From 74783005860524bbdf1be4fe0ec2924e650c1652 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Wed, 30 Jan 2008 17:02:27 +0000 Subject: updated ... working --- qooxdoo/source/class/Smokeping/Application.js | 26 ++++---- qooxdoo/source/class/Smokeping/Server.js | 76 +++++++++++++++++++++++ qooxdoo/source/class/Smokeping/io/Rpc.js | 80 ------------------------- qooxdoo/source/class/Smokeping/ui/Graph.js | 5 +- qooxdoo/source/class/Smokeping/ui/GraphList.js | 16 +---- qooxdoo/source/class/Smokeping/ui/Mover.js | 8 ++- qooxdoo/source/class/Smokeping/ui/Navigator.js | 26 +++++--- qooxdoo/source/class/Smokeping/ui/TargetTree.js | 39 ++---------- 8 files changed, 123 insertions(+), 153 deletions(-) create mode 100644 qooxdoo/source/class/Smokeping/Server.js delete mode 100644 qooxdoo/source/class/Smokeping/io/Rpc.js (limited to 'qooxdoo/source/class/Smokeping') diff --git a/qooxdoo/source/class/Smokeping/Application.js b/qooxdoo/source/class/Smokeping/Application.js index 90e2f32..917b608 100644 --- a/qooxdoo/source/class/Smokeping/Application.js +++ b/qooxdoo/source/class/Smokeping/Application.js @@ -21,38 +21,38 @@ qx.Class.define('Smokeping.Application', 'SP', qx.core.Setting.get('Smokeping.resourceUri') ); - // this will provide access to the server side of this app -// var rpc = new Smokeping.io.Rpc('http://localhost/~oetiker/smq/'); - var rpc = new Smokeping.io.Rpc('http://johan.oetiker.ch/~oetiker/smq/'); - - var base_url = rpc.getBaseUrl(); - - var prime = new qx.ui.layout.VerticalBoxLayout(); - with(prime){ + // if we run with a file:// url make sure + // the app finds the smokeping service (smokeping.cgi) + Smokeping.Server.getInstance().setLocalUrl( + 'http://localhost/~oetiker/smq/' + ); + + var base_layout = new qx.ui.layout.VerticalBoxLayout(); + with(base_layout){ setPadding(8); setLocation(0,0); setWidth('100%'); setHeight('100%'); setSpacing(10); }; - prime.addToDocument(); + base_layout.addToDocument(); var title = new qx.ui.basic.Atom(this.tr('Smokeping Viewer')); with(title){ setTextColor('#b0b0b0'); setFont(qx.ui.core.Font.fromString('16px bold sans-serif')); } - prime.add(title); + base_layout.add(title); var splitpane = new qx.ui.splitpane.HorizontalSplitPane(200, '1*'); splitpane.setEdge(0); splitpane.setHeight('1*'); splitpane.setShowKnob(true); - prime.add(splitpane); + base_layout.add(splitpane); - var tree = new Smokeping.ui.TargetTree(rpc); + var tree = new Smokeping.ui.TargetTree(); splitpane.addLeft(tree); - var graphlist = new Smokeping.ui.GraphList(rpc.getBaseUrl()); + var graphlist = new Smokeping.ui.GraphList(); splitpane.addRight(graphlist); diff --git a/qooxdoo/source/class/Smokeping/Server.js b/qooxdoo/source/class/Smokeping/Server.js new file mode 100644 index 0000000..ebc938d --- /dev/null +++ b/qooxdoo/source/class/Smokeping/Server.js @@ -0,0 +1,76 @@ +/* ************************************************************************ +#module(Smokeping) +************************************************************************ */ + +/** + * A smokeping specific rpc call which works + */ + +qx.Class.define('Smokeping.Server', +{ + extend: qx.io.remote.Rpc, + type: "singleton", + + /* + ***************************************************************************** + CONSTRUCTOR + ***************************************************************************** + */ + + /** + * @param local_url {String} When running the application in file:// mode. + * where will we find our RPC server. + */ + construct: function (local_url) { + + with(this){ + base(arguments); + setTimeout(7000000); + setUrl('smokeping.cgi'); + setServiceName('Smokeping'); + } + + return this; + }, + + /* + ***************************************************************************** + MEMBERS + ***************************************************************************** + */ + + members : + { + + /* + --------------------------------------------------------------------------- + CORE METHODS + --------------------------------------------------------------------------- + */ + + /** + * Tell about the BaseUrl we found. + * + * @type member + * + * @param {void} + * + * @return BaseUrl {Strings} + */ + + getBaseUrl: function(){ + return this.__base_url; + }, + + setLocalUrl: function(local_url){ + if ( document.location.host === '' ) { + with(this){ + setUrl(local_url+'smokeping.cgi'); + setCrossDomain(true); + } + } + } + + } +}); + diff --git a/qooxdoo/source/class/Smokeping/io/Rpc.js b/qooxdoo/source/class/Smokeping/io/Rpc.js deleted file mode 100644 index 327d2c4..0000000 --- a/qooxdoo/source/class/Smokeping/io/Rpc.js +++ /dev/null @@ -1,80 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * A smokeping specific rpc call which works - */ - -qx.Class.define('Smokeping.io.Rpc', -{ - extend: qx.io.remote.Rpc, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param local_url {String} When running the application in file:// mode. - * where will we find our RPC server. - */ - construct: function (local_url) { - - with(this){ - base(arguments); - setTimeout(7000000); - setUrl('jsonrpc.cgi'); - setServiceName('Smokeping'); - } - - var our_href = new String(document.location.href); - var last_slash = our_href.lastIndexOf("/"); - this.__base_url = our_href.substring(0,last_slash+1); - - // look for services on the localhost if we access the - // application locally - - if ( document.location.host === '' ) { - with(this){ - __base_url = local_url; - setUrl(__base_url + 'jsonrpc.cgi'); - setCrossDomain(true); - } - } - - return this; - }, - - /* - ***************************************************************************** - MEMBERS - ***************************************************************************** - */ - - members : - { - - /* - --------------------------------------------------------------------------- - CORE METHODS - --------------------------------------------------------------------------- - */ - - /** - * Tell about the BaseUrl we found. - * - * @type member - * - * @param {void} - * - * @return BaseUrl {Strings} - */ - - getBaseUrl: function(){ - return this.__base_url; - } - } -}); - 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 0) { if ( e.getData()[0].basename == 'TreeFolder' ){ -- cgit v1.2.3-24-g4f1b