Changes include Metadata support, Upload tosca policy model and Loop Template
CLAMP Metadata support to parse policy_model_type, acronym and clamp_possible_values from the Tosca Policy Model
UI and Backend changes to support Loop Template
Backend APIs for Dictionary referenced in the Tosca Policy Model.
Upload Tosca Model UI changes to allow user to upload policy models.
DB Schema changes for the Loop Element Model and updated schema for the Dictionary
Added Jest test cases and snapshots
checkstyle issues fix and Junits
Issue-ID: CLAMP-580
Signed-off-by: ash74268 <ashwin.shyam.sharma@att.com>
Change-Id: I57521bc1c3afaf4ca5a2acf4c59823df05fd4cd6
Signed-off-by: ash74268 <ashwin.shyam.sharma@att.com>
diff --git a/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js b/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js
index 6a93d4d..5b66a25 100644
--- a/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js
+++ b/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,29 +58,29 @@
show: true,
content: 'Please select Tosca model to view the details',
selectedRow: -1,
- toscaNames: [],
+ toscaPolicyModelNames: [],
toscaColumns: [
{ title: "#", field: "index", render: rowData => rowData.tableData.id + 1,
cellStyle: cellStyle,
headerStyle: headerStyle
},
- { title: "Micro Service Name", field: "toscaModelName",
+ { title: "Policy Model Type", field: "policyModelType",
cellStyle: cellStyle,
headerStyle: headerStyle
},
- { title: "PolicyType", field: "policyType",
+ { title: "Policy Acronym", field: "policyAcronym",
cellStyle: cellStyle,
headerStyle: headerStyle
},
- { title: "Version", field: "toscaModelRevisions[0].version",
+ { title: "Version", field: "version",
cellStyle: cellStyle,
headerStyle: headerStyle
},
- { title: "Uploaded By", field: "userId",
+ { title: "Uploaded By", field: "updatedBy",
cellStyle: cellStyle,
headerStyle: headerStyle
},
- { title: "Uploaded Date", field: "lastUpdatedDate", editable: 'never',
+ { title: "Uploaded Date", field: "updatedDate", editable: 'never',
cellStyle: cellStyle,
headerStyle: headerStyle
}
@@ -101,6 +101,7 @@
this.handleClose = this.handleClose.bind(this);
this.getPolicyToscaModels = this.getToscaPolicyModels.bind(this);
this.handleYamlContent = this.handleYamlContent.bind(this);
+ this.getToscaPolicyModelYaml = this.getToscaPolicyModelYaml.bind(this);
}
componentWillMount() {
@@ -108,11 +109,25 @@
}
getToscaPolicyModels() {
- TemplateMenuService.getToscaPolicyModels().then(toscaNames => {
- this.setState({ toscaNames: toscaNames });
+ TemplateMenuService.getToscaPolicyModels().then(toscaPolicyModelNames => {
+ this.setState({ toscaPolicyModelNames: toscaPolicyModelNames });
});
}
+ getToscaPolicyModelYaml(policyModelType) {
+ if (typeof policyModelType !== "undefined") {
+ TemplateMenuService.getToscaPolicyModelYaml(policyModelType).then(toscaYaml => {
+ if (toscaYaml.length !== 0) {
+ this.setState({content: toscaYaml})
+ } else {
+ this.setState({ content: 'Please select Tosca model to view the details' })
+ }
+ });
+ } else {
+ this.setState({ content: 'Please select Tosca model to view the details' })
+ }
+ }
+
handleYamlContent(event) {
this.setState({ content: event.target.value });
}
@@ -130,10 +145,10 @@
<Modal.Body>
<MaterialTable
title={"View Tosca Policy Models"}
- data={this.state.toscaNames}
+ data={this.state.toscaPolicyModelNames}
columns={this.state.toscaColumns}
icons={this.state.tableIcons}
- onRowClick={(event, rowData) => {this.setState({content: rowData.toscaModelRevisions[0].toscaModelYaml, selectedRow: rowData.tableData.id})}}
+ onRowClick={(event, rowData) => {this.getToscaPolicyModelYaml(rowData.policyModelType);this.setState({selectedRow: rowData.tableData.id})}}
options={{
headerStyle: rowHeaderStyle,
rowStyle: rowData => ({