Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #7979 - adding better error reporting for repo enable ui #4753

Merged
merged 1 commit into from Oct 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/assets/javascripts/katello/providers/provider_redhat.js
Expand Up @@ -67,6 +67,7 @@ KT.redhat_provider_page = (function($) {

$(checkbox).hide();
$('#spinner_'+id).removeClass('hidden').show();
checkbox.parent().parent().siblings().first().find('.errors').remove();
$.ajax({
type: "PUT",
url: url,
Expand All @@ -80,6 +81,11 @@ KT.redhat_provider_page = (function($) {
else {
set_checkbox.attr('disabled','disabled');
}
},
error: function(data) {
checkbox.parent().parent().siblings().first().append(data.responseText);
$(checkbox).removeClass('hidden').show().attr('checked', false);
$('#spinner_'+id).addClass('hidden').hide();
}
});
return false;
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/katello/contents.scss
Expand Up @@ -569,6 +569,9 @@ $container_width: ($static_width/2) - 36;
}
}
tbody {
a {
color: $linkfg_color
}
tr {
background: $white_color;
}
Expand Down
40 changes: 20 additions & 20 deletions app/assets/stylesheets/katello/widgets/tabs.scss
Expand Up @@ -17,6 +17,26 @@
padding: 0px;
.ui-tabs-nav {
background: $lightergrey_color;
a {
cursor: pointer;
text-transform: none;
text-decoration: none;
@include text-shadow(0 1px 0 rgba($white_color, 1));
display: block;
margin: 0;
padding: 8px 16px 6px;
color: $taboff_color;
float: left;
font-weight: bold;
&.selected {
color: $tabon_color;
font-weight: bold;
border-bottom: 3px solid $kselected_color;
padding-bottom: 3px;
}

&:hover { color: lighten($kselected_color,10%); }
}
}
.ui-tabs-panel {
padding: 0px;
Expand All @@ -37,26 +57,6 @@
color: $tabon_color;
font-weight: bold;
}
a {
cursor: pointer;
text-transform: none;
text-decoration: none;
@include text-shadow(0 1px 0 rgba($white_color, 1));
display: block;
margin: 0;
padding: 8px 16px 6px;
color: $taboff_color;
float: left;
font-weight: bold;
&.selected {
color: $tabon_color;
font-weight: bold;
border-bottom: 3px solid $kselected_color;
padding-bottom: 3px;
}

&:hover { color: lighten($kselected_color,10%); }
}

.icon_wrap {
padding-top: 2px;
Expand Down
12 changes: 11 additions & 1 deletion app/controllers/katello/products_controller.rb
Expand Up @@ -29,7 +29,11 @@ def available_repositories
render_bad_parameters _('Repository sets are not available for custom products.')
else
task = sync_task(::Actions::Katello::RepositorySet::ScanCdn, @product, params[:content_id])
render :partial => 'katello/providers/redhat/repos', :locals => { :scan_cdn => task }
if task.result == 'warning'
render :partial => 'katello/providers/redhat/errors', :locals => { :error_message => task_error(task), :task => task}
else
render :partial => 'katello/providers/redhat/repos', :locals => { :scan_cdn => task }
end
end
end

Expand All @@ -41,6 +45,8 @@ def toggle_repository
end
task = sync_task(action_class, @product, @content, substitutions)
render :json => { :task_id => task.id }
rescue => e
render :partial => 'katello/providers/redhat/enable_errors', :locals => { :error_message => e.message}, :status => 500
end

def auto_complete
Expand Down Expand Up @@ -88,5 +94,9 @@ def substitutions
params.slice(:basearch, :releasever)
end

def task_error(task)
task.failed_steps.first.action(task.execution_plan).steps.map { |s| s.try(:error).try(:message) }.reject(&:blank?).join(', ')
end

end
end
9 changes: 9 additions & 0 deletions app/views/katello/providers/redhat/_enable_errors.haml
@@ -0,0 +1,9 @@
%span.errors
%br
%i.icon-exclamation-sign
= _("There was an error attempting to enable or disable this repository:")
%pre
= error_message
= _("For more information see ")
%a{:href => main_app.foreman_tasks_tasks_path}
= _("the related failed task.")
13 changes: 13 additions & 0 deletions app/views/katello/providers/redhat/_errors.html.haml
@@ -0,0 +1,13 @@
%table.repo_table{:style=>'display: none;'}
%thead
%th
= _('Errors')
%tbody
%td
%i.icon-exclamation-sign
= _("There was an error attempting to retrieve the repository list:")
%pre
= error_message
= _("For more information see ")
%a{:href => main_app.foreman_tasks_task_path(task.id)}
= _("the failed task.")