|
|
|
@ -8,11 +8,13 @@ |
|
|
|
>{{ rootMenu.label }} |
|
|
|
<component :is="renderIcon('element ArrowDown')"></component> |
|
|
|
</div> |
|
|
|
<div style="flex-grow: 1;"></div> |
|
|
|
<div style="flex-grow: 1;"> |
|
|
|
<span>{{ worldModelState.project_label }}</span> |
|
|
|
</div> |
|
|
|
<div v-if="isModelOpen" style="display: flex; flex-direction: row; align-items: center; margin-right: 10px;"> |
|
|
|
<div class="field-block" style="margin-right: 5px;"> |
|
|
|
<el-select style="width:180px;" placeholder="运行环境" |
|
|
|
v-model="worldModelState.runState.currentEnvId"> |
|
|
|
<el-select style="width:180px;" placeholder="运行环境" :disabled="worldModelState.runState.currentEnvId && worldModelState.runState.isRunning" |
|
|
|
v-model="currentEnvId"> |
|
|
|
<el-option v-for="env in envList" :key="env.envId" :label="env.envName" :value="env.envId"></el-option> |
|
|
|
<template #footer> |
|
|
|
<el-button size="small" type="primary" @click="createEnv" plain>创建虚拟环境</el-button> |
|
|
|
@ -29,13 +31,13 @@ |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
<el-button :icon="renderIcon('Play')" type="primary" |
|
|
|
v-if="!worldModelState.runState.isRunning" |
|
|
|
v-if="!worldModelState.runState.currentEnvId || !worldModelState.runState.isRunning" |
|
|
|
:disabled="!worldModelState.runState.currentEnvId" |
|
|
|
:loading="worldModelState.runState.isLoading" |
|
|
|
@click="startEnv">启动服务 |
|
|
|
</el-button> |
|
|
|
<el-button :icon="renderIcon('Stop')" type="danger" plain |
|
|
|
v-if="worldModelState.runState.isRunning" |
|
|
|
v-if="worldModelState.runState.currentEnvId && worldModelState.runState.isRunning" |
|
|
|
:loading="worldModelState.runState.isLoading" |
|
|
|
@click="stopEnv">停止服务 |
|
|
|
</el-button> |
|
|
|
@ -229,7 +231,8 @@ export default { |
|
|
|
sectionRightName: 'property', |
|
|
|
sectionBottomName: '', |
|
|
|
sectionLeftSearch: '', |
|
|
|
centerActiveName: 'ModelEditor' |
|
|
|
centerActiveName: 'ModelEditor', |
|
|
|
currentEnvId: worldModel.state.runState.currentEnvId |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -284,6 +287,33 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
'currentEnvId': { |
|
|
|
handler(newVal, originalVal) { |
|
|
|
if (this.worldModelState.runState.currentEnvId && this.worldModelState.runState.isRunning) { |
|
|
|
throw new Error('cannot change env when running') |
|
|
|
this.currentEnvId = originalVal |
|
|
|
|
|
|
|
} else { |
|
|
|
// 更新当前环境 ID |
|
|
|
const env = _.find(this.envList, env => env.envId === newVal) |
|
|
|
if (!env) { |
|
|
|
this.worldModelState.runState.currentEnvId = newVal |
|
|
|
this.worldModelState.runState.isLoading = false |
|
|
|
this.worldModelState.runState.isRunning = false |
|
|
|
this.worldModelState.runState.isVirtual = false |
|
|
|
this.worldModelState.runState.timeRate = 0 |
|
|
|
this.worldModelState.runState.currentEnv = null |
|
|
|
} else { |
|
|
|
this.worldModelState.runState.currentEnvId = newVal |
|
|
|
this.worldModelState.runState.isLoading = false |
|
|
|
this.worldModelState.runState.isRunning = false |
|
|
|
this.worldModelState.runState.isVirtual = env.isVirtual |
|
|
|
this.worldModelState.runState.timeRate = 1 |
|
|
|
this.worldModelState.runState.currentEnv = env |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
hideBottom(value) { |
|
|
|
if (value) { |
|
|
|
this.$refs.mainSplit.refreshSize([100, 0]) |
|
|
|
|