@burdenoff/microfe-assethandler 2026.826.13 → 2026.826.15
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/assethandler/hooks/useCopy.d.ts.map +1 -1
- package/dist/assethandler/hooks/useCopy.js +17 -15
- package/dist/assethandler/hooks/useCopy.js.map +1 -1
- package/dist/assethandler/pages/CmdbBrowserPage.d.ts.map +1 -1
- package/dist/assethandler/pages/CmdbBrowserPage.js +107 -82
- package/dist/assethandler/pages/CmdbBrowserPage.js.map +1 -1
- package/dist/assethandler/pages/SamLicensesPage.d.ts.map +1 -1
- package/dist/assethandler/pages/SamLicensesPage.js +179 -158
- package/dist/assethandler/pages/SamLicensesPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCopy.d.ts","sourceRoot":"","sources":["../../../src/assethandler/hooks/useCopy.ts"],"names":[],"mappings":"AAKA,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,KAAK,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useCopy.d.ts","sourceRoot":"","sources":["../../../src/assethandler/hooks/useCopy.ts"],"names":[],"mappings":"AAKA,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,KAAK,MAAM,CAAC;AAM3F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAwChC"}
|
|
@@ -2,32 +2,34 @@ import { useAssetHandler as e, useAssetTerminology as t } from "../providers/Ass
|
|
|
2
2
|
import { useCallback as n } from "react";
|
|
3
3
|
import { useI18n as r } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
4
4
|
//#region src/assethandler/hooks/useCopy.ts
|
|
5
|
-
var i = /\{\{(asset|assets|assetLower|assetsLower)\}\}/g;
|
|
6
|
-
function
|
|
7
|
-
let { t:
|
|
5
|
+
var i = /\{\{(asset|assets|assetLower|assetsLower)\}\}/g, a = /\{\{([^{}]+)\}\}/g;
|
|
6
|
+
function o() {
|
|
7
|
+
let { t: o } = r(), { copy: s } = e(), { asset: c, assets: l } = t();
|
|
8
8
|
return n((e, t, n) => {
|
|
9
|
-
let r =
|
|
9
|
+
let r = s?.[e];
|
|
10
10
|
if (r === void 0) {
|
|
11
|
-
let i =
|
|
11
|
+
let i = o(e, n);
|
|
12
12
|
r = i === e ? t : i;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
if (!r.includes("{{")) return r;
|
|
15
|
+
let u = r.replace(i, (e, t) => {
|
|
15
16
|
switch (t) {
|
|
16
|
-
case "asset": return
|
|
17
|
-
case "assets": return
|
|
18
|
-
case "assetLower": return
|
|
19
|
-
case "assetsLower": return
|
|
17
|
+
case "asset": return c;
|
|
18
|
+
case "assets": return l;
|
|
19
|
+
case "assetLower": return c.toLowerCase();
|
|
20
|
+
case "assetsLower": return l.toLowerCase();
|
|
20
21
|
default: return e;
|
|
21
22
|
}
|
|
22
|
-
})
|
|
23
|
+
});
|
|
24
|
+
return !n || !u.includes("{{") ? u : u.replace(a, (e, t) => Object.prototype.hasOwnProperty.call(n, t) ? String(n[t]) : e);
|
|
23
25
|
}, [
|
|
24
|
-
o,
|
|
25
|
-
a,
|
|
26
26
|
s,
|
|
27
|
-
|
|
27
|
+
o,
|
|
28
|
+
c,
|
|
29
|
+
l
|
|
28
30
|
]);
|
|
29
31
|
}
|
|
30
32
|
//#endregion
|
|
31
|
-
export {
|
|
33
|
+
export { o as useCopy };
|
|
32
34
|
|
|
33
35
|
//# sourceMappingURL=useCopy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCopy.js","names":[],"sources":["../../../src/assethandler/hooks/useCopy.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\nimport { useAssetHandler, useAssetTerminology } from '../providers/AssetHandlerProvider';\n\ntype TranslationParams = Record<string, string | number>;\n\n/**\n * Resolves a single piece of module copy.\n *\n * @param key i18n key, e.g. \"assethandler.dashboard.metrics.totalAssets\".\n * @param fallback The module's own English copy, used when neither the host nor\n * the platform provides a string. May contain terminology\n * tokens (see {@link useCopy}).\n */\nexport type CopyFn = (key: string, fallback: string, params?: TranslationParams) => string;\n\n/** Terminology tokens substituted into resolved copy. */\nconst TOKEN_PATTERN = /\\{\\{(asset|assets|assetLower|assetsLower)\\}\\}/g;\n\n/**\n * Copy resolver for the module, in precedence order:\n *\n * 1. the host's `copy[key]` override (the `copy` prop on `AssetHandlerRoot`),\n * 2. the platform translation for `key`, when the locale provides one,\n * 3. the module's own default fallback.\n *\n * The resolved string then has its `{{asset}}` / `{{assets}}` /\n * `{{assetLower}}` / `{{assetsLower}}` tokens substituted with the terminology\n * from the `terminology` prop.\n *\n * With no `copy` and no `terminology` props the tokens resolve to\n * \"Asset\"/\"Assets\"/\"asset\"/\"assets\", so output is identical to the module's\n * previous `tWithFallback(t, key, fallback)` behaviour.\n */\nexport function useCopy(): CopyFn {\n const { t } = useI18n();\n const { copy } = useAssetHandler();\n const { asset, assets } = useAssetTerminology();\n\n return useCallback(\n (key: string, fallback: string, params?: TranslationParams): string => {\n // 1. host override, 2. platform translation, 3. module fallback.\n let resolved = copy?.[key];\n if (resolved === undefined) {\n const translated = t(key, params);\n resolved = translated === key ? fallback : translated;\n }\n\n if (!resolved.includes('{{')) return resolved;\n\n
|
|
1
|
+
{"version":3,"file":"useCopy.js","names":[],"sources":["../../../src/assethandler/hooks/useCopy.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\nimport { useAssetHandler, useAssetTerminology } from '../providers/AssetHandlerProvider';\n\ntype TranslationParams = Record<string, string | number>;\n\n/**\n * Resolves a single piece of module copy.\n *\n * @param key i18n key, e.g. \"assethandler.dashboard.metrics.totalAssets\".\n * @param fallback The module's own English copy, used when neither the host nor\n * the platform provides a string. May contain terminology\n * tokens (see {@link useCopy}).\n */\nexport type CopyFn = (key: string, fallback: string, params?: TranslationParams) => string;\n\n/** Terminology tokens substituted into resolved copy. */\nconst TOKEN_PATTERN = /\\{\\{(asset|assets|assetLower|assetsLower)\\}\\}/g;\nconst PARAM_PATTERN = /\\{\\{([^{}]+)\\}\\}/g;\n\n/**\n * Copy resolver for the module, in precedence order:\n *\n * 1. the host's `copy[key]` override (the `copy` prop on `AssetHandlerRoot`),\n * 2. the platform translation for `key`, when the locale provides one,\n * 3. the module's own default fallback.\n *\n * The resolved string then has its `{{asset}}` / `{{assets}}` /\n * `{{assetLower}}` / `{{assetsLower}}` tokens substituted with the terminology\n * from the `terminology` prop.\n *\n * With no `copy` and no `terminology` props the tokens resolve to\n * \"Asset\"/\"Assets\"/\"asset\"/\"assets\", so output is identical to the module's\n * previous `tWithFallback(t, key, fallback)` behaviour.\n */\nexport function useCopy(): CopyFn {\n const { t } = useI18n();\n const { copy } = useAssetHandler();\n const { asset, assets } = useAssetTerminology();\n\n return useCallback(\n (key: string, fallback: string, params?: TranslationParams): string => {\n // 1. host override, 2. platform translation, 3. module fallback.\n let resolved = copy?.[key];\n if (resolved === undefined) {\n const translated = t(key, params);\n resolved = translated === key ? fallback : translated;\n }\n\n if (!resolved.includes('{{')) return resolved;\n\n const withTerminology = resolved.replace(TOKEN_PATTERN, (_match, token: string) => {\n switch (token) {\n case 'asset':\n return asset;\n case 'assets':\n return assets;\n case 'assetLower':\n return asset.toLowerCase();\n case 'assetsLower':\n return assets.toLowerCase();\n default:\n return _match;\n }\n });\n\n if (!params || !withTerminology.includes('{{')) return withTerminology;\n\n return withTerminology.replace(PARAM_PATTERN, (match, token: string) => {\n if (!Object.prototype.hasOwnProperty.call(params, token)) return match;\n return String(params[token]);\n });\n },\n [copy, t, asset, assets]\n );\n}\n"],"mappings":";;;;AAkBA,IAAM,IAAgB,kDAChB,IAAgB;AAiBtB,SAAgB,IAAkB;CAChC,IAAM,EAAE,SAAM,EAAQ,GAChB,EAAE,YAAS,EAAgB,GAC3B,EAAE,UAAO,cAAW,EAAoB;CAE9C,OAAO,GACJ,GAAa,GAAkB,MAAuC;EAErE,IAAI,IAAW,IAAO;EACtB,IAAI,MAAa,KAAA,GAAW;GAC1B,IAAM,IAAa,EAAE,GAAK,CAAM;GAChC,IAAW,MAAe,IAAM,IAAW;EAC7C;EAEA,IAAI,CAAC,EAAS,SAAS,IAAI,GAAG,OAAO;EAErC,IAAM,IAAkB,EAAS,QAAQ,IAAgB,GAAQ,MAAkB;GACjF,QAAQ,GAAR;IACE,KAAK,SACH,OAAO;IACT,KAAK,UACH,OAAO;IACT,KAAK,cACH,OAAO,EAAM,YAAY;IAC3B,KAAK,eACH,OAAO,EAAO,YAAY;IAC5B,SACE,OAAO;GACX;EACF,CAAC;EAID,OAFI,CAAC,KAAU,CAAC,EAAgB,SAAS,IAAI,IAAU,IAEhD,EAAgB,QAAQ,IAAgB,GAAO,MAC/C,OAAO,UAAU,eAAe,KAAK,GAAQ,CAAK,IAChD,OAAO,EAAO,EAAM,IADsC,CAElE;CACH,GACA;EAAC;EAAM;EAAG;EAAO;CAAM,CACzB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmdbBrowserPage.d.ts","sourceRoot":"","sources":["../../../src/assethandler/pages/CmdbBrowserPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CmdbBrowserPage.d.ts","sourceRoot":"","sources":["../../../src/assethandler/pages/CmdbBrowserPage.tsx"],"names":[],"mappings":"AAudA,wBAAgB,eAAe,gCAkW9B"}
|
|
@@ -7,13 +7,13 @@ import { StatTile as a } from "../components/StatTile.js";
|
|
|
7
7
|
import { ChartCard as o } from "../components/ChartCard.js";
|
|
8
8
|
import "../components/index.js";
|
|
9
9
|
import { useMemo as s, useState as c, useSyncExternalStore as l } from "react";
|
|
10
|
-
import { AppWindow as u, ChevronDown as d, ChevronRight as f, Cog as p, Database as m, HardDrive as h, Network as g, Pencil as _, Plus as ee, Search as v, Server as y, Trash2 as
|
|
11
|
-
import { gql as
|
|
12
|
-
import { useMutation as
|
|
10
|
+
import { AppWindow as u, ChevronDown as d, ChevronRight as f, Cog as p, Database as m, HardDrive as h, Network as g, Pencil as _, Plus as ee, Search as v, Server as y, Trash2 as b, X as x } from "lucide-react";
|
|
11
|
+
import { gql as S } from "@apollo/client";
|
|
12
|
+
import { useMutation as te, useQuery as C } from "@apollo/client/react";
|
|
13
13
|
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
14
|
-
import { Button as E, GlassCard as D, GradientText as O, IllustratedEmptyState as ne, Input as k, Label as A, PagePurpose as j, ResponsiveDialog as re, ResponsiveDialogContent as ie, ResponsiveDialogDescription as M, ResponsiveDialogFooter as
|
|
14
|
+
import { Button as E, GlassCard as D, GradientText as O, IllustratedEmptyState as ne, Input as k, Label as A, PagePurpose as j, ResponsiveDialog as re, ResponsiveDialogContent as ie, ResponsiveDialogDescription as M, ResponsiveDialogFooter as N, ResponsiveDialogHeader as P, ResponsiveDialogTitle as ae, Select as F, SelectContent as I, SelectItem as L, SelectTrigger as R, SelectValue as z } from "@burdenoff/fe-libs/ui";
|
|
15
15
|
//#region src/assethandler/pages/CmdbBrowserPage.tsx
|
|
16
|
-
var oe =
|
|
16
|
+
var oe = S`
|
|
17
17
|
query AssetHandlerConfigurationItems {
|
|
18
18
|
configurationItems {
|
|
19
19
|
id
|
|
@@ -27,13 +27,17 @@ var oe = x`
|
|
|
27
27
|
updatedAt
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
`, B =
|
|
30
|
+
`, B = S`
|
|
31
31
|
mutation AssetHandlerUpsertConfigurationItem($input: UpsertConfigurationItemInput!) {
|
|
32
32
|
upsertConfigurationItem(input: $input) {
|
|
33
33
|
id
|
|
34
34
|
ciNumber
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
`, se = S`
|
|
38
|
+
mutation AssetHandlerDeleteConfigurationItem($id: ID!) {
|
|
39
|
+
deleteConfigurationItem(id: $id)
|
|
40
|
+
}
|
|
37
41
|
`, V = [
|
|
38
42
|
"SERVER",
|
|
39
43
|
"SERVICE",
|
|
@@ -86,7 +90,7 @@ function K({ status: e }) {
|
|
|
86
90
|
children: n.label
|
|
87
91
|
});
|
|
88
92
|
}
|
|
89
|
-
function
|
|
93
|
+
function ce() {
|
|
90
94
|
return l((e) => {
|
|
91
95
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
|
|
92
96
|
let t = window.matchMedia("(min-width: 1024px)");
|
|
@@ -99,10 +103,10 @@ function q(e) {
|
|
|
99
103
|
value: typeof t == "string" ? t : JSON.stringify(t)
|
|
100
104
|
})) : [];
|
|
101
105
|
}
|
|
102
|
-
function
|
|
103
|
-
let a = !!r, [o, s] = c(""), [l, u] = c(""), [d, f] = c("SERVER"), [p, m] = c("ACTIVE"), [h, g] = c("PRODUCTION"), [_, v] = c(""), [y,
|
|
104
|
-
e &&
|
|
105
|
-
let [D, { loading: O }] =
|
|
106
|
+
function le({ open: e, onOpenChange: t, seed: r, onSaved: i }) {
|
|
107
|
+
let a = !!r, [o, s] = c(""), [l, u] = c(""), [d, f] = c("SERVER"), [p, m] = c("ACTIVE"), [h, g] = c("PRODUCTION"), [_, v] = c(""), [y, x] = c([]), [S, C] = c(null);
|
|
108
|
+
e && S !== (r?.id ?? "__new__") && (C(r?.id ?? "__new__"), s(r?.ciNumber ?? ""), u(r?.name ?? ""), f(r?.ciType ?? "SERVER"), m(r?.status ?? "ACTIVE"), g(r?.environment ?? "PRODUCTION"), v(r?.owner ?? ""), x(q(r?.attributes))), !e && S !== null && C(null);
|
|
109
|
+
let [D, { loading: O }] = te(B, {
|
|
106
110
|
onCompleted: (e) => {
|
|
107
111
|
n.success(a ? "Configuration item updated" : "Configuration item saved", `${e.upsertConfigurationItem.ciNumber} is now in the CMDB.`), t(!1), i();
|
|
108
112
|
},
|
|
@@ -123,7 +127,7 @@ function ce({ open: e, onOpenChange: t, seed: r, onSaved: i }) {
|
|
|
123
127
|
owner: _.trim() || null,
|
|
124
128
|
attributes: e
|
|
125
129
|
} } });
|
|
126
|
-
}, j = (e, t) =>
|
|
130
|
+
}, j = (e, t) => x((n) => n.map((n, r) => r === e ? {
|
|
127
131
|
...n,
|
|
128
132
|
...t
|
|
129
133
|
} : n));
|
|
@@ -133,7 +137,7 @@ function ce({ open: e, onOpenChange: t, seed: r, onSaved: i }) {
|
|
|
133
137
|
children: /* @__PURE__ */ T(ie, {
|
|
134
138
|
className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl",
|
|
135
139
|
children: [
|
|
136
|
-
/* @__PURE__ */ T(
|
|
140
|
+
/* @__PURE__ */ T(P, { children: [/* @__PURE__ */ w(ae, { children: a ? "Edit CI" : "Add CI" }), /* @__PURE__ */ w(M, { children: "Register a configuration item in the CMDB and map it to your estate." })] }),
|
|
137
141
|
/* @__PURE__ */ T("div", {
|
|
138
142
|
className: "space-y-4",
|
|
139
143
|
children: [
|
|
@@ -208,7 +212,7 @@ function ce({ open: e, onOpenChange: t, seed: r, onSaved: i }) {
|
|
|
208
212
|
type: "button",
|
|
209
213
|
variant: "outline",
|
|
210
214
|
size: "sm",
|
|
211
|
-
onClick: () =>
|
|
215
|
+
onClick: () => x((e) => [...e, {
|
|
212
216
|
key: "",
|
|
213
217
|
value: ""
|
|
214
218
|
}]),
|
|
@@ -238,9 +242,9 @@ function ce({ open: e, onOpenChange: t, seed: r, onSaved: i }) {
|
|
|
238
242
|
type: "button",
|
|
239
243
|
variant: "ghost",
|
|
240
244
|
size: "icon",
|
|
241
|
-
onClick: () =>
|
|
245
|
+
onClick: () => x((e) => e.filter((e, n) => n !== t)),
|
|
242
246
|
"aria-label": "Remove attribute",
|
|
243
|
-
children: /* @__PURE__ */ w(
|
|
247
|
+
children: /* @__PURE__ */ w(b, { className: "h-4 w-4" })
|
|
244
248
|
})
|
|
245
249
|
]
|
|
246
250
|
}, t))
|
|
@@ -248,7 +252,7 @@ function ce({ open: e, onOpenChange: t, seed: r, onSaved: i }) {
|
|
|
248
252
|
})
|
|
249
253
|
]
|
|
250
254
|
}),
|
|
251
|
-
/* @__PURE__ */ T(
|
|
255
|
+
/* @__PURE__ */ T(N, { children: [/* @__PURE__ */ w(E, {
|
|
252
256
|
variant: "outline",
|
|
253
257
|
onClick: () => t(!1),
|
|
254
258
|
disabled: O,
|
|
@@ -274,8 +278,8 @@ function J({ label: e, value: t }) {
|
|
|
274
278
|
})]
|
|
275
279
|
});
|
|
276
280
|
}
|
|
277
|
-
function
|
|
278
|
-
let
|
|
281
|
+
function ue({ ci: e, onEdit: t, onDelete: n, deleting: r, onClose: i }) {
|
|
282
|
+
let a = q(e.attributes);
|
|
279
283
|
return /* @__PURE__ */ T("div", {
|
|
280
284
|
className: "space-y-4",
|
|
281
285
|
children: [
|
|
@@ -298,18 +302,28 @@ function le({ ci: e, onEdit: t, onClose: n }) {
|
|
|
298
302
|
})]
|
|
299
303
|
}), /* @__PURE__ */ T("div", {
|
|
300
304
|
className: "flex items-center gap-1",
|
|
301
|
-
children: [
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
305
|
+
children: [
|
|
306
|
+
/* @__PURE__ */ T(E, {
|
|
307
|
+
variant: "outline",
|
|
308
|
+
size: "sm",
|
|
309
|
+
onClick: t,
|
|
310
|
+
children: [/* @__PURE__ */ w(_, { className: "mr-1 h-3.5 w-3.5" }), "Edit"]
|
|
311
|
+
}),
|
|
312
|
+
/* @__PURE__ */ T(E, {
|
|
313
|
+
variant: "outline",
|
|
314
|
+
size: "sm",
|
|
315
|
+
onClick: n,
|
|
316
|
+
disabled: r,
|
|
317
|
+
children: [/* @__PURE__ */ w(b, { className: "mr-1 h-3.5 w-3.5" }), r ? "Deleting…" : "Delete"]
|
|
318
|
+
}),
|
|
319
|
+
i ? /* @__PURE__ */ w(E, {
|
|
320
|
+
variant: "ghost",
|
|
321
|
+
size: "icon",
|
|
322
|
+
onClick: i,
|
|
323
|
+
"aria-label": "Close detail",
|
|
324
|
+
children: /* @__PURE__ */ w(x, { className: "h-4 w-4" })
|
|
325
|
+
}) : null
|
|
326
|
+
]
|
|
313
327
|
})]
|
|
314
328
|
}),
|
|
315
329
|
/* @__PURE__ */ T("div", {
|
|
@@ -344,12 +358,12 @@ function le({ ci: e, onEdit: t, onClose: n }) {
|
|
|
344
358
|
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("h4", {
|
|
345
359
|
className: "mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",
|
|
346
360
|
children: "Attributes"
|
|
347
|
-
}),
|
|
361
|
+
}), a.length === 0 ? /* @__PURE__ */ w("p", {
|
|
348
362
|
className: "text-sm text-text-secondary",
|
|
349
363
|
children: "No attributes recorded for this CI."
|
|
350
364
|
}) : /* @__PURE__ */ w("div", {
|
|
351
365
|
className: "divide-y divide-border-seam/60 rounded-lg bg-bg-sunken/40",
|
|
352
|
-
children:
|
|
366
|
+
children: a.map((e) => /* @__PURE__ */ T("div", {
|
|
353
367
|
className: "flex items-start justify-between gap-3 px-3 py-2",
|
|
354
368
|
children: [/* @__PURE__ */ w("span", {
|
|
355
369
|
className: "text-sm text-text-secondary",
|
|
@@ -363,10 +377,15 @@ function le({ ci: e, onEdit: t, onClose: n }) {
|
|
|
363
377
|
]
|
|
364
378
|
});
|
|
365
379
|
}
|
|
366
|
-
function
|
|
367
|
-
let [
|
|
368
|
-
|
|
369
|
-
|
|
380
|
+
function de() {
|
|
381
|
+
let [l, u] = c(!1), [m, _] = c(null), [b, x] = c(null), [S, A] = c(!1), [M, N] = c(""), [B, V] = c("ALL"), [q, J] = c("ALL"), [de, fe] = c({}), pe = ce(), { data: Y, loading: me, refetch: he } = C(oe, { fetchPolicy: "cache-and-network" }), [ge, { loading: _e }] = te(se, {
|
|
382
|
+
onCompleted: () => {
|
|
383
|
+
n.success("Configuration item deleted"), x(null), A(!1), he();
|
|
384
|
+
},
|
|
385
|
+
onError: (e) => n.error("Could not delete configuration item", e.message)
|
|
386
|
+
}), X = s(() => Y?.configurationItems ?? [], [Y?.configurationItems]), Z = s(() => {
|
|
387
|
+
let e = M.trim().toLowerCase();
|
|
388
|
+
return X.filter((t) => B !== "ALL" && t.status !== B || q !== "ALL" && t.environment !== q ? !1 : e ? [
|
|
370
389
|
t.ciNumber,
|
|
371
390
|
t.name,
|
|
372
391
|
t.ciType,
|
|
@@ -374,10 +393,10 @@ function Y() {
|
|
|
374
393
|
].join(" ").toLowerCase().includes(e) : !0);
|
|
375
394
|
}, [
|
|
376
395
|
X,
|
|
377
|
-
S,
|
|
378
396
|
M,
|
|
379
|
-
B
|
|
380
|
-
|
|
397
|
+
B,
|
|
398
|
+
q
|
|
399
|
+
]), ve = s(() => {
|
|
381
400
|
let e = /* @__PURE__ */ new Map();
|
|
382
401
|
for (let t of Z) {
|
|
383
402
|
let n = t.ciType || "OTHER", r = e.get(n);
|
|
@@ -392,25 +411,27 @@ function Y() {
|
|
|
392
411
|
maintenance: n,
|
|
393
412
|
retired: r
|
|
394
413
|
};
|
|
395
|
-
}, [X]),
|
|
414
|
+
}, [X]), ye = s(() => {
|
|
396
415
|
let t = X.reduce((e, t) => (e[t.status] = (e[t.status] ?? 0) + 1, e), {});
|
|
397
416
|
return Object.entries(t).map(([t, n], r) => ({
|
|
398
417
|
name: G[t]?.label ?? t,
|
|
399
418
|
value: n,
|
|
400
419
|
color: e(r)
|
|
401
420
|
}));
|
|
402
|
-
}, [X]),
|
|
421
|
+
}, [X]), be = s(() => {
|
|
403
422
|
let e = X.reduce((e, t) => (e[t.ciType] = (e[t.ciType] ?? 0) + 1, e), {});
|
|
404
423
|
return Object.entries(e).sort((e, t) => t[1] - e[1]).map(([e, t]) => ({
|
|
405
424
|
name: e,
|
|
406
425
|
count: t
|
|
407
426
|
}));
|
|
408
|
-
}, [X]), $ = s(() => X.find((e) => e.id ===
|
|
409
|
-
|
|
410
|
-
},
|
|
411
|
-
|
|
412
|
-
},
|
|
413
|
-
|
|
427
|
+
}, [X]), $ = s(() => X.find((e) => e.id === b) ?? null, [X, b]), xe = (e) => {
|
|
428
|
+
x(e.id), pe || A(!0);
|
|
429
|
+
}, Se = () => {
|
|
430
|
+
_(null), u(!0);
|
|
431
|
+
}, Ce = (e) => {
|
|
432
|
+
_(e), u(!0), A(!1);
|
|
433
|
+
}, we = (e) => {
|
|
434
|
+
window.confirm(`Delete ${e.ciNumber} — ${e.name}?`) && ge({ variables: { id: e.id } });
|
|
414
435
|
};
|
|
415
436
|
return /* @__PURE__ */ T("div", {
|
|
416
437
|
className: "space-y-5 p-4 sm:p-6",
|
|
@@ -427,21 +448,21 @@ function Y() {
|
|
|
427
448
|
children: "CMDB — Configuration Items"
|
|
428
449
|
}), /* @__PURE__ */ w("p", {
|
|
429
450
|
className: "mt-1 max-w-2xl text-sm text-text-secondary",
|
|
430
|
-
children: "A
|
|
451
|
+
children: "A searchable catalog of configuration items and their attributes."
|
|
431
452
|
})]
|
|
432
453
|
})]
|
|
433
454
|
}), /* @__PURE__ */ T(E, {
|
|
434
455
|
className: "w-full sm:w-auto",
|
|
435
|
-
onClick:
|
|
456
|
+
onClick: Se,
|
|
436
457
|
children: [/* @__PURE__ */ w(ee, { className: "mr-2 h-4 w-4" }), "Add CI"]
|
|
437
458
|
})]
|
|
438
459
|
}),
|
|
439
|
-
/* @__PURE__ */ w(j, { children: "Your configuration
|
|
440
|
-
/* @__PURE__ */ w(
|
|
441
|
-
open:
|
|
442
|
-
onOpenChange:
|
|
443
|
-
seed:
|
|
444
|
-
onSaved: () => void
|
|
460
|
+
/* @__PURE__ */ w(j, { children: "Your configuration-item catalog: record servers, services, network gear, status, ownership, environment and structured attributes. Dependency relationships and blast-radius analysis are not shipped yet." }),
|
|
461
|
+
/* @__PURE__ */ w(le, {
|
|
462
|
+
open: l,
|
|
463
|
+
onOpenChange: u,
|
|
464
|
+
seed: m,
|
|
465
|
+
onSaved: () => void he()
|
|
445
466
|
}),
|
|
446
467
|
/* @__PURE__ */ T("div", {
|
|
447
468
|
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
@@ -478,7 +499,7 @@ function Y() {
|
|
|
478
499
|
title: "Status mix",
|
|
479
500
|
subtitle: "Configuration items by status",
|
|
480
501
|
children: /* @__PURE__ */ w(i, {
|
|
481
|
-
data:
|
|
502
|
+
data: ye,
|
|
482
503
|
height: 220,
|
|
483
504
|
centerLabel: "CIs",
|
|
484
505
|
centerValue: Q.total,
|
|
@@ -488,7 +509,7 @@ function Y() {
|
|
|
488
509
|
title: "By type",
|
|
489
510
|
subtitle: "Configuration items per type",
|
|
490
511
|
children: /* @__PURE__ */ w(r, {
|
|
491
|
-
data:
|
|
512
|
+
data: be,
|
|
492
513
|
xKey: "name",
|
|
493
514
|
series: [{
|
|
494
515
|
key: "count",
|
|
@@ -513,15 +534,15 @@ function Y() {
|
|
|
513
534
|
children: [/* @__PURE__ */ w(v, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ w(k, {
|
|
514
535
|
className: "pl-9",
|
|
515
536
|
placeholder: "Search CIs by number, name, type or owner…",
|
|
516
|
-
value:
|
|
517
|
-
onChange: (e) =>
|
|
537
|
+
value: M,
|
|
538
|
+
onChange: (e) => N(e.target.value),
|
|
518
539
|
"aria-label": "Search configuration items"
|
|
519
540
|
})]
|
|
520
541
|
}), /* @__PURE__ */ T("div", {
|
|
521
542
|
className: "grid gap-2 sm:grid-cols-2",
|
|
522
543
|
children: [/* @__PURE__ */ T(F, {
|
|
523
|
-
value:
|
|
524
|
-
onValueChange:
|
|
544
|
+
value: B,
|
|
545
|
+
onValueChange: V,
|
|
525
546
|
children: [/* @__PURE__ */ w(R, { children: /* @__PURE__ */ w(z, { placeholder: "Status" }) }), /* @__PURE__ */ T(I, { children: [/* @__PURE__ */ w(L, {
|
|
526
547
|
value: "ALL",
|
|
527
548
|
children: "All statuses"
|
|
@@ -530,8 +551,8 @@ function Y() {
|
|
|
530
551
|
children: e
|
|
531
552
|
}, e))] })]
|
|
532
553
|
}), /* @__PURE__ */ T(F, {
|
|
533
|
-
value:
|
|
534
|
-
onValueChange:
|
|
554
|
+
value: q,
|
|
555
|
+
onValueChange: J,
|
|
535
556
|
children: [/* @__PURE__ */ w(R, { children: /* @__PURE__ */ w(z, { placeholder: "Environment" }) }), /* @__PURE__ */ T(I, { children: [/* @__PURE__ */ w(L, {
|
|
536
557
|
value: "ALL",
|
|
537
558
|
children: "All environments"
|
|
@@ -544,22 +565,22 @@ function Y() {
|
|
|
544
565
|
}), /* @__PURE__ */ T("div", {
|
|
545
566
|
className: "border-t border-border-seam",
|
|
546
567
|
children: [
|
|
547
|
-
|
|
568
|
+
me && X.length === 0 ? /* @__PURE__ */ w("div", {
|
|
548
569
|
className: "space-y-2 p-4",
|
|
549
570
|
children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ w("div", { className: "h-9 rounded-md bg-bg-sunken motion-safe:animate-vc-shimmer" }, t))
|
|
550
571
|
}) : null,
|
|
551
|
-
!
|
|
552
|
-
illustration:
|
|
553
|
-
title:
|
|
554
|
-
description:
|
|
572
|
+
!me && Z.length === 0 ? /* @__PURE__ */ w(ne, {
|
|
573
|
+
illustration: M || B !== "ALL" || q !== "ALL" ? "empty-search" : "empty-data",
|
|
574
|
+
title: M || B !== "ALL" || q !== "ALL" ? "No configuration items match" : "No configuration items found",
|
|
575
|
+
description: M || B !== "ALL" || q !== "ALL" ? "Try a different search or filter." : "Add a configuration item to start mapping your estate."
|
|
555
576
|
}) : null,
|
|
556
577
|
/* @__PURE__ */ w("div", {
|
|
557
578
|
className: "max-h-[540px] overflow-y-auto",
|
|
558
|
-
children:
|
|
559
|
-
let r = W[e] ?? p, i =
|
|
579
|
+
children: ve.map(([e, n]) => {
|
|
580
|
+
let r = W[e] ?? p, i = de[e];
|
|
560
581
|
return /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("button", {
|
|
561
582
|
type: "button",
|
|
562
|
-
onClick: () =>
|
|
583
|
+
onClick: () => fe((t) => ({
|
|
563
584
|
...t,
|
|
564
585
|
[e]: !t[e]
|
|
565
586
|
})),
|
|
@@ -578,9 +599,9 @@ function Y() {
|
|
|
578
599
|
]
|
|
579
600
|
}), i ? null : n.map((e) => /* @__PURE__ */ T("button", {
|
|
580
601
|
type: "button",
|
|
581
|
-
onClick: () =>
|
|
582
|
-
"aria-current":
|
|
583
|
-
className: t("flex w-full items-center gap-3 border-b border-border-seam/40 px-4 py-2.5 pl-10 text-left last:border-b-0",
|
|
602
|
+
onClick: () => xe(e),
|
|
603
|
+
"aria-current": b === e.id,
|
|
604
|
+
className: t("flex w-full items-center gap-3 border-b border-border-seam/40 px-4 py-2.5 pl-10 text-left last:border-b-0", b === e.id ? "bg-action-primary-bg/10" : "hover:bg-bg-sunken/40"),
|
|
584
605
|
children: [/* @__PURE__ */ T("div", {
|
|
585
606
|
className: "min-w-0 flex-1",
|
|
586
607
|
children: [/* @__PURE__ */ w("p", {
|
|
@@ -603,9 +624,11 @@ function Y() {
|
|
|
603
624
|
className: "sticky top-4 border-border-seam",
|
|
604
625
|
children: /* @__PURE__ */ w("div", {
|
|
605
626
|
className: "p-4",
|
|
606
|
-
children: $ ? /* @__PURE__ */ w(
|
|
627
|
+
children: $ ? /* @__PURE__ */ w(ue, {
|
|
607
628
|
ci: $,
|
|
608
|
-
onEdit: () =>
|
|
629
|
+
onEdit: () => Ce($),
|
|
630
|
+
onDelete: () => we($),
|
|
631
|
+
deleting: _e
|
|
609
632
|
}) : /* @__PURE__ */ T("div", {
|
|
610
633
|
className: "flex flex-col items-center justify-center gap-2 py-12 text-center",
|
|
611
634
|
children: [
|
|
@@ -625,13 +648,15 @@ function Y() {
|
|
|
625
648
|
})]
|
|
626
649
|
}),
|
|
627
650
|
/* @__PURE__ */ w(re, {
|
|
628
|
-
open:
|
|
629
|
-
onOpenChange:
|
|
651
|
+
open: S && !pe,
|
|
652
|
+
onOpenChange: A,
|
|
630
653
|
children: /* @__PURE__ */ T(ie, {
|
|
631
654
|
className: "max-h-[85vh] overflow-y-auto",
|
|
632
|
-
children: [/* @__PURE__ */ w(
|
|
655
|
+
children: [/* @__PURE__ */ w(P, { children: /* @__PURE__ */ w(ae, { children: "Configuration item" }) }), $ ? /* @__PURE__ */ w(ue, {
|
|
633
656
|
ci: $,
|
|
634
|
-
onEdit: () =>
|
|
657
|
+
onEdit: () => Ce($),
|
|
658
|
+
onDelete: () => we($),
|
|
659
|
+
deleting: _e
|
|
635
660
|
}) : null]
|
|
636
661
|
})
|
|
637
662
|
})
|
|
@@ -639,6 +664,6 @@ function Y() {
|
|
|
639
664
|
});
|
|
640
665
|
}
|
|
641
666
|
//#endregion
|
|
642
|
-
export {
|
|
667
|
+
export { de as CmdbBrowserPage };
|
|
643
668
|
|
|
644
669
|
//# sourceMappingURL=CmdbBrowserPage.js.map
|