@@ -165,20 +227,71 @@ export default class LoopUI extends React.Component {
updateLoopCache(loopJson) {
this.setState({ loopCache: new LoopCache(loopJson) });
this.setState({ loopName: this.state.loopCache.getLoopName() });
+ console.info(this.state.loopName+" loop loaded successfully");
+ }
+
+ showSucAlert(message) {
+ this.setState ({ showSucAlert: true, showMessage:message });
+ }
+
+ showFailAlert(message) {
+ this.setState ({ showFailAlert: true, showMessage:message });
+ }
+
+ disableAlert() {
+ this.setState ({ showSucAlert: false, showFailAlert: false });
+ }
+
+ loadLoop(loopName) {
+ LoopService.getLoop(loopName).then(loop => {
+ console.debug("Updating loopCache");
+ LoopActionService.refreshStatus(loopName).then(data => {
+ this.updateLoopCache(data);
+ this.props.history.push('/');
+ })
+ .catch(error => {
+ this.updateLoopCache(loop);
+ this.props.history.push('/');
+ });
+ });
+ }
+
+ closeLoop() {
+ this.setState({ loopCache: new LoopCache({}), loopName: OnapConstants.defaultLoopName });
+ this.props.history.push('/');
}
render() {
return (
-
-
- {this.renderNavBar()}
- {this.renderLoopViewer()}
+
+ ()} />
+ ()} />
+ ()} />
+ ()} />
()} />
- ()} />
- ()} />
- ()} />
-
+ render={(routeProps) => ()} />
+ ()} />
+ ()} />
+ ()} />
+ ()} />
+ ()} />
+ ()} />
+
+ ()} />
+
+ ()} />
+ ()} />
+ ()} />
+ ()} />
+ ()} />
+ ()} />
+ ()} />
+
+
+ {this.renderAlertBar()}
+ {this.renderNavBar()}
+ {this.renderLoopViewer()}
+
);
}
}