treewide: import utility classes explicitly
[project/luci.git] / applications / luci-app-statistics / htdocs / luci-static / resources / statistics / rrdtool / definitions / apcups.js
index bcebf303405fafbc49529180d06603b5c72542d5..c03e38cf57e0a2460a5dab2bd8b43e5d8f6a3b09 100644 (file)
@@ -1,8 +1,9 @@
 /* Licensed to the public under the Apache License 2.0. */
 
 'use strict';
+'require baseclass';
 
-return L.Class.extend({
+return baseclass.extend({
        title: _('APC UPS'),
 
        rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
@@ -15,10 +16,10 @@ return L.Class.extend({
                 */
 
                var ups_types = graph.dataTypes(host, plugin, plugin_instance),
-                   ups_inst = [];
+                   ups_inst = {};
 
                for (var i = 0; i < ups_types.length; i++)
-                       ups_inst.push(graph.dataInstances(host, plugin, plugin_instance, ups_types[i]));
+                       ups_inst[ups_types[i]] = graph.dataInstances(host, plugin, plugin_instance, ups_types[i]);
 
                /* Check if hash table or array is empty or nil-filled */
                function empty(t) {
@@ -37,9 +38,9 @@ return L.Class.extend({
 
                        if (L.isObject(def_inst)) {
                                for (var k in def_inst) {
-                                       if (ups_types.find(function(t) { return t == k }).length) {
+                                       if (ups_types.filter(function(t) { return t == k }).length) {
                                                for (var i = def_inst[k].length - 1; i >= 0; i--)
-                                                       if (!ups_inst[k].find(function(n) { return n == def_inst[k][i] }).length)
+                                                       if (!ups_inst[k].filter(function(n) { return n == def_inst[k][i] }).length)
                                                                def_inst[k].splice(i, 1);
 
                                                if (def_inst[k].length == 0)