Skip to content

Commit 07f2bf7

Browse files
committed
Was implemented Event list for job, run and fleet
1 parent baa7497 commit 07f2bf7

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

frontend/src/pages/Events/List/hooks/useFilters.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ const multipleChoiseKeys: RequestParamsKeys[] = [
5454
'actors',
5555
];
5656

57-
const targetTypes = ['project', 'user', 'fleet', 'instance', 'run', 'job'];
57+
const targetTypes = [
58+
{ label: 'Project', value: 'project' },
59+
{ label: 'User', value: 'user' },
60+
{ label: 'Fleet', value: 'fleet' },
61+
{ label: 'Instance', value: 'instance' },
62+
{ label: 'Run', value: 'run' },
63+
{ label: 'Job', value: 'job' },
64+
];
5865

5966
export const useFilters = () => {
6067
const [searchParams, setSearchParams] = useSearchParams();
@@ -100,7 +107,7 @@ export const useFilters = () => {
100107
targetTypes?.forEach((targetType) => {
101108
options.push({
102109
propertyKey: filterKeys.INCLUDE_TARGET_TYPES,
103-
value: targetType,
110+
value: targetType.label,
104111
});
105112
});
106113

@@ -240,6 +247,14 @@ export const useFilters = () => {
240247
),
241248
}
242249
: {}),
250+
251+
...(params[filterKeys.INCLUDE_TARGET_TYPES] && Array.isArray(params[filterKeys.INCLUDE_TARGET_TYPES])
252+
? {
253+
[filterKeys.INCLUDE_TARGET_TYPES]: params[filterKeys.INCLUDE_TARGET_TYPES]?.map(
254+
(selectedLabel: string) => targetTypes?.find(({ label }) => label === selectedLabel)?.['value'],
255+
),
256+
}
257+
: {}),
243258
};
244259

245260
return {

0 commit comments

Comments
 (0)