@dovetail-v2/refine 0.4.3 → 0.4.4

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 (33) hide show
  1. package/dist/{PodShell-43c7028e.cjs → PodShell-a335b2b2.cjs} +4 -2
  2. package/dist/{PodShell-76331418.js → PodShell-a6ed3498.js} +4 -2
  3. package/dist/components/CopyButton/index.d.ts +7 -0
  4. package/dist/components/FormWidgets/NameInputWidget.d.ts +0 -48
  5. package/dist/components/ServiceComponents/index.d.ts +10 -0
  6. package/dist/components/Shell/ShellToolbar.d.ts +1 -1
  7. package/dist/components/ShowContent/fields.d.ts +4 -0
  8. package/dist/components/index.d.ts +2 -3
  9. package/dist/contexts/component.d.ts +14 -5
  10. package/dist/contexts/index.d.ts +1 -0
  11. package/dist/hooks/useDeleteModal/index.d.ts +1 -0
  12. package/dist/hooks/useEagleTable/columns.d.ts +5 -4
  13. package/dist/hooks/useSubmitForm.d.ts +1 -1
  14. package/dist/hooks/useTableData.d.ts +1 -1
  15. package/dist/i18n.d.ts +25 -0
  16. package/dist/{index-31874f77.cjs → index-053ee180.cjs} +1 -1
  17. package/dist/{index-ab97826a.js → index-d7bc2ee6.js} +1 -1
  18. package/dist/index.d.ts +0 -1
  19. package/dist/locales/en-US/index.d.ts +12 -0
  20. package/dist/locales/zh-CN/index.d.ts +13 -0
  21. package/dist/models/daemonset-model.d.ts +0 -3
  22. package/dist/models/statefulset-model.d.ts +0 -3
  23. package/dist/models/workload-base-model.d.ts +3 -0
  24. package/dist/models/workload-model.d.ts +3 -0
  25. package/dist/pages/deployments/form/index.d.ts +2 -1
  26. package/dist/plugins/model-plugin.d.ts +1 -1
  27. package/dist/refine.cjs +1220 -1083
  28. package/dist/refine.js +1223 -1086
  29. package/dist/shell.cjs +1 -1
  30. package/dist/shell.js +1 -1
  31. package/dist/style.css +133 -4
  32. package/dist/types/resource.d.ts +9 -9
  33. package/package.json +17 -6
package/dist/refine.cjs CHANGED
@@ -20,6 +20,7 @@ const yaml$2 = require("js-yaml");
20
20
  const sunflowerAntd = require("sunflower-antd");
21
21
  const usehooksTs = require("usehooks-ts");
22
22
  const k8sApiProvider = require("k8s-api-provider");
23
+ const copyToClipboard$1 = require("copy-to-clipboard");
23
24
  const reactLogViewer = require("@patternfly/react-log-viewer");
24
25
  const reactHookForm = require("react-hook-form");
25
26
  const monaco = require("monaco-editor");
@@ -456,6 +457,18 @@ function Trans(_ref) {
456
457
  ...additionalProps
457
458
  });
458
459
  }
460
+ const add_container$1 = "Add container";
461
+ const container_index$1 = "Container {{index}}";
462
+ const container_name$1 = "Container name";
463
+ const container_image$1 = "Container image";
464
+ const advanced_settings$1 = "Advanced settings";
465
+ const app$1 = {
466
+ add_container: add_container$1,
467
+ container_index: container_index$1,
468
+ container_name: container_name$1,
469
+ container_image: container_image$1,
470
+ advanced_settings: advanced_settings$1
471
+ };
459
472
  const copy$1 = "Copy";
460
473
  const reset_arguments$1 = "Reset";
461
474
  const view_changes$1 = "Show diff";
@@ -623,7 +636,7 @@ const available_state$1 = "Available";
623
636
  const bound_state$1 = "Bound";
624
637
  const released_state$1 = "Released";
625
638
  const failed_state$1 = "Failed";
626
- const exec_pod = "Execute shell";
639
+ const exec_pod$1 = "Execute shell";
627
640
  const search$1 = "Search";
628
641
  const edit_label$1 = "Edit label";
629
642
  const csi$1 = "CSI driver";
@@ -736,6 +749,11 @@ const pause_scheduling$1 = "Suspend scheduling";
736
749
  const port_name$1 = "Port name";
737
750
  const target_port_range_limit$1 = "Only integers between 1 and 65535, or strings, are supported.";
738
751
  const service_port_name_tip$1 = "When the port count is 1, this field is optional; when it is greater than 1, this field is mandatory.";
752
+ const network_error$1 = "Network error";
753
+ const retry_when_access_data_failed$1 = "Failed to load data. Click to retry.";
754
+ const service$1 = "Service";
755
+ const ingress$1 = "Ingress";
756
+ const fstype$1 = "Filesystem type";
739
757
  const dovetail$1 = {
740
758
  copy: copy$1,
741
759
  reset_arguments: reset_arguments$1,
@@ -907,7 +925,7 @@ const dovetail$1 = {
907
925
  bound_state: bound_state$1,
908
926
  released_state: released_state$1,
909
927
  failed_state: failed_state$1,
910
- exec_pod,
928
+ exec_pod: exec_pod$1,
911
929
  search: search$1,
912
930
  edit_label: edit_label$1,
913
931
  csi: csi$1,
@@ -1019,11 +1037,29 @@ const dovetail$1 = {
1019
1037
  pause_scheduling: pause_scheduling$1,
1020
1038
  port_name: port_name$1,
1021
1039
  target_port_range_limit: target_port_range_limit$1,
1022
- service_port_name_tip: service_port_name_tip$1
1040
+ service_port_name_tip: service_port_name_tip$1,
1041
+ network_error: network_error$1,
1042
+ retry_when_access_data_failed: retry_when_access_data_failed$1,
1043
+ service: service$1,
1044
+ ingress: ingress$1,
1045
+ fstype: fstype$1
1023
1046
  };
1024
1047
  const EN = {
1048
+ app: app$1,
1025
1049
  dovetail: dovetail$1
1026
1050
  };
1051
+ const add_container = "添加容器";
1052
+ const container_index = "容器 {{index}}";
1053
+ const container_name = "容器名称";
1054
+ const container_image = "容器镜像";
1055
+ const advanced_settings = "高级设置";
1056
+ const app = {
1057
+ add_container,
1058
+ container_index,
1059
+ container_name,
1060
+ container_image,
1061
+ advanced_settings
1062
+ };
1027
1063
  const copy = "复制";
1028
1064
  const reset_arguments = "重置";
1029
1065
  const view_changes = "查看改动";
@@ -1303,6 +1339,12 @@ const no_labels = "无标签";
1303
1339
  const no_annotations = "无注解";
1304
1340
  const pause_scheduling = "暂停调度";
1305
1341
  const service_port_name_tip = "端口数量为 1 时,名称为选填项;大于 1 时,名称为必填项。";
1342
+ const exec_pod = "执行 Shell";
1343
+ const network_error = "网络错误";
1344
+ const retry_when_access_data_failed = "数据加载失败,点击重试。";
1345
+ const service = "服务";
1346
+ const ingress = "Ingress";
1347
+ const fstype = "文件系统类型";
1306
1348
  const dovetail = {
1307
1349
  copy,
1308
1350
  reset_arguments,
@@ -1585,9 +1627,16 @@ const dovetail = {
1585
1627
  no_labels,
1586
1628
  no_annotations,
1587
1629
  pause_scheduling,
1588
- service_port_name_tip
1630
+ service_port_name_tip,
1631
+ exec_pod,
1632
+ network_error,
1633
+ retry_when_access_data_failed,
1634
+ service,
1635
+ ingress,
1636
+ fstype
1589
1637
  };
1590
1638
  const ZH = {
1639
+ app,
1591
1640
  dovetail
1592
1641
  };
1593
1642
  const resources = {
@@ -7319,9 +7368,7 @@ class K8sOpenAPI {
7319
7368
  return this.schemas;
7320
7369
  }
7321
7370
  try {
7322
- const response = await fetch(
7323
- `${this.pathPrefix}${this.resourceBasePath}`
7324
- );
7371
+ const response = await fetch(`${this.pathPrefix}${this.resourceBasePath}`);
7325
7372
  const result = await response.json();
7326
7373
  this.schemas = Object.values(result.components.schemas);
7327
7374
  if (this.schemas) {
@@ -7393,33 +7440,42 @@ function useApiGroupSchema() {
7393
7440
  loading: false,
7394
7441
  error: null
7395
7442
  });
7396
- const fetchSchema = React.useCallback(async (apiGroups, schemaUrlPrefix) => {
7397
- setState((prev) => ({ ...prev, loading: true, error: null }));
7398
- try {
7399
- const results = await Promise.all(
7400
- apiGroups.map(async (apiGroup) => {
7401
- if (state2.schemasMap[apiGroup]) {
7402
- return { apiGroup, schemas: state2.schemasMap[apiGroup] };
7403
- }
7404
- const groupSchemas = await schemaStore.fetchSchemas(apiGroup, schemaUrlPrefix);
7405
- return { apiGroup, schemas: groupSchemas || [] };
7406
- })
7407
- );
7408
- const newSchemasMap = results.reduce((acc, { apiGroup, schemas }) => {
7409
- acc[apiGroup] = schemas;
7410
- return acc;
7411
- }, {});
7412
- const allSchemas = results.flatMap(({ schemas }) => schemas);
7413
- setState({
7414
- schemas: allSchemas,
7415
- schemasMap: newSchemasMap,
7416
- loading: false,
7417
- error: null
7418
- });
7419
- } catch (e2) {
7420
- setState((prev) => ({ ...prev, loading: false, error: e2 }));
7421
- }
7422
- }, [state2.schemasMap]);
7443
+ const fetchSchema = React.useCallback(
7444
+ async (apiGroups, schemaUrlPrefix) => {
7445
+ setState((prev) => ({ ...prev, loading: true, error: null }));
7446
+ try {
7447
+ const results = await Promise.all(
7448
+ apiGroups.map(async (apiGroup) => {
7449
+ if (state2.schemasMap[apiGroup]) {
7450
+ return { apiGroup, schemas: state2.schemasMap[apiGroup] };
7451
+ }
7452
+ const groupSchemas = await schemaStore.fetchSchemas(
7453
+ apiGroup,
7454
+ schemaUrlPrefix
7455
+ );
7456
+ return { apiGroup, schemas: groupSchemas || [] };
7457
+ })
7458
+ );
7459
+ const newSchemasMap = results.reduce(
7460
+ (acc, { apiGroup, schemas }) => {
7461
+ acc[apiGroup] = schemas;
7462
+ return acc;
7463
+ },
7464
+ {}
7465
+ );
7466
+ const allSchemas = results.flatMap(({ schemas }) => schemas);
7467
+ setState({
7468
+ schemas: allSchemas,
7469
+ schemasMap: newSchemasMap,
7470
+ loading: false,
7471
+ error: null
7472
+ });
7473
+ } catch (e2) {
7474
+ setState((prev) => ({ ...prev, loading: false, error: e2 }));
7475
+ }
7476
+ },
7477
+ [state2.schemasMap]
7478
+ );
7423
7479
  return { ...state2, fetchSchema };
7424
7480
  }
7425
7481
  function useSchema(options) {
@@ -7435,7 +7491,11 @@ function useSchema(options) {
7435
7491
  setLoading(true);
7436
7492
  setError(null);
7437
7493
  try {
7438
- const schema2 = await schemaStore.fetchSchema((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath, schemaUrlPrefix, (_b2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _b2.kind);
7494
+ const schema2 = await schemaStore.fetchSchema(
7495
+ (_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath,
7496
+ schemaUrlPrefix,
7497
+ (_b2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _b2.kind
7498
+ );
7439
7499
  setSchema(schema2 || null);
7440
7500
  setError(null);
7441
7501
  } catch (e2) {
@@ -7456,6 +7516,34 @@ function useSchema(options) {
7456
7516
  fetchSchema
7457
7517
  };
7458
7518
  }
7519
+ const useDeleteManyModal = (resource, ids) => {
7520
+ const { mutate } = core.useDeleteMany();
7521
+ const [visible, setVisible] = React.useState(false);
7522
+ const { t: t2 } = common.useTranslation();
7523
+ const modalProps = {
7524
+ title: t2("dovetail.delete"),
7525
+ okText: t2("dovetail.delete"),
7526
+ okButtonProps: {
7527
+ danger: true
7528
+ },
7529
+ cancelText: t2("dovetail.cancel"),
7530
+ children: t2("dovetail.confirm_delete_text", {
7531
+ target: ids,
7532
+ interpolation: { escapeValue: false }
7533
+ }),
7534
+ onOk() {
7535
+ mutate({
7536
+ resource,
7537
+ ids
7538
+ });
7539
+ setVisible(false);
7540
+ },
7541
+ onCancel() {
7542
+ setVisible(false);
7543
+ }
7544
+ };
7545
+ return { modalProps, visible, setVisible };
7546
+ };
7459
7547
  const ConfigsContext = React.createContext({});
7460
7548
  function getCommonErrors(responseBody, i18n2) {
7461
7549
  var _a;
@@ -7499,12 +7587,16 @@ function getCommonErrors(responseBody, i18n2) {
7499
7587
  }
7500
7588
  return [
7501
7589
  i18n2.t(
7502
- [`error.${responseBody.code}`, `error.${responseBody.reason}`, responseBody.message || ""],
7590
+ [
7591
+ `error.${responseBody.code}`,
7592
+ `error.${responseBody.reason}`,
7593
+ responseBody.message || ""
7594
+ ],
7503
7595
  { fallbackLng: "" }
7504
7596
  )
7505
7597
  ];
7506
7598
  }
7507
- const tag_18x9v7m = "";
7599
+ const tag_19ts6m8 = "";
7508
7600
  const StateTagStyle = "s82411";
7509
7601
  const NameTagStyle = "n9ja9cs";
7510
7602
  function shortenedImage(image2) {
@@ -7904,48 +7996,6 @@ function NameInputWidget(props) {
7904
7996
  const { action } = core.useResource();
7905
7997
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Input, { ...props, disabled: action === "edit" });
7906
7998
  }
7907
- const dnsSubDomainRules = [
7908
- {
7909
- required: true,
7910
- message: "名称不能为空"
7911
- },
7912
- {
7913
- pattern: /^[a-z0-9]([-.a-z0-9]*[a-z0-9])?$/,
7914
- message: "名称只能包含小写字母、数字,以及 '-' 和 '.',且必须以字母或数字开头和结束"
7915
- },
7916
- {
7917
- max: 253,
7918
- message: "名称长度不能超过253个字符"
7919
- }
7920
- ];
7921
- const rfc1123LabelRules = [
7922
- {
7923
- required: true,
7924
- message: "名称不能为空"
7925
- },
7926
- {
7927
- pattern: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
7928
- message: "名称只能包含小写字母、数字,以及 '-',且以字母或数字开头和结束"
7929
- },
7930
- {
7931
- max: 63,
7932
- message: "名称长度不能超过63个字符"
7933
- }
7934
- ];
7935
- const rfc1035LabelRules = [
7936
- {
7937
- required: true,
7938
- message: "名称不能为空"
7939
- },
7940
- {
7941
- pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
7942
- message: "名称只能包含小写字母、数字,以及 '-',且以字母开头,字母或数字结束"
7943
- },
7944
- {
7945
- max: 63,
7946
- message: "名称长度不能超过63个字符"
7947
- }
7948
- ];
7949
7999
  function NamespaceSelectWidget(props) {
7950
8000
  const { action } = core.useResource();
7951
8001
  const { data: data2 } = core.useList({
@@ -8007,10 +8057,13 @@ function KeyValueListWidget(props) {
8007
8057
  const onChange = React.useCallback(
8008
8058
  (newItems) => {
8009
8059
  var _a;
8010
- const newValue = newItems.reduce((result, item) => {
8011
- result[item.key] = item.value;
8012
- return result;
8013
- }, {});
8060
+ const newValue = newItems.reduce(
8061
+ (result, item) => {
8062
+ result[item.key] = item.value;
8063
+ return result;
8064
+ },
8065
+ {}
8066
+ );
8014
8067
  (_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
8015
8068
  },
8016
8069
  [props]
@@ -8056,7 +8109,7 @@ function KeyValueListWidget(props) {
8056
8109
  }
8057
8110
  function MetadataForm() {
8058
8111
  return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
8059
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(NameInputWidget, {}) }),
8112
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Form.Item, { label: "Name", name: ["metadata", "name"], children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(NameInputWidget, {}) }),
8060
8113
  /* @__PURE__ */ common.jsxRuntimeExports.jsx(
8061
8114
  eagle.Form.Item,
8062
8115
  {
@@ -8071,6 +8124,12 @@ function MetadataForm() {
8071
8124
  ] });
8072
8125
  }
8073
8126
  const ComponentContext = React.createContext({});
8127
+ function ComponentContextProvider({
8128
+ value: value2,
8129
+ children
8130
+ }) {
8131
+ return React.createElement(ComponentContext.Provider, { value: value2 }, children);
8132
+ }
8074
8133
  const GlobalStoreContext = React.createContext({});
8075
8134
  const index_1s9fcl3 = "";
8076
8135
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
@@ -8234,21 +8293,31 @@ function Table$1(props) {
8234
8293
  })]
8235
8294
  });
8236
8295
  }
8237
- function useTableData({ data: data2, columns, pageSize = 10, defaultSorters }) {
8296
+ function useTableData({
8297
+ data: data2,
8298
+ columns,
8299
+ pageSize = 10,
8300
+ defaultSorters
8301
+ }) {
8238
8302
  const [currentPage, setCurrentPage] = React.useState(1);
8239
8303
  const [sorters, setSorters] = React.useState(defaultSorters || []);
8240
- const onSorterChange = React.useCallback((order, key2) => {
8241
- var _a;
8242
- const ORDER_MAP = {
8243
- descend: "desc",
8244
- ascend: "asc"
8245
- };
8246
- const sorters2 = [{
8247
- field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
8248
- order: order ? ORDER_MAP[order] : order
8249
- }];
8250
- setSorters(sorters2);
8251
- }, [columns]);
8304
+ const onSorterChange = React.useCallback(
8305
+ (order, key2) => {
8306
+ var _a;
8307
+ const ORDER_MAP = {
8308
+ descend: "desc",
8309
+ ascend: "asc"
8310
+ };
8311
+ const sorters2 = [
8312
+ {
8313
+ field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
8314
+ order: order ? ORDER_MAP[order] : order
8315
+ }
8316
+ ];
8317
+ setSorters(sorters2);
8318
+ },
8319
+ [columns]
8320
+ );
8252
8321
  return {
8253
8322
  data: k8sApiProvider.paginateData(
8254
8323
  {
@@ -8328,7 +8397,7 @@ const PodSelectorTable = ({ podSelectors = {} }) => {
8328
8397
  }
8329
8398
  );
8330
8399
  };
8331
- const PortsTable = ({ service }) => {
8400
+ const PortsTable = ({ service: service2 }) => {
8332
8401
  const { t: t2 } = common.useTranslation();
8333
8402
  const component = React.useContext(ComponentContext);
8334
8403
  const Table2 = component.Table || Table$1;
@@ -8375,7 +8444,7 @@ const PortsTable = ({ service }) => {
8375
8444
  width: 199
8376
8445
  }
8377
8446
  ];
8378
- const ports = (service._rawYaml.spec.ports || []).map((port2) => ({
8447
+ const ports = (service2._rawYaml.spec.ports || []).map((port2) => ({
8379
8448
  ...port2,
8380
8449
  id: port2.name || ""
8381
8450
  }));
@@ -8790,6 +8859,38 @@ function PVCDistributeStorage({
8790
8859
  )
8791
8860
  ] });
8792
8861
  }
8862
+ const index_1oorxg6 = "";
8863
+ const CopyIconStyle = "c1oll6q9";
8864
+ const CopyButton = ({
8865
+ value: value2,
8866
+ className
8867
+ }) => {
8868
+ const {
8869
+ i18n: i18n2
8870
+ } = common.useTranslation();
8871
+ const [tooltip, setTooltip] = React.useState(i18n2.t("dovetail.copy"));
8872
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tooltip, {
8873
+ title: tooltip,
8874
+ onVisibleChange: (visible) => {
8875
+ if (!visible) {
8876
+ setTimeout(() => {
8877
+ setTooltip(i18n2.t("dovetail.copy"));
8878
+ }, 80);
8879
+ }
8880
+ },
8881
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, {
8882
+ src: iconsReact.ClipboardCopy16GradientGrayIcon,
8883
+ hoverSrc: iconsReact.ClipboardCopy16GradientBlueIcon,
8884
+ className: common.cx_default(CopyIconStyle, className),
8885
+ iconWidth: 16,
8886
+ iconHeight: 16,
8887
+ onClick: () => {
8888
+ copyToClipboard$1(value2);
8889
+ setTooltip(i18n2.t("dovetail.copied"));
8890
+ }
8891
+ })
8892
+ });
8893
+ };
8793
8894
  class ResourceModel {
8794
8895
  constructor(_rawYaml, _globalStore) {
8795
8896
  __publicField(this, "id");
@@ -8907,74 +9008,70 @@ const BASE_INIT_VALUE = {
8907
9008
  }
8908
9009
  };
8909
9010
  const DEPLOYMENT_INIT_VALUE = {
8910
- "apiVersion": "apps/v1",
8911
- "kind": "Deployment",
8912
- "metadata": {
8913
- "name": "example",
8914
- "namespace": "default"
9011
+ apiVersion: "apps/v1",
9012
+ kind: "Deployment",
9013
+ metadata: {
9014
+ name: "example",
9015
+ namespace: "default"
8915
9016
  },
8916
- "spec": {
8917
- "selector": {
8918
- "matchLabels": {
8919
- "app": "deployment-example"
9017
+ spec: {
9018
+ selector: {
9019
+ matchLabels: {
9020
+ app: "deployment-example"
8920
9021
  }
8921
9022
  },
8922
- "replicas": 3,
8923
- "template": {
8924
- "metadata": {
8925
- "labels": {
8926
- "app": "deployment-example"
9023
+ replicas: 3,
9024
+ template: {
9025
+ metadata: {
9026
+ labels: {
9027
+ app: "deployment-example"
8927
9028
  }
8928
9029
  },
8929
- "spec": {
8930
- "containers": [
9030
+ spec: {
9031
+ containers: [
8931
9032
  {
8932
- "name": "deployment-example",
8933
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
8934
- "ports": [
9033
+ name: "deployment-example",
9034
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9035
+ ports: [
8935
9036
  {
8936
- "containerPort": 8080,
8937
- "protocol": "TCP"
9037
+ containerPort: 8080,
9038
+ protocol: "TCP"
8938
9039
  }
8939
9040
  ]
8940
9041
  }
8941
9042
  ]
8942
9043
  }
8943
9044
  },
8944
- "strategy": {
8945
- "type": "RollingUpdate",
8946
- "rollingUpdate": {
8947
- "maxSurge": "25%",
8948
- "maxUnavailable": "25%"
9045
+ strategy: {
9046
+ type: "RollingUpdate",
9047
+ rollingUpdate: {
9048
+ maxSurge: "25%",
9049
+ maxUnavailable: "25%"
8949
9050
  }
8950
9051
  }
8951
9052
  }
8952
9053
  };
8953
9054
  const CRONJOB_INIT_VALUE = {
8954
- "apiVersion": "batch/v1",
8955
- "kind": "CronJob",
8956
- "metadata": {
8957
- "name": "example",
8958
- "namespace": "default"
9055
+ apiVersion: "batch/v1",
9056
+ kind: "CronJob",
9057
+ metadata: {
9058
+ name: "example",
9059
+ namespace: "default"
8959
9060
  },
8960
- "spec": {
8961
- "schedule": "@daily",
8962
- "jobTemplate": {
8963
- "spec": {
8964
- "template": {
8965
- "spec": {
8966
- "containers": [
9061
+ spec: {
9062
+ schedule: "@daily",
9063
+ jobTemplate: {
9064
+ spec: {
9065
+ template: {
9066
+ spec: {
9067
+ containers: [
8967
9068
  {
8968
- "name": "example",
8969
- "image": "registry.smtx.io/kubesmart/alpine:3",
8970
- "args": [
8971
- "/bin/sh",
8972
- "-c",
8973
- "date; echo Hello from the Kubernetes cluster"
8974
- ]
9069
+ name: "example",
9070
+ image: "registry.smtx.io/kubesmart/alpine:3",
9071
+ args: ["/bin/sh", "-c", "date; echo Hello from the Kubernetes cluster"]
8975
9072
  }
8976
9073
  ],
8977
- "restartPolicy": "OnFailure"
9074
+ restartPolicy: "OnFailure"
8978
9075
  }
8979
9076
  }
8980
9077
  }
@@ -8982,32 +9079,32 @@ const CRONJOB_INIT_VALUE = {
8982
9079
  }
8983
9080
  };
8984
9081
  const DAEMONSET_INIT_VALUE = {
8985
- "apiVersion": "apps/v1",
8986
- "kind": "DaemonSet",
8987
- "metadata": {
8988
- "name": "example",
8989
- "namespace": "default"
9082
+ apiVersion: "apps/v1",
9083
+ kind: "DaemonSet",
9084
+ metadata: {
9085
+ name: "example",
9086
+ namespace: "default"
8990
9087
  },
8991
- "spec": {
8992
- "selector": {
8993
- "matchLabels": {
8994
- "app": "daemonset-example"
9088
+ spec: {
9089
+ selector: {
9090
+ matchLabels: {
9091
+ app: "daemonset-example"
8995
9092
  }
8996
9093
  },
8997
- "template": {
8998
- "metadata": {
8999
- "labels": {
9000
- "app": "daemonset-example"
9094
+ template: {
9095
+ metadata: {
9096
+ labels: {
9097
+ app: "daemonset-example"
9001
9098
  }
9002
9099
  },
9003
- "spec": {
9004
- "containers": [
9100
+ spec: {
9101
+ containers: [
9005
9102
  {
9006
- "name": "daemonset-example",
9007
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9008
- "ports": [
9103
+ name: "daemonset-example",
9104
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9105
+ ports: [
9009
9106
  {
9010
- "containerPort": 8080
9107
+ containerPort: 8080
9011
9108
  }
9012
9109
  ]
9013
9110
  }
@@ -9017,98 +9114,86 @@ const DAEMONSET_INIT_VALUE = {
9017
9114
  }
9018
9115
  };
9019
9116
  const JOB_INIT_VALUE = {
9020
- "apiVersion": "batch/v1",
9021
- "kind": "Job",
9022
- "metadata": {
9023
- "name": "example",
9024
- "namespace": "default"
9117
+ apiVersion: "batch/v1",
9118
+ kind: "Job",
9119
+ metadata: {
9120
+ name: "example",
9121
+ namespace: "default"
9025
9122
  },
9026
- "spec": {
9027
- "selector": {},
9028
- "template": {
9029
- "metadata": {
9030
- "name": "job-example"
9123
+ spec: {
9124
+ selector: {},
9125
+ template: {
9126
+ metadata: {
9127
+ name: "job-example"
9031
9128
  },
9032
- "spec": {
9033
- "containers": [
9129
+ spec: {
9130
+ containers: [
9034
9131
  {
9035
- "name": "job-example",
9036
- "image": "registry.smtx.io/kubesmart/alpine:3",
9037
- "command": [
9038
- "/bin/sh",
9039
- "-c",
9040
- "date; echo Hello from the Kubernetes cluster"
9041
- ]
9132
+ name: "job-example",
9133
+ image: "registry.smtx.io/kubesmart/alpine:3",
9134
+ command: ["/bin/sh", "-c", "date; echo Hello from the Kubernetes cluster"]
9042
9135
  }
9043
9136
  ],
9044
- "restartPolicy": "Never"
9137
+ restartPolicy: "Never"
9045
9138
  }
9046
9139
  }
9047
9140
  }
9048
9141
  };
9049
9142
  const STATEFULSET_INIT_VALUE = {
9050
- "apiVersion": "apps/v1",
9051
- "kind": "StatefulSet",
9052
- "metadata": {
9053
- "name": "example",
9054
- "namespace": "default"
9143
+ apiVersion: "apps/v1",
9144
+ kind: "StatefulSet",
9145
+ metadata: {
9146
+ name: "example",
9147
+ namespace: "default"
9055
9148
  },
9056
- "spec": {
9057
- "serviceName": "statefulset-example",
9058
- "replicas": 3,
9059
- "selector": {
9060
- "matchLabels": {
9061
- "app": "statefulset-example"
9149
+ spec: {
9150
+ serviceName: "statefulset-example",
9151
+ replicas: 3,
9152
+ selector: {
9153
+ matchLabels: {
9154
+ app: "statefulset-example"
9062
9155
  }
9063
9156
  },
9064
- "template": {
9065
- "metadata": {
9066
- "labels": {
9067
- "app": "statefulset-example"
9157
+ template: {
9158
+ metadata: {
9159
+ labels: {
9160
+ app: "statefulset-example"
9068
9161
  }
9069
9162
  },
9070
- "spec": {
9071
- "terminationGracePeriodSeconds": 10,
9072
- "containers": [
9163
+ spec: {
9164
+ terminationGracePeriodSeconds: 10,
9165
+ containers: [
9073
9166
  {
9074
- "name": "statefulset-example",
9075
- "image": "registry.smtx.io/kubesmart/fileserver:v1.0.0",
9076
- "command": [
9077
- "dufs"
9078
- ],
9079
- "args": [
9080
- "-A",
9081
- "--render-try-index",
9082
- "/data"
9083
- ],
9084
- "ports": [
9167
+ name: "statefulset-example",
9168
+ image: "registry.smtx.io/kubesmart/fileserver:v1.0.0",
9169
+ command: ["dufs"],
9170
+ args: ["-A", "--render-try-index", "/data"],
9171
+ ports: [
9085
9172
  {
9086
- "containerPort": 5e3,
9087
- "name": "http"
9173
+ containerPort: 5e3,
9174
+ name: "http"
9088
9175
  }
9089
9176
  ],
9090
- "volumeMounts": [
9177
+ volumeMounts: [
9091
9178
  {
9092
- "name": "file",
9093
- "mountPath": "/data"
9179
+ name: "file",
9180
+ mountPath: "/data"
9094
9181
  }
9095
9182
  ]
9096
9183
  }
9097
9184
  ]
9098
9185
  }
9099
9186
  },
9100
- "volumeClaimTemplates": [
9187
+ volumeClaimTemplates: [
9101
9188
  {
9102
- "metadata": {
9103
- "name": "file"
9189
+ metadata: {
9190
+ name: "file"
9104
9191
  },
9105
- "spec": {
9106
- "accessModes": [
9107
- "ReadWriteOnce"
9108
- ],
9109
- "resources": {
9110
- "requests": {
9111
- "storage": "1Gi"
9192
+ spec: {
9193
+ accessModes: ["ReadWriteOnce"],
9194
+ resources: {
9195
+ requests: {
9196
+ storage: "1Gi"
9112
9197
  }
9113
9198
  }
9114
9199
  }
@@ -9117,37 +9202,35 @@ const STATEFULSET_INIT_VALUE = {
9117
9202
  }
9118
9203
  };
9119
9204
  const POD_INIT_VALUE = {
9120
- "apiVersion": "v1",
9121
- "kind": "Pod",
9122
- "metadata": {
9123
- "name": "example",
9124
- "namespace": "default",
9125
- "labels": {
9126
- "app": "example"
9205
+ apiVersion: "v1",
9206
+ kind: "Pod",
9207
+ metadata: {
9208
+ name: "example",
9209
+ namespace: "default",
9210
+ labels: {
9211
+ app: "example"
9127
9212
  }
9128
9213
  },
9129
- "spec": {
9130
- "securityContext": {
9131
- "runAsNonRoot": true,
9132
- "seccompProfile": {
9133
- "type": "RuntimeDefault"
9214
+ spec: {
9215
+ securityContext: {
9216
+ runAsNonRoot: true,
9217
+ seccompProfile: {
9218
+ type: "RuntimeDefault"
9134
9219
  }
9135
9220
  },
9136
- "containers": [
9221
+ containers: [
9137
9222
  {
9138
- "name": "example",
9139
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9140
- "ports": [
9223
+ name: "example",
9224
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9225
+ ports: [
9141
9226
  {
9142
- "containerPort": 8080
9227
+ containerPort: 8080
9143
9228
  }
9144
9229
  ],
9145
- "securityContext": {
9146
- "allowPrivilegeEscalation": false,
9147
- "capabilities": {
9148
- "drop": [
9149
- "ALL"
9150
- ]
9230
+ securityContext: {
9231
+ allowPrivilegeEscalation: false,
9232
+ capabilities: {
9233
+ drop: ["ALL"]
9151
9234
  }
9152
9235
  }
9153
9236
  }
@@ -9155,143 +9238,143 @@ const POD_INIT_VALUE = {
9155
9238
  }
9156
9239
  };
9157
9240
  const SERVICE_CLUSTER_IP_INIT_VALUE = {
9158
- "apiVersion": "v1",
9159
- "kind": "Service",
9160
- "metadata": {
9161
- "name": "example",
9162
- "namespace": "default"
9241
+ apiVersion: "v1",
9242
+ kind: "Service",
9243
+ metadata: {
9244
+ name: "example",
9245
+ namespace: "default"
9163
9246
  },
9164
- "spec": {
9165
- "selector": {
9166
- "app": "example"
9247
+ spec: {
9248
+ selector: {
9249
+ app: "example"
9167
9250
  },
9168
- "ports": [
9251
+ ports: [
9169
9252
  {
9170
- "name": "example",
9171
- "port": 8080,
9172
- "protocol": "TCP",
9173
- "targetPort": 8080
9253
+ name: "example",
9254
+ port: 8080,
9255
+ protocol: "TCP",
9256
+ targetPort: 8080
9174
9257
  }
9175
9258
  ],
9176
- "sessionAffinity": "None",
9177
- "type": "ClusterIP"
9259
+ sessionAffinity: "None",
9260
+ type: "ClusterIP"
9178
9261
  }
9179
9262
  };
9180
9263
  const SERVICE_NODE_PORT_INIT_VALUE = {
9181
- "apiVersion": "v1",
9182
- "kind": "Service",
9183
- "metadata": {
9184
- "name": "example",
9185
- "namespace": "default"
9264
+ apiVersion: "v1",
9265
+ kind: "Service",
9266
+ metadata: {
9267
+ name: "example",
9268
+ namespace: "default"
9186
9269
  },
9187
- "spec": {
9188
- "selector": {
9189
- "app": "example"
9270
+ spec: {
9271
+ selector: {
9272
+ app: "example"
9190
9273
  },
9191
- "ports": [
9274
+ ports: [
9192
9275
  {
9193
- "name": "example",
9194
- "port": 8080,
9195
- "protocol": "TCP",
9196
- "targetPort": 8080
9276
+ name: "example",
9277
+ port: 8080,
9278
+ protocol: "TCP",
9279
+ targetPort: 8080
9197
9280
  }
9198
9281
  ],
9199
- "sessionAffinity": "None",
9200
- "type": "NodePort"
9282
+ sessionAffinity: "None",
9283
+ type: "NodePort"
9201
9284
  }
9202
9285
  };
9203
9286
  const SERVICE_LOAD_BALANCER_INIT_VALUE = {
9204
- "apiVersion": "v1",
9205
- "kind": "Service",
9206
- "metadata": {
9207
- "name": "example",
9208
- "namespace": "default"
9287
+ apiVersion: "v1",
9288
+ kind: "Service",
9289
+ metadata: {
9290
+ name: "example",
9291
+ namespace: "default"
9209
9292
  },
9210
- "spec": {
9211
- "selector": {
9212
- "app": "example"
9293
+ spec: {
9294
+ selector: {
9295
+ app: "example"
9213
9296
  },
9214
- "ports": [
9297
+ ports: [
9215
9298
  {
9216
- "name": "example",
9217
- "port": 80,
9218
- "protocol": "TCP",
9219
- "targetPort": 8080
9299
+ name: "example",
9300
+ port: 80,
9301
+ protocol: "TCP",
9302
+ targetPort: 8080
9220
9303
  }
9221
9304
  ],
9222
- "sessionAffinity": "None",
9223
- "type": "LoadBalancer"
9305
+ sessionAffinity: "None",
9306
+ type: "LoadBalancer"
9224
9307
  }
9225
9308
  };
9226
9309
  const SERVICE_EXTERNAL_NAME_INIT_VALUE = {
9227
- "apiVersion": "v1",
9228
- "kind": "Service",
9229
- "metadata": {
9230
- "name": "example",
9231
- "namespace": "default"
9310
+ apiVersion: "v1",
9311
+ kind: "Service",
9312
+ metadata: {
9313
+ name: "example",
9314
+ namespace: "default"
9232
9315
  },
9233
- "spec": {
9234
- "selector": {
9235
- "app": "example"
9316
+ spec: {
9317
+ selector: {
9318
+ app: "example"
9236
9319
  },
9237
- "ports": [
9320
+ ports: [
9238
9321
  {
9239
- "name": "example",
9240
- "port": 8080,
9241
- "protocol": "TCP",
9242
- "targetPort": 8080
9322
+ name: "example",
9323
+ port: 8080,
9324
+ protocol: "TCP",
9325
+ targetPort: 8080
9243
9326
  }
9244
9327
  ],
9245
- "sessionAffinity": "None",
9246
- "type": "ExternalName",
9247
- "externalName": "app.example.com"
9328
+ sessionAffinity: "None",
9329
+ type: "ExternalName",
9330
+ externalName: "app.example.com"
9248
9331
  }
9249
9332
  };
9250
9333
  const SERVICE_HEADLESS_INIT_VALUE = {
9251
- "apiVersion": "v1",
9252
- "kind": "Service",
9253
- "metadata": {
9254
- "name": "example",
9255
- "namespace": "default"
9334
+ apiVersion: "v1",
9335
+ kind: "Service",
9336
+ metadata: {
9337
+ name: "example",
9338
+ namespace: "default"
9256
9339
  },
9257
- "spec": {
9258
- "selector": {
9259
- "app": "example"
9340
+ spec: {
9341
+ selector: {
9342
+ app: "example"
9260
9343
  },
9261
- "clusterIP": "None",
9262
- "ports": [
9344
+ clusterIP: "None",
9345
+ ports: [
9263
9346
  {
9264
- "name": "example",
9265
- "port": null,
9266
- "protocol": "TCP",
9267
- "targetPort": null
9347
+ name: "example",
9348
+ port: null,
9349
+ protocol: "TCP",
9350
+ targetPort: null
9268
9351
  }
9269
9352
  ],
9270
- "sessionAffinity": "None",
9271
- "type": "ClusterIP"
9353
+ sessionAffinity: "None",
9354
+ type: "ClusterIP"
9272
9355
  }
9273
9356
  };
9274
9357
  const INGRESS_INIT_VALUE = {
9275
- "apiVersion": "networking.k8s.io/v1",
9276
- "kind": "Ingress",
9277
- "metadata": {
9278
- "name": "example",
9279
- "namespace": "default"
9358
+ apiVersion: "networking.k8s.io/v1",
9359
+ kind: "Ingress",
9360
+ metadata: {
9361
+ name: "example",
9362
+ namespace: "default"
9280
9363
  },
9281
- "spec": {
9282
- "rules": [
9364
+ spec: {
9365
+ rules: [
9283
9366
  {
9284
- "host": "example.com",
9285
- "http": {
9286
- "paths": [
9367
+ host: "example.com",
9368
+ http: {
9369
+ paths: [
9287
9370
  {
9288
- "path": "/testpath",
9289
- "pathType": "Prefix",
9290
- "backend": {
9291
- "service": {
9292
- "name": "test",
9293
- "port": {
9294
- "number": 80
9371
+ path: "/testpath",
9372
+ pathType: "Prefix",
9373
+ backend: {
9374
+ service: {
9375
+ name: "test",
9376
+ port: {
9377
+ number: 80
9295
9378
  }
9296
9379
  }
9297
9380
  }
@@ -9303,28 +9386,28 @@ const INGRESS_INIT_VALUE = {
9303
9386
  }
9304
9387
  };
9305
9388
  const NETWORK_POLICY_INIT_VALUE = {
9306
- "apiVersion": "networking.k8s.io/v1",
9307
- "kind": "NetworkPolicy",
9308
- "metadata": {
9309
- "name": "example",
9310
- "namespace": "default"
9389
+ apiVersion: "networking.k8s.io/v1",
9390
+ kind: "NetworkPolicy",
9391
+ metadata: {
9392
+ name: "example",
9393
+ namespace: "default"
9311
9394
  },
9312
- "spec": {
9313
- "podSelector": {},
9314
- "policyTypes": []
9395
+ spec: {
9396
+ podSelector: {},
9397
+ policyTypes: []
9315
9398
  }
9316
9399
  };
9317
9400
  const CONFIG_MAP_INIT_VALUE = {
9318
- "apiVersion": "v1",
9319
- "kind": "ConfigMap",
9320
- "metadata": {
9321
- "name": "example",
9322
- "namespace": "default"
9401
+ apiVersion: "v1",
9402
+ kind: "ConfigMap",
9403
+ metadata: {
9404
+ name: "example",
9405
+ namespace: "default"
9323
9406
  },
9324
- "data": {
9325
- "key": "value"
9407
+ data: {
9408
+ key: "value"
9326
9409
  },
9327
- "immutable": false
9410
+ immutable: false
9328
9411
  };
9329
9412
  const SERVER_INSTANCE_INIT_VALUE = {
9330
9413
  apiVersion: "kubesmart.smtx.io/v1alpha1",
@@ -9346,138 +9429,136 @@ const SERVER_INSTANCE_INIT_VALUE = {
9346
9429
  };
9347
9430
  const REDEPLOY_TIMESTAMP_KEY = "kubectl.kubernetes.io/restartedAt";
9348
9431
  const SECRET_OPAQUE_INIT_VALUE = {
9349
- "apiVersion": "v1",
9350
- "kind": "Secret",
9351
- "metadata": {
9352
- "name": "example",
9353
- "namespace": "default"
9432
+ apiVersion: "v1",
9433
+ kind: "Secret",
9434
+ metadata: {
9435
+ name: "example",
9436
+ namespace: "default"
9354
9437
  },
9355
- "type": "Opaque",
9356
- "data": {
9357
- "key": "value"
9438
+ type: "Opaque",
9439
+ data: {
9440
+ key: "value"
9358
9441
  }
9359
9442
  };
9360
9443
  const SECRET_IMAGE_REPO_INIT_VALUE = {
9361
- "apiVersion": "v1",
9362
- "kind": "Secret",
9363
- "metadata": {
9364
- "name": "example",
9365
- "namespace": "default"
9444
+ apiVersion: "v1",
9445
+ kind: "Secret",
9446
+ metadata: {
9447
+ name: "example",
9448
+ namespace: "default"
9366
9449
  },
9367
- "type": "kubernetes.io/dockerconfigjson",
9368
- "data": {
9450
+ type: "kubernetes.io/dockerconfigjson",
9451
+ data: {
9369
9452
  ".dockerconfigjson": ""
9370
9453
  }
9371
9454
  };
9372
9455
  const SECRET_BASIC_AUTH_INIT_VALUE = {
9373
- "apiVersion": "v1",
9374
- "kind": "Secret",
9375
- "metadata": {
9376
- "name": "example",
9377
- "namespace": "default"
9456
+ apiVersion: "v1",
9457
+ kind: "Secret",
9458
+ metadata: {
9459
+ name: "example",
9460
+ namespace: "default"
9378
9461
  },
9379
- "type": "kubernetes.io/basic-auth",
9380
- "data": {
9381
- "username": "example",
9382
- "password": "example"
9462
+ type: "kubernetes.io/basic-auth",
9463
+ data: {
9464
+ username: "example",
9465
+ password: "example"
9383
9466
  }
9384
9467
  };
9385
9468
  const SECRET_SSH_AUTH_INIT_VALUE = {
9386
- "apiVersion": "v1",
9387
- "kind": "Secret",
9388
- "metadata": {
9389
- "name": "example",
9390
- "namespace": "default"
9469
+ apiVersion: "v1",
9470
+ kind: "Secret",
9471
+ metadata: {
9472
+ name: "example",
9473
+ namespace: "default"
9391
9474
  },
9392
- "type": "kubernetes.io/ssh-auth",
9393
- "data": {
9475
+ type: "kubernetes.io/ssh-auth",
9476
+ data: {
9394
9477
  "ssh-publickey": "",
9395
9478
  "ssh-privatekey": ""
9396
9479
  }
9397
9480
  };
9398
9481
  const SECRET_TLS_INIT_VALUE = {
9399
- "apiVersion": "v1",
9400
- "kind": "Secret",
9401
- "metadata": {
9402
- "name": "example",
9403
- "namespace": "default"
9482
+ apiVersion: "v1",
9483
+ kind: "Secret",
9484
+ metadata: {
9485
+ name: "example",
9486
+ namespace: "default"
9404
9487
  },
9405
- "type": "kubernetes.io/tls",
9406
- "data": {
9488
+ type: "kubernetes.io/tls",
9489
+ data: {
9407
9490
  "tls.crt": "",
9408
9491
  "tls.key": ""
9409
9492
  }
9410
9493
  };
9411
9494
  const SECRET_CUSTOM_INIT_VALUE = {
9412
- "apiVersion": "v1",
9413
- "kind": "Secret",
9414
- "metadata": {
9415
- "name": "example",
9416
- "namespace": "default"
9495
+ apiVersion: "v1",
9496
+ kind: "Secret",
9497
+ metadata: {
9498
+ name: "example",
9499
+ namespace: "default"
9417
9500
  },
9418
- "type": "",
9419
- "data": {}
9501
+ type: "",
9502
+ data: {}
9420
9503
  };
9421
9504
  const NODE_INIT_VALUE = {
9422
- "apiVersion": "v1",
9423
- "kind": "Node",
9424
- "metadata": {
9425
- "name": "example",
9426
- "namespace": "default"
9505
+ apiVersion: "v1",
9506
+ kind: "Node",
9507
+ metadata: {
9508
+ name: "example",
9509
+ namespace: "default"
9427
9510
  },
9428
- "spec": {}
9511
+ spec: {}
9429
9512
  };
9430
9513
  const STORAGE_CLASS_INIT_VALUE = {
9431
- "apiVersion": "storage.k8s.io/v1",
9432
- "kind": "StorageClass",
9433
- "metadata": {
9434
- "name": ""
9514
+ apiVersion: "storage.k8s.io/v1",
9515
+ kind: "StorageClass",
9516
+ metadata: {
9517
+ name: ""
9435
9518
  },
9436
- "parameters": {
9519
+ parameters: {
9437
9520
  "csi.storage.k8s.io/fstype": "ext4"
9438
9521
  },
9439
- "provisioner": "",
9440
- "reclaimPolicy": "Delete",
9441
- "allowVolumeExpansion": true,
9442
- "volumeBindingMode": "Immediate"
9522
+ provisioner: "",
9523
+ reclaimPolicy: "Delete",
9524
+ allowVolumeExpansion: true,
9525
+ volumeBindingMode: "Immediate"
9443
9526
  };
9444
9527
  const PV_INIT_VALUE = {
9445
- "apiVersion": "v1",
9446
- "kind": "PersistentVolume",
9447
- "metadata": {
9448
- "name": "pvc-hostpath"
9528
+ apiVersion: "v1",
9529
+ kind: "PersistentVolume",
9530
+ metadata: {
9531
+ name: "pvc-hostpath"
9449
9532
  },
9450
- "spec": {
9451
- "accessModes": [
9452
- "ReadWriteOnce"
9453
- ],
9454
- "capacity": {
9455
- "storage": "10Gi"
9533
+ spec: {
9534
+ accessModes: ["ReadWriteOnce"],
9535
+ capacity: {
9536
+ storage: "10Gi"
9456
9537
  },
9457
- "hostPath": {
9458
- "type": "DirectoryOrCreate",
9459
- "path": "/root/test"
9538
+ hostPath: {
9539
+ type: "DirectoryOrCreate",
9540
+ path: "/root/test"
9460
9541
  },
9461
- "persistentVolumeReclaimPolicy": "Delete",
9462
- "volumeMode": "Filesystem"
9542
+ persistentVolumeReclaimPolicy: "Delete",
9543
+ volumeMode: "Filesystem"
9463
9544
  }
9464
9545
  };
9465
9546
  const PVC_INIT_VALUE = {
9466
- "apiVersion": "v1",
9467
- "kind": "PersistentVolumeClaim",
9468
- "metadata": {
9469
- "name": "",
9470
- "namespace": "default"
9547
+ apiVersion: "v1",
9548
+ kind: "PersistentVolumeClaim",
9549
+ metadata: {
9550
+ name: "",
9551
+ namespace: "default"
9471
9552
  },
9472
- "spec": {
9473
- "accessModes": [],
9474
- "resources": {
9475
- "requests": {
9476
- "storage": "10Gi"
9553
+ spec: {
9554
+ accessModes: [],
9555
+ resources: {
9556
+ requests: {
9557
+ storage: "10Gi"
9477
9558
  }
9478
9559
  },
9479
- "storageClassName": "",
9480
- "volumeMode": "Filesystem"
9560
+ storageClassName: "",
9561
+ volumeMode: "Filesystem"
9481
9562
  }
9482
9563
  };
9483
9564
  var ResourceState = /* @__PURE__ */ ((ResourceState2) => {
@@ -9584,6 +9665,16 @@ class WorkloadBaseModel extends ResourceModel {
9584
9665
  );
9585
9666
  return (containers == null ? void 0 : containers.map((container2) => shortenedImage(container2.image || ""))) || [];
9586
9667
  }
9668
+ async fetchRestarts(selector, namespace2) {
9669
+ const pods = await this._globalStore.get("pods", {
9670
+ resourceBasePath: "/api/v1",
9671
+ kind: "Pod"
9672
+ });
9673
+ const myPods = pods.items.filter(
9674
+ (p) => matchSelector(p, selector, namespace2)
9675
+ );
9676
+ return lodashExports.sumBy(myPods, "restarts");
9677
+ }
9587
9678
  }
9588
9679
  class JobModel extends WorkloadBaseModel {
9589
9680
  constructor(_rawYaml, _globalStore) {
@@ -9595,18 +9686,11 @@ class JobModel extends WorkloadBaseModel {
9595
9686
  await this.getRestarts();
9596
9687
  }
9597
9688
  async getRestarts() {
9598
- const pods = await this._globalStore.get("pods", {
9599
- resourceBasePath: "/api/v1",
9600
- kind: "Pod"
9601
- });
9602
- const myPods = pods.items.filter(
9603
- (p) => {
9604
- var _a;
9605
- return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9606
- }
9689
+ var _a;
9690
+ this.restarts = await this.fetchRestarts(
9691
+ (_a = this.spec) == null ? void 0 : _a.selector,
9692
+ this.metadata.namespace
9607
9693
  );
9608
- const result = lodashExports.sumBy(myPods, "restarts");
9609
- this.restarts = result;
9610
9694
  }
9611
9695
  get duration() {
9612
9696
  var _a, _b;
@@ -9671,18 +9755,11 @@ class WorkloadModel extends WorkloadBaseModel {
9671
9755
  await this.getIngresses();
9672
9756
  }
9673
9757
  async getRestarts() {
9674
- const pods = await this._globalStore.get("pods", {
9675
- resourceBasePath: "/api/v1",
9676
- kind: "Pod"
9677
- });
9678
- const myPods = pods.items.filter(
9679
- (p) => {
9680
- var _a;
9681
- return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9682
- }
9758
+ var _a;
9759
+ this.restarts = await this.fetchRestarts(
9760
+ (_a = this.spec) == null ? void 0 : _a.selector,
9761
+ this.metadata.namespace
9683
9762
  );
9684
- const result = lodashExports.sumBy(myPods, "restarts");
9685
- this.restarts = result;
9686
9763
  }
9687
9764
  async getServices() {
9688
9765
  const services = await this._globalStore.get("services", {
@@ -9699,10 +9776,10 @@ class WorkloadModel extends WorkloadBaseModel {
9699
9776
  }
9700
9777
  async getIngresses() {
9701
9778
  const allIngresses = /* @__PURE__ */ new Map();
9702
- for (const service of this.services) {
9703
- for (const ingress of service.ingresses) {
9704
- const key2 = `${ingress.namespace}-${ingress.name}`;
9705
- allIngresses.set(key2, ingress);
9779
+ for (const service2 of this.services) {
9780
+ for (const ingress2 of service2.ingresses) {
9781
+ const key2 = `${ingress2.namespace}-${ingress2.name}`;
9782
+ allIngresses.set(key2, ingress2);
9706
9783
  }
9707
9784
  }
9708
9785
  this.ingresses = Array.from(allIngresses.values());
@@ -9735,6 +9812,23 @@ class WorkloadModel extends WorkloadBaseModel {
9735
9812
  }
9736
9813
  return newOne;
9737
9814
  }
9815
+ getControllerRevisions(controllerRevisions) {
9816
+ return controllerRevisions.filter(
9817
+ (cr) => {
9818
+ var _a, _b;
9819
+ return (_b = (_a = cr.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
9820
+ (ref) => ref.kind === this.kind && ref.uid === this.metadata.uid
9821
+ );
9822
+ }
9823
+ );
9824
+ }
9825
+ getRevision(controllerRevisions) {
9826
+ const myRevisions = this.getControllerRevisions(controllerRevisions);
9827
+ return myRevisions.reduce(
9828
+ (result, cr) => Math.max(result, Number(cr.revision || 0)),
9829
+ 0
9830
+ );
9831
+ }
9738
9832
  }
9739
9833
  class PodModel extends WorkloadBaseModel {
9740
9834
  constructor(_rawYaml, _globalStore) {
@@ -10011,22 +10105,6 @@ class DaemonSetModel extends WorkloadModel {
10011
10105
  super(_rawYaml, _globalStore);
10012
10106
  this._rawYaml = _rawYaml;
10013
10107
  }
10014
- getControllerRevisions(controllerVisions) {
10015
- return controllerVisions.filter(
10016
- (controllerRevision) => {
10017
- var _a, _b;
10018
- return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
10019
- (ownerReference) => ownerReference.kind === "DaemonSet" && ownerReference.uid === this.metadata.uid
10020
- );
10021
- }
10022
- );
10023
- }
10024
- getRevision(controllerVisions) {
10025
- const myControllerVisions = this.getControllerRevisions(controllerVisions);
10026
- return myControllerVisions.reduce((result, controllerRevision) => {
10027
- return Math.max(result, Number(controllerRevision.revision || 0));
10028
- }, 0);
10029
- }
10030
10108
  get stateDisplay() {
10031
10109
  var _a, _b;
10032
10110
  if (((_a = this.status) == null ? void 0 : _a.desiredNumberScheduled) !== ((_b = this.status) == null ? void 0 : _b.numberReady)) {
@@ -10046,22 +10124,6 @@ class StatefulSetModel extends WorkloadModel {
10046
10124
  super(_rawYaml, _globalStore);
10047
10125
  this._rawYaml = _rawYaml;
10048
10126
  }
10049
- getControllerRevisions(controllerVisions) {
10050
- return controllerVisions.filter(
10051
- (controllerRevision) => {
10052
- var _a, _b;
10053
- return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
10054
- (ownerReference) => ownerReference.kind === "StatefulSet" && ownerReference.uid === this.metadata.uid
10055
- );
10056
- }
10057
- );
10058
- }
10059
- getRevision(controllerVisions) {
10060
- const myControllerVisions = this.getControllerRevisions(controllerVisions);
10061
- return myControllerVisions.reduce((result, controllerRevision) => {
10062
- return Math.max(result, Number(controllerRevision.revision || 0));
10063
- }, 0);
10064
- }
10065
10127
  get stateDisplay() {
10066
10128
  var _a, _b, _c;
10067
10129
  if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
@@ -10094,11 +10156,9 @@ class ServiceModel extends ResourceModel {
10094
10156
  resourceBasePath: "/apis/networking.k8s.io/v1",
10095
10157
  kind: "Ingress"
10096
10158
  });
10097
- const myIngresses = ingresses.items.filter((ingress) => {
10098
- const rules = ingress.getFlattenedRules([]);
10099
- return rules.some(
10100
- (rule2) => rule2.serviceName === this.name
10101
- );
10159
+ const myIngresses = ingresses.items.filter((ingress2) => {
10160
+ const rules = ingress2.getFlattenedRules([]);
10161
+ return rules.some((rule2) => rule2.serviceName === this.name);
10102
10162
  });
10103
10163
  this.ingresses = myIngresses;
10104
10164
  }
@@ -10290,15 +10350,15 @@ class IngressClassModel extends ResourceModel {
10290
10350
  return (_a = this.spec) == null ? void 0 : _a.controller;
10291
10351
  }
10292
10352
  }
10293
- const index_1rec449 = "";
10353
+ const index_1ndmolf = "";
10294
10354
  const ServiceInClusterAccessComponent = ({
10295
- service
10355
+ service: service2
10296
10356
  }) => {
10297
- const spec = service._rawYaml.spec;
10298
- switch (service.displayType) {
10357
+ const spec = service2._rawYaml.spec;
10358
+ switch (service2.displayType) {
10299
10359
  case ServiceTypeEnum.ExternalName:
10300
10360
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
10301
- value: service.dnsRecord
10361
+ value: service2.dnsRecord
10302
10362
  });
10303
10363
  case ServiceTypeEnum.Headless:
10304
10364
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
@@ -10314,46 +10374,79 @@ const BreakLineStyle = "b1vtjd4k";
10314
10374
  const LinkStyle$2 = "luro4rx";
10315
10375
  const ShowLinkStyle = "s1gydjqf";
10316
10376
  const DashedUnderlineSpanStyle = "dvp1i89";
10377
+ const AccessAddressStyle = "azmggeh";
10378
+ const ServiceAccessAddress = ({
10379
+ children,
10380
+ copyValue
10381
+ }) => {
10382
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("span", {
10383
+ className: AccessAddressStyle,
10384
+ children: [children, /* @__PURE__ */ common.jsxRuntimeExports.jsx(CopyButton, {
10385
+ value: copyValue
10386
+ })]
10387
+ });
10388
+ };
10389
+ function renderAccessItems(items, separator) {
10390
+ if (!items.length) {
10391
+ return void 0;
10392
+ }
10393
+ const result = [];
10394
+ for (let i2 = 0; i2 < items.length; i2++) {
10395
+ result.push(/* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Fragment, {
10396
+ children: items[i2]
10397
+ }, `item-${i2}`));
10398
+ if (i2 < items.length - 1) {
10399
+ result.push(/* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Fragment, {
10400
+ children: separator
10401
+ }, `separator-${i2}`));
10402
+ }
10403
+ }
10404
+ return result;
10405
+ }
10317
10406
  const ServiceOutClusterAccessComponent = ({
10318
- service,
10407
+ service: service2,
10319
10408
  breakLine = true,
10320
10409
  clusterVip,
10321
- showDashedUnderline = true
10410
+ showDashedUnderline = true,
10411
+ showCopyButton = false
10322
10412
  }) => {
10323
- var _a, _b, _c, _d, _e;
10413
+ var _a, _b, _c, _d, _e, _f, _g, _h;
10324
10414
  const {
10325
10415
  i18n: i18n2
10326
10416
  } = common.useTranslation();
10327
- const spec = service._rawYaml.spec;
10328
- const status = service._rawYaml.status;
10417
+ const spec = service2._rawYaml.spec;
10418
+ const status = service2._rawYaml.status;
10329
10419
  let content = "-";
10330
10420
  switch (spec.type) {
10331
10421
  case ServiceTypeEnum.NodePort:
10332
10422
  if (!breakLine) {
10333
- content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v).map((p) => [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Link, {
10334
- href: `http://${clusterVip}:${p.nodePort}`,
10335
- target: "_blank",
10336
- className: common.cx_default(ShowLinkStyle, eagle.Typo.Label.l4_regular_title),
10337
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tooltip, {
10338
- title: i18n2.t("dovetail.default_http_protocol_tooltip"),
10339
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
10340
- className: DashedUnderlineSpanStyle,
10341
- style: showDashedUnderline ? void 0 : {
10342
- borderBottom: "none"
10343
- },
10344
- children: `${clusterVip}:${p.nodePort}`
10423
+ content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v && v.nodePort).map((p) => {
10424
+ const address = `${clusterVip}:${p.nodePort}`;
10425
+ const link = /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Link, {
10426
+ href: `http://${address}`,
10427
+ target: "_blank",
10428
+ className: common.cx_default(ShowLinkStyle, eagle.Typo.Label.l4_regular_title),
10429
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tooltip, {
10430
+ title: i18n2.t("dovetail.default_http_protocol_tooltip"),
10431
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
10432
+ className: DashedUnderlineSpanStyle,
10433
+ style: showDashedUnderline ? void 0 : {
10434
+ borderBottom: "none"
10435
+ },
10436
+ children: address
10437
+ })
10345
10438
  })
10346
- })
10347
- }, p.name)]);
10348
- if (content && content instanceof Array) {
10349
- const result = [];
10350
- for (let i2 = 0; i2 < content.length; i2++) {
10351
- result.push(content[i2]);
10352
- if (i2 < content.length - 1) {
10353
- result.push(", ");
10354
- }
10439
+ }, p.name || p.nodePort);
10440
+ if (!showCopyButton) {
10441
+ return link;
10355
10442
  }
10356
- content = result;
10443
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceAccessAddress, {
10444
+ copyValue: address,
10445
+ children: link
10446
+ }, p.name || p.nodePort);
10447
+ });
10448
+ if (content && content instanceof Array) {
10449
+ content = renderAccessItems(content, ", ");
10357
10450
  }
10358
10451
  break;
10359
10452
  }
@@ -10376,15 +10469,31 @@ const ServiceOutClusterAccessComponent = ({
10376
10469
  children: content
10377
10470
  });
10378
10471
  case ServiceTypeEnum.ExternalName:
10472
+ if (showCopyButton) {
10473
+ content = renderAccessItems(((_c = spec.externalIPs) == null ? void 0 : _c.map((ip) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceAccessAddress, {
10474
+ copyValue: ip,
10475
+ children: ip
10476
+ }, ip))) || [], breakLine ? "\n" : ", ");
10477
+ break;
10478
+ }
10379
10479
  content = /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
10380
10480
  useOverflow: false,
10381
- value: (_c = spec.externalIPs) == null ? void 0 : _c.join(breakLine ? "\n" : ", ")
10481
+ value: (_d = spec.externalIPs) == null ? void 0 : _d.join(breakLine ? "\n" : ", ")
10382
10482
  });
10383
10483
  break;
10384
10484
  case ServiceTypeEnum.LoadBalancer:
10485
+ if (showCopyButton) {
10486
+ content = renderAccessItems(((_f = (_e = status.loadBalancer) == null ? void 0 : _e.ingress) == null ? void 0 : _f.map(({
10487
+ ip
10488
+ }) => ip).filter((ip) => !!ip).map((ip) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceAccessAddress, {
10489
+ copyValue: ip,
10490
+ children: ip
10491
+ }, ip))) || [], breakLine ? "\n" : ", ");
10492
+ break;
10493
+ }
10385
10494
  content = /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
10386
10495
  useOverflow: false,
10387
- value: (_e = (_d = status.loadBalancer) == null ? void 0 : _d.ingress) == null ? void 0 : _e.map(({
10496
+ value: (_h = (_g = status.loadBalancer) == null ? void 0 : _g.ingress) == null ? void 0 : _h.map(({
10388
10497
  ip
10389
10498
  }) => ip).join(breakLine ? "\n" : ", ")
10390
10499
  });
@@ -10411,7 +10520,7 @@ const ServiceOutClusterAccessComponent = ({
10411
10520
  children: content || "-"
10412
10521
  });
10413
10522
  };
10414
- const index_1es4s7t = "";
10523
+ const index_1l1kti4 = "";
10415
10524
  const TagWrapper = "t13a6vox";
10416
10525
  const TagStyle = "t12ikbmp";
10417
10526
  const Tags = (props) => {
@@ -10677,42 +10786,48 @@ function immutableSet(obj, path2, value2) {
10677
10786
  return lodashEs.setWith(lodashEs.clone(obj), path2, value2, lodashEs.clone);
10678
10787
  }
10679
10788
  function usePathMap(options) {
10680
- const { pathMap, transformInitValues: transformInitValuesFromOptions, transformApplyValues: transformApplyValuesFromOptions } = options;
10681
- const transformInitValues = React.useCallback((values) => {
10682
- const initValues = values._rawYaml || values;
10683
- let result = initValues;
10684
- for (const { from, to } of pathMap || []) {
10685
- result = immutableSet(initValues, to, lodashEs.get(initValues, from));
10686
- const fromPath = [...from];
10687
- const lastKey = fromPath.pop();
10688
- if (lastKey) {
10689
- const obj = lodashEs.get(result, fromPath);
10690
- if (obj && typeof obj === "object") {
10691
- delete obj[lastKey];
10692
- }
10693
- }
10694
- }
10695
- return (transformInitValuesFromOptions == null ? void 0 : transformInitValuesFromOptions(result)) || result;
10696
- }, [transformInitValuesFromOptions, pathMap]);
10697
- const transformApplyValues = React.useCallback((values) => {
10698
- let result = values;
10699
- for (const { from, to } of pathMap || []) {
10700
- result = immutableSet(
10701
- values,
10702
- from,
10703
- lodashEs.get(result, to)
10704
- );
10705
- const toPath = [...to];
10706
- const lastKey = toPath.pop();
10707
- if (lastKey) {
10708
- const obj = lodashEs.get(result, toPath);
10709
- if (obj && typeof obj === "object") {
10710
- delete obj[lastKey];
10789
+ const {
10790
+ pathMap,
10791
+ transformInitValues: transformInitValuesFromOptions,
10792
+ transformApplyValues: transformApplyValuesFromOptions
10793
+ } = options;
10794
+ const transformInitValues = React.useCallback(
10795
+ (values) => {
10796
+ const initValues = values._rawYaml || values;
10797
+ let result = initValues;
10798
+ for (const { from, to } of pathMap || []) {
10799
+ result = immutableSet(initValues, to, lodashEs.get(initValues, from));
10800
+ const fromPath = [...from];
10801
+ const lastKey = fromPath.pop();
10802
+ if (lastKey) {
10803
+ const obj = lodashEs.get(result, fromPath);
10804
+ if (obj && typeof obj === "object") {
10805
+ delete obj[lastKey];
10806
+ }
10711
10807
  }
10712
10808
  }
10713
- }
10714
- return (transformApplyValuesFromOptions == null ? void 0 : transformApplyValuesFromOptions(result)) || result;
10715
- }, [transformApplyValuesFromOptions, pathMap]);
10809
+ return (transformInitValuesFromOptions == null ? void 0 : transformInitValuesFromOptions(result)) || result;
10810
+ },
10811
+ [transformInitValuesFromOptions, pathMap]
10812
+ );
10813
+ const transformApplyValues = React.useCallback(
10814
+ (values) => {
10815
+ let result = values;
10816
+ for (const { from, to } of pathMap || []) {
10817
+ result = immutableSet(values, from, lodashEs.get(result, to));
10818
+ const toPath = [...to];
10819
+ const lastKey = toPath.pop();
10820
+ if (lastKey) {
10821
+ const obj = lodashEs.get(result, toPath);
10822
+ if (obj && typeof obj === "object") {
10823
+ delete obj[lastKey];
10824
+ }
10825
+ }
10826
+ }
10827
+ return (transformApplyValuesFromOptions == null ? void 0 : transformApplyValuesFromOptions(result)) || result;
10828
+ },
10829
+ [transformApplyValuesFromOptions, pathMap]
10830
+ );
10716
10831
  return {
10717
10832
  transformInitValues,
10718
10833
  transformApplyValues
@@ -10775,278 +10890,276 @@ const ErrorWrapperStyle = "e19q2bnp";
10775
10890
  const YamlEditorStyle = "y16u5v3w";
10776
10891
  const MonacoYamlEditor$3 = React.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$1));
10777
10892
  const MonacoYamlDiffEditor$2 = React.lazy(() => Promise.resolve().then(() => MonacoYamlDiffEditor$1));
10778
- const YamlEditorComponent = React.forwardRef(
10779
- function YamlEditorComponent2(props, ref) {
10780
- const {
10781
- title,
10782
- collapsable = true,
10783
- isDefaultCollapsed,
10784
- value: value2,
10785
- defaultValue = "",
10786
- height,
10787
- readOnly,
10788
- errorMsgs = [],
10789
- schemas,
10790
- eleRef,
10791
- className,
10792
- debounceTime,
10793
- isScrollOnFocus = true,
10794
- isHideActions = false
10795
- } = props;
10796
- const { t: t2 } = common.useTranslation();
10797
- const [isCollapsed, setIsCollapsed] = React.useState(
10798
- collapsable ? isDefaultCollapsed : false
10799
- );
10800
- const [isDiff, setIsDiff] = React.useState(false);
10801
- const [_value, _setValue] = React.useState(value2 || defaultValue);
10802
- const editorInstance = React.useRef();
10803
- const [copyTooltip, setCopyTooltip] = React.useState(t2("dovetail.copy"));
10804
- const [resetTooltip, setResetTooltip] = React.useState(t2("dovetail.reset_arguments"));
10805
- const defaultValueString = React.useMemo(() => {
10806
- if (typeof defaultValue === "string") {
10807
- return defaultValue;
10808
- }
10809
- return yaml$2.dump(defaultValue);
10810
- }, [defaultValue]);
10811
- const _valueString = React.useMemo(() => {
10812
- if (typeof _value === "string") {
10813
- return _value;
10814
- }
10815
- return yaml$2.dump(_value);
10816
- }, [_value]);
10817
- const onChange = React.useCallback(
10818
- (newVal) => {
10819
- var _a;
10820
- _setValue(newVal);
10821
- (_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
10822
- },
10823
- [props.onChange]
10824
- );
10825
- const finalOnChange = React.useMemo(() => {
10826
- return debounceTime ? lodashEs.debounce(onChange, debounceTime) : onChange;
10827
- }, [onChange, debounceTime]);
10828
- const onValidate = React.useCallback(
10829
- (valid, schemaValid) => {
10830
- var _a;
10831
- (_a = props.onValidate) == null ? void 0 : _a.call(props, valid, schemaValid);
10832
- },
10833
- [props.onValidate]
10834
- );
10835
- const onEditorCreate = React.useCallback(
10836
- (editor) => {
10837
- var _a, _b, _c;
10838
- if (editor.getValue() !== _value) {
10839
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
10840
- }
10841
- (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
10842
- },
10843
- [_value, props.onEditorCreate]
10844
- );
10845
- const getInstance = React.useCallback((ins) => {
10846
- editorInstance.current = ins;
10847
- }, []);
10848
- const getEditorValue = React.useCallback(() => {
10893
+ const YamlEditorComponent = React.forwardRef(function YamlEditorComponent2(props, ref) {
10894
+ const {
10895
+ title,
10896
+ collapsable = true,
10897
+ isDefaultCollapsed,
10898
+ value: value2,
10899
+ defaultValue = "",
10900
+ height,
10901
+ readOnly,
10902
+ errorMsgs = [],
10903
+ schemas,
10904
+ eleRef,
10905
+ className,
10906
+ debounceTime,
10907
+ isScrollOnFocus = true,
10908
+ isHideActions = false
10909
+ } = props;
10910
+ const { t: t2 } = common.useTranslation();
10911
+ const [isCollapsed, setIsCollapsed] = React.useState(
10912
+ collapsable ? isDefaultCollapsed : false
10913
+ );
10914
+ const [isDiff, setIsDiff] = React.useState(false);
10915
+ const [_value, _setValue] = React.useState(value2 || defaultValue);
10916
+ const editorInstance = React.useRef();
10917
+ const [copyTooltip, setCopyTooltip] = React.useState(t2("dovetail.copy"));
10918
+ const [resetTooltip, setResetTooltip] = React.useState(t2("dovetail.reset_arguments"));
10919
+ const defaultValueString = React.useMemo(() => {
10920
+ if (typeof defaultValue === "string") {
10921
+ return defaultValue;
10922
+ }
10923
+ return yaml$2.dump(defaultValue);
10924
+ }, [defaultValue]);
10925
+ const _valueString = React.useMemo(() => {
10926
+ if (typeof _value === "string") {
10927
+ return _value;
10928
+ }
10929
+ return yaml$2.dump(_value);
10930
+ }, [_value]);
10931
+ const onChange = React.useCallback(
10932
+ (newVal) => {
10849
10933
  var _a;
10850
- return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
10851
- }, []);
10852
- React.useEffect(() => {
10853
- var _a, _b;
10854
- if (value2 !== void 0 && !lodashEs.isEqual(value2, _value)) {
10855
- const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
10856
- _setValue(value2);
10857
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
10934
+ _setValue(newVal);
10935
+ (_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
10936
+ },
10937
+ [props.onChange]
10938
+ );
10939
+ const finalOnChange = React.useMemo(() => {
10940
+ return debounceTime ? lodashEs.debounce(onChange, debounceTime) : onChange;
10941
+ }, [onChange, debounceTime]);
10942
+ const onValidate = React.useCallback(
10943
+ (valid, schemaValid) => {
10944
+ var _a;
10945
+ (_a = props.onValidate) == null ? void 0 : _a.call(props, valid, schemaValid);
10946
+ },
10947
+ [props.onValidate]
10948
+ );
10949
+ const onEditorCreate = React.useCallback(
10950
+ (editor) => {
10951
+ var _a, _b, _c;
10952
+ if (editor.getValue() !== _value) {
10953
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
10858
10954
  }
10859
- }, [value2]);
10860
- React.useImperativeHandle(ref, () => {
10861
- return {
10862
- setValue: _setValue,
10863
- setEditorValue: (value22) => {
10864
- var _a, _b;
10865
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
10866
- },
10867
- getEditorValue,
10868
- getEditorInstance: () => editorInstance.current || null
10869
- };
10870
- });
10871
- return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
10872
- "div",
10873
- {
10874
- className: common.cx_default(WrapperStyle$4, className),
10875
- "data-is-error": !!errorMsgs.length,
10876
- ref: eleRef,
10877
- children: [
10878
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
10879
- eagle.Space,
10880
- {
10881
- className: common.cx_default(ToolBarStyle, isCollapsed ? "collapsed" : ""),
10882
- direction: "vertical",
10883
- size: 0,
10884
- children: [
10885
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ToolBarHeaderStyle, children: [
10886
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 8, children: [
10887
- collapsable && /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10888
- eagle.Icon,
10889
- {
10890
- src: iconsReact.HierarchyTriangleRight16GrayIcon,
10891
- hoverSrc: iconsReact.HierarchyTriangleRight16BlueIcon,
10892
- className: common.cx_default(IconStyle, isCollapsed ? "" : "arrow-down"),
10893
- iconWidth: 16,
10894
- iconHeight: 16,
10895
- onClick: () => setIsCollapsed(!isCollapsed)
10896
- }
10897
- ),
10898
- /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { className: common.cx_default(TitleStyle$1, "yaml-editor-title"), children: title || t2("dovetail.configure_file") })
10899
- ] }),
10900
- isHideActions ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 14, children: [
10901
- isDiff ? void 0 : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
10902
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10903
- eagle.Tooltip,
10904
- {
10905
- title: isCollapsed ? "" : copyTooltip,
10906
- onVisibleChange: (visible) => {
10907
- if (!visible) {
10908
- setTimeout(() => {
10909
- setCopyTooltip(t2("dovetail.copy"));
10910
- }, 80);
10911
- }
10912
- },
10913
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10914
- eagle.Icon,
10915
- {
10916
- "data-disabled": isCollapsed,
10917
- src: iconsReact.ClipboardCopy16GradientGrayIcon,
10918
- hoverSrc: isCollapsed ? void 0 : iconsReact.ClipboardCopy16GradientBlueIcon,
10919
- className: IconStyle,
10920
- iconWidth: 16,
10921
- iconHeight: 16,
10922
- onClick: () => {
10923
- if (!isCollapsed) {
10924
- copyToClipboard(getEditorValue());
10925
- setCopyTooltip(t2("dovetail.copied"));
10926
- }
10927
- }
10928
- }
10929
- )
10930
- }
10931
- ),
10932
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(Separator, {}),
10933
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10934
- eagle.Tooltip,
10935
- {
10936
- title: isCollapsed ? "" : resetTooltip,
10937
- onVisibleChange: (visible) => {
10938
- if (!visible) {
10939
- setTimeout(() => {
10940
- setResetTooltip(t2("dovetail.reset_arguments"));
10941
- }, 80);
10942
- }
10943
- },
10944
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10945
- eagle.Icon,
10946
- {
10947
- "data-disabled": isCollapsed,
10948
- src: iconsReact.Retry16GradientGrayIcon,
10949
- hoverSrc: isCollapsed ? void 0 : iconsReact.Retry16GradientBlueIcon,
10950
- className: IconStyle,
10951
- iconWidth: 16,
10952
- iconHeight: 16,
10953
- onClick: () => {
10954
- var _a;
10955
- if (!isCollapsed) {
10956
- (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
10957
- setResetTooltip(t2("dovetail.already_reset"));
10958
- }
10959
- }
10960
- }
10961
- )
10962
- }
10963
- ),
10964
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(Separator, {})
10965
- ] }),
10955
+ (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
10956
+ },
10957
+ [_value, props.onEditorCreate]
10958
+ );
10959
+ const getInstance = React.useCallback((ins) => {
10960
+ editorInstance.current = ins;
10961
+ }, []);
10962
+ const getEditorValue = React.useCallback(() => {
10963
+ var _a;
10964
+ return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
10965
+ }, []);
10966
+ React.useEffect(() => {
10967
+ var _a, _b;
10968
+ if (value2 !== void 0 && !lodashEs.isEqual(value2, _value)) {
10969
+ const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
10970
+ _setValue(value2);
10971
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
10972
+ }
10973
+ }, [value2]);
10974
+ React.useImperativeHandle(ref, () => {
10975
+ return {
10976
+ setValue: _setValue,
10977
+ setEditorValue: (value22) => {
10978
+ var _a, _b;
10979
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
10980
+ },
10981
+ getEditorValue,
10982
+ getEditorInstance: () => editorInstance.current || null
10983
+ };
10984
+ });
10985
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
10986
+ "div",
10987
+ {
10988
+ className: common.cx_default(WrapperStyle$4, className),
10989
+ "data-is-error": !!errorMsgs.length,
10990
+ ref: eleRef,
10991
+ children: [
10992
+ /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
10993
+ eagle.Space,
10994
+ {
10995
+ className: common.cx_default(ToolBarStyle, isCollapsed ? "collapsed" : ""),
10996
+ direction: "vertical",
10997
+ size: 0,
10998
+ children: [
10999
+ /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ToolBarHeaderStyle, children: [
11000
+ /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 8, children: [
11001
+ collapsable && /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11002
+ eagle.Icon,
11003
+ {
11004
+ src: iconsReact.HierarchyTriangleRight16GrayIcon,
11005
+ hoverSrc: iconsReact.HierarchyTriangleRight16BlueIcon,
11006
+ className: common.cx_default(IconStyle, isCollapsed ? "" : "arrow-down"),
11007
+ iconWidth: 16,
11008
+ iconHeight: 16,
11009
+ onClick: () => setIsCollapsed(!isCollapsed)
11010
+ }
11011
+ ),
11012
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { className: common.cx_default(TitleStyle$1, "yaml-editor-title"), children: title || t2("dovetail.configure_file") })
11013
+ ] }),
11014
+ isHideActions ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 14, children: [
11015
+ isDiff ? void 0 : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
10966
11016
  /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10967
11017
  eagle.Tooltip,
10968
11018
  {
10969
- title: isCollapsed ? "" : isDiff ? t2("dovetail.back_to_edit") : t2("dovetail.view_changes"),
10970
- children: isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11019
+ title: isCollapsed ? "" : copyTooltip,
11020
+ onVisibleChange: (visible) => {
11021
+ if (!visible) {
11022
+ setTimeout(() => {
11023
+ setCopyTooltip(t2("dovetail.copy"));
11024
+ }, 80);
11025
+ }
11026
+ },
11027
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10971
11028
  eagle.Icon,
10972
11029
  {
10973
11030
  "data-disabled": isCollapsed,
10974
- src: iconsReact.EditPen16GradientGrayIcon,
10975
- hoverSrc: isCollapsed ? void 0 : iconsReact.EditPen16GradientBlueIcon,
11031
+ src: iconsReact.ClipboardCopy16GradientGrayIcon,
11032
+ hoverSrc: isCollapsed ? void 0 : iconsReact.ClipboardCopy16GradientBlueIcon,
10976
11033
  className: IconStyle,
10977
11034
  iconWidth: 16,
10978
11035
  iconHeight: 16,
10979
- onClick: () => isCollapsed ? void 0 : setIsDiff(false)
11036
+ onClick: () => {
11037
+ if (!isCollapsed) {
11038
+ copyToClipboard(getEditorValue());
11039
+ setCopyTooltip(t2("dovetail.copied"));
11040
+ }
11041
+ }
10980
11042
  }
10981
- ) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11043
+ )
11044
+ }
11045
+ ),
11046
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(Separator, {}),
11047
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11048
+ eagle.Tooltip,
11049
+ {
11050
+ title: isCollapsed ? "" : resetTooltip,
11051
+ onVisibleChange: (visible) => {
11052
+ if (!visible) {
11053
+ setTimeout(() => {
11054
+ setResetTooltip(t2("dovetail.reset_arguments"));
11055
+ }, 80);
11056
+ }
11057
+ },
11058
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10982
11059
  eagle.Icon,
10983
11060
  {
10984
11061
  "data-disabled": isCollapsed,
10985
- src: iconsReact.Showdiff16GradientGrayIcon,
10986
- hoverSrc: isCollapsed ? void 0 : iconsReact.Showdiff16GradientBlueIcon,
11062
+ src: iconsReact.Retry16GradientGrayIcon,
11063
+ hoverSrc: isCollapsed ? void 0 : iconsReact.Retry16GradientBlueIcon,
10987
11064
  className: IconStyle,
10988
11065
  iconWidth: 16,
10989
11066
  iconHeight: 16,
10990
- onClick: () => isCollapsed ? void 0 : setIsDiff(true)
11067
+ onClick: () => {
11068
+ var _a;
11069
+ if (!isCollapsed) {
11070
+ (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
11071
+ setResetTooltip(t2("dovetail.already_reset"));
11072
+ }
11073
+ }
10991
11074
  }
10992
11075
  )
10993
11076
  }
10994
- )
10995
- ] })
10996
- ] }),
10997
- errorMsgs.length ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ErrorWrapperStyle, size: 8, align: "start", children: [
10998
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.XmarkFailedSeriousWarningFill16RedIcon, { className: ErrorIconStyle$1 }),
10999
- /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsxs("pre", { className: ErrorMsgStyle, children: [
11000
- errorMsgs.length > 1 ? `${index2 + 1}. ` : "",
11001
- errorMsg
11002
- ] }, errorMsg)) })
11003
- ] }) : void 0
11004
- ]
11005
- }
11006
- ),
11007
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
11008
- "div",
11009
- {
11010
- style: {
11011
- display: isCollapsed ? "none" : "block",
11012
- width: "100%",
11013
- height: height || "500px",
11014
- zIndex: 1
11015
- },
11016
- children: [
11017
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11018
- MonacoYamlEditor$3,
11019
- {
11020
- id: props.id,
11021
- getInstance,
11022
- defaultValue: _value,
11023
- height,
11024
- onChange: finalOnChange,
11025
- onValidate,
11026
- onEditorCreate,
11027
- onBlur: props.onBlur,
11028
- schemas,
11029
- readOnly,
11030
- isScrollOnFocus
11031
- }
11032
- ) }) }),
11033
- isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11034
- MonacoYamlDiffEditor$2,
11035
- {
11036
- id: props.id,
11037
- origin: defaultValueString,
11038
- modified: _valueString,
11039
- height
11040
- }
11041
- ) }) : null
11042
- ]
11043
- }
11044
- )
11045
- ]
11046
- }
11047
- );
11048
- }
11049
- );
11077
+ ),
11078
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(Separator, {})
11079
+ ] }),
11080
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11081
+ eagle.Tooltip,
11082
+ {
11083
+ title: isCollapsed ? "" : isDiff ? t2("dovetail.back_to_edit") : t2("dovetail.view_changes"),
11084
+ children: isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11085
+ eagle.Icon,
11086
+ {
11087
+ "data-disabled": isCollapsed,
11088
+ src: iconsReact.EditPen16GradientGrayIcon,
11089
+ hoverSrc: isCollapsed ? void 0 : iconsReact.EditPen16GradientBlueIcon,
11090
+ className: IconStyle,
11091
+ iconWidth: 16,
11092
+ iconHeight: 16,
11093
+ onClick: () => isCollapsed ? void 0 : setIsDiff(false)
11094
+ }
11095
+ ) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11096
+ eagle.Icon,
11097
+ {
11098
+ "data-disabled": isCollapsed,
11099
+ src: iconsReact.Showdiff16GradientGrayIcon,
11100
+ hoverSrc: isCollapsed ? void 0 : iconsReact.Showdiff16GradientBlueIcon,
11101
+ className: IconStyle,
11102
+ iconWidth: 16,
11103
+ iconHeight: 16,
11104
+ onClick: () => isCollapsed ? void 0 : setIsDiff(true)
11105
+ }
11106
+ )
11107
+ }
11108
+ )
11109
+ ] })
11110
+ ] }),
11111
+ errorMsgs.length ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ErrorWrapperStyle, size: 8, align: "start", children: [
11112
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.XmarkFailedSeriousWarningFill16RedIcon, { className: ErrorIconStyle$1 }),
11113
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsxs("pre", { className: ErrorMsgStyle, children: [
11114
+ errorMsgs.length > 1 ? `${index2 + 1}. ` : "",
11115
+ errorMsg
11116
+ ] }, errorMsg)) })
11117
+ ] }) : void 0
11118
+ ]
11119
+ }
11120
+ ),
11121
+ /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
11122
+ "div",
11123
+ {
11124
+ style: {
11125
+ display: isCollapsed ? "none" : "block",
11126
+ width: "100%",
11127
+ height: height || "500px",
11128
+ zIndex: 1
11129
+ },
11130
+ children: [
11131
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11132
+ MonacoYamlEditor$3,
11133
+ {
11134
+ id: props.id,
11135
+ getInstance,
11136
+ defaultValue: _value,
11137
+ height,
11138
+ onChange: finalOnChange,
11139
+ onValidate,
11140
+ onEditorCreate,
11141
+ onBlur: props.onBlur,
11142
+ schemas,
11143
+ readOnly,
11144
+ isScrollOnFocus
11145
+ }
11146
+ ) }) }),
11147
+ isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11148
+ MonacoYamlDiffEditor$2,
11149
+ {
11150
+ id: props.id,
11151
+ origin: defaultValueString,
11152
+ modified: _valueString,
11153
+ height
11154
+ }
11155
+ ) }) : null
11156
+ ]
11157
+ }
11158
+ )
11159
+ ]
11160
+ }
11161
+ );
11162
+ });
11050
11163
  function copyToClipboard(text) {
11051
11164
  const input = document.createElement("textarea");
11052
11165
  input.value = text;
@@ -11119,14 +11232,7 @@ function use409Retry({
11119
11232
  function useK8sYamlEditor() {
11120
11233
  const foldSymbol = React.useCallback(function(editor, symbol) {
11121
11234
  const model = editor.getModel();
11122
- const matchs = (model == null ? void 0 : model.findMatches(
11123
- symbol,
11124
- false,
11125
- false,
11126
- false,
11127
- "",
11128
- false
11129
- ).filter((match) => match.range.startColumn === 1)) || [];
11235
+ const matchs = (model == null ? void 0 : model.findMatches(symbol, false, false, false, "", false).filter((match) => match.range.startColumn === 1)) || [];
11130
11236
  return new Promise(async (resolve, reject) => {
11131
11237
  try {
11132
11238
  for (const match of matchs) {
@@ -11140,19 +11246,22 @@ function useK8sYamlEditor() {
11140
11246
  }
11141
11247
  });
11142
11248
  }, []);
11143
- const fold2 = React.useCallback(async function(editor) {
11144
- await editor.getAction("editor.unfoldAll").run();
11145
- const symbols = [
11146
- " annotations:",
11147
- " managedFields:",
11148
- "status:",
11149
- " kubectl.kubernetes.io/last-applied-configuration:"
11150
- ];
11151
- for (const symbol of symbols) {
11152
- await foldSymbol(editor, symbol);
11153
- }
11154
- editor.setScrollPosition({ scrollTop: 0 });
11155
- }, [foldSymbol]);
11249
+ const fold2 = React.useCallback(
11250
+ async function(editor) {
11251
+ await editor.getAction("editor.unfoldAll").run();
11252
+ const symbols = [
11253
+ " annotations:",
11254
+ " managedFields:",
11255
+ "status:",
11256
+ " kubectl.kubernetes.io/last-applied-configuration:"
11257
+ ];
11258
+ for (const symbol of symbols) {
11259
+ await foldSymbol(editor, symbol);
11260
+ }
11261
+ editor.setScrollPosition({ scrollTop: 0 });
11262
+ },
11263
+ [foldSymbol]
11264
+ );
11156
11265
  return {
11157
11266
  fold: fold2
11158
11267
  };
@@ -11349,7 +11458,14 @@ const useYamlForm = ({
11349
11458
  pruneBeforeEdit(initialValues2);
11350
11459
  }
11351
11460
  return (transformInitValues == null ? void 0 : transformInitValues(initialValues2)) || initialValues2;
11352
- }, [queryResult, globalStore, initialValuesForCreate, action, initialValuesForEdit, transformInitValues]);
11461
+ }, [
11462
+ queryResult,
11463
+ globalStore,
11464
+ initialValuesForCreate,
11465
+ action,
11466
+ initialValuesForEdit,
11467
+ transformInitValues
11468
+ ]);
11353
11469
  const finalErrors = React.useMemo(() => {
11354
11470
  return lodashEs.uniq([...editorErrors, ...rulesErrors]);
11355
11471
  }, [editorErrors, rulesErrors]);
@@ -11466,13 +11582,16 @@ const useYamlForm = ({
11466
11582
  try {
11467
11583
  let hasErrors = false;
11468
11584
  setIsBeforeSubmitLoading(true);
11469
- const result = await beforeSubmit(finalValues, (errors2) => {
11470
- if (errors2 && errors2.length > 0) {
11471
- setBeforeSubmitErrors(errors2);
11472
- onBeforeSubmitError == null ? void 0 : onBeforeSubmitError(errors2);
11473
- hasErrors = true;
11585
+ const result = await beforeSubmit(
11586
+ finalValues,
11587
+ (errors2) => {
11588
+ if (errors2 && errors2.length > 0) {
11589
+ setBeforeSubmitErrors(errors2);
11590
+ onBeforeSubmitError == null ? void 0 : onBeforeSubmitError(errors2);
11591
+ hasErrors = true;
11592
+ }
11474
11593
  }
11475
- });
11594
+ );
11476
11595
  if (hasErrors) {
11477
11596
  onSubmitAbort == null ? void 0 : onSubmitAbort();
11478
11597
  return;
@@ -11812,6 +11931,7 @@ function RawYamlFormModal(props) {
11812
11931
  },
11813
11932
  okText: ((_c = resourceConfig.formConfig) == null ? void 0 : _c.saveButtonText) || okText,
11814
11933
  destroyOnClose: true,
11934
+ isContentFull: true,
11815
11935
  children: [desc ? /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
11816
11936
  className: FormDescStyle$1,
11817
11937
  children: desc
@@ -11854,8 +11974,9 @@ function useOpenForm() {
11854
11974
  if (formType === void 0 || formType === FormContainerType.MODAL) {
11855
11975
  pushModal({
11856
11976
  component: () => {
11857
- var _a2;
11858
- if (options == null ? void 0 : options.useYamlEditor) {
11977
+ var _a2, _b2, _c;
11978
+ const isYamlOnlyForm = ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formType) !== FormType.FORM && !((_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.CustomFormModal);
11979
+ if ((options == null ? void 0 : options.useYamlEditor) || isYamlOnlyForm) {
11859
11980
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11860
11981
  RawYamlFormModal,
11861
11982
  {
@@ -11868,7 +11989,7 @@ function useOpenForm() {
11868
11989
  }
11869
11990
  );
11870
11991
  }
11871
- const ModalComponent = ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.CustomFormModal) || FormModal;
11992
+ const ModalComponent = ((_c = resourceConfig.formConfig) == null ? void 0 : _c.CustomFormModal) || FormModal;
11872
11993
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11873
11994
  ModalComponent,
11874
11995
  {
@@ -12388,34 +12509,6 @@ function CreateButton(props) {
12388
12509
  }
12389
12510
  );
12390
12511
  }
12391
- const useDeleteManyModal = (resource, ids) => {
12392
- const { mutate } = core.useDeleteMany();
12393
- const [visible, setVisible] = React.useState(false);
12394
- const { t: t2 } = common.useTranslation();
12395
- const modalProps = {
12396
- title: t2("dovetail.delete"),
12397
- okText: t2("dovetail.delete"),
12398
- okButtonProps: {
12399
- danger: true
12400
- },
12401
- cancelText: t2("dovetail.cancel"),
12402
- children: t2("dovetail.confirm_delete_text", {
12403
- target: ids,
12404
- interpolation: { escapeValue: false }
12405
- }),
12406
- onOk() {
12407
- mutate({
12408
- resource,
12409
- ids
12410
- });
12411
- setVisible(false);
12412
- },
12413
- onCancel() {
12414
- setVisible(false);
12415
- }
12416
- };
12417
- return { modalProps, visible, setVisible };
12418
- };
12419
12512
  const DeleteManyButton = (props) => {
12420
12513
  const { resource } = core.useResource();
12421
12514
  const { t: t2 } = common.useTranslation();
@@ -12719,94 +12812,109 @@ const ResourceLink = (props) => {
12719
12812
  value: ""
12720
12813
  });
12721
12814
  };
12722
- const IngressRulesTable = ({ ingress }) => {
12723
- const { t: t2 } = common.useTranslation();
12724
- const { data: serviceData } = core.useList({
12815
+ const IngressRulesTable_1nylejt = "";
12816
+ const PathCellStyle = "pmi0ggi";
12817
+ const PathTextStyle = "p1gmjxeo";
12818
+ const PathCopyStyle = "p1379cb5";
12819
+ const IngressRulesTable = ({
12820
+ ingress: ingress2
12821
+ }) => {
12822
+ const {
12823
+ t: t2
12824
+ } = common.useTranslation();
12825
+ const {
12826
+ data: serviceData
12827
+ } = core.useList({
12725
12828
  resource: "services",
12726
12829
  meta: {
12727
12830
  kind: "Service",
12728
12831
  apiVersion: "v1"
12729
12832
  }
12730
12833
  });
12731
- const flattenedRules = React.useMemo(
12732
- () => (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [],
12733
- [serviceData == null ? void 0 : serviceData.data, ingress]
12734
- );
12834
+ const flattenedRules = React.useMemo(() => (serviceData == null ? void 0 : serviceData.data) ? ingress2.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [], [serviceData == null ? void 0 : serviceData.data, ingress2]);
12735
12835
  const rows = React.useMemo(() => {
12736
12836
  return addId(flattenedRules || [], "fullPath");
12737
12837
  }, [flattenedRules]);
12738
12838
  const component = React.useContext(ComponentContext);
12739
12839
  const Table2 = component.Table || Table$1;
12740
12840
  const currentSize = 10;
12741
- const columns = [
12742
- {
12743
- key: "pathType",
12744
- display: true,
12745
- dataIndex: "pathType",
12746
- title: t2("dovetail.path_type"),
12747
- width: 160,
12748
- sortable: true
12749
- },
12750
- {
12751
- key: "fullPath",
12752
- display: true,
12753
- dataIndex: "fullPath",
12754
- title: t2("dovetail.path"),
12755
- width: 478,
12756
- sortable: true,
12757
- render(value2) {
12758
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(LinkFallback, { fullPath: value2 });
12759
- }
12760
- },
12761
- {
12762
- key: "serviceName",
12763
- display: true,
12764
- dataIndex: "serviceName",
12765
- title: t2("dovetail.target_service"),
12766
- sortable: true,
12767
- width: 160,
12768
- render: (serviceName, record) => {
12769
- return record.serviceName ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12770
- ResourceLink,
12771
- {
12772
- resourceName: "services",
12773
- namespace: ingress.metadata.namespace || "default",
12774
- name: serviceName
12775
- }
12776
- ) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
12841
+ const columns = [{
12842
+ key: "pathType",
12843
+ display: true,
12844
+ dataIndex: "pathType",
12845
+ title: t2("dovetail.path_type"),
12846
+ width: 160,
12847
+ sortable: true
12848
+ }, {
12849
+ key: "fullPath",
12850
+ display: true,
12851
+ dataIndex: "fullPath",
12852
+ title: t2("dovetail.path"),
12853
+ width: 478,
12854
+ sortable: true,
12855
+ render(value2) {
12856
+ if (!value2) {
12857
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
12858
+ value: ""
12859
+ });
12777
12860
  }
12778
- },
12779
- {
12780
- key: "servicePort",
12781
- display: true,
12782
- dataIndex: "servicePort",
12783
- title: t2("dovetail.target_service_port"),
12784
- width: 120,
12785
- sortable: true
12786
- },
12787
- {
12788
- key: "secret",
12789
- display: true,
12790
- dataIndex: "host",
12791
- title: t2("dovetail.cert"),
12792
- width: 160,
12793
- render(host2) {
12794
- var _a, _b;
12795
- const secretName = (_b = (_a = ingress._rawYaml.spec.tls) == null ? void 0 : _a.find(
12796
- ({ hosts }) => hosts == null ? void 0 : hosts.includes(host2)
12797
- )) == null ? void 0 : _b.secretName;
12798
- return secretName ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12799
- ResourceLink,
12800
- {
12801
- resourceName: "secrets",
12802
- namespace: ingress.metadata.namespace || "default",
12803
- name: secretName
12804
- }
12805
- ) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
12806
- },
12807
- sortable: true
12861
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
12862
+ className: PathCellStyle,
12863
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
12864
+ className: PathTextStyle,
12865
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(LinkFallback, {
12866
+ fullPath: value2
12867
+ })
12868
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx(CopyButton, {
12869
+ value: value2,
12870
+ className: PathCopyStyle
12871
+ })]
12872
+ });
12808
12873
  }
12809
- ];
12874
+ }, {
12875
+ key: "serviceName",
12876
+ display: true,
12877
+ dataIndex: "serviceName",
12878
+ title: t2("dovetail.target_service"),
12879
+ sortable: true,
12880
+ width: 160,
12881
+ render: (serviceName, record) => {
12882
+ return record.serviceName ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceLink, {
12883
+ resourceName: "services",
12884
+ namespace: ingress2.metadata.namespace || "default",
12885
+ name: serviceName
12886
+ }) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
12887
+ value: ""
12888
+ });
12889
+ }
12890
+ }, {
12891
+ key: "servicePort",
12892
+ display: true,
12893
+ dataIndex: "servicePort",
12894
+ title: t2("dovetail.target_service_port"),
12895
+ width: 120,
12896
+ sortable: true
12897
+ }, {
12898
+ key: "secret",
12899
+ display: true,
12900
+ dataIndex: "host",
12901
+ title: t2("dovetail.cert"),
12902
+ width: 160,
12903
+ render(host2) {
12904
+ var _a, _b;
12905
+ const secretName = (_b = (_a = ingress2._rawYaml.spec.tls) == null ? void 0 : _a.find(({
12906
+ hosts
12907
+ }) => hosts == null ? void 0 : hosts.includes(host2))) == null ? void 0 : _b.secretName;
12908
+ return secretName ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceLink, {
12909
+ resourceName: "secrets",
12910
+ namespace: ingress2.metadata.namespace || "default",
12911
+ name: secretName
12912
+ }) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
12913
+ value: ""
12914
+ });
12915
+ },
12916
+ sortable: true
12917
+ }];
12810
12918
  const {
12811
12919
  data: finalData,
12812
12920
  currentPage,
@@ -12817,31 +12925,27 @@ const IngressRulesTable = ({ ingress }) => {
12817
12925
  data: rows
12818
12926
  });
12819
12927
  if ((rows == null ? void 0 : rows.length) === 0) {
12820
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12821
- WidgetErrorContent,
12822
- {
12823
- errorText: t2("dovetail.no_resource", { kind: t2("dovetail.rule") }),
12824
- type: ErrorContentType.List
12825
- }
12826
- );
12928
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(WidgetErrorContent, {
12929
+ errorText: t2("dovetail.no_resource", {
12930
+ kind: t2("dovetail.rule")
12931
+ }),
12932
+ type: ErrorContentType.List
12933
+ });
12827
12934
  }
12828
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12829
- Table2,
12830
- {
12831
- tableKey: "ingressRules",
12832
- loading: false,
12833
- data: finalData,
12834
- total: rows.length,
12835
- columns: addDefaultRenderToColumns(columns),
12836
- rowKey: "pathType",
12837
- empty: t2("dovetail.empty"),
12838
- defaultSize: currentSize,
12839
- currentPage,
12840
- onPageChange,
12841
- onSorterChange,
12842
- showMenuColumn: false
12843
- }
12844
- );
12935
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(Table2, {
12936
+ tableKey: "ingressRules",
12937
+ loading: false,
12938
+ data: finalData,
12939
+ total: rows.length,
12940
+ columns: addDefaultRenderToColumns(columns),
12941
+ rowKey: "pathType",
12942
+ empty: t2("dovetail.empty"),
12943
+ defaultSize: currentSize,
12944
+ currentPage,
12945
+ onPageChange,
12946
+ onSorterChange,
12947
+ showMenuColumn: false
12948
+ });
12845
12949
  };
12846
12950
  const KeyValue_1qasuz9 = "";
12847
12951
  const ContentBlockStyle = "c8jy7dc";
@@ -12970,9 +13074,7 @@ function readFileAsBase64(file) {
12970
13074
  if (isUtf8(arrayBuffer)) {
12971
13075
  resolve(await file.text());
12972
13076
  } else {
12973
- const base64String = btoa(
12974
- String.fromCharCode(...new Uint8Array(arrayBuffer))
12975
- );
13077
+ const base64String = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));
12976
13078
  resolve(base64String);
12977
13079
  }
12978
13080
  return;
@@ -13729,7 +13831,7 @@ const StateTag = (props) => {
13729
13831
  }
13730
13832
  );
13731
13833
  };
13732
- const WorkloadPodsTable_975j2t = "";
13834
+ const WorkloadPodsTable_a750q3 = "";
13733
13835
  const WorkloadPodsTable = ({
13734
13836
  namespace: namespace2,
13735
13837
  selector,
@@ -13765,14 +13867,16 @@ const WorkloadPodsTable = ({
13765
13867
  kind: "Pod"
13766
13868
  },
13767
13869
  filters: {
13768
- permanent: [{
13769
- field: "",
13770
- value: "",
13771
- fn(item) {
13772
- return filter ? filter(item) : matchSelector(item, selector, namespace2);
13870
+ permanent: [
13871
+ {
13872
+ field: "",
13873
+ value: "",
13874
+ fn(item) {
13875
+ return filter ? filter(item) : matchSelector(item, selector, namespace2);
13876
+ }
13773
13877
  }
13774
13878
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13775
- }]
13879
+ ]
13776
13880
  }
13777
13881
  }
13778
13882
  });
@@ -14248,7 +14352,8 @@ const ServiceOutClusterAccessField = (clusterVip) => ({
14248
14352
  service: record,
14249
14353
  breakLine: false,
14250
14354
  clusterVip,
14251
- showDashedUnderline: false
14355
+ showDashedUnderline: false,
14356
+ showCopyButton: true
14252
14357
  });
14253
14358
  }
14254
14359
  });
@@ -14266,14 +14371,14 @@ const PodSelectorField = () => ({
14266
14371
  const PortsTableField = () => ({
14267
14372
  key: "ports",
14268
14373
  path: [],
14269
- renderContent: (_, service) => {
14374
+ renderContent: (_, service2) => {
14270
14375
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
14271
14376
  style: {
14272
14377
  padding: "0 24px",
14273
14378
  height: "100%"
14274
14379
  },
14275
14380
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(PortsTable, {
14276
- service
14381
+ service: service2
14277
14382
  })
14278
14383
  });
14279
14384
  }
@@ -14970,11 +15075,11 @@ const NetworkPolicyIngressRulesTab = ({
14970
15075
  fields: [{
14971
15076
  key: "Ingress",
14972
15077
  path: ["spec", "ingress"],
14973
- render: (ingress) => {
15078
+ render: (ingress2) => {
14974
15079
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
14975
15080
  className: NetworkPolicyRulesViewerStyle,
14976
15081
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(NetworkPolicyRulesViewer, {
14977
- ingressOrEgress: ingress
15082
+ ingressOrEgress: ingress2
14978
15083
  })
14979
15084
  });
14980
15085
  }
@@ -15049,7 +15154,9 @@ const PodContainersTable = ({
15049
15154
  const isInit = initContainerStatuses.some(
15050
15155
  (c2) => c2.containerID === record.containerID
15051
15156
  );
15052
- return i18n2.t(isInit ? "dovetail.init_container" : "dovetail.regular_container");
15157
+ return i18n2.t(
15158
+ isInit ? "dovetail.init_container" : "dovetail.regular_container"
15159
+ );
15053
15160
  }
15054
15161
  },
15055
15162
  {
@@ -15079,10 +15186,12 @@ const PodContainersTable = ({
15079
15186
  [i18n2, initContainerStatuses]
15080
15187
  );
15081
15188
  const dataSource = React.useMemo(
15082
- () => addId(containerStatuses.concat(initContainerStatuses), "containerID").map((container2) => ({
15083
- ...container2,
15084
- startedAt: lodashEs.get(container2, ["state", "running", "startedAt"]) || lodashEs.get(container2, ["state", "terminated", "startedAt"])
15085
- })),
15189
+ () => addId(containerStatuses.concat(initContainerStatuses), "containerID").map(
15190
+ (container2) => ({
15191
+ ...container2,
15192
+ startedAt: lodashEs.get(container2, ["state", "running", "startedAt"]) || lodashEs.get(container2, ["state", "terminated", "startedAt"])
15193
+ })
15194
+ ),
15086
15195
  [containerStatuses, initContainerStatuses]
15087
15196
  );
15088
15197
  const {
@@ -15093,10 +15202,12 @@ const PodContainersTable = ({
15093
15202
  } = useTableData({
15094
15203
  data: dataSource,
15095
15204
  columns,
15096
- defaultSorters: [{
15097
- field: "startedAt",
15098
- order: "desc"
15099
- }]
15205
+ defaultSorters: [
15206
+ {
15207
+ field: "startedAt",
15208
+ order: "desc"
15209
+ }
15210
+ ]
15100
15211
  });
15101
15212
  if (dataSource.length === 0) {
15102
15213
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
@@ -15114,7 +15225,9 @@ const PodContainersTable = ({
15114
15225
  loading: false,
15115
15226
  data: finalData,
15116
15227
  total: dataSource.length,
15117
- columns: addDefaultRenderToColumns(columns),
15228
+ columns: addDefaultRenderToColumns(
15229
+ columns
15230
+ ),
15118
15231
  rowKey: "containerID",
15119
15232
  error: false,
15120
15233
  defaultSize: currentSize,
@@ -15237,11 +15350,11 @@ const NetworkPolicyIngressRulesGroup = (i18n2) => ({
15237
15350
  {
15238
15351
  key: "Ingress",
15239
15352
  path: ["spec", "ingress"],
15240
- renderContent: (ingress) => {
15353
+ renderContent: (ingress2) => {
15241
15354
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
15242
15355
  NetworkPolicyRulesViewer,
15243
15356
  {
15244
- ingressOrEgress: ingress,
15357
+ ingressOrEgress: ingress2,
15245
15358
  kind: ` ${i18n2.t("dovetail.ingress_rule")}`
15246
15359
  }
15247
15360
  );
@@ -15295,7 +15408,7 @@ function Tabs(props) {
15295
15408
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
15296
15409
  }) });
15297
15410
  }
15298
- const ShowContentView_11vyp5a = "";
15411
+ const ShowContentView_szlndu = "";
15299
15412
  const ShowContentWrapperStyle = "soapvs9";
15300
15413
  const BackButton = "b13d603q";
15301
15414
  const ToolBarWrapper = "tm8eaia";
@@ -15739,7 +15852,7 @@ function ReplicasDropdown(props) {
15739
15852
  ] });
15740
15853
  }
15741
15854
  const PodShell = React.lazy(
15742
- () => Promise.resolve().then(() => require("./PodShell-43c7028e.cjs")).then((module2) => ({ default: module2.PodShell }))
15855
+ () => Promise.resolve().then(() => require("./PodShell-a335b2b2.cjs")).then((module2) => ({ default: module2.PodShell }))
15743
15856
  );
15744
15857
  function PodShellModal(props) {
15745
15858
  const { pod: pod2 } = props;
@@ -16086,9 +16199,9 @@ function ResourceShow(props) {
16086
16199
  }
16087
16200
  );
16088
16201
  }
16089
- const button_1v659kh = "";
16202
+ const button_a1727f = "";
16090
16203
  const WarningButtonStyle = "wwyz7ti";
16091
- const modal_1eijuvm = "";
16204
+ const modal_1muog24 = "";
16092
16205
  const SmallModalStyle = "s1nc293e";
16093
16206
  const ExtraSubmitFooter_15u4r8u = "";
16094
16207
  const FooterStyle = "f16wn4bu";
@@ -17053,6 +17166,7 @@ const useForm = ({
17053
17166
  const [transformedInitValues, setTransformedInitValues] = React.useState(useHookFormResult.getValues());
17054
17167
  const [beforeSubmitErrors, setBeforeSubmitErrors] = React.useState([]);
17055
17168
  const [isBeforeSubmitLoading, setIsBeforeSubmitLoading] = React.useState(false);
17169
+ const hasAppliedInitialDataRef = React.useRef(false);
17056
17170
  const {
17057
17171
  watch,
17058
17172
  setValue,
@@ -17105,7 +17219,7 @@ const useForm = ({
17105
17219
  }, [captureInitialResource, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data]);
17106
17220
  React.useEffect(() => {
17107
17221
  var _a2;
17108
- if (formState.isDirty)
17222
+ if (hasAppliedInitialDataRef.current || formState.isDirty)
17109
17223
  return;
17110
17224
  const data2 = (_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data;
17111
17225
  if (!data2)
@@ -17123,6 +17237,7 @@ const useForm = ({
17123
17237
  });
17124
17238
  }
17125
17239
  });
17240
+ hasAppliedInitialDataRef.current = true;
17126
17241
  setTransformedInitValues(getValues());
17127
17242
  }, [queryResult == null ? void 0 : queryResult.data, setValue, transformInitValues, formState.isDirty, getValues]);
17128
17243
  React.useEffect(() => {
@@ -17781,31 +17896,43 @@ function CronJobDropdown(props) {
17781
17896
  values: v,
17782
17897
  successNotification() {
17783
17898
  return {
17784
- message: t2(suspended ? "dovetail.resume_success_toast" : "dovetail.pause_success_toast", {
17785
- kind: record.kind,
17786
- name: id,
17787
- interpolation: {
17788
- escapeValue: false
17899
+ message: t2(
17900
+ suspended ? "dovetail.resume_success_toast" : "dovetail.pause_success_toast",
17901
+ {
17902
+ kind: record.kind,
17903
+ name: id,
17904
+ interpolation: {
17905
+ escapeValue: false
17906
+ }
17789
17907
  }
17790
- }),
17908
+ ),
17791
17909
  type: "success"
17792
17910
  };
17793
17911
  },
17794
17912
  errorNotification() {
17795
17913
  return {
17796
- message: t2(suspended ? "dovetail.resume_failed_toast" : "dovetail.pause_failed_toast", {
17797
- kind: record.kind,
17798
- name: id,
17799
- interpolation: {
17800
- escapeValue: false
17914
+ message: t2(
17915
+ suspended ? "dovetail.resume_failed_toast" : "dovetail.pause_failed_toast",
17916
+ {
17917
+ kind: record.kind,
17918
+ name: id,
17919
+ interpolation: {
17920
+ escapeValue: false
17921
+ }
17801
17922
  }
17802
- }),
17923
+ ),
17803
17924
  type: "error"
17804
17925
  };
17805
17926
  }
17806
17927
  });
17807
17928
  },
17808
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, { src: suspended ? iconsReact.RecoverContinue16GradientBlueIcon : iconsReact.Pause16GradientBlueIcon, children: t2(suspended ? "dovetail.resume" : "dovetail.suspend") })
17929
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17930
+ eagle.Icon,
17931
+ {
17932
+ src: suspended ? iconsReact.RecoverContinue16GradientBlueIcon : iconsReact.Pause16GradientBlueIcon,
17933
+ children: t2(suspended ? "dovetail.resume" : "dovetail.suspend")
17934
+ }
17935
+ )
17809
17936
  }
17810
17937
  ) : null });
17811
17938
  }
@@ -18322,7 +18449,9 @@ const DeleteButton = () => {
18322
18449
  const { resource } = core.useResource();
18323
18450
  const { id } = core.useParsed();
18324
18451
  const { t: t2 } = common.useTranslation();
18325
- const { openDeleteConfirmModal } = useDeleteModal({ resourceName: (resource == null ? void 0 : resource.name) || "" });
18452
+ const { openDeleteConfirmModal } = useDeleteModal({
18453
+ resourceName: (resource == null ? void 0 : resource.name) || ""
18454
+ });
18326
18455
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(common.jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
18327
18456
  eagle.Button,
18328
18457
  {
@@ -18333,7 +18462,7 @@ const DeleteButton = () => {
18333
18462
  }
18334
18463
  ) });
18335
18464
  };
18336
- const index_1tehui8 = "";
18465
+ const index_e6cgji = "";
18337
18466
  const MenuStyle = "mdppgn0";
18338
18467
  const Menu = () => {
18339
18468
  const {
@@ -19470,9 +19599,9 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
19470
19599
  });
19471
19600
  const nodePortsFromOtherServices = React.useMemo(() => {
19472
19601
  var _a;
19473
- return ((_a = services == null ? void 0 : services.data) == null ? void 0 : _a.filter((service) => service.id !== serviceId).map((service) => {
19602
+ return ((_a = services == null ? void 0 : services.data) == null ? void 0 : _a.filter((service2) => service2.id !== serviceId).map((service2) => {
19474
19603
  var _a2, _b;
19475
- return (_b = (_a2 = service == null ? void 0 : service.spec) == null ? void 0 : _a2.ports) == null ? void 0 : _b.map((port2) => port2.nodePort);
19604
+ return (_b = (_a2 = service2 == null ? void 0 : service2.spec) == null ? void 0 : _a2.ports) == null ? void 0 : _b.map((port2) => port2.nodePort);
19476
19605
  }).flat().filter((port2) => port2 !== void 0)) || [];
19477
19606
  }, [services, serviceId]);
19478
19607
  const columns = React.useMemo(() => {
@@ -19665,7 +19794,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
19665
19794
  }
19666
19795
  );
19667
19796
  });
19668
- const IngressRulesComponent = ({ ingress, noLink }) => {
19797
+ const IngressRulesComponent = ({ ingress: ingress2, noLink }) => {
19669
19798
  const { data: serviceData } = core.useList({
19670
19799
  resource: "services",
19671
19800
  meta: {
@@ -19673,12 +19802,12 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19673
19802
  apiVersion: "v1"
19674
19803
  }
19675
19804
  });
19676
- const flattenedRules = (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [];
19805
+ const flattenedRules = (serviceData == null ? void 0 : serviceData.data) ? ingress2.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [];
19677
19806
  const result = flattenedRules.map((r2) => {
19678
19807
  var _a, _b;
19679
19808
  const arrow = " → ";
19680
19809
  const divider = " | ";
19681
- const secretName = (_b = (_a = ingress.spec.tls) == null ? void 0 : _a.find(
19810
+ const secretName = (_b = (_a = ingress2.spec.tls) == null ? void 0 : _a.find(
19682
19811
  ({ hosts }) => hosts == null ? void 0 : hosts.includes(r2.host || "")
19683
19812
  )) == null ? void 0 : _b.secretName;
19684
19813
  let tooltip = r2.fullPath;
@@ -19699,7 +19828,7 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19699
19828
  ResourceLink,
19700
19829
  {
19701
19830
  resourceName: "services",
19702
- namespace: ingress.metadata.namespace || "default",
19831
+ namespace: ingress2.metadata.namespace || "default",
19703
19832
  name: r2.serviceName
19704
19833
  }
19705
19834
  ),
@@ -19714,7 +19843,7 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19714
19843
  ResourceLink,
19715
19844
  {
19716
19845
  resourceName: "secrets",
19717
- namespace: ingress.metadata.namespace || "default",
19846
+ namespace: ingress2.metadata.namespace || "default",
19718
19847
  name: secretName
19719
19848
  }
19720
19849
  )
@@ -20083,7 +20212,10 @@ function ServiceOutClusterAccessTitle() {
20083
20212
  })
20084
20213
  });
20085
20214
  }
20086
- const ServiceOutClusterAccessColumnRenderer = (clusterVip) => {
20215
+ const ServiceOutClusterAccessColumnRenderer = (_i18n, options) => {
20216
+ const {
20217
+ clusterVip
20218
+ } = options;
20087
20219
  return {
20088
20220
  key: "outClusterAccess",
20089
20221
  title: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
@@ -20123,10 +20255,8 @@ const PodWorkloadColumnRenderer = (i18n2) => {
20123
20255
  }
20124
20256
  };
20125
20257
  };
20126
- const IngressRulesColumnRenderer = ({
20127
- i18n: i18n2,
20128
- noLink
20129
- }) => {
20258
+ const IngressRulesColumnRenderer = (i18n2, options) => {
20259
+ const noLink = options == null ? void 0 : options.noLink;
20130
20260
  const dataIndex = ["spec", "rules"];
20131
20261
  return {
20132
20262
  key: "type",
@@ -20587,39 +20717,45 @@ const Dovetail = (props) => {
20587
20717
  antd4Configs: {
20588
20718
  getPopupContainer: antdGetPopupContainer || (() => document.body)
20589
20719
  },
20590
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: globalStoreMap, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
20591
- core.Refine,
20720
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
20721
+ GlobalStoreContext.Provider,
20592
20722
  {
20593
- dataProvider: k8sApiProvider.dataProvider(globalStoreMap.default),
20594
- liveProvider: k8sApiProvider.liveProvider(globalStoreMap.default),
20595
- routerProvider,
20596
- notificationProvider,
20597
- options: {
20598
- warnWhenUnsavedChanges: true,
20599
- liveMode: "auto",
20600
- disableTelemetry: true
20601
- },
20602
- accessControlProvider,
20603
- resources: resourcesConfig.map((c2) => {
20604
- return {
20605
- name: c2.name,
20606
- meta: {
20607
- dataProviderName: c2.dataProviderName,
20608
- resourceBasePath: c2.basePath,
20609
- kind: c2.kind,
20610
- parent: c2.parent,
20611
- label: `${c2.kind}s`
20723
+ value: globalStoreMap,
20724
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
20725
+ core.Refine,
20726
+ {
20727
+ dataProvider: k8sApiProvider.dataProvider(globalStoreMap.default),
20728
+ liveProvider: k8sApiProvider.liveProvider(globalStoreMap.default),
20729
+ routerProvider,
20730
+ notificationProvider,
20731
+ options: {
20732
+ warnWhenUnsavedChanges: true,
20733
+ liveMode: "auto",
20734
+ disableTelemetry: true
20612
20735
  },
20613
- list: `${urlPrefix}/${c2.name}`,
20614
- show: `${urlPrefix}/${c2.name}/show`,
20615
- create: `${urlPrefix}/${c2.name}/create`,
20616
- edit: `${urlPrefix}/${c2.name}/edit`
20617
- };
20618
- }),
20619
- ...props,
20620
- children: content
20736
+ accessControlProvider,
20737
+ resources: resourcesConfig.map((c2) => {
20738
+ return {
20739
+ name: c2.name,
20740
+ meta: {
20741
+ dataProviderName: c2.dataProviderName,
20742
+ resourceBasePath: c2.basePath,
20743
+ kind: c2.kind,
20744
+ parent: c2.parent,
20745
+ label: `${c2.kind}s`
20746
+ },
20747
+ list: `${urlPrefix}/${c2.name}`,
20748
+ show: `${urlPrefix}/${c2.name}/show`,
20749
+ create: `${urlPrefix}/${c2.name}/create`,
20750
+ edit: `${urlPrefix}/${c2.name}/edit`
20751
+ };
20752
+ }),
20753
+ ...props,
20754
+ children: content
20755
+ }
20756
+ )
20621
20757
  }
20622
- ) })
20758
+ )
20623
20759
  }
20624
20760
  ) }) }) }) });
20625
20761
  };
@@ -20680,8 +20816,8 @@ class ModelPlugin {
20680
20816
  restoreItem(item) {
20681
20817
  return item._rawYaml;
20682
20818
  }
20683
- setModelMap(key2, model) {
20684
- this.ModelMap.set(key2, model);
20819
+ setModelMap(key2, ModelClass) {
20820
+ this.ModelMap.set(key2, ModelClass);
20685
20821
  }
20686
20822
  }
20687
20823
  const modelPlugin = new ModelPlugin();
@@ -20786,12 +20922,14 @@ exports.ClusterIpField = ClusterIpField;
20786
20922
  exports.ColumnKeys = ColumnKeys;
20787
20923
  exports.CommonSorter = CommonSorter;
20788
20924
  exports.ComponentContext = ComponentContext;
20925
+ exports.ComponentContextProvider = ComponentContextProvider;
20789
20926
  exports.ConditionsField = ConditionsField;
20790
20927
  exports.ConditionsGroup = ConditionsGroup;
20791
20928
  exports.ConditionsTab = ConditionsTab;
20792
20929
  exports.ConditionsTable = ConditionsTable;
20793
20930
  exports.ConfigsContext = ConfigsContext;
20794
20931
  exports.ControllerRevisionModel = ControllerRevisionModel;
20932
+ exports.CopyButton = CopyButton;
20795
20933
  exports.CreateButton = CreateButton;
20796
20934
  exports.CronJobDropdown = CronJobDropdown;
20797
20935
  exports.CronJobModel = CronJobModel;
@@ -20819,7 +20957,7 @@ exports.EditLabelDropdownMenuItem = EditLabelDropdownMenuItem;
20819
20957
  exports.EditLabelForm = EditLabelForm;
20820
20958
  exports.EditNodeTaintDropdownMenuItem = EditNodeTaintDropdownMenuItem;
20821
20959
  exports.EditNodeTaintForm = EditNodeTaintForm;
20822
- exports.ErrorContent = WidgetErrorContent;
20960
+ exports.ErrorContent = ErrorContent;
20823
20961
  exports.ErrorContentType = ErrorContentType;
20824
20962
  exports.ErrorWrapper = ErrorWrapper;
20825
20963
  exports.EventModel = EventModel;
@@ -21028,6 +21166,7 @@ exports.TextTags = TextTags;
21028
21166
  exports.Time = Time;
21029
21167
  exports.ValidateRfc1035Name = ValidateRfc1035Name;
21030
21168
  exports.ValueDisplay = index;
21169
+ exports.WidgetErrorContent = WidgetErrorContent;
21031
21170
  exports.WorkloadBaseModel = WorkloadBaseModel;
21032
21171
  exports.WorkloadDropdown = WorkloadDropdown;
21033
21172
  exports.WorkloadImageColumnRenderer = WorkloadImageColumnRenderer;
@@ -21038,7 +21177,6 @@ exports.WorkloadReplicasForm = WorkloadReplicasForm;
21038
21177
  exports.YamlEditorComponent = YamlEditorComponent;
21039
21178
  exports.YamlForm = YamlForm;
21040
21179
  exports.addDefaultRenderToColumns = addDefaultRenderToColumns;
21041
- exports.dnsSubDomainRules = dnsSubDomainRules;
21042
21180
  exports.dovetailRefineI18n = dovetailRefineI18n;
21043
21181
  exports.generateSchemaTypeValue = generateSchemaTypeValue;
21044
21182
  exports.generateValueFromSchema = generateValueFromSchema;
@@ -21052,12 +21190,11 @@ exports.pruneBeforeEdit = pruneBeforeEdit;
21052
21190
  exports.relationPlugin = relationPlugin;
21053
21191
  exports.renderCommonFormFiled = renderCommonFormFiled;
21054
21192
  exports.resolveRef = resolveRef;
21055
- exports.rfc1035LabelRules = rfc1035LabelRules;
21056
- exports.rfc1123LabelRules = rfc1123LabelRules;
21057
21193
  exports.routerProvider = routerProvider;
21058
21194
  exports.shortenedImage = shortenedImage;
21059
21195
  exports.transformResourceKindInSentence = transformResourceKindInSentence;
21060
21196
  exports.useApiGroupSchema = useApiGroupSchema;
21197
+ exports.useDeleteManyModal = useDeleteManyModal;
21061
21198
  exports.useDeleteModal = useDeleteModal;
21062
21199
  exports.useDeleteModalOnly = useDeleteModalOnly;
21063
21200
  exports.useDownloadYAML = useDownloadYAML;