mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 03:38:04 +00:00
Added bracketSpacing into prettier (#627)
This commit is contained in:
@@ -2,3 +2,4 @@ trailingComma: "es5"
|
||||
tabWidth: 2
|
||||
semi: true
|
||||
singleQuote: false
|
||||
bracketSpacing: true
|
||||
|
||||
@@ -7,8 +7,9 @@ import apiService from "./apiService";
|
||||
function useGetKubectlContexts(options?: UseQueryOptions<KubectlContexts>) {
|
||||
return useQuery<KubectlContexts>({
|
||||
queryKey: ["k8s", "contexts"],
|
||||
queryFn:() => apiService.fetchWithDefaults<KubectlContexts>("/api/k8s/contexts"),
|
||||
...(options ?? {})
|
||||
queryFn: () =>
|
||||
apiService.fetchWithDefaults<KubectlContexts>("/api/k8s/contexts"),
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,8 +26,8 @@ function useGetK8sResource(
|
||||
apiService.fetchWithDefaults<K8sResource>(
|
||||
`/api/k8s/${kind}/get?name=${name}&namespace=${namespace}`
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// Get list of resources
|
||||
@@ -38,8 +39,8 @@ function useGetK8sResourceList(
|
||||
queryKey: ["k8s", kind, "list"],
|
||||
queryFn: () =>
|
||||
apiService.fetchWithDefaults<K8sResourceList>(`/api/k8s/${kind}/list`),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// Get describe text for kubernetes resource
|
||||
@@ -60,6 +61,6 @@ function useGetK8sResourceDescribe(
|
||||
},
|
||||
}
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ export function useShutdownHelmDashboard(
|
||||
apiService.fetchWithDefaults("/", {
|
||||
method: "DELETE",
|
||||
}),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// Gets application status
|
||||
|
||||
@@ -16,9 +16,10 @@ export function useGetInstalledReleases(
|
||||
) {
|
||||
return useQuery<Release[]>({
|
||||
queryKey: ["installedReleases", context],
|
||||
queryFn: () => apiService.fetchWithDefaults<Release[]>("/api/helm/releases"),
|
||||
...(options ?? {})}
|
||||
);
|
||||
queryFn: () =>
|
||||
apiService.fetchWithDefaults<Release[]>("/api/helm/releases"),
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
export interface ReleaseManifest {
|
||||
@@ -68,8 +69,8 @@ export function useGetReleaseManifest({
|
||||
apiService.fetchWithDefaults<ReleaseManifest[]>(
|
||||
`/api/helm/releases/${namespace}/${chartName}/manifests`
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// List of installed k8s resources for this release
|
||||
@@ -84,8 +85,8 @@ export function useGetResources(
|
||||
apiService.fetchWithDefaults<StructuredResources[]>(
|
||||
`/api/helm/releases/${ns}/${name}/resources?health=true`
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
|
||||
return {
|
||||
data: data
|
||||
@@ -124,8 +125,8 @@ export function useGetResourceDescription(
|
||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||
}
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
export function useGetLatestVersion(
|
||||
chartName: string,
|
||||
@@ -137,8 +138,8 @@ export function useGetLatestVersion(
|
||||
apiService.fetchWithDefaults<ChartVersion[]>(
|
||||
`/api/helm/repositories/latestver?name=${chartName}`
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
export function useGetVersions(
|
||||
chartName: string,
|
||||
@@ -150,8 +151,8 @@ export function useGetVersions(
|
||||
apiService.fetchWithDefaults<LatestChartVersion[]>(
|
||||
`/api/helm/repositories/versions?name=${chartName}`
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
export function useGetReleaseInfoByType(
|
||||
@@ -169,8 +170,8 @@ export function useGetReleaseInfoByType(
|
||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||
}
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
export function useGetDiff(
|
||||
@@ -186,8 +187,8 @@ export function useGetDiff(
|
||||
method: "POST",
|
||||
});
|
||||
},
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// Rollback the release to a previous revision
|
||||
@@ -202,7 +203,8 @@ export function useRollbackRelease(
|
||||
void,
|
||||
unknown,
|
||||
{ ns: string; name: string; revision: number }
|
||||
>({mutationFn:({ ns, name, revision }) => {
|
||||
>({
|
||||
mutationFn: ({ ns, name, revision }) => {
|
||||
const formData = new FormData();
|
||||
formData.append("revision", revision.toString());
|
||||
|
||||
@@ -213,7 +215,9 @@ export function useRollbackRelease(
|
||||
body: formData,
|
||||
}
|
||||
);
|
||||
}, ...(options ?? {})});
|
||||
},
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// Run the tests on a release
|
||||
@@ -229,8 +233,8 @@ export function useTestRelease(
|
||||
}
|
||||
);
|
||||
},
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
export function useChartReleaseValues({
|
||||
@@ -259,8 +263,8 @@ export function useChartReleaseValues({
|
||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||
}
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
export const useVersionData = ({
|
||||
@@ -315,7 +319,7 @@ export const useVersionData = ({
|
||||
return data;
|
||||
},
|
||||
|
||||
...(options ?? {})
|
||||
...(options ?? {}),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export function useGetRepositories(
|
||||
queryKey: ["helm", "repositories"],
|
||||
queryFn: () =>
|
||||
apiService.fetchWithDefaults<HelmRepositories>("/api/helm/repositories"),
|
||||
...(options ?? {})
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,14 +24,17 @@ export function useUpdateRepo(
|
||||
repo: string,
|
||||
options?: UseMutationOptions<void, unknown, void>
|
||||
) {
|
||||
return useMutation<void, unknown, void>({ mutationFn:() => {
|
||||
return useMutation<void, unknown, void>({
|
||||
mutationFn: () => {
|
||||
return apiService.fetchWithDefaults<void>(
|
||||
`/api/helm/repositories/${repo}`,
|
||||
{
|
||||
method: "POST",
|
||||
}
|
||||
);
|
||||
}, ...(options ?? {})});
|
||||
},
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// Remove repository
|
||||
@@ -39,14 +42,17 @@ export function useDeleteRepo(
|
||||
repo: string,
|
||||
options?: UseMutationOptions<void, unknown, void>
|
||||
) {
|
||||
return useMutation<void, unknown, void>({mutationFn:() => {
|
||||
return useMutation<void, unknown, void>({
|
||||
mutationFn: () => {
|
||||
return apiService.fetchWithDefaults<void>(
|
||||
`/api/helm/repositories/${repo}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
}
|
||||
);
|
||||
}, ...(options ?? {})});
|
||||
},
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
export function useChartRepoValues({
|
||||
@@ -66,6 +72,5 @@ export function useChartRepoValues({
|
||||
}
|
||||
),
|
||||
enabled: Boolean(version) && Boolean(chart),
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ function useGetDiscoveredScanners(options?: UseQueryOptions<ScannersList>) {
|
||||
return useQuery<ScannersList>({
|
||||
queryKey: ["scanners"],
|
||||
queryFn: () => apiService.fetchWithDefaults<ScannersList>("/api/scanners"),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// Scan manifests using all applicable scanners
|
||||
@@ -32,8 +32,8 @@ function useScanManifests(
|
||||
method: "POST",
|
||||
body: formData,
|
||||
}),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
// Scan specified k8s resource in cluster
|
||||
@@ -43,12 +43,12 @@ function useScanK8sResource(
|
||||
name: string,
|
||||
options?: UseQueryOptions<ScanResults>
|
||||
) {
|
||||
return useQuery<ScanResults>({queryKey:
|
||||
["scanners", "resource", kind, namespace, name],
|
||||
return useQuery<ScanResults>({
|
||||
queryKey: ["scanners", "resource", kind, namespace, name],
|
||||
queryFn: () =>
|
||||
apiService.fetchWithDefaults<ScanResults>(
|
||||
`/api/scanners/resource/${kind}?namespace=${namespace}&name=${name}`
|
||||
),
|
||||
...(options ?? {})}
|
||||
);
|
||||
...(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,7 +44,13 @@ export const useDiffData = ({
|
||||
chart: string;
|
||||
}) => {
|
||||
return useQuery({
|
||||
queryKey: [selectedRepo, versionsError, chart, currentVerManifest, selectedVerData],
|
||||
queryKey: [
|
||||
selectedRepo,
|
||||
versionsError,
|
||||
chart,
|
||||
currentVerManifest,
|
||||
selectedVerData,
|
||||
],
|
||||
queryFn: async () => {
|
||||
const formData = new FormData();
|
||||
formData.append("a", currentVerManifest);
|
||||
@@ -58,6 +64,5 @@ export const useDiffData = ({
|
||||
return diff;
|
||||
},
|
||||
enabled: Boolean(selectedVerData),
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -130,8 +130,8 @@ export const InstallReleaseChartModal = ({
|
||||
});
|
||||
|
||||
// Confirm method (install)
|
||||
const setReleaseVersionMutation = useMutation(
|
||||
{mutationKey:[
|
||||
const setReleaseVersionMutation = useMutation({
|
||||
mutationKey: [
|
||||
"setVersion",
|
||||
namespace,
|
||||
releaseName,
|
||||
@@ -174,8 +174,7 @@ export const InstallReleaseChartModal = ({
|
||||
onError: (error) => {
|
||||
setInstallError((error as Error)?.message || "Failed to update");
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
@@ -112,8 +112,8 @@ export const InstallRepoChartModal = ({
|
||||
});
|
||||
|
||||
// Confirm method (install)
|
||||
const setReleaseVersionMutation = useMutation(
|
||||
{mutationKey:[
|
||||
const setReleaseVersionMutation = useMutation({
|
||||
mutationKey: [
|
||||
"setVersion",
|
||||
namespace,
|
||||
releaseName,
|
||||
@@ -142,15 +142,12 @@ export const InstallRepoChartModal = ({
|
||||
|
||||
onSuccess: async (response) => {
|
||||
onClose();
|
||||
navigate(
|
||||
`/${response.namespace}/${response.name}/installed/revision/1`
|
||||
);
|
||||
navigate(`/${response.namespace}/${response.name}/installed/revision/1`);
|
||||
},
|
||||
onError: (error) => {
|
||||
setInstallError((error as Error)?.message || "Failed to update");
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
@@ -458,8 +458,8 @@ const Uninstall = () => {
|
||||
enabled: isOpen,
|
||||
});
|
||||
|
||||
const uninstallMutation = useMutation(
|
||||
{mutationKey:["uninstall", namespace, chart],
|
||||
const uninstallMutation = useMutation({
|
||||
mutationKey: ["uninstall", namespace, chart],
|
||||
mutationFn: () =>
|
||||
apiService.fetchWithDefaults(
|
||||
"/api/helm/releases/" + namespace + "/" + chart,
|
||||
@@ -470,8 +470,7 @@ const Uninstall = () => {
|
||||
onSuccess: () => {
|
||||
window.location.href = "/";
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
const uninstallTitle = (
|
||||
<div className="font-semibold text-lg">
|
||||
Uninstall <span className="text-red-500">{chart}</span> from namespace{" "}
|
||||
|
||||
Reference in New Issue
Block a user