diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricTable/CustomMetricTable.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricTable/CustomMetricTable.tsx index b9d0f73a2..272a886f9 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricTable/CustomMetricTable.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricTable/CustomMetricTable.tsx @@ -26,14 +26,14 @@ const getColumns = (metric) => { interface Props { metric?: any, data: any; - onClick?: (filters) => void; + onClick?: (filters: any) => void; isTemplate?: boolean; } -function CustomMetriTable(props: Props) { +function CustomMetricTable(props: Props) { const { metric = {}, data = { values: [] }, onClick = () => null, isTemplate } = props; const rows = List(data.values); - const onClickHandler = (event, data) => { + const onClickHandler = (event: any, data: any) => { const filters = Array(); let filter = { ...filtersMap[metric.metricOf] } filter.value = [data.name] @@ -64,4 +64,4 @@ function CustomMetriTable(props: Props) { ) } -export default CustomMetriTable; +export default CustomMetricTable; diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx index 51420daf8..fe83c04b8 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx @@ -29,7 +29,6 @@ interface Props { metric: any; // loading?: boolean; data?: any; - showSync?: boolean; compare?: boolean; period?: any; onClickEdit: (e) => void; @@ -37,50 +36,26 @@ interface Props { setShowAlerts: (showAlerts) => void; setAlertMetricId: (id) => void; onAlertClick: (e) => void; - init: (metric) => void; + init: (metric: any) => void; edit: (setDefault?) => void; setActiveWidget: (widget) => void; updateActiveState: (metricId, state) => void; isTemplate?: boolean; } function CustomMetricWidget(props: Props) { - const { metric, showSync, compare, period, isTemplate } = props; + const { metric, period, isTemplate } = props; const [loading, setLoading] = useState(false) const [data, setData] = useState([]); - const [seriesMap, setSeriesMap] = useState([]); + // const [seriesMap, setSeriesMap] = useState([]); const colors = Styles.customMetricColors; const params = customParams(period.rangeName) - const metricParams = { ...params, metricId: metric.metricId, viewType: 'lineChart', startDate: period.start, endDate: period.end } + // const metricParams = { ...params, metricId: metric.metricId, viewType: 'lineChart', startDate: period.start, endDate: period.end } const isLineChart = metric.viewType === 'lineChart'; const isProgress = metric.viewType === 'progress'; const isTable = metric.viewType === 'table'; const isPieChart = metric.viewType === 'pieChart'; - // useEffect(() => { - // new APIClient()['post'](`/custom_metrics/${metricParams.metricId}/chart`, { ...metricParams, q: metric.name }) - // .then(response => response.json()) - // .then(({ errors, data }) => { - // if (errors) { - // console.log('err', errors) - // } else { - // const namesMap = data - // .map(i => Object.keys(i)) - // .flat() - // .filter(i => i !== 'time' && i !== 'timestamp') - // .reduce((unique: any, item: any) => { - // if (!unique.includes(item)) { - // unique.push(item); - // } - // return unique; - // }, []); - - // setSeriesMap(namesMap); - // setData(getChartFormatter(period)(data)); - // } - // }).finally(() => setLoading(false)); - // }, [period]) - const clickHandlerTable = (filters) => { const activeWidget = { widget: metric, @@ -147,7 +122,6 @@ function CustomMetricWidget(props: Props) {