Skip to content

Commit

Permalink
feat: add options for any-tag-set and tag-not-set (Greenstand#227)
Browse files Browse the repository at this point in the history
* feat: add options for any-tag-set and tag-not-set

* feat: add options for any-tag-set and tag-not-set

* feat: add options for any-tag-set and tag-not-set

* feat: add options for any-tag-set and tag-not-set

* fix: removed comments and fixed MUI error

Co-authored-by: Nick Charlton <[email protected]>
  • Loading branch information
bstetzer32 and nmcharlton authored Jan 4, 2022
1 parent 3b96dd9 commit b9598b8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/components/Filter.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Option A for divider for verify tool tag filter */
#tag-option-1 {
border-bottom: 1px solid rgba(0, 0, 0, 0.54);
padding-bottom: 16px;
margin-bottom: 16px;
}
28 changes: 16 additions & 12 deletions src/components/FilterTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import FilterModel, {
SPECIES_NOT_SET,
ALL_ORGANIZATIONS,
ORGANIZATION_NOT_SET,
// TAG_NOT_SET,
TAG_NOT_SET,
ANY_TAG_SET,
} from '../models/Filter';
import DateFnsUtils from '@date-io/date-fns';
import {
Expand Down Expand Up @@ -348,12 +349,18 @@ function Filter(props) {
inputRoot: classes.autocompleteInputRoot,
}}
options={[
// {
// id: TAG_NOT_SET,
// tagName: 'Not set',
// active: true,
// public: true,
// },
{
id: TAG_NOT_SET,
tagName: 'Not set',
active: true,
public: true,
},
{
id: ANY_TAG_SET,
tagName: 'Any tag set',
active: true,
public: true,
},
...tagsContext.tagList.filter((t) =>
t.tagName
.toLowerCase()
Expand All @@ -371,18 +378,15 @@ function Filter(props) {
onChange={(_oldVal, newVal) => {
//triggered by onInputChange
console.log('newVal -- ', newVal);
if (newVal && newVal.tagName === 'Not set') {
setTag('Not set');
} else {
setTag(newVal);
}
setTag(newVal);
}}
onInputChange={(_oldVal, newVal) => {
setTagSearchString(newVal);
}}
renderInput={(params) => {
return <TextField {...params} label="Tag" />;
}}
getOptionSelected={(option, value) => option.id === value.id}
// selectOnFocus
// clearOnBlur
// handleHomeEndKeys
Expand Down
3 changes: 3 additions & 0 deletions src/models/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const SPECIES_NOT_SET = 'SPECIES_NOT_SET';
export const ALL_ORGANIZATIONS = 'ALL_ORGANIZATIONS';
export const ORGANIZATION_NOT_SET = 'ORGANIZATION_NOT_SET';
export const TAG_NOT_SET = 'TAG_NOT_SET';
export const ANY_TAG_SET = 'ANY_TAG_SET';
import { tokenizationStates } from '../common/variables';

export default class Filter {
Expand Down Expand Up @@ -81,6 +82,8 @@ export default class Filter {

if (this.tagId === TAG_NOT_SET) {
where.tagId = null;
} else if (this.tagId === ANY_TAG_SET) {
where.tagId = '0';
} else if (this.tagId) {
where.tagId = this.tagId;
}
Expand Down

0 comments on commit b9598b8

Please sign in to comment.