1 import { I18n } from '@ngx-translate/i18n-polyfill';
3 import { CdTableAction } from '../../../shared/models/cd-table-action';
4 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
6 export class RbdSnapshotActionsModel {
10 rename: CdTableAction;
11 protect: CdTableAction;
12 unprotect: CdTableAction;
15 rollback: CdTableAction;
16 deleteSnap: CdTableAction;
17 ordering: CdTableAction[];
19 constructor(i18n: I18n) {
25 name: this.i18n('Create')
30 name: this.i18n('Rename')
35 visible: (selection: CdTableSelection) =>
36 selection.hasSingleSelection && !selection.first().is_protected,
37 name: this.i18n('Protect')
42 visible: (selection: CdTableSelection) =>
43 selection.hasSingleSelection && selection.first().is_protected,
44 name: this.i18n('Unprotect')
48 canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection,
49 disable: (selection: CdTableSelection) =>
50 !selection.hasSingleSelection || selection.first().cdExecuting,
52 name: this.i18n('Clone')
56 canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection,
57 disable: (selection: CdTableSelection) =>
58 !selection.hasSingleSelection || selection.first().cdExecuting,
60 name: this.i18n('Copy')
65 name: this.i18n('Rollback')
70 disable: (selection: CdTableSelection) => {
71 const first = selection.first();
72 return !selection.hasSingleSelection || first.cdExecuting || first.is_protected;
74 name: this.i18n('Delete')