@webx-ui/module-delivery 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +58 -2
- package/dist/BindingsPage-pjTbDDWA.js +280 -0
- package/dist/BindingsPage-pjTbDDWA.js.map +1 -0
- package/dist/BindingsPage.d.ts +2 -0
- package/dist/CarrierDialog.d.ts +26 -0
- package/dist/CarriersPage-Dpre8dbl.js +650 -0
- package/dist/CarriersPage-Dpre8dbl.js.map +1 -0
- package/dist/CarriersPage.d.ts +2 -0
- package/dist/GeographyPage-IBg0JnNH.js +750 -0
- package/dist/GeographyPage-IBg0JnNH.js.map +1 -0
- package/dist/GeographyPage.d.ts +2 -0
- package/dist/LocalityDialog.d.ts +39 -0
- package/dist/LocalitySearch.d.ts +33 -0
- package/dist/MethodPane.d.ts +29 -0
- package/dist/MethodsPage-Bpzsa_6v.js +414 -0
- package/dist/MethodsPage-Bpzsa_6v.js.map +1 -0
- package/dist/MethodsPage.d.ts +2 -0
- package/dist/OrderChangeDialog.d.ts +7 -0
- package/dist/OrderDeliveryNode.d.ts +2 -0
- package/dist/PointDialog.d.ts +22 -0
- package/dist/PointsPage-CzYIM86R.js +336 -0
- package/dist/PointsPage-CzYIM86R.js.map +1 -0
- package/dist/PointsPage.d.ts +2 -0
- package/dist/PopularPage-CSrvVg4o.js +141 -0
- package/dist/PopularPage-CSrvVg4o.js.map +1 -0
- package/dist/PopularPage.d.ts +2 -0
- package/dist/RegionDialog.d.ts +11 -0
- package/dist/WaybillDialog.d.ts +8 -0
- package/dist/api.d.ts +151 -0
- package/dist/fields/CountryField.d.ts +14 -0
- package/dist/fields/LocalitiesField.d.ts +14 -0
- package/dist/fields/LocalityField.d.ts +16 -0
- package/dist/fields/PointKindField.d.ts +20 -0
- package/dist/fields/RegionField.d.ts +19 -0
- package/dist/fields/ScheduleField.d.ts +24 -0
- package/dist/i18n.d.ts +5 -0
- package/dist/index-5nt0M0In.js +2539 -0
- package/dist/index-5nt0M0In.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +7 -0
- package/dist/module.d.ts +19 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +467 -0
- package/package.json +64 -3
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
import { defineComponent as ve, useModel as Ee, ref as k, computed as N, watch as ze, openBlock as n, createBlock as y, unref as r, createSlots as Ae, withCtx as v, createElementBlock as p, createElementVNode as b, toDisplayString as s, createTextVNode as f, createCommentVNode as x, createVNode as $, Fragment as O, renderList as F, mergeModels as se } from "vue";
|
|
2
|
+
import { RouterLink as Be } from "vue-router";
|
|
3
|
+
import { WxDialog as De, WxSkeleton as me, WxButton as j, WxForm as oe, WxFormItem as ie, WxSelect as ce, WxSwitch as ye, WxInputNumber as Le, WxInput as ue, WxBadge as q, WxSpace as Ne, toast as V, WxCard as de, WxEmpty as qe } from "@webx-ui/core";
|
|
4
|
+
import { useAdmin as pe, useErrorText as _e, WxDate as fe, WxListScreen as Fe } from "@webx-ui/module-admin";
|
|
5
|
+
import { c as ge, u as he, _ as ke } from "./index-5nt0M0In.js";
|
|
6
|
+
const Ie = {
|
|
7
|
+
key: 1,
|
|
8
|
+
class: "wx-delivery-carrier-form"
|
|
9
|
+
}, Me = { key: 0 }, Te = { class: "wx-delivery-carrier-form__head" }, Pe = { class: "wx-delivery-carrier-form__title" }, Re = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "wx-delivery-carrier-form__choice"
|
|
12
|
+
}, Ge = { class: "wx-delivery-carrier-form__select" }, He = {
|
|
13
|
+
key: 1,
|
|
14
|
+
"data-test": "credentials"
|
|
15
|
+
}, Je = { class: "wx-delivery-carrier-form__title" }, Ke = { class: "wx-delivery-carrier-form__secret" }, Qe = { class: "wx-delivery-carrier-form__title" }, Xe = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "wx-delivery-carrier-form__muted"
|
|
18
|
+
}, Ye = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "wx-delivery-carrier-form__runs"
|
|
21
|
+
}, Ze = { class: "wx-delivery-carrier-form__muted" }, ea = {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: "wx-delivery-carrier-form__error"
|
|
24
|
+
}, X = "_labels", aa = /* @__PURE__ */ ve({
|
|
25
|
+
__name: "CarrierDialog",
|
|
26
|
+
props: /* @__PURE__ */ se({
|
|
27
|
+
carrier: {}
|
|
28
|
+
}, {
|
|
29
|
+
open: { type: Boolean, default: !1 },
|
|
30
|
+
openModifiers: {}
|
|
31
|
+
}),
|
|
32
|
+
emits: /* @__PURE__ */ se(["saved"], ["update:open"]),
|
|
33
|
+
setup(R, { emit: I }) {
|
|
34
|
+
const w = R, c = Ee(R, "open"), D = I, S = pe(), U = ge(S), i = he(), E = _e(), m = k(null), _ = k({}), z = k({}), C = k(!1), M = k(!1), T = k(!1), L = k({}), W = k({}), A = k({}), u = k({}), g = k(!1), l = N(() => S.can("delivery.manage")), d = N(() => m.value?.settings.fields ?? []), B = N(() => d.value.filter(H)), G = N(
|
|
35
|
+
() => !m.value || m.value.credentials.length === 0 || m.value.credentials.some((e) => e.set)
|
|
36
|
+
);
|
|
37
|
+
function H(e) {
|
|
38
|
+
return e.options === "carrier";
|
|
39
|
+
}
|
|
40
|
+
function J(e) {
|
|
41
|
+
if (typeof e.label == "string") return e.label;
|
|
42
|
+
if (e.label && typeof e.label == "object") {
|
|
43
|
+
const t = S.i18n.state.locale;
|
|
44
|
+
return e.label[t] ?? Object.values(e.label)[0] ?? e.name;
|
|
45
|
+
}
|
|
46
|
+
return e.name;
|
|
47
|
+
}
|
|
48
|
+
function be(e, t, a) {
|
|
49
|
+
return e.label ? J(e) : a > 1 ? `${i("carrier.key")} ${t + 1}` : i("carrier.key");
|
|
50
|
+
}
|
|
51
|
+
function Y(e) {
|
|
52
|
+
return typeof e.default == "number" || typeof e.default == "string" ? String(e.default) : void 0;
|
|
53
|
+
}
|
|
54
|
+
function xe(e) {
|
|
55
|
+
return d.value.find((t) => t.name === e);
|
|
56
|
+
}
|
|
57
|
+
const K = (e) => e == null || e === "";
|
|
58
|
+
function Z() {
|
|
59
|
+
const e = _.value[X];
|
|
60
|
+
return e && typeof e == "object" ? e : {};
|
|
61
|
+
}
|
|
62
|
+
function ee(e) {
|
|
63
|
+
for (const t of e.depends ?? [])
|
|
64
|
+
if (K(_.value[t])) return xe(t) ?? { name: t };
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
function $e(e) {
|
|
68
|
+
return Object.fromEntries((e.depends ?? []).map((t) => [t, _.value[t]]));
|
|
69
|
+
}
|
|
70
|
+
function ae(e) {
|
|
71
|
+
if (!G.value) return i("options.no-key");
|
|
72
|
+
const t = ee(e);
|
|
73
|
+
return t ? i("options.choose-first", { field: J(t) }) : u.value[e.name] ?? null;
|
|
74
|
+
}
|
|
75
|
+
function we(e) {
|
|
76
|
+
const t = (W.value[e.name] ?? []).map((o) => ({
|
|
77
|
+
value: o.value,
|
|
78
|
+
label: o.hint ? `${o.label} · ${o.hint}` : o.label
|
|
79
|
+
})), a = _.value[e.name];
|
|
80
|
+
return !K(a) && !t.some((o) => o.value === String(a)) && t.unshift({ value: String(a), label: Z()[e.name] ?? String(a) }), t;
|
|
81
|
+
}
|
|
82
|
+
async function P(e, t, a = !1) {
|
|
83
|
+
if (!(!w.carrier || !G.value || ee(e)) && !(e.search && !t)) {
|
|
84
|
+
A.value = { ...A.value, [e.name]: !0 };
|
|
85
|
+
try {
|
|
86
|
+
const o = await U.carrierOptions(w.carrier, e.name, {
|
|
87
|
+
values: $e(e),
|
|
88
|
+
q: t,
|
|
89
|
+
fresh: a
|
|
90
|
+
});
|
|
91
|
+
W.value = { ...W.value, [e.name]: o }, u.value = Object.fromEntries(
|
|
92
|
+
Object.entries(u.value).filter(([h]) => h !== e.name)
|
|
93
|
+
);
|
|
94
|
+
} catch (o) {
|
|
95
|
+
u.value = { ...u.value, [e.name]: E(o) };
|
|
96
|
+
} finally {
|
|
97
|
+
A.value = { ...A.value, [e.name]: !1 };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function Q(e = !1) {
|
|
102
|
+
await Promise.all(B.value.map((t) => P(t, void 0, e)));
|
|
103
|
+
}
|
|
104
|
+
async function Ve() {
|
|
105
|
+
g.value = !0, u.value = {};
|
|
106
|
+
try {
|
|
107
|
+
await Q(!0);
|
|
108
|
+
} finally {
|
|
109
|
+
g.value = !1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function re(e) {
|
|
113
|
+
const t = [], a = (o) => {
|
|
114
|
+
for (const h of d.value)
|
|
115
|
+
(h.depends ?? []).includes(o) && !t.includes(h) && (t.push(h), a(h.name));
|
|
116
|
+
};
|
|
117
|
+
return a(e), t;
|
|
118
|
+
}
|
|
119
|
+
function Ce(e, t) {
|
|
120
|
+
const a = (W.value[e.name] ?? []).find((h) => h.value === t), o = { ...Z() };
|
|
121
|
+
_.value[e.name] = t, a ? o[e.name] = a.label : K(t) && delete o[e.name];
|
|
122
|
+
for (const h of re(e.name))
|
|
123
|
+
_.value[h.name] = null, delete o[h.name], W.value = { ...W.value, [h.name]: [] };
|
|
124
|
+
_.value[X] = o;
|
|
125
|
+
for (const h of re(e.name)) P(h);
|
|
126
|
+
}
|
|
127
|
+
const te = {};
|
|
128
|
+
function We(e, t) {
|
|
129
|
+
clearTimeout(te[e.name]), !(t.trim().length < 2) && (te[e.name] = setTimeout(() => {
|
|
130
|
+
P(e, t.trim());
|
|
131
|
+
}, 250));
|
|
132
|
+
}
|
|
133
|
+
function Se(e) {
|
|
134
|
+
if (!H(e)) return;
|
|
135
|
+
const t = m.value?.settings.missing?.[e.name];
|
|
136
|
+
return ae(e) ?? (t ? i("options.missing", { label: t }) : void 0);
|
|
137
|
+
}
|
|
138
|
+
async function Ue() {
|
|
139
|
+
if (w.carrier) {
|
|
140
|
+
C.value = !0, z.value = {}, L.value = {}, W.value = {}, u.value = {};
|
|
141
|
+
try {
|
|
142
|
+
m.value = await U.carrier(w.carrier), _.value = { ...m.value.settings.values };
|
|
143
|
+
} catch (e) {
|
|
144
|
+
V.danger(E(e)), c.value = !1;
|
|
145
|
+
return;
|
|
146
|
+
} finally {
|
|
147
|
+
C.value = !1;
|
|
148
|
+
}
|
|
149
|
+
Q();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
ze(c, (e) => {
|
|
153
|
+
e && Ue();
|
|
154
|
+
});
|
|
155
|
+
function ne() {
|
|
156
|
+
return Object.fromEntries(Object.entries(z.value).filter(([, e]) => e.trim() !== ""));
|
|
157
|
+
}
|
|
158
|
+
async function le(e = []) {
|
|
159
|
+
if (w.carrier) {
|
|
160
|
+
M.value = !0, L.value = {};
|
|
161
|
+
try {
|
|
162
|
+
const t = Object.fromEntries(
|
|
163
|
+
Object.entries(_.value).filter(([a]) => a !== X)
|
|
164
|
+
);
|
|
165
|
+
m.value = await U.saveCarrier(w.carrier, {
|
|
166
|
+
settings: t,
|
|
167
|
+
credentials: ne(),
|
|
168
|
+
clear: e
|
|
169
|
+
}), _.value = { ...m.value.settings.values }, z.value = {}, V.success(i("carrier.saved")), D("saved"), Q();
|
|
170
|
+
} catch (t) {
|
|
171
|
+
const a = t.errors ?? {};
|
|
172
|
+
L.value = Object.fromEntries(
|
|
173
|
+
Object.entries(a).map(([o, h]) => [o.replace(/^settings\./, ""), h[0] ?? ""])
|
|
174
|
+
), V.danger(E(t));
|
|
175
|
+
} finally {
|
|
176
|
+
M.value = !1;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async function Oe() {
|
|
181
|
+
if (w.carrier) {
|
|
182
|
+
T.value = !0;
|
|
183
|
+
try {
|
|
184
|
+
const e = await U.testCarrier(w.carrier, ne());
|
|
185
|
+
e.ok ? V.success(e.message ?? i("carrier.test-ok")) : V.danger(i("carrier.test-failed", { message: e.message ?? "" }));
|
|
186
|
+
} catch (e) {
|
|
187
|
+
V.danger(E(e));
|
|
188
|
+
} finally {
|
|
189
|
+
T.value = !1;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const je = {
|
|
194
|
+
running: "primary",
|
|
195
|
+
succeeded: "success",
|
|
196
|
+
failed: "danger",
|
|
197
|
+
held: "warning"
|
|
198
|
+
};
|
|
199
|
+
return (e, t) => (n(), y(r(De), {
|
|
200
|
+
open: c.value,
|
|
201
|
+
"onUpdate:open": t[1] || (t[1] = (a) => c.value = a),
|
|
202
|
+
title: m.value?.title ?? r(i)("carrier.choose"),
|
|
203
|
+
width: 640,
|
|
204
|
+
scroll: "body"
|
|
205
|
+
}, Ae({
|
|
206
|
+
default: v(() => [
|
|
207
|
+
C.value || !m.value ? (n(), y(r(me), {
|
|
208
|
+
key: 0,
|
|
209
|
+
rows: 5
|
|
210
|
+
})) : (n(), p("div", Ie, [
|
|
211
|
+
m.value.settings.fields.length > 0 ? (n(), p("section", Me, [
|
|
212
|
+
b("div", Te, [
|
|
213
|
+
b("h4", Pe, s(r(i)("carrier.settings")), 1),
|
|
214
|
+
B.value.length > 0 && G.value ? (n(), y(r(j), {
|
|
215
|
+
key: 0,
|
|
216
|
+
size: "sm",
|
|
217
|
+
variant: "text",
|
|
218
|
+
icon: "refresh",
|
|
219
|
+
loading: g.value,
|
|
220
|
+
"data-test": "options-refresh",
|
|
221
|
+
onClick: Ve
|
|
222
|
+
}, {
|
|
223
|
+
default: v(() => [
|
|
224
|
+
f(s(r(i)("options.refresh")), 1)
|
|
225
|
+
]),
|
|
226
|
+
_: 1
|
|
227
|
+
}, 8, ["loading"])) : x("", !0)
|
|
228
|
+
]),
|
|
229
|
+
$(r(oe), null, {
|
|
230
|
+
default: v(() => [
|
|
231
|
+
(n(!0), p(O, null, F(m.value.settings.fields, (a) => (n(), y(r(ie), {
|
|
232
|
+
key: a.name,
|
|
233
|
+
label: J(a),
|
|
234
|
+
help: Se(a),
|
|
235
|
+
error: L.value[a.name],
|
|
236
|
+
"data-test": `setting-${a.name}`
|
|
237
|
+
}, {
|
|
238
|
+
default: v(() => [
|
|
239
|
+
H(a) ? (n(), p("div", Re, [
|
|
240
|
+
b("div", Ge, [
|
|
241
|
+
$(r(ce), {
|
|
242
|
+
"model-value": _.value[a.name] ?? null,
|
|
243
|
+
options: we(a),
|
|
244
|
+
filterable: a.search === !0,
|
|
245
|
+
disabled: !l.value || ae(a) !== null || A.value[a.name] === !0,
|
|
246
|
+
status: m.value.settings.missing?.[a.name] ? "warning" : void 0,
|
|
247
|
+
placeholder: a.search ? r(i)("options.search") : void 0,
|
|
248
|
+
clearable: "",
|
|
249
|
+
"onUpdate:modelValue": (o) => Ce(a, o),
|
|
250
|
+
onSearch: (o) => We(a, o)
|
|
251
|
+
}, null, 8, ["model-value", "options", "filterable", "disabled", "status", "placeholder", "onUpdate:modelValue", "onSearch"])
|
|
252
|
+
]),
|
|
253
|
+
u.value[a.name] && l.value ? (n(), y(r(j), {
|
|
254
|
+
key: 0,
|
|
255
|
+
size: "sm",
|
|
256
|
+
variant: "outline",
|
|
257
|
+
onClick: (o) => P(a, void 0, !0)
|
|
258
|
+
}, {
|
|
259
|
+
default: v(() => [
|
|
260
|
+
f(s(r(i)("options.retry")), 1)
|
|
261
|
+
]),
|
|
262
|
+
_: 1
|
|
263
|
+
}, 8, ["onClick"])) : x("", !0)
|
|
264
|
+
])) : a.type === "boolean" ? (n(), y(r(ye), {
|
|
265
|
+
key: 1,
|
|
266
|
+
modelValue: _.value[a.name],
|
|
267
|
+
"onUpdate:modelValue": (o) => _.value[a.name] = o,
|
|
268
|
+
disabled: !l.value
|
|
269
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.type === "number" ? (n(), y(r(Le), {
|
|
270
|
+
key: 2,
|
|
271
|
+
modelValue: _.value[a.name],
|
|
272
|
+
"onUpdate:modelValue": (o) => _.value[a.name] = o,
|
|
273
|
+
step: a.step,
|
|
274
|
+
precision: a.precision,
|
|
275
|
+
min: a.min,
|
|
276
|
+
max: a.max,
|
|
277
|
+
placeholder: Y(a),
|
|
278
|
+
disabled: !l.value
|
|
279
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "step", "precision", "min", "max", "placeholder", "disabled"])) : a.type === "select" ? (n(), y(r(ce), {
|
|
280
|
+
key: 3,
|
|
281
|
+
modelValue: _.value[a.name],
|
|
282
|
+
"onUpdate:modelValue": (o) => _.value[a.name] = o,
|
|
283
|
+
options: Array.isArray(a.options) ? a.options : [],
|
|
284
|
+
disabled: !l.value
|
|
285
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "options", "disabled"])) : (n(), y(r(ue), {
|
|
286
|
+
key: 4,
|
|
287
|
+
modelValue: _.value[a.name],
|
|
288
|
+
"onUpdate:modelValue": (o) => _.value[a.name] = o,
|
|
289
|
+
placeholder: Y(a),
|
|
290
|
+
disabled: !l.value
|
|
291
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"]))
|
|
292
|
+
]),
|
|
293
|
+
_: 2
|
|
294
|
+
}, 1032, ["label", "help", "error", "data-test"]))), 128))
|
|
295
|
+
]),
|
|
296
|
+
_: 1
|
|
297
|
+
})
|
|
298
|
+
])) : x("", !0),
|
|
299
|
+
m.value.credentials.length > 0 ? (n(), p("section", He, [
|
|
300
|
+
b("h4", Je, s(r(i)("carrier.credentials")), 1),
|
|
301
|
+
$(r(oe), null, {
|
|
302
|
+
default: v(() => [
|
|
303
|
+
(n(!0), p(O, null, F(m.value.credentials, (a, o) => (n(), y(r(ie), {
|
|
304
|
+
key: a.name,
|
|
305
|
+
label: be(a, o, m.value.credentials.length)
|
|
306
|
+
}, {
|
|
307
|
+
default: v(() => [
|
|
308
|
+
b("div", Ke, [
|
|
309
|
+
$(r(q), {
|
|
310
|
+
type: a.set ? "success" : "default",
|
|
311
|
+
dot: ""
|
|
312
|
+
}, {
|
|
313
|
+
default: v(() => [
|
|
314
|
+
f(s(a.set ? r(i)("carrier.set") : r(i)("carrier.not-set")), 1)
|
|
315
|
+
]),
|
|
316
|
+
_: 2
|
|
317
|
+
}, 1032, ["type"]),
|
|
318
|
+
$(r(ue), {
|
|
319
|
+
modelValue: z.value[a.name],
|
|
320
|
+
"onUpdate:modelValue": (h) => z.value[a.name] = h,
|
|
321
|
+
type: "password",
|
|
322
|
+
autocomplete: "new-password",
|
|
323
|
+
placeholder: r(i)("carrier.replace"),
|
|
324
|
+
disabled: !l.value,
|
|
325
|
+
class: "wx-delivery-carrier-form__key"
|
|
326
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"]),
|
|
327
|
+
a.set && l.value ? (n(), y(r(j), {
|
|
328
|
+
key: 0,
|
|
329
|
+
size: "sm",
|
|
330
|
+
variant: "text",
|
|
331
|
+
onClick: (h) => le([a.name])
|
|
332
|
+
}, {
|
|
333
|
+
default: v(() => [
|
|
334
|
+
f(s(r(i)("carrier.clear")), 1)
|
|
335
|
+
]),
|
|
336
|
+
_: 1
|
|
337
|
+
}, 8, ["onClick"])) : x("", !0)
|
|
338
|
+
])
|
|
339
|
+
]),
|
|
340
|
+
_: 2
|
|
341
|
+
}, 1032, ["label"]))), 128))
|
|
342
|
+
]),
|
|
343
|
+
_: 1
|
|
344
|
+
})
|
|
345
|
+
])) : x("", !0),
|
|
346
|
+
b("section", null, [
|
|
347
|
+
b("h4", Qe, s(r(i)("carrier.runs")), 1),
|
|
348
|
+
m.value.runs.length === 0 ? (n(), p("p", Xe, s(r(i)("carrier.never")), 1)) : (n(), p("ul", Ye, [
|
|
349
|
+
(n(!0), p(O, null, F(m.value.runs, (a) => (n(), p("li", {
|
|
350
|
+
key: a.id
|
|
351
|
+
}, [
|
|
352
|
+
$(r(q), {
|
|
353
|
+
type: je[a.status],
|
|
354
|
+
size: "sm"
|
|
355
|
+
}, {
|
|
356
|
+
default: v(() => [
|
|
357
|
+
f(s(r(i)(`carrier.statuses.${a.status}`)), 1)
|
|
358
|
+
]),
|
|
359
|
+
_: 2
|
|
360
|
+
}, 1032, ["type"]),
|
|
361
|
+
b("span", null, s(r(i)(`carrier.directories.${a.directory}`)), 1),
|
|
362
|
+
a.started_at ? (n(), y(r(fe), {
|
|
363
|
+
key: 0,
|
|
364
|
+
value: a.started_at
|
|
365
|
+
}, null, 8, ["value"])) : x("", !0),
|
|
366
|
+
b("span", Ze, s(r(i)("carrier.seen")) + ": " + s(a.seen) + " · +" + s(a.created) + " · −" + s(a.removed), 1),
|
|
367
|
+
a.error ? (n(), p("span", ea, s(a.error), 1)) : x("", !0)
|
|
368
|
+
]))), 128))
|
|
369
|
+
]))
|
|
370
|
+
])
|
|
371
|
+
]))
|
|
372
|
+
]),
|
|
373
|
+
_: 2
|
|
374
|
+
}, [
|
|
375
|
+
l.value && m.value ? {
|
|
376
|
+
name: "footer",
|
|
377
|
+
fn: v(() => [
|
|
378
|
+
$(r(Ne), { size: "sm" }, {
|
|
379
|
+
default: v(() => [
|
|
380
|
+
m.value.credentials.length > 0 ? (n(), y(r(j), {
|
|
381
|
+
key: 0,
|
|
382
|
+
variant: "outline",
|
|
383
|
+
loading: T.value,
|
|
384
|
+
onClick: Oe
|
|
385
|
+
}, {
|
|
386
|
+
default: v(() => [
|
|
387
|
+
f(s(r(i)("carrier.test")), 1)
|
|
388
|
+
]),
|
|
389
|
+
_: 1
|
|
390
|
+
}, 8, ["loading"])) : x("", !0),
|
|
391
|
+
$(r(j), {
|
|
392
|
+
type: "primary",
|
|
393
|
+
loading: M.value,
|
|
394
|
+
"data-test": "carrier-save",
|
|
395
|
+
onClick: t[0] || (t[0] = (a) => le())
|
|
396
|
+
}, {
|
|
397
|
+
default: v(() => [
|
|
398
|
+
f(s(r(i)("common.save")), 1)
|
|
399
|
+
]),
|
|
400
|
+
_: 1
|
|
401
|
+
}, 8, ["loading"])
|
|
402
|
+
]),
|
|
403
|
+
_: 1
|
|
404
|
+
})
|
|
405
|
+
]),
|
|
406
|
+
key: "0"
|
|
407
|
+
} : void 0
|
|
408
|
+
]), 1032, ["open", "title"]));
|
|
409
|
+
}
|
|
410
|
+
}), ra = /* @__PURE__ */ ke(aa, [["__scopeId", "data-v-0b307bd5"]]), ta = {
|
|
411
|
+
key: 2,
|
|
412
|
+
class: "wx-delivery-carriers"
|
|
413
|
+
}, na = { class: "wx-delivery-carrier__head" }, la = {
|
|
414
|
+
key: 0,
|
|
415
|
+
class: "wx-delivery-carrier__missing",
|
|
416
|
+
"data-test": "carrier-missing"
|
|
417
|
+
}, sa = {
|
|
418
|
+
key: 1,
|
|
419
|
+
class: "wx-delivery-carrier__queue"
|
|
420
|
+
}, oa = { class: "wx-delivery-dir__main" }, ia = { class: "wx-delivery-dir__name" }, ca = { class: "wx-delivery-dir__facts" }, ua = { key: 0 }, da = { class: "wx-delivery-dir__facts" }, va = { class: "wx-delivery-dir__badges" }, ma = {
|
|
421
|
+
key: 0,
|
|
422
|
+
class: "wx-delivery-dir__actions"
|
|
423
|
+
}, ya = /* @__PURE__ */ ve({
|
|
424
|
+
__name: "CarriersPage",
|
|
425
|
+
setup(R) {
|
|
426
|
+
const I = pe(), w = ge(I), c = he(), D = _e(), S = k([]), U = k(!0), i = k(null), E = k(null), m = k(!1), _ = N(() => I.can("delivery.manage")), z = N(
|
|
427
|
+
() => I.state.manifest?.modules.find((u) => u.id === "delivery-carriers")?.title ?? c("sections.carriers")
|
|
428
|
+
);
|
|
429
|
+
async function C() {
|
|
430
|
+
U.value = !0;
|
|
431
|
+
try {
|
|
432
|
+
S.value = await w.carriers();
|
|
433
|
+
} catch (u) {
|
|
434
|
+
V.danger(D(u));
|
|
435
|
+
} finally {
|
|
436
|
+
U.value = !1;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
C();
|
|
440
|
+
async function M(u, g) {
|
|
441
|
+
try {
|
|
442
|
+
await w.saveCarrier(u.key, { enabled: g }), await C();
|
|
443
|
+
} catch (l) {
|
|
444
|
+
V.danger(D(l));
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
async function T(u, g) {
|
|
448
|
+
i.value = `${u.key}:${g.directory}`;
|
|
449
|
+
try {
|
|
450
|
+
const { queued: l } = await w.runSync(u.key, g.directory);
|
|
451
|
+
V.success(
|
|
452
|
+
c("carrier.queued", {
|
|
453
|
+
list: l.map((d) => c(`carrier.directories.${d}`)).join(", ")
|
|
454
|
+
})
|
|
455
|
+
), await C();
|
|
456
|
+
} catch (l) {
|
|
457
|
+
V.danger(D(l));
|
|
458
|
+
} finally {
|
|
459
|
+
i.value = null;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
async function L(u, g) {
|
|
463
|
+
i.value = `${u.key}:${g.directory}`;
|
|
464
|
+
try {
|
|
465
|
+
await w.confirmRemoval(u.key, g.directory), V.success(c("carrier.confirmed")), await C();
|
|
466
|
+
} catch (l) {
|
|
467
|
+
V.danger(D(l));
|
|
468
|
+
} finally {
|
|
469
|
+
i.value = null;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function W(u) {
|
|
473
|
+
if (u.label) return u.label;
|
|
474
|
+
const g = `carrier.remarks.${u.key.replace(".", "-")}`, l = c(g, { count: u.count });
|
|
475
|
+
return l.endsWith(g) ? c("carrier.remarks.skipped-other", { count: u.count }) : l;
|
|
476
|
+
}
|
|
477
|
+
function A(u) {
|
|
478
|
+
E.value = u, m.value = !0;
|
|
479
|
+
}
|
|
480
|
+
return (u, g) => (n(), y(r(Fe), {
|
|
481
|
+
title: z.value,
|
|
482
|
+
card: !1
|
|
483
|
+
}, {
|
|
484
|
+
default: v(() => [
|
|
485
|
+
U.value && S.value.length === 0 ? (n(), y(r(me), {
|
|
486
|
+
key: 0,
|
|
487
|
+
rows: 4
|
|
488
|
+
})) : S.value.length === 0 ? (n(), y(r(de), { key: 1 }, {
|
|
489
|
+
default: v(() => [
|
|
490
|
+
$(r(qe), {
|
|
491
|
+
title: r(c)("carrier.empty"),
|
|
492
|
+
description: r(c)("carrier.empty-help")
|
|
493
|
+
}, null, 8, ["title", "description"])
|
|
494
|
+
]),
|
|
495
|
+
_: 1
|
|
496
|
+
})) : (n(), p("div", ta, [
|
|
497
|
+
(n(!0), p(O, null, F(S.value, (l) => (n(), y(r(de), {
|
|
498
|
+
key: l.key,
|
|
499
|
+
title: l.title,
|
|
500
|
+
class: "wx-delivery-carrier"
|
|
501
|
+
}, {
|
|
502
|
+
extra: v(() => [
|
|
503
|
+
b("span", na, [
|
|
504
|
+
$(r(ye), {
|
|
505
|
+
"model-value": l.enabled,
|
|
506
|
+
disabled: !_.value,
|
|
507
|
+
"aria-label": r(c)("carrier.enabled"),
|
|
508
|
+
"onUpdate:modelValue": (d) => M(l, !!d)
|
|
509
|
+
}, null, 8, ["model-value", "disabled", "aria-label", "onUpdate:modelValue"]),
|
|
510
|
+
$(r(j), {
|
|
511
|
+
size: "sm",
|
|
512
|
+
variant: "outline",
|
|
513
|
+
onClick: (d) => A(l.key)
|
|
514
|
+
}, {
|
|
515
|
+
default: v(() => [
|
|
516
|
+
f(s(r(c)("carrier.settings")), 1)
|
|
517
|
+
]),
|
|
518
|
+
_: 1
|
|
519
|
+
}, 8, ["onClick"])
|
|
520
|
+
])
|
|
521
|
+
]),
|
|
522
|
+
default: v(() => [
|
|
523
|
+
l.missing && l.missing.length > 0 ? (n(), p("p", la, s(r(c)("options.missing-list", { list: l.missing.join(", ") })), 1)) : x("", !0),
|
|
524
|
+
l.queue > 0 ? (n(), p("p", sa, [
|
|
525
|
+
f(s(r(c)("carrier.queue")) + ": ", 1),
|
|
526
|
+
b("strong", null, s(l.queue), 1),
|
|
527
|
+
$(r(Be), {
|
|
528
|
+
to: { name: "webx.delivery.bindings", query: { carrier: l.key } }
|
|
529
|
+
}, {
|
|
530
|
+
default: v(() => [...g[1] || (g[1] = [
|
|
531
|
+
f("→", -1)
|
|
532
|
+
])]),
|
|
533
|
+
_: 1
|
|
534
|
+
}, 8, ["to"])
|
|
535
|
+
])) : x("", !0),
|
|
536
|
+
(n(!0), p(O, null, F(l.directories, (d) => (n(), p("div", {
|
|
537
|
+
key: d.directory,
|
|
538
|
+
class: "wx-delivery-dir"
|
|
539
|
+
}, [
|
|
540
|
+
b("div", oa, [
|
|
541
|
+
b("span", ia, s(r(c)(`carrier.directories.${d.directory}`)), 1),
|
|
542
|
+
b("span", ca, [
|
|
543
|
+
f(s(r(c)("carrier.records")) + ": " + s(d.records) + " · " + s(r(c)("carrier.schedule")) + ": ", 1),
|
|
544
|
+
d.cron ? (n(), p("code", ua, s(d.cron), 1)) : (n(), p(O, { key: 1 }, [
|
|
545
|
+
f(s(r(c)("carrier.manual")), 1)
|
|
546
|
+
], 64))
|
|
547
|
+
]),
|
|
548
|
+
b("span", da, [
|
|
549
|
+
f(s(r(c)("carrier.last-success")) + ": ", 1),
|
|
550
|
+
d.last_success ? (n(), y(r(fe), {
|
|
551
|
+
key: 0,
|
|
552
|
+
value: d.last_success
|
|
553
|
+
}, null, 8, ["value"])) : (n(), p(O, { key: 1 }, [
|
|
554
|
+
f(s(r(c)("carrier.never")), 1)
|
|
555
|
+
], 64))
|
|
556
|
+
]),
|
|
557
|
+
b("span", va, [
|
|
558
|
+
d.running ? (n(), y(r(q), {
|
|
559
|
+
key: 0,
|
|
560
|
+
type: "primary",
|
|
561
|
+
dot: ""
|
|
562
|
+
}, {
|
|
563
|
+
default: v(() => [
|
|
564
|
+
f(s(r(c)("carrier.running")), 1)
|
|
565
|
+
]),
|
|
566
|
+
_: 1
|
|
567
|
+
})) : x("", !0),
|
|
568
|
+
d.held !== null ? (n(), y(r(q), {
|
|
569
|
+
key: 1,
|
|
570
|
+
type: "warning",
|
|
571
|
+
dot: ""
|
|
572
|
+
}, {
|
|
573
|
+
default: v(() => [
|
|
574
|
+
f(s(r(c)("carrier.held", { count: d.held })), 1)
|
|
575
|
+
]),
|
|
576
|
+
_: 2
|
|
577
|
+
}, 1024)) : x("", !0),
|
|
578
|
+
d.stale ? (n(), y(r(q), {
|
|
579
|
+
key: 2,
|
|
580
|
+
type: "danger",
|
|
581
|
+
dot: ""
|
|
582
|
+
}, {
|
|
583
|
+
default: v(() => [
|
|
584
|
+
f(s(r(c)("carrier.stale")), 1)
|
|
585
|
+
]),
|
|
586
|
+
_: 1
|
|
587
|
+
})) : x("", !0),
|
|
588
|
+
d.latest?.status === "failed" ? (n(), y(r(q), {
|
|
589
|
+
key: 3,
|
|
590
|
+
type: "danger",
|
|
591
|
+
size: "sm"
|
|
592
|
+
}, {
|
|
593
|
+
default: v(() => [
|
|
594
|
+
f(s(r(c)("carrier.statuses.failed")), 1)
|
|
595
|
+
]),
|
|
596
|
+
_: 1
|
|
597
|
+
})) : x("", !0)
|
|
598
|
+
]),
|
|
599
|
+
(n(!0), p(O, null, F(d.remarks, (B) => (n(), p("span", {
|
|
600
|
+
key: B.key,
|
|
601
|
+
class: "wx-delivery-dir__remark"
|
|
602
|
+
}, s(W(B)), 1))), 128))
|
|
603
|
+
]),
|
|
604
|
+
_.value ? (n(), p("span", ma, [
|
|
605
|
+
d.held !== null ? (n(), y(r(j), {
|
|
606
|
+
key: 0,
|
|
607
|
+
size: "sm",
|
|
608
|
+
type: "warning",
|
|
609
|
+
loading: i.value === `${l.key}:${d.directory}`,
|
|
610
|
+
onClick: (B) => L(l, d)
|
|
611
|
+
}, {
|
|
612
|
+
default: v(() => [
|
|
613
|
+
f(s(r(c)("carrier.confirm")), 1)
|
|
614
|
+
]),
|
|
615
|
+
_: 1
|
|
616
|
+
}, 8, ["loading", "onClick"])) : x("", !0),
|
|
617
|
+
$(r(j), {
|
|
618
|
+
size: "sm",
|
|
619
|
+
icon: "refresh",
|
|
620
|
+
disabled: d.running || !l.enabled,
|
|
621
|
+
loading: i.value === `${l.key}:${d.directory}`,
|
|
622
|
+
"data-test": `run-${l.key}-${d.directory}`,
|
|
623
|
+
onClick: (B) => T(l, d)
|
|
624
|
+
}, {
|
|
625
|
+
default: v(() => [
|
|
626
|
+
f(s(r(c)("carrier.run")), 1)
|
|
627
|
+
]),
|
|
628
|
+
_: 1
|
|
629
|
+
}, 8, ["disabled", "loading", "data-test", "onClick"])
|
|
630
|
+
])) : x("", !0)
|
|
631
|
+
]))), 128))
|
|
632
|
+
]),
|
|
633
|
+
_: 2
|
|
634
|
+
}, 1032, ["title"]))), 128))
|
|
635
|
+
])),
|
|
636
|
+
$(ra, {
|
|
637
|
+
open: m.value,
|
|
638
|
+
"onUpdate:open": g[0] || (g[0] = (l) => m.value = l),
|
|
639
|
+
carrier: E.value,
|
|
640
|
+
onSaved: C
|
|
641
|
+
}, null, 8, ["open", "carrier"])
|
|
642
|
+
]),
|
|
643
|
+
_: 1
|
|
644
|
+
}, 8, ["title"]));
|
|
645
|
+
}
|
|
646
|
+
}), ka = /* @__PURE__ */ ke(ya, [["__scopeId", "data-v-33674486"]]);
|
|
647
|
+
export {
|
|
648
|
+
ka as default
|
|
649
|
+
};
|
|
650
|
+
//# sourceMappingURL=CarriersPage-Dpre8dbl.js.map
|