Skip to content

Commit

Permalink
feat: Searches item description and tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick committed Jul 17, 2017
1 parent 7c91602 commit 9681897
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 35 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
coverage
dist/application
dist/boilerplate
dist/viewApp
dist/viewApp
package-lock.json
27 changes: 14 additions & 13 deletions dist/application/widgets/Main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/application/widgets/Main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/application/widgets/panels/PanelBase.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/boilerplate/ApplicationBase.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/boilerplate/ApplicationBase.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions dist/viewApp/widgets/Main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/viewApp/widgets/Main.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions src/application/widgets/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default class Main extends declared(Widget) {
console.error(err);
this.state = {
...this.state,
status: "failed"
loadStatus: "failed"
};
})
}
Expand Down Expand Up @@ -262,12 +262,14 @@ export default class Main extends declared(Widget) {

private handleSearch(e) {
e.preventDefault();

const searchResults = this.state.items.filter((item) => {
return item.title.toLowerCase().indexOf(e.target.childNodes[0].value.toLowerCase()) !== -1 ||
item.type.toLowerCase().indexOf(e.target.childNodes[0].value.toLowerCase()) !== -1 ||
item.owner.toLowerCase().indexOf(e.target.childNodes[0].value.toLowerCase()) !== -1;
});
const searchQuery = e.target.childNodes[0].value.toLowerCase();
const searchResults = this.state.items.filter((item) => (
item.title.toLowerCase().indexOf(searchQuery) !== -1 ||
item.type.toLowerCase().indexOf(searchQuery) !== -1 ||
item.owner.toLowerCase().indexOf(searchQuery) !== -1 ||
(item.tags && item.tags.map((tag) => tag.toLowerCase()).indexOf(searchQuery) !== -1) ||
(item.description && item.description.indexOf(searchQuery) !== -1)
));

this.state = {
...this.state,
Expand Down
1 change: 1 addition & 0 deletions src/application/widgets/panels/PanelBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface IPanelProps {
extTitle: string;
extLink: string;
extItem: string;
portalUrl: string;
}

export default (props: IPanelProps) => {
Expand Down

0 comments on commit 9681897

Please sign in to comment.