@dovetail-v2/refine 0.0.14 → 0.0.16

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.
Files changed (64) hide show
  1. package/dist/{MonacoYamlDiffEditor.2bd18ff6.js → MonacoYamlDiffEditor.4fe9fad1.js} +3 -3
  2. package/dist/{index.8d29d388.js → index.8dfa48ab.js} +1892 -1547
  3. package/dist/refine.js +82 -75
  4. package/dist/refine.umd.cjs +1806 -1461
  5. package/dist/style.css +5 -32595
  6. package/lib/src/Dovetail.d.ts +0 -2
  7. package/lib/src/components/CronJobDropdown/index.d.ts +2 -2
  8. package/lib/src/components/DrawerShow/DrawerShow.d.ts +4 -5
  9. package/lib/src/components/ErrorContent/index.d.ts +12 -0
  10. package/lib/src/components/EventsTable/EventsTable.d.ts +1 -3
  11. package/lib/src/components/K8sDropdown/index.d.ts +2 -2
  12. package/lib/src/components/ListPage/index.d.ts +1 -1
  13. package/lib/src/components/PageShow/PageShow.d.ts +5 -6
  14. package/lib/src/components/PodLog/index.d.ts +1 -1
  15. package/lib/src/components/ResourceCRUD/create/index.d.ts +5 -5
  16. package/lib/src/components/ResourceCRUD/list/index.d.ts +4 -5
  17. package/lib/src/components/ResourceCRUD/show/index.d.ts +5 -6
  18. package/lib/src/components/ShowContent/ShowContent.d.ts +5 -6
  19. package/lib/src/components/ShowContent/fields.d.ts +13 -14
  20. package/lib/src/components/Table/index.d.ts +6 -2
  21. package/lib/src/components/WorkloadDropdown/index.d.ts +2 -2
  22. package/lib/src/components/WorkloadReplicas/index.d.ts +1 -1
  23. package/lib/src/components/YamlForm/index.d.ts +6 -0
  24. package/lib/src/constants/k8s.d.ts +22 -0
  25. package/lib/src/contexts/component.d.ts +6 -0
  26. package/lib/src/contexts/global-store.d.ts +6 -0
  27. package/lib/src/contexts/index.d.ts +1 -0
  28. package/lib/src/hooks/index.d.ts +1 -0
  29. package/lib/src/hooks/useDownloadYAML.d.ts +2 -2
  30. package/lib/src/hooks/useEagleForm.d.ts +5 -0
  31. package/lib/src/hooks/useEagleTable/columns.d.ts +13 -14
  32. package/lib/src/hooks/useEagleTable/useEagleTable.d.ts +7 -8
  33. package/lib/src/hooks/useGlobalStore.d.ts +3 -0
  34. package/lib/src/hooks/useSchema.d.ts +9 -2
  35. package/lib/src/i18n.d.ts +6 -0
  36. package/lib/src/index.d.ts +2 -1
  37. package/lib/src/locales/en-US/index.d.ts +3 -0
  38. package/lib/src/locales/zh-CN/index.d.ts +3 -0
  39. package/lib/src/main.d.ts +2 -0
  40. package/lib/src/model/pod-model.d.ts +2 -0
  41. package/lib/src/models/cronjob-model.d.ts +14 -0
  42. package/lib/src/models/event-model.d.ts +8 -0
  43. package/lib/src/models/index.d.ts +9 -0
  44. package/lib/src/models/job-model.d.ts +15 -0
  45. package/lib/src/models/pod-metrics-model.d.ts +9 -0
  46. package/lib/src/models/pod-model.d.ts +20 -0
  47. package/lib/src/models/resource-model.d.ts +21 -0
  48. package/lib/src/models/types/index.d.ts +1 -0
  49. package/lib/src/models/types/metric.d.ts +25 -0
  50. package/lib/src/models/workload-base-model.d.ts +13 -0
  51. package/lib/src/models/workload-model.d.ts +17 -0
  52. package/lib/src/pages/configmaps/index.d.ts +3 -3
  53. package/lib/src/pages/jobs/index.d.ts +3 -4
  54. package/lib/src/pages/secrets/index.d.ts +3 -3
  55. package/lib/src/pages/services/index.d.ts +3 -3
  56. package/lib/src/plugins/index.d.ts +2 -0
  57. package/lib/src/plugins/model-plugin.d.ts +12 -0
  58. package/lib/src/plugins/relation-plugin.d.ts +27 -0
  59. package/lib/src/plugins/type.d.ts +8 -0
  60. package/lib/src/types/index.d.ts +0 -1
  61. package/lib/src/types/resource.d.ts +6 -20
  62. package/lib/src/utils/match-selector.d.ts +3 -0
  63. package/lib/src/utils/selector.d.ts +1 -1
  64. package/package.json +13 -4
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global2, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("js-yaml"), require("k8s-api-provider"), require("lodash-es"), require("sunflower-antd"), require("@cloudtower/icons-react"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("antd"), require("i18next")) : typeof define === "function" && define.amd ? define(["exports", "@refinedev/core", "qs", "react", "react-router-dom", "@cloudtower/eagle", "js-yaml", "k8s-api-provider", "lodash-es", "sunflower-antd", "@cloudtower/icons-react", "monaco-editor", "monaco-yaml", "react-dom", "antd", "i18next"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.core, global2.qs, global2.React, global2.reactRouterDom, global2.eagle, global2.yaml, global2.k8sApiProvider, global2.lodashEs, global2.sunflowerAntd, global2.iconsReact, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.antd$1, global2.i18n));
9
- })(this, function(exports2, core, qs, React, reactRouterDom, eagle, yaml, k8sApiProvider, lodashEs, sunflowerAntd, iconsReact, monaco, monacoYaml, ReactDOM, antd$1, i18n) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("js-yaml"), require("lodash-es"), require("sunflower-antd"), require("i18next"), require("@cloudtower/icons-react"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("antd"), require("k8s-api-provider")) : typeof define === "function" && define.amd ? define(["exports", "@refinedev/core", "qs", "react", "react-router-dom", "@cloudtower/eagle", "js-yaml", "lodash-es", "sunflower-antd", "i18next", "@cloudtower/icons-react", "monaco-editor", "monaco-yaml", "react-dom", "antd", "k8s-api-provider"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.core, global2.qs, global2.React, global2.reactRouterDom, global2.eagle, global2.yaml, global2.lodashEs, global2.sunflowerAntd, global2.i18n, global2.iconsReact, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.antd, global2.k8sApiProvider));
9
+ })(this, function(exports2, core, qs, React, reactRouterDom, eagle, yaml, lodashEs, sunflowerAntd, i18n, iconsReact, monaco, monacoYaml, ReactDOM, antd, k8sApiProvider) {
10
10
  "use strict";
11
11
  const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
12
12
  function _interopNamespace(e) {
@@ -29,9 +29,9 @@ var __publicField = (obj, key, value) => {
29
29
  }
30
30
  const React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
31
31
  const yaml__default = /* @__PURE__ */ _interopDefaultLegacy(yaml);
32
+ const i18n__default = /* @__PURE__ */ _interopDefaultLegacy(i18n);
32
33
  const monaco__namespace = /* @__PURE__ */ _interopNamespace(monaco);
33
34
  const ReactDOM__default = /* @__PURE__ */ _interopDefaultLegacy(ReactDOM);
34
- const i18n__default = /* @__PURE__ */ _interopDefaultLegacy(i18n);
35
35
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
36
36
  function getDefaultExportFromCjs(x) {
37
37
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -1069,7 +1069,7 @@ var __publicField = (obj, key, value) => {
1069
1069
  });
1070
1070
  }
1071
1071
  function useK8sYamlEditor() {
1072
- function foldSymbol(editor, symbol) {
1072
+ const foldSymbol = React.useCallback(function(editor, symbol) {
1073
1073
  const model = editor.getModel();
1074
1074
  const matchs = (model == null ? void 0 : model.findMatches(
1075
1075
  symbol,
@@ -1091,8 +1091,8 @@ var __publicField = (obj, key, value) => {
1091
1091
  reject(e);
1092
1092
  }
1093
1093
  });
1094
- }
1095
- async function fold(editor) {
1094
+ }, []);
1095
+ const fold = React.useCallback(async function(editor) {
1096
1096
  await editor.getAction("editor.unfoldAll").run();
1097
1097
  const symbols = [
1098
1098
  " annotations:",
@@ -1104,7 +1104,7 @@ var __publicField = (obj, key, value) => {
1104
1104
  await foldSymbol(editor, symbol);
1105
1105
  }
1106
1106
  editor.setScrollPosition({ scrollTop: 0 });
1107
- }
1107
+ }, [foldSymbol]);
1108
1108
  return {
1109
1109
  fold
1110
1110
  };
@@ -6703,6 +6703,8 @@ var __publicField = (obj, key, value) => {
6703
6703
  function useSchema(options) {
6704
6704
  var _a;
6705
6705
  const [schema, setSchema] = React.useState(null);
6706
+ const [loading, setLoading] = React.useState(false);
6707
+ const [error, setError] = React.useState(null);
6706
6708
  const useResourceResult = core.useResource();
6707
6709
  const resource = (options == null ? void 0 : options.resource) || useResourceResult.resource;
6708
6710
  const openapi = React.useMemo(
@@ -6712,14 +6714,31 @@ var __publicField = (obj, key, value) => {
6712
6714
  },
6713
6715
  [(_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.resourceBasePath]
6714
6716
  );
6715
- React.useEffect(() => {
6716
- (async function() {
6717
- var _a2;
6717
+ const fetchSchema = React.useCallback(async () => {
6718
+ var _a2;
6719
+ setLoading(true);
6720
+ setError(null);
6721
+ try {
6718
6722
  const schema2 = await openapi.findSchema((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.kind);
6719
6723
  setSchema(schema2 || null);
6720
- })();
6724
+ setError(null);
6725
+ } catch (e) {
6726
+ setError(e);
6727
+ } finally {
6728
+ setLoading(false);
6729
+ }
6721
6730
  }, [resource, openapi]);
6722
- return schema;
6731
+ React.useEffect(() => {
6732
+ if (options == null ? void 0 : options.skip)
6733
+ return;
6734
+ fetchSchema();
6735
+ }, [fetchSchema]);
6736
+ return {
6737
+ schema,
6738
+ loading,
6739
+ error,
6740
+ fetchSchema
6741
+ };
6723
6742
  }
6724
6743
  function generateYamlBySchema(defaultValue, schema) {
6725
6744
  const typeObject = generateSchemaTypeValue(schema);
@@ -6763,6 +6782,10 @@ var __publicField = (obj, key, value) => {
6763
6782
  const content = yaml__default.default.dump(merged);
6764
6783
  return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
6765
6784
  }
6785
+ const GlobalStoreContext = React.createContext({});
6786
+ const useGlobalStore = () => {
6787
+ return React.useContext(GlobalStoreContext);
6788
+ };
6766
6789
  const useEagleForm = ({
6767
6790
  action,
6768
6791
  resource,
@@ -6801,8 +6824,16 @@ var __publicField = (obj, key, value) => {
6801
6824
  const [editorErrors, setEditorErrors] = React.useState([]);
6802
6825
  const [errorResponseBody, setErrorResponseBody] = React.useState(null);
6803
6826
  const useResourceResult = core.useResource();
6827
+ const { globalStore } = useGlobalStore();
6804
6828
  const kit = eagle.useUIKit();
6805
- const schema = useSchema();
6829
+ const {
6830
+ schema,
6831
+ loading: isLoadingSchema,
6832
+ error: loadSchemaError,
6833
+ fetchSchema
6834
+ } = useSchema({
6835
+ skip: editorOptions == null ? void 0 : editorOptions.isSkipSchema
6836
+ });
6806
6837
  const [formAnt] = kit.form.useForm();
6807
6838
  const formSF = sunflowerAntd.useForm({
6808
6839
  form: formAnt
@@ -6898,9 +6929,7 @@ var __publicField = (obj, key, value) => {
6898
6929
  }
6899
6930
  }
6900
6931
  };
6901
- const initialValues = ((_c = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _c.data) ? {
6902
- ...k8sApiProvider.relationPlugin.restoreItem(queryResult.data.data)
6903
- } : void 0;
6932
+ const initialValues = ((_c = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _c.data) ? globalStore == null ? void 0 : globalStore.restoreItem(queryResult.data.data) : void 0;
6904
6933
  if (initialValues) {
6905
6934
  pruneBeforeEdit(initialValues);
6906
6935
  }
@@ -6930,6 +6959,10 @@ var __publicField = (obj, key, value) => {
6930
6959
  editorProps,
6931
6960
  enableEditor,
6932
6961
  errorResponseBody,
6962
+ schema,
6963
+ isLoadingSchema,
6964
+ loadSchemaError,
6965
+ fetchSchema,
6933
6966
  switchEditor() {
6934
6967
  var _a2, _b2;
6935
6968
  if (enableEditor && ((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue())) {
@@ -6952,13 +6985,13 @@ var __publicField = (obj, key, value) => {
6952
6985
  const [id, setId] = React.useState("");
6953
6986
  const { t } = useTranslation();
6954
6987
  const modalProps = {
6955
- title: t("delete"),
6956
- okText: t("delete"),
6988
+ title: t("dovetail.delete"),
6989
+ okText: t("dovetail.delete"),
6957
6990
  okButtonProps: {
6958
6991
  danger: true
6959
6992
  },
6960
- cancelText: t("cancel"),
6961
- children: t("confirm_delete_text", {
6993
+ cancelText: t("dovetail.cancel"),
6994
+ children: t("dovetail.confirm_delete_text", {
6962
6995
  target: id,
6963
6996
  interpolation: { escapeValue: false }
6964
6997
  }),
@@ -7382,7 +7415,7 @@ var __publicField = (obj, key, value) => {
7382
7415
  const currentReplicas = lodashEs.get(record, "spec.replicas", 0);
7383
7416
  const scale = (delta) => {
7384
7417
  const v = record.scale(currentReplicas + delta);
7385
- const id = v.id;
7418
+ const id = record.id;
7386
7419
  pruneBeforeEdit(v);
7387
7420
  mutate({
7388
7421
  id,
@@ -7406,6 +7439,188 @@ var __publicField = (obj, key, value) => {
7406
7439
  })]
7407
7440
  });
7408
7441
  };
7442
+ const copy$1 = "Copy";
7443
+ const reset_arguments$1 = "Reset";
7444
+ const view_changes$1 = "Show Diff";
7445
+ const back_to_edit$1 = "Edit";
7446
+ const configure_file$1 = "Configuration";
7447
+ const yaml_format_wrong$1 = "Configuration is in an invalid YAML format.";
7448
+ const yaml_value_wrong$1 = "Configuration has invalid values.";
7449
+ const edit_yaml$1 = "Edit YAML";
7450
+ const copied$1 = "Copied";
7451
+ const already_reset$1 = "Already reset";
7452
+ const fetch_schema_fail$1 = "Failed to fetch schema.";
7453
+ const obtain_data_error$1 = "Having trouble getting data.";
7454
+ const retry$1 = "Retry";
7455
+ const dovetail$1 = {
7456
+ copy: copy$1,
7457
+ reset_arguments: reset_arguments$1,
7458
+ view_changes: view_changes$1,
7459
+ back_to_edit: back_to_edit$1,
7460
+ configure_file: configure_file$1,
7461
+ yaml_format_wrong: yaml_format_wrong$1,
7462
+ yaml_value_wrong: yaml_value_wrong$1,
7463
+ edit_yaml: edit_yaml$1,
7464
+ copied: copied$1,
7465
+ already_reset: already_reset$1,
7466
+ fetch_schema_fail: fetch_schema_fail$1,
7467
+ obtain_data_error: obtain_data_error$1,
7468
+ retry: retry$1
7469
+ };
7470
+ const EN = {
7471
+ dovetail: dovetail$1
7472
+ };
7473
+ const copy = "\u590D\u5236";
7474
+ const reset_arguments = "\u91CD\u7F6E";
7475
+ const view_changes = "\u67E5\u770B\u6539\u52A8";
7476
+ const back_to_edit = "\u7F16\u8F91";
7477
+ const configure_file = "\u914D\u7F6E\u5185\u5BB9";
7478
+ const yaml_format_wrong = "\u914D\u7F6E\u5185\u5BB9\u4E0D\u662F\u6709\u6548\u7684 yaml \u683C\u5F0F\u3002";
7479
+ const yaml_value_wrong = "\u914D\u7F6E\u5185\u5BB9\u4E2D\u5B58\u5728\u4E0D\u5408\u6CD5\u7684\u503C\u3002";
7480
+ const edit_yaml = "\u7F16\u8F91 YAML";
7481
+ const copied = "\u5DF2\u590D\u5236";
7482
+ const already_reset = "\u5DF2\u91CD\u7F6E";
7483
+ const cancel = "\u53D6\u6D88";
7484
+ const create = "\u521B\u5EFA";
7485
+ const confirm_delete_text = "\u786E\u5B9A\u8981\u5220\u9664 {{target}} \u5417\uFF1F";
7486
+ const edit = "\u7F16\u8F91";
7487
+ const namespace = "\u540D\u5B57\u7A7A\u95F4";
7488
+ const name = "\u540D\u79F0";
7489
+ const state = "\u72B6\u6001";
7490
+ const status = "\u72B6\u6001";
7491
+ const phase = "\u72B6\u6001";
7492
+ const image = "\u5BB9\u5668\u955C\u50CF";
7493
+ const replicas = "\u526F\u672C\u6570";
7494
+ const created_time = "\u521B\u5EFA\u65F6\u95F4";
7495
+ const label = "\u6807\u7B7E";
7496
+ const annotation = "\u6CE8\u91CA";
7497
+ const type = "\u7C7B\u578B";
7498
+ const event = "\u4E8B\u4EF6";
7499
+ const reason = "\u539F\u56E0";
7500
+ const object = "\u5BF9\u8C61";
7501
+ const note = "\u4E8B\u4EF6\u4FE1\u606F";
7502
+ const condition = "Condition";
7503
+ const download_yaml = "\u4E0B\u8F7D YAML";
7504
+ const detail = "\u8BE6\u60C5";
7505
+ const node_name = "\u4E3B\u673A\u540D\u79F0";
7506
+ const restarts = "\u91CD\u542F\u6B21\u6570";
7507
+ const updated_time = "\u66F4\u65B0\u65F6\u95F4";
7508
+ const message = "\u6D88\u606F";
7509
+ const save = "\u4FDD\u5B58";
7510
+ const more = "\u66F4\u591A";
7511
+ const workload = "\u5DE5\u4F5C\u8D1F\u8F7D";
7512
+ const all_namespaces = "\u6240\u6709\u540D\u5B57\u7A7A\u95F4";
7513
+ const empty = "\u65E0\u53EF\u663E\u793A\u7684\u6570\u636E";
7514
+ const schedule = "\u8C03\u5EA6\u65F6\u95F4\u8868";
7515
+ const lastScheduleTime = "\u4E0A\u6B21\u8C03\u5EA6\u65F6\u95F4";
7516
+ const duration = "\u6301\u7EED\u65F6\u95F4";
7517
+ const completions = "\u5B8C\u6210 Job \u5386\u53F2\u6570";
7518
+ const started = "\u5F00\u59CB\u65F6\u95F4";
7519
+ const ready = "\u5C31\u7EEA";
7520
+ const init_container = "\u521D\u59CB\u5316\u5BB9\u5668";
7521
+ const container = "\u5BB9\u5668";
7522
+ const redeploy = "\u91CD\u65B0\u90E8\u7F72";
7523
+ const data = "\u6570\u636E";
7524
+ const suspend = "\u6682\u505C";
7525
+ const resume = "\u91CD\u65B0\u5F00\u59CB";
7526
+ const cluster = "\u96C6\u7FA4";
7527
+ const storage = "\u5B58\u50A8";
7528
+ const network = "\u7F51\u7EDC";
7529
+ const clusterIp = "\u96C6\u7FA4 IP";
7530
+ const sessionAffinity = "\u4F1A\u8BDD\u4FDD\u6301";
7531
+ const log = "\u65E5\u5FD7";
7532
+ const select_container = "\u9009\u62E9\u5BB9\u5668";
7533
+ const wrap = "\u6298\u53E0";
7534
+ const resume_log = "\u7EE7\u7EED";
7535
+ const log_new_lines = "\uFF0C\u5E76\u5C55\u793A {{ count }} \u884C\u65B0\u65E5\u5FD7";
7536
+ const fetch_schema_fail = "\u83B7\u53D6 schema \u5931\u8D25\u3002";
7537
+ const obtain_data_error = "\u83B7\u53D6\u6570\u636E\u65F6\u9047\u5230\u95EE\u9898\u3002";
7538
+ const retry = "\u91CD\u8BD5";
7539
+ const dovetail = {
7540
+ copy,
7541
+ reset_arguments,
7542
+ view_changes,
7543
+ back_to_edit,
7544
+ configure_file,
7545
+ yaml_format_wrong,
7546
+ yaml_value_wrong,
7547
+ edit_yaml,
7548
+ copied,
7549
+ already_reset,
7550
+ cancel,
7551
+ "delete": "\u5220\u9664",
7552
+ create,
7553
+ confirm_delete_text,
7554
+ edit,
7555
+ namespace,
7556
+ name,
7557
+ state,
7558
+ status,
7559
+ phase,
7560
+ image,
7561
+ replicas,
7562
+ created_time,
7563
+ label,
7564
+ annotation,
7565
+ type,
7566
+ event,
7567
+ reason,
7568
+ object,
7569
+ note,
7570
+ condition,
7571
+ download_yaml,
7572
+ detail,
7573
+ node_name,
7574
+ restarts,
7575
+ updated_time,
7576
+ message,
7577
+ save,
7578
+ more,
7579
+ workload,
7580
+ all_namespaces,
7581
+ empty,
7582
+ schedule,
7583
+ lastScheduleTime,
7584
+ duration,
7585
+ completions,
7586
+ started,
7587
+ ready,
7588
+ init_container,
7589
+ container,
7590
+ redeploy,
7591
+ data,
7592
+ suspend,
7593
+ resume,
7594
+ cluster,
7595
+ storage,
7596
+ network,
7597
+ clusterIp,
7598
+ sessionAffinity,
7599
+ log,
7600
+ select_container,
7601
+ wrap,
7602
+ resume_log,
7603
+ log_new_lines,
7604
+ fetch_schema_fail,
7605
+ obtain_data_error,
7606
+ retry
7607
+ };
7608
+ const ZH = {
7609
+ dovetail
7610
+ };
7611
+ const resources = {
7612
+ "en-US": EN,
7613
+ "zh-CN": ZH
7614
+ };
7615
+ i18n__default.default.use(initReactI18next).init({
7616
+ supportedLngs: ["en-US", "zh-CN"],
7617
+ resources,
7618
+ ns: Object.keys(resources["zh-CN"]),
7619
+ defaultNS: "dovetail",
7620
+ fallbackLng: ["en-US", "zh-CN"],
7621
+ lng: "zh-CN",
7622
+ nsSeparator: "."
7623
+ });
7409
7624
  const NameLink = (props) => {
7410
7625
  var _a;
7411
7626
  const { name: name2, id, resource } = props;
@@ -7442,13 +7657,13 @@ var __publicField = (obj, key, value) => {
7442
7657
  return 1;
7443
7658
  return -1;
7444
7659
  };
7445
- const NameColumnRenderer = (i18n2, resource = "") => {
7660
+ const NameColumnRenderer = (resource = "") => {
7446
7661
  const dataIndex = ["metadata", "name"];
7447
7662
  return {
7448
7663
  key: "name",
7449
7664
  display: true,
7450
7665
  dataIndex,
7451
- title: i18n2.t("name"),
7666
+ title: i18n__default.default.t("dovetail.name"),
7452
7667
  sortable: true,
7453
7668
  sorter: CommonSorter(dataIndex),
7454
7669
  render: (v, record) => {
@@ -7456,50 +7671,60 @@ var __publicField = (obj, key, value) => {
7456
7671
  }
7457
7672
  };
7458
7673
  };
7459
- const NameSpaceColumnRenderer = (i18n2) => {
7674
+ const NameSpaceColumnRenderer = () => {
7460
7675
  const dataIndex = ["metadata", "namespace"];
7461
7676
  return {
7462
7677
  key: "namespace",
7463
7678
  display: true,
7464
7679
  dataIndex,
7465
- title: i18n2.t("namespace"),
7680
+ title: i18n__default.default.t("dovetail.namespace"),
7466
7681
  sortable: true,
7467
7682
  sorter: CommonSorter(dataIndex)
7468
7683
  };
7469
7684
  };
7470
- const PhaseColumnRenderer = (i18n2) => {
7685
+ const PhaseColumnRenderer = () => {
7471
7686
  const dataIndex = ["status", "phase"];
7472
7687
  return {
7473
7688
  key: "phase",
7474
7689
  display: true,
7475
7690
  dataIndex,
7476
- title: i18n2.t("phase"),
7691
+ title: i18n__default.default.t("dovetail.phase"),
7477
7692
  sortable: true,
7478
7693
  sorter: CommonSorter(dataIndex),
7479
7694
  render: (v) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: v })
7480
7695
  };
7481
7696
  };
7482
- const WorkloadImageColumnRenderer = (i18n2) => {
7697
+ const WorkloadImageColumnRenderer = () => {
7483
7698
  const dataIndex = ["imageNames"];
7484
7699
  return {
7485
7700
  key: "image",
7486
7701
  display: true,
7487
7702
  dataIndex,
7488
- title: i18n2.t("image"),
7703
+ title: i18n__default.default.t("dovetail.image"),
7489
7704
  sortable: true,
7490
7705
  sorter: CommonSorter(dataIndex),
7491
- render(value) {
7492
- return /* @__PURE__ */ jsxRuntime.exports.jsx(ImageNames, { value });
7706
+ render(value, record) {
7707
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(ImageNames, { value: record.imageNames });
7493
7708
  }
7494
7709
  };
7495
7710
  };
7496
- const ReplicasColumnRenderer = (i18n2) => {
7711
+ const WorkloadRestartsColumnRenderer = () => {
7712
+ const dataIndex = ["restarts"];
7713
+ return {
7714
+ key: "restarts",
7715
+ display: true,
7716
+ dataIndex,
7717
+ title: i18n__default.default.t("dovetail.restarts"),
7718
+ sortable: false
7719
+ };
7720
+ };
7721
+ const ReplicasColumnRenderer = () => {
7497
7722
  const dataIndex = ["status", "replicas"];
7498
7723
  return {
7499
7724
  key: "replicas",
7500
7725
  display: true,
7501
7726
  dataIndex,
7502
- title: i18n2.t("replicas"),
7727
+ title: i18n__default.default.t("dovetail.replicas"),
7503
7728
  sortable: true,
7504
7729
  sorter: CommonSorter(dataIndex),
7505
7730
  render: (_, record) => {
@@ -7507,13 +7732,13 @@ var __publicField = (obj, key, value) => {
7507
7732
  }
7508
7733
  };
7509
7734
  };
7510
- const AgeColumnRenderer = (i18n2) => {
7735
+ const AgeColumnRenderer = () => {
7511
7736
  const dataIndex = ["metadata", "creationTimestamp"];
7512
7737
  return {
7513
7738
  key: "creationTimestamp",
7514
7739
  display: true,
7515
7740
  dataIndex,
7516
- title: i18n2.t("created_time"),
7741
+ title: i18n__default.default.t("dovetail.created_time"),
7517
7742
  sortable: true,
7518
7743
  sorter: (a, b) => {
7519
7744
  const valA = new Date(lodash.exports.get(a, dataIndex));
@@ -7529,55 +7754,56 @@ var __publicField = (obj, key, value) => {
7529
7754
  }
7530
7755
  };
7531
7756
  };
7532
- const NodeNameColumnRenderer = (i18n2) => {
7757
+ const NodeNameColumnRenderer = (options) => {
7533
7758
  const dataIndex = ["spec", "nodeName"];
7534
7759
  return {
7535
7760
  key: "node",
7536
7761
  display: true,
7537
7762
  dataIndex,
7538
- title: i18n2.t("node_name"),
7763
+ title: i18n__default.default.t("dovetail.node_name"),
7539
7764
  sortable: true,
7540
- sorter: CommonSorter(dataIndex)
7765
+ sorter: CommonSorter(dataIndex),
7766
+ ...options
7541
7767
  };
7542
7768
  };
7543
- const RestartCountColumnRenderer = (i18n2) => {
7769
+ const RestartCountColumnRenderer = () => {
7544
7770
  const dataIndex = ["restartCount"];
7545
7771
  return {
7546
7772
  key: "restartCount",
7547
7773
  display: true,
7548
7774
  dataIndex,
7549
- title: i18n2.t("restarts"),
7775
+ title: i18n__default.default.t("dovetail.restarts"),
7550
7776
  sortable: true,
7551
7777
  sorter: CommonSorter(dataIndex)
7552
7778
  };
7553
7779
  };
7554
- const CompletionsCountColumnRenderer = (i18n2) => {
7780
+ const CompletionsCountColumnRenderer = () => {
7555
7781
  const dataIndex = ["completionsDisplay"];
7556
7782
  return {
7557
7783
  key: "completions",
7558
7784
  display: true,
7559
7785
  dataIndex,
7560
- title: i18n2.t("completions"),
7786
+ title: i18n__default.default.t("completions"),
7561
7787
  sortable: true,
7562
7788
  sorter: CommonSorter(dataIndex)
7563
7789
  };
7564
7790
  };
7565
- const DurationColumnRenderer = (i18n2) => {
7791
+ const DurationColumnRenderer = () => {
7566
7792
  const dataIndex = ["durationDisplay"];
7567
7793
  return {
7568
7794
  key: "duration",
7569
7795
  display: true,
7570
7796
  dataIndex,
7571
- title: i18n2.t("duration"),
7797
+ title: i18n__default.default.t("dovetail.duration"),
7572
7798
  sortable: true,
7573
7799
  sorter: CommonSorter(dataIndex)
7574
7800
  };
7575
7801
  };
7576
- const ServiceTypeColumnRenderer = (i18n2) => {
7577
- const dataIndex = ["rawYaml", "spec", "type"];
7802
+ const ServiceTypeColumnRenderer = () => {
7803
+ const dataIndex = ["spec", "type"];
7578
7804
  return {
7579
7805
  key: "type",
7580
- title: i18n2.t("dovetail.type"),
7806
+ title: i18n__default.default.t("dovetail.type"),
7581
7807
  display: true,
7582
7808
  dataIndex,
7583
7809
  sortable: true,
@@ -7599,6 +7825,7 @@ var __publicField = (obj, key, value) => {
7599
7825
  function useDownloadYAML() {
7600
7826
  return function(options) {
7601
7827
  const { name: name2, item } = options;
7828
+ console.log("download", item);
7602
7829
  const content = yaml__default.default.dump(item);
7603
7830
  download(`${name2}.yaml`, content);
7604
7831
  };
@@ -7624,8 +7851,9 @@ var __publicField = (obj, key, value) => {
7624
7851
  return { edit: edit2 };
7625
7852
  }
7626
7853
  function K8sDropdown(props) {
7627
- const { data: data2 } = props;
7854
+ const { record } = props;
7628
7855
  const kit = eagle.useUIKit();
7856
+ const { globalStore } = useGlobalStore();
7629
7857
  const useResourceResult = core.useResource();
7630
7858
  const resource = useResourceResult.resource;
7631
7859
  const { edit: edit2 } = useEdit();
@@ -7643,11 +7871,11 @@ var __publicField = (obj, key, value) => {
7643
7871
  kit.menuItem,
7644
7872
  {
7645
7873
  onClick: () => {
7646
- if (data2.id) {
7647
- edit2(data2.id);
7874
+ if (record.id) {
7875
+ edit2(record.id);
7648
7876
  }
7649
7877
  },
7650
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t("edit") })
7878
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t("dovetail.edit") })
7651
7879
  }
7652
7880
  ),
7653
7881
  /* @__PURE__ */ jsxRuntime.exports.jsx(
@@ -7655,9 +7883,9 @@ var __publicField = (obj, key, value) => {
7655
7883
  {
7656
7884
  danger: true,
7657
7885
  onClick: () => {
7658
- openDeleteConfirmModal(data2.id);
7886
+ openDeleteConfirmModal(record.id);
7659
7887
  },
7660
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t("delete") })
7888
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t("dovetail.delete") })
7661
7889
  }
7662
7890
  ),
7663
7891
  /* @__PURE__ */ jsxRuntime.exports.jsx(
@@ -7665,14 +7893,14 @@ var __publicField = (obj, key, value) => {
7665
7893
  {
7666
7894
  onClick: () => {
7667
7895
  var _a;
7668
- if (data2.id) {
7896
+ if (record.id) {
7669
7897
  download2({
7670
- name: ((_a = data2.metadata) == null ? void 0 : _a.name) || data2.kind || "",
7671
- item: data2
7898
+ name: ((_a = record.metadata) == null ? void 0 : _a.name) || record.kind || "",
7899
+ item: (globalStore == null ? void 0 : globalStore.restoreItem(record)) || record
7672
7900
  });
7673
7901
  }
7674
7902
  },
7675
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t("download_yaml") })
7903
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t("dovetail.download_yaml") })
7676
7904
  }
7677
7905
  ),
7678
7906
  props.children
@@ -7865,9 +8093,13 @@ var __publicField = (obj, key, value) => {
7865
8093
  const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
7866
8094
  const [selectedKeys, setSelectedKeys] = React.useState([]);
7867
8095
  const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
8096
+ const { resource } = core.useResource();
7868
8097
  const { value: nsFilter } = useNamespacesFilter();
7869
8098
  const useTableParams = React.useMemo(() => {
7870
8099
  const mergedParams = lodashEs.merge(params.useTableParams, {
8100
+ pagination: {
8101
+ mode: "off"
8102
+ },
7871
8103
  filters: {
7872
8104
  permanent: [
7873
8105
  {
@@ -7887,20 +8119,13 @@ var __publicField = (obj, key, value) => {
7887
8119
  },
7888
8120
  [setCurrentPage]
7889
8121
  );
7890
- const actionColumn = {
7891
- key: "action",
7892
- display: true,
7893
- dataIndex: [],
7894
- title: () => /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.SettingsGear16GradientGrayIcon }),
7895
- render: (_, record) => {
7896
- return /* @__PURE__ */ jsxRuntime.exports.jsx(Dropdown, { data: record });
7897
- }
7898
- };
7899
- const finalDataSource = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data.map(formatter);
8122
+ const data2 = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data;
8123
+ const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
7900
8124
  const finalProps = {
8125
+ tableKey: (resource == null ? void 0 : resource.name) || "table",
7901
8126
  loading: table.tableQueryResult.isLoading,
7902
- dataSource: finalDataSource || [],
7903
- columns: [...columns, actionColumn],
8127
+ data: finalDataSource || [],
8128
+ columns,
7904
8129
  refetch: () => null,
7905
8130
  error: false,
7906
8131
  rowKey: "id",
@@ -7909,7 +8134,8 @@ var __publicField = (obj, key, value) => {
7909
8134
  onPageChange,
7910
8135
  onSelect: (keys) => {
7911
8136
  setSelectedKeys(keys);
7912
- }
8137
+ },
8138
+ RowMenu: Dropdown
7913
8139
  };
7914
8140
  return { tableProps: finalProps, selectedKeys, ...table };
7915
8141
  };
@@ -8016,7 +8242,6 @@ var __publicField = (obj, key, value) => {
8016
8242
  const onValueChange = React.useCallback(
8017
8243
  (event2) => {
8018
8244
  var _a;
8019
- console.log(event2);
8020
8245
  const value = event2.target.value;
8021
8246
  (_a = props.onChange) == null ? void 0 : _a.call(props, {
8022
8247
  ...item,
@@ -8069,7 +8294,6 @@ var __publicField = (obj, key, value) => {
8069
8294
  {
8070
8295
  item,
8071
8296
  onChange: (newItem) => {
8072
- console.log(newItem);
8073
8297
  const temp = [...items];
8074
8298
  temp.splice(index, 1, newItem);
8075
8299
  onChange(temp);
@@ -8117,9 +8341,9 @@ var __publicField = (obj, key, value) => {
8117
8341
  });
8118
8342
  }
8119
8343
  const ErrorContent_1t51xnx = "";
8120
- const ErrorWrapper = "eckm4od";
8121
- const ErrorContent = "e1hl982n";
8122
- const WidgetErrorContent = (props) => {
8344
+ const ErrorWrapper$1 = "eckm4od";
8345
+ const ErrorContent$1 = "e1hl982n";
8346
+ const WidgetErrorContent$1 = (props) => {
8123
8347
  const {
8124
8348
  refetch
8125
8349
  } = props;
@@ -8128,10 +8352,10 @@ var __publicField = (obj, key, value) => {
8128
8352
  t
8129
8353
  } = useTranslation();
8130
8354
  return /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
8131
- className: ErrorWrapper,
8355
+ className: ErrorWrapper$1,
8132
8356
  style: props.style,
8133
8357
  children: /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
8134
- className: ErrorContent,
8358
+ className: ErrorContent$1,
8135
8359
  children: [/* @__PURE__ */ jsxRuntime.exports.jsx("p", {
8136
8360
  className: cx_default(eagle.Typo.Label.l1_regular_title, "title"),
8137
8361
  children: props.errorText || t("dovetail.obtain_data_error")
@@ -8155,28 +8379,28 @@ var __publicField = (obj, key, value) => {
8155
8379
  key: "type",
8156
8380
  display: true,
8157
8381
  dataIndex: "type",
8158
- title: t("condition"),
8382
+ title: t("dovetail.condition"),
8159
8383
  sortable: true
8160
8384
  },
8161
8385
  {
8162
8386
  key: "status",
8163
8387
  display: true,
8164
8388
  dataIndex: "status",
8165
- title: t("status"),
8389
+ title: t("dovetail.status"),
8166
8390
  sortable: true
8167
8391
  },
8168
8392
  {
8169
8393
  key: "reason",
8170
8394
  display: true,
8171
8395
  dataIndex: "reason",
8172
- title: t("reason"),
8396
+ title: t("dovetail.reason"),
8173
8397
  sortable: true
8174
8398
  },
8175
8399
  {
8176
8400
  key: "lastUpdateTime",
8177
8401
  display: true,
8178
8402
  dataIndex: "lastUpdateTime",
8179
- title: t("updated_time"),
8403
+ title: t("dovetail.updated_time"),
8180
8404
  sortable: true,
8181
8405
  render: (value, record) => {
8182
8406
  const time = value || record.lastTransitionTime;
@@ -8187,12 +8411,12 @@ var __publicField = (obj, key, value) => {
8187
8411
  key: "message",
8188
8412
  display: true,
8189
8413
  dataIndex: "message",
8190
- title: t("message"),
8414
+ title: t("dovetail.message"),
8191
8415
  sortable: true
8192
8416
  }
8193
8417
  ];
8194
8418
  if (conditionsWithId.length === 0) {
8195
- return /* @__PURE__ */ jsxRuntime.exports.jsx(WidgetErrorContent, { errorText: t("dovetail.empty"), style: { padding: "15px 0" } });
8419
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(WidgetErrorContent$1, { errorText: t("dovetail.empty"), style: { padding: "15px 0" } });
8196
8420
  }
8197
8421
  return /* @__PURE__ */ jsxRuntime.exports.jsx(
8198
8422
  kit.table,
@@ -8205,1028 +8429,574 @@ var __publicField = (obj, key, value) => {
8205
8429
  }
8206
8430
  );
8207
8431
  };
8208
- function getSecondsDiff(startDate, endDate) {
8209
- return Math.round(Math.abs(Date.parse(endDate) - Date.parse(startDate)) / 1e3);
8432
+ function memoize(fn) {
8433
+ var cache = /* @__PURE__ */ Object.create(null);
8434
+ return function(arg) {
8435
+ if (cache[arg] === void 0)
8436
+ cache[arg] = fn(arg);
8437
+ return cache[arg];
8438
+ };
8210
8439
  }
8211
- function elapsedTime(seconds) {
8212
- if (!seconds) {
8213
- return {};
8440
+ var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
8441
+ var isPropValid = /* @__PURE__ */ memoize(
8442
+ function(prop) {
8443
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
8214
8444
  }
8215
- if (seconds < 120) {
8216
- return {
8217
- diff: 1,
8218
- label: `${seconds}s`
8219
- };
8445
+ );
8446
+ var isCapital = (ch) => ch.toUpperCase() === ch;
8447
+ var filterKey = (keys) => (key) => keys.indexOf(key) === -1;
8448
+ var omit = (obj, keys) => {
8449
+ const res = {};
8450
+ Object.keys(obj).filter(filterKey(keys)).forEach((key) => {
8451
+ res[key] = obj[key];
8452
+ });
8453
+ return res;
8454
+ };
8455
+ function filterProps(asIs, props, omitKeys) {
8456
+ const filteredProps = omit(props, omitKeys);
8457
+ if (!asIs) {
8458
+ const interopValidAttr = typeof isPropValid === "function" ? { default: isPropValid } : isPropValid;
8459
+ Object.keys(filteredProps).forEach((key) => {
8460
+ if (!interopValidAttr.default(key)) {
8461
+ delete filteredProps[key];
8462
+ }
8463
+ });
8220
8464
  }
8221
- const minutes = Math.floor(seconds / 60);
8222
- if (minutes < 10) {
8223
- return {
8224
- diff: 1,
8225
- label: `${minutes}m${seconds - minutes * 60}s`
8226
- };
8227
- }
8228
- const hours = Math.floor(seconds / 3600);
8229
- if (hours < 3) {
8230
- return {
8231
- diff: 60,
8232
- label: `${minutes}m`
8233
- };
8234
- }
8235
- const days = Math.floor(seconds / (3600 * 24));
8236
- if (days > 1) {
8237
- return {
8238
- diff: 60,
8239
- label: `${days}d${hours - days * 24}h`
8240
- };
8241
- }
8242
- if (hours > 7) {
8243
- return {
8244
- diff: 60,
8245
- label: `${hours}h`
8246
- };
8247
- }
8248
- return {
8249
- diff: 60,
8250
- label: `${hours}h${minutes - hours * 60}m`
8251
- };
8465
+ return filteredProps;
8252
8466
  }
8253
- const BASE_INIT_VALUE = {
8254
- metadata: {
8255
- name: "",
8256
- namespace: "default",
8257
- annotations: {},
8258
- labels: {}
8259
- }
8260
- };
8261
- const DEFAULT_MATCH_LABEL = "sks.user.kubesmart.smtx.io/app";
8262
- const BASE_CONTAINER_INIT_VALUE = {
8263
- name: "container-0",
8264
- imagePullPolicy: "Always",
8265
- image: ""
8266
- };
8267
- const BASE_WORKLOAD_SPEC_INIT_VALUE = {
8268
- affinity: {},
8269
- imagePullSecrets: [],
8270
- initContainers: [],
8271
- volumes: []
8272
- };
8273
- const DEPLOYMENT_INIT_VALUE = {
8274
- apiVersion: "apps/v1",
8275
- kind: "Deployment",
8276
- ...BASE_INIT_VALUE,
8277
- spec: {
8278
- replicas: 1,
8279
- selector: {
8280
- matchLabels: {
8281
- [DEFAULT_MATCH_LABEL]: ""
8282
- }
8283
- },
8284
- template: {
8285
- metadata: {
8286
- labels: {
8287
- [DEFAULT_MATCH_LABEL]: ""
8288
- }
8289
- },
8290
- spec: {
8291
- containers: [BASE_CONTAINER_INIT_VALUE],
8292
- restartPolicy: "Always",
8293
- ...BASE_WORKLOAD_SPEC_INIT_VALUE
8294
- }
8467
+ var warnIfInvalid = (value, componentName) => {
8468
+ if (process.env.NODE_ENV !== "production") {
8469
+ if (typeof value === "string" || typeof value === "number" && isFinite(value)) {
8470
+ return;
8295
8471
  }
8472
+ const stringified = typeof value === "object" ? JSON.stringify(value) : String(value);
8473
+ console.warn(
8474
+ `An interpolation evaluated to '${stringified}' in the component '${componentName}', which is probably a mistake. You should explicitly cast or transform the value to a string.`
8475
+ );
8296
8476
  }
8297
8477
  };
8298
- const CRONJOB_INIT_VALUE = {
8299
- apiVersion: "batch/v1beta1",
8300
- kind: "CronJob",
8301
- ...BASE_INIT_VALUE,
8302
- spec: {
8303
- schedule: "",
8304
- jobTemplate: {
8305
- metadata: {
8306
- labels: {}
8307
- },
8308
- spec: {
8309
- template: {
8310
- spec: {
8311
- containers: [BASE_CONTAINER_INIT_VALUE],
8312
- restartPolicy: "Never",
8313
- ...BASE_WORKLOAD_SPEC_INIT_VALUE
8314
- }
8315
- }
8316
- }
8478
+ var idx = 0;
8479
+ function styled(tag) {
8480
+ var _a;
8481
+ let mockedClass = "";
8482
+ if (process.env.NODE_ENV === "test") {
8483
+ mockedClass += `mocked-styled-${idx++}`;
8484
+ if ((_a = tag == null ? void 0 : tag.__linaria) == null ? void 0 : _a.className) {
8485
+ mockedClass += ` ${tag.__linaria.className}`;
8317
8486
  }
8318
8487
  }
8319
- };
8320
- const DAEMONSET_INIT_VALUE = {
8321
- apiVersion: "apps/v1",
8322
- kind: "DaemonSet",
8323
- ...BASE_INIT_VALUE,
8324
- spec: {
8325
- replicas: 1,
8326
- selector: {
8327
- matchLabels: {
8328
- [DEFAULT_MATCH_LABEL]: ""
8488
+ return (options) => {
8489
+ if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test") {
8490
+ if (Array.isArray(options)) {
8491
+ throw new Error(
8492
+ 'Using the "styled" tag in runtime is not supported. Make sure you have set up the Babel plugin correctly. See https://github.com/callstack/linaria#setup'
8493
+ );
8329
8494
  }
8330
- },
8331
- template: {
8332
- metadata: {
8333
- labels: {
8334
- [DEFAULT_MATCH_LABEL]: ""
8495
+ }
8496
+ const render = (props, ref) => {
8497
+ const { as: component = tag, class: className = mockedClass } = props;
8498
+ const shouldKeepProps = options.propsAsIs === void 0 ? !(typeof component === "string" && component.indexOf("-") === -1 && !isCapital(component[0])) : options.propsAsIs;
8499
+ const filteredProps = filterProps(shouldKeepProps, props, [
8500
+ "as",
8501
+ "class"
8502
+ ]);
8503
+ filteredProps.ref = ref;
8504
+ filteredProps.className = options.atomic ? cx_default(options.class, filteredProps.className || className) : cx_default(filteredProps.className || className, options.class);
8505
+ const { vars } = options;
8506
+ if (vars) {
8507
+ const style = {};
8508
+ for (const name2 in vars) {
8509
+ const variable = vars[name2];
8510
+ const result = variable[0];
8511
+ const unit = variable[1] || "";
8512
+ const value = typeof result === "function" ? result(props) : result;
8513
+ warnIfInvalid(value, options.name);
8514
+ style[`--${name2}`] = `${value}${unit}`;
8335
8515
  }
8336
- },
8337
- spec: {
8338
- containers: [BASE_CONTAINER_INIT_VALUE],
8339
- restartPolicy: "Always",
8340
- ...BASE_WORKLOAD_SPEC_INIT_VALUE
8516
+ const ownStyle = filteredProps.style || {};
8517
+ const keys = Object.keys(ownStyle);
8518
+ if (keys.length > 0) {
8519
+ keys.forEach((key) => {
8520
+ style[key] = ownStyle[key];
8521
+ });
8522
+ }
8523
+ filteredProps.style = style;
8341
8524
  }
8342
- }
8343
- }
8344
- };
8345
- const JOB_INIT_VALUE = {
8346
- apiVersion: "batch/v1",
8347
- kind: "Job",
8348
- ...BASE_INIT_VALUE,
8349
- spec: {
8350
- replicas: 1,
8351
- selector: {
8352
- matchLabels: {}
8353
- },
8354
- template: {
8355
- metadata: {
8356
- labels: {}
8357
- },
8358
- spec: {
8359
- containers: [BASE_CONTAINER_INIT_VALUE],
8360
- restartPolicy: "Never",
8361
- ...BASE_WORKLOAD_SPEC_INIT_VALUE
8525
+ if (tag.__linaria && tag !== component) {
8526
+ filteredProps.as = component;
8527
+ return React__default.default.createElement(tag, filteredProps);
8362
8528
  }
8363
- }
8529
+ return React__default.default.createElement(component, filteredProps);
8530
+ };
8531
+ const Result = React__default.default.forwardRef ? React__default.default.forwardRef(render) : (props) => {
8532
+ const rest = omit(props, ["innerRef"]);
8533
+ return render(rest, props.innerRef);
8534
+ };
8535
+ Result.displayName = options.name;
8536
+ Result.__linaria = {
8537
+ className: options.class || mockedClass,
8538
+ extends: tag
8539
+ };
8540
+ return Result;
8541
+ };
8542
+ }
8543
+ var styled_default = process.env.NODE_ENV !== "production" ? new Proxy(styled, {
8544
+ get(o, prop) {
8545
+ return o(prop);
8364
8546
  }
8365
- };
8366
- const STATEFULSET_INIT_VALUE = {
8367
- apiVersion: "apps/v1",
8368
- kind: "StatefulSet",
8369
- ...BASE_INIT_VALUE,
8370
- spec: {
8371
- replicas: 1,
8372
- selector: {
8373
- matchLabels: {
8374
- [DEFAULT_MATCH_LABEL]: ""
8375
- }
8376
- },
8377
- template: {
8378
- metadata: {
8379
- labels: {
8380
- [DEFAULT_MATCH_LABEL]: ""
8547
+ }) : styled;
8548
+ const TableWidgets_ny30pi = "";
8549
+ const AuxiliaryLine = /* @__PURE__ */ styled_default("div")({
8550
+ name: "AuxiliaryLine",
8551
+ class: "ax1qopv",
8552
+ propsAsIs: false
8553
+ });
8554
+ const index_dmbxj3 = "";
8555
+ const TableContainerStyle = "t1upn1sz";
8556
+ function Table(props) {
8557
+ const kit = eagle.useUIKit();
8558
+ const {
8559
+ t
8560
+ } = useTranslation();
8561
+ const {
8562
+ loading,
8563
+ error,
8564
+ data: dataSource,
8565
+ rowKey,
8566
+ columns,
8567
+ scroll,
8568
+ currentPage,
8569
+ currentSize,
8570
+ RowMenu,
8571
+ refetch,
8572
+ onSelect,
8573
+ onPageChange,
8574
+ onSizeChange
8575
+ } = props;
8576
+ const auxiliaryLineRef = React.useRef(null);
8577
+ const wrapperRef = React.useRef(null);
8578
+ const pagination = React.useMemo(() => ({
8579
+ current: currentPage,
8580
+ pageSize: currentSize,
8581
+ onChange: onPageChange
8582
+ }), [currentPage, currentSize, onPageChange]);
8583
+ const finalColumns = React.useMemo(() => {
8584
+ if (RowMenu) {
8585
+ const actionColumn = {
8586
+ key: "_action_",
8587
+ display: true,
8588
+ dataIndex: [],
8589
+ title: "",
8590
+ render: (_, record) => {
8591
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(RowMenu, {
8592
+ record
8593
+ });
8381
8594
  }
8382
- },
8383
- spec: {
8384
- containers: [BASE_CONTAINER_INIT_VALUE],
8385
- restartPolicy: "Always",
8386
- ...BASE_WORKLOAD_SPEC_INIT_VALUE
8387
- }
8595
+ };
8596
+ return [...columns, actionColumn];
8388
8597
  }
8389
- }
8390
- };
8391
- const POD_INIT_VALUE = {
8392
- apiVersion: "v1",
8393
- kind: "Pod",
8394
- ...BASE_INIT_VALUE,
8395
- spec: {
8396
- containers: [BASE_CONTAINER_INIT_VALUE]
8397
- }
8398
- };
8399
- const TIMESTAMP_LABEL = "sks.user.kubesmart.smtx.io/timestamp";
8400
- function shortenedImage(image2) {
8401
- return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2\u2026");
8402
- }
8403
- class ResourceModel {
8404
- constructor(rawYaml) {
8405
- __publicField(this, "id");
8406
- __publicField(this, "apiVersion");
8407
- __publicField(this, "kind");
8408
- __publicField(this, "metadata");
8409
- this.rawYaml = rawYaml;
8410
- this.id = rawYaml.id;
8411
- this.apiVersion = rawYaml.apiVersion;
8412
- this.kind = rawYaml.kind;
8413
- this.metadata = rawYaml.metadata;
8414
- }
8415
- get name() {
8416
- var _a;
8417
- return (_a = this.rawYaml.metadata) == null ? void 0 : _a.name;
8418
- }
8419
- get namespace() {
8420
- var _a;
8421
- return (_a = this.rawYaml.metadata) == null ? void 0 : _a.namespace;
8422
- }
8423
- get labels() {
8424
- var _a;
8425
- return (_a = this.rawYaml.metadata) == null ? void 0 : _a.labels;
8426
- }
8427
- get annotations() {
8428
- var _a;
8429
- return (_a = this.rawYaml.metadata) == null ? void 0 : _a.annotations;
8430
- }
8431
- }
8432
- class WorkloadModel extends ResourceModel {
8433
- constructor(rawYaml) {
8434
- super(rawYaml);
8435
- this.rawYaml = rawYaml;
8436
- }
8437
- get status() {
8438
- return this.rawYaml.status;
8439
- }
8440
- get spec() {
8441
- return this.rawYaml.spec;
8442
- }
8443
- get imageNames() {
8444
- var _a, _b, _c, _d;
8445
- const containers = this.rawYaml.spec && "jobTemplate" in this.rawYaml.spec ? (_b = (_a = this.rawYaml.spec.jobTemplate.spec) == null ? void 0 : _a.template.spec) == null ? void 0 : _b.containers : this.rawYaml.spec && "template" in this.rawYaml.spec ? (_d = (_c = this.rawYaml.spec) == null ? void 0 : _c.template.spec) == null ? void 0 : _d.containers : [];
8446
- return (containers == null ? void 0 : containers.map((container2) => shortenedImage(container2.image || ""))) || [];
8447
- }
8448
- get restartCount() {
8449
- return 0;
8450
- }
8451
- redeploy() {
8452
- const newOne = lodashEs.cloneDeep(this.rawYaml);
8453
- const path = "spec.template.metadata.annotations";
8454
- const annotations = lodashEs.get(newOne, path, {});
8455
- lodashEs.set(newOne, path, {
8456
- ...annotations,
8457
- [TIMESTAMP_LABEL]: new Date().toISOString().replace(/\.\d+Z$/, "Z")
8598
+ return columns;
8599
+ }, [columns, RowMenu]);
8600
+ if (loading) {
8601
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.loading, {});
8602
+ } else if (error) {
8603
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(WidgetErrorContent$1, {
8604
+ errorText: t("dovetail.retry_when_access_data_failed"),
8605
+ refetch,
8606
+ style: {
8607
+ padding: "15px 0"
8608
+ }
8609
+ });
8610
+ } else if (dataSource.length === 0) {
8611
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(WidgetErrorContent$1, {
8612
+ errorText: t("dovetail.empty"),
8613
+ style: {
8614
+ padding: "15px 0"
8615
+ }
8458
8616
  });
8459
- return newOne;
8460
8617
  }
8461
- scale(value) {
8462
- const newOne = lodashEs.cloneDeep(this.rawYaml);
8463
- if (newOne.kind === "Deployment" || newOne.kind === "StatefulSet") {
8464
- lodashEs.set(newOne, "spec.replicas", value);
8618
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
8619
+ ref: wrapperRef,
8620
+ className: cx_default(TableContainerStyle, props.className, "table-wrapper"),
8621
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx(kit.table, {
8622
+ tableLayout: "fixed",
8623
+ rowSelection: onSelect ? {
8624
+ onChange: (keys, rows) => {
8625
+ onSelect == null ? void 0 : onSelect(keys, rows);
8626
+ }
8627
+ } : void 0,
8628
+ columns: finalColumns,
8629
+ dataSource,
8630
+ pagination,
8631
+ error,
8632
+ loading,
8633
+ rowKey,
8634
+ wrapper: wrapperRef,
8635
+ scroll
8636
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(AuxiliaryLine, {
8637
+ ref: auxiliaryLineRef
8638
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.pagination, {
8639
+ current: currentPage,
8640
+ size: currentSize,
8641
+ count: dataSource.length,
8642
+ onChange: onPageChange,
8643
+ onSizeChange
8644
+ })]
8645
+ });
8646
+ }
8647
+ function CreateButton() {
8648
+ const { resource } = core.useResource();
8649
+ const navigation = core.useNavigation();
8650
+ const go = core.useGo();
8651
+ const kit = eagle.useUIKit();
8652
+ const { t } = useTranslation();
8653
+ const onClick = React.useCallback(() => {
8654
+ if (resource == null ? void 0 : resource.name) {
8655
+ go({
8656
+ to: navigation.createUrl(resource.name),
8657
+ options: {
8658
+ keepQuery: true
8659
+ }
8660
+ });
8465
8661
  }
8466
- return newOne;
8467
- }
8662
+ }, [resource == null ? void 0 : resource.name]);
8663
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", onClick, children: t("dovetail.create") });
8468
8664
  }
8469
- class JobModel extends WorkloadModel {
8470
- constructor(rawYaml) {
8471
- super(rawYaml);
8472
- this.rawYaml = rawYaml;
8473
- }
8474
- get duration() {
8475
- var _a, _b;
8476
- const completionTime = (_a = this.rawYaml.status) == null ? void 0 : _a.completionTime;
8477
- const startTime = (_b = this.rawYaml.status) == null ? void 0 : _b.startTime;
8478
- if (!completionTime && startTime) {
8479
- return getSecondsDiff(startTime, Date.now().toString());
8665
+ const useDeleteManyModal = (resource, ids) => {
8666
+ const { mutate } = core.useDeleteMany();
8667
+ const [visible, setVisible] = React.useState(false);
8668
+ const { t } = useTranslation();
8669
+ const modalProps = {
8670
+ title: t("dovetail.delete"),
8671
+ okText: t("dovetail.delete"),
8672
+ okButtonProps: {
8673
+ danger: true
8674
+ },
8675
+ cancelText: t("dovetail.cancel"),
8676
+ children: t("dovetail.confirm_delete_text", {
8677
+ target: ids,
8678
+ interpolation: { escapeValue: false }
8679
+ }),
8680
+ onOk() {
8681
+ mutate({
8682
+ resource,
8683
+ ids
8684
+ });
8685
+ setVisible(false);
8686
+ },
8687
+ onCancel() {
8688
+ setVisible(false);
8480
8689
  }
8481
- if (completionTime && startTime) {
8482
- return getSecondsDiff(startTime, completionTime);
8690
+ };
8691
+ return { modalProps, visible, setVisible };
8692
+ };
8693
+ const DeleteManyButton = (props) => {
8694
+ const { resource } = core.useResource();
8695
+ const kit = eagle.useUIKit();
8696
+ const { t } = useTranslation();
8697
+ const { modalProps, visible, setVisible } = useDeleteManyModal(
8698
+ (resource == null ? void 0 : resource.name) || "",
8699
+ props.ids
8700
+ );
8701
+ const onClick = React.useCallback(() => {
8702
+ setVisible(true);
8703
+ }, [setVisible]);
8704
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
8705
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", danger: true, onClick, children: t("dovetail.delete") }),
8706
+ visible ? /* @__PURE__ */ jsxRuntime.exports.jsx(kit.modal, { ...modalProps }) : null
8707
+ ] });
8708
+ };
8709
+ const TableToolBar_1a3t35p = "";
8710
+ const ToolbarStyle$1 = "t1v3ienx";
8711
+ const TableToolBar = ({
8712
+ title,
8713
+ selectedKeys,
8714
+ hideCreate
8715
+ }) => {
8716
+ const kit = eagle.useUIKit();
8717
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, {
8718
+ className: cx_default(ToolbarStyle$1, "table-toolbar"),
8719
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx("span", {
8720
+ className: eagle.Typo.Display.d2_bold_title,
8721
+ children: title
8722
+ }), /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, {
8723
+ children: [selectedKeys.length > 0 ? /* @__PURE__ */ jsxRuntime.exports.jsx(DeleteManyButton, {
8724
+ ids: selectedKeys
8725
+ }) : void 0, !hideCreate ? /* @__PURE__ */ jsxRuntime.exports.jsx(CreateButton, {}) : null]
8726
+ })]
8727
+ });
8728
+ };
8729
+ const index_1hr2h38 = "";
8730
+ function matchOwner(job, owner) {
8731
+ var _a;
8732
+ let match = false;
8733
+ for (const o of ((_a = job.metadata) == null ? void 0 : _a.ownerReferences) || []) {
8734
+ if (o.apiVersion === owner.apiVersion && o.kind === owner.kind && o.name === owner.name && job.namespace === owner.namespace) {
8735
+ match = true;
8483
8736
  }
8484
- return 0;
8485
- }
8486
- get durationDisplay() {
8487
- return elapsedTime(this.duration).label;
8488
- }
8489
- get completionsDisplay() {
8490
- var _a, _b;
8491
- return `${((_a = this.rawYaml.status) == null ? void 0 : _a.succeeded) || 0}/${(_b = this.rawYaml.spec) == null ? void 0 : _b.completions}`;
8492
8737
  }
8738
+ return match;
8493
8739
  }
8494
- const UNITS = ["", "K", "M", "G", "T", "P"];
8495
- const FRACTIONAL = ["", "m", "u", "n", "p", "f"];
8496
- function formatSi(inValue, options) {
8740
+ const CronjobJobsTable = ({
8741
+ owner
8742
+ }) => {
8743
+ const kit = eagle.useUIKit();
8744
+ const [selectedKeys, setSelectedKeys] = React.useState([]);
8745
+ const [currentPage, setCurrentPage] = React.useState(1);
8497
8746
  const {
8498
- increment = 1e3,
8499
- suffix = null,
8500
- firstSuffix = null,
8501
- startingExponent = 0,
8502
- minExponent = 0,
8503
- maxPrecision = 2,
8504
- atLeastOne = true
8505
- } = options || {};
8506
- let val = inValue;
8507
- let exp = startingExponent;
8508
- while (val >= increment && exp + 1 < UNITS.length || exp < minExponent) {
8509
- val = val / increment;
8510
- exp++;
8511
- }
8512
- let out = 0;
8513
- if (val < 10 && maxPrecision >= 2) {
8514
- out = Math.round(val * 100) / 100;
8515
- } else if (val < 100 && maxPrecision >= 1) {
8516
- out = Math.round(val * 10) / 10;
8517
- } else {
8518
- out = Math.round(val);
8519
- }
8520
- if (atLeastOne && out === 0) {
8521
- out = 1;
8522
- }
8523
- let outStr = String(out);
8524
- if (exp === 0 && firstSuffix !== null) {
8525
- outStr += `${firstSuffix}`;
8526
- } else {
8527
- outStr += `${UNITS[exp]}${suffix}` || "";
8528
- }
8529
- return outStr;
8530
- }
8531
- function parseSi(inValue, increment = null, allowFractional = true) {
8532
- if (!inValue || typeof inValue !== "string" || !inValue.length) {
8533
- return NaN;
8534
- }
8535
- inValue = inValue.replace(/,/g, "");
8536
- let [, valStr, unit, incStr] = inValue.match(/^([0-9.-]+)\s*([^0-9.-]?)([^0-9.-]?)/) || [];
8537
- const val = parseFloat(valStr);
8538
- if (!unit) {
8539
- return val;
8540
- }
8541
- if (unit.charCodeAt(0) === 181) {
8542
- unit = "u";
8543
- }
8544
- const divide = FRACTIONAL.includes(unit);
8545
- const multiply = UNITS.includes(unit.toUpperCase());
8546
- if (increment === null) {
8547
- if ((multiply || divide) && incStr === "i") {
8548
- increment = 1024;
8549
- } else {
8550
- increment = 1e3;
8747
+ data: data2
8748
+ } = core.useList({
8749
+ resource: "jobs",
8750
+ meta: {
8751
+ resourceBasePath: "/apis/batch/v1",
8752
+ kind: "Job"
8551
8753
  }
8754
+ });
8755
+ const dataSource = React.useMemo(() => {
8756
+ return data2 == null ? void 0 : data2.data.filter((p) => {
8757
+ return owner ? matchOwner(p, owner) : true;
8758
+ });
8759
+ }, [data2 == null ? void 0 : data2.data, owner]);
8760
+ const columns = [PhaseColumnRenderer(), NameColumnRenderer("jobs"), NameSpaceColumnRenderer(), WorkloadImageColumnRenderer(), CompletionsCountColumnRenderer(), DurationColumnRenderer(), AgeColumnRenderer()];
8761
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, {
8762
+ direction: "vertical",
8763
+ className: "c16agr8o",
8764
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx(TableToolBar, {
8765
+ title: "Jobs",
8766
+ selectedKeys,
8767
+ hideCreate: true
8768
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(Table, {
8769
+ tableKey: "cronjobs",
8770
+ loading: !dataSource,
8771
+ data: dataSource || [],
8772
+ columns,
8773
+ onSelect: (keys) => setSelectedKeys(keys),
8774
+ rowKey: "id",
8775
+ error: false,
8776
+ currentPage,
8777
+ onPageChange: (p) => setCurrentPage(p),
8778
+ currentSize: 10,
8779
+ refetch: () => null
8780
+ })]
8781
+ });
8782
+ };
8783
+ const KeyValue = ({ value }) => {
8784
+ const kit = eagle.useUIKit();
8785
+ if (!value || Object.keys.length === 0) {
8786
+ return /* @__PURE__ */ jsxRuntime.exports.jsx("div", { children: "Empty" });
8552
8787
  }
8553
- if (divide && allowFractional) {
8554
- const exp = FRACTIONAL.indexOf(unit);
8555
- return val / Math.pow(increment, exp);
8556
- }
8557
- if (multiply) {
8558
- const exp = UNITS.indexOf(unit.toUpperCase());
8559
- return val * Math.pow(increment, exp);
8560
- }
8561
- return val;
8562
- }
8563
- class PodModel extends WorkloadModel {
8564
- constructor(rawYaml) {
8565
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
8566
- super(rawYaml);
8567
- __publicField(this, "request");
8568
- __publicField(this, "limit");
8569
- this.rawYaml = rawYaml;
8570
- let cpuRequestNum = 0;
8571
- let memoryRequestNum = 0;
8572
- let cpuLimitNum = 0;
8573
- let memoryLimitNum = 0;
8574
- for (const container2 of ((_a = rawYaml.spec) == null ? void 0 : _a.containers) || []) {
8575
- cpuRequestNum += parseSi(((_c = (_b = container2.resources) == null ? void 0 : _b.requests) == null ? void 0 : _c.cpu) || "0");
8576
- memoryRequestNum += parseSi(((_e = (_d = container2.resources) == null ? void 0 : _d.requests) == null ? void 0 : _e.memory) || "0");
8577
- cpuLimitNum += parseSi(((_g = (_f = container2.resources) == null ? void 0 : _f.limits) == null ? void 0 : _g.cpu) || "0");
8578
- memoryLimitNum += parseSi(((_i = (_h = container2.resources) == null ? void 0 : _h.limits) == null ? void 0 : _i.memory) || "0");
8579
- }
8580
- this.request = {
8581
- cpu: {
8582
- value: cpuRequestNum,
8583
- si: formatSi(cpuRequestNum, {
8584
- suffix: "m"
8585
- })
8586
- },
8587
- memory: {
8588
- value: memoryRequestNum,
8589
- si: formatSi(memoryRequestNum, {
8590
- suffix: "i"
8591
- })
8592
- }
8593
- };
8594
- this.limit = {
8595
- cpu: {
8596
- value: cpuLimitNum,
8597
- si: formatSi(cpuLimitNum, {
8598
- suffix: "m"
8599
- })
8600
- },
8601
- memory: {
8602
- value: memoryLimitNum,
8603
- si: formatSi(memoryLimitNum, {
8604
- suffix: "i"
8605
- })
8606
- }
8788
+ const data2 = Object.keys(value).map((key) => {
8789
+ return {
8790
+ id: key,
8791
+ key,
8792
+ value: value[key]
8607
8793
  };
8608
- }
8609
- get imageNames() {
8610
- var _a;
8611
- return ((_a = this.rawYaml.spec) == null ? void 0 : _a.containers.map(
8612
- (container2) => shortenedImage(container2.image || "")
8613
- )) || [];
8614
- }
8615
- get restartCount() {
8616
- var _a, _b;
8617
- if ((_a = this.rawYaml.status) == null ? void 0 : _a.containerStatuses) {
8618
- return ((_b = this.rawYaml.status) == null ? void 0 : _b.containerStatuses[0].restartCount) || 0;
8794
+ });
8795
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(
8796
+ kit.table,
8797
+ {
8798
+ loading: false,
8799
+ columns: [
8800
+ {
8801
+ key: "key",
8802
+ title: "Key",
8803
+ dataIndex: ["key"]
8804
+ },
8805
+ {
8806
+ key: "value",
8807
+ title: "Value",
8808
+ dataIndex: ["value"]
8809
+ }
8810
+ ],
8811
+ dataSource: data2
8619
8812
  }
8620
- return 0;
8621
- }
8622
- get readyDisplay() {
8623
- var _a, _b, _c;
8624
- return `${(_b = (_a = this.rawYaml.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.filter((c) => c.ready).length}/${(_c = this.rawYaml.spec) == null ? void 0 : _c.containers.length}`;
8625
- }
8626
- }
8627
- class PodMetricsModel extends ResourceModel {
8628
- constructor(data2) {
8629
- super(data2);
8630
- __publicField(this, "usage");
8631
- this.data = data2;
8632
- let cpuUsageNum = 0;
8633
- let memoryUsageNum = 0;
8634
- for (const container2 of data2.containers) {
8635
- cpuUsageNum += parseSi(container2.usage.cpu || "0");
8636
- memoryUsageNum += parseSi(container2.usage.memory || "0");
8813
+ );
8814
+ };
8815
+ function matchSelector$1(pod, selector) {
8816
+ var _a, _b, _c;
8817
+ let match = true;
8818
+ for (const key in selector.matchLabels) {
8819
+ if (!((_b = (_a = pod.metadata) == null ? void 0 : _a.labels) == null ? void 0 : _b[key]) || ((_c = pod.metadata.labels) == null ? void 0 : _c[key]) !== selector.matchLabels[key]) {
8820
+ match = false;
8637
8821
  }
8638
- this.usage = {
8639
- cpu: {
8640
- value: cpuUsageNum,
8641
- si: formatSi(1e3 * cpuUsageNum, {
8642
- suffix: "m",
8643
- maxPrecision: 0
8644
- })
8645
- },
8646
- memory: {
8647
- value: memoryUsageNum,
8648
- si: formatSi(memoryUsageNum, {
8649
- suffix: "i",
8650
- maxPrecision: 0
8651
- })
8652
- }
8653
- };
8654
8822
  }
8823
+ return match;
8655
8824
  }
8656
- class CronJobModel extends WorkloadModel {
8657
- constructor(data2) {
8658
- super(data2);
8659
- this.data = data2;
8660
- }
8661
- suspend() {
8662
- const newOne = lodashEs.cloneDeep(this.data);
8663
- if (this.data.kind === "CronJob") {
8664
- lodashEs.set(newOne, "spec.suspend", true);
8825
+ const WorkloadPodsTable_z2tsj7 = "";
8826
+ const WorkloadPodsTable = ({
8827
+ selector
8828
+ }) => {
8829
+ const kit = eagle.useUIKit();
8830
+ const [selectedKeys, setSelectedKeys] = React.useState([]);
8831
+ const [currentPage, setCurrentPage] = React.useState(1);
8832
+ const {
8833
+ data: data2
8834
+ } = core.useList({
8835
+ resource: "pods",
8836
+ meta: {
8837
+ resourceBasePath: "/api/v1",
8838
+ kind: "Pod"
8665
8839
  }
8666
- return newOne;
8667
- }
8668
- resume() {
8669
- const newOne = lodashEs.cloneDeep(this.data);
8670
- if (this.data.kind === "CronJob") {
8671
- lodashEs.set(newOne, "spec.suspend", false);
8840
+ });
8841
+ const dataSource = React.useMemo(() => {
8842
+ return data2 == null ? void 0 : data2.data.filter((p) => {
8843
+ return selector ? matchSelector$1(p, selector) : true;
8844
+ });
8845
+ }, [data2 == null ? void 0 : data2.data, selector]);
8846
+ const columns = [PhaseColumnRenderer(), NameColumnRenderer("pods"), NodeNameColumnRenderer(), WorkloadImageColumnRenderer(), RestartCountColumnRenderer()];
8847
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, {
8848
+ direction: "vertical",
8849
+ className: "c1dicff8",
8850
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx(TableToolBar, {
8851
+ title: "",
8852
+ selectedKeys,
8853
+ hideCreate: true
8854
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(Table, {
8855
+ tableKey: "pods",
8856
+ loading: !dataSource,
8857
+ data: dataSource || [],
8858
+ columns,
8859
+ onSelect: (keys) => setSelectedKeys(keys),
8860
+ rowKey: "id",
8861
+ error: false,
8862
+ currentPage,
8863
+ onPageChange: (p) => setCurrentPage(p),
8864
+ currentSize: 10,
8865
+ refetch: () => null
8866
+ })]
8867
+ });
8868
+ };
8869
+ const ImageField = () => {
8870
+ return {
8871
+ key: "Image",
8872
+ title: i18n__default.default.t("dovetail.image"),
8873
+ path: ["imageNames"],
8874
+ render(value) {
8875
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(ImageNames, { value });
8672
8876
  }
8673
- return newOne;
8674
- }
8675
- }
8676
- function memoize(fn) {
8677
- var cache = /* @__PURE__ */ Object.create(null);
8678
- return function(arg) {
8679
- if (cache[arg] === void 0)
8680
- cache[arg] = fn(arg);
8681
- return cache[arg];
8682
8877
  };
8683
- }
8684
- var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
8685
- var isPropValid = /* @__PURE__ */ memoize(
8686
- function(prop) {
8687
- return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
8688
- }
8689
- );
8690
- var isCapital = (ch) => ch.toUpperCase() === ch;
8691
- var filterKey = (keys) => (key) => keys.indexOf(key) === -1;
8692
- var omit = (obj, keys) => {
8693
- const res = {};
8694
- Object.keys(obj).filter(filterKey(keys)).forEach((key) => {
8695
- res[key] = obj[key];
8696
- });
8697
- return res;
8698
8878
  };
8699
- function filterProps(asIs, props, omitKeys) {
8700
- const filteredProps = omit(props, omitKeys);
8701
- if (!asIs) {
8702
- const interopValidAttr = typeof isPropValid === "function" ? { default: isPropValid } : isPropValid;
8703
- Object.keys(filteredProps).forEach((key) => {
8704
- if (!interopValidAttr.default(key)) {
8705
- delete filteredProps[key];
8706
- }
8707
- });
8708
- }
8709
- return filteredProps;
8710
- }
8711
- var warnIfInvalid = (value, componentName) => {
8712
- if (process.env.NODE_ENV !== "production") {
8713
- if (typeof value === "string" || typeof value === "number" && isFinite(value)) {
8714
- return;
8879
+ const ReplicaField = () => {
8880
+ return {
8881
+ key: "Replicas",
8882
+ title: i18n__default.default.t("dovetail.replicas"),
8883
+ path: ["status", "replicas"],
8884
+ render: (_, record) => {
8885
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(WorkloadReplicas, { record });
8715
8886
  }
8716
- const stringified = typeof value === "object" ? JSON.stringify(value) : String(value);
8717
- console.warn(
8718
- `An interpolation evaluated to '${stringified}' in the component '${componentName}', which is probably a mistake. You should explicitly cast or transform the value to a string.`
8719
- );
8720
- }
8887
+ };
8721
8888
  };
8722
- var idx = 0;
8723
- function styled(tag) {
8724
- var _a;
8725
- let mockedClass = "";
8726
- if (process.env.NODE_ENV === "test") {
8727
- mockedClass += `mocked-styled-${idx++}`;
8728
- if ((_a = tag == null ? void 0 : tag.__linaria) == null ? void 0 : _a.className) {
8729
- mockedClass += ` ${tag.__linaria.className}`;
8889
+ const ConditionsField = () => {
8890
+ return {
8891
+ key: "Conditions",
8892
+ title: i18n__default.default.t("dovetail.condition"),
8893
+ path: ["status", "conditions"],
8894
+ render: (value) => {
8895
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(ConditionsTable, { conditions: value });
8730
8896
  }
8731
- }
8732
- return (options) => {
8733
- if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test") {
8734
- if (Array.isArray(options)) {
8735
- throw new Error(
8736
- 'Using the "styled" tag in runtime is not supported. Make sure you have set up the Babel plugin correctly. See https://github.com/callstack/linaria#setup'
8737
- );
8738
- }
8739
- }
8740
- const render = (props, ref) => {
8741
- const { as: component = tag, class: className = mockedClass } = props;
8742
- const shouldKeepProps = options.propsAsIs === void 0 ? !(typeof component === "string" && component.indexOf("-") === -1 && !isCapital(component[0])) : options.propsAsIs;
8743
- const filteredProps = filterProps(shouldKeepProps, props, [
8744
- "as",
8745
- "class"
8746
- ]);
8747
- filteredProps.ref = ref;
8748
- filteredProps.className = options.atomic ? cx_default(options.class, filteredProps.className || className) : cx_default(filteredProps.className || className, options.class);
8749
- const { vars } = options;
8750
- if (vars) {
8751
- const style2 = {};
8752
- for (const name2 in vars) {
8753
- const variable = vars[name2];
8754
- const result = variable[0];
8755
- const unit = variable[1] || "";
8756
- const value = typeof result === "function" ? result(props) : result;
8757
- warnIfInvalid(value, options.name);
8758
- style2[`--${name2}`] = `${value}${unit}`;
8897
+ };
8898
+ };
8899
+ const PodsField = () => {
8900
+ return {
8901
+ key: "pods",
8902
+ title: "Pods",
8903
+ path: [],
8904
+ render: (_, record) => {
8905
+ var _a, _b;
8906
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(
8907
+ WorkloadPodsTable,
8908
+ {
8909
+ selector: (_b = (_a = record.metadata.relations) == null ? void 0 : _a.find((r) => {
8910
+ return r.kind === "Pod" && r.type === "creates";
8911
+ })) == null ? void 0 : _b.selector
8759
8912
  }
8760
- const ownStyle = filteredProps.style || {};
8761
- const keys = Object.keys(ownStyle);
8762
- if (keys.length > 0) {
8763
- keys.forEach((key) => {
8764
- style2[key] = ownStyle[key];
8765
- });
8913
+ );
8914
+ }
8915
+ };
8916
+ };
8917
+ const JobsField = () => {
8918
+ return {
8919
+ key: "jobs",
8920
+ title: "Jobs",
8921
+ path: [],
8922
+ render: (_, record) => {
8923
+ var _a, _b, _c;
8924
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(
8925
+ CronjobJobsTable,
8926
+ {
8927
+ owner: {
8928
+ apiVersion: record.apiVersion || "",
8929
+ kind: record.kind || "",
8930
+ name: ((_a = record.metadata) == null ? void 0 : _a.name) || "",
8931
+ namespace: ((_b = record.metadata) == null ? void 0 : _b.namespace) || "",
8932
+ uid: ((_c = record.metadata) == null ? void 0 : _c.uid) || ""
8933
+ }
8766
8934
  }
8767
- filteredProps.style = style2;
8768
- }
8769
- if (tag.__linaria && tag !== component) {
8770
- filteredProps.as = component;
8771
- return React__default.default.createElement(tag, filteredProps);
8772
- }
8773
- return React__default.default.createElement(component, filteredProps);
8774
- };
8775
- const Result = React__default.default.forwardRef ? React__default.default.forwardRef(render) : (props) => {
8776
- const rest = omit(props, ["innerRef"]);
8777
- return render(rest, props.innerRef);
8778
- };
8779
- Result.displayName = options.name;
8780
- Result.__linaria = {
8781
- className: options.class || mockedClass,
8782
- extends: tag
8783
- };
8784
- return Result;
8935
+ );
8936
+ }
8785
8937
  };
8786
- }
8787
- var styled_default = process.env.NODE_ENV !== "production" ? new Proxy(styled, {
8788
- get(o, prop) {
8789
- return o(prop);
8790
- }
8791
- }) : styled;
8792
- const TableWidgets_ny30pi = "";
8793
- const AuxiliaryLine = /* @__PURE__ */ styled_default("div")({
8794
- name: "AuxiliaryLine",
8795
- class: "ax1qopv",
8796
- propsAsIs: false
8797
- });
8798
- const index_dmbxj3 = "";
8799
- const TableContainerStyle = "t1upn1sz";
8800
- function Table(props) {
8801
- const kit = eagle.useUIKit();
8802
- const {
8803
- t
8804
- } = useTranslation();
8805
- const {
8806
- loading,
8807
- error,
8808
- dataSource,
8809
- rowKey,
8810
- columns,
8811
- scroll,
8812
- currentPage,
8813
- currentSize,
8814
- refetch,
8815
- onSelect,
8816
- onPageChange,
8817
- onSizeChange
8818
- } = props;
8819
- const auxiliaryLineRef = React.useRef(null);
8820
- const wrapperRef = React.useRef(null);
8821
- const pagination = React.useMemo(() => ({
8822
- current: currentPage,
8823
- pageSize: currentSize,
8824
- onChange: onPageChange
8825
- }), [currentPage, currentSize, onPageChange]);
8826
- if (loading) {
8827
- return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.loading, {});
8828
- } else if (error) {
8829
- return /* @__PURE__ */ jsxRuntime.exports.jsx(WidgetErrorContent, {
8830
- errorText: t("dovetail.retry_when_access_data_failed"),
8831
- refetch,
8832
- style: {
8833
- padding: "15px 0"
8834
- }
8835
- });
8836
- } else if (dataSource.length === 0) {
8837
- return /* @__PURE__ */ jsxRuntime.exports.jsx(WidgetErrorContent, {
8838
- errorText: t("dovetail.empty"),
8839
- style: {
8840
- padding: "15px 0"
8938
+ };
8939
+ const DataField = () => {
8940
+ return {
8941
+ key: "data",
8942
+ title: i18n__default.default.t("dovetail.data"),
8943
+ path: ["data"],
8944
+ render: (val) => {
8945
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValue, { value: val });
8946
+ }
8947
+ };
8948
+ };
8949
+ const SecretDataField = () => {
8950
+ return {
8951
+ key: "data",
8952
+ title: i18n__default.default.t("dovetail.data"),
8953
+ path: ["data"],
8954
+ render: (val) => {
8955
+ const decodeVal = {};
8956
+ for (const key in val) {
8957
+ decodeVal[key] = atob(val[key]);
8841
8958
  }
8842
- });
8843
- }
8844
- return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
8845
- ref: wrapperRef,
8846
- className: cx_default(TableContainerStyle, props.className, "table-wrapper"),
8847
- children: [/* @__PURE__ */ jsxRuntime.exports.jsx(kit.table, {
8848
- tableLayout: "fixed",
8849
- rowSelection: onSelect ? {
8850
- onChange: (keys, rows) => {
8851
- onSelect == null ? void 0 : onSelect(keys, rows);
8852
- }
8853
- } : void 0,
8854
- columns,
8855
- dataSource,
8856
- pagination,
8857
- error,
8858
- loading,
8859
- rowKey,
8860
- wrapper: wrapperRef,
8861
- scroll
8862
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(AuxiliaryLine, {
8863
- ref: auxiliaryLineRef
8864
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.pagination, {
8865
- current: currentPage,
8866
- size: currentSize,
8867
- count: dataSource.length,
8868
- onChange: onPageChange,
8869
- onSizeChange
8870
- })]
8871
- });
8872
- }
8873
- function CreateButton() {
8874
- const { resource } = core.useResource();
8875
- const navigation = core.useNavigation();
8876
- const go = core.useGo();
8877
- const kit = eagle.useUIKit();
8878
- const { t } = useTranslation();
8879
- const onClick = React.useCallback(() => {
8880
- if (resource == null ? void 0 : resource.name) {
8881
- go({
8882
- to: navigation.createUrl(resource.name),
8883
- options: {
8884
- keepQuery: true
8885
- }
8886
- });
8959
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValue, { value: decodeVal });
8887
8960
  }
8888
- }, [resource == null ? void 0 : resource.name]);
8889
- return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", onClick, children: t("create") });
8890
- }
8891
- const useDeleteManyModal = (resource, ids) => {
8892
- const { mutate } = core.useDeleteMany();
8893
- const [visible, setVisible] = React.useState(false);
8894
- const { t } = useTranslation();
8895
- const modalProps = {
8896
- title: t("delete"),
8897
- okText: t("delete"),
8898
- okButtonProps: {
8899
- danger: true
8900
- },
8901
- cancelText: t("cancel"),
8902
- children: t("confirm_delete_text", {
8903
- target: ids,
8904
- interpolation: { escapeValue: false }
8905
- }),
8906
- onOk() {
8907
- mutate({
8908
- resource,
8909
- ids
8910
- });
8911
- setVisible(false);
8912
- },
8913
- onCancel() {
8914
- setVisible(false);
8961
+ };
8962
+ };
8963
+ const StartTimeField = () => {
8964
+ return {
8965
+ key: "started",
8966
+ title: i18n__default.default.t("dovetail.started"),
8967
+ path: ["status", "startTime"],
8968
+ render(value) {
8969
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(Time, { date: value });
8915
8970
  }
8916
8971
  };
8917
- return { modalProps, visible, setVisible };
8918
8972
  };
8919
- const DeleteManyButton = (props) => {
8920
- const { resource } = core.useResource();
8921
- const kit = eagle.useUIKit();
8922
- const { t } = useTranslation();
8923
- const { modalProps, visible, setVisible } = useDeleteManyModal(
8924
- (resource == null ? void 0 : resource.name) || "",
8925
- props.ids
8926
- );
8927
- const onClick = React.useCallback(() => {
8928
- setVisible(true);
8929
- }, [setVisible]);
8930
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
8931
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", danger: true, onClick, children: t("delete") }),
8932
- visible ? /* @__PURE__ */ jsxRuntime.exports.jsx(kit.modal, { ...modalProps }) : null
8933
- ] });
8973
+ const ServiceTypeField = () => {
8974
+ return {
8975
+ key: "type",
8976
+ title: i18n__default.default.t("dovetail.type"),
8977
+ path: ["spec", "type"]
8978
+ };
8934
8979
  };
8935
- const TableToolBar_1a3t35p = "";
8936
- const ToolbarStyle$1 = "t1v3ienx";
8937
- const TableToolBar = ({
8938
- title,
8939
- selectedKeys,
8940
- hideCreate
8941
- }) => {
8942
- const kit = eagle.useUIKit();
8943
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, {
8944
- className: cx_default(ToolbarStyle$1, "table-toolbar"),
8945
- children: [/* @__PURE__ */ jsxRuntime.exports.jsx("span", {
8946
- className: eagle.Typo.Display.d2_bold_title,
8947
- children: title
8948
- }), /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, {
8949
- children: [selectedKeys.length > 0 ? /* @__PURE__ */ jsxRuntime.exports.jsx(DeleteManyButton, {
8950
- ids: selectedKeys
8951
- }) : void 0, !hideCreate ? /* @__PURE__ */ jsxRuntime.exports.jsx(CreateButton, {}) : null]
8952
- })]
8953
- });
8954
- };
8955
- const index_1hr2h38 = "";
8956
- function matchOwner(job, owner) {
8957
- var _a;
8958
- let match = false;
8959
- for (const o of ((_a = job.metadata) == null ? void 0 : _a.ownerReferences) || []) {
8960
- if (o.apiVersion === owner.apiVersion && o.kind === owner.kind && o.name === owner.name && job.namespace === owner.namespace) {
8961
- match = true;
8962
- }
8963
- }
8964
- return match;
8965
- }
8966
- const CronjobJobsTable = ({
8967
- owner
8968
- }) => {
8969
- const kit = eagle.useUIKit();
8970
- const {
8971
- i18n: i18n2
8972
- } = useTranslation();
8973
- const [selectedKeys, setSelectedKeys] = React.useState([]);
8974
- const [currentPage, setCurrentPage] = React.useState(1);
8975
- const {
8976
- data: data2
8977
- } = core.useList({
8978
- resource: "jobs",
8979
- meta: {
8980
- resourceBasePath: "/apis/batch/v1",
8981
- kind: "Job"
8982
- }
8983
- });
8984
- const dataSource = React.useMemo(() => {
8985
- return data2 == null ? void 0 : data2.data.map((p) => new JobModel(p)).filter((p) => {
8986
- return owner ? matchOwner(p, owner) : true;
8987
- });
8988
- }, [data2 == null ? void 0 : data2.data, owner]);
8989
- const columns = [PhaseColumnRenderer(i18n2), NameColumnRenderer(i18n2, "jobs"), NameSpaceColumnRenderer(i18n2), WorkloadImageColumnRenderer(i18n2), CompletionsCountColumnRenderer(i18n2), DurationColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
8990
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, {
8991
- direction: "vertical",
8992
- className: "c16agr8o",
8993
- children: [/* @__PURE__ */ jsxRuntime.exports.jsx(TableToolBar, {
8994
- title: "Jobs",
8995
- selectedKeys,
8996
- hideCreate: true
8997
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(Table, {
8998
- loading: !dataSource,
8999
- dataSource: dataSource || [],
9000
- columns,
9001
- onSelect: (keys) => setSelectedKeys(keys),
9002
- rowKey: "id",
9003
- error: false,
9004
- currentPage,
9005
- onPageChange: (p) => setCurrentPage(p),
9006
- currentSize: 10,
9007
- refetch: () => null
9008
- })]
9009
- });
9010
- };
9011
- const KeyValue = ({ value }) => {
9012
- const kit = eagle.useUIKit();
9013
- if (!value || Object.keys.length === 0) {
9014
- return /* @__PURE__ */ jsxRuntime.exports.jsx("div", { children: "Empty" });
9015
- }
9016
- const data2 = Object.keys(value).map((key) => {
9017
- return {
9018
- id: key,
9019
- key,
9020
- value: value[key]
9021
- };
9022
- });
9023
- return /* @__PURE__ */ jsxRuntime.exports.jsx(
9024
- kit.table,
9025
- {
9026
- loading: false,
9027
- columns: [
9028
- {
9029
- key: "key",
9030
- title: "Key",
9031
- dataIndex: ["key"]
9032
- },
9033
- {
9034
- key: "value",
9035
- title: "Value",
9036
- dataIndex: ["value"]
9037
- }
9038
- ],
9039
- dataSource: data2
9040
- }
9041
- );
9042
- };
9043
- function matchSelector(pod, selector) {
9044
- var _a, _b, _c;
9045
- let match = true;
9046
- for (const key in selector.matchLabels) {
9047
- if (!((_b = (_a = pod.metadata) == null ? void 0 : _a.labels) == null ? void 0 : _b[key]) || ((_c = pod.metadata.labels) == null ? void 0 : _c[key]) !== selector.matchLabels[key]) {
9048
- match = false;
9049
- }
9050
- }
9051
- return match;
9052
- }
9053
- const WorkloadPodsTable_z2tsj7 = "";
9054
- const WorkloadPodsTable = ({
9055
- selector
9056
- }) => {
9057
- const kit = eagle.useUIKit();
9058
- const {
9059
- i18n: i18n2
9060
- } = useTranslation();
9061
- const [selectedKeys, setSelectedKeys] = React.useState([]);
9062
- const [currentPage, setCurrentPage] = React.useState(1);
9063
- const {
9064
- data: data2
9065
- } = core.useList({
9066
- resource: "pods",
9067
- meta: {
9068
- resourceBasePath: "/api/v1",
9069
- kind: "Pod"
9070
- }
9071
- });
9072
- const dataSource = React.useMemo(() => {
9073
- return data2 == null ? void 0 : data2.data.map((p) => new PodModel(p)).filter((p) => {
9074
- return selector ? matchSelector(p, selector) : true;
9075
- });
9076
- }, [data2 == null ? void 0 : data2.data, selector]);
9077
- const columns = [PhaseColumnRenderer(i18n2), NameColumnRenderer(i18n2, "pods"), NodeNameColumnRenderer(i18n2), WorkloadImageColumnRenderer(i18n2), RestartCountColumnRenderer(i18n2)];
9078
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, {
9079
- direction: "vertical",
9080
- className: "c1dicff8",
9081
- children: [/* @__PURE__ */ jsxRuntime.exports.jsx(TableToolBar, {
9082
- title: "",
9083
- selectedKeys,
9084
- hideCreate: true
9085
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(Table, {
9086
- loading: !dataSource,
9087
- dataSource: dataSource || [],
9088
- columns,
9089
- onSelect: (keys) => setSelectedKeys(keys),
9090
- rowKey: "id",
9091
- error: false,
9092
- currentPage,
9093
- onPageChange: (p) => setCurrentPage(p),
9094
- currentSize: 10,
9095
- refetch: () => null
9096
- })]
9097
- });
9098
- };
9099
- const ImageField = (i18n2) => {
9100
- return {
9101
- key: "Image",
9102
- title: i18n2.t("image"),
9103
- path: ["imageNames"],
9104
- render(value) {
9105
- return /* @__PURE__ */ jsxRuntime.exports.jsx(ImageNames, { value });
9106
- }
9107
- };
9108
- };
9109
- const ReplicaField = (i18n2) => {
9110
- return {
9111
- key: "Replicas",
9112
- title: i18n2.t("replicas"),
9113
- path: ["status", "replicas"],
9114
- render: (_, record) => {
9115
- return /* @__PURE__ */ jsxRuntime.exports.jsx(WorkloadReplicas, { record });
9116
- }
9117
- };
9118
- };
9119
- const ConditionsField = (i18n2) => {
9120
- return {
9121
- key: "Conditions",
9122
- title: i18n2.t("condition"),
9123
- path: ["status", "conditions"],
9124
- render: (value) => {
9125
- return /* @__PURE__ */ jsxRuntime.exports.jsx(ConditionsTable, { conditions: value });
9126
- }
9127
- };
9128
- };
9129
- const PodsField = (_) => {
9130
- return {
9131
- key: "pods",
9132
- title: "Pods",
9133
- path: [],
9134
- render: (_2, record) => {
9135
- var _a, _b;
9136
- return /* @__PURE__ */ jsxRuntime.exports.jsx(
9137
- WorkloadPodsTable,
9138
- {
9139
- selector: (_b = (_a = record.metadata.relations) == null ? void 0 : _a.find((r) => {
9140
- return r.kind === "Pod" && r.type === "creates";
9141
- })) == null ? void 0 : _b.selector
9142
- }
9143
- );
9144
- }
9145
- };
9146
- };
9147
- const JobsField = (_) => {
9148
- return {
9149
- key: "jobs",
9150
- title: "Jobs",
9151
- path: [],
9152
- render: (_2, record) => {
9153
- var _a, _b, _c;
9154
- return /* @__PURE__ */ jsxRuntime.exports.jsx(
9155
- CronjobJobsTable,
9156
- {
9157
- owner: {
9158
- apiVersion: record.apiVersion || "",
9159
- kind: record.kind || "",
9160
- name: ((_a = record.metadata) == null ? void 0 : _a.name) || "",
9161
- namespace: ((_b = record.metadata) == null ? void 0 : _b.namespace) || "",
9162
- uid: ((_c = record.metadata) == null ? void 0 : _c.uid) || ""
9163
- }
9164
- }
9165
- );
9166
- }
9167
- };
9168
- };
9169
- const DataField = (i18n2) => {
9170
- return {
9171
- key: "data",
9172
- title: i18n2.t("data"),
9173
- path: ["rawYaml", "data"],
9174
- render: (val) => {
9175
- return /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValue, { value: val });
9176
- }
9177
- };
9178
- };
9179
- const SecretDataField = (i18n2) => {
9180
- return {
9181
- key: "data",
9182
- title: i18n2.t("data"),
9183
- path: ["rawYaml", "data"],
9184
- render: (val) => {
9185
- const decodeVal = {};
9186
- for (const key in val) {
9187
- decodeVal[key] = atob(val[key]);
9188
- }
9189
- return /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValue, { value: decodeVal });
9190
- }
9191
- };
9192
- };
9193
- const StartTimeField = (i18n2) => {
9194
- return {
9195
- key: "started",
9196
- title: i18n2.t("started"),
9197
- path: ["status", "startTime"],
9198
- render(value) {
9199
- return /* @__PURE__ */ jsxRuntime.exports.jsx(Time, { date: value });
9200
- }
9201
- };
9202
- };
9203
- const ServiceTypeField = (i18n2) => {
9204
- return {
9205
- key: "type",
9206
- title: i18n2.t("dovetail.type"),
9207
- path: ["rawYaml", "spec", "type"]
9208
- };
9209
- };
9210
- const ClusterIpField = (i18n2) => {
8980
+ const ClusterIpField = () => {
9211
8981
  return {
9212
8982
  key: "clusterIp",
9213
- title: i18n2.t("dovetail.clusterIp"),
9214
- path: ["rawYaml", "spec", "clusterIP"]
8983
+ title: i18n__default.default.t("dovetail.clusterIp"),
8984
+ path: ["spec", "clusterIP"]
9215
8985
  };
9216
8986
  };
9217
- const SessionAffinityField = (i18n2) => {
8987
+ const SessionAffinityField = () => {
9218
8988
  return {
9219
8989
  key: "clusterIp",
9220
- title: i18n2.t("dovetail.sessionAffinity"),
9221
- path: ["rawYaml", "spec", "sessionAffinity"]
8990
+ title: i18n__default.default.t("dovetail.sessionAffinity"),
8991
+ path: ["spec", "sessionAffinity"]
9222
8992
  };
9223
8993
  };
9224
- const ServicePodsField = (_) => {
8994
+ const ServicePodsField = () => {
9225
8995
  return {
9226
8996
  key: "pods",
9227
8997
  title: "Pods",
9228
8998
  path: [],
9229
- render: (_2, record) => {
8999
+ render: (_, record) => {
9230
9000
  var _a, _b;
9231
9001
  return /* @__PURE__ */ jsxRuntime.exports.jsx(
9232
9002
  WorkloadPodsTable,
@@ -9400,87 +9170,65 @@ var __publicField = (obj, key, value) => {
9400
9170
  __proto__: null,
9401
9171
  default: MonacoYamlEditor$1
9402
9172
  }, Symbol.toStringTag, { value: "Module" }));
9403
- const index_m52iq6 = "";
9404
- const TagWrapper = "t13a6vox";
9405
- const TagStyle = "t12ikbmp";
9406
- const Tags = (props) => {
9407
- const {
9408
- value
9409
- } = props;
9410
- const kit = eagle.useUIKit();
9411
- const tags = Object.keys(value).map((key) => {
9412
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.tag, {
9413
- className: TagStyle,
9414
- title: `${key}:${value[key]}`,
9415
- children: [key, ":", value[key]]
9416
- }, key);
9417
- });
9418
- return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.space, {
9419
- className: TagWrapper,
9420
- size: 8,
9421
- children: tags
9422
- });
9423
- };
9424
9173
  const EventsTable = ({}) => {
9425
- eagle.useUIKit();
9426
9174
  const { i18n: i18n2 } = useTranslation();
9427
9175
  const [currentPage, setCurrentPage] = React.useState(1);
9428
- const parsed = core.useParsed();
9429
9176
  const { data: data2, isLoading } = core.useList({
9430
9177
  resource: "events",
9431
9178
  meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" }
9432
9179
  });
9180
+ const parsed = core.useParsed();
9433
9181
  const columns = React.useMemo(
9434
9182
  () => [
9435
- NameSpaceColumnRenderer(i18n2),
9183
+ NameSpaceColumnRenderer(),
9436
9184
  {
9437
9185
  key: "type",
9438
9186
  display: true,
9439
- dataIndex: ["rawYaml", "type"],
9440
- title: i18n2.t("type"),
9187
+ dataIndex: ["type"],
9188
+ title: i18n2.t("dovetail.type"),
9441
9189
  sortable: true,
9442
- sorter: CommonSorter(["rawYaml", "type"])
9190
+ sorter: CommonSorter(["type"])
9443
9191
  },
9444
9192
  {
9445
9193
  key: "reason",
9446
9194
  display: true,
9447
- dataIndex: ["rawYaml", "reason"],
9448
- title: i18n2.t("reason"),
9195
+ dataIndex: ["reason"],
9196
+ title: i18n2.t("dovetail.reason"),
9449
9197
  sortable: true,
9450
- sorter: CommonSorter(["rawYaml", "reason"])
9198
+ sorter: CommonSorter(["reason"])
9451
9199
  },
9452
9200
  {
9453
9201
  key: "object",
9454
9202
  display: true,
9455
- dataIndex: ["rawYaml", "regarding", "name"],
9456
- title: i18n2.t("object"),
9203
+ dataIndex: ["regarding", "name"],
9204
+ title: i18n2.t("dovetail.object"),
9457
9205
  sortable: true,
9458
- sorter: CommonSorter(["rawYaml", "regarding", "name"])
9206
+ sorter: CommonSorter(["regarding", "name"])
9459
9207
  },
9460
9208
  {
9461
9209
  key: "note",
9462
9210
  display: true,
9463
- dataIndex: ["rawYaml", "note"],
9464
- title: i18n2.t("note"),
9211
+ dataIndex: ["note"],
9212
+ title: i18n2.t("dovetail.note"),
9465
9213
  sortable: true,
9466
- sorter: CommonSorter(["rawYaml", "note"])
9214
+ sorter: CommonSorter(["note"])
9467
9215
  },
9468
- AgeColumnRenderer(i18n2)
9216
+ AgeColumnRenderer()
9469
9217
  ],
9470
9218
  [i18n2]
9471
9219
  );
9472
- const dataSource = React.useMemo(
9473
- () => addId((data2 == null ? void 0 : data2.data) || [], "metadata.uid").filter((d) => {
9220
+ const dataSource = React.useMemo(() => {
9221
+ return data2 == null ? void 0 : data2.data.filter((d) => {
9474
9222
  const objectId = `${d.regarding.namespace}/${d.regarding.name}`;
9475
9223
  return objectId === parsed.id;
9476
- }).map((d) => new ResourceModel(d)),
9477
- [data2 == null ? void 0 : data2.data, parsed]
9478
- );
9224
+ });
9225
+ }, [data2 == null ? void 0 : data2.data, parsed]);
9479
9226
  return /* @__PURE__ */ jsxRuntime.exports.jsx(
9480
9227
  Table,
9481
9228
  {
9229
+ tableKey: "events",
9482
9230
  loading: isLoading,
9483
- dataSource: dataSource || [],
9231
+ data: dataSource || [],
9484
9232
  columns,
9485
9233
  rowKey: "id",
9486
9234
  error: false,
@@ -9491,6 +9239,27 @@ var __publicField = (obj, key, value) => {
9491
9239
  }
9492
9240
  );
9493
9241
  };
9242
+ const index_m52iq6 = "";
9243
+ const TagWrapper = "t13a6vox";
9244
+ const TagStyle = "t12ikbmp";
9245
+ const Tags = (props) => {
9246
+ const {
9247
+ value
9248
+ } = props;
9249
+ const kit = eagle.useUIKit();
9250
+ const tags = Object.keys(value).map((key) => {
9251
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.tag, {
9252
+ className: TagStyle,
9253
+ title: `${key}:${value[key]}`,
9254
+ children: [key, ":", value[key]]
9255
+ }, key);
9256
+ });
9257
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.space, {
9258
+ className: TagWrapper,
9259
+ size: 8,
9260
+ children: tags
9261
+ });
9262
+ };
9494
9263
  const ShowContent_10jwllm = "";
9495
9264
  const TopBarStyle = "t9agep2";
9496
9265
  const ShowContentStyle = "so89gfi";
@@ -9503,6 +9272,9 @@ var __publicField = (obj, key, value) => {
9503
9272
  Dropdown = K8sDropdown
9504
9273
  } = props;
9505
9274
  const kit = eagle.useUIKit();
9275
+ const {
9276
+ globalStore
9277
+ } = useGlobalStore();
9506
9278
  const parsed = core.useParsed();
9507
9279
  const {
9508
9280
  resource
@@ -9525,14 +9297,15 @@ var __publicField = (obj, key, value) => {
9525
9297
  if (!(data2 == null ? void 0 : data2.data)) {
9526
9298
  return null;
9527
9299
  }
9528
- const record = formatter(data2 == null ? void 0 : data2.data);
9300
+ const model = data2.data;
9301
+ const record = formatter ? formatter(model) : data2 == null ? void 0 : data2.data;
9529
9302
  const FirstLineFields = [{
9530
9303
  key: "NameSpace",
9531
- title: t("namespace"),
9304
+ title: t("dovetail.namespace"),
9532
9305
  path: ["metadata", "namespace"]
9533
9306
  }, {
9534
9307
  key: "Age",
9535
- title: t("created_time"),
9308
+ title: t("dovetail.created_time"),
9536
9309
  path: ["metadata", "creationTimestamp"],
9537
9310
  render(value) {
9538
9311
  return /* @__PURE__ */ jsxRuntime.exports.jsx(Time, {
@@ -9542,7 +9315,7 @@ var __publicField = (obj, key, value) => {
9542
9315
  }];
9543
9316
  const SecondLineFields = [{
9544
9317
  key: "Labels",
9545
- title: t("label"),
9318
+ title: t("dovetail.label"),
9546
9319
  path: ["metadata", "labels"],
9547
9320
  render: (value) => {
9548
9321
  if (!value) {
@@ -9554,7 +9327,7 @@ var __publicField = (obj, key, value) => {
9554
9327
  }
9555
9328
  }, {
9556
9329
  key: "Annotations",
9557
- title: t("annotation"),
9330
+ title: t("dovetail.annotation"),
9558
9331
  path: ["metadata", "annotations"],
9559
9332
  render: (value) => {
9560
9333
  if (!value) {
@@ -9603,13 +9376,13 @@ var __publicField = (obj, key, value) => {
9603
9376
  onChange: (e) => setMode(e.target.value),
9604
9377
  children: [/* @__PURE__ */ jsxRuntime.exports.jsx(kit.radioButton, {
9605
9378
  value: "detail",
9606
- children: t("detail")
9379
+ children: t("dovetail.detail")
9607
9380
  }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.radioButton, {
9608
9381
  value: "yaml",
9609
9382
  children: "YAML"
9610
9383
  })]
9611
9384
  }), /* @__PURE__ */ jsxRuntime.exports.jsx(Dropdown, {
9612
- data: record
9385
+ record
9613
9386
  })]
9614
9387
  })]
9615
9388
  });
@@ -9640,7 +9413,7 @@ var __publicField = (obj, key, value) => {
9640
9413
  children: content
9641
9414
  }, field.key);
9642
9415
  }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tabsTabPane, {
9643
- tab: t("event"),
9416
+ tab: t("dovetail.event"),
9644
9417
  children: /* @__PURE__ */ jsxRuntime.exports.jsx(EventsTable, {})
9645
9418
  }, "event")]
9646
9419
  });
@@ -9650,7 +9423,7 @@ var __publicField = (obj, key, value) => {
9650
9423
  }),
9651
9424
  ["yaml"]: /* @__PURE__ */ jsxRuntime.exports.jsx(MonacoYamlEditor$1, {
9652
9425
  className: EditorStyle$1,
9653
- defaultValue: yaml__default.default.dump(lodashEs.omit(k8sApiProvider.relationPlugin.restoreItem(data2.data), "id")),
9426
+ defaultValue: yaml__default.default.dump(globalStore == null ? void 0 : globalStore.restoreItem(model)),
9654
9427
  schema: {},
9655
9428
  onEditorCreate: (editor) => {
9656
9429
  fold(editor);
@@ -9704,7 +9477,7 @@ var __publicField = (obj, key, value) => {
9704
9477
  {
9705
9478
  key: "state",
9706
9479
  dataIndex: ["state"],
9707
- title: i18n2.t("state"),
9480
+ title: i18n2.t("dovetail.state"),
9708
9481
  sortable: true,
9709
9482
  sorter: CommonSorter(["state"]),
9710
9483
  render: (v) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: Object.keys(v)[0] })
@@ -9712,7 +9485,7 @@ var __publicField = (obj, key, value) => {
9712
9485
  {
9713
9486
  key: "ready",
9714
9487
  dataIndex: ["ready"],
9715
- title: i18n2.t("ready"),
9488
+ title: i18n2.t("dovetail.ready"),
9716
9489
  sortable: true,
9717
9490
  sorter: CommonSorter(["ready"]),
9718
9491
  render: (v) => /* @__PURE__ */ jsxRuntime.exports.jsx(
@@ -9725,21 +9498,21 @@ var __publicField = (obj, key, value) => {
9725
9498
  {
9726
9499
  key: "name",
9727
9500
  dataIndex: ["name"],
9728
- title: i18n2.t("name"),
9501
+ title: i18n2.t("dovetail.name"),
9729
9502
  sortable: true,
9730
9503
  sorter: CommonSorter(["name"])
9731
9504
  },
9732
9505
  {
9733
9506
  key: "image",
9734
9507
  dataIndex: ["image"],
9735
- title: i18n2.t("image"),
9508
+ title: i18n2.t("dovetail.image"),
9736
9509
  sortable: true,
9737
9510
  sorter: CommonSorter(["image"])
9738
9511
  },
9739
9512
  {
9740
9513
  key: "init",
9741
9514
  dataIndex: [],
9742
- title: i18n2.t("init_container"),
9515
+ title: i18n2.t("dovetail.init_container"),
9743
9516
  render: (_, record) => {
9744
9517
  const isInit = initContainerStatuses.some(
9745
9518
  (c) => c.containerID === record.containerID
@@ -9753,14 +9526,14 @@ var __publicField = (obj, key, value) => {
9753
9526
  {
9754
9527
  key: "restartCount",
9755
9528
  dataIndex: ["restartCount"],
9756
- title: i18n2.t("restarts"),
9529
+ title: i18n2.t("dovetail.restarts"),
9757
9530
  sortable: true,
9758
9531
  sorter: CommonSorter(["restartCount"])
9759
9532
  },
9760
9533
  {
9761
9534
  key: "started",
9762
9535
  dataIndex: ["state", "running", "startedAt"],
9763
- title: i18n2.t("started"),
9536
+ title: i18n2.t("dovetail.started"),
9764
9537
  sortable: true,
9765
9538
  sorter: CommonSorter(["state", "running", "startedAt"]),
9766
9539
  render: (value) => {
@@ -9788,16 +9561,16 @@ var __publicField = (obj, key, value) => {
9788
9561
  );
9789
9562
  };
9790
9563
  function WorkloadDropdown(props) {
9791
- const { data: data2 } = props;
9564
+ const { record } = props;
9792
9565
  const kit = eagle.useUIKit();
9793
9566
  const { resource } = core.useResource();
9794
9567
  const { mutate } = core.useUpdate();
9795
9568
  const { t } = useTranslation();
9796
- return /* @__PURE__ */ jsxRuntime.exports.jsx(K8sDropdown, { data: data2, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
9569
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(K8sDropdown, { record, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
9797
9570
  kit.menu.Item,
9798
9571
  {
9799
9572
  onClick: () => {
9800
- const v = data2.redeploy();
9573
+ const v = record.redeploy();
9801
9574
  const id = v.id;
9802
9575
  pruneBeforeEdit(v);
9803
9576
  mutate({
@@ -9810,6 +9583,7 @@ var __publicField = (obj, key, value) => {
9810
9583
  }
9811
9584
  ) });
9812
9585
  }
9586
+ const ComponentContext = React.createContext({});
9813
9587
  const index_3lw8k1 = "";
9814
9588
  const ListPageStyle = "laykzsq";
9815
9589
  const TableStyle = "t1ng0psc";
@@ -9819,12 +9593,16 @@ var __publicField = (obj, key, value) => {
9819
9593
  selectedKeys,
9820
9594
  tableProps
9821
9595
  } = props;
9596
+ const {
9597
+ Table: TableComponent
9598
+ } = React.useContext(ComponentContext);
9599
+ const Table$1 = TableComponent || Table;
9822
9600
  return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
9823
9601
  className: ListPageStyle,
9824
9602
  children: [/* @__PURE__ */ jsxRuntime.exports.jsx(TableToolBar, {
9825
9603
  title,
9826
9604
  selectedKeys
9827
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(Table, {
9605
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(Table$1, {
9828
9606
  ...tableProps,
9829
9607
  className: TableStyle,
9830
9608
  scroll: {
@@ -9835,13 +9613,12 @@ var __publicField = (obj, key, value) => {
9835
9613
  }
9836
9614
  function ResourceList(props) {
9837
9615
  const { formatter, name: name2, columns, Dropdown } = props;
9838
- const { i18n: i18n2 } = useTranslation();
9839
9616
  const { tableProps, selectedKeys } = useEagleTable({
9840
9617
  useTableParams: {},
9841
9618
  columns: [
9842
- PhaseColumnRenderer(i18n2),
9843
- NameColumnRenderer(i18n2),
9844
- NameSpaceColumnRenderer(i18n2),
9619
+ NameColumnRenderer(),
9620
+ PhaseColumnRenderer(),
9621
+ NameSpaceColumnRenderer(),
9845
9622
  ...columns
9846
9623
  ],
9847
9624
  tableProps: {
@@ -9863,6 +9640,46 @@ var __publicField = (obj, key, value) => {
9863
9640
  }
9864
9641
  );
9865
9642
  }
9643
+ const index_1kmu85y = "";
9644
+ const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
9645
+ name: "ErrorWrapper",
9646
+ class: "egn3dbn",
9647
+ propsAsIs: false
9648
+ });
9649
+ const ErrorContent = /* @__PURE__ */ styled_default("div")({
9650
+ name: "ErrorContent",
9651
+ class: "e136jgy8",
9652
+ propsAsIs: false
9653
+ });
9654
+ const WidgetErrorContent = (props) => {
9655
+ const {
9656
+ refetch,
9657
+ errorText,
9658
+ hiddenRetry
9659
+ } = props;
9660
+ const kit = React.useContext(eagle.kitContext);
9661
+ const {
9662
+ t
9663
+ } = useTranslation();
9664
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(ErrorWrapper, {
9665
+ className: props.className,
9666
+ style: props.style,
9667
+ children: /* @__PURE__ */ jsxRuntime.exports.jsxs(ErrorContent, {
9668
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx("p", {
9669
+ className: cx_default(eagle.Typo.Label.l1_regular_title, "title"),
9670
+ children: errorText || t("dovetail.obtain_data_error")
9671
+ }), hiddenRetry ? null : /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
9672
+ size: "small",
9673
+ type: "ordinary",
9674
+ onClick: (e) => {
9675
+ e.stopPropagation();
9676
+ refetch == null ? void 0 : refetch();
9677
+ },
9678
+ children: t("dovetail.retry")
9679
+ })]
9680
+ })
9681
+ });
9682
+ };
9866
9683
  const index_12sfrn = "";
9867
9684
  const Style = "s1bsn3us";
9868
9685
  const Separator = () => {
@@ -9904,8 +9721,8 @@ var __publicField = (obj, key, value) => {
9904
9721
  (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value2);
9905
9722
  },
9906
9723
  getEditorValue: () => {
9907
- var _a;
9908
- return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) || "";
9724
+ var _a, _b;
9725
+ return (_b = (_a = editorInstance.current) == null ? void 0 : _a.getValue()) != null ? _b : "";
9909
9726
  },
9910
9727
  getEditorInstance: () => editorInstance.current || null
9911
9728
  };
@@ -10121,6 +9938,172 @@ var __publicField = (obj, key, value) => {
10121
9938
  document.execCommand("copy");
10122
9939
  document.body.removeChild(input);
10123
9940
  }
9941
+ const BASE_INIT_VALUE = {
9942
+ metadata: {
9943
+ name: "",
9944
+ namespace: "default",
9945
+ annotations: {},
9946
+ labels: {}
9947
+ }
9948
+ };
9949
+ const DEFAULT_MATCH_LABEL = "sks.user.kubesmart.smtx.io/app";
9950
+ const BASE_CONTAINER_INIT_VALUE = {
9951
+ name: "container-0",
9952
+ imagePullPolicy: "Always",
9953
+ image: ""
9954
+ };
9955
+ const BASE_WORKLOAD_SPEC_INIT_VALUE = {
9956
+ affinity: {},
9957
+ imagePullSecrets: [],
9958
+ initContainers: [],
9959
+ volumes: []
9960
+ };
9961
+ const DEPLOYMENT_INIT_VALUE = {
9962
+ apiVersion: "apps/v1",
9963
+ kind: "Deployment",
9964
+ ...BASE_INIT_VALUE,
9965
+ spec: {
9966
+ replicas: 1,
9967
+ selector: {
9968
+ matchLabels: {
9969
+ [DEFAULT_MATCH_LABEL]: ""
9970
+ }
9971
+ },
9972
+ template: {
9973
+ metadata: {
9974
+ labels: {
9975
+ [DEFAULT_MATCH_LABEL]: ""
9976
+ }
9977
+ },
9978
+ spec: {
9979
+ containers: [BASE_CONTAINER_INIT_VALUE],
9980
+ restartPolicy: "Always",
9981
+ ...BASE_WORKLOAD_SPEC_INIT_VALUE
9982
+ }
9983
+ }
9984
+ }
9985
+ };
9986
+ const CRONJOB_INIT_VALUE = {
9987
+ apiVersion: "batch/v1",
9988
+ kind: "CronJob",
9989
+ ...BASE_INIT_VALUE,
9990
+ spec: {
9991
+ schedule: "",
9992
+ jobTemplate: {
9993
+ metadata: {
9994
+ labels: {}
9995
+ },
9996
+ spec: {
9997
+ template: {
9998
+ spec: {
9999
+ containers: [BASE_CONTAINER_INIT_VALUE],
10000
+ restartPolicy: "Never",
10001
+ ...BASE_WORKLOAD_SPEC_INIT_VALUE
10002
+ }
10003
+ }
10004
+ }
10005
+ }
10006
+ }
10007
+ };
10008
+ const DAEMONSET_INIT_VALUE = {
10009
+ apiVersion: "apps/v1",
10010
+ kind: "DaemonSet",
10011
+ ...BASE_INIT_VALUE,
10012
+ spec: {
10013
+ replicas: 1,
10014
+ selector: {
10015
+ matchLabels: {
10016
+ [DEFAULT_MATCH_LABEL]: ""
10017
+ }
10018
+ },
10019
+ template: {
10020
+ metadata: {
10021
+ labels: {
10022
+ [DEFAULT_MATCH_LABEL]: ""
10023
+ }
10024
+ },
10025
+ spec: {
10026
+ containers: [BASE_CONTAINER_INIT_VALUE],
10027
+ restartPolicy: "Always",
10028
+ ...BASE_WORKLOAD_SPEC_INIT_VALUE
10029
+ }
10030
+ }
10031
+ }
10032
+ };
10033
+ const JOB_INIT_VALUE = {
10034
+ apiVersion: "batch/v1",
10035
+ kind: "Job",
10036
+ ...BASE_INIT_VALUE,
10037
+ spec: {
10038
+ replicas: 1,
10039
+ selector: {
10040
+ matchLabels: {}
10041
+ },
10042
+ template: {
10043
+ metadata: {
10044
+ labels: {}
10045
+ },
10046
+ spec: {
10047
+ containers: [BASE_CONTAINER_INIT_VALUE],
10048
+ restartPolicy: "Never",
10049
+ ...BASE_WORKLOAD_SPEC_INIT_VALUE
10050
+ }
10051
+ }
10052
+ }
10053
+ };
10054
+ const STATEFULSET_INIT_VALUE = {
10055
+ apiVersion: "apps/v1",
10056
+ kind: "StatefulSet",
10057
+ ...BASE_INIT_VALUE,
10058
+ spec: {
10059
+ replicas: 1,
10060
+ selector: {
10061
+ matchLabels: {
10062
+ [DEFAULT_MATCH_LABEL]: ""
10063
+ }
10064
+ },
10065
+ template: {
10066
+ metadata: {
10067
+ labels: {
10068
+ [DEFAULT_MATCH_LABEL]: ""
10069
+ }
10070
+ },
10071
+ spec: {
10072
+ containers: [BASE_CONTAINER_INIT_VALUE],
10073
+ restartPolicy: "Always",
10074
+ ...BASE_WORKLOAD_SPEC_INIT_VALUE
10075
+ }
10076
+ }
10077
+ }
10078
+ };
10079
+ const POD_INIT_VALUE = {
10080
+ apiVersion: "v1",
10081
+ kind: "Pod",
10082
+ ...BASE_INIT_VALUE,
10083
+ spec: {
10084
+ containers: [BASE_CONTAINER_INIT_VALUE]
10085
+ }
10086
+ };
10087
+ const SERVICE_INIT_VALUE = {
10088
+ "apiVersion": "v1",
10089
+ "kind": "Service",
10090
+ ...BASE_INIT_VALUE,
10091
+ "spec": {
10092
+ "selector": {},
10093
+ "clusterIP": null,
10094
+ "ports": [
10095
+ {
10096
+ "name": "",
10097
+ "port": null,
10098
+ "protocol": "TCP",
10099
+ "targetPort": null
10100
+ }
10101
+ ],
10102
+ "sessionAffinity": "None",
10103
+ "type": "ClusterIP"
10104
+ }
10105
+ };
10106
+ const TIMESTAMP_LABEL = "sks.user.kubesmart.smtx.io/timestamp";
10124
10107
  function getCommonErrors(response, i18n2) {
10125
10108
  var _a;
10126
10109
  if (!((response == null ? void 0 : response.message) || (response == null ? void 0 : response.code) || (response == null ? void 0 : response.reason) || (response == null ? void 0 : response.details) || (response == null ? void 0 : response.graphQLErrors))) {
@@ -10168,60 +10151,89 @@ var __publicField = (obj, key, value) => {
10168
10151
  )
10169
10152
  ];
10170
10153
  }
10171
- const index_1tozzph = "";
10172
- const EditorStyle = "e5ks0bl";
10154
+ const index_1mpguu8 = "";
10155
+ const FormStyle = "f5ks0bl";
10156
+ const EditorStyle = "e1tqaxpu";
10157
+ var SchemaStrategy = /* @__PURE__ */ ((SchemaStrategy2) => {
10158
+ SchemaStrategy2["Required"] = "Required";
10159
+ SchemaStrategy2["Optional"] = "Optional";
10160
+ SchemaStrategy2["None"] = "None";
10161
+ return SchemaStrategy2;
10162
+ })(SchemaStrategy || {});
10173
10163
  function YamlForm(props) {
10174
10164
  var _a, _b;
10165
+ const {
10166
+ schemaStrategy = "Optional"
10167
+ } = props;
10175
10168
  const {
10176
10169
  formProps,
10177
10170
  saveButtonProps,
10178
10171
  editorProps,
10179
10172
  errorResponseBody,
10180
- mutationResult
10181
- } = useEagleForm();
10173
+ mutationResult,
10174
+ isLoadingSchema,
10175
+ fetchSchema
10176
+ } = useEagleForm({
10177
+ editorOptions: {
10178
+ isSkipSchema: schemaStrategy === "None"
10179
+ },
10180
+ liveMode: "off"
10181
+ });
10182
10182
  const kit = eagle.useUIKit();
10183
10183
  const {
10184
10184
  t,
10185
10185
  i18n: i18n2
10186
10186
  } = useTranslation();
10187
10187
  const responseErrors = errorResponseBody ? getCommonErrors(errorResponseBody, i18n2) : [];
10188
+ const schema = React.useMemo(() => {
10189
+ return editorProps.schema || {};
10190
+ }, [editorProps.schema]);
10188
10191
  return /* @__PURE__ */ jsxRuntime.exports.jsx(FormLayout, {
10189
10192
  children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form, {
10190
10193
  ...formProps,
10191
10194
  initialValues: (_b = (_a = formProps.initialValues) != null ? _a : props.initialValues) != null ? _b : BASE_INIT_VALUE,
10192
10195
  layout: "horizontal",
10193
- children: editorProps.schema ? /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, {
10194
- children: [/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, {
10195
- style: {
10196
- flex: 1
10197
- },
10198
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(YamlEditorComponent, {
10199
- ...editorProps,
10200
- className: EditorStyle,
10201
- schema: editorProps.schema,
10202
- collapsable: false
10203
- })
10204
- }), /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.form.Item, {
10205
- children: [mutationResult.error && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.alert, {
10206
- message: errorResponseBody ? /* @__PURE__ */ jsxRuntime.exports.jsx("ul", {
10207
- children: responseErrors.map((error, index) => /* @__PURE__ */ jsxRuntime.exports.jsxs("li", {
10208
- children: [responseErrors.length > 1 ? index + 1 + ". " : "", error]
10209
- }, error))
10210
- }) : mutationResult.error.message,
10211
- type: "error",
10212
- style: {
10213
- marginTop: 16
10214
- }
10215
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
10216
- ...saveButtonProps,
10217
- type: "primary",
10196
+ className: FormStyle,
10197
+ children: (() => {
10198
+ if (isLoadingSchema) {
10199
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.loading, {});
10200
+ }
10201
+ return editorProps.schema || schemaStrategy !== "Required" ? /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, {
10202
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, {
10218
10203
  style: {
10219
- marginTop: 16
10204
+ flex: 1
10220
10205
  },
10221
- children: t("save")
10206
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(YamlEditorComponent, {
10207
+ ...editorProps,
10208
+ className: EditorStyle,
10209
+ schema,
10210
+ collapsable: false
10211
+ })
10212
+ }), /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.form.Item, {
10213
+ children: [mutationResult.error && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.alert, {
10214
+ message: errorResponseBody ? /* @__PURE__ */ jsxRuntime.exports.jsx("ul", {
10215
+ children: responseErrors.map((error, index) => /* @__PURE__ */ jsxRuntime.exports.jsxs("li", {
10216
+ children: [responseErrors.length > 1 ? index + 1 + ". " : "", error]
10217
+ }, error))
10218
+ }) : mutationResult.error.message,
10219
+ type: "error",
10220
+ style: {
10221
+ marginTop: 16
10222
+ }
10223
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
10224
+ ...saveButtonProps,
10225
+ type: "primary",
10226
+ style: {
10227
+ marginTop: 16
10228
+ },
10229
+ children: t("dovetail.save")
10230
+ })]
10222
10231
  })]
10223
- })]
10224
- }) : /* @__PURE__ */ jsxRuntime.exports.jsx(kit.loading, {})
10232
+ }) : /* @__PURE__ */ jsxRuntime.exports.jsx(WidgetErrorContent, {
10233
+ errorText: t("dovetail.fetch_schema_fail"),
10234
+ refetch: fetchSchema
10235
+ });
10236
+ })()
10225
10237
  })
10226
10238
  });
10227
10239
  }
@@ -10241,25 +10253,23 @@ var __publicField = (obj, key, value) => {
10241
10253
  }
10242
10254
  const ResourceCRUD = (props) => {
10243
10255
  const { configs, urlPrefix } = props;
10244
- const { i18n: i18n2 } = useTranslation();
10245
10256
  return /* @__PURE__ */ jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment, { children: configs.map((config) => {
10246
10257
  var _a, _b;
10247
- const formatter = config.formatter || ((v) => new ResourceModel(v));
10248
10258
  return /* @__PURE__ */ jsxRuntime.exports.jsxs(React__default.default.Fragment, { children: [
10249
10259
  /* @__PURE__ */ jsxRuntime.exports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}`, exact: true, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
10250
10260
  ResourceList,
10251
10261
  {
10252
10262
  name: config.kind,
10253
- formatter,
10254
- columns: ((_a = config.columns) == null ? void 0 : _a.call(config, i18n2)) || [],
10263
+ formatter: config.formatter,
10264
+ columns: ((_a = config.columns) == null ? void 0 : _a.call(config)) || [],
10255
10265
  Dropdown: config.Dropdown
10256
10266
  }
10257
10267
  ) }),
10258
10268
  /* @__PURE__ */ jsxRuntime.exports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/show`, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
10259
10269
  ResourceShow,
10260
10270
  {
10261
- formatter,
10262
- filedGroups: ((_b = config.showFields) == null ? void 0 : _b.call(config, i18n2)) || [],
10271
+ formatter: config.formatter,
10272
+ filedGroups: ((_b = config.showFields) == null ? void 0 : _b.call(config)) || [],
10263
10273
  Dropdown: config.Dropdown
10264
10274
  }
10265
10275
  ) }),
@@ -10269,19 +10279,19 @@ var __publicField = (obj, key, value) => {
10269
10279
  }) });
10270
10280
  };
10271
10281
  function CronJobDropdown(props) {
10272
- var _a;
10273
- const { data: data2 } = props;
10282
+ const { record } = props;
10283
+ const { spec } = record;
10274
10284
  const kit = eagle.useUIKit();
10275
10285
  const { resource } = core.useResource();
10276
10286
  const { mutate } = core.useUpdate();
10277
10287
  const { t } = useTranslation();
10278
- const suspended = Boolean((_a = data2.spec) == null ? void 0 : _a.suspend);
10279
- return /* @__PURE__ */ jsxRuntime.exports.jsx(K8sDropdown, { data: data2, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
10288
+ const suspended = Boolean(spec == null ? void 0 : spec.suspend);
10289
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(K8sDropdown, { record, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
10280
10290
  kit.menu.Item,
10281
10291
  {
10282
10292
  onClick: () => {
10283
- const v = suspended ? data2.resume() : data2.suspend();
10284
- const id = v.id;
10293
+ const v = suspended ? record.resume() : record.suspend();
10294
+ const id = record.id;
10285
10295
  pruneBeforeEdit(v);
10286
10296
  mutate({
10287
10297
  id,
@@ -10293,35 +10303,104 @@ var __publicField = (obj, key, value) => {
10293
10303
  }
10294
10304
  ) });
10295
10305
  }
10296
- const index_1wzdp7m = "";
10297
- const WrapperStyle = "wfg6u6g";
10298
- const InnerBar = ({
10299
- usage,
10300
- requestNum,
10301
- limitNum
10302
- }) => {
10303
- const usageNum = parseSi(usage);
10304
- const totalNum = limitNum || requestNum / 0.8;
10305
- const requestPercent = 100 * requestNum / totalNum;
10306
- const usageInRequestPercent = 100 * Math.min(usageNum / requestNum, 1);
10307
- const usageInRequestToLimitPercent = 100 * Math.min(Math.max(usageNum - requestNum, 0) / (totalNum - requestNum), 1);
10308
- const noLimit = limitNum === 0;
10309
- return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
10310
- className: "usage-bar",
10311
- style: {
10312
- marginLeft: 4
10313
- },
10314
- children: [/* @__PURE__ */ jsxRuntime.exports.jsx("div", {
10315
- className: "request-anchor",
10316
- style: {
10317
- left: `${requestPercent}%`
10318
- }
10319
- }), /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
10320
- className: "request-bar",
10321
- style: {
10322
- width: `${requestPercent}%`
10323
- },
10324
- children: /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
10306
+ const UNITS = ["", "K", "M", "G", "T", "P"];
10307
+ const FRACTIONAL = ["", "m", "u", "n", "p", "f"];
10308
+ function formatSi(inValue, options) {
10309
+ const {
10310
+ increment = 1e3,
10311
+ suffix = null,
10312
+ firstSuffix = null,
10313
+ startingExponent = 0,
10314
+ minExponent = 0,
10315
+ maxPrecision = 2,
10316
+ atLeastOne = true
10317
+ } = options || {};
10318
+ let val = inValue;
10319
+ let exp = startingExponent;
10320
+ while (val >= increment && exp + 1 < UNITS.length || exp < minExponent) {
10321
+ val = val / increment;
10322
+ exp++;
10323
+ }
10324
+ let out = 0;
10325
+ if (val < 10 && maxPrecision >= 2) {
10326
+ out = Math.round(val * 100) / 100;
10327
+ } else if (val < 100 && maxPrecision >= 1) {
10328
+ out = Math.round(val * 10) / 10;
10329
+ } else {
10330
+ out = Math.round(val);
10331
+ }
10332
+ if (atLeastOne && out === 0) {
10333
+ out = 1;
10334
+ }
10335
+ let outStr = String(out);
10336
+ if (exp === 0 && firstSuffix !== null) {
10337
+ outStr += `${firstSuffix}`;
10338
+ } else {
10339
+ outStr += `${UNITS[exp]}${suffix}` || "";
10340
+ }
10341
+ return outStr;
10342
+ }
10343
+ function parseSi(inValue, increment = null, allowFractional = true) {
10344
+ if (!inValue || typeof inValue !== "string" || !inValue.length) {
10345
+ return NaN;
10346
+ }
10347
+ inValue = inValue.replace(/,/g, "");
10348
+ let [, valStr, unit, incStr] = inValue.match(/^([0-9.-]+)\s*([^0-9.-]?)([^0-9.-]?)/) || [];
10349
+ const val = parseFloat(valStr);
10350
+ if (!unit) {
10351
+ return val;
10352
+ }
10353
+ if (unit.charCodeAt(0) === 181) {
10354
+ unit = "u";
10355
+ }
10356
+ const divide = FRACTIONAL.includes(unit);
10357
+ const multiply = UNITS.includes(unit.toUpperCase());
10358
+ if (increment === null) {
10359
+ if ((multiply || divide) && incStr === "i") {
10360
+ increment = 1024;
10361
+ } else {
10362
+ increment = 1e3;
10363
+ }
10364
+ }
10365
+ if (divide && allowFractional) {
10366
+ const exp = FRACTIONAL.indexOf(unit);
10367
+ return val / Math.pow(increment, exp);
10368
+ }
10369
+ if (multiply) {
10370
+ const exp = UNITS.indexOf(unit.toUpperCase());
10371
+ return val * Math.pow(increment, exp);
10372
+ }
10373
+ return val;
10374
+ }
10375
+ const index_1wzdp7m = "";
10376
+ const WrapperStyle = "wfg6u6g";
10377
+ const InnerBar = ({
10378
+ usage,
10379
+ requestNum,
10380
+ limitNum
10381
+ }) => {
10382
+ const usageNum = parseSi(usage);
10383
+ const totalNum = limitNum || requestNum / 0.8;
10384
+ const requestPercent = 100 * requestNum / totalNum;
10385
+ const usageInRequestPercent = 100 * Math.min(usageNum / requestNum, 1);
10386
+ const usageInRequestToLimitPercent = 100 * Math.min(Math.max(usageNum - requestNum, 0) / (totalNum - requestNum), 1);
10387
+ const noLimit = limitNum === 0;
10388
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
10389
+ className: "usage-bar",
10390
+ style: {
10391
+ marginLeft: 4
10392
+ },
10393
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx("div", {
10394
+ className: "request-anchor",
10395
+ style: {
10396
+ left: `${requestPercent}%`
10397
+ }
10398
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
10399
+ className: "request-bar",
10400
+ style: {
10401
+ width: `${requestPercent}%`
10402
+ },
10403
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
10325
10404
  className: "usage-fill-bar",
10326
10405
  style: {
10327
10406
  width: `${usageInRequestPercent}%`
@@ -10365,7 +10444,7 @@ var __publicField = (obj, key, value) => {
10365
10444
  (resource == null ? void 0 : resource.name) || ""
10366
10445
  );
10367
10446
  return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
10368
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", danger: true, onClick: () => openDeleteConfirmModal(id || ""), children: t("delete") }),
10447
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", danger: true, onClick: () => openDeleteConfirmModal(id || ""), children: t("dovetail.delete") }),
10369
10448
  visible ? /* @__PURE__ */ jsxRuntime.exports.jsx(kit.modal, { ...modalProps }) : null
10370
10449
  ] });
10371
10450
  };
@@ -10446,7 +10525,7 @@ var __publicField = (obj, key, value) => {
10446
10525
  const { queryResult } = core.useShow({ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id });
10447
10526
  const { isLoading } = queryResult;
10448
10527
  return /* @__PURE__ */ jsxRuntime.exports.jsx(
10449
- antd$1.Drawer,
10528
+ antd.Drawer,
10450
10529
  {
10451
10530
  title: "Show Drawer",
10452
10531
  placement: "right",
@@ -14836,7 +14915,7 @@ var __publicField = (obj, key, value) => {
14836
14915
  return "&#x27;";
14837
14916
  }
14838
14917
  });
14839
- const LogViewerRow = React.memo(({ index, style: style2, data: data2, ansiUp }) => {
14918
+ const LogViewerRow = React.memo(({ index, style, data: data2, ansiUp }) => {
14840
14919
  const { parsedData, searchedWordIndexes, rowInFocus } = data2;
14841
14920
  const context = React.useContext(LogViewerContext);
14842
14921
  const getData = (index2) => parsedData ? parsedData[index2] : null;
@@ -14880,7 +14959,7 @@ var __publicField = (obj, key, value) => {
14880
14959
  };
14881
14960
  return React__default.default.createElement(
14882
14961
  "div",
14883
- { style: style2, className: css(styles$1.logViewerListItem) },
14962
+ { style, className: css(styles$1.logViewerListItem) },
14884
14963
  React__default.default.createElement("span", { className: css(styles$1.logViewerIndex) }, getRowIndex(index)),
14885
14964
  React__default.default.createElement("span", { className: css(styles$1.logViewerText), style: { width: "fit-content" }, dangerouslySetInnerHTML: { __html: ansiUp.ansi_to_html(getFormattedData()) } })
14886
14965
  );
@@ -15008,19 +15087,19 @@ var __publicField = (obj, key, value) => {
15008
15087
  this._getItemStyle = (index) => {
15009
15088
  const { itemSize } = this.props;
15010
15089
  const itemStyleCache = this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && itemSize);
15011
- let style2;
15090
+ let style;
15012
15091
  if (itemStyleCache.hasOwnProperty(index)) {
15013
- style2 = itemStyleCache[index];
15092
+ style = itemStyleCache[index];
15014
15093
  } else {
15015
15094
  const offset = getItemOffset(this.props, index, this._instanceProps);
15016
15095
  const size = getItemSize(this.props, index, this._instanceProps);
15017
- itemStyleCache[index] = style2 = {
15096
+ itemStyleCache[index] = style = {
15018
15097
  position: "absolute",
15019
15098
  top: offset,
15020
15099
  height: size
15021
15100
  };
15022
15101
  }
15023
- return style2;
15102
+ return style;
15024
15103
  };
15025
15104
  this._getItemStyleCache = memoizeOne(() => ({}));
15026
15105
  this._onScrollVertical = (event2) => {
@@ -15137,7 +15216,7 @@ var __publicField = (obj, key, value) => {
15137
15216
  });
15138
15217
  }
15139
15218
  render() {
15140
- const { children, outerClassName, innerClassName, height, innerRef, innerElementType, innerTagName, itemCount, itemData, itemKey = defaultItemKey, outerElementType, outerTagName, style: style2, useIsScrolling, width, isTextWrapped, hasLineNumbers, indexWidth, ansiUp } = this.props;
15219
+ const { children, outerClassName, innerClassName, height, innerRef, innerElementType, innerTagName, itemCount, itemData, itemKey = defaultItemKey, outerElementType, outerTagName, style, useIsScrolling, width, isTextWrapped, hasLineNumbers, indexWidth, ansiUp } = this.props;
15141
15220
  const { isScrolling } = this.state;
15142
15221
  const onScroll = this._onScrollVertical;
15143
15222
  const [startIndex, stopIndex] = this._getRangeToRender();
@@ -15160,7 +15239,7 @@ var __publicField = (obj, key, value) => {
15160
15239
  onScroll,
15161
15240
  ref: this._outerRefSetter,
15162
15241
  tabIndex: 0,
15163
- style: Object.assign({ height, paddingTop: 0, paddingBottom: 0, WebkitOverflowScrolling: "touch", overflowX: isTextWrapped ? "hidden" : "auto" }, style2)
15242
+ style: Object.assign({ height, paddingTop: 0, paddingBottom: 0, WebkitOverflowScrolling: "touch", overflowX: isTextWrapped ? "hidden" : "auto" }, style)
15164
15243
  }, React.createElement(innerElementType || innerTagName || "div", {
15165
15244
  className: innerClassName,
15166
15245
  ref: innerRef,
@@ -15977,7 +16056,7 @@ var __publicField = (obj, key, value) => {
15977
16056
  var _a, _b, _c, _d, _e;
15978
16057
  const kit = eagle.useUIKit();
15979
16058
  const [selectedContainer, setSelectedContainer] = React.useState(((_b = (_a = pod.spec) == null ? void 0 : _a.containers[0]) == null ? void 0 : _b.name) || "");
15980
- const [follow, setFollow] = React.useState(true);
16059
+ const follow = true;
15981
16060
  const [logs, setLogs] = React.useState([]);
15982
16061
  const [currentItemCount, setCurrentItemCount] = React.useState(0);
15983
16062
  const [paused, setPaused] = React.useState(false);
@@ -16025,7 +16104,7 @@ var __publicField = (obj, key, value) => {
16025
16104
  signal
16026
16105
  } = abortControllerRef.current;
16027
16106
  let url = `${apiUrl}/api/v1/namespaces/${(_a2 = pod.metadata) == null ? void 0 : _a2.namespace}/pods/${(_b2 = pod.metadata) == null ? void 0 : _b2.name}/log?container=${selectedContainer}&tailLines=100&timestamps=true`;
16028
- if (follow) {
16107
+ {
16029
16108
  url += "&follow=true";
16030
16109
  }
16031
16110
  fetch(url, {
@@ -16050,270 +16129,529 @@ var __publicField = (obj, key, value) => {
16050
16129
  if (lastIndex === -1) {
16051
16130
  buffer += chunk;
16052
16131
  }
16053
- const total = buffer + chunk.slice(0, lastIndex);
16054
- buffer = chunk.slice(lastIndex + 1);
16055
- const formattedLogs = total.split("\n").filter(Boolean).map((line) => {
16056
- const [timestamps, ...content] = line.split(" ");
16057
- const t2 = new Date(timestamps).toLocaleString();
16058
- if (t2 === "Invalid Date") {
16059
- return line;
16060
- }
16061
- return `${t2} ${content.join(" ")}`;
16062
- }).join("\n");
16063
- setLogs((prevLogs) => prevLogs.concat(formattedLogs.split("\n")));
16064
- reader.read().then(processChunk);
16065
- };
16066
- reader.read().then(processChunk);
16132
+ const total = buffer + chunk.slice(0, lastIndex);
16133
+ buffer = chunk.slice(lastIndex + 1);
16134
+ const formattedLogs = total.split("\n").filter(Boolean).map((line) => {
16135
+ const [timestamps, ...content] = line.split(" ");
16136
+ const t2 = new Date(timestamps).toLocaleString();
16137
+ if (t2 === "Invalid Date") {
16138
+ return line;
16139
+ }
16140
+ return `${t2} ${content.join(" ")}`;
16141
+ }).join("\n");
16142
+ setLogs((prevLogs) => prevLogs.concat(formattedLogs.split("\n")));
16143
+ reader.read().then(processChunk);
16144
+ };
16145
+ reader.read().then(processChunk);
16146
+ });
16147
+ }, [follow, (_c = pod.metadata) == null ? void 0 : _c.namespace, (_d = pod.metadata) == null ? void 0 : _d.name, selectedContainer]);
16148
+ const stopFetchingLogs = React.useCallback(() => {
16149
+ if (abortControllerRef.current) {
16150
+ abortControllerRef.current.abort();
16151
+ abortControllerRef.current = null;
16152
+ }
16153
+ }, []);
16154
+ React.useEffect(() => {
16155
+ fetchLogs();
16156
+ return () => {
16157
+ stopFetchingLogs();
16158
+ };
16159
+ }, [fetchLogs, stopFetchingLogs]);
16160
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
16161
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
16162
+ className: ToolbarStyle,
16163
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsxs(kit.select, {
16164
+ input: {
16165
+ onChange: (newValue) => {
16166
+ stopFetchingLogs();
16167
+ setSelectedContainer(newValue);
16168
+ setLogs([]);
16169
+ setPaused(false);
16170
+ setLinesBehind(0);
16171
+ },
16172
+ value: selectedContainer
16173
+ },
16174
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, {
16175
+ value: "",
16176
+ disabled: true,
16177
+ children: t("dovetail.select_container")
16178
+ }), (((_e = pod.spec) == null ? void 0 : _e.containers) || []).map((container2) => /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, {
16179
+ value: container2.name,
16180
+ children: container2.name
16181
+ }, container2.name))]
16182
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.checkbox, {
16183
+ checked: wrap2,
16184
+ onChange: (e) => setWrap(e.target.checked),
16185
+ children: t("dovetail.wrap")
16186
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
16187
+ onClick: () => setPaused((prev) => !prev),
16188
+ prefixIcon: paused ? /* @__PURE__ */ jsxRuntime.exports.jsx(iconsReact.Resume24Icon, {}) : /* @__PURE__ */ jsxRuntime.exports.jsx(iconsReact.SuspendedPause24GradientOrangeIcon, {}),
16189
+ children: paused ? t("dovetail.resume_log") : t("dovetail.suspend")
16190
+ })]
16191
+ }), /* @__PURE__ */ jsxRuntime.exports.jsx(LogViewer, {
16192
+ innerRef: logViewerRef,
16193
+ hasLineNumbers: true,
16194
+ height: 300,
16195
+ data: logs,
16196
+ theme: "light",
16197
+ isTextWrapped: wrap2,
16198
+ footer: paused && /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.button, {
16199
+ type: "primary",
16200
+ style: {
16201
+ borderRadius: 0
16202
+ },
16203
+ onClick: () => setPaused(false),
16204
+ children: [t("dovetail.resume_log"), linesBehind === 0 ? null : t("dovetail.log_new_lines", {
16205
+ count: linesBehind
16206
+ })]
16207
+ }),
16208
+ onScroll
16209
+ })]
16210
+ });
16211
+ };
16212
+ function getSecondsDiff(startDate, endDate) {
16213
+ return Math.round(Math.abs(Date.parse(endDate) - Date.parse(startDate)) / 1e3);
16214
+ }
16215
+ function elapsedTime(seconds) {
16216
+ if (!seconds) {
16217
+ return {};
16218
+ }
16219
+ if (seconds < 120) {
16220
+ return {
16221
+ diff: 1,
16222
+ label: `${seconds}s`
16223
+ };
16224
+ }
16225
+ const minutes = Math.floor(seconds / 60);
16226
+ if (minutes < 10) {
16227
+ return {
16228
+ diff: 1,
16229
+ label: `${minutes}m${seconds - minutes * 60}s`
16230
+ };
16231
+ }
16232
+ const hours = Math.floor(seconds / 3600);
16233
+ if (hours < 3) {
16234
+ return {
16235
+ diff: 60,
16236
+ label: `${minutes}m`
16237
+ };
16238
+ }
16239
+ const days = Math.floor(seconds / (3600 * 24));
16240
+ if (days > 1) {
16241
+ return {
16242
+ diff: 60,
16243
+ label: `${days}d${hours - days * 24}h`
16244
+ };
16245
+ }
16246
+ if (hours > 7) {
16247
+ return {
16248
+ diff: 60,
16249
+ label: `${hours}h`
16250
+ };
16251
+ }
16252
+ return {
16253
+ diff: 60,
16254
+ label: `${hours}h${minutes - hours * 60}m`
16255
+ };
16256
+ }
16257
+ function shortenedImage(image2) {
16258
+ return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2\u2026");
16259
+ }
16260
+ class ResourceModel {
16261
+ constructor(_rawYaml, _globalStore) {
16262
+ __publicField(this, "id");
16263
+ __publicField(this, "apiVersion");
16264
+ __publicField(this, "kind");
16265
+ __publicField(this, "metadata");
16266
+ this._rawYaml = _rawYaml;
16267
+ this._globalStore = _globalStore;
16268
+ Object.keys(_rawYaml).forEach((key) => {
16269
+ Object.defineProperty(this, key, {
16270
+ value: _rawYaml[key]
16271
+ });
16272
+ });
16273
+ }
16274
+ async init() {
16275
+ }
16276
+ get name() {
16277
+ var _a;
16278
+ return (_a = this._rawYaml.metadata) == null ? void 0 : _a.name;
16279
+ }
16280
+ get namespace() {
16281
+ var _a;
16282
+ return (_a = this._rawYaml.metadata) == null ? void 0 : _a.namespace;
16283
+ }
16284
+ get labels() {
16285
+ var _a;
16286
+ return (_a = this._rawYaml.metadata) == null ? void 0 : _a.labels;
16287
+ }
16288
+ get annotations() {
16289
+ var _a;
16290
+ return (_a = this._rawYaml.metadata) == null ? void 0 : _a.annotations;
16291
+ }
16292
+ restore() {
16293
+ return this._rawYaml;
16294
+ }
16295
+ }
16296
+ class WorkloadBaseModel extends ResourceModel {
16297
+ constructor(_rawYaml, _globalStore) {
16298
+ super(_rawYaml, _globalStore);
16299
+ this._rawYaml = _rawYaml;
16300
+ this._globalStore = _globalStore;
16301
+ }
16302
+ get imageNames() {
16303
+ var _a, _b, _c, _d;
16304
+ const containers = this._rawYaml.spec && "jobTemplate" in this._rawYaml.spec ? (_b = (_a = this._rawYaml.spec.jobTemplate.spec) == null ? void 0 : _a.template.spec) == null ? void 0 : _b.containers : this._rawYaml.spec && "template" in this._rawYaml.spec ? (_d = (_c = this._rawYaml.spec) == null ? void 0 : _c.template.spec) == null ? void 0 : _d.containers : [];
16305
+ return (containers == null ? void 0 : containers.map((container2) => shortenedImage(container2.image || ""))) || [];
16306
+ }
16307
+ }
16308
+ class JobModel extends WorkloadBaseModel {
16309
+ constructor(_rawYaml, _globalStore) {
16310
+ super(_rawYaml, _globalStore);
16311
+ this._rawYaml = _rawYaml;
16312
+ this._globalStore = _globalStore;
16313
+ }
16314
+ get duration() {
16315
+ var _a, _b;
16316
+ const completionTime = (_a = this._rawYaml.status) == null ? void 0 : _a.completionTime;
16317
+ const startTime = (_b = this._rawYaml.status) == null ? void 0 : _b.startTime;
16318
+ if (!completionTime && startTime) {
16319
+ return getSecondsDiff(startTime, Date.now().toString());
16320
+ }
16321
+ if (completionTime && startTime) {
16322
+ return getSecondsDiff(startTime, completionTime);
16323
+ }
16324
+ return 0;
16325
+ }
16326
+ get durationDisplay() {
16327
+ return elapsedTime(this.duration).label;
16328
+ }
16329
+ get completionsDisplay() {
16330
+ var _a, _b;
16331
+ return `${((_a = this._rawYaml.status) == null ? void 0 : _a.succeeded) || 0}/${(_b = this._rawYaml.spec) == null ? void 0 : _b.completions}`;
16332
+ }
16333
+ }
16334
+ function matchSelector(pod, selector) {
16335
+ var _a, _b, _c;
16336
+ let match = true;
16337
+ for (const key in selector.matchLabels) {
16338
+ if (!((_b = (_a = pod.metadata) == null ? void 0 : _a.labels) == null ? void 0 : _b[key]) || ((_c = pod.metadata.labels) == null ? void 0 : _c[key]) !== selector.matchLabels[key]) {
16339
+ match = false;
16340
+ }
16341
+ }
16342
+ return match;
16343
+ }
16344
+ class WorkloadModel extends WorkloadBaseModel {
16345
+ constructor(_rawYaml, _globalStore) {
16346
+ super(_rawYaml, _globalStore);
16347
+ __publicField(this, "restarts", 0);
16348
+ this._rawYaml = _rawYaml;
16349
+ this._globalStore = _globalStore;
16350
+ }
16351
+ async init() {
16352
+ await this.getRestarts();
16353
+ }
16354
+ async getRestarts() {
16355
+ const pods = await this._globalStore.get("pods", {
16356
+ resourceBasePath: "/api/v1",
16357
+ kind: "Pod"
16358
+ });
16359
+ const myPods = pods.items.filter(
16360
+ (p) => {
16361
+ var _a, _b;
16362
+ return ((_a = this.spec) == null ? void 0 : _a.selector) ? matchSelector(p, (_b = this.spec) == null ? void 0 : _b.selector) : false;
16363
+ }
16364
+ );
16365
+ const result = lodash.exports.sumBy(myPods, "restartCount");
16366
+ this.restarts = result;
16367
+ }
16368
+ redeploy() {
16369
+ const rawYaml = this._globalStore.restoreItem(this);
16370
+ const newOne = lodash.exports.cloneDeep(rawYaml);
16371
+ const path = "spec.template.metadata.annotations";
16372
+ const annotations = lodash.exports.get(newOne, path, {});
16373
+ lodash.exports.set(newOne, path, {
16374
+ ...annotations,
16375
+ [TIMESTAMP_LABEL]: new Date().toISOString().replace(/\.\d+Z$/, "Z")
16376
+ });
16377
+ return newOne;
16378
+ }
16379
+ scale(value) {
16380
+ const rawYaml = this._globalStore.restoreItem(this);
16381
+ const newOne = lodash.exports.cloneDeep(rawYaml);
16382
+ if (newOne.kind === "Deployment" || newOne.kind === "StatefulSet") {
16383
+ lodash.exports.set(newOne, "spec.replicas", value);
16384
+ }
16385
+ return newOne;
16386
+ }
16387
+ }
16388
+ class PodModel extends WorkloadBaseModel {
16389
+ constructor(_rawYaml, _globalStore) {
16390
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
16391
+ super(_rawYaml, _globalStore);
16392
+ __publicField(this, "request");
16393
+ __publicField(this, "limit");
16394
+ this._rawYaml = _rawYaml;
16395
+ this._globalStore = _globalStore;
16396
+ let cpuRequestNum = 0;
16397
+ let memoryRequestNum = 0;
16398
+ let cpuLimitNum = 0;
16399
+ let memoryLimitNum = 0;
16400
+ for (const container2 of ((_a = _rawYaml.spec) == null ? void 0 : _a.containers) || []) {
16401
+ cpuRequestNum += parseSi(((_c = (_b = container2.resources) == null ? void 0 : _b.requests) == null ? void 0 : _c.cpu) || "0");
16402
+ memoryRequestNum += parseSi(((_e = (_d = container2.resources) == null ? void 0 : _d.requests) == null ? void 0 : _e.memory) || "0");
16403
+ cpuLimitNum += parseSi(((_g = (_f = container2.resources) == null ? void 0 : _f.limits) == null ? void 0 : _g.cpu) || "0");
16404
+ memoryLimitNum += parseSi(((_i = (_h = container2.resources) == null ? void 0 : _h.limits) == null ? void 0 : _i.memory) || "0");
16405
+ }
16406
+ this.request = {
16407
+ cpu: {
16408
+ value: cpuRequestNum,
16409
+ si: formatSi(cpuRequestNum, {
16410
+ suffix: "m"
16411
+ })
16412
+ },
16413
+ memory: {
16414
+ value: memoryRequestNum,
16415
+ si: formatSi(memoryRequestNum, {
16416
+ suffix: "i"
16417
+ })
16418
+ }
16419
+ };
16420
+ this.limit = {
16421
+ cpu: {
16422
+ value: cpuLimitNum,
16423
+ si: formatSi(cpuLimitNum, {
16424
+ suffix: "m"
16425
+ })
16426
+ },
16427
+ memory: {
16428
+ value: memoryLimitNum,
16429
+ si: formatSi(memoryLimitNum, {
16430
+ suffix: "i"
16431
+ })
16432
+ }
16433
+ };
16434
+ }
16435
+ get imageNames() {
16436
+ var _a;
16437
+ return ((_a = this._rawYaml.spec) == null ? void 0 : _a.containers.map(
16438
+ (container2) => shortenedImage(container2.image || "")
16439
+ )) || [];
16440
+ }
16441
+ get restartCount() {
16442
+ var _a, _b;
16443
+ if ((_a = this._rawYaml.status) == null ? void 0 : _a.containerStatuses) {
16444
+ return ((_b = this._rawYaml.status) == null ? void 0 : _b.containerStatuses[0].restartCount) || 0;
16445
+ }
16446
+ return 0;
16447
+ }
16448
+ get readyDisplay() {
16449
+ var _a, _b, _c;
16450
+ return `${(_b = (_a = this._rawYaml.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.filter((c) => c.ready).length}/${(_c = this._rawYaml.spec) == null ? void 0 : _c.containers.length}`;
16451
+ }
16452
+ get readyContainerCount() {
16453
+ var _a, _b;
16454
+ return (_b = (_a = this._rawYaml.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.filter((c) => c.ready).length;
16455
+ }
16456
+ get containerCount() {
16457
+ var _a;
16458
+ return (_a = this._rawYaml.spec) == null ? void 0 : _a.containers.length;
16459
+ }
16460
+ }
16461
+ class PodMetricsModel extends ResourceModel {
16462
+ constructor(_rawYaml, _globalStore) {
16463
+ super(_rawYaml, _globalStore);
16464
+ __publicField(this, "usage");
16465
+ this._rawYaml = _rawYaml;
16466
+ this._globalStore = _globalStore;
16467
+ let cpuUsageNum = 0;
16468
+ let memoryUsageNum = 0;
16469
+ for (const container2 of _rawYaml.containers) {
16470
+ cpuUsageNum += parseSi(container2.usage.cpu || "0");
16471
+ memoryUsageNum += parseSi(container2.usage.memory || "0");
16472
+ }
16473
+ this.usage = {
16474
+ cpu: {
16475
+ value: cpuUsageNum,
16476
+ si: formatSi(1e3 * cpuUsageNum, {
16477
+ suffix: "m",
16478
+ maxPrecision: 0
16479
+ })
16480
+ },
16481
+ memory: {
16482
+ value: memoryUsageNum,
16483
+ si: formatSi(memoryUsageNum, {
16484
+ suffix: "i",
16485
+ maxPrecision: 0
16486
+ })
16487
+ }
16488
+ };
16489
+ }
16490
+ }
16491
+ class CronJobModel extends WorkloadBaseModel {
16492
+ constructor(_rawYaml, _globalStore) {
16493
+ super(_rawYaml, _globalStore);
16494
+ this._rawYaml = _rawYaml;
16495
+ this._globalStore = _globalStore;
16496
+ }
16497
+ suspend() {
16498
+ const newOne = lodash.exports.cloneDeep(this._rawYaml);
16499
+ if (this._rawYaml.kind === "CronJob") {
16500
+ lodash.exports.set(newOne, "spec.suspend", true);
16501
+ }
16502
+ return newOne;
16503
+ }
16504
+ resume() {
16505
+ const newOne = lodash.exports.cloneDeep(this._rawYaml);
16506
+ if (this._rawYaml.kind === "CronJob") {
16507
+ lodash.exports.set(newOne, "spec.suspend", false);
16508
+ }
16509
+ return newOne;
16510
+ }
16511
+ }
16512
+ class EventModel extends ResourceModel {
16513
+ constructor(_rawYaml, _globalStore) {
16514
+ super(_rawYaml, _globalStore);
16515
+ this._rawYaml = _rawYaml;
16516
+ this._globalStore = _globalStore;
16517
+ this.id = _rawYaml.metadata.uid || _rawYaml.id;
16518
+ }
16519
+ }
16520
+ const ModelMap = {
16521
+ Deployment: WorkloadModel,
16522
+ DaemonSet: WorkloadModel,
16523
+ StatefulSet: WorkloadModel,
16524
+ CronJob: CronJobModel,
16525
+ Job: JobModel,
16526
+ Pod: PodModel,
16527
+ Event: EventModel
16528
+ };
16529
+ class ModelPlugin {
16530
+ constructor() {
16531
+ __publicField(this, "_globalStore");
16532
+ }
16533
+ init(globalStore) {
16534
+ this._globalStore = globalStore;
16535
+ }
16536
+ async processData(res) {
16537
+ const { kind, apiVersion } = res;
16538
+ const items = await Promise.all(
16539
+ res.items.map((item) => {
16540
+ const newItem = { ...item };
16541
+ newItem.kind = kind.replace(/List$/g, "");
16542
+ newItem.apiVersion = apiVersion;
16543
+ return this.processItem(newItem);
16544
+ })
16545
+ );
16546
+ return {
16547
+ ...res,
16548
+ items
16549
+ };
16550
+ }
16551
+ async processItem(item) {
16552
+ const Model = ModelMap[item.kind] || ResourceModel;
16553
+ const result = new Model(item, this._globalStore);
16554
+ await result.init();
16555
+ return result;
16556
+ }
16557
+ restoreData(res) {
16558
+ ({ ...res });
16559
+ res.items.map((item) => this.restoreItem(item));
16560
+ return res;
16561
+ }
16562
+ restoreItem(item) {
16563
+ return item._rawYaml;
16564
+ }
16565
+ }
16566
+ const modelPlugin = new ModelPlugin();
16567
+ class RelationPlugin {
16568
+ constructor() {
16569
+ __publicField(this, "globalStore");
16570
+ }
16571
+ init(globalStore) {
16572
+ this.globalStore = globalStore;
16573
+ }
16574
+ async processData(res) {
16575
+ const { kind, apiVersion } = res;
16576
+ const items = await Promise.all(
16577
+ res.items.map(
16578
+ (item) => this.processItem({
16579
+ ...item,
16580
+ kind: kind.replace(/List$/g, ""),
16581
+ apiVersion
16582
+ })
16583
+ )
16584
+ );
16585
+ return {
16586
+ ...res,
16587
+ items
16588
+ };
16589
+ }
16590
+ async processItem(item) {
16591
+ this.processPodSelector(item);
16592
+ return item;
16593
+ }
16594
+ restoreData(res) {
16595
+ res.items = res.items.map((item) => this.restoreItem(item));
16596
+ return res;
16597
+ }
16598
+ restoreItem(item) {
16599
+ return {
16600
+ ...item,
16601
+ metadata: lodash.exports.omit(item.metadata, "relations")
16602
+ };
16603
+ }
16604
+ processPodSelector(item) {
16605
+ const { spec, kind } = item;
16606
+ const selector = spec == null ? void 0 : spec.selector;
16607
+ if (!selector) {
16608
+ return item;
16609
+ }
16610
+ if (!kind || ![
16611
+ "Deployment",
16612
+ "DaemonSet",
16613
+ "StatefulSet",
16614
+ "ReplicaSet",
16615
+ "Job",
16616
+ "Service"
16617
+ ].includes(kind)) {
16618
+ return item;
16619
+ }
16620
+ if (!selector.matchLabels && !selector.matchExpressions) {
16621
+ selector.matchLabels = {};
16622
+ for (const key of Object.keys(selector)) {
16623
+ if (key === "matchLabels") {
16624
+ continue;
16625
+ }
16626
+ selector.matchLabels[key] = selector[key];
16627
+ delete selector[key];
16628
+ }
16629
+ }
16630
+ this.appendRelation(item, {
16631
+ kind: "Pod",
16632
+ apiVersion: "v1",
16633
+ type: kind === "Service" ? "selects" : "creates",
16634
+ selector,
16635
+ inbound: false
16067
16636
  });
16068
- }, [follow, (_c = pod.metadata) == null ? void 0 : _c.namespace, (_d = pod.metadata) == null ? void 0 : _d.name, selectedContainer]);
16069
- const stopFetchingLogs = React.useCallback(() => {
16070
- if (abortControllerRef.current) {
16071
- abortControllerRef.current.abort();
16072
- abortControllerRef.current = null;
16637
+ return item;
16638
+ }
16639
+ appendRelation(item, relation) {
16640
+ const metadata = item.metadata;
16641
+ if (!metadata.relations) {
16642
+ metadata.relations = [];
16073
16643
  }
16074
- }, []);
16075
- React.useEffect(() => {
16076
- fetchLogs();
16077
- return () => {
16078
- stopFetchingLogs();
16079
- };
16080
- }, [fetchLogs, stopFetchingLogs]);
16081
- return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
16082
- children: [/* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
16083
- className: ToolbarStyle,
16084
- children: [/* @__PURE__ */ jsxRuntime.exports.jsxs(kit.select, {
16085
- input: {
16086
- onChange: (newValue) => {
16087
- stopFetchingLogs();
16088
- setSelectedContainer(newValue);
16089
- setLogs([]);
16090
- setPaused(false);
16091
- setLinesBehind(0);
16092
- },
16093
- value: selectedContainer
16094
- },
16095
- children: [/* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, {
16096
- value: "",
16097
- disabled: true,
16098
- children: t("select_container")
16099
- }), (((_e = pod.spec) == null ? void 0 : _e.containers) || []).map((container2) => /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, {
16100
- value: container2.name,
16101
- children: container2.name
16102
- }, container2.name))]
16103
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.checkbox, {
16104
- checked: wrap2,
16105
- onChange: (e) => setWrap(e.target.checked),
16106
- children: t("wrap")
16107
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
16108
- onClick: () => setPaused((prev) => !prev),
16109
- prefixIcon: paused ? /* @__PURE__ */ jsxRuntime.exports.jsx(iconsReact.Resume24Icon, {}) : /* @__PURE__ */ jsxRuntime.exports.jsx(iconsReact.SuspendedPause24GradientOrangeIcon, {}),
16110
- children: paused ? t("resume_log") : t("suspend")
16111
- })]
16112
- }), /* @__PURE__ */ jsxRuntime.exports.jsx(LogViewer, {
16113
- innerRef: logViewerRef,
16114
- hasLineNumbers: true,
16115
- height: 300,
16116
- data: logs,
16117
- theme: "light",
16118
- isTextWrapped: wrap2,
16119
- footer: paused && /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.button, {
16120
- type: "primary",
16121
- style: {
16122
- borderRadius: 0
16123
- },
16124
- onClick: () => setPaused(false),
16125
- children: [t("resume_log"), linesBehind === 0 ? null : t("log_new_lines", {
16126
- count: linesBehind
16127
- })]
16128
- }),
16129
- onScroll
16130
- })]
16131
- });
16132
- };
16133
- const copy$1 = "Copy";
16134
- const reset_arguments$1 = "Reset";
16135
- const view_changes$1 = "Show Diff";
16136
- const back_to_edit$1 = "Edit";
16137
- const configure_file$1 = "Configuration";
16138
- const yaml_format_wrong$1 = "Configuration is in an invalid YAML format.";
16139
- const yaml_value_wrong$1 = "Configuration has invalid values.";
16140
- const edit_yaml$1 = "Edit YAML";
16141
- const copied$1 = "Copied";
16142
- const already_reset$1 = "Already reset";
16143
- const dovetail$1 = {
16144
- copy: copy$1,
16145
- reset_arguments: reset_arguments$1,
16146
- view_changes: view_changes$1,
16147
- back_to_edit: back_to_edit$1,
16148
- configure_file: configure_file$1,
16149
- yaml_format_wrong: yaml_format_wrong$1,
16150
- yaml_value_wrong: yaml_value_wrong$1,
16151
- edit_yaml: edit_yaml$1,
16152
- copied: copied$1,
16153
- already_reset: already_reset$1
16154
- };
16155
- const EN = {
16156
- dovetail: dovetail$1
16157
- };
16158
- const copy = "\u590D\u5236";
16159
- const reset_arguments = "\u91CD\u7F6E";
16160
- const view_changes = "\u67E5\u770B\u6539\u52A8";
16161
- const back_to_edit = "\u7F16\u8F91";
16162
- const configure_file = "\u914D\u7F6E\u5185\u5BB9";
16163
- const yaml_format_wrong = "\u914D\u7F6E\u5185\u5BB9\u4E0D\u662F\u6709\u6548\u7684 yaml \u683C\u5F0F\u3002";
16164
- const yaml_value_wrong = "\u914D\u7F6E\u5185\u5BB9\u4E2D\u5B58\u5728\u4E0D\u5408\u6CD5\u7684\u503C\u3002";
16165
- const edit_yaml = "\u7F16\u8F91 YAML";
16166
- const copied = "\u5DF2\u590D\u5236";
16167
- const already_reset = "\u5DF2\u91CD\u7F6E";
16168
- const cancel = "\u53D6\u6D88";
16169
- const create = "\u521B\u5EFA";
16170
- const confirm_delete_text = "\u786E\u5B9A\u8981\u5220\u9664 {{target}} \u5417\uFF1F";
16171
- const edit = "\u7F16\u8F91";
16172
- const namespace = "\u540D\u5B57\u7A7A\u95F4";
16173
- const name = "\u540D\u5B57";
16174
- const state = "\u72B6\u6001";
16175
- const status = "\u72B6\u6001";
16176
- const phase = "\u72B6\u6001";
16177
- const image = "\u955C\u50CF";
16178
- const replicas = "\u526F\u672C\u6570";
16179
- const created_time = "\u521B\u5EFA\u65F6\u95F4";
16180
- const label = "\u6807\u7B7E";
16181
- const annotation = "\u6CE8\u91CA";
16182
- const type = "\u7C7B\u578B";
16183
- const event = "\u4E8B\u4EF6";
16184
- const reason = "\u539F\u56E0";
16185
- const object = "\u5BF9\u8C61";
16186
- const note = "\u4E8B\u4EF6\u4FE1\u606F";
16187
- const condition = "Condition";
16188
- const download_yaml = "\u4E0B\u8F7D YAML";
16189
- const detail = "\u8BE6\u60C5";
16190
- const node_name = "\u4E3B\u673A\u540D\u79F0";
16191
- const restarts = "\u91CD\u542F\u6B21\u6570";
16192
- const updated_time = "\u66F4\u65B0\u65F6\u95F4";
16193
- const message = "\u6D88\u606F";
16194
- const save = "\u4FDD\u5B58";
16195
- const more = "\u66F4\u591A";
16196
- const workload = "\u5DE5\u4F5C\u8D1F\u8F7D";
16197
- const all_namespaces = "\u6240\u6709\u540D\u5B57\u7A7A\u95F4";
16198
- const empty = "\u65E0\u53EF\u663E\u793A\u7684\u6570\u636E";
16199
- const schedule = "\u8C03\u5EA6";
16200
- const lastScheduleTime = "\u4E0A\u6B21\u8C03\u5EA6";
16201
- const duration = "\u6301\u7EED\u65F6\u95F4";
16202
- const completions = "\u5B8C\u6210 Job \u5386\u53F2\u6570";
16203
- const started = "\u5F00\u59CB\u65F6\u95F4";
16204
- const ready = "\u5C31\u7EEA";
16205
- const init_container = "\u521D\u59CB\u5316\u5BB9\u5668";
16206
- const container = "\u5BB9\u5668";
16207
- const redeploy = "\u91CD\u65B0\u90E8\u7F72";
16208
- const data = "\u6570\u636E";
16209
- const suspend = "\u6682\u505C";
16210
- const resume = "\u91CD\u65B0\u5F00\u59CB";
16211
- const cluster = "\u96C6\u7FA4";
16212
- const storage = "\u5B58\u50A8";
16213
- const network = "\u7F51\u7EDC";
16214
- const clusterIp = "\u96C6\u7FA4 IP";
16215
- const sessionAffinity = "\u4F1A\u8BDD\u4FDD\u6301";
16216
- const log = "\u65E5\u5FD7";
16217
- const select_container = "\u9009\u62E9\u5BB9\u5668";
16218
- const wrap = "\u6298\u53E0";
16219
- const resume_log = "\u7EE7\u7EED";
16220
- const log_new_lines = "\uFF0C\u5E76\u5C55\u793A {{ count }} \u884C\u65B0\u65E5\u5FD7";
16221
- const dovetail = {
16222
- copy,
16223
- reset_arguments,
16224
- view_changes,
16225
- back_to_edit,
16226
- configure_file,
16227
- yaml_format_wrong,
16228
- yaml_value_wrong,
16229
- edit_yaml,
16230
- copied,
16231
- already_reset,
16232
- cancel,
16233
- "delete": "\u5220\u9664",
16234
- create,
16235
- confirm_delete_text,
16236
- edit,
16237
- namespace,
16238
- name,
16239
- state,
16240
- status,
16241
- phase,
16242
- image,
16243
- replicas,
16244
- created_time,
16245
- label,
16246
- annotation,
16247
- type,
16248
- event,
16249
- reason,
16250
- object,
16251
- note,
16252
- condition,
16253
- download_yaml,
16254
- detail,
16255
- node_name,
16256
- restarts,
16257
- updated_time,
16258
- message,
16259
- save,
16260
- more,
16261
- workload,
16262
- all_namespaces,
16263
- empty,
16264
- schedule,
16265
- lastScheduleTime,
16266
- duration,
16267
- completions,
16268
- started,
16269
- ready,
16270
- init_container,
16271
- container,
16272
- redeploy,
16273
- data,
16274
- suspend,
16275
- resume,
16276
- cluster,
16277
- storage,
16278
- network,
16279
- clusterIp,
16280
- sessionAffinity,
16281
- log,
16282
- select_container,
16283
- wrap,
16284
- resume_log,
16285
- log_new_lines
16286
- };
16287
- const ZH = {
16288
- dovetail
16289
- };
16290
- const resources = {
16291
- "en-US": EN,
16292
- "zh-CN": ZH
16293
- };
16294
- i18n__default.default.use(initReactI18next).init({
16295
- supportedLngs: ["en-US", "zh-CN"],
16296
- resources,
16297
- ns: Object.keys(resources["zh-CN"]),
16298
- defaultNS: "dovetail",
16299
- fallbackLng: ["en-US", "zh-CN"],
16300
- lng: "zh-CN",
16301
- nsSeparator: "."
16302
- });
16644
+ metadata.relations.push(relation);
16645
+ return item;
16646
+ }
16647
+ }
16648
+ const relationPlugin = new RelationPlugin();
16649
+ const ProviderPlugins = [relationPlugin, modelPlugin];
16303
16650
  const styles = "";
16304
- const antd = "";
16305
- const style = "";
16306
16651
  const Dovetail = (props) => {
16307
- const {
16308
- resourcesConfig,
16309
- urlPrefix = "",
16310
- useHashUrl,
16311
- Layout: Layout2,
16312
- history,
16313
- globalStoreParams
16314
- } = props;
16652
+ const { resourcesConfig, urlPrefix = "", Layout: Layout2, history, globalStoreParams } = props;
16315
16653
  const globalStore = React.useMemo(() => {
16316
- return new k8sApiProvider.GlobalStore(globalStoreParams);
16654
+ return new k8sApiProvider.GlobalStore(globalStoreParams, ProviderPlugins);
16317
16655
  }, [globalStoreParams]);
16318
16656
  const notCustomResources = React.useMemo(() => {
16319
16657
  return resourcesConfig.filter((c) => !c.isCustom);
@@ -16328,7 +16666,7 @@ var __publicField = (obj, key, value) => {
16328
16666
  }
16329
16667
  return _content;
16330
16668
  }, [Layout2, notCustomResources, props.children, urlPrefix]);
16331
- return /* @__PURE__ */ jsxRuntime.exports.jsx(reactRouterDom.Router, { history, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
16669
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(reactRouterDom.Router, { history, children: /* @__PURE__ */ jsxRuntime.exports.jsx(GlobalStoreContext.Provider, { value: { globalStore }, children: /* @__PURE__ */ jsxRuntime.exports.jsx(
16332
16670
  core.Refine,
16333
16671
  {
16334
16672
  dataProvider: {
@@ -16357,7 +16695,7 @@ var __publicField = (obj, key, value) => {
16357
16695
  }),
16358
16696
  children: content
16359
16697
  }
16360
- ) });
16698
+ ) }) });
16361
16699
  };
16362
16700
  var RESOURCE_GROUP = /* @__PURE__ */ ((RESOURCE_GROUP2) => {
16363
16701
  RESOURCE_GROUP2["WORKLOAD"] = "WORKLOAD";
@@ -16415,6 +16753,7 @@ var __publicField = (obj, key, value) => {
16415
16753
  exports2.ColumnKeys = ColumnKeys;
16416
16754
  exports2.CommonSorter = CommonSorter;
16417
16755
  exports2.CompletionsCountColumnRenderer = CompletionsCountColumnRenderer;
16756
+ exports2.ComponentContext = ComponentContext;
16418
16757
  exports2.ConditionsField = ConditionsField;
16419
16758
  exports2.ConditionsTable = ConditionsTable;
16420
16759
  exports2.CreateButton = CreateButton;
@@ -16430,6 +16769,7 @@ var __publicField = (obj, key, value) => {
16430
16769
  exports2.DrawerShow = DrawerShow;
16431
16770
  exports2.DurationColumnRenderer = DurationColumnRenderer;
16432
16771
  exports2.EditButton = EditButton;
16772
+ exports2.EventModel = EventModel;
16433
16773
  exports2.ImageField = ImageField;
16434
16774
  exports2.ImageNames = ImageNames;
16435
16775
  exports2.JOB_INIT_VALUE = JOB_INIT_VALUE;
@@ -16466,7 +16806,9 @@ var __publicField = (obj, key, value) => {
16466
16806
  exports2.ResourceShow = ResourceShow;
16467
16807
  exports2.ResourceUsageBar = ResourceUsageBar;
16468
16808
  exports2.RestartCountColumnRenderer = RestartCountColumnRenderer;
16809
+ exports2.SERVICE_INIT_VALUE = SERVICE_INIT_VALUE;
16469
16810
  exports2.STATEFULSET_INIT_VALUE = STATEFULSET_INIT_VALUE;
16811
+ exports2.SchemaStrategy = SchemaStrategy;
16470
16812
  exports2.SecretDataField = SecretDataField;
16471
16813
  exports2.Separator = Separator;
16472
16814
  exports2.ServicePodsField = ServicePodsField;
@@ -16478,11 +16820,13 @@ var __publicField = (obj, key, value) => {
16478
16820
  exports2.StateTag = StateTag;
16479
16821
  exports2.TIMESTAMP_LABEL = TIMESTAMP_LABEL;
16480
16822
  exports2.Tags = Tags;
16823
+ exports2.WorkloadBaseModel = WorkloadBaseModel;
16481
16824
  exports2.WorkloadDropdown = WorkloadDropdown;
16482
16825
  exports2.WorkloadImageColumnRenderer = WorkloadImageColumnRenderer;
16483
16826
  exports2.WorkloadModel = WorkloadModel;
16484
16827
  exports2.WorkloadPodsTable = WorkloadPodsTable;
16485
16828
  exports2.WorkloadReplicas = WorkloadReplicas;
16829
+ exports2.WorkloadRestartsColumnRenderer = WorkloadRestartsColumnRenderer;
16486
16830
  exports2.YamlEditorComponent = YamlEditorComponent;
16487
16831
  exports2.dnsSubDomainRules = dnsSubDomainRules;
16488
16832
  exports2.namespaceRules = namespaceRules;
@@ -16493,6 +16837,7 @@ var __publicField = (obj, key, value) => {
16493
16837
  exports2.useDownloadYAML = useDownloadYAML;
16494
16838
  exports2.useEagleTable = useEagleTable;
16495
16839
  exports2.useEdit = useEdit;
16840
+ exports2.useGlobalStore = useGlobalStore;
16496
16841
  exports2.useNamespacesFilter = useNamespacesFilter;
16497
16842
  exports2.useSchema = useSchema;
16498
16843
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });