From 7910b9e8725203be72105b4dec46a266f1dadf57 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Wed, 22 Jun 2022 12:10:40 +0200 Subject: [PATCH] feat(ui) - metrics list icons --- .../MetricListItem/MetricListItem.tsx | 39 ++++++++++++++----- .../components/MetricsList/MetricsList.tsx | 4 +- .../components/WidgetView/WidgetView.tsx | 7 +++- .../shared/Breadcrumb/Breadcrumb.tsx | 4 +- frontend/app/components/ui/SVG.tsx | 1 + frontend/app/svg/icons/circle-fill.svg | 3 ++ 6 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 frontend/app/svg/icons/circle-fill.svg diff --git a/frontend/app/components/Dashboard/components/MetricListItem/MetricListItem.tsx b/frontend/app/components/Dashboard/components/MetricListItem/MetricListItem.tsx index cbeb4ee4e..4dcfa0d61 100644 --- a/frontend/app/components/Dashboard/components/MetricListItem/MetricListItem.tsx +++ b/frontend/app/components/Dashboard/components/MetricListItem/MetricListItem.tsx @@ -1,18 +1,21 @@ import React from 'react'; import { Icon, NoContent, Label, Link, Pagination } from 'UI'; import { checkForRecent, formatDateTimeDefault, convertTimestampToUtcTimestamp } from 'App/date'; +import { getIcon } from 'react-toastify/dist/components'; interface Props { metric: any; } -function DashboardLink({ dashboards}) { +function DashboardLink({ dashboards}: any) { return ( - dashboards.map(dashboard => ( + dashboards.map((dashboard: any) => ( - -
-
ยท
+ +
+
+ +
{dashboard.name}
@@ -23,14 +26,30 @@ function DashboardLink({ dashboards}) { function MetricListItem(props: Props) { const { metric } = props; + + const getIcon = (metricType: string) => { + switch (metricType) { + case 'funnel': + return 'filter'; + case 'table': + return 'list-alt'; + case 'timeseries': + return 'bar-chart-line'; + } + } return (
-
- - {metric.name} - +
+
+
+ +
+ + {metric.name} + +
-
+ {/*
*/}
diff --git a/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx b/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx index 8ed8df601..3cc6dff40 100644 --- a/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx +++ b/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx @@ -39,8 +39,8 @@ function MetricsList(props: Props) { >
-
Title
-
Type
+
Metric
+ {/*
Type
*/}
Dashboards
Owner
Visibility
diff --git a/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx b/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx index de9a09793..527dbe32b 100644 --- a/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx +++ b/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx @@ -22,6 +22,11 @@ function WidgetView(props: Props) { const widget = useObserver(() => metricStore.instance); const loading = useObserver(() => metricStore.isLoading); const [expanded, setExpanded] = useState(!metricId || metricId === 'create'); + + const dashboards = useObserver(() => dashboardStore.dashboards); + const dashboard = useObserver(() => dashboards.find((d: any) => d.dashboardId == dashboardId)); + const dashboardName = dashboard ? dashboard.name : null; + React.useEffect(() => { if (metricId && metricId !== 'create') { @@ -45,7 +50,7 @@ function WidgetView(props: Props) {
diff --git a/frontend/app/components/shared/Breadcrumb/Breadcrumb.tsx b/frontend/app/components/shared/Breadcrumb/Breadcrumb.tsx index 67a1a120d..7f764749f 100644 --- a/frontend/app/components/shared/Breadcrumb/Breadcrumb.tsx +++ b/frontend/app/components/shared/Breadcrumb/Breadcrumb.tsx @@ -5,11 +5,11 @@ import { Link } from 'react-router-dom'; interface Props { items: any } -function Breadcrumb(props) { +function Breadcrumb(props: Props) { const { items } = props; return (
- {items.map((item, index) => { + {items.map((item: any, index: any) => { if (index === items.length - 1) { return ( {item.label} diff --git a/frontend/app/components/ui/SVG.tsx b/frontend/app/components/ui/SVG.tsx index f24a7096a..5789ce273 100644 --- a/frontend/app/components/ui/SVG.tsx +++ b/frontend/app/components/ui/SVG.tsx @@ -101,6 +101,7 @@ const SVG = (props: Props) => { case 'chevron-left': return ; case 'chevron-right': return ; case 'chevron-up': return ; + case 'circle-fill': return ; case 'circle': return ; case 'clipboard-list-check': return ; case 'clock': return ; diff --git a/frontend/app/svg/icons/circle-fill.svg b/frontend/app/svg/icons/circle-fill.svg new file mode 100644 index 000000000..e0cce9191 --- /dev/null +++ b/frontend/app/svg/icons/circle-fill.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file