diff options
author | 2016-10-20 15:20:25 +0800 | |
---|---|---|
committer | 2016-10-20 15:20:25 +0800 | |
commit | 49a7265d18d85e66401b0925ed19768031817fef (patch) | |
tree | 4b71a954f34c05cb8e923056596a88006c58aa47 /openo-portal/portal-catalog/src | |
parent | ae3a13b740237fbb72fd3a971726936ccd4e785e (diff) |
Fix onboard and delete package url, onboard SSAR package calls catalog API.
Change-Id: Id6024a0a39b716931d0c8ad91d87920625289592
Issue-id:GSO-28 GSO-29
Signed-off-by: nancylizi <li.zi30@zte.com.cn>
Diffstat (limited to 'openo-portal/portal-catalog/src')
5 files changed, 83 insertions, 93 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 c1611414..ecc0b869 100644 --- a/openo-portal/portal-catalog/src/main/webapp/catalog/csarPackage.html +++ b/openo-portal/portal-catalog/src/main/webapp/catalog/csarPackage.html @@ -103,7 +103,7 @@ <td ms-text="res.operationalState"></td>
<td>
<span class="label label-info status" data-toggle="tooltip" title="nfv-package-iui-status-tip"
- ms-click="vm.onBoardPackage(res.csarId,res.type)">
+ ms-click="vm.onBoardPackage(res.csarId,res.type,res.onBoardState)">
{{res.onBoardState}}
</span>
</td>
@@ -117,6 +117,26 @@ </tbody>
</table>
</div>
+ <div class="row-fluid">
+ <div class="col-md-12" style="padding-left:0px;">
+ <div class="pull-left">
+ <small><label>
+ View
+ <select size="1" name="ict_template_table_length" aria-controls="ict_template_table">
+ <option value="10" selected="selected">10</option>
+ <option value="25">25</option>
+ <option value="50">50</option>
+ <option value="100">100</option>
+ </select>
+ records
+ </label>
+ <span id="com_zte_openo_umc_monitor_monitorList_total" name_i18n="com_zte_openo_umc_monitor_ui_i18n">Found total</span>
+ <span ms-text="vm.resource.packageInfo.size()"></span>
+ <span id="com_zte_openo_umc_monitor_monitorList_records" name_i18n="com_zte_openo_umc_monitor_ui_i18n">records</span>
+ </small>
+ </div>
+ </div>
+ </div>
<div id="right-menu" ms-css-display="packageDetail.isShow">
<div>
<div class="title">
diff --git a/openo-portal/portal-catalog/src/main/webapp/catalog/i18n/nfv-nso-iui-i18n-en-US.properties b/openo-portal/portal-catalog/src/main/webapp/catalog/i18n/nfv-nso-iui-i18n-en-US.properties index 3b2cf39a..5b34be2a 100644 --- a/openo-portal/portal-catalog/src/main/webapp/catalog/i18n/nfv-nso-iui-i18n-en-US.properties +++ b/openo-portal/portal-catalog/src/main/webapp/catalog/i18n/nfv-nso-iui-i18n-en-US.properties @@ -84,6 +84,7 @@ nfv-package-iui-message-upload-csar-exist=There is a package in the same name, t nfv-package-iui-message-upload-csar-deletionpending=This package is referenced in an instance. whether to re upload?
nfv-package-iui-message-onBoarded = Already onBoarded, no need for onBoarding.
nfv-package-iui-message-onBoard-error = Onboarding error.
+nfv-package-iui-message-delete-error = Package delete error.
nfv-package-iui-message-select-vim-error = Can not select more than one VIM to be test environment.
nfv-package-iui-onboard-dialog-vimname = VIM Name
nfv-package-iui-product-env = Product Environment
@@ -147,3 +148,6 @@ nfv-topology-iui-message-error=Query Topology Information failed. nfv-software-iui-action-delete=Delete
nfv-software-iui-action-onboard=Onboard
+
+com_zte_openo_umc_monitor_monitorList_total=total
+com_zte_openo_umc_monitor_monitorList_records=records
\ No newline at end of file diff --git a/openo-portal/portal-catalog/src/main/webapp/catalog/i18n/nfv-nso-iui-i18n-zh-CN.properties b/openo-portal/portal-catalog/src/main/webapp/catalog/i18n/nfv-nso-iui-i18n-zh-CN.properties index c7383af9..1dce1392 100644 --- a/openo-portal/portal-catalog/src/main/webapp/catalog/i18n/nfv-nso-iui-i18n-zh-CN.properties +++ b/openo-portal/portal-catalog/src/main/webapp/catalog/i18n/nfv-nso-iui-i18n-zh-CN.properties @@ -85,6 +85,7 @@ nfv-package-iui-message-upload-csar-exist=存在同名包,是否继续上传 nfv-package-iui-message-upload-csar-deletionpending=实例中引用了此包,是否重新上传?
nfv-package-iui-message-onBoarded = 已经上载,无需再次上载。
nfv-package-iui-message-onBoard-error = 上载失败。
+nfv-package-iui-message-delete-error = 包删除失败。
nfv-package-iui-message-select-vim-error = 最多只能选择一个VIM做为测试环境
nfv-package-iui-onboard-dialog-vimname = VIM名称
nfv-package-iui-product-env = 生产环境
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 3170242b..72d83dfb 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 @@ -21,16 +21,16 @@ var vm = avalon.define({ 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", 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}
+ // ]
+ //},
$language: {
"sProcessing": "<img src='../common/thirdparty/data-tables/images/loading-spinner-grey.gif'/><span> "
+$.i18n.prop("nfv-nso-iui-table-sProcess")+"</span>",
@@ -51,14 +51,14 @@ var vm = avalon.define({ $restUrl:{
queryPackageInfoUrl: "/openoapi/catalog/v1/csars",
uploadPackageUrl: "/openoapi/catalog/v1/csars",
- gsarDelPackageUrl: "/openoapi/gsolcm/v1.0/nspackage",
+ gsarDelPackageUrl: "/openoapi/gso/v1/nspackages",
ssarDelPackageUrl: "/openoapi/catalog/v1/csars",
- nsarDelPackageUrl: "/openoapi/nslcm/v1.0/nspackage",
- nfarDelPackageUrl: "/openoapi/nslcm/v1.0/vnfpackage",
- gsarOnboardUrl: "/openoapi/gsolcm/v1.0/nspackage",
- ssarOnboardUrl: "/openoapi/nslcm/v1.0/nspackage",
- nsarOnboardUrl: "/openoapi/nslcm/v1.0/nspackage",
- nfarOnboardUrl: "/openoapi/nslcm/v1.0/vnfpackage",
+ nsarDelPackageUrl: "/openoapi/nslcm/v1/nspackage",
+ nfarDelPackageUrl: "/openoapi/nslcm/v1/vnfpackage",
+ gsarOnboardUrl: "/openoapi/gso/v1/nspackages",
+ ssarOnboardUrl: "/openoapi/catalog/v1/csars",
+ nsarOnboardUrl: "/openoapi/nslcm/v1/nspackage",
+ nfarOnboardUrl: "/openoapi/nslcm/v1/vnfpackage",
changePackageStatusUrl : "/openoapi/catalog/v1/csars",
queryVimInfoUrl : "/openoapi/extsys/v1/vims"
},
@@ -130,11 +130,6 @@ var vm = avalon.define({ labVimId : "",
},
$initData : function(csarId) {
- //vm.resource.vimSelectItems = [
- // {vimName:"test1", oid:"123456"},
- // {vimName:"test2", oid:"987654"},
- // {vimName:"test3", oid:"123qwe"}
- //];
var url=vm.$restUrl.queryVimInfoUrl;
commonUtil.get(url,null,function(resp) {
if (resp) {
@@ -189,28 +184,14 @@ var vm = avalon.define({ if(result) {
if(type == "NSAR") {
url = vm.$restUrl.nsarDelPackageUrl + "/" + csarId;
- //commonUtil.delete(url, function(resp) {
- // vm.gotoPackageListPage();
- //});
} else if(type == "NFAR") {
url = vm.$restUrl.nfarDelPackageUrl + "/" + csarId;
- //commonUtil.delete(url, function(resp) {
- // vm.gotoPackageListPage();
- //});
} else if(type == "GSAR") {
url = vm.$restUrl.gsarDelPackageUrl + "/" + csarId;
- //commonUtil.delete(url, function(resp) {
- // vm.gotoPackageListPage();
- //});
} else if(type == "SSAR") {
url = vm.$restUrl.ssarDelPackageUrl + "/" + csarId;
- //commonUtil.delete(url, function(resp) {
- // vm.gotoPackageListPage();
- //});
}
- commonUtil.delete(url, function(resp) {
- vm.gotoPackageListPage();
- });
+ pmUtil.delPackage(url);
}
});
},
@@ -226,26 +207,28 @@ var vm = avalon.define({ return false;
},
- onBoardPackage : function(csarId,type) {
+ onBoardPackage : function(csarId,type,onBoardState) {
var param = {
csarId : csarId
};
if(type == "NSAR") {
- //vm.csarIdSelected = csarId;
- //vm.showOnboardDialog(csarId);
var url = vm.$restUrl.nsarOnboardUrl;
pmUtil.doOnBoard(url, param);
} else if(type == "NFAR") {
- //var url = vm.$restUrl.nfarOnboardUrl;
- //pmUtil.doOnBoard(url, param);
vm.csarIdSelected = csarId;
vm.showOnboardDialog(csarId);
} else if(type == "GSAR") {
var url = vm.$restUrl.gsarOnboardUrl;
pmUtil.doOnBoard(url, param);
} else if(type == "SSAR") {
- var url = vm.$restUrl.ssarOnboardUrl;
- pmUtil.doOnBoard(url, param);
+ var ssarTarOnbardState="";
+ if(onBoardState =="onBoarded") {
+ ssarTarOnbardState = "non-onBoarded";
+ } else {
+ ssarTarOnbardState = "onBoarded";
+ }
+ var url = vm.$restUrl.ssarOnboardUrl+"/"+csarId+"?onBoardState="+ssarTarOnbardState
+ pmUtil.doSSAROnboard(url);
}
},
showOnboardDialog : function(csarId) {
@@ -321,6 +304,7 @@ var vm = avalon.define({ },
gotoPackageListPage:function(){
window.location.href="./csarPackage.html";
+ refreshByCond();
}
});
avalon.scan();
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 9b8d10e3..b7b5bbfa 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 @@ -40,54 +40,6 @@ pmUtil.changeTableStatus = function(name, status) { }
}
-pmUtil.isRowDeletingStatus = function(name) {
- var table = $("#" + vm.$tableId).dataTable();
- var tableData = table.fnGetData();
- for (var i=0; i<tableData.length; i++) {
- if(tableData[i]["name"] == name &&
- tableData[i]["status"].indexOf($.i18n.prop("nfv-package-iui-status-deleting")) > -1) {
- return true;
- }
- }
- return false;
-}
-
-pmUtil.delPackage = function(csarId) {
- if(pmUtil.isRowDeletingStatus(csarId)){
- return;
- }
- bootbox.confirm($.i18n.prop("nfv-package-iui-message-delete-confirm"), function(result){
- if(result) {
- pmUtil.changeTableStatus(csarId, "deleting");
- var url = vm.$restUrl.delPackageUrl + csarId;
- commonUtil.delete(url, function(resp) {
-
- });
- }
- });
-}
-
-pmUtil.isRowOnBoardingStatus = function(name) {
- var table = $("#" + vm.$tableId).dataTable();
- var tableData = table.fnGetData();
- for (var i=0; i<tableData.length; i++) {
- if(tableData[i]["name"] == name &&
- tableData[i]["status"].indexOf($.i18n.prop("nfv-package-iui-status-onboarding")) > -1) {
- return true;
- }
- }
- return false;
-}
-
-pmUtil.onBoardPackage = function(name) {
- if(pmUtil.isRowOnBoardingStatus(name)){
- return;
- }
- pmUtil.changeTableStatus(name, "onboarding");
- var url = vm.$restUrl.delPackageUrl + "?csarName=" + name;
- commonUtil.delete(url, function(resp) {
- });
-}
//query packages exist
//0: the package does not exist
//1: the package does not exist, but the instance cite this package
@@ -177,3 +129,32 @@ pmUtil.doNFAROnboard = function(extData) { }
});
}
+
+pmUtil.doSSAROnboard = function(url) {
+ $.ajax({
+ type : "PUT",
+ url : url,
+ contentType : "application/json",
+ success : function(resp) {
+ refreshByCond();
+ },
+ error : function() {
+ commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-onBoard-error"), "failed");
+ }
+ });
+}
+
+pmUtil.delPackage = function (url) {
+ $.ajax({
+ type : "DELETE",
+ url : url,
+ contentType : "application/json",
+ success : function(resp) {
+ refreshByCond();
+ },
+ error : function() {
+ refreshByCond();
+ //commonUtil.showMessage($.i18n.prop("nfv-package-iui-message-delete-error"), "failed");
+ }
+ });
+}
|