@dovetail-v2/refine 0.3.13-alpha.0 → 0.3.13-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/components/InternalBaseTable/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useRefineFilters.d.ts +9 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/locales/zh-CN/index.d.ts +2 -0
- package/dist/refine.cjs +98 -30
- package/dist/refine.js +98 -30
- package/dist/types/resource.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const NAME_KEYWORD_PARAM = "name_keyword";
|
|
2
|
+
interface UseRefineFiltersOptions {
|
|
3
|
+
disableNamespaceFilter?: boolean;
|
|
4
|
+
disableNameKeywordFilter?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function useRefineFilters(options?: UseRefineFiltersOptions): {
|
|
7
|
+
permanent: import("@refinedev/core").CrudFilter[];
|
|
8
|
+
};
|
|
9
|
+
export {};
|
package/dist/i18n.d.ts
CHANGED
package/dist/refine.cjs
CHANGED
|
@@ -1225,6 +1225,8 @@ const label_annotations = "标签与注解";
|
|
|
1225
1225
|
const target_service = "目标服务";
|
|
1226
1226
|
const target_service_port = "目标服务端口";
|
|
1227
1227
|
const select_workload = "选择工作负载";
|
|
1228
|
+
const no_search_result = "无搜索结果";
|
|
1229
|
+
const clear_search_condition = "清空搜索条件";
|
|
1228
1230
|
const dovetail = {
|
|
1229
1231
|
copy,
|
|
1230
1232
|
reset_arguments,
|
|
@@ -1493,7 +1495,9 @@ const dovetail = {
|
|
|
1493
1495
|
label_annotations,
|
|
1494
1496
|
target_service,
|
|
1495
1497
|
target_service_port,
|
|
1496
|
-
select_workload
|
|
1498
|
+
select_workload,
|
|
1499
|
+
no_search_result,
|
|
1500
|
+
clear_search_condition
|
|
1497
1501
|
};
|
|
1498
1502
|
const ZH = {
|
|
1499
1503
|
dovetail
|
|
@@ -7995,7 +7999,7 @@ const WidgetErrorContent = (props) => {
|
|
|
7995
7999
|
children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("p", {
|
|
7996
8000
|
className: common.cx_default(fontMap[type2], "title", `${type2}-title`),
|
|
7997
8001
|
children: errorText || t2("dovetail.obtain_data_error")
|
|
7998
|
-
}), !refetch ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(kit.button, {
|
|
8002
|
+
}), props.children, !refetch ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(kit.button, {
|
|
7999
8003
|
size: type2 === "list" ? "middle" : "small",
|
|
8000
8004
|
type: "ordinary",
|
|
8001
8005
|
onClick: (e2) => {
|
|
@@ -10659,6 +10663,9 @@ function validateLabelKey(key2) {
|
|
|
10659
10663
|
if (prefix2 && prefix2.length > 253) {
|
|
10660
10664
|
return { isValid: false };
|
|
10661
10665
|
}
|
|
10666
|
+
if (!labelRegex.test(name2)) {
|
|
10667
|
+
return { isValid: false };
|
|
10668
|
+
}
|
|
10662
10669
|
if (name2 && name2.length > 63) {
|
|
10663
10670
|
return { isValid: false };
|
|
10664
10671
|
}
|
|
@@ -10977,7 +10984,6 @@ const TableToolBar = ({
|
|
|
10977
10984
|
selectedKeys,
|
|
10978
10985
|
hideCreate
|
|
10979
10986
|
}) => {
|
|
10980
|
-
var _a;
|
|
10981
10987
|
const {
|
|
10982
10988
|
resource
|
|
10983
10989
|
} = core.useResource();
|
|
@@ -10987,7 +10993,7 @@ const TableToolBar = ({
|
|
|
10987
10993
|
className: ToolbarStyle$1,
|
|
10988
10994
|
children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
|
|
10989
10995
|
className: common.cx_default(eagle.Typo.Display.d2_regular_title, TitleStyle$2),
|
|
10990
|
-
children: title
|
|
10996
|
+
children: title
|
|
10991
10997
|
}), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
|
|
10992
10998
|
children: [selectedKeys.length > 0 ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(DeleteManyButton, {
|
|
10993
10999
|
ids: selectedKeys
|
|
@@ -12071,9 +12077,18 @@ function Table(props) {
|
|
|
12071
12077
|
const { tableProps, displayName, errorContentProps } = props;
|
|
12072
12078
|
const { Table: TableComponent } = React.useContext(ComponentContext);
|
|
12073
12079
|
const Table2 = TableComponent || Table$1;
|
|
12080
|
+
const { params } = core.useParsed();
|
|
12074
12081
|
const { i18n: i18n2 } = common.useTranslation();
|
|
12075
12082
|
const resourceType = transformResourceKindInSentence(displayName, i18n2.language);
|
|
12076
12083
|
if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
|
|
12084
|
+
const nameKeyword = (params == null ? void 0 : params[NAME_KEYWORD_PARAM]) || "";
|
|
12085
|
+
if (nameKeyword) {
|
|
12086
|
+
const onClear = () => {
|
|
12087
|
+
var _a2;
|
|
12088
|
+
(_a2 = tableProps.onClearSearchKeyword) == null ? void 0 : _a2.call(tableProps);
|
|
12089
|
+
};
|
|
12090
|
+
return /* @__PURE__ */ common.jsxRuntimeExports.jsx(WidgetErrorContent, { errorText: i18n2.t("dovetail.no_search_result"), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, { onClick: onClear, type: "ordinary", children: i18n2.t("dovetail.clear_search_condition") }) });
|
|
12091
|
+
}
|
|
12077
12092
|
return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
|
|
12078
12093
|
WidgetErrorContent,
|
|
12079
12094
|
{
|
|
@@ -14427,30 +14442,6 @@ const NamespacesFilter = ({
|
|
|
14427
14442
|
})
|
|
14428
14443
|
});
|
|
14429
14444
|
};
|
|
14430
|
-
function useNamespaceRefineFilter() {
|
|
14431
|
-
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
14432
|
-
const filters = React.useMemo(() => {
|
|
14433
|
-
const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
|
|
14434
|
-
if (filters2.length === 0) {
|
|
14435
|
-
return {
|
|
14436
|
-
permanent: []
|
|
14437
|
-
};
|
|
14438
|
-
}
|
|
14439
|
-
return {
|
|
14440
|
-
permanent: [
|
|
14441
|
-
{
|
|
14442
|
-
operator: "or",
|
|
14443
|
-
value: filters2.map((filter) => ({
|
|
14444
|
-
field: "metadata.namespace",
|
|
14445
|
-
operator: "eq",
|
|
14446
|
-
value: filter
|
|
14447
|
-
}))
|
|
14448
|
-
}
|
|
14449
|
-
]
|
|
14450
|
-
};
|
|
14451
|
-
}, [nsFilters]);
|
|
14452
|
-
return filters;
|
|
14453
|
-
}
|
|
14454
14445
|
const index_1l2xllo = "";
|
|
14455
14446
|
const ListPageStyle = "laykzsq";
|
|
14456
14447
|
const ListContentStyle = "l1ng0psc";
|
|
@@ -14473,7 +14464,7 @@ function ListPage(props) {
|
|
|
14473
14464
|
children: [!config.hideListToolBar ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, {
|
|
14474
14465
|
children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(TableToolBar, {
|
|
14475
14466
|
selectedKeys,
|
|
14476
|
-
title: config == null ? void 0 : config.displayName,
|
|
14467
|
+
title: (config == null ? void 0 : config.customListTitle) || (config == null ? void 0 : config.displayName) || config.kind,
|
|
14477
14468
|
description: config == null ? void 0 : config.description,
|
|
14478
14469
|
hideCreate: config == null ? void 0 : config.hideCreate
|
|
14479
14470
|
}), belowToolBarContent, /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Divider, {
|
|
@@ -14510,7 +14501,7 @@ function ResourceList(props) {
|
|
|
14510
14501
|
const { formatter, columns, Dropdown, noShow } = props.config;
|
|
14511
14502
|
const { i18n: i18n2 } = common.useTranslation();
|
|
14512
14503
|
const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
|
|
14513
|
-
const filters =
|
|
14504
|
+
const filters = useRefineFilters();
|
|
14514
14505
|
const { tableProps, selectedKeys } = useEagleTable({
|
|
14515
14506
|
useTableParams: {
|
|
14516
14507
|
filters
|
|
@@ -19537,6 +19528,78 @@ const SCAllowExpandColumnRenderer = (i18n2) => {
|
|
|
19537
19528
|
}
|
|
19538
19529
|
};
|
|
19539
19530
|
};
|
|
19531
|
+
function useNamespaceRefineFilter() {
|
|
19532
|
+
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
19533
|
+
const filters = React.useMemo(() => {
|
|
19534
|
+
const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
|
|
19535
|
+
if (filters2.length === 0) {
|
|
19536
|
+
return {
|
|
19537
|
+
permanent: []
|
|
19538
|
+
};
|
|
19539
|
+
}
|
|
19540
|
+
return {
|
|
19541
|
+
permanent: [
|
|
19542
|
+
{
|
|
19543
|
+
operator: "or",
|
|
19544
|
+
value: filters2.map((filter) => ({
|
|
19545
|
+
field: "metadata.namespace",
|
|
19546
|
+
operator: "eq",
|
|
19547
|
+
value: filter
|
|
19548
|
+
}))
|
|
19549
|
+
}
|
|
19550
|
+
]
|
|
19551
|
+
};
|
|
19552
|
+
}, [nsFilters]);
|
|
19553
|
+
return filters;
|
|
19554
|
+
}
|
|
19555
|
+
const NAME_KEYWORD_PARAM = "name_keyword";
|
|
19556
|
+
function useRefineFilters(options = {}) {
|
|
19557
|
+
const {
|
|
19558
|
+
disableNamespaceFilter = false,
|
|
19559
|
+
disableNameKeywordFilter = false
|
|
19560
|
+
} = options;
|
|
19561
|
+
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
19562
|
+
const namespaceFilters = React.useMemo(() => {
|
|
19563
|
+
if (disableNamespaceFilter) {
|
|
19564
|
+
return [];
|
|
19565
|
+
}
|
|
19566
|
+
const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
|
|
19567
|
+
if (filters2.length === 0) {
|
|
19568
|
+
return [];
|
|
19569
|
+
}
|
|
19570
|
+
return [
|
|
19571
|
+
{
|
|
19572
|
+
operator: "or",
|
|
19573
|
+
value: filters2.map((filter) => ({
|
|
19574
|
+
field: "metadata.namespace",
|
|
19575
|
+
operator: "eq",
|
|
19576
|
+
value: filter
|
|
19577
|
+
}))
|
|
19578
|
+
}
|
|
19579
|
+
];
|
|
19580
|
+
}, [nsFilters, disableNamespaceFilter]);
|
|
19581
|
+
const { params } = core.useParsed();
|
|
19582
|
+
const nameKeyword = params == null ? void 0 : params[NAME_KEYWORD_PARAM];
|
|
19583
|
+
const nameKeywordFilters = React.useMemo(() => {
|
|
19584
|
+
if (disableNameKeywordFilter || !nameKeyword || nameKeyword.trim() === "") {
|
|
19585
|
+
return [];
|
|
19586
|
+
}
|
|
19587
|
+
return [
|
|
19588
|
+
{
|
|
19589
|
+
field: "metadata.name",
|
|
19590
|
+
operator: "contains",
|
|
19591
|
+
value: nameKeyword.trim()
|
|
19592
|
+
}
|
|
19593
|
+
];
|
|
19594
|
+
}, [nameKeyword, disableNameKeywordFilter]);
|
|
19595
|
+
const filters = React.useMemo(
|
|
19596
|
+
() => ({
|
|
19597
|
+
permanent: [...namespaceFilters, ...nameKeywordFilters]
|
|
19598
|
+
}),
|
|
19599
|
+
[namespaceFilters, nameKeywordFilters]
|
|
19600
|
+
);
|
|
19601
|
+
return filters;
|
|
19602
|
+
}
|
|
19540
19603
|
const styles = "";
|
|
19541
19604
|
const Dovetail = (props) => {
|
|
19542
19605
|
const {
|
|
@@ -19868,6 +19931,7 @@ exports.MetadataForm = MetadataForm;
|
|
|
19868
19931
|
exports.ModelPlugin = ModelPlugin;
|
|
19869
19932
|
exports.MonacoYamlDiffEditor = MonacoYamlDiffEditor;
|
|
19870
19933
|
exports.MonacoYamlEditor = MonacoYamlEditor;
|
|
19934
|
+
exports.NAME_KEYWORD_PARAM = NAME_KEYWORD_PARAM;
|
|
19871
19935
|
exports.NETWORK_POLICY_INIT_VALUE = NETWORK_POLICY_INIT_VALUE;
|
|
19872
19936
|
exports.NODE_INIT_VALUE = NODE_INIT_VALUE;
|
|
19873
19937
|
exports.NS_STORE_KEY = NS_STORE_KEY;
|
|
@@ -20035,6 +20099,7 @@ exports.generateSchemaTypeValue = generateSchemaTypeValue;
|
|
|
20035
20099
|
exports.generateValueFromSchema = generateValueFromSchema;
|
|
20036
20100
|
exports.getApiVersion = getApiVersion;
|
|
20037
20101
|
exports.getResourceNameByKind = getResourceNameByKind;
|
|
20102
|
+
exports.isFirstLetterEnglish = isFirstLetterEnglish;
|
|
20038
20103
|
exports.matchSelector = matchSelector;
|
|
20039
20104
|
exports.modelPlugin = modelPlugin;
|
|
20040
20105
|
exports.namespaceRules = namespaceRules;
|
|
@@ -20045,6 +20110,8 @@ exports.resolveRef = resolveRef;
|
|
|
20045
20110
|
exports.rfc1035LabelRules = rfc1035LabelRules;
|
|
20046
20111
|
exports.rfc1123LabelRules = rfc1123LabelRules;
|
|
20047
20112
|
exports.routerProvider = routerProvider;
|
|
20113
|
+
exports.shortenedImage = shortenedImage;
|
|
20114
|
+
exports.transformResourceKindInSentence = transformResourceKindInSentence;
|
|
20048
20115
|
exports.useApiGroupSchema = useApiGroupSchema;
|
|
20049
20116
|
exports.useDeleteModal = useDeleteModal;
|
|
20050
20117
|
exports.useDeleteModalOnly = useDeleteModalOnly;
|
|
@@ -20056,6 +20123,7 @@ exports.useGlobalStore = useGlobalStore;
|
|
|
20056
20123
|
exports.useNamespaceRefineFilter = useNamespaceRefineFilter;
|
|
20057
20124
|
exports.useNamespacesFilter = useNamespacesFilter;
|
|
20058
20125
|
exports.useOpenForm = useOpenForm;
|
|
20126
|
+
exports.useRefineFilters = useRefineFilters;
|
|
20059
20127
|
exports.useRefineForm = useRefineForm;
|
|
20060
20128
|
exports.useSchema = useSchema;
|
|
20061
20129
|
exports.validateDataKey = validateDataKey;
|
package/dist/refine.js
CHANGED
|
@@ -1206,6 +1206,8 @@ const label_annotations = "标签与注解";
|
|
|
1206
1206
|
const target_service = "目标服务";
|
|
1207
1207
|
const target_service_port = "目标服务端口";
|
|
1208
1208
|
const select_workload = "选择工作负载";
|
|
1209
|
+
const no_search_result = "无搜索结果";
|
|
1210
|
+
const clear_search_condition = "清空搜索条件";
|
|
1209
1211
|
const dovetail = {
|
|
1210
1212
|
copy,
|
|
1211
1213
|
reset_arguments,
|
|
@@ -1474,7 +1476,9 @@ const dovetail = {
|
|
|
1474
1476
|
label_annotations,
|
|
1475
1477
|
target_service,
|
|
1476
1478
|
target_service_port,
|
|
1477
|
-
select_workload
|
|
1479
|
+
select_workload,
|
|
1480
|
+
no_search_result,
|
|
1481
|
+
clear_search_condition
|
|
1478
1482
|
};
|
|
1479
1483
|
const ZH = {
|
|
1480
1484
|
dovetail
|
|
@@ -7976,7 +7980,7 @@ const WidgetErrorContent = (props) => {
|
|
|
7976
7980
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
|
|
7977
7981
|
className: cx_default(fontMap[type2], "title", `${type2}-title`),
|
|
7978
7982
|
children: errorText || t2("dovetail.obtain_data_error")
|
|
7979
|
-
}), !refetch ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
|
|
7983
|
+
}), props.children, !refetch ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
|
|
7980
7984
|
size: type2 === "list" ? "middle" : "small",
|
|
7981
7985
|
type: "ordinary",
|
|
7982
7986
|
onClick: (e2) => {
|
|
@@ -10640,6 +10644,9 @@ function validateLabelKey(key2) {
|
|
|
10640
10644
|
if (prefix2 && prefix2.length > 253) {
|
|
10641
10645
|
return { isValid: false };
|
|
10642
10646
|
}
|
|
10647
|
+
if (!labelRegex.test(name2)) {
|
|
10648
|
+
return { isValid: false };
|
|
10649
|
+
}
|
|
10643
10650
|
if (name2 && name2.length > 63) {
|
|
10644
10651
|
return { isValid: false };
|
|
10645
10652
|
}
|
|
@@ -10958,7 +10965,6 @@ const TableToolBar = ({
|
|
|
10958
10965
|
selectedKeys,
|
|
10959
10966
|
hideCreate
|
|
10960
10967
|
}) => {
|
|
10961
|
-
var _a;
|
|
10962
10968
|
const {
|
|
10963
10969
|
resource
|
|
10964
10970
|
} = useResource();
|
|
@@ -10968,7 +10974,7 @@ const TableToolBar = ({
|
|
|
10968
10974
|
className: ToolbarStyle$1,
|
|
10969
10975
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
10970
10976
|
className: cx_default(Typo.Display.d2_regular_title, TitleStyle$2),
|
|
10971
|
-
children: title
|
|
10977
|
+
children: title
|
|
10972
10978
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
|
|
10973
10979
|
children: [selectedKeys.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteManyButton, {
|
|
10974
10980
|
ids: selectedKeys
|
|
@@ -12052,9 +12058,18 @@ function Table(props) {
|
|
|
12052
12058
|
const { tableProps, displayName, errorContentProps } = props;
|
|
12053
12059
|
const { Table: TableComponent } = useContext(ComponentContext);
|
|
12054
12060
|
const Table2 = TableComponent || Table$1;
|
|
12061
|
+
const { params } = useParsed();
|
|
12055
12062
|
const { i18n: i18n2 } = useTranslation();
|
|
12056
12063
|
const resourceType = transformResourceKindInSentence(displayName, i18n2.language);
|
|
12057
12064
|
if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
|
|
12065
|
+
const nameKeyword = (params == null ? void 0 : params[NAME_KEYWORD_PARAM]) || "";
|
|
12066
|
+
if (nameKeyword) {
|
|
12067
|
+
const onClear = () => {
|
|
12068
|
+
var _a2;
|
|
12069
|
+
(_a2 = tableProps.onClearSearchKeyword) == null ? void 0 : _a2.call(tableProps);
|
|
12070
|
+
};
|
|
12071
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, { errorText: i18n2.t("dovetail.no_search_result"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: onClear, type: "ordinary", children: i18n2.t("dovetail.clear_search_condition") }) });
|
|
12072
|
+
}
|
|
12058
12073
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12059
12074
|
WidgetErrorContent,
|
|
12060
12075
|
{
|
|
@@ -14408,30 +14423,6 @@ const NamespacesFilter = ({
|
|
|
14408
14423
|
})
|
|
14409
14424
|
});
|
|
14410
14425
|
};
|
|
14411
|
-
function useNamespaceRefineFilter() {
|
|
14412
|
-
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
14413
|
-
const filters = useMemo(() => {
|
|
14414
|
-
const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
|
|
14415
|
-
if (filters2.length === 0) {
|
|
14416
|
-
return {
|
|
14417
|
-
permanent: []
|
|
14418
|
-
};
|
|
14419
|
-
}
|
|
14420
|
-
return {
|
|
14421
|
-
permanent: [
|
|
14422
|
-
{
|
|
14423
|
-
operator: "or",
|
|
14424
|
-
value: filters2.map((filter) => ({
|
|
14425
|
-
field: "metadata.namespace",
|
|
14426
|
-
operator: "eq",
|
|
14427
|
-
value: filter
|
|
14428
|
-
}))
|
|
14429
|
-
}
|
|
14430
|
-
]
|
|
14431
|
-
};
|
|
14432
|
-
}, [nsFilters]);
|
|
14433
|
-
return filters;
|
|
14434
|
-
}
|
|
14435
14426
|
const index_1l2xllo = "";
|
|
14436
14427
|
const ListPageStyle = "laykzsq";
|
|
14437
14428
|
const ListContentStyle = "l1ng0psc";
|
|
@@ -14454,7 +14445,7 @@ function ListPage(props) {
|
|
|
14454
14445
|
children: [!config.hideListToolBar ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
14455
14446
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(TableToolBar, {
|
|
14456
14447
|
selectedKeys,
|
|
14457
|
-
title: config == null ? void 0 : config.displayName,
|
|
14448
|
+
title: (config == null ? void 0 : config.customListTitle) || (config == null ? void 0 : config.displayName) || config.kind,
|
|
14458
14449
|
description: config == null ? void 0 : config.description,
|
|
14459
14450
|
hideCreate: config == null ? void 0 : config.hideCreate
|
|
14460
14451
|
}), belowToolBarContent, /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {
|
|
@@ -14491,7 +14482,7 @@ function ResourceList(props) {
|
|
|
14491
14482
|
const { formatter, columns, Dropdown: Dropdown2, noShow } = props.config;
|
|
14492
14483
|
const { i18n: i18n2 } = useTranslation();
|
|
14493
14484
|
const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
|
|
14494
|
-
const filters =
|
|
14485
|
+
const filters = useRefineFilters();
|
|
14495
14486
|
const { tableProps, selectedKeys } = useEagleTable({
|
|
14496
14487
|
useTableParams: {
|
|
14497
14488
|
filters
|
|
@@ -19518,6 +19509,78 @@ const SCAllowExpandColumnRenderer = (i18n2) => {
|
|
|
19518
19509
|
}
|
|
19519
19510
|
};
|
|
19520
19511
|
};
|
|
19512
|
+
function useNamespaceRefineFilter() {
|
|
19513
|
+
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
19514
|
+
const filters = useMemo(() => {
|
|
19515
|
+
const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
|
|
19516
|
+
if (filters2.length === 0) {
|
|
19517
|
+
return {
|
|
19518
|
+
permanent: []
|
|
19519
|
+
};
|
|
19520
|
+
}
|
|
19521
|
+
return {
|
|
19522
|
+
permanent: [
|
|
19523
|
+
{
|
|
19524
|
+
operator: "or",
|
|
19525
|
+
value: filters2.map((filter) => ({
|
|
19526
|
+
field: "metadata.namespace",
|
|
19527
|
+
operator: "eq",
|
|
19528
|
+
value: filter
|
|
19529
|
+
}))
|
|
19530
|
+
}
|
|
19531
|
+
]
|
|
19532
|
+
};
|
|
19533
|
+
}, [nsFilters]);
|
|
19534
|
+
return filters;
|
|
19535
|
+
}
|
|
19536
|
+
const NAME_KEYWORD_PARAM = "name_keyword";
|
|
19537
|
+
function useRefineFilters(options = {}) {
|
|
19538
|
+
const {
|
|
19539
|
+
disableNamespaceFilter = false,
|
|
19540
|
+
disableNameKeywordFilter = false
|
|
19541
|
+
} = options;
|
|
19542
|
+
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
19543
|
+
const namespaceFilters = useMemo(() => {
|
|
19544
|
+
if (disableNamespaceFilter) {
|
|
19545
|
+
return [];
|
|
19546
|
+
}
|
|
19547
|
+
const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
|
|
19548
|
+
if (filters2.length === 0) {
|
|
19549
|
+
return [];
|
|
19550
|
+
}
|
|
19551
|
+
return [
|
|
19552
|
+
{
|
|
19553
|
+
operator: "or",
|
|
19554
|
+
value: filters2.map((filter) => ({
|
|
19555
|
+
field: "metadata.namespace",
|
|
19556
|
+
operator: "eq",
|
|
19557
|
+
value: filter
|
|
19558
|
+
}))
|
|
19559
|
+
}
|
|
19560
|
+
];
|
|
19561
|
+
}, [nsFilters, disableNamespaceFilter]);
|
|
19562
|
+
const { params } = useParsed();
|
|
19563
|
+
const nameKeyword = params == null ? void 0 : params[NAME_KEYWORD_PARAM];
|
|
19564
|
+
const nameKeywordFilters = useMemo(() => {
|
|
19565
|
+
if (disableNameKeywordFilter || !nameKeyword || nameKeyword.trim() === "") {
|
|
19566
|
+
return [];
|
|
19567
|
+
}
|
|
19568
|
+
return [
|
|
19569
|
+
{
|
|
19570
|
+
field: "metadata.name",
|
|
19571
|
+
operator: "contains",
|
|
19572
|
+
value: nameKeyword.trim()
|
|
19573
|
+
}
|
|
19574
|
+
];
|
|
19575
|
+
}, [nameKeyword, disableNameKeywordFilter]);
|
|
19576
|
+
const filters = useMemo(
|
|
19577
|
+
() => ({
|
|
19578
|
+
permanent: [...namespaceFilters, ...nameKeywordFilters]
|
|
19579
|
+
}),
|
|
19580
|
+
[namespaceFilters, nameKeywordFilters]
|
|
19581
|
+
);
|
|
19582
|
+
return filters;
|
|
19583
|
+
}
|
|
19521
19584
|
const styles = "";
|
|
19522
19585
|
const Dovetail = (props) => {
|
|
19523
19586
|
const {
|
|
@@ -19850,6 +19913,7 @@ export {
|
|
|
19850
19913
|
ModelPlugin,
|
|
19851
19914
|
MonacoYamlDiffEditor,
|
|
19852
19915
|
MonacoYamlEditor,
|
|
19916
|
+
NAME_KEYWORD_PARAM,
|
|
19853
19917
|
NETWORK_POLICY_INIT_VALUE,
|
|
19854
19918
|
NODE_INIT_VALUE,
|
|
19855
19919
|
NS_STORE_KEY,
|
|
@@ -20017,6 +20081,7 @@ export {
|
|
|
20017
20081
|
generateValueFromSchema,
|
|
20018
20082
|
getApiVersion,
|
|
20019
20083
|
getResourceNameByKind,
|
|
20084
|
+
isFirstLetterEnglish,
|
|
20020
20085
|
matchSelector,
|
|
20021
20086
|
modelPlugin,
|
|
20022
20087
|
namespaceRules,
|
|
@@ -20027,6 +20092,8 @@ export {
|
|
|
20027
20092
|
rfc1035LabelRules,
|
|
20028
20093
|
rfc1123LabelRules,
|
|
20029
20094
|
routerProvider,
|
|
20095
|
+
shortenedImage,
|
|
20096
|
+
transformResourceKindInSentence,
|
|
20030
20097
|
useApiGroupSchema,
|
|
20031
20098
|
useDeleteModal,
|
|
20032
20099
|
useDeleteModalOnly,
|
|
@@ -20038,6 +20105,7 @@ export {
|
|
|
20038
20105
|
useNamespaceRefineFilter,
|
|
20039
20106
|
useNamespacesFilter,
|
|
20040
20107
|
useOpenForm,
|
|
20108
|
+
useRefineFilters,
|
|
20041
20109
|
useRefineForm,
|
|
20042
20110
|
useSchema,
|
|
20043
20111
|
validateDataKey,
|
package/dist/types/resource.d.ts
CHANGED
|
@@ -174,6 +174,8 @@ export type ResourceConfig<Model extends ResourceModel = ResourceModel> = {
|
|
|
174
174
|
hideCreate?: boolean;
|
|
175
175
|
/** 资源的描述信息 */
|
|
176
176
|
description?: React.ReactNode;
|
|
177
|
+
/** 自定义资源列表标题 */
|
|
178
|
+
customListTitle?: string;
|
|
177
179
|
/** 父级资源名称,用于建立资源层级关系。在 Dovetail2 中用不到这个 */
|
|
178
180
|
parent?: string;
|
|
179
181
|
/** 格式化数据参数,目前暂未完全实现,可能会删除 */
|
package/dist/utils/index.d.ts
CHANGED