aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <max@magorsch.de>2019-09-06 00:04:32 +0200
committerMax Magorsch <max@magorsch.de>2019-09-06 00:04:32 +0200
commitb0f938ad1d88164aabb9943053dec4617e5bd678 (patch)
tree339d6a854800b52ebe97dc1e8c57fbe3d48df0b4 /app/views/packages/_changelog_entry.html.erb
parentRun the initialization scripts using docker-compose (diff)
downloadpackages-5-b0f938ad1d88164aabb9943053dec4617e5bd678.tar.gz
packages-5-b0f938ad1d88164aabb9943053dec4617e5bd678.tar.bz2
packages-5-b0f938ad1d88164aabb9943053dec4617e5bd678.zip
Add an ES index containing the git commits
So far, any history-related information has been fetched using git. That is, whenever a user requested any history-related information 'git log' was run and the output was parsed. That is time-consuming. Loading the page https://packages.gentoo.org/packages/keyworded takes around 120 seconds this way. Instead of doing so, any git commits are now added to an ES index and retrieved using ES. This way, the same page as mentioned before, loads in under 3 seconds. The commits for populating the index are fetched incrementally. This way, the first run may take some time, but afterwards, updates are fast. Signed-off-by: Max Magorsch <max@magorsch.de>
Diffstat (limited to 'app/views/packages/_changelog_entry.html.erb')
-rw-r--r--app/views/packages/_changelog_entry.html.erb21
1 files changed, 11 insertions, 10 deletions
diff --git a/app/views/packages/_changelog_entry.html.erb b/app/views/packages/_changelog_entry.html.erb
index e592f89..17a6e66 100644
--- a/app/views/packages/_changelog_entry.html.erb
+++ b/app/views/packages/_changelog_entry.html.erb
@@ -1,28 +1,29 @@
<li class="list-group-item">
- <strong><%= annotate_bugs changelog[:message].lines.first %></strong>
+ <strong><%= annotate_bugs changelog.message.lines.first %></strong>
<div class="kk-byline">
- <%= mail_to changelog[:email], changelog[:author] %>,
- <%= i18n_date(changelog[:date]) %>,
- commit&nbsp;<%= link_to_gitweb_commit changelog[:id]%>
+ <%= mail_to changelog.email, changelog.author %>,
+ <%= i18n_date(changelog.date) %>,
+ commit&nbsp;<%= link_to_gitweb_commit changelog.id%>
</div>
<table class="table table-condensed kk-changelog-diffstat">
- <% unless changelog[:files][:added].empty? %>
+
+ <% unless changelog.files["added"].empty? %>
<tr class="success">
<td class="kk-changelog-diffstat-icon"><span class="octicon octicon-diff-added"></span></td>
- <td><%= safe_join(changelog[:files][:added].map {|f| link_to_gitweb_ebuild_diff(f, changelog[:id], @package.category, @package.name) }, ', ') %></td>
+ <td><%= safe_join(changelog.files["added"].select { |file| file.include?(@package.category + '/' + @package.name) }.map {|f| link_to_gitweb_ebuild_diff(f.split('/').last, changelog.id, @package.category, @package.name) }, ', ') %></td>
</tr>
<% end %>
- <% unless changelog[:files][:modified].empty? %>
+ <% unless changelog.files["modified"].empty? %>
<tr class="warning">
<td class="kk-changelog-diffstat-icon"><span class="octicon octicon-diff-modified"></span></td>
- <td><%= safe_join(changelog[:files][:modified].map {|f| link_to_gitweb_ebuild_diff(f, changelog[:id], @package.category, @package.name) }, ', ') %></td>
+ <td><%= safe_join(changelog.files["modified"].select { |file| file.include?(@package.category + '/' + @package.name) }.map {|f| link_to_gitweb_ebuild_diff(f.split('/').last, changelog.id, @package.category, @package.name) }, ', ') %></td>
</tr>
<% end %>
- <% unless changelog[:files][:deleted].empty? %>
+ <% unless changelog.files["deleted"].empty? %>
<tr class="danger">
<td class="kk-changelog-diffstat-icon"><span class="octicon octicon-diff-removed"></span></td>
- <td><%= safe_join(changelog[:files][:deleted].map {|f| link_to_gitweb_ebuild_diff(f, changelog[:id], @package.category, @package.name) }, ', ') %></td>
+ <td><%= safe_join(changelog.files["deleted"].select { |file| file.include?(@package.category + '/' + @package.name) }.map {|f| link_to_gitweb_ebuild_diff(f.split('/').last, changelog.id, @package.category, @package.name) }, ', ') %></td>
</tr>
<% end %>