diff --git a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx
index c6850e07a..0dd90dbe8 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx
+++ b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx
@@ -85,46 +85,23 @@ export function useCertPipelineCreator() {
const settingStore = useSettingStore();
const router = useRouter();
- function createCrudOptions(certPlugins: any[], getFormData: any, doSubmit: any): CreateCrudOptionsRet {
+ function createCrudOptions(req: { certPlugin: any; doSubmit: any; title?: string }): CreateCrudOptionsRet {
const inputs: any = {};
const moreParams = [];
- for (const plugin of certPlugins) {
- for (const inputKey in plugin.input) {
- if (inputs[inputKey]) {
- //如果两个插件有的字段,直接显示
- inputs[inputKey].form.show = true;
- continue;
- }
- const inputDefine = cloneDeep(plugin.input[inputKey]);
- if (!inputDefine.required && !inputDefine.maybeNeed) {
- moreParams.push(inputKey);
- // continue;
- }
- useReference(inputDefine);
- inputs[inputKey] = {
- title: inputDefine.title,
- form: {
- ...inputDefine,
- show: compute(ctx => {
- const form = getFormData();
- if (!form) {
- return false;
- }
-
- let inputDefineShow = true;
- if (inputDefine.show != null) {
- const computeShow = inputDefine.show as any;
- if (computeShow === false) {
- inputDefineShow = false;
- } else if (computeShow && computeShow.computeFn) {
- inputDefineShow = computeShow.computeFn({ form });
- }
- }
- return form?.certApplyPlugin === plugin.name && inputDefineShow;
- }),
- },
- };
+ const doSubmit = req.doSubmit;
+ for (const inputKey in req.certPlugin.input) {
+ // inputs[inputKey].form.show = true;
+ const inputDefine = cloneDeep(req.certPlugin.input[inputKey]);
+ if (inputDefine.maybeNeed) {
+ moreParams.push(inputKey);
}
+ useReference(inputDefine);
+ inputs[inputKey] = {
+ title: inputDefine.title,
+ form: {
+ ...inputDefine,
+ },
+ };
}
const pluginStore = usePluginStore();
@@ -146,7 +123,7 @@ export function useCertPipelineCreator() {
wrapClassName: "cert_pipeline_create_form",
width: 1350,
saveRemind: false,
- title: t("certd.pipelineForm.createTitle"),
+ title: req.title || t("certd.pipelineForm.createTitle"),
},
group: {
groups: {
@@ -159,44 +136,44 @@ export function useCertPipelineCreator() {
},
},
columns: {
- certApplyPlugin: {
- title: t("certd.plugin.selectTitle"),
- type: "dict-select",
- dict: dict({
- data: [
- { value: "CertApply", label: "JS-ACME" },
- { value: "CertApplyLego", label: "Lego-ACME" },
- { value: "CertApplyGetFormAliyun", label: "Aliyun-Order" },
- ],
- }),
- form: {
- order: 0,
- value: "CertApply",
- helper: {
- render: () => {
- return (
-
- - {t("certd.plugin.jsAcme")}
- - {t("certd.plugin.legoAcme")}
- - {t("certd.plugin.aliyunOrder")}
-
- );
- },
- },
- valueChange: {
- handle: async ({ form, value }) => {
- const config = await pluginStore.getPluginConfig({
- name: value,
- type: "builtIn",
- });
- if (config.sysSetting?.input) {
- merge(form, config.sysSetting.input);
- }
- },
- immediate: true,
- },
- },
- },
+ // certApplyPlugin: {
+ // title: t("certd.plugin.selectTitle"),
+ // type: "dict-select",
+ // dict: dict({
+ // data: [
+ // { value: "CertApply", label: "JS-ACME" },
+ // { value: "CertApplyLego", label: "Lego-ACME" },
+ // { value: "CertApplyGetFormAliyun", label: "Aliyun-Order" },
+ // ],
+ // }),
+ // form: {
+ // order: 0,
+ // value: "CertApply",
+ // helper: {
+ // render: () => {
+ // return (
+ //
+ // - {t("certd.plugin.jsAcme")}
+ // - {t("certd.plugin.legoAcme")}
+ // - {t("certd.plugin.aliyunOrder")}
+ //
+ // );
+ // },
+ // },
+ // valueChange: {
+ // handle: async ({ form, value }) => {
+ // const config = await pluginStore.getPluginConfig({
+ // name: value,
+ // type: "builtIn",
+ // });
+ // if (config.sysSetting?.input) {
+ // merge(form, config.sysSetting.input);
+ // }
+ // },
+ // immediate: true,
+ // },
+ // },
+ // },
...inputs,
triggerCron: {
title: t("certd.pipelineForm.triggerCronTitle"),
@@ -336,18 +313,10 @@ export function useCertPipelineCreator() {
return certPlugins;
}
- async function openAddCertdPipelineDialog(req: { defaultGroupId?: number }) {
+ async function openAddCertdPipelineDialog(req: { pluginName: string; defaultGroupId?: number; title?: string }) {
//检查是否流水线数量超出限制
await checkPipelineLimit();
- const wrapperRef = ref();
- function getFormData() {
- if (!wrapperRef.value) {
- return null;
- }
- return wrapperRef.value.getFormData();
- }
-
async function doSubmit({ form }: any) {
// const certDetail = readCertDetail(form.cert.crt);
// 添加certd pipeline
@@ -375,7 +344,7 @@ export function useCertPipelineCreator() {
strategy: {
runStrategy: 0, // 正常执行
},
- type: form.certApplyPlugin,
+ type: req.pluginName,
},
],
},
@@ -410,11 +379,19 @@ export function useCertPipelineCreator() {
router.push({ path: "/certd/pipeline/detail", query: { id, editMode: "true" } });
}
const certPlugins = await getCertPlugins();
- const { crudOptions } = createCrudOptions(certPlugins, getFormData, doSubmit);
+ const certPlugin = certPlugins.find(plugin => plugin.name === req.pluginName);
+ if (!certPlugin) {
+ message.error("该证书申请插件不存在");
+ return;
+ }
+ const { crudOptions } = createCrudOptions({
+ certPlugin,
+ doSubmit,
+ title: req.title,
+ });
//@ts-ignore
crudOptions.columns.groupId.form.value = req.defaultGroupId || undefined;
- const wrapper = await openCrudFormDialog({ crudOptions });
- wrapperRef.value = wrapper;
+ await openCrudFormDialog({ crudOptions });
}
return {
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx
index 95610ff7b..347fe149c 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx
@@ -1,29 +1,26 @@
-import * as api from "./api";
+import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, useUi } from "@fast-crud/fast-crud";
+import { Modal, notification } from "ant-design-vue";
+import dayjs from "dayjs";
import { computed, ref } from "vue";
import { useRouter } from "vue-router";
-import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, useUi } from "@fast-crud/fast-crud";
-import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
-import { Modal, notification } from "ant-design-vue";
-import { useUserStore } from "/@/store/user";
-import dayjs from "dayjs";
+import * as api from "./api";
+import { GetDetail } from "./api";
+import { groupDictRef } from "./group/dicts";
import { useSettingStore } from "/@/store/settings";
-import { cloneDeep } from "lodash-es";
-import { eachStages } from "./utils";
-import { setRunnableIds, useCertPipelineCreator } from "/@/views/certd/pipeline/certd-form/use";
+import { useUserStore } from "/@/store/user";
import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use";
+import { setRunnableIds } from "/@/views/certd/pipeline/certd-form/use";
import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue";
+import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
import { useCertViewer } from "/@/views/certd/pipeline/use";
import { useI18n } from "/src/locales";
-import { GetDetail, GetObj } from "./api";
-import { groupDictRef } from "./group/dicts";
-export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
+export default function ({ crudExpose, context: { selectedRowKeys, openCertApplyDialog } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter();
const lastResRef = ref();
const { t } = useI18n();
- const { openAddCertdPipelineDialog } = useCertPipelineCreator();
const { openUploadCreateDialog } = useCertUpload();
const pageRequest = async (query: UserPageQuery): Promise => {
@@ -108,7 +105,8 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
actionbar: {
buttons: {
add: {
- order: 5,
+ order: 99,
+ show: false,
icon: "ion:ios-add-circle-outline",
text: t("certd.customPipeline"),
},
@@ -118,9 +116,7 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
type: "primary",
icon: "ion:ios-add-circle-outline",
click() {
- const searchForm = crudExpose.getSearchValidatedFormData();
- const defaultGroupId = searchForm.groupId;
- openAddCertdPipelineDialog({ defaultGroupId });
+ openCertApplyDialog({ key: "CertApply" });
},
},
uploadCert: {
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/index.vue
index 190a7fc51..2767ec459 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/index.vue
+++ b/packages/ui/certd-client/src/views/certd/pipeline/index.vue
@@ -9,6 +9,40 @@
-->
+
+
+
+ 更多流水线
+
+
+
+
+
+
+
+
+ 阿里云订阅证书流水线
+
+
+
+
+
+ Lego申请证书流水线
+
+
+
+
+
+ 自定义流水线
+
+
+
+
+
+
{{ t("certd.selectedCount", { count: selectedRowKeys.length }) }}
@@ -19,7 +53,6 @@
-
{{ t("certd.applyCertificate") }}
@@ -28,7 +61,7 @@