summaryrefslogtreecommitdiffstats
path: root/ui-react/src/LoopUI.js
diff options
context:
space:
mode:
authorTed Humphrey <Thomas.Humphrey@att.com>2020-07-08 16:48:40 -0400
committerChristophe Closset <christophe.closset@intl.att.com>2020-07-15 17:49:00 +0000
commit083e5a2aefd76bb1fc25bcb5528b7288b059c1c2 (patch)
treebc99c546f6397c7bd53feb3c49de3dbb7e21a8b5 /ui-react/src/LoopUI.js
parentb165eb5507409cd0e63b4d255202f46c059f7e6d (diff)
block re-use of existing loop name; support derivation of SvgGenerator
added changes to LoopUI for global style and support of "delete" CL case Issue-ID: CLAMP-896 Change-Id: I97f603f38c277011835b8e206e5e05226a296606 Signed-off-by: Ted Humphrey <Thomas.Humphrey@att.com>
Diffstat (limited to 'ui-react/src/LoopUI.js')
-rw-r--r--ui-react/src/LoopUI.js34
1 files changed, 29 insertions, 5 deletions
diff --git a/ui-react/src/LoopUI.js b/ui-react/src/LoopUI.js
index 0ee6e6e24..5491ab187 100644
--- a/ui-react/src/LoopUI.js
+++ b/ui-react/src/LoopUI.js
@@ -130,6 +130,8 @@ export default class LoopUI extends React.Component {
this.setBusyLoading = this.setBusyLoading.bind(this);
this.clearBusyLoading = this.clearBusyLoading.bind(this);
this.isBusyLoading = this.isBusyLoading.bind(this);
+ this.renderGlobalStyle = this.renderGlobalStyle.bind(this);
+ this.renderSvg = this.renderSvg.bind(this);
}
componentWillMount() {
@@ -198,10 +200,15 @@ export default class LoopUI extends React.Component {
);
}
+ renderSvg() {
+ return (
+ <SvgGenerator loopCache={this.state.loopCache} clickable={true} generatedFrom={SvgGenerator.GENERATED_FROM_INSTANCE} isBusyLoading={this.isBusyLoading}/>
+ )
+ }
renderLoopViewBody() {
return (
<LoopViewBodyDivStyled>
- <SvgGenerator loopCache={this.state.loopCache} clickable={true} generatedFrom={SvgGenerator.GENERATED_FROM_INSTANCE} isBusyLoading={this.isBusyLoading}/>
+ {this.renderSvg()}
<LoopStatus loopCache={this.state.loopCache}/>
<LoopLogs loopCache={this.state.loopCache} />
</LoopViewBodyDivStyled>
@@ -223,10 +230,20 @@ export default class LoopUI extends React.Component {
}
updateLoopCache(loopJson) {
- this.setState({ loopCache: new LoopCache(loopJson) });
- this.setState({ loopName: this.state.loopCache.getLoopName() });
+
+ // If call with an empty object for loopJson, this is a reset to empty
+ // from someplace like PerformActions for the case where we are "deleting"
+ // a Control Loop model. Set the loopName to the default.
+
+ if (loopJson === null) {
+ this.setState({ loopName: OnapConstants.defaultLoopName });
+ this.setState({ loopCache: new LoopCache({}) });
+ } else {
+ 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 });
@@ -369,6 +386,13 @@ export default class LoopUI extends React.Component {
);
}
+ renderGlobalStyle() {
+ return (
+ <GlobalClampStyle />
+ );
+ };
+
+
renderSpinner() {
if (this.isBusyLoading()) {
return (
@@ -386,7 +410,7 @@ export default class LoopUI extends React.Component {
render() {
return (
<StyledMainDiv id="main_div">
- <GlobalClampStyle />
+ {this.renderGlobalStyle()}
{this.renderRoutes()}
{this.renderSpinner()}
{this.renderAlertBar()}