summaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/components/dialogs/Loop
diff options
context:
space:
mode:
authorbrunomilitzer <bruno.militzer@est.tech>2021-06-04 14:40:46 +0100
committerbrunomilitzer <bruno.militzer@est.tech>2021-06-04 16:06:28 +0100
commit8c6beedc3d58420988c9e80d75aad96198e2962e (patch)
tree0d362d8cc43c84fa8974143ca2e3a4fc376d4b89 /gui-clamp/ui-react/src/components/dialogs/Loop
parent83022f8577c170df5a9816be90378bea4643f0af (diff)
MERGE Clamp UI-React repo to Policy Gui Repo
According to a Diff differences from one repo to the other, there was some missing changes from the original clamp repo to the policy gui repo. Issue-ID: POLICY-3267 Change-Id: I9a71841732dc5c3d9623bca9c1384866f4c826a6 Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Diffstat (limited to 'gui-clamp/ui-react/src/components/dialogs/Loop')
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js7
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js21
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js7
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/Loop/__snapshots__/DeployLoopModal.test.js.snap9
4 files changed, 22 insertions, 22 deletions
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
index 401bb6a..3d94833 100644
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js
@@ -26,6 +26,13 @@ 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 () => {
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js b/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
index b7ab8a5..5fff586 100644
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP CLAMP
+ * ONAP POLICY-CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,6 +44,7 @@ const FormStyled = styled(Form.Group)`
`
export default class DeployLoopModal extends React.Component {
+
constructor(props, context) {
super(props, context);
@@ -65,13 +66,7 @@ export default class DeployLoopModal extends React.Component {
getInitialKeyValue(temporaryPropertiesJson) {
const deployJsonList = temporaryPropertiesJson["dcaeDeployParameters"];
- let initialKey;
- Object.keys(deployJsonList)
- .filter((obj) => Object.keys(deployJsonList).indexOf(obj) === 0)
- .map(obj =>
- initialKey = obj
- );
- return initialKey;
+ return Object.keys(deployJsonList).find((obj) => Object.keys(deployJsonList).indexOf(obj) === 0);
}
componentWillReceiveProps(newProps) {
@@ -145,8 +140,8 @@ export default class DeployLoopModal extends React.Component {
const deployJsonList = this.state.temporaryPropertiesJson["dcaeDeployParameters"];
var indents = [];
- Object.keys(deployJsonList).map((item, key) =>
- indents.push(<Tab eventKey={ item } title={ item }>
+ Object.keys(deployJsonList).forEach(item =>
+ indents.push(<Tab key={ item } eventKey={ item } title={ item }>
{ this.renderDeployParam(deployJsonList[item]) }
</Tab>)
);
@@ -155,8 +150,8 @@ export default class DeployLoopModal extends React.Component {
renderDeployParam(deployJson) {
var indents = [];
- Object.keys(deployJson).map((item, key) =>
- indents.push(<FormStyled>
+ 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>));
diff --git a/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js b/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js
index 8f8b74d..0d20341 100644
--- a/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js
@@ -130,13 +130,6 @@ export default class ModifyLoopModal extends React.Component {
this.initializeToscaPolicyModelsInfo();
}
- componentWillReceiveProps(newProps) {
- this.setState({
- loopCache: newProps.loopCache,
- temporaryPropertiesJson: JSON.parse(JSON.stringify(newProps.loopCache.getGlobalProperties()))
- });
- }
-
initializeToscaPolicyModelsInfo() {
var operationalPolicies = this.state.loopCache.getOperationalPolicies();
var selectedPolicyModels = [];
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
index 4779ced..33f8faa 100644
--- 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
@@ -26,9 +26,12 @@ exports[`Verify DeployLoopModal Test the render method 1`] = `
>
<Tab
eventKey="testMs"
+ key="testMs"
title="testMs"
>
- <Styled(FormGroup)>
+ <Styled(FormGroup)
+ key="location_id"
+ >
<FormLabel
column={false}
srOnly={false}
@@ -42,7 +45,9 @@ exports[`Verify DeployLoopModal Test the render method 1`] = `
type="text"
/>
</Styled(FormGroup)>
- <Styled(FormGroup)>
+ <Styled(FormGroup)
+ key="policy_id"
+ >
<FormLabel
column={false}
srOnly={false}