77</template >
88<script setup lang="ts">
99import type { RendererProps } from ' ../types'
10- import type { MetricCardOptions , TimeRangeV4 } from ' @kong-ui-public/analytics-utilities'
10+ import type { MetricCardOptions } from ' @kong-ui-public/analytics-utilities'
1111import { MetricsProvider , MetricsConsumer } from ' @kong-ui-public/analytics-metric-provider'
12- import { computed , type Ref } from ' vue'
12+ import { computed } from ' vue'
1313import type { ExploreFilterAll } from ' @kong-ui-public/analytics-utilities'
1414
1515// Unlike AnalyticsChart, the metric card package doesn't currently expose its options
@@ -18,18 +18,14 @@ type ProviderProps = InstanceType<typeof MetricsProvider>['$props']
1818
1919const props = defineProps <RendererProps <MetricCardOptions >>()
2020
21- const overrideTimeRange: Ref <TimeRangeV4 > = computed (() => {
22- return props .context .timeSpec
23- })
24-
2521const options = computed <ProviderProps >(() => {
2622 const datasource = props .query ?.datasource
2723 if (datasource && datasource !== ' api_usage' && datasource !== ' basic' ) {
2824 throw new Error (` Invalid datasource value: ${datasource } ` )
2925 }
3026 return {
3127 datasource: props .query ?.datasource ,
32- overrideTimeRange: overrideTimeRange . value ,
28+ overrideTimeRange: props . context . timeSpec ,
3329 tz: props .context .tz ,
3430 additionalFilter: props .context .filters as ExploreFilterAll [], // TODO: Decide how to handle metric card filters.
3531 longCardTitles: props .chartOptions .long_card_titles ,
0 commit comments