@wssto2/vue-core 0.5.3 → 0.6.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +3 -1
  3. package/dist/{ActionRow.vue_vue_type_script_setup_true_lang-Bv-APkGf.js → ActionRow.vue_vue_type_script_setup_true_lang-D8NCXX4p.js} +1 -1
  4. package/dist/{Activity-DUjDaPfP.js → Activity-DGodh6BU.js} +4 -4
  5. package/dist/{Changes-B0tZO6BZ.js → Changes-38u4xY6e.js} +3 -3
  6. package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-o_Pj-JcD.js → CollectionPage.vue_vue_type_script_setup_true_lang-DPcCnrjr.js} +3 -3
  7. package/dist/{DateField.vue_vue_type_script_setup_true_lang-CDg31ZU7.js → DateField.vue_vue_type_script_setup_true_lang-BxUuUypB.js} +1 -1
  8. package/dist/{DeadLetters-IgVHao84.js → DeadLetters-CeHfhFHP.js} +6 -5
  9. package/dist/{FormGroup.vue_vue_type_script_setup_true_lang-CSgT4ITL.js → FormGroup.vue_vue_type_script_setup_true_lang-CNb2CK01.js} +1 -1
  10. package/dist/{FormView.vue_vue_type_script_setup_true_lang-D31Hk3pJ.js → FormView.vue_vue_type_script_setup_true_lang-nyz8EkzM.js} +1 -1
  11. package/dist/{General-C40HxupS.js → General-BNTjPvat.js} +6 -6
  12. package/dist/{NewRolePage-Bhy8KJO1.js → NewRolePage-Btg7gzzH.js} +7 -6
  13. package/dist/{NumberField.vue_vue_type_script_setup_true_lang-BdS7BxuS.js → NumberField.vue_vue_type_script_setup_true_lang-C8um4ARi.js} +1 -1
  14. package/dist/PersonAccess.vue_vue_type_script_setup_true_lang-ClmawvYm.js +600 -0
  15. package/dist/{ProfilePage-Bf7dFzGd.js → ProfilePage-CoZyG11N.js} +9 -9
  16. package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-C6oloGIh.js → RoleEditor.vue_vue_type_script_setup_true_lang-Bs9bo0Zb.js} +30 -29
  17. package/dist/{RolePage-BjbvciTg.js → RolePage-CPlwZA6X.js} +37 -35
  18. package/dist/{RolesPage-DzVOgF4z.js → RolesPage-CdYdIHR4.js} +29 -27
  19. package/dist/{SegmentedField.vue_vue_type_script_setup_true_lang-DXe_iOS8.js → SegmentedField.vue_vue_type_script_setup_true_lang-B_hBL5f4.js} +1 -1
  20. package/dist/{SelectField.vue_vue_type_script_setup_true_lang-BN4vzvV9.js → SelectField.vue_vue_type_script_setup_true_lang-CBZhGNpm.js} +4 -4
  21. package/dist/ServiceAccountDialog.vue_vue_type_script_setup_true_lang-DuvSSBbX.js +126 -0
  22. package/dist/ServiceAccountRecord-BtaUZuWU.js +511 -0
  23. package/dist/ServiceAccountsList-CcRJvNaf.js +137 -0
  24. package/dist/{SessionList.vue_vue_type_script_setup_true_lang-PuWIK-Wa.js → SessionList.vue_vue_type_script_setup_true_lang-VvBB2EZz.js} +2 -2
  25. package/dist/{Sessions-CRUObe5G.js → Sessions-DkGNO1FO.js} +2 -2
  26. package/dist/{SettingsPage-C0qEC0uI.js → SettingsPage-D4G1HGbG.js} +8 -8
  27. package/dist/{SignIn-Uy0Jujzz.js → SignIn-DS1YymqD.js} +4 -4
  28. package/dist/{SignInPage-CpVZfrLZ.js → SignInPage-BrmL0PUw.js} +3 -3
  29. package/dist/{SignIns-Cp5Gx2dk.js → SignIns-C7l7IPHQ.js} +1 -1
  30. package/dist/{SwitchField.vue_vue_type_script_setup_true_lang-Dj5Aq8QT.js → SwitchField.vue_vue_type_script_setup_true_lang-DXZK89A3.js} +1 -1
  31. package/dist/{TextField.vue_vue_type_script_setup_true_lang-BwfNNQEz.js → TextField.vue_vue_type_script_setup_true_lang-CX3LdZLK.js} +2 -2
  32. package/dist/{TextareaField.vue_vue_type_script_setup_true_lang-aT1P8Xqr.js → TextareaField.vue_vue_type_script_setup_true_lang-BOtn_1GT.js} +1 -1
  33. package/dist/{TimeField.vue_vue_type_script_setup_true_lang-jPKPE1hc.js → TimeField.vue_vue_type_script_setup_true_lang-CbflIrq6.js} +1 -1
  34. package/dist/{UserRecord-DbSMnTbj.js → UserRecord-Du8M_kuk.js} +25 -25
  35. package/dist/{UsersList-9MicE2pG.js → UsersList-D3ydQice.js} +13 -13
  36. package/dist/access/api.d.ts +7 -8
  37. package/dist/access/context.d.ts +2 -7
  38. package/dist/access/feature.d.ts +0 -8
  39. package/dist/access/index.js +47 -15
  40. package/dist/client/client.d.ts +2 -2
  41. package/dist/client/index.d.ts +1 -1
  42. package/dist/client/route.d.ts +22 -3
  43. package/dist/collection/http.d.ts +3 -2
  44. package/dist/collection/index.js +17 -16
  45. package/dist/form/index.js +586 -611
  46. package/dist/http-nz92KjdS.js +42 -0
  47. package/dist/i18n/index.js +32 -32
  48. package/dist/identity/index.d.ts +7 -0
  49. package/dist/identity/index.js +19 -15
  50. package/dist/identity/serviceaccounts/ApiKeysPanel.vue.d.ts +17 -0
  51. package/dist/identity/serviceaccounts/CreatedApiKeyDialog.vue.d.ts +53 -0
  52. package/dist/identity/serviceaccounts/NewApiKeyDialog.vue.d.ts +24 -0
  53. package/dist/identity/serviceaccounts/ServiceAccountDialog.vue.d.ts +22 -0
  54. package/dist/identity/serviceaccounts/ServiceAccountRecord.vue.d.ts +2 -0
  55. package/dist/identity/serviceaccounts/ServiceAccountsList.vue.d.ts +2 -0
  56. package/dist/identity/serviceaccounts/access.d.ts +4 -0
  57. package/dist/identity/serviceaccounts/api.d.ts +27 -0
  58. package/dist/identity/serviceaccounts/context.d.ts +14 -0
  59. package/dist/identity/serviceaccounts/feature.d.ts +23 -0
  60. package/dist/identity/serviceaccounts/form.d.ts +4 -0
  61. package/dist/identity/serviceaccounts/messages.d.ts +11 -0
  62. package/dist/identity/serviceaccounts/routes.d.ts +22 -0
  63. package/dist/{index-Ok29ucE3.js → index-Cmj9iZmT.js} +191 -168
  64. package/dist/{index-C-oM_Mnf.js → index-DH0MoFqg.js} +2 -2
  65. package/dist/index.d.ts +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/internal/copyText.d.ts +5 -0
  68. package/dist/modules/access/routes.d.ts +13 -13
  69. package/dist/modules/events/routes.d.ts +4 -4
  70. package/dist/modules/identity/routes.d.ts +31 -31
  71. package/dist/modules/notification/routes.d.ts +16 -16
  72. package/dist/modules/serviceaccount/entities.d.ts +127 -0
  73. package/dist/modules/serviceaccount/routes.d.ts +58 -0
  74. package/dist/modules/serviceaccount/schemas.d.ts +49 -0
  75. package/dist/{neighbors-Bv6vnWlW.js → neighbors-DNZuGlQH.js} +1 -1
  76. package/dist/notifications/index.js +1 -1
  77. package/dist/{options-Bu0XbEpN.js → options-e_CAfvDQ.js} +3 -3
  78. package/dist/phone/index.js +1 -1
  79. package/dist/refusals-COPr15XZ.js +135 -0
  80. package/dist/routes-CVckt7Pj.js +19 -0
  81. package/dist/state-BC1Fc6U2.js +154 -0
  82. package/dist/{status-C78NpXyB.js → status-C8XtnK6m.js} +7 -6
  83. package/dist/styles.css +1 -1
  84. package/dist/{suggestions-ClyLexMO.js → suggestions-cPjs5gQz.js} +1 -1
  85. package/dist/{useCommand-DyuPTosF.js → useCommand-CfG727e8.js} +1 -1
  86. package/dist/{useGroupSheet-C2NyqWRp.js → useGroupSheet-BVcNDWbP.js} +2 -2
  87. package/dist/useRecordDialog-D65FF85F.js +30 -0
  88. package/package.json +2 -2
  89. package/dist/http-CdQowFlW.js +0 -194
  90. package/dist/index-BdGnA1Jh.js +0 -765
@@ -0,0 +1,126 @@
1
+ import { defineComponent as I, computed as K, ref as V, openBlock as A, createBlock as k, unref as e, withCtx as b, createElementVNode as B, createVNode as p, mergeProps as f, createCommentVNode as D } from "vue";
2
+ import { useI18n as G } from "vue-i18n";
3
+ import { f as T, u as U } from "./refusals-COPr15XZ.js";
4
+ import { _ as x } from "./FormGroup.vue_vue_type_script_setup_true_lang-CNb2CK01.js";
5
+ import { u as M, _ as N } from "./SelectField.vue_vue_type_script_setup_true_lang-CBZhGNpm.js";
6
+ import { _ as Z } from "./TextareaField.vue_vue_type_script_setup_true_lang-BOtn_1GT.js";
7
+ import { _ as j } from "./TextField.vue_vue_type_script_setup_true_lang-CX3LdZLK.js";
8
+ import { _ as F } from "./useCommand-CfG727e8.js";
9
+ import { u as H } from "./useRecordDialog-D65FF85F.js";
10
+ import { t as J } from "./toast-CqSDTWRX.js";
11
+ import { u as S } from "./platform-Dx6STiwY.js";
12
+ import { i as Q, f as W, M as X } from "./index-Cmj9iZmT.js";
13
+ import { r as Y } from "./http-nz92KjdS.js";
14
+ import { s as l } from "./routes-CVckt7Pj.js";
15
+ import { u as ee } from "./fieldMessages-DTXpWnBd.js";
16
+ const y = (o) => ({ headers: { "Idempotency-Key": o } }), O = 500;
17
+ function ae(o) {
18
+ return {
19
+ list: async (s) => (await o.request(l.index, void 0, s)).data.service_accounts,
20
+ show: async (s, t) => (await o.request(l.show, { id: s }, t)).data,
21
+ create: async (s, t) => (await o.request(l.create, s, y(t))).data,
22
+ update: async (s, t, c) => (await o.request(l.update, { ...t, id: s }, y(c))).data,
23
+ deactivate: async (s) => (await o.request(l.deactivate, { id: s })).data,
24
+ keys: async (s, t) => (await o.request(l.keys, { id: s }, t)).data.keys,
25
+ /** The secret is in the answer, and only there. */
26
+ createKey: async (s, t, c) => (await o.request(l.createkey, { ...t, id: s }, y(c))).data,
27
+ revokeKey: async (s, t) => void await o.request(l.revokekey, { id: s, keyID: t }),
28
+ /** The people who can answer for an account: the active ones of the users list (its largest page). */
29
+ people: async (s) => Y(await o.request(Q.usersList, { view: "active", order_col: "name", order_dir: "asc", page: 1, per_page: O }, s), { page: 1, pageSize: O }).rows.map((t) => ({ id: t.id, name: t.name }))
30
+ };
31
+ }
32
+ const se = () => ae(S().http);
33
+ function te() {
34
+ const o = ee(), s = T();
35
+ return { ...o, failureMessage: (t, c) => s(t, c) ?? o.failureMessage(t, c) };
36
+ }
37
+ const ne = {
38
+ class: "flex min-w-0 flex-col gap-group-gap",
39
+ "data-test": "service-account-form"
40
+ }, h = 0, he = /* @__PURE__ */ I({
41
+ __name: "ServiceAccountDialog",
42
+ emits: ["saved"],
43
+ setup(o, { expose: s, emit: t }) {
44
+ const c = t, { t: r } = G(), { access: C } = S(), L = U(), _ = se(), { tenants: u } = W(), P = te(), v = K(() => {
45
+ const a = C.held(X);
46
+ return a !== null && a.scope.id === void 0;
47
+ }), R = (a) => a.trim() === "", d = H({
48
+ ...P,
49
+ defaults: () => ({ name: "", description: "", tenant_id: u !== null && v.value ? h : null, owner_id: null }),
50
+ validator: {
51
+ safeParse(a) {
52
+ const n = a, i = [], w = r("core.account.validation.required"), q = r("core.serviceaccounts.errors.too_long");
53
+ return R(n.name) ? i.push({ path: ["name"], message: w }) : n.name.trim().length > 100 && i.push({ path: ["name"], message: q }), n.description.length > 500 && i.push({ path: ["description"], message: q }), n.owner_id === null && i.push({ path: ["owner_id"], message: w }), u !== null && n.tenant_id === null && i.push({ path: ["tenant_id"], message: w }), i.length > 0 || n.owner_id === null ? { success: !1, error: { issues: i } } : { success: !0, data: { name: n.name.trim(), description: n.description, tenant_id: u === null ? null : n.tenant_id || null, owner_id: n.owner_id } };
54
+ }
55
+ },
56
+ toValues: (a) => ({ name: a.name, description: a.description, tenant_id: a.tenant?.id ?? (v.value ? h : null), owner_id: a.owner.id }),
57
+ create: (a, { idempotencyKey: n }) => _.create(a, n),
58
+ update: (a, n, { idempotencyKey: i }) => _.update(a.id, n, i),
59
+ done: (a) => {
60
+ J.success(r("core.serviceaccounts.toasts.saved")), c("saved", a);
61
+ }
62
+ }), m = d.form, g = V(!1), $ = M({
63
+ for: () => g.value && u !== null ? !0 : null,
64
+ load: async (a, { signal: n }) => [
65
+ ...v.value ? [{ value: h, label: L.levelLabel("organization") }] : [],
66
+ ...(await (u?.options(n) ?? [])).map((i) => ({ value: i.id, label: i.name }))
67
+ ]
68
+ }), z = M({
69
+ for: () => g.value ? !0 : null,
70
+ load: async (a, { signal: n }) => (await _.people({ signal: n })).map((i) => ({ value: i.id, label: i.name }))
71
+ });
72
+ function E(a) {
73
+ g.value = !0, a ? d.edit(a) : d.create();
74
+ }
75
+ return s({ show: E, form: m }), (a, n) => (A(), k(e(F), {
76
+ command: e(d).command,
77
+ size: "md",
78
+ title: e(d).editing.value ? e(r)("core.serviceaccounts.edit_title") : e(r)("core.serviceaccounts.create_title"),
79
+ subtitle: e(r)("core.serviceaccounts.no_password"),
80
+ "confirm-label": e(r)("core.serviceaccounts.save")
81
+ }, {
82
+ default: b(() => [
83
+ B("div", ne, [
84
+ p(e(x), null, {
85
+ default: b(() => [
86
+ p(e(j), f(e(m).bind("name"), {
87
+ label: e(r)("core.serviceaccounts.fields.name"),
88
+ "max-length": 100,
89
+ required: ""
90
+ }), null, 16, ["label"]),
91
+ p(e(Z), f(e(m).bind("description"), {
92
+ label: e(r)("core.serviceaccounts.fields.description"),
93
+ rows: 2,
94
+ "max-length": 500
95
+ }), null, 16, ["label"])
96
+ ]),
97
+ _: 1
98
+ }),
99
+ p(e(x), {
100
+ footer: e(r)("core.serviceaccounts.fields.owner_hint")
101
+ }, {
102
+ default: b(() => [
103
+ e(u) ? (A(), k(e(N), f({ key: 0 }, e(m).bind("tenant_id"), {
104
+ label: e(r)(e(u).labelKey),
105
+ options: e($),
106
+ required: ""
107
+ }), null, 16, ["label", "options"])) : D("", !0),
108
+ p(e(N), f(e(m).bind("owner_id"), {
109
+ label: e(r)("core.serviceaccounts.fields.owner"),
110
+ options: e(z),
111
+ required: ""
112
+ }), null, 16, ["label", "options"])
113
+ ]),
114
+ _: 1
115
+ }, 8, ["footer"])
116
+ ])
117
+ ]),
118
+ _: 1
119
+ }, 8, ["command", "title", "subtitle", "confirm-label"]));
120
+ }
121
+ });
122
+ export {
123
+ he as _,
124
+ te as a,
125
+ se as u
126
+ };
@@ -0,0 +1,511 @@
1
+ import { defineComponent as P, useTemplateRef as F, ref as N, openBlock as r, createBlock as _, unref as e, withCtx as o, createElementBlock as E, createVNode as s, createElementVNode as D, toDisplayString as w, createTextVNode as R, createCommentVNode as L, mergeProps as Z, computed as K, Fragment as se, renderList as oe, createSlots as ne } from "vue";
2
+ import { useI18n as q } from "vue-i18n";
3
+ import { useRoute as re } from "vue-router";
4
+ import { u as le } from "./refusals-COPr15XZ.js";
5
+ import { a as ie } from "./PersonAccess.vue_vue_type_script_setup_true_lang-ClmawvYm.js";
6
+ import { _ as ee } from "./IconTile.vue_vue_type_script_setup_true_lang-_FXvaj93.js";
7
+ import { _ as ue } from "./Tabs.vue_vue_type_script_setup_true_lang-CcMcE38r.js";
8
+ import { _ as V } from "./FormGroup.vue_vue_type_script_setup_true_lang-CNb2CK01.js";
9
+ import { g as p } from "./options-e_CAfvDQ.js";
10
+ import { u as Q } from "./format-D8X4zsx6.js";
11
+ import { _ as te } from "./AlertDialog.vue_vue_type_script_setup_true_lang-whA4WLdl.js";
12
+ import { t as j } from "./toast-CqSDTWRX.js";
13
+ import { _ as de } from "./RecordHeader.vue_vue_type_script_setup_true_lang-fmx0f8xi.js";
14
+ import { u as ae } from "./platform-Dx6STiwY.js";
15
+ import { u as me, a as ve } from "./routeResource-CcYA75T2.js";
16
+ import { a as fe } from "./ResourcePage.vue_vue_type_script_setup_true_lang-BFBGvevP.js";
17
+ import { _ as O } from "./Badge.vue_vue_type_script_setup_true_lang-DJyZc0C7.js";
18
+ import { M as ce, R as _e, f as pe, s as ye } from "./index-Cmj9iZmT.js";
19
+ import { u as W, a as X, _ as ke } from "./ServiceAccountDialog.vue_vue_type_script_setup_true_lang-DuvSSBbX.js";
20
+ import { _ as J } from "./Button.vue_vue_type_script_setup_true_lang-CL9Qh5yq.js";
21
+ import { _ as be } from "./AsyncSection.vue_vue_type_script_setup_true_lang-B0NfvG3B.js";
22
+ import { _ as ge } from "./Modal.vue_vue_type_script_setup_true_lang-DpBb8ans.js";
23
+ import { _ as xe } from "./Banner.vue_vue_type_script_setup_true_lang-DSStj_5z.js";
24
+ import { _ as we } from "./DateField.vue_vue_type_script_setup_true_lang-BxUuUypB.js";
25
+ import { _ as $e } from "./TextField.vue_vue_type_script_setup_true_lang-CX3LdZLK.js";
26
+ import { u as he, _ as Ce } from "./useCommand-CfG727e8.js";
27
+ async function Se(u) {
28
+ try {
29
+ return await navigator.clipboard.writeText(u), !0;
30
+ } catch {
31
+ }
32
+ const t = document.createElement("textarea");
33
+ t.value = u, t.setAttribute("readonly", ""), t.style.position = "fixed", t.style.opacity = "0", document.body.append(t), t.select();
34
+ try {
35
+ return document.execCommand("copy");
36
+ } catch {
37
+ return !1;
38
+ } finally {
39
+ t.remove();
40
+ }
41
+ }
42
+ const Ae = {
43
+ key: 0,
44
+ class: "flex min-w-0 flex-col gap-group-gap",
45
+ "data-test": "created-api-key"
46
+ }, Ke = { class: "flex min-w-0 items-center gap-3" }, De = {
47
+ class: "min-w-0 flex-1 break-all rounded-control bg-fill px-3 py-2 font-mono text-body text-content-strong select-all",
48
+ "data-test": "api-key-secret"
49
+ }, Re = {
50
+ class: "contents",
51
+ "data-test": "copy-api-key"
52
+ }, Le = { "data-test": "api-key-once" }, Te = /* @__PURE__ */ P({
53
+ __name: "CreatedApiKeyDialog",
54
+ props: {
55
+ account: {}
56
+ },
57
+ emits: ["done"],
58
+ setup(u, { expose: t, emit: k }) {
59
+ const l = u, g = k, { t: c } = q(), $ = Q(), d = F("dialog"), m = N(null), i = N(!1);
60
+ function n(C) {
61
+ m.value = C, i.value = !1, d.value?.present();
62
+ }
63
+ async function v() {
64
+ m.value && await Se(m.value.secret) && j.success(c("core.serviceaccounts.keys.copied"));
65
+ }
66
+ function x() {
67
+ i.value = !0, d.value?.dismiss(), m.value = null, g("done");
68
+ }
69
+ const h = () => i.value;
70
+ return t({ show: n, done: x, copySecret: v, created: m }), (C, A) => (r(), _(e(ge), {
71
+ ref_key: "dialog",
72
+ ref: d,
73
+ title: e(c)("core.serviceaccounts.keys.created_title"),
74
+ subtitle: l.account.name,
75
+ size: "md",
76
+ grouped: "",
77
+ "before-dismiss": h,
78
+ "without-close-button": "",
79
+ "primary-label": e(c)("core.serviceaccounts.keys.saved_it"),
80
+ onPrimary: x
81
+ }, {
82
+ default: o(() => [
83
+ m.value ? (r(), E("div", Ae, [
84
+ s(e(V), null, {
85
+ default: o(() => [
86
+ s(e(p), { layout: "stacked" }, {
87
+ default: o(() => [
88
+ D("div", Ke, [
89
+ D("code", De, w(m.value.secret), 1),
90
+ D("span", Re, [
91
+ s(e(J), {
92
+ prominence: "secondary",
93
+ icon: "copy",
94
+ onClick: v
95
+ }, {
96
+ default: o(() => [
97
+ R(w(e(c)("core.serviceaccounts.keys.copy")), 1)
98
+ ]),
99
+ _: 1
100
+ })
101
+ ])
102
+ ])
103
+ ]),
104
+ _: 1
105
+ })
106
+ ]),
107
+ _: 1
108
+ }),
109
+ D("div", Le, [
110
+ s(e(xe), {
111
+ tone: "warning",
112
+ icon: "alertTriangle"
113
+ }, {
114
+ default: o(() => [
115
+ R(w(e(c)("core.serviceaccounts.keys.once")), 1)
116
+ ]),
117
+ _: 1
118
+ })
119
+ ]),
120
+ s(e(V), null, {
121
+ default: o(() => [
122
+ s(e(p), {
123
+ layout: "setting",
124
+ label: e(c)("core.serviceaccounts.keys.fields.name"),
125
+ value: m.value.key.name
126
+ }, null, 8, ["label", "value"]),
127
+ s(e(p), {
128
+ layout: "setting",
129
+ label: e(c)("core.serviceaccounts.title"),
130
+ value: l.account.name
131
+ }, null, 8, ["label", "value"]),
132
+ s(e(p), {
133
+ layout: "setting",
134
+ label: e(c)("core.serviceaccounts.keys.fields.expires"),
135
+ value: m.value.key.expires_at ? e($).date(m.value.key.expires_at) : e(c)("core.serviceaccounts.keys.no_expiry")
136
+ }, null, 8, ["label", "value"])
137
+ ]),
138
+ _: 1
139
+ })
140
+ ])) : L("", !0)
141
+ ]),
142
+ _: 1
143
+ }, 8, ["title", "subtitle", "primary-label"]));
144
+ }
145
+ });
146
+ function Fe(u) {
147
+ if (!u) return null;
148
+ const [t, k, l] = u.split("-").map(Number);
149
+ return !t || !k || !l ? null : new Date(t, k - 1, l, 23, 59, 59).toISOString();
150
+ }
151
+ function Ne(u = /* @__PURE__ */ new Date()) {
152
+ return `${u.getFullYear()}-${String(u.getMonth() + 1).padStart(2, "0")}-${String(u.getDate()).padStart(2, "0")}`;
153
+ }
154
+ const Ee = {
155
+ class: "flex min-w-0 flex-col gap-group-gap",
156
+ "data-test": "new-api-key"
157
+ }, Ve = /* @__PURE__ */ P({
158
+ __name: "NewApiKeyDialog",
159
+ props: {
160
+ account: {}
161
+ },
162
+ emits: ["created"],
163
+ setup(u, { expose: t, emit: k }) {
164
+ const l = u, g = k, { t: c } = q(), $ = W(), d = X(), i = he({
165
+ ...d,
166
+ defaults: () => ({ name: "", expires: null }),
167
+ validator: {
168
+ safeParse(n) {
169
+ const { name: v, expires: x } = n;
170
+ return v.trim() === "" ? { success: !1, error: { issues: [{ path: ["name"], message: c("core.account.validation.required") }] } } : { success: !0, data: { name: v.trim(), expires_at: Fe(x) } };
171
+ }
172
+ },
173
+ // The server's complaint about `expires_at` belongs to the field called `expires`.
174
+ serverField: (n) => n === "expires_at" ? "expires" : n,
175
+ run: (n, { idempotencyKey: v }) => $.createKey(l.account.id, n, v),
176
+ done: (n) => g("created", n)
177
+ });
178
+ return t({ show: () => i.present(), form: i.form }), (n, v) => (r(), _(e(Ce), {
179
+ command: e(i),
180
+ size: "md",
181
+ title: e(c)("core.serviceaccounts.keys.new_title"),
182
+ subtitle: l.account.name,
183
+ "confirm-label": e(c)("core.serviceaccounts.keys.create")
184
+ }, {
185
+ default: o(() => [
186
+ D("div", Ee, [
187
+ s(e(V), {
188
+ footer: e(c)("core.serviceaccounts.keys.new_footer")
189
+ }, {
190
+ default: o(() => [
191
+ s(e($e), Z(e(i).form.bind("name"), {
192
+ label: e(c)("core.serviceaccounts.keys.fields.name"),
193
+ "max-length": 100,
194
+ required: "",
195
+ placeholder: e(c)("core.serviceaccounts.keys.fields.name_placeholder")
196
+ }), null, 16, ["label", "placeholder"]),
197
+ s(e(we), Z(e(i).form.bind("expires"), {
198
+ label: e(c)("core.serviceaccounts.keys.fields.expires"),
199
+ hint: e(c)("core.serviceaccounts.keys.fields.expires_hint"),
200
+ min: e(Ne)()
201
+ }), null, 16, ["label", "hint", "min"])
202
+ ]),
203
+ _: 1
204
+ }, 8, ["footer"])
205
+ ])
206
+ ]),
207
+ _: 1
208
+ }, 8, ["command", "title", "subtitle", "confirm-label"]));
209
+ }
210
+ }), je = {
211
+ class: "flex min-w-0 flex-col gap-group-gap",
212
+ "data-test": "api-keys"
213
+ }, Me = ["data-test"], ze = {
214
+ class: "contents",
215
+ "data-test": "new-api-key-action"
216
+ }, Oe = /* @__PURE__ */ P({
217
+ __name: "ApiKeysPanel",
218
+ props: {
219
+ account: {}
220
+ },
221
+ emits: ["changed"],
222
+ setup(u, { expose: t, emit: k }) {
223
+ const l = u, g = k, { t: c } = q(), { access: $ } = ae(), d = Q(), m = W(), i = X(), n = me({ for: () => l.account.id, load: (a, { signal: f }) => m.keys(a, { signal: f }) }), v = () => n.reload(), x = F("newKey"), h = F("createdKey"), C = F("revokeConfirm"), A = N(null), M = K(() => !l.account.deactivated_at), B = K(() => $.can(ce)), z = K(() => $.can(_e)), T = (a) => a.expires_at !== null && new Date(a.expires_at).getTime() < Date.now();
224
+ function I(a) {
225
+ return [
226
+ `${a.prefix}…`,
227
+ c("core.serviceaccounts.keys.made_by", { name: a.created_by.name, date: d.date(a.created_at) }),
228
+ a.last_used_at ? c("core.serviceaccounts.keys.last_used", { at: d.dateTime(a.last_used_at) }) : c("core.serviceaccounts.keys.never_used"),
229
+ a.expires_at ? c("core.serviceaccounts.keys.expires", { date: d.date(a.expires_at) }) : c("core.serviceaccounts.keys.no_expiry")
230
+ ].join(" · ");
231
+ }
232
+ async function U() {
233
+ await v(), g("changed");
234
+ }
235
+ function Y(a) {
236
+ A.value = a, C.value?.present();
237
+ }
238
+ async function G() {
239
+ const a = A.value;
240
+ a && (await m.revokeKey(l.account.id, a.id), j.success(c("core.serviceaccounts.keys.revoked_toast")), A.value = null, await v(), g("changed"));
241
+ }
242
+ const S = (a) => j.error(i.sentence(a, c("core.serviceaccounts.keys.errors.revoke"))), y = (a) => h.value?.show(a);
243
+ return t({ reload: v }), (a, f) => (r(), E("div", je, [
244
+ s(e(be), {
245
+ state: e(n).state.value,
246
+ "skeleton-rows": 3,
247
+ "is-empty": () => !1,
248
+ onRetry: f[1] || (f[1] = (H) => v())
249
+ }, {
250
+ default: o(({ value: H }) => [
251
+ s(e(V), {
252
+ header: e(c)("core.serviceaccounts.keys.title"),
253
+ footer: e(c)("core.serviceaccounts.keys.footer")
254
+ }, {
255
+ default: o(() => [
256
+ H.length === 0 ? (r(), _(e(p), {
257
+ key: 0,
258
+ layout: "setting",
259
+ label: e(c)("core.serviceaccounts.keys.empty_title"),
260
+ sub: e(c)("core.serviceaccounts.keys.empty_description")
261
+ }, null, 8, ["label", "sub"])) : L("", !0),
262
+ (r(!0), E(se, null, oe(H, (b) => (r(), _(e(p), {
263
+ key: b.id,
264
+ layout: "setting",
265
+ label: b.name,
266
+ sub: I(b)
267
+ }, ne({
268
+ leading: o(() => [
269
+ s(e(ee), {
270
+ tone: b.revoked_at ? "anchor" : "brand",
271
+ icon: "key2Line"
272
+ }, null, 8, ["tone"])
273
+ ]),
274
+ default: o(() => [
275
+ b.revoked_at ? (r(), _(e(O), {
276
+ key: 0,
277
+ tone: "critical"
278
+ }, {
279
+ default: o(() => [
280
+ R(w(e(c)("core.serviceaccounts.keys.revoked", { date: e(d).date(b.revoked_at) })), 1)
281
+ ]),
282
+ _: 2
283
+ }, 1024)) : T(b) ? (r(), _(e(O), {
284
+ key: 1,
285
+ tone: "warning"
286
+ }, {
287
+ default: o(() => [
288
+ R(w(e(c)("core.serviceaccounts.keys.expired")), 1)
289
+ ]),
290
+ _: 1
291
+ })) : L("", !0)
292
+ ]),
293
+ _: 2
294
+ }, [
295
+ z.value && !b.revoked_at ? {
296
+ name: "trailing",
297
+ fn: o(() => [
298
+ D("span", {
299
+ class: "contents",
300
+ "data-test": `revoke-key-${b.id}`
301
+ }, [
302
+ s(e(J), {
303
+ prominence: "plain",
304
+ tone: "critical",
305
+ size: "sm",
306
+ onClick: (Ie) => Y(b)
307
+ }, {
308
+ default: o(() => [
309
+ R(w(e(c)("core.serviceaccounts.keys.revoke")), 1)
310
+ ]),
311
+ _: 1
312
+ }, 8, ["onClick"])
313
+ ], 8, Me)
314
+ ]),
315
+ key: "0"
316
+ } : void 0
317
+ ]), 1032, ["label", "sub"]))), 128)),
318
+ B.value && M.value ? (r(), _(e(p), {
319
+ key: 1,
320
+ layout: "stacked"
321
+ }, {
322
+ default: o(() => [
323
+ D("span", ze, [
324
+ s(e(J), {
325
+ prominence: "secondary",
326
+ icon: "addLine",
327
+ onClick: f[0] || (f[0] = (b) => x.value?.show())
328
+ }, {
329
+ default: o(() => [
330
+ R(w(e(c)("core.serviceaccounts.keys.new")), 1)
331
+ ]),
332
+ _: 1
333
+ })
334
+ ])
335
+ ]),
336
+ _: 1
337
+ })) : L("", !0)
338
+ ]),
339
+ _: 2
340
+ }, 1032, ["header", "footer"])
341
+ ]),
342
+ _: 1
343
+ }, 8, ["state"]),
344
+ s(Ve, {
345
+ ref_key: "newKey",
346
+ ref: x,
347
+ account: l.account,
348
+ onCreated: y
349
+ }, null, 8, ["account"]),
350
+ s(Te, {
351
+ ref_key: "createdKey",
352
+ ref: h,
353
+ account: l.account,
354
+ onDone: U
355
+ }, null, 8, ["account"]),
356
+ s(e(te), {
357
+ ref_key: "revokeConfirm",
358
+ ref: C,
359
+ title: e(c)("core.serviceaccounts.keys.revoke_title"),
360
+ message: e(c)("core.serviceaccounts.keys.revoke_body", { name: A.value?.name ?? "", account: l.account.name }),
361
+ "confirm-label": e(c)("core.serviceaccounts.keys.revoke"),
362
+ tone: "critical",
363
+ action: G,
364
+ onFailed: S
365
+ }, null, 8, ["title", "message", "confirm-label"])
366
+ ]));
367
+ }
368
+ }), Pe = { key: 0 }, qe = { class: "flex min-w-0 flex-col gap-group-gap" }, Be = {
369
+ key: 0,
370
+ class: "flex min-w-0 flex-col gap-group-gap",
371
+ "data-test": "service-general"
372
+ }, yt = /* @__PURE__ */ P({
373
+ __name: "ServiceAccountRecord",
374
+ setup(u) {
375
+ const { t } = q(), k = re(), { access: l } = ae(), g = Q(), c = le(), $ = W(), { tenants: d } = pe(), m = X(), i = ve({ param: "id", load: (S, { signal: y }) => $.show(S, { signal: y }) }), n = i.data, v = ["general", "access", "keys"], x = typeof k.query.tab == "string" ? k.query.tab : "", h = N(v.includes(x) ? x : "general"), C = N(null), A = F("editDialog"), M = F("deactivateConfirm"), B = K(() => l.can(ce)), z = K(() => n.value !== null && !n.value.deactivated_at), T = K(() => n.value?.tenant?.name ?? c.levelLabel("organization")), I = K(() => [
376
+ { value: "general", label: t("core.serviceaccounts.tabs.general"), icon: "settings3Line" },
377
+ { value: "access", label: t("core.serviceaccounts.tabs.access"), icon: "shieldStarFill", ...C.value !== null ? { badge: C.value } : {} },
378
+ { value: "keys", label: t("core.serviceaccounts.tabs.keys"), icon: "key2Line", badge: n.value?.active_keys ?? 0 }
379
+ ]), U = K(() => {
380
+ const S = n.value;
381
+ return !S || !B.value || !z.value ? [] : [
382
+ { id: "edit", label: t("core.serviceaccounts.actions.edit"), icon: "edit", placement: "secondary", onClick: () => A.value?.show(S) },
383
+ { id: "deactivate", label: t("core.serviceaccounts.actions.deactivate"), icon: "lockLine", placement: "overflow", tone: "critical", onClick: () => M.value?.present() }
384
+ ];
385
+ });
386
+ async function Y() {
387
+ n.value && (i.update(await $.deactivate(n.value.id)), j.success(t("core.serviceaccounts.toasts.deactivated")));
388
+ }
389
+ const G = (S) => j.error(m.sentence(S, t("core.serviceaccounts.errors.deactivate")));
390
+ return (S, y) => (r(), _(e(fe), {
391
+ resource: e(i),
392
+ title: e(n)?.name || e(t)("core.serviceaccounts.title"),
393
+ back: { label: e(t)("core.serviceaccounts.title_plural"), to: e(ye).index },
394
+ actions: U.value,
395
+ width: "content"
396
+ }, {
397
+ header: o(({ record: a }) => [
398
+ s(e(de), {
399
+ title: a.name,
400
+ subtitle: e(d) ? T.value : void 0
401
+ }, {
402
+ leading: o(() => [
403
+ s(e(ee), {
404
+ tone: "anchor",
405
+ icon: "key2Line",
406
+ size: "lg"
407
+ })
408
+ ]),
409
+ meta: o(() => [
410
+ s(e(O), { tone: "context" }, {
411
+ default: o(() => [
412
+ R(w(e(t)("core.serviceaccounts.title")), 1)
413
+ ]),
414
+ _: 1
415
+ }),
416
+ e(d) ? (r(), E("span", Pe, w(T.value), 1)) : L("", !0),
417
+ z.value ? L("", !0) : (r(), _(e(O), {
418
+ key: 1,
419
+ tone: "neutral"
420
+ }, {
421
+ default: o(() => [
422
+ R(w(e(t)("core.serviceaccounts.deactivated")), 1)
423
+ ]),
424
+ _: 1
425
+ }))
426
+ ]),
427
+ _: 1
428
+ }, 8, ["title", "subtitle"])
429
+ ]),
430
+ default: o(({ record: a }) => [
431
+ D("div", qe, [
432
+ s(e(ue), {
433
+ modelValue: h.value,
434
+ "onUpdate:modelValue": y[0] || (y[0] = (f) => h.value = f),
435
+ tabs: I.value
436
+ }, null, 8, ["modelValue", "tabs"]),
437
+ h.value === "general" ? (r(), E("div", Be, [
438
+ s(e(V), {
439
+ footer: e(t)("core.serviceaccounts.no_password")
440
+ }, {
441
+ default: o(() => [
442
+ s(e(p), {
443
+ layout: "value",
444
+ label: e(t)("core.serviceaccounts.fields.owner"),
445
+ value: a.owner.name
446
+ }, null, 8, ["label", "value"]),
447
+ e(d) ? (r(), _(e(p), {
448
+ key: 0,
449
+ layout: "value",
450
+ label: e(t)(e(d).labelKey),
451
+ value: T.value
452
+ }, null, 8, ["label", "value"])) : L("", !0),
453
+ a.description ? (r(), _(e(p), {
454
+ key: 1,
455
+ layout: "value",
456
+ label: e(t)("core.serviceaccounts.fields.description"),
457
+ value: a.description
458
+ }, null, 8, ["label", "value"])) : L("", !0),
459
+ s(e(p), {
460
+ layout: "value",
461
+ label: e(t)("core.serviceaccounts.made_by"),
462
+ value: `${a.created_by.name}, ${e(g).date(a.created_at)}`
463
+ }, null, 8, ["label", "value"]),
464
+ s(e(p), {
465
+ layout: "value",
466
+ label: e(t)("core.serviceaccounts.last_call_label"),
467
+ value: a.last_used_at ? e(g).dateTime(a.last_used_at) : e(t)("core.serviceaccounts.never_used")
468
+ }, null, 8, ["label", "value"]),
469
+ s(e(p), {
470
+ layout: "value",
471
+ label: e(t)("core.serviceaccounts.status"),
472
+ value: a.deactivated_at ? e(t)("core.serviceaccounts.deactivated_on", { date: e(g).date(a.deactivated_at) }) : e(t)("core.serviceaccounts.active")
473
+ }, null, 8, ["label", "value"])
474
+ ]),
475
+ _: 2
476
+ }, 1032, ["footer"])
477
+ ])) : h.value === "access" ? (r(), _(e(ie), {
478
+ key: 1,
479
+ subject: { kind: "service", id: a.id },
480
+ name: a.name,
481
+ "subject-label": e(d) ? `${a.name} · ${T.value}` : a.name,
482
+ onLoaded: y[1] || (y[1] = (f) => C.value = f)
483
+ }, null, 8, ["subject", "name", "subject-label"])) : (r(), _(Oe, {
484
+ key: 2,
485
+ account: a,
486
+ onChanged: y[2] || (y[2] = (f) => e(i).reload())
487
+ }, null, 8, ["account"]))
488
+ ]),
489
+ s(ke, {
490
+ ref_key: "editDialog",
491
+ ref: A,
492
+ onSaved: y[3] || (y[3] = (f) => e(i).update(f))
493
+ }, null, 512),
494
+ s(e(te), {
495
+ ref_key: "deactivateConfirm",
496
+ ref: M,
497
+ title: e(t)("core.serviceaccounts.deactivate_title"),
498
+ message: e(t)("core.serviceaccounts.deactivate_body", { name: a.name }),
499
+ "confirm-label": e(t)("core.serviceaccounts.actions.deactivate"),
500
+ tone: "critical",
501
+ action: Y,
502
+ onFailed: G
503
+ }, null, 8, ["title", "message", "confirm-label"])
504
+ ]),
505
+ _: 1
506
+ }, 8, ["resource", "title", "back", "actions"]));
507
+ }
508
+ });
509
+ export {
510
+ yt as default
511
+ };