mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
feat(helm): uninstall helm app from details view [r8s-285] (#648)
This commit is contained in:
parent
6fcf1893d3
commit
bbe94f55b6
5 changed files with 133 additions and 18 deletions
|
@ -0,0 +1,47 @@
|
|||
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 (
|
||||
<DeleteButton
|
||||
size="medium"
|
||||
data-cy="k8sApp-removeHelmChartButton"
|
||||
isLoading={uninstallHelmAppMutation.isLoading}
|
||||
confirmMessage="Do you want to remove the selected Helm chart? This will delete all resources associated with the Helm chart."
|
||||
onConfirmed={handleUninstall}
|
||||
>
|
||||
Uninstall
|
||||
</DeleteButton>
|
||||
);
|
||||
|
||||
function handleUninstall() {
|
||||
uninstallHelmAppMutation.mutate(
|
||||
{ releaseName, namespace },
|
||||
{
|
||||
onSuccess: () => {
|
||||
router.stateService.go('kubernetes.applications', {
|
||||
endpointId: environmentId,
|
||||
});
|
||||
notifySuccess('Success', 'Helm chart uninstalled successfully');
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue