@webx-ui/module-services 0.1.15 → 0.1.16
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/index.js +487 -454
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { reorderItems as De, useAdmin as
|
|
2
|
-
import { provide as
|
|
3
|
-
import { useRoute as We, useRouter as Ce, onBeforeRouteLeave as
|
|
4
|
-
import { provideBlocksPreview as
|
|
5
|
-
import { useLocales as
|
|
1
|
+
import { reorderItems as De, useAdmin as ie, useDates as Me, useTranslate as ae, useErrorText as me, provideRecordAddress as Le, WxScreenHead as Re, WxScreen as Ue, WxSaveState as He, WxDate as Fe, useItemOrder as Ke, WxListScreen as Ge, WxRowMenu as Je, WxAddressNote as je, categoryRoutes as Qe } from "@webx-ui/module-admin";
|
|
2
|
+
import { provide as Xe, inject as Ye, defineComponent as oe, computed as y, ref as b, watch as re, onMounted as Te, onBeforeUnmount as Se, openBlock as d, createElementBlock as B, Fragment as Y, createVNode as h, unref as e, withCtx as c, createTextVNode as _, toDisplayString as w, createBlock as k, createCommentVNode as D, createElementVNode as A, renderList as $e, normalizeClass as ye, useTemplateRef as Ze, nextTick as et, isRef as tt, withKeys as st, resolveDynamicComponent as at, mergeProps as rt } from "vue";
|
|
3
|
+
import { useRoute as We, useRouter as Ce, onBeforeRouteLeave as it } from "vue-router";
|
|
4
|
+
import { provideBlocksPreview as lt } from "@webx-ui/module-blocks";
|
|
5
|
+
import { useLocales as nt, localizedValue as ot, confirm as j, WxSkeleton as ne, WxCard as ct, WxBadge as Q, WxBreadcrumb as ut, WxBreadcrumbItem as xe, WxAlert as Ve, WxButton as X, WxActionBar as dt, toast as S, WxEmpty as qe, WxText as vt, useModal as pt, WxDialog as ht, WxFormItem as ft, WxInput as Ie, WxSpace as yt, createModal as gt, WxIcon as _e, WxSelect as mt, WxSortableList as bt, WxTooltip as wt } from "@webx-ui/core";
|
|
6
6
|
const ge = "services";
|
|
7
|
-
function
|
|
8
|
-
const
|
|
7
|
+
function ce(u) {
|
|
8
|
+
const o = `${u.apiPath}/${ge}`, g = (a) => a.data;
|
|
9
9
|
return {
|
|
10
|
-
list: (
|
|
10
|
+
list: (a = {}) => {
|
|
11
11
|
const l = new URLSearchParams();
|
|
12
|
-
return
|
|
12
|
+
return a.q && l.set("q", a.q), a.category != null && l.set("category", String(a.category)), a.status && l.set("status", a.status), a.trashed && l.set("trashed", "1"), u.http.get(l.size > 0 ? `${o}?${l}` : o);
|
|
13
13
|
},
|
|
14
|
-
get: (
|
|
15
|
-
create: (
|
|
16
|
-
save: (
|
|
17
|
-
discard: (
|
|
18
|
-
publish: (
|
|
19
|
-
unpublish: (
|
|
20
|
-
remove: (
|
|
14
|
+
get: (a) => u.http.get(`${o}/${a}`).then(g),
|
|
15
|
+
create: (a) => u.http.post(o, a).then(g),
|
|
16
|
+
save: (a, l) => u.http.put(`${o}/${a}`, l).then(g),
|
|
17
|
+
discard: (a) => u.http.post(`${o}/${a}/discard`, {}).then(g),
|
|
18
|
+
publish: (a) => u.http.post(`${o}/${a}/publish`, {}).then(g),
|
|
19
|
+
unpublish: (a) => u.http.post(`${o}/${a}/unpublish`, {}).then(g),
|
|
20
|
+
remove: (a) => u.http.delete(`${o}/${a}`).then(() => {
|
|
21
21
|
}),
|
|
22
|
-
restore: (
|
|
23
|
-
versions: (
|
|
24
|
-
restoreVersion: (
|
|
25
|
-
reorder: (
|
|
22
|
+
restore: (a) => u.http.post(`${o}/${a}/restore`, {}).then(g),
|
|
23
|
+
versions: (a) => u.http.get(`${o}/${a}/versions`).then(g),
|
|
24
|
+
restoreVersion: (a, l) => u.http.post(`${o}/${a}/versions/${l}/restore`, {}).then(g),
|
|
25
|
+
reorder: (a, l = null) => De(u, ge, a, l)
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
const ze = /* @__PURE__ */ Symbol("wx-service-editor");
|
|
29
|
-
function
|
|
30
|
-
|
|
29
|
+
function xt(u) {
|
|
30
|
+
Xe(ze, u);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function _t() {
|
|
33
|
+
return Ye(ze, null);
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const kt = {
|
|
36
36
|
module: {
|
|
37
37
|
group: "Services",
|
|
38
38
|
services: "Services",
|
|
@@ -90,8 +90,6 @@ const bt = {
|
|
|
90
90
|
"publish-nowhere": "It has no address in this language yet, so nothing will answer.",
|
|
91
91
|
preview: "Preview",
|
|
92
92
|
discard: "Discard changes",
|
|
93
|
-
"discard-title": "Discard what is waiting?",
|
|
94
|
-
"discard-text": "The service goes back to what the site is showing. What was written since is not listed anywhere.",
|
|
95
93
|
discarded: "The service is back to what is published.",
|
|
96
94
|
"conflict-title": "The service changed while you were editing",
|
|
97
95
|
"conflict-mine": "Keep mine",
|
|
@@ -140,215 +138,244 @@ const bt = {
|
|
|
140
138
|
"address-moving": "The address is changing. The old one keeps working and leads to the new one."
|
|
141
139
|
}
|
|
142
140
|
}, ke = /* @__PURE__ */ new WeakSet();
|
|
143
|
-
function
|
|
141
|
+
function ue() {
|
|
144
142
|
try {
|
|
145
|
-
const { i18n:
|
|
146
|
-
ke.has(
|
|
143
|
+
const { i18n: u } = ie();
|
|
144
|
+
ke.has(u) || (u.defaults("webx-services", kt), ke.add(u));
|
|
147
145
|
} catch {
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
|
-
const
|
|
148
|
+
const Tt = { class: "wx-service-editor__screen" }, St = 1200, $t = /* @__PURE__ */ oe({
|
|
151
149
|
__name: "ServiceEditorPage",
|
|
152
150
|
props: {
|
|
153
151
|
base: { default: "/services" }
|
|
154
152
|
},
|
|
155
|
-
setup(
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
const s =
|
|
159
|
-
const i =
|
|
160
|
-
return
|
|
161
|
-
}), ve =
|
|
162
|
-
const i =
|
|
163
|
-
return !i || i.status !== "published" && i.status !== "modified" ? "" : s("service.live-since", { date:
|
|
153
|
+
setup(u) {
|
|
154
|
+
const o = u, g = ie(), a = ce(g), l = We(), O = Ce(), r = nt(), W = Me();
|
|
155
|
+
ue();
|
|
156
|
+
const s = ae("webx-services"), x = ae("webx-admin"), T = me(), M = y(() => Number(l.params.id)), V = y(() => o.base), n = b(null), f = b({}), p = b(""), z = b(null), E = b(null), F = b(!0), K = b(!1), N = b(!1), Z = b({}), q = b(null), L = b(""), ee = b(0), P = y(() => g.can("services.manage")), le = y(() => !P.value || N.value), R = y(() => JSON.stringify(f.value)), I = y(() => L.value !== "" && R.value !== L.value), de = y(() => K.value ? "saving" : I.value ? "unsaved" : "saved"), te = y(() => {
|
|
157
|
+
const i = f.value.title;
|
|
158
|
+
return ot(i, r.active.value, n.value?.title ?? "");
|
|
159
|
+
}), ve = y(() => {
|
|
160
|
+
const i = n.value;
|
|
161
|
+
return !i || i.status !== "published" && i.status !== "modified" ? "" : s("service.live-since", { date: W.short(i.published_at) });
|
|
164
162
|
});
|
|
165
|
-
|
|
166
|
-
values:
|
|
167
|
-
prefix:
|
|
168
|
-
path:
|
|
163
|
+
lt({ url: y(() => E.value), reload: ee }), Le({
|
|
164
|
+
values: f,
|
|
165
|
+
prefix: z,
|
|
166
|
+
path: y(() => n.value?.path),
|
|
169
167
|
moving: () => s("service.address-moving")
|
|
170
|
-
}),
|
|
171
|
-
function
|
|
172
|
-
|
|
168
|
+
}), xt({ service: n, canManage: P.value, reload: () => U(!0) });
|
|
169
|
+
function G(i) {
|
|
170
|
+
n.value = i.service, f.value = i.values, p.value = i.revision, z.value = i.prefix, E.value = i.preview_url, L.value = JSON.stringify(i.values), q.value = null;
|
|
173
171
|
}
|
|
174
|
-
async function
|
|
175
|
-
i || (
|
|
172
|
+
async function U(i = !1) {
|
|
173
|
+
i || (F.value = !0);
|
|
176
174
|
try {
|
|
177
|
-
|
|
178
|
-
} catch (
|
|
179
|
-
S.danger($
|
|
175
|
+
G(await a.get(M.value));
|
|
176
|
+
} catch ($) {
|
|
177
|
+
S.danger(T($)), O.push(V.value);
|
|
180
178
|
} finally {
|
|
181
|
-
|
|
179
|
+
F.value = !1;
|
|
182
180
|
}
|
|
183
181
|
}
|
|
184
|
-
let
|
|
182
|
+
let J;
|
|
185
183
|
function pe() {
|
|
186
|
-
!
|
|
187
|
-
|
|
188
|
-
},
|
|
184
|
+
!P.value || q.value || !I.value || (clearTimeout(J), J = setTimeout(() => {
|
|
185
|
+
m();
|
|
186
|
+
}, St));
|
|
189
187
|
}
|
|
190
188
|
function he() {
|
|
191
|
-
!
|
|
189
|
+
!P.value || q.value || !I.value || K.value || (clearTimeout(J), m());
|
|
192
190
|
}
|
|
193
|
-
let
|
|
194
|
-
async function
|
|
195
|
-
for (;
|
|
196
|
-
const { carried:
|
|
197
|
-
if (await
|
|
191
|
+
let t;
|
|
192
|
+
async function m() {
|
|
193
|
+
for (; t; ) {
|
|
194
|
+
const { carried: C, done: H } = t;
|
|
195
|
+
if (await H, !I.value || q.value || R.value === C) return;
|
|
198
196
|
}
|
|
199
|
-
const i =
|
|
200
|
-
|
|
197
|
+
const i = R.value, $ = v();
|
|
198
|
+
t = { carried: i, done: $ };
|
|
201
199
|
try {
|
|
202
|
-
await
|
|
200
|
+
await $;
|
|
203
201
|
} finally {
|
|
204
|
-
|
|
202
|
+
t?.done === $ && (t = void 0);
|
|
205
203
|
}
|
|
206
204
|
}
|
|
207
|
-
async function
|
|
208
|
-
if (!
|
|
209
|
-
clearTimeout(
|
|
210
|
-
const i =
|
|
211
|
-
|
|
205
|
+
async function v() {
|
|
206
|
+
if (!n.value || !P.value) return;
|
|
207
|
+
clearTimeout(J);
|
|
208
|
+
const i = R.value, $ = f.value;
|
|
209
|
+
K.value = !0, Z.value = {};
|
|
212
210
|
try {
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
} catch (
|
|
216
|
-
const
|
|
217
|
-
|
|
211
|
+
const C = await a.save(n.value.id, { values: $, revision: p.value });
|
|
212
|
+
n.value = C.service, p.value = C.revision, z.value = C.prefix, E.value = C.preview_url, q.value = null, R.value === i && (L.value = i), ee.value += 1;
|
|
213
|
+
} catch (C) {
|
|
214
|
+
const H = C;
|
|
215
|
+
H.status === 409 && H.body?.data ? q.value = H.body : H.body?.errors ? (Z.value = H.body.errors, S.danger(s("service.save-failed"))) : S.danger(T(C));
|
|
218
216
|
} finally {
|
|
219
|
-
|
|
217
|
+
K.value = !1;
|
|
220
218
|
}
|
|
221
219
|
}
|
|
222
|
-
async function
|
|
223
|
-
await
|
|
220
|
+
async function se() {
|
|
221
|
+
await j({
|
|
224
222
|
title: s("service.conflict-theirs-title"),
|
|
225
223
|
message: s("service.conflict-theirs-text"),
|
|
226
224
|
confirmText: s("service.conflict-theirs"),
|
|
227
225
|
cancelText: s("panel.cancel"),
|
|
228
226
|
tone: "danger"
|
|
229
|
-
}) && await
|
|
230
|
-
}
|
|
231
|
-
async function te() {
|
|
232
|
-
const i = V.value;
|
|
233
|
-
i && (m.value = i.data.revision, V.value = null, await t());
|
|
227
|
+
}) && await U(!0);
|
|
234
228
|
}
|
|
235
229
|
async function fe() {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
230
|
+
const i = q.value;
|
|
231
|
+
i && (p.value = i.data.revision, q.value = null, await m());
|
|
232
|
+
}
|
|
233
|
+
async function Ee() {
|
|
234
|
+
if (!(!n.value || !await j({
|
|
235
|
+
title: x("editor.discard-title"),
|
|
236
|
+
message: x("editor.discard-text"),
|
|
239
237
|
confirmText: s("service.discard"),
|
|
240
|
-
|
|
238
|
+
// Not «Cancel»: beside «Discard changes» the two read as the same word.
|
|
239
|
+
cancelText: x("editor.keep-changes"),
|
|
241
240
|
tone: "danger"
|
|
242
241
|
}))) {
|
|
243
|
-
|
|
242
|
+
N.value = !0;
|
|
244
243
|
try {
|
|
245
|
-
|
|
246
|
-
} catch (
|
|
247
|
-
S.danger($
|
|
244
|
+
G(await a.discard(n.value.id)), S.success(s("service.discarded"));
|
|
245
|
+
} catch ($) {
|
|
246
|
+
S.danger(T($));
|
|
248
247
|
} finally {
|
|
249
|
-
|
|
248
|
+
N.value = !1;
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
251
|
}
|
|
253
|
-
async function
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
252
|
+
async function Ne() {
|
|
253
|
+
if (I.value && await m(), q.value || I.value) return;
|
|
254
|
+
const i = n.value;
|
|
255
|
+
if (!i) return;
|
|
256
|
+
const $ = i.next_path ?? i.path, C = i.next_path != null && i.path !== null ? ` ${x("editor.publish-moves", { old: `/${i.path}` })}` : "";
|
|
257
|
+
if (await j({
|
|
258
|
+
title: s("service.publish-title", { title: te.value || i.title }),
|
|
259
|
+
message: $ === null ? s("service.publish-nowhere") : s("service.publish-text", { address: `/${$}` }) + C,
|
|
258
260
|
confirmText: s("panel.publish"),
|
|
259
261
|
cancelText: s("panel.cancel")
|
|
260
|
-
}))
|
|
261
|
-
|
|
262
|
+
})) {
|
|
263
|
+
N.value = !0;
|
|
262
264
|
try {
|
|
263
|
-
await
|
|
264
|
-
} catch (
|
|
265
|
-
S.danger(
|
|
265
|
+
await a.publish(i.id), await U(!0), S.success(s("panel.published"));
|
|
266
|
+
} catch (Pe) {
|
|
267
|
+
S.danger(T(Pe));
|
|
266
268
|
} finally {
|
|
267
|
-
|
|
269
|
+
N.value = !1;
|
|
268
270
|
}
|
|
269
271
|
}
|
|
270
272
|
}
|
|
271
|
-
function
|
|
272
|
-
const i =
|
|
273
|
+
async function Ae() {
|
|
274
|
+
const i = n.value;
|
|
275
|
+
if (!(!i || !await j({
|
|
276
|
+
title: x("editor.unpublish-title"),
|
|
277
|
+
message: x("editor.unpublish-text"),
|
|
278
|
+
confirmText: x("editor.unpublish"),
|
|
279
|
+
cancelText: x("editor.keep-published")
|
|
280
|
+
}))) {
|
|
281
|
+
N.value = !0;
|
|
282
|
+
try {
|
|
283
|
+
await a.unpublish(i.id), await U(!0), S.success(x("editor.unpublished"));
|
|
284
|
+
} catch (C) {
|
|
285
|
+
S.danger(T(C));
|
|
286
|
+
} finally {
|
|
287
|
+
N.value = !1;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function Be() {
|
|
292
|
+
const i = n.value?.status;
|
|
273
293
|
return i === "published" || i === "modified" ? "success" : "default";
|
|
274
294
|
}
|
|
275
295
|
function we(i) {
|
|
276
|
-
|
|
296
|
+
I.value && i.preventDefault();
|
|
277
297
|
}
|
|
278
|
-
|
|
279
|
-
|
|
298
|
+
re(R, pe), re(M, () => {
|
|
299
|
+
U();
|
|
280
300
|
}), Te(() => {
|
|
281
|
-
|
|
301
|
+
U(), window.addEventListener("beforeunload", we);
|
|
282
302
|
}), Se(() => {
|
|
283
|
-
clearTimeout(
|
|
284
|
-
}),
|
|
303
|
+
clearTimeout(J), window.removeEventListener("beforeunload", we);
|
|
304
|
+
}), it(async () => !I.value || !P.value || (await m(), !I.value) ? !0 : await j({
|
|
285
305
|
title: s("service.leave-title"),
|
|
286
306
|
message: s("service.leave-text"),
|
|
287
307
|
confirmText: s("service.leave"),
|
|
288
308
|
cancelText: s("panel.cancel"),
|
|
289
309
|
tone: "danger"
|
|
290
310
|
}));
|
|
291
|
-
const
|
|
311
|
+
const Oe = y(() => {
|
|
292
312
|
const i = [];
|
|
293
|
-
return
|
|
313
|
+
return E.value && i.push({ key: "preview", label: s("service.preview"), icon: "eye", href: E.value }), n.value?.url && n.value.status !== "draft" && i.push({
|
|
294
314
|
key: "site",
|
|
295
315
|
label: s("panel.open-on-site"),
|
|
296
316
|
icon: "link",
|
|
297
|
-
href:
|
|
298
|
-
}),
|
|
317
|
+
href: n.value.url
|
|
318
|
+
}), P.value && (n.value?.status === "published" || n.value?.status === "modified") && i.push({
|
|
319
|
+
key: "unpublish",
|
|
320
|
+
label: x("editor.unpublish"),
|
|
321
|
+
icon: "eye-off",
|
|
322
|
+
run: () => {
|
|
323
|
+
Ae();
|
|
324
|
+
}
|
|
325
|
+
}), n.value?.status === "modified" && i.push({
|
|
299
326
|
key: "discard",
|
|
300
327
|
label: s("service.discard"),
|
|
301
328
|
icon: "refresh",
|
|
302
329
|
danger: !0,
|
|
303
330
|
menu: !0,
|
|
304
331
|
run: () => {
|
|
305
|
-
|
|
332
|
+
Ee();
|
|
306
333
|
}
|
|
307
334
|
}), i;
|
|
308
335
|
});
|
|
309
|
-
return (i,
|
|
336
|
+
return (i, $) => (d(), B("div", {
|
|
310
337
|
class: "wx-service-editor",
|
|
311
338
|
onFocusout: he
|
|
312
339
|
}, [
|
|
313
|
-
|
|
314
|
-
|
|
340
|
+
F.value || !n.value ? (d(), B(Y, { key: 0 }, [
|
|
341
|
+
h(e(ne), {
|
|
315
342
|
class: "wx-service-editor__ghost",
|
|
316
343
|
title: "",
|
|
317
344
|
rows: 1
|
|
318
345
|
}),
|
|
319
|
-
|
|
320
|
-
default:
|
|
321
|
-
|
|
346
|
+
h(e(ct), null, {
|
|
347
|
+
default: c(() => [
|
|
348
|
+
h(e(ne), { rows: 8 })
|
|
322
349
|
]),
|
|
323
350
|
_: 1
|
|
324
351
|
})
|
|
325
|
-
], 64)) : (d(),
|
|
326
|
-
|
|
352
|
+
], 64)) : (d(), B(Y, { key: 1 }, [
|
|
353
|
+
h(e(Re), {
|
|
327
354
|
divider: "",
|
|
328
|
-
back:
|
|
355
|
+
back: V.value,
|
|
329
356
|
"back-label": e(s)("module.services"),
|
|
330
|
-
title:
|
|
357
|
+
title: te.value || e(s)("service.untitled"),
|
|
331
358
|
subtitle: ve.value,
|
|
332
|
-
actions:
|
|
359
|
+
actions: Oe.value
|
|
333
360
|
}, {
|
|
334
|
-
trail:
|
|
335
|
-
|
|
361
|
+
trail: c(() => [
|
|
362
|
+
h(e(ut), {
|
|
336
363
|
size: "sm",
|
|
337
364
|
label: e(s)("service.trail")
|
|
338
365
|
}, {
|
|
339
|
-
default:
|
|
340
|
-
|
|
366
|
+
default: c(() => [
|
|
367
|
+
h(e(xe), {
|
|
341
368
|
as: "router-link",
|
|
342
|
-
to:
|
|
369
|
+
to: V.value
|
|
343
370
|
}, {
|
|
344
|
-
default:
|
|
371
|
+
default: c(() => [
|
|
345
372
|
_(w(e(s)("module.services")), 1)
|
|
346
373
|
]),
|
|
347
374
|
_: 1
|
|
348
375
|
}, 8, ["to"]),
|
|
349
|
-
|
|
350
|
-
default:
|
|
351
|
-
_(w(
|
|
376
|
+
h(e(xe), { current: "" }, {
|
|
377
|
+
default: c(() => [
|
|
378
|
+
_(w(te.value || e(s)("service.untitled")), 1)
|
|
352
379
|
]),
|
|
353
380
|
_: 1
|
|
354
381
|
})
|
|
@@ -356,253 +383,253 @@ const wt = { class: "wx-service-editor__screen" }, _t = 1200, xt = /* @__PURE__
|
|
|
356
383
|
_: 1
|
|
357
384
|
}, 8, ["label"])
|
|
358
385
|
]),
|
|
359
|
-
"title-after":
|
|
360
|
-
|
|
361
|
-
type:
|
|
386
|
+
"title-after": c(() => [
|
|
387
|
+
h(e(Q), {
|
|
388
|
+
type: Be(),
|
|
362
389
|
dot: ""
|
|
363
390
|
}, {
|
|
364
|
-
default:
|
|
365
|
-
_(w(e(s)(`panel.status-${
|
|
391
|
+
default: c(() => [
|
|
392
|
+
_(w(e(s)(`panel.status-${n.value.status}`)), 1)
|
|
366
393
|
]),
|
|
367
394
|
_: 1
|
|
368
395
|
}, 8, ["type"]),
|
|
369
|
-
|
|
396
|
+
n.value.status === "modified" ? (d(), k(e(Q), {
|
|
370
397
|
key: 0,
|
|
371
398
|
type: "primary",
|
|
372
399
|
round: ""
|
|
373
400
|
}, {
|
|
374
|
-
default:
|
|
401
|
+
default: c(() => [
|
|
375
402
|
_(w(e(s)("panel.edits")), 1)
|
|
376
403
|
]),
|
|
377
404
|
_: 1
|
|
378
|
-
})) :
|
|
405
|
+
})) : D("", !0)
|
|
379
406
|
]),
|
|
380
407
|
_: 1
|
|
381
408
|
}, 8, ["back", "back-label", "title", "subtitle", "actions"]),
|
|
382
|
-
|
|
409
|
+
q.value ? (d(), k(e(Ve), {
|
|
383
410
|
key: 0,
|
|
384
411
|
type: "warning",
|
|
385
412
|
title: e(s)("service.conflict-title"),
|
|
386
|
-
description:
|
|
413
|
+
description: q.value.message
|
|
387
414
|
}, {
|
|
388
|
-
actions:
|
|
389
|
-
|
|
415
|
+
actions: c(() => [
|
|
416
|
+
h(e(X), {
|
|
390
417
|
size: "sm",
|
|
391
418
|
variant: "outline",
|
|
392
|
-
onClick:
|
|
419
|
+
onClick: se
|
|
393
420
|
}, {
|
|
394
|
-
default:
|
|
421
|
+
default: c(() => [
|
|
395
422
|
_(w(e(s)("service.conflict-theirs")), 1)
|
|
396
423
|
]),
|
|
397
424
|
_: 1
|
|
398
425
|
}),
|
|
399
|
-
|
|
426
|
+
h(e(X), {
|
|
400
427
|
size: "sm",
|
|
401
428
|
type: "primary",
|
|
402
|
-
onClick:
|
|
429
|
+
onClick: fe
|
|
403
430
|
}, {
|
|
404
|
-
default:
|
|
431
|
+
default: c(() => [
|
|
405
432
|
_(w(e(s)("service.conflict-mine")), 1)
|
|
406
433
|
]),
|
|
407
434
|
_: 1
|
|
408
435
|
})
|
|
409
436
|
]),
|
|
410
437
|
_: 1
|
|
411
|
-
}, 8, ["title", "description"])) :
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
modelValue:
|
|
415
|
-
"onUpdate:modelValue":
|
|
438
|
+
}, 8, ["title", "description"])) : D("", !0),
|
|
439
|
+
A("div", Tt, [
|
|
440
|
+
h(e(Ue), {
|
|
441
|
+
modelValue: f.value,
|
|
442
|
+
"onUpdate:modelValue": $[0] || ($[0] = (C) => f.value = C),
|
|
416
443
|
name: "services.form",
|
|
417
|
-
errors:
|
|
418
|
-
disabled:
|
|
444
|
+
errors: Z.value,
|
|
445
|
+
disabled: le.value
|
|
419
446
|
}, null, 8, ["modelValue", "errors", "disabled"])
|
|
420
447
|
]),
|
|
421
|
-
|
|
422
|
-
state:
|
|
423
|
-
|
|
448
|
+
P.value ? (d(), k(e(dt), { key: 1 }, {
|
|
449
|
+
state: c(() => [
|
|
450
|
+
h(e(He), { state: de.value }, null, 8, ["state"])
|
|
424
451
|
]),
|
|
425
|
-
default:
|
|
426
|
-
|
|
452
|
+
default: c(() => [
|
|
453
|
+
h(e(X), {
|
|
427
454
|
variant: "outline",
|
|
428
|
-
loading:
|
|
429
|
-
disabled: !
|
|
430
|
-
onClick:
|
|
455
|
+
loading: K.value,
|
|
456
|
+
disabled: !I.value,
|
|
457
|
+
onClick: m
|
|
431
458
|
}, {
|
|
432
|
-
default:
|
|
459
|
+
default: c(() => [
|
|
433
460
|
_(w(e(s)("service.save")), 1)
|
|
434
461
|
]),
|
|
435
462
|
_: 1
|
|
436
463
|
}, 8, ["loading", "disabled"]),
|
|
437
|
-
|
|
464
|
+
h(e(X), {
|
|
438
465
|
type: "primary",
|
|
439
|
-
loading:
|
|
440
|
-
disabled:
|
|
441
|
-
onClick:
|
|
466
|
+
loading: N.value,
|
|
467
|
+
disabled: n.value.status === "published" && !I.value,
|
|
468
|
+
onClick: Ne
|
|
442
469
|
}, {
|
|
443
|
-
default:
|
|
470
|
+
default: c(() => [
|
|
444
471
|
_(w(e(s)("panel.publish")), 1)
|
|
445
472
|
]),
|
|
446
473
|
_: 1
|
|
447
474
|
}, 8, ["loading", "disabled"])
|
|
448
475
|
]),
|
|
449
476
|
_: 1
|
|
450
|
-
})) :
|
|
477
|
+
})) : D("", !0)
|
|
451
478
|
], 64))
|
|
452
479
|
], 32));
|
|
453
480
|
}
|
|
454
|
-
}), be = (
|
|
455
|
-
const
|
|
456
|
-
for (const [
|
|
457
|
-
|
|
458
|
-
return
|
|
459
|
-
},
|
|
481
|
+
}), be = (u, o) => {
|
|
482
|
+
const g = u.__vccOpts || u;
|
|
483
|
+
for (const [a, l] of o)
|
|
484
|
+
g[a] = l;
|
|
485
|
+
return g;
|
|
486
|
+
}, Wt = /* @__PURE__ */ be($t, [["__scopeId", "data-v-13029584"]]), Ct = { class: "wx-service-history" }, Vt = { class: "wx-service-history__number" }, qt = { class: "wx-service-history__who" }, It = /* @__PURE__ */ oe({
|
|
460
487
|
name: "WxServiceHistory",
|
|
461
488
|
__name: "ServiceHistory",
|
|
462
|
-
setup(
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
const l =
|
|
466
|
-
() => s.value?.status === "published" || s.value?.status === "modified" ?
|
|
489
|
+
setup(u) {
|
|
490
|
+
const o = ie(), g = ce(o), a = _t();
|
|
491
|
+
ue();
|
|
492
|
+
const l = ae("webx-services"), O = me(), r = b(null), W = b(!1), s = y(() => a?.service.value ?? null), x = y(() => a?.canManage ?? !1), T = y(
|
|
493
|
+
() => s.value?.status === "published" || s.value?.status === "modified" ? r.value?.[0]?.number ?? null : null
|
|
467
494
|
);
|
|
468
|
-
async function
|
|
469
|
-
const
|
|
470
|
-
if (
|
|
495
|
+
async function M() {
|
|
496
|
+
const n = s.value;
|
|
497
|
+
if (n)
|
|
471
498
|
try {
|
|
472
|
-
|
|
473
|
-
} catch (
|
|
474
|
-
|
|
499
|
+
r.value = await g.versions(n.id);
|
|
500
|
+
} catch (f) {
|
|
501
|
+
r.value = [], S.danger(O(f));
|
|
475
502
|
}
|
|
476
503
|
}
|
|
477
|
-
async function
|
|
478
|
-
const
|
|
479
|
-
if (!(!
|
|
480
|
-
title: l("service.restore-title", { number:
|
|
504
|
+
async function V(n) {
|
|
505
|
+
const f = s.value;
|
|
506
|
+
if (!(!f || !await j({
|
|
507
|
+
title: l("service.restore-title", { number: n.number }),
|
|
481
508
|
message: l("service.restore-text"),
|
|
482
509
|
confirmText: l("service.restore-version"),
|
|
483
510
|
cancelText: l("panel.cancel")
|
|
484
511
|
}))) {
|
|
485
|
-
|
|
512
|
+
W.value = !0;
|
|
486
513
|
try {
|
|
487
|
-
await
|
|
488
|
-
} catch (
|
|
489
|
-
S.danger(
|
|
514
|
+
await g.restoreVersion(f.id, n.number), await a?.reload(), S.success(l("service.restored-version", { number: n.number }));
|
|
515
|
+
} catch (z) {
|
|
516
|
+
S.danger(O(z));
|
|
490
517
|
} finally {
|
|
491
|
-
|
|
518
|
+
W.value = !1;
|
|
492
519
|
}
|
|
493
520
|
}
|
|
494
521
|
}
|
|
495
|
-
return
|
|
522
|
+
return re(
|
|
496
523
|
() => [s.value?.id, s.value?.published_at, s.value?.updated_at],
|
|
497
524
|
() => {
|
|
498
|
-
|
|
525
|
+
M();
|
|
499
526
|
},
|
|
500
527
|
{ immediate: !0 }
|
|
501
|
-
), (
|
|
502
|
-
|
|
528
|
+
), (n, f) => (d(), B("div", Ct, [
|
|
529
|
+
r.value === null ? (d(), k(e(ne), {
|
|
503
530
|
key: 0,
|
|
504
531
|
class: "wx-service-history__ghost",
|
|
505
532
|
rows: 3
|
|
506
|
-
})) :
|
|
533
|
+
})) : r.value.length === 0 ? (d(), k(e(qe), {
|
|
507
534
|
key: 1,
|
|
508
535
|
description: e(l)("service.history-empty")
|
|
509
|
-
}, null, 8, ["description"])) : (d(!0),
|
|
510
|
-
key:
|
|
511
|
-
class: ye(["wx-service-history__row", { "is-live":
|
|
536
|
+
}, null, 8, ["description"])) : (d(!0), B(Y, { key: 2 }, $e(r.value, (p) => (d(), B("div", {
|
|
537
|
+
key: p.number,
|
|
538
|
+
class: ye(["wx-service-history__row", { "is-live": p.number === T.value }])
|
|
512
539
|
}, [
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
540
|
+
A("code", Vt, w(e(l)("service.version", { number: p.number })), 1),
|
|
541
|
+
A("div", qt, [
|
|
542
|
+
p.created_at ? (d(), k(e(Fe), {
|
|
516
543
|
key: 0,
|
|
517
|
-
value:
|
|
544
|
+
value: p.created_at,
|
|
518
545
|
size: "md",
|
|
519
546
|
tone: "default"
|
|
520
|
-
}, null, 8, ["value"])) :
|
|
521
|
-
|
|
547
|
+
}, null, 8, ["value"])) : D("", !0),
|
|
548
|
+
h(e(vt), {
|
|
522
549
|
size: "sm",
|
|
523
550
|
tone: "muted"
|
|
524
551
|
}, {
|
|
525
|
-
default:
|
|
526
|
-
_(w(
|
|
527
|
-
|
|
528
|
-
_(" · " + w(
|
|
529
|
-
], 64)) :
|
|
552
|
+
default: c(() => [
|
|
553
|
+
_(w(p.author ?? e(l)(`service.source-${p.source}`)) + " ", 1),
|
|
554
|
+
p.comment ? (d(), B(Y, { key: 0 }, [
|
|
555
|
+
_(" · " + w(p.comment), 1)
|
|
556
|
+
], 64)) : D("", !0)
|
|
530
557
|
]),
|
|
531
558
|
_: 2
|
|
532
559
|
}, 1024)
|
|
533
560
|
]),
|
|
534
|
-
|
|
561
|
+
p.number === T.value ? (d(), k(e(Q), {
|
|
535
562
|
key: 0,
|
|
536
563
|
type: "success",
|
|
537
564
|
dot: ""
|
|
538
565
|
}, {
|
|
539
|
-
default:
|
|
566
|
+
default: c(() => [
|
|
540
567
|
_(w(e(l)("service.version-live")), 1)
|
|
541
568
|
]),
|
|
542
569
|
_: 1
|
|
543
|
-
})) :
|
|
544
|
-
|
|
570
|
+
})) : D("", !0),
|
|
571
|
+
x.value && p.number !== T.value ? (d(), k(e(X), {
|
|
545
572
|
key: 1,
|
|
546
573
|
size: "sm",
|
|
547
574
|
variant: "outline",
|
|
548
|
-
loading:
|
|
549
|
-
onClick: (
|
|
575
|
+
loading: W.value,
|
|
576
|
+
onClick: (z) => V(p)
|
|
550
577
|
}, {
|
|
551
|
-
default:
|
|
578
|
+
default: c(() => [
|
|
552
579
|
_(w(e(l)("service.restore-version")), 1)
|
|
553
580
|
]),
|
|
554
581
|
_: 1
|
|
555
|
-
}, 8, ["loading", "onClick"])) :
|
|
582
|
+
}, 8, ["loading", "onClick"])) : D("", !0)
|
|
556
583
|
], 2))), 128))
|
|
557
584
|
]));
|
|
558
585
|
}
|
|
559
|
-
}),
|
|
586
|
+
}), zt = /* @__PURE__ */ be(It, [["__scopeId", "data-v-72dccbb1"]]), Et = /* @__PURE__ */ oe({
|
|
560
587
|
__name: "ServiceCreateDialog",
|
|
561
|
-
setup(
|
|
562
|
-
const { open:
|
|
563
|
-
|
|
564
|
-
const
|
|
588
|
+
setup(u) {
|
|
589
|
+
const { open: o, resolve: g, dismiss: a } = pt(), l = ie(), O = ce(l);
|
|
590
|
+
ue();
|
|
591
|
+
const r = ae("webx-services"), W = b(""), s = b(!1), x = b({}), T = Ze("field");
|
|
565
592
|
Te(async () => {
|
|
566
|
-
await
|
|
593
|
+
await et(), T.value?.querySelector("input")?.focus();
|
|
567
594
|
});
|
|
568
|
-
async function
|
|
569
|
-
if (!(
|
|
570
|
-
s.value = !0,
|
|
595
|
+
async function M() {
|
|
596
|
+
if (!(W.value.trim() === "" || s.value)) {
|
|
597
|
+
s.value = !0, x.value = {};
|
|
571
598
|
try {
|
|
572
|
-
|
|
573
|
-
} catch (
|
|
574
|
-
|
|
599
|
+
g(await O.create({ title: W.value.trim() }));
|
|
600
|
+
} catch (V) {
|
|
601
|
+
x.value = V.body?.errors ?? {};
|
|
575
602
|
} finally {
|
|
576
603
|
s.value = !1;
|
|
577
604
|
}
|
|
578
605
|
}
|
|
579
606
|
}
|
|
580
|
-
return (
|
|
581
|
-
open: e(
|
|
582
|
-
"onUpdate:open":
|
|
583
|
-
title: e(
|
|
607
|
+
return (V, n) => (d(), k(e(ht), {
|
|
608
|
+
open: e(o),
|
|
609
|
+
"onUpdate:open": n[2] || (n[2] = (f) => tt(o) ? o.value = f : null),
|
|
610
|
+
title: e(r)("panel.new-title"),
|
|
584
611
|
width: 440
|
|
585
612
|
}, {
|
|
586
|
-
footer:
|
|
587
|
-
|
|
588
|
-
default:
|
|
589
|
-
|
|
613
|
+
footer: c(() => [
|
|
614
|
+
h(e(yt), { size: "sm" }, {
|
|
615
|
+
default: c(() => [
|
|
616
|
+
h(e(X), {
|
|
590
617
|
variant: "outline",
|
|
591
|
-
onClick:
|
|
618
|
+
onClick: n[1] || (n[1] = (f) => e(a)())
|
|
592
619
|
}, {
|
|
593
|
-
default:
|
|
594
|
-
_(w(e(
|
|
620
|
+
default: c(() => [
|
|
621
|
+
_(w(e(r)("panel.cancel")), 1)
|
|
595
622
|
]),
|
|
596
623
|
_: 1
|
|
597
624
|
}),
|
|
598
|
-
|
|
625
|
+
h(e(X), {
|
|
599
626
|
type: "primary",
|
|
600
627
|
loading: s.value,
|
|
601
|
-
disabled:
|
|
602
|
-
onClick:
|
|
628
|
+
disabled: W.value.trim() === "",
|
|
629
|
+
onClick: M
|
|
603
630
|
}, {
|
|
604
|
-
default:
|
|
605
|
-
_(w(e(
|
|
631
|
+
default: c(() => [
|
|
632
|
+
_(w(e(r)("panel.create")), 1)
|
|
606
633
|
]),
|
|
607
634
|
_: 1
|
|
608
635
|
}, 8, ["loading", "disabled"])
|
|
@@ -610,22 +637,22 @@ const wt = { class: "wx-service-editor__screen" }, _t = 1200, xt = /* @__PURE__
|
|
|
610
637
|
_: 1
|
|
611
638
|
})
|
|
612
639
|
]),
|
|
613
|
-
default:
|
|
614
|
-
|
|
615
|
-
label: e(
|
|
616
|
-
error:
|
|
640
|
+
default: c(() => [
|
|
641
|
+
h(e(ft), {
|
|
642
|
+
label: e(r)("panel.field-title"),
|
|
643
|
+
error: x.value.title?.[0] ?? x.value.slug?.[0],
|
|
617
644
|
required: ""
|
|
618
645
|
}, {
|
|
619
|
-
default:
|
|
620
|
-
|
|
646
|
+
default: c(() => [
|
|
647
|
+
A("div", {
|
|
621
648
|
ref_key: "field",
|
|
622
|
-
ref:
|
|
649
|
+
ref: T
|
|
623
650
|
}, [
|
|
624
|
-
|
|
625
|
-
modelValue:
|
|
626
|
-
"onUpdate:modelValue":
|
|
627
|
-
"aria-label": e(
|
|
628
|
-
onKeyup:
|
|
651
|
+
h(e(Ie), {
|
|
652
|
+
modelValue: W.value,
|
|
653
|
+
"onUpdate:modelValue": n[0] || (n[0] = (f) => W.value = f),
|
|
654
|
+
"aria-label": e(r)("panel.field-title"),
|
|
655
|
+
onKeyup: st(M, ["enter"])
|
|
629
656
|
}, null, 8, ["modelValue", "aria-label"])
|
|
630
657
|
], 512)
|
|
631
658
|
]),
|
|
@@ -635,351 +662,357 @@ const wt = { class: "wx-service-editor__screen" }, _t = 1200, xt = /* @__PURE__
|
|
|
635
662
|
_: 1
|
|
636
663
|
}, 8, ["open", "title"]));
|
|
637
664
|
}
|
|
638
|
-
}),
|
|
665
|
+
}), Nt = { class: "wx-services" }, At = { class: "wx-services__bar" }, Bt = ["src"], Ot = { class: "wx-service-row__name" }, Pt = { class: "wx-service-row__title" }, Dt = { class: "wx-service-row__address" }, Mt = { class: "wx-service-row__facts" }, Lt = { class: "wx-service-row__chips" }, Rt = { class: "wx-service-row__state" }, Ut = /* @__PURE__ */ oe({
|
|
639
666
|
__name: "ServicesPage",
|
|
640
667
|
props: {
|
|
641
668
|
base: { default: "/services" }
|
|
642
669
|
},
|
|
643
|
-
setup(
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
() =>
|
|
648
|
-
),
|
|
670
|
+
setup(u) {
|
|
671
|
+
const o = u, g = ie(), a = ce(g), l = We(), O = Ce();
|
|
672
|
+
ue();
|
|
673
|
+
const r = ae("webx-services"), W = me(), s = b([]), x = b([]), T = b(!0), M = gt(Et), V = y(() => g.can("services.manage")), n = y(
|
|
674
|
+
() => g.state.manifest?.modules.find((t) => t.id === "services")?.title ?? r("module.services")
|
|
675
|
+
), f = y({
|
|
649
676
|
get: () => typeof l.query.view == "string" ? l.query.view : "",
|
|
650
677
|
set: (t) => {
|
|
651
|
-
|
|
678
|
+
O.replace({
|
|
652
679
|
query: { ...l.query, view: t === "" ? void 0 : String(t) }
|
|
653
680
|
});
|
|
654
681
|
}
|
|
655
|
-
}),
|
|
682
|
+
}), p = y(() => f.value === "trashed"), z = y(() => {
|
|
656
683
|
const t = l.query.category;
|
|
657
684
|
return typeof t == "string" && t !== "" && Number(t) || null;
|
|
658
|
-
}),
|
|
659
|
-
{ value: "", label:
|
|
660
|
-
{ value: "published", label:
|
|
661
|
-
{ value: "draft", label:
|
|
662
|
-
{ value: "unpublished", label:
|
|
663
|
-
{ value: "trashed", label:
|
|
664
|
-
]),
|
|
665
|
-
q:
|
|
666
|
-
category:
|
|
667
|
-
filtered:
|
|
668
|
-
})),
|
|
669
|
-
async function
|
|
670
|
-
|
|
685
|
+
}), E = y(() => typeof l.query.q == "string" ? l.query.q : ""), F = b(E.value), K = y(() => [
|
|
686
|
+
{ value: "", label: r("panel.view-all") },
|
|
687
|
+
{ value: "published", label: r("panel.view-published") },
|
|
688
|
+
{ value: "draft", label: r("panel.view-draft") },
|
|
689
|
+
{ value: "unpublished", label: r("panel.view-unpublished") },
|
|
690
|
+
{ value: "trashed", label: r("panel.bin"), icon: "trash" }
|
|
691
|
+
]), N = Ke(ge, () => ({
|
|
692
|
+
q: E.value,
|
|
693
|
+
category: z.value,
|
|
694
|
+
filtered: f.value !== ""
|
|
695
|
+
})), Z = y(() => V.value && N.sortable.value), q = y(() => E.value !== "" ? r("panel.empty-search") : p.value ? r("panel.empty-bin") : r("panel.empty"));
|
|
696
|
+
async function L() {
|
|
697
|
+
T.value = !0;
|
|
671
698
|
try {
|
|
672
|
-
const t = await
|
|
673
|
-
q:
|
|
674
|
-
category:
|
|
675
|
-
status:
|
|
676
|
-
trashed:
|
|
699
|
+
const t = await a.list({
|
|
700
|
+
q: E.value,
|
|
701
|
+
category: z.value,
|
|
702
|
+
status: p.value ? "" : f.value,
|
|
703
|
+
trashed: p.value
|
|
677
704
|
});
|
|
678
|
-
s.value = t.data,
|
|
705
|
+
s.value = t.data, x.value = t.filters.categories;
|
|
679
706
|
} catch (t) {
|
|
680
|
-
S.danger(
|
|
707
|
+
S.danger(W(t));
|
|
681
708
|
} finally {
|
|
682
|
-
|
|
709
|
+
T.value = !1;
|
|
683
710
|
}
|
|
684
711
|
}
|
|
685
|
-
|
|
686
|
-
() => [
|
|
712
|
+
re(
|
|
713
|
+
() => [f.value, z.value, E.value],
|
|
687
714
|
() => {
|
|
688
|
-
|
|
715
|
+
L();
|
|
689
716
|
}
|
|
690
|
-
),
|
|
691
|
-
let
|
|
692
|
-
|
|
693
|
-
clearTimeout(
|
|
694
|
-
|
|
717
|
+
), L();
|
|
718
|
+
let ee;
|
|
719
|
+
re(F, (t) => {
|
|
720
|
+
clearTimeout(ee), ee = setTimeout(() => {
|
|
721
|
+
O.replace({ query: { ...l.query, q: t.trim() === "" ? void 0 : t } });
|
|
695
722
|
}, 300);
|
|
696
|
-
}), Se(() => clearTimeout(
|
|
697
|
-
function
|
|
698
|
-
|
|
723
|
+
}), Se(() => clearTimeout(ee));
|
|
724
|
+
function P(t) {
|
|
725
|
+
O.replace({
|
|
699
726
|
query: { ...l.query, category: typeof t == "number" ? String(t) : void 0 }
|
|
700
727
|
});
|
|
701
728
|
}
|
|
702
|
-
function
|
|
703
|
-
|
|
729
|
+
function le(t) {
|
|
730
|
+
O.push({ path: `${o.base}/${t.id}`, query: { ...l.query } });
|
|
704
731
|
}
|
|
705
|
-
async function
|
|
706
|
-
const t = await
|
|
707
|
-
t &&
|
|
732
|
+
async function R() {
|
|
733
|
+
const t = await M({});
|
|
734
|
+
t && le(t);
|
|
708
735
|
}
|
|
709
|
-
async function
|
|
736
|
+
async function I() {
|
|
710
737
|
try {
|
|
711
|
-
await
|
|
738
|
+
await N.move(s.value.map((t) => t.id));
|
|
712
739
|
} catch (t) {
|
|
713
|
-
S.danger(
|
|
740
|
+
S.danger(W(t, r("panel.reorder-failed"))), await L();
|
|
714
741
|
}
|
|
715
742
|
}
|
|
716
|
-
function
|
|
717
|
-
if (!
|
|
718
|
-
if (
|
|
743
|
+
function de(t) {
|
|
744
|
+
if (!V.value) return [];
|
|
745
|
+
if (p.value)
|
|
719
746
|
return [
|
|
720
747
|
{
|
|
721
748
|
key: "restore",
|
|
722
749
|
icon: "refresh",
|
|
723
|
-
label:
|
|
750
|
+
label: r("panel.restore"),
|
|
724
751
|
run: () => {
|
|
725
|
-
|
|
752
|
+
ve(t);
|
|
726
753
|
}
|
|
727
754
|
}
|
|
728
755
|
];
|
|
729
|
-
const
|
|
730
|
-
{ key: "open", icon: "edit", label:
|
|
756
|
+
const m = [
|
|
757
|
+
{ key: "open", icon: "edit", label: r("panel.open"), run: () => le(t) }
|
|
731
758
|
];
|
|
732
|
-
return t.url && t.status !== "draft" &&
|
|
759
|
+
return t.url && t.status !== "draft" && m.push({
|
|
733
760
|
key: "site",
|
|
734
761
|
icon: "external-link",
|
|
735
|
-
label:
|
|
762
|
+
label: r("panel.open-on-site"),
|
|
736
763
|
href: t.url
|
|
737
|
-
}), t.url &&
|
|
764
|
+
}), t.url && m.push({
|
|
738
765
|
key: "copy",
|
|
739
766
|
icon: "copy",
|
|
740
|
-
label:
|
|
767
|
+
label: r("panel.copy-address"),
|
|
741
768
|
run: () => {
|
|
742
|
-
|
|
769
|
+
U(t);
|
|
743
770
|
}
|
|
744
|
-
}),
|
|
771
|
+
}), m.push(
|
|
745
772
|
t.status === "published" || t.status === "modified" ? {
|
|
746
773
|
key: "unpublish",
|
|
747
774
|
icon: "eye-off",
|
|
748
|
-
label:
|
|
775
|
+
label: r("panel.unpublish"),
|
|
749
776
|
run: () => {
|
|
750
|
-
|
|
777
|
+
G(() => a.unpublish(t.id), r("panel.unpublished-done"));
|
|
751
778
|
}
|
|
752
779
|
} : {
|
|
753
780
|
key: "publish",
|
|
754
781
|
icon: "upload",
|
|
755
|
-
label:
|
|
782
|
+
label: r("panel.publish"),
|
|
756
783
|
run: () => {
|
|
757
|
-
|
|
784
|
+
G(() => a.publish(t.id), r("panel.published"));
|
|
758
785
|
}
|
|
759
786
|
}
|
|
760
|
-
),
|
|
787
|
+
), m.push({
|
|
761
788
|
key: "delete",
|
|
762
789
|
icon: "trash",
|
|
763
|
-
label:
|
|
790
|
+
label: r("panel.delete"),
|
|
764
791
|
danger: !0,
|
|
765
792
|
run: () => {
|
|
766
|
-
|
|
793
|
+
te(t);
|
|
767
794
|
}
|
|
768
|
-
}),
|
|
795
|
+
}), m;
|
|
769
796
|
}
|
|
770
|
-
async function
|
|
771
|
-
await
|
|
772
|
-
title:
|
|
773
|
-
message:
|
|
774
|
-
confirmText:
|
|
775
|
-
cancelText:
|
|
797
|
+
async function te(t) {
|
|
798
|
+
await j({
|
|
799
|
+
title: r("panel.delete-title", { title: t.title }),
|
|
800
|
+
message: r("panel.delete-text"),
|
|
801
|
+
confirmText: r("panel.delete"),
|
|
802
|
+
cancelText: r("panel.cancel"),
|
|
776
803
|
tone: "danger"
|
|
777
|
-
}) && await
|
|
804
|
+
}) && await G(() => a.remove(t.id), r("panel.deleted"));
|
|
778
805
|
}
|
|
779
|
-
async function
|
|
780
|
-
await
|
|
806
|
+
async function ve(t) {
|
|
807
|
+
await G(() => a.restore(t.id), r("panel.restored"));
|
|
781
808
|
}
|
|
782
|
-
async function
|
|
809
|
+
async function G(t, m) {
|
|
783
810
|
try {
|
|
784
|
-
await t(), S.success(
|
|
811
|
+
await t(), S.success(m);
|
|
785
812
|
} catch (v) {
|
|
786
|
-
S.danger(
|
|
813
|
+
S.danger(W(v));
|
|
787
814
|
} finally {
|
|
788
|
-
await
|
|
815
|
+
await L();
|
|
789
816
|
}
|
|
790
817
|
}
|
|
791
|
-
async function
|
|
818
|
+
async function U(t) {
|
|
792
819
|
if (t.url)
|
|
793
820
|
try {
|
|
794
|
-
await navigator.clipboard.writeText(t.url), S.success(
|
|
821
|
+
await navigator.clipboard.writeText(t.url), S.success(r("panel.address-copied"));
|
|
795
822
|
} catch {
|
|
796
823
|
}
|
|
797
824
|
}
|
|
798
|
-
function
|
|
825
|
+
function J(t) {
|
|
799
826
|
return t === "published" || t === "modified" ? "success" : "default";
|
|
800
827
|
}
|
|
801
|
-
function
|
|
802
|
-
return
|
|
828
|
+
function pe(t) {
|
|
829
|
+
return p.value ? "—" : t.path === null ? r("panel.no-address") : `/${t.path}`;
|
|
803
830
|
}
|
|
804
|
-
const
|
|
805
|
-
() =>
|
|
806
|
-
|
|
831
|
+
const he = y(
|
|
832
|
+
() => V.value ? [{ key: "new", label: r("panel.new"), icon: "plus", primary: !0, run: () => {
|
|
833
|
+
R();
|
|
807
834
|
} }] : []
|
|
808
835
|
);
|
|
809
|
-
return (t,
|
|
810
|
-
|
|
811
|
-
view:
|
|
812
|
-
"onUpdate:view":
|
|
813
|
-
title:
|
|
814
|
-
views:
|
|
815
|
-
actions:
|
|
836
|
+
return (t, m) => (d(), B("div", Nt, [
|
|
837
|
+
h(e(Ge), {
|
|
838
|
+
view: f.value,
|
|
839
|
+
"onUpdate:view": m[2] || (m[2] = (v) => f.value = v),
|
|
840
|
+
title: n.value,
|
|
841
|
+
views: K.value,
|
|
842
|
+
actions: he.value,
|
|
816
843
|
padding: "sm"
|
|
817
844
|
}, {
|
|
818
|
-
default:
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
modelValue:
|
|
822
|
-
"onUpdate:modelValue":
|
|
845
|
+
default: c(() => [
|
|
846
|
+
A("div", At, [
|
|
847
|
+
h(e(Ie), {
|
|
848
|
+
modelValue: F.value,
|
|
849
|
+
"onUpdate:modelValue": m[0] || (m[0] = (v) => F.value = v),
|
|
823
850
|
class: "wx-services__search",
|
|
824
851
|
size: "sm",
|
|
825
852
|
clearable: "",
|
|
826
|
-
placeholder: e(
|
|
827
|
-
"aria-label": e(
|
|
853
|
+
placeholder: e(r)("panel.search"),
|
|
854
|
+
"aria-label": e(r)("panel.search")
|
|
828
855
|
}, {
|
|
829
|
-
prefix:
|
|
830
|
-
|
|
856
|
+
prefix: c(() => [
|
|
857
|
+
h(e(_e), {
|
|
831
858
|
name: "search",
|
|
832
859
|
size: "sm"
|
|
833
860
|
})
|
|
834
861
|
]),
|
|
835
862
|
_: 1
|
|
836
863
|
}, 8, ["modelValue", "placeholder", "aria-label"]),
|
|
837
|
-
|
|
864
|
+
h(e(mt), {
|
|
838
865
|
class: "wx-services__category",
|
|
839
|
-
"model-value":
|
|
840
|
-
options:
|
|
841
|
-
placeholder: e(
|
|
842
|
-
"aria-label": e(
|
|
866
|
+
"model-value": z.value,
|
|
867
|
+
options: x.value.map((v) => ({ value: v.id, label: v.title })),
|
|
868
|
+
placeholder: e(r)("panel.any-category"),
|
|
869
|
+
"aria-label": e(r)("panel.filter-category"),
|
|
843
870
|
clearable: "",
|
|
844
871
|
size: "sm",
|
|
845
|
-
"onUpdate:modelValue":
|
|
872
|
+
"onUpdate:modelValue": P
|
|
846
873
|
}, null, 8, ["model-value", "options", "placeholder", "aria-label"])
|
|
847
874
|
]),
|
|
848
|
-
|
|
875
|
+
T.value && s.value.length === 0 ? (d(), k(e(ne), {
|
|
849
876
|
key: 0,
|
|
850
877
|
class: "wx-services__loading",
|
|
851
878
|
rows: 5
|
|
852
879
|
})) : s.value.length === 0 ? (d(), k(e(qe), {
|
|
853
880
|
key: 1,
|
|
854
|
-
title:
|
|
855
|
-
description:
|
|
856
|
-
}, null, 8, ["title", "description"])) : (d(),
|
|
857
|
-
|
|
881
|
+
title: q.value,
|
|
882
|
+
description: f.value === "" && E.value === "" && z.value === null ? e(r)("panel.empty-help") : void 0
|
|
883
|
+
}, null, 8, ["title", "description"])) : (d(), B(Y, { key: 2 }, [
|
|
884
|
+
h(e(bt), {
|
|
858
885
|
modelValue: s.value,
|
|
859
|
-
"onUpdate:modelValue":
|
|
860
|
-
class: ye(["wx-services__list", { "is-loading":
|
|
886
|
+
"onUpdate:modelValue": m[1] || (m[1] = (v) => s.value = v),
|
|
887
|
+
class: ye(["wx-services__list", { "is-loading": T.value }]),
|
|
861
888
|
plain: "",
|
|
862
889
|
"item-key": "id",
|
|
863
|
-
handle:
|
|
890
|
+
handle: Z.value ? "grip" : "row",
|
|
864
891
|
"item-label": (v) => v.title,
|
|
865
|
-
disabled: !
|
|
866
|
-
onMove:
|
|
892
|
+
disabled: !Z.value,
|
|
893
|
+
onMove: I
|
|
867
894
|
}, {
|
|
868
|
-
default:
|
|
869
|
-
(d(), k(
|
|
870
|
-
default:
|
|
871
|
-
|
|
895
|
+
default: c(({ item: v }) => [
|
|
896
|
+
(d(), k(at(p.value ? "div" : "router-link"), rt({ class: "wx-service-row" }, p.value ? {} : { to: { path: `${o.base}/${v.id}`, query: e(l).query } }), {
|
|
897
|
+
default: c(() => [
|
|
898
|
+
A("span", {
|
|
872
899
|
class: ye(["wx-service-row__cover", { "is-empty": !v.cover }])
|
|
873
900
|
}, [
|
|
874
|
-
v.cover?.thumb ? (d(),
|
|
901
|
+
v.cover?.thumb ? (d(), B("img", {
|
|
875
902
|
key: 0,
|
|
876
903
|
src: v.cover.thumb,
|
|
877
904
|
alt: "",
|
|
878
905
|
loading: "lazy"
|
|
879
|
-
}, null, 8,
|
|
906
|
+
}, null, 8, Bt)) : (d(), k(e(_e), {
|
|
880
907
|
key: 1,
|
|
881
908
|
name: "image",
|
|
882
909
|
size: "sm"
|
|
883
910
|
}))
|
|
884
911
|
], 2),
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
912
|
+
A("span", Ot, [
|
|
913
|
+
A("span", Pt, w(v.title), 1),
|
|
914
|
+
A("span", Dt, [
|
|
915
|
+
_(w(pe(v)), 1),
|
|
916
|
+
p.value ? D("", !0) : (d(), k(e(je), {
|
|
917
|
+
key: 0,
|
|
918
|
+
locale: v.address_locale
|
|
919
|
+
}, null, 8, ["locale"]))
|
|
920
|
+
])
|
|
888
921
|
]),
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
(d(!0),
|
|
892
|
-
key:
|
|
922
|
+
A("span", Mt, [
|
|
923
|
+
A("span", Lt, [
|
|
924
|
+
(d(!0), B(Y, null, $e(v.categories, (se, fe) => (d(), B(Y, {
|
|
925
|
+
key: se.id
|
|
893
926
|
}, [
|
|
894
|
-
fe === 0 ? (d(), k(e(
|
|
927
|
+
fe === 0 ? (d(), k(e(wt), {
|
|
895
928
|
key: 0,
|
|
896
|
-
content: e(
|
|
929
|
+
content: e(r)("panel.main-category")
|
|
897
930
|
}, {
|
|
898
|
-
default:
|
|
899
|
-
|
|
931
|
+
default: c(() => [
|
|
932
|
+
h(e(Q), {
|
|
900
933
|
size: "sm",
|
|
901
934
|
round: "",
|
|
902
935
|
type: "primary"
|
|
903
936
|
}, {
|
|
904
|
-
default:
|
|
905
|
-
_(w(
|
|
937
|
+
default: c(() => [
|
|
938
|
+
_(w(se.title), 1)
|
|
906
939
|
]),
|
|
907
940
|
_: 2
|
|
908
941
|
}, 1024)
|
|
909
942
|
]),
|
|
910
943
|
_: 2
|
|
911
|
-
}, 1032, ["content"])) : (d(), k(e(
|
|
944
|
+
}, 1032, ["content"])) : (d(), k(e(Q), {
|
|
912
945
|
key: 1,
|
|
913
946
|
size: "sm",
|
|
914
947
|
round: ""
|
|
915
948
|
}, {
|
|
916
|
-
default:
|
|
917
|
-
_(w(
|
|
949
|
+
default: c(() => [
|
|
950
|
+
_(w(se.title), 1)
|
|
918
951
|
]),
|
|
919
952
|
_: 2
|
|
920
953
|
}, 1024))
|
|
921
954
|
], 64))), 128))
|
|
922
955
|
]),
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
type:
|
|
956
|
+
A("span", Rt, [
|
|
957
|
+
h(e(Q), {
|
|
958
|
+
type: J(v.status),
|
|
926
959
|
dot: "",
|
|
927
960
|
size: "sm"
|
|
928
961
|
}, {
|
|
929
|
-
default:
|
|
930
|
-
_(w(e(
|
|
962
|
+
default: c(() => [
|
|
963
|
+
_(w(e(r)(`panel.status-${v.status}`)), 1)
|
|
931
964
|
]),
|
|
932
965
|
_: 2
|
|
933
966
|
}, 1032, ["type"]),
|
|
934
|
-
v.status === "modified" ? (d(), k(e(
|
|
967
|
+
v.status === "modified" ? (d(), k(e(Q), {
|
|
935
968
|
key: 0,
|
|
936
969
|
type: "primary",
|
|
937
970
|
size: "sm",
|
|
938
971
|
round: ""
|
|
939
972
|
}, {
|
|
940
|
-
default:
|
|
941
|
-
_(w(e(
|
|
973
|
+
default: c(() => [
|
|
974
|
+
_(w(e(r)("panel.edits")), 1)
|
|
942
975
|
]),
|
|
943
976
|
_: 1
|
|
944
|
-
})) :
|
|
977
|
+
})) : D("", !0)
|
|
945
978
|
])
|
|
946
979
|
])
|
|
947
980
|
]),
|
|
948
981
|
_: 2
|
|
949
982
|
}, 1040))
|
|
950
983
|
]),
|
|
951
|
-
actions:
|
|
952
|
-
|
|
953
|
-
actions:
|
|
984
|
+
actions: c(({ item: v }) => [
|
|
985
|
+
h(e(Je), {
|
|
986
|
+
actions: de(v),
|
|
954
987
|
label: v.title
|
|
955
988
|
}, null, 8, ["actions", "label"])
|
|
956
989
|
]),
|
|
957
990
|
_: 1
|
|
958
991
|
}, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
|
|
959
|
-
|
|
992
|
+
V.value && !p.value ? (d(), k(e(Ve), {
|
|
960
993
|
key: 0,
|
|
961
994
|
class: "wx-services__note",
|
|
962
995
|
type: "info",
|
|
963
|
-
description: e(
|
|
964
|
-
}, null, 8, ["description"])) :
|
|
996
|
+
description: e(N).hint.value
|
|
997
|
+
}, null, 8, ["description"])) : D("", !0)
|
|
965
998
|
], 64))
|
|
966
999
|
]),
|
|
967
1000
|
_: 1
|
|
968
1001
|
}, 8, ["view", "title", "views", "actions"])
|
|
969
1002
|
]));
|
|
970
1003
|
}
|
|
971
|
-
}),
|
|
972
|
-
function
|
|
1004
|
+
}), Ht = /* @__PURE__ */ be(Ut, [["__scopeId", "data-v-b32f9ad4"]]);
|
|
1005
|
+
function Ft(u = "/services") {
|
|
973
1006
|
return {
|
|
974
1007
|
api: "services/categories",
|
|
975
|
-
path: `${
|
|
1008
|
+
path: `${u}/categories`,
|
|
976
1009
|
name: "webx.services.categories",
|
|
977
1010
|
module: "service-categories",
|
|
978
1011
|
screen: "services.category-form",
|
|
979
1012
|
manage: "services.categories.manage",
|
|
980
1013
|
count: "services_count",
|
|
981
1014
|
// The list narrowed to one category is also where its own order is dragged.
|
|
982
|
-
items: (
|
|
1015
|
+
items: (o) => ({ path: u, query: { category: String(o) } }),
|
|
983
1016
|
words: {
|
|
984
1017
|
new: "webx-services::category.new",
|
|
985
1018
|
empty: "webx-services::category.empty",
|
|
@@ -999,19 +1032,19 @@ function Lt(c = "/services") {
|
|
|
999
1032
|
}
|
|
1000
1033
|
};
|
|
1001
1034
|
}
|
|
1002
|
-
function
|
|
1003
|
-
const
|
|
1035
|
+
function Xt(u = {}) {
|
|
1036
|
+
const o = u.path ?? "/services";
|
|
1004
1037
|
return [
|
|
1005
1038
|
{
|
|
1006
1039
|
id: "services",
|
|
1007
|
-
path:
|
|
1040
|
+
path: o,
|
|
1008
1041
|
routes: [
|
|
1009
|
-
{ path:
|
|
1042
|
+
{ path: o, name: "webx.services", component: Ht, props: { base: o } },
|
|
1010
1043
|
{
|
|
1011
|
-
path: `${
|
|
1044
|
+
path: `${o}/:id(\\d+)`,
|
|
1012
1045
|
name: "webx.services.edit",
|
|
1013
|
-
component:
|
|
1014
|
-
props: { base:
|
|
1046
|
+
component: Wt,
|
|
1047
|
+
props: { base: o }
|
|
1015
1048
|
}
|
|
1016
1049
|
],
|
|
1017
1050
|
/*
|
|
@@ -1020,28 +1053,28 @@ function Gt(c = {}) {
|
|
|
1020
1053
|
* particular is shared, and reads the prefix from the editor hosting the screen.
|
|
1021
1054
|
*/
|
|
1022
1055
|
types: {
|
|
1023
|
-
"wx-service-history": { component:
|
|
1056
|
+
"wx-service-history": { component: zt, kind: "display" }
|
|
1024
1057
|
}
|
|
1025
1058
|
},
|
|
1026
1059
|
{
|
|
1027
1060
|
id: "service-categories",
|
|
1028
|
-
path: `${
|
|
1029
|
-
routes:
|
|
1061
|
+
path: `${o}/categories`,
|
|
1062
|
+
routes: Qe(Ft(o))
|
|
1030
1063
|
}
|
|
1031
1064
|
];
|
|
1032
1065
|
}
|
|
1033
1066
|
export {
|
|
1034
1067
|
ge as SERVICES_API,
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1068
|
+
Et as WxServiceCreateDialog,
|
|
1069
|
+
Wt as WxServiceEditorPage,
|
|
1070
|
+
zt as WxServiceHistory,
|
|
1071
|
+
Ht as WxServicesPage,
|
|
1072
|
+
ce as createServicesApi,
|
|
1073
|
+
xt as provideServiceEditor,
|
|
1074
|
+
Ft as serviceCategoriesOptions,
|
|
1042
1075
|
ze as serviceEditorKey,
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1076
|
+
Xt as services,
|
|
1077
|
+
kt as servicesMessages,
|
|
1078
|
+
_t as useServiceEditor
|
|
1046
1079
|
};
|
|
1047
1080
|
//# sourceMappingURL=index.js.map
|