mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 21:00:06 +01:00
fix: ui updates for org api keys
Signed-off-by: allanice001 <allanice001@gmail.com>
This commit is contained in:
@@ -1,36 +1,56 @@
|
||||
;
|
||||
// src/pages/ClustersPage.tsx
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { clustersApi } from "@/api/clusters";
|
||||
import { dnsApi } from "@/api/dns";
|
||||
import { loadBalancersApi } from "@/api/loadbalancers";
|
||||
import { nodePoolsApi } from "@/api/node_pools";
|
||||
import { serversApi } from "@/api/servers";
|
||||
import type { DtoClusterResponse, DtoDomainResponse, DtoLoadBalancerResponse, DtoNodePoolResponse, DtoRecordSetResponse, DtoServerResponse } from "@/sdk";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { AlertCircle, CheckCircle2, CircleSlash2, FileCode2, Globe2, Loader2, MapPin, Pencil, Plus, Search, Server, Wrench } from "lucide-react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { toast } from "sonner";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
|
||||
import { truncateMiddle } from "@/lib/utils";
|
||||
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 { Label } from "@/components/ui/label.tsx";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select.tsx";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table.tsx";
|
||||
import { Textarea } from "@/components/ui/textarea.tsx";
|
||||
|
||||
|
||||
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
import { clustersApi } from "@/api/clusters"
|
||||
import { dnsApi } from "@/api/dns"
|
||||
import { loadBalancersApi } from "@/api/loadbalancers"
|
||||
import { nodePoolsApi } from "@/api/node_pools"
|
||||
import { serversApi } from "@/api/servers"
|
||||
import type {
|
||||
DtoClusterResponse,
|
||||
DtoDomainResponse,
|
||||
DtoLoadBalancerResponse,
|
||||
DtoNodePoolResponse,
|
||||
DtoRecordSetResponse,
|
||||
DtoServerResponse,
|
||||
} from "@/sdk"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
|
||||
import {
|
||||
AlertCircle,
|
||||
CheckCircle2,
|
||||
CircleSlash2,
|
||||
FileCode2,
|
||||
Globe2,
|
||||
Loader2,
|
||||
MapPin,
|
||||
Pencil,
|
||||
Plus,
|
||||
Search,
|
||||
Server,
|
||||
Wrench,
|
||||
} from "lucide-react"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
|
||||
import { truncateMiddle } from "@/lib/utils"
|
||||
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 { Label } from "@/components/ui/label.tsx"
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select.tsx"
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table.tsx"
|
||||
import { Textarea } from "@/components/ui/textarea.tsx"
|
||||
|
||||
// --- Schemas ---
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useForm } from "react-hook-form"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
|
||||
import { Badge } from "@/components/ui/badge.tsx"
|
||||
import { Button } from "@/components/ui/button.tsx"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx"
|
||||
import {
|
||||
@@ -161,6 +162,7 @@ export const OrgApiKeys = () => {
|
||||
<TableHead>Scope</TableHead>
|
||||
<TableHead>Created</TableHead>
|
||||
<TableHead>Expires</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
<TableHead className="w-28" />
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
@@ -173,6 +175,33 @@ export const OrgApiKeys = () => {
|
||||
<TableCell>
|
||||
{k.expires_at ? new Date(k.expires_at).toLocaleString() : "-"}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{(() => {
|
||||
const isExpired = k.expires_at ? new Date(k.expires_at) <= new Date() : false
|
||||
|
||||
if (k.revoked) {
|
||||
return (
|
||||
<Badge variant="destructive" className="font-mono">
|
||||
Revoked
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
|
||||
if (isExpired) {
|
||||
return (
|
||||
<Badge variant="outline" className="font-mono">
|
||||
Expired
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Badge variant="secondary" className="font-mono">
|
||||
Active
|
||||
</Badge>
|
||||
)
|
||||
})()}
|
||||
</TableCell>
|
||||
<TableCell className="text-right">
|
||||
<Button variant="destructive" size="sm" onClick={() => deleteMut.mutate(k.id!)}>
|
||||
Delete
|
||||
|
||||
Reference in New Issue
Block a user