From: Thierry Parmentelat Date: Sun, 24 Mar 2013 11:16:42 +0000 (+0100) Subject: manifold-core deprecated, keep its -leftovers for further ref X-Git-Tag: myslice-django-0.1-2~14 X-Git-Url: http://git.onelab.eu/?p=unfold.git;a=commitdiff_plain;h=ee1403fe15f21c08fcd97f770f64ef44122e2c23 manifold-core deprecated, keep its -leftovers for further ref --- diff --git a/manifold/js/manifold-core.js b/manifold/js/manifold-core-leftovers.js similarity index 55% rename from manifold/js/manifold-core.js rename to manifold/js/manifold-core-leftovers.js index ae9067f5..b6450017 100644 --- a/manifold/js/manifold-core.js +++ b/manifold/js/manifold-core-leftovers.js @@ -31,15 +31,6 @@ jQuery(document).ready(function() { }); */ -function get_value(value) { - //if(typeof(jQuery(value).attr('value'))!="undefined"){ - if (/.*<\/span>/i.test(value)) { - return jQuery(value).attr('value'); - } else { - return value; - } -} - /* From: http://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-clone-a-javascript-object I want to note that the .clone() method in jQuery only clones DOM elements. In order to clone JavaScript objects, you would do: @@ -56,58 +47,6 @@ function clone_object(obj) { return jQuery.extend(true, {}, obj); } -/* https://gist.github.com/661855 */ -(function(jQuery) { - - var o = jQuery({}); - - jQuery.subscribe = function( types, selector, data, fn) { - /* borrowed from jQuery */ - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - /* */ - - /* We use an indirection function that will clone the object passed in - * parameter to the subscribe callback - * - * FIXME currently we only clone query objects which are the only ones - * supported and editable, we might have the same issue with results but - * the page load time will be severely affected... - */ - o.on.apply(o, [types, selector, data, function() { - for(i = 1; i < arguments.length; i++) { - if ( arguments[i].constructor.name == 'Query' ) - arguments[i] = arguments[i].clone(); - } - fn.apply(o, arguments); - }]); - }; - - jQuery.unsubscribe = function() { - o.off.apply(o, arguments); - }; - - jQuery.publish = function() { - o.trigger.apply(o, arguments); - }; - -}(jQuery)); - - function executeFunctionByName(functionName, context /*, args */) { var args = Array.prototype.slice.call(arguments).splice(2); var namespaces = functionName.split("."); diff --git a/manifold/js/manifold.js b/manifold/js/manifold.js index 88b9482b..6b2d7288 100644 --- a/manifold/js/manifold.js +++ b/manifold/js/manifold.js @@ -38,14 +38,14 @@ var manifold = { // trigger a query asynchroneously proxy_url : '/manifold/proxy/json/', - asynchroneous_debug : true, + asynchroneous_debug : false, // Executes all async. queries // input queries are specified as a list of {'query_uuid': , 'id': } asynchroneous_exec : function (query_uuid_domids) { // start spinners - if (manifold.asynchroneous_exec) console.log("Turning spin on with " + jQuery(".need-spin").length + " matches for need-spin"); + if (manifold.asynchroneous_debug) console.log("Turning on spin with " + jQuery(".need-spin").length + " matches for .need-spin"); jQuery('.need-spin').spin(spin_presets); // We use js function closure to be able to pass the query (array) to the diff --git a/plugins/hazelnut/hazelnut.js b/plugins/hazelnut/hazelnut.js index 2f7ec5ea..b1c095cb 100644 --- a/plugins/hazelnut/hazelnut.js +++ b/plugins/hazelnut/hazelnut.js @@ -15,7 +15,7 @@ (function($){ var debug=false; - debug=true +// debug=true // routing calls $.fn.Hazelnut = function( method ) { @@ -131,7 +131,7 @@ // sScrollX: '100%', /* Horizontal scrolling */ bProcessing: true, /* Loading */ fnRowCallback: function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { - $(nRow).attr('id', get_value(aData[3])); + $(nRow).attr('id', unfold.get_value(aData[3])); return nRow; }, fnDrawCallback: function() { hazelnut_draw_callback.call(object, options); } @@ -277,11 +277,11 @@ if (rows.length==0) { if (debug) console.l ("empty result"); - this.table.html(errorDisplay("No Result")); + this.table.html(unfold.errorDisplay("No Result")); return; } else if (typeof(rows[0].error) != 'undefined') { if (debug) console.log ("undefined result"); - this.table.html(errorDisplay(rows[0].error)); + this.table.html(unfold.errorDisplay(rows[0].error)); return; } newlines = new Array(); @@ -339,8 +339,8 @@ this.checkbox = function (plugin_uuid, header, field, selected_str, disabled_str) { var result=""; /* Prefix id with plugin_uuid */ - result += "subject, $is_unique); # $fields = Plugins::metadata_get_fields($query->subject); # for now I am hard-coding the ones from haze.py - env['subject_fields']=[ 'hostname', 'hrn' ] + env['subject_fields']=[ 'network', 'type', 'hostname', 'hrn' ] return env def requirements (self): reqs = { 'js_files' : [ "js/hazelnut.js", - "js/manifold.js", "js/manifold-query.js", "js/manifold-core.js", + "js/manifold.js", "js/manifold-query.js", "js/dataTables.js", "js/with-datatables.js", "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", "js/unfold-helper.js", diff --git a/plugins/quickfilter/quickfilter.js b/plugins/quickfilter/quickfilter.js index 686b13c9..589177bc 100644 --- a/plugins/quickfilter/quickfilter.js +++ b/plugins/quickfilter/quickfilter.js @@ -59,7 +59,7 @@ var availableTags={}; $.each (rows, function(index, obj) { $.each(obj,function(key,value){ - value = get_value(value); + value = unfold.get_value(value); if(!availableTags.hasOwnProperty(key)){availableTags[key]=new Array();} //availableTags[key].push(value); var currentArray=availableTags[key]; diff --git a/trash/sliceview.py b/trash/sliceview.py index 9b97b7a3..022eb57d 100644 --- a/trash/sliceview.py +++ b/trash/sliceview.py @@ -29,15 +29,15 @@ def slice_view (request, slicename=tmp_default_slice): main_query = ManifoldQuery (action='get', subject='resource', timestamp='latest', - fields=['hrn','hostname'], + fields=['network','type','hrn','hostname'], filters= [ [ 'slice_hrn', '=', slicename, ] ], - sort='slice_hrn', +# sort='slice_hrn', ) page.enqueue_query (main_query) main_plugin = Stack ( page=page, - title="global container", + title="Slice view for %s"%slicename, domid='thestack', # togglable=False, sons=[Tabs ( diff --git a/unfold/js/unfold-helper.js b/unfold/js/unfold-helper.js index 3a76049a..0d3a54d8 100644 --- a/unfold/js/unfold-helper.js +++ b/unfold/js/unfold-helper.js @@ -25,7 +25,17 @@ var unfold = { return out; }, + get_value: function (value) { + //if(typeof(jQuery(value).attr('value'))!="undefined"){ + if (/.*<\/span>/i.test(value)) { + return jQuery(value).attr('value'); + } else { + return value; + } +} + } // global unfold // xxx tmp - until all plugins are ported -errorDisplay = unfold.errorDisplay; +errorDisplay = unfold.errorDisplay; +get_value = unfold.get_value;