You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by cw...@apache.org on 2019/06/01 09:08:43 UTC

[incubator-druid] branch master updated: Web-console: prevent unnecessary loading of disabled data sources (#7804)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 21d3d0c  Web-console: prevent unnecessary loading of disabled data sources  (#7804)
21d3d0c is described below

commit 21d3d0cde8d1f4db2b314b66cfd81568b9d9f5e3
Author: mcbrewster <37...@users.noreply.github.com>
AuthorDate: Sat Jun 1 02:08:34 2019 -0700

    Web-console: prevent unnecessary loading of disabled data sources  (#7804)
    
    * prevent loading disabled datasources
    
    * prevent double loading
    
    * remove complexity
    
    * rename function
    
    * remove space
---
 .../src/views/datasource-view/datasource-view.tsx        | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/web-console/src/views/datasource-view/datasource-view.tsx b/web-console/src/views/datasource-view/datasource-view.tsx
index 35d46f9..964b4e1 100644
--- a/web-console/src/views/datasource-view/datasource-view.tsx
+++ b/web-console/src/views/datasource-view/datasource-view.tsx
@@ -151,8 +151,11 @@ export class DatasourcesView extends React.Component<DatasourcesViewProps, Datas
 
         const seen = countBy(datasources, (x: any) => x.datasource);
 
-        const disabledResp = await axios.get('/druid/coordinator/v1/metadata/datasources?includeDisabled');
-        const disabled: string[] = disabledResp.data.filter((d: string) => !seen[d]);
+        let disabled: string [] = [];
+        if (this.state.showDisabled) {
+          const disabledResp = await axios.get('/druid/coordinator/v1/metadata/datasources?includeDisabled' );
+          disabled = disabledResp.data.filter((d: string) => !seen[d]);
+        }
 
         const rulesResp = await axios.get('/druid/coordinator/v1/rules');
         const rules = rulesResp.data;
@@ -395,6 +398,13 @@ GROUP BY 1`);
     });
   }
 
+  private  toggleDisabled(showDisabled: boolean) {
+    if (!showDisabled) {
+      this.datasourceQueryManager.rerunLastQuery();
+    }
+    this.setState({showDisabled: !showDisabled});
+  }
+
   getDatasourceActions(datasource: string, disabled: boolean): BasicAction[] {
     const { goToSql } = this.props;
 
@@ -657,7 +667,7 @@ GROUP BY 1`);
         <Switch
           checked={showDisabled}
           label="Show disabled"
-          onChange={() => this.setState({ showDisabled: !showDisabled })}
+          onChange={() => this.toggleDisabled(showDisabled)}
         />
         <TableColumnSelection
           columns={noSqlMode ? tableColumnsNoSql : tableColumns}


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