aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src
diff options
context:
space:
mode:
Diffstat (limited to 'ui-react/src')
-rw-r--r--ui-react/src/api/LoopCache.js6
-rw-r--r--ui-react/src/api/LoopCache.test.js2
-rw-r--r--ui-react/src/api/LoopCache_mokeLoopJsonCache.json2
-rw-r--r--ui-react/src/api/PolicyToscaService.js4
-rw-r--r--ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js20
-rw-r--r--ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js16
-rw-r--r--ui-react/src/components/dialogs/Tosca/__snapshots__/UploadToscaPolicyModal.test.js.snap111
-rw-r--r--ui-react/src/components/menu/MenuBar.js1
-rw-r--r--ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap3
9 files changed, 14 insertions, 151 deletions
diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js
index b17723089..03cec9fa6 100644
--- a/ui-react/src/api/LoopCache.js
+++ b/ui-react/src/api/LoopCache.js
@@ -31,7 +31,7 @@ export default class LoopCache {
updateMicroServiceProperties(name, newMsProperties) {
for (var policy in this.loopJsonCache["microServicePolicies"]) {
if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
- this.loopJsonCache["microServicePolicies"][policy]["properties"] = newMsProperties;
+ this.loopJsonCache["microServicePolicies"][policy]["configurationsJson"] = newMsProperties;
}
}
}
@@ -91,7 +91,7 @@ export default class LoopCache {
getOperationalPolicyPropertiesForName(name) {
var opConfig = this.getOperationalPolicyForName(name);
if (opConfig !== null) {
- return opConfig["properties"];
+ return opConfig["configurationsJson"];
}
return null;
}
@@ -118,7 +118,7 @@ export default class LoopCache {
getMicroServicePropertiesForName(name) {
var msConfig = this.getMicroServiceForName(name);
if (msConfig !== null) {
- return msConfig["properties"];
+ return msConfig["configurationsJson"];
}
return null;
}
diff --git a/ui-react/src/api/LoopCache.test.js b/ui-react/src/api/LoopCache.test.js
index 471fa4d71..97c09fa36 100644
--- a/ui-react/src/api/LoopCache.test.js
+++ b/ui-react/src/api/LoopCache.test.js
@@ -103,7 +103,7 @@ describe('Verify LoopCache functions', () => {
const msJson = {
"name": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca",
"modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "properties": {"domain": "measurementsForVfScaling"},
+ "configurationsJson": {"domain": "measurementsForVfScaling"},
"shared": false,
"jsonRepresentation": {"schema": {}}
};
diff --git a/ui-react/src/api/LoopCache_mokeLoopJsonCache.json b/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
index 087ab5d45..23ea354ea 100644
--- a/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
+++ b/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
@@ -103,7 +103,7 @@
{
"name": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca",
"modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "properties": {"domain": "measurementsForVfScaling"},
+ "configurationsJson": {"domain": "measurementsForVfScaling"},
"shared": false,
"jsonRepresentation": {"schema": {}}
}
diff --git a/ui-react/src/api/PolicyToscaService.js b/ui-react/src/api/PolicyToscaService.js
index 52e68fac4..610a11418 100644
--- a/ui-react/src/api/PolicyToscaService.js
+++ b/ui-react/src/api/PolicyToscaService.js
@@ -78,8 +78,8 @@ export default class PolicyToscaService {
});
}
- static createPolicyModelFromToscaModel(policyModelType, jsonData) {
- return fetch('/restservices/clds/v2/policyToscaModels/' + policyModelType, {
+ static createPolicyModelFromToscaModel(jsonData) {
+ return fetch('/restservices/clds/v2/policyToscaModels', {
method: 'POST',
credentials: 'same-origin',
headers: {
diff --git a/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js b/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js
index 2e0460f61..1937485b0 100644
--- a/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js
+++ b/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js
@@ -39,12 +39,10 @@ export default class UploadToscaPolicyModal extends React.Component {
this.handleCreateFromToscaPolicyModel = this.handleCreateFromToscaPolicyModel.bind(this);
this.handleClose = this.handleClose.bind(this);
- this.handlePolicyModelType = this.handlePolicyModelType.bind(this);
this.fileSelectedHandler = this.fileSelectedHandler.bind(this);
this.state = {
show: true,
selectedFile: '',
- policyModelType: '',
policyModelTosca: [],
apiResponseStatus: '',
apiResponseMessage: '',
@@ -56,7 +54,7 @@ export default class UploadToscaPolicyModal extends React.Component {
if (event.target.files && event.target.files[0]) {
const scope = this;
let reader = new FileReader();
- this.setState({policyModelType: '', policyModelTosca: '' });
+ this.setState({policyModelTosca: '' });
reader.onload = function(e) {
scope.setState({ policyModelTosca: reader.result});
};
@@ -73,9 +71,8 @@ export default class UploadToscaPolicyModal extends React.Component {
handleCreateFromToscaPolicyModel(e) {
e.preventDefault();
- console.log("Policy Model Type is", this.state.policyModelType);
- if(this.state.policyModelType && this.state.policyModelTosca) {
- PolicyToscaService.createPolicyModelFromToscaModel(this.state.policyModelType, this.state.policyModelTosca).then(resp => {
+ if(this.state.policyModelTosca) {
+ PolicyToscaService.createPolicyModelFromToscaModel(this.state.policyModelTosca).then(resp => {
if(resp.status === 200) {
this.setState({apiResponseStatus: resp.status, apiResponseMessage: resp.message, upldBtnClicked: true});
} else {
@@ -87,12 +84,6 @@ export default class UploadToscaPolicyModal extends React.Component {
}
}
- handlePolicyModelType = event => {
- this.setState({
- policyModelType: event.target.value
- })
- }
-
render() {
return (
<ModalStyled size="lg" show={this.state.show} onHide={this.handleClose}>
@@ -108,11 +99,6 @@ export default class UploadToscaPolicyModal extends React.Component {
<Alert variant="secondary">
<p>{this.state.selectedFile.name}</p>
</Alert>
- <Form.Label column sm="2">Policy Model Type:</Form.Label>
- <input type="text" style={{width: '50%'}}
- value={this.state.policyModelType}
- onChange={this.handlePolicyModelType}
- />
</Col>
</Form.Group>
</Modal.Body>
diff --git a/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js b/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js
index dac8ac920..e4842062a 100644
--- a/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js
+++ b/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js
@@ -27,22 +27,6 @@ import UploadToscaPolicyModal from './UploadToscaPolicyModal';
describe('Test Upload Tosca Policy Model', () => {
- it('Test handleMicroServiceName', () => {
-
- const component = shallow(<UploadToscaPolicyModal />);
-
- const inputValue = 'TCA'
-
- const button = component.find('input').at(1);
-
- button.simulate('change', { target: { value: inputValue }});
-
- expect(component.state('policyModelType')).toEqual(inputValue);
-
- expect(component).toMatchSnapshot();
-
- });
-
it('Test handleUploadToscaPolicyModel for Tosca Model', () => {
const component = shallow(<UploadToscaPolicyModal />);
diff --git a/ui-react/src/components/dialogs/Tosca/__snapshots__/UploadToscaPolicyModal.test.js.snap b/ui-react/src/components/dialogs/Tosca/__snapshots__/UploadToscaPolicyModal.test.js.snap
deleted file mode 100644
index 8e801367b..000000000
--- a/ui-react/src/components/dialogs/Tosca/__snapshots__/UploadToscaPolicyModal.test.js.snap
+++ /dev/null
@@ -1,111 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Test Upload Tosca Policy Model Test handleMicroServiceName 1`] = `
-<Styled(Bootstrap(Modal))
- onHide={[Function]}
- show={true}
- size="lg"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Upload 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"
- name="file"
- onChange={[Function]}
- style={
- Object {
- "display": "none",
- }
- }
- type="file"
- />
- <button
- onClick={[Function]}
- >
- Pick Tosca File
- </button>
- <Alert
- closeLabel="Close alert"
- show={true}
- transition={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "defaultProps": Object {
- "appear": false,
- "in": false,
- "mountOnEnter": false,
- "timeout": 300,
- "unmountOnExit": false,
- },
- "displayName": "Fade",
- "render": [Function],
- }
- }
- variant="secondary"
- >
- <p />
- </Alert>
- <FormLabel
- column={true}
- sm="2"
- srOnly={false}
- >
- Policy Model Type:
- </FormLabel>
- <input
- onChange={[Function]}
- style={
- Object {
- "width": "50%",
- }
- }
- type="text"
- value="TCA"
- />
- </Col>
- </FormGroup>
- </ModalBody>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- type="null"
- variant="secondary"
- >
- Cancel
- </Button>
- <Button
- active={false}
- disabled={true}
- onClick={[Function]}
- type="submit"
- variant="primary"
- >
- Create
- </Button>
- </ModalFooter>
-</Styled(Bootstrap(Modal))>
-`;
diff --git a/ui-react/src/components/menu/MenuBar.js b/ui-react/src/components/menu/MenuBar.js
index 2f13cfe32..92380ab6c 100644
--- a/ui-react/src/components/menu/MenuBar.js
+++ b/ui-react/src/components/menu/MenuBar.js
@@ -107,6 +107,7 @@ export default class MenuBar extends React.Component {
<NavDropdown.Item as={StyledLink} to="/stop" disabled={this.state.disabled}>Undeploy from Policy Engine (STOP)</NavDropdown.Item>
<NavDropdown.Item as={StyledLink} to="/restart" disabled={this.state.disabled}>ReDeploy to Policy Engine (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>
diff --git a/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap b/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap
index 63d3f6543..dfc6a5682 100644
--- a/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap
+++ b/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap
@@ -680,6 +680,9 @@ exports[`Verify MenuBar Test the render method 1`] = `
>
Delete loop instance (DELETE)
</DropdownItem>
+ <DropdownDivider
+ role="separator"
+ />
<DropdownItem
as={
Object {