#
# various trash views
#
- (r'^slice/?$', 'trash.sampleviews.slice_view'),
- (r'^slice/(?P<name>[\w\.]+)/?$', 'trash.sampleviews.slice_view'),
(r'^tab/?$', 'trash.sampleviews.tab_view'),
(r'^scroll/?$', 'trash.sampleviews.scroll_view'),
(r'^plugin/?$', 'trash.pluginview.test_plugin_view'),
(r'^dashboard/?$', 'trash.dashboard.dashboard_view'),
- (r'^hazelnut/?$', 'trash.haze.hazelnut_view'),
+ (r'^slice/?$', 'trash.sliceview.slice_view'),
+ (r'^slice/(?P<slicename>[\w\.]+)/?$', 'trash.sliceview.slice_view'),
)
standard_topmenu_items = [
{ 'label':'Tab', 'href': '/tab/'},
{ 'label':'Scroll', 'href': '/scroll/'},
- { 'label':'Slice', 'href': '/slice/'},
{ 'label':'Plugin', 'href': '/plugin/'},
{ 'label':'Dashboard', 'href': '/dashboard/'},
- { 'label':'Hazelnut', 'href': '/hazelnut/'},
+ { 'label':'Slice', 'href': '/slice/'},
]
#login_out_items = { False: { 'label':'Login', 'href':'/login/'},
$.subscribe(query_channel, function(e, query) { hazelnut.set_query(query); });;
$.subscribe(update_channel, function(e, resources, instance) { hazelnut.set_resources(resources, instance); });
- $.subscribe(results_channel, function(e, rows) { hazelnut.update_table(rows); });
+ $.subscribe(results_channel, $this, function(e, rows) { hazelnut.update_plugin(e,rows); });
}); // this.each
}, // init
}
}
- /**
- * @brief
- * @param plugin_uuid
- * @param header
- * @param field
- * @param selected_str
- * @param disabled_str
- */
- this.checkbox = function(plugin_uuid, header, field, selected_str, disabled_str) {
- /* Prefix id with plugin_uuid */
- return "<input class='hazelnut-checkbox-" + plugin_uuid + "' id='hazelnut-checkbox-" + plugin_uuid + "-" + get_value(header) + "' name='" + get_value(field) + "' type='checkbox' " + selected_str + disabled_str + "autocomplete='off' value='" + get_value(header) + "'></input>";
- }
-
- this.update_table = function(rows) {
- var o = this.options;
- var object = this;
+ this.update_plugin = function(e, rows) {
+ if (debug) console.log("entering update_plugin");
+ // e.data is what we passed in second argument to subscribe
+ // so here it is the jquery object attached to the plugin <div>
+ var $plugindiv=e.data;
+ console.log("incoming plugindiv= " + $plugindiv);
+ // clear the spinning wheel: look up an ancestor that has the need-spin class
+ // do this before we might return
+ $plugindiv.closest('.need-spin').spin(false);
+
+ var options = this.options;
+ var hazelnut = this;
- $('#' + o.plugin_uuid).spin(false)
if (rows.length==0) {
this.table.html(errorDisplay("No Result"));
return;
// go through table headers to get column names we want
// in order (we have temporarily hack some adjustments in names)
- var cols = object.table.fnSettings().aoColumns;
+ var cols = hazelnut.table.fnSettings().aoColumns;
var colnames = cols.map(function(x) {return x.sTitle})
var nb_col = colnames.length;
- if (o.checkboxes)
+ if (options.checkboxes)
nb_col -= 1;
for (var j = 0; j < nb_col; j++) {
if (typeof colnames[j] == 'undefined') {
}
}
- if (o.checkboxes) {
+ if (options.checkboxes) {
var checked = '';
if (typeof(obj['sliver']) != 'undefined') { /* It is equal to null when <sliver/> is present */
checked = 'checked ';
- object.current_resources.push(obj['urn']);
+ hazelnut.current_resources.push(obj['urn']);
}
// Use a key instead of hostname (hard coded...)
- newline.push(object.checkbox(o.plugin_uuid, obj['urn'], obj['type'], checked, false));
+ newline.push(hazelnut.checkbox(options.plugin_uuid, obj['urn'], obj['type'], checked, false));
}
newlines.push(newline);
});
+// console.log ("end of each, newlines=" + newlines.length);
this.table.fnAddData(newlines);
- }
- }
+// console.log (" exiting update_plugin = ");
+ };
+
+ this.checkbox = function (plugin_uuid, header, field, selected_str, disabled_str) {
+ var result="";
+ /* Prefix id with plugin_uuid */
+ result += "<input class='hazelnut-checkbox-" + plugin_uuid + "' id='hazelnut-checkbox-" + plugin_uuid + "-" + get_value(header) + "'";
+ result += " name='" + get_value(field) + "' type='checkbox' " + selected_str + disabled_str + " autocomplete='off' value='" + get_value(header) + "'";
+ result +="></input>";
+ return result;
+ };
+ } // constructor
+
/***************************************************************************
* Private methods
***************************************************************************/
}
function hazelnut_draw_callback() {
- var o = this.options;
+ var options = this.options;
/*
* Handle clicks on checkboxes: reassociate checkbox click every time
* the table is redrawn
*/
- $('.hazelnut-checkbox-' + o.plugin_uuid).unbind('click');
- $('.hazelnut-checkbox-' + o.plugin_uuid).click({instance: this}, check_click);
+ $('.hazelnut-checkbox-' + options.plugin_uuid).unbind('click');
+ $('.hazelnut-checkbox-' + options.plugin_uuid).click({instance: this}, check_click);
if (!this.table)
return;
# xxx need to retrieve metadata
# $subject_keys = Plugins::get_default_fields($query->subject, $is_unique);
# $fields = Plugins::metadata_get_fields($query->subject);
- env['subject_fields']=[ 'the','available','default','fields']
+# for now I am hard-coding the ones from haze.py
+ env['subject_fields']=[ 'hostname', 'hrn' ]
return env
def requirements (self):
},
context_instance=RequestContext(request))
-# we take name from the URL and propagate in the template
-@login_required
-def slice_view (request, name=None):
- title='Fake Slice Page'
- if name: title += " for slice %s"%name
- result=render_to_response ('view-slice.html',
- {'name':name,
- 'title':title,
- 'topmenu_items' : topmenu_items('slice',request),
- 'username':the_user (request),
- 'slices': hard_wired_slice_names,
- 'unfold1_main' : lorem,
- },
- context_instance=RequestContext(request))
-
- return result
from myslice.viewutils import topmenu_items, the_user
+tmp_default_slice='ple.inria.sfatest'
+
@login_required
-def hazelnut_view (request):
+def slice_view (request, slicename=tmp_default_slice):
page = Page(request)
subject='resource',
timestamp='latest',
fields=['hrn','hostname'],
- filters= [ [ 'slice_hrn', '=', 'ple.inria.omftest', ] ],
+ filters= [ [ 'slice_hrn', '=', slicename, ] ],
# xxx filter : should filter on the slices the logged user can see
# we don't have the user's hrn yet
# in addition this currently returns all slices anyways
page=page,
title='xmlrpc code',
query=main_query,
+ toggled=False,
),
])
+++ /dev/null
-{# -*-django-html-mumamo-mode-*- #}
-{% extends 'layout-unfold1.html' %}
-
-{% block unfold1_main %}
-{% if name %}
-<p class='well'>We're getting the variable <code>name= {{ name }}</code> from the URL </p>
-{% else %}
-<p class='well'>This URL is not valid, you need to pass a slice name like in <a href="/slice/my.slice.name">/slice/my.slice.name</a></p>
-{% endif %}
-{% endblock unfold1_main %}
-