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,6 +1,6 @@
|
||||
import { HD_RESOURCE_CONDITION_TYPE } from "../../API/releases";
|
||||
import { Tooltip } from "flowbite-react";
|
||||
import { ReleaseHealthStatus } from "../../data/types";
|
||||
import type { ReleaseHealthStatus } from "../../data/types";
|
||||
|
||||
interface Props {
|
||||
statusData: ReleaseHealthStatus[];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Meta } from "@storybook/react-vite";
|
||||
import type { Meta } from "@storybook/react-vite";
|
||||
import InstalledPackageCard from "./InstalledPackageCard";
|
||||
|
||||
const meta = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { Release, ReleaseHealthStatus } from "../../data/types";
|
||||
import type { Release, ReleaseHealthStatus } from "../../data/types";
|
||||
import { BsArrowUpCircleFill, BsPlusCircleFill } from "react-icons/bs";
|
||||
import { getAge } from "../../timeUtils";
|
||||
import StatusLabel, {
|
||||
@@ -13,7 +13,7 @@ import HelmGrayIcon from "../../assets/helm-gray-50.svg";
|
||||
import Spinner from "../Spinner";
|
||||
import { useGetLatestVersion } from "../../API/releases";
|
||||
import { isNewerVersion } from "../../utils";
|
||||
import { LatestChartVersion } from "../../API/interfaces";
|
||||
import type { LatestChartVersion } from "../../API/interfaces";
|
||||
import useNavigateWithSearchParams from "../../hooks/useNavigateWithSearchParams";
|
||||
import { useInView } from "react-intersection-observer";
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function InstalledPackageCard({
|
||||
queryKey: ["chartName", release.chartName],
|
||||
});
|
||||
|
||||
const { data: statusData } = useQuery<ReleaseHealthStatus[] | null>({
|
||||
const { data: statusData = [], isLoading } = useQuery<ReleaseHealthStatus[]>({
|
||||
queryKey: ["resourceStatus", release],
|
||||
queryFn: () => apiService.getResourceStatus({ release }),
|
||||
enabled: inView,
|
||||
@@ -61,14 +61,21 @@ export default function InstalledPackageCard({
|
||||
setIsMouseOver(false);
|
||||
};
|
||||
|
||||
const handleOnClick = () => {
|
||||
const onClick = async () => {
|
||||
const { name, namespace } = release;
|
||||
navigate(`/${namespace}/${name}/installed/revision/${release.revision}`, {
|
||||
state: release,
|
||||
});
|
||||
await navigate(
|
||||
`/${namespace}/${name}/installed/revision/${release.revision}`,
|
||||
{
|
||||
state: release,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const statusColor = getStatusColor(release.status as DeploymentStatus);
|
||||
const handleClick = () => {
|
||||
void onClick();
|
||||
};
|
||||
|
||||
const statusColor = getStatusColor(release.status);
|
||||
const borderLeftColor: { [key: string]: string } = {
|
||||
[DeploymentStatus.DEPLOYED]: "border-l-border-deployed",
|
||||
[DeploymentStatus.FAILED]: "border-l-text-danger",
|
||||
@@ -85,7 +92,7 @@ export default function InstalledPackageCard({
|
||||
}`}
|
||||
onMouseOver={handleMouseOver}
|
||||
onMouseOut={handleMouseOut}
|
||||
onClick={handleOnClick}
|
||||
onClick={handleClick}
|
||||
>
|
||||
<img
|
||||
src={release.icon || HelmGrayIcon}
|
||||
@@ -118,10 +125,10 @@ export default function InstalledPackageCard({
|
||||
{release.description}
|
||||
</div>
|
||||
<div className="col-span-3 mr-2">
|
||||
{statusData ? (
|
||||
<HealthStatus statusData={statusData} />
|
||||
) : (
|
||||
{isLoading ? (
|
||||
<Spinner size={4} />
|
||||
) : (
|
||||
<HealthStatus statusData={statusData} />
|
||||
)}
|
||||
</div>
|
||||
<div className="items col-span-2 flex flex-col text-muted">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Meta } from "@storybook/react-vite";
|
||||
import type { Meta } from "@storybook/react-vite";
|
||||
import InstalledPackagesHeader from "./InstalledPackagesHeader";
|
||||
|
||||
const meta = {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import HeaderLogo from "../../assets/packges-header.svg";
|
||||
import { Release } from "../../data/types";
|
||||
import type { Release } from "../../data/types";
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
|
||||
type InstalledPackagesHeaderProps = {
|
||||
filteredReleases?: Release[];
|
||||
setFilterKey: React.Dispatch<React.SetStateAction<string>>;
|
||||
setFilterKey: Dispatch<SetStateAction<string>>;
|
||||
isLoading: boolean;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Meta } from "@storybook/react-vite";
|
||||
import type { Meta } from "@storybook/react-vite";
|
||||
import InstalledPackagesList from "./InstalledPackagesList";
|
||||
|
||||
const meta = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import InstalledPackageCard from "./InstalledPackageCard";
|
||||
import { Release } from "../../data/types";
|
||||
import type { Release } from "../../data/types";
|
||||
|
||||
type InstalledPackagesListProps = {
|
||||
filteredReleases: Release[];
|
||||
|
||||
Reference in New Issue
Block a user