diff --git a/src/api/app/helpers/webui/webui_helper.rb b/src/api/app/helpers/webui/webui_helper.rb index d26df9634ad..0d9faef3b49 100644 --- a/src/api/app/helpers/webui/webui_helper.rb +++ b/src/api/app/helpers/webui/webui_helper.rb @@ -111,6 +111,14 @@ def format_projectname(prjname, login) 'scheduling' => 'The repository state is being calculated right now' }.freeze + def repo_status_description(status) + REPO_STATUS_DESCRIPTIONS[status] || 'Unknown state of repository' + end + + def webui2_repo_status_icon(status) + WEBUI2_REPO_STATUS_ICONS[status] || 'eye' + end + def check_first(first) first.nil? ? true : nil end @@ -118,7 +126,6 @@ def check_first(first) # TODO: bento_only def repo_status_icon(status, details = nil) icon = REPO_STATUS_ICONS[status] || 'eye' - outdated = nil if /^outdated_/.match?(status) status.gsub!(%r{^outdated_}, '') @@ -135,19 +142,14 @@ def repo_status_icon(status, details = nil) def webui2_repository_status_icon(status:, details: nil, html_class: '') outdated = status.sub!(/^outdated_/, '') description = outdated ? 'State needs recalculations, former state was: ' : '' - description << REPO_STATUS_DESCRIPTIONS[status] || 'Unknown state of repository' + description << repo_status_description(status) description << " (#{details})" if details repo_state_class = outdated ? 'outdated' : 'default' - content_tag(:i, '', class: "repository-state-#{repo_state_class} #{html_class} #{webui2_repo_status_icon(status)}", + content_tag(:i, '', class: "repository-state-#{repo_state_class} #{html_class} fas fa-#{webui2_repo_status_icon(status)}", data: { content: description, placement: 'top', toggle: 'popover' }) end - def webui2_repo_status_icon(status) - icon = WEBUI2_REPO_STATUS_ICONS[status] || 'eye' - "fas fa-#{icon}" - end - # TODO: bento_only def tab(id, text, opts) opts[:package] = @package.to_s if @package