From ef452ea6d75c71d783d985fa4465265c51b39f3c Mon Sep 17 00:00:00 2001 From: Nivedita Priyadarshini Date: Mon, 4 Mar 2024 00:00:23 +0530 Subject: [PATCH] scheduled release badge and description, minor staged rollout fix --- app/assets/images/v2/person_standing.svg | 7 +++++++ app/assets/images/v2/robot.svg | 9 +++++++++ app/components/release_monitoring_component.rb | 3 ++- app/components/v2/base_release_component.rb | 15 +++++++++++++++ app/components/v2/release_list_component.html.erb | 3 ++- app/components/v2/release_list_component.rb | 10 ++++++++++ .../v2/release_overview_component.html.erb | 1 + app/models/staged_rollout.rb | 1 + 8 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/v2/person_standing.svg create mode 100644 app/assets/images/v2/robot.svg diff --git a/app/assets/images/v2/person_standing.svg b/app/assets/images/v2/person_standing.svg new file mode 100644 index 000000000..0ba2dc302 --- /dev/null +++ b/app/assets/images/v2/person_standing.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/app/assets/images/v2/robot.svg b/app/assets/images/v2/robot.svg new file mode 100644 index 000000000..ae7892049 --- /dev/null +++ b/app/assets/images/v2/robot.svg @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/app/components/release_monitoring_component.rb b/app/components/release_monitoring_component.rb index 34661b2ac..6c0a680b2 100644 --- a/app/components/release_monitoring_component.rb +++ b/app/components/release_monitoring_component.rb @@ -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 diff --git a/app/components/v2/base_release_component.rb b/app/components/v2/base_release_component.rb index cf4ea36d9..a66199ac6 100644 --- a/app/components/v2/base_release_component.rb +++ b/app/components/v2/base_release_component.rb @@ -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 } diff --git a/app/components/v2/release_list_component.html.erb b/app/components/v2/release_list_component.html.erb index 8e3b7151a..ab84d91f2 100644 --- a/app/components/v2/release_list_component.html.erb +++ b/app/components/v2/release_list_component.html.erb @@ -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", @@ -170,6 +170,7 @@
<%= 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? %>
<% end %> diff --git a/app/components/v2/release_list_component.rb b/app/components/v2/release_list_component.rb index 1ca5ea495..fbfe3eb2e 100644 --- a/app/components/v2/release_list_component.rb +++ b/app/components/v2/release_list_component.rb @@ -1,5 +1,6 @@ class V2::ReleaseListComponent < V2::BaseComponent include Memery + include TrainsHelper def initialize(train:) @train = train @@ -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) diff --git a/app/components/v2/release_overview_component.html.erb b/app/components/v2/release_overview_component.html.erb index 2023da38f..a7313665c 100644 --- a/app/components/v2/release_overview_component.html.erb +++ b/app/components/v2/release_overview_component.html.erb @@ -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? %>
diff --git a/app/models/staged_rollout.rb b/app/models/staged_rollout.rb index d4a336e1f..87c1a1f28 100644 --- a/app/models/staged_rollout.rb +++ b/app/models/staged_rollout.rb @@ -85,6 +85,7 @@ class StagedRollout < ApplicationRecord end def display_current_stage + return 0 if created? (current_stage || 0).succ end