You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by vo...@apache.org on 2020/04/07 20:31:34 UTC

[druid] branch master updated: fix global filter input (#9567)

This is an automated email from the ASF dual-hosted git repository.

vogievetsky pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 6e50d29  fix global filter input (#9567)
6e50d29 is described below

commit 6e50d29b4e95597337cb389689459b2bc33a4834
Author: mcbrewster <37...@users.noreply.github.com>
AuthorDate: Tue Apr 7 14:31:19 2020 -0600

    fix global filter input (#9567)
    
    * fix global filter input
    
    * remove clear
    
    * close global filters after clicking apply
    
    * add restFilter
---
 .../src/views/load-data-view/load-data-view.tsx    | 29 +++++++++++++++-------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/web-console/src/views/load-data-view/load-data-view.tsx b/web-console/src/views/load-data-view/load-data-view.tsx
index 113b104..49d322d 100644
--- a/web-console/src/views/load-data-view/load-data-view.tsx
+++ b/web-console/src/views/load-data-view/load-data-view.tsx
@@ -313,6 +313,7 @@ export interface LoadDataViewState {
   selectedFilterIndex: number;
   selectedFilter?: DruidFilter;
   showGlobalFilter: boolean;
+  newFilterValue?: Record<string, any>;
 
   // for schema
   schemaQueryState: QueryState<{
@@ -2066,7 +2067,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
   }
 
   renderGlobalFilterControls() {
-    const { spec, showGlobalFilter } = this.state;
+    const { spec, showGlobalFilter, newFilterValue } = this.state;
     const intervals: string[] = deepGet(spec, 'spec.dataSchema.granularitySpec.intervals');
     const { restFilter } = splitFilter(deepGet(spec, 'spec.dataSchema.transformSpec.filter'));
     const hasGlobalFilter = Boolean(intervals || restFilter);
@@ -2094,19 +2095,24 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
           />
           <FormGroup label="Extra filter">
             <JsonInput
-              value={restFilter}
-              onChange={f => {
+              value={newFilterValue}
+              onChange={f => this.setState({ newFilterValue: f })}
+              height="200px"
+            />
+          </FormGroup>
+          <div className="control-buttons">
+            <Button
+              text="Apply"
+              intent={Intent.PRIMARY}
+              onClick={() => {
                 const curFilter = splitFilter(
                   deepGet(spec, 'spec.dataSchema.transformSpec.filter'),
                 );
-                const newFilter = joinFilter(deepSet(curFilter, `restFilter`, f));
+                const newFilter = joinFilter(deepSet(curFilter, `restFilter`, newFilterValue));
                 this.updateSpec(deepSet(spec, 'spec.dataSchema.transformSpec.filter', newFilter));
+                this.setState({ showGlobalFilter: false, newFilterValue: undefined });
               }}
-              height="200px"
             />
-          </FormGroup>
-          <div className="control-buttons">
-            <Button text="Apply" intent={Intent.PRIMARY} onClick={() => this.queryForFilter()} />
             <Button text="Cancel" onClick={() => this.setState({ showGlobalFilter: false })} />
           </div>
         </div>
@@ -2116,7 +2122,12 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
         <FormGroup>
           <Button
             text={`${hasGlobalFilter ? 'Edit' : 'Add'} global filter`}
-            onClick={() => this.setState({ showGlobalFilter: true })}
+            onClick={() =>
+              this.setState({
+                showGlobalFilter: true,
+                newFilterValue: restFilter,
+              })
+            }
           />
         </FormGroup>
       );


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org