1442 lines
73 KiB
Vue
1442 lines
73 KiB
Vue
<script>
|
||
// KKY ECS 分项升级入口:实例规格、带宽、防护、新增硬盘和已有磁盘扩容分别调用对应接口。
|
||
import "~/assets/styles/ConfigBandwidth.CWSH1WJZ.css";
|
||
import "~/assets/styles/KkyUpgrade.CkDmxFBM.css";
|
||
import { toDisplayString } from "vue";
|
||
import { renderList } from "vue";
|
||
import { onMounted } 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 { sanitizeMessage } from "~/lib/auth.js";
|
||
import { useApi } from "~/lib/auth.js";
|
||
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 select from "primevue/select";
|
||
import inputnumber from "primevue/inputnumber";
|
||
import OperationNotice from "~/components/OperationNotice.vue";
|
||
import tag from "primevue/tag";
|
||
import skeleton from "primevue/skeleton";
|
||
import ConfigBandwidth from "~/components/config/ConfigBandwidth.vue";
|
||
var ue = {
|
||
key: 0,
|
||
class: `up`,
|
||
},
|
||
de = {
|
||
key: 0,
|
||
class: `current`,
|
||
},
|
||
fe = {
|
||
class: `current-spec`,
|
||
},
|
||
pe = {
|
||
class: `seg`,
|
||
},
|
||
me = [`onClick`],
|
||
he = {
|
||
key: 2,
|
||
class: `sk`,
|
||
},
|
||
ge = {
|
||
key: 0,
|
||
class: `plans`,
|
||
},
|
||
_e = [`disabled`, `onClick`],
|
||
ve = {
|
||
class: `plan-head`,
|
||
},
|
||
ye = {
|
||
class: `plan-name`,
|
||
},
|
||
be = {
|
||
key: 1,
|
||
class: `pi pi-check-circle plan-check`,
|
||
},
|
||
xe = {
|
||
key: 0,
|
||
class: `plan-desc`,
|
||
},
|
||
Se = {
|
||
key: 0,
|
||
class: `field`,
|
||
},
|
||
Ce = {
|
||
class: `field-hint`,
|
||
},
|
||
we = {
|
||
class: `sub`,
|
||
},
|
||
Te = {
|
||
class: `field-row`,
|
||
},
|
||
Ee = {
|
||
class: `field`,
|
||
},
|
||
De = {
|
||
class: `field`,
|
||
},
|
||
Oe = {
|
||
class: `note`,
|
||
},
|
||
ke = {
|
||
key: 0,
|
||
class: `disks`,
|
||
},
|
||
Ae = [`onClick`],
|
||
je = {
|
||
class: `disk-name`,
|
||
},
|
||
Me = {
|
||
class: `disk-meta`,
|
||
},
|
||
Ne = {
|
||
key: 2,
|
||
class: `field`,
|
||
},
|
||
Pe = {
|
||
class: `field-hint`,
|
||
},
|
||
Fe = {
|
||
key: 5,
|
||
class: `bar`,
|
||
},
|
||
Ie = {
|
||
class: `bar-price`,
|
||
},
|
||
Le = {
|
||
class: `bar-value`,
|
||
},
|
||
Re = {
|
||
key: 0,
|
||
class: `pi pi-spin pi-spinner`,
|
||
},
|
||
ze = {
|
||
key: 0,
|
||
class: `bar-sub`,
|
||
},
|
||
Be = {
|
||
key: 6,
|
||
class: `changes`,
|
||
},
|
||
x = Object.assign(
|
||
_plugin_vue_export_helper_t(
|
||
defineComponent({
|
||
__name: `KkyUpgrade`,
|
||
props: {
|
||
hostId: {},
|
||
upgradeAllowed: {
|
||
type: Boolean,
|
||
default: !0,
|
||
},
|
||
disks: {},
|
||
current: {},
|
||
},
|
||
emits: [`pay`, `refresh`],
|
||
setup(_, { emit: b }) {
|
||
let x = _,
|
||
S = b,
|
||
C = useApi(),
|
||
w = ref(``),
|
||
T = computed(() => `/kky_ecs/upgrade/${x.hostId}`),
|
||
Ve = [
|
||
{
|
||
key: `ins`,
|
||
label: `实例规格`,
|
||
icon: `pi pi-desktop`,
|
||
},
|
||
{
|
||
key: `bandwidth`,
|
||
label: `带宽上限`,
|
||
icon: `pi pi-wifi`,
|
||
},
|
||
{
|
||
key: `protect`,
|
||
label: `防护`,
|
||
icon: `pi pi-shield`,
|
||
},
|
||
{
|
||
key: `disk`,
|
||
label: `硬盘`,
|
||
icon: `pi pi-database`,
|
||
},
|
||
],
|
||
E = ref(`ins`),
|
||
D = ref(!1),
|
||
O = ref({}),
|
||
He = new Set(),
|
||
k = ref([]),
|
||
A = ref(null),
|
||
j = ref(null),
|
||
M = ref(0),
|
||
Ue = computed(() =>
|
||
j.value
|
||
? [
|
||
{
|
||
type: `step`,
|
||
min_value: j.value.min,
|
||
max_value: j.value.max,
|
||
step: j.value.step,
|
||
},
|
||
]
|
||
: [],
|
||
),
|
||
N = ref([]),
|
||
P = ref(null),
|
||
F = ref(`add`),
|
||
I = ref(null),
|
||
L = ref(0),
|
||
R = ref(1),
|
||
z = ref(null),
|
||
B = ref(null),
|
||
V = ref(0),
|
||
H = ref(null),
|
||
U = ref(!1),
|
||
W = ref(!1),
|
||
G = ref(``),
|
||
K = 0,
|
||
q = 0,
|
||
J = !1,
|
||
We = computed(() =>
|
||
F.value === `expand`
|
||
? (z.value?.type?.[0] ?? `SSD`)
|
||
: (I.value?.type?.[0] ?? `SSD`),
|
||
),
|
||
Ge = computed(() =>
|
||
[
|
||
x.current.cpu ? `${x.current.cpu} 核` : ``,
|
||
x.current.memory ? `${x.current.memory} GB 内存` : ``,
|
||
x.current.bw ? `${x.current.bw} Mbps` : ``,
|
||
x.current.protect ? `${x.current.protect} G 防护` : ``,
|
||
]
|
||
.filter(Boolean)
|
||
.join(` · `),
|
||
);
|
||
function Ke(e) {
|
||
let t = e;
|
||
for (let e of x.disks)
|
||
e.ident &&
|
||
(t = t
|
||
.split(`${e.ident}, `)
|
||
.join(``)
|
||
.split(e.ident)
|
||
.join(e.name));
|
||
return t;
|
||
}
|
||
let qe = computed(() =>
|
||
(H.value?.description ?? ``)
|
||
.split(/\r?\n/)
|
||
.map((e) => e.trim())
|
||
.filter(Boolean)
|
||
.map(Ke),
|
||
);
|
||
async function Je() {
|
||
k.value = await C.get(`${T.value}/ins_upgrade_config`);
|
||
}
|
||
async function Ye() {
|
||
let e = await C.get(`${T.value}/bandwidth_config`);
|
||
((j.value = e), (M.value = e.min));
|
||
}
|
||
async function Xe() {
|
||
N.value = await C.get(`${T.value}/protect_upgrade_config`);
|
||
}
|
||
async function Ze() {
|
||
let e = await C.get(`${T.value}/add_disk_config`);
|
||
((I.value = e), (L.value = e.min), (R.value = 1));
|
||
}
|
||
let Qe = {
|
||
ins: Je,
|
||
bandwidth: Ye,
|
||
protect: Xe,
|
||
disk: Ze,
|
||
};
|
||
// 各页签首次进入时按需加载规格,已尝试加载的页签不重复发起初始化请求。
|
||
async function Y(e) {
|
||
if (
|
||
x.upgradeAllowed !== !1 &&
|
||
((E.value = e), (G.value = ``), (H.value = null), !He.has(e))
|
||
) {
|
||
(He.add(e), (D.value = !0));
|
||
try {
|
||
(await Qe[e](), await Z());
|
||
} catch (t) {
|
||
O.value[e] = t instanceof Error ? t.message : `暂不可用`;
|
||
} finally {
|
||
D.value = !1;
|
||
}
|
||
}
|
||
}
|
||
// 扩容配置必须匹配所选磁盘 identity;切换磁盘或页签后丢弃旧配置响应。
|
||
async function $e(e) {
|
||
if (J || x.upgradeAllowed === !1 || W.value) return;
|
||
let t = ++q,
|
||
n = x.hostId;
|
||
(K++, (U.value = !1));
|
||
let r = () =>
|
||
!J &&
|
||
t === q &&
|
||
n === x.hostId &&
|
||
E.value === `disk` &&
|
||
F.value === `expand` &&
|
||
B.value?.ident === e.ident;
|
||
((B.value = e),
|
||
(z.value = null),
|
||
(V.value = 0),
|
||
(H.value = null),
|
||
(G.value = ``));
|
||
try {
|
||
let t = await C.get(`${T.value}/expand_disk_config`, {
|
||
disk_identity: e.ident,
|
||
});
|
||
if (!r()) return;
|
||
if (!e.ident || String(t?.disk_info?.identity) !== e.ident)
|
||
throw Error(`磁盘配置与所选磁盘不一致,请重新选择`);
|
||
((z.value = t), (V.value = t.min + t.step), await Z());
|
||
} catch (e) {
|
||
r() &&
|
||
(G.value =
|
||
e instanceof Error ? e.message : `该磁盘暂不支持扩容`);
|
||
}
|
||
}
|
||
// 根据当前页签组装请求体;新增磁盘发送列表,扩容发送类型、目标容量与唯一标识。
|
||
function X() {
|
||
return E.value === `ins`
|
||
? A.value
|
||
? {
|
||
cpu_num: A.value.cpu_num,
|
||
memory: A.value.memory,
|
||
}
|
||
: null
|
||
: E.value === `bandwidth`
|
||
? M.value
|
||
? {
|
||
bandwidth: M.value,
|
||
}
|
||
: null
|
||
: E.value === `protect`
|
||
? P.value
|
||
? {
|
||
protect: P.value,
|
||
}
|
||
: null
|
||
: F.value === `add`
|
||
? !I.value ||
|
||
I.value.remaining_num <= 0 ||
|
||
!L.value ||
|
||
!R.value
|
||
? null
|
||
: {
|
||
add_disks: Array.from(
|
||
{
|
||
length: R.value,
|
||
},
|
||
() => ({
|
||
type: We.value,
|
||
size: L.value,
|
||
}),
|
||
),
|
||
}
|
||
: !z.value ||
|
||
!V.value ||
|
||
!B.value?.ident ||
|
||
String(z.value.disk_info.identity) !== B.value.ident
|
||
? null
|
||
: {
|
||
expand_disk: {
|
||
property: B.value?.type2 === `system` ? 1 : 2,
|
||
type: We.value,
|
||
size: V.value,
|
||
identity: z.value.disk_info.identity,
|
||
},
|
||
};
|
||
}
|
||
// 询价记录页签、实例和请求体快照,只让仍对应当前选择的结果更新界面。
|
||
async function Z() {
|
||
if (x.upgradeAllowed === !1) return;
|
||
let e = ++K,
|
||
t = X();
|
||
if (!t) {
|
||
((H.value = null), (U.value = !1));
|
||
return;
|
||
}
|
||
let n = E.value,
|
||
r = x.hostId,
|
||
i = JSON.stringify(t),
|
||
a = () =>
|
||
!J &&
|
||
r === x.hostId &&
|
||
e === K &&
|
||
E.value === n &&
|
||
JSON.stringify(X()) === i;
|
||
((U.value = !0), (H.value = null), (G.value = ``));
|
||
try {
|
||
let e = await C.post(`${T.value}/get_upgrade_price`, t);
|
||
a() && (H.value = e);
|
||
} catch (e) {
|
||
if (!a()) return;
|
||
((H.value = null),
|
||
(G.value = e instanceof Error ? e.message : `询价失败`));
|
||
} finally {
|
||
e === K && (U.value = !1);
|
||
}
|
||
}
|
||
let et = {
|
||
ins: `ins_upgrade_order`,
|
||
bandwidth: `bandwidth_order`,
|
||
protect: `protect_upgrade_order`,
|
||
};
|
||
// 按升级种类选择订单接口,返回后由父级统一处理支付。
|
||
async function tt() {
|
||
if (x.upgradeAllowed === !1 || W.value || U.value || !H.value)
|
||
return;
|
||
let e = X();
|
||
if (e) {
|
||
((W.value = !0), (G.value = ``), (w.value = ``));
|
||
try {
|
||
let t =
|
||
E.value === `disk`
|
||
? F.value === `add`
|
||
? `add_disk_order`
|
||
: `expand_disk_order`
|
||
: et[E.value],
|
||
n = await C.post(`${T.value}/${t}`, e);
|
||
S(`pay`, {
|
||
order_id: n.id,
|
||
amount: H.value?.price ?? String(n.amount ?? `0`),
|
||
});
|
||
} catch (e) {
|
||
w.value = e instanceof Error ? e.message : `下单失败`;
|
||
} finally {
|
||
W.value = !1;
|
||
}
|
||
}
|
||
}
|
||
function nt(e) {
|
||
((G.value = ``), (H.value = null), (O.value[e] = void 0));
|
||
}
|
||
function rt(e, t) {
|
||
x.upgradeAllowed !== !1 &&
|
||
((A.value = {
|
||
cpu_num: e,
|
||
memory: t,
|
||
}),
|
||
nt(`ins`),
|
||
Z());
|
||
}
|
||
function Q() {
|
||
((H.value = null), Z());
|
||
}
|
||
function it(e) {
|
||
x.upgradeAllowed === !1 ||
|
||
W.value ||
|
||
D.value ||
|
||
((M.value = e), K++, (H.value = null), (U.value = !1));
|
||
}
|
||
function $(e) {
|
||
((F.value = e), (G.value = ``), (H.value = null));
|
||
}
|
||
return (
|
||
watch(
|
||
[E, F, () => x.hostId],
|
||
() => {
|
||
(q++,
|
||
K++,
|
||
(z.value = null),
|
||
(B.value = null),
|
||
(V.value = 0),
|
||
(H.value = null),
|
||
(U.value = !1));
|
||
},
|
||
{
|
||
flush: `sync`,
|
||
},
|
||
),
|
||
onBeforeUnmount(() => {
|
||
((J = !0), q++, K++);
|
||
}),
|
||
onMounted(() => Y(`ins`)),
|
||
(n, i) => {
|
||
let a = OperationNotice,
|
||
s = message,
|
||
u = skeleton,
|
||
te = tag,
|
||
b = ConfigBandwidth,
|
||
x = select,
|
||
S = inputnumber,
|
||
C = button;
|
||
return _.upgradeAllowed === !1
|
||
? createCommentVNode(``, !0)
|
||
: (openBlock(),
|
||
createElementBlock(`div`, ue, [
|
||
createVNode(
|
||
a,
|
||
{
|
||
message: unref(w),
|
||
severity: `error`,
|
||
},
|
||
null,
|
||
8,
|
||
[`message`],
|
||
),
|
||
unref(Ge)
|
||
? (openBlock(),
|
||
createElementBlock(`div`, de, [
|
||
(i[6] ||= createElementVNode(
|
||
`span`,
|
||
{
|
||
class: `current-label`,
|
||
},
|
||
`当前配置`,
|
||
-1,
|
||
)),
|
||
createElementVNode(
|
||
`span`,
|
||
fe,
|
||
toDisplayString(unref(Ge)),
|
||
1,
|
||
),
|
||
]))
|
||
: createCommentVNode(``, !0),
|
||
createElementVNode(`div`, pe, [
|
||
(openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
null,
|
||
renderList(Ve, (t) =>
|
||
createElementVNode(
|
||
`button`,
|
||
{
|
||
key: t.key,
|
||
type: `button`,
|
||
class: normalizeClass([
|
||
`seg-item`,
|
||
{
|
||
active: unref(E) === t.key,
|
||
},
|
||
]),
|
||
onClick: (e) => Y(t.key),
|
||
},
|
||
[
|
||
createElementVNode(
|
||
`i`,
|
||
{
|
||
class: normalizeClass(t.icon),
|
||
},
|
||
null,
|
||
2,
|
||
),
|
||
createElementVNode(
|
||
`span`,
|
||
null,
|
||
toDisplayString(t.label),
|
||
1,
|
||
),
|
||
],
|
||
10,
|
||
me,
|
||
),
|
||
),
|
||
64,
|
||
)),
|
||
]),
|
||
unref(G)
|
||
? (openBlock(),
|
||
createBlock(
|
||
s,
|
||
{
|
||
key: 1,
|
||
severity: `error`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
createTextVNode(toDisplayString(unref(G)), 1),
|
||
]),
|
||
_: 1,
|
||
},
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
unref(D)
|
||
? (openBlock(),
|
||
createElementBlock(`div`, he, [
|
||
createVNode(u, {
|
||
height: `110px`,
|
||
}),
|
||
]))
|
||
: unref(O)[unref(E)]
|
||
? (openBlock(),
|
||
createBlock(
|
||
s,
|
||
{
|
||
key: 3,
|
||
severity: `info`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
createTextVNode(
|
||
toDisplayString(unref(O)[unref(E)]),
|
||
1,
|
||
),
|
||
]),
|
||
_: 1,
|
||
},
|
||
))
|
||
: (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 4,
|
||
},
|
||
[
|
||
unref(E) === `ins`
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 0,
|
||
},
|
||
[
|
||
unref(k).length
|
||
? (openBlock(),
|
||
createElementBlock(`div`, ge, [
|
||
(openBlock(!0),
|
||
createElementBlock(
|
||
Fragment,
|
||
null,
|
||
renderList(
|
||
unref(k),
|
||
(n) => (
|
||
openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: n.cpu_num,
|
||
},
|
||
[
|
||
(openBlock(!0),
|
||
createElementBlock(
|
||
Fragment,
|
||
null,
|
||
renderList(
|
||
n.mem_list,
|
||
(t) => (
|
||
openBlock(),
|
||
createElementBlock(
|
||
`button`,
|
||
{
|
||
key: t.id,
|
||
type: `button`,
|
||
class:
|
||
normalizeClass(
|
||
[
|
||
`plan`,
|
||
{
|
||
active:
|
||
unref(
|
||
A,
|
||
)
|
||
?.cpu_num ===
|
||
n.cpu_num &&
|
||
unref(
|
||
A,
|
||
)
|
||
?.memory ===
|
||
t.memory,
|
||
},
|
||
],
|
||
),
|
||
disabled:
|
||
t.is_sell_out ===
|
||
1,
|
||
onClick: (e) =>
|
||
rt(
|
||
n.cpu_num,
|
||
t.memory,
|
||
),
|
||
},
|
||
[
|
||
createElementVNode(
|
||
`div`,
|
||
ve,
|
||
[
|
||
createElementVNode(
|
||
`span`,
|
||
ye,
|
||
toDisplayString(
|
||
n.cpu_num,
|
||
) +
|
||
` 核 ` +
|
||
toDisplayString(
|
||
t.memory,
|
||
) +
|
||
` GB`,
|
||
1,
|
||
),
|
||
t.is_sell_out ===
|
||
1
|
||
? (openBlock(),
|
||
createBlock(
|
||
te,
|
||
{
|
||
key: 0,
|
||
value: `售罄`,
|
||
severity: `secondary`,
|
||
},
|
||
))
|
||
: unref(A)
|
||
?.cpu_num ===
|
||
n.cpu_num &&
|
||
unref(
|
||
A,
|
||
)
|
||
?.memory ===
|
||
t.memory
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
`i`,
|
||
be,
|
||
))
|
||
: createCommentVNode(
|
||
``,
|
||
!0,
|
||
),
|
||
],
|
||
),
|
||
t.description
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
`div`,
|
||
xe,
|
||
toDisplayString(
|
||
unref(
|
||
sanitizeMessage,
|
||
)(
|
||
t.description,
|
||
),
|
||
),
|
||
1,
|
||
))
|
||
: createCommentVNode(
|
||
``,
|
||
!0,
|
||
),
|
||
],
|
||
10,
|
||
_e,
|
||
)
|
||
),
|
||
),
|
||
128,
|
||
)),
|
||
],
|
||
64,
|
||
)
|
||
),
|
||
),
|
||
128,
|
||
)),
|
||
]))
|
||
: (openBlock(),
|
||
createBlock(
|
||
s,
|
||
{
|
||
key: 1,
|
||
severity: `info`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
...(i[7] ||= [
|
||
createTextVNode(
|
||
`当前规格已是可选购的最高配置,没有可升级的套餐。`,
|
||
-1,
|
||
),
|
||
]),
|
||
]),
|
||
_: 1,
|
||
},
|
||
)),
|
||
],
|
||
64,
|
||
))
|
||
: unref(E) === `bandwidth` && unref(j)
|
||
? (openBlock(),
|
||
createBlock(
|
||
b,
|
||
{
|
||
key: 1,
|
||
"model-value": unref(M),
|
||
options: unref(Ue),
|
||
disabled: unref(W) || unref(D),
|
||
"onUpdate:modelValue": it,
|
||
onChange: Q,
|
||
},
|
||
null,
|
||
8,
|
||
[`model-value`, `options`, `disabled`],
|
||
))
|
||
: unref(E) === `protect`
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 2,
|
||
},
|
||
[
|
||
unref(N).length
|
||
? (openBlock(),
|
||
createElementBlock(`div`, Se, [
|
||
(i[8] ||= createElementVNode(
|
||
`label`,
|
||
null,
|
||
`升级至`,
|
||
-1,
|
||
)),
|
||
createVNode(
|
||
x,
|
||
{
|
||
modelValue: unref(P),
|
||
"onUpdate:modelValue": [
|
||
(i[0] ||= (e) =>
|
||
isRef(P)
|
||
? (P.value = e)
|
||
: null),
|
||
Q,
|
||
],
|
||
options: unref(N),
|
||
placeholder: `选择防护峰值`,
|
||
},
|
||
{
|
||
option: withCtx(
|
||
({ option: t }) => [
|
||
createTextVNode(
|
||
toDisplayString(t) +
|
||
` G`,
|
||
1,
|
||
),
|
||
],
|
||
),
|
||
_: 1,
|
||
},
|
||
8,
|
||
[`modelValue`, `options`],
|
||
),
|
||
createElementVNode(
|
||
`span`,
|
||
Ce,
|
||
`可选防护峰值:` +
|
||
toDisplayString(
|
||
unref(N)
|
||
.map((e) => `${e}G`)
|
||
.join(` / `),
|
||
),
|
||
1,
|
||
),
|
||
]))
|
||
: (openBlock(),
|
||
createBlock(
|
||
s,
|
||
{
|
||
key: 1,
|
||
severity: `info`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
...(i[9] ||= [
|
||
createTextVNode(
|
||
`当前实例没有可升级的防护配置。`,
|
||
-1,
|
||
),
|
||
]),
|
||
]),
|
||
_: 1,
|
||
},
|
||
)),
|
||
],
|
||
64,
|
||
))
|
||
: unref(E) === `disk`
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 3,
|
||
},
|
||
[
|
||
createElementVNode(`div`, we, [
|
||
createElementVNode(
|
||
`button`,
|
||
{
|
||
type: `button`,
|
||
class: normalizeClass([
|
||
`sub-item`,
|
||
{
|
||
active:
|
||
unref(F) === `add`,
|
||
},
|
||
]),
|
||
onClick: (i[1] ||= (e) =>
|
||
$(`add`)),
|
||
},
|
||
` 新增数据盘 `,
|
||
2,
|
||
),
|
||
createElementVNode(
|
||
`button`,
|
||
{
|
||
type: `button`,
|
||
class: normalizeClass([
|
||
`sub-item`,
|
||
{
|
||
active:
|
||
unref(F) === `expand`,
|
||
},
|
||
]),
|
||
onClick: (i[2] ||= (e) =>
|
||
$(`expand`)),
|
||
},
|
||
` 扩容已有盘 `,
|
||
2,
|
||
),
|
||
]),
|
||
unref(F) === `add`
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 0,
|
||
},
|
||
[
|
||
unref(I) &&
|
||
unref(I).remaining_num > 0
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 0,
|
||
},
|
||
[
|
||
createElementVNode(
|
||
`div`,
|
||
Te,
|
||
[
|
||
createElementVNode(
|
||
`div`,
|
||
Ee,
|
||
[
|
||
(i[10] ||=
|
||
createElementVNode(
|
||
`label`,
|
||
null,
|
||
`单盘容量`,
|
||
-1,
|
||
)),
|
||
createVNode(
|
||
S,
|
||
{
|
||
modelValue:
|
||
unref(
|
||
L,
|
||
),
|
||
"onUpdate:modelValue":
|
||
[
|
||
(i[3] ||=
|
||
(
|
||
e,
|
||
) =>
|
||
isRef(
|
||
L,
|
||
)
|
||
? (L.value =
|
||
e)
|
||
: null),
|
||
Q,
|
||
],
|
||
min: unref(
|
||
I,
|
||
).min,
|
||
max: unref(
|
||
I,
|
||
).max,
|
||
step: unref(
|
||
I,
|
||
).step,
|
||
showButtons: ``,
|
||
buttonLayout: `horizontal`,
|
||
suffix: ` GB`,
|
||
},
|
||
null,
|
||
8,
|
||
[
|
||
`modelValue`,
|
||
`min`,
|
||
`max`,
|
||
`step`,
|
||
],
|
||
),
|
||
],
|
||
),
|
||
createElementVNode(
|
||
`div`,
|
||
De,
|
||
[
|
||
(i[11] ||=
|
||
createElementVNode(
|
||
`label`,
|
||
null,
|
||
`数量`,
|
||
-1,
|
||
)),
|
||
createVNode(
|
||
S,
|
||
{
|
||
modelValue:
|
||
unref(
|
||
R,
|
||
),
|
||
"onUpdate:modelValue":
|
||
[
|
||
(i[4] ||=
|
||
(
|
||
e,
|
||
) =>
|
||
isRef(
|
||
R,
|
||
)
|
||
? (R.value =
|
||
e)
|
||
: null),
|
||
Q,
|
||
],
|
||
min: 1,
|
||
max: unref(
|
||
I,
|
||
)
|
||
.remaining_num,
|
||
showButtons: ``,
|
||
buttonLayout: `horizontal`,
|
||
suffix: ` 块`,
|
||
},
|
||
null,
|
||
8,
|
||
[
|
||
`modelValue`,
|
||
`max`,
|
||
],
|
||
),
|
||
],
|
||
),
|
||
],
|
||
),
|
||
createElementVNode(
|
||
`p`,
|
||
Oe,
|
||
toDisplayString(
|
||
unref(
|
||
I,
|
||
).type.join(
|
||
` / `,
|
||
),
|
||
) +
|
||
` 数据盘,单盘 ` +
|
||
toDisplayString(
|
||
unref(I).min,
|
||
) +
|
||
` – ` +
|
||
toDisplayString(
|
||
unref(I).max,
|
||
) +
|
||
` GB,步长 ` +
|
||
toDisplayString(
|
||
unref(I).step,
|
||
) +
|
||
`; 最多可挂载 ` +
|
||
toDisplayString(
|
||
unref(I)
|
||
.max_num,
|
||
) +
|
||
` 块,当前还可新增 ` +
|
||
toDisplayString(
|
||
unref(I)
|
||
.remaining_num,
|
||
) +
|
||
` 块。 `,
|
||
1,
|
||
),
|
||
],
|
||
64,
|
||
))
|
||
: unref(I)
|
||
? (openBlock(),
|
||
createBlock(
|
||
s,
|
||
{
|
||
key: 1,
|
||
severity: `info`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(
|
||
() => [
|
||
createTextVNode(
|
||
toDisplayString(
|
||
unref(I)
|
||
.max_num >
|
||
0
|
||
? `最多可挂载 ${unref(I).max_num} 块数据盘,当前已达上限。`
|
||
: `当前规格不支持新增数据盘。`,
|
||
),
|
||
1,
|
||
),
|
||
],
|
||
),
|
||
_: 1,
|
||
},
|
||
))
|
||
: (openBlock(),
|
||
createBlock(
|
||
s,
|
||
{
|
||
key: 2,
|
||
severity: `info`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(
|
||
() => [
|
||
...(i[12] ||=
|
||
[
|
||
createTextVNode(
|
||
`当前规格不支持新增数据盘。`,
|
||
-1,
|
||
),
|
||
]),
|
||
],
|
||
),
|
||
_: 1,
|
||
},
|
||
)),
|
||
],
|
||
64,
|
||
))
|
||
: (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 1,
|
||
},
|
||
[
|
||
_.disks.length
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
`div`,
|
||
ke,
|
||
[
|
||
(openBlock(!0),
|
||
createElementBlock(
|
||
Fragment,
|
||
null,
|
||
renderList(
|
||
_.disks,
|
||
(t) => (
|
||
openBlock(),
|
||
createElementBlock(
|
||
`button`,
|
||
{
|
||
key: t.ident,
|
||
type: `button`,
|
||
class:
|
||
normalizeClass(
|
||
[
|
||
`disk`,
|
||
{
|
||
active:
|
||
unref(
|
||
B,
|
||
)
|
||
?.ident ===
|
||
t.ident,
|
||
},
|
||
],
|
||
),
|
||
onClick: (
|
||
e,
|
||
) =>
|
||
$e(t),
|
||
},
|
||
[
|
||
createElementVNode(
|
||
`i`,
|
||
{
|
||
class:
|
||
normalizeClass(
|
||
t.type2 ===
|
||
`system`
|
||
? `pi pi-server`
|
||
: `pi pi-database`,
|
||
),
|
||
},
|
||
null,
|
||
2,
|
||
),
|
||
createElementVNode(
|
||
`span`,
|
||
je,
|
||
toDisplayString(
|
||
t.name,
|
||
),
|
||
1,
|
||
),
|
||
createElementVNode(
|
||
`span`,
|
||
Me,
|
||
toDisplayString(
|
||
t.size,
|
||
) +
|
||
` GB · ` +
|
||
toDisplayString(
|
||
t.type,
|
||
),
|
||
1,
|
||
),
|
||
],
|
||
10,
|
||
Ae,
|
||
)
|
||
),
|
||
),
|
||
128,
|
||
)),
|
||
],
|
||
))
|
||
: (openBlock(),
|
||
createBlock(
|
||
s,
|
||
{
|
||
key: 1,
|
||
severity: `info`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(
|
||
() => [
|
||
...(i[13] ||= [
|
||
createTextVNode(
|
||
`未获取到磁盘信息。`,
|
||
-1,
|
||
),
|
||
]),
|
||
],
|
||
),
|
||
_: 1,
|
||
},
|
||
)),
|
||
unref(z)
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
`div`,
|
||
Ne,
|
||
[
|
||
(i[14] ||=
|
||
createElementVNode(
|
||
`label`,
|
||
null,
|
||
`扩容至`,
|
||
-1,
|
||
)),
|
||
createVNode(
|
||
S,
|
||
{
|
||
modelValue:
|
||
unref(V),
|
||
"onUpdate:modelValue":
|
||
[
|
||
(i[5] ||= (
|
||
e,
|
||
) =>
|
||
isRef(V)
|
||
? (V.value =
|
||
e)
|
||
: null),
|
||
Q,
|
||
],
|
||
min:
|
||
unref(z).min +
|
||
unref(z).step,
|
||
max: unref(z)
|
||
.max,
|
||
step: unref(z)
|
||
.step,
|
||
showButtons: ``,
|
||
buttonLayout: `horizontal`,
|
||
suffix: ` GB`,
|
||
},
|
||
null,
|
||
8,
|
||
[
|
||
`modelValue`,
|
||
`min`,
|
||
`max`,
|
||
`step`,
|
||
],
|
||
),
|
||
createElementVNode(
|
||
`span`,
|
||
Pe,
|
||
` 当前 ` +
|
||
toDisplayString(
|
||
unref(z)
|
||
.disk_info
|
||
.size,
|
||
) +
|
||
` GB,最大 ` +
|
||
toDisplayString(
|
||
unref(z).max,
|
||
) +
|
||
` GB,步长 ` +
|
||
toDisplayString(
|
||
unref(z).step,
|
||
) +
|
||
` GB `,
|
||
1,
|
||
),
|
||
],
|
||
))
|
||
: createCommentVNode(
|
||
``,
|
||
!0,
|
||
),
|
||
],
|
||
64,
|
||
)),
|
||
],
|
||
64,
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
],
|
||
64,
|
||
)),
|
||
X()
|
||
? (openBlock(),
|
||
createElementBlock(`div`, Fe, [
|
||
createElementVNode(`div`, Ie, [
|
||
(i[15] ||= createElementVNode(
|
||
`span`,
|
||
{
|
||
class: `bar-label`,
|
||
},
|
||
`升级费用`,
|
||
-1,
|
||
)),
|
||
createElementVNode(`span`, Le, [
|
||
unref(U)
|
||
? (openBlock(), createElementBlock(`i`, Re))
|
||
: (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 1,
|
||
},
|
||
[
|
||
createTextVNode(
|
||
toDisplayString(
|
||
unref(H) ? `¥${unref(H).price}` : `—`,
|
||
),
|
||
1,
|
||
),
|
||
],
|
||
64,
|
||
)),
|
||
]),
|
||
unref(H)?.renew_price_difference
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
`span`,
|
||
ze,
|
||
`续费差价 ¥` +
|
||
toDisplayString(
|
||
unref(H).renew_price_difference,
|
||
),
|
||
1,
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
]),
|
||
createVNode(
|
||
C,
|
||
{
|
||
label: `立即升级`,
|
||
icon: `pi pi-arrow-up`,
|
||
loading: unref(W),
|
||
disabled: !unref(H),
|
||
onClick: tt,
|
||
},
|
||
null,
|
||
8,
|
||
[`loading`, `disabled`],
|
||
),
|
||
]))
|
||
: createCommentVNode(``, !0),
|
||
unref(qe).length
|
||
? (openBlock(),
|
||
createElementBlock(`ul`, Be, [
|
||
(openBlock(!0),
|
||
createElementBlock(
|
||
Fragment,
|
||
null,
|
||
renderList(
|
||
unref(qe),
|
||
(t, n) => (
|
||
openBlock(),
|
||
createElementBlock(
|
||
`li`,
|
||
{
|
||
key: n,
|
||
},
|
||
toDisplayString(t),
|
||
1,
|
||
)
|
||
),
|
||
),
|
||
128,
|
||
)),
|
||
]))
|
||
: createCommentVNode(``, !0),
|
||
(i[16] ||= createElementVNode(
|
||
`p`,
|
||
{
|
||
class: `hint`,
|
||
},
|
||
`升级为变更配置,原配置将被替换;部分操作会重新计费并可能要求实例处于运行中状态。`,
|
||
-1,
|
||
)),
|
||
]));
|
||
}
|
||
);
|
||
},
|
||
}),
|
||
[[`__scopeId`, `data-v-625e699a`]],
|
||
),
|
||
{
|
||
__name: `KkyUpgrade`,
|
||
},
|
||
);
|
||
export {};
|
||
export default x;
|
||
</script>
|