@dovetail-v2/refine 0.0.46-alpha.0 → 0.0.46-alpha.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.
@@ -6,13 +6,13 @@ var __publicField = (obj, key2, value2) => {
6
6
  };
7
7
  import i18n from "i18next";
8
8
  import * as React from "react";
9
- import React__default, { createElement, isValidElement, cloneElement, Children, createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, useLayoutEffect, useImperativeHandle, memo, PureComponent, forwardRef, Suspense } from "react";
9
+ import React__default, { createElement, isValidElement, cloneElement, Children, createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, useImperativeHandle, memo, PureComponent, useLayoutEffect, forwardRef, Suspense } from "react";
10
10
  import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, useParsed, useGo, useCan, useTable, useDeleteMany, CanAccess, useUpdate, 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 { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
13
- import { Typo, Tag, useUIKit, kitContext, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, pushModal, Icon as Icon$1, Button, popModal, Loading, Divider, Fields, Form, Space, Modal, useMessage, ModalStack, KitStoreProvider } from "@cloudtower/eagle";
13
+ import { Typo, Tag, useUIKit, kitContext, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, pushModal, Icon as Icon$1, Button, popModal, Loading, Divider, Fields, Space, Form, Modal, useMessage, ModalStack, KitStoreProvider } from "@cloudtower/eagle";
14
14
  import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, EditPen16GradientBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon } from "@cloudtower/icons-react";
15
- import { omit as omit$1, debounce, last, merge, get as get$3, first, isObject as isObject$4, keyBy } from "lodash-es";
15
+ import { omit as omit$1, merge, get as get$3, first, debounce, last, isObject as isObject$4, keyBy } from "lodash-es";
16
16
  import yaml from "js-yaml";
17
17
  import { paginateData, sortData, dataProvider, liveProvider } from "k8s-api-provider";
18
18
  import * as monaco from "monaco-editor";
@@ -8682,9 +8682,9 @@ function Table(props) {
8682
8682
  });
8683
8683
  }
8684
8684
  const ComponentContext = createContext({});
8685
- function useTableData({ data: data2, columns, pageSize = 10 }) {
8685
+ function useTableData({ data: data2, columns, pageSize = 10, defaultSorters }) {
8686
8686
  const [currentPage, setCurrentPage] = useState(1);
8687
- const [sorters, setSorters] = useState([]);
8687
+ const [sorters, setSorters] = useState(defaultSorters || []);
8688
8688
  const onSorterChange = useCallback((order, key2) => {
8689
8689
  var _a;
8690
8690
  const ORDER_MAP = {
@@ -9998,7 +9998,7 @@ const ServiceOutClusterAccessComponent = ({
9998
9998
  children: content || "-"
9999
9999
  });
10000
10000
  };
10001
- const index_1wlqq0y = "";
10001
+ const index_10ylmu3 = "";
10002
10002
  const TagWrapper = "t13a6vox";
10003
10003
  const TagStyle = "t12ikbmp";
10004
10004
  const Tags = (props) => {
@@ -10037,23 +10037,24 @@ const StateTag = ({
10037
10037
  const {
10038
10038
  t: t2
10039
10039
  } = useTranslation();
10040
- const colorMap = {
10041
- updating: "blue",
10040
+ const statusMap = {
10041
+ updating: "loading",
10042
10042
  ready: "green",
10043
10043
  completed: "gray",
10044
10044
  failed: "red",
10045
10045
  suspended: "warning",
10046
- running: "blue",
10047
- succeeded: "green",
10048
- unknown: "warning",
10049
- terminating: "red",
10050
- pending: "gray",
10046
+ running: "green",
10047
+ succeeded: "blue",
10048
+ unknown: "gray",
10049
+ terminating: "loading",
10050
+ pending: "warning",
10051
10051
  waiting: "warning",
10052
10052
  terminated: "red"
10053
10053
  };
10054
10054
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.statusCapsule, {
10055
10055
  className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
10056
- color: colorMap[state2],
10056
+ color: statusMap[state2] !== "loading" ? statusMap[state2] : void 0,
10057
+ loading: statusMap[state2] === "loading",
10057
10058
  children: t2(`dovetail.${state2 || "updating"}`)
10058
10059
  });
10059
10060
  };
@@ -10229,7 +10230,14 @@ const ConditionsTable = ({ conditions = [] }) => {
10229
10230
  width: 403
10230
10231
  }
10231
10232
  ];
10232
- const { data: finalData, currentPage, onPageChange, onSorterChange } = useTableData({ data: conditionsWithId, columns });
10233
+ const { data: finalData, currentPage, onPageChange, onSorterChange } = useTableData({
10234
+ data: conditionsWithId,
10235
+ columns,
10236
+ defaultSorters: [{
10237
+ field: "lastUpdateTime",
10238
+ order: "desc"
10239
+ }]
10240
+ });
10233
10241
  const currentSize = 10;
10234
10242
  if (conditionsWithId.length === 0) {
10235
10243
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -10439,273 +10447,6 @@ function K8sDropdown(props) {
10439
10447
  visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
10440
10448
  ] });
10441
10449
  }
10442
- globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
10443
- function adopt(value2) {
10444
- return value2 instanceof P ? value2 : new P(function(resolve) {
10445
- resolve(value2);
10446
- });
10447
- }
10448
- return new (P || (P = Promise))(function(resolve, reject) {
10449
- function fulfilled(value2) {
10450
- try {
10451
- step(generator.next(value2));
10452
- } catch (e2) {
10453
- reject(e2);
10454
- }
10455
- }
10456
- function rejected(value2) {
10457
- try {
10458
- step(generator["throw"](value2));
10459
- } catch (e2) {
10460
- reject(e2);
10461
- }
10462
- }
10463
- function step(result) {
10464
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
10465
- }
10466
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10467
- });
10468
- };
10469
- function useEventCallback(fn) {
10470
- const ref = useRef(() => {
10471
- throw new Error("Cannot call an event handler while rendering.");
10472
- });
10473
- useIsomorphicLayoutEffect(() => {
10474
- ref.current = fn;
10475
- }, [fn]);
10476
- return useCallback((...args) => ref.current(...args), [ref]);
10477
- }
10478
- function useEventListener(eventName, handler, element, options) {
10479
- const savedHandler = useRef(handler);
10480
- useIsomorphicLayoutEffect(() => {
10481
- savedHandler.current = handler;
10482
- }, [handler]);
10483
- useEffect(() => {
10484
- var _a;
10485
- const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
10486
- if (!(targetElement && targetElement.addEventListener))
10487
- return;
10488
- const listener = (event2) => savedHandler.current(event2);
10489
- targetElement.addEventListener(eventName, listener, options);
10490
- return () => {
10491
- targetElement.removeEventListener(eventName, listener, options);
10492
- };
10493
- }, [eventName, element, options]);
10494
- }
10495
- globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
10496
- function adopt(value2) {
10497
- return value2 instanceof P ? value2 : new P(function(resolve) {
10498
- resolve(value2);
10499
- });
10500
- }
10501
- return new (P || (P = Promise))(function(resolve, reject) {
10502
- function fulfilled(value2) {
10503
- try {
10504
- step(generator.next(value2));
10505
- } catch (e2) {
10506
- reject(e2);
10507
- }
10508
- }
10509
- function rejected(value2) {
10510
- try {
10511
- step(generator["throw"](value2));
10512
- } catch (e2) {
10513
- reject(e2);
10514
- }
10515
- }
10516
- function step(result) {
10517
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
10518
- }
10519
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10520
- });
10521
- };
10522
- const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
10523
- function useLocalStorage(key2, initialValue) {
10524
- const readValue = useCallback(() => {
10525
- if (typeof window === "undefined") {
10526
- return initialValue;
10527
- }
10528
- try {
10529
- const item = window.localStorage.getItem(key2);
10530
- return item ? parseJSON(item) : initialValue;
10531
- } catch (error) {
10532
- console.warn(`Error reading localStorage key “${key2}”:`, error);
10533
- return initialValue;
10534
- }
10535
- }, [initialValue, key2]);
10536
- const [storedValue, setStoredValue] = useState(readValue);
10537
- const setValue = useEventCallback((value2) => {
10538
- if (typeof window === "undefined") {
10539
- console.warn(`Tried setting localStorage key “${key2}” even though environment is not a client`);
10540
- }
10541
- try {
10542
- const newValue = value2 instanceof Function ? value2(storedValue) : value2;
10543
- window.localStorage.setItem(key2, JSON.stringify(newValue));
10544
- setStoredValue(newValue);
10545
- window.dispatchEvent(new Event("local-storage"));
10546
- } catch (error) {
10547
- console.warn(`Error setting localStorage key “${key2}”:`, error);
10548
- }
10549
- });
10550
- useEffect(() => {
10551
- setStoredValue(readValue());
10552
- }, []);
10553
- const handleStorageChange = useCallback((event2) => {
10554
- if ((event2 === null || event2 === void 0 ? void 0 : event2.key) && event2.key !== key2) {
10555
- return;
10556
- }
10557
- setStoredValue(readValue());
10558
- }, [key2, readValue]);
10559
- useEventListener("storage", handleStorageChange);
10560
- useEventListener("local-storage", handleStorageChange);
10561
- return [storedValue, setValue];
10562
- }
10563
- function parseJSON(value2) {
10564
- try {
10565
- return value2 === "undefined" ? void 0 : JSON.parse(value2 !== null && value2 !== void 0 ? value2 : "");
10566
- } catch (_a) {
10567
- console.log("parsing error on", { value: value2 });
10568
- return void 0;
10569
- }
10570
- }
10571
- const GlobalStoreContext = createContext({});
10572
- const index_1uuzt53 = "";
10573
- const SelectStyle = "sj0ggy";
10574
- const DropdownStyle = "d1eo8uqs";
10575
- const SearchInputStyle = "s64gojc";
10576
- const SelectContentStyle = "s16fqgtu";
10577
- const TokenStyle = "tgaujbg";
10578
- const CountTokenStyle = "c1vbd54v";
10579
- const SelectOptionGroupStyle = "sxzmtrx";
10580
- const LabelWrapperStyle = "lqrghwd";
10581
- const AllNamespaceOptionStyle = "api7z1z";
10582
- const OptionStyle = "o38b23x";
10583
- const NS_STORE_KEY = "namespace-filter";
10584
- const ALL_NS = "_all";
10585
- const useNamespacesFilter = () => {
10586
- const [value2] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
10587
- const {
10588
- resource
10589
- } = useResource();
10590
- const configs = useContext(ConfigsContext);
10591
- if ((resource == null ? void 0 : resource.name) && configs[resource == null ? void 0 : resource.name].hideNamespacesFilter) {
10592
- return {
10593
- value: []
10594
- };
10595
- }
10596
- return {
10597
- value: value2
10598
- };
10599
- };
10600
- const NamespacesFilter = ({
10601
- className
10602
- }) => {
10603
- const kit = useUIKit();
10604
- const {
10605
- t: t2
10606
- } = useTranslation();
10607
- const [search, setSearch] = useState("");
10608
- const {
10609
- data: data2,
10610
- isLoading
10611
- } = useList({
10612
- resource: "namespaces",
10613
- meta: {
10614
- resourceBasePath: "/api/v1",
10615
- kind: "Namespace"
10616
- },
10617
- pagination: {
10618
- mode: "off"
10619
- }
10620
- });
10621
- const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
10622
- const debouncedSetSearch = debounce(setSearch, 100);
10623
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
10624
- loading: isLoading,
10625
- style: {
10626
- width: 278
10627
- },
10628
- className: cx_default(SelectStyle, className),
10629
- dropdownClassName: DropdownStyle,
10630
- searchValue: search,
10631
- virtual: false,
10632
- input: {
10633
- value: value2,
10634
- onChange(value22) {
10635
- if (last(value22) === ALL_NS || value22.length === 0) {
10636
- setValue([ALL_NS]);
10637
- } else {
10638
- setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
10639
- }
10640
- }
10641
- },
10642
- dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10643
- className: SelectContentStyle,
10644
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
10645
- style: {
10646
- width: "100%"
10647
- },
10648
- className: SearchInputStyle,
10649
- onChange: debouncedSetSearch,
10650
- placeholder: t2("dovetail.please_input")
10651
- }), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
10652
- }),
10653
- tagRender: ({
10654
- label: label2,
10655
- value: value22,
10656
- closable,
10657
- onClose
10658
- }) => {
10659
- const isCountToken = label2 !== value22 && typeof label2 === "string";
10660
- const isAll = value22 === ALL_NS;
10661
- return isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10662
- style: {
10663
- marginLeft: 8
10664
- },
10665
- children: label2
10666
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
10667
- className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
10668
- closable,
10669
- size: "medium",
10670
- onClose,
10671
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10672
- content: isCountToken ? label2.replace(/[\s\.]/g, "") : label2
10673
- })
10674
- });
10675
- },
10676
- maxTagCount: 1,
10677
- optionLabelProp: "label",
10678
- showArrow: true,
10679
- showSearch: false,
10680
- multiple: true,
10681
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
10682
- value: "_all",
10683
- label: t2("dovetail.all_namespaces"),
10684
- className: AllNamespaceOptionStyle,
10685
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10686
- content: t2("dovetail.all_namespaces"),
10687
- className: LabelWrapperStyle
10688
- })
10689
- }, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
10690
- label: "",
10691
- className: SelectOptionGroupStyle,
10692
- children: data2 == null ? void 0 : data2.data.map((namespace2) => {
10693
- const {
10694
- name: name2
10695
- } = namespace2.metadata;
10696
- return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
10697
- value: name2,
10698
- label: name2,
10699
- className: OptionStyle,
10700
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10701
- content: name2,
10702
- className: LabelWrapperStyle
10703
- })
10704
- }, name2);
10705
- })
10706
- })]
10707
- });
10708
- };
10709
10450
  var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
10710
10451
  ColumnKeys2["age"] = "age";
10711
10452
  ColumnKeys2["name"] = "name";
@@ -10730,34 +10471,21 @@ function addDefaultRenderToColumns(columns) {
10730
10471
  }));
10731
10472
  }
10732
10473
  const useEagleTable = (params) => {
10733
- var _a, _b;
10474
+ var _a, _b, _c;
10734
10475
  const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
10735
10476
  const [selectedKeys, setSelectedKeys] = useState([]);
10736
10477
  const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
10737
10478
  const { resource } = useResource();
10738
10479
  const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
10739
- const { value: nsFilters = [] } = useNamespacesFilter();
10740
10480
  const useTableParams = useMemo(() => {
10741
10481
  const mergedParams = merge(params.useTableParams, {
10742
10482
  pagination: {
10743
10483
  pageSize: currentSize,
10744
10484
  mode: "server"
10745
- },
10746
- filters: {
10747
- permanent: [
10748
- {
10749
- operator: "or",
10750
- value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
10751
- field: "metadata.namespace",
10752
- operator: "eq",
10753
- value: filter
10754
- }))
10755
- }
10756
- ]
10757
10485
  }
10758
10486
  });
10759
10487
  return mergedParams;
10760
- }, [params.useTableParams, nsFilters, currentSize]);
10488
+ }, [params.useTableParams, currentSize]);
10761
10489
  const finalColumns = useMemo(
10762
10490
  () => addDefaultRenderToColumns(columns),
10763
10491
  [columns]
@@ -10794,15 +10522,26 @@ const useEagleTable = (params) => {
10794
10522
  error: false,
10795
10523
  rowKey: "id",
10796
10524
  currentPage,
10797
- defaultSize: currentSize,
10798
10525
  onPageChange,
10799
10526
  onSorterChange,
10800
10527
  onSelect: (keys) => {
10801
10528
  setSelectedKeys(keys);
10802
10529
  },
10803
10530
  total,
10804
- RowMenu: Dropdown
10531
+ RowMenu: Dropdown,
10532
+ ...tableProps,
10533
+ defaultSize: currentSize
10805
10534
  };
10535
+ useEffect(() => {
10536
+ table.setSorters([{
10537
+ field: "metadata.creationTimestamp",
10538
+ order: "desc"
10539
+ }]);
10540
+ }, []);
10541
+ useEffect(() => {
10542
+ setCurrentPage(1);
10543
+ table.setCurrent(1);
10544
+ }, [(_c = params.useTableParams) == null ? void 0 : _c.filters]);
10806
10545
  return { tableProps: finalProps, selectedKeys, ...table };
10807
10546
  };
10808
10547
  function CreateButton() {
@@ -10918,6 +10657,7 @@ const CronjobJobsTable = ({
10918
10657
  owner,
10919
10658
  hideToolBar
10920
10659
  }) => {
10660
+ var _a;
10921
10661
  const {
10922
10662
  i18n: i18n2
10923
10663
  } = useTranslation();
@@ -10938,15 +10678,19 @@ const CronjobJobsTable = ({
10938
10678
  meta: {
10939
10679
  resourceBasePath: "/apis/batch/v1",
10940
10680
  kind: "Job"
10681
+ },
10682
+ filters: {
10683
+ permanent: [{
10684
+ field: "",
10685
+ value: "",
10686
+ fn(item) {
10687
+ return owner ? matchOwner(item, owner) : true;
10688
+ }
10689
+ }]
10941
10690
  }
10942
10691
  }
10943
10692
  });
10944
- const dataSource = useMemo(() => {
10945
- return tableProps.data.filter((p) => {
10946
- return owner ? matchOwner(p, owner) : true;
10947
- });
10948
- }, [tableProps.data, owner]);
10949
- if (!(dataSource == null ? void 0 : dataSource.length) && !tableProps.loading) {
10693
+ if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
10950
10694
  return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
10951
10695
  errorText: i18n2.t("dovetail.no_resource", {
10952
10696
  kind: " Job"
@@ -10968,8 +10712,10 @@ const CronjobJobsTable = ({
10968
10712
  });
10969
10713
  };
10970
10714
  const EventsTable = ({}) => {
10715
+ var _a, _b;
10971
10716
  const { i18n: i18n2 } = useTranslation();
10972
10717
  const parsed = useParsed();
10718
+ const [regardingNamespace, regardingName] = (_a = parsed == null ? void 0 : parsed.id) == null ? void 0 : _a.split("/");
10973
10719
  const columns = useMemo(
10974
10720
  () => [
10975
10721
  {
@@ -11012,20 +10758,34 @@ const EventsTable = ({}) => {
11012
10758
  );
11013
10759
  const { tableProps } = useEagleTable({
11014
10760
  columns,
10761
+ tableProps: {
10762
+ defaultSize: 50
10763
+ },
11015
10764
  useTableParams: {
11016
10765
  resource: "events",
11017
- meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" }
10766
+ meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
10767
+ filters: {
10768
+ permanent: [{
10769
+ operator: "and",
10770
+ value: [
10771
+ {
10772
+ field: "regarding.namespace",
10773
+ operator: "eq",
10774
+ value: regardingNamespace
10775
+ },
10776
+ {
10777
+ field: "regarding.name",
10778
+ operator: "eq",
10779
+ value: regardingName
10780
+ }
10781
+ ]
10782
+ }]
10783
+ }
11018
10784
  }
11019
10785
  });
11020
10786
  const component = useContext(ComponentContext);
11021
- const dataSource = useMemo(() => {
11022
- return tableProps.data.filter((d) => {
11023
- const objectId = `${d.regarding.namespace}/${d.regarding.name}`;
11024
- return objectId === parsed.id;
11025
- });
11026
- }, [tableProps.data, parsed]);
11027
10787
  const Table$1 = component.Table || Table;
11028
- if (!(dataSource == null ? void 0 : dataSource.length) && !tableProps.loading) {
10788
+ if (!((_b = tableProps.data) == null ? void 0 : _b.length) && !tableProps.loading) {
11029
10789
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
11030
10790
  WidgetErrorContent,
11031
10791
  {
@@ -11050,10 +10810,10 @@ const ImageNames = ({
11050
10810
  }) => {
11051
10811
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11052
10812
  className: ImageWrapperStyle,
11053
- children: breakLine ? value2.map((image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTooltip, {
10813
+ children: breakLine ? value2.map((image2, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTooltip, {
11054
10814
  content: image2,
11055
10815
  tooltip: image2
11056
- }, image2)) : value2.join(", ")
10816
+ }, `${image2}-${index}`)) : value2.join(", ")
11057
10817
  });
11058
10818
  };
11059
10819
  const ResourceLink = (props) => {
@@ -11183,7 +10943,7 @@ const IngressRulesTable = ({ ingress }) => {
11183
10943
  }
11184
10944
  );
11185
10945
  };
11186
- const KeyValue_1v1utgj = "";
10946
+ const KeyValue_q4vd5r = "";
11187
10947
  const ContentBlockStyle = "c8jy7dc";
11188
10948
  const KeyStyle = "k2sddxl";
11189
10949
  const ValueStyle$2 = "v16vicsr";
@@ -11497,6 +11257,7 @@ const WorkloadPodsTable = ({
11497
11257
  selector,
11498
11258
  hideToolbar
11499
11259
  }) => {
11260
+ var _a;
11500
11261
  const {
11501
11262
  i18n: i18n2
11502
11263
  } = useTranslation();
@@ -11522,15 +11283,19 @@ const WorkloadPodsTable = ({
11522
11283
  meta: {
11523
11284
  resourceBasePath: "/api/v1",
11524
11285
  kind: "Pod"
11286
+ },
11287
+ filters: {
11288
+ permanent: [{
11289
+ field: "",
11290
+ value: "",
11291
+ fn(item) {
11292
+ return selector ? matchSelector(item, selector) : true;
11293
+ }
11294
+ }]
11525
11295
  }
11526
11296
  }
11527
11297
  });
11528
- const dataSource = useMemo(() => {
11529
- return tableProps.data.filter((p) => {
11530
- return selector ? matchSelector(p, selector) : true;
11531
- });
11532
- }, [tableProps.data, selector]);
11533
- if ((dataSource == null ? void 0 : dataSource.length) === 0) {
11298
+ if (((_a = tableProps.data) == null ? void 0 : _a.length) === 0) {
11534
11299
  return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
11535
11300
  errorText: i18n2.t("dovetail.no_resource", {
11536
11301
  kind: ` ${i18n2.t("dovetail.pod")}`
@@ -18237,7 +18002,11 @@ const PodContainersTable = ({
18237
18002
  onSorterChange
18238
18003
  } = useTableData({
18239
18004
  data: dataSource,
18240
- columns
18005
+ columns,
18006
+ defaultSorters: [{
18007
+ field: "state.running.startedAt",
18008
+ order: "desc"
18009
+ }]
18241
18010
  });
18242
18011
  if (dataSource.length === 0) {
18243
18012
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -18577,6 +18346,342 @@ function ReplicasDropdown(props) {
18577
18346
  children
18578
18347
  ] });
18579
18348
  }
18349
+ globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
18350
+ function adopt(value2) {
18351
+ return value2 instanceof P ? value2 : new P(function(resolve) {
18352
+ resolve(value2);
18353
+ });
18354
+ }
18355
+ return new (P || (P = Promise))(function(resolve, reject) {
18356
+ function fulfilled(value2) {
18357
+ try {
18358
+ step(generator.next(value2));
18359
+ } catch (e2) {
18360
+ reject(e2);
18361
+ }
18362
+ }
18363
+ function rejected(value2) {
18364
+ try {
18365
+ step(generator["throw"](value2));
18366
+ } catch (e2) {
18367
+ reject(e2);
18368
+ }
18369
+ }
18370
+ function step(result) {
18371
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18372
+ }
18373
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18374
+ });
18375
+ };
18376
+ function useEventCallback(fn) {
18377
+ const ref = useRef(() => {
18378
+ throw new Error("Cannot call an event handler while rendering.");
18379
+ });
18380
+ useIsomorphicLayoutEffect(() => {
18381
+ ref.current = fn;
18382
+ }, [fn]);
18383
+ return useCallback((...args) => ref.current(...args), [ref]);
18384
+ }
18385
+ function useEventListener(eventName, handler, element, options) {
18386
+ const savedHandler = useRef(handler);
18387
+ useIsomorphicLayoutEffect(() => {
18388
+ savedHandler.current = handler;
18389
+ }, [handler]);
18390
+ useEffect(() => {
18391
+ var _a;
18392
+ const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
18393
+ if (!(targetElement && targetElement.addEventListener))
18394
+ return;
18395
+ const listener = (event2) => savedHandler.current(event2);
18396
+ targetElement.addEventListener(eventName, listener, options);
18397
+ return () => {
18398
+ targetElement.removeEventListener(eventName, listener, options);
18399
+ };
18400
+ }, [eventName, element, options]);
18401
+ }
18402
+ globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
18403
+ function adopt(value2) {
18404
+ return value2 instanceof P ? value2 : new P(function(resolve) {
18405
+ resolve(value2);
18406
+ });
18407
+ }
18408
+ return new (P || (P = Promise))(function(resolve, reject) {
18409
+ function fulfilled(value2) {
18410
+ try {
18411
+ step(generator.next(value2));
18412
+ } catch (e2) {
18413
+ reject(e2);
18414
+ }
18415
+ }
18416
+ function rejected(value2) {
18417
+ try {
18418
+ step(generator["throw"](value2));
18419
+ } catch (e2) {
18420
+ reject(e2);
18421
+ }
18422
+ }
18423
+ function step(result) {
18424
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18425
+ }
18426
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18427
+ });
18428
+ };
18429
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
18430
+ function useLocalStorage(key2, initialValue) {
18431
+ const readValue = useCallback(() => {
18432
+ if (typeof window === "undefined") {
18433
+ return initialValue;
18434
+ }
18435
+ try {
18436
+ const item = window.localStorage.getItem(key2);
18437
+ return item ? parseJSON(item) : initialValue;
18438
+ } catch (error) {
18439
+ console.warn(`Error reading localStorage key “${key2}”:`, error);
18440
+ return initialValue;
18441
+ }
18442
+ }, [initialValue, key2]);
18443
+ const [storedValue, setStoredValue] = useState(readValue);
18444
+ const setValue = useEventCallback((value2) => {
18445
+ if (typeof window === "undefined") {
18446
+ console.warn(`Tried setting localStorage key “${key2}” even though environment is not a client`);
18447
+ }
18448
+ try {
18449
+ const newValue = value2 instanceof Function ? value2(storedValue) : value2;
18450
+ window.localStorage.setItem(key2, JSON.stringify(newValue));
18451
+ setStoredValue(newValue);
18452
+ window.dispatchEvent(new Event("local-storage"));
18453
+ } catch (error) {
18454
+ console.warn(`Error setting localStorage key “${key2}”:`, error);
18455
+ }
18456
+ });
18457
+ useEffect(() => {
18458
+ setStoredValue(readValue());
18459
+ }, []);
18460
+ const handleStorageChange = useCallback((event2) => {
18461
+ if ((event2 === null || event2 === void 0 ? void 0 : event2.key) && event2.key !== key2) {
18462
+ return;
18463
+ }
18464
+ setStoredValue(readValue());
18465
+ }, [key2, readValue]);
18466
+ useEventListener("storage", handleStorageChange);
18467
+ useEventListener("local-storage", handleStorageChange);
18468
+ return [storedValue, setValue];
18469
+ }
18470
+ function parseJSON(value2) {
18471
+ try {
18472
+ return value2 === "undefined" ? void 0 : JSON.parse(value2 !== null && value2 !== void 0 ? value2 : "");
18473
+ } catch (_a) {
18474
+ console.log("parsing error on", { value: value2 });
18475
+ return void 0;
18476
+ }
18477
+ }
18478
+ const GlobalStoreContext = createContext({});
18479
+ const index_1xad2h9 = "";
18480
+ const SelectStyle = "sj0ggy";
18481
+ const DropdownStyle = "d1eo8uqs";
18482
+ const SearchInputStyle = "s64gojc";
18483
+ const SelectContentStyle = "s16fqgtu";
18484
+ const TokenStyle = "tgaujbg";
18485
+ const CountTokenStyle = "c1vbd54v";
18486
+ const SelectOptionGroupStyle = "sxzmtrx";
18487
+ const LabelWrapperStyle = "lqrghwd";
18488
+ const AllNamespaceOptionStyle = "api7z1z";
18489
+ const OptionStyle = "o38b23x";
18490
+ const NS_STORE_KEY = "namespace-filter";
18491
+ const ALL_NS = "_all";
18492
+ const useNamespacesFilter = () => {
18493
+ const [value2] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
18494
+ const {
18495
+ resource
18496
+ } = useResource();
18497
+ const configs = useContext(ConfigsContext);
18498
+ if ((resource == null ? void 0 : resource.name) && configs[resource == null ? void 0 : resource.name].hideNamespacesFilter) {
18499
+ return {
18500
+ value: []
18501
+ };
18502
+ }
18503
+ return {
18504
+ value: value2
18505
+ };
18506
+ };
18507
+ const NamespacesFilter = ({
18508
+ className
18509
+ }) => {
18510
+ const kit = useUIKit();
18511
+ const {
18512
+ t: t2
18513
+ } = useTranslation();
18514
+ const [search, setSearch] = useState("");
18515
+ const [tagMaxWidth, setTagMaxWidth] = useState("");
18516
+ const {
18517
+ data: data2,
18518
+ isLoading
18519
+ } = useList({
18520
+ resource: "namespaces",
18521
+ meta: {
18522
+ resourceBasePath: "/api/v1",
18523
+ kind: "Namespace"
18524
+ },
18525
+ pagination: {
18526
+ mode: "off"
18527
+ }
18528
+ });
18529
+ const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
18530
+ const [open, setOpen] = useState(false);
18531
+ const debouncedSetSearch = debounce(setSearch, 100);
18532
+ const MAX_TAG_COUNT = 8;
18533
+ const COUNT_TAG_WIDTH = 22;
18534
+ const TAG_GAP = 4;
18535
+ const PADDING = 36;
18536
+ const hasCountTag = value2.length > MAX_TAG_COUNT;
18537
+ const WRAPPER_CLASS = "d2-namespace-select-wrapper";
18538
+ const SELECT_CLASS = "d2-namespace-select";
18539
+ const calcTagMaxWidth = useCallback(() => {
18540
+ const wrapper = document.querySelector(`.${WRAPPER_CLASS}`);
18541
+ const n2 = Math.min(value2.length, MAX_TAG_COUNT);
18542
+ const tagWidth = ((wrapper == null ? void 0 : wrapper.offsetWidth) || 0) / n2;
18543
+ const gapsWidth = (Math.min(value2.length, MAX_TAG_COUNT + 1) - 1) * TAG_GAP;
18544
+ const paddingAndCountTagWidth = PADDING + (hasCountTag ? COUNT_TAG_WIDTH : 0);
18545
+ const perTagMaxWidth = tagWidth - (paddingAndCountTagWidth + gapsWidth) / n2;
18546
+ setTagMaxWidth(`${perTagMaxWidth}px`);
18547
+ }, [value2, hasCountTag]);
18548
+ useEffect(() => {
18549
+ calcTagMaxWidth();
18550
+ }, [calcTagMaxWidth]);
18551
+ useEffect(() => {
18552
+ window.addEventListener("resize", calcTagMaxWidth);
18553
+ return () => {
18554
+ window.removeEventListener("resize", calcTagMaxWidth);
18555
+ };
18556
+ }, [calcTagMaxWidth]);
18557
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
18558
+ className: WRAPPER_CLASS,
18559
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
18560
+ loading: isLoading,
18561
+ className: cx_default(SelectStyle, SELECT_CLASS, className),
18562
+ style: {
18563
+ "--tag-max-width": tagMaxWidth
18564
+ },
18565
+ dropdownClassName: DropdownStyle,
18566
+ searchValue: search,
18567
+ virtual: false,
18568
+ input: {
18569
+ value: value2,
18570
+ onChange(value22) {
18571
+ if (last(value22) === ALL_NS || value22.length === 0) {
18572
+ setValue([ALL_NS]);
18573
+ } else {
18574
+ setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
18575
+ }
18576
+ }
18577
+ },
18578
+ dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
18579
+ className: SelectContentStyle,
18580
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
18581
+ style: {
18582
+ width: "100%"
18583
+ },
18584
+ className: SearchInputStyle,
18585
+ onChange: debouncedSetSearch,
18586
+ placeholder: t2("dovetail.please_input")
18587
+ }), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
18588
+ }),
18589
+ tagRender: ({
18590
+ label: label2,
18591
+ value: namespaceValue,
18592
+ closable,
18593
+ onClose
18594
+ }) => {
18595
+ const isCountToken = label2 !== namespaceValue && typeof label2 === "string";
18596
+ const isAll = namespaceValue === ALL_NS;
18597
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
18598
+ onClick: () => {
18599
+ setOpen(!open);
18600
+ },
18601
+ children: isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
18602
+ style: {
18603
+ marginLeft: 8
18604
+ },
18605
+ children: label2
18606
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
18607
+ className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
18608
+ closable,
18609
+ size: "medium",
18610
+ onClose,
18611
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18612
+ content: isCountToken ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.tooltip, {
18613
+ title: isCountToken ? value2.slice(MAX_TAG_COUNT).map((namespace2, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
18614
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
18615
+ children: namespace2
18616
+ }), index !== value2.length - 1 - MAX_TAG_COUNT ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, {
18617
+ style: {
18618
+ margin: "6px 0",
18619
+ borderColor: "rgba(107, 128, 167, 0.60)"
18620
+ }
18621
+ }) : null]
18622
+ })) : null,
18623
+ trigger: ["hover"],
18624
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
18625
+ children: label2.replace(/[\s\.]/g, "")
18626
+ })
18627
+ }) : label2
18628
+ })
18629
+ })
18630
+ });
18631
+ },
18632
+ maxTagCount: MAX_TAG_COUNT,
18633
+ optionLabelProp: "label",
18634
+ showArrow: true,
18635
+ showSearch: false,
18636
+ open,
18637
+ onDropdownVisibleChange: (open2) => {
18638
+ setOpen(open2);
18639
+ },
18640
+ multiple: true,
18641
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
18642
+ value: "_all",
18643
+ label: t2("dovetail.all_namespaces"),
18644
+ className: AllNamespaceOptionStyle,
18645
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18646
+ content: t2("dovetail.all_namespaces"),
18647
+ className: LabelWrapperStyle
18648
+ })
18649
+ }, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
18650
+ label: "",
18651
+ className: SelectOptionGroupStyle,
18652
+ children: data2 == null ? void 0 : data2.data.map((namespace2) => {
18653
+ const {
18654
+ name: name2
18655
+ } = namespace2.metadata;
18656
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
18657
+ value: name2,
18658
+ label: name2,
18659
+ className: OptionStyle,
18660
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18661
+ content: name2,
18662
+ className: LabelWrapperStyle
18663
+ })
18664
+ }, name2);
18665
+ })
18666
+ })]
18667
+ })
18668
+ });
18669
+ };
18670
+ function useNamespaceFilter() {
18671
+ const { value: nsFilters = [] } = useNamespacesFilter();
18672
+ return {
18673
+ permanent: [
18674
+ {
18675
+ operator: "or",
18676
+ value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
18677
+ field: "metadata.namespace",
18678
+ operator: "eq",
18679
+ value: filter
18680
+ }))
18681
+ }
18682
+ ]
18683
+ };
18684
+ }
18580
18685
  const index_hp158y = "";
18581
18686
  const ListPageStyle = "laykzsq";
18582
18687
  const ListContentStyle = "l1ng0psc";
@@ -18641,11 +18746,15 @@ function ResourceList(props) {
18641
18746
  const { formatter, columns, Dropdown, noShow } = props.config;
18642
18747
  const { i18n: i18n2 } = useTranslation();
18643
18748
  const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
18749
+ const filters = useNamespaceFilter();
18644
18750
  const { tableProps, selectedKeys } = useEagleTable({
18645
- useTableParams: {},
18751
+ useTableParams: {
18752
+ filters
18753
+ },
18646
18754
  columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
18647
18755
  tableProps: {
18648
- defaultSize: 50
18756
+ defaultSize: 50,
18757
+ ...props.config.tableProps
18649
18758
  },
18650
18759
  formatter,
18651
18760
  Dropdown
@@ -21850,20 +21959,44 @@ function useForm$1(props = {}) {
21850
21959
  _formControl.current.formState = getProxyFormState(formState, control);
21851
21960
  return _formControl.current;
21852
21961
  }
21853
- const RefineFormContent_1in3vad = "";
21962
+ const RefineFormContent_1tb00bi = "";
21854
21963
  const RefineFormContent = (props) => {
21855
- var _a, _b;
21964
+ var _a, _b, _c, _d;
21856
21965
  const {
21857
21966
  config,
21858
21967
  formResult,
21859
- action,
21968
+ resourceId,
21860
21969
  errorMsg
21861
21970
  } = props;
21862
21971
  const {
21863
21972
  control,
21864
21973
  getValues
21865
21974
  } = formResult;
21866
- const fields = (_b = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _b.map((c2) => {
21975
+ const action = resourceId ? "edit" : "create";
21976
+ const listQuery = useList({
21977
+ resource: config == null ? void 0 : config.name,
21978
+ meta: {
21979
+ resourceBasePath: config == null ? void 0 : config.basePath,
21980
+ kind: config == null ? void 0 : config.kind
21981
+ },
21982
+ pagination: {
21983
+ mode: "off"
21984
+ }
21985
+ });
21986
+ const showQuery = useShow({
21987
+ resource: config == null ? void 0 : config.name,
21988
+ meta: {
21989
+ resourceBasePath: config == null ? void 0 : config.basePath,
21990
+ kind: config == null ? void 0 : config.kind
21991
+ },
21992
+ id: resourceId
21993
+ });
21994
+ const formFieldsConfig = (_d = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _d.call(_a, {
21995
+ record: (_b = showQuery.queryResult.data) == null ? void 0 : _b.data,
21996
+ records: ((_c = listQuery.data) == null ? void 0 : _c.data) || [],
21997
+ action
21998
+ });
21999
+ const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((c2) => {
21867
22000
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
21868
22001
  control,
21869
22002
  name: c2.path.join("."),
@@ -21895,6 +22028,7 @@ const RefineFormContent = (props) => {
21895
22028
  var _a2;
21896
22029
  const formValue = getValues();
21897
22030
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(Fields.String, {
22031
+ placeholder: c2.placeholder,
21898
22032
  input: {
21899
22033
  value: value2,
21900
22034
  onChange,
@@ -21907,6 +22041,7 @@ const RefineFormContent = (props) => {
21907
22041
  switch (c2.type) {
21908
22042
  case "number":
21909
22043
  ele = /* @__PURE__ */ jsxRuntimeExports.jsx(Fields.Integer, {
22044
+ placeholder: c2.placeholder,
21910
22045
  input: {
21911
22046
  value: value2,
21912
22047
  onChange,
@@ -21922,11 +22057,23 @@ const RefineFormContent = (props) => {
21922
22057
  children: value2
21923
22058
  });
21924
22059
  }
22060
+ if (c2.helperText) {
22061
+ ele = /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
22062
+ size: 4,
22063
+ direction: "vertical",
22064
+ className: "c154n7ie",
22065
+ children: [ele, /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
22066
+ className: cx_default(Typo.Footnote.f2_regular, "c1c9j4da"),
22067
+ children: c2.helperText
22068
+ })]
22069
+ });
22070
+ }
21925
22071
  if (c2 == null ? void 0 : c2.render) {
21926
22072
  ele = c2.render(value2, onChange, formValue, onBlur, action);
21927
22073
  }
21928
22074
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, {
21929
22075
  label: c2.label,
22076
+ colon: false,
21930
22077
  labelCol: {
21931
22078
  flex: "0 0 216px"
21932
22079
  },
@@ -21939,7 +22086,7 @@ const RefineFormContent = (props) => {
21939
22086
  });
21940
22087
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
21941
22088
  direction: "vertical",
21942
- className: "c154n7ie",
22089
+ className: "cjxv8cf",
21943
22090
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
21944
22091
  errorMsgs: errorMsg ? [errorMsg] : [],
21945
22092
  style: {
@@ -22579,7 +22726,6 @@ const useForm = ({
22579
22726
  };
22580
22727
  };
22581
22728
  const useRefineForm = (props) => {
22582
- var _a;
22583
22729
  const { config, id, refineProps } = props;
22584
22730
  const [responseErrorMsg, setResponseErrorMsg] = useState("");
22585
22731
  const i18n2 = useTranslation();
@@ -22612,15 +22758,15 @@ const useRefineForm = (props) => {
22612
22758
  defaultValues: config == null ? void 0 : config.initValue
22613
22759
  });
22614
22760
  useEffect(() => {
22615
- var _a2, _b;
22616
- const response = (_a2 = result.refineCore.mutationResult.error) == null ? void 0 : _a2.response;
22761
+ var _a, _b;
22762
+ const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
22617
22763
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
22618
22764
  (_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
22619
- var _a3, _b2;
22620
- setResponseErrorMsg(((_b2 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b2.call(_a3, body)) || body.message);
22765
+ var _a2, _b2;
22766
+ setResponseErrorMsg(((_b2 = (_a2 = config.formConfig) == null ? void 0 : _a2.formatError) == null ? void 0 : _b2.call(_a2, body)) || body.message);
22621
22767
  });
22622
22768
  }
22623
- }, [config.formConfig, (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response]);
22769
+ }, [config.formConfig, result]);
22624
22770
  return { formResult: result, responseErrorMsg };
22625
22771
  };
22626
22772
  const index_12sfrn = "";
@@ -22631,7 +22777,7 @@ const Separator = () => {
22631
22777
  });
22632
22778
  };
22633
22779
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
22634
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-a06e0978.js"));
22780
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-a0787f8d.js"));
22635
22781
  const YamlEditorComponent = forwardRef(
22636
22782
  function YamlEditorComponent2(props, ref) {
22637
22783
  const {
@@ -23146,9 +23292,18 @@ const useYamlForm = ({
23146
23292
  setEditorErrors(errors);
23147
23293
  return;
23148
23294
  }
23149
- const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
23150
- const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
23151
- return onFinish(finalValues);
23295
+ try {
23296
+ const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
23297
+ const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
23298
+ return onFinish(finalValues);
23299
+ } catch (error) {
23300
+ if (error instanceof Error) {
23301
+ if (error.message === "expected a single document in the stream, but found more") {
23302
+ setEditorErrors([t2("dovetail.only_support_one_yaml")]);
23303
+ return;
23304
+ }
23305
+ }
23306
+ }
23152
23307
  },
23153
23308
  onKeyUp,
23154
23309
  onValuesChange,
@@ -23370,7 +23525,7 @@ function FormModal(props) {
23370
23525
  formResult: refineFormResult.formResult,
23371
23526
  config,
23372
23527
  errorMsg: refineFormResult.responseErrorMsg,
23373
- action: id ? "edit" : "create"
23528
+ resourceId: id
23374
23529
  });
23375
23530
  })();
23376
23531
  const saveButtonProps = isYamlForm ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
@@ -23453,7 +23608,7 @@ const RefineFormPage = (props) => {
23453
23608
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23454
23609
  config,
23455
23610
  formResult,
23456
- action
23611
+ resourceId: id
23457
23612
  }), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
23458
23613
  ...saveButtonProps,
23459
23614
  onClick,
@@ -23854,7 +24009,11 @@ const PlainTextNameColumnRenderer = (i18n2) => {
23854
24009
  title: i18n2.t("dovetail.name"),
23855
24010
  sortable: true,
23856
24011
  width: 200,
23857
- sorter: CommonSorter(dataIndex)
24012
+ sorter: CommonSorter(dataIndex),
24013
+ render: (v) => /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTooltip, {
24014
+ content: v,
24015
+ tooltip: v
24016
+ })
23858
24017
  };
23859
24018
  };
23860
24019
  const NameSpaceColumnRenderer = (i18n2) => {
@@ -23986,7 +24145,7 @@ const RestartCountColumnRenderer = (i18n2) => {
23986
24145
  };
23987
24146
  };
23988
24147
  const CompletionsCountColumnRenderer = (i18n2) => {
23989
- const dataIndex = ["completionsDisplay"];
24148
+ const dataIndex = ["succeeded"];
23990
24149
  return {
23991
24150
  key: "completions",
23992
24151
  display: true,
@@ -24001,7 +24160,12 @@ const CompletionsCountColumnRenderer = (i18n2) => {
24001
24160
  sortable: true,
24002
24161
  width: 120,
24003
24162
  align: "right",
24004
- sorter: CommonSorter(dataIndex)
24163
+ sorter: CommonSorter(dataIndex),
24164
+ render: (_, record) => {
24165
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
24166
+ children: record.completionsDisplay
24167
+ });
24168
+ }
24005
24169
  };
24006
24170
  };
24007
24171
  const DurationColumnRenderer = (i18n2) => {