aboutsummaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react
diff options
context:
space:
mode:
Diffstat (limited to 'gui-clamp/ui-react')
-rw-r--r--gui-clamp/ui-react/package.json124
-rw-r--r--gui-clamp/ui-react/public/index.html40
-rw-r--r--gui-clamp/ui-react/public/manifest.json15
-rw-r--r--gui-clamp/ui-react/public/onap.icobin18046 -> 0 bytes
-rw-r--r--gui-clamp/ui-react/src/LoopUI.js431
-rw-r--r--gui-clamp/ui-react/src/LoopUI.test.js187
-rw-r--r--gui-clamp/ui-react/src/NotFound.js36
-rw-r--r--gui-clamp/ui-react/src/NotFound.test.js36
-rw-r--r--gui-clamp/ui-react/src/OnapClamp.js39
-rw-r--r--gui-clamp/ui-react/src/OnapClamp.test.js36
-rw-r--r--gui-clamp/ui-react/src/__snapshots__/LoopUI.test.js.snap218
-rw-r--r--gui-clamp/ui-react/src/__snapshots__/NotFound.test.js.snap26
-rw-r--r--gui-clamp/ui-react/src/__snapshots__/OnapClamp.test.js.snap244
-rw-r--r--gui-clamp/ui-react/src/api/ACMService.js180
-rw-r--r--gui-clamp/ui-react/src/api/ACMService.test.js54
-rw-r--r--gui-clamp/ui-react/src/api/LoopActionService.js74
-rw-r--r--gui-clamp/ui-react/src/api/LoopActionService.test.js58
-rw-r--r--gui-clamp/ui-react/src/api/LoopCache.js252
-rw-r--r--gui-clamp/ui-react/src/api/LoopCache.test.js305
-rw-r--r--gui-clamp/ui-react/src/api/LoopCacheMockFile.json135
-rw-r--r--gui-clamp/ui-react/src/api/LoopService.js244
-rw-r--r--gui-clamp/ui-react/src/api/LoopService.test.js443
-rw-r--r--gui-clamp/ui-react/src/api/PoliciesListCacheMockFile.json215
-rw-r--r--gui-clamp/ui-react/src/api/PolicyService.js152
-rw-r--r--gui-clamp/ui-react/src/api/PolicyService.test.js238
-rw-r--r--gui-clamp/ui-react/src/api/PolicyToscaService.js80
-rw-r--r--gui-clamp/ui-react/src/api/PolicyToscaService.test.js138
-rw-r--r--gui-clamp/ui-react/src/api/TemplateService.js197
-rw-r--r--gui-clamp/ui-react/src/api/TemplateService.test.js289
-rw-r--r--gui-clamp/ui-react/src/api/UserService.js75
-rw-r--r--gui-clamp/ui-react/src/api/UserService.test.js88
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.js120
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.test.js50
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.js171
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.test.js262
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.js155
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.test.js227
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.js56
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.test.js54
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.js150
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.test.js122
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.js54
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.test.js85
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.js272
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.test.js152
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.js124
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.test.js49
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.js41
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.test.js33
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.js52
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.test.js53
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.js217
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.test.js155
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.js113
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.test.js51
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.js85
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.test.js93
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.js132
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.test.js252
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.js52
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.test.js61
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/AccordionHeader.test.js.snap211
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ChangeOrderStateModal.test.js.snap114
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/CommissioningModal.test.js.snap77
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/DeleteToscaTemplate.test.js.snap20
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetLocalToscaFileForUpload.test.js.snap103
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetToscaTemplate.test.js.snap15
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstancePropertiesModal.test.js.snap105
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElementItem.test.js.snap9
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElements.test.js.snap3
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationItem.test.js.snap26
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationManagementModal.test.js.snap155
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap27
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/MonitorInstantiation.test.js.snap41
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ReadAndConvertYaml.test.js.snap63
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/UploadToscaFile.test.js.snap16
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/acmList.json59
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/commonProps.json1444
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/fullTemplate.json2194
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/instanceProps.json1444
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/jsonEditorData.json50
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/orderedStateJson.json9
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.js178
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.test.js94
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.js177
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.test.js54
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.js193
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js151
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js178
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.test.js114
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js118
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.test.js110
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js262
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js121
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/OpenLoopModal.js139
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js93
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/CreateLoopModal.test.js.snap167
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/DeployLoopModal.test.js.snap88
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/LoopPropertiesModal.test.js.snap61
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/OpenLoopModal.test.js.snap137
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/ManageDictionaries.js637
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/ManageDictionaries.test.js465
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/__snapshots__/ManageDictionaries.test.js.snap196
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/PerformActions.js95
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js121
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.js121
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.test.js54
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.js180
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.test.js93
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js192
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.test.js71
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PolicyModal.js349
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PolicyModal.test.js185
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.js135
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.test.js128
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/ToscaViewer.js66
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/ToscaViewer.test.js54
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js476
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.test.js164
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap23
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyDeploymentEditor.test.js.snap71
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap788
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyModal.test.js.snap159
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap80
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ToscaViewer.test.js.snap30
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap598
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/toscaData.test.json179
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/toscaData.test.yaml13
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/toscaInstantiationData.test.json59
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/toscaModels.test.json23
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesData.test.json336
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesList.test.json94
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Policy/toscaPolicyDeploymentEditor.test.json90
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/RefreshStatus.js65
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/RefreshStatus.test.js72
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.js173
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.test.js163
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Tosca/__snapshots__/ViewLoopTemplatesModal.test.js.snap157
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/UserInfoModal.js115
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/UserInfoModal.test.js84
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/__snapshots__/UserInfoModal.test.js.snap119
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/logs/LoopLogs.js97
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/logs/LoopLogs.test.js70
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/logs/__snapshots__/LoopLogs.test.js.snap62
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/status/LoopStatus.js110
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/status/LoopStatus.test.js78
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/status/__snapshots__/LoopStatus.test.js.snap66
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/svg/SvgGenerator.js247
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/svg/SvgGenerator.test.js63
-rw-r--r--gui-clamp/ui-react/src/components/loop_viewer/svg/__snapshots__/SvgGenerator.test.js.snap7
-rw-r--r--gui-clamp/ui-react/src/components/menu/MenuBar.js133
-rw-r--r--gui-clamp/ui-react/src/components/menu/MenuBar.test.js92
-rw-r--r--gui-clamp/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap1327
-rw-r--r--gui-clamp/ui-react/src/index.js38
-rw-r--r--gui-clamp/ui-react/src/index.test.js45
-rw-r--r--gui-clamp/ui-react/src/logo.pngbin21360 -> 0 bytes
-rw-r--r--gui-clamp/ui-react/src/setupTests.js28
-rw-r--r--gui-clamp/ui-react/src/theme/globalStyle.js98
-rw-r--r--gui-clamp/ui-react/src/utils/CsvToJson.js204
-rw-r--r--gui-clamp/ui-react/src/utils/CsvToJson.test.js268
-rw-r--r--gui-clamp/ui-react/src/utils/OnapConstants.js32
-rw-r--r--gui-clamp/ui-react/src/utils/OnapUtils.js65
-rw-r--r--gui-clamp/ui-react/src/utils/OnapUtils.test.js55
163 files changed, 0 insertions, 27220 deletions
diff --git a/gui-clamp/ui-react/package.json b/gui-clamp/ui-react/package.json
deleted file mode 100644
index b15cc1f..0000000
--- a/gui-clamp/ui-react/package.json
+++ /dev/null
@@ -1,124 +0,0 @@
-{
- "name": "onap-policy-clamp-ui",
- "version": "${project.version}",
- "description": "ONAP Policy Clamp UI",
- "author": "ONAP Policy Team",
- "license": "Apache-2.0",
- "publishConfig": {
- "registry": "${npm.publish.url}"
- },
- "main": "index.js",
- "homepage": ".",
- "proxy": "http://policy-clamp-runtime-acm:6969",
- "scripts": {
- "start": "HTTPS=false react-scripts start",
- "build": "react-scripts build",
- "test": "jest",
- "test:watch": "jest --watch",
- "test:coverage": "jest --coverage",
- "eject": "react-scripts eject"
- },
- "files": [
- "src/*.js",
- "src/*.png",
- "src/api",
- "src/components",
- "src/theme"
- ],
- "dependencies": {
- "@babel/runtime": "7.16.5",
- "@fortawesome/fontawesome-free": "5.15.3",
- "@json-editor/json-editor": "2.5.4",
- "@material-ui/core": "4.12.3",
- "@material-ui/icons": "4.11.2",
- "@material-ui/lab": "4.0.0-alpha.60",
- "@material-ui/pickers": "3.3.10",
- "bootstrap-css-only": "4.4.1",
- "debug": "^4.3.4",
- "js-yaml": "4.1.0",
- "material-table": "1.68.0",
- "package.json": "^2.0.1",
- "react": "17.0.2",
- "react-bootstrap": "1.6.1",
- "react-dom": "17.0.2",
- "react-router-dom": "5.2.0",
- "react-scripts": "4.0.3",
- "react-select": "4.3.1",
- "styled-components": "5.3.0"
- },
- "devDependencies": {
- "@babel/plugin-proposal-class-properties": "7.14.5",
- "@babel/plugin-transform-runtime": "7.16.5",
- "@babel/preset-env": "7.14.7",
- "@babel/preset-react": "7.14.5",
- "@wojtekmaj/enzyme-adapter-react-17": "0.6.2",
- "babel-jest": "26.6.0",
- "enzyme": "3.11.0",
- "enzyme-adapter-react-17-updated": "1.0.2",
- "enzyme-to-json": "3.6.2",
- "history": "5.0.0",
- "jest": "26.6.0",
- "jest-canvas-mock": "2.3.1",
- "jest-fetch-mock": "3.0.3",
- "jest-sonar-reporter": "2.0.0"
- },
- "browserslist": [
- ">0.2%",
- "not dead",
- "not ie <= 11",
- "not op_mini all"
- ],
- "jest": {
- "verbose": true,
- "collectCoverage": true,
- "coverageDirectory": "${project.build.directory}/code-coverage",
- "collectCoverageFrom": [
- "**/*.{js,jsx}",
- "!./src/setupTests.js"
- ],
- "testResultsProcessor": "jest-sonar-reporter",
- "rootDir": "${project.build.directory}/${ui.react.src}",
- "coverageReporters": [
- "lcov"
- ],
- "moduleNameMapper": {
- "\\.(css|png)$": "identity-obj-proxy"
- },
- "setupFiles": [
- "./src/setupTests.js",
- "jest-canvas-mock"
- ],
- "snapshotSerializers": [
- "enzyme-to-json/serializer"
- ]
- },
- "jestSonar": {
- "reportPath": "../../target/reports",
- "reportFile": "test-reporter.xml",
- "indent": 4,
- "sonar56x": true
- },
- "babel": {
- "presets": [
- "@babel/preset-env",
- "@babel/preset-react"
- ],
- "plugins": [
- [
- "@babel/plugin-proposal-class-properties",
- {
- "loose": true
- }
- ],
- [
- "@babel/plugin-transform-runtime"
- ],
- [
- "@babel/plugin-proposal-private-methods",
- {
- "loose": true
- }
- ]
- ]
- }
-}
diff --git a/gui-clamp/ui-react/public/index.html b/gui-clamp/ui-react/public/index.html
deleted file mode 100644
index bab3e7a..0000000
--- a/gui-clamp/ui-react/public/index.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- ============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============================================
- ===================================================================
-
- -->
-
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport"
- content="width=device-width, initial-scale=1, shrink-to-fit=no">
-<meta name="theme-color" content="#000000">
-<link rel="manifest" href="manifest.json">
-<link rel="shortcut icon" href="onap.ico">
-
-<title>Clamp Designer UI</title>
-</head>
-<body>
- <noscript>You need to enable JavaScript to run this app.</noscript>
- <div id="root"></div>
-</body>
-</html>
diff --git a/gui-clamp/ui-react/public/manifest.json b/gui-clamp/ui-react/public/manifest.json
deleted file mode 100644
index 8210c4e..0000000
--- a/gui-clamp/ui-react/public/manifest.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "short_name": "Clamp Designer UI",
- "name": "Clamp Designer UI",
- "icons": [
- {
- "src": "onap.ico",
- "sizes": "64x64 32x32 24x24 16x16",
- "type": "image/x-icon"
- }
- ],
- "start_url": "./index.html",
- "display": "standalone",
- "theme_color": "#000000",
- "background_color": "#ffffff"
-}
diff --git a/gui-clamp/ui-react/public/onap.ico b/gui-clamp/ui-react/public/onap.ico
deleted file mode 100644
index 85e168a..0000000
--- a/gui-clamp/ui-react/public/onap.ico
+++ /dev/null
Binary files differ
diff --git a/gui-clamp/ui-react/src/LoopUI.js b/gui-clamp/ui-react/src/LoopUI.js
deleted file mode 100644
index 46e12e1..0000000
--- a/gui-clamp/ui-react/src/LoopUI.js
+++ /dev/null
@@ -1,431 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from 'react';
-import styled from 'styled-components';
-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 SvgGenerator from './components/loop_viewer/svg/SvgGenerator';
-import LoopLogs from './components/loop_viewer/logs/LoopLogs';
-import LoopStatus from './components/loop_viewer/status/LoopStatus';
-import UserService from './api/UserService';
-import LoopCache from './api/LoopCache';
-import LoopActionService from './api/LoopActionService';
-
-import { Route } from 'react-router-dom'
-import CreateLoopModal from './components/dialogs/Loop/CreateLoopModal';
-import OpenLoopModal from './components/dialogs/Loop/OpenLoopModal';
-import ModifyLoopModal from './components/dialogs/Loop/ModifyLoopModal';
-import PolicyModal from './components/dialogs/Policy/PolicyModal';
-import ViewAllPolicies from './components/dialogs/Policy/ViewAllPolicies';
-import LoopPropertiesModal from './components/dialogs/Loop/LoopPropertiesModal';
-import UserInfoModal from './components/dialogs/UserInfoModal';
-import LoopService from './api/LoopService';
-import ViewLoopTemplatesModal from './components/dialogs/Tosca/ViewLoopTemplatesModal';
-import ManageDictionaries from './components/dialogs/ManageDictionaries/ManageDictionaries';
-import PerformAction from './components/dialogs/PerformActions';
-import RefreshStatus from './components/dialogs/RefreshStatus';
-import DeployLoopModal from './components/dialogs/Loop/DeployLoopModal';
-import Alert from 'react-bootstrap/Alert';
-import Spinner from 'react-bootstrap/Spinner';
-
-import { Link } from 'react-router-dom';
-import ReadAndConvertYaml from "./components/dialogs/ACM/ReadAndConvertYaml";
-import MonitorInstantiation from "./components/dialogs/ACM/MonitorInstantiation";
-import GetLocalToscaFileForUpload from "./components/dialogs/ACM/GetLocalToscaFileForUpload";
-import CommissioningModal from "./components/dialogs/ACM/CommissioningModal";
-import InstancePropertiesModal from "./components/dialogs/ACM/InstancePropertiesModal";
-import ChangeOrderStateModal from "./components/dialogs/ACM/ChangeOrderStateModal";
-import InstantiationManagementModal from "./components/dialogs/ACM/InstantiationManagementModal";
-
-const StyledMainDiv = styled.div`
- background-color: ${ props => props.theme.backgroundColor };
-`
-
-const StyledSpinnerDiv = styled.div`
- justify-content: center !important;
- display: flex !important;
-`;
-
-const ProjectNameStyled = styled.a`
- vertical-align: middle;
- padding-left: 30px;
- font-size: 36px;
- font-weight: bold;
-`
-
-const StyledRouterLink = styled(Link)`
- color: ${ props => props.theme.menuFontColor };
- background-color: ${ props => props.theme.backgroundColor };
-`
-
-const StyledLoginInfo = styled.a`
- color: ${ props => props.theme.menuFontColor };
- background-color: ${ props => props.theme.backgroundColor };
-`
-
-const LoopViewDivStyled = styled.div`
- height: 100%;
- overflow: hidden;
- margin-left: 10px;
- margin-right: 10px;
- margin-bottom: 10px;
- color: ${ props => props.theme.loopViewerFontColor };
- background-color: ${ props => props.theme.loopViewerBackgroundColor };
- border: 1px solid transparent;
- border-color: ${ props => props.theme.loopViewerHeaderBackgroundColor };
-`
-
-const LoopViewHeaderDivStyled = styled.div`
- background-color: ${ props => props.theme.loopViewerHeaderBackgroundColor };
- padding: 10px 10px;
- color: ${ props => props.theme.loopViewerHeaderFontColor };
-`
-
-const LoopViewBodyDivStyled = styled.div`
- background-color: ${ props => (props.theme.loopViewerBackgroundColor) };
- padding: 10px 10px;
- color: ${ props => (props.theme.loopViewerHeaderFontColor) };
- height: 95%;
-`
-
-export default class LoopUI extends React.Component {
-
- state = {
- userName: null,
- loopName: OnapConstants.defaultLoopName,
- loopCache: new LoopCache({}),
- showSucAlert: false,
- showFailAlert: false,
- busyLoadingCount: 0
- };
-
- constructor() {
- super();
- this.getUser = this.getUser.bind(this);
- this.updateLoopCache = this.updateLoopCache.bind(this);
- this.loadLoop = this.loadLoop.bind(this);
- this.closeLoop = this.closeLoop.bind(this);
- this.showSucAlert = this.showSucAlert.bind(this);
- this.showFailAlert = this.showFailAlert.bind(this);
- this.disableAlert = this.disableAlert.bind(this);
- 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() {
- this.getUser();
- }
-
- getUser() {
- UserService.login().then(user => {
- this.setState({ userName: user })
- });
- }
-
- renderMenuNavBar() {
- return (
- <MenuBar loopName={ this.state.loopName }/>
- );
- }
-
- renderUserLoggedNavBar() {
- return (
- <Navbar.Text>
- <StyledLoginInfo>Signed in as: </StyledLoginInfo>
- <StyledRouterLink to="/userInfo">{ this.state.userName }</StyledRouterLink>
- </Navbar.Text>
- );
- }
-
- renderLogoNavBar() {
- return (
- <Navbar.Brand>
- <img height="50px" width="234px" src={ logo } alt=""/>
- <ProjectNameStyled>CLAMP</ProjectNameStyled>
- </Navbar.Brand>
- );
- }
-
- renderAlertBar() {
- return (
- <div>
- <Alert variant="success" show={ this.state.showSucAlert } onClose={ this.disableAlert } dismissible>
- { this.state.showMessage }
- </Alert>
- <Alert variant="danger" show={ this.state.showFailAlert } onClose={ this.disableAlert } dismissible>
- { this.state.showMessage }
- </Alert>
- </div>
- );
- }
-
- renderNavBar() {
- return (
- <Navbar>
- { this.renderLogoNavBar() }
- <Navbar.Toggle aria-controls="responsive-navbar-nav"/>
- { this.renderMenuNavBar() }
- { this.renderUserLoggedNavBar() }
- </Navbar>
- );
- }
-
- renderLoopViewHeader() {
- return (
- <LoopViewHeaderDivStyled>
- Loop Viewer - { this.state.loopName } - ({ this.state.loopCache.getTemplateName() })
- </LoopViewHeaderDivStyled>
- );
- }
-
- renderSvg() {
- return (
- <SvgGenerator loopCache={ this.state.loopCache } clickable={ true } generatedFrom={ SvgGenerator.GENERATED_FROM_INSTANCE } isBusyLoading={ this.isBusyLoading }/>
- )
- }
-
- renderLoopViewBody() {
- return (
- <LoopViewBodyDivStyled>
- { this.renderSvg() }
- <LoopStatus loopCache={ this.state.loopCache }/>
- <LoopLogs loopCache={ this.state.loopCache }/>
- </LoopViewBodyDivStyled>
- );
- }
-
- getLoopCache() {
- return this.state.loopCache;
-
- }
-
- renderLoopViewer() {
- return (
- <LoopViewDivStyled>
- { this.renderLoopViewHeader() }
- { this.renderLoopViewBody() }
- </LoopViewDivStyled>
- );
- }
-
- updateLoopCache(loopJson) {
-
- // 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 });
- }
-
- showFailAlert(message) {
- this.setState({ showFailAlert: true, showMessage: message });
- }
-
- disableAlert() {
- this.setState({ showSucAlert: false, showFailAlert: false });
- }
-
- loadLoop(loopName) {
- this.setBusyLoading();
- LoopService.getLoop(loopName).then(loop => {
- console.debug("Updating loopCache");
- LoopActionService.refreshStatus(loopName).then(data => {
- this.updateLoopCache(data);
- this.clearBusyLoading();
- this.props.history.push('/');
- })
- .catch(error => {
- this.updateLoopCache(loop);
- this.clearBusyLoading();
- this.props.history.push('/');
- });
- });
- }
-
- setBusyLoading() {
- this.setState((state, props) => ({ busyLoadingCount: ++state.busyLoadingCount }));
- }
-
- clearBusyLoading() {
- this.setState((state, props) => ({ busyLoadingCount: --state.busyLoadingCount }));
- }
-
- isBusyLoading() {
- if (this.state.busyLoadingCount === 0) {
- return false;
- } else {
- return true;
- }
- }
-
- closeLoop() {
- this.setState({ loopCache: new LoopCache({}), loopName: OnapConstants.defaultLoopName });
- this.props.history.push('/');
- }
-
- renderRoutes() {
- return (
- <React.Fragment>
- <Route path="/readToscaTemplate" render={ (routeProps) => (<ReadAndConvertYaml { ...routeProps } />) }/>
- <Route path="/uploadToscaFile" render={ (routeProps) => (<GetLocalToscaFileForUpload { ...routeProps } />) }/>
- <Route path="/getJsonSchema" render={ (routeProps) => (<CommissioningModal { ...routeProps } />) }/>
- <Route path="/viewLoopTemplatesModal" render={ (routeProps) => (<ViewLoopTemplatesModal { ...routeProps } />) }/>
- <Route path="/manageDictionaries" render={ (routeProps) => (<ManageDictionaries { ...routeProps } />) }/>
- <Route path="/viewAllPolicies" render={ (routeProps) => (<ViewAllPolicies { ...routeProps } />) }/>
- <Route path="/policyModal/:policyInstanceType/:policyName" render={ (routeProps) => (<PolicyModal { ...routeProps }
- loopCache={ this.getLoopCache() }
- loadLoopFunction={ this.loadLoop }/>) }
- />
- <Route path="/createLoop" render={ (routeProps) => (<CreateLoopModal { ...routeProps }
- loadLoopFunction={ this.loadLoop }/>) }
- />
- <Route path="/openLoop" render={ (routeProps) => (<OpenLoopModal { ...routeProps }
- loadLoopFunction={ this.loadLoop }/>) }
- />
- <Route path="/loopProperties" render={ (routeProps) => (<LoopPropertiesModal { ...routeProps }
- loopCache={ this.getLoopCache() }
- loadLoopFunction={ this.loadLoop }/>) }
- />
- <Route path="/modifyLoop" render={ (routeProps) => (<ModifyLoopModal { ...routeProps }
- loopCache={ this.getLoopCache() }
- loadLoopFunction={ this.loadLoop }/>) }
- />
-
- <Route path="/userInfo" render={ (routeProps) => (<UserInfoModal { ...routeProps } />) }/>
- <Route path="/closeLoop" render={ this.closeLoop }/>
-
- <Route path="/submit" render={ (routeProps) => (<PerformAction { ...routeProps }
- loopAction="submit"
- loopCache={ this.getLoopCache() }
- updateLoopFunction={ this.updateLoopCache }
- showSucAlert={ this.showSucAlert }
- showFailAlert={ this.showFailAlert }
- setBusyLoading={ this.setBusyLoading }
- clearBusyLoading={ this.clearBusyLoading }/>) }
- />
- <Route path="/stop" render={ (routeProps) => (<PerformAction { ...routeProps }
- loopAction="stop"
- loopCache={ this.getLoopCache() }
- updateLoopFunction={ this.updateLoopCache }
- showSucAlert={ this.showSucAlert }
- showFailAlert={ this.showFailAlert }
- setBusyLoading={ this.setBusyLoading }
- clearBusyLoading={ this.clearBusyLoading }/>) }
- />
- <Route path="/restart" render={ (routeProps) => (<PerformAction { ...routeProps }
- loopAction="restart"
- loopCache={ this.getLoopCache() }
- updateLoopFunction={ this.updateLoopCache }
- showSucAlert={ this.showSucAlert }
- showFailAlert={ this.showFailAlert }
- setBusyLoading={ this.setBusyLoading }
- clearBusyLoading={ this.clearBusyLoading }/>) }
- />
- <Route path="/delete" render={ (routeProps) => (<PerformAction { ...routeProps }
- loopAction="delete"
- loopCache={ this.getLoopCache() }
- updateLoopFunction={ this.updateLoopCache }
- showSucAlert={ this.showSucAlert }
- showFailAlert={ this.showFailAlert }
- setBusyLoading={ this.setBusyLoading }
- clearBusyLoading={ this.clearBusyLoading }/>) }
- />
- <Route path="/undeploy" render={ (routeProps) => (<PerformAction { ...routeProps }
- loopAction="undeploy"
- loopCache={ this.getLoopCache() }
- updateLoopFunction={ this.updateLoopCache }
- showSucAlert={ this.showSucAlert }
- showFailAlert={ this.showFailAlert }
- setBusyLoading={ this.setBusyLoading }
- clearBusyLoading={ this.clearBusyLoading }/>) }
- />
- <Route path="/deploy" render={ (routeProps) => (<DeployLoopModal { ...routeProps }
- loopCache={ this.getLoopCache() }
- updateLoopFunction={ this.updateLoopCache }
- showSucAlert={ this.showSucAlert }
- showFailAlert={ this.showFailAlert }/>) }
- />
- <Route path="/refreshStatus" render={ (routeProps) => (<RefreshStatus { ...routeProps }
- loopCache={ this.getLoopCache() }
- updateLoopFunction={ this.updateLoopCache }
- showSucAlert={ this.showSucAlert }
- showFailAlert={ this.showFailAlert }/>) }
- />
- <Route path="/monitorInstantiation" render={ (routeProps) => (<MonitorInstantiation { ...routeProps } />) }/>
- <Route path="/instantiationManagement" render={ (routeProps) => (<InstantiationManagementModal { ...routeProps } />) }/>
- <Route path="/editACMInstanceProperties" render={ (routeProps) => (<InstancePropertiesModal { ...routeProps } />) }/>
- <Route path="/changeOrderState" render={ (routeProps) => (<ChangeOrderStateModal { ...routeProps } />) }/>
- </React.Fragment>
- );
- }
-
- renderGlobalStyle() {
- return (
- <GlobalClampStyle/>
- );
- };
-
-
- renderSpinner() {
- if (this.isBusyLoading()) {
- return (
- <StyledSpinnerDiv>
- <Spinner animation="border" role="status">
- <span className="sr-only">Loading...</span>
- </Spinner>
- </StyledSpinnerDiv>
- );
- } else {
- return (<div></div>);
- }
- }
-
- render() {
- return (
- <StyledMainDiv id="main_div">
- { this.renderGlobalStyle() }
- { this.renderRoutes() }
- { this.renderSpinner() }
- { this.renderAlertBar() }
- { this.renderNavBar() }
- { this.renderLoopViewer() }
- </StyledMainDiv>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/LoopUI.test.js b/gui-clamp/ui-react/src/LoopUI.test.js
deleted file mode 100644
index 083b233..0000000
--- a/gui-clamp/ui-react/src/LoopUI.test.js
+++ /dev/null
@@ -1,187 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-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';
-import LoopService from './api/LoopService';
-
-import { ThemeConsumer } from 'styled-components'
-import { GlobalClampStyle } from './theme/globalStyle.js';
-import { DefaultClampTheme } from './theme/globalStyle.js';
-
-export const shallowWithTheme = (children, theme = DefaultClampTheme) => {
- ThemeConsumer._currentValue = theme
- return shallow(children)
-}
-describe('Verify LoopUI', () => {
- beforeEach(() => {
- fetch.resetMocks();
- fetch.mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "testUser"
-
- });
- });
- })
-
- const loopCache = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "components": {
- "POLICY": {
- "componentState": {
- "stateName": "UNKNOWN",
- "description": "The policies defined have NOT yet been created on the policy engine"
- }
- },
- "DCAE": {
- "componentState": {
- "stateName": "BLUEPRINT_DEPLOYED",
- "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
- }
- }
- }
- });
-
- it('Test the render method', async () => {
- const flushPromises = () => new Promise(setImmediate);
-
- const component = shallow(<LoopUI/>)
- component.setState({
- loopName: "testLoopName",
- showSucAlert: false,
- showFailAlert: false
- });
- await flushPromises();
- expect(component).toMatchSnapshot();
- });
-
- test('Test closeLoop method', () => {
- const historyMock = { push: jest.fn() };
- const component = shallow(<LoopUI history={ historyMock }/>)
- const instance = component.instance();
- instance.closeLoop();
-
- expect(component.state('loopName')).toEqual(OnapConstants.defaultLoopName);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- })
-
- test('Test loadLoop method refresh suc', async () => {
- const historyMock = { push: jest.fn() };
- LoopService.getLoop = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => {
- }
- });
- });
-
- LoopActionService.refreshStatus = jest.fn().mockImplementation(() => {
- return Promise.resolve({ name: "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca" });
- });
-
- const flushPromises = () => new Promise(setImmediate);
- const component = shallow(<LoopUI history={ historyMock }/>)
- const instance = component.instance();
- instance.loadLoop("LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca");
-
- await flushPromises();
-
- const resLoopCache = instance.getLoopCache();
-
- expect(resLoopCache.getComponentStates()).toBeUndefined();
- expect(component.state('loopName')).toEqual("LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca");
- })
-
- test('Test loadLoop method refresh fail', async () => {
- const historyMock = { push: jest.fn() };
- LoopService.getLoop = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- name: "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "components": {
- "POLICY": {
- "componentState": {
- "stateName": "UNKNOWN",
- "description": "The policies defined have NOT yet been created on the policy engine"
- }
- },
- "DCAE": {
- "componentState": {
- "stateName": "BLUEPRINT_DEPLOYED",
- "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
- }
- }
- }
- });
- });
-
- LoopActionService.refreshStatus = jest.fn().mockImplementation(() => {
- return Promise.reject({ error: "whatever" });
- });
-
- const flushPromises = () => new Promise(setImmediate);
- const component = shallow(<LoopUI history={ historyMock }/>)
- const instance = component.instance();
- instance.loadLoop("LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca");
-
- await flushPromises();
-
- const resLoopCache = instance.getLoopCache();
-
- expect(resLoopCache).toEqual(loopCache);
- expect(component.state('loopName')).toEqual("LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca");
- })
-
- test('Test alert methods', () => {
- const component = shallow(<LoopUI/>)
- expect(component.state('showSucAlert')).toEqual(false);
-
- const instance = component.instance();
- instance.showSucAlert("testAlert");
- expect(component.state('showSucAlert')).toEqual(true);
- expect(component.state('showFailAlert')).toEqual(false);
- expect(component.state('showMessage')).toEqual("testAlert");
-
- instance.disableAlert();
-
- expect(component.state('showSucAlert')).toEqual(false);
- expect(component.state('showFailAlert')).toEqual(false);
-
- instance.showFailAlert("testAlert2");
- expect(component.state('showSucAlert')).toEqual(false);
- expect(component.state('showFailAlert')).toEqual(true);
- expect(component.state('showMessage')).toEqual("testAlert2");
- })
-
- test('Test renders correctly Clamp Style', () => {
- let tree = shallowWithTheme(<GlobalClampStyle />);
- expect(tree).toMatchSnapshot();
- })
-});
diff --git a/gui-clamp/ui-react/src/NotFound.js b/gui-clamp/ui-react/src/NotFound.js
deleted file mode 100644
index fb6d10a..0000000
--- a/gui-clamp/ui-react/src/NotFound.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react'
-
-
-export default class NotFound extends React.Component {
- render() {
- return (
- <div id='main'>
- <div class="divRow"><b>Page Not Found!</b></div>
- <div class="divRow">Please cick <a href="/">here</a> to go back to the main page.</div>
- </div>
-
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/NotFound.test.js b/gui-clamp/ui-react/src/NotFound.test.js
deleted file mode 100644
index 3b4dcb0..0000000
--- a/gui-clamp/ui-react/src/NotFound.test.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import NotFound from './NotFound';
-
-describe('Verify OnapClamp', () => {
-
- it('Test the render method', () => {
-
- const component = shallow(<NotFound/>)
-
- expect(component).toMatchSnapshot();
- });
-
-});
diff --git a/gui-clamp/ui-react/src/OnapClamp.js b/gui-clamp/ui-react/src/OnapClamp.js
deleted file mode 100644
index b8615ac..0000000
--- a/gui-clamp/ui-react/src/OnapClamp.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-
-import React from 'react';
-import LoopUI from './LoopUI'
-import { ThemeProvider } from 'styled-components';
-import { DefaultClampTheme } from './theme/globalStyle.js';
-
-export default class OnapClamp extends LoopUI {
-
- render() {
- console.info("Onap Clamp UI starting");
- return (
- <ThemeProvider theme={ DefaultClampTheme }>
- { super.render() }
- </ThemeProvider>);
- }
-}
-
diff --git a/gui-clamp/ui-react/src/OnapClamp.test.js b/gui-clamp/ui-react/src/OnapClamp.test.js
deleted file mode 100644
index c711a95..0000000
--- a/gui-clamp/ui-react/src/OnapClamp.test.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import OnapClamp from './OnapClamp';
-
-describe('Verify OnapClamp', () => {
-
- it('Test the render method', () => {
-
- const component = shallow(<OnapClamp/>)
-
- expect(component).toMatchSnapshot();
- });
-
-});
diff --git a/gui-clamp/ui-react/src/__snapshots__/LoopUI.test.js.snap b/gui-clamp/ui-react/src/__snapshots__/LoopUI.test.js.snap
deleted file mode 100644
index 573a131..0000000
--- a/gui-clamp/ui-react/src/__snapshots__/LoopUI.test.js.snap
+++ /dev/null
@@ -1,218 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify LoopUI Test renders correctly Clamp Style 1`] = `""`;
-
-exports[`Verify LoopUI Test the render method 1`] = `
-<styled.div
- id="main_div"
->
- <Memo(l) />
- <Route
- path="/readToscaTemplate"
- render={[Function]}
- />
- <Route
- path="/uploadToscaFile"
- render={[Function]}
- />
- <Route
- path="/getJsonSchema"
- render={[Function]}
- />
- <Route
- path="/viewLoopTemplatesModal"
- render={[Function]}
- />
- <Route
- path="/manageDictionaries"
- render={[Function]}
- />
- <Route
- path="/viewAllPolicies"
- render={[Function]}
- />
- <Route
- path="/policyModal/:policyInstanceType/:policyName"
- render={[Function]}
- />
- <Route
- path="/createLoop"
- render={[Function]}
- />
- <Route
- path="/openLoop"
- render={[Function]}
- />
- <Route
- path="/loopProperties"
- render={[Function]}
- />
- <Route
- path="/modifyLoop"
- render={[Function]}
- />
- <Route
- path="/userInfo"
- render={[Function]}
- />
- <Route
- path="/closeLoop"
- render={[Function]}
- />
- <Route
- path="/submit"
- render={[Function]}
- />
- <Route
- path="/stop"
- render={[Function]}
- />
- <Route
- path="/restart"
- render={[Function]}
- />
- <Route
- path="/delete"
- render={[Function]}
- />
- <Route
- path="/undeploy"
- render={[Function]}
- />
- <Route
- path="/deploy"
- render={[Function]}
- />
- <Route
- path="/refreshStatus"
- render={[Function]}
- />
- <Route
- path="/monitorInstantiation"
- render={[Function]}
- />
- <Route
- path="/instantiationManagement"
- render={[Function]}
- />
- <Route
- path="/editACMInstanceProperties"
- render={[Function]}
- />
- <Route
- path="/changeOrderState"
- render={[Function]}
- />
- <div />
- <div>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="success"
- />
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="danger"
- />
- </div>
- <Navbar
- collapseOnSelect={false}
- expand={true}
- variant="light"
- >
- <NavbarBrand>
- <img
- alt=""
- height="50px"
- src={null}
- width="234px"
- />
- <styled.a>
- CLAMP
- </styled.a>
- </NavbarBrand>
- <NavbarToggle
- aria-controls="responsive-navbar-nav"
- label="Toggle navigation"
- />
- <MenuBar
- loopName="testLoopName"
- />
- <NavbarText>
- <styled.a>
- Signed in as:
- </styled.a>
- <Styled(Link)
- to="/userInfo"
- >
- testUser
- </Styled(Link)>
- </NavbarText>
- </Navbar>
- <styled.div>
- <styled.div>
- Loop Viewer -
- testLoopName
- - (
- )
- </styled.div>
- <styled.div>
- <withRouter(SvgGenerator)
- clickable={true}
- generatedFrom="INSTANCE"
- isBusyLoading={[Function]}
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- <LoopStatus
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- <LoopLogs
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- </styled.div>
- </styled.div>
-</styled.div>
-`;
diff --git a/gui-clamp/ui-react/src/__snapshots__/NotFound.test.js.snap b/gui-clamp/ui-react/src/__snapshots__/NotFound.test.js.snap
deleted file mode 100644
index 86bcfd1..0000000
--- a/gui-clamp/ui-react/src/__snapshots__/NotFound.test.js.snap
+++ /dev/null
@@ -1,26 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify OnapClamp Test the render method 1`] = `
-<div
- id="main"
->
- <div
- class="divRow"
- >
- <b>
- Page Not Found!
- </b>
- </div>
- <div
- class="divRow"
- >
- Please cick
- <a
- href="/"
- >
- here
- </a>
- to go back to the main page.
- </div>
-</div>
-`;
diff --git a/gui-clamp/ui-react/src/__snapshots__/OnapClamp.test.js.snap b/gui-clamp/ui-react/src/__snapshots__/OnapClamp.test.js.snap
deleted file mode 100644
index 5bb4f3a..0000000
--- a/gui-clamp/ui-react/src/__snapshots__/OnapClamp.test.js.snap
+++ /dev/null
@@ -1,244 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify OnapClamp Test the render method 1`] = `
-<Component
- theme={
- Object {
- "backgroundColor": "#eeeeee",
- "fontDanger": "#eb238e",
- "fontDark": "#888888",
- "fontFamily": "Arial, Sans-serif",
- "fontHighlight": "#ffff00",
- "fontLight": "#ffffff",
- "fontNormal": "black",
- "fontSize": "16px",
- "fontWarning": "#eb238e",
- "loopLogsHeaderBackgroundColor": "white",
- "loopLogsHeaderFontColor": "black",
- "loopViewerBackgroundColor": "white",
- "loopViewerFontColor": "yellow",
- "loopViewerHeaderBackgroundColor": "#337ab7",
- "loopViewerHeaderFontColor": "white",
- "menuBackgroundColor": "white",
- "menuFontColor": "black",
- "menuHighlightedBackgroundColor": "#337ab7",
- "menuHighlightedFontColor": "white",
- "policyEditorBackgroundColor": "white",
- "policyEditorFontSize": "13px",
- "toscaTextareaBackgroundColor": "white",
- "toscaTextareaFontSize": "13px",
- }
- }
->
- <styled.div
- id="main_div"
- >
- <Memo(l) />
- <Route
- path="/readToscaTemplate"
- render={[Function]}
- />
- <Route
- path="/uploadToscaFile"
- render={[Function]}
- />
- <Route
- path="/getJsonSchema"
- render={[Function]}
- />
- <Route
- path="/viewLoopTemplatesModal"
- render={[Function]}
- />
- <Route
- path="/manageDictionaries"
- render={[Function]}
- />
- <Route
- path="/viewAllPolicies"
- render={[Function]}
- />
- <Route
- path="/policyModal/:policyInstanceType/:policyName"
- render={[Function]}
- />
- <Route
- path="/createLoop"
- render={[Function]}
- />
- <Route
- path="/openLoop"
- render={[Function]}
- />
- <Route
- path="/loopProperties"
- render={[Function]}
- />
- <Route
- path="/modifyLoop"
- render={[Function]}
- />
- <Route
- path="/userInfo"
- render={[Function]}
- />
- <Route
- path="/closeLoop"
- render={[Function]}
- />
- <Route
- path="/submit"
- render={[Function]}
- />
- <Route
- path="/stop"
- render={[Function]}
- />
- <Route
- path="/restart"
- render={[Function]}
- />
- <Route
- path="/delete"
- render={[Function]}
- />
- <Route
- path="/undeploy"
- render={[Function]}
- />
- <Route
- path="/deploy"
- render={[Function]}
- />
- <Route
- path="/refreshStatus"
- render={[Function]}
- />
- <Route
- path="/monitorInstantiation"
- render={[Function]}
- />
- <Route
- path="/instantiationManagement"
- render={[Function]}
- />
- <Route
- path="/editACMInstanceProperties"
- render={[Function]}
- />
- <Route
- path="/changeOrderState"
- render={[Function]}
- />
- <div />
- <div>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="success"
- />
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="danger"
- />
- </div>
- <Navbar
- collapseOnSelect={false}
- expand={true}
- variant="light"
- >
- <NavbarBrand>
- <img
- alt=""
- height="50px"
- src={null}
- width="234px"
- />
- <styled.a>
- CLAMP
- </styled.a>
- </NavbarBrand>
- <NavbarToggle
- aria-controls="responsive-navbar-nav"
- label="Toggle navigation"
- />
- <MenuBar
- loopName="Empty (NO loop loaded yet)"
- />
- <NavbarText>
- <styled.a>
- Signed in as:
- </styled.a>
- <Styled(Link)
- to="/userInfo"
- />
- </NavbarText>
- </Navbar>
- <styled.div>
- <styled.div>
- Loop Viewer -
- Empty (NO loop loaded yet)
- - (
- )
- </styled.div>
- <styled.div>
- <withRouter(SvgGenerator)
- clickable={true}
- generatedFrom="INSTANCE"
- isBusyLoading={[Function]}
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- <LoopStatus
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- <LoopLogs
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- </styled.div>
- </styled.div>
- </styled.div>
-</Component>
-`;
diff --git a/gui-clamp/ui-react/src/api/ACMService.js b/gui-clamp/ui-react/src/api/ACMService.js
deleted file mode 100644
index a03aac2..0000000
--- a/gui-clamp/ui-react/src/api/ACMService.js
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-export default class ACMService {
-
- static async getACMInstantiation() {
-
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/instantiation');
-
- return response
- }
-
- static async createInstanceProperties(instancePropertiesTemplate) {
-
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/instanceProperties', {
- method: 'POST',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin',
- body: JSON.stringify(instancePropertiesTemplate),
- });
-
- return response
- }
-
- static async updateInstanceProperties(instanceName, version, instancePropertiesTemplate) {
- const params = {
- name: instanceName,
- version: version
- }
-
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/instanceProperties?' + (new URLSearchParams(params)), {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin',
- body: JSON.stringify(instancePropertiesTemplate),
- });
-
- return response
- }
-
- static async deleteInstantiation(name, version) {
- const params = {
- name: name,
- version: version
- }
-
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/instanceProperties?' + (new URLSearchParams(params)), {
- method: 'DELETE',
- credentials: 'same-origin',
- });
-
- const data = await response;
-
- return data;
- }
-
- static async getInstanceOrderState(name, version) {
- const params = {
- name: name,
- version: version
- }
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/instantiationState'+ '?' + (new URLSearchParams(params)));
-
- const data = await response;
-
- return data;
- }
-
- static async changeInstanceOrderState(toscaObject) {
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/instantiation/command', {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin',
- body: JSON.stringify(toscaObject)
- });
-
- return response
- }
-
- static async getToscaTemplate(name, version, instanceName) {
- const params = instanceName != null ?
- {
- name: name,
- version: version,
- instanceName: instanceName
- } :
- {
- name: name,
- version: version
- }
-
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/commission/toscaservicetemplate' + '?' + (new URLSearchParams(params)));
-
- const data = await response;
-
- return data;
- }
-
- static async uploadToscaFile(toscaObject) {
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/commission', {
- method: 'POST',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin',
- body: JSON.stringify(toscaObject),
- });
-
- return response
-
- }
-
- static async deleteToscaTemplate(name, version) {
- const params = {
- name: name,
- version: version
- }
-
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/commission' + '?' + (new URLSearchParams(params)),
- {
- method: 'DELETE'
- });
-
- const data = await response;
-
- return data;
- }
-
- static async getCommonOrInstanceProperties(name, version, instanceName, isCommon) {
- const params = instanceName != null ?
- {
- name: name,
- version: version,
- instanceName: instanceName,
- common: isCommon
- } :
- {
- name: name,
- version: version,
- common: isCommon
- }
-
- const response = await fetch(window.location.pathname +
- 'onap/policy/clamp/acm/v2/commission/getCommonOrInstanceProperties' + '?' + (new URLSearchParams(params)));
-
- return response;
- }
-
-}
diff --git a/gui-clamp/ui-react/src/api/ACMService.test.js b/gui-clamp/ui-react/src/api/ACMService.test.js
deleted file mode 100644
index e4a3837..0000000
--- a/gui-clamp/ui-react/src/api/ACMService.test.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import ACMService from "./ACMService";
-
-describe("Verify GetACMInstantiation", () => {
- let response;
- let name = "name";
- let template = "template";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Success",
- ok: true,
- })
- );
- beforeEach(async () => {
- response = await ACMService.getACMInstantiation(name, template);
- });
- it("Test getACMInstantiation", () => {
- expect(response.status).toEqual("Success");
- });
-});
-describe("Verify DeleteInstantiation", () => {
- let response;
- let name = "name";
- let version = "version";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Success",
- ok: true,
- })
- );
- beforeEach(async () => {
- response = await ACMService.deleteInstantiation(name, version);
- });
- it("Test deleteInstantiation", () => {
- expect(response.status).toEqual("Success");
- });
-});
diff --git a/gui-clamp/ui-react/src/api/LoopActionService.js b/gui-clamp/ui-react/src/api/LoopActionService.js
deleted file mode 100644
index 6f3b22f..0000000
--- a/gui-clamp/ui-react/src/api/LoopActionService.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============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 class LoopActionService {
-
- static performAction(cl_name, uiAction) {
- console.info("LoopActionService perform action: " + uiAction + " closedloopName=" + cl_name);
- const svcAction = uiAction.toLowerCase();
- return fetch(window.location.pathname + "restservices/clds/v2/loop/" + svcAction + "/" + cl_name, {
- method: 'PUT',
- credentials: 'same-origin'
- })
- .then(function (response) {
- if (response.ok) {
- return response;
- } else {
- return Promise.reject("Perform action failed with code:" + response.status);
- }
- })
- .then(function (data) {
- console.info("Action Successful: " + uiAction);
- return data;
- })
- .catch(function (error) {
- console.info("Action Failure: " + uiAction);
- return Promise.reject(error);
- });
- }
-
-
- static refreshStatus(cl_name) {
- console.info("Refresh the status for closedloopName=" + cl_name);
-
- return fetch(window.location.pathname + "restservices/clds/v2/loop/getstatus/" + cl_name, {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- if (response.ok) {
- return response.json();
- } else {
- return Promise.reject("Refresh status failed with code:" + response.status);
- }
- })
- .then(function (data) {
- console.info("Refresh status Successful");
- return data;
- })
- .catch(function (error) {
- console.info("Refresh status failed:", error);
- return Promise.reject(error);
- });
- }
-}
diff --git a/gui-clamp/ui-react/src/api/LoopActionService.test.js b/gui-clamp/ui-react/src/api/LoopActionService.test.js
deleted file mode 100644
index 4253c8c..0000000
--- a/gui-clamp/ui-react/src/api/LoopActionService.test.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import LoopActionService from "./LoopActionService";
-
-describe("Verify PerformAction", () => {
- let response;
- let cl_name = "name";
- let uiAction = "action";
- describe("Response Ok Check", () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Success",
- ok: true,
- })
- );
- beforeEach(async () => {
- response = await LoopActionService.performAction(cl_name, uiAction);
- });
- it("Test performAction returns correct response status", () => {
- expect(response.ok).toEqual(true);
- });
- });
-});
-describe("Verify RefreshStatus", () => {
- let response;
- let cl_name = "name";
- describe("Response Ok Check", () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "name" }),
- status: "Success",
- ok: true,
- })
- );
- beforeEach(async () => {
- response = await LoopActionService.refreshStatus(cl_name);
- });
- it("Test refreshStatus returns correct response", () => {
- expect(response).toEqual({ name: "name" });
- });
- });
-});
diff --git a/gui-clamp/ui-react/src/api/LoopCache.js b/gui-clamp/ui-react/src/api/LoopCache.js
deleted file mode 100644
index ac2da07..0000000
--- a/gui-clamp/ui-react/src/api/LoopCache.js
+++ /dev/null
@@ -1,252 +0,0 @@
-/*-
- * ============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 class LoopCache {
- loopJsonCache;
-
- constructor(loopJson) {
- this.loopJsonCache = loopJson;
- }
-
- updateMicroServiceProperties(name, newMsProperties) {
- for (var policy in this.loopJsonCache["microServicePolicies"]) {
- if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
- this.loopJsonCache["microServicePolicies"][policy]["configurationsJson"] = newMsProperties;
- }
- }
- }
-
- updateMicroServicePdpGroup(name, pdpGroup, pdpSubgroup) {
- for (var policy in this.loopJsonCache["microServicePolicies"]) {
- if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
- this.loopJsonCache["microServicePolicies"][policy]["pdpGroup"] = pdpGroup;
- this.loopJsonCache["microServicePolicies"][policy]["pdpSubgroup"] = pdpSubgroup;
- }
- }
- }
-
- updateGlobalProperties(newGlobalProperties) {
- this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties;
- }
-
- updateOperationalPolicyProperties(name, newOpProperties) {
- for (var policy in this.loopJsonCache["operationalPolicies"]) {
- if (this.loopJsonCache["operationalPolicies"][policy]["name"] === name) {
- this.loopJsonCache["operationalPolicies"][policy]["configurationsJson"] = newOpProperties;
- }
- }
- }
-
- updateOperationalPolicyPdpGroup(name, pdpGroup, pdpSubgroup) {
- for (var policy in this.loopJsonCache["operationalPolicies"]) {
- if (this.loopJsonCache["operationalPolicies"][policy]["name"] === name) {
- this.loopJsonCache["operationalPolicies"][policy]["pdpGroup"] = pdpGroup;
- this.loopJsonCache["operationalPolicies"][policy]["pdpSubgroup"] = pdpSubgroup;
- }
- }
- }
-
- getLoopName() {
- return this.loopJsonCache["name"];
- }
-
- getOperationalPolicyJsonSchema() {
- return this.loopJsonCache["operationalPolicies"]["0"]["jsonRepresentation"];
- }
-
- getOperationalPolicies() {
- return this.loopJsonCache["operationalPolicies"];
- }
-
- getOperationalPoliciesNoJsonSchema() {
- var operationalPolicies = JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]));
- delete operationalPolicies[0]["jsonRepresentation"];
- return operationalPolicies;
- }
-
- getGlobalProperties() {
- return this.loopJsonCache["globalPropertiesJson"];
- }
-
- getDcaeDeploymentProperties() {
- return this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"];
- }
-
- getMicroServicePolicies() {
- return this.loopJsonCache["microServicePolicies"];
- }
-
- getOperationalPolicyForName(name) {
- var opProperties = this.getOperationalPolicies();
- for (var policy in opProperties) {
- if (opProperties[policy]["name"] === name) {
- return opProperties[policy];
- }
- }
- return null;
- }
-
- getOperationalPolicyPropertiesForName(name) {
- var opConfig = this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- return opConfig["configurationsJson"];
- }
- return null;
- }
-
- getOperationalPolicyJsonRepresentationForName(name) {
- var opConfig = this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- return opConfig["jsonRepresentation"];
- }
- return null;
- }
-
- getOperationalPolicySupportedPdpGroup(name) {
- var opConfig = this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- if (opConfig["policyModel"]["policyPdpGroup"] !== undefined && opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"] !== undefined) {
- return opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"];
- }
- }
- return [];
- }
-
- getOperationalPolicyPdpGroup(name) {
- var opConfig = this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- return opConfig["pdpGroup"];
- }
- return null;
- }
-
- getOperationalPolicyPdpSubgroup(name) {
- var opConfig = this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- return opConfig["pdpSubgroup"];
- }
- return null;
- }
-
- getMicroServiceSupportedPdpGroup(name) {
- var microService = this.getMicroServiceForName(name);
- if (microService !== null) {
- if (microService["policyModel"]["policyPdpGroup"] !== undefined && microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"] !== undefined) {
- return microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"];
- }
- }
- return [];
- }
-
- getMicroServicePdpGroup(name) {
- var microService = this.getMicroServiceForName(name);
- if (microService !== null) {
- return microService["pdpGroup"];
- }
- return null;
- }
-
- getMicroServicePdpSubgroup(name) {
- var microService = this.getMicroServiceForName(name);
- if (microService !== null) {
- return microService["pdpSubgroup"];
- }
- return null;
- }
-
- getMicroServiceForName(name) {
- var msProperties = this.getMicroServicePolicies();
- for (var policy in msProperties) {
- if (msProperties[policy]["name"] === name) {
- return msProperties[policy];
- }
- }
- return null;
- }
-
- getMicroServicePropertiesForName(name) {
- var msConfig = this.getMicroServiceForName(name);
- if (msConfig !== null) {
- return msConfig["configurationsJson"];
- }
- return null;
- }
-
- getMicroServiceJsonRepresentationForName(name) {
- var msConfig = this.getMicroServiceForName(name);
- if (msConfig !== null) {
- return msConfig["jsonRepresentation"];
- }
- return null;
- }
-
- getResourceDetailsVfProperty() {
- return this.loopJsonCache["modelService"]["resourceDetails"]["VF"];
- }
-
- getResourceDetailsVfModuleProperty() {
- return this.loopJsonCache["modelService"]["resourceDetails"]["VFModule"];
- }
-
- getLoopLogsArray() {
- return this.loopJsonCache.loopLogs;
- }
-
- getComputedState() {
- return this.loopJsonCache.lastComputedState;
- }
-
- getComponentStates() {
- return this.loopJsonCache.components;
- }
-
- getTemplateName() {
- if (this.getLoopTemplate() !== undefined) {
- return this.getLoopTemplate().name;
- }
- return null;
- }
-
- getLoopTemplate() {
- return this.loopJsonCache["loopTemplate"];
- }
-
- isOpenLoopTemplate() {
- var loopTemplate = this.getLoopTemplate();
- if (loopTemplate != null && loopTemplate["allowedLoopType"] === "OPEN") {
- return true;
- }
- return false;
- }
-
- getAllLoopElementModels() {
- var loopTemplate = this.getLoopTemplate();
- var loopElementModels = [];
- if (loopTemplate != null) {
- for (var element of loopTemplate['loopElementModelsUsed']) {
- loopElementModels.push(element['loopElementModel'])
- }
- }
- return loopElementModels;
- }
-}
diff --git a/gui-clamp/ui-react/src/api/LoopCache.test.js b/gui-clamp/ui-react/src/api/LoopCache.test.js
deleted file mode 100644
index eff2e65..0000000
--- a/gui-clamp/ui-react/src/api/LoopCache.test.js
+++ /dev/null
@@ -1,305 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import LoopCache from '../api/LoopCache';
-
-const json = require('./LoopCacheMockFile.json');
-
-describe('Verify LoopCache functions', () => {
- const loopCache = new LoopCache(json);
- it('getLoopName', () => {
- expect(loopCache.getLoopName()).toBe("LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca");
- });
-
- it('getOperationalPolicies', () => {
- const opPolicy = [{
- "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
- "configurationsJson": {
- "operational_policy": {
- "acm": {},
- "policies": []
- }
- },
- "pdpGroup": "pdpGroupTest",
- "pdpSubgroup": "pdpSubgroupTest",
- "jsonRepresentation": {
- "schema": {}
- }
- }];
- expect(loopCache.getOperationalPolicies()).toStrictEqual(opPolicy);
- });
-
- it('getOperationalPoliciesNoJsonSchema', () => {
- const opPolicy = [{
- "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
- "configurationsJson": {
- "operational_policy": {
- "acm": {},
- "policies": []
- }
- },
- "pdpGroup": "pdpGroupTest",
- "pdpSubgroup": "pdpSubgroupTest",
- }];
- expect(loopCache.getOperationalPoliciesNoJsonSchema()).toStrictEqual(opPolicy);
- });
-
- it('getOperationalPolicyJsonSchema', () => {
- const jsonSchema = {
- "schema": {}
- };
-
- expect(loopCache.getOperationalPolicyJsonSchema()).toStrictEqual(jsonSchema);
- });
- it('getGlobalProperties', () => {
- const globelProp = {
- "dcaeDeployParameters": {
- "location_id": "",
- "service_id": "",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- }
- };
- expect(loopCache.getGlobalProperties()).toStrictEqual(globelProp);
- });
-
- it('getDcaeDeploymentProperties', () => {
- const deploymentProp = {
- "location_id": "",
- "service_id": "",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- };
- expect(loopCache.getDcaeDeploymentProperties()).toStrictEqual(deploymentProp);
- });
-
- it('getMicroServiceForName', () => {
- const msJson = {
- "name": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca",
- "modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "configurationsJson": {"domain": "measurementsForVfScaling"},
- "shared": false,
- "pdpGroup": "pdpGroupTest",
- "pdpSubgroup": "pdpSubgroupTest",
- "policyModel": {"policyPdpGroup": {"supportedPdpGroups": "supportedPdpGroupsTest"}},
- "jsonRepresentation": {"schema": {}}
- };
- expect(loopCache.getMicroServiceForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msJson);
- expect(loopCache.getMicroServiceForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca_2")).toBeNull();
- });
-
- it('getMicroServicePropertiesForName', () => {
- const msProp = {"domain": "measurementsForVfScaling"};
- expect(loopCache.getMicroServicePropertiesForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msProp);
- expect(loopCache.getMicroServicePropertiesForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca_2")).toBeNull();
- });
-
- it('getMicroServiceJsonRepresentationForName', () => {
- const msJsonRepresentation = {"schema": {}};
- expect(loopCache.getMicroServiceJsonRepresentationForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msJsonRepresentation);
- });
-
- it('getResourceDetailsVfProperty', () => {
- const resourceVF = {
- "vLoadBalancerMS 0": {
- "resourceVendor": "Test",
- "resourceVendorModelNumber": "",
- "name": "vLoadBalancerMS",
- "description": "vLBMS",
- "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506",
- "subcategory": "Load Balancer",
- "category": "Application L4+",
- "type": "VF",
- "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
- "version": "1.0",
- "resourceVendorRelease": "1.0",
- "customizationUUID": "465246dc-7748-45f4-a013-308d92922552"
- }
- };
- expect(loopCache.getResourceDetailsVfProperty()).toStrictEqual(resourceVF);
- });
-
- it('getResourceDetailsVfModuleProperty', () => {
- const vfModule = {
- "Vloadbalancerms..vpkg..module-1": {
- "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043",
- "vfModuleModelVersion": "1",
- "vfModuleModelName": "Vloadbalancerms..vpkg..module-1",
- "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
- "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
- "min_vf_module_instances": 0,
- "vf_module_label": "vpkg",
- "max_vf_module_instances": 1,
- "vf_module_type": "Expansion",
- "isBase": false,
- "initial_count": 0,
- "volume_group": false
- }
- };
- expect(loopCache.getResourceDetailsVfModuleProperty()).toStrictEqual(vfModule);
- });
-
- it('getLoopLogsArray', () => {
- const logs = [
- {
- "id": 1,
- "logType": "INFO",
- "logComponent": "CLAMP",
- "message": "Operational policies UPDATED",
- "logInstant": "2019-07-08T09:44:37Z"
- }
- ];
- expect(loopCache.getLoopLogsArray()).toStrictEqual(logs);
- });
-
- it('getComponentStates', () => {
- const component = {
- "POLICY": {
- "componentState": {
- "stateName": "NOT_SENT",
- "description": "The policies defined have NOT yet been created on the policy engine"
- }
- },
- "DCAE": {
- "componentState": {
- "stateName": "BLUEPRINT_DEPLOYED",
- "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
- }
- }
- };
- expect(loopCache.getComponentStates()).toStrictEqual(component);
- });
-
- it('getOperationalPolicyForName', () => {
- const opPolicy = {
- "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
- "configurationsJson": {
- "operational_policy": {
- "acm": {},
- "policies": []
- }
- },
- "pdpGroup": "pdpGroupTest",
- "pdpSubgroup": "pdpSubgroupTest",
- "jsonRepresentation": {
- "schema": {}
- }
- };
- expect(loopCache.getOperationalPolicyForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(opPolicy);
- expect(loopCache.getOperationalPolicyForName("Not_Exist")).toBeNull();
- });
-
- it('getOperationalPolicyPropertiesForName', () => {
- const opPolicyJson = {
- "operational_policy": {
- "acm": {},
- "policies": []
- }};
- expect(loopCache.getOperationalPolicyPropertiesForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(opPolicyJson);
- expect(loopCache.getOperationalPolicyPropertiesForName("Not_Exist")).toBeNull();
- });
-
- it('getOperationalPolicyJsonRepresentationForName', () => {
- const opPolicySchema = {
- "schema": {}
- };
- expect(loopCache.getOperationalPolicyJsonRepresentationForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(opPolicySchema);
- expect(loopCache.getOperationalPolicyJsonRepresentationForName("Not_Exist")).toBeNull();
- });
-
- it('getOperationalPolicySupportedPdpGroup', () => {
- expect(loopCache.getOperationalPolicySupportedPdpGroup("Not_Exist")).toStrictEqual([]);
- });
-
- it('getOperationalPolicyPdpGroup', () => {
- expect(loopCache.getOperationalPolicyPdpGroup("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpGroupTest");
- expect(loopCache.getOperationalPolicyPdpGroup("Not_Exist")).toBeNull();
- });
-
- it('getOperationalPolicyPdpSubgroup', () => {
- expect(loopCache.getOperationalPolicyPdpSubgroup("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpSubgroupTest");
- expect(loopCache.getOperationalPolicyPdpSubgroup("Not_Exist")).toBeNull();
- });
-
- it('getMicroServiceSupportedPdpGroup', () => {
- expect(loopCache.getMicroServiceSupportedPdpGroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("supportedPdpGroupsTest");
- expect(loopCache.getMicroServiceSupportedPdpGroup("Not_Exist")).toStrictEqual([]);
- });
-
- it('getMicroServicePdpGroup', () => {
- expect(loopCache.getMicroServicePdpGroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpGroupTest");
- expect(loopCache.getMicroServicePdpGroup("Not_Exist")).toBeNull();
- });
-
- it('getMicroServicePdpSubgroup', () => {
- expect(loopCache.getMicroServicePdpSubgroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpSubgroupTest");
- expect(loopCache.getMicroServicePdpSubgroup("Not_Exist")).toBeNull();
- });
-
- it('getMicroServiceJsonRepresentationForName', () => {
- const msPolicySchema = {
- "schema": {}
- };
- expect(loopCache.getMicroServiceJsonRepresentationForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msPolicySchema);
- expect(loopCache.getMicroServiceJsonRepresentationForName("Not_Exist")).toBeNull();
- });
-
- it('getTemplateName', () => {
- expect(loopCache.getTemplateName()).toStrictEqual("loopTemplateTest");
- });
-
- it('updateGlobalProperties', () => {
- const newGlobalProps = {
- "dcaeDeployParameters": {
- "location_id": "newLocation",
- "service_id": "newServiceId",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca_2"
- }
- };
- loopCache.updateGlobalProperties(newGlobalProps);
- expect(loopCache.getGlobalProperties()).toStrictEqual(newGlobalProps);
- });
-
- it('updateOperationalPolicyProperties', () => {
- const newOpPolicy = {
- "operational_policy": {
- "acm": {},
- "policies": []
- }
- };
- loopCache.updateOperationalPolicyProperties("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",newOpPolicy);
- expect(loopCache.getOperationalPolicyPropertiesForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(newOpPolicy);
- });
-
- it('updateMicroServiceProperties', () => {
- const newMsPolicyProperties = {"domain": "measurementsForVfScalingNew"};
- loopCache.updateMicroServiceProperties("TCA_h2NMX_v1_0_ResourceInstanceName1_tca", newMsPolicyProperties);
- expect(loopCache.getMicroServicePropertiesForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(newMsPolicyProperties);
- });
-
- it('updateMicroServicePdpGroup', () => {
- const newMsPolicyProperties = {"domain": "measurementsForVfScalingNew"};
- loopCache.updateMicroServicePdpGroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca", "pdpGroupTest1", "pdpSubgroupTest1");
- expect(loopCache.getMicroServicePdpGroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpGroupTest1");
- expect(loopCache.getMicroServicePdpGroup("Not_Exist")).toBeNull();
- expect(loopCache.getMicroServicePdpSubgroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpSubgroupTest1");
- expect(loopCache.getMicroServicePdpSubgroup("Not_Exist")).toBeNull();
- });
- });
diff --git a/gui-clamp/ui-react/src/api/LoopCacheMockFile.json b/gui-clamp/ui-react/src/api/LoopCacheMockFile.json
deleted file mode 100644
index 733fcaa..0000000
--- a/gui-clamp/ui-react/src/api/LoopCacheMockFile.json
+++ /dev/null
@@ -1,135 +0,0 @@
-{
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "dcaeBlueprintId": "typeId-3a942643-a8f7-4e54-b2c1-eea8daba2b17",
- "globalPropertiesJson": {
- "dcaeDeployParameters": {
- "location_id": "",
- "service_id": "",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- }
- },
- "loopTemplate": {
- "name": "loopTemplateTest"
- },
- "modelService": {
- "serviceDetails": {
- "serviceType": "",
- "namingPolicy": "",
- "environmentContext": "General_Revenue-Bearing",
- "serviceEcompNaming": "true",
- "serviceRole": "",
- "name": "vLoadBalancerMS",
- "description": "vLBMS",
- "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f",
- "ecompGeneratedNaming": "true",
- "category": "Network L4+",
- "type": "Service",
- "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0",
- "instantiationType": "A-la-carte"
- },
- "resourceDetails": {
- "CP": {},
- "VL": {},
- "VF": {
- "vLoadBalancerMS 0": {
- "resourceVendor": "Test",
- "resourceVendorModelNumber": "",
- "name": "vLoadBalancerMS",
- "description": "vLBMS",
- "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506",
- "subcategory": "Load Balancer",
- "category": "Application L4+",
- "type": "VF",
- "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
- "version": "1.0",
- "resourceVendorRelease": "1.0",
- "customizationUUID": "465246dc-7748-45f4-a013-308d92922552"
- }
- },
- "CR": {},
- "VFC": {},
- "PNF": {},
- "Service": {},
- "CVFC": {},
- "Service Proxy": {},
- "Configuration": {},
- "AllottedResource": {},
- "VFModule": {
- "Vloadbalancerms..vpkg..module-1": {
- "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043",
- "vfModuleModelVersion": "1",
- "vfModuleModelName": "Vloadbalancerms..vpkg..module-1",
- "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
- "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
- "min_vf_module_instances": 0,
- "vf_module_label": "vpkg",
- "max_vf_module_instances": 1,
- "vf_module_type": "Expansion",
- "isBase": false,
- "initial_count": 0,
- "volume_group": false
- }
- }
- }
- },
- "lastComputedState": "DESIGN",
- "components": {
- "POLICY": {
- "componentState": {
- "stateName": "NOT_SENT",
- "description": "The policies defined have NOT yet been created on the policy engine"
- }
- },
- "DCAE": {
- "componentState": {
- "stateName": "BLUEPRINT_DEPLOYED",
- "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
- }
- }
- },
- "operationalPolicies": [
- {
- "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
- "configurationsJson": {
- "operational_policy": {
- "acm": {},
- "policies": []
- }
- },
- "pdpGroup": "pdpGroupTest",
- "pdpSubgroup": "pdpSubgroupTest",
- "jsonRepresentation": {
- "schema": {}
- }
- }
- ],
- "microServicePolicies": [
- {
- "name": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca",
- "modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "configurationsJson": {
- "domain": "measurementsForVfScaling"
- },
- "shared": false,
- "pdpGroup": "pdpGroupTest",
- "pdpSubgroup": "pdpSubgroupTest",
- "policyModel": {
- "policyPdpGroup": {
- "supportedPdpGroups": "supportedPdpGroupsTest"
- }
- },
- "jsonRepresentation": {
- "schema": {}
- }
- }
- ],
- "loopLogs": [
- {
- "id": 1,
- "logType": "INFO",
- "logComponent": "CLAMP",
- "message": "Operational policies UPDATED",
- "logInstant": "2019-07-08T09:44:37Z"
- }
- ]
-}
diff --git a/gui-clamp/ui-react/src/api/LoopService.js b/gui-clamp/ui-react/src/api/LoopService.js
deleted file mode 100644
index 16f1bec..0000000
--- a/gui-clamp/ui-react/src/api/LoopService.js
+++ /dev/null
@@ -1,244 +0,0 @@
-/*-
- * ============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 class LoopService {
- static getLoopNames() {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/getAllNames', { method: 'GET', credentials: 'same-origin' })
- .then(function (response) {
- console.debug("GetLoopNames response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("GetLoopNames query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("GetLoopNames error received", error);
- return {};
- });
- }
-
- static createLoop(loopName, templateName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/create/' + loopName + '?templateName=' + templateName, {
- method: 'POST',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("CreateLoop response received: ", response.status);
- return response.json();
- })
- .catch(function (error) {
- console.error("CreateLoop error received", error);
- return "";
- });
- }
-
- static getLoop(loopName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/' + loopName, {
- method: 'GET',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("GetLoop response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("GetLoop query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("GetLoop error received", error);
- return {};
- });
- }
-
- static setMicroServiceProperties(loopName, jsonData) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateMicroservicePolicy/' + loopName, {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("updateMicroservicePolicy response received: ", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("updateMicroservicePolicy query failed");
- return "";
- }
- })
- .catch(function (error) {
- console.error("updateMicroservicePolicy error received", error);
- return "";
- });
- }
-
- static setOperationalPolicyProperties(loopName, jsonData) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateOperationalPolicies/' + loopName, {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("updateOperationalPolicies response received: ", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("updateOperationalPolicies query failed");
- return "";
- }
- })
- .catch(function (error) {
- console.error("updateOperationalPolicies error received", error);
- return "";
- });
- }
-
- static updateGlobalProperties(loopName, jsonData) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateGlobalProperties/' + loopName, {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("updateGlobalProperties response received: ", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("updateGlobalProperties query failed");
- return "";
- }
- })
- .catch(function (error) {
- console.error("updateGlobalProperties error received", error);
- return "";
- });
- }
-
- static refreshOperationalPolicyJson(loopName, operationalPolicyName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/refreshOperationalPolicyJsonSchema/' + loopName + '/' + operationalPolicyName, {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("Refresh Operational Policy Json Schema response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("Refresh Operational Policy Json Schema query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("Refresh Operational Policy Json Schema error received", error);
- return {};
- });
- }
-
- static refreshMicroServicePolicyJson(loopName, microServicePolicyName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/refreshMicroServicePolicyJsonSchema/' + loopName + '/' + microServicePolicyName, {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("Refresh Operational Policy Json Schema response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("Refresh Operational Policy Json Schema query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("Refresh Operational Policy Json Schema error received", error);
- return {};
- });
- }
-
- static addOperationalPolicyType(loopName, policyType, policyVersion) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/addOperationaPolicy/' + loopName + '/policyModel/' + policyType + '/' + policyVersion, {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("Add Operational Policy response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- return response.text();
- }
- })
- .catch(function (error) {
- console.error("Add Operational Policy query failed");
- throw new Error(error);
- })
- }
-
- static removeOperationalPolicyType(loopName, policyType, policyVersion, policyName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/removeOperationaPolicy/' + loopName + '/policyModel/' + policyType + '/' + policyVersion + '/' + policyName, {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("Remove Operational Policy response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("Remove Operational Policy query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("Remove Operational Policy error received", error);
- return {};
- });
- }
-}
diff --git a/gui-clamp/ui-react/src/api/LoopService.test.js b/gui-clamp/ui-react/src/api/LoopService.test.js
deleted file mode 100644
index bd68582..0000000
--- a/gui-clamp/ui-react/src/api/LoopService.test.js
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import LoopService from "./LoopService";
-
-describe("Verify GetLoopNames", () => {
- let response;
- let loopNameJson;
- describe("Non-Empty Json Check", () => {
- loopNameJson = { name: "loop1" };
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- beforeEach(async () => {
- response = await LoopService.getLoopNames();
- });
- it("Test getLoopNames returns correct json", () => {
- expect(response).toEqual(loopNameJson);
- });
- });
- describe("Empty Json Check", () => {
- loopNameJson = {};
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({}),
- status: "Failed",
- ok: false,
- })
- );
- beforeEach(async () => {
- response = await LoopService.getLoopNames();
- });
- it("Test getLoopNames returns empty json", () => {
- expect(response).toEqual(loopNameJson);
- });
- });
- describe("Error during API call", () => {
- loopNameJson = {};
- beforeEach(async () => {
- response = await LoopService.getLoopNames();
- });
- it("Test getLoopNames returns empty json", () => {
- expect(response).toEqual(loopNameJson);
- });
- });
-});
-
-describe("Verify CreateLoop", () => {
- let response;
- let loopNameJson;
- let loopName = "loop1";
- let templateName = "template1";
- describe("Non-Empty Json Check", () => {
- loopNameJson = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await LoopService.createLoop(loopName, templateName);
- });
-
- it("Test createLoop returns correct json", () => {
- expect(response).toEqual(loopNameJson);
- });
- });
- describe("Error during API call", () => {
- let emptyResponse = "";
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve(""),
- })
- );
- response = await LoopService.createLoop("", "");
- });
- it("Test createLoop returns empty", () => {
- expect(response).toEqual(emptyResponse);
- });
- });
-});
-describe("Verify GetLoop", () => {
- let actualResponse;
- let expected;
- let name = "loop1";
- describe("Non-Empty Json Check", () => {
- beforeEach(async () => {
- expected = { name: "loop1" };
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- actualResponse = await LoopService.getLoop(name);
- });
-
- it("Test getLoop returns correct json", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
- describe("Error during API call", () => {
- beforeEach(async () => {
- expected = {};
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({}),
- })
- );
- actualResponse = await LoopService.getLoop(name);
- });
- it("Test getLoop returns empty", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
-});
-describe("Verify SetMicroServiceProperties", () => {
- let actualResponse;
- let expected;
- let name = "loop1";
- let jsonData = {};
- describe("Non-Empty Text Check", () => {
- beforeEach(async () => {
- expected = "data";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve("data"),
- status: "Success",
- ok: true,
- })
- );
- actualResponse = await LoopService.setMicroServiceProperties(
- name,
- jsonData
- );
- });
-
- it("Test setMicroServiceProperties returns correct text", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
- describe("Error during API call", () => {
- beforeEach(async () => {
- expected = "";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve(""),
- })
- );
- actualResponse = await LoopService.setMicroServiceProperties(
- name,
- jsonData
- );
- });
- it("Test setMicroServiceProperties returns empty", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
-});
-describe("Verify SetOperationalPolicyProperties", () => {
- let actualResponse;
- let expected;
- let name = "loop1";
- let jsonData = {};
- describe("Non-Empty Text Check", () => {
- beforeEach(async () => {
- expected = "data";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve("data"),
- status: "Success",
- ok: true,
- })
- );
- actualResponse = await LoopService.setOperationalPolicyProperties(
- name,
- jsonData
- );
- });
-
- it("Test setOperationalPolicyProperties returns correct text", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
- describe("Error during API call", () => {
- beforeEach(async () => {
- expected = "";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve(""),
- })
- );
- actualResponse = await LoopService.setOperationalPolicyProperties(
- name,
- jsonData
- );
- });
- it("Test setOperationalPolicyProperties returns empty", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
-});
-describe("Verify UpdateGlobalProperties", () => {
- let actualResponse;
- let expected;
- let name = "loop1";
- let jsonData = {};
- describe("Non-Empty Text Check", () => {
- beforeEach(async () => {
- expected = "data";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve("data"),
- status: "Success",
- ok: true,
- })
- );
- actualResponse = await LoopService.updateGlobalProperties(name, jsonData);
- });
-
- it("Test updateGlobalProperties returns correct text", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
- describe("Error during API call", () => {
- beforeEach(async () => {
- expected = "";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve(""),
- })
- );
- actualResponse = await LoopService.updateGlobalProperties(name, jsonData);
- });
- it("Test updateGlobalProperties returns empty", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
-});
-describe("Verify RefreshOperationalPolicyJson", () => {
- let actualResponse;
- let expected;
- let name = "loop1";
- let policyName = "policy";
- describe("Non-Empty Json Check", () => {
- beforeEach(async () => {
- expected = { name: "loop1" };
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- actualResponse = await LoopService.refreshOperationalPolicyJson(
- name,
- policyName
- );
- });
-
- it("Test refreshOperationalPolicyJson returns correct json", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
- describe("Error during API call", () => {
- beforeEach(async () => {
- expected = {};
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({}),
- })
- );
- actualResponse = await LoopService.refreshOperationalPolicyJson(
- name,
- policyName
- );
- });
- it("Test refreshOperationalPolicyJson returns empty", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
-});
-describe("Verify RefreshMicroServicePolicyJson", () => {
- let actualResponse;
- let expected;
- let name = "loop1";
- let policyName = "policy";
- describe("Non-Empty Json Check", () => {
- beforeEach(async () => {
- expected = { name: "loop1" };
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- actualResponse = await LoopService.refreshMicroServicePolicyJson(
- name,
- policyName
- );
- });
-
- it("Test refreshMicroServicePolicyJson returns correct json", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
- describe("Error during API call", () => {
- beforeEach(async () => {
- expected = {};
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({}),
- })
- );
- actualResponse = await LoopService.refreshMicroServicePolicyJson(
- name,
- policyName
- );
- });
- it("Test refreshMicroServicePolicyJson returns empty", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
-});
-describe("Verify AddOperationalPolicyType", () => {
- let actualResponse;
- let expected;
- let name = "loop1";
- let type = "type";
- let version = "version";
- describe("Non-Empty Json Check", () => {
- beforeEach(async () => {
- expected = { name: "loop1" };
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- actualResponse = await LoopService.addOperationalPolicyType(
- name,
- type,
- version
- );
- });
-
- it("Test addOperationalPolicyType returns correct json", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
- describe("Error during API call", () => {
- beforeEach(async () => {
- expected = new Error("error");
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve(expected),
- })
- );
- actualResponse = await LoopService.addOperationalPolicyType(
- name,
- type,
- version
- );
- });
- it("Test addOperationalPolicyType returns empty", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
-});
-describe("Verify RemoveOperationalPolicyType", () => {
- let actualResponse;
- let expected;
- let name = "loop1";
- let type = "type";
- let version = "version";
- let policyName = "policy";
- describe("Non-Empty Json Check", () => {
- beforeEach(async () => {
- expected = { name: "loop1" };
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- actualResponse = await LoopService.removeOperationalPolicyType(
- name,
- type,
- version,
- policyName
- );
- });
-
- it("Test removeOperationalPolicyType returns correct json", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
- describe("Error during API call", () => {
- beforeEach(async () => {
- expected = {};
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({}),
- })
- );
- actualResponse = await LoopService.removeOperationalPolicyType(
- name,
- type,
- version,
- policyName
- );
- });
- it("Test removeOperationalPolicyType returns empty", () => {
- expect(actualResponse).toEqual(expected);
- });
- });
-});
diff --git a/gui-clamp/ui-react/src/api/PoliciesListCacheMockFile.json b/gui-clamp/ui-react/src/api/PoliciesListCacheMockFile.json
deleted file mode 100644
index 14d5cc6..0000000
--- a/gui-clamp/ui-react/src/api/PoliciesListCacheMockFile.json
+++ /dev/null
@@ -1,215 +0,0 @@
-{
- "policies": [
- {
- "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0": {
- "type": "onap.policies.monitoring.tcagen2",
- "type_version": "1.0.0",
- "properties": {
- "tca.policy": {
- "domain": "measurementsForVfScaling",
- "metricsPerEventName": [
- {
- "policyScope": "DCAE",
- "thresholds": [
- {
- "version": "1.0.2",
- "severity": "MAJOR",
- "thresholdValue": 200,
- "closedLoopEventStatus": "ONSET",
- "closedLoopControlName": "LOOP_test",
- "direction": "LESS_OR_EQUAL",
- "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta"
- }
- ],
- "eventName": "vLoadBalancer",
- "policyVersion": "v0.0.1",
- "controlLoopSchemaType": "VM",
- "policyName": "DCAE.Config_tca-hi-lo"
- }
- ]
- }
- },
- "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "version": "1.0.0",
- "metadata": {
- "policy-id": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "policy-version": "1.0.0"
- },
- "pdpGroupInfo": {
- "pdpGroup": "pdpGroup2",
- "pdpSubGroup": "subGroup2"
- },
- "supportedPdpGroups": [
- {
- "pdpGroup2": [
- "subGroup2",
- "subGroup3"
- ]
- }
- ]
- }
- },
- {
- "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd": {
- "type": "onap.policies.controlloop.operational.common.Drools",
- "type_version": "1.0.0",
- "properties": {
- "abatement": false,
- "operations": [
- {
- "failure_retries": "final_failure_retries",
- "id": "test1",
- "failure_timeout": "final_failure_timeout",
- "failure": "final_failure",
- "operation": {
- "payload": {
- "artifact_name": "baseconfiguration",
- "artifact_version": "1.0.0",
- "mode": "async",
- "data": "{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"hostname\":\"\",\"request-info\":{\"prop1\":\"\",\"prop2\":\"\"}}}"
- },
- "target": {
- "entityIds": {
- "resourceID": "Vloadbalancerms..vdns..module-3",
- "modelInvariantId": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
- "modelVersionId": "4fa73b49-8a6c-493e-816b-eb401567b720",
- "modelName": "Vloadbalancerms..vdns..module-3",
- "modelVersion": "1",
- "modelCustomizationId": "bafcdab0-801d-4d81-9ead-f464640a38b1"
- },
- "targetType": "VNF"
- },
- "actor": "SDNR",
- "operation": "BandwidthOnDemand"
- },
- "failure_guard": "final_failure_guard",
- "retries": 0,
- "timeout": 0,
- "failure_exception": "final_failure_exception",
- "description": "test",
- "success": "final_success"
- }
- ],
- "trigger": "test1",
- "timeout": 0,
- "id": "LOOP_test"
- },
- "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd",
- "version": "1.0.0",
- "metadata": {
- "policy-id": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd",
- "policy-version": "1.0.0"
- },
- "pdpGroupInfo": {
- "pdpGroup": "pdpGroup2",
- "pdpSubGroup": "subGroup3"
- },
- "supportedPdpGroups": [
- {
- "pdpGroup2": [
- "subGroup2",
- "subGroup3"
- ]
- }
- ]
- }
- },
- {
- "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP": {
- "type": "onap.policies.Naming",
- "type_version": "1.0.0",
- "properties": {
- "naming-models": [
- {
- "naming-type": "VNF",
- "naming-recipe": "AIC_CLOUD_REGION|DELIMITER|CONSTANT|DELIMITER|TIMESTAMP",
- "name-operation": "to_lower_case()",
- "naming-properties": [
- {
- "property-name": "AIC_CLOUD_REGION"
- },
- {
- "property-name": "CONSTANT",
- "property-value": "onap-nf"
- },
- {
- "property-name": "TIMESTAMP"
- },
- {
- "property-value": "-",
- "property-name": "DELIMITER"
- }
- ]
- },
- {
- "naming-type": "VNFC",
- "naming-recipe": "VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE",
- "name-operation": "to_lower_case()",
- "naming-properties": [
- {
- "property-name": "VNF_NAME"
- },
- {
- "property-name": "SEQUENCE",
- "increment-sequence": {
- "max": "zzz",
- "scope": "ENTIRETY",
- "start-value": "1",
- "length": "3",
- "increment": "1",
- "sequence-type": "alpha-numeric"
- }
- },
- {
- "property-name": "NFC_NAMING_CODE"
- },
- {
- "property-value": "-",
- "property-name": "DELIMITER"
- }
- ]
- },
- {
- "naming-type": "VF-MODULE",
- "naming-recipe": "VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE",
- "name-operation": "to_lower_case()",
- "naming-properties": [
- {
- "property-name": "VNF_NAME"
- },
- {
- "property-value": "-",
- "property-name": "DELIMITER"
- },
- {
- "property-name": "VF_MODULE_LABEL"
- },
- {
- "property-name": "VF_MODULE_TYPE"
- },
- {
- "property-name": "SEQUENCE",
- "increment-sequence": {
- "max": "zzz",
- "scope": "PRECEEDING",
- "start-value": "1",
- "length": "3",
- "increment": "1",
- "sequence-type": "alpha-numeric"
- }
- }
- ]
- }
- ],
- "policy-instance-name": "ONAP_NF_NAMING_TIMESTAMP"
- },
- "name": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP",
- "version": "1.0.0",
- "metadata": {
- "policy-id": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP",
- "policy-version": "1.0.0"
- }
- }
- }
- ]
-}
diff --git a/gui-clamp/ui-react/src/api/PolicyService.js b/gui-clamp/ui-react/src/api/PolicyService.js
deleted file mode 100644
index cf4f0fd..0000000
--- a/gui-clamp/ui-react/src/api/PolicyService.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 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 class PolicyService {
- static getPoliciesList() {
- return fetch(window.location.pathname + 'restservices/clds/v2/policies', {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getPoliciesList response received: ", response.status);
- if (response.ok) {
- console.info("getPoliciesList query successful");
- return response.json();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("getPoliciesList error occurred ", error);
- alert("getPoliciesList error occurred " + error);
- return undefined;
- });
- }
-
- static createNewPolicy(policyModelType, policyModelVersion, policyName, policyVersion, policyJson) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policies/' + policyModelType + '/'
- + policyModelVersion + '/' + policyName + '/' + policyVersion, {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(policyJson)
- })
- .then(function (response) {
- console.debug("createNewPolicy response received: ", response.status);
- if (response.ok) {
- console.info("createNewPolicy query successful");
- return response.text();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("createNewPolicy error occurred ", error);
- alert("createNewPolicy error occurred " + error);
- return undefined;
- });
- }
-
- static deletePolicy(policyModelType, policyModelVersion, policyName, policyVersion) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policies/' + policyModelType + '/'
- + policyModelVersion + '/' + policyName + '/' + policyVersion, {
- method: 'DELETE',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("deletePolicy response received: ", response.status);
- if (response.ok) {
- console.info("deletePolicy query successful");
- return response.text();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("deletePolicy error occurred ", error);
- alert("deletePolicy error occurred " + error);
- return undefined;
- });
- }
-
- static updatePdpDeployment(pdpOperationsList) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policies/pdpDeployment', {
- method: 'PUT',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(pdpOperationsList)
- })
- .then(function (response) {
- console.debug("updatePdpDeployment response received: ", response.status);
- if (response.ok) {
- console.info("updatePdpDeployment query successful");
- return response.text();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("updatePdpDeployment error occurred ", error);
- alert("updatePdpDeployment error occurred " + error);
- return undefined;
- });
- }
-
- static sendNewPolicyModel(newPolicyModel) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policies/policytype', {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "plain/text"
- },
- body: newPolicyModel
- })
- .then(function (response) {
- console.debug("sendNewPolicyModel response received: ", response.status);
- if (response.ok) {
- console.info("sendNewPolicyModel query successful");
- return response.text();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("sendNewPolicyModel error occurred ", error);
- alert("sendNewPolicyModel error occurred " + error);
- return undefined;
- });
- }
-}
diff --git a/gui-clamp/ui-react/src/api/PolicyService.test.js b/gui-clamp/ui-react/src/api/PolicyService.test.js
deleted file mode 100644
index 3a491f9..0000000
--- a/gui-clamp/ui-react/src/api/PolicyService.test.js
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import PolicyService from "./PolicyService";
-
-describe("Verify GetPoliciesList", () => {
- let response;
- let expectedResponse;
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await PolicyService.getPoliciesList();
- });
- it("Test getPoliciesList returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Error Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Failed",
- ok: false,
- })
- );
- response = PolicyService.getPoliciesList();
- });
- it("Test getPoliciesList returns correct error", () => {
- expect(response).rejects.toEqual(
- new Error("HTTP Failed," + { name: "loop1" })
- );
- });
- });
-});
-describe("Verify CreateNewPolicy", () => {
- let response;
- let expectedResponse;
- let modelType = "modelType";
- let modelVersion = "modelVersion";
- let policyName = "policyName";
- let policyVersion = "policyVersion";
- let json = {};
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await PolicyService.createNewPolicy(
- modelType,
- modelVersion,
- policyName,
- policyVersion,
- json
- );
- });
- it("Test createNewPolicy returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Error Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Failed",
- ok: false,
- })
- );
- response = PolicyService.createNewPolicy(
- modelType,
- modelVersion,
- policyName,
- policyVersion,
- json
- );
- });
- it("Test getPoliciesList returns correct error", () => {
- expect(response).rejects.toEqual(
- new Error("HTTP Failed," + { name: "loop1" })
- );
- });
- });
-});
-describe("Verify DeletePolicy", () => {
- let response;
- let expectedResponse;
- let modelType = "modelType";
- let modelVersion = "modelVersion";
- let policyName = "policyName";
- let policyVersion = "policyVersion";
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await PolicyService.deletePolicy(
- modelType,
- modelVersion,
- policyName,
- policyVersion
- );
- });
- it("Test deletePolicy returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Error Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Failed",
- ok: false,
- })
- );
- response = PolicyService.deletePolicy(
- modelType,
- modelVersion,
- policyName,
- policyVersion
- );
- });
- it("Test deletePolicy returns correct error", () => {
- expect(response).rejects.toEqual(
- new Error("HTTP Failed," + { name: "loop1" })
- );
- });
- });
-});
-describe("Verify UpdatePdpDeployment", () => {
- let response;
- let expectedResponse;
- let operationList = "operation";
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await PolicyService.updatePdpDeployment(operationList);
- });
- it("Test updatePdpDeployment returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Error Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Failed",
- ok: false,
- })
- );
- response = PolicyService.updatePdpDeployment(operationList);
- });
- it("Test updatePdpDeployment returns correct error", () => {
- expect(response).rejects.toEqual(
- new Error("HTTP Failed," + { name: "loop1" })
- );
- });
- });
-});
-describe("Verify SendNewPolicyModel", () => {
- let response;
- let expectedResponse;
- let policyModel = "model";
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await PolicyService.sendNewPolicyModel(policyModel);
- });
- it("Test sendNewPolicyModel returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Error Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "loop1" }),
- status: "Failed",
- ok: false,
- })
- );
- response = PolicyService.sendNewPolicyModel(policyModel);
- });
- it("Test sendNewPolicyModel returns correct error", () => {
- expect(response).rejects.toEqual(
- new Error("HTTP Failed," + { name: "loop1" })
- );
- });
- });
-});
diff --git a/gui-clamp/ui-react/src/api/PolicyToscaService.js b/gui-clamp/ui-react/src/api/PolicyToscaService.js
deleted file mode 100644
index 6c74149..0000000
--- a/gui-clamp/ui-react/src/api/PolicyToscaService.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019, 2021 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 class PolicyToscaService {
- static getToscaPolicyModels() {
- return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels', { method: 'GET', credentials: 'same-origin' })
- .then(function (response) {
- console.debug("getToscaPolicyModels response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getToscaPolicyModels query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getToscaPolicyModels error received", error);
- return {};
- });
- }
-
- static getToscaPolicyModelYaml(policyModelType, policyModelVersion) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/yaml/' + policyModelType + "/" + policyModelVersion, {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getToscaPolicyModelYaml response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getToscaPolicyModelYaml query failed");
- return "";
- }
- })
- .catch(function (error) {
- console.error("getToscaPolicyModelYaml error received", error);
- return "";
- });
- }
-
- static getToscaPolicyModel(policyModelType, policyModelVersion) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/' + policyModelType + "/" + policyModelVersion, {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getToscaPolicyModel response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getToscaPolicyModel query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getToscaPolicyModel error received", error);
- return {};
- });
- }
-}
diff --git a/gui-clamp/ui-react/src/api/PolicyToscaService.test.js b/gui-clamp/ui-react/src/api/PolicyToscaService.test.js
deleted file mode 100644
index b6ed4bd..0000000
--- a/gui-clamp/ui-react/src/api/PolicyToscaService.test.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import PolicyToscaService from "./PolicyToscaService";
-
-describe("Verify GetToscaPolicyModels", () => {
- let response;
- let expectedResponse;
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await PolicyToscaService.getToscaPolicyModels();
- });
- it("Test getToscaPolicyModels returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Empty Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await PolicyToscaService.getToscaPolicyModels();
- });
- it("Test getToscaPolicyModels returns empty response", () => {
- expect(response).toEqual({});
- });
- });
-});
-describe("Verify GetToscaPolicyModelYaml", () => {
- let response;
- let expectedResponse;
- let modelType = "type";
- let version = "version";
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await PolicyToscaService.getToscaPolicyModelYaml(
- modelType,
- version
- );
- });
- it("Test getToscaPolicyModelYaml returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Empty Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await PolicyToscaService.getToscaPolicyModelYaml(
- modelType,
- version
- );
- });
- it("Test getToscaPolicyModelYaml returns empty response", () => {
- expect(response).toEqual("");
- });
- });
-});
-describe("Verify GetToscaPolicyModel", () => {
- let response;
- let expectedResponse;
- let modelType = "type";
- let version = "version";
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await PolicyToscaService.getToscaPolicyModel(
- modelType,
- version
- );
- });
- it("Test getToscaPolicyModel returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Empty Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await PolicyToscaService.getToscaPolicyModel(
- modelType,
- version
- );
- });
- it("Test getToscaPolicyModel returns empty response", () => {
- expect(response).toEqual({});
- });
- });
-});
diff --git a/gui-clamp/ui-react/src/api/TemplateService.js b/gui-clamp/ui-react/src/api/TemplateService.js
deleted file mode 100644
index a6e386e..0000000
--- a/gui-clamp/ui-react/src/api/TemplateService.js
+++ /dev/null
@@ -1,197 +0,0 @@
-/*-
- * ============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 class TemplateService {
-
- static getLoopNames() {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/getAllNames', { method: 'GET', credentials: 'same-origin' })
- .then(function (response) {
- console.debug("getLoopNames response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getLoopNames query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getLoopNames error received", error);
- return {};
- });
- }
-
- static getAllLoopTemplates() {
- return fetch(window.location.pathname + 'restservices/clds/v2/templates', { method: 'GET', credentials: 'same-origin', })
- .then(function (response) {
- console.debug("getAllLoopTemplates response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getAllLoopTemplates query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getAllLoopTemplates error received", error);
- return {};
- });
- }
-
- static getDictionary() {
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/', { method: 'GET', credentials: 'same-origin', })
- .then(function (response) {
- console.debug("getDictionary response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getDictionary query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getDictionary error received", error);
- return {};
- });
- }
-
- static getDictionaryElements(dictionaryName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryName, {
- method: 'GET',
- headers: {
- "Content-Type": "application/json",
- },
- credentials: 'same-origin',
- })
- .then(function (response) {
- console.debug("getDictionaryElements response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getDictionaryElements query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getDictionaryElements error received", error);
- return {};
- });
- }
-
- static insDictionary(jsonData) {
- console.log("dictionaryName is", jsonData.name)
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/', {
- method: 'PUT',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("insDictionary response received: ", response.status);
- if (response.ok) {
- return response.status;
- } else {
- var errorMessage = response.status;
- console.error("insDictionary query failed", response.status);
- return errorMessage;
- }
- })
- .catch(function (error) {
- console.error("insDictionary error received", error);
- return "";
- });
- }
-
- static insDictionaryElements(jsonData) {
- console.log("dictionaryName is", jsonData.name)
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + jsonData.name, {
- method: 'PUT',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("insDictionary response received: ", response.status);
- if (response.ok) {
- return response.status;
- } else {
- var errorMessage = response.status;
- console.error("insDictionary query failed", response.status);
- return errorMessage;
- }
- })
- .catch(function (error) {
- console.error("insDictionary error received", error);
- return "";
- });
- }
-
- static deleteDictionary(dictionaryName) {
- console.log("inside templaemenu service", dictionaryName)
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryName, {
- method: 'DELETE',
- headers: {
- "Content-Type": "application/json",
- },
- credentials: 'same-origin',
- })
- .then(function (response) {
- console.debug("deleteDictionary response received: ", response.status);
- if (response.ok) {
- return response.status;
- } else {
- console.error("deleteDictionary query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("deleteDictionary error received", error);
- return {};
- });
- }
-
- static deleteDictionaryElements(dictionaryData) {
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryData.name + '/elements/' + dictionaryData.shortName, {
- method: 'DELETE',
- headers: {
- "Content-Type": "application/json",
- },
- credentials: 'same-origin',
- })
- .then(function (response) {
- console.debug("deleteDictionary response received: ", response.status);
- if (response.ok) {
- return response.status;
- } else {
- console.error("deleteDictionary query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("deleteDictionary error received", error);
- return {};
- });
- }
-}
diff --git a/gui-clamp/ui-react/src/api/TemplateService.test.js b/gui-clamp/ui-react/src/api/TemplateService.test.js
deleted file mode 100644
index 6899ef3..0000000
--- a/gui-clamp/ui-react/src/api/TemplateService.test.js
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import TemplateService from "./TemplateService";
-
-describe("Verify GetLoopNames", () => {
- let response;
- let expectedResponse;
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await TemplateService.getLoopNames();
- });
- it("Test getLoopNames returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Empty Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await TemplateService.getLoopNames();
- });
- it("Test getLoopNames returns empty response", () => {
- expect(response).toEqual({});
- });
- });
-});
-describe("Verify GetAllLoopTemplates", () => {
- let response;
- let expectedResponse;
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await TemplateService.getAllLoopTemplates();
- });
- it("Test getAllLoopTemplates returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Empty Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await TemplateService.getAllLoopTemplates();
- });
- it("Test getAllLoopTemplates returns empty response", () => {
- expect(response).toEqual({});
- });
- });
-});
-describe("Verify GetDictionary", () => {
- let response;
- let expectedResponse;
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await TemplateService.getDictionary();
- });
- it("Test getDictionary returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Empty Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await TemplateService.getDictionary();
- });
- it("Test getDictionary returns empty response", () => {
- expect(response).toEqual({});
- });
- });
-});
-describe("Verify GetDictionaryElements", () => {
- let response;
- let expectedResponse;
- let dictionaryName = "name";
- describe("Non-Empty Json Check", () => {
- expectedResponse = { name: "loop1" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await TemplateService.getDictionaryElements(dictionaryName);
- });
- it("Test getDictionaryElements returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Empty Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await TemplateService.getDictionaryElements(dictionaryName);
- });
- it("Test getDictionaryElements returns empty response", () => {
- expect(response).toEqual({});
- });
- });
-});
-describe("Verify InsDictionary", () => {
- let response;
- let expectedResponse;
- let json = "{}";
- describe("Return Success Response Check", () => {
- expectedResponse = "Success";
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "loop1" }),
- status: "Success",
- ok: true,
- })
- );
- response = await TemplateService.insDictionary(json);
- });
- it("Test insDictionary returns correct json", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Return Failed Response Check", () => {
- beforeEach(async () => {
- expectedResponse = "Failed";
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await TemplateService.insDictionary(json);
- });
- it("Test insDictionary returns empty response", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
-});
-describe("Verify InsDictionaryElements", () => {
- let response;
- let json = "{}";
- describe("Return Success Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Success",
- ok: true,
- })
- );
- response = await TemplateService.insDictionaryElements(json);
- });
- it("Test insDictionaryElements returns success response", () => {
- expect(response).toEqual("Success");
- });
- });
- describe("Return Failed Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await TemplateService.insDictionaryElements(json);
- });
- it("Test insDictionaryElements returns failed response", () => {
- expect(response).toEqual("Failed");
- });
- });
-});
-describe("Verify DeleteDictionary", () => {
- let response;
- let dictionaryName = "name";
- describe("Return Success Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Success",
- ok: true,
- })
- );
- response = await TemplateService.deleteDictionary(dictionaryName);
- });
- it("Test deleteDictionary returns success response", () => {
- expect(response).toEqual("Success");
- });
- });
- describe("Return Failed Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await TemplateService.deleteDictionary(dictionaryName);
- });
- it("Test deleteDictionary returns failed response", () => {
- expect(response).toEqual({});
- });
- });
-});
-describe("Verify DeleteDictionaryElements", () => {
- let response;
- let dictionaryData = "name";
- describe("Return Success Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Success",
- ok: true,
- })
- );
- response = await TemplateService.deleteDictionaryElements(dictionaryData);
- });
- it("Test deleteDictionaryElements returns success response", () => {
- expect(response).toEqual("Success");
- });
- });
- describe("Return Failed Response Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await TemplateService.deleteDictionaryElements(dictionaryData);
- });
- it("Test deleteDictionaryElements returns failed response", () => {
- expect(response).toEqual({});
- });
- });
-});
diff --git a/gui-clamp/ui-react/src/api/UserService.js b/gui-clamp/ui-react/src/api/UserService.js
deleted file mode 100644
index bcf46ea..0000000
--- a/gui-clamp/ui-react/src/api/UserService.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * ============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 class UserService {
- static notLoggedUserName = 'Anonymous';
-
- static login() {
- return fetch(window.location.pathname + 'restservices/clds/v1/user/getUser', {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getUser response received, status code:", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("getUser response is nok");
- return UserService.notLoggedUserName;
- }
- })
- .then(function (data) {
- console.info("User connected:", data)
- return data;
- })
- .catch(function (error) {
- console.warn("getUser error received, user set to: ", UserService.notLoggedUserName);
- console.error("getUser error:", error);
- return UserService.notLoggedUserName;
- });
- }
-
- static getUserInfo() {
- return fetch(window.location.pathname + 'restservices/clds/v2/clampInformation', {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getUserInfo response received, status code:", response.status);
- if (response.ok) {
- return response.json();
- } else {
- return {}
- }
- })
- .then(function (data) {
- console.info("User info received:", data)
- return data;
- })
- .catch(function (error) {
- console.warn("getUserInfo error received, user set to: ", UserService.notLoggedUserName);
- console.error("getUserInfo error:", error);
- return {};
- });
- }
-}
diff --git a/gui-clamp/ui-react/src/api/UserService.test.js b/gui-clamp/ui-react/src/api/UserService.test.js
deleted file mode 100644
index ede5446..0000000
--- a/gui-clamp/ui-react/src/api/UserService.test.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import UserService from "./UserService";
-
-describe("Verify Login", () => {
- let response;
- let expectedResponse;
- describe("Login Username Check", () => {
- expectedResponse = { name: "name" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- text: () => Promise.resolve({ name: "name" }),
- status: "Success",
- ok: true,
- })
- );
- response = await UserService.login();
- });
- it("Test login returns correct username", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Anonymouse Login Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await UserService.login();
- });
- it("Test login returns Anonymous user", () => {
- expect(response).toEqual("Anonymous");
- });
- });
-});
-describe("Verify GetUserInfo", () => {
- let response;
- let expectedResponse;
- describe("Test Correct Username", () => {
- expectedResponse = { name: "name" };
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- json: () => Promise.resolve({ name: "name" }),
- status: "Success",
- ok: true,
- })
- );
- response = await UserService.getUserInfo();
- });
- it("Test getUserInfo returns correct username", () => {
- expect(response).toEqual(expectedResponse);
- });
- });
- describe("Empty User Check", () => {
- beforeEach(async () => {
- global.fetch = jest.fn(() =>
- Promise.resolve({
- status: "Failed",
- ok: false,
- })
- );
- response = await UserService.getUserInfo();
- });
- it("Test getUserInfo returns empty response", () => {
- expect(response).toEqual({});
- });
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.js b/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.js
deleted file mode 100644
index a34b5b3..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- *
- *
- */
-
-import React from "react";
-import styled from "styled-components";
-import { Accordion, Button } from "react-bootstrap";
-
-const UninitialisedHeader = styled.div`
- margin: 0;
- padding: 0 0 1px 0;
- border-bottom: 1px solid #7f7f7f;
- background: #cccccc;
- font-weight: normal;
- border-radius: 0;
-`
-
-const PassiveHeader = styled.div`
- margin: 0;
- padding: 0 0 1px 0;
- border-bottom: 1px solid #7f7f7f;
- background: #ffe87c;
- font-weight: normal;
- border-radius: 0;
-`
-
-const RunningHeader = styled.div`
- margin: 0;
- padding: 0 0 1px 0;
- border-bottom: 1px solid #7f7f7f;
- background: #7ec699;
- font-weight: normal;
- border-radius: 0;
-`
-
-const ToggleButton = styled(Button)`
- color: #000000;
- text-decoration: none;
-
- :hover, :active {
- color: #000000;
- text-decoration: none !important;
- }
-`
-
-const AccordionHeader = (props) => {
-
- const index = props.index;
-
- console.log("----------------");
- console.log(index);
- console.log("----------------");
-
- const toggleState = () => {
- switch (props.orderedState) {
- case 'UNINITIALISED':
- return renderUninitialisedOrderedState();
- case 'PASSIVE':
- return renderPassiveOrderedState();
- case 'RUNNING':
- return renderRunningOrderedState();
- default:
- return renderUninitialisedOrderedState();
- }
- }
-
- const renderUninitialisedOrderedState = () => {
-
- return (
- <UninitialisedHeader className="panel-header">
- <Accordion.Toggle as={ToggleButton} variant="link" eventKey={ index.toString() }>
- { props.title }
- </Accordion.Toggle>
- </UninitialisedHeader>
- )
- }
-
- const renderPassiveOrderedState = () => {
- return (
- <PassiveHeader className="panel-header">
- <Accordion.Toggle as={ToggleButton} variant="link" eventKey={ index.toString() }>
- { props.title }
- </Accordion.Toggle>
- </PassiveHeader>
- )
- }
-
- const renderRunningOrderedState = () => {
- return (
- <RunningHeader className="panel-header">
- <Accordion.Toggle as={ToggleButton} variant="link" eventKey={ index.toString() }>
- { props.title }
- </Accordion.Toggle>
- </RunningHeader>
- )
- }
-
- return (
- toggleState()
- );
-}
-
-export default AccordionHeader; \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.test.js
deleted file mode 100644
index 987f1fc..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- *
- *
- */
-
-import { shallow } from "enzyme";
-import React from "react";
-import AccordionHeader from "./AccordionHeader";
-import toJson from "enzyme-to-json";
-
-describe('Verify AccordionHeader', () => {
-
- const index = 0;
-
- it("renders correctly", () => {
- const container = shallow(<AccordionHeader index={ index }/>);
- expect(toJson(container)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is uninitialized", () => {
- const container = shallow(<AccordionHeader title={ "UNINITIALISED_TEST" } orderState={ "UNINITIALISED" } index={ index } key={ index }/>);
- expect(toJson(container)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is passive", () => {
- const container = shallow(<AccordionHeader title={ "PASSIVE_TEST" } orderState={ "PASSIVE" } index={ index } key={ index }/>);
- expect(toJson(container)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is running", () => {
- const container = shallow(<AccordionHeader title={ "RUNNING_TEST" } orderState={ "RUNNING" } index={ index } key={ index }/>);
- expect(toJson(container)).toMatchSnapshot();
- });
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.js b/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.js
deleted file mode 100644
index 0c9e8b7..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import styled from "styled-components";
-import Modal from "react-bootstrap/Modal";
-import Button from "react-bootstrap/Button";
-import React, { useEffect, useState } from "react";
-import InstantiationOrderStateChangeItem from "./InstantiationOrderStateChangeItem";
-import ACMService from "../../../api/ACMService";
-import { Alert, Container, Dropdown } from "react-bootstrap";
-
-const ModalStyled = styled(Modal)`
- @media (min-width: 800px) {
- .modal-xl {
- max-width: 96%;
- }
- }
- background-color: transparent;
-`
-
-const DivWhiteSpaceStyled = styled.div`
- overflow: auto;
- min-width: 100%;
- max-height: 300px;
- padding: 5px 5px 0px 5px;
- text-align: center;
-`
-
-const AlertStyled = styled(Alert)`
- margin-top: 10px;
-`
-
-const ChangeOrderStateModal = (props) => {
- const [show, setShow] = useState(true);
- const [ACMIdentifierList, setACMIdentifierList] = useState([]);
- const [orderedState, setOrderedState] = useState('');
- const [toscaOrderStateObject, setToscaOrderStateObject] = useState({});
- const [instantiationOrderStateError, setInstantiationOrderStateError] = useState(false);
- const [instantiationOrderStateMsgError, setInstantiationOrderStateMsgError] = useState({});
- const [alertMessage, setAlertMessage] = useState(null);
-
- useEffect(async () => {
-
- const instantiationOrderState = await ACMService.getInstanceOrderState(
- props.location.instantiationName,
- props.location.instantiationVersion)
- .catch(error => error.message);
-
- const orderStateJson = await instantiationOrderState.json();
-
- console.log(orderStateJson);
-
- if (!instantiationOrderState.ok || orderStateJson['automationCompositionIdentifierList'].length === 0) {
- setInstantiationOrderStateError(true);
- setInstantiationOrderStateMsgError(orderStateJson);
- } else {
- setACMIdentifierList(orderStateJson['automationCompositionIdentifierList']);
- setOrderedState(orderStateJson['orderedState']);
- }
- }, []);
-
- const handleDropSelect = (event) => {
- console.log("handleDropDownChange called");
-
- const stateChangeObject = {
- orderedState: event,
- automationCompositionIdentifierList: ACMIdentifierList
- }
- setToscaOrderStateObject(stateChangeObject);
- setOrderedState(event);
- }
-
- const handleSave = async () => {
- console.log("handleSave called");
-
- const response = await ACMService.changeInstanceOrderState(toscaOrderStateObject)
- .catch(error => error.message);
-
- if (response.ok) {
- successAlert();
- } else {
- await errorAlert(response);
- }
- }
-
- const handleClose = () => {
- console.log('handleClose called');
- setShow(false);
- props.history.push('/');
- }
-
- const successAlert = () => {
- console.log("successAlert called");
- setAlertMessage(<Alert variant="success">
- <Alert.Heading>Order State Changed Success</Alert.Heading>
- <p>Order State Changed was successfully changed</p>
- <hr/>
- </Alert>);
- }
-
- const errorAlert = async (response) => {
- console.log("errorAlert called");
- setAlertMessage(<Alert variant="danger">
- <Alert.Heading>Order State Changed Failure</Alert.Heading>
- <p>An error occurred while trying to change order state</p>
- <p>Status code: { await response.status } : { response.statusText }</p>
- <p>Status Text: { await response.text() }</p>
- <hr/>
- </Alert>);
- }
-
- return (
- <ModalStyled size="sm"
- show={ show }
- onHide={ handleClose }
- backdrop="static"
- keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Manage Instantiation</Modal.Title>
- </Modal.Header>
- <div style={ { padding: '5px 5px 0 5px' } }>
- <Modal.Body>
- <Container>
- <Dropdown onSelect={ handleDropSelect }>
- <Dropdown.Toggle variant="dark" id="dropdown-basic">
- Select Order State
- </Dropdown.Toggle>
- <Dropdown.Menu>
- <Dropdown.Item eventKey="UNINITIALISED">UNINITIALISED</Dropdown.Item>
- <Dropdown.Item eventKey="PASSIVE">PASSIVE</Dropdown.Item>
- <Dropdown.Item eventKey="RUNNING">RUNNING</Dropdown.Item>
- </Dropdown.Menu>
- </Dropdown>
- {
- ACMIdentifierList.map((clIdList, index) => (
- <InstantiationOrderStateChangeItem title={ clIdList.name } orderState={ orderedState } index={ index } key={ index }/>
- ))
- }
- </Container>
- <AlertStyled show={ instantiationOrderStateError }
- variant="danger">Can't get instantiation ordered state:<br/>{ JSON.stringify(instantiationOrderStateMsgError, null, 2) }</AlertStyled>
- </Modal.Body>
- <DivWhiteSpaceStyled>
- { alertMessage }
- </DivWhiteSpaceStyled>
- </div>
- <Modal.Footer>
- <Button variant="primary" onClick={ handleSave }>Save</Button>
- <Button variant="secondary" onClick={ handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
-}
-
-export default ChangeOrderStateModal;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.test.js
deleted file mode 100644
index 598e6e3..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.test.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import toJson from "enzyme-to-json";
-import ChangeOrderStateModal from "./ChangeOrderStateModal";
-import { createMemoryHistory } from "history";
-import { act } from "react-dom/test-utils";
-import acmList from "./testFiles/acmList.json";
-import orderedStateJson from "./testFiles/orderedStateJson.json";
-import ACMService from "../../../api/ACMService";
-
-let logSpy = jest.spyOn(console, 'log')
-const oldWindowLocation = window.location
-
-describe('Verify ChangeOrderStateModal', () => {
- const flushPromises = () => new Promise(setImmediate);
-
- beforeEach(() => {
- logSpy.mockClear()
- })
-
- afterAll(() => {
- window.location = oldWindowLocation
- })
-
- beforeAll(() => {
- jest
- .spyOn(global, 'fetch')
- .mockImplementation(() => {
- return {
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(orderedStateJson)
- }
- }
- }
- )
-
-
- delete window.location
-
- // create a new `window.location` object that's *almost*
- // like the real thing
- window.location = Object.defineProperties(
- // start with an empty object on which to define properties
- {},
- {
- // grab all of the property descriptors for the
- // `jsdom` `Location` object
- ...Object.getOwnPropertyDescriptors(oldWindowLocation),
- instantiationName: {
- configurable: true,
- value: "PMSH_Instance1",
- },
- instantiationVersion: {
- configurable: true,
- value: "2.3.1",
- }
- },
- )
- })
-
- it("renders without crashing", () => {
- act(() => {
- shallow(<ChangeOrderStateModal location={window.location}/>);
- })
- });
-
- it("renders correctly", () => {
- act(() => {
- const tree = shallow(<ChangeOrderStateModal location={window.location}/>);
- expect(toJson(tree)).toMatchSnapshot();
- })
- });
-
- it('should have two Button elements', () => {
- act(() => {
- const container = shallow(<ChangeOrderStateModal location={window.location}/>)
- expect(container.find('Button').length).toEqual(2);
- })
- });
-
- it('should have one dropdown element', () => {
- act(() => {
- const container = shallow(<ChangeOrderStateModal location={ window.location }/>)
- expect(container.find('Dropdown').length).toEqual(1);
- });
- });
-
- it('handleDropSelect called when dropdown clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<ChangeOrderStateModal history={ history } location={window.location}/>)
-
- act(() => {
- component.find('Dropdown').get(0).props.onSelect();
- expect(logSpy).toHaveBeenCalledWith('handleDropDownChange called');
- });
-
- component.unmount();
- });
-
- it('handleClose called when bottom button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<ChangeOrderStateModal history={ history } location={window.location}/>)
-
- act(() => {
- component.find('[variant="secondary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
-
- component.unmount();
- });
-
- it('handleClose called when top-right button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<ChangeOrderStateModal history={ history } location={window.location}/>)
-
- act(() => {
- component.find('[size="sm"]').get(0).props.onHide();
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
-
- component.unmount();
- });
-
- it('handleSave called when save button clicked and response is ok', async () => {
- jest.resetAllMocks()
- const getInstanceOrderStateSpy = jest.spyOn(ACMService, 'getInstanceOrderState')
- .mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(orderedStateJson)
- }
- })
- }
- )
-
- const changeInstanceOrderStateSpy = jest.spyOn(ACMService, 'changeInstanceOrderState')
- .mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(acmList)
- }
- })
- }
- )
-
- const component = mount(<ChangeOrderStateModal location={window.location}/>)
-
- act( async () => {
- component.find('[variant="primary"]').simulate('click');
- await expect(getInstanceOrderStateSpy).toHaveBeenCalled()
- await expect(changeInstanceOrderStateSpy).toHaveBeenCalled()
- expect(logSpy).toHaveBeenNthCalledWith(1,"handleSave called");
- expect(logSpy).toHaveBeenNthCalledWith(2,"successAlert called");
- });
- });
-
- it('handleSave called when save button clicked and response is not ok', async () => {
- jest.resetAllMocks()
- const getInstanceOrderStateSpy = jest.spyOn(ACMService, 'getInstanceOrderState')
- .mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(orderedStateJson)
- }
- })
- }
- )
-
- const changeInstanceOrderStateSpy = jest.spyOn(ACMService, 'changeInstanceOrderState')
- .mockImplementationOnce(() => {
- return Promise.resolve({
- ok: false,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(acmList)
- }
- })
- }
- )
-
- const component = mount(<ChangeOrderStateModal location={window.location}/>)
-
- await act( async () => {
- component.find('[variant="primary"]').simulate('click');
- await expect(getInstanceOrderStateSpy).toHaveBeenCalled()
- await expect(changeInstanceOrderStateSpy).toHaveBeenCalled()
- expect(logSpy).toHaveBeenNthCalledWith(1,"handleSave called");
- expect(logSpy).toHaveBeenNthCalledWith(2,"errorAlert called");
- });
- });
-
- it('Check useEffect is being called', async () => {
- jest.resetAllMocks()
- jest.spyOn(ACMService, 'getInstanceOrderState')
- .mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(orderedStateJson)
- }
- })
- }
- )
-
- jest.spyOn(ACMService, 'changeInstanceOrderState')
- .mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(acmList)
- }
- })
- }
- )
-
- const component = mount(<ChangeOrderStateModal location={window.location}/>)
-
- const useEffect = jest.spyOn(React, "useEffect");
- act(async () => {
- await flushPromises()
- component.update()
- await expect(useEffect).toHaveBeenCalled();
- })
- component.unmount();
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.js b/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.js
deleted file mode 100644
index d120def..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import Modal from "react-bootstrap/Modal";
-import Button from "react-bootstrap/Button";
-import React, { useEffect, useState } from "react";
-import styled from "styled-components";
-import ACMService from "../../../api/ACMService";
-import { Alert } from "react-bootstrap";
-import CommissioningUtils from "./utils/CommissioningUtils";
-
-const ModalStyled = styled(Modal)`
- @media (min-width: 800px) {
- .modal-xl {
- max-width: 96%;
- }
- }
- background-color: transparent;
-`
-
-const StyledMessagesDiv = styled.div`
- overflow: auto;
- min-width: 100%;
- max-height: 300px;
- padding: 5px 5px 0px 5px;
- text-align: center;
-`
-
-const AlertStyled = styled(Alert)`
- margin-top: 10px;
-`
-
-const CommissioningModal = (props) => {
- const [fullToscaTemplate, setFullToscaTemplate] = useState({});
- const [commonProperties, setCommonProperties] = useState({})
- const [jsonEditor, setJsonEditor] = useState(null);
- const [show, setShow] = useState(true);
- const [alertMessages, setAlertMessages] = useState();
- const [commonPropertiesResponseOk, setCommonPropertiesResponseOk] = useState(true);
- const [serviceTemplateResponseOk, setServiceTemplateResponseOk] = useState(true);
- const name = 'ToscaServiceTemplateSimple';
- const version = '1.0.0';
-
- useEffect(async () => {
- const toscaTemplateResponse = await ACMService.getToscaTemplate(name, version, null)
- .catch(error => error.message);
- const toscaCommonProperties = await ACMService.getCommonOrInstanceProperties(name, version, null, true)
- .catch(error => error.message);
-
- if (!toscaCommonProperties.ok) {
- const errorResponse = await toscaCommonProperties.json()
- setCommonProperties(errorResponse)
- setCommonPropertiesResponseOk(false);
- }
-
- if (!toscaTemplateResponse.ok) {
- const errorResponse = await toscaTemplateResponse.json()
- console.log(errorResponse)
- setFullToscaTemplate(errorResponse)
- setServiceTemplateResponseOk(false);
- }
-
- if (toscaTemplateResponse.ok && toscaCommonProperties.ok) {
- const renderedEditorObjects = CommissioningUtils.renderJsonEditor(toscaTemplateResponse, toscaCommonProperties)
- setFullToscaTemplate((await renderedEditorObjects).fullTemplate)
- setJsonEditor((await renderedEditorObjects).editorTemp)
-
- }
-
- }, []);
-
- const handleClose = () => {
- console.log('handleClose called');
- setShow(false);
- props.history.push('/');
- }
-
- const handleSave = async () => {
- console.log("handleSave called")
- if (jsonEditor != null) {
- setFullToscaTemplate(await CommissioningUtils.updateTemplate(jsonEditor.getValue(), fullToscaTemplate))
- }
- }
-
-
-
- const handleCommission = async () => {
-
- console.log("handleCommission called")
-
- await ACMService.deleteToscaTemplate('ToscaServiceTemplateSimple', "1.0.0")
-
- const recommissioningResponse = await ACMService.uploadToscaFile(fullToscaTemplate)
-
- await receiveResponseFromCommissioning(recommissioningResponse)
- }
-
- const receiveResponseFromCommissioning = async (response) => {
- console.log("receiveResponseFromCommissioning called")
- setAlertMessages(await CommissioningUtils.getAlertMessages(response));
- };
-
- return (
- <ModalStyled size="xl"
- show={ show }
- onHide={ handleClose }
- backdrop="static"
- keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Change ACM Common Properties</Modal.Title>
- </Modal.Header>
- <br/>
- <div style={ { padding: '5px 5px 0px 5px' } }>
- <Modal.Body>
- <div id="editor"/>
- <AlertStyled show={ !serviceTemplateResponseOk }
- variant="danger">Can't get service template:<br/>{ JSON.stringify(fullToscaTemplate, null, 2) }</AlertStyled>
- <AlertStyled show={ !commonPropertiesResponseOk }
- variant="danger">Can't get common properties:<br/>{ JSON.stringify(commonProperties, null, 2) }</AlertStyled>
- </Modal.Body>
- </div>
- <StyledMessagesDiv>
- { alertMessages }
- </StyledMessagesDiv>
- <Modal.Footer>
- <Button
- variant="primary"
- onClick={ handleSave }
- >Save</Button>
- <Button variant="success mr-auto"
- onClick={ handleCommission }>Commission</Button>
- <Button variant="secondary"
- onClick={ handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
-}
-
-export default CommissioningModal;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.test.js
deleted file mode 100644
index e3a50be..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.test.js
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import toJson from "enzyme-to-json";
-import { act } from "react-dom/test-utils";
-import { createMemoryHistory } from "history";
-import CommissioningModal from "./CommissioningModal";
-import commonProps from "./testFiles/commonProps.json";
-import fullTemp from "./testFiles/fullTemplate.json";
-import ACMService from "../../../api/ACMService";
-
-let logSpy = jest.spyOn(console, 'log')
-const commonProperties = JSON.parse(JSON.stringify(commonProps))
-const fullTemplate = JSON.parse(JSON.stringify(fullTemp))
-describe('Verify CommissioningModal', () => {
-
- const unmockedFetch = global.fetch
- beforeAll(() => {
- global.fetch = () =>
- Promise.resolve({
- status: 200,
- text: () => "OK",
- json: () => "{GlobalFetch}"
- })
- })
-
- afterAll(() => {
- global.fetch = unmockedFetch
- })
-
- beforeEach(() => {
- logSpy.mockClear()
- })
-
- it("renders without crashing", () => {
- shallow(<CommissioningModal/>);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<CommissioningModal/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have three Button elements', () => {
- const container = shallow(<CommissioningModal/>)
- expect(container.find('Button').length).toEqual(3);
- });
-
- it('handleClose called when bottom button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<CommissioningModal history={ history }/>)
-
- act(() => {
- component.find('[variant="secondary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
-
- component.unmount();
- });
-
- it('handleClose called when top-right button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<CommissioningModal history={ history }/>)
-
- act(() => {
- component.find('[size="xl"]').get(0).props.onHide();
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
-
- component.unmount();
- });
-
- it('handleSave called when save button clicked', () => {
- const component = shallow(<CommissioningModal/>)
- act(() => {
- component.find('[variant="primary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith("handleSave called");
- });
- });
-
- it('getToscaTemplate gets called in useEffect with error', async() => {
- const fetchMock = jest.spyOn(ACMService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
- ok: false,
- status: 200,
- text: () => "OK",
- json: () => fullTemplate
- }))
-
- mount(<CommissioningModal/>)
- await act(async () => {
- expect(fetchMock).toHaveBeenCalled();
- });
- });
-
- it('getCommonProperties gets called in useEffect with error', async() => {
- const fetchMock = jest.spyOn(ACMService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
- ok: false,
- status: 200,
- text: () => "OK",
- json: () => commonProperties
- }))
-
- mount(<CommissioningModal/>)
- await act(async () => {
- expect(fetchMock).toHaveBeenCalled();
- });
- });
-
- it('useState gets called in useEffect with error', async() => {
- const useStateSpy = jest.spyOn(React, 'useState')
- jest
- .spyOn(global, 'fetch')
- .mockImplementation(() =>
- Promise.resolve({
- ok: false,
- status: 200,
- text: () => "OK",
- json: () => "{useState}"
- })
- )
-
- mount(<CommissioningModal/>)
- await act(async () => {
- expect(useStateSpy).toHaveBeenCalledTimes(6);
- });
- });
-
- it('set state gets called for setFullToscaTemplate', () => {
- const setFullToscaTemplate = jest.fn();
- const history = createMemoryHistory();
- jest
- .spyOn(global, 'fetch')
- .mockImplementation(() =>
- Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => fullTemplate
- })
- )
-
- mount(<CommissioningModal history={ history }/>)
- act(async () => {
- // expect(renderJsonEditor).toHaveBeenCalled();
- expect(setFullToscaTemplate).toHaveBeenCalledTimes(1);
- });
- });
-
- it('set state gets called for setToscaJsonSchema useEffect on success', () => {
- const setToscaJsonEditor = jest.fn();
- const history = createMemoryHistory();
- jest
- .spyOn(global, 'fetch')
- .mockImplementation(() =>
- Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => fullTemplate
- })
- )
-
- mount(<CommissioningModal history={ history }/>)
- act(async () => {
- expect(setToscaJsonEditor).toHaveBeenCalledTimes(1);
- });
- });
-
- it('Check useEffect is being called', async () => {
- const useEffect = jest.spyOn(React, "useEffect");
- mount(<CommissioningModal/>)
- await act(async () => {
- expect(useEffect).toHaveBeenCalled();
- })
- });
-
- it('test handleCommission called on click', async () => {
- const deleteToscaTemplateSpy = jest.spyOn(ACMService, 'deleteToscaTemplate').mockImplementation(() => {
- Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => "{handleCommissioning}"
- })
- })
- const uploadToscaTemplateSpy = jest.spyOn(ACMService, 'uploadToscaFile').mockImplementation(() => {
- Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => "{uploadToscaFile}"
- })
- })
-
-
- const useStateSpy = jest.spyOn(React, 'useState')
-
- const component = shallow(<CommissioningModal/>)
- component.find('[variant="success mr-auto"]').simulate('click');
-
- await act( async () => {
- expect(logSpy).toHaveBeenCalledWith("handleCommission called")
- expect(await deleteToscaTemplateSpy).toHaveBeenCalled()
- expect(await uploadToscaTemplateSpy).toHaveBeenCalled()
- expect(logSpy).toHaveBeenCalledWith("receiveResponseFromCommissioning called")
- expect(useStateSpy).toHaveBeenCalled()
- })
- })
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.js
deleted file mode 100644
index 3dbf7bd..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React, { useState } from "react";
-import Button from "react-bootstrap/Button";
-import ACMService from "../../../api/ACMService";
-
-const DeleteToscaTemplate = props => {
-
- const deleteTemplateHandler = async () => {
- console.log('deleteTemplateHandler called');
-
- const response = await ACMService.deleteToscaTemplate(props.templateName, props.templateVersion)
- .catch(error => error.message);
-
- if(!response.ok) {
- console.log('deleteTemplateHandler called with error');
- } else {
- console.log('deleteTemplateHandler called');
- }
- // console.log('Response is ok: ' + response.ok);
-
- props.onDeleteToscaServiceTemplate(response);
-
- }
-
- return (
- <React.Fragment>
- <Button variant="danger"
- type="submit"
- style={{float: "right"}}
- onClick={ deleteTemplateHandler }>Delete Tosca Service Template</Button>
- </React.Fragment>
- );
-
-
-}
-
-export default DeleteToscaTemplate;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.test.js
deleted file mode 100644
index c52bdea..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.test.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import toJson from "enzyme-to-json";
-import DeleteToscaTemplate from "./DeleteToscaTemplate";
-
-describe('Verify DeleteToscaTemplate', () => {
-
- it("renders without crashing", () => {
- shallow(<DeleteToscaTemplate/>);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<DeleteToscaTemplate/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have a Button element', () => {
- const container = shallow(<DeleteToscaTemplate/>)
- expect(container.find('Button').length).toEqual(1);
- });
-
- it('button should call deleteTemplateHandler when clicked', async () => {
- const component = mount(<DeleteToscaTemplate/>)
- const logSpy = jest.spyOn(console, 'log');
-
- component.find('[variant="danger"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('deleteTemplateHandler called');
- });
-
- it('should have a Button element with specified text', () => {
- const container = shallow(<DeleteToscaTemplate/>)
- expect(container.find('Button').text()).toBe('Delete Tosca Service Template');
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.js b/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.js
deleted file mode 100644
index 013dd89..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React, { useState } from 'react';
-import Button from "react-bootstrap/Button";
-import Modal from 'react-bootstrap/Modal';
-import Form from 'react-bootstrap/Form';
-import Row from 'react-bootstrap/Row';
-import styled from 'styled-components';
-import Alert from 'react-bootstrap/Alert';
-import * as yaml from "js-yaml";
-import UploadToscaFile from "./UploadToscaFile";
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-const StyledMessagesDiv = styled.div`
- overflow: auto;
- min-width: 100%;
- max-height: 300px;
- padding: 5px 5px 0px 5px;
- text-align: center;
-`
-
-const GetLocalToscaFileForUpload = (props) => {
- const [selectedFile, setSelectedFile] = useState();
- const [fileIsSelected, setFileIsSelected] = useState(false);
- const [toscaJsonObject, setToscaJsonObject] = useState({});
- const [show, setShow] = useState(true);
- const [alertMessages, setAlertMessages] = useState();
-
- const handleClose = () => {
- console.log('handleClose called');
- setShow(false);
- props.history.push('/');
- }
-
- const fileChangeHandler = (event) => {
- event.preventDefault();
- console.log('fileChangeHandler called');
-
- if (event.currentTarget.files[0] !== undefined) {
- console.log('file defined');
- setSelectedFile(event.currentTarget.files[0]);
- setFileIsSelected(true);
-
- const file = event.currentTarget.files[0];
-
- setAlertMessages([]);
-
- const fileReader = new FileReader();
-
- fileReader.onload = () => {
- const jsonObj = yaml.load(fileReader.result, 'utf8');
- setToscaJsonObject(jsonObj);
- }
-
- fileReader.readAsText(file);
-
- } else {
- return;
- }
- };
-
- const receiveResponseFromUpload = async (response) => {
-
- if (await response.ok) {
- setAlertMessages(<Alert variant="success">
- <Alert.Heading>Upload Success</Alert.Heading>
- <p>Tosca Service Template from { selectedFile.name } was Successfully Uploaded</p>
- <hr/>
- <p>Type: { selectedFile.type }</p><p>Size: { +selectedFile.size / 1000 }Kb</p>
- </Alert>);
- }
- else {
- setAlertMessages(<Alert variant="danger">
- <Alert.Heading>Upload Failure</Alert.Heading>
- <p>Tosca Service Template from { selectedFile.name } failed to upload</p>
- <p>Status code: { await response.status }: { response.statusText }</p>
- <p>Response Text: { await response.text() }</p>
- <hr/>
- <p>Type: { selectedFile.type }</p><p>Size: { +selectedFile.size / 1000 }Kb</p>
- </Alert>);
- }
- };
-
- return (
- <ModalStyled size="lg"
- show={ show }
- onHide={ handleClose }
- backdrop="static"
- keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Upload Tosca to Commissioning API</Modal.Title>
- </Modal.Header>
- <br/>
- <div style={ { padding: '5px 5px 0px 5px' } }>
- <Modal.Body>
- <Form style={ { paddingTop: '20px' } }>
- <Form.Group as={ Row }>
- <Form.File
- type="file"
- className="custom-file-label"
- id="inputGroupFile01"
- onChange={ fileChangeHandler }
- custom
- accept=".yaml,.yml,.json"
- label={ fileIsSelected ? selectedFile.name : 'Please select a file' }
- >
- </Form.File>
- <Form.Text>Only .yaml, .yml and .json files are supported</Form.Text>
- </Form.Group>
- <Form.Group as={ Row }>
- <UploadToscaFile toscaObject={ toscaJsonObject }
- onResponseReceived={ receiveResponseFromUpload }/>
- </Form.Group>
- <Form.Group as={ Row }>
- <StyledMessagesDiv>
- { alertMessages }
- </StyledMessagesDiv>
- </Form.Group>
- </Form>
- </Modal.Body>
- </div>
- <Modal.Footer>
- <Button variant="secondary"
- onClick={ handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
-}
-
-export default GetLocalToscaFileForUpload;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.test.js
deleted file mode 100644
index 9b885c6..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.test.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import toJson from 'enzyme-to-json';
-import { act } from "react-dom/test-utils";
-import GetLocalToscaFileForUpload from './GetLocalToscaFileForUpload';
-import { createMemoryHistory } from 'history';
-
-
-describe('Verify GetLocalToscaFileForUpload', () => {
- const fs = require('fs');
- let testFile = fs.readFileSync('src/components/dialogs/Policy/toscaData.test.json');
- const file = new Blob([testFile], { type: 'file' });
-
- beforeEach(() => {
- fetch.resetMocks();
- fetch.mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "data_types": {},
- "policy_types": {},
- "topology_template": {},
- "name": "ToscaServiceTemplateSimple",
- "version": "1.0.0",
- "metadata": {},
- "id": "0.19518677404255147"
- });
- }
- });
- });
- })
-
- it("renders without crashing", () => {
- shallow(<GetLocalToscaFileForUpload/>);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<GetLocalToscaFileForUpload/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have a UploadToscaFile element', () => {
- const container = shallow(<GetLocalToscaFileForUpload/>)
- expect(container.find('UploadToscaFile').length).toEqual(1);
- });
-
- it('handleClose called when bottom button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<GetLocalToscaFileForUpload history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
-
-
- act(() => {
- component.find('[variant="secondary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- });
-
- it('handleClose called when top-right button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<GetLocalToscaFileForUpload history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
-
-
- act(() => {
- component.find('[size="lg"]').get(0).props.onHide();
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- });
-
- it('should call fileChangeHandler on change, file undefined', () => {
- const component = mount(<GetLocalToscaFileForUpload/>);
- const logSpy = jest.spyOn(console, 'log');
- const event = {
- preventDefault() {
- },
- currentTarget: { files: [] }
- };
-
- act(() => {
- component.find('[type="file"]').get(0).props.onChange(event);
- expect(logSpy).toHaveBeenCalledWith('fileChangeHandler called');
- });
- });
-
- it('should call fileChangeHandler on change, file defined', async () => {
- const component = mount(<GetLocalToscaFileForUpload/>);
- const logSpy = jest.spyOn(console, 'log');
- const event = {
- preventDefault() {
- },
- currentTarget: { files: [file] }
- };
-
- act(async () => {
- component.find('[type="file"]').get(0).props.onChange(event);
- expect(logSpy).toHaveBeenCalledWith('file defined');
- });
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.js
deleted file mode 100644
index e86c2cf..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React, { useState } from "react";
-import Button from "react-bootstrap/Button";
-import ACMService from "../../../api/ACMService";
-
-const GetToscaTemplate = (props) => {
-
- const getTemplateHandler = async () => {
-
- const response = await ACMService.getToscaTemplate(props.templateName, props.templateVersion)
- .catch(error => error.message);
-
- if(!response.ok) {
- console.log('getToscaServiceTemplateHandler called with error')
-
- } else
- {
- console.log('getToscaServiceTemplateHandler called')
- }
-
- props.onGetToscaServiceTemplate(response);
-
- }
-
- return (
- <React.Fragment>
- <Button variant="primary"
- type="submit"
- onClick={ getTemplateHandler }>Pull Tosca Service Template</Button>
- </React.Fragment>
- );
-
-
-}
-
-export default GetToscaTemplate;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.test.js
deleted file mode 100644
index 71fbeec..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.test.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import GetToscaTemplate from './GetToscaTemplate';
-import toJson from "enzyme-to-json";
-import { act } from "react-dom/test-utils";
-
-describe('Verify GetToscaTemplate', () => {
-
- const flushPromises = () => new Promise(setImmediate);
-
- it("renders without crashing", () => {
- shallow(<GetToscaTemplate/>);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<GetToscaTemplate/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have a Button element', () => {
- const container = shallow(<GetToscaTemplate/>)
- expect(container.find('Button').length).toEqual(1);
- });
-
- it('button should call getTemplateHandler when clicked when response is error', async () => {
-
- const onGetToscaServiceTemplate = jest.fn()
- jest
- .spyOn(global, 'fetch')
- .mockImplementationOnce(async () =>
- Promise.resolve({
- ok: false,
- status: 200,
- json: () => {
- return Promise.resolve({
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "data_types": {},
- "policy_types": {},
- "topology_template": {},
- "name": "ToscaServiceTemplateSimple",
- "version": "1.0.0",
- "metadata": {},
- "id": "0.19518677404255147"
- })
- }
- }
- )
- )
-
- const component = mount(<GetToscaTemplate onGetToscaServiceTemplate={onGetToscaServiceTemplate}/>)
- const logSpy = jest.spyOn(console, 'log');
-
- await act(async () => {
- component.find('[variant="primary"]').simulate('click');
- await flushPromises()
- component.update()
- expect(logSpy).toHaveBeenCalledWith('getToscaServiceTemplateHandler called with error');
- });
- component.unmount();
- });
-
- it('should have a Button element with specified text', () => {
- const container = shallow(<GetToscaTemplate/>)
- expect(container.find('Button').text()).toBe('Pull Tosca Service Template');
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.js
deleted file mode 100644
index 1c152ff..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.js
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React, { useEffect, useState } from "react";
-import Modal from "react-bootstrap/Modal";
-import styled from "styled-components";
-import Button from "react-bootstrap/Button";
-import ACMService from "../../../api/ACMService";
-import Alert from "react-bootstrap/Alert";
-import * as PropTypes from "prop-types";
-import InstantiationUtils from "./utils/InstantiationUtils";
-import Row from "react-bootstrap/Row";
-import Form from "react-bootstrap/Form";
-
-const ModalStyled = styled(Modal)`
- @media (min-width: 800px) {
- .modal-xl {
- max-width: 96%;
- }
- }
- background-color: transparent;
-`
-
-const DivWhiteSpaceStyled = styled.div`
- overflow: auto;
- min-width: 100%;
- max-height: 300px;
- padding: 5px 5px 0px 5px;
- text-align: center;
-`
-
-const AlertStyled = styled(Alert)`
- margin-top: 10px;
-`
-
-const templateName = "ToscaServiceTemplateSimple";
-const templateVersion = "1.0.0";
-
-function Fragment(props) {
- return null;
-}
-
-const specialCharacter = /[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
-
-Fragment.propTypes = {children: PropTypes.node};
-const InstancePropertiesModal = (props) => {
- const [show, setShow] = useState(true);
- const [toscaFullTemplate, setToscaFullTemplate] = useState({});
- const [jsonEditor, setJsonEditor] = useState(null);
- const [alertMessage, setAlertMessage] = useState(null);
- const [clearButton, setClearButton] = useState(null);
- const [instancePropertiesGlobal, setInstancePropertiesGlobal] = useState({});
- const [serviceTemplateResponseOk, setServiceTemplateResponseOk] = useState(true);
- const [instancePropertiesResponseOk, setInstancePropertiesResponseOk] = useState(true);
- const [instanceName, setInstanceName] = useState('');
- const [instanceVersion, setInstanceVersion] = useState('');
- const [oldInstanceName, setOldInstanceName] = useState('');
- const [tempInstanceName, setTempInstanceName] = useState('');
- const [validated, setValidated] = useState(false);
- const [editMode, setEditMode] = useState(false);
-
- useEffect(async () => {
- let isEditMode = false;
-
- if (props.location.instantiationName !== undefined) {
- isEditMode = true;
- setEditMode(true);
- setInstanceName(props.location.instantiationName);
- setInstanceVersion(props.location.instantiationVersion);
- }
-
- const instantiationName = isEditMode ? props.location.instantiationName : null;
- console.log(instantiationName);
-
- const toscaTemplateResponse = await ACMService.getToscaTemplate(templateName, templateVersion, instantiationName)
- .catch(error => error.message);
-
- const toscaInstanceProperties = await ACMService.getCommonOrInstanceProperties(templateName, templateVersion, instantiationName, false)
- .catch(error => error.message);
-
- if (toscaInstanceProperties == null || toscaTemplateResponse == null) {
- await warningAlert('Tosca service template is empty')
- return;
- }
-
- if (!toscaInstanceProperties.ok) {
- const errorResponse = await toscaInstanceProperties.json();
- console.log(errorResponse);
- setInstancePropertiesGlobal(errorResponse);
- setInstancePropertiesResponseOk(false);
- }
-
- if (!toscaTemplateResponse.ok) {
- const errorResponse = await toscaTemplateResponse.json();
- console.log(errorResponse);
- setToscaFullTemplate(errorResponse);
- setServiceTemplateResponseOk(false);
- }
-
- if (toscaTemplateResponse.ok && toscaInstanceProperties.ok) {
- const renderedJsonSchema = await InstantiationUtils.parseJsonSchema(toscaTemplateResponse, toscaInstanceProperties);
- setToscaFullTemplate(await (renderedJsonSchema).fullTemplate);
- setJsonEditor(await (renderedJsonSchema).jsonEditor);
- }
-
- }, []);
-
- useEffect(async () => {
-
- await validateInstanceName();
-
- }, [instanceName])
-
- const validateInstanceName = async () => {
- console.log('validateInstanceName called');
-
- if (specialCharacter.test(instanceName)) {
- await warningAlert('Instance name cannot contain special characters');
- } else if (alertMessage) {
- clearWarning();
- }
-
- if (instanceName.length > 2 && !specialCharacter.test(instanceName)) {
- console.log('validated');
- setOldInstanceName(tempInstanceName);
- setValidated(true);
- } else {
- setValidated(false);
- }
- }
-
- const handleClose = () => {
- console.log('handleClose called');
- setShow(false);
- props.history.push('/');
- }
-
- const handleInstanceName = (event) => {
- console.log('handleInstanceName called');
-
- setTempInstanceName(instanceName);
- setInstanceName(event.target.value);
-
- validateInstanceName().then(() => {
- });
- }
-
- const handleSave = async () => {
- if (instanceName !== '' || instanceName !== undefined || instanceName.length > 0) {
- console.log("handleSave called");
-
- console.log("instanceName to be saved is: " + instanceName);
-
- if (jsonEditor != null) {
- setToscaFullTemplate(InstantiationUtils.updateTemplate(instanceName, jsonEditor.getValue(), toscaFullTemplate));
- }
-
- let response = null;
-
- if (editMode) {
- response = await ACMService.updateInstanceProperties(oldInstanceName, instanceVersion, toscaFullTemplate)
- .catch(error => error.message);
- } else {
- response = await ACMService.createInstanceProperties(toscaFullTemplate)
- .catch(error => error.message);
- }
-
- if (response.ok) {
- successAlert();
- } else {
- await errorAlert(response);
- }
- } else {
- await warningAlert('Instance name cannot be empty');
- }
- }
-
- const warningAlert = async (message) => {
- console.log("warningAlert called");
-
- setAlertMessage(<Alert variant="warning">
- <Alert.Heading>Instantiation Properties Warning</Alert.Heading>
- <p>{message}</p>
- <hr/>
- </Alert>);
- }
-
- const successAlert = () => {
- console.log("successAlert called");
- setAlertMessage(<Alert variant="success">
- <Alert.Heading>Instantiation Properties Success</Alert.Heading>
- <p>Instance Properties was successfully saved</p>
- <hr/>
- </Alert>);
- }
-
- const errorAlert = async (response) => {
- console.log("errorAlert called");
- setAlertMessage(<Alert variant="danger">
- <Alert.Heading>Instantiation Properties Failure</Alert.Heading>
- <p>An error occurred while trying to save</p>
- <p>Status code: { await response.status } : { response.statusText }</p>
- <p>Status Text: { await response.text() }</p>
- <hr/>
- </Alert>);
- }
-
- const clearWarning = () => {
- console.log("clearWarning called");
-
- if (specialCharacter.test(instanceName)) {
- return;
- }
-
- setClearButton(null);
- setAlertMessage(null);
- }
-
- return (
- <ModalStyled size="xl"
- show={ show }
- onHide={ handleClose }
- backdrop="static"
- keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>{ editMode ? 'Edit' : 'Create' } Tosca Instance Properties</Modal.Title>
- </Modal.Header>
- <div style={ { padding: '5px 5px 0 5px' } }>
- <Modal.Body>
- <Form.Group as={ Row } controlId="formPlaintextEmail">
- <Form.Label column sm="2">Instance Name:</Form.Label>
- <input sm="5" type="text" style={ { width: '50%' } }
- value={ instanceName }
- onChange={ handleInstanceName }
- />
- </Form.Group>
- <div id="editor"/>
- <AlertStyled show={ !serviceTemplateResponseOk }
- variant="danger">Can't get service template:<br/>{ JSON.stringify(toscaFullTemplate, null, 2) }</AlertStyled>
- <AlertStyled show={ !instancePropertiesResponseOk }
- variant="danger">Can't get instance properties:<br/>{ JSON.stringify(instancePropertiesGlobal, null, 2) }</AlertStyled>
- </Modal.Body>
- <DivWhiteSpaceStyled>
- { alertMessage }
- </DivWhiteSpaceStyled>
- </div>
- <Modal.Footer>
- { clearButton }
- <Button variant="primary" disabled={ !validated } onClick={ handleSave } style={validated ? {} : { cursor: "not-allowed" }}>Save</Button>
- <Button variant="secondary" onClick={ handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
-}
-
-export default InstancePropertiesModal;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.test.js
deleted file mode 100644
index 5b60bce..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.test.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import {shallow} from "enzyme";
-import React from "react";
-import InstancePropertiesModal from "./InstancePropertiesModal";
-import toJson from "enzyme-to-json";
-import { createMemoryHistory } from "history";
-import { act } from "react-dom/test-utils";
-import ACMService from "../../../api/ACMService";
-import fullTemp from "./testFiles/fullTemplate.json";
-import instanceProps from "./testFiles/instanceProps.json";
-
-const instanceProperties = JSON.parse(JSON.stringify(instanceProps))
-const fullTemplate = JSON.parse(JSON.stringify(fullTemp))
-let logSpy = jest.spyOn(console, 'log');
-
-describe('Verify InstancePropertiesModal', () => {
-
- const unmockedFetch = global.fetch
- beforeAll(() => {
- global.fetch = () =>
- Promise.resolve({
- status: 200,
- text: () => "OK",
- json: () => "{GlobalFetch}"
- });
- });
-
- afterAll(() => {
- global.fetch = unmockedFetch
- });
-
- beforeEach(() => {
- logSpy.mockClear()
- });
-
- it("renders without crashing", () => {
- shallow(<InstancePropertiesModal />);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<InstancePropertiesModal />);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have save button element', () => {
- const container = shallow(<InstancePropertiesModal/>)
- expect(container.find('[variant="primary"]').length).toEqual(1);
- });
-
- it('should have close button element', () => {
- const container = shallow(<InstancePropertiesModal/>)
- expect(container.find('[variant="secondary"]').length).toEqual(1);
- });
-
- it('handleCreateUpdateToscaInstanceProperties called when save button clicked', () => {
- const component = shallow(<InstancePropertiesModal />);
-
- const instanceNameState = jest.spyOn(React, "useState");
- instanceNameState.mockImplementation(instanceName => [instanceName, 'Test']);
-
- act(() => {
- component.find('[variant="primary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleSave called');
- });
- });
-
- it('handleClose called when close button clicked', () => {
- const history = createMemoryHistory();
- const component = shallow(<InstancePropertiesModal history={ history }/>)
-
- act(() => {
- component.find('[variant="secondary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- });
-
- it('handleSave called when save button clicked', () => {
- const component = shallow(<InstancePropertiesModal />)
-
- act(() => {
- component.find('[variant="primary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleSave called');
- });
- });
-
- it('Check useEffect is being called', async () => {
- const useEffect = jest.spyOn(React, "useEffect");
- const component = shallow(<InstancePropertiesModal />)
- act(async () => {
- expect(useEffect).toHaveBeenCalled();
- component.update()
- });
- });
-
- it('Check useEffect is being called', async () => {
- const useEffect = jest.spyOn(React, "useEffect");
- const component = shallow(<InstancePropertiesModal />)
- act(async () => {
- expect(useEffect).toHaveBeenCalled();
- component.update();
- });
- });
-
- it('getToscaTemplate gets called in useEffect with error', async() => {
- const fetchMock = jest.spyOn(ACMService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
- ok: false,
- status: 200,
- text: () => "OK",
- json: () => fullTemplate
- }))
-
- const component = shallow(<InstancePropertiesModal/>)
- act(async () => {
- expect(fetchMock).toHaveBeenCalled();
- component.update();
- });
- });
-
- it('getCommonOrInstanceProperties gets called in useEffect with error', async() => {
- const fetchMock = jest.spyOn(ACMService, 'getCommonOrInstanceProperties').mockImplementation(() => Promise.resolve({
- ok: false,
- status: 200,
- text: () => "OK",
- json: () => instanceProperties
- }))
-
- const component = shallow(<InstancePropertiesModal/>)
- act(async () => {
- expect(fetchMock).toHaveBeenCalled();
- component.update();
- });
- });
-
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.js
deleted file mode 100644
index 0e2c407..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React, { useEffect, useState } from "react";
-import styled from "styled-components";
-import { Button } from "react-bootstrap";
-
-const UninitialisedBox = styled.div`
- margin: 0;
- padding: 0 0 1px 0;
- border-bottom: 1px solid #7f7f7f;
- background: #cccccc;
- font-weight: normal;
- border-radius: 0;
-`
-const PassiveBox = styled.div`
- margin: 0;
- padding: 0 0 1px 0;
- border-bottom: 1px solid #7f7f7f;
- background: #ffe87c;
- font-weight: normal;
- border-radius: 0;
-`
-const RunningBox = styled.div`
- margin: 0;
- padding: 0 0 1px 0;
- border-bottom: 1px solid #7f7f7f;
- background: #7ec699;
- font-weight: normal;
- border-radius: 0;
-`
-const ButtonStyle = styled(Button)`
- margin: 0;
- padding: 5px 12px;
- width: 100%;
- text-align: left;
- background: transparent !important;
- color: #000000 !important;
- text-decoration: none !important;
- border: none;
- border-radius: 0;
-
- :hover, :active :focus {
- color: #000000 !important;
- outline: 0 !important;
- box-shadow: none !important;
- background: transparent !important;
- text-decoration: none !important;
- }
-`
-
-const InstantiationElementItem = (props) => {
- const [title, setTitle] = useState("");
-
- useEffect(() => {
- const title = props.title.split(".");
- setTitle(title[4]);
- }, []);
-
- const toggleState = () => {
- switch (props.orderedState) {
- case 'UNINITIALISED':
- return renderUninitialisedOrderedState();
- case 'PASSIVE':
- return renderPassiveOrderedState();
- case 'RUNNING':
- return renderRunningOrderedState();
- }
- }
-
- const renderUninitialisedOrderedState = () => {
- return (
- <UninitialisedBox className="panel-header">
- <Button as={ ButtonStyle } variant="link">
- { title }
- </Button>
- </UninitialisedBox>
- )
- }
-
- const renderPassiveOrderedState = () => {
- return (
- <PassiveBox className="panel-header">
- <Button as={ ButtonStyle } variant="link">
- { title }
- </Button>
- </PassiveBox>
- )
- }
-
- const renderRunningOrderedState = () => {
- return (
- <RunningBox className="panel-header">
- <Button as={ ButtonStyle } variant="link" active={ true }>
- { title }
- </Button>
- </RunningBox>
- )
- }
-
- return (
- <React.Fragment>
- { toggleState() }
- </React.Fragment>
- );
-}
-
-export default InstantiationElementItem;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.test.js
deleted file mode 100644
index 7b1c1ec..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.test.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- *
- *
- */
-
-import { shallow } from "enzyme";
-import toJson from "enzyme-to-json";
-import React from "react";
-import InstantiationElementItem from "./InstantiationElementItem";
-
-describe('Verify InstantiationElementItem', () => {
- const index = 0;
-
- it("renders correctly", () => {
- const container = shallow(<InstantiationElementItem />);
- expect(toJson(container)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is uninitialized", () => {
- const container = shallow(<InstantiationElementItem title={ "UNINITIALISED_TEST" } orderState={ "UNINITIALISED" } index={ index } key={ index }/>);
- expect(toJson(container)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is passive", () => {
- const container = shallow(<InstantiationElementItem title={ "PASSIVE_TEST" } orderState={ "PASSIVE" } index={ index } key={ index }/>);
- expect(toJson(container)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is running", () => {
- const container = shallow(<InstantiationElementItem title={ "RUNNING_TEST" } orderState={ "RUNNING" } index={ index } key={ index }/>);
- expect(toJson(container)).toMatchSnapshot();
- });
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.js
deleted file mode 100644
index d8e6348..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React, { useEffect, useState } from "react";
-import InstantiationElementItem from "./InstantiationElementItem";
-
-const InstantiationElements = (props) => {
- const [clElements, setClElements] = useState([]);
-
- useEffect(() => {
- setClElements(Object.values(props.elements));
- }, []);
-
- return (
- <React.Fragment>
- {
- clElements.map((clEl, index) => (
- <InstantiationElementItem title={ clEl["definition"]["name"] } orderedState={ clEl["orderedState"] } key={ index } />
- ))
- }
- </React.Fragment>
- );
-}
-
-export default InstantiationElements;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.test.js
deleted file mode 100644
index 127a886..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.test.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- *
- *
- */
-
-import toJson from "enzyme-to-json";
-import { shallow } from "enzyme";
-import React from "react";
-import InstantiationElements from "./InstantiationElements";
-
-describe('Verify InstantiationElements', () => {
- const container = shallow(<InstantiationElements />);
-
- it("renders correctly", () => {
- expect(toJson(container)).toMatchSnapshot();
- });
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.js
deleted file mode 100644
index 7b8e453..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from "react";
-import styled from 'styled-components';
-
-import { Accordion, Button, Card } from "react-bootstrap";
-import AccordionHeader from "./AccordionHeader";
-
-const AccordionBody = styled.div`
- margin: 0;
- padding: 0;
- border: 1px solid #7f7f7f;
- border-radius: 0;
-`
-
-const CardBody = styled(Card.Body)`
- padding: 0;
- margin: 0;
-`
-
-const InstantiationItem = (props) => {
-
- return (
- <Accordion>
- <AccordionBody>
- <AccordionHeader title={ props.title } orderedState={ props.orderedState } index={ props.index } key={ props.index } />
- <Accordion.Collapse eventKey={ props.index.toString() }>
- <CardBody>{ props.children }</CardBody>
- </Accordion.Collapse>
- </AccordionBody>
- </Accordion>
- );
-}
-
-export default InstantiationItem;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.test.js
deleted file mode 100644
index fe4aaf8..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.test.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- *
- *
- */
-
-import React from "react";
-import { shallow } from "enzyme";
-import toJson from "enzyme-to-json";
-
-import InstantiationItem from "./InstantiationItem";
-
-describe('Verify InstantiationItem', () => {
-
- const index = 0;
- const title = "PMSH Instance";
- const orderState = "UNINITIALISED";
- const container = shallow(<InstantiationItem title={ { title } } orderState={ { orderState } } index={ { index } } key={ { index } }/>);
-
- it("renders without crashing", () => {
- shallow(<InstantiationItem title={ { title } } orderState={ { orderState } } index={ { index } } key={ { index } }/>);
- });
-
- it("renders correctly", () => {
- expect(toJson(container)).toMatchSnapshot();
- });
-
- it("should contain an Accordion", () => {
- const accordion = container.find('Accordion');
- expect(accordion).toHaveLength(1);
- });
-
- it("should contain an AccordionHeader", () => {
- const accordion = container.find('AccordionHeader');
- expect(accordion).toHaveLength(1);
- });
-
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.js
deleted file mode 100644
index 2d87119..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.js
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- *
- *
- */
-
-import Modal from "react-bootstrap/Modal";
-import { Alert, Container, Table } from "react-bootstrap";
-import Button from "react-bootstrap/Button";
-import React, { useEffect, useState } from "react";
-import styled from "styled-components";
-import { Link } from "react-router-dom";
-import ACMService from "../../../api/ACMService";
-import Row from "react-bootstrap/Row";
-import InstantiationUtils from "./utils/InstantiationUtils";
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-const HorizontalSpace = styled.div`
- padding-right: 2px;
- padding-left: 2px;
-`;
-
-const DivWhiteSpaceStyled = styled.div`
- overflow: auto;
- min-width: 100%;
- max-height: 300px;
- padding: 5px 5px 0px 5px;
- text-align: center;
-`
-const InstantiationManagementModal = (props) => {
- const [show, setShow] = useState(true);
- const [instantiationList, setInstantiationList] = useState([]);
- const [alertMessage, setAlertMessage] = useState(null);
-
- useEffect(async () => {
-
- const response = await ACMService.getACMInstantiation();
-
- const instantiationListJson = await response.json();
-
- const parsedInstantiationList = InstantiationUtils.parseInstantiationList(instantiationListJson['automationCompositionList']);
-
- setInstantiationList(parsedInstantiationList);
- }, []);
-
- const getBackgroundColor = (index) => {
- if (index % 2 === 0) {
- return 'Silver';
- }
-
- return 'White';
- }
-
- const deleteInstantiationHandler = async (index, instantiation) => {
- console.log("deleteInstantiationHandler called");
-
- if (instantiation.disableDelete) {
- return;
- }
-
- const name = instantiation.name;
- const version = instantiation.version;
-
- const response = await ACMService.deleteInstantiation(name, version);
-
- updateList(index);
-
- if (response.ok) {
- successAlert();
- } else {
- await errorAlert(response);
- }
- }
-
- const updateList = (index) => {
- console.log("updateList called")
-
- const updatedList = [...instantiationList];
- updatedList.splice(index, 1);
-
- setInstantiationList(updatedList);
- }
-
- const handleClose = () => {
- console.log("handleClose called");
- setShow(false);
- props.history.push('/');
- }
-
- const successAlert = () => {
- console.log("successAlert called");
- setAlertMessage(<Alert variant="success">
- <Alert.Heading>Deletion of Instantiation Success</Alert.Heading>
- <p>Deletion of Instantiation was successful!</p>
- <hr/>
- </Alert>);
- }
-
- const errorAlert = async (response) => {
- console.log("errorAlert called");
- setAlertMessage(<Alert variant="danger">
- <Alert.Heading>Deletion of Instantiation Failure</Alert.Heading>
- <p>An error occurred while trying to delete instantiation</p>
- <p>Status code: { await response.status } : { response.statusText }</p>
- <p>Status Text: { await response.text() }</p>
- <hr/>
- </Alert>);
- }
-
- const clearErrors = () => {
- console.log("clearErrors called");
- setAlertMessage(null);
- }
-
- return (
- <ModalStyled size="xl"
- show={ show }
- onHide={ handleClose }
- backdrop="static"
- keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Manage Instances</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <Container>
- <Row>
- <Link to={ { pathname: "/editACMInstanceProperties" } }>
- <Button variant="primary" type="null">Create Instance</Button>
- </Link>
- <HorizontalSpace/>
- <Link to={ { pathname: "/monitorInstantiation" } }>
- <Button variant="secondary" type="null">Monitor Instantiations</Button>
- </Link>
- </Row>
- </Container>
- <Table bordered style={ { marginTop: '10px' } }>
- <thead>
- <tr>
- <th>#</th>
- <th style={ { textAlign: "center" } }>Instantiation Name</th>
- <th style={ { textAlign: "center" } }>Edit Instantiation</th>
- <th style={ { textAlign: "center" } }>Delete Instantiation</th>
- <th style={ { textAlign: "center" } }>Change Order State</th>
- <th style={ { textAlign: "center" } }>Instantiation Order State</th>
- <th style={ { textAlign: "center" } }>Instantiation Current State</th>
- </tr>
- </thead>
- <tbody>
- { instantiationList.map((instantiation, index) => {
- return (
- <tr style={ { backgroundColor: getBackgroundColor(index) } } key={ index } className="instantiationList">
- <td>{ index + 1 }</td>
- <td>{ instantiation.name }</td>
- <td style={ { textAlign: "center" } }>
- <Link to={ {
- pathname: "editACMInstanceProperties",
- instantiationName: instantiation.name,
- instantiationVersion: instantiation.version
- } }>
- <Button variant={ instantiation.disabled ? "outline-success" : "success" } type="null"
- disabled={ instantiation.disableEdit }
- style={ instantiation.disableEdit ? { cursor: "not-allowed" } : {} }>Edit</Button>
- </Link>
- </td>
- <td style={ { textAlign: "center" } }>
- <Button variant={ instantiation.disabled ? "outline-danger" : "danger" } type="null"
- disabled={ instantiation.disableDelete }
- style={ instantiation.disableDelete ? { cursor: "not-allowed" } : {} }
- onClick={(e) => deleteInstantiationHandler(index, instantiation)}>Delete</Button>
- </td>
- <td style={ { textAlign: "center" } }>
- <Link to={ {
- pathname: "changeOrderState",
- instantiationName: instantiation.name,
- instantiationVersion: instantiation.version
- } }>
- <Button variant="secondary" type="null">Change</Button>
- </Link>
- </td>
- <td>{ instantiation.orderedState }</td>
- <td>{ instantiation.currentState }</td>
- </tr>
- )
- }) }
- </tbody>
- </Table>
- <DivWhiteSpaceStyled>
- { alertMessage }
- </DivWhiteSpaceStyled>
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ clearErrors }>Clear Error Message</Button>
- <Button variant="secondary" type="null" onClick={ handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
-}
-
-export default InstantiationManagementModal;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.test.js
deleted file mode 100644
index e511ce0..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.test.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- *
- *
- */
-
-import {mount, shallow} from "enzyme";
-import React from "react";
-import toJson from "enzyme-to-json";
-import InstantiationManagementModal from "./InstantiationManagementModal";
-import {act} from "react-dom/test-utils";
-import {createMemoryHistory} from "history";
-import ACMService from "../../../api/ACMService";
-import acmLoopList from "./testFiles/acmList.json";
-import {BrowserRouter} from "react-router-dom";
-
-const logSpy = jest.spyOn(console, 'log')
-const history = createMemoryHistory();
-
-describe('Verify Instantiation Management', () => {
- const flushPromises = () => new Promise(setImmediate);
-
- beforeEach(() => {
- logSpy.mockClear();
- });
-
- it("renders without crashing", () => {
- shallow(<InstantiationManagementModal/>);
- });
- it("renders correctly", () => {
- const tree = shallow(<InstantiationManagementModal/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have a close Button element', () => {
- const container = shallow(<InstantiationManagementModal/>);
- const button = container.find('[variant="secondary"]').at(2);
-
- expect(button.text()).toEqual("Close");
- });
-
- it('should have a Create Instance Button element', () => {
- const container = shallow(<InstantiationManagementModal/>);
- const button = container.find('[variant="primary"]').at(0);
-
- expect(button.text()).toEqual("Create Instance");
- });
-
- it('should have a Monitor Instantiations Button element', () => {
- const container = shallow(<InstantiationManagementModal/>);
- const button = container.find('[variant="secondary"]').at(0);
-
- expect(button.text()).toEqual("Monitor Instantiations");
- });
-
- it('handleClose called when bottom button clicked', () => {
- const container = shallow(<InstantiationManagementModal history={history}/>);
- const button = container.find('[variant="secondary"]').at(2);
-
- act(() => {
- button.simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- });
-
- it('handleClose called when top-right button clicked', () => {
- const container = shallow(<InstantiationManagementModal history={history}/>);
-
- act(() => {
- container.find('[size="xl"]').get(0).props.onHide();
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- });
-
- it('clearErrors called when clear error message button clicked', () => {
- const container = shallow(<InstantiationManagementModal history={history}/>);
- const button = container.find('[variant="secondary"]').at(1);
-
- act(() => {
- button.simulate('click');
- expect(logSpy).toHaveBeenCalledWith('clearErrors called');
- });
- });
-
- it('Check useEffect is being called', async () => {
- jest.resetAllMocks();
- jest.spyOn(ACMService, 'getACMInstantiation')
- .mockImplementationOnce(async () => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(acmLoopList);
- }
- });
- });
-
- const component = mount(
- <BrowserRouter>
- <InstantiationManagementModal/>
- </BrowserRouter>
- );
- const useEffect = jest.spyOn(React, "useEffect");
-
- await act(async () => {
- await flushPromises()
- component.update();
- await expect(useEffect).toHaveBeenCalled();
-
- });
- component.unmount();
- });
-
- it('set state gets called for setInstantiationList useEffect on success', async () => {
- const setInstantiationList = jest.fn();
- const setDeleteInstantiation = true;
- const history = createMemoryHistory();
- jest
- .spyOn(global, 'fetch')
- .mockImplementation(() =>
- Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => acmLoopList
- })
- )
-
- mount(
- <BrowserRouter>
- <InstantiationManagementModal history={history}/>
- </BrowserRouter>
- );
- act(async () => {
- expect(setInstantiationList).toHaveBeenCalledTimes(1);
- expect(setDeleteInstantiation).toHaveBeenCalledTimes(1);
- });
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.js
deleted file mode 100644
index 8545943..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from "react";
-import styled from "styled-components";
-
-const UninitialisedBox = styled.div`
- margin: 2px -15px;
- padding: 8px;
- outline: none;
- font-size: 16px;
- font-weight: normal;
- background: #cccccc;
- border-radius: 8px;
- border: 1px solid #7f7f7f;
-
- &:focus, &:active, &:after {
- outline: none;
- border-radius: 8px;
- }
-`
-
-const PassiveBox = styled.div`
- margin: 2px -15px;
- padding: 8px;
- outline: none;
- font-size: 16px;
- font-weight: normal;
- background: #ffe87c;
- border-radius: 8px;
- border: 1px solid #7f7f7f;
-
- &:focus, &:active, &:after {
- outline: none;
- border-radius: 8px;
- }
-`
-
-const RunningBox = styled.div`
- margin: 2px -15px;
- padding: 8px;
- outline: none;
- font-size: 16px;
- font-weight: normal;
- background: #7ec699;
- border-radius: 8px;
- border: 1px solid #7f7f7f;
-
- &:focus, &:active, &:after {
- outline: none;
- border-radius: 8px;
- }
-`
-
-const InstantiationOrderStateChangeItem = (props) => {
-
- const renderOrderStateItem = () => {
- console.log("renderOrderStateItem called");
- switch (props.orderState) {
- case 'UNINITIALISED':
- console.log("called UNINITIALISED");
- return renderUninitialisedOrderedState();
- case 'PASSIVE':
- console.log("called PASSIVE");
- return renderPassiveOrderedState();
- case 'RUNNING':
- console.log("called RUNNING");
- return renderRunningOrderedState();
- }
- }
-
- const renderUninitialisedOrderedState = () => {
- return (
- <UninitialisedBox>{ props.title }</UninitialisedBox>
- )
- }
-
- const renderPassiveOrderedState = () => {
- return (
- <PassiveBox>{ props.title }</PassiveBox>
- )
- }
-
- const renderRunningOrderedState = () => {
- return (
- <RunningBox>{ props.title }</RunningBox>
- )
- }
-
- return (
- <React.Fragment>
- { renderOrderStateItem() }
- </React.Fragment>
- );
-}
-
-export default InstantiationOrderStateChangeItem;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.test.js
deleted file mode 100644
index 3981ea5..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.test.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import toJson from "enzyme-to-json";
-import InstantiationOrderStateChangeItem from "./InstantiationOrderStateChangeItem";
-import CommissioningUtils from "./utils/CommissioningUtils";
-
-describe('Verify InstantiationOrderStateChangeItem', () => {
-
- it("renders without crashing", () => {
- shallow(<InstantiationOrderStateChangeItem/>);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<InstantiationOrderStateChangeItem/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is uninitialized", () => {
- const tree = shallow(<InstantiationOrderStateChangeItem orderState="UNINITIALISED" title="UNINITIALISED_TEST"/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is passive", () => {
- const tree = shallow(<InstantiationOrderStateChangeItem orderState="PASSIVE" title="PASSIVE_TEST"/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it("renders correctly when orderState is running", () => {
- const tree = shallow(<InstantiationOrderStateChangeItem orderState="RUNNING" title="RUNNING_TEST"/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.js b/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.js
deleted file mode 100644
index 5699b56..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React, { useEffect, useState } from "react";
-import styled from "styled-components";
-import Modal from "react-bootstrap/Modal";
-import Button from "react-bootstrap/Button";
-import InstantiationItem from "./InstantiationItem";
-import ACMService from "../../../api/ACMService";
-import InstantiationElements from "./InstantiationElements";
-import { Alert } from "react-bootstrap";
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-const AlertStyled = styled(Alert)`
- margin-top: 10px;
-`
-
-const MonitorInstantiation = (props) => {
- const [show, setShow] = useState(true);
- const [acmList, setAcmList] = useState([]);
- const [acmInstantiationOk, setAcmInstantiationOk] = useState(true);
- const [acmInstantiationError, setACMInstantiationError] = useState({});
-
- useEffect(async () => {
- const acmInstantiation = await ACMService.getACMInstantiation()
- .catch(error => error.message);
-
- const acmInstantiationJson = await acmInstantiation.json();
-
- if (!acmInstantiation.ok || acmInstantiationJson['automationCompositionList'].length === 0) {
- setAcmInstantiationOk(false)
- setACMInstantiationError(acmInstantiationJson)
- } else {
- setAcmList(acmInstantiationJson['automationCompositionList']);
- }
- }, [])
-
- const handleClose = () => {
- console.log('handleClose called');
- setShow(false);
- props.history.push('/');
- }
-
- return (
- <ModalStyled size="xl" show={ show } onHide={ handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Tosca Instantiation - Monitoring</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- {
- acmList.map((clList, index) => (
- <InstantiationItem title={ clList["name"] } orderedState={ clList["orderedState"] } index={ index } key={ index } >
- <InstantiationElements elements={ clList["elements"] } />
- </InstantiationItem>
- ))
- }
- <AlertStyled show={ !acmInstantiationOk }
- variant="danger">Can't get acm instantiation info:<br/>{ JSON.stringify(acmInstantiationError, null, 2) }</AlertStyled>
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- )
-}
-
-export default MonitorInstantiation;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.test.js
deleted file mode 100644
index 5923f10..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.test.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from "react";
-import { mount, shallow } from "enzyme";
-import toJson from "enzyme-to-json";
-import { act } from "react-dom/test-utils";
-import { createMemoryHistory } from "history";
-import MonitorInstantiation from "./MonitorInstantiation";
-import ACMService from "../../../api/ACMService";
-import clLoopList from "./testFiles/acmList.json";
-
-const logSpy = jest.spyOn(console, 'log')
-const history = createMemoryHistory();
-
-describe('Verify MonitorInstantiation', () => {
- const flushPromises = () => new Promise(setImmediate);
-
- beforeEach(() => {
- logSpy.mockClear();
- });
-
- it("renders correctly", () => {
- const container = shallow(<MonitorInstantiation />);
- expect(toJson(container)).toMatchSnapshot();
- });
-
- it('should have a Button element', () => {
- const container = shallow(<MonitorInstantiation />);
- expect(container.find('Button').length).toEqual(1);
- });
-
- it('handleClose called when bottom button clicked', () => {
- const container = shallow(<MonitorInstantiation history={ history } />);
- const logSpy = jest.spyOn(console, 'log');
-
- act(() => {
- container.find('[variant="secondary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- });
-
- it('handleClose called when top-right button clicked', () => {
- const container = shallow(<MonitorInstantiation history={ history } />);
- const logSpy = jest.spyOn(console, 'log');
-
- act(() => {
- container.find('[size="xl"]').get(0).props.onHide();
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- });
-
- it('Check useEffect is being called', async () => {
- jest.resetAllMocks();
- jest.spyOn(ACMService, 'getACMInstantiation')
- .mockImplementationOnce(async () => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(clLoopList);
- }
- });
- });
-
- const component = mount(<MonitorInstantiation />);
- const useEffect = jest.spyOn(React, "useEffect");
-
- await act(async () => {
- await flushPromises()
- component.update();
- await expect(useEffect).toHaveBeenCalled();
- });
- component.unmount();
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.js b/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.js
deleted file mode 100644
index 5fc97c4..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React, { useState } from "react";
-import GetToscaTemplate from "./GetToscaTemplate";
-import Modal from "react-bootstrap/Modal";
-import Button from "react-bootstrap/Button";
-import { Alert } from "react-bootstrap";
-
-import styled from 'styled-components';
-import DeleteToscaTemplate from "./DeleteToscaTemplate";
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-const AlertStyled = styled(Alert)`
- margin-top: 10px;
-`
-
-const PreStyled = styled.pre`
- color: #7F0055;
- overflow: auto;
- max-height: 70vh;
- margin-top: 10px;
-`
-
-const ReadAndConvertYaml = (props) => {
- const [show, setShow] = useState(true);
- const [toscaTemplateData, setToscaTemplateData] = useState();
- const [deleteToscaTemplateData, setDeleteToscaTemplateData] = useState(null);
- const [responseOk, setResponseOk] = useState(true);
- const [deleteResponseOk, setDeleteResponseOk] = useState(true);
- const [showDeleteButton, setShowDeleteButton] = useState(false);
- const name = 'ToscaServiceTemplateSimple';
- const version = '1.0.0';
-
- const handleClose = () => {
- console.log('handleClose called');
- setShow(false);
- props.history.push('/');
- }
-
- const getToscaServiceTemplateHandler = async (toscaServiceTemplateResponse) => {
-
- if (!toscaServiceTemplateResponse.ok) {
- console.log('Response is not ok');
- setResponseOk(false);
- const toscaData = await toscaServiceTemplateResponse.json();
- setToscaTemplateData(toscaData);
- } else {
- setResponseOk(true);
- console.log('Response is ok');
- const toscaData = await toscaServiceTemplateResponse.json();
- setToscaTemplateData(toscaData);
- setShowDeleteButton(true)
- }
- }
-
- const deleteToscaServiceTemplateHandler = async (deleteToscaServiceTemplateResponse) => {
-
- if (!deleteToscaServiceTemplateResponse.ok) {
- setShowDeleteButton(false)
- console.log('Delete response not ok');
- setDeleteResponseOk(false);
- const deleteToscaData = await deleteToscaServiceTemplateResponse.json();
- console.log(deleteToscaData)
- setDeleteToscaTemplateData(deleteToscaData);
- } else {
- setShowDeleteButton(false)
- setDeleteResponseOk(true);
- const deleteToscaData = await deleteToscaServiceTemplateResponse.json();
- setDeleteToscaTemplateData(null)
- setDeleteToscaTemplateData(deleteToscaData);
- setShowDeleteButton(false);
- }
- }
-
- return (
- <ModalStyled size="xl"
- show={ show }
- onHide={ handleClose }
- backdrop="static"
- keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>View Tosca Template</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <GetToscaTemplate templateName={ name }
- templateVersion={ version }
- onGetToscaServiceTemplate={ getToscaServiceTemplateHandler }/>
- { responseOk && <PreStyled> { JSON.stringify(toscaTemplateData, null, 2) } </PreStyled> }
- <AlertStyled show={ !responseOk }
- variant="danger">{ JSON.stringify(toscaTemplateData, null, 2) }</AlertStyled>
- { showDeleteButton &&
- <DeleteToscaTemplate templateName={ name }
- templateVersion={ version }
- onDeleteToscaServiceTemplate={ deleteToscaServiceTemplateHandler }
- />
- }
- <AlertStyled show={ !deleteResponseOk }
- variant="danger">{ JSON.stringify(deleteToscaTemplateData, null, 2) }</AlertStyled>
- <AlertStyled show={ deleteResponseOk && deleteToscaTemplateData != null && toscaTemplateData != null}
- variant="success"><h2>Delete Successful</h2><PreStyled>{ JSON.stringify(deleteToscaTemplateData, null, 2) }</PreStyled></AlertStyled>
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary"
- type="null"
- onClick={ handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
-}
-;
-
-export default ReadAndConvertYaml;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.test.js
deleted file mode 100644
index 03192a1..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.test.js
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import ReadAndConvertYaml from './ReadAndConvertYaml';
-import GetToscaTemplate from "./GetToscaTemplate";
-import toJson from "enzyme-to-json";
-import { act } from "react-dom/test-utils";
-import { createMemoryHistory } from "history";
-
-let logSpy = jest.spyOn(console, 'log')
-describe('Verify ReadAndConvertYaml', () => {
-
- const unmockedFetch = global.fetch
-
- const flushPromises = () => new Promise(setImmediate);
-
- beforeAll(() => {
- global.fetch = () =>
- Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => Promise.resolve({
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "data_types": {},
- "policy_types": {},
- "topology_template": {},
- "name": "ToscaServiceTemplateSimple",
- "version": "1.0.0",
- "metadata": {},
- "id": "0.19518677404255147"
- })
- })
- })
-
- beforeEach(() => {
- logSpy.mockClear()
- })
-
- afterAll(() => {
- global.fetch = unmockedFetch
- })
-
- it("renders without crashing", () => {
- shallow(<ReadAndConvertYaml/>);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<ReadAndConvertYaml/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have a GetToscaTemplate element', () => {
- const container = shallow(<ReadAndConvertYaml/>)
- expect(container.find('GetToscaTemplate').length).toEqual(1);
- });
-
- it('should call getToscaServiceTemplateHandler on click', async () => {
- const component = mount(<ReadAndConvertYaml/>);
-
- await act(async () => {
- component.find('GetToscaTemplate').simulate('click');
- await flushPromises()
- component.update()
- await expect(logSpy).toHaveBeenCalledWith('getToscaServiceTemplateHandler called');
- });
- component.unmount()
- });
-
- it('should make unsuccessful call getToscaServiceTemplateHandler on click', async () => {
- jest
- .spyOn(global, 'fetch')
- .mockImplementationOnce(async () =>
- Promise.resolve({
- ok: false,
- status: 200,
- json: () => {
- return Promise.resolve({
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "data_types": {},
- "policy_types": {},
- "topology_template": {},
- "name": "ToscaServiceTemplateSimple",
- "version": "1.0.0",
- "metadata": {},
- "id": "0.19518677404255147"
- })
- }
- }
- )
- )
- const component = mount(<ReadAndConvertYaml/>);
-
- await act(async () => {
- component.find('GetToscaTemplate').simulate('click');
- await flushPromises()
- component.update()
- expect(logSpy).toHaveBeenCalledWith('getToscaServiceTemplateHandler called with error');
- });
- component.unmount();
- });
-
- it('should make unsuccessful call deleteToscaServiceTemplateHandler on click', async () => {
- jest
- .spyOn(global, 'fetch')
- .mockImplementationOnce(() =>
- Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "data_types": {},
- "policy_types": {},
- "topology_template": {},
- "name": "ToscaServiceTemplateSimple",
- "version": "1.0.0",
- "metadata": {},
- "id": "0.19518677404255147"
- })
- }
- }
- )
- )
- const component = mount(<ReadAndConvertYaml/>);
-
- await act(async () => {
- component.find('GetToscaTemplate').simulate('click');
- await flushPromises()
- component.update()
- component.find('DeleteToscaTemplate').simulate('click');
- await flushPromises()
- component.update()
- expect(logSpy).toHaveBeenCalledWith('deleteTemplateHandler called');
- });
-
- component.unmount()
- });
-
- it('should make unsuccessful call deleteToscaServiceTemplateHandler on click', async () => {
- const realUseState = React.useState
- const stubInitialState = [true]
-
- const useStateSpy = jest.spyOn(React, 'useState')
- useStateSpy.mockImplementationOnce(() => realUseState(stubInitialState));
-
- jest
- .spyOn(global, 'fetch')
- .mockImplementationOnce(() =>
- Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "data_types": {},
- "policy_types": {},
- "topology_template": {},
- "name": "ToscaServiceTemplateSimple",
- "version": "1.0.0",
- "metadata": {},
- "id": "0.19518677404255147"
- })
- }
- }
- )
- )
- const component = mount(<ReadAndConvertYaml/>);
-
-
- await act(async () => {
- component.find('GetToscaTemplate').simulate('click');
- await flushPromises()
- component.update()
- });
-
- jest
- .spyOn(global, 'fetch')
- .mockImplementationOnce(() =>
- Promise.resolve({
- ok: false,
- status: 200,
- json: () => {
- return Promise.resolve({
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "data_types": {},
- "policy_types": {},
- "topology_template": {},
- "name": "ToscaServiceTemplateSimple",
- "version": "1.0.0",
- "metadata": {},
- "id": "0.19518677404255147"
- })
- }
- }
- )
- )
-
- await act(async () => {
- component.find('DeleteToscaTemplate').simulate('click');
- await flushPromises()
- component.update()
- expect(logSpy).toHaveBeenCalledWith('deleteTemplateHandler called with error');
- });
- component.unmount()
- });
-
- it('handleClose called when bottom button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<ReadAndConvertYaml history={ history }/>)
-
-
- act(() => {
- component.find('[variant="secondary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- component.unmount()
- });
-
- it('handleClose called when top-right button clicked', async () => {
- const history = createMemoryHistory();
- const component = mount(<ReadAndConvertYaml history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
-
-
- await act(async () => {
- component.find('[size="xl"]').get(0).props.onHide();
- await flushPromises()
- component.update()
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- component.unmount()
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.js b/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.js
deleted file mode 100644
index 4357a9f..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import Button from "react-bootstrap/Button";
-import React, { useState } from "react";
-import ACMService from "../../../api/ACMService";
-
-const UploadToscaFile = (props) => {
-
- const postServiceTemplateHandler = async (event) => {
- event.preventDefault();
- console.log('postServiceTemplateHandler called');
-
- const response = await ACMService.uploadToscaFile(props.toscaObject)
- .catch(error => error.message);
-
- // const responseMessage = await response.text();
-
- props.onResponseReceived(response);
-
- }
-
- return (
- <React.Fragment>
- <Button variant="primary"
- block={ true }
- type="submit"
- onClick={ postServiceTemplateHandler }>
- Upload Tosca Service Template
- </Button>
- </React.Fragment>
- );
-
-};
-
-export default UploadToscaFile;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.test.js
deleted file mode 100644
index 520eea9..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.test.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import UploadToscaFile from './UploadToscaFile';
-import toJson from "enzyme-to-json";
-import { act } from "react-dom/test-utils";
-
-describe('Verify UploadToscaFile', () => {
-
- it("renders without crashing", () => {
- shallow(<UploadToscaFile/>);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<UploadToscaFile/>);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have a Button element', () => {
- const container = shallow(<UploadToscaFile/>)
- expect(container.find('Button').length).toEqual(1);
- });
-
- it('button should call postServiceTemplateHandler when clicked', async () => {
- const component = mount(<UploadToscaFile/>)
- const logSpy = jest.spyOn(console, 'log');
- const event = {
- preventDefault() {
- }
- };
-
- await act(() => {
- component.find('[variant="primary"]').get(0).props.onClick(event);
- expect(logSpy).toHaveBeenCalledWith('postServiceTemplateHandler called');
- })
-
- });
-
- it('should have a Button element with specified text', () => {
- const container = shallow(<UploadToscaFile/>)
- expect(container.find('Button').text()).toBe('Upload Tosca Service Template');
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/AccordionHeader.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/AccordionHeader.test.js.snap
deleted file mode 100644
index da86eb7..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/AccordionHeader.test.js.snap
+++ /dev/null
@@ -1,211 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify AccordionHeader renders correctly 1`] = `
-<styled.div
- className="panel-header"
->
- <ForwardRef
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -417256348,
- "baseStyle": undefined,
- "componentId": "sc-hKFxyN",
- "isStatic": false,
- "rules": Array [
- "
- color: #000000;
- text-decoration: none;
-
- :hover, :active {
- color: #000000;
- text-decoration: none !important;
- }
-",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-hKFxyN",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "active": false,
- "disabled": false,
- "variant": "primary",
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- eventKey="0"
- variant="link"
- />
-</styled.div>
-`;
-
-exports[`Verify AccordionHeader renders correctly when orderState is passive 1`] = `
-<styled.div
- className="panel-header"
->
- <ForwardRef
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -417256348,
- "baseStyle": undefined,
- "componentId": "sc-hKFxyN",
- "isStatic": false,
- "rules": Array [
- "
- color: #000000;
- text-decoration: none;
-
- :hover, :active {
- color: #000000;
- text-decoration: none !important;
- }
-",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-hKFxyN",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "active": false,
- "disabled": false,
- "variant": "primary",
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- eventKey="0"
- variant="link"
- >
- PASSIVE_TEST
- </ForwardRef>
-</styled.div>
-`;
-
-exports[`Verify AccordionHeader renders correctly when orderState is running 1`] = `
-<styled.div
- className="panel-header"
->
- <ForwardRef
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -417256348,
- "baseStyle": undefined,
- "componentId": "sc-hKFxyN",
- "isStatic": false,
- "rules": Array [
- "
- color: #000000;
- text-decoration: none;
-
- :hover, :active {
- color: #000000;
- text-decoration: none !important;
- }
-",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-hKFxyN",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "active": false,
- "disabled": false,
- "variant": "primary",
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- eventKey="0"
- variant="link"
- >
- RUNNING_TEST
- </ForwardRef>
-</styled.div>
-`;
-
-exports[`Verify AccordionHeader renders correctly when orderState is uninitialized 1`] = `
-<styled.div
- className="panel-header"
->
- <ForwardRef
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -417256348,
- "baseStyle": undefined,
- "componentId": "sc-hKFxyN",
- "isStatic": false,
- "rules": Array [
- "
- color: #000000;
- text-decoration: none;
-
- :hover, :active {
- color: #000000;
- text-decoration: none !important;
- }
-",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-hKFxyN",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "active": false,
- "disabled": false,
- "variant": "primary",
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- eventKey="0"
- variant="link"
- >
- UNINITIALISED_TEST
- </ForwardRef>
-</styled.div>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ChangeOrderStateModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ChangeOrderStateModal.test.js.snap
deleted file mode 100644
index 478b886..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ChangeOrderStateModal.test.js.snap
+++ /dev/null
@@ -1,114 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify ChangeOrderStateModal renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="sm"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Manage Instantiation
- </ModalTitle>
- </ModalHeader>
- <div
- style={
- Object {
- "padding": "5px 5px 0 5px",
- }
- }
- >
- <ModalBody>
- <Container
- fluid={false}
- >
- <Dropdown
- navbar={false}
- onSelect={[Function]}
- >
- <DropdownToggle
- id="dropdown-basic"
- variant="dark"
- >
- Select Order State
- </DropdownToggle>
- <DropdownMenu
- align="left"
- alignRight={false}
- flip={true}
- >
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- }
- }
- disabled={false}
- eventKey="UNINITIALISED"
- >
- UNINITIALISED
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- }
- }
- disabled={false}
- eventKey="PASSIVE"
- >
- PASSIVE
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- }
- }
- disabled={false}
- eventKey="RUNNING"
- >
- RUNNING
- </DropdownItem>
- </DropdownMenu>
- </Dropdown>
- </Container>
- <Styled(Alert)
- show={false}
- variant="danger"
- >
- Can't get instantiation ordered state:
- <br />
- {}
- </Styled(Alert)>
- </ModalBody>
- <styled.div />
- </div>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="primary"
- >
- Save
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/CommissioningModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/CommissioningModal.test.js.snap
deleted file mode 100644
index 4ff976a..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/CommissioningModal.test.js.snap
+++ /dev/null
@@ -1,77 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify CommissioningModal renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Change ACM Common Properties
- </ModalTitle>
- </ModalHeader>
- <br />
- <div
- style={
- Object {
- "padding": "5px 5px 0px 5px",
- }
- }
- >
- <ModalBody>
- <div
- id="editor"
- />
- <Styled(Alert)
- show={false}
- variant="danger"
- >
- Can't get service template:
- <br />
- {}
- </Styled(Alert)>
- <Styled(Alert)
- show={false}
- variant="danger"
- >
- Can't get common properties:
- <br />
- {}
- </Styled(Alert)>
- </ModalBody>
- </div>
- <styled.div />
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="primary"
- >
- Save
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="success mr-auto"
- >
- Commission
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/DeleteToscaTemplate.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/DeleteToscaTemplate.test.js.snap
deleted file mode 100644
index cd2288e..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/DeleteToscaTemplate.test.js.snap
+++ /dev/null
@@ -1,20 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify DeleteToscaTemplate renders correctly 1`] = `
-<Fragment>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- style={
- Object {
- "float": "right",
- }
- }
- type="submit"
- variant="danger"
- >
- Delete Tosca Service Template
- </Button>
-</Fragment>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetLocalToscaFileForUpload.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetLocalToscaFileForUpload.test.js.snap
deleted file mode 100644
index 84168fd..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetLocalToscaFileForUpload.test.js.snap
+++ /dev/null
@@ -1,103 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify GetLocalToscaFileForUpload renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="lg"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Upload Tosca to Commissioning API
- </ModalTitle>
- </ModalHeader>
- <br />
- <div
- style={
- Object {
- "padding": "5px 5px 0px 5px",
- }
- }
- >
- <ModalBody>
- <Form
- inline={false}
- style={
- Object {
- "paddingTop": "20px",
- }
- }
- >
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- >
- <FormFile
- accept=".yaml,.yml,.json"
- className="custom-file-label"
- custom={true}
- id="inputGroupFile01"
- label="Please select a file"
- onChange={[Function]}
- type="file"
- />
- <FormText>
- Only .yaml, .yml and .json files are supported
- </FormText>
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- >
- <UploadToscaFile
- onResponseReceived={[Function]}
- toscaObject={Object {}}
- />
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- >
- <styled.div />
- </FormGroup>
- </Form>
- </ModalBody>
- </div>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetToscaTemplate.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetToscaTemplate.test.js.snap
deleted file mode 100644
index 873afa7..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetToscaTemplate.test.js.snap
+++ /dev/null
@@ -1,15 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify GetToscaTemplate renders correctly 1`] = `
-<Fragment>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="submit"
- variant="primary"
- >
- Pull Tosca Service Template
- </Button>
-</Fragment>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstancePropertiesModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstancePropertiesModal.test.js.snap
deleted file mode 100644
index 4791083..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstancePropertiesModal.test.js.snap
+++ /dev/null
@@ -1,105 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify InstancePropertiesModal renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Create
- Tosca Instance Properties
- </ModalTitle>
- </ModalHeader>
- <div
- style={
- Object {
- "padding": "5px 5px 0 5px",
- }
- }
- >
- <ModalBody>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formPlaintextEmail"
- >
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
- Instance Name:
- </FormLabel>
- <input
- onChange={[Function]}
- sm="5"
- style={
- Object {
- "width": "50%",
- }
- }
- type="text"
- value=""
- />
- </FormGroup>
- <div
- id="editor"
- />
- <Styled(Alert)
- show={false}
- variant="danger"
- >
- Can't get service template:
- <br />
- {}
- </Styled(Alert)>
- <Styled(Alert)
- show={false}
- variant="danger"
- >
- Can't get instance properties:
- <br />
- {}
- </Styled(Alert)>
- </ModalBody>
- <styled.div />
- </div>
- <ModalFooter>
- <Button
- active={false}
- disabled={true}
- onClick={[Function]}
- style={
- Object {
- "cursor": "not-allowed",
- }
- }
- variant="primary"
- >
- Save
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElementItem.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElementItem.test.js.snap
deleted file mode 100644
index 81f5f26..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElementItem.test.js.snap
+++ /dev/null
@@ -1,9 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify InstantiationElementItem renders correctly 1`] = `<Fragment />`;
-
-exports[`Verify InstantiationElementItem renders correctly when orderState is passive 1`] = `<Fragment />`;
-
-exports[`Verify InstantiationElementItem renders correctly when orderState is running 1`] = `<Fragment />`;
-
-exports[`Verify InstantiationElementItem renders correctly when orderState is uninitialized 1`] = `<Fragment />`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElements.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElements.test.js.snap
deleted file mode 100644
index 8fa928e..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElements.test.js.snap
+++ /dev/null
@@ -1,3 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify InstantiationElements renders correctly 1`] = `<Fragment />`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationItem.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationItem.test.js.snap
deleted file mode 100644
index a3a230a..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationItem.test.js.snap
+++ /dev/null
@@ -1,26 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify InstantiationItem renders correctly 1`] = `
-<Accordion>
- <styled.div>
- <AccordionHeader
- index={
- Object {
- "index": 0,
- }
- }
- key="[object Object]"
- title={
- Object {
- "title": "PMSH Instance",
- }
- }
- />
- <AccordionCollapse
- eventKey="[object Object]"
- >
- <Styled(CardBody) />
- </AccordionCollapse>
- </styled.div>
-</Accordion>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationManagementModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationManagementModal.test.js.snap
deleted file mode 100644
index b800f52..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationManagementModal.test.js.snap
+++ /dev/null
@@ -1,155 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify Instantiation Management renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Manage Instances
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <Container
- fluid={false}
- >
- <Row
- noGutters={false}
- >
- <Link
- to={
- Object {
- "pathname": "/editACMInstanceProperties",
- }
- }
- >
- <Button
- active={false}
- disabled={false}
- type="null"
- variant="primary"
- >
- Create Instance
- </Button>
- </Link>
- <styled.div />
- <Link
- to={
- Object {
- "pathname": "/monitorInstantiation",
- }
- }
- >
- <Button
- active={false}
- disabled={false}
- type="null"
- variant="secondary"
- >
- Monitor Instantiations
- </Button>
- </Link>
- </Row>
- </Container>
- <ForwardRef
- bordered={true}
- style={
- Object {
- "marginTop": "10px",
- }
- }
- >
- <thead>
- <tr>
- <th>
- #
- </th>
- <th
- style={
- Object {
- "textAlign": "center",
- }
- }
- >
- Instantiation Name
- </th>
- <th
- style={
- Object {
- "textAlign": "center",
- }
- }
- >
- Edit Instantiation
- </th>
- <th
- style={
- Object {
- "textAlign": "center",
- }
- }
- >
- Delete Instantiation
- </th>
- <th
- style={
- Object {
- "textAlign": "center",
- }
- }
- >
- Change Order State
- </th>
- <th
- style={
- Object {
- "textAlign": "center",
- }
- }
- >
- Instantiation Order State
- </th>
- <th
- style={
- Object {
- "textAlign": "center",
- }
- }
- >
- Instantiation Current State
- </th>
- </tr>
- </thead>
- <tbody />
- </ForwardRef>
- <styled.div />
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Clear Error Message
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap
deleted file mode 100644
index bbf92ca..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap
+++ /dev/null
@@ -1,27 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify InstantiationOrderStateChangeItem renders correctly 1`] = `<Fragment />`;
-
-exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is passive 1`] = `
-<Fragment>
- <styled.div>
- PASSIVE_TEST
- </styled.div>
-</Fragment>
-`;
-
-exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is running 1`] = `
-<Fragment>
- <styled.div>
- RUNNING_TEST
- </styled.div>
-</Fragment>
-`;
-
-exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is uninitialized 1`] = `
-<Fragment>
- <styled.div>
- UNINITIALISED_TEST
- </styled.div>
-</Fragment>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/MonitorInstantiation.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/MonitorInstantiation.test.js.snap
deleted file mode 100644
index 2b07252..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/MonitorInstantiation.test.js.snap
+++ /dev/null
@@ -1,41 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify MonitorInstantiation renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Tosca Instantiation - Monitoring
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <Styled(Alert)
- show={false}
- variant="danger"
- >
- Can't get acm instantiation info:
- <br />
- {}
- </Styled(Alert)>
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ReadAndConvertYaml.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ReadAndConvertYaml.test.js.snap
deleted file mode 100644
index 76739f3..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ReadAndConvertYaml.test.js.snap
+++ /dev/null
@@ -1,63 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify ReadAndConvertYaml renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- View Tosca Template
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <GetToscaTemplate
- onGetToscaServiceTemplate={[Function]}
- templateName="ToscaServiceTemplateSimple"
- templateVersion="1.0.0"
- />
- <styled.pre>
-
-
- </styled.pre>
- <Styled(Alert)
- show={false}
- variant="danger"
- />
- <Styled(Alert)
- show={false}
- variant="danger"
- >
- null
- </Styled(Alert)>
- <Styled(Alert)
- show={false}
- variant="success"
- >
- <h2>
- Delete Successful
- </h2>
- <styled.pre>
- null
- </styled.pre>
- </Styled(Alert)>
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/UploadToscaFile.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/UploadToscaFile.test.js.snap
deleted file mode 100644
index a1ae439..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/UploadToscaFile.test.js.snap
+++ /dev/null
@@ -1,16 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify UploadToscaFile renders correctly 1`] = `
-<Fragment>
- <Button
- active={false}
- block={true}
- disabled={false}
- onClick={[Function]}
- type="submit"
- variant="primary"
- >
- Upload Tosca Service Template
- </Button>
-</Fragment>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/acmList.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/acmList.json
deleted file mode 100644
index f854d90..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/acmList.json
+++ /dev/null
@@ -1,59 +0,0 @@
-{
- "automationCompositionList": [
- {
- "name": "PMSHInstance0",
- "version": "1.0.1",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
- "version": "1.2.3"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 0",
- "elements": {
- "709c62b3-8918-41b9-a747-d21eb79c6c20": {
- "id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
- "version": "1.2.3"
- },
- "participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
- },
- "709c62b3-8918-41b9-a747-d21eb79c6c21": {
- "id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
- },
- "709c62b3-8918-41b9-a747-d21eb79c6c22": {
- "id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
- }
- }
- }
- ]
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/commonProps.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/commonProps.json
deleted file mode 100644
index 71f98f8..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/commonProps.json
+++ /dev/null
@@ -1,1444 +0,0 @@
-{
- "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the http requests of PMSH microservice",
- "type": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "typeVersion": "1.0.1",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "version": "1.0.1"
- },
- "key": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the operational policy for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the K8S microservice for local chart",
- "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the monitoring policy for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.sample.GenericK8s_ControlLoopDefinition": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop for Hello World",
- "type": "org.onap.policy.clamp.controlloop.ControlLoop",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "elements": {
- "name": "elements",
- "type": "list",
- "typeVersion": "0.0.0",
- "description": "Specifies a list of control loop element definitions that make up this control loop definition",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": {
- "name": null,
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "constraints": null
- },
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.ControlLoop",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the K8S microservice for PMSH",
- "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.pmsh.DerivedPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "definedVersion": "1.2.3"
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/fullTemplate.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/fullTemplate.json
deleted file mode 100644
index 8b77554..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/fullTemplate.json
+++ /dev/null
@@ -1,2194 +0,0 @@
-{
- "policy_types": {
- "onap.policies.Monitoring": {
- "name": "onap.policies.Monitoring",
- "version": "1.0.0",
- "derived_from": "tosca.policies.Root",
- "metadata": {},
- "description": "a base policy type for all policies that govern monitoring provisioning",
- "properties": {},
- "key": {
- "name": "onap.policies.Monitoring",
- "version": "1.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.policies.Monitoring",
- "defined_version": "1.0.0"
- },
- "onap.policies.Sirisha": {
- "name": "onap.policies.Sirisha",
- "version": "1.0.0",
- "derived_from": "tosca.policies.Root",
- "metadata": {},
- "description": "a base policy type for all policies that govern monitoring provisioning",
- "properties": {},
- "key": {
- "name": "onap.policies.Sirisha",
- "version": "1.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.policies.Sirisha",
- "defined_version": "1.0.0"
- },
- "onap.policies.controlloop.operational.Common": {
- "name": "onap.policies.controlloop.operational.Common",
- "version": "1.0.0",
- "derived_from": "tosca.policies.Root",
- "metadata": {},
- "description": "Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\nPolicy Types. This does NOT support the legacy Policy YAML policy type.\n",
- "properties": {
- "abatement": {
- "name": "abatement",
- "type": "boolean",
- "type_version": "0.0.0",
- "description": "Whether an abatement event message will be expected for the control loop from DCAE.",
- "default_value": false,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "operations": {
- "name": "operations",
- "type": "list",
- "type_version": "0.0.0",
- "description": "List of operations to be performed when Control Loop is triggered.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatype.controlloop.Operation",
- "type_version": "0.0.0",
- "description": null,
- "constraints": null
- },
- "metadata": null
- },
- "trigger": {
- "name": "trigger",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Initial operation to execute upon receiving an Onset event message for the Control Loop.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "timeout": {
- "name": "timeout",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "Overall timeout for executing all the operations. This timeout should equal or exceed the total\ntimeout for each operation listed.\n",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "id": {
- "name": "id",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The unique control loop id.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "key": {
- "name": "onap.policies.controlloop.operational.Common",
- "version": "1.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.policies.controlloop.operational.Common",
- "defined_version": "1.0.0"
- },
- "onap.policies.controlloop.operational.common.Apex": {
- "name": "onap.policies.controlloop.operational.common.Apex",
- "version": "1.0.0",
- "derived_from": "onap.policies.controlloop.operational.Common",
- "metadata": {},
- "description": "Operational policies for Apex PDP",
- "properties": {
- "engineServiceParameters": {
- "name": "engineServiceParameters",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The engine parameters like name, instanceCount, policy implementation, parameters etc.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "eventOutputParameters": {
- "name": "eventOutputParameters",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The event output parameters.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "javaProperties": {
- "name": "javaProperties",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Name/value pairs of properties to be set for APEX if needed.",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "eventInputParameters": {
- "name": "eventInputParameters",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The event input parameters.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "key": {
- "name": "onap.policies.controlloop.operational.common.Apex",
- "version": "1.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.policies.controlloop.operational.common.Apex",
- "defined_version": "1.0.0"
- },
- "onap.policies.monitoring.dcae-pm-subscription-handler": {
- "name": "onap.policies.monitoring.dcae-pm-subscription-handler",
- "version": "1.0.0",
- "derived_from": "onap.policies.Monitoring",
- "metadata": {},
- "description": null,
- "properties": {
- "pmsh_policy": {
- "name": "pmsh_policy",
- "type": "onap.datatypes.monitoring.subscription",
- "type_version": "0.0.0",
- "description": "PMSH Policy JSON",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {}
- }
- },
- "key": {
- "name": "onap.policies.monitoring.dcae-pm-subscription-handler",
- "version": "1.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.policies.monitoring.dcae-pm-subscription-handler",
- "defined_version": "1.0.0"
- }
- },
- "node_types": {
- "org.onap.policy.clamp.controlloop.CDSControlLoopElement": {
- "name": "org.onap.policy.clamp.controlloop.CDSControlLoopElement",
- "version": "1.0.1",
- "derived_from": "org.onap.policy.clamp.controlloop.ControlLoopElement",
- "metadata": {},
- "description": null,
- "properties": {
- "cds_blueprint_id": {
- "name": "cds_blueprint_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.CDSControlLoopElement",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.CDSControlLoopElement",
- "defined_version": "1.0.1"
- },
- "org.onap.policy.clamp.controlloop.ControlLoop": {
- "name": "org.onap.policy.clamp.controlloop.ControlLoop",
- "version": "1.0.1",
- "derived_from": "tosca.nodetypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "elements": {
- "name": "elements",
- "type": "list",
- "type_version": "0.0.0",
- "description": "Specifies a list of control loop element definitions that make up this control loop definition",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "constraints": null
- },
- "metadata": {
- "common": "true"
- }
- },
- "provider": {
- "name": "provider",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.ControlLoop",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.ControlLoop",
- "defined_version": "1.0.1"
- },
- "org.onap.policy.clamp.controlloop.ControlLoopElement": {
- "name": "org.onap.policy.clamp.controlloop.ControlLoopElement",
- "version": "1.0.1",
- "derived_from": "tosca.nodetypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "default_value": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "valid_values": null,
- "equal": null,
- "greater_than": null,
- "greater_or_equal": "0",
- "less_than": null,
- "less_or_equal": null,
- "range_values": null
- }
- ],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- },
- "provider": {
- "name": "provider",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "valid_values": null,
- "equal": null,
- "greater_than": null,
- "greater_or_equal": "0",
- "less_than": null,
- "less_or_equal": null,
- "range_values": null
- }
- ],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "default_value": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "valid_values": null,
- "equal": null,
- "greater_than": null,
- "greater_or_equal": "0",
- "less_than": null,
- "less_or_equal": null,
- "range_values": null
- }
- ],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "default_value": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "valid_values": null,
- "equal": null,
- "greater_than": null,
- "greater_or_equal": "0",
- "less_than": null,
- "less_or_equal": null,
- "range_values": null
- }
- ],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "default_value": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "valid_values": null,
- "equal": null,
- "greater_than": null,
- "greater_or_equal": "0",
- "less_than": null,
- "less_or_equal": null,
- "range_values": null
- }
- ],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "common": "true"
- }
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.ControlLoopElement",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.ControlLoopElement",
- "defined_version": "1.0.1"
- },
- "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement": {
- "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "version": "1.0.1",
- "derived_from": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "metadata": {},
- "description": null,
- "properties": {
- "policy_id": {
- "name": "policy_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "policy_type_id": {
- "name": "policy_type_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "defined_version": "1.0.1"
- },
- "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement": {
- "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "version": "1.0.1",
- "derived_from": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "metadata": {},
- "description": null,
- "properties": {
- "policy_id": {
- "name": "policy_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "policy_type_id": {
- "name": "policy_type_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "defined_version": "1.0.1"
- },
- "org.onap.policy.clamp.controlloop.HttpControlLoopElement": {
- "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "version": "1.0.1",
- "derived_from": "org.onap.policy.clamp.controlloop.ControlLoopElement",
- "metadata": {},
- "description": null,
- "properties": {
- "httpHeaders": {
- "name": "httpHeaders",
- "type": "map",
- "type_version": "0.0.0",
- "description": "HTTP headers to send on REST requests",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "constraints": null
- },
- "metadata": null
- },
- "baseUrl": {
- "name": "baseUrl",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The base URL to be prepended to each path, identifies the host for the REST endpoints.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "configurationEntities": {
- "name": "configurationEntities",
- "type": "map",
- "type_version": "0.0.0",
- "description": "The connfiguration entities the Control Loop Element is managing and their associated REST requests",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity",
- "type_version": "0.0.0",
- "description": null,
- "constraints": null
- },
- "metadata": null
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "defined_version": "1.0.1"
- },
- "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement": {
- "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "version": "1.0.1",
- "derived_from": "org.onap.policy.clamp.controlloop.ControlLoopElement",
- "metadata": {},
- "description": null,
- "properties": {
- "values": {
- "name": "values",
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "templates": {
- "name": "templates",
- "type": "list",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "chart": {
- "name": "chart",
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "requirements": {
- "name": "requirements",
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "configs": {
- "name": "configs",
- "type": "list",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "defined_version": "1.0.1"
- },
- "org.onap.policy.clamp.controlloop.Participant": {
- "name": "org.onap.policy.clamp.controlloop.Participant",
- "version": "1.0.1",
- "derived_from": "tosca.nodetypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.Participant",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.Participant",
- "defined_version": "1.0.1"
- },
- "org.onap.policy.clamp.controlloop.PolicyControlLoopElement": {
- "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "version": "1.0.1",
- "derived_from": "org.onap.policy.clamp.controlloop.ControlLoopElement",
- "metadata": {},
- "description": null,
- "properties": {
- "policy_id": {
- "name": "policy_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "policy_type_id": {
- "name": "policy_type_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "requirements": null,
- "key": {
- "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "version": "1.0.1"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "defined_version": "1.0.1"
- }
- },
- "topology_template": {
- "description": null,
- "inputs": {
- "pmsh_operational_policy": {
- "name": "pmsh_operational_policy",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "value": null
- },
- "pmsh_monitoring_policy": {
- "name": "pmsh_monitoring_policy",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "value": null
- }
- },
- "node_templates": {
- "org.onap.controlloop.HttpControlLoopParticipant": {
- "name": "org.onap.controlloop.HttpControlLoopParticipant",
- "version": "2.3.4",
- "derived_from": null,
- "metadata": {},
- "description": "Participant for Http requests",
- "type": "org.onap.policy.clamp.controlloop.Participant",
- "type_version": "1.0.1",
- "properties": {
- "provider": "ONAP"
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.controlloop.HttpControlLoopParticipant",
- "version": "2.3.4"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.Participant",
- "version": "1.0.1"
- },
- "key": {
- "name": "org.onap.controlloop.HttpControlLoopParticipant",
- "version": "2.3.4"
- },
- "defined_name": "org.onap.controlloop.HttpControlLoopParticipant",
- "defined_version": "2.3.4"
- },
- "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derived_from": null,
- "metadata": {},
- "description": "Control loop element for the http requests of PMSH microservice",
- "type": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "type_version": "1.0.1",
- "properties": {
- "participantType": {
- "name": "org.onap.k8s.controlloop.HttpControlLoopParticipant",
- "version": "2.3.4"
- },
- "configurationEntities": [
- {
- "configurationEntityId": {
- "name": "entity1",
- "version": "1.0.1"
- },
- "restSequence": [
- {
- "restRequestId": {
- "name": "request1",
- "version": "1.0.1"
- },
- "httpMethod": "PUT",
- "path": "v1/kv/dcae-pmsh2",
- "body": "{ \"control_loop_name\":\"pmsh-control-loop\", \"operational_policy_name\":\"pmsh-operational-policy\", \"aaf_password\":\"demo123456!\", \"aaf_identity\":\"dcae@dcae.onap.org\", \"cert_path\":\"/opt/app/pmsh/etc/certs/cert.pem\", \"key_path\":\"/opt/app/pmsh/etc/certs/key.pem\", \"ca_cert_path\":\"/opt/app/pmsh/etc/certs/cacert.pem\", \"enable_tls\":\"true\", \"pmsh_policy\":{ \"subscription\":{ \"subscriptionName\":\"ExtraPM-All-gNB-R2B\", \"administrativeState\":\"UNLOCKED\", \"fileBasedGP\":15, \"fileLocation\":\"\/pm\/pm.xml\", \"nfFilter\":{ \"nfNames\":[ \"^pnf.*\", \"^vnf.*\" ], \"modelInvariantIDs\":[ ], \"modelVersionIDs\":[ ], \"modelNames\":[ ] }, \"measurementGroups\":[ { \"measurementGroup\":{ \"measurementTypes\":[ { \"measurementType\":\"countera\" }, { \"measurementType\":\"counterb\" } ], \"managedObjectDNsBasic\":[ { \"DN\":\"dna\" }, { \"DN\":\"dnb\" } ] } }, { \"measurementGroup\":{ \"measurementTypes\":[ { \"measurementType\":\"counterc\" }, { \"measurementType\":\"counterd\" } ], \"managedObjectDNsBasic\":[ { \"DN\":\"dnc\" }, { \"DN\":\"dnd\" } ] } } ] } }, \"streams_subscribes\":{ \"aai_subscriber\":{ \"type\":\"message_router\", \"dmaap_info\":{ \"topic_url\":\"https://10.152.183.151:3905/events/AAI_EVENT\", \"client_role\":\"org.onap.dcae.aaiSub\", \"location\":\"san-francisco\", \"client_id\":\"1575976809466\" } }, \"policy_pm_subscriber\":{ \"type\":\"message_router\", \"dmaap_info\":{ \"topic_url\":\"https://10.152.183.151:3905/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS\", \"client_role\":\"org.onap.dcae.pmSubscriber\", \"location\":\"san-francisco\", \"client_id\":\"1575876809456\" } } }, \"streams_publishes\":{ \"policy_pm_publisher\":{ \"type\":\"message_router\", \"dmaap_info\":{ \"topic_url\":\"https://10.152.183.151:3905/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS\", \"client_role\":\"org.onap.dcae.pmPublisher\", \"location\":\"san-francisco\", \"client_id\":\"1475976809466\" } }, \"other_publisher\":{ \"type\":\"message_router\", \"dmaap_info\":{ \"topic_url\":\"https://10.152.183.151:3905/events/org.onap.dmaap.mr.SOME_OTHER_TOPIC\", \"client_role\":\"org.onap.dcae.pmControlPub\", \"location\":\"san-francisco\", \"client_id\":\"1875976809466\" } } } }",
- "expectedResponse": 200
- }
- ]
- }
- ],
- "provider": "ONAP",
- "startPhase": 1,
- "uninitializedToPassiveTimeout": 180,
- "httpHeaders": {
- "Content-Type": "application/json"
- },
- "participant_id": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
- "baseUrl": "http://10.152.183.51:8500"
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "version": "1.0.1"
- },
- "key": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "defined_name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "defined_version": "1.2.3"
- },
- "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3",
- "derived_from": null,
- "metadata": {},
- "description": "Control loop element for the operational policy for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "type_version": "1.0.0",
- "properties": {
- "participant_id": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
- "policy_type_id": {
- "name": "onap.policies.operational.pm-subscription-handler",
- "version": "1.0.0"
- },
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "provider": "Ericsson",
- "policy_id": {
- "get_input": "pmsh_operational_policy"
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "defined_name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "defined_version": "1.2.3"
- },
- "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derived_from": null,
- "metadata": {},
- "description": "Control loop element for the K8S microservice for local chart",
- "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "type_version": "1.0.0",
- "properties": {
- "participant_id": {
- "name": "K8sParticipant0",
- "version": "1.0.0"
- },
- "provider": "ONAP",
- "chart": {
- "chartId": {
- "name": "nginx-ingress",
- "version": "0.9.1"
- },
- "releaseName": "nginxms",
- "namespace": "test"
- },
- "participantType": {
- "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
- "version": "2.3.4"
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "defined_name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "defined_version": "1.2.3"
- },
- "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3",
- "derived_from": null,
- "metadata": {},
- "description": "Control loop element for the monitoring policy for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "type_version": "1.0.0",
- "properties": {
- "participant_id": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
- "policy_type_id": {
- "name": "onap.policies.monitoring.pm-subscription-handler",
- "version": "1.0.0"
- },
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "provider": "Ericsson",
- "policy_id": {
- "get_input": "pmsh_monitoring_policy"
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "defined_name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "defined_version": "1.2.3"
- },
- "org.onap.k8s.controlloop.K8SControlLoopParticipant": {
- "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
- "version": "2.3.4",
- "derived_from": null,
- "metadata": {},
- "description": "Participant for K8S",
- "type": "org.onap.policy.clamp.controlloop.Participant",
- "type_version": "1.0.1",
- "properties": {
- "provider": "ONAP"
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
- "version": "2.3.4"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.Participant",
- "version": "1.0.1"
- },
- "key": {
- "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
- "version": "2.3.4"
- },
- "defined_name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
- "defined_version": "2.3.4"
- },
- "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3",
- "derived_from": null,
- "metadata": {},
- "description": "Control loop for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "type_version": "1.0.0",
- "properties": {
- "participant_id": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
- "provider": "Ericsson",
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "defined_name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "defined_version": "1.2.3"
- },
- "org.onap.domain.sample.GenericK8s_ControlLoopDefinition": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3",
- "derived_from": null,
- "metadata": {},
- "description": "Control loop for Hello World",
- "type": "org.onap.policy.clamp.controlloop.ControlLoop",
- "type_version": "1.0.0",
- "properties": {
- "elements": [
- {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- }
- ],
- "provider": "ONAP"
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.ControlLoop",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3"
- },
- "defined_name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "defined_version": "1.2.3"
- },
- "org.onap.policy.controlloop.PolicyControlLoopParticipant": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1",
- "derived_from": null,
- "metadata": {},
- "description": "Participant for DCAE microservices",
- "type": "org.onap.policy.clamp.controlloop.Participant",
- "type_version": "1.0.1",
- "properties": {
- "provider": "ONAP"
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.Participant",
- "version": "1.0.1"
- },
- "key": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "defined_name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "defined_version": "2.3.1"
- },
- "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derived_from": null,
- "metadata": {},
- "description": "Control loop element for the K8S microservice for PMSH",
- "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "type_version": "1.0.0",
- "properties": {
- "participant_id": {
- "name": "K8sParticipant0",
- "version": "1.0.0"
- },
- "provider": "ONAP",
- "chart": {
- "chartId": {
- "name": "dcae-pmsh",
- "version": "8.0.0"
- },
- "namespace": "onap",
- "releaseName": "pmshms",
- "repository": {
- "repoName": "chartmuseum",
- "protocol": "http",
- "address": "10.152.183.120",
- "port": 80,
- "userName": "onapinitializer",
- "password": "demo123456!"
- },
- "overrideParams": {
- "global.masterPassword": "test"
- }
- },
- "participantType": {
- "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
- "version": "2.3.4"
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "defined_name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "defined_version": "1.2.3"
- },
- "org.onap.domain.pmsh.DerivedPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3",
- "derived_from": null,
- "metadata": {},
- "description": "Control loop for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "type_version": "1.0.0",
- "properties": {
- "participant_id": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
- "provider": "Ericsson",
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "type_identifier": {
- "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "defined_name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "defined_version": "1.2.3"
- }
- },
- "policies": null,
- "policies_as_map": {}
- },
- "tosca_definitions_version": "tosca_simple_yaml_1_3",
- "data_types": {
- "onap.datatype.controlloop.Actor": {
- "name": "onap.datatype.controlloop.Actor",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": "An actor/operation/target definition",
- "properties": {
- "payload": {
- "name": "payload",
- "type": "map",
- "type_version": "0.0.0",
- "description": "Name/value pairs of payload information passed by Policy to the actor",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "constraints": null
- },
- "metadata": {
- "clamp_possible_values": "ClampExecution:CDS/payload"
- }
- },
- "target": {
- "name": "target",
- "type": "onap.datatype.controlloop.Target",
- "type_version": "0.0.0",
- "description": "The resource the operation should be performed on.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "actor": {
- "name": "actor",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The actor performing the operation.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "clamp_possible_values": "Dictionary:DefaultActors,ClampExecution:CDS/actor"
- }
- },
- "operation": {
- "name": "operation",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The operation the actor is performing.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": {
- "clamp_possible_values": "Dictionary:DefaultOperations,ClampExecution:CDS/operation"
- }
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatype.controlloop.Actor",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatype.controlloop.Actor",
- "defined_version": null
- },
- "onap.datatype.controlloop.Operation": {
- "name": "onap.datatype.controlloop.Operation",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": "An operation supported by an actor",
- "properties": {
- "failure_retries": {
- "name": "failure_retries",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Points to the operation to invoke when the current operation has exceeded its max retries.",
- "default_value": "final_failure_retries",
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "id": {
- "name": "id",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Unique identifier for the operation",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "failure_timeout": {
- "name": "failure_timeout",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Points to the operation to invoke when the time out for the operation occurs.",
- "default_value": "final_failure_timeout",
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "failure": {
- "name": "failure",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Points to the operation to invoke on Actor operation failure.",
- "default_value": "final_failure",
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "operation": {
- "name": "operation",
- "type": "onap.datatype.controlloop.Actor",
- "type_version": "0.0.0",
- "description": "The definition of the operation to be performed.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "failure_guard": {
- "name": "failure_guard",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.",
- "default_value": "final_failure_guard",
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "retries": {
- "name": "retries",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "The number of retries the actor should attempt to perform the operation.",
- "default_value": 0.0,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "timeout": {
- "name": "timeout",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "The amount of time for the actor to perform the operation.",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "failure_exception": {
- "name": "failure_exception",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Points to the operation to invoke when the current operation causes an exception.",
- "default_value": "final_failure_exception",
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "description": {
- "name": "description",
- "type": "string",
- "type_version": "0.0.0",
- "description": "A user-friendly description of the intent for the operation",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "success": {
- "name": "success",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.",
- "default_value": "final_success",
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatype.controlloop.Operation",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatype.controlloop.Operation",
- "defined_version": null
- },
- "onap.datatype.controlloop.Target": {
- "name": "onap.datatype.controlloop.Target",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": "Definition for a entity in A&AI to perform a control loop operation on",
- "properties": {
- "entityIds": {
- "name": "entityIds",
- "type": "map",
- "type_version": "0.0.0",
- "description": "Map of values that identify the resource. If none are provided, it is assumed that the\nentity that generated the ONSET event will be the target.\n",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "constraints": null
- },
- "metadata": {
- "clamp_possible_values": "ClampExecution:CSAR_RESOURCES"
- }
- },
- "targetType": {
- "name": "targetType",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Category for the target type",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [
- {
- "valid_values": [
- "VNF",
- "VM",
- "VFMODULE",
- "PNF"
- ],
- "equal": null,
- "greater_than": null,
- "greater_or_equal": null,
- "less_than": null,
- "less_or_equal": null,
- "range_values": null
- }
- ],
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatype.controlloop.Target",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatype.controlloop.Target",
- "defined_version": null
- },
- "onap.datatypes.ToscaConceptIdentifier": {
- "name": "onap.datatypes.ToscaConceptIdentifier",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "version": {
- "name": "version",
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "name": {
- "name": "name",
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.ToscaConceptIdentifier",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.ToscaConceptIdentifier",
- "defined_version": null
- },
- "onap.datatypes.monitoring.managedObjectDNsBasic": {
- "name": "onap.datatypes.monitoring.managedObjectDNsBasic",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "DN": {
- "name": "DN",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Managed object distinguished name",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {}
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.monitoring.managedObjectDNsBasic",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.monitoring.managedObjectDNsBasic",
- "defined_version": null
- },
- "onap.datatypes.monitoring.managedObjectDNsBasics": {
- "name": "onap.datatypes.monitoring.managedObjectDNsBasics",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "managedObjectDNsBasic": {
- "name": "managedObjectDNsBasic",
- "type": "map",
- "type_version": "0.0.0",
- "description": "Managed object distinguished name object",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatypes.monitoring.managedObjectDNsBasic",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.monitoring.managedObjectDNsBasics",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.monitoring.managedObjectDNsBasics",
- "defined_version": null
- },
- "onap.datatypes.monitoring.measurementGroup": {
- "name": "onap.datatypes.monitoring.measurementGroup",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "measurementTypes": {
- "name": "measurementTypes",
- "type": "list",
- "type_version": "0.0.0",
- "description": "List of measurement types",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatypes.monitoring.measurementTypes",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- },
- "managedObjectDNsBasic": {
- "name": "managedObjectDNsBasic",
- "type": "list",
- "type_version": "0.0.0",
- "description": "List of managed object distinguished names",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatypes.monitoring.managedObjectDNsBasics",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.monitoring.measurementGroup",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.monitoring.measurementGroup",
- "defined_version": null
- },
- "onap.datatypes.monitoring.measurementGroups": {
- "name": "onap.datatypes.monitoring.measurementGroups",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "measurementGroup": {
- "name": "measurementGroup",
- "type": "map",
- "type_version": "0.0.0",
- "description": "Measurement Group",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatypes.monitoring.measurementGroup",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.monitoring.measurementGroups",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.monitoring.measurementGroups",
- "defined_version": null
- },
- "onap.datatypes.monitoring.measurementType": {
- "name": "onap.datatypes.monitoring.measurementType",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "measurementType": {
- "name": "measurementType",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Measurement type",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {}
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.monitoring.measurementType",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.monitoring.measurementType",
- "defined_version": null
- },
- "onap.datatypes.monitoring.measurementTypes": {
- "name": "onap.datatypes.monitoring.measurementTypes",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "measurementType": {
- "name": "measurementType",
- "type": "map",
- "type_version": "0.0.0",
- "description": "Measurement type object",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatypes.monitoring.measurementType",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.monitoring.measurementTypes",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.monitoring.measurementTypes",
- "defined_version": null
- },
- "onap.datatypes.monitoring.nfFilter": {
- "name": "onap.datatypes.monitoring.nfFilter",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "modelVersionIDs": {
- "name": "modelVersionIDs",
- "type": "list",
- "type_version": "0.0.0",
- "description": "List of model version IDs",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- },
- "modelInvariantIDs": {
- "name": "modelInvariantIDs",
- "type": "list",
- "type_version": "0.0.0",
- "description": "List of model invariant IDs",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- },
- "modelNames": {
- "name": "modelNames",
- "type": "list",
- "type_version": "0.0.0",
- "description": "List of model names",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- },
- "nfNames": {
- "name": "nfNames",
- "type": "list",
- "type_version": "0.0.0",
- "description": "List of network functions",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "string",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.monitoring.nfFilter",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.monitoring.nfFilter",
- "defined_version": null
- },
- "onap.datatypes.monitoring.subscription": {
- "name": "onap.datatypes.monitoring.subscription",
- "version": "0.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "measurementGroups": {
- "name": "measurementGroups",
- "type": "list",
- "type_version": "0.0.0",
- "description": "Measurement Groups",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatypes.monitoring.measurementGroups",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- },
- "fileBasedGP": {
- "name": "fileBasedGP",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "File based granularity period",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {}
- },
- "fileLocation": {
- "name": "fileLocation",
- "type": "string",
- "type_version": "0.0.0",
- "description": "ROP file location",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {}
- },
- "subscriptionName": {
- "name": "subscriptionName",
- "type": "string",
- "type_version": "0.0.0",
- "description": "Name of the subscription",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {}
- },
- "administrativeState": {
- "name": "administrativeState",
- "type": "string",
- "type_version": "0.0.0",
- "description": "State of the subscription",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [
- {
- "valid_values": [
- "LOCKED",
- "UNLOCKED"
- ],
- "equal": null,
- "greater_than": null,
- "greater_or_equal": null,
- "less_than": null,
- "less_or_equal": null,
- "range_values": null
- }
- ],
- "key_schema": null,
- "entry_schema": null,
- "metadata": {}
- },
- "nfFilter": {
- "name": "nfFilter",
- "type": "map",
- "type_version": "0.0.0",
- "description": "Network function filter",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": {
- "name": null,
- "type": "onap.datatypes.monitoring.nfFilter",
- "type_version": "0.0.0",
- "description": null,
- "constraints": []
- },
- "metadata": {}
- }
- },
- "constraints": [],
- "key": {
- "name": "onap.datatypes.monitoring.subscription",
- "version": "0.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "onap.datatypes.monitoring.subscription",
- "defined_version": null
- },
- "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest": {
- "name": "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest",
- "version": "1.0.0",
- "derived_from": "tosca.datatypes.Root",
- "metadata": {},
- "description": null,
- "properties": {
- "body": {
- "name": "body",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The body of the REST request for PUT and POST requests",
- "default_value": null,
- "required": false,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "expectedResponse": {
- "name": "expectedResponse",
- "type": "integer",
- "type_version": "0.0.0",
- "description": "THe expected HTTP status code for the REST request",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [],
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "httpMethod": {
- "name": "httpMethod",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The REST method to use",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": [
- {
- "valid_values": [
- "POST",
- "PUT",
- "GET",
- "DELETE"
- ],
- "equal": null,
- "greater_than": null,
- "greater_or_equal": null,
- "less_than": null,
- "less_or_equal": null,
- "range_values": null
- }
- ],
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "restRequestId": {
- "name": "restRequestId",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "type_version": "0.0.0",
- "description": "The name and version of a REST request to be sent to a REST endpoint",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- },
- "path": {
- "name": "path",
- "type": "string",
- "type_version": "0.0.0",
- "description": "The path of the REST request relative to the base URL",
- "default_value": null,
- "required": true,
- "status": null,
- "constraints": null,
- "key_schema": null,
- "entry_schema": null,
- "metadata": null
- }
- },
- "constraints": [],
- "key": {
- "name": "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest",
- "version": "1.0.0"
- },
- "type": null,
- "type_version": null,
- "defined_name": "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest",
- "defined_version": "1.0.0"
- }
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/instanceProps.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/instanceProps.json
deleted file mode 100644
index b8250fd..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/instanceProps.json
+++ /dev/null
@@ -1,1444 +0,0 @@
-{
- "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the http requests of PMSH microservice",
- "type": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "typeVersion": "1.0.1",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
- "version": "1.0.1"
- },
- "key": {
- "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the operational policy for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the K8S microservice for local chart",
- "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the monitoring policy for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.sample.GenericK8s_ControlLoopDefinition": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop for Hello World",
- "type": "org.onap.policy.clamp.controlloop.ControlLoop",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "elements": {
- "name": "elements",
- "type": "list",
- "typeVersion": "0.0.0",
- "description": "Specifies a list of control loop element definitions that make up this control loop definition",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": {
- "name": null,
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "constraints": null
- },
- "metadata": {
- "common": "false"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.ControlLoop",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop element for the K8S microservice for PMSH",
- "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
- "definedVersion": "1.2.3"
- },
- "org.onap.domain.pmsh.DerivedPolicyControlLoopElement": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3",
- "derivedFrom": null,
- "metadata": {},
- "description": "Control loop for Performance Management Subscription Handling",
- "type": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "typeVersion": "1.0.0",
- "properties": {
- "provider": {
- "name": "provider",
- "type": "string",
- "typeVersion": "0.0.0",
- "description": "Specifies the organization that provides the control loop element",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToUninitializedTimeout": {
- "name": "passiveToUninitializedTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participant_id": {
- "name": "participant_id",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": null,
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "participantType": {
- "name": "participantType",
- "type": "onap.datatypes.ToscaConceptIdentifier",
- "typeVersion": "0.0.0",
- "description": "The identity of the participant type that hosts this type of Control Loop Element",
- "defaultValue": null,
- "required": true,
- "status": null,
- "constraints": null,
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "uninitializedToPassiveTimeout": {
- "name": "uninitializedToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "startPhase": {
- "name": "startPhase",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
- "defaultValue": null,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "runningToPassiveTimeout": {
- "name": "runningToPassiveTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from running to passive",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- },
- "passiveToRunningTimeout": {
- "name": "passiveToRunningTimeout",
- "type": "integer",
- "typeVersion": "0.0.0",
- "description": "The maximum time in seconds to wait for a state chage from passive to running",
- "defaultValue": 60.0,
- "required": false,
- "status": null,
- "constraints": [
- {
- "validValues": null,
- "equal": null,
- "greaterThan": null,
- "greaterOrEqual": "0",
- "lessThan": null,
- "lessOrEqual": null,
- "rangeValues": null
- }
- ],
- "keySchema": null,
- "entrySchema": null,
- "metadata": {
- "common": "false"
- }
- }
- },
- "requirements": null,
- "capabilities": null,
- "identifier": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "typeIdentifier": {
- "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
- "version": "1.0.0"
- },
- "key": {
- "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "definedName": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
- "definedVersion": "1.2.3"
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/jsonEditorData.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/jsonEditorData.json
deleted file mode 100644
index c09424f..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/jsonEditorData.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "__data": [
- "Object"
- ],
- "copyClipboard": null,
- "editors": [
- "Object"
- ],
- "element": "<div … />",
- "expandRefs": [
- "Function anonymous"
- ],
- "expandSchema": [
- "Function anonymous"
- ],
- "iconlib": [
- "n"
- ],
- "options": [
- "Object"
- ],
- "ready": true,
- "refs": [
- "Object"
- ],
- "root": [
- "o"
- ],
- "root_container": "<div … />",
- "schema": [
- "Object"
- ],
- "template": "undefined",
- "theme": [
- "o"
- ],
- "translate": [
- "Function translate"
- ],
- "translateProperty": [
- "Function translateProperty"
- ],
- "uuid": 0,
- "validation_results": [
- "Array"
- ],
- "validator": [
- "t"
- ]
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/orderedStateJson.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/orderedStateJson.json
deleted file mode 100644
index 1179fce..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/orderedStateJson.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "orderedState": "PASSIVE",
- "acmIdentifierList": [
- {
- "name": "PMSH_Instance1",
- "version": "2.3.1"
- }
- ]
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.js b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.js
deleted file mode 100644
index 2d98598..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import { JSONEditor } from "@json-editor/json-editor";
-import { Alert } from "react-bootstrap";
-import React from "react";
-
-const CommissioningUtils = {
- makeSchemaForCommonProperties: (commonProps) => {
- const commonPropsArr = Object.entries(commonProps)
-
- const newSchemaObject = {}
-
- newSchemaObject.title = "CommonProperties"
- newSchemaObject.type = "object"
- newSchemaObject.properties = {}
-
- commonPropsArr.forEach(([templateKey, template]) => {
-
- const propertiesObject = {}
- Object.entries(template.properties).forEach(([propKey, prop]) => {
-
- propertiesObject[propKey] = {
- type: CommissioningUtils.getType(prop.type)
- }
-
- })
- newSchemaObject.properties[templateKey] = {
- options: {
- "collapsed": true
- },
- properties: propertiesObject
- }
- })
-
- return newSchemaObject
- },
- getType: (propertyType) => {
- switch (propertyType)
- {
- case "string":
- return "string"
- case "integer":
- return "integer"
- case "list":
- return "array"
- case "object":
- return "object"
- default:
- return "object"
- }
- },
- createJsonEditor: (toscaModel, editorData) => {
- JSONEditor.defaults.options.collapse = false;
-
- return new JSONEditor(document.getElementById("editor"),
- {
- schema: toscaModel,
- startval: editorData,
- theme: 'bootstrap4',
- iconlib: 'fontawesome5',
- object_layout: 'normal',
- disable_properties: false,
- disable_edit_json: true,
- disable_array_reorder: true,
- disable_array_delete_last_row: true,
- disable_array_delete_all_rows: false,
- array_controls_top: true,
- keep_oneof_values: false,
- collapsed: false,
- show_errors: 'always',
- display_required_only: false,
- show_opt_in: false,
- prompt_before_delete: true,
- required_by_default: false,
- })
- },
- renderJsonEditor: async (template, commonProps) => {
-
- const fullTemplate = await template.json()
-
- let toscaInitialValues
- const allNodeTemplates = fullTemplate.topology_template.node_templates
- const shortenedNodeTemplatesObjectStartValues = {}
- // Get the common properties to construct a schema
- // Get valid start values at the same time
- const commonNodeTemplatesJson = await commonProps.json().then(data => {
- const nodeTemplatesArray = Object.entries(data)
- const shortenedNodeTemplatesObject = {}
- nodeTemplatesArray.forEach(([key, temp]) => {
- const currentNodeTemplate = allNodeTemplates[key]
- const propertiesObject = {
- properties: temp.properties
- }
-
- shortenedNodeTemplatesObject[key] = propertiesObject
-
- const propertiesStartValues = {}
-
- // Get all the existing start values to populate the properties in the schema
- Object.entries(propertiesObject.properties).forEach(([propKey, prop]) => {
- propertiesStartValues[propKey] = currentNodeTemplate.properties[propKey]
- })
-
- shortenedNodeTemplatesObjectStartValues[key] = propertiesStartValues
-
- })
-
- toscaInitialValues = shortenedNodeTemplatesObjectStartValues;
- return shortenedNodeTemplatesObject;
- })
-
- const propertySchema = CommissioningUtils.makeSchemaForCommonProperties(commonNodeTemplatesJson);
-
- const editorTemp = CommissioningUtils.createJsonEditor(propertySchema, shortenedNodeTemplatesObjectStartValues);
-
- return {
- fullTemplate: fullTemplate,
- propertySchema: propertySchema,
- editorTemp: editorTemp,
- toscaInitialValues: toscaInitialValues
- }
- },
- getAlertMessages: async (response) => {
- if (response.ok) {
- return(<Alert variant="success">
- <Alert.Heading>Commissioning Success</Alert.Heading>
- <p>Altered Template was Successfully Uploaded</p>
- <hr/>
- </Alert>);
- }
- else {
- return(<Alert variant="danger">
- <Alert.Heading>Commissioning Failure</Alert.Heading>
- <p>Updated Template Failed to Upload</p>
- <p>Status code: { await response.status }: { response.statusText }</p>
- <p>Response Text: { await response.text() }</p>
- <hr/>
- </Alert>);
- }
- },
-
- updateTemplate: async (userAddedCommonPropValues, fullToscaTemplate) => {
- const nodeTemplates = fullToscaTemplate.topology_template.node_templates
- const commonPropertyDataEntries = Object.entries(userAddedCommonPropValues)
-
- // This replaces the values for properties in the full tosca template
- // that will be sent up to the api with the entries the user provided.
- commonPropertyDataEntries.forEach(([templateKey, values]) => {
- Object.entries(values).forEach(([propKey, propVal]) => {
- nodeTemplates[templateKey].properties[propKey] = propVal
- })
- })
-
- fullToscaTemplate.topology_template.node_templates = nodeTemplates
-
- alert('Changes saved. Commission When Ready...')
- return fullToscaTemplate
- }
-}
-
-export default CommissioningUtils;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.test.js
deleted file mode 100644
index 8304ecb..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.test.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import commonProps from "../testFiles/commonProps.json";
-import fullTemp from "../testFiles/fullTemplate.json";
-import CommissioningUtils from "./CommissioningUtils";
-import React from "react";
-
-const commonProperties = JSON.parse(JSON.stringify(commonProps))
-const fullTemplate = JSON.parse(JSON.stringify(fullTemp))
-
-describe('Verify CommissioningUtils', () => {
-
- const fullTemplatePromise = {
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(fullTemplate)
- }
- }
-
- const commonPropertiesPromise = {
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(commonProperties)
- }
- }
-
- it('test renderJsonEditor output is correct', async () => {
- // Have to mock "editor" dom element for json editor to work in testing
- document.body.innerHTML = '<div id="editor"></div>';
-
- await expect((await CommissioningUtils.renderJsonEditor(fullTemplatePromise, commonPropertiesPromise)).editorTemp).toBeTruthy()
- await expect((await CommissioningUtils.renderJsonEditor(fullTemplatePromise, commonPropertiesPromise)).fullTemplate).toBeTruthy()
- await expect((await CommissioningUtils.renderJsonEditor(fullTemplatePromise, commonPropertiesPromise)).propertySchema).toBeTruthy()
- await expect((await CommissioningUtils.renderJsonEditor(fullTemplatePromise, commonPropertiesPromise)).toscaInitialValues).toBeTruthy()
- })
-
- it('test the getType method object type', () => {
- expect(CommissioningUtils.getType("object")).toBe("object")
- })
-
- it('test getAlertMessages with response ok', async () => {
- const response = {
- ok: true,
- status: 200,
- text: () => {
- return Promise.resolve("OK")
- },
- json: () => {
- return Promise.resolve("{}")
- }
- }
-
- await expect(JSON.stringify(await CommissioningUtils.getAlertMessages(response))).toContain("Commissioning Success")
- })
-
- it('test getAlertMessages with response not ok', async () => {
- const response = {
- ok: false,
- status: 200,
- text: () => {
- return Promise.resolve("Error")
- },
- json: () => {
- return Promise.resolve("{}")
- }
- }
-
- await expect(JSON.stringify(await CommissioningUtils.getAlertMessages(response))).toContain("Commissioning Failure")
- })
-
-
- }
-)
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.js b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.js
deleted file mode 100644
index 1e33edb..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.js
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- *
- *
- */
-
-import { JSONEditor } from "@json-editor/json-editor";
-
-const InstantiationUtils = {
-
- parseInstantiationList: (acmList) => {
- const parsedAcmList = [];
-
- acmList.map((instance, index) => {
-
- const acmObj = {
- index,
- name: instance['name'],
- version: instance['version'],
- orderedState: instance['orderedState'],
- currentState: instance['state'],
- disableDelete: instance['state'] !== 'UNINITIALISED',
- disableEdit: instance['state'] !== 'UNINITIALISED'
- }
-
- parsedAcmList.push(acmObj);
- });
-
- return parsedAcmList;
- },
-
- makeSchemaForInstanceProperties: (instanceProps) => {
- const instancePropsArray = Object.entries(instanceProps);
-
- const newSchemaObject = {};
-
- newSchemaObject.title = "InstanceProperties";
- newSchemaObject.type = "object";
- newSchemaObject.properties = {};
-
- instancePropsArray.forEach(([key, value]) => {
-
- const propertiesObject = {};
-
- Object.entries(value.properties).forEach(([pKey, pValue]) => {
- propertiesObject[pKey] = {
- type: InstantiationUtils.getType(pValue.type)
- }
- });
-
- newSchemaObject.properties[key] = {
- options: {
- "collapsed": true
- },
- properties: propertiesObject
- }
- });
-
- return newSchemaObject;
- },
-
- parseJsonSchema: async (template, instanceProperties) => {
- const fullTemplate = await template.json();
-
- const filteredInitialValues = {};
-
- const allInstanceProperties = await instanceProperties.json().then(properties => {
- const filteredTemplateObj = {};
- const propertiesTemplateArray = Object.entries(properties);
-
- propertiesTemplateArray.forEach(([key, value]) => {
- const propertiesObj = {
- properties: value.properties
- }
-
- const propValues = {};
- filteredTemplateObj[key] = propertiesObj;
-
- const jsonNodeSchemaKey = fullTemplate.topology_template.node_templates[key];
-
- Object.entries(propertiesObj.properties).forEach(([pKey, pValue]) => {
- propValues[pKey] = jsonNodeSchemaKey.properties[pKey];
- });
-
- filteredInitialValues[key] = propValues;
- });
-
- return filteredTemplateObj;
- });
-
- const propertySchema = InstantiationUtils.makeSchemaForInstanceProperties(allInstanceProperties);
-
- const jsonEditor = InstantiationUtils.createJsonEditor(propertySchema, filteredInitialValues);
-
- return {
- fullTemplate: fullTemplate,
- jsonEditor: jsonEditor
- }
- },
-
- getType: (pType) => {
- switch (pType) {
- case "map":
- return "string";
- case "string":
- return "string";
- case "integer":
- return "integer";
- case "list":
- return "array";
- case "object":
- return "object";
- default:
- return "object";
- }
- },
-
- createJsonEditor: (fullSchema, instanceProperties) => {
- JSONEditor.defaults.options.collapse = true;
-
- return new JSONEditor(document.getElementById("editor"),
- {
- schema: fullSchema,
- startval: instanceProperties,
- theme: 'bootstrap4',
- iconlib: 'fontawesome5',
- object_layout: 'normal',
- disable_properties: false,
- disable_edit_json: false,
- disable_array_reorder: true,
- disable_array_delete_last_row: true,
- disable_array_delete_all_rows: false,
- array_controls_top: true,
- keep_oneof_values: false,
- collapsed: true,
- show_errors: 'always',
- display_required_only: false,
- show_opt_in: false,
- prompt_before_delete: true,
- required_by_default: false,
- });
- },
-
- updateTemplate: (instanceName, jsonEditorValues, fullTemplate) => {
- const nodeTemplates = fullTemplate.topology_template.node_templates;
- const instanceDataProperties = Object.entries(jsonEditorValues);
-
- instanceDataProperties.forEach(([key, value]) => {
- const nodeTemplatesKey = nodeTemplates[key]
- Object.entries(value).forEach(([pKey, pValue]) => {
- nodeTemplatesKey.properties[pKey] = pValue
- });
- });
-
- fullTemplate.topology_template.node_templates = nodeTemplates;
- fullTemplate.name = instanceName;
-
- return fullTemplate;
- }
-}
-
-export default InstantiationUtils; \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.test.js
deleted file mode 100644
index 4077ff8..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.test.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import InstantiationUtils from "./InstantiationUtils";
-import instanceProps from "../testFiles/instanceProps.json";
-import fullTemp from "../testFiles/fullTemplate.json";
-
-const instanceProperties = JSON.parse(JSON.stringify(instanceProps))
-const fullTemplate = JSON.parse(JSON.stringify(fullTemp))
-
-describe('Verify InstantiationUtils', () => {
-
- const fullTemplatePromise = {
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(fullTemplate)
- }
- }
-
- const instancePropertiesPromise = {
- ok: true,
- status: 200,
- text: () => "OK",
- json: () => {
- return Promise.resolve(instanceProperties)
- }
- }
-
- it('test parseJsonSchema output is correct', async () => {
- // Have to mock "editor" dom element for json editor to work in testing
- document.body.innerHTML = '<div id="editor"></div>';
-
- await expect((await InstantiationUtils.parseJsonSchema(fullTemplatePromise, instancePropertiesPromise)).jsonEditor).toBeTruthy()
- await expect((await InstantiationUtils.parseJsonSchema(fullTemplatePromise, instancePropertiesPromise)).fullTemplate).toBeTruthy()
- })
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.js b/gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.js
deleted file mode 100644
index 690dcbb..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import Select from 'react-select';
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import Form from 'react-bootstrap/Form';
-import Row from 'react-bootstrap/Row';
-import Col from 'react-bootstrap/Col';
-import styled from 'styled-components';
-import LoopService from '../../../api/LoopService';
-import TemplateService from '../../../api/TemplateService';
-import LoopCache from '../../../api/LoopCache';
-import SvgGenerator from '../../loop_viewer/svg/SvgGenerator';
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-const ErrMsgStyled = styled.div`
- color: red;
-`
-
-export default class CreateLoopModal extends React.Component {
- constructor(props, context) {
- super(props, context);
-
- this.getAllLoopTemplates = this.getAllLoopTemplates.bind(this);
- this.handleCreate = this.handleCreate.bind(this);
- this.handleModelName = this.handleModelName.bind(this);
- this.handleClose = this.handleClose.bind(this);
- this.handleDropDownListChange = this.handleDropDownListChange.bind(this);
- this.renderSvg = this.renderSvg.bind(this);
- this.state = {
- show: true,
- chosenTemplateName: '',
- modelInputErrMsg: '',
- modelName: '',
- templateNames: [],
- fakeLoopCacheWithTemplate: new LoopCache({})
- };
- }
-
- async componentDidMount() {
- await this.getAllLoopTemplates();
- await this.getModelNames();
- }
-
- handleClose() {
- this.setState({ show: false });
- this.props.history.push('/');
- }
-
- handleDropDownListChange(e) {
- if (typeof e.value !== "undefined") {
- this.setState({
- fakeLoopCacheWithTemplate:
- new LoopCache({
- "loopTemplate": e.templateObject,
- "name": "fakeLoop"
- }),
- chosenTemplateName: e.value
- })
- } else {
- this.setState({ fakeLoopCacheWithTemplate: new LoopCache({}) })
- }
- }
-
- getAllLoopTemplates() {
- TemplateService.getAllLoopTemplates().then(templatesData => {
- const templateOptions = templatesData.map((templateData) => {
- return { label: templateData.name, value: templateData.name, templateObject: templateData }
- });
- this.setState({
- templateNames: templateOptions
- })
- });
- }
-
- getModelNames() {
- TemplateService.getLoopNames().then(loopNames => {
- if (!loopNames) {
- loopNames = [];
- }
- // Remove LOOP_ prefix
- let trimmedLoopNames = loopNames.map(str => str.replace('LOOP_', ''));
- this.setState({ modelNames: trimmedLoopNames });
- });
- }
-
- handleCreate() {
- if (!this.state.modelName) {
- alert("A model name is required");
- return;
- }
- console.debug("Create Model " + this.state.modelName + ", Template " + this.state.chosenTemplateName + " is chosen");
- this.setState({ show: false });
- LoopService.createLoop("LOOP_" + this.state.modelName, this.state.chosenTemplateName).then(text => {
- console.debug("CreateLoop response received: ", text);
- try {
- this.props.history.push('/');
- this.props.loadLoopFunction("LOOP_" + this.state.modelName);
- } catch (err) {
- alert(text);
- this.props.history.push('/');
- }
- })
- .catch(error => {
- console.debug("Create Loop failed");
- });
- }
-
- handleModelName(event) {
- if (this.state.modelNames.includes(event.target.value)) {
- this.setState({
- modelInputErrMsg: 'A model named "' + event.target.value + '" already exists. Please pick another name.',
- modelName: event.target.value
- });
- return;
- } else {
- this.setState({
- modelInputErrMsg: '',
- modelName: event.target.value
- });
- }
- }
-
- renderSvg() {
- return (
- <SvgGenerator loopCache={ this.state.fakeLoopCacheWithTemplate } clickable={ false } generatedFrom={ SvgGenerator.GENERATED_FROM_TEMPLATE }/>
- );
- }
-
- render() {
- return (
- <ModalStyled size="xl" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Create Model</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <Form.Group as={ Row } controlId="formPlaintextEmail">
- <Form.Label column sm="2">Template Name:</Form.Label>
- <Col sm="10">
- <Select onChange={ this.handleDropDownListChange } options={ this.state.templateNames }/>
- </Col>
- </Form.Group>
- <Form.Group as={ Row } style={ { alignItems: 'center' } } controlId="formSvgPreview">
- <Form.Label column sm="2">Model Preview:</Form.Label>
- <Col sm="10">
- { this.renderSvg() }
- </Col>
- </Form.Group>
- <Form.Group as={ Row } controlId="formPlaintextEmail">
- <Form.Label column sm="2">Model Name:</Form.Label>
- <input sm="5" type="text" style={ { width: '50%', marginLeft: '1em' } }
- value={ this.state.modelName }
- onChange={ this.handleModelName }
- />
- <span sm="5"/>
- </Form.Group>
- <Form.Group as={ Row } controlId="formPlaintextEmail">
- <Form.Label column sm="2"> </Form.Label>
- <ErrMsgStyled>{ this.state.modelInputErrMsg }</ErrMsgStyled>
- </Form.Group>
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ this.handleClose }>Cancel</Button>
- <Button variant="primary" type="submit" onClick={ this.handleCreate }>Create</Button>
- </Modal.Footer>
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js
deleted file mode 100644
index 3d94833..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import CreateLoopModal from './CreateLoopModal';
-import LoopService from '../../../api/LoopService';
-import TemplateService from '../../../api/TemplateService';
-
-let errorMessage = '';
-window.alert = jest.fn().mockImplementation((mesg) => {
- errorMessage = mesg;
- return
-});
-
-
-describe('Verify CreateLoopModal', () => {
-
- it('Test the render method', async () => {
- const flushPromises = () => new Promise(setImmediate);
- TemplateService.getAllLoopTemplates = jest.fn().mockImplementation(() => {
- return Promise.resolve([{ "name": "template1" }, { "name": "template2" }]);
- });
- TemplateService.getLoopNames = jest.fn().mockImplementation(() => {
- return Promise.resolve([]);
- });
-
- const component = shallow(<CreateLoopModal/>);
- expect(component).toMatchSnapshot();
- await flushPromises();
- component.update();
- expect(component.state('templateNames')).toStrictEqual([{ "label": "template1", "value": "template1", "templateObject": { "name": "template1" } }, {
- "label": "template2",
- "value": "template2",
- "templateObject": { "name": "template2" }
- }]);
- });
-
- it('handleDropdownListChange event', async () => {
- const flushPromises = () => new Promise(setImmediate);
-
- const component = shallow(<CreateLoopModal/>);
- component.find('StateManager').simulate('change', { value: 'template1', templateObject: { "name": "template1" } });
- await flushPromises();
- component.update();
- expect(component.state('chosenTemplateName')).toEqual("template1");
- expect(component.state('fakeLoopCacheWithTemplate').getLoopTemplate()['name']).toEqual("template1");
- expect(component.state('fakeLoopCacheWithTemplate').getLoopName()).toEqual("fakeLoop");
-
- component.find('StateManager').simulate('change', { value: 'template2', templateObject: { "name": "template2" } });
- await flushPromises();
- component.update();
- expect(component.state('chosenTemplateName')).toEqual("template2");
- expect(component.state('fakeLoopCacheWithTemplate').getLoopTemplate()['name']).toEqual("template2");
- expect(component.state('fakeLoopCacheWithTemplate').getLoopName()).toEqual("fakeLoop");
- });
-
- it('handleModelName event', async () => {
- const flushPromises = () => new Promise(setImmediate);
- TemplateService.getAllLoopTemplates = jest.fn().mockImplementation(() => {
- return Promise.resolve([{ "name": "template1" }, { "name": "template2" }]);
- });
- TemplateService.getLoopNames = jest.fn().mockImplementation(() => {
- return Promise.resolve([]);
- });
- const event = { target: { value: "model1" } };
- const component = shallow(<CreateLoopModal/>);
- await flushPromises();
- component.find('input').simulate('change', event);
- component.update();
- expect(component.state('modelName')).toEqual("model1");
- });
-
- it('Test handleClose', () => {
- const historyMock = { push: jest.fn() };
- const handleClose = jest.spyOn(CreateLoopModal.prototype, 'handleClose');
- const component = shallow(<CreateLoopModal history={ historyMock }/>)
-
- component.find('[variant="secondary"]').prop('onClick')();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
-
- handleClose.mockClear();
- });
-
- it('Test handleCreate Fail', () => {
- const handleCreate = jest.spyOn(CreateLoopModal.prototype, 'handleCreate');
- const component = shallow(<CreateLoopModal/>)
-
- component.find('[variant="primary"]').prop('onClick')();
-
- expect(handleCreate).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(true);
-
- handleCreate.mockClear();
- });
-
- it('Test handleCreate Suc', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const historyMock = { push: jest.fn() };
- const loadLoopFunction = jest.fn();
-
- LoopService.createLoop = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
-
- const handleCreate = jest.spyOn(CreateLoopModal.prototype, 'handleCreate');
- const component = shallow(<CreateLoopModal history={ historyMock } loadLoopFunction={ loadLoopFunction }/>)
- component.setState({
- modelName: "modelNameTest",
- chosenTemplateName: "template1"
- });
-
- component.find('[variant="primary"]').prop('onClick')();
- await flushPromises();
- component.update();
-
- expect(handleCreate).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
-
- handleCreate.mockClear();
- });
-
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js b/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
deleted file mode 100644
index 5fff586..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2019, 2021 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import LoopActionService from '../../../api/LoopActionService';
-import LoopService from '../../../api/LoopService';
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import Form from 'react-bootstrap/Form';
-import Tabs from 'react-bootstrap/Tabs';
-import Tab from 'react-bootstrap/Tab';
-import styled from 'styled-components';
-import Spinner from 'react-bootstrap/Spinner'
-
-const StyledSpinnerDiv = styled.div`
- justify-content: center !important;
- display: flex !important;
-`;
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-const FormStyled = styled(Form.Group)`
- padding: .25rem 1.5rem;
-`
-export default class DeployLoopModal extends React.Component {
-
-
- constructor(props, context) {
- super(props, context);
-
- this.handleSave = this.handleSave.bind(this);
- this.handleClose = this.handleClose.bind(this);
- this.handleChange = this.handleChange.bind(this);
- this.refreshStatus = this.refreshStatus.bind(this);
- this.renderDeployParam = this.renderDeployParam.bind(this);
- this.renderSpinner = this.renderSpinner.bind(this);
-
- const propertiesJson = JSON.parse(JSON.stringify(this.props.loopCache.getGlobalProperties()));
- this.state = {
- loopCache: this.props.loopCache,
- temporaryPropertiesJson: propertiesJson,
- show: true,
- key: this.getInitialKeyValue(propertiesJson)
- };
- }
-
- getInitialKeyValue(temporaryPropertiesJson) {
- const deployJsonList = temporaryPropertiesJson["dcaeDeployParameters"];
- return Object.keys(deployJsonList).find((obj) => Object.keys(deployJsonList).indexOf(obj) === 0);
- }
-
- componentWillReceiveProps(newProps) {
- this.setState({
- loopName: newProps.loopCache.getLoopName(),
- show: true
- });
- }
-
- handleClose() {
- this.setState({ show: false });
- this.props.history.push('/');
- }
-
- renderSpinner() {
- if (this.state.deploying) {
- return (
- <StyledSpinnerDiv>
- <Spinner animation="border" role="status">
- <span className="sr-only">Loading...</span>
- </Spinner>
- </StyledSpinnerDiv>
- );
- } else {
- return (<div></div>);
- }
- }
-
- handleSave() {
- const loopName = this.props.loopCache.getLoopName();
- // save the global propserties
- this.setState({ deploying: true });
- LoopService.updateGlobalProperties(loopName, this.state.temporaryPropertiesJson).then(resp => {
- LoopActionService.performAction(loopName, "deploy").then(pars => {
- this.props.showSucAlert("Action deploy successfully performed");
- // refresh status and update loop logs
- this.refreshStatus(loopName);
- })
- .catch(error => {
- this.props.showFailAlert("Action deploy failed");
- // refresh status and update loop logs
- this.refreshStatus(loopName);
- });
- });
- }
-
- refreshStatus(loopName) {
- LoopActionService.refreshStatus(loopName).then(data => {
- this.props.updateLoopFunction(data);
- this.setState({ show: false, deploying: false });
- this.props.history.push('/');
- })
- .catch(error => {
- this.props.showFailAlert("Refresh status failed");
- this.setState({ show: false, deploying: false });
- this.props.history.push('/');
- });
- }
-
- handleChange(event) {
- let deploymentParam = this.state.temporaryPropertiesJson["dcaeDeployParameters"];
- deploymentParam[this.state.key][event.target.name] = event.target.value;
-
- this.setState({ temporaryPropertiesJson: { dcaeDeployParameters: deploymentParam } });
- }
-
- renderDeployParamTabs() {
- if (typeof (this.state.temporaryPropertiesJson) === "undefined") {
- return "";
- }
-
- const deployJsonList = this.state.temporaryPropertiesJson["dcaeDeployParameters"];
- var indents = [];
- Object.keys(deployJsonList).forEach(item =>
- indents.push(<Tab key={ item } eventKey={ item } title={ item }>
- { this.renderDeployParam(deployJsonList[item]) }
- </Tab>)
- );
- return indents;
- }
-
- renderDeployParam(deployJson) {
- var indents = [];
- Object.keys(deployJson).forEach(item =>
- indents.push(<FormStyled key={ item }>
- <Form.Label>{ item }</Form.Label>
- <Form.Control type="text" name={ item } onChange={ this.handleChange } defaultValue={ deployJson[item] }></Form.Control>
- </FormStyled>));
- return indents;
- }
-
- render() {
- return (
- <ModalStyled size="lg" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Deployment parameters</Modal.Title>
- </Modal.Header>
- <Tabs id="controlled-tab-example" activeKey={ this.state.key } onSelect={ key => this.setState({ key }) }>
- { this.renderDeployParamTabs() }
- </Tabs>
- { this.renderSpinner() }
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ this.handleClose }>Cancel</Button>
- <Button variant="primary" type="submit" onClick={ this.handleSave }>Deploy</Button>
- </Modal.Footer>
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.test.js
deleted file mode 100644
index 0c68f23..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.test.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import DeployLoopModal from './DeployLoopModal';
-import LoopCache from '../../../api/LoopCache';
-import LoopActionService from '../../../api/LoopActionService';
-import LoopService from '../../../api/LoopService';
-
-describe('Verify DeployLoopModal', () => {
- const loopCache = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "globalPropertiesJson": {
- "dcaeDeployParameters": {
- "testMs": {
- "location_id": "",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- }
- }
- }
- });
-
- it('Test the render method', () => {
- const component = shallow(
- <DeployLoopModal loopCache={ loopCache }/>
- )
-
- expect(component).toMatchSnapshot();
- });
-
- it('Test handleClose', () => {
- const historyMock = { push: jest.fn() };
- const handleClose = jest.spyOn(DeployLoopModal.prototype, 'handleClose');
- const component = shallow(<DeployLoopModal history={ historyMock } loopCache={ loopCache }/>)
-
- component.find('[variant="secondary"]').prop('onClick')();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test handleSave successful', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const historyMock = { push: jest.fn() };
- const updateLoopFunction = jest.fn();
- const showSucAlert = jest.fn();
- const showFailAlert = jest.fn();
- const handleSave = jest.spyOn(DeployLoopModal.prototype, 'handleSave');
- LoopService.updateGlobalProperties = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK"
- });
- });
- LoopActionService.performAction = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
- LoopActionService.refreshStatus = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
-
- const component = shallow(<DeployLoopModal history={ historyMock }
- loopCache={ loopCache } updateLoopFunction={ updateLoopFunction } showSucAlert={ showSucAlert } showFailAlert={ showFailAlert }/>)
-
- component.find('[variant="primary"]').prop('onClick')();
- await flushPromises();
- component.update();
-
- expect(handleSave).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- handleSave.mockClear();
- });
-
- it('Onchange event', () => {
- const event = { target: { name: "location_id", value: "testLocation" } };
- const component = shallow(<DeployLoopModal loopCache={ loopCache }/>);
-
- component.find('[name="location_id"]').simulate('change', event);
- component.update();
- expect(component.state('temporaryPropertiesJson').dcaeDeployParameters.testMs.location_id).toEqual("testLocation");
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js b/gui-clamp/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js
deleted file mode 100644
index 6917713..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import Form from 'react-bootstrap/Form';
-import styled from 'styled-components';
-import LoopService from '../../../api/LoopService';
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-export default class LoopPropertiesModal extends React.Component {
-
- state = {
- show: true,
- loopCache: this.props.loopCache,
- temporaryPropertiesJson: JSON.parse(JSON.stringify(this.props.loopCache.getGlobalProperties()))
- };
-
- constructor(props, context) {
- super(props, context);
-
- this.handleClose = this.handleClose.bind(this);
- this.handleSave = this.handleSave.bind(this);
- this.handleChange = this.handleChange.bind(this);
-
- this.renderDcaeParameters = this.renderDcaeParameters.bind(this);
- this.renderAllParameters = this.renderAllParameters.bind(this);
- this.getDcaeParameters = this.getDcaeParameters.bind(this);
- this.readOnly = props.readOnly !== undefined ? props.readOnly : false;
- }
-
- componentWillReceiveProps(newProps) {
- this.setState({
- loopCache: newProps.loopCache,
- temporaryPropertiesJson: JSON.parse(JSON.stringify(newProps.loopCache.getGlobalProperties()))
- });
- }
-
- handleClose() {
- this.props.history.push('/');
- }
-
- handleSave(event) {
- LoopService.updateGlobalProperties(this.state.loopCache.getLoopName(), this.state.temporaryPropertiesJson).then(resp => {
- this.setState({ show: false });
- this.props.history.push('/');
- this.props.loadLoopFunction(this.state.loopCache.getLoopName());
- });
- }
-
- handleChange(event) {
- this.setState({ temporaryPropertiesJson: { [event.target.name]: JSON.parse(event.target.value) } });
- }
-
- renderAllParameters() {
- return (<Modal.Body>
- <Form>
- { this.renderDcaeParameters() }
- </Form>
- </Modal.Body>
- );
- }
-
- getDcaeParameters() {
- if (typeof (this.state.temporaryPropertiesJson) !== "undefined") {
- return JSON.stringify(this.state.temporaryPropertiesJson["dcaeDeployParameters"]);
- } else {
- return "";
- }
-
- }
-
- renderDcaeParameters() {
- return (
- <Form.Group>
- <Form.Label>Deploy Parameters</Form.Label>
- <Form.Control as="textarea" rows="3" name="dcaeDeployParameters" onChange={ this.handleChange } defaultValue={ this.getDcaeParameters() }></Form.Control>
- </Form.Group>
- );
- }
-
- render() {
- return (
- <ModalStyled size="lg" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Model Properties</Modal.Title>
- </Modal.Header>
- { this.renderAllParameters() }
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ this.handleClose }>Cancel</Button>
- <Button variant="primary" type="submit" disabled={ this.readOnly } onClick={ this.handleSave }>Save Changes</Button>
- </Modal.Footer>
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.test.js
deleted file mode 100644
index a9c5903..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.test.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import LoopPropertiesModal from './LoopPropertiesModal';
-import LoopCache from '../../../api/LoopCache';
-import LoopService from '../../../api/LoopService';
-
-describe('Verify LoopPropertiesModal', () => {
- const loopCache = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "globalPropertiesJson": {
- "dcaeDeployParameters": {
- "location_id": "",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- }
- }
- });
-
- it('Test the render method', () => {
- const component = shallow(
- <LoopPropertiesModal loopCache={ loopCache }/>
- )
- component.setState({
- show: true,
- temporaryPropertiesJson: {
- "dcaeDeployParameters": {
- "location_id": "",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- }
- }
- });
-
- expect(component.state('temporaryPropertiesJson')).toEqual({
- "dcaeDeployParameters": {
- "location_id": "",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- }
- });
- expect(component.state('show')).toEqual(true);
-
- expect(component).toMatchSnapshot();
- });
-
- it('Test handleClose', () => {
- const historyMock = { push: jest.fn() };
- const handleClose = jest.spyOn(LoopPropertiesModal.prototype, 'handleClose');
- const component = shallow(<LoopPropertiesModal history={ historyMock } loopCache={ loopCache }/>)
-
- component.find('[variant="secondary"]').prop('onClick')();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test handleSave successful', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const historyMock = { push: jest.fn() };
- const loadLoopFunction = jest.fn();
- const handleSave = jest.spyOn(LoopPropertiesModal.prototype, 'handleSave');
- LoopService.updateGlobalProperties = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK"
- });
- });
-
- const component = shallow(<LoopPropertiesModal history={ historyMock }
- loopCache={ loopCache } loadLoopFunction={ loadLoopFunction }/>)
-
- component.find('[variant="primary"]').prop('onClick')();
- await flushPromises();
- component.update();
-
- expect(handleSave).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Onchange event', () => {
- const event = { target: { name: "dcaeDeployParameters", value: "{\"location_id\": \"testLocation\",\"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName1_tca\"}" } };
- const component = shallow(<LoopPropertiesModal loopCache={ loopCache }/>);
-
- component.find('FormControl').simulate('change', event);
- component.update();
-
- expect(component.state('temporaryPropertiesJson').dcaeDeployParameters.location_id).toEqual("testLocation");
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js b/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js
deleted file mode 100644
index 32ae209..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-
-import React, { forwardRef } from 'react'
-import MaterialTable from "material-table";
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import styled from 'styled-components';
-import PolicyToscaService from '../../../api/PolicyToscaService';
-import ArrowUpward from '@material-ui/icons/ArrowUpward';
-import ChevronLeft from '@material-ui/icons/ChevronLeft';
-import ChevronRight from '@material-ui/icons/ChevronRight';
-import Clear from '@material-ui/icons/Clear';
-import FirstPage from '@material-ui/icons/FirstPage';
-import LastPage from '@material-ui/icons/LastPage';
-import Search from '@material-ui/icons/Search';
-import LoopService from '../../../api/LoopService';
-import Tabs from 'react-bootstrap/Tabs';
-import Tab from 'react-bootstrap/Tab';
-import Alert from 'react-bootstrap/Alert';
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-const TextModal = styled.textarea`
- margin-top: 20px;
- white-space: pre;
- background-color: ${ props => props.theme.toscaTextareaBackgroundColor };
- text-align: justify;
- font-size: ${ props => props.theme.toscaTextareaFontSize };
- width: 100%;
- height: 300px;
-`
-const cellStyle = { border: '1px solid black' };
-const headerStyle = { backgroundColor: '#ddd', border: '2px solid black' };
-const rowHeaderStyle = { backgroundColor: '#ddd', fontSize: '15pt', text: 'bold', border: '1px solid black' };
-
-export default class ModifyLoopModal extends React.Component {
-
- state = {
- show: true,
- loopCache: this.props.loopCache,
- content: 'Please select Tosca model to view the details',
- selectedRowData: {},
- toscaPolicyModelsData: [],
- selectedPolicyModelsData: [],
- key: 'add',
- showFailAlert: false,
- toscaColumns: [
- {
- title: "#", field: "index", render: rowData => rowData.tableData.id + 1,
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Policy Model Type", field: "policyModelType",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Policy Acronym", field: "policyAcronym",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Policy Name", field: "policyName",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Version", field: "version",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Uploaded By", field: "updatedBy",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Uploaded Date", field: "updatedDate", editable: 'never',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Created Date", field: "createdDate", editable: 'never',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- }
- ],
- tableIcons: {
- FirstPage: forwardRef((props, ref) => <FirstPage { ...props } ref={ ref }/>),
- LastPage: forwardRef((props, ref) => <LastPage { ...props } ref={ ref }/>),
- NextPage: forwardRef((props, ref) => <ChevronRight { ...props } ref={ ref }/>),
- PreviousPage: forwardRef((props, ref) => <ChevronLeft { ...props } ref={ ref }/>),
- ResetSearch: forwardRef((props, ref) => <Clear { ...props } ref={ ref }/>),
- Search: forwardRef((props, ref) => <Search { ...props } ref={ ref }/>),
- SortArrow: forwardRef((props, ref) => <ArrowUpward { ...props } ref={ ref }/>)
- }
- };
-
- constructor(props, context) {
- super(props, context);
- this.handleClose = this.handleClose.bind(this);
- this.initializeToscaPolicyModelsInfo = this.initializeToscaPolicyModelsInfo.bind(this);
- this.handleYamlContent = this.handleYamlContent.bind(this);
- this.getToscaPolicyModelYaml = this.getToscaPolicyModelYaml.bind(this);
- this.handleAdd = this.handleAdd.bind(this);
- this.handleRemove = this.handleRemove.bind(this);
- this.initializeToscaPolicyModelsInfo();
- }
-
- initializeToscaPolicyModelsInfo() {
- var operationalPolicies = this.state.loopCache.getOperationalPolicies();
- var selectedPolicyModels = [];
- for (var policy in operationalPolicies) {
- var newRow = operationalPolicies[policy]["policyModel"];
- newRow["policyName"] = operationalPolicies[policy].name;
- selectedPolicyModels.push(newRow);
- }
-
- PolicyToscaService.getToscaPolicyModels().then(allToscaModels => {
- this.setState({
- toscaPolicyModelsData: allToscaModels,
- selectedPolicyModelsData: selectedPolicyModels
- });
- });
- }
-
- getToscaPolicyModelYaml(policyModelType, policyModelVersion) {
- if (typeof policyModelType !== "undefined") {
- PolicyToscaService.getToscaPolicyModelYaml(policyModelType, policyModelVersion).then(toscaYaml => {
- if (toscaYaml.length !== 0) {
- this.setState({ content: toscaYaml })
- } else {
- this.setState({ content: 'No Tosca model Yaml available' })
- }
- });
- } else {
- this.setState({ content: 'Please select Tosca model to view the details' })
- }
- }
-
- handleYamlContent(event) {
- this.setState({ content: event.target.value });
- }
-
- handleClose() {
- this.setState({ show: false });
- this.props.history.push('/');
- }
-
- renderAlert() {
- return (
- <div>
- <Alert variant="danger" show={ this.state.showFailAlert } onClose={ this.disableAlert } dismissible>
- { this.state.showMessage }
- </Alert>
- </div>
- );
- }
-
- handleAdd() {
- LoopService.addOperationalPolicyType(this.state.loopCache.getLoopName(), this.state.selectedRowData.policyModelType, this.state.selectedRowData.version)
- .then(pars => {
- this.props.loadLoopFunction(this.state.loopCache.getLoopName());
- this.handleClose();
- })
- .catch(error => {
- this.setState({ showFailAlert: true, showMessage: "Adding failed with error: " + error.message });
- });
- }
-
- handleRemove() {
- LoopService.removeOperationalPolicyType(this.state.loopCache.getLoopName(), this.state.selectedRowData.policyModelType, this.state.selectedRowData.version, this.state.selectedRowData.policyName);
- this.props.loadLoopFunction(this.state.loopCache.getLoopName());
- this.handleClose();
- }
-
- render() {
- return (
- <ModalStyled size="xl" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Modify Loop Operational Policies</Modal.Title>
- </Modal.Header>
- <Tabs id="controlled-tab-example" activeKey={ this.state.key } onSelect={ key => this.setState({ key, selectedRowData: {} }) }>
- <Tab eventKey="add" title="Add Operational Policies">
- <Modal.Body>
- <MaterialTable
- title={ "View Tosca Policy Models" }
- data={ this.state.toscaPolicyModelsData }
- columns={ this.state.toscaColumns }
- icons={ this.state.tableIcons }
- onRowClick={ (event, rowData) => {
- this.getToscaPolicyModelYaml(rowData.policyModelType, rowData.version);
- this.setState({ selectedRowData: rowData })
- } }
- options={ {
- headerStyle: rowHeaderStyle,
- rowStyle: rowData => ({
- backgroundColor: (this.state.selectedRowData !== {} && this.state.selectedRowData.tableData !== undefined
- && this.state.selectedRowData.tableData.id === rowData.tableData.id) ? '#EEE' : '#FFF'
- })
- } }
- />
- <div>
- <TextModal value={ this.state.content } onChange={ this.handleYamlContent }/>
- </div>
- </Modal.Body>
- { this.renderAlert() }
- </Tab>
- <Tab eventKey="remove" title="Remove Operational Policies">
- <Modal.Body>
- <MaterialTable
- title={ "Tosca Policy Models already added" }
- data={ this.state.selectedPolicyModelsData }
- columns={ this.state.toscaColumns }
- icons={ this.state.tableIcons }
- onRowClick={ (event, rowData) => {
- this.setState({ selectedRowData: rowData })
- } }
- options={ {
- headerStyle: rowHeaderStyle,
- rowStyle: rowData => ({
- backgroundColor: (this.state.selectedRowData !== {} && this.state.selectedRowData.tableData !== undefined
- && this.state.selectedRowData.tableData.id === rowData.tableData.id) ? '#EEE' : '#FFF'
- })
- } }
- />
- </Modal.Body>
- </Tab>
- </Tabs>
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ this.handleClose }>Cancel</Button>
- <Button variant="primary" disabled={ (this.state.key === "remove") } type="submit" onClick={ this.handleAdd }>Add</Button>
- <Button variant="primary" disabled={ (this.state.key === "add") } type="submit" onClick={ this.handleRemove }>Remove</Button>
- </Modal.Footer>
-
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js
deleted file mode 100644
index ef57998..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.test.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { mount } from 'enzyme';
-import ModifyLoopModal from './ModifyLoopModal';
-import LoopCache from '../../../api/LoopCache';
-import LoopService from '../../../api/LoopService';
-import PolicyToscaService from '../../../api/PolicyToscaService';
-
-describe('Verify ModifyLoopModal', () => {
- const toscaPolicyModels = [{
- "policyModelType": "test",
- "policyAcronym": "test",
- "version": "1.0.0",
- "updatedBy": "",
- "updatedDate": ""
- }];
- const selectedPolicyModels = [];
-
- beforeEach(() => {
- PolicyToscaService.getToscaPolicyModels = jest.fn().mockImplementation(() => {
- return Promise.resolve(toscaPolicyModels);
- });
- PolicyToscaService.getToscaPolicyModelYaml = jest.fn().mockImplementation(() => {
- return Promise.resolve("OK");
- });
- })
-
- const loopCache = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "microServicePolicies": [{
- "name": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca",
- "modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "properties": { "domain": "measurementsForVfScaling" },
- "shared": false,
- "jsonRepresentation": { "schema": {} }
- }],
- "globalPropertiesJson": {
- "dcaeDeployParameters": {
- "testMs": {
- "location_id": "",
- "policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- }
- }
- }
- });
- const historyMock = { push: jest.fn() };
-
- it('Test handleClose', () => {
- const handleClose = jest.spyOn(ModifyLoopModal.prototype, 'handleClose');
- const component = mount(<ModifyLoopModal history={ historyMock } loopCache={ loopCache }/>)
-
- component.find('[variant="secondary"]').get(0).props.onClick();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test getToscaPolicyModelYaml', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const component = mount(<ModifyLoopModal history={ historyMock } loopCache={ loopCache }/>)
- component.setState({
- "selectedRowData": { "tableData": { "id": 0 } }
- });
- const instance = component.instance();
-
- instance.getToscaPolicyModelYaml("", "1.0.0");
- expect(component.state('content')).toEqual("Please select Tosca model to view the details");
-
- instance.getToscaPolicyModelYaml("test", "1.0.0");
- await flushPromises();
- expect(component.state('content')).toEqual("OK");
-
- PolicyToscaService.getToscaPolicyModelYaml = jest.fn().mockImplementation(() => {
- return Promise.resolve("");
- });
- instance.getToscaPolicyModelYaml("test", "1.0.0");
- await flushPromises();
- expect(component.state('content')).toEqual("No Tosca model Yaml available");
- });
-
- it('Test handleYamlContent', async () => {
- const component = mount(<ModifyLoopModal loopCache={ loopCache }/>)
- const instance = component.instance();
-
- const event = { "target": { "value": "testValue" } }
- instance.handleYamlContent(event);
- expect(component.state('content')).toEqual("testValue");
- });
-
- it('Test initializeToscaPolicyModelsInfo', () => {
- const component = mount(<ModifyLoopModal loopCache={ loopCache }/>)
- component.setState({
- toscaPolicyModelsData: toscaPolicyModels,
- selectedPolicyModelsData: selectedPolicyModels
- });
- expect(component.state('toscaPolicyModelsData')).toEqual(toscaPolicyModels);
- expect(component.state('selectedPolicyModelsData')).toEqual(selectedPolicyModels);
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/OpenLoopModal.js b/gui-clamp/ui-react/src/components/dialogs/Loop/OpenLoopModal.js
deleted file mode 100644
index b6407fb..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/OpenLoopModal.js
+++ /dev/null
@@ -1,139 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import Select from 'react-select';
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import Form from 'react-bootstrap/Form';
-import Row from 'react-bootstrap/Row';
-import Col from 'react-bootstrap/Col';
-import FormCheck from 'react-bootstrap/FormCheck'
-import styled from 'styled-components';
-import LoopService from '../../../api/LoopService';
-import SvgGenerator from '../../loop_viewer/svg/SvgGenerator';
-import LoopCache from '../../../api/LoopCache';
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-const CheckBoxStyled = styled(FormCheck.Input)`
- margin-left: 3rem;
-`
-
-export default class OpenLoopModal extends React.Component {
- constructor(props, context) {
- super(props, context);
-
- this.getLoopNames = this.getLoopNames.bind(this);
- this.handleOpen = this.handleOpen.bind(this);
- this.handleClose = this.handleClose.bind(this);
- this.handleDropDownListChange = this.handleDropDownListChange.bind(this);
- this.renderSvg = this.renderSvg.bind(this);
- this.showReadOnly = props.showReadOnly !== undefined ? props.showReadOnly : true;
- this.state = {
- show: true,
- chosenLoopName: '',
- loopNames: [],
- loopCacheOpened: new LoopCache({})
- };
- }
-
- componentWillMount() {
- this.getLoopNames();
- }
-
- handleClose() {
- this.setState({ show: false });
- this.props.history.push('/');
- }
-
- handleDropDownListChange(e) {
- LoopService.getLoop(e.value).then(loop => {
- this.setState({
- chosenLoopName: e.value,
- loopCacheOpened: new LoopCache(loop)
- });
- });
- }
-
- getLoopNames() {
- LoopService.getLoopNames().then(loopNames => {
- if (Object.entries(loopNames).length !== 0) {
- const loopOptions = loopNames.filter(loopName => loopName !== 'undefined').map((loopName) => {
- return { label: loopName, value: loopName }
- });
- this.setState({ loopNames: loopOptions })
- }
- });
- }
-
- handleOpen() {
- console.info("Loop " + this.state.chosenLoopName + " is chosen");
- this.handleClose();
- this.props.loadLoopFunction(this.state.chosenLoopName);
- }
-
- renderSvg() {
- return (
- <SvgGenerator loopCache={ this.state.loopCacheOpened } clickable={ false } generatedFrom={ SvgGenerator.GENERATED_FROM_INSTANCE }/>
- );
- }
-
- render() {
- return (
- <ModalStyled size="xl" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Open Model</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <Form.Group as={ Row } controlId="formPlaintextEmail">
- <Form.Label column sm="2">Model Name:</Form.Label>
- <Col sm="10">
- <Select onChange={ this.handleDropDownListChange }
- options={ this.state.loopNames }/>
- </Col>
- </Form.Group>
- <Form.Group as={ Row } style={ { alignItems: 'center' } } controlId="formSvgPreview">
- <Form.Label column sm="2">Model Preview:</Form.Label>
- <Col sm="10">
- { this.renderSvg() }
- </Col>
- </Form.Group>
- { this.showReadOnly === true ?
- <Form.Group as={ Row } controlId="formBasicCheckbox">
- <Form.Check>
- <FormCheck.Label>Read Only Mode:</FormCheck.Label>
- <CheckBoxStyled style={ { marginLeft: '3.5em' } } type="checkbox"/>
- </Form.Check>
- </Form.Group>
- : null }
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ this.handleClose }>Cancel</Button>
- <Button variant="primary" type="submit" onClick={ this.handleOpen }>Open</Button>
- </Modal.Footer>
- </ModalStyled>
-
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
deleted file mode 100644
index 6b2dc4a..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import OpenLoopModal from './OpenLoopModal';
-import LoopService from '../../../api/LoopService';
-
-describe('Verify OpenLoopModal', () => {
-
- beforeEach(() => {
- fetch.resetMocks();
- fetch.mockResponse(JSON.stringify([
- "LOOP_gmtAS_v1_0_ResourceInstanceName1_tca",
- "LOOP_gmtAS_v1_0_ResourceInstanceName1_tca_3",
- "LOOP_gmtAS_v1_0_ResourceInstanceName2_tca_2"
- ]));
- });
-
- it('Test the render method', () => {
-
- const component = shallow(<OpenLoopModal/>);
- expect(component).toMatchSnapshot();
- });
-
- it('Onchange event', async () => {
- const flushPromises = () => new Promise(setImmediate);
- LoopService.getLoop = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
- const event = { value: 'LOOP_gmtAS_v1_0_ResourceInstanceName1_tca_3' };
- const component = shallow(<OpenLoopModal/>);
- component.find('StateManager').simulate('change', event);
- await flushPromises();
- component.update();
- expect(component.state('chosenLoopName')).toEqual("LOOP_gmtAS_v1_0_ResourceInstanceName1_tca_3");
- });
-
-
- it('Test handleClose', () => {
- const historyMock = { push: jest.fn() };
- const handleClose = jest.spyOn(OpenLoopModal.prototype, 'handleClose');
- const component = shallow(<OpenLoopModal history={ historyMock }/>)
-
- component.find('[variant="secondary"]').prop('onClick')();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
-
- handleClose.mockClear();
- });
-
- it('Test handleSubmit', () => {
- const historyMock = { push: jest.fn() };
- const loadLoopFunction = jest.fn();
- const handleOpen = jest.spyOn(OpenLoopModal.prototype, 'handleOpen');
- const component = shallow(<OpenLoopModal history={ historyMock } loadLoopFunction={ loadLoopFunction }/>)
-
- component.find('[variant="primary"]').prop('onClick')();
-
- expect(handleOpen).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
-
- handleOpen.mockClear();
- });
-
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/CreateLoopModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/CreateLoopModal.test.js.snap
deleted file mode 100644
index 1ba9dba..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/CreateLoopModal.test.js.snap
+++ /dev/null
@@ -1,167 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify CreateLoopModal Test the render method 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Create Model
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formPlaintextEmail"
- >
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
- Template Name:
- </FormLabel>
- <Col
- sm="10"
- >
- <StateManager
- defaultInputValue=""
- defaultMenuIsOpen={false}
- defaultValue={null}
- onChange={[Function]}
- options={Array []}
- />
- </Col>
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formSvgPreview"
- style={
- Object {
- "alignItems": "center",
- }
- }
- >
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
- Model Preview:
- </FormLabel>
- <Col
- sm="10"
- >
- <withRouter(SvgGenerator)
- clickable={false}
- generatedFrom="TEMPLATE"
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- </Col>
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formPlaintextEmail"
- >
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
- Model Name:
- </FormLabel>
- <input
- onChange={[Function]}
- sm="5"
- style={
- Object {
- "marginLeft": "1em",
- "width": "50%",
- }
- }
- type="text"
- value=""
- />
- <span
- sm="5"
- />
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formPlaintextEmail"
- >
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
-
- </FormLabel>
- <styled.div />
- </FormGroup>
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Cancel
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="submit"
- variant="primary"
- >
- Create
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/DeployLoopModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/DeployLoopModal.test.js.snap
deleted file mode 100644
index 33f8faa..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/DeployLoopModal.test.js.snap
+++ /dev/null
@@ -1,88 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify DeployLoopModal Test the render method 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="lg"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Deployment parameters
- </ModalTitle>
- </ModalHeader>
- <Tabs
- activeKey="testMs"
- id="controlled-tab-example"
- mountOnEnter={false}
- onSelect={[Function]}
- unmountOnExit={false}
- variant="tabs"
- >
- <Tab
- eventKey="testMs"
- key="testMs"
- title="testMs"
- >
- <Styled(FormGroup)
- key="location_id"
- >
- <FormLabel
- column={false}
- srOnly={false}
- >
- location_id
- </FormLabel>
- <FormControl
- defaultValue=""
- name="location_id"
- onChange={[Function]}
- type="text"
- />
- </Styled(FormGroup)>
- <Styled(FormGroup)
- key="policy_id"
- >
- <FormLabel
- column={false}
- srOnly={false}
- >
- policy_id
- </FormLabel>
- <FormControl
- defaultValue="TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
- name="policy_id"
- onChange={[Function]}
- type="text"
- />
- </Styled(FormGroup)>
- </Tab>
- </Tabs>
- <div />
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Cancel
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="submit"
- variant="primary"
- >
- Deploy
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/LoopPropertiesModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/LoopPropertiesModal.test.js.snap
deleted file mode 100644
index 3baaa57..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/LoopPropertiesModal.test.js.snap
+++ /dev/null
@@ -1,61 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify LoopPropertiesModal Test the render method 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="lg"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Model Properties
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <Form
- inline={false}
- >
- <FormGroup>
- <FormLabel
- column={false}
- srOnly={false}
- >
- Deploy Parameters
- </FormLabel>
- <FormControl
- as="textarea"
- defaultValue="{\\"location_id\\":\\"\\",\\"policy_id\\":\\"TCA_h2NMX_v1_0_ResourceInstanceName1_tca\\"}"
- name="dcaeDeployParameters"
- onChange={[Function]}
- rows="3"
- />
- </FormGroup>
- </Form>
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Cancel
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="submit"
- variant="primary"
- >
- Save Changes
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/OpenLoopModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/OpenLoopModal.test.js.snap
deleted file mode 100644
index 581fd0e..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/OpenLoopModal.test.js.snap
+++ /dev/null
@@ -1,137 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify OpenLoopModal Test the render method 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Open Model
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formPlaintextEmail"
- >
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
- Model Name:
- </FormLabel>
- <Col
- sm="10"
- >
- <StateManager
- defaultInputValue=""
- defaultMenuIsOpen={false}
- defaultValue={null}
- onChange={[Function]}
- options={Array []}
- />
- </Col>
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formSvgPreview"
- style={
- Object {
- "alignItems": "center",
- }
- }
- >
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
- Model Preview:
- </FormLabel>
- <Col
- sm="10"
- >
- <withRouter(SvgGenerator)
- clickable={false}
- generatedFrom="INSTANCE"
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- </Col>
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formBasicCheckbox"
- >
- <FormCheck>
- <FormCheckLabel>
- Read Only Mode:
- </FormCheckLabel>
- <Styled(FormCheckInput)
- style={
- Object {
- "marginLeft": "3.5em",
- }
- }
- type="checkbox"
- />
- </FormCheck>
- </FormGroup>
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Cancel
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="submit"
- variant="primary"
- >
- Open
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/ManageDictionaries.js b/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/ManageDictionaries.js
deleted file mode 100644
index d7ba8d1..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/ManageDictionaries.js
+++ /dev/null
@@ -1,637 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-
-
-import React, { forwardRef } from 'react';
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import Row from 'react-bootstrap/Row';
-import Col from 'react-bootstrap/Col';
-import styled from 'styled-components';
-import TemplateMenuService from '../../../api/TemplateService';
-import CsvToJson from '../../../utils/CsvToJson';
-import MaterialTable, { MTableToolbar } from "material-table";
-import IconButton from '@material-ui/core/IconButton';
-import Tooltip from '@material-ui/core/Tooltip';
-import AddBox from '@material-ui/icons/AddBox';
-import ArrowUpward from '@material-ui/icons/ArrowUpward';
-import Check from '@material-ui/icons/Check';
-import ChevronLeft from '@material-ui/icons/ChevronLeft';
-import VerticalAlignTopIcon from '@material-ui/icons/VerticalAlignTop';
-import VerticalAlignBottomIcon from '@material-ui/icons/VerticalAlignBottom';
-import ChevronRight from '@material-ui/icons/ChevronRight';
-import Clear from '@material-ui/icons/Clear';
-import DeleteOutline from '@material-ui/icons/DeleteOutline';
-import Edit from '@material-ui/icons/Edit';
-import FilterList from '@material-ui/icons/FilterList';
-import FirstPage from '@material-ui/icons/FirstPage';
-import LastPage from '@material-ui/icons/LastPage';
-import Remove from '@material-ui/icons/Remove';
-import Search from '@material-ui/icons/Search';
-import ViewColumn from '@material-ui/icons/ViewColumn';
-
-
-const ModalStyled = styled(Modal)`
- @media (min-width: 1200px) {
- .modal-xl {
- max-width: 96%;
- }
- }
- background-color: transparent;
-`
-
-const MTableToolbarStyled = styled(MTableToolbar)`
- display: flex;
- flex-direction: row;
- align-items: center;
-`
-const ColPullLeftStyled = styled(Col)`
- display: flex;
- flex-direction: row;
- align-items: center;
- margin-left: -40px;
-`
-
-const cellStyle = { border: '1px solid black' };
-const headerStyle = { backgroundColor: '#ddd', border: '2px solid black' };
-const rowHeaderStyle = { backgroundColor: '#ddd', fontSize: '15pt', text: 'bold', border: '1px solid black' };
-
-let dictList = [];
-let subDictFlag = false;
-
-function SelectSubDictType(props) {
- const { onChange } = props;
- const selectedValues = (e) => {
- let options = e.target.options;
- let SelectedDictTypes = '';
- for (let dictType = 0, values = options.length; dictType < values; dictType++) {
- if (options[dictType].selected) {
- SelectedDictTypes = SelectedDictTypes.concat(options[dictType].value);
- SelectedDictTypes = SelectedDictTypes.concat('|');
- }
- }
- SelectedDictTypes = SelectedDictTypes.slice(0, -1);
- onChange(SelectedDictTypes);
- }
- // When the subDictFlag is true, we need to disable selection of element "type"
- return (
- <div>
- <select disabled={ subDictFlag } multiple={ true } onChange={ selectedValues }>
- <option value="string">string</option>
- <option value="number">number</option>
- <option value="datetime">datetime</option>
- <option value="map">map</option>
- <option value="json">json</option>
- </select>
- </div>
- );
-}
-
-function SubDict(props) {
- const { onChange } = props;
- const subDicts = [];
- subDicts.push('none');
- if (dictList !== undefined && dictList.length > 0) {
- let item;
- for (item in dictList) {
- if (dictList[item].secondLevelDictionary === 1) {
- subDicts.push(dictList[item].name);
- }
- }
- }
- let optionItems = [];
- for (let i = 0; i < subDicts.length; ++i) {
- if (i === 0) {
- optionItems.push(<option selected key={ subDicts[i] }>{ subDicts[i] }</option>);
- } else {
- optionItems.push(<option key={ subDicts[i] }>{ subDicts[i] }</option>);
- }
- }
-
- function selectedValue(e) {
- onChange(e.target.value);
- }
-
- // When the subDictFlag is true, we need to disable selection of
- // the sub-dictionary flag
- return (
- <select disabled={ subDictFlag } onChange={ selectedValue }>
- { optionItems }
- </select>
- );
-}
-
-export default class ManageDictionaries extends React.Component {
- constructor(props, context) {
- super(props, context);
- this.addDictionaryElementRow = this.addDictionaryElementRow.bind(this);
- this.addDictionaryRow = this.addDictionaryRow.bind(this);
- this.addReplaceDictionaryRequest = this.addReplaceDictionaryRequest.bind(this);
- this.clickHandler = this.clickHandler.bind(this);
- this.deleteDictionaryElementRow = this.deleteDictionaryElementRow.bind(this);
- this.deleteDictionaryRequest = this.deleteDictionaryRequest.bind(this);
- this.deleteDictionaryRow = this.deleteDictionaryRow.bind(this);
- this.fileSelectedHandler = this.fileSelectedHandler.bind(this);
- this.getDictionaries = this.getDictionaries.bind(this);
- this.getDictionaryElements = this.getDictionaryElements.bind(this);
- this.handleClose = this.handleClose.bind(this);
- this.handleDictionaryRowClick = this.handleDictionaryRowClick.bind(this);
- this.importCsvData = this.importCsvData.bind(this);
- this.updateDictionaryElementRow = this.updateDictionaryElementRow.bind(this);
- this.updateDictionaryElementsRequest = this.updateDictionaryElementsRequest.bind(this);
- this.updateDictionaryRow = this.updateDictionaryRow.bind(this);
- this.readOnly = props.readOnly !== undefined ? props.readOnly : false;
- this.state = {
- show: true,
- currentSelectedDictionary: null,
- exportFilename: '',
- content: null,
- dictionaryElements: [],
- tableIcons: {
- Add: forwardRef((props, ref) => <AddBox { ...props } ref={ ref }/>),
- Delete: forwardRef((props, ref) => <DeleteOutline { ...props } ref={ ref }/>),
- DetailPanel: forwardRef((props, ref) => <ChevronRight { ...props } ref={ ref }/>),
- Edit: forwardRef((props, ref) => <Edit { ...props } ref={ ref }/>),
- Check: forwardRef((props, ref) => <Check { ...props } ref={ ref }/>),
- Clear: forwardRef((props, ref) => <Clear { ...props } ref={ ref }/>),
- Export: forwardRef((props, ref) => <VerticalAlignBottomIcon { ...props } ref={ ref }/>),
- Filter: forwardRef((props, ref) => <FilterList { ...props } ref={ ref }/>),
- FirstPage: forwardRef((props, ref) => <FirstPage { ...props } ref={ ref }/>),
- LastPage: forwardRef((props, ref) => <LastPage { ...props } ref={ ref }/>),
- NextPage: forwardRef((props, ref) => <ChevronRight { ...props } ref={ ref }/>),
- PreviousPage: forwardRef((props, ref) => <ChevronLeft { ...props } ref={ ref }/>),
- ResetSearch: forwardRef((props, ref) => <Clear { ...props } ref={ ref }/>),
- Search: forwardRef((props, ref) => <Search { ...props } ref={ ref }/>),
- SortArrow: forwardRef((props, ref) => <ArrowUpward { ...props } ref={ ref }/>),
- ThirdStateCheck: forwardRef((props, ref) => <Remove { ...props } ref={ ref }/>),
- ViewColumn: forwardRef((props, ref) => <ViewColumn { ...props } ref={ ref }/>)
- },
- dictColumns: [
- {
- title: "Dictionary Name", field: "name", editable: 'onAdd',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Sub Dictionary ?", field: "secondLevelDictionary", lookup: { 0: 'No', 1: 'Yes' },
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Dictionary Type", field: "subDictionaryType", lookup: { string: 'string', number: 'number' },
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Updated By", field: "updatedBy", editable: 'never',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Last Updated Date", field: "updatedDate", editable: 'never',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- }
- ],
- dictElementColumns: [
- {
- title: "Element Short Name", field: "shortName", editable: 'onAdd',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Element Name", field: "name",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Element Description", field: "description",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Element Type", field: "type",
- editComponent: props => (
- <div>
- <SelectSubDictType value={ props.value } onChange={ props.onChange }/>
- </div>
- ),
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Sub-Dictionary", field: "subDictionary",
- editComponent: props => (
- <div>
- <SubDict value={ props.value } onChange={ props.onChange }/>
- </div>
- ),
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Updated By", field: "updatedBy", editable: 'never',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Updated Date", field: "updatedDate", editable: 'never',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- }
- ]
- }
- }
-
- componentDidMount() {
- this.getDictionaries();
- }
-
- getDictionaries() {
- TemplateMenuService.getDictionary().then(arrayOfdictionaries => {
- this.setState({ dictionaries: arrayOfdictionaries, currentSelectedDictionary: null })
- // global variable setting used functional components in this file
- dictList = arrayOfdictionaries;
- }).catch(() => {
- console.error('Failed to retrieve dictionaries');
- this.setState({ dictionaries: [], currentSelectedDictionary: null })
- });
- }
-
- getDictionaryElements(dictionaryName) {
- TemplateMenuService.getDictionaryElements(dictionaryName).then(dictionaryElements => {
- this.setState({ dictionaryElements: dictionaryElements.dictionaryElements });
- this.setState({ currentSelectDictionary: dictionaryName });
- }).catch(() => console.error('Failed to retrieve dictionary elements'))
- }
-
- clickHandler(rowData) {
- this.getDictionaries();
- }
-
- handleClose() {
- this.setState({ show: false });
- this.props.history.push('/');
- }
-
- addReplaceDictionaryRequest(dictionaryEntry) {
- TemplateMenuService.insDictionary(dictionaryEntry)
- .then(resp => {
- this.getDictionaries();
- })
- .catch(() => console.error('Failed to insert new dictionary elements'));
- }
-
- updateDictionaryElementsRequest(dictElements) {
- let reqData = { "name": this.state.currentSelectedDictionary, 'dictionaryElements': dictElements };
- TemplateMenuService.insDictionaryElements(reqData)
- .then(resp => {
- this.getDictionaryElements(this.state.currentSelectedDictionary)
- })
- .catch(() => console.error('Failed to update dictionary elements'));
- }
-
- deleteDictionaryRequest(dictionaryName) {
- TemplateMenuService.deleteDictionary(dictionaryName)
- .then(resp => {
- this.getDictionaries();
- })
- .catch(() => console.error('Failed to delete dictionary'));
- }
-
- deleteDictionaryElementRequest(dictionaryName, elemenetShortName) {
- TemplateMenuService.deleteDictionaryElements({ 'name': dictionaryName, 'shortName': elemenetShortName })
- .then(resp => {
- this.getDictionaryElements(dictionaryName);
- })
- .catch(() => console.error('Failed to delete dictionary elements'));
- }
-
- fileSelectedHandler = (event) => {
-
- if (event.target.files[0].type === 'text/csv' || event.target.files[0].type === 'application/vnd.ms-excel') {
- if (event.target.files && event.target.files[0]) {
- const reader = new FileReader();
- reader.onload = (e) => {
- let errorMessages = this.importCsvData(reader.result);
- if (errorMessages !== '') {
- alert(errorMessages);
- }
- }
- reader.readAsText(event.target.files[0]);
- }
- } else {
- alert('Please upload .csv extention files only.');
- }
- }
-
- importCsvData(rawCsvData) {
-
- const jsonKeyNames = ['shortName', 'name', 'description', 'type', 'subDictionary'];
- const userHeaderNames = ['Element Short Name', 'Element Name', 'Element Description', 'Element Type', 'Sub-Dictionary'];
- const validTypes = ['string', 'number', 'datetime', 'json', 'map'];
-
- let mandatory;
-
- if (subDictFlag) {
- mandatory = [true, true, true, false, false];
- } else {
- mandatory = [true, true, true, true, false];
- }
-
- let result = CsvToJson(rawCsvData, ',', '||||', userHeaderNames, jsonKeyNames, mandatory);
-
- let errorMessages = result.errorMessages;
- let jsonObjArray = result.jsonObjArray;
-
- let validTypesErrorMesg = '';
-
- for (let i = 0; i < validTypes.length; ++i) {
- if (i === 0) {
- validTypesErrorMesg = validTypes[i];
- } else {
- validTypesErrorMesg += ',' + validTypes[i];
- }
- }
-
- if (errorMessages !== '') {
- return errorMessages;
- }
-
- // Perform further checks on data that is now in JSON form
- let subDictionaries = [];
-
- // NOTE: dictList is a global variable maintained faithfully
- // by the getDictionaries() method outside this import
- // functionality.
- let item;
- for (item in dictList) {
- if (dictList[item].secondLevelDictionary === 1) {
- subDictionaries.push(dictList[item].name);
- }
- }
- ;
-
- // Check for valid Sub-Dictionary and Element Type values
- subDictionaries = subDictionaries.toString();
- let row = 2;
- let dictElem;
- for (dictElem of jsonObjArray) {
- let itemKey;
- for (itemKey in dictElem) {
- let value = dictElem[itemKey].trim();
- let keyIndex = jsonKeyNames.indexOf(itemKey);
- if (itemKey === 'shortName' && /[^a-zA-Z0-9-_.]/.test(value)) {
- errorMessages += '\n' + userHeaderNames[keyIndex] +
- ' at row #' + row +
- ' can only contain alphanumeric characters and periods, hyphens or underscores';
- }
- if (itemKey === 'type' && validTypes.indexOf(value) < 0) {
- errorMessages += '\nInvalid value of "' + value + '" for "' + userHeaderNames[keyIndex] + '" at row #' + row;
- errorMessages += '\nValid types are: ' + validTypesErrorMesg;
- }
- if (value !== "" && itemKey === 'subDictionary' && subDictionaries.indexOf(value) < 0) {
- errorMessages += '\nInvalid Sub-Dictionary value of "' + value + '" at row #' + row;
- }
- }
- ++row;
- }
- if (errorMessages === '') {
- // We made it through all the checks. Send it to back end
- this.updateDictionaryElementsRequest(jsonObjArray);
- }
-
- return errorMessages;
- }
-
- addDictionaryRow(newData) {
- let validData = true;
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- if (/[^a-zA-Z0-9-_.]/.test(newData.name)) {
- validData = false;
- alert('Please enter alphanumeric input. Only allowed special characters are:(period, hyphen, underscore)');
- reject();
- }
- for (let i = 0; i < this.state.dictionaries.length; i++) {
- if (this.state.dictionaries[i].name === newData.name) {
- validData = false;
- alert(newData.name + ' dictionary name already exists')
- reject();
- }
- }
- if (validData) {
- this.addReplaceDictionaryRequest(newData);
- }
- resolve();
- }, 1000);
- });
- }
-
-
- updateDictionaryRow(newData, oldData) {
- let validData = true;
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- if (/[^a-zA-Z0-9-_.]/.test(newData.name)) {
- validData = false;
- alert('Please enter alphanumberic input. Only allowed special characters are:(period, hyphen, underscore)');
- reject();
- }
- if (validData) {
- this.addReplaceDictionaryRequest(newData);
- }
- resolve();
- }, 1000);
- });
- }
-
- deleteDictionaryRow(oldData) {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- this.deleteDictionaryRequest(oldData.name);
- resolve();
- }, 1000);
- });
- }
-
- addDictionaryElementRow(newData) {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- let dictionaryElements = this.state.dictionaryElements;
- let errorMessages = '';
- for (let i = 0; i < this.state.dictionaryElements.length; i++) {
- if (this.state.dictionaryElements[i].shortName === newData.shortName) {
- alert('Short Name "' + newData.shortName + '" already exists');
- reject("");
- }
- }
- // MaterialTable returns no property at all if the user has not touched a
- // new column, so we want to add the property with an emptry string
- // for several cases if that is the case to simplify other checks.
- if (newData.description === undefined) {
- newData.description = "";
- }
- if (newData.subDictionary === undefined) {
- newData.subDictionary = null;
- }
- if (newData.type === undefined) {
- newData.type = "";
- }
- if (!newData.shortName && /[^a-zA-Z0-9-_.]/.test(newData.shortName)) {
- errorMessages += '\nShort Name is limited to alphanumeric characters and also period, hyphen, and underscore';
- }
- if (!newData.shortName) {
- errorMessages += '\nShort Name must be specified';
- }
- if (!newData.name) {
- errorMessages += '\nElement Name must be specified';
- }
- if (!newData.type && !subDictFlag) {
- errorMessages += '\nElement Type must be specified';
- }
- if (errorMessages === '') {
- dictionaryElements.push(newData);
- this.updateDictionaryElementsRequest([newData]);
- resolve();
- } else {
- alert(errorMessages);
- reject("");
- }
- }, 1000);
- });
- }
-
- updateDictionaryElementRow(newData, oldData) {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- let dictionaryElements = this.state.dictionaryElements;
- let validData = true;
- if (!newData.type) {
- validData = false;
- alert('Element Type cannot be null');
- reject();
- }
- if (validData) {
- const index = dictionaryElements.indexOf(oldData);
- dictionaryElements[index] = newData;
- this.updateDictionaryElementsRequest([newData]);
- }
- resolve();
- }, 1000);
- });
- }
-
-
- deleteDictionaryElementRow(oldData) {
- return new Promise((resolve) => {
- setTimeout(() => {
- this.deleteDictionaryElementRequest(this.state.currentSelectedDictionary, oldData.shortName);
- resolve();
- }, 1000);
- });
- }
-
- handleDictionaryRowClick(event, rowData) {
- subDictFlag = rowData.secondLevelDictionary === 1 ? true : false;
- this.setState({
- currentSelectedDictionary: rowData.name,
- exportFilename: rowData.name
- })
- this.getDictionaryElements(rowData.name);
- }
-
- render() {
- return (
- <ModalStyled size="xl" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Manage Dictionaries</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- { this.state.currentSelectedDictionary === null ?
- <MaterialTable
- title={ "Dictionary List" }
- data={ this.state.dictionaries }
- columns={ this.state.dictColumns }
- icons={ this.state.tableIcons }
- onRowClick={ this.handleDictionaryRowClick }
- options={ {
- headerStyle: rowHeaderStyle,
- } }
- editable={ !this.readOnly ?
- {
- onRowAdd: this.addDictionaryRow,
- onRowUpdate: this.updateDictionaryRow,
- onRowDelete: this.deleteDictionaryRow
- } : undefined }
- /> : null
- }
- { this.state.currentSelectedDictionary !== null ?
- <MaterialTable
- title={ 'Dictionary Elements List for ' + (subDictFlag ? 'Sub-Dictionary "' : '"') + this.state.currentSelectedDictionary + '"' }
- data={ this.state.dictionaryElements }
- columns={ this.state.dictElementColumns }
- icons={ this.state.tableIcons }
- options={ {
- exportAllData: true,
- exportButton: true,
- exportFileName: this.state.exportFilename,
- headerStyle: { backgroundColor: 'white', fontSize: '15pt', text: 'bold', border: '1px solid black' }
- } }
- components={ {
- Toolbar: props => (
- <Row>
- <Col sm="11">
- <MTableToolbarStyled { ...props } />
- </Col>
- <ColPullLeftStyled sm="1">
- <Tooltip title="Import" placement="bottom">
- <IconButton aria-label="import" disabled={ this.readOnly } onClick={ () => this.fileUpload.click() }>
- <VerticalAlignTopIcon/>
- </IconButton>
- </Tooltip>
- <input type="file" ref={ (fileUpload) => {
- this.fileUpload = fileUpload;
- } }
- style={ { visibility: 'hidden', width: '1px' } } onChange={ this.fileSelectedHandler }/>
- </ColPullLeftStyled>
- </Row>
- )
- } }
- editable={ !this.readOnly ?
- {
- onRowAdd: this.addDictionaryElementRow,
- onRowUpdate: this.updateDictionaryElementRow,
- onRowDelete: this.deleteDictionaryElementRow
- } : undefined
- }
- /> : null
- }
- { this.state.currentSelectedDictionary !== null ? <button onClick={ this.clickHandler } style={ { marginTop: '25px' } }>Go Back to Dictionaries List</button> : "" }
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ this.handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/ManageDictionaries.test.js b/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/ManageDictionaries.test.js
deleted file mode 100644
index 2552d7a..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/ManageDictionaries.test.js
+++ /dev/null
@@ -1,465 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import { mount } from 'enzyme';
-import { render } from 'enzyme';
-import ManageDictionaries from './ManageDictionaries';
-import TemplateMenuService from '../../../api/TemplateService'
-
-const TestDictionaryElements = {
- name: "test",
- secondLevelDictionary: 0,
- subDictionaryType: "",
- dictionaryElements: [
- {
- shortName: "alertType",
- name: "Alert Type",
- description: "Type of Alert",
- type: "string",
- subDictionary: "",
- createdDate: "2020-06-12T13:58:51.443931Z",
- updatedDate: "2020-06-13T16:27:57.084870Z",
- updatedBy: "admin",
- createdBy: "admin"
- }
- ]
-};
-
-const TestDictionaries =
- [
- {
- name: "test",
- secondLevelDictionary: 0,
- subDictionaryType: "string",
- dictionaryElements: [TestDictionaryElements],
- createdDate: "2020-06-14T21:00:33.231166Z",
- updatedDate: "2020-06-14T21:00:33.231166Z",
- updatedBy: "admin",
- createdBy: "admin"
- },
- {
- name: "testSub1",
- secondLevelDictionary: 1,
- subDictionaryType: "string",
- dictionaryElements: [
- {
- shortName: "subElem",
- name: "Sub Element",
- description: "Sub Element Description",
- type: "string",
- createdDate: "2020-06-14T21:04:44.402287Z",
- updatedDate: "2020-06-14T21:04:44.402287Z",
- updatedBy: "admin",
- createdBy: "admin"
- }
- ],
- createdDate: "2020-06-14T21:01:16.390250Z",
- updatedDate: "2020-06-14T21:01:16.390250Z",
- updatedBy: "admin",
- createdBy: "admin"
- }
- ];
-
-
-const historyMock = { push: jest.fn() };
-
-let errorMessage = '';
-
-window.alert = jest.fn().mockImplementation((mesg) => {
- errorMessage = mesg;
- return
-});
-
-TemplateMenuService.getDictionary = jest.fn().mockImplementation(() => {
- return Promise.resolve(TestDictionaries);
-});
-
-TemplateMenuService.insDictionary = jest.fn().mockImplementation(() => {
- return Promise.resolve({ ok: true, status: 200 });
-});
-
-TemplateMenuService.deleteDictionary = jest.fn().mockImplementation(() => {
- return Promise.resolve("200");
-});
-
-TemplateMenuService.getDictionaryElements = jest.fn().mockImplementation(() => {
- return Promise.resolve(TestDictionaryElements);
-});
-
-TemplateMenuService.deleteDictionaryElements = jest.fn().mockImplementation(() => {
- return Promise.resolve("200");
-});
-
-TemplateMenuService.insDictionaryElements = jest.fn().mockImplementation(() => {
- return Promise.resolve("200");
-});
-
-
-describe('Verify ManageDictionaries', () => {
-
- beforeEach(() => {
- fetch.resetMocks();
- });
-
- it('Test API Successful', () => {
- fetch.mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "name": "vtest",
- "secondLevelDictionary": 1,
- "subDictionaryType": "string",
- "updatedBy": "test",
- "updatedDate": "05-07-2019 19:09:42"
- });
- }
- });
- });
- const component = shallow(<ManageDictionaries/>);
- expect(component).toMatchSnapshot();
- });
-
- it('Test API Exception', () => {
- fetch.mockImplementationOnce(() => {
- return Promise.resolve({
- ok: false,
- status: 500,
- json: () => {
- return Promise.resolve({
- "name": "vtest",
- "secondLevelDictionary": 1,
- "subDictionaryType": "string",
- "updatedBy": "test",
- "updatedDate": "05-07-2019 19:09:42"
- });
- }
- });
- });
- const component = shallow(<ManageDictionaries/>);
- });
-
- it('Test Table icons', () => {
-
- const component = mount(<ManageDictionaries/>);
- expect(component.find('[className="MuiSelect-icon MuiTablePagination-selectIcon"]')).toBeTruthy();
- });
-
- test('Test add/replace and delete dictionary requests', async () => {
-
- const component = shallow(<ManageDictionaries history={ historyMock }/>)
- const instance = component.instance();
-
- const flushPromises = () => new Promise(setImmediate);
-
- instance.addReplaceDictionaryRequest({ name: "newdict", secondLevelDictionary: 0, subDictionaryType: "string" });
- instance.deleteDictionaryRequest("test");
-
- await flushPromises();
-
- expect(component.state('currentSelectedDictionary')).toEqual(null);
- expect(component.state('dictionaries')).toEqual(TestDictionaries);
- });
-
- test('Test update dictionary row', async () => {
-
- const component = shallow(<ManageDictionaries history={ historyMock }/>)
- const instance = component.instance();
- const rowData = { name: "newdict", secondLevelDictionary: 0, subDictionaryType: "string" };
-
- await expect(instance.updateDictionaryRow(rowData, rowData)).resolves.toEqual(undefined);
-
- }, 2000);
-
- test('Test add dictionary row', async () => {
-
- const addReplaceRequest = jest.spyOn(ManageDictionaries.prototype, 'addReplaceDictionaryRequest');
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
- const rowData = { name: "newdict", secondLevelDictionary: 0, subDictionaryType: "string" };
-
- await instance.addDictionaryRow(rowData);
- expect(addReplaceRequest).toHaveBeenCalledWith(rowData);
-
- }, 2000);
-
- test('Test add dictionary row with errors name already exists', async () => {
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
- let rowData = { name: "test", secondLevelDictionary: 0, subDictionaryType: "" };
-
- await expect(instance.addDictionaryRow(rowData)).rejects.toEqual(undefined);
-
- }, 2000);
-
- test('Test add dictionary row with errors illegal chars in name', async () => {
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
- let rowData = { name: "test@@", secondLevelDictionary: 0, subDictionaryType: "" };
-
- await expect(instance.addDictionaryRow(rowData)).rejects.toEqual(undefined);
-
- }, 2000);
-
- test('Test update dictionary row with errors illegal chars in name', async () => {
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
- let rowData = { name: "test@@", secondLevelDictionary: 0, subDictionaryType: "" };
-
- await expect(instance.updateDictionaryRow(rowData)).rejects.toEqual(undefined);
- });
-
-
- test('Test add dictionary row with errors (illegal chars)', async () => {
-
- const addReplaceRequest = jest.spyOn(ManageDictionaries.prototype, 'addReplaceDictionaryRequest');
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
- let rowData = { name: "test@@", secondLevelDictionary: 0, subDictionaryType: "" };
-
- await expect(instance.addDictionaryRow(rowData)).rejects.toEqual(undefined);
-
- }, 2000);
-
-
- test('Test delete dictionary row', async () => {
-
- const deleteRequest = jest.spyOn(ManageDictionaries.prototype, 'deleteDictionaryRequest');
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
- const rowData = { name: "newdict", secondLevelDictionary: 0, subDictionaryType: "string" };
-
- await instance.deleteDictionaryRow(rowData);
- expect(deleteRequest).toHaveBeenCalledWith("newdict");
-
- }, 2000);
-
- test('Test handle select dictionary row click', async () => {
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
- const rowData = { name: "newdict", secondLevelDictionary: 0, subDictionaryType: "string" };
-
- instance.handleDictionaryRowClick("event", rowData);
- expect(component.state('currentSelectedDictionary')).toEqual("newdict");
- }, 2000);
-
- test('Test dictionary element row add, update, delete', async () => {
-
- const rowData = {
- createdBy: "admin",
- createdDate: "2020-06-15T13:59:20.467381Z",
- description: "Description",
- name: "Some Elem",
- shortName: "someElem",
- type: "string",
- updatedBy: "admin",
- updatedDate: "2020-06-15T13:59:20.467381Z"
- };
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
-
- const badRowData = {
- description: "Description",
- name: "Some Elem",
- shortName: "someElem",
- type: "string"
- };
-
- await instance.clickHandler();
- await instance.getDictionaryElements("test");
-
- await expect(instance.addDictionaryElementRow(rowData)).resolves.toEqual(undefined);
- await expect(instance.updateDictionaryElementRow(rowData, rowData)).resolves.toEqual(undefined);
- await expect(instance.deleteDictionaryElementRow(rowData)).resolves.toEqual(undefined);
- });
-
- test('Test dictionary element row add with errors', async () => {
-
- const badRowData = {
- description: "",
- name: "",
- shortName: "some#Elem",
- type: ""
- };
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
-
- await expect(instance.addDictionaryElementRow(badRowData)).rejects.toEqual("");
- });
-
- test('Test dictionary element update with error illegal name', async () => {
-
- const badRowData = {
- description: "",
- name: "test@@",
- shortName: "some#Elem",
- type: ""
- };
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
-
- await expect(instance.updateDictionaryElementRow(badRowData)).rejects.toEqual(undefined);
- });
-
- test('Test dictionary element addition with duplicate name error', async () => {
-
- const badRowData = {
- description: "description",
- name: "Alert Type",
- shortName: "alertType",
- type: "string"
- };
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
-
- component.setState({ currentSelectedDictionary: 'test' });
-
- await instance.getDictionaryElements();
- await expect(instance.addDictionaryElementRow(badRowData)).rejects.toEqual("");
- });
-
- test('Test dictionary element addition with empty name error', async () => {
-
- const badRowData = {
- description: "description",
- name: "Alert Type",
- shortName: "",
- type: "string"
- };
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
-
- component.setState({ currentSelectedDictionary: 'test' });
-
- await instance.getDictionaryElements();
- await expect(instance.addDictionaryElementRow(badRowData)).rejects.toEqual("");
- });
-
-
- it('Test Import CSV Sunny Day', async () => {
-
- TemplateMenuService.insDictionaryElements = jest.fn().mockImplementation(() => {
- return Promise.resolve({ ok: true, status: 200 });
- });
-
- let rawCsvData = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsvData += '"alertType","Alert Type","Alert Type Description","string","","admin","2020-06-11T13:56:14.927437Z"';
-
- let expectedResult = [
- {
- description: "Alert Type Description",
- name: "Alert Type",
- shortName: "alertType",
- subDictionary: "",
- type: "string"
- }
- ];
-
- const updateDictionaryElementsRequest = jest.spyOn(ManageDictionaries.prototype, 'updateDictionaryElementsRequest');
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
-
- await expect(instance.importCsvData(rawCsvData)).toEqual('');
- expect(updateDictionaryElementsRequest).toHaveBeenCalledWith(expectedResult);
- });
-
- it('Test Import CSV Mandatory Field Check Errors', () => {
-
- let rawCsvData = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsvData += '"","","","","","",""';
-
- // The empty values for all the fields in row 1 of the rawCsvData will trigger a bunch of errors.
- // Getting Enzyme to properly match them with embedded newlines turned out to be impossible
- // and maybe not desirable anyway; so our test for "success" here is simply that the
- // routine returns a non-empty error string.
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
- expect(instance.importCsvData(rawCsvData)).not.toEqual('');
- });
-
- it('Test Import CSV Errors in Row Data', async () => {
-
- TemplateMenuService.insDictionaryElements = jest.fn().mockImplementation(() => {
- return Promise.resolve({ ok: true, status: 200 });
- });
-
- let rawCsvData = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsvData += '"alert@Type","Alert Type","Alert Type Description","strin","subby","admin","2020-06-11T13:56:14.927437Z"';
-
- let expectedResult = [
- {
- description: "Alert Type Description",
- name: "Alert Type",
- shortName: "alertType",
- subDictionary: "",
- type: "string"
- }
- ];
-
- const updateDictionaryElementsRequest = jest.spyOn(ManageDictionaries.prototype, 'updateDictionaryElementsRequest');
-
- const component = shallow(<ManageDictionaries/>)
- const instance = component.instance();
-
- await expect(instance.importCsvData(rawCsvData)).not.toEqual('');
- });
-
-
- it('Test handleClose', () => {
- fetch.mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "name": "vtest",
- "secondLevelDictionary": 1,
- "subDictionaryType": "string",
- "updatedBy": "test",
- "updatedDate": "05-07-2019 19:09:42"
- });
- }
- });
- });
- const handleClose = jest.spyOn(ManageDictionaries.prototype, 'handleClose');
- const component = shallow(<ManageDictionaries history={ historyMock }/>)
- component.find('[variant="secondary"]').prop('onClick')();
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- handleClose.mockClear();
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/__snapshots__/ManageDictionaries.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/__snapshots__/ManageDictionaries.test.js.snap
deleted file mode 100644
index 6b58363..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ManageDictionaries/__snapshots__/ManageDictionaries.test.js.snap
+++ /dev/null
@@ -1,196 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify ManageDictionaries Test API Successful 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Manage Dictionaries
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <WithStyles(Component)
- columns={
- Array [
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "editable": "onAdd",
- "field": "name",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Dictionary Name",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "field": "secondLevelDictionary",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "lookup": Object {
- "0": "No",
- "1": "Yes",
- },
- "title": "Sub Dictionary ?",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "field": "subDictionaryType",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "lookup": Object {
- "number": "number",
- "string": "string",
- },
- "title": "Dictionary Type",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "editable": "never",
- "field": "updatedBy",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Updated By",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "editable": "never",
- "field": "updatedDate",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Last Updated Date",
- },
- ]
- }
- editable={
- Object {
- "onRowAdd": [Function],
- "onRowDelete": [Function],
- "onRowUpdate": [Function],
- }
- }
- icons={
- Object {
- "Add": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Check": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Clear": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Delete": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "DetailPanel": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Edit": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Export": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Filter": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "FirstPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "LastPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "NextPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "PreviousPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ResetSearch": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Search": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "SortArrow": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ThirdStateCheck": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ViewColumn": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- }
- }
- onRowClick={[Function]}
- options={
- Object {
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "1px solid black",
- "fontSize": "15pt",
- "text": "bold",
- },
- }
- }
- title="Dictionary List"
- />
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/PerformActions.js b/gui-clamp/ui-react/src/components/dialogs/PerformActions.js
deleted file mode 100644
index 428902e..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/PerformActions.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import LoopActionService from '../../api/LoopActionService';
-
-
-export default class PerformActions extends React.Component {
- state = {
- loopName: this.props.loopCache.getLoopName(),
- loopAction: this.props.loopAction
- };
-
- constructor(props, context) {
- super(props, context);
- this.refreshStatus = this.refreshStatus.bind(this);
- }
-
- componentWillReceiveProps(newProps) {
- this.setState({
- loopName: newProps.loopCache.getLoopName(),
- loopAction: newProps.loopAction
- });
- }
-
- componentDidMount() {
- const action = this.state.loopAction;
- const loopName = this.state.loopName;
-
- if (action === 'delete') {
- if (window.confirm('You are about to remove ACM Model "' + loopName +
- '". Select OK to continue with deletion or Cancel to keep the model.') === false) {
- return;
- }
- }
-
- this.props.setBusyLoading(); // Alert top level to start block user clicks
-
- LoopActionService.performAction(loopName, action)
- .then(pars => {
- this.props.showSucAlert("Action " + action + " successfully performed");
- if (action === 'delete') {
- this.props.updateLoopFunction(null);
- this.props.history.push('/');
- } else {
- // refresh status and update loop logs
- this.refreshStatus(loopName);
- }
- })
- .catch(error => {
- this.props.showFailAlert("Action " + action + " failed");
- // refresh status and update loop logs
- this.refreshStatus(loopName);
- })
- .finally(() => this.props.clearBusyLoading());
- }
-
- refreshStatus(loopName) {
-
- this.props.setBusyLoading();
-
- LoopActionService.refreshStatus(loopName)
- .then(data => {
- this.props.updateLoopFunction(data);
- this.props.history.push('/');
- })
- .catch(error => {
- this.props.history.push('/');
- })
- .finally(() => this.props.clearBusyLoading());
- }
-
- render() {
- return null;
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js b/gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js
deleted file mode 100644
index e5a2f9f..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import PerformActions from './PerformActions';
-import LoopCache from '../../api/LoopCache';
-import LoopActionService from '../../api/LoopActionService';
-
-describe('Verify PerformActions', () => {
-
- const loopCache = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca"
- });
-
- it('Test the render method action failed', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const historyMock = { push: jest.fn() };
- const updateLoopFunction = jest.fn();
- const showSucAlert = jest.fn();
- const showFailAlert = jest.fn();
- const setBusyLoading = jest.fn();
- const clearBusyLoading = jest.fn();
-
- LoopActionService.refreshStatus = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
- const component = shallow(<PerformActions loopCache={ loopCache }
- loopAction="submit" history={ historyMock } updateLoopFunction={ updateLoopFunction } showSucAlert={ showSucAlert } showFailAlert={ showFailAlert }
- setBusyLoading={ setBusyLoading } clearBusyLoading={ clearBusyLoading }/>)
- await flushPromises();
- component.update();
-
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test the render method action successful', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const historyMock = { push: jest.fn() };
- const updateLoopFunction = jest.fn();
- const showSucAlert = jest.fn();
- const showFailAlert = jest.fn();
- const setBusyLoading = jest.fn();
- const clearBusyLoading = jest.fn();
-
- LoopActionService.performAction = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
- LoopActionService.refreshStatus = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
- const component = shallow(<PerformActions loopCache={ loopCache }
- loopAction="submit" history={ historyMock } updateLoopFunction={ updateLoopFunction } showSucAlert={ showSucAlert } showFailAlert={ showFailAlert }
- setBusyLoading={ setBusyLoading } clearBusyLoading={ clearBusyLoading }/>)
- await flushPromises();
- component.update();
-
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test the delete method action', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const historyMock = { push: jest.fn() };
- const updateLoopFunction = jest.fn();
- const showSucAlert = jest.fn();
- const showFailAlert = jest.fn();
- const setBusyLoading = jest.fn();
- const clearBusyLoading = jest.fn();
-
- LoopActionService.refreshStatus = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
- const component = shallow(<PerformActions loopCache={ loopCache }
- loopAction="delete" history={ historyMock } updateLoopFunction={ updateLoopFunction } showSucAlert={ showSucAlert } showFailAlert={ showFailAlert }
- setBusyLoading={ setBusyLoading } clearBusyLoading={ clearBusyLoading }/>)
- await flushPromises();
- component.update();
-
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.js
deleted file mode 100644
index 7ec7eef..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import TreeView from '@material-ui/lab/TreeView';
-import TreeItem from '@material-ui/lab/TreeItem';
-import FolderIcon from '@material-ui/icons/Folder';
-import FolderOpenIcon from '@material-ui/icons/FolderOpen';
-import DescriptionIcon from '@material-ui/icons/Description';
-
-
-export default class PoliciesTreeViewer extends React.Component {
-
- separator = ".";
-
- nodesList = new Map();
-
- constructor(props, context) {
- super(props, context);
- this.createPoliciesTree = this.createPoliciesTree.bind(this);
- this.handleTreeItemClick = this.handleTreeItemClick.bind(this);
- this.buildNameWithParent = this.buildNameWithParent.bind(this);
-
- }
-
- state = {
- policiesTreeData: this.createPoliciesTree(this.props.policiesData),
- }
-
- componentDidUpdate(prevProps) {
- if (prevProps.policiesData !== this.props.policiesData) {
- this.setState({policiesTreeData: this.createPoliciesTree(this.props.policiesData)})
- }
- }
-
- createPoliciesTree(policiesArray) {
- console.log('createPoliciesTree called')
- // put my policies array in a Json
- let nodeId = 1;
- let root = {id: nodeId, policyCount: 0, name: "ROOT", children: [], parent: undefined};
- this.nodesList.set(nodeId++, root);
-
- if (policiesArray !== null && policiesArray.forEach !== undefined) {
-
- policiesArray.forEach(policy => {
- let currentTreeNode = root;
- policy[this.props.valueForTreeCreation].split(this.separator).forEach((policyNamePart, index, policyNamePartsArray) => {
- let node = currentTreeNode["children"].find(element => element.name === policyNamePart);
- if (typeof (node) === "undefined") {
- node = {
- id: nodeId,
- policyCount: 0,
- children: [],
- name: policyNamePart,
- parent: currentTreeNode
- };
- this.nodesList.set(nodeId++, node);
- currentTreeNode["children"].push(node);
- }
- if ((index + 1) === policyNamePartsArray.length) {
- ++currentTreeNode["policyCount"];
- }
- currentTreeNode = node;
- })
- });
- }
- return root;
- }
-
- buildNameWithParent(node) {
- let nameToBuild = node.name;
- if (node.parent !== undefined) {
- nameToBuild = this.buildNameWithParent(node.parent) + this.separator + node.name;
- }
- return nameToBuild;
- }
-
- handleTreeItemClick(event, value) {
- let fullName = this.buildNameWithParent(this.nodesList.get(value[0])).substring(5);
- this.props.policiesFilterFunction(fullName);
- }
-
- renderTreeItems(nodes) {
- return (<TreeItem key={nodes.id} nodeId={nodes.id} label={nodes.name + "(" + nodes.policyCount + ")"}
- onNodeSelect={this.handleTreeItemClick}>
- {
- Array.isArray(nodes.children) ? nodes.children.map((node) => this.renderTreeItems(node)) : null
- }
- </TreeItem>);
- };
-
- render() {
- return (
- <TreeView defaultExpanded={['root']} defaultCollapseIcon={<FolderOpenIcon/>}
- defaultExpandIcon={<FolderIcon/>} defaultEndIcon={<DescriptionIcon/>}
- onNodeSelect={this.handleTreeItemClick} multiSelect>
- {this.renderTreeItems(this.state.policiesTreeData)}
- </TreeView>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.test.js
deleted file mode 100644
index 7a6a76a..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.test.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import {shallow} from "enzyme";
-import React from "react";
-import PoliciesTreeViewer from "./PoliciesTreeViewer";
-import fs from "fs";
-import toJson from "enzyme-to-json";
-
-describe('Verify PoliciesTreeViewer', () => {
-
- let toscaPoliciesData = fs.readFileSync('src/components/dialogs/Policy/toscaPoliciesData.test.json', {
- encoding: 'utf8',
- flag: 'r'
- });
- const toscaPoliciesDataArray = JSON.parse(toscaPoliciesData);
-
- const logSpy = jest.spyOn(console, 'log');
-
-
- it("renders correctly", () => {
- const component = shallow(<PoliciesTreeViewer policiesData={'[]'} />);
-
- expect(toJson(component)).toMatchSnapshot();
- });
-
- it("tests createPoliciesTree handler", () => {
- const component = shallow(<PoliciesTreeViewer policiesData={ toscaPoliciesDataArray } valueForTreeCreation="name" />);
- component.setState({ policiesTreeData: toscaPoliciesDataArray });
-
- const instance = component.instance();
- instance.createPoliciesTree(toscaPoliciesDataArray);
-
- expect(logSpy).toHaveBeenCalledWith('createPoliciesTree called');
- expect(component.state('policiesTreeData')).toEqual(toscaPoliciesDataArray);
- });
-
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.js
deleted file mode 100644
index 27eed22..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.js
+++ /dev/null
@@ -1,180 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 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============================================
- * ===================================================================
- *
- */
-
-import React, { forwardRef } from 'react';
-import Modal from 'react-bootstrap/Modal';
-import styled from 'styled-components';
-import Button from 'react-bootstrap/Button';
-import Alert from 'react-bootstrap/Alert';
-import PolicyService from '../../../api/PolicyService';
-import FormGroup from '@material-ui/core/FormGroup';
-import Checkbox from '@material-ui/core/Checkbox';
-import FormControlLabel from '@material-ui/core/FormControlLabel';
-
-const DivWhiteSpaceStyled = styled.div`
- white-space: pre;
-`
-
-const PanelDiv = styled.div`
- text-align: justify;
- font-size: ${ props => props.theme.policyEditorFontSize };
- background-color: ${ props => props.theme.loopViewerBackgroundColor };
-`
-
-export default class PolicyDeploymentEditor extends React.Component {
-
- state = {
- policyData: this.props.policyData,
- showSuccessAlert: false,
- showFailAlert: false,
- checkboxesState: this.createPdpStructure(this.props.policyData),
- checkboxesInitialState: this.createPdpStructure(this.props.policyData),
- };
-
- constructor(props, context) {
- super(props, context);
- this.handleClose = this.handleClose.bind(this);
- this.handleUpdatePdpDeployment = this.handleUpdatePdpDeployment.bind(this);
- this.disableAlert = this.disableAlert.bind(this);
- this.renderPdpDeploymentCheckboxes = this.renderPdpDeploymentCheckboxes.bind(this);
- this.createPdpStructure = this.createPdpStructure.bind(this);
- this.handleCheckboxChange = this.handleCheckboxChange.bind(this);
- this.createPdpGroupOperations = this.createPdpGroupOperations.bind(this);
- }
-
- handleClose() {
- this.setState({ show: false });
-
- }
-
- disableAlert() {
- this.setState({ showSuccessAlert: false, showFailAlert: false });
- }
-
- createPdpGroupOperations(initialStates, newStates) {
- console.log('createPdpGroupOperations called');
- let commandsArray = [];
- initialStates.forEach(initElem => {
- let newStateFound = newStates.find(newElement => newElement.name === initElem.name);
- if (initElem.value !== newStateFound.value) {
- let newPdpGroupsArray = newStateFound.name.split("/");
- let operation = "POST/";
- if (initElem.value) {
- operation = "DELETE/";
- }
- commandsArray.push(operation + newPdpGroupsArray[0] + "/" + newPdpGroupsArray[1] + "/"
- + this.state.policyData.name + "/" + this.state.policyData.version);
- }
- });
- return commandsArray.length > 0 ? { "PdpActions": commandsArray } : undefined;
- }
-
- handleUpdatePdpDeployment() {
- console.log('handleUpdatePdpDeployment called');
- let operationsList = this.createPdpGroupOperations(this.state.checkboxesInitialState,
- this.state.checkboxesState);
- if (typeof (operationsList) !== "undefined") {
- PolicyService.updatePdpDeployment(operationsList).then(respPdpDeploymentUpdate => {
- if (typeof (respPdpDeploymentUpdate) === "undefined") {
- //it indicates a failure
- this.setState({
- showFailAlert: true,
- showMessage: 'Pdp Deployment update Failure'
- });
- } else {
- this.setState({
- showSuccessAlert: true,
- showMessage: 'Pdp Deployment Update successful'
- });
- this.props.policiesTableUpdateFunction();
- }
- })
- } else {
- this.setState({
- showSuccessAlert: true,
- showMessage: 'Pdp Deployment: Nothing to change'
- });
- }
- }
-
- createPdpStructure(policyData) {
- // Create map with data for all group/subgroup where the policy is deployed
- let infoPdpMap = new Map();
- if (typeof policyData.pdpGroupInfo !== "undefined") {
- policyData["pdpGroupInfo"].forEach(pdpGroupElem => {
- let pdpGroupName = Object.keys(pdpGroupElem)[0];
- pdpGroupElem[pdpGroupName]["pdpSubgroups"].forEach(pdpSubGroupElem => {
- infoPdpMap.set(pdpGroupName + "/" + pdpSubGroupElem["pdpType"], true);
- });
- });
- }
- // Create the possible values for pdpgroup/subgroup and tick the ones where policy is deployed
- let pdpStates = [];
- if (typeof policyData.supportedPdpGroups !== "undefined") {
- for (const pdpGroup of policyData["supportedPdpGroups"]) {
- let pdpGroupName = Object.keys(pdpGroup)[0];
- for (const pdpSubGroup of Object.values(pdpGroup)[0]) {
- let fullName = pdpGroupName + "/" + pdpSubGroup;
- pdpStates.push({
- name: fullName,
- value: infoPdpMap.get(fullName) !== undefined
- });
- }
- }
- }
- return pdpStates;
- }
-
- handleCheckboxChange(event) {
- const checkboxesArray = this.state.checkboxesState;
- checkboxesArray.find(element => element.name === event.target.name).value = event.target.checked;
- this.setState({ checkboxesState: checkboxesArray });
- }
-
- renderPdpDeploymentCheckboxes() {
- return this.state.checkboxesState.map(item => {
- return <FormControlLabel control={ <Checkbox checked={ item.value } onChange={ this.handleCheckboxChange }
- name={ item.name }/> } label={ item.name }/>;
- });
- }
-
- render() {
- return (
- <PanelDiv>
- <Alert variant="success" show={ this.state.showSuccessAlert } onClose={ this.disableAlert } dismissible>
- <DivWhiteSpaceStyled>
- { this.state.showMessage }
- </DivWhiteSpaceStyled>
- </Alert>
- <Alert variant="danger" show={ this.state.showFailAlert } onClose={ this.disableAlert } dismissible>
- <DivWhiteSpaceStyled>
- { this.state.showMessage }
- </DivWhiteSpaceStyled>
- </Alert>
- <Button variant="secondary" title="Update the policy to the specified PDP Groups/Subgroups"
- onClick={ this.handleUpdatePdpDeployment }>Update PDP</Button>
- <FormGroup>{ this.renderPdpDeploymentCheckboxes() }</FormGroup>
- </PanelDiv>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.test.js
deleted file mode 100644
index 1ae73a2..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.test.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import {shallow} from "enzyme";
-import toJson from "enzyme-to-json";
-import React from "react";
-import PolicyDeploymentEditor from "./PolicyDeploymentEditor";
-import fs from "fs";
-import LoopService from "../../../api/LoopService";
-
-describe('Verify PolicyDeploymentEditor', () => {
- const toscaPolicyDeploymentEditor = fs.readFileSync('src/components/dialogs/Policy/toscaPolicyDeploymentEditor.test.json', {
- encoding: 'utf8',
- flag: 'r'
- });
-
- const toscaPolicyDeploymentEditorArray = JSON.parse(toscaPolicyDeploymentEditor);
-
- const initialStateTrue = [
- {
- "name": "monitoring/xacml",
- "value": true
- }
- ];
-
- const initialStateFalse = [
- {
- "name": "monitoring/xacml",
- "value": false
- }
- ];
-
- const logSpy = jest.spyOn(console, 'log');
-
- it("renders correctly", () => {
- const component = shallow(<PolicyDeploymentEditor policyData={toscaPolicyDeploymentEditorArray}/>);
- expect(toJson(component)).toMatchSnapshot();
- });
-
- it('Test createPdpGroupOperations', () => {
- const component = shallow(<PolicyDeploymentEditor policyData={toscaPolicyDeploymentEditorArray} />);
-
- const instance = component.instance();
-
- instance.createPdpGroupOperations(initialStateTrue, initialStateTrue);
-
- component.update();
-
- expect(logSpy).toHaveBeenCalledWith('createPdpGroupOperations called');
- });
-
- it('Test handleUpdatePdpDeployment', () => {
- LoopService.updatePdpDeployment = jest.fn().mockImplementation(() => {
- return Promise.resolve(undefined);
- });
-
- const component = shallow(<PolicyDeploymentEditor policyData={toscaPolicyDeploymentEditorArray} />);
- component.setState({checkboxesInitialState: initialStateTrue});
- component.setState({checkboxesState: initialStateFalse});
-
- const instance = component.instance();
- instance.handleUpdatePdpDeployment();
-
- expect(component.state('showFailAlert')).toEqual(false);
- expect(component.state('showMessage')).toEqual(undefined);
-
- component.update();
-
- component.setState({showFailAlert: true});
- component.setState({showMessage: 'Pdp Deployment update Failure'});
-
- expect(logSpy).toHaveBeenCalledWith('handleUpdatePdpDeployment called');
- expect(component.state('showFailAlert')).toEqual(true);
- expect(component.state('showMessage')).toEqual('Pdp Deployment update Failure');
- });
-
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js
deleted file mode 100644
index 1e27541..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js
+++ /dev/null
@@ -1,192 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import PolicyToscaService from '../../../api/PolicyToscaService';
-import { JSONEditor } from '@json-editor/json-editor/dist/nonmin/jsoneditor.js';
-import "@fortawesome/fontawesome-free/css/all.css"
-import styled from 'styled-components';
-import Button from 'react-bootstrap/Button';
-import TextField from '@material-ui/core/TextField';
-import Alert from 'react-bootstrap/Alert';
-import PolicyService from '../../../api/PolicyService';
-import OnapUtils from '../../../utils/OnapUtils';
-
-const DivWhiteSpaceStyled = styled.div`
- white-space: pre;
-`
-
-const JsonEditorDiv = styled.div`
- margin-top: 20px;
- background-color: ${ props => props.theme.loopViewerBackgroundColor };
- text-align: justify;
- font-size: ${ props => props.theme.policyEditorFontSize };
- border: 1px solid #C0C0C0;
-`
-const PanelDiv = styled.div`
- text-align: justify;
- font-size: ${ props => props.theme.policyEditorFontSize };
- background-color: ${ props => props.theme.loopViewerBackgroundColor };
-`
-
-export default class PolicyEditor extends React.Component {
-
- state = {
- policyModelType: this.props.policyModelType,
- policyModelTypeVersion: this.props.policyModelTypeVersion,
- policyName: (typeof this.props.policyName !== "undefined") ? this.props.policyName : "org.onap.policy.new",
- policyVersion: (typeof this.props.policyVersion !== "undefined") ? this.props.policyVersion : "0.0.1",
- policyProperties: this.props.policyProperties,
- showSuccessAlert: false,
- showFailAlert: false,
- jsonEditor: null,
- jsonEditorDivId: this.props.policyModelType + "_" + this.props.policyModelTypeVersion + "_" + this.props.policyName + "_" + this.props.policyVersion,
- }
-
- constructor(props, context) {
- super(props, context);
- this.createJsonEditor = this.createJsonEditor.bind(this);
- this.getToscaModelForPolicy = this.getToscaModelForPolicy.bind(this);
- this.disableAlert = this.disableAlert.bind(this);
- this.handleCreateNewVersion = this.handleCreateNewVersion.bind(this);
- this.handleChangePolicyName = this.handleChangePolicyName.bind(this);
- this.handleChangePolicyVersion = this.handleChangePolicyVersion.bind(this);
- }
-
- disableAlert() {
- this.setState({ showSuccessAlert: false, showFailAlert: false });
- }
-
- customValidation(editorData) {
- // method for sub-classes to override with customized validation
- return [];
- }
-
- handleCreateNewVersion() {
- var editorData = this.state.jsonEditor.getValue();
- var errors = this.state.jsonEditor.validate();
- errors = errors.concat(this.customValidation(editorData));
-
- if (errors.length !== 0) {
- console.error("Errors detected during policy data validation ", errors);
- this.setState({
- showFailAlert: true,
- showMessage: 'Errors detected during policy data validation:\n' + OnapUtils.jsonEditorErrorFormatter(errors)
- });
- return;
- } else {
- console.info("NO validation errors found in policy data");
- PolicyService.createNewPolicy(this.state.policyModelType, this.state.policyModelTypeVersion,
- this.state.policyName, this.state.policyVersion, editorData).then(respPolicyCreation => {
- if (typeof (respPolicyCreation) === "undefined") {
- //it indicates a failure
- this.setState({
- showFailAlert: true,
- showMessage: 'Policy Creation Failure'
- });
- } else {
- this.setState({
- showSuccessAlert: true,
- showMessage: 'Policy ' + this.state.policyName + '/' + this.state.policyVersion + ' created successfully'
- });
- this.props.policiesTableUpdateFunction();
- }
- })
- }
- }
-
- getToscaModelForPolicy() {
- PolicyToscaService.getToscaPolicyModel(this.state.policyModelType, this.state.policyModelTypeVersion).then(respJsonPolicyTosca => {
- if (respJsonPolicyTosca !== {}) {
- this.setState({
- jsonSchemaPolicyTosca: respJsonPolicyTosca,
- jsonEditor: this.createJsonEditor(respJsonPolicyTosca, this.state.policyProperties),
- })
- }
- });
- }
-
- componentDidMount() {
- this.getToscaModelForPolicy();
- }
-
- createJsonEditor(toscaModel, editorData) {
- return new JSONEditor(document.getElementById(this.state.jsonEditorDivId),
- {
- schema: toscaModel,
- startval: editorData,
- theme: 'bootstrap4',
- iconlib: 'fontawesome5',
- object_layout: 'grid',
- disable_properties: false,
- disable_edit_json: false,
- disable_array_reorder: true,
- disable_array_delete_last_row: true,
- disable_array_delete_all_rows: false,
- array_controls_top: true,
- keep_oneof_values: false,
- collapsed: true,
- show_errors: 'always',
- display_required_only: false,
- show_opt_in: false,
- prompt_before_delete: true,
- required_by_default: false
- })
- }
-
- handleChangePolicyName(event) {
- this.setState({
- policyName: event.target.value,
- });
- }
-
- handleChangePolicyVersion(event) {
- this.setState({
- policyVersion: event.target.value,
- });
- }
-
- render() {
- return (
- <PanelDiv>
- <Alert variant="success" show={ this.state.showSuccessAlert } onClose={ this.disableAlert } dismissible>
- <DivWhiteSpaceStyled>
- { this.state.showMessage }
- </DivWhiteSpaceStyled>
- </Alert>
- <Alert variant="danger" show={ this.state.showFailAlert } onClose={ this.disableAlert } dismissible>
- <DivWhiteSpaceStyled>
- { this.state.showMessage }
- </DivWhiteSpaceStyled>
- </Alert>
- <TextField required id="policyName" label="Required" defaultValue={ this.state.policyName }
- onChange={ this.handleChangePolicyName } variant="outlined" size="small"/>
- <TextField required id="policyVersion" label="Required" defaultValue={ this.state.policyVersion }
- onChange={ this.handleChangePolicyVersion } size="small" variant="outlined"/>
- <Button variant="secondary" title="Create a new policy version from the defined parameters"
- onClick={ this.handleCreateNewVersion }>Create New Version</Button>
- <JsonEditorDiv id={ this.state.jsonEditorDivId } title="Policy Properties"/>
- </PanelDiv>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.test.js
deleted file mode 100644
index 339d660..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.test.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import PolicyEditor from './PolicyEditor';
-import { shallow, mount } from 'enzyme';
-import PolicyToscaService from '../../../api/PolicyToscaService';
-
-describe('Verify PolicyEditor', () => {
- const fs = require('fs');
-
- let toscaJson = fs.readFileSync('src/components/dialogs/Policy/toscaData.test.json', { encoding: 'utf8', flag: 'r' })
-
- const policyProperties = {
- "tca.policy": {
- "domain": "measurementsForVfScaling",
- "metricsPerEventName": [
- {
- "policyScope": "DCAE",
- "thresholds": [
- {
- "version": "1.0.2",
- "severity": "MAJOR",
- "thresholdValue": 200,
- "closedLoopEventStatus": "ONSET",
- "closedLoopControlName": "LOOP_test",
- "direction": "LESS_OR_EQUAL",
- "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta"
- }
- ],
- "eventName": "vLoadBalancer",
- "policyVersion": "v0.0.1",
- "acmSchemaType": "VM",
- "policyName": "DCAE.Config_tca-hi-lo"
- }
- ]
- }
- };
-
- it('Test the render method', async () => {
- PolicyToscaService.getToscaPolicyModel = jest.fn().mockImplementation(() => {
- return Promise.resolve(toscaJson);
- });
-
- const component = mount(<PolicyEditor policyModelType="onap.policies.monitoring.tcagen2" policyModelTypeVersion="1.0.0"
- policyName="org.onap.new" policyVersion="1.0.0" policyProperties={ policyProperties }
- policiesTableUpdateFunction={ () => {
- } }/>);
- await PolicyToscaService.getToscaPolicyModel();
- expect(component).toMatchSnapshot();
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyModal.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyModal.js
deleted file mode 100644
index 0c7637c..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyModal.js
+++ /dev/null
@@ -1,349 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2020-2021 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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import Button from 'react-bootstrap/Button';
-import Form from 'react-bootstrap/Form';
-import Col from 'react-bootstrap/Col';
-import Row from 'react-bootstrap/Row';
-import Select from 'react-select';
-import Modal from 'react-bootstrap/Modal';
-import styled from 'styled-components';
-import LoopService from '../../../api/LoopService';
-import LoopCache from '../../../api/LoopCache';
-import { JSONEditor } from '@json-editor/json-editor/dist/jsoneditor.js';
-import "@fortawesome/fontawesome-free/css/all.css"
-import Alert from 'react-bootstrap/Alert';
-import OnapConstant from '../../../utils/OnapConstants';
-import OnapUtils from '../../../utils/OnapUtils';
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-const DivWhiteSpaceStyled = styled.div`
- white-space: pre;
-`
-
-export default class PolicyModal extends React.Component {
-
- state = {
- show: true,
- loopCache: this.props.loopCache,
- jsonEditor: null,
- policyName: this.props.match.params.policyName,
- // This is to indicate whether it's an operational or config policy (in terms of loop instance)
- policyInstanceType: this.props.match.params.policyInstanceType,
- pdpGroup: null,
- pdpGroupList: [],
- pdpSubgroupList: [],
- chosenPdpGroup: '',
- chosenPdpSubgroup: '',
- showSucAlert: false,
- showFailAlert: false
- };
-
- constructor(props, context) {
- super(props, context);
- this.handleClose = this.handleClose.bind(this);
- this.handleSave = this.handleSave.bind(this);
- this.renderJsonEditor = this.renderJsonEditor.bind(this);
- this.handlePdpGroupChange = this.handlePdpGroupChange.bind(this);
- this.handlePdpSubgroupChange = this.handlePdpSubgroupChange.bind(this);
- this.createJsonEditor = this.createJsonEditor.bind(this);
- this.handleRefresh = this.handleRefresh.bind(this);
- this.disableAlert = this.disableAlert.bind(this);
- this.renderPdpGroupDropDown = this.renderPdpGroupDropDown.bind(this);
- this.renderOpenLoopMessage = this.renderOpenLoopMessage.bind(this);
- this.renderModalTitle = this.renderModalTitle.bind(this);
- this.readOnly = props.readOnly !== undefined ? props.readOnly : false;
- }
-
- handleSave() {
- var editorData = this.state.jsonEditor.getValue();
- var errors = this.state.jsonEditor.validate();
- errors = errors.concat(this.customValidation(editorData, this.state.loopCache.getTemplateName()));
-
- if (errors.length !== 0) {
- console.error("Errors detected during policy data validation ", errors);
- this.setState({
- showFailAlert: true,
- showMessage: 'Errors detected during policy data validation:\n' + OnapUtils.jsonEditorErrorFormatter(errors)
- });
- return;
- } else {
- console.info("NO validation errors found in policy data");
- if (this.state.policyInstanceType === OnapConstant.microServiceType) {
- this.state.loopCache.updateMicroServiceProperties(this.state.policyName, editorData);
- this.state.loopCache.updateMicroServicePdpGroup(this.state.policyName, this.state.chosenPdpGroup, this.state.chosenPdpSubgroup);
- LoopService.setMicroServiceProperties(this.state.loopCache.getLoopName(), this.state.loopCache.getMicroServiceForName(this.state.policyName)).then(resp => {
- this.setState({ show: false });
- this.props.history.push('/');
- this.props.loadLoopFunction(this.state.loopCache.getLoopName());
- });
- } else if (this.state.policyInstanceType === OnapConstant.operationalPolicyType) {
- this.state.loopCache.updateOperationalPolicyProperties(this.state.policyName, editorData);
- this.state.loopCache.updateOperationalPolicyPdpGroup(this.state.policyName, this.state.chosenPdpGroup, this.state.chosenPdpSubgroup);
- LoopService.setOperationalPolicyProperties(this.state.loopCache.getLoopName(), this.state.loopCache.getOperationalPolicies()).then(resp => {
- this.setState({ show: false });
- this.props.history.push('/');
- this.props.loadLoopFunction(this.state.loopCache.getLoopName());
- });
- }
- }
- }
-
- customValidation(editorData, templateName) {
- // method for sub-classes to override with customized validation
- return [];
- }
-
- handleClose() {
- this.setState({ show: false });
- this.props.history.push('/');
- }
-
- componentDidMount() {
- this.renderJsonEditor();
- }
-
- componentDidUpdate() {
- if (this.state.showSucAlert === true || this.state.showFailAlert === true) {
- let modalElement = document.getElementById("policyModal")
- if (modalElement) {
- modalElement.scrollTo(0, 0);
- }
- }
- }
-
- createJsonEditor(toscaModel, editorData) {
- return new JSONEditor(document.getElementById("editor"),
- {
- schema: toscaModel,
- startval: editorData,
- theme: 'bootstrap4',
- iconlib: 'fontawesome5',
- object_layout: 'grid',
- disable_properties: false,
- disable_edit_json: false,
- disable_array_reorder: true,
- disable_array_delete_last_row: true,
- disable_array_delete_all_rows: false,
- array_controls_top: true,
- keep_oneof_values: false,
- collapsed: true,
- show_errors: 'always',
- display_required_only: false,
- show_opt_in: false,
- prompt_before_delete: true,
- required_by_default: false
- })
- }
-
- renderJsonEditor() {
- console.debug("Rendering PolicyModal ", this.state.policyName);
- var toscaModel = {};
- var editorData = {};
- var pdpGroupValues = {};
- var chosenPdpGroupValue, chosenPdpSubgroupValue;
- if (this.state.policyInstanceType === OnapConstant.microServiceType) {
- toscaModel = this.state.loopCache.getMicroServiceJsonRepresentationForName(this.state.policyName);
- editorData = this.state.loopCache.getMicroServicePropertiesForName(this.state.policyName);
- pdpGroupValues = this.state.loopCache.getMicroServiceSupportedPdpGroup(this.state.policyName);
- chosenPdpGroupValue = this.state.loopCache.getMicroServicePdpGroup(this.state.policyName);
- chosenPdpSubgroupValue = this.state.loopCache.getMicroServicePdpSubgroup(this.state.policyName);
- } else if (this.state.policyInstanceType === OnapConstant.operationalPolicyType) {
- toscaModel = this.state.loopCache.getOperationalPolicyJsonRepresentationForName(this.state.policyName);
- editorData = this.state.loopCache.getOperationalPolicyPropertiesForName(this.state.policyName);
- pdpGroupValues = this.state.loopCache.getOperationalPolicySupportedPdpGroup(this.state.policyName);
- chosenPdpGroupValue = this.state.loopCache.getOperationalPolicyPdpGroup(this.state.policyName);
- chosenPdpSubgroupValue = this.state.loopCache.getOperationalPolicyPdpSubgroup(this.state.policyName);
- }
-
- if (toscaModel == null) {
- return;
- }
-
- var pdpSubgroupValues = [];
- if (typeof (chosenPdpGroupValue) !== "undefined") {
- var selectedPdpGroup = pdpGroupValues.filter(entry => (Object.keys(entry)[0] === chosenPdpGroupValue));
- pdpSubgroupValues = selectedPdpGroup[0][chosenPdpGroupValue].map((pdpSubgroup) => {
- return { label: pdpSubgroup, value: pdpSubgroup }
- });
- }
- this.setState({
- jsonEditor: this.createJsonEditor(toscaModel, editorData),
- pdpGroup: pdpGroupValues,
- pdpGroupList: pdpGroupValues.map(entry => {
- return { label: Object.keys(entry)[0], value: Object.keys(entry)[0] };
- }),
- pdpSubgroupList: pdpSubgroupValues,
- chosenPdpGroup: chosenPdpGroupValue,
- chosenPdpSubgroup: chosenPdpSubgroupValue
- })
- }
-
- handlePdpGroupChange(e) {
- var selectedPdpGroup = this.state.pdpGroup.filter(entry => (Object.keys(entry)[0] === e.value));
- const pdpSubgroupValues = selectedPdpGroup[0][e.value].map((pdpSubgroup) => {
- return { label: pdpSubgroup, value: pdpSubgroup }
- });
- if (this.state.chosenPdpGroup !== e.value) {
- this.setState({
- chosenPdpGroup: e.value,
- chosenPdpSubgroup: '',
- pdpSubgroupList: pdpSubgroupValues
- });
- }
- }
-
- handlePdpSubgroupChange(e) {
- this.setState({ chosenPdpSubgroup: e.value });
- }
-
- handleRefresh() {
- var newLoopCache, toscaModel, editorData;
- if (this.state.policyInstanceType === OnapConstant.microServiceType) {
- LoopService.refreshMicroServicePolicyJson(this.state.loopCache.getLoopName(), this.state.policyName).then(data => {
- newLoopCache = new LoopCache(data);
- toscaModel = newLoopCache.getMicroServiceJsonRepresentationForName(this.state.policyName);
- editorData = newLoopCache.getMicroServicePropertiesForName(this.state.policyName);
- document.getElementById("editor").innerHTML = "";
- this.setState({
- loopCache: newLoopCache,
- jsonEditor: this.createJsonEditor(toscaModel, editorData),
- showSucAlert: true,
- showMessage: "Successfully refreshed"
- });
- })
- .catch(error => {
- console.error("Error while refreshing the Operational Policy Json Representation");
- this.setState({
- showFailAlert: true,
- showMessage: "Refreshing of UI failed"
- });
- });
- } else if (this.state.policyInstanceType === OnapConstant.operationalPolicyType) {
- LoopService.refreshOperationalPolicyJson(this.state.loopCache.getLoopName(), this.state.policyName).then(data => {
- var newLoopCache = new LoopCache(data);
- toscaModel = newLoopCache.getOperationalPolicyJsonRepresentationForName(this.state.policyName);
- editorData = newLoopCache.getOperationalPolicyPropertiesForName(this.state.policyName);
- document.getElementById("editor").innerHTML = "";
- this.setState({
- loopCache: newLoopCache,
- jsonEditor: this.createJsonEditor(toscaModel, editorData),
- showSucAlert: true,
- showMessage: "Successfully refreshed"
- });
- })
- .catch(error => {
- console.error("Error while refreshing the Operational Policy Json Representation");
- this.setState({
- showFailAlert: true,
- showMessage: "Refreshing of UI failed"
- });
- });
- }
- }
-
- disableAlert() {
- this.setState({ showSucAlert: false, showFailAlert: false });
- }
-
- renderPdpGroupDropDown() {
- if (this.state.policyInstanceType !== OnapConstant.operationalPolicyType || !this.state.loopCache.isOpenLoopTemplate()) {
- return (
- <Form.Group as={ Row } controlId="formPlaintextEmail">
- <Form.Label column sm="2">Pdp Group Info</Form.Label>
- <Col sm="3">
- <Select value={ { label: this.state.chosenPdpGroup, value: this.state.chosenPdpGroup } } onChange={ this.handlePdpGroupChange } options={ this.state.pdpGroupList }/>
- </Col>
- <Col sm="3">
- <Select value={ { label: this.state.chosenPdpSubgroup, value: this.state.chosenPdpSubgroup } } onChange={ this.handlePdpSubgroupChange } options={ this.state.pdpSubgroupList }/>
- </Col>
- </Form.Group>
- );
- }
- }
-
- renderOpenLoopMessage() {
- if (this.state.policyInstanceType === OnapConstant.operationalPolicyType && this.state.loopCache.isOpenLoopTemplate()) {
- return (
- "Operational Policy cannot be configured as only Open Loop is supported for this Template!"
- );
- }
- }
-
- renderModalTitle() {
- return (
- <Modal.Title>Edit the policy</Modal.Title>
- );
- }
-
- renderButton() {
- var allElement = [(<Button key="close" variant="secondary" onClick={ this.handleClose }>
- Close
- </Button>)];
- if (this.state.policyInstanceType !== OnapConstant.operationalPolicyType || !this.state.loopCache.isOpenLoopTemplate()) {
- allElement.push((
- <Button key="save" variant="primary" disabled={ this.readOnly } onClick={ this.handleSave }>
- Save Changes
- </Button>
- ));
- allElement.push((
- <Button key="refresh" variant="primary" disabled={ this.readOnly } onClick={ this.handleRefresh }>
- Refresh
- </Button>
- ));
- }
- return allElement;
- }
-
- render() {
- return (
- <ModalStyled size="xl" backdrop="static" keyboard={ false } show={ this.state.show } onHide={ this.handleClose }>
- <Modal.Header closeButton>
- { this.renderModalTitle() }
- </Modal.Header>
- <Alert variant="success" show={ this.state.showSucAlert } onClose={ this.disableAlert } dismissible>
- <DivWhiteSpaceStyled>
- { this.state.showMessage }
- </DivWhiteSpaceStyled>
- </Alert>
- <Alert variant="danger" show={ this.state.showFailAlert } onClose={ this.disableAlert } dismissible>
- <DivWhiteSpaceStyled>
- { this.state.showMessage }
- </DivWhiteSpaceStyled>
- </Alert>
- <Modal.Body>
- { this.renderOpenLoopMessage() }
- <div id="editor"/>
- { this.renderPdpGroupDropDown() }
- </Modal.Body>
- <Modal.Footer>
- { this.renderButton() }
- </Modal.Footer>
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyModal.test.js
deleted file mode 100644
index 0f7d528..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyModal.test.js
+++ /dev/null
@@ -1,185 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { mount } from 'enzyme';
-import PolicyModal from './PolicyModal';
-import LoopCache from '../../../api/LoopCache';
-import LoopService from '../../../api/LoopService';
-import OnapConstant from '../../../utils/OnapConstants';
-import { shallow } from 'enzyme';
-
-describe('Verify PolicyModal', () => {
- beforeEach(() => {
- fetch.resetMocks();
- fetch.mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- text: () => "OK"
- });
- });
- })
- const loopCacheStr = {
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "operationalPolicies": [{
- "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
- "configurationsJson": {
- "operational_policy": {
- "acm": {},
- "policies": []
- }
- },
- "policyModel": { "policyPdpGroup": { "supportedPdpGroups": [{ "monitoring": ["xacml"] }] } },
- "jsonRepresentation": { "schema": {} }
- }]
- };
-
- const loopCacheStrMC = {
- "name": "MICROSERVICE_type_tca",
- "microServicePolicies": [{
- "name": "MICROSERVICE_type",
- "configurationsJson": {
- "operational_policy": {
- "acm": {},
- "policies": []
- }
- },
- "policyModel": { "policyPdpGroup": { "supportedPdpGroups": [{ "monitoring": ["xacml"] }] } },
- "jsonRepresentation": { "schema": {} }
- }]
- };
-
- const loopCache = new LoopCache(loopCacheStr);
- const historyMock = { push: jest.fn() };
- const flushPromises = () => new Promise(setImmediate);
- const match = { params: { policyName: "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca", policyInstanceType: OnapConstant.operationalPolicyType } }
- const loopCacheMicroService = new LoopCache(loopCacheStrMC);
- const matchMicroService = { params: { policyName: "MICROSERVICE_type", policyInstanceType: OnapConstant.microServiceType } }
-
- it('Test handleClose', () => {
- const handleClose = jest.spyOn(PolicyModal.prototype, 'handleClose');
- const component = mount(<PolicyModal history={ historyMock } match={ match } loopCache={ loopCache }/>)
-
- component.find('[variant="secondary"]').prop('onClick')();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test handleSave', async () => {
- const loadLoopFunction = jest.fn();
- const handleSave = jest.spyOn(PolicyModal.prototype, 'handleSave');
- const component = mount(<PolicyModal history={ historyMock }
- loopCache={ loopCache } match={ match } loadLoopFunction={ loadLoopFunction }/>)
-
- component.find('[variant="primary"]').get(0).props.onClick();
- await flushPromises();
- component.update();
-
- expect(handleSave).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test handleSave MicroService', async () => {
- const loadLoopFunctionMC = jest.fn();
- const handleSaveMC = jest.spyOn(PolicyModal.prototype, 'handleSave');
- const componentMC = mount(<PolicyModal history={ historyMock }
- loopCache={ loopCacheMicroService } match={ matchMicroService } loadLoopFunction={ loadLoopFunctionMC }/>)
- componentMC.find('[variant="primary"]').get(0).props.onClick();
- await flushPromises();
- componentMC.update();
-
- expect(handleSaveMC).toHaveBeenCalledTimes(2); //The 1st call it's done in the previous test
- expect(componentMC.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test handleRefresh', async () => {
- LoopService.refreshOperationalPolicyJson = jest.fn().mockImplementation(() => {
- return Promise.resolve(loopCacheStr);
- });
- const updateLoopFunction = jest.fn();
- const handleRefresh = jest.spyOn(PolicyModal.prototype, 'handleRefresh');
- const component = mount(<PolicyModal loopCache={ loopCache } match={ match } updateLoopFunction={ updateLoopFunction }/>)
-
- component.find('[variant="primary"]').get(1).props.onClick();
- await flushPromises();
- component.update();
-
- expect(handleRefresh).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(true);
- expect(component.state('showSucAlert')).toEqual(true);
- expect(component.state('showMessage')).toEqual("Successfully refreshed");
- });
-
- it('Test handleRefresh MicroService Fail', async () => {
- LoopService.refreshOperationalPolicyJson = jest.fn().mockImplementation(() => {
- return Promise.resolve(loopCacheStrMC);
- });
- const updateLoopFunction = jest.fn();
- const handleRefresh = jest.spyOn(PolicyModal.prototype, 'handleRefresh');
- const component = mount(<PolicyModal loopCache={ loopCacheMicroService } match={ matchMicroService } updateLoopFunction={ updateLoopFunction }/>)
-
- component.find('[variant="primary"]').get(1).props.onClick();
- await flushPromises();
- component.update();
-
- expect(handleRefresh).toHaveBeenCalledTimes(2);
- expect(component.state('show')).toEqual(true);
- expect(component.state('showSucAlert')).toEqual(false);
- expect(component.state('showMessage')).toEqual("Refreshing of UI failed");
- });
-
- it('Test handlePdpGroupChange', () => {
- const component = mount(<PolicyModal loopCache={ loopCache } match={ match }/>)
- component.setState({
- "pdpGroup": [{ "option1": ["subPdp1", "subPdp2"] }],
- "chosenPdpGroup": "option2"
- });
- expect(component.state('chosenPdpGroup')).toEqual("option2");
-
- const instance = component.instance();
- const event = { label: "option1", value: "option1" }
- instance.handlePdpGroupChange(event);
- expect(component.state('chosenPdpGroup')).toEqual("option1");
- expect(component.state('chosenPdpSubgroup')).toEqual("");
- expect(component.state('pdpSubgroupList')).toEqual([{ label: "subPdp1", value: "subPdp1" }, { label: "subPdp2", value: "subPdp2" }]);
- });
-
- it('Test handlePdpSubgroupChange', () => {
- const component = mount(<PolicyModal loopCache={ loopCache } match={ match }/>)
-
- const instance = component.instance();
- const event = { label: "option1", value: "option1" }
- instance.handlePdpSubgroupChange(event);
- expect(component.state('chosenPdpSubgroup')).toEqual("option1");
- });
-
- it('Test the render method', () => {
- const component = shallow(<PolicyModal loopCache={ loopCache } match={ match }/>)
- expect(component).toMatchSnapshot();
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.js
deleted file mode 100644
index 8051059..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import Modal from 'react-bootstrap/Modal';
-import Form from 'react-bootstrap/Form';
-import Row from 'react-bootstrap/Row';
-import Col from 'react-bootstrap/Col';
-import styled from 'styled-components';
-import Alert from 'react-bootstrap/Alert';
-import { Button, SvgIcon } from "@material-ui/core";
-import PublishIcon from '@material-ui/icons/Publish';
-import PolicyService from "../../../api/PolicyService";
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-const StyledMessagesDiv = styled.div`
- overflow: auto;
- max-height: 300px;
-`
-
-
-export default class PolicyToscaFileSelector extends React.Component {
-
- state = {
- show: this.props.show,
- alertMessages: [],
- }
-
- constructor(props, context) {
- super(props, context);
- this.handleClose = this.handleClose.bind(this);
- this.onFileChange = this.onFileChange.bind(this);
- }
-
- componentDidUpdate(prevProps) {
- if (this.props.show !== this.state.show) {
- this.setState({ show: this.props.show });
- }
- }
-
- handleClose() {
- this.props.disableFunction();
- this.setState({ alertMessages: [] });
- }
-
- onFileChange(target) {
- console.log('onFileChange target');
- this.setState({ alertMessages: [] });
- target.currentTarget.files.forEach(file => {
- const fileReader = new FileReader();
- fileReader.readAsDataURL(file);
- fileReader.onload = (content) => {
- PolicyService.sendNewPolicyModel(atob(content.target.result.split(",")[1])).then(respModelCreate => {
- if (typeof (respModelCreate) === "undefined") {
- //it indicates a failure
- this.setState(state => {
- return {
- alertMessages: [...state.alertMessages, (<Alert variant="danger"><Alert.Heading>{ file.name }</Alert.Heading><p>Policy Tosca Model Creation Failure</p>
- <hr/>
- <p>Type: { file.type }</p><p>Size: { file.size }</p></Alert>)]
- };
- });
- } else {
- this.props.toscaTableUpdateFunction();
- this.setState(state => {
- return {
- alertMessages: [...state.alertMessages, (<Alert variant="success"><Alert.Heading>{ file.name }</Alert.Heading><p>Policy Tosca Model Created Successfully</p>
- <hr/>
- <p>Type: { file.type }</p><p>Size: { file.size }</p></Alert>)]
- };
- });
- }
- });
- };
- });
-
- }
-
- render() {
- return (
- <ModalStyled size="lg" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>Create New Policy Tosca Model</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <Form.Group as={ Row } controlId="formPlaintextEmail">
- <Col sm="10">
- <input type="file" multiple accept=".yaml,.yml" id="fileUploadButton" style={ { display: 'none' } } onChange={ this.onFileChange }/>
- <label htmlFor={ 'fileUploadButton' }>
- <Button color="primary" variant="contained" component="span"
- startIcon={
- <SvgIcon fontSize="small">
- <PublishIcon/>
- </SvgIcon>
- }>
- Upload Files
- </Button>
- <p>(Only YAML files are supported)</p>
- </label>
- <StyledMessagesDiv>
- { this.state.alertMessages }
- </StyledMessagesDiv>
- </Col>
- </Form.Group>
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary" onClick={ this.handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.test.js
deleted file mode 100644
index 412b1b0..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.test.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import {shallow} from "enzyme";
-import toJson from "enzyme-to-json";
-import React from "react";
-import PolicyToscaFileSelector from "./PolicyToscaFileSelector";
-import PolicyService from "../../../api/PolicyService";
-import Alert from "react-bootstrap/Alert";
-import PolicyToscaService from "../../../api/PolicyToscaService";
-import fs from "fs";
-
-describe('Verify PolicyToscaFileSelector', () => {
-
- let toscaPoliciesList = fs.readFileSync('src/components/dialogs/Policy/toscaPoliciesList.test.json', {
- encoding: 'utf8',
- flag: 'r'
- });
-
- const uploadFile = JSON.stringify(
- {
- name: 'test-file.yaml',
- lastModified: 1639414348371,
- lastModifiedDate: 'Sat Jan 1 2022 00:00:01 GMT+0000',
- size: 32880,
- type: ''
- });
-
- const file = new Blob([uploadFile], {type: 'file'})
- const logSpy = jest.spyOn(console, 'log');
-
- const alertMessages = [(
- <Alert variant="success"><Alert.Heading>{file.name}</Alert.Heading><p>Policy Tosca Model Creation Test</p>
- <hr/>
- <p>Type: {file.type}</p><p>Size: {file.size}</p></Alert>)];
-
- it("renders correctly", () => {
- const component = shallow(<PolicyToscaFileSelector/>);
- expect(toJson(component)).toMatchSnapshot();
- });
-
- it('Test handleClose', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const showFileSelectorMock = jest.fn();
- const showFileSelector = showFileSelectorMock.bind({
- showFileSelector: false
- });
- const handleClose = jest.spyOn(PolicyToscaFileSelector.prototype, 'handleClose');
- const component = shallow(<PolicyToscaFileSelector disableFunction={showFileSelector} show={false}/>);
-
- component.find('[variant="secondary"]').get(0).props.onClick();
- await flushPromises();
- component.update();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
-
- handleClose.mockClear();
- });
-
- it('handleClose called when top-right button clicked', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const showFileSelectorMock = jest.fn();
- const showFileSelector = showFileSelectorMock.bind({
- showFileSelector: false
- });
- const handleClose = jest.spyOn(PolicyToscaFileSelector.prototype, 'handleClose');
- const component = shallow(<PolicyToscaFileSelector disableFunction={showFileSelector} show={false}/>);
-
- component.find('[size="lg"]').get(0).props.onHide();
- await flushPromises();
- component.update();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
-
- handleClose.mockClear();
- });
-
- it("onFileChange called when upload button clicked", () => {
- PolicyService.sendNewPolicyModel = jest.fn().mockImplementation(() => {
- return Promise.resolve({});
- });
-
- const component = shallow(<PolicyToscaFileSelector/>);
- const instance = component.instance();
- const target = {
- currentTarget: {files: [file]}
- }
-
- instance.onFileChange(target);
-
- component.find('[type="file"]').get(0).props.onChange(target);
- expect(logSpy).toHaveBeenCalledWith('onFileChange target');
- });
-
- it("setAlertMessage state", () => {
- PolicyToscaService.getToscaPolicyModels = jest.fn().mockImplementation(() => {
- return Promise.resolve(toscaPoliciesList);
- });
- const getAllToscaModelsMock = jest.fn();
- const getAllToscaModels = getAllToscaModelsMock.bind({
- toscaModelsListData: toscaPoliciesList,
- toscaModelsListDataFiltered: toscaPoliciesList
- });
-
- const component = shallow(<PolicyToscaFileSelector toscaTableUpdateFunction={getAllToscaModels}/>);
- component.setState({alertMessages: alertMessages});
-
- expect(component.state('alertMessages')).toEqual(alertMessages);
- });
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/ToscaViewer.js b/gui-clamp/ui-react/src/components/dialogs/Policy/ToscaViewer.js
deleted file mode 100644
index fc69a63..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/ToscaViewer.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import PolicyToscaService from '../../../api/PolicyToscaService';
-import styled from 'styled-components';
-import Button from 'react-bootstrap/Button';
-
-const ToscaDiv = styled.div`
- background-color: ${ props => props.theme.toscaTextareaBackgroundColor };
- text-align: justify;
- font-size: ${ props => props.theme.toscaTextareaFontSize };
- width: 100%;
- height: 30%;
-`
-
-export default class ToscaViewer extends React.Component {
-
- state = {
- toscaData: this.props.toscaData,
- yamlPolicyTosca: this.getToscaModelYamlFor(this.props.toscaData),
- }
-
- constructor(props, context) {
- super(props, context);
- this.getToscaModelYamlFor = this.getToscaModelYamlFor.bind(this);
- }
-
- getToscaModelYamlFor(toscaData) {
- PolicyToscaService.getToscaPolicyModelYaml(toscaData["policyModelType"], toscaData["version"]).then(respYamlPolicyTosca => {
- this.setState({
- yamlPolicyTosca: respYamlPolicyTosca,
- })
- });
- }
-
- render() {
- return (
- <ToscaDiv>
- <pre>{ this.state.yamlPolicyTosca }</pre>
- <Button variant="secondary" title="Create a new policy version from the defined parameters"
- onClick={ this.handleCreateNewVersion }>Create New Version</Button>
- </ToscaDiv>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/ToscaViewer.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/ToscaViewer.test.js
deleted file mode 100644
index 538f0a8..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/ToscaViewer.test.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import ToscaViewer from './ToscaViewer';
-import { shallow, mount } from 'enzyme';
-import PolicyToscaService from '../../../api/PolicyToscaService';
-
-describe('Verify ToscaViewer', () => {
- const fs = require('fs');
-
- let toscaYaml = fs.readFileSync('src/components/dialogs/Policy/toscaData.test.yaml', { encoding: 'utf8', flag: 'r' })
-
- const toscaData = {
- "policyModelType": "onap.policies.acm.Guard",
- "version": "1.0.0",
- "policyAcronym": "Guard",
- "createdDate": "2021-04-09T02:29:31.407356Z",
- "updatedDate": "2021-04-09T02:29:31.407356Z",
- "updatedBy": "Not found",
- "createdBy": "Not found",
- "tableData": {
- "id": 0
- }
- };
-
- it('Test the render method', async () => {
- PolicyToscaService.getToscaPolicyModelYaml = jest.fn().mockImplementation(() => {
- return Promise.resolve(toscaYaml);
- });
- const component = shallow(<ToscaViewer toscaData={ toscaData }/>);
- await PolicyToscaService.getToscaPolicyModelYaml();
- expect(component).toMatchSnapshot();
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js b/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js
deleted file mode 100644
index 8f8bd51..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js
+++ /dev/null
@@ -1,476 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-
-import React, { forwardRef } from 'react'
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import styled from 'styled-components';
-import AddBox from '@material-ui/icons/AddBox';
-import ArrowDownward from '@material-ui/icons/ArrowDownward';
-import Check from '@material-ui/icons/Check';
-import ChevronLeft from '@material-ui/icons/ChevronLeft';
-import ChevronRight from '@material-ui/icons/ChevronRight';
-import Clear from '@material-ui/icons/Clear';
-import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
-import Edit from '@material-ui/icons/Edit';
-import FilterList from '@material-ui/icons/FilterList';
-import FirstPage from '@material-ui/icons/FirstPage';
-import LastPage from '@material-ui/icons/LastPage';
-import Remove from '@material-ui/icons/Remove';
-import SaveAlt from '@material-ui/icons/SaveAlt';
-import Search from '@material-ui/icons/Search';
-import ViewColumn from '@material-ui/icons/ViewColumn';
-import DehazeIcon from '@material-ui/icons/Dehaze';
-import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
-import AddIcon from '@material-ui/icons/Add';
-import PublishIcon from '@material-ui/icons/Publish';
-import MaterialTable from "material-table";
-import PolicyService from '../../../api/PolicyService';
-import PolicyToscaService from '../../../api/PolicyToscaService';
-import Alert from 'react-bootstrap/Alert';
-import Tabs from 'react-bootstrap/Tabs';
-import Tab from 'react-bootstrap/Tab';
-import PolicyEditor from './PolicyEditor';
-import ToscaViewer from './ToscaViewer';
-import PolicyDeploymentEditor from './PolicyDeploymentEditor';
-import PoliciesTreeViewer from './PoliciesTreeViewer';
-import PolicyToscaFileSelector from './PolicyToscaFileSelector';
-
-const DivWhiteSpaceStyled = styled.div`
- white-space: pre;
-`
-
-const ModalStyled = styled(Modal)`
- @media (min-width: 800px) {
- .modal-xl {
- max-width: 96%;
- }
- }
- background-color: transparent;
-`
-const DetailedRow = styled.div`
- margin: 0 auto;
- background-color: ${ props => props.theme.policyEditorBackgroundColor };
- font-size: ${ props => props.theme.policyEditorFontSize };
- width: 97%;
- margin-left: auto;
- margin-right: auto;
- margin-top: 20px;
-`
-
-const PoliciesTreeViewerDiv = styled.div`
- width: 20%;
- float: left;
- left: 0;
- overflow: auto;
-`
-
-const MaterialTableDiv = styled.div`
- float: right;
- width: 80%;
- left: 20%;
-`
-
-const standardCellStyle = { backgroundColor: '#039be5', color: '#FFF', border: '1px solid black' };
-const headerStyle = { backgroundColor: '#ddd', border: '2px solid black' };
-const rowHeaderStyle = { backgroundColor: '#ddd', fontSize: '15pt', text: 'bold', border: '1px solid black' };
-
-export default class ViewAllPolicies extends React.Component {
- state = {
- show: true,
- policiesListData: [],
- policiesListDataFiltered: [],
- toscaModelsListData: [],
- toscaModelsListDataFiltered: [],
- jsonEditorForPolicy: new Map(),
- showSuccessAlert: false,
- showFailAlert: false,
- showFileSelector: false,
- policyColumnsDefinition: [
- {
- title: "Policy Name", field: "name",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Policy Version", field: "version",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle,
- },
- {
- title: "Policy Type", field: "type",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Policy Type Version", field: "type_version",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Deployable in PDP Group", field: "supportedPdpGroupsString",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Deployed in PDP Group", field: "pdpGroupInfoString",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- }
- ],
- toscaColumnsDefinition: [
- {
- title: "Policy Model Type", field: "policyModelType",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Policy Acronym", field: "policyAcronym",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Version", field: "version",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Uploaded By", field: "updatedBy",
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Uploaded Date", field: "updatedDate", editable: 'never',
- cellStyle: standardCellStyle,
- headerStyle: headerStyle
- }
- ],
- tableIcons: {
- Add: forwardRef((props, ref) => <AddBox { ...props } ref={ ref }/>),
- Check: forwardRef((props, ref) => <Check { ...props } ref={ ref }/>),
- Clear: forwardRef((props, ref) => <Clear { ...props } ref={ ref }/>),
- Delete: forwardRef((props, ref) => <DeleteRoundedIcon { ...props } ref={ ref }/>),
- DetailPanel: forwardRef((props, ref) => <ChevronRight { ...props } ref={ ref }/>),
- Edit: forwardRef((props, ref) => <Edit { ...props } ref={ ref }/>),
- Export: forwardRef((props, ref) => <SaveAlt { ...props } ref={ ref }/>),
- Filter: forwardRef((props, ref) => <FilterList { ...props } ref={ ref }/>),
- FirstPage: forwardRef((props, ref) => <FirstPage { ...props } ref={ ref }/>),
- LastPage: forwardRef((props, ref) => <LastPage { ...props } ref={ ref }/>),
- NextPage: forwardRef((props, ref) => <ChevronRight { ...props } ref={ ref }/>),
- PreviousPage: forwardRef((props, ref) => <ChevronLeft { ...props } ref={ ref }/>),
- ResetSearch: forwardRef((props, ref) => <Clear { ...props } ref={ ref }/>),
- Search: forwardRef((props, ref) => <Search { ...props } ref={ ref }/>),
- SortArrow: forwardRef((props, ref) => <ArrowDownward { ...props } ref={ ref }/>),
- ThirdStateCheck: forwardRef((props, ref) => <Remove { ...props } ref={ ref }/>),
- ViewColumn: forwardRef((props, ref) => <ViewColumn { ...props } ref={ ref }/>)
- }
- };
-
- constructor(props, context) {
- super(props, context);
- this.handleClose = this.handleClose.bind(this);
- this.handleDeletePolicy = this.handleDeletePolicy.bind(this);
- this.disableAlert = this.disableAlert.bind(this);
- this.getAllPolicies = this.getAllPolicies.bind(this);
- this.getAllToscaModels = this.getAllToscaModels.bind(this);
- this.generateAdditionalPolicyColumns = this.generateAdditionalPolicyColumns.bind(this);
- this.filterPolicies = this.filterPolicies.bind(this);
- this.filterTosca = this.filterTosca.bind(this);
- this.showFileSelector = this.showFileSelector.bind(this);
- this.disableFileSelector = this.disableFileSelector.bind(this);
- this.getAllPolicies();
- this.getAllToscaModels();
- }
-
- generateAdditionalPolicyColumns(policiesData) {
- console.log('generateAdditionalPolicyColumns called');
-
- policiesData.forEach(policy => {
- let supportedPdpGroupsString = "";
- if (typeof policy.supportedPdpGroups !== "undefined") {
- for (const pdpGroup of policy["supportedPdpGroups"]) {
- for (const pdpSubGroup of Object.values(pdpGroup)[0]) {
- supportedPdpGroupsString += (Object.keys(pdpGroup)[0] + "/" + pdpSubGroup + "\r\n");
- }
- }
- policy["supportedPdpGroupsString"] = supportedPdpGroupsString;
- }
-
- let infoPdpGroup = "";
- if (typeof policy.pdpGroupInfo !== "undefined") {
- policy["pdpGroupInfo"].forEach(pdpGroupElem => {
- let groupName = Object.keys(pdpGroupElem)[0];
- pdpGroupElem[groupName]["pdpSubgroups"].forEach(pdpSubGroupElem => {
- infoPdpGroup += (groupName + "/" + pdpSubGroupElem["pdpType"] + " ("
- + pdpGroupElem[groupName]["pdpGroupState"] + ")" + "\r\n");
- });
- policy["pdpGroupInfoString"] = infoPdpGroup;
- });
- }
- });
- }
-
- getAllToscaModels() {
- PolicyToscaService.getToscaPolicyModels().then(toscaModelsList => {
- this.setState({
- toscaModelsListData: toscaModelsList,
- toscaModelsListDataFiltered: toscaModelsList
- });
- });
- }
-
- getAllPolicies() {
- PolicyService.getPoliciesList().then(allPolicies => {
- this.generateAdditionalPolicyColumns(allPolicies["policies"])
- this.setState({
- policiesListData: allPolicies["policies"],
- policiesListDataFiltered: allPolicies["policies"],
- })
- });
-
- }
-
- handleClose() {
- console.log("handleClose called");
- this.setState({ show: false });
- this.props.history.push('/')
- }
-
- handleDeletePolicy(event, rowData) {
- PolicyService.deletePolicy(rowData["type"], rowData["type_version"], rowData["name"], rowData["version"]).then(
- respPolicyDeletion => {
- if (typeof (respPolicyDeletion) === "undefined") {
- //it indicates a failure
- this.setState({
- showFailAlert: true,
- showMessage: 'Policy Deletion Failure'
- });
- } else {
- this.setState({
- showSuccessAlert: true,
- showMessage: 'Policy successfully Deleted'
- });
- this.getAllPolicies();
- }
- }
- )
- }
-
- disableAlert() {
- this.setState({ showSuccessAlert: false, showFailAlert: false });
- }
-
- filterPolicies(prefixForFiltering) {
- this.setState({ policiesListDataFiltered: this.state.policiesListData.filter(element => element.name.startsWith(prefixForFiltering)) });
- }
-
- filterTosca(prefixForFiltering) {
- this.setState({ toscaModelsListDataFiltered: this.state.toscaModelsListData.filter(element => element.policyModelType.startsWith(prefixForFiltering)) });
- }
-
- showFileSelector() {
- this.setState({ showFileSelector: true });
- }
-
- disableFileSelector() {
- this.setState({ showFileSelector: false });
- }
-
- renderPoliciesTab() {
- return (
- <Tab eventKey="policies" title="Policies in Policy Framework">
- <Modal.Body>
- <div>
- <PoliciesTreeViewerDiv>
- <PoliciesTreeViewer policiesData={ this.state.policiesListData } valueForTreeCreation="name" policiesFilterFunction={ this.filterPolicies }/>
- </PoliciesTreeViewerDiv>
- <MaterialTableDiv>
- <MaterialTable
- title={ "Policies" }
- data={ this.state.policiesListDataFiltered }
- columns={ this.state.policyColumnsDefinition }
- icons={ this.state.tableIcons }
- onRowClick={ (event, rowData, togglePanel) => togglePanel() }
- options={ {
- grouping: true,
- exportButton: true,
- headerStyle: rowHeaderStyle,
- actionsColumnIndex: -1
- } }
- detailPanel={ [
- {
- icon: ArrowForwardIosIcon,
- tooltip: 'Show Configuration',
- render: rowData => {
- return (
- <DetailedRow>
- <PolicyEditor policyModelType={ rowData["type"] } policyModelTypeVersion={ rowData["type_version"] }
- policyName={ rowData["name"] } policyVersion={ rowData["version"] } policyProperties={ rowData["properties"] }
- policiesTableUpdateFunction={ this.getAllPolicies }/>
- </DetailedRow>
- )
- },
- },
- {
- icon: DehazeIcon,
- openIcon: DehazeIcon,
- tooltip: 'Show Raw Data',
- render: rowData => {
- return (
- <DetailedRow>
- <pre>{ JSON.stringify(rowData, null, 2) }</pre>
- </DetailedRow>
- )
- },
- },
- {
- icon: PublishIcon,
- openIcon: PublishIcon,
- tooltip: 'PDP Group Deployment',
- render: rowData => {
- return (
- <DetailedRow>
- <PolicyDeploymentEditor policyData={ rowData } policiesTableUpdateFunction={ this.getAllPolicies }/>
- </DetailedRow>
- )
- },
- }
- ] }
- actions={ [
- {
- icon: DeleteRoundedIcon,
- tooltip: 'Delete Policy',
- onClick: (event, rowData) => this.handleDeletePolicy(event, rowData)
- }
- ] }
- />
- </MaterialTableDiv>
- </div>
- </Modal.Body>
- </Tab>
- );
- }
-
- renderToscaTab() {
- return (
- <Tab eventKey="tosca models" title="Tosca Models in Policy Framework">
- <Modal.Body>
- <div>
- <PoliciesTreeViewerDiv>
- <PoliciesTreeViewer policiesData={ this.state.toscaModelsListData } valueForTreeCreation="policyModelType" policiesFilterFunction={ this.filterTosca }/>
- </PoliciesTreeViewerDiv>
- <MaterialTableDiv>
- <MaterialTable
- title={ "Tosca Models" }
- data={ this.state.toscaModelsListDataFiltered }
- columns={ this.state.toscaColumnsDefinition }
- icons={ this.state.tableIcons }
- onRowClick={ (event, rowData, togglePanel) => togglePanel() }
- options={ {
- grouping: true,
- exportButton: true,
- headerStyle: rowHeaderStyle,
- actionsColumnIndex: -1
- } }
- actions={ [
- {
- icon: AddIcon,
- tooltip: 'Add New Tosca Model',
- isFreeAction: true,
- onClick: () => this.showFileSelector()
- }
- ] }
- detailPanel={ [
- {
- icon: ArrowForwardIosIcon,
- tooltip: 'Show Tosca',
- render: rowData => {
- return (
- <DetailedRow>
- <ToscaViewer toscaData={ rowData }/>
- </DetailedRow>
- )
- },
- },
- {
- icon: DehazeIcon,
- openIcon: DehazeIcon,
- tooltip: 'Show Raw Data',
- render: rowData => {
- return (
- <DetailedRow>
- <pre>{ JSON.stringify(rowData, null, 2) }</pre>
- </DetailedRow>
- )
- },
- },
- {
- icon: AddIcon,
- openIcon: AddIcon,
- tooltip: 'Create a policy from this model',
- render: rowData => {
- return (
- <DetailedRow>
- <PolicyEditor policyModelType={ rowData["policyModelType"] } policyModelTypeVersion={ rowData["version"] } policyProperties={ {} } policiesTableUpdateFunction={ this.getAllPolicies }/>
- </DetailedRow>
- )
- },
- },
- ] }
- />
- </MaterialTableDiv>
- </div>
- </Modal.Body>
- </Tab>
- );
- }
-
- render() {
- return (
- <React.Fragment>
- <ModalStyled size="xl" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- </Modal.Header>
- <Tabs id="controlled-tab-example" activeKey={ this.state.key } onSelect={ key => this.setState({ key, selectedRowData: {} }) }>
- { this.renderPoliciesTab() }
- { this.renderToscaTab() }
- </Tabs>
- <Alert variant="success" show={ this.state.showSuccessAlert } onClose={ this.disableAlert } dismissible>
- <DivWhiteSpaceStyled>
- { this.state.showMessage }
- </DivWhiteSpaceStyled>
- </Alert>
- <Alert variant="danger" show={ this.state.showFailAlert } onClose={ this.disableAlert } dismissible>
- <DivWhiteSpaceStyled>
- { this.state.showMessage }
- </DivWhiteSpaceStyled>
- </Alert>
- <Modal.Footer>
- <Button variant="secondary" onClick={ this.handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- <PolicyToscaFileSelector show={ this.state.showFileSelector } disableFunction={ this.disableFileSelector } toscaTableUpdateFunction={ this.getAllToscaModels }/>
- </React.Fragment>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.test.js
deleted file mode 100644
index c2ce731..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.test.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import {shallow} from "enzyme";
-import React from "react";
-import ViewAllPolicies from "./ViewAllPolicies";
-import fs from "fs";
-import PolicyToscaService from "../../../api/PolicyToscaService";
-import PolicyService from "../../../api/PolicyService";
-import toJson from "enzyme-to-json";
-
-describe('Verify ViewAllPolicies', () => {
- let toscaPolicyModels = fs.readFileSync('src/components/dialogs/Policy/toscaData.test.json', {
- encoding: 'utf8',
- flag: 'r'
- });
- let toscaPoliciesList = fs.readFileSync('src/components/dialogs/Policy/toscaPoliciesList.test.json', {
- encoding: 'utf8',
- flag: 'r'
- });
-
- const toscaPolicyModelsArray = JSON.parse(toscaPolicyModels);
-
- const toscaPoliciesListArray = JSON.parse(toscaPoliciesList);
-
- const logSpy = jest.spyOn(console, 'log');
-
- it("renders correctly", () => {
- const component = shallow(<ViewAllPolicies />);
- expect(toJson(component)).toMatchSnapshot();
- });
-
- it('Test handleClose', () => {
- const historyMock = {push: jest.fn()};
- const handleClose = jest.spyOn(ViewAllPolicies.prototype, 'handleClose');
- const component = shallow(<ViewAllPolicies history={historyMock}/>);
-
- component.find('[variant="secondary"]').prop('onClick')();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
-
- handleClose.mockClear();
- });
-
- it('handleClose called when top-right button clicked', () => {
- const historyMock = {push: jest.fn()};
- const handleClose = jest.spyOn(ViewAllPolicies.prototype, 'handleClose');
- const component = shallow(<ViewAllPolicies history={historyMock}/>);
-
- component.find('[size="xl"]').get(0).props.onHide();
-
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
-
- handleClose.mockClear();
- });
-
- it('Test getAllToscaModels', () => {
- PolicyToscaService.getToscaPolicyModels = jest.fn().mockImplementation(() => {
- return Promise.resolve(toscaPolicyModels);
- });
-
- const getAllToscaModels = jest.spyOn(ViewAllPolicies.prototype, 'getAllToscaModels');
- shallow(<ViewAllPolicies/>);
-
- expect(getAllToscaModels).toHaveBeenCalledTimes(1);
- });
-
- it('Test setToscaModelsListData', async () => {
- PolicyToscaService.getToscaPolicyModel = jest.fn().mockImplementation(() => {
- return Promise.resolve(toscaPolicyModels);
- });
-
- const component = shallow(<ViewAllPolicies/>);
- component.setState({toscaModelsListData: toscaPolicyModels})
- expect(component.state('toscaModelsListData')).toEqual(toscaPolicyModels);
- });
-
- it('Test getAllPolicies', () => {
- PolicyService.getPoliciesList = jest.fn().mockImplementation(() => {
- return Promise.resolve(toscaPoliciesList);
- });
-
- const getAllPolicies = jest.spyOn(ViewAllPolicies.prototype, 'getAllPolicies');
- shallow(<ViewAllPolicies/>);
-
- expect(getAllPolicies).toHaveBeenCalledTimes(1);
- });
-
- it('Test setPoliciesListData', async () => {
- PolicyService.getPoliciesList = jest.fn().mockImplementation(() => {
- return Promise.resolve(toscaPoliciesList);
- });
-
- const component = shallow(<ViewAllPolicies/>);
- component.setState({policiesListData: toscaPoliciesList});
- component.setState({policiesListDataFiltered: toscaPoliciesList});
-
- expect(component.state('policiesListData')).toEqual(toscaPoliciesList);
- expect(component.state('policiesListDataFiltered')).toEqual(toscaPoliciesList);
- });
-
- it('Test handleDeletePolicy event rowdata', async () => {
- const rowData = {
- type: 'onap.policies.monitoring.tcagen2',
- type_version: '1.0.0',
- name: 'MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0',
- version: '1.0.0'
- }
-
- PolicyService.deletePolicy = await jest.fn().mockImplementation(() => {
- return Promise.resolve({});
- });
-
- const event = { target: {value: 'event'}}
- const renderPoliciesTab = jest.spyOn(ViewAllPolicies.prototype, 'renderPoliciesTab');
-
- const component = shallow(<ViewAllPolicies />);
-
- component.setState({showSuccessAlert: true});
- component.setState({showMessage: 'Policy successfully Deleted'});
- component.setState({policiesListDataFiltered: toscaPolicyModelsArray});
-
- component.update();
-
- const instance = component.instance();
-
- instance.handleDeletePolicy(event, rowData);
-
- expect(renderPoliciesTab).toHaveBeenCalledTimes(4);
- expect(component.state('showSuccessAlert')).toEqual(true);
- expect(component.state('showMessage')).toEqual('Policy successfully Deleted');
- });
-
- it('Test generateAdditionalPolicyColumns policiesData', async () => {
- const component = shallow(<ViewAllPolicies />);
-
- const instance = component.instance();
- instance.generateAdditionalPolicyColumns(toscaPoliciesListArray.policies);
-
- component.update();
-
- expect(logSpy).toHaveBeenCalledWith('generateAdditionalPolicyColumns called');
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap
deleted file mode 100644
index 8d14fa4..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap
+++ /dev/null
@@ -1,23 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify PoliciesTreeViewer renders correctly 1`] = `
-<WithStyles(ForwardRef(TreeView))
- defaultCollapseIcon={<Memo />}
- defaultEndIcon={<Memo />}
- defaultExpandIcon={<Memo />}
- defaultExpanded={
- Array [
- "root",
- ]
- }
- multiSelect={true}
- onNodeSelect={[Function]}
->
- <WithStyles(ForwardRef(TreeItem))
- key="1"
- label="ROOT(0)"
- nodeId={1}
- onNodeSelect={[Function]}
- />
-</WithStyles(ForwardRef(TreeView))>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyDeploymentEditor.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyDeploymentEditor.test.js.snap
deleted file mode 100644
index 7bf297a..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyDeploymentEditor.test.js.snap
+++ /dev/null
@@ -1,71 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify PolicyDeploymentEditor renders correctly 1`] = `
-<styled.div>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="success"
- >
- <styled.div />
- </Alert>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="danger"
- >
- <styled.div />
- </Alert>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- title="Update the policy to the specified PDP Groups/Subgroups"
- variant="secondary"
- >
- Update PDP
- </Button>
- <WithStyles(ForwardRef(FormGroup))>
- <WithStyles(ForwardRef(FormControlLabel))
- control={
- <WithStyles(ForwardRef(Checkbox))
- checked={true}
- name="monitoring/xacml"
- onChange={[Function]}
- />
- }
- label="monitoring/xacml"
- />
- </WithStyles(ForwardRef(FormGroup))>
-</styled.div>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap
deleted file mode 100644
index ea435fc..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap
+++ /dev/null
@@ -1,788 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify PolicyEditor Test the render method 1`] = `
-<PolicyEditor
- policiesTableUpdateFunction={[Function]}
- policyModelType="onap.policies.monitoring.tcagen2"
- policyModelTypeVersion="1.0.0"
- policyName="org.onap.new"
- policyProperties={
- Object {
- "tca.policy": Object {
- "domain": "measurementsForVfScaling",
- "metricsPerEventName": Array [
- Object {
- "acmSchemaType": "VM",
- "eventName": "vLoadBalancer",
- "policyName": "DCAE.Config_tca-hi-lo",
- "policyScope": "DCAE",
- "policyVersion": "v0.0.1",
- "thresholds": Array [
- Object {
- "closedLoopControlName": "LOOP_test",
- "closedLoopEventStatus": "ONSET",
- "direction": "LESS_OR_EQUAL",
- "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta",
- "severity": "MAJOR",
- "thresholdValue": 200,
- "version": "1.0.2",
- },
- ],
- },
- ],
- },
- }
- }
- policyVersion="1.0.0"
->
- <styled.div>
- <div
- className="sc-dlnjwi ksxnfR"
- >
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="success"
- >
- <Fade
- appear={false}
- in={false}
- mountOnEnter={false}
- timeout={300}
- unmountOnExit={true}
- >
- <Transition
- addEndListener={[Function]}
- appear={false}
- enter={true}
- exit={true}
- in={false}
- mountOnEnter={false}
- onEnter={[Function]}
- onEntered={[Function]}
- onEntering={[Function]}
- onExit={[Function]}
- onExited={[Function]}
- onExiting={[Function]}
- timeout={300}
- unmountOnExit={true}
- />
- </Fade>
- </Alert>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="danger"
- >
- <Fade
- appear={false}
- in={false}
- mountOnEnter={false}
- timeout={300}
- unmountOnExit={true}
- >
- <Transition
- addEndListener={[Function]}
- appear={false}
- enter={true}
- exit={true}
- in={false}
- mountOnEnter={false}
- onEnter={[Function]}
- onEntered={[Function]}
- onEntering={[Function]}
- onExit={[Function]}
- onExited={[Function]}
- onExiting={[Function]}
- timeout={300}
- unmountOnExit={true}
- />
- </Fade>
- </Alert>
- <WithStyles(ForwardRef(TextField))
- defaultValue="org.onap.new"
- id="policyName"
- label="Required"
- onChange={[Function]}
- required={true}
- size="small"
- variant="outlined"
- >
- <ForwardRef(TextField)
- classes={
- Object {
- "root": "MuiTextField-root",
- }
- }
- defaultValue="org.onap.new"
- id="policyName"
- label="Required"
- onChange={[Function]}
- required={true}
- size="small"
- variant="outlined"
- >
- <WithStyles(ForwardRef(FormControl))
- className="MuiTextField-root"
- color="primary"
- disabled={false}
- error={false}
- fullWidth={false}
- required={true}
- size="small"
- variant="outlined"
- >
- <ForwardRef(FormControl)
- className="MuiTextField-root"
- classes={
- Object {
- "fullWidth": "MuiFormControl-fullWidth",
- "marginDense": "MuiFormControl-marginDense",
- "marginNormal": "MuiFormControl-marginNormal",
- "root": "MuiFormControl-root",
- }
- }
- color="primary"
- disabled={false}
- error={false}
- fullWidth={false}
- required={true}
- size="small"
- variant="outlined"
- >
- <div
- className="MuiFormControl-root MuiTextField-root"
- >
- <WithStyles(ForwardRef(InputLabel))
- htmlFor="policyName"
- id="policyName-label"
- >
- <ForwardRef(InputLabel)
- classes={
- Object {
- "animated": "MuiInputLabel-animated",
- "asterisk": "MuiInputLabel-asterisk",
- "disabled": "Mui-disabled",
- "error": "Mui-error",
- "filled": "MuiInputLabel-filled",
- "focused": "Mui-focused",
- "formControl": "MuiInputLabel-formControl",
- "marginDense": "MuiInputLabel-marginDense",
- "outlined": "MuiInputLabel-outlined",
- "required": "Mui-required",
- "root": "MuiInputLabel-root",
- "shrink": "MuiInputLabel-shrink",
- }
- }
- htmlFor="policyName"
- id="policyName-label"
- >
- <WithStyles(ForwardRef(FormLabel))
- className="MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-marginDense MuiInputLabel-outlined"
- classes={
- Object {
- "asterisk": "MuiInputLabel-asterisk",
- "disabled": "Mui-disabled",
- "error": "Mui-error",
- "focused": "Mui-focused",
- "required": "Mui-required",
- }
- }
- data-shrink={true}
- htmlFor="policyName"
- id="policyName-label"
- >
- <ForwardRef(FormLabel)
- className="MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-marginDense MuiInputLabel-outlined"
- classes={
- Object {
- "asterisk": "MuiFormLabel-asterisk MuiInputLabel-asterisk",
- "colorSecondary": "MuiFormLabel-colorSecondary",
- "disabled": "Mui-disabled Mui-disabled",
- "error": "Mui-error Mui-error",
- "filled": "MuiFormLabel-filled",
- "focused": "Mui-focused Mui-focused",
- "required": "Mui-required Mui-required",
- "root": "MuiFormLabel-root",
- }
- }
- data-shrink={true}
- htmlFor="policyName"
- id="policyName-label"
- >
- <label
- className="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-marginDense MuiInputLabel-outlined MuiFormLabel-filled Mui-required Mui-required"
- data-shrink={true}
- htmlFor="policyName"
- id="policyName-label"
- >
- Required
- <span
- aria-hidden={true}
- className="MuiFormLabel-asterisk MuiInputLabel-asterisk"
- >
-  
- *
- </span>
- </label>
- </ForwardRef(FormLabel)>
- </WithStyles(ForwardRef(FormLabel))>
- </ForwardRef(InputLabel)>
- </WithStyles(ForwardRef(InputLabel))>
- <WithStyles(ForwardRef(OutlinedInput))
- autoFocus={false}
- defaultValue="org.onap.new"
- fullWidth={false}
- id="policyName"
- label={
- <React.Fragment>
- Required
-  *
- </React.Fragment>
- }
- multiline={false}
- onChange={[Function]}
- >
- <ForwardRef(OutlinedInput)
- autoFocus={false}
- classes={
- Object {
- "adornedEnd": "MuiOutlinedInput-adornedEnd",
- "adornedStart": "MuiOutlinedInput-adornedStart",
- "colorSecondary": "MuiOutlinedInput-colorSecondary",
- "disabled": "Mui-disabled",
- "error": "Mui-error",
- "focused": "Mui-focused",
- "input": "MuiOutlinedInput-input",
- "inputAdornedEnd": "MuiOutlinedInput-inputAdornedEnd",
- "inputAdornedStart": "MuiOutlinedInput-inputAdornedStart",
- "inputMarginDense": "MuiOutlinedInput-inputMarginDense",
- "inputMultiline": "MuiOutlinedInput-inputMultiline",
- "marginDense": "MuiOutlinedInput-marginDense",
- "multiline": "MuiOutlinedInput-multiline",
- "notchedOutline": "MuiOutlinedInput-notchedOutline",
- "root": "MuiOutlinedInput-root",
- }
- }
- defaultValue="org.onap.new"
- fullWidth={false}
- id="policyName"
- label={
- <React.Fragment>
- Required
-  *
- </React.Fragment>
- }
- multiline={false}
- onChange={[Function]}
- >
- <WithStyles(ForwardRef(InputBase))
- autoFocus={false}
- classes={
- Object {
- "adornedEnd": "MuiOutlinedInput-adornedEnd",
- "adornedStart": "MuiOutlinedInput-adornedStart",
- "colorSecondary": "MuiOutlinedInput-colorSecondary",
- "disabled": "Mui-disabled",
- "error": "Mui-error",
- "focused": "Mui-focused",
- "input": "MuiOutlinedInput-input",
- "inputAdornedEnd": "MuiOutlinedInput-inputAdornedEnd",
- "inputAdornedStart": "MuiOutlinedInput-inputAdornedStart",
- "inputMarginDense": "MuiOutlinedInput-inputMarginDense",
- "inputMultiline": "MuiOutlinedInput-inputMultiline",
- "marginDense": "MuiOutlinedInput-marginDense",
- "multiline": "MuiOutlinedInput-multiline",
- "notchedOutline": null,
- "root": "MuiOutlinedInput-root",
- }
- }
- defaultValue="org.onap.new"
- fullWidth={false}
- id="policyName"
- inputComponent="input"
- multiline={false}
- onChange={[Function]}
- renderSuffix={[Function]}
- type="text"
- >
- <ForwardRef(InputBase)
- autoFocus={false}
- classes={
- Object {
- "adornedEnd": "MuiInputBase-adornedEnd MuiOutlinedInput-adornedEnd",
- "adornedStart": "MuiInputBase-adornedStart MuiOutlinedInput-adornedStart",
- "colorSecondary": "MuiInputBase-colorSecondary MuiOutlinedInput-colorSecondary",
- "disabled": "Mui-disabled Mui-disabled",
- "error": "Mui-error Mui-error",
- "focused": "Mui-focused Mui-focused",
- "formControl": "MuiInputBase-formControl",
- "fullWidth": "MuiInputBase-fullWidth",
- "input": "MuiInputBase-input MuiOutlinedInput-input",
- "inputAdornedEnd": "MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd",
- "inputAdornedStart": "MuiInputBase-inputAdornedStart MuiOutlinedInput-inputAdornedStart",
- "inputHiddenLabel": "MuiInputBase-inputHiddenLabel",
- "inputMarginDense": "MuiInputBase-inputMarginDense MuiOutlinedInput-inputMarginDense",
- "inputMultiline": "MuiInputBase-inputMultiline MuiOutlinedInput-inputMultiline",
- "inputTypeSearch": "MuiInputBase-inputTypeSearch",
- "marginDense": "MuiInputBase-marginDense MuiOutlinedInput-marginDense",
- "multiline": "MuiInputBase-multiline MuiOutlinedInput-multiline",
- "root": "MuiInputBase-root MuiOutlinedInput-root",
- }
- }
- defaultValue="org.onap.new"
- fullWidth={false}
- id="policyName"
- inputComponent="input"
- multiline={false}
- onChange={[Function]}
- renderSuffix={[Function]}
- type="text"
- >
- <div
- className="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-formControl MuiInputBase-marginDense MuiOutlinedInput-marginDense"
- onClick={[Function]}
- >
- <input
- aria-invalid={false}
- autoFocus={false}
- className="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMarginDense MuiOutlinedInput-inputMarginDense"
- defaultValue="org.onap.new"
- disabled={false}
- id="policyName"
- onAnimationStart={[Function]}
- onBlur={[Function]}
- onChange={[Function]}
- onFocus={[Function]}
- required={true}
- type="text"
- />
- <WithStyles(ForwardRef(NotchedOutline))
- className="MuiOutlinedInput-notchedOutline"
- label={
- <React.Fragment>
- Required
-  *
- </React.Fragment>
- }
- labelWidth={0}
- notched={true}
- >
- <ForwardRef(NotchedOutline)
- className="MuiOutlinedInput-notchedOutline"
- classes={
- Object {
- "legend": "PrivateNotchedOutline-legend-2",
- "legendLabelled": "PrivateNotchedOutline-legendLabelled-3",
- "legendNotched": "PrivateNotchedOutline-legendNotched-4",
- "root": "PrivateNotchedOutline-root-1",
- }
- }
- label={
- <React.Fragment>
- Required
-  *
- </React.Fragment>
- }
- labelWidth={0}
- notched={true}
- >
- <fieldset
- aria-hidden={true}
- className="PrivateNotchedOutline-root-1 MuiOutlinedInput-notchedOutline"
- >
- <legend
- className="PrivateNotchedOutline-legendLabelled-3 PrivateNotchedOutline-legendNotched-4"
- >
- <span>
- Required
-  *
- </span>
- </legend>
- </fieldset>
- </ForwardRef(NotchedOutline)>
- </WithStyles(ForwardRef(NotchedOutline))>
- </div>
- </ForwardRef(InputBase)>
- </WithStyles(ForwardRef(InputBase))>
- </ForwardRef(OutlinedInput)>
- </WithStyles(ForwardRef(OutlinedInput))>
- </div>
- </ForwardRef(FormControl)>
- </WithStyles(ForwardRef(FormControl))>
- </ForwardRef(TextField)>
- </WithStyles(ForwardRef(TextField))>
- <WithStyles(ForwardRef(TextField))
- defaultValue="1.0.0"
- id="policyVersion"
- label="Required"
- onChange={[Function]}
- required={true}
- size="small"
- variant="outlined"
- >
- <ForwardRef(TextField)
- classes={
- Object {
- "root": "MuiTextField-root",
- }
- }
- defaultValue="1.0.0"
- id="policyVersion"
- label="Required"
- onChange={[Function]}
- required={true}
- size="small"
- variant="outlined"
- >
- <WithStyles(ForwardRef(FormControl))
- className="MuiTextField-root"
- color="primary"
- disabled={false}
- error={false}
- fullWidth={false}
- required={true}
- size="small"
- variant="outlined"
- >
- <ForwardRef(FormControl)
- className="MuiTextField-root"
- classes={
- Object {
- "fullWidth": "MuiFormControl-fullWidth",
- "marginDense": "MuiFormControl-marginDense",
- "marginNormal": "MuiFormControl-marginNormal",
- "root": "MuiFormControl-root",
- }
- }
- color="primary"
- disabled={false}
- error={false}
- fullWidth={false}
- required={true}
- size="small"
- variant="outlined"
- >
- <div
- className="MuiFormControl-root MuiTextField-root"
- >
- <WithStyles(ForwardRef(InputLabel))
- htmlFor="policyVersion"
- id="policyVersion-label"
- >
- <ForwardRef(InputLabel)
- classes={
- Object {
- "animated": "MuiInputLabel-animated",
- "asterisk": "MuiInputLabel-asterisk",
- "disabled": "Mui-disabled",
- "error": "Mui-error",
- "filled": "MuiInputLabel-filled",
- "focused": "Mui-focused",
- "formControl": "MuiInputLabel-formControl",
- "marginDense": "MuiInputLabel-marginDense",
- "outlined": "MuiInputLabel-outlined",
- "required": "Mui-required",
- "root": "MuiInputLabel-root",
- "shrink": "MuiInputLabel-shrink",
- }
- }
- htmlFor="policyVersion"
- id="policyVersion-label"
- >
- <WithStyles(ForwardRef(FormLabel))
- className="MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-marginDense MuiInputLabel-outlined"
- classes={
- Object {
- "asterisk": "MuiInputLabel-asterisk",
- "disabled": "Mui-disabled",
- "error": "Mui-error",
- "focused": "Mui-focused",
- "required": "Mui-required",
- }
- }
- data-shrink={true}
- htmlFor="policyVersion"
- id="policyVersion-label"
- >
- <ForwardRef(FormLabel)
- className="MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-marginDense MuiInputLabel-outlined"
- classes={
- Object {
- "asterisk": "MuiFormLabel-asterisk MuiInputLabel-asterisk",
- "colorSecondary": "MuiFormLabel-colorSecondary",
- "disabled": "Mui-disabled Mui-disabled",
- "error": "Mui-error Mui-error",
- "filled": "MuiFormLabel-filled",
- "focused": "Mui-focused Mui-focused",
- "required": "Mui-required Mui-required",
- "root": "MuiFormLabel-root",
- }
- }
- data-shrink={true}
- htmlFor="policyVersion"
- id="policyVersion-label"
- >
- <label
- className="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-marginDense MuiInputLabel-outlined MuiFormLabel-filled Mui-required Mui-required"
- data-shrink={true}
- htmlFor="policyVersion"
- id="policyVersion-label"
- >
- Required
- <span
- aria-hidden={true}
- className="MuiFormLabel-asterisk MuiInputLabel-asterisk"
- >
-  
- *
- </span>
- </label>
- </ForwardRef(FormLabel)>
- </WithStyles(ForwardRef(FormLabel))>
- </ForwardRef(InputLabel)>
- </WithStyles(ForwardRef(InputLabel))>
- <WithStyles(ForwardRef(OutlinedInput))
- autoFocus={false}
- defaultValue="1.0.0"
- fullWidth={false}
- id="policyVersion"
- label={
- <React.Fragment>
- Required
-  *
- </React.Fragment>
- }
- multiline={false}
- onChange={[Function]}
- >
- <ForwardRef(OutlinedInput)
- autoFocus={false}
- classes={
- Object {
- "adornedEnd": "MuiOutlinedInput-adornedEnd",
- "adornedStart": "MuiOutlinedInput-adornedStart",
- "colorSecondary": "MuiOutlinedInput-colorSecondary",
- "disabled": "Mui-disabled",
- "error": "Mui-error",
- "focused": "Mui-focused",
- "input": "MuiOutlinedInput-input",
- "inputAdornedEnd": "MuiOutlinedInput-inputAdornedEnd",
- "inputAdornedStart": "MuiOutlinedInput-inputAdornedStart",
- "inputMarginDense": "MuiOutlinedInput-inputMarginDense",
- "inputMultiline": "MuiOutlinedInput-inputMultiline",
- "marginDense": "MuiOutlinedInput-marginDense",
- "multiline": "MuiOutlinedInput-multiline",
- "notchedOutline": "MuiOutlinedInput-notchedOutline",
- "root": "MuiOutlinedInput-root",
- }
- }
- defaultValue="1.0.0"
- fullWidth={false}
- id="policyVersion"
- label={
- <React.Fragment>
- Required
-  *
- </React.Fragment>
- }
- multiline={false}
- onChange={[Function]}
- >
- <WithStyles(ForwardRef(InputBase))
- autoFocus={false}
- classes={
- Object {
- "adornedEnd": "MuiOutlinedInput-adornedEnd",
- "adornedStart": "MuiOutlinedInput-adornedStart",
- "colorSecondary": "MuiOutlinedInput-colorSecondary",
- "disabled": "Mui-disabled",
- "error": "Mui-error",
- "focused": "Mui-focused",
- "input": "MuiOutlinedInput-input",
- "inputAdornedEnd": "MuiOutlinedInput-inputAdornedEnd",
- "inputAdornedStart": "MuiOutlinedInput-inputAdornedStart",
- "inputMarginDense": "MuiOutlinedInput-inputMarginDense",
- "inputMultiline": "MuiOutlinedInput-inputMultiline",
- "marginDense": "MuiOutlinedInput-marginDense",
- "multiline": "MuiOutlinedInput-multiline",
- "notchedOutline": null,
- "root": "MuiOutlinedInput-root",
- }
- }
- defaultValue="1.0.0"
- fullWidth={false}
- id="policyVersion"
- inputComponent="input"
- multiline={false}
- onChange={[Function]}
- renderSuffix={[Function]}
- type="text"
- >
- <ForwardRef(InputBase)
- autoFocus={false}
- classes={
- Object {
- "adornedEnd": "MuiInputBase-adornedEnd MuiOutlinedInput-adornedEnd",
- "adornedStart": "MuiInputBase-adornedStart MuiOutlinedInput-adornedStart",
- "colorSecondary": "MuiInputBase-colorSecondary MuiOutlinedInput-colorSecondary",
- "disabled": "Mui-disabled Mui-disabled",
- "error": "Mui-error Mui-error",
- "focused": "Mui-focused Mui-focused",
- "formControl": "MuiInputBase-formControl",
- "fullWidth": "MuiInputBase-fullWidth",
- "input": "MuiInputBase-input MuiOutlinedInput-input",
- "inputAdornedEnd": "MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd",
- "inputAdornedStart": "MuiInputBase-inputAdornedStart MuiOutlinedInput-inputAdornedStart",
- "inputHiddenLabel": "MuiInputBase-inputHiddenLabel",
- "inputMarginDense": "MuiInputBase-inputMarginDense MuiOutlinedInput-inputMarginDense",
- "inputMultiline": "MuiInputBase-inputMultiline MuiOutlinedInput-inputMultiline",
- "inputTypeSearch": "MuiInputBase-inputTypeSearch",
- "marginDense": "MuiInputBase-marginDense MuiOutlinedInput-marginDense",
- "multiline": "MuiInputBase-multiline MuiOutlinedInput-multiline",
- "root": "MuiInputBase-root MuiOutlinedInput-root",
- }
- }
- defaultValue="1.0.0"
- fullWidth={false}
- id="policyVersion"
- inputComponent="input"
- multiline={false}
- onChange={[Function]}
- renderSuffix={[Function]}
- type="text"
- >
- <div
- className="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-formControl MuiInputBase-marginDense MuiOutlinedInput-marginDense"
- onClick={[Function]}
- >
- <input
- aria-invalid={false}
- autoFocus={false}
- className="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMarginDense MuiOutlinedInput-inputMarginDense"
- defaultValue="1.0.0"
- disabled={false}
- id="policyVersion"
- onAnimationStart={[Function]}
- onBlur={[Function]}
- onChange={[Function]}
- onFocus={[Function]}
- required={true}
- type="text"
- />
- <WithStyles(ForwardRef(NotchedOutline))
- className="MuiOutlinedInput-notchedOutline"
- label={
- <React.Fragment>
- Required
-  *
- </React.Fragment>
- }
- labelWidth={0}
- notched={true}
- >
- <ForwardRef(NotchedOutline)
- className="MuiOutlinedInput-notchedOutline"
- classes={
- Object {
- "legend": "PrivateNotchedOutline-legend-2",
- "legendLabelled": "PrivateNotchedOutline-legendLabelled-3",
- "legendNotched": "PrivateNotchedOutline-legendNotched-4",
- "root": "PrivateNotchedOutline-root-1",
- }
- }
- label={
- <React.Fragment>
- Required
-  *
- </React.Fragment>
- }
- labelWidth={0}
- notched={true}
- >
- <fieldset
- aria-hidden={true}
- className="PrivateNotchedOutline-root-1 MuiOutlinedInput-notchedOutline"
- >
- <legend
- className="PrivateNotchedOutline-legendLabelled-3 PrivateNotchedOutline-legendNotched-4"
- >
- <span>
- Required
-  *
- </span>
- </legend>
- </fieldset>
- </ForwardRef(NotchedOutline)>
- </WithStyles(ForwardRef(NotchedOutline))>
- </div>
- </ForwardRef(InputBase)>
- </WithStyles(ForwardRef(InputBase))>
- </ForwardRef(OutlinedInput)>
- </WithStyles(ForwardRef(OutlinedInput))>
- </div>
- </ForwardRef(FormControl)>
- </WithStyles(ForwardRef(FormControl))>
- </ForwardRef(TextField)>
- </WithStyles(ForwardRef(TextField))>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- title="Create a new policy version from the defined parameters"
- variant="secondary"
- >
- <button
- className="btn btn-secondary"
- disabled={false}
- onClick={[Function]}
- title="Create a new policy version from the defined parameters"
- type="button"
- >
- Create New Version
- </button>
- </Button>
- <styled.div
- id="onap.policies.monitoring.tcagen2_1.0.0_org.onap.new_1.0.0"
- title="Policy Properties"
- >
- <div
- className="sc-gtsrHT duRXVT"
- id="onap.policies.monitoring.tcagen2_1.0.0_org.onap.new_1.0.0"
- title="Policy Properties"
- />
- </styled.div>
- </div>
- </styled.div>
-</PolicyEditor>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyModal.test.js.snap
deleted file mode 100644
index 8b1261b..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyModal.test.js.snap
+++ /dev/null
@@ -1,159 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify PolicyModal Test the render method 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Edit the policy
- </ModalTitle>
- </ModalHeader>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="success"
- >
- <styled.div />
- </Alert>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="danger"
- >
- <styled.div />
- </Alert>
- <ModalBody>
- <div
- id="editor"
- />
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formPlaintextEmail"
- >
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
- Pdp Group Info
- </FormLabel>
- <Col
- sm="3"
- >
- <StateManager
- defaultInputValue=""
- defaultMenuIsOpen={false}
- defaultValue={null}
- onChange={[Function]}
- options={
- Array [
- Object {
- "label": "monitoring",
- "value": "monitoring",
- },
- ]
- }
- value={
- Object {
- "label": undefined,
- "value": undefined,
- }
- }
- />
- </Col>
- <Col
- sm="3"
- >
- <StateManager
- defaultInputValue=""
- defaultMenuIsOpen={false}
- defaultValue={null}
- onChange={[Function]}
- options={Array []}
- value={
- Object {
- "label": undefined,
- "value": undefined,
- }
- }
- />
- </Col>
- </FormGroup>
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- key="close"
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </Button>
- <Button
- active={false}
- disabled={false}
- key="save"
- onClick={[Function]}
- variant="primary"
- >
- Save Changes
- </Button>
- <Button
- active={false}
- disabled={false}
- key="refresh"
- onClick={[Function]}
- variant="primary"
- >
- Refresh
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap
deleted file mode 100644
index 10a5559..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap
+++ /dev/null
@@ -1,80 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify PolicyToscaFileSelector renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- size="lg"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Create New Policy Tosca Model
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="formPlaintextEmail"
- >
- <Col
- sm="10"
- >
- <input
- accept=".yaml,.yml"
- id="fileUploadButton"
- multiple={true}
- onChange={[Function]}
- style={
- Object {
- "display": "none",
- }
- }
- type="file"
- />
- <label
- htmlFor="fileUploadButton"
- >
- <WithStyles(ForwardRef(Button))
- color="primary"
- component="span"
- startIcon={
- <WithStyles(ForwardRef(SvgIcon))
- fontSize="small"
- >
- <Memo />
- </WithStyles(ForwardRef(SvgIcon))>
- }
- variant="contained"
- >
- Upload Files
- </WithStyles(ForwardRef(Button))>
- <p>
- (Only YAML files are supported)
- </p>
- </label>
- <styled.div />
- </Col>
- </FormGroup>
- </ModalBody>
- <ModalFooter>
- <WithStyles(ForwardRef(Button))
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </WithStyles(ForwardRef(Button))>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ToscaViewer.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ToscaViewer.test.js.snap
deleted file mode 100644
index 61fb485..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ToscaViewer.test.js.snap
+++ /dev/null
@@ -1,30 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify ToscaViewer Test the render method 1`] = `
-<styled.div>
- <pre>
- tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.Guard:
- properties: {
- }
- name: onap.policies.controlloop.Guard
- version: 1.0.0
- derived_from: tosca.policies.Root
- metadata: {
- }
- description: Guard Policies for Control Loop Operational Policies
-name: ToscaServiceTemplateSimple
-version: 1.0.0
-
- </pre>
- <Button
- active={false}
- disabled={false}
- title="Create a new policy version from the defined parameters"
- variant="secondary"
- >
- Create New Version
- </Button>
-</styled.div>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap
deleted file mode 100644
index 24b631b..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap
+++ /dev/null
@@ -1,598 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify ViewAllPolicies renders correctly 1`] = `
-<Fragment>
- <Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
- >
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- />
- <Tabs
- id="controlled-tab-example"
- mountOnEnter={false}
- onSelect={[Function]}
- unmountOnExit={false}
- variant="tabs"
- >
- <Tab
- eventKey="policies"
- title="Policies in Policy Framework"
- >
- <ModalBody>
- <div>
- <styled.div>
- <PoliciesTreeViewer
- policiesData={Array []}
- policiesFilterFunction={[Function]}
- valueForTreeCreation="name"
- />
- </styled.div>
- <styled.div>
- <WithStyles(Component)
- actions={
- Array [
- Object {
- "icon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "onClick": [Function],
- "tooltip": "Delete Policy",
- },
- ]
- }
- columns={
- Array [
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "name",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Policy Name",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "version",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Policy Version",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "type",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Policy Type",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "type_version",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Policy Type Version",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "supportedPdpGroupsString",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Deployable in PDP Group",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "pdpGroupInfoString",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Deployed in PDP Group",
- },
- ]
- }
- data={Array []}
- detailPanel={
- Array [
- Object {
- "icon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "render": [Function],
- "tooltip": "Show Configuration",
- },
- Object {
- "icon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "openIcon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "render": [Function],
- "tooltip": "Show Raw Data",
- },
- Object {
- "icon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "openIcon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "render": [Function],
- "tooltip": "PDP Group Deployment",
- },
- ]
- }
- icons={
- Object {
- "Add": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Check": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Clear": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Delete": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "DetailPanel": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Edit": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Export": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Filter": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "FirstPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "LastPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "NextPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "PreviousPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ResetSearch": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Search": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "SortArrow": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ThirdStateCheck": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ViewColumn": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- }
- }
- onRowClick={[Function]}
- options={
- Object {
- "actionsColumnIndex": -1,
- "exportButton": true,
- "grouping": true,
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "1px solid black",
- "fontSize": "15pt",
- "text": "bold",
- },
- }
- }
- title="Policies"
- />
- </styled.div>
- </div>
- </ModalBody>
- </Tab>
- <Tab
- eventKey="tosca models"
- title="Tosca Models in Policy Framework"
- >
- <ModalBody>
- <div>
- <styled.div>
- <PoliciesTreeViewer
- policiesData={Array []}
- policiesFilterFunction={[Function]}
- valueForTreeCreation="policyModelType"
- />
- </styled.div>
- <styled.div>
- <WithStyles(Component)
- actions={
- Array [
- Object {
- "icon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "isFreeAction": true,
- "onClick": [Function],
- "tooltip": "Add New Tosca Model",
- },
- ]
- }
- columns={
- Array [
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "policyModelType",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Policy Model Type",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "policyAcronym",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Policy Acronym",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "version",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Version",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "field": "updatedBy",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Uploaded By",
- },
- Object {
- "cellStyle": Object {
- "backgroundColor": "#039be5",
- "border": "1px solid black",
- "color": "#FFF",
- },
- "editable": "never",
- "field": "updatedDate",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Uploaded Date",
- },
- ]
- }
- data={Array []}
- detailPanel={
- Array [
- Object {
- "icon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "render": [Function],
- "tooltip": "Show Tosca",
- },
- Object {
- "icon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "openIcon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "render": [Function],
- "tooltip": "Show Raw Data",
- },
- Object {
- "icon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "openIcon": Object {
- "$$typeof": Symbol(react.memo),
- "compare": null,
- "type": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- },
- "render": [Function],
- "tooltip": "Create a policy from this model",
- },
- ]
- }
- icons={
- Object {
- "Add": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Check": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Clear": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Delete": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "DetailPanel": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Edit": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Export": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Filter": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "FirstPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "LastPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "NextPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "PreviousPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ResetSearch": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Search": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "SortArrow": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ThirdStateCheck": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ViewColumn": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- }
- }
- onRowClick={[Function]}
- options={
- Object {
- "actionsColumnIndex": -1,
- "exportButton": true,
- "grouping": true,
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "1px solid black",
- "fontSize": "15pt",
- "text": "bold",
- },
- }
- }
- title="Tosca Models"
- />
- </styled.div>
- </div>
- </ModalBody>
- </Tab>
- </Tabs>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="success"
- >
- <styled.div />
- </Alert>
- <Alert
- closeLabel="Close alert"
- dismissible={true}
- onClose={[Function]}
- show={false}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "render": [Function],
- }
- }
- variant="danger"
- >
- <styled.div />
- </Alert>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
- </Styled(Modal)>
- <PolicyToscaFileSelector
- disableFunction={[Function]}
- show={false}
- toscaTableUpdateFunction={[Function]}
- />
-</Fragment>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaData.test.json b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaData.test.json
deleted file mode 100644
index 3b001b3..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaData.test.json
+++ /dev/null
@@ -1,179 +0,0 @@
-{
- "title": "onap.policies.monitoring.tcagen2",
- "type": "object",
- "required": [
- "tca.policy"
- ],
- "properties": {
- "tca.policy": {
- "title": "onap.datatypes.monitoring.tca_policy",
- "type": "object",
- "required": [
- "domain",
- "metricsPerEventName"
- ],
- "properties": {
- "domain": {
- "type": "string",
- "description": "Domain name to which TCA needs to be applied",
- "default": "measurementsForVfScaling",
- "const": "measurementsForVfScaling"
- },
- "metricsPerEventName": {
- "type": "array",
- "description": "Contains eventName and threshold details that need to be applied to given eventName",
- "items": {
- "title": "onap.datatypes.monitoring.metricsPerEventName",
- "type": "object",
- "required": [
- "controlLoopSchemaType",
- "eventName",
- "policyName",
- "policyScope",
- "policyVersion",
- "thresholds"
- ],
- "properties": {
- "controlLoopSchemaType": {
- "type": "string",
- "description": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM",
- "enum": [
- "VM",
- "VNF"
- ]
- },
- "eventName": {
- "type": "string",
- "description": "Event name to which thresholds need to be applied"
- },
- "policyName": {
- "type": "string",
- "description": "TCA Policy Scope Name"
- },
- "policyScope": {
- "type": "string",
- "description": "TCA Policy Scope"
- },
- "policyVersion": {
- "type": "string",
- "description": "TCA Policy Scope Version"
- },
- "thresholds": {
- "type": "array",
- "description": "Thresholds associated with eventName",
- "items": {
- "title": "onap.datatypes.monitoring.thresholds",
- "type": "object",
- "required": [
- "closedLoopControlName",
- "closedLoopEventStatus",
- "direction",
- "fieldPath",
- "severity",
- "thresholdValue",
- "version"
- ],
- "properties": {
- "closedLoopControlName": {
- "type": "string",
- "description": "Closed Loop Control Name associated with the threshold"
- },
- "closedLoopEventStatus": {
- "type": "string",
- "description": "Closed Loop Event Status of the threshold",
- "enum": [
- "ONSET",
- "ABATED"
- ]
- },
- "direction": {
- "type": "string",
- "description": "Direction of the threshold",
- "enum": [
- "LESS",
- "LESS_OR_EQUAL",
- "GREATER",
- "GREATER_OR_EQUAL",
- "EQUAL"
- ]
- },
- "fieldPath": {
- "type": "string",
- "description": "Json field Path as per CEF message which needs to be analyzed for TCA",
- "enum": [
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage",
- "$.event.measurementsForVfScalingFields.meanRequestLatency",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed",
- "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
- ]
- },
- "severity": {
- "type": "string",
- "description": "Threshold Event Severity",
- "enum": [
- "CRITICAL",
- "MAJOR",
- "MINOR",
- "WARNING",
- "NORMAL"
- ]
- },
- "thresholdValue": {
- "type": "integer",
- "description": "Threshold value for the field Path inside CEF message"
- },
- "version": {
- "type": "string",
- "description": "Version number associated with the threshold"
- }
- }
- },
- "format": "tabs-top"
- }
- }
- },
- "format": "tabs-top"
- }
- }
- }
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaData.test.yaml b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaData.test.yaml
deleted file mode 100644
index 15a3cec..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaData.test.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_1_0
-policy_types:
- onap.policies.controlloop.Guard:
- properties: {
- }
- name: onap.policies.controlloop.Guard
- version: 1.0.0
- derived_from: tosca.policies.Root
- metadata: {
- }
- description: Guard Policies for Control Loop Operational Policies
-name: ToscaServiceTemplateSimple
-version: 1.0.0
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaInstantiationData.test.json b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaInstantiationData.test.json
deleted file mode 100644
index 176d921..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaInstantiationData.test.json
+++ /dev/null
@@ -1,59 +0,0 @@
-{
- "acmList": [
- {
- "name": "PMSHInstance0",
- "version": "1.0.1",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
- "version": "1.2.3"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "PMSH control loop instance 0",
- "elements": {
- "709c62b3-8918-41b9-a747-d21eb79c6c20": {
- "id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
- "version": "1.2.3"
- },
- "participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
- },
- "709c62b3-8918-41b9-a747-d21eb79c6c21": {
- "id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
- },
- "709c62b3-8918-41b9-a747-d21eb79c6c22": {
- "id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
- "version": "1.2.3"
- },
- "participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
- }
- }
- }
- ]
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaModels.test.json b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaModels.test.json
deleted file mode 100644
index aa757a8..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaModels.test.json
+++ /dev/null
@@ -1,23 +0,0 @@
-[
- {
- "policyModelType": "onap.policies.controlloop.guard.common.Blacklist",
- "version": "1.0.0",
- "policyAcronym": "Blacklist",
- "policyPdpGroup": {
- "supportedPdpGroups": [
- {
- "controlloop": [
- "xacml"
- ]
- }
- ]
- },
- "createdDate": "2021-06-17T15:15:11.250177Z",
- "updatedDate": "2021-06-17T15:15:11.450816Z",
- "updatedBy": "Not found",
- "createdBy": "Not found",
- "tableData": {
- "id": 0
- }
- }
-] \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesData.test.json b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesData.test.json
deleted file mode 100644
index a852daf..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesData.test.json
+++ /dev/null
@@ -1,336 +0,0 @@
-[
- {
- "type": "onap.policies.monitoring.tcagen2",
- "type_version": "1.0.0",
- "properties": {
- "tca.policy": {
- "domain": "measurementsForVfScaling",
- "metricsPerEventName": [
- {
- "policyScope": "DCAE",
- "thresholds": [
- {
- "version": "1.0.2",
- "severity": "MAJOR",
- "thresholdValue": 200,
- "closedLoopEventStatus": "ONSET",
- "closedLoopControlName": "LOOP_test",
- "direction": "LESS_OR_EQUAL",
- "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta"
- }
- ],
- "eventName": "vLoadBalancer",
- "policyVersion": "v0.0.1",
- "controlLoopSchemaType": "VM",
- "policyName": "DCAE.Config_tca-hi-lo"
- }
- ]
- }
- },
- "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "version": "1.0.0",
- "metadata": {
- "policy-id": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "policy-version": "1.0.0"
- },
- "pdpGroupInfo": [
- {
- "monitoring": {
- "name": "monitoring",
- "description": "This group should be used for managing all monitoring related policies and pdps",
- "pdpGroupState": "ACTIVE",
- "properties": {},
- "pdpSubgroups": [
- {
- "pdpType": "xacml",
- "supportedPolicyTypes": [
- {
- "name": "onap.policies.monitoring.*",
- "version": "1.0.0"
- },
- {
- "name": "onap.policies.Naming",
- "version": "1.0.0"
- }
- ],
- "policies": [
- {
- "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "version": "1.0.0"
- }
- ],
- "currentInstanceCount": 0,
- "desiredInstanceCount": 1,
- "properties": {},
- "pdpInstances": [
- {
- "instanceId": "monitoring-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
- "pdpState": "ACTIVE",
- "healthy": "HEALTHY",
- "message": "Pdp Heartbeat",
- "lastUpdate": "2021-09-29T02:51:21Z"
- }
- ]
- }
- ]
- }
- }
- ],
- "supportedPdpGroups": [
- {
- "monitoring": [
- "xacml"
- ]
- }
- ],
- "supportedPdpGroupsString": "monitoring/xacml\r\n",
- "pdpGroupInfoString": "monitoring/xacml (ACTIVE)\r\n",
- "tableData": {
- "id": 0
- }
- },
- {
- "type": "onap.policies.controlloop.operational.common.Drools",
- "type_version": "1.0.0",
- "properties": {
- "abatement": false,
- "operations": [
- {
- "failure_retries": "final_failure_retries",
- "id": "test1",
- "failure_timeout": "final_failure_timeout",
- "failure": "final_failure",
- "operation": {
- "payload": {
- "artifact_name": "baseconfiguration",
- "artifact_version": "1.0.0",
- "mode": "async",
- "data": "{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"hostname\":\"\",\"request-info\":{\"prop1\":\"\",\"prop2\":\"\"}}}"
- },
- "target": {
- "entityIds": {
- "resourceID": "Vloadbalancerms..vdns..module-3",
- "modelInvariantId": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
- "modelVersionId": "4fa73b49-8a6c-493e-816b-eb401567b720",
- "modelName": "Vloadbalancerms..vdns..module-3",
- "modelVersion": "1",
- "modelCustomizationId": "bafcdab0-801d-4d81-9ead-f464640a38b1"
- },
- "targetType": "VNF"
- },
- "actor": "SDNR",
- "operation": "BandwidthOnDemand"
- },
- "failure_guard": "final_failure_guard",
- "retries": 0,
- "timeout": 0,
- "failure_exception": "final_failure_exception",
- "description": "test",
- "success": "final_success"
- }
- ],
- "trigger": "test1",
- "timeout": 0,
- "id": "LOOP_test"
- },
- "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd",
- "version": "1.0.0",
- "metadata": {
- "policy-id": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd",
- "policy-version": "1.0.0"
- },
- "pdpGroupInfo": [
- {
- "controlloop": {
- "name": "controlloop",
- "description": "This group should be used for managing all control loop related policies and pdps",
- "pdpGroupState": "ACTIVE",
- "properties": {},
- "pdpSubgroups": [
- {
- "pdpType": "apex",
- "supportedPolicyTypes": [
- {
- "name": "onap.policies.controlloop.Operational",
- "version": "1.0.0"
- },
- {
- "name": "onap.policies.controlloop.operational.common.*",
- "version": "1.0.0"
- }
- ],
- "policies": [
- {
- "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd",
- "version": "1.0.0"
- }
- ],
- "currentInstanceCount": 0,
- "desiredInstanceCount": 1,
- "properties": {},
- "pdpInstances": [
- {
- "instanceId": "controlloop-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
- "pdpState": "ACTIVE",
- "healthy": "HEALTHY",
- "message": "Pdp Heartbeat",
- "lastUpdate": "2021-09-29T02:51:21Z"
- }
- ]
- },
- {
- "pdpType": "drools",
- "supportedPolicyTypes": [
- {
- "name": "onap.policies.controlloop.operational.common.*",
- "version": "1.0.0"
- },
- {
- "name": "onap.policies.controlloop.Operational",
- "version": "1.0.0"
- }
- ],
- "policies": [
- {
- "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd",
- "version": "1.0.0"
- }
- ],
- "currentInstanceCount": 0,
- "desiredInstanceCount": 1,
- "properties": {},
- "pdpInstances": [
- {
- "instanceId": "drools-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
- "pdpState": "ACTIVE",
- "healthy": "HEALTHY",
- "message": "Pdp Heartbeat",
- "lastUpdate": "2021-09-29T02:51:21Z"
- }
- ]
- }
- ]
- }
- }
- ],
- "supportedPdpGroups": [
- {
- "controlloop": [
- "apex",
- "drools"
- ]
- }
- ],
- "supportedPdpGroupsString": "controlloop/apex\r\ncontrolloop/drools\r\n",
- "pdpGroupInfoString": "controlloop/apex (ACTIVE)\r\ncontrolloop/drools (ACTIVE)\r\n",
- "tableData": {
- "id": 1
- }
- },
- {
- "type": "onap.policies.Naming",
- "type_version": "1.0.0",
- "properties": {
- "naming-models": [
- {
- "naming-type": "VNF",
- "naming-recipe": "AIC_CLOUD_REGION|DELIMITER|CONSTANT|DELIMITER|TIMESTAMP",
- "name-operation": "to_lower_case()",
- "naming-properties": [
- {
- "property-name": "AIC_CLOUD_REGION"
- },
- {
- "property-name": "CONSTANT",
- "property-value": "onap-nf"
- },
- {
- "property-name": "TIMESTAMP"
- },
- {
- "property-value": "-",
- "property-name": "DELIMITER"
- }
- ]
- },
- {
- "naming-type": "VNFC",
- "naming-recipe": "VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE",
- "name-operation": "to_lower_case()",
- "naming-properties": [
- {
- "property-name": "VNF_NAME"
- },
- {
- "property-name": "SEQUENCE",
- "increment-sequence": {
- "max": "zzz",
- "scope": "ENTIRETY",
- "start-value": "1",
- "length": "3",
- "increment": "1",
- "sequence-type": "alpha-numeric"
- }
- },
- {
- "property-name": "NFC_NAMING_CODE"
- },
- {
- "property-value": "-",
- "property-name": "DELIMITER"
- }
- ]
- },
- {
- "naming-type": "VF-MODULE",
- "naming-recipe": "VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE",
- "name-operation": "to_lower_case()",
- "naming-properties": [
- {
- "property-name": "VNF_NAME"
- },
- {
- "property-value": "-",
- "property-name": "DELIMITER"
- },
- {
- "property-name": "VF_MODULE_LABEL"
- },
- {
- "property-name": "VF_MODULE_TYPE"
- },
- {
- "property-name": "SEQUENCE",
- "increment-sequence": {
- "max": "zzz",
- "scope": "PRECEEDING",
- "start-value": "1",
- "length": "3",
- "increment": "1",
- "sequence-type": "alpha-numeric"
- }
- }
- ]
- }
- ],
- "policy-instance-name": "ONAP_NF_NAMING_TIMESTAMP"
- },
- "name": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP",
- "version": "1.0.0",
- "metadata": {
- "policy-id": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP",
- "policy-version": "1.0.0"
- },
- "supportedPdpGroups": [
- {
- "monitoring": [
- "xacml"
- ]
- }
- ],
- "supportedPdpGroupsString": "monitoring/xacml\r\n",
- "tableData": {
- "id": 2
- }
- }
-] \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesList.test.json b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesList.test.json
deleted file mode 100644
index 0da8beb..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesList.test.json
+++ /dev/null
@@ -1,94 +0,0 @@
-{
- "policies": [
- {
- "type": "onap.policies.monitoring.tcagen2",
- "type_version": "1.0.0",
- "properties": {
- "tca.policy": {
- "domain": "measurementsForVfScaling",
- "metricsPerEventName": [
- {
- "policyScope": "DCAE",
- "thresholds": [
- {
- "version": "1.0.2",
- "severity": "MAJOR",
- "thresholdValue": 200,
- "closedLoopEventStatus": "ONSET",
- "closedLoopControlName": "LOOP_test",
- "direction": "LESS_OR_EQUAL",
- "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta"
- }
- ],
- "eventName": "vLoadBalancer",
- "policyVersion": "v0.0.1",
- "controlLoopSchemaType": "VM",
- "policyName": "DCAE.Config_tca-hi-lo"
- }
- ]
- }
- },
- "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "version": "1.0.0",
- "metadata": {
- "policy-id": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "policy-version": "1.0.0"
- },
- "pdpGroupInfo": [
- {
- "monitoring": {
- "name": "monitoring",
- "description": "This group should be used for managing all monitoring related policies and pdps",
- "pdpGroupState": "ACTIVE",
- "properties": {},
- "pdpSubgroups": [
- {
- "pdpType": "xacml",
- "supportedPolicyTypes": [
- {
- "name": "onap.policies.monitoring.*",
- "version": "1.0.0"
- },
- {
- "name": "onap.policies.Naming",
- "version": "1.0.0"
- }
- ],
- "policies": [
- {
- "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "version": "1.0.0"
- }
- ],
- "currentInstanceCount": 0,
- "desiredInstanceCount": 1,
- "properties": {},
- "pdpInstances": [
- {
- "instanceId": "monitoring-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
- "pdpState": "ACTIVE",
- "healthy": "HEALTHY",
- "message": "Pdp Heartbeat",
- "lastUpdate": "2021-09-29T02:51:21Z"
- }
- ]
- }
- ]
- }
- }
- ],
- "supportedPdpGroups": [
- {
- "monitoring": [
- "xacml"
- ]
- }
- ],
- "supportedPdpGroupsString": "monitoring/xacml\r\n",
- "pdpGroupInfoString": "monitoring/xacml (ACTIVE)\r\n",
- "tableData": {
- "id": 0
- }
- }
- ]
-} \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPolicyDeploymentEditor.test.json b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPolicyDeploymentEditor.test.json
deleted file mode 100644
index f6907e5..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPolicyDeploymentEditor.test.json
+++ /dev/null
@@ -1,90 +0,0 @@
-{
- "type": "onap.policies.monitoring.tcagen2",
- "type_version": "1.0.0",
- "properties": {
- "tca.policy": {
- "domain": "measurementsForVfScaling",
- "metricsPerEventName": [
- {
- "policyScope": "DCAE",
- "thresholds": [
- {
- "version": "1.0.2",
- "severity": "MAJOR",
- "thresholdValue": 200,
- "closedLoopEventStatus": "ONSET",
- "closedLoopControlName": "LOOP_test",
- "direction": "LESS_OR_EQUAL",
- "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta"
- }
- ],
- "eventName": "vLoadBalancer",
- "policyVersion": "v0.0.1",
- "controlLoopSchemaType": "VM",
- "policyName": "DCAE.Config_tca-hi-lo"
- }
- ]
- }
- },
- "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "version": "1.0.0",
- "metadata": {
- "policy-id": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "policy-version": "1.0.0"
- },
- "pdpGroupInfo": [
- {
- "monitoring": {
- "name": "monitoring",
- "description": "This group should be used for managing all monitoring related policies and pdps",
- "pdpGroupState": "ACTIVE",
- "properties": {},
- "pdpSubgroups": [
- {
- "pdpType": "xacml",
- "supportedPolicyTypes": [
- {
- "name": "onap.policies.monitoring.*",
- "version": "1.0.0"
- },
- {
- "name": "onap.policies.Naming",
- "version": "1.0.0"
- }
- ],
- "policies": [
- {
- "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0",
- "version": "1.0.0"
- }
- ],
- "currentInstanceCount": 0,
- "desiredInstanceCount": 1,
- "properties": {},
- "pdpInstances": [
- {
- "instanceId": "monitoring-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
- "pdpState": "ACTIVE",
- "healthy": "HEALTHY",
- "message": "Pdp Heartbeat",
- "lastUpdate": "2021-09-29T02:51:21Z"
- }
- ]
- }
- ]
- }
- }
- ],
- "supportedPdpGroups": [
- {
- "monitoring": [
- "xacml"
- ]
- }
- ],
- "supportedPdpGroupsString": "monitoring/xacml\r\n",
- "pdpGroupInfoString": "monitoring/xacml (ACTIVE)\r\n",
- "tableData": {
- "id": 0
- }
-} \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/RefreshStatus.js b/gui-clamp/ui-react/src/components/dialogs/RefreshStatus.js
deleted file mode 100644
index e23ab3f..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/RefreshStatus.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import LoopActionService from '../../api/LoopActionService';
-import Spinner from 'react-bootstrap/Spinner';
-import styled from 'styled-components';
-
-const StyledSpinnerDiv = styled.div`
- justify-content: center !important;
- display: flex !important;
-`;
-
-export default class RefreshStatus extends React.Component {
- state = {
- loopName: this.props.loopCache.getLoopName()
- };
-
- componentWillReceiveProps(newProps) {
- this.setState({
- loopName: newProps.loopCache.getLoopName()
- });
- }
-
- componentDidMount() {
- // refresh status and update loop logs
- LoopActionService.refreshStatus(this.state.loopName).then(data => {
- this.props.showSucAlert("Status successfully refreshed");
- this.props.updateLoopFunction(data);
- this.props.history.push('/');
- })
- .catch(error => {
- this.props.showFailAlert("Status refreshing failed");
- this.props.history.push('/');
- });
- }
-
- render() {
- return (
- <StyledSpinnerDiv>
- <Spinner animation="border" role="status">
- </Spinner>
- </StyledSpinnerDiv>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/RefreshStatus.test.js b/gui-clamp/ui-react/src/components/dialogs/RefreshStatus.test.js
deleted file mode 100644
index 7736ffd..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/RefreshStatus.test.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import RefreshStatus from './RefreshStatus';
-import LoopCache from '../../api/LoopCache';
-import LoopActionService from '../../api/LoopActionService';
-
-describe('Verify RefreshStatus', () => {
-
- const loopCache = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca"
- });
-
- it('Test refresh status failed', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const historyMock = { push: jest.fn() };
- const showSucAlert = jest.fn();
- const showFailAlert = jest.fn();
-
- const component = shallow(<RefreshStatus loopCache={ loopCache } history={ historyMock } showSucAlert={ showSucAlert } showFailAlert={ showFailAlert }/>)
- await flushPromises();
- component.update();
-
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
- it('Test refresh status successful', async () => {
- const flushPromises = () => new Promise(setImmediate);
- const historyMock = { push: jest.fn() };
- const updateLoopFunction = jest.fn();
- const showSucAlert = jest.fn();
- const showFailAlert = jest.fn();
-
- LoopActionService.refreshStatus = jest.fn().mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- }
- });
- });
-
- const component = shallow(<RefreshStatus loopCache={ loopCache }
- loopAction="submit" history={ historyMock } updateLoopFunction={ updateLoopFunction } showSucAlert={ showSucAlert } showFailAlert={ showFailAlert }/>)
- await flushPromises();
- component.update();
-
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- });
-
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.js b/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.js
deleted file mode 100644
index e7be984..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.js
+++ /dev/null
@@ -1,173 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2019, 2021 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============================================
- * ===================================================================
- *
- */
-
-import React, { forwardRef } from 'react'
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import styled from 'styled-components';
-import TemplateService from '../../../api/TemplateService';
-import ArrowUpward from '@material-ui/icons/ArrowUpward';
-import ChevronLeft from '@material-ui/icons/ChevronLeft';
-import ChevronRight from '@material-ui/icons/ChevronRight';
-import Clear from '@material-ui/icons/Clear';
-import FirstPage from '@material-ui/icons/FirstPage';
-import LastPage from '@material-ui/icons/LastPage';
-import Search from '@material-ui/icons/Search';
-import MaterialTable from "material-table";
-import LoopCache from '../../../api/LoopCache';
-import SvgGenerator from '../../loop_viewer/svg/SvgGenerator';
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-const cellStyle = { border: '1px solid black' };
-const headerStyle = { backgroundColor: '#ddd', border: '2px solid black' };
-const rowHeaderStyle = { backgroundColor: '#ddd', fontSize: '15pt', text: 'bold', border: '1px solid black' };
-
-export default class ViewLoopTemplatesModal extends React.Component {
- state = {
- show: true,
- content: 'Please select a loop template to display it',
- selectedRow: -1,
- loopTemplatesData: [],
- fakeLoopCacheWithTemplate: new LoopCache({}),
- loopTemplateColumnsDefinition: [
- {
- title: "#", field: "index", render: rowData => rowData.tableData.id + 1,
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Template Name", field: "name",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Service Model Name", field: "modelService.serviceDetails.name",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Loop Type Allowed", field: "allowedLoopType",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "# Instances Allowed", field: "maximumInstancesAllowed",
- cellStyle: cellStyle,
- headerStyle: headerStyle
- },
- {
- title: "Modified Date", field: "updatedDate", editable: 'never',
- cellStyle: cellStyle,
- headerStyle: headerStyle
- }
- ],
- tableIcons: {
- FirstPage: forwardRef((props, ref) => <FirstPage { ...props } ref={ ref }/>),
- LastPage: forwardRef((props, ref) => <LastPage { ...props } ref={ ref }/>),
- NextPage: forwardRef((props, ref) => <ChevronRight { ...props } ref={ ref }/>),
- PreviousPage: forwardRef((props, ref) => <ChevronLeft { ...props } ref={ ref }/>),
- ResetSearch: forwardRef((props, ref) => <Clear { ...props } ref={ ref }/>),
- Search: forwardRef((props, ref) => <Search { ...props } ref={ ref }/>),
- SortArrow: forwardRef((props, ref) => <ArrowUpward { ...props } ref={ ref }/>)
- }
- };
-
- constructor(props, context) {
- super(props, context);
- this.handleClose = this.handleClose.bind(this);
- this.renderSvg = this.renderSvg.bind(this);
- this.getLoopTemplate = this.getLoopTemplate.bind(this);
- this.getAllLoopTemplates();
- }
-
- getAllLoopTemplates() {
- TemplateService.getAllLoopTemplates().then(templatesData => {
- // replace -1 in maximumInstancesAllowed with more meaningful 'No Limit'
- for (let item in templatesData) {
- if (templatesData[item].maximumInstancesAllowed === -1) {
- templatesData[item].maximumInstancesAllowed = 'No Limit';
- }
- }
- this.setState({ loopTemplatesData: templatesData })
- });
- }
-
- getLoopTemplate(templateIdInDataArray) {
- if (typeof templateIdInDataArray !== "undefined") {
- this.setState({
- fakeLoopCacheWithTemplate:
- new LoopCache({
- "loopTemplate": this.state.loopTemplatesData[templateIdInDataArray],
- "name": "fakeLoop"
- })
- })
- } else {
- this.setState({ fakeLoopCacheWithTemplate: new LoopCache({}) })
- }
- }
-
- handleClose() {
- this.setState({ show: false });
- this.props.history.push('/')
- }
-
- renderSvg() {
- return (
- <SvgGenerator loopCache={ this.state.fakeLoopCacheWithTemplate } clickable={ false } generatedFrom={ SvgGenerator.GENERATED_FROM_TEMPLATE }/>
- )
- }
-
- render() {
- return (
- <ModalStyled size="xl" show={ this.state.show } onHide={ this.handleClose } backdrop="static" keyboard={ false }>
- <Modal.Header closeButton>
- </Modal.Header>
- <Modal.Body>
- <MaterialTable
- title={ "View Blueprint MicroService Templates" }
- data={ this.state.loopTemplatesData }
- columns={ this.state.loopTemplateColumnsDefinition }
- icons={ this.state.tableIcons }
- onRowClick={ (event, rowData) => {
- this.getLoopTemplate(rowData.tableData.id);
- this.setState({ selectedRow: rowData.tableData.id })
- } }
- options={ {
- headerStyle: rowHeaderStyle,
- rowStyle: rowData => ({
- backgroundColor: (this.state.selectedRow !== -1 && this.state.selectedRow === rowData.tableData.id) ? '#EEE' : '#FFF'
- })
- } }
- />
- { this.renderSvg() }
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary" onClick={ this.handleClose }>Close</Button>
- </Modal.Footer>
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.test.js
deleted file mode 100644
index fd52761..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.test.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import ViewLoopTemplatesModal from './ViewLoopTemplatesModal';
-import { mount } from 'enzyme';
-import { BrowserRouter as Router } from 'react-router-dom';
-
-describe('Verify ViewLoopTemplatesModal', () => {
- beforeEach(() => {
- fetch.resetMocks();
- });
-
- it('Test API Successful', () => {
- fetch.mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "index": "1",
- "name": "MTCA version 1",
- "modelService.serviceDetails.name": "MTCA",
- "allowedLoopType": "CLOSED",
- "maximumInstancesAllowed": 1,
- "updatedDate": "2019-09-06 19:09:42"
- });
- }
- });
- });
- const component = shallow(<ViewLoopTemplatesModal/>);
- });
-
- it('Test API Exception', () => {
- fetch.mockImplementationOnce(() => {
- return Promise.resolve({
- ok: false,
- status: 500,
- json: () => {
- return Promise.resolve({
- "index": "1",
- "name": "MTCA version 1",
- "modelService.serviceDetails.name": "MTCA",
- "allowedLoopType": "CLOSED",
- "maximumInstancesAllowed": 1,
- "updatedDate": "2019-09-06 19:09:42"
- });
- }
- });
- });
- shallow(<ViewLoopTemplatesModal/>);
- });
-
- it('Test API Rejection', () => {
- const myMockFunc = fetch.mockImplementationOnce(() => Promise.reject('error'));
- setTimeout(() => myMockFunc().catch(e => {
- console.info(e);
- }),
- 100
- );
- shallow(<ViewLoopTemplatesModal/>);
- expect(myMockFunc.mock.calls.length).toBe(1);
- });
-
- it('Test the tosca model view render method', () => {
- fetch.mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "index": "1",
- "name": "MTCA version 1",
- "modelService.serviceDetails.name": "MTCA",
- "allowedLoopType": "CLOSED",
- "maximumInstancesAllowed": 1,
- "updatedDate": "2019-09-06 19:09:42"
- });
- }
- });
- });
- const component = shallow(<ViewLoopTemplatesModal/>);
- component.setState({
- loopTemplateData: {
- "index": "1",
- "name": "MTCA version 1",
- "modelService.serviceDetails.name": "MTCA",
- "allowedLoopType": "CLOSED",
- "maximumInstancesAllowed": 1,
- "updatedDate": "2019-09-06 19:09:42"
- }
- });
- expect(component).toMatchSnapshot();
- });
-
- it('Test Table icons', () => {
- fetch.mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "index": "1",
- "name": "MTCA version 1",
- "modelService.serviceDetails.name": "MTCA",
- "allowedLoopType": "CLOSED",
- "maximumInstancesAllowed": 1,
- "updatedDate": "2019-09-06 19:09:42"
- });
- }
- });
- });
- const component = mount(<Router><ViewLoopTemplatesModal/></Router>);
- expect(component.find('[className="MuiSelect-icon MuiTablePagination-selectIcon"]')).toBeTruthy();
- });
-
- it('Test handleClose', () => {
- fetch.mockImplementationOnce(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "index": "1",
- "name": "MTCA version 1",
- "modelService.serviceDetails.name": "MTCA",
- "allowedLoopType": "CLOSED",
- "maximumInstancesAllowed": 1,
- "updatedDate": "2019-09-06 19:09:42"
- });
- }
- });
- });
- const historyMock = { push: jest.fn() };
- const handleClose = jest.spyOn(ViewLoopTemplatesModal.prototype, 'handleClose');
- const component = shallow(<ViewLoopTemplatesModal history={ historyMock }/>)
- component.find('[variant="secondary"]').prop('onClick')();
- expect(handleClose).toHaveBeenCalledTimes(1);
- expect(component.state('show')).toEqual(false);
- expect(historyMock.push.mock.calls[0]).toEqual(['/']);
- handleClose.mockClear();
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/Tosca/__snapshots__/ViewLoopTemplatesModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Tosca/__snapshots__/ViewLoopTemplatesModal.test.js.snap
deleted file mode 100644
index 73f6596..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/Tosca/__snapshots__/ViewLoopTemplatesModal.test.js.snap
+++ /dev/null
@@ -1,157 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify ViewLoopTemplatesModal Test the tosca model view render method 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="xl"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- />
- <ModalBody>
- <WithStyles(Component)
- columns={
- Array [
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "field": "index",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "render": [Function],
- "title": "#",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "field": "name",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Template Name",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "field": "modelService.serviceDetails.name",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Service Model Name",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "field": "allowedLoopType",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Loop Type Allowed",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "field": "maximumInstancesAllowed",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "# Instances Allowed",
- },
- Object {
- "cellStyle": Object {
- "border": "1px solid black",
- },
- "editable": "never",
- "field": "updatedDate",
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "2px solid black",
- },
- "title": "Modified Date",
- },
- ]
- }
- data={Array []}
- icons={
- Object {
- "FirstPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "LastPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "NextPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "PreviousPage": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "ResetSearch": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "Search": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- "SortArrow": Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- },
- }
- }
- onRowClick={[Function]}
- options={
- Object {
- "headerStyle": Object {
- "backgroundColor": "#ddd",
- "border": "1px solid black",
- "fontSize": "15pt",
- "text": "bold",
- },
- "rowStyle": [Function],
- }
- }
- title="View Blueprint MicroService Templates"
- />
- <withRouter(SvgGenerator)
- clickable={false}
- generatedFrom="TEMPLATE"
- loopCache={
- LoopCache {
- "loopJsonCache": Object {},
- }
- }
- />
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/UserInfoModal.js b/gui-clamp/ui-react/src/components/dialogs/UserInfoModal.js
deleted file mode 100644
index d452f6d..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/UserInfoModal.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import Button from 'react-bootstrap/Button';
-import Modal from 'react-bootstrap/Modal';
-import Form from 'react-bootstrap/Form';
-import Row from 'react-bootstrap/Row';
-import Col from 'react-bootstrap/Col';
-import styled from 'styled-components';
-import UserService from '../../api/UserService';
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-export default class UserInfoModal extends React.Component {
-
- constructor(props, context) {
- super(props, context);
-
- this.handleClose = this.handleClose.bind(this);
- this.renderPermissions = this.renderPermissions.bind(this);
- this.renderUserName = this.renderUserName.bind(this);
- this.state = {
- show: true,
- userInfo: {}
- };
- }
-
- componentWillMount() {
- UserService.getUserInfo().then(userInfo => {
- this.setState({ userInfo: userInfo })
- });
- }
-
- handleClose() {
- this.props.history.push('/');
- }
-
- renderPermissions() {
- if (this.state.userInfo["allPermissions"]) {
- var listOfPermissions = this.state.userInfo["allPermissions"].map(function (perm) {
- return <Form.Control key={ perm } plaintext readOnly defaultValue={ perm }/>;
- })
- return listOfPermissions;
- } else {
- return;
- }
- }
-
- renderUserName() {
- if (this.state.userInfo["userName"]) {
- return <Form.Control plaintext readOnly defaultValue={ this.state.userInfo["userName"] }/>
- } else {
- return;
- }
- }
-
- renderVersion() {
- if (this.state.userInfo["cldsVersion"]) {
- return <Form.Control plaintext readOnly defaultValue={ this.state.userInfo["cldsVersion"] }/>
- } else {
- return;
- }
- }
-
- render() {
- return (
- <ModalStyled size="lg" show={ this.state.show } onHide={ this.handleClose }>
- <Modal.Header closeButton>
- <Modal.Title>User Info</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <Form.Group as={ Row } controlId="userName">
- <Form.Label column sm="3">Current User:</Form.Label>
- <Col>{ this.renderUserName() }</Col>
- </Form.Group>
- <Form.Group as={ Row } controlId="cldsVersion">
- <Form.Label column sm="3">CLDS Version:</Form.Label>
- <Col>{ this.renderVersion() }</Col>
- </Form.Group>
- <Form.Group as={ Row } controlId="userPermissions">
- <Form.Label column sm="3">User Permissions:</Form.Label>
- <Col>
- { this.renderPermissions() }
- </Col>
- </Form.Group>
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary" type="null" onClick={ this.handleClose }>Cancel</Button>
- </Modal.Footer>
- </ModalStyled>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/dialogs/UserInfoModal.test.js b/gui-clamp/ui-react/src/components/dialogs/UserInfoModal.test.js
deleted file mode 100644
index 7168792..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/UserInfoModal.test.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import UserInfoModal from './UserInfoModal';
-
-describe('Verify UserInfoModal', () => {
-
- beforeEach(() => {
- fetch.resetMocks();
- fetch.mockImplementation(() => {
- return Promise.resolve({
- ok: true,
- status: 200,
- json: () => {
- return Promise.resolve({
- "userName": "test",
- "cldsVersion": "1.0.0"
- });
- }
- });
- });
- })
-
- it('Test the render method full permission', () => {
- const component = shallow(<UserInfoModal/>)
- component.setState({
- userInfo: {
- "userName": "test",
- "cldsVersion": "1.0.0",
- "allPermissions": ["permission1", "permission2"]
- }
- });
- expect(component).toMatchSnapshot();
- });
-
- it('Test the render method no permission', () => {
- const component = shallow(<UserInfoModal/>)
- component.setState({
- userInfo: {}
- });
-
- expect(component.find('FormControl').length).toEqual(0);
- });
-
- it('Test the render method read permission', () => {
- const component = shallow(<UserInfoModal/>)
- component.setState({
- userInfo: {
- "userName": "test",
- "cldsVersion": "1.0.0",
- "allPermissions": ["permission1", "permission2"]
- }
- });
-
- expect(component.find('FormControl').length).toEqual(4);
-
- const forms = component.find('FormControl');
- expect(forms.get(0).props.defaultValue).toEqual("test");
- expect(forms.get(1).props.defaultValue).toEqual("1.0.0");
- expect(forms.get(2).props.defaultValue).toEqual("permission1");
- expect(forms.get(3).props.defaultValue).toEqual("permission2");
- });
-});
diff --git a/gui-clamp/ui-react/src/components/dialogs/__snapshots__/UserInfoModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/__snapshots__/UserInfoModal.test.js.snap
deleted file mode 100644
index 548a2d9..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/__snapshots__/UserInfoModal.test.js.snap
+++ /dev/null
@@ -1,119 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify UserInfoModal Test the render method full permission 1`] = `
-<Styled(Modal)
- onHide={[Function]}
- show={true}
- size="lg"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- User Info
- </ModalTitle>
- </ModalHeader>
- <ModalBody>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="userName"
- >
- <FormLabel
- column={true}
- sm="3"
- srOnly={false}
- >
- Current User:
- </FormLabel>
- <Col>
- <FormControl
- defaultValue="test"
- plaintext={true}
- readOnly={true}
- />
- </Col>
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="cldsVersion"
- >
- <FormLabel
- column={true}
- sm="3"
- srOnly={false}
- >
- CLDS Version:
- </FormLabel>
- <Col>
- <FormControl
- defaultValue="1.0.0"
- plaintext={true}
- readOnly={true}
- />
- </Col>
- </FormGroup>
- <FormGroup
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "noGutters": false,
- },
- "render": [Function],
- }
- }
- controlId="userPermissions"
- >
- <FormLabel
- column={true}
- sm="3"
- srOnly={false}
- >
- User Permissions:
- </FormLabel>
- <Col>
- <FormControl
- defaultValue="permission1"
- key="permission1"
- plaintext={true}
- readOnly={true}
- />
- <FormControl
- defaultValue="permission2"
- key="permission2"
- plaintext={true}
- readOnly={true}
- />
- </Col>
- </FormGroup>
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Cancel
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/logs/LoopLogs.js b/gui-clamp/ui-react/src/components/loop_viewer/logs/LoopLogs.js
deleted file mode 100644
index 3435ba3..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/logs/LoopLogs.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import Table from 'react-bootstrap/Table';
-import LoopCache from '../../../api/LoopCache';
-import styled from 'styled-components';
-
-const LoopLogsHeaderDivStyled = styled.div`
- background-color: ${ props => props.theme.loopLogsHeaderBackgroundColor };
- padding: 10px 10px;
- color: ${ props => props.theme.loopLogsHeaderFontColor };
-`
-const TableStyled = styled(Table)`
-
- overflow: auto;
-`
-const TableRow = ({ logRow }) => (
- <tr>
- <td>{ logRow.logInstant }</td>
- <td>{ logRow.logType }</td>
- <td>{ logRow.logComponent }</td>
- <td>{ logRow.message }</td>
- </tr>
-
-)
-
-export default class LoopLogs extends React.Component {
-
- state = {
- loopCache: new LoopCache({})
- }
-
- constructor(props) {
- super(props);
- this.renderLogs = this.renderLogs.bind(this);
- this.state.loopCache = props.loopCache;
- }
-
- shouldComponentUpdate(nextProps, nextState) {
- return this.state.loopCache !== nextState.loopCache;
- }
-
- componentWillReceiveProps(newProps) {
- this.setState({
- loopCache: newProps.loopCache
- });
- }
-
- renderLogs() {
- let logsArray = this.state.loopCache.getLoopLogsArray();
- if (logsArray != null) {
- return (logsArray.map(row => <TableRow key={ row.id } logRow={ row }/>));
- }
- }
-
- render() {
- return (
- <LoopLogsHeaderDivStyled>
- <label>Loop Logs</label>
- <TableStyled striped hover variant responsive>
- <thead>
- <tr>
- <th><span align="left">Date</span></th>
- <th><span align="left">Type</span></th>
- <th><span align="left">Component</span></th>
- <th><span align="right">Log</span></th>
- </tr>
- </thead>
- <tbody>
- { this.renderLogs() }
- </tbody>
- </TableStyled>
- </LoopLogsHeaderDivStyled>
-
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/logs/LoopLogs.test.js b/gui-clamp/ui-react/src/components/loop_viewer/logs/LoopLogs.test.js
deleted file mode 100644
index d3a21d8..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/logs/LoopLogs.test.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import LoopLogs from './LoopLogs';
-import LoopCache from '../../../api/LoopCache';
-
-describe('Verify LoopLogs', () => {
-
- const loopCache = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "loopLogs": [
- {
- "id": 1,
- "logType": "INFO",
- "logComponent": "CLAMP",
- "message": "Operational policies UPDATED",
- "logInstant": "2019-07-08T09:44:37Z"
- }
- ]
- });
-
- it('Test the render method', () => {
- const component = shallow(<LoopLogs loopCache={ loopCache }/>)
- expect(component).toMatchSnapshot();
-
- const loopCacheUpdated = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "loopLogs": [
- {
- "id": 1,
- "logType": "INFO",
- "logComponent": "CLAMP",
- "message": "Operational policies UPDATED",
- "logInstant": "2019-07-08T09:44:37Z"
- },
- {
- "id": 2,
- "logType": "INFO",
- "logComponent": "CLAMP",
- "message": "Operational policies UPDATED",
- "logInstant": "2019-07-08T09:44:50Z"
- }
- ]
- });
-
- component.setProps({ loopCache: loopCacheUpdated });
- expect(component.find('TableRow').length).toEqual(2);
- });
-});
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/logs/__snapshots__/LoopLogs.test.js.snap b/gui-clamp/ui-react/src/components/loop_viewer/logs/__snapshots__/LoopLogs.test.js.snap
deleted file mode 100644
index 996c674..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/logs/__snapshots__/LoopLogs.test.js.snap
+++ /dev/null
@@ -1,62 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify LoopLogs Test the render method 1`] = `
-<styled.div>
- <label>
- Loop Logs
- </label>
- <Styled(Component)
- hover={true}
- responsive={true}
- striped={true}
- variant={true}
- >
- <thead>
- <tr>
- <th>
- <span
- align="left"
- >
- Date
- </span>
- </th>
- <th>
- <span
- align="left"
- >
- Type
- </span>
- </th>
- <th>
- <span
- align="left"
- >
- Component
- </span>
- </th>
- <th>
- <span
- align="right"
- >
- Log
- </span>
- </th>
- </tr>
- </thead>
- <tbody>
- <TableRow
- key="1"
- logRow={
- Object {
- "id": 1,
- "logComponent": "CLAMP",
- "logInstant": "2019-07-08T09:44:37Z",
- "logType": "INFO",
- "message": "Operational policies UPDATED",
- }
- }
- />
- </tbody>
- </Styled(Component)>
-</styled.div>
-`;
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/status/LoopStatus.js b/gui-clamp/ui-react/src/components/loop_viewer/status/LoopStatus.js
deleted file mode 100644
index f539ad4..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/status/LoopStatus.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
-* ============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============================================
-* ===================================================================
-*
-*/
-import React from 'react';
-import Table from 'react-bootstrap/Table';
-import styled from 'styled-components';
-import LoopCache from '../../../api/LoopCache';
-
-const LoopStatusViewDivStyled = styled.div`
- background-color: ${ props => props.theme.loopViewerHeaderBackgroundColor };
- padding: 10px 10px;
- color: ${ props => props.theme.loopViewerHeaderFontColor };
-`
-
-const TableStyled = styled(Table)`
- overflow: auto;
-`
-
-const TableRow = ({ statusRow }) => (
- <tr>
- <td>{ statusRow.componentName }</td>
- <td>{ statusRow.stateName }</td>
- <td>{ statusRow.description }</td>
- </tr>
-
-)
-
-export default class LoopStatus extends React.Component {
- state = {
- loopCache: new LoopCache({})
- }
-
- constructor(props) {
- super(props);
- this.renderStatus = this.renderStatus.bind(this);
- this.state.loopCache = props.loopCache;
- }
-
-
- renderStatus() {
- let componentStates = this.state.loopCache.getComponentStates();
- if (componentStates != null) {
- return Object.keys(componentStates).map((key) => {
- console.debug("Adding status for: ", key);
- var res = {}
- res[key] = this.state.loopCache.getComponentStates()[key];
- return (<TableRow key={ key } statusRow={ {
- 'componentName': key,
- 'stateName': this.state.loopCache.getComponentStates()[key].componentState.stateName,
- 'description': this.state.loopCache.getComponentStates()[key].componentState.description
- } }/>)
- })
-
- }
- }
-
- shouldComponentUpdate(nextProps, nextState) {
- return this.state.loopCache !== nextState.loopCache;
- }
-
- componentWillReceiveProps(newProps) {
- this.setState({
- loopCache: newProps.loopCache
- });
- }
-
- render() {
- return (
- <LoopStatusViewDivStyled>
- <label>Loop Status: { this.state.loopCache.getComputedState() }
- </label>
-
- <div>
- <TableStyled striped hover variant responsive>
- <thead>
- <tr>
- <th><span align="left">Component Name</span></th>
- <th><span align="left">Component State</span></th>
- <th><span align="right">Description</span></th>
- </tr>
- </thead>
- <tbody>
- { this.renderStatus() }
- </tbody>
- </TableStyled>
- </div>
- </LoopStatusViewDivStyled>
- );
- }
-}
-
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/status/LoopStatus.test.js b/gui-clamp/ui-react/src/components/loop_viewer/status/LoopStatus.test.js
deleted file mode 100644
index b84067e..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/status/LoopStatus.test.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import LoopStatus from './LoopStatus';
-import LoopCache from '../../../api/LoopCache';
-
-describe('Verify LoopStatus', () => {
-
- const loopCache = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "lastComputedState": "DESIGN",
- "components": {
- "POLICY": {
- "componentState": {
- "stateName": "NOT_SENT",
- "description": "The policies defined have NOT yet been created on the policy engine"
- }
- },
- "DCAE": {
- "componentState": {
- "stateName": "BLUEPRINT_DEPLOYED",
- "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
- }
- }
- }
- });
-
- it('Test the render method', () => {
- const component = shallow(<LoopStatus loopCache={ loopCache }/>)
-
- expect(component).toMatchSnapshot();
-
- const loopCacheUpdated = new LoopCache({
- "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
- "lastComputedState": "SUBMIT",
- "components": {
- "POLICY": {
- "componentState": {
- "stateName": "SENT",
- "description": "The policies defined have NOT yet been created on the policy engine"
- }
- },
- "DCAE": {
- "componentState": {
- "stateName": "BLUEPRINT_DEPLOYED",
- "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
- }
- }
- }
- });
- component.setProps({ loopCache: loopCacheUpdated });
-
- const forms = component.find('TableRow');
- expect(forms.get(0).props.statusRow.stateName).toEqual("SENT");
- expect(component.find('label').text()).toContain('SUBMIT');
- });
-});
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/status/__snapshots__/LoopStatus.test.js.snap b/gui-clamp/ui-react/src/components/loop_viewer/status/__snapshots__/LoopStatus.test.js.snap
deleted file mode 100644
index 24d879d..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/status/__snapshots__/LoopStatus.test.js.snap
+++ /dev/null
@@ -1,66 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify LoopStatus Test the render method 1`] = `
-<styled.div>
- <label>
- Loop Status:
- DESIGN
- </label>
- <div>
- <Styled(Component)
- hover={true}
- responsive={true}
- striped={true}
- variant={true}
- >
- <thead>
- <tr>
- <th>
- <span
- align="left"
- >
- Component Name
- </span>
- </th>
- <th>
- <span
- align="left"
- >
- Component State
- </span>
- </th>
- <th>
- <span
- align="right"
- >
- Description
- </span>
- </th>
- </tr>
- </thead>
- <tbody>
- <TableRow
- key="POLICY"
- statusRow={
- Object {
- "componentName": "POLICY",
- "description": "The policies defined have NOT yet been created on the policy engine",
- "stateName": "NOT_SENT",
- }
- }
- />
- <TableRow
- key="DCAE"
- statusRow={
- Object {
- "componentName": "DCAE",
- "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop",
- "stateName": "BLUEPRINT_DEPLOYED",
- }
- }
- />
- </tbody>
- </Styled(Component)>
- </div>
-</styled.div>
-`;
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/svg/SvgGenerator.js b/gui-clamp/ui-react/src/components/loop_viewer/svg/SvgGenerator.js
deleted file mode 100644
index 2eba102..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/svg/SvgGenerator.js
+++ /dev/null
@@ -1,247 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-
-import React from 'react'
-import styled from 'styled-components';
-import { withRouter } from "react-router-dom";
-import LoopCache from '../../../api/LoopCache';
-import OnapConstant from '../../../utils/OnapConstants';
-
-const DivStyled = styled.div`
- overflow-x: scroll;
- display: flex;
- width: 100%;
- height: 100%;
-`
-
-const emptySvg = (<svg>
- <text x="60" y="40">No LOOP (SVG)</text>
-</svg>);
-
-class SvgGenerator extends React.Component {
- boxWidth = 200;
- boxHeight = 100;
- boxSpace = 50;
-
- static GENERATED_FROM_INSTANCE = "INSTANCE";
- static GENERATED_FROM_TEMPLATE = "TEMPLATE";
-
- state = {
- loopCache: new LoopCache({}),
- clickable: false,
- generatedFrom: SvgGenerator.GENERATED_FROM_INSTANCE, // INSTANCE / TEMPLATE
- }
-
- constructor(props) {
- super(props);
- this.state.loopCache = props.loopCache;
- this.state.clickable = props.clickable;
- this.state.generatedFrom = props.generatedFrom;
- this.handleSvgClick = this.handleSvgClick.bind(this);
- this.renderSvg = this.renderSvg.bind(this);
- }
-
- shouldComponentUpdate(nextProps, nextState) {
- return this.state.loopCache !== nextProps.loopCache;
- }
-
- componentDidUpdate(prevProps) {
- if (prevProps.loopCache !== this.props.loopCache) {
- this.setState({
- loopCache: this.props.loopCache,
- });
- }
- }
-
- handleSvgClick(event) {
- if (this.state.clickable) {
- var elementName = event.target.parentNode.getAttribute('policyId');
- console.info("SVG element clicked", elementName);
- // Only allow movement to policy editing IF there busyLoadingCOunt is 0,
- // meaning we are not waiting for refreshStatus to complete, for example
- if (elementName !== null && !this.props.isBusyLoading()) {
- this.props.history.push("/policyModal/" + event.target.parentNode.getAttribute('policyType') + "/" + elementName);
- }
- }
- }
-
- createVesBox(xPos) {
- return this.createOneBox(xPos, null, null, 'VES Collector', 'VES', null);
- }
-
- createOneArrow(xPos) {
- return (
- <svg width={ this.boxSpace } height={ this.boxHeight } x={ xPos }>
- <defs>
- <marker viewBox="0 0 20 20" markerWidth="20" markerHeight="20" orient="auto" refX="8.5" refY="5" id="arrow">
- <path d="m 1 5 l 0 -3 l 7 3 l -7 3 z"
- stroke-width="1" stroke-linecap="butt" stroke-dasharray="10000, 1"
- fill="#000000" stroke="#000000"/>
- </marker>
- </defs>
- <line x1="0" y1="50%" x2="100%" y2="50%" stroke-width="2" color="black" stroke="black" marker-end="url(#arrow)"/>
- </svg>
- );
- }
-
- createBeginCircle(xPos, text) {
- return (
- <svg width={ this.boxWidth } height={ this.boxHeight } x={ xPos }>
- <circle cx={ this.boxWidth - 30 } cy="50%" r="30" stroke-width="1" color="black" stroke="black" fill="#27ae60"/>
- <text x={ this.boxWidth - 30 } y="50%" text-anchor="middle" dominant-baseline="middle" textLength="20%" lengthAdjust="spacingAndGlyphs">{ text }</text>
- </svg>
- );
- }
-
- createEndCircle(xPos, text) {
- return (
- <svg width={ this.boxWidth } height={ this.boxHeight } x={ xPos }>
- <circle cx={ 30 } cy="50%" r="30" stroke-width="2" color="black" stroke="black" fill="#27ae60"/>
- <text x={ 30 } y="50%" text-anchor="middle" dominant-baseline="middle" textLength="20%" lengthAdjust="spacingAndGlyphs">{ text }</text>
- </svg>
- );
- }
-
- createOneBox(xPos, policyId, loopElementModelId, name, title, policyType) {
- return (
- <svg width={ this.boxWidth } height={ this.boxHeight } x={ xPos } title="test">
- <g policyId={ policyId } loopElementModelId={ loopElementModelId } policyType={ policyType }>
- <rect width="100%" height="100%" stroke-width="2" color="black" stroke="black" fill="#1abc9c"/>
- <text x="50%" y="15%" color="white" fill="white" dominant-baseline="middle" text-anchor="middle" textLength="50%" lengthAdjust="spacingAndGlyphs">{ title }</text>
- <text x="50%" y="50%" text-anchor="middle" dominant-baseline="middle" textLength="80%" lengthAdjust="spacingAndGlyphs">{ name }</text>
- <text x="50%" y="80%" text-anchor="middle" dominant-baseline="middle" textLength="110%" lengthAdjust="spacingAndGlyphs">{ policyId }</text>
- </g>
- </svg>
- );
- }
-
- createSvgFromTemplate() {
- const allElements = [];
- var xPos = 0;
-
- allElements.push(this.createBeginCircle(xPos, "Start"))
- xPos += (this.boxWidth + this.boxSpace);
-
- allElements.push(this.createOneArrow(xPos - this.boxSpace));
-
- allElements.push(this.createVesBox(xPos));
- xPos += (this.boxWidth + this.boxSpace);
-
- allElements.push(this.createOneArrow(xPos - this.boxSpace));
- for (var loopElement of this.state.loopCache.getAllLoopElementModels()) {
-
- allElements.push(this.createOneBox(xPos,
- loopElement['name'],
- loopElement['name'],
- loopElement['shortName'],
- loopElement['loopElementType'],
- loopElement['loopElementType']))
- xPos += (this.boxWidth + this.boxSpace);
- allElements.push(this.createOneArrow(xPos - this.boxSpace));
- }
-
- allElements.push(this.createEndCircle(xPos, "End"))
- xPos += (this.boxWidth + this.boxSpace);
-
- return allElements;
- }
-
- createSvgFromInstance() {
- const allElements = [];
- var xPos = 0;
-
- allElements.push(this.createBeginCircle(xPos, "Start"))
- xPos += (this.boxWidth + this.boxSpace);
-
- allElements.push(this.createOneArrow(xPos - this.boxSpace));
-
- allElements.push(this.createVesBox(xPos));
- xPos += (this.boxWidth + this.boxSpace);
-
- allElements.push(this.createOneArrow(xPos - this.boxSpace));
-
- for (var msPolicy in this.state.loopCache.getMicroServicePolicies()) {
- var loopElementModelName = this.state.loopCache.getMicroServicePolicies()[msPolicy]['loopElementModel'];
- if (loopElementModelName !== undefined) {
- loopElementModelName = loopElementModelName['name'];
- }
- allElements.push(this.createOneBox(xPos,
- this.state.loopCache.getMicroServicePolicies()[msPolicy]['name'],
- loopElementModelName,
- this.state.loopCache.getMicroServicePolicies()[msPolicy]['policyModel']['policyAcronym'],
- 'microservice',
- OnapConstant.microServiceType))
- xPos += (this.boxWidth + this.boxSpace);
- allElements.push(this.createOneArrow(xPos - this.boxSpace));
- }
-
- for (var opPolicy in this.state.loopCache.getOperationalPolicies()) {
- loopElementModelName = this.state.loopCache.getOperationalPolicies()[opPolicy]['loopElementModel'];
- if (loopElementModelName !== undefined) {
- loopElementModelName = loopElementModelName['name'];
- }
- allElements.push(this.createOneBox(xPos,
- this.state.loopCache.getOperationalPolicies()[opPolicy]['name'],
- loopElementModelName,
- this.state.loopCache.getOperationalPolicies()[opPolicy]['policyModel']['policyAcronym'],
- 'operational',
- OnapConstant.operationalPolicyType))
- xPos += (this.boxWidth + this.boxSpace);
- allElements.push(this.createOneArrow(xPos - this.boxSpace));
- }
-
- allElements.push(this.createEndCircle(xPos, "End"))
- xPos += (this.boxWidth + this.boxSpace);
-
- return allElements;
- }
-
- renderSvg() {
- console.log('renderSvg called');
- if (this.state.loopCache.getLoopName() === undefined) {
- return [emptySvg];
- }
- if (this.state.generatedFrom === SvgGenerator.GENERATED_FROM_INSTANCE) {
- return this.createSvgFromInstance();
- } else if (this.state.generatedFrom === SvgGenerator.GENERATED_FROM_TEMPLATE) {
- return this.createSvgFromTemplate();
- }
- }
-
- render() {
- var allTheElements = this.renderSvg();
- var svgWidth = this.boxWidth * allTheElements.length;
- var svgHeight = this.boxHeight + 50;
- return (
-
- <DivStyled onClick={ this.handleSvgClick }>
- <svg key="main" height={ svgHeight } width={ svgWidth } viewBox="0,0,{svgWidth},{svgHeight}" preserveAspectRatio="none">
- <svg key="content" x="-50" y="25">
- { allTheElements }
- </svg>
- </svg>
- </DivStyled>
- );
- }
-}
-
-export default withRouter(SvgGenerator);
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/svg/SvgGenerator.test.js b/gui-clamp/ui-react/src/components/loop_viewer/svg/SvgGenerator.test.js
deleted file mode 100644
index b8c32dc..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/svg/SvgGenerator.test.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import {shallow} from "enzyme";
-import toJson from "enzyme-to-json";
-import React from "react";
-import SvgGenerator from "./SvgGenerator";
-import {Router} from "react-router-dom";
-import {createMemoryHistory} from "history";
-import LoopCache from "../../../api/LoopCache";
-import {act} from "react-dom/test-utils";
-
-const logSpy = jest.spyOn(console, 'log')
-const history = createMemoryHistory();
-
-describe('Verify SvgGenerator', () => {
-
- it("renders correctly", () => {
- const component = shallow(<SvgGenerator/>);
- expect(toJson(component)).toMatchSnapshot();
- });
-
- it("Test renderSvg called", () => {
- shallow(
- <Router history={history}>
- <SvgGenerator loopCache={new LoopCache({})} clickable={ true } generatedFrom='INSTANCE' isBusyLoading={false}/>
- </Router>
- );
-
- act(async () => {
- expect(logSpy).toHaveBeenCalledWith('renderSvg called');
- });
- });
-
- it("Test svg click event received", () => {
- const component = shallow(
- <Router history={history}>
- <SvgGenerator loopCache={new LoopCache({})} clickable={ true } generatedFrom='INSTANCE' isBusyLoading={false}/>
- </Router>
- );
-
- act(async () => {
- component.find('withRouter(SvgGenerator)').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('svg click event received');
- });
- });
-}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/loop_viewer/svg/__snapshots__/SvgGenerator.test.js.snap b/gui-clamp/ui-react/src/components/loop_viewer/svg/__snapshots__/SvgGenerator.test.js.snap
deleted file mode 100644
index b7ccc9b..0000000
--- a/gui-clamp/ui-react/src/components/loop_viewer/svg/__snapshots__/SvgGenerator.test.js.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify SvgGenerator renders correctly 1`] = `
-<ContextConsumer>
- <Component />
-</ContextConsumer>
-`;
diff --git a/gui-clamp/ui-react/src/components/menu/MenuBar.js b/gui-clamp/ui-react/src/components/menu/MenuBar.js
deleted file mode 100644
index 94ec7f3..0000000
--- a/gui-clamp/ui-react/src/components/menu/MenuBar.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import React from 'react';
-import Nav from 'react-bootstrap/Nav';
-import Navbar from 'react-bootstrap/Navbar';
-import NavDropdown from 'react-bootstrap/NavDropdown';
-import OnapConstants from '../../utils/OnapConstants';
-import 'bootstrap-css-only/css/bootstrap.min.css';
-import styled from 'styled-components';
-import { Link } from 'react-router-dom';
-
-const StyledLink = styled(Link)`
- color: ${ props => props.theme.menuFontColor };
- background-color: ${ props => props.theme.menuBackgroundColor };
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ${ props => props.theme.menuHighlightedBackgroundColor };
- color: ${ props => props.theme.menuHighlightedFontColor };
- }`;
-const StyledNavLink = styled(Nav.Link)`
- color: ${ props => props.theme.menuFontColor };
- background-color: ${ props => props.theme.menuBackgroundColor };
- font-weight: normal;
- padding: .25rem 1.5rem;
- :hover {
- background-color: ${ props => props.theme.menuHighlightedBackgroundColor };
- color: ${ props => props.theme.menuHighlightedFontColor };
- }`;
-
-const StyledNavDropdown = styled(NavDropdown)`
- color: ${ props => props.theme.menuFontColor };
-
- & .nav-link.disabled {
- color: rgba(136, 136, 136, 0.5)
- }
-
- & .dropdown-toggle {
- color: ${ props => props.theme.menuFontColor };
- background-color: ${ props => props.theme.backgroundColor };
- font-weight: normal;
-
- :hover {
- font-weight: bold;
- }
- }`;
-
-export default class MenuBar extends React.Component {
- state = {
- loopName: this.props.loopName,
- disabled: true
- };
-
- componentWillReceiveProps(newProps) {
- if (newProps.loopName !== OnapConstants.defaultLoopName) {
- this.setState({ disabled: false });
- } else {
- this.setState({ disabled: true });
- }
- }
-
- render() {
- return (
- <Navbar.Collapse>
- <StyledNavDropdown title="POLICY Framework" disabled>
- <NavDropdown.Item as={ StyledLink } to="/viewAllPolicies">View All Policies</NavDropdown.Item>
- </StyledNavDropdown>
- <StyledNavDropdown title="CLAMP Options" disabled>
- <NavDropdown.Item as={ StyledLink } to="/manageDictionaries">Tosca Metadata Dictionaries</NavDropdown.Item>
- <NavDropdown.Divider/>
- <NavDropdown.Item as={ StyledLink } to="/viewLoopTemplatesModal">View All Loop Templates</NavDropdown.Item>
- </StyledNavDropdown>
- <StyledNavDropdown title="LOOP Instance" disabled>
- <NavDropdown.Item as={ StyledLink } to="/createLoop">Create</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/openLoop">Open</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/closeLoop" disabled={ this.state.disabled }>Close</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/modifyLoop" disabled={ this.state.disabled }>Modify</NavDropdown.Item>
- <NavDropdown.Divider/>
- <NavDropdown.Item as={ StyledLink } to="/loopProperties" disabled={ this.state.disabled }>Properties</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/refreshStatus" disabled={ this.state.disabled }>Refresh Status</NavDropdown.Item>
- </StyledNavDropdown>
- <StyledNavDropdown title="LOOP Operations" disabled>
- <NavDropdown.Item as={ StyledLink } to="/submit" disabled={ this.state.disabled }>Create and deploy to Policy Framework (SUBMIT)</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/stop" disabled={ this.state.disabled }>Undeploy from Policy Framework (STOP)</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/restart" disabled={ this.state.disabled }>ReDeploy to Policy Framework (RESTART)</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/delete" disabled={ this.state.disabled }>Delete loop instance (DELETE)</NavDropdown.Item>
- <NavDropdown.Divider/>
- <NavDropdown.Item as={ StyledLink } to="/deploy" disabled={ this.state.disabled }>Deploy to DCAE (DEPLOY)</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/undeploy" disabled={ this.state.disabled }>UnDeploy to DCAE (UNDEPLOY)</NavDropdown.Item>
- </StyledNavDropdown>
- <StyledNavDropdown title="TOSCA Automation Composition">
- <NavDropdown.Header>Instantiation</NavDropdown.Header>
- <NavDropdown.Item as={ StyledLink } to="/instantiationManagement">Instantiation Management</NavDropdown.Item>
- <NavDropdown.Divider/>
- <NavDropdown.Header>Commissioning</NavDropdown.Header>
- <NavDropdown.Item as={ StyledLink } to="/readToscaTemplate">Manage Commissioned Automation Composition Template</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/uploadToscaFile">Upload Automation Composition to Commissioning</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/getJsonSchema">Edit Automation Composition Properties</NavDropdown.Item>
- </StyledNavDropdown>
- <StyledNavDropdown title="Help">
- <StyledNavLink href="https://wiki.onap.org/" target="_blank">Wiki</StyledNavLink>
- <StyledNavLink href="mailto:onap-discuss@lists.onap.org?subject=CLAMP&body=Please send us suggestions or feature enhancements or defect. If possible, please send us the steps to replicate any defect.">Contact
- Us</StyledNavLink>
- <NavDropdown.Item as={ StyledLink } to="/userInfo">User Info</NavDropdown.Item>
- </StyledNavDropdown>
- </Navbar.Collapse>
- );
- }
-}
diff --git a/gui-clamp/ui-react/src/components/menu/MenuBar.test.js b/gui-clamp/ui-react/src/components/menu/MenuBar.test.js
deleted file mode 100644
index df1a17a..0000000
--- a/gui-clamp/ui-react/src/components/menu/MenuBar.test.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * 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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import { shallow } from 'enzyme';
-import MenuBar from './MenuBar';
-import DropdownItem from "react-bootstrap/DropdownItem";
-
-describe('Verify MenuBar', () => {
-
- it('Test the render method', () => {
- const component = shallow(<MenuBar/>)
-
- expect(component).toMatchSnapshot();
- });
-
- it('Update loopName', () => {
- const component = shallow(<MenuBar/>)
- component.setProps({ loopName: "newLoop" });
- expect(component.state('disabled')).toBe(false);
- });
-
- it('Default loopName', () => {
- const component = shallow(<MenuBar/>)
- component.setProps({ loopName: "Empty (NO loop loaded yet)" });
- expect(component.state('disabled')).toBe(true);
- });
-
- it('Find 20 DropdownItem', () => {
- const component = shallow(<MenuBar />)
- expect(component.find('DropdownItem').length).toEqual(20);
- });
-
- it('Finds POLICY Framework Menu', () => {
- const component = shallow(<MenuBar />).childAt(0).dive();
- expect(component.find({ tile: 'POLICY Framework' }));
- });
-
- it('Finds POLICY Framework Menu', () => {
- const component = shallow(<MenuBar />).childAt(1).dive();
- expect(component.find({ tile: 'CLAMP Options' }));
- });
-
- it('Finds POLICY Framework Menu', () => {
- const component = shallow(<MenuBar />).childAt(2).dive();
- expect(component.find({ tile: 'LOOP Instance' }));
- });
-
- it('Finds POLICY Framework Menu', () => {
- const component = shallow(<MenuBar />).childAt(3).dive();
- expect(component.find({ tile: 'LOOP Operations' }));
- });
-
- it('Finds POLICY Framework Menu', () => {
- const component = shallow(<MenuBar />).childAt(4).dive();
- expect(component.find({ tile: 'TOSCA Automation Composition' }));
- });
-
- it('Finds POLICY Framework Menu', () => {
- const component = shallow(<MenuBar />).childAt(5).dive();
- expect(component.find({ tile: 'Help' }));
- });
-
- it('Finds StyledNavLink', () => {
- const component = shallow(<MenuBar />);
- expect(component.find('Styled(NavLink)').length).toEqual(2);
- });
-
- it('Finds StyledNavDropdown', () => {
- const component = shallow(<MenuBar />);
- expect(component.find('Styled(NavDropdown)').length).toEqual(6);
- });
-});
diff --git a/gui-clamp/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap b/gui-clamp/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap
deleted file mode 100644
index 3d4f8cb..0000000
--- a/gui-clamp/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap
+++ /dev/null
@@ -1,1327 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify MenuBar Test the render method 1`] = `
-<NavbarCollapse>
- <Styled(NavDropdown)
- disabled={true}
- title="POLICY Framework"
- >
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/viewAllPolicies"
- >
- View All Policies
- </DropdownItem>
- </Styled(NavDropdown)>
- <Styled(NavDropdown)
- disabled={true}
- title="CLAMP Options"
- >
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/manageDictionaries"
- >
- Tosca Metadata Dictionaries
- </DropdownItem>
- <DropdownDivider
- role="separator"
- />
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/viewLoopTemplatesModal"
- >
- View All Loop Templates
- </DropdownItem>
- </Styled(NavDropdown)>
- <Styled(NavDropdown)
- disabled={true}
- title="LOOP Instance"
- >
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/createLoop"
- >
- Create
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/openLoop"
- >
- Open
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/closeLoop"
- >
- Close
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/modifyLoop"
- >
- Modify
- </DropdownItem>
- <DropdownDivider
- role="separator"
- />
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/loopProperties"
- >
- Properties
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/refreshStatus"
- >
- Refresh Status
- </DropdownItem>
- </Styled(NavDropdown)>
- <Styled(NavDropdown)
- disabled={true}
- title="LOOP Operations"
- >
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/submit"
- >
- Create and deploy to Policy Framework (SUBMIT)
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/stop"
- >
- Undeploy from Policy Framework (STOP)
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/restart"
- >
- ReDeploy to Policy Framework (RESTART)
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/delete"
- >
- Delete loop instance (DELETE)
- </DropdownItem>
- <DropdownDivider
- role="separator"
- />
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/deploy"
- >
- Deploy to DCAE (DEPLOY)
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={true}
- to="/undeploy"
- >
- UnDeploy to DCAE (UNDEPLOY)
- </DropdownItem>
- </Styled(NavDropdown)>
- <Styled(NavDropdown)
- title="TOSCA Automation Composition"
- >
- <DropdownHeader
- role="heading"
- >
- Instantiation
- </DropdownHeader>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/instantiationManagement"
- >
- Instantiation Management
- </DropdownItem>
- <DropdownDivider
- role="separator"
- />
- <DropdownHeader
- role="heading"
- >
- Commissioning
- </DropdownHeader>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/readToscaTemplate"
- >
- Manage Commissioned Automation Composition Template
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/uploadToscaFile"
- >
- Upload Automation Composition to Commissioning
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/getJsonSchema"
- >
- Edit Automation Composition Properties
- </DropdownItem>
- </Styled(NavDropdown)>
- <Styled(NavDropdown)
- title="Help"
- >
- <Styled(NavLink)
- href="https://wiki.onap.org/"
- target="_blank"
- >
- Wiki
- </Styled(NavLink)>
- <Styled(NavLink)
- href="mailto:onap-discuss@lists.onap.org?subject=CLAMP&body=Please send us suggestions or feature enhancements or defect. If possible, please send us the steps to replicate any defect."
- >
- Contact Us
- </Styled(NavLink)>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "attrs": Array [],
- "componentStyle": e {
- "baseHash": -715527839,
- "baseStyle": undefined,
- "componentId": "sc-bdnxRM",
- "isStatic": false,
- "rules": Array [
- "
- color: ",
- [Function],
- ";
- background-color: ",
- [Function],
- ";
- font-weight: normal;
- display: block;
- width: 100%;
- padding: .25rem 1.5rem;
- clear: both;
- text-align: inherit;
- white-space: nowrap;
- border: 0;
- :hover {
- text-decoration: none;
- background-color: ",
- [Function],
- ";
- color: ",
- [Function],
- ";
- }",
- ],
- "staticRulesId": "",
- },
- "foldedComponentIds": Array [],
- "render": [Function],
- "shouldForwardProp": undefined,
- "styledComponentId": "sc-bdnxRM",
- "target": Object {
- "$$typeof": Symbol(react.forward_ref),
- "propTypes": Object {
- "innerRef": [Function],
- "onClick": [Function],
- "replace": [Function],
- "target": [Function],
- "to": [Function],
- },
- "render": [Function],
- },
- "toString": [Function],
- "warnTooManyClasses": [Function],
- "withComponent": [Function],
- }
- }
- disabled={false}
- to="/userInfo"
- >
- User Info
- </DropdownItem>
- </Styled(NavDropdown)>
-</NavbarCollapse>
-`;
diff --git a/gui-clamp/ui-react/src/index.js b/gui-clamp/ui-react/src/index.js
deleted file mode 100644
index 9baeaee..0000000
--- a/gui-clamp/ui-react/src/index.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-import React from 'react';
-import ReactDOM from 'react-dom';
-import OnapClamp from './OnapClamp';
-import { Route, MemoryRouter } from 'react-router-dom'
-
-
-const routing = (
- <MemoryRouter forceRefresh={ false }>
- <Route path="/" component={ OnapClamp }/>
- </MemoryRouter>
-);
-
-export var mainClamp = ReactDOM.render(
- routing,
- document.getElementById('root')
-)
diff --git a/gui-clamp/ui-react/src/index.test.js b/gui-clamp/ui-react/src/index.test.js
deleted file mode 100644
index 188a26e..0000000
--- a/gui-clamp/ui-react/src/index.test.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2022 Nordix Foundation. 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============================================
- * ===================================================================
- *
- */
-
-import React from "react";
-import ReactDOM from "react-dom";
-import { Route, MemoryRouter } from 'react-router-dom'
-import OnapClamp from './OnapClamp';
-
-
-
-const routing = (
- <MemoryRouter forceRefresh={ false }>
- <Route path="/" component={ OnapClamp }/>
- </MemoryRouter>
-);
-jest.mock("react-dom", () => ({ render: jest.fn() }));
-
-describe("Application root", () => {
- it("should render without crashing", () => {
- const div = document.createElement("div");
- div.id = "root";
- document.body.appendChild(div);
- require("./index.js");
- expect(ReactDOM.render).toHaveBeenCalledWith(routing, div);
- });
-});
diff --git a/gui-clamp/ui-react/src/logo.png b/gui-clamp/ui-react/src/logo.png
deleted file mode 100644
index c6f6857..0000000
--- a/gui-clamp/ui-react/src/logo.png
+++ /dev/null
Binary files differ
diff --git a/gui-clamp/ui-react/src/setupTests.js b/gui-clamp/ui-react/src/setupTests.js
deleted file mode 100644
index 30ce019..0000000
--- a/gui-clamp/ui-react/src/setupTests.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP POLICY-CLAMP
- * ================================================================================
- * Copyright (C) 2019, 2021 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============================================
- * ===================================================================
- *
- */
-
-import { configure } from 'enzyme';
-import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
-
-configure({ adapter: new Adapter() });
-global.fetch = require('jest-fetch-mock');
diff --git a/gui-clamp/ui-react/src/theme/globalStyle.js b/gui-clamp/ui-react/src/theme/globalStyle.js
deleted file mode 100644
index 5245aae..0000000
--- a/gui-clamp/ui-react/src/theme/globalStyle.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-
-import { createGlobalStyle } from 'styled-components';
-
-export const GlobalClampStyle = createGlobalStyle`
- body {
- padding: 0;
- margin: 0;
- font-family: ${ props => props.theme.fontFamily };
- font-size: ${ props => props.theme.fontSize };
- font-weight: normal;
- }
-
- span {
- font-family: ${ props => props.theme.fontFamily };
- font-size: ${ props => props.theme.fontSize };
- font-weight: bold;
- }
-
- a {
- font-family: ${ props => props.theme.fontFamily };
- font-size: ${ props => props.theme.fontSize };
- font-weight: bold;
- }
-
- div {
- font-family: ${ props => props.theme.fontFamily };
- font-size: ${ props => props.theme.fontSize };
- border-radius: 4px;
- margin-top: 1px;
- }
-
- label {
- font-family: ${ props => props.theme.fontFamily };
- font-size: ${ props => props.theme.fontSize };
- font-weight: bold;
- }
-
- button {
- font-family: ${ props => props.theme.fontFamily };
- font-size: ${ props => props.theme.fontSize };
- font-weight: bold;
- }
-
-`
-
-export const DefaultClampTheme = {
- fontDanger: '#eb238e',
- fontWarning: '#eb238e',
- fontLight: '#ffffff',
- fontDark: '#888888',
- fontHighlight: '#ffff00',
- fontNormal: 'black',
-
- backgroundColor: '#eeeeee',
- fontFamily: 'Arial, Sans-serif',
- fontSize: '16px',
-
- loopViewerBackgroundColor: 'white',
- loopViewerFontColor: 'yellow',
- loopViewerHeaderBackgroundColor: '#337ab7',
- loopViewerHeaderFontColor: 'white',
-
- loopLogsHeaderBackgroundColor: 'white',
- loopLogsHeaderFontColor: 'black',
-
- menuBackgroundColor: 'white',
- menuFontColor: 'black',
- menuHighlightedBackgroundColor: '#337ab7',
- menuHighlightedFontColor: 'white',
-
- toscaTextareaBackgroundColor: 'white',
- toscaTextareaFontSize: '13px',
-
- policyEditorBackgroundColor: 'white',
- policyEditorFontSize: '13px'
-};
diff --git a/gui-clamp/ui-react/src/utils/CsvToJson.js b/gui-clamp/ui-react/src/utils/CsvToJson.js
deleted file mode 100644
index 6d95b31..0000000
--- a/gui-clamp/ui-react/src/utils/CsvToJson.js
+++ /dev/null
@@ -1,204 +0,0 @@
-/*-
- * ============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 function CsvToJson(rawCsvData, delimiter, internalDelimiter, csvHeaderNames, jsonKeyNames, mandatory) {
-
- let printDictKeys = '';
- let result = { jsonObjArray: [], errorMessages: '' };
-
- // Validate that all parallel arrays passed in have same number of elements;
- // this would be a developer error.
-
- let checkLength = csvHeaderNames.length;
-
- if (checkLength !== jsonKeyNames.length || checkLength !== mandatory.length) {
- result.errorMessages = 'interanl error: csvHeaderNames, jsonKeyNames, and mandatory arrays parameters are not the same length';
- return result;
- }
-
- if (checkLength < 1) {
- result.errorMessages = 'interanl error: csvHeaderNames, jsonKeyNames, and mandatory arrays have no entries';
- return result;
- }
-
- // Make a nice string to print in the error case to tell user what is the
- // required heaer row format
-
- for (let i = 0; i < csvHeaderNames.length; ++i) {
- if (i === 0) {
- printDictKeys = csvHeaderNames[i];
- } else {
- printDictKeys += ',' + csvHeaderNames[i];
- }
- }
-
- let dictElems = rawCsvData.split('\n');
- let numColumns = 0;
- let filteredDictElems = [];
-
- // The task of the following loop is to convert raw CSV rows into easily parseable
- // and streamlined versions of the rows with an internalDelimiter replacing the standard
- // comma; it is presumed (and checked) that the internalDelimiter cannot exist as a valid
- // sequence of characters in the user's data.
-
- // This conversion process also strips leading and trailing whitespace from each row,
- // discards empty rows, correctly interprets and removes all double quotes that programs like
- // Excel use to support user columns that contain special characters, most notably, the comma
- // delimiter. A double-quote that is contained within a double-quoted column value
- // must appear in this raw data as a sequence of two double quotes. Furthermore, any column
- // value in the raw CSV data that does not contain a delimiter may or may not be enclosed in
- // double quotes. It is the Excel convention to not use double qoutes unless necessary, and
- // there is no reasonable way to tell Excel to surround every column value with double quotes.
- // Any files that were directly "exported" by CLAMP itself from the Managing Dictionaries
- // capability, surround all columns with double quotes.
-
- for (let i = 0; i < dictElems.length; i++) {
-
- let oneRow = dictElems[i].trim();
- let j = 0;
- let inQuote = false
- let nextChar = undefined;
- let prevChar = null;
-
-
- if (oneRow === '') {
- continue; // Skip blank rows
- } else if (oneRow.indexOf(internalDelimiter) !== -1) {
- result.errorMessages += '\nRow #' + i + ' contains illegal sequence of characters (' + internalDelimiter + ')';
- break;
- } else {
- nextChar = oneRow[1];
- }
-
- let newStr = '';
- numColumns = 1;
-
- // This "while loop" performs the very meticulous task of removing double quotes that
- // are used by Excel to encase special characters as user string value data,
- // and manages to correctly identify columns that are defined with or without
- // double quotes and to process the comma delimiter correctly when encountered
- // as a user value within a column. Such a column would have to be encased in
- // double quotes; a comma found outside double quotes IS a delimiter.
-
- while (j < oneRow.length) {
- if (oneRow[j] === '"') {
- if (inQuote === false) {
- if (prevChar !== delimiter && prevChar !== null) {
- result.errorMessages += '\nMismatched double quotes or illegal whitespace around delimiter at row #' + (i + 1) + ' near column #' + numColumns;
- break;
- } else {
- inQuote = true;
- }
- } else {
- if (nextChar === '"') {
- newStr += '"';
- ++j;
- } else if ((nextChar !== delimiter) && (nextChar !== undefined)) {
- result.errorMessages += '\nRow #' + (i + 1) + ' is badly formatted at column #' + numColumns + '. Perhaps an unescaped double quote.';
- break;
- } else if (nextChar === delimiter) {
- ++numColumns;
- inQuote = false;
- newStr += internalDelimiter;
- prevChar = delimiter;
- j += 2;
- nextChar = oneRow[j + 1];
- continue;
- } else {
- ++numColumns;
- inQuote = false;
- break;
- }
- }
- } else {
- if (oneRow[j] === delimiter && inQuote === false) {
- newStr += internalDelimiter;
- ++numColumns;
- } else {
- newStr += oneRow[j];
- }
- }
- prevChar = oneRow[j];
- ++j;
- nextChar = oneRow[j + 1]; // can result in undefined at the end
- }
-
- if (result.errorMessages === '' && inQuote !== false) {
- result.errorMessages += '\nMismatched double quotes at row #' + (i + 1);
- break;
- } else if (result.errorMessages === '' && numColumns < jsonKeyNames.length) {
- result.errorMessages += '\nNot enough columns (' + jsonKeyNames.length + ') at row #' + (i + 1);
- break;
- }
-
- filteredDictElems.push(newStr);
- }
-
- if (result.errorMessages !== '') {
- return result;
- }
-
- // Perform further checks on data that is now in JSON form
- if (filteredDictElems.length < 2) {
- result.errorMessages += '\nNot enough row data found in import file. Need at least a header row and one row of data';
- return result;
- }
-
- // Now that we have something reliably parsed into sanitized columns lets run some checks
- // and convert it all into an array of JSON objects to push to the back end if all the
- // checks pass.
-
- let headers = filteredDictElems[0].split(internalDelimiter);
-
- // check that headers are included in proper order
- for (let i = 0; i < jsonKeyNames.length; ++i) {
- if (csvHeaderNames[i] !== headers[i]) {
- result.errorMessages += 'Row 1 header key at column #' + (i + 1) + ' is a mismatch. Expected row header must contain at least:\n' + printDictKeys;
- return result;
- }
- }
-
- // Convert the ASCII rows of data into an array of JSON obects that omit the header
- // row which is not sent to the back end.
-
- for (let i = 1; i < filteredDictElems.length; i++) {
- let data = filteredDictElems[i].split(internalDelimiter);
- let obj = {};
- for (let j = 0; j < data.length && j < jsonKeyNames.length; j++) {
- let value = data[j].trim();
- if (mandatory[j] === true && value === '') {
- result.errorMessages += '\n' + csvHeaderNames[j] + ' at row #' + (i + 1) + ' is empty but requires a value.';
- }
- obj[jsonKeyNames[j]] = value;
- }
- result.jsonObjArray.push(obj);
- }
-
- if (result.errorMessages !== '') {
- // If we have errors, return empty parse result even though some things
- // may have parsed properly. We do not want to encourage the caller
- // to think the data is good for use.
- result.jsonObjArray = [];
- }
-
- return result;
-}
diff --git a/gui-clamp/ui-react/src/utils/CsvToJson.test.js b/gui-clamp/ui-react/src/utils/CsvToJson.test.js
deleted file mode 100644
index e36e855..0000000
--- a/gui-clamp/ui-react/src/utils/CsvToJson.test.js
+++ /dev/null
@@ -1,268 +0,0 @@
-/*-
- * ============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============================================
- * ===================================================================
- *
- */
-
-import CsvToJson from './CsvToJson'
-
-describe('Verify CsvToJson', () => {
-
- const hdrNames = [
- "Element Short Name",
- "Element Name",
- "Element Description",
- "Element Type",
- "Sub-Dictionary"
- ];
-
- const jsonKeyNames = [
- "shortName",
- "name",
- "description",
- "type",
- "subDictionary"
- ];
-
- const mandatory = [true, true, true, true, false];
-
- it('Test CsvToJson No Error Case, Quoted Columns', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert Type","Type of Alert","string","","admin","2020-06-11T13:56:14.927437Z"';
-
- let expectedResult = {
- errorMessages: '',
- jsonObjArray: [
- {
- description: "Type of Alert",
- name: "Alert Type",
- shortName: "alertType",
- subDictionary: "",
- type: "string"
- }
- ]
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson No Error Case, Unquoted Columns', () => {
-
- let rawCsv = 'Element Short Name,Element Name,Element Description,Element Type,Sub-Dictionary\n';
- rawCsv += 'alertType,Alert Type,Type of Alert,string,,admin,2020-06-11T13:56:14.927437Z';
-
- let expectedResult = {
- errorMessages: '',
- jsonObjArray: [
- {
- description: "Type of Alert",
- name: "Alert Type",
- shortName: "alertType",
- subDictionary: "",
- type: "string"
- }
- ]
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Properly Escaped Double Quote and Delimiter', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert ""Type""","Type of Alert, Varies","string","","admin","2020-06-11T13:56:14.927437Z"';
-
- let errorMessage = '';
-
- let expectedResult = {
- errorMessages: errorMessage,
- jsonObjArray: [
- {
- description: "Type of Alert, Varies",
- name: 'Alert "Type"',
- shortName: 'alertType',
- subDictionary: "",
- type: "string",
- }
-
- ]
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
-
- it('Test CsvToJson Error Header Mismatch Error Case', () => {
-
- let rawCsv = '"Element Short Names","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert Type","Type of Alert","string","","admin","2020-06-11T13:56:14.927437Z"';
-
- let errorMessage = 'Row 1 header key at column #1 is a mismatch. Expected row header must contain at least:\n';
- errorMessage += 'Element Short Name,Element Name,Element Description,Element Type,Sub-Dictionary';
-
- let expectedResult = {
- errorMessages: errorMessage,
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Mismatched Double Quotes in Column', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alert"Type","Alert Type","Type of Alert","string","","admin","2020-06-11T13:56:14.927437Z"';
-
- let errorMessage = '\nRow #2 is badly formatted at column #1. Perhaps an unescaped double quote.'
-
- let expectedResult = {
- errorMessages: errorMessage,
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Illegal Whitespace', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += 'alertType , "Alert Type","Type of Alert","string","","admin","2020-06-11T13:56:14.927437Z"';
-
- let errorMessage = '\nMismatched double quotes or illegal whitespace around delimiter at row #2 near column #2';
-
- let expectedResult = {
- errorMessages: errorMessage,
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Too Few Data Columns', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert Type","Type of Alert"';
-
- let errorMessage = '\nNot enough columns (5) at row #2';
-
- let expectedResult = {
- errorMessages: errorMessage,
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Wrong Header Column Order', () => {
-
- let rawCsv = '"Element Name","Element Short Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert Type","Type of Alert","string","","admin","2020-06-11T13:56:14.927437Z"';
-
- let errorMessage = 'Row 1 header key at column #1 is a mismatch. Expected row header must contain at least:\n';
- errorMessage += 'Element Short Name,Element Name,Element Description,Element Type,Sub-Dictionary';
-
- let expectedResult = {
- errorMessages: errorMessage,
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Not Enough Rows', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
-
- let errorMessage = '\nNot enough row data found in import file. Need at least a header row and one row of data';
-
- let expectedResult = {
- errorMessages: errorMessage,
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Mandatory Field Is Empty', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"","Alert Type","Type of Alert","string","","admin","2020-06-11T13:56:14.927437Z"';
-
- let expectedResult = {
- errorMessages: '\nElement Short Name at row #2 is empty but requires a value.',
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '|', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Mismatched Double Quotes At End', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert Type","Alert Type Description","string","admin","2020-06-11T13:56:14.927437Z';
-
- let expectedResult = {
- errorMessages: '\nMismatched double quotes at row #2',
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '||', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Mismatched Mandatory Array Parameters', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert Type","Alert Type Description","string","admin","2020-06-11T13:56:14.927437Z';
-
- let expectedResult = {
- errorMessages: 'interanl error: csvHeaderNames, jsonKeyNames, and mandatory arrays parameters are not the same length',
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '||', hdrNames, jsonKeyNames, [true])).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Empty Mandatory Array Parameters', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert Type","Alert Type Description","string","admin","2020-06-11T13:56:14.927437Z';
-
- let expectedResult = {
- errorMessages: 'interanl error: csvHeaderNames, jsonKeyNames, and mandatory arrays have no entries',
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '||', [], [], [])).toEqual(expectedResult);
- });
-
- it('Test CsvToJson Error Illegal Data Contains Internal Delimiter', () => {
-
- let rawCsv = '"Element Short Name","Element Name","Element Description","Element Type","Sub-Dictionary"\n';
- rawCsv += '"alertType","Alert Type","Alert Type||Description","string","admin","2020-06-11T13:56:14.927437Z';
-
- let expectedResult = {
- errorMessages: '\nRow #1 contains illegal sequence of characters (||)',
- jsonObjArray: []
- };
-
- expect(CsvToJson(rawCsv, ',', '||', hdrNames, jsonKeyNames, mandatory)).toEqual(expectedResult);
- });
-})
diff --git a/gui-clamp/ui-react/src/utils/OnapConstants.js b/gui-clamp/ui-react/src/utils/OnapConstants.js
deleted file mode 100644
index c5b96d4..0000000
--- a/gui-clamp/ui-react/src/utils/OnapConstants.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============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)",
- microServiceType: "MICRO-SERVICE-POLICY",
- operationalPolicyType: "OPERATIONAL_POLICY_TYPE"
-};
-
-export default OnapConstants;
diff --git a/gui-clamp/ui-react/src/utils/OnapUtils.js b/gui-clamp/ui-react/src/utils/OnapUtils.js
deleted file mode 100644
index 9ba9382..0000000
--- a/gui-clamp/ui-react/src/utils/OnapUtils.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 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 class OnapUtils {
-
- constructor() {
- this.clickBlocked = false;
- }
-
- static jsonEditorErrorFormatter(errors) {
-
- let messages = [];
- let messagesOutputString = null;
-
- // errors is an array of JSON Editor "error" objects, where each
- // object looks like this:
-
- // {
- // message: "Please populate the required property "Threshold""
- // path: "root.signatures.0"
- // property: "required"
- // }
-
- // In this function we concatenate all the messages, removing any duplicates,
- // and adding a newline between each message. The result returned is a single
- // string that can be displayed to the user in an alert message
-
- if (!Array.isArray(errors)) {
- console.error('jsoneEditorErrorFormatter was passed a non-array argument');
- } else {
- for (let ii = 0; ii < errors.length; ++ii) {
- if (!messages.includes(errors[ii].message)) {
- messages.push(errors[ii].message);
- if (messagesOutputString) {
- messagesOutputString += '\n' + errors[ii].message;
- } else {
- messagesOutputString = errors[ii].message;
- }
- }
- }
- }
-
- return messagesOutputString;
- }
-}
diff --git a/gui-clamp/ui-react/src/utils/OnapUtils.test.js b/gui-clamp/ui-react/src/utils/OnapUtils.test.js
deleted file mode 100644
index 7db23fd..0000000
--- a/gui-clamp/ui-react/src/utils/OnapUtils.test.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2022 Nordix 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============================================
- * ===================================================================
- *
- */
-
-import OnapUtils from './OnapUtils'
-
-describe('Onap Utils Error Formatting', () => {
-
- var error = {
- message: "Please populate the required property Threshold",
- path: "root.signatures.0",
- property: "required"
- };
-
- var error2 = {
- message: "Invalid data type Threshold",
- };
-
- var errorArray = [error, error2];
- it('Test array formatting', () => {
- var utils = new OnapUtils();
- expect(utils.clickBlocked).toBeFalsy();
- var expectedResult = "Please populate the required property Threshold" + '\n'
- +"Invalid data type Threshold";
- expect(OnapUtils.jsonEditorErrorFormatter(errorArray)).toEqual(expectedResult);
- });
-
- it('Test error not array formatting', () => {
- let spy = {};
- spy.console = jest.spyOn(console, 'error').mockImplementation(() => {});
- OnapUtils.jsonEditorErrorFormatter(error);
- expect(console.error).toHaveBeenCalled();
- expect(spy.console.mock.calls[0][0]).toContain('jsoneEditorErrorFormatter was passed a non-array argument');
- spy.console.mockRestore();
- });
-}); \ No newline at end of file