1 /* Copyright 2016-2017, Huawei Technologies Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 function loadVimData() {
16 var requestUrl = app_url+"/v1/resmanage/vim/vimInfo";
20 contentType: "application/json",
21 success: function (jsonobj) {
22 printCharts(jsonobj.data[0].used.cpu,
23 jsonobj.data[0].total.cpu, jsonobj.data[0].used.memory, jsonobj.data[0].total.memory, jsonobj.data[0].used.disk, jsonobj.data[0].total.disk);
26 error: function (xhr, ajaxOptions, thrownError) {
27 bootbox.alert("Error on getting data (here display the test data) : " + xhr.responseText);
28 printCharts(11, 12, 21, 22, 31, 32);
32 function printCharts(v11, v12, v21, v22, v31, v32) {
33 var cpuChart = new Chart($("#cpuChart"), {
36 labels: ["used", "available"],
39 backgroundColor: ["#FFCE56", "#36A2EB"],
40 hoverBackgroundColor: ["#FFCE56", "#36A2EB"]
51 var memoryChart = new Chart($("#memoryChart"), {
54 labels: ["used", "available"],
57 backgroundColor: ["#FF6384", "#36A2EB"],
58 hoverBackgroundColor: ["#FF6384", "#36A2EB"]
70 var diskChart = new Chart($("#diskChart"), {
73 labels: ["used", "available"],
76 backgroundColor: ["#FF6384", "green"],
77 hoverBackgroundColor: ["#FF6384", "green"]