pull/265/head
xiaojunnuo 2024-11-25 00:53:36 +08:00
parent c96fcb7afc
commit dd2b0a1595
13 changed files with 49 additions and 52 deletions

View File

@ -18,6 +18,8 @@ export class SysPublicSettings extends BaseSettings {
limitUserPipelineCount = 0; limitUserPipelineCount = 0;
managerOtherUserPipeline = false; managerOtherUserPipeline = false;
icpNo?: string; icpNo?: string;
defaultCron?: string;
defaultNotification?: number;
// triggerOnStartup = false; // triggerOnStartup = false;
} }

View File

@ -58,7 +58,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
}, },
required: true, required: true,
helper: helper:
"DNS直接验证域名是在阿里云、腾讯云、华为云、Cloudflare、西数注册的,选它。\nCNAME代理验证支持任何注册商注册的域名但第一次需要手动添加CNAME记录", "DNS直接验证域名是在阿里云、腾讯云、华为云、Cloudflare、NameSilo、西数注册的,选它。\nCNAME代理验证支持任何注册商注册的域名但第一次需要手动添加CNAME记录",
}) })
challengeType!: string; challengeType!: string;

View File

@ -24,11 +24,18 @@ export type PlusInfo = {
isComm?: boolean; isComm?: boolean;
}; };
export type SysPublicSetting = { export type SysPublicSetting = {
registerEnabled: boolean; registerEnabled?: boolean;
managerOtherUserPipeline: boolean; limitUserPipelineCount?: number;
managerOtherUserPipeline?: boolean;
icpNo?: string; icpNo?: string;
}; };
export type SysPrivateSetting = {
httpProxy?: string;
httpsProxy?: string;
dnsResultOrder?: string;
commonCnameEnabled?: boolean;
};
export type SysInstallInfo = { export type SysInstallInfo = {
siteId: string; siteId: string;
}; };

View File

@ -13,8 +13,9 @@
@error="onError" @error="onError"
/> />
</div> </div>
<div class="mt-5"> <div class="mt-5 flex">
<a-input :disabled="true" :readonly="readonly" :value="modelValue" @change="onChange"></a-input> <a-input :disabled="true" :readonly="readonly" :value="modelValue" @change="onChange"></a-input>
<fs-icon icon="ion:close-circle" class="pointer fs-16 ml-5 color-gray" title="清除选择" @click="onClear"></fs-icon>
</div> </div>
<div class="helper">下次触发时间{{ nextTime }}</div> <div class="helper">下次触发时间{{ nextTime }}</div>
<div class="fs-helper">{{ errorMessage }}</div> <div class="fs-helper">{{ errorMessage }}</div>
@ -35,8 +36,12 @@ const props = defineProps<{
}>(); }>();
const period = ref<string>(""); const period = ref<string>("");
if (props.modelValue == null) { if (props.modelValue == null || props.modelValue.endsWith("* * *")) {
period.value = "day"; period.value = "day";
} else if (props.modelValue.endsWith("* *")) {
period.value = "month";
} else if (props.modelValue.endsWith("*")) {
period.value = "year";
} }
const emit = defineEmits<{ const emit = defineEmits<{
"update:modelValue": any; "update:modelValue": any;
@ -74,6 +79,13 @@ const onError = (error: any) => {
errorMessage.value = error; errorMessage.value = error;
}; };
const onClear = () => {
if (props.disabled) {
return;
}
onUpdate("");
};
const nextTime = computed(() => { const nextTime = computed(() => {
if (props.modelValue == null) { if (props.modelValue == null) {
return "请先设置正确的cron表达式"; return "请先设置正确的cron表达式";

View File

@ -198,6 +198,9 @@ h1, h2, h3, h4, h5, h6 {
.color-green { .color-green {
color: green; color: green;
} }
.color-gray {
color: gray;
}
.iconify{ .iconify{
//font-size: 16px; //font-size: 16px;

View File

@ -110,7 +110,6 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
const define = await api.GetProviderDefine(value); const define = await api.GetProviderDefine(value);
currentDefine.value = define; currentDefine.value = define;
console.log("define", define); console.log("define", define);
debugger;
if (!immediate) { if (!immediate) {
form.body = {}; form.body = {};
} }

View File

@ -23,7 +23,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const addRequest = async (req: AddReq) => { const addRequest = async (req: AddReq) => {
const { form } = req; const { form } = req;
debugger;
const res = await api.AddObj(form); const res = await api.AddObj(form);
return res; return res;
}; };

View File

@ -7,7 +7,7 @@
<span v-else class="mlr-5 text-gray">{{ placeholder }}</span> <span v-else class="mlr-5 text-gray">{{ placeholder }}</span>
<a-button class="ml-5" :disabled="disabled" :size="size" @click="chooseForm.open"></a-button> <a-button class="ml-5" :disabled="disabled" :size="size" @click="chooseForm.open"></a-button>
<a-form-item-rest v-if="chooseForm.show"> <a-form-item-rest v-if="chooseForm.show">
<a-modal v-model:open="chooseForm.show" title="选择通知" width="900px" @ok="chooseForm.ok"> <a-modal v-model:open="chooseForm.show" title="选择通知渠道" width="900px" @ok="chooseForm.ok">
<div style="height: 400px; position: relative"> <div style="height: 400px; position: relative">
<cert-notification-modal v-model="selectedId"></cert-notification-modal> <cert-notification-modal v-model="selectedId"></cert-notification-modal>
</div> </div>

View File

@ -5,6 +5,7 @@ import _, { merge } from "lodash-es";
import { useUserStore } from "/@/store/modules/user"; import { useUserStore } from "/@/store/modules/user";
import { useSettingStore } from "/@/store/modules/settings"; import { useSettingStore } from "/@/store/modules/settings";
import * as api from "../api.plugin"; import * as api from "../api.plugin";
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
export default function (certPluginGroup: PluginGroup, formWrapperRef: any): CreateCrudOptionsRet { export default function (certPluginGroup: PluginGroup, formWrapperRef: any): CreateCrudOptionsRet {
const inputs: any = {}; const inputs: any = {};
const userStore = useUserStore(); const userStore = useUserStore();
@ -102,30 +103,16 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
order: 100 order: 100
} }
}, },
emailNotify: { notification: {
title: "失败邮件通知", title: "失败通知",
type: "dict-switch", type: "text",
dict: dict({
data: [
{ value: true, label: "启用" },
{ value: false, label: "不启用" }
]
}),
form: { form: {
component: {
name: NotificationSelector,
vModel: "modelValue"
},
order: 101, order: 101,
value: true, helper: "建议设置,任务执行失败实时提醒"
helper: {
render: () => {
if (settingStore.isPlus) {
return "建议启用";
}
return (
<div>
<router-link to={{ path: "/sys/settings/email" }}></router-link>
</div>
);
}
}
} }
} }
} }

View File

@ -14,7 +14,7 @@ import * as _ from "lodash-es";
import { useModal } from "/@/use/use-modal"; import { useModal } from "/@/use/use-modal";
import CertView from "./cert-view.vue"; import CertView from "./cert-view.vue";
import { eachStages } from "./utils"; import { eachStages } from "./utils";
import { createApi as createNotificationApi } from "../notification/api";
export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
@ -102,13 +102,13 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } }); triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } });
} }
const notifications = []; const notifications = [];
if (form.emailNotify) { if (form.notification) {
const notify = await createNotificationApi().GetSimpleInfo(form.notification);
notifications.push({ notifications.push({
type: "email", type: "custom",
when: ["error", "turnToSuccess"], when: ["error", "turnToSuccess"],
options: { notificationId: form.notification,
receivers: [form.email] title: notify.name
}
}); });
} }
let pipeline = { let pipeline = {

View File

@ -75,7 +75,8 @@ export type PluginConfigBean = {
}; };
export type CertApplyPluginSysInput = { export type CertApplyPluginSysInput = {
googleCommonEabAccessId: number; googleCommonEabAccessId?: number;
zerosslCommonEabAccessId?: number;
}; };
export type PluginSysSetting<T> = { export type PluginSysSetting<T> = {
sysSetting: { sysSetting: {

View File

@ -1,22 +1,9 @@
// @ts-ignore // @ts-ignore
import { request } from "/@/api/service"; import { request } from "/@/api/service";
import { SysPrivateSetting, SysPublicSetting } from "/@/api/modules/api.basic";
const apiPrefix = "/sys/settings"; const apiPrefix = "/sys/settings";
export type SysSettings = { public: SysPublicSetting; private: SysPrivateSetting }; export type SysSettings = { public: SysPublicSetting; private: SysPrivateSetting };
export type SysPublicSetting = {
registerEnabled?: boolean;
limitUserPipelineCount?: number;
managerOtherUserPipeline?: boolean;
icpNo?: string;
};
export type SysPrivateSetting = {
httpProxy?: string;
httpsProxy?: string;
dnsResultOrder?: string;
commonCnameEnabled?: boolean;
};
export const SettingKeys = { export const SettingKeys = {
SysPublic: "sys.public", SysPublic: "sys.public",
SysPrivate: "sys.private", SysPrivate: "sys.private",

View File

@ -73,7 +73,7 @@ import { notification } from "ant-design-vue";
import { useSettingStore } from "/@/store/modules/settings"; import { useSettingStore } from "/@/store/modules/settings";
import { merge } from "lodash-es"; import { merge } from "lodash-es";
import { util } from "/@/utils"; import { util } from "/@/utils";
import NotificationSelector from "/src/views/certd/notification/notification-selector/index.vue";
defineOptions({ defineOptions({
name: "SysSettings" name: "SysSettings"
}); });