From f3474f081150a3f889e915d3e8eabaee74fc83b6 Mon Sep 17 00:00:00 2001 From: Kia Lam Date: Thu, 3 Feb 2022 09:32:23 -0800 Subject: [PATCH] Add legend toggle to header. --- awx/ui/src/screens/TopologyView/Header.js | 53 +++++++++++++++++++ awx/ui/src/screens/TopologyView/MeshGraph.js | 4 +- .../src/screens/TopologyView/TopologyView.js | 18 +++++-- 3 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 awx/ui/src/screens/TopologyView/Header.js diff --git a/awx/ui/src/screens/TopologyView/Header.js b/awx/ui/src/screens/TopologyView/Header.js new file mode 100644 index 0000000000..096d79ce22 --- /dev/null +++ b/awx/ui/src/screens/TopologyView/Header.js @@ -0,0 +1,53 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import { t } from '@lingui/macro'; +import { + PageSection, + PageSectionVariants, + Switch, + Title, + Tooltip, +} from '@patternfly/react-core'; + +const Header = ({ title, handleSwitchToggle, toggleState }) => { + const { light } = PageSectionVariants; + + return ( + +
+
+ + {title} + +
+
+ + handleSwitchToggle(!toggleState)} + /> + +
+
+
+ ); +}; + +Header.propTypes = { + title: PropTypes.string.isRequired, +}; + +export default Header; diff --git a/awx/ui/src/screens/TopologyView/MeshGraph.js b/awx/ui/src/screens/TopologyView/MeshGraph.js index 6644fae22a..d9b4a98a91 100644 --- a/awx/ui/src/screens/TopologyView/MeshGraph.js +++ b/awx/ui/src/screens/TopologyView/MeshGraph.js @@ -8,7 +8,7 @@ import Legend from './Legend'; import Tooltip from './Tooltip'; // function MeshGraph({ data }) { -function MeshGraph() { +function MeshGraph({ showLegend }) { const [isNodeSelected, setIsNodeSelected] = useState(false); const [selectedNode, setSelectedNode] = useState(null); const [nodeDetail, setNodeDetail] = useState(null); @@ -517,7 +517,7 @@ function MeshGraph() { return (
- + {showLegend && } - - +
- {!isLoading && } + + {!isLoading && ( + + )} +