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

Make Pipeline view work

parent e84c155f
......@@ -34,6 +34,25 @@ table {
font-weight: normal;
font-size: 15px;
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 {
......
class Projects::PipelineController < Projects::ApplicationController
class Projects::PipelinesController < Projects::ApplicationController
before_action :ci_commit, except: [:index, :new, :create]
before_action :authorize_read_pipeline!
before_action :authorize_create_pipeline!, only: [:new, :create]
......
......@@ -37,7 +37,7 @@ module CiStatusHelper
return unless ci_commit.is_a?(Commit) || ci_commit.is_a?(Ci::Commit)
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}",
title: "Build #{ci_label_for_status(ci_commit.status)}",
data: { toggle: 'tooltip', placement: tooltip_placement }
......
......@@ -37,7 +37,7 @@ module GitlabRoutingHelper
builds_namespace_project_commit_path(project.namespace, project, commit.id)
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)
end
......
......@@ -94,6 +94,10 @@ module Ci
end
end
def triggered?
trigger_requests.any?
end
def invalidate
write_attribute(:status, nil)
write_attribute(:started_at, nil)
......
......@@ -40,7 +40,7 @@
- if project_nav_tab? :builds
= 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')
%span
Pipelines
......
- status = commit.status
%tr.commit
%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)
%strong ##{commit.id}
......@@ -14,7 +14,7 @@
%span.label.label-primary tag
- if commit.branch?
%span.label.label-primary branch
- if commit.trigger_requests.any?
- if commit.triggered?
%span.label.label-primary triggered
- if commit.yaml_errors.present?
%span.label.label-danger.has-tooltip(title="#{commit.yaml_errors}") yaml invalid
......@@ -27,22 +27,21 @@
%p
Cant find HEAD commit for this branch
- stages_status = commit.statuses.stages_status
- 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')
- if status = stages_status[stage]
%span.has-tooltip(title="#{status}"){class: "ci-status-icon-#{status}"}
= ci_icon_for_status(status)
%td
- if commit.started_at && commit.finished_at
%p
%i.fa.fa-late-o
#{duration_in_words(commit.finished_at, commit.started_at)}
- if commit.finished_at
%p
%i.fa.fa-date-o
#{time_ago_with_tooltip(commit.finished_at)}
%td.content
......@@ -63,11 +62,11 @@
- if can?(current_user, :update_pipeline, @project)
- 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")
&nbsp;
- 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")
- 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 @@
.top-area
%ul.nav-links
%li{class: ('active' if @scope.nil?)}
= link_to project_ci_commits_path(@project) do
= link_to project_pipelines_path(@project) do
All
%span.badge.js-totalbuilds-count
= number_with_delimiter(@all_commits.count(:id))
%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
%span.badge.js-running-count
= number_with_delimiter(@all_commits.running_or_pending.count(:id))
%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
%span.badge.js-running-count
= number_with_delimiter(@all_commits.running_or_pending.count(:id))
%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
%span.badge.js-running-count
= number_with_delimiter(@all_commits.running_or_pending.count(:id))
.nav-controls
- 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')
New
......@@ -56,10 +56,10 @@
%th Pipeline ID
%th Commit
- @commits.stages.each do |stage|
%th
%th.rotate
= stage.titleize
%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'
......@@ -9,7 +9,7 @@
New Pipeline
%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
= label_tag :ref, 'Create for', class: 'control-label'
.col-sm-10
......@@ -17,7 +17,7 @@
.help-block Existing branch name, tag
.form-actions
= 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
var availableRefs = #{@project.repository.ref_names.to_json};
......
......@@ -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(:asana_service).dependent(:destroy) }
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(:runner_projects) }
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