diff --git a/backstage-plugin/plugins/open-dora/src/components/DashboardComponent/DashboardComponent.tsx b/backstage-plugin/plugins/open-dora/src/components/DashboardComponent/DashboardComponent.tsx
index 985c10b..7383c08 100644
--- a/backstage-plugin/plugins/open-dora/src/components/DashboardComponent/DashboardComponent.tsx
+++ b/backstage-plugin/plugins/open-dora/src/components/DashboardComponent/DashboardComponent.tsx
@@ -10,12 +10,10 @@ import { getEntityRelations, useEntity } from '@backstage/plugin-catalog-react';
import { CircularProgress, Grid } from '@material-ui/core';
import React from 'react';
import { useTranslation } from 'react-i18next';
+import { useMetricBenchmark } from '../../hooks/MetricBenchmarkHook';
+import { useMetricData } from '../../hooks/MetricDataHook';
import '../../i18n';
import { MetricContext } from '../../services/MetricContext';
-import {
- useMetricData,
- useMetricOverview,
-} from '../../services/MetricDataHook';
import { BarChartComponent } from '../BarChartComponent/BarChartComponent';
import { DropdownComponent } from '../DropdownComponent/DropdownComponent';
import { HighlightTextBoxComponent } from '../HighlightTextBoxComponent/HighlightTextBoxComponent';
@@ -51,15 +49,15 @@ const ChartGridItem = ({ type, label }: { type: string; label: string }) => {
);
};
-const OverviewGridItem = ({ type }: { type: string }) => {
+const BenchmarkGridItem = ({ type }: { type: string }) => {
const [t] = useTranslation();
- const { overview, error } = useMetricOverview(type);
+ const { benchmark, error } = useMetricBenchmark(type);
- const testOrProgressComponent = overview ? (
+ const testOrProgressComponent = benchmark ? (
@@ -123,7 +121,7 @@ export const DashboardComponent = ({
-
+
{
+ const groupDataService = useApi(groupDataServiceApiRef);
+ const [benchmark, setDfBenchmark] = useState();
+ const [error, setError] = useState();
+
+ useEffect(() => {
+ groupDataService.retrieveBenchmarkData({ type: type }).then(response => {
+ setDfBenchmark(response.key);
+ }, setError);
+ }, [groupDataService, type]);
+
+ return { error: error, benchmark: benchmark };
+};
diff --git a/backstage-plugin/plugins/open-dora/src/services/MetricDataHook.ts b/backstage-plugin/plugins/open-dora/src/hooks/MetricDataHook.ts
similarity index 59%
rename from backstage-plugin/plugins/open-dora/src/services/MetricDataHook.ts
rename to backstage-plugin/plugins/open-dora/src/hooks/MetricDataHook.ts
index 0ae19d4..99c2a5d 100644
--- a/backstage-plugin/plugins/open-dora/src/services/MetricDataHook.ts
+++ b/backstage-plugin/plugins/open-dora/src/hooks/MetricDataHook.ts
@@ -1,9 +1,8 @@
import { useApi } from '@backstage/core-plugin-api';
import { useContext, useEffect, useState } from 'react';
-import { dfBenchmarkKey } from '../models/DfBenchmarkData';
import { MetricData } from '../models/MetricData';
-import { groupDataServiceApiRef } from './GroupDataService';
-import { MetricContext } from './MetricContext';
+import { groupDataServiceApiRef } from '../services/GroupDataService';
+import { MetricContext } from '../services/MetricContext';
export const useMetricData = (type: string) => {
const groupDataService = useApi(groupDataServiceApiRef);
@@ -30,17 +29,3 @@ export const useMetricData = (type: string) => {
return { error: error, chartData: chartData };
};
-
-export const useMetricOverview = (type: string) => {
- const groupDataService = useApi(groupDataServiceApiRef);
- const [overview, setDfOverview] = useState();
- const [error, setError] = useState();
-
- useEffect(() => {
- groupDataService.retrieveBenchmarkData({ type: type }).then(response => {
- setDfOverview(response.key);
- }, setError);
- }, [groupDataService, type]);
-
- return { error: error, overview: overview };
-};