summaryrefslogtreecommitdiffstats
path: root/portal/src/main
diff options
context:
space:
mode:
authorLiZi <li.zi30@zte.com.cn>2018-02-27 04:30:01 -0500
committerLiZi <li.zi30@zte.com.cn>2018-02-27 04:30:27 -0500
commitee244ee3876121afaf6922b351c6d3c0b4cb425a (patch)
treecefce7491e0a24e5bc0578c40ed91d36afd65d63 /portal/src/main
parentb4c1ca64cd0b7635cb762c6431765cba168ae149 (diff)
Call the API of MultiCloud when register VIM
Change-Id: I7ba901c9abb7718cc4d69144c4ea02e1433cec66 Issue-ID: AAI-812 Signed-off-by: LiZi <li.zi30@zte.com.cn>
Diffstat (limited to 'portal/src/main')
-rw-r--r--portal/src/main/webapp/extsys/vim/js/vimController.js48
-rw-r--r--portal/src/main/webapp/extsys/vim/vimView.html16
2 files changed, 51 insertions, 13 deletions
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<vm.vimTypeObj.length;i++) {
+ if(vim_type == vm.vimTypeObj[i]["vim_type"]) {
+ vm.vimVersions = vm.vimTypeObj[i]["versions"];
+ }
+ }
}
});
vm.currentElement = $.extend(true, {}, vm.$blankElement);
diff --git a/portal/src/main/webapp/extsys/vim/vimView.html b/portal/src/main/webapp/extsys/vim/vimView.html
index b0cb326..8e0e06d 100644
--- a/portal/src/main/webapp/extsys/vim/vimView.html
+++ b/portal/src/main/webapp/extsys/vim/vimView.html
@@ -76,9 +76,8 @@
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <select ms-duplex="currentElement['cloudType']">
- <option value='openstack'>openstack</option>
- <option value='vmware'>vmware</option>
+ <select ms-duplex="currentElement['cloudType']" ms-change="getVimVerions(this.value)" >
+ <option ms-repeat="vimTypeObj" ms-attr-value="el.vim_type">{{el.vim_type}}</option>
</select>
<span class="help-block"></span>
</div>
@@ -88,16 +87,9 @@
<span>Cloud Region Version</span>
<span class="required" aria-required="true">*</span>
</label>
- <div class="col-sm-7" ms-if="'openstack' == currentElement.cloudType">
- <select ms-duplex="currentElement['cloudRegionVersion']">
- <option value='titanium_cloud'>titanium_cloud</option>
- <option value='ocata'>ocata</option>
- </select>
- <span class="help-block"></span>
- </div>
- <div class="col-sm-7" ms-if="'vmware' == currentElement.cloudType">
+ <div class="col-sm-7">
<select ms-duplex="currentElement['cloudRegionVersion']">
- <option value='4.0'>4.0</option>
+ <option ms-repeat="vimVersions">{{el}}</option>
</select>
<span class="help-block"></span>
</div>