@dongnanyang/deploy-cli 0.12.1 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
function resolveEntry(argv) {
|
|
4
4
|
switch (argv[0]) {
|
|
5
5
|
case void 0:
|
|
6
|
-
case "tui":
|
|
7
|
-
case "--tui-next": return "tui
|
|
6
|
+
case "tui":
|
|
7
|
+
case "--tui-next": return "tui";
|
|
8
|
+
case "--legacy-tui": return "legacy-tui";
|
|
8
9
|
default: return "cli";
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -12,13 +13,13 @@ function resolveEntry(argv) {
|
|
|
12
13
|
async function runEntry(argv = process.argv.slice(2)) {
|
|
13
14
|
switch (resolveEntry(argv)) {
|
|
14
15
|
case "tui":
|
|
15
|
-
await import("./main.js");
|
|
16
|
-
break;
|
|
17
|
-
case "tui-next":
|
|
18
16
|
await import("./tui/main.js");
|
|
19
17
|
break;
|
|
18
|
+
case "legacy-tui":
|
|
19
|
+
await import("./main.js");
|
|
20
|
+
break;
|
|
20
21
|
case "cli": {
|
|
21
|
-
const cli = await import("./cli-
|
|
22
|
+
const cli = await import("./cli-DuwAYtpm.js");
|
|
22
23
|
process.exitCode = await cli.main(argv);
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as run, S as execFailureMessage, _ as acmeProbeCommand, c as loadProject, f as removeProject, g as ACME_BIN, r as addProject, s as listProjects, v as certbotProbeCommand, x as resolveNginxPaths, y as createNginx } from "./project-BL00JHAo.js";
|
|
2
2
|
import { n as loadConfig, r as saveConfig, t as expandPath } from "./config-xUl8Oa3T.js";
|
|
3
|
-
import {
|
|
3
|
+
import { c as createDocker, l as logsArgs, o as checkProjectHealth, r as runDeploy, s as findProjectContainers, t as buildSpec } from "./deploy-DuQKdGV9.js";
|
|
4
4
|
import { accessSync, constants, existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { C as run, S as execFailureMessage, a as generateCompose, h as PROJECT_LABEL, m as COMPOSE_SERVICE_LABEL, o as hasComposeMarker, t as COMPOSE_MARKER, y as createNginx } from "./project-BL00JHAo.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t as expandPath } from "./config-xUl8Oa3T.js";
|
|
3
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { spawn } from "node:child_process";
|
|
4
6
|
//#region src/core/docker.ts
|
|
5
7
|
/** docker 调用默认超时(F5:docker daemon 挂起不得永久挂死 CLI),与流水线 600s 长步档同口径;--follow 流式豁免 */
|
|
6
8
|
const DOCKER_TIMEOUT_MS = 6e5;
|
|
@@ -372,5 +374,54 @@ async function runDeploy(project, opts) {
|
|
|
372
374
|
}
|
|
373
375
|
return { ok: true };
|
|
374
376
|
}
|
|
377
|
+
/** 扫描项目的部署脚本(v0.1.0 discoverScripts 迁移:*.sh 按名排序,目录不存在=空表) */
|
|
378
|
+
function discoverScripts(project) {
|
|
379
|
+
const projectPath = expandPath(project.path);
|
|
380
|
+
const deployPath = resolve(projectPath, project.deployDir);
|
|
381
|
+
let files;
|
|
382
|
+
try {
|
|
383
|
+
files = readdirSync(deployPath);
|
|
384
|
+
} catch {
|
|
385
|
+
return [];
|
|
386
|
+
}
|
|
387
|
+
return files.filter((f) => f.endsWith(".sh")).map((f) => ({
|
|
388
|
+
project: project.name,
|
|
389
|
+
name: f,
|
|
390
|
+
path: join(deployPath, f)
|
|
391
|
+
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
392
|
+
}
|
|
393
|
+
/** 执行部署脚本(v0.1.0 runDeployScript 迁移:cwd=deploy 目录,stdout/stderr 逐行回调,exit 回调收尾) */
|
|
394
|
+
function runDeployScript(script, args, onOutput, onExit) {
|
|
395
|
+
const cwd = dirname(script.path);
|
|
396
|
+
const child = spawn("bash", [script.name, ...args], {
|
|
397
|
+
cwd,
|
|
398
|
+
stdio: [
|
|
399
|
+
"pipe",
|
|
400
|
+
"pipe",
|
|
401
|
+
"pipe"
|
|
402
|
+
],
|
|
403
|
+
env: { ...process.env }
|
|
404
|
+
});
|
|
405
|
+
const handleStream = (stream) => {
|
|
406
|
+
let buffer = "";
|
|
407
|
+
stream.on("data", (chunk) => {
|
|
408
|
+
buffer += chunk.toString();
|
|
409
|
+
const lines = buffer.split("\n");
|
|
410
|
+
buffer = lines.pop() || "";
|
|
411
|
+
for (const line of lines) if (line.trim()) onOutput(line);
|
|
412
|
+
});
|
|
413
|
+
stream.on("end", () => {
|
|
414
|
+
if (buffer.trim()) onOutput(buffer);
|
|
415
|
+
});
|
|
416
|
+
};
|
|
417
|
+
handleStream(child.stdout);
|
|
418
|
+
handleStream(child.stderr);
|
|
419
|
+
child.on("exit", onExit);
|
|
420
|
+
}
|
|
421
|
+
/** 记录脚本执行结果(v0.1.0 saveScriptResult 迁移:就地更新 lastRun/lastResult) */
|
|
422
|
+
function saveScriptResult(script, success) {
|
|
423
|
+
script.lastRun = (/* @__PURE__ */ new Date()).toISOString();
|
|
424
|
+
script.lastResult = success ? "success" : "fail";
|
|
425
|
+
}
|
|
375
426
|
//#endregion
|
|
376
|
-
export {
|
|
427
|
+
export { saveScriptResult as a, createDocker as c, runDeployScript as i, logsArgs as l, discoverScripts as n, checkProjectHealth as o, runDeploy as r, findProjectContainers as s, buildSpec as t };
|
package/dist/tui/main.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { a as generateCompose, b as isValidSlug, i as createManagedProject, l as managedComposeExists, s as listProjects, u as managedDir } from "../project-BL00JHAo.js";
|
|
2
2
|
import { n as loadConfig, t as expandPath } from "../config-xUl8Oa3T.js";
|
|
3
3
|
import { t as export_helper_default } from "../export-helper-CIEcxb5I.js";
|
|
4
|
-
import { a as createDocker, n as
|
|
4
|
+
import { a as saveScriptResult, c as createDocker, i as runDeployScript, n as discoverScripts, o as checkProjectHealth, r as runDeploy } from "../deploy-DuQKdGV9.js";
|
|
5
|
+
import { readFileSync } from "fs";
|
|
5
6
|
import { stringify } from "yaml";
|
|
6
7
|
import { Box, Text, createApp, useApp, useInput } from "@vue-tui/runtime";
|
|
7
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, onScopeDispose, openBlock, reactive, ref, renderList, shallowRef, toDisplayString, toValue, watch, withCtx } from "vue";
|
|
8
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, onMounted, onScopeDispose, onUnmounted, openBlock, reactive, ref, renderList, shallowRef, toDisplayString, toValue, watch, withCtx } from "vue";
|
|
8
9
|
import { ScrollBox } from "@vue-tui/components";
|
|
10
|
+
import { createServer } from "net";
|
|
11
|
+
import { Client } from "ssh2";
|
|
9
12
|
//#region src/tui/composables/useKeymap.ts
|
|
10
13
|
/** 六面板(spec 6.4):键位 1-6 与数组序一一对应 */
|
|
11
14
|
const PANEL_IDS = [
|
|
@@ -86,7 +89,7 @@ function useKeymap(handlers) {
|
|
|
86
89
|
* 键位:y/enter 确认、n/escape 取消;不可见时不响应。
|
|
87
90
|
* R17:visible 期间挂模态闸——全局键 1-6/q/? 一并停用(弹窗独占输入)。
|
|
88
91
|
*/
|
|
89
|
-
const _sfc_main$
|
|
92
|
+
const _sfc_main$10 = /*@__PURE__*/ defineComponent({
|
|
90
93
|
__name: "ConfirmModal",
|
|
91
94
|
props: {
|
|
92
95
|
visible: {
|
|
@@ -127,7 +130,7 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
127
130
|
return __returned__;
|
|
128
131
|
}
|
|
129
132
|
});
|
|
130
|
-
function _sfc_render$
|
|
133
|
+
function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
|
|
131
134
|
return $setup.props.visible ? (openBlock(), createBlock($setup["Box"], {
|
|
132
135
|
key: 0,
|
|
133
136
|
flexDirection: "column",
|
|
@@ -156,10 +159,10 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
156
159
|
_: 1
|
|
157
160
|
})) : createCommentVNode("v-if", true);
|
|
158
161
|
}
|
|
159
|
-
var ConfirmModal_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
162
|
+
var ConfirmModal_default = /*#__PURE__*/ export_helper_default(_sfc_main$10, [["render", _sfc_render$10], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/ConfirmModal.vue"]]);
|
|
160
163
|
//#endregion
|
|
161
164
|
//#region src/tui/components/ContainersPanel.vue
|
|
162
|
-
const _sfc_main$
|
|
165
|
+
const _sfc_main$9 = /*@__PURE__*/ defineComponent({
|
|
163
166
|
__name: "ContainersPanel",
|
|
164
167
|
props: {
|
|
165
168
|
rows: {
|
|
@@ -250,7 +253,7 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
|
|
|
250
253
|
return __returned__;
|
|
251
254
|
}
|
|
252
255
|
});
|
|
253
|
-
function _sfc_render$
|
|
256
|
+
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
254
257
|
return openBlock(), createBlock($setup["Box"], {
|
|
255
258
|
flexDirection: "column",
|
|
256
259
|
flexGrow: 1,
|
|
@@ -391,7 +394,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
391
394
|
_: 1
|
|
392
395
|
});
|
|
393
396
|
}
|
|
394
|
-
var ContainersPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
397
|
+
var ContainersPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$9, [["render", _sfc_render$9], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/ContainersPanel.vue"]]);
|
|
395
398
|
//#endregion
|
|
396
399
|
//#region src/tui/components/DeployPanel.vue
|
|
397
400
|
/**
|
|
@@ -399,7 +402,7 @@ var ContainersPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$7, [
|
|
|
399
402
|
* 只吃 ViewModel(useDeployRun);发起部署入口在 Projects 面板 d(App 接线)。
|
|
400
403
|
* 失败即停视觉呈现:fail 步标「失败」,其后步骤标「跳过」。
|
|
401
404
|
*/
|
|
402
|
-
const _sfc_main$
|
|
405
|
+
const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
403
406
|
__name: "DeployPanel",
|
|
404
407
|
props: {
|
|
405
408
|
projectName: {
|
|
@@ -469,7 +472,7 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
|
469
472
|
return __returned__;
|
|
470
473
|
}
|
|
471
474
|
});
|
|
472
|
-
function _sfc_render$
|
|
475
|
+
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
473
476
|
return openBlock(), createBlock($setup["Box"], {
|
|
474
477
|
flexDirection: "column",
|
|
475
478
|
flexGrow: 1,
|
|
@@ -590,7 +593,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
590
593
|
_: 1
|
|
591
594
|
});
|
|
592
595
|
}
|
|
593
|
-
var DeployPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
596
|
+
var DeployPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$8, [["render", _sfc_render$8], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/DeployPanel.vue"]]);
|
|
594
597
|
//#endregion
|
|
595
598
|
//#region src/tui/components/OutputPanel.vue
|
|
596
599
|
/**
|
|
@@ -598,7 +601,7 @@ var DeployPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$6, [["re
|
|
|
598
601
|
* 滚动/截断(T4#4 递延项):ScrollBox 有界视口(内容超高即截断)+ 旧 TUI g/G 键位语义(g 到顶、G 回底跟随)、↑/↓ 逐行;
|
|
599
602
|
* 列表上限在 useLogs(LOGS_LIMIT 环形截断),此处只管视口。
|
|
600
603
|
*/
|
|
601
|
-
const _sfc_main$
|
|
604
|
+
const _sfc_main$7 = /*@__PURE__*/ defineComponent({
|
|
602
605
|
__name: "OutputPanel",
|
|
603
606
|
props: { logs: {
|
|
604
607
|
type: Array,
|
|
@@ -641,7 +644,7 @@ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
|
|
|
641
644
|
return __returned__;
|
|
642
645
|
}
|
|
643
646
|
});
|
|
644
|
-
function _sfc_render$
|
|
647
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
645
648
|
return openBlock(), createBlock($setup["Box"], {
|
|
646
649
|
flexDirection: "column",
|
|
647
650
|
flexGrow: 1,
|
|
@@ -691,14 +694,14 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
691
694
|
_: 1
|
|
692
695
|
});
|
|
693
696
|
}
|
|
694
|
-
var OutputPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
697
|
+
var OutputPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$7, [["render", _sfc_render$7], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/OutputPanel.vue"]]);
|
|
695
698
|
//#endregion
|
|
696
699
|
//#region src/tui/components/ProjectsPanel.vue
|
|
697
700
|
/**
|
|
698
701
|
* Projects 面板(spec 6.4):项目列表 NAME/PATH/TYPE/ERROR + 动作事件出口。
|
|
699
702
|
* 只吃 ViewModel(rows);动作经 emit 交 App 接线(部署等 T6 接线)。
|
|
700
703
|
*/
|
|
701
|
-
const _sfc_main$
|
|
704
|
+
const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
702
705
|
__name: "ProjectsPanel",
|
|
703
706
|
props: {
|
|
704
707
|
rows: {
|
|
@@ -712,6 +715,7 @@ const _sfc_main$4 = /*@__PURE__*/ defineComponent({
|
|
|
712
715
|
},
|
|
713
716
|
emits: [
|
|
714
717
|
"deploy",
|
|
718
|
+
"scripts",
|
|
715
719
|
"create",
|
|
716
720
|
"refresh"
|
|
717
721
|
],
|
|
@@ -730,6 +734,7 @@ const _sfc_main$4 = /*@__PURE__*/ defineComponent({
|
|
|
730
734
|
if (name === "j" || name === "down") sel.value = Math.min(sel.value + 1, props.rows.length - 1);
|
|
731
735
|
else if (name === "k" || name === "up") sel.value = Math.max(sel.value - 1, 0);
|
|
732
736
|
else if (name === "d") emit("deploy", props.rows[sel.value].name);
|
|
737
|
+
else if (name === "r") emit("scripts", props.rows[sel.value].name);
|
|
733
738
|
else if (name === "f") emit("refresh");
|
|
734
739
|
});
|
|
735
740
|
const __returned__ = {
|
|
@@ -750,7 +755,7 @@ const _sfc_main$4 = /*@__PURE__*/ defineComponent({
|
|
|
750
755
|
return __returned__;
|
|
751
756
|
}
|
|
752
757
|
});
|
|
753
|
-
function _sfc_render$
|
|
758
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
754
759
|
return openBlock(), createBlock($setup["Box"], {
|
|
755
760
|
flexDirection: "column",
|
|
756
761
|
flexGrow: 1,
|
|
@@ -868,21 +873,291 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
868
873
|
}, 1024);
|
|
869
874
|
}), 128)),
|
|
870
875
|
createVNode($setup["Text"], { dimColor: "" }, {
|
|
871
|
-
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("j/k 选择 · n 新建(创建向导) · d 部署 · f 刷新", -1)])]),
|
|
876
|
+
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("j/k 选择 · n 新建(创建向导) · d 部署 · r 脚本 · f 刷新", -1)])]),
|
|
872
877
|
_: 1
|
|
873
878
|
})
|
|
874
879
|
]),
|
|
875
880
|
_: 1
|
|
876
881
|
});
|
|
877
882
|
}
|
|
878
|
-
var ProjectsPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
883
|
+
var ProjectsPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$6, [["render", _sfc_render$6], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/ProjectsPanel.vue"]]);
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region src/tui/components/ScriptsPanel.vue
|
|
886
|
+
/**
|
|
887
|
+
* Scripts 脚本浮层(R20:spec §6.5 脚本执行并入项目动作——Projects 面板 r 打开,扫描选中项目 deploy/)。
|
|
888
|
+
* 能力迁移自 v0.1.0 DeployPanel:j/k/Enter/p(传参弹窗=旧 InputModal 语义)。
|
|
889
|
+
* R21 确认闸:脚本执行=任意 shell,Enter/传参执行一律经 ConfirmModal 确认后才 emit。
|
|
890
|
+
* 只吃 ViewModel(project/rows/running);动作经 emit 交 App 接线(useScripts)。
|
|
891
|
+
* 挂模态闸(R17 机制):浮层打开期间全局键 1-6/q/? 停用;Esc 返回(关闭浮层)。
|
|
892
|
+
*/
|
|
893
|
+
const _sfc_main$5 = /*@__PURE__*/ defineComponent({
|
|
894
|
+
__name: "ScriptsPanel",
|
|
895
|
+
props: {
|
|
896
|
+
project: {
|
|
897
|
+
type: String,
|
|
898
|
+
required: true
|
|
899
|
+
},
|
|
900
|
+
rows: {
|
|
901
|
+
type: Array,
|
|
902
|
+
required: true
|
|
903
|
+
},
|
|
904
|
+
running: {
|
|
905
|
+
type: [String, null],
|
|
906
|
+
required: true
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
emits: [
|
|
910
|
+
"run",
|
|
911
|
+
"refresh",
|
|
912
|
+
"close"
|
|
913
|
+
],
|
|
914
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
915
|
+
__expose();
|
|
916
|
+
const props = __props;
|
|
917
|
+
const emit = __emit;
|
|
918
|
+
useModalGate(() => true);
|
|
919
|
+
const sel = ref(0);
|
|
920
|
+
watch(() => props.rows.length, () => {
|
|
921
|
+
sel.value = Math.min(sel.value, Math.max(0, props.rows.length - 1));
|
|
922
|
+
});
|
|
923
|
+
/** 传参弹窗(旧 InputModal 语义):输入参数、Enter 转确认弹窗、Esc 取消 */
|
|
924
|
+
const paramsFor = ref(null);
|
|
925
|
+
const paramsText = ref("");
|
|
926
|
+
const paramsOpen = computed(() => paramsFor.value !== null);
|
|
927
|
+
/** 执行确认挂起(R21:任意 shell);挂起期间列表键位全部停用 */
|
|
928
|
+
const pending = ref(null);
|
|
929
|
+
const confirmMessage = computed(() => {
|
|
930
|
+
if (pending.value === null) return "";
|
|
931
|
+
const { script, args } = pending.value;
|
|
932
|
+
const key = `${script.project}/${script.name}`;
|
|
933
|
+
return args.length > 0 ? `确认执行脚本 ${key}(参数: ${args.join(" ")})?` : `确认执行脚本 ${key}?`;
|
|
934
|
+
});
|
|
935
|
+
function closeParams() {
|
|
936
|
+
paramsFor.value = null;
|
|
937
|
+
paramsText.value = "";
|
|
938
|
+
}
|
|
939
|
+
useInput((event) => {
|
|
940
|
+
if (pending.value !== null) return;
|
|
941
|
+
const name = keyName(event);
|
|
942
|
+
const char = event.type === "text" ? event.text : event.type === "key" ? event.key.character : void 0;
|
|
943
|
+
if (paramsOpen.value) {
|
|
944
|
+
if (name === "enter") {
|
|
945
|
+
const script = paramsFor.value;
|
|
946
|
+
const args = paramsText.value.trim().split(/\s+/).filter(Boolean);
|
|
947
|
+
closeParams();
|
|
948
|
+
pending.value = {
|
|
949
|
+
script,
|
|
950
|
+
args
|
|
951
|
+
};
|
|
952
|
+
} else if (name === "escape") closeParams();
|
|
953
|
+
else if (name === "backspace") paramsText.value = paramsText.value.slice(0, -1);
|
|
954
|
+
else if (char) paramsText.value += char;
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
if (name === "escape") {
|
|
958
|
+
emit("close");
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
if (props.rows.length === 0) return;
|
|
962
|
+
if (name === "j" || name === "down") sel.value = Math.min(sel.value + 1, props.rows.length - 1);
|
|
963
|
+
else if (name === "k" || name === "up") sel.value = Math.max(sel.value - 1, 0);
|
|
964
|
+
else if (name === "enter") pending.value = {
|
|
965
|
+
script: props.rows[sel.value],
|
|
966
|
+
args: []
|
|
967
|
+
};
|
|
968
|
+
else if (name === "p") {
|
|
969
|
+
paramsFor.value = props.rows[sel.value];
|
|
970
|
+
paramsText.value = "";
|
|
971
|
+
} else if (name === "f") emit("refresh");
|
|
972
|
+
}, { isActive: () => pending.value === null });
|
|
973
|
+
function onConfirm() {
|
|
974
|
+
const p = pending.value;
|
|
975
|
+
pending.value = null;
|
|
976
|
+
if (p !== null) emit("run", p.script, p.args);
|
|
977
|
+
}
|
|
978
|
+
function key(script) {
|
|
979
|
+
return `${script.project}/${script.name}`;
|
|
980
|
+
}
|
|
981
|
+
const __returned__ = {
|
|
982
|
+
props,
|
|
983
|
+
emit,
|
|
984
|
+
sel,
|
|
985
|
+
paramsFor,
|
|
986
|
+
paramsText,
|
|
987
|
+
paramsOpen,
|
|
988
|
+
pending,
|
|
989
|
+
confirmMessage,
|
|
990
|
+
closeParams,
|
|
991
|
+
onConfirm,
|
|
992
|
+
key,
|
|
993
|
+
get Box() {
|
|
994
|
+
return Box;
|
|
995
|
+
},
|
|
996
|
+
get Text() {
|
|
997
|
+
return Text;
|
|
998
|
+
},
|
|
999
|
+
ConfirmModal: ConfirmModal_default
|
|
1000
|
+
};
|
|
1001
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
1002
|
+
enumerable: false,
|
|
1003
|
+
value: true
|
|
1004
|
+
});
|
|
1005
|
+
return __returned__;
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1009
|
+
return openBlock(), createBlock($setup["Box"], {
|
|
1010
|
+
flexDirection: "column",
|
|
1011
|
+
flexGrow: 1,
|
|
1012
|
+
borderStyle: "round",
|
|
1013
|
+
borderColor: "cyan",
|
|
1014
|
+
padding: 1
|
|
1015
|
+
}, {
|
|
1016
|
+
default: withCtx(() => [
|
|
1017
|
+
createVNode($setup["Text"], {
|
|
1018
|
+
bold: "",
|
|
1019
|
+
color: "cyan"
|
|
1020
|
+
}, {
|
|
1021
|
+
default: withCtx(() => [createTextVNode("Scripts 脚本 — " + toDisplayString($setup.props.project) + "(deploy/ 目录)", 1)]),
|
|
1022
|
+
_: 1
|
|
1023
|
+
}),
|
|
1024
|
+
$setup.props.rows.length === 0 ? (openBlock(), createBlock($setup["Text"], {
|
|
1025
|
+
key: 0,
|
|
1026
|
+
dimColor: ""
|
|
1027
|
+
}, {
|
|
1028
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("(暂无部署脚本)——在项目 deploy/ 目录放置 *.sh 后按 [f] 重扫", -1)])]),
|
|
1029
|
+
_: 1
|
|
1030
|
+
})) : createCommentVNode("v-if", true),
|
|
1031
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($setup.props.rows, (s, i) => {
|
|
1032
|
+
return openBlock(), createBlock($setup["Box"], {
|
|
1033
|
+
key: $setup.key(s),
|
|
1034
|
+
flexDirection: "row",
|
|
1035
|
+
flexShrink: 0
|
|
1036
|
+
}, {
|
|
1037
|
+
default: withCtx(() => [
|
|
1038
|
+
createVNode($setup["Box"], { width: 2 }, {
|
|
1039
|
+
default: withCtx(() => [createVNode($setup["Text"], { color: i === $setup.sel ? "cyan" : void 0 }, {
|
|
1040
|
+
default: withCtx(() => [createTextVNode(toDisplayString(i === $setup.sel ? ">" : " "), 1)]),
|
|
1041
|
+
_: 2
|
|
1042
|
+
}, 1032, ["color"])]),
|
|
1043
|
+
_: 2
|
|
1044
|
+
}, 1024),
|
|
1045
|
+
createVNode($setup["Box"], { width: 2 }, {
|
|
1046
|
+
default: withCtx(() => [$setup.props.running === $setup.key(s) ? (openBlock(), createBlock($setup["Text"], {
|
|
1047
|
+
key: 0,
|
|
1048
|
+
color: "yellow"
|
|
1049
|
+
}, {
|
|
1050
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("▸", -1)])]),
|
|
1051
|
+
_: 1
|
|
1052
|
+
})) : s.lastResult === "success" ? (openBlock(), createBlock($setup["Text"], {
|
|
1053
|
+
key: 1,
|
|
1054
|
+
color: "green"
|
|
1055
|
+
}, {
|
|
1056
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("✓", -1)])]),
|
|
1057
|
+
_: 1
|
|
1058
|
+
})) : s.lastResult === "fail" ? (openBlock(), createBlock($setup["Text"], {
|
|
1059
|
+
key: 2,
|
|
1060
|
+
color: "red"
|
|
1061
|
+
}, {
|
|
1062
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("✗", -1)])]),
|
|
1063
|
+
_: 1
|
|
1064
|
+
})) : (openBlock(), createBlock($setup["Text"], { key: 3 }))]),
|
|
1065
|
+
_: 2
|
|
1066
|
+
}, 1024),
|
|
1067
|
+
createVNode($setup["Box"], { flexGrow: 1 }, {
|
|
1068
|
+
default: withCtx(() => [createVNode($setup["Text"], {
|
|
1069
|
+
wrap: "truncate",
|
|
1070
|
+
bold: i === $setup.sel,
|
|
1071
|
+
color: i === $setup.sel ? "cyan" : void 0
|
|
1072
|
+
}, {
|
|
1073
|
+
default: withCtx(() => [createTextVNode(toDisplayString($setup.key(s)), 1)]),
|
|
1074
|
+
_: 2
|
|
1075
|
+
}, 1032, ["bold", "color"])]),
|
|
1076
|
+
_: 2
|
|
1077
|
+
}, 1024),
|
|
1078
|
+
createVNode($setup["Box"], { flexShrink: 0 }, {
|
|
1079
|
+
default: withCtx(() => [$setup.props.running === $setup.key(s) ? (openBlock(), createBlock($setup["Text"], {
|
|
1080
|
+
key: 0,
|
|
1081
|
+
color: "yellow"
|
|
1082
|
+
}, {
|
|
1083
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("running...", -1)])]),
|
|
1084
|
+
_: 1
|
|
1085
|
+
})) : createCommentVNode("v-if", true)]),
|
|
1086
|
+
_: 2
|
|
1087
|
+
}, 1024)
|
|
1088
|
+
]),
|
|
1089
|
+
_: 2
|
|
1090
|
+
}, 1024);
|
|
1091
|
+
}), 128)),
|
|
1092
|
+
createVNode($setup["Text"], { dimColor: "" }, {
|
|
1093
|
+
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("j/k 选择 · Enter 执行 · p 传参执行 · f 重扫 · Esc 返回", -1)])]),
|
|
1094
|
+
_: 1
|
|
1095
|
+
}),
|
|
1096
|
+
createCommentVNode(" 传参弹窗(旧 InputModal 文案) "),
|
|
1097
|
+
$setup.paramsFor ? (openBlock(), createBlock($setup["Box"], {
|
|
1098
|
+
key: 1,
|
|
1099
|
+
flexDirection: "column",
|
|
1100
|
+
borderStyle: "round",
|
|
1101
|
+
borderColor: "cyan",
|
|
1102
|
+
padding: 1
|
|
1103
|
+
}, {
|
|
1104
|
+
default: withCtx(() => [
|
|
1105
|
+
createVNode($setup["Text"], {
|
|
1106
|
+
bold: "",
|
|
1107
|
+
color: "cyan"
|
|
1108
|
+
}, {
|
|
1109
|
+
default: withCtx(() => [createTextVNode("执行: " + toDisplayString($setup.paramsFor.project) + "/" + toDisplayString($setup.paramsFor.name), 1)]),
|
|
1110
|
+
_: 1
|
|
1111
|
+
}),
|
|
1112
|
+
createVNode($setup["Box"], {
|
|
1113
|
+
flexDirection: "row",
|
|
1114
|
+
marginTop: 1,
|
|
1115
|
+
gap: 1
|
|
1116
|
+
}, {
|
|
1117
|
+
default: withCtx(() => [createVNode($setup["Text"], { dimColor: "" }, {
|
|
1118
|
+
default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("参数:", -1)])]),
|
|
1119
|
+
_: 1
|
|
1120
|
+
}), createVNode($setup["Text"], {
|
|
1121
|
+
bold: "",
|
|
1122
|
+
color: "cyan"
|
|
1123
|
+
}, {
|
|
1124
|
+
default: withCtx(() => [createTextVNode(toDisplayString($setup.paramsText) + "_", 1)]),
|
|
1125
|
+
_: 1
|
|
1126
|
+
})]),
|
|
1127
|
+
_: 1
|
|
1128
|
+
}),
|
|
1129
|
+
createVNode($setup["Box"], {
|
|
1130
|
+
flexDirection: "row",
|
|
1131
|
+
marginTop: 1
|
|
1132
|
+
}, {
|
|
1133
|
+
default: withCtx(() => [createVNode($setup["Text"], { dimColor: "" }, {
|
|
1134
|
+
default: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode("[Enter] 执行 [Esc] 取消", -1)])]),
|
|
1135
|
+
_: 1
|
|
1136
|
+
})]),
|
|
1137
|
+
_: 1
|
|
1138
|
+
})
|
|
1139
|
+
]),
|
|
1140
|
+
_: 1
|
|
1141
|
+
})) : createCommentVNode("v-if", true),
|
|
1142
|
+
createCommentVNode(" 执行确认(R21:任意 shell,y 确认才执行) "),
|
|
1143
|
+
createVNode($setup["ConfirmModal"], {
|
|
1144
|
+
visible: $setup.pending !== null,
|
|
1145
|
+
message: $setup.confirmMessage,
|
|
1146
|
+
onConfirm: $setup.onConfirm,
|
|
1147
|
+
onCancel: _cache[0] || (_cache[0] = ($event) => $setup.pending = null)
|
|
1148
|
+
}, null, 8, ["visible", "message"])
|
|
1149
|
+
]),
|
|
1150
|
+
_: 1
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
var ScriptsPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$5, [["render", _sfc_render$5], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/ScriptsPanel.vue"]]);
|
|
879
1154
|
//#endregion
|
|
880
1155
|
//#region src/tui/components/StatusPanel.vue
|
|
881
1156
|
/**
|
|
882
1157
|
* Status 面板(spec 6.4):项目健康聚合 CONTAINERS/HTTP/NGINX(口径同 CLI status 表格)。
|
|
883
1158
|
* 只吃 ViewModel(rows);单行错误降级展示(检查失败/配置不可用行 + 继续,M2-T2 #10 的 UI 面)。
|
|
884
1159
|
*/
|
|
885
|
-
const _sfc_main$
|
|
1160
|
+
const _sfc_main$4 = /*@__PURE__*/ defineComponent({
|
|
886
1161
|
__name: "StatusPanel",
|
|
887
1162
|
props: {
|
|
888
1163
|
rows: {
|
|
@@ -919,7 +1194,7 @@ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
|
|
|
919
1194
|
return __returned__;
|
|
920
1195
|
}
|
|
921
1196
|
});
|
|
922
|
-
function _sfc_render$
|
|
1197
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
923
1198
|
return openBlock(), createBlock($setup["Box"], {
|
|
924
1199
|
flexDirection: "column",
|
|
925
1200
|
flexGrow: 1,
|
|
@@ -1043,10 +1318,10 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1043
1318
|
_: 1
|
|
1044
1319
|
});
|
|
1045
1320
|
}
|
|
1046
|
-
var StatusPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
1321
|
+
var StatusPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$4, [["render", _sfc_render$4], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/StatusPanel.vue"]]);
|
|
1047
1322
|
//#endregion
|
|
1048
1323
|
//#region src/tui/components/StatusBar.vue
|
|
1049
|
-
const _sfc_main$
|
|
1324
|
+
const _sfc_main$3 = /*@__PURE__*/ defineComponent({
|
|
1050
1325
|
__name: "StatusBar",
|
|
1051
1326
|
props: {
|
|
1052
1327
|
activePanel: {
|
|
@@ -1079,7 +1354,7 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
|
|
|
1079
1354
|
return __returned__;
|
|
1080
1355
|
}
|
|
1081
1356
|
});
|
|
1082
|
-
function _sfc_render$
|
|
1357
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1083
1358
|
return openBlock(), createBlock($setup["Box"], {
|
|
1084
1359
|
paddingX: 1,
|
|
1085
1360
|
flexDirection: "row",
|
|
@@ -1099,7 +1374,190 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1099
1374
|
_: 1
|
|
1100
1375
|
});
|
|
1101
1376
|
}
|
|
1102
|
-
var StatusBar_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
1377
|
+
var StatusBar_default = /*#__PURE__*/ export_helper_default(_sfc_main$3, [["render", _sfc_render$3], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/StatusBar.vue"]]);
|
|
1378
|
+
//#endregion
|
|
1379
|
+
//#region src/tui/components/TunnelsPanel.vue
|
|
1380
|
+
/**
|
|
1381
|
+
* Tunnels 面板(spec 6.4 面板 5):旧 v0.1.0 TunnelPanel 迁移——j/k/s/x/a 语义保留。
|
|
1382
|
+
* R21 确认闸分流:start 类(s/a)直接执行(非破坏);x 停止=中断在用连接,走 ConfirmModal。
|
|
1383
|
+
* 只吃 ViewModel(rows);动作经 emit 交 App 接线(useTunnels)。
|
|
1384
|
+
*/
|
|
1385
|
+
const _sfc_main$2 = /*@__PURE__*/ defineComponent({
|
|
1386
|
+
__name: "TunnelsPanel",
|
|
1387
|
+
props: { rows: {
|
|
1388
|
+
type: Array,
|
|
1389
|
+
required: true
|
|
1390
|
+
} },
|
|
1391
|
+
emits: [
|
|
1392
|
+
"start",
|
|
1393
|
+
"stop",
|
|
1394
|
+
"startAll"
|
|
1395
|
+
],
|
|
1396
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1397
|
+
__expose();
|
|
1398
|
+
const props = __props;
|
|
1399
|
+
const emit = __emit;
|
|
1400
|
+
const sel = ref(0);
|
|
1401
|
+
/** 确认挂起(R21:x 停止=中断在用连接);挂起期间面板键位全部停用 */
|
|
1402
|
+
const pendingStop = ref(null);
|
|
1403
|
+
watch(() => props.rows.length, () => {
|
|
1404
|
+
sel.value = Math.min(sel.value, Math.max(0, props.rows.length - 1));
|
|
1405
|
+
});
|
|
1406
|
+
useInput((event) => {
|
|
1407
|
+
if (pendingStop.value !== null) return;
|
|
1408
|
+
const name = keyName(event);
|
|
1409
|
+
if (name === "a") emit("startAll");
|
|
1410
|
+
if (props.rows.length === 0) return;
|
|
1411
|
+
if (name === "j" || name === "down") sel.value = Math.min(sel.value + 1, props.rows.length - 1);
|
|
1412
|
+
else if (name === "k" || name === "up") sel.value = Math.max(sel.value - 1, 0);
|
|
1413
|
+
else if (name === "s") emit("start", props.rows[sel.value].name);
|
|
1414
|
+
else if (name === "x") pendingStop.value = props.rows[sel.value].name;
|
|
1415
|
+
}, { isActive: () => pendingStop.value === null });
|
|
1416
|
+
function onStopConfirm() {
|
|
1417
|
+
const name = pendingStop.value;
|
|
1418
|
+
pendingStop.value = null;
|
|
1419
|
+
if (name !== null) emit("stop", name);
|
|
1420
|
+
}
|
|
1421
|
+
const __returned__ = {
|
|
1422
|
+
props,
|
|
1423
|
+
emit,
|
|
1424
|
+
sel,
|
|
1425
|
+
pendingStop,
|
|
1426
|
+
onStopConfirm,
|
|
1427
|
+
STATUS_MARK: {
|
|
1428
|
+
running: "●",
|
|
1429
|
+
error: "✗",
|
|
1430
|
+
stopped: "○"
|
|
1431
|
+
},
|
|
1432
|
+
STATUS_COLOR: {
|
|
1433
|
+
running: "green",
|
|
1434
|
+
error: "red",
|
|
1435
|
+
stopped: "gray"
|
|
1436
|
+
},
|
|
1437
|
+
get Box() {
|
|
1438
|
+
return Box;
|
|
1439
|
+
},
|
|
1440
|
+
get Text() {
|
|
1441
|
+
return Text;
|
|
1442
|
+
},
|
|
1443
|
+
ConfirmModal: ConfirmModal_default
|
|
1444
|
+
};
|
|
1445
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
1446
|
+
enumerable: false,
|
|
1447
|
+
value: true
|
|
1448
|
+
});
|
|
1449
|
+
return __returned__;
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1453
|
+
return openBlock(), createBlock($setup["Box"], {
|
|
1454
|
+
flexDirection: "column",
|
|
1455
|
+
flexGrow: 1,
|
|
1456
|
+
borderStyle: "round",
|
|
1457
|
+
borderColor: "cyan",
|
|
1458
|
+
padding: 1
|
|
1459
|
+
}, {
|
|
1460
|
+
default: withCtx(() => [
|
|
1461
|
+
createVNode($setup["Text"], {
|
|
1462
|
+
bold: "",
|
|
1463
|
+
color: "cyan"
|
|
1464
|
+
}, {
|
|
1465
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("5. Tunnels 隧道", -1)])]),
|
|
1466
|
+
_: 1
|
|
1467
|
+
}),
|
|
1468
|
+
$setup.props.rows.length === 0 ? (openBlock(), createBlock($setup["Text"], {
|
|
1469
|
+
key: 0,
|
|
1470
|
+
dimColor: ""
|
|
1471
|
+
}, {
|
|
1472
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("(暂无隧道配置)", -1)])]),
|
|
1473
|
+
_: 1
|
|
1474
|
+
})) : createCommentVNode("v-if", true),
|
|
1475
|
+
$setup.props.rows.length === 0 ? (openBlock(), createBlock($setup["Text"], {
|
|
1476
|
+
key: 1,
|
|
1477
|
+
dimColor: ""
|
|
1478
|
+
}, {
|
|
1479
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("编辑 ~/.deploy-cli/config.json 添加", -1)])]),
|
|
1480
|
+
_: 1
|
|
1481
|
+
})) : createCommentVNode("v-if", true),
|
|
1482
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($setup.props.rows, (t, i) => {
|
|
1483
|
+
return openBlock(), createBlock($setup["Box"], {
|
|
1484
|
+
key: t.name,
|
|
1485
|
+
flexDirection: "row",
|
|
1486
|
+
flexShrink: 0
|
|
1487
|
+
}, {
|
|
1488
|
+
default: withCtx(() => [
|
|
1489
|
+
createVNode($setup["Box"], { width: 2 }, {
|
|
1490
|
+
default: withCtx(() => [createVNode($setup["Text"], { color: i === $setup.sel ? "cyan" : void 0 }, {
|
|
1491
|
+
default: withCtx(() => [createTextVNode(toDisplayString(i === $setup.sel ? ">" : " "), 1)]),
|
|
1492
|
+
_: 2
|
|
1493
|
+
}, 1032, ["color"])]),
|
|
1494
|
+
_: 2
|
|
1495
|
+
}, 1024),
|
|
1496
|
+
createVNode($setup["Box"], { width: 2 }, {
|
|
1497
|
+
default: withCtx(() => [createVNode($setup["Text"], { color: $setup.STATUS_COLOR[t.status] }, {
|
|
1498
|
+
default: withCtx(() => [createTextVNode(toDisplayString($setup.STATUS_MARK[t.status]), 1)]),
|
|
1499
|
+
_: 2
|
|
1500
|
+
}, 1032, ["color"])]),
|
|
1501
|
+
_: 2
|
|
1502
|
+
}, 1024),
|
|
1503
|
+
createVNode($setup["Box"], { width: 24 }, {
|
|
1504
|
+
default: withCtx(() => [createVNode($setup["Text"], {
|
|
1505
|
+
wrap: "truncate",
|
|
1506
|
+
bold: i === $setup.sel,
|
|
1507
|
+
color: i === $setup.sel ? "cyan" : void 0
|
|
1508
|
+
}, {
|
|
1509
|
+
default: withCtx(() => [createTextVNode(toDisplayString(t.name), 1)]),
|
|
1510
|
+
_: 2
|
|
1511
|
+
}, 1032, ["bold", "color"])]),
|
|
1512
|
+
_: 2
|
|
1513
|
+
}, 1024),
|
|
1514
|
+
createVNode($setup["Box"], { flexShrink: 0 }, {
|
|
1515
|
+
default: withCtx(() => [createVNode($setup["Text"], { dimColor: "" }, {
|
|
1516
|
+
default: withCtx(() => [createTextVNode(":" + toDisplayString(t.localPort) + " -> " + toDisplayString(t.remoteHost) + ":" + toDisplayString(t.remotePort), 1)]),
|
|
1517
|
+
_: 2
|
|
1518
|
+
}, 1024)]),
|
|
1519
|
+
_: 2
|
|
1520
|
+
}, 1024),
|
|
1521
|
+
createVNode($setup["Box"], { flexShrink: 0 }, {
|
|
1522
|
+
default: withCtx(() => [t.autoStart ? (openBlock(), createBlock($setup["Text"], {
|
|
1523
|
+
key: 0,
|
|
1524
|
+
dimColor: ""
|
|
1525
|
+
}, {
|
|
1526
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode(" (auto)", -1)])]),
|
|
1527
|
+
_: 1
|
|
1528
|
+
})) : createCommentVNode("v-if", true)]),
|
|
1529
|
+
_: 2
|
|
1530
|
+
}, 1024),
|
|
1531
|
+
createVNode($setup["Box"], { flexGrow: 1 }, {
|
|
1532
|
+
default: withCtx(() => [t.message ? (openBlock(), createBlock($setup["Text"], {
|
|
1533
|
+
key: 0,
|
|
1534
|
+
color: "red",
|
|
1535
|
+
wrap: "truncate"
|
|
1536
|
+
}, {
|
|
1537
|
+
default: withCtx(() => [createTextVNode(toDisplayString(t.message), 1)]),
|
|
1538
|
+
_: 2
|
|
1539
|
+
}, 1024)) : createCommentVNode("v-if", true)]),
|
|
1540
|
+
_: 2
|
|
1541
|
+
}, 1024)
|
|
1542
|
+
]),
|
|
1543
|
+
_: 2
|
|
1544
|
+
}, 1024);
|
|
1545
|
+
}), 128)),
|
|
1546
|
+
createVNode($setup["Text"], { dimColor: "" }, {
|
|
1547
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("j/k 选择 · s 启动 · x 停止(确认) · a 全部启动", -1)])]),
|
|
1548
|
+
_: 1
|
|
1549
|
+
}),
|
|
1550
|
+
createVNode($setup["ConfirmModal"], {
|
|
1551
|
+
visible: $setup.pendingStop !== null,
|
|
1552
|
+
message: `确认停止隧道 ${$setup.pendingStop ?? ""}?将中断在用连接`,
|
|
1553
|
+
onConfirm: $setup.onStopConfirm,
|
|
1554
|
+
onCancel: _cache[0] || (_cache[0] = ($event) => $setup.pendingStop = null)
|
|
1555
|
+
}, null, 8, ["visible", "message"])
|
|
1556
|
+
]),
|
|
1557
|
+
_: 1
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
var TunnelsPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$2, [["render", _sfc_render$2], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/TunnelsPanel.vue"]]);
|
|
1103
1561
|
//#endregion
|
|
1104
1562
|
//#region src/tui/composables/useWizard.ts
|
|
1105
1563
|
/** 类型步选项(顺序=spec 6.1 compose|image|static) */
|
|
@@ -2089,6 +2547,293 @@ function useProjects(opts = {}) {
|
|
|
2089
2547
|
};
|
|
2090
2548
|
}
|
|
2091
2549
|
//#endregion
|
|
2550
|
+
//#region src/tui/composables/useScripts.ts
|
|
2551
|
+
/**
|
|
2552
|
+
* Scripts 面板数据面(M2-T7,自 v0.1.0 useDeploy + deploy-runner 迁移):
|
|
2553
|
+
* 扫描各项目 deploy/ 目录 → 行;执行走 core runDeployScript,输出/结果日志口径与 v0.1.0 逐字一致。
|
|
2554
|
+
*/
|
|
2555
|
+
function useScripts(opts = {}) {
|
|
2556
|
+
const { info, success, warn, error: logError } = useLogs();
|
|
2557
|
+
const config = opts.load ? opts.load() : loadConfig();
|
|
2558
|
+
const rows = ref([]);
|
|
2559
|
+
const running = ref(null);
|
|
2560
|
+
function scan(name) {
|
|
2561
|
+
const projects = name === void 0 ? config.projects : config.projects.filter((p) => p.name === name);
|
|
2562
|
+
const all = [];
|
|
2563
|
+
for (const project of projects) all.push(...discoverScripts(project));
|
|
2564
|
+
rows.value = all;
|
|
2565
|
+
info(`扫描完成: ${projects.length} 个项目, ${all.length} 个脚本`);
|
|
2566
|
+
}
|
|
2567
|
+
function run(script, args = []) {
|
|
2568
|
+
const key = `${script.project}/${script.name}`;
|
|
2569
|
+
if (running.value !== null) {
|
|
2570
|
+
warn(`已有脚本在运行: ${running.value}`);
|
|
2571
|
+
return Promise.resolve();
|
|
2572
|
+
}
|
|
2573
|
+
running.value = key;
|
|
2574
|
+
info(`▸ ${key}${args.length ? " " + args.join(" ") : ""}`);
|
|
2575
|
+
return new Promise((settle) => {
|
|
2576
|
+
(opts.run ?? runDeployScript)(script, args, (line) => {
|
|
2577
|
+
info(` ${line}`);
|
|
2578
|
+
}, (code) => {
|
|
2579
|
+
const ok = code === 0;
|
|
2580
|
+
saveScriptResult(script, ok);
|
|
2581
|
+
if (ok) success(`✓ ${key} 完成`);
|
|
2582
|
+
else logError(`✗ ${key} 失败 (exit ${code})`);
|
|
2583
|
+
running.value = null;
|
|
2584
|
+
settle();
|
|
2585
|
+
});
|
|
2586
|
+
});
|
|
2587
|
+
}
|
|
2588
|
+
return {
|
|
2589
|
+
rows,
|
|
2590
|
+
running,
|
|
2591
|
+
scan,
|
|
2592
|
+
run
|
|
2593
|
+
};
|
|
2594
|
+
}
|
|
2595
|
+
//#endregion
|
|
2596
|
+
//#region src/core/tunnel.ts
|
|
2597
|
+
/** 读取私钥文件内容(v0.1.0 readPrivateKey 迁移:~ 展开后读盘) */
|
|
2598
|
+
function readPrivateKey(keyPath) {
|
|
2599
|
+
const expanded = expandPath(keyPath);
|
|
2600
|
+
return readFileSync(expanded, "utf-8");
|
|
2601
|
+
}
|
|
2602
|
+
/** 建立 SSH 连接(v0.1.0 createSSHConn 迁移:readyTimeout 10s + 12s 整体超时) */
|
|
2603
|
+
function createSSHConn(server) {
|
|
2604
|
+
return new Promise((resolve, reject) => {
|
|
2605
|
+
const conn = new Client();
|
|
2606
|
+
const config = {
|
|
2607
|
+
host: server.host,
|
|
2608
|
+
port: server.port,
|
|
2609
|
+
username: server.username,
|
|
2610
|
+
readyTimeout: 1e4
|
|
2611
|
+
};
|
|
2612
|
+
if (server.privateKey) config.privateKey = readPrivateKey(server.privateKey);
|
|
2613
|
+
else if (server.password) config.password = server.password;
|
|
2614
|
+
const timer = setTimeout(() => reject(/* @__PURE__ */ new Error("SSH 连接超时")), 12e3);
|
|
2615
|
+
conn.on("ready", () => {
|
|
2616
|
+
clearTimeout(timer);
|
|
2617
|
+
resolve(conn);
|
|
2618
|
+
});
|
|
2619
|
+
conn.on("error", (err) => {
|
|
2620
|
+
clearTimeout(timer);
|
|
2621
|
+
reject(err);
|
|
2622
|
+
});
|
|
2623
|
+
conn.connect(config);
|
|
2624
|
+
});
|
|
2625
|
+
}
|
|
2626
|
+
/** 隧道管理器实现 */
|
|
2627
|
+
var TunnelManagerImpl = class {
|
|
2628
|
+
config;
|
|
2629
|
+
activeTunnels = /* @__PURE__ */ new Map();
|
|
2630
|
+
/** 失败/断开原因(states() 行 overlay;成功启动/手动停止时清除) */
|
|
2631
|
+
lastError = /* @__PURE__ */ new Map();
|
|
2632
|
+
handlers = /* @__PURE__ */ new Set();
|
|
2633
|
+
constructor(config) {
|
|
2634
|
+
this.config = config;
|
|
2635
|
+
}
|
|
2636
|
+
emit(event) {
|
|
2637
|
+
for (const handler of [...this.handlers]) handler(event);
|
|
2638
|
+
}
|
|
2639
|
+
log(level, message) {
|
|
2640
|
+
this.emit({
|
|
2641
|
+
type: "log",
|
|
2642
|
+
level,
|
|
2643
|
+
message
|
|
2644
|
+
});
|
|
2645
|
+
}
|
|
2646
|
+
async start(name) {
|
|
2647
|
+
try {
|
|
2648
|
+
await this.startInner(name);
|
|
2649
|
+
this.lastError.delete(name);
|
|
2650
|
+
} catch (error) {
|
|
2651
|
+
this.lastError.set(name, error instanceof Error ? error.message : String(error));
|
|
2652
|
+
throw error;
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
async startInner(name) {
|
|
2656
|
+
const tunnel = this.config.tunnels.find((t) => t.name === name);
|
|
2657
|
+
if (!tunnel) throw new Error(`未找到隧道: ${name}`);
|
|
2658
|
+
if (this.activeTunnels.has(name)) throw new Error(`隧道 "${name}" 已在运行`);
|
|
2659
|
+
const server = this.config.servers.find((s) => s.name === tunnel.server);
|
|
2660
|
+
if (!server) throw new Error(`找不到服务器: ${tunnel.server}`);
|
|
2661
|
+
this.log("info", `正在连接 ${server.host}...`);
|
|
2662
|
+
const conn = await createSSHConn(server);
|
|
2663
|
+
this.log("info", `SSH 已连接 ${server.username}@${server.host}`);
|
|
2664
|
+
const netServer = createServer((socket) => {
|
|
2665
|
+
conn.forwardOut(socket.remoteAddress || "127.0.0.1", socket.remotePort || 0, tunnel.remoteHost, tunnel.remotePort, (err, stream) => {
|
|
2666
|
+
if (err) {
|
|
2667
|
+
socket.destroy();
|
|
2668
|
+
return;
|
|
2669
|
+
}
|
|
2670
|
+
socket.pipe(stream);
|
|
2671
|
+
stream.pipe(socket);
|
|
2672
|
+
socket.on("error", () => stream.end());
|
|
2673
|
+
socket.on("close", () => stream.end());
|
|
2674
|
+
stream.on("error", () => socket.destroy());
|
|
2675
|
+
stream.on("close", () => socket.destroy());
|
|
2676
|
+
});
|
|
2677
|
+
});
|
|
2678
|
+
try {
|
|
2679
|
+
await new Promise((resolve, reject) => {
|
|
2680
|
+
netServer.on("error", reject);
|
|
2681
|
+
netServer.listen(tunnel.localPort, "127.0.0.1", resolve);
|
|
2682
|
+
});
|
|
2683
|
+
} catch (error) {
|
|
2684
|
+
conn.end();
|
|
2685
|
+
throw error;
|
|
2686
|
+
}
|
|
2687
|
+
conn.on("close", () => {
|
|
2688
|
+
if (!this.activeTunnels.has(name)) return;
|
|
2689
|
+
this.stop(name);
|
|
2690
|
+
this.lastError.set(name, "SSH 连接断开");
|
|
2691
|
+
this.log("warn", `隧道 "${name}" SSH 连接断开`);
|
|
2692
|
+
this.emit({
|
|
2693
|
+
type: "stopped",
|
|
2694
|
+
name,
|
|
2695
|
+
reason: "disconnect"
|
|
2696
|
+
});
|
|
2697
|
+
});
|
|
2698
|
+
conn.on("error", () => {
|
|
2699
|
+
if (!this.activeTunnels.has(name)) return;
|
|
2700
|
+
this.stop(name);
|
|
2701
|
+
this.lastError.set(name, "SSH 错误");
|
|
2702
|
+
this.log("error", `隧道 "${name}" SSH 错误`);
|
|
2703
|
+
this.emit({
|
|
2704
|
+
type: "stopped",
|
|
2705
|
+
name,
|
|
2706
|
+
reason: "error"
|
|
2707
|
+
});
|
|
2708
|
+
});
|
|
2709
|
+
this.activeTunnels.set(name, {
|
|
2710
|
+
server: netServer,
|
|
2711
|
+
conn
|
|
2712
|
+
});
|
|
2713
|
+
this.log("success", `隧道 "${name}" 已启动: localhost:${tunnel.localPort} -> ${tunnel.remoteHost}:${tunnel.remotePort}`);
|
|
2714
|
+
}
|
|
2715
|
+
stop(name) {
|
|
2716
|
+
const active = this.activeTunnels.get(name);
|
|
2717
|
+
if (!active) return;
|
|
2718
|
+
active.server.close();
|
|
2719
|
+
active.conn.end();
|
|
2720
|
+
this.activeTunnels.delete(name);
|
|
2721
|
+
this.lastError.delete(name);
|
|
2722
|
+
}
|
|
2723
|
+
stopAll() {
|
|
2724
|
+
for (const name of [...this.activeTunnels.keys()]) this.stop(name);
|
|
2725
|
+
}
|
|
2726
|
+
status(name) {
|
|
2727
|
+
return this.activeTunnels.has(name) ? "running" : "stopped";
|
|
2728
|
+
}
|
|
2729
|
+
states() {
|
|
2730
|
+
return this.config.tunnels.map((t) => {
|
|
2731
|
+
const running = this.activeTunnels.has(t.name);
|
|
2732
|
+
const error = running ? void 0 : this.lastError.get(t.name);
|
|
2733
|
+
return {
|
|
2734
|
+
name: t.name,
|
|
2735
|
+
server: t.server,
|
|
2736
|
+
localPort: t.localPort,
|
|
2737
|
+
remoteHost: t.remoteHost,
|
|
2738
|
+
remotePort: t.remotePort,
|
|
2739
|
+
autoStart: t.autoStart,
|
|
2740
|
+
status: running ? "running" : error !== void 0 ? "error" : "stopped",
|
|
2741
|
+
message: error
|
|
2742
|
+
};
|
|
2743
|
+
});
|
|
2744
|
+
}
|
|
2745
|
+
async autoStart() {
|
|
2746
|
+
for (const tunnel of this.config.tunnels) {
|
|
2747
|
+
if (!tunnel.autoStart) continue;
|
|
2748
|
+
if (this.activeTunnels.has(tunnel.name)) continue;
|
|
2749
|
+
try {
|
|
2750
|
+
await this.start(tunnel.name);
|
|
2751
|
+
} catch (error) {
|
|
2752
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2753
|
+
this.log("error", `隧道 "${tunnel.name}" 启动失败: ${message}`);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
onEvent(handler) {
|
|
2758
|
+
this.handlers.add(handler);
|
|
2759
|
+
return () => {
|
|
2760
|
+
this.handlers.delete(handler);
|
|
2761
|
+
};
|
|
2762
|
+
}
|
|
2763
|
+
};
|
|
2764
|
+
/** 创建隧道管理器(ssh2 隧道沿用 v0.1.0 逻辑重构——spec 6.2 core/tunnel.ts) */
|
|
2765
|
+
function createTunnelManager(config) {
|
|
2766
|
+
return new TunnelManagerImpl(config);
|
|
2767
|
+
}
|
|
2768
|
+
//#endregion
|
|
2769
|
+
//#region src/tui/composables/useTunnels.ts
|
|
2770
|
+
/**
|
|
2771
|
+
* Tunnels 面板数据面(M2-T7,自 v0.1.0 useTunnels 迁移):core/tunnel 事件 → 响应式行 + 全局日志。
|
|
2772
|
+
* - manager log 事件 → useLogs(旧 onLog 归宿);stopped 事件(SSH 断开/错误)→ 行转 error 带原因。
|
|
2773
|
+
* - 行为基线 = v0.1.0 useTunnels;两处意图行为修正:重复启动只 warn 不误标 error 行、
|
|
2774
|
+
* SSH 断开行不再残留 running(旧实现状态漂移)。
|
|
2775
|
+
*/
|
|
2776
|
+
function useTunnels(opts = {}) {
|
|
2777
|
+
const { info, success, warn, error: logError } = useLogs();
|
|
2778
|
+
const config = opts.load ? opts.load() : loadConfig();
|
|
2779
|
+
const manager = opts.manager ?? createTunnelManager(config);
|
|
2780
|
+
const tunnels = ref(manager.states());
|
|
2781
|
+
manager.onEvent((event) => {
|
|
2782
|
+
if (event.type === "log") if (event.level === "info") info(event.message);
|
|
2783
|
+
else if (event.level === "success") success(event.message);
|
|
2784
|
+
else if (event.level === "warn") warn(event.message);
|
|
2785
|
+
else logError(event.message);
|
|
2786
|
+
else tunnels.value = manager.states();
|
|
2787
|
+
});
|
|
2788
|
+
async function start(name) {
|
|
2789
|
+
const tunnel = config.tunnels.find((t) => t.name === name);
|
|
2790
|
+
if (!tunnel) return;
|
|
2791
|
+
if (!config.servers.find((s) => s.name === tunnel.server)) {
|
|
2792
|
+
logError(`找不到服务器: ${tunnel.server}`);
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
if (manager.status(name) === "running") {
|
|
2796
|
+
warn(`隧道 "${name}" 已在运行`);
|
|
2797
|
+
return;
|
|
2798
|
+
}
|
|
2799
|
+
const row = tunnels.value.find((t) => t.name === name);
|
|
2800
|
+
if (row) row.status = "running";
|
|
2801
|
+
try {
|
|
2802
|
+
await manager.start(name);
|
|
2803
|
+
} catch (error) {
|
|
2804
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2805
|
+
logError(`隧道 "${name}" 启动失败: ${message}`);
|
|
2806
|
+
}
|
|
2807
|
+
tunnels.value = manager.states();
|
|
2808
|
+
}
|
|
2809
|
+
function stop(name) {
|
|
2810
|
+
manager.stop(name);
|
|
2811
|
+
tunnels.value = manager.states();
|
|
2812
|
+
info(`隧道 "${name}" 已停止`);
|
|
2813
|
+
}
|
|
2814
|
+
async function startAll() {
|
|
2815
|
+
for (const t of tunnels.value) {
|
|
2816
|
+
if (t.status === "running") continue;
|
|
2817
|
+
await start(t.name);
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
async function autoStart() {
|
|
2821
|
+
await manager.autoStart();
|
|
2822
|
+
tunnels.value = manager.states();
|
|
2823
|
+
}
|
|
2824
|
+
function cleanup() {
|
|
2825
|
+
manager.stopAll();
|
|
2826
|
+
}
|
|
2827
|
+
return {
|
|
2828
|
+
tunnels,
|
|
2829
|
+
start,
|
|
2830
|
+
stop,
|
|
2831
|
+
startAll,
|
|
2832
|
+
autoStart,
|
|
2833
|
+
cleanup
|
|
2834
|
+
};
|
|
2835
|
+
}
|
|
2836
|
+
//#endregion
|
|
2092
2837
|
//#region src/tui/App.vue
|
|
2093
2838
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
2094
2839
|
__name: "App",
|
|
@@ -2100,19 +2845,32 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
2100
2845
|
const { rows: containerRows, error: containerError, following, refresh: refreshContainers, restart, stop, remove, followLogs } = useContainers();
|
|
2101
2846
|
const { rows: healthRows, error: healthError, refresh: refreshHealth } = useHealth();
|
|
2102
2847
|
const { projectName: deployProject, steps: deploySteps, lines: deployLines, running: deployRunning, done: deployDone, failedStep: deployFailedStep, start: startDeploy } = useDeployRun();
|
|
2848
|
+
const { tunnels: tunnelRows, start: startTunnel, stop: stopTunnel, startAll: startAllTunnels, autoStart: autoStartTunnels, cleanup: cleanupTunnels } = useTunnels();
|
|
2849
|
+
const { rows: scriptRows, running: scriptRunning, scan: scanScripts, run: runScript } = useScripts();
|
|
2103
2850
|
const activePanel = ref("projects");
|
|
2104
2851
|
const helpVisible = ref(false);
|
|
2105
2852
|
const wizardOpen = ref(false);
|
|
2853
|
+
/** R20:脚本浮层目标项目名(null=浮层关) */
|
|
2854
|
+
const scriptsFor = ref(null);
|
|
2106
2855
|
useKeymap({
|
|
2107
2856
|
onPanel: (panel) => {
|
|
2108
2857
|
activePanel.value = panel;
|
|
2109
2858
|
helpVisible.value = false;
|
|
2110
2859
|
},
|
|
2111
|
-
onQuit: () =>
|
|
2860
|
+
onQuit: () => {
|
|
2861
|
+
cleanupTunnels();
|
|
2862
|
+
exit();
|
|
2863
|
+
},
|
|
2112
2864
|
onHelp: () => {
|
|
2113
2865
|
helpVisible.value = !helpVisible.value;
|
|
2114
2866
|
}
|
|
2115
2867
|
});
|
|
2868
|
+
onMounted(() => {
|
|
2869
|
+
autoStartTunnels();
|
|
2870
|
+
});
|
|
2871
|
+
onUnmounted(() => {
|
|
2872
|
+
cleanupTunnels();
|
|
2873
|
+
});
|
|
2116
2874
|
watch(activePanel, (panel) => {
|
|
2117
2875
|
if (panel === "projects") refreshProjects();
|
|
2118
2876
|
else if (panel === "containers") refreshContainers();
|
|
@@ -2146,6 +2904,19 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
2146
2904
|
activePanel.value = "deploy";
|
|
2147
2905
|
startDeploy(name);
|
|
2148
2906
|
}
|
|
2907
|
+
/** Projects r → 脚本浮层(R20 项目动作):打开即扫该项目 deploy/(输出进 useLogs→Output 面板) */
|
|
2908
|
+
function onScripts(name) {
|
|
2909
|
+
scriptsFor.value = name;
|
|
2910
|
+
scanScripts(name);
|
|
2911
|
+
}
|
|
2912
|
+
/** 浮层内 R21 确认后的脚本执行(useScripts.run 消费输出/结果) */
|
|
2913
|
+
function onScriptRun(script, args) {
|
|
2914
|
+
runScript(script, args);
|
|
2915
|
+
}
|
|
2916
|
+
/** 浮层内 f 重扫(同项目范围) */
|
|
2917
|
+
function onScriptRefresh() {
|
|
2918
|
+
if (scriptsFor.value !== null) scanScripts(scriptsFor.value);
|
|
2919
|
+
}
|
|
2149
2920
|
/** 创建向导落盘成功(WizardPanel 经 ConfirmModal 确认后):日志 + 关闭时刷新列表 */
|
|
2150
2921
|
function onWizardCreated(result) {
|
|
2151
2922
|
success(`创建托管项目成功: ${result.config.name}(${result.dir})`);
|
|
@@ -2181,16 +2952,29 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
2181
2952
|
deployDone,
|
|
2182
2953
|
deployFailedStep,
|
|
2183
2954
|
startDeploy,
|
|
2955
|
+
tunnelRows,
|
|
2956
|
+
startTunnel,
|
|
2957
|
+
stopTunnel,
|
|
2958
|
+
startAllTunnels,
|
|
2959
|
+
autoStartTunnels,
|
|
2960
|
+
cleanupTunnels,
|
|
2961
|
+
scriptRows,
|
|
2962
|
+
scriptRunning,
|
|
2963
|
+
scanScripts,
|
|
2964
|
+
runScript,
|
|
2184
2965
|
activePanel,
|
|
2185
2966
|
helpVisible,
|
|
2186
2967
|
wizardOpen,
|
|
2968
|
+
scriptsFor,
|
|
2187
2969
|
ACTION_LABEL,
|
|
2188
2970
|
onContainerAction,
|
|
2189
2971
|
onLogs,
|
|
2190
2972
|
onDeploy,
|
|
2973
|
+
onScripts,
|
|
2974
|
+
onScriptRun,
|
|
2975
|
+
onScriptRefresh,
|
|
2191
2976
|
onWizardCreated,
|
|
2192
2977
|
onWizardClose,
|
|
2193
|
-
panelTitle: computed(() => `${PANEL_IDS.indexOf(activePanel.value) + 1}. ${PANEL_TITLES[activePanel.value]}`),
|
|
2194
2978
|
get Box() {
|
|
2195
2979
|
return Box;
|
|
2196
2980
|
},
|
|
@@ -2201,8 +2985,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
2201
2985
|
DeployPanel: DeployPanel_default,
|
|
2202
2986
|
OutputPanel: OutputPanel_default,
|
|
2203
2987
|
ProjectsPanel: ProjectsPanel_default,
|
|
2988
|
+
ScriptsPanel: ScriptsPanel_default,
|
|
2204
2989
|
StatusPanel: StatusPanel_default,
|
|
2205
2990
|
StatusBar: StatusBar_default,
|
|
2991
|
+
TunnelsPanel: TunnelsPanel_default,
|
|
2206
2992
|
WizardPanel: WizardPanel_default,
|
|
2207
2993
|
get PANEL_IDS() {
|
|
2208
2994
|
return PANEL_IDS;
|
|
@@ -2235,15 +3021,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2235
3021
|
bold: "",
|
|
2236
3022
|
color: "cyan"
|
|
2237
3023
|
}, {
|
|
2238
|
-
default: withCtx(() => [..._cache[
|
|
3024
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("Deploy CLI", -1)])]),
|
|
2239
3025
|
_: 1
|
|
2240
3026
|
}), createVNode($setup["Text"], { dimColor: "" }, {
|
|
2241
|
-
default: withCtx(() => [..._cache[
|
|
3027
|
+
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("1 Projects · 2 Containers · 3 Deploy · 4 Status · 5 Tunnels · 6 Output", -1)])]),
|
|
2242
3028
|
_: 1
|
|
2243
3029
|
})]),
|
|
2244
3030
|
_: 1
|
|
2245
3031
|
}),
|
|
2246
|
-
createCommentVNode("
|
|
3032
|
+
createCommentVNode(" 主面板区:六面板全部实装(T7 隧道/脚本迁移收尾);创建向导(n)打开时独占主区 "),
|
|
2247
3033
|
createVNode($setup["Box"], {
|
|
2248
3034
|
flexDirection: "column",
|
|
2249
3035
|
flexGrow: 1,
|
|
@@ -2253,34 +3039,45 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2253
3039
|
key: 0,
|
|
2254
3040
|
onCreated: $setup.onWizardCreated,
|
|
2255
3041
|
onClose: $setup.onWizardClose
|
|
2256
|
-
})) : $setup.
|
|
2257
|
-
|
|
3042
|
+
})) : $setup.scriptsFor !== null ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" R20:脚本浮层(Projects r 项目动作)——挂模态闸,Esc 关闭 "), createVNode($setup["ScriptsPanel"], {
|
|
3043
|
+
project: $setup.scriptsFor,
|
|
3044
|
+
rows: $setup.scriptRows,
|
|
3045
|
+
running: $setup.scriptRunning,
|
|
3046
|
+
onRun: $setup.onScriptRun,
|
|
3047
|
+
onRefresh: $setup.onScriptRefresh,
|
|
3048
|
+
onClose: _cache[0] || (_cache[0] = ($event) => $setup.scriptsFor = null)
|
|
3049
|
+
}, null, 8, [
|
|
3050
|
+
"project",
|
|
3051
|
+
"rows",
|
|
3052
|
+
"running"
|
|
3053
|
+
])], 2112)) : $setup.activePanel === "projects" ? (openBlock(), createBlock($setup["ProjectsPanel"], {
|
|
3054
|
+
key: 2,
|
|
2258
3055
|
rows: $setup.projectRows,
|
|
2259
3056
|
error: $setup.projectError,
|
|
2260
3057
|
onDeploy: $setup.onDeploy,
|
|
2261
|
-
|
|
3058
|
+
onScripts: $setup.onScripts,
|
|
3059
|
+
onCreate: _cache[1] || (_cache[1] = ($event) => $setup.wizardOpen = true),
|
|
2262
3060
|
onRefresh: $setup.refreshProjects
|
|
2263
3061
|
}, null, 8, [
|
|
2264
3062
|
"rows",
|
|
2265
3063
|
"error",
|
|
2266
3064
|
"onRefresh"
|
|
2267
3065
|
])) : $setup.activePanel === "containers" ? (openBlock(), createBlock($setup["ContainersPanel"], {
|
|
2268
|
-
key:
|
|
3066
|
+
key: 3,
|
|
2269
3067
|
rows: $setup.containerRows,
|
|
2270
3068
|
error: $setup.containerError,
|
|
2271
3069
|
following: $setup.following,
|
|
2272
3070
|
onLogs: $setup.onLogs,
|
|
2273
|
-
onRestart: _cache[
|
|
2274
|
-
onStop: _cache[
|
|
2275
|
-
onRemove: _cache[
|
|
3071
|
+
onRestart: _cache[2] || (_cache[2] = (name) => $setup.onContainerAction("restart", name)),
|
|
3072
|
+
onStop: _cache[3] || (_cache[3] = (name) => $setup.onContainerAction("stop", name)),
|
|
3073
|
+
onRemove: _cache[4] || (_cache[4] = (name) => $setup.onContainerAction("remove", name)),
|
|
2276
3074
|
onRefresh: $setup.refreshContainers
|
|
2277
3075
|
}, null, 8, [
|
|
2278
3076
|
"rows",
|
|
2279
3077
|
"error",
|
|
2280
3078
|
"following",
|
|
2281
3079
|
"onRefresh"
|
|
2282
|
-
])) : $setup.activePanel === "deploy" ? (openBlock(),
|
|
2283
|
-
key: 3,
|
|
3080
|
+
])) : $setup.activePanel === "deploy" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [createCommentVNode(" 面板 3 Deploy:T6 流水线视图(R20:脚本=Projects 动作浮层,不在此复合) "), createVNode($setup["DeployPanel"], {
|
|
2284
3081
|
"project-name": $setup.deployProject,
|
|
2285
3082
|
steps: $setup.deploySteps,
|
|
2286
3083
|
lines: $setup.deployLines,
|
|
@@ -2294,8 +3091,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2294
3091
|
"running",
|
|
2295
3092
|
"done",
|
|
2296
3093
|
"failed-step"
|
|
2297
|
-
])) : $setup.activePanel === "status" ? (openBlock(), createBlock($setup["StatusPanel"], {
|
|
2298
|
-
key:
|
|
3094
|
+
])], 2112)) : $setup.activePanel === "status" ? (openBlock(), createBlock($setup["StatusPanel"], {
|
|
3095
|
+
key: 5,
|
|
2299
3096
|
rows: $setup.healthRows,
|
|
2300
3097
|
error: $setup.healthError,
|
|
2301
3098
|
onRefresh: $setup.refreshHealth
|
|
@@ -2303,28 +3100,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2303
3100
|
"rows",
|
|
2304
3101
|
"error",
|
|
2305
3102
|
"onRefresh"
|
|
3103
|
+
])) : $setup.activePanel === "tunnels" ? (openBlock(), createBlock($setup["TunnelsPanel"], {
|
|
3104
|
+
key: 6,
|
|
3105
|
+
rows: $setup.tunnelRows,
|
|
3106
|
+
onStart: $setup.startTunnel,
|
|
3107
|
+
onStop: $setup.stopTunnel,
|
|
3108
|
+
onStartAll: $setup.startAllTunnels
|
|
3109
|
+
}, null, 8, [
|
|
3110
|
+
"rows",
|
|
3111
|
+
"onStart",
|
|
3112
|
+
"onStop",
|
|
3113
|
+
"onStartAll"
|
|
2306
3114
|
])) : $setup.activePanel === "output" ? (openBlock(), createBlock($setup["OutputPanel"], {
|
|
2307
|
-
key:
|
|
3115
|
+
key: 7,
|
|
2308
3116
|
logs: $setup.logs
|
|
2309
|
-
}, null, 8, ["logs"])) : (
|
|
2310
|
-
key: 6,
|
|
2311
|
-
flexDirection: "column",
|
|
2312
|
-
flexGrow: 1,
|
|
2313
|
-
borderStyle: "round",
|
|
2314
|
-
padding: 1
|
|
2315
|
-
}, {
|
|
2316
|
-
default: withCtx(() => [createVNode($setup["Text"], {
|
|
2317
|
-
bold: "",
|
|
2318
|
-
color: "cyan"
|
|
2319
|
-
}, {
|
|
2320
|
-
default: withCtx(() => [createTextVNode(toDisplayString($setup.panelTitle), 1)]),
|
|
2321
|
-
_: 1
|
|
2322
|
-
}), createVNode($setup["Text"], { dimColor: "" }, {
|
|
2323
|
-
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("(骨架占位:面板内容随 M2 后续任务实现)", -1)])]),
|
|
2324
|
-
_: 1
|
|
2325
|
-
})]),
|
|
2326
|
-
_: 1
|
|
2327
|
-
}))]),
|
|
3117
|
+
}, null, 8, ["logs"])) : createCommentVNode("v-if", true)]),
|
|
2328
3118
|
_: 1
|
|
2329
3119
|
}),
|
|
2330
3120
|
createCommentVNode(" 帮助浮层(? 开关) "),
|