chore: 支持手动上传证书并部署

This commit is contained in:
xiaojunnuo
2025-03-18 00:52:50 +08:00
parent 29a6a992f0
commit de40be430b
74 changed files with 1040 additions and 597 deletions
+21 -21
View File
@@ -3,34 +3,34 @@ module.exports = {
env: {
browser: true,
node: true,
es6: true
es6: true,
},
parser: "vue-eslint-parser",
parser: 'vue-eslint-parser',
parserOptions: {
parser: "@typescript-eslint/parser",
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
sourceType: "module",
jsxPragma: "React",
sourceType: 'module',
jsxPragma: 'React',
ecmaFeatures: {
jsx: true,
tsx: true
}
tsx: true,
},
},
extends: ["plugin:vue/vue3-recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended", "prettier"],
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended', 'prettier'],
rules: {
//"max-len": [0, 200, 2, { ignoreUrls: true }],
"@typescript-eslint/no-unused-vars": "off",
"no-unused-vars": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
'@typescript-eslint/no-unused-vars': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
// "@typescript-eslint/no-unused-vars": [
// "error",
// {
@@ -69,5 +69,5 @@ module.exports = {
// math: "always",
// },
// ],
}
},
};
+5 -3
View File
@@ -1,5 +1,7 @@
{
"trailingComma": "none",
"printWidth": 220
"printWidth": 220,
"bracketSpacing": true,
"singleQuote": false,
"trailingComma": "es5",
"arrowParens": "avoid"
}
@@ -5,6 +5,7 @@ import OutputSelector from "/@/components/plugins/common/output-selector/index.v
import DnsProviderSelector from "/@/components/plugins/cert/dns-provider-selector/index.vue";
import DomainsVerifyPlanEditor from "/@/components/plugins/cert/domains-verify-plan-editor/index.vue";
import AccessSelector from "/@/views/certd/access/access-selector/index.vue";
import CertInfoSelector from "/@/views/certd/monitor/cert/selector/index.vue";
import InputPassword from "./common/input-password.vue";
import ApiTest from "./common/api-test.vue";
export * from "./cert/index.js";
@@ -14,6 +15,8 @@ export default {
app.component("DnsProviderSelector", DnsProviderSelector);
app.component("DomainsVerifyPlanEditor", DomainsVerifyPlanEditor);
app.component("AccessSelector", AccessSelector);
app.component("CertInfoSelector", CertInfoSelector);
app.component("ApiTest", ApiTest);
app.component("SynologyDeviceIdGetter", SynologyIdDeviceGetter);
@@ -7,7 +7,7 @@ export const certInfoApi = {
return await request({
url: apiPrefix + "/page",
method: "post",
data: query
data: query,
});
},
@@ -15,7 +15,7 @@ export const certInfoApi = {
return await request({
url: apiPrefix + "/add",
method: "post",
data: obj
data: obj,
});
},
@@ -23,7 +23,7 @@ export const certInfoApi = {
return await request({
url: apiPrefix + "/update",
method: "post",
data: obj
data: obj,
});
},
@@ -31,7 +31,7 @@ export const certInfoApi = {
return await request({
url: apiPrefix + "/delete",
method: "post",
params: { id }
params: { id },
});
},
@@ -39,27 +39,35 @@ export const certInfoApi = {
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 Upload(body: { id?: number; cert: { crt: string; key: string } }) {
return await request({
url: apiPrefix + "/upload",
method: "post",
data: body
data: body,
});
},
async GetCert(id: number): Promise<CertInfo> {
return await request({
url: apiPrefix + "/getCert",
method: "post",
params: { id: id }
params: { id: id },
});
}
},
async GetOptionsByIds(ids: number[]): Promise<any[]> {
return await request({
url: apiPrefix + "/getOptionsByIds",
method: "post",
data: { ids },
});
},
};
@@ -1,6 +1,17 @@
// @ts-ignore
import { useI18n } from "vue-i18n";
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, useFormWrapper, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import {
AddReq,
compute,
CreateCrudOptionsProps,
CreateCrudOptionsRet,
DelReq,
dict,
EditReq,
useFormWrapper,
UserPageQuery,
UserPageRes
} from "@fast-crud/fast-crud";
import { certInfoApi } from "./api";
import dayjs from "dayjs";
import { useRouter } from "vue-router";
@@ -9,7 +20,6 @@ import { notification } from "ant-design-vue";
import CertView from "/@/views/certd/pipeline/cert-view.vue";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n();
const api = certInfoApi;
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query);
@@ -48,7 +58,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
width: 800,
content: () => {
return <CertView cert={cert}></CertView>;
}
},
});
};
@@ -69,35 +79,35 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
title: "ID",
type: "number",
form: {
show: false
}
show: false,
},
},
"cert.crt": {
title: "证书",
type: "textarea",
form: {
component: {
rows: 4
rows: 4,
},
rules: [{ required: true, message: "此项必填" }],
col: { span: 24 }
}
col: { span: 24 },
},
},
"cert.key": {
title: "私钥",
type: "textarea",
form: {
component: {
rows: 4
rows: 4,
},
rules: [{ required: true, message: "此项必填" }],
col: { span: 24 }
}
}
col: { span: 24 },
},
},
},
form: {
wrapper: {
title: "上传自定义证书"
title: "上传自定义证书",
},
async doSubmit({ form }: any) {
if (!id) {
@@ -106,9 +116,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
form.id = id;
}
return await api.Upload(form);
}
}
}
},
},
},
};
}
const { crudOptions } = createCrudOptions();
@@ -121,22 +131,22 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
pageRequest,
addRequest,
editRequest,
delRequest
delRequest,
},
form: {
labelCol: {
//固定label宽度
span: null,
style: {
width: "100px"
}
width: "100px",
},
},
col: {
span: 22
span: 22,
},
wrapper: {
width: 600
}
width: 600,
},
},
actionbar: {
show: true,
@@ -147,13 +157,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
show: true,
async click() {
await openUpload();
}
}
}
},
},
},
},
tabs: {
name: "fromType",
show: true
show: true,
},
rowHandle: {
width: 140,
@@ -167,7 +177,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
icon: "ph:certificate",
async click({ row }) {
await viewCert(row);
}
},
},
copy: { show: false },
edit: { show: false },
@@ -181,15 +191,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
icon: "ph:upload",
async click({ row }) {
await openUpload(row.id);
}
},
},
remove: {
order: 10,
show: compute(({ row }) => {
return row.fromType === "upload";
})
}
}
}),
},
},
},
columns: {
id: {
@@ -197,85 +207,85 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
key: "id",
type: "number",
search: {
show: false
show: false,
},
column: {
width: 100,
editable: {
disabled: true
}
disabled: true,
},
},
form: {
show: false
}
show: false,
},
},
fromType: {
title: "来源",
search: {
show: true
show: true,
},
type: "dict-select",
dict: dict({
data: [
{ label: "流水线", value: "pipeline" },
{ label: "手动上传", value: "upload" }
]
{ label: "手动上传", value: "upload" },
],
}),
form: {
show: false
show: false,
},
column: {
width: 100,
sorter: true,
component: {
color: "auto"
color: "auto",
},
conditionalRender: false
conditionalRender: false,
},
valueBuilder({ value, row, key }) {
if (!value) {
row[key] = "pipeline";
}
}
},
},
domains: {
title: "域名",
search: {
show: true
show: true,
},
type: "text",
form: {
rules: [{ required: true, message: "请输入域名" }]
rules: [{ required: true, message: "请输入域名" }],
},
column: {
width: 450,
sorter: true,
component: {
name: "fs-values-format",
color: "auto"
}
}
color: "auto",
},
},
},
domainCount: {
title: "域名数量",
type: "number",
form: {
show: false
show: false,
},
column: {
width: 120,
sorter: true,
show: false
}
show: false,
},
},
expiresLeft: {
title: "有效天数",
search: {
show: false
show: false,
},
type: "date",
form: {
show: false
show: false,
},
column: {
sorter: true,
@@ -290,54 +300,54 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const color = leftDays < 20 ? "red" : "#389e0d";
const percent = (leftDays / 90) * 100;
return <a-progress title={expireDate + "过期"} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}`} />;
}
}
},
},
},
expiresTime: {
title: "过期时间",
search: {
show: false
show: false,
},
type: "datetime",
form: {
show: false
show: false,
},
column: {
sorter: true
}
sorter: true,
},
},
certProvider: {
title: "证书颁发机构",
search: {
show: false
show: false,
},
type: "text",
form: {
show: false
show: false,
},
column: {
width: 200
}
width: 200,
},
},
applyTime: {
title: "申请时间",
search: {
show: false
show: false,
},
type: "datetime",
form: {
show: false
show: false,
},
column: {
sorter: true
}
sorter: true,
},
},
"pipeline.title": {
title: "关联流水线",
search: { show: false },
type: "link",
form: {
show: false
show: false,
},
column: {
width: 350,
@@ -346,12 +356,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
on: {
onClick({ row }) {
router.push({ path: "/certd/pipeline/detail", query: { id: row.pipelineId, editMode: "false" } });
}
}
}
}
}
}
}
},
},
},
},
},
},
},
};
}
@@ -0,0 +1,123 @@
<template>
<div class="cert-info-selector w-full">
<div class="flex-o w-full">
<fs-table-select
ref="tableSelectRef"
class="flex-0"
:model-value="modelValue"
:dict="optionsDictRef"
:create-crud-options="createCrudOptions"
:crud-options-override="{
search: { show: false },
table: {
scroll: {
x: 540,
},
},
}"
:show-current="false"
:show-select="false"
:dialog="{ width: 960 }"
:destroy-on-close="false"
height="400px"
@update:model-value="onChange"
@dialog-closed="doRefresh"
@selected-change="onSelectedChange"
/>
</div>
</div>
</template>
<script lang="tsx" setup>
import { inject, ref, Ref, watch } from "vue";
import { message } from "ant-design-vue";
import createCrudOptions from "../crud";
import { dict } from "@fast-crud/fast-crud";
import { certInfoApi } from "../api";
defineOptions({
name: "CertInfoSelector",
});
const props = defineProps<{
modelValue?: number | string;
type?: string;
placeholder?: string;
size?: string;
disabled?: boolean;
}>();
const onChange = async (value: number) => {
await emitValue(value);
};
const emit = defineEmits(["update:modelValue", "selectedChange", "change"]);
const tableSelectRef = ref();
const optionsDictRef = dict({
value: "id",
label: "domain",
getNodesByValues: async (values: any[]) => {
return await certInfoApi.GetOptionsByIds(values);
},
});
// async function openTableSelectDialog() {
// await tableSelectRef.value.open({});
// await tableSelectRef.value.crudExpose.openAdd({});
// }
const target: Ref<any> = ref({});
function clear() {
if (props.disabled) {
return;
}
emitValue(null);
}
async function emitValue(value: any) {
target.value = optionsDictRef.dataMap[value];
if (value !== 0 && pipeline?.value && target && pipeline.value.userId !== target.value.userId) {
message.error("对不起,您不能修改他人流水线的证书仓库ID");
return;
}
emit("change", value);
emit("update:modelValue", value);
}
function onSelectedChange(value: any) {
if (value && value.length > 0) {
emit("selectedChange", value[0]);
} else {
emit("selectedChange", null);
}
}
// watch(
// () => {
// return props.modelValue;
// },
// async value => {
// await optionsDictRef.loadDict();
// target.value = optionsDictRef.dataMap[value];
// emit("selectedChange", target.value);
// },
// {
// immediate: true,
// }
// );
//当不在pipeline中编辑时,可能为空
const pipeline = inject("pipeline", null);
async function doRefresh() {
await optionsDictRef.reloadDict();
}
</script>
<style lang="less">
.cert-info-selector {
width: 100%;
}
</style>
@@ -1,16 +1,7 @@
<template>
<div class="notification-selector">
<div class="flex-o w-100">
<fs-dict-select
class="flex-1"
:value="modelValue"
:dict="optionsDictRef"
:disabled="disabled"
:render-label="renderLabel"
:slots="selectSlots"
:allow-clear="true"
@update:value="onChange"
/>
<fs-dict-select class="flex-1" :value="modelValue" :dict="optionsDictRef" :disabled="disabled" :render-label="renderLabel" :slots="selectSlots" :allow-clear="true" @update:value="onChange" />
<fs-table-select
ref="tableSelectRef"
class="flex-0"
@@ -18,12 +9,12 @@
:dict="optionsDictRef"
:create-crud-options="createCrudOptions"
:crud-options-override="{
search: { show: false },
search: { show: false, initialForm: { fromType: 'upload' } },
table: {
scroll: {
x: 540
}
}
x: 540,
},
},
}"
:show-current="false"
:show-select="false"
@@ -50,7 +41,7 @@ import createCrudOptions from "../crud";
import { notificationProvide } from "/@/views/certd/notification/common";
defineOptions({
name: "NotificationSelector"
name: "NotificationSelector",
});
const props = defineProps<{
@@ -89,12 +80,12 @@ const optionsDictRef = dict({
{
id: 0,
name: "使用默认通知",
icon: "ion:notifications"
icon: "ion:notifications",
},
...dict.data
...dict.data,
];
dict.setData(data);
}
},
});
const renderLabel = (option: any) => {
return <span>{option.name}</span>;
@@ -115,7 +106,7 @@ const selectSlots = ref({
// res.push(<a-space style="padding: 4px 8px" />);
// res.push(<fs-button class="w-100" type="text" icon="plus-outlined" text="新建通知渠道" onClick={openTableSelectDialog}></fs-button>);
return res;
}
},
});
const target: Ref<any> = ref({});
@@ -141,13 +132,13 @@ watch(
() => {
return props.modelValue;
},
async (value) => {
async value => {
await optionsDictRef.loadDict();
target.value = optionsDictRef.dataMap[value];
emit("selectedChange", target.value);
},
{
immediate: true
immediate: true,
}
);
@@ -27,7 +27,7 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
title: inputDefine.title,
form: {
...inputDefine,
show: compute((ctx) => {
show: compute(ctx => {
const form = formWrapperRef.value.getFormData();
if (!form) {
return false;
@@ -43,8 +43,8 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
}
}
return form?.certApplyPlugin === plugin.name && inputDefineShow;
})
}
}),
},
};
}
}
@@ -57,17 +57,17 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
wrapper: {
width: 1350,
saveRemind: false,
title: "创建证书流水线"
title: "创建证书流水线",
},
group: {
groups: {
more: {
header: "更多参数",
columns: moreParams,
collapsed: true
}
}
}
collapsed: true,
},
},
},
},
columns: {
certApplyPlugin: {
@@ -76,8 +76,8 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
dict: dict({
data: [
{ value: "CertApply", label: "JS-ACME" },
{ value: "CertApplyLego", label: "Lego-ACME" }
]
{ value: "CertApplyLego", label: "Lego-ACME" },
],
}),
form: {
order: 0,
@@ -90,21 +90,21 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
<li>Lego-ACMELego实现DNS提供商LEGO的用户可以使用</li>
</ul>
);
}
},
},
valueChange: {
handle: async ({ form, value }) => {
const config = await api.GetPluginConfig({
name: value,
type: "builtIn"
type: "builtIn",
});
if (config.sysSetting?.input) {
merge(form, config.sysSetting.input);
}
},
immediate: true
}
}
immediate: true,
},
},
},
...inputs,
triggerCron: {
@@ -115,11 +115,11 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
component: {
name: "cron-editor",
vModel: "modelValue",
placeholder: "0 0 4 * * *"
placeholder: "0 0 4 * * *",
},
helper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行",
order: 100
}
order: 100,
},
},
notification: {
title: "失败通知",
@@ -132,14 +132,14 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
on: {
selectedChange({ $event, form }) {
form.notificationTarget = $event;
}
}
},
},
},
order: 101,
helper: "任务执行失败实时提醒"
}
}
}
}
helper: "任务执行失败实时提醒",
},
},
},
},
};
}
@@ -76,7 +76,7 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
const addRequest = async ({ form }: AddReq) => {
if (form.content == null) {
form.content = JSON.stringify({
title: form.title
title: form.title,
});
} else {
//复制的流水线
@@ -106,7 +106,7 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
const max = suiteDetail.pipelineCount.max;
if (max != -1 && max <= suiteDetail.pipelineCount.used) {
notification.error({
message: `对不起,您最多只能创建${max}条流水线,请购买或升级套餐`
message: `对不起,您最多只能创建${max}条流水线,请购买或升级套餐`,
});
return;
}
@@ -124,7 +124,7 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
type: "custom",
when: ["error", "turnToSuccess", "success"],
notificationId: form.notification,
title: form.notificationTarget?.name || "自定义通知"
title: form.notificationTarget?.name || "自定义通知",
});
}
let pipeline = {
@@ -145,20 +145,20 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
runnableType: "step",
input: {
renewDays: 35,
...form
...form,
},
strategy: {
runStrategy: 0 // 正常执行
runStrategy: 0, // 正常执行
},
type: form.certApplyPlugin
}
]
}
]
}
type: form.certApplyPlugin,
},
],
},
],
},
],
triggers,
notifications
notifications,
};
pipeline = setRunnableIds(pipeline);
@@ -173,7 +173,7 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
content: JSON.stringify(pipeline),
keepHistoryCount: 30,
type: "cert",
from: "custom"
from: "custom",
});
message.success("创建成功,请添加证书部署任务");
router.push({ path: "/certd/pipeline/detail", query: { id, editMode: "true" } });
@@ -195,7 +195,7 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
width: 800,
content: () => {
return <CertView cert={cert}></CertView>;
}
},
});
};
@@ -230,7 +230,7 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
<div> {children}</div>
</div>
);
}
},
});
};
const userStore = useUserStore();
@@ -242,7 +242,7 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
pageRequest,
addRequest,
editRequest,
delRequest
delRequest,
},
settings: {
plugins: {
@@ -259,16 +259,16 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
selectedRowKeys,
onSelectedChanged(selected) {
console.log("已选择变化:", selected);
}
}
}
}
},
},
},
},
},
actionbar: {
buttons: {
add: {
order: 5,
text: "自定义流水线"
text: "自定义流水线",
},
addCertd: {
order: 1,
@@ -276,29 +276,29 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
type: "primary",
click() {
addCertdPipeline();
}
}
}
},
},
},
},
form: {
afterSubmit({ form, res, mode }) {
if (mode === "add") {
router.push({ path: "/certd/pipeline/detail", query: { id: res.id, editMode: "true" } });
}
}
},
},
table: {
scroll: { x: 1500 }
scroll: { x: 1500 },
},
tabs: {
name: "groupId",
show: true
show: true,
},
rowHandle: {
width: 200,
fixed: "right",
dropdown: {
show: true
show: true,
},
buttons: {
play: {
@@ -313,18 +313,18 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
async onOk() {
await api.Trigger(row.id);
notification.success({ message: "管道已经开始运行" });
}
},
});
}
},
},
view: {
show: false,
click({ row }) {
router.push({ path: "/certd/pipeline/detail", query: { id: row.id, editMode: "false" } });
}
},
},
copy: {
click: async (context) => {
click: async context => {
settingStore.checkPlus();
const { ui } = useUi();
// @ts-ignore
@@ -333,10 +333,10 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
row.title = row.title + "_copy";
await crudExpose.openCopy({
row: row,
index: context.index
index: context.index,
});
},
class: "need-plus"
class: "need-plus",
},
config: {
order: 1,
@@ -346,13 +346,13 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
icon: "ant-design:edit-outlined",
click({ row }) {
router.push({ path: "/certd/pipeline/detail", query: { id: row.id, editMode: "true" } });
}
},
},
edit: {
order: 2,
title: "修改配置/分组",
icon: "ant-design:setting-outlined",
dropdown: true
dropdown: true,
},
viewCert: {
order: 3,
@@ -361,7 +361,7 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
icon: "ph:certificate",
async click({ row }) {
await viewCert(row);
}
},
},
download: {
order: 4,
@@ -370,13 +370,13 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
icon: "ant-design:download-outlined",
async click({ row }) {
await downloadCert(row);
}
},
},
remove: {
order: 5,
dropdown: true
}
}
dropdown: true,
},
},
},
columns: {
id: {
@@ -384,14 +384,14 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
key: "id",
type: "number",
search: {
show: true
show: true,
},
column: {
width: 100
width: 100,
},
form: {
show: false
}
show: false,
},
},
userId: {
title: "用户Id",
@@ -399,17 +399,17 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
search: {
show: computed(() => {
return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
})
}),
},
form: {
show: false
show: false,
},
column: {
show: computed(() => {
return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
}),
width: 100
}
width: 100,
},
},
title: {
title: "流水线名称",
@@ -418,11 +418,11 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
show: true,
title: "关键字",
component: {
name: "a-input"
}
name: "a-input",
},
},
form: {
rules: [{ required: true, message: "此项必填" }]
rules: [{ required: true, message: "此项必填" }],
},
column: {
width: 350,
@@ -432,16 +432,16 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
// 注意:必须要on前缀
onClick({ row }) {
router.push({ path: "/certd/pipeline/detail", query: { id: row.id, editMode: "false" } });
}
}
}
}
},
},
},
},
},
content: {
title: "流水线内容",
form: { show: false },
column: {
show: false
show: false,
},
valueBuilder({ row }) {
if (row.content) {
@@ -463,18 +463,18 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
if (row.content) {
row.content = JSON.stringify(row.content);
}
}
},
},
_triggerCount: {
title: "定时任务数",
type: "number",
column: {
align: "center",
width: 100
width: 100,
},
form: {
show: false
}
show: false,
},
},
_stepCount: {
title: "部署任务数",
@@ -482,14 +482,14 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
form: { show: false },
column: {
align: "center",
width: 100
}
width: 100,
},
},
lastVars: {
title: "到期剩余",
type: "number",
form: {
show: false
show: false,
},
column: {
cellRender({ row }) {
@@ -501,52 +501,52 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
const percent = (leftDays / 90) * 100;
return <a-progress percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}`} />;
},
width: 150
}
width: 150,
},
},
"lastVars.certExpiresTime": {
title: "过期时间",
search: {
show: false
show: false,
},
type: "datetime",
form: {
show: false
show: false,
},
column: {
sorter: true,
align: "center"
}
align: "center",
},
},
status: {
title: "状态",
type: "dict-select",
search: {
show: true
show: true,
},
dict: dict({
data: statusUtil.getOptions()
data: statusUtil.getOptions(),
}),
form: {
show: false
show: false,
},
column: {
sorter: true,
width: 120,
align: "center"
}
align: "center",
},
},
lastHistoryTime: {
title: "最后运行",
type: "datetime",
form: {
show: false
show: false,
},
column: {
sorter: true,
width: 150,
align: "center"
}
align: "center",
},
},
disabled: {
title: "启用",
@@ -554,12 +554,12 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
dict: dict({
data: [
{ value: false, label: "启用" },
{ value: true, label: "禁用" }
]
{ value: true, label: "禁用" },
],
}),
form: {
value: false,
show: false
show: false,
},
column: {
sorter: true,
@@ -567,30 +567,30 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
align: "center",
component: {
name: "fs-dict-switch",
vModel: "checked"
vModel: "checked",
},
async valueChange({ row, key, value }) {
return await api.UpdateObj({
id: row.id,
disabled: row[key]
disabled: row[key],
});
}
}
},
},
},
groupId: {
title: "分组",
type: "dict-select",
search: {
show: true
show: true,
},
dict: groupDictRef,
column: {
width: 130,
align: "center",
component: {
color: "auto"
}
}
color: "auto",
},
},
},
order: {
title: "排序号",
@@ -598,48 +598,48 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
column: {
sorter: true,
align: "center",
width: 80
width: 80,
},
form: {
value: 0
}
value: 0,
},
},
keepHistoryCount: {
title: "历史记录保持数",
type: "number",
form: {
value: 20,
helper: "历史记录保持条数,多余的会被删除"
helper: "历史记录保持条数,多余的会被删除",
},
column: {
width: 130,
show: false
}
show: false,
},
},
createTime: {
title: "创建时间",
type: "datetime",
form: {
show: false
show: false,
},
column: {
sorter: true,
width: 155,
align: "center"
}
align: "center",
},
},
updateTime: {
title: "更新时间",
type: "datetime",
form: {
show: false
show: false,
},
column: {
width: 125,
show: false
}
}
}
}
show: false,
},
},
},
},
};
}