@omniviewdev/runtime 0.6.0 → 0.7.1
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/api.cjs +1 -1
- package/dist/api.js +2 -2
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/settings/servicewrapper.d.ts +1 -0
- package/dist/bindings/github.com/omniviewdev/omniview/internal/settings/servicewrapper.d.ts +4 -0
- package/dist/bindings/github.com/omniviewdev/plugin-sdk/settings/index.d.ts +1 -1
- package/dist/bindings/github.com/omniviewdev/plugin-sdk/settings/models.d.ts +14 -0
- package/dist/graphservice-1J8q3eeL.cjs +1 -0
- package/dist/graphservice-CUg1PUsC.js +852 -0
- package/dist/hooks/snackbar/NotificationCenter.styles.d.ts +77 -0
- package/dist/hooks/snackbar/useSnackbar.d.ts +2 -0
- package/dist/index.cjs +4 -2
- package/dist/index.js +1240 -1034
- package/dist/{models-D-vu7j83.js → models-4EtitZnM.js} +379 -361
- package/dist/models-BQsuB2Lj.cjs +1 -0
- package/dist/{models-8-4Ny_ft.cjs → models-BpVWHqlF.cjs} +1 -1
- package/dist/{models-BlTzZkmp.js → models-C5sf8GNY.js} +1 -1
- package/dist/models.cjs +1 -1
- package/dist/models.js +48 -47
- package/package.json +1 -1
- package/dist/graphservice-BKFw5MxQ.js +0 -844
- package/dist/graphservice-CWIVejHl.cjs +0 -1
- package/dist/models-CGYstu7u.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import
|
|
6
|
-
import { Link as
|
|
1
|
+
var mt = Object.defineProperty;
|
|
2
|
+
var Et = (t, e, n) => e in t ? mt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var L = (t, e, n) => Et(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { jsx as R, jsxs as q, Fragment as St } from "react/jsx-runtime";
|
|
5
|
+
import C, { useContext as X, createContext as ue, useState as K, useRef as W, useCallback as M, useSyncExternalStore as vt, useEffect as j, useMemo as Ct } from "react";
|
|
6
|
+
import { Link as _t, useNavigate as wt, useLocation as bt, createMemoryRouter as Rt, RouterProvider as It } from "react-router-dom";
|
|
7
7
|
import "./index-D2mKAO8s.js";
|
|
8
|
-
import { P as
|
|
9
|
-
import { P as
|
|
10
|
-
import { O as
|
|
11
|
-
import { useQueryClient as
|
|
12
|
-
import { useToast as
|
|
13
|
-
import { w as
|
|
14
|
-
const
|
|
8
|
+
import { P as Ot, G as At, V as Tt, S as Dt, a as qe, U as xt, R as Ft, b as Nt, c as $e, d as Pt, L as Lt, e as kt, f as Mt, g as Ut, h as qt, i as $t, j as Wt, C as Gt, k as jt, l as Qt, m as Kt, n as Ht, Q as Bt, o as zt, p as De, q as Vt, r as We, F as Yt, s as Jt, t as Ge, D as je, u as Xt, v as Zt, w as en, x as Qe, y as tn, z as nn, A as Ke, B as rn, E as sn, H as on, I as an, J as cn, K as un, M as xe, N as ln, O as dn, T as fn, W as pn, X as hn } from "./graphservice-CUg1PUsC.js";
|
|
9
|
+
import { P as gn, W as yn, S as mn, C as En, L as Sn, F as vn, a as Cn, U as He, D as Be, G as _n, b as ze, c as Ve, A as Ye } from "./models-4EtitZnM.js";
|
|
10
|
+
import { O as x, a as Je } from "./events-Bcx6NsMp.js";
|
|
11
|
+
import { useQueryClient as B, useMutation as N, useQuery as F, keepPreviousData as Xe, useQueries as wn } from "@tanstack/react-query";
|
|
12
|
+
import { useToast as bn, Card as Rn, Toolbar as Fe, Text as ee, IconButton as ne, EmptyState as In, Button as pe, Code as On } from "@omniviewdev/base-ui";
|
|
13
|
+
import { w as An } from "./legacyEnum-DORXlU_y.js";
|
|
14
|
+
const _e = C.createContext(void 0), D = {
|
|
15
15
|
// Plugin
|
|
16
16
|
PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
|
|
17
17
|
PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
|
|
@@ -46,88 +46,88 @@ const Ee = _.createContext(void 0), F = {
|
|
|
46
46
|
INTERNAL: "omniview:internal",
|
|
47
47
|
VALIDATION: "omniview:validation",
|
|
48
48
|
NOT_IMPLEMENTED: "omniview:not-implemented"
|
|
49
|
-
},
|
|
50
|
-
INVALID_REQUEST: [
|
|
51
|
-
UNSUPPORTED: [
|
|
52
|
-
FORBIDDEN: [
|
|
53
|
-
UNAUTHORIZED: [
|
|
54
|
-
NOT_FOUND: [
|
|
55
|
-
CONFLICT: [
|
|
56
|
-
ALREADY_EXISTS: [
|
|
57
|
-
CANCELLED: [
|
|
58
|
-
TIMEOUT: [
|
|
59
|
-
UNAVAILABLE: [
|
|
60
|
-
CONNECTION_ERROR: [
|
|
61
|
-
CERTIFICATE_ERROR: [
|
|
62
|
-
RESOURCE_LIMIT: [
|
|
63
|
-
CONTINUATION_EXPIRED: [
|
|
64
|
-
RESET_REQUIRED: [
|
|
65
|
-
PARTIAL_RESULT: [
|
|
66
|
-
PROVIDER_ERROR: [
|
|
67
|
-
INTERNAL: [
|
|
49
|
+
}, Ne = {
|
|
50
|
+
INVALID_REQUEST: [D.VALIDATION, 400, "correctRequest"],
|
|
51
|
+
UNSUPPORTED: [D.NOT_IMPLEMENTED, 501, "refreshContract"],
|
|
52
|
+
FORBIDDEN: [D.RESOURCE_FORBIDDEN, 403, "none"],
|
|
53
|
+
UNAUTHORIZED: [D.RESOURCE_UNAUTHORIZED, 401, "none"],
|
|
54
|
+
NOT_FOUND: [D.RESOURCE_NOT_FOUND, 404, "none"],
|
|
55
|
+
CONFLICT: [D.RESOURCE_CONFLICT, 409, "refreshContract"],
|
|
56
|
+
ALREADY_EXISTS: [D.RESOURCE_CONFLICT, 409, "refreshContract"],
|
|
57
|
+
CANCELLED: [D.CANCELLED, 499, "none"],
|
|
58
|
+
TIMEOUT: [D.RESOURCE_TIMEOUT, 408, "none"],
|
|
59
|
+
UNAVAILABLE: [D.CONNECTION_FAILED, 503, "reconnect"],
|
|
60
|
+
CONNECTION_ERROR: [D.CONNECTION_FAILED, 503, "reconnect"],
|
|
61
|
+
CERTIFICATE_ERROR: [D.CONNECTION_FAILED, 502, "reconnect"],
|
|
62
|
+
RESOURCE_LIMIT: [D.RESOURCE_LIMIT, 429, "correctRequest"],
|
|
63
|
+
CONTINUATION_EXPIRED: [D.RESOURCE_CONTINUATION_EXPIRED, 410, "restartQuery"],
|
|
64
|
+
RESET_REQUIRED: [D.RESOURCE_RESET_REQUIRED, 409, "restartQuery"],
|
|
65
|
+
PARTIAL_RESULT: [D.RESOURCE_PARTIAL, 422, "none"],
|
|
66
|
+
PROVIDER_ERROR: [D.RESOURCE_PROVIDER_ERROR, 502, "none"],
|
|
67
|
+
INTERNAL: [D.INTERNAL, 500, "none"]
|
|
68
68
|
};
|
|
69
|
-
function
|
|
69
|
+
function he(t) {
|
|
70
70
|
return typeof t == "object" && t !== null ? t : void 0;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function G(t, e) {
|
|
73
73
|
return typeof t == "string" && t.length > 0 && t.length <= e;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return { type:
|
|
75
|
+
function ge() {
|
|
76
|
+
return { type: D.CANCELLED, code: "CANCELLED", title: "Cancelled", status: 499, detail: "The operation was cancelled.", recovery: "none" };
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function ie(t, e) {
|
|
79
79
|
if (e > 4) return;
|
|
80
|
-
if (t === "cancelled") return
|
|
80
|
+
if (t === "cancelled") return ge();
|
|
81
81
|
if (typeof t == "string") {
|
|
82
82
|
const r = t.trim();
|
|
83
83
|
if (!r.startsWith("{")) return;
|
|
84
84
|
try {
|
|
85
|
-
return
|
|
85
|
+
return ie(JSON.parse(r), e + 1);
|
|
86
86
|
} catch {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
const n =
|
|
90
|
+
const n = he(t);
|
|
91
91
|
if (n) {
|
|
92
|
-
if (n.name === "AbortError" || n.name === "CancelError") return
|
|
93
|
-
if (
|
|
92
|
+
if (n.name === "AbortError" || n.name === "CancelError") return ge();
|
|
93
|
+
if (G(n.type, 256) && G(n.title, 256) && typeof n.status == "number" && Number.isInteger(n.status) && n.status >= 100 && n.status <= 599 && typeof n.detail == "string" && n.detail.length <= 4096) {
|
|
94
94
|
const r = { type: n.type, title: n.title, status: n.status, detail: n.detail };
|
|
95
|
-
|
|
96
|
-
const o =
|
|
97
|
-
return !!o && ["navigate", "retry", "open-url", "copy"].includes(String(o.type)) &&
|
|
95
|
+
G(n.code, 64) && (r.code = n.code), G(n.requestId, 256) && (r.requestId = n.requestId), G(n.instance, 512) && (r.instance = n.instance), Array.isArray(n.suggestions) && (r.suggestions = n.suggestions.filter((i) => G(i, 512)).slice(0, 8)), Array.isArray(n.actions) && (r.actions = n.actions.filter((i) => {
|
|
96
|
+
const o = he(i);
|
|
97
|
+
return !!o && ["navigate", "retry", "open-url", "copy"].includes(String(o.type)) && G(o.label, 256) && (o.target === void 0 || G(o.target, 4096));
|
|
98
98
|
}).slice(0, 8)), ["correctRequest", "refreshContract", "restartQuery", "reconnect", "none"].includes(String(n.recovery)) && (r.recovery = n.recovery);
|
|
99
|
-
const s =
|
|
99
|
+
const s = he(n.location);
|
|
100
100
|
return (s == null ? void 0 : s.unit) === "utf8-byte" && typeof s.start == "number" && typeof s.end == "number" && Number.isSafeInteger(s.start) && Number.isSafeInteger(s.end) && s.start >= 0 && s.end >= s.start && (r.location = { start: s.start, end: s.end, unit: "utf8-byte" }), r;
|
|
101
101
|
}
|
|
102
102
|
if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
|
|
103
103
|
let r = n.code;
|
|
104
|
-
if (r === "PERMISSION_DENIED" && (r = "FORBIDDEN"), ["INVALID_INPUT", "FILTER_UNKNOWN_FIELD", "FILTER_INVALID_OPERATOR"].includes(r) && (r = "INVALID_REQUEST"), Object.prototype.hasOwnProperty.call(
|
|
105
|
-
const [s, i, o] =
|
|
104
|
+
if (r === "PERMISSION_DENIED" && (r = "FORBIDDEN"), ["INVALID_INPUT", "FILTER_UNKNOWN_FIELD", "FILTER_INVALID_OPERATOR"].includes(r) && (r = "INVALID_REQUEST"), Object.prototype.hasOwnProperty.call(Ne, r) || (r = "INTERNAL"), r === "CANCELLED") return ge();
|
|
105
|
+
const [s, i, o] = Ne[r], a = r === "FORBIDDEN" || r === "UNAUTHORIZED" || r === "INTERNAL" || r === "PROVIDER_ERROR";
|
|
106
106
|
return {
|
|
107
107
|
type: s,
|
|
108
108
|
status: i,
|
|
109
109
|
code: r,
|
|
110
110
|
recovery: o,
|
|
111
|
-
title: a ? r === "FORBIDDEN" ? "Access denied" : r === "UNAUTHORIZED" ? "Authentication required" : "Operation failed" :
|
|
112
|
-
detail: a ? "The operation could not be completed." :
|
|
113
|
-
...!a && Array.isArray(n.suggestions) ? { suggestions: n.suggestions.filter((c) =>
|
|
111
|
+
title: a ? r === "FORBIDDEN" ? "Access denied" : r === "UNAUTHORIZED" ? "Authentication required" : "Operation failed" : G(n.title, 256) ? n.title : "Operation failed",
|
|
112
|
+
detail: a ? "The operation could not be completed." : G(n.message, 4096) ? n.message : "The operation could not be completed.",
|
|
113
|
+
...!a && Array.isArray(n.suggestions) ? { suggestions: n.suggestions.filter((c) => G(c, 512)).slice(0, 8) } : {}
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
return
|
|
116
|
+
return ie(n.message, e + 1) ?? ie(n.cause, e + 1);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
return
|
|
121
|
-
type:
|
|
119
|
+
function H(t) {
|
|
120
|
+
return ie(t, 0) ?? {
|
|
121
|
+
type: D.INTERNAL,
|
|
122
122
|
title: t == null ? "Unknown error" : "Error",
|
|
123
123
|
status: 500,
|
|
124
124
|
detail: t == null ? "An unknown error occurred." : "The operation could not be completed."
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
return
|
|
127
|
+
function ae(t) {
|
|
128
|
+
return H(t).type === D.CANCELLED;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Tn(t) {
|
|
131
131
|
switch (t.type) {
|
|
132
132
|
case "navigate":
|
|
133
133
|
return {
|
|
@@ -164,7 +164,7 @@ function _n(t) {
|
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function Ze(t, e) {
|
|
168
168
|
var s, i;
|
|
169
169
|
const n = [
|
|
170
170
|
t.detail,
|
|
@@ -175,73 +175,73 @@ function ze(t, e) {
|
|
|
175
175
|
message: e || (t.title !== "Error" ? t.title : "Operation failed"),
|
|
176
176
|
status: "error",
|
|
177
177
|
details: n,
|
|
178
|
-
actions: (i = t.actions) == null ? void 0 : i.map(
|
|
178
|
+
actions: (i = t.actions) == null ? void 0 : i.map(Tn)
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
if (
|
|
183
|
-
const r =
|
|
184
|
-
t(
|
|
181
|
+
function z(t, e, n) {
|
|
182
|
+
if (ae(e)) return;
|
|
183
|
+
const r = H(e);
|
|
184
|
+
t(Ze(r, n));
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function U(t, e) {
|
|
187
187
|
return (n) => {
|
|
188
|
-
if (
|
|
189
|
-
const r =
|
|
190
|
-
t(
|
|
188
|
+
if (ae(n)) return;
|
|
189
|
+
const r = H(n);
|
|
190
|
+
t(Ze(r, r.title !== "Error" ? r.title : e));
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const { children: e, pluginId: n } = t, [r, s] =
|
|
195
|
-
console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!
|
|
196
|
-
const
|
|
193
|
+
function cs(t) {
|
|
194
|
+
const { children: e, pluginId: n } = t, [r, s] = C.useState({}), [i, o] = C.useState(new gn()), [a, c] = C.useState(!1), [d, l] = C.useState(null), f = C.useRef(0), h = C.useRef(0);
|
|
195
|
+
console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!d });
|
|
196
|
+
const g = C.useCallback(() => {
|
|
197
197
|
if (n === void 0 || n === "")
|
|
198
198
|
return;
|
|
199
|
-
const
|
|
200
|
-
console.debug(`[PluginContextProvider] fetching settings for "${n}"`),
|
|
201
|
-
|
|
202
|
-
}).catch((
|
|
203
|
-
if (
|
|
204
|
-
const
|
|
205
|
-
console.error(`[PluginContextProvider] error fetching settings for "${n}":`,
|
|
199
|
+
const S = ++f.current;
|
|
200
|
+
console.debug(`[PluginContextProvider] fetching settings for "${n}"`), Ot(n).then((u) => {
|
|
201
|
+
S === f.current && (console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(u)), s(u));
|
|
202
|
+
}).catch((u) => {
|
|
203
|
+
if (S !== f.current) return;
|
|
204
|
+
const p = H(u);
|
|
205
|
+
console.error(`[PluginContextProvider] error fetching settings for "${n}":`, p.detail);
|
|
206
206
|
});
|
|
207
|
-
}, [n]),
|
|
207
|
+
}, [n]), m = C.useCallback(() => {
|
|
208
208
|
if (n === void 0 || n === "") {
|
|
209
209
|
console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
console.debug(`[PluginContextProvider] fetching meta for "${n}"`),
|
|
214
|
-
|
|
215
|
-
}).catch((
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
console.error(`[PluginContextProvider] error fetching meta for "${n}":`,
|
|
212
|
+
const S = ++h.current;
|
|
213
|
+
console.debug(`[PluginContextProvider] fetching meta for "${n}"`), l(null), At(n).then((u) => {
|
|
214
|
+
S === h.current && (console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: u == null ? void 0 : u.name, version: u == null ? void 0 : u.version }), o(u), c(!0));
|
|
215
|
+
}).catch((u) => {
|
|
216
|
+
if (S !== h.current) return;
|
|
217
|
+
const p = H(u);
|
|
218
|
+
console.error(`[PluginContextProvider] error fetching meta for "${n}":`, p.detail), l(p.detail), c(!1);
|
|
219
219
|
});
|
|
220
220
|
}, [n]);
|
|
221
|
-
return
|
|
221
|
+
return C.useEffect(() => {
|
|
222
222
|
if (a) return;
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
var
|
|
229
|
-
((
|
|
223
|
+
const S = () => {
|
|
224
|
+
g(), m();
|
|
225
|
+
}, u = [
|
|
226
|
+
x("plugin/init_complete", S),
|
|
227
|
+
x("plugin/dev_install_complete", (p) => {
|
|
228
|
+
var _;
|
|
229
|
+
((_ = p.data) == null ? void 0 : _.id) === n && S();
|
|
230
230
|
}),
|
|
231
|
-
|
|
231
|
+
x("plugin/inventory_changed", S)
|
|
232
232
|
];
|
|
233
233
|
return () => {
|
|
234
|
-
for (const
|
|
234
|
+
for (const p of u) p();
|
|
235
235
|
};
|
|
236
|
-
}, [n, a,
|
|
237
|
-
++
|
|
238
|
-
}), [n,
|
|
236
|
+
}, [n, a, g, m]), C.useEffect(() => (console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), c(!1), l(null), s({}), g(), m(), () => {
|
|
237
|
+
++f.current, ++h.current;
|
|
238
|
+
}), [n, g, m]), d ? /* @__PURE__ */ R("div", { style: {
|
|
239
239
|
display: "flex",
|
|
240
240
|
flex: 1,
|
|
241
241
|
alignItems: "center",
|
|
242
242
|
justifyContent: "center",
|
|
243
243
|
padding: 24
|
|
244
|
-
}, children: /* @__PURE__ */
|
|
244
|
+
}, children: /* @__PURE__ */ q("div", { style: {
|
|
245
245
|
maxWidth: 480,
|
|
246
246
|
width: "100%",
|
|
247
247
|
border: "1px solid #7F1D1D",
|
|
@@ -250,19 +250,19 @@ function Zr(t) {
|
|
|
250
250
|
padding: 20,
|
|
251
251
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
252
252
|
}, children: [
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
/* @__PURE__ */
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ q("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
|
|
254
|
+
/* @__PURE__ */ q("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
255
|
+
/* @__PURE__ */ R("circle", { cx: "12", cy: "12", r: "10" }),
|
|
256
|
+
/* @__PURE__ */ R("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
257
|
+
/* @__PURE__ */ R("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
258
258
|
] }),
|
|
259
|
-
/* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ R("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
|
|
260
260
|
] }),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ R("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: d }),
|
|
262
|
+
/* @__PURE__ */ R(
|
|
263
263
|
"button",
|
|
264
264
|
{
|
|
265
|
-
onClick: () =>
|
|
265
|
+
onClick: () => m(),
|
|
266
266
|
style: {
|
|
267
267
|
background: "transparent",
|
|
268
268
|
color: "#F87171",
|
|
@@ -276,13 +276,13 @@ function Zr(t) {
|
|
|
276
276
|
children: "Retry"
|
|
277
277
|
}
|
|
278
278
|
)
|
|
279
|
-
] }) }) : a ? /* @__PURE__ */
|
|
279
|
+
] }) }) : a ? /* @__PURE__ */ R(_e.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ q("div", { style: {
|
|
280
280
|
display: "flex",
|
|
281
281
|
flex: 1,
|
|
282
282
|
alignItems: "center",
|
|
283
283
|
justifyContent: "center"
|
|
284
284
|
}, children: [
|
|
285
|
-
/* @__PURE__ */
|
|
285
|
+
/* @__PURE__ */ R("div", { style: {
|
|
286
286
|
width: 24,
|
|
287
287
|
height: 24,
|
|
288
288
|
border: "2px solid #3F3F46",
|
|
@@ -290,38 +290,38 @@ function Zr(t) {
|
|
|
290
290
|
borderRadius: "50%",
|
|
291
291
|
animation: "plugin-spin 0.8s linear infinite"
|
|
292
292
|
} }),
|
|
293
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ R("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
|
|
294
294
|
] });
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const t =
|
|
296
|
+
function we() {
|
|
297
|
+
const t = X(_e);
|
|
298
298
|
if (!t)
|
|
299
299
|
throw new Error("usePluginContext must be used within a PluginContextProvider");
|
|
300
300
|
return t;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
return
|
|
302
|
+
function us() {
|
|
303
|
+
return we().settings;
|
|
304
304
|
}
|
|
305
|
-
const
|
|
306
|
-
const [e, n] =
|
|
305
|
+
const et = ue(void 0), ls = ({ children: t }) => {
|
|
306
|
+
const [e, n] = K({}), r = W(0), s = M(() => {
|
|
307
307
|
const o = r.current + 1;
|
|
308
|
-
r.current = o,
|
|
308
|
+
r.current = o, Tt().then((a) => {
|
|
309
309
|
o === r.current && n(a);
|
|
310
310
|
}).catch((a) => {
|
|
311
311
|
o === r.current && console.error("Error fetching settings:", a);
|
|
312
312
|
});
|
|
313
313
|
}, []);
|
|
314
|
-
|
|
315
|
-
const o =
|
|
314
|
+
C.useEffect(() => {
|
|
315
|
+
const o = x("settings/changed", () => s());
|
|
316
316
|
return s(), () => {
|
|
317
317
|
r.current += 1, o();
|
|
318
318
|
};
|
|
319
319
|
}, [s]);
|
|
320
|
-
const i =
|
|
320
|
+
const i = M(() => {
|
|
321
321
|
s();
|
|
322
322
|
}, [s]);
|
|
323
|
-
return /* @__PURE__ */
|
|
324
|
-
},
|
|
323
|
+
return /* @__PURE__ */ R(et.Provider, { value: { settings: e, reload: i }, children: t });
|
|
324
|
+
}, Dn = {
|
|
325
325
|
height: 32,
|
|
326
326
|
focused: 0,
|
|
327
327
|
tabs: [],
|
|
@@ -345,80 +345,80 @@ const Ve = ie(void 0), ts = ({ children: t }) => {
|
|
|
345
345
|
},
|
|
346
346
|
fullscreenDrawer: () => {
|
|
347
347
|
}
|
|
348
|
-
},
|
|
349
|
-
const [e, n] =
|
|
348
|
+
}, xn = C.createContext(Dn), Fn = ue(void 0), Nn = C.createContext(void 0), tt = C.createContext(void 0), Pn = 3e4, ds = ({ children: t }) => {
|
|
349
|
+
const [e, n] = C.useState([]), r = C.useCallback((a) => {
|
|
350
350
|
n((c) => [a, ...c]);
|
|
351
|
-
}, []), s =
|
|
351
|
+
}, []), s = C.useCallback((a, c) => {
|
|
352
352
|
n(
|
|
353
|
-
(
|
|
353
|
+
(d) => d.map((l) => l.id === a ? { ...l, ...c } : l)
|
|
354
354
|
);
|
|
355
|
-
}, []), i =
|
|
356
|
-
n((c) => c.filter((
|
|
355
|
+
}, []), i = C.useCallback((a) => {
|
|
356
|
+
n((c) => c.filter((d) => d.id !== a));
|
|
357
357
|
}, []);
|
|
358
|
-
|
|
358
|
+
C.useEffect(() => {
|
|
359
359
|
const a = [];
|
|
360
360
|
for (const c of e)
|
|
361
361
|
if (c.status !== "running") {
|
|
362
|
-
const
|
|
363
|
-
a.push(setTimeout(() => i(c.id),
|
|
362
|
+
const d = Date.now() - (c.completedAt ?? c.startedAt), l = Math.max(0, Pn - d);
|
|
363
|
+
a.push(setTimeout(() => i(c.id), l));
|
|
364
364
|
}
|
|
365
365
|
return () => a.forEach(clearTimeout);
|
|
366
366
|
}, [e, i]);
|
|
367
|
-
const o =
|
|
367
|
+
const o = C.useMemo(
|
|
368
368
|
() => ({ operations: e, addOperation: r, updateOperation: s, removeOperation: i }),
|
|
369
369
|
[e, r, s, i]
|
|
370
370
|
);
|
|
371
|
-
return /* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ R(tt.Provider, { value: o, children: t });
|
|
372
372
|
};
|
|
373
|
-
var
|
|
374
|
-
return
|
|
373
|
+
var Se = function(t, e) {
|
|
374
|
+
return Se = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
375
375
|
n.__proto__ = r;
|
|
376
376
|
} || function(n, r) {
|
|
377
377
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
378
|
-
},
|
|
378
|
+
}, Se(t, e);
|
|
379
379
|
};
|
|
380
|
-
function
|
|
380
|
+
function Ln(t, e) {
|
|
381
381
|
if (typeof e != "function" && e !== null)
|
|
382
382
|
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
383
|
-
|
|
383
|
+
Se(t, e);
|
|
384
384
|
function n() {
|
|
385
385
|
this.constructor = t;
|
|
386
386
|
}
|
|
387
387
|
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
|
|
388
388
|
}
|
|
389
|
-
var
|
|
389
|
+
var ye = "Invariant Violation", Pe = Object.setPrototypeOf, kn = Pe === void 0 ? function(t, e) {
|
|
390
390
|
return t.__proto__ = e, t;
|
|
391
|
-
} :
|
|
391
|
+
} : Pe, Mn = (
|
|
392
392
|
/** @class */
|
|
393
393
|
function(t) {
|
|
394
|
-
|
|
394
|
+
Ln(e, t);
|
|
395
395
|
function e(n) {
|
|
396
|
-
n === void 0 && (n =
|
|
397
|
-
var r = t.call(this, typeof n == "number" ?
|
|
398
|
-
return r.framesToPop = 1, r.name =
|
|
396
|
+
n === void 0 && (n = ye);
|
|
397
|
+
var r = t.call(this, typeof n == "number" ? ye + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
|
|
398
|
+
return r.framesToPop = 1, r.name = ye, kn(r, e.prototype), r;
|
|
399
399
|
}
|
|
400
400
|
return e;
|
|
401
401
|
}(Error)
|
|
402
402
|
);
|
|
403
|
-
function
|
|
403
|
+
function ve(t, e) {
|
|
404
404
|
if (!t)
|
|
405
|
-
throw new
|
|
405
|
+
throw new Mn(e);
|
|
406
406
|
}
|
|
407
|
-
var
|
|
408
|
-
function
|
|
407
|
+
var nt = ["debug", "log", "warn", "error", "silent"], Un = nt.indexOf("log");
|
|
408
|
+
function re(t) {
|
|
409
409
|
return function() {
|
|
410
|
-
if (
|
|
410
|
+
if (nt.indexOf(t) >= Un) {
|
|
411
411
|
var e = console[t] || console.log;
|
|
412
412
|
return e.apply(console, arguments);
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
416
|
(function(t) {
|
|
417
|
-
t.debug =
|
|
418
|
-
})(
|
|
419
|
-
const
|
|
420
|
-
function
|
|
421
|
-
const e =
|
|
417
|
+
t.debug = re("debug"), t.log = re("log"), t.warn = re("warn"), t.error = re("error");
|
|
418
|
+
})(ve || (ve = {}));
|
|
419
|
+
const rt = ue(void 0), qn = () => X(rt);
|
|
420
|
+
function fs(t) {
|
|
421
|
+
const e = qn(), n = C.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = M(
|
|
422
422
|
(o) => {
|
|
423
423
|
const a = [];
|
|
424
424
|
return e && a.push(e.subscribe(o)), r && a.push(r.subscribe(o)), () => {
|
|
@@ -427,13 +427,13 @@ function rs(t) {
|
|
|
427
427
|
};
|
|
428
428
|
},
|
|
429
429
|
[e, t, r]
|
|
430
|
-
), i =
|
|
430
|
+
), i = M(() => {
|
|
431
431
|
const o = e == null ? void 0 : e.getExtensionPoint(t);
|
|
432
432
|
if (!o) {
|
|
433
433
|
if (n.current && n.current.store === void 0)
|
|
434
434
|
return n.current.sentinel;
|
|
435
|
-
const
|
|
436
|
-
return n.current = { store: void 0, version: -1, sentinel:
|
|
435
|
+
const d = {};
|
|
436
|
+
return n.current = { store: void 0, version: -1, sentinel: d }, d;
|
|
437
437
|
}
|
|
438
438
|
const a = n.current;
|
|
439
439
|
if (a && a.store === o && a.version === o.version)
|
|
@@ -441,30 +441,30 @@ function rs(t) {
|
|
|
441
441
|
const c = {};
|
|
442
442
|
return n.current = { store: o, version: o.version, sentinel: c }, c;
|
|
443
443
|
}, [e, t]);
|
|
444
|
-
return
|
|
444
|
+
return vt(s, i), e == null ? void 0 : e.getExtensionPoint(t);
|
|
445
445
|
}
|
|
446
|
-
const
|
|
447
|
-
const n =
|
|
448
|
-
return
|
|
446
|
+
const ps = ({ registry: t, children: e }) => {
|
|
447
|
+
const n = C.useRef(t);
|
|
448
|
+
return ve(
|
|
449
449
|
n.current === t,
|
|
450
450
|
"You can't change the extension registry after it has been rendered"
|
|
451
|
-
), /* @__PURE__ */
|
|
452
|
-
},
|
|
451
|
+
), /* @__PURE__ */ R(rt.Provider, { value: n.current, children: e });
|
|
452
|
+
}, me = (t) => {
|
|
453
453
|
if (!t || typeof t != "string")
|
|
454
454
|
throw new TypeError(`extensionName is required to be a string and can't be: "${t}" (${typeof t})`);
|
|
455
455
|
return t.trim();
|
|
456
456
|
};
|
|
457
|
-
class
|
|
457
|
+
class $n {
|
|
458
458
|
constructor(e) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
459
|
+
L(this, "id");
|
|
460
|
+
L(this, "mode");
|
|
461
|
+
L(this, "_pluginId");
|
|
462
|
+
L(this, "_version", 0);
|
|
463
|
+
L(this, "_contributions", /* @__PURE__ */ new Map());
|
|
464
|
+
L(this, "_lookupCache", /* @__PURE__ */ new Map());
|
|
465
|
+
L(this, "_matcher");
|
|
466
|
+
L(this, "_select");
|
|
467
|
+
L(this, "_listeners", /* @__PURE__ */ new Set());
|
|
468
468
|
this.id = e.id, this.mode = e.mode ?? "multiple", this._pluginId = e.pluginId, this._matcher = e.matcher, this._select = e.select;
|
|
469
469
|
}
|
|
470
470
|
get pluginId() {
|
|
@@ -574,11 +574,11 @@ class Dn {
|
|
|
574
574
|
e();
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
|
-
class
|
|
577
|
+
class hs {
|
|
578
578
|
constructor(e) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
579
|
+
L(this, "_stores", /* @__PURE__ */ new Map());
|
|
580
|
+
L(this, "_storeUnsubs", /* @__PURE__ */ new Map());
|
|
581
|
+
L(this, "_listeners", /* @__PURE__ */ new Set());
|
|
582
582
|
if (e != null && e.initialStores)
|
|
583
583
|
for (const n of e.initialStores)
|
|
584
584
|
this.addExtensionPoint(n);
|
|
@@ -588,28 +588,28 @@ class os {
|
|
|
588
588
|
* Throws if the extension point ID already exists.
|
|
589
589
|
*/
|
|
590
590
|
addExtensionPoint(e) {
|
|
591
|
-
const n =
|
|
591
|
+
const n = me(e.id);
|
|
592
592
|
if (this._stores.has(n)) {
|
|
593
593
|
const s = this._stores.get(n);
|
|
594
594
|
throw new Error(
|
|
595
595
|
`Extension point "${n}" already exists (owned by "${s.pluginId ?? "unknown"}")`
|
|
596
596
|
);
|
|
597
597
|
}
|
|
598
|
-
const r = new
|
|
598
|
+
const r = new $n({ ...e, id: n });
|
|
599
599
|
this._stores.set(n, r), this._storeUnsubs.set(n, r.subscribe(() => this._notify())), this._notify();
|
|
600
600
|
}
|
|
601
601
|
/**
|
|
602
602
|
* Get an extension point store by ID.
|
|
603
603
|
*/
|
|
604
604
|
getExtensionPoint(e) {
|
|
605
|
-
const n =
|
|
605
|
+
const n = me(e);
|
|
606
606
|
return this._stores.get(n);
|
|
607
607
|
}
|
|
608
608
|
/**
|
|
609
609
|
* Check if an extension point exists.
|
|
610
610
|
*/
|
|
611
611
|
hasExtensionPoint(e) {
|
|
612
|
-
const n =
|
|
612
|
+
const n = me(e);
|
|
613
613
|
return this._stores.has(n);
|
|
614
614
|
}
|
|
615
615
|
/**
|
|
@@ -650,90 +650,296 @@ class os {
|
|
|
650
650
|
e();
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
const
|
|
653
|
+
const $ = {
|
|
654
|
+
Panel: {
|
|
655
|
+
position: "fixed",
|
|
656
|
+
right: "var(--ov-space-3)",
|
|
657
|
+
bottom: 36,
|
|
658
|
+
zIndex: "calc(var(--ov-z-toast, 9999) + 1)",
|
|
659
|
+
width: "min(480px, calc(100vw - 24px))",
|
|
660
|
+
minWidth: 0,
|
|
661
|
+
maxHeight: "min(560px, calc(100dvh - 64px))",
|
|
662
|
+
display: "flex",
|
|
663
|
+
flexDirection: "column",
|
|
664
|
+
overflow: "hidden",
|
|
665
|
+
padding: 0
|
|
666
|
+
},
|
|
667
|
+
Header: {
|
|
668
|
+
flex: "none",
|
|
669
|
+
gap: "var(--ov-space-2)",
|
|
670
|
+
paddingInline: "var(--ov-space-3)",
|
|
671
|
+
background: "var(--ov-color-bg-surface-raised)",
|
|
672
|
+
borderBottom: "1px solid var(--ov-color-border-muted)"
|
|
673
|
+
},
|
|
674
|
+
HeaderActions: { marginLeft: "auto" },
|
|
675
|
+
List: { minHeight: 0, overflowY: "auto", overscrollBehavior: "contain" },
|
|
676
|
+
Notice: { borderTop: "1px solid var(--ov-color-border-muted)" },
|
|
677
|
+
Row: {
|
|
678
|
+
display: "flex",
|
|
679
|
+
alignItems: "center",
|
|
680
|
+
gap: "var(--ov-space-1)",
|
|
681
|
+
padding: "var(--ov-space-2) var(--ov-space-2) var(--ov-space-2) var(--ov-space-3)"
|
|
682
|
+
},
|
|
683
|
+
ErrorIcon: { flex: "none", color: "var(--ov-color-danger)" },
|
|
684
|
+
Message: { flex: 1, minWidth: 0, justifyContent: "flex-start", textAlign: "left" },
|
|
685
|
+
MessageText: { minWidth: 0, overflowWrap: "anywhere" },
|
|
686
|
+
Details: { padding: "0 var(--ov-space-3) var(--ov-space-3) 36px" },
|
|
687
|
+
Code: {
|
|
688
|
+
display: "block",
|
|
689
|
+
margin: "var(--ov-space-2) 0",
|
|
690
|
+
padding: "var(--ov-space-3)",
|
|
691
|
+
maxHeight: 240,
|
|
692
|
+
overflow: "auto",
|
|
693
|
+
whiteSpace: "pre-wrap",
|
|
694
|
+
overflowWrap: "anywhere",
|
|
695
|
+
lineHeight: 1.5,
|
|
696
|
+
userSelect: "text"
|
|
697
|
+
},
|
|
698
|
+
Actions: { display: "flex", flexWrap: "wrap", gap: "var(--ov-space-2)" },
|
|
699
|
+
CopyError: {
|
|
700
|
+
margin: 0,
|
|
701
|
+
padding: "var(--ov-space-3)",
|
|
702
|
+
borderTop: "1px solid var(--ov-color-border-muted)"
|
|
703
|
+
}
|
|
704
|
+
}, st = ue(void 0), Wn = {
|
|
654
705
|
default: "info",
|
|
655
706
|
info: "info",
|
|
656
707
|
success: "success",
|
|
657
708
|
warning: "warning",
|
|
658
709
|
error: "danger"
|
|
659
|
-
},
|
|
660
|
-
const { toast: e } =
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
710
|
+
}, gs = ({ children: t }) => {
|
|
711
|
+
const { toast: e } = bn(), [n, r] = C.useState([]), [s, i] = C.useState([]), [o, a] = C.useState(!1), [c, d] = C.useState(), [l, f] = C.useState(""), h = C.useRef(Date.now()), g = C.useRef(null);
|
|
712
|
+
C.useEffect(() => {
|
|
713
|
+
var _;
|
|
714
|
+
if (!o)
|
|
715
|
+
return;
|
|
716
|
+
const u = document.activeElement;
|
|
717
|
+
(_ = g.current) == null || _.focus();
|
|
718
|
+
const p = (y) => {
|
|
719
|
+
y.key === "Escape" && (y.stopPropagation(), a(!1));
|
|
720
|
+
};
|
|
721
|
+
return document.addEventListener("keydown", p), () => {
|
|
722
|
+
document.removeEventListener("keydown", p), u instanceof HTMLElement && u.isConnected && u.focus();
|
|
723
|
+
};
|
|
724
|
+
}, [o]);
|
|
725
|
+
const m = (u) => {
|
|
726
|
+
r((p) => [...p, u]);
|
|
727
|
+
}, S = (u, p, _) => {
|
|
728
|
+
const y = typeof u == "object";
|
|
729
|
+
let E = "", w = "info", v, b = 5e3, I;
|
|
730
|
+
if (y) {
|
|
731
|
+
if (E = u.message, u.showOnce) {
|
|
732
|
+
if (n.includes(E))
|
|
668
733
|
return;
|
|
669
|
-
|
|
734
|
+
m(E);
|
|
670
735
|
}
|
|
671
|
-
|
|
736
|
+
w = u.status, v = u.details, b = u.autoHideDuration ?? 5e3, I = u.actions;
|
|
672
737
|
} else
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
738
|
+
E = u, w = p, v = _;
|
|
739
|
+
let A;
|
|
740
|
+
if (w === "error") {
|
|
741
|
+
const k = {
|
|
742
|
+
id: ++h.current,
|
|
743
|
+
message: E,
|
|
744
|
+
details: v,
|
|
745
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
746
|
+
actions: I
|
|
747
|
+
};
|
|
748
|
+
i((P) => [...P, k].slice(-20)), A = { label: "Details", onClick: () => {
|
|
749
|
+
d(k.id), a(!0);
|
|
750
|
+
} };
|
|
751
|
+
}
|
|
752
|
+
e(w === "error" ? E : v ?? E, {
|
|
753
|
+
severity: Wn[w] ?? "info",
|
|
754
|
+
title: w !== "error" && v ? E : void 0,
|
|
755
|
+
duration: b,
|
|
756
|
+
action: A ?? (I == null ? void 0 : I[0])
|
|
679
757
|
});
|
|
680
758
|
};
|
|
681
|
-
return /* @__PURE__ */
|
|
682
|
-
|
|
683
|
-
|
|
759
|
+
return /* @__PURE__ */ q(st.Provider, { value: { showSnackbar: S, openNotifications: () => {
|
|
760
|
+
a(!0);
|
|
761
|
+
}, notificationCount: s.length }, children: [
|
|
762
|
+
t,
|
|
763
|
+
o && /* @__PURE__ */ q(
|
|
764
|
+
Rn,
|
|
765
|
+
{
|
|
766
|
+
ref: g,
|
|
767
|
+
style: $.Panel,
|
|
768
|
+
size: "sm",
|
|
769
|
+
variant: "outline",
|
|
770
|
+
surface: "overlay",
|
|
771
|
+
elevation: 3,
|
|
772
|
+
"aria-label": "Notifications",
|
|
773
|
+
tabIndex: -1,
|
|
774
|
+
children: [
|
|
775
|
+
/* @__PURE__ */ q(Fe, { size: "sm", style: $.Header, children: [
|
|
776
|
+
/* @__PURE__ */ R(ee, { size: "sm", weight: "semibold", children: "Notifications" }),
|
|
777
|
+
/* @__PURE__ */ R(ee, { size: "xs", tone: "muted", children: s.length }),
|
|
778
|
+
/* @__PURE__ */ q(Fe.Group, { style: $.HeaderActions, children: [
|
|
779
|
+
/* @__PURE__ */ R(
|
|
780
|
+
ne,
|
|
781
|
+
{
|
|
782
|
+
size: "sm",
|
|
783
|
+
variant: "ghost",
|
|
784
|
+
"aria-label": "Clear history",
|
|
785
|
+
title: "Clear history",
|
|
786
|
+
disabled: s.length === 0,
|
|
787
|
+
onClick: () => {
|
|
788
|
+
i([]), d(void 0), f("");
|
|
789
|
+
},
|
|
790
|
+
children: /* @__PURE__ */ R("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ R("path", { d: "m3 3 6 6m0-6L3 9M13 6h8M3 14h18M3 20h18" }) })
|
|
791
|
+
}
|
|
792
|
+
),
|
|
793
|
+
/* @__PURE__ */ R(
|
|
794
|
+
ne,
|
|
795
|
+
{
|
|
796
|
+
size: "sm",
|
|
797
|
+
variant: "ghost",
|
|
798
|
+
"aria-label": "Close notifications",
|
|
799
|
+
title: "Close notifications",
|
|
800
|
+
onClick: () => {
|
|
801
|
+
a(!1);
|
|
802
|
+
},
|
|
803
|
+
children: /* @__PURE__ */ R("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ R("path", { d: "m6 9 6 6 6-6" }) })
|
|
804
|
+
}
|
|
805
|
+
)
|
|
806
|
+
] })
|
|
807
|
+
] }),
|
|
808
|
+
/* @__PURE__ */ q("div", { style: $.List, children: [
|
|
809
|
+
s.length === 0 && /* @__PURE__ */ R(In, { size: "sm", title: "No recent errors", description: "Error details will appear here." }),
|
|
810
|
+
s.slice().reverse().map((u) => {
|
|
811
|
+
var _, y;
|
|
812
|
+
const p = c === u.id;
|
|
813
|
+
return /* @__PURE__ */ q("div", { style: $.Notice, children: [
|
|
814
|
+
/* @__PURE__ */ q("div", { style: $.Row, children: [
|
|
815
|
+
/* @__PURE__ */ q("svg", { style: $.ErrorIcon, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-label": "Error", role: "img", children: [
|
|
816
|
+
/* @__PURE__ */ R("circle", { cx: "12", cy: "12", r: "9" }),
|
|
817
|
+
/* @__PURE__ */ R("path", { d: "m9 9 6 6m0-6-6 6" })
|
|
818
|
+
] }),
|
|
819
|
+
/* @__PURE__ */ R(
|
|
820
|
+
pe,
|
|
821
|
+
{
|
|
822
|
+
size: "sm",
|
|
823
|
+
variant: "ghost",
|
|
824
|
+
style: $.Message,
|
|
825
|
+
"aria-expanded": p,
|
|
826
|
+
"aria-controls": `notification-${u.id}`,
|
|
827
|
+
title: u.message,
|
|
828
|
+
onClick: () => {
|
|
829
|
+
d(p ? void 0 : u.id), f("");
|
|
830
|
+
},
|
|
831
|
+
children: /* @__PURE__ */ R(ee, { size: "sm", style: $.MessageText, truncate: !p, children: u.message })
|
|
832
|
+
}
|
|
833
|
+
),
|
|
834
|
+
/* @__PURE__ */ R(
|
|
835
|
+
ne,
|
|
836
|
+
{
|
|
837
|
+
size: "sm",
|
|
838
|
+
variant: "ghost",
|
|
839
|
+
"aria-label": p ? "Collapse details" : "Expand details",
|
|
840
|
+
title: p ? "Collapse details" : "Expand details",
|
|
841
|
+
"aria-expanded": p,
|
|
842
|
+
"aria-controls": `notification-${u.id}`,
|
|
843
|
+
onClick: () => {
|
|
844
|
+
d(p ? void 0 : u.id), f("");
|
|
845
|
+
},
|
|
846
|
+
children: /* @__PURE__ */ R("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ R("path", { d: p ? "m6 15 6-6 6 6" : "m6 9 6 6 6-6" }) })
|
|
847
|
+
}
|
|
848
|
+
),
|
|
849
|
+
/* @__PURE__ */ R(
|
|
850
|
+
ne,
|
|
851
|
+
{
|
|
852
|
+
size: "sm",
|
|
853
|
+
variant: "ghost",
|
|
854
|
+
"aria-label": `Dismiss ${u.message}`,
|
|
855
|
+
title: "Dismiss notification",
|
|
856
|
+
onClick: () => {
|
|
857
|
+
i((E) => E.filter((w) => w.id !== u.id)), p && (d(void 0), f(""));
|
|
858
|
+
},
|
|
859
|
+
children: /* @__PURE__ */ R("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ R("path", { d: "m6 6 12 12m0-12L6 18" }) })
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ R("div", { id: `notification-${u.id}`, hidden: !p, style: $.Details, children: p && /* @__PURE__ */ q(St, { children: [
|
|
864
|
+
/* @__PURE__ */ R(ee, { size: "xs", tone: "muted", children: /* @__PURE__ */ R("time", { dateTime: u.created, children: new Date(u.created).toLocaleString() }) }),
|
|
865
|
+
/* @__PURE__ */ R(On, { size: "sm", style: $.Code, children: (_ = u.details) != null && _.length ? u.details : u.message }),
|
|
866
|
+
/* @__PURE__ */ q("div", { style: $.Actions, children: [
|
|
867
|
+
/* @__PURE__ */ R(pe, { size: "sm", variant: "ghost", onClick: async () => {
|
|
868
|
+
f("");
|
|
869
|
+
try {
|
|
870
|
+
await navigator.clipboard.writeText(`${u.message}
|
|
871
|
+
${u.created}
|
|
872
|
+
${u.details ?? ""}`);
|
|
873
|
+
} catch {
|
|
874
|
+
f("Copy failed. Select the diagnostic text and copy it manually.");
|
|
875
|
+
}
|
|
876
|
+
}, children: "Copy details" }),
|
|
877
|
+
(y = u.actions) == null ? void 0 : y.map((E, w) => /* @__PURE__ */ R(pe, { size: "sm", variant: "outline", onClick: E.onClick, children: E.label }, `${E.label}-${w}`))
|
|
878
|
+
] })
|
|
879
|
+
] }) })
|
|
880
|
+
] }, u.id);
|
|
881
|
+
})
|
|
882
|
+
] }),
|
|
883
|
+
l && /* @__PURE__ */ R(ee, { as: "p", size: "sm", role: "status", style: $.CopyError, children: l })
|
|
884
|
+
]
|
|
885
|
+
}
|
|
886
|
+
)
|
|
887
|
+
] });
|
|
888
|
+
}, Q = () => {
|
|
889
|
+
const t = X(st);
|
|
684
890
|
if (t === void 0)
|
|
685
891
|
throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
|
|
686
892
|
return t;
|
|
687
893
|
};
|
|
688
|
-
function
|
|
689
|
-
const e =
|
|
894
|
+
function T(t) {
|
|
895
|
+
const e = X(_e), n = (e == null ? void 0 : e.pluginId) ?? t;
|
|
690
896
|
if (!n)
|
|
691
897
|
throw new Error(
|
|
692
898
|
"pluginID must be provided either via PluginContext or as an explicit parameter"
|
|
693
899
|
);
|
|
694
900
|
return n;
|
|
695
901
|
}
|
|
696
|
-
const
|
|
697
|
-
const n =
|
|
698
|
-
mutationFn: async () =>
|
|
699
|
-
onSuccess(
|
|
700
|
-
r.setQueryData(i,
|
|
902
|
+
const ys = ({ pluginID: t, connectionID: e }) => {
|
|
903
|
+
const n = T(t), r = B(), { showSnackbar: s } = Q(), i = [n, "connection", "detail", e], { mutateAsync: o } = N({
|
|
904
|
+
mutationFn: async () => Dt(n, e),
|
|
905
|
+
onSuccess(f) {
|
|
906
|
+
r.setQueryData(i, f), r.invalidateQueries({
|
|
701
907
|
queryKey: ["EDITOR_SCHEMAS", n, e]
|
|
702
908
|
});
|
|
703
909
|
},
|
|
704
|
-
onError:
|
|
910
|
+
onError: U(s, "Failed to start connection")
|
|
705
911
|
}), { mutateAsync: a } = N({
|
|
706
|
-
mutationFn: async () =>
|
|
707
|
-
onSuccess(
|
|
708
|
-
r.setQueryData(i,
|
|
912
|
+
mutationFn: async () => qe(n, e),
|
|
913
|
+
onSuccess(f) {
|
|
914
|
+
r.setQueryData(i, f);
|
|
709
915
|
},
|
|
710
|
-
onError:
|
|
916
|
+
onError: U(s, "Failed to stop connection")
|
|
711
917
|
}), { mutateAsync: c } = N({
|
|
712
|
-
mutationFn: async (
|
|
713
|
-
onSuccess(
|
|
714
|
-
s({ message: `Connection ${
|
|
918
|
+
mutationFn: async (f) => xt(n, f),
|
|
919
|
+
onSuccess(f, { name: h }) {
|
|
920
|
+
s({ message: `Connection ${h} successfully updated`, status: "success" }), r.setQueryData(i, f), r.setQueriesData(
|
|
715
921
|
{ queryKey: [n, "connection", "list"] },
|
|
716
|
-
(
|
|
922
|
+
(g) => g == null ? void 0 : g.map((m) => m.id === e ? f : m)
|
|
717
923
|
);
|
|
718
924
|
},
|
|
719
|
-
onError:
|
|
720
|
-
}), { mutateAsync:
|
|
721
|
-
mutationFn: async () =>
|
|
925
|
+
onError: U(s, "Failed to update connection")
|
|
926
|
+
}), { mutateAsync: d } = N({
|
|
927
|
+
mutationFn: async () => Ft(n, e),
|
|
722
928
|
onSuccess() {
|
|
723
929
|
s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
|
|
724
930
|
{ queryKey: [n, "connection", "list"] },
|
|
725
|
-
(
|
|
931
|
+
(f) => f == null ? void 0 : f.filter((h) => h.id !== e)
|
|
726
932
|
);
|
|
727
933
|
},
|
|
728
|
-
onError:
|
|
934
|
+
onError: U(s, "Failed to remove connection")
|
|
729
935
|
});
|
|
730
936
|
return {
|
|
731
937
|
/**
|
|
732
938
|
* Get the connection
|
|
733
939
|
*/
|
|
734
|
-
connection:
|
|
940
|
+
connection: F({
|
|
735
941
|
queryKey: i,
|
|
736
|
-
queryFn: async () =>
|
|
942
|
+
queryFn: async () => Nt(n, e)
|
|
737
943
|
}),
|
|
738
944
|
/**
|
|
739
945
|
* Start the connection
|
|
@@ -750,61 +956,61 @@ const as = ({ pluginID: t, connectionID: e }) => {
|
|
|
750
956
|
/**
|
|
751
957
|
* Delete the connection
|
|
752
958
|
*/
|
|
753
|
-
deleteConnection:
|
|
959
|
+
deleteConnection: d
|
|
754
960
|
};
|
|
755
|
-
},
|
|
756
|
-
const e =
|
|
757
|
-
mutationFn: async (
|
|
758
|
-
onError:
|
|
961
|
+
}, Gn = (t) => [t, "connection", "list"], ms = ({ plugin: t }) => {
|
|
962
|
+
const e = T(t), n = B(), { showSnackbar: r } = Q(), s = Gn(e), { mutateAsync: i } = N({
|
|
963
|
+
mutationFn: async (d) => $e(e, d.id),
|
|
964
|
+
onError: U(r, "Failed to start connection watch")
|
|
759
965
|
}), { mutateAsync: o } = N({
|
|
760
|
-
mutationFn: async (
|
|
761
|
-
onError:
|
|
762
|
-
}), a =
|
|
763
|
-
const
|
|
764
|
-
console.log("got update to connections",
|
|
966
|
+
mutationFn: async (d) => Pt(e, d.id),
|
|
967
|
+
onError: U(r, "Failed to stop connection watch")
|
|
968
|
+
}), a = C.useCallback((d) => {
|
|
969
|
+
const l = d.data;
|
|
970
|
+
console.log("got update to connections", l), n.setQueryData(s, l);
|
|
765
971
|
}, [n, s]);
|
|
766
|
-
return
|
|
767
|
-
const
|
|
972
|
+
return C.useEffect(() => {
|
|
973
|
+
const d = x(`${e}/connection/sync`, a);
|
|
768
974
|
return () => {
|
|
769
|
-
|
|
975
|
+
d();
|
|
770
976
|
};
|
|
771
977
|
}, [e, a]), {
|
|
772
|
-
connections:
|
|
978
|
+
connections: F({
|
|
773
979
|
queryKey: s,
|
|
774
980
|
queryFn: async () => {
|
|
775
981
|
try {
|
|
776
|
-
return await
|
|
777
|
-
} catch (
|
|
778
|
-
console.log(
|
|
982
|
+
return await Lt(e);
|
|
983
|
+
} catch (d) {
|
|
984
|
+
console.log(d), U(r, "Failed to load connections")(d);
|
|
779
985
|
}
|
|
780
986
|
return [];
|
|
781
987
|
},
|
|
782
988
|
staleTime: 3e4,
|
|
783
|
-
placeholderData:
|
|
989
|
+
placeholderData: Xe
|
|
784
990
|
}),
|
|
785
991
|
startWatch: i,
|
|
786
992
|
stopWatch: o
|
|
787
993
|
};
|
|
788
|
-
},
|
|
789
|
-
const n =
|
|
994
|
+
}, Es = ({ pluginID: t, connectionID: e }) => {
|
|
995
|
+
const n = T(t);
|
|
790
996
|
return {
|
|
791
997
|
/**
|
|
792
998
|
* Get the connection
|
|
793
999
|
*/
|
|
794
|
-
namespaces:
|
|
1000
|
+
namespaces: F({
|
|
795
1001
|
queryKey: [n, "connection", "namespaces", e],
|
|
796
|
-
queryFn: async () =>
|
|
1002
|
+
queryFn: async () => kt(n, e)
|
|
797
1003
|
})
|
|
798
1004
|
};
|
|
799
|
-
},
|
|
800
|
-
function
|
|
1005
|
+
}, O = An(yn, "WatchState");
|
|
1006
|
+
function Ce(t) {
|
|
801
1007
|
const e = Object.values(t.states), n = e.length;
|
|
802
1008
|
let r = 0, s = 0, i = 0, o = 0;
|
|
803
|
-
for (const
|
|
804
|
-
|
|
1009
|
+
for (const l of e)
|
|
1010
|
+
l === O.WatchStateSynced && r++, (l === O.WatchStateError || l === O.WatchStateFailed) && s++, l === O.WatchStateForbidden && i++, l === O.WatchStateSkipped && o++;
|
|
805
1011
|
const a = n - o, c = e.filter(
|
|
806
|
-
(
|
|
807
|
-
).length,
|
|
1012
|
+
(l) => l === O.WatchStateSynced || l === O.WatchStateError || l === O.WatchStateStopped || l === O.WatchStateFailed || l === O.WatchStateForbidden
|
|
1013
|
+
).length, d = a > 0 ? c / a : 0;
|
|
808
1014
|
return {
|
|
809
1015
|
pluginID: t.pluginID,
|
|
810
1016
|
connectionID: t.connectionID,
|
|
@@ -815,24 +1021,24 @@ function me(t) {
|
|
|
815
1021
|
forbiddenCount: i,
|
|
816
1022
|
skippedCount: o,
|
|
817
1023
|
doneCount: c,
|
|
818
|
-
progress:
|
|
1024
|
+
progress: d
|
|
819
1025
|
};
|
|
820
1026
|
}
|
|
821
|
-
function
|
|
1027
|
+
function ce(t) {
|
|
822
1028
|
return t.watchedTotal > 0 && t.doneCount >= t.watchedTotal;
|
|
823
1029
|
}
|
|
824
|
-
function
|
|
825
|
-
return t.some((e) => !
|
|
1030
|
+
function ot(t) {
|
|
1031
|
+
return t.some((e) => !ce(e));
|
|
826
1032
|
}
|
|
827
|
-
function
|
|
1033
|
+
function it(t) {
|
|
828
1034
|
const e = t.reduce((r, s) => r + s.watchedTotal, 0);
|
|
829
1035
|
return e === 0 ? 0 : t.reduce((r, s) => r + s.doneCount, 0) / e;
|
|
830
1036
|
}
|
|
831
|
-
function
|
|
1037
|
+
function be(t) {
|
|
832
1038
|
return `${t.pluginId}/${t.connection}`;
|
|
833
1039
|
}
|
|
834
|
-
function
|
|
835
|
-
const n =
|
|
1040
|
+
function at(t, e) {
|
|
1041
|
+
const n = be(e);
|
|
836
1042
|
t.has(n) || t.set(n, {
|
|
837
1043
|
states: {},
|
|
838
1044
|
pluginID: e.pluginId,
|
|
@@ -841,163 +1047,163 @@ function nt(t, e) {
|
|
|
841
1047
|
const r = t.get(n);
|
|
842
1048
|
return r.states[e.resourceKey] = e.state, r;
|
|
843
1049
|
}
|
|
844
|
-
function
|
|
845
|
-
const [t, e] =
|
|
846
|
-
|
|
847
|
-
const
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
const
|
|
851
|
-
return
|
|
1050
|
+
function Ss() {
|
|
1051
|
+
const [t, e] = K(/* @__PURE__ */ new Set()), [n, r] = K({}), [s, i] = K(/* @__PURE__ */ new Map()), o = W(/* @__PURE__ */ new Map()), [a, c] = K(/* @__PURE__ */ new Map());
|
|
1052
|
+
j(() => {
|
|
1053
|
+
const y = x("plugin/crash_recovery_failed", (w) => {
|
|
1054
|
+
const v = w.data, b = v == null ? void 0 : v.pluginID;
|
|
1055
|
+
b && c((I) => {
|
|
1056
|
+
const A = new Map(I);
|
|
1057
|
+
return A.set(b, v.error ?? "Crash recovery failed"), A;
|
|
852
1058
|
});
|
|
853
|
-
}),
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
if (!
|
|
857
|
-
const
|
|
858
|
-
return
|
|
1059
|
+
}), E = x("plugin/recovered", (w) => {
|
|
1060
|
+
const v = w.data, b = v == null ? void 0 : v.pluginID;
|
|
1061
|
+
b && c((I) => {
|
|
1062
|
+
if (!I.has(b)) return I;
|
|
1063
|
+
const A = new Map(I);
|
|
1064
|
+
return A.delete(b), A;
|
|
859
1065
|
});
|
|
860
1066
|
});
|
|
861
1067
|
return () => {
|
|
862
|
-
|
|
1068
|
+
y(), E();
|
|
863
1069
|
};
|
|
864
|
-
}, []),
|
|
865
|
-
|
|
866
|
-
if (!
|
|
867
|
-
const
|
|
868
|
-
for (const [
|
|
869
|
-
if (
|
|
870
|
-
b
|
|
871
|
-
for (const
|
|
872
|
-
if (!
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
const
|
|
876
|
-
pluginID:
|
|
877
|
-
connectionID:
|
|
1070
|
+
}, []), j(() => {
|
|
1071
|
+
Mt().then((y) => {
|
|
1072
|
+
if (!y) return;
|
|
1073
|
+
const E = {}, w = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Map();
|
|
1074
|
+
for (const [b, I] of Object.entries(y))
|
|
1075
|
+
if (I) {
|
|
1076
|
+
E[b] = I.map((A) => A.connection);
|
|
1077
|
+
for (const A of I) {
|
|
1078
|
+
if (!A.started) continue;
|
|
1079
|
+
const k = `${b}/${A.connection.id}`;
|
|
1080
|
+
w.add(k);
|
|
1081
|
+
const P = {
|
|
1082
|
+
pluginID: b,
|
|
1083
|
+
connectionID: A.connection.id,
|
|
878
1084
|
states: {}
|
|
879
1085
|
};
|
|
880
|
-
if (
|
|
881
|
-
for (const [
|
|
882
|
-
|
|
883
|
-
o.current.set(
|
|
1086
|
+
if (A.resources)
|
|
1087
|
+
for (const [fe, yt] of Object.entries(A.resources))
|
|
1088
|
+
P.states[fe] = yt;
|
|
1089
|
+
o.current.set(k, P), v.set(k, Ce(P));
|
|
884
1090
|
}
|
|
885
1091
|
}
|
|
886
|
-
r(
|
|
1092
|
+
r(E), e(w), i(v);
|
|
887
1093
|
}).catch(() => {
|
|
888
1094
|
});
|
|
889
|
-
}, []),
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
const
|
|
893
|
-
return
|
|
894
|
-
}), i((
|
|
895
|
-
const
|
|
896
|
-
return
|
|
897
|
-
}), o.current.delete(
|
|
898
|
-
const
|
|
899
|
-
return
|
|
900
|
-
}),
|
|
901
|
-
if (!
|
|
902
|
-
const
|
|
903
|
-
for (const [
|
|
904
|
-
|
|
905
|
-
r(
|
|
1095
|
+
}, []), j(() => x("connection/status", (E) => {
|
|
1096
|
+
const w = E.data, v = `${w.pluginID}/${w.connectionID}`;
|
|
1097
|
+
w.status === "DISCONNECTED" ? (e((b) => {
|
|
1098
|
+
const I = new Set(b);
|
|
1099
|
+
return I.delete(v), I;
|
|
1100
|
+
}), i((b) => {
|
|
1101
|
+
const I = new Map(b);
|
|
1102
|
+
return I.delete(v), I;
|
|
1103
|
+
}), o.current.delete(v)) : e((b) => {
|
|
1104
|
+
const I = new Set(b);
|
|
1105
|
+
return I.add(v), I;
|
|
1106
|
+
}), qt().then((b) => {
|
|
1107
|
+
if (!b) return;
|
|
1108
|
+
const I = {};
|
|
1109
|
+
for (const [A, k] of Object.entries(b))
|
|
1110
|
+
k != null && (I[A] = k);
|
|
1111
|
+
r(I);
|
|
906
1112
|
}).catch(() => {
|
|
907
1113
|
});
|
|
908
1114
|
}), []);
|
|
909
|
-
const
|
|
910
|
-
const
|
|
911
|
-
e((
|
|
912
|
-
if (
|
|
913
|
-
const
|
|
914
|
-
return
|
|
1115
|
+
const d = M((y) => {
|
|
1116
|
+
const E = y.data, w = be(E);
|
|
1117
|
+
e((I) => {
|
|
1118
|
+
if (I.has(w)) return I;
|
|
1119
|
+
const A = new Set(I);
|
|
1120
|
+
return A.add(w), A;
|
|
915
1121
|
});
|
|
916
|
-
const
|
|
917
|
-
i((
|
|
918
|
-
const
|
|
919
|
-
return
|
|
1122
|
+
const v = at(o.current, E), b = Ce(v);
|
|
1123
|
+
i((I) => {
|
|
1124
|
+
const A = new Map(I);
|
|
1125
|
+
return A.set(w, b), A;
|
|
920
1126
|
});
|
|
921
1127
|
}, []);
|
|
922
|
-
|
|
923
|
-
const
|
|
924
|
-
await
|
|
925
|
-
}, []),
|
|
926
|
-
await
|
|
927
|
-
}, []),
|
|
928
|
-
const
|
|
929
|
-
c((
|
|
930
|
-
if (!
|
|
931
|
-
const
|
|
932
|
-
return
|
|
1128
|
+
j(() => x("watch/STATE", d), [d]);
|
|
1129
|
+
const l = M(async (y, E) => {
|
|
1130
|
+
await qe(y, E);
|
|
1131
|
+
}, []), f = M(async (y, E) => {
|
|
1132
|
+
await $e(y, E);
|
|
1133
|
+
}, []), h = M(async (y) => {
|
|
1134
|
+
const E = a.get(y);
|
|
1135
|
+
c((w) => {
|
|
1136
|
+
if (!w.has(y)) return w;
|
|
1137
|
+
const v = new Map(w);
|
|
1138
|
+
return v.delete(y), v;
|
|
933
1139
|
});
|
|
934
1140
|
try {
|
|
935
|
-
await
|
|
936
|
-
} catch (
|
|
937
|
-
throw c((
|
|
938
|
-
const
|
|
939
|
-
return
|
|
940
|
-
}),
|
|
1141
|
+
await Ut(y);
|
|
1142
|
+
} catch (w) {
|
|
1143
|
+
throw c((v) => {
|
|
1144
|
+
const b = new Map(v);
|
|
1145
|
+
return b.set(y, E ?? "Reload failed"), b;
|
|
1146
|
+
}), w;
|
|
941
1147
|
}
|
|
942
|
-
}, [a]),
|
|
943
|
-
for (const
|
|
944
|
-
const [
|
|
945
|
-
|
|
946
|
-
pluginID:
|
|
947
|
-
connectionID:
|
|
948
|
-
name: (
|
|
949
|
-
avatar: (
|
|
1148
|
+
}, [a]), g = [];
|
|
1149
|
+
for (const y of t) {
|
|
1150
|
+
const [E, w] = y.split("/", 2), b = (n[E] ?? []).find((fe) => fe.id === w), I = s.get(y), A = I != null && !ce(I), k = I != null && I.errorCount > 0, P = a.get(E);
|
|
1151
|
+
g.push({
|
|
1152
|
+
pluginID: E,
|
|
1153
|
+
connectionID: w,
|
|
1154
|
+
name: (b == null ? void 0 : b.name) ?? w,
|
|
1155
|
+
avatar: (b == null ? void 0 : b.avatar) ?? "",
|
|
950
1156
|
isStarted: !0,
|
|
951
|
-
sync:
|
|
952
|
-
isSyncing:
|
|
953
|
-
hasErrors:
|
|
954
|
-
pluginFailed:
|
|
955
|
-
pluginError:
|
|
1157
|
+
sync: I,
|
|
1158
|
+
isSyncing: A,
|
|
1159
|
+
hasErrors: k || P != null,
|
|
1160
|
+
pluginFailed: P != null,
|
|
1161
|
+
pluginError: P
|
|
956
1162
|
});
|
|
957
1163
|
}
|
|
958
|
-
const
|
|
959
|
-
for (const
|
|
960
|
-
const
|
|
961
|
-
|
|
1164
|
+
const m = /* @__PURE__ */ new Map();
|
|
1165
|
+
for (const y of g) {
|
|
1166
|
+
const E = m.get(y.pluginID) ?? [];
|
|
1167
|
+
E.push(y), m.set(y.pluginID, E);
|
|
962
1168
|
}
|
|
963
|
-
const
|
|
1169
|
+
const S = Array.from(s.values()), u = g.filter((y) => y.isSyncing), p = g.filter((y) => y.hasErrors), _ = g.filter((y) => y.pluginFailed);
|
|
964
1170
|
return {
|
|
965
|
-
entries:
|
|
966
|
-
grouped:
|
|
967
|
-
connectedCount:
|
|
968
|
-
syncingCount:
|
|
969
|
-
errorCount:
|
|
970
|
-
failedCount:
|
|
971
|
-
hasSyncing:
|
|
972
|
-
aggregateProgress:
|
|
973
|
-
disconnect:
|
|
974
|
-
retryWatch:
|
|
975
|
-
retryPlugin:
|
|
1171
|
+
entries: g,
|
|
1172
|
+
grouped: m,
|
|
1173
|
+
connectedCount: g.length,
|
|
1174
|
+
syncingCount: u.length,
|
|
1175
|
+
errorCount: p.length,
|
|
1176
|
+
failedCount: _.length,
|
|
1177
|
+
hasSyncing: ot(S),
|
|
1178
|
+
aggregateProgress: it(S),
|
|
1179
|
+
disconnect: l,
|
|
1180
|
+
retryWatch: f,
|
|
1181
|
+
retryPlugin: h
|
|
976
1182
|
};
|
|
977
1183
|
}
|
|
978
|
-
function
|
|
1184
|
+
function jn(t, e) {
|
|
979
1185
|
return e === null ? t === null : Array.isArray(e) ? Array.isArray(t) : typeof e == "object" ? typeof t == "object" && t !== null && !Array.isArray(t) : typeof t == typeof e;
|
|
980
1186
|
}
|
|
981
|
-
function
|
|
982
|
-
const r =
|
|
1187
|
+
function vs(t, e, n) {
|
|
1188
|
+
const r = T(t), s = B(), i = [r, "data", e], o = F({
|
|
983
1189
|
queryKey: i,
|
|
984
1190
|
queryFn: async () => {
|
|
985
|
-
const c = await
|
|
986
|
-
return c == null ? n :
|
|
1191
|
+
const c = await $t(r, e);
|
|
1192
|
+
return c == null ? n : jn(c, n) ? c : (console.warn(
|
|
987
1193
|
`[usePluginData] stored value for "${e}" has unexpected type (expected ${Array.isArray(n) ? "array" : typeof n}, got ${Array.isArray(c) ? "array" : typeof c}). Using default.`
|
|
988
1194
|
), n);
|
|
989
1195
|
}
|
|
990
1196
|
}), a = N({
|
|
991
1197
|
mutationFn: async (c) => {
|
|
992
|
-
await
|
|
1198
|
+
await Wt(r, e, c);
|
|
993
1199
|
},
|
|
994
1200
|
onMutate: async (c) => {
|
|
995
1201
|
await s.cancelQueries({ queryKey: i });
|
|
996
|
-
const
|
|
997
|
-
return s.setQueryData(i, c), { previous:
|
|
1202
|
+
const d = s.getQueryData(i);
|
|
1203
|
+
return s.setQueryData(i, c), { previous: d };
|
|
998
1204
|
},
|
|
999
|
-
onError: (c,
|
|
1000
|
-
(
|
|
1205
|
+
onError: (c, d, l) => {
|
|
1206
|
+
(l == null ? void 0 : l.previous) !== void 0 && s.setQueryData(i, l.previous);
|
|
1001
1207
|
},
|
|
1002
1208
|
onSettled: () => {
|
|
1003
1209
|
s.invalidateQueries({ queryKey: i });
|
|
@@ -1011,23 +1217,23 @@ function ds(t, e, n) {
|
|
|
1011
1217
|
isLoading: o.isLoading
|
|
1012
1218
|
};
|
|
1013
1219
|
}
|
|
1014
|
-
const
|
|
1015
|
-
const t =
|
|
1220
|
+
const Cs = () => {
|
|
1221
|
+
const t = X(Fn);
|
|
1016
1222
|
if (!t) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
|
|
1017
1223
|
return t;
|
|
1018
|
-
},
|
|
1019
|
-
const t =
|
|
1224
|
+
}, ct = () => {
|
|
1225
|
+
const t = X(xn);
|
|
1020
1226
|
if (t === void 0)
|
|
1021
1227
|
throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
|
|
1022
1228
|
return t;
|
|
1023
|
-
},
|
|
1024
|
-
const e =
|
|
1229
|
+
}, _s = ({ pluginID: t }) => {
|
|
1230
|
+
const e = T(t), { showSnackbar: n } = Q(), { createTab: r, updateTab: s } = ct();
|
|
1025
1231
|
return {
|
|
1026
1232
|
createSession: N({
|
|
1027
|
-
mutationFn: async ({ connectionID: o, icon: a, label: c, opts:
|
|
1028
|
-
const
|
|
1233
|
+
mutationFn: async ({ connectionID: o, icon: a, label: c, opts: d }) => {
|
|
1234
|
+
const l = `pending-${crypto.randomUUID()}`;
|
|
1029
1235
|
r({
|
|
1030
|
-
id:
|
|
1236
|
+
id: l,
|
|
1031
1237
|
title: c ?? "Connecting...",
|
|
1032
1238
|
variant: "terminal",
|
|
1033
1239
|
icon: a ?? "LuSquareTerminal",
|
|
@@ -1035,97 +1241,97 @@ const fs = () => {
|
|
|
1035
1241
|
status: "connecting",
|
|
1036
1242
|
pluginID: e,
|
|
1037
1243
|
connectionID: o,
|
|
1038
|
-
opts: { ...
|
|
1244
|
+
opts: { ...d }
|
|
1039
1245
|
}
|
|
1040
1246
|
});
|
|
1041
|
-
const
|
|
1247
|
+
const f = mn.createFrom({
|
|
1042
1248
|
command: ["/bin/bash"],
|
|
1043
1249
|
tty: !0,
|
|
1044
|
-
...
|
|
1250
|
+
...d
|
|
1045
1251
|
});
|
|
1046
1252
|
try {
|
|
1047
|
-
const
|
|
1048
|
-
if (!
|
|
1253
|
+
const h = await Gt(e, o, f);
|
|
1254
|
+
if (!h) throw new Error("Failed to create session: null response");
|
|
1049
1255
|
s(
|
|
1050
|
-
{ id:
|
|
1256
|
+
{ id: l },
|
|
1051
1257
|
{
|
|
1052
|
-
id:
|
|
1053
|
-
title: c ?? `Session ${
|
|
1054
|
-
properties: { status: "connected", pluginID: e, connectionID: o, opts: { ...
|
|
1258
|
+
id: h.id,
|
|
1259
|
+
title: c ?? `Session ${h.id.substring(0, 8)}`,
|
|
1260
|
+
properties: { status: "connected", pluginID: e, connectionID: o, opts: { ...d } }
|
|
1055
1261
|
}
|
|
1056
1262
|
);
|
|
1057
|
-
} catch (
|
|
1058
|
-
const
|
|
1263
|
+
} catch (h) {
|
|
1264
|
+
const g = H(h);
|
|
1059
1265
|
s(
|
|
1060
|
-
{ id:
|
|
1266
|
+
{ id: l },
|
|
1061
1267
|
{
|
|
1062
|
-
properties: { status: "error", error:
|
|
1268
|
+
properties: { status: "error", error: g.detail, pluginID: e, connectionID: o, opts: { ...d } }
|
|
1063
1269
|
}
|
|
1064
|
-
),
|
|
1270
|
+
), z(n, h, "Failed to start session");
|
|
1065
1271
|
}
|
|
1066
1272
|
}
|
|
1067
1273
|
}).mutateAsync
|
|
1068
1274
|
};
|
|
1069
|
-
},
|
|
1070
|
-
const e =
|
|
1275
|
+
}, ws = ({ pluginID: t }) => {
|
|
1276
|
+
const e = T(t), { showSnackbar: n } = Q(), { createTab: r } = ct(), s = N({
|
|
1071
1277
|
mutationFn: async ({
|
|
1072
1278
|
connectionID: o,
|
|
1073
1279
|
resourceKey: a,
|
|
1074
1280
|
resourceID: c,
|
|
1075
|
-
resourceData:
|
|
1076
|
-
icon:
|
|
1077
|
-
label:
|
|
1078
|
-
target:
|
|
1079
|
-
follow:
|
|
1080
|
-
tailLines:
|
|
1081
|
-
params:
|
|
1281
|
+
resourceData: d,
|
|
1282
|
+
icon: l,
|
|
1283
|
+
label: f,
|
|
1284
|
+
target: h,
|
|
1285
|
+
follow: g = !0,
|
|
1286
|
+
tailLines: m = 1e3,
|
|
1287
|
+
params: S
|
|
1082
1288
|
}) => {
|
|
1083
|
-
const
|
|
1289
|
+
const u = En.createFrom({
|
|
1084
1290
|
resource_key: a,
|
|
1085
1291
|
resource_id: c,
|
|
1086
|
-
resource_data:
|
|
1087
|
-
options:
|
|
1088
|
-
target:
|
|
1089
|
-
follow:
|
|
1292
|
+
resource_data: d,
|
|
1293
|
+
options: Sn.createFrom({
|
|
1294
|
+
target: h ?? "",
|
|
1295
|
+
follow: g,
|
|
1090
1296
|
include_previous: !1,
|
|
1091
1297
|
include_timestamps: !0,
|
|
1092
|
-
tail_lines:
|
|
1298
|
+
tail_lines: m,
|
|
1093
1299
|
since_seconds: 0,
|
|
1094
1300
|
limit_bytes: 0,
|
|
1095
1301
|
include_source_events: !0,
|
|
1096
|
-
params:
|
|
1302
|
+
params: S ?? {}
|
|
1097
1303
|
})
|
|
1098
|
-
}),
|
|
1099
|
-
if (!
|
|
1304
|
+
}), p = await jt(e, o, u);
|
|
1305
|
+
if (!p) throw new Error("Failed to create log session: null response");
|
|
1100
1306
|
return r({
|
|
1101
|
-
id:
|
|
1102
|
-
title:
|
|
1307
|
+
id: p.id,
|
|
1308
|
+
title: f ?? `Logs ${p.id.substring(0, 8)}`,
|
|
1103
1309
|
variant: "logs",
|
|
1104
|
-
icon:
|
|
1105
|
-
}),
|
|
1310
|
+
icon: l ?? "LuLogs"
|
|
1311
|
+
}), p;
|
|
1106
1312
|
},
|
|
1107
|
-
onError:
|
|
1313
|
+
onError: U(n, "Failed to start log session")
|
|
1108
1314
|
}), i = N({
|
|
1109
1315
|
mutationFn: async (o) => {
|
|
1110
|
-
await
|
|
1316
|
+
await Qt(o);
|
|
1111
1317
|
},
|
|
1112
|
-
onError:
|
|
1318
|
+
onError: U(n, "Failed to close log session")
|
|
1113
1319
|
});
|
|
1114
1320
|
return {
|
|
1115
1321
|
createLogSession: s.mutateAsync,
|
|
1116
1322
|
closeLogSession: i.mutateAsync
|
|
1117
1323
|
};
|
|
1118
|
-
},
|
|
1324
|
+
}, bs = () => F({
|
|
1119
1325
|
queryKey: ["metric", "providers"],
|
|
1120
|
-
queryFn:
|
|
1326
|
+
queryFn: Kt,
|
|
1121
1327
|
staleTime: 3e4
|
|
1122
|
-
}),
|
|
1328
|
+
}), Qn = (t) => F({
|
|
1123
1329
|
queryKey: ["metric", "providers", t],
|
|
1124
|
-
queryFn: () =>
|
|
1330
|
+
queryFn: () => Ht(t),
|
|
1125
1331
|
enabled: !!t,
|
|
1126
1332
|
staleTime: 3e4
|
|
1127
|
-
}),
|
|
1128
|
-
var
|
|
1333
|
+
}), Rs = (t) => {
|
|
1334
|
+
var u, p;
|
|
1129
1335
|
const {
|
|
1130
1336
|
connectionID: e,
|
|
1131
1337
|
resourceKey: n,
|
|
@@ -1136,15 +1342,15 @@ const fs = () => {
|
|
|
1136
1342
|
shape: a = 0,
|
|
1137
1343
|
// CURRENT
|
|
1138
1344
|
timeRange: c,
|
|
1139
|
-
refreshInterval:
|
|
1140
|
-
enabled:
|
|
1345
|
+
refreshInterval: d = 0,
|
|
1346
|
+
enabled: l = !0
|
|
1141
1347
|
} = t, {
|
|
1142
|
-
data:
|
|
1143
|
-
isLoading:
|
|
1144
|
-
} =
|
|
1348
|
+
data: f,
|
|
1349
|
+
isLoading: h
|
|
1350
|
+
} = Qn(n), g = f ?? [], m = c ? Math.max(
|
|
1145
1351
|
Math.floor((c.end.getTime() - c.start.getTime()) / 250),
|
|
1146
1352
|
15e3
|
|
1147
|
-
) * 1e6 : 0,
|
|
1353
|
+
) * 1e6 : 0, S = F({
|
|
1148
1354
|
queryKey: [
|
|
1149
1355
|
"metric",
|
|
1150
1356
|
"query",
|
|
@@ -1154,11 +1360,11 @@ const fs = () => {
|
|
|
1154
1360
|
s,
|
|
1155
1361
|
o,
|
|
1156
1362
|
a,
|
|
1157
|
-
(
|
|
1158
|
-
(
|
|
1363
|
+
(u = c == null ? void 0 : c.start) == null ? void 0 : u.getTime(),
|
|
1364
|
+
(p = c == null ? void 0 : c.end) == null ? void 0 : p.getTime()
|
|
1159
1365
|
],
|
|
1160
1366
|
queryFn: async () => {
|
|
1161
|
-
const
|
|
1367
|
+
const _ = await Bt(
|
|
1162
1368
|
e,
|
|
1163
1369
|
n,
|
|
1164
1370
|
r,
|
|
@@ -1168,27 +1374,27 @@ const fs = () => {
|
|
|
1168
1374
|
a,
|
|
1169
1375
|
((c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0)).toISOString(),
|
|
1170
1376
|
((c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0)).toISOString(),
|
|
1171
|
-
|
|
1172
|
-
),
|
|
1173
|
-
for (const [
|
|
1174
|
-
|
|
1175
|
-
return
|
|
1377
|
+
m
|
|
1378
|
+
), y = {};
|
|
1379
|
+
for (const [E, w] of Object.entries(_))
|
|
1380
|
+
w != null && (y[E] = w);
|
|
1381
|
+
return y;
|
|
1176
1382
|
},
|
|
1177
|
-
enabled:
|
|
1178
|
-
refetchInterval:
|
|
1383
|
+
enabled: l && !!e && !!n && (n.startsWith("cluster::") || !!r) && g.length > 0,
|
|
1384
|
+
refetchInterval: d > 0 ? d : void 0,
|
|
1179
1385
|
staleTime: 5e3,
|
|
1180
1386
|
// Keep previous data visible while fetching new data (e.g. on time range change)
|
|
1181
1387
|
// to prevent the chart from blinking empty.
|
|
1182
|
-
placeholderData:
|
|
1388
|
+
placeholderData: Xe
|
|
1183
1389
|
});
|
|
1184
1390
|
return {
|
|
1185
|
-
data:
|
|
1186
|
-
providers:
|
|
1187
|
-
isLoading:
|
|
1188
|
-
error:
|
|
1189
|
-
refetch:
|
|
1391
|
+
data: S.data ?? void 0,
|
|
1392
|
+
providers: g,
|
|
1393
|
+
isLoading: h || S.isLoading,
|
|
1394
|
+
error: S.error,
|
|
1395
|
+
refetch: S.refetch
|
|
1190
1396
|
};
|
|
1191
|
-
},
|
|
1397
|
+
}, Is = (t) => {
|
|
1192
1398
|
const {
|
|
1193
1399
|
pluginID: e,
|
|
1194
1400
|
connectionID: n,
|
|
@@ -1198,11 +1404,11 @@ const fs = () => {
|
|
|
1198
1404
|
resourceData: o = {},
|
|
1199
1405
|
metricIDs: a = [],
|
|
1200
1406
|
interval: c = 1e4,
|
|
1201
|
-
enabled:
|
|
1202
|
-
} = t,
|
|
1203
|
-
if (!(!
|
|
1407
|
+
enabled: d = !0
|
|
1408
|
+
} = t, l = T(e), [f, h] = K(null), [g, m] = K(null), [S, u] = K(!1), [p, _] = K(null), y = W(null), E = M(async () => {
|
|
1409
|
+
if (!(!d || !l || !n || !r || !s))
|
|
1204
1410
|
try {
|
|
1205
|
-
const
|
|
1411
|
+
const v = await zt(l, n, {
|
|
1206
1412
|
resource_key: r,
|
|
1207
1413
|
resource_id: s,
|
|
1208
1414
|
resource_namespace: i,
|
|
@@ -1211,177 +1417,177 @@ const fs = () => {
|
|
|
1211
1417
|
interval: c * 1e6
|
|
1212
1418
|
// ms to nanoseconds for Go time.Duration
|
|
1213
1419
|
});
|
|
1214
|
-
|
|
1215
|
-
const
|
|
1216
|
-
const
|
|
1420
|
+
m(v), u(!0), _(null);
|
|
1421
|
+
const b = x(`core/metrics/data/${v}`, (A) => {
|
|
1422
|
+
const k = A.data;
|
|
1217
1423
|
try {
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1220
|
-
} catch (
|
|
1221
|
-
console.error("Failed to parse metric stream data:",
|
|
1424
|
+
const P = JSON.parse(k);
|
|
1425
|
+
P.results && h(P.results);
|
|
1426
|
+
} catch (P) {
|
|
1427
|
+
console.error("Failed to parse metric stream data:", P);
|
|
1222
1428
|
}
|
|
1223
|
-
}),
|
|
1224
|
-
const
|
|
1429
|
+
}), I = x(`core/metrics/error/${v}`, (A) => {
|
|
1430
|
+
const k = A.data;
|
|
1225
1431
|
try {
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1432
|
+
const P = JSON.parse(k);
|
|
1433
|
+
_(P.error || "Unknown error");
|
|
1228
1434
|
} catch {
|
|
1229
|
-
|
|
1435
|
+
_("Failed to parse metric stream error");
|
|
1230
1436
|
}
|
|
1231
1437
|
});
|
|
1232
|
-
|
|
1233
|
-
|
|
1438
|
+
y.current = () => {
|
|
1439
|
+
b(), I();
|
|
1234
1440
|
};
|
|
1235
|
-
} catch (
|
|
1236
|
-
|
|
1441
|
+
} catch (v) {
|
|
1442
|
+
_(v instanceof Error ? v.message : String(v));
|
|
1237
1443
|
}
|
|
1238
|
-
}, [
|
|
1239
|
-
if (
|
|
1444
|
+
}, [l, n, r, s, i, a, c, d]), w = M(async () => {
|
|
1445
|
+
if (g)
|
|
1240
1446
|
try {
|
|
1241
|
-
await
|
|
1242
|
-
} catch (
|
|
1243
|
-
console.error("Failed to unsubscribe:",
|
|
1447
|
+
await De(g);
|
|
1448
|
+
} catch (v) {
|
|
1449
|
+
console.error("Failed to unsubscribe:", v);
|
|
1244
1450
|
}
|
|
1245
|
-
|
|
1246
|
-
}, [
|
|
1247
|
-
return
|
|
1248
|
-
|
|
1249
|
-
}, [
|
|
1250
|
-
data:
|
|
1251
|
-
subscriptionID:
|
|
1252
|
-
isStreaming:
|
|
1253
|
-
error:
|
|
1254
|
-
start:
|
|
1255
|
-
stop:
|
|
1451
|
+
y.current && (y.current(), y.current = null), m(null), u(!1);
|
|
1452
|
+
}, [g]);
|
|
1453
|
+
return j(() => () => {
|
|
1454
|
+
g && De(g).catch(console.error), y.current && y.current();
|
|
1455
|
+
}, [g]), {
|
|
1456
|
+
data: f,
|
|
1457
|
+
subscriptionID: g,
|
|
1458
|
+
isStreaming: S,
|
|
1459
|
+
error: p,
|
|
1460
|
+
start: E,
|
|
1461
|
+
stop: w
|
|
1256
1462
|
};
|
|
1257
|
-
},
|
|
1258
|
-
function
|
|
1259
|
-
const { showSnackbar: t } =
|
|
1260
|
-
queryKey: [...
|
|
1261
|
-
queryFn: async () =>
|
|
1262
|
-
if (
|
|
1463
|
+
}, J = ["networker", "portforward", "all-sessions"];
|
|
1464
|
+
function Os() {
|
|
1465
|
+
const { showSnackbar: t } = Q(), e = B(), n = F({
|
|
1466
|
+
queryKey: [...J],
|
|
1467
|
+
queryFn: async () => Vt().catch((i) => {
|
|
1468
|
+
if (H(i).detail.includes("not found")) return [];
|
|
1263
1469
|
throw i;
|
|
1264
1470
|
}),
|
|
1265
1471
|
retry: !1
|
|
1266
1472
|
});
|
|
1267
|
-
|
|
1268
|
-
const i =
|
|
1269
|
-
e.invalidateQueries({ queryKey: [...
|
|
1270
|
-
}), o =
|
|
1271
|
-
e.invalidateQueries({ queryKey: [...
|
|
1473
|
+
j(() => {
|
|
1474
|
+
const i = x("core/networker/portforward/created", () => {
|
|
1475
|
+
e.invalidateQueries({ queryKey: [...J] });
|
|
1476
|
+
}), o = x("core/networker/portforward/closed", () => {
|
|
1477
|
+
e.invalidateQueries({ queryKey: [...J] });
|
|
1272
1478
|
});
|
|
1273
1479
|
return () => {
|
|
1274
1480
|
i(), o();
|
|
1275
1481
|
};
|
|
1276
1482
|
}, [e]);
|
|
1277
1483
|
const r = n.data ?? [], s = N({
|
|
1278
|
-
mutationFn: async (i) =>
|
|
1279
|
-
onError:
|
|
1484
|
+
mutationFn: async (i) => We(i),
|
|
1485
|
+
onError: U(t, "Failed to close port forwarding session"),
|
|
1280
1486
|
onSuccess: async () => {
|
|
1281
|
-
await e.invalidateQueries({ queryKey: [...
|
|
1487
|
+
await e.invalidateQueries({ queryKey: [...J] });
|
|
1282
1488
|
}
|
|
1283
1489
|
});
|
|
1284
1490
|
return {
|
|
1285
1491
|
sessions: n,
|
|
1286
1492
|
activeSessions: r,
|
|
1287
1493
|
closeSession: s.mutateAsync,
|
|
1288
|
-
openInBrowser: (i) =>
|
|
1494
|
+
openInBrowser: (i) => Je(`http://localhost:${i}`)
|
|
1289
1495
|
};
|
|
1290
1496
|
}
|
|
1291
|
-
function
|
|
1292
|
-
const r =
|
|
1497
|
+
function As({ pluginID: t, connectionID: e, resourceID: n }) {
|
|
1498
|
+
const r = T(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = Q(), o = B(), a = F({
|
|
1293
1499
|
queryKey: s,
|
|
1294
|
-
queryFn: async () =>
|
|
1500
|
+
queryFn: async () => Yt(r, e, vn.createFrom({
|
|
1295
1501
|
resource_id: n,
|
|
1296
1502
|
connection_id: e
|
|
1297
|
-
})).catch((
|
|
1298
|
-
const
|
|
1299
|
-
return
|
|
1503
|
+
})).catch((l) => {
|
|
1504
|
+
const f = H(l);
|
|
1505
|
+
return f.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: f.detail }), []);
|
|
1300
1506
|
}),
|
|
1301
1507
|
retry: !1
|
|
1302
1508
|
}), c = N({
|
|
1303
|
-
mutationFn: async ({ opts:
|
|
1304
|
-
const
|
|
1305
|
-
local_port:
|
|
1306
|
-
remote_port:
|
|
1307
|
-
protocol:
|
|
1509
|
+
mutationFn: async ({ opts: l }) => {
|
|
1510
|
+
const f = Cn.createFrom({
|
|
1511
|
+
local_port: l.localPort || 0,
|
|
1512
|
+
remote_port: l.remotePort,
|
|
1513
|
+
protocol: l.protocol || "TCP",
|
|
1308
1514
|
connection_type: "RESOURCE",
|
|
1309
1515
|
connection: {
|
|
1310
|
-
resource_data:
|
|
1516
|
+
resource_data: l.resource,
|
|
1311
1517
|
connection_id: e,
|
|
1312
1518
|
plugin_id: r,
|
|
1313
|
-
resource_id:
|
|
1314
|
-
resource_key:
|
|
1519
|
+
resource_id: l.resourceId,
|
|
1520
|
+
resource_key: l.resourceKey
|
|
1315
1521
|
},
|
|
1316
|
-
labels:
|
|
1317
|
-
params:
|
|
1318
|
-
}),
|
|
1319
|
-
if (!
|
|
1320
|
-
return
|
|
1522
|
+
labels: l.labels ?? {},
|
|
1523
|
+
params: l.parameters ?? {}
|
|
1524
|
+
}), h = await Jt(r, e, f);
|
|
1525
|
+
if (!h) throw new Error("Failed to start port forwarding: null response");
|
|
1526
|
+
return l.openInBrowser && Je(`http://localhost:${h.local_port}`), h;
|
|
1321
1527
|
},
|
|
1322
|
-
onError:
|
|
1528
|
+
onError: U(i, "Failed to start port forwarding session"),
|
|
1323
1529
|
onSuccess: async () => {
|
|
1324
1530
|
await Promise.all([
|
|
1325
1531
|
o.invalidateQueries({ queryKey: s }),
|
|
1326
|
-
o.invalidateQueries({ queryKey: [...
|
|
1532
|
+
o.invalidateQueries({ queryKey: [...J] })
|
|
1327
1533
|
]);
|
|
1328
1534
|
}
|
|
1329
|
-
}),
|
|
1330
|
-
mutationFn: async ({ opts:
|
|
1331
|
-
onError:
|
|
1535
|
+
}), d = N({
|
|
1536
|
+
mutationFn: async ({ opts: l }) => We(l.sessionID),
|
|
1537
|
+
onError: U(i, "Failed to close port forwarding session"),
|
|
1332
1538
|
onSuccess: async () => {
|
|
1333
1539
|
await Promise.all([
|
|
1334
1540
|
o.invalidateQueries({ queryKey: s }),
|
|
1335
|
-
o.invalidateQueries({ queryKey: [...
|
|
1541
|
+
o.invalidateQueries({ queryKey: [...J] })
|
|
1336
1542
|
]);
|
|
1337
1543
|
}
|
|
1338
1544
|
});
|
|
1339
1545
|
return {
|
|
1340
1546
|
sessions: a,
|
|
1341
1547
|
forward: c.mutateAsync,
|
|
1342
|
-
close:
|
|
1548
|
+
close: d.mutateAsync
|
|
1343
1549
|
};
|
|
1344
1550
|
}
|
|
1345
|
-
const
|
|
1346
|
-
const t =
|
|
1551
|
+
const Ts = () => {
|
|
1552
|
+
const t = C.useContext(Nn);
|
|
1347
1553
|
if (!t) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
|
|
1348
1554
|
return t;
|
|
1349
|
-
},
|
|
1555
|
+
}, Ds = ({
|
|
1350
1556
|
pluginID: t,
|
|
1351
1557
|
connectionID: e,
|
|
1352
1558
|
resourceKey: n,
|
|
1353
1559
|
resourceID: r,
|
|
1354
1560
|
namespace: s = ""
|
|
1355
1561
|
}) => {
|
|
1356
|
-
const i =
|
|
1357
|
-
mutationFn: async (
|
|
1358
|
-
input:
|
|
1562
|
+
const i = T(t), o = B(), { showSnackbar: a } = Q(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: d } = N({
|
|
1563
|
+
mutationFn: async (h) => Ge(i, e, n, He.createFrom({
|
|
1564
|
+
input: h.input,
|
|
1359
1565
|
id: r,
|
|
1360
1566
|
namespace: s
|
|
1361
1567
|
})),
|
|
1362
1568
|
onSuccess: async () => {
|
|
1363
1569
|
a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1364
1570
|
},
|
|
1365
|
-
onError:
|
|
1366
|
-
}), { mutateAsync:
|
|
1367
|
-
mutationFn: async (
|
|
1571
|
+
onError: U(a, `Failed to update resource ${r}`)
|
|
1572
|
+
}), { mutateAsync: l } = N({
|
|
1573
|
+
mutationFn: async (h = {}) => je(i, e, n, Be.createFrom({
|
|
1368
1574
|
id: r,
|
|
1369
1575
|
namespace: s,
|
|
1370
|
-
gracePeriodSeconds:
|
|
1576
|
+
gracePeriodSeconds: h.gracePeriodSeconds
|
|
1371
1577
|
})),
|
|
1372
1578
|
onSuccess: async () => {
|
|
1373
1579
|
a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1374
1580
|
},
|
|
1375
|
-
onError:
|
|
1581
|
+
onError: U(a, `Failed to delete resource ${r}`)
|
|
1376
1582
|
});
|
|
1377
1583
|
return {
|
|
1378
1584
|
/**
|
|
1379
1585
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1380
1586
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1381
1587
|
*/
|
|
1382
|
-
resource:
|
|
1588
|
+
resource: F({
|
|
1383
1589
|
queryKey: c,
|
|
1384
|
-
queryFn: async () =>
|
|
1590
|
+
queryFn: async () => Xt(i, e, n, _n.createFrom({
|
|
1385
1591
|
id: r,
|
|
1386
1592
|
namespace: s
|
|
1387
1593
|
})),
|
|
@@ -1393,49 +1599,49 @@ const _s = () => {
|
|
|
1393
1599
|
*
|
|
1394
1600
|
* @params opts Optional parameters to pass to the resource update
|
|
1395
1601
|
*/
|
|
1396
|
-
update:
|
|
1602
|
+
update: d,
|
|
1397
1603
|
/**
|
|
1398
1604
|
* Delete an existing resource. A set of optional parameters can be passed to customize the delete behavior,
|
|
1399
1605
|
* which if specified, will add additional default behavior set via the hook options.
|
|
1400
1606
|
*
|
|
1401
1607
|
* @params {object} opts Optional parameters to pass to the resource delete
|
|
1402
1608
|
*/
|
|
1403
|
-
remove:
|
|
1609
|
+
remove: l
|
|
1404
1610
|
};
|
|
1405
|
-
},
|
|
1611
|
+
}, xs = (t) => {
|
|
1406
1612
|
const e = ["component", t.plugin, t.resource, t.area];
|
|
1407
1613
|
return {
|
|
1408
1614
|
/**
|
|
1409
1615
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1410
1616
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1411
1617
|
*/
|
|
1412
|
-
component:
|
|
1618
|
+
component: F({
|
|
1413
1619
|
queryKey: e,
|
|
1414
|
-
queryFn: async () =>
|
|
1620
|
+
queryFn: async () => Zt(t)
|
|
1415
1621
|
})
|
|
1416
1622
|
};
|
|
1417
|
-
},
|
|
1418
|
-
const n =
|
|
1623
|
+
}, Fs = ({ pluginID: t, connectionID: e }) => {
|
|
1624
|
+
const n = T(t);
|
|
1419
1625
|
return {
|
|
1420
1626
|
/**
|
|
1421
1627
|
* The resource groups for the given plugin and connection.
|
|
1422
1628
|
*/
|
|
1423
|
-
groups:
|
|
1629
|
+
groups: F({
|
|
1424
1630
|
queryKey: [n, "resource_groups", "list"],
|
|
1425
|
-
queryFn: async () =>
|
|
1631
|
+
queryFn: async () => en(n, e),
|
|
1426
1632
|
retry: !1
|
|
1427
1633
|
})
|
|
1428
1634
|
};
|
|
1429
|
-
},
|
|
1635
|
+
}, Ns = ({
|
|
1430
1636
|
pluginID: t,
|
|
1431
1637
|
connectionID: e,
|
|
1432
1638
|
searches: n
|
|
1433
1639
|
}) => {
|
|
1434
|
-
const r =
|
|
1435
|
-
return
|
|
1640
|
+
const r = T(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
|
|
1641
|
+
return wn({
|
|
1436
1642
|
queries: n.map((o) => ({
|
|
1437
1643
|
queryKey: s(o),
|
|
1438
|
-
queryFn: async () =>
|
|
1644
|
+
queryFn: async () => Qe(r, e, o.key, ze.createFrom({
|
|
1439
1645
|
order: [{ field: "name", descending: !1 }],
|
|
1440
1646
|
pagination: { page: 1, pageSize: 200 },
|
|
1441
1647
|
namespaces: o.namespaces
|
|
@@ -1443,40 +1649,40 @@ const _s = () => {
|
|
|
1443
1649
|
retry: !1
|
|
1444
1650
|
}))
|
|
1445
1651
|
});
|
|
1446
|
-
},
|
|
1447
|
-
const n =
|
|
1652
|
+
}, Ps = ({ pluginID: t, resourceKey: e }) => {
|
|
1653
|
+
const n = T(t);
|
|
1448
1654
|
return {
|
|
1449
1655
|
/**
|
|
1450
1656
|
* The current settings from the provider.
|
|
1451
1657
|
*/
|
|
1452
|
-
resourceType:
|
|
1658
|
+
resourceType: F({
|
|
1453
1659
|
queryKey: [n, "resources", e],
|
|
1454
|
-
queryFn: async () =>
|
|
1660
|
+
queryFn: async () => tn(n, e),
|
|
1455
1661
|
retry: !1
|
|
1456
1662
|
})
|
|
1457
1663
|
};
|
|
1458
|
-
},
|
|
1459
|
-
const n =
|
|
1664
|
+
}, Ls = ({ pluginID: t, connectionID: e }) => {
|
|
1665
|
+
const n = T(t);
|
|
1460
1666
|
return {
|
|
1461
1667
|
/**
|
|
1462
1668
|
* The resource types for the given plugin and connection.
|
|
1463
1669
|
*/
|
|
1464
|
-
types:
|
|
1670
|
+
types: F({
|
|
1465
1671
|
queryKey: [n, "resources", "list", e],
|
|
1466
|
-
queryFn: async () =>
|
|
1672
|
+
queryFn: async () => nn(n, e),
|
|
1467
1673
|
retry: !1
|
|
1468
1674
|
})
|
|
1469
1675
|
};
|
|
1470
1676
|
};
|
|
1471
|
-
var
|
|
1472
|
-
function
|
|
1677
|
+
var se = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1678
|
+
function Kn(t) {
|
|
1473
1679
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
1474
1680
|
}
|
|
1475
|
-
var
|
|
1476
|
-
function
|
|
1681
|
+
var Hn = "Expected a function", ut = "__lodash_hash_undefined__", Bn = "[object Function]", zn = "[object GeneratorFunction]", Vn = "[object Symbol]", Yn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Jn = /^\w*$/, Xn = /^\./, Zn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, er = /[\\^$.*+?()[\]{}|]/g, tr = /\\(\\)?/g, nr = /^\[object .+?Constructor\]$/, rr = typeof se == "object" && se && se.Object === Object && se, sr = typeof self == "object" && self && self.Object === Object && self, Re = rr || sr || Function("return this")();
|
|
1682
|
+
function or(t, e) {
|
|
1477
1683
|
return t == null ? void 0 : t[e];
|
|
1478
1684
|
}
|
|
1479
|
-
function
|
|
1685
|
+
function ir(t) {
|
|
1480
1686
|
var e = !1;
|
|
1481
1687
|
if (t != null && typeof t.toString != "function")
|
|
1482
1688
|
try {
|
|
@@ -1485,177 +1691,177 @@ function Jn(t) {
|
|
|
1485
1691
|
}
|
|
1486
1692
|
return e;
|
|
1487
1693
|
}
|
|
1488
|
-
var
|
|
1489
|
-
var t = /[^.]+$/.exec(
|
|
1694
|
+
var ar = Array.prototype, cr = Function.prototype, lt = Object.prototype, Ee = Re["__core-js_shared__"], Le = function() {
|
|
1695
|
+
var t = /[^.]+$/.exec(Ee && Ee.keys && Ee.keys.IE_PROTO || "");
|
|
1490
1696
|
return t ? "Symbol(src)_1." + t : "";
|
|
1491
|
-
}(),
|
|
1492
|
-
"^" +
|
|
1493
|
-
),
|
|
1494
|
-
function
|
|
1697
|
+
}(), dt = cr.toString, Ie = lt.hasOwnProperty, ft = lt.toString, ur = RegExp(
|
|
1698
|
+
"^" + dt.call(Ie).replace(er, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1699
|
+
), ke = Re.Symbol, lr = ar.splice, dr = pt(Re, "Map"), te = pt(Object, "create"), Me = ke ? ke.prototype : void 0, Ue = Me ? Me.toString : void 0;
|
|
1700
|
+
function V(t) {
|
|
1495
1701
|
var e = -1, n = t ? t.length : 0;
|
|
1496
1702
|
for (this.clear(); ++e < n; ) {
|
|
1497
1703
|
var r = t[e];
|
|
1498
1704
|
this.set(r[0], r[1]);
|
|
1499
1705
|
}
|
|
1500
1706
|
}
|
|
1501
|
-
function
|
|
1502
|
-
this.__data__ =
|
|
1707
|
+
function fr() {
|
|
1708
|
+
this.__data__ = te ? te(null) : {};
|
|
1503
1709
|
}
|
|
1504
|
-
function
|
|
1710
|
+
function pr(t) {
|
|
1505
1711
|
return this.has(t) && delete this.__data__[t];
|
|
1506
1712
|
}
|
|
1507
|
-
function
|
|
1713
|
+
function hr(t) {
|
|
1508
1714
|
var e = this.__data__;
|
|
1509
|
-
if (
|
|
1715
|
+
if (te) {
|
|
1510
1716
|
var n = e[t];
|
|
1511
|
-
return n ===
|
|
1717
|
+
return n === ut ? void 0 : n;
|
|
1512
1718
|
}
|
|
1513
|
-
return
|
|
1719
|
+
return Ie.call(e, t) ? e[t] : void 0;
|
|
1514
1720
|
}
|
|
1515
|
-
function
|
|
1721
|
+
function gr(t) {
|
|
1516
1722
|
var e = this.__data__;
|
|
1517
|
-
return
|
|
1723
|
+
return te ? e[t] !== void 0 : Ie.call(e, t);
|
|
1518
1724
|
}
|
|
1519
|
-
function
|
|
1725
|
+
function yr(t, e) {
|
|
1520
1726
|
var n = this.__data__;
|
|
1521
|
-
return n[t] =
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
function
|
|
1727
|
+
return n[t] = te && e === void 0 ? ut : e, this;
|
|
1728
|
+
}
|
|
1729
|
+
V.prototype.clear = fr;
|
|
1730
|
+
V.prototype.delete = pr;
|
|
1731
|
+
V.prototype.get = hr;
|
|
1732
|
+
V.prototype.has = gr;
|
|
1733
|
+
V.prototype.set = yr;
|
|
1734
|
+
function Z(t) {
|
|
1529
1735
|
var e = -1, n = t ? t.length : 0;
|
|
1530
1736
|
for (this.clear(); ++e < n; ) {
|
|
1531
1737
|
var r = t[e];
|
|
1532
1738
|
this.set(r[0], r[1]);
|
|
1533
1739
|
}
|
|
1534
1740
|
}
|
|
1535
|
-
function
|
|
1741
|
+
function mr() {
|
|
1536
1742
|
this.__data__ = [];
|
|
1537
1743
|
}
|
|
1538
|
-
function
|
|
1539
|
-
var e = this.__data__, n =
|
|
1744
|
+
function Er(t) {
|
|
1745
|
+
var e = this.__data__, n = le(e, t);
|
|
1540
1746
|
if (n < 0)
|
|
1541
1747
|
return !1;
|
|
1542
1748
|
var r = e.length - 1;
|
|
1543
|
-
return n == r ? e.pop() :
|
|
1749
|
+
return n == r ? e.pop() : lr.call(e, n, 1), !0;
|
|
1544
1750
|
}
|
|
1545
|
-
function
|
|
1546
|
-
var e = this.__data__, n =
|
|
1751
|
+
function Sr(t) {
|
|
1752
|
+
var e = this.__data__, n = le(e, t);
|
|
1547
1753
|
return n < 0 ? void 0 : e[n][1];
|
|
1548
1754
|
}
|
|
1549
|
-
function
|
|
1550
|
-
return
|
|
1755
|
+
function vr(t) {
|
|
1756
|
+
return le(this.__data__, t) > -1;
|
|
1551
1757
|
}
|
|
1552
|
-
function
|
|
1553
|
-
var n = this.__data__, r =
|
|
1758
|
+
function Cr(t, e) {
|
|
1759
|
+
var n = this.__data__, r = le(n, t);
|
|
1554
1760
|
return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
|
|
1555
1761
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
function
|
|
1762
|
+
Z.prototype.clear = mr;
|
|
1763
|
+
Z.prototype.delete = Er;
|
|
1764
|
+
Z.prototype.get = Sr;
|
|
1765
|
+
Z.prototype.has = vr;
|
|
1766
|
+
Z.prototype.set = Cr;
|
|
1767
|
+
function Y(t) {
|
|
1562
1768
|
var e = -1, n = t ? t.length : 0;
|
|
1563
1769
|
for (this.clear(); ++e < n; ) {
|
|
1564
1770
|
var r = t[e];
|
|
1565
1771
|
this.set(r[0], r[1]);
|
|
1566
1772
|
}
|
|
1567
1773
|
}
|
|
1568
|
-
function
|
|
1774
|
+
function _r() {
|
|
1569
1775
|
this.__data__ = {
|
|
1570
|
-
hash: new
|
|
1571
|
-
map: new (
|
|
1572
|
-
string: new
|
|
1776
|
+
hash: new V(),
|
|
1777
|
+
map: new (dr || Z)(),
|
|
1778
|
+
string: new V()
|
|
1573
1779
|
};
|
|
1574
1780
|
}
|
|
1575
|
-
function
|
|
1576
|
-
return
|
|
1781
|
+
function wr(t) {
|
|
1782
|
+
return de(this, t).delete(t);
|
|
1577
1783
|
}
|
|
1578
|
-
function
|
|
1579
|
-
return
|
|
1784
|
+
function br(t) {
|
|
1785
|
+
return de(this, t).get(t);
|
|
1580
1786
|
}
|
|
1581
|
-
function
|
|
1582
|
-
return
|
|
1787
|
+
function Rr(t) {
|
|
1788
|
+
return de(this, t).has(t);
|
|
1583
1789
|
}
|
|
1584
|
-
function
|
|
1585
|
-
return
|
|
1790
|
+
function Ir(t, e) {
|
|
1791
|
+
return de(this, t).set(t, e), this;
|
|
1586
1792
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
function
|
|
1793
|
+
Y.prototype.clear = _r;
|
|
1794
|
+
Y.prototype.delete = wr;
|
|
1795
|
+
Y.prototype.get = br;
|
|
1796
|
+
Y.prototype.has = Rr;
|
|
1797
|
+
Y.prototype.set = Ir;
|
|
1798
|
+
function le(t, e) {
|
|
1593
1799
|
for (var n = t.length; n--; )
|
|
1594
|
-
if (
|
|
1800
|
+
if (Mr(t[n][0], e))
|
|
1595
1801
|
return n;
|
|
1596
1802
|
return -1;
|
|
1597
1803
|
}
|
|
1598
|
-
function
|
|
1599
|
-
e =
|
|
1804
|
+
function Or(t, e) {
|
|
1805
|
+
e = xr(e, t) ? [e] : Dr(e);
|
|
1600
1806
|
for (var n = 0, r = e.length; t != null && n < r; )
|
|
1601
|
-
t = t[
|
|
1807
|
+
t = t[Lr(e[n++])];
|
|
1602
1808
|
return n && n == r ? t : void 0;
|
|
1603
1809
|
}
|
|
1604
|
-
function
|
|
1605
|
-
if (!
|
|
1810
|
+
function Ar(t) {
|
|
1811
|
+
if (!gt(t) || Nr(t))
|
|
1606
1812
|
return !1;
|
|
1607
|
-
var e =
|
|
1608
|
-
return e.test(
|
|
1813
|
+
var e = Ur(t) || ir(t) ? ur : nr;
|
|
1814
|
+
return e.test(kr(t));
|
|
1609
1815
|
}
|
|
1610
|
-
function
|
|
1816
|
+
function Tr(t) {
|
|
1611
1817
|
if (typeof t == "string")
|
|
1612
1818
|
return t;
|
|
1613
|
-
if (
|
|
1614
|
-
return
|
|
1819
|
+
if (Ae(t))
|
|
1820
|
+
return Ue ? Ue.call(t) : "";
|
|
1615
1821
|
var e = t + "";
|
|
1616
1822
|
return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
|
|
1617
1823
|
}
|
|
1618
|
-
function
|
|
1619
|
-
return
|
|
1824
|
+
function Dr(t) {
|
|
1825
|
+
return ht(t) ? t : Pr(t);
|
|
1620
1826
|
}
|
|
1621
|
-
function
|
|
1827
|
+
function de(t, e) {
|
|
1622
1828
|
var n = t.__data__;
|
|
1623
|
-
return
|
|
1829
|
+
return Fr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
1624
1830
|
}
|
|
1625
|
-
function
|
|
1626
|
-
var n =
|
|
1627
|
-
return
|
|
1831
|
+
function pt(t, e) {
|
|
1832
|
+
var n = or(t, e);
|
|
1833
|
+
return Ar(n) ? n : void 0;
|
|
1628
1834
|
}
|
|
1629
|
-
function
|
|
1630
|
-
if (
|
|
1835
|
+
function xr(t, e) {
|
|
1836
|
+
if (ht(t))
|
|
1631
1837
|
return !1;
|
|
1632
1838
|
var n = typeof t;
|
|
1633
|
-
return n == "number" || n == "symbol" || n == "boolean" || t == null ||
|
|
1839
|
+
return n == "number" || n == "symbol" || n == "boolean" || t == null || Ae(t) ? !0 : Jn.test(t) || !Yn.test(t) || e != null && t in Object(e);
|
|
1634
1840
|
}
|
|
1635
|
-
function
|
|
1841
|
+
function Fr(t) {
|
|
1636
1842
|
var e = typeof t;
|
|
1637
1843
|
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
1638
1844
|
}
|
|
1639
|
-
function
|
|
1640
|
-
return !!
|
|
1845
|
+
function Nr(t) {
|
|
1846
|
+
return !!Le && Le in t;
|
|
1641
1847
|
}
|
|
1642
|
-
var
|
|
1643
|
-
t =
|
|
1848
|
+
var Pr = Oe(function(t) {
|
|
1849
|
+
t = $r(t);
|
|
1644
1850
|
var e = [];
|
|
1645
|
-
return
|
|
1646
|
-
e.push(s ? i.replace(
|
|
1851
|
+
return Xn.test(t) && e.push(""), t.replace(Zn, function(n, r, s, i) {
|
|
1852
|
+
e.push(s ? i.replace(tr, "$1") : r || n);
|
|
1647
1853
|
}), e;
|
|
1648
1854
|
});
|
|
1649
|
-
function
|
|
1650
|
-
if (typeof t == "string" ||
|
|
1855
|
+
function Lr(t) {
|
|
1856
|
+
if (typeof t == "string" || Ae(t))
|
|
1651
1857
|
return t;
|
|
1652
1858
|
var e = t + "";
|
|
1653
1859
|
return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
|
|
1654
1860
|
}
|
|
1655
|
-
function
|
|
1861
|
+
function kr(t) {
|
|
1656
1862
|
if (t != null) {
|
|
1657
1863
|
try {
|
|
1658
|
-
return
|
|
1864
|
+
return dt.call(t);
|
|
1659
1865
|
} catch {
|
|
1660
1866
|
}
|
|
1661
1867
|
try {
|
|
@@ -1665,9 +1871,9 @@ function Or(t) {
|
|
|
1665
1871
|
}
|
|
1666
1872
|
return "";
|
|
1667
1873
|
}
|
|
1668
|
-
function
|
|
1874
|
+
function Oe(t, e) {
|
|
1669
1875
|
if (typeof t != "function" || e && typeof e != "function")
|
|
1670
|
-
throw new TypeError(
|
|
1876
|
+
throw new TypeError(Hn);
|
|
1671
1877
|
var n = function() {
|
|
1672
1878
|
var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
|
|
1673
1879
|
if (i.has(s))
|
|
@@ -1675,52 +1881,52 @@ function be(t, e) {
|
|
|
1675
1881
|
var o = t.apply(this, r);
|
|
1676
1882
|
return n.cache = i.set(s, o), o;
|
|
1677
1883
|
};
|
|
1678
|
-
return n.cache = new (
|
|
1884
|
+
return n.cache = new (Oe.Cache || Y)(), n;
|
|
1679
1885
|
}
|
|
1680
|
-
|
|
1681
|
-
function
|
|
1886
|
+
Oe.Cache = Y;
|
|
1887
|
+
function Mr(t, e) {
|
|
1682
1888
|
return t === e || t !== t && e !== e;
|
|
1683
1889
|
}
|
|
1684
|
-
var
|
|
1685
|
-
function
|
|
1686
|
-
var e =
|
|
1687
|
-
return e ==
|
|
1890
|
+
var ht = Array.isArray;
|
|
1891
|
+
function Ur(t) {
|
|
1892
|
+
var e = gt(t) ? ft.call(t) : "";
|
|
1893
|
+
return e == Bn || e == zn;
|
|
1688
1894
|
}
|
|
1689
|
-
function
|
|
1895
|
+
function gt(t) {
|
|
1690
1896
|
var e = typeof t;
|
|
1691
1897
|
return !!t && (e == "object" || e == "function");
|
|
1692
1898
|
}
|
|
1693
|
-
function
|
|
1899
|
+
function qr(t) {
|
|
1694
1900
|
return !!t && typeof t == "object";
|
|
1695
1901
|
}
|
|
1696
|
-
function
|
|
1697
|
-
return typeof t == "symbol" ||
|
|
1902
|
+
function Ae(t) {
|
|
1903
|
+
return typeof t == "symbol" || qr(t) && ft.call(t) == Vn;
|
|
1698
1904
|
}
|
|
1699
|
-
function
|
|
1700
|
-
return t == null ? "" :
|
|
1905
|
+
function $r(t) {
|
|
1906
|
+
return t == null ? "" : Tr(t);
|
|
1701
1907
|
}
|
|
1702
|
-
function
|
|
1703
|
-
var r = t == null ? void 0 :
|
|
1908
|
+
function Wr(t, e, n) {
|
|
1909
|
+
var r = t == null ? void 0 : Or(t, e);
|
|
1704
1910
|
return r === void 0 ? n : r;
|
|
1705
1911
|
}
|
|
1706
|
-
var
|
|
1707
|
-
const
|
|
1708
|
-
function
|
|
1912
|
+
var Gr = Wr;
|
|
1913
|
+
const oe = /* @__PURE__ */ Kn(Gr);
|
|
1914
|
+
function jr(t, e, n) {
|
|
1709
1915
|
const r = t ?? { result: [], success: !0, totalCount: 0 }, s = [...r.result ?? []];
|
|
1710
1916
|
for (const i of e) {
|
|
1711
|
-
const o =
|
|
1917
|
+
const o = oe(i.payload.data, n);
|
|
1712
1918
|
switch (i.type) {
|
|
1713
1919
|
case "ADD": {
|
|
1714
|
-
s.findIndex((c) =>
|
|
1920
|
+
s.findIndex((c) => oe(c, n) === o) === -1 && s.push(i.payload.data);
|
|
1715
1921
|
break;
|
|
1716
1922
|
}
|
|
1717
1923
|
case "UPDATE": {
|
|
1718
|
-
const a = s.findIndex((c) =>
|
|
1924
|
+
const a = s.findIndex((c) => oe(c, n) === o);
|
|
1719
1925
|
a !== -1 && (s[a] = i.payload.data);
|
|
1720
1926
|
break;
|
|
1721
1927
|
}
|
|
1722
1928
|
case "DELETE": {
|
|
1723
|
-
const a = s.findIndex((c) =>
|
|
1929
|
+
const a = s.findIndex((c) => oe(c, n) === o);
|
|
1724
1930
|
a !== -1 && s.splice(a, 1);
|
|
1725
1931
|
break;
|
|
1726
1932
|
}
|
|
@@ -1728,126 +1934,126 @@ function xr(t, e, n) {
|
|
|
1728
1934
|
}
|
|
1729
1935
|
return { ...r, result: s };
|
|
1730
1936
|
}
|
|
1731
|
-
function
|
|
1732
|
-
const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a =
|
|
1733
|
-
|
|
1734
|
-
const
|
|
1735
|
-
const
|
|
1736
|
-
if (a.current = [], c.current !== null && (clearTimeout(c.current), c.current = null),
|
|
1937
|
+
function Qr(t, e, n, r, s, i) {
|
|
1938
|
+
const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = W([]), c = W(null), d = W(null), l = W(s);
|
|
1939
|
+
l.current = s;
|
|
1940
|
+
const f = M(() => {
|
|
1941
|
+
const g = a.current;
|
|
1942
|
+
if (a.current = [], c.current !== null && (clearTimeout(c.current), c.current = null), d.current !== null && (cancelAnimationFrame(d.current), d.current = null), !(g.length === 0 || !r)) {
|
|
1737
1943
|
t.setQueryData(
|
|
1738
1944
|
e,
|
|
1739
|
-
(
|
|
1945
|
+
(m) => jr(m, g, r)
|
|
1740
1946
|
);
|
|
1741
|
-
for (const
|
|
1742
|
-
(
|
|
1743
|
-
n(
|
|
1744
|
-
{ result:
|
|
1947
|
+
for (const m of g)
|
|
1948
|
+
(m.type === "ADD" || m.type === "UPDATE") && t.setQueryData(
|
|
1949
|
+
n(m.payload.id, m.payload.namespace),
|
|
1950
|
+
{ result: m.payload.data }
|
|
1745
1951
|
);
|
|
1746
1952
|
}
|
|
1747
|
-
}, [t, e, n, r]),
|
|
1748
|
-
(
|
|
1749
|
-
a.current.push(
|
|
1953
|
+
}, [t, e, n, r]), h = M(
|
|
1954
|
+
(g) => {
|
|
1955
|
+
a.current.push(g), !(c.current !== null || d.current !== null) && (c.current = setTimeout(f, o), l.current !== 1 && (d.current = requestAnimationFrame(f)));
|
|
1750
1956
|
},
|
|
1751
|
-
[
|
|
1957
|
+
[f, o]
|
|
1752
1958
|
);
|
|
1753
|
-
return
|
|
1754
|
-
c.current !== null && (clearTimeout(c.current), c.current = null),
|
|
1755
|
-
}, []),
|
|
1959
|
+
return j(() => () => {
|
|
1960
|
+
c.current !== null && (clearTimeout(c.current), c.current = null), d.current !== null && (cancelAnimationFrame(d.current), d.current = null);
|
|
1961
|
+
}, []), h;
|
|
1756
1962
|
}
|
|
1757
|
-
const
|
|
1963
|
+
const ks = ({
|
|
1758
1964
|
pluginID: t,
|
|
1759
1965
|
connectionID: e,
|
|
1760
1966
|
resourceKey: n,
|
|
1761
1967
|
idAccessor: r,
|
|
1762
1968
|
namespaces: s
|
|
1763
1969
|
}) => {
|
|
1764
|
-
const i =
|
|
1970
|
+
const i = T(t), o = B(), { showSnackbar: a } = Q(), c = C.useMemo(() => s ?? [], [s]), d = C.useMemo(
|
|
1765
1971
|
() => [i, e, n, c, "list"],
|
|
1766
1972
|
[i, e, n, c]
|
|
1767
|
-
),
|
|
1768
|
-
(
|
|
1973
|
+
), l = C.useCallback(
|
|
1974
|
+
(u, p) => [i, e, n, p, u],
|
|
1769
1975
|
[i, e, n]
|
|
1770
|
-
), { mutateAsync:
|
|
1771
|
-
mutationFn: async (
|
|
1772
|
-
input:
|
|
1773
|
-
namespace:
|
|
1976
|
+
), { mutateAsync: f } = N({
|
|
1977
|
+
mutationFn: async (u) => Ke(i, e, n, Ve.createFrom({
|
|
1978
|
+
input: u.input,
|
|
1979
|
+
namespace: u.namespace ?? (c.length === 1 ? c[0] : "")
|
|
1774
1980
|
})),
|
|
1775
|
-
onSuccess: async (
|
|
1776
|
-
var
|
|
1777
|
-
const
|
|
1778
|
-
let
|
|
1779
|
-
(
|
|
1780
|
-
const
|
|
1781
|
-
a(
|
|
1981
|
+
onSuccess: async (u) => {
|
|
1982
|
+
var E;
|
|
1983
|
+
const p = u == null ? void 0 : u.result;
|
|
1984
|
+
let _ = "";
|
|
1985
|
+
(E = p == null ? void 0 : p.metadata) != null && E.name ? _ = p.metadata.name : p != null && p.id ? _ = p.id : p != null && p.name ? _ = p.name : p != null && p.ID ? _ = p.ID : p != null && p.Name && (_ = p.Name);
|
|
1986
|
+
const y = _ ? `Resource ${_} created` : "Resource created";
|
|
1987
|
+
a(y, "success"), await o.invalidateQueries({ queryKey: d });
|
|
1782
1988
|
},
|
|
1783
|
-
onError:
|
|
1784
|
-
}),
|
|
1785
|
-
queryKey:
|
|
1786
|
-
queryFn: async () =>
|
|
1989
|
+
onError: U(a, "Failed to create resource")
|
|
1990
|
+
}), h = F({
|
|
1991
|
+
queryKey: d,
|
|
1992
|
+
queryFn: async () => Qe(i, e, n, ze.createFrom({
|
|
1787
1993
|
order: [{ field: "name", descending: !1 }],
|
|
1788
1994
|
pagination: { page: 1, pageSize: 200 },
|
|
1789
1995
|
namespaces: c
|
|
1790
1996
|
})),
|
|
1791
|
-
placeholderData: (
|
|
1997
|
+
placeholderData: (u, p) => u,
|
|
1792
1998
|
retry: !1
|
|
1793
|
-
}), [
|
|
1794
|
-
|
|
1999
|
+
}), [g, m] = C.useState(
|
|
2000
|
+
O.WatchStateIdle
|
|
1795
2001
|
);
|
|
1796
|
-
|
|
2002
|
+
C.useEffect(() => x(
|
|
1797
2003
|
`${i}/${e}/watch/STATE`,
|
|
1798
|
-
(
|
|
1799
|
-
const
|
|
1800
|
-
|
|
2004
|
+
(p) => {
|
|
2005
|
+
const _ = p.data;
|
|
2006
|
+
_.resourceKey === n && m(_.state);
|
|
1801
2007
|
}
|
|
1802
2008
|
), [i, e, n]);
|
|
1803
|
-
const
|
|
1804
|
-
return
|
|
2009
|
+
const S = Qr(o, d, l, r, g);
|
|
2010
|
+
return C.useEffect(() => {
|
|
1805
2011
|
if (!r)
|
|
1806
2012
|
return;
|
|
1807
|
-
|
|
1808
|
-
const
|
|
2013
|
+
rn(i, e, n);
|
|
2014
|
+
const u = x(
|
|
1809
2015
|
`${i}/${e}/${n}/ADD`,
|
|
1810
|
-
(
|
|
1811
|
-
),
|
|
2016
|
+
(y) => S({ type: "ADD", payload: y.data })
|
|
2017
|
+
), p = x(
|
|
1812
2018
|
`${i}/${e}/${n}/UPDATE`,
|
|
1813
|
-
(
|
|
1814
|
-
),
|
|
2019
|
+
(y) => S({ type: "UPDATE", payload: y.data })
|
|
2020
|
+
), _ = x(
|
|
1815
2021
|
`${i}/${e}/${n}/DELETE`,
|
|
1816
|
-
(
|
|
2022
|
+
(y) => S({ type: "DELETE", payload: y.data })
|
|
1817
2023
|
);
|
|
1818
2024
|
return () => {
|
|
1819
|
-
|
|
2025
|
+
u(), p(), _(), sn(i, e, n);
|
|
1820
2026
|
};
|
|
1821
|
-
}, [i, e, n,
|
|
2027
|
+
}, [i, e, n, S]), {
|
|
1822
2028
|
/**
|
|
1823
2029
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1824
2030
|
* when the resources are updated or deleted via the returned create and remove mutation functions, or
|
|
1825
2031
|
* the per-resource hook mutation functions.
|
|
1826
2032
|
*/
|
|
1827
|
-
resources:
|
|
2033
|
+
resources: h,
|
|
1828
2034
|
/**
|
|
1829
2035
|
* Create a new resource. A set of optional parameters can be passed to customize the create behavior,
|
|
1830
2036
|
* which if specified, will add additional default behavior set via the hook options.
|
|
1831
2037
|
*
|
|
1832
2038
|
* @params opts Optional parameters to pass to the resource create operation
|
|
1833
2039
|
*/
|
|
1834
|
-
create:
|
|
2040
|
+
create: f,
|
|
1835
2041
|
/** Current watch state for this resource type */
|
|
1836
|
-
watchState:
|
|
2042
|
+
watchState: g,
|
|
1837
2043
|
/** Whether the watch is currently syncing */
|
|
1838
|
-
isSyncing:
|
|
2044
|
+
isSyncing: g === O.WatchStateSyncing,
|
|
1839
2045
|
/** Whether the watch has fully synced */
|
|
1840
|
-
isSynced:
|
|
2046
|
+
isSynced: g === O.WatchStateSynced,
|
|
1841
2047
|
/** Whether the watch encountered an error */
|
|
1842
|
-
watchError:
|
|
2048
|
+
watchError: g === O.WatchStateError
|
|
1843
2049
|
};
|
|
1844
|
-
},
|
|
1845
|
-
const e =
|
|
1846
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2050
|
+
}, Ms = ({ pluginID: t }) => {
|
|
2051
|
+
const e = T(t), { showSnackbar: n } = Q(), r = N({
|
|
2052
|
+
mutationFn: async ({ opts: o, input: a }) => Ke(
|
|
1847
2053
|
e,
|
|
1848
2054
|
o.connectionID,
|
|
1849
2055
|
o.resourceKey,
|
|
1850
|
-
|
|
2056
|
+
Ve.createFrom({
|
|
1851
2057
|
input: a.input,
|
|
1852
2058
|
namespace: a.namespace ?? o.namespace ?? ""
|
|
1853
2059
|
})
|
|
@@ -1856,14 +2062,14 @@ const Os = ({
|
|
|
1856
2062
|
n(`Resource ${a.resourceID} created`, "success");
|
|
1857
2063
|
},
|
|
1858
2064
|
onError(o, { opts: a }) {
|
|
1859
|
-
|
|
2065
|
+
z(n, o, `Failed to create resource ${a.resourceID}`);
|
|
1860
2066
|
}
|
|
1861
2067
|
}), s = N({
|
|
1862
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2068
|
+
mutationFn: async ({ opts: o, input: a }) => Ge(
|
|
1863
2069
|
e,
|
|
1864
2070
|
o.connectionID,
|
|
1865
2071
|
o.resourceKey,
|
|
1866
|
-
|
|
2072
|
+
He.createFrom({
|
|
1867
2073
|
input: a.input,
|
|
1868
2074
|
id: o.resourceID,
|
|
1869
2075
|
namespace: o.namespace ?? ""
|
|
@@ -1873,14 +2079,14 @@ const Os = ({
|
|
|
1873
2079
|
n(`Resource ${a.resourceID} updated`, "success");
|
|
1874
2080
|
},
|
|
1875
2081
|
onError(o, { opts: a }) {
|
|
1876
|
-
|
|
2082
|
+
z(n, o, `Failed to update resource ${a.resourceID}`);
|
|
1877
2083
|
}
|
|
1878
2084
|
}), i = N({
|
|
1879
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2085
|
+
mutationFn: async ({ opts: o, input: a }) => je(
|
|
1880
2086
|
e,
|
|
1881
2087
|
o.connectionID,
|
|
1882
2088
|
o.resourceKey,
|
|
1883
|
-
|
|
2089
|
+
Be.createFrom({
|
|
1884
2090
|
id: o.resourceID,
|
|
1885
2091
|
namespace: o.namespace ?? "",
|
|
1886
2092
|
gracePeriodSeconds: a.gracePeriodSeconds
|
|
@@ -1890,7 +2096,7 @@ const Os = ({
|
|
|
1890
2096
|
n(`Resource ${a.resourceID} deleted`, "success");
|
|
1891
2097
|
},
|
|
1892
2098
|
onError(o, { opts: a }) {
|
|
1893
|
-
|
|
2099
|
+
z(n, o, `Failed to delete resource ${a.resourceID}`);
|
|
1894
2100
|
}
|
|
1895
2101
|
});
|
|
1896
2102
|
return {
|
|
@@ -1898,15 +2104,15 @@ const Os = ({
|
|
|
1898
2104
|
update: s.mutateAsync,
|
|
1899
2105
|
remove: i.mutateAsync
|
|
1900
2106
|
};
|
|
1901
|
-
},
|
|
2107
|
+
}, Us = ({
|
|
1902
2108
|
pluginID: t,
|
|
1903
2109
|
connectionID: e,
|
|
1904
2110
|
resourceKey: n,
|
|
1905
2111
|
enabled: r = !0
|
|
1906
2112
|
}) => {
|
|
1907
|
-
const s =
|
|
2113
|
+
const s = T(t), i = F({
|
|
1908
2114
|
queryKey: ["RESOURCE_ACTIONS", s, e, n],
|
|
1909
|
-
queryFn: () =>
|
|
2115
|
+
queryFn: () => on(s, e, n),
|
|
1910
2116
|
enabled: r && !!s && !!e && !!n,
|
|
1911
2117
|
staleTime: 5 * 60 * 1e3
|
|
1912
2118
|
// actions don't change often
|
|
@@ -1916,18 +2122,18 @@ const Os = ({
|
|
|
1916
2122
|
isLoading: i.isLoading,
|
|
1917
2123
|
error: i.error
|
|
1918
2124
|
};
|
|
1919
|
-
},
|
|
2125
|
+
}, qs = ({
|
|
1920
2126
|
pluginID: t,
|
|
1921
2127
|
connectionID: e,
|
|
1922
2128
|
resourceKey: n
|
|
1923
2129
|
}) => {
|
|
1924
|
-
const r =
|
|
1925
|
-
mutationFn: async ({ actionID: a, id: c = "", namespace:
|
|
2130
|
+
const r = T(t), s = B(), { showSnackbar: i } = Q(), o = N({
|
|
2131
|
+
mutationFn: async ({ actionID: a, id: c = "", namespace: d = "", params: l = {} }) => an(
|
|
1926
2132
|
r,
|
|
1927
2133
|
e,
|
|
1928
2134
|
n,
|
|
1929
2135
|
a,
|
|
1930
|
-
|
|
2136
|
+
Ye.createFrom({ id: c, namespace: d, params: l })
|
|
1931
2137
|
),
|
|
1932
2138
|
onSuccess: (a) => {
|
|
1933
2139
|
a != null && a.message && i(a.message, "success"), s.invalidateQueries({
|
|
@@ -1935,7 +2141,7 @@ const Os = ({
|
|
|
1935
2141
|
});
|
|
1936
2142
|
},
|
|
1937
2143
|
onError: (a, c) => {
|
|
1938
|
-
|
|
2144
|
+
z(i, a, `Failed to execute action "${c.actionID}"`);
|
|
1939
2145
|
}
|
|
1940
2146
|
});
|
|
1941
2147
|
return {
|
|
@@ -1943,14 +2149,14 @@ const Os = ({
|
|
|
1943
2149
|
isExecuting: o.isPending,
|
|
1944
2150
|
error: o.error
|
|
1945
2151
|
};
|
|
1946
|
-
},
|
|
2152
|
+
}, $s = ({
|
|
1947
2153
|
pluginID: t,
|
|
1948
2154
|
connectionID: e,
|
|
1949
2155
|
enabled: n = !0
|
|
1950
2156
|
}) => {
|
|
1951
|
-
const r =
|
|
2157
|
+
const r = T(t), s = F({
|
|
1952
2158
|
queryKey: ["EDITOR_SCHEMAS", r, e],
|
|
1953
|
-
queryFn: () =>
|
|
2159
|
+
queryFn: () => cn(r, e),
|
|
1954
2160
|
enabled: n && !!r && !!e,
|
|
1955
2161
|
staleTime: 10 * 60 * 1e3,
|
|
1956
2162
|
// schemas are fairly stable per connection
|
|
@@ -1962,115 +2168,115 @@ const Os = ({
|
|
|
1962
2168
|
error: s.error,
|
|
1963
2169
|
refetch: s.refetch
|
|
1964
2170
|
};
|
|
1965
|
-
},
|
|
2171
|
+
}, Ws = ({
|
|
1966
2172
|
pluginID: t,
|
|
1967
2173
|
connectionID: e,
|
|
1968
2174
|
enabled: n = !0
|
|
1969
2175
|
}) => {
|
|
1970
|
-
const r =
|
|
1971
|
-
s.setQueryData(i, (
|
|
1972
|
-
if (!
|
|
1973
|
-
const
|
|
1974
|
-
let
|
|
1975
|
-
for (const
|
|
1976
|
-
|
|
1977
|
-
return { ...
|
|
2176
|
+
const r = T(t), s = B(), i = [r, e, "watch-state"], o = W([]), a = W(!1), c = M((h) => {
|
|
2177
|
+
s.setQueryData(i, (g) => {
|
|
2178
|
+
if (!g) return g;
|
|
2179
|
+
const m = { ...g.resources, [h.resourceKey]: h.state }, S = { ...g.resourceCounts, [h.resourceKey]: h.resourceCount };
|
|
2180
|
+
let u = 0, p = 0;
|
|
2181
|
+
for (const _ of Object.values(m))
|
|
2182
|
+
_ === O.WatchStateSynced && u++, (_ === O.WatchStateError || _ === O.WatchStateFailed) && p++;
|
|
2183
|
+
return { ...g, resources: m, resourceCounts: S, totalResources: Object.keys(m).length, syncedCount: u, errorCount: p };
|
|
1978
2184
|
});
|
|
1979
|
-
}, [s, r, e]),
|
|
2185
|
+
}, [s, r, e]), d = F({
|
|
1980
2186
|
queryKey: i,
|
|
1981
2187
|
queryFn: async () => {
|
|
1982
|
-
const
|
|
1983
|
-
if (!
|
|
1984
|
-
const p = {};
|
|
1985
|
-
let h = 0, E = 0;
|
|
1986
|
-
for (const [y, w] of Object.entries(f.resources ?? {}))
|
|
1987
|
-
w != null && (p[y] = w, w === I.WatchStateSynced && h++, w === I.WatchStateError && E++);
|
|
2188
|
+
const h = await un(r, e);
|
|
2189
|
+
if (!h) throw new Error("Failed to get watch state: null response");
|
|
1988
2190
|
const g = {};
|
|
1989
|
-
|
|
1990
|
-
|
|
2191
|
+
let m = 0, S = 0;
|
|
2192
|
+
for (const [p, _] of Object.entries(h.resources ?? {}))
|
|
2193
|
+
_ != null && (g[p] = _, _ === O.WatchStateSynced && m++, _ === O.WatchStateError && S++);
|
|
2194
|
+
const u = {};
|
|
2195
|
+
for (const [p, _] of Object.entries(h.resourceCounts ?? {}))
|
|
2196
|
+
_ != null && (u[p] = _);
|
|
1991
2197
|
return {
|
|
1992
|
-
connection:
|
|
1993
|
-
resources:
|
|
1994
|
-
resourceCounts:
|
|
1995
|
-
totalResources: Object.keys(
|
|
1996
|
-
syncedCount:
|
|
1997
|
-
errorCount:
|
|
2198
|
+
connection: h.connectionId,
|
|
2199
|
+
resources: g,
|
|
2200
|
+
resourceCounts: u,
|
|
2201
|
+
totalResources: Object.keys(g).length,
|
|
2202
|
+
syncedCount: m,
|
|
2203
|
+
errorCount: S
|
|
1998
2204
|
};
|
|
1999
2205
|
},
|
|
2000
2206
|
enabled: n && !!r && !!e,
|
|
2001
|
-
refetchInterval: (
|
|
2002
|
-
const
|
|
2003
|
-
if (!
|
|
2004
|
-
let
|
|
2005
|
-
for (const
|
|
2006
|
-
(
|
|
2007
|
-
return
|
|
2207
|
+
refetchInterval: (h) => {
|
|
2208
|
+
const g = h.state.data;
|
|
2209
|
+
if (!g || g.totalResources === 0) return 3e3;
|
|
2210
|
+
let m = 0;
|
|
2211
|
+
for (const S of Object.values(g.resources))
|
|
2212
|
+
(S === O.WatchStateSynced || S === O.WatchStateError || S === O.WatchStateStopped || S === O.WatchStateFailed || S === O.WatchStateForbidden || S === O.WatchStateSkipped) && m++;
|
|
2213
|
+
return m >= g.totalResources ? !1 : 3e3;
|
|
2008
2214
|
}
|
|
2009
2215
|
});
|
|
2010
|
-
|
|
2011
|
-
if (!
|
|
2216
|
+
j(() => {
|
|
2217
|
+
if (!d.data || a.current) return;
|
|
2012
2218
|
a.current = !0;
|
|
2013
|
-
const
|
|
2219
|
+
const h = o.current;
|
|
2014
2220
|
o.current = [];
|
|
2015
|
-
for (const
|
|
2016
|
-
c(
|
|
2017
|
-
}, [
|
|
2221
|
+
for (const g of h)
|
|
2222
|
+
c(g);
|
|
2223
|
+
}, [d.data, c]), j(() => {
|
|
2018
2224
|
if (!n || !r || !e)
|
|
2019
2225
|
return;
|
|
2020
2226
|
a.current = !1, o.current = [];
|
|
2021
|
-
const
|
|
2227
|
+
const h = x(
|
|
2022
2228
|
`${r}/${e}/watch/STATE`,
|
|
2023
|
-
(
|
|
2024
|
-
const
|
|
2025
|
-
a.current ? c(
|
|
2229
|
+
(g) => {
|
|
2230
|
+
const m = g.data;
|
|
2231
|
+
a.current ? c(m) : o.current.push(m);
|
|
2026
2232
|
}
|
|
2027
2233
|
);
|
|
2028
2234
|
return () => {
|
|
2029
|
-
|
|
2235
|
+
h(), a.current = !1, o.current = [];
|
|
2030
2236
|
};
|
|
2031
2237
|
}, [r, e, n, c]);
|
|
2032
|
-
const
|
|
2033
|
-
let
|
|
2034
|
-
if (
|
|
2035
|
-
for (const
|
|
2036
|
-
(
|
|
2238
|
+
const l = d.data;
|
|
2239
|
+
let f = 0;
|
|
2240
|
+
if (l != null && l.resources)
|
|
2241
|
+
for (const h of Object.values(l.resources))
|
|
2242
|
+
(h === O.WatchStateSynced || h === O.WatchStateError || h === O.WatchStateStopped || h === O.WatchStateFailed || h === O.WatchStateForbidden || h === O.WatchStateSkipped) && f++;
|
|
2037
2243
|
return {
|
|
2038
2244
|
/** Full summary query result */
|
|
2039
|
-
summary:
|
|
2245
|
+
summary: d,
|
|
2040
2246
|
/** Get the state of a specific resource type's watch */
|
|
2041
|
-
getResourceState: (
|
|
2247
|
+
getResourceState: (h) => l == null ? void 0 : l.resources[h],
|
|
2042
2248
|
/** Whether all registered watches have reached a terminal state */
|
|
2043
|
-
isFullySynced:
|
|
2249
|
+
isFullySynced: l ? l.totalResources > 0 && f === l.totalResources : !1,
|
|
2044
2250
|
/** Sync progress as a 0-1 fraction (terminal states / total) */
|
|
2045
|
-
syncProgress:
|
|
2251
|
+
syncProgress: l && l.totalResources > 0 ? f / l.totalResources : 0,
|
|
2046
2252
|
/** Number of watches that encountered errors */
|
|
2047
|
-
errorCount: (
|
|
2253
|
+
errorCount: (l == null ? void 0 : l.errorCount) ?? 0
|
|
2048
2254
|
};
|
|
2049
|
-
},
|
|
2050
|
-
const [t, e] =
|
|
2051
|
-
const
|
|
2052
|
-
if (e((
|
|
2053
|
-
const
|
|
2054
|
-
return
|
|
2055
|
-
}), r.current.has(
|
|
2056
|
-
const
|
|
2057
|
-
e((
|
|
2058
|
-
const
|
|
2059
|
-
return
|
|
2060
|
-
}), n.current.delete(
|
|
2255
|
+
}, Gs = () => {
|
|
2256
|
+
const [t, e] = K(/* @__PURE__ */ new Map()), n = W(/* @__PURE__ */ new Map()), r = W(/* @__PURE__ */ new Map()), s = M((d) => {
|
|
2257
|
+
const l = d.data, f = be(l), h = at(n.current, l), g = Ce(h);
|
|
2258
|
+
if (e((m) => {
|
|
2259
|
+
const S = new Map(m);
|
|
2260
|
+
return S.set(f, g), S;
|
|
2261
|
+
}), r.current.has(f) && (clearTimeout(r.current.get(f)), r.current.delete(f)), ce(g)) {
|
|
2262
|
+
const m = setTimeout(() => {
|
|
2263
|
+
e((S) => {
|
|
2264
|
+
const u = new Map(S);
|
|
2265
|
+
return u.delete(f), u;
|
|
2266
|
+
}), n.current.delete(f), r.current.delete(f);
|
|
2061
2267
|
}, 5e3);
|
|
2062
|
-
r.current.set(
|
|
2268
|
+
r.current.set(f, m);
|
|
2063
2269
|
}
|
|
2064
2270
|
}, []);
|
|
2065
|
-
|
|
2066
|
-
const
|
|
2271
|
+
j(() => {
|
|
2272
|
+
const d = x("watch/STATE", s);
|
|
2067
2273
|
return () => {
|
|
2068
|
-
|
|
2069
|
-
for (const
|
|
2070
|
-
clearTimeout(
|
|
2274
|
+
d();
|
|
2275
|
+
for (const l of r.current.values())
|
|
2276
|
+
clearTimeout(l);
|
|
2071
2277
|
};
|
|
2072
2278
|
}, [s]);
|
|
2073
|
-
const i = Array.from(t.values()), o =
|
|
2279
|
+
const i = Array.from(t.values()), o = ot(i), a = i.find((d) => !ce(d)) ?? i[0] ?? null, c = it(i);
|
|
2074
2280
|
return {
|
|
2075
2281
|
/** All tracked syncs */
|
|
2076
2282
|
syncs: i,
|
|
@@ -2081,73 +2287,73 @@ const Os = ({
|
|
|
2081
2287
|
/** Aggregate progress across all connections (0-1) */
|
|
2082
2288
|
aggregateProgress: c
|
|
2083
2289
|
};
|
|
2084
|
-
},
|
|
2085
|
-
const t =
|
|
2290
|
+
}, Kr = () => {
|
|
2291
|
+
const t = C.useContext(tt);
|
|
2086
2292
|
if (!t) throw new Error("useOperations must be used within an OperationsProvider");
|
|
2087
2293
|
return t;
|
|
2088
|
-
},
|
|
2089
|
-
const r =
|
|
2090
|
-
var
|
|
2091
|
-
|
|
2092
|
-
}),
|
|
2294
|
+
}, js = ({ pluginID: t, connectionID: e, resourceKey: n }) => {
|
|
2295
|
+
const r = T(t), { showSnackbar: s } = Q(), { addOperation: i, updateOperation: o } = Kr(), a = C.useRef(/* @__PURE__ */ new Set()), c = C.useCallback((f, h = !1) => {
|
|
2296
|
+
var g, m, S;
|
|
2297
|
+
f.disposed || (f.disposed = !0, (g = f.unsubscribe) == null || g.call(f), (m = f.open) == null || m.cancel(), (S = f.attach) == null || S.cancel(), f.handle && (xe(f.handle).catch(() => {
|
|
2298
|
+
}), h && o(f.handle, { status: "cancelled", message: "Cancelled", completedAt: Date.now() })), a.current.delete(f));
|
|
2093
2299
|
}, [o]);
|
|
2094
|
-
|
|
2095
|
-
for (const
|
|
2300
|
+
C.useEffect(() => () => {
|
|
2301
|
+
for (const f of a.current) c(f, !0);
|
|
2096
2302
|
}, [r, e, n, c]);
|
|
2097
|
-
const
|
|
2098
|
-
const
|
|
2099
|
-
a.current.add(
|
|
2303
|
+
const d = C.useCallback(async ({ actionID: f, id: h, namespace: g, label: m, params: S = {} }) => {
|
|
2304
|
+
const u = { disposed: !1, terminal: !1, sequence: 0 };
|
|
2305
|
+
a.current.add(u);
|
|
2100
2306
|
try {
|
|
2101
|
-
|
|
2102
|
-
const
|
|
2103
|
-
if (
|
|
2104
|
-
return
|
|
2105
|
-
}),
|
|
2106
|
-
|
|
2107
|
-
const
|
|
2108
|
-
if (
|
|
2109
|
-
|
|
2110
|
-
const
|
|
2111
|
-
if (
|
|
2112
|
-
|
|
2113
|
-
const
|
|
2114
|
-
o(
|
|
2115
|
-
} else if (
|
|
2116
|
-
|
|
2117
|
-
const
|
|
2118
|
-
o(
|
|
2307
|
+
u.open = ln(r, e, n, f, Ye.createFrom({ id: h, namespace: g, params: S }));
|
|
2308
|
+
const p = await u.open;
|
|
2309
|
+
if (u.open = void 0, u.disposed)
|
|
2310
|
+
return xe(p).catch(() => {
|
|
2311
|
+
}), p;
|
|
2312
|
+
u.handle = p, i({ id: p, label: m, resourceKey: n, resourceName: h, namespace: g, connectionID: e, status: "running", startedAt: Date.now() });
|
|
2313
|
+
const _ = (E) => {
|
|
2314
|
+
if (u.disposed || !Number.isSafeInteger(E.sequence) || E.sequence <= u.sequence) return;
|
|
2315
|
+
u.sequence = E.sequence;
|
|
2316
|
+
const w = E.event, v = w.data ?? {};
|
|
2317
|
+
if (w.type === "error") {
|
|
2318
|
+
u.terminal = !0;
|
|
2319
|
+
const b = H(w.error);
|
|
2320
|
+
o(p, { status: ae(b) ? "cancelled" : "error", message: b.title, completedAt: Date.now() }), z(s, b, m), c(u);
|
|
2321
|
+
} else if (w.type === "complete") {
|
|
2322
|
+
u.terminal = !0;
|
|
2323
|
+
const b = typeof v.message == "string" ? v.message : `${m} completed`;
|
|
2324
|
+
o(p, { status: "completed", message: b, completedAt: Date.now() }), s(b, "success"), c(u);
|
|
2119
2325
|
} else
|
|
2120
|
-
o(
|
|
2121
|
-
message: typeof
|
|
2122
|
-
progress: typeof
|
|
2326
|
+
o(p, {
|
|
2327
|
+
message: typeof v.message == "string" ? v.message : void 0,
|
|
2328
|
+
progress: typeof v.ready == "number" && typeof v.desired == "number" ? { ready: v.ready, desired: v.desired } : void 0
|
|
2123
2329
|
});
|
|
2124
2330
|
};
|
|
2125
|
-
|
|
2126
|
-
const
|
|
2127
|
-
return
|
|
2128
|
-
} catch (
|
|
2129
|
-
if (
|
|
2130
|
-
throw
|
|
2331
|
+
u.unsubscribe = x(`action/stream/${p}`, (E) => _(E.data)), u.attach = dn(p);
|
|
2332
|
+
const y = await u.attach;
|
|
2333
|
+
return u.attach = void 0, _(y), p;
|
|
2334
|
+
} catch (p) {
|
|
2335
|
+
if (u.terminal && u.handle) return u.handle;
|
|
2336
|
+
throw u.disposed || (u.handle && o(u.handle, { status: ae(p) ? "cancelled" : "error", message: H(p).title, completedAt: Date.now() }), z(s, p, `Failed to start "${f}"`)), c(u), p;
|
|
2131
2337
|
}
|
|
2132
|
-
}, [r, e, n, i, o, s, c]),
|
|
2133
|
-
for (const
|
|
2134
|
-
c(
|
|
2338
|
+
}, [r, e, n, i, o, s, c]), l = C.useCallback((f) => {
|
|
2339
|
+
for (const h of a.current) if (h.handle === f) {
|
|
2340
|
+
c(h, !0);
|
|
2135
2341
|
return;
|
|
2136
2342
|
}
|
|
2137
2343
|
}, [c]);
|
|
2138
|
-
return { startStreamAction:
|
|
2344
|
+
return { startStreamAction: d, cancelStreamAction: l };
|
|
2139
2345
|
};
|
|
2140
|
-
function
|
|
2346
|
+
function Hr(t, e) {
|
|
2141
2347
|
return `${t}/${e}/graph/CHANGED`;
|
|
2142
2348
|
}
|
|
2143
|
-
function
|
|
2144
|
-
const s =
|
|
2349
|
+
function Te(t, e, n, r) {
|
|
2350
|
+
const s = B(), i = W(n);
|
|
2145
2351
|
i.current = n;
|
|
2146
2352
|
const o = JSON.stringify(n);
|
|
2147
|
-
|
|
2353
|
+
j(() => {
|
|
2148
2354
|
if (!r || !t || !e)
|
|
2149
2355
|
return;
|
|
2150
|
-
const a =
|
|
2356
|
+
const a = x(Hr(t, e), () => {
|
|
2151
2357
|
s.invalidateQueries({ queryKey: i.current, exact: !0 });
|
|
2152
2358
|
});
|
|
2153
2359
|
return () => {
|
|
@@ -2155,7 +2361,7 @@ function Re(t, e, n, r) {
|
|
|
2155
2361
|
};
|
|
2156
2362
|
}, [s, t, e, o, r]);
|
|
2157
2363
|
}
|
|
2158
|
-
const
|
|
2364
|
+
const Br = {
|
|
2159
2365
|
owns: { outgoing: "Owns", incoming: "Owned by" },
|
|
2160
2366
|
runs_on: { outgoing: "Runs on", incoming: "Running here" },
|
|
2161
2367
|
uses: { outgoing: "Uses", incoming: "Used by" },
|
|
@@ -2164,19 +2370,19 @@ const Mr = {
|
|
|
2164
2370
|
member_of: { outgoing: "Member of", incoming: "Members" },
|
|
2165
2371
|
selects: { outgoing: "Selects", incoming: "Selected by" }
|
|
2166
2372
|
};
|
|
2167
|
-
function
|
|
2168
|
-
const n =
|
|
2373
|
+
function Qs(t, e) {
|
|
2374
|
+
const n = Br[t];
|
|
2169
2375
|
if (n)
|
|
2170
2376
|
return n[e];
|
|
2171
2377
|
const r = t.replace(/_/g, " ");
|
|
2172
2378
|
return e === "outgoing" ? r : `${r} (incoming)`;
|
|
2173
2379
|
}
|
|
2174
|
-
function
|
|
2380
|
+
function zr(t, e) {
|
|
2175
2381
|
return t.pluginId === e.pluginId && t.connectionId === e.connectionId && t.resourceKey === e.resourceKey && t.id === e.id && (t.namespace ?? "") === (e.namespace ?? "");
|
|
2176
2382
|
}
|
|
2177
|
-
function
|
|
2383
|
+
function Vr(t, e) {
|
|
2178
2384
|
return e.map((n) => {
|
|
2179
|
-
const r =
|
|
2385
|
+
const r = zr(n.source, t);
|
|
2180
2386
|
return {
|
|
2181
2387
|
resource: r ? n.target : n.source,
|
|
2182
2388
|
type: n.type,
|
|
@@ -2185,7 +2391,7 @@ function $r(t, e) {
|
|
|
2185
2391
|
};
|
|
2186
2392
|
});
|
|
2187
2393
|
}
|
|
2188
|
-
const
|
|
2394
|
+
const Ks = ({
|
|
2189
2395
|
pluginID: t,
|
|
2190
2396
|
connectionID: e,
|
|
2191
2397
|
resourceKey: n,
|
|
@@ -2196,31 +2402,31 @@ const Us = ({
|
|
|
2196
2402
|
enabled: a = !0,
|
|
2197
2403
|
refetchInterval: c = !1
|
|
2198
2404
|
}) => {
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2201
|
-
const
|
|
2202
|
-
queryKey:
|
|
2203
|
-
queryFn: async () =>
|
|
2204
|
-
enabled:
|
|
2405
|
+
const d = T(t), l = ["RESOURCE_RELATED", d, e, n, s, r, i, o ?? null], f = a && !!d && !!e && !!n && !!r;
|
|
2406
|
+
Te(d, e, l, f);
|
|
2407
|
+
const h = F({
|
|
2408
|
+
queryKey: l,
|
|
2409
|
+
queryFn: async () => fn(d, e, n, s, r, i, o ?? null),
|
|
2410
|
+
enabled: f,
|
|
2205
2411
|
refetchInterval: c
|
|
2206
|
-
}),
|
|
2207
|
-
pluginId:
|
|
2412
|
+
}), g = {
|
|
2413
|
+
pluginId: d,
|
|
2208
2414
|
connectionId: e,
|
|
2209
2415
|
resourceKey: n,
|
|
2210
2416
|
id: r,
|
|
2211
2417
|
namespace: s
|
|
2212
|
-
},
|
|
2418
|
+
}, m = h.data ?? [];
|
|
2213
2419
|
return {
|
|
2214
2420
|
/** One entry per edge, from the viewed resource's side. */
|
|
2215
|
-
related:
|
|
2421
|
+
related: Vr(g, m),
|
|
2216
2422
|
/** The raw graph edges. */
|
|
2217
|
-
edges:
|
|
2218
|
-
isLoading:
|
|
2219
|
-
isFetching:
|
|
2220
|
-
error:
|
|
2221
|
-
refetch:
|
|
2423
|
+
edges: m,
|
|
2424
|
+
isLoading: h.isLoading,
|
|
2425
|
+
isFetching: h.isFetching,
|
|
2426
|
+
error: h.error,
|
|
2427
|
+
refetch: h.refetch
|
|
2222
2428
|
};
|
|
2223
|
-
},
|
|
2429
|
+
}, Hs = ({
|
|
2224
2430
|
pluginID: t,
|
|
2225
2431
|
connectionID: e,
|
|
2226
2432
|
resourceKey: n,
|
|
@@ -2230,22 +2436,22 @@ const Us = ({
|
|
|
2230
2436
|
enabled: o = !0,
|
|
2231
2437
|
refetchInterval: a = !1
|
|
2232
2438
|
}) => {
|
|
2233
|
-
const c =
|
|
2234
|
-
|
|
2235
|
-
const
|
|
2236
|
-
queryKey:
|
|
2237
|
-
queryFn: async () =>
|
|
2238
|
-
enabled:
|
|
2439
|
+
const c = T(t), d = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], l = o && !!c && !!e && !!n && !!r;
|
|
2440
|
+
Te(c, e, d, l);
|
|
2441
|
+
const f = F({
|
|
2442
|
+
queryKey: d,
|
|
2443
|
+
queryFn: async () => pn(c, e, n, s, r, i),
|
|
2444
|
+
enabled: l,
|
|
2239
2445
|
refetchInterval: a
|
|
2240
2446
|
});
|
|
2241
2447
|
return {
|
|
2242
|
-
tree:
|
|
2243
|
-
isLoading:
|
|
2244
|
-
isFetching:
|
|
2245
|
-
error:
|
|
2246
|
-
refetch:
|
|
2448
|
+
tree: f.data ?? null,
|
|
2449
|
+
isLoading: f.isLoading,
|
|
2450
|
+
isFetching: f.isFetching,
|
|
2451
|
+
error: f.error,
|
|
2452
|
+
refetch: f.refetch
|
|
2247
2453
|
};
|
|
2248
|
-
},
|
|
2454
|
+
}, Bs = ({
|
|
2249
2455
|
pluginID: t,
|
|
2250
2456
|
connectionID: e,
|
|
2251
2457
|
resourceKey: n,
|
|
@@ -2255,53 +2461,53 @@ const Us = ({
|
|
|
2255
2461
|
downDepth: o = 3,
|
|
2256
2462
|
enabled: a = !0
|
|
2257
2463
|
}) => {
|
|
2258
|
-
const c =
|
|
2259
|
-
|
|
2260
|
-
const
|
|
2261
|
-
queryKey:
|
|
2262
|
-
queryFn: async () =>
|
|
2263
|
-
enabled:
|
|
2464
|
+
const c = T(t), d = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], l = a && !!c && !!e && !!n && !!r;
|
|
2465
|
+
Te(c, e, d, l);
|
|
2466
|
+
const f = F({
|
|
2467
|
+
queryKey: d,
|
|
2468
|
+
queryFn: async () => hn(c, e, n, s, r, i, o),
|
|
2469
|
+
enabled: l
|
|
2264
2470
|
});
|
|
2265
2471
|
return {
|
|
2266
|
-
graph:
|
|
2267
|
-
isLoading:
|
|
2268
|
-
isFetching:
|
|
2269
|
-
error:
|
|
2270
|
-
refetch:
|
|
2472
|
+
graph: f.data ?? null,
|
|
2473
|
+
isLoading: f.isLoading,
|
|
2474
|
+
isFetching: f.isFetching,
|
|
2475
|
+
error: f.error,
|
|
2476
|
+
refetch: f.refetch
|
|
2271
2477
|
};
|
|
2272
|
-
},
|
|
2273
|
-
const t =
|
|
2478
|
+
}, zs = () => {
|
|
2479
|
+
const t = C.useContext(et);
|
|
2274
2480
|
if (!t)
|
|
2275
2481
|
throw new Error("useSettings must be used within a SettingsProvider");
|
|
2276
2482
|
return t;
|
|
2277
|
-
},
|
|
2278
|
-
const { pluginId: r } =
|
|
2483
|
+
}, Vs = ({ to: t, withinContext: e, ...n }) => {
|
|
2484
|
+
const { pluginId: r } = we();
|
|
2279
2485
|
r || console.error("Link used outside of a plugin context");
|
|
2280
2486
|
const s = `/_plugin/${r}${t.startsWith("/") ? "" : "/"}${t}`;
|
|
2281
|
-
return
|
|
2487
|
+
return C.useMemo(() => /* @__PURE__ */ R(_t, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
|
|
2282
2488
|
};
|
|
2283
|
-
function
|
|
2284
|
-
const t =
|
|
2489
|
+
function Ys() {
|
|
2490
|
+
const t = wt(), e = bt(), { pluginId: n } = we();
|
|
2285
2491
|
n || console.error("usePluginRouter used outside of a plugin context");
|
|
2286
|
-
const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i =
|
|
2492
|
+
const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = M((o, a) => {
|
|
2287
2493
|
const { ...c } = a ?? {};
|
|
2288
2494
|
o.startsWith("/") ? t(`${r}${o}`, c) : t(o, c);
|
|
2289
2495
|
}, [t, r]);
|
|
2290
|
-
return
|
|
2496
|
+
return Ct(() => ({
|
|
2291
2497
|
location: e,
|
|
2292
2498
|
navigate: i,
|
|
2293
2499
|
pluginPath: s
|
|
2294
2500
|
}), [e, i, s]);
|
|
2295
2501
|
}
|
|
2296
|
-
class
|
|
2502
|
+
class Js {
|
|
2297
2503
|
}
|
|
2298
|
-
class
|
|
2504
|
+
class Xs {
|
|
2299
2505
|
constructor() {
|
|
2300
|
-
|
|
2506
|
+
L(this, "_extensions");
|
|
2301
2507
|
/**
|
|
2302
2508
|
* The root component to render for the application window.
|
|
2303
2509
|
*/
|
|
2304
|
-
|
|
2510
|
+
L(this, "root");
|
|
2305
2511
|
/**
|
|
2306
2512
|
* Various pages to render under the root component. These can be navigated to using
|
|
2307
2513
|
* the built-in navigation system both programatically and through Links.
|
|
@@ -2331,8 +2537,8 @@ class js {
|
|
|
2331
2537
|
* ```
|
|
2332
2538
|
*
|
|
2333
2539
|
*/
|
|
2334
|
-
|
|
2335
|
-
|
|
2540
|
+
L(this, "pages");
|
|
2541
|
+
L(this, "_routes");
|
|
2336
2542
|
}
|
|
2337
2543
|
get extensions() {
|
|
2338
2544
|
return this._extensions || [];
|
|
@@ -2354,9 +2560,9 @@ class js {
|
|
|
2354
2560
|
*/
|
|
2355
2561
|
get Window() {
|
|
2356
2562
|
if (!this._routes && this.root)
|
|
2357
|
-
return /* @__PURE__ */
|
|
2358
|
-
const e =
|
|
2359
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ R(this.root, {});
|
|
2564
|
+
const e = Rt(this._routes || []);
|
|
2565
|
+
return /* @__PURE__ */ R(It, { router: e });
|
|
2360
2566
|
}
|
|
2361
2567
|
/**
|
|
2362
2568
|
* Register extension points for other plugins to extend the functionality
|
|
@@ -2388,91 +2594,91 @@ class js {
|
|
|
2388
2594
|
return this._routes = e, this;
|
|
2389
2595
|
}
|
|
2390
2596
|
}
|
|
2391
|
-
var
|
|
2392
|
-
const
|
|
2597
|
+
var Yr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Yr || {});
|
|
2598
|
+
const Zs = (t) => {
|
|
2393
2599
|
const e = t.split("::");
|
|
2394
2600
|
return e.length === 1 ? { group: "core", version: "", kind: e[0] } : {
|
|
2395
2601
|
group: e[0] || "core",
|
|
2396
2602
|
version: e[1] || "",
|
|
2397
2603
|
kind: e[2] || e[0]
|
|
2398
2604
|
};
|
|
2399
|
-
},
|
|
2605
|
+
}, eo = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
2400
2606
|
export {
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2607
|
+
J as ALL_SESSIONS_KEY,
|
|
2608
|
+
xn as BottomDrawerContext,
|
|
2609
|
+
Nn as ConfirmationModalContext,
|
|
2610
|
+
D as ErrorTypes,
|
|
2611
|
+
hs as ExtensionPointRegistry,
|
|
2612
|
+
$n as ExtensionPointStore,
|
|
2613
|
+
ps as ExtensionProvider,
|
|
2614
|
+
Vs as Link,
|
|
2615
|
+
tt as OperationsContext,
|
|
2616
|
+
ds as OperationsProvider,
|
|
2617
|
+
_e as PluginContext,
|
|
2618
|
+
cs as PluginContextProvider,
|
|
2619
|
+
Yr as PluginErrorCode,
|
|
2620
|
+
Xs as PluginWindow,
|
|
2621
|
+
Js as PluginWindowRootProps,
|
|
2622
|
+
Fn as RightDrawerContext,
|
|
2623
|
+
et as SettingsContext,
|
|
2624
|
+
ls as SettingsProvider,
|
|
2625
|
+
gs as SnackbarProvider,
|
|
2626
|
+
O as WatchState,
|
|
2627
|
+
Tn as actionToSnackbar,
|
|
2628
|
+
jr as applyBatch,
|
|
2629
|
+
Gn as connectionListQueryKey,
|
|
2630
|
+
U as createErrorHandler,
|
|
2631
|
+
Dn as defaultState,
|
|
2632
|
+
eo as formatGroup,
|
|
2633
|
+
Hr as graphChangedEvent,
|
|
2634
|
+
ae as isCancelledError,
|
|
2635
|
+
H as parseAppError,
|
|
2636
|
+
Zs as parseResourceKey,
|
|
2637
|
+
Qs as relationshipLabel,
|
|
2638
|
+
z as showAppError,
|
|
2639
|
+
Vr as toRelatedResources,
|
|
2640
|
+
Gs as useActiveSyncs,
|
|
2641
|
+
ct as useBottomDrawer,
|
|
2642
|
+
Ts as useConfirmationModal,
|
|
2643
|
+
ys as useConnection,
|
|
2644
|
+
Es as useConnectionNamespaces,
|
|
2645
|
+
Ss as useConnectionStatus,
|
|
2646
|
+
ms as useConnections,
|
|
2647
|
+
Hs as useDependencyTree,
|
|
2648
|
+
$s as useEditorSchemas,
|
|
2649
|
+
Qr as useEventBatcher,
|
|
2650
|
+
_s as useExec,
|
|
2651
|
+
qs as useExecuteAction,
|
|
2652
|
+
fs as useExtensionPoint,
|
|
2653
|
+
qn as useExtensionRegistry,
|
|
2654
|
+
ws as useLogs,
|
|
2655
|
+
bs as useMetricProviders,
|
|
2656
|
+
Qn as useMetricProvidersForResource,
|
|
2657
|
+
Is as useMetricStream,
|
|
2658
|
+
Kr as useOperations,
|
|
2659
|
+
we as usePluginContext,
|
|
2660
|
+
vs as usePluginData,
|
|
2661
|
+
Ys as usePluginRouter,
|
|
2662
|
+
us as usePluginSettings,
|
|
2663
|
+
Os as usePortForwardSessions,
|
|
2664
|
+
Te as useRefetchOnGraphChange,
|
|
2665
|
+
Ks as useRelatedResources,
|
|
2666
|
+
T as useResolvedPluginId,
|
|
2667
|
+
Ds as useResource,
|
|
2668
|
+
Us as useResourceActions,
|
|
2669
|
+
xs as useResourceAreaComponent,
|
|
2670
|
+
Bs as useResourceGraph,
|
|
2671
|
+
Fs as useResourceGroups,
|
|
2672
|
+
Rs as useResourceMetrics,
|
|
2673
|
+
Ms as useResourceMutations,
|
|
2674
|
+
As as useResourcePortForwarder,
|
|
2675
|
+
Ns as useResourceSearch,
|
|
2676
|
+
Ps as useResourceType,
|
|
2677
|
+
Ls as useResourceTypes,
|
|
2678
|
+
ks as useResources,
|
|
2679
|
+
Cs as useRightDrawer,
|
|
2680
|
+
zs as useSettings,
|
|
2681
|
+
Q as useSnackbar,
|
|
2682
|
+
js as useStreamAction,
|
|
2683
|
+
Ws as useWatchState
|
|
2478
2684
|
};
|