diff options
-rw-r--r-- | README.md | 27 | ||||
-rw-r--r-- | extra/docker/clamp/clamp.env | 2 | ||||
-rw-r--r-- | pom.xml | 72 | ||||
-rw-r--r-- | src/main/resources/clds/aaf/org.onap.clamp.p12 | bin | 4147 -> 4155 bytes | |||
-rw-r--r-- | src/main/resources/clds/aaf/ssl/clamp.key | 54 | ||||
-rw-r--r-- | src/main/resources/clds/aaf/ssl/clamp.pem | 37 | ||||
-rwxr-xr-x | ui-react-lib/libIndex.js | 45 | ||||
-rwxr-xr-x | ui-react-lib/package.json | 51 | ||||
-rwxr-xr-x | ui-react-lib/rollup.config.js | 48 | ||||
-rw-r--r-- | ui-react/src/LoopUI.js | 7 | ||||
-rw-r--r-- | ui-react/src/LoopUI.test.js | 3 | ||||
-rw-r--r-- | ui-react/src/components/loop_viewer/svg/LoopSvg.js | 2 | ||||
-rw-r--r-- | ui-react/src/components/menu/MenuBar.js | 4 | ||||
-rw-r--r-- | ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap | 52 | ||||
-rw-r--r-- | ui-react/src/utils/OnapConstants.js | 30 |
15 files changed, 336 insertions, 98 deletions
@@ -114,10 +114,10 @@ With the default log settings, all logs will be generated into console and into You can see the swagger definition for the jaxrs apis at `/restservices/clds/v1/openapi.json` -## Clamp AAF +## Clamp AAF - Renew Certificates - Connect to windriver with openvpn - create a folder aaf-renewal and go to it -- create a file aaf.props with that content +- create a file aaf.props with that content (or run the agent.sh script below, it will prompt you for values at first run) VERSION=2.1.13 DOCKER_REPOSITORY=nexus3.onap.org:10001 HOSTNAME= @@ -141,13 +141,24 @@ You can see the swagger definition for the jaxrs apis at `/restservices/clds/v1/ cadi_latitude[0.000]=10.0 cadi_longitude[0.000]=10.0 - Certs should created, you can get them in /var/lib/docker/volumes/clamp_config/_data/local + If you want to recreate the certs, you have to delete the docker volume (otherwise it will be re used) : docker volume rm clamp_config - wget https://nexus.onap.org/content/repositories/releases/org/onap/aaf/authz/aaf-cadi-aaf/2.1.13/aaf-cadi-aaf-2.1.13-full.jar - to encrypt or decrypt the store passwords: java -jar aaf-cadi-aaf-2.1.13-full.jar cadi digest changeit testos.key - +- you can also use the agent.sh script to decrypt the passwords, by running the showpass commands (see wiki below) - Extract private key from P12: 'openssl pkcs12 -in org.onap.clamp.p12 -nocerts -nodes > clamp.key' - Extract public certificate from P12: 'openssl pkcs12 -in org.onap.clamp.p12 -clcerts -nokeys > clamp.pem' - Extract CA certificate from P12: 'openssl pkcs12 -in org.onap.clamp.p12 -cacerts -nokeys -chain > ca-certs.pem' - reference wiki: https://wiki.onap.org/display/DW/AAF+Certificate+Management+for+Dummies +- you need to place new clamp.key, clamp.pem and ca-certs.pem into src/main/resources/clds/aaf/ssl, this will be used by the FrontEnd +- you need to replace the password of the generated keystore (clamp uses the p12 keystore), we want to keep the same demo password across release + to do so, you can use keytool to update the password and set it back to 'China in the Spring' + keytool -storepasswd -keystore ./org.onap.clamp.p12 +- this will prompt for the current keystore password (the one generated by the aaf script that you can get from the above) +- you can then set it to 'China in the Spring' +- once done, you can replace : org.onap.clamp.p12 into src/main/resources/clds/aaf +- rebuild Clamp Docker containers, they should be updated with the renewed certificates + + ## Clamp Credentials There are two mechanisms that can enabled for the authentication, one or the other never both at the same time. @@ -158,17 +169,17 @@ There is a section for SSL enablement and cadi configuration (for AAF) + one spr server.port=8443 server.ssl.key-store=classpath:/clds/aaf/org.onap.clamp.p12 -server.ssl.key-store-password=China in the Spring -server.ssl.key-password=China in the Spring +server.ssl.key-store-password=enc:WWCxchk4WGBNSvuzLq3MLjMs5ObRybJtts5AI0XD1Vc +server.ssl.key-password=enc:WWCxchk4WGBNSvuzLq3MLjMs5ObRybJtts5AI0XD1Vc server.ssl.key-store-type=PKCS12 server.ssl.key-alias=clamp@clamp.onap.org +clamp.config.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile server.ssl.client-auth=want server.ssl.trust-store=classpath:/clds/aaf/truststoreONAPall.jks -server.ssl.trust-store-password=changeit - +server.ssl.trust-store-password=enc:iDnPBBLq_EMidXlMa1FEuBR8TZzYxrCg66vq_XfLHdJ server.http-to-https-redirection.port=8080 .... -spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller +spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller-new,clamp-ssl-config .... clamp.config.cadi.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile clamp.config.cadi.cadiLoglevel=DEBUG diff --git a/extra/docker/clamp/clamp.env b/extra/docker/clamp/clamp.env index ae6dbec11..06381f941 100644 --- a/extra/docker/clamp/clamp.env +++ b/extra/docker/clamp/clamp.env @@ -1,2 +1,2 @@ ### Be careful, this must be in one line only ### -SPRING_APPLICATION_JSON={"spring.datasource.cldsdb.url":"jdbc:mariadb:sequential://db:3306/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3","spring.profiles.active":"clamp-default,clamp-default-user,clamp-sdc-controller-new","clamp.config.policy.api.url":"http4://third-party-proxy:8085","clamp.config.policy.pap.url":"http4://third-party-proxy:8085","clamp.config.dcae.inventory.url":"http://third-party-proxy:8085","clamp.config.dcae.deployment.url":"http4://third-party-proxy:8085"} +SPRING_APPLICATION_JSON={"spring.datasource.cldsdb.url":"jdbc:mariadb:sequential://db:3306/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3","spring.profiles.active":"clamp-default,clamp-default-user,clamp-sdc-controller-new,clamp-ssl-config","clamp.config.policy.api.url":"http4://third-party-proxy:8085","clamp.config.policy.pap.url":"http4://third-party-proxy:8085","clamp.config.dcae.inventory.url":"http://third-party-proxy:8085","clamp.config.dcae.deployment.url":"http4://third-party-proxy:8085"} @@ -39,7 +39,7 @@ <description> This is the MAVEN project that builds everything for ONAP CLAMP. Docker engine is normally requires to perfom all possible tasks (including integration tests) - + It can build: - The ONAP CLAMP JAR that contains CLAMP back-end code. - The DOCKER images for: @@ -53,7 +53,7 @@ - The CLAMP backend, JAVA unit testing - The CLAMP backend, JAVA integration tests (with Spring + docker mariadb database + docker policy/dcae emulator written in python) - The CLAMP frontend, Javascrip tests (NodeJS(NPM) + JEST + Enzyme fro React) - + The test coverage for dev's can be found after a "clean install" build in: - Clamp backend: target/jacoco-dev.exec (unit tests + integration tests merged) or separately target/coverage-reports/jacoco.exec and target/coverage-reports/jacoco-it.exec @@ -104,6 +104,7 @@ <python.http.proxy.param /> <tomcat.version>9.0.27</tomcat.version> <ui.react.src>ui-react</ui.react.src> + <ui.react.lib.src>ui-react-lib</ui.react.lib.src> <npm.publish.url>https://nexus3.onap.org/repository/npm.release/</npm.publish.url> </properties> @@ -589,7 +590,7 @@ </testResource> </testResources> <resources> - <!-- For AAF folder maven should not try to filter Keystores/Truststores ... Otherwise + <!-- For AAF folder maven should not try to filter Keystores/Truststores ... Otherwise they will be broken and unreadable --> <resource> <directory>src/main/resources</directory> @@ -607,6 +608,9 @@ </resource> <resource> <directory>${ui.react.src}</directory> + <excludes> + <exclude>node_modules</exclude> + </excludes> <includes> <include>src/**</include> <include>public/**</include> @@ -616,6 +620,30 @@ <filtering>true</filtering> <targetPath>${project.build.directory}/${ui.react.src}</targetPath> </resource> + <resource> + <directory>${ui.react.src}</directory> + <includes> + <include>src/**</include> + </includes> + <excludes> + <exclude>**/__snapshots__/**</exclude> + <exclude>**/**.test.js</exclude> + </excludes> + <filtering>true</filtering> + <targetPath>${project.build.directory}/${ui.react.lib.src}</targetPath> + </resource> + <resource> + <directory>${ui.react.lib.src}</directory> + <includes> + <include>**</include> + </includes> + <excludes> + <exclude>node_modules/**</exclude> + <exclude>package-lock.json</exclude> + </excludes> + <filtering>true</filtering> + <targetPath>${project.build.directory}/${ui.react.lib.src}</targetPath> + </resource> </resources> <plugins> @@ -652,7 +680,7 @@ </executions> </plugin> - <!-- Read the swagger.json file and the definition from SwaggerConfig.java; generate + <!-- Read the swagger.json file and the definition from SwaggerConfig.java; generate a list of .adoc files containing the APIs info in more structured way --> <plugin> <groupId>io.github.swagger2markup</groupId> @@ -687,7 +715,7 @@ </executions> </plugin> - <!-- Run the generated asciidoc through Asciidoctor to generate other documentation + <!-- Run the generated asciidoc through Asciidoctor to generate other documentation types, such as PDFs or HTML5 --> <plugin> <groupId>org.asciidoctor</groupId> @@ -975,7 +1003,7 @@ <tag>${project.docker.latesttagtimestamp.version}</tag> <tag>${project.docker.latesttag.version}</tag> </tags> - <!-- A relative path is looked up in ${project.basedir}/src/main/docker by + <!-- A relative path is looked up in ${project.basedir}/src/main/docker by default --> <dockerFile>backend/Dockerfile</dockerFile> <assembly> @@ -997,7 +1025,7 @@ <tag>${project.docker.latesttagtimestamp.version}</tag> <tag>${project.docker.latesttag.version}</tag> </tags> - <!-- A relative path is looked up in ${project.basedir}/src/main/docker by + <!-- A relative path is looked up in ${project.basedir}/src/main/docker by default --> <dockerFile>frontend/Dockerfile</dockerFile> <assembly> @@ -1153,7 +1181,6 @@ <version>1.8.0</version> <configuration> <installDirectory>${project.build.directory}/${ui.react.src}</installDirectory> - <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory> </configuration> <executions> <execution> @@ -1163,8 +1190,8 @@ </goals> <phase>generate-sources</phase> <configuration> - <nodeVersion>v12.13.0</nodeVersion> - <npmVersion>6.13.0</npmVersion> + <nodeVersion>v12.13.0</nodeVersion> + <npmVersion>6.13.0</npmVersion> </configuration> </execution> <execution> @@ -1174,6 +1201,7 @@ </goals> <phase>compile</phase> <configuration> + <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory> <arguments>install</arguments> </configuration> </execution> @@ -1185,6 +1213,29 @@ <phase>test</phase> <configuration> <arguments>run-script test:coverage</arguments> + <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory> + </configuration> + </execution> + <execution> + <id>npm_install_lib</id> + <goals> + <goal>npm</goal> + </goals> + <phase>deploy</phase> + <configuration> + <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory> + <arguments>install</arguments> + </configuration> + </execution> + <execution> + <id>npm_build_lib</id> + <goals> + <goal>npm</goal> + </goals> + <phase>deploy</phase> + <configuration> + <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory> + <arguments>run build</arguments> </configuration> </execution> <execution> @@ -1194,6 +1245,7 @@ </goals> <phase>deploy</phase> <configuration> + <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory> <arguments>publish</arguments> </configuration> </execution> diff --git a/src/main/resources/clds/aaf/org.onap.clamp.p12 b/src/main/resources/clds/aaf/org.onap.clamp.p12 Binary files differindex dc24567b9..268aa1a3c 100644 --- a/src/main/resources/clds/aaf/org.onap.clamp.p12 +++ b/src/main/resources/clds/aaf/org.onap.clamp.p12 diff --git a/src/main/resources/clds/aaf/ssl/clamp.key b/src/main/resources/clds/aaf/ssl/clamp.key index af847d59a..bcbb9f17e 100644 --- a/src/main/resources/clds/aaf/ssl/clamp.key +++ b/src/main/resources/clds/aaf/ssl/clamp.key @@ -1,32 +1,32 @@ Bag Attributes friendlyName: clamp@clamp.onap.org - localKeyID: 54 69 6D 65 20 31 35 37 31 30 36 38 34 31 31 38 30 37 + localKeyID: 54 69 6D 65 20 31 35 38 30 38 32 39 30 36 35 34 37 39 Key Attributes: <No Attributes> -----BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCsuvJ9pjBqjrxI -+5TG2PTVRUob9Cx1uO3cUMzR01mxNodsSRdI3sq6Q2Nr+PenoT7edo8ujru8G79H -BfyUWBkNe3hJikCXzDV62cwavWtGjWIsOZHczJfj8ZrtObJ/uRpeGmbosY38zUwN -cGzT1vm2K67MPe2BazTI4JLxyGcJ0bZEZ0XGBMOup3Hqo2QOy7BaQMOTs20Ww3aB -64h7KAqaqNnblqUOtkLCUBdp6Lxa9oBXqS4Fg+C1eZqzuixLQgmWZs2ED+wl4FZD -DaIkN4gw4YTXhpxr82gauW3ro2sAYrJX63FqIzaj0rj/vqxYSy7fjzbsE1VPBxCH -yUuaHxUTAgMBAAECggEABaPlHy06D4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C8hVsCgYEAquy5I4hO4jNBQ6v5+omjsEgk4513/RNs +f47Md8bsDHKJMbCMKCdqM1D3J1xbgV3DgSv0yNlKdU2wenWdgQAyBtz18NBgno85 +YNanFhp1CymgLFHdLJHSOqAkzutSuCNnGTT6AKspOQvy+cuj7XsnbsxtYK3Cgw5h +Mom3RnUy9ZcCgYAnForHVEYDBgAYuI9g39z9dT8Q1dMA6SN6S6Ps0Xt/R5gF15e9 +941/FYiqr3yB+cWgrp7hu8XFD9/0F63waTuW2AgYSjZNnROHN5g/UbRxXqQOA3al +tXRUiHEbYjVTe4GX+ORF/8rvH19JUZmn87ekxII4fH/wOfIhBOxaV+yuuwKBgHtz +5Tizz/3y9TWSdkgtt6uwP+yipLKGn/v1wNrWM1G+PDdGg8TQyxTrasfkHjdu6LFY +dUHIJ85X4ZphbvRolrl8SKq5Zr+/RLsb7qy5SUZZt1Wrfysc25H6bvuA3ksfTuzW +5acr+Oc6KTGgkvMI229cebe1aONNtIhTDav3JGpbAoGAX5DQvNreqnP8qSAvUN2I +TAHXIzawR3f6vgGgVIdkHkiS2eKzs/fgP3VAK80TbrGSR8HvBcPEcR/icOn1u/e6 +tDp0j6mGt5aPKK9VQkBn94bW35T12FUbdB+L8FWWTUrfiVWJtEW8tEsKil5ac8U4 +Bn3vC5WUeKhW6v6kD4AigqE= -----END PRIVATE KEY----- diff --git a/src/main/resources/clds/aaf/ssl/clamp.pem b/src/main/resources/clds/aaf/ssl/clamp.pem index 22f4541a4..a01b587a5 100644 --- a/src/main/resources/clds/aaf/ssl/clamp.pem +++ b/src/main/resources/clds/aaf/ssl/clamp.pem @@ -1,32 +1,33 @@ Bag Attributes friendlyName: clamp@clamp.onap.org - localKeyID: 54 69 6D 65 20 31 35 37 31 30 36 38 34 31 31 38 30 37 + localKeyID: 54 69 6D 65 20 31 35 38 30 38 32 39 30 36 35 34 37 39 subject=CN = clamp, emailAddress = mark.d.manager@people.osaaf.com, OU = clamp@clamp.onap.org:DEV, OU = OSAAF,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VF+8iFpoTb17V8e3C +MQswCQYDVQQGEwJVU4IBBzAdBgNVHQ4EFgQUzfIed+18wgFs7E6q0b6BbMICtfsw +RwYDVR0RBEAwPoIFY2xhbXCCCmNsYW1wLW9uYXCCHWNsYW1wLmFwaS5zaW1wbGVk +ZW1vLm9uYXAub3JnggpjbGFtcC5vbmFwMA0GCSqGSIb3DQEBCwUAA4IBAQBizhsW +XrJ9wQy3PrBxgh90sOF15tayXPRZSFYPoQb5LhRh3IY/PvXLaSHlkgPHlCLLx36S +0/DiVf86/83ABvyaq9gJIyg/m4ntNae23OKH1AkA1aN+JCKA8yhsAzDBcRF6Aj7E +VJ+vQlSzz5oh+efP1e/8DUMd1/WwbTXvRd0Iqv/fyZunbjb82qNMrsK1mQ2q+87A +0jx9u1EdeMihP6vWiuKzlwy4mKoNT573SPpvaOkjX3yDlmf2CTQZ9vdAvjmFmVsH +1wyrNZOIgW4VjluiZfAk3mOEskrZiP/7aUXnxmNnYTpgZMbhiouLbRrTc4lLEyhx +G7A61/KGTsLZlvxb -----END CERTIFICATE----- diff --git a/ui-react-lib/libIndex.js b/ui-react-lib/libIndex.js new file mode 100755 index 000000000..89bf831d9 --- /dev/null +++ b/ui-react-lib/libIndex.js @@ -0,0 +1,45 @@ +/*- + * ============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============================================ + * =================================================================== + * + */ + +export { default as ConfigurationPolicyModal } from './src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal'; +export { default as DeployLoopModal } from './src/components/dialogs/Loop/DeployLoopModal'; +export { default as LoopActionService } from './src/api/LoopActionService'; +export { default as LoopCache } from './src/api/LoopCache'; +export { default as LoopComponentConverter } from './src/components/loop_viewer/svg/LoopComponentConverter'; +export { default as LoopLogs } from './src/components/loop_viewer/logs/LoopLogs'; +export { default as LoopPropertiesModal } from './src/components/dialogs/Loop/LoopPropertiesModal'; +export { default as LoopService } from './src/api/LoopService'; +export { default as LoopStatus } from './src/components/loop_viewer/status/LoopStatus'; +export { default as LoopSvg } from './src/components/loop_viewer/svg/LoopSvg'; +export { default as LoopUI } from './src/LoopUI'; +export { default as MenuBar } from './src/components/menu/MenuBar'; +export { default as NotFound } from './src/NotFound'; +export { default as OpenLoopModal } from './src/components/dialogs/Loop/OpenLoopModal'; +export { default as OperationalPolicyModal } from './src/components/dialogs/OperationalPolicy/OperationalPolicyModal'; +export { default as PerformActions } from './src/components/dialogs/PerformActions'; +export { default as RefreshStatus } from './src/components/dialogs/RefreshStatus'; +export { default as TemplateMenuService } from './src/api/TemplateMenuService'; +export { default as UserInfoModal } from './src/components/dialogs/UserInfoModal'; +export { default as UserService } from './src/api/UserService'; +export { default as ViewBlueprintMicroServiceTemplatesModal } from './src/components/dialogs/Tosca/ViewBlueprintMicroServiceTemplatesModal'; +export { default as ViewToscaPolicyModal } from './src/components/dialogs/Tosca/ViewToscaPolicyModal'; diff --git a/ui-react-lib/package.json b/ui-react-lib/package.json new file mode 100755 index 000000000..3698484d7 --- /dev/null +++ b/ui-react-lib/package.json @@ -0,0 +1,51 @@ +{ + "name": "onap-clamp-ui-lib", + "version": "${project.version}", + "description": "ONAP CLAMP UI Reactjs Component Library", + "author": "ONAP Clamp Team", + "license": "Apache-2.0", + "main": "dist/index.js", + "module": "dist/esindex.js", + "scripts": { + "build": "rollup -c" + }, + "files": [ + "dist" + ], + "peerDependencies": { + "@json-editor/json-editor": "1.4.0-beta.0", + "@material-ui/core": "4.6.0", + "@material-ui/icons": "4.5.1", + "bootstrap-css-only": "4.3.1", + "material-table": "1.53.0", + "react": "16.9.0", + "react-bootstrap": "1.0.0-beta.14", + "react-dom": "16.9.0", + "react-router-dom": "5.0.1", + "react-scripts": "3.1.1", + "react-select": "3.0.8", + "rollup": "^1.29.1", + "styled-components": "4.3.2" + }, + "devDependencies": { + "@babel/cli": "7.7.5", + "@babel/core": "7.7.5", + "@babel/helper-plugin-utils": "7.0.0", + "@babel/plugin-external-helpers": "^7.7.4", + "@babel/plugin-proposal-class-properties": "7.5.5", + "@babel/plugin-transform-runtime": "7.7.6", + "@babel/preset-env": "7.5.5", + "@babel/preset-react": "7.0.0", + "rollup": "1.29.1", + "@rollup/plugin-commonjs": "^11.0.1", + "@rollup/plugin-image": "2.0.0", + "@rollup/plugin-node-resolve": "7.0.0", + "@rollup/plugin-replace": "2.2.1", + "@rollup/plugin-url": "4.0.0", + "@svgr/rollup": "5.1.0", + "babel-plugin-external-helpers": "6.22.0", + "rollup-plugin-babel": "4.3.3", + "rollup-plugin-peer-deps-external": "2.2.0", + "rollup-plugin-postcss": "2.0.3" + } +} diff --git a/ui-react-lib/rollup.config.js b/ui-react-lib/rollup.config.js new file mode 100755 index 000000000..c671779c0 --- /dev/null +++ b/ui-react-lib/rollup.config.js @@ -0,0 +1,48 @@ +import babel from 'rollup-plugin-babel' +import commonjs from '@rollup/plugin-commonjs' +import postcss from 'rollup-plugin-postcss' +import resolve from '@rollup/plugin-node-resolve' +import external from 'rollup-plugin-peer-deps-external' +import img from '@rollup/plugin-image' + +import pkg from './package.json' + +export default { + input: './libIndex.js', + output: [ + { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + { + file: pkg.module, + format: 'es', + sourcemap: true + } + ], + plugins: [ + img(), + external(), + postcss({ + modules: true + }), + babel({ + exclude: 'node_modules/**', + presets: [ + + "@babel/preset-env", {}, + "@babel/preset-react", {} + ], + plugins: [ + [ + "@babel/plugin-proposal-class-properties", + { + "loose": true + } + ] + ] + }), + resolve({ preferBuiltins: true, mainFields: ['browser'] }) + ] +} 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; |