diff options
author | sebdet <sebastien.determe@intl.att.com> | 2019-07-12 12:25:56 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2019-07-12 12:25:56 +0200 |
commit | e44fdb1905fae612b12b56886af8f387e516e485 (patch) | |
tree | a59eb65fe06c08f92dfdda3961784580228b7c29 /ui-react/src/components | |
parent | 4946e5b7d80fa1a7baa1c6042100fa1dee24ee31 (diff) |
Rework the structure
Rework of the project structure and static loop cache added for the
entire site
Issue-ID: CLAMP-418
Change-Id: Ia2cf62431cd9139c91bf74bb639b502a368ce761
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'ui-react/src/components')
-rw-r--r-- | ui-react/src/components/app/LoopUI.js | 163 | ||||
-rw-r--r-- | ui-react/src/components/app/NotFound.js | 36 | ||||
-rw-r--r-- | ui-react/src/components/app/logo.png | bin | 21360 -> 0 bytes | |||
-rw-r--r-- | ui-react/src/components/backend_communication/LoopActionService.js | 54 | ||||
-rw-r--r-- | ui-react/src/components/backend_communication/LoopCache.js | 116 | ||||
-rw-r--r-- | ui-react/src/components/backend_communication/UserService.js | 50 | ||||
-rw-r--r-- | ui-react/src/components/backend_communication/example.json | 417 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js | 8 |
8 files changed, 3 insertions, 841 deletions
diff --git a/ui-react/src/components/app/LoopUI.js b/ui-react/src/components/app/LoopUI.js deleted file mode 100644 index d058543a..00000000 --- a/ui-react/src/components/app/LoopUI.js +++ /dev/null @@ -1,163 +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 MenuBar from '../menu/MenuBar'; -import Navbar from 'react-bootstrap/Navbar'; -import logo from './logo.png'; -import { GlobalClampStyle } from '../../theme/globalStyle.js'; - -import ClosedLoopSvg from '../loop_viewer/svg/ClosedLoopSvg'; -import ClosedLoopLogs from '../loop_viewer/logs/ClosedLoopLogs'; -import ClosedLoopStatus from '../loop_viewer/status/ClosedLoopStatus'; -import UserService from '../backend_communication/UserService'; - -const ProjectNameStyled = styled.a` - vertical-align: middle; - padding-left: 30px; - font-size: 30px; - -` -const LoopViewDivStyled = styled.div` - height: 90vh; - 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%; -` - -const LoopViewLoopNameSpanStyled = styled.span` - font-weight: bold; - color: ${props => (props.theme.loopViewerHeaderFontColor)}; - background-color: ${props => (props.theme.loopViewerHeaderBackgroundColor)}; -` - -export default class LoopUI extends React.Component { - state = { - userName: null, - loopName: "Empty (NO loop loaded yet)", - }; - - constructor() { - super(); - this.getUser = this.getUser.bind(this); - } - - componentDidMount() { - this.getUser(); - } - - getUser() { - UserService.LOGIN().then(user => { - this.setState({userName:user}) - }); - } - - renderMenuNavBar() { - return ( - <MenuBar /> - ); - } - - renderUserLoggedNavBar() { - return ( - <Navbar.Text> - Signed in as: <a href="/login">{this.state.userName}</a> - </Navbar.Text> - ); - } - - renderLogoNavBar() { - return ( - <Navbar.Brand> - <img height="50px" width="234px" src={logo} alt=""/> - <ProjectNameStyled>CLAMP</ProjectNameStyled> - </Navbar.Brand> - ); - } - - renderNavBar() { - return ( - <Navbar expand="lg"> - {this.renderLogoNavBar()} - {this.renderMenuNavBar()} - {this.renderUserLoggedNavBar()} - </Navbar> - ); - } - - renderLoopViewHeader() { - return ( - <LoopViewHeaderDivStyled> - Loop Viewer - <LoopViewLoopNameSpanStyled id="loop_name">{this.state.loopName}</LoopViewLoopNameSpanStyled> - </LoopViewHeaderDivStyled> - ); - } - - renderLoopViewBody() { - return ( - <LoopViewBodyDivStyled> - <ClosedLoopSvg /> - <ClosedLoopLogs /> - <ClosedLoopStatus /> - </LoopViewBodyDivStyled> - ); - } - - renderLoopViewer() { - return ( - <LoopViewDivStyled> - {this.renderLoopViewHeader()} - {this.renderLoopViewBody()} - </LoopViewDivStyled> - ); - } - - render() { - return ( - <div id="main_div"> - <GlobalClampStyle /> - {this.renderNavBar()} - {this.renderLoopViewer()} - </div> - ); - } -} diff --git a/ui-react/src/components/app/NotFound.js b/ui-react/src/components/app/NotFound.js deleted file mode 100644 index d4b53fd7..00000000 --- a/ui-react/src/components/app/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/ui-react/src/components/app/logo.png b/ui-react/src/components/app/logo.png Binary files differdeleted file mode 100644 index c6f6857a..00000000 --- a/ui-react/src/components/app/logo.png +++ /dev/null diff --git a/ui-react/src/components/backend_communication/LoopActionService.js b/ui-react/src/components/backend_communication/LoopActionService.js deleted file mode 100644 index 9ce8ff0a..00000000 --- a/ui-react/src/components/backend_communication/LoopActionService.js +++ /dev/null @@ -1,54 +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============================================ - * =================================================================== - * - */ -const loopActionService = { - submit -}; - - -function submit(uiAction) { - const cl_name = ""; - console.log("clActionServices perform action: " + uiAction + " closedloopName=" - + cl_name); - const svcAction = uiAction.toLowerCase(); - const svcUrl = "/restservices/clds/v2/loop/" + svcAction + "/" + cl_name; - - let options = { - method: 'GET' - }; - return sendRequest(svcUrl, svcAction, options); -} - -function sendRequest(svcUrl, svcAction) { - fetch(svcUrl, options) - .then( - response => { - alertService.alertMessage("Action Successful: " + svcAction, 1) - }).error(error => { - alertService.alertMessage("Action Failure: " + svcAction, 2); - return Promise.reject(error); - }); - - return response.json(); -}; - -export default loopActionService;
\ No newline at end of file diff --git a/ui-react/src/components/backend_communication/LoopCache.js b/ui-react/src/components/backend_communication/LoopCache.js deleted file mode 100644 index 2ef83962..00000000 --- a/ui-react/src/components/backend_communication/LoopCache.js +++ /dev/null @@ -1,116 +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============================================ - * =================================================================== - * - */ -class LoopCache { - constructor() { - //this.loopJsonCache=loopJson; - this.loopJsonCache = require('./example.json'); //(with path) - } - - updateMsProperties(type, newMsProperties) { - if (newMsProperties["name"] == type) { - for (var policy in this.loopJsonCache["microServicePolicies"]) { - if (this.loopJsonCache["microServicePolicies"][policy]["name"] == type) { - this.loopJsonCache["microServicePolicies"][policy] = newMsProperties; - } - } - } - } - - updateGlobalProperties(newGlobalProperties) { - this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties; - } - - updateOpPolicyProperties(newOpProperties) { - this.loopJsonCache["operationalPolicies"] = newOpProperties; - } - - getLoopName() { - return this.loopJsonCache["name"]; - } - - getOperationalPolicyProperty() { - return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"])); - } - - getOperationalPolicies() { - return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"])); - } - - getGlobalProperty() { - return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"])); - } - - getDeploymentProperties() { - return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"])); - } - - getMsJson(type) { - var msProperties = this.loopJsonCache["microServicePolicies"]; - for (var policy in msProperties) { - if (msProperties[policy]["name"] == type) { - return JSON.parse(JSON.stringify(msProperties[policy])); - } - } - return null; - } - - getMsProperty(type) { - var msProperties = this.loopJsonCache["microServicePolicies"]; - for (var policy in msProperties) { - if (msProperties[policy]["name"] == type) { - if (msProperties[policy]["properties"] !== null && msProperties[policy]["properties"] !== undefined) { - return JSON.parse(JSON.stringify(msProperties[policy]["properties"])); - } - } - } - return null; - } - - getMsUI(type) { - var msProperties = this.loopJsonCache["microServicePolicies"]; - for (var policy in msProperties) { - if (msProperties[policy]["name"] == type) { - return JSON.parse(JSON.stringify(msProperties[policy]["jsonRepresentation"])); - } - } - return null; - } - - getResourceDetailsVfProperty() { - return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VF"]; - } - - getResourceDetailsVfModuleProperty() { - return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VFModule"]; - } - - getLoopLogsArray() { - return this.loopJsonCache.loopLogs; - } - - getComponentStates() { - return this.loopJsonCache.components; - } - -} -export default LoopCache; diff --git a/ui-react/src/components/backend_communication/UserService.js b/ui-react/src/components/backend_communication/UserService.js deleted file mode 100644 index 81453955..00000000 --- a/ui-react/src/components/backend_communication/UserService.js +++ /dev/null @@ -1,50 +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 LOGIN() { - return fetch('/restservices/clds/v1/user/getUser', { - method: 'GET', - credentials: 'include', - }) - .then(function (response) { - if (response.ok) { - console.log("getUser response received: ", response.status); - return response.text(); - } else { - console.error("getUser failed with status code: ",response.status); - return "Anonymous"; - } - }) - .then(function (data) { - console.log ("User connected:",data) - return data; - }) - .catch(function(error) { - console.error("getUser error received",error); - return "Anonymous"; - }); - } -} - diff --git a/ui-react/src/components/backend_communication/example.json b/ui-react/src/components/backend_communication/example.json deleted file mode 100644 index f3cc9e18..00000000 --- a/ui-react/src/components/backend_communication/example.json +++ /dev/null @@ -1,417 +0,0 @@ -{ - "name": "LOOP_h2NMX_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" - } - }, - "modelPropertiesJson": { - "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 - }, - "Vloadbalancerms..vdns..module-3": { - "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa", - "vfModuleModelVersion": "1", - "vfModuleModelName": "Vloadbalancerms..vdns..module-3", - "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720", - "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1", - "min_vf_module_instances": 0, - "vf_module_label": "vdns", - "max_vf_module_instances": 50, - "vf_module_type": "Expansion", - "isBase": false, - "initial_count": 0, - "volume_group": false - }, - "Vloadbalancerms..base_template..module-0": { - "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3", - "vfModuleModelVersion": "1", - "vfModuleModelName": "Vloadbalancerms..base_template..module-0", - "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce", - "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27", - "min_vf_module_instances": 1, - "vf_module_label": "base_template", - "max_vf_module_instances": 1, - "vf_module_type": "Base", - "isBase": true, - "initial_count": 1, - "volume_group": false - }, - "Vloadbalancerms..vlb..module-2": { - "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd", - "vfModuleModelVersion": "1", - "vfModuleModelName": "Vloadbalancerms..vlb..module-2", - "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a", - "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806", - "min_vf_module_instances": 0, - "vf_module_label": "vlb", - "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": { - "guard_policies": { - "guard.minmax.new": { - "recipe": "", - "clname": "LOOP_h2NMX_v1_0_ResourceInstanceName1_tca", - "actor": "", - "targets": "", - "min": "gg", - "max": "gg", - "limit": "", - "timeUnits": "", - "timeWindow": "", - "guardActiveStart": "00:00:00Z", - "guardActiveEnd": "00:00:01Z" - } - }, - "operational_policy": { - "controlLoop": { - "trigger_policy": "new", - "timeout": "0", - "abatement": "false", - "controlLoopName": "LOOP_h2NMX_v1_0_ResourceInstanceName1_tca" - }, - "policies": [ - { - "id": "new", - "recipe": "", - "retry": "0", - "timeout": "0", - "actor": "", - "payload": "", - "success": "", - "failure": "", - "failure_timeout": "", - "failure_retries": "", - "failure_exception": "", - "failure_guard": "", - "target": { - "type": "VM", - "resourceID": "" - } - } - ] - } - } - } - ], - "microServicePolicies": [ - { - "name": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca", - "modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app", - "properties": { - "domain": "measurementsForVfScaling", - "metricsPerEventName": [ - { - "policyVersion": "ff", - "thresholds": [ - { - "severity": "CRITICAL", - "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", - "thresholdValue": 0, - "closedLoopEventStatus": "ONSET", - "closedLoopControlName": "ff", - "version": "ff", - "direction": "LESS" - } - ], - "policyName": "ff", - "controlLoopSchemaType": "VM", - "policyScope": "ff", - "eventName": "ff" - } - ] - }, - "shared": false, - "jsonRepresentation": { - "schema": { - "uniqueItems": "true", - "format": "tabs-top", - "type": "array", - "title": "TCA Policy JSON", - "items": { - "type": "object", - "title": "TCA Policy JSON", - "required": [ - "domain", - "metricsPerEventName" - ], - "properties": { - "domain": { - "propertyOrder": 1001, - "default": "measurementsForVfScaling", - "title": "Domain name to which TCA needs to be applied", - "type": "string" - }, - "metricsPerEventName": { - "propertyOrder": 1002, - "uniqueItems": "true", - "format": "tabs-top", - "title": "Contains eventName and threshold details that need to be applied to given eventName", - "type": "array", - "items": { - "type": "object", - "required": [ - "controlLoopSchemaType", - "eventName", - "policyName", - "policyScope", - "policyVersion", - "thresholds" - ], - "properties": { - "policyVersion": { - "propertyOrder": 1007, - "title": "TCA Policy Scope Version", - "type": "string" - }, - "thresholds": { - "propertyOrder": 1008, - "uniqueItems": "true", - "format": "tabs-top", - "title": "Thresholds associated with eventName", - "type": "array", - "items": { - "type": "object", - "required": [ - "closedLoopControlName", - "closedLoopEventStatus", - "direction", - "fieldPath", - "severity", - "thresholdValue", - "version" - ], - "properties": { - "severity": { - "propertyOrder": 1013, - "title": "Threshold Event Severity", - "type": "string", - "enum": [ - "CRITICAL", - "MAJOR", - "MINOR", - "WARNING", - "NORMAL" - ] - }, - "fieldPath": { - "propertyOrder": 1012, - "title": "Json field Path as per CEF message which needs to be analyzed for TCA", - "type": "string", - "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" - ] - }, - "thresholdValue": { - "propertyOrder": 1014, - "title": "Threshold value for the field Path inside CEF message", - "type": "integer" - }, - "closedLoopEventStatus": { - "propertyOrder": 1010, - "title": "Closed Loop Event Status of the threshold", - "type": "string", - "enum": [ - "ONSET", - "ABATED" - ] - }, - "closedLoopControlName": { - "propertyOrder": 1009, - "title": "Closed Loop Control Name associated with the threshold", - "type": "string" - }, - "version": { - "propertyOrder": 1015, - "title": "Version number associated with the threshold", - "type": "string" - }, - "direction": { - "propertyOrder": 1011, - "title": "Direction of the threshold", - "type": "string", - "enum": [ - "LESS", - "LESS_OR_EQUAL", - "GREATER", - "GREATER_OR_EQUAL", - "EQUAL" - ] - } - } - } - }, - "policyName": { - "propertyOrder": 1005, - "title": "TCA Policy Scope Name", - "type": "string" - }, - "controlLoopSchemaType": { - "propertyOrder": 1003, - "title": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", - "type": "string", - "enum": [ - "VM", - "VNF" - ] - }, - "policyScope": { - "propertyOrder": 1006, - "title": "TCA Policy Scope", - "type": "string" - }, - "eventName": { - "propertyOrder": 1004, - "title": "Event name to which thresholds need to be applied", - "type": "string" - } - } - } - } - } - } - } - } - } - ], - "loopLogs": [ - { - "id": 2, - "logType": "INFO", - "logComponent": "CLAMP", - "message": "Micro Service policies UPDATED", - "logInstant": "2019-07-08T09:44:53Z" - }, - { - "id": 1, - "logType": "INFO", - "logComponent": "CLAMP", - "message": "Operational and Guard policies UPDATED", - "logInstant": "2019-07-08T09:44:37Z" - } - ] -} diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js index e52d930a..7d339313 100644 --- a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js +++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js @@ -24,7 +24,7 @@ import React from 'react' import Button from 'react-bootstrap/Button'; import Modal from 'react-bootstrap/Modal'; -import LoopCache from '../../backend_communication/LoopCache' +import { LOOP_CACHE } from '../../../api/LoopCache' import './OperationalPolicy.css' import styled from 'styled-components'; @@ -37,8 +37,6 @@ export default class OperationalPolicyModal extends React.Component { constructor(props, context) { super(props, context); - this.loopCache = new LoopCache(); - this.handleClose = this.handleClose.bind(this); this.initPolicySelect = this.initPolicySelect.bind(this); @@ -59,7 +57,7 @@ export default class OperationalPolicyModal extends React.Component { initPolicySelect() { if (this.allPolicies['operational_policy'] === undefined || this.allPolicies['operational_policy'] === null) { - this.allPolicies = this.loopCache.getOperationalPolicyProperty(); + this.allPolicies = LOOP_CACHE.getOperationalPolicyProperty(); } // Provision all policies ID first if (this.policyIds.length == 0 && this.allPolicies['operational_policy'] != undefined) { @@ -197,7 +195,7 @@ export default class OperationalPolicyModal extends React.Component { <label className="col-sm-4 control-label" htmlFor="clname">ControlLoopName</label> <div className="col-sm-8"> <input type="text" className="form-control" name="controlLoopName" - readOnly="readonly" id="clname" value={this.loopCache.getLoopName()} /> + readOnly="readonly" id="clname" value={LOOP_CACHE.getLoopName()} /> </div> </div> </form> |