Skip to content

Commit e998bfb

Browse files
committed
Update styles and filtering
1 parent 1d2a667 commit e998bfb

File tree

12 files changed

+47
-18
lines changed

12 files changed

+47
-18
lines changed

app/assets/stylesheets/rails_pulse/components/tags.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
flex-wrap: wrap;
2727
}
2828

29+
.tag-list span {
30+
padding-right: 3px !important;
31+
}
32+
2933
/* Individual Tag */
3034
.tag {
3135
display: inline-flex;
@@ -63,9 +67,10 @@
6367
}
6468

6569
.tag-remove span {
66-
font-size: 1.25rem;
6770
line-height: 1;
68-
font-weight: bold;
71+
font-weight: inherit;
72+
margin-left: 6px;
73+
font-size: 17px;
6974
}
7075

7176
/* Add Tag Container */

app/controllers/rails_pulse/jobs_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def setup_metric_cards
7575
return if turbo_frame_request?
7676

7777
# Pass the job to scope the cards to the current job on the show page
78-
@total_jobs_metric_card = RailsPulse::Jobs::Cards::TotalJobs.new(job: @job).to_metric_card
7978
@total_runs_metric_card = RailsPulse::Jobs::Cards::TotalRuns.new(job: @job).to_metric_card
8079
@failure_rate_metric_card = RailsPulse::Jobs::Cards::FailureRate.new(job: @job).to_metric_card
8180
@average_duration_metric_card = RailsPulse::Jobs::Cards::AverageDuration.new(job: @job).to_metric_card

app/helpers/rails_pulse/status_helper.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,5 +281,21 @@ def duration_options(type = :route)
281281
[ "Critical (≥ #{thresholds[:critical]}ms)", :critical ]
282282
]
283283
end
284+
285+
def duration_threshold_filter_options(type = :route)
286+
thresholds = RailsPulse.configuration.public_send("#{type}_thresholds")
287+
288+
all_label =
289+
case type
290+
when :job then "All Job Runs"
291+
else "All #{type.to_s.humanize.pluralize}"
292+
end
293+
294+
threshold_options = thresholds.map do |name, value|
295+
[ "#{name.to_s.humanize} (≥ #{value}ms)", value ]
296+
end.sort_by { |_, value| value }
297+
298+
[[ all_label, nil ]] + threshold_options
299+
end
284300
end
285301
end

app/helpers/rails_pulse/tags_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def display_tag_badges(tags)
6161

6262
return content_tag(:span, "-", class: "text-subtle") if tag_array.empty?
6363

64-
safe_join(tag_array.map { |tag| content_tag(:div, tag, class: "badge") }, " ")
64+
safe_join(tag_array.map { |tag| content_tag(:div, tag.humanize, class: "badge") }, " ")
6565
end
6666
end
6767
end

app/views/rails_pulse/components/_active_filters.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<% has_any_filters = has_date_filters || has_performance_filter || has_tag_filters %>
77

88
<% if has_any_filters %>
9-
<div class="flex items-center gap text-sm">
10-
Filtered:
9+
<div class="flex items-center gap text-sm card pi-3 pb-2 shadow-xs">
10+
Global Filters:
1111
<% if has_date_filters %>
1212
<% start_time = Time.parse(global_filters['start_time']) %>
1313
<% end_time = Time.parse(global_filters['end_time']) %>

app/views/rails_pulse/components/_page_header.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@
1313
</nav>
1414

1515
<% if (defined?(taggable) && taggable.present?) || (defined?(show_active_filters) && show_active_filters) %>
16-
<div class="breadcrumb-tags">
16+
<div class="breadcrumb-tags gap">
1717
<% if defined?(show_active_filters) && show_active_filters %>
1818
<%= render 'rails_pulse/components/active_filters' %>
1919
<% end %>
20-
<% if defined?(show_active_filters) && show_active_filters && defined?(taggable) && taggable.present? %>
21-
<div class="breadcrumb-separator mi-4">|</div>
22-
<% end %>
2320
<% if defined?(taggable) && taggable.present? %>
2421
<%= render 'rails_pulse/tags/tag_manager', taggable: taggable %>
2522
<% end %>

app/views/rails_pulse/dashboard/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="flex justify-end mb-1">
1+
<div class="flex justify-end">
22
<%= render 'rails_pulse/components/active_filters' %>
33
</div>
44

app/views/rails_pulse/jobs/index.html.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<% unless turbo_frame_request? %>
44
<div class="row">
5-
<%= render 'rails_pulse/components/metric_card', { class: "grid-item block", data: @total_jobs_metric_card } %>
65
<%= render 'rails_pulse/components/metric_card', { class: "grid-item block", data: @total_runs_metric_card } %>
76
<%= render 'rails_pulse/components/metric_card', { class: "grid-item block", data: @failure_rate_metric_card } %>
87
<%= render 'rails_pulse/components/metric_card', { class: "grid-item block", data: @average_duration_metric_card } %>

app/views/rails_pulse/jobs/show.html.erb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<% unless turbo_frame_request? %>
44
<div class="row">
5-
<%= render 'rails_pulse/components/metric_card', { class: "grid-item block", data: @total_jobs_metric_card } %>
65
<%= render 'rails_pulse/components/metric_card', { class: "grid-item block", data: @total_runs_metric_card } %>
76
<%= render 'rails_pulse/components/metric_card', { class: "grid-item block", data: @failure_rate_metric_card } %>
87
<%= render 'rails_pulse/components/metric_card', { class: "grid-item block", data: @average_duration_metric_card } %>
@@ -27,6 +26,12 @@
2726
{ class: "input" }
2827
%>
2928

29+
<%= form.select :duration_gteq,
30+
duration_threshold_filter_options(:job),
31+
{ selected: params.dig(:q, :duration_gteq) },
32+
{ class: "input" }
33+
%>
34+
3035
<%= link_to "Reset", job_path(@job), class: "btn btn--borderless show@md" if params.has_key?(:q) %>
3136
<%= form.submit "Search", class: "btn show@sm" %>
3237
</div>

app/views/rails_pulse/tags/_tag_manager.html.erb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77

88
<div
99
id="tag_manager_<%= taggable_type %>_<%= taggable.id %>"
10-
class="tag-manager"
10+
class="tag-manager card pi-3 pb-2 text-sm shadow-xs"
1111
>
12+
<% if current_tags.present? %>
13+
Tags:
14+
<% end %>
1215
<div class="tag-list">
1316
<% current_tags.each do |tag| %>
1417
<%= render_tag_badge(tag, variant: :secondary, removable: true, taggable_type: taggable_type, taggable_id: taggable.id) %>
@@ -52,7 +55,7 @@
5255
},
5356
style: "cursor: pointer;",
5457
role: "menuitem" do %>
55-
<%= tag %>
58+
<%= tag.humanize %>
5659
<% end %>
5760
<% end %>
5861
</div>

0 commit comments

Comments
 (0)