From: Loic Baron Date: Thu, 5 Jun 2014 13:09:54 +0000 (+0200) Subject: Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab X-Git-Tag: myslice-1.1~77^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a968cf61c4c7bc122108fb37fac8cdc111f466e6;hp=bdb6a3e86a1c998036f88dae5fb7ea1ab3bdd913;p=unfold.git Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab --- diff --git a/manifoldapi/static/js/manifold.js b/manifoldapi/static/js/manifold.js index f0bbc8a6..fa5415a8 100644 --- a/manifoldapi/static/js/manifold.js +++ b/manifoldapi/static/js/manifold.js @@ -475,15 +475,18 @@ var manifold = { var key = manifold.metadata.get_key(method); if (!key) continue; - if (key.length > 1) - continue; - key = key[0]; var sq_keys = []; var subrecords = record[method]; if (!subrecords) continue $.each(subrecords, function (i, subrecord) { - sq_keys.push(subrecord[key]); + if (key.length == 1){ + key = key[0]; + sq_keys.push(subrecord[key]); + }else{ + // more than what's necessary, but should work + sq_keys.push(subrecord); + } }); update_query.params[method] = sq_keys; update_query_orig.params[method] = sq_keys.slice(); diff --git a/plugins/queryupdater/static/js/queryupdater.js b/plugins/queryupdater/static/js/queryupdater.js index 5a7f7ba0..774392b9 100644 --- a/plugins/queryupdater/static/js/queryupdater.js +++ b/plugins/queryupdater/static/js/queryupdater.js @@ -29,10 +29,13 @@ var QueryUpdater = Plugin.extend({ init: function(options, element) { - this.classname="queryupdater"; + this.classname="queryupdater"; this._super(options, element); var self = this; + + this.initial = Array(); + this.table = this.elmt('table').dataTable({ // the original querytable layout was // sDom: "<'row'<'col-xs-5'l><'col-xs-1'r><'col-xs-6'f>>t<'row'<'col-xs-5'i><'col-xs-7'p>>", @@ -70,8 +73,15 @@ do_update: function(e) { var self = e.data; + + self.spin(); + console.log("do_update"); + // XXX check that the query is not disabled manifold.raise_event(self.options.query_uuid, RUN_UPDATE); + + // how to stop the spinning after the event? + // this should be triggered by some on_updatequery_done ? }, // related buttons are also disabled in the html template @@ -122,6 +132,7 @@ set_state: function(data) { + console.log("function set_state"); var action; var msg; var button = ''; @@ -214,11 +225,15 @@ on_new_record: function(record) { + console.log("query_updater on_new_record"); + console.log(record); + // if (not and update) { // initial['resource'], initial['lease'] ? - this.initial.push(record.urn); + this.initial.push(record); + //this.set_record_state(record, RECORD_STATE_ATTACHED); // We simply add to the table // } else { // \ this.initial_resources @@ -279,7 +294,7 @@ on_query_in_progress: function() { - messages.debug("queryupdater.on_query_in_progress"); + messages.debug("queryupdater.on_query_in_progress"); this.spin(); }, @@ -295,12 +310,9 @@ this.clear(); }, - on_new_record: function(record) - { - }, - on_query_done: function() { + console.log("on_query_done"); this.unspin(); }, @@ -308,12 +320,14 @@ // NOTE: record_key could be sufficient on_added_record: function(record) { + console.log("on_added_record = ",record); this.set_record_state(record, RECORD_STATE_ADDED); // update pending number }, on_removed_record: function(record_key) { + console.log("on_removed_record = ",record_key); this.set_record_state(RECORD_STATE_REMOVED); }, @@ -329,6 +343,8 @@ on_field_state_changed: function(result) { + console.log("on_field_state_changed"); + console.log(result); messages.debug(result) /* this.set_state(result.request, result.key, result.value, result.status); */ this.set_state(result); @@ -375,7 +391,7 @@ if (!change) return; // ioi: Refubrished - var initial = this.initial_resources; + var initial = this.initial; //var r_removed = []; // /*----------------------------------------------------------------------- TODO: remove this dirty hack !!! diff --git a/portal/sliceresourceview.py b/portal/sliceresourceview.py index 2034eac4..f99c7d98 100644 --- a/portal/sliceresourceview.py +++ b/portal/sliceresourceview.py @@ -19,6 +19,7 @@ from plugins.queryupdater import QueryUpdater from plugins.testbeds import TestbedsPlugin from plugins.scheduler2 import Scheduler2 from plugins.columns_editor import ColumnsEditor +from plugins.lists.simplelist import SimpleList from myslice.theme import ThemeView @@ -43,13 +44,16 @@ class SliceResourceView (LoginRequiredView, ThemeView): user_fields = ['user_hrn'] # [column['name'] for column in user_md['column']] # TODO The query to run is embedded in the URL + # Example: select slice_hrn, resource.urn, lease.resource, lease.start_time, lease.end_time from slice where slice_hrn == "ple.upmc.myslicedemo" main_query = Query.get('slice').filter_by('slice_hrn', '=', slicename) main_query.select( 'slice_hrn', 'resource.urn', 'resource.hostname', 'resource.type', 'resource.network_hrn', - 'lease.urn', + 'lease.resource', + 'lease.start_time', + 'lease.end_time', #'user.user_hrn', #'application.measurement_point.counter' ) @@ -95,21 +99,35 @@ class SliceResourceView (LoginRequiredView, ThemeView): # RESERVED RESOURCES LIST # resources as a list using datatable plugin - list_reserved_resources = QueryTable( - page = page, - domid = 'resources-reserved-list', - title = 'List view', - query = sq_resource, - query_all = sq_resource, - init_key = "urn", - checkboxes = True, - datatables_options = { - 'iDisplayLength': 25, - 'bLengthChange' : True, - 'bAutoWidth' : True, - }, + list_reserved_resources = SimpleList( + title = None, + page = page, + key = 'urn', + query = sq_resource, ) + list_reserved_leases = SimpleList( + title = None, + page = page, + key = 'resource', + query = sq_lease, + ) + +# list_reserved_resources = QueryTable( +# page = page, +# domid = 'resources-reserved-list', +# title = 'List view', +# query = sq_resource, +# query_all = sq_resource, +# init_key = "urn", +# checkboxes = True, +# datatables_options = { +# 'iDisplayLength': 25, +# 'bLengthChange' : True, +# 'bAutoWidth' : True, +# }, +# ) + # -------------------------------------------------------------------------- # COLUMNS EDITOR # list of fields to be applied on the query @@ -203,7 +221,8 @@ class SliceResourceView (LoginRequiredView, ThemeView): template_env = {} template_env['list_resources'] = list_resources.render(self.request) -# template_env['list_reserved_resources'] = list_reserved_resources.render(self.request) + template_env['list_reserved_resources'] = list_reserved_resources.render(self.request) + template_env['list_reserved_leases'] = list_reserved_leases.render(self.request) template_env['columns_editor'] = filter_column_editor.render(self.request) diff --git a/portal/templates/account-view.html b/portal/templates/account-view.html index 353a83c2..c60efb96 100644 --- a/portal/templates/account-view.html +++ b/portal/templates/account-view.html @@ -127,7 +127,7 @@ {%if 'N/A' not in user_private_key%} Private Key - ******** + ******** @@ -136,7 +136,7 @@ {%else%} Private Key - ******** + ******** diff --git a/portal/templates/slice-resource-view.html b/portal/templates/slice-resource-view.html index 707fa364..27ac3c5b 100644 --- a/portal/templates/slice-resource-view.html +++ b/portal/templates/slice-resource-view.html @@ -79,7 +79,13 @@