From c239757866c940fb050d2554624e251eb5aa024d Mon Sep 17 00:00:00 2001 From: chi zhang Date: Wed, 8 Oct 2014 15:45:00 -0700 Subject: [PATCH] connect the multi-select to the graph Change-Id: If5cd97400530eb45d67c65df1cba3a884d9c6ec4 --- v2/assets/css/shelf.css | 7 + v2/src/app/appDev.js | 378 +++++++++++---------- v2/src/app/monitoring/metrics.tpl.html | 11 +- v2/src/app/monitoring/monitoring.js | 36 +- v2/src/app/monitoring/multiSelect.tpl.html | 6 +- 5 files changed, 237 insertions(+), 201 deletions(-) diff --git a/v2/assets/css/shelf.css b/v2/assets/css/shelf.css index 5c8dcd3..c519149 100644 --- a/v2/assets/css/shelf.css +++ b/v2/assets/css/shelf.css @@ -240,3 +240,10 @@ address, caption, cite, code, dfn, em, strong, th, var { height: 205px; } } +.chosen-container-multi .chosen-choices{ + border-radius: 5px; +} +.chosen-container-active .chosen-choices{ + border: 1px solid orange; + border-radius: 5px; +} diff --git a/v2/src/app/appDev.js b/v2/src/app/appDev.js index eb31680..3cc1655 100644 --- a/v2/src/app/appDev.js +++ b/v2/src/app/appDev.js @@ -1578,189 +1578,201 @@ compassAppDev.run(function($httpBackend, settings, $http) { $httpBackend.whenGET(/\.*\/monit.*clusters\/([0-9]|[1-9][0-9])\/metrics\/.*/).respond(function(method, url, data) { console.log(method, url, data); - var metricData = [{ - "key": "Series 1", - "values": [ - [1136005200000, 1271000.0], - [1138683600000, 1271000.0], - [1141102800000, 1271000.0], - [1159588800000, 3899486.0], - [1162270800000, 3899486.0], - [1164862800000, 3899486.0], - [1167541200000, 3564700.0], - [1170219600000, 3564700.0], - [1172638800000, 3564700.0], - [1191124800000, 2906501.0], - [1193803200000, 2906501.0], - [1196398800000, 2906501.0], - [1199077200000, 2206761.0], - [1201755600000, 2206761.0], - [1204261200000, 2206761.0], - [1206936000000, 2287726.0], - [1209528000000, 2287726.0], - [1212206400000, 2287726.0], - [1214798400000, 2732646.0], - [1217476800000, 2732646.0], - [1225425600000, 2599196.0], - [1228021200000, 2599196.0], - [1230699600000, 1924387.0], - [1233378000000, 1924387.0], - [1235797200000, 1924387.0], - [1249012800000, 1743470.0], - [1251691200000, 1743470.0], - [1254283200000, 1519010.0], - [1256961600000, 1087726.0], - [1264914000000, 2087726.0], - [1267333200000, 2287726.0], - [1270008000000, 2287726.0], - [1272600000000, 2287726.0], - [1275278400000, 2287726.0], - [1277870400000, 1309915.0], - [1280548800000, 1309915.0], - [1283227200000, 1309915.0], - [1285819200000, 1331875.0], - [1288497600000, 1331875.0], - [1291093200000, 1331875.0], - [1293771600000, 1331875.0], - [1314763200000, 1244525.0], - [1317355200000, 475000.0], - [1320033600000, 475000.0], - [1322629200000, 475000.0], - [1325307600000, 690033.0], - [1327986000000, 690033.0], - [1330491600000, 690033.0], - [1333166400000, 514733.0], - [1335758400000, 514733.0] - ] - }, { - "key": "Series 2", - "values": [ - [1136005200000, 1271000.0], - [1138683600000, 1271000.0], - [1141102800000, 1271000.0], - [1159588800000, 3899486.0], - [1162270800000, 3899486.0], - [1164862800000, 3899486.0], - [1167541200000, 2287726.0], - [1170219600000, 2287726.0], - [1172638800000, 3564700.0], - [1175313600000, 2648493.0], - [1177905600000, 2648493.0], - [1180584000000, 2648493.0], - [1183176000000, 2522993.0], - [1185854400000, 2522993.0], - [1188532800000, 2522993.0], - [1191124800000, 2906501.0], - [1193803200000, 2906501.0], - [1196398800000, 2906501.0], - [1199077200000, 2206761.0], - [1201755600000, 2206761.0], - [1204261200000, 2206761.0], - [1206936000000, 2287726.0], - [1209528000000, 2287726.0], - [1212206400000, 2287726.0], - [1214798400000, 2732646.0], - [1217476800000, 2732646.0], - [1220155200000, 2732646.0], - [1222747200000, 2599196.0], - [1225425600000, 2599196.0], - [1228021200000, 2599196.0], - [1230699600000, 1924387.0], - [1233378000000, 1924387.0], - [1235797200000, 1924387.0], - [1238472000000, 1756311.0], - [1241064000000, 1756311.0], - ] - }, { - "key": "Series 3", - "values": [ - [1136005200000, 1271000.0], - [1138683600000, 1271000.0], - [1141102800000, 1271000.0], - [1159588800000, 3899486.0], - [1177905600000, 2648493.0], - [1180584000000, 2648493.0], - [1183176000000, 2522993.0], - [1185854400000, 2522993.0], - [1188532800000, 2522993.0], - [1191124800000, 2906501.0], - [1193803200000, 2906501.0], - [1196398800000, 2906501.0], - [1199077200000, 2206761.0], - [1201755600000, 2206761.0], - [1204261200000, 2206761.0], - [1206936000000, 2287726.0], - [1209528000000, 2287726.0], - [1212206400000, 2287726.0], - [1214798400000, 2732646.0], - [1217476800000, 2732646.0], - [1220155200000, 2732646.0], - [1222747200000, 2599196.0], - [1225425600000, 2599196.0], - [1228021200000, 2599196.0], - [1230699600000, 1924387.0], - [1233378000000, 1924387.0], - [1235797200000, 1924387.0], - [1238472000000, 1756311.0], - [1241064000000, 2287726.0], - [1280548800000, 1309915.0], - [1283227200000, 1309915.0], - [1285819200000, 1331875.0], - [1288497600000, 1331875.0], - [1291093200000, 1331875.0], - [1293771600000, 1331875.0], - [1296450000000, 1154695.0], - [1298869200000, 2287726.0], - [1301544000000, 1194025.0], - [1304136000000, 1194025.0], - [1306814400000, 1194025.0], - [1309406400000, 1194025.0], - [1312084800000, 1194025.0], - [1314763200000, 1244525.0] - ] - }, { - "key": "Series 4", - "values": [ - [1136005200000, 1271000.0], - [1138683600000, 1271000.0], - [1141102800000, 1271000.0], - [1170219600000, 3564700.0], - [1172638800000, 3564700.0], - [1175313600000, 2648493.0], - [1177905600000, 2648493.0], - [1180584000000, 2648493.0], - [1183176000000, 2522993.0], - [1185854400000, 2522993.0], - [1188532800000, 2522993.0], - [1220155200000, 2732646.0], - [1222747200000, 2599196.0], - [1225425600000, 2599196.0], - [1228021200000, 2599196.0], - [1230699600000, 1271000.0], - [1233378000000, 1924387.0], - [1235797200000, 1924387.0], - [1251691200000, 1743470.0], - [1254283200000, 1519010.0], - [1275278400000, 1543784.0], - [1277870400000, 1271000.0], - [1280548800000, 1309915.0], - [1283227200000, 1309915.0], - [1285819200000, 1331875.0], - [1288497600000, 1331875.0], - [1291093200000, 1331875.0], - [1293771600000, 1331875.0], - [1296450000000, 1154695.0], - [1298869200000, 1154695.0], - [1301544000000, 1194025.0], - [1304136000000, 1194025.0], - [1322629200000, 475000.0], - [1325307600000, 690033.0], - [1327986000000, 690033.0], - [1330491600000, 690033.0], - [1333166400000, 514733.0], - [1335758400000, 514733.0] - ] - }]; + var name = url.split("metrics")[1].substr(1); + var metricData; + if (name == "cpu.0.cpu.idle.value") { + + metricData = { + "key": "cpu.0.cpu.idle.value", + "values": [ + [1136005200000, 1271000.0], + [1138683600000, 1271000.0], + [1141102800000, 1271000.0], + [1159588800000, 3899486.0], + [1162270800000, 3899486.0], + [1164862800000, 3899486.0], + [1167541200000, 3564700.0], + [1170219600000, 3564700.0], + [1172638800000, 3564700.0], + [1191124800000, 2906501.0], + [1193803200000, 2906501.0], + [1196398800000, 2906501.0], + [1199077200000, 2206761.0], + [1201755600000, 2206761.0], + [1204261200000, 2206761.0], + [1206936000000, 2287726.0], + [1209528000000, 2287726.0], + [1212206400000, 2287726.0], + [1214798400000, 2732646.0], + [1217476800000, 2732646.0], + [1225425600000, 2599196.0], + [1228021200000, 2599196.0], + [1230699600000, 1924387.0], + [1233378000000, 1924387.0], + [1235797200000, 1924387.0], + [1249012800000, 1743470.0], + [1251691200000, 1743470.0], + [1254283200000, 1519010.0], + [1256961600000, 1087726.0], + [1264914000000, 2087726.0], + [1267333200000, 2287726.0], + [1270008000000, 2287726.0], + [1272600000000, 2287726.0], + [1275278400000, 2287726.0], + [1277870400000, 1309915.0], + [1280548800000, 1309915.0], + [1283227200000, 1309915.0], + [1285819200000, 1331875.0], + [1288497600000, 1331875.0], + [1291093200000, 1331875.0], + [1293771600000, 1331875.0], + [1314763200000, 1244525.0], + [1317355200000, 475000.0], + [1320033600000, 475000.0], + [1322629200000, 475000.0], + [1325307600000, 690033.0], + [1327986000000, 690033.0], + [1330491600000, 690033.0], + [1333166400000, 514733.0], + [1335758400000, 514733.0] + ] + }; + } else if (name == "cpu.0.cpu.interrupt.value") { + metricData = { + "key": "cpu.0.cpu.interrupt.value", + "values": [ + [1136005200000, 1271000.0], + [1138683600000, 1271000.0], + [1141102800000, 1271000.0], + [1159588800000, 3899486.0], + [1162270800000, 3899486.0], + [1164862800000, 3899486.0], + [1167541200000, 2287726.0], + [1170219600000, 2287726.0], + [1172638800000, 3564700.0], + [1175313600000, 2648493.0], + [1177905600000, 2648493.0], + [1180584000000, 2648493.0], + [1183176000000, 2522993.0], + [1185854400000, 2522993.0], + [1188532800000, 2522993.0], + [1191124800000, 2906501.0], + [1193803200000, 2906501.0], + [1196398800000, 2906501.0], + [1199077200000, 2206761.0], + [1201755600000, 2206761.0], + [1204261200000, 2206761.0], + [1206936000000, 2287726.0], + [1209528000000, 2287726.0], + [1212206400000, 2287726.0], + [1214798400000, 2732646.0], + [1217476800000, 2732646.0], + [1220155200000, 2732646.0], + [1222747200000, 2599196.0], + [1225425600000, 2599196.0], + [1228021200000, 2599196.0], + [1230699600000, 1924387.0], + [1233378000000, 1924387.0], + [1235797200000, 1924387.0], + [1238472000000, 1756311.0], + [1241064000000, 1756311.0], + ] + }; + } else if (name == "cpu.0.cpu.nice.value") { + metricData = { + + "key": "cpu.0.cpu.nice.value", + "values": [ + [1136005200000, 1271000.0], + [1138683600000, 1271000.0], + [1141102800000, 1271000.0], + [1159588800000, 3899486.0], + [1177905600000, 2648493.0], + [1180584000000, 2648493.0], + [1183176000000, 2522993.0], + [1185854400000, 2522993.0], + [1188532800000, 2522993.0], + [1191124800000, 2906501.0], + [1193803200000, 2906501.0], + [1196398800000, 2906501.0], + [1199077200000, 2206761.0], + [1201755600000, 2206761.0], + [1204261200000, 2206761.0], + [1206936000000, 2287726.0], + [1209528000000, 2287726.0], + [1212206400000, 2287726.0], + [1214798400000, 2732646.0], + [1217476800000, 2732646.0], + [1220155200000, 2732646.0], + [1222747200000, 2599196.0], + [1225425600000, 2599196.0], + [1228021200000, 2599196.0], + [1230699600000, 1924387.0], + [1233378000000, 1924387.0], + [1235797200000, 1924387.0], + [1238472000000, 1756311.0], + [1241064000000, 2287726.0], + [1280548800000, 1309915.0], + [1283227200000, 1309915.0], + [1285819200000, 1331875.0], + [1288497600000, 1331875.0], + [1291093200000, 1331875.0], + [1293771600000, 1331875.0], + [1296450000000, 1154695.0], + [1298869200000, 2287726.0], + [1301544000000, 1194025.0], + [1304136000000, 1194025.0], + [1306814400000, 1194025.0], + [1309406400000, 1194025.0], + [1312084800000, 1194025.0], + [1314763200000, 1244525.0] + ] + }; + } else { + metricData = { + "key": "else", + "values": [ + [1136005200000, 1271000.0], + [1138683600000, 1271000.0], + [1141102800000, 1271000.0], + [1170219600000, 3564700.0], + [1172638800000, 3564700.0], + [1175313600000, 2648493.0], + [1177905600000, 2648493.0], + [1180584000000, 2648493.0], + [1183176000000, 2522993.0], + [1185854400000, 2522993.0], + [1188532800000, 2522993.0], + [1220155200000, 2732646.0], + [1222747200000, 2599196.0], + [1225425600000, 2599196.0], + [1228021200000, 2599196.0], + [1230699600000, 1271000.0], + [1233378000000, 1924387.0], + [1235797200000, 1924387.0], + [1251691200000, 1743470.0], + [1254283200000, 1519010.0], + [1275278400000, 1543784.0], + [1277870400000, 1271000.0], + [1280548800000, 1309915.0], + [1283227200000, 1309915.0], + [1285819200000, 1331875.0], + [1288497600000, 1331875.0], + [1291093200000, 1331875.0], + [1293771600000, 1331875.0], + [1296450000000, 1154695.0], + [1298869200000, 1154695.0], + [1301544000000, 1194025.0], + [1304136000000, 1194025.0], + [1322629200000, 475000.0], + [1325307600000, 690033.0], + [1327986000000, 690033.0], + [1330491600000, 690033.0], + [1333166400000, 514733.0], + [1335758400000, 514733.0] + ] + }; + } return [200, metricData, {}]; }); }); diff --git a/v2/src/app/monitoring/metrics.tpl.html b/v2/src/app/monitoring/metrics.tpl.html index 6de9929..abd7896 100644 --- a/v2/src/app/monitoring/metrics.tpl.html +++ b/v2/src/app/monitoring/metrics.tpl.html @@ -23,13 +23,14 @@

Metrics Browser - Collapse all - Expand all

-
+

- +
+ Collapse all + Expand all +