diff options
author | nancylizi <li.zi30@zte.com.cn> | 2016-10-27 14:57:37 +0800 |
---|---|---|
committer | nancylizi <li.zi30@zte.com.cn> | 2016-10-28 08:39:30 +0800 |
commit | 5bfc39f1e6befe01563be95d3e40fd7b5f7e14fe (patch) | |
tree | 67faca71b140cf656d896e0ecc85dbfe9a2ce4a1 | |
parent | d1c4216d1ab52fd06ed89ce3e7827fd2216ca413 (diff) |
Fix the bug "delete package, package table would not be refreshed".
Change-Id: Ia2311b7e5e0ecc0f072ab03d064a55764a60d886
Issue-id:GSO-50
Signed-off-by: nancylizi <li.zi30@zte.com.cn>
3 files changed, 31 insertions, 18 deletions
diff --git a/openo-portal/portal-catalog/src/main/webapp/catalog/csarPackage.html b/openo-portal/portal-catalog/src/main/webapp/catalog/csarPackage.html index fc427394..6c547ce1 100644 --- a/openo-portal/portal-catalog/src/main/webapp/catalog/csarPackage.html +++ b/openo-portal/portal-catalog/src/main/webapp/catalog/csarPackage.html @@ -226,6 +226,7 @@ <script type="text/javascript" src="../common/thirdparty/jquery.i18n/jquery.i18n.properties-1.0.9.js"></script>
<script type="text/javascript" src="../common/thirdparty/cometd/cometd.js"></script>
+ <script type="text/javascript" src="../common/thirdparty/cometd/jquery/jquery.cometd.js"></script>
<script type="text/javascript" src="../common/thirdparty/jQuery-File-Upload/js/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../common/thirdparty/jQuery-File-Upload/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="../common/thirdparty/jQuery-File-Upload/js/jquery.fileupload.js"></script>
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 9129b9d3..3b19d23e 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 @@ -326,6 +326,11 @@ var vm = avalon.define({ }
});
},
+ $initCometd : function() {
+ commonUtil.registerCometdMessage("/openoapi/catalog/v1/catalognotification", "/package/delete", function(message) {
+ pmUtil.updateDeletedPackageStatus(message);
+ });
+ },
gotoPackageListPage:function(){
window.location.href="./csarPackage.html";
refreshByCond();
@@ -333,7 +338,7 @@ var vm = avalon.define({ });
avalon.scan();
vm.$initUpload();
-
+vm.$initCometd();
$(function(){
vm.$initTable();
});
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 79dd813b..ccd0f11b 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 @@ -29,11 +29,11 @@ pmUtil.changeStatus = function(csarId, status) { });
}
-pmUtil.changeTableStatus = function(name, status) {
+pmUtil.changeTableStatus = function(csarId, status) {
var table = $("#" + vm.$tableId).dataTable();
var tableData = table.fnGetData();
for (var i=0; i<tableData.length; i++) {
- if(tableData[i]["name"] == name) {
+ if(tableData[i]["csarId"] == csarId) {
table.fnUpdate(status, i, 4, false, false);
break;
}
@@ -67,11 +67,12 @@ pmUtil.getExistPackageByName = function(name) { }
pmUtil.updateDeletedPackageStatus = function(message) {
- if(message.status == "true" || message.status == "deletionPending") {
+ var messageobj = JSON.parse(message);
+ if(messageobj.status == "true" || messageobj.status == "deletionPending") {
commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-success"), "success");
refreshByCond();
} else {
- pmUtil.changeTableStatus(message.csarid, "deletefail");
+ pmUtil.changeTableStatus(messageobj.csarid, "deletefail");
}
}
@@ -103,7 +104,9 @@ pmUtil.doOnBoard = function(url,param) { dataType : "json",
success : function(resp) {
if(resp.data.status == "failed") {
- commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-onBoarded"), "failed");
+ commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-onBoard-error"), "failed");
+ } else {
+ commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-onBoarded"), "success");
}
refreshByCond();
},
@@ -122,6 +125,11 @@ pmUtil.doNFAROnboard = function(extData) { contentType : "application/json",
dataType : "json",
success : function(resp) {
+ if(resp.data.status == "failed") {
+ commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-onBoard-error"), "failed");
+ } else {
+ commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-onBoarded"), "success");
+ }
refreshByCond();
},
error : function() {
@@ -136,6 +144,11 @@ pmUtil.doSSAROnboard = function(url) { url : url,
contentType : "application/json",
success : function(resp) {
+ if(resp.data.status == "failed") {
+ commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-onBoard-error"), "failed");
+ } else {
+ commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-onBoarded"), "success");
+ }
refreshByCond();
},
error : function() {
@@ -150,24 +163,18 @@ pmUtil.delPackage = function (url) { url : url,
contentType : "application/json",
success : function(resp) {
- commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-success"), "success");
- setTimeout( function(){
- refreshByCond();
- }, 1 * 1000 );
+ //commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-success"), "success");
+ //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");
- setTimeout( function(){
- refreshByCond();
- }, 1 * 1000 );
+ //commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-success"), "success");
//refreshByCond();
} else {
commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-error"), "failed");
- setTimeout( function(){
- refreshByCond();
- }, 1 * 1000 );
- //refreshByCond();
+ refreshByCond();
}
}
});
|