|
| 1 | +<template> |
| 2 | + <KCard |
| 3 | + class="mb-3 analytics-overview" |
| 4 | + data-testid="analytics-metrics-overview" |
| 5 | + > |
| 6 | + <template #body> |
| 7 | + <MetricsProvider |
| 8 | + v-bind="metricProviderProps" |
| 9 | + > |
| 10 | + <MetricsConsumer /> |
| 11 | + </MetricsProvider> |
| 12 | + </template> |
| 13 | + </KCard> |
| 14 | +</template> |
| 15 | + |
| 16 | +<script setup lang="ts"> |
| 17 | +import '@kong-ui-public/metric-cards/dist/style.css' |
| 18 | +
|
| 19 | +// Enums and Interfaces |
| 20 | +import { Timeframe } from '@kong-ui-public/analytics-utilities' |
| 21 | +
|
| 22 | +// Components |
| 23 | +import MetricsProvider from './MetricsProvider.vue' |
| 24 | +import { EXPLORE_V2_DIMENSIONS, EXPLORE_V2_FILTER_TYPES, MetricsConsumer } from '@kong-ui-public/analytics-metric-provider' |
| 25 | +import { computed } from 'vue' |
| 26 | +
|
| 27 | +const props = defineProps<{ |
| 28 | + applicationId: string, |
| 29 | + productVersionIds?: string[], |
| 30 | + timeframe: Timeframe, |
| 31 | +}>() |
| 32 | +
|
| 33 | +const metricProviderProps = computed(() => ({ |
| 34 | + overrideTimeframe: props.timeframe, |
| 35 | + additionalFilter: [ |
| 36 | + { |
| 37 | + dimension: EXPLORE_V2_DIMENSIONS.APPLICATION, |
| 38 | + type: EXPLORE_V2_FILTER_TYPES.IN, |
| 39 | + values: [props.applicationId] |
| 40 | + }, |
| 41 | + ...(props.productVersionIds?.length > 0 |
| 42 | + ? [{ |
| 43 | + dimension: EXPLORE_V2_DIMENSIONS.API_PRODUCT_VERSION, |
| 44 | + type: EXPLORE_V2_FILTER_TYPES.IN, |
| 45 | + values: props.productVersionIds |
| 46 | + }] |
| 47 | + : []) |
| 48 | + ] |
| 49 | +})) |
| 50 | +
|
| 51 | +</script> |
| 52 | + |
| 53 | +<style lang="scss"> |
| 54 | +@import '../../assets/variables.scss'; |
| 55 | +
|
| 56 | +.analytics-overview { |
| 57 | + background-color: var(--white, #fff) !important; |
| 58 | +
|
| 59 | + .kong-ui-public-metric-card-container { |
| 60 | + .metricscard { |
| 61 | + @media (min-width: $viewport-md) { |
| 62 | + max-width: 220px; |
| 63 | + justify-content: space-around; |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | +} |
| 68 | +</style> |
0 commit comments