Skip to content

Commit 9e5fc1d

Browse files
committed
frontend: improve filter table
Signed-off-by: farodin91 <github@jan-jansen.net>
1 parent 82fad67 commit 9e5fc1d

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

frontend/src/components/common/Resource/ResourceTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ function ResourceTableContent<RowItem extends KubeObject>(props: ResourceTablePr
416416
id: 'namespace',
417417
header: t('glossary|Namespace'),
418418
gridTemplate: 'auto',
419-
accessorFn: (item: RowItem) => item.getNamespace() ?? '',
419+
accessorFn: (item: RowItem) => item.getNamespace() ?? '(cluster-wide)',
420420
filterVariant: 'multi-select',
421421
Cell: ({ row }: { row: MRT_Row<RowItem> }) =>
422422
row.original?.getNamespace() ? (

frontend/src/components/job/List.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ import ResourceListView from '../common/Resource/ResourceListView';
2929
import { SimpleTableProps } from '../common/SimpleTable';
3030
import LightTooltip from '../common/Tooltip/TooltipLight';
3131

32+
export function makeJobStatusValue(job: Job) {
33+
if (!job?.status?.conditions) {
34+
return 'Unknown';
35+
}
36+
const conditionOptions = ['Failed', 'Complete', 'Suspended'];
37+
38+
const condition = job.status.conditions.find(
39+
({ status, type }: { status: string; type: string }) =>
40+
conditionOptions.includes(type) && status === 'True'
41+
);
42+
43+
if (!condition) {
44+
return 'Unknown';
45+
}
46+
47+
return condition.type;
48+
}
49+
3250
export function makeJobStatusLabel(job: Job) {
3351
if (!job?.status?.conditions) {
3452
return null;
@@ -127,10 +145,9 @@ export function JobsListRenderer(props: JobsListRendererProps) {
127145
{
128146
id: 'conditions',
129147
label: t('translation|Conditions'),
148+
filterVariant: 'multi-select',
130149
gridTemplate: 'min-content',
131-
getValue: job =>
132-
job.status?.conditions?.find(({ status }: { status: string }) => status === 'True') ??
133-
null,
150+
getValue: job => makeJobStatusValue(job),
134151
render: job => makeJobStatusLabel(job),
135152
},
136153
{

frontend/src/components/job/__snapshots__/JobList.Items.stories.storyshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,12 @@
494494
Conditions
495495
</div>
496496
<span
497-
aria-label="Sort by Conditions descending"
497+
aria-label="Sort by Conditions ascending"
498498
class="MuiBadge-root css-1c32n2y-MuiBadge-root"
499499
data-mui-internal-clone-element="true"
500500
>
501501
<span
502-
aria-label="Sort by Conditions descending"
502+
aria-label="Sort by Conditions ascending"
503503
class="MuiButtonBase-root MuiTableSortLabel-root Mui-active css-542clt-MuiButtonBase-root-MuiTableSortLabel-root"
504504
role="button"
505505
tabindex="0"

frontend/src/components/pod/List.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export function PodListRenderer(props: PodListProps) {
237237
gridTemplate: 'min-content',
238238
filterVariant: 'multi-select',
239239
label: t('translation|Status'),
240-
getValue: pod => getPodStatus(pod) + '/' + pod.getDetailedStatus().reason,
240+
getValue: pod => pod.getDetailedStatus().reason,
241241
render: makePodStatusLabel,
242242
},
243243
...(metrics?.length

frontend/src/components/storage/VolumeList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export default function VolumeList() {
111111
{
112112
id: 'status',
113113
label: t('translation|Status'),
114+
filterVariant: 'multi-select',
114115
getValue: volume => volume.status?.phase,
115116
render: volume => makePVStatusLabel(volume),
116117
gridTemplate: 0.3,

0 commit comments

Comments
 (0)