@dovetail-v2/refine 0.3.15-alpha.0 → 0.3.17-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,8 @@ export declare const ErrorContent: import("@linaria/react").StyledComponent<Reac
4
4
  export declare enum ErrorContentType {
5
5
  List = "list",
6
6
  Card = "card",
7
- Widget = "widget"
7
+ Widget = "widget",
8
+ Item = "item"
8
9
  }
9
10
  export type WidgetErrorContentProps = {
10
11
  className?: string;
@@ -16,6 +16,7 @@ export type YamlEditorProps<T extends string | Record<string, unknown> = string>
16
16
  readOnly?: boolean;
17
17
  debounceTime?: number;
18
18
  isScrollOnFocus?: boolean;
19
+ isHideActions?: boolean;
19
20
  onChange?: (value: T) => void;
20
21
  onValidate?: (valid: boolean, schemaValid: boolean) => void;
21
22
  onEditorCreate?: (editor: editor.IStandaloneCodeEditor) => void;
package/dist/i18n.d.ts CHANGED
@@ -528,6 +528,8 @@ export declare const resources: {
528
528
  select_workload: string;
529
529
  no_search_result: string;
530
530
  clear_search_condition: string;
531
+ no_labels: string;
532
+ no_annotations: string;
531
533
  };
532
534
  };
533
535
  };
@@ -271,6 +271,8 @@ declare const _default: {
271
271
  select_workload: string;
272
272
  no_search_result: string;
273
273
  clear_search_condition: string;
274
+ no_labels: string;
275
+ no_annotations: string;
274
276
  };
275
277
  };
276
278
  export default _default;
package/dist/refine.cjs CHANGED
@@ -1230,6 +1230,8 @@ const target_service_port = "目标服务端口";
1230
1230
  const select_workload = "选择工作负载";
1231
1231
  const no_search_result = "无搜索结果";
1232
1232
  const clear_search_condition = "清空搜索条件";
1233
+ const no_labels = "无标签";
1234
+ const no_annotations = "无注解";
1233
1235
  const dovetail = {
1234
1236
  copy,
1235
1237
  reset_arguments,
@@ -1501,7 +1503,9 @@ const dovetail = {
1501
1503
  target_service_port,
1502
1504
  select_workload,
1503
1505
  no_search_result,
1504
- clear_search_condition
1506
+ clear_search_condition,
1507
+ no_labels,
1508
+ no_annotations
1505
1509
  };
1506
1510
  const ZH = {
1507
1511
  dovetail
@@ -7953,7 +7957,7 @@ var styled_default = process.env.NODE_ENV !== "production" ? new Proxy(styled, {
7953
7957
  return o(prop);
7954
7958
  }
7955
7959
  }) : styled;
7956
- const index_hjjv5w = "";
7960
+ const index_l4xyq7 = "";
7957
7961
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
7958
7962
  name: "ErrorWrapper",
7959
7963
  class: "egn3dbn",
@@ -7968,6 +7972,7 @@ var ErrorContentType = /* @__PURE__ */ ((ErrorContentType2) => {
7968
7972
  ErrorContentType2["List"] = "list";
7969
7973
  ErrorContentType2["Card"] = "card";
7970
7974
  ErrorContentType2["Widget"] = "widget";
7975
+ ErrorContentType2["Item"] = "item";
7971
7976
  return ErrorContentType2;
7972
7977
  })(ErrorContentType || {});
7973
7978
  const WidgetErrorContent = (props) => {
@@ -7982,18 +7987,26 @@ const WidgetErrorContent = (props) => {
7982
7987
  t: t2
7983
7988
  } = common.useTranslation();
7984
7989
  const fontMap = {
7990
+ // 小卡片
7985
7991
  [
7986
7992
  "widget"
7987
7993
  /* Widget */
7988
7994
  ]: eagle.Typo.Label.l1_regular_title,
7995
+ // 详情里整个大卡片
7989
7996
  [
7990
7997
  "card"
7991
7998
  /* Card */
7992
7999
  ]: eagle.Typo.Label.l1_bold,
8000
+ // 列表
7993
8001
  [
7994
8002
  "list"
7995
8003
  /* List */
7996
- ]: eagle.Typo.Display.d2_bold_title
8004
+ ]: eagle.Typo.Display.d2_bold_title,
8005
+ // 详情里的某一项
8006
+ [
8007
+ "item"
8008
+ /* Item */
8009
+ ]: eagle.Typo.Heading.h2_bold_title
7997
8010
  };
7998
8011
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ErrorWrapper, {
7999
8012
  className: common.cx_default(props.className, type2),
@@ -9699,8 +9712,8 @@ class PodModel extends WorkloadBaseModel {
9699
9712
  return this.ips.join(", ");
9700
9713
  }
9701
9714
  get hasDnsConfig() {
9702
- var _a, _b, _c, _d;
9703
- return !!(((_a = this.spec) == null ? void 0 : _a.dnsConfig) && (((_b = this.spec.dnsConfig.nameservers) == null ? void 0 : _b.length) || ((_c = this.spec.dnsConfig.searches) == null ? void 0 : _c.length) || ((_d = this.spec.dnsConfig.options) == null ? void 0 : _d.length)));
9715
+ var _a, _b, _c, _d, _e, _f, _g;
9716
+ return !!(((_a = this.spec) == null ? void 0 : _a.dnsConfig) && (((_b = this.spec.dnsConfig.nameservers) == null ? void 0 : _b.length) || ((_c = this.spec.dnsConfig.searches) == null ? void 0 : _c.length) || ((_d = this.spec.dnsConfig.options) == null ? void 0 : _d.length)) || ((_e = this.spec) == null ? void 0 : _e.dnsPolicy) || ((_g = (_f = this.spec) == null ? void 0 : _f.hostAliases) == null ? void 0 : _g.length));
9704
9717
  }
9705
9718
  }
9706
9719
  class PodMetricsModel extends ResourceModel {
@@ -10390,7 +10403,14 @@ const ConditionsTable = ({ conditions = [] }) => {
10390
10403
  width: 120,
10391
10404
  sortable: true,
10392
10405
  render: (value2) => {
10393
- return value2;
10406
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10407
+ eagle.StatusCapsule,
10408
+ {
10409
+ color: value2 === "True" ? "green" : "red",
10410
+ className: common.cx_default(StateTagStyle, "no-background"),
10411
+ children: value2 === "True" ? t2("dovetail.true") : t2("dovetail.false")
10412
+ }
10413
+ );
10394
10414
  }
10395
10415
  },
10396
10416
  {
@@ -10729,7 +10749,12 @@ function validateLabelValue(value2, i18n2, isOptional) {
10729
10749
  if (isOptional && value2 === "") {
10730
10750
  return { isValid: true };
10731
10751
  } else if (value2 === "") {
10732
- return { isValid: false, errorMessage: i18n2.t("dovetail.required_field", { label: i18n2.t("dovetail.value") }) };
10752
+ return {
10753
+ isValid: false,
10754
+ errorMessage: i18n2.t("dovetail.required_field", {
10755
+ label: i18n2.t("dovetail.value")
10756
+ })
10757
+ };
10733
10758
  }
10734
10759
  if (value2.length > 63) {
10735
10760
  return { isValid: false };
@@ -10766,7 +10791,7 @@ function validatePort(port2, options) {
10766
10791
  return { isValid: true };
10767
10792
  }
10768
10793
  function validateNodePort(nodePort, allNodePorts, i18n2) {
10769
- if (!nodePort) {
10794
+ if (nodePort === "") {
10770
10795
  return {
10771
10796
  isValid: false,
10772
10797
  errorMessage: i18n2.t("dovetail.required_field", {
@@ -10784,7 +10809,7 @@ function validateNodePort(nodePort, allNodePorts, i18n2) {
10784
10809
  return { isValid: true };
10785
10810
  }
10786
10811
  function K8sDropdown(props) {
10787
- var _a;
10812
+ var _a, _b;
10788
10813
  const { record, size = "normal", customButton } = props;
10789
10814
  const globalStore = useGlobalStore();
10790
10815
  const useResourceResult = core.useResource();
@@ -10795,7 +10820,7 @@ function K8sDropdown(props) {
10795
10820
  const { openDeleteConfirmModal } = useDeleteModal({ resourceName: resourceName || "" });
10796
10821
  const download2 = useDownloadYAML();
10797
10822
  const openForm = useOpenForm();
10798
- const isInShowPage = useResourceResult.action === "show";
10823
+ const isInShowPage = useResourceResult.action === "show" && ((_a = useResourceResult.resource) == null ? void 0 : _a.name) === config.name;
10799
10824
  const { data: canEditData } = core.useCan({
10800
10825
  resource: resourceName,
10801
10826
  action: AccessControlAuth.Edit,
@@ -10810,7 +10835,7 @@ function K8sDropdown(props) {
10810
10835
  namespace: record.namespace
10811
10836
  }
10812
10837
  });
10813
- const formType = ((_a = config.formConfig) == null ? void 0 : _a.formType) || FormType.FORM;
10838
+ const formType = ((_b = config.formConfig) == null ? void 0 : _b.formType) || FormType.FORM;
10814
10839
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(common.jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10815
10840
  eagle.Dropdown,
10816
10841
  {
@@ -11448,16 +11473,21 @@ const KeyValue = (props) => {
11448
11473
  const {
11449
11474
  t: t2
11450
11475
  } = common.useTranslation();
11451
- const result = Object.keys(data2).map((key2) => /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
11452
- className: ContentBlockStyle,
11453
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11454
- className: common.cx_default(KeyStyle, eagle.Typo.Label.l4_regular),
11455
- children: key2
11456
- }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11457
- className: common.cx_default(eagle.Typo.Label.l4_regular, ValueStyle$2),
11458
- children: hideSecret ? toAsterisk(data2[key2]) : data2[key2]
11459
- })]
11460
- }, key2));
11476
+ const result = Object.keys(data2).map((key2) => {
11477
+ const value2 = hideSecret ? toAsterisk(data2[key2]) : data2[key2];
11478
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
11479
+ className: ContentBlockStyle,
11480
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11481
+ className: common.cx_default(KeyStyle, eagle.Typo.Label.l4_regular),
11482
+ children: key2
11483
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11484
+ className: common.cx_default(eagle.Typo.Label.l4_regular, ValueStyle$2),
11485
+ children: value2 || /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
11486
+ value: ""
11487
+ })
11488
+ })]
11489
+ }, key2);
11490
+ });
11461
11491
  if (!result.length) {
11462
11492
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(WidgetErrorContent, {
11463
11493
  errorText: empty2 || t2("dovetail.empty"),
@@ -11753,6 +11783,7 @@ function _KeyValueTableForm(props, ref) {
11753
11783
  rowIndex,
11754
11784
  disabled
11755
11785
  }) => {
11786
+ const record = _value[rowIndex || 0];
11756
11787
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.AutoComplete, {
11757
11788
  options: keyOptions || [],
11758
11789
  value: value22,
@@ -11762,7 +11793,7 @@ function _KeyValueTableForm(props, ref) {
11762
11793
  var _a;
11763
11794
  return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toString().toLowerCase().includes(inputValue.toLowerCase())) || false;
11764
11795
  },
11765
- disabled: disabled || disabledChagneDefaultValues && (rowIndex || 0) < (defaultValue.length || 0),
11796
+ disabled: disabled || disabledChagneDefaultValues && defaultValue.some((row) => lodashEs.isEqual(row, record)),
11766
11797
  allowClear: true
11767
11798
  });
11768
11799
  };
@@ -11772,12 +11803,13 @@ function _KeyValueTableForm(props, ref) {
11772
11803
  rowIndex,
11773
11804
  disabled
11774
11805
  }) => {
11806
+ const record = _value[rowIndex || 0];
11775
11807
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.TextArea, {
11776
11808
  autoSize: true,
11777
11809
  className: "c17gq8cd",
11778
11810
  size: "small",
11779
11811
  value: value22,
11780
- disabled: disabled || disabledChagneDefaultValues && (rowIndex || 0) < (defaultValue.length || 0),
11812
+ disabled: disabled || disabledChagneDefaultValues && defaultValue.some((row) => lodashEs.isEqual(row, record)),
11781
11813
  onChange: (e2) => {
11782
11814
  onChange2(e2.target.value);
11783
11815
  }
@@ -11838,15 +11870,16 @@ function _KeyValueTableForm(props, ref) {
11838
11870
  defaultData: _value,
11839
11871
  row: {
11840
11872
  deletable: _value.length > (minSize || 0),
11841
- disableActions(rowIndex) {
11842
- if (disabledChagneDefaultValues && rowIndex < (defaultValue.length || 0)) {
11873
+ disableActions(rowIndex, datas) {
11874
+ const record = datas[rowIndex];
11875
+ if (disabledChagneDefaultValues && defaultValue.some((row) => lodashEs.isEqual(row, record))) {
11843
11876
  return ["delete"];
11844
11877
  }
11845
11878
  }
11846
11879
  },
11847
11880
  disableBatchFilling: true,
11848
11881
  hideEmptyTable: true
11849
- }), isHideLabelFormatPopover ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(LabelFormatPopover, {
11882
+ }), isHideLabelFormatPopover || _value.length === 0 ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(LabelFormatPopover, {
11850
11883
  noValueValidation
11851
11884
  })]
11852
11885
  });
@@ -13057,8 +13090,8 @@ const LabelsAndAnnotationsShow = ({
13057
13090
  }), Object.keys(labels || {}).length ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(Tags, {
13058
13091
  value: labels
13059
13092
  }) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(WidgetErrorContent, {
13060
- errorText: sksI18n.t("dovetail.empty"),
13061
- type: ErrorContentType.Card
13093
+ errorText: sksI18n.t("dovetail.no_labels"),
13094
+ type: ErrorContentType.Item
13062
13095
  })]
13063
13096
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13064
13097
  className: ItemWrapperStyle,
@@ -13067,7 +13100,8 @@ const LabelsAndAnnotationsShow = ({
13067
13100
  children: sksI18n.t("dovetail.annotation")
13068
13101
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsx(KeyValue, {
13069
13102
  data: annotations,
13070
- errorContent: ErrorContentType.Card
13103
+ empty: sksI18n.t("dovetail.no_annotations"),
13104
+ errorContent: ErrorContentType.Item
13071
13105
  })]
13072
13106
  })]
13073
13107
  });
@@ -15750,7 +15784,8 @@ const YamlEditorComponent = React.forwardRef(
15750
15784
  eleRef,
15751
15785
  className,
15752
15786
  debounceTime,
15753
- isScrollOnFocus = true
15787
+ isScrollOnFocus = true,
15788
+ isHideActions = false
15754
15789
  } = props;
15755
15790
  const { t: t2 } = common.useTranslation();
15756
15791
  const [isCollapsed, setIsCollapsed] = React.useState(
@@ -15856,7 +15891,7 @@ const YamlEditorComponent = React.forwardRef(
15856
15891
  ),
15857
15892
  /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { className: common.cx_default(TitleStyle, "yaml-editor-title"), children: title || t2("dovetail.configure_file") })
15858
15893
  ] }),
15859
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 14, children: [
15894
+ isHideActions ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 14, children: [
15860
15895
  isDiff ? void 0 : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
15861
15896
  /* @__PURE__ */ common.jsxRuntimeExports.jsx(
15862
15897
  eagle.Tooltip,
@@ -17943,7 +17978,7 @@ const MatchLabelSelector = React.forwardRef(function MatchLabelSelector2(props,
17943
17978
  }
17944
17979
  ),
17945
17980
  onChange,
17946
- isValueOptional: false,
17981
+ isValueOptional: true,
17947
17982
  minSize: 1,
17948
17983
  disabledChagneDefaultValues
17949
17984
  }
@@ -18782,7 +18817,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
18782
18817
  },
18783
18818
  {
18784
18819
  key: "name",
18785
- title: i18n2.t("dovetail.port_name"),
18820
+ title: `${i18n2.t("dovetail.name")} ${i18n2.t("dovetail.optional_with_bracket")}`,
18786
18821
  type: "input",
18787
18822
  validator: ({ value: portName, rowIndex }) => {
18788
18823
  const { errorMessage } = validateRfc1123Name({
@@ -18810,7 +18845,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
18810
18845
  );
18811
18846
  },
18812
18847
  validator: ({ value: value22 }) => {
18813
- const { isValid, errorMessage } = validatePort(value22 || "", {
18848
+ const { isValid, errorMessage } = validatePort(value22 ?? "", {
18814
18849
  isOptional: false,
18815
18850
  i18n: i18n2,
18816
18851
  emptyText: i18n2.t("dovetail.required_field", {
@@ -18836,7 +18871,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
18836
18871
  );
18837
18872
  },
18838
18873
  validator: ({ value: value22 }) => {
18839
- const { isValid, errorMessage } = validatePort(value22 || "", {
18874
+ const { isValid, errorMessage } = validatePort(value22 ?? "", {
18840
18875
  isOptional: false,
18841
18876
  i18n: i18n2,
18842
18877
  emptyText: i18n2.t("dovetail.required_field", {
@@ -18873,7 +18908,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
18873
18908
  }
18874
18909
  ).map((row) => row.nodePort.value)
18875
18910
  ];
18876
- const { isValid, errorMessage } = value22.mode === "auto" ? { isValid: true, errorMessage: void 0 } : validateNodePort(value22.value, allNodePorts, i18n2);
18911
+ const { isValid, errorMessage } = value22.mode === "auto" ? { isValid: true, errorMessage: void 0 } : validateNodePort(value22.value ?? "", allNodePorts, i18n2);
18877
18912
  if (!isValid)
18878
18913
  return errorMessage;
18879
18914
  }
@@ -19474,13 +19509,7 @@ const DataKeysColumnRenderer = (i18n2) => {
19474
19509
  const PortMappingColumnRenderer = (i18n2) => {
19475
19510
  return {
19476
19511
  key: "displayPortMapping",
19477
- title: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tooltip, {
19478
- title: i18n2.t("dovetail.port_mapping_title_tooltip"),
19479
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
19480
- className: DashedTitleStyle,
19481
- children: i18n2.t("dovetail.port_mapping")
19482
- })
19483
- }),
19512
+ title: i18n2.t("dovetail.port_mapping"),
19484
19513
  display: true,
19485
19514
  dataIndex: ["displayPortMapping"],
19486
19515
  width: 300,
@@ -20048,6 +20077,7 @@ exports.DataTab = DataTab;
20048
20077
  exports.DeleteButton = DeleteButton;
20049
20078
  exports.DeleteManyButton = DeleteManyButton;
20050
20079
  exports.DeploymentModel = DeploymentModel;
20080
+ exports.DnsSubdomainRegExp = DnsSubdomainRegExp;
20051
20081
  exports.Dovetail = Dovetail;
20052
20082
  exports.DrawerShow = DrawerShow;
20053
20083
  exports.DurationColumnRenderer = DurationColumnRenderer;
@@ -20209,6 +20239,8 @@ exports.ResourceTableField = ResourceTableField;
20209
20239
  exports.ResourceTableGroup = ResourceTableGroup;
20210
20240
  exports.ResourceUsageBar = ResourceUsageBar;
20211
20241
  exports.RestartsColumnRenderer = RestartsColumnRenderer;
20242
+ exports.Rfc1035NameRegExp = Rfc1035NameRegExp;
20243
+ exports.Rfc1123NameRegExp = Rfc1123NameRegExp;
20212
20244
  exports.SCAllowExpandColumnRenderer = SCAllowExpandColumnRenderer;
20213
20245
  exports.SCReclaimPolicyColumnRenderer = SCReclaimPolicyColumnRenderer;
20214
20246
  exports.SCReclaimPolicyField = SCReclaimPolicyField;
package/dist/refine.js CHANGED
@@ -11,7 +11,7 @@ import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNav
11
11
  import { parse, stringify } from "qs";
12
12
  import React, { createElement, isValidElement, cloneElement, Children, useContext, useCallback, createContext, useState, useEffect, useMemo, useRef, useImperativeHandle, lazy, Suspense, memo, forwardRef } from "react";
13
13
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
14
- import { usePushModal, usePopModal, DeleteDialog, Tag, RejectDialog, RejectDialogType, Typo, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Loading, Table as Table$2, Pagination, Alert, ImmersiveDialog, SmallDialog, Fields, Units, Link as Link$1, OverflowTooltip, Tooltip, Dropdown, Menu as Menu$1, Icon, Divider, LegacyModal, StatusCapsule, Popover, AntdTable, Upload, TableForm, AutoComplete, getOptions, DonutChart, SegmentControl, Checkbox, Tabs as Tabs$1, TabsTabPane, Col, Row, useMessage, SearchInput, Token, AntdSelectOptGroup, WizardDialog, MenuItemGroup, Layout as Layout$1, InputGroup, InputInteger, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
14
+ import { usePushModal, usePopModal, DeleteDialog, Tag, RejectDialog, RejectDialogType, Typo, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Loading, Table as Table$2, Pagination, Alert, ImmersiveDialog, SmallDialog, Fields, Units, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, Dropdown, Menu as Menu$1, Icon, Divider, LegacyModal, Popover, AntdTable, Upload, TableForm, AutoComplete, getOptions, DonutChart, SegmentControl, Checkbox, Tabs as Tabs$1, TabsTabPane, Col, Row, useMessage, SearchInput, Token, AntdSelectOptGroup, WizardDialog, MenuItemGroup, Layout as Layout$1, InputGroup, InputInteger, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
15
15
  import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, ArrowChevronDownSmall16BlueIcon, ArrowChevronUpSmall16BlueIcon, Retry16GradientBlueIcon, OpenTerminal16GradientBlueIcon, ArrowChevronDown16BlueIcon, ArrowChevronUp16BlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
16
16
  import { first, get as get$2, cloneDeep, set, omit as omit$1, merge, isEqual as isEqual$1, debounce, last, setWith, clone, isObject as isObject$4, uniq, keyBy } from "lodash-es";
17
17
  import yaml$2 from "js-yaml";
@@ -1211,6 +1211,8 @@ const target_service_port = "目标服务端口";
1211
1211
  const select_workload = "选择工作负载";
1212
1212
  const no_search_result = "无搜索结果";
1213
1213
  const clear_search_condition = "清空搜索条件";
1214
+ const no_labels = "无标签";
1215
+ const no_annotations = "无注解";
1214
1216
  const dovetail = {
1215
1217
  copy,
1216
1218
  reset_arguments,
@@ -1482,7 +1484,9 @@ const dovetail = {
1482
1484
  target_service_port,
1483
1485
  select_workload,
1484
1486
  no_search_result,
1485
- clear_search_condition
1487
+ clear_search_condition,
1488
+ no_labels,
1489
+ no_annotations
1486
1490
  };
1487
1491
  const ZH = {
1488
1492
  dovetail
@@ -7934,7 +7938,7 @@ var styled_default = process.env.NODE_ENV !== "production" ? new Proxy(styled, {
7934
7938
  return o(prop);
7935
7939
  }
7936
7940
  }) : styled;
7937
- const index_hjjv5w = "";
7941
+ const index_l4xyq7 = "";
7938
7942
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
7939
7943
  name: "ErrorWrapper",
7940
7944
  class: "egn3dbn",
@@ -7949,6 +7953,7 @@ var ErrorContentType = /* @__PURE__ */ ((ErrorContentType2) => {
7949
7953
  ErrorContentType2["List"] = "list";
7950
7954
  ErrorContentType2["Card"] = "card";
7951
7955
  ErrorContentType2["Widget"] = "widget";
7956
+ ErrorContentType2["Item"] = "item";
7952
7957
  return ErrorContentType2;
7953
7958
  })(ErrorContentType || {});
7954
7959
  const WidgetErrorContent = (props) => {
@@ -7963,18 +7968,26 @@ const WidgetErrorContent = (props) => {
7963
7968
  t: t2
7964
7969
  } = useTranslation();
7965
7970
  const fontMap = {
7971
+ // 小卡片
7966
7972
  [
7967
7973
  "widget"
7968
7974
  /* Widget */
7969
7975
  ]: Typo.Label.l1_regular_title,
7976
+ // 详情里整个大卡片
7970
7977
  [
7971
7978
  "card"
7972
7979
  /* Card */
7973
7980
  ]: Typo.Label.l1_bold,
7981
+ // 列表
7974
7982
  [
7975
7983
  "list"
7976
7984
  /* List */
7977
- ]: Typo.Display.d2_bold_title
7985
+ ]: Typo.Display.d2_bold_title,
7986
+ // 详情里的某一项
7987
+ [
7988
+ "item"
7989
+ /* Item */
7990
+ ]: Typo.Heading.h2_bold_title
7978
7991
  };
7979
7992
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorWrapper, {
7980
7993
  className: cx_default(props.className, type2),
@@ -9680,8 +9693,8 @@ class PodModel extends WorkloadBaseModel {
9680
9693
  return this.ips.join(", ");
9681
9694
  }
9682
9695
  get hasDnsConfig() {
9683
- var _a, _b, _c, _d;
9684
- return !!(((_a = this.spec) == null ? void 0 : _a.dnsConfig) && (((_b = this.spec.dnsConfig.nameservers) == null ? void 0 : _b.length) || ((_c = this.spec.dnsConfig.searches) == null ? void 0 : _c.length) || ((_d = this.spec.dnsConfig.options) == null ? void 0 : _d.length)));
9696
+ var _a, _b, _c, _d, _e, _f, _g;
9697
+ return !!(((_a = this.spec) == null ? void 0 : _a.dnsConfig) && (((_b = this.spec.dnsConfig.nameservers) == null ? void 0 : _b.length) || ((_c = this.spec.dnsConfig.searches) == null ? void 0 : _c.length) || ((_d = this.spec.dnsConfig.options) == null ? void 0 : _d.length)) || ((_e = this.spec) == null ? void 0 : _e.dnsPolicy) || ((_g = (_f = this.spec) == null ? void 0 : _f.hostAliases) == null ? void 0 : _g.length));
9685
9698
  }
9686
9699
  }
9687
9700
  class PodMetricsModel extends ResourceModel {
@@ -10371,7 +10384,14 @@ const ConditionsTable = ({ conditions = [] }) => {
10371
10384
  width: 120,
10372
10385
  sortable: true,
10373
10386
  render: (value2) => {
10374
- return value2;
10387
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10388
+ StatusCapsule,
10389
+ {
10390
+ color: value2 === "True" ? "green" : "red",
10391
+ className: cx_default(StateTagStyle, "no-background"),
10392
+ children: value2 === "True" ? t2("dovetail.true") : t2("dovetail.false")
10393
+ }
10394
+ );
10375
10395
  }
10376
10396
  },
10377
10397
  {
@@ -10710,7 +10730,12 @@ function validateLabelValue(value2, i18n2, isOptional) {
10710
10730
  if (isOptional && value2 === "") {
10711
10731
  return { isValid: true };
10712
10732
  } else if (value2 === "") {
10713
- return { isValid: false, errorMessage: i18n2.t("dovetail.required_field", { label: i18n2.t("dovetail.value") }) };
10733
+ return {
10734
+ isValid: false,
10735
+ errorMessage: i18n2.t("dovetail.required_field", {
10736
+ label: i18n2.t("dovetail.value")
10737
+ })
10738
+ };
10714
10739
  }
10715
10740
  if (value2.length > 63) {
10716
10741
  return { isValid: false };
@@ -10747,7 +10772,7 @@ function validatePort(port2, options) {
10747
10772
  return { isValid: true };
10748
10773
  }
10749
10774
  function validateNodePort(nodePort, allNodePorts, i18n2) {
10750
- if (!nodePort) {
10775
+ if (nodePort === "") {
10751
10776
  return {
10752
10777
  isValid: false,
10753
10778
  errorMessage: i18n2.t("dovetail.required_field", {
@@ -10765,7 +10790,7 @@ function validateNodePort(nodePort, allNodePorts, i18n2) {
10765
10790
  return { isValid: true };
10766
10791
  }
10767
10792
  function K8sDropdown(props) {
10768
- var _a;
10793
+ var _a, _b;
10769
10794
  const { record, size = "normal", customButton } = props;
10770
10795
  const globalStore = useGlobalStore();
10771
10796
  const useResourceResult = useResource();
@@ -10776,7 +10801,7 @@ function K8sDropdown(props) {
10776
10801
  const { openDeleteConfirmModal } = useDeleteModal({ resourceName: resourceName || "" });
10777
10802
  const download2 = useDownloadYAML();
10778
10803
  const openForm = useOpenForm();
10779
- const isInShowPage = useResourceResult.action === "show";
10804
+ const isInShowPage = useResourceResult.action === "show" && ((_a = useResourceResult.resource) == null ? void 0 : _a.name) === config.name;
10780
10805
  const { data: canEditData } = useCan({
10781
10806
  resource: resourceName,
10782
10807
  action: AccessControlAuth.Edit,
@@ -10791,7 +10816,7 @@ function K8sDropdown(props) {
10791
10816
  namespace: record.namespace
10792
10817
  }
10793
10818
  });
10794
- const formType = ((_a = config.formConfig) == null ? void 0 : _a.formType) || FormType.FORM;
10819
+ const formType = ((_b = config.formConfig) == null ? void 0 : _b.formType) || FormType.FORM;
10795
10820
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10796
10821
  Dropdown,
10797
10822
  {
@@ -11429,16 +11454,21 @@ const KeyValue = (props) => {
11429
11454
  const {
11430
11455
  t: t2
11431
11456
  } = useTranslation();
11432
- const result = Object.keys(data2).map((key2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11433
- className: ContentBlockStyle,
11434
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11435
- className: cx_default(KeyStyle, Typo.Label.l4_regular),
11436
- children: key2
11437
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11438
- className: cx_default(Typo.Label.l4_regular, ValueStyle$2),
11439
- children: hideSecret ? toAsterisk(data2[key2]) : data2[key2]
11440
- })]
11441
- }, key2));
11457
+ const result = Object.keys(data2).map((key2) => {
11458
+ const value2 = hideSecret ? toAsterisk(data2[key2]) : data2[key2];
11459
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11460
+ className: ContentBlockStyle,
11461
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11462
+ className: cx_default(KeyStyle, Typo.Label.l4_regular),
11463
+ children: key2
11464
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11465
+ className: cx_default(Typo.Label.l4_regular, ValueStyle$2),
11466
+ children: value2 || /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
11467
+ value: ""
11468
+ })
11469
+ })]
11470
+ }, key2);
11471
+ });
11442
11472
  if (!result.length) {
11443
11473
  return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
11444
11474
  errorText: empty2 || t2("dovetail.empty"),
@@ -11734,6 +11764,7 @@ function _KeyValueTableForm(props, ref) {
11734
11764
  rowIndex,
11735
11765
  disabled
11736
11766
  }) => {
11767
+ const record = _value[rowIndex || 0];
11737
11768
  return /* @__PURE__ */ jsxRuntimeExports.jsx(AutoComplete, {
11738
11769
  options: keyOptions || [],
11739
11770
  value: value22,
@@ -11743,7 +11774,7 @@ function _KeyValueTableForm(props, ref) {
11743
11774
  var _a;
11744
11775
  return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toString().toLowerCase().includes(inputValue.toLowerCase())) || false;
11745
11776
  },
11746
- disabled: disabled || disabledChagneDefaultValues && (rowIndex || 0) < (defaultValue.length || 0),
11777
+ disabled: disabled || disabledChagneDefaultValues && defaultValue.some((row) => isEqual$1(row, record)),
11747
11778
  allowClear: true
11748
11779
  });
11749
11780
  };
@@ -11753,12 +11784,13 @@ function _KeyValueTableForm(props, ref) {
11753
11784
  rowIndex,
11754
11785
  disabled
11755
11786
  }) => {
11787
+ const record = _value[rowIndex || 0];
11756
11788
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TextArea, {
11757
11789
  autoSize: true,
11758
11790
  className: "c17gq8cd",
11759
11791
  size: "small",
11760
11792
  value: value22,
11761
- disabled: disabled || disabledChagneDefaultValues && (rowIndex || 0) < (defaultValue.length || 0),
11793
+ disabled: disabled || disabledChagneDefaultValues && defaultValue.some((row) => isEqual$1(row, record)),
11762
11794
  onChange: (e2) => {
11763
11795
  onChange2(e2.target.value);
11764
11796
  }
@@ -11819,15 +11851,16 @@ function _KeyValueTableForm(props, ref) {
11819
11851
  defaultData: _value,
11820
11852
  row: {
11821
11853
  deletable: _value.length > (minSize || 0),
11822
- disableActions(rowIndex) {
11823
- if (disabledChagneDefaultValues && rowIndex < (defaultValue.length || 0)) {
11854
+ disableActions(rowIndex, datas) {
11855
+ const record = datas[rowIndex];
11856
+ if (disabledChagneDefaultValues && defaultValue.some((row) => isEqual$1(row, record))) {
11824
11857
  return ["delete"];
11825
11858
  }
11826
11859
  }
11827
11860
  },
11828
11861
  disableBatchFilling: true,
11829
11862
  hideEmptyTable: true
11830
- }), isHideLabelFormatPopover ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {
11863
+ }), isHideLabelFormatPopover || _value.length === 0 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {
11831
11864
  noValueValidation
11832
11865
  })]
11833
11866
  });
@@ -13038,8 +13071,8 @@ const LabelsAndAnnotationsShow = ({
13038
13071
  }), Object.keys(labels || {}).length ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tags, {
13039
13072
  value: labels
13040
13073
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
13041
- errorText: sksI18n.t("dovetail.empty"),
13042
- type: ErrorContentType.Card
13074
+ errorText: sksI18n.t("dovetail.no_labels"),
13075
+ type: ErrorContentType.Item
13043
13076
  })]
13044
13077
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13045
13078
  className: ItemWrapperStyle,
@@ -13048,7 +13081,8 @@ const LabelsAndAnnotationsShow = ({
13048
13081
  children: sksI18n.t("dovetail.annotation")
13049
13082
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValue, {
13050
13083
  data: annotations,
13051
- errorContent: ErrorContentType.Card
13084
+ empty: sksI18n.t("dovetail.no_annotations"),
13085
+ errorContent: ErrorContentType.Item
13052
13086
  })]
13053
13087
  })]
13054
13088
  });
@@ -15731,7 +15765,8 @@ const YamlEditorComponent = forwardRef(
15731
15765
  eleRef,
15732
15766
  className,
15733
15767
  debounceTime,
15734
- isScrollOnFocus = true
15768
+ isScrollOnFocus = true,
15769
+ isHideActions = false
15735
15770
  } = props;
15736
15771
  const { t: t2 } = useTranslation();
15737
15772
  const [isCollapsed, setIsCollapsed] = useState(
@@ -15837,7 +15872,7 @@ const YamlEditorComponent = forwardRef(
15837
15872
  ),
15838
15873
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cx_default(TitleStyle, "yaml-editor-title"), children: title || t2("dovetail.configure_file") })
15839
15874
  ] }),
15840
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { size: 14, children: [
15875
+ isHideActions ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { size: 14, children: [
15841
15876
  isDiff ? void 0 : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
15842
15877
  /* @__PURE__ */ jsxRuntimeExports.jsx(
15843
15878
  Tooltip,
@@ -17924,7 +17959,7 @@ const MatchLabelSelector = React.forwardRef(function MatchLabelSelector2(props,
17924
17959
  }
17925
17960
  ),
17926
17961
  onChange,
17927
- isValueOptional: false,
17962
+ isValueOptional: true,
17928
17963
  minSize: 1,
17929
17964
  disabledChagneDefaultValues
17930
17965
  }
@@ -18763,7 +18798,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
18763
18798
  },
18764
18799
  {
18765
18800
  key: "name",
18766
- title: i18n2.t("dovetail.port_name"),
18801
+ title: `${i18n2.t("dovetail.name")} ${i18n2.t("dovetail.optional_with_bracket")}`,
18767
18802
  type: "input",
18768
18803
  validator: ({ value: portName, rowIndex }) => {
18769
18804
  const { errorMessage } = validateRfc1123Name({
@@ -18791,7 +18826,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
18791
18826
  );
18792
18827
  },
18793
18828
  validator: ({ value: value22 }) => {
18794
- const { isValid, errorMessage } = validatePort(value22 || "", {
18829
+ const { isValid, errorMessage } = validatePort(value22 ?? "", {
18795
18830
  isOptional: false,
18796
18831
  i18n: i18n2,
18797
18832
  emptyText: i18n2.t("dovetail.required_field", {
@@ -18817,7 +18852,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
18817
18852
  );
18818
18853
  },
18819
18854
  validator: ({ value: value22 }) => {
18820
- const { isValid, errorMessage } = validatePort(value22 || "", {
18855
+ const { isValid, errorMessage } = validatePort(value22 ?? "", {
18821
18856
  isOptional: false,
18822
18857
  i18n: i18n2,
18823
18858
  emptyText: i18n2.t("dovetail.required_field", {
@@ -18854,7 +18889,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
18854
18889
  }
18855
18890
  ).map((row) => row.nodePort.value)
18856
18891
  ];
18857
- const { isValid, errorMessage } = value22.mode === "auto" ? { isValid: true, errorMessage: void 0 } : validateNodePort(value22.value, allNodePorts, i18n2);
18892
+ const { isValid, errorMessage } = value22.mode === "auto" ? { isValid: true, errorMessage: void 0 } : validateNodePort(value22.value ?? "", allNodePorts, i18n2);
18858
18893
  if (!isValid)
18859
18894
  return errorMessage;
18860
18895
  }
@@ -19455,13 +19490,7 @@ const DataKeysColumnRenderer = (i18n2) => {
19455
19490
  const PortMappingColumnRenderer = (i18n2) => {
19456
19491
  return {
19457
19492
  key: "displayPortMapping",
19458
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
19459
- title: i18n2.t("dovetail.port_mapping_title_tooltip"),
19460
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
19461
- className: DashedTitleStyle,
19462
- children: i18n2.t("dovetail.port_mapping")
19463
- })
19464
- }),
19493
+ title: i18n2.t("dovetail.port_mapping"),
19465
19494
  display: true,
19466
19495
  dataIndex: ["displayPortMapping"],
19467
19496
  width: 300,
@@ -20030,6 +20059,7 @@ export {
20030
20059
  DeleteButton,
20031
20060
  DeleteManyButton,
20032
20061
  DeploymentModel,
20062
+ DnsSubdomainRegExp,
20033
20063
  Dovetail,
20034
20064
  DrawerShow,
20035
20065
  DurationColumnRenderer,
@@ -20191,6 +20221,8 @@ export {
20191
20221
  ResourceTableGroup,
20192
20222
  ResourceUsageBar,
20193
20223
  RestartsColumnRenderer,
20224
+ Rfc1035NameRegExp,
20225
+ Rfc1123NameRegExp,
20194
20226
  SCAllowExpandColumnRenderer,
20195
20227
  SCReclaimPolicyColumnRenderer,
20196
20228
  SCReclaimPolicyField,
package/dist/style.css CHANGED
@@ -720,6 +720,9 @@
720
720
  .egn3dbn.card .error-content {
721
721
  height: 96px;
722
722
  }
723
+ .egn3dbn.item .title {
724
+ color: rgba(0, 21, 64, 0.3);
725
+ }
723
726
 
724
727
  .e136jgy8 {
725
728
  display: flex;
@@ -1,4 +1,7 @@
1
1
  import { i18n as I18n } from 'i18next';
2
+ export declare const Rfc1123NameRegExp: RegExp;
3
+ export declare const Rfc1035NameRegExp: RegExp;
4
+ export declare const DnsSubdomainRegExp: RegExp;
2
5
  interface ValidateResourceNameOptions {
3
6
  v: string;
4
7
  allNames: string[];
@@ -58,7 +61,7 @@ export declare function validatePort(port: string | number, options: {
58
61
  isValid: boolean;
59
62
  errorMessage?: string;
60
63
  };
61
- export declare function validateNodePort(nodePort: number | null, allNodePorts: number[], i18n: I18n): {
64
+ export declare function validateNodePort(nodePort: number | string | null, allNodePorts: number[], i18n: I18n): {
62
65
  isValid: boolean;
63
66
  errorMessage?: string;
64
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.15-alpha.0",
3
+ "version": "0.3.17-alpha.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",