ui: check for metric type

This commit is contained in:
nick-delirium 2024-12-03 11:03:58 +01:00
parent 48a573399e
commit c41deb1af2
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
2 changed files with 4 additions and 4 deletions

View file

@ -135,11 +135,10 @@ function CategoryTab({ tab, inCards }: { tab: string, inCards?: boolean }) {
const handleCardSelection = (card: string) => {
metricStore.init();
const selectedCard = CARD_LIST.find((c) => c.key === card) as CardType;
const cardData: any = {
metricType: selectedCard.cardType,
name: selectedCard.title,
metricOf: selectedCard.metricOf
metricOf: selectedCard.metricOf,
};
if (selectedCard.filters) {

View file

@ -152,10 +152,11 @@ function WidgetChart(props: Props) {
}
prevMetricRef.current = metric;
const timestmaps = drillDownPeriod.toTimestamps();
const isTimeseries = metric.metricType === TIMESERIES;
const payload = isSaved
// TODO: remove after backend adds support for more view types
? { ...metricParams, viewType: 'lineChart' }
: { ...params, ...timestmaps, ...metric.toJson(), viewType: 'lineChart' };
? { ...metricParams, viewType: isTimeseries ? 'lineChart' : metric.viewType }
: { ...params, ...timestmaps, ...metric.toJson(), viewType: isTimeseries ? 'lineChart' : metric.viewType };
debounceRequest(
metric,
payload,