[ARVADOS] updated: 67578498c5de67fe2e821a3d91c1d2b7294df579
git at public.curoverse.com
git at public.curoverse.com
Mon Jun 9 16:57:55 EDT 2014
Summary of changes:
apps/workbench/app/assets/javascripts/event_log.js | 14 ++++++++------
apps/workbench/app/controllers/application_controller.rb | 1 -
apps/workbench/app/views/application/_content.html.erb | 4 ++--
3 files changed, 10 insertions(+), 9 deletions(-)
via 67578498c5de67fe2e821a3d91c1d2b7294df579 (commit)
from ef3e10bdf2324f3c9e6427b3fd085e6b05e3877c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 67578498c5de67fe2e821a3d91c1d2b7294df579
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Jun 9 16:57:50 2014 -0400
2961: Escaped erb used embedded in javascript. Updated comments in
event_log.js. Removed debug put from ApplicationController.
diff --git a/apps/workbench/app/assets/javascripts/event_log.js b/apps/workbench/app/assets/javascripts/event_log.js
index 0539021..8bfa1b0 100644
--- a/apps/workbench/app/assets/javascripts/event_log.js
+++ b/apps/workbench/app/assets/javascripts/event_log.js
@@ -2,8 +2,7 @@
* This js establishes a websockets connection with the API Server.
*/
-/* The subscribe method takes a window element id and object id.
- Any log events for that particular object id are sent to that window element. */
+/* Subscribe to websockets event log. Do nothing if already connected. */
function subscribeToEventLog () {
// if websockets are not supported by browser, do not subscribe for events
websocketsSupported = ('WebSocket' in window);
@@ -11,10 +10,10 @@ function subscribeToEventLog () {
return;
}
- // grab websocket connection from window, if one exists
+ // check if websocket connection is already stored on the window
event_log_disp = $(window).data("arv-websocket");
if (event_log_disp == null) {
- // create the event log dispatcher
+ // need to create new websocket and event log dispatcher
websocket_url = $('meta[name=arv-websocket-url]').attr("content");
if (websocket_url == null)
return;
@@ -29,12 +28,13 @@ function subscribeToEventLog () {
}
}
-/* send subscribe message to the websockets server */
+/* Send subscribe message to the websockets server. Without any filters
+ arguments, this subscribes to all events */
function onEventLogDispatcherOpen(event) {
this.send('{"method":"subscribe"}');
}
-/* trigger event for all applicable elements waiting for this event */
+/* Trigger event for all applicable elements waiting for this event */
function onEventLogDispatcherMessage(event) {
parsedData = JSON.parse(event.data);
object_uuid = parsedData.object_uuid;
@@ -44,6 +44,8 @@ function onEventLogDispatcherMessage(event) {
$(matches).trigger('arv-log-event', event.data);
}
+/* Automatically connect if there are any elements on the page that want to
+ received event log events. */
$(document).on('ajax:complete ready', function() {
var a = $('.arv-log-event-listener');
if (a.length > 0) {
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 78884a0..b77ce8d 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -105,7 +105,6 @@ class ApplicationController < ActionController::Base
return render_not_found("object not found")
end
respond_to do |f|
- puts f
f.json { render json: @object.attributes.merge(href: url_for(@object)) }
f.html {
if params['tab_pane']
diff --git a/apps/workbench/app/views/application/_content.html.erb b/apps/workbench/app/views/application/_content.html.erb
index 494a3ab..3b3ac6a 100644
--- a/apps/workbench/app/views/application/_content.html.erb
+++ b/apps/workbench/app/views/application/_content.html.erb
@@ -1,6 +1,6 @@
<% content_for :js do %>
function ajaxRefreshTabPane(pane) {
- $.ajax('<%= url_for @object %>?tab_pane='+pane, {dataType: 'html', type: 'GET'}).
+ $.ajax('<%=j url_for @object %>?tab_pane='+pane, {dataType: 'html', type: 'GET'}).
done(function(data, status, jqxhr) {
$('#' + pane + ' > div > div').html(data);
$(document).trigger('ajax:complete')
@@ -42,7 +42,7 @@
<% content_for :js do %>
<% if i != 0 %>
$(document).on('ready', function() {
- ajaxRefreshTabPane('<%= pane %>');
+ ajaxRefreshTabPane('<%=j pane %>');
});
<% end %>
<% end %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list