first commit
This commit is contained in:
commit
db5762abd4
687 files changed
+171307
No files matched your search
@@ -0,0 +1,95 @@
|
||||
function e(e, t) {
|
||||
let n =
|
||||
typeof t == `string` &&
|
||||
[`suspend`, `suspended`, `paused`].includes(t.trim().toLowerCase());
|
||||
return e.status !== `Suspended` && !(e.status === `Active` && n)
|
||||
? ``
|
||||
: e.suspend_reason?.trim() ||
|
||||
{
|
||||
overtraffic: `流量用尽,服务已暂停`,
|
||||
overdue: `服务到期,已暂停`,
|
||||
certification_not_complete: `实名认证未完成,服务已暂停`,
|
||||
upstream: `上游暂停服务`,
|
||||
downstream: `下游暂停服务`,
|
||||
}[e.suspend_type || ``] ||
|
||||
`暂停原因暂未提供,请联系支持`;
|
||||
}
|
||||
function t(e, t = `Active`, n = !1) {
|
||||
let r = {
|
||||
Unpaid: `未付款`,
|
||||
Pending: `开通中`,
|
||||
Suspended: `暂停`,
|
||||
Deleted: `已删除`,
|
||||
Failed: `开通失败`,
|
||||
Grace: `宽限期`,
|
||||
Keep: `保留期`,
|
||||
};
|
||||
if (t && t !== `Active`)
|
||||
return {
|
||||
label: r[t] || `状态未知`,
|
||||
tone: `warning`,
|
||||
severity: `warn`,
|
||||
};
|
||||
let i = typeof e == `string` ? e.trim().toLowerCase() : ``;
|
||||
return i === `on`
|
||||
? {
|
||||
label: `运行中`,
|
||||
tone: `running`,
|
||||
severity: `success`,
|
||||
}
|
||||
: i === `off`
|
||||
? {
|
||||
label: `已关机`,
|
||||
tone: `stopped`,
|
||||
severity: `danger`,
|
||||
}
|
||||
: {
|
||||
label:
|
||||
{
|
||||
suspend: `暂停`,
|
||||
suspended: `暂停`,
|
||||
paused: `暂停`,
|
||||
pending: `开通中`,
|
||||
operating: `操作中`,
|
||||
fault: `故障`,
|
||||
}[i] || (n ? `查询中` : `状态未知`),
|
||||
tone: `warning`,
|
||||
severity: `warn`,
|
||||
};
|
||||
}
|
||||
function n(e, t) {
|
||||
if (!/^[1-9]\d*$/.test(String(t))) return null;
|
||||
let n = e.replace(/^mf_finance(?=$|_)/, `remf_finance`);
|
||||
return n === `idcsmart_common` || n === `reidcsmart_common`
|
||||
? {
|
||||
method: `post`,
|
||||
path: `/${n}/host/${t}/provision/status`,
|
||||
}
|
||||
: [
|
||||
`mf_cloud`,
|
||||
`kky_ecs`,
|
||||
`mf_dcim`,
|
||||
`remf_dcim`,
|
||||
`remf_cloud`,
|
||||
`remf_finance`,
|
||||
`remf_finance_dcim`,
|
||||
`remf_finance_common`,
|
||||
`jy_cloud`,
|
||||
`jy_dcim`,
|
||||
].includes(n)
|
||||
? {
|
||||
method: `get`,
|
||||
path: `/${n}/${t}/status`,
|
||||
}
|
||||
: null;
|
||||
}
|
||||
async function r(e, t, r) {
|
||||
let i = n(t, r);
|
||||
if (!i) return ``;
|
||||
let a = await e[i.method](i.path, void 0, !1, {
|
||||
timeoutMs: 12e3,
|
||||
}),
|
||||
o = a && typeof a == `object` ? a.status : void 0;
|
||||
return typeof o == `string` ? o : ``;
|
||||
}
|
||||
export { e as n, r, t };
|
||||
Reference in new issue
Block a user