fix SSH 独立管理面板支持快捷使用文件管理

This commit is contained in:
bwcx_jzy 2023-09-18 15:38:59 +08:00
parent 57377811f7
commit 62084cae4d
No known key found for this signature in database
GPG Key ID: E187D6E9DDDE8C53
3 changed files with 48 additions and 11 deletions

View File

@ -2,11 +2,11 @@
### 2.10.45.2-beta
### 🐣 新增功能
### 🐞 解决BUG、优化功能
1. 【server】优化 容器构建判断构建异常(严格模式异常中断构建)(感谢@在时间里流浪)
2. 【server】修复 构建流程中断触发 success 事件(感谢@在时间里流浪)
3. 【server】优化 SSH 独立管理面板支持快捷使用文件管理
------

View File

@ -818,6 +818,7 @@ public class BuildExecuteManage implements Runnable {
}
try {
boolean stop = false;
for (Map.Entry<String, IProcessItem> stringSupplierEntry : processItemMap.entrySet()) {
processName = stringSupplierEntry.getKey();
IProcessItem processItem = stringSupplierEntry.getValue();
@ -830,6 +831,7 @@ public class BuildExecuteManage implements Runnable {
logRecorder.system("执行中断 {} 流程,原因事件脚本中断", processItem.name());
this.asyncWebHooks("stop", "process", processName, "statusMsg", interruptMsg);
buildExecuteService.updateStatus(buildInfoModel.getId(), this.logId, buildInfoModel.getBuildId(), BuildStatus.Interrupt, interruptMsg);
stop = true;
break;
}
String errorMsg = processItem.execute();
@ -838,11 +840,14 @@ public class BuildExecuteManage implements Runnable {
logRecorder.systemError("执行异常[{}]流程:{}", processItem.name(), errorMsg);
this.asyncWebHooks("stop", "process", processName, "statusMsg", errorMsg);
buildExecuteService.updateStatus(buildInfoModel.getId(), this.logId, buildInfoModel.getBuildId(), BuildStatus.Error, errorMsg);
stop = true;
break;
}
logRecorder.system("执行结束 {}流程,耗时:{}", processItem.name(), DateUtil.formatBetween(SystemClock.now() - processItemStartTime));
}
this.asyncWebHooks("success");
if (!stop) { // 没有执行 stop
this.asyncWebHooks("success");
}
} catch (DiyInterruptException diyInterruptException) {
// 主动中断
this.asyncWebHooks("stop", "process", processName);

View File

@ -6,15 +6,32 @@
</a-layout-sider>
<a-layout-content :style="{ padding: '0 5px', height: `calc(100vh - 10px)` }">
<a-tabs v-if="selectPanes.length" v-model="activeKey" type="editable-card" hide-add @edit="onEdit" @change="change">
<a-tab-pane v-for="pane in selectPanes" :key="pane.id" :tab="pane.name" :closable="true">
<div v-if="pane.open" :style="{ height: `calc(100vh - 70px) ` }">
<terminal :sshId="pane.id" />
<template slot="tabBarExtraContent">
<a-button type="primary" :disabled="!activeKey" @click="changeFileVisible(activeKey, true)"> 文件管理 </a-button>
</template>
<a-tab-pane v-for="pane in selectPanes" :key="pane.id" :tab="pane.name" :closable="true" :ref="`pene-${pane.id}`">
<div :id="`paneDom${pane.id}`">
<div v-if="pane.open" :style="{ height: `calc(100vh - 70px) ` }">
<terminal :sshId="pane.id" />
</div>
<a-result v-else status="warning" title="未开启当前终端">
<template #extra>
<a-button type="primary" @click="open(pane.id)"> 打开终端 </a-button>
</template>
</a-result>
<!-- 文件管理 -->
<a-drawer
v-if="pane.openFile"
:getContainer="`#paneDom${pane.id}`"
:title="`${pane.name}文件管理`"
placement="right"
width="90vw"
:visible="pane.fileVisible"
@close="changeFileVisible(pane.id, false)"
>
<ssh-file v-if="pane.openFile" :sshId="pane.id" />
</a-drawer>
</div>
<a-result v-else status="warning" title="未开启当前终端">
<template #extra>
<a-button type="primary" @click="open(pane.id)"> 打开终端 </a-button>
</template>
</a-result>
</a-tab-pane>
</a-tabs>
<a-empty v-else description="未选择ssh"></a-empty>
@ -25,9 +42,12 @@
import { mapGetters } from "vuex";
import { getSshListTree } from "@/api/ssh";
import terminal from "./terminal";
import SshFile from "@/pages/ssh/ssh-file";
export default {
components: {
terminal,
SshFile,
},
data() {
return {
@ -142,6 +162,18 @@ export default {
})
);
},
//
changeFileVisible(activeKey, value) {
this.selectPanes = this.selectPanes.map((item) => {
if (item.id === activeKey) {
item.fileVisible = value;
if (value && !item.openFile) {
item.openFile = true;
}
}
return item;
});
},
},
};
</script>