mirror of https://github.com/apache/superset.git
certainty
This commit is contained in:
parent
9256762d44
commit
77dea1915b
|
@ -76,7 +76,7 @@ export const hydrateDashboard = (dashboardData, chartData, datasourcesData) => (
|
||||||
getState,
|
getState,
|
||||||
) => {
|
) => {
|
||||||
const { user, common } = getState();
|
const { user, common } = getState();
|
||||||
const metadata = JSON.parse(dashboardData.json_metadata);
|
const metadata = JSON.parse(dashboardData.json_metadata) || {};
|
||||||
const queryParams = querystring.parse(window.location.search);
|
const queryParams = querystring.parse(window.location.search);
|
||||||
const urlParams = extractUrlParams(queryParams);
|
const urlParams = extractUrlParams(queryParams);
|
||||||
const editMode = queryParams.edit === 'true';
|
const editMode = queryParams.edit === 'true';
|
||||||
|
@ -98,7 +98,7 @@ export const hydrateDashboard = (dashboardData, chartData, datasourcesData) => (
|
||||||
|
|
||||||
// Priming the color palette with user's label-color mapping provided in
|
// Priming the color palette with user's label-color mapping provided in
|
||||||
// the dashboard's JSON metadata
|
// the dashboard's JSON metadata
|
||||||
if (metadata?.label_colors) {
|
if (metadata.label_colors) {
|
||||||
const scheme = metadata.color_scheme;
|
const scheme = metadata.color_scheme;
|
||||||
const namespace = metadata.color_namespace;
|
const namespace = metadata.color_namespace;
|
||||||
const colorMap = isString(metadata.label_colors)
|
const colorMap = isString(metadata.label_colors)
|
||||||
|
@ -134,7 +134,7 @@ export const hydrateDashboard = (dashboardData, chartData, datasourcesData) => (
|
||||||
let newSlicesContainer;
|
let newSlicesContainer;
|
||||||
let newSlicesContainerWidth = 0;
|
let newSlicesContainerWidth = 0;
|
||||||
|
|
||||||
const filterScopes = metadata?.filter_scopes || {};
|
const filterScopes = metadata.filter_scopes || {};
|
||||||
|
|
||||||
const chartQueries = {};
|
const chartQueries = {};
|
||||||
const dashboardFilters = {};
|
const dashboardFilters = {};
|
||||||
|
@ -293,8 +293,8 @@ export const hydrateDashboard = (dashboardData, chartData, datasourcesData) => (
|
||||||
}
|
}
|
||||||
|
|
||||||
const nativeFilters = getInitialNativeFilterState({
|
const nativeFilters = getInitialNativeFilterState({
|
||||||
filterConfig: metadata?.native_filter_configuration || [],
|
filterConfig: metadata.native_filter_configuration || [],
|
||||||
filterSetsConfig: metadata?.filter_sets_configuration || [],
|
filterSetsConfig: metadata.filter_sets_configuration || [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const { roles } = getState().user;
|
const { roles } = getState().user;
|
||||||
|
@ -330,14 +330,14 @@ export const hydrateDashboard = (dashboardData, chartData, datasourcesData) => (
|
||||||
directPathToChild,
|
directPathToChild,
|
||||||
directPathLastUpdated: Date.now(),
|
directPathLastUpdated: Date.now(),
|
||||||
focusedFilterField: null,
|
focusedFilterField: null,
|
||||||
expandedSlices: metadata?.expanded_slices || {},
|
expandedSlices: metadata.expanded_slices || {},
|
||||||
refreshFrequency: metadata?.refresh_frequency || 0,
|
refreshFrequency: metadata.refresh_frequency || 0,
|
||||||
// dashboard viewers can set refresh frequency for the current visit,
|
// dashboard viewers can set refresh frequency for the current visit,
|
||||||
// only persistent refreshFrequency will be saved to backend
|
// only persistent refreshFrequency will be saved to backend
|
||||||
shouldPersistRefreshFrequency: false,
|
shouldPersistRefreshFrequency: false,
|
||||||
css: dashboardData.css || '',
|
css: dashboardData.css || '',
|
||||||
colorNamespace: metadata?.color_namespace || null,
|
colorNamespace: metadata.color_namespace || null,
|
||||||
colorScheme: metadata?.color_scheme || null,
|
colorScheme: metadata.color_scheme || null,
|
||||||
editMode: getPermissions('can_write', 'Dashboard', roles) && editMode,
|
editMode: getPermissions('can_write', 'Dashboard', roles) && editMode,
|
||||||
isPublished: dashboardData.published,
|
isPublished: dashboardData.published,
|
||||||
hasUnsavedChanges: false,
|
hasUnsavedChanges: false,
|
||||||
|
|
|
@ -298,7 +298,7 @@ class Header extends React.PureComponent {
|
||||||
let labelColors = colorScheme ? scale.getColorMap() : {};
|
let labelColors = colorScheme ? scale.getColorMap() : {};
|
||||||
// but allow metadata to overwrite if it exists
|
// but allow metadata to overwrite if it exists
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
const metadataLabelColors = dashboardInfo.metadata?.label_colors;
|
const metadataLabelColors = dashboardInfo.metadata.label_colors;
|
||||||
if (metadataLabelColors) {
|
if (metadataLabelColors) {
|
||||||
labelColors = { ...labelColors, ...metadataLabelColors };
|
labelColors = { ...labelColors, ...metadataLabelColors };
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ class Header extends React.PureComponent {
|
||||||
// check refresh frequency is for current session or persist
|
// check refresh frequency is for current session or persist
|
||||||
const refreshFrequency = shouldPersistRefreshFrequency
|
const refreshFrequency = shouldPersistRefreshFrequency
|
||||||
? currentRefreshFrequency
|
? currentRefreshFrequency
|
||||||
: dashboardInfo.metadata?.refresh_frequency; // eslint-disable-line camelcase
|
: dashboardInfo.metadata.refresh_frequency; // eslint-disable-line camelcase
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
positions,
|
positions,
|
||||||
|
|
|
@ -140,7 +140,7 @@ class SaveModal extends React.PureComponent<SaveModalProps, SaveModalState> {
|
||||||
// check refresh frequency is for current session or persist
|
// check refresh frequency is for current session or persist
|
||||||
const refreshFrequency = shouldPersistRefreshFrequency
|
const refreshFrequency = shouldPersistRefreshFrequency
|
||||||
? currentRefreshFrequency
|
? currentRefreshFrequency
|
||||||
: dashboardInfo.metadata?.refresh_frequency; // eslint-disable camelcase
|
: dashboardInfo.metadata.refresh_frequency; // eslint-disable camelcase
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
positions,
|
positions,
|
||||||
|
|
|
@ -62,7 +62,7 @@ function mapStateToProps(
|
||||||
layout: dashboardLayout.present,
|
layout: dashboardLayout.present,
|
||||||
chart,
|
chart,
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
chartConfiguration: dashboardInfo.metadata?.chart_configuration,
|
chartConfiguration: dashboardInfo.metadata.chart_configuration,
|
||||||
charts: chartQueries,
|
charts: chartQueries,
|
||||||
filters: getAppliedFilterValues(id),
|
filters: getAppliedFilterValues(id),
|
||||||
colorScheme,
|
colorScheme,
|
||||||
|
|
|
@ -60,7 +60,7 @@ function mapStateToProps(state) {
|
||||||
...getActiveFilters(),
|
...getActiveFilters(),
|
||||||
...getAllActiveFilters({
|
...getAllActiveFilters({
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
chartConfiguration: dashboardInfo.metadata?.chart_configuration,
|
chartConfiguration: dashboardInfo.metadata.chart_configuration,
|
||||||
nativeFilters: nativeFilters.filters,
|
nativeFilters: nativeFilters.filters,
|
||||||
dataMask,
|
dataMask,
|
||||||
layout: dashboardLayout.present,
|
layout: dashboardLayout.present,
|
||||||
|
|
|
@ -78,7 +78,7 @@ const mapStateToProps = (
|
||||||
chartId,
|
chartId,
|
||||||
charts,
|
charts,
|
||||||
present,
|
present,
|
||||||
dashboardInfo.metadata?.chart_configuration,
|
dashboardInfo.metadata.chart_configuration,
|
||||||
);
|
);
|
||||||
|
|
||||||
const indicators = uniqWith(
|
const indicators = uniqWith(
|
||||||
|
|
Loading…
Reference in New Issue