diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-03 18:09:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-03 18:09:56 +0300 |
commit | c08d9c22569d1c9e7c7737e183969593394133d9 (patch) | |
tree | 8ce1722f852f8921656080e04f6c9e16fa71ddb5 /app | |
parent | 546ddc3f6ac96fdf09934390a938bb391d07dc94 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/framework/secondary_navigation_elements.scss | 4 | ||||
-rw-r--r-- | app/models/concerns/milestoneish.rb | 16 | ||||
-rw-r--r-- | app/models/global_milestone.rb | 2 | ||||
-rw-r--r-- | app/services/ci/daily_report_result_service.rb | 15 | ||||
-rw-r--r-- | app/views/ci/variables/_index.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/issues/_nav_btns.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/issues/import_csv/_button.html.haml | 27 | ||||
-rw-r--r-- | app/views/shared/milestones/_sidebar.html.haml | 8 |
8 files changed, 49 insertions, 27 deletions
diff --git a/app/assets/stylesheets/framework/secondary_navigation_elements.scss b/app/assets/stylesheets/framework/secondary_navigation_elements.scss index d4ee59790e9..79f203091f2 100644 --- a/app/assets/stylesheets/framework/secondary_navigation_elements.scss +++ b/app/assets/stylesheets/framework/secondary_navigation_elements.scss @@ -121,6 +121,7 @@ } > .btn, + > .btn-group, > .btn-container, > .dropdown, > input, @@ -161,7 +162,8 @@ .dropdown, .dropdown-toggle, .dropdown-menu-toggle, - .form-control { + .form-control, + > .btn-group { margin: 0 0 $gl-padding-8; display: block; width: 100%; diff --git a/app/models/concerns/milestoneish.rb b/app/models/concerns/milestoneish.rb index fac058e5a46..fa5a79cc12b 100644 --- a/app/models/concerns/milestoneish.rb +++ b/app/models/concerns/milestoneish.rb @@ -117,20 +117,20 @@ module Milestoneish false end - def total_issue_time_spent - @total_issue_time_spent ||= issues.joins(:timelogs).sum(:time_spent) + def total_time_spent + @total_time_spent ||= issues.joins(:timelogs).sum(:time_spent) + merge_requests.joins(:timelogs).sum(:time_spent) end - def human_total_issue_time_spent - Gitlab::TimeTrackingFormatter.output(total_issue_time_spent) + def human_total_time_spent + Gitlab::TimeTrackingFormatter.output(total_time_spent) end - def total_issue_time_estimate - @total_issue_time_estimate ||= issues.sum(:time_estimate) + def total_time_estimate + @total_time_estimate ||= issues.sum(:time_estimate) + merge_requests.sum(:time_estimate) end - def human_total_issue_time_estimate - Gitlab::TimeTrackingFormatter.output(total_issue_time_estimate) + def human_total_time_estimate + Gitlab::TimeTrackingFormatter.output(total_time_estimate) end private diff --git a/app/models/global_milestone.rb b/app/models/global_milestone.rb index 65fd5c1b35a..d0cec0e9fc6 100644 --- a/app/models/global_milestone.rb +++ b/app/models/global_milestone.rb @@ -94,7 +94,7 @@ class GlobalMilestone end def merge_requests - @merge_requests ||= MergeRequest.of_milestones(milestone).includes(:target_project, :assignee, :labels) + @merge_requests ||= MergeRequest.of_milestones(milestone).includes(:target_project, :assignees, :labels) end def labels diff --git a/app/services/ci/daily_report_result_service.rb b/app/services/ci/daily_report_result_service.rb index 79b5015c076..b774a806203 100644 --- a/app/services/ci/daily_report_result_service.rb +++ b/app/services/ci/daily_report_result_service.rb @@ -19,12 +19,21 @@ module Ci last_pipeline_id: pipeline.id } - pipeline.builds.with_coverage.map do |build| + aggregate(pipeline.builds.with_coverage).map do |group_name, group| base_attrs.merge( - title: build.group_name, - value: build.coverage + title: group_name, + value: average_coverage(group) ) end end + + def aggregate(builds) + builds.group_by(&:group_name) + end + + def average_coverage(group) + total_coverage = group.reduce(0.0) { |sum, build| sum + build.coverage } + (total_coverage / group.size).round(2) + end end end diff --git a/app/views/ci/variables/_index.html.haml b/app/views/ci/variables/_index.html.haml index f11c730eba6..3fa957f38a0 100644 --- a/app/views/ci/variables/_index.html.haml +++ b/app/views/ci/variables/_index.html.haml @@ -23,7 +23,7 @@ .prepend-top-20 %button.btn.btn-success.js-ci-variables-save-button{ type: 'button' } %span.hide.js-ci-variables-save-loading-icon - = icon('spinner spin') + .spinner.spinner-light.mr-1 = _('Save variables') %button.btn.btn-info.btn-inverted.prepend-left-10.js-secret-value-reveal-button{ type: 'button', data: { secret_reveal_status: "#{@variables.size == 0}" } } - if @variables.size == 0 diff --git a/app/views/projects/issues/_nav_btns.html.haml b/app/views/projects/issues/_nav_btns.html.haml index d81089bee68..c347b8d2c9c 100644 --- a/app/views/projects/issues/_nav_btns.html.haml +++ b/app/views/projects/issues/_nav_btns.html.haml @@ -6,7 +6,7 @@ - if show_feed_buttons = render 'shared/issuable/feed_buttons' - .btn-group.append-right-10< + .btn-group - if show_export_button = render_if_exists 'projects/issues/export_csv/button' diff --git a/app/views/projects/issues/import_csv/_button.html.haml b/app/views/projects/issues/import_csv/_button.html.haml index 78c561e81ef..0a352d26b0b 100644 --- a/app/views/projects/issues/import_csv/_button.html.haml +++ b/app/views/projects/issues/import_csv/_button.html.haml @@ -1,11 +1,22 @@ - type = local_assigns.fetch(:type, :icon) -%button.csv-import-button.btn{ title: _('Import CSV'), class: ('has-tooltip' if type == :icon), - data: { toggle: 'modal', target: '.issues-import-modal' } } - - if type == :icon - = sprite_icon('import') - - else - = _('Import CSV') - - if Feature.enabled?(:jira_issue_import, @project) - = link_to _("Import Jira issues"), project_import_jira_path(@project), class: "btn btn-default" + .dropdown.btn-group + %button.btn.rounded-right.text-center{ class: ('has-tooltip' if type == :icon), title: (_('Import issues') if type == :icon), + data: { toggle: 'dropdown' }, 'aria-label' => _('Import issues'), 'aria-haspopup' => 'true', 'aria-expanded' => 'false' } + - if type == :icon + = sprite_icon('import') + - else + = _('Import issues') + %ul.dropdown-menu + %li + %button.btn{ data: { toggle: 'modal', target: '.issues-import-modal' } } + = _('Import CSV') + %li= link_to _('Import from Jira'), project_import_jira_path(@project) +- else + %button.csv-import-button.btn{ title: _('Import CSV'), class: ('has-tooltip' if type == :icon), + data: { toggle: 'modal', target: '.issues-import-modal' } } + - if type == :icon + = sprite_icon('import') + - else + = _('Import CSV') diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index aa9c4be1cc1..ba1629bd99a 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -93,10 +93,10 @@ = milestone.issues_visible_to_user(current_user).closed.count .block - #issuable-time-tracker{ data: { time_estimate: @milestone.total_issue_time_estimate, - time_spent: @milestone.total_issue_time_spent, - human_time_estimate: @milestone.human_total_issue_time_estimate, - human_time_spent: @milestone.human_total_issue_time_spent, + #issuable-time-tracker{ data: { time_estimate: @milestone.total_time_estimate, + time_spent: @milestone.total_time_spent, + human_time_estimate: @milestone.human_total_time_estimate, + human_time_spent: @milestone.human_total_time_spent, limit_to_hours: Gitlab::CurrentSettings.time_tracking_limit_to_hours.to_s } } = render_if_exists 'shared/milestones/weight', milestone: milestone |