From f67def9484061c6b6b83ba4ea2e2e1014e078d11 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jordan=20Aug=C3=A9?= Date: Fri, 22 Nov 2013 14:35:07 +0100 Subject: [PATCH] added scheduler to slice view --- plugins/scheduler/__init__.py | 2 +- plugins/scheduler/static/js/scheduler.js | 34 ++++++++++++----------- plugins/scheduler/template/scheduler.html | 9 ++---- portal/sliceview.py | 2 +- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/plugins/scheduler/__init__.py b/plugins/scheduler/__init__.py index 3a7771f4..94a75716 100644 --- a/plugins/scheduler/__init__.py +++ b/plugins/scheduler/__init__.py @@ -6,7 +6,7 @@ class Scheduler(Plugin): # pass columns as the initial set of columns # if None then this is taken from the query's fields # latitude,longitude, zoom : the starting point - def __init__ (self, query, query_all = None, **settings): + def __init__ (self, query, query_lease = None, **settings): Plugin.__init__ (self, **settings) self.query=query self.query_lease = query_lease diff --git a/plugins/scheduler/static/js/scheduler.js b/plugins/scheduler/static/js/scheduler.js index 79292e5a..0ffed880 100644 --- a/plugins/scheduler/static/js/scheduler.js +++ b/plugins/scheduler/static/js/scheduler.js @@ -48,8 +48,7 @@ var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-s this._super(options, element); /* Member variables */ - this.options = options; - this.canvas_id = 'leases_area-' + options.plugin_uuid; + this.canvas_id = this.id('leases_area'); this.query_uuid = options.query_uuid; this.rows = null; @@ -139,13 +138,13 @@ var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-s * Implement an action of filtering while typing * filter what correspond to the user choice * - */ $(function() { var availableTags = ['omf','nitos','ple', s.nodelabel]; $( "#search" ).autocomplete({ source: availableTags }); }); + */ this.init_axisx(''); this.draw(); @@ -198,20 +197,23 @@ var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-s }); this.draw(this.canvas_id); - } + }, - this.set_leases = function(leases) { + set_leases: function(leases) + { this.initial_leases=leases; this.draw(this.canvas_id); - } + }, - this.update_resources = function(resources) { + update_resources: function(resources) + { // - } + }, - this.update_leases = function(leases) { + update_leases: function(leases) + { // - } + }, /* RECORD HANDLERS */ @@ -315,7 +317,7 @@ var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-s paper.path(half_daymarker_path).attr({'translation':left+','+top}).attr(attr_daymarker); } left += this.options.leases_w; - }, + } ////////// the row with the timeslot buttons (the one labeled 'All nodes') this.granularity= this.min_granularity; // XXX axisx[1][0]-axisx[0][0]; @@ -327,14 +329,14 @@ var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-s var allnodes = paper.text (o.x_nodelabel-o.x_sep,top+o.y_node/2,"All nodes").attr(txt_allnodes) .attr ({"font-size":o.y_node, "text-anchor":"end","baseline":"bottom"}); allnodes.scheduler=this; - allnodes.click(allnodes_methods.click); + allnodes.click(this.allnodes_methods.click); // timeslot buttons [it's the triangles above the slots] for (var i=0, len=axisx.length; i < len; ++i) { var timebutton=paper.path(this.timebutton_path).attr({'translation':left+','+top}).attr(attr_timebutton); timebutton.from_time=axisx[i][0]; timebutton.scheduler=this; - timebutton.click(timebutton_methods.click); + timebutton.click(this.timebutton_methods.click); left+=(this.options.leases_w); } @@ -355,9 +357,9 @@ var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-s var nodelabel = paper.text(o.x_nodelabel-o.x_sep,top+o.y_node/3,nodename).attr(txt_nodelabel) .attr ({"font-size":"12px", "text-anchor":"end","baseline":"bottom"}); //console.log(nodelabel); - nodelabel_methods.selected(nodelabel,1); + this.nodelabel_methods.selected(nodelabel,1); //nodelabel_methods.selected( this, ! this.selected ); - nodelabel.click(nodelabel_methods.click); //click action works here + nodelabel.click(this.nodelabel_methods.click); //click action works here //timebutton.click(timebutton_methods.click); // lease_methods.init_free(nodelabel.click, lease_methods.click_mine); @@ -473,7 +475,7 @@ var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-s /* if at least one is not selected : select all */ var new_state = (unselected >0) ? 1 : 0; for (var i=0, len=scheduler.nodelabels.length; i -

Date:

+

Date:

Search:

@@ -41,7 +36,7 @@ define('DEFAULT_LEASES_GRANULARITY', 3600); -
+