diff options
author | 2016-10-22 11:40:43 +0800 | |
---|---|---|
committer | 2016-10-22 11:40:43 +0800 | |
commit | 10f61f323e7b566fd86f5c0fc1904e030afe2239 (patch) | |
tree | 60344fd5c40a6d277af8ba7a68e3450f2dd92b67 /openo-portal/portal-catalog/src/main/webapp/catalog/js/package | |
parent | 9a7b8cfb0e8182d0d69d73ee40c0116042bc2e5e (diff) |
Change the realization of package table, fix the bug GSO-40
Change-Id: Ie05b630cd3cd091c5604641a75ad1956a77c3467
Issue-id:GSO-40
Signed-off-by: nancylizi <li.zi30@zte.com.cn>
Diffstat (limited to 'openo-portal/portal-catalog/src/main/webapp/catalog/js/package')
-rw-r--r-- | openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmController.js | 72 | ||||
-rw-r--r-- | openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmUtil.js | 30 |
2 files changed, 76 insertions, 26 deletions
diff --git a/openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmController.js b/openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmController.js index 72d83dfb..abe4fb14 100644 --- a/openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmController.js +++ b/openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmController.js @@ -15,22 +15,26 @@ */
var vm = avalon.define({
$id : "pmController",
+ $tableId : "ict_package_table",
resource : {
packageInfo : [],
packageDetails : "",
vimSelectItems : []
},
csarIdSelected : "",
- //$packageTableFields : {// table columns
- // table: [
- // {"mData": "name", name: $.i18n.prop("nfv-package-iui-field-name")},
- // {"mData": "type", name: $.i18n.prop("nfv-package-iui-field-type")},
- // {"mData": "size", name: $.i18n.prop("nfv-package-iui-field-size")},
- // {"mData": "createTime", name: $.i18n.prop("nfv-package-iui-field-createTime")},
- // {"mData": "status", name: $.i18n.prop("nfv-package-iui-field-status"), "fnRender" : pmUtil.statusRender},
- // {"mData": null, name: $.i18n.prop("nfv-package-iui-field-operation"), "fnRender" : pmUtil.actionRender}
- // ]
- //},
+ $packageTableFields : {// table columns
+ table: [
+ //{"mData":"",name:$.i18n.prop("nfv-package-iui-field-sn")},
+ {"mData": "csarId", name: "ID", "bVisible": false},
+ {"mData": "name", name: $.i18n.prop("nfv-package-iui-field-name"),"fnRender" : pmUtil.nameRender},
+ {"mData": "type", name: $.i18n.prop("nfv-package-iui-field-type")},
+ {"mData": "usageState", name: $.i18n.prop("nfv-package-iui-field-usagestate")},
+ {"mData": "processState", name: $.i18n.prop("nfv-package-iui-field-processstate")},
+ {"mData": "operationalState", name: $.i18n.prop("nfv-package-iui-field-operationalstate")},
+ {"mData": "onBoardState", name: $.i18n.prop("nfv-package-iui-field-onboardstate"), "fnRender" : pmUtil.onBoardRender},
+ {"mData": "", name: $.i18n.prop("nfv-package-iui-field-operation"), "fnRender" : pmUtil.operationRender}
+ ]
+ },
$language: {
"sProcessing": "<img src='../common/thirdparty/data-tables/images/loading-spinner-grey.gif'/><span> "
+$.i18n.prop("nfv-nso-iui-table-sProcess")+"</span>",
@@ -66,14 +70,24 @@ var vm = avalon.define({ var cond = {};
return cond;
},
- $initTable: function() {
- var url=vm.$restUrl.queryPackageInfoUrl;
- commonUtil.get(url,null,function(resp) {
- if (resp) {
- vm.resource.packageInfo=resp;
- }
- })
- },
+ //$initTable: function() {
+ // var url=vm.$restUrl.queryPackageInfoUrl;
+ // commonUtil.get(url,null,function(resp) {
+ // if (resp) {
+ // vm.resource.packageInfo=resp;
+ // }
+ // })
+ //},
+ $initTable: function() {
+ var setting = {};
+ setting.language = vm.$language;
+ setting.paginate = true;
+ setting.info = true;
+ setting.columns = vm.$packageTableFields.table;
+ setting.restUrl = vm.$restUrl.queryPackageInfoUrl;
+ setting.tableId = vm.$tableId;
+ serverPageTable.initDataTable(setting,{},vm.$tableId + '_div');
+ },
packageDetail : {
detailTitle : "",
isShow : "none",
@@ -88,14 +102,14 @@ var vm = avalon.define({ isActive : false
}
],
- $showDetails : function (isShow, sn, name) {
+ $showDetails : function (isShow, csarId, name) {
vm.packageDetail.isShow = isShow;
vm.packageDetail.detailCondChange(0);
if (isShow == "block") {
vm.packageDetail.detailTitle = name + "-" + $.i18n.prop("nfv-package-iui_packageview_packageDetail"),
$('#' + vm.packageDetail.detailData[0].id).click();
vm.packageDetail.detailData[0].isActive = true;
- vm.packageDetail.$initPackageDetailTable(sn);
+ vm.packageDetail.$initPackageDetailTable(csarId);
}
},
detailCondChange : function (index) {
@@ -105,8 +119,15 @@ var vm = avalon.define({ }
vm.packageDetail.detailData[index].isActive = true;
},
- $initPackageDetailTable : function (sn) {
- vm.resource.packageDetails = vm.resource.packageInfo[sn];
+ $initPackageDetailTable : function (csarId) {
+ var data;
+ for(var i=0; i<vm.resource.packageInfo.length; i++) {
+ if (vm.resource.packageInfo[i].csarId == csarId) {
+ data = vm.resource.packageInfo[i];
+ break;
+ }
+ }
+ vm.resource.packageDetails = data;
vm.resource.relationInfo = [];
},
$isRowDeletingStatus : function(name) {
@@ -221,13 +242,16 @@ var vm = avalon.define({ var url = vm.$restUrl.gsarOnboardUrl;
pmUtil.doOnBoard(url, param);
} else if(type == "SSAR") {
- var ssarTarOnbardState="";
+ var ssarTarOnbardState="";
+ var operationalState="";
if(onBoardState =="onBoarded") {
ssarTarOnbardState = "non-onBoarded";
+ operationalState = "Disabled";
} else {
ssarTarOnbardState = "onBoarded";
+ operationalState = "Enabled";
}
- var url = vm.$restUrl.ssarOnboardUrl+"/"+csarId+"?onBoardState="+ssarTarOnbardState
+ var url = vm.$restUrl.ssarOnboardUrl+"/"+csarId+"?onBoardState="+ssarTarOnbardState+"&operationalState="+operationalState;
pmUtil.doSSAROnboard(url);
}
},
diff --git a/openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmUtil.js b/openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmUtil.js index d6321262..79dd813b 100644 --- a/openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmUtil.js +++ b/openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmUtil.js @@ -151,15 +151,41 @@ pmUtil.delPackage = function (url) { contentType : "application/json",
success : function(resp) {
commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-success"), "success");
- refreshByCond();
+ setTimeout( function(){
+ refreshByCond();
+ }, 1 * 1000 );
},
error : function(resp) {
if(resp.status == 202 || resp.responseText == "success") {
commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-success"), "success");
- refreshByCond();
+ setTimeout( function(){
+ refreshByCond();
+ }, 1 * 1000 );
+ //refreshByCond();
} else {
commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-error"), "failed");
+ setTimeout( function(){
+ refreshByCond();
+ }, 1 * 1000 );
+ //refreshByCond();
}
}
});
}
+
+pmUtil.nameRender = function(obj) {
+ return '<a href="#" onclick="vm.packageDetail.$showDetails('
+ + '\'block\',\'' + obj.aData.id + '\', \'' + obj.aData.name + '\')">' + obj.aData.name + '</a>';
+}
+
+pmUtil.onBoardRender = function(obj) {
+ var attr;
+ attr = 'class="label label-info status" data-toggle="tooltip" title="nfv-package-iui-status-tip"';
+ return '<span class="label label-info status" data-toggle="tooltip" title="nfv-package-iui-status-tip" onclick="vm.onBoardPackage(\'' + obj.aData.csarId
+ + '\',\''+ obj.aData.type + '\', \''+ obj.aData.onBoardState +'\')">' + obj.aData.onBoardState + '</span>';
+}
+
+pmUtil.operationRender = function(obj) {
+ return '<a href="#" class="btn-xs grey btn-editable" onclick="vm.$delPackage(\'' + obj.aData.csarId
+ + '\',\''+ obj.aData.type + '\')">' + '<i class=\"ict-delete\"></i>' + $.i18n.prop('nfv-software-iui-action-delete') + '</a>';
+}
\ No newline at end of file |