-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6446 from hennevogel/feature/bootstrap-pulse
Refactor and adopt pulse to bootstrap
- Loading branch information
Showing
23 changed files
with
370 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pulse { | ||
.request-state-new { | ||
color: $obs_blue; | ||
} | ||
|
||
.request-state-review { | ||
color: $obs_yellow; | ||
} | ||
|
||
.request-state-accepted { | ||
color: $obs_green; | ||
} | ||
|
||
.request-state-declined { | ||
color: $red; | ||
} | ||
|
||
.request-state-revoked { | ||
color: $dark; | ||
} | ||
|
||
.request-state-superseded { | ||
color: $orange; | ||
} | ||
|
||
.progress-state-new { | ||
background-color: $obs_blue; | ||
} | ||
|
||
.progress-state-review { | ||
background-color: $obs_yellow; | ||
} | ||
|
||
.progress-state-accepted { | ||
background-color: $obs_green; | ||
} | ||
|
||
.progress-state-declined { | ||
background-color: $red; | ||
} | ||
|
||
.progress-state-revoked { | ||
background-color: $dark; | ||
} | ||
|
||
.progress-state-superseded { | ||
background-color: $orange; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/api/app/controllers/webui/projects/pulse_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Webui | ||
module Projects | ||
class PulseController < WebuiController | ||
before_action :set_project | ||
|
||
def show | ||
switch_to_webui2 | ||
@pulse = @project.project_log_entries.page(params[:page]) | ||
end | ||
|
||
def update_pulse | ||
@range = params[:range] == 'month' ? 'month' : 'week' | ||
case @range | ||
when 'month' | ||
range = 1.month.ago..Date.tomorrow | ||
else | ||
range = 1.week.ago..Date.tomorrow | ||
end | ||
|
||
pulse = @project.project_log_entries.where(datetime: range).order(datetime: :asc) | ||
@builds = pulse.where(event_type: [:build_fail, :build_success]) | ||
@new_packages = pulse.where(event_type: :create_package) | ||
@deleted_packages = pulse.where(event_type: :delete_package) | ||
@branches = pulse.where(event_type: :branch_command) | ||
@commits = pulse.where(event_type: :commit) | ||
@updates = pulse.where(event_type: :version_change) | ||
@comments = pulse.where(event_type: [:comment_for_package, :comment_for_project]) | ||
@project_changes = pulse.where(event_type: [:update_project, :update_project_config]) | ||
|
||
@requests = @project.target_of_bs_requests.where(updated_at: range).order(updated_at: :desc) | ||
# group by state, sort by value... | ||
@requests_by_state = @requests.group(:state).count.sort_by { |_, v| -v }.to_h | ||
# transpose to percentages | ||
@requests_by_percentage = @requests_by_state.each_with_object({}) { |(k, v), hash| hash[k] = (v * 100.0 / @requests_by_state.values.sum).round.to_s } if @requests_by_state.any? | ||
switch_to_webui2 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 1 addition & 0 deletions
1
src/api/app/views/webui2/webui/projects/pulse/_breadcrumb_items.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../project/_breadcrumb_items.html.haml |
90 changes: 90 additions & 0 deletions
90
src/api/app/views/webui2/webui/projects/pulse/_pulse_list.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
.row | ||
.col | ||
%p | ||
During this period | ||
= render partial: 'pulse_list_commits', locals: { commits: commits, updates: updates } | ||
%p | ||
= render partial: 'pulse_list_builds', locals: { builds: builds } | ||
= render partial: 'pulse_list_new', locals: { new_packages: new_packages, deleted_packages: deleted_packages } | ||
= render partial: 'pulse_list_changes', locals: { project_changes: project_changes } | ||
%p | ||
= render partial: 'pulse_list_branches', locals: { branches: branches } | ||
= render partial: 'pulse_list_comments', locals: { comments: comments } | ||
|
||
.col | ||
.card | ||
.card-header | ||
Requests | ||
.card-body | ||
- if requests.any? | ||
.row | ||
.col | ||
.progress | ||
-# haml-lint:disable InlineStyles | ||
- requests_by_percentage.each do |state, percentage| | ||
%div{ title: "#{requests_by_state[state]} #{state} requests", | ||
class: "progress-bar progress-state-#{state}", | ||
'aria-valuemax': '100', 'aria-valuemin': '0', 'aria-valuenow': percentage, | ||
role: 'progressbar', style: "width: #{percentage}%" } | ||
-# haml-lint:enable InlineStyles | ||
%p | ||
= link_to('#pulse-requests') do | ||
= requests_by_state.values.sum | ||
active requests | ||
.row | ||
- requests_by_state.each_key do |state| | ||
.col.border.text-center | ||
%p.fa-3x | ||
%i{ class: "fa #{request_bootstrap_icon(state)} request-state-#{state}" } | ||
%p | ||
= pluralize(requests_by_state[state], 'request') | ||
%br | ||
in #{state} | ||
- else | ||
= link_to(project_requests_path(project)) do | ||
There have been no requests send to this project. | ||
.row | ||
.col | ||
%h5#pulse-packages | ||
Package Changes | ||
%hr | ||
%ul.list-unstyled | ||
- (commits + new_packages + deleted_packages + updates).sort_by(&:datetime).reverse_each do |log_entry| | ||
%li | ||
= render partial: 'pulse_list_entry', locals: { log_entry: log_entry, project: project } | ||
|
||
%h5#pulse-project | ||
Project Changes | ||
%hr | ||
%ul.list-unstyled | ||
- project_changes.each do |log_entry| | ||
%li | ||
= render partial: 'pulse_list_entry', locals: { log_entry: log_entry, project: project } | ||
|
||
%h5#pulse-builds | ||
Builds | ||
%hr | ||
%ul.list-unstyled | ||
- builds.each do |log_entry| | ||
%li | ||
= render partial: 'pulse_list_entry', locals: { log_entry: log_entry, project: project } | ||
|
||
%h5#pulse-collaboration | ||
Collaboration | ||
%hr | ||
%ul.list-unstyled | ||
- (branches + comments).sort_by(&:datetime).reverse_each.each do |log_entry| | ||
%li | ||
= render partial: 'pulse_list_entry', locals: { log_entry: log_entry, project: project } | ||
|
||
%h5#pulse-requests | ||
Requests | ||
- if requests.count > 30 | ||
%small.text-muted | ||
( last 30, | ||
= link_to(project_requests_path(project)) do | ||
view all | ||
) | ||
%hr | ||
= render partial: 'pulse_list_requests', locals: { requests: requests } | ||
|
7 changes: 7 additions & 0 deletions
7
src/api/app/views/webui2/webui/projects/pulse/_pulse_list_branches.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
- if branches.any? | ||
People | ||
= link_to('#pulse-collaboration') do | ||
branched | ||
#{pluralize(branches.count, 'package')}. | ||
- else | ||
No one branched packages from this project. |
21 changes: 21 additions & 0 deletions
21
src/api/app/views/webui2/webui/projects/pulse/_pulse_list_builds.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- if builds.any? | ||
- builds = builds.group(:event_type).count | ||
There | ||
-# 'has' does not have an inflection and the String | ||
version of pluralize does not know about the plural | ||
option like, that's why this is an if... | ||
'has'.pluralize(builds.values.sum, plural: 'have') | ||
= builds.values.sum > 1 ? 'have' : 'has' | ||
been | ||
= link_to('#pulse-builds') do | ||
= builds.values.sum | ||
builds | ||
of which | ||
%b.text-danger | ||
= builds['build_fail'] | ||
failed | ||
and | ||
%b.text-success | ||
= builds['build_success'] | ||
succeeded | ||
\. |
5 changes: 5 additions & 0 deletions
5
src/api/app/views/webui2/webui/projects/pulse/_pulse_list_changes.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- if project_changes.any? | ||
And the project setup has been changed | ||
#{pluralize(project_changes.count, 'time')}. | ||
- else | ||
And no one touched the project setup. |
10 changes: 10 additions & 0 deletions
10
src/api/app/views/webui2/webui/projects/pulse/_pulse_list_comments.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
- if comments.any? | ||
And | ||
- people = comments.group(:user_name).count | ||
= pluralize(people.count, 'person') | ||
added | ||
= link_to('#pulse-collaboration') do | ||
= pluralize(comments.count, 'comment') | ||
in here. | ||
- else | ||
And no one commented in here. |
18 changes: 18 additions & 0 deletions
18
src/api/app/views/webui2/webui/projects/pulse/_pulse_list_commits.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
- if commits.any? | ||
- people = commits.group(:user_name).count | ||
%b | ||
= pluralize(people.count, 'person') | ||
added | ||
= link_to('#pulse-packages') do | ||
= pluralize(commits.count, 'commit') | ||
to packages in this project. | ||
- if updates.any? | ||
Out of those commits, | ||
= pluralize(updates.count, 'was a', plural: 'were') | ||
version #{'update'.pluralize(updates.count)}. | ||
- top_committer = commits.group(:user_name).count.max_by { |_, v| v } | ||
%span{ title: "with #{pluralize(top_committer.second, 'commit')}" } | ||
= top_committer.first | ||
was the busiest commiter, hooray! | ||
- else | ||
no one committed anything. |
6 changes: 6 additions & 0 deletions
6
src/api/app/views/webui2/webui/projects/pulse/_pulse_list_entry.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
= log_entry.event_type.camelcase.prepend('Event::').constantize.description | ||
- if log_entry.package_name | ||
(#{link_to(log_entry.package_name, package_show_path(project.name, log_entry.package_name))}) | ||
- if log_entry.user_name | ||
by #{link_to(log_entry.user_name, user_show_path(log_entry.user_name))} | ||
= fuzzy_time(log_entry.datetime) |
15 changes: 15 additions & 0 deletions
15
src/api/app/views/webui2/webui/projects/pulse/_pulse_list_new.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
There was | ||
- if new_packages.any? | ||
%b.text-success | ||
= new_packages.count | ||
= 'package'.pluralize(new_packages.count) | ||
created | ||
- else | ||
no package created | ||
- if deleted_packages.any? | ||
and | ||
%b.text-danger | ||
= deleted_packages.count | ||
deleted. | ||
- else | ||
\. |
18 changes: 18 additions & 0 deletions
18
src/api/app/views/webui2/webui/projects/pulse/_pulse_list_requests.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.row | ||
- @requests.take(30).each do |request| | ||
%dt.col-1 | ||
%span{ class: "badge progress-state-#{request.state} text-light" } | ||
= request.state.to_s | ||
%dd.col-11 | ||
= link_to(request_show_path(request.number)) do | ||
= request.number | ||
(#{truncate(request.description)}) | ||
- if request.request_history_elements.any? | ||
= request.request_history_elements.last.description.gsub('Request', '') | ||
- else | ||
was created | ||
by | ||
= link_to(user_show_path(request.creator)) do | ||
= request.creator | ||
= fuzzy_time(request.updated_at) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../project/_tabs.html.haml |
Oops, something went wrong.