aboutsummaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/components/loop_viewer
diff options
context:
space:
mode:
Diffstat (limited to 'gui-clamp/ui-react/src/components/loop_viewer')
-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
9 files changed, 0 insertions, 800 deletions
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>
-`;