aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-08-18 16:02:10 -0400
committerbobzel <zzzman@gmail.com>2020-08-18 16:02:10 -0400
commit2b8e17103583fa70018477368f83b9d564961067 (patch)
tree33d6d2917317fb1540f6198af266cfe778a0a98e /src/client/views/search
parent73ab9e35c849c54245be618c9e7fe09f56a151f3 (diff)
changed catalog to pop up search over db for author. turned off double-clicking on any fonticon.
Diffstat (limited to 'src/client/views/search')
-rw-r--r--src/client/views/search/SearchBox.tsx37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index 000bdd965..ee2bc8af1 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -189,21 +189,14 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
}
}
- enter = (e: React.KeyboardEvent) => {
- if (e.key === "Enter") {
+ enter = action((e: React.KeyboardEvent | undefined) => {
+ if (!e || e.key === "Enter") {
this.layoutDoc._searchString = this.newsearchstring;
- runInAction(() => this._pageStart = 0);
-
- if (StrCast(this.layoutDoc._searchString) !== "" || !this.searchFullDB) {
- runInAction(() => this.open = true);
- }
- else {
- runInAction(() => this.open = false);
-
- }
+ this._pageStart = 0;
+ this.open = StrCast(this.layoutDoc._searchString) !== "" || this.searchFullDB !== "DB";
this.submitSearch();
}
- }
+ });
@observable open: boolean = false;
@@ -576,7 +569,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
}, 60000);
}
- if (query !== "") {
+ if (query !== "" || this.searchFullDB === "My Stuff") {
this._endIndex = 12;
this._maxSearchIndex = 0;
this._numTotalResults = -1;
@@ -591,7 +584,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
}
}
- @observable searchFullDB = true;
+ @observable searchFullDB = "DB";
@observable _timeout: any = undefined;
@@ -608,10 +601,11 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
private get filterQuery() {
const types = ["preselement", "docholder", "search", "searchitem", "fonticonbox"]; // this.filterTypes;
const baseExpr = "NOT system_b:true";
+ const authorExpr = this.searchFullDB === "My Stuff" ? ` author_t:${Doc.CurrentUserEmail}` : undefined;
const includeDeleted = this.getDataStatus() ? "" : " NOT deleted_b:true";
const typeExpr = this._onlyAliases ? "NOT {!join from=id to=proto_i}type_t:*" : `(type_t:* OR {!join from=id to=proto_i}type_t:*) ${types.map(type => `NOT ({!join from=id to=proto_i}type_t:${type}) AND NOT type_t:${type}`).join(" AND ")}`;
// fq: type_t:collection OR {!join from=id to=proto_i}type_t:collection q:text_t:hello
- const query = [baseExpr, includeDeleted, typeExpr].join(" AND ").replace(/AND $/, "");
+ const query = [baseExpr, authorExpr, includeDeleted, typeExpr].filter(q => q).join(" AND ").replace(/AND $/, "");
return query;
}
@@ -888,7 +882,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
<div style={{ pointerEvents: "all" }} className="searchBox-container">
<div style={{ position: "absolute", left: 15, height: 32, alignItems: "center", display: "flex" }}>{Doc.CurrentUserEmail}</div>
<div className="searchBox-bar">
- <div style={{ position: "relative", display: "flex", width: 400 }}>
+ <div style={{ position: "relative", display: "flex", width: 450 }}>
<input value={this.newsearchstring} autoComplete="off" onChange={this.onChange} type="text" placeholder="Search..." id="search-input" ref={this.inputRef}
className="searchBox-barChild searchBox-input" onPointerDown={this.openSearch} onKeyPress={this.enter} onFocus={this.openSearch}
style={{ padding: 1, paddingLeft: 20, paddingRight: 60, color: "black", height: 20, width: 250 }} />
@@ -973,7 +967,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
<label style={{ fontSize: 12, marginTop: 6 }} >
<input type="radio" style={{ marginLeft: -16, marginTop: -1 }} checked={!this.searchFullDB} onChange={() => {
runInAction(() => {
- this.searchFullDB = !this.searchFullDB;
+ this.searchFullDB = "";
this.dataDoc[this.fieldKey] = new List<Doc>([]);
if (this.currentSelectedCollection !== undefined) {
let newarray: Doc[] = [];
@@ -1005,9 +999,9 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
</div>
<div className="radio" style={{ margin: 0 }}>
<label style={{ fontSize: 12, marginTop: 6 }} >
- <input style={{ marginLeft: -16, marginTop: -1 }} type="radio" checked={this.searchFullDB} onChange={() => {
+ <input style={{ marginLeft: -16, marginTop: -1 }} type="radio" checked={this.searchFullDB?.length ? true : false} onChange={() => {
runInAction(() => {
- this.searchFullDB = !this.searchFullDB;
+ this.searchFullDB = "DB";
this.dataDoc[this.fieldKey] = new List<Doc>([]);
this.filter = false;
if (this.currentSelectedCollection !== undefined) {
@@ -1036,7 +1030,10 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
});
}} />
DB
- </label>
+ <span onClick={action(() => this.searchFullDB = this.searchFullDB === "My Stuff" ? "DB" : "My Stuff")}>
+ {this.searchFullDB === "My Stuff" ? "(me)" : "(full)"}
+ </span>
+ </label>
</div>
</div>
</form>