diff --git a/web-common/src/features/dashboards/workspace/Dashboard.svelte b/web-common/src/features/dashboards/workspace/Dashboard.svelte index bc1c4871680..f03dde5122e 100644 --- a/web-common/src/features/dashboards/workspace/Dashboard.svelte +++ b/web-common/src/features/dashboards/workspace/Dashboard.svelte @@ -36,7 +36,6 @@ }, dashboardStore, - validSpecStore, } = StateManagers; const timeControlsStore = useTimeControlStore(StateManagers); @@ -45,6 +44,8 @@ let exploreContainerWidth: number; + $: ({ instanceId } = $runtime); + $: ({ whereFilter, dimensionThresholdFilters } = $dashboardStore); $: extraLeftPadding = !$navigationOpen; @@ -55,37 +56,41 @@ $: selectedDimension = selectedDimensionName && $getDimensionByName(selectedDimensionName); $: expandedMeasureName = $exploreState?.tdd?.expandedMeasureName; - $: metricTimeSeries = useModelHasTimeSeries( - $runtime.instanceId, - metricsViewName, - ); + $: metricTimeSeries = useModelHasTimeSeries(instanceId, metricsViewName); $: hasTimeSeries = $metricTimeSeries.data; $: isRillDeveloper = $readOnly === false; // Check if the mock user (if selected) has access to the explore - $: explore = useExploreValidSpec($runtime.instanceId, exploreName); + $: explore = useExploreValidSpec(instanceId, exploreName); $: mockUserHasNoAccess = $selectedMockUserStore && $explore.error?.response?.status === 404; $: hidePivot = isEmbedded && $explore.data?.explore?.embedsHidePivot; - $: timeControls = $timeControlsStore; + $: ({ + timeStart: start, + timeEnd: end, + showTimeComparison, + comparisonTimeStart, + comparisonTimeEnd, + ready: timeControlsReady = false, + } = $timeControlsStore); $: timeRange = { - start: timeControls.timeStart, - end: timeControls.timeEnd, + start, + end, }; - $: comparisonTimeRange = timeControls.showTimeComparison + $: comparisonTimeRange = showTimeComparison ? { - start: timeControls.comparisonTimeStart, - end: timeControls.comparisonTimeEnd, + start: comparisonTimeStart, + end: comparisonTimeEnd, } : undefined; - $: metricsView = $validSpecStore.data?.metricsView ?? {}; + $: metricsView = $explore.data?.metricsView ?? {}; let metricsWidth = DEFAULT_TIMESERIES_WIDTH; let resizing = false; @@ -181,7 +186,7 @@ {timeRange} {comparisonTimeRange} activeMeasureName={$activeMeasureName} - timeControlsReady={!!timeControls.ready} + {timeControlsReady} {metricsView} visibleMeasureNames={$visibleMeasures.map( ({ name }) => name ?? "", @@ -197,7 +202,7 @@ {timeRange} {comparisonTimeRange} {metricsView} - timeControlsReady={!!timeControls.ready} + {timeControlsReady} /> {/if}