mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-08 13:39:53 +00:00
Implement immediate deployment, and automatically load scheduled tasks when the service starts.
This commit is contained in:
parent
90967fc2e1
commit
f6760515e9
@ -62,7 +62,7 @@ func update(ctx context.Context, record *models.Record) error {
|
|||||||
app.GetApp().Logger().Error("update cron job failed", "err", err)
|
app.GetApp().Logger().Error("update cron job failed", "err", err)
|
||||||
return fmt.Errorf("update cron job failed: %w", err)
|
return fmt.Errorf("update cron job failed: %w", err)
|
||||||
}
|
}
|
||||||
app.GetApp().Logger().Error("update cron job failed", "domain", record.GetString("domain"))
|
app.GetApp().Logger().Info("update cron job success", "domain", record.GetString("domain"))
|
||||||
|
|
||||||
scheduler.Start()
|
scheduler.Start()
|
||||||
return nil
|
return nil
|
||||||
|
32
internal/domains/init.go
Normal file
32
internal/domains/init.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package domains
|
||||||
|
|
||||||
|
import (
|
||||||
|
"certimate/internal/utils/app"
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitSchedule() {
|
||||||
|
// 查询所有启用的域名
|
||||||
|
records, err := app.GetApp().Dao().FindRecordsByFilter("domains", "enabled=true", "-id", 500, 0)
|
||||||
|
if err != nil {
|
||||||
|
app.GetApp().Logger().Error("查询所有启用的域名失败", "err", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加入到定时任务
|
||||||
|
for _, record := range records {
|
||||||
|
if err := app.GetScheduler().Add(record.Id, record.GetString("crontab"), func() {
|
||||||
|
if err := deploy(context.Background(), record); err != nil {
|
||||||
|
app.GetApp().Logger().Error("部署失败", "err", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}); err != nil {
|
||||||
|
app.GetApp().Logger().Error("加入到定时任务失败", "err", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 启动定时任务
|
||||||
|
app.GetScheduler().Start()
|
||||||
|
app.GetApp().Logger().Info("定时任务启动成功", "total", app.GetScheduler().Total())
|
||||||
|
|
||||||
|
}
|
2
main.go
2
main.go
@ -31,6 +31,8 @@ func main() {
|
|||||||
|
|
||||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
|
|
||||||
|
domains.InitSchedule()
|
||||||
|
|
||||||
e.Router.GET(
|
e.Router.GET(
|
||||||
"/*",
|
"/*",
|
||||||
echo.StaticDirectoryHandler(ui.DistDirFS, false),
|
echo.StaticDirectoryHandler(ui.DistDirFS, false),
|
||||||
|
228
ui/dist/assets/index-5KJiNPtI.js
vendored
Normal file
228
ui/dist/assets/index-5KJiNPtI.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
ui/dist/assets/index-BrfolDry.css
vendored
1
ui/dist/assets/index-BrfolDry.css
vendored
File diff suppressed because one or more lines are too long
1
ui/dist/assets/index-D631C4rs.css
vendored
Normal file
1
ui/dist/assets/index-D631C4rs.css
vendored
Normal file
File diff suppressed because one or more lines are too long
222
ui/dist/assets/index-D8LCaikl.js
vendored
222
ui/dist/assets/index-D8LCaikl.js
vendored
File diff suppressed because one or more lines are too long
4
ui/dist/index.html
vendored
4
ui/dist/index.html
vendored
@ -5,8 +5,8 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Certimate - Your Trusted SSL Automation Partner</title>
|
<title>Certimate - Your Trusted SSL Automation Partner</title>
|
||||||
<script type="module" crossorigin src="/assets/index-D8LCaikl.js"></script>
|
<script type="module" crossorigin src="/assets/index-5KJiNPtI.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-BrfolDry.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-D631C4rs.css">
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-background">
|
<body class="bg-background">
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
28
ui/package-lock.json
generated
28
ui/package-lock.json
generated
@ -9,6 +9,7 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^3.9.0",
|
"@hookform/resolvers": "^3.9.0",
|
||||||
|
"@radix-ui/react-alert-dialog": "^1.1.1",
|
||||||
"@radix-ui/react-dialog": "^1.1.1",
|
"@radix-ui/react-dialog": "^1.1.1",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.1",
|
"@radix-ui/react-dropdown-menu": "^2.1.1",
|
||||||
"@radix-ui/react-label": "^2.1.0",
|
"@radix-ui/react-label": "^2.1.0",
|
||||||
@ -1115,6 +1116,33 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@radix-ui/primitive/-/primitive-1.1.0.tgz",
|
"resolved": "https://registry.npmmirror.com/@radix-ui/primitive/-/primitive-1.1.0.tgz",
|
||||||
"integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA=="
|
"integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/@radix-ui/react-alert-dialog": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@radix-ui/react-alert-dialog/-/react-alert-dialog-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-wmCoJwj7byuVuiLKqDLlX7ClSUU0vd9sdCeM+2Ls+uf13+cpSJoMgwysHq1SGVVkJj5Xn0XWi1NoRCdkMpr6Mw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@radix-ui/primitive": "1.1.0",
|
||||||
|
"@radix-ui/react-compose-refs": "1.1.0",
|
||||||
|
"@radix-ui/react-context": "1.1.0",
|
||||||
|
"@radix-ui/react-dialog": "1.1.1",
|
||||||
|
"@radix-ui/react-primitive": "2.0.0",
|
||||||
|
"@radix-ui/react-slot": "1.1.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/react": "*",
|
||||||
|
"@types/react-dom": "*",
|
||||||
|
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||||
|
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@types/react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@radix-ui/react-arrow": {
|
"node_modules/@radix-ui/react-arrow": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmmirror.com/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz",
|
"resolved": "https://registry.npmmirror.com/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz",
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^3.9.0",
|
"@hookform/resolvers": "^3.9.0",
|
||||||
|
"@radix-ui/react-alert-dialog": "^1.1.1",
|
||||||
"@radix-ui/react-dialog": "^1.1.1",
|
"@radix-ui/react-dialog": "^1.1.1",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.1",
|
"@radix-ui/react-dropdown-menu": "^2.1.1",
|
||||||
"@radix-ui/react-label": "^2.1.0",
|
"@radix-ui/react-label": "^2.1.0",
|
||||||
|
15
ui/src/components/Show.tsx
Normal file
15
ui/src/components/Show.tsx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const Show = ({
|
||||||
|
when,
|
||||||
|
children,
|
||||||
|
fallback,
|
||||||
|
}: {
|
||||||
|
when: boolean;
|
||||||
|
children: React.ReactNode;
|
||||||
|
fallback?: React.ReactNode;
|
||||||
|
}) => {
|
||||||
|
return when ? children : fallback;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Show;
|
139
ui/src/components/ui/alert-dialog.tsx
Normal file
139
ui/src/components/ui/alert-dialog.tsx
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { buttonVariants } from "@/components/ui/button"
|
||||||
|
|
||||||
|
const AlertDialog = AlertDialogPrimitive.Root
|
||||||
|
|
||||||
|
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
||||||
|
|
||||||
|
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
||||||
|
|
||||||
|
const AlertDialogOverlay = React.forwardRef<
|
||||||
|
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<AlertDialogPrimitive.Overlay
|
||||||
|
className={cn(
|
||||||
|
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
ref={ref}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
||||||
|
|
||||||
|
const AlertDialogContent = React.forwardRef<
|
||||||
|
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<AlertDialogPortal>
|
||||||
|
<AlertDialogOverlay />
|
||||||
|
<AlertDialogPrimitive.Content
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
</AlertDialogPortal>
|
||||||
|
))
|
||||||
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
||||||
|
|
||||||
|
const AlertDialogHeader = ({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex flex-col space-y-2 text-center sm:text-left",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
AlertDialogHeader.displayName = "AlertDialogHeader"
|
||||||
|
|
||||||
|
const AlertDialogFooter = ({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
AlertDialogFooter.displayName = "AlertDialogFooter"
|
||||||
|
|
||||||
|
const AlertDialogTitle = React.forwardRef<
|
||||||
|
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<AlertDialogPrimitive.Title
|
||||||
|
ref={ref}
|
||||||
|
className={cn("text-lg font-semibold", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
||||||
|
|
||||||
|
const AlertDialogDescription = React.forwardRef<
|
||||||
|
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<AlertDialogPrimitive.Description
|
||||||
|
ref={ref}
|
||||||
|
className={cn("text-sm text-muted-foreground", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
AlertDialogDescription.displayName =
|
||||||
|
AlertDialogPrimitive.Description.displayName
|
||||||
|
|
||||||
|
const AlertDialogAction = React.forwardRef<
|
||||||
|
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<AlertDialogPrimitive.Action
|
||||||
|
ref={ref}
|
||||||
|
className={cn(buttonVariants(), className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
||||||
|
|
||||||
|
const AlertDialogCancel = React.forwardRef<
|
||||||
|
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<AlertDialogPrimitive.Cancel
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
buttonVariants({ variant: "outline" }),
|
||||||
|
"mt-2 sm:mt-0",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
||||||
|
|
||||||
|
export {
|
||||||
|
AlertDialog,
|
||||||
|
AlertDialogPortal,
|
||||||
|
AlertDialogOverlay,
|
||||||
|
AlertDialogTrigger,
|
||||||
|
AlertDialogContent,
|
||||||
|
AlertDialogHeader,
|
||||||
|
AlertDialogFooter,
|
||||||
|
AlertDialogTitle,
|
||||||
|
AlertDialogDescription,
|
||||||
|
AlertDialogAction,
|
||||||
|
AlertDialogCancel,
|
||||||
|
}
|
@ -15,6 +15,7 @@ export type Domain = {
|
|||||||
created?: string;
|
created?: string;
|
||||||
updated?: string;
|
updated?: string;
|
||||||
deleted?: string;
|
deleted?: string;
|
||||||
|
rightnow?: boolean;
|
||||||
expand?: {
|
expand?: {
|
||||||
lastDeployment?: Deployment;
|
lastDeployment?: Deployment;
|
||||||
};
|
};
|
||||||
|
@ -1,19 +1,35 @@
|
|||||||
import DeployProgress from "@/components/certimate/DeployProgress";
|
import DeployProgress from "@/components/certimate/DeployProgress";
|
||||||
|
import Show from "@/components/Show";
|
||||||
|
import {
|
||||||
|
AlertDialogAction,
|
||||||
|
AlertDialogCancel,
|
||||||
|
AlertDialogDescription,
|
||||||
|
AlertDialogFooter,
|
||||||
|
AlertDialogHeader,
|
||||||
|
AlertDialog,
|
||||||
|
AlertDialogContent,
|
||||||
|
AlertDialogTitle,
|
||||||
|
AlertDialogTrigger,
|
||||||
|
} from "@/components/ui/alert-dialog";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { Toaster } from "@/components/ui/toaster";
|
import { Toaster } from "@/components/ui/toaster";
|
||||||
import { Tooltip, TooltipTrigger } from "@/components/ui/tooltip";
|
import { Tooltip, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
|
import { useToast } from "@/components/ui/use-toast";
|
||||||
import { Domain } from "@/domain/domain";
|
import { Domain } from "@/domain/domain";
|
||||||
import { convertZulu2Beijing, getDate } from "@/lib/time";
|
import { convertZulu2Beijing, getDate } from "@/lib/time";
|
||||||
import { list, remove, save } from "@/repository/domains";
|
import { list, remove, save } from "@/repository/domains";
|
||||||
|
|
||||||
import { TooltipContent, TooltipProvider } from "@radix-ui/react-tooltip";
|
import { TooltipContent, TooltipProvider } from "@radix-ui/react-tooltip";
|
||||||
import { CircleCheck, CircleX, Earth } from "lucide-react";
|
import { CircleCheck, CircleX, Earth } from "lucide-react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
|
const toast = useToast();
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const handleCreateClick = () => {
|
const handleCreateClick = () => {
|
||||||
navigate("/edit");
|
navigate("/edit");
|
||||||
@ -64,6 +80,37 @@ const Home = () => {
|
|||||||
setDomains(updatedDomains);
|
setDomains(updatedDomains);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRightNowClick = async (domain: Domain) => {
|
||||||
|
try {
|
||||||
|
domain.rightnow = true;
|
||||||
|
const resp = await save(domain);
|
||||||
|
const updatedDomains = domains.map((domain) => {
|
||||||
|
if (domain.id === resp.id) {
|
||||||
|
return { ...resp };
|
||||||
|
}
|
||||||
|
return domain;
|
||||||
|
});
|
||||||
|
setDomains(updatedDomains);
|
||||||
|
} catch (e) {
|
||||||
|
toast.toast({
|
||||||
|
title: "执行失败",
|
||||||
|
description: (
|
||||||
|
<>
|
||||||
|
执行失败,请查看
|
||||||
|
<Link
|
||||||
|
to={`/history?domain=${domain.id}`}
|
||||||
|
className="underline text-blue-500"
|
||||||
|
>
|
||||||
|
部署日志
|
||||||
|
</Link>
|
||||||
|
查看详情。
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
variant: "destructive",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="">
|
<div className="">
|
||||||
@ -179,16 +226,46 @@ const Home = () => {
|
|||||||
>
|
>
|
||||||
部署历史
|
部署历史
|
||||||
</Button>
|
</Button>
|
||||||
|
<Show when={domain.enabled ? true : false}>
|
||||||
|
<Separator orientation="vertical" className="h-4 mx-2" />
|
||||||
|
<Button
|
||||||
|
variant={"link"}
|
||||||
|
className="p-0"
|
||||||
|
onClick={() => handleRightNowClick(domain)}
|
||||||
|
>
|
||||||
|
立即执行
|
||||||
|
</Button>
|
||||||
|
</Show>
|
||||||
|
|
||||||
{!domain.enabled && (
|
{!domain.enabled && (
|
||||||
<>
|
<>
|
||||||
<Separator orientation="vertical" className="h-4 mx-2" />
|
<Separator orientation="vertical" className="h-4 mx-2" />
|
||||||
<Button
|
<AlertDialog>
|
||||||
variant={"link"}
|
<AlertDialogTrigger asChild>
|
||||||
className="p-0"
|
<Button variant={"link"} className="p-0">
|
||||||
onClick={() => handleDeleteClick(domain.id)}
|
删除
|
||||||
>
|
</Button>
|
||||||
删除
|
</AlertDialogTrigger>
|
||||||
</Button>
|
<AlertDialogContent>
|
||||||
|
<AlertDialogHeader>
|
||||||
|
<AlertDialogTitle>删除域名</AlertDialogTitle>
|
||||||
|
<AlertDialogDescription>
|
||||||
|
确定要删除域名吗?
|
||||||
|
</AlertDialogDescription>
|
||||||
|
</AlertDialogHeader>
|
||||||
|
<AlertDialogFooter>
|
||||||
|
<AlertDialogCancel>取消</AlertDialogCancel>
|
||||||
|
<AlertDialogAction
|
||||||
|
onClick={() => {
|
||||||
|
handleDeleteClick(domain.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</AlertDialogAction>
|
||||||
|
</AlertDialogFooter>
|
||||||
|
</AlertDialogContent>
|
||||||
|
</AlertDialog>
|
||||||
|
|
||||||
<Separator orientation="vertical" className="h-4 mx-2" />
|
<Separator orientation="vertical" className="h-4 mx-2" />
|
||||||
<Button
|
<Button
|
||||||
variant={"link"}
|
variant={"link"}
|
||||||
|
@ -7,7 +7,7 @@ export const list = async (req: DeploymentListReq) => {
|
|||||||
page = req.page;
|
page = req.page;
|
||||||
}
|
}
|
||||||
|
|
||||||
let perPage = 10;
|
let perPage = 50;
|
||||||
if (req.perPage) {
|
if (req.perPage) {
|
||||||
perPage = req.perPage;
|
perPage = req.perPage;
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ export const list = async (req: DeploymentListReq) => {
|
|||||||
.collection("deployments")
|
.collection("deployments")
|
||||||
.getList<Deployment>(page, perPage, {
|
.getList<Deployment>(page, perPage, {
|
||||||
filter: filter,
|
filter: filter,
|
||||||
sort: "-id",
|
sort: "-deployedAt",
|
||||||
expand: "domain",
|
expand: "domain",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -17,9 +17,9 @@ export const get = async (id: string) => {
|
|||||||
|
|
||||||
export const save = async (data: Domain) => {
|
export const save = async (data: Domain) => {
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
return await getPb().collection("domains").update(data.id, data);
|
return await getPb().collection("domains").update<Domain>(data.id, data);
|
||||||
}
|
}
|
||||||
return await getPb().collection("domains").create(data);
|
return await getPb().collection("domains").create<Domain>(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const remove = async (id: string) => {
|
export const remove = async (id: string) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user