From f7b6e64c5c60f7221d80d16460d0a85d0f17b35a Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 12 Aug 2020 15:05:36 -0400 Subject: fixed warnings and fixed rendering of fields in search view. --- src/client/views/search/SearchBox.tsx | 38 ++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 2e2e87092..b1ddeb08b 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -54,6 +54,8 @@ export class SearchBox extends ViewBoxBaseComponent(); private _resultsRef = React.createRef(); public inputRef = React.createRef(); @@ -245,11 +247,11 @@ export class SearchBox extends ViewBoxBaseComponent { - i === 0 ? newWords.push(key + mod + "\"" + word + "\"") : newWords.push("AND " + key + mod + "\"" + word + "\"") + i === 0 ? newWords.push(key + mod + "\"" + word + "\"") : newWords.push("AND " + key + mod + "\"" + word + "\""); }); query = `(${query}) AND (${newWords.join(" ")})`; } else { for (let i = 0; i < values.length; i++) { - let mod = "_t:" + const mod = "_t:"; const newWords: string[] = []; const oldWords = values[i].split(" "); oldWords.forEach((word, i) => { - i === 0 ? newWords.push(key + mod + "\"" + word + "\"") : newWords.push("AND " + key + mod + "\"" + word + "\"") + i === 0 ? newWords.push(key + mod + "\"" + word + "\"") : newWords.push("AND " + key + mod + "\"" + word + "\""); }); - let v = "(" + newWords.join(" ") + ")"; + const v = "(" + newWords.join(" ") + ")"; if (i === 0) { query = `(${query}) AND (${v}`; if (values.length === 1) { @@ -348,7 +350,7 @@ export class SearchBox extends ViewBoxBaseComponent { const layoutresult = Cast(doc.type, "string"); if (layoutresult && !blockedTypes.includes(layoutresult)) { @@ -739,8 +741,8 @@ export class SearchBox extends ViewBoxBaseComponent(["title", "author", "*lastModified", "type"]); + const headers = new Set(["title", "author", "text", "type", "data", "*lastModified"]); // if ((this._numTotalResults === 0 || this._results.length === 0) && this._openNoResults) { // if (this.noresults === "") { // this.noresults = "No search results :("; @@ -838,7 +840,7 @@ export class SearchBox extends ViewBoxBaseComponent { return this.props.ScreenToLocalTransform().translate(-5, -65);// listBox padding-left and pres-box-cont minHeight @@ -857,7 +859,7 @@ export class SearchBox extends ViewBoxBaseComponent([]); this.resultsScrolled(); } @@ -1000,7 +1002,7 @@ export class SearchBox extends ViewBoxBaseComponent { if (d.data !== undefined) { d._searchDocs = new List(); - d._docFilters = new List() + d._docFilters = new List(); const newdocs = DocListCast(d.data); newdocs.forEach((newdoc) => { newarray.push(newdoc); -- cgit v1.2.3-70-g09d2 From 57bbb175bfed6388f63566230eb7f1a591107855 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 12 Aug 2020 16:10:39 -0400 Subject: fixed run-time warnings & remove print statements --- src/client/views/collections/CollectionSchemaCells.tsx | 8 ++++---- src/client/views/collections/CollectionSchemaHeaders.tsx | 1 - src/client/views/nodes/PDFBox.tsx | 10 +++++----- src/client/views/nodes/WebBox.tsx | 4 ++-- src/client/views/search/SearchBox.tsx | 8 +------- 5 files changed, 12 insertions(+), 19 deletions(-) (limited to 'src/client/views/search') diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index c9dccd23b..49d75e6de 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -168,13 +168,14 @@ export class CollectionSchemaCell extends React.Component { if (positions !== undefined) { StrCast(this.props.Document._searchString); const length = StrCast(this.props.Document._searchString).length; + const color = contents ? "black" : "grey"; - results.push({contents ? contents.slice(0, positions[0]) : "undefined"}); + results.push({contents?.slice(0, positions[0])}); positions.forEach((num, cur) => { - results.push({contents ? contents.slice(num, num + length) : "undefined"}); + results.push({contents?.slice(num, num + length)}); let end = 0; cur === positions.length - 1 ? end = contents.length : end = positions[cur + 1]; - results.push({contents ? contents.slice(num + length, end) : "undefined"}); + results.push({contents?.slice(num + length, end)}); } ); return results; @@ -233,7 +234,6 @@ export class CollectionSchemaCell extends React.Component { if (aliasdoc.length > 0) { targetContext = Cast(aliasdoc[0].context, Doc) as Doc; } - console.log(targetContext); DocumentManager.Instance.jumpToDocument(this.props.rowProps.original, false, undefined, targetContext); } else { diff --git a/src/client/views/collections/CollectionSchemaHeaders.tsx b/src/client/views/collections/CollectionSchemaHeaders.tsx index 12fb5a874..c2bc7c77c 100644 --- a/src/client/views/collections/CollectionSchemaHeaders.tsx +++ b/src/client/views/collections/CollectionSchemaHeaders.tsx @@ -483,7 +483,6 @@ export class KeysDropdown extends React.Component { @observable filterOpen: boolean | undefined = undefined; render() { - console.log(this._isOpen, this._key, this._searchTerm); return (
{ this.props.Document._searchDoc ? runInAction(() => { this._isOpen === undefined ? this._isOpen = true : this._isOpen = !this._isOpen; }) : this.props.openHeader(this.props.col, e.clientX, e.clientY); }} icon={this.props.icon} size="lg" style={{ display: "inline", paddingBottom: "1px", paddingTop: "4px", cursor: "hand" }} /> diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index 2fdb87e63..255a1b2d0 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -60,19 +60,19 @@ export class PDFBox extends ViewBoxAnnotatableComponent; } else if (field instanceof WebField) { const url = this.layoutDoc.UseCors ? Utils.CorsProxy(field.url.href) : field.url.href; - view =