-
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.
Refactor and adopt pulse to bootstrap
This was some basic functionality. A bit extended now to give some more information about what is happening in a Project.
- Loading branch information
1 parent
7919c5f
commit cef8f37
Showing
17 changed files
with
318 additions
and
1 deletion.
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
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
91 changes: 91 additions & 0 deletions
91
src/api/app/views/webui2/webui/project/_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,91 @@ | ||
.row | ||
.col | ||
%p | ||
During this period | ||
= render partial: 'pulse_list_commits' | ||
%p | ||
= render partial: 'pulse_list_builds' | ||
= render partial: 'pulse_list_new' | ||
= render partial: 'pulse_list_changes' | ||
%p | ||
= render partial: 'pulse_list_branches' | ||
= render partial: 'pulse_list_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 | ||
%h3 | ||
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 } | ||
%h3 | ||
Project Changes | ||
%hr | ||
%ul.list-unstyled | ||
- @project_changes.each do |log_entry| | ||
%li | ||
= render partial: 'pulse_list_entry', locals: { log_entry: log_entry } | ||
%h3 | ||
Collaboration | ||
%hr | ||
%ul.list-unstyled | ||
- @branches.each do |log_entry| | ||
%li | ||
= render partial: 'pulse_list_entry', locals: { log_entry: log_entry } | ||
- @comments.each do |log_entry| | ||
%li | ||
= render partial: 'pulse_list_entry', locals: { log_entry: log_entry } | ||
%h3#pulse-requests | ||
Requests | ||
%hr | ||
.row | ||
- @requests.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) |
7 changes: 7 additions & 0 deletions
7
src/api/app/views/webui2/webui/project/_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? | ||
Packages from this project have been | ||
%b | ||
branched | ||
= pluralize(@branches.count, 'time') | ||
- else | ||
No one branched packages from this project. |
23 changes: 23 additions & 0 deletions
23
src/api/app/views/webui2/webui/project/_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,23 @@ | ||
- if @builds.any? | ||
- builds = @builds.group(:event_type).count | ||
There | ||
- # FIXME: 'has' does not have an inflection and | ||
- # 'has'.pluralize(builds.values.sum, plural: 'have') | ||
- # does not work... | ||
- if builds.values.sum > 1 | ||
have | ||
- else | ||
has | ||
been | ||
%b | ||
= 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/project/_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/project/_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? | ||
- people = @comments.group(:user_name).count | ||
%b | ||
= pluralize(people.count, 'person') | ||
added | ||
%b | ||
= pluralize(@comments.count, 'comment') | ||
in here. | ||
- else | ||
And no one commented in here. |
20 changes: 20 additions & 0 deletions
20
src/api/app/views/webui2/webui/project/_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,20 @@ | ||
- if @commits.any? | ||
- people = @commits.group(:user_name).count | ||
%b | ||
= pluralize(people.count, 'person') | ||
added | ||
%b | ||
= pluralize(@commits.count, 'commit') | ||
to packages in this project. | ||
- if @updates.any? | ||
Out of those commits, | ||
= pluralize(@updates.count, 'was a', plural: 'where') | ||
version #{'update'.pluralize(@updates.count)}. | ||
- top_committer = @commits.group(:user_name).count.max_by { |_, v| v } | ||
= top_committer.first | ||
was the busiest commiter with | ||
%b | ||
#{pluralize(top_committer.second, 'commit')}. | ||
Hooray! | ||
- else | ||
no one committed anything. |
6 changes: 6 additions & 0 deletions
6
src/api/app/views/webui2/webui/project/_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/project/_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 | ||
\. |
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 @@ | ||
#{Time.zone.today.strftime('%B, %e')} – #{Time.zone.today.prev_month.strftime('%B, %e')} |
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 @@ | ||
#{Time.zone.today.strftime('%B, %e')} – #{Time.zone.today.prev_week.strftime('%B, %e')} |
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,43 @@ | ||
- @pagetitle = "Pulse for #{@project}" | ||
|
||
.card | ||
= render(partial: 'tabs', locals: { project: @project }) | ||
|
||
.card-body | ||
.row | ||
.col-8.mb-3 | ||
%h3#range-header | ||
= render partial: 'range_month' | ||
.col | ||
.dropdown.float-right | ||
%button.btn.btn-secondary.dropdown-toggle#period-dropdown{ 'aria-expanded': 'false', | ||
'aria-haspopup': 'true', | ||
'data-toggle': 'dropdown', | ||
type: 'button' } | ||
Period: One | ||
%span#range-text | ||
Week | ||
.dropdown-menu{ 'aria-labelledby': 'dropdownMenuButton' } | ||
%h6.dropdown-header | ||
Period to display: | ||
= link_to(update_project_pulse_path(@project), remote: true, type: :json, class: 'dropdown-item') do | ||
One Week | ||
= link_to(update_project_pulse_path(@project, range: 'month'), remote: true, type: :json, class: 'dropdown-item') do | ||
One Month | ||
.row | ||
.col#pulse | ||
.row | ||
.col.text-center | ||
%i.fas.fa-spinner.fa-spin.fa-3x | ||
|
||
|
||
:javascript | ||
$.ajax({ | ||
url: "#{update_project_pulse_path(@project)}", | ||
type:"get", | ||
}); | ||
$( ".dropdown-item" ).click(function() { | ||
$( "#pulse" ).html('<div class="fa-3x"><i class="fas fa-spinner fa-spin"></i></div>') | ||
// FIXME: No idea why this is needed, maybe remote links are not covered by bootstrap? | ||
$('#period-dropdown').dropdown('toggle') | ||
}); |
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,3 @@ | ||
$('#range-header').html("<%= escape_javascript render partial: "range_#{@range}" %>"); | ||
$('#range-text').html("<%= @range.titleize %>"); | ||
$('#pulse').html("<%= escape_javascript render partial: 'pulse_list' %>"); |
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