Commit 406a796f authored by Kamil Trzcinski's avatar Kamil Trzcinski

Make Pipeline view work

parent e84c155f
...@@ -34,6 +34,25 @@ table { ...@@ -34,6 +34,25 @@ table {
font-weight: normal; font-weight: normal;
font-size: 15px; font-size: 15px;
border-bottom: 1px solid $border-color; border-bottom: 1px solid $border-color;
.rotate {
height: 140px;
white-space: nowrap;
}
.rotate > div {
transform:
/* Magic Numbers */
translate(25px, 51px)
/* 45 is really 360 - 45 */
rotate(315deg);
width: 30px;
}
.rotate > div > span {
border-bottom: 1px solid #ccc;
padding: 5px 10px;
}
} }
td { td {
......
class Projects::PipelineController < Projects::ApplicationController class Projects::PipelinesController < Projects::ApplicationController
before_action :ci_commit, except: [:index, :new, :create] before_action :ci_commit, except: [:index, :new, :create]
before_action :authorize_read_pipeline! before_action :authorize_read_pipeline!
before_action :authorize_create_pipeline!, only: [:new, :create] before_action :authorize_create_pipeline!, only: [:new, :create]
......
...@@ -37,7 +37,7 @@ module CiStatusHelper ...@@ -37,7 +37,7 @@ module CiStatusHelper
return unless ci_commit.is_a?(Commit) || ci_commit.is_a?(Ci::Commit) return unless ci_commit.is_a?(Commit) || ci_commit.is_a?(Ci::Commit)
link_to ci_icon_for_status(ci_commit.status), link_to ci_icon_for_status(ci_commit.status),
project_ci_commit_path(ci_commit.project, ci_commit), project_pipeline_path(ci_commit.project, ci_commit),
class: "ci-status-link ci-status-icon-#{ci_commit.status.dasherize}", class: "ci-status-link ci-status-icon-#{ci_commit.status.dasherize}",
title: "Build #{ci_label_for_status(ci_commit.status)}", title: "Build #{ci_label_for_status(ci_commit.status)}",
data: { toggle: 'tooltip', placement: tooltip_placement } data: { toggle: 'tooltip', placement: tooltip_placement }
......
...@@ -37,7 +37,7 @@ module GitlabRoutingHelper ...@@ -37,7 +37,7 @@ module GitlabRoutingHelper
builds_namespace_project_commit_path(project.namespace, project, commit.id) builds_namespace_project_commit_path(project.namespace, project, commit.id)
end end
def project_ci_commit_path(project, ci_commit) def project_pipeline_path(project, ci_commit)
builds_namespace_project_commit_path(project.namespace, project, ci_commit.sha) builds_namespace_project_commit_path(project.namespace, project, ci_commit.sha)
end end
......
...@@ -94,6 +94,10 @@ module Ci ...@@ -94,6 +94,10 @@ module Ci
end end
end end
def triggered?
trigger_requests.any?
end
def invalidate def invalidate
write_attribute(:status, nil) write_attribute(:status, nil)
write_attribute(:started_at, nil) write_attribute(:started_at, nil)
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
- if project_nav_tab? :builds - if project_nav_tab? :builds
= nav_link(controller: %w(ci_commits)) do = nav_link(controller: %w(ci_commits)) do
= link_to project_ci_commits_path(@project), title: 'Pipelines', class: 'shortcuts-builds' do = link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-builds' do
= icon('ship fw') = icon('ship fw')
%span %span
Pipelines Pipelines
......
- status = commit.status - status = commit.status
%tr.commit %tr.commit
%td.commit-link %td.commit-link
= link_to namespace_project_commit_url(@project.namespace, @project, commit), class: "ci-status ci-#{status}" do = link_to namespace_project_commit_path(@project.namespace, @project, commit.sha), class: "ci-status ci-#{status}" do
= ci_icon_for_status(status) = ci_icon_for_status(status)
%strong ##{commit.id} %strong ##{commit.id}
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
%span.label.label-primary tag %span.label.label-primary tag
- if commit.branch? - if commit.branch?
%span.label.label-primary branch %span.label.label-primary branch
- if commit.trigger_requests.any? - if commit.triggered?
%span.label.label-primary triggered %span.label.label-primary triggered
- if commit.yaml_errors.present? - if commit.yaml_errors.present?
%span.label.label-danger.has-tooltip(title="#{commit.yaml_errors}") yaml invalid %span.label.label-danger.has-tooltip(title="#{commit.yaml_errors}") yaml invalid
...@@ -27,22 +27,21 @@ ...@@ -27,22 +27,21 @@
%p %p
Cant find HEAD commit for this branch Cant find HEAD commit for this branch
- stages_status = commit.statuses.stages_status
- stages.each do |stage| - stages.each do |stage|
%td %td
- status = commit.statuses.latest.where(stage: stage).status - if status = stages_status[stage]
%span.has-tooltip(title="#{status || "missing"}"){class: "ci-status-icon-#{status || "skipped"}"} %span.has-tooltip(title="#{status}"){class: "ci-status-icon-#{status}"}
= ci_icon_for_status(status || "missing") = ci_icon_for_status(status)
-#- if status
-# = ci_status_with_icon(status)
-#- else
-# = ci_status_with_icon('missing')
%td %td
- if commit.started_at && commit.finished_at - if commit.started_at && commit.finished_at
%p %p
%i.fa.fa-late-o
#{duration_in_words(commit.finished_at, commit.started_at)} #{duration_in_words(commit.finished_at, commit.started_at)}
- if commit.finished_at - if commit.finished_at
%p %p
%i.fa.fa-date-o
#{time_ago_with_tooltip(commit.finished_at)} #{time_ago_with_tooltip(commit.finished_at)}
%td.content %td.content
...@@ -63,11 +62,11 @@ ...@@ -63,11 +62,11 @@
- if can?(current_user, :update_pipeline, @project) - if can?(current_user, :update_pipeline, @project)
- if commit.retryable? - 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 = link_to retry_namespace_project_pipeline_path(@project.namespace, @project, commit.id), class: 'btn has-tooltip', title: "Retry", method: :post do
= icon("repeat") = icon("repeat")
&nbsp; &nbsp;
- if commit.active? - 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 = link_to cancel_namespace_project_pipeline_path(@project.namespace, @project, commit.id), class: 'btn btn-remove has-tooltip', title: "Cancel", method: :post do
= icon("remove cred") = icon("remove cred")
- header_title project_title(@project, "Pipelines", project_ci_commits_path(@project))
- header_title project_title(@project, "Pipelines", project_pipelines_path(@project))
...@@ -4,32 +4,32 @@ ...@@ -4,32 +4,32 @@
.top-area .top-area
%ul.nav-links %ul.nav-links
%li{class: ('active' if @scope.nil?)} %li{class: ('active' if @scope.nil?)}
= link_to project_ci_commits_path(@project) do = link_to project_pipelines_path(@project) do
All All
%span.badge.js-totalbuilds-count %span.badge.js-totalbuilds-count
= number_with_delimiter(@all_commits.count(:id)) = number_with_delimiter(@all_commits.count(:id))
%li{class: ('active' if @scope == 'branches')} %li{class: ('active' if @scope == 'branches')}
= link_to project_ci_commits_path(@project, scope: :branches) do = link_to project_pipelines_path(@project, scope: :branches) do
Branches Branches
%span.badge.js-running-count %span.badge.js-running-count
= number_with_delimiter(@all_commits.running_or_pending.count(:id)) = number_with_delimiter(@all_commits.running_or_pending.count(:id))
%li{class: ('active' if @scope == 'tags')} %li{class: ('active' if @scope == 'tags')}
= link_to project_ci_commits_path(@project, scope: :tags) do = link_to project_pipelines_path(@project, scope: :tags) do
Tags Tags
%span.badge.js-running-count %span.badge.js-running-count
= number_with_delimiter(@all_commits.running_or_pending.count(:id)) = number_with_delimiter(@all_commits.running_or_pending.count(:id))
%li{class: ('active' if @scope == 'running')} %li{class: ('active' if @scope == 'running')}
= link_to project_ci_commits_path(@project, scope: :running) do = link_to project_pipelines_path(@project, scope: :running) do
Failed Failed
%span.badge.js-running-count %span.badge.js-running-count
= number_with_delimiter(@all_commits.running_or_pending.count(:id)) = number_with_delimiter(@all_commits.running_or_pending.count(:id))
.nav-controls .nav-controls
- if can? current_user, :create_pipeline, @project - if can? current_user, :create_pipeline, @project
= link_to new_namespace_project_ci_commit_path(@project.namespace, @project), class: 'btn btn-create' do = link_to new_namespace_project_pipeline_path(@project.namespace, @project), class: 'btn btn-create' do
= icon('plus') = icon('plus')
New New
...@@ -56,10 +56,10 @@ ...@@ -56,10 +56,10 @@
%th Pipeline ID %th Pipeline ID
%th Commit %th Commit
- @commits.stages.each do |stage| - @commits.stages.each do |stage|
%th %th.rotate
= stage.titleize = stage.titleize
%th %th
%th %th
= render @commits.includes(:statuses).includes(:builds), commit_sha: true, stage: true, allow_retry: true, stages: stages = render @commits, commit_sha: true, stage: true, allow_retry: true, stages: stages
= paginate @commits, theme: 'gitlab' = paginate @commits, theme: 'gitlab'
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
New Pipeline New Pipeline
%hr %hr
= form_tag namespace_project_ci_commits_path, method: :post, id: "new-pipeline-form", class: "form-horizontal js-create-branch-form js-requires-input" do = form_tag namespace_project_pipelines_path, method: :post, id: "new-pipeline-form", class: "form-horizontal js-create-branch-form js-requires-input" do
.form-group .form-group
= label_tag :ref, 'Create for', class: 'control-label' = label_tag :ref, 'Create for', class: 'control-label'
.col-sm-10 .col-sm-10
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
.help-block Existing branch name, tag .help-block Existing branch name, tag
.form-actions .form-actions
= button_tag 'Create pipeline', class: 'btn btn-create', tabindex: 3 = button_tag 'Create pipeline', class: 'btn btn-create', tabindex: 3
= link_to 'Cancel', namespace_project_ci_commits_path(@project.namespace, @project), class: 'btn btn-cancel' = link_to 'Cancel', namespace_project_pipelines_path(@project.namespace, @project), class: 'btn btn-cancel'
:javascript :javascript
var availableRefs = #{@project.repository.ref_names.to_json}; var availableRefs = #{@project.repository.ref_names.to_json};
......
...@@ -62,7 +62,7 @@ describe Project, models: true do ...@@ -62,7 +62,7 @@ describe Project, models: true do
it { is_expected.to have_one(:pushover_service).dependent(:destroy) } it { is_expected.to have_one(:pushover_service).dependent(:destroy) }
it { is_expected.to have_one(:asana_service).dependent(:destroy) } it { is_expected.to have_one(:asana_service).dependent(:destroy) }
it { is_expected.to have_many(:commit_statuses) } it { is_expected.to have_many(:commit_statuses) }
it { is_expected.to have_many(:ci_commits) } it { is_expected.to have_many(:pipelines) }
it { is_expected.to have_many(:builds) } it { is_expected.to have_many(:builds) }
it { is_expected.to have_many(:runner_projects) } it { is_expected.to have_many(:runner_projects) }
it { is_expected.to have_many(:runners) } it { is_expected.to have_many(:runners) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment