trash updater
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 23 Sep 2013 12:59:12 +0000 (14:59 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 23 Sep 2013 12:59:12 +0000 (14:59 +0200)
plugins/updater/WARNING [deleted file]
plugins/updater/__init__.py [deleted file]
plugins/updater/static/css/updater.css [deleted file]
plugins/updater/static/js/updater.js [deleted file]
plugins/updater/templates/updater.html [deleted file]
trash/pluginview.py

diff --git a/plugins/updater/WARNING b/plugins/updater/WARNING
deleted file mode 100644 (file)
index 9e0494c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-This plugin was an early attempt at implementing the widget that would
-. actually gather pending changes
-. and have an 'Update' button so as to post them
-However this work has been put on hold and is currently not used in real apps.
diff --git a/plugins/updater/__init__.py b/plugins/updater/__init__.py
deleted file mode 100644 (file)
index 2f68b41..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-from unfold.plugin import Plugin
-
-class Updater (Plugin):
-
-    def __init__ (self, query, label="Update", **settings):
-        Plugin.__init__ (self, **settings)
-        self.query=query
-        if query.action != "get": print "Updater on non-get query: ",query.action
-        self.label=label
-
-    def template_file (self):
-        return "updater.html"
-
-    def requirements (self):
-        return {
-            'js_files' :  [ "js/updater.js" , "js/manifold.js", "js/manifold-query.js", 
-                            "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js",
-                            "js/Math.uuid.js",
-                            ],
-            'css_files' : "css/updater.css",
-            }
-
-    # although this has no query, we need a plugin instance to be created in the js output
-    def export_json_settings (self):     return True
-    # the js plugin expects a domid
-    def json_settings_list (self):       return [ 'plugin_uuid', 'query_uuid', ]
-
-    # and we don't need a spin wheel 
-    def start_with_spin (self):          return False
-
-    def default_togglable (self):        return False
diff --git a/plugins/updater/static/css/updater.css b/plugins/updater/static/css/updater.css
deleted file mode 100644 (file)
index 34345ab..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-input.updater {
-    margin: 10px;
-}
diff --git a/plugins/updater/static/js/updater.js b/plugins/updater/static/js/updater.js
deleted file mode 100644 (file)
index 7ff9b8a..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * Description: Manage query updates
- * Copyright (c) 2012-2013 UPMC Sorbonne Universite - INRIA
- * License: GPLv3
- */
-
-(function( $ ) {
-    
-    var debug=false;
-//    debug=true
-
-    var Updater = Plugin.extend({
-
-        init: function(options, element)
-        {
-            this._super(options, element);
-            
-            this.listen_query(options.query_uuid);
-        },
-
-        
-        /*************************** PLUGIN EVENTS ****************************/
-
-        /***************************** GUI EVENTS *****************************/
-
-        arm_button: function()
-        {
-               this.elmt('updater').click(this, this.submit_update_request);
-        },
-
-        submit_update_request: function (e) 
-        {
-            var self = e.data;
-
-            manifold.raise_event(self.options.query_uuid, RUN_UPDATE);
-
-        },
-
-        /************************** GUI MANIPULATION **************************/
-
-        disable_update_button: function()
-        {
-            this.elmt('updater').attr('disabled', 'disabled');
-        },
-
-        /*************************** QUERY HANDLER ****************************/
-
-        /*************************** RECORD HANDLER ***************************/
-
-        /************************** PRIVATE METHODS ***************************/
-
-        /******************************** TODO ********************************/
-
-        /*
-           query_failed: function (e, code, output) 
-        {
-            var plugindiv=e.data;
-            var updater=plugindiv.data('Updater');
-                $('#updater-' + updater.options.plugin_uuid).removeAttr('disabled');
-            // just as a means to deom how to retrieve the stuff passed on the channel
-            if (debug)
-                messages.debug("retrieved error code " + code + " and output " + output);
-       },
-           
-        update_resources: function (e, resources, change)
-        {
-                data = e.data.instance.data().Slices;
-
-                data.update_query.params['resource'] = resources
-                $.publish('/update/' + data.options.query_uuid, [data.update_query, true]);
-        },
-
-        update_leases: function (e, leases, change) 
-        {
-            data = e.data.instance.data().Slices;
-            
-            data.update_query.params['lease'] = leases
-            $.publish('/update/' + data.options.query_uuid, [data.update_query, true]);
-        },
-        
-        query_completed: function (e, rows, query)
-        {
-
-            // This function is called twice : get and update 
-            messages.info("updater.query_completed - not implemented yet");
-            return;
-          
-            var data = e.data.instance.data().Slices;
-          
-            // Update placeholders and trigger subqueries updates 
-            if (rows.length == 0) {
-            alert("no result");
-            return;
-            }
-            var slice = rows[0];
-          
-            // for get
-            if (data.update_query == null) {
-                data.update_query = new Query('update','slice', 'now', query.filter, {"resource": null, "lease": null}, query.fields, 0, data.options.query_uuid);
-            }
-            // In case of update the list of resources and leases should be updated accordingly
-          
-            // only for get ?
-            $.each(slice, function(key, value) {
-            if (typeof value == 'string') {
-                $('#myslice__' + key).html(value);
-            }
-            });
-          
-            // TODO avoid repetitions + made this code generic and plugin-independent 
-            
-            if (query.method == 'update') {
-                // XXX NON, les uuid doivent etre les memes que dans la query Get, cet appel devrait etre fait avant.
-                query.analyzed_subqueries();
-            }
-          
-            // NOTE: Dans le cadre d'un update, on n'a pas besoin de refaire tout
-            // le query plan et obtenir toutes les infos, par contre on ne peut pas
-            // savoir d'avance quels parametres ont été accordés, changés, etc.
-            // Dans le cas général, ca pourrait affecter le query plan...
-            // Par contre on n'a pas d'information sur toutes les resources, mais
-            // uniquement celles dans la liste. Comment gérer ?
-            
-            // Inform child plugins about their respective parts of the results 
-            // Only for get 
-            var r_subq = query.analyzed_query.subqueries['resource'];
-            var l_subq = query.analyzed_query.subqueries['lease'];
-            $.publish('/results/' + r_subq.uuid + '/changed', [slice['resource'], r_subq]);
-            $.publish('/results/' + l_subq.uuid + '/changed', [slice['lease'],    l_subq]);
-            
-            // Subscribe to get notifications from child plugins
-            if (!data.child_subscribe) {
-                $.subscribe('/update-set/' + r_subq.uuid, {instance: e.data.instance}, update_resources);
-                $.subscribe('/update-set/' + l_subq.uuid, {instance: e.data.instance}, update_leases);
-                data.child_subscribe = true
-            }
-            
-        }
-        */
-    });
-
-    $.plugin('Updater', Updater);
-
-})( jQuery );
diff --git a/plugins/updater/templates/updater.html b/plugins/updater/templates/updater.html
deleted file mode 100644 (file)
index 798b17a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<input id="{{domid}}__updater" class="updater" type=button value="{{ label }}" />
index f6198df..366c131 100644 (file)
@@ -18,7 +18,6 @@ from plugins.querycode                  import QueryCode
 from plugins.raw                        import Raw
 from plugins.messages                   import Messages
 from plugins.hazelnut                   import Hazelnut
-from plugins.updater                    import Updater
 
 from myslice.viewutils                  import topmenu_items, the_user
 from trash.trashutils                  import hard_wired_slice_names, hard_wired_list, lorem_p, lorem, quickfilter_criterias
@@ -47,14 +46,6 @@ def test_plugin_view (request):
         togglable=True,
         domid='stack',
         sons=[ \
-# this updater thing never made it to production                
-#            Updater (
-#                    page=page,
-#                    title="Won't show up as non togglable",
-#                    query=main_query,
-#                    label="Update me",
-#                    domid="the-updater",
-#                ),
         # make sure the 2 things work together
             Messages (
                     page=page,
@@ -64,7 +55,7 @@ def test_plugin_view (request):
                     ),
             Hazelnut (
                     page=page,
-                    title="Slice %s - checkboxes interacting w/ updater"%slicename,
+                    title="Slice %s - checkboxes"%slicename,
                     query=main_query,
                     domid="hazelnut",
                     checkboxes=True,