mirror of
https://github.com/moghtech/komodo.git
synced 2026-04-30 14:25:22 -05:00
cleanup for build
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { ConfirmUpdate } from "@components/config/confirm-update";
|
import { ConfirmUpdate } from "@components/config/confirm-update";
|
||||||
import { Button } from "@ui/button";
|
import { Button } from "@ui/button";
|
||||||
import { Settings, Save, History } from "lucide-react";
|
import { Settings, History } from "lucide-react";
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
|
|
||||||
interface PageProps {
|
interface PageProps {
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import { ServerStatus } from "@monitor/client/dist/types";
|
|||||||
export const ServersChart = () => {
|
export const ServersChart = () => {
|
||||||
const { data } = useRead("ListServers", {});
|
const { data } = useRead("ListServers", {});
|
||||||
|
|
||||||
const running = data?.filter((d) => d.status === ServerStatus.Ok).length;
|
const running = data?.filter((d) => d.info.status === ServerStatus.Ok).length;
|
||||||
const stopped = data?.filter((d) => d.status === ServerStatus.NotOk).length;
|
const stopped = data?.filter(
|
||||||
|
(d) => d.info.status === ServerStatus.NotOk
|
||||||
|
).length;
|
||||||
const not_deployed = data?.filter(
|
const not_deployed = data?.filter(
|
||||||
(d) => d.status === ServerStatus.Disabled
|
(d) => d.info.status === ServerStatus.Disabled
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const AlerterCard = ({ id }: { id: string }) => {
|
|||||||
<Link to={`/alerters/${id}`}>
|
<Link to={`/alerters/${id}`}>
|
||||||
<ResourceCard
|
<ResourceCard
|
||||||
title={alerter.name}
|
title={alerter.name}
|
||||||
description={`${alerter.alerter_type} alerter`}
|
description={`${alerter.info.alerter_type} alerter`}
|
||||||
statusIcon={<AlarmClock className="w-4 h-4" />}
|
statusIcon={<AlarmClock className="w-4 h-4" />}
|
||||||
>
|
>
|
||||||
<div></div>
|
<div></div>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export const BuildCard = ({ id }: { id: string }) => {
|
|||||||
<Link to={`/builds/${build.id}`} key={build.id}>
|
<Link to={`/builds/${build.id}`} key={build.id}>
|
||||||
<ResourceCard
|
<ResourceCard
|
||||||
title={build.name}
|
title={build.name}
|
||||||
description={version_to_string(build.version) ?? "not built"}
|
description={version_to_string(build.info.version) ?? "not built"}
|
||||||
statusIcon={<Hammer className="w-4 h-4" />}
|
statusIcon={<Hammer className="w-4 h-4" />}
|
||||||
>
|
>
|
||||||
<BuildInfo id={id} />
|
<BuildInfo id={id} />
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const BuildName = ({ id }: { id: string | undefined }) => {
|
|||||||
export const BuildVersion = ({ id }: { id: string }) => {
|
export const BuildVersion = ({ id }: { id: string }) => {
|
||||||
const builds = useRead("ListBuilds", {}).data;
|
const builds = useRead("ListBuilds", {}).data;
|
||||||
const build = builds?.find((b) => b.id === id);
|
const build = builds?.find((b) => b.id === id);
|
||||||
return <>{version_to_string(build?.version) ?? "..."}</>;
|
return <>{version_to_string(build?.info.version) ?? "..."}</>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const BuildBuilder = ({ id }: { id: string }) => {
|
export const BuildBuilder = ({ id }: { id: string }) => {
|
||||||
@@ -23,7 +23,7 @@ export const BuildBuilder = ({ id }: { id: string }) => {
|
|||||||
export const BuildLastBuilt = ({ id }: { id: string }) => {
|
export const BuildLastBuilt = ({ id }: { id: string }) => {
|
||||||
const builds = useRead("ListBuilds", {}).data;
|
const builds = useRead("ListBuilds", {}).data;
|
||||||
const build = builds?.find((b) => b.id === id);
|
const build = builds?.find((b) => b.id === id);
|
||||||
const last = build?.last_built_at;
|
const last = build?.info.last_built_at;
|
||||||
return <>{last ? new Date(last).toLocaleString() : "not yet built"}</>;
|
return <>{last ? new Date(last).toLocaleString() : "not yet built"}</>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const RedeployContainer = ({ deployment_id }: DeploymentId) => {
|
|||||||
const deployment = deployments?.find((d) => d.id === deployment_id);
|
const deployment = deployments?.find((d) => d.id === deployment_id);
|
||||||
return (
|
return (
|
||||||
<ConfirmButton
|
<ConfirmButton
|
||||||
title={deployment?.status ? "Redeploy" : "Deploy"}
|
title={deployment?.info.status ? "Redeploy" : "Deploy"}
|
||||||
intent="success"
|
intent="success"
|
||||||
icon={<Rocket className="h-4 w-4" />}
|
icon={<Rocket className="h-4 w-4" />}
|
||||||
onClick={() => mutate({ deployment_id })}
|
onClick={() => mutate({ deployment_id })}
|
||||||
@@ -61,9 +61,9 @@ export const StartOrStopContainer = ({ deployment_id }: DeploymentId) => {
|
|||||||
const deployments = useRead("ListDeployments", {}).data;
|
const deployments = useRead("ListDeployments", {}).data;
|
||||||
const deployment = deployments?.find((d) => d.id === deployment_id);
|
const deployment = deployments?.find((d) => d.id === deployment_id);
|
||||||
|
|
||||||
if (deployment?.state === DockerContainerState.NotDeployed) return null;
|
if (deployment?.info.state === DockerContainerState.NotDeployed) return null;
|
||||||
|
|
||||||
if (deployment?.state === DockerContainerState.Running)
|
if (deployment?.info.state === DockerContainerState.Running)
|
||||||
return <StopContainer deployment_id={deployment_id} />;
|
return <StopContainer deployment_id={deployment_id} />;
|
||||||
return <StartContainer deployment_id={deployment_id} />;
|
return <StartContainer deployment_id={deployment_id} />;
|
||||||
};
|
};
|
||||||
@@ -74,7 +74,7 @@ export const RemoveContainer = ({ deployment_id }: DeploymentId) => {
|
|||||||
|
|
||||||
const deployments = useRead("ListDeployments", {}).data;
|
const deployments = useRead("ListDeployments", {}).data;
|
||||||
const deployment = deployments?.find((d) => d.id === deployment_id);
|
const deployment = deployments?.find((d) => d.id === deployment_id);
|
||||||
if (deployment?.state === DockerContainerState.NotDeployed) return null;
|
if (deployment?.info.state === DockerContainerState.NotDeployed) return null;
|
||||||
|
|
||||||
if (!d) return null;
|
if (!d) return null;
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const DeploymentLogs = ({
|
|||||||
const deployments = useRead("ListDeployments", {}).data;
|
const deployments = useRead("ListDeployments", {}).data;
|
||||||
const deployment = deployments?.find((d) => d.id === deployment_id);
|
const deployment = deployments?.find((d) => d.id === deployment_id);
|
||||||
|
|
||||||
if (deployment?.state === DockerContainerState.NotDeployed) return null;
|
if (deployment?.info.state === DockerContainerState.NotDeployed) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs defaultValue="stdout">
|
<Tabs defaultValue="stdout">
|
||||||
|
|||||||
@@ -5,13 +5,6 @@ import { useRead, useWrite } from "@hooks";
|
|||||||
import { Section } from "@layouts/page";
|
import { Section } from "@layouts/page";
|
||||||
import { Types } from "@monitor/client";
|
import { Types } from "@monitor/client";
|
||||||
import { Button } from "@ui/button";
|
import { Button } from "@ui/button";
|
||||||
import {
|
|
||||||
Card,
|
|
||||||
CardContent,
|
|
||||||
CardDescription,
|
|
||||||
CardHeader,
|
|
||||||
CardTitle,
|
|
||||||
} from "@ui/card";
|
|
||||||
import { Input } from "@ui/input";
|
import { Input } from "@ui/input";
|
||||||
import { Settings, Save, History } from "lucide-react";
|
import { Settings, Save, History } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -21,7 +14,7 @@ type ServerUpdate = Partial<Types.ServerConfig>;
|
|||||||
|
|
||||||
export const SerCon = ({ id }: { id: string }) => {
|
export const SerCon = ({ id }: { id: string }) => {
|
||||||
const config = useRead("GetServer", { id }).data?.config;
|
const config = useRead("GetServer", { id }).data?.config;
|
||||||
const { mutate, isLoading } = useWrite("UpdateServer");
|
const { mutate } = useWrite("UpdateServer");
|
||||||
const [update, set] = useState<ServerUpdate>({});
|
const [update, set] = useState<ServerUpdate>({});
|
||||||
const up = <K extends keyof Types.ServerConfig, V = Types.ServerConfig[K]>(
|
const up = <K extends keyof Types.ServerConfig, V = Types.ServerConfig[K]>(
|
||||||
k: K,
|
k: K,
|
||||||
|
|||||||
Reference in New Issue
Block a user