From ee244ee3876121afaf6922b351c6d3c0b4cb425a Mon Sep 17 00:00:00 2001 From: LiZi Date: Tue, 27 Feb 2018 04:30:01 -0500 Subject: Call the API of MultiCloud when register VIM Change-Id: I7ba901c9abb7718cc4d69144c4ea02e1433cec66 Issue-ID: AAI-812 Signed-off-by: LiZi --- .../src/main/webapp/extsys/vim/js/vimController.js | 48 +++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'portal/src/main/webapp/extsys/vim/js') diff --git a/portal/src/main/webapp/extsys/vim/js/vimController.js b/portal/src/main/webapp/extsys/vim/js/vimController.js index b9e6212..33f66e6 100644 --- a/portal/src/main/webapp/extsys/vim/js/vimController.js +++ b/portal/src/main/webapp/extsys/vim/js/vimController.js @@ -45,6 +45,9 @@ var vm = avalon } ] }, + vimTypeObj: [], + vimTypes: [], + vimVersions:[], $Status: { success: "active", failed: "inactive", @@ -57,6 +60,7 @@ var vm = avalon $addVimInfoUrl: '/api/aai-esr-server/v1/vims', $updateVimInfoUrl: '/api/aai-esr-server/v1/vims/{cloudOwner}/{cloudRegionId}', $delVimInfoUrl: '/api/aai-esr-server/v1/vims/{cloudOwner}/{cloudRegionId}', + $queryVimTypeUrl: '/multicloud/v0/vim_types', $initTable: function () { $.ajax({ "type": 'get', @@ -79,7 +83,6 @@ var vm = avalon resUtil.tooltipVimStatus(); } }); - }, $showVimTable: function (index, action) { vm.isSave = false; @@ -93,6 +96,7 @@ var vm = avalon vm.fillElement(vm.vimInfo[index], vm.currentElement); } vm.$showModal(); + vm.getVimTypes(); }, $showModal: function () { $(".form-group").removeClass('has-success').removeClass('has-error').find(".help-block[id]").remove(); @@ -266,6 +270,48 @@ var vm = avalon var vimSave = $.extend(true, {}, vm.currentElement.$model); vimSave["vimAuthInfos"] = $.extend(true, [], vm.currentElement["vimAuthInfos"].$model); return vimSave; + }, + getVimTypes: function(){ + // vm.vimTypeObj = [{ + // "vim_type": "openstack", + // "versions": ["titanium_cloud","ocata"] + // }, + // { + // "vim_type": "vmware", + // "versions": ["4.0"] + // }, + // { + // "vim_type": "test", + // "versions": ["1.0","2.0"] + // }]; + $.ajax({ + "type": 'get', + "url": vm.$queryVimTypeUrl, + "success": function (resp, statusText, jqXHR) { + if (jqXHR.status == "200") { + vm.vimTypeObj = resp; + } + else { + vm.vimTypeObj = []; + bootbox.alert($.i18n.prop("com_zte_ums_eco_roc_vim_growl_msg_query_failed")); + return; + } + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + bootbox.alert($.i18n.prop("com_zte_ums_eco_roc_vim_growl_msg_query_failed") + textStatus + ":" + errorThrown); + return; + }, + complete: function () { + resUtil.tooltipVimStatus(); + } + }); + }, + getVimVerions: function(vim_type){ + for (var i=0;i