@@ -72,7 +72,7 @@ useTabsDrag(props, emit);
v-show="showScrollButton"
:class="{
'hover:bg-muted text-muted-foreground cursor-pointer': !scrollIsAtRight,
- 'pointer-events-none opacity-30': scrollIsAtRight
+ 'pointer-events-none opacity-30': scrollIsAtRight,
}"
class="hover:bg-muted text-muted-foreground cursor-pointer border-l px-2"
@click="scrollDirection('right')"
diff --git a/packages/ui/certd-client/src/vben/tabs-ui/types.ts b/packages/ui/certd-client/src/vben/tabs-ui/types.ts
index 5e5b46c0c..e6170ccc4 100644
--- a/packages/ui/certd-client/src/vben/tabs-ui/types.ts
+++ b/packages/ui/certd-client/src/vben/tabs-ui/types.ts
@@ -1,5 +1,5 @@
-import type { IContextMenuItem } from '/@/vben/shadcn-ui';
-import type { TabDefinition, TabsStyleType } from '/@/vben/typings';
+import type { IContextMenuItem } from "/@/vben/shadcn-ui";
+import type { TabDefinition, TabsStyleType } from "/@/vben/typings";
export type TabsEmits = {
close: [string];
diff --git a/packages/ui/certd-client/src/vben/tabs-ui/use-tabs-drag.ts b/packages/ui/certd-client/src/vben/tabs-ui/use-tabs-drag.ts
index 99e71585f..55c8f2de0 100644
--- a/packages/ui/certd-client/src/vben/tabs-ui/use-tabs-drag.ts
+++ b/packages/ui/certd-client/src/vben/tabs-ui/use-tabs-drag.ts
@@ -1,18 +1,16 @@
-import type { Sortable } from '/@/vben/composables';
-import type { EmitType } from '/@/vben/typings';
+import type { Sortable } from "/@/vben/composables";
+import type { EmitType } from "/@/vben/typings";
-import type { TabsProps } from './types';
+import type { TabsProps } from "./types";
-import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
+import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
-import { useIsMobile, useSortable } from '/@/vben/composables';
+import { useIsMobile, useSortable } from "/@/vben/composables";
// 可能会找到拖拽的子元素,这里需要确保拖拽的dom时tab元素
function findParentElement(element: HTMLElement) {
- const parentCls = 'group';
- return element.classList.contains(parentCls)
- ? element
- : element.closest(`.${parentCls}`);
+ const parentCls = "group";
+ return element.classList.contains(parentCls) ? element : element.closest(`.${parentCls}`);
}
export function useTabsDrag(props: TabsProps, emit: EmitType) {
@@ -21,25 +19,23 @@ export function useTabsDrag(props: TabsProps, emit: EmitType) {
async function initTabsSortable() {
await nextTick();
- const el = document.querySelectorAll(
- `.${props.contentClass}`,
- )?.[0] as HTMLElement;
+ const el = document.querySelectorAll(`.${props.contentClass}`)?.[0] as HTMLElement;
if (!el) {
- console.warn('Element not found for sortable initialization');
+ console.warn("Element not found for sortable initialization");
return;
}
const resetElState = async () => {
- el.style.cursor = 'default';
+ el.style.cursor = "default";
// el.classList.remove('dragging');
- el.querySelector('.draggable')?.classList.remove('dragging');
+ el.querySelector(".draggable")?.classList.remove("dragging");
};
const { initializeSortable } = useSortable(el, {
filter: (_evt, target: HTMLElement) => {
const parent = findParentElement(target);
- const draggable = parent?.classList.contains('draggable');
+ const draggable = parent?.classList.contains("draggable");
return !draggable || !props.draggable;
},
onEnd(evt) {
@@ -59,28 +55,22 @@ export function useTabsDrag(props: TabsProps, emit: EmitType) {
return;
}
- if (!srcParent.classList.contains('draggable')) {
+ if (!srcParent.classList.contains("draggable")) {
resetElState();
return;
}
- if (
- oldIndex !== undefined &&
- newIndex !== undefined &&
- !Number.isNaN(oldIndex) &&
- !Number.isNaN(newIndex) &&
- oldIndex !== newIndex
- ) {
- emit('sortTabs', oldIndex, newIndex);
+ if (oldIndex !== undefined && newIndex !== undefined && !Number.isNaN(oldIndex) && !Number.isNaN(newIndex) && oldIndex !== newIndex) {
+ emit("sortTabs", oldIndex, newIndex);
}
resetElState();
},
onMove(evt) {
const parent = findParentElement(evt.related);
- if (parent?.classList.contains('draggable') && props.draggable) {
- const isCurrentAffix = evt.dragged.classList.contains('affix-tab');
- const isRelatedAffix = evt.related.classList.contains('affix-tab');
+ if (parent?.classList.contains("draggable") && props.draggable) {
+ const isCurrentAffix = evt.dragged.classList.contains("affix-tab");
+ const isRelatedAffix = evt.related.classList.contains("affix-tab");
// 不允许在固定的tab和非固定的tab之间互相拖拽
return isCurrentAffix === isRelatedAffix;
} else {
@@ -88,8 +78,8 @@ export function useTabsDrag(props: TabsProps, emit: EmitType) {
}
},
onStart: () => {
- el.style.cursor = 'grabbing';
- el.querySelector('.draggable')?.classList.add('dragging');
+ el.style.cursor = "grabbing";
+ el.querySelector(".draggable")?.classList.add("dragging");
// el.classList.add('dragging');
},
});
@@ -115,7 +105,7 @@ export function useTabsDrag(props: TabsProps, emit: EmitType) {
() => {
sortableInstance.value?.destroy();
init();
- },
+ }
);
onUnmounted(() => {
diff --git a/packages/ui/certd-client/src/vben/tabs-ui/use-tabs-view-scroll.ts b/packages/ui/certd-client/src/vben/tabs-ui/use-tabs-view-scroll.ts
index c734fef1a..c8e2aeb6e 100644
--- a/packages/ui/certd-client/src/vben/tabs-ui/use-tabs-view-scroll.ts
+++ b/packages/ui/certd-client/src/vben/tabs-ui/use-tabs-view-scroll.ts
@@ -1,10 +1,10 @@
-import type { TabsProps } from './types';
+import type { TabsProps } from "./types";
-import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
+import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
-import { VbenScrollbar } from '/@/vben/shadcn-ui';
+import { VbenScrollbar } from "/@/vben/shadcn-ui";
-import { useDebounceFn } from '@vueuse/core';
+import { useDebounceFn } from "@vueuse/core";
type DomElement = Element | null | undefined;
@@ -31,10 +31,7 @@ export function useTabsViewScroll(props: TabsProps) {
};
}
- function scrollDirection(
- direction: 'left' | 'right',
- distance: number = 150,
- ) {
+ function scrollDirection(direction: "left" | "right", distance: number = 150) {
const { scrollbarWidth, scrollViewWidth } = getScrollClientWidth();
if (!scrollbarWidth || !scrollViewWidth) return;
@@ -42,11 +39,8 @@ export function useTabsViewScroll(props: TabsProps) {
if (scrollbarWidth > scrollViewWidth) return;
scrollViewportEl.value?.scrollBy({
- behavior: 'smooth',
- left:
- direction === 'left'
- ? -(scrollbarWidth - distance)
- : +(scrollbarWidth - distance),
+ behavior: "smooth",
+ left: direction === "left" ? -(scrollbarWidth - distance) : +(scrollbarWidth - distance),
});
}
@@ -58,9 +52,7 @@ export function useTabsViewScroll(props: TabsProps) {
return;
}
- const viewportEl = scrollbarEl?.querySelector(
- 'div[data-radix-scroll-area-viewport]',
- );
+ const viewportEl = scrollbarEl?.querySelector("div[data-radix-scroll-area-viewport]");
scrollViewportEl.value = viewportEl;
calcShowScrollbarButton();
@@ -74,7 +66,7 @@ export function useTabsViewScroll(props: TabsProps) {
useDebounceFn((_entries: ResizeObserverEntry[]) => {
calcShowScrollbarButton();
scrollToActiveIntoView();
- }, 100),
+ }, 100)
);
resizeObserver.observe(viewportEl);
@@ -82,9 +74,7 @@ export function useTabsViewScroll(props: TabsProps) {
mutationObserver?.disconnect();
// 使用 MutationObserver 仅监听子节点数量变化
mutationObserver = new MutationObserver(() => {
- const count = viewportEl.querySelectorAll(
- `div[data-tab-item="true"]`,
- ).length;
+ const count = viewportEl.querySelectorAll(`div[data-tab-item="true"]`).length;
if (count > tabItemCount) {
scrollToActiveIntoView();
@@ -118,8 +108,8 @@ export function useTabsViewScroll(props: TabsProps) {
}
requestAnimationFrame(() => {
- const activeItem = viewportEl?.querySelector('.is-active');
- activeItem?.scrollIntoView({ behavior: 'smooth', inline: 'start' });
+ const activeItem = viewportEl?.querySelector(".is-active");
+ activeItem?.scrollIntoView({ behavior: "smooth", inline: "start" });
});
}
@@ -133,8 +123,7 @@ export function useTabsViewScroll(props: TabsProps) {
const { scrollbarWidth } = getScrollClientWidth();
- showScrollButton.value =
- scrollViewportEl.value.scrollWidth > scrollbarWidth;
+ showScrollButton.value = scrollViewportEl.value.scrollWidth > scrollbarWidth;
}
const handleScrollAt = useDebounceFn(({ left, right }) => {
@@ -158,8 +147,8 @@ export function useTabsViewScroll(props: TabsProps) {
// }, 300);
},
{
- flush: 'post',
- },
+ flush: "post",
+ }
);
// watch(
@@ -177,7 +166,7 @@ export function useTabsViewScroll(props: TabsProps) {
() => props.styleType,
() => {
initScrollbar();
- },
+ }
);
onMounted(initScrollbar);
diff --git a/packages/ui/certd-client/src/vben/typings/app.d.ts b/packages/ui/certd-client/src/vben/typings/app.d.ts
index ef3f0896b..d9d3cee3d 100644
--- a/packages/ui/certd-client/src/vben/typings/app.d.ts
+++ b/packages/ui/certd-client/src/vben/typings/app.d.ts
@@ -99,5 +99,5 @@ export type {
PageTransitionType,
PreferencesButtonPositionType,
TabsStyleType,
- ThemeModeType
+ ThemeModeType,
};
diff --git a/packages/ui/certd-client/src/vben/typings/helper.d.ts b/packages/ui/certd-client/src/vben/typings/helper.d.ts
index a3ec9b933..aa0424334 100644
--- a/packages/ui/certd-client/src/vben/typings/helper.d.ts
+++ b/packages/ui/certd-client/src/vben/typings/helper.d.ts
@@ -115,5 +115,5 @@ export type {
Nullable,
ReadonlyRecordable,
Recordable,
- TimeoutHandle
+ TimeoutHandle,
};
diff --git a/packages/ui/certd-client/src/vben/typings/tabs.ts b/packages/ui/certd-client/src/vben/typings/tabs.ts
index c78a90c5b..5bff6b6ae 100644
--- a/packages/ui/certd-client/src/vben/typings/tabs.ts
+++ b/packages/ui/certd-client/src/vben/typings/tabs.ts
@@ -1,3 +1,3 @@
-import type { RouteLocationNormalized } from 'vue-router';
+import type { RouteLocationNormalized } from "vue-router";
export type TabDefinition = RouteLocationNormalized;
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/__tests__/find-menu-by-path.test.ts b/packages/ui/certd-client/src/vben/utils/helpers/__tests__/find-menu-by-path.test.ts
index fc0d76b58..d77c0df1f 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/__tests__/find-menu-by-path.test.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/__tests__/find-menu-by-path.test.ts
@@ -1,86 +1,77 @@
-import { describe, expect, it } from 'vitest';
+import { describe, expect, it } from "vitest";
-import { findMenuByPath, findRootMenuByPath } from '../find-menu-by-path';
+import { findMenuByPath, findRootMenuByPath } from "../find-menu-by-path";
// 示例菜单数据
const menus: any[] = [
- { path: '/', children: [] },
- { path: '/about', children: [] },
+ { path: "/", children: [] },
+ { path: "/about", children: [] },
{
- path: '/contact',
+ path: "/contact",
children: [
- { path: '/contact/email', children: [] },
- { path: '/contact/phone', children: [] },
+ { path: "/contact/email", children: [] },
+ { path: "/contact/phone", children: [] },
],
},
{
- path: '/services',
+ path: "/services",
children: [
- { path: '/services/design', children: [] },
+ { path: "/services/design", children: [] },
{
- path: '/services/development',
- children: [{ path: '/services/development/web', children: [] }],
+ path: "/services/development",
+ children: [{ path: "/services/development/web", children: [] }],
},
],
},
];
-describe('menu Finder Tests', () => {
- it('finds a top-level menu', () => {
- const menu = findMenuByPath(menus, '/about');
+describe("menu Finder Tests", () => {
+ it("finds a top-level menu", () => {
+ const menu = findMenuByPath(menus, "/about");
expect(menu).toBeDefined();
- expect(menu?.path).toBe('/about');
+ expect(menu?.path).toBe("/about");
});
- it('finds a nested menu', () => {
- const menu = findMenuByPath(menus, '/services/development/web');
+ it("finds a nested menu", () => {
+ const menu = findMenuByPath(menus, "/services/development/web");
expect(menu).toBeDefined();
- expect(menu?.path).toBe('/services/development/web');
+ expect(menu?.path).toBe("/services/development/web");
});
- it('returns null for a non-existent path', () => {
- const menu = findMenuByPath(menus, '/non-existent');
+ it("returns null for a non-existent path", () => {
+ const menu = findMenuByPath(menus, "/non-existent");
expect(menu).toBeNull();
});
- it('handles empty menus list', () => {
- const menu = findMenuByPath([], '/about');
+ it("handles empty menus list", () => {
+ const menu = findMenuByPath([], "/about");
expect(menu).toBeNull();
});
- it('handles menu items without children', () => {
- const menu = findMenuByPath(
- [{ path: '/only', children: undefined }] as any[],
- '/only',
- );
+ it("handles menu items without children", () => {
+ const menu = findMenuByPath([{ path: "/only", children: undefined }] as any[], "/only");
expect(menu).toBeDefined();
- expect(menu?.path).toBe('/only');
+ expect(menu?.path).toBe("/only");
});
- it('finds root menu by path', () => {
- const { findMenu, rootMenu, rootMenuPath } = findRootMenuByPath(
- menus,
- '/services/development/web',
- );
+ it("finds root menu by path", () => {
+ const { findMenu, rootMenu, rootMenuPath } = findRootMenuByPath(menus, "/services/development/web");
expect(findMenu).toBeDefined();
expect(rootMenu).toBeUndefined();
expect(rootMenuPath).toBeUndefined();
- expect(findMenu?.path).toBe('/services/development/web');
+ expect(findMenu?.path).toBe("/services/development/web");
});
- it('returns null for undefined or empty path', () => {
+ it("returns null for undefined or empty path", () => {
const menuUndefinedPath = findMenuByPath(menus);
- const menuEmptyPath = findMenuByPath(menus, '');
+ const menuEmptyPath = findMenuByPath(menus, "");
expect(menuUndefinedPath).toBeNull();
expect(menuEmptyPath).toBeNull();
});
- it('checks for root menu when path does not exist', () => {
- const { findMenu, rootMenu, rootMenuPath } = findRootMenuByPath(
- menus,
- '/non-existent',
- );
+ it("checks for root menu when path does not exist", () => {
+ const { findMenu, rootMenu, rootMenuPath } = findRootMenuByPath(menus, "/non-existent");
expect(findMenu).toBeNull();
expect(rootMenu).toBeUndefined();
expect(rootMenuPath).toBeUndefined();
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/__tests__/generate-menus.test.ts b/packages/ui/certd-client/src/vben/utils/helpers/__tests__/generate-menus.test.ts
index 9d98b5a19..be4f7a8a6 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/__tests__/generate-menus.test.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/__tests__/generate-menus.test.ts
@@ -1,30 +1,30 @@
-import type { Router, RouteRecordRaw } from 'vue-router';
+import type { Router, RouteRecordRaw } from "vue-router";
-import { createRouter, createWebHistory } from 'vue-router';
+import { createRouter, createWebHistory } from "vue-router";
-import { describe, expect, it, vi } from 'vitest';
+import { describe, expect, it, vi } from "vitest";
-import { generateMenus } from '../generate-menus';
+import { generateMenus } from "../generate-menus";
// Nested route setup to test child inclusion and hideChildrenInMenu functionality
-describe('generateMenus', () => {
+describe("generateMenus", () => {
// 模拟路由数据
const mockRoutes = [
{
- meta: { icon: 'home-icon', title: '首页' },
- name: 'home',
- path: '/home',
+ meta: { icon: "home-icon", title: "首页" },
+ name: "home",
+ path: "/home",
},
{
- meta: { hideChildrenInMenu: true, icon: 'about-icon', title: '关于' },
- name: 'about',
- path: '/about',
+ meta: { hideChildrenInMenu: true, icon: "about-icon", title: "关于" },
+ name: "about",
+ path: "/about",
children: [
{
- path: 'team',
- name: 'team',
- meta: { icon: 'team-icon', title: '团队' },
+ path: "team",
+ name: "team",
+ meta: { icon: "team-icon", title: "团队" },
},
],
},
@@ -33,24 +33,24 @@ describe('generateMenus', () => {
// 模拟 Vue 路由器实例
const mockRouter = {
getRoutes: vi.fn(() => [
- { name: 'home', path: '/home' },
- { name: 'about', path: '/about' },
- { name: 'team', path: '/about/team' },
+ { name: "home", path: "/home" },
+ { name: "about", path: "/about" },
+ { name: "team", path: "/about/team" },
]),
};
- it('the correct menu list should be generated according to the route', async () => {
+ it("the correct menu list should be generated according to the route", async () => {
const expectedMenus = [
{
badge: undefined,
badgeType: undefined,
badgeVariants: undefined,
- icon: 'home-icon',
- name: '首页',
+ icon: "home-icon",
+ name: "首页",
order: undefined,
parent: undefined,
parents: undefined,
- path: '/home',
+ path: "/home",
show: true,
children: [],
},
@@ -58,12 +58,12 @@ describe('generateMenus', () => {
badge: undefined,
badgeType: undefined,
badgeVariants: undefined,
- icon: 'about-icon',
- name: '关于',
+ icon: "about-icon",
+ name: "关于",
order: undefined,
parent: undefined,
parents: undefined,
- path: '/about',
+ path: "/about",
show: true,
children: [],
},
@@ -73,12 +73,12 @@ describe('generateMenus', () => {
expect(menus).toEqual(expectedMenus);
});
- it('includes additional meta properties in menu items', async () => {
+ it("includes additional meta properties in menu items", async () => {
const mockRoutesWithMeta = [
{
- meta: { icon: 'user-icon', order: 1, title: 'Profile' },
- name: 'profile',
- path: '/profile',
+ meta: { icon: "user-icon", order: 1, title: "Profile" },
+ name: "profile",
+ path: "/profile",
},
] as RouteRecordRaw[];
@@ -88,24 +88,24 @@ describe('generateMenus', () => {
badge: undefined,
badgeType: undefined,
badgeVariants: undefined,
- icon: 'user-icon',
- name: 'Profile',
+ icon: "user-icon",
+ name: "Profile",
order: 1,
parent: undefined,
parents: undefined,
- path: '/profile',
+ path: "/profile",
show: true,
children: [],
},
]);
});
- it('handles dynamic route parameters correctly', async () => {
+ it("handles dynamic route parameters correctly", async () => {
const mockRoutesWithParams = [
{
- meta: { icon: 'details-icon', title: 'User Details' },
- name: 'userDetails',
- path: '/users/:userId',
+ meta: { icon: "details-icon", title: "User Details" },
+ name: "userDetails",
+ path: "/users/:userId",
},
] as RouteRecordRaw[];
@@ -115,36 +115,33 @@ describe('generateMenus', () => {
badge: undefined,
badgeType: undefined,
badgeVariants: undefined,
- icon: 'details-icon',
- name: 'User Details',
+ icon: "details-icon",
+ name: "User Details",
order: undefined,
parent: undefined,
parents: undefined,
- path: '/users/:userId',
+ path: "/users/:userId",
show: true,
children: [],
},
]);
});
- it('processes routes with redirects correctly', async () => {
+ it("processes routes with redirects correctly", async () => {
const mockRoutesWithRedirect = [
{
- name: 'redirectedRoute',
- path: '/old-path',
- redirect: '/new-path',
+ name: "redirectedRoute",
+ path: "/old-path",
+ redirect: "/new-path",
},
{
- meta: { icon: 'path-icon', title: 'New Path' },
- name: 'newPath',
- path: '/new-path',
+ meta: { icon: "path-icon", title: "New Path" },
+ name: "newPath",
+ path: "/new-path",
},
] as RouteRecordRaw[];
- const menus = await generateMenus(
- mockRoutesWithRedirect,
- mockRouter as any,
- );
+ const menus = await generateMenus(mockRoutesWithRedirect, mockRouter as any);
expect(menus).toEqual([
// Assuming your generateMenus function excludes redirect routes from the menu
{
@@ -152,11 +149,11 @@ describe('generateMenus', () => {
badgeType: undefined,
badgeVariants: undefined,
icon: undefined,
- name: 'redirectedRoute',
+ name: "redirectedRoute",
order: undefined,
parent: undefined,
parents: undefined,
- path: '/old-path',
+ path: "/old-path",
show: true,
children: [],
},
@@ -164,12 +161,12 @@ describe('generateMenus', () => {
badge: undefined,
badgeType: undefined,
badgeVariants: undefined,
- icon: 'path-icon',
- name: 'New Path',
+ icon: "path-icon",
+ name: "New Path",
order: undefined,
parent: undefined,
parents: undefined,
- path: '/new-path',
+ path: "/new-path",
show: true,
children: [],
},
@@ -178,14 +175,14 @@ describe('generateMenus', () => {
const routes: any = [
{
- meta: { order: 2, title: 'Home' },
- name: 'home',
- path: '/',
+ meta: { order: 2, title: "Home" },
+ name: "home",
+ path: "/",
},
{
- meta: { order: 1, title: 'About' },
- name: 'about',
- path: '/about',
+ meta: { order: 1, title: "About" },
+ name: "about",
+ path: "/about",
},
];
@@ -194,7 +191,7 @@ describe('generateMenus', () => {
routes,
});
- it('should generate menu list with correct order', async () => {
+ it("should generate menu list with correct order", async () => {
const menus = await generateMenus(routes, router);
const expectedMenus = [
{
@@ -202,11 +199,11 @@ describe('generateMenus', () => {
badgeType: undefined,
badgeVariants: undefined,
icon: undefined,
- name: 'About',
+ name: "About",
order: 1,
parent: undefined,
parents: undefined,
- path: '/about',
+ path: "/about",
show: true,
children: [],
},
@@ -215,11 +212,11 @@ describe('generateMenus', () => {
badgeType: undefined,
badgeVariants: undefined,
icon: undefined,
- name: 'Home',
+ name: "Home",
order: 2,
parent: undefined,
parents: undefined,
- path: '/',
+ path: "/",
show: true,
children: [],
},
@@ -228,7 +225,7 @@ describe('generateMenus', () => {
expect(menus).toEqual(expectedMenus);
});
- it('should handle empty routes', async () => {
+ it("should handle empty routes", async () => {
const emptyRoutes: any[] = [];
const menus = await generateMenus(emptyRoutes, router);
expect(menus).toEqual([]);
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/__tests__/generate-routes-frontend.test.ts b/packages/ui/certd-client/src/vben/utils/helpers/__tests__/generate-routes-frontend.test.ts
index 8e018530a..227e0bf0e 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/__tests__/generate-routes-frontend.test.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/__tests__/generate-routes-frontend.test.ts
@@ -1,105 +1,93 @@
-import type { RouteRecordRaw } from 'vue-router';
+import type { RouteRecordRaw } from "vue-router";
-import { describe, expect, it } from 'vitest';
+import { describe, expect, it } from "vitest";
-import {
- generateRoutesByFrontend,
- hasAuthority,
-} from '../generate-routes-frontend';
+import { generateRoutesByFrontend, hasAuthority } from "../generate-routes-frontend";
// Mock 路由数据
const mockRoutes = [
{
meta: {
- authority: ['admin', 'user'],
+ authority: ["admin", "user"],
hideInMenu: false,
},
- path: '/dashboard',
+ path: "/dashboard",
children: [
{
- path: '/dashboard/overview',
- meta: { authority: ['admin'], hideInMenu: false },
+ path: "/dashboard/overview",
+ meta: { authority: ["admin"], hideInMenu: false },
},
{
- path: '/dashboard/stats',
- meta: { authority: ['user'], hideInMenu: true },
+ path: "/dashboard/stats",
+ meta: { authority: ["user"], hideInMenu: true },
},
],
},
{
- meta: { authority: ['admin'], hideInMenu: false },
- path: '/settings',
+ meta: { authority: ["admin"], hideInMenu: false },
+ path: "/settings",
},
{
meta: { hideInMenu: false },
- path: '/profile',
+ path: "/profile",
},
] as RouteRecordRaw[];
-describe('hasAuthority', () => {
- it('should return true if there is no authority defined', () => {
- expect(hasAuthority(mockRoutes[2], ['admin'])).toBe(true);
+describe("hasAuthority", () => {
+ it("should return true if there is no authority defined", () => {
+ expect(hasAuthority(mockRoutes[2], ["admin"])).toBe(true);
});
- it('should return true if the user has the required authority', () => {
- expect(hasAuthority(mockRoutes[0], ['admin'])).toBe(true);
+ it("should return true if the user has the required authority", () => {
+ expect(hasAuthority(mockRoutes[0], ["admin"])).toBe(true);
});
- it('should return false if the user does not have the required authority', () => {
- expect(hasAuthority(mockRoutes[1], ['user'])).toBe(false);
+ it("should return false if the user does not have the required authority", () => {
+ expect(hasAuthority(mockRoutes[1], ["user"])).toBe(false);
});
});
-describe('generateRoutesByFrontend', () => {
- it('should handle routes without children', async () => {
- const generatedRoutes = await generateRoutesByFrontend(mockRoutes, [
- 'user',
- ]);
+describe("generateRoutesByFrontend", () => {
+ it("should handle routes without children", async () => {
+ const generatedRoutes = await generateRoutesByFrontend(mockRoutes, ["user"]);
expect(generatedRoutes).toEqual(
expect.arrayContaining([
expect.objectContaining({
- path: '/profile', // This route has no children and should be included
+ path: "/profile", // This route has no children and should be included
}),
- ]),
+ ])
);
});
- it('should handle empty roles array', async () => {
+ it("should handle empty roles array", async () => {
const generatedRoutes = await generateRoutesByFrontend(mockRoutes, []);
expect(generatedRoutes).toEqual(
expect.arrayContaining([
// Only routes without authority should be included
expect.objectContaining({
- path: '/profile',
+ path: "/profile",
}),
- ]),
+ ])
);
expect(generatedRoutes).not.toEqual(
expect.arrayContaining([
expect.objectContaining({
- path: '/dashboard',
+ path: "/dashboard",
}),
expect.objectContaining({
- path: '/settings',
+ path: "/settings",
}),
- ]),
+ ])
);
});
- it('should handle missing meta fields', async () => {
+ it("should handle missing meta fields", async () => {
const routesWithMissingMeta = [
- { path: '/path1' }, // No meta
- { meta: {}, path: '/path2' }, // Empty meta
- { meta: { authority: ['admin'] }, path: '/path3' }, // Only authority
+ { path: "/path1" }, // No meta
+ { meta: {}, path: "/path2" }, // Empty meta
+ { meta: { authority: ["admin"] }, path: "/path3" }, // Only authority
];
- const generatedRoutes = await generateRoutesByFrontend(
- routesWithMissingMeta as RouteRecordRaw[],
- ['admin'],
- );
- expect(generatedRoutes).toEqual([
- { path: '/path1' },
- { meta: {}, path: '/path2' },
- { meta: { authority: ['admin'] }, path: '/path3' },
- ]);
+ const generatedRoutes = await generateRoutesByFrontend(routesWithMissingMeta as RouteRecordRaw[], ["admin"]);
+ expect(generatedRoutes).toEqual([{ path: "/path1" }, { meta: {}, path: "/path2" }, { meta: { authority: ["admin"] }, path: "/path3" }]);
});
});
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/__tests__/merge-route-modules.test.ts b/packages/ui/certd-client/src/vben/utils/helpers/__tests__/merge-route-modules.test.ts
index 36155566a..6b590162f 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/__tests__/merge-route-modules.test.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/__tests__/merge-route-modules.test.ts
@@ -1,29 +1,29 @@
-import type { RouteRecordRaw } from 'vue-router';
+import type { RouteRecordRaw } from "vue-router";
-import type { RouteModuleType } from '../merge-route-modules';
+import type { RouteModuleType } from "../merge-route-modules";
-import { describe, expect, it } from 'vitest';
+import { describe, expect, it } from "vitest";
-import { mergeRouteModules } from '../merge-route-modules';
+import { mergeRouteModules } from "../merge-route-modules";
-describe('mergeRouteModules', () => {
- it('should merge route modules correctly', () => {
+describe("mergeRouteModules", () => {
+ it("should merge route modules correctly", () => {
const routeModules: Record
= {
- './dynamic-routes/about.ts': {
+ "./dynamic-routes/about.ts": {
default: [
{
- component: () => Promise.resolve({ template: 'About
' }),
- name: 'About',
- path: '/about',
+ component: () => Promise.resolve({ template: "About
" }),
+ name: "About",
+ path: "/about",
},
],
},
- './dynamic-routes/home.ts': {
+ "./dynamic-routes/home.ts": {
default: [
{
- component: () => Promise.resolve({ template: 'Home
' }),
- name: 'Home',
- path: '/',
+ component: () => Promise.resolve({ template: "Home
" }),
+ name: "Home",
+ path: "/",
},
],
},
@@ -32,13 +32,13 @@ describe('mergeRouteModules', () => {
const expectedRoutes: RouteRecordRaw[] = [
{
component: expect.any(Function),
- name: 'About',
- path: '/about',
+ name: "About",
+ path: "/about",
},
{
component: expect.any(Function),
- name: 'Home',
- path: '/',
+ name: "Home",
+ path: "/",
},
];
@@ -46,7 +46,7 @@ describe('mergeRouteModules', () => {
expect(mergedRoutes).toEqual(expectedRoutes);
});
- it('should handle empty modules', () => {
+ it("should handle empty modules", () => {
const routeModules: Record = {};
const expectedRoutes: RouteRecordRaw[] = [];
@@ -54,9 +54,9 @@ describe('mergeRouteModules', () => {
expect(mergedRoutes).toEqual(expectedRoutes);
});
- it('should handle modules with no default export', () => {
+ it("should handle modules with no default export", () => {
const routeModules: Record = {
- './dynamic-routes/empty.ts': {
+ "./dynamic-routes/empty.ts": {
default: [],
},
};
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/find-menu-by-path.ts b/packages/ui/certd-client/src/vben/utils/helpers/find-menu-by-path.ts
index 46b6cd8ae..bbd26875b 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/find-menu-by-path.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/find-menu-by-path.ts
@@ -21,11 +21,11 @@ function findMenuByPath(list: MenuRecordRaw[], path?: string): MenuRecordRaw | n
function findRootMenuByPath(menus: MenuRecordRaw[], path?: string, level = 0) {
const findMenu = findMenuByPath(menus, path);
const rootMenuPath = findMenu?.parents?.[level];
- const rootMenu = rootMenuPath ? menus.find((item) => item.path === rootMenuPath) : undefined;
+ const rootMenu = rootMenuPath ? menus.find(item => item.path === rootMenuPath) : undefined;
return {
findMenu,
rootMenu,
- rootMenuPath
+ rootMenuPath,
};
}
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/generate-menus.ts b/packages/ui/certd-client/src/vben/utils/helpers/generate-menus.ts
index 18ced0df3..01f9a3435 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/generate-menus.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/generate-menus.ts
@@ -29,7 +29,7 @@ async function generateMenus(routes: RouteRecordRaw[], router: Router): Promise<
// 将菜单的所有父级和父级菜单记录到菜单项内
if (resultChildren && resultChildren.length > 0) {
- resultChildren.forEach((child) => {
+ resultChildren.forEach(child => {
child.parents = [...(route.parents || []), path];
child.parent = path;
});
@@ -49,14 +49,14 @@ async function generateMenus(routes: RouteRecordRaw[], router: Router): Promise<
path: resultPath as string,
show: !route?.meta?.hideInMenu && route?.meta?.isMenu !== false,
children: resultChildren || [],
- meta: route.meta
+ meta: route.meta,
};
});
// 对菜单进行排序
menus = sortBy(menus, (item: any) => item.order ?? 0);
- const finalMenus = filterTree(menus, (menu) => {
+ const finalMenus = filterTree(menus, menu => {
return !!menu.show;
});
return finalMenus;
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/generate-routes-backend.ts b/packages/ui/certd-client/src/vben/utils/helpers/generate-routes-backend.ts
index 29a687ba7..b58977d0c 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/generate-routes-backend.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/generate-routes-backend.ts
@@ -32,7 +32,7 @@ async function generateRoutesByBackend(options: GenerateMenuAndRoutesOptions): P
}
function convertRoutes(routes: RouteRecordStringComponent[], layoutMap: ComponentRecordType, pageMap: ComponentRecordType): RouteRecordRaw[] {
- return mapTree(routes, (node) => {
+ return mapTree(routes, node => {
const route = node as unknown as RouteRecordRaw;
const { component, name } = node;
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/generate-routes-frontend.ts b/packages/ui/certd-client/src/vben/utils/helpers/generate-routes-frontend.ts
index 0ff16d14c..cff9624fe 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/generate-routes-frontend.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/generate-routes-frontend.ts
@@ -7,7 +7,7 @@ import { filterTree, mapTree } from "/@/vben/shared/utils";
*/
async function generateRoutesByFrontend(routes: RouteRecordRaw[], roles: string[], forbiddenComponent?: RouteRecordRaw["component"]): Promise {
// 根据角色标识过滤路由表,判断当前用户是否拥有指定权限
- const finalRoutes = filterTree(routes, (route) => {
+ const finalRoutes = filterTree(routes, route => {
return hasAuthority(route, roles);
});
@@ -16,7 +16,7 @@ async function generateRoutesByFrontend(routes: RouteRecordRaw[], roles: string[
}
// 如果有禁止访问的页面,将禁止访问的页面替换为403页面
- return mapTree(finalRoutes, (route) => {
+ return mapTree(finalRoutes, route => {
if (menuHasVisibleWithForbidden(route)) {
route.component = forbiddenComponent;
}
@@ -34,7 +34,7 @@ function hasAuthority(route: RouteRecordRaw, access: string[]) {
if (!authority) {
return true;
}
- const canAccess = access.some((value) => authority.includes(value));
+ const canAccess = access.some(value => authority.includes(value));
return canAccess || (!canAccess && menuHasVisibleWithForbidden(route));
}
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/get-popup-container.ts b/packages/ui/certd-client/src/vben/utils/helpers/get-popup-container.ts
index 6aa84d6da..56611eace 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/get-popup-container.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/get-popup-container.ts
@@ -4,7 +4,5 @@
* the document body if the element is not provided.
*/
export function getPopupContainer(node?: HTMLElement): HTMLElement {
- return (
- node?.closest('form') ?? (node?.parentNode as HTMLElement) ?? document.body
- );
+ return node?.closest("form") ?? (node?.parentNode as HTMLElement) ?? document.body;
}
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/index.ts b/packages/ui/certd-client/src/vben/utils/helpers/index.ts
index da2cd8d7f..4ec87cd7a 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/index.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/index.ts
@@ -1,8 +1,8 @@
-export * from './find-menu-by-path';
-export * from './generate-menus';
-export * from './generate-routes-backend';
-export * from './generate-routes-frontend';
-export * from './get-popup-container';
-export * from './merge-route-modules';
-export * from './reset-routes';
-export * from './unmount-global-loading';
+export * from "./find-menu-by-path";
+export * from "./generate-menus";
+export * from "./generate-routes-backend";
+export * from "./generate-routes-frontend";
+export * from "./get-popup-container";
+export * from "./merge-route-modules";
+export * from "./reset-routes";
+export * from "./unmount-global-loading";
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/reset-routes.ts b/packages/ui/certd-client/src/vben/utils/helpers/reset-routes.ts
index 6afcbd98e..8e07d02b4 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/reset-routes.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/reset-routes.ts
@@ -1,21 +1,16 @@
-import type { Router, RouteRecordName, RouteRecordRaw } from 'vue-router';
+import type { Router, RouteRecordName, RouteRecordRaw } from "vue-router";
-import { traverseTreeValues } from '/@/vben/shared/utils';
+import { traverseTreeValues } from "/@/vben/shared/utils";
/**
* @zh_CN 重置所有路由,如有指定白名单除外
*/
export function resetStaticRoutes(router: Router, routes: RouteRecordRaw[]) {
// 获取静态路由所有节点包含子节点的 name,并排除不存在 name 字段的路由
- const staticRouteNames = traverseTreeValues<
- RouteRecordRaw,
- RouteRecordName | undefined
- >(routes, (route) => {
+ const staticRouteNames = traverseTreeValues(routes, route => {
// 这些路由需要指定 name,防止在路由重置时,不能删除没有指定 name 的路由
if (!route.name) {
- console.warn(
- `The route with the path ${route.path} needs to have the field name specified.`,
- );
+ console.warn(`The route with the path ${route.path} needs to have the field name specified.`);
}
return route.name;
});
diff --git a/packages/ui/certd-client/src/vben/utils/helpers/unmount-global-loading.ts b/packages/ui/certd-client/src/vben/utils/helpers/unmount-global-loading.ts
index 10b88eaeb..decdb95ae 100644
--- a/packages/ui/certd-client/src/vben/utils/helpers/unmount-global-loading.ts
+++ b/packages/ui/certd-client/src/vben/utils/helpers/unmount-global-loading.ts
@@ -7,25 +7,23 @@
*/
export function unmountGlobalLoading() {
// 查找全局 loading 元素
- const loadingElement = document.querySelector('#__app-loading__');
+ const loadingElement = document.querySelector("#__app-loading__");
if (loadingElement) {
// 添加隐藏类,触发过渡动画
- loadingElement.classList.add('hidden');
+ loadingElement.classList.add("hidden");
// 查找所有需要移除的注入 loading 元素
- const injectLoadingElements = document.querySelectorAll(
- '[data-app-loading^="inject"]',
- );
+ const injectLoadingElements = document.querySelectorAll('[data-app-loading^="inject"]');
// 当过渡动画结束时,移除 loading 元素和所有注入的 loading 元素
loadingElement.addEventListener(
- 'transitionend',
+ "transitionend",
() => {
loadingElement.remove(); // 移除 loading 元素
- injectLoadingElements.forEach((el) => el.remove()); // 移除所有注入的 loading 元素
+ injectLoadingElements.forEach(el => el.remove()); // 移除所有注入的 loading 元素
},
- { once: true },
+ { once: true }
); // 确保事件只触发一次
}
}
diff --git a/packages/ui/certd-client/src/views/certd/access/api.ts b/packages/ui/certd-client/src/views/certd/access/api.ts
index 905e8fed1..180984fea 100644
--- a/packages/ui/certd-client/src/views/certd/access/api.ts
+++ b/packages/ui/certd-client/src/views/certd/access/api.ts
@@ -11,7 +11,7 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/page",
method: "post",
- data: query
+ data: query,
});
},
@@ -19,7 +19,7 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/add",
method: "post",
- data: obj
+ data: obj,
});
},
@@ -27,7 +27,7 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/update",
method: "post",
- data: obj
+ data: obj,
});
},
@@ -35,7 +35,7 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/delete",
method: "post",
- params: { id }
+ params: { id },
});
},
@@ -43,7 +43,7 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/info",
method: "post",
- params: { id }
+ params: { id },
});
},
@@ -51,7 +51,7 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/simpleInfo",
method: "post",
- params: { id }
+ params: { id },
});
},
@@ -59,7 +59,7 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/getSecretPlain",
method: "post",
- data: { id, key }
+ data: { id, key },
});
},
@@ -67,7 +67,7 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/define",
method: "post",
- params: { type }
+ params: { type },
});
},
@@ -75,8 +75,8 @@ export function createAccessApi(from = "user") {
return await request({
url: apiPrefix + "/defineByAccessType",
method: "post",
- params: { type }
+ params: { type },
});
- }
+ },
};
}
diff --git a/packages/ui/certd-client/src/views/certd/access/index.vue b/packages/ui/certd-client/src/views/certd/access/index.vue
index 9bf9a7501..aeec1c9c3 100644
--- a/packages/ui/certd-client/src/views/certd/access/index.vue
+++ b/packages/ui/certd-client/src/views/certd/access/index.vue
@@ -1,13 +1,13 @@
-
-
-
- {{ t("certd.authorizationManagement") }}
- {{ t("certd.manageThirdPartyAuth") }}
-
-
-
-
+
+
+
+ {{ t("certd.authorizationManagement") }}
+ {{ t("certd.manageThirdPartyAuth") }}
+
+
+
+
diff --git a/packages/ui/certd-client/src/views/certd/cname/record/api.ts b/packages/ui/certd-client/src/views/certd/cname/record/api.ts
index e50149eec..43638d78b 100644
--- a/packages/ui/certd-client/src/views/certd/cname/record/api.ts
+++ b/packages/ui/certd-client/src/views/certd/cname/record/api.ts
@@ -6,7 +6,7 @@ export async function GetList(query: any) {
return await request({
url: apiPrefix + "/page",
method: "post",
- data: query
+ data: query,
});
}
@@ -14,7 +14,7 @@ export async function AddObj(obj: any) {
return await request({
url: apiPrefix + "/add",
method: "post",
- data: obj
+ data: obj,
});
}
@@ -22,7 +22,7 @@ export async function UpdateObj(obj: any) {
return await request({
url: apiPrefix + "/update",
method: "post",
- data: obj
+ data: obj,
});
}
@@ -30,7 +30,7 @@ export async function DelObj(id: any) {
return await request({
url: apiPrefix + "/delete",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -38,7 +38,7 @@ export async function GetObj(id: any) {
return await request({
url: apiPrefix + "/info",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -46,7 +46,7 @@ export async function GetDetail(id: any) {
return await request({
url: apiPrefix + "/detail",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -54,7 +54,7 @@ export async function DeleteBatch(ids: any[]) {
return await request({
url: apiPrefix + "/deleteByIds",
method: "post",
- data: { ids }
+ data: { ids },
});
}
@@ -63,7 +63,7 @@ export async function DoVerify(id: number) {
url: apiPrefix + "/verify",
method: "post",
data: {
- id
- }
+ id,
+ },
});
}
diff --git a/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx b/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx
index 50385055a..769da2de5 100644
--- a/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx
@@ -8,272 +8,272 @@ import { useSettingStore } from "/@/store/settings";
import { message } from "ant-design-vue";
import CnameTip from "/@/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const router = useRouter();
- const { t } = useI18n();
- const pageRequest = async (query: UserPageQuery): Promise => {
- return await api.GetList(query);
- };
- const editRequest = async ({ form, row }: EditReq) => {
- form.id = row.id;
- const res = await api.UpdateObj(form);
- return res;
- };
- const delRequest = async ({ row }: DelReq) => {
- return await api.DelObj(row.id);
- };
+ const router = useRouter();
+ const { t } = useI18n();
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ return await api.GetList(query);
+ };
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ const res = await api.UpdateObj(form);
+ return res;
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ return await api.DelObj(row.id);
+ };
- const addRequest = async ({ form }: AddReq) => {
- const res = await api.AddObj(form);
- return res;
- };
+ const addRequest = async ({ form }: AddReq) => {
+ const res = await api.AddObj(form);
+ return res;
+ };
- const userStore = useUserStore();
- const settingStore = useSettingStore();
- const selectedRowKeys: Ref = ref([]);
- context.selectedRowKeys = selectedRowKeys;
- const dictRef = dict({
- data: [
- { label: t('certd.pending_cname_setup'), value: "cname", color: "warning" },
- { label: t('certd.validating'), value: "validating", color: "blue" },
- { label: t('certd.validation_successful'), value: "valid", color: "green" },
- { label: t('certd.validation_failed'), value: "failed", color: "red" },
- { label: t('certd.validation_timed_out'), value: "timeout", color: "red" },
- ],
- });
- return {
- crudOptions: {
- settings: {
- plugins: {
- //这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
- rowSelection: {
- enabled: true,
- order: -2,
- before: true,
- // handle: (pluginProps,useCrudProps)=>CrudOptions,
- props: {
- multiple: true,
- crossPage: true,
- selectedRowKeys,
- },
- },
- },
- },
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest,
- },
- tabs: {
- name: "status",
- show: true,
- },
- rowHandle: {
- minWidth: 200,
- fixed: "right",
- },
- columns: {
- id: {
- title: "ID",
- key: "id",
- type: "number",
- column: {
- width: 80,
- },
- form: {
- show: false,
- },
- },
- domain: {
- title: t('certd.proxied_domain'),
- type: "text",
- search: {
- show: true,
- },
- editForm: {
- component: {
- disabled: true,
- },
- },
- },
- hostRecord: {
- title: t('certd.host_record'),
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 250,
- cellRender: ({ value }) => {
- return ;
- },
- },
- },
- recordValue: {
- title: t('certd.please_set_cname'),
- type: "copyable",
- form: {
- show: false,
- },
- column: {
- width: 500,
- },
- },
- cnameProviderId: {
- title: t('certd.cname_service'),
- type: "dict-select",
- dict: dict({
- url: "/cname/provider/list",
- value: "id",
- label: "domain",
- }),
- form: {
- component: {
- onDictChange: ({ form, dict }: any) => {
- if (!form.cnameProviderId) {
- const list = dict.data.filter((item: any) => {
- return !item.disabled;
- });
- let item = list.find((item: any) => item.isDefault);
- if (!item && list.length > 0) {
- item = list[0];
- }
- if (item) {
- form.cnameProviderId = item.id;
- }
- }
- },
- renderLabel(item: any) {
- if (item.title) {
- return `${item.domain}<${item.title}>`;
- } else {
- return item.domain;
- }
- },
- },
- helper: {
- render() {
- const closeForm = () => {
- crudExpose.getFormWrapperRef().close();
- };
- return (
-
- {t('certd.default_public_cname')}
-
- {t('certd.customize_cname')}
-
-
- );
- },
- },
- },
- column: {
- width: 120,
- align: "center",
- cellRender({ value }) {
- if (value < 0) {
- return {t('certd.public_cname')};
- } else {
- return {t('certd.custom_cname')};
- }
- },
- },
- },
- status: {
- title: t('certd.fields.status'),
- type: "dict-select",
- dict: dictRef,
- addForm: {
- show: false,
- },
- column: {
- width: 120,
- align: "center",
- cellRender({ value, row }) {
- return (
-
-
- {row.error && (
-
-
-
- )}
-
- );
- },
- },
- },
- triggerValidate: {
- title: t('certd.validate'),
- type: "text",
- form: {
- show: false,
- },
- column: {
- conditionalRenderDisabled: true,
- width: 130,
- align: "center",
- cellRender({ row, value }) {
- if (row.status === "valid") {
- return "-";
- }
+ const userStore = useUserStore();
+ const settingStore = useSettingStore();
+ const selectedRowKeys: Ref = ref([]);
+ context.selectedRowKeys = selectedRowKeys;
+ const dictRef = dict({
+ data: [
+ { label: t("certd.pending_cname_setup"), value: "cname", color: "warning" },
+ { label: t("certd.validating"), value: "validating", color: "blue" },
+ { label: t("certd.validation_successful"), value: "valid", color: "green" },
+ { label: t("certd.validation_failed"), value: "failed", color: "red" },
+ { label: t("certd.validation_timed_out"), value: "timeout", color: "red" },
+ ],
+ });
+ return {
+ crudOptions: {
+ settings: {
+ plugins: {
+ //这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
+ rowSelection: {
+ enabled: true,
+ order: -2,
+ before: true,
+ // handle: (pluginProps,useCrudProps)=>CrudOptions,
+ props: {
+ multiple: true,
+ crossPage: true,
+ selectedRowKeys,
+ },
+ },
+ },
+ },
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ tabs: {
+ name: "status",
+ show: true,
+ },
+ rowHandle: {
+ minWidth: 200,
+ fixed: "right",
+ },
+ columns: {
+ id: {
+ title: "ID",
+ key: "id",
+ type: "number",
+ column: {
+ width: 80,
+ },
+ form: {
+ show: false,
+ },
+ },
+ domain: {
+ title: t("certd.proxied_domain"),
+ type: "text",
+ search: {
+ show: true,
+ },
+ editForm: {
+ component: {
+ disabled: true,
+ },
+ },
+ },
+ hostRecord: {
+ title: t("certd.host_record"),
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 250,
+ cellRender: ({ value }) => {
+ return ;
+ },
+ },
+ },
+ recordValue: {
+ title: t("certd.please_set_cname"),
+ type: "copyable",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 500,
+ },
+ },
+ cnameProviderId: {
+ title: t("certd.cname_service"),
+ type: "dict-select",
+ dict: dict({
+ url: "/cname/provider/list",
+ value: "id",
+ label: "domain",
+ }),
+ form: {
+ component: {
+ onDictChange: ({ form, dict }: any) => {
+ if (!form.cnameProviderId) {
+ const list = dict.data.filter((item: any) => {
+ return !item.disabled;
+ });
+ let item = list.find((item: any) => item.isDefault);
+ if (!item && list.length > 0) {
+ item = list[0];
+ }
+ if (item) {
+ form.cnameProviderId = item.id;
+ }
+ }
+ },
+ renderLabel(item: any) {
+ if (item.title) {
+ return `${item.domain}<${item.title}>`;
+ } else {
+ return item.domain;
+ }
+ },
+ },
+ helper: {
+ render() {
+ const closeForm = () => {
+ crudExpose.getFormWrapperRef().close();
+ };
+ return (
+
+ {t("certd.default_public_cname")}
+
+ {t("certd.customize_cname")}
+
+
+ );
+ },
+ },
+ },
+ column: {
+ width: 120,
+ align: "center",
+ cellRender({ value }) {
+ if (value < 0) {
+ return {t("certd.public_cname")};
+ } else {
+ return {t("certd.custom_cname")};
+ }
+ },
+ },
+ },
+ status: {
+ title: t("certd.fields.status"),
+ type: "dict-select",
+ dict: dictRef,
+ addForm: {
+ show: false,
+ },
+ column: {
+ width: 120,
+ align: "center",
+ cellRender({ value, row }) {
+ return (
+
+
+ {row.error && (
+
+
+
+ )}
+
+ );
+ },
+ },
+ },
+ triggerValidate: {
+ title: t("certd.validate"),
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ conditionalRenderDisabled: true,
+ width: 130,
+ align: "center",
+ cellRender({ row, value }) {
+ if (row.status === "valid") {
+ return "-";
+ }
- async function doVerify() {
- row._validating_ = true;
- try {
- const res = await api.DoVerify(row.id);
- if (res === true) {
- message.success(t('certd.validation_successful'));
- row.status = "valid";
- } else if (res === false) {
- message.success(t('certd.validation_timed_out'));
- row.status = "timeout";
- } else {
- message.success(t('certd.validation_started'));
- }
- await crudExpose.doRefresh();
- } catch (e: any) {
- console.error(e);
- message.error(e.message);
- } finally {
- row._validating_ = false;
- }
- }
+ async function doVerify() {
+ row._validating_ = true;
+ try {
+ const res = await api.DoVerify(row.id);
+ if (res === true) {
+ message.success(t("certd.validation_successful"));
+ row.status = "valid";
+ } else if (res === false) {
+ message.success(t("certd.validation_timed_out"));
+ row.status = "timeout";
+ } else {
+ message.success(t("certd.validation_started"));
+ }
+ await crudExpose.doRefresh();
+ } catch (e: any) {
+ console.error(e);
+ message.error(e.message);
+ } finally {
+ row._validating_ = false;
+ }
+ }
- return (
-
-
- {t('certd.click_to_validate')}
-
-
-
- );
- },
- },
- },
- createTime: {
- title: t('certd.create_time'),
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- width: 160,
- align: "center",
- },
- },
- updateTime: {
- title: t('certd.update_time'),
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- show: true,
- },
- },
- },
- },
- };
+ return (
+
+
+ {t("certd.click_to_validate")}
+
+
+
+ );
+ },
+ },
+ },
+ createTime: {
+ title: t("certd.create_time"),
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ width: 160,
+ align: "center",
+ },
+ },
+ updateTime: {
+ title: t("certd.update_time"),
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ show: true,
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/certd/cname/record/index.vue b/packages/ui/certd-client/src/views/certd/cname/record/index.vue
index 73ad342f5..52eadb50b 100644
--- a/packages/ui/certd-client/src/views/certd/cname/record/index.vue
+++ b/packages/ui/certd-client/src/views/certd/cname/record/index.vue
@@ -1,26 +1,25 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/packages/ui/certd-client/src/views/certd/history/crud.tsx b/packages/ui/certd-client/src/views/certd/history/crud.tsx
index 04bc04e65..c745721c4 100644
--- a/packages/ui/certd-client/src/views/certd/history/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/history/crud.tsx
@@ -8,209 +8,209 @@ import { useSettingStore } from "/@/store/settings";
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const router = useRouter();
- const { t } = useI18n();
- const pageRequest = async (query: UserPageQuery): Promise => {
- return await api.GetList(query);
- };
- const editRequest = async ({ form, row }: EditReq) => {
- form.id = row.id;
- const res = await api.UpdateObj(form);
- return res;
- };
- const delRequest = async ({ row }: DelReq) => {
- return await api.DelObj(row.id);
- };
+ const router = useRouter();
+ const { t } = useI18n();
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ return await api.GetList(query);
+ };
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ const res = await api.UpdateObj(form);
+ return res;
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ return await api.DelObj(row.id);
+ };
- const addRequest = async ({ form }: AddReq) => {
- const res = await api.AddObj(form);
- return res;
- };
+ const addRequest = async ({ form }: AddReq) => {
+ const res = await api.AddObj(form);
+ return res;
+ };
- const userStore = useUserStore();
- const settingStore = useSettingStore();
- const selectedRowKeys: Ref = ref([]);
- context.selectedRowKeys = selectedRowKeys;
+ const userStore = useUserStore();
+ const settingStore = useSettingStore();
+ const selectedRowKeys: Ref = ref([]);
+ context.selectedRowKeys = selectedRowKeys;
- return {
- crudOptions: {
- settings: {
- plugins: {
- //这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
- rowSelection: {
- enabled: true,
- order: -2,
- before: true,
- // handle: (pluginProps,useCrudProps)=>CrudOptions,
- props: {
- multiple: true,
- crossPage: true,
- selectedRowKeys,
- },
- },
- },
- },
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest,
- },
- actionbar: {
- buttons: {
- add: {
- show: false,
- },
- },
- },
- search: {
- formItem: {
- labelCol: {
- style: {
- // width: "100px"
- },
- },
- wrapperCol: {
- style: {
- width: "50%",
- },
- },
- },
- },
- rowHandle: {
- minWidth: 200,
- fixed: "right",
- buttons: {
- edit: {
- show: false,
- },
- },
- },
- columns: {
- id: {
- title: "ID",
- key: "id",
- type: "number",
- column: {
- width: 100,
- },
- form: {
- show: false,
- },
- },
- userId: {
- title: t("certd.fields.userId"),
- type: "number",
- search: {
- show: computed(() => {
- return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
- }),
- },
- form: {
- show: false,
- },
- column: {
- show: computed(() => {
- return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
- }),
- width: 100,
- },
- },
- pipelineId: {
- title: t("certd.fields.pipelineId"),
- type: "number",
- search: {
- show: true,
- },
- form: {
- show: false,
- },
- column: {
- width: 100,
- },
- },
- pipelineTitle: {
- title: t('certd.fields.pipelineName'),
- type: "text",
- search: {
- show: true,
- },
- column: {
- width: 300,
- tooltip: true,
- ellipsis: true,
- cellRender: ({ row, value }) => {
- return {value};
- },
- },
- },
- triggerType: {
- title: t("certd.fields.triggerType"),
- type: "dict-select",
- search: {
- show: true,
- },
- dict: dict({
- data: [
- { value: "user", label: t("certd.triggerTypes.manual") },
- { value: "timer", label: t("certd.triggerTypes.timer") },
- ],
- }),
- form: {
- show: false,
- value: "custom",
- },
- column: {
- sorter: true,
- width: 90,
- align: "center",
- show: true,
- component: {
- color: "auto",
- },
- },
- },
- status: {
- title: t("certd.fields.status"),
- type: "dict-select",
- search: {
- show: true,
- },
- dict: dict({
- data: statusUtil.getOptions(),
- }),
- form: {
- show: false,
- },
- column: {
- sorter: true,
- width: 120,
- align: "center",
- },
- },
- createTime: {
- title: t("certd.fields.createTime"),
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- width: 160,
- align: "center",
- },
- },
- updateTime: {
- title: t("certd.fields.updateTime"),
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- show: true,
- },
- },
- },
- },
- };
+ return {
+ crudOptions: {
+ settings: {
+ plugins: {
+ //这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
+ rowSelection: {
+ enabled: true,
+ order: -2,
+ before: true,
+ // handle: (pluginProps,useCrudProps)=>CrudOptions,
+ props: {
+ multiple: true,
+ crossPage: true,
+ selectedRowKeys,
+ },
+ },
+ },
+ },
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ actionbar: {
+ buttons: {
+ add: {
+ show: false,
+ },
+ },
+ },
+ search: {
+ formItem: {
+ labelCol: {
+ style: {
+ // width: "100px"
+ },
+ },
+ wrapperCol: {
+ style: {
+ width: "50%",
+ },
+ },
+ },
+ },
+ rowHandle: {
+ minWidth: 200,
+ fixed: "right",
+ buttons: {
+ edit: {
+ show: false,
+ },
+ },
+ },
+ columns: {
+ id: {
+ title: "ID",
+ key: "id",
+ type: "number",
+ column: {
+ width: 100,
+ },
+ form: {
+ show: false,
+ },
+ },
+ userId: {
+ title: t("certd.fields.userId"),
+ type: "number",
+ search: {
+ show: computed(() => {
+ return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
+ }),
+ },
+ form: {
+ show: false,
+ },
+ column: {
+ show: computed(() => {
+ return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
+ }),
+ width: 100,
+ },
+ },
+ pipelineId: {
+ title: t("certd.fields.pipelineId"),
+ type: "number",
+ search: {
+ show: true,
+ },
+ form: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ },
+ },
+ pipelineTitle: {
+ title: t("certd.fields.pipelineName"),
+ type: "text",
+ search: {
+ show: true,
+ },
+ column: {
+ width: 300,
+ tooltip: true,
+ ellipsis: true,
+ cellRender: ({ row, value }) => {
+ return {value};
+ },
+ },
+ },
+ triggerType: {
+ title: t("certd.fields.triggerType"),
+ type: "dict-select",
+ search: {
+ show: true,
+ },
+ dict: dict({
+ data: [
+ { value: "user", label: t("certd.triggerTypes.manual") },
+ { value: "timer", label: t("certd.triggerTypes.timer") },
+ ],
+ }),
+ form: {
+ show: false,
+ value: "custom",
+ },
+ column: {
+ sorter: true,
+ width: 90,
+ align: "center",
+ show: true,
+ component: {
+ color: "auto",
+ },
+ },
+ },
+ status: {
+ title: t("certd.fields.status"),
+ type: "dict-select",
+ search: {
+ show: true,
+ },
+ dict: dict({
+ data: statusUtil.getOptions(),
+ }),
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ width: 120,
+ align: "center",
+ },
+ },
+ createTime: {
+ title: t("certd.fields.createTime"),
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ width: 160,
+ align: "center",
+ },
+ },
+ updateTime: {
+ title: t("certd.fields.updateTime"),
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ show: true,
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/certd/history/index.vue b/packages/ui/certd-client/src/views/certd/history/index.vue
index e6232d267..17bfb9bcc 100644
--- a/packages/ui/certd-client/src/views/certd/history/index.vue
+++ b/packages/ui/certd-client/src/views/certd/history/index.vue
@@ -13,7 +13,6 @@
-
diff --git a/packages/ui/certd-client/src/views/certd/mine/user-profile.vue b/packages/ui/certd-client/src/views/certd/mine/user-profile.vue
index 244db826d..0e2d29ee4 100644
--- a/packages/ui/certd-client/src/views/certd/mine/user-profile.vue
+++ b/packages/ui/certd-client/src/views/certd/mine/user-profile.vue
@@ -1,34 +1,28 @@
-
-
- {{ t("certd.myInfo") }}
-
-
-
- {{ userInfo.username }}
-
-
-
-
- {{ userInfo.username }}
-
-
- {{ userInfo.nickName }}
- {{ userInfo.email }}
- {{ userInfo.phoneCode }}{{ userInfo.mobile
- }}
-
-
-
-
-
-
-
+
+
+ {{ t("certd.myInfo") }}
+
+
+
+ {{ userInfo.username }}
+
+
+
+ {{ userInfo.username }}
+
+
+ {{ userInfo.nickName }}
+ {{ userInfo.email }}
+ {{ userInfo.phoneCode }}{{ userInfo.mobile }}
+
+
+
+
+
+
-
-
diff --git a/packages/ui/certd-client/src/views/certd/monitor/cert/crud.tsx b/packages/ui/certd-client/src/views/certd/monitor/cert/crud.tsx
index 88f3bce96..9555cfb47 100644
--- a/packages/ui/certd-client/src/views/certd/monitor/cert/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/monitor/cert/crud.tsx
@@ -11,288 +11,286 @@ import CertView from "/@/views/certd/pipeline/cert-view.vue";
import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const { t } = useI18n();
- const api = certInfoApi;
- const pageRequest = async (query: UserPageQuery): Promise => {
- return await api.GetList(query);
- };
- const editRequest = async (req: EditReq) => {
- const { form, row } = req;
- form.id = row.id;
- const res = await api.UpdateObj(form);
- return res;
- };
- const delRequest = async (req: DelReq) => {
- const { row } = req;
- return await api.DelObj(row.id);
- };
+ const { t } = useI18n();
+ const api = certInfoApi;
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ return await api.GetList(query);
+ };
+ const editRequest = async (req: EditReq) => {
+ const { form, row } = req;
+ form.id = row.id;
+ const res = await api.UpdateObj(form);
+ return res;
+ };
+ const delRequest = async (req: DelReq) => {
+ const { row } = req;
+ return await api.DelObj(row.id);
+ };
- const addRequest = async (req: AddReq) => {
- const { form } = req;
- const res = await api.AddObj(form);
- return res;
- };
- const { openCrudFormDialog } = useFormWrapper();
- const router = useRouter();
+ const addRequest = async (req: AddReq) => {
+ const { form } = req;
+ const res = await api.AddObj(form);
+ return res;
+ };
+ const { openCrudFormDialog } = useFormWrapper();
+ const router = useRouter();
- const model = useModal();
- const viewCert = async (row: any) => {
- const cert = await api.GetCert(row.id);
- if (!cert) {
- notification.error({ message: t("certd.certificateNotGenerated") });
- return;
- }
+ const model = useModal();
+ const viewCert = async (row: any) => {
+ const cert = await api.GetCert(row.id);
+ if (!cert) {
+ notification.error({ message: t("certd.certificateNotGenerated") });
+ return;
+ }
- model.success({
- title: t("certd.modal.viewCertificateTitle"),
- maskClosable: true,
- okText: t("certd.modal.close"),
- width: 800,
- content: () => {
- return ;
- },
- });
- };
+ model.success({
+ title: t("certd.modal.viewCertificateTitle"),
+ maskClosable: true,
+ okText: t("certd.modal.close"),
+ width: 800,
+ content: () => {
+ return ;
+ },
+ });
+ };
- const { openUploadCreateDialog, openUpdateCertDialog } = useCertUpload();
- return {
- crudOptions: {
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest,
- },
- form: {
- labelCol: {
- //固定label宽度
- span: null,
- style: {
- width: "100px",
- },
- },
- col: {
- span: 22,
- },
- wrapper: {
- width: 600,
- },
- },
- actionbar: {
- show: true,
- buttons: {
- add: {
- text: t('certd.uploadCustomCert'),
- type: "primary",
- show: false,
- async click() {
- await openUploadCreateDialog();
- },
- },
- },
- },
- tabs: {
- name: "fromType",
- show: true,
- },
- rowHandle: {
- width: 100,
- fixed: "right",
- buttons: {
- view: { show: false },
- viewCert: {
- order: 3,
- title: t("certd.viewCert.title"),
- type: "link",
- icon: "ph:certificate",
- async click({ row }) {
- await viewCert(row);
- },
- },
- copy: { show: false },
- edit: { show: false },
- remove: {
- order: 10,
- show: false,
- },
- download: {
- order: 9,
- title: t("certd.download.title"),
- type: "link",
- icon: "ant-design:download-outlined",
- async click({ row }) {
- if (!row.certFile) {
- notification.error({ message: t("certd.certificateNotGenerated") });
- return;
- }
- window.open("/api/monitor/cert/download?id=" + row.id);
- },
- },
-
- },
- },
- columns: {
- id: {
- title: "ID",
- key: "id",
- type: "number",
- search: {
- show: false,
- },
- column: {
- width: 100,
- editable: {
- disabled: true,
- },
- },
- form: {
- show: false,
- },
- },
- fromType: {
- title: t('certd.sourcee'),
- search: {
- show: true,
- },
- type: "dict-select",
- dict: dict({
- data: [
- { label: t('certd.sourcePipeline'), value: "pipeline" },
- { label: t('certd.sourceManualUpload'), value: "upload" },
- ],
- }),
- form: {
- show: false,
- },
- column: {
- width: 100,
- sorter: true,
- component: {
- color: "auto",
- },
- conditionalRender: false,
- },
- valueBuilder({ value, row, key }) {
- if (!value) {
- row[key] = "pipeline";
- }
- },
- },
- domains: {
- title: t('certd.domains'),
- search: {
- show: true,
- },
- type: "text",
- form: {
- rules: [{ required: true, message: t('certd.enterDomain') }],
- },
- column: {
- width: 450,
- sorter: true,
- component: {
- name: "fs-values-format",
- color: "auto",
- },
- },
- },
- domainCount: {
- title: t('certd.domainCount'),
- type: "number",
- form: {
- show: false,
- },
- column: {
- width: 120,
- sorter: true,
- show: false,
- },
- },
- expiresLeft: {
- title: t('certd.validDays'),
- search: {
- show: false,
- },
- type: "date",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- conditionalRender: false,
- cellRender({ row }) {
- const value = row.expiresTime;
- if (!value) {
- return "-";
- }
- const expireDate = dayjs(value).format("YYYY-MM-DD");
- const leftDays = dayjs(value).diff(dayjs(), "day");
- const color = leftDays < 20 ? "red" : "#389e0d";
- const percent = (leftDays / 90) * 100;
- return `${leftDays}${t('certd.days')}`} />;
- },
- },
- },
- expiresTime: {
- title: t('certd.expireTime'),
- search: {
- show: false,
- },
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- },
- },
- certProvider: {
- title: t('certd.certIssuer'),
- search: {
- show: false,
- },
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 200,
- },
- },
- applyTime: {
- title: t('certd.applyTime'),
- search: {
- show: false,
- },
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- },
- },
- "pipeline.title": {
- title: t('certd.relatedPipeline'),
- search: { show: false },
- type: "link",
- form: {
- show: false,
- },
- column: {
- width: 350,
- sorter: true,
- component: {
- on: {
- onClick({ row }) {
- router.push({ path: "/certd/pipeline/detail", query: { id: row.pipelineId, editMode: "false" } });
- },
- },
- },
- },
- },
-
- },
- },
- };
+ const { openUploadCreateDialog, openUpdateCertDialog } = useCertUpload();
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ form: {
+ labelCol: {
+ //固定label宽度
+ span: null,
+ style: {
+ width: "100px",
+ },
+ },
+ col: {
+ span: 22,
+ },
+ wrapper: {
+ width: 600,
+ },
+ },
+ actionbar: {
+ show: true,
+ buttons: {
+ add: {
+ text: t("certd.uploadCustomCert"),
+ type: "primary",
+ show: false,
+ async click() {
+ await openUploadCreateDialog({});
+ },
+ },
+ },
+ },
+ tabs: {
+ name: "fromType",
+ show: true,
+ },
+ rowHandle: {
+ width: 100,
+ fixed: "right",
+ buttons: {
+ view: { show: false },
+ viewCert: {
+ order: 3,
+ title: t("certd.viewCert.title"),
+ type: "link",
+ icon: "ph:certificate",
+ async click({ row }) {
+ await viewCert(row);
+ },
+ },
+ copy: { show: false },
+ edit: { show: false },
+ remove: {
+ order: 10,
+ show: false,
+ },
+ download: {
+ order: 9,
+ title: t("certd.download.title"),
+ type: "link",
+ icon: "ant-design:download-outlined",
+ async click({ row }) {
+ if (!row.certFile) {
+ notification.error({ message: t("certd.certificateNotGenerated") });
+ return;
+ }
+ window.open("/api/monitor/cert/download?id=" + row.id);
+ },
+ },
+ },
+ },
+ columns: {
+ id: {
+ title: "ID",
+ key: "id",
+ type: "number",
+ search: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ editable: {
+ disabled: true,
+ },
+ },
+ form: {
+ show: false,
+ },
+ },
+ fromType: {
+ title: t("certd.sourcee"),
+ search: {
+ show: true,
+ },
+ type: "dict-select",
+ dict: dict({
+ data: [
+ { label: t("certd.sourcePipeline"), value: "pipeline" },
+ { label: t("certd.sourceManualUpload"), value: "upload" },
+ ],
+ }),
+ form: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ sorter: true,
+ component: {
+ color: "auto",
+ },
+ conditionalRender: false,
+ },
+ valueBuilder({ value, row, key }) {
+ if (!value) {
+ row[key] = "pipeline";
+ }
+ },
+ },
+ domains: {
+ title: t("certd.domains"),
+ search: {
+ show: true,
+ },
+ type: "text",
+ form: {
+ rules: [{ required: true, message: t("certd.enterDomain") }],
+ },
+ column: {
+ width: 450,
+ sorter: true,
+ component: {
+ name: "fs-values-format",
+ color: "auto",
+ },
+ },
+ },
+ domainCount: {
+ title: t("certd.domainCount"),
+ type: "number",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 120,
+ sorter: true,
+ show: false,
+ },
+ },
+ expiresLeft: {
+ title: t("certd.validDays"),
+ search: {
+ show: false,
+ },
+ type: "date",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ conditionalRender: false,
+ cellRender({ row }) {
+ const value = row.expiresTime;
+ if (!value) {
+ return "-";
+ }
+ const expireDate = dayjs(value).format("YYYY-MM-DD");
+ const leftDays = dayjs(value).diff(dayjs(), "day");
+ const color = leftDays < 20 ? "red" : "#389e0d";
+ const percent = (leftDays / 90) * 100;
+ return `${leftDays}${t("certd.days")}`} />;
+ },
+ },
+ },
+ expiresTime: {
+ title: t("certd.expireTime"),
+ search: {
+ show: false,
+ },
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ },
+ },
+ certProvider: {
+ title: t("certd.certIssuer"),
+ search: {
+ show: false,
+ },
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 200,
+ },
+ },
+ applyTime: {
+ title: t("certd.applyTime"),
+ search: {
+ show: false,
+ },
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ },
+ },
+ "pipeline.title": {
+ title: t("certd.relatedPipeline"),
+ search: { show: false },
+ type: "link",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 350,
+ sorter: true,
+ component: {
+ on: {
+ onClick({ row }) {
+ router.push({ path: "/certd/pipeline/detail", query: { id: row.pipelineId, editMode: "false" } });
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/certd/monitor/cert/index.vue b/packages/ui/certd-client/src/views/certd/monitor/cert/index.vue
index d2bf6ea7e..2c4d0a8be 100644
--- a/packages/ui/certd-client/src/views/certd/monitor/cert/index.vue
+++ b/packages/ui/certd-client/src/views/certd/monitor/cert/index.vue
@@ -1,13 +1,13 @@
-
-
-
- {{ t("certd.certificateRepo.title") }}
- {{ t("certd.certificateRepo.sub") }}
-
-
-
-
+
+
+
+ {{ t("certd.certificateRepo.title") }}
+ {{ t("certd.certificateRepo.sub") }}
+
+
+
+
diff --git a/packages/ui/certd-client/src/views/certd/monitor/site/crud.tsx b/packages/ui/certd-client/src/views/certd/monitor/site/crud.tsx
index 27b1fab3a..9c220462f 100644
--- a/packages/ui/certd-client/src/views/certd/monitor/site/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/monitor/site/crud.tsx
@@ -11,513 +11,508 @@ import { useSiteIpMonitor } from "./ip/use";
import { useSiteImport } from "/@/views/certd/monitor/site/use";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const { t } = useI18n();
- const api = siteInfoApi;
- const { crudBinding } = crudExpose;
- const pageRequest = async (query: UserPageQuery): Promise => {
- return await api.GetList(query);
- };
- const editRequest = async (req: EditReq) => {
- const { form, row } = req;
- form.id = row.id;
- const res = await api.UpdateObj(form);
- return res;
- };
- const delRequest = async (req: DelReq) => {
- const { row } = req;
- return await api.DelObj(row.id);
- };
+ const { t } = useI18n();
+ const api = siteInfoApi;
+ const { crudBinding } = crudExpose;
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ return await api.GetList(query);
+ };
+ const editRequest = async (req: EditReq) => {
+ const { form, row } = req;
+ form.id = row.id;
+ const res = await api.UpdateObj(form);
+ return res;
+ };
+ const delRequest = async (req: DelReq) => {
+ const { row } = req;
+ return await api.DelObj(row.id);
+ };
- const addRequest = async (req: AddReq) => {
- const { form } = req;
- const res = await api.AddObj(form);
- return res;
- };
+ const addRequest = async (req: AddReq) => {
+ const { form } = req;
+ const res = await api.AddObj(form);
+ return res;
+ };
- const settingsStore = useSettingStore();
+ const settingsStore = useSettingStore();
- const checkStatusDict = dict({
- data: [
- { label: t("checkStatus.success"), value: "ok", color: "green" },
- { label: t("checkStatus.checking"), value: "checking", color: "blue" },
- { label: t("checkStatus.error"), value: "error", color: "red" },
- ],
- });
+ const checkStatusDict = dict({
+ data: [
+ { label: t("checkStatus.success"), value: "ok", color: "green" },
+ { label: t("checkStatus.checking"), value: "checking", color: "blue" },
+ { label: t("checkStatus.error"), value: "error", color: "red" },
+ ],
+ });
+ const { openSiteIpMonitorDialog } = useSiteIpMonitor();
+ const { openSiteImportDialog } = useSiteImport();
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ form: {
+ labelCol: {
+ //固定label宽度
+ span: null,
+ style: {
+ width: "100px",
+ },
+ },
+ col: {
+ span: 22,
+ },
+ wrapper: {
+ width: 600,
+ },
+ },
+ actionbar: {
+ buttons: {
+ add: {
+ async click() {
+ if (!settingsStore.isPlus) {
+ // 非plus
+ if (crudBinding.value.data.length >= 1) {
+ notification.error({
+ message: t("certd.monitor.basicLimitError"),
+ });
+ mitter.emit("openVipModal");
+ return;
+ }
+ }
- const { openSiteIpMonitorDialog } = useSiteIpMonitor();
- const { openSiteImportDialog } = useSiteImport();
- return {
- crudOptions: {
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest,
- },
- form: {
- labelCol: {
- //固定label宽度
- span: null,
- style: {
- width: "100px",
- },
- },
- col: {
- span: 22,
- },
- wrapper: {
- width: 600,
- },
- },
- actionbar: {
- buttons: {
- add: {
- async click() {
- if (!settingsStore.isPlus) {
- // 非plus
- if (crudBinding.value.data.length >= 1) {
- notification.error({
- message: t("certd.monitor.basicLimitError"),
- });
- mitter.emit("openVipModal");
- return;
- }
- }
+ //检查是否监控站点数量超出限制
+ if (settingsStore.isComm && settingsStore.suiteSetting.enabled) {
+ // 检查数量是否超限
+ const suiteDetail = await mySuiteApi.SuiteDetailGet();
+ const max = suiteDetail.monitorCount.max;
+ if (max != -1 && max <= suiteDetail.monitorCount.used) {
+ notification.error({
+ message: t("certd.monitor.limitExceeded", { max }),
+ });
+ return;
+ }
+ }
-
- //检查是否监控站点数量超出限制
- if (settingsStore.isComm && settingsStore.suiteSetting.enabled) {
- // 检查数量是否超限
- const suiteDetail = await mySuiteApi.SuiteDetailGet();
- const max = suiteDetail.monitorCount.max;
- if (max != -1 && max <= suiteDetail.monitorCount.used) {
- notification.error({
- message: t("certd.monitor.limitExceeded", { max }),
- });
- return;
- }
- }
-
- await crudExpose.openAdd({});
- },
- },
- //导入按钮
- import: {
- show: true,
- text: t("certd.monitor.bulkImport"),
- type: "primary",
- async click() {
- openSiteImportDialog({
- afterSubmit() {
- crudExpose.doRefresh();
- },
- });
- },
- },
- },
- },
- rowHandle: {
- fixed: "right",
- width: 240,
- buttons: {
- check: {
- order: 0,
- type: "link",
- text: null,
- tooltip: {
- title: "立即检查",
- },
- icon: "ion:play-sharp",
- click: async ({ row }) => {
- await api.DoCheck(row.id);
- await crudExpose.doRefresh();
- notification.success({
- message: t("certd.monitor.checkSubmittedRefresh"),
- });
- },
- },
- ipCheck: {
- order: 10,
- type: "link",
- text: null,
- show: compute(({ row }) => row.ipCheck === true),
- tooltip: {
- title: t("certd.monitor.ipManagement"),
- },
- icon: "entypo:address",
- click: async ({ row }) => {
- openSiteIpMonitorDialog({ siteId: row.id });
- },
- },
- },
- },
- tabs: {
- name: "disabled",
- show: true,
- },
- columns: {
- id: {
- title: "ID",
- key: "id",
- type: "number",
- search: {
- show: false,
- },
- column: {
- width: 80,
- align: "center",
- },
- form: {
- show: false,
- },
- },
- name: {
- title: t("certd.monitor.siteName"),
- search: {
- show: true,
- },
- type: "text",
- form: {
- rules: [{ required: true, message: t("certd.monitor.enterSiteName") }],
- },
- column: {
- width: 160,
- },
- },
- domain: {
- title: t("certd.monitor.domain"),
- search: {
- show: true,
- },
- type: "text",
- form: {
- rules: [
- { required: true, message: t("certd.monitor.enterDomain") },
- // @ts-ignore
- { type: "domains", message: t("certd.monitor.enterValidDomain") },
- ],
- },
- column: {
- width: 230,
- sorter: true,
- cellRender({ value, row }) {
- const url = `https://${value}:${row.httpsPort}`;
- return (
-
-
-
- {value}:{row.httpsPort}
-
-
-
- );
- },
- },
- },
- httpsPort: {
- title: t("certd.monitor.httpsPort"),
- search: {
- show: false,
- },
- type: "number",
- form: {
- value: 443,
- rules: [{ required: true, message: t("certd.monitor.enterPort") }],
- },
- column: {
- width: 100,
- show: false,
- },
- },
- certInfo: {
- title: t("certd.monitor.certInfo"),
- type: "text",
- form: { show: false },
- column: {
- width: 200,
- sorter: false,
- show: true,
- conditionalRender: false,
- cellRender({ value, row }) {
- const slots = {
- content() {
- return (
-
-
{t("certd.monitor.issuer")}: {row.certProvider}
-
{t("certd.monitor.certDomains")}: {row.certDomains}
-
- );
- },
- };
- return (
-
- {row.certDomains}
-
- );
- },
- },
- },
- certDomains: {
- title: t("certd.monitor.certDomains"),
- search: {
- show: true,
- },
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 200,
- sorter: true,
- show: false,
- cellRender({ value }) {
- return (
-
- {value}
-
- );
- },
- },
- },
- certProvider: {
- title: t("certd.monitor.certProvider"),
- search: {
- show: false,
- },
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 200,
- sorter: true,
- show: false,
- cellRender({ value }) {
- return {value};
- },
- },
- },
- certStatus: {
- title: t("certd.monitor.certStatus"),
- search: {
- show: true,
- },
- type: "dict-select",
- dict: dict({
- data: [
- { label: t("certd.monitor.status.ok"), value: "ok", color: "green" },
- { label: t("certd.monitor.status.expired"), value: "expired", color: "red" },
- ],
- }),
- form: {
- show: false,
- },
- column: {
- width: 100,
- sorter: true,
- show: true,
- align: "center",
- },
- },
- certExpiresTime: {
- title: t("certd.monitor.certExpiresTime"),
- search: {
- show: false,
- },
- type: "date",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- cellRender({ value }) {
- if (!value) {
- return "-";
- }
- const expireDate = dayjs(value).format("YYYY-MM-DD");
- const leftDays = dayjs(value).diff(dayjs(), "day");
- const color = leftDays < 20 ? "red" : "#389e0d";
- const percent = (leftDays / 90) * 100;
- return (
- `${leftDays}${t("certd.monitor.days")}`}
- />
- );
- },
- },
- },
- lastCheckTime: {
- title: t("certd.monitor.lastCheckTime"),
- search: {
- show: false,
- },
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- width: 155,
- },
- },
- disabled: {
- title: t("certd.monitor.disabled"),
- search: {
- show: false,
- },
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("common.enabled"), value: false, color: "green" },
- { label: t("common.disabled"), value: true, color: "red" },
- ],
- }),
- form: {
- value: false,
- },
- column: {
- width: 100,
- sorter: true,
- align: "center",
- component: {
- name: "fs-dict-switch",
- vModel: "checked",
- on: {
- async change({ row, $event }) {
- await api.DisabledChange(row.id, $event);
- await crudExpose.doRefresh();
- },
- },
- },
- },
- },
- ipCheck: {
- title: t("certd.monitor.ipCheck"),
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("common.enabled"), value: true, color: "green" },
- { label: t("common.disabled"), value: false, color: "gray" },
- ],
- }),
- form: {
- value: false,
- rules: [{ required: true, message: t("certd.monitor.selectRequired") }],
- },
- column: {
- align: "center",
- width: 100,
- conditionalRender: false,
- component: {
- name: "fs-dict-switch",
- vModel: "checked",
- on: {
- change({ row, $event }) {
- Modal.confirm({
- title: t("common.confirm"),
- content: t("certd.monitor.ipCheckConfirm", { status: $event ? t("common.enabled") : t("common.disabled") }),
- onOk: async () => {
- await api.IpCheckChange(row.id, $event);
- await crudExpose.doRefresh();
- if ($event) {
- openSiteIpMonitorDialog({ siteId: row.id });
- }
- },
- onCancel: async () => {
- await crudExpose.doRefresh();
- },
- });
- },
- },
- },
- }
- } as ColumnCompositionProps,
- ipCount: {
- title: t("certd.monitor.ipCount"),
- search: {
- show: false,
- },
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 100,
- sorter: true,
- align: "center",
- },
- },
- checkStatus: {
- title: t("certd.monitor.checkStatus"),
- search: {
- show: false,
- },
- type: "dict-select",
- dict: checkStatusDict,
- form: {
- show: false,
- },
- column: {
- width: 100,
- align: "center",
- sorter: true,
- cellRender({ value, row }) {
- return (
-
-
-
- );
- },
- },
- },
- // error: {
- // title: "错误信息",
- // search: {
- // show: false
- // },
- // type: "text",
- // form: {
- // show: false
- // },
- // column: {
- // width: 200,
- // sorter: true,
- // cellRender({ value }) {
- // return {value};
- // }
- // }
- // },
- pipelineId: {
- title: t("certd.monitor.pipelineId"),
- search: {
- show: false,
- },
- form: { show: false },
- type: "number",
- column: {
- width: 200,
- sorter: true,
- show: false,
- },
- },
- certInfoId: {
- title: t("certd.monitor.certInfoId"),
- search: {
- show: false,
- },
- type: "number",
- form: { show: false },
- column: {
- width: 100,
- sorter: true,
- show: false,
- },
- },
- },
- },
- };
+ await crudExpose.openAdd({});
+ },
+ },
+ //导入按钮
+ import: {
+ show: true,
+ text: t("certd.monitor.bulkImport"),
+ type: "primary",
+ async click() {
+ openSiteImportDialog({
+ afterSubmit() {
+ crudExpose.doRefresh();
+ },
+ });
+ },
+ },
+ },
+ },
+ rowHandle: {
+ fixed: "right",
+ width: 240,
+ buttons: {
+ check: {
+ order: 0,
+ type: "link",
+ text: null,
+ tooltip: {
+ title: "立即检查",
+ },
+ icon: "ion:play-sharp",
+ click: async ({ row }) => {
+ await api.DoCheck(row.id);
+ await crudExpose.doRefresh();
+ notification.success({
+ message: t("certd.monitor.checkSubmittedRefresh"),
+ });
+ },
+ },
+ ipCheck: {
+ order: 10,
+ type: "link",
+ text: null,
+ show: compute(({ row }) => row.ipCheck === true),
+ tooltip: {
+ title: t("certd.monitor.ipManagement"),
+ },
+ icon: "entypo:address",
+ click: async ({ row }) => {
+ openSiteIpMonitorDialog({ siteId: row.id });
+ },
+ },
+ },
+ },
+ tabs: {
+ name: "disabled",
+ show: true,
+ },
+ columns: {
+ id: {
+ title: "ID",
+ key: "id",
+ type: "number",
+ search: {
+ show: false,
+ },
+ column: {
+ width: 80,
+ align: "center",
+ },
+ form: {
+ show: false,
+ },
+ },
+ name: {
+ title: t("certd.monitor.siteName"),
+ search: {
+ show: true,
+ },
+ type: "text",
+ form: {
+ rules: [{ required: true, message: t("certd.monitor.enterSiteName") }],
+ },
+ column: {
+ width: 160,
+ },
+ },
+ domain: {
+ title: t("certd.monitor.domain"),
+ search: {
+ show: true,
+ },
+ type: "text",
+ form: {
+ rules: [
+ { required: true, message: t("certd.monitor.enterDomain") },
+ // @ts-ignore
+ { type: "domains", message: t("certd.monitor.enterValidDomain") },
+ ],
+ },
+ column: {
+ width: 230,
+ sorter: true,
+ cellRender({ value, row }) {
+ const url = `https://${value}:${row.httpsPort}`;
+ return (
+
+
+
+ {value}:{row.httpsPort}
+
+
+
+ );
+ },
+ },
+ },
+ httpsPort: {
+ title: t("certd.monitor.httpsPort"),
+ search: {
+ show: false,
+ },
+ type: "number",
+ form: {
+ value: 443,
+ rules: [{ required: true, message: t("certd.monitor.enterPort") }],
+ },
+ column: {
+ width: 100,
+ show: false,
+ },
+ },
+ certInfo: {
+ title: t("certd.monitor.certInfo"),
+ type: "text",
+ form: { show: false },
+ column: {
+ width: 200,
+ sorter: false,
+ show: true,
+ conditionalRender: false,
+ cellRender({ value, row }) {
+ const slots = {
+ content() {
+ return (
+
+
+ {t("certd.monitor.issuer")}: {row.certProvider}
+
+
+ {t("certd.monitor.certDomains")}: {row.certDomains}
+
+
+ );
+ },
+ };
+ return (
+
+ {row.certDomains}
+
+ );
+ },
+ },
+ },
+ certDomains: {
+ title: t("certd.monitor.certDomains"),
+ search: {
+ show: true,
+ },
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 200,
+ sorter: true,
+ show: false,
+ cellRender({ value }) {
+ return (
+
+ {value}
+
+ );
+ },
+ },
+ },
+ certProvider: {
+ title: t("certd.monitor.certProvider"),
+ search: {
+ show: false,
+ },
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 200,
+ sorter: true,
+ show: false,
+ cellRender({ value }) {
+ return {value};
+ },
+ },
+ },
+ certStatus: {
+ title: t("certd.monitor.certStatus"),
+ search: {
+ show: true,
+ },
+ type: "dict-select",
+ dict: dict({
+ data: [
+ { label: t("certd.monitor.status.ok"), value: "ok", color: "green" },
+ { label: t("certd.monitor.status.expired"), value: "expired", color: "red" },
+ ],
+ }),
+ form: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ sorter: true,
+ show: true,
+ align: "center",
+ },
+ },
+ certExpiresTime: {
+ title: t("certd.monitor.certExpiresTime"),
+ search: {
+ show: false,
+ },
+ type: "date",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ cellRender({ value }) {
+ if (!value) {
+ return "-";
+ }
+ const expireDate = dayjs(value).format("YYYY-MM-DD");
+ const leftDays = dayjs(value).diff(dayjs(), "day");
+ const color = leftDays < 20 ? "red" : "#389e0d";
+ const percent = (leftDays / 90) * 100;
+ return `${leftDays}${t("certd.monitor.days")}`} />;
+ },
+ },
+ },
+ lastCheckTime: {
+ title: t("certd.monitor.lastCheckTime"),
+ search: {
+ show: false,
+ },
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ width: 155,
+ },
+ },
+ disabled: {
+ title: t("certd.monitor.disabled"),
+ search: {
+ show: false,
+ },
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("common.enabled"), value: false, color: "green" },
+ { label: t("common.disabled"), value: true, color: "red" },
+ ],
+ }),
+ form: {
+ value: false,
+ },
+ column: {
+ width: 100,
+ sorter: true,
+ align: "center",
+ component: {
+ name: "fs-dict-switch",
+ vModel: "checked",
+ on: {
+ async change({ row, $event }) {
+ await api.DisabledChange(row.id, $event);
+ await crudExpose.doRefresh();
+ },
+ },
+ },
+ },
+ },
+ ipCheck: {
+ title: t("certd.monitor.ipCheck"),
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("common.enabled"), value: true, color: "green" },
+ { label: t("common.disabled"), value: false, color: "gray" },
+ ],
+ }),
+ form: {
+ value: false,
+ rules: [{ required: true, message: t("certd.monitor.selectRequired") }],
+ },
+ column: {
+ align: "center",
+ width: 100,
+ conditionalRender: false,
+ component: {
+ name: "fs-dict-switch",
+ vModel: "checked",
+ on: {
+ change({ row, $event }) {
+ Modal.confirm({
+ title: t("common.confirm"),
+ content: t("certd.monitor.ipCheckConfirm", { status: $event ? t("common.enabled") : t("common.disabled") }),
+ onOk: async () => {
+ await api.IpCheckChange(row.id, $event);
+ await crudExpose.doRefresh();
+ if ($event) {
+ openSiteIpMonitorDialog({ siteId: row.id });
+ }
+ },
+ onCancel: async () => {
+ await crudExpose.doRefresh();
+ },
+ });
+ },
+ },
+ },
+ },
+ } as ColumnCompositionProps,
+ ipCount: {
+ title: t("certd.monitor.ipCount"),
+ search: {
+ show: false,
+ },
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ sorter: true,
+ align: "center",
+ },
+ },
+ checkStatus: {
+ title: t("certd.monitor.checkStatus"),
+ search: {
+ show: false,
+ },
+ type: "dict-select",
+ dict: checkStatusDict,
+ form: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ align: "center",
+ sorter: true,
+ cellRender({ value, row }) {
+ return (
+
+
+
+ );
+ },
+ },
+ },
+ // error: {
+ // title: "错误信息",
+ // search: {
+ // show: false
+ // },
+ // type: "text",
+ // form: {
+ // show: false
+ // },
+ // column: {
+ // width: 200,
+ // sorter: true,
+ // cellRender({ value }) {
+ // return {value};
+ // }
+ // }
+ // },
+ pipelineId: {
+ title: t("certd.monitor.pipelineId"),
+ search: {
+ show: false,
+ },
+ form: { show: false },
+ type: "number",
+ column: {
+ width: 200,
+ sorter: true,
+ show: false,
+ },
+ },
+ certInfoId: {
+ title: t("certd.monitor.certInfoId"),
+ search: {
+ show: false,
+ },
+ type: "number",
+ form: { show: false },
+ column: {
+ width: 100,
+ sorter: true,
+ show: false,
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/certd/monitor/site/index.vue b/packages/ui/certd-client/src/views/certd/monitor/site/index.vue
index 1da7404da..51d50f88a 100644
--- a/packages/ui/certd-client/src/views/certd/monitor/site/index.vue
+++ b/packages/ui/certd-client/src/views/certd/monitor/site/index.vue
@@ -1,28 +1,27 @@
-
-
-
- {{ t("certd.monitor.title") }}
-
-
- {{ t("certd.monitor.description") }}
- {{ t("certd.monitor.settingLink") }}
-
-
- {{ t("certd.monitor.limitInfo") }}
-
-
-
-
-
-
{{ t("certd.monitor.checkAll") }}
-
-
-
-
+
+
+
+ {{ t("certd.monitor.title") }}
+
+
+ {{ t("certd.monitor.description") }}
+ {{ t("certd.monitor.settingLink") }}
+
+
+ {{ t("certd.monitor.limitInfo") }}
+
+
+
+
+
+
{{ t("certd.monitor.checkAll") }}
+
+
+
+
-
diff --git a/packages/ui/certd-client/src/views/certd/monitor/site/ip/crud.tsx b/packages/ui/certd-client/src/views/certd/monitor/site/ip/crud.tsx
index f600adb44..1da523c95 100644
--- a/packages/ui/certd-client/src/views/certd/monitor/site/ip/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/monitor/site/ip/crud.tsx
@@ -7,354 +7,354 @@ import { Modal, notification } from "ant-design-vue";
import { useSiteIpMonitor } from "/@/views/certd/monitor/site/ip/use";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const { t } = useI18n();
- const api = siteIpApi;
+ const { t } = useI18n();
+ const api = siteIpApi;
- const pageRequest = async (query: UserPageQuery): Promise => {
- if (!query.query) {
- query.query = {};
- }
- query.query.siteId = context.props.siteId;
- return await api.GetList(query);
- };
- const editRequest = async (req: EditReq) => {
- const { form, row } = req;
- form.id = row.id;
- const res = await api.UpdateObj(form);
- return res;
- };
- const delRequest = async (req: DelReq) => {
- const { row } = req;
- return await api.DelObj(row.id);
- };
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ if (!query.query) {
+ query.query = {};
+ }
+ query.query.siteId = context.props.siteId;
+ return await api.GetList(query);
+ };
+ const editRequest = async (req: EditReq) => {
+ const { form, row } = req;
+ form.id = row.id;
+ const res = await api.UpdateObj(form);
+ return res;
+ };
+ const delRequest = async (req: DelReq) => {
+ const { row } = req;
+ return await api.DelObj(row.id);
+ };
- const addRequest = async (req: AddReq) => {
- const { form } = req;
- form.siteId = context.props.siteId;
- const res = await api.AddObj(form);
- return res;
- };
+ const addRequest = async (req: AddReq) => {
+ const { form } = req;
+ form.siteId = context.props.siteId;
+ const res = await api.AddObj(form);
+ return res;
+ };
- const checkStatusDict = dict({
- data: [
- { label: t("certd.statusSuccess"), value: "ok", color: "green" },
- { label: t("certd.statusChecking"), value: "checking", color: "blue" },
- { label: t("certd.statusError"), value: "error", color: "red" },
- ],
- });
- const { openSiteIpImportDialog } = useSiteIpMonitor();
- return {
- crudOptions: {
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest,
- },
- form: {
- labelCol: {
- //固定label宽度
- span: null,
- style: {
- width: "100px",
- },
- },
- col: {
- span: 22,
- },
- wrapper: {
- width: 600,
- },
- },
- actionbar: {
- buttons: {
- add: {
- async click() {
- await crudExpose.openAdd({});
- },
- },
- import: {
- show: true,
- text: t("certd.actionImportBatch"),
- type: "primary",
- async click() {
- openSiteIpImportDialog({
- siteId: context.props.siteId,
- afterSubmit() {
- crudExpose.doRefresh();
- },
- });
- },
- },
- load: {
- text: t("certd.actionSyncIp"),
- type: "primary",
- async click() {
- Modal.confirm({
- title: t("certd.modalTitleSyncIp"),
- content: t("certd.modalContentSyncIp"),
- onOk: async () => {
- await api.DoSync(context.props.siteId);
- await crudExpose.doRefresh();
- notification.success({
- message: t("certd.notificationSyncComplete"),
- });
- },
- });
- },
- },
- checkAll: {
- text: t("certd.actionCheckAll"),
- type: "primary",
- click: () => {
- Modal.confirm({
- title: t("certd.modalTitleConfirm"),
- content: t("certd.modalContentCheckAll"),
- onOk: async () => {
- await siteIpApi.CheckAll(context.props.siteId);
- notification.success({
- message: t("certd.notificationCheckSubmitted"),
- description: t("certd.notificationCheckDescription"),
- });
- },
- });
- },
- },
- },
- },
- rowHandle: {
- fixed: "right",
- width: 240,
- buttons: {
- check: {
- order: 0,
- type: "link",
- text: null,
- tooltip: {
- title: t("certd.tooltipCheckNow"),
- },
- icon: "ion:play-sharp",
- click: async ({ row }) => {
- await api.DoCheck(row.id);
- await crudExpose.doRefresh();
- notification.success({
- message: t("certd.notificationCheckSubmittedPleaseRefresh"),
- });
- },
- },
- },
- },
- columns: {
- id: {
- title: t("certd.columnId"),
- key: "id",
- type: "number",
- search: {
- show: false,
- },
- column: {
- width: 80,
- align: "center",
- },
- form: {
- show: false,
- },
- },
- ipAddress: {
- title: t("certd.columnIp"),
- search: {
- show: true,
- },
- type: "text",
- helper: t("certd.helperIpCname"),
- form: {
- rules: [{ required: true, message: t("certd.ruleIpRequired") }],
- },
- column: {
- width: 160,
- },
- },
- certDomains: {
- title: t("certd.columnCertDomains"),
- search: {
- show: false,
- },
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 200,
- sorter: true,
- show: false,
- cellRender({ value }) {
- return (
-
- {value}
-
- );
- },
- },
- },
- certProvider: {
- title: t("certd.columnCertProvider"),
- search: {
- show: false,
- },
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 200,
- show: false,
- sorter: true,
- cellRender({ value }) {
- return {value};
- },
- },
- },
- certStatus: {
- title: t("certd.columnCertStatus"),
- search: {
- show: true,
- },
- type: "dict-select",
- dict: dict({
- data: [
- { label: t("certd.statusNormal"), value: "ok", color: "green" },
- { label: t("certd.statusExpired"), value: "expired", color: "red" },
- ],
- }),
- form: {
- show: false,
- },
- column: {
- width: 100,
- sorter: true,
- show: true,
- align: "center",
- },
- },
- certExpiresTime: {
- title: t("certd.columnCertExpiresTime"),
- search: {
- show: false,
- },
- type: "date",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- cellRender({ value }) {
- if (!value) {
- return "-";
- }
- const expireDate = dayjs(value).format("YYYY-MM-DD");
- const leftDays = dayjs(value).diff(dayjs(), "day");
- const color = leftDays < 20 ? "red" : "#389e0d";
- const percent = (leftDays / 90) * 100;
- return `${leftDays} ${t("certd.days")}`} />;
- },
- },
- },
- checkStatus: {
- title: t("certd.columnCheckStatus"),
- search: {
- show: false,
- },
- type: "dict-select",
- dict: checkStatusDict,
- form: {
- show: false,
- },
- column: {
- width: 100,
- align: "center",
- sorter: true,
- cellRender({ value, row, key }) {
- return (
-
-
-
- );
- },
- },
- },
- lastCheckTime: {
- title: t("certd.columnLastCheckTime"),
- search: {
- show: false,
- },
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- width: 155,
- },
- },
- from: {
- title: t("certd.columnSource"),
- search: {
- show: false,
- },
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("certd.sourceSync"), value: "sync", color: "green" },
- { label: t("certd.sourceManual"), value: "manual", color: "blue" },
- { label: t("certd.sourceImport"), value: "import", color: "blue" },
- ],
- }),
- form: {
- value: false,
- },
- column: {
- width: 100,
- sorter: true,
- align: "center",
- },
- },
- disabled: {
- title: t("certd.columnDisabled"),
- search: {
- show: false,
- },
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("certd.enabled"), value: false, color: "green" },
- { label: t("certd.disabled"), value: true, color: "red" },
- ],
- }),
- form: {
- value: false,
- },
- column: {
- width: 100,
- sorter: true,
- align: "center",
- },
- },
- remark: {
- title: t("certd.columnRemark"),
- search: {
- show: false,
- },
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 200,
- sorter: true,
- tooltip: true,
- },
- },
- },
- },
- };
+ const checkStatusDict = dict({
+ data: [
+ { label: t("certd.statusSuccess"), value: "ok", color: "green" },
+ { label: t("certd.statusChecking"), value: "checking", color: "blue" },
+ { label: t("certd.statusError"), value: "error", color: "red" },
+ ],
+ });
+ const { openSiteIpImportDialog } = useSiteIpMonitor();
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ form: {
+ labelCol: {
+ //固定label宽度
+ span: null,
+ style: {
+ width: "100px",
+ },
+ },
+ col: {
+ span: 22,
+ },
+ wrapper: {
+ width: 600,
+ },
+ },
+ actionbar: {
+ buttons: {
+ add: {
+ async click() {
+ await crudExpose.openAdd({});
+ },
+ },
+ import: {
+ show: true,
+ text: t("certd.actionImportBatch"),
+ type: "primary",
+ async click() {
+ openSiteIpImportDialog({
+ siteId: context.props.siteId,
+ afterSubmit() {
+ crudExpose.doRefresh();
+ },
+ });
+ },
+ },
+ load: {
+ text: t("certd.actionSyncIp"),
+ type: "primary",
+ async click() {
+ Modal.confirm({
+ title: t("certd.modalTitleSyncIp"),
+ content: t("certd.modalContentSyncIp"),
+ onOk: async () => {
+ await api.DoSync(context.props.siteId);
+ await crudExpose.doRefresh();
+ notification.success({
+ message: t("certd.notificationSyncComplete"),
+ });
+ },
+ });
+ },
+ },
+ checkAll: {
+ text: t("certd.actionCheckAll"),
+ type: "primary",
+ click: () => {
+ Modal.confirm({
+ title: t("certd.modalTitleConfirm"),
+ content: t("certd.modalContentCheckAll"),
+ onOk: async () => {
+ await siteIpApi.CheckAll(context.props.siteId);
+ notification.success({
+ message: t("certd.notificationCheckSubmitted"),
+ description: t("certd.notificationCheckDescription"),
+ });
+ },
+ });
+ },
+ },
+ },
+ },
+ rowHandle: {
+ fixed: "right",
+ width: 240,
+ buttons: {
+ check: {
+ order: 0,
+ type: "link",
+ text: null,
+ tooltip: {
+ title: t("certd.tooltipCheckNow"),
+ },
+ icon: "ion:play-sharp",
+ click: async ({ row }) => {
+ await api.DoCheck(row.id);
+ await crudExpose.doRefresh();
+ notification.success({
+ message: t("certd.notificationCheckSubmittedPleaseRefresh"),
+ });
+ },
+ },
+ },
+ },
+ columns: {
+ id: {
+ title: t("certd.columnId"),
+ key: "id",
+ type: "number",
+ search: {
+ show: false,
+ },
+ column: {
+ width: 80,
+ align: "center",
+ },
+ form: {
+ show: false,
+ },
+ },
+ ipAddress: {
+ title: t("certd.columnIp"),
+ search: {
+ show: true,
+ },
+ type: "text",
+ helper: t("certd.helperIpCname"),
+ form: {
+ rules: [{ required: true, message: t("certd.ruleIpRequired") }],
+ },
+ column: {
+ width: 160,
+ },
+ },
+ certDomains: {
+ title: t("certd.columnCertDomains"),
+ search: {
+ show: false,
+ },
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 200,
+ sorter: true,
+ show: false,
+ cellRender({ value }) {
+ return (
+
+ {value}
+
+ );
+ },
+ },
+ },
+ certProvider: {
+ title: t("certd.columnCertProvider"),
+ search: {
+ show: false,
+ },
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 200,
+ show: false,
+ sorter: true,
+ cellRender({ value }) {
+ return {value};
+ },
+ },
+ },
+ certStatus: {
+ title: t("certd.columnCertStatus"),
+ search: {
+ show: true,
+ },
+ type: "dict-select",
+ dict: dict({
+ data: [
+ { label: t("certd.statusNormal"), value: "ok", color: "green" },
+ { label: t("certd.statusExpired"), value: "expired", color: "red" },
+ ],
+ }),
+ form: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ sorter: true,
+ show: true,
+ align: "center",
+ },
+ },
+ certExpiresTime: {
+ title: t("certd.columnCertExpiresTime"),
+ search: {
+ show: false,
+ },
+ type: "date",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ cellRender({ value }) {
+ if (!value) {
+ return "-";
+ }
+ const expireDate = dayjs(value).format("YYYY-MM-DD");
+ const leftDays = dayjs(value).diff(dayjs(), "day");
+ const color = leftDays < 20 ? "red" : "#389e0d";
+ const percent = (leftDays / 90) * 100;
+ return `${leftDays} ${t("certd.days")}`} />;
+ },
+ },
+ },
+ checkStatus: {
+ title: t("certd.columnCheckStatus"),
+ search: {
+ show: false,
+ },
+ type: "dict-select",
+ dict: checkStatusDict,
+ form: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ align: "center",
+ sorter: true,
+ cellRender({ value, row, key }) {
+ return (
+
+
+
+ );
+ },
+ },
+ },
+ lastCheckTime: {
+ title: t("certd.columnLastCheckTime"),
+ search: {
+ show: false,
+ },
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ width: 155,
+ },
+ },
+ from: {
+ title: t("certd.columnSource"),
+ search: {
+ show: false,
+ },
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("certd.sourceSync"), value: "sync", color: "green" },
+ { label: t("certd.sourceManual"), value: "manual", color: "blue" },
+ { label: t("certd.sourceImport"), value: "import", color: "blue" },
+ ],
+ }),
+ form: {
+ value: false,
+ },
+ column: {
+ width: 100,
+ sorter: true,
+ align: "center",
+ },
+ },
+ disabled: {
+ title: t("certd.columnDisabled"),
+ search: {
+ show: false,
+ },
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("certd.enabled"), value: false, color: "green" },
+ { label: t("certd.disabled"), value: true, color: "red" },
+ ],
+ }),
+ form: {
+ value: false,
+ },
+ column: {
+ width: 100,
+ sorter: true,
+ align: "center",
+ },
+ },
+ remark: {
+ title: t("certd.columnRemark"),
+ search: {
+ show: false,
+ },
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 200,
+ sorter: true,
+ tooltip: true,
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/certd/monitor/site/setting/index.vue b/packages/ui/certd-client/src/views/certd/monitor/site/setting/index.vue
index 0c5c39341..46160e125 100644
--- a/packages/ui/certd-client/src/views/certd/monitor/site/setting/index.vue
+++ b/packages/ui/certd-client/src/views/certd/monitor/site/setting/index.vue
@@ -1,41 +1,37 @@
-
-
- {{ t("certd.siteMonitorSettings") }}
-
-
-
+
+
+ {{ t("certd.siteMonitorSettings") }}
+
+
+
-
diff --git a/packages/ui/certd-client/src/views/certd/monitor/site/use.tsx b/packages/ui/certd-client/src/views/certd/monitor/site/use.tsx
index 32b0efc3f..fe46f8bd1 100644
--- a/packages/ui/certd-client/src/views/certd/monitor/site/use.tsx
+++ b/packages/ui/certd-client/src/views/certd/monitor/site/use.tsx
@@ -3,42 +3,42 @@ import { siteInfoApi } from "./api";
import { useI18n } from "vue-i18n";
export function useSiteImport() {
- const { t } = useI18n();
- const { openCrudFormDialog } = useFormWrapper();
+ const { t } = useI18n();
+ const { openCrudFormDialog } = useFormWrapper();
- async function openSiteImportDialog(opts: { afterSubmit: any }) {
- const { afterSubmit } = opts;
- await openCrudFormDialog({
- crudOptions: {
- columns: {
- text: {
- type: "textarea",
- title: t("certd.domainList.title"), // 域名列表
- form: {
- helper: t("certd.domainList.helper"),
- rules: [{ required: true, message: t("certd.domainList.required") }],
- component: {
- placeholder: t("certd.domainList.placeholder"),
- rows: 8,
- },
- col: {
- span: 24,
- },
- },
- },
- },
+ async function openSiteImportDialog(opts: { afterSubmit: any }) {
+ const { afterSubmit } = opts;
+ await openCrudFormDialog({
+ crudOptions: {
+ columns: {
+ text: {
+ type: "textarea",
+ title: t("certd.domainList.title"), // 域名列表
+ form: {
+ helper: t("certd.domainList.helper"),
+ rules: [{ required: true, message: t("certd.domainList.required") }],
+ component: {
+ placeholder: t("certd.domainList.placeholder"),
+ rows: 8,
+ },
+ col: {
+ span: 24,
+ },
+ },
+ },
+ },
- form: {
- async doSubmit({ form }) {
- return siteInfoApi.Import(form);
- },
- afterSubmit,
- },
- },
- });
- }
+ form: {
+ async doSubmit({ form }) {
+ return siteInfoApi.Import(form);
+ },
+ afterSubmit,
+ },
+ },
+ });
+ }
- return {
- openSiteImportDialog,
- };
+ return {
+ openSiteImportDialog,
+ };
}
diff --git a/packages/ui/certd-client/src/views/certd/notification/common.tsx b/packages/ui/certd-client/src/views/certd/notification/common.tsx
index 196adcddf..65d038a89 100644
--- a/packages/ui/certd-client/src/views/certd/notification/common.tsx
+++ b/packages/ui/certd-client/src/views/certd/notification/common.tsx
@@ -8,238 +8,238 @@ import { mitter } from "/@/utils/util.mitt";
import { useI18n } from "vue-i18n";
export function notificationProvide(api: any) {
- provide("notificationApi", api);
- provide("get:plugin:type", () => {
- return "notification";
- });
+ provide("notificationApi", api);
+ provide("get:plugin:type", () => {
+ return "notification";
+ });
}
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
- const { t } = useI18n();
+ const { t } = useI18n();
- const notificationTypeDictRef = dict({
- url: "/pi/notification/getTypeDict",
- });
- const defaultPluginConfig = {
- component: {
- name: "a-input",
- vModel: "value",
- },
- };
+ const notificationTypeDictRef = dict({
+ url: "/pi/notification/getTypeDict",
+ });
+ const defaultPluginConfig = {
+ component: {
+ name: "a-input",
+ vModel: "value",
+ },
+ };
- function buildDefineFields(define: any, form: any, mode: string) {
- const formWrapperRef = crudExpose.getFormWrapperRef();
- const columnsRef = toRef(formWrapperRef.formOptions, "columns");
+ function buildDefineFields(define: any, form: any, mode: string) {
+ const formWrapperRef = crudExpose.getFormWrapperRef();
+ const columnsRef = toRef(formWrapperRef.formOptions, "columns");
- for (const key in columnsRef.value) {
- if (key.indexOf(".") >= 0) {
- delete columnsRef.value[key];
- }
- }
- console.log('crudBinding.value[mode + "Form"].columns', columnsRef.value);
- forEach(define.input, (value: any, mapKey: any) => {
- const key = "body." + mapKey;
- const field = {
- ...value,
- key,
- };
- const column = merge({ title: key }, defaultPluginConfig, field);
- //eval
- useReference(column);
+ for (const key in columnsRef.value) {
+ if (key.indexOf(".") >= 0) {
+ delete columnsRef.value[key];
+ }
+ }
+ console.log('crudBinding.value[mode + "Form"].columns', columnsRef.value);
+ forEach(define.input, (value: any, mapKey: any) => {
+ const key = "body." + mapKey;
+ const field = {
+ ...value,
+ key,
+ };
+ const column = merge({ title: key }, defaultPluginConfig, field);
+ //eval
+ useReference(column);
- if (column.required) {
- if (!column.rules) {
- column.rules = [];
- }
- column.rules.push({ required: true, message: t("certd.requiredField") });
- }
+ if (column.required) {
+ if (!column.rules) {
+ column.rules = [];
+ }
+ column.rules.push({ required: true, message: t("certd.requiredField") });
+ }
- //设置默认值
- if (column.value != null && get(form, key) == null) {
- set(form, key, column.value);
- }
- //字段配置赋值
- columnsRef.value[key] = column;
- console.log("form", columnsRef.value, form);
- });
- }
+ //设置默认值
+ if (column.value != null && get(form, key) == null) {
+ set(form, key, column.value);
+ }
+ //字段配置赋值
+ columnsRef.value[key] = column;
+ console.log("form", columnsRef.value, form);
+ });
+ }
- const currentDefine = ref();
+ const currentDefine = ref();
- return {
- id: {
- title: "ID",
- key: "id",
- type: "number",
- column: {
- width: 100,
- },
- form: {
- show: false,
- },
- },
- type: {
- title: t("certd.notificationType"),
- type: "dict-select",
- dict: notificationTypeDictRef,
- search: {
- show: false,
- },
- column: {
- width: 200,
- component: {
- color: "auto",
- },
- },
- editForm: {
- component: {
- disabled: false,
- },
- },
- form: {
- component: {
- disabled: false,
- showSearch: true,
- filterOption: (input: string, option: any) => {
- input = input?.toLowerCase();
- return option.value.toLowerCase().indexOf(input) >= 0 || option.label.toLowerCase().indexOf(input) >= 0;
- },
- renderLabel(item: any) {
- return (
-
- {item.label}
- {item.needPlus && }
-
- );
- },
- },
- rules: [{ required: true, message: t("certd.selectNotificationType") }],
- valueChange: {
- immediate: true,
- async handle({ value, mode, form, immediate }) {
- if (value == null) {
- return;
- }
- const lastTitle = currentDefine.value?.title;
- const define = await api.GetProviderDefine(value);
- currentDefine.value = define;
- console.log("define", define);
+ return {
+ id: {
+ title: "ID",
+ key: "id",
+ type: "number",
+ column: {
+ width: 100,
+ },
+ form: {
+ show: false,
+ },
+ },
+ type: {
+ title: t("certd.notificationType"),
+ type: "dict-select",
+ dict: notificationTypeDictRef,
+ search: {
+ show: false,
+ },
+ column: {
+ width: 200,
+ component: {
+ color: "auto",
+ },
+ },
+ editForm: {
+ component: {
+ disabled: false,
+ },
+ },
+ form: {
+ component: {
+ disabled: false,
+ showSearch: true,
+ filterOption: (input: string, option: any) => {
+ input = input?.toLowerCase();
+ return option.value.toLowerCase().indexOf(input) >= 0 || option.label.toLowerCase().indexOf(input) >= 0;
+ },
+ renderLabel(item: any) {
+ return (
+
+ {item.label}
+ {item.needPlus && }
+
+ );
+ },
+ },
+ rules: [{ required: true, message: t("certd.selectNotificationType") }],
+ valueChange: {
+ immediate: true,
+ async handle({ value, mode, form, immediate }) {
+ if (value == null) {
+ return;
+ }
+ const lastTitle = currentDefine.value?.title;
+ const define = await api.GetProviderDefine(value);
+ currentDefine.value = define;
+ console.log("define", define);
- if (!immediate) {
- form.body = {};
- if (define.needPlus) {
- mitter.emit("openVipModal");
- }
- }
+ if (!immediate) {
+ form.body = {};
+ if (define.needPlus) {
+ mitter.emit("openVipModal");
+ }
+ }
- if (!form.name || form.name === lastTitle) {
- form.name = define.title;
- }
- buildDefineFields(define, form, mode);
- },
- },
- helper: computed(() => {
- const define = currentDefine.value;
- if (define == null) {
- return "";
- }
- return define.desc;
- }),
- },
- } as ColumnCompositionProps,
- name: {
- title: t("certd.notificationName"),
- search: {
- show: true,
- },
- type: ["text"],
- form: {
- rules: [{ required: true, message: t("certd.enterName") }],
- helper: t("certd.helperNotificationName"),
- },
- column: {
- width: 200,
- },
- },
- isDefault: {
- title: t("certd.isDefault"),
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("certd.yes"), value: true, color: "success" },
- { label: t("certd.no"), value: false, color: "default" },
- ],
- }),
- form: {
- value: false,
- rules: [{ required: true, message: t("certd.selectIsDefault") }],
- order: 999,
- },
- column: {
- align: "center",
- width: 100,
- component: {
- name: "a-switch",
- vModel: "checked",
- disabled: compute(({ value }) => {
- return value === true;
- }),
- on: {
- change({ row }) {
- Modal.confirm({
- title: t("certd.prompt"),
- content: t("certd.confirmSetDefaultNotification"),
- onOk: async () => {
- await api.SetDefault(row.id);
- await crudExpose.doRefresh();
- },
- onCancel: async () => {
- await crudExpose.doRefresh();
- },
- });
- },
- },
- },
- },
- } as ColumnCompositionProps,
- test: {
- title: t("certd.test"),
- form: {
- show: compute(({ form }) => {
- return !!form.type;
- }),
- component: {
- name: "api-test",
- action: "TestRequest",
- },
- order: 990,
- col: {
- span: 24,
- },
- },
- column: {
- show: false,
- },
- },
- setting: {
- column: { show: false },
- form: {
- show: false,
- valueBuilder({ value, form }) {
- form.body = {};
- if (!value) {
- return;
- }
- const setting = JSON.parse(value);
- for (const key in setting) {
- form.body[key] = setting[key];
- }
- },
- valueResolve({ form }) {
- const setting = form.body;
- form.setting = JSON.stringify(setting);
- },
- },
- } as ColumnCompositionProps,
- };
+ if (!form.name || form.name === lastTitle) {
+ form.name = define.title;
+ }
+ buildDefineFields(define, form, mode);
+ },
+ },
+ helper: computed(() => {
+ const define = currentDefine.value;
+ if (define == null) {
+ return "";
+ }
+ return define.desc;
+ }),
+ },
+ } as ColumnCompositionProps,
+ name: {
+ title: t("certd.notificationName"),
+ search: {
+ show: true,
+ },
+ type: ["text"],
+ form: {
+ rules: [{ required: true, message: t("certd.enterName") }],
+ helper: t("certd.helperNotificationName"),
+ },
+ column: {
+ width: 200,
+ },
+ },
+ isDefault: {
+ title: t("certd.isDefault"),
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("certd.yes"), value: true, color: "success" },
+ { label: t("certd.no"), value: false, color: "default" },
+ ],
+ }),
+ form: {
+ value: false,
+ rules: [{ required: true, message: t("certd.selectIsDefault") }],
+ order: 999,
+ },
+ column: {
+ align: "center",
+ width: 100,
+ component: {
+ name: "a-switch",
+ vModel: "checked",
+ disabled: compute(({ value }) => {
+ return value === true;
+ }),
+ on: {
+ change({ row }) {
+ Modal.confirm({
+ title: t("certd.prompt"),
+ content: t("certd.confirmSetDefaultNotification"),
+ onOk: async () => {
+ await api.SetDefault(row.id);
+ await crudExpose.doRefresh();
+ },
+ onCancel: async () => {
+ await crudExpose.doRefresh();
+ },
+ });
+ },
+ },
+ },
+ },
+ } as ColumnCompositionProps,
+ test: {
+ title: t("certd.test"),
+ form: {
+ show: compute(({ form }) => {
+ return !!form.type;
+ }),
+ component: {
+ name: "api-test",
+ action: "TestRequest",
+ },
+ order: 990,
+ col: {
+ span: 24,
+ },
+ },
+ column: {
+ show: false,
+ },
+ },
+ setting: {
+ column: { show: false },
+ form: {
+ show: false,
+ valueBuilder({ value, form }) {
+ form.body = {};
+ if (!value) {
+ return;
+ }
+ const setting = JSON.parse(value);
+ for (const key in setting) {
+ form.body[key] = setting[key];
+ }
+ },
+ valueResolve({ form }) {
+ const setting = form.body;
+ form.setting = JSON.stringify(setting);
+ },
+ },
+ } as ColumnCompositionProps,
+ };
}
diff --git a/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue b/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue
index cc10c45bf..2d7177a26 100644
--- a/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue
+++ b/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue
@@ -1,26 +1,36 @@
-
+
diff --git a/packages/ui/certd-client/src/views/certd/notification/notification-selector/modal/crud.tsx b/packages/ui/certd-client/src/views/certd/notification/notification-selector/modal/crud.tsx
index 7bd22238d..3f27ca407 100644
--- a/packages/ui/certd-client/src/views/certd/notification/notification-selector/modal/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/notification/notification-selector/modal/crud.tsx
@@ -47,46 +47,46 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
pageRequest,
addRequest,
editRequest,
- delRequest
+ delRequest,
},
toolbar: {
- show: false
+ show: false,
},
search: {
- show: false
+ show: false,
},
form: {
labelCol: {
//固定label宽度
span: null,
style: {
- width: "145px"
- }
- }
+ width: "145px",
+ },
+ },
},
rowHandle: {
- width: 200
+ width: 200,
},
table: {
scroll: {
- x: 700
+ x: 700,
},
rowSelection: {
type: "radio",
selectedRowKeys: selectedRowKey,
- onChange: onSelectChange
+ onChange: onSelectChange,
},
customRow: (record: any) => {
return {
onClick: () => {
onSelectChange([record.id]);
- } // 点击行
+ }, // 点击行
};
- }
+ },
},
columns: {
- ...commonColumnsDefine
- }
- }
+ ...commonColumnsDefine,
+ },
+ },
};
}
diff --git a/packages/ui/certd-client/src/views/certd/notification/notification-selector/modal/index.vue b/packages/ui/certd-client/src/views/certd/notification/notification-selector/modal/index.vue
index 1a7a73a32..21012d050 100644
--- a/packages/ui/certd-client/src/views/certd/notification/notification-selector/modal/index.vue
+++ b/packages/ui/certd-client/src/views/certd/notification/notification-selector/modal/index.vue
@@ -13,7 +13,7 @@ import { createNotificationApi } from "../../api";
export default defineComponent({
name: "CertNotificationModal",
props: {
- modelValue: {}
+ modelValue: {},
},
emits: ["update:modelValue"],
setup(props, ctx) {
@@ -26,9 +26,9 @@ export default defineComponent({
return {
crudBinding,
- crudRef
+ crudRef,
};
- }
+ },
});
diff --git a/packages/ui/certd-client/src/views/certd/suite/api.ts b/packages/ui/certd-client/src/views/certd/suite/api.ts
index f972d3050..9b6d8cdec 100644
--- a/packages/ui/certd-client/src/views/certd/suite/api.ts
+++ b/packages/ui/certd-client/src/views/certd/suite/api.ts
@@ -16,8 +16,8 @@ export const durationDict = dict({
{ label: "8年", value: 2920 },
{ label: "9年", value: 3285 },
{ label: "10年", value: 3650 },
- { label: "永久", value: -1 }
- ]
+ { label: "永久", value: -1 },
+ ],
});
export type OrderModalOpenReq = {
@@ -29,7 +29,7 @@ export type OrderModalOpenReq = {
export async function ProductList() {
return await request({
url: "/suite/product/list",
- method: "POST"
+ method: "POST",
});
}
@@ -37,7 +37,7 @@ export async function ProductInfo(productId: number) {
return await request({
url: "/suite/product/info",
method: "POST",
- data: { id: productId }
+ data: { id: productId },
});
}
@@ -52,7 +52,7 @@ export async function TradeCreate(form: TradeCreateReq) {
return await request({
url: "/suite/trade/create",
method: "POST",
- data: form
+ data: form,
});
}
@@ -60,20 +60,20 @@ export async function TradeCreateFree(form: TradeCreateReq) {
return await request({
url: "/suite/trade/createFree",
method: "POST",
- data: form
+ data: form,
});
}
export async function GetPaymentTypes() {
return await request({
url: "/suite/trade/payments",
- method: "POST"
+ method: "POST",
});
}
export async function GetSuiteSetting() {
return await request({
url: "/suite/settings/get",
- method: "POST"
+ method: "POST",
});
}
diff --git a/packages/ui/certd-client/src/views/certd/suite/mine/api.ts b/packages/ui/certd-client/src/views/certd/suite/mine/api.ts
index d890d2ad9..f647164d9 100644
--- a/packages/ui/certd-client/src/views/certd/suite/mine/api.ts
+++ b/packages/ui/certd-client/src/views/certd/suite/mine/api.ts
@@ -21,7 +21,7 @@ export const mySuiteApi = {
return await request({
url: apiPrefix + "/page",
method: "post",
- data: query
+ data: query,
});
},
@@ -29,7 +29,7 @@ export const mySuiteApi = {
return await request({
url: apiPrefix + "/add",
method: "post",
- data: obj
+ data: obj,
});
},
@@ -37,7 +37,7 @@ export const mySuiteApi = {
return await request({
url: apiPrefix + "/update",
method: "post",
- data: obj
+ data: obj,
});
},
@@ -45,7 +45,7 @@ export const mySuiteApi = {
return await request({
url: apiPrefix + "/delete",
method: "post",
- params: { id }
+ params: { id },
});
},
@@ -53,19 +53,19 @@ export const mySuiteApi = {
return await request({
url: apiPrefix + "/info",
method: "post",
- params: { id }
+ params: { id },
});
},
async ListAll() {
return await request({
url: apiPrefix + "/all",
- method: "post"
+ method: "post",
});
},
async SuiteDetailGet() {
return await request({
url: `${apiPrefix}/detail`,
- method: "post"
+ method: "post",
});
- }
+ },
};
diff --git a/packages/ui/certd-client/src/views/certd/suite/mine/crud.tsx b/packages/ui/certd-client/src/views/certd/suite/mine/crud.tsx
index 295ff2fcb..1076630a7 100644
--- a/packages/ui/certd-client/src/views/certd/suite/mine/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/suite/mine/crud.tsx
@@ -7,310 +7,310 @@ import DurationValue from "/@/views/sys/suite/product/duration-value.vue";
import UserSuiteStatus from "/@/views/certd/suite/mine/user-suite-status.vue";
import dayjs from "dayjs";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const pageRequest = async (query: UserPageQuery): Promise => {
- return await api.GetList(query);
- };
- const editRequest = async (req: EditReq) => {
- const { form, row } = req;
- form.id = row.id;
- const res = await api.UpdateObj(form);
- return res;
- };
- const delRequest = async (req: DelReq) => {
- const { row } = req;
- return await api.DelObj(row.id);
- };
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ return await api.GetList(query);
+ };
+ const editRequest = async (req: EditReq) => {
+ const { form, row } = req;
+ form.id = row.id;
+ const res = await api.UpdateObj(form);
+ return res;
+ };
+ const delRequest = async (req: DelReq) => {
+ const { row } = req;
+ return await api.DelObj(row.id);
+ };
- const addRequest = async (req: AddReq) => {
- const { form } = req;
- const res = await api.AddObj(form);
- return res;
- };
+ const addRequest = async (req: AddReq) => {
+ const { form } = req;
+ const res = await api.AddObj(form);
+ return res;
+ };
- const router = useRouter();
+ const router = useRouter();
- return {
- crudOptions: {
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest
- },
- form: {
- labelCol: {
- //固定label宽度
- span: null,
- style: {
- width: "100px"
- }
- },
- col: {
- span: 22
- },
- wrapper: {
- width: 600
- }
- },
- actionbar: {
- buttons: {
- add: { show: false },
- buy: {
- text: "购买",
- type: "primary",
- click() {
- router.push({
- path: "/certd/suite/buy"
- });
- }
- }
- }
- },
- rowHandle: {
- width: 200,
- fixed: "right",
- buttons: {
- view: { show: false },
- copy: { show: false },
- edit: { show: false },
- remove: { show: false }
- // continue:{
- // text:"续期",
- // type:"link",
- // click(){
- // console.log("续期");
- // }
- // }
- }
- },
- columns: {
- id: {
- title: "ID",
- key: "id",
- type: "number",
- search: {
- show: false
- },
- column: {
- width: 100,
- editable: {
- disabled: true
- }
- },
- form: {
- show: false
- }
- },
- title: {
- title: "套餐名称",
- type: "text",
- search: {
- show: true
- },
- form: {
- rules: [{ required: true, message: "此项必填" }]
- },
- column: {
- width: 200
- }
- },
- productType: {
- title: "类型",
- type: "dict-select",
- editForm: {
- component: {
- disabled: true
- }
- },
- dict: dict({
- data: [
- { label: "套餐", value: "suite", color: "green" },
- { label: "加量包", value: "addon", color: "blue" }
- ]
- }),
- form: {
- rules: [{ required: true, message: "此项必填" }]
- },
- column: {
- width: 80,
- align: "center"
- },
- valueBuilder: ({ row }) => {
- if (row.content) {
- row.content = JSON.parse(row.content);
- }
- },
- valueResolve: ({ form }) => {
- if (form.content) {
- form.content = JSON.stringify(form.content);
- }
- }
- },
- "content.maxDomainCount": {
- title: "域名数量",
- type: "text",
- form: {
- key: ["content", "maxDomainCount"],
- component: {
- name: SuiteValueEdit,
- vModel: "modelValue",
- unit: "个"
- },
- rules: [{ required: true, message: "此项必填" }]
- },
- column: {
- width: 100,
- component: {
- name: SuiteValue,
- vModel: "modelValue",
- unit: "个"
- },
- align: "center"
- }
- },
- "content.maxPipelineCount": {
- title: "流水线数量",
- type: "text",
- form: {
- key: ["content", "maxPipelineCount"],
- component: {
- name: SuiteValueEdit,
- vModel: "modelValue",
- unit: "条"
- },
- rules: [{ required: true, message: "此项必填" }]
- },
- column: {
- width: 100,
- component: {
- name: SuiteValue,
- vModel: "modelValue",
- unit: "条"
- },
- align: "center"
- }
- },
- "content.maxDeployCount": {
- title: "部署次数",
- type: "text",
- form: {
- key: ["content", "maxDeployCount"],
- component: {
- name: SuiteValueEdit,
- vModel: "modelValue",
- unit: "次"
- },
- rules: [{ required: true, message: "此项必填" }]
- },
- column: {
- width: 100,
- component: {
- name: SuiteValue,
- vModel: "modelValue",
- unit: "次",
- used: compute(({ row }) => {
- return row.deployCountUsed;
- })
- },
- align: "center"
- }
- },
- "content.maxMonitorCount": {
- title: "证书监控数量",
- type: "text",
- form: {
- key: ["content", "maxMonitorCount"],
- component: {
- name: SuiteValueEdit,
- vModel: "modelValue",
- unit: "个"
- },
- rules: [{ required: true, message: "此项必填" }]
- },
- column: {
- width: 120,
- component: {
- name: SuiteValue,
- vModel: "modelValue",
- unit: "个"
- },
- align: "center"
- }
- },
- duration: {
- title: "时长",
- type: "text",
- form: {},
- column: {
- component: {
- name: DurationValue,
- vModel: "modelValue"
- },
- width: 100,
- align: "center"
- }
- },
- status: {
- title: "状态",
- type: "text",
- form: { show: false },
- column: {
- width: 100,
- align: "center",
- component: {
- name: UserSuiteStatus,
- userSuite: compute(({ row }) => {
- return row;
- }),
- currentSuite: context.currentSuite
- },
- conditionalRender: {
- match() {
- return false;
- }
- }
- }
- },
- activeTime: {
- title: "激活时间",
- type: "date",
- column: {
- width: 150
- }
- },
- expiresTime: {
- title: "过期时间",
- type: "date",
- column: {
- width: 150,
- component: {
- name: "expires-time-text",
- vModel: "value",
- mode: "tag",
- title: compute(({ value }) => {
- return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
- })
- }
- }
- },
- isPresent: {
- title: "是否赠送",
- type: "dict-switch",
- dict: dict({
- data: [
- { label: "是", value: true, color: "success" },
- { label: "否", value: false, color: "blue" }
- ]
- }),
- form: {
- value: true
- },
- column: {
- width: 100,
- align: "center"
- }
- }
- }
- }
- };
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ form: {
+ labelCol: {
+ //固定label宽度
+ span: null,
+ style: {
+ width: "100px",
+ },
+ },
+ col: {
+ span: 22,
+ },
+ wrapper: {
+ width: 600,
+ },
+ },
+ actionbar: {
+ buttons: {
+ add: { show: false },
+ buy: {
+ text: "购买",
+ type: "primary",
+ click() {
+ router.push({
+ path: "/certd/suite/buy",
+ });
+ },
+ },
+ },
+ },
+ rowHandle: {
+ width: 200,
+ fixed: "right",
+ buttons: {
+ view: { show: false },
+ copy: { show: false },
+ edit: { show: false },
+ remove: { show: false },
+ // continue:{
+ // text:"续期",
+ // type:"link",
+ // click(){
+ // console.log("续期");
+ // }
+ // }
+ },
+ },
+ columns: {
+ id: {
+ title: "ID",
+ key: "id",
+ type: "number",
+ search: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ editable: {
+ disabled: true,
+ },
+ },
+ form: {
+ show: false,
+ },
+ },
+ title: {
+ title: "套餐名称",
+ type: "text",
+ search: {
+ show: true,
+ },
+ form: {
+ rules: [{ required: true, message: "此项必填" }],
+ },
+ column: {
+ width: 200,
+ },
+ },
+ productType: {
+ title: "类型",
+ type: "dict-select",
+ editForm: {
+ component: {
+ disabled: true,
+ },
+ },
+ dict: dict({
+ data: [
+ { label: "套餐", value: "suite", color: "green" },
+ { label: "加量包", value: "addon", color: "blue" },
+ ],
+ }),
+ form: {
+ rules: [{ required: true, message: "此项必填" }],
+ },
+ column: {
+ width: 80,
+ align: "center",
+ },
+ valueBuilder: ({ row }) => {
+ if (row.content) {
+ row.content = JSON.parse(row.content);
+ }
+ },
+ valueResolve: ({ form }) => {
+ if (form.content) {
+ form.content = JSON.stringify(form.content);
+ }
+ },
+ },
+ "content.maxDomainCount": {
+ title: "域名数量",
+ type: "text",
+ form: {
+ key: ["content", "maxDomainCount"],
+ component: {
+ name: SuiteValueEdit,
+ vModel: "modelValue",
+ unit: "个",
+ },
+ rules: [{ required: true, message: "此项必填" }],
+ },
+ column: {
+ width: 100,
+ component: {
+ name: SuiteValue,
+ vModel: "modelValue",
+ unit: "个",
+ },
+ align: "center",
+ },
+ },
+ "content.maxPipelineCount": {
+ title: "流水线数量",
+ type: "text",
+ form: {
+ key: ["content", "maxPipelineCount"],
+ component: {
+ name: SuiteValueEdit,
+ vModel: "modelValue",
+ unit: "条",
+ },
+ rules: [{ required: true, message: "此项必填" }],
+ },
+ column: {
+ width: 100,
+ component: {
+ name: SuiteValue,
+ vModel: "modelValue",
+ unit: "条",
+ },
+ align: "center",
+ },
+ },
+ "content.maxDeployCount": {
+ title: "部署次数",
+ type: "text",
+ form: {
+ key: ["content", "maxDeployCount"],
+ component: {
+ name: SuiteValueEdit,
+ vModel: "modelValue",
+ unit: "次",
+ },
+ rules: [{ required: true, message: "此项必填" }],
+ },
+ column: {
+ width: 100,
+ component: {
+ name: SuiteValue,
+ vModel: "modelValue",
+ unit: "次",
+ used: compute(({ row }) => {
+ return row.deployCountUsed;
+ }),
+ },
+ align: "center",
+ },
+ },
+ "content.maxMonitorCount": {
+ title: "证书监控数量",
+ type: "text",
+ form: {
+ key: ["content", "maxMonitorCount"],
+ component: {
+ name: SuiteValueEdit,
+ vModel: "modelValue",
+ unit: "个",
+ },
+ rules: [{ required: true, message: "此项必填" }],
+ },
+ column: {
+ width: 120,
+ component: {
+ name: SuiteValue,
+ vModel: "modelValue",
+ unit: "个",
+ },
+ align: "center",
+ },
+ },
+ duration: {
+ title: "时长",
+ type: "text",
+ form: {},
+ column: {
+ component: {
+ name: DurationValue,
+ vModel: "modelValue",
+ },
+ width: 100,
+ align: "center",
+ },
+ },
+ status: {
+ title: "状态",
+ type: "text",
+ form: { show: false },
+ column: {
+ width: 100,
+ align: "center",
+ component: {
+ name: UserSuiteStatus,
+ userSuite: compute(({ row }) => {
+ return row;
+ }),
+ currentSuite: context.currentSuite,
+ },
+ conditionalRender: {
+ match() {
+ return false;
+ },
+ },
+ },
+ },
+ activeTime: {
+ title: "激活时间",
+ type: "date",
+ column: {
+ width: 150,
+ },
+ },
+ expiresTime: {
+ title: "过期时间",
+ type: "date",
+ column: {
+ width: 150,
+ component: {
+ name: "expires-time-text",
+ vModel: "value",
+ mode: "tag",
+ title: compute(({ value }) => {
+ return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
+ }),
+ },
+ },
+ },
+ isPresent: {
+ title: "是否赠送",
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: "是", value: true, color: "success" },
+ { label: "否", value: false, color: "blue" },
+ ],
+ }),
+ form: {
+ value: true,
+ },
+ column: {
+ width: 100,
+ align: "center",
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/certd/suite/mine/index.vue b/packages/ui/certd-client/src/views/certd/suite/mine/index.vue
index 1f9258216..8b11383c4 100644
--- a/packages/ui/certd-client/src/views/certd/suite/mine/index.vue
+++ b/packages/ui/certd-client/src/views/certd/suite/mine/index.vue
@@ -22,7 +22,7 @@ import { mySuiteApi, SuiteDetail } from "/@/views/certd/suite/mine/api";
import SuiteCard from "/@/views/framework/home/dashboard/suite-card.vue";
defineOptions({
- name: "MySuites"
+ name: "MySuites",
});
const detail = ref({});
const currentSuite = computed(() => {
diff --git a/packages/ui/certd-client/src/views/certd/suite/mine/user-suite-status.vue b/packages/ui/certd-client/src/views/certd/suite/mine/user-suite-status.vue
index 07432fd6e..0dcf4f5c2 100644
--- a/packages/ui/certd-client/src/views/certd/suite/mine/user-suite-status.vue
+++ b/packages/ui/certd-client/src/views/certd/suite/mine/user-suite-status.vue
@@ -7,7 +7,7 @@ import { ref, computed } from "vue";
import dayjs from "dayjs";
defineOptions({
- name: "UserSuiteStatus"
+ name: "UserSuiteStatus",
});
const props = defineProps<{
diff --git a/packages/ui/certd-client/src/views/certd/suite/order-modal.vue b/packages/ui/certd-client/src/views/certd/suite/order-modal.vue
index 7f4748475..e695d62c8 100644
--- a/packages/ui/certd-client/src/views/certd/suite/order-modal.vue
+++ b/packages/ui/certd-client/src/views/certd/suite/order-modal.vue
@@ -2,45 +2,38 @@
- {{$t('order.package')}}:{{ product.title }}
+ {{ $t("order.package") }}:{{ product.title }}
- {{$t('order.description')}}:{{ product.intro }}
+ {{ $t("order.description") }}:{{ product.intro }}
- {{$t('order.specifications')}}:
+ {{ $t("order.specifications") }}:
-
- {{$t('order.pipeline')}};
-
-
- {{$t('order.domain')}};
-
-
- {{$t('order.deployTimes')}};
-
+ {{ $t("order.pipeline") }};
+ {{ $t("order.domain") }};
+ {{ $t("order.deployTimes") }};
- {{$t('order.duration')}}:
+ {{ $t("order.duration") }}:
-
{{$t('order.price')}}:
+
{{ $t("order.price") }}:
-
{{$t('order.paymentMethod')}}:
-
{{$t('order.free')}}
+
{{ $t("order.paymentMethod") }}:
+
{{ $t("order.free") }}
-
diff --git a/packages/ui/certd-client/src/views/framework/error/404.vue b/packages/ui/certd-client/src/views/framework/error/404.vue
index dd8fb4d4a..a522dc5fb 100644
--- a/packages/ui/certd-client/src/views/framework/error/404.vue
+++ b/packages/ui/certd-client/src/views/framework/error/404.vue
@@ -13,7 +13,7 @@ export default {
methods: {
toHome() {
this.$router.push({ path: "/" });
- }
- }
+ },
+ },
};
diff --git a/packages/ui/certd-client/src/views/framework/home/dashboard/charts/day-count.vue b/packages/ui/certd-client/src/views/framework/home/dashboard/charts/day-count.vue
index 9e1102705..1266ed906 100644
--- a/packages/ui/certd-client/src/views/framework/home/dashboard/charts/day-count.vue
+++ b/packages/ui/certd-client/src/views/framework/home/dashboard/charts/day-count.vue
@@ -23,17 +23,17 @@ const props = withDefaults(
{
data: () => {
return [];
- }
+ },
}
);
const dates = computed(() => {
- return props.data.map((item) => {
+ return props.data.map(item => {
return item.name;
});
});
const counts = computed(() => {
- return props.data.map((item) => {
+ return props.data.map(item => {
return item.value;
});
});
@@ -43,15 +43,15 @@ const option = ref({
show: props.data.length === 0, // 没数据才显示
extStyle: {
color: "grey",
- fontSize: 20
+ fontSize: 20,
},
text: "暂无数据",
left: "center",
- top: "center"
+ top: "center",
},
tooltip: {
- trigger: "item"
+ trigger: "item",
},
// tooltip: {
// trigger: "axis",
@@ -70,19 +70,19 @@ const option = ref({
left: "20px",
right: "20px",
bottom: "10px",
- containLabel: true
+ containLabel: true,
},
xAxis: [
{
type: "category",
boundaryGap: false,
- data: dates
- }
+ data: dates,
+ },
],
yAxis: [
{
- type: "value"
- }
+ type: "value",
+ },
],
series: [
{
@@ -91,16 +91,16 @@ const option = ref({
stack: "Total",
label: {
show: true,
- position: "top"
+ position: "top",
},
smooth: true,
areaStyle: {},
emphasis: {
- focus: "series"
+ focus: "series",
},
- data: counts
- }
- ]
+ data: counts,
+ },
+ ],
});
diff --git a/packages/ui/certd-client/src/views/framework/home/dashboard/charts/pie-count.vue b/packages/ui/certd-client/src/views/framework/home/dashboard/charts/pie-count.vue
index a7b30ebde..9a508dc22 100644
--- a/packages/ui/certd-client/src/views/framework/home/dashboard/charts/pie-count.vue
+++ b/packages/ui/certd-client/src/views/framework/home/dashboard/charts/pie-count.vue
@@ -22,19 +22,19 @@ const props = defineProps<{
const option = ref({
color: ["#91cc75", "#73c0de", "#ee6666", "#fac858", "#5470c6", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc", "#5470c6"],
tooltip: {
- trigger: "item"
+ trigger: "item",
},
legend: {
orient: "vertical",
bottom: "5%",
- left: "left"
+ left: "left",
},
grid: {
top: "20px",
left: "20px",
right: "20px",
bottom: "10px",
- containLabel: true
+ containLabel: true,
},
series: [
{
@@ -46,25 +46,25 @@ const option = ref({
itemStyle: {
borderRadius: 0,
borderColor: "#fff",
- borderWidth: 1
+ borderWidth: 1,
},
label: {
show: false,
- position: "center"
+ position: "center",
},
emphasis: {
label: {
show: false,
fontSize: 18,
- fontWeight: "bold"
- }
+ fontWeight: "bold",
+ },
},
labelLine: {
- show: false
+ show: false,
},
- data: props.data
- }
- ]
+ data: props.data,
+ },
+ ],
});
diff --git a/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue b/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue
index 4836789f6..8ee7455e7 100644
--- a/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue
+++ b/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue
@@ -11,14 +11,12 @@
- {{ t('certd.dashboard.greeting', { name: userInfo.nickName || userInfo.username, site: siteInfo.title }) }}
+ {{ t("certd.dashboard.greeting", { name: userInfo.nickName || userInfo.username, site: siteInfo.title }) }}
-
- {{ now }}
-
+ {{ now }}
@@ -50,7 +48,7 @@
- {{ t('certd.dashboard.tutorialText') }}
+ {{ t("certd.dashboard.tutorialText") }}
@@ -61,10 +59,9 @@
@@ -75,14 +72,12 @@
-
{{ t('certd.dashboard.noPipeline') }}
-
{{ t('certd.dashboard.createNow') }}
+
{{ t("certd.dashboard.noPipeline") }}
+
{{ t("certd.dashboard.createNow") }}
-
- {{ t('certd.dashboard.managePipeline') }}
-
+ {{ t("certd.dashboard.managePipeline") }}
@@ -107,7 +102,7 @@
- {{ t('certd.dashboard.supportedTasks') }}
+ {{ t("certd.dashboard.supportedTasks") }}
{{ pluginGroups.groups.all.plugins.length }}
@@ -136,7 +131,6 @@
-
diff --git a/packages/ui/certd-client/src/views/framework/home/index.vue b/packages/ui/certd-client/src/views/framework/home/index.vue
index c1e91ebac..62ef75812 100644
--- a/packages/ui/certd-client/src/views/framework/home/index.vue
+++ b/packages/ui/certd-client/src/views/framework/home/index.vue
@@ -2,10 +2,7 @@
-
+
diff --git a/packages/ui/certd-client/src/views/framework/register/index.vue b/packages/ui/certd-client/src/views/framework/register/index.vue
index 2aacb9a38..030f899b0 100644
--- a/packages/ui/certd-client/src/views/framework/register/index.vue
+++ b/packages/ui/certd-client/src/views/framework/register/index.vue
@@ -1,16 +1,6 @@
-
+
@@ -104,7 +94,7 @@ export default defineComponent({
if (!settingsStore.sysPublic.usernameRegisterEnabled) {
registerType.value = "";
notification.error({
- message: "没有启用任何一种注册方式"
+ message: "没有启用任何一种注册方式",
});
}
}
@@ -117,7 +107,7 @@ export default defineComponent({
username: "",
password: "",
confirmPassword: "",
- randomStr: ""
+ randomStr: "",
});
const rules = {
@@ -125,32 +115,32 @@ export default defineComponent({
{
required: true,
trigger: "change",
- message: "请输入用户名"
- }
+ message: "请输入用户名",
+ },
],
email: [
{
required: true,
trigger: "change",
- message: "请输入邮箱"
+ message: "请输入邮箱",
},
{
type: "email",
- message: "请输入正确的邮箱"
- }
+ message: "请输入正确的邮箱",
+ },
],
password: [
{
required: true,
trigger: "change",
- message: "请输入密码"
- }
+ message: "请输入密码",
+ },
],
confirmPassword: [
{
required: true,
trigger: "change",
- message: "请确认密码"
+ message: "请确认密码",
},
{
validator: async (rule: any, value: any) => {
@@ -158,41 +148,41 @@ export default defineComponent({
throw new Error("两次输入密码不一致");
}
return true;
- }
- }
+ },
+ },
],
imgCode: [
{
required: true,
- message: "请输入图片验证码"
+ message: "请输入图片验证码",
},
{
min: 4,
max: 4,
- message: "请输入4位图片验证码"
- }
+ message: "请输入4位图片验证码",
+ },
],
smsCode: [
{
required: true,
- message: "请输入短信验证码"
- }
+ message: "请输入短信验证码",
+ },
],
validateCode: [
{
required: true,
- message: "请输入邮件验证码"
- }
- ]
+ message: "请输入邮件验证码",
+ },
+ ],
};
const layout = {
labelCol: {
- span: 0
+ span: 0,
},
wrapperCol: {
- span: 24
- }
+ span: 24,
+ },
};
const handleFinish = async (values: any) => {
@@ -204,7 +194,7 @@ export default defineComponent({
imgCode: formState.imgCode,
randomStr: formState.randomStr,
email: formState.email,
- validateCode: formState.validateCode
+ validateCode: formState.validateCode,
}) as any
);
};
@@ -235,9 +225,9 @@ export default defineComponent({
handleFinish,
resetForm,
registerType,
- settingsStore
+ settingsStore,
};
- }
+ },
});
diff --git a/packages/ui/certd-client/src/views/sys/account/api.ts b/packages/ui/certd-client/src/views/sys/account/api.ts
index 0ce5df7ef..c237aacfe 100644
--- a/packages/ui/certd-client/src/views/sys/account/api.ts
+++ b/packages/ui/certd-client/src/views/sys/account/api.ts
@@ -4,7 +4,7 @@ export async function PreBindUser(userId: number) {
await request({
url: "/sys/account/preBindUser",
method: "post",
- data: { userId }
+ data: { userId },
});
}
@@ -12,7 +12,7 @@ export async function BindUser(userId: number) {
await request({
url: "/sys/account/bindUser",
method: "post",
- data: { userId }
+ data: { userId },
});
}
@@ -20,7 +20,7 @@ export async function UnbindUser(userId: number) {
await request({
url: "/sys/account/unbindUser",
method: "post",
- data: { userId }
+ data: { userId },
});
}
@@ -28,6 +28,6 @@ export async function UpdateLicense(data: any) {
await request({
url: "/sys/account/updateLicense",
method: "post",
- data
+ data,
});
}
diff --git a/packages/ui/certd-client/src/views/sys/authority/permission/api.ts b/packages/ui/certd-client/src/views/sys/authority/permission/api.ts
index 672e0b38b..c5ddec8c3 100644
--- a/packages/ui/certd-client/src/views/sys/authority/permission/api.ts
+++ b/packages/ui/certd-client/src/views/sys/authority/permission/api.ts
@@ -4,14 +4,14 @@ export async function GetList(query: any) {
return await request({
url: apiPrefix + "/page",
method: "post",
- data: query
+ data: query,
});
}
export async function GetTree() {
return await request({
url: apiPrefix + "/tree",
- method: "post"
+ method: "post",
});
}
@@ -19,7 +19,7 @@ export async function AddObj(obj: any) {
return await request({
url: apiPrefix + "/add",
method: "post",
- data: obj
+ data: obj,
});
}
@@ -27,7 +27,7 @@ export async function UpdateObj(obj: any) {
return await request({
url: apiPrefix + "/update",
method: "post",
- data: obj
+ data: obj,
});
}
@@ -35,7 +35,7 @@ export async function DelObj(id: any) {
return await request({
url: apiPrefix + "/delete",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -43,6 +43,6 @@ export async function GetObj(id: any) {
return await request({
url: apiPrefix + "/info",
method: "post",
- params: { id }
+ params: { id },
});
}
diff --git a/packages/ui/certd-client/src/views/sys/authority/permission/crud.tsx b/packages/ui/certd-client/src/views/sys/authority/permission/crud.tsx
index e6ae51270..cf05191fa 100644
--- a/packages/ui/certd-client/src/views/sys/authority/permission/crud.tsx
+++ b/packages/ui/certd-client/src/views/sys/authority/permission/crud.tsx
@@ -3,150 +3,149 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
import { useI18n } from "vue-i18n";
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const { t } = useI18n();
- const pageRequest = async (query: UserPageQuery): Promise => {
- const list = await api.GetTree();
+ const { t } = useI18n();
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ const list = await api.GetTree();
- return {
- offset: 0,
- records: list,
- total: 10000,
- limit: 10000
- };
- };
+ return {
+ offset: 0,
+ records: list,
+ total: 10000,
+ limit: 10000,
+ };
+ };
- async function afterChange() {
- await permissionTreeDict.reloadDict();
- }
- const editRequest = async ({ form, row }: EditReq) => {
- form.id = row.id;
- const ret = await api.UpdateObj(form);
- await afterChange();
- return ret;
- };
- const delRequest = async ({ row }: DelReq) => {
- const ret = await api.DelObj(row.id);
- await afterChange();
- return ret;
- };
+ async function afterChange() {
+ await permissionTreeDict.reloadDict();
+ }
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ const ret = await api.UpdateObj(form);
+ await afterChange();
+ return ret;
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ const ret = await api.DelObj(row.id);
+ await afterChange();
+ return ret;
+ };
- const addRequest = async ({ form }: AddReq) => {
- const ret = await api.AddObj(form);
- await afterChange();
- return ret;
- };
- const permissionTreeDict = dict({
- url: "/sys/authority/permission/tree",
- isTree: true,
- value: "id",
- label: "title",
- async onReady({ dict }: any) {
- dict.setData([{ id: -1, title: t("certd.rootNode"), children: dict.data }]);
- }
- });
- return {
- crudOptions: {
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest
- },
- actionbar: {
- show: false
- },
- toolbar: {
- show: false
- },
- table: {
- show: false
- // scroll: { fixed: true }
- },
- rowHandle: {
- fixed: "right"
- },
- search: {
- show: false
- },
- pagination: {
- show: false,
- pageSize: 100000
- },
- columns: {
- id: {
- title: "id",
- type: "number",
- form: { show: false }, // 表单配置
- column: {
- width: 120,
- sortable: "custom"
- }
- },
- title: {
- title: t("certd.permissionName"),
- type: "text",
- form: {
- rules: [
- { required: true, message: t("certd.enterPermissionName") },
- { max: 50, message: t("certd.max50Chars") }
- ],
- component: {
- placeholder: t("certd.permissionName")
- }
- },
- column: {
- width: 200
- }
- },
- permission: {
- title: t("certd.permissionCode"),
- type: "text",
- column: {
- width: 170
- },
- form: {
- rules: [
- { required: true, message: t("certd.enterPermissionCode") },
- { max: 100, message: t("certd.max100Chars") }
- ],
- component: {
- placeholder: t("certd.examplePermissionCode")
- }
- }
- },
- sort: {
- title: t("certd.sortOrder"),
- type: "number",
- column: {
- width: 100
- },
- form: {
- value: 100,
- rules: [{ required: true, type: "number", message: t("certd.sortRequired") }]
- }
- },
- parentId: {
- title: t("certd.parentNode"),
- type: "dict-tree",
- column: {
- width: 100
- },
- dict: permissionTreeDict,
- form: {
- value: -1,
- component: {
- multiple: false,
- defaultExpandAll: true,
- dict: { cache: false },
- fieldNames: {
- value: "id",
- label: "title"
- }
- }
- }
- }
-
- }
- }
- };
+ const addRequest = async ({ form }: AddReq) => {
+ const ret = await api.AddObj(form);
+ await afterChange();
+ return ret;
+ };
+ const permissionTreeDict = dict({
+ url: "/sys/authority/permission/tree",
+ isTree: true,
+ value: "id",
+ label: "title",
+ async onReady({ dict }: any) {
+ dict.setData([{ id: -1, title: t("certd.rootNode"), children: dict.data }]);
+ },
+ });
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ actionbar: {
+ show: false,
+ },
+ toolbar: {
+ show: false,
+ },
+ table: {
+ show: false,
+ // scroll: { fixed: true }
+ },
+ rowHandle: {
+ fixed: "right",
+ },
+ search: {
+ show: false,
+ },
+ pagination: {
+ show: false,
+ pageSize: 100000,
+ },
+ columns: {
+ id: {
+ title: "id",
+ type: "number",
+ form: { show: false }, // 表单配置
+ column: {
+ width: 120,
+ sortable: "custom",
+ },
+ },
+ title: {
+ title: t("certd.permissionName"),
+ type: "text",
+ form: {
+ rules: [
+ { required: true, message: t("certd.enterPermissionName") },
+ { max: 50, message: t("certd.max50Chars") },
+ ],
+ component: {
+ placeholder: t("certd.permissionName"),
+ },
+ },
+ column: {
+ width: 200,
+ },
+ },
+ permission: {
+ title: t("certd.permissionCode"),
+ type: "text",
+ column: {
+ width: 170,
+ },
+ form: {
+ rules: [
+ { required: true, message: t("certd.enterPermissionCode") },
+ { max: 100, message: t("certd.max100Chars") },
+ ],
+ component: {
+ placeholder: t("certd.examplePermissionCode"),
+ },
+ },
+ },
+ sort: {
+ title: t("certd.sortOrder"),
+ type: "number",
+ column: {
+ width: 100,
+ },
+ form: {
+ value: 100,
+ rules: [{ required: true, type: "number", message: t("certd.sortRequired") }],
+ },
+ },
+ parentId: {
+ title: t("certd.parentNode"),
+ type: "dict-tree",
+ column: {
+ width: 100,
+ },
+ dict: permissionTreeDict,
+ form: {
+ value: -1,
+ component: {
+ multiple: false,
+ defaultExpandAll: true,
+ dict: { cache: false },
+ fieldNames: {
+ value: "id",
+ label: "title",
+ },
+ },
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/sys/authority/permission/fs-permission-tree.vue b/packages/ui/certd-client/src/views/sys/authority/permission/fs-permission-tree.vue
index 207319bf0..08c17beaf 100644
--- a/packages/ui/certd-client/src/views/sys/authority/permission/fs-permission-tree.vue
+++ b/packages/ui/certd-client/src/views/sys/authority/permission/fs-permission-tree.vue
@@ -1,20 +1,27 @@
-
-
-
-
{{ scope.title }}
-
-
-
-
-
-
-
-
+
+
+
+
{{ scope.title }}
+
+
+
+
+
+
+
+
diff --git a/packages/ui/certd-client/src/views/sys/authority/permission/index.vue b/packages/ui/certd-client/src/views/sys/authority/permission/index.vue
index 1d5be5719..ef3516fd6 100644
--- a/packages/ui/certd-client/src/views/sys/authority/permission/index.vue
+++ b/packages/ui/certd-client/src/views/sys/authority/permission/index.vue
@@ -1,20 +1,18 @@
-
-
- {{ t("certd.permissionManagement") }}
-
-
-
-
- {{ t("certd.adda") }}
-
-
-
-
+
+
+ {{ t("certd.permissionManagement") }}
+
+
+
+
+ {{ t("certd.adda") }}
+
+
+
+
-
diff --git a/packages/ui/certd-client/src/views/sys/authority/role/api.ts b/packages/ui/certd-client/src/views/sys/authority/role/api.ts
index 7d76ac5aa..652220702 100644
--- a/packages/ui/certd-client/src/views/sys/authority/role/api.ts
+++ b/packages/ui/certd-client/src/views/sys/authority/role/api.ts
@@ -4,7 +4,7 @@ export async function GetList(query: any) {
return await request({
url: apiPrefix + "/page",
method: "post",
- data: query
+ data: query,
});
}
@@ -12,7 +12,7 @@ export async function AddObj(obj: any) {
return await request({
url: apiPrefix + "/add",
method: "post",
- data: obj
+ data: obj,
});
}
@@ -20,7 +20,7 @@ export async function UpdateObj(obj: any) {
return await request({
url: apiPrefix + "/update",
method: "post",
- data: obj
+ data: obj,
});
}
@@ -28,7 +28,7 @@ export async function DelObj(id: any) {
return await request({
url: apiPrefix + "/delete",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -36,7 +36,7 @@ export async function GetObj(id: any) {
return await request({
url: apiPrefix + "/info",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -50,7 +50,7 @@ export async function getPermissionIds(roleId: any) {
return await request({
url: apiPrefix + "/getPermissionIds",
method: "post",
- params: { id: roleId }
+ params: { id: roleId },
});
}
@@ -65,6 +65,6 @@ export async function DoAuthz(roleId: any, permissionIds: any) {
return await request({
url: apiPrefix + "/authz",
method: "post",
- data: { roleId, permissionIds }
+ data: { roleId, permissionIds },
});
}
diff --git a/packages/ui/certd-client/src/views/sys/authority/role/crud.tsx b/packages/ui/certd-client/src/views/sys/authority/role/crud.tsx
index 22535080b..2c2335235 100644
--- a/packages/ui/certd-client/src/views/sys/authority/role/crud.tsx
+++ b/packages/ui/certd-client/src/views/sys/authority/role/crud.tsx
@@ -3,84 +3,84 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq,
import { useI18n } from "vue-i18n";
export default function ({ crudExpose, context: { authz } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const { t } = useI18n();
- const pageRequest = async (query: UserPageQuery): Promise => {
- return await api.GetList(query);
- };
- const editRequest = async ({ form, row }: EditReq) => {
- form.id = row.id;
- return await api.UpdateObj(form);
- };
- const delRequest = async ({ row }: DelReq) => {
- return await api.DelObj(row.id);
- };
+ const { t } = useI18n();
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ return await api.GetList(query);
+ };
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ return await api.UpdateObj(form);
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ return await api.DelObj(row.id);
+ };
- const addRequest = async ({ form }: AddReq) => {
- return await api.AddObj(form);
- };
- return {
- crudOptions: {
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest
- },
- rowHandle: {
- width: 300,
- buttons: {
- authz: {
- type: "link",
- text: "授权",
- async click(context) {
- await authz.authzOpen(context.record.id);
- }
- }
- }
- },
- columns: {
- id: {
- title: "id",
- type: "text",
- form: { show: false }, // 表单配置
- column: {
- width: 70,
- sorter: true
- }
- },
- name: {
- title: t("certd.roleName"),
- type: "text",
- search: { show: true },
- form: {
- rules: [
- { required: true, message: t("certd.enterRoleName") },
- { max: 50, message: t("certd.max50Chars") }
- ]
- }, // 表单配置
- column: {
- sorter: true
- }
- },
- createTime: {
- title: t("certd.createTime"),
- type: "datetime",
- column: {
- sorter: true
- },
- form: {
- show: false
- }
- },
- updateTime: {
- title: t("certd.updateTime"),
- type: "datetime",
- column: {
- sorter: true
- },
- form: { show: false } // 表单配置
- }
- }
- }
- };
+ const addRequest = async ({ form }: AddReq) => {
+ return await api.AddObj(form);
+ };
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ rowHandle: {
+ width: 300,
+ buttons: {
+ authz: {
+ type: "link",
+ text: "授权",
+ async click(context) {
+ await authz.authzOpen(context.record.id);
+ },
+ },
+ },
+ },
+ columns: {
+ id: {
+ title: "id",
+ type: "text",
+ form: { show: false }, // 表单配置
+ column: {
+ width: 70,
+ sorter: true,
+ },
+ },
+ name: {
+ title: t("certd.roleName"),
+ type: "text",
+ search: { show: true },
+ form: {
+ rules: [
+ { required: true, message: t("certd.enterRoleName") },
+ { max: 50, message: t("certd.max50Chars") },
+ ],
+ }, // 表单配置
+ column: {
+ sorter: true,
+ },
+ },
+ createTime: {
+ title: t("certd.createTime"),
+ type: "datetime",
+ column: {
+ sorter: true,
+ },
+ form: {
+ show: false,
+ },
+ },
+ updateTime: {
+ title: t("certd.updateTime"),
+ type: "datetime",
+ column: {
+ sorter: true,
+ },
+ form: { show: false }, // 表单配置
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/sys/authority/role/index.vue b/packages/ui/certd-client/src/views/sys/authority/role/index.vue
index 4b8682958..21ea62634 100644
--- a/packages/ui/certd-client/src/views/sys/authority/role/index.vue
+++ b/packages/ui/certd-client/src/views/sys/authority/role/index.vue
@@ -1,18 +1,15 @@
-
-
- {{ t("certd.roleManagement") }}
-
-
-
-
-
-
+
+
+ {{ t("certd.roleManagement") }}
+
+
+
+
+
+
-
diff --git a/packages/ui/certd-client/src/views/sys/authority/user/crud.tsx b/packages/ui/certd-client/src/views/sys/authority/user/crud.tsx
index 0bc8ff66e..7b0f6cd51 100644
--- a/packages/ui/certd-client/src/views/sys/authority/user/crud.tsx
+++ b/packages/ui/certd-client/src/views/sys/authority/user/crud.tsx
@@ -6,282 +6,281 @@ import dayjs from "dayjs";
import { useSettingStore } from "/@/store/settings";
import { useI18n } from "vue-i18n";
-
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const { t } = useI18n();
- const pageRequest = async (query: UserPageQuery): Promise => {
- return await api.GetList(query);
- };
- const editRequest = async ({ form, row }: EditReq) => {
- form.id = row.id;
- return await api.UpdateObj(form);
- };
- const delRequest = async ({ row }: DelReq) => {
- return await api.DelObj(row.id);
- };
+ const { t } = useI18n();
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ return await api.GetList(query);
+ };
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ return await api.UpdateObj(form);
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ return await api.DelObj(row.id);
+ };
- const addRequest = async ({ form }: AddReq) => {
- return await api.AddObj(form);
- };
+ const addRequest = async ({ form }: AddReq) => {
+ return await api.AddObj(form);
+ };
- const userStore = useUserStore();
+ const userStore = useUserStore();
- const settingStore = useSettingStore();
- const userValidTimeEnabled = compute(() => {
- return settingStore.sysPublic.userValidTimeEnabled === true;
- });
- return {
- crudOptions: {
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest,
- },
- rowHandle: {
- fixed: "right",
- buttons: {
- unlock: {
- title: t("certd.unlockLogin"),
- text: null,
- type: "link",
- icon: "ion:lock-open-outline",
- click: async ({ row }) => {
- Modal.confirm({
- title: t("certd.notice"),
- content: t("certd.confirmUnlock"),
- onOk: async () => {
- await api.Unlock(row.id);
- notification.success({
- message: t("certd.unlockSuccess"),
- });
- },
- });
- },
- },
- },
- },
- table: {
- scroll: {
- //使用固定列时需要设置此值,并且大于等于列宽度之和的值
- x: 1400,
- },
- },
- columns: {
- id: {
- title: "id",
- type: "text",
- form: { show: false }, // 表单配置
- column: {
- width: 100,
- sorter: true,
- },
- },
- createTime: {
- title: t("certd.createTime"),
- type: "datetime",
- form: { show: false }, // 表单配置
- column: {
- width: 180,
- sorter: true,
- },
- },
- // updateTime: {
- // title: "修改时间",
- // type: "datetime",
- // form: { show: false }, // 表单配置
- // column: {
- // sortable: "update_time",
- // width: 180
- // }
- // },
- username: {
- title: t("certd.username"),
- type: "text",
- search: { show: true }, // 开启查询
- form: {
- rules: [
- { required: true, message: t("certd.enterUsername") },
- { max: 50, message: t("certd.max50Chars") },
- ],
- },
- editForm: { component: { disabled: false } },
- column: {
- sorter: true,
- width: 200,
- },
- },
- password: {
- title: t("certd.password"),
- type: "text",
- key: "password",
- column: {
- show: false,
- },
- form: {
- rules: [{ max: 50, message: t("certd.max50Chars") }],
- component: {
- showPassword: true,
- },
- helper: t("certd.modifyPasswordIfFilled"),
- },
- },
- nickName: {
- title: t("certd.nickName"),
- type: "text",
- search: { show: true }, // 开启查询
- form: {
- rules: [{ max: 50, message: t("certd.max50Chars") }],
- },
- column: {
- sorter: true,
- },
- },
- email: {
- title: t("certd.emaila"),
- type: "text",
- search: { show: true }, // 开启查询
- form: {
- rules: [{ max: 50, message: t("certd.max50Chars") }],
- },
- column: {
- sorter: true,
- width: 160,
- },
- },
- mobile: {
- title: t("certd.mobile"),
- type: "text",
- search: { show: true }, // 开启查询
- form: {
- rules: [{ max: 50, message: t("certd.max50Chars") }],
- },
- column: {
- sorter: true,
- width: 130,
- },
- },
- avatar: {
- title: t("certd.avatar"),
- type: "cropper-uploader",
- column: {
- width: 70,
- component: {
- style: {
- height: "30px",
- width: "auto",
- },
- buildUrl(key: string) {
- return `api/basic/file/download?&key=` + key;
- },
- },
- },
- form: {
- component: {
- vModel: "modelValue",
- valueType: "key",
- cropper: {
- aspectRatio: 1,
- autoCropArea: 1,
- viewMode: 0,
- },
- onReady: null,
- uploader: {
- type: "form",
- action: "/basic/file/upload",
- name: "file",
- headers: {
- Authorization: "Bearer " + userStore.getToken,
- },
- successHandle(res: any) {
- return res;
- },
- },
- buildUrl(key: string) {
- return `api/basic/file/download?&key=` + key;
- },
- },
- },
- },
- status: {
- title: t("certd.status"),
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("certd.enabled"), value: 1, color: "green" },
- { label: t("certd.disabled"), value: 0, color: "red" },
- ],
- }),
- column: {
- align: "center",
- sorter: true,
- width: 100,
- },
- },
- validTime: {
- title: t("certd.validTime"),
- type: "date",
- form: {
- show: userValidTimeEnabled,
- },
- column: {
- align: "center",
- sorter: true,
- width: 100,
- show: userValidTimeEnabled,
- cellRender({ value }) {
- if (value == null || value === 0) {
- return "";
- }
- if (value < dayjs().valueOf()) {
- return {t("certd.expired")};
- }
- const date = dayjs(value).format("YYYY-MM-DD");
- return (
-
-
-
- );
- },
- },
- valueBuilder({ value, row, key }) {
- if (value != null) {
- row[key] = dayjs(value);
- }
- },
- valueResolve({ value, row, key }) {
- if (value != null) {
- row[key] = value.valueOf();
- }
- },
- },
- remark: {
- title: t("certd.remark"),
- type: "text",
- column: {
- sorter: true,
- },
- form: {
- rules: [{ max: 100, message: t("certd.max100Chars") }],
- },
- },
- roles: {
- title: t("certd.roles"),
- type: "dict-select",
- dict: dict({
- url: "/sys/authority/role/list",
- value: "id",
- label: "name",
- }), // 数据字典
- form: {
- component: { mode: "multiple" },
- },
- column: {
- width: 250,
- sortable: true,
- },
- },
- },
- },
- };
+ const settingStore = useSettingStore();
+ const userValidTimeEnabled = compute(() => {
+ return settingStore.sysPublic.userValidTimeEnabled === true;
+ });
+ return {
+ crudOptions: {
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ rowHandle: {
+ fixed: "right",
+ buttons: {
+ unlock: {
+ title: t("certd.unlockLogin"),
+ text: null,
+ type: "link",
+ icon: "ion:lock-open-outline",
+ click: async ({ row }) => {
+ Modal.confirm({
+ title: t("certd.notice"),
+ content: t("certd.confirmUnlock"),
+ onOk: async () => {
+ await api.Unlock(row.id);
+ notification.success({
+ message: t("certd.unlockSuccess"),
+ });
+ },
+ });
+ },
+ },
+ },
+ },
+ table: {
+ scroll: {
+ //使用固定列时需要设置此值,并且大于等于列宽度之和的值
+ x: 1400,
+ },
+ },
+ columns: {
+ id: {
+ title: "id",
+ type: "text",
+ form: { show: false }, // 表单配置
+ column: {
+ width: 100,
+ sorter: true,
+ },
+ },
+ createTime: {
+ title: t("certd.createTime"),
+ type: "datetime",
+ form: { show: false }, // 表单配置
+ column: {
+ width: 180,
+ sorter: true,
+ },
+ },
+ // updateTime: {
+ // title: "修改时间",
+ // type: "datetime",
+ // form: { show: false }, // 表单配置
+ // column: {
+ // sortable: "update_time",
+ // width: 180
+ // }
+ // },
+ username: {
+ title: t("certd.username"),
+ type: "text",
+ search: { show: true }, // 开启查询
+ form: {
+ rules: [
+ { required: true, message: t("certd.enterUsername") },
+ { max: 50, message: t("certd.max50Chars") },
+ ],
+ },
+ editForm: { component: { disabled: false } },
+ column: {
+ sorter: true,
+ width: 200,
+ },
+ },
+ password: {
+ title: t("certd.password"),
+ type: "text",
+ key: "password",
+ column: {
+ show: false,
+ },
+ form: {
+ rules: [{ max: 50, message: t("certd.max50Chars") }],
+ component: {
+ showPassword: true,
+ },
+ helper: t("certd.modifyPasswordIfFilled"),
+ },
+ },
+ nickName: {
+ title: t("certd.nickName"),
+ type: "text",
+ search: { show: true }, // 开启查询
+ form: {
+ rules: [{ max: 50, message: t("certd.max50Chars") }],
+ },
+ column: {
+ sorter: true,
+ },
+ },
+ email: {
+ title: t("certd.emaila"),
+ type: "text",
+ search: { show: true }, // 开启查询
+ form: {
+ rules: [{ max: 50, message: t("certd.max50Chars") }],
+ },
+ column: {
+ sorter: true,
+ width: 160,
+ },
+ },
+ mobile: {
+ title: t("certd.mobile"),
+ type: "text",
+ search: { show: true }, // 开启查询
+ form: {
+ rules: [{ max: 50, message: t("certd.max50Chars") }],
+ },
+ column: {
+ sorter: true,
+ width: 130,
+ },
+ },
+ avatar: {
+ title: t("certd.avatar"),
+ type: "cropper-uploader",
+ column: {
+ width: 70,
+ component: {
+ style: {
+ height: "30px",
+ width: "auto",
+ },
+ buildUrl(key: string) {
+ return `api/basic/file/download?&key=` + key;
+ },
+ },
+ },
+ form: {
+ component: {
+ vModel: "modelValue",
+ valueType: "key",
+ cropper: {
+ aspectRatio: 1,
+ autoCropArea: 1,
+ viewMode: 0,
+ },
+ onReady: null,
+ uploader: {
+ type: "form",
+ action: "/basic/file/upload",
+ name: "file",
+ headers: {
+ Authorization: "Bearer " + userStore.getToken,
+ },
+ successHandle(res: any) {
+ return res;
+ },
+ },
+ buildUrl(key: string) {
+ return `api/basic/file/download?&key=` + key;
+ },
+ },
+ },
+ },
+ status: {
+ title: t("certd.status"),
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("certd.enabled"), value: 1, color: "green" },
+ { label: t("certd.disabled"), value: 0, color: "red" },
+ ],
+ }),
+ column: {
+ align: "center",
+ sorter: true,
+ width: 100,
+ },
+ },
+ validTime: {
+ title: t("certd.validTime"),
+ type: "date",
+ form: {
+ show: userValidTimeEnabled,
+ },
+ column: {
+ align: "center",
+ sorter: true,
+ width: 100,
+ show: userValidTimeEnabled,
+ cellRender({ value }) {
+ if (value == null || value === 0) {
+ return "";
+ }
+ if (value < dayjs().valueOf()) {
+ return {t("certd.expired")};
+ }
+ const date = dayjs(value).format("YYYY-MM-DD");
+ return (
+
+
+
+ );
+ },
+ },
+ valueBuilder({ value, row, key }) {
+ if (value != null) {
+ row[key] = dayjs(value);
+ }
+ },
+ valueResolve({ value, row, key }) {
+ if (value != null) {
+ row[key] = value.valueOf();
+ }
+ },
+ },
+ remark: {
+ title: t("certd.remark"),
+ type: "text",
+ column: {
+ sorter: true,
+ },
+ form: {
+ rules: [{ max: 100, message: t("certd.max100Chars") }],
+ },
+ },
+ roles: {
+ title: t("certd.roles"),
+ type: "dict-select",
+ dict: dict({
+ url: "/sys/authority/role/list",
+ value: "id",
+ label: "name",
+ }), // 数据字典
+ form: {
+ component: { mode: "multiple" },
+ },
+ column: {
+ width: 250,
+ sortable: true,
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/sys/cname/provider/api.ts b/packages/ui/certd-client/src/views/sys/cname/provider/api.ts
index 31615e2a4..6da42dc80 100644
--- a/packages/ui/certd-client/src/views/sys/cname/provider/api.ts
+++ b/packages/ui/certd-client/src/views/sys/cname/provider/api.ts
@@ -6,7 +6,7 @@ export async function GetList(query: any) {
return await request({
url: apiPrefix + "/page",
method: "post",
- data: query
+ data: query,
});
}
@@ -14,7 +14,7 @@ export async function AddObj(obj: any) {
return await request({
url: apiPrefix + "/add",
method: "post",
- data: obj
+ data: obj,
});
}
@@ -22,7 +22,7 @@ export async function UpdateObj(obj: any) {
return await request({
url: apiPrefix + "/update",
method: "post",
- data: obj
+ data: obj,
});
}
@@ -30,7 +30,7 @@ export async function DelObj(id: any) {
return await request({
url: apiPrefix + "/delete",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -38,7 +38,7 @@ export async function GetObj(id: any) {
return await request({
url: apiPrefix + "/info",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -46,7 +46,7 @@ export async function GetDetail(id: any) {
return await request({
url: apiPrefix + "/detail",
method: "post",
- params: { id }
+ params: { id },
});
}
@@ -54,7 +54,7 @@ export async function DeleteBatch(ids: any[]) {
return await request({
url: apiPrefix + "/deleteByIds",
method: "post",
- data: { ids }
+ data: { ids },
});
}
@@ -62,7 +62,7 @@ export async function SetDefault(id: any) {
return await request({
url: apiPrefix + "/setDefault",
method: "post",
- data: { id }
+ data: { id },
});
}
@@ -70,6 +70,6 @@ export async function SetDisabled(id: any, disabled: boolean) {
return await request({
url: apiPrefix + "/setDisabled",
method: "post",
- data: { id, disabled }
+ data: { id, disabled },
});
}
diff --git a/packages/ui/certd-client/src/views/sys/cname/provider/crud.tsx b/packages/ui/certd-client/src/views/sys/cname/provider/crud.tsx
index dda10e7c0..ca5f74921 100644
--- a/packages/ui/certd-client/src/views/sys/cname/provider/crud.tsx
+++ b/packages/ui/certd-client/src/views/sys/cname/provider/crud.tsx
@@ -8,244 +8,244 @@ import { useSettingStore } from "/@/store/settings";
import { Modal } from "ant-design-vue";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const router = useRouter();
- const { t } = useI18n();
- const pageRequest = async (query: UserPageQuery): Promise => {
- return await api.GetList(query);
- };
- const editRequest = async ({ form, row }: EditReq) => {
- form.id = row.id;
- const res = await api.UpdateObj(form);
- return res;
- };
- const delRequest = async ({ row }: DelReq) => {
- return await api.DelObj(row.id);
- };
+ const router = useRouter();
+ const { t } = useI18n();
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ return await api.GetList(query);
+ };
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ const res = await api.UpdateObj(form);
+ return res;
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ return await api.DelObj(row.id);
+ };
- const addRequest = async ({ form }: AddReq) => {
- const res = await api.AddObj(form);
- return res;
- };
+ const addRequest = async ({ form }: AddReq) => {
+ const res = await api.AddObj(form);
+ return res;
+ };
- const userStore = useUserStore();
- const settingStore = useSettingStore();
- const selectedRowKeys: Ref = ref([]);
- context.selectedRowKeys = selectedRowKeys;
+ const userStore = useUserStore();
+ const settingStore = useSettingStore();
+ const selectedRowKeys: Ref = ref([]);
+ context.selectedRowKeys = selectedRowKeys;
- return {
- crudOptions: {
- settings: {
- plugins: {
- //这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
- rowSelection: {
- enabled: true,
- order: -2,
- before: true,
- // handle: (pluginProps,useCrudProps)=>CrudOptions,
- props: {
- multiple: true,
- crossPage: true,
- selectedRowKeys
- }
- }
- }
- },
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest
- },
- rowHandle: {
- minWidth: 200,
- fixed: "right"
- },
- columns: {
- id: {
- title: "ID",
- key: "id",
- type: "number",
- column: {
- width: 100
- },
- form: {
- show: false
- }
- },
- domain: {
- title: t("certd.cnameDomain"),
- type: "text",
- editForm: {
- component: {
- disabled: true,
- },
- },
- search: {
- show: true,
- },
- form: {
- component: {
- placeholder: t("certd.cnameDomainPlaceholder"),
- },
- helper: t("certd.cnameDomainHelper"),
- rules: [{ required: true, message: t("certd.requiredField") }],
- },
- column: {
- width: 200,
- },
- },
- dnsProviderType: {
- title: t("certd.dnsProvider"),
- type: "dict-select",
- search: {
- show: true,
- },
- dict: dict({
- url: "pi/dnsProvider/list",
- value: "key",
- label: "title",
- }),
- form: {
- rules: [{ required: true, message: t("certd.requiredField") }],
- },
- column: {
- width: 150,
- component: {
- color: "auto",
- },
- },
- },
- accessId: {
- title: t("certd.dnsProviderAuthorization"),
- type: "dict-select",
- dict: dict({
- url: "/pi/access/list",
- value: "id",
- label: "name",
- }),
- form: {
- component: {
- name: "access-selector",
- vModel: "modelValue",
- type: compute(({ form }) => {
- return form.dnsProviderType;
- }),
- },
- rules: [{ required: true, message: t("certd.requiredField") }],
- },
- column: {
- width: 150,
- component: {
- color: "auto",
- },
- },
- },
- isDefault: {
- title: t("certd.isDefault"),
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("certd.yes"), value: true, color: "success" },
- { label: t("certd.no"), value: false, color: "default" },
- ],
- }),
- form: {
- value: false,
- rules: [{ required: true, message: t("certd.selectIsDefault") }],
- },
- column: {
- align: "center",
- width: 100,
- },
- },
- setDefault: {
- title: t("certd.setDefault"),
- type: "text",
- form: {
- show: false,
- },
- column: {
- width: 100,
- align: "center",
- conditionalRenderDisabled: true,
- cellRender: ({ row }) => {
- if (row.isDefault) {
- return;
- }
- const onClick = async () => {
- Modal.confirm({
- title: t("certd.prompt"),
- content: t("certd.confirmSetDefault"),
- onOk: async () => {
- await api.SetDefault(row.id);
- await crudExpose.doRefresh();
- },
- });
- };
+ return {
+ crudOptions: {
+ settings: {
+ plugins: {
+ //这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
+ rowSelection: {
+ enabled: true,
+ order: -2,
+ before: true,
+ // handle: (pluginProps,useCrudProps)=>CrudOptions,
+ props: {
+ multiple: true,
+ crossPage: true,
+ selectedRowKeys,
+ },
+ },
+ },
+ },
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ rowHandle: {
+ minWidth: 200,
+ fixed: "right",
+ },
+ columns: {
+ id: {
+ title: "ID",
+ key: "id",
+ type: "number",
+ column: {
+ width: 100,
+ },
+ form: {
+ show: false,
+ },
+ },
+ domain: {
+ title: t("certd.cnameDomain"),
+ type: "text",
+ editForm: {
+ component: {
+ disabled: true,
+ },
+ },
+ search: {
+ show: true,
+ },
+ form: {
+ component: {
+ placeholder: t("certd.cnameDomainPlaceholder"),
+ },
+ helper: t("certd.cnameDomainHelper"),
+ rules: [{ required: true, message: t("certd.requiredField") }],
+ },
+ column: {
+ width: 200,
+ },
+ },
+ dnsProviderType: {
+ title: t("certd.dnsProvider"),
+ type: "dict-select",
+ search: {
+ show: true,
+ },
+ dict: dict({
+ url: "pi/dnsProvider/list",
+ value: "key",
+ label: "title",
+ }),
+ form: {
+ rules: [{ required: true, message: t("certd.requiredField") }],
+ },
+ column: {
+ width: 150,
+ component: {
+ color: "auto",
+ },
+ },
+ },
+ accessId: {
+ title: t("certd.dnsProviderAuthorization"),
+ type: "dict-select",
+ dict: dict({
+ url: "/pi/access/list",
+ value: "id",
+ label: "name",
+ }),
+ form: {
+ component: {
+ name: "access-selector",
+ vModel: "modelValue",
+ type: compute(({ form }) => {
+ return form.dnsProviderType;
+ }),
+ },
+ rules: [{ required: true, message: t("certd.requiredField") }],
+ },
+ column: {
+ width: 150,
+ component: {
+ color: "auto",
+ },
+ },
+ },
+ isDefault: {
+ title: t("certd.isDefault"),
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("certd.yes"), value: true, color: "success" },
+ { label: t("certd.no"), value: false, color: "default" },
+ ],
+ }),
+ form: {
+ value: false,
+ rules: [{ required: true, message: t("certd.selectIsDefault") }],
+ },
+ column: {
+ align: "center",
+ width: 100,
+ },
+ },
+ setDefault: {
+ title: t("certd.setDefault"),
+ type: "text",
+ form: {
+ show: false,
+ },
+ column: {
+ width: 100,
+ align: "center",
+ conditionalRenderDisabled: true,
+ cellRender: ({ row }) => {
+ if (row.isDefault) {
+ return;
+ }
+ const onClick = async () => {
+ Modal.confirm({
+ title: t("certd.prompt"),
+ content: t("certd.confirmSetDefault"),
+ onOk: async () => {
+ await api.SetDefault(row.id);
+ await crudExpose.doRefresh();
+ },
+ });
+ };
- return (
-
- {t("certd.setAsDefault")}
-
- );
- },
- },
- },
- disabled: {
- title: t("certd.disabled"),
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("certd.enabled"), value: false, color: "success" },
- { label: t("certd.disabledLabel"), value: true, color: "error" },
- ],
- }),
- form: {
- value: false,
- },
- column: {
- width: 100,
- component: {
- title: t("certd.clickToToggle"),
- on: {
- async click({ value, row }) {
- Modal.confirm({
- title: t("certd.prompt"),
- content: t("certd.confirmToggleStatus", { action: !value ? t("certd.disable") : t("certd.enable") }),
- onOk: async () => {
- await api.SetDisabled(row.id, !value);
- await crudExpose.doRefresh();
- },
- });
- },
- },
- },
- },
- },
- createTime: {
- title: t("certd.createTime"),
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- width: 160,
- align: "center",
- },
- },
- updateTime: {
- title: t("certd.updateTime"),
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- show: true,
- width: 160,
- },
- },
- }
- }
- };
+ return (
+
+ {t("certd.setAsDefault")}
+
+ );
+ },
+ },
+ },
+ disabled: {
+ title: t("certd.disabled"),
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("certd.enabled"), value: false, color: "success" },
+ { label: t("certd.disabledLabel"), value: true, color: "error" },
+ ],
+ }),
+ form: {
+ value: false,
+ },
+ column: {
+ width: 100,
+ component: {
+ title: t("certd.clickToToggle"),
+ on: {
+ async click({ value, row }) {
+ Modal.confirm({
+ title: t("certd.prompt"),
+ content: t("certd.confirmToggleStatus", { action: !value ? t("certd.disable") : t("certd.enable") }),
+ onOk: async () => {
+ await api.SetDisabled(row.id, !value);
+ await crudExpose.doRefresh();
+ },
+ });
+ },
+ },
+ },
+ },
+ },
+ createTime: {
+ title: t("certd.createTime"),
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ width: 160,
+ align: "center",
+ },
+ },
+ updateTime: {
+ title: t("certd.updateTime"),
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ show: true,
+ width: 160,
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/sys/cname/provider/index.vue b/packages/ui/certd-client/src/views/sys/cname/provider/index.vue
index 858da32d0..a957c0621 100644
--- a/packages/ui/certd-client/src/views/sys/cname/provider/index.vue
+++ b/packages/ui/certd-client/src/views/sys/cname/provider/index.vue
@@ -1,27 +1,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/packages/ui/certd-client/src/views/sys/console/api.ts b/packages/ui/certd-client/src/views/sys/console/api.ts
index b17537507..f8e965a0c 100644
--- a/packages/ui/certd-client/src/views/sys/console/api.ts
+++ b/packages/ui/certd-client/src/views/sys/console/api.ts
@@ -3,6 +3,6 @@ import { request } from "/@/api/service";
export async function GetStatisticCount() {
return await request({
url: "/sys/statistic/count",
- method: "POST"
+ method: "POST",
});
}
diff --git a/packages/ui/certd-client/src/views/sys/console/index.vue b/packages/ui/certd-client/src/views/sys/console/index.vue
index b3afb449e..69198113e 100644
--- a/packages/ui/certd-client/src/views/sys/console/index.vue
+++ b/packages/ui/certd-client/src/views/sys/console/index.vue
@@ -57,7 +57,7 @@ import { GetStatisticCount } from "./api";
const count: Ref = ref({});
function transformCountPerDayToChartData(key: string) {
- count.value[key] = count.value[key].map((item:any) => {
+ count.value[key] = count.value[key].map((item: any) => {
return {
name: item.date,
value: item.count,
diff --git a/packages/ui/certd-client/src/views/sys/plugin/crud.tsx b/packages/ui/certd-client/src/views/sys/plugin/crud.tsx
index 01d332296..b81746437 100644
--- a/packages/ui/certd-client/src/views/sys/plugin/crud.tsx
+++ b/packages/ui/certd-client/src/views/sys/plugin/crud.tsx
@@ -8,527 +8,527 @@ import { Modal, notification } from "ant-design-vue";
import yaml from "js-yaml";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- const router = useRouter();
- const { t } = useI18n();
+ const router = useRouter();
+ const { t } = useI18n();
- let lastType = "";
- const pageRequest = async (query: UserPageQuery): Promise => {
- if (lastType && lastType != query?.query?.type) {
- query.page.offset = 0;
- }
- lastType = query?.query?.type;
- return await api.GetList(query);
- };
- const editRequest = async ({ form, row }: EditReq) => {
- form.id = row.id;
- const res = await api.UpdateObj(form);
- return res;
- };
- const delRequest = async ({ row }: DelReq) => {
- return await api.DelObj(row.id);
- };
+ let lastType = "";
+ const pageRequest = async (query: UserPageQuery): Promise => {
+ if (lastType && lastType != query?.query?.type) {
+ query.page.offset = 0;
+ }
+ lastType = query?.query?.type;
+ return await api.GetList(query);
+ };
+ const editRequest = async ({ form, row }: EditReq) => {
+ form.id = row.id;
+ const res = await api.UpdateObj(form);
+ return res;
+ };
+ const delRequest = async ({ row }: DelReq) => {
+ return await api.DelObj(row.id);
+ };
- const addRequest = async ({ form }: AddReq) => {
- const res = await api.AddObj(form);
- return res;
- };
+ const addRequest = async ({ form }: AddReq) => {
+ const res = await api.AddObj(form);
+ return res;
+ };
- const selectedRowKeys: Ref = ref([]);
- context.selectedRowKeys = selectedRowKeys;
- const { openCrudFormDialog } = useFormWrapper();
+ const selectedRowKeys: Ref = ref([]);
+ context.selectedRowKeys = selectedRowKeys;
+ const { openCrudFormDialog } = useFormWrapper();
- async function openImportDialog() {
- function createCrudOptions() {
- return {
- crudOptions: {
- columns: {
- content: {
- title: t("certd.pluginFile"),
- type: "text",
- form: {
- component: {
- name: "pem-input",
- vModel: "modelValue",
- textarea: {
- rows: 8,
- },
- },
- col: {
- span: 24,
- },
- helper: t("certd.selectPluginFile"),
- },
- },
- override: {
- title: t("certd.overrideSameName"),
- type: "dict-switch",
- dict: dict({
- data: [
- {
- value: true,
- label: t("certd.override"),
- },
- {
- value: false,
- label: t("certd.noOverride"),
- },
- ],
- }),
- form: {
- value: false,
- col: {
- span: 24,
- },
- helper: t("certd.overrideHelper"),
- },
- },
- },
- form: {
- wrapper: {
- title: t("certd.importPlugin"),
- saveRemind: false,
- },
- afterSubmit() {
- notification.success({ message: t("certd.operationSuccess") });
- crudExpose.doRefresh();
- },
- async doSubmit({ form }: any) {
- return await api.ImportPlugin({
- ...form,
- });
- },
- },
- },
- };
- }
- const { crudOptions } = createCrudOptions();
- await openCrudFormDialog({ crudOptions });
- }
- return {
- crudOptions: {
- settings: {
- plugins: {
- rowSelection: {
- enabled: true,
- order: -2,
- before: true,
- props: {
- multiple: true,
- crossPage: true,
- selectedRowKeys,
- },
- },
- },
- },
- request: {
- pageRequest,
- addRequest,
- editRequest,
- delRequest,
- },
- actionbar: {
- buttons: {
- add: {
- show: true,
- icon: "ion:ios-add-circle-outline",
- text: t("certd.customPlugin"),
- },
- import: {
- show: true,
- icon: "ion:cloud-upload-outline",
- text: t("certd.import"),
- type: "primary",
- async click() {
- await openImportDialog();
- },
- },
- },
- },
- rowHandle: {
- show: true,
- minWidth: 200,
- fixed: "right",
- buttons: {
- edit: {
- show: compute(({ row }) => {
- return row.type === "custom";
- }),
- },
- copy: {
- show: compute(({ row }) => {
- return row.type === "custom";
- }),
- },
- remove: {
- order: 999,
- show: compute(({ row }) => {
- return row.type === "custom";
- }),
- },
- export: {
- text: null,
- icon: "ion:cloud-download-outline",
- title: t("certd.export"),
- type: "link",
- show: compute(({ row }) => {
- return row.type === "custom";
- }),
- async click({ row }) {
- const content = await api.ExportPlugin(row.id);
- if (content) {
- const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
- const url = URL.createObjectURL(blob);
- const link = document.createElement("a");
- link.href = url;
- link.download = `${row.name}.yaml`;
- link.click();
- URL.revokeObjectURL(url);
- }
- },
- },
- },
- },
- table: {
- rowKey: "name",
- },
- tabs: {
- name: "type",
- show: true,
- defaultOption: {
- show: false,
- },
- },
- form: {
- onSuccess(opts: any) {
- if (opts.res?.id) {
- router.push({
- name: "SysPluginEdit",
- query: {
- id: opts.res.id,
- },
- });
- }
- },
- },
- columns: {
- pluginType: {
- title: t("certd.pluginType"),
- type: "dict-select",
- search: {
- show: true,
- },
- form: {
- order: 0,
- rules: [{ required: true }],
- component: {
- disabled: true,
- },
- },
- addForm: {
- component: {
- disabled: false,
- },
- },
- dict: dict({
- data: [
- { label: t("certd.auth"), value: "access" },
- { label: t("certd.dns"), value: "dnsProvider" },
- { label: t("certd.deployPlugin"), value: "deploy" },
- ],
- }),
- column: {
- width: 100,
- align: "center",
- component: {
- color: "auto",
- },
- },
- },
- icon: {
- title: t("certd.icon"),
- type: "icon",
- form: {
- rules: [{ required: true }],
- },
- column: {
- width: 70,
- align: "center",
- component: {
- name: "fs-icon",
- vModel: "icon",
- style: {
- fontSize: "22px",
- },
- },
- },
- },
- name: {
- title: t("certd.pluginName"),
- type: "text",
- search: {
- show: true,
- },
- form: {
- show: true,
- helper: t("certd.pluginNameHelper"),
- rules: [
- { required: true },
- {
- type: "regexp",
- pattern: /^[a-zA-Z][a-zA-Z0-9]+$/,
- message: t("certd.pluginNameRuleMsg"),
- },
- ],
- },
- column: {
- width: 250,
- cellRender({ row }) {
- if (row.author) {
- return ;
- } else {
- return ;
- }
- },
- },
- },
- author: {
- title: t("certd.author"),
- type: "text",
- search: {
- show: true,
- },
- form: {
- show: true,
- helper: t("certd.authorHelper"),
- rules: [
- { required: true },
- {
- type: "regexp",
- pattern: /^[a-zA-Z][a-zA-Z0-9]+$/,
- message: t("certd.authorRuleMsg"),
- },
- ],
- },
- column: {
- width: 200,
- show: false,
- },
- },
- title: {
- title: t("certd.titlea"),
- type: "text",
- form: {
- helper: t("certd.titleHelper"),
- rules: [{ required: true }],
- },
- column: {
- width: 300,
- cellRender({ row }) {
- if (row.type === "custom") {
- return {row.title};
- }
- return {row.title}
;
- },
- },
- },
- desc: {
- title: t("certd.description"),
- type: "textarea",
- helper: t("certd.descriptionHelper"),
- column: {
- width: 300,
- show: false,
- },
- },
- type: {
- title: t("certd.sourcee"),
- type: "dict-select",
- search: {
- show: true,
- },
- form: {
- value: "custom",
- component: {
- disabled: true,
- },
- },
- dict: dict({
- data: [
- { label: t("certd.builtIn"), value: "builtIn" },
- { label: t("certd.custom"), value: "custom" },
- { label: t("certd.store"), value: "store" },
- ],
- }),
- column: {
- width: 70,
- align: "center",
- component: {
- color: "auto",
- },
- },
- },
- version: {
- title: t("certd.version"),
- type: "text",
- column: {
- width: 100,
- align: "center",
- },
- },
- "extra.dependPlugins": {
- title: t("certd.pluginDependencies"),
- type: "text",
- form: {
- component: {
- name: "a-select",
- mode: "tags",
- open: false,
- allowClear: true,
- },
- helper: t("certd.pluginDependenciesHelper"),
- },
- column: {
- show: false,
- },
- },
- "extra.showRunStrategy": {
- title: t("certd.editableRunStrategy"),
- type: "dict-switch",
- dict: dict({
- data: [
- { value: true, label: t("certd.editable") },
- { value: false, label: t("certd.notEditable") },
- ],
- }),
- form: {
- value: false,
- rules: [{ required: true }],
- },
- column: {
- width: 100,
- align: "left",
- show: false,
- },
- },
- "extra.default.strategy.runStrategy": {
- title: t("certd.runStrategy"),
- type: "dict-select",
- dict: dict({
- data: [
- { value: 0, label: t("certd.normalRun") },
- { value: 1, label: t("certd.skipOnSuccess") },
- ],
- }),
- form: {
- value: 1,
- rules: [{ required: true }],
- helper: t("certd.defaultRunStrategyHelper"),
- show: compute(({ form }) => {
- return form.extra.showRunStrategy;
- }),
- },
- column: {
- width: 100,
- align: "left",
- component: {
- color: "auto",
- },
- show: false,
- },
- valueBuilder({ row }) {
- if (row.extra) {
- row.extra = yaml.load(row.extra);
- }
- },
- valueResolve({ row }) {
- if (row.extra) {
- row.extra = yaml.dump(row.extra);
- }
- },
- },
- disabled: {
- title: t("certd.enableDisable"),
- type: "dict-switch",
- dict: dict({
- data: [
- { label: t("certd.enabled"), value: false, color: "success" },
- { label: t("certd.disabled"), value: true, color: "error" },
- ],
- }),
- form: {
- title: t("certd.enableDisable"),
- value: false,
- },
- column: {
- width: 120,
- align: "center",
- component: {
- title: t("certd.clickToToggle"),
- on: {
- async click({ value, row }) {
- Modal.confirm({
- title: t("certd.confirm"),
- content: `${t("certd.confirmToggle")} ${!value ? t("certd.disable") : t("certd.enable")}?`,
- onOk: async () => {
- await api.SetDisabled({
- id: row.id,
- name: row.name,
- type: row.type,
- disabled: !value,
- });
- await crudExpose.doRefresh();
- },
- });
- },
- },
- },
- },
- },
- group: {
- title: t("certd.pluginGroup"),
- type: "dict-select",
- dict: dict({
- url: "/pi/plugin/groupsList",
- label: "title",
- value: "key",
- }),
- form: {
- rules: [{ required: true }],
- show: compute(({ form }) => {
- return form.pluginType === "deploy";
- }),
- },
- column: {
- width: 100,
- align: "left",
- component: {
- color: "auto",
- },
- },
- },
- createTime: {
- title: t("certd.createTime"),
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- sorter: true,
- width: 160,
- align: "center",
- },
- },
- updateTime: {
- title: t("certd.updateTime"),
- type: "datetime",
- form: {
- show: false,
- },
- column: {
- show: true,
- },
- },
- },
- },
- };
+ async function openImportDialog() {
+ function createCrudOptions() {
+ return {
+ crudOptions: {
+ columns: {
+ content: {
+ title: t("certd.pluginFile"),
+ type: "text",
+ form: {
+ component: {
+ name: "pem-input",
+ vModel: "modelValue",
+ textarea: {
+ rows: 8,
+ },
+ },
+ col: {
+ span: 24,
+ },
+ helper: t("certd.selectPluginFile"),
+ },
+ },
+ override: {
+ title: t("certd.overrideSameName"),
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ {
+ value: true,
+ label: t("certd.override"),
+ },
+ {
+ value: false,
+ label: t("certd.noOverride"),
+ },
+ ],
+ }),
+ form: {
+ value: false,
+ col: {
+ span: 24,
+ },
+ helper: t("certd.overrideHelper"),
+ },
+ },
+ },
+ form: {
+ wrapper: {
+ title: t("certd.importPlugin"),
+ saveRemind: false,
+ },
+ afterSubmit() {
+ notification.success({ message: t("certd.operationSuccess") });
+ crudExpose.doRefresh();
+ },
+ async doSubmit({ form }: any) {
+ return await api.ImportPlugin({
+ ...form,
+ });
+ },
+ },
+ },
+ };
+ }
+ const { crudOptions } = createCrudOptions();
+ await openCrudFormDialog({ crudOptions });
+ }
+ return {
+ crudOptions: {
+ settings: {
+ plugins: {
+ rowSelection: {
+ enabled: true,
+ order: -2,
+ before: true,
+ props: {
+ multiple: true,
+ crossPage: true,
+ selectedRowKeys,
+ },
+ },
+ },
+ },
+ request: {
+ pageRequest,
+ addRequest,
+ editRequest,
+ delRequest,
+ },
+ actionbar: {
+ buttons: {
+ add: {
+ show: true,
+ icon: "ion:ios-add-circle-outline",
+ text: t("certd.customPlugin"),
+ },
+ import: {
+ show: true,
+ icon: "ion:cloud-upload-outline",
+ text: t("certd.import"),
+ type: "primary",
+ async click() {
+ await openImportDialog();
+ },
+ },
+ },
+ },
+ rowHandle: {
+ show: true,
+ minWidth: 200,
+ fixed: "right",
+ buttons: {
+ edit: {
+ show: compute(({ row }) => {
+ return row.type === "custom";
+ }),
+ },
+ copy: {
+ show: compute(({ row }) => {
+ return row.type === "custom";
+ }),
+ },
+ remove: {
+ order: 999,
+ show: compute(({ row }) => {
+ return row.type === "custom";
+ }),
+ },
+ export: {
+ text: null,
+ icon: "ion:cloud-download-outline",
+ title: t("certd.export"),
+ type: "link",
+ show: compute(({ row }) => {
+ return row.type === "custom";
+ }),
+ async click({ row }) {
+ const content = await api.ExportPlugin(row.id);
+ if (content) {
+ const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
+ const url = URL.createObjectURL(blob);
+ const link = document.createElement("a");
+ link.href = url;
+ link.download = `${row.name}.yaml`;
+ link.click();
+ URL.revokeObjectURL(url);
+ }
+ },
+ },
+ },
+ },
+ table: {
+ rowKey: "name",
+ },
+ tabs: {
+ name: "type",
+ show: true,
+ defaultOption: {
+ show: false,
+ },
+ },
+ form: {
+ onSuccess(opts: any) {
+ if (opts.res?.id) {
+ router.push({
+ name: "SysPluginEdit",
+ query: {
+ id: opts.res.id,
+ },
+ });
+ }
+ },
+ },
+ columns: {
+ pluginType: {
+ title: t("certd.pluginType"),
+ type: "dict-select",
+ search: {
+ show: true,
+ },
+ form: {
+ order: 0,
+ rules: [{ required: true }],
+ component: {
+ disabled: true,
+ },
+ },
+ addForm: {
+ component: {
+ disabled: false,
+ },
+ },
+ dict: dict({
+ data: [
+ { label: t("certd.auth"), value: "access" },
+ { label: t("certd.dns"), value: "dnsProvider" },
+ { label: t("certd.deployPlugin"), value: "deploy" },
+ ],
+ }),
+ column: {
+ width: 100,
+ align: "center",
+ component: {
+ color: "auto",
+ },
+ },
+ },
+ icon: {
+ title: t("certd.icon"),
+ type: "icon",
+ form: {
+ rules: [{ required: true }],
+ },
+ column: {
+ width: 70,
+ align: "center",
+ component: {
+ name: "fs-icon",
+ vModel: "icon",
+ style: {
+ fontSize: "22px",
+ },
+ },
+ },
+ },
+ name: {
+ title: t("certd.pluginName"),
+ type: "text",
+ search: {
+ show: true,
+ },
+ form: {
+ show: true,
+ helper: t("certd.pluginNameHelper"),
+ rules: [
+ { required: true },
+ {
+ type: "regexp",
+ pattern: /^[a-zA-Z][a-zA-Z0-9]+$/,
+ message: t("certd.pluginNameRuleMsg"),
+ },
+ ],
+ },
+ column: {
+ width: 250,
+ cellRender({ row }) {
+ if (row.author) {
+ return ;
+ } else {
+ return ;
+ }
+ },
+ },
+ },
+ author: {
+ title: t("certd.author"),
+ type: "text",
+ search: {
+ show: true,
+ },
+ form: {
+ show: true,
+ helper: t("certd.authorHelper"),
+ rules: [
+ { required: true },
+ {
+ type: "regexp",
+ pattern: /^[a-zA-Z][a-zA-Z0-9]+$/,
+ message: t("certd.authorRuleMsg"),
+ },
+ ],
+ },
+ column: {
+ width: 200,
+ show: false,
+ },
+ },
+ title: {
+ title: t("certd.titlea"),
+ type: "text",
+ form: {
+ helper: t("certd.titleHelper"),
+ rules: [{ required: true }],
+ },
+ column: {
+ width: 300,
+ cellRender({ row }) {
+ if (row.type === "custom") {
+ return {row.title};
+ }
+ return {row.title}
;
+ },
+ },
+ },
+ desc: {
+ title: t("certd.description"),
+ type: "textarea",
+ helper: t("certd.descriptionHelper"),
+ column: {
+ width: 300,
+ show: false,
+ },
+ },
+ type: {
+ title: t("certd.sourcee"),
+ type: "dict-select",
+ search: {
+ show: true,
+ },
+ form: {
+ value: "custom",
+ component: {
+ disabled: true,
+ },
+ },
+ dict: dict({
+ data: [
+ { label: t("certd.builtIn"), value: "builtIn" },
+ { label: t("certd.custom"), value: "custom" },
+ { label: t("certd.store"), value: "store" },
+ ],
+ }),
+ column: {
+ width: 70,
+ align: "center",
+ component: {
+ color: "auto",
+ },
+ },
+ },
+ version: {
+ title: t("certd.version"),
+ type: "text",
+ column: {
+ width: 100,
+ align: "center",
+ },
+ },
+ "extra.dependPlugins": {
+ title: t("certd.pluginDependencies"),
+ type: "text",
+ form: {
+ component: {
+ name: "a-select",
+ mode: "tags",
+ open: false,
+ allowClear: true,
+ },
+ helper: t("certd.pluginDependenciesHelper"),
+ },
+ column: {
+ show: false,
+ },
+ },
+ "extra.showRunStrategy": {
+ title: t("certd.editableRunStrategy"),
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { value: true, label: t("certd.editable") },
+ { value: false, label: t("certd.notEditable") },
+ ],
+ }),
+ form: {
+ value: false,
+ rules: [{ required: true }],
+ },
+ column: {
+ width: 100,
+ align: "left",
+ show: false,
+ },
+ },
+ "extra.default.strategy.runStrategy": {
+ title: t("certd.runStrategy"),
+ type: "dict-select",
+ dict: dict({
+ data: [
+ { value: 0, label: t("certd.normalRun") },
+ { value: 1, label: t("certd.skipOnSuccess") },
+ ],
+ }),
+ form: {
+ value: 1,
+ rules: [{ required: true }],
+ helper: t("certd.defaultRunStrategyHelper"),
+ show: compute(({ form }) => {
+ return form.extra.showRunStrategy;
+ }),
+ },
+ column: {
+ width: 100,
+ align: "left",
+ component: {
+ color: "auto",
+ },
+ show: false,
+ },
+ valueBuilder({ row }) {
+ if (row.extra) {
+ row.extra = yaml.load(row.extra);
+ }
+ },
+ valueResolve({ row }) {
+ if (row.extra) {
+ row.extra = yaml.dump(row.extra);
+ }
+ },
+ },
+ disabled: {
+ title: t("certd.enableDisable"),
+ type: "dict-switch",
+ dict: dict({
+ data: [
+ { label: t("certd.enabled"), value: false, color: "success" },
+ { label: t("certd.disabled"), value: true, color: "error" },
+ ],
+ }),
+ form: {
+ title: t("certd.enableDisable"),
+ value: false,
+ },
+ column: {
+ width: 120,
+ align: "center",
+ component: {
+ title: t("certd.clickToToggle"),
+ on: {
+ async click({ value, row }) {
+ Modal.confirm({
+ title: t("certd.confirm"),
+ content: `${t("certd.confirmToggle")} ${!value ? t("certd.disable") : t("certd.enable")}?`,
+ onOk: async () => {
+ await api.SetDisabled({
+ id: row.id,
+ name: row.name,
+ type: row.type,
+ disabled: !value,
+ });
+ await crudExpose.doRefresh();
+ },
+ });
+ },
+ },
+ },
+ },
+ },
+ group: {
+ title: t("certd.pluginGroup"),
+ type: "dict-select",
+ dict: dict({
+ url: "/pi/plugin/groupsList",
+ label: "title",
+ value: "key",
+ }),
+ form: {
+ rules: [{ required: true }],
+ show: compute(({ form }) => {
+ return form.pluginType === "deploy";
+ }),
+ },
+ column: {
+ width: 100,
+ align: "left",
+ component: {
+ color: "auto",
+ },
+ },
+ },
+ createTime: {
+ title: t("certd.createTime"),
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ sorter: true,
+ width: 160,
+ align: "center",
+ },
+ },
+ updateTime: {
+ title: t("certd.updateTime"),
+ type: "datetime",
+ form: {
+ show: false,
+ },
+ column: {
+ show: true,
+ },
+ },
+ },
+ },
+ };
}
diff --git a/packages/ui/certd-client/src/views/sys/plugin/demo/sdk.yaml b/packages/ui/certd-client/src/views/sys/plugin/demo/sdk.yaml
index 2892bf5a4..c78fbee0b 100644
--- a/packages/ui/certd-client/src/views/sys/plugin/demo/sdk.yaml
+++ b/packages/ui/certd-client/src/views/sys/plugin/demo/sdk.yaml
@@ -15,7 +15,7 @@ script: |
accessKeyId = '';
secretAccessKey = '';
}
-
+
return {
AliyunClient
}
diff --git a/packages/ui/certd-client/src/views/sys/plugin/index.vue b/packages/ui/certd-client/src/views/sys/plugin/index.vue
index c16ab9662..bed34c945 100644
--- a/packages/ui/certd-client/src/views/sys/plugin/index.vue
+++ b/packages/ui/certd-client/src/views/sys/plugin/index.vue
@@ -1,22 +1,21 @@
-
-
-
- {{ t("certd.pluginManagement") }}
- {{ t("certd.pluginBetaWarning") }}
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {{ t("certd.pluginManagement") }}
+ {{ t("certd.pluginBetaWarning") }}
+
+
+
+
+
+
+
+
+
+
-
diff --git a/packages/ui/certd-client/src/views/sys/settings/api.ts b/packages/ui/certd-client/src/views/sys/settings/api.ts
index cb0c32992..e2d576097 100644
--- a/packages/ui/certd-client/src/views/sys/settings/api.ts
+++ b/packages/ui/certd-client/src/views/sys/settings/api.ts
@@ -103,4 +103,3 @@ export async function GetSmsTypeDefine(type: string) {
},
});
}
-
diff --git a/packages/ui/certd-client/src/views/sys/settings/email/api.email.ts b/packages/ui/certd-client/src/views/sys/settings/email/api.email.ts
index 65a181b02..43c70939d 100644
--- a/packages/ui/certd-client/src/views/sys/settings/email/api.email.ts
+++ b/packages/ui/certd-client/src/views/sys/settings/email/api.email.ts
@@ -6,7 +6,7 @@ export async function TestSend(receiver: string) {
url: apiPrefix + "/test",
method: "post",
data: {
- receiver
- }
+ receiver,
+ },
});
}
diff --git a/packages/ui/certd-client/src/views/sys/settings/email/index.vue b/packages/ui/certd-client/src/views/sys/settings/email/index.vue
index 9c6843d13..eec473a68 100644
--- a/packages/ui/certd-client/src/views/sys/settings/email/index.vue
+++ b/packages/ui/certd-client/src/views/sys/settings/email/index.vue
@@ -1,86 +1,75 @@
-
-
-
- {{ t('certd.emailServerSettings') }}
- {{ t('certd.setEmailSendingServer') }}
-
-
+
+
+
+ {{ t("certd.emailServerSettings") }}
+ {{ t("certd.setEmailSendingServer") }}
+
+
-