mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
Added bracketSpacing into prettier (#627)
This commit is contained in:
@@ -2,3 +2,4 @@ trailingComma: "es5"
|
|||||||
tabWidth: 2
|
tabWidth: 2
|
||||||
semi: true
|
semi: true
|
||||||
singleQuote: false
|
singleQuote: false
|
||||||
|
bracketSpacing: true
|
||||||
|
|||||||
@@ -6,10 +6,11 @@ import apiService from "./apiService";
|
|||||||
// Get list of kubectl contexts configured locally
|
// Get list of kubectl contexts configured locally
|
||||||
function useGetKubectlContexts(options?: UseQueryOptions<KubectlContexts>) {
|
function useGetKubectlContexts(options?: UseQueryOptions<KubectlContexts>) {
|
||||||
return useQuery<KubectlContexts>({
|
return useQuery<KubectlContexts>({
|
||||||
queryKey:["k8s", "contexts"],
|
queryKey: ["k8s", "contexts"],
|
||||||
queryFn:() => apiService.fetchWithDefaults<KubectlContexts>("/api/k8s/contexts"),
|
queryFn: () =>
|
||||||
...(options ?? {})
|
apiService.fetchWithDefaults<KubectlContexts>("/api/k8s/contexts"),
|
||||||
});
|
...(options ?? {}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get resources information
|
// Get resources information
|
||||||
@@ -21,12 +22,12 @@ function useGetK8sResource(
|
|||||||
) {
|
) {
|
||||||
return useQuery<K8sResource>({
|
return useQuery<K8sResource>({
|
||||||
queryKey: ["k8s", kind, "get", name, namespace],
|
queryKey: ["k8s", kind, "get", name, namespace],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<K8sResource>(
|
apiService.fetchWithDefaults<K8sResource>(
|
||||||
`/api/k8s/${kind}/get?name=${name}&namespace=${namespace}`
|
`/api/k8s/${kind}/get?name=${name}&namespace=${namespace}`
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get list of resources
|
// Get list of resources
|
||||||
@@ -36,10 +37,10 @@ function useGetK8sResourceList(
|
|||||||
) {
|
) {
|
||||||
return useQuery<K8sResourceList>({
|
return useQuery<K8sResourceList>({
|
||||||
queryKey: ["k8s", kind, "list"],
|
queryKey: ["k8s", kind, "list"],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<K8sResourceList>(`/api/k8s/${kind}/list`),
|
apiService.fetchWithDefaults<K8sResourceList>(`/api/k8s/${kind}/list`),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get describe text for kubernetes resource
|
// Get describe text for kubernetes resource
|
||||||
@@ -50,8 +51,8 @@ function useGetK8sResourceDescribe(
|
|||||||
options?: UseQueryOptions<string>
|
options?: UseQueryOptions<string>
|
||||||
) {
|
) {
|
||||||
return useQuery<string>({
|
return useQuery<string>({
|
||||||
queryKey:["k8s", kind, "describe", name, namespace],
|
queryKey: ["k8s", kind, "describe", name, namespace],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<string>(
|
apiService.fetchWithDefaults<string>(
|
||||||
`/api/k8s/${kind}/describe?name=${name}&namespace=${namespace}`,
|
`/api/k8s/${kind}/describe?name=${name}&namespace=${namespace}`,
|
||||||
{
|
{
|
||||||
@@ -60,6 +61,6 @@ function useGetK8sResourceDescribe(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ export function useShutdownHelmDashboard(
|
|||||||
options?: UseMutationOptions<void, Error>
|
options?: UseMutationOptions<void, Error>
|
||||||
) {
|
) {
|
||||||
return useMutation<void, Error>({
|
return useMutation<void, Error>({
|
||||||
mutationFn:() =>
|
mutationFn: () =>
|
||||||
apiService.fetchWithDefaults("/", {
|
apiService.fetchWithDefaults("/", {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
}),
|
}),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets application status
|
// Gets application status
|
||||||
@@ -27,6 +27,6 @@ export function useGetApplicationStatus(
|
|||||||
return useQuery<ApplicationStatus>({
|
return useQuery<ApplicationStatus>({
|
||||||
queryKey: ["status"],
|
queryKey: ["status"],
|
||||||
queryFn: () => apiService.fetchWithDefaults<ApplicationStatus>("/status"),
|
queryFn: () => apiService.fetchWithDefaults<ApplicationStatus>("/status"),
|
||||||
...(options ?? {}),
|
...(options ?? {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ export function useGetInstalledReleases(
|
|||||||
options?: UseQueryOptions<Release[]>
|
options?: UseQueryOptions<Release[]>
|
||||||
) {
|
) {
|
||||||
return useQuery<Release[]>({
|
return useQuery<Release[]>({
|
||||||
queryKey:["installedReleases", context],
|
queryKey: ["installedReleases", context],
|
||||||
queryFn: () => apiService.fetchWithDefaults<Release[]>("/api/helm/releases"),
|
queryFn: () =>
|
||||||
...(options ?? {})}
|
apiService.fetchWithDefaults<Release[]>("/api/helm/releases"),
|
||||||
);
|
...(options ?? {}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReleaseManifest {
|
export interface ReleaseManifest {
|
||||||
@@ -63,13 +64,13 @@ export function useGetReleaseManifest({
|
|||||||
options?: UseQueryOptions<ReleaseManifest[]>;
|
options?: UseQueryOptions<ReleaseManifest[]>;
|
||||||
}) {
|
}) {
|
||||||
return useQuery<ReleaseManifest[]>({
|
return useQuery<ReleaseManifest[]>({
|
||||||
queryKey:["manifest", namespace, chartName],
|
queryKey: ["manifest", namespace, chartName],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<ReleaseManifest[]>(
|
apiService.fetchWithDefaults<ReleaseManifest[]>(
|
||||||
`/api/helm/releases/${namespace}/${chartName}/manifests`
|
`/api/helm/releases/${namespace}/${chartName}/manifests`
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of installed k8s resources for this release
|
// List of installed k8s resources for this release
|
||||||
@@ -79,13 +80,13 @@ export function useGetResources(
|
|||||||
options?: UseQueryOptions<StructuredResources[]>
|
options?: UseQueryOptions<StructuredResources[]>
|
||||||
) {
|
) {
|
||||||
const { data, ...rest } = useQuery<StructuredResources[]>({
|
const { data, ...rest } = useQuery<StructuredResources[]>({
|
||||||
queryKey:["resources", ns, name],
|
queryKey: ["resources", ns, name],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<StructuredResources[]>(
|
apiService.fetchWithDefaults<StructuredResources[]>(
|
||||||
`/api/helm/releases/${ns}/${name}/resources?health=true`
|
`/api/helm/releases/${ns}/${name}/resources?health=true`
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: data
|
data: data
|
||||||
@@ -116,29 +117,29 @@ export function useGetResourceDescription(
|
|||||||
options?: UseQueryOptions<string>
|
options?: UseQueryOptions<string>
|
||||||
) {
|
) {
|
||||||
return useQuery<string>({
|
return useQuery<string>({
|
||||||
queryKey:["describe", type, ns, name],
|
queryKey: ["describe", type, ns, name],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<string>(
|
apiService.fetchWithDefaults<string>(
|
||||||
`/api/k8s/${type}/describe?name=${name}&namespace=${ns}`,
|
`/api/k8s/${type}/describe?name=${name}&namespace=${ns}`,
|
||||||
{
|
{
|
||||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
export function useGetLatestVersion(
|
export function useGetLatestVersion(
|
||||||
chartName: string,
|
chartName: string,
|
||||||
options?: UseQueryOptions<ChartVersion[]>
|
options?: UseQueryOptions<ChartVersion[]>
|
||||||
) {
|
) {
|
||||||
return useQuery<ChartVersion[]>({
|
return useQuery<ChartVersion[]>({
|
||||||
queryKey:["latestver", chartName],
|
queryKey: ["latestver", chartName],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<ChartVersion[]>(
|
apiService.fetchWithDefaults<ChartVersion[]>(
|
||||||
`/api/helm/repositories/latestver?name=${chartName}`
|
`/api/helm/repositories/latestver?name=${chartName}`
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
export function useGetVersions(
|
export function useGetVersions(
|
||||||
chartName: string,
|
chartName: string,
|
||||||
@@ -150,8 +151,8 @@ export function useGetVersions(
|
|||||||
apiService.fetchWithDefaults<LatestChartVersion[]>(
|
apiService.fetchWithDefaults<LatestChartVersion[]>(
|
||||||
`/api/helm/repositories/versions?name=${chartName}`
|
`/api/helm/repositories/versions?name=${chartName}`
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useGetReleaseInfoByType(
|
export function useGetReleaseInfoByType(
|
||||||
@@ -161,16 +162,16 @@ export function useGetReleaseInfoByType(
|
|||||||
) {
|
) {
|
||||||
const { chart, namespace, tab, revision } = params;
|
const { chart, namespace, tab, revision } = params;
|
||||||
return useQuery<string>({
|
return useQuery<string>({
|
||||||
queryKey:[tab, namespace, chart, revision, additionalParams],
|
queryKey: [tab, namespace, chart, revision, additionalParams],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<string>(
|
apiService.fetchWithDefaults<string>(
|
||||||
`/api/helm/releases/${namespace}/${chart}/${tab}?revision=${revision}${additionalParams}`,
|
`/api/helm/releases/${namespace}/${chart}/${tab}?revision=${revision}${additionalParams}`,
|
||||||
{
|
{
|
||||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useGetDiff(
|
export function useGetDiff(
|
||||||
@@ -178,16 +179,16 @@ export function useGetDiff(
|
|||||||
options?: UseQueryOptions<string>
|
options?: UseQueryOptions<string>
|
||||||
) {
|
) {
|
||||||
return useQuery<string>({
|
return useQuery<string>({
|
||||||
queryKey:["diff", formData],
|
queryKey: ["diff", formData],
|
||||||
queryFn:() => {
|
queryFn: () => {
|
||||||
return apiService.fetchWithDefaults<string>("/diff", {
|
return apiService.fetchWithDefaults<string>("/diff", {
|
||||||
body: formData,
|
body: formData,
|
||||||
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rollback the release to a previous revision
|
// Rollback the release to a previous revision
|
||||||
@@ -202,18 +203,21 @@ export function useRollbackRelease(
|
|||||||
void,
|
void,
|
||||||
unknown,
|
unknown,
|
||||||
{ ns: string; name: string; revision: number }
|
{ ns: string; name: string; revision: number }
|
||||||
>({mutationFn:({ ns, name, revision }) => {
|
>({
|
||||||
const formData = new FormData();
|
mutationFn: ({ ns, name, revision }) => {
|
||||||
formData.append("revision", revision.toString());
|
const formData = new FormData();
|
||||||
|
formData.append("revision", revision.toString());
|
||||||
|
|
||||||
return apiService.fetchWithDefaults<void>(
|
return apiService.fetchWithDefaults<void>(
|
||||||
`/api/helm/releases/${ns}/${name}/rollback`,
|
`/api/helm/releases/${ns}/${name}/rollback`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}, ...(options ?? {})});
|
},
|
||||||
|
...(options ?? {}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the tests on a release
|
// Run the tests on a release
|
||||||
@@ -221,7 +225,7 @@ export function useTestRelease(
|
|||||||
options?: UseMutationOptions<void, unknown, { ns: string; name: string }>
|
options?: UseMutationOptions<void, unknown, { ns: string; name: string }>
|
||||||
) {
|
) {
|
||||||
return useMutation<void, unknown, { ns: string; name: string }>({
|
return useMutation<void, unknown, { ns: string; name: string }>({
|
||||||
mutationFn:({ ns, name }) => {
|
mutationFn: ({ ns, name }) => {
|
||||||
return apiService.fetchWithDefaults<void>(
|
return apiService.fetchWithDefaults<void>(
|
||||||
`/api/helm/releases/${ns}/${name}/test`,
|
`/api/helm/releases/${ns}/${name}/test`,
|
||||||
{
|
{
|
||||||
@@ -229,8 +233,8 @@ export function useTestRelease(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useChartReleaseValues({
|
export function useChartReleaseValues({
|
||||||
@@ -249,8 +253,8 @@ export function useChartReleaseValues({
|
|||||||
options?: UseQueryOptions<unknown>;
|
options?: UseQueryOptions<unknown>;
|
||||||
}) {
|
}) {
|
||||||
return useQuery<unknown>({
|
return useQuery<unknown>({
|
||||||
queryKey:["values", namespace, release, userDefinedValue, version],
|
queryKey: ["values", namespace, release, userDefinedValue, version],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<unknown>(
|
apiService.fetchWithDefaults<unknown>(
|
||||||
`/api/helm/releases/${namespace}/${release}/values?${"userDefined=true"}${
|
`/api/helm/releases/${namespace}/${release}/values?${"userDefined=true"}${
|
||||||
revision ? `&revision=${revision}` : ""
|
revision ? `&revision=${revision}` : ""
|
||||||
@@ -259,8 +263,8 @@ export function useChartReleaseValues({
|
|||||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useVersionData = ({
|
export const useVersionData = ({
|
||||||
@@ -315,7 +319,7 @@ export const useVersionData = ({
|
|||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
...(options ?? {})
|
...(options ?? {}),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ export function useGetRepositories(
|
|||||||
options?: UseQueryOptions<HelmRepositories>
|
options?: UseQueryOptions<HelmRepositories>
|
||||||
) {
|
) {
|
||||||
return useQuery<HelmRepositories>({
|
return useQuery<HelmRepositories>({
|
||||||
queryKey:["helm", "repositories"],
|
queryKey: ["helm", "repositories"],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<HelmRepositories>("/api/helm/repositories"),
|
apiService.fetchWithDefaults<HelmRepositories>("/api/helm/repositories"),
|
||||||
...(options ?? {})
|
...(options ?? {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,14 +24,17 @@ export function useUpdateRepo(
|
|||||||
repo: string,
|
repo: string,
|
||||||
options?: UseMutationOptions<void, unknown, void>
|
options?: UseMutationOptions<void, unknown, void>
|
||||||
) {
|
) {
|
||||||
return useMutation<void, unknown, void>({ mutationFn:() => {
|
return useMutation<void, unknown, void>({
|
||||||
return apiService.fetchWithDefaults<void>(
|
mutationFn: () => {
|
||||||
`/api/helm/repositories/${repo}`,
|
return apiService.fetchWithDefaults<void>(
|
||||||
{
|
`/api/helm/repositories/${repo}`,
|
||||||
method: "POST",
|
{
|
||||||
}
|
method: "POST",
|
||||||
);
|
}
|
||||||
}, ...(options ?? {})});
|
);
|
||||||
|
},
|
||||||
|
...(options ?? {}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove repository
|
// Remove repository
|
||||||
@@ -39,14 +42,17 @@ export function useDeleteRepo(
|
|||||||
repo: string,
|
repo: string,
|
||||||
options?: UseMutationOptions<void, unknown, void>
|
options?: UseMutationOptions<void, unknown, void>
|
||||||
) {
|
) {
|
||||||
return useMutation<void, unknown, void>({mutationFn:() => {
|
return useMutation<void, unknown, void>({
|
||||||
return apiService.fetchWithDefaults<void>(
|
mutationFn: () => {
|
||||||
`/api/helm/repositories/${repo}`,
|
return apiService.fetchWithDefaults<void>(
|
||||||
{
|
`/api/helm/repositories/${repo}`,
|
||||||
method: "DELETE",
|
{
|
||||||
}
|
method: "DELETE",
|
||||||
);
|
}
|
||||||
}, ...(options ?? {})});
|
);
|
||||||
|
},
|
||||||
|
...(options ?? {}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useChartRepoValues({
|
export function useChartRepoValues({
|
||||||
@@ -57,15 +63,14 @@ export function useChartRepoValues({
|
|||||||
chart: string;
|
chart: string;
|
||||||
}) {
|
}) {
|
||||||
return useQuery<string>({
|
return useQuery<string>({
|
||||||
queryKey:["helm", "repositories", "values", chart, version],
|
queryKey: ["helm", "repositories", "values", chart, version],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<string>(
|
apiService.fetchWithDefaults<string>(
|
||||||
`/api/helm/repositories/values?chart=${chart}&version=${version}`,
|
`/api/helm/repositories/values?chart=${chart}&version=${version}`,
|
||||||
{
|
{
|
||||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
enabled: Boolean(version) && Boolean(chart),
|
enabled: Boolean(version) && Boolean(chart),
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import apiService from "./apiService";
|
|||||||
function useGetDiscoveredScanners(options?: UseQueryOptions<ScannersList>) {
|
function useGetDiscoveredScanners(options?: UseQueryOptions<ScannersList>) {
|
||||||
return useQuery<ScannersList>({
|
return useQuery<ScannersList>({
|
||||||
queryKey: ["scanners"],
|
queryKey: ["scanners"],
|
||||||
queryFn:() => apiService.fetchWithDefaults<ScannersList>("/api/scanners"),
|
queryFn: () => apiService.fetchWithDefaults<ScannersList>("/api/scanners"),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan manifests using all applicable scanners
|
// Scan manifests using all applicable scanners
|
||||||
@@ -27,13 +27,13 @@ function useScanManifests(
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("manifest", manifest);
|
formData.append("manifest", manifest);
|
||||||
return useMutation<ScanResults, Error, string>({
|
return useMutation<ScanResults, Error, string>({
|
||||||
mutationFn:() =>
|
mutationFn: () =>
|
||||||
apiService.fetchWithDefaults<ScanResults>("/api/scanners/manifests", {
|
apiService.fetchWithDefaults<ScanResults>("/api/scanners/manifests", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
}),
|
}),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan specified k8s resource in cluster
|
// Scan specified k8s resource in cluster
|
||||||
@@ -43,12 +43,12 @@ function useScanK8sResource(
|
|||||||
name: string,
|
name: string,
|
||||||
options?: UseQueryOptions<ScanResults>
|
options?: UseQueryOptions<ScanResults>
|
||||||
) {
|
) {
|
||||||
return useQuery<ScanResults>({queryKey:
|
return useQuery<ScanResults>({
|
||||||
["scanners", "resource", kind, namespace, name],
|
queryKey: ["scanners", "resource", kind, namespace, name],
|
||||||
queryFn:() =>
|
queryFn: () =>
|
||||||
apiService.fetchWithDefaults<ScanResults>(
|
apiService.fetchWithDefaults<ScanResults>(
|
||||||
`/api/scanners/resource/${kind}?namespace=${namespace}&name=${name}`
|
`/api/scanners/resource/${kind}?namespace=${namespace}&name=${name}`
|
||||||
),
|
),
|
||||||
...(options ?? {})}
|
...(options ?? {}),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,13 @@ export const useDiffData = ({
|
|||||||
chart: string;
|
chart: string;
|
||||||
}) => {
|
}) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: [selectedRepo, versionsError, chart, currentVerManifest, selectedVerData],
|
queryKey: [
|
||||||
|
selectedRepo,
|
||||||
|
versionsError,
|
||||||
|
chart,
|
||||||
|
currentVerManifest,
|
||||||
|
selectedVerData,
|
||||||
|
],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("a", currentVerManifest);
|
formData.append("a", currentVerManifest);
|
||||||
@@ -58,6 +64,5 @@ export const useDiffData = ({
|
|||||||
return diff;
|
return diff;
|
||||||
},
|
},
|
||||||
enabled: Boolean(selectedVerData),
|
enabled: Boolean(selectedVerData),
|
||||||
}
|
});
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -130,8 +130,8 @@ export const InstallReleaseChartModal = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Confirm method (install)
|
// Confirm method (install)
|
||||||
const setReleaseVersionMutation = useMutation(
|
const setReleaseVersionMutation = useMutation({
|
||||||
{mutationKey:[
|
mutationKey: [
|
||||||
"setVersion",
|
"setVersion",
|
||||||
namespace,
|
namespace,
|
||||||
releaseName,
|
releaseName,
|
||||||
@@ -140,7 +140,7 @@ export const InstallReleaseChartModal = ({
|
|||||||
selectedCluster,
|
selectedCluster,
|
||||||
chartAddress,
|
chartAddress,
|
||||||
],
|
],
|
||||||
mutationFn:async () => {
|
mutationFn: async () => {
|
||||||
setInstallError("");
|
setInstallError("");
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("preview", "false");
|
formData.append("preview", "false");
|
||||||
@@ -161,21 +161,20 @@ export const InstallReleaseChartModal = ({
|
|||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
onSuccess: async (response) => {
|
onSuccess: async (response) => {
|
||||||
onClose();
|
onClose();
|
||||||
setSelectedVersionData({ version: "", urls: [] }); //cleanup
|
setSelectedVersionData({ version: "", urls: [] }); //cleanup
|
||||||
navigate(
|
navigate(
|
||||||
`/${
|
`/${
|
||||||
namespace ? namespace : "default"
|
namespace ? namespace : "default"
|
||||||
}/${releaseName}/installed/revision/${response.version}`
|
}/${releaseName}/installed/revision/${response.version}`
|
||||||
);
|
);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
setInstallError((error as Error)?.message || "Failed to update");
|
setInstallError((error as Error)?.message || "Failed to update");
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ export const InstallRepoChartModal = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Confirm method (install)
|
// Confirm method (install)
|
||||||
const setReleaseVersionMutation = useMutation(
|
const setReleaseVersionMutation = useMutation({
|
||||||
{mutationKey:[
|
mutationKey: [
|
||||||
"setVersion",
|
"setVersion",
|
||||||
namespace,
|
namespace,
|
||||||
releaseName,
|
releaseName,
|
||||||
@@ -122,7 +122,7 @@ export const InstallRepoChartModal = ({
|
|||||||
selectedCluster,
|
selectedCluster,
|
||||||
chartAddress,
|
chartAddress,
|
||||||
],
|
],
|
||||||
mutationFn:async () => {
|
mutationFn: async () => {
|
||||||
setInstallError("");
|
setInstallError("");
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("preview", "false");
|
formData.append("preview", "false");
|
||||||
@@ -140,17 +140,14 @@ export const InstallRepoChartModal = ({
|
|||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
onSuccess: async (response) => {
|
onSuccess: async (response) => {
|
||||||
onClose();
|
onClose();
|
||||||
navigate(
|
navigate(`/${response.namespace}/${response.name}/installed/revision/1`);
|
||||||
`/${response.namespace}/${response.name}/installed/revision/1`
|
},
|
||||||
);
|
onError: (error) => {
|
||||||
},
|
setInstallError((error as Error)?.message || "Failed to update");
|
||||||
onError: (error) => {
|
},
|
||||||
setInstallError((error as Error)?.message || "Failed to update");
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
|||||||
@@ -458,20 +458,19 @@ const Uninstall = () => {
|
|||||||
enabled: isOpen,
|
enabled: isOpen,
|
||||||
});
|
});
|
||||||
|
|
||||||
const uninstallMutation = useMutation(
|
const uninstallMutation = useMutation({
|
||||||
{mutationKey:["uninstall", namespace, chart],
|
mutationKey: ["uninstall", namespace, chart],
|
||||||
mutationFn:() =>
|
mutationFn: () =>
|
||||||
apiService.fetchWithDefaults(
|
apiService.fetchWithDefaults(
|
||||||
"/api/helm/releases/" + namespace + "/" + chart,
|
"/api/helm/releases/" + namespace + "/" + chart,
|
||||||
{
|
{
|
||||||
method: "delete",
|
method: "delete",
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
window.location.href = "/";
|
window.location.href = "/";
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
const uninstallTitle = (
|
const uninstallTitle = (
|
||||||
<div className="font-semibold text-lg">
|
<div className="font-semibold text-lg">
|
||||||
Uninstall <span className="text-red-500">{chart}</span> from namespace{" "}
|
Uninstall <span className="text-red-500">{chart}</span> from namespace{" "}
|
||||||
|
|||||||
Reference in New Issue
Block a user