mirror of
https://github.com/certd/certd.git
synced 2026-04-28 07:57:25 +08:00
perf: 流水线修改编辑之后,增加未保存提示
This commit is contained in:
@@ -126,7 +126,7 @@ export function createAxiosService({ logger }: { logger: ILogger }) {
|
|||||||
if (config.skipSslVerify || config.httpProxy) {
|
if (config.skipSslVerify || config.httpProxy) {
|
||||||
let rejectUnauthorized = true;
|
let rejectUnauthorized = true;
|
||||||
if (config.skipSslVerify) {
|
if (config.skipSslVerify) {
|
||||||
logger.info("跳过SSL验证");
|
logger.info("忽略接口请求的SSL校验");
|
||||||
rejectUnauthorized = false;
|
rejectUnauthorized = false;
|
||||||
}
|
}
|
||||||
const proxy: any = {};
|
const proxy: any = {};
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ import { useCertViewer } from "/@/views/certd/pipeline/use";
|
|||||||
import { useI18n } from "/@/locales";
|
import { useI18n } from "/@/locales";
|
||||||
import TriggerIcon from "./component/trigger-icon.vue";
|
import TriggerIcon from "./component/trigger-icon.vue";
|
||||||
import { useCrudPermission } from "/@/plugin/permission";
|
import { useCrudPermission } from "/@/plugin/permission";
|
||||||
|
import { onBeforeRouteLeave } from "vue-router";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "PipelineEdit",
|
name: "PipelineEdit",
|
||||||
// eslint-disable-next-line vue/no-unused-components
|
// eslint-disable-next-line vue/no-unused-components
|
||||||
@@ -372,10 +372,22 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
emits: ["update:modelValue", "update:editMode"],
|
emits: ["update:modelValue", "update:editMode"],
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
|
onBeforeRouteLeave((to, from) => {
|
||||||
|
const newPipelineStr = JSON.stringify(pipeline.value || {});
|
||||||
|
if (pipelineOriginStr.value && pipelineOriginStr.value !== newPipelineStr) {
|
||||||
|
const answer = window.confirm("流水线还未保存,确定要离开吗?");
|
||||||
|
if (!answer) {
|
||||||
|
return false; // 返回 false 即可阻止本次路由跳转
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
//右侧选中的pipeline
|
//右侧选中的pipeline
|
||||||
const currentPipeline: Ref<any> = ref({});
|
const currentPipeline: Ref<any> = ref({});
|
||||||
const pipeline: Ref<any> = ref({});
|
const pipeline: Ref<any> = ref({});
|
||||||
|
const pipelineOriginStr = ref("");
|
||||||
const pipelineDetail: Ref<any> = ref({});
|
const pipelineDetail: Ref<any> = ref({});
|
||||||
const histories: Ref<RunHistory[]> = ref([]);
|
const histories: Ref<RunHistory[]> = ref([]);
|
||||||
|
|
||||||
@@ -423,6 +435,7 @@ export default defineComponent({
|
|||||||
await loadCurrentHistoryDetail();
|
await loadCurrentHistoryDetail();
|
||||||
pipeline.value = currentHistory.value.pipeline;
|
pipeline.value = currentHistory.value.pipeline;
|
||||||
currentPipeline.value = currentHistory.value.pipeline;
|
currentPipeline.value = currentHistory.value.pipeline;
|
||||||
|
pipelineOriginStr.value = JSON.stringify(pipeline.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
async function loadHistoryList(reload = false, historyId: number = null) {
|
async function loadHistoryList(reload = false, historyId: number = null) {
|
||||||
@@ -880,6 +893,7 @@ export default defineComponent({
|
|||||||
pipeline.value.version = version;
|
pipeline.value.version = version;
|
||||||
currentPipeline.value.version = version;
|
currentPipeline.value.version = version;
|
||||||
}
|
}
|
||||||
|
pipelineOriginStr.value = JSON.stringify(pipeline.value);
|
||||||
}
|
}
|
||||||
if (offEdit) {
|
if (offEdit) {
|
||||||
toggleEditMode(false);
|
toggleEditMode(false);
|
||||||
|
|||||||
@@ -63,18 +63,18 @@ export class OnePanelDeployToPanelPlugin extends AbstractTaskPlugin {
|
|||||||
helper: "SSL模式,只有2.1.x以上版本才支持,旧版本保持默认即可",
|
helper: "SSL模式,只有2.1.x以上版本才支持,旧版本保持默认即可",
|
||||||
component: {
|
component: {
|
||||||
name: "a-select",
|
name: "a-select",
|
||||||
|
vMode: "value",
|
||||||
options: [
|
options: [
|
||||||
{ label: "启用SSL(旧版本)", value: "enable" },
|
{ label: "启用SSL(旧版本)", value: "enable" },
|
||||||
{ label: "Strict模式(>=2.1.x)", value: "Enable" },
|
{ label: "Strict模式(>=2.1.x)", value: "Enable" },
|
||||||
{ label: "Mux模式(>=2.1.x)", value: "Mux" }
|
{ label: "Mux模式(>=2.1.x)", value: "Mux" }
|
||||||
],
|
],
|
||||||
value: "enable",
|
|
||||||
},
|
},
|
||||||
|
value: "enable",
|
||||||
required: true,
|
required: true,
|
||||||
})
|
})
|
||||||
sslMode!: string;
|
sslMode!: string;
|
||||||
|
|
||||||
|
|
||||||
access: OnePanelAccess;
|
access: OnePanelAccess;
|
||||||
async onInstance() {
|
async onInstance() {
|
||||||
this.access = await this.getAccess(this.accessId);
|
this.access = await this.getAccess(this.accessId);
|
||||||
|
|||||||
Reference in New Issue
Block a user