mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
* Introduced tsconfig.app.json and tsconfig.base.json * yarn.lock * Introduced tsconfig.app.json, tsconfig.base.jsonfig. * Refactored eslint.config.js to latest structure * Returned previous recommended rules. * More rules * Force import rules * Check * Check * Cleanup ESLint configuration and plugins * Cleanup heap: "writable",DD_RUM: "writable" from ESLint configuration * "scripts" moved to the top of package.json
70 lines
1.5 KiB
TypeScript
70 lines
1.5 KiB
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
|
|
import apiService from "./apiService";
|
|
|
|
export const getVersionManifestFormData = ({
|
|
version,
|
|
userValues,
|
|
chart,
|
|
releaseValues,
|
|
releaseName,
|
|
}: {
|
|
version: string;
|
|
userValues?: string;
|
|
chart: string;
|
|
releaseValues?: string;
|
|
releaseName?: string;
|
|
}) => {
|
|
const formData = new FormData();
|
|
// preview needs to come first, for some reason it has a meaning at the backend
|
|
formData.append("preview", "true");
|
|
formData.append("chart", chart);
|
|
formData.append("version", version);
|
|
formData.append(
|
|
"values",
|
|
userValues ? userValues : releaseValues ? releaseValues : ""
|
|
);
|
|
if (releaseName) {
|
|
formData.append("name", releaseName);
|
|
}
|
|
|
|
return formData;
|
|
};
|
|
|
|
export const useDiffData = ({
|
|
selectedRepo,
|
|
versionsError,
|
|
currentVerManifest,
|
|
selectedVerData,
|
|
chart,
|
|
}: {
|
|
selectedRepo: string;
|
|
versionsError: string;
|
|
currentVerManifest: string;
|
|
selectedVerData: { [key: string]: string };
|
|
chart: string;
|
|
}) => {
|
|
return useQuery({
|
|
queryKey: [
|
|
selectedRepo,
|
|
versionsError,
|
|
chart,
|
|
currentVerManifest,
|
|
selectedVerData,
|
|
],
|
|
queryFn: async () => {
|
|
const formData = new FormData();
|
|
formData.append("a", currentVerManifest);
|
|
formData.append("b", selectedVerData.manifest);
|
|
|
|
const diff = await apiService.fetchWithDefaults("/diff", {
|
|
method: "post",
|
|
body: formData,
|
|
});
|
|
|
|
return diff;
|
|
},
|
|
enabled: Boolean(selectedVerData),
|
|
});
|
|
};
|