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