mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 04:40:05 +01:00
feat: adding taints, labels and annotations to terraform provider and ui all implementing the SDK
This commit is contained in:
@@ -2,6 +2,7 @@ import { AppShell } from "@/layouts/app-shell.tsx"
|
||||
import { Route, Routes } from "react-router-dom"
|
||||
|
||||
import { ProtectedRoute } from "@/components/protected-route.tsx"
|
||||
import { AnnotationPage } from "@/pages/annotations/annotation-page.tsx"
|
||||
import { Login } from "@/pages/auth/login.tsx"
|
||||
import { JobsPage } from "@/pages/jobs/jobs-page.tsx"
|
||||
import { LabelsPage } from "@/pages/labels/labels-page.tsx"
|
||||
@@ -29,6 +30,7 @@ export default function App() {
|
||||
<Route path="/servers" element={<ServerPage />} />
|
||||
<Route path="/taints" element={<TaintsPage />} />
|
||||
<Route path="/labels" element={<LabelsPage />} />
|
||||
<Route path="/annotations" element={<AnnotationPage />} />
|
||||
|
||||
<Route path="/admin/jobs" element={<JobsPage />} />
|
||||
</Route>
|
||||
|
||||
27
ui/src/api/annotations.ts
Normal file
27
ui/src/api/annotations.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { withRefresh } from "@/api/with-refresh.ts"
|
||||
import type { DtoCreateAnnotationRequest, DtoUpdateAnnotationRequest } from "@/sdk"
|
||||
import { makeAnnotationsApi } from "@/sdkClient.ts"
|
||||
|
||||
const annotations = makeAnnotationsApi()
|
||||
export const annotationsApi = {
|
||||
listAnnotations: () =>
|
||||
withRefresh(async () => {
|
||||
return await annotations.listAnnotations()
|
||||
}),
|
||||
createAnnotation: (body: DtoCreateAnnotationRequest) =>
|
||||
withRefresh(async () => {
|
||||
return await annotations.createAnnotation({ body })
|
||||
}),
|
||||
getAnnotation: (id: string) =>
|
||||
withRefresh(async () => {
|
||||
return await annotations.getAnnotation({ id })
|
||||
}),
|
||||
deleteAnnotation: (id: string) =>
|
||||
withRefresh(async () => {
|
||||
await annotations.deleteAnnotation({ id })
|
||||
}),
|
||||
updateAnnotation: (id: string, body: DtoUpdateAnnotationRequest) =>
|
||||
withRefresh(async () => {
|
||||
return await annotations.updateAnnotation({ id, body })
|
||||
}),
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { withRefresh } from "@/api/with-refresh.ts"
|
||||
import type { AdminListArcherJobsRequest } from "@/sdk"
|
||||
import { makeArcherAdminApi } from "@/sdkClient.ts"
|
||||
|
||||
const archerAdmin = makeArcherAdminApi()
|
||||
@@ -12,7 +13,7 @@ type ListParams = {
|
||||
}
|
||||
|
||||
export const archerAdminApi = {
|
||||
listJobs: (params: ListParams = {}) => {
|
||||
listJobs: (params: AdminListArcherJobsRequest = {}) => {
|
||||
return withRefresh(async () => {
|
||||
return await archerAdmin.adminListArcherJobs(params)
|
||||
})
|
||||
|
||||
@@ -24,7 +24,7 @@ export const mainNav: NavItem[] = [
|
||||
{ to: "/clusters", label: "Clusters", icon: AiOutlineCluster },
|
||||
{ to: "/node-pools", label: "Node Pools", icon: BoxesIcon },
|
||||
{ to: "/annotations", label: "Annotations", icon: ComponentIcon },
|
||||
{ to: "/Labels", label: "Labels", icon: TagsIcon },
|
||||
{ to: "/labels", label: "Labels", icon: TagsIcon },
|
||||
{ to: "/taints", label: "Taints", icon: SprayCanIcon },
|
||||
{ to: "/servers", label: "Servers", icon: ServerIcon },
|
||||
{ to: "/ssh", label: "SSH Keys", icon: FileKey2Icon },
|
||||
|
||||
372
ui/src/pages/annotations/annotation-page.tsx
Normal file
372
ui/src/pages/annotations/annotation-page.tsx
Normal file
@@ -0,0 +1,372 @@
|
||||
import { useMemo, useState } from "react"
|
||||
import { annotationsApi } from "@/api/annotations.ts"
|
||||
import { labelsApi } from "@/api/labels.ts"
|
||||
import type { DtoLabelResponse } from "@/sdk"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
|
||||
import { CircleSlash2, Pencil, Plus, Search, Tags } from "lucide-react"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
|
||||
import { truncateMiddle } from "@/lib/utils.ts"
|
||||
import { Badge } from "@/components/ui/badge.tsx"
|
||||
import { Button } from "@/components/ui/button.tsx"
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog.tsx"
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@/components/ui/form.tsx"
|
||||
import { Input } from "@/components/ui/input.tsx"
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table.tsx"
|
||||
|
||||
const createAnnotationSchema = z.object({
|
||||
key: z.string().trim().min(1, "Key is required").max(120, "Max 120 chars"),
|
||||
value: z.string().trim().optional(),
|
||||
})
|
||||
type CreateAnnotationInput = z.input<typeof createAnnotationSchema>
|
||||
|
||||
const updateAnnotationSchema = createAnnotationSchema.partial()
|
||||
type UpdateAnnotationValues = z.infer<typeof updateAnnotationSchema>
|
||||
|
||||
function AnnotationBadge({ t }: { t: Pick<DtoLabelResponse, "key" | "value"> }) {
|
||||
const label = `${t.key}${t.value ? `=${t.value}` : ""}`
|
||||
return (
|
||||
<Badge variant="secondary" className="font-mono text-xs">
|
||||
<Tags className="mr-1 h-3 w-3" />
|
||||
{label}
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
|
||||
export const AnnotationPage = () => {
|
||||
const [filter, setFilter] = useState<string>("")
|
||||
const [createOpen, setCreateOpen] = useState<boolean>(false)
|
||||
const [updateOpen, setUpdateOpen] = useState<boolean>(false)
|
||||
const [deleteId, setDeleteId] = useState<string | null>(null)
|
||||
const [editingId, setEditingId] = useState<string | null>(null)
|
||||
|
||||
const qc = useQueryClient()
|
||||
|
||||
const annotationQ = useQuery({
|
||||
queryKey: ["annotations"],
|
||||
queryFn: () => annotationsApi.listAnnotations(),
|
||||
})
|
||||
|
||||
// --- Create
|
||||
|
||||
const createForm = useForm<CreateAnnotationInput>({
|
||||
resolver: zodResolver(createAnnotationSchema),
|
||||
defaultValues: {
|
||||
key: "",
|
||||
value: "",
|
||||
},
|
||||
})
|
||||
|
||||
const createMut = useMutation({
|
||||
mutationFn: (values: CreateAnnotationInput) => annotationsApi.createAnnotation(values),
|
||||
onSuccess: async () => {
|
||||
await qc.invalidateQueries({ queryKey: ["annotations"] })
|
||||
createForm.reset()
|
||||
setCreateOpen(false)
|
||||
toast.success("Annotation Created Successfully.")
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err.message ?? "There was an error while creating Annotation")
|
||||
},
|
||||
})
|
||||
|
||||
const onCreateSubmit = (values: CreateAnnotationInput) => {
|
||||
createMut.mutate(values)
|
||||
}
|
||||
|
||||
// --- Update
|
||||
const updateForm = useForm<UpdateAnnotationValues>({
|
||||
resolver: zodResolver(updateAnnotationSchema),
|
||||
defaultValues: {},
|
||||
})
|
||||
|
||||
const updateMut = useMutation({
|
||||
mutationFn: ({ id, values }: { id: string; values: UpdateAnnotationValues }) =>
|
||||
annotationsApi.updateAnnotation(id, values),
|
||||
onSuccess: async () => {
|
||||
await qc.invalidateQueries({ queryKey: ["annotations"] })
|
||||
updateForm.reset()
|
||||
setUpdateOpen(false)
|
||||
toast.success("Annotation Updated Successfully.")
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err.message ?? "There was an error while updating Annotation")
|
||||
},
|
||||
})
|
||||
|
||||
const openEdit = (label: any) => {
|
||||
setEditingId(label.id)
|
||||
updateForm.reset({
|
||||
key: label.key,
|
||||
value: label.value,
|
||||
})
|
||||
setUpdateOpen(true)
|
||||
}
|
||||
|
||||
// --- Delete ---
|
||||
|
||||
const deleteMut = useMutation({
|
||||
mutationFn: (id: string) => annotationsApi.deleteAnnotation(id),
|
||||
onSuccess: async () => {
|
||||
await qc.invalidateQueries({ queryKey: ["annotations"] })
|
||||
setDeleteId(null)
|
||||
toast.success("Annotation Deleted Successfully.")
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err.message ?? "There was an error while deleting Annotation")
|
||||
},
|
||||
})
|
||||
|
||||
// --- Filter ---
|
||||
const filtered = useMemo(() => {
|
||||
const data = annotationQ.data ?? []
|
||||
const q = filter.trim().toLowerCase()
|
||||
|
||||
return q
|
||||
? data.filter((k: any) => {
|
||||
return k.key?.toLowerCase().includes(q) || k.value?.toLowerCase().includes(q)
|
||||
})
|
||||
: data
|
||||
}, [filter, annotationQ.data])
|
||||
|
||||
if (annotationQ.isLoading) return <div className="p-6">Loading annotations…</div>
|
||||
if (annotationQ.error)
|
||||
return (
|
||||
<div className="p-6 text-red-500">
|
||||
Error loading annotations.<pre>{JSON.stringify(annotationQ, null, 2)}</pre>
|
||||
</div>
|
||||
)
|
||||
return (
|
||||
<div className="space-y-4 p-6">
|
||||
<div className="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
|
||||
<h1 className="mb-4 text-2xl font-bold">Annotations</h1>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<div className="relative">
|
||||
<Search className="absolute top-2.5 left-2 h-4 w-4 opacity-60" />
|
||||
<Input
|
||||
value={filter}
|
||||
onChange={(e) => setFilter(e.target.value)}
|
||||
placeholder="Search annotations"
|
||||
className="w-64 pl-8"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Dialog open={createOpen} onOpenChange={setCreateOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button onClick={() => setCreateOpen(true)}>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Create Annotation
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="sm:max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Create Label</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<Form {...createForm}>
|
||||
<form className="space-y-4" onSubmit={createForm.handleSubmit(onCreateSubmit)}>
|
||||
<FormField
|
||||
control={createForm.control}
|
||||
name="key"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Key</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="environment" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={createForm.control}
|
||||
name="value"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Value</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="dev" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<DialogFooter className="gap-2">
|
||||
<Button type="button" variant="outline" onClick={() => setCreateOpen(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button type="submit" disabled={createForm.formState.isSubmitting}>
|
||||
{createForm.formState.isSubmitting ? "Creating…" : "Create"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</Form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-background overflow-hidden rounded-2xl border shadow-sm">
|
||||
<div className="overflow-x-auto">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Key</TableHead>
|
||||
<TableHead>Value</TableHead>
|
||||
<TableHead>Annotation</TableHead>
|
||||
<TableHead className="w-[180px] text-right">Actions</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{filtered.map((t) => (
|
||||
<TableRow key={t.id}>
|
||||
<TableCell>{t.key}</TableCell>
|
||||
<TableCell>{t.value}</TableCell>
|
||||
<TableCell>
|
||||
<div className="flex items-center gap-2">
|
||||
<AnnotationBadge t={t} />
|
||||
<code className="text-muted-foreground text-xs">
|
||||
{truncateMiddle(t.id!, 6)}
|
||||
</code>
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
<TableCell>
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="outline" size="sm" onClick={() => openEdit(t)}>
|
||||
<Pencil className="mr-2 h-4 w-4" /> Edit
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
size="sm"
|
||||
onClick={() => setDeleteId(t.id!)}
|
||||
disabled={deleteMut.isPending && deleteId === t.id}
|
||||
>
|
||||
{deleteMut.isPending && deleteId === t.id ? "Deleting…" : "Delete"}
|
||||
</Button>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
|
||||
{filtered.length === 0 && (
|
||||
<TableRow>
|
||||
<TableCell colSpan={4} className="text-muted-foreground py-10 text-center">
|
||||
<CircleSlash2 className="mx-auto mb-2 h-6 w-6 opacity-60" />
|
||||
No labels match your search.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Update dialog */}
|
||||
<Dialog open={updateOpen} onOpenChange={setUpdateOpen}>
|
||||
<DialogContent className="sm:max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Edit Annotation</DialogTitle>
|
||||
</DialogHeader>
|
||||
<Form {...updateForm}>
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={updateForm.handleSubmit((values) => {
|
||||
if (!editingId) return
|
||||
updateMut.mutate({ id: editingId, values })
|
||||
})}
|
||||
>
|
||||
<FormField
|
||||
control={updateForm.control}
|
||||
name="key"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Key</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="dedicated" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={updateForm.control}
|
||||
name="value"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Value (optional)</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="gpu" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<DialogFooter className="gap-2">
|
||||
<Button type="button" variant="outline" onClick={() => setUpdateOpen(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button type="submit" disabled={updateMut.isPending}>
|
||||
{updateMut.isPending ? "Saving…" : "Save changes"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</Form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
{/* Delete confirm dialog */}
|
||||
<Dialog open={!!deleteId} onOpenChange={(open) => !open && setDeleteId(null)}>
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Delete annotation</DialogTitle>
|
||||
</DialogHeader>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
This action cannot be undone. Are you sure you want to delete this annotation?
|
||||
</p>
|
||||
<DialogFooter className="gap-2">
|
||||
<Button variant="outline" onClick={() => setDeleteId(null)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
onClick={() => deleteId && deleteMut.mutate(deleteId)}
|
||||
disabled={deleteMut.isPending}
|
||||
>
|
||||
{deleteMut.isPending ? "Deleting…" : "Delete"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState, type FC } from "react"
|
||||
import { archerAdminApi } from "@/api/archer_admin"
|
||||
import type { AdminListArcherJobsRequest } from "@/sdk"
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
|
||||
import { Loader2, Plus, RefreshCw, Search, X } from "lucide-react"
|
||||
|
||||
@@ -125,13 +126,13 @@ export const JobsPage: FC = () => {
|
||||
queryKey: key,
|
||||
queryFn: () =>
|
||||
archerAdminApi.listJobs({
|
||||
status: status || undefined,
|
||||
status: status,
|
||||
queue: queue || undefined,
|
||||
q: debouncedQ || undefined,
|
||||
page,
|
||||
pageSize,
|
||||
}) as Promise<DtoPageJob>,
|
||||
keepPreviousData: true,
|
||||
} as AdminListArcherJobsRequest) as Promise<DtoPageJob>,
|
||||
placeholderData: (prev) => prev,
|
||||
staleTime: 10_000,
|
||||
})
|
||||
|
||||
@@ -159,7 +160,7 @@ export const JobsPage: FC = () => {
|
||||
|
||||
const busy = jobsQ.isFetching
|
||||
|
||||
const data = jobsQ.data
|
||||
const data = jobsQ.data as DtoPageJob
|
||||
const totalPages = data ? Math.max(1, Math.ceil(data.total / data.pageSize)) : 1
|
||||
|
||||
return (
|
||||
|
||||
@@ -287,7 +287,7 @@ export const LabelsPage = () => {
|
||||
<Dialog open={updateOpen} onOpenChange={setUpdateOpen}>
|
||||
<DialogContent className="sm:max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Edit taint</DialogTitle>
|
||||
<DialogTitle>Edit Label</DialogTitle>
|
||||
</DialogHeader>
|
||||
<Form {...updateForm}>
|
||||
<form
|
||||
@@ -337,7 +337,30 @@ export const LabelsPage = () => {
|
||||
</Form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
<pre>{JSON.stringify(labelsQ.data, null, 2)}</pre>
|
||||
|
||||
{/* Delete confirm dialog */}
|
||||
<Dialog open={!!deleteId} onOpenChange={(open) => !open && setDeleteId(null)}>
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Delete label</DialogTitle>
|
||||
</DialogHeader>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
This action cannot be undone. Are you sure you want to delete this label?
|
||||
</p>
|
||||
<DialogFooter className="gap-2">
|
||||
<Button variant="outline" onClick={() => setDeleteId(null)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
onClick={() => deleteId && deleteMut.mutate(deleteId)}
|
||||
disabled={deleteMut.isPending}
|
||||
>
|
||||
{deleteMut.isPending ? "Deleting…" : "Delete"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -500,7 +500,6 @@ export const MePage = () => {
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
<pre>{JSON.stringify(meQ.data, null, 2)}</pre>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -819,7 +819,6 @@ export const ServerPage = () => {
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
<pre>{JSON.stringify(serverQ.data, null, 2)}</pre>
|
||||
</TooltipProvider>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -470,7 +470,6 @@ export const SshPage = () => {
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
<pre>{JSON.stringify(sshQ.data, null, 2)}</pre>
|
||||
</TooltipProvider>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -422,7 +422,6 @@ export const TaintsPage = () => {
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
<pre>{JSON.stringify(taintsQ.data, null, 2)}</pre>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export interface GetAnnotationRequest {
|
||||
|
||||
export interface ListAnnotationsRequest {
|
||||
xOrgID?: string;
|
||||
name?: string;
|
||||
key?: string;
|
||||
value?: string;
|
||||
q?: string;
|
||||
}
|
||||
@@ -233,14 +233,14 @@ export class AnnotationsApi extends runtime.BaseAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns annotations for the organization in X-Org-ID. Filters: `name`, `value`, and `q` (name contains). Add `include=node_pools` to include linked node pools.
|
||||
* Returns annotations for the organization in X-Org-ID. Filters: `key`, `value`, and `q` (key contains). Add `include=node_pools` to include linked node pools.
|
||||
* List annotations (org scoped)
|
||||
*/
|
||||
async listAnnotationsRaw(requestParameters: ListAnnotationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<DtoAnnotationResponse>>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
if (requestParameters['name'] != null) {
|
||||
queryParameters['name'] = requestParameters['name'];
|
||||
if (requestParameters['key'] != null) {
|
||||
queryParameters['key'] = requestParameters['key'];
|
||||
}
|
||||
|
||||
if (requestParameters['value'] != null) {
|
||||
@@ -283,7 +283,7 @@ export class AnnotationsApi extends runtime.BaseAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns annotations for the organization in X-Org-ID. Filters: `name`, `value`, and `q` (name contains). Add `include=node_pools` to include linked node pools.
|
||||
* Returns annotations for the organization in X-Org-ID. Filters: `key`, `value`, and `q` (key contains). Add `include=node_pools` to include linked node pools.
|
||||
* List annotations (org scoped)
|
||||
*/
|
||||
async listAnnotations(requestParameters: ListAnnotationsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<DtoAnnotationResponse>> {
|
||||
|
||||
@@ -261,11 +261,11 @@ example().catch(console.error);
|
||||
|
||||
## listAnnotations
|
||||
|
||||
> Array<DtoAnnotationResponse> listAnnotations(xOrgID, name, value, q)
|
||||
> Array<DtoAnnotationResponse> listAnnotations(xOrgID, key, value, q)
|
||||
|
||||
List annotations (org scoped)
|
||||
|
||||
Returns annotations for the organization in X-Org-ID. Filters: `name`, `value`, and `q` (name contains). Add `include=node_pools` to include linked node pools.
|
||||
Returns annotations for the organization in X-Org-ID. Filters: `key`, `value`, and `q` (key contains). Add `include=node_pools` to include linked node pools.
|
||||
|
||||
### Example
|
||||
|
||||
@@ -291,11 +291,11 @@ async function example() {
|
||||
const body = {
|
||||
// string | Organization UUID (optional)
|
||||
xOrgID: xOrgID_example,
|
||||
// string | Exact name (optional)
|
||||
name: name_example,
|
||||
// string | Exact key (optional)
|
||||
key: key_example,
|
||||
// string | Exact value (optional)
|
||||
value: value_example,
|
||||
// string | name contains (case-insensitive) (optional)
|
||||
// string | key contains (case-insensitive) (optional)
|
||||
q: q_example,
|
||||
} satisfies ListAnnotationsRequest;
|
||||
|
||||
@@ -317,9 +317,9 @@ example().catch(console.error);
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **xOrgID** | `string` | Organization UUID | [Optional] [Defaults to `undefined`] |
|
||||
| **name** | `string` | Exact name | [Optional] [Defaults to `undefined`] |
|
||||
| **key** | `string` | Exact key | [Optional] [Defaults to `undefined`] |
|
||||
| **value** | `string` | Exact value | [Optional] [Defaults to `undefined`] |
|
||||
| **q** | `string` | name contains (case-insensitive) | [Optional] [Defaults to `undefined`] |
|
||||
| **q** | `string` | key contains (case-insensitive) | [Optional] [Defaults to `undefined`] |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -25,17 +25,17 @@ import type { DtoJob } from '@glueops/autoglue-sdk-go'
|
||||
|
||||
// TODO: Update the object below with actual values
|
||||
const example = {
|
||||
"attempts": null,
|
||||
"created_at": null,
|
||||
"id": null,
|
||||
"last_error": null,
|
||||
"max_attempts": null,
|
||||
"attempts": 0,
|
||||
"created_at": 2025-11-04T09:30:00Z,
|
||||
"id": 01HF7SZK8Z8WG1M3J7S2Z8M2N6,
|
||||
"last_error": error message,
|
||||
"max_attempts": 3,
|
||||
"payload": null,
|
||||
"queue": null,
|
||||
"run_at": null,
|
||||
"queue": default,
|
||||
"run_at": 2025-11-04T09:30:00Z,
|
||||
"status": null,
|
||||
"type": null,
|
||||
"updated_at": null,
|
||||
"type": email.send,
|
||||
"updated_at": 2025-11-04T09:30:00Z,
|
||||
} satisfies DtoJob
|
||||
|
||||
console.log(example)
|
||||
|
||||
@@ -19,9 +19,9 @@ import type { DtoPageJob } from '@glueops/autoglue-sdk-go'
|
||||
// TODO: Update the object below with actual values
|
||||
const example = {
|
||||
"items": null,
|
||||
"page": null,
|
||||
"page_size": null,
|
||||
"total": null,
|
||||
"page": 1,
|
||||
"page_size": 25,
|
||||
"total": 120,
|
||||
} satisfies DtoPageJob
|
||||
|
||||
console.log(example)
|
||||
|
||||
@@ -19,11 +19,11 @@ import type { DtoQueueInfo } from '@glueops/autoglue-sdk-go'
|
||||
|
||||
// TODO: Update the object below with actual values
|
||||
const example = {
|
||||
"failed": null,
|
||||
"name": null,
|
||||
"pending": null,
|
||||
"running": null,
|
||||
"scheduled": null,
|
||||
"failed": 5,
|
||||
"name": default,
|
||||
"pending": 42,
|
||||
"running": 3,
|
||||
"scheduled": 7,
|
||||
} satisfies DtoQueueInfo
|
||||
|
||||
console.log(example)
|
||||
|
||||
@@ -28,68 +28,67 @@ import {
|
||||
*/
|
||||
export interface DtoJob {
|
||||
/**
|
||||
* example: 0
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
attempts?: number;
|
||||
/**
|
||||
* example: 2025-11-04T09:30:00Z
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
* example: 01HF7SZK8Z8WG1M3J7S2Z8M2N6
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* example: dial tcp: i/o timeout
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
last_error?: string;
|
||||
/**
|
||||
* example: 3
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
max_attempts?: number;
|
||||
/**
|
||||
* arbitrary JSON payload
|
||||
*
|
||||
* @type {object}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
payload?: object;
|
||||
/**
|
||||
* example: default
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
queue?: string;
|
||||
/**
|
||||
* example: 2025-11-05T08:00:00Z
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
run_at?: string;
|
||||
/**
|
||||
* enum: queued,running,succeeded,failed,canceled,retrying,scheduled
|
||||
* example: queued
|
||||
*
|
||||
* @type {DtoJobStatus}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
status?: DtoJobStatus;
|
||||
/**
|
||||
* example: email.send
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* example: 2025-11-04T09:31:00Z
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof DtoJob
|
||||
*/
|
||||
|
||||
@@ -34,19 +34,19 @@ export interface DtoPageJob {
|
||||
*/
|
||||
items?: Array<DtoJob>;
|
||||
/**
|
||||
* example: 1
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoPageJob
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* example: 25
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoPageJob
|
||||
*/
|
||||
page_size?: number;
|
||||
/**
|
||||
* example: 120
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoPageJob
|
||||
*/
|
||||
|
||||
@@ -20,31 +20,31 @@ import { mapValues } from '../runtime';
|
||||
*/
|
||||
export interface DtoQueueInfo {
|
||||
/**
|
||||
* example: 5
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoQueueInfo
|
||||
*/
|
||||
failed?: number;
|
||||
/**
|
||||
* example: default
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof DtoQueueInfo
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* example: 42
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoQueueInfo
|
||||
*/
|
||||
pending?: number;
|
||||
/**
|
||||
* example: 3
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoQueueInfo
|
||||
*/
|
||||
running?: number;
|
||||
/**
|
||||
* example: 7
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof DtoQueueInfo
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { orgStore } from "@/auth/org.ts"
|
||||
import { authStore } from "@/auth/store.ts"
|
||||
import {
|
||||
AnnotationsApi,
|
||||
ArcherAdminApi,
|
||||
AuthApi,
|
||||
Configuration,
|
||||
@@ -95,6 +96,9 @@ export function makeLabelsApi() {
|
||||
return makeApiClient(LabelsApi)
|
||||
}
|
||||
|
||||
export function makeAnnotationsApi() {
|
||||
return makeApiClient(AnnotationsApi)
|
||||
}
|
||||
export function makeArcherAdminApi() {
|
||||
return makeApiClient(ArcherAdminApi)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user