aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src/LoopUI.js
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-07-17 13:48:44 +0200
committersebdet <sebastien.determe@intl.att.com>2019-07-17 13:48:44 +0200
commit2dacb9bd185db2c05de435d2bd446865e158e483 (patch)
tree4f42564c670c8b8807cc4a50623abe5ea5fb03f9 /ui-react/src/LoopUI.js
parent493c3839fb6807512218165fd8a3a6efe1933fb9 (diff)
Draft of Config policy
Initial code of the config policy window using the Json Editor version from NPM Issue-ID: CLAMP-426 Change-Id: I4ff3e63c463320706031c703afa22417b321faa3 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'ui-react/src/LoopUI.js')
-rw-r--r--ui-react/src/LoopUI.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/ui-react/src/LoopUI.js b/ui-react/src/LoopUI.js
index a1aff3d61..4271f1037 100644
--- a/ui-react/src/LoopUI.js
+++ b/ui-react/src/LoopUI.js
@@ -34,7 +34,7 @@ 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 { Route, Redirect } 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';
@@ -78,9 +78,11 @@ const LoopViewLoopNameSpanStyled = styled.span`
export default class LoopUI extends React.Component {
+ static defaultLoopName="Empty (NO loop loaded yet)";
+
state = {
userName: null,
- loopName: "Empty (NO loop loaded yet)",
+ loopName: LoopUI.defaultLoopName,
loopCache: new LoopCache({}),
};
@@ -90,7 +92,7 @@ export default class LoopUI extends React.Component {
this.updateLoopCache = this.updateLoopCache.bind(this);
}
- componentDidMount() {
+ componentWillMount() {
this.getUser();
}
@@ -162,6 +164,7 @@ export default class LoopUI extends React.Component {
updateLoopCache(loopJson) {
this.setState({ loopCache: new LoopCache(loopJson) });
+ this.setState({ loopName: this.state.loopCache.getLoopName() });
}
render() {
@@ -174,6 +177,7 @@ export default class LoopUI extends React.Component {
render={(routeProps) => (<OperationalPolicyModal {...routeProps} loopCache={this.state.loopCache} />)} />
<Route path="/configurationPolicyModal" render={(routeProps) => (<ConfigurationPolicyModal {...routeProps} loopCache={this.state.loopCache} />)} />
<Route path="/openLoop" render={(routeProps) => (<OpenLoopModal {...routeProps} updateLoopCacheFunction={this.updateLoopCache} />)} />
+ <Route path="/closeLoop" render={(routeProps) => (<Redirect to='/'/>)} />
</div>
);
}