diff --git a/awx/ui_next/src/App.jsx b/awx/ui_next/src/App.jsx index 69d5dd2417..a6f1718a0e 100644 --- a/awx/ui_next/src/App.jsx +++ b/awx/ui_next/src/App.jsx @@ -20,7 +20,7 @@ import Login from './screens/Login'; import { isAuthenticated } from './util/auth'; import { getLanguageWithoutRegionCode } from './util/language'; import { dynamicActivate, locales } from './i18nLoader'; -import ObservabilityMetrics from './screens/ObservabilityMetrics'; +import Metrics from './screens/Metrics'; import getRouteConfig from './routeConfig'; import SubscriptionEdit from './screens/Setting/Subscription/SubscriptionEdit'; @@ -59,6 +59,9 @@ const AuthorizedRoutes = ({ routeConfig }) => { )) .concat( + + + , @@ -88,7 +91,6 @@ function App() { const { hash, search, pathname } = useLocation(); return ( -<<<<<<< HEAD @@ -110,47 +112,6 @@ function App() { -======= - - - {({ i18n }) => ( - - - - - - - - - - - - - - - {getRouteConfig(i18n) - .flatMap(({ routes }) => routes) - .map(({ path, screen: Screen }) => ( - - - - )) - .concat( - - - , - - - - )} - - - - - - )} - ->>>>>>> Adds observability metrics chart ); } diff --git a/awx/ui_next/src/screens/InstanceGroup/InstanceGroupList/InstanceGroupList.test.jsx b/awx/ui_next/src/screens/InstanceGroup/InstanceGroupList/InstanceGroupList.test.jsx index b4c702bef2..683381fecd 100644 --- a/awx/ui_next/src/screens/InstanceGroup/InstanceGroupList/InstanceGroupList.test.jsx +++ b/awx/ui_next/src/screens/InstanceGroup/InstanceGroupList/InstanceGroupList.test.jsx @@ -164,6 +164,7 @@ describe('', () => { }); test('should render deletion error modal', async () => { + jest.setTimeout(5000 * 4); InstanceGroupsAPI.destroy.mockRejectedValue( new Error({ response: { diff --git a/awx/ui_next/src/screens/ObservabilityMetrics/LineChart.jsx b/awx/ui_next/src/screens/Metrics/LineChart.jsx similarity index 94% rename from awx/ui_next/src/screens/ObservabilityMetrics/LineChart.jsx rename to awx/ui_next/src/screens/Metrics/LineChart.jsx index 48872214b3..594d77b9da 100644 --- a/awx/ui_next/src/screens/ObservabilityMetrics/LineChart.jsx +++ b/awx/ui_next/src/screens/Metrics/LineChart.jsx @@ -1,6 +1,5 @@ import React, { useEffect, useCallback } from 'react'; import * as d3 from 'd3'; -import { PageContextConsumer } from '@patternfly/react-core'; function LineChart({ data, helpText }) { const count = data[0]?.values.length; @@ -256,14 +255,4 @@ function LineChart({ data, helpText }) { return
; } -const withPageContext = Component => { - return function contextComponent(props) { - return ( - - {pageContext => } - - ); - }; -}; - -export default withPageContext(LineChart); +export default LineChart; diff --git a/awx/ui_next/src/screens/ObservabilityMetrics/LineChart.test.jsx b/awx/ui_next/src/screens/Metrics/LineChart.test.jsx similarity index 100% rename from awx/ui_next/src/screens/ObservabilityMetrics/LineChart.test.jsx rename to awx/ui_next/src/screens/Metrics/LineChart.test.jsx diff --git a/awx/ui_next/src/screens/ObservabilityMetrics/ObservabilityMetrics.jsx b/awx/ui_next/src/screens/Metrics/Metrics.jsx similarity index 62% rename from awx/ui_next/src/screens/ObservabilityMetrics/ObservabilityMetrics.jsx rename to awx/ui_next/src/screens/Metrics/Metrics.jsx index 0b08f00036..90baa054ab 100644 --- a/awx/ui_next/src/screens/ObservabilityMetrics/ObservabilityMetrics.jsx +++ b/awx/ui_next/src/screens/Metrics/Metrics.jsx @@ -18,6 +18,7 @@ import LineChart from './LineChart'; import { MetricsAPI, InstancesAPI } from '../../api'; import useRequest from '../../util/useRequest'; import ContentEmpty from '../../components/ContentEmpty'; +import ScreenHeader from '../../components/ScreenHeader/ScreenHeader'; import ContentError from '../../components/ContentError'; let count = [0]; @@ -43,7 +44,7 @@ function useInterval(callback, delay, instance, metric) { }, [callback, delay, instance, metric]); return { count }; } -function ObservabilityMetrics({ i18n }) { +function Metrics({ i18n }) { const [instanceIsOpen, setInstanceIsOpen] = useState(false); const [instance, setInstance] = useState(null); const [metric, setMetric] = useState(null); @@ -154,7 +155,6 @@ function ObservabilityMetrics({ i18n }) { fetchInstances(); }, [fetchInstances]); if (fetchInitialError || updateError) { - console.log('here'); return ( @@ -166,74 +166,78 @@ function ObservabilityMetrics({ i18n }) { ); } return ( - - - - - - - {i18n._(t`Instance`)} - - - - {i18n._(t`Metric`)} - - - - - - - - - {instance && metric ? ( - Object.keys(renderedData).length > 0 && ( - + + + + + + + + + {i18n._(t`Instance`)} + + + + {i18n._(t`Metric`)} + + + + + + + + + {instance && metric ? ( + Object.keys(renderedData).length > 0 && ( + + ) + ) : ( + - ) - ) : ( - - )} - - - + )} + + + + ); } -export default withI18n()(ObservabilityMetrics); +export default withI18n()(Metrics); diff --git a/awx/ui_next/src/screens/ObservabilityMetrics/ObservabilityMetrics.test.jsx b/awx/ui_next/src/screens/Metrics/Metrics.test.jsx similarity index 89% rename from awx/ui_next/src/screens/ObservabilityMetrics/ObservabilityMetrics.test.jsx rename to awx/ui_next/src/screens/Metrics/Metrics.test.jsx index 4fcf8a86a5..fb74d6d929 100644 --- a/awx/ui_next/src/screens/ObservabilityMetrics/ObservabilityMetrics.test.jsx +++ b/awx/ui_next/src/screens/Metrics/Metrics.test.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { mountWithContexts } from '../../../testUtils/enzymeHelpers'; -import ObservabilityMetrics from './ObservabilityMetrics'; +import Metrics from './Metrics'; import { MetricsAPI, InstancesAPI } from '../../api'; jest.mock('../../api/models/Instances'); @@ -23,11 +23,11 @@ MetricsAPI.read.mockResolvedValue({ }, }); -describe('', () => { +describe('', () => { let wrapper; beforeEach(async () => { await act(async () => { - wrapper = mountWithContexts(); + wrapper = mountWithContexts(); }); }); afterEach(() => { @@ -35,7 +35,7 @@ describe('', () => { jest.clearAllMocks(); }); test('should mound properly', () => { - expect(wrapper.find('ObservabilityMetrics').length).toBe(1); + expect(wrapper.find('Metrics').length).toBe(1); expect(wrapper.find('EmptyStateBody').length).toBe(1); expect(wrapper.find('ChartLine').length).toBe(0); }); diff --git a/awx/ui_next/src/screens/Metrics/index.js b/awx/ui_next/src/screens/Metrics/index.js new file mode 100644 index 0000000000..8e5880233f --- /dev/null +++ b/awx/ui_next/src/screens/Metrics/index.js @@ -0,0 +1 @@ +export { default } from './Metrics'; diff --git a/awx/ui_next/src/screens/ObservabilityMetrics/index.js b/awx/ui_next/src/screens/ObservabilityMetrics/index.js deleted file mode 100644 index e1ebe1cb96..0000000000 --- a/awx/ui_next/src/screens/ObservabilityMetrics/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './ObservabilityMetrics';