@burdenoff/microfe-bigconsole 2026.1119.6 → 2026.1119.7
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/bigconsole/components/settings/WidgetCatalogSection.d.ts +3 -0
- package/dist/bigconsole/components/settings/WidgetCatalogSection.js +207 -0
- package/dist/bigconsole/constants/backendErrors.js +2 -0
- package/dist/bigconsole/hooks/useWidgetTypeCatalog.d.ts +14 -0
- package/dist/bigconsole/hooks/useWidgetTypeCatalog.js +79 -0
- package/dist/bigconsole/pages/SettingsPage.js +198 -196
- package/dist/bigconsole/utils/widgetCatalog.d.ts +42 -0
- package/dist/bigconsole/utils/widgetCatalog.js +15 -0
- package/dist/constants/permissions.d.ts +2 -1
- package/dist/constants/permissions.js +1 -0
- package/dist/generated/wspace-operations.d.ts +55 -0
- package/dist/generated/wspace-operations.js +301 -30
- package/package.json +1 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { BIGCONSOLE_PERMISSIONS as e } from "../../../constants/permissions.js";
|
|
2
|
+
import { useBigConsole as t } from "../../context/BigConsoleContext.js";
|
|
3
|
+
import "../../context/index.js";
|
|
4
|
+
import { useWidgetTypeCatalog as n } from "../../hooks/useWidgetTypeCatalog.js";
|
|
5
|
+
import { resolveBackendErrorMessage as r } from "../../utils/backendError.js";
|
|
6
|
+
import { isWidgetCatalogRowMuted as i, sortWidgetCatalogRows as a, widgetCatalogAction as o, widgetCatalogRowKey as s } from "../../utils/widgetCatalog.js";
|
|
7
|
+
import { useCallback as c, useMemo as l, useState as u } from "react";
|
|
8
|
+
import { usePermissions as d } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
9
|
+
import { Blocks as f, ExternalLink as p } from "lucide-react";
|
|
10
|
+
import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
// src/bigconsole/components/settings/WidgetCatalogSection.tsx
|
|
13
|
+
var _ = "px-3 py-2 text-left align-middle text-body-sm", v = "px-3 py-2 text-left text-body-sm font-medium text-text-secondary", y = "rounded-button border border-border px-3 py-1 text-body-sm text-text-primary hover:border-action-primary-bg disabled:cursor-not-allowed disabled:opacity-60", b = () => {
|
|
14
|
+
let { hasPermission: t, isLoading: n } = d();
|
|
15
|
+
return n || !t(e.WIDGET_MANAGE_TYPES) ? null : /* @__PURE__ */ h(x, {});
|
|
16
|
+
}, x = () => {
|
|
17
|
+
let { t: e } = m(), { workspaceId: d, basePath: b } = t(), x = n(d, !0), [S, C] = u(null), w = l(() => a(x.rows), [x.rows]), T = `${b}/store${typeof window > "u" ? "" : window.location.search}`, { install: E, uninstall: D } = x, O = c(async (t, n) => {
|
|
18
|
+
C(null);
|
|
19
|
+
let i = n === "install" ? await E(t) : await D(t);
|
|
20
|
+
i && C(r(e, i));
|
|
21
|
+
}, [
|
|
22
|
+
E,
|
|
23
|
+
D,
|
|
24
|
+
e
|
|
25
|
+
]), k = (t) => {
|
|
26
|
+
switch (t) {
|
|
27
|
+
case "AVAILABLE": return e("bigconsole.settings.widgetCatalog.status.available", "Available");
|
|
28
|
+
case "DEPRECATED": return e("bigconsole.settings.widgetCatalog.status.deprecated", "Deprecated");
|
|
29
|
+
case "DISABLED": return e("bigconsole.settings.widgetCatalog.status.disabled", "Disabled");
|
|
30
|
+
default: return t;
|
|
31
|
+
}
|
|
32
|
+
}, A = (t) => t === "STORE" ? e("bigconsole.settings.widgetCatalog.source.store", "Store") : e("bigconsole.settings.widgetCatalog.source.custom", "Custom"), j = (t) => {
|
|
33
|
+
let n = o(t), r = x.pendingKey === s(t), i = x.pendingKey !== null;
|
|
34
|
+
if (n === "store") return /* @__PURE__ */ g("a", {
|
|
35
|
+
href: T,
|
|
36
|
+
target: "_blank",
|
|
37
|
+
rel: "noopener noreferrer",
|
|
38
|
+
className: "inline-flex items-center gap-1 text-body-sm text-text-link hover:underline",
|
|
39
|
+
children: [t.installedInWorkspace ? e("bigconsole.settings.widgetCatalog.actions.manageInStore", "Manage in Store") : e("bigconsole.settings.widgetCatalog.actions.getFromStore", "Get from Store"), /* @__PURE__ */ h(p, {
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
size: 12
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
if (n === "none") return /* @__PURE__ */ h("span", {
|
|
45
|
+
className: "text-body-sm text-text-muted",
|
|
46
|
+
children: e("bigconsole.settings.widgetCatalog.actions.unavailable", "Not installable")
|
|
47
|
+
});
|
|
48
|
+
let a = n === "install" ? r ? e("bigconsole.settings.widgetCatalog.actions.installing", "Installing…") : e("bigconsole.settings.widgetCatalog.actions.install", "Install") : r ? e("bigconsole.settings.widgetCatalog.actions.uninstalling", "Uninstalling…") : e("bigconsole.settings.widgetCatalog.actions.uninstall", "Uninstall");
|
|
49
|
+
return /* @__PURE__ */ h("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
className: y,
|
|
52
|
+
disabled: i,
|
|
53
|
+
"aria-busy": r,
|
|
54
|
+
"aria-label": `${a} ${t.name} ${t.widgetVersion}`,
|
|
55
|
+
onClick: () => void O(t, n),
|
|
56
|
+
children: a
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ g("section", {
|
|
60
|
+
"aria-labelledby": "bigconsole-widget-catalog-title",
|
|
61
|
+
"data-testid": "bigconsole-widget-catalog",
|
|
62
|
+
className: "mb-[var(--space-sectionGap)] rounded-card border border-border-seam bg-bg-surface p-[var(--space-cardPadding)] shadow-pop",
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ g("div", {
|
|
65
|
+
className: "mb-4 flex flex-wrap items-start justify-between gap-form-gap",
|
|
66
|
+
children: [/* @__PURE__ */ g("div", {
|
|
67
|
+
className: "flex items-start gap-[var(--space-iconGap)]",
|
|
68
|
+
children: [/* @__PURE__ */ h(f, {
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
size: 20,
|
|
71
|
+
className: "mt-0.5 text-text-primary"
|
|
72
|
+
}), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("h2", {
|
|
73
|
+
id: "bigconsole-widget-catalog-title",
|
|
74
|
+
className: "text-body-md font-semibold text-text-primary",
|
|
75
|
+
children: e("bigconsole.settings.widgetCatalog.title", "Widget catalog")
|
|
76
|
+
}), /* @__PURE__ */ h("p", {
|
|
77
|
+
className: "mt-1 text-body-sm text-text-muted",
|
|
78
|
+
children: e("bigconsole.settings.widgetCatalog.subtitle", "Custom and Store widget types registered for BigConsole. Installed types appear in this workspace’s widget palette.")
|
|
79
|
+
})] })]
|
|
80
|
+
}), /* @__PURE__ */ g("a", {
|
|
81
|
+
href: T,
|
|
82
|
+
target: "_blank",
|
|
83
|
+
rel: "noopener noreferrer",
|
|
84
|
+
className: "inline-flex items-center gap-1 text-body-sm text-text-link hover:underline",
|
|
85
|
+
children: [e("bigconsole.settings.widgetCatalog.browseStore", "Browse widget store"), /* @__PURE__ */ h(p, {
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
size: 12
|
|
88
|
+
})]
|
|
89
|
+
})]
|
|
90
|
+
}),
|
|
91
|
+
S && /* @__PURE__ */ h("p", {
|
|
92
|
+
role: "alert",
|
|
93
|
+
className: "mb-form-gap text-body-sm text-status-error-text",
|
|
94
|
+
children: S
|
|
95
|
+
}),
|
|
96
|
+
x.loadError ? /* @__PURE__ */ g("div", {
|
|
97
|
+
role: "alert",
|
|
98
|
+
className: "flex flex-wrap items-center gap-form-gap text-body-sm text-status-error-text",
|
|
99
|
+
children: [/* @__PURE__ */ g("span", { children: [
|
|
100
|
+
e("bigconsole.settings.widgetCatalog.loadFailed", "The widget catalog could not be loaded."),
|
|
101
|
+
" ",
|
|
102
|
+
r(e, x.loadError)
|
|
103
|
+
] }), /* @__PURE__ */ h("button", {
|
|
104
|
+
type: "button",
|
|
105
|
+
className: y,
|
|
106
|
+
onClick: () => void x.reload(),
|
|
107
|
+
children: e("bigconsole.settings.widgetCatalog.retry", "Retry")
|
|
108
|
+
})]
|
|
109
|
+
}) : x.loading && w.length === 0 ? /* @__PURE__ */ h("p", {
|
|
110
|
+
role: "status",
|
|
111
|
+
className: "text-body-sm text-text-muted",
|
|
112
|
+
children: e("bigconsole.settings.widgetCatalog.loading", "Loading widget types…")
|
|
113
|
+
}) : w.length === 0 ? /* @__PURE__ */ h("p", {
|
|
114
|
+
className: "text-body-sm text-text-muted",
|
|
115
|
+
children: e("bigconsole.settings.widgetCatalog.empty", "No custom or Store widget types are registered yet. Browse the widget store to add one.")
|
|
116
|
+
}) : /* @__PURE__ */ h("div", {
|
|
117
|
+
className: "overflow-x-auto",
|
|
118
|
+
children: /* @__PURE__ */ g("table", {
|
|
119
|
+
className: "w-full min-w-[640px] border-collapse",
|
|
120
|
+
children: [/* @__PURE__ */ h("thead", { children: /* @__PURE__ */ g("tr", {
|
|
121
|
+
className: "border-b border-border-seam",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ h("th", {
|
|
124
|
+
scope: "col",
|
|
125
|
+
className: v,
|
|
126
|
+
children: e("bigconsole.settings.widgetCatalog.columns.name", "Name")
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ h("th", {
|
|
129
|
+
scope: "col",
|
|
130
|
+
className: v,
|
|
131
|
+
children: e("bigconsole.settings.widgetCatalog.columns.category", "Category")
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ h("th", {
|
|
134
|
+
scope: "col",
|
|
135
|
+
className: v,
|
|
136
|
+
children: e("bigconsole.settings.widgetCatalog.columns.version", "Version")
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ h("th", {
|
|
139
|
+
scope: "col",
|
|
140
|
+
className: v,
|
|
141
|
+
children: e("bigconsole.settings.widgetCatalog.columns.source", "Source")
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ h("th", {
|
|
144
|
+
scope: "col",
|
|
145
|
+
className: v,
|
|
146
|
+
children: e("bigconsole.settings.widgetCatalog.columns.status", "Status")
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ h("th", {
|
|
149
|
+
scope: "col",
|
|
150
|
+
className: v,
|
|
151
|
+
children: /* @__PURE__ */ h("span", {
|
|
152
|
+
className: "sr-only",
|
|
153
|
+
children: e("bigconsole.settings.widgetCatalog.columns.action", "Action")
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}) }), /* @__PURE__ */ h("tbody", { children: w.map((t) => {
|
|
158
|
+
let n = i(t);
|
|
159
|
+
return /* @__PURE__ */ g("tr", {
|
|
160
|
+
"data-status": t.status,
|
|
161
|
+
className: `border-b border-border-seam last:border-b-0 ${n ? "opacity-60" : ""}`,
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ g("td", {
|
|
164
|
+
className: _,
|
|
165
|
+
children: [/* @__PURE__ */ h("div", {
|
|
166
|
+
className: "font-medium text-text-primary",
|
|
167
|
+
children: t.name
|
|
168
|
+
}), t.author && /* @__PURE__ */ h("div", {
|
|
169
|
+
className: "text-xs text-text-muted",
|
|
170
|
+
children: e("bigconsole.settings.widgetCatalog.byAuthor", "by {{author}}", { author: t.author })
|
|
171
|
+
})]
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ h("td", {
|
|
174
|
+
className: `${_} text-text-secondary`,
|
|
175
|
+
children: t.category ?? e("bigconsole.settings.widgetCatalog.uncategorized", "Uncategorized")
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ h("td", {
|
|
178
|
+
className: `${_} text-text-secondary`,
|
|
179
|
+
children: t.widgetVersion
|
|
180
|
+
}),
|
|
181
|
+
/* @__PURE__ */ h("td", {
|
|
182
|
+
className: `${_} text-text-secondary`,
|
|
183
|
+
children: A(t.publishType)
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ g("td", {
|
|
186
|
+
className: _,
|
|
187
|
+
children: [/* @__PURE__ */ h("span", {
|
|
188
|
+
className: "text-text-secondary",
|
|
189
|
+
children: k(t.status)
|
|
190
|
+
}), t.installedInWorkspace && /* @__PURE__ */ h("span", {
|
|
191
|
+
className: "ml-2 rounded-pill bg-status-success-bg px-2 py-0.5 text-xs text-status-success-text",
|
|
192
|
+
children: e("bigconsole.settings.widgetCatalog.installed", "Installed")
|
|
193
|
+
})]
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ h("td", {
|
|
196
|
+
className: `${_} text-right`,
|
|
197
|
+
children: j(t)
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
}, s(t));
|
|
201
|
+
}) })]
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
export { b as WidgetCatalogSection, b as default };
|
|
@@ -58,6 +58,8 @@ var e = {
|
|
|
58
58
|
NO_ACTIVE_WEBHOOK_MAPPINGS: "No active webhook mappings were found for this event.",
|
|
59
59
|
WIDGET_NOT_ASSOCIATED_WITH_DASHBOARD: "That widget is not associated with a dashboard.",
|
|
60
60
|
WIDGET_TYPE_NOT_REGISTERED: "That widget type is not registered. Register it before installing.",
|
|
61
|
+
WIDGET_TYPE_REQUIRES_STORE_INSTALL: "That widget type comes from the Store. Install it from the Store instead.",
|
|
62
|
+
WIDGET_TYPE_NOT_INSTALLABLE: "That widget type cannot be installed in its current status.",
|
|
61
63
|
INVALID_PUBLISH_TYPE: "That publish type is not valid.",
|
|
62
64
|
INVALID_REGISTRABLE_PUBLISH_TYPE: "That publish type cannot be registered.",
|
|
63
65
|
INVALID_WIDGET_RENDERER: "That widget renderer is not valid.",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WidgetCatalogRow } from '../utils/widgetCatalog';
|
|
2
|
+
export interface UseWidgetTypeCatalogResult {
|
|
3
|
+
rows: WidgetCatalogRow[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
/** The load error, if the catalog could not be read. */
|
|
6
|
+
loadError: unknown;
|
|
7
|
+
/** Key (`type@version`) of the row whose install/uninstall is in flight. */
|
|
8
|
+
pendingKey: string | null;
|
|
9
|
+
reload: () => Promise<void>;
|
|
10
|
+
/** Resolves to null on success, or the error to show. */
|
|
11
|
+
install: (row: WidgetCatalogRow) => Promise<unknown>;
|
|
12
|
+
uninstall: (row: WidgetCatalogRow) => Promise<unknown>;
|
|
13
|
+
}
|
|
14
|
+
export declare function useWidgetTypeCatalog(workspaceId: string | undefined, enabled: boolean): UseWidgetTypeCatalogResult;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { InstallWidgetTypeDocument as e, UninstallWidgetTypeDocument as t, WidgetTypeCatalogDocument as n } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { widgetCatalogRowKey as r } from "../utils/widgetCatalog.js";
|
|
3
|
+
import { useCallback as i, useMemo as a, useState as o } from "react";
|
|
4
|
+
import { useApolloClient as s, useQuery as c } from "@apollo/client/react";
|
|
5
|
+
// src/bigconsole/hooks/useWidgetTypeCatalog.ts
|
|
6
|
+
function l(l, u) {
|
|
7
|
+
let d = s(), [f, p] = o(null), [m, h] = o({}), { data: g, dataState: _, loading: v, error: y, refetch: b } = c(n, {
|
|
8
|
+
skip: !u || !l,
|
|
9
|
+
fetchPolicy: "network-only",
|
|
10
|
+
notifyOnNetworkStatusChange: !0
|
|
11
|
+
}), x = _ === "complete" ? g?.widgetTypeCatalog : void 0, S = a(() => (x ?? []).map((e) => {
|
|
12
|
+
let t = m[r(e)];
|
|
13
|
+
return t === void 0 ? e : {
|
|
14
|
+
...e,
|
|
15
|
+
installedInWorkspace: t
|
|
16
|
+
};
|
|
17
|
+
}), [x, m]), C = i(async () => {
|
|
18
|
+
h({}), await b();
|
|
19
|
+
}, [b]), w = i((e, t) => {
|
|
20
|
+
let n = r(e);
|
|
21
|
+
h((e) => ({
|
|
22
|
+
...e,
|
|
23
|
+
[n]: t
|
|
24
|
+
}));
|
|
25
|
+
}, []), T = i(async (t) => {
|
|
26
|
+
if (!l) return null;
|
|
27
|
+
p(r(t));
|
|
28
|
+
try {
|
|
29
|
+
return await d.mutate({
|
|
30
|
+
mutation: e,
|
|
31
|
+
variables: { input: {
|
|
32
|
+
widgetType: t.widgetType,
|
|
33
|
+
widgetVersion: t.widgetVersion,
|
|
34
|
+
publishType: t.publishType,
|
|
35
|
+
workspaceId: l
|
|
36
|
+
} }
|
|
37
|
+
}), w(t, !0), null;
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return e;
|
|
40
|
+
} finally {
|
|
41
|
+
p(null);
|
|
42
|
+
}
|
|
43
|
+
}, [
|
|
44
|
+
d,
|
|
45
|
+
w,
|
|
46
|
+
l
|
|
47
|
+
]), E = i(async (e) => {
|
|
48
|
+
if (!l) return null;
|
|
49
|
+
p(r(e));
|
|
50
|
+
try {
|
|
51
|
+
return await d.mutate({
|
|
52
|
+
mutation: t,
|
|
53
|
+
variables: { input: {
|
|
54
|
+
widgetType: e.widgetType,
|
|
55
|
+
widgetVersion: e.widgetVersion,
|
|
56
|
+
workspaceId: l
|
|
57
|
+
} }
|
|
58
|
+
}), w(e, !1), null;
|
|
59
|
+
} catch (e) {
|
|
60
|
+
return e;
|
|
61
|
+
} finally {
|
|
62
|
+
p(null);
|
|
63
|
+
}
|
|
64
|
+
}, [
|
|
65
|
+
d,
|
|
66
|
+
w,
|
|
67
|
+
l
|
|
68
|
+
]);
|
|
69
|
+
return {
|
|
70
|
+
rows: S,
|
|
71
|
+
loading: v,
|
|
72
|
+
loadError: y ?? null,
|
|
73
|
+
pendingKey: f,
|
|
74
|
+
reload: C,
|
|
75
|
+
install: T,
|
|
76
|
+
uninstall: E
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export { l as useWidgetTypeCatalog };
|