From 78f561032a62cf21ef43615aa4ba3ccbdd5fc596 Mon Sep 17 00:00:00 2001 From: 覃亮10184303 Date: Fri, 22 Sep 2017 17:11:13 +0800 Subject: Integrate esr-gui with server for vnfm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue-ID: AAI-348 Change-Id: If9685418a38d2b8b2b3dfee6ebbcda369b00edc7 Signed-off-by: 覃亮10184303 --- .../ems/i18n/nfv-nso-iui-i18n-en-US.properties | 2 + .../src/main/webapp/extsys/ems/js/emsController.js | 4 +- .../extsys/sdncontroller/js/sdncController.js | 2 +- .../src/main/webapp/extsys/vnfm/js/commonUtil.js | 2 +- .../main/webapp/extsys/vnfm/js/loadi18n_nsoc.js | 2 +- .../main/webapp/extsys/vnfm/js/vnfmController.js | 364 ++++++++------------- portal/src/main/webapp/extsys/vnfm/vnfmView.html | 91 ++---- 7 files changed, 179 insertions(+), 288 deletions(-) diff --git a/portal/src/main/webapp/extsys/ems/i18n/nfv-nso-iui-i18n-en-US.properties b/portal/src/main/webapp/extsys/ems/i18n/nfv-nso-iui-i18n-en-US.properties index f39749a..150a125 100644 --- a/portal/src/main/webapp/extsys/ems/i18n/nfv-nso-iui-i18n-en-US.properties +++ b/portal/src/main/webapp/extsys/ems/i18n/nfv-nso-iui-i18n-en-US.properties @@ -53,3 +53,5 @@ nfv-ems-iui-validate-ems=Please select a EMS nfv-ems-iui-validate-url-required=Please enter the URL nfv-ems-iui-validate-url=Please enter the right URL nfv-ems-iui-text-url-tip=Example: http://10.0.0.1 + + diff --git a/portal/src/main/webapp/extsys/ems/js/emsController.js b/portal/src/main/webapp/extsys/ems/js/emsController.js index 107131d..fea1820 100644 --- a/portal/src/main/webapp/extsys/ems/js/emsController.js +++ b/portal/src/main/webapp/extsys/ems/js/emsController.js @@ -282,7 +282,7 @@ var vm = avalon.define({ data: JSON.stringify(currentElement), dataType: "json", contentType: "application/json", - success: function (data) { + success: function (data, statusText, jqXHR) { vm.server_rtn.info_block = false; vm.server_rtn.warning_block = false; if (data) { @@ -340,7 +340,7 @@ var vm = avalon.define({ emsSave.performanceAddr = vm.currentElement.performanceAddr.$model; return emsSave; } - }); +}); vm.currentElement = $.extend(true, {}, vm.$newElement); avalon.scan(); vm.$initTable(); \ No newline at end of file diff --git a/portal/src/main/webapp/extsys/sdncontroller/js/sdncController.js b/portal/src/main/webapp/extsys/sdncontroller/js/sdncController.js index 6c147ad..6bfc5a9 100644 --- a/portal/src/main/webapp/extsys/sdncontroller/js/sdncController.js +++ b/portal/src/main/webapp/extsys/sdncontroller/js/sdncController.js @@ -124,7 +124,7 @@ var vm = avalon.define({ updateSDNC: function (index) { vm.saveType = "update"; vm.currentIndex = index; - vm.fillElement(vm.sdncList[vm.currentIndex], vm.currentElement) + vm.fillElement(vm.sdncList[vm.currentIndex], vm.currentElement); vm.$showTable(); }, validate: function () { diff --git a/portal/src/main/webapp/extsys/vnfm/js/commonUtil.js b/portal/src/main/webapp/extsys/vnfm/js/commonUtil.js index 44a72f3..081fef1 100644 --- a/portal/src/main/webapp/extsys/vnfm/js/commonUtil.js +++ b/portal/src/main/webapp/extsys/vnfm/js/commonUtil.js @@ -53,7 +53,7 @@ commonUtil.parseDate = function (dateObj, format) { commonUtil.showMessage = function (message, type) { $.growl({ icon: "fa fa-envelope-o fa-lg", - title: "  " + $.i18n.prop("nfv-nso-iui-common-tip"), + title: "  Tips: ", message: message }, { type: type diff --git a/portal/src/main/webapp/extsys/vnfm/js/loadi18n_nsoc.js b/portal/src/main/webapp/extsys/vnfm/js/loadi18n_nsoc.js index a543a20..45224af 100644 --- a/portal/src/main/webapp/extsys/vnfm/js/loadi18n_nsoc.js +++ b/portal/src/main/webapp/extsys/vnfm/js/loadi18n_nsoc.js @@ -23,7 +23,7 @@ function loadPropertiesSideMenu(lang, fileNamePrefix, filePath) { var i18nItems = $("[name_i18n=com_zte_nfv_nsoc_i18n]"); for (var i = 0; i < i18nItems.length; i++) { var $item = $(i18nItems.eq(i)); - var itemId = $item.attr("id"); + var itemId = $item.attr("id_i18n"); var itemTitle = $item.attr("title"); if (typeof(itemTitle) != "undefined") { $item.attr("title", $.i18n.prop(itemId)); diff --git a/portal/src/main/webapp/extsys/vnfm/js/vnfmController.js b/portal/src/main/webapp/extsys/vnfm/js/vnfmController.js index 1df32b1..6f1c52e 100644 --- a/portal/src/main/webapp/extsys/vnfm/js/vnfmController.js +++ b/portal/src/main/webapp/extsys/vnfm/js/vnfmController.js @@ -14,12 +14,27 @@ * limitations under the License. */ -var vm = avalon - .define({ +var vm = avalon.define({ $id: "vnfmController", vnfmInfo: [], - //mocSelectItems : [], - vimSelectItems: [], + currentElement: {}, + currentIndex: 0, + saveType: "add", + $vnfmList: [], + $newElement: { + "vnfmId": "", + "name": "", + "type": "Tacker", + "vimId": "", + "vendor": "ZTE", + "version": "v1.0", + "certificateUrl": "", + "url": "http://", + "userName": "", + "password": "" + }, + saveType: "add", + modalTitle: $.i18n.prop("nfv-ems-iui-text-register"), server_rtn: { info_block: false, warning_block: false, @@ -32,12 +47,10 @@ var vm = avalon failed: "inactive" }, $restUrl: { - queryVnfmInfoUrl: '/onapapi/aai/esr/v1/vnfms', - addVnfmInfoUrl: '/onapapi/aai/esr/v1/vnfms', - updateVnfmInfoUrl: '/onapapi/aai/esr/v1/vnfms/', - delVnfmInfoUrl: '/onapapi/aai/esr/v1/vnfms/', - queryMocUrl: '', - queryVimUrl: '/onapapi/aai/esr/v1/vims' + queryVnfmInfoUrl: '/api/aai-esr-server/v1/vnfms', + addVnfmInfoUrl: '/api/aai-esr-server/v1/vnfms', + updateVnfmInfoUrl: '/api/aai-esr-server/v1/vnfms/{vnfmId}', + delVnfmInfoUrl: '/api/aai-esr-server/v1/vnfms/{vnfmId}' }, $htmlText: { saveSuccess: $.i18n.prop("nfv-vnfm-iui-message-save-success"), @@ -50,12 +63,14 @@ var vm = avalon $.ajax({ "type": 'GET', "url": vm.$restUrl.queryVnfmInfoUrl, - //"dataType": "json", - "success": function (resp) { - for (var i = 0; i < resp.length; i++) { - resp[i].status = vm.$Status.success; + "dataType": "json", + "success": function (resp, statusText, jqXHR) { + if(jqXHR.status == 200){ + vm.vnfmInfo = resp; + vm.$vnfmList = $.extend(true, [], resp) ; + } else { + bootbox.alert($.i18n.prop("nfv-vnfm-iui-message-query-fail") + ":" + textStatus + ":" + errorThrown); } - vm.vnfmInfo = resp; }, error: function (XMLHttpRequest, textStatus, errorThrown) { bootbox.alert($.i18n.prop("nfv-vnfm-iui-message-query-fail") + ":" + textStatus + ":" + errorThrown); @@ -66,77 +81,7 @@ var vm = avalon } }); }, - // $initMoc : function() { - // /*var url = vm.$restUrl.queryMocUrl; - // commonUtil.get(url, null, function(resp) { - // if (resp) { - // vm.addVnfm.moc = resp.data; - // } - // });*/ - // var resp = [ - // { id : "nfv.vnfm.eco", name : "VNFM(ECO)"}, - // { id : "nfv.vnfm.tacker", name : "VNFM(Tacker)"}, - // { id : "nfv.vnfm.cmcc", name : "VNFM(CMCC)"}, - // { id : "nfv.vnfm.etsi", name : "VNFM(ETSI)"} - // ] - // vm.mocSelectItems = resp; - // }, - $initVim: function () { - $.ajax({ - type: 'get', - url: vm.$restUrl.queryVimUrl, - dataType: 'json', - success: function (resp) { - if (resp) { - vm.vimSelectItems = resp; - } - vm.vimSelectItems.push({"vimId": "", "name": ""}); - } - }); - }, - addVnfm: { - title: $.i18n.prop("nfv-vnfm-iui-text-register"), - vnfmId: "", - name: "", - type: "", - //moc : "", - nameReadonly : false, - vimId: "", - //vimVisiable : false, - vendor: "", - version: "", - description: "", - certificateUrl: "", - url: "", - urlTip: $.i18n.prop("nfv-vnfm-iui-text-url-tip"), - userName: "", - password: "", - saveType: "add", - status: "" - }, $showVnfmTable: function () { - vm.addVnfm.title = $.i18n.prop("nfv-vnfm-iui-text-register"), - vm.addVnfm.vnfmId = ""; - vm.addVnfm.name = ""; - vm.addVnfm.type = ""; - //vm.addVnfm.moc = ""; - vm.addVnfm.nameReadonly = false; - vm.addVnfm.vimId = ""; - //vm.addVnfm.vimVisiable = false; - vm.addVnfm.vendor = ""; - vm.addVnfm.version = ""; - vm.addVnfm.description = ""; - vm.addVnfm.certificateUrl = ""; - vm.addVnfm.url = ""; - vm.addVnfm.userName = ""; - vm.addVnfm.password = ""; - vm.addVnfm.saveType = "add"; - vm.server_rtn.warning_block = false; - vm.server_rtn.info_block = false; - //vm.$initMoc(); - vm.$initVim(); - //vm.$mocChange(); - $(".form-group").each(function () { $(this).removeClass('has-success'); $(this).removeClass('has-error'); @@ -144,159 +89,128 @@ var vm = avalon }); $("#addVnfmDlg").modal("show"); }, - // $getMocName : function(mocId) { - // var items = vm.mocSelectItems; - // for(var i=0;i - @@ -36,57 +35,52 @@
-
-
-
+
+ id_i18n="nfv-vnfm-iui-text-status-normal" name_i18n="com_zte_nfv_nsoc_i18n">
@@ -192,16 +167,16 @@

-
URL:
@@ -210,9 +185,11 @@
- - + + + + +
@@ -224,8 +201,6 @@ - - -- cgit 1.2.3-korg