Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remnants of v2 code organization #720

Merged
merged 8 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes
12 changes: 3 additions & 9 deletions app/assets/images/android.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
13 changes: 7 additions & 6 deletions app/assets/images/clipboard_copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app/assets/images/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
7 changes: 6 additions & 1 deletion app/assets/images/download.svg
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
7 changes: 6 additions & 1 deletion app/assets/images/git_commit.svg
12 changes: 7 additions & 5 deletions app/assets/images/git_pull_request.svg
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
7 changes: 4 additions & 3 deletions app/assets/images/play.svg
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 0 additions & 4 deletions app/assets/images/v2/android.svg
Diff not rendered.
8 changes: 0 additions & 8 deletions app/assets/images/v2/clipboard_copy.svg
Diff not rendered.
3 changes: 0 additions & 3 deletions app/assets/images/v2/clock.svg
Diff not rendered.
6 changes: 0 additions & 6 deletions app/assets/images/v2/download.svg
Diff not rendered.
6 changes: 0 additions & 6 deletions app/assets/images/v2/git_commit.svg
Diff not rendered.
8 changes: 0 additions & 8 deletions app/assets/images/v2/git_pull_request.svg
Diff not rendered.
5 changes: 0 additions & 5 deletions app/assets/images/v2/play.svg
Diff not rendered.
1 change: 0 additions & 1 deletion app/assets/images/v2/plus.svg
Diff not rendered.
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<div class="group transform flex w-full <%= title_style %>" data-action="click->reveal#toggle">
<div class="flex items-center w-full gap-2 text-secondary focus:ring-4 focus:ring-main-200 dark:focus:ring-main dark:text-secondary-50">
<span data-accordion-reveal <%= "hidden" unless auto_hide %>>
<%= inline_svg("v2/plus.svg", classname: "w-4 h-4 fill-current") %>
<%= inline_svg("plus.svg", classname: "w-3 h-3 fill-current") %>
</span>

<span data-accordion-reveal <%= "hidden" if auto_hide %>>
<%= inline_svg("v2/plus.svg", classname: "w-4 h-4 fill-current rotate-45") %>
<%= inline_svg("plus.svg", classname: "w-3 h-3 fill-current rotate-45") %>
</span>

<span class="select-none flex-grow">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class V2::AccordionComponent < V2::BaseComponent
class AccordionComponent < BaseComponent
renders_one :title_section

def initialize(title: nil, auto_hide: true, push_down: false, acts_as_list: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
role="alert">
<div class="flex mr-6 gap-x-1 items-start">
<div class="flex justify-start gap-x-1 items-center">
<%= render V2::IconComponent.new("v2/info.svg", size: :md) %>
<%= render IconComponent.new("info.svg", size: :md) %>
<span class="font-semibold"><%= type.to_s.humanize %>:</span>
</div>
<%= title %>
</div>

<% if dismissible %>
<%= render V2::ButtonComponent.new(
<%= render ButtonComponent.new(
scheme: :naked_icon,
type: :action,
size: :none,
Expand All @@ -27,7 +27,7 @@
class="w-full <%= padding %> <%= style %> <%= border_style %> mb-4"
role="alert">
<div class="flex items-center">
<%= render V2::IconComponent.new("v2/info.svg", size: :md, classes: "mr-2") %>
<%= render IconComponent.new("info.svg", size: :md, classes: "mr-2") %>
<h3 class="heading-3 !text-inherit"><%= title %></h3>
</div>

Expand All @@ -38,20 +38,20 @@
<% if info? || dismissible %>
<div class="flex mt-4 gap-x-2">
<% if info? %>
<%= render V2::ButtonComponent.new(
<%= render ButtonComponent.new(
scheme: :none,
options: info[:link],
type: :link_external,
label: info[:label],
size: :none,
authz: false,
html_options: { class: ACTION_BUTTON_STYLES }) do |b|
b.with_icon("v2/eye.svg", size: :md, rounded: false)
b.with_icon("eye.svg", size: :md, rounded: false)
end %>
<% end %>

<% if dismissible %>
<%= render V2::ButtonComponent.new(
<%= render ButtonComponent.new(
scheme: :none,
type: :action,
size: :none,
Expand All @@ -66,7 +66,7 @@
<% elsif announcement? %>
<div class="w-full <%= padding %> <%= style %> <%= border_style %>">
<div class="flex items-center mb-2">
<%= render V2::IconComponent.new("v2/megaphone.svg", size: :lg, classes: "mr-2") %>
<%= render IconComponent.new("megaphone.svg", size: :lg, classes: "mr-2") %>
<h3 class="heading-3 !text-inherit"><%= title %></h3>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class V2::AlertComponent < V2::BaseComponent
class AlertComponent < BaseComponent
COLORS = {
notice: "text-blue-900 bg-blue-50 dark:bg-main-800 dark:text-blue-400",
error: "text-red-800 bg-red-50 dark:bg-main-800 dark:text-red-400",
Expand All @@ -21,9 +21,9 @@ class V2::AlertComponent < V2::BaseComponent

KINDS = [:alert, :banner, :announcement]

renders_one :banner_action, V2::ButtonComponent
renders_many :announcement_modals, V2::ModalComponent
renders_many :announcement_buttons, V2::ButtonComponent
renders_one :banner_action, ButtonComponent
renders_many :announcement_modals, ModalComponent
renders_many :announcement_buttons, ButtonComponent

def initialize(kind: :alert, type: :notice, title: "Alert", dismissible: false, info: nil, full_screen: true)
raise ArgumentError, "Invalid type" unless COLORS.key?(type.to_sym)
Expand Down
4 changes: 2 additions & 2 deletions app/components/all_builds_table_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@
<span>
<% if build.ci_link.present? %>
<%= link_to_external build.ci_link, title: "link to CI" do %>
<%= render V2::IconComponent.new("workflow.svg", size: :lg) %>
<%= render IconComponent.new("workflow.svg", size: :lg) %>
<% end %>
<% end %>

<% if build.download_url.present? %>
<%= link_to_external build.download_url, title: "download build" do %>
<%= render V2::IconComponent.new("download.svg", size: :lg) %>
<%= render IconComponent.new("download.svg", size: :lg) %>
<% end %>
<% end %>
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<%= render V2::ButtonComponent.new(scheme: :light,
<%= render ButtonComponent.new(scheme: :light,
options: path,
type: :link,
size: :xxs,
authz: false,
html_options: { class: "-ml-0.5",
data: link_data }) do |b| %>
<% b.with_tooltip(tooltip_text, placement: "right") %>
<% b.with_icon("v2/arrow_left.svg", size: :md) %>
<% b.with_icon("arrow_left.svg", size: :md) %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class V2::BackButtonComponent < V2::BaseComponent
class BackButtonComponent < BaseComponent
def initialize(path: nil, to: nil)
@path = path
@link_data = (!path) ? history_nav : {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class V2::BadgeComponent < V2::BaseComponent
renders_one :icon, V2::IconComponent
class BadgeComponent < BaseComponent
renders_one :icon, IconComponent
renders_one :link, ->(label, link) do
link_to_external(label, link, class: "hover:underline")
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class V2::BaseComponent < ViewComponent::Base
class BaseComponent < ViewComponent::Base
include ApplicationHelper
include LinkHelper
include AssetsHelper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class V2::BuildHealthComponent < ViewComponent::Base
class BuildHealthComponent < ViewComponent::Base
def initialize(builds)
@builds = builds
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class V2::ButtonComponent < V2::BaseComponent
class ButtonComponent < BaseComponent
include Memery

TYPES = %i[link link_external button dropdown action]
Expand Down Expand Up @@ -37,8 +37,8 @@ class V2::ButtonComponent < V2::BaseComponent
}

renders_one :title_text
renders_one :icon, V2::IconComponent
renders_one :tooltip, ->(text, **args) { V2::TooltipComponent.new(text, **args.merge(cursor: false)) }
renders_one :icon, IconComponent
renders_one :tooltip, ->(text, **args) { TooltipComponent.new(text, **args.merge(cursor: false)) }

def initialize(label: nil, scheme: :switcher, type: :button, size: :xxs, options: nil, html_options: nil, arrow: :none, authz: true, turbo: true, disabled: false, auto_label_case: true)
arrow = (scheme == :switcher) ? :double : arrow
Expand Down Expand Up @@ -173,6 +173,6 @@ def icon_only?

memoize def arrow
return if @arrow_type.eql?(:none)
V2::IconComponent.new(DROPDOWN_ARROW_STYLES[@arrow_type], size: :sm, classes: "ml-2")
IconComponent.new(DROPDOWN_ARROW_STYLES[@arrow_type], size: :sm, classes: "ml-2")
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<div class="flex flex-row items-center justify-between">
<div class="flex items-center">
<% if fold? && !emptiness %>
<%= render V2::ButtonComponent.new(
<%= render ButtonComponent.new(
scheme: :naked_icon,
type: :action,
authz: false,
html_options: fold_button_params,
size: :none) do |b|
b.with_icon("v2/unfold_vertical.svg", size: :sm)
b.with_icon("unfold_vertical.svg", size: :sm)
b.with_tooltip("Fold / unfold", placement: "top")
end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class V2::CardComponent < ViewComponent::Base
class CardComponent < ViewComponent::Base
renders_many :actions
renders_one :empty_state, ->(**args) {
empty_state_params = {type: :tiny}.merge(**args)
V2::EmptyStateComponent.new(**empty_state_params)
EmptyStateComponent.new(**empty_state_params)
}

SIZE = {
Expand Down
4 changes: 2 additions & 2 deletions app/components/chart_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if chart.present? %>
<%= render V2::CardComponent.new(title: title,
<%= render CardComponent.new(title: title,
subtitle: chart_scope,
fold: false,
separator: false,
Expand All @@ -12,7 +12,7 @@
<% end %>

<% card.with_empty_state(text: "Waiting for more data",
banner_image: "v2/clock.svg",
banner_image: "clock.svg",
type: :subdued) %>

<% unless insufficient? %>
Expand Down
8 changes: 4 additions & 4 deletions app/components/chart_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ChartComponent < V2::BaseComponent
class ChartComponent < BaseComponent
using RefinedHash
CHART_TYPES = %w[area line stacked-bar polar-area]
InvalidChartType = Class.new(StandardError)
Expand Down Expand Up @@ -94,18 +94,18 @@ def help_link

def corner_icon
if help_text.present?
icon = V2::IconComponent.new("v2/info.svg", size: :md, classes: "text-secondary")
icon = IconComponent.new("info.svg", size: :md, classes: "text-secondary")
icon.with_tooltip(help_text, placement: "top", type: :detailed) do |tooltip|
tooltip.with_detailed_text do
content_tag(:div, nil, class: "flex flex-col gap-y-4 items-start") do
concat simple_format(help_text)
if help_link.present?
concat render(V2::ButtonComponent.new(scheme: :link,
concat render(ButtonComponent.new(scheme: :link,
label: "Learn more",
options: help_link,
type: :link_external,
size: :none,
authz: false) { |b| b.with_icon("v2/arrow_right.svg") })
authz: false) { |b| b.with_icon("arrow_right.svg") })
end
end
end
Expand Down
Loading
Loading