mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-26 14:28:04 +00:00
Enabled recommended-requiring-type-checking as result type fixes provided (#632)
* Enabled recommended-requiring-type-checking * from .cjs to .js * check * check * check * check * A lot of types aligned and refactored * More strict types * Improvement * Improvements * Improvements * Fixed routs * Fixed import types
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { useParams } from "react-router";
|
||||
import { useEffect, useEffectEvent, useMemo, useState } from "react";
|
||||
import type { VersionData } from "../../../API/releases";
|
||||
import {
|
||||
useChartReleaseValues,
|
||||
useGetReleaseManifest,
|
||||
useGetVersions,
|
||||
useVersionData,
|
||||
VersionData,
|
||||
} from "../../../API/releases";
|
||||
import Modal, { ModalButtonStyle } from "../Modal";
|
||||
import { GeneralDetails } from "./GeneralDetails";
|
||||
@@ -17,11 +17,11 @@ import { isNoneEmptyArray } from "../../../utils";
|
||||
import useCustomSearchParams from "../../../hooks/useCustomSearchParams";
|
||||
import { useChartRepoValues } from "../../../API/repositories";
|
||||
import { useDiffData } from "../../../API/shared";
|
||||
import { InstallChartModalProps } from "../../../data/types";
|
||||
import type { InstallChartModalProps } from "../../../data/types";
|
||||
import { DefinedValues } from "./DefinedValues";
|
||||
import apiService from "../../../API/apiService";
|
||||
import { InstallUpgradeTitle } from "./InstallUpgradeTitle";
|
||||
import { LatestChartVersion } from "../../../API/interfaces";
|
||||
import type { LatestChartVersion } from "../../../API/interfaces";
|
||||
|
||||
export const InstallReleaseChartModal = ({
|
||||
isOpen,
|
||||
@@ -129,7 +129,7 @@ export const InstallReleaseChartModal = ({
|
||||
});
|
||||
|
||||
// Confirm method (install)
|
||||
const setReleaseVersionMutation = useMutation<VersionData>({
|
||||
const setReleaseVersionMutation = useMutation<VersionData, Error>({
|
||||
mutationKey: [
|
||||
"setVersion",
|
||||
namespace,
|
||||
@@ -148,20 +148,23 @@ export const InstallReleaseChartModal = ({
|
||||
}
|
||||
formData.append("version", selectedVersion || "");
|
||||
formData.append("values", userValues || releaseValues || ""); // if userValues is empty, we use the release values
|
||||
return await apiService.fetchWithDefaults(
|
||||
`/api/helm/releases/${
|
||||
namespace ? namespace : "default"
|
||||
}${`/${releaseName}`}`,
|
||||
{
|
||||
const url = `/api/helm/releases/${
|
||||
namespace ? namespace : "default"
|
||||
}/${releaseName}`;
|
||||
|
||||
return await apiService.fetchWithSafeDefaults<VersionData>({
|
||||
url,
|
||||
options: {
|
||||
method: "post",
|
||||
body: formData,
|
||||
}
|
||||
);
|
||||
},
|
||||
fallback: { version: "", urls: [""] },
|
||||
});
|
||||
},
|
||||
onSuccess: async (response) => {
|
||||
onClose();
|
||||
setSelectedVersionData({ version: "", urls: [] }); //cleanup
|
||||
navigate(
|
||||
await navigate(
|
||||
`/${
|
||||
namespace ? namespace : "default"
|
||||
}/${releaseName}/installed/revision/${response.version}`
|
||||
|
||||
@@ -10,11 +10,11 @@ import useNavigateWithSearchParams from "../../../hooks/useNavigateWithSearchPar
|
||||
import { VersionToInstall } from "./VersionToInstall";
|
||||
import { isNoneEmptyArray } from "../../../utils";
|
||||
import { useDiffData } from "../../../API/shared";
|
||||
import { InstallChartModalProps } from "../../../data/types";
|
||||
import type { InstallChartModalProps } from "../../../data/types";
|
||||
import { DefinedValues } from "./DefinedValues";
|
||||
import apiService from "../../../API/apiService";
|
||||
import { InstallUpgradeTitle } from "./InstallUpgradeTitle";
|
||||
import { LatestChartVersion } from "../../../API/interfaces";
|
||||
import type { LatestChartVersion } from "../../../API/interfaces";
|
||||
|
||||
export const InstallRepoChartModal = ({
|
||||
isOpen,
|
||||
@@ -135,18 +135,21 @@ export const InstallRepoChartModal = ({
|
||||
formData.append("values", userValues);
|
||||
formData.append("name", releaseName || "");
|
||||
|
||||
return await apiService.fetchWithDefaults(
|
||||
`/api/helm/releases/${namespace ? namespace : "default"}`,
|
||||
{
|
||||
return await apiService.fetchWithSafeDefaults({
|
||||
url: `/api/helm/releases/${namespace ? namespace : "default"}`,
|
||||
options: {
|
||||
method: "post",
|
||||
body: formData,
|
||||
}
|
||||
);
|
||||
},
|
||||
fallback: { namespace: "", name: "" },
|
||||
});
|
||||
},
|
||||
|
||||
onSuccess: async (response: { namespace: string; name: string }) => {
|
||||
onClose();
|
||||
navigate(`/${response.namespace}/${response.name}/installed/revision/1`);
|
||||
await navigate(
|
||||
`/${response.namespace}/${response.name}/installed/revision/1`
|
||||
);
|
||||
},
|
||||
onError: (error) => {
|
||||
setInstallError(error?.message || "Failed to update");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FC } from "react";
|
||||
import type { FC } from "react";
|
||||
|
||||
interface InstallUpgradeProps {
|
||||
isUpgrade: boolean;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { FC, useMemo, useState } from "react";
|
||||
import Select, { components, GroupBase, SingleValueProps } from "react-select";
|
||||
import type { FC } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import type { GroupBase, SingleValueProps } from "react-select";
|
||||
import Select, { components } from "react-select";
|
||||
import { BsCheck2 } from "react-icons/bs";
|
||||
import { NonEmptyArray } from "../../../data/types";
|
||||
import type { NonEmptyArray } from "../../../data/types";
|
||||
|
||||
interface Version {
|
||||
repository: string;
|
||||
|
||||
Reference in New Issue
Block a user