forked from github-starred/komodo
add Danger zone (delete + copy)
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
import { Config } from "@components/config";
|
import { Config } from "@components/config";
|
||||||
|
import { ActionWithDialog } from "@components/util";
|
||||||
import { useRead, useWrite } from "@lib/hooks";
|
import { useRead, useWrite } from "@lib/hooks";
|
||||||
import { Types } from "@monitor/client";
|
import { Types } from "@monitor/client";
|
||||||
|
import { Trash } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
export const AlerterConfig = ({ id }: { id: string }) => {
|
export const AlerterConfig = ({ id }: { id: string }) => {
|
||||||
const config = useRead("GetAlerter", { alerter: id }).data?.config;
|
const config = useRead("GetAlerter", { alerter: id }).data?.config;
|
||||||
@@ -54,3 +57,27 @@ const CustomAlerterConfig = ({ id }: { id: string }) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const DeleteAlerter = ({ id }: { id: string }) => {
|
||||||
|
const nav = useNavigate();
|
||||||
|
const { data: alerter } = useRead("GetAlerter", { alerter: id });
|
||||||
|
const { mutateAsync, isPending } = useWrite("DeleteAlerter");
|
||||||
|
|
||||||
|
if (!alerter) return null;
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="w-full">Delete Alerter</div>
|
||||||
|
<ActionWithDialog
|
||||||
|
name={alerter.name}
|
||||||
|
title="Delete"
|
||||||
|
icon={<Trash className="h-4 w-4" />}
|
||||||
|
onClick={async () => {
|
||||||
|
await mutateAsync({ id });
|
||||||
|
nav("/");
|
||||||
|
}}
|
||||||
|
disabled={isPending}
|
||||||
|
loading={isPending}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { NewResource } from "@components/layouts";
|
import { NewResource, Section } from "@components/layouts";
|
||||||
import { useRead, useWrite } from "@lib/hooks";
|
import { useRead, useWrite } from "@lib/hooks";
|
||||||
import { Types } from "@monitor/client";
|
import { Types } from "@monitor/client";
|
||||||
import {
|
import {
|
||||||
@@ -11,13 +11,13 @@ import {
|
|||||||
} from "@ui/select";
|
} from "@ui/select";
|
||||||
import { RequiredResourceComponents } from "@types";
|
import { RequiredResourceComponents } from "@types";
|
||||||
import { Input } from "@ui/input";
|
import { Input } from "@ui/input";
|
||||||
import { AlarmClock } from "lucide-react";
|
import { AlarmClock, AlertTriangle } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { DataTable } from "@ui/data-table";
|
import { DataTable } from "@ui/data-table";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { Card, CardDescription, CardHeader, CardTitle } from "@ui/card";
|
import { Card, CardDescription, CardHeader, CardTitle } from "@ui/card";
|
||||||
import { AlerterConfig } from "./config";
|
import { AlerterConfig, DeleteAlerter } from "./config";
|
||||||
import { ResourceLink } from "@components/util";
|
import { CopyResource, ResourceLink } from "@components/util";
|
||||||
import { TagsWithBadge } from "@components/tags";
|
import { TagsWithBadge } from "@components/tags";
|
||||||
|
|
||||||
const useAlerter = (id?: string) =>
|
const useAlerter = (id?: string) =>
|
||||||
@@ -32,6 +32,15 @@ export const AlerterComponents: RequiredResourceComponents = {
|
|||||||
Status: () => <></>,
|
Status: () => <></>,
|
||||||
Page: {
|
Page: {
|
||||||
Config: AlerterConfig,
|
Config: AlerterConfig,
|
||||||
|
Danger: ({ id }) => (
|
||||||
|
<Section
|
||||||
|
title="Danger Zone"
|
||||||
|
icon={<AlertTriangle className="w-4 h-4" />}
|
||||||
|
actions={<CopyResource type="Alerter" id={id} />}
|
||||||
|
>
|
||||||
|
<DeleteAlerter id={id} />
|
||||||
|
</Section>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
Actions: [],
|
Actions: [],
|
||||||
Table: () => {
|
Table: () => {
|
||||||
@@ -46,7 +55,7 @@ export const AlerterComponents: RequiredResourceComponents = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: "Type",
|
header: "Type",
|
||||||
accessorKey: "info.alerter_type"
|
accessorKey: "info.alerter_type",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: "Tags",
|
header: "Tags",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
ResourceSelector,
|
ResourceSelector,
|
||||||
SystemCommand,
|
SystemCommand,
|
||||||
} from "@components/config/util";
|
} from "@components/config/util";
|
||||||
|
import { ActionWithDialog } from "@components/util";
|
||||||
import { useRead, useWrite } from "@lib/hooks";
|
import { useRead, useWrite } from "@lib/hooks";
|
||||||
import { env_to_text, text_to_env } from "@lib/utils";
|
import { env_to_text, text_to_env } from "@lib/utils";
|
||||||
import { Types } from "@monitor/client";
|
import { Types } from "@monitor/client";
|
||||||
@@ -18,8 +19,9 @@ import {
|
|||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@ui/select";
|
} from "@ui/select";
|
||||||
import { Textarea } from "@ui/textarea";
|
import { Textarea } from "@ui/textarea";
|
||||||
import { MinusCircle, PlusCircle } from "lucide-react";
|
import { MinusCircle, PlusCircle, Trash } from "lucide-react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
export const BuildConfig = ({ id }: { id: string }) => {
|
export const BuildConfig = ({ id }: { id: string }) => {
|
||||||
const config = useRead("GetBuild", { build: id }).data?.config;
|
const config = useRead("GetBuild", { build: id }).data?.config;
|
||||||
@@ -241,3 +243,28 @@ const DockerOrganizations = ({
|
|||||||
</ConfigItem>
|
</ConfigItem>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const DeleteBuild = ({ id }: { id: string }) => {
|
||||||
|
const nav = useNavigate();
|
||||||
|
const build = useRead("GetBuild", { build: id }).data;
|
||||||
|
const { mutateAsync, isPending } = useWrite("DeleteBuild");
|
||||||
|
|
||||||
|
if (!build) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="w-full">Delete Build</div>
|
||||||
|
<ActionWithDialog
|
||||||
|
name={build.name}
|
||||||
|
title="Delete"
|
||||||
|
icon={<Trash className="h-4 w-4" />}
|
||||||
|
onClick={async () => {
|
||||||
|
await mutateAsync({ id });
|
||||||
|
nav("/");
|
||||||
|
}}
|
||||||
|
disabled={isPending}
|
||||||
|
loading={isPending}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { NewResource } from "@components/layouts";
|
import { NewResource, Section } from "@components/layouts";
|
||||||
import { ConfirmButton, ResourceLink } from "@components/util";
|
import { ConfirmButton, CopyResource, ResourceLink } from "@components/util";
|
||||||
import { useExecute, useRead, useWrite } from "@lib/hooks";
|
import { useExecute, useRead, useWrite } from "@lib/hooks";
|
||||||
import { RequiredResourceComponents } from "@types";
|
import { RequiredResourceComponents } from "@types";
|
||||||
import { Input } from "@ui/input";
|
import { Input } from "@ui/input";
|
||||||
import { Ban, Hammer, History, Loader2 } from "lucide-react";
|
import { AlertTriangle, Ban, Hammer, History, Loader2 } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useToast } from "@ui/use-toast";
|
import { useToast } from "@ui/use-toast";
|
||||||
import { BuildConfig } from "./config";
|
import { BuildConfig, DeleteBuild } from "./config";
|
||||||
import { fill_color_class_by_intention } from "@lib/color";
|
import { fill_color_class_by_intention } from "@lib/color";
|
||||||
import { BuildChart } from "./dashboard";
|
import { BuildChart } from "./dashboard";
|
||||||
import { BuildTable } from "./table";
|
import { BuildTable } from "./table";
|
||||||
@@ -43,6 +43,15 @@ export const BuildComponents: RequiredResourceComponents = {
|
|||||||
Status: () => <>Build</>,
|
Status: () => <>Build</>,
|
||||||
Page: {
|
Page: {
|
||||||
Config: ({ id }) => <BuildConfig id={id} />,
|
Config: ({ id }) => <BuildConfig id={id} />,
|
||||||
|
Danger: ({ id }) => (
|
||||||
|
<Section
|
||||||
|
title="Danger Zone"
|
||||||
|
icon={<AlertTriangle className="w-4 h-4" />}
|
||||||
|
actions={<CopyResource type="Build" id={id} />}
|
||||||
|
>
|
||||||
|
<DeleteBuild id={id} />
|
||||||
|
</Section>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
Icon: ({ id }) => {
|
Icon: ({ id }) => {
|
||||||
if (id) return <Icon id={id} />;
|
if (id) return <Icon id={id} />;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import { Config } from "@components/config";
|
import { Config } from "@components/config";
|
||||||
import { InputList, ResourceSelector } from "@components/config/util";
|
import { InputList, ResourceSelector } from "@components/config/util";
|
||||||
|
import { ActionWithDialog } from "@components/util";
|
||||||
import { useRead, useWrite } from "@lib/hooks";
|
import { useRead, useWrite } from "@lib/hooks";
|
||||||
import { Types } from "@monitor/client";
|
import { Types } from "@monitor/client";
|
||||||
|
import { Trash } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
export const BuilderConfig = ({ id }: { id: string }) => {
|
export const BuilderConfig = ({ id }: { id: string }) => {
|
||||||
const config = useRead("GetBuilder", { builder: id }).data?.config;
|
const config = useRead("GetBuilder", { builder: id }).data?.config;
|
||||||
@@ -89,3 +92,28 @@ const ServerBuilderConfig = ({ id }: { id: string }) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const DeleteBuilder = ({ id }: { id: string }) => {
|
||||||
|
const nav = useNavigate();
|
||||||
|
const builder = useRead("GetBuilder", { builder: id }).data;
|
||||||
|
const { mutateAsync, isPending } = useWrite("DeleteBuilder");
|
||||||
|
|
||||||
|
if (!builder) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="w-full">Delete Builder</div>
|
||||||
|
<ActionWithDialog
|
||||||
|
name={builder.name}
|
||||||
|
title="Delete"
|
||||||
|
icon={<Trash className="h-4 w-4" />}
|
||||||
|
onClick={async () => {
|
||||||
|
await mutateAsync({ id });
|
||||||
|
nav("/");
|
||||||
|
}}
|
||||||
|
disabled={isPending}
|
||||||
|
loading={isPending}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { NewResource } from "@components/layouts";
|
import { NewResource, Section } from "@components/layouts";
|
||||||
import { useTagsFilter } from "@components/tags";
|
import { useTagsFilter } from "@components/tags";
|
||||||
import { useRead, useWrite } from "@lib/hooks";
|
import { useRead, useWrite } from "@lib/hooks";
|
||||||
import { Types } from "@monitor/client";
|
import { Types } from "@monitor/client";
|
||||||
@@ -14,11 +14,11 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@ui/select";
|
} from "@ui/select";
|
||||||
import { Cloud, Bot, Factory } from "lucide-react";
|
import { Cloud, Bot, Factory, AlertTriangle } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { BuilderConfig } from "./config";
|
import { BuilderConfig, DeleteBuilder } from "./config";
|
||||||
import { ResourceLink } from "@components/util";
|
import { CopyResource, ResourceLink } from "@components/util";
|
||||||
|
|
||||||
const useBuilder = (id?: string) =>
|
const useBuilder = (id?: string) =>
|
||||||
useRead("ListBuilders", {}).data?.find((d) => d.id === id);
|
useRead("ListBuilders", {}).data?.find((d) => d.id === id);
|
||||||
@@ -46,6 +46,15 @@ export const BuilderComponents: RequiredResourceComponents = {
|
|||||||
Actions: [],
|
Actions: [],
|
||||||
Page: {
|
Page: {
|
||||||
Config: BuilderConfig,
|
Config: BuilderConfig,
|
||||||
|
Danger: ({ id }) => (
|
||||||
|
<Section
|
||||||
|
title="Danger Zone"
|
||||||
|
icon={<AlertTriangle className="w-4 h-4" />}
|
||||||
|
actions={<CopyResource type="Builder" id={id} />}
|
||||||
|
>
|
||||||
|
<DeleteBuilder id={id} />
|
||||||
|
</Section>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
Table: () => {
|
Table: () => {
|
||||||
const tags = useTagsFilter();
|
const tags = useTagsFilter();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import {
|
|||||||
text_color_class_by_intention,
|
text_color_class_by_intention,
|
||||||
} from "@lib/color";
|
} from "@lib/color";
|
||||||
import { DeploymentTable } from "./table";
|
import { DeploymentTable } from "./table";
|
||||||
import { ResourceLink } from "@components/util";
|
import { CopyResource, ResourceLink } from "@components/util";
|
||||||
import { DeploymentsChart } from "./dashboard";
|
import { DeploymentsChart } from "./dashboard";
|
||||||
|
|
||||||
export const useDeployment = (id?: string) =>
|
export const useDeployment = (id?: string) =>
|
||||||
@@ -78,7 +78,11 @@ export const DeploymentComponents: RequiredResourceComponents = {
|
|||||||
Logs: ({ id }) => <DeploymentLogs id={id} />,
|
Logs: ({ id }) => <DeploymentLogs id={id} />,
|
||||||
Config: ({ id }) => <DeploymentConfig id={id} />,
|
Config: ({ id }) => <DeploymentConfig id={id} />,
|
||||||
Danger: ({ id }) => (
|
Danger: ({ id }) => (
|
||||||
<Section title="Danger Zone" icon={<AlertTriangle className="w-4 h-4" />}>
|
<Section
|
||||||
|
title="Danger Zone"
|
||||||
|
icon={<AlertTriangle className="w-4 h-4" />}
|
||||||
|
actions={<CopyResource type="Deployment" id={id} />}
|
||||||
|
>
|
||||||
<RenameDeployment id={id} />
|
<RenameDeployment id={id} />
|
||||||
<DeleteDeployment id={id} />
|
<DeleteDeployment id={id} />
|
||||||
</Section>
|
</Section>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { NewResource } from "@components/layouts";
|
import { NewResource, Section } from "@components/layouts";
|
||||||
import { ConfirmButton, ResourceLink } from "@components/util";
|
import {
|
||||||
|
ActionWithDialog,
|
||||||
|
ConfirmButton,
|
||||||
|
CopyResource,
|
||||||
|
ResourceLink,
|
||||||
|
} from "@components/util";
|
||||||
import { useExecute, useRead, useWrite } from "@lib/hooks";
|
import { useExecute, useRead, useWrite } from "@lib/hooks";
|
||||||
import { Types } from "@monitor/client";
|
import { Types } from "@monitor/client";
|
||||||
import { RequiredResourceComponents } from "@types";
|
import { RequiredResourceComponents } from "@types";
|
||||||
@@ -12,9 +17,9 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@ui/select";
|
} from "@ui/select";
|
||||||
import { Loader2, Route } from "lucide-react";
|
import { AlertTriangle, Loader2, Route, Trash } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
import { ProcedureConfig } from "./config";
|
import { ProcedureConfig } from "./config";
|
||||||
import { ProcedureTable } from "./table";
|
import { ProcedureTable } from "./table";
|
||||||
|
|
||||||
@@ -30,6 +35,15 @@ export const ProcedureComponents: RequiredResourceComponents = {
|
|||||||
Status: () => <>Procedure</>,
|
Status: () => <>Procedure</>,
|
||||||
Page: {
|
Page: {
|
||||||
Config: ProcedureConfig,
|
Config: ProcedureConfig,
|
||||||
|
Danger: ({ id }) => (
|
||||||
|
<Section
|
||||||
|
title="Danger Zone"
|
||||||
|
icon={<AlertTriangle className="w-4 h-4" />}
|
||||||
|
actions={<CopyResource type="Procedure" id={id} />}
|
||||||
|
>
|
||||||
|
<DeleteProcedure id={id} />
|
||||||
|
</Section>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
Actions: [
|
Actions: [
|
||||||
({ id }) => {
|
({ id }) => {
|
||||||
@@ -106,3 +120,28 @@ export const ProcedureComponents: RequiredResourceComponents = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const DeleteProcedure = ({ id }: { id: string }) => {
|
||||||
|
const nav = useNavigate();
|
||||||
|
const procedure = useRead("GetProcedure", { procedure: id }).data;
|
||||||
|
const { mutateAsync, isPending } = useWrite("DeleteProcedure");
|
||||||
|
|
||||||
|
if (!procedure) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="w-full">Delete Procedure</div>
|
||||||
|
<ActionWithDialog
|
||||||
|
name={procedure.name}
|
||||||
|
title="Delete"
|
||||||
|
icon={<Trash className="h-4 w-4" />}
|
||||||
|
onClick={async () => {
|
||||||
|
await mutateAsync({ id });
|
||||||
|
nav("/");
|
||||||
|
}}
|
||||||
|
disabled={isPending}
|
||||||
|
loading={isPending}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { Config } from "@components/config";
|
import { Config } from "@components/config";
|
||||||
import { ConfigItem, ResourceSelector, SystemCommand } from "@components/config/util";
|
import {
|
||||||
|
ConfigItem,
|
||||||
|
ResourceSelector,
|
||||||
|
SystemCommand,
|
||||||
|
} from "@components/config/util";
|
||||||
|
import { ActionWithDialog } from "@components/util";
|
||||||
import { useRead, useWrite } from "@lib/hooks";
|
import { useRead, useWrite } from "@lib/hooks";
|
||||||
import { Types } from "@monitor/client";
|
import { Types } from "@monitor/client";
|
||||||
import {
|
import {
|
||||||
@@ -9,7 +14,9 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@ui/select";
|
} from "@ui/select";
|
||||||
|
import { Trash } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
export const RepoConfig = ({ id }: { id: string }) => {
|
export const RepoConfig = ({ id }: { id: string }) => {
|
||||||
const config = useRead("GetRepo", { repo: id }).data?.config;
|
const config = useRead("GetRepo", { repo: id }).data?.config;
|
||||||
@@ -97,3 +104,28 @@ const GithubAccount = ({
|
|||||||
</ConfigItem>
|
</ConfigItem>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const DeleteRepo = ({ id }: { id: string }) => {
|
||||||
|
const nav = useNavigate();
|
||||||
|
const repo = useRead("GetRepo", { repo: id }).data;
|
||||||
|
const { mutateAsync, isPending } = useWrite("DeleteRepo");
|
||||||
|
|
||||||
|
if (!repo) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="w-full">Delete Repo</div>
|
||||||
|
<ActionWithDialog
|
||||||
|
name={repo.name}
|
||||||
|
title="Delete"
|
||||||
|
icon={<Trash className="h-4 w-4" />}
|
||||||
|
onClick={async () => {
|
||||||
|
await mutateAsync({ id });
|
||||||
|
nav("/");
|
||||||
|
}}
|
||||||
|
disabled={isPending}
|
||||||
|
loading={isPending}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import { useRead, useWrite } from "@lib/hooks";
|
|||||||
import { RequiredResourceComponents } from "@types";
|
import { RequiredResourceComponents } from "@types";
|
||||||
import { Card, CardDescription, CardHeader, CardTitle } from "@ui/card";
|
import { Card, CardDescription, CardHeader, CardTitle } from "@ui/card";
|
||||||
import { DataTable } from "@ui/data-table";
|
import { DataTable } from "@ui/data-table";
|
||||||
import { GitBranch } from "lucide-react";
|
import { AlertTriangle, GitBranch } from "lucide-react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { RepoConfig } from "./config";
|
import { DeleteRepo, RepoConfig } from "./config";
|
||||||
import { ResourceLink } from "@components/util";
|
import { CopyResource, ResourceLink } from "@components/util";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { NewResource } from "@components/layouts";
|
import { NewResource, Section } from "@components/layouts";
|
||||||
import { Input } from "@ui/input";
|
import { Input } from "@ui/input";
|
||||||
|
|
||||||
const useRepo = (id?: string) =>
|
const useRepo = (id?: string) =>
|
||||||
@@ -24,6 +24,15 @@ export const RepoComponents: RequiredResourceComponents = {
|
|||||||
Actions: [],
|
Actions: [],
|
||||||
Page: {
|
Page: {
|
||||||
Config: RepoConfig,
|
Config: RepoConfig,
|
||||||
|
Danger: ({ id }) => (
|
||||||
|
<Section
|
||||||
|
title="Danger Zone"
|
||||||
|
icon={<AlertTriangle className="w-4 h-4" />}
|
||||||
|
actions={<CopyResource type="Repo" id={id} />}
|
||||||
|
>
|
||||||
|
<DeleteRepo id={id} />
|
||||||
|
</Section>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
Table: () => {
|
Table: () => {
|
||||||
const repos = useRead("ListRepos", {}).data;
|
const repos = useRead("ListRepos", {}).data;
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ export const CopyResource = ({
|
|||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
type: "Deployment" | "Build";
|
type: Exclude<UsableResource, "Server">;
|
||||||
}) => {
|
}) => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
@@ -203,8 +203,8 @@ export const CopyResource = ({
|
|||||||
<Input value={name} onChange={(e) => setName(e.target.value)} />
|
<Input value={name} onChange={(e) => setName(e.target.value)} />
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<ActionButton
|
<ConfirmButton
|
||||||
title="Confirm"
|
title="Copy"
|
||||||
icon={<Check className="w-4 h-4" />}
|
icon={<Check className="w-4 h-4" />}
|
||||||
disabled={!name}
|
disabled={!name}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user