]> git.99rst.org Git - openwrt-luci.git/blob
f612e39f6b9bc29a9ff111d5a557ff14ed295799
[openwrt-luci.git] /
1 /* Licensed to the public under the Apache License 2.0. */
2
3 'use strict';
4 'require baseclass';
5
6 return baseclass.extend({
7 title: _('Sensors'),
8
9 rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
10 var rv = [];
11 var types = graph.dataTypes(host, plugin, plugin_instance);
12
13 if (types.indexOf('temperature') > -1) {
14 rv.push({
15 per_instance: true,
16 title: "%H: %pi - %di",
17 vlabel: "\xb0C",
18 number_format: "%4.1lf\xb0C",
19 data: {
20 types: [ "temperature" ],
21 options: {
22 temperature__value: {
23 color: "ff0000",
24 title: "Temperature"
25 }
26 }
27 }
28 });
29 }
30 if (types.indexOf('humidity') > -1) {
31 rv.push({
32 per_instance: true,
33 title: "%H: %pi - %di",
34 vlabel: "%RH",
35 number_format: "%4.1lf %%RH",
36 data: {
37 types: [ "humidity" ],
38 options: {
39 humidity__value: {
40 color: "0000ff",
41 title: "Humidity"
42 }
43 }
44 }
45 });
46 }
47 if (types.indexOf('voltage') > -1) {
48 rv.push({
49 per_instance: true,
50 title: "%H: %pi - %di",
51 vlabel: "V",
52 number_format: "%4.1lf V",
53 data: {
54 types: [ "voltage" ],
55 options: {
56 voltage__value: {
57 color: "0000ff",
58 title: "Voltage"
59 }
60 }
61 }
62 });
63 }
64 if (types.indexOf('current') > -1) {
65 rv.push({
66 per_instance: true,
67 title: "%H: %pi - %di",
68 vlabel: "A",
69 number_format: "%4.1lf A",
70 data: {
71 types: [ "current" ],
72 options: {
73 current__value: {
74 color: "00ff00",
75 title: "Current"
76 }
77 }
78 }
79 });
80 }
81 if (types.indexOf('power') > -1) {
82 rv.push({
83 per_instance: true,
84 title: "%H: %pi - %di",
85 vlabel: "W",
86 number_format: "%4.1lf W",
87 data: {
88 types: [ "power" ],
89 options: {
90 power__value: {
91 color: "ff0000",
92 title: "Power"
93 }
94 }
95 }
96 });
97 }
98 if (types.indexOf('fanspeed') > -1) {
99 rv.push({
100 per_instance: true,
101 title: "%H: %pi - %di",
102 vlabel: "rpm",
103 number_format: "%4lf rpm",
104 data: {
105 types: [ "fanspeed" ],
106 options: {
107 fanspeed__value: {
108 color: "0000ff",
109 title: "Fan speed"
110 }
111 }
112 }
113 });
114 }
115
116 return rv;
117 }
118 });
git clone https://git.99rst.org/PROJECT