Skip to content

Commit

Permalink
Merge pull request #5388 from yaacov/update-vm-templates-kebab-action…
Browse files Browse the repository at this point in the history
…-labels

Bug 1834260: Update vm teamplates kebab lables
  • Loading branch information
openshift-merge-robot committed May 11, 2020
2 parents 46d6b47 + 309d2bc commit a4f395c
Showing 1 changed file with 18 additions and 3 deletions.
@@ -1,12 +1,13 @@
import { getName, getNamespace } from '@console/shared';
import { K8sKind, TemplateKind } from '@console/internal/module/k8s';
import { asAccessReview, Kebab } from '@console/internal/components/utils';
import { asAccessReview, Kebab, KebabOption } from '@console/internal/components/utils';
import { deleteModal } from '@console/internal/components/modals/delete-modal';
import { VMWizardName, VMWizardMode } from '../../constants/vm';
import { VirtualMachineModel } from '../../models';
import { getVMWizardCreateLink } from '../../utils/url';

const vmTemplateEditAction = (kind: K8sKind, obj: TemplateKind) => ({
label: `Edit VM Template`,
label: `Edit Virtual Machine Template`,
href: `/k8s/ns/${getNamespace(obj)}/vmtemplates/${getName(obj)}/yaml`,
accessReview: asAccessReview(kind, obj, 'update'),
});
Expand All @@ -22,10 +23,24 @@ const vmTemplateCreateVMAction = (kind: K8sKind, obj: TemplateKind) => ({
accessReview: { model: VirtualMachineModel, namespace: getNamespace(obj), verb: 'create' },
});

export const menuActionDeleteVMTemplate = (
kindObj: K8sKind,
vmTempalte: TemplateKind,
): KebabOption => ({
label: `Delete Virtual Machine Template`,
callback: () =>
deleteModal({
kind: kindObj,
resource: vmTempalte,
redirectTo: `/k8s/ns/${getNamespace(vmTempalte)}/virtualization/templates`,
}),
accessReview: asAccessReview(kindObj, vmTempalte, 'delete'),
});

export const menuActions = [
Kebab.factory.ModifyLabels,
Kebab.factory.ModifyAnnotations,
vmTemplateEditAction,
vmTemplateCreateVMAction,
Kebab.factory.Delete,
menuActionDeleteVMTemplate,
];

0 comments on commit a4f395c

Please sign in to comment.