diff options
Diffstat (limited to 'src/client/views/SearchBox.tsx')
-rw-r--r-- | src/client/views/SearchBox.tsx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/client/views/SearchBox.tsx b/src/client/views/SearchBox.tsx index 63d2065e2..0fd3c0904 100644 --- a/src/client/views/SearchBox.tsx +++ b/src/client/views/SearchBox.tsx @@ -22,6 +22,7 @@ import { SetupDrag } from '../util/DragManager'; import { Docs } from '../documents/Documents'; import { RouteStore } from '../../server/RouteStore'; import { NumCast } from '../../new_fields/Types'; +import { SearchUtil } from '../util/SearchUtil'; library.add(faSearch); library.add(faObjectGroup); @@ -37,6 +38,7 @@ export class SearchBox extends React.Component { @observable private _results: Doc[] = []; + @action.bound onChange(e: React.ChangeEvent<HTMLInputElement>) { this.searchString = e.target.value; @@ -72,6 +74,7 @@ export class SearchBox extends React.Component { } return docs; } + public static async convertDataUri(imageUri: string, returnedFilename: string) { try { let posting = DocServer.prepend(RouteStore.dataUriToImage); @@ -169,6 +172,18 @@ export class SearchBox extends React.Component { return Docs.FreeformDocument(docs, { width: 400, height: 400, panX: 175, panY: 175, backgroundColor: "grey", title: `Search Docs: "${this.searchString}"` }); } + @action + getViews = async (doc: Doc) => { + console.log("getting view") + const results = await SearchUtil.GetViewsOfDocument(doc); + let toReturn: Doc[] = []; + await runInAction(() => { + toReturn = results; + }); + return toReturn; + } + + // Useful queries: // Delegates of a document: {!join from=id to=proto_i}id:{protoId} // Documents in a collection: {!join from=data_l to=id}id:{collectionProtoId} @@ -183,7 +198,7 @@ export class SearchBox extends React.Component { <input value={this.searchString} onChange={this.onChange} type="text" placeholder="Search..." className="searchBox-barChild searchBox-input" onKeyPress={this.enter} style={{ width: this._resultsOpen ? "500px" : undefined }} /> - {/* <button className="searchBox-barChild searchBox-filter" onClick={this.toggleFilterDisplay}>Filter</button> */} + <button className="searchBox-barChild searchBox-filter" onClick={this.toggleFilterDisplay}>Filter</button> {/* <FontAwesomeIcon icon="search" size="lg" className="searchBox-barChild searchBox-submit" /> */} </div> {this._resultsOpen ? ( |