From e9b23b1d5bdcdecccad579f34ece0ad6d8a83172 Mon Sep 17 00:00:00 2001 From: sebdet Date: Sun, 24 Jan 2021 18:12:36 +0100 Subject: Add New UI component for policies list Add new Ui components to list policies + the small refactoring of React Routes Issue-ID: POLICY-2925 Signed-off-by: sebdet Change-Id: I784d7c144a3a3af98a9d62b5d40b5172dbdaed47 Signed-off-by: sebdet (cherry picked from commit eb8e3f1dd891ac98f1bbaf35a2a0679146785236) --- ui-react/src/components/menu/MenuBar.js | 161 +++--- .../menu/__snapshots__/MenuBar.test.js.snap | 565 +++++++++++---------- 2 files changed, 389 insertions(+), 337 deletions(-) (limited to 'ui-react/src/components/menu') diff --git a/ui-react/src/components/menu/MenuBar.js b/ui-react/src/components/menu/MenuBar.js index 7cf56570b..40a3890a5 100644 --- a/ui-react/src/components/menu/MenuBar.js +++ b/ui-react/src/components/menu/MenuBar.js @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights + * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,94 +30,95 @@ import styled from 'styled-components'; import { Link } from 'react-router-dom'; const StyledLink = styled(Link)` - color: ${props => props.theme.menuFontColor}; - background-color: ${props => props.theme.menuBackgroundColor}; - font-weight: normal; - display: block; - width: 100%; - padding: .25rem 1.5rem; - clear: both; - text-align: inherit; - white-space: nowrap; - border: 0; - :hover { - text-decoration: none; - background-color: ${props => props.theme.menuHighlightedBackgroundColor}; - color: ${props => props.theme.menuHighlightedFontColor}; - } + color: ${props => props.theme.menuFontColor}; + background-color: ${props => props.theme.menuBackgroundColor}; + font-weight: normal; + display: block; + width: 100%; + padding: .25rem 1.5rem; + clear: both; + text-align: inherit; + white-space: nowrap; + border: 0; + :hover { + text-decoration: none; + background-color: ${props => props.theme.menuHighlightedBackgroundColor}; + color: ${props => props.theme.menuHighlightedFontColor}; + } `; const StyledNavLink = styled(Nav.Link)` - color: ${props => props.theme.menuFontColor}; - background-color: ${props => props.theme.menuBackgroundColor}; - font-weight: normal; - padding: .25rem 1.5rem; - :hover { - background-color: ${props => props.theme.menuHighlightedBackgroundColor}; - color: ${props => props.theme.menuHighlightedFontColor}; - } + color: ${props => props.theme.menuFontColor}; + background-color: ${props => props.theme.menuBackgroundColor}; + font-weight: normal; + padding: .25rem 1.5rem; + :hover { + background-color: ${props => props.theme.menuHighlightedBackgroundColor}; + color: ${props => props.theme.menuHighlightedFontColor}; + } `; const StyledNavDropdown = styled(NavDropdown)` - color: ${props => props.theme.menuFontColor}; - & .dropdown-toggle { - color: ${props => props.theme.menuFontColor}; - background-color: ${props => props.theme.backgroundColor}; - font-weight: normal; - :hover { - font-weight: bold; - } - } + color: ${props => props.theme.menuFontColor}; + & .dropdown-toggle { + color: ${props => props.theme.menuFontColor}; + background-color: ${props => props.theme.backgroundColor}; + font-weight: normal; + :hover { + font-weight: bold; + } + } `; export default class MenuBar extends React.Component { - state = { - loopName: this.props.loopName, - disabled: true - }; + state = { + loopName: this.props.loopName, + disabled: true + }; - componentWillReceiveProps(newProps) { - if (newProps.loopName !== OnapConstants.defaultLoopName) { - this.setState({ disabled: false }); - } else { - this.setState({ disabled: true }); - } - } + componentWillReceiveProps(newProps) { + if (newProps.loopName !== OnapConstants.defaultLoopName) { + this.setState({ disabled: false }); + } else { + this.setState({ disabled: true }); + } + } - render () { - return ( - - - View All Templates - - - Upload Tosca Model - View Tosca Models - Manage Metadata Dictionaries + render () { + return ( + + + View All Templates - - Create - Open - Close - Modify - - Properties - Refresh Status - - - Create and deploy to Policy Engine(SUBMIT) - Undeploy from Policy Engine (STOP) - ReDeploy to Policy Engine (RESTART) - Delete loop instance (DELETE) - - Deploy to DCAE (DEPLOY) - UnDeploy to DCAE (UNDEPLOY) - - - Wiki - Contact Us - User Info - - - ); - } + + Upload Tosca Model + View Tosca Models + Manage Metadata Dictionaries + View All Policies + + + Create + Open + Close + Modify + + Properties + Refresh Status + + + Create and deploy to Policy Engine(SUBMIT) + Undeploy from Policy Engine (STOP) + ReDeploy to Policy Engine (RESTART) + Delete loop instance (DELETE) + + Deploy to DCAE (DEPLOY) + UnDeploy to DCAE (UNDEPLOY) + + + Wiki + Contact Us + User Info + + + ); + } } diff --git a/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap b/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap index 92444ea3d..69a0e85db 100644 --- a/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap +++ b/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap @@ -15,29 +15,29 @@ exports[`Verify MenuBar Test the render method 1`] = ` "isStatic": false, "rules": Array [ " - color: ", + color: ", [Function], "; - background-color: ", + background-color: ", [Function], "; - font-weight: normal; - display: block; - width: 100%; - padding: .25rem 1.5rem; - clear: both; - text-align: inherit; - white-space: nowrap; - border: 0; - :hover { - text-decoration: none; - background-color: ", + font-weight: normal; + display: block; + width: 100%; + padding: .25rem 1.5rem; + clear: both; + text-align: inherit; + white-space: nowrap; + border: 0; + :hover { + text-decoration: none; + background-color: ", [Function], "; - color: ", + color: ", [Function], "; - } + } ", ], }, @@ -52,7 +52,7 @@ exports[`Verify MenuBar Test the render method 1`] = ` } } disabled={false} - to="/ViewLoopTemplatesModal" + to="/viewLoopTemplatesModal" > View All Templates @@ -70,29 +70,29 @@ exports[`Verify MenuBar Test the render method 1`] = ` "isStatic": false, "rules": Array [ " - color: ", + color: ", [Function], "; - background-color: ", + background-color: ", [Function], "; - font-weight: normal; - display: block; - width: 100%; - padding: .25rem 1.5rem; - clear: both; - text-align: inherit; - white-space: nowrap; - border: 0; - :hover { - text-decoration: none; - background-color: ", + font-weight: normal; + display: block; + width: 100%; + padding: .25rem 1.5rem; + clear: both; + text-align: inherit; + white-space: nowrap; + border: 0; + :hover { + text-decoration: none; + background-color: ", [Function], "; - color: ", + color: ", [Function], "; - } + } ", ], }, @@ -121,29 +121,29 @@ exports[`Verify MenuBar Test the render method 1`] = ` "isStatic": false, "rules": Array [ " - color: ", + color: ", [Function], "; - background-color: ", + background-color: ", [Function], "; - font-weight: normal; - display: block; - width: 100%; - padding: .25rem 1.5rem; - clear: both; - text-align: inherit; - white-space: nowrap; - border: 0; - :hover { - text-decoration: none; - background-color: ", + font-weight: normal; + display: block; + width: 100%; + padding: .25rem 1.5rem; + clear: both; + text-align: inherit; + white-space: nowrap; + border: 0; + :hover { + text-decoration: none; + background-color: ", [Function], "; - color: ", + color: ", [Function], "; - } + } ", ], }, @@ -172,29 +172,29 @@ exports[`Verify MenuBar Test the render method 1`] = ` "isStatic": false, "rules": Array [ " - color: ", + color: ", [Function], "; - background-color: ", + background-color: ", [Function], "; - font-weight: normal; - display: block; - width: 100%; - padding: .25rem 1.5rem; - clear: both; - text-align: inherit; - white-space: nowrap; - border: 0; - :hover { - text-decoration: none; - background-color: ", + font-weight: normal; + display: block; + width: 100%; + padding: .25rem 1.5rem; + clear: both; + text-align: inherit; + white-space: nowrap; + border: 0; + :hover { + text-decoration: none; + background-color: ", [Function], "; - color: ", + color: ", [Function], "; - } + } ", ], }, @@ -209,10 +209,61 @@ exports[`Verify MenuBar Test the render method 1`] = ` } } disabled={false} - to="/ManageDictionaries" + to="/manageDictionaries" > Manage Metadata Dictionaries + + View All Policies +