From 6c00eb94719c575c2123d048e6d652a7e72a84af Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 4 Mar 2022 12:50:31 +0100 Subject: [PATCH] feat(ui) - custom metrics - wip --- .../app/components/Dashboard/Dashboard.js | 2 +- .../CustomMetricPercentage.tsx | 3 +- .../CustomMetricWidgetPreview.tsx | 58 ++++++++++--------- .../CustomMetricsWidgets.tsx | 39 ++++++++----- .../CustomMetricForm/CustomMetricForm.tsx | 4 +- frontend/app/svg/icons/pie-chart-fill.svg | 3 + 6 files changed, 65 insertions(+), 44 deletions(-) create mode 100644 frontend/app/svg/icons/pie-chart-fill.svg diff --git a/frontend/app/components/Dashboard/Dashboard.js b/frontend/app/components/Dashboard/Dashboard.js index 8ad8ecdf8..2b71ef253 100644 --- a/frontend/app/components/Dashboard/Dashboard.js +++ b/frontend/app/components/Dashboard/Dashboard.js @@ -243,7 +243,7 @@ export default class Dashboard extends React.PureComponent { } > -
+
null}/>
diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricPercentage/CustomMetricPercentage.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricPercentage/CustomMetricPercentage.tsx index cfd0d5295..ed4f3cc85 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricPercentage/CustomMetricPercentage.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricPercentage/CustomMetricPercentage.tsx @@ -11,7 +11,8 @@ function CustomMetriPercentage(props: Props) { return (
{data.count}
-
{`${data.previousCount} ( ${data.countProgress}% ) from previous period.`}
+
{`${data.previousCount} ( ${data.countProgress}% )`}
+
from previous period.
) } diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidgetPreview/CustomMetricWidgetPreview.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidgetPreview/CustomMetricWidgetPreview.tsx index eb37268fc..55d07da1f 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidgetPreview/CustomMetricWidgetPreview.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidgetPreview/CustomMetricWidgetPreview.tsx @@ -94,39 +94,45 @@ function CustomMetricWidget(props: Props) { return (
-
+
Preview
{isTimeSeries && ( - + <> + Visualization + + )} {isTable && ( - + <> + Visualization + + )} -
+
Time Range item.active); useEffect(() => { props.fetchList() @@ -23,27 +24,35 @@ function CustomMetricsWidgets(props: Props) { return ( <> - {list.map((item: any) => ( - - { - setActiveMetricId(item.metricId) - props.initAlert({ query: { left: item.series.first().seriesId }}) - }} - /> - - ))} +
+ {activeList.map((item: any) => ( + + { + setActiveMetricId(item.metricId) + props.initAlert({ query: { left: item.series.first().seriesId }}) + }} + /> + + ))} +
{list.size === 0 && (
-
Be proactive by monitoring the metrics you care about the most.
+
Be proactive by monitoring the metrics you care about the most.
)} + {list.size > 0 && activeList && activeList.size === 0 && ( +
+
It's blank here, add a metric to this section.
+
+ )} + ({ - list: state.getIn(['customMetrics', 'list']).filter(item => item.active), + list: state.getIn(['customMetrics', 'list']), }), { fetchList, initAlert })(CustomMetricsWidgets); \ No newline at end of file diff --git a/frontend/app/components/shared/CustomMetrics/CustomMetricForm/CustomMetricForm.tsx b/frontend/app/components/shared/CustomMetrics/CustomMetricForm/CustomMetricForm.tsx index ea923a6e1..4ff533029 100644 --- a/frontend/app/components/shared/CustomMetrics/CustomMetricForm/CustomMetricForm.tsx +++ b/frontend/app/components/shared/CustomMetrics/CustomMetricForm/CustomMetricForm.tsx @@ -168,7 +168,9 @@ function CustomMetricForm(props: Props) {
- + {metric.series && metric.series.size > 0 && metric.series.take(isTable ? 1 : metric.series.size).map((series: any, index: number) => (
+ + \ No newline at end of file