Refactor: 重构实例更新请求参数

This commit is contained in:
Suwings 2022-07-17 13:03:28 +08:00
parent 8b27c26bdb
commit 07e4f441ef
5 changed files with 106 additions and 30 deletions

View File

@ -81,6 +81,19 @@ export const API_PROGRESS = `${API_URL}/api/environment/progress`;
export const API_PANEL_STATUS = `${API_URL}/api/auth/status`;
export const API_PANEL_INSTALL = `${API_URL}/api/auth/install`;
export const TERMINAL_CODE = [
{ label: "UTF-8通用", value: "UTF-8" },
{ label: "GBK中文", value: "GBK" },
{ label: "BIG5繁中", value: "BIG5" },
{ label: "Shift_JIS日文", value: "Shift_JIS" },
{ label: "KS_C_5601韩文", value: "KS_C_5601" },
{ label: "GB2312中文", value: "GB2312" },
{ label: "GB18030中文", value: "GB18030" },
{ label: "Big5-HKSCS繁中", value: "Big5-HKSCS" },
{ label: "UTF-16", value: "UTF-16" }
]
export function sleep(t) {
return new Promise((s) => {
setTimeout(s, t);

View File

@ -479,7 +479,7 @@
</template>
<script>
import { API_IMAGES, API_INSTANCE, API_NETWORK_MODES } from "../service/common";
import { API_IMAGES, API_INSTANCE, API_NETWORK_MODES, TERMINAL_CODE } from "../service/common";
import { processTypeList, statusCodeToText } from "../service/instance_tools";
import Panel from "../../components/Panel";
import router from "../router";
@ -541,17 +541,7 @@ export default {
],
//
characters: [
{ label: "UTF-8通用", value: "UTF-8" },
{ label: "GBK中文", value: "GBK" },
{ label: "BIG5繁中", value: "BIG5" },
{ label: "Shift_JIS日文", value: "Shift_JIS" },
{ label: "KS_C_5601韩文", value: "KS_C_5601" },
{ label: "GB2312中文", value: "GB2312" },
{ label: "GB18030中文", value: "GB18030" },
{ label: "Big5-HKSCS繁中", value: "Big5-HKSCS" },
{ label: "UTF-16", value: "UTF-16" }
]
characters: TERMINAL_CODE
};
},
methods: {

View File

@ -52,7 +52,7 @@
<el-input
v-model="options.ptyWindowCol"
:disabled="!options.pty"
size="mini"
size="small"
style="width: 80px"
></el-input>
&nbsp;
@ -60,20 +60,87 @@
<el-input
:disabled="!options.pty"
v-model="options.ptyWindowRow"
size="mini"
size="small"
style="width: 80px"
></el-input>
</div>
</div>
<div class="sub-title row-mt">
<p class="sub-title-title">颜色渲染</p>
<p class="sub-title-info">
网页自动给输出内容增加颜色渲染渲染的颜色不一定完全正确<br />如果颜色渲染功能与软件自带的颜色功能冲突可以关闭此功能
</p>
</div>
<div class="row-mt">
<el-switch v-model="options.haveColor"></el-switch>
<div class="sub-title">
<p class="sub-title-title">输入输出编码</p>
<p class="sub-title-info">
在仿真终端开启时生效用于设置仿真终端高度和宽度更改生效需要重启实例
<br />
如果使用有问题建议关闭
</p>
</div>
<div class="row-mt" style="display: flex">
<el-select
v-model="options.oe"
filterable
allow-create
size="small"
default-first-option
placeholder="终端输出编码"
style="width: 220px"
>
<el-option
v-for="item in TERMINAL_CODE"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-select
v-model="options.ie"
filterable
size="small"
allow-create
default-first-option
placeholder="命令输入编码"
style="width: 220px; margin-left: 12px"
>
<el-option
v-for="item in TERMINAL_CODE"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
</div>
<div>
<div class="sub-title row-mt">
<p class="sub-title-title">命令执行回车符</p>
<p class="sub-title-info">
如果您输入命令按回车没有反应可以尝试调整此选项
<br />
Windows 平台下一般是回车换行符Linux/MacOS 平台下一般是换行符
</p>
</div>
<div class="row-mt">
<el-select v-model="options.crlf" placeholder="请选择" size="small" style="width: 220px">
<el-option label="换行符(\n" :value="1"></el-option>
<el-option label="回车换行符(\r\n" :value="2"></el-option>
</el-select>
</div>
</div>
<div>
<div class="sub-title row-mt">
<p class="sub-title-title">网页颜色渲染</p>
<p class="sub-title-info">
网页自动给输出内容增加颜色渲染渲染的颜色不一定完全正确<br />如果颜色渲染功能与软件自带的颜色功能冲突可以关闭此功能
</p>
</div>
<div class="row-mt">
<el-switch v-model="options.haveColor"></el-switch>
</div>
</div>
<div class="row-mt">
@ -90,6 +157,7 @@
import Dialog from "@/components/Dialog";
import { request } from "@/app//service/protocol";
import { API_INSTANCE_UPDATE } from "@/app/service/common";
import { TERMINAL_CODE } from "../../service/common";
export default {
components: { Dialog },
props: {
@ -109,6 +177,7 @@ export default {
},
data() {
return {
TERMINAL_CODE,
v: false,
options: {}
};
@ -143,7 +212,10 @@ export default {
...this.options
},
pingConfig: {},
eventTask: {}
eventTask: {},
crlf: this.options.crlf,
ie: this.options.ie,
oe: this.options.oe
}
});
this.options = {};

View File

@ -873,7 +873,12 @@ export default {
this.eventConfigPanel.visible = true;
},
toTerminalSettingPanel() {
this.terminalSettingPanel = { ...this.instanceInfo.config.terminalOption };
this.terminalSettingPanel = {
...this.instanceInfo.config.terminalOption,
crlf: this.instanceInfo.config.crlf,
oe: this.instanceInfo.config.oe,
ie: this.instanceInfo.config.ie
};
this.terminalSettingPanel.visible = true;
},
async syncLog() {
@ -902,12 +907,8 @@ export default {
url: API_INSTANCE_UPDATE,
params: { remote_uuid: this.serviceUuid, uuid: this.instanceUuid },
data: {
pingConfig: this.pingConfigForm.is
? this.pingConfigForm
: this.instanceInfo.config.pingConfig,
eventTask: this.eventConfigPanel
? this.eventConfigPanel
: this.instanceInfo.config.eventTask,
pingConfig: this.pingConfigForm.is ? this.pingConfigForm : {},
eventTask: this.eventConfigPanel.visible ? this.eventConfigPanel : {},
terminalOption: {}
}
});

View File

@ -76,7 +76,7 @@ export default {
}
.box-card-shadow {
border-radius: 4px;
border-radius: 0px;
}
.left-tip {