Skip to content

Commit 965371f

Browse files
feat: align certificate filters to mockups (#10)
Signed-off-by: Carlos Feria <[email protected]>
1 parent a2ad933 commit 965371f

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

client/src/app/pages/TrustRoot/components/Certificates.tsx

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ export const CerticatesTable: React.FC<ICerticatesTableProps> = ({ certificates,
3434
items: certificates,
3535
toolbar: {
3636
categoryTitles: {
37-
search: "Search",
37+
subject: "Subject",
3838
status: "Status",
3939
},
4040
},
4141
filtering: {
4242
filterCategories: [
4343
{
44-
categoryKey: "search",
44+
categoryKey: "subject",
4545
matcher: (filterValue, item) => {
46-
return stringMatcher(filterValue, item.issuer);
46+
return stringMatcher(filterValue, item.subject);
4747
},
4848
},
4949
{
@@ -82,29 +82,33 @@ export const CerticatesTable: React.FC<ICerticatesTableProps> = ({ certificates,
8282
<>
8383
<Toolbar {...toolbarProps} aria-label="certificates toolbar">
8484
<ToolbarContent>
85-
<FilterToolbar {...filterToolbarProps}>
86-
<SearchFilterControl
87-
{...getFilterControlProps({ categoryKey: "search" })}
88-
placeholderText="Search by issuer..."
89-
/>
90-
<MultiselectFilterControl
91-
{...getFilterControlProps({ categoryKey: "status" })}
92-
selectOptions={[
93-
{
94-
value: "active",
95-
label: "Active",
96-
},
97-
{
98-
value: "expiring",
99-
label: "Expiring",
100-
},
101-
{
102-
value: "expired",
103-
label: "Expired",
104-
},
105-
]}
106-
placeholderText="Status"
107-
/>
85+
<FilterToolbar {...filterToolbarProps} showFilterDropdown>
86+
{filterToolbarProps.currentFilterCategoryKey === "subject" && (
87+
<SearchFilterControl
88+
{...getFilterControlProps({ categoryKey: "subject" })}
89+
placeholderText="Search by subject"
90+
/>
91+
)}
92+
{filterToolbarProps.currentFilterCategoryKey === "status" && (
93+
<MultiselectFilterControl
94+
{...getFilterControlProps({ categoryKey: "status" })}
95+
selectOptions={[
96+
{
97+
value: "active",
98+
label: "Active",
99+
},
100+
{
101+
value: "expiring",
102+
label: "Expiring",
103+
},
104+
{
105+
value: "expired",
106+
label: "Expired",
107+
},
108+
]}
109+
placeholderText="Status"
110+
/>
111+
)}
108112
</FilterToolbar>
109113
<ToolbarItem {...paginationToolbarItemProps}>
110114
<SimplePagination idPrefix="certificates-table" isTop paginationProps={paginationProps} />
@@ -115,8 +119,8 @@ export const CerticatesTable: React.FC<ICerticatesTableProps> = ({ certificates,
115119
<Table aria-label="certificates table">
116120
<Thead>
117121
<Tr>
118-
<Th>Issuer</Th>
119122
<Th>Subject</Th>
123+
<Th>Issuer</Th>
120124
<Th>Target</Th>
121125
<Th>Type</Th>
122126
<Th>Status</Th>
@@ -133,8 +137,8 @@ export const CerticatesTable: React.FC<ICerticatesTableProps> = ({ certificates,
133137
return (
134138
<Tbody key={rowIndex}>
135139
<Tr key={rowIndex}>
136-
<Td>{certificate.issuer}</Td>
137140
<Td>{certificate.subject}</Td>
141+
<Td>{certificate.issuer}</Td>
138142
<Td>{certificate.target}</Td>
139143
<Td>{certificate.type}</Td>
140144
<Td>

0 commit comments

Comments
 (0)