@dovetail-v2/refine 0.0.12 → 0.0.13

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.
@@ -10,15 +10,14 @@ import { parse, stringify } from "qs";
10
10
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
11
11
  import { useUIKit, Typo, Icon, kitContext } from "@cloudtower/eagle";
12
12
  import yaml from "js-yaml";
13
- import { isObject, get, merge, cloneDeep, set } from "lodash-es";
13
+ import { relationPlugin, GlobalStore, dataProvider, liveProvider } from "k8s-api-provider";
14
+ import { isObject, get, merge, cloneDeep, set, omit as omit$1 } from "lodash-es";
14
15
  import { useForm } from "sunflower-antd";
15
16
  import { EditPen16PrimaryIcon, TrashBinDelete16Icon, Download16GradientBlueIcon, MoreEllipsis316BoldBlueIcon, SettingsGear16GradientGrayIcon, CheckmarkDoneSuccessCorrect16BoldGreenIcon, XmarkFailed16BoldRedIcon, DynamicResourceSchedule16BlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, Retry16GradientBlueIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, VmResume16Icon, SuspendedPause16GradientGrayIcon } from "@cloudtower/icons-react";
16
17
  import * as monaco from "monaco-editor";
17
18
  import { setDiagnosticsOptions } from "monaco-yaml";
18
19
  import ReactDOM from "react-dom";
19
20
  import { Drawer } from "antd";
20
- import require$$0 from "ky";
21
- import require$$2 from "mitt";
22
21
  import i18n from "i18next";
23
22
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
24
23
  var jsxRuntime = { exports: {} };
@@ -36,28 +35,28 @@ function requireReactJsxRuntime_production_min() {
36
35
  if (hasRequiredReactJsxRuntime_production_min)
37
36
  return reactJsxRuntime_production_min;
38
37
  hasRequiredReactJsxRuntime_production_min = 1;
39
- var f2 = React, g = 60103;
38
+ var f = React, g = 60103;
40
39
  reactJsxRuntime_production_min.Fragment = 60107;
41
40
  if ("function" === typeof Symbol && Symbol.for) {
42
41
  var h = Symbol.for;
43
42
  g = h("react.element");
44
43
  reactJsxRuntime_production_min.Fragment = h("react.fragment");
45
44
  }
46
- var m = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
47
- function q2(c, a, k2) {
48
- var b2, d2 = {}, e = null, l = null;
49
- void 0 !== k2 && (e = "" + k2);
45
+ 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 };
46
+ function q(c, a, k) {
47
+ var b, d = {}, e = null, l = null;
48
+ void 0 !== k && (e = "" + k);
50
49
  void 0 !== a.key && (e = "" + a.key);
51
50
  void 0 !== a.ref && (l = a.ref);
52
- for (b2 in a)
53
- n.call(a, b2) && !p.hasOwnProperty(b2) && (d2[b2] = a[b2]);
51
+ for (b in a)
52
+ n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
54
53
  if (c && c.defaultProps)
55
- for (b2 in a = c.defaultProps, a)
56
- void 0 === d2[b2] && (d2[b2] = a[b2]);
57
- return { $$typeof: g, type: c, key: e, ref: l, props: d2, _owner: m.current };
54
+ for (b in a = c.defaultProps, a)
55
+ void 0 === d[b] && (d[b] = a[b]);
56
+ return { $$typeof: g, type: c, key: e, ref: l, props: d, _owner: m.current };
58
57
  }
59
- reactJsxRuntime_production_min.jsx = q2;
60
- reactJsxRuntime_production_min.jsxs = q2;
58
+ reactJsxRuntime_production_min.jsx = q;
59
+ reactJsxRuntime_production_min.jsxs = q;
61
60
  return reactJsxRuntime_production_min;
62
61
  }
63
62
  var reactJsxRuntime_development = {};
@@ -268,7 +267,7 @@ function requireReactJsxRuntime_development() {
268
267
  currentlyValidatingElement = element;
269
268
  }
270
269
  }
271
- function checkPropTypes(typeSpecs, values, location2, componentName, element) {
270
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
272
271
  {
273
272
  var has = Function.call.bind(Object.prototype.hasOwnProperty);
274
273
  for (var typeSpecName in typeSpecs) {
@@ -276,23 +275,23 @@ function requireReactJsxRuntime_development() {
276
275
  var error$1 = void 0;
277
276
  try {
278
277
  if (typeof typeSpecs[typeSpecName] !== "function") {
279
- var err = Error((componentName || "React class") + ": " + location2 + " 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`.");
278
+ 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`.");
280
279
  err.name = "Invariant Violation";
281
280
  throw err;
282
281
  }
283
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location2, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
282
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
284
283
  } catch (ex) {
285
284
  error$1 = ex;
286
285
  }
287
286
  if (error$1 && !(error$1 instanceof Error)) {
288
287
  setCurrentlyValidatingElement(element);
289
- 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", location2, typeSpecName, typeof error$1);
288
+ 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);
290
289
  setCurrentlyValidatingElement(null);
291
290
  }
292
291
  if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
293
292
  loggedTypeFailures[error$1.message] = true;
294
293
  setCurrentlyValidatingElement(element);
295
- error("Failed %s type: %s", location2, error$1.message);
294
+ error("Failed %s type: %s", location, error$1.message);
296
295
  setCurrentlyValidatingElement(null);
297
296
  }
298
297
  }
@@ -774,20 +773,6 @@ const routerProvider = {
774
773
  return /* @__PURE__ */ jsxRuntime.exports.jsx(Link, { ...props, ref });
775
774
  })
776
775
  };
777
- function _extends() {
778
- _extends = Object.assign ? Object.assign.bind() : function(target) {
779
- for (var i = 1; i < arguments.length; i++) {
780
- var source = arguments[i];
781
- for (var key in source) {
782
- if (Object.prototype.hasOwnProperty.call(source, key)) {
783
- target[key] = source[key];
784
- }
785
- }
786
- }
787
- return target;
788
- };
789
- return _extends.apply(this, arguments);
790
- }
791
776
  function warn() {
792
777
  if (console && console.warn) {
793
778
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -968,12 +953,12 @@ function useTranslation(ns) {
968
953
  i18n2.reportNamespaces = new ReportNamespaces();
969
954
  if (!i18n2) {
970
955
  warnOnce("You will need to pass in an i18next instance by using initReactI18next");
971
- const notReadyT = (k2, optsOrDefaultValue) => {
956
+ const notReadyT = (k, optsOrDefaultValue) => {
972
957
  if (typeof optsOrDefaultValue === "string")
973
958
  return optsOrDefaultValue;
974
959
  if (optsOrDefaultValue && typeof optsOrDefaultValue === "object" && typeof optsOrDefaultValue.defaultValue === "string")
975
960
  return optsOrDefaultValue.defaultValue;
976
- return Array.isArray(k2) ? k2[k2.length - 1] : k2;
961
+ return Array.isArray(k) ? k[k.length - 1] : k;
977
962
  };
978
963
  const retNotReady = [notReadyT, {}, false];
979
964
  retNotReady.t = notReadyT;
@@ -1067,16 +1052,52 @@ function useTranslation(ns) {
1067
1052
  }
1068
1053
  });
1069
1054
  }
1055
+ function useK8sYamlEditor() {
1056
+ function foldSymbol(editor, symbol) {
1057
+ const model = editor.getModel();
1058
+ const matchs = (model == null ? void 0 : model.findMatches(
1059
+ symbol,
1060
+ false,
1061
+ false,
1062
+ false,
1063
+ "",
1064
+ false
1065
+ ).filter((match) => match.range.startColumn === 1)) || [];
1066
+ return new Promise(async (resolve, reject) => {
1067
+ try {
1068
+ for (const match of matchs) {
1069
+ const lineNumber = match.range.startLineNumber;
1070
+ editor.setPosition({ lineNumber, column: 1 });
1071
+ await editor.getAction("editor.fold").run();
1072
+ }
1073
+ resolve(null);
1074
+ } catch (e) {
1075
+ reject(e);
1076
+ }
1077
+ });
1078
+ }
1079
+ async function fold(editor) {
1080
+ await editor.getAction("editor.unfoldAll").run();
1081
+ const symbols = [
1082
+ " annotations:",
1083
+ " managedFields:",
1084
+ "status:",
1085
+ " kubectl.kubernetes.io/last-applied-configuration:"
1086
+ ];
1087
+ for (const symbol of symbols) {
1088
+ await foldSymbol(editor, symbol);
1089
+ }
1090
+ editor.setScrollPosition({ scrollTop: 0 });
1091
+ }
1092
+ return {
1093
+ fold
1094
+ };
1095
+ }
1070
1096
  function getApiVersion(resourceBasePath) {
1071
1097
  return resourceBasePath.replace(/^(\/api\/)|(\/apis\/)/, "");
1072
1098
  }
1073
- function pruneBeforeEdit(v2) {
1074
- var _a, _b;
1075
- delete v2.id;
1076
- (_a = v2.metadata) == null ? true : delete _a.managedFields;
1077
- if ((_b = v2.metadata) == null ? void 0 : _b.annotations) {
1078
- delete v2.metadata.annotations["kubectl.kubernetes.io/last-applied-configuration"];
1079
- }
1099
+ function pruneBeforeEdit(v) {
1100
+ delete v.id;
1080
1101
  }
1081
1102
  var lodash = { exports: {} };
1082
1103
  /**
@@ -1773,7 +1794,7 @@ var lodash = { exports: {} };
1773
1794
  return string.match(reUnicodeWord) || [];
1774
1795
  }
1775
1796
  var runInContext = function runInContext2(context) {
1776
- context = context == null ? root : _2.defaults(root.Object(), context, _2.pick(root, contextProps));
1797
+ context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
1777
1798
  var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
1778
1799
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
1779
1800
  var coreJsData = context["__core-js_shared__"];
@@ -3039,7 +3060,7 @@ var lodash = { exports: {} };
3039
3060
  end = end === undefined$1 ? length : end;
3040
3061
  return !start && end >= length ? array : baseSlice(array, start, end);
3041
3062
  }
3042
- var clearTimeout2 = ctxClearTimeout || function(id) {
3063
+ var clearTimeout = ctxClearTimeout || function(id) {
3043
3064
  return root.clearTimeout(id);
3044
3065
  };
3045
3066
  function cloneBuffer(buffer, isDeep) {
@@ -4910,7 +4931,7 @@ var lodash = { exports: {} };
4910
4931
  }
4911
4932
  function cancel2() {
4912
4933
  if (timerId !== undefined$1) {
4913
- clearTimeout2(timerId);
4934
+ clearTimeout(timerId);
4914
4935
  }
4915
4936
  lastInvokeTime = 0;
4916
4937
  lastArgs = lastCallTime = lastThis = timerId = undefined$1;
@@ -4928,7 +4949,7 @@ var lodash = { exports: {} };
4928
4949
  return leadingEdge(lastCallTime);
4929
4950
  }
4930
4951
  if (maxing) {
4931
- clearTimeout2(timerId);
4952
+ clearTimeout(timerId);
4932
4953
  timerId = setTimeout2(timerExpired, wait);
4933
4954
  return invokeFunc(lastCallTime);
4934
4955
  }
@@ -5989,9 +6010,9 @@ var lodash = { exports: {} };
5989
6010
  }
5990
6011
  return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
5991
6012
  }
5992
- function uniqueId(prefix2) {
6013
+ function uniqueId(prefix) {
5993
6014
  var id = ++idCounter;
5994
- return toString(prefix2) + id;
6015
+ return toString(prefix) + id;
5995
6016
  }
5996
6017
  var add = createMathOperation(function(augend, addend) {
5997
6018
  return augend + addend;
@@ -6507,12 +6528,12 @@ var lodash = { exports: {} };
6507
6528
  }
6508
6529
  return lodash2;
6509
6530
  };
6510
- var _2 = runInContext();
6531
+ var _ = runInContext();
6511
6532
  if (freeModule) {
6512
- (freeModule.exports = _2)._ = _2;
6513
- freeExports._ = _2;
6533
+ (freeModule.exports = _)._ = _;
6534
+ freeExports._ = _;
6514
6535
  } else {
6515
- root._ = _2;
6536
+ root._ = _;
6516
6537
  }
6517
6538
  }).call(commonjsGlobal);
6518
6539
  })(lodash, lodash.exports);
@@ -6580,7 +6601,7 @@ function resolveRef(schema, schemas, options) {
6580
6601
  if (prune.metadata && [
6581
6602
  "io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta",
6582
6603
  "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
6583
- ].some((k2) => refKey.includes(k2)) && schema.properties) {
6604
+ ].some((k) => refKey.includes(k)) && schema.properties) {
6584
6605
  schema.properties = lodash.exports.pick(schema.properties, [
6585
6606
  "name",
6586
6607
  "namespace",
@@ -6754,8 +6775,9 @@ const useEagleForm = ({
6754
6775
  overtimeOptions,
6755
6776
  editorOptions
6756
6777
  } = {}) => {
6757
- var _a, _b, _c, _d;
6778
+ var _a, _b, _c;
6758
6779
  const editor = useRef(null);
6780
+ const isFoldRef = useRef(false);
6759
6781
  const { t } = useTranslation();
6760
6782
  const [enableEditor, setEnableEditor] = useState(false);
6761
6783
  const [isYamlValid, setIsYamlValid] = useState(true);
@@ -6770,6 +6792,7 @@ const useEagleForm = ({
6770
6792
  form: formAnt
6771
6793
  });
6772
6794
  const { form } = formSF;
6795
+ const { fold } = useK8sYamlEditor();
6773
6796
  const useFormCoreResult = useForm$1({
6774
6797
  onMutationSuccess: onMutationSuccessProp ? onMutationSuccessProp : void 0,
6775
6798
  onMutationError,
@@ -6799,13 +6822,19 @@ const useEagleForm = ({
6799
6822
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = useWarnAboutChange();
6800
6823
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp != null ? warnWhenUnsavedChangesProp : warnWhenUnsavedChangesRefine;
6801
6824
  React.useEffect(() => {
6825
+ var _a2;
6802
6826
  form.resetFields();
6803
6827
  if (editor.current) {
6804
6828
  const editorValue = yaml.dump(form.getFieldsValue(true));
6829
+ const editorInstance = editor.current.getEditorInstance();
6805
6830
  editor.current.setEditorValue(editorValue);
6806
6831
  editor.current.setValue(editorValue);
6832
+ if (((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) && editorInstance && !isFoldRef.current) {
6833
+ fold(editorInstance);
6834
+ isFoldRef.current = true;
6835
+ }
6807
6836
  }
6808
- }, [(_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data, id, form]);
6837
+ }, [(_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data, id, form, fold]);
6809
6838
  React.useEffect(() => {
6810
6839
  var _a2, _b2;
6811
6840
  const response = (_a2 = useFormCoreResult.mutationResult.error) == null ? void 0 : _a2.response;
@@ -6844,10 +6873,17 @@ const useEagleForm = ({
6844
6873
  if (yamlValid && schemaValid) {
6845
6874
  setEditorErrors([]);
6846
6875
  }
6876
+ },
6877
+ onEditorCreate(editor2) {
6878
+ var _a2;
6879
+ if (((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) && !isFoldRef.current) {
6880
+ fold(editor2);
6881
+ isFoldRef.current = true;
6882
+ }
6847
6883
  }
6848
6884
  };
6849
6885
  const initialValues = ((_c = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _c.data) ? {
6850
- ...(_d = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _d.data
6886
+ ...relationPlugin.restoreItem(queryResult.data.data)
6851
6887
  } : void 0;
6852
6888
  if (initialValues) {
6853
6889
  pruneBeforeEdit(initialValues);
@@ -6859,8 +6895,8 @@ const useEagleForm = ({
6859
6895
  onFinish: (values) => {
6860
6896
  var _a2;
6861
6897
  const errors = [
6862
- !isYamlValid && t("dovetail.yaml_format_wrong"),
6863
- !isSchemaValid && t("dovetail.yaml_value_wrong")
6898
+ !isYamlValid ? t("dovetail.yaml_format_wrong") : "",
6899
+ !isSchemaValid ? t("dovetail.yaml_value_wrong") : ""
6864
6900
  ].filter((error) => !!error);
6865
6901
  if (errors.length) {
6866
6902
  setEditorErrors(errors);
@@ -6996,13 +7032,13 @@ var dayjs_min = { exports: {} };
6996
7032
  !function(t, e) {
6997
7033
  module.exports = e();
6998
7034
  }(commonjsGlobal, function() {
6999
- var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f2 = "quarter", h = "year", d2 = "date", l = "Invalid Date", $2 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
7035
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
7000
7036
  var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
7001
7037
  return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
7002
7038
  } }, m = function(t2, e2, n2) {
7003
7039
  var r2 = String(t2);
7004
7040
  return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
7005
- }, v2 = { s: m, z: function(t2) {
7041
+ }, v = { s: m, z: function(t2) {
7006
7042
  var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
7007
7043
  return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
7008
7044
  }, m: function t2(e2, n2) {
@@ -7013,53 +7049,53 @@ var dayjs_min = { exports: {} };
7013
7049
  }, a: function(t2) {
7014
7050
  return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
7015
7051
  }, p: function(t2) {
7016
- return { M: c, y: h, w: o, d: a, D: d2, h: u, m: s, s: i, ms: r, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
7052
+ return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
7017
7053
  }, u: function(t2) {
7018
7054
  return void 0 === t2;
7019
- } }, g = "en", D2 = {};
7020
- D2[g] = M2;
7021
- var p = "$isDayjsObject", S2 = function(t2) {
7022
- return t2 instanceof _2 || !(!t2 || !t2[p]);
7023
- }, w2 = function t2(e2, n2, r2) {
7055
+ } }, g = "en", D = {};
7056
+ D[g] = M;
7057
+ var p = "$isDayjsObject", S = function(t2) {
7058
+ return t2 instanceof _ || !(!t2 || !t2[p]);
7059
+ }, w = function t2(e2, n2, r2) {
7024
7060
  var i2;
7025
7061
  if (!e2)
7026
7062
  return g;
7027
7063
  if ("string" == typeof e2) {
7028
7064
  var s2 = e2.toLowerCase();
7029
- D2[s2] && (i2 = s2), n2 && (D2[s2] = n2, i2 = s2);
7065
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
7030
7066
  var u2 = e2.split("-");
7031
7067
  if (!i2 && u2.length > 1)
7032
7068
  return t2(u2[0]);
7033
7069
  } else {
7034
7070
  var a2 = e2.name;
7035
- D2[a2] = e2, i2 = a2;
7071
+ D[a2] = e2, i2 = a2;
7036
7072
  }
7037
7073
  return !r2 && i2 && (g = i2), i2 || !r2 && g;
7038
7074
  }, O = function(t2, e2) {
7039
- if (S2(t2))
7075
+ if (S(t2))
7040
7076
  return t2.clone();
7041
7077
  var n2 = "object" == typeof e2 ? e2 : {};
7042
- return n2.date = t2, n2.args = arguments, new _2(n2);
7043
- }, b2 = v2;
7044
- b2.l = w2, b2.i = S2, b2.w = function(t2, e2) {
7078
+ return n2.date = t2, n2.args = arguments, new _(n2);
7079
+ }, b = v;
7080
+ b.l = w, b.i = S, b.w = function(t2, e2) {
7045
7081
  return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
7046
7082
  };
7047
- var _2 = function() {
7048
- function M3(t2) {
7049
- this.$L = w2(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
7083
+ var _ = function() {
7084
+ function M2(t2) {
7085
+ this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
7050
7086
  }
7051
- var m2 = M3.prototype;
7087
+ var m2 = M2.prototype;
7052
7088
  return m2.parse = function(t2) {
7053
7089
  this.$d = function(t3) {
7054
7090
  var e2 = t3.date, n2 = t3.utc;
7055
7091
  if (null === e2)
7056
7092
  return new Date(NaN);
7057
- if (b2.u(e2))
7093
+ if (b.u(e2))
7058
7094
  return new Date();
7059
7095
  if (e2 instanceof Date)
7060
7096
  return new Date(e2);
7061
7097
  if ("string" == typeof e2 && !/Z$/i.test(e2)) {
7062
- var r2 = e2.match($2);
7098
+ var r2 = e2.match($);
7063
7099
  if (r2) {
7064
7100
  var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
7065
7101
  return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
@@ -7071,7 +7107,7 @@ var dayjs_min = { exports: {} };
7071
7107
  var t2 = this.$d;
7072
7108
  this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
7073
7109
  }, m2.$utils = function() {
7074
- return b2;
7110
+ return b;
7075
7111
  }, m2.isValid = function() {
7076
7112
  return !(this.$d.toString() === l);
7077
7113
  }, m2.isSame = function(t2, e2) {
@@ -7082,94 +7118,94 @@ var dayjs_min = { exports: {} };
7082
7118
  }, m2.isBefore = function(t2, e2) {
7083
7119
  return this.endOf(e2) < O(t2);
7084
7120
  }, m2.$g = function(t2, e2, n2) {
7085
- return b2.u(t2) ? this[e2] : this.set(n2, t2);
7121
+ return b.u(t2) ? this[e2] : this.set(n2, t2);
7086
7122
  }, m2.unix = function() {
7087
7123
  return Math.floor(this.valueOf() / 1e3);
7088
7124
  }, m2.valueOf = function() {
7089
7125
  return this.$d.getTime();
7090
7126
  }, m2.startOf = function(t2, e2) {
7091
- var n2 = this, r2 = !!b2.u(e2) || e2, f3 = b2.p(t2), l2 = function(t3, e3) {
7092
- var i2 = b2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
7127
+ var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
7128
+ var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
7093
7129
  return r2 ? i2 : i2.endOf(a);
7094
- }, $3 = function(t3, e3) {
7095
- return b2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
7096
- }, y3 = this.$W, M4 = this.$M, m3 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
7097
- switch (f3) {
7130
+ }, $2 = function(t3, e3) {
7131
+ return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
7132
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
7133
+ switch (f2) {
7098
7134
  case h:
7099
7135
  return r2 ? l2(1, 0) : l2(31, 11);
7100
7136
  case c:
7101
- return r2 ? l2(1, M4) : l2(0, M4 + 1);
7137
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
7102
7138
  case o:
7103
- var g2 = this.$locale().weekStart || 0, D3 = (y3 < g2 ? y3 + 7 : y3) - g2;
7104
- return l2(r2 ? m3 - D3 : m3 + (6 - D3), M4);
7139
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
7140
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
7105
7141
  case a:
7106
- case d2:
7107
- return $3(v3 + "Hours", 0);
7142
+ case d:
7143
+ return $2(v2 + "Hours", 0);
7108
7144
  case u:
7109
- return $3(v3 + "Minutes", 1);
7145
+ return $2(v2 + "Minutes", 1);
7110
7146
  case s:
7111
- return $3(v3 + "Seconds", 2);
7147
+ return $2(v2 + "Seconds", 2);
7112
7148
  case i:
7113
- return $3(v3 + "Milliseconds", 3);
7149
+ return $2(v2 + "Milliseconds", 3);
7114
7150
  default:
7115
7151
  return this.clone();
7116
7152
  }
7117
7153
  }, m2.endOf = function(t2) {
7118
7154
  return this.startOf(t2, false);
7119
7155
  }, m2.$set = function(t2, e2) {
7120
- var n2, o2 = b2.p(t2), f3 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f3 + "Date", n2[d2] = f3 + "Date", n2[c] = f3 + "Month", n2[h] = f3 + "FullYear", n2[u] = f3 + "Hours", n2[s] = f3 + "Minutes", n2[i] = f3 + "Seconds", n2[r] = f3 + "Milliseconds", n2)[o2], $3 = o2 === a ? this.$D + (e2 - this.$W) : e2;
7156
+ var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
7121
7157
  if (o2 === c || o2 === h) {
7122
- var y3 = this.clone().set(d2, 1);
7123
- y3.$d[l2]($3), y3.init(), this.$d = y3.set(d2, Math.min(this.$D, y3.daysInMonth())).$d;
7158
+ var y2 = this.clone().set(d, 1);
7159
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
7124
7160
  } else
7125
- l2 && this.$d[l2]($3);
7161
+ l2 && this.$d[l2]($2);
7126
7162
  return this.init(), this;
7127
7163
  }, m2.set = function(t2, e2) {
7128
7164
  return this.clone().$set(t2, e2);
7129
7165
  }, m2.get = function(t2) {
7130
- return this[b2.p(t2)]();
7131
- }, m2.add = function(r2, f3) {
7132
- var d3, l2 = this;
7166
+ return this[b.p(t2)]();
7167
+ }, m2.add = function(r2, f2) {
7168
+ var d2, l2 = this;
7133
7169
  r2 = Number(r2);
7134
- var $3 = b2.p(f3), y3 = function(t2) {
7170
+ var $2 = b.p(f2), y2 = function(t2) {
7135
7171
  var e2 = O(l2);
7136
- return b2.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
7172
+ return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
7137
7173
  };
7138
- if ($3 === c)
7174
+ if ($2 === c)
7139
7175
  return this.set(c, this.$M + r2);
7140
- if ($3 === h)
7176
+ if ($2 === h)
7141
7177
  return this.set(h, this.$y + r2);
7142
- if ($3 === a)
7143
- return y3(1);
7144
- if ($3 === o)
7145
- return y3(7);
7146
- var M4 = (d3 = {}, d3[s] = e, d3[u] = n, d3[i] = t, d3)[$3] || 1, m3 = this.$d.getTime() + r2 * M4;
7147
- return b2.w(m3, this);
7178
+ if ($2 === a)
7179
+ return y2(1);
7180
+ if ($2 === o)
7181
+ return y2(7);
7182
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
7183
+ return b.w(m3, this);
7148
7184
  }, m2.subtract = function(t2, e2) {
7149
7185
  return this.add(-1 * t2, e2);
7150
7186
  }, m2.format = function(t2) {
7151
7187
  var e2 = this, n2 = this.$locale();
7152
7188
  if (!this.isValid())
7153
7189
  return n2.invalidDate || l;
7154
- var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b2.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f3 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
7190
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
7155
7191
  return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
7156
- }, d3 = function(t3) {
7157
- return b2.s(s2 % 12 || 12, t3, "0");
7158
- }, $3 = f3 || function(t3, e3, n3) {
7192
+ }, d2 = function(t3) {
7193
+ return b.s(s2 % 12 || 12, t3, "0");
7194
+ }, $2 = f2 || function(t3, e3, n3) {
7159
7195
  var r3 = t3 < 12 ? "AM" : "PM";
7160
7196
  return n3 ? r3.toLowerCase() : r3;
7161
7197
  };
7162
- return r2.replace(y2, function(t3, r3) {
7198
+ return r2.replace(y, function(t3, r3) {
7163
7199
  return r3 || function(t4) {
7164
7200
  switch (t4) {
7165
7201
  case "YY":
7166
7202
  return String(e2.$y).slice(-2);
7167
7203
  case "YYYY":
7168
- return b2.s(e2.$y, 4, "0");
7204
+ return b.s(e2.$y, 4, "0");
7169
7205
  case "M":
7170
7206
  return a2 + 1;
7171
7207
  case "MM":
7172
- return b2.s(a2 + 1, 2, "0");
7208
+ return b.s(a2 + 1, 2, "0");
7173
7209
  case "MMM":
7174
7210
  return h2(n2.monthsShort, a2, c2, 3);
7175
7211
  case "MMMM":
@@ -7177,7 +7213,7 @@ var dayjs_min = { exports: {} };
7177
7213
  case "D":
7178
7214
  return e2.$D;
7179
7215
  case "DD":
7180
- return b2.s(e2.$D, 2, "0");
7216
+ return b.s(e2.$D, 2, "0");
7181
7217
  case "d":
7182
7218
  return String(e2.$W);
7183
7219
  case "dd":
@@ -7189,25 +7225,25 @@ var dayjs_min = { exports: {} };
7189
7225
  case "H":
7190
7226
  return String(s2);
7191
7227
  case "HH":
7192
- return b2.s(s2, 2, "0");
7228
+ return b.s(s2, 2, "0");
7193
7229
  case "h":
7194
- return d3(1);
7230
+ return d2(1);
7195
7231
  case "hh":
7196
- return d3(2);
7232
+ return d2(2);
7197
7233
  case "a":
7198
- return $3(s2, u2, true);
7234
+ return $2(s2, u2, true);
7199
7235
  case "A":
7200
- return $3(s2, u2, false);
7236
+ return $2(s2, u2, false);
7201
7237
  case "m":
7202
7238
  return String(u2);
7203
7239
  case "mm":
7204
- return b2.s(u2, 2, "0");
7240
+ return b.s(u2, 2, "0");
7205
7241
  case "s":
7206
7242
  return String(e2.$s);
7207
7243
  case "ss":
7208
- return b2.s(e2.$s, 2, "0");
7244
+ return b.s(e2.$s, 2, "0");
7209
7245
  case "SSS":
7210
- return b2.s(e2.$ms, 3, "0");
7246
+ return b.s(e2.$ms, 3, "0");
7211
7247
  case "Z":
7212
7248
  return i2;
7213
7249
  }
@@ -7216,50 +7252,50 @@ var dayjs_min = { exports: {} };
7216
7252
  });
7217
7253
  }, m2.utcOffset = function() {
7218
7254
  return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
7219
- }, m2.diff = function(r2, d3, l2) {
7220
- var $3, y3 = this, M4 = b2.p(d3), m3 = O(r2), v3 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D3 = function() {
7221
- return b2.m(y3, m3);
7255
+ }, m2.diff = function(r2, d2, l2) {
7256
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
7257
+ return b.m(y2, m3);
7222
7258
  };
7223
- switch (M4) {
7259
+ switch (M3) {
7224
7260
  case h:
7225
- $3 = D3() / 12;
7261
+ $2 = D2() / 12;
7226
7262
  break;
7227
7263
  case c:
7228
- $3 = D3();
7264
+ $2 = D2();
7229
7265
  break;
7230
- case f2:
7231
- $3 = D3() / 3;
7266
+ case f:
7267
+ $2 = D2() / 3;
7232
7268
  break;
7233
7269
  case o:
7234
- $3 = (g2 - v3) / 6048e5;
7270
+ $2 = (g2 - v2) / 6048e5;
7235
7271
  break;
7236
7272
  case a:
7237
- $3 = (g2 - v3) / 864e5;
7273
+ $2 = (g2 - v2) / 864e5;
7238
7274
  break;
7239
7275
  case u:
7240
- $3 = g2 / n;
7276
+ $2 = g2 / n;
7241
7277
  break;
7242
7278
  case s:
7243
- $3 = g2 / e;
7279
+ $2 = g2 / e;
7244
7280
  break;
7245
7281
  case i:
7246
- $3 = g2 / t;
7282
+ $2 = g2 / t;
7247
7283
  break;
7248
7284
  default:
7249
- $3 = g2;
7285
+ $2 = g2;
7250
7286
  }
7251
- return l2 ? $3 : b2.a($3);
7287
+ return l2 ? $2 : b.a($2);
7252
7288
  }, m2.daysInMonth = function() {
7253
7289
  return this.endOf(c).$D;
7254
7290
  }, m2.$locale = function() {
7255
- return D2[this.$L];
7291
+ return D[this.$L];
7256
7292
  }, m2.locale = function(t2, e2) {
7257
7293
  if (!t2)
7258
7294
  return this.$L;
7259
- var n2 = this.clone(), r2 = w2(t2, e2, true);
7295
+ var n2 = this.clone(), r2 = w(t2, e2, true);
7260
7296
  return r2 && (n2.$L = r2), n2;
7261
7297
  }, m2.clone = function() {
7262
- return b2.w(this.$d, this);
7298
+ return b.w(this.$d, this);
7263
7299
  }, m2.toDate = function() {
7264
7300
  return new Date(this.valueOf());
7265
7301
  }, m2.toJSON = function() {
@@ -7268,17 +7304,17 @@ var dayjs_min = { exports: {} };
7268
7304
  return this.$d.toISOString();
7269
7305
  }, m2.toString = function() {
7270
7306
  return this.$d.toUTCString();
7271
- }, M3;
7272
- }(), k2 = _2.prototype;
7273
- return O.prototype = k2, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d2]].forEach(function(t2) {
7274
- k2[t2[1]] = function(e2) {
7307
+ }, M2;
7308
+ }(), k = _.prototype;
7309
+ return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
7310
+ k[t2[1]] = function(e2) {
7275
7311
  return this.$g(e2, t2[0], t2[1]);
7276
7312
  };
7277
7313
  }), O.extend = function(t2, e2) {
7278
- return t2.$i || (t2(e2, _2, O), t2.$i = true), O;
7279
- }, O.locale = w2, O.isDayjs = S2, O.unix = function(t2) {
7314
+ return t2.$i || (t2(e2, _, O), t2.$i = true), O;
7315
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
7280
7316
  return O(1e3 * t2);
7281
- }, O.en = D2[g], O.Ls = D2, O.p = {}, O;
7317
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
7282
7318
  });
7283
7319
  })(dayjs_min);
7284
7320
  const dayjs = dayjs_min.exports;
@@ -7329,13 +7365,13 @@ const WorkloadReplicas = ({
7329
7365
  const canScale = record.kind === "Deployment" || record.kind === "StatefulSet";
7330
7366
  const currentReplicas = get(record, "spec.replicas", 0);
7331
7367
  const scale = (delta) => {
7332
- const v2 = record.scale(currentReplicas + delta);
7333
- const id = v2.id;
7334
- pruneBeforeEdit(v2);
7368
+ const v = record.scale(currentReplicas + delta);
7369
+ const id = v.id;
7370
+ pruneBeforeEdit(v);
7335
7371
  mutate({
7336
7372
  id,
7337
7373
  resource: (resource == null ? void 0 : resource.name) || "",
7338
- values: v2
7374
+ values: v
7339
7375
  });
7340
7376
  };
7341
7377
  return /* @__PURE__ */ jsxRuntime.exports.jsxs("span", {
@@ -7378,9 +7414,9 @@ const NameLink = (props) => {
7378
7414
  }
7379
7415
  );
7380
7416
  };
7381
- const CommonSorter = (dataIndex) => (a, b2) => {
7417
+ const CommonSorter = (dataIndex) => (a, b) => {
7382
7418
  const valA = lodash.exports.get(a, dataIndex);
7383
- const valB = lodash.exports.get(b2, dataIndex);
7419
+ const valB = lodash.exports.get(b, dataIndex);
7384
7420
  if (valA === valB)
7385
7421
  return 0;
7386
7422
  if (valA > valB)
@@ -7396,8 +7432,8 @@ const NameColumnRenderer = (i18n2, resource = "") => {
7396
7432
  title: i18n2.t("name"),
7397
7433
  sortable: true,
7398
7434
  sorter: CommonSorter(dataIndex),
7399
- render: (v2, record) => {
7400
- return /* @__PURE__ */ jsxRuntime.exports.jsx(NameLink, { name: v2, id: record.id, resource });
7435
+ render: (v, record) => {
7436
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(NameLink, { name: v, id: record.id, resource });
7401
7437
  }
7402
7438
  };
7403
7439
  };
@@ -7421,7 +7457,7 @@ const PhaseColumnRenderer = (i18n2) => {
7421
7457
  title: i18n2.t("phase"),
7422
7458
  sortable: true,
7423
7459
  sorter: CommonSorter(dataIndex),
7424
- render: (v2) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: v2 })
7460
+ render: (v) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: v })
7425
7461
  };
7426
7462
  };
7427
7463
  const WorkloadImageColumnRenderer = (i18n2) => {
@@ -7447,7 +7483,7 @@ const ReplicasColumnRenderer = (i18n2) => {
7447
7483
  title: i18n2.t("replicas"),
7448
7484
  sortable: true,
7449
7485
  sorter: CommonSorter(dataIndex),
7450
- render: (_2, record) => {
7486
+ render: (_, record) => {
7451
7487
  return /* @__PURE__ */ jsxRuntime.exports.jsx(WorkloadReplicas, { record });
7452
7488
  }
7453
7489
  };
@@ -7460,9 +7496,9 @@ const AgeColumnRenderer = (i18n2) => {
7460
7496
  dataIndex,
7461
7497
  title: i18n2.t("created_time"),
7462
7498
  sortable: true,
7463
- sorter: (a, b2) => {
7499
+ sorter: (a, b) => {
7464
7500
  const valA = new Date(lodash.exports.get(a, dataIndex));
7465
- const valB = new Date(lodash.exports.get(b2, dataIndex));
7501
+ const valB = new Date(lodash.exports.get(b, dataIndex));
7466
7502
  if (valA === valB)
7467
7503
  return 0;
7468
7504
  if (valA > valB)
@@ -7518,6 +7554,17 @@ const DurationColumnRenderer = (i18n2) => {
7518
7554
  sorter: CommonSorter(dataIndex)
7519
7555
  };
7520
7556
  };
7557
+ const ServiceTypeColumnRenderer = (i18n2) => {
7558
+ const dataIndex = ["rawYaml", "spec", "type"];
7559
+ return {
7560
+ key: "type",
7561
+ title: i18n2.t("dovetail.type"),
7562
+ display: true,
7563
+ dataIndex,
7564
+ sortable: true,
7565
+ sorter: CommonSorter(dataIndex)
7566
+ };
7567
+ };
7521
7568
  function download(filename, content) {
7522
7569
  const element = document.createElement("a");
7523
7570
  element.setAttribute(
@@ -7822,7 +7869,7 @@ const useEagleTable = (params) => {
7822
7869
  display: true,
7823
7870
  dataIndex: [],
7824
7871
  title: () => /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: SettingsGear16GradientGrayIcon }),
7825
- render: (_2, record) => {
7872
+ render: (_, record) => {
7826
7873
  return /* @__PURE__ */ jsxRuntime.exports.jsx(Dropdown, { data: record });
7827
7874
  }
7828
7875
  };
@@ -8954,7 +9001,6 @@ const KeyValue = ({ value }) => {
8954
9001
  }
8955
9002
  );
8956
9003
  };
8957
- const WorkloadPodsTable_z2tsj7 = "";
8958
9004
  function matchSelector(pod, selector) {
8959
9005
  var _a, _b, _c;
8960
9006
  let match = true;
@@ -8965,6 +9011,7 @@ function matchSelector(pod, selector) {
8965
9011
  }
8966
9012
  return match;
8967
9013
  }
9014
+ const WorkloadPodsTable_z2tsj7 = "";
8968
9015
  const WorkloadPodsTable = ({
8969
9016
  selector
8970
9017
  }) => {
@@ -9025,7 +9072,7 @@ const ReplicaField = (i18n2) => {
9025
9072
  key: "Replicas",
9026
9073
  title: i18n2.t("replicas"),
9027
9074
  path: ["status", "replicas"],
9028
- render: (_2, record) => {
9075
+ render: (_, record) => {
9029
9076
  return /* @__PURE__ */ jsxRuntime.exports.jsx(WorkloadReplicas, { record });
9030
9077
  }
9031
9078
  };
@@ -9040,12 +9087,12 @@ const ConditionsField = (i18n2) => {
9040
9087
  }
9041
9088
  };
9042
9089
  };
9043
- const PodsField = (_2) => {
9090
+ const PodsField = (_) => {
9044
9091
  return {
9045
9092
  key: "pods",
9046
9093
  title: "Pods",
9047
9094
  path: [],
9048
- render: (_22, record) => {
9095
+ render: (_2, record) => {
9049
9096
  var _a, _b;
9050
9097
  return /* @__PURE__ */ jsxRuntime.exports.jsx(
9051
9098
  WorkloadPodsTable,
@@ -9058,12 +9105,12 @@ const PodsField = (_2) => {
9058
9105
  }
9059
9106
  };
9060
9107
  };
9061
- const JobsField = (_2) => {
9108
+ const JobsField = (_) => {
9062
9109
  return {
9063
9110
  key: "jobs",
9064
9111
  title: "Jobs",
9065
9112
  path: [],
9066
- render: (_22, record) => {
9113
+ render: (_2, record) => {
9067
9114
  var _a, _b, _c;
9068
9115
  return /* @__PURE__ */ jsxRuntime.exports.jsx(
9069
9116
  CronjobJobsTable,
@@ -9114,6 +9161,45 @@ const StartTimeField = (i18n2) => {
9114
9161
  }
9115
9162
  };
9116
9163
  };
9164
+ const ServiceTypeField = (i18n2) => {
9165
+ return {
9166
+ key: "type",
9167
+ title: i18n2.t("dovetail.type"),
9168
+ path: ["rawYaml", "spec", "type"]
9169
+ };
9170
+ };
9171
+ const ClusterIpField = (i18n2) => {
9172
+ return {
9173
+ key: "clusterIp",
9174
+ title: i18n2.t("dovetail.clusterIp"),
9175
+ path: ["rawYaml", "spec", "clusterIP"]
9176
+ };
9177
+ };
9178
+ const SessionAffinityField = (i18n2) => {
9179
+ return {
9180
+ key: "clusterIp",
9181
+ title: i18n2.t("dovetail.sessionAffinity"),
9182
+ path: ["rawYaml", "spec", "sessionAffinity"]
9183
+ };
9184
+ };
9185
+ const ServicePodsField = (_) => {
9186
+ return {
9187
+ key: "pods",
9188
+ title: "Pods",
9189
+ path: [],
9190
+ render: (_2, record) => {
9191
+ var _a, _b;
9192
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(
9193
+ WorkloadPodsTable,
9194
+ {
9195
+ selector: (_b = (_a = record.metadata.relations) == null ? void 0 : _a.find((r) => {
9196
+ return r.kind === "Pod" && r.type === "selects";
9197
+ })) == null ? void 0 : _b.selector
9198
+ }
9199
+ );
9200
+ }
9201
+ };
9202
+ };
9117
9203
  const style_inzxm5 = "";
9118
9204
  const ToolBarStyle = "t1joof7s";
9119
9205
  const ToolBarHeaderStyle = "tti58uh";
@@ -9321,6 +9407,9 @@ const ShowContent = (props) => {
9321
9407
  const {
9322
9408
  t
9323
9409
  } = useTranslation();
9410
+ const {
9411
+ fold
9412
+ } = useK8sYamlEditor();
9324
9413
  const {
9325
9414
  data: data2
9326
9415
  } = queryResult;
@@ -9449,8 +9538,11 @@ const ShowContent = (props) => {
9449
9538
  }),
9450
9539
  ["yaml"]: /* @__PURE__ */ jsxRuntime.exports.jsx(MonacoYamlEditor$1, {
9451
9540
  className: EditorStyle$1,
9452
- defaultValue: yaml.dump(record),
9541
+ defaultValue: yaml.dump(omit$1(relationPlugin.restoreItem(data2.data), "id")),
9453
9542
  schema: {},
9543
+ onEditorCreate: (editor) => {
9544
+ fold(editor);
9545
+ },
9454
9546
  readOnly: true
9455
9547
  })
9456
9548
  };
@@ -9503,7 +9595,7 @@ const PodContainersTable = ({
9503
9595
  title: i18n2.t("state"),
9504
9596
  sortable: true,
9505
9597
  sorter: CommonSorter(["state"]),
9506
- render: (v2) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: Object.keys(v2)[0] })
9598
+ render: (v) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: Object.keys(v)[0] })
9507
9599
  },
9508
9600
  {
9509
9601
  key: "ready",
@@ -9511,10 +9603,10 @@ const PodContainersTable = ({
9511
9603
  title: i18n2.t("ready"),
9512
9604
  sortable: true,
9513
9605
  sorter: CommonSorter(["ready"]),
9514
- render: (v2) => /* @__PURE__ */ jsxRuntime.exports.jsx(
9606
+ render: (v) => /* @__PURE__ */ jsxRuntime.exports.jsx(
9515
9607
  Icon,
9516
9608
  {
9517
- src: v2 ? CheckmarkDoneSuccessCorrect16BoldGreenIcon : XmarkFailed16BoldRedIcon
9609
+ src: v ? CheckmarkDoneSuccessCorrect16BoldGreenIcon : XmarkFailed16BoldRedIcon
9518
9610
  }
9519
9611
  )
9520
9612
  },
@@ -9536,7 +9628,7 @@ const PodContainersTable = ({
9536
9628
  key: "init",
9537
9629
  dataIndex: [],
9538
9630
  title: i18n2.t("init_container"),
9539
- render: (_2, record) => {
9631
+ render: (_, record) => {
9540
9632
  const isInit = initContainerStatuses.some(
9541
9633
  (c) => c.containerID === record.containerID
9542
9634
  );
@@ -9593,13 +9685,13 @@ function WorkloadDropdown(props) {
9593
9685
  kit.menu.Item,
9594
9686
  {
9595
9687
  onClick: () => {
9596
- const v2 = data2.redeploy();
9597
- const id = v2.id;
9598
- pruneBeforeEdit(v2);
9688
+ const v = data2.redeploy();
9689
+ const id = v.id;
9690
+ pruneBeforeEdit(v);
9599
9691
  mutate({
9600
9692
  id,
9601
9693
  resource: (resource == null ? void 0 : resource.name) || "",
9602
- values: v2
9694
+ values: v
9603
9695
  });
9604
9696
  },
9605
9697
  children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: DynamicResourceSchedule16BlueIcon, children: t("dovetail.redeploy") })
@@ -9667,7 +9759,7 @@ const Separator = () => {
9667
9759
  });
9668
9760
  };
9669
9761
  const MonacoYamlEditor = React.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
9670
- const MonacoYamlDiffEditor = React.lazy(() => import("./MonacoYamlDiffEditor.6b29d662.js"));
9762
+ const MonacoYamlDiffEditor = React.lazy(() => import("./MonacoYamlDiffEditor.33e5c246.js"));
9671
9763
  const YamlEditorComponent = forwardRef(
9672
9764
  function YamlEditorComponent2(props, ref) {
9673
9765
  const {
@@ -9702,7 +9794,8 @@ const YamlEditorComponent = forwardRef(
9702
9794
  getEditorValue: () => {
9703
9795
  var _a;
9704
9796
  return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) || "";
9705
- }
9797
+ },
9798
+ getEditorInstance: () => editorInstance.current || null
9706
9799
  };
9707
9800
  });
9708
9801
  const onChange = useCallback(
@@ -10039,7 +10132,7 @@ const ResourceCRUD = (props) => {
10039
10132
  const { i18n: i18n2 } = useTranslation();
10040
10133
  return /* @__PURE__ */ jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment, { children: configs.map((config) => {
10041
10134
  var _a, _b;
10042
- const formatter = config.formatter || ((v2) => new ResourceModel(v2));
10135
+ const formatter = config.formatter || ((v) => new ResourceModel(v));
10043
10136
  return /* @__PURE__ */ jsxRuntime.exports.jsxs(React.Fragment, { children: [
10044
10137
  /* @__PURE__ */ jsxRuntime.exports.jsx(Route, { path: `${urlPrefix}/${config.name}`, exact: true, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
10045
10138
  ResourceList,
@@ -10075,13 +10168,13 @@ function CronJobDropdown(props) {
10075
10168
  kit.menu.Item,
10076
10169
  {
10077
10170
  onClick: () => {
10078
- const v2 = suspended ? data2.resume() : data2.suspend();
10079
- const id = v2.id;
10080
- pruneBeforeEdit(v2);
10171
+ const v = suspended ? data2.resume() : data2.suspend();
10172
+ const id = v.id;
10173
+ pruneBeforeEdit(v);
10081
10174
  mutate({
10082
10175
  id,
10083
10176
  resource: (resource == null ? void 0 : resource.name) || "",
10084
- values: v2
10177
+ values: v
10085
10178
  });
10086
10179
  },
10087
10180
  children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: suspended ? VmResume16Icon : SuspendedPause16GradientGrayIcon, children: t(suspended ? "dovetail.resume" : "dovetail.suspend") })
@@ -10268,1265 +10361,6 @@ const EditButton = () => {
10268
10361
  }
10269
10362
  );
10270
10363
  };
10271
- function isAbsolute(pathname) {
10272
- return pathname.charAt(0) === "/";
10273
- }
10274
- function spliceOne(list, index) {
10275
- for (var i = index, k2 = i + 1, n = list.length; k2 < n; i += 1, k2 += 1) {
10276
- list[i] = list[k2];
10277
- }
10278
- list.pop();
10279
- }
10280
- function resolvePathname(to, from) {
10281
- if (from === void 0)
10282
- from = "";
10283
- var toParts = to && to.split("/") || [];
10284
- var fromParts = from && from.split("/") || [];
10285
- var isToAbs = to && isAbsolute(to);
10286
- var isFromAbs = from && isAbsolute(from);
10287
- var mustEndAbs = isToAbs || isFromAbs;
10288
- if (to && isAbsolute(to)) {
10289
- fromParts = toParts;
10290
- } else if (toParts.length) {
10291
- fromParts.pop();
10292
- fromParts = fromParts.concat(toParts);
10293
- }
10294
- if (!fromParts.length)
10295
- return "/";
10296
- var hasTrailingSlash;
10297
- if (fromParts.length) {
10298
- var last = fromParts[fromParts.length - 1];
10299
- hasTrailingSlash = last === "." || last === ".." || last === "";
10300
- } else {
10301
- hasTrailingSlash = false;
10302
- }
10303
- var up = 0;
10304
- for (var i = fromParts.length; i >= 0; i--) {
10305
- var part = fromParts[i];
10306
- if (part === ".") {
10307
- spliceOne(fromParts, i);
10308
- } else if (part === "..") {
10309
- spliceOne(fromParts, i);
10310
- up++;
10311
- } else if (up) {
10312
- spliceOne(fromParts, i);
10313
- up--;
10314
- }
10315
- }
10316
- if (!mustEndAbs)
10317
- for (; up--; up)
10318
- fromParts.unshift("..");
10319
- if (mustEndAbs && fromParts[0] !== "" && (!fromParts[0] || !isAbsolute(fromParts[0])))
10320
- fromParts.unshift("");
10321
- var result = fromParts.join("/");
10322
- if (hasTrailingSlash && result.substr(-1) !== "/")
10323
- result += "/";
10324
- return result;
10325
- }
10326
- var isProduction$1 = process.env.NODE_ENV === "production";
10327
- function warning(condition2, message2) {
10328
- if (!isProduction$1) {
10329
- if (condition2) {
10330
- return;
10331
- }
10332
- var text = "Warning: " + message2;
10333
- if (typeof console !== "undefined") {
10334
- console.warn(text);
10335
- }
10336
- try {
10337
- throw Error(text);
10338
- } catch (x2) {
10339
- }
10340
- }
10341
- }
10342
- var isProduction = process.env.NODE_ENV === "production";
10343
- var prefix = "Invariant failed";
10344
- function invariant(condition2, message2) {
10345
- if (condition2) {
10346
- return;
10347
- }
10348
- if (isProduction) {
10349
- throw new Error(prefix);
10350
- }
10351
- var provided = typeof message2 === "function" ? message2() : message2;
10352
- var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
10353
- throw new Error(value);
10354
- }
10355
- function addLeadingSlash(path) {
10356
- return path.charAt(0) === "/" ? path : "/" + path;
10357
- }
10358
- function stripLeadingSlash(path) {
10359
- return path.charAt(0) === "/" ? path.substr(1) : path;
10360
- }
10361
- function hasBasename(path, prefix2) {
10362
- return path.toLowerCase().indexOf(prefix2.toLowerCase()) === 0 && "/?#".indexOf(path.charAt(prefix2.length)) !== -1;
10363
- }
10364
- function stripBasename(path, prefix2) {
10365
- return hasBasename(path, prefix2) ? path.substr(prefix2.length) : path;
10366
- }
10367
- function stripTrailingSlash(path) {
10368
- return path.charAt(path.length - 1) === "/" ? path.slice(0, -1) : path;
10369
- }
10370
- function parsePath(path) {
10371
- var pathname = path || "/";
10372
- var search = "";
10373
- var hash = "";
10374
- var hashIndex = pathname.indexOf("#");
10375
- if (hashIndex !== -1) {
10376
- hash = pathname.substr(hashIndex);
10377
- pathname = pathname.substr(0, hashIndex);
10378
- }
10379
- var searchIndex = pathname.indexOf("?");
10380
- if (searchIndex !== -1) {
10381
- search = pathname.substr(searchIndex);
10382
- pathname = pathname.substr(0, searchIndex);
10383
- }
10384
- return {
10385
- pathname,
10386
- search: search === "?" ? "" : search,
10387
- hash: hash === "#" ? "" : hash
10388
- };
10389
- }
10390
- function createPath(location2) {
10391
- var pathname = location2.pathname, search = location2.search, hash = location2.hash;
10392
- var path = pathname || "/";
10393
- if (search && search !== "?")
10394
- path += search.charAt(0) === "?" ? search : "?" + search;
10395
- if (hash && hash !== "#")
10396
- path += hash.charAt(0) === "#" ? hash : "#" + hash;
10397
- return path;
10398
- }
10399
- function createLocation(path, state2, key, currentLocation) {
10400
- var location2;
10401
- if (typeof path === "string") {
10402
- location2 = parsePath(path);
10403
- location2.state = state2;
10404
- } else {
10405
- location2 = _extends({}, path);
10406
- if (location2.pathname === void 0)
10407
- location2.pathname = "";
10408
- if (location2.search) {
10409
- if (location2.search.charAt(0) !== "?")
10410
- location2.search = "?" + location2.search;
10411
- } else {
10412
- location2.search = "";
10413
- }
10414
- if (location2.hash) {
10415
- if (location2.hash.charAt(0) !== "#")
10416
- location2.hash = "#" + location2.hash;
10417
- } else {
10418
- location2.hash = "";
10419
- }
10420
- if (state2 !== void 0 && location2.state === void 0)
10421
- location2.state = state2;
10422
- }
10423
- try {
10424
- location2.pathname = decodeURI(location2.pathname);
10425
- } catch (e) {
10426
- if (e instanceof URIError) {
10427
- throw new URIError('Pathname "' + location2.pathname + '" could not be decoded. This is likely caused by an invalid percent-encoding.');
10428
- } else {
10429
- throw e;
10430
- }
10431
- }
10432
- if (key)
10433
- location2.key = key;
10434
- if (currentLocation) {
10435
- if (!location2.pathname) {
10436
- location2.pathname = currentLocation.pathname;
10437
- } else if (location2.pathname.charAt(0) !== "/") {
10438
- location2.pathname = resolvePathname(location2.pathname, currentLocation.pathname);
10439
- }
10440
- } else {
10441
- if (!location2.pathname) {
10442
- location2.pathname = "/";
10443
- }
10444
- }
10445
- return location2;
10446
- }
10447
- function createTransitionManager() {
10448
- var prompt = null;
10449
- function setPrompt(nextPrompt) {
10450
- process.env.NODE_ENV !== "production" ? warning(prompt == null, "A history supports only one prompt at a time") : void 0;
10451
- prompt = nextPrompt;
10452
- return function() {
10453
- if (prompt === nextPrompt)
10454
- prompt = null;
10455
- };
10456
- }
10457
- function confirmTransitionTo(location2, action, getUserConfirmation, callback) {
10458
- if (prompt != null) {
10459
- var result = typeof prompt === "function" ? prompt(location2, action) : prompt;
10460
- if (typeof result === "string") {
10461
- if (typeof getUserConfirmation === "function") {
10462
- getUserConfirmation(result, callback);
10463
- } else {
10464
- process.env.NODE_ENV !== "production" ? warning(false, "A history needs a getUserConfirmation function in order to use a prompt message") : void 0;
10465
- callback(true);
10466
- }
10467
- } else {
10468
- callback(result !== false);
10469
- }
10470
- } else {
10471
- callback(true);
10472
- }
10473
- }
10474
- var listeners = [];
10475
- function appendListener(fn) {
10476
- var isActive = true;
10477
- function listener() {
10478
- if (isActive)
10479
- fn.apply(void 0, arguments);
10480
- }
10481
- listeners.push(listener);
10482
- return function() {
10483
- isActive = false;
10484
- listeners = listeners.filter(function(item) {
10485
- return item !== listener;
10486
- });
10487
- };
10488
- }
10489
- function notifyListeners() {
10490
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10491
- args[_key] = arguments[_key];
10492
- }
10493
- listeners.forEach(function(listener) {
10494
- return listener.apply(void 0, args);
10495
- });
10496
- }
10497
- return {
10498
- setPrompt,
10499
- confirmTransitionTo,
10500
- appendListener,
10501
- notifyListeners
10502
- };
10503
- }
10504
- var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
10505
- function getConfirmation(message2, callback) {
10506
- callback(window.confirm(message2));
10507
- }
10508
- function supportsHistory() {
10509
- var ua = window.navigator.userAgent;
10510
- if ((ua.indexOf("Android 2.") !== -1 || ua.indexOf("Android 4.0") !== -1) && ua.indexOf("Mobile Safari") !== -1 && ua.indexOf("Chrome") === -1 && ua.indexOf("Windows Phone") === -1)
10511
- return false;
10512
- return window.history && "pushState" in window.history;
10513
- }
10514
- function supportsPopStateOnHashChange() {
10515
- return window.navigator.userAgent.indexOf("Trident") === -1;
10516
- }
10517
- function supportsGoWithoutReloadUsingHash() {
10518
- return window.navigator.userAgent.indexOf("Firefox") === -1;
10519
- }
10520
- function isExtraneousPopstateEvent(event) {
10521
- return event.state === void 0 && navigator.userAgent.indexOf("CriOS") === -1;
10522
- }
10523
- var PopStateEvent = "popstate";
10524
- var HashChangeEvent = "hashchange";
10525
- function getHistoryState() {
10526
- try {
10527
- return window.history.state || {};
10528
- } catch (e) {
10529
- return {};
10530
- }
10531
- }
10532
- function createBrowserHistory(props) {
10533
- if (props === void 0) {
10534
- props = {};
10535
- }
10536
- !canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, "Browser history needs a DOM") : invariant(false) : void 0;
10537
- var globalHistory = window.history;
10538
- var canUseHistory = supportsHistory();
10539
- var needsHashChangeListener = !supportsPopStateOnHashChange();
10540
- var _props = props, _props$forceRefresh = _props.forceRefresh, forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh, _props$getUserConfirm = _props.getUserConfirmation, getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, _props$keyLength = _props.keyLength, keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
10541
- var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : "";
10542
- function getDOMLocation(historyState) {
10543
- var _ref = historyState || {}, key = _ref.key, state2 = _ref.state;
10544
- var _window$location = window.location, pathname = _window$location.pathname, search = _window$location.search, hash = _window$location.hash;
10545
- var path = pathname + search + hash;
10546
- process.env.NODE_ENV !== "production" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0;
10547
- if (basename)
10548
- path = stripBasename(path, basename);
10549
- return createLocation(path, state2, key);
10550
- }
10551
- function createKey() {
10552
- return Math.random().toString(36).substr(2, keyLength);
10553
- }
10554
- var transitionManager = createTransitionManager();
10555
- function setState(nextState) {
10556
- _extends(history, nextState);
10557
- history.length = globalHistory.length;
10558
- transitionManager.notifyListeners(history.location, history.action);
10559
- }
10560
- function handlePopState(event) {
10561
- if (isExtraneousPopstateEvent(event))
10562
- return;
10563
- handlePop(getDOMLocation(event.state));
10564
- }
10565
- function handleHashChange() {
10566
- handlePop(getDOMLocation(getHistoryState()));
10567
- }
10568
- var forceNextPop = false;
10569
- function handlePop(location2) {
10570
- if (forceNextPop) {
10571
- forceNextPop = false;
10572
- setState();
10573
- } else {
10574
- var action = "POP";
10575
- transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) {
10576
- if (ok) {
10577
- setState({
10578
- action,
10579
- location: location2
10580
- });
10581
- } else {
10582
- revertPop(location2);
10583
- }
10584
- });
10585
- }
10586
- }
10587
- function revertPop(fromLocation) {
10588
- var toLocation = history.location;
10589
- var toIndex = allKeys.indexOf(toLocation.key);
10590
- if (toIndex === -1)
10591
- toIndex = 0;
10592
- var fromIndex = allKeys.indexOf(fromLocation.key);
10593
- if (fromIndex === -1)
10594
- fromIndex = 0;
10595
- var delta = toIndex - fromIndex;
10596
- if (delta) {
10597
- forceNextPop = true;
10598
- go(delta);
10599
- }
10600
- }
10601
- var initialLocation = getDOMLocation(getHistoryState());
10602
- var allKeys = [initialLocation.key];
10603
- function createHref(location2) {
10604
- return basename + createPath(location2);
10605
- }
10606
- function push(path, state2) {
10607
- process.env.NODE_ENV !== "production" ? warning(!(typeof path === "object" && path.state !== void 0 && state2 !== void 0), "You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored") : void 0;
10608
- var action = "PUSH";
10609
- var location2 = createLocation(path, state2, createKey(), history.location);
10610
- transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) {
10611
- if (!ok)
10612
- return;
10613
- var href = createHref(location2);
10614
- var key = location2.key, state3 = location2.state;
10615
- if (canUseHistory) {
10616
- globalHistory.pushState({
10617
- key,
10618
- state: state3
10619
- }, null, href);
10620
- if (forceRefresh) {
10621
- window.location.href = href;
10622
- } else {
10623
- var prevIndex = allKeys.indexOf(history.location.key);
10624
- var nextKeys = allKeys.slice(0, prevIndex + 1);
10625
- nextKeys.push(location2.key);
10626
- allKeys = nextKeys;
10627
- setState({
10628
- action,
10629
- location: location2
10630
- });
10631
- }
10632
- } else {
10633
- process.env.NODE_ENV !== "production" ? warning(state3 === void 0, "Browser history cannot push state in browsers that do not support HTML5 history") : void 0;
10634
- window.location.href = href;
10635
- }
10636
- });
10637
- }
10638
- function replace(path, state2) {
10639
- process.env.NODE_ENV !== "production" ? warning(!(typeof path === "object" && path.state !== void 0 && state2 !== void 0), "You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored") : void 0;
10640
- var action = "REPLACE";
10641
- var location2 = createLocation(path, state2, createKey(), history.location);
10642
- transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) {
10643
- if (!ok)
10644
- return;
10645
- var href = createHref(location2);
10646
- var key = location2.key, state3 = location2.state;
10647
- if (canUseHistory) {
10648
- globalHistory.replaceState({
10649
- key,
10650
- state: state3
10651
- }, null, href);
10652
- if (forceRefresh) {
10653
- window.location.replace(href);
10654
- } else {
10655
- var prevIndex = allKeys.indexOf(history.location.key);
10656
- if (prevIndex !== -1)
10657
- allKeys[prevIndex] = location2.key;
10658
- setState({
10659
- action,
10660
- location: location2
10661
- });
10662
- }
10663
- } else {
10664
- process.env.NODE_ENV !== "production" ? warning(state3 === void 0, "Browser history cannot replace state in browsers that do not support HTML5 history") : void 0;
10665
- window.location.replace(href);
10666
- }
10667
- });
10668
- }
10669
- function go(n) {
10670
- globalHistory.go(n);
10671
- }
10672
- function goBack() {
10673
- go(-1);
10674
- }
10675
- function goForward() {
10676
- go(1);
10677
- }
10678
- var listenerCount = 0;
10679
- function checkDOMListeners(delta) {
10680
- listenerCount += delta;
10681
- if (listenerCount === 1 && delta === 1) {
10682
- window.addEventListener(PopStateEvent, handlePopState);
10683
- if (needsHashChangeListener)
10684
- window.addEventListener(HashChangeEvent, handleHashChange);
10685
- } else if (listenerCount === 0) {
10686
- window.removeEventListener(PopStateEvent, handlePopState);
10687
- if (needsHashChangeListener)
10688
- window.removeEventListener(HashChangeEvent, handleHashChange);
10689
- }
10690
- }
10691
- var isBlocked = false;
10692
- function block(prompt) {
10693
- if (prompt === void 0) {
10694
- prompt = false;
10695
- }
10696
- var unblock = transitionManager.setPrompt(prompt);
10697
- if (!isBlocked) {
10698
- checkDOMListeners(1);
10699
- isBlocked = true;
10700
- }
10701
- return function() {
10702
- if (isBlocked) {
10703
- isBlocked = false;
10704
- checkDOMListeners(-1);
10705
- }
10706
- return unblock();
10707
- };
10708
- }
10709
- function listen(listener) {
10710
- var unlisten = transitionManager.appendListener(listener);
10711
- checkDOMListeners(1);
10712
- return function() {
10713
- checkDOMListeners(-1);
10714
- unlisten();
10715
- };
10716
- }
10717
- var history = {
10718
- length: globalHistory.length,
10719
- action: "POP",
10720
- location: initialLocation,
10721
- createHref,
10722
- push,
10723
- replace,
10724
- go,
10725
- goBack,
10726
- goForward,
10727
- block,
10728
- listen
10729
- };
10730
- return history;
10731
- }
10732
- var HashChangeEvent$1 = "hashchange";
10733
- var HashPathCoders = {
10734
- hashbang: {
10735
- encodePath: function encodePath(path) {
10736
- return path.charAt(0) === "!" ? path : "!/" + stripLeadingSlash(path);
10737
- },
10738
- decodePath: function decodePath(path) {
10739
- return path.charAt(0) === "!" ? path.substr(1) : path;
10740
- }
10741
- },
10742
- noslash: {
10743
- encodePath: stripLeadingSlash,
10744
- decodePath: addLeadingSlash
10745
- },
10746
- slash: {
10747
- encodePath: addLeadingSlash,
10748
- decodePath: addLeadingSlash
10749
- }
10750
- };
10751
- function stripHash(url) {
10752
- var hashIndex = url.indexOf("#");
10753
- return hashIndex === -1 ? url : url.slice(0, hashIndex);
10754
- }
10755
- function getHashPath() {
10756
- var href = window.location.href;
10757
- var hashIndex = href.indexOf("#");
10758
- return hashIndex === -1 ? "" : href.substring(hashIndex + 1);
10759
- }
10760
- function pushHashPath(path) {
10761
- window.location.hash = path;
10762
- }
10763
- function replaceHashPath(path) {
10764
- window.location.replace(stripHash(window.location.href) + "#" + path);
10765
- }
10766
- function createHashHistory(props) {
10767
- if (props === void 0) {
10768
- props = {};
10769
- }
10770
- !canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, "Hash history needs a DOM") : invariant(false) : void 0;
10771
- var globalHistory = window.history;
10772
- var canGoWithoutReload = supportsGoWithoutReloadUsingHash();
10773
- var _props = props, _props$getUserConfirm = _props.getUserConfirmation, getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, _props$hashType = _props.hashType, hashType = _props$hashType === void 0 ? "slash" : _props$hashType;
10774
- var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : "";
10775
- var _HashPathCoders$hashT = HashPathCoders[hashType], encodePath2 = _HashPathCoders$hashT.encodePath, decodePath2 = _HashPathCoders$hashT.decodePath;
10776
- function getDOMLocation() {
10777
- var path2 = decodePath2(getHashPath());
10778
- process.env.NODE_ENV !== "production" ? warning(!basename || hasBasename(path2, basename), 'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "' + path2 + '" to begin with "' + basename + '".') : void 0;
10779
- if (basename)
10780
- path2 = stripBasename(path2, basename);
10781
- return createLocation(path2);
10782
- }
10783
- var transitionManager = createTransitionManager();
10784
- function setState(nextState) {
10785
- _extends(history, nextState);
10786
- history.length = globalHistory.length;
10787
- transitionManager.notifyListeners(history.location, history.action);
10788
- }
10789
- var forceNextPop = false;
10790
- var ignorePath = null;
10791
- function locationsAreEqual$$1(a, b2) {
10792
- return a.pathname === b2.pathname && a.search === b2.search && a.hash === b2.hash;
10793
- }
10794
- function handleHashChange() {
10795
- var path2 = getHashPath();
10796
- var encodedPath2 = encodePath2(path2);
10797
- if (path2 !== encodedPath2) {
10798
- replaceHashPath(encodedPath2);
10799
- } else {
10800
- var location2 = getDOMLocation();
10801
- var prevLocation = history.location;
10802
- if (!forceNextPop && locationsAreEqual$$1(prevLocation, location2))
10803
- return;
10804
- if (ignorePath === createPath(location2))
10805
- return;
10806
- ignorePath = null;
10807
- handlePop(location2);
10808
- }
10809
- }
10810
- function handlePop(location2) {
10811
- if (forceNextPop) {
10812
- forceNextPop = false;
10813
- setState();
10814
- } else {
10815
- var action = "POP";
10816
- transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) {
10817
- if (ok) {
10818
- setState({
10819
- action,
10820
- location: location2
10821
- });
10822
- } else {
10823
- revertPop(location2);
10824
- }
10825
- });
10826
- }
10827
- }
10828
- function revertPop(fromLocation) {
10829
- var toLocation = history.location;
10830
- var toIndex = allPaths.lastIndexOf(createPath(toLocation));
10831
- if (toIndex === -1)
10832
- toIndex = 0;
10833
- var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
10834
- if (fromIndex === -1)
10835
- fromIndex = 0;
10836
- var delta = toIndex - fromIndex;
10837
- if (delta) {
10838
- forceNextPop = true;
10839
- go(delta);
10840
- }
10841
- }
10842
- var path = getHashPath();
10843
- var encodedPath = encodePath2(path);
10844
- if (path !== encodedPath)
10845
- replaceHashPath(encodedPath);
10846
- var initialLocation = getDOMLocation();
10847
- var allPaths = [createPath(initialLocation)];
10848
- function createHref(location2) {
10849
- var baseTag = document.querySelector("base");
10850
- var href = "";
10851
- if (baseTag && baseTag.getAttribute("href")) {
10852
- href = stripHash(window.location.href);
10853
- }
10854
- return href + "#" + encodePath2(basename + createPath(location2));
10855
- }
10856
- function push(path2, state2) {
10857
- process.env.NODE_ENV !== "production" ? warning(state2 === void 0, "Hash history cannot push state; it is ignored") : void 0;
10858
- var action = "PUSH";
10859
- var location2 = createLocation(path2, void 0, void 0, history.location);
10860
- transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) {
10861
- if (!ok)
10862
- return;
10863
- var path3 = createPath(location2);
10864
- var encodedPath2 = encodePath2(basename + path3);
10865
- var hashChanged = getHashPath() !== encodedPath2;
10866
- if (hashChanged) {
10867
- ignorePath = path3;
10868
- pushHashPath(encodedPath2);
10869
- var prevIndex = allPaths.lastIndexOf(createPath(history.location));
10870
- var nextPaths = allPaths.slice(0, prevIndex + 1);
10871
- nextPaths.push(path3);
10872
- allPaths = nextPaths;
10873
- setState({
10874
- action,
10875
- location: location2
10876
- });
10877
- } else {
10878
- process.env.NODE_ENV !== "production" ? warning(false, "Hash history cannot PUSH the same path; a new entry will not be added to the history stack") : void 0;
10879
- setState();
10880
- }
10881
- });
10882
- }
10883
- function replace(path2, state2) {
10884
- process.env.NODE_ENV !== "production" ? warning(state2 === void 0, "Hash history cannot replace state; it is ignored") : void 0;
10885
- var action = "REPLACE";
10886
- var location2 = createLocation(path2, void 0, void 0, history.location);
10887
- transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) {
10888
- if (!ok)
10889
- return;
10890
- var path3 = createPath(location2);
10891
- var encodedPath2 = encodePath2(basename + path3);
10892
- var hashChanged = getHashPath() !== encodedPath2;
10893
- if (hashChanged) {
10894
- ignorePath = path3;
10895
- replaceHashPath(encodedPath2);
10896
- }
10897
- var prevIndex = allPaths.indexOf(createPath(history.location));
10898
- if (prevIndex !== -1)
10899
- allPaths[prevIndex] = path3;
10900
- setState({
10901
- action,
10902
- location: location2
10903
- });
10904
- });
10905
- }
10906
- function go(n) {
10907
- process.env.NODE_ENV !== "production" ? warning(canGoWithoutReload, "Hash history go(n) causes a full page reload in this browser") : void 0;
10908
- globalHistory.go(n);
10909
- }
10910
- function goBack() {
10911
- go(-1);
10912
- }
10913
- function goForward() {
10914
- go(1);
10915
- }
10916
- var listenerCount = 0;
10917
- function checkDOMListeners(delta) {
10918
- listenerCount += delta;
10919
- if (listenerCount === 1 && delta === 1) {
10920
- window.addEventListener(HashChangeEvent$1, handleHashChange);
10921
- } else if (listenerCount === 0) {
10922
- window.removeEventListener(HashChangeEvent$1, handleHashChange);
10923
- }
10924
- }
10925
- var isBlocked = false;
10926
- function block(prompt) {
10927
- if (prompt === void 0) {
10928
- prompt = false;
10929
- }
10930
- var unblock = transitionManager.setPrompt(prompt);
10931
- if (!isBlocked) {
10932
- checkDOMListeners(1);
10933
- isBlocked = true;
10934
- }
10935
- return function() {
10936
- if (isBlocked) {
10937
- isBlocked = false;
10938
- checkDOMListeners(-1);
10939
- }
10940
- return unblock();
10941
- };
10942
- }
10943
- function listen(listener) {
10944
- var unlisten = transitionManager.appendListener(listener);
10945
- checkDOMListeners(1);
10946
- return function() {
10947
- checkDOMListeners(-1);
10948
- unlisten();
10949
- };
10950
- }
10951
- var history = {
10952
- length: globalHistory.length,
10953
- action: "POP",
10954
- location: initialLocation,
10955
- createHref,
10956
- push,
10957
- replace,
10958
- go,
10959
- goBack,
10960
- goForward,
10961
- block,
10962
- listen
10963
- };
10964
- return history;
10965
- }
10966
- var lib = {};
10967
- Object.defineProperty(lib, "__esModule", { value: true });
10968
- var y = require$$0;
10969
- var U = lodash.exports;
10970
- var et = require$$2;
10971
- function _interopDefault(e) {
10972
- return e && e.__esModule ? e : { default: e };
10973
- }
10974
- var y__default = /* @__PURE__ */ _interopDefault(y);
10975
- var U__default = /* @__PURE__ */ _interopDefault(U);
10976
- var et__default = /* @__PURE__ */ _interopDefault(et);
10977
- var z = Object.defineProperty, q = Object.defineProperties;
10978
- var X = Object.getOwnPropertyDescriptors;
10979
- var D = Object.getOwnPropertySymbols;
10980
- var I = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
10981
- var C = (s, t, r) => t in s ? z(s, t, { enumerable: true, configurable: true, writable: true, value: r }) : s[t] = r, f = (s, t) => {
10982
- for (var r in t || (t = {}))
10983
- I.call(t, r) && C(s, r, t[r]);
10984
- if (D)
10985
- for (var r of D(t))
10986
- K.call(t, r) && C(s, r, t[r]);
10987
- return s;
10988
- }, b = (s, t) => q(s, X(t));
10989
- var k = (s, t) => {
10990
- var r = {};
10991
- for (var e in s)
10992
- I.call(s, e) && t.indexOf(e) < 0 && (r[e] = s[e]);
10993
- if (s != null && D)
10994
- for (var e of D(s))
10995
- t.indexOf(e) < 0 && K.call(s, e) && (r[e] = s[e]);
10996
- return r;
10997
- };
10998
- var d = (s, t, r) => new Promise((e, a) => {
10999
- var o = (c) => {
11000
- try {
11001
- n(r.next(c));
11002
- } catch (u) {
11003
- a(u);
11004
- }
11005
- }, i = (c) => {
11006
- try {
11007
- n(r.throw(c));
11008
- } catch (u) {
11009
- a(u);
11010
- }
11011
- }, n = (c) => c.done ? e(c.value) : Promise.resolve(c.value).then(o, i);
11012
- n((r = r.apply(s, t)).next());
11013
- });
11014
- var W = class {
11015
- processData(t) {
11016
- let { kind: r, apiVersion: e } = t;
11017
- return t.items = t.items.map((a) => this.processItem(b(f({}, a), { kind: r.replace(/List$/g, ""), apiVersion: e }))), t;
11018
- }
11019
- processItem(t) {
11020
- return this.processPodSelector(t), t;
11021
- }
11022
- restoreData(t) {
11023
- return t.items = t.items.map((r) => this.restoreItem(r)), t;
11024
- }
11025
- restoreItem(t) {
11026
- return delete t.metadata.relations, t;
11027
- }
11028
- processPodSelector(t) {
11029
- let { spec: r, kind: e } = t, a = r == null ? void 0 : r.selector;
11030
- if (!a || !e || !["Deployment", "DaemonSet", "StatefulSet", "ReplicaSet", "Job", "Service"].includes(e))
11031
- return t;
11032
- if (!a.matchLabels && !a.matchExpressions) {
11033
- a.matchLabels = {};
11034
- for (let o in a)
11035
- a.matchLabels[o] = a[o];
11036
- }
11037
- return this.appendRelation(t, { kind: "Pod", apiVersion: "v1", type: e === "Service" ? "selects" : "creates", selector: a, inbound: false }), t;
11038
- }
11039
- appendRelation(t, r) {
11040
- let e = t.metadata;
11041
- return e.relations || (e.relations = []), e.relations.push(r), t;
11042
- }
11043
- }, v = new W();
11044
- function R(s, ...t) {
11045
- return console.log(`[REFINE K8s ${s}]`, ...t);
11046
- }
11047
- function rt({ resourceBasePath: s, namespace: t, resource: r, name: e }) {
11048
- let a = [s];
11049
- return t && a.push(`namespaces/${t}`), a.push(r), e && a.push(e), a.join("/");
11050
- }
11051
- function G(s, t) {
11052
- if (s.indexOf(`
11053
- `) === -1)
11054
- return s;
11055
- let e = s.slice(0, s.indexOf(`
11056
- `)), a = s.slice(s.indexOf(`
11057
- `) + 1);
11058
- return t(e), G(a, t);
11059
- }
11060
- function V(s) {
11061
- clearTimeout(s.pingTimeout), s.pingTimeout = setTimeout(() => {
11062
- s.close();
11063
- }, 3e4 * 1.5);
11064
- }
11065
- var L = et__default.default(), E = class {
11066
- constructor(t) {
11067
- this.options = t;
11068
- this.maxTimeout = Math.pow(2, 10) * 1e3;
11069
- this.retryTimes = 0;
11070
- let { objectConstructor: r, basePath: e, watchWsBasePath: a } = t;
11071
- this.options = t, this.watchWsBasePath = a, this.basePath = e, this.resourceBasePath = r.resourceBasePath, this.namespace = r.namespace, this.resource = r.resource;
11072
- }
11073
- resetRetryState() {
11074
- this.retryTimes = 0, clearTimeout(this.retryTimer), this.retryTimer = void 0;
11075
- }
11076
- list() {
11077
- return d(this, arguments, function* ({ namespace: t, query: r, fetchOptions: e } = {}) {
11078
- let a = this.getUrl({ namespace: t });
11079
- return yield y__default.default.get(a, f({ searchParams: r, retry: 0 }, e || {})).json();
11080
- });
11081
- }
11082
- listWatch() {
11083
- return d(this, arguments, function* ({ namespace: t, query: r, onResponse: e, onEvent: a } = {}) {
11084
- let o = this.getUrl({ namespace: t }), i = this.watchWsBasePath ? this.getUrl({ namespace: t }, void 0, true) : o, n = yield this.list({ namespace: t, query: r, fetchOptions: { timeout: false } }), c = this.watch(i, n, e, a, this.listWatch.bind(this, { namespace: t, query: r, onResponse: e, onEvent: a }));
11085
- return e == null || e(n), c;
11086
- });
11087
- }
11088
- watch(t, r, e, a, o) {
11089
- return d(this, null, function* () {
11090
- let { items: i } = r, n = [], c = (u) => {
11091
- if (u.type === "PING")
11092
- return;
11093
- R("INFORMER", u);
11094
- let h = u.object.metadata.name, p = u.object.metadata.namespace;
11095
- switch (u.type) {
11096
- case "ADDED": {
11097
- let l = false;
11098
- i = i.map((m) => m.metadata.name === h && m.metadata.namespace === p ? (l = true, u.object) : m).concat(l ? [] : [u.object]);
11099
- break;
11100
- }
11101
- case "MODIFIED":
11102
- i = i.map((l) => l.metadata.name === h && l.metadata.namespace === p ? u.object : l);
11103
- break;
11104
- case "DELETED":
11105
- i = i.filter((l) => l.metadata.name !== h || l.metadata.namespace !== p);
11106
- break;
11107
- }
11108
- e == null || e(b(f({}, r), { items: i })), a == null || a(u);
11109
- };
11110
- return n.push(this.watchBySdk(r, c)), this.watchWsBasePath ? n.push(this.watchByWebsocket(t, r, c, o)) : n.push(this.watchByHttp(t, r, c, o)), () => {
11111
- n.forEach((u) => u());
11112
- };
11113
- });
11114
- }
11115
- watchBySdk(t, r) {
11116
- let e = (a) => {
11117
- let { type: o, basePath: i, items: n } = a;
11118
- i === this.basePath && n.forEach((c) => {
11119
- c.apiVersion === t.apiVersion && c.kind === t.kind.replace(/List$/g, "") && r({ type: o, object: c });
11120
- });
11121
- };
11122
- return L.on("change", e), () => {
11123
- L.off("change", e);
11124
- };
11125
- }
11126
- watchByWebsocket(t, r, e, a) {
11127
- let { resourceVersion: o = "" } = r.metadata, i = location.protocol.includes("https") ? "wss" : "ws", n = new WebSocket(t.includes("://") ? `${t}?resourceVersion=${o}&watch=1` : `${i}://${location.host}/${t}?resourceVersion=${o}&watch=1`), c = false, u = () => {
11128
- n.readyState === n.OPEN ? n.close(3001, "DOVETAIL_MANUAL_CLOSE") : c = true;
11129
- };
11130
- function h() {
11131
- u();
11132
- }
11133
- return n.addEventListener("open", () => {
11134
- if (c) {
11135
- n.close(3001, "DOVETAIL_MANUAL_CLOSE");
11136
- return;
11137
- }
11138
- V(n);
11139
- }), n.addEventListener("message", function(p) {
11140
- let l = JSON.parse(p.data);
11141
- V(n), e(l);
11142
- }), n.addEventListener("close", (p) => {
11143
- clearTimeout(n.pingTimeout), p.reason !== "DOVETAIL_MANUAL_CLOSE" && (this.retryFunc(() => d(this, null, function* () {
11144
- u = yield a();
11145
- })), u = () => {
11146
- clearTimeout(this.retryTimer);
11147
- });
11148
- }), h;
11149
- }
11150
- watchByHttp(t, r, e, a) {
11151
- let { resourceVersion: o = "" } = r.metadata, i = new AbortController(), { signal: n } = i, c = () => i.abort();
11152
- function u() {
11153
- c();
11154
- }
11155
- return d(this, null, function* () {
11156
- var h;
11157
- try {
11158
- let l = (h = (yield y__default.default.get(t, { searchParams: { watch: 1, resourceVersion: o }, timeout: false, signal: n })).body) == null ? void 0 : h.getReader(), m = new TextDecoder("utf-8"), P = "";
11159
- (function H() {
11160
- return d(this, null, function* () {
11161
- if (!l)
11162
- return Promise.reject();
11163
- let { done: J, value: Y } = yield l.read();
11164
- return J ? Promise.resolve() : (P += m.decode(Y), P = G(P, (B) => {
11165
- try {
11166
- let O = JSON.parse(B);
11167
- e(O);
11168
- } catch (O) {
11169
- R("INFORMER", "Error while parsing", B, `
11170
- `, O);
11171
- }
11172
- }), H());
11173
- });
11174
- })();
11175
- } catch (p) {
11176
- if (p.name === "AbortError")
11177
- return;
11178
- R("INFORMER", "watch API error:", p), c = yield a();
11179
- }
11180
- }), u;
11181
- }
11182
- getUrl({ name: t, namespace: r } = {}, e, a) {
11183
- let o = rt({ resourceBasePath: this.resourceBasePath, resource: this.resource, namespace: r || this.namespace, name: t }), i = new URLSearchParams(this.normalizeQuery(e));
11184
- return (a ? this.watchWsBasePath : this.basePath) + o + (e ? `?${i.toString()}` : "");
11185
- }
11186
- normalizeQuery(t = {}) {
11187
- return t.labelSelector && (t.labelSelector = [t.labelSelector].flat().join(",")), t.fieldSelector && (t.fieldSelector = [t.fieldSelector].flat().join(",")), t;
11188
- }
11189
- retryFunc(t) {
11190
- let r = Math.min(Math.pow(2, this.retryTimes) * 1e3, this.maxTimeout);
11191
- this.retryTimer = setTimeout(t, r), this.retryTimes++;
11192
- }
11193
- }, S = {}, w = class {
11194
- constructor(t) {
11195
- this.options = t;
11196
- this.defaultNamespace = "default";
11197
- let { basePath: r, fieldManager: e } = t;
11198
- this.options = t, this.basePath = r, this.fieldManager = e;
11199
- }
11200
- applyYaml(t, r, e) {
11201
- return d(this, null, function* () {
11202
- var c;
11203
- let a = t.filter((u) => u && u.kind && u.metadata).map((u) => v.restoreItem(u)), o = [], i = [], n = [];
11204
- for (let u in a) {
11205
- let h = a[u], p = U.cloneDeep(h);
11206
- p.metadata = p.metadata || {}, p.metadata.annotations = p.metadata.annotations || {}, r === "application/apply-patch+yaml" && (delete p.metadata.managedFields, delete p.metadata.resourceVersion);
11207
- let l = true;
11208
- try {
11209
- yield this.read(p);
11210
- } catch (P) {
11211
- if (((c = P.response) == null ? void 0 : c.status) === 404)
11212
- l = false;
11213
- else
11214
- throw P;
11215
- }
11216
- let m = l ? yield this.patch(p, r || "application/apply-patch+yaml", e == null ? void 0 : e[u]) : yield this.create(p);
11217
- l ? n.push(m) : i.push(m), o.push(m);
11218
- }
11219
- return i.length && L.emit("change", { type: "ADDED", basePath: this.basePath, items: i }), n.length && L.emit("change", { type: "MODIFIED", basePath: this.basePath, items: n }), o;
11220
- });
11221
- }
11222
- deleteYaml(t, r) {
11223
- return d(this, null, function* () {
11224
- let { sync: e } = r || {}, a = t.filter((n) => n && n.kind && n.metadata), o = [], i = [];
11225
- for (let n of a) {
11226
- n.metadata = n.metadata || {}, n.metadata.annotations = n.metadata.annotations || {};
11227
- let c = yield this.delete(n);
11228
- o.push(c), i.push(n);
11229
- }
11230
- return e && L.emit("change", { type: "DELETED", basePath: this.basePath, items: i }), o;
11231
- });
11232
- }
11233
- read(t) {
11234
- return d(this, null, function* () {
11235
- let r = yield this.specUriPath(t, "read");
11236
- return yield y__default.default.get(r, { retry: 0 }).json();
11237
- });
11238
- }
11239
- create(t) {
11240
- return d(this, null, function* () {
11241
- let r = yield this.specUriPath(t, "create");
11242
- return yield y__default.default.post(r, { retry: 0, json: t }).json();
11243
- });
11244
- }
11245
- patch(t, r, e) {
11246
- return d(this, null, function* () {
11247
- let a = yield this.specUriPath(t, "patch"), o = r === "application/json-patch+json" ? (e || []).map((n) => ({ op: "replace", path: "/" + n.split(".").join("/"), value: U.get(t, n) })) : t;
11248
- return yield y__default.default.patch(a, { headers: { "Content-Type": r }, retry: 0, json: o, searchParams: r === "application/apply-patch+yaml" ? { fieldManager: this.fieldManager || "refine", force: true } : void 0 }).json();
11249
- });
11250
- }
11251
- put(t) {
11252
- return d(this, null, function* () {
11253
- let r = yield this.specUriPath(t, "put");
11254
- return yield y__default.default.put(r, { retry: 0, json: t }).json();
11255
- });
11256
- }
11257
- delete(t) {
11258
- return d(this, null, function* () {
11259
- let r = yield this.specUriPath(t, "delete");
11260
- return yield y__default.default.delete(r, { retry: 0 }).json();
11261
- });
11262
- }
11263
- apiVersionPath(t) {
11264
- let r = t.includes("/") ? "apis" : "api";
11265
- return [this.basePath, r, t].join("/");
11266
- }
11267
- specUriPath(t, r) {
11268
- return d(this, null, function* () {
11269
- if (!t.kind)
11270
- throw new Error("Required spec property kind is not set");
11271
- t.apiVersion = t.apiVersion || "v1", t.metadata = t.metadata || {};
11272
- let e = yield this.resource(t.apiVersion, t.kind);
11273
- if (!e)
11274
- throw new Error(`Unrecognized API version and kind: ${t.apiVersion} ${t.kind}`);
11275
- e.namespaced && !t.metadata.namespace && r !== "list" && (t.metadata.namespace = this.defaultNamespace);
11276
- let a = [this.apiVersionPath(t.apiVersion)];
11277
- if (e.namespaced && t.metadata.namespace && a.push("namespaces", encodeURIComponent(String(t.metadata.namespace))), a.push(e.name), r !== "create" && r !== "list") {
11278
- if (!t.metadata.name)
11279
- throw new Error("Required spec property name is not set");
11280
- a.push(encodeURIComponent(String(t.metadata.name)));
11281
- }
11282
- return a.join("/").toLowerCase();
11283
- });
11284
- }
11285
- resource(t, r) {
11286
- return d(this, null, function* () {
11287
- let e = this.getApiVersionCacheKey(t);
11288
- if (S[e]) {
11289
- let i = S[e].resources.find((n) => n.kind === r);
11290
- if (i)
11291
- return i;
11292
- }
11293
- let a = this.apiVersionPath(t), o = yield y__default.default.get(a).json();
11294
- return S[e] = o, S[e].resources.find((i) => i.kind === r);
11295
- });
11296
- }
11297
- getApiVersionCacheKey(t) {
11298
- return `${t}@${this.basePath}`;
11299
- }
11300
- };
11301
- var A = (s, t) => !s || s.length === 0 ? t : t.filter((r) => s.every((e) => {
11302
- if ("field" in e) {
11303
- let { field: a, operator: o, value: i } = e;
11304
- return x(r, a, o, i);
11305
- } else {
11306
- let { operator: a, value: o } = e;
11307
- if (a === "or")
11308
- return o.some((i) => {
11309
- let { field: n, operator: c, value: u } = i;
11310
- return x(r, n, c, u);
11311
- });
11312
- if (a === "and")
11313
- return o.every((i) => {
11314
- let { field: n, operator: c, value: u } = i;
11315
- return x(r, n, c, u);
11316
- });
11317
- }
11318
- return true;
11319
- }));
11320
- function x(s, t, r, e) {
11321
- let a = U__default.default.get(s, t);
11322
- switch (r) {
11323
- case "eq":
11324
- return a === e;
11325
- case "ne":
11326
- return a !== e;
11327
- case "lt":
11328
- return a < e;
11329
- case "gt":
11330
- return a > e;
11331
- case "lte":
11332
- return a <= e;
11333
- case "gte":
11334
- return a >= e;
11335
- case "in":
11336
- return e.includes(a);
11337
- case "nin":
11338
- return !e.includes(a);
11339
- case "contains":
11340
- return a.includes(e);
11341
- case "ncontains":
11342
- return !a.includes(e);
11343
- case "containss":
11344
- return a.toLowerCase().includes(e.toLowerCase());
11345
- case "ncontainss":
11346
- return !a.toLowerCase().includes(e.toLowerCase());
11347
- case "between":
11348
- return e[0] <= a && a <= e[1];
11349
- case "nbetween":
11350
- return e[0] > a || a > e[1];
11351
- case "null":
11352
- return a === null;
11353
- case "nnull":
11354
- return a !== null;
11355
- case "startswith":
11356
- return a.startsWith(e);
11357
- case "nstartswith":
11358
- return !a.startsWith(e);
11359
- case "startswiths":
11360
- return a.toLowerCase().startsWith(e.toLowerCase());
11361
- case "nstartswiths":
11362
- return !a.toLowerCase().startsWith(e.toLowerCase());
11363
- case "endswith":
11364
- return a.endsWith(e);
11365
- case "nendswith":
11366
- return !a.endsWith(e);
11367
- case "endswiths":
11368
- return a.toLowerCase().endsWith(e.toLowerCase());
11369
- case "nendswiths":
11370
- return !a.toLowerCase().endsWith(e.toLowerCase());
11371
- default:
11372
- return true;
11373
- }
11374
- }
11375
- function M(s, t) {
11376
- return s != null && s.length ? [...t].sort((r, e) => {
11377
- for (let a of s) {
11378
- let { field: o, order: i } = a, n = U__default.default.get(r, o), c = U__default.default.get(e, o);
11379
- if (!(U__default.default.isNil(n) && U__default.default.isNil(c))) {
11380
- if (U__default.default.isNil(n))
11381
- return i === "asc" ? 1 : -1;
11382
- if (U__default.default.isNil(c) || n < c)
11383
- return i === "asc" ? -1 : 1;
11384
- if (n > c)
11385
- return i === "asc" ? 1 : -1;
11386
- }
11387
- }
11388
- return 0;
11389
- }) : t;
11390
- }
11391
- var N = (s, t) => {
11392
- let { current: r = 1, pageSize: e = 20, mode: a } = s != null ? s : {};
11393
- if (a !== "client")
11394
- return console.warn("k8s no support server paginateData"), t;
11395
- let o = 0, i = t.length, n = r * e;
11396
- return o = (r - 1) * e, i = n < i ? n : i, t.slice(o, i);
11397
- };
11398
- function T(s) {
11399
- var t, r, e, a;
11400
- return (t = s.metadata) != null && t.namespace ? `${(e = s.metadata) == null ? void 0 : e.namespace}/${(a = s.metadata) == null ? void 0 : a.name}` : ((r = s.metadata) == null ? void 0 : r.name) || "";
11401
- }
11402
- function $(s) {
11403
- return s.replace(/^(\/api\/)|(\/apis\/)/, "");
11404
- }
11405
- var F = (s) => {
11406
- let t = (r) => d(void 0, null, function* () {
11407
- let { resource: e, id: a, meta: o } = r, i = a.toString().split("/"), [n, c] = i.length === 1 ? [void 0, i[0]] : i, { items: u, kind: h, apiVersion: p } = yield s.get(e, o), l = u.find((m) => m.metadata.name === c && m.metadata.namespace === n);
11408
- return { data: b(f({}, l), { id: l ? T(l) : "", kind: h.replace(/List$/g, ""), apiVersion: p }) };
11409
- });
11410
- return { getList: (r) => d(void 0, null, function* () {
11411
- let { resource: e, pagination: a, filters: o, sorters: i, meta: n } = r, { items: c } = yield s.get(e, n);
11412
- return o && (c = A(o, c)), i && (c = M(i, c)), a && (c = N(a, c)), { data: c.map((u) => b(f({}, u), { id: T(u) })), total: c.length };
11413
- }), getMany: (r) => d(void 0, null, function* () {
11414
- let i = r, { ids: e } = i, a = k(i, ["ids"]);
11415
- return { data: yield Promise.all(e.map((n) => t(f({ id: n }, a)).then((c) => c.data))) };
11416
- }), create: (a) => d(void 0, [a], function* ({ variables: r, meta: e }) {
11417
- return { data: (yield new w({ basePath: s.apiUrl, fieldManager: s.fieldManager }).applyYaml([b(f({}, r), { apiVersion: $(e == null ? void 0 : e.resourceBasePath), kind: e == null ? void 0 : e.kind })]))[0] };
11418
- }), update: (a) => d(void 0, [a], function* ({ variables: r, meta: e }) {
11419
- let o = new w({ basePath: s.apiUrl, fieldManager: s.fieldManager }), i = [b(f({}, r), { apiVersion: $(e == null ? void 0 : e.resourceBasePath), kind: e == null ? void 0 : e.kind })];
11420
- return { data: (yield o.applyYaml(i, e == null ? void 0 : e.strategy, e == null ? void 0 : e.replacePaths))[0] };
11421
- }), getOne: t, deleteOne: (i) => d(void 0, null, function* () {
11422
- var n = i, { resource: r, id: e, meta: a } = n, o = k(n, ["resource", "id", "meta"]);
11423
- let c = new w({ basePath: s.apiUrl, fieldManager: s.fieldManager }), { data: u } = yield t(f({ id: e, resource: r, meta: a }, o));
11424
- return { data: (yield c.deleteYaml([u]))[0] };
11425
- }), getApiUrl: () => s.apiUrl };
11426
- };
11427
- var j = { ADDED: "created", MODIFIED: "updated", DELETED: "deleted", PING: "ping" };
11428
- function st(s) {
11429
- return Object.keys(j).find((t) => j[t] === s);
11430
- }
11431
- function _(s, t) {
11432
- return Array.isArray(s) ? s.find((r) => r.prefix === t) : s;
11433
- }
11434
- var It = (s) => ({ subscribe: ({ channel: t, params: r, callback: e }) => {
11435
- let { resource: a } = r != null ? r : {};
11436
- if (!a)
11437
- throw new Error("[WatchApi]: `resource` is required in `params` for k8s watch and globalStore");
11438
- let o = _(s, r == null ? void 0 : r.dataProviderName);
11439
- if (!o)
11440
- throw new Error("[WatchApi]: `GlobalStore` is required in `params` for k8s live provider, can not find matched `GlobalStore`");
11441
- return { stop: o.subscribe(a, (n) => {
11442
- let c = T(n.object);
11443
- e({ channel: t, type: j[n.type] || n.type, date: new Date(), payload: { ids: [c], object: n.object } });
11444
- }) };
11445
- }, unsubscribe: ({ stop: t }) => {
11446
- t == null || t();
11447
- }, publish: (t) => {
11448
- var o;
11449
- let r = _(s, (o = t.meta) == null ? void 0 : o.dataProviderName);
11450
- if (!r)
11451
- throw new Error("[WatchApi]: `GlobalStore` is required in `params` for k8s live provider, can not find matched `GlobalStore`");
11452
- let e = st(t.type), [, a] = t.channel.split("/");
11453
- if (!a)
11454
- throw new Error("[WatchApi]: `resource` is required in `params` for k8s watch and globalStore");
11455
- r.publish(a, { type: e, object: t.payload });
11456
- } });
11457
- var nt = (s) => {
11458
- switch (s) {
11459
- case "ne":
11460
- case "gte":
11461
- case "lte":
11462
- return `_${s}`;
11463
- case "contains":
11464
- return "_like";
11465
- case "eq":
11466
- default:
11467
- return "";
11468
- }
11469
- };
11470
- function it(s, t) {
11471
- return t != null && t.resourceBasePath ? { resourceBasePath: t == null ? void 0 : t.resourceBasePath, resource: s, namespace: t.namespace } : { resourceBasePath: "/api/v1", resource: "namespaces" };
11472
- }
11473
- var Q = class {
11474
- constructor(t) {
11475
- this._apiUrl = "";
11476
- this.store = /* @__PURE__ */ new Map();
11477
- this.subscribers = /* @__PURE__ */ new Map();
11478
- this.init(t);
11479
- }
11480
- get apiUrl() {
11481
- return this._apiUrl;
11482
- }
11483
- get(t, r) {
11484
- return new Promise((e, a) => {
11485
- if (this.store.has(t))
11486
- e(this.store.get(t));
11487
- else {
11488
- let o = new E({ basePath: this._apiUrl, watchWsBasePath: this.watchWsApiUrl, objectConstructor: it(t, r) }), i = false;
11489
- o.listWatch({ onResponse: (n) => {
11490
- v.processData(n), i || (e(n), i = true), this.store.set(t, n);
11491
- }, onEvent: (n) => {
11492
- v.processItem(n.object), this.notify(t, n);
11493
- } }).catch((n) => a(n));
11494
- }
11495
- });
11496
- }
11497
- subscribe(t, r) {
11498
- return this.subscribers.has(t) || this.subscribers.set(t, []), this.subscribers.get(t).push(r), () => {
11499
- let e = this.subscribers.get(t);
11500
- this.subscribers.set(t, (e == null ? void 0 : e.filter((a) => a !== r)) || []);
11501
- };
11502
- }
11503
- notify(t, r) {
11504
- let e = this.subscribers.get(t);
11505
- if (e)
11506
- for (let a of e)
11507
- a(r);
11508
- }
11509
- publish(t, r) {
11510
- this.notify(t, r);
11511
- }
11512
- init(t) {
11513
- let { apiUrl: r, watchWsApiUrl: e, prefix: a, fieldManager: o } = t;
11514
- this.store = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this._apiUrl = r, this.watchWsApiUrl = e, this.prefix = a, this.fieldManager = o;
11515
- }
11516
- };
11517
- var ee = F;
11518
- var GlobalStore = lib.GlobalStore = Q;
11519
- lib.KubeApi = E;
11520
- lib.KubeSdk = w;
11521
- var dataProvider = lib.dataProvider = F;
11522
- lib.default = ee;
11523
- lib.filterData = A;
11524
- lib.getId = T;
11525
- lib.getObjectConstructor = it;
11526
- lib.informerLog = R;
11527
- var liveProvider = lib.liveProvider = It;
11528
- lib.mapOperator = nt;
11529
- lib.sortData = M;
11530
10364
  const copy$1 = "Copy";
11531
10365
  const reset_arguments$1 = "Reset";
11532
10366
  const view_changes$1 = "Show Diff";
@@ -11601,6 +10435,11 @@ const redeploy = "\u91CD\u65B0\u90E8\u7F72";
11601
10435
  const data = "\u6570\u636E";
11602
10436
  const suspend = "\u6682\u505C";
11603
10437
  const resume = "\u91CD\u65B0\u5F00\u59CB";
10438
+ const cluster = "\u96C6\u7FA4";
10439
+ const storage = "\u5B58\u50A8";
10440
+ const network = "\u7F51\u7EDC";
10441
+ const clusterIp = "\u96C6\u7FA4 IP";
10442
+ const sessionAffinity = "\u4F1A\u8BDD\u4FDD\u6301";
11604
10443
  const dovetail = {
11605
10444
  copy,
11606
10445
  reset_arguments,
@@ -11651,7 +10490,12 @@ const dovetail = {
11651
10490
  redeploy,
11652
10491
  data,
11653
10492
  suspend,
11654
- resume
10493
+ resume,
10494
+ cluster,
10495
+ storage,
10496
+ network,
10497
+ clusterIp,
10498
+ sessionAffinity
11655
10499
  };
11656
10500
  const ZH = {
11657
10501
  dovetail
@@ -11678,13 +10522,7 @@ const globalStore = new GlobalStore({
11678
10522
  prefix: "default"
11679
10523
  });
11680
10524
  const Dovetail = (props) => {
11681
- const { resourcesConfig, urlPrefix, useHashUrl, Layout: Layout2 } = props;
11682
- const history = useMemo(() => {
11683
- if (useHashUrl) {
11684
- return createHashHistory();
11685
- }
11686
- return createBrowserHistory();
11687
- }, [useHashUrl]);
10525
+ const { resourcesConfig, urlPrefix = "", useHashUrl, Layout: Layout2, history } = props;
11688
10526
  const notCustomResources = useMemo(() => {
11689
10527
  return resourcesConfig.filter((c) => !c.isCustom);
11690
10528
  }, [resourcesConfig]);
@@ -11731,11 +10569,13 @@ const Dovetail = (props) => {
11731
10569
  };
11732
10570
  var RESOURCE_GROUP = /* @__PURE__ */ ((RESOURCE_GROUP2) => {
11733
10571
  RESOURCE_GROUP2["WORKLOAD"] = "WORKLOAD";
11734
- RESOURCE_GROUP2["CORE"] = "CORE";
10572
+ RESOURCE_GROUP2["STORAGE"] = "STORAGE";
10573
+ RESOURCE_GROUP2["NETWORK"] = "NETWORK";
10574
+ RESOURCE_GROUP2["CLUSTER"] = "CLUSTER";
11735
10575
  return RESOURCE_GROUP2;
11736
10576
  })(RESOURCE_GROUP || {});
11737
10577
  export {
11738
- DataField as $,
10578
+ JobsField as $,
11739
10579
  AgeColumnRenderer as A,
11740
10580
  Breadcrumb as B,
11741
10581
  CommonSorter as C,
@@ -11752,48 +10592,53 @@ export {
11752
10592
  NameColumnRenderer as N,
11753
10593
  KeyValue as O,
11754
10594
  PhaseColumnRenderer as P,
11755
- DeleteButton as Q,
10595
+ Separator as Q,
11756
10596
  ReplicasColumnRenderer as R,
11757
- Separator as S,
11758
- Layout as T,
11759
- ImageField as U,
11760
- ReplicaField as V,
10597
+ ServiceTypeColumnRenderer as S,
10598
+ DeleteButton as T,
10599
+ Layout as U,
10600
+ ImageField as V,
11761
10601
  WorkloadImageColumnRenderer as W,
11762
- ConditionsField as X,
10602
+ ReplicaField as X,
11763
10603
  YamlEditorComponent as Y,
11764
- PodsField as Z,
11765
- JobsField as _,
10604
+ ConditionsField as Z,
10605
+ PodsField as _,
11766
10606
  useDeleteModal as a,
11767
- SecretDataField as a0,
11768
- StartTimeField as a1,
11769
- ShowContent as a2,
11770
- DeleteManyButton as a3,
11771
- ListPage as a4,
11772
- StateTag as a5,
11773
- DrawerShow as a6,
11774
- Menu as a7,
11775
- EditButton as a8,
11776
- NS_STORE_KEY as a9,
11777
- ALL_NS as aa,
11778
- useNamespacesFilter as ab,
11779
- NamespacesFilter as ac,
11780
- Tags as ad,
11781
- BASE_INIT_VALUE as ae,
11782
- DEPLOYMENT_INIT_VALUE as af,
11783
- CRONJOB_INIT_VALUE as ag,
11784
- DAEMONSET_INIT_VALUE as ah,
11785
- JOB_INIT_VALUE as ai,
11786
- STATEFULSET_INIT_VALUE as aj,
11787
- POD_INIT_VALUE as ak,
11788
- TIMESTAMP_LABEL as al,
11789
- JobModel as am,
11790
- PodModel as an,
11791
- PodMetricsModel as ao,
11792
- ResourceModel as ap,
11793
- WorkloadModel as aq,
11794
- CronJobModel as ar,
11795
- Dovetail as as,
11796
- RESOURCE_GROUP as at,
10607
+ DataField as a0,
10608
+ SecretDataField as a1,
10609
+ StartTimeField as a2,
10610
+ ServiceTypeField as a3,
10611
+ ClusterIpField as a4,
10612
+ SessionAffinityField as a5,
10613
+ ServicePodsField as a6,
10614
+ ShowContent as a7,
10615
+ DeleteManyButton as a8,
10616
+ ListPage as a9,
10617
+ StateTag as aa,
10618
+ DrawerShow as ab,
10619
+ Menu as ac,
10620
+ EditButton as ad,
10621
+ NS_STORE_KEY as ae,
10622
+ ALL_NS as af,
10623
+ useNamespacesFilter as ag,
10624
+ NamespacesFilter as ah,
10625
+ Tags as ai,
10626
+ BASE_INIT_VALUE as aj,
10627
+ DEPLOYMENT_INIT_VALUE as ak,
10628
+ CRONJOB_INIT_VALUE as al,
10629
+ DAEMONSET_INIT_VALUE as am,
10630
+ JOB_INIT_VALUE as an,
10631
+ STATEFULSET_INIT_VALUE as ao,
10632
+ POD_INIT_VALUE as ap,
10633
+ TIMESTAMP_LABEL as aq,
10634
+ JobModel as ar,
10635
+ PodModel as as,
10636
+ PodMetricsModel as at,
10637
+ ResourceModel as au,
10638
+ WorkloadModel as av,
10639
+ CronJobModel as aw,
10640
+ Dovetail as ax,
10641
+ RESOURCE_GROUP as ay,
11797
10642
  NameSpaceColumnRenderer as b,
11798
10643
  NodeNameColumnRenderer as c,
11799
10644
  RestartCountColumnRenderer as d,