mirror of
https://github.com/certd/certd.git
synced 2026-04-14 12:30:54 +08:00
perf: 流水线修改编辑之后,增加未保存提示
This commit is contained in:
@@ -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 = {};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user