(function($){
- var Slicestat = Plugin.extend({
+ var SliceStat = Plugin.extend({
/** XXX to check
* @brief Plugin constructor
// Call the parent constructor, see FAQ when forgotten
this._super(options, element);
-
+
/* Member variables */
/* Plugin events */
// What happens when we don't define some events ?
// Some can be less efficient
this.listen_query(options.query_uuid);
-
+
/* GUI setup and event binding */
// call function
-
+ if (typeof options.slicename != 'undefined') {
+ options.slicename = options.slicename.replace("ple.","").replace(".","_");
+ }
+ if (typeof options.o == 'undefined') {
+ //options.o = 'cpu';
+ }
+
+ this.elmt().on('show', options, this.on_show);
},
/* PLUGIN EVENTS */
- // on_show like in hazelnut
+ // on_show like in querytable
/* GUI EVENTS */
// this.id, this.el, this.cl, this.elts
// same output as a jquery selector with some guarantees
},
-
+
+ on_show: function(ev)
+ {
+ $('iframe#' + ev.target.id + '-iframe').attr('src','http://plestats.planet-lab.eu/nodes.php?slice='+ev.data.slicename+'&order='+ev.data.o);
+ },
/* TEMPLATES */
// see in the html template
/* RECORD HANDLERS */
on_new_record: function(record)
{
- console.log(record);
-
- $('iframe#slicestat_resource').attr('src','http://plestats.planet-lab.eu/node.php?node='+record.hostname);
-
+ $('iframe#' + this.elmt().attr('id') + '-iframe').attr('src','http://plestats.planet-lab.eu/node.php?node='+record.hostname);
},
/* INTERNAL FUNCTIONS */
});
/* Plugin registration */
- $.plugin('Slicestat', Slicestat);
+ $.plugin('SliceStat', SliceStat);
// TODO Here use cases for instanciating plugins in different ways like in the pastie.