aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src
diff options
context:
space:
mode:
authorSébastien Determe <sebastien.determe@intl.att.com>2020-02-05 14:09:02 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-05 14:09:02 +0000
commit899c22fccf12f50a877988c62e30d5e2c7fb7e3c (patch)
tree745646b0b9cfc306a006f89b9148c083940b644f /ui-react/src
parent504422fe7b93714222ff53b9ee9914a26b74c091 (diff)
parent01e5fde3fa45638f3ad884ca76ad861d8781868a (diff)
Merge "Changes for populating ReactJS component library"
Diffstat (limited to 'ui-react/src')
-rw-r--r--ui-react/src/LoopUI.js7
-rw-r--r--ui-react/src/LoopUI.test.js3
-rw-r--r--ui-react/src/components/loop_viewer/svg/LoopSvg.js2
-rw-r--r--ui-react/src/components/menu/MenuBar.js4
-rw-r--r--ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap52
-rw-r--r--ui-react/src/utils/OnapConstants.js30
6 files changed, 64 insertions, 34 deletions
diff --git a/ui-react/src/LoopUI.js b/ui-react/src/LoopUI.js
index eb4ff6a50..9eea0be95 100644
--- a/ui-react/src/LoopUI.js
+++ b/ui-react/src/LoopUI.js
@@ -27,6 +27,7 @@ import MenuBar from './components/menu/MenuBar';
import Navbar from 'react-bootstrap/Navbar';
import logo from './logo.png';
import { GlobalClampStyle } from './theme/globalStyle.js';
+import OnapConstants from './utils/OnapConstants';
import LoopSvg from './components/loop_viewer/svg/LoopSvg';
import LoopLogs from './components/loop_viewer/logs/LoopLogs';
@@ -99,11 +100,9 @@ const LoopViewBodyDivStyled = styled.div`
export default class LoopUI extends React.Component {
- static defaultLoopName="Empty (NO loop loaded yet)";
-
state = {
userName: null,
- loopName: LoopUI.defaultLoopName,
+ loopName: OnapConstants.defaultLoopName,
loopCache: new LoopCache({}),
showAlert: false
};
@@ -242,7 +241,7 @@ export default class LoopUI extends React.Component {
}
closeLoop() {
- this.setState({ loopCache: new LoopCache({}), loopName: LoopUI.defaultLoopName });
+ this.setState({ loopCache: new LoopCache({}), loopName: OnapConstants.defaultLoopName });
this.props.history.push('/');
}
diff --git a/ui-react/src/LoopUI.test.js b/ui-react/src/LoopUI.test.js
index e28096bd4..d1b76aa9a 100644
--- a/ui-react/src/LoopUI.test.js
+++ b/ui-react/src/LoopUI.test.js
@@ -23,6 +23,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import LoopUI from './LoopUI';
+import OnapConstants from './utils/OnapConstants';
import LoopCache from './api/LoopCache';
import LoopActionService from './api/LoopActionService';
@@ -77,7 +78,7 @@ describe('Verify LoopUI', () => {
const instance = component.instance();
instance.closeLoop();
- expect(component.state('loopName')).toEqual("Empty (NO loop loaded yet)");
+ expect(component.state('loopName')).toEqual(OnapConstants.defaultLoopName);
expect(historyMock.push.mock.calls[0]).toEqual([ '/']);
})
diff --git a/ui-react/src/components/loop_viewer/svg/LoopSvg.js b/ui-react/src/components/loop_viewer/svg/LoopSvg.js
index 06cfd238f..4bbf608df 100644
--- a/ui-react/src/components/loop_viewer/svg/LoopSvg.js
+++ b/ui-react/src/components/loop_viewer/svg/LoopSvg.js
@@ -23,7 +23,7 @@
import React from 'react';
import styled from 'styled-components';
import LoopCache from '../../../api/LoopCache';
-import { withRouter } from "react-router";
+import { withRouter } from "react-router-dom";
import LoopService from '../../../api/LoopService';
import LoopComponentConverter from './LoopComponentConverter';
diff --git a/ui-react/src/components/menu/MenuBar.js b/ui-react/src/components/menu/MenuBar.js
index e211b0eaf..41a105488 100644
--- a/ui-react/src/components/menu/MenuBar.js
+++ b/ui-react/src/components/menu/MenuBar.js
@@ -24,7 +24,7 @@ import React from 'react';
import Nav from 'react-bootstrap/Nav';
import Navbar from 'react-bootstrap/Navbar';
import NavDropdown from 'react-bootstrap/NavDropdown';
-import LoopUI from '../../LoopUI';
+import OnapConstants from '../../utils/OnapConstants';
import 'bootstrap-css-only/css/bootstrap.min.css';
import styled from 'styled-components';
import { Link } from 'react-router-dom';
@@ -76,7 +76,7 @@ export default class MenuBar extends React.Component {
};
componentWillReceiveProps(newProps) {
- if (newProps.loopName !== LoopUI.defaultLoopName) {
+ if (newProps.loopName !== OnapConstants.defaultLoopName) {
this.setState({ disabled: false });
} else {
this.setState({ disabled: true });
diff --git a/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap b/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap
index 1670124cc..c17214aad 100644
--- a/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap
+++ b/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap
@@ -11,7 +11,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -44,7 +44,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -62,7 +62,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -95,7 +95,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -117,7 +117,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -150,7 +150,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -168,7 +168,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -201,7 +201,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -219,7 +219,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -252,7 +252,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -274,7 +274,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -307,7 +307,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -325,7 +325,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -358,7 +358,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -376,7 +376,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -409,7 +409,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -427,7 +427,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -460,7 +460,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -478,7 +478,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -511,7 +511,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -529,7 +529,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -562,7 +562,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -584,7 +584,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -617,7 +617,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
@@ -650,7 +650,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"$$typeof": Symbol(react.forward_ref),
"attrs": Array [],
"componentStyle": ComponentStyle {
- "componentId": "sc-eNQAEJ",
+ "componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
@@ -683,7 +683,7 @@ exports[`Verify MenuBar Test the render method 1`] = `
"displayName": "Styled(Link)",
"foldedComponentIds": Array [],
"render": [Function],
- "styledComponentId": "sc-eNQAEJ",
+ "styledComponentId": "sc-bdVaJa",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
diff --git a/ui-react/src/utils/OnapConstants.js b/ui-react/src/utils/OnapConstants.js
new file mode 100644
index 000000000..22460c3d1
--- /dev/null
+++ b/ui-react/src/utils/OnapConstants.js
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+// Maintain a list of ONAP CLAMP UI "constants" that can be used by any componenet within CLAMP
+
+const OnapConstants = {
+ defaultLoopName: "Empty (NO loop loaded yet)"
+};
+
+export default OnapConstants;