From 9a7cdb5b911986c2080374ddfa123420579029a6 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 7 Feb 2022 18:43:05 +0100 Subject: [PATCH] feat(ui) - metrics post endpoint change --- .../CustomMetricWidget/CustomMetricWidget.tsx | 2 +- frontend/app/components/shared/AddWidgets.js | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx index 3a6414424..7efac8418 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx @@ -97,7 +97,7 @@ function CustomMetricWidget(props: Props) { return (
-
{metric.name + ' ' + metric.metricId}
+
{metric.name}
props.edit(metric)} /> diff --git a/frontend/app/components/shared/AddWidgets.js b/frontend/app/components/shared/AddWidgets.js index 273816469..ee1f334d3 100644 --- a/frontend/app/components/shared/AddWidgets.js +++ b/frontend/app/components/shared/AddWidgets.js @@ -1,9 +1,8 @@ import { connect } from 'react-redux'; import cn from 'classnames'; import withToggle from 'HOCs/withToggle'; -import { IconButton, SlideModal, NoContent, Popup } from 'UI'; +import { IconButton, Popup } from 'UI'; import { updateAppearance } from 'Duck/user'; -import { WIDGET_LIST } from 'Types/dashboard'; import stl from './addWidgets.css'; import OutsideClickDetectingDiv from 'Shared/OutsideClickDetectingDiv'; import { updateActiveState } from 'Duck/customMetrics'; @@ -35,12 +34,11 @@ export default class AddWidgets extends React.PureComponent { type: CUSTOM_METRICS, key: item.metricId, name: item.name, - })) + })).toJS(); } render() { const { disabled, widgets, type } = this.props; - // const widgets = WIDGET_LIST.filter(({ key, type }) => !appearance.dashboard[ key ] && type === this.props.type ); const filteredWidgets = type === CUSTOM_METRICS ? this.getCustomMetricWidgets() : widgets; return ( @@ -53,7 +51,7 @@ export default class AddWidgets extends React.PureComponent { icon="plus" outline onClick={ this.props.switchOpen } - disabled={ filteredWidgets.length === 0 } //TODO disabled after Custom fields filtering + disabled={ filteredWidgets.length === 0 } /> } content={ `Add a metric to this section.` }