BigW Consortium Gitlab

Commit 0e06cfc0 by Shinya Maeda

Add api points for ci cd status. Add favicon.

parent 3918c303
......@@ -91,6 +91,12 @@ class Projects::BuildsController < Projects::ApplicationController
end
end
def ci_cd_status
render json: BuildSerializer
.new(project: @project, user: @current_user)
.represent(@build)
end
private
def build
......
......@@ -10,7 +10,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action :module_enabled
before_action :merge_request, only: [
:edit, :update, :show, :diffs, :commits, :conflicts, :conflict_for_path, :pipelines, :merge, :merge_check,
:ci_status, :ci_environments_status, :toggle_subscription, :cancel_merge_when_pipeline_succeeds, :remove_wip, :resolve_conflicts, :assign_related_issues
:ci_status, :ci_cd_status, :ci_environments_status, :toggle_subscription, :cancel_merge_when_pipeline_succeeds, :remove_wip, :resolve_conflicts, :assign_related_issues
]
before_action :validates_merge_request, only: [:show, :diffs, :commits, :pipelines]
before_action :define_show_vars, only: [:show, :diffs, :commits, :conflicts, :conflict_for_path, :builds, :pipelines]
......@@ -473,6 +473,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController
render json: response
end
def ci_cd_status
render json: PipelineSerializer
.new(project: @project, user: @current_user)
.represent(@merge_request.head_pipeline)
end
def ci_environments_status
environments =
begin
......
......@@ -72,6 +72,12 @@ class Projects::PipelinesController < Projects::ApplicationController
end
end
def ci_cd_status
render json: PipelineSerializer
.new(project: @project, user: @current_user)
.represent(@pipeline)
end
def stage
@stage = pipeline.stage(params[:stage])
return not_found unless @stage
......
......@@ -19,6 +19,12 @@ class BuildEntity < Grape::Entity
expose :created_at
expose :updated_at
expose :status do |build, options|
StatusEntity.represent(
build.detailed_status(request.user),
options)
end
private
def path_to(route, build)
......
class BuildSerializer < BaseSerializer
entity BuildEntity
end
class StatusEntity < Grape::Entity
include RequestAwareEntity
expose :icon, :text, :label, :group
expose :icon, :favicon, :text, :label, :group
expose :has_details?, as: :has_details
expose :details_path
......
......@@ -102,6 +102,7 @@ constraints(ProjectUrlConstrainer.new) do
get :merge_widget_refresh
post :cancel_merge_when_pipeline_succeeds
get :ci_status
get :ci_cd_status
get :ci_environments_status
post :toggle_subscription
post :remove_wip
......@@ -152,6 +153,7 @@ constraints(ProjectUrlConstrainer.new) do
post :cancel
post :retry
get :builds
get :ci_cd_status
end
end
......@@ -203,6 +205,7 @@ constraints(ProjectUrlConstrainer.new) do
post :erase
get :trace
get :raw
get :ci_cd_status
end
resource :artifacts, only: [] do
......
......@@ -13,6 +13,10 @@ module Gitlab
'icon_status_warning'
end
def favicon
'build_status_warning'
end
def group
'failed_with_warnings'
end
......
......@@ -13,6 +13,10 @@ module Gitlab
def icon
'icon_status_canceled'
end
def favicon
'build_status_canceled'
end
end
end
end
......
......@@ -13,6 +13,10 @@ module Gitlab
def icon
'icon_status_created'
end
def favicon
'build_status_created'
end
end
end
end
......
......@@ -13,6 +13,10 @@ module Gitlab
def icon
'icon_status_failed'
end
def favicon
'build_status_failed'
end
end
end
end
......
......@@ -13,6 +13,10 @@ module Gitlab
def icon
'icon_status_pending'
end
def favicon
'build_status_pending'
end
end
end
end
......
......@@ -13,6 +13,10 @@ module Gitlab
def icon
'icon_status_running'
end
def favicon
'build_status_running'
end
end
end
end
......
......@@ -13,6 +13,10 @@ module Gitlab
def icon
'icon_status_skipped'
end
def favicon
'build_status_skipped'
end
end
end
end
......
......@@ -13,6 +13,10 @@ module Gitlab
def icon
'icon_status_success'
end
def favicon
'build_status_success'
end
end
end
end
......
......@@ -20,6 +20,10 @@ module Gitlab
'icon_status_warning'
end
def favicon
'build_status_warning'
end
def group
'success_with_warnings'
end
......
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