From 7e3ae1c22e2260662a8f83aec851a67af1411edc Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 10 Jan 2025 17:49:18 +0100 Subject: [PATCH] ui: small ui fixes --- frontend/app/components/Alerts/AlertForm.js | 8 ++++++-- frontend/app/components/Charts/BarChart.tsx | 6 ++++++ frontend/app/components/Client/Projects/ProjectList.tsx | 3 +-- .../components/Dashboard/components/Alerts/NewAlert.tsx | 1 + frontend/app/constants/card.ts | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/frontend/app/components/Alerts/AlertForm.js b/frontend/app/components/Alerts/AlertForm.js index 852780e9b..bf3a0f58d 100644 --- a/frontend/app/components/Alerts/AlertForm.js +++ b/frontend/app/components/Alerts/AlertForm.js @@ -52,11 +52,15 @@ function AlertForm(props) { onDelete, style = {height: "calc('100vh - 40px')"}, } = props; - const {alertsStore} = useStore() + const {alertsStore, metricStore} = useStore() const { - triggerOptions, + triggerOptions: allTriggerSeries, loading, } = alertsStore + + const triggerOptions = metricStore.instance.series.length > 0 ? allTriggerSeries.filter(s => { + return metricStore.instance.series.findIndex(ms => ms.seriesId === s.value) !== -1 + }) : allTriggerSeries const instance = alertsStore.instance const deleting = loading diff --git a/frontend/app/components/Charts/BarChart.tsx b/frontend/app/components/Charts/BarChart.tsx index fbc63fd93..94f599bad 100644 --- a/frontend/app/components/Charts/BarChart.tsx +++ b/frontend/app/components/Charts/BarChart.tsx @@ -12,6 +12,7 @@ echarts.use([BarChart]); interface BarChartProps extends DataProps { label?: string; + onClick?: (event: any) => void; } function ORBarChart(props: BarChartProps) { @@ -71,6 +72,11 @@ function ORBarChart(props: BarChartProps) { dataset: datasets, series, }); + chart.on('click', (event) => { + const index = event.dataIndex; + const timestamp = (window as any).__timestampMap?.[chartUuid.current]?.[index]; + props.onClick?.({ activePayload: [{ payload: { timestamp }}]}) + }) return () => { chart.dispose(); diff --git a/frontend/app/components/Client/Projects/ProjectList.tsx b/frontend/app/components/Client/Projects/ProjectList.tsx index 8d5e9774f..5f28629ca 100644 --- a/frontend/app/components/Client/Projects/ProjectList.tsx +++ b/frontend/app/components/Client/Projects/ProjectList.tsx @@ -3,8 +3,7 @@ import { Avatar, Button, Input, Menu, MenuProps, Progress, Typography } from 'an import { useStore } from '@/mstore'; import Project from '@/mstore/types/project'; import { observer } from 'mobx-react-lite'; -import { AppWindowMac, EditIcon, Smartphone } from 'lucide-react'; -import { PencilIcon } from '.store/lucide-react-virtual-3cff663764/package'; +import { AppWindowMac, EditIcon, Smartphone, PencilIcon } from 'lucide-react'; import ProjectForm from 'Components/Client/Projects/ProjectForm'; import { useModal } from 'Components/ModalContext'; diff --git a/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx b/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx index 02b602754..aceeccf3a 100644 --- a/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx +++ b/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx @@ -76,6 +76,7 @@ const NewAlert = (props: IProps) => { triggerOptions, loading, } = alertsStore + const deleting = loading const webhooks = settingsStore.webhooks const fetchWebhooks = settingsStore.fetchWebhooks diff --git a/frontend/app/constants/card.ts b/frontend/app/constants/card.ts index 675aaf3cc..0143c8c17 100644 --- a/frontend/app/constants/card.ts +++ b/frontend/app/constants/card.ts @@ -49,12 +49,12 @@ export const TYPE_ICONS = { } as const export const TYPE_NAMES = { [LIBRARY]: 'Library', - [TIMESERIES]: 'Timeseries', + [TIMESERIES]: 'Trend', [TABLE]: 'Table', [HEATMAP]: 'Heatmap', [FUNNEL]: 'Funnel', [ERRORS]: 'Errors', - [USER_PATH]: 'User Path', + [USER_PATH]: 'Journeys', [RETENTION]: 'Retention', [INSIGHTS]: 'Insights', [PERFORMANCE]: 'Performance',