Skip to content

Commit

Permalink
[INLONG-10591][Dashboard] Audit item query ignores case (apache#10596)
Browse files Browse the repository at this point in the history
  • Loading branch information
wohainilaodou committed Jul 10, 2024
1 parent d303033 commit 903a4e9
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 30 deletions.
23 changes: 17 additions & 6 deletions inlong-dashboard/src/ui/pages/GroupDetail/Audit/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,25 @@ export const getFormContent = (inlongGroupId, initialValues, onSearch, onDataStr
return request('/audit/getAuditBases');
},
requestParams: {
formatResult: result =>
result?.map(item => ({
label: item.nameInChinese,
value: item.auditId,
})) || [],
formatResult: result => {
return result?.reduce((accumulator, item) => {
const existingItem = accumulator.find(
(i: { value: any }) => i.value === item.auditId,
);
if (!existingItem) {
accumulator.push({
label: i18n?.language === 'cn' ? item.nameInChinese : item.nameInEnglish,
value: item.auditId,
});
}
return accumulator;
}, []);
},
},
},
filterOption: (keyword, option) => option.label.includes(keyword),
filterOption: (keyword: string, option: { label: any }) => {
return (option?.label ?? '').toLowerCase().includes(keyword.toLowerCase());
},
},
},
{
Expand Down
44 changes: 32 additions & 12 deletions inlong-dashboard/src/ui/pages/ModuleAudit/IdModule/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,24 @@ export const getFormContent = (initialValues, onSearch) => [
return request('/audit/getAuditBases');
},
requestParams: {
formatResult: result =>
result?.map(item => ({
label: item.nameInChinese,
value: item.auditId,
})) || [],
formatResult: (result: any[]) => {
return result?.reduce((accumulator, item) => {
const existingItem = accumulator.find(
(i: { value: any }) => i.value === item.auditId,
);
if (!existingItem) {
accumulator.push({
label: i18n?.language === 'cn' ? item.nameInChinese : item.nameInEnglish,
value: item.auditId,
});
}
return accumulator;
}, []);
},
},
},
filterOption: (keyword, option) => option.label.includes(keyword),
filterOption: (keyword: string, option: { label: any }) =>
(option?.label ?? '').toLowerCase().includes(keyword.toLowerCase()),
},
},
{
Expand All @@ -170,14 +180,24 @@ export const getFormContent = (initialValues, onSearch) => [
return request('/audit/getAuditBases');
},
requestParams: {
formatResult: result =>
result?.map(item => ({
label: item.nameInChinese,
value: item.auditId,
})) || [],
formatResult: (result: any[]) => {
return result?.reduce((accumulator, item) => {
const existingItem = accumulator.find(
(i: { value: any }) => i.value === item.auditId,
);
if (!existingItem) {
accumulator.push({
label: i18n?.language === 'cn' ? item.nameInChinese : item.nameInEnglish,
value: item.auditId,
});
}
return accumulator;
}, []);
},
},
},
filterOption: (keyword, option) => option.label.includes(keyword),
filterOption: (keyword: string, option: { label: any }) =>
(option?.label ?? '').toLowerCase().includes(keyword.toLowerCase()),
},
},
{
Expand Down
44 changes: 32 additions & 12 deletions inlong-dashboard/src/ui/pages/ModuleAudit/IpModule/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,24 @@ export const getFormContent = (initialValues, onSearch) => [
return request('/audit/getAuditBases');
},
requestParams: {
formatResult: result =>
result?.map(item => ({
label: item.nameInChinese,
value: item.auditId,
})) || [],
formatResult: (result: any[]) => {
return result?.reduce((accumulator, item) => {
const existingItem = accumulator.find(
(i: { value: any }) => i.value === item.auditId,
);
if (!existingItem) {
accumulator.push({
label: i18n?.language === 'cn' ? item.nameInChinese : item.nameInEnglish,
value: item.auditId,
});
}
return accumulator;
}, []);
},
},
},
filterOption: (keyword, option) => option.label.includes(keyword),
filterOption: (keyword: any, option: { label: any }) =>
(option?.label ?? '').toLowerCase().includes(keyword.toLowerCase()),
},
},
{
Expand All @@ -124,14 +134,24 @@ export const getFormContent = (initialValues, onSearch) => [
return request('/audit/getAuditBases');
},
requestParams: {
formatResult: result =>
result?.map(item => ({
label: item.nameInChinese,
value: item.auditId,
})) || [],
formatResult: (result: any[]) => {
return result?.reduce((accumulator, item) => {
const existingItem = accumulator.find(
(i: { value: any }) => i.value === item.auditId,
);
if (!existingItem) {
accumulator.push({
label: i18n?.language === 'cn' ? item.nameInChinese : item.nameInEnglish,
value: item.auditId,
});
}
return accumulator;
}, []);
},
},
},
filterOption: (keyword, option) => option.label.includes(keyword),
filterOption: (keyword: string, option: { label: any }) =>
(option?.label ?? '').toLowerCase().includes(keyword.toLowerCase()),
},
},
{
Expand Down

0 comments on commit 903a4e9

Please sign in to comment.