This repository has been archived by the owner on Sep 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from abenari/repo-show
Add some ui elements
- Loading branch information
Showing
11 changed files
with
208 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module Content | ||
module RepositoriesHelper | ||
|
||
def sync_status repo | ||
status = repo.sync_status | ||
status = if status && status.first | ||
status.first[:state] | ||
else | ||
details = repo.retrieve_with_details | ||
details[:importers][0][:last_sync] if details && details[:importers] && details[:importers][0] | ||
end | ||
"#{time_ago_in_words(status)} ago" rescue status | ||
rescue | ||
'-' | ||
end | ||
|
||
def last_publish details | ||
return '' unless details[:distributors] && details[:distributors].first && published = details[:distributors].first[:last_publish] | ||
"#{time_ago_in_words published} ago" rescue '' | ||
end | ||
|
||
def last_sync details | ||
return '' unless details[:importers] && details[:importers].first && synced = details[:importers].first[:last_sync] | ||
"#{time_ago_in_words synced} ago" rescue '' | ||
end | ||
|
||
def sync_history_times history | ||
return {} unless history && history.first && summary = history.first['summary'] | ||
return {} unless summary[:comps] | ||
{ | ||
:comps => summary[:comps][:time_total_sec], | ||
:errata => summary[:errata][:errata_time_total_sec], | ||
:packages => summary[:packages][:time_total_sec] | ||
} | ||
end | ||
|
||
def sync_history_metrics history | ||
return {} unless history && last = history.first | ||
{ | ||
:updated => last[:updated_count], | ||
:removed => last[:removed_count], | ||
:added => last[:added_count] | ||
} | ||
end | ||
|
||
def sync_history_status history | ||
return {} unless history && last = history.first | ||
{ | ||
'result' => last[:result], | ||
'message' => last[:error_message] || last['summary']['error'], | ||
'completed' => ("#{time_ago_in_words(last[:completed])} ago" rescue '') | ||
} | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<% javascript 'charts' %> | ||
<% title @repository.to_label %> | ||
<%= title_actions(button_group( | ||
link_to_if_authorized(_("Edit"), hash_for_edit_repository_path(@repository)), | ||
link_to_if_authorized(_("Synchronize"), hash_for_sync_repository_path(@repository), :method => :put) | ||
)) %> | ||
<div class="row"> | ||
<div class="span12"> | ||
<table class="table table-bordered table-striped"> | ||
<tr> | ||
<th><%= _('Repository details') %></th> | ||
<th></th> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Name") %> </td> | ||
<td> <%= @repository.to_label %> </td> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Description") %> </td> | ||
<td> <%= @repository.description %> </td> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Feed") %> </td> | ||
<td> <%= @repository.feed %> </td> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Content type") %> </td> | ||
<td> <%= @repository.content_type %> </td> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Architecture") %> </td> | ||
<td> <%= @repository.architecture %> </td> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Enabled") %> </td> | ||
<td> <%= @repository.enabled %> </td> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Unprotected") %> </td> | ||
<td> <%= @repository.unprotected %> </td> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Full path") %> </td> | ||
<td> <%= @repository.full_path %> </td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
<div class="row-fluid"> | ||
<div class="stats-well span4"> | ||
<h4 class="ca" ><%= _('Last Update Metrics') -%></h4> | ||
<div style="margin-top:50px;padding-bottom: 40px;"> | ||
<%= flot_pie_chart("metrics" ,_("Last Update Metrics"), sync_history_times(@sync_history), :class => "statistics-pie small")%> | ||
</div> | ||
</div> | ||
<div class="stats-well span4"> | ||
<h4 class="ca" ><%= _('Update Summary') -%></h4> | ||
<%= flot_bar_chart("status" ,"", _("Number of packages"), sync_history_metrics(@sync_history), :class => "statistics-bar")%> | ||
</div> | ||
|
||
<div class="span4"> | ||
<table class="table table-bordered table-striped"> | ||
<tr> | ||
<th><%= _('Repository Counters') %></th> | ||
<th></th> | ||
</tr> | ||
<% @details[:content_unit_counts].each do |name, value| -%> | ||
<tr> | ||
<td> <%= name.humanize %> </td> | ||
<td> <%= value %> </td> | ||
</tr> | ||
<% end -%> | ||
<tr> | ||
<td> <%= _("Last published") %> </td> | ||
<td> <%= last_publish @details %> </td> | ||
</tr> | ||
<tr> | ||
<td> <%= _("Last synchronized") %> </td> | ||
<td> <%= last_sync @details %> </td> | ||
</tr> | ||
</table> | ||
</div> | ||
<div class="span4"> | ||
<table class="table table-bordered table-striped"> | ||
<tr> | ||
<th><%= _('Last Sync') %></th> | ||
<th></th> | ||
</tr> | ||
<% sync_history_status(@sync_history).each do |name, value| -%> | ||
<tr> | ||
<td> <%= name.humanize %> </td> | ||
<td> <%= value %> </td> | ||
</tr> | ||
<% end -%> | ||
</table> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,9 @@ | |
collection do | ||
get 'auto_complete_search' | ||
end | ||
member do | ||
put :sync | ||
end | ||
end | ||
|
||
resources :repositories do | ||
|