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 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}
|
||||
|
|
Loading…
Reference in New Issue