From: javier Date: Mon, 16 Jun 2014 08:17:06 +0000 (+0200) Subject: Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab X-Git-Tag: myslice-1.1~64^2~18 X-Git-Url: http://git.onelab.eu/?p=unfold.git;a=commitdiff_plain;h=ba476841726dc818c0efd3ed25e42955a39fc504 Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab Conflicts: plugins/queryupdater/static/js/queryupdater.js portal/sliceresourceview.py portal/templates/fed4fire/fed4fire_widget-slice-sections.html jgarcia - Commit after merging HEAD files and SLA & Service Directory code --- ba476841726dc818c0efd3ed25e42955a39fc504 diff --cc myslice/urls.py index 67865e79,2b0049db..a49156e1 --- a/myslice/urls.py +++ b/myslice/urls.py @@@ -87,11 -88,9 +88,12 @@@ urls = (r'^slice/(?P[^/]+)/?$', portal.sliceview.SliceView.as_view()), (r'^info/(?P[^/]+)/?$', portal.slicetabinfo.SliceInfoView.as_view()), (r'^testbeds/(?P[^/]+)/?$', portal.slicetabtestbeds.SliceTabTestbeds.as_view()), + (r'^measurements/(?P[^/]+)/?$', portal.slicetabmeasurements.SliceTabMeasurements.as_view()), (r'^experiment/(?P[^/]+)/?$', portal.slicetabexperiment.ExperimentView.as_view()), url(r'^portal/', include('portal.urls')), + + # SLA + url(r'^sla/', include('sla.urls')), ] #this one would not match the convention diff --cc plugins/queryupdater/static/js/queryupdater.js index ac7fc0ae,774392b9..252d349c --- a/plugins/queryupdater/static/js/queryupdater.js +++ b/plugins/queryupdater/static/js/queryupdater.js @@@ -70,51 -73,15 +73,63 @@@ do_update: function(e) { var self = e.data; + - self.spin(); - console.log("do_update"); - + var username = e.data.options.username; + var urn = data.value; // 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 ? + console.log("DATA VALUE: " + data.value); + + if (data.value.toLowerCase().indexOf("iminds") >= 0){ + + $('#sla_dialog').show(); + $('#slamodal').modal('show'); + + $(document).ready(function() { + $("#accept_sla").click(function(){ + console.log("SLA ACCEPTED"); + console.log("With username: " + username); + if(urn.toLowerCase().indexOf("wall2") >= 0){ + $.post("/sla/agreements/simplecreate", + { "template_id": "iMindsServiceVirtualwall", + "user": username, + "expiration_time": new Date() // jgarcia: FIXME + }); + } else if(urn.toLowerCase().indexOf("wilab2") >= 0){ + $.post("/sla/agreements/simplecreate", + { "template_id":"iMindsServiceWiLab2", + "user":username, + "expiration_time": new Date() // jgarcia: FIXME + }); + } + $('#slamodal').modal('hide'); - console.log("Executing raise_event after sending SLA"); - // manifold.raise_event(self.options.query_uuid, RUN_UPDATE); ++ self.spin(); ++ console.log("Executing do_update after sending SLA"); ++ // 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 ? + }); + }); + + $(document).ready(function() { + $("#dismiss_sla").click(function(){ + console.log("SLA NOT ACCEPTED"); + $('#slamodal').modal('hide'); + }); + }); + + } else { - console.log("Executing raise_event"); ++ 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 diff --cc portal/sliceresourceview.py index 64a151b2,f99c7d98..1ea6eada --- a/portal/sliceresourceview.py +++ b/portal/sliceresourceview.py @@@ -19,7 -19,7 +19,8 @@@ from plugins.queryupdater im from plugins.testbeds import TestbedsPlugin from plugins.scheduler2 import Scheduler2 from plugins.columns_editor import ColumnsEditor +from plugins.sladialog import SlaDialog + from plugins.lists.simplelist import SimpleList from myslice.theme import ThemeView @@@ -203,24 -219,10 +221,25 @@@ class SliceResourceView (LoginRequiredV }, ) + # -------------------------------------------------------------------------- + # SLA View and accept dialog + + sla_dialog = SlaDialog( + page = page, + title = 'sla dialog', + query = main_query, + togglable = False, + # start turned off, it will open up itself when stuff comes in + toggled = True, + domid = 'sla_dialog', + outline_complete = True, + username = request.user, + ) + 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 --cc portal/templates/_widget-slice-sections.html index 7c89f2e9,a3d5d95a..175b09c0 --- a/portal/templates/_widget-slice-sections.html +++ b/portal/templates/_widget-slice-sections.html @@@ -4,10 -4,9 +4,10 @@@
  • Testbeds
  • Resources
  • Users
  • -
  • Statistics
  • -
  • Measurements
  • + +
  • Measurements
  • Experiment
  • +
  • SLA
  • {% else %}