Skip to content

Commit

Permalink
perf: multi window restart issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyzyykk committed Jan 6, 2025
1 parent 19b44f2 commit 7f45f09
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion front/terminal/src/components/tcode/Tcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export const SysTcode = {
if(context.proxy.socket) context.proxy.socket.close(3333); // 主动释放资源,必需
// 进行重启
context.proxy.closeFileBlock();
context.proxy.doSSHConnect();
context.proxy.resetTerminal();
context.proxy.doSSHConnect();
}
}
};
Expand Down
8 changes: 4 additions & 4 deletions front/terminal/src/utils/BaseUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
// export const http_base_url = http_protocol + '//' + window.location.host + '/api';

// 本地开发环境
export const ws_base_url = 'ws://localhost:3000/socket/ssh/';
export const http_base_url = 'http://localhost:3000/api';
// export const ws_base_url = 'ws://localhost:3000/socket/ssh/';
// export const http_base_url = 'http://localhost:3000/api';

// 在线环境
// export const ws_base_url = 'wss://ssh.kkbpro.com/socket/ssh/';
// export const http_base_url = 'https://ssh.kkbpro.com/api';
export const ws_base_url = 'wss://ssh.kkbpro.com/socket/ssh/';
export const http_base_url = 'https://ssh.kkbpro.com/api';
26 changes: 15 additions & 11 deletions front/terminal/src/views/FrameWork.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,19 @@ export default {
};
loadTCodes();
const env = ref(null);
const urlParams = ref(getUrlParams());
const loadEnv = () => {
if(localStorage.getItem('env')) env.value = JSON.parse(decrypt(localStorage.getItem('env')));
else env.value = default_env;
// url参数
const urlParams = getUrlParams();
env.value = {...env.value,...urlParams};
// session参数
let sessionEnv = {};
if(sessionStorage.getItem('env')) sessionEnv = JSON.parse(decrypt(sessionStorage.getItem('env')));
env.value = {...env.value,...sessionEnv};
for (const key in urlParams.value) {
if(key in env.value && key.lastIndexOf('_') == -1) env.value[key] = urlParams.value[key];
}
// option
let nowOpInfo = options.value[env.value['option']];
if(nowOpInfo) env.value = {...env.value,...nowOpInfo};
else env.value.option = '';
urlParams.value.option = env.value.option;
// lang
i18n.global.locale = env.value.lang || 'en';
};
Expand Down Expand Up @@ -283,8 +280,14 @@ export default {
const fileBlockRef = ref();
// 保存更改的环境变量
const saveEnv = (new_env,restart=true) => {
env.value = {...env.value,...new_env};
localStorage.setItem('env',encrypt(JSON.stringify(env.value)));
let save_env = {};
if(localStorage.getItem('env')) save_env = JSON.parse(decrypt(localStorage.getItem('env')));
else save_env = default_env;
save_env = {...save_env,...new_env};
localStorage.setItem('env',encrypt(JSON.stringify(save_env)));
for (const key in new_env) {
if(key in urlParams.value) urlParams.value[key] = new_env[key];
}
if(restart) doSettings(3);
};
Expand Down Expand Up @@ -379,8 +382,8 @@ export default {
if(socket.value) socket.value.close(3333); // 主动释放资源,必需
// 进行重启
closeFileBlock();
doSSHConnect();
resetTerminal();
doSSHConnect();
}
// 文件管理
else if(type == 4) {
Expand Down Expand Up @@ -558,6 +561,7 @@ export default {
// 启动终端
resetTerminal();
// 初始化
$.ajax({
url: http_base_url + '/init',
type:'get',
Expand Down

0 comments on commit 7f45f09

Please sign in to comment.