diff options
author | Quan-Zhong <quanzhong@huawei.com> | 2016-11-02 18:40:59 +0800 |
---|---|---|
committer | Quan-Zhong <quanzhong@huawei.com> | 2016-11-02 18:40:59 +0800 |
commit | efc5db072006f4b9097d9016994384eb55a1c47a (patch) | |
tree | 3bc78265afa2db85cae00bd15fa472abf8ad6996 /openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/datacenter.js | |
parent | 775c5d44a152d1cd1ef669d10b429a5150296464 (diff) |
FINALFIX
NFVO-39
Change-Id: I799b88f79e8820824321250909166b8fc36c89e0
Signed-off-by: Quan-Zhong <quanzhong@huawei.com>
Diffstat (limited to 'openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/datacenter.js')
-rw-r--r-- | openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/datacenter.js | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/datacenter.js b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/datacenter.js index 3a74ce10..ddaff142 100644 --- a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/datacenter.js +++ b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/datacenter.js @@ -1,6 +1,10 @@ +function trim(str) { + + return str.replace(/(^\s*)|(\s*$)/g,''); +} function hideFirstCol() { -// $('table tr').find('th:eq(0)').hide(); -// $('table tr').find('td:eq(0)').hide(); + $('table tr').find('th:eq(0)').hide(); + $('table tr').find('td:eq(0)').hide(); } function deleteDatacenter(objectId) { @@ -15,6 +19,7 @@ function deleteDatacenter(objectId) { values: [objectId] }); bootbox.alert("Delete successfull !!!"); + hideFirstCol(); }, error: function (xhr, ajaxOptions, thrownError) { bootbox.alert("Error on deleting data: " + xhr.responseText); @@ -44,6 +49,8 @@ function loadDatacenterData() { bootbox.alert("Error on getting site data : " + xhr.responseText); } }); + $('#location_table').bootstrapTable('refresh'); + hideFirstCol(); } function loadNetWorkData() { var requestUrl = app_url+"/openoapi/resmgr/v1/networks"; @@ -120,13 +127,13 @@ function fillCountryData() { function fillVimNameData() { var requestUrl = app_url+"/openoapi/resmgr/v1/datacenters/vims"; - var htmlContent = ""; + var htmlContent = "<option value=''>--select--</option>"; $.ajax({ type: "GET", url: requestUrl, contentType: "application/json", success: function (jsonobj) { - var str = jsonobj.data.replace('[', '').replace(']', '').split(',') + var str = jsonobj.data; $.each(str, function (n, v) { htmlContent += "<option value='" + v.vimId + "'>" + v.name + "</option>"; $("#vimName").html(htmlContent); @@ -207,7 +214,9 @@ $(function () { data: formData, success: function (jsonResp) { loadDatacenterData(); - bootbox.alert(jsonResp.msg); + bootbox.alert(jsonResp.msg,function(){ + window.location.reload(); + }); $('#vmAppDialog').removeClass('in').css({ 'display': 'none' }); @@ -220,8 +229,8 @@ $(function () { $('#country').change(function () { var country = $(this).children('option:selected').val(); - var requestUrl = app_url+"/openoapi/resmgr/v1/locations/locationbycountry?country=" + country; - + country = trim(country); + var requestUrl = app_url+"/openoapi/resmgr/v1/locations/locationbycountry?country="+country; var htmlContent = "<option value=''>--select--</option>"; $.ajax({ type: "GET", @@ -240,6 +249,26 @@ $(function () { }); }) + + $('#vimName').change(function () { + var vimName = $(this).children('option:selected').val(); + vimName = trim(vimName); + var requestUrl = app_url+"/openoapi/resmgr/v1/limits?vimId="+vimName; + $.ajax({ + type: "GET", + url: requestUrl, + contentType: "application/json", + success: function (jsonobj) { + $('#totalCPU').html(jsonobj.totalCPU); + $('#totalMemory').html(jsonobj.totalMemory); + $('#totalDisk').html(jsonobj.totalDisk); + }, + error: function (xhr, ajaxOptions, thrownError) { + bootbox.alert("Error on getting data : " + xhr.responseText); + } + }); + + }) })
\ No newline at end of file |