@dovetail-v2/refine 0.3.0 → 0.3.2

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 (35) hide show
  1. package/dist/{MonacoYamlEditor-1ed09191.cjs → MonacoYamlEditor-bdd52136.cjs} +15 -7
  2. package/dist/{MonacoYamlEditor-74ecf0d5.js → MonacoYamlEditor-d09e7de9.js} +15 -7
  3. package/dist/components/Form/FormModal.d.ts +2 -0
  4. package/dist/components/Form/RefineFormContainer.d.ts +2 -1
  5. package/dist/components/Form/YamlForm.d.ts +2 -2
  6. package/dist/components/Form/YamlFormContainer.d.ts +3 -2
  7. package/dist/components/Form/type.d.ts +11 -1
  8. package/dist/components/KeyValueTableForm/index.d.ts +34 -0
  9. package/dist/components/ShowContent/ShowContent.d.ts +4 -16
  10. package/dist/components/ShowContent/ShowContentView.d.ts +21 -0
  11. package/dist/components/ShowContent/fields.d.ts +1 -0
  12. package/dist/components/ShowContent/index.d.ts +1 -0
  13. package/dist/components/YamlEditor/MonacoYamlEditor.d.ts +5 -5
  14. package/dist/components/YamlEditor/YamlEditorComponent.d.ts +9 -7
  15. package/dist/components/index.d.ts +1 -0
  16. package/dist/hooks/useEagleTable/columns.d.ts +1 -1
  17. package/dist/hooks/useOpenForm.d.ts +5 -2
  18. package/dist/i18n.d.ts +1 -0
  19. package/dist/{index-23ef5f69.js → index-3126e84d.js} +881 -586
  20. package/dist/{index-7c78ef6f.cjs → index-ec66ac8f.cjs} +770 -475
  21. package/dist/locales/zh-CN/index.d.ts +1 -0
  22. package/dist/models/deployment-model.d.ts +5 -1
  23. package/dist/models/index.d.ts +1 -1
  24. package/dist/models/replicaset-model.d.ts +17 -0
  25. package/dist/models/service-model.d.ts +4 -0
  26. package/dist/models/workload-model.d.ts +6 -0
  27. package/dist/refine.cjs +8 -1
  28. package/dist/refine.js +114 -107
  29. package/dist/style.css +171 -162
  30. package/dist/utils/file.d.ts +1 -0
  31. package/dist/utils/index.d.ts +1 -0
  32. package/dist/utils/match-selector.d.ts +2 -2
  33. package/dist/utils/validation.d.ts +5 -1
  34. package/package.json +1 -1
  35. package/dist/components/EditMetadataForm/KeyValueTableForm.d.ts +0 -16
@@ -7,14 +7,14 @@ var __publicField = (obj, key2, value2) => {
7
7
  import dayjs from "dayjs";
8
8
  import i18n from "i18next";
9
9
  import { w as warnOnce, g as getDefaults, a as warn, b as getI18n, s as setDefaults, d as setI18n, I as I18nContext, j as jsxRuntimeExports, u as useTranslation, c as cx_default, S as SocketStatus } from "./common-feae5742.js";
10
- import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, CanAccess, useUpdate, useParsed, useGo, useCan, useTable, useDeleteMany, useShow, useDataProvider, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, Refine } from "@refinedev/core";
10
+ import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, CanAccess, useUpdate, useParsed, useGo, useCan, useTable, useDeleteMany, useDataProvider, useShow, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, Refine } from "@refinedev/core";
11
11
  import { parse, stringify } from "qs";
12
12
  import * as React from "react";
13
13
  import React__default, { createElement, isValidElement, cloneElement, Children, useContext, useCallback, createContext, useState, useEffect, useMemo, useRef, useImperativeHandle, lazy, Suspense, forwardRef } from "react";
14
14
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
15
- import { usePushModal, usePopModal, DeleteDialog, Tag, RejectDialog, RejectDialogType, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Typo, Loading, Table as Table$2, Pagination, Alert, Modal, Fields, Units, Link as Link$1, OverflowTooltip, Tooltip, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, StatusCapsule, Tabs as Tabs$1, TabsTabPane, Row, Col, Popover, AntdTable, TableForm, getOptions, DonutChart, SegmentControl, Checkbox, useMessage, SearchInput, Token, AntdSelectOptGroup, MenuItemGroup, Layout as Layout$1, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
16
- import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, OpenTerminal16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
17
- import { first, get as get$2, cloneDeep, set, omit as omit$1, merge, debounce, last, setWith, clone, isObject as isObject$3, uniq, keyBy } from "lodash-es";
15
+ import { usePushModal, usePopModal, DeleteDialog, Tag, RejectDialog, RejectDialogType, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Typo, Loading, Table as Table$2, Pagination, Alert, Modal, Fields, Units, Link as Link$1, OverflowTooltip, Tooltip, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, StatusCapsule, Popover, AntdTable, TableForm, Upload, getOptions, DonutChart, SegmentControl, Checkbox, Tabs as Tabs$1, TabsTabPane, Row, Col, useMessage, SearchInput, Token, AntdSelectOptGroup, MenuItemGroup, Layout as Layout$1, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
16
+ import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, Retry16GradientBlueIcon, OpenTerminal16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
17
+ import { first, get as get$2, cloneDeep, set, omit as omit$1, merge, isEqual, debounce, last, setWith, clone, isObject as isObject$3, uniq, keyBy } from "lodash-es";
18
18
  import yaml$2 from "js-yaml";
19
19
  import { useLocalStorage } from "usehooks-ts";
20
20
  import { paginateData, sortData, dataProvider, liveProvider } from "k8s-api-provider";
@@ -1163,6 +1163,7 @@ const confirm = "确认";
1163
1163
  const cant_delete_resource = "无法删除{{resource}}";
1164
1164
  const cant_delete_resource_with_name = "无法删除{{resource}} <0>{{name}}</0> 。";
1165
1165
  const close = "关闭";
1166
+ const import_from_file = "从文件读取";
1166
1167
  const dovetail = {
1167
1168
  copy,
1168
1169
  reset_arguments,
@@ -1404,7 +1405,8 @@ const dovetail = {
1404
1405
  confirm,
1405
1406
  cant_delete_resource,
1406
1407
  cant_delete_resource_with_name,
1407
- close
1408
+ close,
1409
+ import_from_file
1408
1410
  };
1409
1411
  const ZH = {
1410
1412
  dovetail
@@ -5615,7 +5617,7 @@ lodash.exports;
5615
5617
  }
5616
5618
  return true;
5617
5619
  }
5618
- function isEqual(value2, other) {
5620
+ function isEqual2(value2, other) {
5619
5621
  return baseIsEqual(value2, other);
5620
5622
  }
5621
5623
  function isEqualWith(value2, other, customizer) {
@@ -6728,7 +6730,7 @@ lodash.exports;
6728
6730
  lodash2.isDate = isDate;
6729
6731
  lodash2.isElement = isElement;
6730
6732
  lodash2.isEmpty = isEmpty;
6731
- lodash2.isEqual = isEqual;
6733
+ lodash2.isEqual = isEqual2;
6732
6734
  lodash2.isEqualWith = isEqualWith;
6733
6735
  lodash2.isError = isError;
6734
6736
  lodash2.isFinite = isFinite2;
@@ -9252,7 +9254,7 @@ var ResourceState = /* @__PURE__ */ ((ResourceState2) => {
9252
9254
  return ResourceState2;
9253
9255
  })(ResourceState || {});
9254
9256
  function matchSelector(pod2, selector, namespace2 = "default") {
9255
- var _a, _b, _c;
9257
+ var _a, _b, _c, _d;
9256
9258
  let match = true;
9257
9259
  if (selector) {
9258
9260
  for (const key2 in selector.matchLabels) {
@@ -9261,7 +9263,7 @@ function matchSelector(pod2, selector, namespace2 = "default") {
9261
9263
  }
9262
9264
  }
9263
9265
  }
9264
- return match && pod2.metadata.namespace === namespace2;
9266
+ return match && ((_d = pod2.metadata) == null ? void 0 : _d.namespace) === namespace2;
9265
9267
  }
9266
9268
  class WorkloadBaseModel extends ResourceModel {
9267
9269
  constructor(_rawYaml, _globalStore) {
@@ -9351,10 +9353,14 @@ class WorkloadModel extends WorkloadBaseModel {
9351
9353
  constructor(_rawYaml, _globalStore) {
9352
9354
  super(_rawYaml, _globalStore);
9353
9355
  __publicField(this, "restarts", 0);
9356
+ __publicField(this, "services", []);
9357
+ __publicField(this, "ingresses", []);
9354
9358
  this._rawYaml = _rawYaml;
9355
9359
  }
9356
9360
  async init() {
9357
9361
  await this.getRestarts();
9362
+ await this.getServices();
9363
+ await this.getIngresses();
9358
9364
  }
9359
9365
  async getRestarts() {
9360
9366
  const pods = await this._globalStore.get("pods", {
@@ -9370,6 +9376,29 @@ class WorkloadModel extends WorkloadBaseModel {
9370
9376
  const result = lodashExports.sumBy(myPods, "restarts");
9371
9377
  this.restarts = result;
9372
9378
  }
9379
+ async getServices() {
9380
+ const services = await this._globalStore.get("services", {
9381
+ resourceBasePath: "/api/v1",
9382
+ kind: "Service"
9383
+ });
9384
+ const myServices = services.items.filter(
9385
+ (p) => {
9386
+ var _a;
9387
+ return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9388
+ }
9389
+ );
9390
+ this.services = myServices;
9391
+ }
9392
+ async getIngresses() {
9393
+ const allIngresses = /* @__PURE__ */ new Map();
9394
+ for (const service of this.services) {
9395
+ for (const ingress of service.ingresses) {
9396
+ const key2 = `${ingress.namespace}-${ingress.name}`;
9397
+ allIngresses.set(key2, ingress);
9398
+ }
9399
+ }
9400
+ this.ingresses = Array.from(allIngresses.values());
9401
+ }
9373
9402
  get replicas() {
9374
9403
  return this.spec && "replicas" in this.spec ? this.spec.replicas : 0;
9375
9404
  }
@@ -9510,6 +9539,38 @@ class PodMetricsModel extends ResourceModel {
9510
9539
  };
9511
9540
  }
9512
9541
  }
9542
+ class ReplicaSetModel extends ResourceModel {
9543
+ constructor(_rawYaml, _globalStore) {
9544
+ super(_rawYaml, _globalStore);
9545
+ __publicField(this, "pods", []);
9546
+ __publicField(this, "restarts", 0);
9547
+ this._rawYaml = _rawYaml;
9548
+ }
9549
+ async init() {
9550
+ await this.getPods();
9551
+ }
9552
+ async getPods() {
9553
+ const pods = await this._globalStore.get("pods", {
9554
+ resourceBasePath: "/api/v1",
9555
+ kind: "Pod"
9556
+ });
9557
+ const myPods = pods.items.filter(
9558
+ (pod2) => {
9559
+ var _a;
9560
+ return matchSelector(pod2, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9561
+ }
9562
+ );
9563
+ this.pods = myPods;
9564
+ this.restarts = lodashExports.sumBy(this.pods, (pod2) => pod2.restarts || 0);
9565
+ }
9566
+ get ownerDeploymentName() {
9567
+ var _a;
9568
+ const ownerRef = (_a = this.metadata.ownerReferences) == null ? void 0 : _a.find(
9569
+ (ref) => ref.kind === "Deployment" && ref.apiVersion === "apps/v1"
9570
+ );
9571
+ return ownerRef == null ? void 0 : ownerRef.name;
9572
+ }
9573
+ }
9513
9574
  class CronJobModel extends WorkloadBaseModel {
9514
9575
  constructor(_rawYaml, _globalStore) {
9515
9576
  super(_rawYaml, _globalStore);
@@ -9552,8 +9613,27 @@ class EventModel extends ResourceModel {
9552
9613
  class DeploymentModel extends WorkloadModel {
9553
9614
  constructor(_rawYaml, _globalStore) {
9554
9615
  super(_rawYaml, _globalStore);
9616
+ __publicField(this, "replicaSets", []);
9555
9617
  this._rawYaml = _rawYaml;
9556
9618
  }
9619
+ async init() {
9620
+ await super.init();
9621
+ await this.getReplicaSets();
9622
+ }
9623
+ async getReplicaSets() {
9624
+ const replicaSets = await this._globalStore.get("replicasets", {
9625
+ resourceBasePath: "/apis/apps/v1",
9626
+ kind: "ReplicaSet"
9627
+ });
9628
+ const myReplicaSets = replicaSets.items.filter((rs) => {
9629
+ var _a, _b, _c;
9630
+ const ownerRef = (_b = (_a = rs.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.find(
9631
+ (ref) => ref.kind === "Deployment" && ref.apiVersion === "apps/v1" && ref.name === this.name && ref.uid === this.metadata.uid
9632
+ );
9633
+ return !!ownerRef && ((_c = rs.metadata) == null ? void 0 : _c.namespace) === this.metadata.namespace;
9634
+ });
9635
+ this.replicaSets = myReplicaSets;
9636
+ }
9557
9637
  get stateDisplay() {
9558
9638
  var _a, _b, _c;
9559
9639
  if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
@@ -9609,8 +9689,25 @@ var ServiceTypeEnum = /* @__PURE__ */ ((ServiceTypeEnum2) => {
9609
9689
  class ServiceModel extends ResourceModel {
9610
9690
  constructor(_rawYaml, _globalStore) {
9611
9691
  super(_rawYaml, _globalStore);
9692
+ __publicField(this, "ingresses", []);
9612
9693
  this._rawYaml = _rawYaml;
9613
9694
  }
9695
+ async init() {
9696
+ await this.getIngresses();
9697
+ }
9698
+ async getIngresses() {
9699
+ const ingresses = await this._globalStore.get("ingresses", {
9700
+ resourceBasePath: "/apis/networking.k8s.io/v1",
9701
+ kind: "Ingress"
9702
+ });
9703
+ const myIngresses = ingresses.items.filter((ingress) => {
9704
+ const rules = ingress.getFlattenedRules([]);
9705
+ return rules.some(
9706
+ (rule2) => rule2.serviceName === this.name
9707
+ );
9708
+ });
9709
+ this.ingresses = myIngresses;
9710
+ }
9614
9711
  get displayType() {
9615
9712
  const spec = this._rawYaml.spec;
9616
9713
  const type2 = spec.type;
@@ -10176,29 +10273,38 @@ function getInitialValues(config) {
10176
10273
  spec: {}
10177
10274
  };
10178
10275
  }
10179
- function useOpenForm(options) {
10276
+ function useOpenForm() {
10180
10277
  const { resource } = useResource();
10181
10278
  const configs = useContext(ConfigsContext);
10182
10279
  const { edit: edit2 } = useEdit();
10183
10280
  const navigation = useNavigation();
10184
10281
  const pushModal = usePushModal();
10185
10282
  const go = useGo();
10186
- return function openForm(resourceName) {
10187
- var _a, _b;
10188
- const finalResourceName = resourceName || (resource == null ? void 0 : resource.name);
10283
+ return function openForm(options) {
10284
+ var _a;
10285
+ const finalResourceName = (options == null ? void 0 : options.resourceName) || (resource == null ? void 0 : resource.name);
10189
10286
  if (finalResourceName) {
10190
10287
  const config = configs[finalResourceName];
10191
10288
  const formType = (_a = config.formConfig) == null ? void 0 : _a.formContainerType;
10192
10289
  if (formType === void 0 || formType === FormContainerType.MODAL) {
10193
10290
  pushModal({
10194
- component: ((_b = config.formConfig) == null ? void 0 : _b.CustomFormModal) || FormModal,
10195
- props: {
10196
- resource: finalResourceName,
10197
- id: options == null ? void 0 : options.id,
10198
- formProps: {
10199
- initialValues: getInitialValues(config)
10200
- }
10201
- }
10291
+ component: () => {
10292
+ var _a2;
10293
+ const ModalComponent = ((_a2 = config.formConfig) == null ? void 0 : _a2.CustomFormModal) || FormModal;
10294
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10295
+ ModalComponent,
10296
+ {
10297
+ resource: finalResourceName,
10298
+ id: options == null ? void 0 : options.id,
10299
+ yamlFormProps: {
10300
+ config,
10301
+ initialValuesForCreate: getInitialValues(config)
10302
+ },
10303
+ onSuccess: options == null ? void 0 : options.onSuccess
10304
+ }
10305
+ );
10306
+ },
10307
+ props: {}
10202
10308
  });
10203
10309
  } else if (options == null ? void 0 : options.id) {
10204
10310
  edit2(options.id);
@@ -10217,6 +10323,52 @@ function getResourceNameByKind(kind, configs) {
10217
10323
  var _a;
10218
10324
  return (_a = Object.values(configs).find((config) => config.kind === kind)) == null ? void 0 : _a.name;
10219
10325
  }
10326
+ function validateDnsSubdomain(subdomain) {
10327
+ const regex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-\_]*[a-zA-Z0-9]$)/;
10328
+ if (!regex.test(subdomain)) {
10329
+ return { isValid: false };
10330
+ }
10331
+ if (subdomain && subdomain.length > 63) {
10332
+ return { isValid: false };
10333
+ }
10334
+ return { isValid: true };
10335
+ }
10336
+ function validateLabelKey(key2) {
10337
+ const labelRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-\_]*[a-zA-Z0-9]$)/;
10338
+ let prefix2, name2;
10339
+ const splitResult = key2.split("/");
10340
+ if (splitResult.length === 1) {
10341
+ name2 = splitResult[0];
10342
+ } else {
10343
+ prefix2 = splitResult[0];
10344
+ name2 = splitResult[1];
10345
+ }
10346
+ if (prefix2 === "") {
10347
+ return { isValid: false };
10348
+ }
10349
+ if (prefix2 && !labelRegex.test(prefix2)) {
10350
+ return { isValid: false };
10351
+ }
10352
+ if (prefix2 && prefix2.length > 253) {
10353
+ return { isValid: false };
10354
+ }
10355
+ return validateDnsSubdomain(name2);
10356
+ }
10357
+ function validateLabelValue(value2, isOptional) {
10358
+ const labelValueRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-\_]*[a-zA-Z0-9]$)/;
10359
+ if (isOptional && value2 === "") {
10360
+ return { isValid: true };
10361
+ } else if (value2 === "") {
10362
+ return { isValid: false };
10363
+ }
10364
+ if (value2.length > 63) {
10365
+ return { isValid: false };
10366
+ }
10367
+ if (!labelValueRegex.test(value2)) {
10368
+ return { isValid: false };
10369
+ }
10370
+ return { isValid: true };
10371
+ }
10220
10372
  function K8sDropdown(props) {
10221
10373
  var _a;
10222
10374
  const { record, size = "normal" } = props;
@@ -10228,7 +10380,7 @@ function K8sDropdown(props) {
10228
10380
  const { t: t2 } = useTranslation();
10229
10381
  const { openDeleteConfirmModal } = useDeleteModal({ resourceName: resourceName || "" });
10230
10382
  const download2 = useDownloadYAML();
10231
- const openForm = useOpenForm({ id: record.id });
10383
+ const openForm = useOpenForm();
10232
10384
  const isInShowPage = useResourceResult.action === "show";
10233
10385
  const { data: canEditData } = useCan({
10234
10386
  resource: resourceName,
@@ -10249,7 +10401,7 @@ function K8sDropdown(props) {
10249
10401
  Dropdown,
10250
10402
  {
10251
10403
  overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu$1, { children: [
10252
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || config.hideEdit ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Menu$1.Item, { onClick: () => openForm(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16PrimaryIcon, children: formType === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml") }) }),
10404
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || config.hideEdit ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Menu$1.Item, { onClick: () => openForm({ id: record.id }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16PrimaryIcon, children: formType === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml") }) }),
10253
10405
  /* @__PURE__ */ jsxRuntimeExports.jsx(
10254
10406
  Menu$1.Item,
10255
10407
  {
@@ -10923,273 +11075,9 @@ function KeyValueAnnotation(props) {
10923
11075
  }) : null]
10924
11076
  });
10925
11077
  }
10926
- function Tabs(props) {
10927
- const { tabs, className } = props;
10928
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs$1, { className, children: tabs.map((tab) => {
10929
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
10930
- }) });
10931
- }
10932
- const StateTag = (props) => {
10933
- const {
10934
- state: state2 = ResourceState.UPDATING,
10935
- hideBackground,
10936
- className,
10937
- customResourceStateMap
10938
- } = props;
10939
- const { t: t2 } = useTranslation();
10940
- const defaultStateMap = {
10941
- [ResourceState.UPDATING]: "loading",
10942
- [ResourceState.READY]: "green",
10943
- [ResourceState.COMPLETED]: "gray",
10944
- [ResourceState.FAILED]: "red",
10945
- [ResourceState.SUSPENDED]: "warning",
10946
- [ResourceState.RUNNING]: "green",
10947
- [ResourceState.SUCCEEDED]: "blue",
10948
- [ResourceState.UNKNOWN]: "gray",
10949
- [ResourceState.TERMINATING]: "loading",
10950
- [ResourceState.PENDING]: "warning",
10951
- [ResourceState.WAITING]: "warning",
10952
- [ResourceState.TERMINATED]: "gray",
10953
- [ResourceState.STOPPED]: "gray",
10954
- [ResourceState.AVAILABLE]: "blue",
10955
- [ResourceState.BOUND]: "green",
10956
- [ResourceState.RELEASED]: "gray",
10957
- [ResourceState.LOST]: "red",
10958
- [ResourceState.ACTIVE]: "green",
10959
- [ResourceState.DELETING]: "loading"
10960
- };
10961
- const finalColorMap = (customResourceStateMap == null ? void 0 : customResourceStateMap.color) || defaultStateMap;
10962
- const finalTextMap = customResourceStateMap == null ? void 0 : customResourceStateMap.text;
10963
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
10964
- StatusCapsule,
10965
- {
10966
- className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
10967
- color: finalColorMap[state2] !== "loading" ? finalColorMap[state2] : void 0,
10968
- loading: finalColorMap[state2] === "loading",
10969
- children: finalTextMap ? finalTextMap[state2] : t2(`dovetail.${state2 || "updating"}_state`)
10970
- }
10971
- );
10972
- };
10973
- const ShowContent_1g0ejph = "";
10974
- const ShowContentWrapperStyle = "s9agep2";
10975
- const BackButton = "bo89gfi";
10976
- const ToolBarWrapper = "t1ohe42f";
10977
- const NameStyle = "nqm4qz0";
10978
- const TopBarStyle = "ticl0qc";
10979
- const ShowContentHeaderStyle = "so9uwk1";
10980
- const GroupStyle$1 = "ge26ou0";
10981
- const GroupTitleStyle = "g17f8vl9";
10982
- const FullTabContentStyle = "fykgn2i";
10983
- const FieldWrapperStyle = "fngr745";
10984
- const TabContentStyle = "t11wg61l";
10985
- const ValueStyle$1 = "v1x3rivf";
10986
- const TabsStyle = "tf5s6s";
10987
- function ShowGroupComponent(props) {
10988
- const {
10989
- title,
10990
- className,
10991
- children,
10992
- operationEle
10993
- } = props;
10994
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10995
- className: cx_default(GroupStyle$1, className),
10996
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10997
- className: cx_default(Typo.Heading.h2_bold_title, GroupTitleStyle),
10998
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10999
- children: title
11000
- }), operationEle]
11001
- }), children]
11002
- });
11003
- }
11004
- const ShowContent = (props) => {
11005
- var _a, _b, _c, _d, _e, _f;
11006
- const {
11007
- showConfig,
11008
- formatter,
11009
- Dropdown: Dropdown2 = K8sDropdown
11010
- } = props;
11011
- const parsed = useParsed();
11012
- const {
11013
- resource
11014
- } = useResource();
11015
- const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
11016
- const {
11017
- queryResult
11018
- } = useShow({
11019
- id,
11020
- errorNotification: false
11021
- });
11022
- const {
11023
- t: t2
11024
- } = useTranslation();
11025
- const {
11026
- data: data2
11027
- } = queryResult;
11028
- const navigation = useNavigation();
11029
- const go = useGo();
11030
- const openForm = useOpenForm({
11031
- id
11032
- });
11033
- const Component = useContext(ComponentContext);
11034
- const configs = useContext(ConfigsContext);
11035
- const config = configs[(resource == null ? void 0 : resource.name) || ""];
11036
- const Tabs$12 = Component.Tabs || Tabs;
11037
- if (!(data2 == null ? void 0 : data2.data)) {
11038
- return null;
11039
- }
11040
- const model = data2.data;
11041
- const record = formatter ? formatter(model) : data2 == null ? void 0 : data2.data;
11042
- function renderFields(fields, areaType, hasCol = true) {
11043
- if (!record)
11044
- return null;
11045
- return fields.map((field) => {
11046
- if (field.hidden)
11047
- return null;
11048
- let content;
11049
- const value2 = get$2(record, field.path);
11050
- if (field.renderContent) {
11051
- content = field.renderContent(value2, record, field);
11052
- } else {
11053
- content = get$2(record, field.path);
11054
- }
11055
- return hasCol ? /* @__PURE__ */ jsxRuntimeExports.jsx(Col, {
11056
- flex: areaType === AreaType.Inline ? "none" : "",
11057
- span: field.col || 24,
11058
- children: field.render ? field.render(value2, record, field) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11059
- className: FieldWrapperStyle,
11060
- children: [field.title && /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11061
- className: Typo.Label.l4_regular_title,
11062
- style: {
11063
- width: field.labelWidth || "165px",
11064
- marginRight: 8,
11065
- flexShrink: 0,
11066
- color: "#2C385299"
11067
- },
11068
- children: field.title
11069
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11070
- style: {
11071
- flex: 1,
11072
- minWidth: 0
11073
- },
11074
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
11075
- className: cx_default(Typo.Label.l4_regular_title, ValueStyle$1),
11076
- value: content,
11077
- useOverflow: false
11078
- })
11079
- })]
11080
- })
11081
- }, field.key) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
11082
- style: {
11083
- height: "100%"
11084
- },
11085
- value: content,
11086
- useOverflow: false
11087
- });
11088
- });
11089
- }
11090
- const stateDisplay = get$2(record, "stateDisplay");
11091
- const topBar = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11092
- className: ToolBarWrapper,
11093
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11094
- className: cx_default(Typo.Label.l4_bold, BackButton),
11095
- onClick: () => {
11096
- go({
11097
- to: navigation.listUrl((resource == null ? void 0 : resource.name) || "")
11098
- });
11099
- },
11100
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
11101
- src: ArrowChevronLeft16BoldTertiaryIcon,
11102
- hoverSrc: ArrowChevronLeftSmall16BoldBlueIcon,
11103
- style: {
11104
- marginRight: 4
11105
- },
11106
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11107
- className: "button-text",
11108
- children: (config == null ? void 0 : config.displayName) || ((_b = resource == null ? void 0 : resource.meta) == null ? void 0 : _b.kind)
11109
- })
11110
- })
11111
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
11112
- className: TopBarStyle,
11113
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11114
- style: {
11115
- display: "flex"
11116
- },
11117
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11118
- className: cx_default(Typo.Display.d2_regular_title, NameStyle),
11119
- children: ((_c = showConfig.displayName) == null ? void 0 : _c.call(showConfig, record)) || ((_d = record == null ? void 0 : record.metadata) == null ? void 0 : _d.name)
11120
- }), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
11121
- state: stateDisplay,
11122
- customResourceStateMap: showConfig.resourceStateMap
11123
- }) : void 0]
11124
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
11125
- children: [(_e = showConfig.renderExtraButton) == null ? void 0 : _e.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
11126
- resource: resource == null ? void 0 : resource.name,
11127
- action: AccessControlAuth.Edit,
11128
- params: {
11129
- namespace: record.namespace
11130
- },
11131
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
11132
- style: {
11133
- marginRight: 8
11134
- },
11135
- onClick: () => openForm(),
11136
- children: ((_f = config.formConfig) == null ? void 0 : _f.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
11137
- })
11138
- }) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown2, {
11139
- record,
11140
- size: "large"
11141
- })]
11142
- })]
11143
- })]
11144
- });
11145
- const tabs = /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs$12, {
11146
- tabs: (showConfig.tabs || []).map((tab, tabIndex) => {
11147
- var _a2;
11148
- return {
11149
- title: tab.title,
11150
- key: tab.key,
11151
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11152
- className: cx_default(TabContentStyle, tab.groups.length <= 1 && tabIndex !== 0 && FullTabContentStyle),
11153
- children: (_a2 = tab.groups) == null ? void 0 : _a2.map((group) => {
11154
- const GroupContainer = group.title ? ShowGroupComponent : React__default.Fragment;
11155
- const FieldContainer = group.title ? Row : React__default.Fragment;
11156
- const groupContainerProps = group.title ? {
11157
- title: group.title || ""
11158
- } : {};
11159
- const fieldContainerProps = group.title ? {
11160
- gutter: [24, 8]
11161
- } : {};
11162
- return /* @__PURE__ */ jsxRuntimeExports.jsx(GroupContainer, {
11163
- ...groupContainerProps,
11164
- children: group.areas.map((area, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
11165
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(FieldContainer, {
11166
- ...fieldContainerProps,
11167
- children: renderFields(area.fields, area.type, !!group.title)
11168
- }, index2), index2 !== group.areas.length - 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {
11169
- style: {
11170
- margin: "8px 0 12px 0"
11171
- }
11172
- }) : null]
11173
- }))
11174
- }, group.title);
11175
- })
11176
- })
11177
- };
11178
- }),
11179
- className: TabsStyle
11180
- });
11181
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11182
- className: ShowContentWrapperStyle,
11183
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Space, {
11184
- direction: "vertical",
11185
- className: ShowContentHeaderStyle,
11186
- children: topBar
11187
- }), tabs]
11188
- });
11189
- };
11190
11078
  const KeyValueSecret_c3ji18 = "";
11191
11079
  const ButtonStyle = "b11tbgf7";
11192
- const GroupStyle = "gtbyh5g";
11080
+ const GroupStyle$1 = "gtbyh5g";
11193
11081
  function KeyValueSecret(props) {
11194
11082
  const {
11195
11083
  data: data2 = {}
@@ -11211,7 +11099,7 @@ function KeyValueSecret(props) {
11211
11099
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ShowGroupComponent, {
11212
11100
  title: i18n2.t("dovetail.data"),
11213
11101
  operationEle: toggleButton,
11214
- className: GroupStyle,
11102
+ className: GroupStyle$1,
11215
11103
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValue, {
11216
11104
  data: data2,
11217
11105
  hideSecret,
@@ -11221,45 +11109,36 @@ function KeyValueSecret(props) {
11221
11109
  })
11222
11110
  });
11223
11111
  }
11224
- function validateLabelKey(key2) {
11225
- const labelRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-\_]*[a-zA-Z0-9]$)/;
11226
- let prefix2, name2;
11227
- const splitResult = key2.split("/");
11228
- if (splitResult.length === 1) {
11229
- name2 = splitResult[0];
11230
- } else {
11231
- prefix2 = splitResult[0];
11232
- name2 = splitResult[1];
11233
- }
11234
- if (prefix2 === "") {
11235
- return { isValid: false, errorMessage: "EMPTY_PREFIX" };
11236
- }
11237
- if (prefix2 && !labelRegex.test(prefix2)) {
11238
- return { isValid: false, errorMessage: "INVALID_PREFIX" };
11239
- }
11240
- if (!labelRegex.test(name2)) {
11241
- return { isValid: false, errorMessage: "INVALID_NAME" };
11242
- }
11243
- if (prefix2 && prefix2.length > 253) {
11244
- return { isValid: false, errorMessage: "MAX_253" };
11245
- }
11246
- if (name2 && name2.length > 63) {
11247
- return { isValid: false, errorMessage: "MAX_63" };
11112
+ function isUtf8(buffer) {
11113
+ try {
11114
+ const decoder = new TextDecoder("utf-8", { fatal: true });
11115
+ decoder.decode(buffer);
11116
+ return true;
11117
+ } catch (e2) {
11118
+ return false;
11248
11119
  }
11249
- return { isValid: true };
11250
11120
  }
11251
- function validateLabelValue(value2) {
11252
- const labelValueRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-\_]*[a-zA-Z0-9]$)/;
11253
- if (value2 === "") {
11254
- return { isValid: true };
11255
- }
11256
- if (value2.length > 63) {
11257
- return { isValid: false, errorMessage: "MAX_63" };
11258
- }
11259
- if (!labelValueRegex.test(value2)) {
11260
- return { isValid: false, errorMessage: "INVALID_VALUE" };
11261
- }
11262
- return { isValid: true };
11121
+ function readFileAsBase64(file) {
11122
+ return new Promise((resolve, reject) => {
11123
+ const reader = new FileReader();
11124
+ reader.onload = async () => {
11125
+ const arrayBuffer = reader.result;
11126
+ if (arrayBuffer instanceof ArrayBuffer) {
11127
+ if (isUtf8(arrayBuffer)) {
11128
+ resolve(await file.text());
11129
+ } else {
11130
+ const base64String = btoa(
11131
+ String.fromCharCode(...new Uint8Array(arrayBuffer))
11132
+ );
11133
+ resolve(base64String);
11134
+ }
11135
+ return;
11136
+ }
11137
+ reject(new Error("Failed to read file"));
11138
+ };
11139
+ reader.onerror = reject;
11140
+ reader.readAsArrayBuffer(file);
11141
+ });
11263
11142
  }
11264
11143
  const LabelFormatPopover_piveun = "";
11265
11144
  const PodLabelFormatRulePopoverStyle = "p5jt6nm";
@@ -11347,59 +11226,86 @@ const LabelFormatPopover = ({
11347
11226
  })
11348
11227
  });
11349
11228
  };
11350
- const KeyValueTableForm_1eydq7y = "";
11351
- function _KeyValueTableFormForm(props, ref) {
11229
+ const index_t3zi07 = "";
11230
+ function _KeyValueTableForm(props, ref) {
11352
11231
  const {
11232
+ value: value2,
11353
11233
  defaultValue,
11354
- onSubmit,
11234
+ onChange,
11355
11235
  extraColumns,
11356
11236
  addButtonText,
11357
- noValueValidation
11237
+ noValueValidation,
11238
+ isHideLabelFormatPopover,
11239
+ isValueOptional = true,
11240
+ canImportFromFile,
11241
+ minSize,
11242
+ validateKey,
11243
+ validateValue,
11244
+ onSubmit
11358
11245
  } = props;
11359
11246
  const {
11360
11247
  t: t2
11361
11248
  } = useTranslation();
11362
- const [value2, setValue] = useState([]);
11363
11249
  const tableFormRef = useRef(null);
11250
+ const [_value, _setValue] = useState(value2 || defaultValue);
11251
+ const [forceUpdateCount, setForceUpdateCount] = useState(0);
11252
+ const validate = useCallback(() => {
11253
+ return new Promise((resolve) => {
11254
+ var _a;
11255
+ (_a = tableFormRef.current) == null ? void 0 : _a.validateWholeFields();
11256
+ setForceUpdateCount(forceUpdateCount + 1);
11257
+ setTimeout(() => {
11258
+ var _a2;
11259
+ const isValid = (_a2 = tableFormRef.current) == null ? void 0 : _a2.isValid();
11260
+ resolve(isValid || false);
11261
+ }, 0);
11262
+ });
11263
+ }, [forceUpdateCount]);
11364
11264
  useImperativeHandle(ref, () => ({
11365
- submit: () => {
11366
- return new Promise((res, rej) => {
11367
- var _a;
11368
- (_a = tableFormRef.current) == null ? void 0 : _a.validateWholeFields();
11369
- setTimeout(() => {
11370
- var _a2;
11371
- const isValid = (_a2 = tableFormRef.current) == null ? void 0 : _a2.isValid();
11372
- if (isValid) {
11373
- res(onSubmit(value2));
11374
- } else {
11375
- rej();
11376
- }
11377
- }, 0);
11378
- });
11265
+ validate,
11266
+ submit: async () => {
11267
+ const isValid = await validate();
11268
+ if (isValid) {
11269
+ return onSubmit == null ? void 0 : onSubmit(_value);
11270
+ }
11271
+ return Promise.reject();
11272
+ },
11273
+ setValue: (value22) => {
11274
+ var _a;
11275
+ _setValue(value22);
11276
+ (_a = tableFormRef.current) == null ? void 0 : _a.setData(value22);
11379
11277
  }
11380
- }), [onSubmit, value2]);
11278
+ }), [validate, onSubmit, _value]);
11279
+ useEffect(() => {
11280
+ var _a;
11281
+ if (value2 && !isEqual(value2, _value)) {
11282
+ _setValue(value2);
11283
+ (_a = tableFormRef.current) == null ? void 0 : _a.setData(value2);
11284
+ }
11285
+ }, [value2]);
11381
11286
  const renderTextAreaFunc = ({
11382
11287
  value: value22,
11383
- onChange
11288
+ onChange: onChange2
11384
11289
  }) => {
11385
11290
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TextArea, {
11386
11291
  autoSize: true,
11387
- className: "clsjtk2",
11292
+ className: "c17gq8cd",
11388
11293
  size: "small",
11389
11294
  value: value22,
11390
11295
  onChange: (e2) => {
11391
- onChange(e2.target.value);
11296
+ onChange2(e2.target.value);
11392
11297
  }
11393
11298
  });
11394
11299
  };
11395
11300
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
11396
11301
  size: 8,
11397
11302
  direction: "vertical",
11398
- className: "cq3mbby",
11303
+ className: "c1n7fiws",
11399
11304
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(TableForm, {
11400
11305
  ref: tableFormRef,
11401
- onBodyChange: (value22) => {
11402
- setValue(value22);
11306
+ onBodyChange: (newValue) => {
11307
+ _setValue(newValue);
11308
+ onChange == null ? void 0 : onChange(newValue);
11403
11309
  },
11404
11310
  columns: [{
11405
11311
  key: "key",
@@ -11410,46 +11316,72 @@ function _KeyValueTableFormForm(props, ref) {
11410
11316
  }) => {
11411
11317
  if (!value22)
11412
11318
  return t2("dovetail.key_empty_text");
11319
+ const validate2 = validateKey || validateLabelKey;
11413
11320
  const {
11414
- isValid
11415
- } = validateLabelKey(value22 || "");
11321
+ isValid,
11322
+ errorMessage
11323
+ } = validate2(value22 || "");
11416
11324
  if (!isValid)
11417
- return t2("dovetail.format_error");
11325
+ return errorMessage || t2("dovetail.format_error");
11418
11326
  },
11419
11327
  render: renderTextAreaFunc
11420
11328
  }, {
11421
11329
  key: "value",
11422
- title: t2("dovetail.value_optional"),
11330
+ title: isValueOptional ? t2("dovetail.value_optional") : t2("dovetail.value"),
11423
11331
  type: "input",
11424
11332
  validator: ({
11425
11333
  value: value22
11426
11334
  }) => {
11427
11335
  if (noValueValidation)
11428
11336
  return;
11337
+ const validate2 = validateValue || validateLabelValue;
11429
11338
  const {
11430
- isValid
11431
- } = validateLabelValue(value22 || "");
11339
+ isValid,
11340
+ errorMessage
11341
+ } = validate2(value22 || "", isValueOptional);
11432
11342
  if (!isValid)
11433
- return t2("dovetail.format_error");
11343
+ return errorMessage || t2("dovetail.format_error");
11434
11344
  },
11435
11345
  render: renderTextAreaFunc
11436
11346
  }, ...extraColumns || []],
11437
- disableBatchFilling: true,
11438
- hideEmptyTable: true,
11439
11347
  rowAddConfig: {
11440
11348
  addible: true,
11441
11349
  text: () => addButtonText
11442
11350
  },
11443
11351
  defaultData: defaultValue,
11444
11352
  row: {
11445
- deletable: true
11446
- }
11447
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {
11353
+ deletable: _value.length > (minSize || 0)
11354
+ },
11355
+ disableBatchFilling: true,
11356
+ hideEmptyTable: true
11357
+ }), isHideLabelFormatPopover ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {
11448
11358
  noValueValidation
11449
- })]
11359
+ }), canImportFromFile ? /* @__PURE__ */ jsxRuntimeExports.jsx(Upload, {
11360
+ multiple: false,
11361
+ showUploadList: false,
11362
+ onChange: async (e2) => {
11363
+ var _a;
11364
+ const fileValue = {
11365
+ key: e2.file.name,
11366
+ value: await readFileAsBase64(e2.file.originFileObj)
11367
+ };
11368
+ let newValue = [..._value, fileValue];
11369
+ if (_value.some((v) => v.key === fileValue.key)) {
11370
+ newValue = _value.map((v) => v.key === fileValue.key ? fileValue : v);
11371
+ }
11372
+ _setValue(newValue);
11373
+ (_a = tableFormRef.current) == null ? void 0 : _a.setData(newValue);
11374
+ onChange == null ? void 0 : onChange(newValue);
11375
+ },
11376
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
11377
+ type: "link",
11378
+ size: "small",
11379
+ children: t2("dovetail.import_from_file")
11380
+ })
11381
+ }) : null]
11450
11382
  });
11451
11383
  }
11452
- const KeyValueTableFormForm = React__default.forwardRef(_KeyValueTableFormForm);
11384
+ const KeyValueTableForm = React__default.forwardRef(_KeyValueTableForm);
11453
11385
  const EditNodeTaintForm_cgov7z = "";
11454
11386
  const UlStyle = "u19jcs7t";
11455
11387
  const EditNodeTaintForm = React__default.forwardRef(function EditNodeTaintForm2(props, ref) {
@@ -11462,6 +11394,7 @@ const EditNodeTaintForm = React__default.forwardRef(function EditNodeTaintForm2(
11462
11394
  const {
11463
11395
  t: t2
11464
11396
  } = useTranslation();
11397
+ const tableFormRef = useRef(null);
11465
11398
  const defaultValue = useMemo(() => {
11466
11399
  var _a;
11467
11400
  return ((_a = nodeModel._rawYaml.spec) == null ? void 0 : _a.taints) || [];
@@ -11497,8 +11430,14 @@ const EditNodeTaintForm = React__default.forwardRef(function EditNodeTaintForm2(
11497
11430
  errorNotification: false
11498
11431
  });
11499
11432
  }, [nodeModel, mutateAsync, t2]);
11500
- return /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueTableFormForm, {
11501
- ref,
11433
+ useImperativeHandle(ref, () => ({
11434
+ submit: () => {
11435
+ var _a;
11436
+ return (_a = tableFormRef.current) == null ? void 0 : _a.submit();
11437
+ }
11438
+ }), []);
11439
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueTableForm, {
11440
+ ref: tableFormRef,
11502
11441
  defaultValue,
11503
11442
  onSubmit,
11504
11443
  addButtonText: t2("dovetail.add_taint"),
@@ -11751,6 +11690,47 @@ function ResourceTable(props) {
11751
11690
  }
11752
11691
  );
11753
11692
  }
11693
+ const StateTag = (props) => {
11694
+ const {
11695
+ state: state2 = ResourceState.UPDATING,
11696
+ hideBackground,
11697
+ className,
11698
+ customResourceStateMap
11699
+ } = props;
11700
+ const { t: t2 } = useTranslation();
11701
+ const defaultStateMap = {
11702
+ [ResourceState.UPDATING]: "loading",
11703
+ [ResourceState.READY]: "green",
11704
+ [ResourceState.COMPLETED]: "gray",
11705
+ [ResourceState.FAILED]: "red",
11706
+ [ResourceState.SUSPENDED]: "warning",
11707
+ [ResourceState.RUNNING]: "green",
11708
+ [ResourceState.SUCCEEDED]: "blue",
11709
+ [ResourceState.UNKNOWN]: "gray",
11710
+ [ResourceState.TERMINATING]: "loading",
11711
+ [ResourceState.PENDING]: "warning",
11712
+ [ResourceState.WAITING]: "warning",
11713
+ [ResourceState.TERMINATED]: "gray",
11714
+ [ResourceState.STOPPED]: "gray",
11715
+ [ResourceState.AVAILABLE]: "blue",
11716
+ [ResourceState.BOUND]: "green",
11717
+ [ResourceState.RELEASED]: "gray",
11718
+ [ResourceState.LOST]: "red",
11719
+ [ResourceState.ACTIVE]: "green",
11720
+ [ResourceState.DELETING]: "loading"
11721
+ };
11722
+ const finalColorMap = (customResourceStateMap == null ? void 0 : customResourceStateMap.color) || defaultStateMap;
11723
+ const finalTextMap = customResourceStateMap == null ? void 0 : customResourceStateMap.text;
11724
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11725
+ StatusCapsule,
11726
+ {
11727
+ className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
11728
+ color: finalColorMap[state2] !== "loading" ? finalColorMap[state2] : void 0,
11729
+ loading: finalColorMap[state2] === "loading",
11730
+ children: finalTextMap ? finalTextMap[state2] : t2(`dovetail.${state2 || "updating"}_state`)
11731
+ }
11732
+ );
11733
+ };
11754
11734
  const WorkloadPodsTable_975j2t = "";
11755
11735
  const WorkloadPodsTable = ({
11756
11736
  namespace: namespace2,
@@ -11832,7 +11812,7 @@ const ReadyValueStyle = "r1bm8olw";
11832
11812
  const ReplicasValueStyle = "r1oqudbh";
11833
11813
  const ContentWrapperStyle = "c18i6jtg";
11834
11814
  const LabelStyle = "lpm22il";
11835
- const ValueStyle = "v1ixr1me";
11815
+ const ValueStyle$1 = "v1ixr1me";
11836
11816
  const WorkloadReplicasForm = React__default.forwardRef(function WorkloadReplicasForm2(props, ref) {
11837
11817
  const {
11838
11818
  defaultValue,
@@ -11962,7 +11942,7 @@ function WorkloadReplicas({
11962
11942
  className: cx_default(LabelStyle, Typo.Label.l3_regular),
11963
11943
  children: record.kind === "Job" ? t2("dovetail.pod_complete_num") : t2("dovetail.pod_ready_num")
11964
11944
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("td", {
11965
- className: cx_default(ValueStyle, Typo.Label.l3_regular),
11945
+ className: cx_default(ValueStyle$1, Typo.Label.l3_regular),
11966
11946
  children: readyReplicas
11967
11947
  })]
11968
11948
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", {
@@ -11970,7 +11950,7 @@ function WorkloadReplicas({
11970
11950
  className: cx_default(LabelStyle, Typo.Label.l3_regular),
11971
11951
  children: t2("dovetail.pod_replicas_num")
11972
11952
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("td", {
11973
- className: cx_default(ValueStyle, Typo.Label.l3_regular),
11953
+ className: cx_default(ValueStyle$1, Typo.Label.l3_regular),
11974
11954
  children: replicas
11975
11955
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("td", {
11976
11956
  children: editable && canScale && /* @__PURE__ */ jsxRuntimeExports.jsx(EditField, {
@@ -12001,6 +11981,7 @@ var AreaType = /* @__PURE__ */ ((AreaType2) => {
12001
11981
  const ImageField = (i18n2) => {
12002
11982
  return {
12003
11983
  key: "Image",
11984
+ col: 12,
12004
11985
  title: i18n2.t("dovetail.image"),
12005
11986
  path: ["imageNames"],
12006
11987
  renderContent(value2) {
@@ -12107,6 +12088,7 @@ const SecretDataField = () => {
12107
12088
  const StartTimeField = (i18n2) => {
12108
12089
  return {
12109
12090
  key: "started",
12091
+ col: 12,
12110
12092
  title: i18n2.t("dovetail.started"),
12111
12093
  path: ["status", "startTime"],
12112
12094
  renderContent(value2) {
@@ -12117,6 +12099,7 @@ const StartTimeField = (i18n2) => {
12117
12099
  const ServiceTypeField = (i18n2) => {
12118
12100
  return {
12119
12101
  key: "type",
12102
+ col: 12,
12120
12103
  title: i18n2.t("dovetail.type"),
12121
12104
  path: ["displayType"]
12122
12105
  };
@@ -12124,6 +12107,7 @@ const ServiceTypeField = (i18n2) => {
12124
12107
  const ClusterIpField = (i18n2) => {
12125
12108
  return {
12126
12109
  key: "clusterIp",
12110
+ col: 12,
12127
12111
  title: i18n2.t("dovetail.clusterIp"),
12128
12112
  path: ["spec", "clusterIP"]
12129
12113
  };
@@ -12131,6 +12115,7 @@ const ClusterIpField = (i18n2) => {
12131
12115
  const SessionAffinityField = (i18n2) => {
12132
12116
  return {
12133
12117
  key: "clusterIp",
12118
+ col: 12,
12134
12119
  title: i18n2.t("dovetail.sessionAffinity"),
12135
12120
  path: ["spec", "sessionAffinity"]
12136
12121
  };
@@ -12175,11 +12160,13 @@ const EventsTableTabField = () => {
12175
12160
  };
12176
12161
  const NamespaceField = (i18n2) => ({
12177
12162
  key: "NameSpace",
12163
+ col: 12,
12178
12164
  title: i18n2.t("dovetail.namespace"),
12179
12165
  path: ["metadata", "namespace"]
12180
12166
  });
12181
12167
  const AgeField = (i18n2) => ({
12182
12168
  key: "Age",
12169
+ col: 12,
12183
12170
  title: i18n2.t("dovetail.created_time"),
12184
12171
  path: ["metadata", "creationTimestamp"],
12185
12172
  renderContent(value2) {
@@ -12207,6 +12194,7 @@ const AnnotationsField = (i18n2) => ({
12207
12194
  });
12208
12195
  const ServiceInnerClusterAccessField = () => ({
12209
12196
  key: "innerClusterAccess",
12197
+ col: 12,
12210
12198
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceInClusterAccessTitle, {}),
12211
12199
  path: [],
12212
12200
  renderContent: (_, record) => {
@@ -12215,6 +12203,7 @@ const ServiceInnerClusterAccessField = () => ({
12215
12203
  });
12216
12204
  const ServiceOutClusterAccessField = (clusterVip) => ({
12217
12205
  key: "innerClusterAccess",
12206
+ col: 12,
12218
12207
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
12219
12208
  path: [],
12220
12209
  renderContent: (_, record) => {
@@ -12247,6 +12236,7 @@ const PortsTableField = () => ({
12247
12236
  const DurationField = (i18n2) => {
12248
12237
  return {
12249
12238
  key: "duration",
12239
+ col: 12,
12250
12240
  path: ["duration"],
12251
12241
  title: i18n2.t("dovetail.duration"),
12252
12242
  renderContent: (v) => {
@@ -12257,6 +12247,7 @@ const DurationField = (i18n2) => {
12257
12247
  const StorageClassProvisionerField = (i18n2) => {
12258
12248
  return {
12259
12249
  key: "provisioner",
12250
+ col: 12,
12260
12251
  path: ["provisioner"],
12261
12252
  title: i18n2.t("dovetail.provisioner")
12262
12253
  };
@@ -12292,6 +12283,7 @@ const StorageClassPvField = () => {
12292
12283
  const PVCapacityField = (i18n2) => {
12293
12284
  return {
12294
12285
  key: "capacity",
12286
+ col: 12,
12295
12287
  path: ["spec", "capacity", "storage"],
12296
12288
  title: i18n2.t("dovetail.capacity"),
12297
12289
  renderContent(value2) {
@@ -12302,6 +12294,7 @@ const PVCapacityField = (i18n2) => {
12302
12294
  const PVCStorageField = (i18n2) => {
12303
12295
  return {
12304
12296
  key: "storage",
12297
+ col: 12,
12305
12298
  path: ["spec", "resources", "requests", "storage"],
12306
12299
  title: i18n2.t("dovetail.distributed"),
12307
12300
  renderContent(value2, pvc2) {
@@ -12312,6 +12305,7 @@ const PVCStorageField = (i18n2) => {
12312
12305
  const PVRefField = (i18n2) => {
12313
12306
  return {
12314
12307
  key: "pv",
12308
+ col: 12,
12315
12309
  path: ["pv"],
12316
12310
  title: i18n2.t("dovetail.pv"),
12317
12311
  renderContent(value2) {
@@ -12329,6 +12323,7 @@ const PVRefField = (i18n2) => {
12329
12323
  const PVStorageClassField = (i18n2) => {
12330
12324
  return {
12331
12325
  key: "storageClass",
12326
+ col: 12,
12332
12327
  path: ["spec", "storageClassName"],
12333
12328
  title: i18n2.t("dovetail.storage_class"),
12334
12329
  renderContent(value2) {
@@ -12339,6 +12334,7 @@ const PVStorageClassField = (i18n2) => {
12339
12334
  const PVPhaseField = (i18n2) => {
12340
12335
  return {
12341
12336
  key: "phase",
12337
+ col: 12,
12342
12338
  path: ["stateDisplay"],
12343
12339
  title: i18n2.t("dovetail.state"),
12344
12340
  renderContent(value2) {
@@ -12349,6 +12345,7 @@ const PVPhaseField = (i18n2) => {
12349
12345
  const PVVolumeModeField = (i18n2) => {
12350
12346
  return {
12351
12347
  key: "mode",
12348
+ col: 12,
12352
12349
  path: ["spec", "volumeMode"],
12353
12350
  title: i18n2.t("dovetail.volume_mode"),
12354
12351
  renderContent(value2) {
@@ -12359,6 +12356,7 @@ const PVVolumeModeField = (i18n2) => {
12359
12356
  const PVAccessModeField = (i18n2) => {
12360
12357
  return {
12361
12358
  key: "accessMode",
12359
+ col: 12,
12362
12360
  path: ["spec", "accessModes"],
12363
12361
  title: i18n2.t("dovetail.access_mode"),
12364
12362
  renderContent(value2) {
@@ -12394,6 +12392,7 @@ const PVCPodsField = () => {
12394
12392
  const PVCRefField = (i18n2) => {
12395
12393
  return {
12396
12394
  key: "pvc",
12395
+ col: 12,
12397
12396
  path: ["pvc"],
12398
12397
  title: i18n2.t("dovetail.pvc"),
12399
12398
  renderContent(value2, pv2) {
@@ -12412,6 +12411,7 @@ const PVCRefField = (i18n2) => {
12412
12411
  const PVCSIRefField = (i18n2) => {
12413
12412
  return {
12414
12413
  key: "csi",
12414
+ col: 12,
12415
12415
  path: ["csi"],
12416
12416
  title: i18n2.t("dovetail.csi")
12417
12417
  };
@@ -12419,6 +12419,7 @@ const PVCSIRefField = (i18n2) => {
12419
12419
  const IsDefaultSCField = (i18n2) => {
12420
12420
  return {
12421
12421
  key: "isDefaultSC",
12422
+ col: 12,
12422
12423
  path: ["isDefaultSC"],
12423
12424
  title: i18n2.t("dovetail.default_sc"),
12424
12425
  renderContent(val) {
@@ -12429,6 +12430,7 @@ const IsDefaultSCField = (i18n2) => {
12429
12430
  const SCReclaimPolicyField = (i18n2) => {
12430
12431
  return {
12431
12432
  key: "reclaimPolicy",
12433
+ col: 12,
12432
12434
  path: ["reclaimPolicy"],
12433
12435
  title: i18n2.t("dovetail.reclaim_policy"),
12434
12436
  renderContent(val) {
@@ -12443,6 +12445,7 @@ const SCReclaimPolicyField = (i18n2) => {
12443
12445
  const IsSCAllowVolumeExpansionField = (i18n2) => {
12444
12446
  return {
12445
12447
  key: "allowVolumeExpansion",
12448
+ col: 12,
12446
12449
  path: ["allowVolumeExpansion"],
12447
12450
  title: i18n2.t("dovetail.allow_expand"),
12448
12451
  renderContent(val) {
@@ -12690,7 +12693,7 @@ const PodLogTab = (i18n2) => ({
12690
12693
  ]
12691
12694
  });
12692
12695
  const NetworkPolicyRulesViewer_r6jity = "";
12693
- const MonacoYamlEditor$1 = lazy(() => import("./MonacoYamlEditor-74ecf0d5.js"));
12696
+ const MonacoYamlEditor$1 = lazy(() => import("./MonacoYamlEditor-d09e7de9.js"));
12694
12697
  const EditorStyle$1 = "e1cjl2b8";
12695
12698
  const NetworkPolicyRulesViewer = ({
12696
12699
  ingressOrEgress,
@@ -13007,27 +13010,269 @@ const NetworkPolicyEgressRulesGroup = (i18n2) => ({
13007
13010
  }
13008
13011
  );
13009
13012
  }
13010
- }
13011
- ]
13012
- }
13013
- ]
13014
- });
13015
- const StorageClassPvGroup = (i18n2) => ({
13016
- title: i18n2.t("dovetail.persistent_volume"),
13017
- areas: [
13018
- {
13019
- fields: [StorageClassPvField()]
13020
- }
13021
- ]
13022
- });
13023
- const ResourceTableGroup = (resource, title) => ({
13024
- title,
13025
- areas: [
13013
+ }
13014
+ ]
13015
+ }
13016
+ ]
13017
+ });
13018
+ const StorageClassPvGroup = (i18n2) => ({
13019
+ title: i18n2.t("dovetail.persistent_volume"),
13020
+ areas: [
13021
+ {
13022
+ fields: [StorageClassPvField()]
13023
+ }
13024
+ ]
13025
+ });
13026
+ const ResourceTableGroup = (resource, title) => ({
13027
+ title,
13028
+ areas: [
13029
+ {
13030
+ fields: [ResourceTableField(resource)]
13031
+ }
13032
+ ]
13033
+ });
13034
+ function Tabs(props) {
13035
+ const { tabs, className } = props;
13036
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs$1, { className, children: tabs.map((tab) => {
13037
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
13038
+ }) });
13039
+ }
13040
+ const ShowContentView_1mvcyif = "";
13041
+ const ShowContentWrapperStyle = "soapvs9";
13042
+ const BackButton = "b13d603q";
13043
+ const ToolBarWrapper = "tm8eaia";
13044
+ const NameStyle = "nhnus27";
13045
+ const TopBarStyle = "t16t20f5";
13046
+ const ShowContentHeaderStyle = "s97y2wr";
13047
+ const GroupStyle = "g1rhnxqx";
13048
+ const GroupTitleStyle = "g1f1s2pc";
13049
+ const FullTabContentStyle = "f1qw3bxx";
13050
+ const FieldWrapperStyle = "flfewds";
13051
+ const TabContentStyle = "t1c7cta8";
13052
+ const ValueStyle = "v1pt61xk";
13053
+ const TabsStyle = "t1to6fie";
13054
+ function ShowGroupComponent(props) {
13055
+ const {
13056
+ title,
13057
+ className,
13058
+ children,
13059
+ operationEle
13060
+ } = props;
13061
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13062
+ className: cx_default(GroupStyle, className),
13063
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13064
+ className: cx_default(Typo.Heading.h2_bold_title, GroupTitleStyle),
13065
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13066
+ children: title
13067
+ }), operationEle]
13068
+ }), children]
13069
+ });
13070
+ }
13071
+ const ShowContentView = (props) => {
13072
+ var _a, _b, _c, _d;
13073
+ const {
13074
+ id,
13075
+ resourceName,
13076
+ showConfig,
13077
+ formatter,
13078
+ Dropdown: Dropdown2 = K8sDropdown,
13079
+ hideBackButton = false
13080
+ } = props;
13081
+ const {
13082
+ queryResult
13083
+ } = useShow({
13084
+ id,
13085
+ resource: resourceName,
13086
+ errorNotification: false
13087
+ });
13088
+ const {
13089
+ t: t2
13090
+ } = useTranslation();
13091
+ const {
13092
+ data: data2
13093
+ } = queryResult;
13094
+ const navigation = useNavigation();
13095
+ const go = useGo();
13096
+ const openForm = useOpenForm();
13097
+ const Component = useContext(ComponentContext);
13098
+ const configs = useContext(ConfigsContext);
13099
+ const config = configs[resourceName];
13100
+ const Tabs$12 = Component.Tabs || Tabs;
13101
+ if (!(data2 == null ? void 0 : data2.data)) {
13102
+ return null;
13103
+ }
13104
+ const model = data2.data;
13105
+ const record = formatter ? formatter(model) : data2 == null ? void 0 : data2.data;
13106
+ function renderFields(fields, areaType, hasCol = true) {
13107
+ if (!record)
13108
+ return null;
13109
+ return fields.map((field) => {
13110
+ if (field.hidden)
13111
+ return null;
13112
+ let content;
13113
+ const value2 = get$2(record, field.path);
13114
+ if (field.renderContent) {
13115
+ content = field.renderContent(value2, record, field);
13116
+ } else {
13117
+ content = get$2(record, field.path);
13118
+ }
13119
+ return hasCol ? /* @__PURE__ */ jsxRuntimeExports.jsx(Col, {
13120
+ flex: areaType === AreaType.Inline ? "none" : "",
13121
+ span: field.col || 24,
13122
+ className: "cca5959",
13123
+ children: field.render ? field.render(value2, record, field) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13124
+ className: FieldWrapperStyle,
13125
+ children: [field.title && /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13126
+ className: Typo.Label.l4_regular_title,
13127
+ style: {
13128
+ width: field.labelWidth || "165px",
13129
+ marginRight: 8,
13130
+ flexShrink: 0,
13131
+ color: "#2C385299"
13132
+ },
13133
+ children: field.title
13134
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13135
+ style: {
13136
+ flex: 1,
13137
+ minWidth: 0
13138
+ },
13139
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
13140
+ className: cx_default(Typo.Label.l4_regular_title, ValueStyle),
13141
+ value: content,
13142
+ useOverflow: false
13143
+ })
13144
+ })]
13145
+ })
13146
+ }, field.key) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
13147
+ style: {
13148
+ height: "100%"
13149
+ },
13150
+ value: content,
13151
+ useOverflow: false
13152
+ });
13153
+ });
13154
+ }
13155
+ function renderGroup(group) {
13156
+ const GroupContainer = group.title ? ShowGroupComponent : React__default.Fragment;
13157
+ const FieldContainer = group.title ? Row : React__default.Fragment;
13158
+ const groupContainerProps = group.title ? {
13159
+ title: group.title || ""
13160
+ } : {};
13161
+ const fieldContainerProps = group.title ? {
13162
+ gutter: [24, 8]
13163
+ } : {};
13164
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(GroupContainer, {
13165
+ ...groupContainerProps,
13166
+ children: group.areas.map((area, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
13167
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(FieldContainer, {
13168
+ ...fieldContainerProps,
13169
+ children: renderFields(area.fields, area.type, !!group.title)
13170
+ }, index2), index2 !== group.areas.length - 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {
13171
+ style: {
13172
+ margin: "8px 0 12px 0"
13173
+ }
13174
+ }) : null]
13175
+ }))
13176
+ }, group.title);
13177
+ }
13178
+ const stateDisplay = get$2(record, "stateDisplay");
13179
+ const topBar = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13180
+ className: ToolBarWrapper,
13181
+ children: [!hideBackButton && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13182
+ className: cx_default(Typo.Label.l4_bold, BackButton),
13183
+ onClick: () => {
13184
+ go({
13185
+ to: navigation.listUrl(resourceName)
13186
+ });
13187
+ },
13188
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
13189
+ src: ArrowChevronLeft16BoldTertiaryIcon,
13190
+ hoverSrc: ArrowChevronLeftSmall16BoldBlueIcon,
13191
+ style: {
13192
+ marginRight: 4
13193
+ },
13194
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13195
+ className: "button-text",
13196
+ children: (config == null ? void 0 : config.displayName) || resourceName
13197
+ })
13198
+ })
13199
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13200
+ className: TopBarStyle,
13201
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13202
+ style: {
13203
+ display: "flex"
13204
+ },
13205
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13206
+ className: cx_default(Typo.Display.d2_regular_title, NameStyle),
13207
+ children: ((_a = showConfig.displayName) == null ? void 0 : _a.call(showConfig, record)) || ((_b = record == null ? void 0 : record.metadata) == null ? void 0 : _b.name)
13208
+ }), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
13209
+ state: stateDisplay,
13210
+ customResourceStateMap: showConfig.resourceStateMap
13211
+ }) : void 0]
13212
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13213
+ children: [(_c = showConfig.renderExtraButton) == null ? void 0 : _c.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
13214
+ resource: resourceName,
13215
+ action: AccessControlAuth.Edit,
13216
+ params: {
13217
+ namespace: record.namespace
13218
+ },
13219
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
13220
+ style: {
13221
+ marginRight: 8
13222
+ },
13223
+ onClick: () => openForm({
13224
+ id
13225
+ }),
13226
+ children: ((_d = config.formConfig) == null ? void 0 : _d.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
13227
+ })
13228
+ }) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown2, {
13229
+ record,
13230
+ size: "large"
13231
+ })]
13232
+ })]
13233
+ })]
13234
+ });
13235
+ const tabs = /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs$12, {
13236
+ tabs: (showConfig.tabs || []).map((tab, tabIndex) => {
13237
+ var _a2;
13238
+ return {
13239
+ title: tab.title,
13240
+ key: tab.key,
13241
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13242
+ className: cx_default(TabContentStyle, tab.groups.length <= 1 && tabIndex !== 0 && FullTabContentStyle),
13243
+ children: (_a2 = tab.groups) == null ? void 0 : _a2.map(renderGroup)
13244
+ })
13245
+ };
13246
+ }),
13247
+ className: TabsStyle
13248
+ });
13249
+ const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup) : null;
13250
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13251
+ className: ShowContentWrapperStyle,
13252
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Space, {
13253
+ direction: "vertical",
13254
+ className: ShowContentHeaderStyle,
13255
+ children: topBar
13256
+ }), basicInfo, tabs]
13257
+ });
13258
+ };
13259
+ const ShowContent = (props) => {
13260
+ var _a;
13261
+ const { showConfig, formatter, Dropdown: Dropdown2 = K8sDropdown } = props;
13262
+ const parsed = useParsed();
13263
+ const { resource } = useResource();
13264
+ const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
13265
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
13266
+ ShowContentView,
13026
13267
  {
13027
- fields: [ResourceTableField(resource)]
13268
+ id,
13269
+ resourceName: (resource == null ? void 0 : resource.name) || "",
13270
+ showConfig,
13271
+ formatter,
13272
+ Dropdown: Dropdown2
13028
13273
  }
13029
- ]
13030
- });
13274
+ );
13275
+ };
13031
13276
  const PageShow = (props) => {
13032
13277
  var _a;
13033
13278
  const parsed = useParsed();
@@ -15261,6 +15506,11 @@ function usePathMap(options) {
15261
15506
  transformApplyValues
15262
15507
  };
15263
15508
  }
15509
+ var FormItemLayout = /* @__PURE__ */ ((FormItemLayout2) => {
15510
+ FormItemLayout2["VERTICAL"] = "VERTICAL";
15511
+ FormItemLayout2["HORIZONTAL"] = "HORIZONTAL";
15512
+ return FormItemLayout2;
15513
+ })(FormItemLayout || {});
15264
15514
  function useFieldsConfig(config, formConfig, resourceId) {
15265
15515
  var _a, _b, _c;
15266
15516
  const action = resourceId ? "edit" : "create";
@@ -15282,7 +15532,8 @@ function useFieldsConfig(config, formConfig, resourceId) {
15282
15532
  action
15283
15533
  });
15284
15534
  }
15285
- const RefineFormContent_ahna8x = "";
15535
+ const RefineFormContent_lnhybh = "";
15536
+ const VerticalFormItemStyle = "v154n7ie";
15286
15537
  function renderCommonFormFiled(props) {
15287
15538
  const {
15288
15539
  field,
@@ -15309,7 +15560,7 @@ function renderCommonFormFiled(props) {
15309
15560
  switch (fieldConfig.type) {
15310
15561
  case "number":
15311
15562
  ele = /* @__PURE__ */ jsxRuntimeExports.jsx(Fields.Integer, {
15312
- className: "c154n7ie",
15563
+ className: "c1c9j4da",
15313
15564
  placeholder: fieldConfig.placeholder,
15314
15565
  input: {
15315
15566
  value: value2,
@@ -15352,7 +15603,7 @@ const RefineFormContent = (props) => {
15352
15603
  control,
15353
15604
  name: fieldConfig.path.join("."),
15354
15605
  rules: {
15355
- validate(value2) {
15606
+ async validate(value2) {
15356
15607
  const formValue = getValues();
15357
15608
  if (!fieldConfig.validators || fieldConfig.validators.length === 0)
15358
15609
  return true;
@@ -15360,7 +15611,7 @@ const RefineFormContent = (props) => {
15360
15611
  const {
15361
15612
  isValid,
15362
15613
  errorMsg
15363
- } = func(value2, formValue, FormType.FORM);
15614
+ } = await func(value2, formValue, FormType.FORM);
15364
15615
  if (!isValid)
15365
15616
  return errorMsg;
15366
15617
  }
@@ -15388,13 +15639,14 @@ const RefineFormContent = (props) => {
15388
15639
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, {
15389
15640
  label: fieldConfig.label,
15390
15641
  colon: false,
15391
- labelCol: {
15642
+ labelCol: fieldConfig.layout === FormItemLayout.VERTICAL ? {} : {
15392
15643
  flex: `0 0 ${(formConfig == null ? void 0 : formConfig.labelWidth) || "216px"}`
15393
15644
  },
15394
- help: (_a2 = fieldState.error) == null ? void 0 : _a2.message,
15645
+ help: fieldConfig.isHideErrorStatus ? "" : (_a2 = fieldState.error) == null ? void 0 : _a2.message,
15395
15646
  extra: fieldConfig.helperText,
15396
- validateStatus: fieldState.invalid ? "error" : void 0,
15647
+ validateStatus: fieldState.invalid && !fieldConfig.isHideErrorStatus ? "error" : void 0,
15397
15648
  "data-test-id": fieldConfig.key,
15649
+ className: fieldConfig.layout === FormItemLayout.VERTICAL ? VerticalFormItemStyle : "",
15398
15650
  children: ele
15399
15651
  }, fieldConfig.key);
15400
15652
  }
@@ -15403,7 +15655,7 @@ const RefineFormContent = (props) => {
15403
15655
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
15404
15656
  direction: "vertical",
15405
15657
  size: 16,
15406
- className: "c1c9j4da",
15658
+ className: "cjxv8cf",
15407
15659
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
15408
15660
  errorMsgs: errorMsgs || [],
15409
15661
  style: {
@@ -16122,7 +16374,7 @@ const PlainCodeStyle = "pqch97v";
16122
16374
  const ErrorMsgStyle = "eh2qjnl";
16123
16375
  const ErrorWrapperStyle = "e19q2bnp";
16124
16376
  const YamlEditorStyle = "y16u5v3w";
16125
- const MonacoYamlEditor = React__default.lazy(() => import("./MonacoYamlEditor-74ecf0d5.js"));
16377
+ const MonacoYamlEditor = React__default.lazy(() => import("./MonacoYamlEditor-d09e7de9.js"));
16126
16378
  const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-7de94ad2.js"));
16127
16379
  const YamlEditorComponent = forwardRef(
16128
16380
  function YamlEditorComponent2(props, ref) {
@@ -16150,20 +16402,18 @@ const YamlEditorComponent = forwardRef(
16150
16402
  const editorInstance = useRef();
16151
16403
  const [copyTooltip, setCopyTooltip] = useState(t2("dovetail.copy"));
16152
16404
  const [resetTooltip, setResetTooltip] = useState(t2("dovetail.reset_arguments"));
16153
- useImperativeHandle(ref, () => {
16154
- return {
16155
- setValue: _setValue,
16156
- setEditorValue: (value22) => {
16157
- var _a, _b;
16158
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
16159
- },
16160
- getEditorValue: () => {
16161
- var _a;
16162
- return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
16163
- },
16164
- getEditorInstance: () => editorInstance.current || null
16165
- };
16166
- });
16405
+ const defaultValueString = useMemo(() => {
16406
+ if (typeof defaultValue === "string") {
16407
+ return defaultValue;
16408
+ }
16409
+ return yaml$2.dump(defaultValue);
16410
+ }, [defaultValue]);
16411
+ const _valueString = useMemo(() => {
16412
+ if (typeof _value === "string") {
16413
+ return _value;
16414
+ }
16415
+ return yaml$2.dump(_value);
16416
+ }, [_value]);
16167
16417
  const onChange = useCallback(
16168
16418
  (newVal) => {
16169
16419
  var _a;
@@ -16186,7 +16436,7 @@ const YamlEditorComponent = forwardRef(
16186
16436
  (editor) => {
16187
16437
  var _a, _b, _c;
16188
16438
  if (editor.getValue() !== _value) {
16189
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_value);
16439
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
16190
16440
  }
16191
16441
  (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
16192
16442
  },
@@ -16195,13 +16445,29 @@ const YamlEditorComponent = forwardRef(
16195
16445
  const getInstance = useCallback((ins) => {
16196
16446
  editorInstance.current = ins;
16197
16447
  }, []);
16448
+ const getEditorValue = useCallback(() => {
16449
+ var _a;
16450
+ return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
16451
+ }, []);
16198
16452
  useEffect(() => {
16199
16453
  var _a, _b;
16200
- if (value2 !== void 0 && value2 !== _value) {
16454
+ if (value2 !== void 0 && !isEqual(value2, _value)) {
16455
+ const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
16201
16456
  _setValue(value2);
16202
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value2);
16457
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
16203
16458
  }
16204
16459
  }, [value2]);
16460
+ useImperativeHandle(ref, () => {
16461
+ return {
16462
+ setValue: _setValue,
16463
+ setEditorValue: (value22) => {
16464
+ var _a, _b;
16465
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
16466
+ },
16467
+ getEditorValue,
16468
+ getEditorInstance: () => editorInstance.current || null
16469
+ };
16470
+ });
16205
16471
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
16206
16472
  "div",
16207
16473
  {
@@ -16255,7 +16521,7 @@ const YamlEditorComponent = forwardRef(
16255
16521
  iconHeight: 16,
16256
16522
  onClick: () => {
16257
16523
  if (!isCollapsed) {
16258
- copyToClipboard(_value);
16524
+ copyToClipboard(getEditorValue());
16259
16525
  setCopyTooltip(t2("dovetail.copied"));
16260
16526
  }
16261
16527
  }
@@ -16287,7 +16553,7 @@ const YamlEditorComponent = forwardRef(
16287
16553
  onClick: () => {
16288
16554
  var _a;
16289
16555
  if (!isCollapsed) {
16290
- (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValue);
16556
+ (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
16291
16557
  setResetTooltip(t2("dovetail.already_reset"));
16292
16558
  }
16293
16559
  }
@@ -16348,7 +16614,7 @@ const YamlEditorComponent = forwardRef(
16348
16614
  zIndex: 1
16349
16615
  },
16350
16616
  children: [
16351
- /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
16617
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
16352
16618
  MonacoYamlEditor,
16353
16619
  {
16354
16620
  id: props.id,
@@ -16364,12 +16630,12 @@ const YamlEditorComponent = forwardRef(
16364
16630
  isScrollOnFocus
16365
16631
  }
16366
16632
  ) }) }),
16367
- isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
16633
+ isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
16368
16634
  MonacoYamlDiffEditor,
16369
16635
  {
16370
16636
  id: props.id,
16371
- origin: defaultValue,
16372
- modified: _value,
16637
+ origin: defaultValueString,
16638
+ modified: _valueString,
16373
16639
  height
16374
16640
  }
16375
16641
  ) }) : null
@@ -16647,21 +16913,21 @@ const useYamlForm = ({
16647
16913
  }
16648
16914
  return changeValues;
16649
16915
  };
16650
- const validateRules = (yamlValue) => {
16916
+ const validateRules = async (yamlValue) => {
16651
16917
  const errorMap = {};
16652
16918
  if (rules && isYamlValid && isSchemaValid) {
16653
16919
  const formValue = yaml$2.load(yamlValue || "");
16654
- rules.forEach((rule2) => {
16920
+ for (const rule2 of rules) {
16655
16921
  const { path: path2, validators } = rule2;
16656
16922
  const value2 = get$2(formValue, path2);
16657
16923
  for (const validator of validators || []) {
16658
- const { isValid, errorMsg } = validator(value2, formValue, FormType.YAML);
16924
+ const { isValid, errorMsg } = await validator(value2, formValue, FormType.YAML);
16659
16925
  if (!isValid) {
16660
16926
  errorMap[path2.join(".")] = `${errorMsg}(${path2.join(".")})`;
16661
16927
  break;
16662
16928
  }
16663
16929
  }
16664
- });
16930
+ }
16665
16931
  }
16666
16932
  setRulesErrors(uniq(Object.values(errorMap)));
16667
16933
  return errorMap;
@@ -16799,7 +17065,7 @@ function YamlForm(props) {
16799
17065
  try {
16800
17066
  const result = await ((_a = formProps.onFinish) == null ? void 0 : _a.call(formProps, store));
16801
17067
  if (result) {
16802
- (_b = props.onFinish) == null ? void 0 : _b.call(props);
17068
+ (_b = props.onFinish) == null ? void 0 : _b.call(props, result);
16803
17069
  }
16804
17070
  } catch {
16805
17071
  } finally {
@@ -16870,20 +17136,21 @@ function RefineFormContainer({
16870
17136
  config,
16871
17137
  id,
16872
17138
  refineProps: {
16873
- onMutationSuccess: () => {
16874
- onSuccess == null ? void 0 : onSuccess();
17139
+ onMutationSuccess: (data2) => {
17140
+ onSuccess == null ? void 0 : onSuccess(data2);
16875
17141
  },
16876
17142
  onMutationError() {
16877
17143
  onError == null ? void 0 : onError();
16878
17144
  },
16879
17145
  redirect: false,
17146
+ mutationMeta: {
17147
+ updateType: "put"
17148
+ },
16880
17149
  ...formConfig == null ? void 0 : formConfig.refineCoreProps
16881
17150
  },
16882
17151
  formConfig
16883
17152
  });
16884
- const {
16885
- transformApplyValues
16886
- } = usePathMap({
17153
+ const { transformApplyValues } = usePathMap({
16887
17154
  pathMap: formConfig == null ? void 0 : formConfig.pathMap,
16888
17155
  transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
16889
17156
  transformApplyValues: (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v)
@@ -16898,14 +17165,16 @@ function RefineFormContainer({
16898
17165
  initialValuesForCreate: transformApplyValues(
16899
17166
  refineFormResult.formResult.getValues()
16900
17167
  ),
16901
- initialValuesForEdit: transformApplyValues(refineFormResult.formResult.getValues()),
17168
+ initialValuesForEdit: transformApplyValues(
17169
+ refineFormResult.formResult.getValues()
17170
+ ),
16902
17171
  id,
16903
17172
  action,
16904
17173
  isShowLayout: false,
16905
17174
  useFormProps: {
16906
17175
  redirect: false
16907
17176
  },
16908
- rules: fieldsConfig == null ? void 0 : fieldsConfig.map((config2) => ({
17177
+ rules: fieldsConfig == null ? void 0 : fieldsConfig.filter((config2) => !config2.isSkipValidationInYaml).map((config2) => ({
16909
17178
  path: config2.path,
16910
17179
  validators: config2.validators
16911
17180
  })),
@@ -16973,51 +17242,45 @@ function YamlFormContainer({
16973
17242
  onSaveButtonPropsChange
16974
17243
  }) {
16975
17244
  const action = id ? "edit" : "create";
16976
- const {
16977
- transformInitValues,
16978
- transformApplyValues
16979
- } = usePathMap({
17245
+ const { transformInitValues, transformApplyValues } = usePathMap({
16980
17246
  pathMap: formConfig == null ? void 0 : formConfig.pathMap,
16981
17247
  transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
16982
17248
  transformApplyValues: (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v)
16983
17249
  });
16984
- const yamlFormProps = useMemo(
16985
- () => {
16986
- return {
16987
- ...customYamlFormProps,
16988
- config,
16989
- transformInitValues,
16990
- transformApplyValues,
16991
- initialValuesForCreate: (customYamlFormProps == null ? void 0 : customYamlFormProps.initialValuesForCreate) || config.initValue,
16992
- initialValuesForEdit: void 0,
16993
- id,
16994
- action,
16995
- isShowLayout: false,
16996
- useFormProps: {
16997
- redirect: false
16998
- },
16999
- rules: void 0,
17000
- onSaveButtonPropsChange,
17001
- onErrorsChange(errors) {
17002
- if (errors.length) {
17003
- onError == null ? void 0 : onError();
17004
- }
17005
- },
17006
- onFinish: onSuccess
17007
- };
17008
- },
17009
- [
17010
- id,
17011
- action,
17012
- customYamlFormProps,
17250
+ const yamlFormProps = useMemo(() => {
17251
+ return {
17252
+ ...customYamlFormProps,
17013
17253
  config,
17014
17254
  transformInitValues,
17015
17255
  transformApplyValues,
17016
- onSuccess,
17017
- onError,
17018
- onSaveButtonPropsChange
17019
- ]
17020
- );
17256
+ initialValuesForCreate: (customYamlFormProps == null ? void 0 : customYamlFormProps.initialValuesForCreate) || config.initValue,
17257
+ initialValuesForEdit: void 0,
17258
+ id,
17259
+ action,
17260
+ isShowLayout: false,
17261
+ useFormProps: {
17262
+ redirect: false
17263
+ },
17264
+ rules: void 0,
17265
+ onSaveButtonPropsChange,
17266
+ onErrorsChange(errors) {
17267
+ if (errors.length) {
17268
+ onError == null ? void 0 : onError();
17269
+ }
17270
+ },
17271
+ onFinish: onSuccess
17272
+ };
17273
+ }, [
17274
+ id,
17275
+ action,
17276
+ customYamlFormProps,
17277
+ config,
17278
+ transformInitValues,
17279
+ transformApplyValues,
17280
+ onSuccess,
17281
+ onError,
17282
+ onSaveButtonPropsChange
17283
+ ]);
17021
17284
  return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, { ...yamlFormProps });
17022
17285
  }
17023
17286
  const FormModal_64brhp = "";
@@ -17057,7 +17320,8 @@ function FormModal(props) {
17057
17320
  const {
17058
17321
  resource: resourceFromProps,
17059
17322
  id,
17060
- yamlFormProps: customYamlFormProps
17323
+ yamlFormProps: customYamlFormProps,
17324
+ onSuccess
17061
17325
  } = props;
17062
17326
  const {
17063
17327
  i18n: i18n2
@@ -17136,9 +17400,10 @@ function FormModal(props) {
17136
17400
  onError: () => {
17137
17401
  setIsError(true);
17138
17402
  },
17139
- onSuccess: () => {
17403
+ onSuccess: (data2) => {
17140
17404
  setIsError(false);
17141
17405
  popModal();
17406
+ onSuccess == null ? void 0 : onSuccess(data2);
17142
17407
  }
17143
17408
  };
17144
17409
  if (config.formConfig && (((_a2 = config.formConfig) == null ? void 0 : _a2.formType) === FormType.FORM || "fields" in config.formConfig)) {
@@ -17152,7 +17417,7 @@ function FormModal(props) {
17152
17417
  ...commonFormProps,
17153
17418
  formConfig: config.formConfig
17154
17419
  });
17155
- }, [id, customYamlFormProps, config, isYamlMode, popModal, setSaveButtonProps]);
17420
+ }, [id, customYamlFormProps, config, isYamlMode, popModal, setSaveButtonProps, onSuccess]);
17156
17421
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, {
17157
17422
  className: cx_default(FullscreenModalStyle),
17158
17423
  style: {
@@ -17325,6 +17590,7 @@ const EditLabelForm = React__default.forwardRef(
17325
17590
  const { resourceModel } = props;
17326
17591
  const { mutateAsync } = useUpdate();
17327
17592
  const { t: t2 } = useTranslation();
17593
+ const tableFormRef = useRef(null);
17328
17594
  const defaultValue = useMemo(() => {
17329
17595
  var _a2;
17330
17596
  return Object.keys(((_a2 = resourceModel.metadata) == null ? void 0 : _a2.labels) || {}).map((key2) => {
@@ -17366,10 +17632,20 @@ const EditLabelForm = React__default.forwardRef(
17366
17632
  },
17367
17633
  [resourceModel, mutateAsync, t2]
17368
17634
  );
17635
+ useImperativeHandle(
17636
+ ref,
17637
+ () => ({
17638
+ submit: () => {
17639
+ var _a2;
17640
+ return (_a2 = tableFormRef.current) == null ? void 0 : _a2.submit();
17641
+ }
17642
+ }),
17643
+ []
17644
+ );
17369
17645
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
17370
- KeyValueTableFormForm,
17646
+ KeyValueTableForm,
17371
17647
  {
17372
- ref,
17648
+ ref: tableFormRef,
17373
17649
  defaultValue,
17374
17650
  onSubmit,
17375
17651
  addButtonText: t2("dovetail.add_label")
@@ -17412,6 +17688,7 @@ const EditAnnotationForm = React__default.forwardRef(function EditAnnotationForm
17412
17688
  const { resourceModel } = props;
17413
17689
  const { mutateAsync } = useUpdate();
17414
17690
  const { t: t2 } = useTranslation();
17691
+ const tableFormRef = useRef(null);
17415
17692
  const defaultValue = useMemo(() => {
17416
17693
  var _a2;
17417
17694
  return Object.keys(((_a2 = resourceModel.metadata) == null ? void 0 : _a2.annotations) || {}).map((key2) => {
@@ -17453,10 +17730,20 @@ const EditAnnotationForm = React__default.forwardRef(function EditAnnotationForm
17453
17730
  },
17454
17731
  [resourceModel, mutateAsync, t2]
17455
17732
  );
17733
+ useImperativeHandle(
17734
+ ref,
17735
+ () => ({
17736
+ submit: () => {
17737
+ var _a2;
17738
+ return (_a2 = tableFormRef.current) == null ? void 0 : _a2.submit();
17739
+ }
17740
+ }),
17741
+ []
17742
+ );
17456
17743
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
17457
- KeyValueTableFormForm,
17744
+ KeyValueTableForm,
17458
17745
  {
17459
- ref,
17746
+ ref: tableFormRef,
17460
17747
  defaultValue,
17461
17748
  onSubmit,
17462
17749
  addButtonText: t2("dovetail.add_annotation"),
@@ -18625,7 +18912,8 @@ class ModelPlugin {
18625
18912
  Node: NodeModel,
18626
18913
  StorageClass: StorageClassModel,
18627
18914
  PersistentVolume: PersistentVolumeModel,
18628
- PersistentVolumeClaim: PersistentVolumeClaimModel
18915
+ PersistentVolumeClaim: PersistentVolumeClaimModel,
18916
+ ReplicaSet: ReplicaSetModel
18629
18917
  })
18630
18918
  ));
18631
18919
  }
@@ -18846,7 +19134,7 @@ export {
18846
19134
  CronjobJobsTable as ay,
18847
19135
  KeyValue as az,
18848
19136
  useSchema as b,
18849
- TextTags as b$,
19137
+ ServiceOutClusterAccessComponent as b$,
18850
19138
  PodSelectorField as b0,
18851
19139
  PortsTableField as b1,
18852
19140
  DurationField as b2,
@@ -18859,31 +19147,31 @@ export {
18859
19147
  PVPhaseField as b9,
18860
19148
  StorageClassPvGroup as bA,
18861
19149
  ResourceTableGroup as bB,
18862
- ShowGroupComponent as bC,
18863
- ShowContent as bD,
18864
- DeleteManyButton as bE,
18865
- ListPage as bF,
18866
- StateTag as bG,
18867
- DrawerShow as bH,
18868
- Menu as bI,
18869
- Table as bJ,
18870
- EditButton as bK,
18871
- ReferenceLink as bL,
18872
- ResourceLink as bM,
18873
- NS_STORE_KEY as bN,
18874
- ALL_NS as bO,
18875
- useNamespacesFilter as bP,
18876
- NamespacesFilter as bQ,
18877
- FormModal as bR,
18878
- renderCommonFormFiled as bS,
18879
- RefineFormContent as bT,
18880
- RefineFormPage as bU,
18881
- SchemaStrategy as bV,
18882
- YamlForm as bW,
18883
- useRefineForm as bX,
18884
- ServiceInClusterAccessComponent as bY,
18885
- ServiceOutClusterAccessComponent as bZ,
18886
- Tags as b_,
19150
+ ShowContent as bC,
19151
+ ShowGroupComponent as bD,
19152
+ ShowContentView as bE,
19153
+ DeleteManyButton as bF,
19154
+ ListPage as bG,
19155
+ StateTag as bH,
19156
+ DrawerShow as bI,
19157
+ Menu as bJ,
19158
+ Table as bK,
19159
+ EditButton as bL,
19160
+ ReferenceLink as bM,
19161
+ ResourceLink as bN,
19162
+ NS_STORE_KEY as bO,
19163
+ ALL_NS as bP,
19164
+ useNamespacesFilter as bQ,
19165
+ NamespacesFilter as bR,
19166
+ FormModal as bS,
19167
+ renderCommonFormFiled as bT,
19168
+ RefineFormContent as bU,
19169
+ RefineFormPage as bV,
19170
+ SchemaStrategy as bW,
19171
+ YamlForm as bX,
19172
+ useRefineForm as bY,
19173
+ FormItemLayout as bZ,
19174
+ ServiceInClusterAccessComponent as b_,
18887
19175
  PVVolumeModeField as ba,
18888
19176
  PVAccessModeField as bb,
18889
19177
  PVCPodsField as bc,
@@ -18911,86 +19199,93 @@ export {
18911
19199
  NetworkPolicyIngressRulesGroup as by,
18912
19200
  NetworkPolicyEgressRulesGroup as bz,
18913
19201
  useDeleteModal as c,
18914
- NodeModel as c$,
18915
- PodLog as c0,
18916
- NetworkPolicyRulesViewer as c1,
18917
- PVVolumeModeDisplay as c2,
18918
- Tabs as c3,
18919
- ResourceSelect as c4,
18920
- PodShellModal as c5,
18921
- PodShell as c6,
18922
- ResourceTable as c7,
18923
- ErrorWrapper as c8,
18924
- ErrorContentType as c9,
18925
- PVC_INIT_VALUE as cA,
18926
- ResourceState as cB,
18927
- AccessControlAuth as cC,
18928
- Dovetail as cD,
18929
- RESOURCE_GROUP as cE,
18930
- FormContainerType as cF,
18931
- FormType as cG,
18932
- FormMode as cH,
18933
- ComponentContext as cI,
18934
- GlobalStoreContext as cJ,
18935
- ConfigsContext as cK,
18936
- IngressModel as cL,
18937
- NetworkPolicyModel as cM,
18938
- JobModel as cN,
18939
- WorkloadModel as cO,
18940
- WorkloadBaseModel as cP,
18941
- PodModel as cQ,
18942
- PodMetricsModel as cR,
18943
- ResourceModel as cS,
18944
- CronJobModel as cT,
18945
- EventModel as cU,
18946
- DeploymentModel as cV,
18947
- DaemonSetModel as cW,
18948
- StatefulSetModel as cX,
18949
- ServiceTypeEnum as cY,
18950
- ServiceModel as cZ,
18951
- NodeRole as c_,
18952
- BASE_INIT_VALUE as ca,
18953
- DEPLOYMENT_INIT_VALUE as cb,
18954
- CRONJOB_INIT_VALUE as cc,
18955
- DAEMONSET_INIT_VALUE as cd,
18956
- JOB_INIT_VALUE as ce,
18957
- STATEFULSET_INIT_VALUE as cf,
18958
- POD_INIT_VALUE as cg,
18959
- SERVICE_CLUSTER_IP_INIT_VALUE as ch,
18960
- SERVICE_NODE_PORT_INIT_VALUE as ci,
18961
- SERVICE_LOAD_BALANCER_INIT_VALUE as cj,
18962
- SERVICE_EXTERNAL_NAME_INIT_VALUE as ck,
18963
- SERVICE_HEADLESS_INIT_VALUE as cl,
18964
- INGRESS_INIT_VALUE as cm,
18965
- NETWORK_POLICY_INIT_VALUE as cn,
18966
- CONFIG_MAP_INIT_VALUE as co,
18967
- SERVER_INSTANCE_INIT_VALUE as cp,
18968
- REDEPLOY_TIMESTAMP_KEY as cq,
18969
- SECRET_OPAQUE_INIT_VALUE as cr,
18970
- SECRET_IMAGE_REPO_INIT_VALUE as cs,
18971
- SECRET_BASIC_AUTH_INIT_VALUE as ct,
18972
- SECRET_SSH_AUTH_INIT_VALUE as cu,
18973
- SECRET_TLS_INIT_VALUE as cv,
18974
- SECRET_CUSTOM_INIT_VALUE as cw,
18975
- NODE_INIT_VALUE as cx,
18976
- STORAGE_CLASS_INIT_VALUE as cy,
18977
- PV_INIT_VALUE as cz,
19202
+ StatefulSetModel as c$,
19203
+ Tags as c0,
19204
+ TextTags as c1,
19205
+ PodLog as c2,
19206
+ NetworkPolicyRulesViewer as c3,
19207
+ PVVolumeModeDisplay as c4,
19208
+ Tabs as c5,
19209
+ ResourceSelect as c6,
19210
+ PodShellModal as c7,
19211
+ PodShell as c8,
19212
+ ResourceTable as c9,
19213
+ NODE_INIT_VALUE as cA,
19214
+ STORAGE_CLASS_INIT_VALUE as cB,
19215
+ PV_INIT_VALUE as cC,
19216
+ PVC_INIT_VALUE as cD,
19217
+ ResourceState as cE,
19218
+ AccessControlAuth as cF,
19219
+ Dovetail as cG,
19220
+ RESOURCE_GROUP as cH,
19221
+ FormContainerType as cI,
19222
+ FormType as cJ,
19223
+ FormMode as cK,
19224
+ ComponentContext as cL,
19225
+ GlobalStoreContext as cM,
19226
+ ConfigsContext as cN,
19227
+ IngressModel as cO,
19228
+ NetworkPolicyModel as cP,
19229
+ JobModel as cQ,
19230
+ WorkloadModel as cR,
19231
+ WorkloadBaseModel as cS,
19232
+ PodModel as cT,
19233
+ PodMetricsModel as cU,
19234
+ ResourceModel as cV,
19235
+ ReplicaSetModel as cW,
19236
+ CronJobModel as cX,
19237
+ EventModel as cY,
19238
+ DeploymentModel as cZ,
19239
+ DaemonSetModel as c_,
19240
+ ErrorWrapper as ca,
19241
+ ErrorContentType as cb,
19242
+ KeyValueTableForm as cc,
19243
+ BASE_INIT_VALUE as cd,
19244
+ DEPLOYMENT_INIT_VALUE as ce,
19245
+ CRONJOB_INIT_VALUE as cf,
19246
+ DAEMONSET_INIT_VALUE as cg,
19247
+ JOB_INIT_VALUE as ch,
19248
+ STATEFULSET_INIT_VALUE as ci,
19249
+ POD_INIT_VALUE as cj,
19250
+ SERVICE_CLUSTER_IP_INIT_VALUE as ck,
19251
+ SERVICE_NODE_PORT_INIT_VALUE as cl,
19252
+ SERVICE_LOAD_BALANCER_INIT_VALUE as cm,
19253
+ SERVICE_EXTERNAL_NAME_INIT_VALUE as cn,
19254
+ SERVICE_HEADLESS_INIT_VALUE as co,
19255
+ INGRESS_INIT_VALUE as cp,
19256
+ NETWORK_POLICY_INIT_VALUE as cq,
19257
+ CONFIG_MAP_INIT_VALUE as cr,
19258
+ SERVER_INSTANCE_INIT_VALUE as cs,
19259
+ REDEPLOY_TIMESTAMP_KEY as ct,
19260
+ SECRET_OPAQUE_INIT_VALUE as cu,
19261
+ SECRET_IMAGE_REPO_INIT_VALUE as cv,
19262
+ SECRET_BASIC_AUTH_INIT_VALUE as cw,
19263
+ SECRET_SSH_AUTH_INIT_VALUE as cx,
19264
+ SECRET_TLS_INIT_VALUE as cy,
19265
+ SECRET_CUSTOM_INIT_VALUE as cz,
18978
19266
  dovetailRefineI18n as d,
18979
- StorageClassModel as d0,
18980
- PersistentVolumeModel as d1,
18981
- PersistentVolumeClaimModel as d2,
18982
- ProviderPlugins as d3,
18983
- ModelPlugin as d4,
18984
- modelPlugin as d5,
18985
- RelationPlugin as d6,
18986
- relationPlugin as d7,
18987
- generateValueFromSchema as d8,
18988
- generateSchemaTypeValue as d9,
18989
- resolveRef as da,
18990
- getApiVersion as db,
18991
- pruneBeforeEdit as dc,
18992
- matchSelector as dd,
18993
- getResourceNameByKind as de,
19267
+ ServiceTypeEnum as d0,
19268
+ ServiceModel as d1,
19269
+ NodeRole as d2,
19270
+ NodeModel as d3,
19271
+ StorageClassModel as d4,
19272
+ PersistentVolumeModel as d5,
19273
+ PersistentVolumeClaimModel as d6,
19274
+ ProviderPlugins as d7,
19275
+ ModelPlugin as d8,
19276
+ modelPlugin as d9,
19277
+ RelationPlugin as da,
19278
+ relationPlugin as db,
19279
+ generateValueFromSchema as dc,
19280
+ generateSchemaTypeValue as dd,
19281
+ resolveRef as de,
19282
+ getApiVersion as df,
19283
+ pruneBeforeEdit as dg,
19284
+ matchSelector as dh,
19285
+ getResourceNameByKind as di,
19286
+ validateDnsSubdomain as dj,
19287
+ validateLabelKey as dk,
19288
+ validateLabelValue as dl,
18994
19289
  useDeleteModalOnly as e,
18995
19290
  useFailedModal as f,
18996
19291
  NameSpaceColumnRenderer as g,