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;
managerOtherUserPipeline = false;
icpNo?: string;
defaultCron?: string;
defaultNotification?: number;
// triggerOnStartup = false;
}

View File

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

View File

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

View File

@ -13,8 +13,9 @@
@error="onError"
/>
</div>
<div class="mt-5">
<div class="mt-5 flex">
<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 class="helper">下次触发时间{{ nextTime }}</div>
<div class="fs-helper">{{ errorMessage }}</div>
@ -35,8 +36,12 @@ const props = defineProps<{
}>();
const period = ref<string>("");
if (props.modelValue == null) {
if (props.modelValue == null || props.modelValue.endsWith("* * *")) {
period.value = "day";
} else if (props.modelValue.endsWith("* *")) {
period.value = "month";
} else if (props.modelValue.endsWith("*")) {
period.value = "year";
}
const emit = defineEmits<{
"update:modelValue": any;
@ -74,6 +79,13 @@ const onError = (error: any) => {
errorMessage.value = error;
};
const onClear = () => {
if (props.disabled) {
return;
}
onUpdate("");
};
const nextTime = computed(() => {
if (props.modelValue == null) {
return "请先设置正确的cron表达式";

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
<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-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">
<cert-notification-modal v-model="selectedId"></cert-notification-modal>
</div>

View File

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

View File

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

View File

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

View File

@ -1,22 +1,9 @@
// @ts-ignore
import { request } from "/@/api/service";
import { SysPrivateSetting, SysPublicSetting } from "/@/api/modules/api.basic";
const apiPrefix = "/sys/settings";
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 = {
SysPublic: "sys.public",
SysPrivate: "sys.private",

View File

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