summaryrefslogtreecommitdiffstats
path: root/openo-portal
diff options
context:
space:
mode:
authorjin xin <j00101220@huawei.com>2016-10-28 01:34:07 +0000
committerGerrit Code Review <gerrit@open-o.org>2016-10-28 01:34:07 +0000
commit493d0e0c2147820188addc9e2746be9785a2b95f (patch)
treef0298d8c5a0e901b62f6d78401b7c6f6d56dacf4 /openo-portal
parent04a10aa5b5a86db5ad7730b33d1fcd5b5b7e8010 (diff)
parent5bfc39f1e6befe01563be95d3e40fd7b5f7e14fe (diff)
Merge "Fix the bug "delete package, package table would not be refreshed"." into sun
Diffstat (limited to 'openo-portal')
-rw-r--r--openo-portal/portal-catalog/src/main/webapp/catalog/csarPackage.html1
-rw-r--r--openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmController.js7
-rw-r--r--openo-portal/portal-catalog/src/main/webapp/catalog/js/package/pmUtil.js41
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();
}
}
});