@dovetail-v2/refine 0.0.46-alpha.0 → 0.0.46-alpha.1
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.
- package/dist/{MonacoYamlDiffEditor-a06e0978.js → MonacoYamlDiffEditor-a0787f8d.js} +1 -1
- package/dist/{index-5213b638.js → index-9a6fb2d3.js} +509 -345
- package/dist/refine.js +1 -1
- package/dist/refine.umd.cjs +505 -341
- package/dist/style.css +15 -13
- package/lib/src/components/Form/RefineFormContent.d.ts +1 -1
- package/lib/src/components/Form/type.d.ts +2 -0
- package/lib/src/hooks/useEagleTable/columns.d.ts +1 -1
- package/lib/src/hooks/useNamespaceFilter.d.ts +5 -0
- package/lib/src/hooks/useTableData.d.ts +3 -1
- package/lib/src/types/resource.d.ts +7 -2
- package/package.json +2 -2
package/dist/refine.umd.cjs
CHANGED
|
@@ -8688,9 +8688,9 @@ var __publicField = (obj, key, value) => {
|
|
|
8688
8688
|
});
|
|
8689
8689
|
}
|
|
8690
8690
|
const ComponentContext = React.createContext({});
|
|
8691
|
-
function useTableData({ data: data2, columns, pageSize = 10 }) {
|
|
8691
|
+
function useTableData({ data: data2, columns, pageSize = 10, defaultSorters }) {
|
|
8692
8692
|
const [currentPage, setCurrentPage] = React.useState(1);
|
|
8693
|
-
const [sorters, setSorters] = React.useState([]);
|
|
8693
|
+
const [sorters, setSorters] = React.useState(defaultSorters || []);
|
|
8694
8694
|
const onSorterChange = React.useCallback((order, key2) => {
|
|
8695
8695
|
var _a;
|
|
8696
8696
|
const ORDER_MAP = {
|
|
@@ -10004,7 +10004,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10004
10004
|
children: content || "-"
|
|
10005
10005
|
});
|
|
10006
10006
|
};
|
|
10007
|
-
const
|
|
10007
|
+
const index_10ylmu3 = "";
|
|
10008
10008
|
const TagWrapper = "t13a6vox";
|
|
10009
10009
|
const TagStyle = "t12ikbmp";
|
|
10010
10010
|
const Tags = (props) => {
|
|
@@ -10043,23 +10043,24 @@ var __publicField = (obj, key, value) => {
|
|
|
10043
10043
|
const {
|
|
10044
10044
|
t: t2
|
|
10045
10045
|
} = useTranslation();
|
|
10046
|
-
const
|
|
10047
|
-
updating: "
|
|
10046
|
+
const statusMap = {
|
|
10047
|
+
updating: "loading",
|
|
10048
10048
|
ready: "green",
|
|
10049
10049
|
completed: "gray",
|
|
10050
10050
|
failed: "red",
|
|
10051
10051
|
suspended: "warning",
|
|
10052
|
-
running: "
|
|
10053
|
-
succeeded: "
|
|
10054
|
-
unknown: "
|
|
10055
|
-
terminating: "
|
|
10056
|
-
pending: "
|
|
10052
|
+
running: "green",
|
|
10053
|
+
succeeded: "blue",
|
|
10054
|
+
unknown: "gray",
|
|
10055
|
+
terminating: "loading",
|
|
10056
|
+
pending: "warning",
|
|
10057
10057
|
waiting: "warning",
|
|
10058
10058
|
terminated: "red"
|
|
10059
10059
|
};
|
|
10060
10060
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.statusCapsule, {
|
|
10061
10061
|
className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
|
|
10062
|
-
color:
|
|
10062
|
+
color: statusMap[state2] !== "loading" ? statusMap[state2] : void 0,
|
|
10063
|
+
loading: statusMap[state2] === "loading",
|
|
10063
10064
|
children: t2(`dovetail.${state2 || "updating"}`)
|
|
10064
10065
|
});
|
|
10065
10066
|
};
|
|
@@ -10235,7 +10236,14 @@ var __publicField = (obj, key, value) => {
|
|
|
10235
10236
|
width: 403
|
|
10236
10237
|
}
|
|
10237
10238
|
];
|
|
10238
|
-
const { data: finalData, currentPage, onPageChange, onSorterChange } = useTableData({
|
|
10239
|
+
const { data: finalData, currentPage, onPageChange, onSorterChange } = useTableData({
|
|
10240
|
+
data: conditionsWithId,
|
|
10241
|
+
columns,
|
|
10242
|
+
defaultSorters: [{
|
|
10243
|
+
field: "lastUpdateTime",
|
|
10244
|
+
order: "desc"
|
|
10245
|
+
}]
|
|
10246
|
+
});
|
|
10239
10247
|
const currentSize = 10;
|
|
10240
10248
|
if (conditionsWithId.length === 0) {
|
|
10241
10249
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -10445,273 +10453,6 @@ var __publicField = (obj, key, value) => {
|
|
|
10445
10453
|
visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
|
|
10446
10454
|
] });
|
|
10447
10455
|
}
|
|
10448
|
-
globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
10449
|
-
function adopt(value2) {
|
|
10450
|
-
return value2 instanceof P ? value2 : new P(function(resolve) {
|
|
10451
|
-
resolve(value2);
|
|
10452
|
-
});
|
|
10453
|
-
}
|
|
10454
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
10455
|
-
function fulfilled(value2) {
|
|
10456
|
-
try {
|
|
10457
|
-
step(generator.next(value2));
|
|
10458
|
-
} catch (e2) {
|
|
10459
|
-
reject(e2);
|
|
10460
|
-
}
|
|
10461
|
-
}
|
|
10462
|
-
function rejected(value2) {
|
|
10463
|
-
try {
|
|
10464
|
-
step(generator["throw"](value2));
|
|
10465
|
-
} catch (e2) {
|
|
10466
|
-
reject(e2);
|
|
10467
|
-
}
|
|
10468
|
-
}
|
|
10469
|
-
function step(result) {
|
|
10470
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
10471
|
-
}
|
|
10472
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10473
|
-
});
|
|
10474
|
-
};
|
|
10475
|
-
function useEventCallback(fn) {
|
|
10476
|
-
const ref = React.useRef(() => {
|
|
10477
|
-
throw new Error("Cannot call an event handler while rendering.");
|
|
10478
|
-
});
|
|
10479
|
-
useIsomorphicLayoutEffect(() => {
|
|
10480
|
-
ref.current = fn;
|
|
10481
|
-
}, [fn]);
|
|
10482
|
-
return React.useCallback((...args) => ref.current(...args), [ref]);
|
|
10483
|
-
}
|
|
10484
|
-
function useEventListener(eventName, handler, element, options) {
|
|
10485
|
-
const savedHandler = React.useRef(handler);
|
|
10486
|
-
useIsomorphicLayoutEffect(() => {
|
|
10487
|
-
savedHandler.current = handler;
|
|
10488
|
-
}, [handler]);
|
|
10489
|
-
React.useEffect(() => {
|
|
10490
|
-
var _a;
|
|
10491
|
-
const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
|
|
10492
|
-
if (!(targetElement && targetElement.addEventListener))
|
|
10493
|
-
return;
|
|
10494
|
-
const listener = (event2) => savedHandler.current(event2);
|
|
10495
|
-
targetElement.addEventListener(eventName, listener, options);
|
|
10496
|
-
return () => {
|
|
10497
|
-
targetElement.removeEventListener(eventName, listener, options);
|
|
10498
|
-
};
|
|
10499
|
-
}, [eventName, element, options]);
|
|
10500
|
-
}
|
|
10501
|
-
globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
10502
|
-
function adopt(value2) {
|
|
10503
|
-
return value2 instanceof P ? value2 : new P(function(resolve) {
|
|
10504
|
-
resolve(value2);
|
|
10505
|
-
});
|
|
10506
|
-
}
|
|
10507
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
10508
|
-
function fulfilled(value2) {
|
|
10509
|
-
try {
|
|
10510
|
-
step(generator.next(value2));
|
|
10511
|
-
} catch (e2) {
|
|
10512
|
-
reject(e2);
|
|
10513
|
-
}
|
|
10514
|
-
}
|
|
10515
|
-
function rejected(value2) {
|
|
10516
|
-
try {
|
|
10517
|
-
step(generator["throw"](value2));
|
|
10518
|
-
} catch (e2) {
|
|
10519
|
-
reject(e2);
|
|
10520
|
-
}
|
|
10521
|
-
}
|
|
10522
|
-
function step(result) {
|
|
10523
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
10524
|
-
}
|
|
10525
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10526
|
-
});
|
|
10527
|
-
};
|
|
10528
|
-
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
10529
|
-
function useLocalStorage(key2, initialValue) {
|
|
10530
|
-
const readValue = React.useCallback(() => {
|
|
10531
|
-
if (typeof window === "undefined") {
|
|
10532
|
-
return initialValue;
|
|
10533
|
-
}
|
|
10534
|
-
try {
|
|
10535
|
-
const item = window.localStorage.getItem(key2);
|
|
10536
|
-
return item ? parseJSON(item) : initialValue;
|
|
10537
|
-
} catch (error) {
|
|
10538
|
-
console.warn(`Error reading localStorage key “${key2}”:`, error);
|
|
10539
|
-
return initialValue;
|
|
10540
|
-
}
|
|
10541
|
-
}, [initialValue, key2]);
|
|
10542
|
-
const [storedValue, setStoredValue] = React.useState(readValue);
|
|
10543
|
-
const setValue = useEventCallback((value2) => {
|
|
10544
|
-
if (typeof window === "undefined") {
|
|
10545
|
-
console.warn(`Tried setting localStorage key “${key2}” even though environment is not a client`);
|
|
10546
|
-
}
|
|
10547
|
-
try {
|
|
10548
|
-
const newValue = value2 instanceof Function ? value2(storedValue) : value2;
|
|
10549
|
-
window.localStorage.setItem(key2, JSON.stringify(newValue));
|
|
10550
|
-
setStoredValue(newValue);
|
|
10551
|
-
window.dispatchEvent(new Event("local-storage"));
|
|
10552
|
-
} catch (error) {
|
|
10553
|
-
console.warn(`Error setting localStorage key “${key2}”:`, error);
|
|
10554
|
-
}
|
|
10555
|
-
});
|
|
10556
|
-
React.useEffect(() => {
|
|
10557
|
-
setStoredValue(readValue());
|
|
10558
|
-
}, []);
|
|
10559
|
-
const handleStorageChange = React.useCallback((event2) => {
|
|
10560
|
-
if ((event2 === null || event2 === void 0 ? void 0 : event2.key) && event2.key !== key2) {
|
|
10561
|
-
return;
|
|
10562
|
-
}
|
|
10563
|
-
setStoredValue(readValue());
|
|
10564
|
-
}, [key2, readValue]);
|
|
10565
|
-
useEventListener("storage", handleStorageChange);
|
|
10566
|
-
useEventListener("local-storage", handleStorageChange);
|
|
10567
|
-
return [storedValue, setValue];
|
|
10568
|
-
}
|
|
10569
|
-
function parseJSON(value2) {
|
|
10570
|
-
try {
|
|
10571
|
-
return value2 === "undefined" ? void 0 : JSON.parse(value2 !== null && value2 !== void 0 ? value2 : "");
|
|
10572
|
-
} catch (_a) {
|
|
10573
|
-
console.log("parsing error on", { value: value2 });
|
|
10574
|
-
return void 0;
|
|
10575
|
-
}
|
|
10576
|
-
}
|
|
10577
|
-
const GlobalStoreContext = React.createContext({});
|
|
10578
|
-
const index_1uuzt53 = "";
|
|
10579
|
-
const SelectStyle = "sj0ggy";
|
|
10580
|
-
const DropdownStyle = "d1eo8uqs";
|
|
10581
|
-
const SearchInputStyle = "s64gojc";
|
|
10582
|
-
const SelectContentStyle = "s16fqgtu";
|
|
10583
|
-
const TokenStyle = "tgaujbg";
|
|
10584
|
-
const CountTokenStyle = "c1vbd54v";
|
|
10585
|
-
const SelectOptionGroupStyle = "sxzmtrx";
|
|
10586
|
-
const LabelWrapperStyle = "lqrghwd";
|
|
10587
|
-
const AllNamespaceOptionStyle = "api7z1z";
|
|
10588
|
-
const OptionStyle = "o38b23x";
|
|
10589
|
-
const NS_STORE_KEY = "namespace-filter";
|
|
10590
|
-
const ALL_NS = "_all";
|
|
10591
|
-
const useNamespacesFilter = () => {
|
|
10592
|
-
const [value2] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
|
|
10593
|
-
const {
|
|
10594
|
-
resource
|
|
10595
|
-
} = core.useResource();
|
|
10596
|
-
const configs = React.useContext(ConfigsContext);
|
|
10597
|
-
if ((resource == null ? void 0 : resource.name) && configs[resource == null ? void 0 : resource.name].hideNamespacesFilter) {
|
|
10598
|
-
return {
|
|
10599
|
-
value: []
|
|
10600
|
-
};
|
|
10601
|
-
}
|
|
10602
|
-
return {
|
|
10603
|
-
value: value2
|
|
10604
|
-
};
|
|
10605
|
-
};
|
|
10606
|
-
const NamespacesFilter = ({
|
|
10607
|
-
className
|
|
10608
|
-
}) => {
|
|
10609
|
-
const kit = eagle.useUIKit();
|
|
10610
|
-
const {
|
|
10611
|
-
t: t2
|
|
10612
|
-
} = useTranslation();
|
|
10613
|
-
const [search, setSearch] = React.useState("");
|
|
10614
|
-
const {
|
|
10615
|
-
data: data2,
|
|
10616
|
-
isLoading
|
|
10617
|
-
} = core.useList({
|
|
10618
|
-
resource: "namespaces",
|
|
10619
|
-
meta: {
|
|
10620
|
-
resourceBasePath: "/api/v1",
|
|
10621
|
-
kind: "Namespace"
|
|
10622
|
-
},
|
|
10623
|
-
pagination: {
|
|
10624
|
-
mode: "off"
|
|
10625
|
-
}
|
|
10626
|
-
});
|
|
10627
|
-
const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
|
|
10628
|
-
const debouncedSetSearch = lodashEs.debounce(setSearch, 100);
|
|
10629
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
|
|
10630
|
-
loading: isLoading,
|
|
10631
|
-
style: {
|
|
10632
|
-
width: 278
|
|
10633
|
-
},
|
|
10634
|
-
className: cx_default(SelectStyle, className),
|
|
10635
|
-
dropdownClassName: DropdownStyle,
|
|
10636
|
-
searchValue: search,
|
|
10637
|
-
virtual: false,
|
|
10638
|
-
input: {
|
|
10639
|
-
value: value2,
|
|
10640
|
-
onChange(value22) {
|
|
10641
|
-
if (lodashEs.last(value22) === ALL_NS || value22.length === 0) {
|
|
10642
|
-
setValue([ALL_NS]);
|
|
10643
|
-
} else {
|
|
10644
|
-
setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
|
|
10645
|
-
}
|
|
10646
|
-
}
|
|
10647
|
-
},
|
|
10648
|
-
dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
10649
|
-
className: SelectContentStyle,
|
|
10650
|
-
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
|
|
10651
|
-
style: {
|
|
10652
|
-
width: "100%"
|
|
10653
|
-
},
|
|
10654
|
-
className: SearchInputStyle,
|
|
10655
|
-
onChange: debouncedSetSearch,
|
|
10656
|
-
placeholder: t2("dovetail.please_input")
|
|
10657
|
-
}), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
|
|
10658
|
-
}),
|
|
10659
|
-
tagRender: ({
|
|
10660
|
-
label: label2,
|
|
10661
|
-
value: value22,
|
|
10662
|
-
closable,
|
|
10663
|
-
onClose
|
|
10664
|
-
}) => {
|
|
10665
|
-
const isCountToken = label2 !== value22 && typeof label2 === "string";
|
|
10666
|
-
const isAll = value22 === ALL_NS;
|
|
10667
|
-
return isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
10668
|
-
style: {
|
|
10669
|
-
marginLeft: 8
|
|
10670
|
-
},
|
|
10671
|
-
children: label2
|
|
10672
|
-
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
|
|
10673
|
-
className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
|
|
10674
|
-
closable,
|
|
10675
|
-
size: "medium",
|
|
10676
|
-
onClose,
|
|
10677
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
10678
|
-
content: isCountToken ? label2.replace(/[\s\.]/g, "") : label2
|
|
10679
|
-
})
|
|
10680
|
-
});
|
|
10681
|
-
},
|
|
10682
|
-
maxTagCount: 1,
|
|
10683
|
-
optionLabelProp: "label",
|
|
10684
|
-
showArrow: true,
|
|
10685
|
-
showSearch: false,
|
|
10686
|
-
multiple: true,
|
|
10687
|
-
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
|
|
10688
|
-
value: "_all",
|
|
10689
|
-
label: t2("dovetail.all_namespaces"),
|
|
10690
|
-
className: AllNamespaceOptionStyle,
|
|
10691
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
10692
|
-
content: t2("dovetail.all_namespaces"),
|
|
10693
|
-
className: LabelWrapperStyle
|
|
10694
|
-
})
|
|
10695
|
-
}, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
|
|
10696
|
-
label: "",
|
|
10697
|
-
className: SelectOptionGroupStyle,
|
|
10698
|
-
children: data2 == null ? void 0 : data2.data.map((namespace2) => {
|
|
10699
|
-
const {
|
|
10700
|
-
name: name2
|
|
10701
|
-
} = namespace2.metadata;
|
|
10702
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
|
|
10703
|
-
value: name2,
|
|
10704
|
-
label: name2,
|
|
10705
|
-
className: OptionStyle,
|
|
10706
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
10707
|
-
content: name2,
|
|
10708
|
-
className: LabelWrapperStyle
|
|
10709
|
-
})
|
|
10710
|
-
}, name2);
|
|
10711
|
-
})
|
|
10712
|
-
})]
|
|
10713
|
-
});
|
|
10714
|
-
};
|
|
10715
10456
|
var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
|
|
10716
10457
|
ColumnKeys2["age"] = "age";
|
|
10717
10458
|
ColumnKeys2["name"] = "name";
|
|
@@ -10736,34 +10477,21 @@ var __publicField = (obj, key, value) => {
|
|
|
10736
10477
|
}));
|
|
10737
10478
|
}
|
|
10738
10479
|
const useEagleTable = (params) => {
|
|
10739
|
-
var _a, _b;
|
|
10480
|
+
var _a, _b, _c;
|
|
10740
10481
|
const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
|
|
10741
10482
|
const [selectedKeys, setSelectedKeys] = React.useState([]);
|
|
10742
10483
|
const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
|
|
10743
10484
|
const { resource } = core.useResource();
|
|
10744
10485
|
const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
|
|
10745
|
-
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
10746
10486
|
const useTableParams = React.useMemo(() => {
|
|
10747
10487
|
const mergedParams = lodashEs.merge(params.useTableParams, {
|
|
10748
10488
|
pagination: {
|
|
10749
10489
|
pageSize: currentSize,
|
|
10750
10490
|
mode: "server"
|
|
10751
|
-
},
|
|
10752
|
-
filters: {
|
|
10753
|
-
permanent: [
|
|
10754
|
-
{
|
|
10755
|
-
operator: "or",
|
|
10756
|
-
value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
|
|
10757
|
-
field: "metadata.namespace",
|
|
10758
|
-
operator: "eq",
|
|
10759
|
-
value: filter
|
|
10760
|
-
}))
|
|
10761
|
-
}
|
|
10762
|
-
]
|
|
10763
10491
|
}
|
|
10764
10492
|
});
|
|
10765
10493
|
return mergedParams;
|
|
10766
|
-
}, [params.useTableParams,
|
|
10494
|
+
}, [params.useTableParams, currentSize]);
|
|
10767
10495
|
const finalColumns = React.useMemo(
|
|
10768
10496
|
() => addDefaultRenderToColumns(columns),
|
|
10769
10497
|
[columns]
|
|
@@ -10800,15 +10528,26 @@ var __publicField = (obj, key, value) => {
|
|
|
10800
10528
|
error: false,
|
|
10801
10529
|
rowKey: "id",
|
|
10802
10530
|
currentPage,
|
|
10803
|
-
defaultSize: currentSize,
|
|
10804
10531
|
onPageChange,
|
|
10805
10532
|
onSorterChange,
|
|
10806
10533
|
onSelect: (keys) => {
|
|
10807
10534
|
setSelectedKeys(keys);
|
|
10808
10535
|
},
|
|
10809
10536
|
total,
|
|
10810
|
-
RowMenu: Dropdown
|
|
10537
|
+
RowMenu: Dropdown,
|
|
10538
|
+
...tableProps,
|
|
10539
|
+
defaultSize: currentSize
|
|
10811
10540
|
};
|
|
10541
|
+
React.useEffect(() => {
|
|
10542
|
+
table.setSorters([{
|
|
10543
|
+
field: "metadata.creationTimestamp",
|
|
10544
|
+
order: "desc"
|
|
10545
|
+
}]);
|
|
10546
|
+
}, []);
|
|
10547
|
+
React.useEffect(() => {
|
|
10548
|
+
setCurrentPage(1);
|
|
10549
|
+
table.setCurrent(1);
|
|
10550
|
+
}, [(_c = params.useTableParams) == null ? void 0 : _c.filters]);
|
|
10812
10551
|
return { tableProps: finalProps, selectedKeys, ...table };
|
|
10813
10552
|
};
|
|
10814
10553
|
function CreateButton() {
|
|
@@ -10924,6 +10663,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10924
10663
|
owner,
|
|
10925
10664
|
hideToolBar
|
|
10926
10665
|
}) => {
|
|
10666
|
+
var _a;
|
|
10927
10667
|
const {
|
|
10928
10668
|
i18n: i18n2
|
|
10929
10669
|
} = useTranslation();
|
|
@@ -10944,15 +10684,19 @@ var __publicField = (obj, key, value) => {
|
|
|
10944
10684
|
meta: {
|
|
10945
10685
|
resourceBasePath: "/apis/batch/v1",
|
|
10946
10686
|
kind: "Job"
|
|
10687
|
+
},
|
|
10688
|
+
filters: {
|
|
10689
|
+
permanent: [{
|
|
10690
|
+
field: "",
|
|
10691
|
+
value: "",
|
|
10692
|
+
fn(item) {
|
|
10693
|
+
return owner ? matchOwner(item, owner) : true;
|
|
10694
|
+
}
|
|
10695
|
+
}]
|
|
10947
10696
|
}
|
|
10948
10697
|
}
|
|
10949
10698
|
});
|
|
10950
|
-
|
|
10951
|
-
return tableProps.data.filter((p) => {
|
|
10952
|
-
return owner ? matchOwner(p, owner) : true;
|
|
10953
|
-
});
|
|
10954
|
-
}, [tableProps.data, owner]);
|
|
10955
|
-
if (!(dataSource == null ? void 0 : dataSource.length) && !tableProps.loading) {
|
|
10699
|
+
if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
|
|
10956
10700
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
|
|
10957
10701
|
errorText: i18n2.t("dovetail.no_resource", {
|
|
10958
10702
|
kind: " Job"
|
|
@@ -10974,8 +10718,10 @@ var __publicField = (obj, key, value) => {
|
|
|
10974
10718
|
});
|
|
10975
10719
|
};
|
|
10976
10720
|
const EventsTable = ({}) => {
|
|
10721
|
+
var _a, _b;
|
|
10977
10722
|
const { i18n: i18n2 } = useTranslation();
|
|
10978
10723
|
const parsed = core.useParsed();
|
|
10724
|
+
const [regardingNamespace, regardingName] = (_a = parsed == null ? void 0 : parsed.id) == null ? void 0 : _a.split("/");
|
|
10979
10725
|
const columns = React.useMemo(
|
|
10980
10726
|
() => [
|
|
10981
10727
|
{
|
|
@@ -11018,20 +10764,34 @@ var __publicField = (obj, key, value) => {
|
|
|
11018
10764
|
);
|
|
11019
10765
|
const { tableProps } = useEagleTable({
|
|
11020
10766
|
columns,
|
|
10767
|
+
tableProps: {
|
|
10768
|
+
defaultSize: 50
|
|
10769
|
+
},
|
|
11021
10770
|
useTableParams: {
|
|
11022
10771
|
resource: "events",
|
|
11023
|
-
meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" }
|
|
10772
|
+
meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
|
|
10773
|
+
filters: {
|
|
10774
|
+
permanent: [{
|
|
10775
|
+
operator: "and",
|
|
10776
|
+
value: [
|
|
10777
|
+
{
|
|
10778
|
+
field: "regarding.namespace",
|
|
10779
|
+
operator: "eq",
|
|
10780
|
+
value: regardingNamespace
|
|
10781
|
+
},
|
|
10782
|
+
{
|
|
10783
|
+
field: "regarding.name",
|
|
10784
|
+
operator: "eq",
|
|
10785
|
+
value: regardingName
|
|
10786
|
+
}
|
|
10787
|
+
]
|
|
10788
|
+
}]
|
|
10789
|
+
}
|
|
11024
10790
|
}
|
|
11025
10791
|
});
|
|
11026
10792
|
const component = React.useContext(ComponentContext);
|
|
11027
|
-
const dataSource = React.useMemo(() => {
|
|
11028
|
-
return tableProps.data.filter((d) => {
|
|
11029
|
-
const objectId = `${d.regarding.namespace}/${d.regarding.name}`;
|
|
11030
|
-
return objectId === parsed.id;
|
|
11031
|
-
});
|
|
11032
|
-
}, [tableProps.data, parsed]);
|
|
11033
10793
|
const Table$1 = component.Table || Table;
|
|
11034
|
-
if (!(
|
|
10794
|
+
if (!((_b = tableProps.data) == null ? void 0 : _b.length) && !tableProps.loading) {
|
|
11035
10795
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
11036
10796
|
WidgetErrorContent,
|
|
11037
10797
|
{
|
|
@@ -11056,10 +10816,10 @@ var __publicField = (obj, key, value) => {
|
|
|
11056
10816
|
}) => {
|
|
11057
10817
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
11058
10818
|
className: ImageWrapperStyle,
|
|
11059
|
-
children: breakLine ? value2.map((image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
|
|
10819
|
+
children: breakLine ? value2.map((image2, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
|
|
11060
10820
|
content: image2,
|
|
11061
10821
|
tooltip: image2
|
|
11062
|
-
}, image2)) : value2.join(", ")
|
|
10822
|
+
}, `${image2}-${index}`)) : value2.join(", ")
|
|
11063
10823
|
});
|
|
11064
10824
|
};
|
|
11065
10825
|
const ResourceLink = (props) => {
|
|
@@ -11189,7 +10949,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11189
10949
|
}
|
|
11190
10950
|
);
|
|
11191
10951
|
};
|
|
11192
|
-
const
|
|
10952
|
+
const KeyValue_q4vd5r = "";
|
|
11193
10953
|
const ContentBlockStyle = "c8jy7dc";
|
|
11194
10954
|
const KeyStyle = "k2sddxl";
|
|
11195
10955
|
const ValueStyle$2 = "v16vicsr";
|
|
@@ -11503,6 +11263,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11503
11263
|
selector,
|
|
11504
11264
|
hideToolbar
|
|
11505
11265
|
}) => {
|
|
11266
|
+
var _a;
|
|
11506
11267
|
const {
|
|
11507
11268
|
i18n: i18n2
|
|
11508
11269
|
} = useTranslation();
|
|
@@ -11528,15 +11289,19 @@ var __publicField = (obj, key, value) => {
|
|
|
11528
11289
|
meta: {
|
|
11529
11290
|
resourceBasePath: "/api/v1",
|
|
11530
11291
|
kind: "Pod"
|
|
11292
|
+
},
|
|
11293
|
+
filters: {
|
|
11294
|
+
permanent: [{
|
|
11295
|
+
field: "",
|
|
11296
|
+
value: "",
|
|
11297
|
+
fn(item) {
|
|
11298
|
+
return selector ? matchSelector(item, selector) : true;
|
|
11299
|
+
}
|
|
11300
|
+
}]
|
|
11531
11301
|
}
|
|
11532
11302
|
}
|
|
11533
11303
|
});
|
|
11534
|
-
|
|
11535
|
-
return tableProps.data.filter((p) => {
|
|
11536
|
-
return selector ? matchSelector(p, selector) : true;
|
|
11537
|
-
});
|
|
11538
|
-
}, [tableProps.data, selector]);
|
|
11539
|
-
if ((dataSource == null ? void 0 : dataSource.length) === 0) {
|
|
11304
|
+
if (((_a = tableProps.data) == null ? void 0 : _a.length) === 0) {
|
|
11540
11305
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
|
|
11541
11306
|
errorText: i18n2.t("dovetail.no_resource", {
|
|
11542
11307
|
kind: ` ${i18n2.t("dovetail.pod")}`
|
|
@@ -18243,7 +18008,11 @@ var __publicField = (obj, key, value) => {
|
|
|
18243
18008
|
onSorterChange
|
|
18244
18009
|
} = useTableData({
|
|
18245
18010
|
data: dataSource,
|
|
18246
|
-
columns
|
|
18011
|
+
columns,
|
|
18012
|
+
defaultSorters: [{
|
|
18013
|
+
field: "state.running.startedAt",
|
|
18014
|
+
order: "desc"
|
|
18015
|
+
}]
|
|
18247
18016
|
});
|
|
18248
18017
|
if (dataSource.length === 0) {
|
|
18249
18018
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -18583,6 +18352,342 @@ var __publicField = (obj, key, value) => {
|
|
|
18583
18352
|
children
|
|
18584
18353
|
] });
|
|
18585
18354
|
}
|
|
18355
|
+
globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
18356
|
+
function adopt(value2) {
|
|
18357
|
+
return value2 instanceof P ? value2 : new P(function(resolve) {
|
|
18358
|
+
resolve(value2);
|
|
18359
|
+
});
|
|
18360
|
+
}
|
|
18361
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
18362
|
+
function fulfilled(value2) {
|
|
18363
|
+
try {
|
|
18364
|
+
step(generator.next(value2));
|
|
18365
|
+
} catch (e2) {
|
|
18366
|
+
reject(e2);
|
|
18367
|
+
}
|
|
18368
|
+
}
|
|
18369
|
+
function rejected(value2) {
|
|
18370
|
+
try {
|
|
18371
|
+
step(generator["throw"](value2));
|
|
18372
|
+
} catch (e2) {
|
|
18373
|
+
reject(e2);
|
|
18374
|
+
}
|
|
18375
|
+
}
|
|
18376
|
+
function step(result) {
|
|
18377
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
18378
|
+
}
|
|
18379
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18380
|
+
});
|
|
18381
|
+
};
|
|
18382
|
+
function useEventCallback(fn) {
|
|
18383
|
+
const ref = React.useRef(() => {
|
|
18384
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
18385
|
+
});
|
|
18386
|
+
useIsomorphicLayoutEffect(() => {
|
|
18387
|
+
ref.current = fn;
|
|
18388
|
+
}, [fn]);
|
|
18389
|
+
return React.useCallback((...args) => ref.current(...args), [ref]);
|
|
18390
|
+
}
|
|
18391
|
+
function useEventListener(eventName, handler, element, options) {
|
|
18392
|
+
const savedHandler = React.useRef(handler);
|
|
18393
|
+
useIsomorphicLayoutEffect(() => {
|
|
18394
|
+
savedHandler.current = handler;
|
|
18395
|
+
}, [handler]);
|
|
18396
|
+
React.useEffect(() => {
|
|
18397
|
+
var _a;
|
|
18398
|
+
const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
|
|
18399
|
+
if (!(targetElement && targetElement.addEventListener))
|
|
18400
|
+
return;
|
|
18401
|
+
const listener = (event2) => savedHandler.current(event2);
|
|
18402
|
+
targetElement.addEventListener(eventName, listener, options);
|
|
18403
|
+
return () => {
|
|
18404
|
+
targetElement.removeEventListener(eventName, listener, options);
|
|
18405
|
+
};
|
|
18406
|
+
}, [eventName, element, options]);
|
|
18407
|
+
}
|
|
18408
|
+
globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
18409
|
+
function adopt(value2) {
|
|
18410
|
+
return value2 instanceof P ? value2 : new P(function(resolve) {
|
|
18411
|
+
resolve(value2);
|
|
18412
|
+
});
|
|
18413
|
+
}
|
|
18414
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
18415
|
+
function fulfilled(value2) {
|
|
18416
|
+
try {
|
|
18417
|
+
step(generator.next(value2));
|
|
18418
|
+
} catch (e2) {
|
|
18419
|
+
reject(e2);
|
|
18420
|
+
}
|
|
18421
|
+
}
|
|
18422
|
+
function rejected(value2) {
|
|
18423
|
+
try {
|
|
18424
|
+
step(generator["throw"](value2));
|
|
18425
|
+
} catch (e2) {
|
|
18426
|
+
reject(e2);
|
|
18427
|
+
}
|
|
18428
|
+
}
|
|
18429
|
+
function step(result) {
|
|
18430
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
18431
|
+
}
|
|
18432
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18433
|
+
});
|
|
18434
|
+
};
|
|
18435
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
18436
|
+
function useLocalStorage(key2, initialValue) {
|
|
18437
|
+
const readValue = React.useCallback(() => {
|
|
18438
|
+
if (typeof window === "undefined") {
|
|
18439
|
+
return initialValue;
|
|
18440
|
+
}
|
|
18441
|
+
try {
|
|
18442
|
+
const item = window.localStorage.getItem(key2);
|
|
18443
|
+
return item ? parseJSON(item) : initialValue;
|
|
18444
|
+
} catch (error) {
|
|
18445
|
+
console.warn(`Error reading localStorage key “${key2}”:`, error);
|
|
18446
|
+
return initialValue;
|
|
18447
|
+
}
|
|
18448
|
+
}, [initialValue, key2]);
|
|
18449
|
+
const [storedValue, setStoredValue] = React.useState(readValue);
|
|
18450
|
+
const setValue = useEventCallback((value2) => {
|
|
18451
|
+
if (typeof window === "undefined") {
|
|
18452
|
+
console.warn(`Tried setting localStorage key “${key2}” even though environment is not a client`);
|
|
18453
|
+
}
|
|
18454
|
+
try {
|
|
18455
|
+
const newValue = value2 instanceof Function ? value2(storedValue) : value2;
|
|
18456
|
+
window.localStorage.setItem(key2, JSON.stringify(newValue));
|
|
18457
|
+
setStoredValue(newValue);
|
|
18458
|
+
window.dispatchEvent(new Event("local-storage"));
|
|
18459
|
+
} catch (error) {
|
|
18460
|
+
console.warn(`Error setting localStorage key “${key2}”:`, error);
|
|
18461
|
+
}
|
|
18462
|
+
});
|
|
18463
|
+
React.useEffect(() => {
|
|
18464
|
+
setStoredValue(readValue());
|
|
18465
|
+
}, []);
|
|
18466
|
+
const handleStorageChange = React.useCallback((event2) => {
|
|
18467
|
+
if ((event2 === null || event2 === void 0 ? void 0 : event2.key) && event2.key !== key2) {
|
|
18468
|
+
return;
|
|
18469
|
+
}
|
|
18470
|
+
setStoredValue(readValue());
|
|
18471
|
+
}, [key2, readValue]);
|
|
18472
|
+
useEventListener("storage", handleStorageChange);
|
|
18473
|
+
useEventListener("local-storage", handleStorageChange);
|
|
18474
|
+
return [storedValue, setValue];
|
|
18475
|
+
}
|
|
18476
|
+
function parseJSON(value2) {
|
|
18477
|
+
try {
|
|
18478
|
+
return value2 === "undefined" ? void 0 : JSON.parse(value2 !== null && value2 !== void 0 ? value2 : "");
|
|
18479
|
+
} catch (_a) {
|
|
18480
|
+
console.log("parsing error on", { value: value2 });
|
|
18481
|
+
return void 0;
|
|
18482
|
+
}
|
|
18483
|
+
}
|
|
18484
|
+
const GlobalStoreContext = React.createContext({});
|
|
18485
|
+
const index_1xad2h9 = "";
|
|
18486
|
+
const SelectStyle = "sj0ggy";
|
|
18487
|
+
const DropdownStyle = "d1eo8uqs";
|
|
18488
|
+
const SearchInputStyle = "s64gojc";
|
|
18489
|
+
const SelectContentStyle = "s16fqgtu";
|
|
18490
|
+
const TokenStyle = "tgaujbg";
|
|
18491
|
+
const CountTokenStyle = "c1vbd54v";
|
|
18492
|
+
const SelectOptionGroupStyle = "sxzmtrx";
|
|
18493
|
+
const LabelWrapperStyle = "lqrghwd";
|
|
18494
|
+
const AllNamespaceOptionStyle = "api7z1z";
|
|
18495
|
+
const OptionStyle = "o38b23x";
|
|
18496
|
+
const NS_STORE_KEY = "namespace-filter";
|
|
18497
|
+
const ALL_NS = "_all";
|
|
18498
|
+
const useNamespacesFilter = () => {
|
|
18499
|
+
const [value2] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
|
|
18500
|
+
const {
|
|
18501
|
+
resource
|
|
18502
|
+
} = core.useResource();
|
|
18503
|
+
const configs = React.useContext(ConfigsContext);
|
|
18504
|
+
if ((resource == null ? void 0 : resource.name) && configs[resource == null ? void 0 : resource.name].hideNamespacesFilter) {
|
|
18505
|
+
return {
|
|
18506
|
+
value: []
|
|
18507
|
+
};
|
|
18508
|
+
}
|
|
18509
|
+
return {
|
|
18510
|
+
value: value2
|
|
18511
|
+
};
|
|
18512
|
+
};
|
|
18513
|
+
const NamespacesFilter = ({
|
|
18514
|
+
className
|
|
18515
|
+
}) => {
|
|
18516
|
+
const kit = eagle.useUIKit();
|
|
18517
|
+
const {
|
|
18518
|
+
t: t2
|
|
18519
|
+
} = useTranslation();
|
|
18520
|
+
const [search, setSearch] = React.useState("");
|
|
18521
|
+
const [tagMaxWidth, setTagMaxWidth] = React.useState("");
|
|
18522
|
+
const {
|
|
18523
|
+
data: data2,
|
|
18524
|
+
isLoading
|
|
18525
|
+
} = core.useList({
|
|
18526
|
+
resource: "namespaces",
|
|
18527
|
+
meta: {
|
|
18528
|
+
resourceBasePath: "/api/v1",
|
|
18529
|
+
kind: "Namespace"
|
|
18530
|
+
},
|
|
18531
|
+
pagination: {
|
|
18532
|
+
mode: "off"
|
|
18533
|
+
}
|
|
18534
|
+
});
|
|
18535
|
+
const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
|
|
18536
|
+
const [open, setOpen] = React.useState(false);
|
|
18537
|
+
const debouncedSetSearch = lodashEs.debounce(setSearch, 100);
|
|
18538
|
+
const MAX_TAG_COUNT = 8;
|
|
18539
|
+
const COUNT_TAG_WIDTH = 22;
|
|
18540
|
+
const TAG_GAP = 4;
|
|
18541
|
+
const PADDING = 36;
|
|
18542
|
+
const hasCountTag = value2.length > MAX_TAG_COUNT;
|
|
18543
|
+
const WRAPPER_CLASS = "d2-namespace-select-wrapper";
|
|
18544
|
+
const SELECT_CLASS = "d2-namespace-select";
|
|
18545
|
+
const calcTagMaxWidth = React.useCallback(() => {
|
|
18546
|
+
const wrapper = document.querySelector(`.${WRAPPER_CLASS}`);
|
|
18547
|
+
const n2 = Math.min(value2.length, MAX_TAG_COUNT);
|
|
18548
|
+
const tagWidth = ((wrapper == null ? void 0 : wrapper.offsetWidth) || 0) / n2;
|
|
18549
|
+
const gapsWidth = (Math.min(value2.length, MAX_TAG_COUNT + 1) - 1) * TAG_GAP;
|
|
18550
|
+
const paddingAndCountTagWidth = PADDING + (hasCountTag ? COUNT_TAG_WIDTH : 0);
|
|
18551
|
+
const perTagMaxWidth = tagWidth - (paddingAndCountTagWidth + gapsWidth) / n2;
|
|
18552
|
+
setTagMaxWidth(`${perTagMaxWidth}px`);
|
|
18553
|
+
}, [value2, hasCountTag]);
|
|
18554
|
+
React.useEffect(() => {
|
|
18555
|
+
calcTagMaxWidth();
|
|
18556
|
+
}, [calcTagMaxWidth]);
|
|
18557
|
+
React.useEffect(() => {
|
|
18558
|
+
window.addEventListener("resize", calcTagMaxWidth);
|
|
18559
|
+
return () => {
|
|
18560
|
+
window.removeEventListener("resize", calcTagMaxWidth);
|
|
18561
|
+
};
|
|
18562
|
+
}, [calcTagMaxWidth]);
|
|
18563
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
18564
|
+
className: WRAPPER_CLASS,
|
|
18565
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
|
|
18566
|
+
loading: isLoading,
|
|
18567
|
+
className: cx_default(SelectStyle, SELECT_CLASS, className),
|
|
18568
|
+
style: {
|
|
18569
|
+
"--tag-max-width": tagMaxWidth
|
|
18570
|
+
},
|
|
18571
|
+
dropdownClassName: DropdownStyle,
|
|
18572
|
+
searchValue: search,
|
|
18573
|
+
virtual: false,
|
|
18574
|
+
input: {
|
|
18575
|
+
value: value2,
|
|
18576
|
+
onChange(value22) {
|
|
18577
|
+
if (lodashEs.last(value22) === ALL_NS || value22.length === 0) {
|
|
18578
|
+
setValue([ALL_NS]);
|
|
18579
|
+
} else {
|
|
18580
|
+
setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
|
|
18581
|
+
}
|
|
18582
|
+
}
|
|
18583
|
+
},
|
|
18584
|
+
dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
18585
|
+
className: SelectContentStyle,
|
|
18586
|
+
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
|
|
18587
|
+
style: {
|
|
18588
|
+
width: "100%"
|
|
18589
|
+
},
|
|
18590
|
+
className: SearchInputStyle,
|
|
18591
|
+
onChange: debouncedSetSearch,
|
|
18592
|
+
placeholder: t2("dovetail.please_input")
|
|
18593
|
+
}), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
|
|
18594
|
+
}),
|
|
18595
|
+
tagRender: ({
|
|
18596
|
+
label: label2,
|
|
18597
|
+
value: namespaceValue,
|
|
18598
|
+
closable,
|
|
18599
|
+
onClose
|
|
18600
|
+
}) => {
|
|
18601
|
+
const isCountToken = label2 !== namespaceValue && typeof label2 === "string";
|
|
18602
|
+
const isAll = namespaceValue === ALL_NS;
|
|
18603
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
18604
|
+
onClick: () => {
|
|
18605
|
+
setOpen(!open);
|
|
18606
|
+
},
|
|
18607
|
+
children: isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
18608
|
+
style: {
|
|
18609
|
+
marginLeft: 8
|
|
18610
|
+
},
|
|
18611
|
+
children: label2
|
|
18612
|
+
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
|
|
18613
|
+
className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
|
|
18614
|
+
closable,
|
|
18615
|
+
size: "medium",
|
|
18616
|
+
onClose,
|
|
18617
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
18618
|
+
content: isCountToken ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.tooltip, {
|
|
18619
|
+
title: isCountToken ? value2.slice(MAX_TAG_COUNT).map((namespace2, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
18620
|
+
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
18621
|
+
children: namespace2
|
|
18622
|
+
}), index !== value2.length - 1 - MAX_TAG_COUNT ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, {
|
|
18623
|
+
style: {
|
|
18624
|
+
margin: "6px 0",
|
|
18625
|
+
borderColor: "rgba(107, 128, 167, 0.60)"
|
|
18626
|
+
}
|
|
18627
|
+
}) : null]
|
|
18628
|
+
})) : null,
|
|
18629
|
+
trigger: ["hover"],
|
|
18630
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
18631
|
+
children: label2.replace(/[\s\.]/g, "")
|
|
18632
|
+
})
|
|
18633
|
+
}) : label2
|
|
18634
|
+
})
|
|
18635
|
+
})
|
|
18636
|
+
});
|
|
18637
|
+
},
|
|
18638
|
+
maxTagCount: MAX_TAG_COUNT,
|
|
18639
|
+
optionLabelProp: "label",
|
|
18640
|
+
showArrow: true,
|
|
18641
|
+
showSearch: false,
|
|
18642
|
+
open,
|
|
18643
|
+
onDropdownVisibleChange: (open2) => {
|
|
18644
|
+
setOpen(open2);
|
|
18645
|
+
},
|
|
18646
|
+
multiple: true,
|
|
18647
|
+
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
|
|
18648
|
+
value: "_all",
|
|
18649
|
+
label: t2("dovetail.all_namespaces"),
|
|
18650
|
+
className: AllNamespaceOptionStyle,
|
|
18651
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
18652
|
+
content: t2("dovetail.all_namespaces"),
|
|
18653
|
+
className: LabelWrapperStyle
|
|
18654
|
+
})
|
|
18655
|
+
}, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
|
|
18656
|
+
label: "",
|
|
18657
|
+
className: SelectOptionGroupStyle,
|
|
18658
|
+
children: data2 == null ? void 0 : data2.data.map((namespace2) => {
|
|
18659
|
+
const {
|
|
18660
|
+
name: name2
|
|
18661
|
+
} = namespace2.metadata;
|
|
18662
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
|
|
18663
|
+
value: name2,
|
|
18664
|
+
label: name2,
|
|
18665
|
+
className: OptionStyle,
|
|
18666
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
18667
|
+
content: name2,
|
|
18668
|
+
className: LabelWrapperStyle
|
|
18669
|
+
})
|
|
18670
|
+
}, name2);
|
|
18671
|
+
})
|
|
18672
|
+
})]
|
|
18673
|
+
})
|
|
18674
|
+
});
|
|
18675
|
+
};
|
|
18676
|
+
function useNamespaceFilter() {
|
|
18677
|
+
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
18678
|
+
return {
|
|
18679
|
+
permanent: [
|
|
18680
|
+
{
|
|
18681
|
+
operator: "or",
|
|
18682
|
+
value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
|
|
18683
|
+
field: "metadata.namespace",
|
|
18684
|
+
operator: "eq",
|
|
18685
|
+
value: filter
|
|
18686
|
+
}))
|
|
18687
|
+
}
|
|
18688
|
+
]
|
|
18689
|
+
};
|
|
18690
|
+
}
|
|
18586
18691
|
const index_hp158y = "";
|
|
18587
18692
|
const ListPageStyle = "laykzsq";
|
|
18588
18693
|
const ListContentStyle = "l1ng0psc";
|
|
@@ -18647,11 +18752,15 @@ var __publicField = (obj, key, value) => {
|
|
|
18647
18752
|
const { formatter, columns, Dropdown, noShow } = props.config;
|
|
18648
18753
|
const { i18n: i18n2 } = useTranslation();
|
|
18649
18754
|
const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
|
|
18755
|
+
const filters = useNamespaceFilter();
|
|
18650
18756
|
const { tableProps, selectedKeys } = useEagleTable({
|
|
18651
|
-
useTableParams: {
|
|
18757
|
+
useTableParams: {
|
|
18758
|
+
filters
|
|
18759
|
+
},
|
|
18652
18760
|
columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
|
|
18653
18761
|
tableProps: {
|
|
18654
|
-
defaultSize: 50
|
|
18762
|
+
defaultSize: 50,
|
|
18763
|
+
...props.config.tableProps
|
|
18655
18764
|
},
|
|
18656
18765
|
formatter,
|
|
18657
18766
|
Dropdown
|
|
@@ -21856,20 +21965,44 @@ var __publicField = (obj, key, value) => {
|
|
|
21856
21965
|
_formControl.current.formState = getProxyFormState(formState, control);
|
|
21857
21966
|
return _formControl.current;
|
|
21858
21967
|
}
|
|
21859
|
-
const
|
|
21968
|
+
const RefineFormContent_1tb00bi = "";
|
|
21860
21969
|
const RefineFormContent = (props) => {
|
|
21861
|
-
var _a, _b;
|
|
21970
|
+
var _a, _b, _c, _d;
|
|
21862
21971
|
const {
|
|
21863
21972
|
config,
|
|
21864
21973
|
formResult,
|
|
21865
|
-
|
|
21974
|
+
resourceId,
|
|
21866
21975
|
errorMsg
|
|
21867
21976
|
} = props;
|
|
21868
21977
|
const {
|
|
21869
21978
|
control,
|
|
21870
21979
|
getValues
|
|
21871
21980
|
} = formResult;
|
|
21872
|
-
const
|
|
21981
|
+
const action = resourceId ? "edit" : "create";
|
|
21982
|
+
const listQuery = core.useList({
|
|
21983
|
+
resource: config == null ? void 0 : config.name,
|
|
21984
|
+
meta: {
|
|
21985
|
+
resourceBasePath: config == null ? void 0 : config.basePath,
|
|
21986
|
+
kind: config == null ? void 0 : config.kind
|
|
21987
|
+
},
|
|
21988
|
+
pagination: {
|
|
21989
|
+
mode: "off"
|
|
21990
|
+
}
|
|
21991
|
+
});
|
|
21992
|
+
const showQuery = core.useShow({
|
|
21993
|
+
resource: config == null ? void 0 : config.name,
|
|
21994
|
+
meta: {
|
|
21995
|
+
resourceBasePath: config == null ? void 0 : config.basePath,
|
|
21996
|
+
kind: config == null ? void 0 : config.kind
|
|
21997
|
+
},
|
|
21998
|
+
id: resourceId
|
|
21999
|
+
});
|
|
22000
|
+
const formFieldsConfig = (_d = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _d.call(_a, {
|
|
22001
|
+
record: (_b = showQuery.queryResult.data) == null ? void 0 : _b.data,
|
|
22002
|
+
records: ((_c = listQuery.data) == null ? void 0 : _c.data) || [],
|
|
22003
|
+
action
|
|
22004
|
+
});
|
|
22005
|
+
const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((c2) => {
|
|
21873
22006
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
|
|
21874
22007
|
control,
|
|
21875
22008
|
name: c2.path.join("."),
|
|
@@ -21901,6 +22034,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21901
22034
|
var _a2;
|
|
21902
22035
|
const formValue = getValues();
|
|
21903
22036
|
let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.String, {
|
|
22037
|
+
placeholder: c2.placeholder,
|
|
21904
22038
|
input: {
|
|
21905
22039
|
value: value2,
|
|
21906
22040
|
onChange,
|
|
@@ -21913,6 +22047,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21913
22047
|
switch (c2.type) {
|
|
21914
22048
|
case "number":
|
|
21915
22049
|
ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.Integer, {
|
|
22050
|
+
placeholder: c2.placeholder,
|
|
21916
22051
|
input: {
|
|
21917
22052
|
value: value2,
|
|
21918
22053
|
onChange,
|
|
@@ -21928,11 +22063,23 @@ var __publicField = (obj, key, value) => {
|
|
|
21928
22063
|
children: value2
|
|
21929
22064
|
});
|
|
21930
22065
|
}
|
|
22066
|
+
if (c2.helperText) {
|
|
22067
|
+
ele = /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
|
|
22068
|
+
size: 4,
|
|
22069
|
+
direction: "vertical",
|
|
22070
|
+
className: "c154n7ie",
|
|
22071
|
+
children: [ele, /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
22072
|
+
className: cx_default(eagle.Typo.Footnote.f2_regular, "c1c9j4da"),
|
|
22073
|
+
children: c2.helperText
|
|
22074
|
+
})]
|
|
22075
|
+
});
|
|
22076
|
+
}
|
|
21931
22077
|
if (c2 == null ? void 0 : c2.render) {
|
|
21932
22078
|
ele = c2.render(value2, onChange, formValue, onBlur, action);
|
|
21933
22079
|
}
|
|
21934
22080
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Form.Item, {
|
|
21935
22081
|
label: c2.label,
|
|
22082
|
+
colon: false,
|
|
21936
22083
|
labelCol: {
|
|
21937
22084
|
flex: "0 0 216px"
|
|
21938
22085
|
},
|
|
@@ -21945,7 +22092,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21945
22092
|
});
|
|
21946
22093
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
|
|
21947
22094
|
direction: "vertical",
|
|
21948
|
-
className: "
|
|
22095
|
+
className: "cjxv8cf",
|
|
21949
22096
|
children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
|
|
21950
22097
|
errorMsgs: errorMsg ? [errorMsg] : [],
|
|
21951
22098
|
style: {
|
|
@@ -22585,7 +22732,6 @@ var __publicField = (obj, key, value) => {
|
|
|
22585
22732
|
};
|
|
22586
22733
|
};
|
|
22587
22734
|
const useRefineForm = (props) => {
|
|
22588
|
-
var _a;
|
|
22589
22735
|
const { config, id, refineProps } = props;
|
|
22590
22736
|
const [responseErrorMsg, setResponseErrorMsg] = React.useState("");
|
|
22591
22737
|
const i18n2 = useTranslation();
|
|
@@ -22618,15 +22764,15 @@ var __publicField = (obj, key, value) => {
|
|
|
22618
22764
|
defaultValues: config == null ? void 0 : config.initValue
|
|
22619
22765
|
});
|
|
22620
22766
|
React.useEffect(() => {
|
|
22621
|
-
var
|
|
22622
|
-
const response = (
|
|
22767
|
+
var _a, _b;
|
|
22768
|
+
const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
|
|
22623
22769
|
if (response && !(response == null ? void 0 : response.bodyUsed)) {
|
|
22624
22770
|
(_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
|
|
22625
|
-
var
|
|
22626
|
-
setResponseErrorMsg(((_b2 = (
|
|
22771
|
+
var _a2, _b2;
|
|
22772
|
+
setResponseErrorMsg(((_b2 = (_a2 = config.formConfig) == null ? void 0 : _a2.formatError) == null ? void 0 : _b2.call(_a2, body)) || body.message);
|
|
22627
22773
|
});
|
|
22628
22774
|
}
|
|
22629
|
-
}, [config.formConfig,
|
|
22775
|
+
}, [config.formConfig, result]);
|
|
22630
22776
|
return { formResult: result, responseErrorMsg };
|
|
22631
22777
|
};
|
|
22632
22778
|
const index_12sfrn = "";
|
|
@@ -23152,9 +23298,18 @@ var __publicField = (obj, key, value) => {
|
|
|
23152
23298
|
setEditorErrors(errors);
|
|
23153
23299
|
return;
|
|
23154
23300
|
}
|
|
23155
|
-
|
|
23156
|
-
|
|
23157
|
-
|
|
23301
|
+
try {
|
|
23302
|
+
const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
|
|
23303
|
+
const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
|
|
23304
|
+
return onFinish(finalValues);
|
|
23305
|
+
} catch (error) {
|
|
23306
|
+
if (error instanceof Error) {
|
|
23307
|
+
if (error.message === "expected a single document in the stream, but found more") {
|
|
23308
|
+
setEditorErrors([t2("dovetail.only_support_one_yaml")]);
|
|
23309
|
+
return;
|
|
23310
|
+
}
|
|
23311
|
+
}
|
|
23312
|
+
}
|
|
23158
23313
|
},
|
|
23159
23314
|
onKeyUp,
|
|
23160
23315
|
onValuesChange,
|
|
@@ -23376,7 +23531,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23376
23531
|
formResult: refineFormResult.formResult,
|
|
23377
23532
|
config,
|
|
23378
23533
|
errorMsg: refineFormResult.responseErrorMsg,
|
|
23379
|
-
|
|
23534
|
+
resourceId: id
|
|
23380
23535
|
});
|
|
23381
23536
|
})();
|
|
23382
23537
|
const saveButtonProps = isYamlForm ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
|
|
@@ -23459,7 +23614,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23459
23614
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
|
|
23460
23615
|
config,
|
|
23461
23616
|
formResult,
|
|
23462
|
-
|
|
23617
|
+
resourceId: id
|
|
23463
23618
|
}), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
|
|
23464
23619
|
...saveButtonProps,
|
|
23465
23620
|
onClick,
|
|
@@ -23860,7 +24015,11 @@ var __publicField = (obj, key, value) => {
|
|
|
23860
24015
|
title: i18n2.t("dovetail.name"),
|
|
23861
24016
|
sortable: true,
|
|
23862
24017
|
width: 200,
|
|
23863
|
-
sorter: CommonSorter(dataIndex)
|
|
24018
|
+
sorter: CommonSorter(dataIndex),
|
|
24019
|
+
render: (v) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
|
|
24020
|
+
content: v,
|
|
24021
|
+
tooltip: v
|
|
24022
|
+
})
|
|
23864
24023
|
};
|
|
23865
24024
|
};
|
|
23866
24025
|
const NameSpaceColumnRenderer = (i18n2) => {
|
|
@@ -23992,7 +24151,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23992
24151
|
};
|
|
23993
24152
|
};
|
|
23994
24153
|
const CompletionsCountColumnRenderer = (i18n2) => {
|
|
23995
|
-
const dataIndex = ["
|
|
24154
|
+
const dataIndex = ["succeeded"];
|
|
23996
24155
|
return {
|
|
23997
24156
|
key: "completions",
|
|
23998
24157
|
display: true,
|
|
@@ -24007,7 +24166,12 @@ var __publicField = (obj, key, value) => {
|
|
|
24007
24166
|
sortable: true,
|
|
24008
24167
|
width: 120,
|
|
24009
24168
|
align: "right",
|
|
24010
|
-
sorter: CommonSorter(dataIndex)
|
|
24169
|
+
sorter: CommonSorter(dataIndex),
|
|
24170
|
+
render: (_, record) => {
|
|
24171
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
24172
|
+
children: record.completionsDisplay
|
|
24173
|
+
});
|
|
24174
|
+
}
|
|
24011
24175
|
};
|
|
24012
24176
|
};
|
|
24013
24177
|
const DurationColumnRenderer = (i18n2) => {
|