diff options
Diffstat (limited to 'qooxdoo/source/class/Smokeping/ui')
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/Graph.js | 5 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/GraphList.js | 16 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/Mover.js | 8 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/Navigator.js | 26 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/TargetTree.js | 39 |
5 files changed, 34 insertions, 60 deletions
diff --git a/qooxdoo/source/class/Smokeping/ui/Graph.js b/qooxdoo/source/class/Smokeping/ui/Graph.js index 1d12cdf..506f158 100644 --- a/qooxdoo/source/class/Smokeping/ui/Graph.js +++ b/qooxdoo/source/class/Smokeping/ui/Graph.js @@ -20,7 +20,7 @@ qx.Class.define('Smokeping.ui.Graph', */ /** - * @param object {GraphShadow} What happens when the SNCF conductors tamazing. + * @param object {file} What happens when the SNCF conductors tamazing. * */ @@ -43,7 +43,8 @@ qx.Class.define('Smokeping.ui.Graph', this._highlight(); var loader = new Smokeping.ui.LoadingAnimation(); this.add(loader); - this._preloader = qx.io.image.PreloaderManager.getInstance().create(this._graph.getSrc()); + this._preloader = qx.io.image.PreloaderManager.getInstance().create(Smokeping.Server.getInstance().getUrl() + + '?g='+graph+';s=now-1d;e=now;t=100000;b=0;w=200;h=100'); if (this._preloader.isLoaded()){ qx.client.Timer.once(this._image_loader,this,0); } else { diff --git a/qooxdoo/source/class/Smokeping/ui/GraphList.js b/qooxdoo/source/class/Smokeping/ui/GraphList.js index 5d9bc58..c49b601 100644 --- a/qooxdoo/source/class/Smokeping/ui/GraphList.js +++ b/qooxdoo/source/class/Smokeping/ui/GraphList.js @@ -21,7 +21,7 @@ qx.Class.define('Smokeping.ui.GraphList', * */ - construct: function (url) { + construct: function () { with(this){ base(arguments); @@ -36,7 +36,6 @@ qx.Class.define('Smokeping.ui.GraphList', padding: 10 }) }; - this._url = url; qx.event.message.Bus.subscribe('sp.menu.folder',this._load_graphs,this); }, @@ -45,18 +44,7 @@ qx.Class.define('Smokeping.ui.GraphList', var files = m.getData() this.removeAll(); for(var i=0;i<files.length;i++){ - var shadow = new Smokeping.GraphShadow(); - shadow.set({ - width: 150, - height: 75, - start: Math.round((new Date()).getTime()/1000)-(3600*24*3), - end: Math.round((new Date()).getTime()/1000), - top: 1000000, - bottom: 0, - cgi: this._url + 'grapher.cgi', - data: files[i] - }); - var image = new Smokeping.ui.Graph(shadow); + var image = new Smokeping.ui.Graph(files[i]); this.add(image); } } diff --git a/qooxdoo/source/class/Smokeping/ui/Mover.js b/qooxdoo/source/class/Smokeping/ui/Mover.js index f212708..2d1d5f0 100644 --- a/qooxdoo/source/class/Smokeping/ui/Mover.js +++ b/qooxdoo/source/class/Smokeping/ui/Mover.js @@ -36,11 +36,13 @@ qx.Class.define('Smokeping.ui.Mover', construct: function (target,src,width,height,top,right,start,end) { this._target = target; - this._width = width; this._src = src; - this._height = height; // some where the calc is 1 off. this fixes it + this._width = width; + this._height = height; this._top = top; this._right = right; + this._start = start; + this._end = end; with(this){ base(arguments); set({ @@ -81,7 +83,7 @@ qx.Class.define('Smokeping.ui.Mover', width: this._width, height: this._height+17, left: this._width * i, - source: this._src+';w='+this._width+';h='+this._height+';s='+(this._start+(duration*(i-2)))+'e='+(this._end+(duration*(i-2))) + source: this._src+';w='+this._width+';h='+this._height+';s='+(this._start+(duration*(i-2)))+';e='+(this._end+(duration*(i-2))) }); this.add(tile); } diff --git a/qooxdoo/source/class/Smokeping/ui/Navigator.js b/qooxdoo/source/class/Smokeping/ui/Navigator.js index dc28d3e..eb799e7 100644 --- a/qooxdoo/source/class/Smokeping/ui/Navigator.js +++ b/qooxdoo/source/class/Smokeping/ui/Navigator.js @@ -23,23 +23,26 @@ qx.Class.define('Smokeping.ui.Navigator', construct: function (graph) { this._graph = graph; - with(this){ base(arguments,tr("Smokeping Graph Navigator")); set({ showMaximize: false, showMinimize: false, - width: graph.getWidth(), - height: graph.getHeight(), - minWidth: 120, - minHeight: 80, + width: 300, + height: 200, + minWidth: 300, + minHeight: 200, backgroundColor: '#f0f0f0' }); } + this._graph_width = 300; + this._graph_height = 200; this._lastrun = 0; this._loader = new Smokeping.ui.LoadingAnimation(); + this._url = Smokeping.Server.getInstance().getUrl(); this._update_image(); }, + members: { // resizable objects have a changeWidth method // which we can override to take part in the fun @@ -52,6 +55,7 @@ qx.Class.define('Smokeping.ui.Navigator', this._graph_width = this._graph_width + diff; qx.client.Timer.once(this._update_image,this,250); }, + _changeHeight: function(newHeight) { var diff = newHeight - this.getBoxHeight(); this.base(arguments, newHeight); @@ -60,10 +64,15 @@ qx.Class.define('Smokeping.ui.Navigator', qx.client.Timer.once(this._update_image,this,250); }, + + _get_url: function(){ + return this._url+ '?g='+this._graph+';s=now-1d;e=now;t=100000;b=0;w='+this._graph_width+';h='+this._graph_height; + }, + _update_image: function(){ var now = (new Date()).getTime(); if (this._lastrun + 1000 < now) { - this._preloader = qx.io.image.PreloaderManager.getInstance().create(this._graph.getSrc()); + this._preloader = qx.io.image.PreloaderManager.getInstance().create(this._get_url()) if (this._preloader.isLoaded()){ qx.client.Timer.once(this._show_image,this,0); } else { @@ -75,6 +84,7 @@ qx.Class.define('Smokeping.ui.Navigator', this.debug('Skipping update since previous update less tahn 1 second') } }, + _show_image: function(e){ with(this){ set({ @@ -86,9 +96,9 @@ qx.Class.define('Smokeping.ui.Navigator', qx.io.image.PreloaderManager.getInstance().remove(this._preloader); removeAll(); add(image); - var zoomer = new Smokeping.ui.Zoomer(image,this._graph,33,30); + var zoomer = new Smokeping.ui.Zoomer(image,this._graph_width,this._graph_height,33,30); add(zoomer); - var mover = new Smokeping.ui.Mover(image,this._graph,33,30); + var mover = new Smokeping.ui.Mover(image,this._url+ '?g='+this._graph,this._graph_width,this._graph_height,33,30,1201680005,1201686005); add(mover); } } diff --git a/qooxdoo/source/class/Smokeping/ui/TargetTree.js b/qooxdoo/source/class/Smokeping/ui/TargetTree.js index fbd5004..0e97a08 100644 --- a/qooxdoo/source/class/Smokeping/ui/TargetTree.js +++ b/qooxdoo/source/class/Smokeping/ui/TargetTree.js @@ -16,14 +16,8 @@ qx.Class.define('Smokeping.ui.TargetTree', ***************************************************************************** */ - /** - * @param root_node {String} Name of the root node - * where will we find our RPC server. - * - * @param rpc {rpcObject} An rpc object providing access to the Smokeping service - */ - construct: function (rpc) { + construct: function () { with(this){ base(arguments,'root node'); set({ @@ -42,14 +36,14 @@ qx.Class.define('Smokeping.ui.TargetTree', if (exc == null){ var nodes = data.length; for(var i=0;i<nodes;i++){ - Smokeping.ui.TargetTree._fill_folder(self,data[i]); + self._fill_folder(self,data[i]); } } else { alert(exc); } }; - rpc.callAsync(fill_tree,'get_tree'); + Smokeping.Server.getInstance().callAsync(fill_tree,'get_tree'); }, /* @@ -57,26 +51,7 @@ qx.Class.define('Smokeping.ui.TargetTree', Statics ***************************************************************************** */ - - statics : - { - - /* - --------------------------------------------------------------------------- - CORE METHODS - --------------------------------------------------------------------------- - */ - - /** - * Create the tree based on input from the Server - * - * @type member - * - * @param {void} - * - * @return BaseUrl {Strings} - */ - + members: { _fill_folder: function(node,data){ // in data[0] we have the id of the folder @@ -86,7 +61,7 @@ qx.Class.define('Smokeping.ui.TargetTree', var length = data.length; for (var i=2;i<length;i++){ if(qx.util.Validation.isValidArray(data[i])){ - Smokeping.ui.TargetTree._fill_folder(folder,data[i]); + this._fill_folder(folder,data[i]); } else { i++; // skip the node id for now var file = new qx.ui.tree.TreeFile(data[i]); @@ -95,10 +70,8 @@ qx.Class.define('Smokeping.ui.TargetTree', } } folder.setUserData('ids',files); - } + }, - }, - members: { _send_event: function(e) { if (e.getData().length > 0) { if ( e.getData()[0].basename == 'TreeFolder' ){ |