@dovetail-v2/refine 0.0.19 → 0.0.21-beta.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.
@@ -4,16 +4,16 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
+ import i18n from "i18next";
7
8
  import * as React from "react";
8
- import React__default, { useCallback, useContext, createContext, useState, useRef, useEffect, useMemo, forwardRef, useImperativeHandle, Suspense, useLayoutEffect, memo, PureComponent, createElement } from "react";
9
+ import React__default, { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle, Suspense, useLayoutEffect, memo, PureComponent, createElement } from "react";
9
10
  import { ResourceContext, matchResourceFromRoute, useResource, useForm as useForm$1, pickNotDeprecated, useWarnAboutChange, useDelete, useNavigation, useBreadcrumb, useList, useParsed, useGo, useDeleteMany, useUpdate, useShow, useMenu, useDataProvider, useTable, Refine } from "@refinedev/core";
10
11
  import { parse, stringify } from "qs";
11
12
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
12
13
  import { useUIKit, kitContext, Typo, Icon as Icon$1, popModal, pushModal, ModalStack, KitStoreProvider } from "@cloudtower/eagle";
13
14
  import yaml from "js-yaml";
14
- import { isObject, first, get, omit as omit$1, merge, keyBy } from "lodash-es";
15
+ import { isObject, first, get, omit as omit$1, flatten, merge, keyBy } from "lodash-es";
15
16
  import { useForm } from "sunflower-antd";
16
- import i18n from "i18next";
17
17
  import { HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, Retry16GradientBlueIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, EditPen16PrimaryIcon, TrashBinDelete16Icon, Download16GradientBlueIcon, MoreEllipsis316BoldBlueIcon, CheckmarkDoneSuccessCorrect16BoldGreenIcon, XmarkFailed16BoldRedIcon, DynamicResourceSchedule16BlueIcon, VmResume16Icon, SuspendedPause16GradientGrayIcon, Resume24Icon, SuspendedPause24GradientOrangeIcon } from "@cloudtower/icons-react";
18
18
  import * as monaco from "monaco-editor";
19
19
  import { setDiagnosticsOptions } from "monaco-yaml";
@@ -24,784 +24,26 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
24
24
  function getDefaultExportFromCjs(x) {
25
25
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
26
26
  }
27
- var jsxRuntime = { exports: {} };
28
- var reactJsxRuntime_production_min = {};
29
- /** @license React v16.14.0
30
- * react-jsx-runtime.production.min.js
31
- *
32
- * Copyright (c) Facebook, Inc. and its affiliates.
33
- *
34
- * This source code is licensed under the MIT license found in the
35
- * LICENSE file in the root directory of this source tree.
36
- */
37
- var hasRequiredReactJsxRuntime_production_min;
38
- function requireReactJsxRuntime_production_min() {
39
- if (hasRequiredReactJsxRuntime_production_min)
40
- return reactJsxRuntime_production_min;
41
- hasRequiredReactJsxRuntime_production_min = 1;
42
- var f = React__default, g = 60103;
43
- reactJsxRuntime_production_min.Fragment = 60107;
44
- if ("function" === typeof Symbol && Symbol.for) {
45
- var h = Symbol.for;
46
- g = h("react.element");
47
- reactJsxRuntime_production_min.Fragment = h("react.fragment");
27
+ function warn() {
28
+ if (console && console.warn) {
29
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
+ args[_key] = arguments[_key];
31
+ }
32
+ if (typeof args[0] === "string")
33
+ args[0] = `react-i18next:: ${args[0]}`;
34
+ console.warn(...args);
48
35
  }
49
- var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
50
- function q(c, a, k) {
51
- var b, d = {}, e = null, l = null;
52
- void 0 !== k && (e = "" + k);
53
- void 0 !== a.key && (e = "" + a.key);
54
- void 0 !== a.ref && (l = a.ref);
55
- for (b in a)
56
- n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
57
- if (c && c.defaultProps)
58
- for (b in a = c.defaultProps, a)
59
- void 0 === d[b] && (d[b] = a[b]);
60
- return { $$typeof: g, type: c, key: e, ref: l, props: d, _owner: m.current };
36
+ }
37
+ const alreadyWarned = {};
38
+ function warnOnce() {
39
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
40
+ args[_key2] = arguments[_key2];
61
41
  }
62
- reactJsxRuntime_production_min.jsx = q;
63
- reactJsxRuntime_production_min.jsxs = q;
64
- return reactJsxRuntime_production_min;
65
- }
66
- var reactJsxRuntime_development = {};
67
- /** @license React v16.14.0
68
- * react-jsx-runtime.development.js
69
- *
70
- * Copyright (c) Facebook, Inc. and its affiliates.
71
- *
72
- * This source code is licensed under the MIT license found in the
73
- * LICENSE file in the root directory of this source tree.
74
- */
75
- var hasRequiredReactJsxRuntime_development;
76
- function requireReactJsxRuntime_development() {
77
- if (hasRequiredReactJsxRuntime_development)
78
- return reactJsxRuntime_development;
79
- hasRequiredReactJsxRuntime_development = 1;
80
- (function(exports) {
81
- if (process.env.NODE_ENV !== "production") {
82
- (function() {
83
- var React2 = React__default;
84
- var REACT_ELEMENT_TYPE = 60103;
85
- var REACT_PORTAL_TYPE = 60106;
86
- exports.Fragment = 60107;
87
- var REACT_STRICT_MODE_TYPE = 60108;
88
- var REACT_PROFILER_TYPE = 60114;
89
- var REACT_PROVIDER_TYPE = 60109;
90
- var REACT_CONTEXT_TYPE = 60110;
91
- var REACT_FORWARD_REF_TYPE = 60112;
92
- var REACT_SUSPENSE_TYPE = 60113;
93
- var REACT_SUSPENSE_LIST_TYPE = 60120;
94
- var REACT_MEMO_TYPE = 60115;
95
- var REACT_LAZY_TYPE = 60116;
96
- var REACT_BLOCK_TYPE = 60121;
97
- var REACT_SERVER_BLOCK_TYPE = 60122;
98
- var REACT_FUNDAMENTAL_TYPE = 60117;
99
- var REACT_DEBUG_TRACING_MODE_TYPE = 60129;
100
- var REACT_LEGACY_HIDDEN_TYPE = 60131;
101
- if (typeof Symbol === "function" && Symbol.for) {
102
- var symbolFor = Symbol.for;
103
- REACT_ELEMENT_TYPE = symbolFor("react.element");
104
- REACT_PORTAL_TYPE = symbolFor("react.portal");
105
- exports.Fragment = symbolFor("react.fragment");
106
- REACT_STRICT_MODE_TYPE = symbolFor("react.strict_mode");
107
- REACT_PROFILER_TYPE = symbolFor("react.profiler");
108
- REACT_PROVIDER_TYPE = symbolFor("react.provider");
109
- REACT_CONTEXT_TYPE = symbolFor("react.context");
110
- REACT_FORWARD_REF_TYPE = symbolFor("react.forward_ref");
111
- REACT_SUSPENSE_TYPE = symbolFor("react.suspense");
112
- REACT_SUSPENSE_LIST_TYPE = symbolFor("react.suspense_list");
113
- REACT_MEMO_TYPE = symbolFor("react.memo");
114
- REACT_LAZY_TYPE = symbolFor("react.lazy");
115
- REACT_BLOCK_TYPE = symbolFor("react.block");
116
- REACT_SERVER_BLOCK_TYPE = symbolFor("react.server.block");
117
- REACT_FUNDAMENTAL_TYPE = symbolFor("react.fundamental");
118
- symbolFor("react.scope");
119
- symbolFor("react.opaque.id");
120
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode");
121
- symbolFor("react.offscreen");
122
- REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden");
123
- }
124
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
125
- var FAUX_ITERATOR_SYMBOL = "@@iterator";
126
- function getIteratorFn(maybeIterable) {
127
- if (maybeIterable === null || typeof maybeIterable !== "object") {
128
- return null;
129
- }
130
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
131
- if (typeof maybeIterator === "function") {
132
- return maybeIterator;
133
- }
134
- return null;
135
- }
136
- var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
137
- function error(format) {
138
- {
139
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
140
- args[_key2 - 1] = arguments[_key2];
141
- }
142
- printWarning("error", format, args);
143
- }
144
- }
145
- function printWarning(level, format, args) {
146
- {
147
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
148
- var stack = "";
149
- if (currentlyValidatingElement) {
150
- var name2 = getComponentName(currentlyValidatingElement.type);
151
- var owner = currentlyValidatingElement._owner;
152
- stack += describeComponentFrame(name2, currentlyValidatingElement._source, owner && getComponentName(owner.type));
153
- }
154
- stack += ReactDebugCurrentFrame.getStackAddendum();
155
- if (stack !== "") {
156
- format += "%s";
157
- args = args.concat([stack]);
158
- }
159
- var argsWithFormat = args.map(function(item) {
160
- return "" + item;
161
- });
162
- argsWithFormat.unshift("Warning: " + format);
163
- Function.prototype.apply.call(console[level], console, argsWithFormat);
164
- }
165
- }
166
- var enableScopeAPI = false;
167
- function isValidElementType(type2) {
168
- if (typeof type2 === "string" || typeof type2 === "function") {
169
- return true;
170
- }
171
- if (type2 === exports.Fragment || type2 === REACT_PROFILER_TYPE || type2 === REACT_DEBUG_TRACING_MODE_TYPE || type2 === REACT_STRICT_MODE_TYPE || type2 === REACT_SUSPENSE_TYPE || type2 === REACT_SUSPENSE_LIST_TYPE || type2 === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI) {
172
- return true;
173
- }
174
- if (typeof type2 === "object" && type2 !== null) {
175
- if (type2.$$typeof === REACT_LAZY_TYPE || type2.$$typeof === REACT_MEMO_TYPE || type2.$$typeof === REACT_PROVIDER_TYPE || type2.$$typeof === REACT_CONTEXT_TYPE || type2.$$typeof === REACT_FORWARD_REF_TYPE || type2.$$typeof === REACT_FUNDAMENTAL_TYPE || type2.$$typeof === REACT_BLOCK_TYPE || type2[0] === REACT_SERVER_BLOCK_TYPE) {
176
- return true;
177
- }
178
- }
179
- return false;
180
- }
181
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
182
- function describeComponentFrame(name2, source, ownerName) {
183
- var sourceInfo = "";
184
- if (source) {
185
- var path = source.fileName;
186
- var fileName = path.replace(BEFORE_SLASH_RE, "");
187
- {
188
- if (/^index\./.test(fileName)) {
189
- var match = path.match(BEFORE_SLASH_RE);
190
- if (match) {
191
- var pathBeforeSlash = match[1];
192
- if (pathBeforeSlash) {
193
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, "");
194
- fileName = folderName + "/" + fileName;
195
- }
196
- }
197
- }
198
- }
199
- sourceInfo = " (at " + fileName + ":" + source.lineNumber + ")";
200
- } else if (ownerName) {
201
- sourceInfo = " (created by " + ownerName + ")";
202
- }
203
- return "\n in " + (name2 || "Unknown") + sourceInfo;
204
- }
205
- var Resolved = 1;
206
- function refineResolvedLazyComponent(lazyComponent) {
207
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
208
- }
209
- function getWrappedName(outerType, innerType, wrapperName) {
210
- var functionName = innerType.displayName || innerType.name || "";
211
- return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
212
- }
213
- function getComponentName(type2) {
214
- if (type2 == null) {
215
- return null;
216
- }
217
- {
218
- if (typeof type2.tag === "number") {
219
- error("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue.");
220
- }
221
- }
222
- if (typeof type2 === "function") {
223
- return type2.displayName || type2.name || null;
224
- }
225
- if (typeof type2 === "string") {
226
- return type2;
227
- }
228
- switch (type2) {
229
- case exports.Fragment:
230
- return "Fragment";
231
- case REACT_PORTAL_TYPE:
232
- return "Portal";
233
- case REACT_PROFILER_TYPE:
234
- return "Profiler";
235
- case REACT_STRICT_MODE_TYPE:
236
- return "StrictMode";
237
- case REACT_SUSPENSE_TYPE:
238
- return "Suspense";
239
- case REACT_SUSPENSE_LIST_TYPE:
240
- return "SuspenseList";
241
- }
242
- if (typeof type2 === "object") {
243
- switch (type2.$$typeof) {
244
- case REACT_CONTEXT_TYPE:
245
- return "Context.Consumer";
246
- case REACT_PROVIDER_TYPE:
247
- return "Context.Provider";
248
- case REACT_FORWARD_REF_TYPE:
249
- return getWrappedName(type2, type2.render, "ForwardRef");
250
- case REACT_MEMO_TYPE:
251
- return getComponentName(type2.type);
252
- case REACT_BLOCK_TYPE:
253
- return getComponentName(type2.render);
254
- case REACT_LAZY_TYPE: {
255
- var thenable = type2;
256
- var resolvedThenable = refineResolvedLazyComponent(thenable);
257
- if (resolvedThenable) {
258
- return getComponentName(resolvedThenable);
259
- }
260
- break;
261
- }
262
- }
263
- }
264
- return null;
265
- }
266
- var loggedTypeFailures = {};
267
- ReactSharedInternals.ReactDebugCurrentFrame;
268
- var currentlyValidatingElement = null;
269
- function setCurrentlyValidatingElement(element) {
270
- {
271
- currentlyValidatingElement = element;
272
- }
273
- }
274
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
275
- {
276
- var has2 = Function.call.bind(Object.prototype.hasOwnProperty);
277
- for (var typeSpecName in typeSpecs) {
278
- if (has2(typeSpecs, typeSpecName)) {
279
- var error$1 = void 0;
280
- try {
281
- if (typeof typeSpecs[typeSpecName] !== "function") {
282
- var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
283
- err.name = "Invariant Violation";
284
- throw err;
285
- }
286
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
287
- } catch (ex) {
288
- error$1 = ex;
289
- }
290
- if (error$1 && !(error$1 instanceof Error)) {
291
- setCurrentlyValidatingElement(element);
292
- error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
293
- setCurrentlyValidatingElement(null);
294
- }
295
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
296
- loggedTypeFailures[error$1.message] = true;
297
- setCurrentlyValidatingElement(element);
298
- error("Failed %s type: %s", location, error$1.message);
299
- setCurrentlyValidatingElement(null);
300
- }
301
- }
302
- }
303
- }
304
- }
305
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
306
- var hasOwnProperty = Object.prototype.hasOwnProperty;
307
- var RESERVED_PROPS = {
308
- key: true,
309
- ref: true,
310
- __self: true,
311
- __source: true
312
- };
313
- var specialPropKeyWarningShown;
314
- var specialPropRefWarningShown;
315
- var didWarnAboutStringRefs;
316
- {
317
- didWarnAboutStringRefs = {};
318
- }
319
- function hasValidRef(config) {
320
- {
321
- if (hasOwnProperty.call(config, "ref")) {
322
- var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
323
- if (getter && getter.isReactWarning) {
324
- return false;
325
- }
326
- }
327
- }
328
- return config.ref !== void 0;
329
- }
330
- function hasValidKey(config) {
331
- {
332
- if (hasOwnProperty.call(config, "key")) {
333
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
334
- if (getter && getter.isReactWarning) {
335
- return false;
336
- }
337
- }
338
- }
339
- return config.key !== void 0;
340
- }
341
- function warnIfStringRefCannotBeAutoConverted(config, self2) {
342
- {
343
- if (typeof config.ref === "string" && ReactCurrentOwner.current && self2 && ReactCurrentOwner.current.stateNode !== self2) {
344
- var componentName = getComponentName(ReactCurrentOwner.current.type);
345
- if (!didWarnAboutStringRefs[componentName]) {
346
- error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
347
- didWarnAboutStringRefs[componentName] = true;
348
- }
349
- }
350
- }
351
- }
352
- function defineKeyPropWarningGetter(props, displayName) {
353
- {
354
- var warnAboutAccessingKey = function() {
355
- if (!specialPropKeyWarningShown) {
356
- specialPropKeyWarningShown = true;
357
- error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
358
- }
359
- };
360
- warnAboutAccessingKey.isReactWarning = true;
361
- Object.defineProperty(props, "key", {
362
- get: warnAboutAccessingKey,
363
- configurable: true
364
- });
365
- }
366
- }
367
- function defineRefPropWarningGetter(props, displayName) {
368
- {
369
- var warnAboutAccessingRef = function() {
370
- if (!specialPropRefWarningShown) {
371
- specialPropRefWarningShown = true;
372
- error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
373
- }
374
- };
375
- warnAboutAccessingRef.isReactWarning = true;
376
- Object.defineProperty(props, "ref", {
377
- get: warnAboutAccessingRef,
378
- configurable: true
379
- });
380
- }
381
- }
382
- var ReactElement = function(type2, key, ref, self2, source, owner, props) {
383
- var element = {
384
- // This tag allows us to uniquely identify this as a React Element
385
- $$typeof: REACT_ELEMENT_TYPE,
386
- // Built-in properties that belong on the element
387
- type: type2,
388
- key,
389
- ref,
390
- props,
391
- // Record the component responsible for creating this element.
392
- _owner: owner
393
- };
394
- {
395
- element._store = {};
396
- Object.defineProperty(element._store, "validated", {
397
- configurable: false,
398
- enumerable: false,
399
- writable: true,
400
- value: false
401
- });
402
- Object.defineProperty(element, "_self", {
403
- configurable: false,
404
- enumerable: false,
405
- writable: false,
406
- value: self2
407
- });
408
- Object.defineProperty(element, "_source", {
409
- configurable: false,
410
- enumerable: false,
411
- writable: false,
412
- value: source
413
- });
414
- if (Object.freeze) {
415
- Object.freeze(element.props);
416
- Object.freeze(element);
417
- }
418
- }
419
- return element;
420
- };
421
- function jsxDEV(type2, config, maybeKey, source, self2) {
422
- {
423
- var propName;
424
- var props = {};
425
- var key = null;
426
- var ref = null;
427
- if (maybeKey !== void 0) {
428
- key = "" + maybeKey;
429
- }
430
- if (hasValidKey(config)) {
431
- key = "" + config.key;
432
- }
433
- if (hasValidRef(config)) {
434
- ref = config.ref;
435
- warnIfStringRefCannotBeAutoConverted(config, self2);
436
- }
437
- for (propName in config) {
438
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
439
- props[propName] = config[propName];
440
- }
441
- }
442
- if (type2 && type2.defaultProps) {
443
- var defaultProps = type2.defaultProps;
444
- for (propName in defaultProps) {
445
- if (props[propName] === void 0) {
446
- props[propName] = defaultProps[propName];
447
- }
448
- }
449
- }
450
- if (key || ref) {
451
- var displayName = typeof type2 === "function" ? type2.displayName || type2.name || "Unknown" : type2;
452
- if (key) {
453
- defineKeyPropWarningGetter(props, displayName);
454
- }
455
- if (ref) {
456
- defineRefPropWarningGetter(props, displayName);
457
- }
458
- }
459
- return ReactElement(type2, key, ref, self2, source, ReactCurrentOwner.current, props);
460
- }
461
- }
462
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
463
- ReactSharedInternals.ReactDebugCurrentFrame;
464
- function setCurrentlyValidatingElement$1(element) {
465
- currentlyValidatingElement = element;
466
- }
467
- var propTypesMisspellWarningShown;
468
- {
469
- propTypesMisspellWarningShown = false;
470
- }
471
- function isValidElement(object2) {
472
- {
473
- return typeof object2 === "object" && object2 !== null && object2.$$typeof === REACT_ELEMENT_TYPE;
474
- }
475
- }
476
- function getDeclarationErrorAddendum() {
477
- {
478
- if (ReactCurrentOwner$1.current) {
479
- var name2 = getComponentName(ReactCurrentOwner$1.current.type);
480
- if (name2) {
481
- return "\n\nCheck the render method of `" + name2 + "`.";
482
- }
483
- }
484
- return "";
485
- }
486
- }
487
- function getSourceInfoErrorAddendum(source) {
488
- {
489
- if (source !== void 0) {
490
- var fileName = source.fileName.replace(/^.*[\\\/]/, "");
491
- var lineNumber = source.lineNumber;
492
- return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
493
- }
494
- return "";
495
- }
496
- }
497
- var ownerHasKeyUseWarning = {};
498
- function getCurrentComponentErrorInfo(parentType) {
499
- {
500
- var info = getDeclarationErrorAddendum();
501
- if (!info) {
502
- var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
503
- if (parentName) {
504
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
505
- }
506
- }
507
- return info;
508
- }
509
- }
510
- function validateExplicitKey(element, parentType) {
511
- {
512
- if (!element._store || element._store.validated || element.key != null) {
513
- return;
514
- }
515
- element._store.validated = true;
516
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
517
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
518
- return;
519
- }
520
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
521
- var childOwner = "";
522
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
523
- childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
524
- }
525
- setCurrentlyValidatingElement$1(element);
526
- error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
527
- setCurrentlyValidatingElement$1(null);
528
- }
529
- }
530
- function validateChildKeys(node, parentType) {
531
- {
532
- if (typeof node !== "object") {
533
- return;
534
- }
535
- if (Array.isArray(node)) {
536
- for (var i = 0; i < node.length; i++) {
537
- var child = node[i];
538
- if (isValidElement(child)) {
539
- validateExplicitKey(child, parentType);
540
- }
541
- }
542
- } else if (isValidElement(node)) {
543
- if (node._store) {
544
- node._store.validated = true;
545
- }
546
- } else if (node) {
547
- var iteratorFn = getIteratorFn(node);
548
- if (typeof iteratorFn === "function") {
549
- if (iteratorFn !== node.entries) {
550
- var iterator = iteratorFn.call(node);
551
- var step;
552
- while (!(step = iterator.next()).done) {
553
- if (isValidElement(step.value)) {
554
- validateExplicitKey(step.value, parentType);
555
- }
556
- }
557
- }
558
- }
559
- }
560
- }
561
- }
562
- function validatePropTypes(element) {
563
- {
564
- var type2 = element.type;
565
- if (type2 === null || type2 === void 0 || typeof type2 === "string") {
566
- return;
567
- }
568
- var propTypes;
569
- if (typeof type2 === "function") {
570
- propTypes = type2.propTypes;
571
- } else if (typeof type2 === "object" && (type2.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
572
- // Inner props are checked in the reconciler.
573
- type2.$$typeof === REACT_MEMO_TYPE)) {
574
- propTypes = type2.propTypes;
575
- } else {
576
- return;
577
- }
578
- if (propTypes) {
579
- var name2 = getComponentName(type2);
580
- checkPropTypes(propTypes, element.props, "prop", name2, element);
581
- } else if (type2.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
582
- propTypesMisspellWarningShown = true;
583
- var _name = getComponentName(type2);
584
- error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
585
- }
586
- if (typeof type2.getDefaultProps === "function" && !type2.getDefaultProps.isReactClassApproved) {
587
- error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
588
- }
589
- }
590
- }
591
- function validateFragmentProps(fragment) {
592
- {
593
- var keys = Object.keys(fragment.props);
594
- for (var i = 0; i < keys.length; i++) {
595
- var key = keys[i];
596
- if (key !== "children" && key !== "key") {
597
- setCurrentlyValidatingElement$1(fragment);
598
- error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
599
- setCurrentlyValidatingElement$1(null);
600
- break;
601
- }
602
- }
603
- if (fragment.ref !== null) {
604
- setCurrentlyValidatingElement$1(fragment);
605
- error("Invalid attribute `ref` supplied to `React.Fragment`.");
606
- setCurrentlyValidatingElement$1(null);
607
- }
608
- }
609
- }
610
- function jsxWithValidation(type2, props, key, isStaticChildren, source, self2) {
611
- {
612
- var validType = isValidElementType(type2);
613
- if (!validType) {
614
- var info = "";
615
- if (type2 === void 0 || typeof type2 === "object" && type2 !== null && Object.keys(type2).length === 0) {
616
- info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
617
- }
618
- var sourceInfo = getSourceInfoErrorAddendum(source);
619
- if (sourceInfo) {
620
- info += sourceInfo;
621
- } else {
622
- info += getDeclarationErrorAddendum();
623
- }
624
- var typeString;
625
- if (type2 === null) {
626
- typeString = "null";
627
- } else if (Array.isArray(type2)) {
628
- typeString = "array";
629
- } else if (type2 !== void 0 && type2.$$typeof === REACT_ELEMENT_TYPE) {
630
- typeString = "<" + (getComponentName(type2.type) || "Unknown") + " />";
631
- info = " Did you accidentally export a JSX literal instead of a component?";
632
- } else {
633
- typeString = typeof type2;
634
- }
635
- error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
636
- }
637
- var element = jsxDEV(type2, props, key, source, self2);
638
- if (element == null) {
639
- return element;
640
- }
641
- if (validType) {
642
- var children = props.children;
643
- if (children !== void 0) {
644
- if (isStaticChildren) {
645
- if (Array.isArray(children)) {
646
- for (var i = 0; i < children.length; i++) {
647
- validateChildKeys(children[i], type2);
648
- }
649
- if (Object.freeze) {
650
- Object.freeze(children);
651
- }
652
- } else {
653
- error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
654
- }
655
- } else {
656
- validateChildKeys(children, type2);
657
- }
658
- }
659
- }
660
- if (type2 === exports.Fragment) {
661
- validateFragmentProps(element);
662
- } else {
663
- validatePropTypes(element);
664
- }
665
- return element;
666
- }
667
- }
668
- function jsxWithValidationStatic(type2, props, key) {
669
- {
670
- return jsxWithValidation(type2, props, key, true);
671
- }
672
- }
673
- function jsxWithValidationDynamic(type2, props, key) {
674
- {
675
- return jsxWithValidation(type2, props, key, false);
676
- }
677
- }
678
- var jsx = jsxWithValidationDynamic;
679
- var jsxs = jsxWithValidationStatic;
680
- exports.jsx = jsx;
681
- exports.jsxs = jsxs;
682
- })();
683
- }
684
- })(reactJsxRuntime_development);
685
- return reactJsxRuntime_development;
686
- }
687
- if (process.env.NODE_ENV === "production") {
688
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
689
- } else {
690
- jsxRuntime.exports = requireReactJsxRuntime_development();
691
- }
692
- var jsxRuntimeExports = jsxRuntime.exports;
693
- const stringifyConfig = {
694
- addQueryPrefix: true,
695
- skipNulls: true,
696
- arrayFormat: "indices",
697
- encode: false,
698
- encodeValuesOnly: true
699
- };
700
- const convertToNumberIfPossible = (value) => {
701
- if (typeof value === "undefined") {
702
- return value;
703
- }
704
- const num = Number(value);
705
- if (`${num}` === value) {
706
- return num;
707
- }
708
- return value;
709
- };
710
- const routerProvider = {
711
- go: () => {
712
- const { search: existingSearch, hash: existingHash } = useLocation();
713
- const history = useHistory();
714
- const fn = useCallback(
715
- ({ to, type: type2, query, hash, options: { keepQuery, keepHash } = {} }) => {
716
- const urlQuery = {
717
- ...keepQuery && existingSearch && parse(existingSearch, { ignoreQueryPrefix: true }),
718
- ...query
719
- };
720
- if (urlQuery.to) {
721
- urlQuery.to = encodeURIComponent(`${urlQuery.to}`);
722
- }
723
- const hasUrlQuery = Object.keys(urlQuery).length > 0;
724
- const urlHash = `#${(hash || keepHash && existingHash || "").replace(
725
- /^#/,
726
- ""
727
- )}`;
728
- const hasUrlHash = urlHash.length > 1;
729
- const urlTo = to || "";
730
- const fullPath = `${urlTo}${hasUrlQuery ? stringify(urlQuery, stringifyConfig) : ""}${hasUrlHash ? urlHash : ""}`;
731
- if (type2 === "path") {
732
- return fullPath;
733
- }
734
- return history[type2 || "push"](fullPath);
735
- },
736
- [existingHash, existingSearch, history]
737
- );
738
- return fn;
739
- },
740
- back: () => {
741
- const history = useHistory();
742
- const fn = useCallback(() => {
743
- history.go(-1);
744
- }, [history]);
745
- return fn;
746
- },
747
- parse: () => {
748
- var _a;
749
- let params = useParams();
750
- const { pathname, search } = useLocation();
751
- const { resources: resources2 } = useContext(ResourceContext);
752
- const { resource, action, matchedRoute } = React__default.useMemo(() => {
753
- return matchResourceFromRoute(pathname, resources2);
754
- }, [resources2, pathname]);
755
- if (Object.entries(params).length === 0 && matchedRoute) {
756
- params = ((_a = matchPath(matchedRoute, pathname)) == null ? void 0 : _a.params) || {};
757
- }
758
- const fn = useCallback(() => {
759
- const parsedSearch = parse(search, { ignoreQueryPrefix: true });
760
- const combinedParams = {
761
- ...params,
762
- ...parsedSearch
763
- };
764
- const response = {
765
- ...resource && { resource },
766
- ...action && { action },
767
- ...(parsedSearch == null ? void 0 : parsedSearch.id) && { id: decodeURIComponent(parsedSearch.id) },
768
- // ...(params?.action && { action: params.action }), // lets see if there is a need for this
769
- pathname,
770
- params: {
771
- ...combinedParams,
772
- current: convertToNumberIfPossible(combinedParams.current),
773
- pageSize: convertToNumberIfPossible(combinedParams.pageSize),
774
- to: combinedParams.to ? decodeURIComponent(combinedParams.to) : void 0
775
- }
776
- };
777
- return response;
778
- }, [pathname, search, params, resource, action]);
779
- return fn;
780
- },
781
- Link: React__default.forwardRef(function RefineLink(props, ref) {
782
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ...props, ref });
783
- })
784
- };
785
- function warn() {
786
- if (console && console.warn) {
787
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
788
- args[_key] = arguments[_key];
789
- }
790
- if (typeof args[0] === "string")
791
- args[0] = `react-i18next:: ${args[0]}`;
792
- console.warn(...args);
793
- }
794
- }
795
- const alreadyWarned = {};
796
- function warnOnce() {
797
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
798
- args[_key2] = arguments[_key2];
799
- }
800
- if (typeof args[0] === "string" && alreadyWarned[args[0]])
801
- return;
802
- if (typeof args[0] === "string")
803
- alreadyWarned[args[0]] = /* @__PURE__ */ new Date();
804
- warn(...args);
42
+ if (typeof args[0] === "string" && alreadyWarned[args[0]])
43
+ return;
44
+ if (typeof args[0] === "string")
45
+ alreadyWarned[args[0]] = /* @__PURE__ */ new Date();
46
+ warn(...args);
805
47
  }
806
48
  const loadedClb = (i18n2, cb) => () => {
807
49
  if (i18n2.isInitialized) {
@@ -867,200 +109,1188 @@ function hasLoadedNamespace(ns, i18n2) {
867
109
  }
868
110
  });
869
111
  }
870
- const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
871
- const htmlEntities = {
872
- "&amp;": "&",
873
- "&#38;": "&",
874
- "&lt;": "<",
875
- "&#60;": "<",
876
- "&gt;": ">",
877
- "&#62;": ">",
878
- "&apos;": "'",
879
- "&#39;": "'",
880
- "&quot;": '"',
881
- "&#34;": '"',
882
- "&nbsp;": " ",
883
- "&#160;": " ",
884
- "&copy;": "©",
885
- "&#169;": "©",
886
- "&reg;": "®",
887
- "&#174;": "®",
888
- "&hellip;": "…",
889
- "&#8230;": "…",
890
- "&#x2F;": "/",
891
- "&#47;": "/"
112
+ const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
113
+ const htmlEntities = {
114
+ "&amp;": "&",
115
+ "&#38;": "&",
116
+ "&lt;": "<",
117
+ "&#60;": "<",
118
+ "&gt;": ">",
119
+ "&#62;": ">",
120
+ "&apos;": "'",
121
+ "&#39;": "'",
122
+ "&quot;": '"',
123
+ "&#34;": '"',
124
+ "&nbsp;": " ",
125
+ "&#160;": " ",
126
+ "&copy;": "©",
127
+ "&#169;": "©",
128
+ "&reg;": "®",
129
+ "&#174;": "®",
130
+ "&hellip;": "…",
131
+ "&#8230;": "…",
132
+ "&#x2F;": "/",
133
+ "&#47;": "/"
134
+ };
135
+ const unescapeHtmlEntity = (m) => htmlEntities[m];
136
+ const unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
137
+ let defaultOptions = {
138
+ bindI18n: "languageChanged",
139
+ bindI18nStore: "",
140
+ transEmptyNodeValue: "",
141
+ transSupportBasicHtmlNodes: true,
142
+ transWrapTextNodes: "",
143
+ transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
144
+ useSuspense: true,
145
+ unescape
146
+ };
147
+ function setDefaults() {
148
+ let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
149
+ defaultOptions = {
150
+ ...defaultOptions,
151
+ ...options
152
+ };
153
+ }
154
+ function getDefaults() {
155
+ return defaultOptions;
156
+ }
157
+ let i18nInstance;
158
+ function setI18n(instance) {
159
+ i18nInstance = instance;
160
+ }
161
+ function getI18n() {
162
+ return i18nInstance;
163
+ }
164
+ const initReactI18next = {
165
+ type: "3rdParty",
166
+ init(instance) {
167
+ setDefaults(instance.options.react);
168
+ setI18n(instance);
169
+ }
170
+ };
171
+ const I18nContext = createContext();
172
+ class ReportNamespaces {
173
+ constructor() {
174
+ this.usedNamespaces = {};
175
+ }
176
+ addUsedNamespaces(namespaces) {
177
+ namespaces.forEach((ns) => {
178
+ if (!this.usedNamespaces[ns])
179
+ this.usedNamespaces[ns] = true;
180
+ });
181
+ }
182
+ getUsedNamespaces() {
183
+ return Object.keys(this.usedNamespaces);
184
+ }
185
+ }
186
+ const usePrevious = (value, ignore) => {
187
+ const ref = useRef();
188
+ useEffect(() => {
189
+ ref.current = ignore ? ref.current : value;
190
+ }, [value, ignore]);
191
+ return ref.current;
192
+ };
193
+ function useTranslation(ns) {
194
+ let props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
195
+ const {
196
+ i18n: i18nFromProps
197
+ } = props;
198
+ const {
199
+ i18n: i18nFromContext,
200
+ defaultNS: defaultNSFromContext
201
+ } = useContext(I18nContext) || {};
202
+ const i18n2 = i18nFromProps || i18nFromContext || getI18n();
203
+ if (i18n2 && !i18n2.reportNamespaces)
204
+ i18n2.reportNamespaces = new ReportNamespaces();
205
+ if (!i18n2) {
206
+ warnOnce("You will need to pass in an i18next instance by using initReactI18next");
207
+ const notReadyT = (k, optsOrDefaultValue) => {
208
+ if (typeof optsOrDefaultValue === "string")
209
+ return optsOrDefaultValue;
210
+ if (optsOrDefaultValue && typeof optsOrDefaultValue === "object" && typeof optsOrDefaultValue.defaultValue === "string")
211
+ return optsOrDefaultValue.defaultValue;
212
+ return Array.isArray(k) ? k[k.length - 1] : k;
213
+ };
214
+ const retNotReady = [notReadyT, {}, false];
215
+ retNotReady.t = notReadyT;
216
+ retNotReady.i18n = {};
217
+ retNotReady.ready = false;
218
+ return retNotReady;
219
+ }
220
+ if (i18n2.options.react && i18n2.options.react.wait !== void 0)
221
+ warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
222
+ const i18nOptions = {
223
+ ...getDefaults(),
224
+ ...i18n2.options.react,
225
+ ...props
226
+ };
227
+ const {
228
+ useSuspense,
229
+ keyPrefix
230
+ } = i18nOptions;
231
+ let namespaces = ns || defaultNSFromContext || i18n2.options && i18n2.options.defaultNS;
232
+ namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
233
+ if (i18n2.reportNamespaces.addUsedNamespaces)
234
+ i18n2.reportNamespaces.addUsedNamespaces(namespaces);
235
+ const ready2 = (i18n2.isInitialized || i18n2.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n2, i18nOptions));
236
+ function getT() {
237
+ return i18n2.getFixedT(props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
238
+ }
239
+ const [t, setT] = useState(getT);
240
+ let joinedNS = namespaces.join();
241
+ if (props.lng)
242
+ joinedNS = `${props.lng}${joinedNS}`;
243
+ const previousJoinedNS = usePrevious(joinedNS);
244
+ const isMounted = useRef(true);
245
+ useEffect(() => {
246
+ const {
247
+ bindI18n,
248
+ bindI18nStore
249
+ } = i18nOptions;
250
+ isMounted.current = true;
251
+ if (!ready2 && !useSuspense) {
252
+ if (props.lng) {
253
+ loadLanguages(i18n2, props.lng, namespaces, () => {
254
+ if (isMounted.current)
255
+ setT(getT);
256
+ });
257
+ } else {
258
+ loadNamespaces(i18n2, namespaces, () => {
259
+ if (isMounted.current)
260
+ setT(getT);
261
+ });
262
+ }
263
+ }
264
+ if (ready2 && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
265
+ setT(getT);
266
+ }
267
+ function boundReset() {
268
+ if (isMounted.current)
269
+ setT(getT);
270
+ }
271
+ if (bindI18n && i18n2)
272
+ i18n2.on(bindI18n, boundReset);
273
+ if (bindI18nStore && i18n2)
274
+ i18n2.store.on(bindI18nStore, boundReset);
275
+ return () => {
276
+ isMounted.current = false;
277
+ if (bindI18n && i18n2)
278
+ bindI18n.split(" ").forEach((e) => i18n2.off(e, boundReset));
279
+ if (bindI18nStore && i18n2)
280
+ bindI18nStore.split(" ").forEach((e) => i18n2.store.off(e, boundReset));
281
+ };
282
+ }, [i18n2, joinedNS]);
283
+ const isInitial = useRef(true);
284
+ useEffect(() => {
285
+ if (isMounted.current && !isInitial.current) {
286
+ setT(getT);
287
+ }
288
+ isInitial.current = false;
289
+ }, [i18n2, keyPrefix]);
290
+ const ret = [t, i18n2, ready2];
291
+ ret.t = t;
292
+ ret.i18n = i18n2;
293
+ ret.ready = ready2;
294
+ if (ready2)
295
+ return ret;
296
+ if (!ready2 && !useSuspense)
297
+ return ret;
298
+ throw new Promise((resolve) => {
299
+ if (props.lng) {
300
+ loadLanguages(i18n2, props.lng, namespaces, () => resolve());
301
+ } else {
302
+ loadNamespaces(i18n2, namespaces, () => resolve());
303
+ }
304
+ });
305
+ }
306
+ const copy$1 = "Copy";
307
+ const reset_arguments$1 = "Reset";
308
+ const view_changes$1 = "Show Diff";
309
+ const back_to_edit$1 = "Edit";
310
+ const configure_file$1 = "Configuration";
311
+ const yaml_format_wrong$1 = "Configuration is in an invalid YAML format.";
312
+ const yaml_value_wrong$1 = "Configuration has invalid values.";
313
+ const edit_yaml$1 = "Edit YAML";
314
+ const copied$1 = "Copied";
315
+ const already_reset$1 = "Already reset";
316
+ const fetch_schema_fail$1 = "Failed to fetch schema.";
317
+ const obtain_data_error$1 = "Having trouble getting data.";
318
+ const retry$1 = "Retry";
319
+ const create_resource$1 = "Create {{resource}}";
320
+ const edit_resource$1 = "Edit {{resource}}";
321
+ const dovetail$1 = {
322
+ copy: copy$1,
323
+ reset_arguments: reset_arguments$1,
324
+ view_changes: view_changes$1,
325
+ back_to_edit: back_to_edit$1,
326
+ configure_file: configure_file$1,
327
+ yaml_format_wrong: yaml_format_wrong$1,
328
+ yaml_value_wrong: yaml_value_wrong$1,
329
+ edit_yaml: edit_yaml$1,
330
+ copied: copied$1,
331
+ already_reset: already_reset$1,
332
+ fetch_schema_fail: fetch_schema_fail$1,
333
+ obtain_data_error: obtain_data_error$1,
334
+ retry: retry$1,
335
+ create_resource: create_resource$1,
336
+ edit_resource: edit_resource$1
892
337
  };
893
- const unescapeHtmlEntity = (m) => htmlEntities[m];
894
- const unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
895
- let defaultOptions = {
896
- bindI18n: "languageChanged",
897
- bindI18nStore: "",
898
- transEmptyNodeValue: "",
899
- transSupportBasicHtmlNodes: true,
900
- transWrapTextNodes: "",
901
- transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
902
- useSuspense: true,
903
- unescape
338
+ const EN = {
339
+ dovetail: dovetail$1
904
340
  };
905
- function setDefaults() {
906
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
907
- defaultOptions = {
908
- ...defaultOptions,
909
- ...options
910
- };
911
- }
912
- function getDefaults() {
913
- return defaultOptions;
914
- }
915
- let i18nInstance;
916
- function setI18n(instance) {
917
- i18nInstance = instance;
918
- }
919
- function getI18n() {
920
- return i18nInstance;
921
- }
922
- const initReactI18next = {
923
- type: "3rdParty",
924
- init(instance) {
925
- setDefaults(instance.options.react);
926
- setI18n(instance);
927
- }
341
+ const copy = "复制";
342
+ const reset_arguments = "重置";
343
+ const view_changes = "查看改动";
344
+ const back_to_edit = "编辑";
345
+ const configure_file = "配置内容";
346
+ const yaml_format_wrong = "配置内容不是有效的 yaml 格式。";
347
+ const yaml_value_wrong = "配置内容中存在不合法的值。";
348
+ const edit_yaml = "编辑 YAML";
349
+ const copied = "已复制";
350
+ const already_reset = "已重置";
351
+ const cancel = "取消";
352
+ const create = "创建";
353
+ const confirm_delete_text = "确定要删除 {{target}} 吗?";
354
+ const edit = "编辑";
355
+ const namespace = "名字空间";
356
+ const name = "名称";
357
+ const state = "状态";
358
+ const status = "状态";
359
+ const phase = "状态";
360
+ const image = "容器镜像";
361
+ const replicas = "副本数";
362
+ const created_time = "创建时间";
363
+ const label = "标签";
364
+ const annotation = "注释";
365
+ const type = "类型";
366
+ const event = "事件";
367
+ const reason = "原因";
368
+ const object = "对象";
369
+ const note$1 = "事件信息";
370
+ const condition = "Condition";
371
+ const download_yaml = "下载 YAML";
372
+ const detail = "详情";
373
+ const node_name = "主机名称";
374
+ const restarts = "重启次数";
375
+ const updated_time = "更新时间";
376
+ const message = "消息";
377
+ const save = "保存";
378
+ const more = "更多";
379
+ const workload = "工作负载";
380
+ const all_namespaces = "所有名字空间";
381
+ const empty = "无可显示的数据";
382
+ const schedule = "调度时间表";
383
+ const lastScheduleTime = "上次调度时间";
384
+ const duration = "持续时间";
385
+ const completions = "完成 Job 历史数";
386
+ const started = "开始时间";
387
+ const init_container = "初始化容器";
388
+ const container = "容器";
389
+ const redeploy = "重新部署";
390
+ const data = "数据";
391
+ const suspend = "暂停";
392
+ const resume = "重新开始";
393
+ const cluster = "集群";
394
+ const storage = "存储";
395
+ const network = "网络";
396
+ const clusterIp = "集群 IP";
397
+ const sessionAffinity = "会话保持";
398
+ const log = "日志";
399
+ const select_container = "选择容器";
400
+ const wrap = "折叠";
401
+ const resume_log = "继续";
402
+ const log_new_lines = ",并展示 {{ count }} 行新日志";
403
+ const fetch_schema_fail = "获取 schema 失败。";
404
+ const obtain_data_error = "获取数据时遇到问题。";
405
+ const retry = "重试";
406
+ const ready = "就绪";
407
+ const updating = "更新中";
408
+ const completed = "完成";
409
+ const failed = "异常";
410
+ const suspended = "挂起";
411
+ const running = "运行中";
412
+ const terminating = "终止";
413
+ const succeeded = "成功终止";
414
+ const unknown = "未知";
415
+ const pending = "待处理";
416
+ const waiting = "等待中";
417
+ const create_resource = "创建 {{resource}}";
418
+ const edit_resource = "编辑 {{resource}}";
419
+ const sec = "秒";
420
+ const min = "分";
421
+ const hr = "小时";
422
+ const day = "天";
423
+ const expand = "展开";
424
+ const fold = "收起";
425
+ const rule = "规则";
426
+ const default_backend = "默认后端";
427
+ const ingress_rule_type = "规则类型";
428
+ const port = "端口";
429
+ const dovetail = {
430
+ copy,
431
+ reset_arguments,
432
+ view_changes,
433
+ back_to_edit,
434
+ configure_file,
435
+ yaml_format_wrong,
436
+ yaml_value_wrong,
437
+ edit_yaml,
438
+ copied,
439
+ already_reset,
440
+ cancel,
441
+ "delete": "删除",
442
+ create,
443
+ confirm_delete_text,
444
+ edit,
445
+ namespace,
446
+ name,
447
+ state,
448
+ status,
449
+ phase,
450
+ image,
451
+ replicas,
452
+ created_time,
453
+ label,
454
+ annotation,
455
+ type,
456
+ event,
457
+ reason,
458
+ object,
459
+ note: note$1,
460
+ condition,
461
+ download_yaml,
462
+ detail,
463
+ node_name,
464
+ restarts,
465
+ updated_time,
466
+ message,
467
+ save,
468
+ more,
469
+ workload,
470
+ all_namespaces,
471
+ empty,
472
+ schedule,
473
+ lastScheduleTime,
474
+ duration,
475
+ completions,
476
+ started,
477
+ init_container,
478
+ container,
479
+ redeploy,
480
+ data,
481
+ suspend,
482
+ resume,
483
+ cluster,
484
+ storage,
485
+ network,
486
+ clusterIp,
487
+ sessionAffinity,
488
+ log,
489
+ select_container,
490
+ wrap,
491
+ resume_log,
492
+ log_new_lines,
493
+ fetch_schema_fail,
494
+ obtain_data_error,
495
+ retry,
496
+ ready,
497
+ updating,
498
+ completed,
499
+ failed,
500
+ suspended,
501
+ running,
502
+ terminating,
503
+ succeeded,
504
+ unknown,
505
+ pending,
506
+ waiting,
507
+ create_resource,
508
+ edit_resource,
509
+ sec,
510
+ min,
511
+ hr,
512
+ day,
513
+ expand,
514
+ fold,
515
+ rule,
516
+ default_backend,
517
+ ingress_rule_type,
518
+ port
928
519
  };
929
- const I18nContext = createContext();
930
- class ReportNamespaces {
931
- constructor() {
932
- this.usedNamespaces = {};
933
- }
934
- addUsedNamespaces(namespaces) {
935
- namespaces.forEach((ns) => {
936
- if (!this.usedNamespaces[ns])
937
- this.usedNamespaces[ns] = true;
938
- });
939
- }
940
- getUsedNamespaces() {
941
- return Object.keys(this.usedNamespaces);
942
- }
943
- }
944
- const usePrevious = (value, ignore) => {
945
- const ref = useRef();
946
- useEffect(() => {
947
- ref.current = ignore ? ref.current : value;
948
- }, [value, ignore]);
949
- return ref.current;
520
+ const ZH = {
521
+ dovetail
950
522
  };
951
- function useTranslation(ns) {
952
- let props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
953
- const {
954
- i18n: i18nFromProps
955
- } = props;
956
- const {
957
- i18n: i18nFromContext,
958
- defaultNS: defaultNSFromContext
959
- } = useContext(I18nContext) || {};
960
- const i18n2 = i18nFromProps || i18nFromContext || getI18n();
961
- if (i18n2 && !i18n2.reportNamespaces)
962
- i18n2.reportNamespaces = new ReportNamespaces();
963
- if (!i18n2) {
964
- warnOnce("You will need to pass in an i18next instance by using initReactI18next");
965
- const notReadyT = (k, optsOrDefaultValue) => {
966
- if (typeof optsOrDefaultValue === "string")
967
- return optsOrDefaultValue;
968
- if (optsOrDefaultValue && typeof optsOrDefaultValue === "object" && typeof optsOrDefaultValue.defaultValue === "string")
969
- return optsOrDefaultValue.defaultValue;
970
- return Array.isArray(k) ? k[k.length - 1] : k;
971
- };
972
- const retNotReady = [notReadyT, {}, false];
973
- retNotReady.t = notReadyT;
974
- retNotReady.i18n = {};
975
- retNotReady.ready = false;
976
- return retNotReady;
523
+ const resources = {
524
+ "en-US": EN,
525
+ "zh-CN": ZH
526
+ };
527
+ i18n.use(initReactI18next).init({
528
+ supportedLngs: ["en-US", "zh-CN"],
529
+ resources,
530
+ ns: Object.keys(resources["zh-CN"]),
531
+ defaultNS: "dovetail",
532
+ fallbackLng: ["en-US", "zh-CN"],
533
+ lng: "zh-CN",
534
+ nsSeparator: "."
535
+ });
536
+ var jsxRuntime = { exports: {} };
537
+ var reactJsxRuntime_production_min = {};
538
+ /** @license React v16.14.0
539
+ * react-jsx-runtime.production.min.js
540
+ *
541
+ * Copyright (c) Facebook, Inc. and its affiliates.
542
+ *
543
+ * This source code is licensed under the MIT license found in the
544
+ * LICENSE file in the root directory of this source tree.
545
+ */
546
+ var hasRequiredReactJsxRuntime_production_min;
547
+ function requireReactJsxRuntime_production_min() {
548
+ if (hasRequiredReactJsxRuntime_production_min)
549
+ return reactJsxRuntime_production_min;
550
+ hasRequiredReactJsxRuntime_production_min = 1;
551
+ var f = React__default, g = 60103;
552
+ reactJsxRuntime_production_min.Fragment = 60107;
553
+ if ("function" === typeof Symbol && Symbol.for) {
554
+ var h = Symbol.for;
555
+ g = h("react.element");
556
+ reactJsxRuntime_production_min.Fragment = h("react.fragment");
977
557
  }
978
- if (i18n2.options.react && i18n2.options.react.wait !== void 0)
979
- warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
980
- const i18nOptions = {
981
- ...getDefaults(),
982
- ...i18n2.options.react,
983
- ...props
984
- };
985
- const {
986
- useSuspense,
987
- keyPrefix
988
- } = i18nOptions;
989
- let namespaces = ns || defaultNSFromContext || i18n2.options && i18n2.options.defaultNS;
990
- namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
991
- if (i18n2.reportNamespaces.addUsedNamespaces)
992
- i18n2.reportNamespaces.addUsedNamespaces(namespaces);
993
- const ready2 = (i18n2.isInitialized || i18n2.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n2, i18nOptions));
994
- function getT() {
995
- return i18n2.getFixedT(props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
558
+ var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
559
+ function q(c, a, k) {
560
+ var b, d = {}, e = null, l = null;
561
+ void 0 !== k && (e = "" + k);
562
+ void 0 !== a.key && (e = "" + a.key);
563
+ void 0 !== a.ref && (l = a.ref);
564
+ for (b in a)
565
+ n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
566
+ if (c && c.defaultProps)
567
+ for (b in a = c.defaultProps, a)
568
+ void 0 === d[b] && (d[b] = a[b]);
569
+ return { $$typeof: g, type: c, key: e, ref: l, props: d, _owner: m.current };
996
570
  }
997
- const [t, setT] = useState(getT);
998
- let joinedNS = namespaces.join();
999
- if (props.lng)
1000
- joinedNS = `${props.lng}${joinedNS}`;
1001
- const previousJoinedNS = usePrevious(joinedNS);
1002
- const isMounted = useRef(true);
1003
- useEffect(() => {
1004
- const {
1005
- bindI18n,
1006
- bindI18nStore
1007
- } = i18nOptions;
1008
- isMounted.current = true;
1009
- if (!ready2 && !useSuspense) {
1010
- if (props.lng) {
1011
- loadLanguages(i18n2, props.lng, namespaces, () => {
1012
- if (isMounted.current)
1013
- setT(getT);
1014
- });
1015
- } else {
1016
- loadNamespaces(i18n2, namespaces, () => {
1017
- if (isMounted.current)
1018
- setT(getT);
1019
- });
1020
- }
1021
- }
1022
- if (ready2 && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
1023
- setT(getT);
1024
- }
1025
- function boundReset() {
1026
- if (isMounted.current)
1027
- setT(getT);
1028
- }
1029
- if (bindI18n && i18n2)
1030
- i18n2.on(bindI18n, boundReset);
1031
- if (bindI18nStore && i18n2)
1032
- i18n2.store.on(bindI18nStore, boundReset);
1033
- return () => {
1034
- isMounted.current = false;
1035
- if (bindI18n && i18n2)
1036
- bindI18n.split(" ").forEach((e) => i18n2.off(e, boundReset));
1037
- if (bindI18nStore && i18n2)
1038
- bindI18nStore.split(" ").forEach((e) => i18n2.store.off(e, boundReset));
1039
- };
1040
- }, [i18n2, joinedNS]);
1041
- const isInitial = useRef(true);
1042
- useEffect(() => {
1043
- if (isMounted.current && !isInitial.current) {
1044
- setT(getT);
1045
- }
1046
- isInitial.current = false;
1047
- }, [i18n2, keyPrefix]);
1048
- const ret = [t, i18n2, ready2];
1049
- ret.t = t;
1050
- ret.i18n = i18n2;
1051
- ret.ready = ready2;
1052
- if (ready2)
1053
- return ret;
1054
- if (!ready2 && !useSuspense)
1055
- return ret;
1056
- throw new Promise((resolve) => {
1057
- if (props.lng) {
1058
- loadLanguages(i18n2, props.lng, namespaces, () => resolve());
1059
- } else {
1060
- loadNamespaces(i18n2, namespaces, () => resolve());
571
+ reactJsxRuntime_production_min.jsx = q;
572
+ reactJsxRuntime_production_min.jsxs = q;
573
+ return reactJsxRuntime_production_min;
574
+ }
575
+ var reactJsxRuntime_development = {};
576
+ /** @license React v16.14.0
577
+ * react-jsx-runtime.development.js
578
+ *
579
+ * Copyright (c) Facebook, Inc. and its affiliates.
580
+ *
581
+ * This source code is licensed under the MIT license found in the
582
+ * LICENSE file in the root directory of this source tree.
583
+ */
584
+ var hasRequiredReactJsxRuntime_development;
585
+ function requireReactJsxRuntime_development() {
586
+ if (hasRequiredReactJsxRuntime_development)
587
+ return reactJsxRuntime_development;
588
+ hasRequiredReactJsxRuntime_development = 1;
589
+ (function(exports) {
590
+ if (process.env.NODE_ENV !== "production") {
591
+ (function() {
592
+ var React2 = React__default;
593
+ var REACT_ELEMENT_TYPE = 60103;
594
+ var REACT_PORTAL_TYPE = 60106;
595
+ exports.Fragment = 60107;
596
+ var REACT_STRICT_MODE_TYPE = 60108;
597
+ var REACT_PROFILER_TYPE = 60114;
598
+ var REACT_PROVIDER_TYPE = 60109;
599
+ var REACT_CONTEXT_TYPE = 60110;
600
+ var REACT_FORWARD_REF_TYPE = 60112;
601
+ var REACT_SUSPENSE_TYPE = 60113;
602
+ var REACT_SUSPENSE_LIST_TYPE = 60120;
603
+ var REACT_MEMO_TYPE = 60115;
604
+ var REACT_LAZY_TYPE = 60116;
605
+ var REACT_BLOCK_TYPE = 60121;
606
+ var REACT_SERVER_BLOCK_TYPE = 60122;
607
+ var REACT_FUNDAMENTAL_TYPE = 60117;
608
+ var REACT_DEBUG_TRACING_MODE_TYPE = 60129;
609
+ var REACT_LEGACY_HIDDEN_TYPE = 60131;
610
+ if (typeof Symbol === "function" && Symbol.for) {
611
+ var symbolFor = Symbol.for;
612
+ REACT_ELEMENT_TYPE = symbolFor("react.element");
613
+ REACT_PORTAL_TYPE = symbolFor("react.portal");
614
+ exports.Fragment = symbolFor("react.fragment");
615
+ REACT_STRICT_MODE_TYPE = symbolFor("react.strict_mode");
616
+ REACT_PROFILER_TYPE = symbolFor("react.profiler");
617
+ REACT_PROVIDER_TYPE = symbolFor("react.provider");
618
+ REACT_CONTEXT_TYPE = symbolFor("react.context");
619
+ REACT_FORWARD_REF_TYPE = symbolFor("react.forward_ref");
620
+ REACT_SUSPENSE_TYPE = symbolFor("react.suspense");
621
+ REACT_SUSPENSE_LIST_TYPE = symbolFor("react.suspense_list");
622
+ REACT_MEMO_TYPE = symbolFor("react.memo");
623
+ REACT_LAZY_TYPE = symbolFor("react.lazy");
624
+ REACT_BLOCK_TYPE = symbolFor("react.block");
625
+ REACT_SERVER_BLOCK_TYPE = symbolFor("react.server.block");
626
+ REACT_FUNDAMENTAL_TYPE = symbolFor("react.fundamental");
627
+ symbolFor("react.scope");
628
+ symbolFor("react.opaque.id");
629
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode");
630
+ symbolFor("react.offscreen");
631
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden");
632
+ }
633
+ var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
634
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
635
+ function getIteratorFn(maybeIterable) {
636
+ if (maybeIterable === null || typeof maybeIterable !== "object") {
637
+ return null;
638
+ }
639
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
640
+ if (typeof maybeIterator === "function") {
641
+ return maybeIterator;
642
+ }
643
+ return null;
644
+ }
645
+ var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
646
+ function error(format) {
647
+ {
648
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
649
+ args[_key2 - 1] = arguments[_key2];
650
+ }
651
+ printWarning("error", format, args);
652
+ }
653
+ }
654
+ function printWarning(level, format, args) {
655
+ {
656
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
657
+ var stack = "";
658
+ if (currentlyValidatingElement) {
659
+ var name2 = getComponentName(currentlyValidatingElement.type);
660
+ var owner = currentlyValidatingElement._owner;
661
+ stack += describeComponentFrame(name2, currentlyValidatingElement._source, owner && getComponentName(owner.type));
662
+ }
663
+ stack += ReactDebugCurrentFrame.getStackAddendum();
664
+ if (stack !== "") {
665
+ format += "%s";
666
+ args = args.concat([stack]);
667
+ }
668
+ var argsWithFormat = args.map(function(item) {
669
+ return "" + item;
670
+ });
671
+ argsWithFormat.unshift("Warning: " + format);
672
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
673
+ }
674
+ }
675
+ var enableScopeAPI = false;
676
+ function isValidElementType(type2) {
677
+ if (typeof type2 === "string" || typeof type2 === "function") {
678
+ return true;
679
+ }
680
+ if (type2 === exports.Fragment || type2 === REACT_PROFILER_TYPE || type2 === REACT_DEBUG_TRACING_MODE_TYPE || type2 === REACT_STRICT_MODE_TYPE || type2 === REACT_SUSPENSE_TYPE || type2 === REACT_SUSPENSE_LIST_TYPE || type2 === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI) {
681
+ return true;
682
+ }
683
+ if (typeof type2 === "object" && type2 !== null) {
684
+ if (type2.$$typeof === REACT_LAZY_TYPE || type2.$$typeof === REACT_MEMO_TYPE || type2.$$typeof === REACT_PROVIDER_TYPE || type2.$$typeof === REACT_CONTEXT_TYPE || type2.$$typeof === REACT_FORWARD_REF_TYPE || type2.$$typeof === REACT_FUNDAMENTAL_TYPE || type2.$$typeof === REACT_BLOCK_TYPE || type2[0] === REACT_SERVER_BLOCK_TYPE) {
685
+ return true;
686
+ }
687
+ }
688
+ return false;
689
+ }
690
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
691
+ function describeComponentFrame(name2, source, ownerName) {
692
+ var sourceInfo = "";
693
+ if (source) {
694
+ var path = source.fileName;
695
+ var fileName = path.replace(BEFORE_SLASH_RE, "");
696
+ {
697
+ if (/^index\./.test(fileName)) {
698
+ var match = path.match(BEFORE_SLASH_RE);
699
+ if (match) {
700
+ var pathBeforeSlash = match[1];
701
+ if (pathBeforeSlash) {
702
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, "");
703
+ fileName = folderName + "/" + fileName;
704
+ }
705
+ }
706
+ }
707
+ }
708
+ sourceInfo = " (at " + fileName + ":" + source.lineNumber + ")";
709
+ } else if (ownerName) {
710
+ sourceInfo = " (created by " + ownerName + ")";
711
+ }
712
+ return "\n in " + (name2 || "Unknown") + sourceInfo;
713
+ }
714
+ var Resolved = 1;
715
+ function refineResolvedLazyComponent(lazyComponent) {
716
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
717
+ }
718
+ function getWrappedName(outerType, innerType, wrapperName) {
719
+ var functionName = innerType.displayName || innerType.name || "";
720
+ return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
721
+ }
722
+ function getComponentName(type2) {
723
+ if (type2 == null) {
724
+ return null;
725
+ }
726
+ {
727
+ if (typeof type2.tag === "number") {
728
+ error("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue.");
729
+ }
730
+ }
731
+ if (typeof type2 === "function") {
732
+ return type2.displayName || type2.name || null;
733
+ }
734
+ if (typeof type2 === "string") {
735
+ return type2;
736
+ }
737
+ switch (type2) {
738
+ case exports.Fragment:
739
+ return "Fragment";
740
+ case REACT_PORTAL_TYPE:
741
+ return "Portal";
742
+ case REACT_PROFILER_TYPE:
743
+ return "Profiler";
744
+ case REACT_STRICT_MODE_TYPE:
745
+ return "StrictMode";
746
+ case REACT_SUSPENSE_TYPE:
747
+ return "Suspense";
748
+ case REACT_SUSPENSE_LIST_TYPE:
749
+ return "SuspenseList";
750
+ }
751
+ if (typeof type2 === "object") {
752
+ switch (type2.$$typeof) {
753
+ case REACT_CONTEXT_TYPE:
754
+ return "Context.Consumer";
755
+ case REACT_PROVIDER_TYPE:
756
+ return "Context.Provider";
757
+ case REACT_FORWARD_REF_TYPE:
758
+ return getWrappedName(type2, type2.render, "ForwardRef");
759
+ case REACT_MEMO_TYPE:
760
+ return getComponentName(type2.type);
761
+ case REACT_BLOCK_TYPE:
762
+ return getComponentName(type2.render);
763
+ case REACT_LAZY_TYPE: {
764
+ var thenable = type2;
765
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
766
+ if (resolvedThenable) {
767
+ return getComponentName(resolvedThenable);
768
+ }
769
+ break;
770
+ }
771
+ }
772
+ }
773
+ return null;
774
+ }
775
+ var loggedTypeFailures = {};
776
+ ReactSharedInternals.ReactDebugCurrentFrame;
777
+ var currentlyValidatingElement = null;
778
+ function setCurrentlyValidatingElement(element) {
779
+ {
780
+ currentlyValidatingElement = element;
781
+ }
782
+ }
783
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
784
+ {
785
+ var has2 = Function.call.bind(Object.prototype.hasOwnProperty);
786
+ for (var typeSpecName in typeSpecs) {
787
+ if (has2(typeSpecs, typeSpecName)) {
788
+ var error$1 = void 0;
789
+ try {
790
+ if (typeof typeSpecs[typeSpecName] !== "function") {
791
+ var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
792
+ err.name = "Invariant Violation";
793
+ throw err;
794
+ }
795
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
796
+ } catch (ex) {
797
+ error$1 = ex;
798
+ }
799
+ if (error$1 && !(error$1 instanceof Error)) {
800
+ setCurrentlyValidatingElement(element);
801
+ error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
802
+ setCurrentlyValidatingElement(null);
803
+ }
804
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
805
+ loggedTypeFailures[error$1.message] = true;
806
+ setCurrentlyValidatingElement(element);
807
+ error("Failed %s type: %s", location, error$1.message);
808
+ setCurrentlyValidatingElement(null);
809
+ }
810
+ }
811
+ }
812
+ }
813
+ }
814
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
815
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
816
+ var RESERVED_PROPS = {
817
+ key: true,
818
+ ref: true,
819
+ __self: true,
820
+ __source: true
821
+ };
822
+ var specialPropKeyWarningShown;
823
+ var specialPropRefWarningShown;
824
+ var didWarnAboutStringRefs;
825
+ {
826
+ didWarnAboutStringRefs = {};
827
+ }
828
+ function hasValidRef(config) {
829
+ {
830
+ if (hasOwnProperty.call(config, "ref")) {
831
+ var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
832
+ if (getter && getter.isReactWarning) {
833
+ return false;
834
+ }
835
+ }
836
+ }
837
+ return config.ref !== void 0;
838
+ }
839
+ function hasValidKey(config) {
840
+ {
841
+ if (hasOwnProperty.call(config, "key")) {
842
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
843
+ if (getter && getter.isReactWarning) {
844
+ return false;
845
+ }
846
+ }
847
+ }
848
+ return config.key !== void 0;
849
+ }
850
+ function warnIfStringRefCannotBeAutoConverted(config, self2) {
851
+ {
852
+ if (typeof config.ref === "string" && ReactCurrentOwner.current && self2 && ReactCurrentOwner.current.stateNode !== self2) {
853
+ var componentName = getComponentName(ReactCurrentOwner.current.type);
854
+ if (!didWarnAboutStringRefs[componentName]) {
855
+ error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
856
+ didWarnAboutStringRefs[componentName] = true;
857
+ }
858
+ }
859
+ }
860
+ }
861
+ function defineKeyPropWarningGetter(props, displayName) {
862
+ {
863
+ var warnAboutAccessingKey = function() {
864
+ if (!specialPropKeyWarningShown) {
865
+ specialPropKeyWarningShown = true;
866
+ error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
867
+ }
868
+ };
869
+ warnAboutAccessingKey.isReactWarning = true;
870
+ Object.defineProperty(props, "key", {
871
+ get: warnAboutAccessingKey,
872
+ configurable: true
873
+ });
874
+ }
875
+ }
876
+ function defineRefPropWarningGetter(props, displayName) {
877
+ {
878
+ var warnAboutAccessingRef = function() {
879
+ if (!specialPropRefWarningShown) {
880
+ specialPropRefWarningShown = true;
881
+ error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
882
+ }
883
+ };
884
+ warnAboutAccessingRef.isReactWarning = true;
885
+ Object.defineProperty(props, "ref", {
886
+ get: warnAboutAccessingRef,
887
+ configurable: true
888
+ });
889
+ }
890
+ }
891
+ var ReactElement = function(type2, key, ref, self2, source, owner, props) {
892
+ var element = {
893
+ // This tag allows us to uniquely identify this as a React Element
894
+ $$typeof: REACT_ELEMENT_TYPE,
895
+ // Built-in properties that belong on the element
896
+ type: type2,
897
+ key,
898
+ ref,
899
+ props,
900
+ // Record the component responsible for creating this element.
901
+ _owner: owner
902
+ };
903
+ {
904
+ element._store = {};
905
+ Object.defineProperty(element._store, "validated", {
906
+ configurable: false,
907
+ enumerable: false,
908
+ writable: true,
909
+ value: false
910
+ });
911
+ Object.defineProperty(element, "_self", {
912
+ configurable: false,
913
+ enumerable: false,
914
+ writable: false,
915
+ value: self2
916
+ });
917
+ Object.defineProperty(element, "_source", {
918
+ configurable: false,
919
+ enumerable: false,
920
+ writable: false,
921
+ value: source
922
+ });
923
+ if (Object.freeze) {
924
+ Object.freeze(element.props);
925
+ Object.freeze(element);
926
+ }
927
+ }
928
+ return element;
929
+ };
930
+ function jsxDEV(type2, config, maybeKey, source, self2) {
931
+ {
932
+ var propName;
933
+ var props = {};
934
+ var key = null;
935
+ var ref = null;
936
+ if (maybeKey !== void 0) {
937
+ key = "" + maybeKey;
938
+ }
939
+ if (hasValidKey(config)) {
940
+ key = "" + config.key;
941
+ }
942
+ if (hasValidRef(config)) {
943
+ ref = config.ref;
944
+ warnIfStringRefCannotBeAutoConverted(config, self2);
945
+ }
946
+ for (propName in config) {
947
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
948
+ props[propName] = config[propName];
949
+ }
950
+ }
951
+ if (type2 && type2.defaultProps) {
952
+ var defaultProps = type2.defaultProps;
953
+ for (propName in defaultProps) {
954
+ if (props[propName] === void 0) {
955
+ props[propName] = defaultProps[propName];
956
+ }
957
+ }
958
+ }
959
+ if (key || ref) {
960
+ var displayName = typeof type2 === "function" ? type2.displayName || type2.name || "Unknown" : type2;
961
+ if (key) {
962
+ defineKeyPropWarningGetter(props, displayName);
963
+ }
964
+ if (ref) {
965
+ defineRefPropWarningGetter(props, displayName);
966
+ }
967
+ }
968
+ return ReactElement(type2, key, ref, self2, source, ReactCurrentOwner.current, props);
969
+ }
970
+ }
971
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
972
+ ReactSharedInternals.ReactDebugCurrentFrame;
973
+ function setCurrentlyValidatingElement$1(element) {
974
+ currentlyValidatingElement = element;
975
+ }
976
+ var propTypesMisspellWarningShown;
977
+ {
978
+ propTypesMisspellWarningShown = false;
979
+ }
980
+ function isValidElement(object2) {
981
+ {
982
+ return typeof object2 === "object" && object2 !== null && object2.$$typeof === REACT_ELEMENT_TYPE;
983
+ }
984
+ }
985
+ function getDeclarationErrorAddendum() {
986
+ {
987
+ if (ReactCurrentOwner$1.current) {
988
+ var name2 = getComponentName(ReactCurrentOwner$1.current.type);
989
+ if (name2) {
990
+ return "\n\nCheck the render method of `" + name2 + "`.";
991
+ }
992
+ }
993
+ return "";
994
+ }
995
+ }
996
+ function getSourceInfoErrorAddendum(source) {
997
+ {
998
+ if (source !== void 0) {
999
+ var fileName = source.fileName.replace(/^.*[\\\/]/, "");
1000
+ var lineNumber = source.lineNumber;
1001
+ return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
1002
+ }
1003
+ return "";
1004
+ }
1005
+ }
1006
+ var ownerHasKeyUseWarning = {};
1007
+ function getCurrentComponentErrorInfo(parentType) {
1008
+ {
1009
+ var info = getDeclarationErrorAddendum();
1010
+ if (!info) {
1011
+ var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
1012
+ if (parentName) {
1013
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1014
+ }
1015
+ }
1016
+ return info;
1017
+ }
1018
+ }
1019
+ function validateExplicitKey(element, parentType) {
1020
+ {
1021
+ if (!element._store || element._store.validated || element.key != null) {
1022
+ return;
1023
+ }
1024
+ element._store.validated = true;
1025
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1026
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1027
+ return;
1028
+ }
1029
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1030
+ var childOwner = "";
1031
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1032
+ childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
1033
+ }
1034
+ setCurrentlyValidatingElement$1(element);
1035
+ error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1036
+ setCurrentlyValidatingElement$1(null);
1037
+ }
1038
+ }
1039
+ function validateChildKeys(node, parentType) {
1040
+ {
1041
+ if (typeof node !== "object") {
1042
+ return;
1043
+ }
1044
+ if (Array.isArray(node)) {
1045
+ for (var i = 0; i < node.length; i++) {
1046
+ var child = node[i];
1047
+ if (isValidElement(child)) {
1048
+ validateExplicitKey(child, parentType);
1049
+ }
1050
+ }
1051
+ } else if (isValidElement(node)) {
1052
+ if (node._store) {
1053
+ node._store.validated = true;
1054
+ }
1055
+ } else if (node) {
1056
+ var iteratorFn = getIteratorFn(node);
1057
+ if (typeof iteratorFn === "function") {
1058
+ if (iteratorFn !== node.entries) {
1059
+ var iterator = iteratorFn.call(node);
1060
+ var step;
1061
+ while (!(step = iterator.next()).done) {
1062
+ if (isValidElement(step.value)) {
1063
+ validateExplicitKey(step.value, parentType);
1064
+ }
1065
+ }
1066
+ }
1067
+ }
1068
+ }
1069
+ }
1070
+ }
1071
+ function validatePropTypes(element) {
1072
+ {
1073
+ var type2 = element.type;
1074
+ if (type2 === null || type2 === void 0 || typeof type2 === "string") {
1075
+ return;
1076
+ }
1077
+ var propTypes;
1078
+ if (typeof type2 === "function") {
1079
+ propTypes = type2.propTypes;
1080
+ } else if (typeof type2 === "object" && (type2.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1081
+ // Inner props are checked in the reconciler.
1082
+ type2.$$typeof === REACT_MEMO_TYPE)) {
1083
+ propTypes = type2.propTypes;
1084
+ } else {
1085
+ return;
1086
+ }
1087
+ if (propTypes) {
1088
+ var name2 = getComponentName(type2);
1089
+ checkPropTypes(propTypes, element.props, "prop", name2, element);
1090
+ } else if (type2.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
1091
+ propTypesMisspellWarningShown = true;
1092
+ var _name = getComponentName(type2);
1093
+ error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
1094
+ }
1095
+ if (typeof type2.getDefaultProps === "function" && !type2.getDefaultProps.isReactClassApproved) {
1096
+ error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1097
+ }
1098
+ }
1099
+ }
1100
+ function validateFragmentProps(fragment) {
1101
+ {
1102
+ var keys = Object.keys(fragment.props);
1103
+ for (var i = 0; i < keys.length; i++) {
1104
+ var key = keys[i];
1105
+ if (key !== "children" && key !== "key") {
1106
+ setCurrentlyValidatingElement$1(fragment);
1107
+ error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
1108
+ setCurrentlyValidatingElement$1(null);
1109
+ break;
1110
+ }
1111
+ }
1112
+ if (fragment.ref !== null) {
1113
+ setCurrentlyValidatingElement$1(fragment);
1114
+ error("Invalid attribute `ref` supplied to `React.Fragment`.");
1115
+ setCurrentlyValidatingElement$1(null);
1116
+ }
1117
+ }
1118
+ }
1119
+ function jsxWithValidation(type2, props, key, isStaticChildren, source, self2) {
1120
+ {
1121
+ var validType = isValidElementType(type2);
1122
+ if (!validType) {
1123
+ var info = "";
1124
+ if (type2 === void 0 || typeof type2 === "object" && type2 !== null && Object.keys(type2).length === 0) {
1125
+ info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
1126
+ }
1127
+ var sourceInfo = getSourceInfoErrorAddendum(source);
1128
+ if (sourceInfo) {
1129
+ info += sourceInfo;
1130
+ } else {
1131
+ info += getDeclarationErrorAddendum();
1132
+ }
1133
+ var typeString;
1134
+ if (type2 === null) {
1135
+ typeString = "null";
1136
+ } else if (Array.isArray(type2)) {
1137
+ typeString = "array";
1138
+ } else if (type2 !== void 0 && type2.$$typeof === REACT_ELEMENT_TYPE) {
1139
+ typeString = "<" + (getComponentName(type2.type) || "Unknown") + " />";
1140
+ info = " Did you accidentally export a JSX literal instead of a component?";
1141
+ } else {
1142
+ typeString = typeof type2;
1143
+ }
1144
+ error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
1145
+ }
1146
+ var element = jsxDEV(type2, props, key, source, self2);
1147
+ if (element == null) {
1148
+ return element;
1149
+ }
1150
+ if (validType) {
1151
+ var children = props.children;
1152
+ if (children !== void 0) {
1153
+ if (isStaticChildren) {
1154
+ if (Array.isArray(children)) {
1155
+ for (var i = 0; i < children.length; i++) {
1156
+ validateChildKeys(children[i], type2);
1157
+ }
1158
+ if (Object.freeze) {
1159
+ Object.freeze(children);
1160
+ }
1161
+ } else {
1162
+ error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
1163
+ }
1164
+ } else {
1165
+ validateChildKeys(children, type2);
1166
+ }
1167
+ }
1168
+ }
1169
+ if (type2 === exports.Fragment) {
1170
+ validateFragmentProps(element);
1171
+ } else {
1172
+ validatePropTypes(element);
1173
+ }
1174
+ return element;
1175
+ }
1176
+ }
1177
+ function jsxWithValidationStatic(type2, props, key) {
1178
+ {
1179
+ return jsxWithValidation(type2, props, key, true);
1180
+ }
1181
+ }
1182
+ function jsxWithValidationDynamic(type2, props, key) {
1183
+ {
1184
+ return jsxWithValidation(type2, props, key, false);
1185
+ }
1186
+ }
1187
+ var jsx = jsxWithValidationDynamic;
1188
+ var jsxs = jsxWithValidationStatic;
1189
+ exports.jsx = jsx;
1190
+ exports.jsxs = jsxs;
1191
+ })();
1061
1192
  }
1062
- });
1193
+ })(reactJsxRuntime_development);
1194
+ return reactJsxRuntime_development;
1195
+ }
1196
+ if (process.env.NODE_ENV === "production") {
1197
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
1198
+ } else {
1199
+ jsxRuntime.exports = requireReactJsxRuntime_development();
1063
1200
  }
1201
+ var jsxRuntimeExports = jsxRuntime.exports;
1202
+ const stringifyConfig = {
1203
+ addQueryPrefix: true,
1204
+ skipNulls: true,
1205
+ arrayFormat: "indices",
1206
+ encode: false,
1207
+ encodeValuesOnly: true
1208
+ };
1209
+ const convertToNumberIfPossible = (value) => {
1210
+ if (typeof value === "undefined") {
1211
+ return value;
1212
+ }
1213
+ const num = Number(value);
1214
+ if (`${num}` === value) {
1215
+ return num;
1216
+ }
1217
+ return value;
1218
+ };
1219
+ const routerProvider = {
1220
+ go: () => {
1221
+ const { search: existingSearch, hash: existingHash } = useLocation();
1222
+ const history = useHistory();
1223
+ const fn = useCallback(
1224
+ ({ to, type: type2, query, hash, options: { keepQuery, keepHash } = {} }) => {
1225
+ const urlQuery = {
1226
+ ...keepQuery && existingSearch && parse(existingSearch, { ignoreQueryPrefix: true }),
1227
+ ...query
1228
+ };
1229
+ if (urlQuery.to) {
1230
+ urlQuery.to = encodeURIComponent(`${urlQuery.to}`);
1231
+ }
1232
+ const hasUrlQuery = Object.keys(urlQuery).length > 0;
1233
+ const urlHash = `#${(hash || keepHash && existingHash || "").replace(
1234
+ /^#/,
1235
+ ""
1236
+ )}`;
1237
+ const hasUrlHash = urlHash.length > 1;
1238
+ const urlTo = to || "";
1239
+ const fullPath = `${urlTo}${hasUrlQuery ? stringify(urlQuery, stringifyConfig) : ""}${hasUrlHash ? urlHash : ""}`;
1240
+ if (type2 === "path") {
1241
+ return fullPath;
1242
+ }
1243
+ return history[type2 || "push"](fullPath);
1244
+ },
1245
+ [existingHash, existingSearch, history]
1246
+ );
1247
+ return fn;
1248
+ },
1249
+ back: () => {
1250
+ const history = useHistory();
1251
+ const fn = useCallback(() => {
1252
+ history.go(-1);
1253
+ }, [history]);
1254
+ return fn;
1255
+ },
1256
+ parse: () => {
1257
+ var _a;
1258
+ let params = useParams();
1259
+ const { pathname, search } = useLocation();
1260
+ const { resources: resources2 } = useContext(ResourceContext);
1261
+ const { resource, action, matchedRoute } = React__default.useMemo(() => {
1262
+ return matchResourceFromRoute(pathname, resources2);
1263
+ }, [resources2, pathname]);
1264
+ if (Object.entries(params).length === 0 && matchedRoute) {
1265
+ params = ((_a = matchPath(matchedRoute, pathname)) == null ? void 0 : _a.params) || {};
1266
+ }
1267
+ const fn = useCallback(() => {
1268
+ const parsedSearch = parse(search, { ignoreQueryPrefix: true });
1269
+ const combinedParams = {
1270
+ ...params,
1271
+ ...parsedSearch
1272
+ };
1273
+ const response = {
1274
+ ...resource && { resource },
1275
+ ...action && { action },
1276
+ ...(parsedSearch == null ? void 0 : parsedSearch.id) && { id: decodeURIComponent(parsedSearch.id) },
1277
+ // ...(params?.action && { action: params.action }), // lets see if there is a need for this
1278
+ pathname,
1279
+ params: {
1280
+ ...combinedParams,
1281
+ current: convertToNumberIfPossible(combinedParams.current),
1282
+ pageSize: convertToNumberIfPossible(combinedParams.pageSize),
1283
+ to: combinedParams.to ? decodeURIComponent(combinedParams.to) : void 0
1284
+ }
1285
+ };
1286
+ return response;
1287
+ }, [pathname, search, params, resource, action]);
1288
+ return fn;
1289
+ },
1290
+ Link: React__default.forwardRef(function RefineLink(props, ref) {
1291
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ...props, ref });
1292
+ })
1293
+ };
1064
1294
  function useK8sYamlEditor() {
1065
1295
  const foldSymbol = useCallback(function(editor, symbol) {
1066
1296
  const model = editor.getModel();
@@ -3810,7 +4040,7 @@ lodash.exports;
3810
4040
  return result2;
3811
4041
  }
3812
4042
  function flatRest(func) {
3813
- return setToString(overRest(func, undefined$1, flatten), func + "");
4043
+ return setToString(overRest(func, undefined$1, flatten2), func + "");
3814
4044
  }
3815
4045
  function getAllKeys(object2) {
3816
4046
  return baseGetAllKeys(object2, keys, getSymbols);
@@ -4357,7 +4587,7 @@ lodash.exports;
4357
4587
  }
4358
4588
  return baseFindIndex(array, getIteratee(predicate, 3), index, true);
4359
4589
  }
4360
- function flatten(array) {
4590
+ function flatten2(array) {
4361
4591
  var length = array == null ? 0 : array.length;
4362
4592
  return length ? baseFlatten(array, 1) : [];
4363
4593
  }
@@ -6145,7 +6375,7 @@ lodash.exports;
6145
6375
  lodash2.flatMap = flatMap;
6146
6376
  lodash2.flatMapDeep = flatMapDeep;
6147
6377
  lodash2.flatMapDepth = flatMapDepth;
6148
- lodash2.flatten = flatten;
6378
+ lodash2.flatten = flatten2;
6149
6379
  lodash2.flattenDeep = flattenDeep;
6150
6380
  lodash2.flattenDepth = flattenDepth;
6151
6381
  lodash2.flip = flip;
@@ -6433,1079 +6663,849 @@ lodash.exports;
6433
6663
  } else {
6434
6664
  result2.__views__.push({
6435
6665
  "size": nativeMin(n, MAX_ARRAY_LENGTH),
6436
- "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
6437
- });
6438
- }
6439
- return result2;
6440
- };
6441
- LazyWrapper.prototype[methodName + "Right"] = function(n) {
6442
- return this.reverse()[methodName](n).reverse();
6443
- };
6444
- });
6445
- arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
6446
- var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
6447
- LazyWrapper.prototype[methodName] = function(iteratee2) {
6448
- var result2 = this.clone();
6449
- result2.__iteratees__.push({
6450
- "iteratee": getIteratee(iteratee2, 3),
6451
- "type": type2
6452
- });
6453
- result2.__filtered__ = result2.__filtered__ || isFilter;
6454
- return result2;
6455
- };
6456
- });
6457
- arrayEach(["head", "last"], function(methodName, index) {
6458
- var takeName = "take" + (index ? "Right" : "");
6459
- LazyWrapper.prototype[methodName] = function() {
6460
- return this[takeName](1).value()[0];
6461
- };
6462
- });
6463
- arrayEach(["initial", "tail"], function(methodName, index) {
6464
- var dropName = "drop" + (index ? "" : "Right");
6465
- LazyWrapper.prototype[methodName] = function() {
6466
- return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
6467
- };
6468
- });
6469
- LazyWrapper.prototype.compact = function() {
6470
- return this.filter(identity);
6471
- };
6472
- LazyWrapper.prototype.find = function(predicate) {
6473
- return this.filter(predicate).head();
6474
- };
6475
- LazyWrapper.prototype.findLast = function(predicate) {
6476
- return this.reverse().find(predicate);
6477
- };
6478
- LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
6479
- if (typeof path == "function") {
6480
- return new LazyWrapper(this);
6481
- }
6482
- return this.map(function(value) {
6483
- return baseInvoke(value, path, args);
6484
- });
6485
- });
6486
- LazyWrapper.prototype.reject = function(predicate) {
6487
- return this.filter(negate(getIteratee(predicate)));
6488
- };
6489
- LazyWrapper.prototype.slice = function(start, end) {
6490
- start = toInteger(start);
6491
- var result2 = this;
6492
- if (result2.__filtered__ && (start > 0 || end < 0)) {
6493
- return new LazyWrapper(result2);
6494
- }
6495
- if (start < 0) {
6496
- result2 = result2.takeRight(-start);
6497
- } else if (start) {
6498
- result2 = result2.drop(start);
6499
- }
6500
- if (end !== undefined$1) {
6501
- end = toInteger(end);
6502
- result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
6503
- }
6504
- return result2;
6505
- };
6506
- LazyWrapper.prototype.takeRightWhile = function(predicate) {
6507
- return this.reverse().takeWhile(predicate).reverse();
6508
- };
6509
- LazyWrapper.prototype.toArray = function() {
6510
- return this.take(MAX_ARRAY_LENGTH);
6511
- };
6512
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
6513
- var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash2[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
6514
- if (!lodashFunc) {
6515
- return;
6516
- }
6517
- lodash2.prototype[methodName] = function() {
6518
- var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value);
6519
- var interceptor = function(value2) {
6520
- var result3 = lodashFunc.apply(lodash2, arrayPush([value2], args));
6521
- return isTaker && chainAll ? result3[0] : result3;
6522
- };
6523
- if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
6524
- isLazy = useLazy = false;
6525
- }
6526
- var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
6527
- if (!retUnwrapped && useLazy) {
6528
- value = onlyLazy ? value : new LazyWrapper(this);
6529
- var result2 = func.apply(value, args);
6530
- result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined$1 });
6531
- return new LodashWrapper(result2, chainAll);
6532
- }
6533
- if (isUnwrapped && onlyLazy) {
6534
- return func.apply(this, args);
6535
- }
6536
- result2 = this.thru(interceptor);
6537
- return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
6538
- };
6539
- });
6540
- arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
6541
- var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
6542
- lodash2.prototype[methodName] = function() {
6543
- var args = arguments;
6544
- if (retUnwrapped && !this.__chain__) {
6545
- var value = this.value();
6546
- return func.apply(isArray(value) ? value : [], args);
6666
+ "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
6667
+ });
6547
6668
  }
6548
- return this[chainName](function(value2) {
6549
- return func.apply(isArray(value2) ? value2 : [], args);
6550
- });
6669
+ return result2;
6670
+ };
6671
+ LazyWrapper.prototype[methodName + "Right"] = function(n) {
6672
+ return this.reverse()[methodName](n).reverse();
6551
6673
  };
6552
6674
  });
6553
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
6554
- var lodashFunc = lodash2[methodName];
6555
- if (lodashFunc) {
6556
- var key = lodashFunc.name + "";
6557
- if (!hasOwnProperty.call(realNames, key)) {
6558
- realNames[key] = [];
6559
- }
6560
- realNames[key].push({ "name": methodName, "func": lodashFunc });
6561
- }
6562
- });
6563
- realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
6564
- "name": "wrapper",
6565
- "func": undefined$1
6566
- }];
6567
- LazyWrapper.prototype.clone = lazyClone;
6568
- LazyWrapper.prototype.reverse = lazyReverse;
6569
- LazyWrapper.prototype.value = lazyValue;
6570
- lodash2.prototype.at = wrapperAt;
6571
- lodash2.prototype.chain = wrapperChain;
6572
- lodash2.prototype.commit = wrapperCommit;
6573
- lodash2.prototype.next = wrapperNext;
6574
- lodash2.prototype.plant = wrapperPlant;
6575
- lodash2.prototype.reverse = wrapperReverse;
6576
- lodash2.prototype.toJSON = lodash2.prototype.valueOf = lodash2.prototype.value = wrapperValue;
6577
- lodash2.prototype.first = lodash2.prototype.head;
6578
- if (symIterator) {
6579
- lodash2.prototype[symIterator] = wrapperToIterator;
6580
- }
6581
- return lodash2;
6582
- };
6583
- var _ = runInContext();
6584
- if (freeModule) {
6585
- (freeModule.exports = _)._ = _;
6586
- freeExports._ = _;
6587
- } else {
6588
- root._ = _;
6589
- }
6590
- }).call(commonjsGlobal);
6591
- })(lodash, lodash.exports);
6592
- var lodashExports = lodash.exports;
6593
- function generateValueFromSchema(schema, options) {
6594
- var _a, _b, _c, _d, _e, _f, _g;
6595
- const { generateValue } = options;
6596
- if (!schema) {
6597
- return {};
6598
- }
6599
- switch (true) {
6600
- case (schema.type === "string" && "enum" in schema && Boolean((_a = schema.enum) == null ? void 0 : _a.length)):
6601
- return (generateValue == null ? void 0 : generateValue(schema)) || ((_b = schema.enum) == null ? void 0 : _b[0]);
6602
- case schema.type === "string":
6603
- return (generateValue == null ? void 0 : generateValue(schema)) || "";
6604
- case schema.type === "boolean":
6605
- return (generateValue == null ? void 0 : generateValue(schema)) || false;
6606
- case schema.type === "array":
6607
- if (!schema.minItems || !schema.items || typeof schema.items === "boolean" || Array.isArray(schema.items)) {
6608
- return (generateValue == null ? void 0 : generateValue(schema)) || [];
6609
- }
6610
- return new Array(schema.minItems).fill(
6611
- generateValueFromSchema(schema.items, options)
6612
- );
6613
- case schema.type === "number":
6614
- case schema.type === "integer":
6615
- return (generateValue == null ? void 0 : generateValue(schema)) || 0;
6616
- case schema.type === "object": {
6617
- const obj = {};
6618
- for (const key in schema.properties) {
6619
- obj[key] = generateValueFromSchema(
6620
- schema.properties[key],
6621
- options
6622
- );
6623
- }
6624
- return obj;
6625
- }
6626
- case (Array.isArray(schema.type) && "anyOf" in schema && Boolean((_c = schema.anyOf) == null ? void 0 : _c.length)):
6627
- case (Array.isArray(schema.type) && "oneOf" in schema && Boolean((_d = schema.oneOf) == null ? void 0 : _d.length)): {
6628
- const subSchema = (_e = schema.anyOf || schema.oneOf) == null ? void 0 : _e[0];
6629
- return generateValueFromSchema(subSchema, options);
6630
- }
6631
- case ("allOf" in schema && Boolean((_f = schema.allOf) == null ? void 0 : _f.length)):
6632
- return generateValueFromSchema((_g = schema.allOf) == null ? void 0 : _g[0], options);
6633
- default:
6634
- return void 0;
6635
- }
6636
- }
6637
- function generateSchemaTypeValue(schema) {
6638
- return generateValueFromSchema(schema, {
6639
- generateValue(schema2) {
6640
- if (schema2.type === "array" && schema2.items) {
6641
- return generateSchemaTypeValue(schema2.items);
6642
- } else {
6643
- return schema2.type;
6644
- }
6645
- }
6646
- });
6647
- }
6648
- function resolveRef(schema, schemas, options) {
6649
- var _a, _b;
6650
- const { prune } = options;
6651
- if (schema.$ref) {
6652
- const refKey = schema.$ref.replace("#/components/schemas/", "");
6653
- Object.assign(schema, schemas[refKey]);
6654
- if (prune.metadata && [
6655
- "io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta",
6656
- "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
6657
- ].some((k) => refKey.includes(k)) && schema.properties) {
6658
- schema.properties = lodashExports.pick(schema.properties, [
6659
- "name",
6660
- "namespace",
6661
- "annotations",
6662
- "labels"
6663
- ]);
6664
- }
6665
- delete schema.$ref;
6666
- }
6667
- for (const schemaKey in schema) {
6668
- if (prune.xProperty && schemaKey.startsWith("x-") && schemaKey !== "x-kubernetes-group-version-kind") {
6669
- delete schema[schemaKey];
6670
- }
6671
- }
6672
- switch (true) {
6673
- case schema.type === "array":
6674
- if (Array.isArray(schema.items)) {
6675
- schema.items.forEach((item) => resolveRef(item, schemas, options));
6676
- } else if (typeof schema.items === "object") {
6677
- resolveRef(schema.items, schemas, options);
6678
- }
6679
- break;
6680
- case schema.type === "object":
6681
- for (const key in schema.properties) {
6682
- const subSchema = schema.properties[key];
6683
- if (prune.optional && !((_a = schema.required) == null ? void 0 : _a.includes(key))) {
6684
- delete schema.properties[key];
6685
- }
6686
- if (prune.fields.includes(key)) {
6687
- delete schema.properties[key];
6688
- }
6689
- resolveRef(subSchema, schemas, options);
6690
- }
6691
- if (schema.additionalProperties) {
6692
- resolveRef(schema.additionalProperties, schemas, options);
6693
- }
6694
- break;
6695
- case !!(schema.allOf && schema.allOf[0]):
6696
- resolveRef((_b = schema.allOf) == null ? void 0 : _b[0], schemas, options);
6697
- }
6698
- if (prune.description) {
6699
- delete schema.description;
6700
- }
6701
- return schema;
6702
- }
6703
- class K8sOpenAPI {
6704
- constructor(resourceBasePath) {
6705
- __publicField(this, "response", null);
6706
- __publicField(this, "apiVersion");
6707
- this.resourceBasePath = resourceBasePath;
6708
- this.apiVersion = getApiVersion(resourceBasePath);
6709
- }
6710
- async fetch() {
6711
- const response = await fetch(
6712
- `/api/sks/api/v1/clusters/sks-mgmt/proxy/openapi/v3${this.resourceBasePath}`
6713
- );
6714
- return response.json();
6715
- }
6716
- async findSchema(kind) {
6717
- const result = this.response || await this.fetch();
6718
- const schema = Object.values(result.components.schemas).find(
6719
- (schema2) => {
6720
- var _a;
6721
- return (_a = schema2["x-kubernetes-group-version-kind"]) == null ? void 0 : _a.some(
6722
- ({ kind: schemaKind, version: schemaVersion, group: schemaGroup }) => kind === schemaKind && this.apiVersion === `${schemaGroup ? schemaGroup + "/" : ""}${schemaVersion}`
6723
- );
6724
- }
6725
- );
6726
- if (schema) {
6727
- resolveRef(schema, result.components.schemas, {
6728
- prune: {
6729
- description: true,
6730
- optional: false,
6731
- fields: [],
6732
- metadata: true,
6733
- xProperty: true
6734
- }
6735
- });
6736
- }
6737
- return schema;
6738
- }
6739
- }
6740
- function useSchema(options) {
6741
- var _a;
6742
- const [schema, setSchema] = useState(null);
6743
- const [loading, setLoading] = useState(false);
6744
- const [error, setError] = useState(null);
6745
- const useResourceResult = useResource();
6746
- const resource = (options == null ? void 0 : options.resource) || useResourceResult.resource;
6747
- const openapi = useMemo(
6748
- () => {
6749
- var _a2;
6750
- return new K8sOpenAPI((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath);
6751
- },
6752
- [(_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.resourceBasePath]
6753
- );
6754
- const fetchSchema = useCallback(async () => {
6755
- var _a2;
6756
- setLoading(true);
6757
- setError(null);
6758
- try {
6759
- const schema2 = await openapi.findSchema((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.kind);
6760
- setSchema(schema2 || null);
6761
- setError(null);
6762
- } catch (e) {
6763
- setError(e);
6764
- } finally {
6765
- setLoading(false);
6766
- }
6767
- }, [resource, openapi]);
6768
- useEffect(() => {
6769
- if (options == null ? void 0 : options.skip)
6770
- return;
6771
- fetchSchema();
6772
- }, [fetchSchema]);
6773
- return {
6774
- schema,
6775
- loading,
6776
- error,
6777
- fetchSchema
6778
- };
6779
- }
6780
- function generateYamlBySchema(defaultValue, schema) {
6781
- const typeObject = generateSchemaTypeValue(schema);
6782
- function makeAnnotations(obj, key) {
6783
- const result = {};
6784
- if (isObject(obj[key])) {
6785
- result[`#${key}`] = {};
6786
- Object.keys(obj[key]).forEach((prop) => {
6787
- result[`#${key}`] = {
6788
- ...result[`#${key}`],
6789
- ...makeAnnotations(obj[key], prop)
6675
+ arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
6676
+ var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
6677
+ LazyWrapper.prototype[methodName] = function(iteratee2) {
6678
+ var result2 = this.clone();
6679
+ result2.__iteratees__.push({
6680
+ "iteratee": getIteratee(iteratee2, 3),
6681
+ "type": type2
6682
+ });
6683
+ result2.__filtered__ = result2.__filtered__ || isFilter;
6684
+ return result2;
6790
6685
  };
6791
6686
  });
6792
- } else {
6793
- result[`#${key}`] = obj[key];
6794
- }
6795
- return result;
6796
- }
6797
- function merge2(obj1, obj2, merged2 = {}) {
6798
- for (const key in obj1) {
6799
- merged2[key] = obj1[key];
6800
- }
6801
- for (const key in obj2) {
6802
- if (key in obj1) {
6803
- if (isObject(obj2[key]) && isObject(obj1[key])) {
6804
- merged2[key] = merge2(
6805
- obj1[key],
6806
- obj2[key]
6807
- );
6808
- }
6809
- } else {
6810
- merged2 = {
6811
- ...merged2,
6812
- ...makeAnnotations(obj2, key)
6687
+ arrayEach(["head", "last"], function(methodName, index) {
6688
+ var takeName = "take" + (index ? "Right" : "");
6689
+ LazyWrapper.prototype[methodName] = function() {
6690
+ return this[takeName](1).value()[0];
6813
6691
  };
6814
- }
6815
- }
6816
- return merged2;
6817
- }
6818
- const merged = merge2(defaultValue, typeObject);
6819
- const content = yaml.dump(merged);
6820
- return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
6821
- }
6822
- const GlobalStoreContext = createContext({});
6823
- const useGlobalStore = () => {
6824
- return useContext(GlobalStoreContext);
6825
- };
6826
- const useEagleForm = ({
6827
- action,
6828
- resource,
6829
- onMutationSuccess: onMutationSuccessProp,
6830
- onMutationError,
6831
- submitOnEnter = false,
6832
- warnWhenUnsavedChanges: warnWhenUnsavedChangesProp,
6833
- redirect,
6834
- successNotification,
6835
- errorNotification,
6836
- meta,
6837
- metaData,
6838
- queryMeta,
6839
- mutationMeta,
6840
- liveMode,
6841
- liveParams,
6842
- mutationMode,
6843
- dataProviderName,
6844
- onLiveEvent,
6845
- invalidates,
6846
- undoableTimeout,
6847
- queryOptions,
6848
- createMutationOptions,
6849
- updateMutationOptions,
6850
- id: idFromProps,
6851
- overtimeOptions,
6852
- editorOptions,
6853
- initialValuesForCreate
6854
- } = {}) => {
6855
- var _a, _b, _c;
6856
- const editor = useRef(null);
6857
- const isFoldRef = useRef(false);
6858
- const { t } = useTranslation();
6859
- const [enableEditor, setEnableEditor] = useState(false);
6860
- const [isYamlValid, setIsYamlValid] = useState(true);
6861
- const [isSchemaValid, setIsSchemaValid] = useState(true);
6862
- const [editorErrors, setEditorErrors] = useState([]);
6863
- const [errorResponseBody, setErrorResponseBody] = useState(null);
6864
- const useResourceResult = useResource();
6865
- const { globalStore } = useGlobalStore();
6866
- const kit = useUIKit();
6867
- const {
6868
- schema,
6869
- loading: isLoadingSchema,
6870
- error: loadSchemaError,
6871
- fetchSchema
6872
- } = useSchema({
6873
- skip: editorOptions == null ? void 0 : editorOptions.isSkipSchema
6874
- });
6875
- const [formAnt] = kit.form.useForm();
6876
- const formSF = useForm({
6877
- form: formAnt
6878
- });
6879
- const { form } = formSF;
6880
- const { fold: fold2 } = useK8sYamlEditor();
6881
- const useFormCoreResult = useForm$1({
6882
- onMutationSuccess: onMutationSuccessProp ? onMutationSuccessProp : void 0,
6883
- onMutationError,
6884
- redirect,
6885
- action,
6886
- resource,
6887
- successNotification,
6888
- errorNotification,
6889
- meta: pickNotDeprecated(meta, metaData),
6890
- metaData: pickNotDeprecated(meta, metaData),
6891
- queryMeta,
6892
- mutationMeta,
6893
- liveMode,
6894
- liveParams,
6895
- mutationMode,
6896
- dataProviderName,
6897
- onLiveEvent,
6898
- invalidates,
6899
- undoableTimeout,
6900
- queryOptions,
6901
- createMutationOptions,
6902
- updateMutationOptions,
6903
- id: idFromProps,
6904
- overtimeOptions
6905
- });
6906
- const { formLoading, onFinish, queryResult, id } = useFormCoreResult;
6907
- const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = useWarnAboutChange();
6908
- const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
6909
- const initialValues = useMemo(() => {
6910
- var _a2;
6911
- const initialValues2 = ((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) ? globalStore == null ? void 0 : globalStore.restoreItem(queryResult.data.data) : initialValuesForCreate;
6912
- if (initialValues2) {
6913
- pruneBeforeEdit(initialValues2);
6914
- }
6915
- return initialValues2;
6916
- }, [queryResult, globalStore, initialValuesForCreate]);
6917
- React__default.useEffect(() => {
6918
- var _a2;
6919
- form.resetFields();
6920
- if (editor.current) {
6921
- const editorValue = yaml.dump(initialValues);
6922
- const editorInstance = editor.current.getEditorInstance();
6923
- editor.current.setEditorValue(editorValue);
6924
- editor.current.setValue(editorValue);
6925
- if (((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) && editorInstance && !isFoldRef.current) {
6926
- fold2(editorInstance);
6927
- isFoldRef.current = true;
6928
- }
6929
- }
6930
- }, [initialValues, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data, id, form, fold2]);
6931
- React__default.useEffect(() => {
6932
- var _a2, _b2;
6933
- const response = (_a2 = useFormCoreResult.mutationResult.error) == null ? void 0 : _a2.response;
6934
- if (response && !(response == null ? void 0 : response.bodyUsed)) {
6935
- (_b2 = response.json) == null ? void 0 : _b2.call(response).then((body) => {
6936
- setErrorResponseBody(body);
6937
6692
  });
6938
- }
6939
- }, [useFormCoreResult.mutationResult]);
6940
- const onKeyUp = (event2) => {
6941
- if (submitOnEnter && event2.key === "Enter") {
6942
- form.submit();
6943
- }
6944
- };
6945
- const onValuesChange = (changeValues) => {
6946
- if (changeValues && warnWhenUnsavedChanges) {
6947
- setWarnWhen(true);
6948
- }
6949
- return changeValues;
6950
- };
6951
- const saveButtonProps = useMemo(() => ({
6952
- loading: formLoading,
6953
- onClick: () => {
6954
- form.submit();
6955
- }
6956
- }), [formLoading, form]);
6957
- const editorProps = useMemo(() => {
6958
- var _a2;
6959
- return {
6960
- ref: editor,
6961
- defaultValue: schema && (editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations) ? generateYamlBySchema(initialValues || {}, schema) : yaml.dump(initialValues),
6962
- schema,
6963
- id: ((_a2 = useResourceResult.resource) == null ? void 0 : _a2.name) || "",
6964
- errorMsgs: editorErrors,
6965
- onValidate(yamlValid, schemaValid) {
6966
- setIsYamlValid(yamlValid);
6967
- setIsSchemaValid(schemaValid);
6968
- if (yamlValid && schemaValid) {
6969
- setEditorErrors([]);
6693
+ arrayEach(["initial", "tail"], function(methodName, index) {
6694
+ var dropName = "drop" + (index ? "" : "Right");
6695
+ LazyWrapper.prototype[methodName] = function() {
6696
+ return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
6697
+ };
6698
+ });
6699
+ LazyWrapper.prototype.compact = function() {
6700
+ return this.filter(identity);
6701
+ };
6702
+ LazyWrapper.prototype.find = function(predicate) {
6703
+ return this.filter(predicate).head();
6704
+ };
6705
+ LazyWrapper.prototype.findLast = function(predicate) {
6706
+ return this.reverse().find(predicate);
6707
+ };
6708
+ LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
6709
+ if (typeof path == "function") {
6710
+ return new LazyWrapper(this);
6970
6711
  }
6971
- },
6972
- onEditorCreate(editor2) {
6973
- var _a3;
6974
- if (((_a3 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a3.data) && !isFoldRef.current) {
6975
- fold2(editor2);
6976
- isFoldRef.current = true;
6712
+ return this.map(function(value) {
6713
+ return baseInvoke(value, path, args);
6714
+ });
6715
+ });
6716
+ LazyWrapper.prototype.reject = function(predicate) {
6717
+ return this.filter(negate(getIteratee(predicate)));
6718
+ };
6719
+ LazyWrapper.prototype.slice = function(start, end) {
6720
+ start = toInteger(start);
6721
+ var result2 = this;
6722
+ if (result2.__filtered__ && (start > 0 || end < 0)) {
6723
+ return new LazyWrapper(result2);
6724
+ }
6725
+ if (start < 0) {
6726
+ result2 = result2.takeRight(-start);
6727
+ } else if (start) {
6728
+ result2 = result2.drop(start);
6729
+ }
6730
+ if (end !== undefined$1) {
6731
+ end = toInteger(end);
6732
+ result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
6733
+ }
6734
+ return result2;
6735
+ };
6736
+ LazyWrapper.prototype.takeRightWhile = function(predicate) {
6737
+ return this.reverse().takeWhile(predicate).reverse();
6738
+ };
6739
+ LazyWrapper.prototype.toArray = function() {
6740
+ return this.take(MAX_ARRAY_LENGTH);
6741
+ };
6742
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
6743
+ var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash2[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
6744
+ if (!lodashFunc) {
6745
+ return;
6746
+ }
6747
+ lodash2.prototype[methodName] = function() {
6748
+ var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value);
6749
+ var interceptor = function(value2) {
6750
+ var result3 = lodashFunc.apply(lodash2, arrayPush([value2], args));
6751
+ return isTaker && chainAll ? result3[0] : result3;
6752
+ };
6753
+ if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
6754
+ isLazy = useLazy = false;
6755
+ }
6756
+ var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
6757
+ if (!retUnwrapped && useLazy) {
6758
+ value = onlyLazy ? value : new LazyWrapper(this);
6759
+ var result2 = func.apply(value, args);
6760
+ result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined$1 });
6761
+ return new LodashWrapper(result2, chainAll);
6762
+ }
6763
+ if (isUnwrapped && onlyLazy) {
6764
+ return func.apply(this, args);
6765
+ }
6766
+ result2 = this.thru(interceptor);
6767
+ return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
6768
+ };
6769
+ });
6770
+ arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
6771
+ var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
6772
+ lodash2.prototype[methodName] = function() {
6773
+ var args = arguments;
6774
+ if (retUnwrapped && !this.__chain__) {
6775
+ var value = this.value();
6776
+ return func.apply(isArray(value) ? value : [], args);
6777
+ }
6778
+ return this[chainName](function(value2) {
6779
+ return func.apply(isArray(value2) ? value2 : [], args);
6780
+ });
6781
+ };
6782
+ });
6783
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
6784
+ var lodashFunc = lodash2[methodName];
6785
+ if (lodashFunc) {
6786
+ var key = lodashFunc.name + "";
6787
+ if (!hasOwnProperty.call(realNames, key)) {
6788
+ realNames[key] = [];
6789
+ }
6790
+ realNames[key].push({ "name": methodName, "func": lodashFunc });
6977
6791
  }
6792
+ });
6793
+ realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
6794
+ "name": "wrapper",
6795
+ "func": undefined$1
6796
+ }];
6797
+ LazyWrapper.prototype.clone = lazyClone;
6798
+ LazyWrapper.prototype.reverse = lazyReverse;
6799
+ LazyWrapper.prototype.value = lazyValue;
6800
+ lodash2.prototype.at = wrapperAt;
6801
+ lodash2.prototype.chain = wrapperChain;
6802
+ lodash2.prototype.commit = wrapperCommit;
6803
+ lodash2.prototype.next = wrapperNext;
6804
+ lodash2.prototype.plant = wrapperPlant;
6805
+ lodash2.prototype.reverse = wrapperReverse;
6806
+ lodash2.prototype.toJSON = lodash2.prototype.valueOf = lodash2.prototype.value = wrapperValue;
6807
+ lodash2.prototype.first = lodash2.prototype.head;
6808
+ if (symIterator) {
6809
+ lodash2.prototype[symIterator] = wrapperToIterator;
6978
6810
  }
6811
+ return lodash2;
6979
6812
  };
6980
- }, [editorErrors, editorOptions, fold2, initialValues, (_b = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _b.data, schema, (_c = useResourceResult.resource) == null ? void 0 : _c.name]);
6981
- return {
6982
- form: formSF.form,
6983
- formProps: {
6984
- ...formSF.formProps,
6985
- onFinish: (values) => {
6986
- var _a2;
6987
- const errors = [
6988
- !isYamlValid ? t("dovetail.yaml_format_wrong") : "",
6989
- !isSchemaValid ? t("dovetail.yaml_value_wrong") : ""
6990
- ].filter((error) => !!error);
6991
- if (errors.length) {
6992
- setEditorErrors(errors);
6993
- return;
6994
- }
6995
- const finalValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
6996
- return onFinish(finalValues);
6997
- },
6998
- onKeyUp,
6999
- onValuesChange,
7000
- initialValues
7001
- },
7002
- saveButtonProps,
7003
- ...useFormCoreResult,
7004
- editorProps,
7005
- enableEditor,
7006
- errorResponseBody,
7007
- schema,
7008
- isLoadingSchema,
7009
- loadSchemaError,
7010
- fetchSchema,
7011
- switchEditor() {
7012
- var _a2, _b2;
7013
- if (enableEditor && ((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue())) {
7014
- const value = yaml.load((_b2 = editor.current) == null ? void 0 : _b2.getEditorValue());
7015
- form == null ? void 0 : form.setFieldsValue(value);
7016
- }
7017
- setEnableEditor(!enableEditor);
7018
- },
7019
- onFinish: async (values) => {
7020
- var _a2;
7021
- const finalValues = enableEditor ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values ?? formSF.form.getFieldsValue(true);
7022
- return await onFinish(finalValues);
7023
- }
7024
- };
7025
- };
7026
- const useDeleteModal = (resource) => {
7027
- const { mutate } = useDelete();
7028
- const [visible, setVisible] = useState(false);
7029
- const navigation = useNavigation();
7030
- const [id, setId] = useState("");
7031
- const { t } = useTranslation();
7032
- const modalProps = {
7033
- title: t("dovetail.delete"),
7034
- okText: t("dovetail.delete"),
7035
- okButtonProps: {
7036
- danger: true
7037
- },
7038
- cancelText: t("dovetail.cancel"),
7039
- children: t("dovetail.confirm_delete_text", {
7040
- target: id,
7041
- interpolation: { escapeValue: false }
7042
- }),
7043
- onOk() {
7044
- mutate({
7045
- resource,
7046
- id
7047
- });
7048
- setVisible(false);
7049
- navigation.list(resource);
7050
- },
7051
- onCancel() {
7052
- setVisible(false);
6813
+ var _ = runInContext();
6814
+ if (freeModule) {
6815
+ (freeModule.exports = _)._ = _;
6816
+ freeExports._ = _;
6817
+ } else {
6818
+ root._ = _;
7053
6819
  }
7054
- };
7055
- function openDeleteConfirmModal(id2) {
7056
- setId(id2);
7057
- setVisible(true);
6820
+ }).call(commonjsGlobal);
6821
+ })(lodash, lodash.exports);
6822
+ var lodashExports = lodash.exports;
6823
+ function generateValueFromSchema(schema, options) {
6824
+ var _a, _b, _c, _d, _e, _f, _g;
6825
+ const { generateValue } = options;
6826
+ if (!schema) {
6827
+ return {};
7058
6828
  }
7059
- return { modalProps, visible, openDeleteConfirmModal };
7060
- };
7061
- var cx = function cx2() {
7062
- const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean);
7063
- const atomicClasses = {};
7064
- const nonAtomicClasses = [];
7065
- presentClassNames.forEach((arg) => {
7066
- const individualClassNames = arg ? arg.split(" ") : [];
7067
- individualClassNames.forEach((className) => {
7068
- if (className.startsWith("atm_")) {
7069
- const [, keyHash] = className.split("_");
7070
- atomicClasses[keyHash] = className;
7071
- } else {
7072
- nonAtomicClasses.push(className);
6829
+ switch (true) {
6830
+ case (schema.type === "string" && "enum" in schema && Boolean((_a = schema.enum) == null ? void 0 : _a.length)):
6831
+ return (generateValue == null ? void 0 : generateValue(schema)) || ((_b = schema.enum) == null ? void 0 : _b[0]);
6832
+ case schema.type === "string":
6833
+ return (generateValue == null ? void 0 : generateValue(schema)) || "";
6834
+ case schema.type === "boolean":
6835
+ return (generateValue == null ? void 0 : generateValue(schema)) || false;
6836
+ case schema.type === "array":
6837
+ if (!schema.minItems || !schema.items || typeof schema.items === "boolean" || Array.isArray(schema.items)) {
6838
+ return (generateValue == null ? void 0 : generateValue(schema)) || [];
7073
6839
  }
7074
- });
7075
- });
7076
- const result = [];
7077
- for (const keyHash in atomicClasses) {
7078
- if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) {
7079
- result.push(atomicClasses[keyHash]);
6840
+ return new Array(schema.minItems).fill(
6841
+ generateValueFromSchema(schema.items, options)
6842
+ );
6843
+ case schema.type === "number":
6844
+ case schema.type === "integer":
6845
+ return (generateValue == null ? void 0 : generateValue(schema)) || 0;
6846
+ case schema.type === "object": {
6847
+ const obj = {};
6848
+ for (const key in schema.properties) {
6849
+ obj[key] = generateValueFromSchema(
6850
+ schema.properties[key],
6851
+ options
6852
+ );
6853
+ }
6854
+ return obj;
7080
6855
  }
6856
+ case (Array.isArray(schema.type) && "anyOf" in schema && Boolean((_c = schema.anyOf) == null ? void 0 : _c.length)):
6857
+ case (Array.isArray(schema.type) && "oneOf" in schema && Boolean((_d = schema.oneOf) == null ? void 0 : _d.length)): {
6858
+ const subSchema = (_e = schema.anyOf || schema.oneOf) == null ? void 0 : _e[0];
6859
+ return generateValueFromSchema(subSchema, options);
6860
+ }
6861
+ case ("allOf" in schema && Boolean((_f = schema.allOf) == null ? void 0 : _f.length)):
6862
+ return generateValueFromSchema((_g = schema.allOf) == null ? void 0 : _g[0], options);
6863
+ default:
6864
+ return void 0;
7081
6865
  }
7082
- result.push(...nonAtomicClasses);
7083
- return result.join(" ");
7084
- };
7085
- var cx_default = cx;
7086
- const index_hex8jv = "";
7087
- const BreadcrumbStyle = "b142d7q8";
7088
- function Breadcrumb(props) {
7089
- const {
7090
- breadcrumbs
7091
- } = useBreadcrumb();
7092
- return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
7093
- className: cx_default(BreadcrumbStyle, props.className),
7094
- children: breadcrumbs.map((breadcrumb) => {
7095
- return /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
7096
- className: "breadcrumb-item",
7097
- children: breadcrumb.href ? /* @__PURE__ */ jsxRuntimeExports.jsx(Link, {
7098
- to: breadcrumb.href,
7099
- children: breadcrumb.label
7100
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
7101
- children: breadcrumb.label
7102
- })
7103
- }, `breadcrumb-${breadcrumb.label}`);
7104
- })
7105
- });
7106
- }
7107
- function NameInputWidget(props) {
7108
- const kit = useUIKit();
7109
- const { action } = useResource();
7110
- return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.input, { ...props, disabled: action === "edit" });
7111
- }
7112
- const dnsSubDomainRules = [
7113
- {
7114
- required: true,
7115
- message: "名称不能为空"
7116
- },
7117
- {
7118
- pattern: /^[a-z0-9]([-.a-z0-9]*[a-z0-9])?$/,
7119
- message: "名称只能包含小写字母、数字,以及 '-' 和 '.',且必须以字母或数字开头和结束"
7120
- },
7121
- {
7122
- max: 253,
7123
- message: "名称长度不能超过253个字符"
7124
- }
7125
- ];
7126
- const rfc1123LabelRules = [
7127
- {
7128
- required: true,
7129
- message: "名称不能为空"
7130
- },
7131
- {
7132
- pattern: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
7133
- message: "名称只能包含小写字母、数字,以及 '-',且以字母或数字开头和结束"
7134
- },
7135
- {
7136
- max: 63,
7137
- message: "名称长度不能超过63个字符"
7138
- }
7139
- ];
7140
- const rfc1035LabelRules = [
7141
- {
7142
- required: true,
7143
- message: "名称不能为空"
7144
- },
7145
- {
7146
- pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
7147
- message: "名称只能包含小写字母、数字,以及 '-',且以字母开头,字母或数字结束"
7148
- },
7149
- {
7150
- max: 63,
7151
- message: "名称长度不能超过63个字符"
7152
- }
7153
- ];
7154
- function NamespaceSelectWidget(props) {
7155
- const kit = useUIKit();
7156
- const { action } = useResource();
7157
- const { data: data2 } = useList({
7158
- resource: "namespaces",
7159
- meta: {
7160
- resourceBasePath: "/api/v1",
7161
- kind: "Namespace"
6866
+ }
6867
+ function generateSchemaTypeValue(schema) {
6868
+ return generateValueFromSchema(schema, {
6869
+ generateValue(schema2) {
6870
+ if (schema2.type === "array" && schema2.items) {
6871
+ return generateSchemaTypeValue(schema2.items);
6872
+ } else {
6873
+ return schema2.type;
6874
+ }
7162
6875
  }
7163
6876
  });
7164
- return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.select, { input: props, disabled: action === "edit", children: data2 == null ? void 0 : data2.data.map((namespace2) => /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, { value: namespace2.metadata.name, children: namespace2.metadata.name }, namespace2.metadata.name)) });
7165
6877
  }
7166
- const namespaceRules = [
7167
- {
7168
- required: true,
7169
- message: "Please input the namespace."
6878
+ function resolveRef(schema, schemas, options) {
6879
+ var _a, _b;
6880
+ const { prune } = options;
6881
+ if (schema.$ref) {
6882
+ const refKey = schema.$ref.replace("#/components/schemas/", "");
6883
+ Object.assign(schema, schemas[refKey]);
6884
+ if (prune.metadata && [
6885
+ "io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta",
6886
+ "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
6887
+ ].some((k) => refKey.includes(k)) && schema.properties) {
6888
+ schema.properties = lodashExports.pick(schema.properties, [
6889
+ "name",
6890
+ "namespace",
6891
+ "annotations",
6892
+ "labels"
6893
+ ]);
6894
+ }
6895
+ delete schema.$ref;
7170
6896
  }
7171
- ];
7172
- function KeyValueInput(props) {
7173
- const { children, item } = props;
7174
- const kit = useUIKit();
7175
- const onKeyChange = useCallback(
7176
- (event2) => {
7177
- var _a;
7178
- const key = event2.target.value;
7179
- (_a = props.onChange) == null ? void 0 : _a.call(props, {
7180
- ...item,
7181
- key
7182
- });
7183
- },
7184
- [item, props]
7185
- );
7186
- const onValueChange = useCallback(
7187
- (event2) => {
7188
- var _a;
7189
- const value = event2.target.value;
7190
- (_a = props.onChange) == null ? void 0 : _a.call(props, {
7191
- ...item,
7192
- value
6897
+ for (const schemaKey in schema) {
6898
+ if (prune.xProperty && schemaKey.startsWith("x-") && schemaKey !== "x-kubernetes-group-version-kind") {
6899
+ delete schema[schemaKey];
6900
+ }
6901
+ }
6902
+ switch (true) {
6903
+ case schema.type === "array":
6904
+ if (Array.isArray(schema.items)) {
6905
+ schema.items.forEach((item) => resolveRef(item, schemas, options));
6906
+ } else if (typeof schema.items === "object") {
6907
+ resolveRef(schema.items, schemas, options);
6908
+ }
6909
+ break;
6910
+ case schema.type === "object":
6911
+ for (const key in schema.properties) {
6912
+ const subSchema = schema.properties[key];
6913
+ if (prune.optional && !((_a = schema.required) == null ? void 0 : _a.includes(key))) {
6914
+ delete schema.properties[key];
6915
+ }
6916
+ if (prune.fields.includes(key)) {
6917
+ delete schema.properties[key];
6918
+ }
6919
+ resolveRef(subSchema, schemas, options);
6920
+ }
6921
+ if (schema.additionalProperties) {
6922
+ resolveRef(schema.additionalProperties, schemas, options);
6923
+ }
6924
+ break;
6925
+ case !!(schema.allOf && schema.allOf[0]):
6926
+ resolveRef((_b = schema.allOf) == null ? void 0 : _b[0], schemas, options);
6927
+ }
6928
+ if (prune.description) {
6929
+ delete schema.description;
6930
+ }
6931
+ return schema;
6932
+ }
6933
+ class K8sOpenAPI {
6934
+ constructor(resourceBasePath) {
6935
+ __publicField(this, "response", null);
6936
+ __publicField(this, "apiVersion");
6937
+ this.resourceBasePath = resourceBasePath;
6938
+ this.apiVersion = getApiVersion(resourceBasePath);
6939
+ }
6940
+ async fetch() {
6941
+ const response = await fetch(
6942
+ `/api/sks/api/v1/clusters/sks-mgmt/proxy/openapi/v3${this.resourceBasePath}`
6943
+ );
6944
+ return response.json();
6945
+ }
6946
+ async findSchema(kind) {
6947
+ const result = this.response || await this.fetch();
6948
+ const schema = Object.values(result.components.schemas).find(
6949
+ (schema2) => {
6950
+ var _a;
6951
+ return (_a = schema2["x-kubernetes-group-version-kind"]) == null ? void 0 : _a.some(
6952
+ ({ kind: schemaKind, version: schemaVersion, group: schemaGroup }) => kind === schemaKind && this.apiVersion === `${schemaGroup ? schemaGroup + "/" : ""}${schemaVersion}`
6953
+ );
6954
+ }
6955
+ );
6956
+ if (schema) {
6957
+ resolveRef(schema, result.components.schemas, {
6958
+ prune: {
6959
+ description: true,
6960
+ optional: false,
6961
+ fields: [],
6962
+ metadata: true,
6963
+ xProperty: true
6964
+ }
7193
6965
  });
7194
- },
7195
- [item, props]
7196
- );
7197
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, { children: [
7198
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.input, { value: item.key, onChange: onKeyChange }),
7199
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.textArea, { value: item.value, onChange: onValueChange }),
7200
- children
7201
- ] });
6966
+ }
6967
+ return schema;
6968
+ }
7202
6969
  }
7203
- function KeyValueListWidget(props) {
7204
- const kit = useUIKit();
7205
- const { value } = props;
7206
- const items = useMemo(() => {
7207
- return Object.entries(value || {}).map(([key, value2]) => ({
7208
- key,
7209
- value: value2
7210
- }));
7211
- }, [value]);
7212
- const onChange = useCallback(
7213
- (newItems) => {
7214
- var _a;
7215
- const newValue = newItems.reduce((result, item) => {
7216
- result[item.key] = item.value;
7217
- return result;
7218
- }, {});
7219
- (_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
7220
- },
7221
- [props]
7222
- );
7223
- const onRemove = useCallback(
7224
- (index) => {
7225
- const result = [...items];
7226
- result.splice(index, 1);
7227
- onChange(result);
6970
+ function useSchema(options) {
6971
+ var _a;
6972
+ const [schema, setSchema] = useState(null);
6973
+ const [loading, setLoading] = useState(false);
6974
+ const [error, setError] = useState(null);
6975
+ const useResourceResult = useResource();
6976
+ const resource = (options == null ? void 0 : options.resource) || useResourceResult.resource;
6977
+ const openapi = useMemo(
6978
+ () => {
6979
+ var _a2;
6980
+ return new K8sOpenAPI((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath);
7228
6981
  },
7229
- [onChange, items]
6982
+ [(_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.resourceBasePath]
7230
6983
  );
7231
- const onAdd = useCallback(() => {
7232
- onChange([...items, { key: "", value: "" }]);
7233
- }, [onChange, items]);
7234
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
7235
- items.map((item, index) => {
7236
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
7237
- KeyValueInput,
7238
- {
7239
- item,
7240
- onChange: (newItem) => {
7241
- const temp = [...items];
7242
- temp.splice(index, 1, newItem);
7243
- onChange(temp);
7244
- },
7245
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
7246
- kit.button,
7247
- {
7248
- onClick: () => {
7249
- onRemove(index);
7250
- },
7251
- danger: true,
7252
- children: "Remove"
7253
- }
7254
- )
7255
- },
7256
- index
7257
- );
7258
- }),
7259
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, { type: "primary", onClick: onAdd, children: "Add" }) })
7260
- ] });
6984
+ const fetchSchema = useCallback(async () => {
6985
+ var _a2;
6986
+ setLoading(true);
6987
+ setError(null);
6988
+ try {
6989
+ const schema2 = await openapi.findSchema((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.kind);
6990
+ setSchema(schema2 || null);
6991
+ setError(null);
6992
+ } catch (e) {
6993
+ setError(e);
6994
+ } finally {
6995
+ setLoading(false);
6996
+ }
6997
+ }, [resource, openapi]);
6998
+ useEffect(() => {
6999
+ if (options == null ? void 0 : options.skip)
7000
+ return;
7001
+ fetchSchema();
7002
+ }, [fetchSchema]);
7003
+ return {
7004
+ schema,
7005
+ loading,
7006
+ error,
7007
+ fetchSchema
7008
+ };
7261
7009
  }
7262
- function MetadataForm() {
7263
- const kit = useUIKit();
7264
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
7265
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ jsxRuntimeExports.jsx(NameInputWidget, {}) }),
7266
- /* @__PURE__ */ jsxRuntimeExports.jsx(
7267
- kit.form.Item,
7268
- {
7269
- label: "Namespace",
7270
- name: ["metadata", "namespace"],
7271
- rules: namespaceRules,
7272
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(NamespaceSelectWidget, {})
7010
+ function generateYamlBySchema(defaultValue, schema) {
7011
+ const typeObject = generateSchemaTypeValue(schema);
7012
+ function makeAnnotations(obj, key) {
7013
+ const result = {};
7014
+ if (isObject(obj[key])) {
7015
+ result[`#${key}`] = {};
7016
+ Object.keys(obj[key]).forEach((prop) => {
7017
+ result[`#${key}`] = {
7018
+ ...result[`#${key}`],
7019
+ ...makeAnnotations(obj[key], prop)
7020
+ };
7021
+ });
7022
+ } else {
7023
+ result[`#${key}`] = obj[key];
7024
+ }
7025
+ return result;
7026
+ }
7027
+ function merge2(obj1, obj2, merged2 = {}) {
7028
+ for (const key in obj1) {
7029
+ merged2[key] = obj1[key];
7030
+ }
7031
+ for (const key in obj2) {
7032
+ if (key in obj1) {
7033
+ if (isObject(obj2[key]) && isObject(obj1[key])) {
7034
+ merged2[key] = merge2(
7035
+ obj1[key],
7036
+ obj2[key]
7037
+ );
7038
+ }
7039
+ } else {
7040
+ merged2 = {
7041
+ ...merged2,
7042
+ ...makeAnnotations(obj2, key)
7043
+ };
7273
7044
  }
7274
- ),
7275
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { name: ["metadata", "labels"], label: "Labels", children: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueListWidget, {}) }),
7276
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { name: ["metadata", "annotations"], label: "Annotations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueListWidget, {}) })
7277
- ] });
7045
+ }
7046
+ return merged2;
7047
+ }
7048
+ const merged = merge2(defaultValue, typeObject);
7049
+ const content = yaml.dump(merged);
7050
+ return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
7278
7051
  }
7279
- const copy$1 = "Copy";
7280
- const reset_arguments$1 = "Reset";
7281
- const view_changes$1 = "Show Diff";
7282
- const back_to_edit$1 = "Edit";
7283
- const configure_file$1 = "Configuration";
7284
- const yaml_format_wrong$1 = "Configuration is in an invalid YAML format.";
7285
- const yaml_value_wrong$1 = "Configuration has invalid values.";
7286
- const edit_yaml$1 = "Edit YAML";
7287
- const copied$1 = "Copied";
7288
- const already_reset$1 = "Already reset";
7289
- const fetch_schema_fail$1 = "Failed to fetch schema.";
7290
- const obtain_data_error$1 = "Having trouble getting data.";
7291
- const retry$1 = "Retry";
7292
- const create_resource$1 = "Create {{resource}}";
7293
- const edit_resource$1 = "Edit {{resource}}";
7294
- const dovetail$1 = {
7295
- copy: copy$1,
7296
- reset_arguments: reset_arguments$1,
7297
- view_changes: view_changes$1,
7298
- back_to_edit: back_to_edit$1,
7299
- configure_file: configure_file$1,
7300
- yaml_format_wrong: yaml_format_wrong$1,
7301
- yaml_value_wrong: yaml_value_wrong$1,
7302
- edit_yaml: edit_yaml$1,
7303
- copied: copied$1,
7304
- already_reset: already_reset$1,
7305
- fetch_schema_fail: fetch_schema_fail$1,
7306
- obtain_data_error: obtain_data_error$1,
7307
- retry: retry$1,
7308
- create_resource: create_resource$1,
7309
- edit_resource: edit_resource$1
7310
- };
7311
- const EN = {
7312
- dovetail: dovetail$1
7313
- };
7314
- const copy = "复制";
7315
- const reset_arguments = "重置";
7316
- const view_changes = "查看改动";
7317
- const back_to_edit = "编辑";
7318
- const configure_file = "配置内容";
7319
- const yaml_format_wrong = "配置内容不是有效的 yaml 格式。";
7320
- const yaml_value_wrong = "配置内容中存在不合法的值。";
7321
- const edit_yaml = "编辑 YAML";
7322
- const copied = "已复制";
7323
- const already_reset = "已重置";
7324
- const cancel = "取消";
7325
- const create = "创建";
7326
- const confirm_delete_text = "确定要删除 {{target}} 吗?";
7327
- const edit = "编辑";
7328
- const namespace = "名字空间";
7329
- const name = "名称";
7330
- const state = "状态";
7331
- const status = "状态";
7332
- const phase = "状态";
7333
- const image = "容器镜像";
7334
- const replicas = "副本数";
7335
- const created_time = "创建时间";
7336
- const label = "标签";
7337
- const annotation = "注释";
7338
- const type = "类型";
7339
- const event = "事件";
7340
- const reason = "原因";
7341
- const object = "对象";
7342
- const note$1 = "事件信息";
7343
- const condition = "Condition";
7344
- const download_yaml = "下载 YAML";
7345
- const detail = "详情";
7346
- const node_name = "主机名称";
7347
- const restarts = "重启次数";
7348
- const updated_time = "更新时间";
7349
- const message = "消息";
7350
- const save = "保存";
7351
- const more = "更多";
7352
- const workload = "工作负载";
7353
- const all_namespaces = "所有名字空间";
7354
- const empty = "无可显示的数据";
7355
- const schedule = "调度时间表";
7356
- const lastScheduleTime = "上次调度时间";
7357
- const duration = "持续时间";
7358
- const completions = "完成 Job 历史数";
7359
- const started = "开始时间";
7360
- const init_container = "初始化容器";
7361
- const container = "容器";
7362
- const redeploy = "重新部署";
7363
- const data = "数据";
7364
- const suspend = "暂停";
7365
- const resume = "重新开始";
7366
- const cluster = "集群";
7367
- const storage = "存储";
7368
- const network = "网络";
7369
- const clusterIp = "集群 IP";
7370
- const sessionAffinity = "会话保持";
7371
- const log = "日志";
7372
- const select_container = "选择容器";
7373
- const wrap = "折叠";
7374
- const resume_log = "继续";
7375
- const log_new_lines = ",并展示 {{ count }} 行新日志";
7376
- const fetch_schema_fail = "获取 schema 失败。";
7377
- const obtain_data_error = "获取数据时遇到问题。";
7378
- const retry = "重试";
7379
- const ready = "就绪";
7380
- const updating = "更新中";
7381
- const completed = "完成";
7382
- const failed = "异常";
7383
- const suspended = "挂起";
7384
- const running = "运行中";
7385
- const terminating = "终止";
7386
- const succeeded = "成功终止";
7387
- const unknown = "未知";
7388
- const pending = "待处理";
7389
- const waiting = "等待中";
7390
- const create_resource = "创建 {{resource}}";
7391
- const edit_resource = "编辑 {{resource}}";
7392
- const sec = "秒";
7393
- const min = "分";
7394
- const hr = "小时";
7395
- const day = "天";
7396
- const expand = "展开";
7397
- const fold = "收起";
7398
- const rule = "规则";
7399
- const default_backend = "默认后端";
7400
- const ingress_rule_type = "规则类型";
7401
- const port = "端口";
7402
- const dovetail = {
7403
- copy,
7404
- reset_arguments,
7405
- view_changes,
7406
- back_to_edit,
7407
- configure_file,
7408
- yaml_format_wrong,
7409
- yaml_value_wrong,
7410
- edit_yaml,
7411
- copied,
7412
- already_reset,
7413
- cancel,
7414
- "delete": "删除",
7415
- create,
7416
- confirm_delete_text,
7417
- edit,
7418
- namespace,
7419
- name,
7420
- state,
7421
- status,
7422
- phase,
7423
- image,
7424
- replicas,
7425
- created_time,
7426
- label,
7427
- annotation,
7428
- type,
7429
- event,
7430
- reason,
7431
- object,
7432
- note: note$1,
7433
- condition,
7434
- download_yaml,
7435
- detail,
7436
- node_name,
7437
- restarts,
7438
- updated_time,
7439
- message,
7440
- save,
7441
- more,
7442
- workload,
7443
- all_namespaces,
7444
- empty,
7445
- schedule,
7446
- lastScheduleTime,
7447
- duration,
7448
- completions,
7449
- started,
7450
- init_container,
7451
- container,
7452
- redeploy,
7453
- data,
7454
- suspend,
7455
- resume,
7456
- cluster,
7457
- storage,
7458
- network,
7459
- clusterIp,
7460
- sessionAffinity,
7461
- log,
7462
- select_container,
7463
- wrap,
7464
- resume_log,
7465
- log_new_lines,
7466
- fetch_schema_fail,
7467
- obtain_data_error,
7468
- retry,
7469
- ready,
7470
- updating,
7471
- completed,
7472
- failed,
7473
- suspended,
7474
- running,
7475
- terminating,
7476
- succeeded,
7477
- unknown,
7478
- pending,
7479
- waiting,
7480
- create_resource,
7481
- edit_resource,
7482
- sec,
7483
- min,
7484
- hr,
7485
- day,
7486
- expand,
7487
- fold,
7488
- rule,
7489
- default_backend,
7490
- ingress_rule_type,
7491
- port
7052
+ const GlobalStoreContext = createContext({});
7053
+ const useGlobalStore = () => {
7054
+ return useContext(GlobalStoreContext);
7492
7055
  };
7493
- const ZH = {
7494
- dovetail
7056
+ const useEagleForm = ({
7057
+ action,
7058
+ resource,
7059
+ onMutationSuccess: onMutationSuccessProp,
7060
+ onMutationError,
7061
+ submitOnEnter = false,
7062
+ warnWhenUnsavedChanges: warnWhenUnsavedChangesProp,
7063
+ redirect,
7064
+ successNotification,
7065
+ errorNotification,
7066
+ meta,
7067
+ metaData,
7068
+ queryMeta,
7069
+ mutationMeta,
7070
+ liveMode,
7071
+ liveParams,
7072
+ mutationMode,
7073
+ dataProviderName,
7074
+ onLiveEvent,
7075
+ invalidates,
7076
+ undoableTimeout,
7077
+ queryOptions,
7078
+ createMutationOptions,
7079
+ updateMutationOptions,
7080
+ id: idFromProps,
7081
+ overtimeOptions,
7082
+ editorOptions,
7083
+ initialValuesForCreate
7084
+ } = {}) => {
7085
+ var _a, _b, _c;
7086
+ const editor = useRef(null);
7087
+ const isFoldRef = useRef(false);
7088
+ const { t } = useTranslation();
7089
+ const [enableEditor, setEnableEditor] = useState(false);
7090
+ const [isYamlValid, setIsYamlValid] = useState(true);
7091
+ const [isSchemaValid, setIsSchemaValid] = useState(true);
7092
+ const [editorErrors, setEditorErrors] = useState([]);
7093
+ const [errorResponseBody, setErrorResponseBody] = useState(null);
7094
+ const useResourceResult = useResource();
7095
+ const { globalStore } = useGlobalStore();
7096
+ const kit = useUIKit();
7097
+ const {
7098
+ schema,
7099
+ loading: isLoadingSchema,
7100
+ error: loadSchemaError,
7101
+ fetchSchema
7102
+ } = useSchema({
7103
+ skip: editorOptions == null ? void 0 : editorOptions.isSkipSchema
7104
+ });
7105
+ const [formAnt] = kit.form.useForm();
7106
+ const formSF = useForm({
7107
+ form: formAnt
7108
+ });
7109
+ const { form } = formSF;
7110
+ const { fold: fold2 } = useK8sYamlEditor();
7111
+ const useFormCoreResult = useForm$1({
7112
+ onMutationSuccess: onMutationSuccessProp ? onMutationSuccessProp : void 0,
7113
+ onMutationError,
7114
+ redirect,
7115
+ action,
7116
+ resource,
7117
+ successNotification,
7118
+ errorNotification,
7119
+ meta: pickNotDeprecated(meta, metaData),
7120
+ metaData: pickNotDeprecated(meta, metaData),
7121
+ queryMeta,
7122
+ mutationMeta,
7123
+ liveMode,
7124
+ liveParams,
7125
+ mutationMode,
7126
+ dataProviderName,
7127
+ onLiveEvent,
7128
+ invalidates,
7129
+ undoableTimeout,
7130
+ queryOptions,
7131
+ createMutationOptions,
7132
+ updateMutationOptions,
7133
+ id: idFromProps,
7134
+ overtimeOptions
7135
+ });
7136
+ const { formLoading, onFinish, queryResult, id } = useFormCoreResult;
7137
+ const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = useWarnAboutChange();
7138
+ const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
7139
+ const initialValues = useMemo(() => {
7140
+ var _a2;
7141
+ const initialValues2 = ((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) ? globalStore == null ? void 0 : globalStore.restoreItem(queryResult.data.data) : initialValuesForCreate;
7142
+ if (initialValues2) {
7143
+ pruneBeforeEdit(initialValues2);
7144
+ }
7145
+ return initialValues2;
7146
+ }, [queryResult, globalStore, initialValuesForCreate]);
7147
+ React__default.useEffect(() => {
7148
+ var _a2;
7149
+ form.resetFields();
7150
+ if (editor.current) {
7151
+ const editorValue = yaml.dump(initialValues);
7152
+ const editorInstance = editor.current.getEditorInstance();
7153
+ editor.current.setEditorValue(editorValue);
7154
+ editor.current.setValue(editorValue);
7155
+ if (((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) && editorInstance && !isFoldRef.current) {
7156
+ fold2(editorInstance);
7157
+ isFoldRef.current = true;
7158
+ }
7159
+ }
7160
+ }, [initialValues, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data, id, form, fold2]);
7161
+ React__default.useEffect(() => {
7162
+ var _a2, _b2;
7163
+ const response = (_a2 = useFormCoreResult.mutationResult.error) == null ? void 0 : _a2.response;
7164
+ if (response && !(response == null ? void 0 : response.bodyUsed)) {
7165
+ (_b2 = response.json) == null ? void 0 : _b2.call(response).then((body) => {
7166
+ setErrorResponseBody(body);
7167
+ });
7168
+ }
7169
+ }, [useFormCoreResult.mutationResult]);
7170
+ const onKeyUp = (event2) => {
7171
+ if (submitOnEnter && event2.key === "Enter") {
7172
+ form.submit();
7173
+ }
7174
+ };
7175
+ const onValuesChange = (changeValues) => {
7176
+ if (changeValues && warnWhenUnsavedChanges) {
7177
+ setWarnWhen(true);
7178
+ }
7179
+ return changeValues;
7180
+ };
7181
+ const saveButtonProps = useMemo(() => ({
7182
+ loading: formLoading,
7183
+ onClick: () => {
7184
+ form.submit();
7185
+ }
7186
+ }), [formLoading, form]);
7187
+ const editorProps = useMemo(() => {
7188
+ var _a2;
7189
+ return {
7190
+ ref: editor,
7191
+ defaultValue: schema && (editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations) ? generateYamlBySchema(initialValues || {}, schema) : yaml.dump(initialValues),
7192
+ schema,
7193
+ id: ((_a2 = useResourceResult.resource) == null ? void 0 : _a2.name) || "",
7194
+ errorMsgs: editorErrors,
7195
+ onValidate(yamlValid, schemaValid) {
7196
+ setIsYamlValid(yamlValid);
7197
+ setIsSchemaValid(schemaValid);
7198
+ if (yamlValid && schemaValid) {
7199
+ setEditorErrors([]);
7200
+ }
7201
+ },
7202
+ onEditorCreate(editor2) {
7203
+ var _a3;
7204
+ if (((_a3 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a3.data) && !isFoldRef.current) {
7205
+ fold2(editor2);
7206
+ isFoldRef.current = true;
7207
+ }
7208
+ }
7209
+ };
7210
+ }, [editorErrors, editorOptions, fold2, initialValues, (_b = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _b.data, schema, (_c = useResourceResult.resource) == null ? void 0 : _c.name]);
7211
+ return {
7212
+ form: formSF.form,
7213
+ formProps: {
7214
+ ...formSF.formProps,
7215
+ onFinish: (values) => {
7216
+ var _a2;
7217
+ const errors = [
7218
+ !isYamlValid ? t("dovetail.yaml_format_wrong") : "",
7219
+ !isSchemaValid ? t("dovetail.yaml_value_wrong") : ""
7220
+ ].filter((error) => !!error);
7221
+ if (errors.length) {
7222
+ setEditorErrors(errors);
7223
+ return;
7224
+ }
7225
+ const finalValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
7226
+ return onFinish(finalValues);
7227
+ },
7228
+ onKeyUp,
7229
+ onValuesChange,
7230
+ initialValues
7231
+ },
7232
+ saveButtonProps,
7233
+ ...useFormCoreResult,
7234
+ editorProps,
7235
+ enableEditor,
7236
+ errorResponseBody,
7237
+ schema,
7238
+ isLoadingSchema,
7239
+ loadSchemaError,
7240
+ fetchSchema,
7241
+ switchEditor() {
7242
+ var _a2, _b2;
7243
+ if (enableEditor && ((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue())) {
7244
+ const value = yaml.load((_b2 = editor.current) == null ? void 0 : _b2.getEditorValue());
7245
+ form == null ? void 0 : form.setFieldsValue(value);
7246
+ }
7247
+ setEnableEditor(!enableEditor);
7248
+ },
7249
+ onFinish: async (values) => {
7250
+ var _a2;
7251
+ const finalValues = enableEditor ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values ?? formSF.form.getFieldsValue(true);
7252
+ return await onFinish(finalValues);
7253
+ }
7254
+ };
7495
7255
  };
7496
- const resources = {
7497
- "en-US": EN,
7498
- "zh-CN": ZH
7256
+ const useDeleteModal = (resource) => {
7257
+ const { mutate } = useDelete();
7258
+ const [visible, setVisible] = useState(false);
7259
+ const navigation = useNavigation();
7260
+ const [id, setId] = useState("");
7261
+ const { t } = useTranslation();
7262
+ const modalProps = {
7263
+ title: t("dovetail.delete"),
7264
+ okText: t("dovetail.delete"),
7265
+ okButtonProps: {
7266
+ danger: true
7267
+ },
7268
+ cancelText: t("dovetail.cancel"),
7269
+ children: t("dovetail.confirm_delete_text", {
7270
+ target: id,
7271
+ interpolation: { escapeValue: false }
7272
+ }),
7273
+ onOk() {
7274
+ mutate({
7275
+ resource,
7276
+ id
7277
+ });
7278
+ setVisible(false);
7279
+ navigation.list(resource);
7280
+ },
7281
+ onCancel() {
7282
+ setVisible(false);
7283
+ }
7284
+ };
7285
+ function openDeleteConfirmModal(id2) {
7286
+ setId(id2);
7287
+ setVisible(true);
7288
+ }
7289
+ return { modalProps, visible, openDeleteConfirmModal };
7290
+ };
7291
+ var cx = function cx2() {
7292
+ const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean);
7293
+ const atomicClasses = {};
7294
+ const nonAtomicClasses = [];
7295
+ presentClassNames.forEach((arg) => {
7296
+ const individualClassNames = arg ? arg.split(" ") : [];
7297
+ individualClassNames.forEach((className) => {
7298
+ if (className.startsWith("atm_")) {
7299
+ const [, keyHash] = className.split("_");
7300
+ atomicClasses[keyHash] = className;
7301
+ } else {
7302
+ nonAtomicClasses.push(className);
7303
+ }
7304
+ });
7305
+ });
7306
+ const result = [];
7307
+ for (const keyHash in atomicClasses) {
7308
+ if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) {
7309
+ result.push(atomicClasses[keyHash]);
7310
+ }
7311
+ }
7312
+ result.push(...nonAtomicClasses);
7313
+ return result.join(" ");
7499
7314
  };
7500
- i18n.use(initReactI18next).init({
7501
- supportedLngs: ["en-US", "zh-CN"],
7502
- resources,
7503
- ns: Object.keys(resources["zh-CN"]),
7504
- defaultNS: "dovetail",
7505
- fallbackLng: ["en-US", "zh-CN"],
7506
- lng: "zh-CN",
7507
- nsSeparator: "."
7508
- });
7315
+ var cx_default = cx;
7316
+ const index_hex8jv = "";
7317
+ const BreadcrumbStyle = "b142d7q8";
7318
+ function Breadcrumb(props) {
7319
+ const {
7320
+ breadcrumbs
7321
+ } = useBreadcrumb();
7322
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
7323
+ className: cx_default(BreadcrumbStyle, props.className),
7324
+ children: breadcrumbs.map((breadcrumb) => {
7325
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
7326
+ className: "breadcrumb-item",
7327
+ children: breadcrumb.href ? /* @__PURE__ */ jsxRuntimeExports.jsx(Link, {
7328
+ to: breadcrumb.href,
7329
+ children: breadcrumb.label
7330
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
7331
+ children: breadcrumb.label
7332
+ })
7333
+ }, `breadcrumb-${breadcrumb.label}`);
7334
+ })
7335
+ });
7336
+ }
7337
+ function NameInputWidget(props) {
7338
+ const kit = useUIKit();
7339
+ const { action } = useResource();
7340
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.input, { ...props, disabled: action === "edit" });
7341
+ }
7342
+ const dnsSubDomainRules = [
7343
+ {
7344
+ required: true,
7345
+ message: "名称不能为空"
7346
+ },
7347
+ {
7348
+ pattern: /^[a-z0-9]([-.a-z0-9]*[a-z0-9])?$/,
7349
+ message: "名称只能包含小写字母、数字,以及 '-' 和 '.',且必须以字母或数字开头和结束"
7350
+ },
7351
+ {
7352
+ max: 253,
7353
+ message: "名称长度不能超过253个字符"
7354
+ }
7355
+ ];
7356
+ const rfc1123LabelRules = [
7357
+ {
7358
+ required: true,
7359
+ message: "名称不能为空"
7360
+ },
7361
+ {
7362
+ pattern: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
7363
+ message: "名称只能包含小写字母、数字,以及 '-',且以字母或数字开头和结束"
7364
+ },
7365
+ {
7366
+ max: 63,
7367
+ message: "名称长度不能超过63个字符"
7368
+ }
7369
+ ];
7370
+ const rfc1035LabelRules = [
7371
+ {
7372
+ required: true,
7373
+ message: "名称不能为空"
7374
+ },
7375
+ {
7376
+ pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
7377
+ message: "名称只能包含小写字母、数字,以及 '-',且以字母开头,字母或数字结束"
7378
+ },
7379
+ {
7380
+ max: 63,
7381
+ message: "名称长度不能超过63个字符"
7382
+ }
7383
+ ];
7384
+ function NamespaceSelectWidget(props) {
7385
+ const kit = useUIKit();
7386
+ const { action } = useResource();
7387
+ const { data: data2 } = useList({
7388
+ resource: "namespaces",
7389
+ meta: {
7390
+ resourceBasePath: "/api/v1",
7391
+ kind: "Namespace"
7392
+ }
7393
+ });
7394
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.select, { input: props, disabled: action === "edit", children: data2 == null ? void 0 : data2.data.map((namespace2) => /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, { value: namespace2.metadata.name, children: namespace2.metadata.name }, namespace2.metadata.name)) });
7395
+ }
7396
+ const namespaceRules = [
7397
+ {
7398
+ required: true,
7399
+ message: "Please input the namespace."
7400
+ }
7401
+ ];
7402
+ function KeyValueInput(props) {
7403
+ const { children, item } = props;
7404
+ const kit = useUIKit();
7405
+ const onKeyChange = useCallback(
7406
+ (event2) => {
7407
+ var _a;
7408
+ const key = event2.target.value;
7409
+ (_a = props.onChange) == null ? void 0 : _a.call(props, {
7410
+ ...item,
7411
+ key
7412
+ });
7413
+ },
7414
+ [item, props]
7415
+ );
7416
+ const onValueChange = useCallback(
7417
+ (event2) => {
7418
+ var _a;
7419
+ const value = event2.target.value;
7420
+ (_a = props.onChange) == null ? void 0 : _a.call(props, {
7421
+ ...item,
7422
+ value
7423
+ });
7424
+ },
7425
+ [item, props]
7426
+ );
7427
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, { children: [
7428
+ /* @__PURE__ */ jsxRuntimeExports.jsx(kit.input, { value: item.key, onChange: onKeyChange }),
7429
+ /* @__PURE__ */ jsxRuntimeExports.jsx(kit.textArea, { value: item.value, onChange: onValueChange }),
7430
+ children
7431
+ ] });
7432
+ }
7433
+ function KeyValueListWidget(props) {
7434
+ const kit = useUIKit();
7435
+ const { value } = props;
7436
+ const items = useMemo(() => {
7437
+ return Object.entries(value || {}).map(([key, value2]) => ({
7438
+ key,
7439
+ value: value2
7440
+ }));
7441
+ }, [value]);
7442
+ const onChange = useCallback(
7443
+ (newItems) => {
7444
+ var _a;
7445
+ const newValue = newItems.reduce((result, item) => {
7446
+ result[item.key] = item.value;
7447
+ return result;
7448
+ }, {});
7449
+ (_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
7450
+ },
7451
+ [props]
7452
+ );
7453
+ const onRemove = useCallback(
7454
+ (index) => {
7455
+ const result = [...items];
7456
+ result.splice(index, 1);
7457
+ onChange(result);
7458
+ },
7459
+ [onChange, items]
7460
+ );
7461
+ const onAdd = useCallback(() => {
7462
+ onChange([...items, { key: "", value: "" }]);
7463
+ }, [onChange, items]);
7464
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
7465
+ items.map((item, index) => {
7466
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
7467
+ KeyValueInput,
7468
+ {
7469
+ item,
7470
+ onChange: (newItem) => {
7471
+ const temp = [...items];
7472
+ temp.splice(index, 1, newItem);
7473
+ onChange(temp);
7474
+ },
7475
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
7476
+ kit.button,
7477
+ {
7478
+ onClick: () => {
7479
+ onRemove(index);
7480
+ },
7481
+ danger: true,
7482
+ children: "Remove"
7483
+ }
7484
+ )
7485
+ },
7486
+ index
7487
+ );
7488
+ }),
7489
+ /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, { type: "primary", onClick: onAdd, children: "Add" }) })
7490
+ ] });
7491
+ }
7492
+ function MetadataForm() {
7493
+ const kit = useUIKit();
7494
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
7495
+ /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ jsxRuntimeExports.jsx(NameInputWidget, {}) }),
7496
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
7497
+ kit.form.Item,
7498
+ {
7499
+ label: "Namespace",
7500
+ name: ["metadata", "namespace"],
7501
+ rules: namespaceRules,
7502
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(NamespaceSelectWidget, {})
7503
+ }
7504
+ ),
7505
+ /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { name: ["metadata", "labels"], label: "Labels", children: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueListWidget, {}) }),
7506
+ /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, { name: ["metadata", "annotations"], label: "Annotations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueListWidget, {}) })
7507
+ ] });
7508
+ }
7509
7509
  function addId(arr, idKey) {
7510
7510
  return arr.map((e) => {
7511
7511
  return {
@@ -9856,7 +9856,7 @@ const ErrorMsgStyle = "eh2qjnl";
9856
9856
  const ErrorWrapperStyle = "e19q2bnp";
9857
9857
  const YamlEditorStyle = "y16u5v3w";
9858
9858
  const MonacoYamlEditor$2 = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$1));
9859
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-b1abdc2e.js"));
9859
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-fd7edf86.js"));
9860
9860
  const YamlEditorComponent = forwardRef(
9861
9861
  function YamlEditorComponent2(props, ref) {
9862
9862
  const {
@@ -11762,7 +11762,7 @@ const ShowContent = (props) => {
11762
11762
  });
11763
11763
  }
11764
11764
  }];
11765
- const state2 = get(record, ["status", "phase"]);
11765
+ const stateDisplay = get(record, "stateDisplay");
11766
11766
  const topBar = /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
11767
11767
  className: TopBarStyle,
11768
11768
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
@@ -11772,9 +11772,9 @@ const ShowContent = (props) => {
11772
11772
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11773
11773
  className: Typo.Label.l1_regular,
11774
11774
  children: (_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name
11775
- }), state2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
11775
+ }), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
11776
11776
  className: StateTagStyle,
11777
- state: state2
11777
+ state: stateDisplay
11778
11778
  }) : void 0]
11779
11779
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
11780
11780
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs(kit.radioGroup, {
@@ -18286,6 +18286,84 @@ const PodLog = ({
18286
18286
  })]
18287
18287
  });
18288
18288
  };
18289
+ const NetworkPolicyRulesTable = ({ ingressOrEgress }) => {
18290
+ const result = ingressOrEgress == null ? void 0 : ingressOrEgress.map((gress, i) => {
18291
+ const peers = get(gress, "from") || get(gress, "to");
18292
+ if (!peers)
18293
+ return null;
18294
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(IngressRuleTable, { peers }, i);
18295
+ });
18296
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: result });
18297
+ };
18298
+ const IngressRuleTable = ({ peers }) => {
18299
+ const kit = useUIKit();
18300
+ const { t } = useTranslation();
18301
+ const rows = useMemo(() => {
18302
+ const rows2 = (peers == null ? void 0 : peers.map((p) => {
18303
+ return Object.keys(p).map((key) => {
18304
+ return {
18305
+ type: key,
18306
+ ...p[key]
18307
+ };
18308
+ });
18309
+ })) || [];
18310
+ return addId(flatten(rows2), "type");
18311
+ }, [peers]);
18312
+ const columns = [
18313
+ {
18314
+ key: "type",
18315
+ display: true,
18316
+ dataIndex: "type",
18317
+ title: t("dovetail.type"),
18318
+ sortable: true
18319
+ },
18320
+ {
18321
+ key: "cidr",
18322
+ display: true,
18323
+ dataIndex: "cidr",
18324
+ title: "CIDR",
18325
+ sortable: true,
18326
+ render(v) {
18327
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: v || "-" });
18328
+ }
18329
+ },
18330
+ {
18331
+ key: "except",
18332
+ display: true,
18333
+ dataIndex: "except",
18334
+ title: "Except",
18335
+ sortable: true,
18336
+ render: (except) => {
18337
+ if (!except)
18338
+ return "-";
18339
+ return except == null ? void 0 : except.map((str) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: str }, str));
18340
+ }
18341
+ },
18342
+ {
18343
+ key: "matchLabels",
18344
+ display: true,
18345
+ dataIndex: "matchLabels",
18346
+ title: "Match Labels",
18347
+ sortable: true,
18348
+ render(matchLabels) {
18349
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Tags, { value: matchLabels });
18350
+ }
18351
+ }
18352
+ ];
18353
+ if (rows.length === 0) {
18354
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, { errorText: t("dovetail.empty"), style: { padding: "15px 0" } });
18355
+ }
18356
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18357
+ kit.table,
18358
+ {
18359
+ loading: false,
18360
+ dataSource: rows,
18361
+ columns,
18362
+ rowKey: "type",
18363
+ empty: t("dovetail.empty")
18364
+ }
18365
+ );
18366
+ };
18289
18367
  const IngressRulesComponent = ({ ingress }) => {
18290
18368
  const kit = useUIKit();
18291
18369
  const result = ingress.flattenedRules.map((r) => {
@@ -19241,122 +19319,125 @@ class RelationPlugin {
19241
19319
  }
19242
19320
  const relationPlugin = new RelationPlugin();
19243
19321
  const ProviderPlugins = [relationPlugin, modelPlugin];
19322
+ const DovetailRefineI18n = i18n;
19244
19323
  export {
19245
- Layout as $,
19324
+ DeleteButton as $,
19246
19325
  AgeColumnRenderer as A,
19247
19326
  Breadcrumb as B,
19248
19327
  CommonSorter as C,
19249
- DurationColumnRenderer as D,
19250
- CreateButton as E,
19251
- ImageNames as F,
19252
- ResourceList as G,
19253
- ResourceShow as H,
19328
+ DovetailRefineI18n as D,
19329
+ WorkloadDropdown as E,
19330
+ CreateButton as F,
19331
+ ImageNames as G,
19332
+ ResourceList as H,
19254
19333
  IngressRulesColumnRenderer as I,
19255
- ResourceForm as J,
19334
+ ResourceShow as J,
19256
19335
  KeyValueListWidget as K,
19257
- ResourceCRUD as L,
19336
+ ResourceForm as L,
19258
19337
  MetadataForm as M,
19259
19338
  NameColumnRenderer as N,
19260
- WorkloadPodsTable as O,
19339
+ ResourceCRUD as O,
19261
19340
  PodWorkloadColumnRenderer as P,
19262
- CronJobDropdown as Q,
19341
+ WorkloadPodsTable as Q,
19263
19342
  ReplicasColumnRenderer as R,
19264
19343
  StateDisplayColumnRenderer as S,
19265
- ResourceUsageBar as T,
19266
- WorkloadReplicas as U,
19267
- CronjobJobsTable as V,
19344
+ CronJobDropdown as T,
19345
+ ResourceUsageBar as U,
19346
+ WorkloadReplicas as V,
19268
19347
  WorkloadImageColumnRenderer as W,
19269
- KeyValue as X,
19270
- Separator as Y,
19271
- YamlEditorComponent as Z,
19272
- DeleteButton as _,
19348
+ CronjobJobsTable as X,
19349
+ KeyValue as Y,
19350
+ Separator as Z,
19351
+ YamlEditorComponent as _,
19273
19352
  useDeleteModal as a,
19274
- ImageField as a0,
19275
- ReplicaField as a1,
19276
- ConditionsField as a2,
19277
- PodsField as a3,
19278
- JobsField as a4,
19279
- DataField as a5,
19280
- SecretDataField as a6,
19281
- StartTimeField as a7,
19282
- ServiceTypeField as a8,
19283
- ClusterIpField as a9,
19284
- STATEFULSET_INIT_VALUE as aA,
19285
- POD_INIT_VALUE as aB,
19286
- SERVICE_INIT_VALUE as aC,
19287
- INGRESS_INIT_VALUE as aD,
19288
- NETWORK_POLICY_INIT_VALUE as aE,
19289
- TIMESTAMP_LABEL as aF,
19290
- WorkloadState as aG,
19291
- Dovetail as aH,
19292
- RESOURCE_GROUP as aI,
19293
- FormType as aJ,
19294
- ComponentContext as aK,
19295
- GlobalStoreContext as aL,
19296
- ConfigsContext as aM,
19297
- IngressModel as aN,
19298
- NetworkPolicyModel as aO,
19299
- JobModel as aP,
19300
- WorkloadModel as aQ,
19301
- WorkloadBaseModel as aR,
19302
- PodModel as aS,
19303
- PodMetricsModel as aT,
19304
- ResourceModel as aU,
19305
- CronJobModel as aV,
19306
- EventModel as aW,
19307
- DeploymentModel as aX,
19308
- DaemonSetModel as aY,
19309
- StatefulSetModel as aZ,
19310
- ProviderPlugins as a_,
19311
- SessionAffinityField as aa,
19312
- ServicePodsField as ab,
19313
- IngressRulesTableTabField as ac,
19314
- EventsTableTabField as ad,
19315
- ShowContent as ae,
19316
- SchemaStrategy as af,
19317
- DeleteManyButton as ag,
19318
- ListPage as ah,
19319
- StateTag as ai,
19320
- DrawerShow as aj,
19321
- Menu as ak,
19322
- EditButton as al,
19323
- ReferenceLink as am,
19324
- ResourceLink as an,
19325
- NS_STORE_KEY as ao,
19326
- ALL_NS as ap,
19327
- useNamespacesFilter as aq,
19328
- NamespacesFilter as ar,
19329
- Tags as as,
19330
- PodLog as at,
19331
- FormModal as au,
19332
- BASE_INIT_VALUE as av,
19333
- DEPLOYMENT_INIT_VALUE as aw,
19334
- CRONJOB_INIT_VALUE as ax,
19335
- DAEMONSET_INIT_VALUE as ay,
19336
- JOB_INIT_VALUE as az,
19353
+ StatefulSetModel as a$,
19354
+ Layout as a0,
19355
+ ImageField as a1,
19356
+ ReplicaField as a2,
19357
+ ConditionsField as a3,
19358
+ PodsField as a4,
19359
+ JobsField as a5,
19360
+ DataField as a6,
19361
+ SecretDataField as a7,
19362
+ StartTimeField as a8,
19363
+ ServiceTypeField as a9,
19364
+ DAEMONSET_INIT_VALUE as aA,
19365
+ JOB_INIT_VALUE as aB,
19366
+ STATEFULSET_INIT_VALUE as aC,
19367
+ POD_INIT_VALUE as aD,
19368
+ SERVICE_INIT_VALUE as aE,
19369
+ INGRESS_INIT_VALUE as aF,
19370
+ NETWORK_POLICY_INIT_VALUE as aG,
19371
+ TIMESTAMP_LABEL as aH,
19372
+ WorkloadState as aI,
19373
+ Dovetail as aJ,
19374
+ RESOURCE_GROUP as aK,
19375
+ FormType as aL,
19376
+ ComponentContext as aM,
19377
+ GlobalStoreContext as aN,
19378
+ ConfigsContext as aO,
19379
+ IngressModel as aP,
19380
+ NetworkPolicyModel as aQ,
19381
+ JobModel as aR,
19382
+ WorkloadModel as aS,
19383
+ WorkloadBaseModel as aT,
19384
+ PodModel as aU,
19385
+ PodMetricsModel as aV,
19386
+ ResourceModel as aW,
19387
+ CronJobModel as aX,
19388
+ EventModel as aY,
19389
+ DeploymentModel as aZ,
19390
+ DaemonSetModel as a_,
19391
+ ClusterIpField as aa,
19392
+ SessionAffinityField as ab,
19393
+ ServicePodsField as ac,
19394
+ IngressRulesTableTabField as ad,
19395
+ EventsTableTabField as ae,
19396
+ ShowContent as af,
19397
+ SchemaStrategy as ag,
19398
+ DeleteManyButton as ah,
19399
+ ListPage as ai,
19400
+ StateTag as aj,
19401
+ DrawerShow as ak,
19402
+ Menu as al,
19403
+ EditButton as am,
19404
+ ReferenceLink as an,
19405
+ ResourceLink as ao,
19406
+ NS_STORE_KEY as ap,
19407
+ ALL_NS as aq,
19408
+ useNamespacesFilter as ar,
19409
+ NamespacesFilter as as,
19410
+ Tags as at,
19411
+ PodLog as au,
19412
+ FormModal as av,
19413
+ NetworkPolicyRulesTable as aw,
19414
+ BASE_INIT_VALUE as ax,
19415
+ DEPLOYMENT_INIT_VALUE as ay,
19416
+ CRONJOB_INIT_VALUE as az,
19337
19417
  NameSpaceColumnRenderer as b,
19418
+ ProviderPlugins as b0,
19338
19419
  WorkloadRestartsColumnRenderer as c,
19339
19420
  NodeNameColumnRenderer as d,
19340
19421
  RestartCountColumnRenderer as e,
19341
19422
  CompletionsCountColumnRenderer as f,
19342
- ServiceTypeColumnRenderer as g,
19343
- IngressDefaultBackendColumnRenderer as h,
19344
- ColumnKeys as i,
19423
+ DurationColumnRenderer as g,
19424
+ ServiceTypeColumnRenderer as h,
19425
+ IngressDefaultBackendColumnRenderer as i,
19345
19426
  jsxRuntimeExports as j,
19346
- useEagleTable as k,
19347
- useDownloadYAML as l,
19348
- useEdit as m,
19349
- useGlobalStore as n,
19350
- NameInputWidget as o,
19351
- dnsSubDomainRules as p,
19352
- rfc1123LabelRules as q,
19427
+ ColumnKeys as k,
19428
+ useEagleTable as l,
19429
+ useDownloadYAML as m,
19430
+ useEdit as n,
19431
+ useGlobalStore as o,
19432
+ NameInputWidget as p,
19433
+ dnsSubDomainRules as q,
19353
19434
  routerProvider as r,
19354
- rfc1035LabelRules as s,
19355
- NamespaceSelectWidget as t,
19435
+ rfc1123LabelRules as s,
19436
+ rfc1035LabelRules as t,
19356
19437
  useSchema as u,
19357
- namespaceRules as v,
19358
- PageShow as w,
19359
- ConditionsTable as x,
19360
- PodContainersTable as y,
19361
- WorkloadDropdown as z
19438
+ NamespaceSelectWidget as v,
19439
+ namespaceRules as w,
19440
+ PageShow as x,
19441
+ ConditionsTable as y,
19442
+ PodContainersTable as z
19362
19443
  };