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