forked from github-starred/komodo
add repo info
This commit is contained in:
@@ -410,6 +410,7 @@ impl StateResource for Build {
|
||||
last_built_at: build.info.last_built_at,
|
||||
version: build.config.version,
|
||||
repo: build.config.repo,
|
||||
branch: build.config.branch,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -444,6 +445,8 @@ impl StateResource for Repo {
|
||||
resource_type: ResourceTargetVariant::Repo,
|
||||
info: RepoInfo {
|
||||
last_pulled_at: repo.info.last_pulled_at,
|
||||
repo: repo.config.repo,
|
||||
branch: repo.config.branch,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ pub struct BuildListItemInfo {
|
||||
pub last_built_at: I64,
|
||||
pub version: Version,
|
||||
pub repo: String,
|
||||
pub branch: String,
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
|
||||
@@ -22,6 +22,8 @@ pub type RepoListItem = ResourceListItem<RepoInfo>;
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
|
||||
pub struct RepoInfo {
|
||||
pub last_pulled_at: I64,
|
||||
pub repo: String,
|
||||
pub branch: String,
|
||||
}
|
||||
|
||||
#[typeshare(serialized_as = "Partial<RepoConfig>")]
|
||||
|
||||
@@ -142,6 +142,7 @@ export interface BuildListItemInfo {
|
||||
last_built_at: I64;
|
||||
version: Version;
|
||||
repo: string;
|
||||
branch: string;
|
||||
}
|
||||
|
||||
export type BuildListItem = ResourceListItem<BuildListItemInfo>;
|
||||
@@ -366,6 +367,8 @@ export interface RepoConfig {
|
||||
|
||||
export interface RepoInfo {
|
||||
last_pulled_at: I64;
|
||||
repo: string;
|
||||
branch: string;
|
||||
}
|
||||
|
||||
export type Repo = Resource<RepoConfig, RepoInfo>;
|
||||
|
||||
@@ -12,14 +12,7 @@ import {
|
||||
} from "@ui/dialog";
|
||||
import { Types } from "@monitor/client";
|
||||
import { ResourceComponents } from "./resources";
|
||||
import {
|
||||
Card,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
CardDescription,
|
||||
CardContent,
|
||||
CardFooter,
|
||||
} from "@ui/card";
|
||||
import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@ui/card";
|
||||
import { ResourceTags } from "./tags";
|
||||
import { Topbar } from "./topbar";
|
||||
|
||||
@@ -92,7 +85,7 @@ export const NewResource = ({
|
||||
enabled,
|
||||
onSuccess,
|
||||
}: {
|
||||
entityType: String;
|
||||
entityType: string;
|
||||
children: ReactNode;
|
||||
enabled: boolean;
|
||||
onSuccess: () => Promise<unknown>;
|
||||
@@ -148,9 +141,9 @@ export const ResourceCard = ({
|
||||
<CardTitle>
|
||||
<Components.Name id={id} />
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
{/* <CardDescription>
|
||||
<Components.Description id={id} />
|
||||
</CardDescription>
|
||||
</CardDescription> */}
|
||||
</div>
|
||||
<Components.Icon id={id} />
|
||||
</CardHeader>
|
||||
@@ -189,9 +182,9 @@ export const ResourceRow = ({
|
||||
))}
|
||||
<div className="flex items-center gap-2">
|
||||
<Components.Icon id={id} />
|
||||
<CardDescription>
|
||||
{/* <CardDescription>
|
||||
<Components.Description id={id} />
|
||||
</CardDescription>
|
||||
</CardDescription> */}
|
||||
</div>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
|
||||
@@ -18,6 +18,7 @@ import { RESOURCE_TARGETS } from "@lib/utils";
|
||||
import { DeploymentComponents } from "./resources/deployment";
|
||||
import { BuildComponents } from "./resources/build";
|
||||
import { ServerComponents } from "./resources/server";
|
||||
import { ProcedureComponents } from "./resources/procedure";
|
||||
|
||||
export const Omnibar = () => {
|
||||
const [open, set] = useState(false);
|
||||
@@ -58,36 +59,43 @@ export const Omnibar = () => {
|
||||
<CommandInput placeholder="Type a command or search..." />
|
||||
<CommandList>
|
||||
<CommandEmpty>No results found.</CommandEmpty>
|
||||
|
||||
|
||||
<CommandGroup>
|
||||
<CommandItem
|
||||
className="flex items-center gap-2"
|
||||
className="flex items-center gap-2 cursor-pointer"
|
||||
onSelect={() => nav("/")}
|
||||
>
|
||||
<Home className="w-4 h-4" />
|
||||
Home
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
className="flex items-center gap-2"
|
||||
className="flex items-center gap-2 cursor-pointer"
|
||||
onSelect={() => nav("/deployments")}
|
||||
>
|
||||
<DeploymentComponents.Icon />
|
||||
Deployments
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
className="flex items-center gap-2"
|
||||
className="flex items-center gap-2 cursor-pointer"
|
||||
onSelect={() => nav("/builds")}
|
||||
>
|
||||
<BuildComponents.Icon />
|
||||
Builds
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
className="flex items-center gap-2"
|
||||
className="flex items-center gap-2 cursor-pointer"
|
||||
onSelect={() => nav("/servers")}
|
||||
>
|
||||
<ServerComponents.Icon />
|
||||
Servers
|
||||
</CommandItem>
|
||||
<CommandItem
|
||||
className="flex items-center gap-2 cursor-pointer"
|
||||
onSelect={() => nav("/procedures")}
|
||||
>
|
||||
<ProcedureComponents.Icon />
|
||||
Procedures
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
|
||||
<CommandSeparator />
|
||||
@@ -109,7 +117,7 @@ const ResourceGroup = ({
|
||||
onSelect,
|
||||
}: {
|
||||
type: UsableResource;
|
||||
onSelect: (value: string) => void;
|
||||
onSelect: (path: string) => void;
|
||||
}) => {
|
||||
const data = useRead(`List${type}s`, {}).data;
|
||||
const Components = ResourceComponents[type];
|
||||
@@ -122,7 +130,7 @@ const ResourceGroup = ({
|
||||
return (
|
||||
<CommandItem
|
||||
key={id}
|
||||
className="flex items-center gap-2"
|
||||
className="cursor-pointer flex items-center gap-2"
|
||||
onSelect={() => onSelect(`/${type.toLowerCase()}s/${id}`)}
|
||||
>
|
||||
<Components.Icon id={id} />
|
||||
@@ -132,4 +140,4 @@ const ResourceGroup = ({
|
||||
})}
|
||||
</CommandGroup>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ const useAlerter = (id?: string) =>
|
||||
export const AlerterComponents: RequiredResourceComponents = {
|
||||
Name: ({ id }: { id: string }) => <>{useAlerter(id)?.name}</>,
|
||||
Icon: () => <AlarmClock className="w-4 h-4" />,
|
||||
Description: ({ id }) => <>{useAlerter(id)?.info.alerter_type} alerter</>,
|
||||
Link: ({ id }) => <ResourceLink type="Alerter" id={id} />,
|
||||
Info: [],
|
||||
Status: () => <></>,
|
||||
|
||||
@@ -3,14 +3,13 @@ import { ConfirmButton } from "@components/util";
|
||||
import { useExecute, useRead, useWrite } from "@lib/hooks";
|
||||
import { RequiredResourceComponents } from "@types";
|
||||
import { Input } from "@ui/input";
|
||||
import { AlertTriangle, Ban, Hammer, History, Loader2 } from "lucide-react";
|
||||
import { AlertTriangle, Ban, FolderGit, Hammer, History, Loader2 } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { useToast } from "@ui/use-toast";
|
||||
import { BuildConfig } from "./config";
|
||||
import { fill_color_class_by_intention } from "@lib/color";
|
||||
import { BuildChart } from "./dashboard";
|
||||
import { BuildTable } from "./table";
|
||||
import { fmt_version } from "@lib/formatting";
|
||||
import { CopyResource, DeleteResource, ResourceLink } from "../common";
|
||||
|
||||
const useBuild = (id?: string) =>
|
||||
@@ -28,9 +27,17 @@ export const BuildComponents: RequiredResourceComponents = {
|
||||
Table: BuildTable,
|
||||
Dashboard: BuildChart,
|
||||
Name: ({ id }) => <>{useBuild(id)?.name}</>,
|
||||
Description: ({ id }) => <>{fmt_version(useBuild(id)?.info.version)}</>,
|
||||
Link: ({ id }) => <ResourceLink type="Build" id={id} />,
|
||||
Info: [
|
||||
({ id }) => {
|
||||
const repo = useBuild(id)?.info.repo;
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<FolderGit className="w-4 h-4" />
|
||||
{repo}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
({ id }) => {
|
||||
const ts = useBuild(id)?.info.last_built_at;
|
||||
return (
|
||||
|
||||
@@ -25,7 +25,6 @@ const useBuilder = (id?: string) =>
|
||||
|
||||
export const BuilderComponents: RequiredResourceComponents = {
|
||||
Name: ({ id }: { id: string }) => <>{useBuilder(id)?.name}</>,
|
||||
Description: () => <></>,
|
||||
Link: ({ id }) => <ResourceLink type="Builder" id={id} />,
|
||||
Info: [
|
||||
({ id }) => (
|
||||
|
||||
@@ -34,7 +34,6 @@ export const useDeployment = (id?: string) =>
|
||||
|
||||
export const DeploymentComponents: RequiredResourceComponents = {
|
||||
Name: ({ id }) => <>{useDeployment(id)?.name}</>,
|
||||
Description: ({ id }) => <>{useDeployment(id)?.info.status}</>,
|
||||
Link: ({ id }) => <ResourceLink type="Deployment" id={id} />,
|
||||
Info: [
|
||||
({ id }) => {
|
||||
|
||||
@@ -24,7 +24,6 @@ const useProcedure = (id?: string) =>
|
||||
|
||||
export const ProcedureComponents: RequiredResourceComponents = {
|
||||
Name: ({ id }) => <>{useProcedure(id)?.name}</>,
|
||||
Description: ({ id }) => <>{useProcedure(id)?.info.procedure_type}</>,
|
||||
Link: ({ id }) => <ResourceLink type="Procedure" id={id} />,
|
||||
Info: [({ id }) => <>{useProcedure(id)?.info.procedure_type}</>],
|
||||
Icon: () => <Route className="w-4" />,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useRead, useWrite } from "@lib/hooks";
|
||||
import { RequiredResourceComponents } from "@types";
|
||||
import { Card, CardDescription, CardHeader, CardTitle } from "@ui/card";
|
||||
import { DataTable } from "@ui/data-table";
|
||||
import { AlertTriangle, GitBranch } from "lucide-react";
|
||||
import { AlertTriangle, FolderGit, GitBranch, History } from "lucide-react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { RepoConfig } from "./config";
|
||||
import { useState } from "react";
|
||||
@@ -17,11 +17,29 @@ const useRepo = (id?: string) =>
|
||||
|
||||
export const RepoComponents: RequiredResourceComponents = {
|
||||
Name: ({ id }: { id: string }) => <>{useRepo(id)?.name}</>,
|
||||
Description: ({ id }) => <>{id}</>,
|
||||
Icon: () => <GitBranch className="w-4 h-4" />,
|
||||
Link: ({ id }) => <ResourceLink type="Repo" id={id} />,
|
||||
Info: [],
|
||||
Status: () => <></>,
|
||||
Info: [
|
||||
({ id }) => {
|
||||
const repo = useRepo(id)?.info.repo;
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<FolderGit className="w-4 h-4" />
|
||||
{repo}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
({ id }) => {
|
||||
const ts = useRepo(id)?.info.last_pulled_at;
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<History className="w-4 h-4" />
|
||||
{ts ? new Date(ts).toLocaleString() : "Never Pulled"}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
],
|
||||
Status: () => <>Repo</>,
|
||||
Actions: [PullRepo, CloneRepo],
|
||||
Page: {
|
||||
Config: RepoConfig,
|
||||
@@ -51,10 +69,17 @@ export const RepoComponents: RequiredResourceComponents = {
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
accessorKey: "id",
|
||||
header: "Name",
|
||||
cell: ({ row }) => <RepoComponents.Link id={row.original.id} />,
|
||||
},
|
||||
{
|
||||
header: "Repo",
|
||||
accessorKey: "info.repo",
|
||||
},
|
||||
{
|
||||
header: "Branch",
|
||||
accessorKey: "info.branch",
|
||||
},
|
||||
{
|
||||
header: "Tags",
|
||||
cell: ({ row }) => {
|
||||
|
||||
@@ -25,7 +25,6 @@ export const useServer = (id?: string) =>
|
||||
|
||||
export const ServerComponents: RequiredResourceComponents = {
|
||||
Name: ({ id }: { id: string }) => <>{useServer(id)?.name}</>,
|
||||
Description: ({ id }) => <>{useServer(id)?.info.status}</>,
|
||||
Link: ({ id }) => <ResourceLink type="Server" id={id} />,
|
||||
Info: [
|
||||
({ id }) => (
|
||||
|
||||
Vendored
-1
@@ -14,7 +14,6 @@ export interface RequiredResourceComponents {
|
||||
Dashboard: React.FC;
|
||||
|
||||
Name: IdComponent;
|
||||
Description: IdComponent;
|
||||
Status: IdComponent;
|
||||
Link: IdComponent;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user