From 9c612838c775a6fa9737963618aeebbc427e794c Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Wed, 17 Mar 2021 21:56:31 -0400 Subject: converted dockingview.instance to dashboard + started commenting --- src/client/views/nodes/FilterBox.tsx | 73 +++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 17 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/FilterBox.tsx b/src/client/views/nodes/FilterBox.tsx index 541693cdf..d410d2b33 100644 --- a/src/client/views/nodes/FilterBox.tsx +++ b/src/client/views/nodes/FilterBox.tsx @@ -40,7 +40,7 @@ export class FilterBox extends ViewBoxBaseComponent) { super(props); const targetDoc = FilterBox.targetDoc; - if (!targetDoc) CurrentUserUtils.setupFilterDocs(targetDoc); + if (targetDoc && !targetDoc.currentFilter) CurrentUserUtils.setupFilterDocs(targetDoc); } public static LayoutString(fieldKey: string) { return FieldView.LayoutString(FilterBox, fieldKey); } @@ -49,11 +49,43 @@ export class FilterBox extends ViewBoxBaseComponent(); const targetDoc = FilterBox.targetDoc; if (this._loaded && targetDoc) { - // if (targetDoc) { const activeTabs = DocListCast(targetDoc.data); SearchBox.foreachRecursiveDoc(activeTabs, (doc: Doc) => allDocs.add(doc)); setTimeout(() => targetDoc.allDocuments = new List(Array.from(allDocs))); @@ -247,20 +278,30 @@ export class FilterBox extends ViewBoxBaseComponent script : undefined; } + /** + * Changes the value of the variable that determines whether filters are ANDed or ORed together + */ @action changeBool = (e: any) => { FilterBox._filterBoolean = e.currentTarget.value; } + /** + * Changes the value of the variable that determines whether the filters should apply to the dashboard or the collection + */ @action changeScope = (e: any) => { FilterBox._filterScope = e.currentTarget.value; } + /** + * Changes whether to select matched or unmatched documents + */ @action changeMatch = (e: any) => { this._filterMatch = e.currentTarget.value; } + @action changeSelected = () => { if (this._filterSelected) { @@ -296,19 +337,26 @@ export class FilterBox extends ViewBoxBaseComponent ScriptField.MakeScript("")!; + /** + * Adds a filterDoc to the list of saved filters + */ saveFilter = () => { Doc.AddDocToList(Doc.UserDoc(), "savedFilters", this.props.Document); - console.log("saved filter"); } + /** + * Changes the title of the filterDoc + */ onTitleValueChange = (val: string) => { - this.props.Document.title = val || `FilterDoc for ${SelectionManager.Views()[0].Document.title}`; + this.props.Document.title = val || `FilterDoc for ${FilterBox.targetDoc.title}`; return true; } + /** + * The flyout from which you can select a saved filter to apply + */ @computed get flyoutPanel() { return DocListCast(Doc.UserDoc().savedFilters).map(doc => { - // console.log("mapping"); return <>
e.stopPropagation()} style={{ height: 50, border: "2px" }} onPointerDown={() => this.props.updateFilterDoc?.(doc)}> {StrCast(doc.title)} @@ -320,15 +368,6 @@ export class FilterBox extends ViewBoxBaseComponent { - // // console.log("mapping"); - // return <> - //
e.stopPropagation()} style={{ height: 50, border: "2px" }} onPointerDown={() => this.props.updateFilterDoc?.(doc)}> - // {StrCast(doc.title)} - //
- // ; - // } - // ); // TODO uncomment the line below when the treeview x works // const options = this._allFacets.filter(facet => this.currentFacets.indexOf(facet) === -1).map(facet => ({ value: facet, label: facet })); -- cgit v1.2.3-70-g09d2