'Edit',
'Copy',
'Flatten',
+ 'Resync',
'Delete',
'Move to Trash',
'Remove Scheduling'
primary: { multiple: 'Create', executing: 'Edit', single: 'Edit', no: 'Create' }
},
'create,update': {
- actions: ['Create', 'Edit', 'Copy', 'Flatten', 'Remove Scheduling'],
+ actions: ['Create', 'Edit', 'Copy', 'Flatten', 'Resync', 'Remove Scheduling'],
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', 'Delete', 'Move to Trash', 'Remove Scheduling'],
+ actions: ['Edit', 'Flatten', 'Resync', 'Delete', 'Move to Trash', 'Remove Scheduling'],
primary: { multiple: 'Edit', executing: 'Edit', single: 'Edit', no: 'Edit' }
},
update: {
- actions: ['Edit', 'Flatten', 'Remove Scheduling'],
+ actions: ['Edit', 'Flatten', 'Resync', 'Remove Scheduling'],
primary: { multiple: 'Edit', executing: 'Edit', single: 'Edit', no: 'Edit' }
},
delete: {
name: this.actionLabels.DELETE,
disable: (selection: CdTableSelection) => this.getDeleteDisableDesc(selection)
};
+ const resyncAction: CdTableAction = {
+ permission: 'update',
+ icon: Icons.refresh,
+ click: () => this.resyncRbdModal(),
+ name: this.actionLabels.RESYNC,
+ disable: (selection: CdTableSelection) => this.getResyncDisableDesc(selection)
+ };
const copyAction: CdTableAction = {
permission: 'create',
canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection,
editAction,
copyAction,
flattenAction,
+ resyncAction,
deleteAction,
moveAction,
removeSchedulingAction
});
}
+ resyncRbdModal() {
+ const poolName = this.selection.first().pool_name;
+ const namespace = this.selection.first().namespace;
+ const imageName = this.selection.first().name;
+ const imageSpec = new ImageSpec(poolName, namespace, imageName);
+
+ this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+ itemDescription: 'RBD',
+ itemNames: [imageSpec],
+ actionDescription: 'resync',
+ submitActionObservable: () =>
+ this.taskWrapper.wrapTaskAroundCall({
+ task: new FinishedTask('rbd/edit', {
+ image_spec: imageSpec.toString()
+ }),
+ call: this.rbdService.update(imageSpec, { resync: true })
+ })
+ });
+ }
+
trashRbdModal() {
const initialState = {
poolName: this.selection.first().pool_name,
return this.getInvalidNameDisable(selection) || this.hasClonedSnapshots(selection.first());
}
+ getResyncDisableDesc(selection: CdTableSelection): string | boolean {
+ const first = selection.first();
+
+ if (first && this.imageIsPrimary(first)) {
+ return $localize`Primary RBD images cannot be resynced`;
+ }
+
+ return this.getInvalidNameDisable(selection);
+ }
+
+ imageIsPrimary(image: object) {
+ return image['primary'];
+ }
getInvalidNameDisable(selection: CdTableSelection): string | boolean {
const first = selection.first();