import React from 'react'; import { Dropdown, MenuItem } from 'react-bootstrap'; import type { ILoadBalancerActionsProps } from '@spinnaker/core'; import { AddEntityTagLinks, robotToHuman, SETTINGS, useModal } from '@spinnaker/core'; import type { IKubernetesLoadBalancerView } from '../../interfaces'; import { KubernetesManifestCommandBuilder } from '../../manifest'; import { DeleteModal } from '../../manifest/delete/DeleteModal'; import { ManifestWizard } from '../../manifest/wizard/ManifestWizard'; export interface IKubernetesLoadBalancerActionsProps extends ILoadBalancerActionsProps { loadBalancer: IKubernetesLoadBalancerView; } export function KubernetesLoadBalancerActions({ app, loadBalancer }: IKubernetesLoadBalancerActionsProps) { const showEntityTags = SETTINGS.feature && SETTINGS.feature.entityTags; const isEnabled = SETTINGS.kubernetesAdHocInfraWritesEnabled; const { manifest } = loadBalancer; const deleteModal = useModal(); const editLoadBalancer = (): void => { KubernetesManifestCommandBuilder.buildNewManifestCommand( app, manifest.manifest, loadBalancer.moniker, loadBalancer.account, ).then((builtCommand) => { ManifestWizard.show({ title: 'Edit Manifest', application: app, command: builtCommand }); }); }; return ( <> {isEnabled && ( {robotToHuman(loadBalancer.kind)} Actions )} Delete Edit {showEntityTags && ( app.loadBalancers.refresh()} /> )} ); }