Skip to content

Commit ea71cdf

Browse files
authored
nobug-show-table-filters-and-search-on-enter-tests (bcgov#99)
1 parent 1f46e8b commit ea71cdf

File tree

7 files changed

+572
-23
lines changed

7 files changed

+572
-23
lines changed

met-web/src/components/comments/admin/reviewListing/Submissions.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ const Submissions = () => {
116116
label="Search Comments"
117117
value={searchText}
118118
onChange={(e) => setSearchText(e.target.value)}
119+
onKeyDown={(e) => {
120+
if (e.key === 'Enter') {
121+
e.preventDefault();
122+
handleSearchBarClick(searchText);
123+
}
124+
}}
119125
size="small"
120126
/>
121127
<PrimaryButton

met-web/src/components/common/Table/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ function MetTableHead<T>({ order, orderBy, onRequestSort, headCells, loading, ne
5050
}
5151
onClick={createSortHandler(headCell.key, index)}
5252
hideSortIcon={Boolean(headCell.hideSorticon)}
53+
sx={
54+
headCell.allowSort
55+
? {
56+
'& .MuiTableSortLabel-icon': {
57+
opacity: 1,
58+
color:
59+
orderBy === headCell.key && nestedSortKey === headCell.nestedSortKey
60+
? 'text.primary'
61+
: 'text.disabled',
62+
},
63+
}
64+
: undefined
65+
}
5366
>
5467
{headCell.label}
5568
{headCell.icon}

met-web/src/components/engagement/listing/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,12 @@ const EngagementListing = () => {
412412
name="searchText"
413413
value={searchText}
414414
onChange={(e) => setSearchText(e.target.value)}
415+
onKeyDown={(e) => {
416+
if (e.key === 'Enter') {
417+
e.preventDefault();
418+
handleSearchBarClick(searchText);
419+
}
420+
}}
415421
size="small"
416422
/>
417423
<PrimaryButton

met-web/src/components/image/listing/ImageListing.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ const ImageListing = () => {
183183
name="searchText"
184184
value={searchText}
185185
onChange={(e) => setSearchText(e.target.value)}
186+
onKeyDown={(e) => {
187+
if (e.key === 'Enter') {
188+
e.preventDefault();
189+
setPaginationOptions({ page: 1, size: 10 });
190+
}
191+
}}
186192
size="small"
187193
/>
188194
<PrimaryButton

met-web/src/components/survey/listing/Surveys.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,12 @@ const Surveys = () => {
402402
name="searchText"
403403
value={searchText}
404404
onChange={(e) => setSearchText(e.target.value)}
405+
onKeyDown={(e) => {
406+
if (e.key === 'Enter') {
407+
e.preventDefault();
408+
handleSearchBarClick(searchText);
409+
}
410+
}}
405411
size="small"
406412
/>
407413
<PrimaryButton

met-web/src/components/userManagement/listing/UserManagementListing.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const UserManagementListing = () => {
2525

2626
const headCells: HeadCell<User>[] = [
2727
{
28-
key: 'first_name',
28+
key: 'last_name',
2929
numeric: false,
3030
disablePadding: true,
3131
label: 'User Name',
@@ -98,6 +98,12 @@ const UserManagementListing = () => {
9898
name="searchBarText"
9999
value={searchBarText}
100100
onChange={(e) => setSearchBarText(e.target.value)}
101+
onKeyDown={(e) => {
102+
if (e.key === 'Enter') {
103+
e.preventDefault();
104+
handleSearchClick();
105+
}
106+
}}
101107
size="small"
102108
/>
103109
<PrimaryButton onClick={handleSearchClick}>

0 commit comments

Comments
 (0)