mirror of
https://github.com/certd/certd.git
synced 2026-05-01 10:27:31 +08:00
fix: 修复流水线未编辑模式下也提示未保存的bug
This commit is contained in:
@@ -374,7 +374,7 @@ export default defineComponent({
|
|||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
onBeforeRouteLeave((to, from) => {
|
onBeforeRouteLeave((to, from) => {
|
||||||
const newPipelineStr = JSON.stringify(pipeline.value || {});
|
const newPipelineStr = JSON.stringify(pipeline.value || {});
|
||||||
if (pipelineOriginStr.value && pipelineOriginStr.value !== newPipelineStr) {
|
if (props.editMode && pipelineOriginStr.value && pipelineOriginStr.value !== newPipelineStr) {
|
||||||
const answer = window.confirm("流水线还未保存,确定要离开吗?");
|
const answer = window.confirm("流水线还未保存,确定要离开吗?");
|
||||||
if (!answer) {
|
if (!answer) {
|
||||||
return false; // 返回 false 即可阻止本次路由跳转
|
return false; // 返回 false 即可阻止本次路由跳转
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { dict, useFormWrapper } from "@fast-crud/fast-crud";
|
import { compute, dict, useFormWrapper } from "@fast-crud/fast-crud";
|
||||||
import { checkPipelineLimit, eachSteps } from "/@/views/certd/pipeline/utils";
|
import { checkPipelineLimit, eachSteps } from "/@/views/certd/pipeline/utils";
|
||||||
import { templateApi } from "/@/views/certd/pipeline/template/api";
|
import { templateApi } from "/@/views/certd/pipeline/template/api";
|
||||||
import TemplateForm from "./form.vue";
|
import TemplateForm from "./form.vue";
|
||||||
@@ -7,6 +7,7 @@ import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue";
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { fillPipelineByDefaultForm } from "/@/views/certd/pipeline/certd-form/use";
|
import { fillPipelineByDefaultForm } from "/@/views/certd/pipeline/certd-form/use";
|
||||||
import { cloneDeep } from "lodash-es";
|
import { cloneDeep } from "lodash-es";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
export function createExtraColumns() {
|
export function createExtraColumns() {
|
||||||
const groupDictRef = dict({
|
const groupDictRef = dict({
|
||||||
@@ -14,24 +15,82 @@ export function createExtraColumns() {
|
|||||||
value: "id",
|
value: "id",
|
||||||
label: "name",
|
label: "name",
|
||||||
});
|
});
|
||||||
|
const { t } = useI18n();
|
||||||
const randomHour = Math.floor(Math.random() * 6);
|
const randomHour = Math.floor(Math.random() * 6);
|
||||||
const randomMin = Math.floor(Math.random() * 60);
|
const randomMin = Math.floor(Math.random() * 60);
|
||||||
return {
|
return {
|
||||||
triggerCron: {
|
// triggerCron: {
|
||||||
title: "定时触发",
|
// title: "定时触发",
|
||||||
type: "text",
|
// type: "text",
|
||||||
|
// form: {
|
||||||
|
// value: `0 ${randomMin} ${randomHour} * * *`,
|
||||||
|
// component: {
|
||||||
|
// name: "cron-editor",
|
||||||
|
// vModel: "modelValue",
|
||||||
|
// placeholder: "0 0 4 * * *",
|
||||||
|
// },
|
||||||
|
// col: {
|
||||||
|
// span: 24,
|
||||||
|
// },
|
||||||
|
// helper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行",
|
||||||
|
// order: 100,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
|
||||||
|
random: {
|
||||||
|
title: "定时类型",
|
||||||
|
form: {
|
||||||
|
value: true,
|
||||||
|
helper: "是否给流水线随机设置一个时间",
|
||||||
|
show: compute(({ form }) => {
|
||||||
|
return form.clear !== true;
|
||||||
|
}),
|
||||||
|
component: {
|
||||||
|
name: "fs-dict-switch",
|
||||||
|
vModel: "checked",
|
||||||
|
dict: dict({
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
label: "随机时间",
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "固定时间",
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
randomRange: {
|
||||||
|
title: "随机时间范围",
|
||||||
|
form: {
|
||||||
|
value: ["00:00:00", "08:00:00"],
|
||||||
|
helper: "随机时间范围,单位秒",
|
||||||
|
component: {
|
||||||
|
// <a-time-range-picker :bordered="false" />
|
||||||
|
name: "a-time-range-picker",
|
||||||
|
vModel: "value",
|
||||||
|
valueFormat: "HH:mm:ss",
|
||||||
|
},
|
||||||
|
show: compute(({ form }) => {
|
||||||
|
return form.clear !== true && form.random === true;
|
||||||
|
}),
|
||||||
|
rules: [{ required: true, message: "请选择随机时间范围" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
triggerCron: {
|
||||||
|
title: t("certd.schedule"),
|
||||||
form: {
|
form: {
|
||||||
value: `0 ${randomMin} ${randomHour} * * *`,
|
|
||||||
component: {
|
component: {
|
||||||
name: "cron-editor",
|
name: "cron-editor",
|
||||||
vModel: "modelValue",
|
vModel: "modelValue",
|
||||||
placeholder: "0 0 4 * * *",
|
|
||||||
},
|
},
|
||||||
col: {
|
show: compute(({ form }) => {
|
||||||
span: 24,
|
return form.clear !== true && form?.random !== true;
|
||||||
},
|
}),
|
||||||
helper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行",
|
rules: [{ required: true, message: t("certd.selectCron") }],
|
||||||
order: 100,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
notification: {
|
notification: {
|
||||||
|
|||||||
Reference in New Issue
Block a user