mirror of https://github.com/apache/druid.git
Web-console: prevent unnecessary loading of disabled data sources (#7804)
* prevent loading disabled datasources * prevent double loading * remove complexity * rename function * remove space
This commit is contained in:
parent
55af692b56
commit
21d3d0cde8
|
@ -151,8 +151,11 @@ export class DatasourcesView extends React.Component<DatasourcesViewProps, Datas
|
||||||
|
|
||||||
const seen = countBy(datasources, (x: any) => x.datasource);
|
const seen = countBy(datasources, (x: any) => x.datasource);
|
||||||
|
|
||||||
const disabledResp = await axios.get('/druid/coordinator/v1/metadata/datasources?includeDisabled');
|
let disabled: string [] = [];
|
||||||
const disabled: string[] = disabledResp.data.filter((d: string) => !seen[d]);
|
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 rulesResp = await axios.get('/druid/coordinator/v1/rules');
|
||||||
const rules = rulesResp.data;
|
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[] {
|
getDatasourceActions(datasource: string, disabled: boolean): BasicAction[] {
|
||||||
const { goToSql } = this.props;
|
const { goToSql } = this.props;
|
||||||
|
|
||||||
|
@ -657,7 +667,7 @@ GROUP BY 1`);
|
||||||
<Switch
|
<Switch
|
||||||
checked={showDisabled}
|
checked={showDisabled}
|
||||||
label="Show disabled"
|
label="Show disabled"
|
||||||
onChange={() => this.setState({ showDisabled: !showDisabled })}
|
onChange={() => this.toggleDisabled(showDisabled)}
|
||||||
/>
|
/>
|
||||||
<TableColumnSelection
|
<TableColumnSelection
|
||||||
columns={noSqlMode ? tableColumnsNoSql : tableColumns}
|
columns={noSqlMode ? tableColumnsNoSql : tableColumns}
|
||||||
|
|
Loading…
Reference in New Issue