From f962986693267e30ca18884e6f04e402181a5a1a Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 19 Aug 2020 13:58:31 -0400 Subject: starting refactor of searchBox code --- src/client/views/search/SearchBox.tsx | 94 ++++++++++++----------------------- 1 file changed, 33 insertions(+), 61 deletions(-) (limited to 'src') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index bdf5e7e44..df64c38d0 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -882,6 +882,35 @@ export class SearchBox extends ViewBoxBaseComponent { + scope && (this.filter = false); + this.searchFullDB = scope; + this.dataDoc[this.fieldKey] = new List([]); + if (this.currentSelectedCollection !== undefined) { + let newarray: Doc[] = []; + let docs: Doc[] = []; + docs = DocListCast(this.currentSelectedCollection.dataDoc[Doc.LayoutFieldKey(this.currentSelectedCollection.dataDoc)]); + while (docs.length > 0) { + newarray = []; + docs.forEach((d) => { + if (d.data !== undefined) { + d._searchDocs = new List(); + d._docFilters = new List(); + const newdocs = DocListCast(d.data); + newdocs.forEach((newdoc) => { + newarray.push(newdoc); + }); + } + }); + docs = newarray; + } + this.currentSelectedCollection.props.Document._docFilters = new List(); + this.currentSelectedCollection.props.Document._searchDocs = undefined; + this.currentSelectedCollection = undefined; + } + this.submitSearch(); + } render() { this.props.Document._chromeStatus === "disabled"; this.props.Document._searchDoc = true; @@ -969,70 +998,13 @@ export class SearchBox extends ViewBoxBaseComponent
+ this.changeSearchScope("")} /> + Collection +