Skip to content

Commit

Permalink
fix(dashboards): preserve granularity in explore link
Browse files Browse the repository at this point in the history
  • Loading branch information
filipgutica committed Dec 6, 2024
1 parent 3faba0c commit 25b1468
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import TopNTableRenderer from './TopNTableRenderer.vue'
import composables from '../composables'
import { KUI_COLOR_TEXT_NEUTRAL, KUI_ICON_SIZE_40 } from '@kong/design-tokens'
import { MoreIcon, EditIcon } from '@kong/icons'
import type { AiExploreAggregations, AiExploreQuery, AnalyticsBridge, ExploreAggregations, ExploreQuery, ExploreResultV4, QueryableAiExploreDimensions, QueryableExploreDimensions, TimeRangeV4 } from '@kong-ui-public/analytics-utilities'
import { msToGranularity, type AiExploreAggregations, type AiExploreQuery, type AnalyticsBridge, type ExploreAggregations, type ExploreQuery, type ExploreResultV4, type QueryableAiExploreDimensions, type QueryableExploreDimensions, type TimeRangeV4 } from '@kong-ui-public/analytics-utilities'
import { CsvExportModal } from '@kong-ui-public/analytics-chart'
const PADDING_SIZE = parseInt(KUI_SPACE_70, 10)
Expand Down Expand Up @@ -128,6 +128,7 @@ const exploreLink = computed(() => {
metrics: props.definition.query.metrics as ExploreAggregations[] | AiExploreAggregations[] ?? [],
dimensions: props.definition.query.dimensions as QueryableExploreDimensions[] | QueryableAiExploreDimensions[] ?? [],
time_range: props.definition.query.time_range as TimeRangeV4 || props.context.timeSpec,
granularity: props.definition.query.granularity || chartDataGranularity.value,
} as ExploreQuery | AiExploreQuery
// Explore only supports advanced or ai
Expand Down Expand Up @@ -169,6 +170,10 @@ const componentData = computed(() => {
}
})
const chartDataGranularity = computed(() => {
return chartData.value ? msToGranularity(chartData.value.meta.granularity_ms) : undefined
})
const editTile = () => {
emit('edit-tile', props.definition)
}
Expand Down

0 comments on commit 25b1468

Please sign in to comment.