Skip to content

Commit

Permalink
scheduled release badge and description, minor staged rollout fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nid90 committed Mar 3, 2024
1 parent 4f4a22c commit ef452ea
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/assets/images/v2/person_standing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/assets/images/v2/robot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion app/components/release_monitoring_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def release_health_class
end

def staged_rollout_percentage
staged_rollout&.last_rollout_percentage || Deployment::FULL_ROLLOUT_VALUE
return Deployment::FULL_ROLLOUT_VALUE unless staged_rollout
staged_rollout.last_rollout_percentage || 0
end

def staged_rollout_text
Expand Down
15 changes: 15 additions & 0 deletions app/components/v2/base_release_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ def hotfix_badge
end
end

def scheduled_badge
if @release.is_automatic?
badge = V2::BadgeComponent.new("Automatic")
badge.with_icon("v2/robot.svg")
else
badge = V2::BadgeComponent.new("Manual")
badge.with_icon("v2/person_standing.svg")
end
badge
end

def automatic?
@release.train.automatic?
end

def step_summary(platform)
@step_summary ||= Queries::ReleaseSummary::StepsSummary.from_release(@release).all
platform_steps = @step_summary.select { |step| step.platform_raw == platform }
Expand Down
3 changes: 2 additions & 1 deletion app/components/v2/release_list_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render V2::ContainerComponent.new(title: train.name, subtitle: train.description) do |container| %>
<%= render V2::ContainerComponent.new(title: train.name, subtitle: description) do |container| %>
<% if train.hotfixable? %>
<% container.with_action do %>
<%= render V2::ModalComponent.new(title: "Start a hotfix release",
Expand Down Expand Up @@ -170,6 +170,7 @@
<div class="flex space-x-2">
<%= render V2::StatusIndicatorPillComponent.new(text: release_component.status[0], status: release_component.status[1]) %>
<%= render(release_component.hotfix_badge) unless release_component.hotfix_badge.nil? %>
<%= render(release_component.scheduled_badge) if release_component.automatic? %>
</div>
<% end %>

Expand Down
10 changes: 10 additions & 0 deletions app/components/v2/release_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class V2::ReleaseListComponent < V2::BaseComponent
include Memery
include TrainsHelper

def initialize(train:)
@train = train
Expand Down Expand Up @@ -95,6 +96,15 @@ def empty_state
end
end

def description
base = train.description || ""
if train.automatic?
base += " • " if base.present?
base += release_schedule(train)
end
base
end

private

def start_release_text(major: false)
Expand Down
1 change: 1 addition & 0 deletions app/components/v2/release_overview_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

<%= render V2::StatusIndicatorPillComponent.new(text: status.first, status: status.second) %>
<%= render(hotfix_badge) unless hotfix_badge.nil? %>
<%= render(scheduled_badge) if automatic? %>
</div>

<div>
Expand Down
1 change: 1 addition & 0 deletions app/models/staged_rollout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class StagedRollout < ApplicationRecord
end

def display_current_stage
return 0 if created?
(current_stage || 0).succ
end

Expand Down

0 comments on commit ef452ea

Please sign in to comment.