Skip to content

Commit

Permalink
Merge pull request #1609 from hLinx/3.6.x
Browse files Browse the repository at this point in the history
format: 代码命名调整 #1608
  • Loading branch information
hLinx authored Dec 13, 2022
2 parents 5dd3c39 + eaca07b commit b0bc42b
Show file tree
Hide file tree
Showing 47 changed files with 148 additions and 149 deletions.
2 changes: 1 addition & 1 deletion src/frontend/src/components/global-variable/edit/array.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
},
handleChange (value) {
this.value = value.trim();
window.changeConfirm = true;
window.changeFlag = true;
},
reset () {
this.init();
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/components/global-variable/edit/host.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
* @desc 外部调用——移除无效主机
*/
removeAllInvalidHost () {
window.changeConfirm = true;
window.changeFlag = true;
this.$refs.choostIP.removeAllInvalidHost();
},
/**
Expand All @@ -140,14 +140,14 @@
handleClear () {
const { hostNodeInfo } = new TaskHostNodeModel({});
this.hostNodeInfo = hostNodeInfo;
window.changeConfirm = true;
window.changeFlag = true;
},
/**
* @desc 提交编辑的数据
*/
handleChange (hostNodeInfo) {
this.hostNodeInfo = Object.freeze(hostNodeInfo);
window.changeConfirm = true;
window.changeFlag = true;
},
/**
* @desc 外部调用——还原默认值
Expand All @@ -161,7 +161,7 @@
*/
validate () {
const { type, id, name } = this.data;

const data = {
id,
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
handleChange (value) {
this.value = value.trim();
window.changeConfirm = true;
window.changeFlag = true;
},
reset () {
this.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
},
handleChange (value) {
this.value = value.trim();
window.changeConfirm = true;
window.changeFlag = true;
},
reset () {
this.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
},
handleChange (value) {
this.value = value.trim();
window.changeConfirm = true;
window.changeFlag = true;
},
reset () {
this.init();
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/components/jb-dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
setTimeout(() => {
if (val) {
this.isRender = true;
this.pageChangeConfirmMemo = window.changeConfirm;
window.changeConfirm = 'dialog';
this.pageChangeConfirmMemo = window.changeFlag;
window.changeFlag = 'dialog';
this.calcMediaWidth();
}
this.isShow = val;
Expand Down Expand Up @@ -177,7 +177,7 @@
* @desc 关闭弹框
*/
close () {
window.changeConfirm = this.pageChangeConfirmMemo;
window.changeFlag = this.pageChangeConfirmMemo;
this.$emit('input', false);
this.$emit('change', false);
},
Expand All @@ -198,7 +198,7 @@
// submit 有可能返回不是 Promise, 用 Promise 包裹兼容这种情况
Promise.resolve(this.checkHandle().submit())
.then(() => {
window.changeConfirm = false;
window.changeFlag = false;
this.close();
})
.finally(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/jb-form/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
handler () {
setTimeout(() => {
if (this.isApplyChange) {
window.changeConfirm = true;
window.changeFlag = true;
}
});
},
Expand Down
14 changes: 7 additions & 7 deletions src/frontend/src/components/jb-sideslider/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@
if (val) {
this.isRender = true;
// 当页面可以进行编辑时,其中一项是通过sideslider来编辑的,需要先记录页面的编辑状态
this.pageChangeConfirmMemo = window.changeConfirm;
window.changeConfirm = 'dialog';
this.pageChangeConfirmMemo = window.changeFlag;
window.changeFlag = 'dialog';
this.getMediaWidth();
this.$nextTick(() => {
observer.observe(this.$refs.content, {
Expand Down Expand Up @@ -206,7 +206,7 @@
if (!this.media.length) {
return;
}

const queryRange = [
// 1366,
1680,
Expand All @@ -215,7 +215,7 @@
];
const windowHeight = window.innerWidth;
let index = 0;

queryRange.forEach((mediaWidth) => {
if (mediaWidth < windowHeight) {
index = index + 1;
Expand All @@ -240,7 +240,7 @@
// eslint-disable-next-line no-plusplus
for (let i = 0; i < $elList.length; i++) {
const currentEl = $elList[i];

const { height } = currentEl.getBoundingClientRect();
if (height === 0) {
return false;
Expand Down Expand Up @@ -296,7 +296,7 @@
* @desc 关闭弹层
*/
close () {
window.changeConfirm = this.pageChangeConfirmMemo;
window.changeFlag = this.pageChangeConfirmMemo;
this.$emit('update:isShow', false);
},
/**
Expand All @@ -306,7 +306,7 @@
this.isSubmiting = true;
Promise.resolve(this.checkHandle().submit())
.then(() => {
window.changeConfirm = false;
window.changeFlag = false;
this.close();
})
.finally(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/components/operation-tag/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,23 @@
*/
const handleSubmit = () => {
state.isSubmiting = true;

return formRef.value.validate()
.then(() => {
if (isEdit.value) {
return TagManageService.updateTag({
id: props.data.id,
...state.formData,
}).then(() => {
window.changeConfirm = false;
window.changeFlag = false;
ctx.emit('on-change');
proxy.messageSuccess(I18n.t('编辑标签成功'));
closeDialog();
});
}
return TagManageService.createTag(state.formData)
.then((data) => {
window.changeConfirm = false;
window.changeFlag = false;
ctx.emit('on-change', new TagModel(data));
proxy.messageSuccess(I18n.t('新建标签成功'));
closeDialog();
Expand All @@ -207,7 +207,7 @@
closeDialog();
});
};

return {
...toRefs(state),
formRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
created () {
if (this.variable.length > 0) {
this.handleVariableChange(this.variable[0].name);
// 设置默认数据,需要取消 window.changeConfirm 的状态
window.changeConfirm = false;
// 设置默认数据,需要取消 window.changeFlag 的状态
window.changeFlag = false;
// 设置默认数据,需要取消服务器文件的编辑状态
this.editNewSourceFile(false);
}
Expand All @@ -180,7 +180,7 @@
*/
handleFileChange (fileLocation) {
this.serverFile.fileLocation = fileLocation;
window.changeConfirm = true;
window.changeFlag = true;
this.editNewSourceFile(true);
},
/**
Expand All @@ -206,7 +206,7 @@
return;
}
this.serverFile.host.variable = variable;
window.changeConfirm = true;
window.changeFlag = true;
this.editNewSourceFile(true);
const formItem = findParent(this, 'JbFormItem');
if (formItem) {
Expand All @@ -226,7 +226,7 @@
* @param {Object} hostNodeInfo 主机值
*/
handleHostChange (hostNodeInfo) {
window.changeConfirm = true;
window.changeFlag = true;
this.serverFile.host.hostNodeInfo = hostNodeInfo;
this.editNewSourceFile(true);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
* store记录服务器文件的编辑状态
*/
handleFileChange (fileLocation) {
window.changeConfirm = true;
window.changeFlag = true;
this.serverFile.fileLocation = fileLocation;
this.editNewSourceFile(true);
},
Expand All @@ -149,7 +149,7 @@
*/
handleHostChange (hostNodeInfo) {
this.serverFile.host.hostNodeInfo = Object.freeze(hostNodeInfo);
window.changeConfirm = true;
window.changeFlag = true;
this.editNewSourceFile(true);
},
/**
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ console.log(
/**
* @desc 页面数据的编辑状态
*/
window.changeConfirm = false;
window.changeFlag = false;

/**
* @desc 因为 IP 有白名单功能,生效范围需要更新场景区分
Expand Down Expand Up @@ -84,7 +84,7 @@ if (oldExecute) {
*/
window.addEventListener('beforeunload', (event) => {
// 需要做 Boolean 类型的值判断
if (window.changeConfirm !== true) {
if (window.changeFlag !== true) {
return null;
}
const e = event || window.event;
Expand Down
5 changes: 2 additions & 3 deletions src/frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default ({ appList, isAdmin, scopeType, scopeId }) => {
let isValidScope = false;
// scope 是有有权限查看
let hasScopePermission = false;

const appInfo = appList.find(_ => _.scopeType === scopeType && _.scopeId === scopeId);
// scope 存在于业务列表中——有效的 scope
if (appInfo) {
Expand Down Expand Up @@ -230,7 +230,7 @@ export default ({ appList, isAdmin, scopeType, scopeId }) => {
window.location.href = lastRouterHrefCache;
}
});

router.afterEach(() => {
history.pushState(null, null, document.URL);
const callback = () => {
Expand All @@ -243,7 +243,6 @@ export default ({ appList, isAdmin, scopeType, scopeId }) => {
history.pushState(null, null, document.URL);
});
};

window.addEventListener('popstate', callback);

const currentRoute = _.last(router.currentRoute.matched);
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/utils/assist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ export const downloadUrl = (url) => {
const eleLink = document.createElement('a');
eleLink.style.display = 'none';
eleLink.href = url;

// 触发点击
document.body.appendChild(eleLink);
const { changeAlert } = window;
window.changeConfirm = false;
window.changeFlag = false;
eleLink.click();
setTimeout(() => {
window.changeConfirm = changeAlert;
window.changeFlag = changeAlert;
});

// 然后移除
document.body.removeChild(eleLink);
};
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/utils/assist/leave-confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import I18n from '@/i18n';
* @returns { Promise }
*/
export const leaveConfirm = (message = I18n.t('离开将会导致未保存信息丢失')) => {
if (!window.changeConfirm || window.changeConfirm === 'dialog') {
if (!window.changeFlag || window.changeFlag === 'dialog') {
return Promise.resolve(true);
}
const vm = new Vue();
Expand All @@ -48,7 +48,7 @@ export const leaveConfirm = (message = I18n.t('离开将会导致未保存信息
},
}, message),
confirmFn: () => {
window.changeConfirm = false;
window.changeFlag = false;
resolve(true);
},
cancelFn: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
theme: 'success',
message: I18n.t('history.操作成功'),
});
window.changeConfirm = false;
window.changeFlag = false;
this.$router.push({
name: 'historyTask',
params: {
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/views/fast-execution/distro-file/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
transferMode,
uploadSpeedLimit,
} = data.stepInfo.fileStepInfo;

this.formData = {
...this.formData,
name,
Expand Down Expand Up @@ -481,7 +481,7 @@
rollingExpr,
rollingMode,
} = this.formData;

return TaskExecuteService.pushFile({
name,
uploadSpeedLimit: parseInt(uploadSpeedLimit, 10),
Expand All @@ -500,7 +500,7 @@
mode: rollingMode,
},
}).then((data) => {
window.changeConfirm = false;
window.changeFlag = false;
this.$router.push({
name: 'quickLaunchStep',
params: {
Expand Down
Loading

0 comments on commit b0bc42b

Please sign in to comment.