From c8d6130e6355a6f8f460c114ed7bac0221eb0020 Mon Sep 17 00:00:00 2001 From: sebdet Date: Thu, 4 Jul 2019 15:50:34 +0200 Subject: [PATCH] More modular approach Modular approach for React components and CSS + theming Issue-ID: CLAMP-418 Change-Id: I359f31e92492ae75ac26ef297abde822c6cd56ea Signed-off-by: sebdet --- ui-react/package.json | 11 +- ui-react/src/ClampHeader.js | 45 -- ui-react/src/ClampLogo.js | 42 -- ui-react/src/ClampLogoImg.js | 40 -- ui-react/src/ClosedLoopView.js | 41 -- ui-react/src/ClosedLoopViewBody.js | 70 --- ui-react/src/ClosedLoopViewHeader.js | 43 -- ui-react/src/MenuBar.js | 62 --- ui-react/src/{Clamp.js => OnapClamp.js} | 19 +- ui-react/src/UserBar.js | 42 -- ui-react/src/components/app/LoopUI.js | 146 +++++++ .../logo_onap_2017.png => components/app/logo.png} | Bin .../components/backend_communication/LoopCache.js | 116 +++++ .../OperationalPolicy/OperationalPolicy.css | 73 ++++ .../dialogs/OperationalPolicy/OperationalPolicy.js | 486 +++++++++++++++++++++ .../loop_viewer/logs}/ClosedLoopLogs.js | 6 +- .../loop_viewer/status/ClosedLoopStatus.css | 19 + .../loop_viewer/status}/ClosedLoopStatus.js | 5 +- .../loop_viewer/svg/ClosedLoopSvg.js} | 18 +- .../src/components/loop_viewer/svg/example.svg | 13 + ui-react/src/components/menu/MenuBar.js | 69 +++ ui-react/src/css/index.css | 88 ---- ui-react/src/index.js | 5 +- ui-react/src/theme/globalStyle.js | 79 ++++ 24 files changed, 1036 insertions(+), 502 deletions(-) delete mode 100644 ui-react/src/ClampHeader.js delete mode 100644 ui-react/src/ClampLogo.js delete mode 100644 ui-react/src/ClampLogoImg.js delete mode 100644 ui-react/src/ClosedLoopView.js delete mode 100644 ui-react/src/ClosedLoopViewBody.js delete mode 100644 ui-react/src/ClosedLoopViewHeader.js delete mode 100644 ui-react/src/MenuBar.js rename ui-react/src/{Clamp.js => OnapClamp.js} (77%) delete mode 100644 ui-react/src/UserBar.js create mode 100644 ui-react/src/components/app/LoopUI.js rename ui-react/src/{images/logo_onap_2017.png => components/app/logo.png} (100%) create mode 100644 ui-react/src/components/backend_communication/LoopCache.js create mode 100644 ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicy.css create mode 100644 ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicy.js rename ui-react/src/{ => components/loop_viewer/logs}/ClosedLoopLogs.js (94%) create mode 100644 ui-react/src/components/loop_viewer/status/ClosedLoopStatus.css rename ui-react/src/{ => components/loop_viewer/status}/ClosedLoopStatus.js (94%) rename ui-react/src/{ClosedLoopSVG.js => components/loop_viewer/svg/ClosedLoopSvg.js} (70%) create mode 100644 ui-react/src/components/loop_viewer/svg/example.svg create mode 100644 ui-react/src/components/menu/MenuBar.js delete mode 100644 ui-react/src/css/index.css create mode 100644 ui-react/src/theme/globalStyle.js diff --git a/ui-react/package.json b/ui-react/package.json index 943ed7ad..7d0e407b 100644 --- a/ui-react/package.json +++ b/ui-react/package.json @@ -12,12 +12,13 @@ "author": "ONAP Clamp Team", "license": "Apache-2.0", "dependencies": { - "json-editor": "^0.7.28", - "react": "~16.8.0", - "react-dom": "~16.8.0", - "react-scripts": "~3.0.1", + "json-editor": "0.7.28", + "react": "16.8.0", + "react-dom": "16.8.0", + "react-scripts": "3.0.1", "react-bootstrap": "1.0.0-beta.9", - "bootstrap-css-only": "4.3.1" + "bootstrap-css-only": "4.3.1", + "styled-components": "4.3.2" }, "browserslist": [ ">0.2%", diff --git a/ui-react/src/ClampHeader.js b/ui-react/src/ClampHeader.js deleted file mode 100644 index 9460023f..00000000 --- a/ui-react/src/ClampHeader.js +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -import React from 'react'; -import ClampLogoImg from './ClampLogoImg'; -import ClampLogo from './ClampLogo'; -import UserBar from './UserBar'; -import MenuBar from './MenuBar'; -import Navbar from 'react-bootstrap/Navbar'; -import 'bootstrap-css-only/css/bootstrap.min.css'; - -class ClampHeader extends React.Component { - render() { - return ( - - - - - - - ); - } -} - -export default ClampHeader; diff --git a/ui-react/src/ClampLogo.js b/ui-react/src/ClampLogo.js deleted file mode 100644 index ffceee1d..00000000 --- a/ui-react/src/ClampLogo.js +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -import React from 'react'; -import Navbar from 'react-bootstrap/Navbar'; -import Nav from 'react-bootstrap/Nav'; -import './css/index.css'; -import 'bootstrap-css-only/css/bootstrap.min.css'; - -class ClampLogo extends React.Component { - render() { - return ( - - ); - } -} - -export default ClampLogo; diff --git a/ui-react/src/ClampLogoImg.js b/ui-react/src/ClampLogoImg.js deleted file mode 100644 index 8b34dad9..00000000 --- a/ui-react/src/ClampLogoImg.js +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -import React from 'react'; -import Navbar from 'react-bootstrap/Navbar'; -import 'bootstrap-css-only/css/bootstrap.min.css'; - -class ClampLogoImg extends React.Component { - render() { - return ( - - - - ); - } -} - -export default ClampLogoImg; diff --git a/ui-react/src/ClosedLoopView.js b/ui-react/src/ClosedLoopView.js deleted file mode 100644 index daa36606..00000000 --- a/ui-react/src/ClosedLoopView.js +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -import React from 'react'; -import ClosedLoopViewHeader from './ClosedLoopViewHeader'; -import ClosedLoopViewBody from './ClosedLoopViewBody'; -import './css/index.css'; - - class ClosedLoopView extends React.Component { - render() { - return ( -
-
- - -
-
- ); - } - } - - export default ClosedLoopView; diff --git a/ui-react/src/ClosedLoopViewBody.js b/ui-react/src/ClosedLoopViewBody.js deleted file mode 100644 index bfa05f8b..00000000 --- a/ui-react/src/ClosedLoopViewBody.js +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -import React from 'react'; -import ClosedLoopSVG from './ClosedLoopSVG'; -import ClosedLoopLogs from './ClosedLoopLogs'; -import ClosedLoopStatus from './ClosedLoopStatus'; -import './css/index.css'; - - class ClosedLoopViewBody extends React.Component { - - constructor(props) { - super(props); - this.state = { - disableDiv: false - }; - this.disableDiv = this.disableDiv.bind(this); - this.enableDiv = this.enableDiv.bind(this); - } - - disableDiv() { - this.setState({ - disableDiv:true - }); - } - - enableDiv() { - this.setState({ - disableDiv:false - }); - } - - - render() { - var divStyle = { - display:this.state.disableDiv?'block':'none' - }; - return ( -
-
- - -
- -
- ); - } - } - - - export default ClosedLoopViewBody; diff --git a/ui-react/src/ClosedLoopViewHeader.js b/ui-react/src/ClosedLoopViewHeader.js deleted file mode 100644 index 8f2d845f..00000000 --- a/ui-react/src/ClosedLoopViewHeader.js +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -import React from 'react'; -import './css/index.css'; - -class ClosedLoopViewHeader extends React.Component { - render() { - return ( -
-
- Closed - Loop Modeler - No - LOOP loaded yet   - -
-
- ); - } -} - -export default ClosedLoopViewHeader; diff --git a/ui-react/src/MenuBar.js b/ui-react/src/MenuBar.js deleted file mode 100644 index ce962f33..00000000 --- a/ui-react/src/MenuBar.js +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -import React from 'react'; -import Navbar from 'react-bootstrap/Navbar'; -import NavDropdown from 'react-bootstrap/NavDropdown'; -import 'bootstrap-css-only/css/bootstrap.min.css'; - -class MenuBar extends React.Component { - render () { - return ( - - - Open CL - Properties CL - Close Model - - - Submit - Stop - Restart - Delete - Deploy - UnDeploy - - - Refresh Status - - - Wiki - Contact Us - User Info - - - - - ); - } -} - - - -export default MenuBar; diff --git a/ui-react/src/Clamp.js b/ui-react/src/OnapClamp.js similarity index 77% rename from ui-react/src/Clamp.js rename to ui-react/src/OnapClamp.js index 38634b3a..bdcea629 100644 --- a/ui-react/src/Clamp.js +++ b/ui-react/src/OnapClamp.js @@ -22,19 +22,18 @@ */ import React from 'react'; -import ClampHeader from './ClampHeader'; -import ClosedLoopView from './ClosedLoopView'; +import LoopUI from './components/app/LoopUI' +import { ThemeProvider } from 'styled-components'; +import { DefaultClampTheme } from './theme/globalStyle.js'; - -class Clamp extends React.Component { +export default class OnapClamp extends LoopUI { + render() { + console.log("Onap Clamp UI starting"); return ( -
- - -
- ); + + {super.render()} + ); } } -export default Clamp; diff --git a/ui-react/src/UserBar.js b/ui-react/src/UserBar.js deleted file mode 100644 index d4b3ede7..00000000 --- a/ui-react/src/UserBar.js +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -import React from 'react'; -import Navbar from 'react-bootstrap/Navbar'; -import 'bootstrap-css-only/css/bootstrap.min.css'; - -class UserBar extends React.Component { - render () { - const user = this.props.user; - return ( - - - - Hello: {user} - - - - ); - } -} - -export default UserBar; diff --git a/ui-react/src/components/app/LoopUI.js b/ui-react/src/components/app/LoopUI.js new file mode 100644 index 00000000..d0f5aa32 --- /dev/null +++ b/ui-react/src/components/app/LoopUI.js @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +import React from 'react'; +import styled from 'styled-components'; +import MenuBar from '../menu/MenuBar'; +import Navbar from 'react-bootstrap/Navbar'; +import logo from './logo.png'; +import { GlobalClampStyle } from '../../theme/globalStyle.js'; + +import ClosedLoopSvg from '../loop_viewer/svg/ClosedLoopSvg'; +import ClosedLoopLogs from '../loop_viewer/logs/ClosedLoopLogs'; +import ClosedLoopStatus from '../loop_viewer/status/ClosedLoopStatus'; + +const ProjectNameStyle = styled.a` + vertical-align: middle; + padding-left: 30px; + font-size: 30px; + +` +const LoopViewDivStyle = styled.div` + height: 90vh; + overflow: hidden; + margin-left: 10px; + margin-right: 10px; + margin-bottom: 10px; + color: ${props => props.theme.loopViewerFontColor}; + background-color: ${props => props.theme.loopViewerBackgroundColor}; + border: 1px solid transparent; + border-color: ${props => props.theme.loopViewerHeaderBackgroundColor}; +` + +const LoopViewHeaderDivStyle = styled.div` + background-color: ${props => props.theme.loopViewerHeaderBackgroundColor}; + padding: 10px 10px; + color: ${props => props.theme.loopViewerHeaderFontColor}; +` + +const LoopViewBodyDivStyle = styled.div` + background-color: ${props => (props.theme.loopViewerBackgroundColor)}; + padding: 10px 10px; + color: ${props => (props.theme.loopViewerHeaderFontColor)}; + height: 95%; +` + +const LoopViewLoopNameSpanStyle = styled.span` + font-weight: bold; + color: ${props => (props.theme.loopViewerHeaderFontColor)}; + background-color: ${props => (props.theme.loopViewerHeaderBackgroundColor)}; +` + +export default class LoopUI extends React.Component { + + user = "testuser"; + loopName="Empty (NO loop loaded yet)"; + + renderMenuNavBar() { + return ( + + ); + } + + renderUserLoggedNavBar() { + return ( + + Signed in as: {this.user} + + ); + } + + renderLogoNavBar() { + return ( + + + CLAMP + + ); + } + + renderNavBar() { + return ( + + {this.renderLogoNavBar()} + {this.renderMenuNavBar()} + {this.renderUserLoggedNavBar()} + + ); + } + + renderLoopViewHeader() { + return ( + + Loop Viewer - {this.loopName} + + ); + } + + renderLoopViewBody() { + return ( + + + + + + ); + } + + renderLoopViewer() { + return ( + + {this.renderLoopViewHeader()} + {this.renderLoopViewBody()} + + ); + } + + render() { + return ( +
+ + {this.renderNavBar()} + {this.renderLoopViewer()} +
+ ); + } +} diff --git a/ui-react/src/images/logo_onap_2017.png b/ui-react/src/components/app/logo.png similarity index 100% rename from ui-react/src/images/logo_onap_2017.png rename to ui-react/src/components/app/logo.png diff --git a/ui-react/src/components/backend_communication/LoopCache.js b/ui-react/src/components/backend_communication/LoopCache.js new file mode 100644 index 00000000..7fd20596 --- /dev/null +++ b/ui-react/src/components/backend_communication/LoopCache.js @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ +class LoopCache +{ + constructor(loopJson) { + this.loopJsonCache=loopJson; + } + + updateMsProperties(type, newMsProperties) { + if (newMsProperties["name"] == type) { + for (p in this.loopJsonCache["microServicePolicies"]) { + if (this.loopJsonCache["microServicePolicies"][p]["name"] == type) { + this.loopJsonCache["microServicePolicies"][p] = newMsProperties; + } + } + } + } + + updateGlobalProperties(newGlobalProperties) { + this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties; + } + + updateOpPolicyProperties(newOpProperties) { + this.loopJsonCache["operationalPolicies"] = newOpProperties; + } + + getLoopName() { + return this.loopJsonCache["name"]; + } + + getOperationalPolicyProperty() { + return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"])); + } + + getOperationalPolicies() { + return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"])); + } + + getGlobalProperty() { + return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"])); + } + + getDeploymentProperties() { + return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"])); + } + + getMsJson(type) { + var msProperties = this.loopJsonCache["microServicePolicies"]; + for (p in msProperties) { + if (msProperties[p]["name"] == type) { + return JSON.parse(JSON.stringify(msProperties[p])); + } + } + return null; + } + + getMsProperty(type) { + var msProperties = this.loopJsonCache["microServicePolicies"]; + for (p in msProperties) { + if (msProperties[p]["name"] == type) { + if (msProperties[p]["properties"] !== null && msProperties[p]["properties"] !== undefined) { + return JSON.parse(JSON.stringify(msProperties[p]["properties"])); + } + } + } + return null; + } + + getMsUI(type) { + var msProperties = this.loopJsonCache["microServicePolicies"]; + for (p in msProperties) { + if (msProperties[p]["name"] == type) { + return JSON.parse(JSON.stringify(msProperties[p]["jsonRepresentation"])); + } + } + return null; + } + + getResourceDetailsVfProperty() { + return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VF"]; + } + + getResourceDetailsVfModuleProperty() { + return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VFModule"]; + } + + getLoopLogsArray() { + return this.loopJsonCache.loopLogs; + } + + getComponentStates() { + return this.loopJsonCache.components; + } + +} +export default LoopCache; diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicy.css b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicy.css new file mode 100644 index 00000000..94a91c23 --- /dev/null +++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicy.css @@ -0,0 +1,73 @@ +.disabled { + background-color: #dddd; +} + +label { + text-align: right; + vertical-align: middle; +} + +.leftPolicyPanel { + padding: 0 10px 0 0; +} + +.idError { + color: red; + padding: 50px 0px; + text-align: center; + display: none; +} + +.policyPanel { + background-color: #f5f5f5; + padding: 15px 5px 0 5px; +} + +.form-group.clearfix { + display: -webkit-flex; + display: flex; + align-items: center; +} + +label { + margin-bottom: 0px; +} + +.withnote { + margin-bottom: 0px; +} + +.note { + font-size:10px; + margin-left: 250px; + font-weight: normal; +} + +#policyTable { + cursor: pointer; + width: 100%; +} + +#policyTable tr { + border-bottom: 1px solid #ddd; + border-collapse: collapse; + text-align: left; + font-size: 12px; + font-weight: normal; +} + +#policyTable td { + padding: 8px 10px; +} + +#policyTable tr.highlight { + background-color: #f5f5f5; + font-weight: bold; + font-size: 13px; +} + +#policyTableHolder { + height: 200px; + width: 100%; + overflow: auto; +} \ No newline at end of file diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicy.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicy.js new file mode 100644 index 00000000..7b4ed0f8 --- /dev/null +++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicy.js @@ -0,0 +1,486 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +import React from 'react' +import Button from 'react-bootstrap/Button'; +import Modal from 'react-bootstrap/Modal'; + +import './OperationalPolicy.css' + +class OperationalPolicy extends React.Component { + + constructor(props, context) { + super(props, context); + + this.handleShow = this.handleShow.bind(this); + this.handleClose = this.handleClose.bind(this); + this.initPolicySelect = this.initPolicySelect.bind(this); + + this.allPolicies=[]; + this.policy_ids=[]; + + this.state = { + show: false, + }; + } + + handleClose() { + this.setState({ show: false }); + } + + handleShow() { + this.setState({ show: true }); + } + + initPolicySelect() { + if (this.allPolicies['operational_policy'] === undefined || this.allPolicies['operational_policy'] === null) { + this.allPolicies = getOperationalPolicyProperty(); + } + // Provision all policies ID first + if (policy_ids.length == 0 && this.allPolicies['operational_policy'] != undefined) { + $.each(this.allPolicies['operational_policy']['policies'], function() { + policy_ids.push(this['id']); + }); + } + } + + render() { + return ( + <> + + + + + Modal heading + + +
+
+ +

Operational Policy

+
+ +
+
+ +
+
+
+ +
+ +
+ + +
+ +
+ + +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+ + +
+
+ +
+ + ID must be unique +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+ +
+ +
+ +
+ + +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+ + +
+ +
+
+ + + + +
+ + ); + } +} + +export default OperationalPolicy; \ No newline at end of file diff --git a/ui-react/src/ClosedLoopLogs.js b/ui-react/src/components/loop_viewer/logs/ClosedLoopLogs.js similarity index 94% rename from ui-react/src/ClosedLoopLogs.js rename to ui-react/src/components/loop_viewer/logs/ClosedLoopLogs.js index 65e057cc..709cec96 100644 --- a/ui-react/src/ClosedLoopLogs.js +++ b/ui-react/src/components/loop_viewer/logs/ClosedLoopLogs.js @@ -22,9 +22,9 @@ */ import React from 'react'; import Table from 'react-bootstrap/Table'; -import './css/index.css'; +import './ClosedLoopLogs.css'; -class ClosedLoopViewLogs extends React.Component { +export default class ClosedLoopViewLogs extends React.Component { render() { return (
@@ -53,5 +53,3 @@ class ClosedLoopViewLogs extends React.Component { ); } } - -export default ClosedLoopViewLogs; diff --git a/ui-react/src/components/loop_viewer/status/ClosedLoopStatus.css b/ui-react/src/components/loop_viewer/status/ClosedLoopStatus.css new file mode 100644 index 00000000..14add0f5 --- /dev/null +++ b/ui-react/src/components/loop_viewer/status/ClosedLoopStatus.css @@ -0,0 +1,19 @@ + +.status_title{ + position: absolute; + left: 61%; + top: 151px; + font-size:20px; +} +.status{ + background-color: gray; + -moz-border-radius: 50px; + -webkit-border-radius: 50px; + border-radius: 50px; +} +.status_table { + position: absolute; + left: 61%; + top: 191px; + font-size:10px; +} \ No newline at end of file diff --git a/ui-react/src/ClosedLoopStatus.js b/ui-react/src/components/loop_viewer/status/ClosedLoopStatus.js similarity index 94% rename from ui-react/src/ClosedLoopStatus.js rename to ui-react/src/components/loop_viewer/status/ClosedLoopStatus.js index 5f427464..da5969e4 100644 --- a/ui-react/src/ClosedLoopStatus.js +++ b/ui-react/src/components/loop_viewer/status/ClosedLoopStatus.js @@ -22,9 +22,9 @@ */ import React from 'react'; import Table from 'react-bootstrap/Table'; -import './css/index.css'; +import './ClosedLoopStatus.css'; -class ClosedLoopStatus extends React.Component { +export default class ClosedLoopStatus extends React.Component { render() { return (
@@ -53,4 +53,3 @@ class ClosedLoopStatus extends React.Component { } } -export default ClosedLoopStatus; diff --git a/ui-react/src/ClosedLoopSVG.js b/ui-react/src/components/loop_viewer/svg/ClosedLoopSvg.js similarity index 70% rename from ui-react/src/ClosedLoopSVG.js rename to ui-react/src/components/loop_viewer/svg/ClosedLoopSvg.js index ffba8309..d9f5eaf8 100644 --- a/ui-react/src/ClosedLoopSVG.js +++ b/ui-react/src/components/loop_viewer/svg/ClosedLoopSvg.js @@ -21,15 +21,23 @@ * */ import React from 'react'; -import './css/index.css'; +import styled from 'styled-components'; +import { ReactComponent as SvgExample } from './example.svg'; +const LoopViewSvgDivStyle = styled.div` -class ClosedLoopViewSVG extends React.Component { + overflow: hidden; + background-color: ${props => (props.theme.loopViewerBackgroundColor)}; + border: 1px solid transparent; + border-color: ${props => (props.theme.loopViewerHeaderColor)}; +` + +export default class ClosedLoopViewSvg extends React.Component { render() { return ( -
-
+ + + ); } } -export default ClosedLoopViewSVG; diff --git a/ui-react/src/components/loop_viewer/svg/example.svg b/ui-react/src/components/loop_viewer/svg/example.svg new file mode 100644 index 00000000..bb332704 --- /dev/null +++ b/ui-react/src/components/loop_viewer/svg/example.svg @@ -0,0 +1,13 @@ + + + + + + + + + + SVG + + Sorry, your browser does not support inline SVG. + \ No newline at end of file diff --git a/ui-react/src/components/menu/MenuBar.js b/ui-react/src/components/menu/MenuBar.js new file mode 100644 index 00000000..3077bde6 --- /dev/null +++ b/ui-react/src/components/menu/MenuBar.js @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ +import React from 'react'; +import Navbar from 'react-bootstrap/Navbar'; +import NavDropdown from 'react-bootstrap/NavDropdown'; +import 'bootstrap-css-only/css/bootstrap.min.css'; +import styled from 'styled-components'; + +const StyledNavDropdownItem = styled(NavDropdown.Item)` + color: ${props => props.theme.fontNormal}; + :hover { + background-color: ${props => props.theme.loopViewerHeaderBackgroundColor}; + color: ${props => props.theme.loopViewerHeaderFontColor} + } +`; + +export default class MenuBar extends React.Component { + + render () { + return ( + + + Open CL + Properties CL + Close Model + + + Submit + Stop + Restart + Delete + Deploy + UnDeploy + + + Refresh Status + + + Wiki + Contact Us + User Info + + + + + ); + } +} + diff --git a/ui-react/src/css/index.css b/ui-react/src/css/index.css deleted file mode 100644 index 5a06c3b2..00000000 --- a/ui-react/src/css/index.css +++ /dev/null @@ -1,88 +0,0 @@ -.cldsmodelling { - height: 90vh; - overflow: hidden; - margin-left: 1px; - margin-right: 1px; -} -.cl_panel { - margin-bottom: 20px; - background-color: #fff; - border: 1px solid transparent; - border-radius: 4px; - box-shadow: 0 1px 1px rgba(0, 0, 0, .05); - width:100% ; - height: 100%; - border-color: #337ab7; -} -.cl_panel_heading{ - color: #fff; - background-color: #337ab7; - border-color: #337ab7; - padding: 10px 15px; - border-bottom: 1px solid transparent; - border-top-left-radius: 3px; - border-top-right-radius: 3px; - font-size: 12px; -} -.pull-left{ - float: left !important; -} -.pull-right{ - float: right !important; -} - -.color_white { - color: white; -} -.cl_view_body { - height: 83.5vh; width: 100%; -} -.logo_text { - font-size: 20px; - font-weight: bold; -} -.js_canvas { - margin-top: 200px; - margin-left: 20px; - margin-right: 20px; -} -.log_div{ - border: 2px solid gray; - margin-right: 20px; - font-size: 12px; -} -.log_table { - width: 100%; - height: 87%; - overflow: auto; -} -.row_10_per { - width: 10%; -} -.row_30_per { - width: 30%; -} -.row_70_per { - width: 70%; -} -.table_header { - font-weight: bold; -} -.status_title{ - position: absolute; - left: 61%; - top: 151px; - font-size:20px; -} -.status{ - background-color: gray; - -moz-border-radius: 50px; - -webkit-border-radius: 50px; - border-radius: 50px; -} -.status_table { - position: absolute; - left: 61%; - top: 191px; - font-size:10px; -} diff --git a/ui-react/src/index.js b/ui-react/src/index.js index 39162f56..b2fc3b0f 100644 --- a/ui-react/src/index.js +++ b/ui-react/src/index.js @@ -22,9 +22,10 @@ */ import React from 'react'; import ReactDOM from 'react-dom'; -import Clamp from './Clamp'; +import OnapClamp from './OnapClamp'; + ReactDOM.render( - , + , document.getElementById('root') ) diff --git a/ui-react/src/theme/globalStyle.js b/ui-react/src/theme/globalStyle.js new file mode 100644 index 00000000..df912629 --- /dev/null +++ b/ui-react/src/theme/globalStyle.js @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +import { createGlobalStyle } from 'styled-components'; + +export const GlobalClampStyle = createGlobalStyle` + body { + padding: 0; + margin: 0; + font-family: ${props => props.theme.fontFamily}; + font-size: ${props => props.theme.fontSize}; + font-weight: normal; + color: ${props => props.theme.fontNormal}; + background-color: ${props => props.theme.backgroundColor}; + } + + span { + font-family: ${props => props.theme.fontFamily}; + font-size: ${props => props.theme.fontSize}; + font-weight: bold; + color: ${props => props.theme.fontNormal}; + background-color: ${props => props.theme.backgroundColor}; + } + + a { + font-family: ${props => props.theme.fontFamily}; + font-size: ${props => props.theme.fontSize}; + font-weight: bold; + color: ${props => props.theme.fontNormal}; + background-color: ${props => props.theme.backgroundColor}; + + } + + div { + font-family: ${props => props.theme.fontFamily}; + font-size: ${props => props.theme.fontSize}; + border-radius: 4px; + color: ${props => props.theme.fontNormal}; + background-color: ${props => (props.theme.backgroundColor)}; + } +` + +export const DefaultClampTheme = { + fontDanger: '#eb238e', + fontWarning: '#eb238e', + fontLight: '#ffffff', + fontDark: '#888888', + fontHighlight: '#ffff00', + fontNormal: 'black', + + backgroundColor: '#eeeeee', + fontFamily: 'Arial, Sans-serif', + fontSize: '15px', + + loopViewerBackgroundColor: 'white', + loopViewerFontColor: 'yellow', + loopViewerHeaderBackgroundColor: '#337ab7', + loopViewerHeaderFontColor: 'white', +}; -- 2.16.6