summaryrefslogtreecommitdiffstats
path: root/openo-portal/portal-resmgr/src
diff options
context:
space:
mode:
authorQuan-Zhong <quanzhong@huawei.com>2016-11-02 18:40:59 +0800
committerQuan-Zhong <quanzhong@huawei.com>2016-11-02 18:40:59 +0800
commitefc5db072006f4b9097d9016994384eb55a1c47a (patch)
tree3bc78265afa2db85cae00bd15fa472abf8ad6996 /openo-portal/portal-resmgr/src
parent775c5d44a152d1cd1ef669d10b429a5150296464 (diff)
FINALFIX
NFVO-39 Change-Id: I799b88f79e8820824321250909166b8fc36c89e0 Signed-off-by: Quan-Zhong <quanzhong@huawei.com>
Diffstat (limited to 'openo-portal/portal-resmgr/src')
-rw-r--r--openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/conf/globalconfig.json2
-rw-r--r--openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/datacenter.html6
-rw-r--r--openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/datacenter.js43
-rw-r--r--openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/resmgr.js13
-rw-r--r--openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/vim.js8
5 files changed, 53 insertions, 19 deletions
diff --git a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/conf/globalconfig.json b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/conf/globalconfig.json
index 9df8207a..d47abbdb 100644
--- a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/conf/globalconfig.json
+++ b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/conf/globalconfig.json
@@ -1,3 +1,3 @@
{
- "url": "http://127.0.0.1:8080/resmgr"
+ "url": ""
} \ No newline at end of file
diff --git a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/datacenter.html b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/datacenter.html
index f0ae9679..ac0e7c76 100644
--- a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/datacenter.html
+++ b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/datacenter.html
@@ -311,9 +311,9 @@
<div class="form-group">
<label class="col-sm-3 control-label">
<span>Avaliable Res:</span>
- CPU(Cores):<br>
- Memory:<br>
- HardDisk:
+ CPU(Cores):<span id="totalCPU"></span><br>
+ Memory:<span id="totalMemory"></span><br>
+ HardDisk:<span id="totalDisk"></span>
</label>
<div class="col-sm-7">
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
diff --git a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/resmgr.js b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/resmgr.js
index 5a6e66cb..d499370e 100644
--- a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/resmgr.js
+++ b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/resmgr.js
@@ -1,6 +1,7 @@
function hideFirstCol() {
-// $('table tr').find('th:eq(0)').hide();
-// $('table tr').find('td:eq(0)').hide();
+ $('#location_table').bootstrapTable('refresh');
+ $('table tr').find('th:eq(0)').hide();
+ $('table tr').find('td:eq(0)').hide();
}
function deleteLocation(objectId) {
var requestUrl = app_url+"/openoapi/resmgr/v1/locations/" + objectId;
@@ -14,11 +15,13 @@ function deleteLocation(objectId) {
values: [objectId]
});
bootbox.alert("Delete successfull !!!");
+ hideFirstCol()();
},
error: function (xhr, ajaxOptions, thrownError) {
bootbox.alert("Error on deleting data: " + xhr.responseText);
}
});
+
}
function editLocation(row) {
@@ -45,7 +48,7 @@ function loadLocationData() {
striped: true,
data: jsonobj.locations
});
- $('#location_table').bootstrapTable('refresh');
+ hideFirstCol();
},
error: function (xhr, ajaxOptions, thrownError) {
@@ -159,7 +162,9 @@ $(function () {
data: formData,
success: function (jsonResp) {
loadLocationData();
- bootbox.alert(jsonResp.msg);
+ bootbox.alert(jsonResp.msg,function(){
+ window.location.reload();
+ });
$('#vmAppDialog').removeClass('in').css({
'display': 'none'
});
diff --git a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/vim.js b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/vim.js
index bf55aaee..24ac3af1 100644
--- a/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/vim.js
+++ b/openo-portal/portal-resmgr/src/main/webapp/resmgr-nfv/js/vim.js
@@ -66,8 +66,8 @@ function printCharts(v11, v12, v21, v22, v31, v32,dc_id) {
labels: ["used", "available"],
datasets: [{
data: [v21, v22-v21],
- backgroundColor: ["#FF6384", "#36A2EB"],
- hoverBackgroundColor: ["#FF6384", "#36A2EB"]
+ backgroundColor: ["#FFCE56", "#36A2EB"],
+ hoverBackgroundColor: ["#FFCE56", "#36A2EB"]
}]
},
options: {
@@ -85,8 +85,8 @@ function printCharts(v11, v12, v21, v22, v31, v32,dc_id) {
labels: ["used", "available"],
datasets: [{
data: [v31, v32-v31],
- backgroundColor: ["#FF6384", "green"],
- hoverBackgroundColor: ["#FF6384", "green"]
+ backgroundColor: ["#FFCE56", "#36A2EB"],
+ hoverBackgroundColor: ["#FFCE56", "#36A2EB"]
}]
},
options: {