[ARVADOS] updated: 1e7906c193d37eb40c734b93a8d152d87650562c
git at public.curoverse.com
git at public.curoverse.com
Wed Aug 20 22:07:06 EDT 2014
Summary of changes:
.../app/assets/javascripts/report_issue.js | 36 +++++++++++
apps/workbench/app/views/application/404.html.erb | 2 +-
.../app/views/application/_report_error.html.erb | 10 ++-
.../views/application/_report_issue_popup.html.erb | 71 +++++++++++++++++-----
.../app/views/application/api_error.html.erb | 2 +-
.../views/application/report_issue_popup.js.erb | 41 -------------
.../test/integration/report_issue_test.rb | 26 ++++----
7 files changed, 115 insertions(+), 73 deletions(-)
create mode 100644 apps/workbench/app/assets/javascripts/report_issue.js
via 1e7906c193d37eb40c734b93a8d152d87650562c (commit)
via 63fedb562b719408600b3b42c51bf0cbe4713006 (commit)
from 28d5074cdf748cd4da9e98d6202925fdbbf678cc (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 1e7906c193d37eb40c734b93a8d152d87650562c
Author: radhika <radhika at curoverse.com>
Date: Wed Aug 20 22:06:28 2014 -0400
3112: move ajax event handling into a separate js file
diff --git a/apps/workbench/app/views/application/report_issue_popup.js.erb b/apps/workbench/app/assets/javascripts/report_issue.js
similarity index 83%
copy from apps/workbench/app/views/application/report_issue_popup.js.erb
copy to apps/workbench/app/assets/javascripts/report_issue.js
index 53edb4b..362a9a1 100644
--- a/apps/workbench/app/views/application/report_issue_popup.js.erb
+++ b/apps/workbench/app/assets/javascripts/report_issue.js
@@ -1,11 +1,3 @@
-$("#report-issue-modal-window").html("<%= escape_javascript(render partial: 'report_issue_popup') %>");
-
-// reset form input fields, for the next time around
-function reset_form() {
- $('#report_issue_text').val("");
- $('#additional_info').val("");
-}
-
// ajax handling for report-issue function
$(document).
on('ajax:send', function() {
@@ -33,7 +25,7 @@ $(document).
if ($sendButton && $sendButton.prop('disabled')) {
$('div').remove('.modal-footer-status');
$('.modal-footer').append('<div class="modal-footer-status alert alert-danger"></br><p align="left">We are sorry. We could not submit your report! We really want this to work, though -- please try again.</p></div>');
- $sendButton.html('Report issue');
+ $sendButton.html('Report a problem');
$sendButton.attr('disabled',false);
}
var $cancelButton = $('#report-issue-cancel');
diff --git a/apps/workbench/app/views/application/404.html.erb b/apps/workbench/app/views/application/404.html.erb
index 84af5d3..16d5ed3 100644
--- a/apps/workbench/app/views/application/404.html.erb
+++ b/apps/workbench/app/views/application/404.html.erb
@@ -22,4 +22,4 @@ Perhaps you'd like to
</p>
<% error_message = "The #{req_item_plain_text} was not found." %>
-<%= render :partial => "report_error", :locals => {error_message: error_message} %>
+<%= render :partial => "report_error", :locals => {error_message: error_message, error_type: '404'} %>
diff --git a/apps/workbench/app/views/application/_report_error.html.erb b/apps/workbench/app/views/application/_report_error.html.erb
index f79a769..4bdc5df 100644
--- a/apps/workbench/app/views/application/_report_error.html.erb
+++ b/apps/workbench/app/views/application/_report_error.html.erb
@@ -1,7 +1,11 @@
<p>
<br/><strong>If you suspect this is a bug, you can help us fix it by sending us a problem report:</strong></br></br>
-<% if api_error %>
- Send a problem report right here. <%= link_to report_issue_popup_path(popup_type: 'report', current_location: request.url, action_method: 'post', api_error_request_url: api_error.request_url, api_error_response: api_error.api_response_s),
+<% if error_type == 'api' %>
+ <%
+ api_request_url = api_error.andand.request_url ? api_error.request_url : ''
+ api_error_response = api_error.andand.api_response ? api_error.api_response : ''
+ %>
+ Send a problem report right here. <%= link_to report_issue_popup_path(popup_type: 'report', current_location: request.url, action_method: 'post', api_error_request_url: api_request_url, api_error_response: api_error_response),
{class: 'btn btn-primary report-issue-modal-window', 'data-toggle' => "modal", 'data-target' => '#report-issue-modal-window', :remote => true, return_to: request.url} do %>
<i class="fa fa-fw fa-support"></i> Report problem
<% end %>
@@ -15,3 +19,5 @@
<br/></br>
If you prefer email, send to: <a href="mailto:<%=support_email%>?subject=Workbench problem report&body=Problem while viewing page <%=request.url%>"><%=support_email%></a>
</p>
+
+
diff --git a/apps/workbench/app/views/application/_report_issue_popup.html.erb b/apps/workbench/app/views/application/_report_issue_popup.html.erb
index 4b2b55a..cd4c57b 100644
--- a/apps/workbench/app/views/application/_report_issue_popup.html.erb
+++ b/apps/workbench/app/views/application/_report_issue_popup.html.erb
@@ -45,21 +45,38 @@
<div class="modal-body" style="overflow-y:scroll">
<div class="form-group">
- <label for="support_version" class="col-sm-4 control-label"> Support email </label>
+ <label for="support_email" class="col-sm-4 control-label"> Support email </label>
<div class="col-sm-8">
<p class="form-control-static" name="support_version"><a href="mailto:<%=support_email%>?subject=Workbench problem report&body=Problem while viewing page <%=@popup_params[:current_location]%>"><%=support_email%></a></p>
</div>
</div>
<div class="form-group">
- <label for="server_version" class="col-sm-4 control-label"> Server version </label>
+ <label for="current_page" class="col-sm-4 control-label"> Current page </label>
+ <div class="col-sm-8">
+ <p class="form-control-static" name="current_page"><%=@popup_params[:current_location]%></a></p>
+ </div>
+ </div>
+
+ <% if @popup_params[:popup_type] == 'report' %>
+ <div class="form-group">
+ <label for="report_text_label" class="col-sm-4 control-label"> Found a problem? Tell us what happened </label>
+ <div class="col-sm-8">
+ <textarea class="form-control" rows="4" id="report_issue_text" name="report_issue_text" type="text"/>
+ </div>
+ <input type="hidden" name="report_additional_info" value="<%=additional_info.to_json%>">
+ </div>
+ <% end %>
+
+ <div class="form-group">
+ <label for="server_version" class="col-sm-4 control-label"> API version </label>
<div class="col-sm-8">
<p class="form-control-static" name="server_version"><%=api_version%></p>
</div>
</div>
<div class="form-group">
- <label for="generated_at" class="col-sm-4 control-label"> Server restarted at </label>
+ <label for="generated_at" class="col-sm-4 control-label"> API startup time </label>
<div class="col-sm-8">
<p class="form-control-static" name="generated_at"><%=generated_at%></p>
</div>
@@ -73,33 +90,59 @@
</div>
<div class="form-group">
- <label for="arvados_base" class="col-sm-4 control-label"> Arvados base </label>
+ <label for="arvados_base" class="col-sm-4 control-label"> Workbench URI </label>
<div class="col-sm-8">
<p class="form-control-static" name="arvados_base"><%=arvados_base%></p>
</div>
</div>
- <% if @popup_params[:popup_type] == 'report' %>
+ <% if current_user %>
<div class="form-group">
- <label for="report_text_label" class="col-sm-4 control-label"> Found a problem? Tell us what happened </label>
+ <label for="user_uuid" class="col-sm-4 control-label"> User UUID </label>
+ <div class="col-sm-8">
+ <p class="form-control-static" name="user_uuid"><%=current_user.uuid%></p>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label for="user_email" class="col-sm-4 control-label"> User email </label>
<div class="col-sm-8">
- <textarea class="form-control" rows="1" id="report_issue_text" name="report_issue_text" type="text"/>
+ <p class="form-control-static" name="user_email"><%=current_user.email%></p>
</div>
</div>
<% end %>
- <div class="form-group">
- <label for="additional_info" class="col-sm-4 control-label"> Additional info </label>
- <div class="col-sm-8">
- <textarea readonly class="form-control" rows="1" name="additional_info" type="text"><%=additional_info_str%></textarea>
+ <% if @popup_params[:error_message] %>
+ <div class="form-group">
+ <label for="error_message" class="col-sm-4 control-label"> Error message </label>
+ <div class="col-sm-8">
+ <p class="form-control-static" name="error_mesasge"><%=@popup_params[:error_message]%></p>
+ </div>
</div>
- <input type="hidden" name="report_additional_info" value="<%=additional_info.to_json%>">
- </div>
+ <% end %>
+
+ <% if @popup_params[:api_error_request_url] %>
+ <div class="form-group">
+ <label for="api_error_url" class="col-sm-4 control-label"> API error request url </label>
+ <div class="col-sm-8">
+ <p class="form-control-static" name="api_error_url"><%=@popup_params[:api_error_request_url]%></p>
+ </div>
+ </div>
+ <% end %>
+
+ <% if @popup_params[:api_error_response] %>
+ <div class="form-group">
+ <label for="api_error_response" class="col-sm-4 control-label"> API error response </label>
+ <div class="col-sm-8">
+ <p class="form-control-static" name="api_error_response"><%=@popup_params[:api_error_response]%></p>
+ </div>
+ </div>
+ <% end %>
</div>
<div class="modal-footer">
<% if @popup_params[:popup_type] == 'report' %>
- <button type="submit" id="report-issue-submit" class="btn btn-primary report-issue-submit" autofocus>Report issue</button>
+ <button type="submit" id="report-issue-submit" class="btn btn-primary report-issue-submit" autofocus>Report a problem</button>
<button class="btn btn-default report-issue-cancel" id="report-issue-cancel" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Cancel</button>
<% else %>
<button class="btn btn-default" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Close</button>
diff --git a/apps/workbench/app/views/application/api_error.html.erb b/apps/workbench/app/views/application/api_error.html.erb
index 9fcfde6..f8edf7d 100644
--- a/apps/workbench/app/views/application/api_error.html.erb
+++ b/apps/workbench/app/views/application/api_error.html.erb
@@ -22,4 +22,4 @@ If that doesn't work, the information below can help system administrators track
</dl>
<% end %>
-<%= render :partial => "report_error", :locals => {api_error: api_error} %>
+<%= render :partial => "report_error", :locals => {api_error: api_error, error_type: 'api'} %>
diff --git a/apps/workbench/app/views/application/report_issue_popup.js.erb b/apps/workbench/app/views/application/report_issue_popup.js.erb
index 53edb4b..59aedbc 100644
--- a/apps/workbench/app/views/application/report_issue_popup.js.erb
+++ b/apps/workbench/app/views/application/report_issue_popup.js.erb
@@ -5,40 +5,3 @@ function reset_form() {
$('#report_issue_text').val("");
$('#additional_info').val("");
}
-
-// ajax handling for report-issue function
-$(document).
- on('ajax:send', function() {
- var $sendButton = $('#report-issue-submit');
- if ($sendButton) {
- $sendButton.html('Sending...');
- $sendButton.attr('disabled',true);
- }
- var $cancelButton = $('#report-issue-cancel');
- if ($cancelButton) {
- $cancelButton.html('Close');
- }
- $('div').remove('.modal-footer-status');
- }).
- on('ajax:success', function() {
- var $sendButton = $('#report-issue-submit');
- if ($sendButton && $sendButton.prop('disabled')) {
- $sendButton.html('Report sent');
- $('div').remove('.modal-footer-status');
- $('.modal-footer').append('<div class="modal-footer-status alert alert-success"><div><p align="left">Thanks for reporting this issue!</p></div></div>');
- }
- }).
- on('ajax:failure', function() {
- var $sendButton = $('#report-issue-submit');
- if ($sendButton && $sendButton.prop('disabled')) {
- $('div').remove('.modal-footer-status');
- $('.modal-footer').append('<div class="modal-footer-status alert alert-danger"></br><p align="left">We are sorry. We could not submit your report! We really want this to work, though -- please try again.</p></div>');
- $sendButton.html('Report issue');
- $sendButton.attr('disabled',false);
- }
- var $cancelButton = $('#report-issue-cancel');
- if ($cancelButton) {
- var text = document.getElementById('report-issue-cancel').firstChild;
- $cancelButton.html('Cancel');
- }
- });
diff --git a/apps/workbench/test/integration/report_issue_test.rb b/apps/workbench/test/integration/report_issue_test.rb
index ce534ff..4b801da 100644
--- a/apps/workbench/test/integration/report_issue_test.rb
+++ b/apps/workbench/test/integration/report_issue_test.rb
@@ -27,21 +27,20 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
assert page.has_link?('Report a problem'), 'No link - Report a problem'
# check show version info link
- click_link 'Show version / debugging info'
+ click_link 'Show version / debugging info ...'
end
end
within '.modal-content' do
assert page.has_text?('Version / debugging info'), 'No text - Version / debugging info'
assert page.has_no_text?('Report a problem'), 'Found text - Report a problem'
- assert page.has_text?('Server version'), 'No text - Server version'
- assert page.has_text?('Server restarted at'), 'No text - Server restarted at'
+ assert page.has_text?('API version'), 'No text - API version'
+ assert page.has_text?('API startup time'), 'No text - API startup time'
assert page.has_text?('Workbench version'), 'No text - Workbench version'
- assert page.has_text?('Arvados base'), 'No text - Arvados base'
- assert page.has_text?('Additional info'), 'No text - Additional info'
+ assert page.has_text?('Workbench URI'), 'No text - Arvados base'
assert page.has_no_text?('Found a problem?'), 'Found text - Found a problem'
assert page.has_button?('Close'), 'No button - Close'
- assert page.has_no_button?('Report issue'), 'Found button - Report issue'
+ assert page.has_no_button?('Report a problem'), 'Found button - Report a problem'
click_button 'Close'
end
@@ -49,29 +48,28 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
within('.navbar-fixed-top') do
page.find("#arv-help").click
within('.dropdown-menu') do
- click_link 'Report a problem'
+ click_link 'Report a problem ...'
end
end
within '.modal-content' do
assert page.has_text?('Report a problem'), 'No text - Report a problem'
assert page.has_no_text?('Version / debugging info'), 'Found text - Version / debugging info'
- assert page.has_text?('Server version'), 'No text - Server version'
- assert page.has_text?('Server restarted at'), 'No text - Server restarted at'
+ assert page.has_text?('API version'), 'No text - API version'
+ assert page.has_text?('API startup time'), 'No text - API startup time'
assert page.has_text?('Workbench version'), 'No text - Workbench version'
- assert page.has_text?('Arvados base'), 'No text - Arvados base'
- assert page.has_text?('Additional info'), 'No text - Additional info'
+ assert page.has_text?('Workbench URI'), 'No text - Arvados base'
assert page.has_text?('Found a problem?'), 'No text - Found a problem'
assert page.has_no_button?('Close'), 'Found button - Close'
- assert page.has_button?('Report issue'), 'No button - Report issue'
+ assert page.has_button?('Report a problem'), 'No button - Report a problem'
assert page.has_button?('Cancel'), 'No button - Cancel'
# enter a report text and click on report
page.find_field('report_issue_text').set 'my test report text'
- click_button 'Report issue'
+ click_button 'Report a problem'
# ajax success updated button texts and added footer message
- assert page.has_no_button?('Report issue'), 'Found button - Report issue'
+ assert page.has_no_button?('Report a problem'), 'Found button - Report a problem'
assert page.has_no_button?('Cancel'), 'Found button - Cancel'
assert page.has_text?('Report sent'), 'No text - Report sent'
assert page.has_button?('Close'), 'No text - Close'
commit 63fedb562b719408600b3b42c51bf0cbe4713006
Author: radhika <radhika at curoverse.com>
Date: Wed Aug 20 18:38:02 2014 -0400
3112: use jquery syntax for find buttons
diff --git a/apps/workbench/app/views/application/report_issue_popup.js.erb b/apps/workbench/app/views/application/report_issue_popup.js.erb
index 93e9a5a..53edb4b 100644
--- a/apps/workbench/app/views/application/report_issue_popup.js.erb
+++ b/apps/workbench/app/views/application/report_issue_popup.js.erb
@@ -9,40 +9,36 @@ function reset_form() {
// ajax handling for report-issue function
$(document).
on('ajax:send', function() {
- var sendButton = document.getElementById('report-issue-submit');
- if (sendButton) {
- var text = document.getElementById('report-issue-submit').firstChild;
- text.data = "Sending...";
- sendButton.disabled = true;
+ var $sendButton = $('#report-issue-submit');
+ if ($sendButton) {
+ $sendButton.html('Sending...');
+ $sendButton.attr('disabled',true);
}
- var cancelButton = document.getElementById('report-issue-cancel');
- if (cancelButton) {
- var text = document.getElementById('report-issue-cancel').firstChild;
- text.data = "Close";
+ var $cancelButton = $('#report-issue-cancel');
+ if ($cancelButton) {
+ $cancelButton.html('Close');
}
$('div').remove('.modal-footer-status');
}).
on('ajax:success', function() {
- var sendButton = document.getElementById('report-issue-submit');
- if (sendButton && sendButton.disabled) {
- var text = document.getElementById('report-issue-submit').firstChild;
- text.data = "Report sent";
+ var $sendButton = $('#report-issue-submit');
+ if ($sendButton && $sendButton.prop('disabled')) {
+ $sendButton.html('Report sent');
$('div').remove('.modal-footer-status');
$('.modal-footer').append('<div class="modal-footer-status alert alert-success"><div><p align="left">Thanks for reporting this issue!</p></div></div>');
}
}).
on('ajax:failure', function() {
- var sendButton = document.getElementById('report-issue-submit');
- if (sendButton && sendButton.disabled) {
+ var $sendButton = $('#report-issue-submit');
+ if ($sendButton && $sendButton.prop('disabled')) {
$('div').remove('.modal-footer-status');
$('.modal-footer').append('<div class="modal-footer-status alert alert-danger"></br><p align="left">We are sorry. We could not submit your report! We really want this to work, though -- please try again.</p></div>');
- var text = document.getElementById('report-issue-submit').firstChild;
- text.data = "Report issue";
- sendButton.disabled = false;
+ $sendButton.html('Report issue');
+ $sendButton.attr('disabled',false);
}
- var cancelButton = document.getElementById('report-issue-cancel');
- if (cancelButton) {
+ var $cancelButton = $('#report-issue-cancel');
+ if ($cancelButton) {
var text = document.getElementById('report-issue-cancel').firstChild;
- text.data = "Cancel";
+ $cancelButton.html('Cancel');
}
});
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list