diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-02 00:49:57 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-07 13:29:02 +0200 |
commit | 05ef835e23f99fd4c141c259d12d42626d9a33a4 (patch) | |
tree | 304e1e98ce118e94ea6d01ee3e7132d3a9e97b02 | |
parent | 2d5de1a6751481b1299d1f0ff2b13fe5da048bc9 (diff) | |
download | gitlab-ce-05ef835e23f99fd4c141c259d12d42626d9a33a4.tar.gz |
WIP
-rw-r--r-- | app/controllers/projects/builds_controller.rb | 28 | ||||
-rw-r--r-- | app/models/commit_status.rb | 5 | ||||
-rw-r--r-- | app/views/projects/ci/builds/_build.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/ci/commits/_commit.html.haml | 18 |
4 files changed, 17 insertions, 36 deletions
diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index 269c0d3c21f..f159e169f6d 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -20,30 +20,6 @@ class Projects::BuildsController < Projects::ApplicationController @builds = @builds.page(params[:page]).per(30) end - def commits - @scope = params[:scope] - @all_commits = project.ci_commits - @commits = @all_commits.order(id: :desc) - @commits = - case @scope - when 'latest' - @commits - when 'branches' - refs = project.repository.branches.map(&:name) - ids = @all_commits.where(ref: refs).group(:ref).select('max(id)') - @commits.where(id: ids) - when 'tags' - refs = project.repository.tags.map(&:name) - ids = @all_commits.where(ref: refs).group(:ref).select('max(id)') - @commits.where(id: ids) - else - @commits - end - @commits = @commits.page(params[:page]).per(30) - end - - private - def cancel_all @project.builds.running_or_pending.each(&:cancel) redirect_to namespace_project_builds_path(project.namespace, project) @@ -92,10 +68,6 @@ class Projects::BuildsController < Projects::ApplicationController @build ||= project.builds.unscoped.find_by!(id: params[:id]) end - def ci_commit - @ci_commit ||= project.ci_commits.find_by!(id: params[:id]) - end - def build_path(build) namespace_project_build_path(build.project.namespace, build.project, build) end diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 88cb7e21d66..5d5939538c0 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -45,6 +45,11 @@ class CommitStatus < ActiveRecord::Base validates_presence_of :name + def self.stages + group(:stage, :stage_idx).order(:stage_idx) + .pluck(:stage, :stage_idx).map(&:first) + end + alias_attribute :author, :user scope :running, -> { where(status: 'running') } diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml index c109b6cdd20..218d396b898 100644 --- a/app/views/projects/ci/builds/_build.html.haml +++ b/app/views/projects/ci/builds/_build.html.haml @@ -1,4 +1,4 @@ -%tr.build{style:"text-decoration: #{if defined?(retried) && retried then "line-through" else "inherit" end}"} +%tr.build %td.status - if can?(current_user, :read_build, build) = ci_status_with_icon(build.status, namespace_project_build_url(build.project.namespace, build.project, build)) diff --git a/app/views/projects/ci/commits/_commit.html.haml b/app/views/projects/ci/commits/_commit.html.haml index 8219e7bf701..29efcc9cfdd 100644 --- a/app/views/projects/ci/commits/_commit.html.haml +++ b/app/views/projects/ci/commits/_commit.html.haml @@ -27,13 +27,15 @@ %p Cant find HEAD commit for this branch - - stages.each do |stage| - %td - - status = commit.statuses.latest.where(stage: stage).status - - if status - = ci_status_with_icon(status) - - else - = ci_status_with_icon('missing') + - stages.each do |stage| + %td + - status = commit.statuses.latest.where(stage: stage).status + %span.has-tooltip(title="#{status || "missing"}"){class: "ci-status-icon-#{status || "skipped"}"} + = ci_icon_for_status(status || "missing") + -#- if status + -# = ci_status_with_icon(status) + -#- else + -# = ci_status_with_icon('missing') %td - if commit.started_at && commit.finished_at @@ -63,7 +65,9 @@ - if commit.retryable? = link_to retry_namespace_project_ci_commit_path(@project.namespace, @project, commit.id), class: 'btn has-tooltip', title: "Retry", method: :post do = icon("repeat") + + - if commit.active? = link_to cancel_namespace_project_ci_commit_path(@project.namespace, @project, commit.id), class: 'btn btn-remove has-tooltip', title: "Cancel", method: :post do = icon("remove cred") |