Skip to content

Commit

Permalink
fix: allow ISearchOptionSettings to be passed to EnumFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
Naomi Aro committed Apr 27, 2021
1 parent 518cf12 commit dcc092c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
21 changes: 13 additions & 8 deletions app/components/FilterableTable/Filters/ApplicationStatusFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ export default class ApplicationStatusFilter extends EnumFilter<
CiipApplicationRevisionStatus | 'NOT_STARTED'
> {
constructor(displayName: string, argName: string, nullValueArgName: string) {
super(displayName, argName, [
'NOT_STARTED',
'DRAFT',
'SUBMITTED',
'REQUESTED_CHANGES',
'APPROVED',
'REJECTED'
]);
super(
displayName,
argName,
[
'NOT_STARTED',
'DRAFT',
'SUBMITTED',
'REQUESTED_CHANGES',
'APPROVED',
'REJECTED'
],
{sortable: false}
);
this._nullValueArgName = nullValueArgName;
}
_nullValueArgName: string;
Expand Down
11 changes: 8 additions & 3 deletions app/components/FilterableTable/Filters/EnumFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import {getUserFriendlyStatusLabel} from 'lib/text-transforms';
import React from 'react';
import {Form} from 'react-bootstrap';
import TableFilter from './TableFilter';
import TableFilter, {ISearchOptionSettings} from './TableFilter';
import {FilterComponent} from './types';

export default class EnumFilter<T> extends TableFilter {
enumValues: T[];

constructor(display, argName, enumValues: T[]) {
super(display, argName, {sortable: false});
constructor(
display,
argName,
enumValues: T[],
settings?: ISearchOptionSettings
) {
super(display, argName, settings);
this.enumValues = enumValues;
this.searchOptionValues = enumValues.map((val) => {
return {display: String(val), value: val};
Expand Down
2 changes: 1 addition & 1 deletion app/components/FilterableTable/Filters/TableFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import type {FilterComponent} from './types';
import {Form} from 'react-bootstrap';

interface ISearchOptionSettings {
export interface ISearchOptionSettings {
filterable?: boolean;
sortable?: boolean;
sortColumnName?: string;
Expand Down

0 comments on commit dcc092c

Please sign in to comment.