aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js
diff options
context:
space:
mode:
authorash74268 <ashwin.shyam.sharma@att.com>2020-01-31 15:40:15 +0000
committersebdet <sebastien.determe@intl.att.com>2020-02-14 08:02:47 -0800
commit3a83e2a2ff88ef49535973df8dc77dc8015170da (patch)
tree7b1d9376a6a3967d9690bcc88487fb6bb7893167 /ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js
parent29e3cd1afbd3202a0c16ef6a4057662942ddefa2 (diff)
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>
Diffstat (limited to 'ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js')
-rw-r--r--ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js37
1 files changed, 26 insertions, 11 deletions
diff --git a/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js b/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js
index 6a93d4d98..5b66a25c0 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 @@ export default class ViewToscalPolicyModal extends React.Component {
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 @@ export default class ViewToscalPolicyModal extends React.Component {
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 @@ export default class ViewToscalPolicyModal extends React.Component {
}
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 @@ export default class ViewToscalPolicyModal extends React.Component {
<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 => ({