diff --git a/packages/libs/lib-server/src/basic/base-controller.ts b/packages/libs/lib-server/src/basic/base-controller.ts index 44960e59b..158eec008 100644 --- a/packages/libs/lib-server/src/basic/base-controller.ts +++ b/packages/libs/lib-server/src/basic/base-controller.ts @@ -47,4 +47,12 @@ export abstract class BaseController { } return user; } + + isAdmin() { + const roleIds: number[] = this.ctx?.user?.roles; + if (roleIds?.includes(1)) { + return true; + } + } + } diff --git a/packages/ui/certd-client/src/locales/langs/en-US/certd.ts b/packages/ui/certd-client/src/locales/langs/en-US/certd.ts index bebbbfb39..255d9e6b2 100644 --- a/packages/ui/certd-client/src/locales/langs/en-US/certd.ts +++ b/packages/ui/certd-client/src/locales/langs/en-US/certd.ts @@ -143,9 +143,10 @@ export default { validTimeHelper: "Not filled in means permanent validity", }, types: { - certApply: "Certificate Application", - certUpload: "Certificate Upload", + certApply: "Cert Apply", + certUpload: "Cert Upload", custom: "Custom", + template: "Template", }, myPipelines: "My Pipelines", selectedCount: "Selected {count} items", @@ -730,6 +731,10 @@ export default { addonName: "Name", addonNameHelper: "Fill freely, helps to distinguish when multiple same type exist", addonTypeSelect: "Select type", + dates: { + years: "{count} years", + months: "{count} months", + }, sys: { setting: { baseSetting: "Base Settings", @@ -737,8 +742,7 @@ export default { safeSetting: "Safe Settings", paymentSetting: "Payment Settings", captchaSetting: "Captcha Setting", - certSetting: "Certificate Apply Settings", - + pipelineSetting: "Pipeline Settings", showRunStrategy: "Show RunStrategy", showRunStrategyHelper: "Allow modify the run strategy of the task", diff --git a/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts b/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts index a89c444ec..e37f0a8d6 100644 --- a/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts +++ b/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts @@ -151,6 +151,7 @@ export default { certApply: "证书申请", certUpload: "证书上传", custom: "自定义", + template: "模版", }, myPipelines: "我的流水线", selectedCount: "已选择 {count} 项", @@ -730,6 +731,10 @@ export default { copyPipelineConfig: "复制该流水线配置作为模板来源", pipeline: "流水线", }, + dates: { + years: "{count}年", + months: "{count}月", + }, sys: { setting: { baseSetting: "基本设置", @@ -737,7 +742,7 @@ export default { safeSetting: "安全设置", paymentSetting: "支付设置", captchaSetting: "验证码设置", - certSetting: "证书申请设置", + pipelineSetting: "流水线设置", showRunStrategy: "显示运行策略选择", showRunStrategyHelper: "任务设置中是否允许选择运行策略", 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 523305d0e..de10d481f 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx @@ -466,7 +466,7 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys }, column: { sorter: true, - width: 80, + width: 100, align: "center", component: { name: "fs-dict-switch", @@ -513,7 +513,7 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys { value: "cert", label: t("certd.types.certApply") }, { value: "cert_upload", label: t("certd.types.certUpload") }, { value: "custom", label: t("certd.types.custom") }, - { value: "template", label: "模版" }, + { value: "template", label: t("certd.types.template") }, ], }), form: { @@ -522,7 +522,7 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys }, column: { sorter: true, - width: 90, + width: 110, align: "center", show: true, component: { @@ -560,7 +560,7 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys type: "date", form: { show: computed(() => { - return settingStore.isPlus && settingStore.sysPublic.pipelineValidTimeEnabled; + return settingStore.isPlus && settingStore.sysPublic.pipelineValidTimeEnabled && userStore.isAdmin; }), helper: t("certd.pi.validTimeHelper"), valueResolve({ form, key, value }) { @@ -573,6 +573,18 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys form[key] = dayjs(value); } }, + component: { + presets: [ + { label: t("certd.dates.months", { count: 3 }), value: dayjs().add(3, "month") }, + { label: t("certd.dates.months", { count: 6 }), value: dayjs().add(6, "month") }, + { label: t("certd.dates.years", { count: 1 }), value: dayjs().add(1, "year") }, + { label: t("certd.dates.years", { count: 2 }), value: dayjs().add(2, "year") }, + { label: t("certd.dates.years", { count: 3 }), value: dayjs().add(3, "year") }, + { label: t("certd.dates.years", { count: 4 }), value: dayjs().add(4, "year") }, + { label: t("certd.dates.years", { count: 5 }), value: dayjs().add(5, "year") }, + { label: t("certd.dates.years", { count: 6 }), value: dayjs().add(6, "year") }, + ], + }, }, column: { show: computed(() => { 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 164a1a793..39e748e22 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/index.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/index.vue @@ -26,7 +26,6 @@ import { onActivated, onMounted, ref } from "vue"; import { dict, useFs } from "@fast-crud/fast-crud"; import createCrudOptions from "./crud"; -import PiCertdForm from "./certd-form/index.vue"; import ChangeGroup from "./components/change-group.vue"; import ChangeTrigger from "./components/change-trigger.vue"; import { Modal, notification } from "ant-design-vue"; diff --git a/packages/ui/certd-client/src/views/sys/settings/index.vue b/packages/ui/certd-client/src/views/sys/settings/index.vue index 66ee8e423..1d03e55f9 100644 --- a/packages/ui/certd-client/src/views/sys/settings/index.vue +++ b/packages/ui/certd-client/src/views/sys/settings/index.vue @@ -20,8 +20,8 @@ - - + + @@ -34,7 +34,7 @@ import SettingRegister from "/@/views/sys/settings/tabs/register.vue"; import SettingPayment from "/@/views/sys/settings/tabs/payment.vue"; import SettingSafe from "/@/views/sys/settings/tabs/safe.vue"; import SettingCaptcha from "/@/views/sys/settings/tabs/captcha.vue"; -import SettingCert from "/@/views/sys/settings/tabs/cert.vue"; +import SettingPipeline from "/@/views/sys/settings/tabs/pipeline.vue"; import { useRoute, useRouter } from "vue-router"; import { ref } from "vue"; import { useSettingStore } from "/@/store/settings"; diff --git a/packages/ui/certd-client/src/views/sys/settings/tabs/cert.vue b/packages/ui/certd-client/src/views/sys/settings/tabs/pipeline.vue similarity index 79% rename from packages/ui/certd-client/src/views/sys/settings/tabs/cert.vue rename to packages/ui/certd-client/src/views/sys/settings/tabs/pipeline.vue index 46ee46f07..a9a44383f 100644 --- a/packages/ui/certd-client/src/views/sys/settings/tabs/cert.vue +++ b/packages/ui/certd-client/src/views/sys/settings/tabs/pipeline.vue @@ -1,6 +1,13 @@