Skip to content

Commit

Permalink
minor changes in how hotfixes are listed (incomplete)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitallis committed Nov 18, 2023
1 parent da4979e commit 2fb464e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
5 changes: 5 additions & 0 deletions app/components/final_summary_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
</div>
<% end %>

<div class="flex flex-col text-center items-center justify-center">
<dt class="mb-2 text-xl font-extrabold"><%= overall.hotfixes %></dt>
<dd class="text-gray-500">Hotfixes</dd>
</div>

<% if backmerges? %>
<div class="flex flex-col text-center items-center justify-center">
<dt class="mb-2 text-xl font-extrabold"><%= overall.backmerge_pr_count %></dt>
Expand Down
4 changes: 3 additions & 1 deletion app/libs/queries/release_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class Queries::ReleaseSummary::Overall
attribute :duration, :integer
attribute :is_hotfix, :boolean
attribute :hotfixed_from, :string
attribute :hotfixes, :string

def self.from_release(release)
attributes = {
Expand All @@ -83,7 +84,8 @@ def self.from_release(release)
backmerge_failure_count: release.backmerge_failure_count,
commits_count: release.all_commits.size,
duration: release.duration&.seconds,
is_hotfix: release.hotfix?
is_hotfix: release.hotfix?,
hotfixes: release.hotfixes.map(&:release_version).join(",")
}

if release.hotfix?
Expand Down
4 changes: 4 additions & 0 deletions app/models/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ def retrigger_for_hotfix?
hotfix? && !new_hotfix_branch?
end

def hotfixes
app.releases.hotfix.where(hotfixed_from: self)
end

private

def base_tag_name
Expand Down
36 changes: 21 additions & 15 deletions app/views/trains/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<% end %>
<% elsif @train.manually_startable? %>
<%= authz_button_to :blue, start_release_text(@train), app_train_releases_path(@app, @train) %>
<%= authz_button_to :amber, start_release_text(@train, major: true), app_train_releases_path(@app, @train), { params: { release: { has_major_bump: true } } } %>
<%= authz_button_to :amber, start_release_text(@train, major: true), app_train_releases_path(@app, @train), { params: { release: { has_major_bump: true } } } %>
<% end %>
<% if @train.hotfixable? %>
<div data-controller="modal">
Expand Down Expand Up @@ -155,37 +155,43 @@
<% row.with_cell do %>
<%= link_to release_path(run.id) do %>
<span class="underline">
<% if run.hotfix? %>
<%= inline_svg("band_aid.svg", classname: "w-6 pr-2 opacity-80 inline-flex align-center") %>
<% end %>
<% if run.completed_at %>
<code><%= run.release_version %></code><%= " on #{time_format(run.completed_at, with_time: false)}" %>
<% else %>
<code><%= version_in_progress(run.release_version) %></code>
<% end %>
<% if run.hotfix? %>
(from 1.0.0)
<% end %>
</span>
<% end %>
<% end %>

<% row.with_cell do %>
<span class="py-0.5"><%= release_status_badge(run.status) %></span>
<% if run.is_automatic? %>
<span class="ml-2 py-0.5"><%= status_badge("automatic", :neutral) %></span>
<% end %>
<% if run.upcoming? %>
<span class="ml-2 py-0.5"><%= status_badge("upcoming", :neutral) %></span>
<% end %>
<% if run.ongoing? %>
<span class="ml-2 py-0.5"><%= status_badge("ongoing", :routine) %></span>
<% end %>
<% if run.hotfix? %>
<span class="ml-2 py-0.5"><%= status_badge("hotfix", :routine) %></span>
<% end %>
<div>
<span class="py-0.5"><%= release_status_badge(run.status) %></span>
<% if run.is_automatic? %>
<span class="ml-2 py-0.5"><%= status_badge("automatic", :neutral) %></span>
<% end %>
<% if run.upcoming? %>
<span class="ml-2 py-0.5"><%= status_badge("upcoming", :neutral) %></span>
<% end %>
<% if run.ongoing? %>
<span class="ml-2 py-0.5"><%= status_badge("ongoing", :routine) %></span>
<% end %>
</div>
<% end %>

<% row.with_cell do %>
<%= run.branch_name %>
<%= time_format run.scheduled_at, with_time: false %>
<% end %>
<% end %>
<% end %>
<% end %>

<% else %>
<h2 class="text-2xl font-bold mb-4">Releases</h2>
<span class="text-sm text-slate-400">
Expand Down

0 comments on commit 2fb464e

Please sign in to comment.