perf: 流水线修改编辑之后,增加未保存提示

This commit is contained in:
xiaojunnuo
2026-04-11 23:41:20 +08:00
parent d05129ec67
commit 21620ac6bd
3 changed files with 18 additions and 4 deletions

View File

@@ -126,7 +126,7 @@ export function createAxiosService({ logger }: { logger: ILogger }) {
if (config.skipSslVerify || config.httpProxy) {
let rejectUnauthorized = true;
if (config.skipSslVerify) {
logger.info("跳过SSL验");
logger.info("忽略接口请求的SSL验");
rejectUnauthorized = false;
}
const proxy: any = {};

View File

@@ -334,7 +334,7 @@ import { useCertViewer } from "/@/views/certd/pipeline/use";
import { useI18n } from "/@/locales";
import TriggerIcon from "./component/trigger-icon.vue";
import { useCrudPermission } from "/@/plugin/permission";
import { onBeforeRouteLeave } from "vue-router";
export default defineComponent({
name: "PipelineEdit",
// eslint-disable-next-line vue/no-unused-components
@@ -372,10 +372,22 @@ export default defineComponent({
},
emits: ["update:modelValue", "update:editMode"],
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();
//右侧选中的pipeline
const currentPipeline: Ref<any> = ref({});
const pipeline: Ref<any> = ref({});
const pipelineOriginStr = ref("");
const pipelineDetail: Ref<any> = ref({});
const histories: Ref<RunHistory[]> = ref([]);
@@ -423,6 +435,7 @@ export default defineComponent({
await loadCurrentHistoryDetail();
pipeline.value = currentHistory.value.pipeline;
currentPipeline.value = currentHistory.value.pipeline;
pipelineOriginStr.value = JSON.stringify(pipeline.value);
};
async function loadHistoryList(reload = false, historyId: number = null) {
@@ -880,6 +893,7 @@ export default defineComponent({
pipeline.value.version = version;
currentPipeline.value.version = version;
}
pipelineOriginStr.value = JSON.stringify(pipeline.value);
}
if (offEdit) {
toggleEditMode(false);

View File

@@ -63,18 +63,18 @@ export class OnePanelDeployToPanelPlugin extends AbstractTaskPlugin {
helper: "SSL模式只有2.1.x以上版本才支持旧版本保持默认即可",
component: {
name: "a-select",
vMode: "value",
options: [
{ label: "启用SSL(旧版本)", value: "enable" },
{ label: "Strict模式(>=2.1.x)", value: "Enable" },
{ label: "Mux模式(>=2.1.x)", value: "Mux" }
],
value: "enable",
},
value: "enable",
required: true,
})
sslMode!: string;
access: OnePanelAccess;
async onInstance() {
this.access = await this.getAccess(this.accessId);