@webx-ui/module-auth 0.9.3 → 0.10.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/dist/index.js +632 -610
- package/dist/index.js.map +1 -1
- package/dist/session.d.ts +5 -0
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { inject as ye, defineComponent as Q, computed as
|
|
2
|
-
import { useTranslate as
|
|
1
|
+
import { inject as ye, defineComponent as Q, computed as T, ref as z, useTemplateRef as ue, onBeforeUnmount as Ze, resolveComponent as H, openBlock as h, createBlock as $, withCtx as t, createVNode as a, withModifiers as Fe, createCommentVNode as E, createElementVNode as V, createTextVNode as d, toDisplayString as o, watch as ce, unref as e, isRef as ge, normalizeClass as Re, createElementBlock as Y, resolveDynamicComponent as Be, createSlots as we, Fragment as ie, renderList as _e, onMounted as et, h as Oe } from "vue";
|
|
2
|
+
import { useTranslate as j, HttpError as tt, useAdmin as Z, useI18n as Ee, useErrorText as me, rowMenuWidth as at, WxDate as re, WxRowMenu as Se, WxFilterChips as De, WxListScreen as Me, WxScreen as lt, useTheme as nt } from "@webx-ui/module-admin";
|
|
3
3
|
import { useRouter as st, useRoute as ot } from "vue-router";
|
|
4
|
-
import { useModal as xe, WxDialog as ke, WxFormItem as
|
|
4
|
+
import { useModal as xe, WxDialog as ke, WxFormItem as K, WxInput as le, WxSelect as ne, WxSpace as se, WxCheckbox as Le, WxText as O, WxButton as N, toast as G, useElementWidth as Ce, WxTable as $e, WxEntityCard as Ae, WxBadge as J, WxAvatar as it, WxIcon as ee, confirm as Ne, createModal as Ve, WxHeading as de, WxCard as be, WxSkeleton as rt, WxTabs as ut, WxTab as fe, WxAlert as ct, WxThemeSwitch as dt } from "@webx-ui/core";
|
|
5
5
|
const Ie = /* @__PURE__ */ Symbol("webx-auth");
|
|
6
6
|
function ze() {
|
|
7
7
|
const n = ye(Ie, null);
|
|
@@ -10,11 +10,11 @@ function ze() {
|
|
|
10
10
|
return n;
|
|
11
11
|
}
|
|
12
12
|
function mt(n) {
|
|
13
|
-
const
|
|
13
|
+
const u = `${n.apiPath}/auth`;
|
|
14
14
|
return {
|
|
15
15
|
async me() {
|
|
16
16
|
try {
|
|
17
|
-
return (await n.http.get(`${
|
|
17
|
+
return (await n.http.get(`${u}/me`)).data;
|
|
18
18
|
} catch (l) {
|
|
19
19
|
if (pt(l))
|
|
20
20
|
return null;
|
|
@@ -22,7 +22,7 @@ function mt(n) {
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
async login(l) {
|
|
25
|
-
const s = await n.http.post(`${
|
|
25
|
+
const s = await n.http.post(`${u}/login`, {
|
|
26
26
|
email: l.email,
|
|
27
27
|
password: l.password,
|
|
28
28
|
remember: l.remember ?? !1
|
|
@@ -30,25 +30,29 @@ function mt(n) {
|
|
|
30
30
|
return n.setUser(s.data), await n.reload(), s.data;
|
|
31
31
|
},
|
|
32
32
|
async setLocale(l) {
|
|
33
|
-
const s = await n.http.put(`${
|
|
33
|
+
const s = await n.http.put(`${u}/locale`, { locale: l });
|
|
34
34
|
n.setUser(s.data), await n.setLocale(l);
|
|
35
35
|
},
|
|
36
36
|
async setTheme(l) {
|
|
37
|
-
const s = await n.http.put(`${
|
|
37
|
+
const s = await n.http.put(`${u}/theme`, {
|
|
38
38
|
theme: l === "system" ? null : l
|
|
39
39
|
});
|
|
40
40
|
n.setUser(s.data);
|
|
41
41
|
},
|
|
42
|
+
async setSiteBar(l) {
|
|
43
|
+
const s = await n.http.put(`${u}/site-bar`, { enabled: l });
|
|
44
|
+
n.setUser(s.data);
|
|
45
|
+
},
|
|
42
46
|
async updateProfile(l) {
|
|
43
47
|
const s = await n.http.put(
|
|
44
|
-
`${
|
|
48
|
+
`${u}/me`,
|
|
45
49
|
l
|
|
46
50
|
);
|
|
47
51
|
return n.setUser(s.data), s.data;
|
|
48
52
|
},
|
|
49
53
|
async logout() {
|
|
50
54
|
try {
|
|
51
|
-
await n.http.post(`${
|
|
55
|
+
await n.http.post(`${u}/logout`);
|
|
52
56
|
} finally {
|
|
53
57
|
n.setUser(null), n.state.status = "unauthenticated", n.state.manifest = null;
|
|
54
58
|
}
|
|
@@ -56,8 +60,8 @@ function mt(n) {
|
|
|
56
60
|
};
|
|
57
61
|
}
|
|
58
62
|
const qe = /* @__PURE__ */ Symbol("webx-auth-avatar"), He = /* @__PURE__ */ Symbol("webx-auth-avatar-field");
|
|
59
|
-
function vt(n,
|
|
60
|
-
n.provide(Ie,
|
|
63
|
+
function vt(n, u, l = null, s = null) {
|
|
64
|
+
n.provide(Ie, u), n.provide(qe, l), n.provide(He, s);
|
|
61
65
|
}
|
|
62
66
|
function pt(n) {
|
|
63
67
|
return typeof n == "object" && n !== null && "status" in n && n.status === 401;
|
|
@@ -77,8 +81,8 @@ const ft = ["title", "aria-label", "aria-pressed"], ht = /* @__PURE__ */ Q({
|
|
|
77
81
|
autofocus: { type: Boolean, default: !0 }
|
|
78
82
|
},
|
|
79
83
|
emits: ["success"],
|
|
80
|
-
setup(n, { expose:
|
|
81
|
-
const s = n, g = l, c = ze(), A =
|
|
84
|
+
setup(n, { expose: u, emit: l }) {
|
|
85
|
+
const s = n, g = l, c = ze(), A = j("webx-auth"), r = T(() => ({
|
|
82
86
|
email: s.emailLabel ?? A("card.email"),
|
|
83
87
|
password: s.passwordLabel ?? A("card.password"),
|
|
84
88
|
remember: s.rememberLabel ?? A("card.remember"),
|
|
@@ -86,29 +90,29 @@ const ft = ["title", "aria-label", "aria-pressed"], ht = /* @__PURE__ */ Q({
|
|
|
86
90
|
capsLock: s.capsLockWarning ?? A("card.caps-lock"),
|
|
87
91
|
reveal: s.revealLabel ?? A("card.reveal"),
|
|
88
92
|
hide: s.hideLabel ?? A("card.hide")
|
|
89
|
-
})), m =
|
|
90
|
-
let
|
|
91
|
-
Ze(
|
|
92
|
-
const
|
|
93
|
-
() => s.throttleMessage === void 0 ? A("card.throttled", { seconds:
|
|
93
|
+
})), m = z(""), U = z(""), p = z(!1), w = z(!1), x = z(!1), f = z(!1), y = z(""), v = z({}), _ = z(0), P = ue("emailField");
|
|
94
|
+
let W = null;
|
|
95
|
+
Ze(D);
|
|
96
|
+
const F = T(() => _.value > 0), i = T(
|
|
97
|
+
() => s.throttleMessage === void 0 ? A("card.throttled", { seconds: _.value }) : s.throttleMessage.replace(":seconds", String(_.value))
|
|
94
98
|
);
|
|
95
|
-
async function
|
|
96
|
-
if (!(w.value ||
|
|
99
|
+
async function b() {
|
|
100
|
+
if (!(w.value || F.value)) {
|
|
97
101
|
w.value = !0, y.value = "", v.value = {};
|
|
98
102
|
try {
|
|
99
103
|
await c.login({
|
|
100
104
|
email: m.value,
|
|
101
|
-
password:
|
|
105
|
+
password: U.value,
|
|
102
106
|
remember: p.value
|
|
103
|
-
}),
|
|
107
|
+
}), U.value = "", g("success");
|
|
104
108
|
} catch (k) {
|
|
105
|
-
|
|
109
|
+
L(k);
|
|
106
110
|
} finally {
|
|
107
111
|
w.value = !1;
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
|
-
function
|
|
115
|
+
function L(k) {
|
|
112
116
|
if (!(k instanceof tt)) {
|
|
113
117
|
y.value = k instanceof Error ? k.message : String(k);
|
|
114
118
|
return;
|
|
@@ -118,24 +122,24 @@ const ft = ["title", "aria-label", "aria-pressed"], ht = /* @__PURE__ */ Q({
|
|
|
118
122
|
return;
|
|
119
123
|
}
|
|
120
124
|
if (k.isThrottled) {
|
|
121
|
-
|
|
125
|
+
I(k.retryAfter ?? 60);
|
|
122
126
|
return;
|
|
123
127
|
}
|
|
124
128
|
y.value = k.message;
|
|
125
129
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
function I(k) {
|
|
131
|
+
D(), _.value = k, W = setInterval(() => {
|
|
132
|
+
_.value -= 1, _.value <= 0 && D();
|
|
129
133
|
}, 1e3);
|
|
130
134
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
135
|
+
function D() {
|
|
136
|
+
W !== null && (clearInterval(W), W = null), _.value = 0;
|
|
133
137
|
}
|
|
134
|
-
function
|
|
138
|
+
function q(k) {
|
|
135
139
|
f.value = k.getModifierState("CapsLock");
|
|
136
140
|
}
|
|
137
|
-
return
|
|
138
|
-
const C =
|
|
141
|
+
return u({ focus: () => P.value?.focus() }), (k, R) => {
|
|
142
|
+
const C = H("wx-alert"), X = H("wx-icon"), pe = H("wx-input"), B = H("wx-form-item"), M = H("wx-checkbox"), S = H("wx-button"), ae = H("wx-form"), Xe = H("wx-card");
|
|
139
143
|
return h(), $(Xe, {
|
|
140
144
|
class: "wx-login",
|
|
141
145
|
padding: 24
|
|
@@ -145,7 +149,7 @@ const ft = ["title", "aria-label", "aria-pressed"], ht = /* @__PURE__ */ Q({
|
|
|
145
149
|
errors: v.value,
|
|
146
150
|
disabled: w.value,
|
|
147
151
|
gap: "md",
|
|
148
|
-
onSubmit: Fe(
|
|
152
|
+
onSubmit: Fe(b, ["prevent"])
|
|
149
153
|
}, {
|
|
150
154
|
default: t(() => [
|
|
151
155
|
y.value !== "" ? (h(), $(C, {
|
|
@@ -155,24 +159,24 @@ const ft = ["title", "aria-label", "aria-pressed"], ht = /* @__PURE__ */ Q({
|
|
|
155
159
|
live: "",
|
|
156
160
|
description: y.value,
|
|
157
161
|
class: "wx-login__message"
|
|
158
|
-
}, null, 8, ["description"])) :
|
|
162
|
+
}, null, 8, ["description"])) : F.value ? (h(), $(C, {
|
|
159
163
|
key: 1,
|
|
160
164
|
type: "warning",
|
|
161
165
|
variant: "soft",
|
|
162
166
|
live: "",
|
|
163
|
-
description:
|
|
167
|
+
description: i.value,
|
|
164
168
|
class: "wx-login__message"
|
|
165
|
-
}, null, 8, ["description"])) :
|
|
166
|
-
a(
|
|
169
|
+
}, null, 8, ["description"])) : E("", !0),
|
|
170
|
+
a(B, { name: "email" }, {
|
|
167
171
|
default: t(() => [
|
|
168
172
|
a(pe, {
|
|
169
173
|
ref_key: "emailField",
|
|
170
|
-
ref:
|
|
174
|
+
ref: P,
|
|
171
175
|
modelValue: m.value,
|
|
172
|
-
"onUpdate:modelValue":
|
|
176
|
+
"onUpdate:modelValue": R[0] || (R[0] = (oe) => m.value = oe),
|
|
173
177
|
type: "email",
|
|
174
|
-
placeholder:
|
|
175
|
-
"aria-label":
|
|
178
|
+
placeholder: r.value.email,
|
|
179
|
+
"aria-label": r.value.email,
|
|
176
180
|
autocomplete: "username",
|
|
177
181
|
autofocus: n.autofocus,
|
|
178
182
|
inputmode: "email",
|
|
@@ -186,34 +190,34 @@ const ft = ["title", "aria-label", "aria-pressed"], ht = /* @__PURE__ */ Q({
|
|
|
186
190
|
]),
|
|
187
191
|
_: 1
|
|
188
192
|
}),
|
|
189
|
-
a(
|
|
193
|
+
a(B, {
|
|
190
194
|
name: "password",
|
|
191
|
-
help: f.value ?
|
|
195
|
+
help: f.value ? r.value.capsLock : void 0
|
|
192
196
|
}, {
|
|
193
197
|
default: t(() => [
|
|
194
198
|
a(pe, {
|
|
195
|
-
modelValue:
|
|
196
|
-
"onUpdate:modelValue":
|
|
199
|
+
modelValue: U.value,
|
|
200
|
+
"onUpdate:modelValue": R[2] || (R[2] = (oe) => U.value = oe),
|
|
197
201
|
type: x.value ? "text" : "password",
|
|
198
|
-
placeholder:
|
|
199
|
-
"aria-label":
|
|
202
|
+
placeholder: r.value.password,
|
|
203
|
+
"aria-label": r.value.password,
|
|
200
204
|
autocomplete: "current-password",
|
|
201
205
|
size: "lg",
|
|
202
|
-
onKeydown:
|
|
203
|
-
onKeyup:
|
|
206
|
+
onKeydown: q,
|
|
207
|
+
onKeyup: q
|
|
204
208
|
}, {
|
|
205
209
|
prefix: t(() => [
|
|
206
210
|
a(X, { name: "lock" })
|
|
207
211
|
]),
|
|
208
212
|
suffix: t(() => [
|
|
209
|
-
|
|
213
|
+
V("button", {
|
|
210
214
|
type: "button",
|
|
211
215
|
class: "wx-login__reveal",
|
|
212
|
-
title: x.value ?
|
|
213
|
-
"aria-label": x.value ?
|
|
216
|
+
title: x.value ? r.value.hide : r.value.reveal,
|
|
217
|
+
"aria-label": x.value ? r.value.hide : r.value.reveal,
|
|
214
218
|
"aria-pressed": x.value,
|
|
215
219
|
tabindex: "-1",
|
|
216
|
-
onClick:
|
|
220
|
+
onClick: R[1] || (R[1] = (oe) => x.value = !x.value)
|
|
217
221
|
}, [
|
|
218
222
|
a(X, {
|
|
219
223
|
name: x.value ? "eye-off" : "eye"
|
|
@@ -228,20 +232,20 @@ const ft = ["title", "aria-label", "aria-pressed"], ht = /* @__PURE__ */ Q({
|
|
|
228
232
|
n.remember ? (h(), $(M, {
|
|
229
233
|
key: 2,
|
|
230
234
|
modelValue: p.value,
|
|
231
|
-
"onUpdate:modelValue":
|
|
232
|
-
label:
|
|
235
|
+
"onUpdate:modelValue": R[3] || (R[3] = (oe) => p.value = oe),
|
|
236
|
+
label: r.value.remember,
|
|
233
237
|
class: "wx-login__remember"
|
|
234
|
-
}, null, 8, ["modelValue", "label"])) :
|
|
235
|
-
a(
|
|
238
|
+
}, null, 8, ["modelValue", "label"])) : E("", !0),
|
|
239
|
+
a(S, {
|
|
236
240
|
type: "primary",
|
|
237
241
|
"native-type": "submit",
|
|
238
242
|
size: "lg",
|
|
239
243
|
block: "",
|
|
240
244
|
loading: w.value,
|
|
241
|
-
disabled:
|
|
245
|
+
disabled: F.value
|
|
242
246
|
}, {
|
|
243
247
|
default: t(() => [
|
|
244
|
-
d(o(
|
|
248
|
+
d(o(r.value.submit), 1)
|
|
245
249
|
]),
|
|
246
250
|
_: 1
|
|
247
251
|
}, 8, ["loading", "disabled"])
|
|
@@ -253,9 +257,9 @@ const ft = ["title", "aria-label", "aria-pressed"], ht = /* @__PURE__ */ Q({
|
|
|
253
257
|
});
|
|
254
258
|
};
|
|
255
259
|
}
|
|
256
|
-
}), ve = (n,
|
|
260
|
+
}), ve = (n, u) => {
|
|
257
261
|
const l = n.__vccOpts || n;
|
|
258
|
-
for (const [s, g] of
|
|
262
|
+
for (const [s, g] of u)
|
|
259
263
|
l[s] = g;
|
|
260
264
|
return l;
|
|
261
265
|
}, yt = /* @__PURE__ */ ve(ht, [["__scopeId", "data-v-3c206e31"]]);
|
|
@@ -263,8 +267,8 @@ function Ke(n) {
|
|
|
263
267
|
return n.types["wx-media"]?.component ?? null;
|
|
264
268
|
}
|
|
265
269
|
function Ye(n) {
|
|
266
|
-
const
|
|
267
|
-
return
|
|
270
|
+
const u = n.assetUrls;
|
|
271
|
+
return u ? async (l) => (await u([l]))[l] ?? null : null;
|
|
268
272
|
}
|
|
269
273
|
const je = {
|
|
270
274
|
card: {
|
|
@@ -432,13 +436,14 @@ const je = {
|
|
|
432
436
|
},
|
|
433
437
|
menu: {
|
|
434
438
|
"sign-out": "Sign out",
|
|
435
|
-
language: "Interface language"
|
|
439
|
+
language: "Interface language",
|
|
440
|
+
"site-bar": "Panel on the site"
|
|
436
441
|
}
|
|
437
442
|
};
|
|
438
443
|
function he(n) {
|
|
439
|
-
const
|
|
444
|
+
const u = `${n.apiPath}/auth`, l = (s) => s.data;
|
|
440
445
|
return {
|
|
441
|
-
list: (s = {}) => n.http.get(`${
|
|
446
|
+
list: (s = {}) => n.http.get(`${u}/admins`, {
|
|
442
447
|
query: {
|
|
443
448
|
q: s.q || void 0,
|
|
444
449
|
role: s.role ?? void 0,
|
|
@@ -448,12 +453,12 @@ function he(n) {
|
|
|
448
453
|
per_page: s.per_page
|
|
449
454
|
}
|
|
450
455
|
}).then((g) => ({ ...g.meta, data: g.data })),
|
|
451
|
-
get: (s) => n.http.get(`${
|
|
452
|
-
create: (s) => n.http.post(`${
|
|
453
|
-
update: (s, g) => n.http.patch(`${
|
|
454
|
-
remove: (s) => n.http.delete(`${
|
|
455
|
-
roles: () => n.http.get(`${
|
|
456
|
-
calls: (s = {}) => n.http.get(`${
|
|
456
|
+
get: (s) => n.http.get(`${u}/admins/${s}`).then(l),
|
|
457
|
+
create: (s) => n.http.post(`${u}/admins`, s).then(l),
|
|
458
|
+
update: (s, g) => n.http.patch(`${u}/admins/${s}`, g).then(l),
|
|
459
|
+
remove: (s) => n.http.delete(`${u}/admins/${s}`),
|
|
460
|
+
roles: () => n.http.get(`${u}/roles`).then(l),
|
|
461
|
+
calls: (s = {}) => n.http.get(`${u}/mcp-calls`, {
|
|
457
462
|
query: {
|
|
458
463
|
user: s.user ?? void 0,
|
|
459
464
|
tool: s.tool ?? void 0,
|
|
@@ -482,9 +487,9 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
482
487
|
avatarField: { default: void 0 }
|
|
483
488
|
},
|
|
484
489
|
setup(n) {
|
|
485
|
-
const
|
|
490
|
+
const u = n, { resolve: l, dismiss: s, open: g } = xe(), c = Z(), A = he(c), r = Ee();
|
|
486
491
|
te();
|
|
487
|
-
const m =
|
|
492
|
+
const m = j("webx-auth"), U = me(), p = z([]), w = z(!1), x = z({}), f = z({
|
|
488
493
|
name: "",
|
|
489
494
|
email: "",
|
|
490
495
|
password: "",
|
|
@@ -493,37 +498,37 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
493
498
|
is_super: !1,
|
|
494
499
|
locale: null,
|
|
495
500
|
roles: []
|
|
496
|
-
}), y =
|
|
501
|
+
}), y = T({
|
|
497
502
|
get: () => f.value.avatar ? { path: f.value.avatar } : null,
|
|
498
|
-
set: (
|
|
499
|
-
f.value.avatar =
|
|
503
|
+
set: (i) => {
|
|
504
|
+
f.value.avatar = i?.path ?? null;
|
|
500
505
|
}
|
|
501
|
-
}), v =
|
|
506
|
+
}), v = T(() => u.admin !== null), _ = T(() => p.value.map((i) => ({ value: i.id, label: i.name }))), P = T(() => [
|
|
502
507
|
{ value: "auto", label: m("admins.locale-auto") },
|
|
503
|
-
...
|
|
508
|
+
...r.state.panelLocales.map((i) => ({ value: i.code, label: i.nativeName }))
|
|
504
509
|
]);
|
|
505
|
-
A.roles().then((
|
|
506
|
-
() =>
|
|
507
|
-
(
|
|
510
|
+
A.roles().then((i) => p.value = i), ce(
|
|
511
|
+
() => u.admin,
|
|
512
|
+
(i) => {
|
|
508
513
|
f.value = {
|
|
509
|
-
name:
|
|
510
|
-
email:
|
|
514
|
+
name: i?.name ?? "",
|
|
515
|
+
email: i?.email ?? "",
|
|
511
516
|
password: "",
|
|
512
|
-
avatar:
|
|
513
|
-
is_active:
|
|
514
|
-
is_super:
|
|
515
|
-
locale:
|
|
516
|
-
roles:
|
|
517
|
+
avatar: i?.avatar ?? null,
|
|
518
|
+
is_active: i?.is_active ?? !0,
|
|
519
|
+
is_super: i?.is_super ?? !1,
|
|
520
|
+
locale: i?.locale ?? "auto",
|
|
521
|
+
roles: i?.roles.map((b) => b.id) ?? []
|
|
517
522
|
}, x.value = {};
|
|
518
523
|
},
|
|
519
524
|
{ immediate: !0 }
|
|
520
525
|
);
|
|
521
|
-
function
|
|
522
|
-
return x.value[
|
|
526
|
+
function W(i) {
|
|
527
|
+
return x.value[i]?.[0];
|
|
523
528
|
}
|
|
524
|
-
async function
|
|
529
|
+
async function F() {
|
|
525
530
|
w.value = !0, x.value = {};
|
|
526
|
-
const
|
|
531
|
+
const i = {
|
|
527
532
|
name: f.value.name,
|
|
528
533
|
email: f.value.email,
|
|
529
534
|
avatar: f.value.avatar,
|
|
@@ -532,39 +537,39 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
532
537
|
locale: f.value.locale === "auto" ? null : f.value.locale,
|
|
533
538
|
roles: f.value.roles ?? []
|
|
534
539
|
};
|
|
535
|
-
f.value.password && (
|
|
540
|
+
f.value.password && (i.password = f.value.password);
|
|
536
541
|
try {
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
} catch (
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
+
const b = u.admin ? await A.update(u.admin.id, i) : await A.create(i);
|
|
543
|
+
G.success(m(v.value ? "admins.updated" : "admins.created")), l(b);
|
|
544
|
+
} catch (b) {
|
|
545
|
+
const L = b.body;
|
|
546
|
+
L?.errors ? x.value = L.errors : G.danger(U(b));
|
|
542
547
|
} finally {
|
|
543
548
|
w.value = !1;
|
|
544
549
|
}
|
|
545
550
|
}
|
|
546
|
-
return (
|
|
551
|
+
return (i, b) => (h(), $(e(ke), {
|
|
547
552
|
open: e(g),
|
|
548
|
-
"onUpdate:open":
|
|
553
|
+
"onUpdate:open": b[9] || (b[9] = (L) => ge(g) ? g.value = L : null),
|
|
549
554
|
title: v.value ? e(m)("admins.edit-short") : e(m)("admins.new-short"),
|
|
550
555
|
width: 720
|
|
551
556
|
}, {
|
|
552
557
|
footer: t(() => [
|
|
553
558
|
a(e(se), { size: "sm" }, {
|
|
554
559
|
default: t(() => [
|
|
555
|
-
a(e(
|
|
560
|
+
a(e(N), {
|
|
556
561
|
variant: "outline",
|
|
557
|
-
onClick:
|
|
562
|
+
onClick: b[8] || (b[8] = (L) => e(s)())
|
|
558
563
|
}, {
|
|
559
564
|
default: t(() => [
|
|
560
565
|
d(o(e(m)("admins.cancel")), 1)
|
|
561
566
|
]),
|
|
562
567
|
_: 1
|
|
563
568
|
}),
|
|
564
|
-
a(e(
|
|
569
|
+
a(e(N), {
|
|
565
570
|
type: "primary",
|
|
566
571
|
loading: w.value,
|
|
567
|
-
onClick:
|
|
572
|
+
onClick: F
|
|
568
573
|
}, {
|
|
569
574
|
default: t(() => [
|
|
570
575
|
d(o(e(m)("admins.save")), 1)
|
|
@@ -576,41 +581,41 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
576
581
|
})
|
|
577
582
|
]),
|
|
578
583
|
default: t(() => [
|
|
579
|
-
|
|
580
|
-
|
|
584
|
+
V("div", _t, [
|
|
585
|
+
V("div", {
|
|
581
586
|
class: Re(["wx-admin-form__grid", { "has-aside": n.avatarField }])
|
|
582
587
|
}, [
|
|
583
588
|
n.avatarField ? (h(), Y("div", bt, [
|
|
584
|
-
(h(), $(
|
|
589
|
+
(h(), $(Be(n.avatarField), {
|
|
585
590
|
modelValue: y.value,
|
|
586
|
-
"onUpdate:modelValue":
|
|
591
|
+
"onUpdate:modelValue": b[0] || (b[0] = (L) => y.value = L),
|
|
587
592
|
label: e(m)("admins.avatar"),
|
|
588
593
|
aspect: "1/1",
|
|
589
594
|
captions: !1
|
|
590
595
|
}, null, 8, ["modelValue", "label"]))
|
|
591
|
-
])) :
|
|
592
|
-
|
|
593
|
-
a(e(
|
|
596
|
+
])) : E("", !0),
|
|
597
|
+
V("div", gt, [
|
|
598
|
+
a(e(K), {
|
|
594
599
|
label: e(m)("admins.name"),
|
|
595
|
-
error:
|
|
600
|
+
error: W("name")
|
|
596
601
|
}, {
|
|
597
602
|
default: t(() => [
|
|
598
603
|
a(e(le), {
|
|
599
604
|
modelValue: f.value.name,
|
|
600
|
-
"onUpdate:modelValue":
|
|
605
|
+
"onUpdate:modelValue": b[1] || (b[1] = (L) => f.value.name = L),
|
|
601
606
|
name: "name"
|
|
602
607
|
}, null, 8, ["modelValue"])
|
|
603
608
|
]),
|
|
604
609
|
_: 1
|
|
605
610
|
}, 8, ["label", "error"]),
|
|
606
|
-
a(e(
|
|
611
|
+
a(e(K), {
|
|
607
612
|
label: e(m)("admins.email"),
|
|
608
|
-
error:
|
|
613
|
+
error: W("email")
|
|
609
614
|
}, {
|
|
610
615
|
default: t(() => [
|
|
611
616
|
a(e(le), {
|
|
612
617
|
modelValue: f.value.email,
|
|
613
|
-
"onUpdate:modelValue":
|
|
618
|
+
"onUpdate:modelValue": b[2] || (b[2] = (L) => f.value.email = L),
|
|
614
619
|
type: "email",
|
|
615
620
|
name: "email",
|
|
616
621
|
autocomplete: "off"
|
|
@@ -618,15 +623,15 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
618
623
|
]),
|
|
619
624
|
_: 1
|
|
620
625
|
}, 8, ["label", "error"]),
|
|
621
|
-
a(e(
|
|
626
|
+
a(e(K), {
|
|
622
627
|
label: e(m)("admins.password"),
|
|
623
|
-
error:
|
|
628
|
+
error: W("password"),
|
|
624
629
|
help: v.value ? e(m)("admins.password-keep") : e(m)("admins.password-hint")
|
|
625
630
|
}, {
|
|
626
631
|
default: t(() => [
|
|
627
632
|
a(e(le), {
|
|
628
633
|
modelValue: f.value.password,
|
|
629
|
-
"onUpdate:modelValue":
|
|
634
|
+
"onUpdate:modelValue": b[3] || (b[3] = (L) => f.value.password = L),
|
|
630
635
|
type: "password",
|
|
631
636
|
name: "password",
|
|
632
637
|
autocomplete: "new-password"
|
|
@@ -634,48 +639,48 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
634
639
|
]),
|
|
635
640
|
_: 1
|
|
636
641
|
}, 8, ["label", "error", "help"]),
|
|
637
|
-
a(e(
|
|
642
|
+
a(e(K), {
|
|
638
643
|
label: e(m)("admins.roles"),
|
|
639
|
-
error:
|
|
644
|
+
error: W("roles")
|
|
640
645
|
}, {
|
|
641
646
|
default: t(() => [
|
|
642
647
|
a(e(ne), {
|
|
643
648
|
modelValue: f.value.roles,
|
|
644
|
-
"onUpdate:modelValue":
|
|
645
|
-
options:
|
|
649
|
+
"onUpdate:modelValue": b[4] || (b[4] = (L) => f.value.roles = L),
|
|
650
|
+
options: _.value,
|
|
646
651
|
multiple: ""
|
|
647
652
|
}, null, 8, ["modelValue", "options"])
|
|
648
653
|
]),
|
|
649
654
|
_: 1
|
|
650
655
|
}, 8, ["label", "error"]),
|
|
651
|
-
a(e(
|
|
656
|
+
a(e(K), {
|
|
652
657
|
label: e(m)("admins.locale")
|
|
653
658
|
}, {
|
|
654
659
|
default: t(() => [
|
|
655
660
|
a(e(ne), {
|
|
656
661
|
modelValue: f.value.locale,
|
|
657
|
-
"onUpdate:modelValue":
|
|
658
|
-
options:
|
|
662
|
+
"onUpdate:modelValue": b[5] || (b[5] = (L) => f.value.locale = L),
|
|
663
|
+
options: P.value
|
|
659
664
|
}, null, 8, ["modelValue", "options"])
|
|
660
665
|
]),
|
|
661
666
|
_: 1
|
|
662
667
|
}, 8, ["label"]),
|
|
663
668
|
a(e(se), { size: "md" }, {
|
|
664
669
|
default: t(() => [
|
|
665
|
-
a(e(
|
|
670
|
+
a(e(Le), {
|
|
666
671
|
modelValue: f.value.is_active,
|
|
667
|
-
"onUpdate:modelValue":
|
|
672
|
+
"onUpdate:modelValue": b[6] || (b[6] = (L) => f.value.is_active = L),
|
|
668
673
|
label: e(m)("admins.active")
|
|
669
674
|
}, null, 8, ["modelValue", "label"]),
|
|
670
|
-
a(e(
|
|
675
|
+
a(e(Le), {
|
|
671
676
|
modelValue: f.value.is_super,
|
|
672
|
-
"onUpdate:modelValue":
|
|
677
|
+
"onUpdate:modelValue": b[7] || (b[7] = (L) => f.value.is_super = L),
|
|
673
678
|
label: e(m)("admins.super")
|
|
674
679
|
}, null, 8, ["modelValue", "label"])
|
|
675
680
|
]),
|
|
676
681
|
_: 1
|
|
677
682
|
}),
|
|
678
|
-
a(e(
|
|
683
|
+
a(e(O), {
|
|
679
684
|
size: "sm",
|
|
680
685
|
tone: "muted"
|
|
681
686
|
}, {
|
|
@@ -701,34 +706,34 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
701
706
|
resolveAvatar: { type: Function, default: void 0 }
|
|
702
707
|
},
|
|
703
708
|
emits: ["open", "chosen", "selection", "remove"],
|
|
704
|
-
setup(n, { expose:
|
|
709
|
+
setup(n, { expose: u, emit: l }) {
|
|
705
710
|
const s = n, g = l, c = Z(), A = he(c);
|
|
706
711
|
te();
|
|
707
|
-
const
|
|
708
|
-
let
|
|
709
|
-
const
|
|
712
|
+
const r = ue("root"), m = Ce(r), U = T(() => m.value > 0 && m.value < Te), p = j("webx-auth"), w = j("webx-admin"), x = z(null), f = z([]), y = z(!1), v = z("all"), _ = z("any"), P = z([]), W = z({});
|
|
713
|
+
let F = { page: 1, perPage: 20, sort: null, search: "" };
|
|
714
|
+
const i = T(() => [
|
|
710
715
|
{ value: "all", label: p("admins.all-roles") },
|
|
711
|
-
...f.value.map((
|
|
712
|
-
]),
|
|
716
|
+
...f.value.map((B) => ({ value: B.slug, label: B.name }))
|
|
717
|
+
]), b = T(() => [
|
|
713
718
|
{ value: "any", label: p("admins.any-state") },
|
|
714
719
|
{ value: "yes", label: p("admins.only-active") },
|
|
715
720
|
{ value: "no", label: p("admins.only-inactive") }
|
|
716
|
-
]),
|
|
717
|
-
const
|
|
718
|
-
return M &&
|
|
721
|
+
]), L = T(() => {
|
|
722
|
+
const B = [], M = f.value.find((S) => S.slug === v.value);
|
|
723
|
+
return M && B.push({
|
|
719
724
|
key: "role",
|
|
720
725
|
label: `${p("admins.filter-role")}: ${M.name}`,
|
|
721
726
|
clear: () => v.value = "all"
|
|
722
|
-
}),
|
|
727
|
+
}), _.value !== "any" && B.push({
|
|
723
728
|
key: "state",
|
|
724
|
-
label: `${p("admins.filter-state")}: ${
|
|
725
|
-
clear: () =>
|
|
726
|
-
}),
|
|
729
|
+
label: `${p("admins.filter-state")}: ${_.value === "yes" ? p("admins.only-active") : p("admins.only-inactive")}`,
|
|
730
|
+
clear: () => _.value = "any"
|
|
731
|
+
}), B;
|
|
727
732
|
});
|
|
728
|
-
function
|
|
729
|
-
v.value = "all",
|
|
733
|
+
function I() {
|
|
734
|
+
v.value = "all", _.value = "any";
|
|
730
735
|
}
|
|
731
|
-
const
|
|
736
|
+
const D = T(() => U.value ? [{ key: "card", label: "" }] : [
|
|
732
737
|
{ key: "name", label: p("admins.name"), sortable: !0 },
|
|
733
738
|
{ key: "email", label: p("admins.email"), sortable: !0, hideBelow: 560 },
|
|
734
739
|
{ key: "roles", label: p("admins.roles"), hideBelow: 760 },
|
|
@@ -752,61 +757,61 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
752
757
|
hideOnCards: !0
|
|
753
758
|
}
|
|
754
759
|
]);
|
|
755
|
-
A.roles().then((
|
|
756
|
-
async function
|
|
757
|
-
|
|
760
|
+
A.roles().then((B) => f.value = B), ce([v, _], () => q(F));
|
|
761
|
+
async function q(B) {
|
|
762
|
+
F = B, y.value = !0;
|
|
758
763
|
try {
|
|
759
764
|
x.value = await A.list({
|
|
760
|
-
q:
|
|
765
|
+
q: B.search,
|
|
761
766
|
role: v.value === "all" ? null : v.value,
|
|
762
|
-
active:
|
|
763
|
-
sort:
|
|
764
|
-
page:
|
|
765
|
-
per_page:
|
|
767
|
+
active: _.value === "any" ? null : _.value,
|
|
768
|
+
sort: B.sort ? `${B.sort.order === "desc" ? "-" : ""}${B.sort.key}` : "name",
|
|
769
|
+
page: B.page,
|
|
770
|
+
per_page: B.perPage
|
|
766
771
|
}), k();
|
|
767
772
|
} finally {
|
|
768
773
|
y.value = !1;
|
|
769
774
|
}
|
|
770
775
|
}
|
|
771
776
|
async function k() {
|
|
772
|
-
const
|
|
773
|
-
if (
|
|
777
|
+
const B = s.resolveAvatar;
|
|
778
|
+
if (B)
|
|
774
779
|
for (const M of x.value?.data ?? []) {
|
|
775
|
-
if (!M.avatar ||
|
|
776
|
-
const
|
|
777
|
-
|
|
780
|
+
if (!M.avatar || W.value[M.avatar]) continue;
|
|
781
|
+
const S = await B(M.avatar);
|
|
782
|
+
S && (W.value = { ...W.value, [M.avatar]: S });
|
|
778
783
|
}
|
|
779
784
|
}
|
|
780
|
-
function
|
|
785
|
+
function R(B) {
|
|
781
786
|
return [
|
|
782
787
|
{
|
|
783
788
|
key: "delete",
|
|
784
789
|
icon: "trash",
|
|
785
790
|
label: p("admins.delete"),
|
|
786
791
|
danger: !0,
|
|
787
|
-
run: () => g("remove",
|
|
792
|
+
run: () => g("remove", B)
|
|
788
793
|
}
|
|
789
794
|
];
|
|
790
795
|
}
|
|
791
|
-
function C(
|
|
796
|
+
function C(B) {
|
|
792
797
|
if (s.picking) {
|
|
793
|
-
g("chosen", [
|
|
798
|
+
g("chosen", [B]);
|
|
794
799
|
return;
|
|
795
800
|
}
|
|
796
|
-
g("open",
|
|
801
|
+
g("open", B);
|
|
797
802
|
}
|
|
798
|
-
const X =
|
|
799
|
-
function pe(
|
|
800
|
-
|
|
803
|
+
const X = T(() => !(s.picking && s.multiple));
|
|
804
|
+
function pe(B, M) {
|
|
805
|
+
P.value = M, g("selection", M);
|
|
801
806
|
}
|
|
802
|
-
return
|
|
807
|
+
return u({ reload: () => q(F), chosen: () => P.value }), (B, M) => (h(), Y("div", {
|
|
803
808
|
ref_key: "root",
|
|
804
|
-
ref:
|
|
809
|
+
ref: r,
|
|
805
810
|
class: "wx-admin-list"
|
|
806
811
|
}, [
|
|
807
812
|
a(e($e), {
|
|
808
813
|
data: x.value,
|
|
809
|
-
columns:
|
|
814
|
+
columns: D.value,
|
|
810
815
|
"row-key": "id",
|
|
811
816
|
searchable: "",
|
|
812
817
|
clickable: X.value,
|
|
@@ -819,25 +824,25 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
819
824
|
"select-row-label": e(w)("filters.select-row"),
|
|
820
825
|
"select-all-label": e(w)("filters.select-all"),
|
|
821
826
|
"cards-below": Te,
|
|
822
|
-
"filters-count":
|
|
827
|
+
"filters-count": L.value.length,
|
|
823
828
|
"filters-label": e(w)("filters.title"),
|
|
824
829
|
onRowClick: C,
|
|
825
|
-
onStateChange:
|
|
830
|
+
onStateChange: q,
|
|
826
831
|
onSelectionChange: pe
|
|
827
832
|
}, we({
|
|
828
|
-
"cell-name": t(({ row:
|
|
833
|
+
"cell-name": t(({ row: S }) => [
|
|
829
834
|
a(e(se), {
|
|
830
835
|
size: "sm",
|
|
831
836
|
align: "center"
|
|
832
837
|
}, {
|
|
833
838
|
default: t(() => [
|
|
834
839
|
a(e(it), {
|
|
835
|
-
name:
|
|
836
|
-
src:
|
|
840
|
+
name: S.name,
|
|
841
|
+
src: S.avatar ? W.value[S.avatar] : void 0,
|
|
837
842
|
size: "sm"
|
|
838
843
|
}, null, 8, ["name", "src"]),
|
|
839
|
-
|
|
840
|
-
|
|
844
|
+
V("span", null, o(S.name), 1),
|
|
845
|
+
S.is_super ? (h(), $(e(J), {
|
|
841
846
|
key: 0,
|
|
842
847
|
type: "warning"
|
|
843
848
|
}, {
|
|
@@ -845,19 +850,19 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
845
850
|
d(o(e(p)("admins.super")), 1)
|
|
846
851
|
]),
|
|
847
852
|
_: 1
|
|
848
|
-
})) :
|
|
853
|
+
})) : E("", !0)
|
|
849
854
|
]),
|
|
850
855
|
_: 2
|
|
851
856
|
}, 1024)
|
|
852
857
|
]),
|
|
853
|
-
"cell-roles": t(({ row:
|
|
854
|
-
|
|
858
|
+
"cell-roles": t(({ row: S }) => [
|
|
859
|
+
S.roles.length > 0 ? (h(), $(e(se), {
|
|
855
860
|
key: 0,
|
|
856
861
|
size: "xs",
|
|
857
862
|
wrap: ""
|
|
858
863
|
}, {
|
|
859
864
|
default: t(() => [
|
|
860
|
-
(h(!0), Y(
|
|
865
|
+
(h(!0), Y(ie, null, _e(S.roles, (ae) => (h(), $(e(J), {
|
|
861
866
|
key: ae.id
|
|
862
867
|
}, {
|
|
863
868
|
default: t(() => [
|
|
@@ -867,7 +872,7 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
867
872
|
}, 1024))), 128))
|
|
868
873
|
]),
|
|
869
874
|
_: 2
|
|
870
|
-
}, 1024)) : (h(), $(e(
|
|
875
|
+
}, 1024)) : (h(), $(e(O), {
|
|
871
876
|
key: 1,
|
|
872
877
|
size: "sm",
|
|
873
878
|
tone: "muted"
|
|
@@ -878,47 +883,47 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
878
883
|
_: 1
|
|
879
884
|
}))
|
|
880
885
|
]),
|
|
881
|
-
"cell-is_active": t(({ row:
|
|
886
|
+
"cell-is_active": t(({ row: S }) => [
|
|
882
887
|
a(e(J), {
|
|
883
|
-
type:
|
|
888
|
+
type: S.is_active ? "success" : "default",
|
|
884
889
|
dot: ""
|
|
885
890
|
}, {
|
|
886
891
|
default: t(() => [
|
|
887
|
-
d(o(
|
|
892
|
+
d(o(S.is_active ? e(p)("admins.active") : e(p)("admins.only-inactive")), 1)
|
|
888
893
|
]),
|
|
889
894
|
_: 2
|
|
890
895
|
}, 1032, ["type"])
|
|
891
896
|
]),
|
|
892
|
-
"card-actions": t(({ row:
|
|
893
|
-
n.removable ? (h(), $(e(
|
|
897
|
+
"card-actions": t(({ row: S }) => [
|
|
898
|
+
n.removable ? (h(), $(e(Se), {
|
|
894
899
|
key: 0,
|
|
895
|
-
actions:
|
|
896
|
-
label:
|
|
897
|
-
}, null, 8, ["actions", "label"])) :
|
|
900
|
+
actions: R(S),
|
|
901
|
+
label: S.name
|
|
902
|
+
}, null, 8, ["actions", "label"])) : E("", !0)
|
|
898
903
|
]),
|
|
899
|
-
"cell-actions": t(({ row:
|
|
900
|
-
a(e(
|
|
901
|
-
actions:
|
|
902
|
-
label:
|
|
904
|
+
"cell-actions": t(({ row: S }) => [
|
|
905
|
+
a(e(Se), {
|
|
906
|
+
actions: R(S),
|
|
907
|
+
label: S.name
|
|
903
908
|
}, null, 8, ["actions", "label"])
|
|
904
909
|
]),
|
|
905
|
-
"cell-last_login_at": t(({ row:
|
|
906
|
-
a(e(
|
|
907
|
-
value:
|
|
908
|
-
tone:
|
|
910
|
+
"cell-last_login_at": t(({ row: S }) => [
|
|
911
|
+
a(e(re), {
|
|
912
|
+
value: S.last_login_at,
|
|
913
|
+
tone: S.last_login_at ? "default" : "muted",
|
|
909
914
|
compact: ""
|
|
910
915
|
}, null, 8, ["value", "tone"])
|
|
911
916
|
]),
|
|
912
|
-
"cell-card": t(({ row:
|
|
917
|
+
"cell-card": t(({ row: S }) => [
|
|
913
918
|
a(e(Ae), {
|
|
914
919
|
variant: "plain",
|
|
915
920
|
shape: "circle",
|
|
916
|
-
title:
|
|
917
|
-
image:
|
|
918
|
-
subtitle:
|
|
921
|
+
title: S.name,
|
|
922
|
+
image: S.avatar ? W.value[S.avatar] : void 0,
|
|
923
|
+
subtitle: S.email
|
|
919
924
|
}, {
|
|
920
925
|
meta: t(() => [
|
|
921
|
-
|
|
926
|
+
S.is_super ? (h(), $(e(J), {
|
|
922
927
|
key: 0,
|
|
923
928
|
type: "warning",
|
|
924
929
|
size: "sm"
|
|
@@ -927,8 +932,8 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
927
932
|
d(o(e(p)("admins.super")), 1)
|
|
928
933
|
]),
|
|
929
934
|
_: 1
|
|
930
|
-
})) :
|
|
931
|
-
(h(!0), Y(
|
|
935
|
+
})) : E("", !0),
|
|
936
|
+
(h(!0), Y(ie, null, _e(S.roles, (ae) => (h(), $(e(J), {
|
|
932
937
|
key: ae.id,
|
|
933
938
|
size: "sm"
|
|
934
939
|
}, {
|
|
@@ -938,12 +943,12 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
938
943
|
_: 2
|
|
939
944
|
}, 1024))), 128)),
|
|
940
945
|
a(e(J), {
|
|
941
|
-
type:
|
|
946
|
+
type: S.is_active ? "success" : "default",
|
|
942
947
|
dot: "",
|
|
943
948
|
size: "sm"
|
|
944
949
|
}, {
|
|
945
950
|
default: t(() => [
|
|
946
|
-
d(o(
|
|
951
|
+
d(o(S.is_active ? e(p)("admins.active") : e(p)("admins.only-inactive")), 1)
|
|
947
952
|
]),
|
|
948
953
|
_: 2
|
|
949
954
|
}, 1032, ["type"])
|
|
@@ -956,38 +961,38 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
956
961
|
n.filters ? {
|
|
957
962
|
name: "filters",
|
|
958
963
|
fn: t(() => [
|
|
959
|
-
a(e(
|
|
964
|
+
a(e(K), {
|
|
960
965
|
label: e(p)("admins.filter-role")
|
|
961
966
|
}, {
|
|
962
967
|
default: t(() => [
|
|
963
968
|
a(e(ne), {
|
|
964
969
|
modelValue: v.value,
|
|
965
|
-
"onUpdate:modelValue": M[0] || (M[0] = (
|
|
966
|
-
options:
|
|
970
|
+
"onUpdate:modelValue": M[0] || (M[0] = (S) => v.value = S),
|
|
971
|
+
options: i.value,
|
|
967
972
|
size: "sm"
|
|
968
973
|
}, null, 8, ["modelValue", "options"])
|
|
969
974
|
]),
|
|
970
975
|
_: 1
|
|
971
976
|
}, 8, ["label"]),
|
|
972
|
-
a(e(
|
|
977
|
+
a(e(K), {
|
|
973
978
|
label: e(p)("admins.filter-state")
|
|
974
979
|
}, {
|
|
975
980
|
default: t(() => [
|
|
976
981
|
a(e(ne), {
|
|
977
|
-
modelValue:
|
|
978
|
-
"onUpdate:modelValue": M[1] || (M[1] = (
|
|
979
|
-
options:
|
|
982
|
+
modelValue: _.value,
|
|
983
|
+
"onUpdate:modelValue": M[1] || (M[1] = (S) => _.value = S),
|
|
984
|
+
options: b.value,
|
|
980
985
|
size: "sm"
|
|
981
986
|
}, null, 8, ["modelValue", "options"])
|
|
982
987
|
]),
|
|
983
988
|
_: 1
|
|
984
989
|
}, 8, ["label"]),
|
|
985
|
-
|
|
990
|
+
L.value.length > 0 ? (h(), $(e(N), {
|
|
986
991
|
key: 0,
|
|
987
992
|
variant: "text",
|
|
988
993
|
size: "sm",
|
|
989
994
|
block: "",
|
|
990
|
-
onClick:
|
|
995
|
+
onClick: I
|
|
991
996
|
}, {
|
|
992
997
|
icon: t(() => [
|
|
993
998
|
a(e(ee), { name: "close" })
|
|
@@ -996,14 +1001,14 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
996
1001
|
d(" " + o(e(w)("filters.reset")), 1)
|
|
997
1002
|
]),
|
|
998
1003
|
_: 1
|
|
999
|
-
})) :
|
|
1004
|
+
})) : E("", !0)
|
|
1000
1005
|
]),
|
|
1001
1006
|
key: "0"
|
|
1002
1007
|
} : void 0,
|
|
1003
1008
|
n.filters ? {
|
|
1004
1009
|
name: "applied",
|
|
1005
1010
|
fn: t(() => [
|
|
1006
|
-
a(e(De), { filters:
|
|
1011
|
+
a(e(De), { filters: L.value }, null, 8, ["filters"])
|
|
1007
1012
|
]),
|
|
1008
1013
|
key: "1"
|
|
1009
1014
|
} : void 0
|
|
@@ -1021,144 +1026,144 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
1021
1026
|
class: "wx-call-list__arguments"
|
|
1022
1027
|
}, Ue = 480, Vt = /* @__PURE__ */ Q({
|
|
1023
1028
|
__name: "CallList",
|
|
1024
|
-
setup(n, { expose:
|
|
1029
|
+
setup(n, { expose: u }) {
|
|
1025
1030
|
const l = Z(), s = he(l);
|
|
1026
1031
|
te();
|
|
1027
|
-
const g =
|
|
1032
|
+
const g = ue("root"), c = Ce(g), A = T(() => c.value > 0 && c.value < Ue), r = j("webx-auth"), m = j("webx-admin"), U = z(null), p = z({ users: [], tools: [] }), w = z(!1), x = z("all"), f = z("all"), y = z("any");
|
|
1028
1033
|
let v = { page: 1, perPage: 30, sort: null, search: "" };
|
|
1029
|
-
function
|
|
1030
|
-
return k === null ?
|
|
1034
|
+
function _(k) {
|
|
1035
|
+
return k === null ? r("calls.local") : k.name ?? r("calls.deleted", { id: k.id });
|
|
1031
1036
|
}
|
|
1032
|
-
const
|
|
1033
|
-
{ value: "all", label:
|
|
1037
|
+
const P = T(() => [
|
|
1038
|
+
{ value: "all", label: r("calls.everybody") },
|
|
1034
1039
|
...p.value.users.map((k) => ({
|
|
1035
1040
|
value: k.id === null ? "none" : String(k.id),
|
|
1036
|
-
label:
|
|
1041
|
+
label: _(k.id === null ? null : { id: k.id, name: k.name })
|
|
1037
1042
|
}))
|
|
1038
|
-
]),
|
|
1039
|
-
{ value: "all", label:
|
|
1043
|
+
]), W = T(() => [
|
|
1044
|
+
{ value: "all", label: r("calls.all-tools") },
|
|
1040
1045
|
...p.value.tools.map((k) => ({ value: k, label: k }))
|
|
1041
|
-
]),
|
|
1042
|
-
{ value: "any", label:
|
|
1043
|
-
{ value: "ok", label:
|
|
1044
|
-
{ value: "failed", label:
|
|
1045
|
-
{ value: "dry", label:
|
|
1046
|
-
]),
|
|
1047
|
-
const k = [],
|
|
1048
|
-
x.value !== "all" &&
|
|
1046
|
+
]), F = T(() => [
|
|
1047
|
+
{ value: "any", label: r("calls.any-outcome") },
|
|
1048
|
+
{ value: "ok", label: r("calls.only-answered") },
|
|
1049
|
+
{ value: "failed", label: r("calls.only-refused") },
|
|
1050
|
+
{ value: "dry", label: r("calls.only-dry") }
|
|
1051
|
+
]), i = T(() => {
|
|
1052
|
+
const k = [], R = P.value.find((X) => X.value === x.value);
|
|
1053
|
+
x.value !== "all" && R && k.push({
|
|
1049
1054
|
key: "user",
|
|
1050
|
-
label: `${
|
|
1055
|
+
label: `${r("calls.filter-user")}: ${R.label}`,
|
|
1051
1056
|
clear: () => x.value = "all"
|
|
1052
1057
|
}), f.value !== "all" && k.push({
|
|
1053
1058
|
key: "tool",
|
|
1054
|
-
label: `${
|
|
1059
|
+
label: `${r("calls.filter-tool")}: ${f.value}`,
|
|
1055
1060
|
clear: () => f.value = "all"
|
|
1056
1061
|
});
|
|
1057
|
-
const C =
|
|
1062
|
+
const C = F.value.find((X) => X.value === y.value);
|
|
1058
1063
|
return y.value !== "any" && C && k.push({
|
|
1059
1064
|
key: "outcome",
|
|
1060
|
-
label: `${
|
|
1065
|
+
label: `${r("calls.filter-outcome")}: ${C.label}`,
|
|
1061
1066
|
clear: () => y.value = "any"
|
|
1062
1067
|
}), k;
|
|
1063
1068
|
});
|
|
1064
|
-
function
|
|
1069
|
+
function b() {
|
|
1065
1070
|
x.value = "all", f.value = "all", y.value = "any";
|
|
1066
1071
|
}
|
|
1067
|
-
const
|
|
1068
|
-
{ key: "at", label:
|
|
1069
|
-
{ key: "user", label:
|
|
1070
|
-
{ key: "tool", label:
|
|
1071
|
-
{ key: "outcome", label:
|
|
1072
|
-
{ key: "duration_ms", label:
|
|
1073
|
-
{ key: "client", label:
|
|
1072
|
+
const L = T(() => A.value ? [{ key: "card", label: "" }] : [
|
|
1073
|
+
{ key: "at", label: r("calls.when") },
|
|
1074
|
+
{ key: "user", label: r("calls.who"), hideBelow: 640 },
|
|
1075
|
+
{ key: "tool", label: r("calls.tool") },
|
|
1076
|
+
{ key: "outcome", label: r("calls.outcome") },
|
|
1077
|
+
{ key: "duration_ms", label: r("calls.took"), align: "right", hideBelow: 820 },
|
|
1078
|
+
{ key: "client", label: r("calls.client"), hideBelow: 960 }
|
|
1074
1079
|
]);
|
|
1075
|
-
|
|
1076
|
-
async function
|
|
1080
|
+
ce([x, f, y], () => I({ ...v, page: 1 }));
|
|
1081
|
+
async function I(k) {
|
|
1077
1082
|
v = k, w.value = !0;
|
|
1078
1083
|
try {
|
|
1079
|
-
|
|
1084
|
+
U.value = await s.calls({
|
|
1080
1085
|
user: x.value === "all" ? null : x.value,
|
|
1081
1086
|
tool: f.value === "all" ? null : f.value,
|
|
1082
1087
|
outcome: y.value === "any" ? null : y.value,
|
|
1083
1088
|
page: k.page,
|
|
1084
1089
|
per_page: k.perPage
|
|
1085
|
-
}), p.value =
|
|
1090
|
+
}), p.value = U.value.filters;
|
|
1086
1091
|
} finally {
|
|
1087
1092
|
w.value = !1;
|
|
1088
1093
|
}
|
|
1089
1094
|
}
|
|
1090
|
-
function G(k) {
|
|
1091
|
-
return k.ok ? k.dry_run ? { type: "info", label: i("calls.dry-run") } : { type: "success", label: i("calls.answered") } : { type: "danger", label: i("calls.refused") };
|
|
1092
|
-
}
|
|
1093
1095
|
function D(k) {
|
|
1096
|
+
return k.ok ? k.dry_run ? { type: "info", label: r("calls.dry-run") } : { type: "success", label: r("calls.answered") } : { type: "danger", label: r("calls.refused") };
|
|
1097
|
+
}
|
|
1098
|
+
function q(k) {
|
|
1094
1099
|
return k.arguments !== null || k.error !== null;
|
|
1095
1100
|
}
|
|
1096
|
-
return
|
|
1101
|
+
return u({ reload: () => I(v) }), (k, R) => (h(), Y("div", {
|
|
1097
1102
|
ref_key: "root",
|
|
1098
1103
|
ref: g,
|
|
1099
1104
|
class: "wx-call-list"
|
|
1100
1105
|
}, [
|
|
1101
1106
|
a(e($e), {
|
|
1102
|
-
data:
|
|
1103
|
-
columns:
|
|
1107
|
+
data: U.value,
|
|
1108
|
+
columns: L.value,
|
|
1104
1109
|
"row-key": "id",
|
|
1105
1110
|
flush: "",
|
|
1106
1111
|
loading: w.value,
|
|
1107
1112
|
clickable: !1,
|
|
1108
1113
|
expandable: !A.value,
|
|
1109
|
-
"expandable-if":
|
|
1110
|
-
"empty-text": e(
|
|
1114
|
+
"expandable-if": q,
|
|
1115
|
+
"empty-text": e(r)("calls.empty"),
|
|
1111
1116
|
"cards-below": Ue,
|
|
1112
|
-
"filters-count":
|
|
1117
|
+
"filters-count": i.value.length,
|
|
1113
1118
|
"filters-label": e(m)("filters.title"),
|
|
1114
|
-
onStateChange:
|
|
1119
|
+
onStateChange: I
|
|
1115
1120
|
}, {
|
|
1116
1121
|
filters: t(() => [
|
|
1117
|
-
a(e(
|
|
1118
|
-
label: e(
|
|
1122
|
+
a(e(K), {
|
|
1123
|
+
label: e(r)("calls.filter-user")
|
|
1119
1124
|
}, {
|
|
1120
1125
|
default: t(() => [
|
|
1121
1126
|
a(e(ne), {
|
|
1122
1127
|
modelValue: x.value,
|
|
1123
|
-
"onUpdate:modelValue":
|
|
1124
|
-
options:
|
|
1128
|
+
"onUpdate:modelValue": R[0] || (R[0] = (C) => x.value = C),
|
|
1129
|
+
options: P.value,
|
|
1125
1130
|
size: "sm"
|
|
1126
1131
|
}, null, 8, ["modelValue", "options"])
|
|
1127
1132
|
]),
|
|
1128
1133
|
_: 1
|
|
1129
1134
|
}, 8, ["label"]),
|
|
1130
|
-
a(e(
|
|
1131
|
-
label: e(
|
|
1135
|
+
a(e(K), {
|
|
1136
|
+
label: e(r)("calls.filter-tool")
|
|
1132
1137
|
}, {
|
|
1133
1138
|
default: t(() => [
|
|
1134
1139
|
a(e(ne), {
|
|
1135
1140
|
modelValue: f.value,
|
|
1136
|
-
"onUpdate:modelValue":
|
|
1137
|
-
options:
|
|
1141
|
+
"onUpdate:modelValue": R[1] || (R[1] = (C) => f.value = C),
|
|
1142
|
+
options: W.value,
|
|
1138
1143
|
size: "sm"
|
|
1139
1144
|
}, null, 8, ["modelValue", "options"])
|
|
1140
1145
|
]),
|
|
1141
1146
|
_: 1
|
|
1142
1147
|
}, 8, ["label"]),
|
|
1143
|
-
a(e(
|
|
1144
|
-
label: e(
|
|
1148
|
+
a(e(K), {
|
|
1149
|
+
label: e(r)("calls.filter-outcome")
|
|
1145
1150
|
}, {
|
|
1146
1151
|
default: t(() => [
|
|
1147
1152
|
a(e(ne), {
|
|
1148
1153
|
modelValue: y.value,
|
|
1149
|
-
"onUpdate:modelValue":
|
|
1150
|
-
options:
|
|
1154
|
+
"onUpdate:modelValue": R[2] || (R[2] = (C) => y.value = C),
|
|
1155
|
+
options: F.value,
|
|
1151
1156
|
size: "sm"
|
|
1152
1157
|
}, null, 8, ["modelValue", "options"])
|
|
1153
1158
|
]),
|
|
1154
1159
|
_: 1
|
|
1155
1160
|
}, 8, ["label"]),
|
|
1156
|
-
|
|
1161
|
+
i.value.length > 0 ? (h(), $(e(N), {
|
|
1157
1162
|
key: 0,
|
|
1158
1163
|
variant: "text",
|
|
1159
1164
|
size: "sm",
|
|
1160
1165
|
block: "",
|
|
1161
|
-
onClick:
|
|
1166
|
+
onClick: b
|
|
1162
1167
|
}, {
|
|
1163
1168
|
icon: t(() => [
|
|
1164
1169
|
a(e(ee), { name: "close" })
|
|
@@ -1167,30 +1172,30 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
1167
1172
|
d(" " + o(e(m)("filters.reset")), 1)
|
|
1168
1173
|
]),
|
|
1169
1174
|
_: 1
|
|
1170
|
-
})) :
|
|
1175
|
+
})) : E("", !0)
|
|
1171
1176
|
]),
|
|
1172
1177
|
applied: t(() => [
|
|
1173
|
-
a(e(De), { filters:
|
|
1178
|
+
a(e(De), { filters: i.value }, null, 8, ["filters"])
|
|
1174
1179
|
]),
|
|
1175
1180
|
"cell-at": t(({ row: C }) => [
|
|
1176
|
-
a(e(
|
|
1181
|
+
a(e(re), {
|
|
1177
1182
|
value: C.at,
|
|
1178
1183
|
tone: "default",
|
|
1179
1184
|
compact: ""
|
|
1180
1185
|
}, null, 8, ["value"])
|
|
1181
1186
|
]),
|
|
1182
1187
|
"cell-user": t(({ row: C }) => [
|
|
1183
|
-
a(e(
|
|
1188
|
+
a(e(O), {
|
|
1184
1189
|
tone: C.user === null || C.user.name === null ? "muted" : "default"
|
|
1185
1190
|
}, {
|
|
1186
1191
|
default: t(() => [
|
|
1187
|
-
d(o(
|
|
1192
|
+
d(o(_(C.user)), 1)
|
|
1188
1193
|
]),
|
|
1189
1194
|
_: 2
|
|
1190
1195
|
}, 1032, ["tone"])
|
|
1191
1196
|
]),
|
|
1192
1197
|
"cell-tool": t(({ row: C }) => [
|
|
1193
|
-
a(e(
|
|
1198
|
+
a(e(O), {
|
|
1194
1199
|
mono: "",
|
|
1195
1200
|
size: "sm"
|
|
1196
1201
|
}, {
|
|
@@ -1202,28 +1207,28 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
1202
1207
|
]),
|
|
1203
1208
|
"cell-outcome": t(({ row: C }) => [
|
|
1204
1209
|
a(e(J), {
|
|
1205
|
-
type:
|
|
1210
|
+
type: D(C).type,
|
|
1206
1211
|
dot: ""
|
|
1207
1212
|
}, {
|
|
1208
1213
|
default: t(() => [
|
|
1209
|
-
d(o(
|
|
1214
|
+
d(o(D(C).label), 1)
|
|
1210
1215
|
]),
|
|
1211
1216
|
_: 2
|
|
1212
1217
|
}, 1032, ["type"])
|
|
1213
1218
|
]),
|
|
1214
1219
|
"cell-duration_ms": t(({ row: C }) => [
|
|
1215
|
-
a(e(
|
|
1220
|
+
a(e(O), {
|
|
1216
1221
|
size: "sm",
|
|
1217
1222
|
tone: "muted"
|
|
1218
1223
|
}, {
|
|
1219
1224
|
default: t(() => [
|
|
1220
|
-
d(o(e(
|
|
1225
|
+
d(o(e(r)("calls.ms", { count: C.duration_ms })), 1)
|
|
1221
1226
|
]),
|
|
1222
1227
|
_: 2
|
|
1223
1228
|
}, 1024)
|
|
1224
1229
|
]),
|
|
1225
1230
|
"cell-client": t(({ row: C }) => [
|
|
1226
|
-
C.client ? (h(), $(e(
|
|
1231
|
+
C.client ? (h(), $(e(O), {
|
|
1227
1232
|
key: 0,
|
|
1228
1233
|
size: "sm"
|
|
1229
1234
|
}, {
|
|
@@ -1231,58 +1236,58 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
1231
1236
|
d(o(C.client), 1)
|
|
1232
1237
|
]),
|
|
1233
1238
|
_: 2
|
|
1234
|
-
}, 1024)) : (h(), $(e(
|
|
1239
|
+
}, 1024)) : (h(), $(e(O), {
|
|
1235
1240
|
key: 1,
|
|
1236
1241
|
size: "sm",
|
|
1237
1242
|
tone: "muted"
|
|
1238
1243
|
}, {
|
|
1239
|
-
default: t(() => [...
|
|
1244
|
+
default: t(() => [...R[3] || (R[3] = [
|
|
1240
1245
|
d("—", -1)
|
|
1241
1246
|
])]),
|
|
1242
1247
|
_: 1
|
|
1243
1248
|
}))
|
|
1244
1249
|
]),
|
|
1245
1250
|
expanded: t(({ row: C }) => [
|
|
1246
|
-
|
|
1247
|
-
C.error ? (h(), $(e(
|
|
1251
|
+
V("div", xt, [
|
|
1252
|
+
C.error ? (h(), $(e(O), {
|
|
1248
1253
|
key: 0,
|
|
1249
1254
|
tone: "danger",
|
|
1250
1255
|
size: "sm",
|
|
1251
1256
|
class: "wx-call-list__error"
|
|
1252
1257
|
}, {
|
|
1253
1258
|
default: t(() => [
|
|
1254
|
-
|
|
1259
|
+
V("strong", null, o(e(r)("calls.error")) + ":", 1),
|
|
1255
1260
|
d(" " + o(C.error), 1)
|
|
1256
1261
|
]),
|
|
1257
1262
|
_: 2
|
|
1258
|
-
}, 1024)) :
|
|
1259
|
-
|
|
1260
|
-
a(e(
|
|
1263
|
+
}, 1024)) : E("", !0),
|
|
1264
|
+
V("div", kt, [
|
|
1265
|
+
a(e(O), {
|
|
1261
1266
|
size: "sm",
|
|
1262
1267
|
weight: "semibold"
|
|
1263
1268
|
}, {
|
|
1264
1269
|
default: t(() => [
|
|
1265
|
-
d(o(e(
|
|
1270
|
+
d(o(e(r)("calls.request")), 1)
|
|
1266
1271
|
]),
|
|
1267
1272
|
_: 1
|
|
1268
1273
|
}),
|
|
1269
|
-
a(e(
|
|
1274
|
+
a(e(O), {
|
|
1270
1275
|
size: "xs",
|
|
1271
1276
|
tone: "muted"
|
|
1272
1277
|
}, {
|
|
1273
1278
|
default: t(() => [
|
|
1274
|
-
d(o(e(
|
|
1279
|
+
d(o(e(r)("calls.request-hint")), 1)
|
|
1275
1280
|
]),
|
|
1276
1281
|
_: 1
|
|
1277
1282
|
})
|
|
1278
1283
|
]),
|
|
1279
|
-
C.arguments ? (h(), Y("pre", Ct, o(C.arguments), 1)) : (h(), $(e(
|
|
1284
|
+
C.arguments ? (h(), Y("pre", Ct, o(C.arguments), 1)) : (h(), $(e(O), {
|
|
1280
1285
|
key: 2,
|
|
1281
1286
|
size: "sm",
|
|
1282
1287
|
tone: "muted"
|
|
1283
1288
|
}, {
|
|
1284
1289
|
default: t(() => [
|
|
1285
|
-
d(o(e(
|
|
1290
|
+
d(o(e(r)("calls.no-arguments")), 1)
|
|
1286
1291
|
]),
|
|
1287
1292
|
_: 1
|
|
1288
1293
|
}))
|
|
@@ -1292,29 +1297,29 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
1292
1297
|
a(e(Ae), {
|
|
1293
1298
|
variant: "plain",
|
|
1294
1299
|
title: C.tool,
|
|
1295
|
-
subtitle:
|
|
1300
|
+
subtitle: _(C.user)
|
|
1296
1301
|
}, {
|
|
1297
1302
|
media: t(() => [
|
|
1298
|
-
|
|
1303
|
+
V("span", $t, [
|
|
1299
1304
|
a(e(ee), { name: "sliders" })
|
|
1300
1305
|
])
|
|
1301
1306
|
]),
|
|
1302
1307
|
meta: t(() => [
|
|
1303
1308
|
a(e(J), {
|
|
1304
|
-
type:
|
|
1309
|
+
type: D(C).type,
|
|
1305
1310
|
dot: "",
|
|
1306
1311
|
size: "sm"
|
|
1307
1312
|
}, {
|
|
1308
1313
|
default: t(() => [
|
|
1309
|
-
d(o(
|
|
1314
|
+
d(o(D(C).label), 1)
|
|
1310
1315
|
]),
|
|
1311
1316
|
_: 2
|
|
1312
1317
|
}, 1032, ["type"]),
|
|
1313
|
-
a(e(
|
|
1318
|
+
a(e(re), {
|
|
1314
1319
|
value: C.at,
|
|
1315
1320
|
compact: ""
|
|
1316
1321
|
}, null, 8, ["value"]),
|
|
1317
|
-
C.client ? (h(), $(e(
|
|
1322
|
+
C.client ? (h(), $(e(O), {
|
|
1318
1323
|
key: 0,
|
|
1319
1324
|
size: "xs",
|
|
1320
1325
|
tone: "muted"
|
|
@@ -1323,17 +1328,17 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
1323
1328
|
d(o(C.client), 1)
|
|
1324
1329
|
]),
|
|
1325
1330
|
_: 2
|
|
1326
|
-
}, 1024)) :
|
|
1331
|
+
}, 1024)) : E("", !0)
|
|
1327
1332
|
]),
|
|
1328
1333
|
default: t(() => [
|
|
1329
|
-
|
|
1334
|
+
q(C) ? (h(), $(e(se), {
|
|
1330
1335
|
key: 0,
|
|
1331
1336
|
direction: "vertical",
|
|
1332
1337
|
size: "xs",
|
|
1333
1338
|
class: "wx-call-list__card-details"
|
|
1334
1339
|
}, {
|
|
1335
1340
|
default: t(() => [
|
|
1336
|
-
C.error ? (h(), $(e(
|
|
1341
|
+
C.error ? (h(), $(e(O), {
|
|
1337
1342
|
key: 0,
|
|
1338
1343
|
tone: "danger",
|
|
1339
1344
|
size: "sm"
|
|
@@ -1342,21 +1347,21 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
1342
1347
|
d(o(C.error), 1)
|
|
1343
1348
|
]),
|
|
1344
1349
|
_: 2
|
|
1345
|
-
}, 1024)) :
|
|
1346
|
-
C.arguments ? (h(), $(e(
|
|
1350
|
+
}, 1024)) : E("", !0),
|
|
1351
|
+
C.arguments ? (h(), $(e(O), {
|
|
1347
1352
|
key: 1,
|
|
1348
1353
|
size: "xs",
|
|
1349
1354
|
tone: "muted"
|
|
1350
1355
|
}, {
|
|
1351
1356
|
default: t(() => [
|
|
1352
|
-
d(o(e(
|
|
1357
|
+
d(o(e(r)("calls.request")), 1)
|
|
1353
1358
|
]),
|
|
1354
1359
|
_: 1
|
|
1355
|
-
})) :
|
|
1356
|
-
C.arguments ? (h(), Y("pre", At, o(C.arguments), 1)) :
|
|
1360
|
+
})) : E("", !0),
|
|
1361
|
+
C.arguments ? (h(), Y("pre", At, o(C.arguments), 1)) : E("", !0)
|
|
1357
1362
|
]),
|
|
1358
1363
|
_: 2
|
|
1359
|
-
}, 1024)) :
|
|
1364
|
+
}, 1024)) : E("", !0)
|
|
1360
1365
|
]),
|
|
1361
1366
|
_: 2
|
|
1362
1367
|
}, 1032, ["title", "subtitle"])
|
|
@@ -1367,17 +1372,17 @@ const _t = { class: "wx-admin-form" }, bt = {
|
|
|
1367
1372
|
}
|
|
1368
1373
|
});
|
|
1369
1374
|
function zt(n) {
|
|
1370
|
-
const
|
|
1375
|
+
const u = `${n.apiPath}/auth/connections`;
|
|
1371
1376
|
return {
|
|
1372
|
-
list: (l = "mine") => n.http.get(
|
|
1377
|
+
list: (l = "mine") => n.http.get(u, { query: { all: l === "all" ? 1 : void 0 } }).then((s) => ({
|
|
1373
1378
|
data: s.data,
|
|
1374
1379
|
scope: s.meta.scope,
|
|
1375
1380
|
canSeeEverybody: s.meta.can_see_everybody
|
|
1376
1381
|
})),
|
|
1377
|
-
disconnect: (l) => n.http.delete(`${
|
|
1382
|
+
disconnect: (l) => n.http.delete(`${u}/${l}`).then((s) => s.data)
|
|
1378
1383
|
};
|
|
1379
1384
|
}
|
|
1380
|
-
const
|
|
1385
|
+
const St = {
|
|
1381
1386
|
class: "wx-connection-list__glyph",
|
|
1382
1387
|
"aria-hidden": "true"
|
|
1383
1388
|
}, Pe = 560, Je = /* @__PURE__ */ Q({
|
|
@@ -1385,10 +1390,10 @@ const Lt = {
|
|
|
1385
1390
|
props: {
|
|
1386
1391
|
scope: { default: "mine" }
|
|
1387
1392
|
},
|
|
1388
|
-
setup(n, { expose:
|
|
1393
|
+
setup(n, { expose: u }) {
|
|
1389
1394
|
const l = n, s = Z(), g = zt(s);
|
|
1390
1395
|
te();
|
|
1391
|
-
const c =
|
|
1396
|
+
const c = j("webx-auth"), A = me(), r = ue("root"), m = Ce(r), U = T(() => m.value > 0 && m.value < Pe), p = z([]), w = z(!1), x = z(null), f = T(() => U.value ? [{ key: "card", label: "" }] : [
|
|
1392
1397
|
{ key: "client", label: c("connections.client"), minWidth: 210 },
|
|
1393
1398
|
...l.scope === "all" ? [{ key: "user", label: c("connections.who"), minWidth: 140 }] : [],
|
|
1394
1399
|
{ key: "read_only", label: c("connections.allowed"), minWidth: 160 },
|
|
@@ -1396,47 +1401,47 @@ const Lt = {
|
|
|
1396
1401
|
{ key: "last_used_at", label: c("connections.last-used"), minWidth: 130 },
|
|
1397
1402
|
{ key: "end", label: "", align: "right", width: 140 }
|
|
1398
1403
|
]);
|
|
1399
|
-
function y(
|
|
1400
|
-
return
|
|
1404
|
+
function y(W) {
|
|
1405
|
+
return W.user.name ?? c("calls.deleted", { id: W.user.id });
|
|
1401
1406
|
}
|
|
1402
|
-
function v(
|
|
1403
|
-
if (
|
|
1407
|
+
function v(W) {
|
|
1408
|
+
if (W.read_only) return c("connections.read-only");
|
|
1404
1409
|
if (l.scope !== "all") return c("connections.full-you");
|
|
1405
|
-
const
|
|
1406
|
-
return c("connections.full", { name:
|
|
1410
|
+
const F = W.user.name?.split(" ")[0];
|
|
1411
|
+
return c("connections.full", { name: F || y(W) });
|
|
1407
1412
|
}
|
|
1408
|
-
async function
|
|
1413
|
+
async function _() {
|
|
1409
1414
|
w.value = !0;
|
|
1410
1415
|
try {
|
|
1411
1416
|
p.value = (await g.list(l.scope)).data;
|
|
1412
|
-
} catch (
|
|
1413
|
-
|
|
1417
|
+
} catch (W) {
|
|
1418
|
+
G.danger(A(W));
|
|
1414
1419
|
} finally {
|
|
1415
1420
|
w.value = !1;
|
|
1416
1421
|
}
|
|
1417
1422
|
}
|
|
1418
|
-
async function
|
|
1423
|
+
async function P(W) {
|
|
1419
1424
|
if (await Ne({
|
|
1420
|
-
title: c("connections.confirm-title", { client:
|
|
1425
|
+
title: c("connections.confirm-title", { client: W.client }),
|
|
1421
1426
|
message: c("connections.confirm-text"),
|
|
1422
1427
|
confirmText: c("connections.confirm"),
|
|
1423
1428
|
cancelText: c("connections.cancel"),
|
|
1424
1429
|
tone: "danger"
|
|
1425
1430
|
})) {
|
|
1426
|
-
x.value =
|
|
1431
|
+
x.value = W.id;
|
|
1427
1432
|
try {
|
|
1428
|
-
const
|
|
1429
|
-
p.value = p.value.map((
|
|
1430
|
-
} catch (
|
|
1431
|
-
|
|
1433
|
+
const i = await g.disconnect(W.id);
|
|
1434
|
+
p.value = p.value.map((b) => b.id === i.id ? i : b), G.success(c("connections.done", { client: W.client }));
|
|
1435
|
+
} catch (i) {
|
|
1436
|
+
G.danger(A(i));
|
|
1432
1437
|
} finally {
|
|
1433
1438
|
x.value = null;
|
|
1434
1439
|
}
|
|
1435
1440
|
}
|
|
1436
1441
|
}
|
|
1437
|
-
return
|
|
1442
|
+
return ce(() => l.scope, _, { immediate: !0 }), u({ reload: _ }), (W, F) => (h(), Y("div", {
|
|
1438
1443
|
ref_key: "root",
|
|
1439
|
-
ref:
|
|
1444
|
+
ref: r,
|
|
1440
1445
|
class: "wx-connection-list"
|
|
1441
1446
|
}, [
|
|
1442
1447
|
a(e($e), {
|
|
@@ -1448,29 +1453,29 @@ const Lt = {
|
|
|
1448
1453
|
clickable: !1,
|
|
1449
1454
|
"empty-text": n.scope === "all" ? e(c)("connections.empty-all") : e(c)("connections.empty"),
|
|
1450
1455
|
"cards-below": Pe,
|
|
1451
|
-
"row-class": (
|
|
1456
|
+
"row-class": (i) => i.revoked_at ? "is-ended" : ""
|
|
1452
1457
|
}, {
|
|
1453
|
-
"cell-client": t(({ row:
|
|
1458
|
+
"cell-client": t(({ row: i }) => [
|
|
1454
1459
|
a(e(se), {
|
|
1455
1460
|
direction: "vertical",
|
|
1456
1461
|
size: "none"
|
|
1457
1462
|
}, {
|
|
1458
1463
|
default: t(() => [
|
|
1459
|
-
a(e(
|
|
1460
|
-
tone:
|
|
1464
|
+
a(e(O), {
|
|
1465
|
+
tone: i.revoked_at ? "muted" : "default",
|
|
1461
1466
|
weight: "medium"
|
|
1462
1467
|
}, {
|
|
1463
1468
|
default: t(() => [
|
|
1464
|
-
d(o(
|
|
1469
|
+
d(o(i.client), 1)
|
|
1465
1470
|
]),
|
|
1466
1471
|
_: 2
|
|
1467
1472
|
}, 1032, ["tone"]),
|
|
1468
|
-
a(e(
|
|
1473
|
+
a(e(O), {
|
|
1469
1474
|
size: "xs",
|
|
1470
1475
|
tone: "muted"
|
|
1471
1476
|
}, {
|
|
1472
1477
|
default: t(() => [
|
|
1473
|
-
d(o(e(c)("connections.returns-to", { host:
|
|
1478
|
+
d(o(e(c)("connections.returns-to", { host: i.host })), 1)
|
|
1474
1479
|
]),
|
|
1475
1480
|
_: 2
|
|
1476
1481
|
}, 1024)
|
|
@@ -1478,18 +1483,18 @@ const Lt = {
|
|
|
1478
1483
|
_: 2
|
|
1479
1484
|
}, 1024)
|
|
1480
1485
|
]),
|
|
1481
|
-
"cell-user": t(({ row:
|
|
1482
|
-
a(e(
|
|
1483
|
-
tone:
|
|
1486
|
+
"cell-user": t(({ row: i }) => [
|
|
1487
|
+
a(e(O), {
|
|
1488
|
+
tone: i.user.name === null ? "muted" : "default"
|
|
1484
1489
|
}, {
|
|
1485
1490
|
default: t(() => [
|
|
1486
|
-
d(o(y(
|
|
1491
|
+
d(o(y(i)), 1)
|
|
1487
1492
|
]),
|
|
1488
1493
|
_: 2
|
|
1489
1494
|
}, 1032, ["tone"])
|
|
1490
1495
|
]),
|
|
1491
|
-
"cell-read_only": t(({ row:
|
|
1492
|
-
|
|
1496
|
+
"cell-read_only": t(({ row: i }) => [
|
|
1497
|
+
i.revoked_at ? (h(), $(e(J), {
|
|
1493
1498
|
key: 0,
|
|
1494
1499
|
type: "default",
|
|
1495
1500
|
dot: ""
|
|
@@ -1500,29 +1505,29 @@ const Lt = {
|
|
|
1500
1505
|
_: 1
|
|
1501
1506
|
})) : (h(), $(e(J), {
|
|
1502
1507
|
key: 1,
|
|
1503
|
-
type:
|
|
1508
|
+
type: i.read_only ? "info" : "success",
|
|
1504
1509
|
dot: ""
|
|
1505
1510
|
}, {
|
|
1506
1511
|
default: t(() => [
|
|
1507
|
-
d(o(v(
|
|
1512
|
+
d(o(v(i)), 1)
|
|
1508
1513
|
]),
|
|
1509
1514
|
_: 2
|
|
1510
1515
|
}, 1032, ["type"]))
|
|
1511
1516
|
]),
|
|
1512
|
-
"cell-connected_at": t(({ row:
|
|
1513
|
-
a(e(
|
|
1514
|
-
value:
|
|
1517
|
+
"cell-connected_at": t(({ row: i }) => [
|
|
1518
|
+
a(e(re), {
|
|
1519
|
+
value: i.connected_at,
|
|
1515
1520
|
tone: "muted",
|
|
1516
1521
|
compact: ""
|
|
1517
1522
|
}, null, 8, ["value"])
|
|
1518
1523
|
]),
|
|
1519
|
-
"cell-last_used_at": t(({ row:
|
|
1520
|
-
|
|
1524
|
+
"cell-last_used_at": t(({ row: i }) => [
|
|
1525
|
+
i.last_used_at ? (h(), $(e(re), {
|
|
1521
1526
|
key: 0,
|
|
1522
|
-
value:
|
|
1527
|
+
value: i.last_used_at,
|
|
1523
1528
|
tone: "default",
|
|
1524
1529
|
compact: ""
|
|
1525
|
-
}, null, 8, ["value"])) : (h(), $(e(
|
|
1530
|
+
}, null, 8, ["value"])) : (h(), $(e(O), {
|
|
1526
1531
|
key: 1,
|
|
1527
1532
|
size: "sm",
|
|
1528
1533
|
tone: "muted"
|
|
@@ -1533,14 +1538,14 @@ const Lt = {
|
|
|
1533
1538
|
_: 1
|
|
1534
1539
|
}))
|
|
1535
1540
|
]),
|
|
1536
|
-
"cell-end": t(({ row:
|
|
1537
|
-
|
|
1541
|
+
"cell-end": t(({ row: i }) => [
|
|
1542
|
+
i.revoked_at ? E("", !0) : (h(), $(e(N), {
|
|
1538
1543
|
key: 0,
|
|
1539
1544
|
type: "danger",
|
|
1540
1545
|
variant: "text",
|
|
1541
1546
|
size: "sm",
|
|
1542
|
-
loading: x.value ===
|
|
1543
|
-
onClick: (
|
|
1547
|
+
loading: x.value === i.id,
|
|
1548
|
+
onClick: (b) => P(i)
|
|
1544
1549
|
}, {
|
|
1545
1550
|
default: t(() => [
|
|
1546
1551
|
d(o(e(c)("connections.disconnect")), 1)
|
|
@@ -1548,19 +1553,19 @@ const Lt = {
|
|
|
1548
1553
|
_: 1
|
|
1549
1554
|
}, 8, ["loading", "onClick"]))
|
|
1550
1555
|
]),
|
|
1551
|
-
"cell-card": t(({ row:
|
|
1556
|
+
"cell-card": t(({ row: i }) => [
|
|
1552
1557
|
a(e(Ae), {
|
|
1553
1558
|
variant: "plain",
|
|
1554
|
-
title:
|
|
1555
|
-
subtitle: e(c)("connections.returns-to", { host:
|
|
1559
|
+
title: i.client,
|
|
1560
|
+
subtitle: e(c)("connections.returns-to", { host: i.host })
|
|
1556
1561
|
}, {
|
|
1557
1562
|
media: t(() => [
|
|
1558
|
-
|
|
1563
|
+
V("span", St, [
|
|
1559
1564
|
a(e(ee), { name: "link" })
|
|
1560
1565
|
])
|
|
1561
1566
|
]),
|
|
1562
1567
|
meta: t(() => [
|
|
1563
|
-
|
|
1568
|
+
i.revoked_at ? (h(), $(e(J), {
|
|
1564
1569
|
key: 0,
|
|
1565
1570
|
type: "default",
|
|
1566
1571
|
dot: "",
|
|
@@ -1572,30 +1577,30 @@ const Lt = {
|
|
|
1572
1577
|
_: 1
|
|
1573
1578
|
})) : (h(), $(e(J), {
|
|
1574
1579
|
key: 1,
|
|
1575
|
-
type:
|
|
1580
|
+
type: i.read_only ? "info" : "success",
|
|
1576
1581
|
dot: "",
|
|
1577
1582
|
size: "sm"
|
|
1578
1583
|
}, {
|
|
1579
1584
|
default: t(() => [
|
|
1580
|
-
d(o(v(
|
|
1585
|
+
d(o(v(i)), 1)
|
|
1581
1586
|
]),
|
|
1582
1587
|
_: 2
|
|
1583
1588
|
}, 1032, ["type"])),
|
|
1584
|
-
n.scope === "all" ? (h(), $(e(
|
|
1589
|
+
n.scope === "all" ? (h(), $(e(O), {
|
|
1585
1590
|
key: 2,
|
|
1586
1591
|
size: "xs",
|
|
1587
1592
|
tone: "muted"
|
|
1588
1593
|
}, {
|
|
1589
1594
|
default: t(() => [
|
|
1590
|
-
d(o(y(
|
|
1595
|
+
d(o(y(i)), 1)
|
|
1591
1596
|
]),
|
|
1592
1597
|
_: 2
|
|
1593
|
-
}, 1024)) :
|
|
1594
|
-
|
|
1598
|
+
}, 1024)) : E("", !0),
|
|
1599
|
+
i.last_used_at ? (h(), $(e(re), {
|
|
1595
1600
|
key: 3,
|
|
1596
|
-
value:
|
|
1601
|
+
value: i.last_used_at,
|
|
1597
1602
|
compact: ""
|
|
1598
|
-
}, null, 8, ["value"])) : (h(), $(e(
|
|
1603
|
+
}, null, 8, ["value"])) : (h(), $(e(O), {
|
|
1599
1604
|
key: 4,
|
|
1600
1605
|
size: "xs",
|
|
1601
1606
|
tone: "muted"
|
|
@@ -1607,13 +1612,13 @@ const Lt = {
|
|
|
1607
1612
|
}))
|
|
1608
1613
|
]),
|
|
1609
1614
|
actions: t(() => [
|
|
1610
|
-
|
|
1615
|
+
i.revoked_at ? E("", !0) : (h(), $(e(N), {
|
|
1611
1616
|
key: 0,
|
|
1612
1617
|
type: "danger",
|
|
1613
1618
|
variant: "text",
|
|
1614
1619
|
size: "sm",
|
|
1615
|
-
loading: x.value ===
|
|
1616
|
-
onClick: (
|
|
1620
|
+
loading: x.value === i.id,
|
|
1621
|
+
onClick: (b) => P(i)
|
|
1617
1622
|
}, {
|
|
1618
1623
|
default: t(() => [
|
|
1619
1624
|
d(o(e(c)("connections.disconnect")), 1)
|
|
@@ -1628,7 +1633,7 @@ const Lt = {
|
|
|
1628
1633
|
}, 8, ["data", "columns", "loading", "empty-text", "row-class"])
|
|
1629
1634
|
], 512));
|
|
1630
1635
|
}
|
|
1631
|
-
}),
|
|
1636
|
+
}), Lt = /* @__PURE__ */ Q({
|
|
1632
1637
|
__name: "AdminsPage",
|
|
1633
1638
|
props: {
|
|
1634
1639
|
base: { default: "/admins" },
|
|
@@ -1637,55 +1642,55 @@ const Lt = {
|
|
|
1637
1642
|
resolveAvatar: { type: Function, default: void 0 }
|
|
1638
1643
|
},
|
|
1639
1644
|
setup(n) {
|
|
1640
|
-
const
|
|
1645
|
+
const u = n, l = Z(), s = he(l), g = u.avatarField ?? Ke(l) ?? void 0, c = u.resolveAvatar ?? Ye(l) ?? void 0, A = st(), r = ot();
|
|
1641
1646
|
te();
|
|
1642
|
-
const m =
|
|
1643
|
-
() => l.state.manifest?.modules.find((
|
|
1644
|
-
),
|
|
1645
|
-
const
|
|
1646
|
-
return y &&
|
|
1647
|
-
}),
|
|
1648
|
-
get: () =>
|
|
1649
|
-
set: (
|
|
1650
|
-
const
|
|
1651
|
-
|
|
1647
|
+
const m = j("webx-auth"), U = me(), p = ue("list"), w = z(null), x = Ve(wt), f = l.can("admins.manage"), y = l.can("admins.audit"), v = T(
|
|
1648
|
+
() => l.state.manifest?.modules.find((b) => b.id === "admins")?.title ?? m("admins.title")
|
|
1649
|
+
), _ = T(() => {
|
|
1650
|
+
const b = [{ value: "admins", label: v.value }];
|
|
1651
|
+
return y && b.push({ value: "calls", label: m("calls.title") }), f && b.push({ value: "connections", label: m("connections.title") }), b.length > 1 ? b : void 0;
|
|
1652
|
+
}), P = T({
|
|
1653
|
+
get: () => u.current,
|
|
1654
|
+
set: (b) => {
|
|
1655
|
+
const L = b === "admins" ? u.base : `${u.base}/${String(b)}`;
|
|
1656
|
+
L !== r.path && A.push(L);
|
|
1652
1657
|
}
|
|
1653
|
-
}),
|
|
1654
|
-
() => f &&
|
|
1658
|
+
}), W = T(
|
|
1659
|
+
() => f && u.current === "admins" ? [
|
|
1655
1660
|
{
|
|
1656
1661
|
key: "new",
|
|
1657
1662
|
label: m("admins.new-short"),
|
|
1658
1663
|
icon: "plus",
|
|
1659
1664
|
primary: !0,
|
|
1660
1665
|
run: () => {
|
|
1661
|
-
|
|
1666
|
+
F(null);
|
|
1662
1667
|
}
|
|
1663
1668
|
}
|
|
1664
1669
|
] : []
|
|
1665
1670
|
);
|
|
1666
|
-
async function
|
|
1667
|
-
w.value =
|
|
1671
|
+
async function F(b) {
|
|
1672
|
+
w.value = b, await x({ admin: b, avatarField: g }) && p.value?.reload();
|
|
1668
1673
|
}
|
|
1669
|
-
async function
|
|
1674
|
+
async function i(b) {
|
|
1670
1675
|
if (await Ne({
|
|
1671
|
-
title: m("admins.delete-title", { name:
|
|
1676
|
+
title: m("admins.delete-title", { name: b.name }),
|
|
1672
1677
|
message: m("admins.delete-text"),
|
|
1673
1678
|
confirmText: m("admins.delete"),
|
|
1674
1679
|
cancelText: m("admins.cancel"),
|
|
1675
1680
|
tone: "danger"
|
|
1676
1681
|
}))
|
|
1677
1682
|
try {
|
|
1678
|
-
await s.remove(
|
|
1679
|
-
} catch (
|
|
1680
|
-
|
|
1683
|
+
await s.remove(b.id), G.success(m("admins.deleted")), p.value?.reload();
|
|
1684
|
+
} catch (I) {
|
|
1685
|
+
G.danger(U(I));
|
|
1681
1686
|
}
|
|
1682
1687
|
}
|
|
1683
|
-
return (
|
|
1684
|
-
view:
|
|
1685
|
-
"onUpdate:view":
|
|
1688
|
+
return (b, L) => (h(), $(e(Me), {
|
|
1689
|
+
view: P.value,
|
|
1690
|
+
"onUpdate:view": L[0] || (L[0] = (I) => P.value = I),
|
|
1686
1691
|
title: v.value,
|
|
1687
|
-
views:
|
|
1688
|
-
actions:
|
|
1692
|
+
views: _.value,
|
|
1693
|
+
actions: W.value
|
|
1689
1694
|
}, {
|
|
1690
1695
|
default: t(() => [
|
|
1691
1696
|
n.current === "calls" ? (h(), $(Vt, { key: 0 })) : n.current === "connections" ? (h(), $(Je, {
|
|
@@ -1697,8 +1702,8 @@ const Lt = {
|
|
|
1697
1702
|
ref: p,
|
|
1698
1703
|
removable: e(f),
|
|
1699
1704
|
"resolve-avatar": e(c),
|
|
1700
|
-
onOpen:
|
|
1701
|
-
onRemove:
|
|
1705
|
+
onOpen: F,
|
|
1706
|
+
onRemove: i
|
|
1702
1707
|
}, null, 8, ["removable", "resolve-avatar"]))
|
|
1703
1708
|
]),
|
|
1704
1709
|
_: 1
|
|
@@ -1710,39 +1715,39 @@ const Lt = {
|
|
|
1710
1715
|
}, Tt = { class: "wx-content-rules__foot" }, Ut = /* @__PURE__ */ Q({
|
|
1711
1716
|
__name: "ContentRulesCard",
|
|
1712
1717
|
setup(n) {
|
|
1713
|
-
const
|
|
1718
|
+
const u = Z();
|
|
1714
1719
|
te();
|
|
1715
|
-
const l =
|
|
1716
|
-
const v =
|
|
1720
|
+
const l = j("webx-auth"), s = j("webx-admin"), g = me(), c = T(() => {
|
|
1721
|
+
const v = u.state.manifest?.modules.find((_) => _.id === "settings")?.meta?.content_screen;
|
|
1717
1722
|
return typeof v == "string" ? v : null;
|
|
1718
|
-
}), A =
|
|
1723
|
+
}), A = u.can("settings.view") || u.can("settings.manage"), r = u.can("settings.manage"), m = z({}), U = z({}), p = z(!0), w = z(!1), x = `${u.apiPath}/settings/content`;
|
|
1719
1724
|
et(async () => {
|
|
1720
1725
|
if (!(!c.value || !A))
|
|
1721
1726
|
try {
|
|
1722
|
-
const y = await
|
|
1727
|
+
const y = await u.http.get(x);
|
|
1723
1728
|
m.value = y.data.values;
|
|
1724
1729
|
} catch (y) {
|
|
1725
|
-
|
|
1730
|
+
G.danger(g(y));
|
|
1726
1731
|
} finally {
|
|
1727
1732
|
p.value = !1;
|
|
1728
1733
|
}
|
|
1729
1734
|
});
|
|
1730
1735
|
async function f() {
|
|
1731
|
-
w.value = !0,
|
|
1736
|
+
w.value = !0, U.value = {};
|
|
1732
1737
|
try {
|
|
1733
|
-
const y = await
|
|
1738
|
+
const y = await u.http.put(x, {
|
|
1734
1739
|
values: m.value
|
|
1735
1740
|
});
|
|
1736
|
-
m.value = y.data.values,
|
|
1741
|
+
m.value = y.data.values, G.success(s("editor.saved"));
|
|
1737
1742
|
} catch (y) {
|
|
1738
1743
|
const v = y.body;
|
|
1739
|
-
v?.errors && (
|
|
1744
|
+
v?.errors && (U.value = v.errors), G.danger(g(y));
|
|
1740
1745
|
} finally {
|
|
1741
1746
|
w.value = !1;
|
|
1742
1747
|
}
|
|
1743
1748
|
}
|
|
1744
1749
|
return (y, v) => c.value && e(A) ? (h(), Y("section", Wt, [
|
|
1745
|
-
a(e(
|
|
1750
|
+
a(e(de), {
|
|
1746
1751
|
level: 2,
|
|
1747
1752
|
size: "sm"
|
|
1748
1753
|
}, {
|
|
@@ -1759,10 +1764,10 @@ const Lt = {
|
|
|
1759
1764
|
})) : (h(), $(e(lt), {
|
|
1760
1765
|
key: 1,
|
|
1761
1766
|
modelValue: m.value,
|
|
1762
|
-
"onUpdate:modelValue": v[0] || (v[0] = (
|
|
1767
|
+
"onUpdate:modelValue": v[0] || (v[0] = (_) => m.value = _),
|
|
1763
1768
|
name: c.value,
|
|
1764
|
-
errors:
|
|
1765
|
-
disabled: !e(
|
|
1769
|
+
errors: U.value,
|
|
1770
|
+
disabled: !e(r)
|
|
1766
1771
|
}, null, 8, ["modelValue", "name", "errors", "disabled"]))
|
|
1767
1772
|
]),
|
|
1768
1773
|
_: 2
|
|
@@ -1770,8 +1775,8 @@ const Lt = {
|
|
|
1770
1775
|
p.value ? void 0 : {
|
|
1771
1776
|
name: "footer",
|
|
1772
1777
|
fn: t(() => [
|
|
1773
|
-
|
|
1774
|
-
a(e(
|
|
1778
|
+
V("div", Tt, [
|
|
1779
|
+
a(e(O), {
|
|
1775
1780
|
size: "sm",
|
|
1776
1781
|
tone: "muted"
|
|
1777
1782
|
}, {
|
|
@@ -1780,7 +1785,7 @@ const Lt = {
|
|
|
1780
1785
|
]),
|
|
1781
1786
|
_: 1
|
|
1782
1787
|
}),
|
|
1783
|
-
e(
|
|
1788
|
+
e(r) ? (h(), $(e(N), {
|
|
1784
1789
|
key: 0,
|
|
1785
1790
|
type: "primary",
|
|
1786
1791
|
loading: w.value,
|
|
@@ -1790,43 +1795,43 @@ const Lt = {
|
|
|
1790
1795
|
d(o(e(s)("editor.save")), 1)
|
|
1791
1796
|
]),
|
|
1792
1797
|
_: 1
|
|
1793
|
-
}, 8, ["loading"])) :
|
|
1798
|
+
}, 8, ["loading"])) : E("", !0)
|
|
1794
1799
|
])
|
|
1795
1800
|
]),
|
|
1796
1801
|
key: "0"
|
|
1797
1802
|
}
|
|
1798
1803
|
]), 1024)
|
|
1799
|
-
])) :
|
|
1804
|
+
])) : E("", !0);
|
|
1800
1805
|
}
|
|
1801
|
-
}), Pt = /* @__PURE__ */ ve(Ut, [["__scopeId", "data-v-55be157e"]]), Ft = { class: "wx-connect" }, Rt = { class: "wx-connect__section" },
|
|
1806
|
+
}), Pt = /* @__PURE__ */ ve(Ut, [["__scopeId", "data-v-55be157e"]]), Ft = { class: "wx-connect" }, Rt = { class: "wx-connect__section" }, Bt = { class: "wx-connect__row" }, Ot = { class: "wx-connect__url" }, Et = { class: "wx-connect__section" }, Dt = { class: "wx-connect__steps" }, Mt = { class: "wx-connect__steps" }, Nt = { class: "wx-connect__snippet" }, It = { class: "wx-connect__snippet" }, qt = { class: "wx-connect__section" }, Ht = { class: "wx-connect__links" }, Kt = { class: "wx-connect__steps" }, Yt = { class: "wx-connect__section" }, jt = /* @__PURE__ */ Q({
|
|
1802
1807
|
__name: "ConnectPage",
|
|
1803
1808
|
setup(n) {
|
|
1804
|
-
const
|
|
1809
|
+
const u = Z();
|
|
1805
1810
|
te();
|
|
1806
|
-
const l =
|
|
1811
|
+
const l = j("webx-auth"), s = z(!1);
|
|
1807
1812
|
let g;
|
|
1808
|
-
const c =
|
|
1809
|
-
const y =
|
|
1813
|
+
const c = T(() => {
|
|
1814
|
+
const y = u.state.manifest?.modules.find((v) => v.id === "connect")?.meta;
|
|
1810
1815
|
return typeof y?.url == "string" ? y.url : "";
|
|
1811
|
-
}), A =
|
|
1816
|
+
}), A = T(() => {
|
|
1812
1817
|
try {
|
|
1813
1818
|
return new URL(c.value).hostname.split(".")[0] || "webx";
|
|
1814
1819
|
} catch {
|
|
1815
1820
|
return "webx";
|
|
1816
1821
|
}
|
|
1817
|
-
}),
|
|
1818
|
-
url = "${c.value}"`),
|
|
1822
|
+
}), r = T(() => `claude mcp add --transport http ${A.value} ${c.value}`), m = T(() => `[mcp_servers.${A.value}]
|
|
1823
|
+
url = "${c.value}"`), U = T(() => {
|
|
1819
1824
|
const y = w(JSON.stringify({ url: c.value }));
|
|
1820
1825
|
return `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(A.value)}&config=${y}`;
|
|
1821
|
-
}), p =
|
|
1826
|
+
}), p = T(() => {
|
|
1822
1827
|
const y = JSON.stringify({ name: A.value, type: "http", url: c.value });
|
|
1823
1828
|
return `vscode:mcp/install?${encodeURIComponent(y)}`;
|
|
1824
1829
|
});
|
|
1825
1830
|
function w(y) {
|
|
1826
1831
|
const v = new TextEncoder().encode(y);
|
|
1827
|
-
let
|
|
1828
|
-
for (const
|
|
1829
|
-
return encodeURIComponent(btoa(
|
|
1832
|
+
let _ = "";
|
|
1833
|
+
for (const P of v) _ += String.fromCharCode(P);
|
|
1834
|
+
return encodeURIComponent(btoa(_));
|
|
1830
1835
|
}
|
|
1831
1836
|
async function x(y) {
|
|
1832
1837
|
try {
|
|
@@ -1837,7 +1842,7 @@ url = "${c.value}"`), P = U(() => {
|
|
|
1837
1842
|
s.value = !0, clearTimeout(g), g = setTimeout(() => s.value = !1, 2e3);
|
|
1838
1843
|
} catch {
|
|
1839
1844
|
if (f(y)) return;
|
|
1840
|
-
|
|
1845
|
+
G.danger(l("connect.copy-failed"));
|
|
1841
1846
|
}
|
|
1842
1847
|
}
|
|
1843
1848
|
function f(y) {
|
|
@@ -1856,15 +1861,15 @@ url = "${c.value}"`), P = U(() => {
|
|
|
1856
1861
|
card: !1
|
|
1857
1862
|
}, {
|
|
1858
1863
|
default: t(() => [
|
|
1859
|
-
|
|
1860
|
-
a(e(
|
|
1864
|
+
V("div", Ft, [
|
|
1865
|
+
a(e(O), { class: "wx-connect__lead" }, {
|
|
1861
1866
|
default: t(() => [
|
|
1862
1867
|
d(o(e(l)("connect.lead")), 1)
|
|
1863
1868
|
]),
|
|
1864
1869
|
_: 1
|
|
1865
1870
|
}),
|
|
1866
|
-
|
|
1867
|
-
a(e(
|
|
1871
|
+
V("section", Rt, [
|
|
1872
|
+
a(e(de), {
|
|
1868
1873
|
level: 2,
|
|
1869
1874
|
size: "sm"
|
|
1870
1875
|
}, {
|
|
@@ -1875,12 +1880,12 @@ url = "${c.value}"`), P = U(() => {
|
|
|
1875
1880
|
}),
|
|
1876
1881
|
a(e(be), { bordered: "" }, {
|
|
1877
1882
|
default: t(() => [
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
a(e(
|
|
1883
|
+
V("div", Bt, [
|
|
1884
|
+
V("code", Ot, o(c.value), 1),
|
|
1885
|
+
a(e(N), {
|
|
1881
1886
|
type: "primary",
|
|
1882
1887
|
disabled: c.value === "",
|
|
1883
|
-
onClick: v[0] || (v[0] = (
|
|
1888
|
+
onClick: v[0] || (v[0] = (_) => x(c.value))
|
|
1884
1889
|
}, {
|
|
1885
1890
|
icon: t(() => [
|
|
1886
1891
|
a(e(ee), {
|
|
@@ -1897,8 +1902,8 @@ url = "${c.value}"`), P = U(() => {
|
|
|
1897
1902
|
_: 1
|
|
1898
1903
|
})
|
|
1899
1904
|
]),
|
|
1900
|
-
|
|
1901
|
-
a(e(
|
|
1905
|
+
V("section", Et, [
|
|
1906
|
+
a(e(de), {
|
|
1902
1907
|
level: 2,
|
|
1903
1908
|
size: "sm"
|
|
1904
1909
|
}, {
|
|
@@ -1917,10 +1922,10 @@ url = "${c.value}"`), P = U(() => {
|
|
|
1917
1922
|
label: e(l)("connect.claude-title")
|
|
1918
1923
|
}, {
|
|
1919
1924
|
default: t(() => [
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1925
|
+
V("ol", Dt, [
|
|
1926
|
+
V("li", null, o(e(l)("connect.claude-1")), 1),
|
|
1927
|
+
V("li", null, o(e(l)("connect.claude-2")), 1),
|
|
1928
|
+
V("li", null, o(e(l)("connect.claude-3")), 1)
|
|
1924
1929
|
])
|
|
1925
1930
|
]),
|
|
1926
1931
|
_: 1
|
|
@@ -1930,10 +1935,10 @@ url = "${c.value}"`), P = U(() => {
|
|
|
1930
1935
|
label: e(l)("connect.chatgpt-title")
|
|
1931
1936
|
}, {
|
|
1932
1937
|
default: t(() => [
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1938
|
+
V("ol", Mt, [
|
|
1939
|
+
V("li", null, o(e(l)("connect.chatgpt-1")), 1),
|
|
1940
|
+
V("li", null, o(e(l)("connect.chatgpt-2")), 1),
|
|
1941
|
+
V("li", null, o(e(l)("connect.chatgpt-3")), 1)
|
|
1937
1942
|
])
|
|
1938
1943
|
]),
|
|
1939
1944
|
_: 1
|
|
@@ -1943,18 +1948,18 @@ url = "${c.value}"`), P = U(() => {
|
|
|
1943
1948
|
label: e(l)("connect.claude-code-title")
|
|
1944
1949
|
}, {
|
|
1945
1950
|
default: t(() => [
|
|
1946
|
-
a(e(
|
|
1951
|
+
a(e(O), { size: "sm" }, {
|
|
1947
1952
|
default: t(() => [
|
|
1948
1953
|
d(o(e(l)("connect.claude-code-hint")), 1)
|
|
1949
1954
|
]),
|
|
1950
1955
|
_: 1
|
|
1951
1956
|
}),
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
a(e(
|
|
1957
|
+
V("div", Nt, [
|
|
1958
|
+
V("pre", null, o(r.value), 1),
|
|
1959
|
+
a(e(N), {
|
|
1955
1960
|
variant: "text",
|
|
1956
1961
|
size: "sm",
|
|
1957
|
-
onClick: v[1] || (v[1] = (
|
|
1962
|
+
onClick: v[1] || (v[1] = (_) => x(r.value))
|
|
1958
1963
|
}, {
|
|
1959
1964
|
icon: t(() => [
|
|
1960
1965
|
a(e(ee), { name: "copy" })
|
|
@@ -1973,18 +1978,18 @@ url = "${c.value}"`), P = U(() => {
|
|
|
1973
1978
|
label: e(l)("connect.codex-title")
|
|
1974
1979
|
}, {
|
|
1975
1980
|
default: t(() => [
|
|
1976
|
-
a(e(
|
|
1981
|
+
a(e(O), { size: "sm" }, {
|
|
1977
1982
|
default: t(() => [
|
|
1978
1983
|
d(o(e(l)("connect.codex-hint")), 1)
|
|
1979
1984
|
]),
|
|
1980
1985
|
_: 1
|
|
1981
1986
|
}),
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
a(e(
|
|
1987
|
+
V("div", It, [
|
|
1988
|
+
V("pre", null, o(m.value), 1),
|
|
1989
|
+
a(e(N), {
|
|
1985
1990
|
variant: "text",
|
|
1986
1991
|
size: "sm",
|
|
1987
|
-
onClick: v[2] || (v[2] = (
|
|
1992
|
+
onClick: v[2] || (v[2] = (_) => x(m.value))
|
|
1988
1993
|
}, {
|
|
1989
1994
|
icon: t(() => [
|
|
1990
1995
|
a(e(ee), { name: "copy" })
|
|
@@ -2002,8 +2007,8 @@ url = "${c.value}"`), P = U(() => {
|
|
|
2002
2007
|
_: 1
|
|
2003
2008
|
}, 8, ["aria-label"])
|
|
2004
2009
|
]),
|
|
2005
|
-
|
|
2006
|
-
a(e(
|
|
2010
|
+
V("section", qt, [
|
|
2011
|
+
a(e(de), {
|
|
2007
2012
|
level: 2,
|
|
2008
2013
|
size: "sm"
|
|
2009
2014
|
}, {
|
|
@@ -2012,7 +2017,7 @@ url = "${c.value}"`), P = U(() => {
|
|
|
2012
2017
|
]),
|
|
2013
2018
|
_: 1
|
|
2014
2019
|
}),
|
|
2015
|
-
a(e(
|
|
2020
|
+
a(e(O), {
|
|
2016
2021
|
size: "sm",
|
|
2017
2022
|
tone: "muted"
|
|
2018
2023
|
}, {
|
|
@@ -2021,9 +2026,9 @@ url = "${c.value}"`), P = U(() => {
|
|
|
2021
2026
|
]),
|
|
2022
2027
|
_: 1
|
|
2023
2028
|
}),
|
|
2024
|
-
|
|
2025
|
-
a(e(
|
|
2026
|
-
href:
|
|
2029
|
+
V("div", Ht, [
|
|
2030
|
+
a(e(N), {
|
|
2031
|
+
href: U.value,
|
|
2027
2032
|
variant: "outline",
|
|
2028
2033
|
disabled: c.value === "",
|
|
2029
2034
|
class: "wx-connect__link"
|
|
@@ -2036,7 +2041,7 @@ url = "${c.value}"`), P = U(() => {
|
|
|
2036
2041
|
]),
|
|
2037
2042
|
_: 1
|
|
2038
2043
|
}, 8, ["href", "disabled"]),
|
|
2039
|
-
a(e(
|
|
2044
|
+
a(e(N), {
|
|
2040
2045
|
href: p.value,
|
|
2041
2046
|
variant: "outline",
|
|
2042
2047
|
disabled: c.value === "",
|
|
@@ -2057,17 +2062,17 @@ url = "${c.value}"`), P = U(() => {
|
|
|
2057
2062
|
title: e(l)("connect.next")
|
|
2058
2063
|
}, {
|
|
2059
2064
|
default: t(() => [
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2065
|
+
V("ol", Kt, [
|
|
2066
|
+
V("li", null, o(e(l)("connect.next-1")), 1),
|
|
2067
|
+
V("li", null, o(e(l)("connect.next-2")), 1),
|
|
2068
|
+
V("li", null, o(e(l)("connect.next-3")), 1)
|
|
2064
2069
|
])
|
|
2065
2070
|
]),
|
|
2066
2071
|
_: 1
|
|
2067
2072
|
}, 8, ["title"]),
|
|
2068
2073
|
a(Pt),
|
|
2069
|
-
|
|
2070
|
-
a(e(
|
|
2074
|
+
V("section", Yt, [
|
|
2075
|
+
a(e(de), {
|
|
2071
2076
|
level: 2,
|
|
2072
2077
|
size: "sm"
|
|
2073
2078
|
}, {
|
|
@@ -2090,9 +2095,9 @@ url = "${c.value}"`), P = U(() => {
|
|
|
2090
2095
|
}
|
|
2091
2096
|
}), Gt = /* @__PURE__ */ ve(jt, [["__scopeId", "data-v-0eba9ed6"]]);
|
|
2092
2097
|
function va(n = {}) {
|
|
2093
|
-
const
|
|
2094
|
-
render: () =>
|
|
2095
|
-
base:
|
|
2098
|
+
const u = n.path ?? "/admins", l = (s) => ({
|
|
2099
|
+
render: () => Oe(Lt, {
|
|
2100
|
+
base: u,
|
|
2096
2101
|
current: s,
|
|
2097
2102
|
avatarField: n.avatarField,
|
|
2098
2103
|
resolveAvatar: n.resolveAvatar
|
|
@@ -2100,15 +2105,15 @@ function va(n = {}) {
|
|
|
2100
2105
|
});
|
|
2101
2106
|
return {
|
|
2102
2107
|
id: "admins",
|
|
2103
|
-
path:
|
|
2108
|
+
path: u,
|
|
2104
2109
|
routes: [
|
|
2105
|
-
{ path:
|
|
2110
|
+
{ path: u, name: "webx.admins", component: l("admins") },
|
|
2106
2111
|
// What their agents did, and which agents they let in: two more views of the same
|
|
2107
2112
|
// section, each with an address of its own so that its filters survive a trip to the
|
|
2108
2113
|
// people and back.
|
|
2109
|
-
{ path: `${
|
|
2114
|
+
{ path: `${u}/calls`, name: "webx.admins.calls", component: l("calls") },
|
|
2110
2115
|
{
|
|
2111
|
-
path: `${
|
|
2116
|
+
path: `${u}/connections`,
|
|
2112
2117
|
name: "webx.admins.connections",
|
|
2113
2118
|
component: l("connections")
|
|
2114
2119
|
}
|
|
@@ -2116,11 +2121,11 @@ function va(n = {}) {
|
|
|
2116
2121
|
};
|
|
2117
2122
|
}
|
|
2118
2123
|
function pa(n = {}) {
|
|
2119
|
-
const
|
|
2124
|
+
const u = n.path ?? "/connect";
|
|
2120
2125
|
return {
|
|
2121
2126
|
id: "connect",
|
|
2122
|
-
path:
|
|
2123
|
-
routes: [{ path:
|
|
2127
|
+
path: u,
|
|
2128
|
+
routes: [{ path: u, name: "webx.connect", component: Gt }]
|
|
2124
2129
|
};
|
|
2125
2130
|
}
|
|
2126
2131
|
const Jt = /* @__PURE__ */ Q({
|
|
@@ -2131,14 +2136,14 @@ const Jt = /* @__PURE__ */ Q({
|
|
|
2131
2136
|
resolveAvatar: { type: Function, default: void 0 }
|
|
2132
2137
|
},
|
|
2133
2138
|
setup(n) {
|
|
2134
|
-
const
|
|
2139
|
+
const u = n, { open: l, resolve: s, dismiss: g } = xe();
|
|
2135
2140
|
te();
|
|
2136
|
-
const c =
|
|
2141
|
+
const c = j("webx-auth"), A = ue("list"), r = z(0);
|
|
2137
2142
|
function m(p) {
|
|
2138
2143
|
s(p);
|
|
2139
2144
|
}
|
|
2140
|
-
function
|
|
2141
|
-
|
|
2145
|
+
function U(p) {
|
|
2146
|
+
r.value = p.length;
|
|
2142
2147
|
}
|
|
2143
2148
|
return (p, w) => (h(), $(e(ke), {
|
|
2144
2149
|
open: e(l),
|
|
@@ -2152,9 +2157,9 @@ const Jt = /* @__PURE__ */ Q({
|
|
|
2152
2157
|
ref: A,
|
|
2153
2158
|
picking: "",
|
|
2154
2159
|
multiple: n.multiple,
|
|
2155
|
-
"resolve-avatar":
|
|
2160
|
+
"resolve-avatar": u.resolveAvatar,
|
|
2156
2161
|
onChosen: m,
|
|
2157
|
-
onSelection:
|
|
2162
|
+
onSelection: U
|
|
2158
2163
|
}, null, 8, ["multiple", "resolve-avatar"])
|
|
2159
2164
|
]),
|
|
2160
2165
|
_: 2
|
|
@@ -2167,16 +2172,16 @@ const Jt = /* @__PURE__ */ Q({
|
|
|
2167
2172
|
align: "center"
|
|
2168
2173
|
}, {
|
|
2169
2174
|
default: t(() => [
|
|
2170
|
-
a(e(
|
|
2175
|
+
a(e(O), {
|
|
2171
2176
|
size: "sm",
|
|
2172
2177
|
tone: "muted"
|
|
2173
2178
|
}, {
|
|
2174
2179
|
default: t(() => [
|
|
2175
|
-
d(o(e(c)("admins.chosen", { count:
|
|
2180
|
+
d(o(e(c)("admins.chosen", { count: r.value })), 1)
|
|
2176
2181
|
]),
|
|
2177
2182
|
_: 1
|
|
2178
2183
|
}),
|
|
2179
|
-
a(e(
|
|
2184
|
+
a(e(N), {
|
|
2180
2185
|
variant: "outline",
|
|
2181
2186
|
onClick: w[0] || (w[0] = (x) => e(g)())
|
|
2182
2187
|
}, {
|
|
@@ -2185,9 +2190,9 @@ const Jt = /* @__PURE__ */ Q({
|
|
|
2185
2190
|
]),
|
|
2186
2191
|
_: 1
|
|
2187
2192
|
}),
|
|
2188
|
-
a(e(
|
|
2193
|
+
a(e(N), {
|
|
2189
2194
|
type: "primary",
|
|
2190
|
-
disabled:
|
|
2195
|
+
disabled: r.value === 0,
|
|
2191
2196
|
onClick: w[1] || (w[1] = (x) => e(s)(A.value?.chosen() ?? []))
|
|
2192
2197
|
}, {
|
|
2193
2198
|
default: t(() => [
|
|
@@ -2219,19 +2224,19 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2219
2224
|
avatarField: { default: void 0 }
|
|
2220
2225
|
},
|
|
2221
2226
|
setup(n) {
|
|
2222
|
-
const
|
|
2227
|
+
const u = n, { resolve: l, dismiss: s, open: g } = xe(), c = Z(), A = ze();
|
|
2223
2228
|
te();
|
|
2224
|
-
const
|
|
2229
|
+
const r = j("webx-auth"), m = me(), U = z(!1), p = z({}), w = z({
|
|
2225
2230
|
name: c.state.user?.name ?? "",
|
|
2226
2231
|
avatar: c.state.user?.avatar ?? null,
|
|
2227
2232
|
password: "",
|
|
2228
2233
|
current_password: ""
|
|
2229
|
-
}), x =
|
|
2234
|
+
}), x = z(w.value.avatar ? { path: w.value.avatar } : null);
|
|
2230
2235
|
function f(v) {
|
|
2231
2236
|
return p.value[v]?.[0];
|
|
2232
2237
|
}
|
|
2233
2238
|
async function y() {
|
|
2234
|
-
|
|
2239
|
+
U.value = !0, p.value = {};
|
|
2235
2240
|
try {
|
|
2236
2241
|
await A.updateProfile({
|
|
2237
2242
|
name: w.value.name,
|
|
@@ -2239,68 +2244,68 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2239
2244
|
// Blank is left out entirely rather than sent as an empty string: the server reads a
|
|
2240
2245
|
// filled password as "change it", and an empty one would be a change to nothing.
|
|
2241
2246
|
...w.value.password ? { password: w.value.password, current_password: w.value.current_password } : {}
|
|
2242
|
-
}),
|
|
2247
|
+
}), G.success(r("profile.saved")), l(!0);
|
|
2243
2248
|
} catch (v) {
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2249
|
+
const _ = v.body;
|
|
2250
|
+
_?.errors ? p.value = _.errors : G.danger(m(v));
|
|
2246
2251
|
} finally {
|
|
2247
|
-
|
|
2252
|
+
U.value = !1;
|
|
2248
2253
|
}
|
|
2249
2254
|
}
|
|
2250
|
-
return (v,
|
|
2255
|
+
return (v, _) => (h(), $(e(ke), {
|
|
2251
2256
|
open: e(g),
|
|
2252
|
-
"onUpdate:open":
|
|
2253
|
-
title: e(
|
|
2257
|
+
"onUpdate:open": _[5] || (_[5] = (P) => ge(g) ? g.value = P : null),
|
|
2258
|
+
title: e(r)("profile.title"),
|
|
2254
2259
|
width: 560
|
|
2255
2260
|
}, {
|
|
2256
2261
|
footer: t(() => [
|
|
2257
|
-
a(e(
|
|
2258
|
-
onClick:
|
|
2262
|
+
a(e(N), {
|
|
2263
|
+
onClick: _[4] || (_[4] = (P) => e(s)())
|
|
2259
2264
|
}, {
|
|
2260
2265
|
default: t(() => [
|
|
2261
|
-
d(o(e(
|
|
2266
|
+
d(o(e(r)("profile.cancel")), 1)
|
|
2262
2267
|
]),
|
|
2263
2268
|
_: 1
|
|
2264
2269
|
}),
|
|
2265
|
-
a(e(
|
|
2270
|
+
a(e(N), {
|
|
2266
2271
|
type: "primary",
|
|
2267
|
-
loading:
|
|
2272
|
+
loading: U.value,
|
|
2268
2273
|
onClick: y
|
|
2269
2274
|
}, {
|
|
2270
2275
|
default: t(() => [
|
|
2271
|
-
d(o(e(
|
|
2276
|
+
d(o(e(r)("profile.save")), 1)
|
|
2272
2277
|
]),
|
|
2273
2278
|
_: 1
|
|
2274
2279
|
}, 8, ["loading"])
|
|
2275
2280
|
]),
|
|
2276
2281
|
default: t(() => [
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
(h(), $(
|
|
2282
|
+
V("div", Qt, [
|
|
2283
|
+
V("div", Xt, [
|
|
2284
|
+
u.avatarField ? (h(), Y("div", Zt, [
|
|
2285
|
+
(h(), $(Be(u.avatarField), {
|
|
2281
2286
|
modelValue: x.value,
|
|
2282
|
-
"onUpdate:modelValue":
|
|
2283
|
-
label: e(
|
|
2287
|
+
"onUpdate:modelValue": _[0] || (_[0] = (P) => x.value = P),
|
|
2288
|
+
label: e(r)("profile.avatar"),
|
|
2284
2289
|
aspect: "1/1",
|
|
2285
2290
|
captions: !1
|
|
2286
2291
|
}, null, 8, ["modelValue", "label"]))
|
|
2287
|
-
])) :
|
|
2288
|
-
|
|
2289
|
-
a(e(
|
|
2290
|
-
label: e(
|
|
2292
|
+
])) : E("", !0),
|
|
2293
|
+
V("div", ea, [
|
|
2294
|
+
a(e(K), {
|
|
2295
|
+
label: e(r)("profile.name"),
|
|
2291
2296
|
error: f("name")
|
|
2292
2297
|
}, {
|
|
2293
2298
|
default: t(() => [
|
|
2294
2299
|
a(e(le), {
|
|
2295
2300
|
modelValue: w.value.name,
|
|
2296
|
-
"onUpdate:modelValue":
|
|
2301
|
+
"onUpdate:modelValue": _[1] || (_[1] = (P) => w.value.name = P),
|
|
2297
2302
|
name: "name"
|
|
2298
2303
|
}, null, 8, ["modelValue"])
|
|
2299
2304
|
]),
|
|
2300
2305
|
_: 1
|
|
2301
2306
|
}, 8, ["label", "error"]),
|
|
2302
|
-
a(e(
|
|
2303
|
-
label: e(
|
|
2307
|
+
a(e(K), {
|
|
2308
|
+
label: e(r)("admins.email")
|
|
2304
2309
|
}, {
|
|
2305
2310
|
default: t(() => [
|
|
2306
2311
|
a(e(le), {
|
|
@@ -2310,37 +2315,37 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2310
2315
|
]),
|
|
2311
2316
|
_: 1
|
|
2312
2317
|
}, 8, ["label"]),
|
|
2313
|
-
a(e(
|
|
2314
|
-
label: e(
|
|
2315
|
-
help: e(
|
|
2318
|
+
a(e(K), {
|
|
2319
|
+
label: e(r)("profile.password"),
|
|
2320
|
+
help: e(r)("profile.password-hint"),
|
|
2316
2321
|
error: f("password")
|
|
2317
2322
|
}, {
|
|
2318
2323
|
default: t(() => [
|
|
2319
2324
|
a(e(le), {
|
|
2320
2325
|
modelValue: w.value.password,
|
|
2321
|
-
"onUpdate:modelValue":
|
|
2326
|
+
"onUpdate:modelValue": _[2] || (_[2] = (P) => w.value.password = P),
|
|
2322
2327
|
type: "password",
|
|
2323
2328
|
autocomplete: "new-password"
|
|
2324
2329
|
}, null, 8, ["modelValue"])
|
|
2325
2330
|
]),
|
|
2326
2331
|
_: 1
|
|
2327
2332
|
}, 8, ["label", "help", "error"]),
|
|
2328
|
-
w.value.password ? (h(), $(e(
|
|
2333
|
+
w.value.password ? (h(), $(e(K), {
|
|
2329
2334
|
key: 0,
|
|
2330
|
-
label: e(
|
|
2331
|
-
help: e(
|
|
2335
|
+
label: e(r)("profile.current-password"),
|
|
2336
|
+
help: e(r)("profile.current-password-hint"),
|
|
2332
2337
|
error: f("current_password")
|
|
2333
2338
|
}, {
|
|
2334
2339
|
default: t(() => [
|
|
2335
2340
|
a(e(le), {
|
|
2336
2341
|
modelValue: w.value.current_password,
|
|
2337
|
-
"onUpdate:modelValue":
|
|
2342
|
+
"onUpdate:modelValue": _[3] || (_[3] = (P) => w.value.current_password = P),
|
|
2338
2343
|
type: "password",
|
|
2339
2344
|
autocomplete: "current-password"
|
|
2340
2345
|
}, null, 8, ["modelValue"])
|
|
2341
2346
|
]),
|
|
2342
2347
|
_: 1
|
|
2343
|
-
}, 8, ["label", "help", "error"])) :
|
|
2348
|
+
}, 8, ["label", "help", "error"])) : E("", !0)
|
|
2344
2349
|
])
|
|
2345
2350
|
])
|
|
2346
2351
|
])
|
|
@@ -2357,19 +2362,19 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2357
2362
|
expanded: { type: Boolean, default: !1 }
|
|
2358
2363
|
},
|
|
2359
2364
|
setup(n) {
|
|
2360
|
-
const
|
|
2365
|
+
const u = n, l = Z(), s = ze(), g = Ee(), c = nt(), A = j("webx-auth"), r = g.scope("webx-admin"), m = T(() => l.state.user), U = T(
|
|
2361
2366
|
() => g.state.panelLocales.length > 1 ? g.state.panelLocales : []
|
|
2362
|
-
), p = ye(qe, null), w = ye(He, null), x =
|
|
2363
|
-
|
|
2367
|
+
), p = ye(qe, null), w = ye(He, null), x = z(void 0);
|
|
2368
|
+
ce(
|
|
2364
2369
|
() => typeof m.value?.avatar == "string" ? m.value.avatar : null,
|
|
2365
|
-
async (
|
|
2366
|
-
const
|
|
2367
|
-
if (
|
|
2370
|
+
async (F) => {
|
|
2371
|
+
const i = u.resolveAvatar ?? p;
|
|
2372
|
+
if (F === null || F === "" || i === null) {
|
|
2368
2373
|
x.value = void 0;
|
|
2369
2374
|
return;
|
|
2370
2375
|
}
|
|
2371
|
-
const
|
|
2372
|
-
m.value?.avatar ===
|
|
2376
|
+
const b = await i(F);
|
|
2377
|
+
m.value?.avatar === F && (x.value = b ?? void 0);
|
|
2373
2378
|
},
|
|
2374
2379
|
{ immediate: !0 }
|
|
2375
2380
|
);
|
|
@@ -2377,51 +2382,56 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2377
2382
|
function y() {
|
|
2378
2383
|
setTimeout(
|
|
2379
2384
|
() => {
|
|
2380
|
-
f({ avatarField:
|
|
2385
|
+
f({ avatarField: u.avatarField ?? w ?? void 0 });
|
|
2381
2386
|
},
|
|
2382
2387
|
0
|
|
2383
2388
|
);
|
|
2384
2389
|
}
|
|
2385
|
-
const v =
|
|
2390
|
+
const v = T({
|
|
2386
2391
|
get: () => c.state.preference,
|
|
2387
|
-
set: (
|
|
2388
|
-
c.set(
|
|
2392
|
+
set: (F) => {
|
|
2393
|
+
c.set(F), s.setTheme(F);
|
|
2389
2394
|
}
|
|
2390
|
-
})
|
|
2391
|
-
|
|
2392
|
-
|
|
2395
|
+
}), _ = T(
|
|
2396
|
+
() => typeof m.value?.siteBar == "boolean" ? m.value.siteBar : null
|
|
2397
|
+
);
|
|
2398
|
+
function P() {
|
|
2399
|
+
_.value !== null && s.setSiteBar(!_.value);
|
|
2400
|
+
}
|
|
2401
|
+
async function W(F) {
|
|
2402
|
+
F !== g.state.locale && await s.setLocale(F);
|
|
2393
2403
|
}
|
|
2394
|
-
return (
|
|
2395
|
-
const
|
|
2396
|
-
return m.value !== null ? (h(), $(
|
|
2404
|
+
return (F, i) => {
|
|
2405
|
+
const b = H("wx-avatar"), L = H("wx-icon"), I = H("wx-text"), D = H("wx-dropdown-item"), q = H("wx-divider"), k = H("wx-dropdown");
|
|
2406
|
+
return m.value !== null ? (h(), $(k, { key: 0 }, {
|
|
2397
2407
|
trigger: t(() => [
|
|
2398
|
-
|
|
2408
|
+
V("button", {
|
|
2399
2409
|
type: "button",
|
|
2400
2410
|
class: Re(["wx-user-menu__trigger", { "wx-user-menu__trigger--named": n.expanded }]),
|
|
2401
2411
|
title: m.value.name
|
|
2402
2412
|
}, [
|
|
2403
|
-
a(
|
|
2413
|
+
a(b, {
|
|
2404
2414
|
name: m.value.name,
|
|
2405
2415
|
src: x.value,
|
|
2406
2416
|
size: "lg"
|
|
2407
2417
|
}, null, 8, ["name", "src"]),
|
|
2408
|
-
n.expanded ? (h(), Y(
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2418
|
+
n.expanded ? (h(), Y(ie, { key: 0 }, [
|
|
2419
|
+
V("span", na, [
|
|
2420
|
+
V("span", sa, o(m.value.name), 1),
|
|
2421
|
+
V("span", oa, o(m.value.email), 1)
|
|
2412
2422
|
]),
|
|
2413
|
-
a(
|
|
2423
|
+
a(L, {
|
|
2414
2424
|
name: "chevron-up",
|
|
2415
2425
|
size: "sm",
|
|
2416
2426
|
class: "wx-user-menu__chevron"
|
|
2417
2427
|
})
|
|
2418
|
-
], 64)) :
|
|
2428
|
+
], 64)) : E("", !0)
|
|
2419
2429
|
], 10, la)
|
|
2420
2430
|
]),
|
|
2421
2431
|
default: t(() => [
|
|
2422
|
-
a(
|
|
2432
|
+
a(D, { disabled: "" }, {
|
|
2423
2433
|
default: t(() => [
|
|
2424
|
-
a(
|
|
2434
|
+
a(I, { size: "sm" }, {
|
|
2425
2435
|
default: t(() => [
|
|
2426
2436
|
d(o(m.value.email), 1)
|
|
2427
2437
|
]),
|
|
@@ -2430,8 +2440,8 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2430
2440
|
]),
|
|
2431
2441
|
_: 1
|
|
2432
2442
|
}),
|
|
2433
|
-
a(
|
|
2434
|
-
a(
|
|
2443
|
+
a(q, { spacing: "sm" }),
|
|
2444
|
+
a(D, {
|
|
2435
2445
|
icon: "user",
|
|
2436
2446
|
onClick: y
|
|
2437
2447
|
}, {
|
|
@@ -2440,42 +2450,54 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2440
2450
|
]),
|
|
2441
2451
|
_: 1
|
|
2442
2452
|
}),
|
|
2443
|
-
a(
|
|
2444
|
-
a(
|
|
2453
|
+
a(q, { spacing: "sm" }),
|
|
2454
|
+
a(D, { disabled: "" }, {
|
|
2445
2455
|
default: t(() => [
|
|
2446
|
-
a(
|
|
2456
|
+
a(I, {
|
|
2447
2457
|
size: "sm",
|
|
2448
2458
|
tone: "muted"
|
|
2449
2459
|
}, {
|
|
2450
2460
|
default: t(() => [
|
|
2451
|
-
d(o(e(
|
|
2461
|
+
d(o(e(r)("theme.label")), 1)
|
|
2452
2462
|
]),
|
|
2453
2463
|
_: 1
|
|
2454
2464
|
})
|
|
2455
2465
|
]),
|
|
2456
2466
|
_: 1
|
|
2457
2467
|
}),
|
|
2458
|
-
|
|
2468
|
+
V("div", {
|
|
2459
2469
|
class: "wx-user-menu__theme",
|
|
2460
|
-
onClick:
|
|
2470
|
+
onClick: i[1] || (i[1] = Fe(() => {
|
|
2461
2471
|
}, ["stop"]))
|
|
2462
2472
|
}, [
|
|
2463
2473
|
a(e(dt), {
|
|
2464
2474
|
modelValue: v.value,
|
|
2465
|
-
"onUpdate:modelValue":
|
|
2475
|
+
"onUpdate:modelValue": i[0] || (i[0] = (R) => v.value = R),
|
|
2466
2476
|
size: "sm",
|
|
2467
2477
|
block: "",
|
|
2468
|
-
"aria-label": e(
|
|
2469
|
-
"light-label": e(
|
|
2470
|
-
"dark-label": e(
|
|
2471
|
-
"system-label": e(
|
|
2478
|
+
"aria-label": e(r)("theme.label"),
|
|
2479
|
+
"light-label": e(r)("theme.light"),
|
|
2480
|
+
"dark-label": e(r)("theme.dark"),
|
|
2481
|
+
"system-label": e(r)("theme.system")
|
|
2472
2482
|
}, null, 8, ["modelValue", "aria-label", "light-label", "dark-label", "system-label"])
|
|
2473
2483
|
]),
|
|
2474
|
-
|
|
2475
|
-
a(
|
|
2476
|
-
a(
|
|
2484
|
+
_.value !== null ? (h(), Y(ie, { key: 0 }, [
|
|
2485
|
+
a(q, { spacing: "sm" }),
|
|
2486
|
+
a(D, {
|
|
2487
|
+
icon: _.value ? "check" : void 0,
|
|
2488
|
+
onClick: P
|
|
2489
|
+
}, {
|
|
2490
|
+
default: t(() => [
|
|
2491
|
+
d(o(e(A)("menu.site-bar")), 1)
|
|
2492
|
+
]),
|
|
2493
|
+
_: 1
|
|
2494
|
+
}, 8, ["icon"])
|
|
2495
|
+
], 64)) : E("", !0),
|
|
2496
|
+
U.value.length > 0 ? (h(), Y(ie, { key: 1 }, [
|
|
2497
|
+
a(q, { spacing: "sm" }),
|
|
2498
|
+
a(D, { disabled: "" }, {
|
|
2477
2499
|
default: t(() => [
|
|
2478
|
-
a(
|
|
2500
|
+
a(I, {
|
|
2479
2501
|
size: "sm",
|
|
2480
2502
|
tone: "muted"
|
|
2481
2503
|
}, {
|
|
@@ -2487,21 +2509,21 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2487
2509
|
]),
|
|
2488
2510
|
_: 1
|
|
2489
2511
|
}),
|
|
2490
|
-
(h(!0), Y(
|
|
2491
|
-
key:
|
|
2492
|
-
icon:
|
|
2493
|
-
onClick: (
|
|
2512
|
+
(h(!0), Y(ie, null, _e(U.value, (R) => (h(), $(D, {
|
|
2513
|
+
key: R.code,
|
|
2514
|
+
icon: R.code === e(g).state.locale ? "check" : void 0,
|
|
2515
|
+
onClick: (C) => W(R.code)
|
|
2494
2516
|
}, {
|
|
2495
2517
|
default: t(() => [
|
|
2496
|
-
d(o(
|
|
2518
|
+
d(o(R.nativeName), 1)
|
|
2497
2519
|
]),
|
|
2498
2520
|
_: 2
|
|
2499
2521
|
}, 1032, ["icon", "onClick"]))), 128)),
|
|
2500
|
-
a(
|
|
2501
|
-
], 64)) :
|
|
2502
|
-
a(
|
|
2522
|
+
a(q, { spacing: "sm" })
|
|
2523
|
+
], 64)) : E("", !0),
|
|
2524
|
+
a(D, {
|
|
2503
2525
|
icon: "logout",
|
|
2504
|
-
onClick:
|
|
2526
|
+
onClick: i[2] || (i[2] = (R) => e(s).logout())
|
|
2505
2527
|
}, {
|
|
2506
2528
|
default: t(() => [
|
|
2507
2529
|
d(o(n.signOutLabel ?? e(A)("menu.sign-out")), 1)
|
|
@@ -2510,12 +2532,12 @@ const Qt = { class: "wx-profile-host" }, Xt = { class: "wx-profile" }, Zt = {
|
|
|
2510
2532
|
})
|
|
2511
2533
|
]),
|
|
2512
2534
|
_: 1
|
|
2513
|
-
})) :
|
|
2535
|
+
})) : E("", !0);
|
|
2514
2536
|
};
|
|
2515
2537
|
}
|
|
2516
|
-
}), ya = /* @__PURE__ */ ve(ia, [["__scopeId", "data-v-
|
|
2538
|
+
}), ya = /* @__PURE__ */ ve(ia, [["__scopeId", "data-v-22dfea95"]]);
|
|
2517
2539
|
function _a(n = {}) {
|
|
2518
|
-
const
|
|
2540
|
+
const u = n.path ?? "/login";
|
|
2519
2541
|
return {
|
|
2520
2542
|
install(l) {
|
|
2521
2543
|
const s = mt(l.context);
|
|
@@ -2525,19 +2547,19 @@ function _a(n = {}) {
|
|
|
2525
2547
|
n.resolveAvatar ?? Ye(l.context),
|
|
2526
2548
|
n.avatarField ?? Ke(l.context)
|
|
2527
2549
|
), l.context.useSessionLoader(() => s.me()), l.router.addRoute({
|
|
2528
|
-
path:
|
|
2550
|
+
path: u,
|
|
2529
2551
|
name: "webx.login",
|
|
2530
2552
|
meta: { public: !0 },
|
|
2531
|
-
component: { render: () =>
|
|
2532
|
-
}), l.router.beforeEach((g) => g.meta.public === !0 || l.context.state.status !== "unauthenticated" ? !0 : { path:
|
|
2553
|
+
component: { render: () => Oe(yt, { ...n.card }) }
|
|
2554
|
+
}), l.router.beforeEach((g) => g.meta.public === !0 || l.context.state.status !== "unauthenticated" ? !0 : { path: u, query: g.fullPath === "/" ? {} : { next: g.fullPath } }), ce(
|
|
2533
2555
|
() => l.context.state.status,
|
|
2534
2556
|
(g) => {
|
|
2535
2557
|
const c = l.router.currentRoute.value;
|
|
2536
|
-
if (g === "unauthenticated" && c.path !==
|
|
2537
|
-
l.router.replace({ path:
|
|
2558
|
+
if (g === "unauthenticated" && c.path !== u) {
|
|
2559
|
+
l.router.replace({ path: u, query: { next: c.fullPath } });
|
|
2538
2560
|
return;
|
|
2539
2561
|
}
|
|
2540
|
-
if (g === "ready" && c.path ===
|
|
2562
|
+
if (g === "ready" && c.path === u) {
|
|
2541
2563
|
const A = c.query.next;
|
|
2542
2564
|
if (typeof A == "string" && ra(A)) {
|
|
2543
2565
|
location.assign(A);
|
|
@@ -2561,7 +2583,7 @@ function ra(n) {
|
|
|
2561
2583
|
}
|
|
2562
2584
|
export {
|
|
2563
2585
|
Ge as WxAdminList,
|
|
2564
|
-
|
|
2586
|
+
Lt as WxAdminsPage,
|
|
2565
2587
|
Vt as WxAgentCallList,
|
|
2566
2588
|
Gt as WxConnectPage,
|
|
2567
2589
|
Je as WxConnectionList,
|