import { useRouter } from '@uirouter/react'; import { EnvironmentId } from '@/react/portainer/environments/types'; import { notifySuccess } from '@/portainer/services/notifications'; import { DeleteButton } from '@@/buttons/DeleteButton'; import { useUninstallHelmAppMutation } from '../queries/useUninstallHelmAppMutation'; export function UninstallButton({ environmentId, releaseName, namespace, }: { environmentId: EnvironmentId; releaseName: string; namespace?: string; }) { const uninstallHelmAppMutation = useUninstallHelmAppMutation(environmentId); const router = useRouter(); return ( Uninstall ); function handleUninstall() { uninstallHelmAppMutation.mutate( { releaseName, namespace }, { onSuccess: () => { router.stateService.go('kubernetes.applications', { endpointId: environmentId, }); notifySuccess('Success', 'Helm chart uninstalled successfully'); }, } ); } }