feat(explore): Fill dashboard name when adding new chart from dashboard view (#20129)

* feat(explore): Fill dashboard name when adding new chart from dashboard view

* Update import paths

* Update test

* Fix test
This commit is contained in:
Kamil Gabryjelski
2022-05-31 18:11:02 +02:00
committed by GitHub
parent 9646591d24
commit 3e3fbccdcb
12 changed files with 50 additions and 12 deletions

View File

@@ -678,12 +678,17 @@ function mapStateToProps(state) {
const chartKey = Object.keys(charts)[0];
const chart = charts[chartKey];
let dashboardId = Number(explore.form_data?.dashboardId);
if (Number.isNaN(dashboardId)) {
dashboardId = undefined;
}
return {
isDatasourceMetaLoading: explore.isDatasourceMetaLoading,
datasource: explore.datasource,
datasource_type: explore.datasource.type,
datasourceId: explore.datasource_id,
dashboardId: explore.form_data ? explore.form_data.dashboardId : undefined,
dashboardId,
controls: explore.controls,
can_overwrite: !!explore.can_overwrite,
can_add: !!explore.can_add,