enable_mirror?: boolean;
mirror_mode?: string;
+ primary?: boolean;
schedule_interval: string;
remove_scheduling? = false;
}
</ng-template>
<ng-template #mirroringTpl
- let-value="value">
+ let-value="value"
+ let-row="row">
<span *ngIf="value.length === 3; else probb"
class="badge badge-info">{{ value[0] }}</span>
<span *ngIf="value.length === 3"
class="badge badge-info"
[ngbTooltip]="'Next scheduled snapshot on' + ' ' + (value[2] | cdDate)">{{ value[1] }}</span>
+ <span *ngIf="row.primary === true"
+ class="badge badge-info"
+ i18n>primary</span>
+ <span *ngIf="row.primary === false"
+ class="badge badge-info"
+ i18n>secondary</span>
<ng-template #probb>
<span class="badge badge-info">{{ value }}</span>
</ng-template>
'Resync',
'Delete',
'Move to Trash',
- 'Remove Scheduling'
+ 'Remove Scheduling',
+ 'Promote',
+ 'Demote'
],
primary: { multiple: 'Create', executing: 'Edit', single: 'Edit', no: 'Create' }
},
'create,update': {
- actions: ['Create', 'Edit', 'Copy', 'Flatten', 'Resync', 'Remove Scheduling'],
+ actions: [
+ 'Create',
+ 'Edit',
+ 'Copy',
+ 'Flatten',
+ 'Resync',
+ 'Remove Scheduling',
+ 'Promote',
+ 'Demote'
+ ],
primary: { multiple: 'Create', executing: 'Edit', single: 'Edit', no: 'Create' }
},
'create,delete': {
primary: { multiple: 'Create', executing: 'Copy', single: 'Copy', no: 'Create' }
},
'update,delete': {
- actions: ['Edit', 'Flatten', 'Resync', 'Delete', 'Move to Trash', 'Remove Scheduling'],
+ actions: [
+ 'Edit',
+ 'Flatten',
+ 'Resync',
+ 'Delete',
+ 'Move to Trash',
+ 'Remove Scheduling',
+ 'Promote',
+ 'Demote'
+ ],
primary: { multiple: 'Edit', executing: 'Edit', single: 'Edit', no: 'Edit' }
},
update: {
- actions: ['Edit', 'Flatten', 'Resync', 'Remove Scheduling'],
+ actions: ['Edit', 'Flatten', 'Resync', 'Remove Scheduling', 'Promote', 'Demote'],
primary: { multiple: 'Edit', executing: 'Edit', single: 'Edit', no: 'Edit' }
},
delete: {
this.getInvalidNameDisable(selection) ||
selection.first().schedule_info === undefined
};
+ const promoteAction: CdTableAction = {
+ permission: 'update',
+ icon: Icons.edit,
+ click: () => this.actionPrimary(true),
+ name: this.actionLabels.PROMOTE,
+ visible: () => this.selection.first() != null && !this.selection.first().primary
+ };
+ const demoteAction: CdTableAction = {
+ permission: 'update',
+ icon: Icons.edit,
+ click: () => this.actionPrimary(false),
+ name: this.actionLabels.DEMOTE,
+ visible: () => this.selection.first() != null && this.selection.first().primary
+ };
this.tableActions = [
addAction,
editAction,
resyncAction,
deleteAction,
moveAction,
- removeSchedulingAction
+ removeSchedulingAction,
+ promoteAction,
+ demoteAction
];
}
});
}
+ actionPrimary(primary: boolean) {
+ const request = new RbdFormEditRequestModel();
+ request.primary = primary;
+ const imageSpec = new ImageSpec(
+ this.selection.first().pool_name,
+ this.selection.first().namespace,
+ this.selection.first().name
+ );
+ this.taskWrapper
+ .wrapTaskAroundCall({
+ task: new FinishedTask('rbd/edit', {
+ image_spec: imageSpec.toString()
+ }),
+ call: this.rbdService.update(imageSpec, request)
+ })
+ .subscribe();
+ }
+
hasSnapshots() {
const snapshots = this.selection.first()['snapshots'] || [];
return snapshots.length > 0;
</div>
</div>
</div>
- </ng-template>
</div>
</div>
this.message = history.state.message;
this.header = history.state.header;
this.section = history.state.section;
-<<<<<<< HEAD
this.section_info = history.state.section_info;
this.button_name = history.state.button_name;
this.button_route = history.state.button_route;
-=======
- this.sectionInfo = history.state.section_info;
->>>>>>> 5b33f500f5d (mgr/dashboard: Error page cleanup)
this.icon = history.state.icon;
this.source = history.state.source;
this.uiConfig = history.state.uiConfig;
ENTER_MAINTENANCE: string;
EXIT_MAINTENANCE: string;
REMOVE_SCHEDULING: string;
+ PROMOTE: string;
+ DEMOTE: string;
START_DRAIN: string;
STOP_DRAIN: string;
START: string;
this.RESTART = $localize`Restart`;
this.REMOVE_SCHEDULING = $localize`Remove Scheduling`;
+ this.PROMOTE = $localize`Promote`;
+ this.DEMOTE = $localize`Demote`;
}
}