mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 05:15:25 +02:00
feat(helm): show manifest previews/changes when installing and upgrading a helm chart [r8s-405] (#898)
This commit is contained in:
parent
a4cff13531
commit
60bc04bc33
41 changed files with 763 additions and 157 deletions
|
@ -1,39 +0,0 @@
|
|||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { withGlobalError, withInvalidate } from '@/react-tools/react-query';
|
||||
import { queryKeys as applicationsQueryKeys } from '@/react/kubernetes/applications/queries/query-keys';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
||||
export function useUninstallHelmAppMutation(environmentId: EnvironmentId) {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
releaseName,
|
||||
namespace,
|
||||
}: {
|
||||
releaseName: string;
|
||||
namespace?: string;
|
||||
}) => uninstallHelmApplication(environmentId, releaseName, namespace),
|
||||
...withInvalidate(queryClient, [
|
||||
applicationsQueryKeys.applications(environmentId),
|
||||
]),
|
||||
...withGlobalError('Unable to uninstall helm application'),
|
||||
});
|
||||
}
|
||||
|
||||
export async function uninstallHelmApplication(
|
||||
environmentId: EnvironmentId,
|
||||
releaseName: string,
|
||||
namespace?: string
|
||||
) {
|
||||
try {
|
||||
await axios.delete(
|
||||
`/endpoints/${environmentId}/kubernetes/helm/${releaseName}`,
|
||||
{ params: { namespace } }
|
||||
);
|
||||
} catch (error) {
|
||||
// parseAxiosError, because it's a regular portainer api error
|
||||
throw parseAxiosError(error, 'Unable to remove application');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue