Files

1589 lines
69 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script>
/** 通用模块实例管理:服务端按钮能力、图表、扩展展示与日志,升级/支付由子组件和父级协作。 */
import "~/assets/styles/CommonUpgrade.C8sZ-ExM.css";
import "~/assets/styles/LegacyProductUpgrade.dzWGwGgY.css";
import "~/assets/styles/RemfUpgrade.4stQ5ASH.css";
import "~/assets/styles/ChartBox.CYP_mhat.css";
import "~/assets/styles/CommonManage.qcc2l13i.css";
import { toDisplayString } from "vue";
import { renderList } from "vue";
import { useId } from "vue";
import { normalizeClass } from "vue";
import { onBeforeUnmount } from "vue";
import { watch } from "vue";
import { createBlock } from "vue";
import { ref } from "vue";
import { withCtx } from "vue";
import { createCommentVNode } from "vue";
import { computed } from "vue";
import { isRef } from "vue";
import { createElementBlock } from "vue";
import { Fragment } from "vue";
import { createElementVNode } from "vue";
import { createTextVNode } from "vue";
import { unref } from "vue";
import { defineComponent } from "vue";
import { createVNode } from "vue";
import { openBlock } from "vue";
import { operationMessage } from "~/lib/auth.js";
import { useApi } from "~/lib/auth.js";
import { o as backend_menu_o } from "~/lib/backend-menu.js";
import dialog from "primevue/dialog";
import button from "primevue/button";
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
import message from "primevue/message";
import inputtext from "primevue/inputtext";
import ChartBox from "~/components/ChartBox.vue";
import datatable from "primevue/datatable";
import paginator from "primevue/paginator";
import select from "primevue/select";
import inputnumber from "primevue/inputnumber";
import checkbox from "primevue/checkbox";
import column from "primevue/column";
import OperatePasswordGate from "~/components/OperatePasswordGate.vue";
import skeleton from "primevue/skeleton";
import { t as configuration_display_t } from "~/lib/configuration-display.js";
import RemfUpgrade from "~/components/instance/RemfUpgrade.vue";
import LegacyProductUpgrade from "~/components/instance/LegacyProductUpgrade.vue";
import { a as CommonUpgrade_a } from "~/components/instance/CommonUpgrade.vue";
import { i as CommonUpgrade_i } from "~/components/instance/CommonUpgrade.vue";
import { n as CommonUpgrade_n } from "~/components/instance/CommonUpgrade.vue";
import { o as CommonUpgrade_o } from "~/components/instance/CommonUpgrade.vue";
import { r as CommonUpgrade_r } from "~/components/instance/CommonUpgrade.vue";
import { s as CommonUpgrade_s } from "~/components/instance/CommonUpgrade.vue";
import CommonUpgrade from "~/components/instance/CommonUpgrade.vue";
function pe(e, t = () => {}) {
// 操作适配器只接受当前 Active 实例中明确 supported 的按钮,动作绑定模块/实例/状态快照。
let n = useApi(),
r = computed(() => e().module === `remf_finance_common`),
o = computed(() =>
CommonUpgrade_n(
CommonUpgrade_s(e().data)[r.value ? `module_button` : `client_button`],
r.value,
),
),
c = computed(() => CommonUpgrade_o(CommonUpgrade_s(e().data).os)),
l = ref(null),
d = ref(!1),
f = ref(``),
p = ref(``),
m = ref(``),
h = ref(``),
g = ref(null),
_ = ref(22),
v = ref(`1`),
y = ref(!1),
b = ref(``),
C = !1,
w = 0,
T = ``,
E = () => `${e().module}:${e().hostId}:${e().status}`,
D = () =>
!C &&
e().status === `Active` &&
!e().loading &&
[`idcsmart_common`, `reidcsmart_common`, `remf_finance_common`].includes(
e().module,
) &&
/^[1-9]\d*$/.test(e().hostId);
function O() {
(w++, (l.value = null), (m.value = ``), (h.value = ``), (b.value = ``));
}
function k() {
d.value || O();
}
function ee(e) {
D() &&
!d.value &&
o.value.some((t) => t.func === e.func && t.supported) &&
(O(),
(T = E()),
(f.value = ``),
(p.value = ``),
(y.value = !1),
(g.value = null),
(_.value = 22),
(v.value = `1`),
(l.value = e));
}
async function te() {
// 敏感动作先校验密码/镜像/重装知情确认;自定义动作与内置 provision 使用不同接口。
let i = l.value;
if (
!i ||
d.value ||
!D() ||
T !== E() ||
!o.value.some((e) => e.func === i.func && e.supported)
)
return;
let a = w,
s = () => !C && a === w && T === E(),
u = e().module,
x = e().hostId;
f.value = ``;
let O = {
client_operate_password: h.value,
};
if (
[`crack_pass`, `rescue_system`].includes(i.func) &&
m.value.length < 8
) {
f.value = `请输入至少 8 位的新密码`;
return;
}
if (
(i.func === `crack_pass` && (O.password = m.value),
i.func === `rescue_system` &&
Object.assign(O, {
system: v.value,
temp_pass: m.value,
}),
i.func === `reinstall`)
) {
let e = c.value.find((e) => e.id === g.value);
if (!e) {
f.value = `请选择操作系统`;
return;
}
if (!y.value) {
f.value = `请确认已备份数据并了解重装影响`;
return;
}
if (!Number.isInteger(_.value) || _.value < 1 || _.value > 65535) {
f.value = `端口必须为 1–65535`;
return;
}
Object.assign(O, {
option_id: e.optionId,
sub_id: e.id,
os: e.os,
os_name: e.name,
port: _.value,
});
}
let k = i.type === `custom`;
k &&
Object.assign(O, {
func: i.func,
custom_fields: {},
});
let ee = r.value
? `/${u}/${x}/${i.func}`
: `/${u}/host/${x}/${k ? `custom/provision` : `provision/${i.func}`}`;
d.value = !0;
try {
let e = await n.post(ee, O, !0);
if (!s()) return;
if (i.func === `vnc`) {
let t = CommonUpgrade_s(e.data),
n = backend_menu_o(e.url || t.url);
if (!n) throw Error(`控制台地址格式暂未适配,请联系支持`);
b.value = n;
} else
((l.value = null),
(p.value = `${i.name}指令已提交,正在读取最新状态。`),
t());
((m.value = ``), (h.value = ``));
} catch (e) {
s() &&
(f.value =
e instanceof Error ? e.message : `操作失败,请核实实例状态后重试`);
} finally {
!C && a === w && (d.value = !1);
}
}
return (
watch(
() => [e().hostId, e().module, e().status],
() => {
(O(), (d.value = !1));
},
{
flush: `sync`,
},
),
onBeforeUnmount(() => {
((C = !0), O());
}),
{
buttons: o,
osOptions: c,
action: l,
busy: d,
error: f,
success: p,
password: m,
operatePassword: h,
osId: g,
port: _,
rescueSystem: v,
acknowledged: y,
consoleUrl: b,
request: ee,
confirm: te,
close: k,
}
);
}
var me = {
class: `common-manage`,
},
he = {
class: `common-tabs`,
"aria-label": `通用实例管理`,
},
ge = [`aria-current`, `disabled`, `onClick`],
_e = {
key: 1,
class: `common-body`,
},
ve = {
class: `common-grid`,
},
ye = {
key: 0,
},
be = {
key: 1,
},
xe = {
key: 2,
},
Se = {
key: 0,
class: `muted`,
},
Ce = {
class: `common-actions`,
},
we = {
key: 1,
class: `muted`,
},
Te = {
key: 2,
class: `muted`,
},
Ee = {
class: `common-actions`,
},
De = {
key: 2,
class: `common-body`,
},
Oe = {
class: `common-actions`,
},
ke = {
key: 0,
class: `muted`,
},
Ae = {
key: 3,
class: `common-body`,
},
je = [`inert`],
Me = [`inert`],
Ne = {
key: 2,
class: `muted`,
},
Pe = {
key: 4,
class: `common-body`,
},
Fe = {
class: `common-form`,
},
Ie = [`for`],
Le = [`for`],
Re = [`for`],
ze = {
key: 2,
},
Be = [`for`],
Ve = [`href`],
P = Object.assign(
_plugin_vue_export_helper_t(
defineComponent({
__name: `CommonManage`,
props: {
hostId: {},
module: {},
host: {},
data: {},
loading: {
type: Boolean,
},
error: {},
busy: {
type: Boolean,
},
},
emits: [`refresh`, `busy`, `pay`],
setup(_, { emit: S }) {
let T = _,
A = S,
j = useApi(),
P = useId(),
F = ref(`overview`),
I = computed(() => T.module === `remf_finance_common`),
L = computed(() => CommonUpgrade_s(T.data)),
He = computed(() =>
Array.isArray(L.value.configoptions)
? L.value.configoptions.map(CommonUpgrade_s)
: [],
),
R = computed(() => CommonUpgrade_s(L.value.host)),
z = computed(
() =>
T.host.status === `Active` &&
T.host.upgrade_allowed !== !1 &&
!T.loading &&
!T.busy &&
!T.error,
),
Ue = ref(null),
B = ref(null),
We = ref(null),
Ge = computed(
() => !!(Ue.value?.busy || B.value?.busy || We.value?.busy),
),
{
buttons: Ke,
osOptions: qe,
action: V,
busy: H,
error: Je,
success: Ye,
password: Xe,
operatePassword: Ze,
osId: Qe,
port: $e,
rescueSystem: et,
acknowledged: tt,
consoleUrl: nt,
request: rt,
confirm: it,
close: at,
} = pe(
() => ({
hostId: T.hostId,
module: T.module,
status: T.host.status,
loading: !!T.loading || !!T.busy || !!T.error,
data: T.data,
}),
() => A(`refresh`),
),
ot = computed(() => H.value || Ge.value);
watch(ot, (e) => A(`busy`, e), {
flush: `sync`,
});
function st(e) {
ot.value || (F.value = e);
}
let ct = computed({
get: () => !!V.value,
set: (e) => {
e || at();
},
}),
lt = computed(() =>
Ke.value.filter((e) => ![`on`, `off`, `reboot`].includes(e.func)),
),
ut = computed(() =>
CommonUpgrade_r(L.value[I.value ? `module_chart` : `chart`]),
),
dt = ref({}),
U = ref({}),
W = ref({}),
G = ref(!1),
K = ref(86400),
ft = ref([]),
q = ref(!1),
J = ref(``),
pt = ref(1),
mt = ref(0),
ht = computed(() =>
(Array.isArray(
L.value[I.value ? `module_client_area` : `client_area`],
)
? L.value[I.value ? `module_client_area` : `client_area`]
: []
).map(CommonUpgrade_s),
),
Y = !0,
X = 0,
Z = 0;
async function Q() {
// 每张图表独立请求并记录错误;请求身份已变化时整轮结果不再回写。
let e = ++X;
((G.value = !0), (W.value = {}), (U.value = {}));
let t = Math.floor(Date.now() / 1e3) - K.value;
(await Promise.allSettled(
ut.value.map(async (n) => {
try {
let r = dt.value[n.type] ?? n.select[0]?.value ?? ``;
if (n.select.length && !n.select.some((e) => e.value === r))
throw Error(`图表选项无效`);
let i = {
start: t,
type: n.type,
select: r,
},
a = await j.post(
I.value
? `/${T.module}/${T.hostId}/chart`
: `/${T.module}/host/${T.hostId}/configoption/chart`,
I.value
? i
: {
chart: i,
},
);
Y && e === X && (U.value[n.type] = CommonUpgrade_i(a));
} catch (t) {
Y &&
e === X &&
(W.value[n.type] =
t instanceof Error ? t.message : `图表加载失败`);
}
}),
),
Y && e === X && (G.value = !1));
}
async function $() {
// 日志按接口分页读取;未获得数组时视为协议错误,而非显示一个误导性的空列表。
let e = ++Z;
((q.value = !0), (J.value = ``));
try {
let t = await j.get(`/${T.module}/${T.hostId}/log`, {
page: pt.value,
limit: 20,
orderby: `id`,
sort: `desc`,
});
if (!Y || e !== Z) return;
if (!Array.isArray(t?.list)) throw Error(`日志数据格式异常`);
((ft.value = t.list), (mt.value = Number(t.count) || 0));
} catch (t) {
Y &&
e === Z &&
(J.value = t instanceof Error ? t.message : `日志加载失败`);
} finally {
Y && e === Z && (q.value = !1);
}
}
return (
watch(F, (e) => {
(e === `charts` && Q(), e === `logs` && $());
}),
watch(
() => [T.hostId, T.module],
() => {
(X++,
Z++,
(U.value = {}),
(W.value = {}),
(ft.value = []),
(F.value = `overview`));
},
),
onBeforeUnmount(() => {
((Y = !1), X++, Z++, A(`busy`, !1));
}),
(n, i) => {
let a = button,
s = message,
u = skeleton,
x = select,
S = ChartBox,
T = RemfUpgrade,
de = LegacyProductUpgrade,
j = CommonUpgrade,
M = column,
N = datatable,
pe = paginator,
L = inputnumber,
Ge = checkbox,
Ke = inputtext,
Y = OperatePasswordGate,
X = dialog;
return (
openBlock(),
createElementBlock(`section`, me, [
createElementVNode(`nav`, he, [
(openBlock(),
createElementBlock(
Fragment,
null,
renderList(
[
{
key: `overview`,
label: `配置与管理`,
},
{
key: `charts`,
label: `监控`,
},
{
key: `billing`,
label: `升降级`,
},
{
key: `logs`,
label: `日志`,
},
],
(t) =>
createElementVNode(
`button`,
{
key: t.key,
type: `button`,
class: normalizeClass({
active: unref(F) === t.key,
}),
"aria-current":
unref(F) === t.key ? `page` : void 0,
disabled: unref(ot),
onClick: (e) => st(t.key),
},
toDisplayString(t.label),
11,
ge,
),
),
64,
)),
]),
_.error
? (openBlock(),
createBlock(
s,
{
key: 0,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(toDisplayString(_.error), 1),
createVNode(a, {
label: `重试`,
text: ``,
onClick: (i[0] ||= (e) => A(`refresh`)),
}),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
_.loading && !_.data
? (openBlock(),
createBlock(u, {
key: 1,
height: `160px`,
}))
: _.data
? (openBlock(),
createElementBlock(
Fragment,
{
key: 2,
},
[
unref(Ye)
? (openBlock(),
createBlock(
s,
{
key: 0,
severity: `success`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(
toDisplayString(unref(Ye)),
1,
),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
unref(F) === `overview`
? (openBlock(),
createElementBlock(`div`, _e, [
(i[18] ||= createElementVNode(
`h3`,
null,
`主机配置`,
-1,
)),
createElementVNode(`dl`, ve, [
unref(R).host_name
? (openBlock(),
createElementBlock(`div`, ye, [
(i[13] ||= createElementVNode(
`dt`,
null,
`主机名`,
-1,
)),
createElementVNode(
`dd`,
null,
toDisplayString(unref(R).host_name),
1,
),
]))
: createCommentVNode(``, !0),
unref(R).username
? (openBlock(),
createElementBlock(`div`, be, [
(i[14] ||= createElementVNode(
`dt`,
null,
`用户名`,
-1,
)),
createElementVNode(
`dd`,
null,
toDisplayString(unref(R).username),
1,
),
]))
: createCommentVNode(``, !0),
unref(R).os
? (openBlock(),
createElementBlock(`div`, xe, [
(i[15] ||= createElementVNode(
`dt`,
null,
`操作系统`,
-1,
)),
createElementVNode(
`dd`,
null,
toDisplayString(unref(R).os),
1,
),
]))
: createCommentVNode(``, !0),
(openBlock(!0),
createElementBlock(
Fragment,
null,
renderList(
unref(He),
(t, n) => (
openBlock(),
createElementBlock(
`div`,
{
key: n,
},
[
createElementVNode(
`dt`,
null,
toDisplayString(
unref(
configuration_display_t,
)(
String(
t.option_name || `配置`,
),
String(t.option_type || ``),
),
),
1,
),
createElementVNode(
`dd`,
null,
toDisplayString(
unref(CommonUpgrade_a)(t),
),
1,
),
],
)
),
),
128,
)),
]),
unref(He).length
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(
`p`,
Se,
`此子模块未提供更多配置项。`,
)),
(i[19] ||= createElementVNode(
`h3`,
null,
`管理操作`,
-1,
)),
createElementVNode(`div`, Ce, [
(openBlock(!0),
createElementBlock(
Fragment,
null,
renderList(
unref(lt),
(e) => (
openBlock(),
createBlock(
a,
{
key: e.func,
label: e.name,
severity: `secondary`,
disabled:
!e.supported ||
_.host.status !== `Active` ||
unref(H) ||
_.busy ||
_.loading ||
!!_.error,
title: e.reason,
onClick: (t) => unref(rt)(e),
},
null,
8,
[
`label`,
`disabled`,
`title`,
`onClick`,
],
)
),
),
128,
)),
]),
unref(lt).length
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(
`p`,
we,
`此子模块未开放更多管理操作。`,
)),
unref(lt).some((e) => !e.supported)
? (openBlock(),
createElementBlock(
`p`,
Te,
`灰色操作暂未适配当前子模块,请联系支持。`,
))
: createCommentVNode(``, !0),
unref(ht).length
? (openBlock(),
createElementBlock(
Fragment,
{
key: 3,
},
[
(i[16] ||= createElementVNode(
`h3`,
null,
`扩展功能`,
-1,
)),
createElementVNode(`div`, Ee, [
(openBlock(!0),
createElementBlock(
Fragment,
null,
renderList(
unref(ht),
(e, t) => (
openBlock(),
createBlock(
a,
{
key: t,
label: String(
e.name ||
e.title ||
e.key ||
`扩展功能`,
),
disabled: ``,
severity: `secondary`,
},
null,
8,
[`label`],
)
),
),
128,
)),
]),
(i[17] ||= createElementVNode(
`p`,
{
class: `muted`,
},
`此子模块的扩展页面暂未适配当前控制台。`,
-1,
)),
],
64,
))
: createCommentVNode(``, !0),
]))
: unref(F) === `charts`
? (openBlock(),
createElementBlock(`div`, De, [
createElementVNode(`div`, Oe, [
createVNode(
x,
{
modelValue: unref(K),
"onUpdate:modelValue": (i[1] ||= (
e,
) =>
isRef(K) ? (K.value = e) : null),
options: [
{
label: `24 小时`,
value: 86400,
},
{
label: `3 天`,
value: 259200,
},
{
label: `7 天`,
value: 604800,
},
],
"option-label": `label`,
"option-value": `value`,
"aria-label": `监控时间范围`,
onChange: Q,
},
null,
8,
[`modelValue`],
),
createVNode(
a,
{
label: `刷新`,
loading: unref(G),
severity: `secondary`,
onClick: Q,
},
null,
8,
[`loading`],
),
]),
unref(ut).length
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(
`p`,
ke,
`此子模块未提供监控图表。`,
)),
(openBlock(!0),
createElementBlock(
Fragment,
null,
renderList(
unref(ut),
(t) => (
openBlock(),
createElementBlock(
`article`,
{
key: t.type,
class: `common-chart`,
},
[
createElementVNode(
`header`,
null,
[
createElementVNode(
`h3`,
null,
toDisplayString(t.title),
1,
),
t.select.length
? (openBlock(),
createBlock(
x,
{
key: 0,
"model-value":
unref(dt)[t.type] ??
t.select[0]?.value,
options: t.select,
"option-label": `name`,
"option-value": `value`,
"aria-label": `${t.title}选项`,
"onUpdate:modelValue":
(e) => {
((unref(dt)[
t.type
] = e),
Q());
},
},
null,
8,
[
`model-value`,
`options`,
`aria-label`,
`onUpdate:modelValue`,
],
))
: createCommentVNode(
``,
!0,
),
],
),
unref(W)[t.type]
? (openBlock(),
createBlock(
s,
{
key: 0,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(
toDisplayString(
unref(W)[t.type],
),
1,
),
]),
_: 2,
},
1024,
))
: unref(U)[t.type]
? (openBlock(),
createBlock(
S,
{
key: 1,
option:
unref(U)[t.type],
height: 280,
},
null,
8,
[`option`],
))
: unref(G)
? (openBlock(),
createBlock(u, {
key: 2,
height: `240px`,
}))
: createCommentVNode(
``,
!0,
),
],
)
),
),
128,
)),
]))
: unref(F) === `billing`
? (openBlock(),
createElementBlock(`div`, Ae, [
unref(I)
? (openBlock(),
createElementBlock(
Fragment,
{
key: 0,
},
[
createElementVNode(
`div`,
{
inert: !!unref(We)?.busy,
},
[
createVNode(
T,
{
ref_key: `financeConfigUpgrade`,
ref: B,
"host-id": _.hostId,
module: _.module,
"upgrade-allowed":
unref(z),
onPay: (i[2] ||= (e) =>
A(`pay`, e)),
},
null,
8,
[
`host-id`,
`module`,
`upgrade-allowed`,
],
),
],
8,
je,
),
createElementVNode(
`div`,
{
inert: !!unref(B)?.busy,
},
[
createVNode(
de,
{
ref_key: `financeProductUpgrade`,
ref: We,
"host-id": _.hostId,
module: _.module,
"upgrade-allowed":
unref(z),
onPay: (i[3] ||= (e) =>
A(`pay`, e)),
},
null,
8,
[
`host-id`,
`module`,
`upgrade-allowed`,
],
),
],
8,
Me,
),
],
64,
))
: (openBlock(),
createBlock(
j,
{
key: 1,
ref_key: `nativeUpgrade`,
ref: Ue,
"host-id": _.hostId,
module: _.module,
current: _.data,
allowed: unref(z),
onPay: (i[4] ||= (e) =>
A(`pay`, e)),
},
null,
8,
[
`host-id`,
`module`,
`current`,
`allowed`,
],
)),
unref(z)
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(
`p`,
Ne,
`当前实例状态不支持升降级。`,
)),
]))
: unref(F) === `logs`
? (openBlock(),
createElementBlock(`div`, Pe, [
createVNode(
a,
{
label: `刷新日志`,
loading: unref(q),
severity: `secondary`,
onClick: $,
},
null,
8,
[`loading`],
),
unref(J)
? (openBlock(),
createBlock(
s,
{
key: 0,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(
toDisplayString(unref(J)),
1,
),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
createVNode(
N,
{
value: unref(ft),
loading: unref(q),
scrollable: ``,
},
{
empty: withCtx(() => [
...(i[20] ||= [
createTextVNode(
`暂无操作日志`,
-1,
),
]),
]),
default: withCtx(() => [
createVNode(
M,
{
header: `时间`,
},
{
body: withCtx(
({ data: t }) => [
createTextVNode(
toDisplayString(
typeof t.create_time ==
`number`
? new Date(
t.create_time *
1e3,
).toLocaleString(
`zh-CN`,
)
: t.create_time,
),
1,
),
],
),
_: 1,
},
),
createVNode(
M,
{
header: `操作`,
},
{
body: withCtx(
({ data: t }) => [
createTextVNode(
toDisplayString(
unref(
operationMessage,
)(t.description),
),
1,
),
],
),
_: 1,
},
),
createVNode(M, {
field: `ip`,
header: `IP`,
}),
]),
_: 1,
},
8,
[`value`, `loading`],
),
unref(mt) > 20
? (openBlock(),
createBlock(
pe,
{
key: 1,
rows: 20,
first: (unref(pt) - 1) * 20,
"total-records": unref(mt),
onPage: (i[5] ||= (e) => {
((pt.value = e.page + 1),
$());
}),
},
null,
8,
[`first`, `total-records`],
))
: createCommentVNode(``, !0),
]))
: createCommentVNode(``, !0),
],
64,
))
: createCommentVNode(``, !0),
createVNode(
X,
{
visible: unref(ct),
"onUpdate:visible": (i[12] ||= (e) =>
isRef(ct) ? (ct.value = e) : null),
header: unref(V)?.name || `确认操作`,
modal: ``,
closable: !unref(H),
"close-on-escape": !unref(H),
draggable: !1,
style: {
width: `500px`,
maxWidth: `94vw`,
},
},
{
footer: withCtx(() => [
createVNode(
a,
{
label: `关闭`,
severity: `secondary`,
disabled: unref(H),
onClick: unref(at),
},
null,
8,
[`disabled`, `onClick`],
),
unref(nt)
? createCommentVNode(``, !0)
: (openBlock(),
createBlock(
a,
{
key: 0,
label: `确认操作`,
loading: unref(H),
disabled:
_.host.status !== `Active` ||
_.loading ||
_.busy ||
!!_.error,
onClick: unref(it),
},
null,
8,
[`loading`, `disabled`, `onClick`],
)),
]),
default: withCtx(() => [
createElementVNode(`div`, Fe, [
createElementVNode(
`p`,
null,
`实例 #` +
toDisplayString(_.hostId) +
` · ` +
toDisplayString(_.host.name),
1,
),
unref(V)?.func === `reinstall`
? (openBlock(),
createElementBlock(
Fragment,
{
key: 0,
},
[
createVNode(
s,
{
severity: `warn`,
closable: !1,
},
{
default: withCtx(() => [
...(i[21] ||= [
createTextVNode(
`重装将清除系统数据。请先备份,再继续。`,
-1,
),
]),
]),
_: 1,
},
),
createVNode(
x,
{
modelValue: unref(Qe),
"onUpdate:modelValue": (i[6] ||= (e) =>
isRef(Qe) ? (Qe.value = e) : null),
options: unref(qe),
"option-label": `name`,
"option-value": `id`,
"aria-label": `操作系统`,
disabled: unref(H),
placeholder: `选择操作系统`,
},
null,
8,
[`modelValue`, `options`, `disabled`],
),
createElementVNode(
`label`,
{
for: `${unref(P)}-port`,
},
`登录端口`,
8,
Ie,
),
createVNode(
L,
{
"input-id": `${unref(P)}-port`,
modelValue: unref($e),
"onUpdate:modelValue": (i[7] ||= (e) =>
isRef($e) ? ($e.value = e) : null),
min: 1,
max: 65535,
"use-grouping": !1,
disabled: unref(H),
},
null,
8,
[`input-id`, `modelValue`, `disabled`],
),
createElementVNode(`div`, null, [
createVNode(
Ge,
{
modelValue: unref(tt),
"onUpdate:modelValue": (i[8] ||= (e) =>
isRef(tt) ? (tt.value = e) : null),
"input-id": `${unref(P)}-ack`,
binary: ``,
disabled: unref(H),
},
null,
8,
[`modelValue`, `input-id`, `disabled`],
),
(i[22] ||= createTextVNode()),
createElementVNode(
`label`,
{
for: `${unref(P)}-ack`,
},
`已备份数据并了解重装影响`,
8,
Le,
),
]),
],
64,
))
: [`crack_pass`, `rescue_system`].includes(
unref(V)?.func || ``,
)
? (openBlock(),
createElementBlock(
Fragment,
{
key: 1,
},
[
createElementVNode(
`label`,
{
for: `${unref(P)}-password`,
},
toDisplayString(
unref(V)?.func === `rescue_system`
? `救援临时密码`
: `新密码`,
),
9,
Re,
),
createVNode(
Ke,
{
id: `${unref(P)}-password`,
modelValue: unref(Xe),
"onUpdate:modelValue": (i[9] ||= (e) =>
isRef(Xe) ? (Xe.value = e) : null),
type: `password`,
autocomplete: `new-password`,
disabled: unref(H),
},
null,
8,
[`id`, `modelValue`, `disabled`],
),
unref(V)?.func === `rescue_system`
? (openBlock(),
createBlock(
x,
{
key: 0,
modelValue: unref(et),
"onUpdate:modelValue": (i[10] ||= (
e,
) =>
isRef(et)
? (et.value = e)
: null),
options: [
{
label: `Linux`,
value: `1`,
},
{
label: `Windows`,
value: `2`,
},
],
"option-label": `label`,
"option-value": `value`,
"aria-label": `救援系统`,
disabled: unref(H),
},
null,
8,
[`modelValue`, `disabled`],
))
: createCommentVNode(``, !0),
],
64,
))
: unref(V)?.func === `vnc`
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(
`p`,
ze,
`此操作可能中断实例上的服务,请确认后继续。`,
)),
createVNode(Y, null, {
default: withCtx(() => [
createElementVNode(
`label`,
{
for: `${unref(P)}-operate`,
},
`操作密码(如已设置)`,
8,
Be,
),
createVNode(
Ke,
{
id: `${unref(P)}-operate`,
modelValue: unref(Ze),
"onUpdate:modelValue": (i[11] ||= (e) =>
isRef(Ze) ? (Ze.value = e) : null),
type: `password`,
autocomplete: `off`,
disabled: unref(H),
},
null,
8,
[`id`, `modelValue`, `disabled`],
),
]),
_: 1,
}),
unref(Je)
? (openBlock(),
createBlock(
s,
{
key: 3,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(
toDisplayString(unref(Je)),
1,
),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
unref(nt)
? (openBlock(),
createElementBlock(
`a`,
{
key: 4,
href: unref(nt),
target: `_blank`,
rel: `noopener noreferrer`,
},
`打开远程控制台`,
8,
Ve,
))
: createCommentVNode(``, !0),
]),
]),
_: 1,
},
8,
[`visible`, `header`, `closable`, `close-on-escape`],
),
])
);
}
);
},
}),
[[`__scopeId`, `data-v-34fd3c5d`]],
),
{
__name: `CommonManage`,
},
);
export {};
export default P;
</script>