summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuji <lu.ji3@zte.com.cn>2016-09-29 12:15:31 +0000
committerGerrit Code Review <gerrit@open-o.org>2016-09-29 12:15:31 +0000
commit0a5a7110b7b86794749b7216d6de311dea12cfab (patch)
treea1dd001abe72b5a52b41e2fc69869f4b455d739b
parent1141f2723d6f792cd7e042bed4ccd8e0d254c951 (diff)
parentaa9c6805e755d9af8a8124df127c14fcce5627c3 (diff)
Merge "Modify the bug which "Different service template shows the same nodes template table" Issue-id:TOSCA-91"
-rw-r--r--openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmController.js4
-rw-r--r--openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmDetailController.js104
-rw-r--r--openo-portal/portal-catalog/src/main/webapp/catalog/templateDetail.html4
3 files changed, 60 insertions, 52 deletions
diff --git a/openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmController.js b/openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmController.js
index 1b1c76d6..4b667a4b 100644
--- a/openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmController.js
+++ b/openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmController.js
@@ -23,7 +23,7 @@ var vm = avalon.define({
$templateTableFields : {// table columns
table: [
{"mData": "serviceTemplateId", name: "ID", "bVisible": false},
- {"mData": "templateName", name: $.i18n.prop("nfv-template-iui-field-templatename"), "fnRender" : tmUtil.nameRender},
+ {"mData": "templateName",name: $.i18n.prop("nfv-template-iui-field-templatename"),"fnRender": tmUtil.nameRender},
//{"mData": "templateName", name: $.i18n.prop("nfv-template-iui-field-templatename-topo"), "fnRender" : tmUtil.topoRender},
//{"mData": "templateName", name: $.i18n.prop("nfv-template-iui-field-templatename-nodes"), "fnRender" : tmUtil.nodesRender},
{"mData": "vendor", name: $.i18n.prop("nfv-template-iui-field-vendor")},
@@ -33,7 +33,7 @@ var vm = avalon.define({
]
},
$language: {
- "sProcessing": "<img src='../component/thirdparty/data-tables/images/loading-spinner-grey.gif'/><span>&nbsp;&nbsp;"
+ "sProcessing": "<img src='../common/thirdparty/data-tables/images/loading-spinner-grey.gif'/><span>&nbsp;&nbsp;"
+$.i18n.prop("nfv-nso-iui-table-sProcess")+"</span>",
"sLengthMenu": $.i18n.prop("nfv-nso-iui-table-sLengthMenu"),
"sZeroRecords": $.i18n.prop("nfv-nso-iui-table-sZeroRecords"),
diff --git a/openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmDetailController.js b/openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmDetailController.js
index 4db377ef..fe1567cf 100644
--- a/openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmDetailController.js
+++ b/openo-portal/portal-catalog/src/main/webapp/catalog/js/template/tmDetailController.js
@@ -14,9 +14,10 @@
* limitations under the License.
*/
var vm = avalon.define({
- $id: "tmDetailController",
- templateId: "",
- templateData: [
+ $id : "tmDetailController",
+ templateId : "",
+ globalNodesData: {},
+ templateData : [
{href: "#topology", name: "Topology", value: true},
{href: "#nodes", name: "Nodes", value: false}
],
@@ -71,14 +72,16 @@ var vm = avalon.define({
success: function (resp) {
if (resp) {
vm.nodesTab.nodesDetail.nodesTemplateDetailData = [];
+ var nodesTempData = [];
for (var i = 0; i < resp.length; i++) {
//generate node table display data
var nodeTemplate = topoUtil.generateNodeTemplate(resp[i]);
- vm.nodesTab.nodesList.nodesData.push(nodeTemplate);
+ nodesTempData.push(nodeTemplate);
}
+ vm.globalNodesData[vm.templateId] = nodesTempData;
vm.nodesTab.nodesDetail.nodesTemplateDetailData = resp;
//generate topology graph display data
- vm.topologyTab.topoTemplateData = topoUtil.generateTopoTemplate(vm.nodesTab.nodesList.nodesData.$model);
+ vm.topologyTab.topoTemplateData = topoUtil.generateTopoTemplate(vm.globalNodesData[vm.templateId]);
//initialize topology data
topoUtil.initTopoData(vm.topologyTab.topoTemplateData.$model);
//vm.nodesTab.nodesList.$initNodesTable();
@@ -89,31 +92,6 @@ var vm = avalon.define({
}
});
},
- $initNodesData: function () {
- $.ajax({
- type: "GET",
- url: vm.$restUrl.queryNodeTemplateUrl,
- success: function (resp) {
- if (resp) {
- vm.nodesTab.nodesDetail.nodesTemplateDetailData = [];
- for (var i = 0; i < resp.length; i++) {
- //generate node table display data
- var nodeTemplate = topoUtil.generateNodeTemplate(resp[i]);
- vm.nodesTab.nodesList.nodesData.push(nodeTemplate);
- }
- vm.nodesTab.nodesDetail.nodesTemplateDetailData = resp;
- //generate topology graph display data
- //vm.topologyTab.topoTemplateData = topoUtil.generateTopoTemplate(vm.nodesTab.nodesList.nodesData.$model);
- //initialize topology data
- //topoUtil.initTopoData(vm.topologyTab.topoTemplateData.$model);
- vm.nodesTab.nodesList.$initNodesTable();
- }
- },
- error: function () {
- commonUtil.showMessage($.i18n.prop("nfv-topology-iui-message-error"), "danger");
- }
- });
- },
topologyTab: {
topology: "topology.html",
vnfTip: $.i18n.prop("nfv-topology-iui-vnf-tip"),
@@ -161,9 +139,6 @@ var vm = avalon.define({
{"mData": "version", name: $.i18n.prop("nfv-template-iui-field-version")},
{"mData": "csarid", name: "packageID", "bVisible": false},
{"mData": "type", name: $.i18n.prop("nfv-template-iui-field-type")},
- //{"mData": "inputs", name: $.i18n.prop("nfv-template-iui-field-inputs"),"fnRender" : tmDetailUtil.inputsRender},
- //{"mData": "outputs", name: $.i18n.prop("nfv-template-iui-field-outputs"),"fnRender" : tmDetailUtil.outputsRender},
- //{"mData": "operations", name: $.i18n.prop("nfv-template-iui-field-operations")}
]
},
$initNfvNodesTab: function () {
@@ -185,15 +160,43 @@ var vm = avalon.define({
tr.removeClass('shown');
}
else {
- table.fnOpen(tr[0], vm.nodesTab.nodesList.$format_Detail(), 'details');
+ table.fnOpen(tr[0], vm.nodesTab.nodesList.$format_Detail(table,tr[0]), 'details');
tr.addClass('shown');
}
});
},
-
+ $initNodesData: function (tempId) {
+ $.ajax({
+ type: "GET",
+ //url: vm.$restUrl.queryNodeTemplateUrl,
+ url: "/openoapi/catalog/v1/servicetemplates/" + tempId + "/nodetemplates",
+ success: function (resp) {
+ if (resp) {
+ vm.nodesTab.nodesDetail.templatesNodesDetailData[tempId] = [];
+ var nodesTempData = [];
+ for (var i = 0; i < resp.length; i++) {
+ //generate node table display data
+ var nodeTemplate = topoUtil.generateNodeTemplate(resp[i]);
+ nodesTempData.push(nodeTemplate);
+ }
+ vm.nodesTab.nodesList.nodesData[tempId] = nodesTempData;
+ vm.nodesTab.nodesDetail.templatesNodesDetailData[tempId] = resp;
+ //generate topology graph display data
+ //vm.topologyTab.topoTemplateData = topoUtil.generateTopoTemplate(vm.nodesTab.nodesList.nodesData.$model);
+ //initialize topology data
+ //topoUtil.initTopoData(vm.topologyTab.topoTemplateData.$model);
+ vm.nodesTab.nodesList.$initNodesTable(tempId);
+ }
+ },
+ error: function () {
+ commonUtil.showMessage($.i18n.prop("nfv-topology-iui-message-error"), "danger");
+ }
+ });
+ },
//nodes list table
nodesList: {
- nodesData: [],
+ nodesData: {},
+ tempId:"",
$nodesTabDataId: "ict_nodes_table",
$nodesTabFields: {// table columns
table: [
@@ -227,27 +230,32 @@ var vm = avalon.define({
}
]
},
- $initNodesTable: function () {
+ $initNodesTable: function (tempId) {
var setting = {};
setting.language = vm.$language;
setting.paginate = true;
setting.info = true;
//setting.sort = true;
setting.columns = vm.nodesTab.nodesList.$nodesTabFields.table;
- setting.restUrl = vm.$restUrl.queryNodeTemplateUrl;
- setting.tableId = vm.nodesTab.nodesList.$nodesTabDataId;
+ setting.restUrl = "/openoapi/catalog/v1/servicetemplates/" + tempId + "/nodetemplates";
+ setting.tableId = vm.nodesTab.nodesList.$nodesTabDataId + "_" + tempId;
//serverPageTable.initTableWithData(setting,vm.nodesTab.nodesList.$nodesTabDataId + '_div',vm.nodesTab.nodesList.nodesData.$model);
- serverPageTable.initTableWithoutLib(setting, {}, vm.nodesTab.nodesList.$nodesTabDataId + '_div');
+ serverPageTable.initTableWithoutLib(setting, {}, setting.tableId + '_div');
},
- $format_Detail: function () {
- var sOut = '<div class="row-fluid" data-name="table_zone"><div class="col-xs-12" id="ict_nodes_table_div"></div></div>'
- vm.$initNodesData();
+ $format_Detail: function (oTable, nTr) {
+ var aData = oTable.fnGetData(nTr);
+ var tempId = aData.serviceTemplateId;
+ vm.nodesTab.nodesList.tempId = tempId;
+ var tableId = "ict_nodes_table" + "_" + tempId + "_div";
+ var sOut = '<div class="row-fluid" data-name="table_zone"><div class="col-xs-12" id="'+tableId+'"></div></div>'
+ vm.nodesTab.$initNodesData(tempId);
return sOut;
},
},
//Nodes Details
nodesDetail: {
nodesTemplateDetailData: [],
+ templatesNodesDetailData:[],
detailTitle: "",
isShow: "none",
detailIndex: 0,
@@ -264,13 +272,13 @@ var vm = avalon.define({
isActive: false
}
],
- $showDetails: function (isShow, nodetypeid, nodetypename) {
+ $showDetails: function (isShow, nodetypeid, nodetypename,tempId) {
vm.nodesTab.nodesDetail.isShow = isShow;
if (isShow == "block") {
vm.nodesTab.nodesDetail.detailTitle = nodetypename + " " + $.i18n.prop("nfv-templateDetail-nodesTab-iui-title-nodeDetail"),
$('#' + vm.nodesTab.nodesDetail.detailData[0].id).click();
vm.nodesTab.nodesDetail.detailData[0].isActive = true;
- vm.nodesTab.nodesDetail.$initNodeDetailTable(nodetypeid);
+ vm.nodesTab.nodesDetail.$initNodeDetailTable(nodetypeid,tempId);
}
},
detailCondChange: function (index) {
@@ -280,7 +288,7 @@ var vm = avalon.define({
}
vm.nodesTab.nodesDetail.detailData[index].isActive = true;
},
- $tableFields: {// table columns
+ $tableFields : {// table columns
general: [
{
"mData": "key",
@@ -323,8 +331,8 @@ var vm = avalon.define({
}
]
},
- $initNodeDetailTable: function (nodetemplateid) {
- var data = topoUtil.getCurrentDetailData(vm.nodesTab.nodesDetail.nodesTemplateDetailData.$model, nodetemplateid);
+ $initNodeDetailTable: function (nodetemplateid,tempId) {
+ var data = topoUtil.getCurrentDetailData(vm.nodesTab.nodesList.nodesData[tempId], nodetemplateid);
//initialize three tables of nodedetail
$.each(vm.nodesTab.nodesDetail.$tableFields, function (key, value) {
var setting = {};
diff --git a/openo-portal/portal-catalog/src/main/webapp/catalog/templateDetail.html b/openo-portal/portal-catalog/src/main/webapp/catalog/templateDetail.html
index f2b88d7f..5582a97f 100644
--- a/openo-portal/portal-catalog/src/main/webapp/catalog/templateDetail.html
+++ b/openo-portal/portal-catalog/src/main/webapp/catalog/templateDetail.html
@@ -106,8 +106,8 @@
<script type="text/javascript" src="../common/thirdparty/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../common/thirdparty/bootstrap/js/bootstrap.min.js"></script>
- <script type="text/javascript" src="../common/thirdparty/data-tables/jquery.dataTables.js"></script>
- <script type="text/javascript" src="../common/thirdparty/data-tables/jquery.dataTables.min.js"></script>
+ <!--<script type="text/javascript" src="../common/thirdparty/data-tables/jquery.dataTables.js"></script>-->
+ <script type="text/javascript" src="../common/thirdparty/data-tables/jquery.dataTables-1.9.4.min.js"></script>
<script type="text/javascript" src="../common/thirdparty/jquery.i18n/jquery.i18n.properties-1.0.9.js"></script>
<script type="text/javascript" src="../common/thirdparty/bootstrap-growl/bootstrap-growl.min.js"></script>