From 0efeb6b141cb4abe84af8eb38e26d5ed1ab73bb0 Mon Sep 17 00:00:00 2001 From: xuegao Date: Mon, 7 Oct 2019 14:36:34 +0200 Subject: Fix Sonar vulnerabilities Fix the vulnerabilities reported by Sonar. Issue-ID: CLAMP-530 Change-Id: I9f6a7fe9ce042045085c371ef3777188b11ffb36 Signed-off-by: xuegao --- ui-react/src/LoopUI.js | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'ui-react/src/LoopUI.js') diff --git a/ui-react/src/LoopUI.js b/ui-react/src/LoopUI.js index b6dd0cb07..ad970d811 100644 --- a/ui-react/src/LoopUI.js +++ b/ui-react/src/LoopUI.js @@ -44,6 +44,7 @@ import LoopService from './api/LoopService'; import PerformAction from './components/dialogs/PerformActions'; import RefreshStatus from './components/dialogs/RefreshStatus'; import DeployLoop from './components/dialogs/DeployLoop'; +import Alert from 'react-bootstrap/Alert'; import { Link } from 'react-router-dom'; @@ -100,7 +101,8 @@ export default class LoopUI extends React.Component { state = { userName: null, loopName: LoopUI.defaultLoopName, - loopCache: new LoopCache({}) + loopCache: new LoopCache({}), + showAlert: false }; constructor() { @@ -110,6 +112,8 @@ export default class LoopUI extends React.Component { this.updateLoopCache = this.updateLoopCache.bind(this); this.loadLoop = this.loadLoop.bind(this); this.closeLoop = this.closeLoop.bind(this); + this.showAlert = this.showAlert.bind(this); + this.disableAlert = this.disableAlert.bind(this); } componentWillMount() { @@ -155,6 +159,14 @@ export default class LoopUI extends React.Component { ); } + renderAlertBar() { + return ( + + {this.state.showMessage} + + ); + } + renderNavBar() { return ( @@ -204,6 +216,14 @@ export default class LoopUI extends React.Component { console.info(this.state.loopName+" loop loaded successfully"); } + showAlert(message) { + this.setState ({ showAlert: true, showMessage:message }); + } + + disableAlert() { + this.setState ({ showAlert: false }); + } + loadLoop(loopName) { LoopService.getLoop(loopName).then(loop => { console.debug("Updating loopCache"); @@ -220,21 +240,22 @@ export default class LoopUI extends React.Component { return ( ()} /> + render={(routeProps) => ()} /> ()} /> ()} /> ()} /> ()} /> - ()} /> - ()} /> - ()} /> - ()} /> - ()} /> - ()} /> - ()} /> + ()} /> + ()} /> + ()} /> + ()} /> + ()} /> + ()} /> + ()} /> + {this.renderAlertBar()} {this.renderNavBar()} {this.renderLoopViewer()} -- cgit 1.2.3-korg