X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ui-react%2Fsrc%2FLoopUI.js;h=a1aff3d61c7827d3c13774051711c3642b378538;hb=493c3839fb6807512218165fd8a3a6efe1933fb9;hp=997f94b18ed3c39197826eb139a496c312bcfc9f;hpb=8bd462f6dc4a714b1680cb11f525c05445d3da33;p=clamp.git diff --git a/ui-react/src/LoopUI.js b/ui-react/src/LoopUI.js index 997f94b1..a1aff3d6 100644 --- a/ui-react/src/LoopUI.js +++ b/ui-react/src/LoopUI.js @@ -28,10 +28,16 @@ import Navbar from 'react-bootstrap/Navbar'; import logo from './logo.png'; import { GlobalClampStyle } from './theme/globalStyle.js'; -import ClosedLoopSvg from './components/loop_viewer/svg/ClosedLoopSvg'; -import ClosedLoopLogs from './components/loop_viewer/logs/ClosedLoopLogs'; -import ClosedLoopStatus from './components/loop_viewer/status/ClosedLoopStatus'; +import LoopSvg from './components/loop_viewer/svg/LoopSvg'; +import LoopLogs from './components/loop_viewer/logs/LoopLogs'; +import LoopStatus from './components/loop_viewer/status/LoopStatus'; import UserService from './api/UserService'; +import LoopCache from './api/LoopCache'; + +import { Route } from 'react-router-dom' +import OpenLoopModal from './components/dialogs/OpenLoop/OpenLoopModal'; +import OperationalPolicyModal from './components/dialogs/OperationalPolicy/OperationalPolicyModal'; +import ConfigurationPolicyModal from './components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal'; const ProjectNameStyled = styled.a` vertical-align: middle; @@ -71,26 +77,29 @@ const LoopViewLoopNameSpanStyled = styled.span` ` export default class LoopUI extends React.Component { + state = { userName: null, loopName: "Empty (NO loop loaded yet)", + loopCache: new LoopCache({}), }; constructor() { super(); this.getUser = this.getUser.bind(this); + this.updateLoopCache = this.updateLoopCache.bind(this); + } + + componentDidMount() { + this.getUser(); } - - componentDidMount() { - this.getUser(); - } getUser() { - UserService.LOGIN().then(user => { - this.setState({userName:user}) + UserService.login().then(user => { + this.setState({ userName: user }) }); } - + renderMenuNavBar() { return ( @@ -108,7 +117,7 @@ export default class LoopUI extends React.Component { renderLogoNavBar() { return ( - + CLAMP ); @@ -116,48 +125,56 @@ export default class LoopUI extends React.Component { renderNavBar() { return ( - - {this.renderLogoNavBar()} - {this.renderMenuNavBar()} - {this.renderUserLoggedNavBar()} - - ); + + {this.renderLogoNavBar()} + {this.renderMenuNavBar()} + {this.renderUserLoggedNavBar()} + + ); } - + renderLoopViewHeader() { return ( - Loop Viewer - {this.state.loopName} + Loop Viewer - {this.state.loopName} ); } - + renderLoopViewBody() { return ( - - - + + + ); } - + renderLoopViewer() { return ( - {this.renderLoopViewHeader()} - {this.renderLoopViewBody()} + {this.renderLoopViewHeader()} + {this.renderLoopViewBody()} - ); + ); } - + + updateLoopCache(loopJson) { + this.setState({ loopCache: new LoopCache(loopJson) }); + } + render() { return (
- - {this.renderNavBar()} - {this.renderLoopViewer()} -
+ + {this.renderNavBar()} + {this.renderLoopViewer()} + ()} /> + ()} /> + ()} /> + ); } }