Skip to content
Snippets Groups Projects
Commit 71777a4a authored by Lin Jen-Shin's avatar Lin Jen-Shin :cookie:
Browse files

Rename BuildsController to JobsController

Rename other URL generators

admin_builds_path -> admin_jobs_path

Fix tests and more renaming

Fix more tests

Also change build_id to job_id in the controller
parent a5f06563
No related branches found
No related tags found
4 merge requests!2131CE => EE 9.3 RC2,!2122Merge RC2 into 9.3 (actually-stable),!2106Add RC2 changes to 9-3-stable-ee,!2018CE upstream - Friday
Showing
with 44 additions and 37 deletions
class Admin::BuildsController < Admin::ApplicationController
class Admin::JobsController < Admin::ApplicationController
def index
@scope = params[:scope]
@all_builds = Ci::Build
......@@ -20,6 +20,6 @@ def index
def cancel_all
Ci::Build.running_or_pending.each(&:cancel)
redirect_to admin_builds_path
redirect_to admin_jobs_path
end
end
......@@ -46,7 +46,7 @@ def raw
def keep
build.keep_artifacts!
redirect_to namespace_project_build_path(project.namespace, project, build)
redirect_to namespace_project_job_path(project.namespace, project, build)
end
def latest_succeeded
......@@ -79,7 +79,7 @@ def build
end
def build_from_id
project.builds.find_by(id: params[:build_id]) if params[:build_id]
project.builds.find_by(id: params[:job_id]) if params[:job_id]
end
def build_from_ref
......
class Projects::BuildsController < Projects::ApplicationController
class Projects::JobsController < Projects::ApplicationController
before_action :build, except: [:index, :cancel_all]
before_action :authorize_read_build!,
......@@ -38,7 +38,7 @@ def cancel_all
build.cancel if can?(current_user, :update_build, build)
end
redirect_to namespace_project_builds_path(project.namespace, project)
redirect_to namespace_project_jobs_path(project.namespace, project)
end
def show
......@@ -97,7 +97,7 @@ def status
def erase
if @build.erase(erased_by: current_user)
redirect_to namespace_project_build_path(project.namespace, project, @build),
redirect_to namespace_project_job_path(project.namespace, project, @build),
notice: "Build has been successfully erased!"
else
respond_422
......@@ -126,6 +126,6 @@ def build
end
def build_path(build)
namespace_project_build_path(build.project.namespace, build.project, build)
namespace_project_job_path(build.project.namespace, build.project, build)
end
end
......@@ -120,7 +120,7 @@ def blob_icon(mode, name)
def blob_raw_url
if @build && @entry
raw_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: @entry.path)
raw_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: @entry.path)
elsif @snippet
if @snippet.project_id
raw_namespace_project_snippet_path(@project.namespace, @project, @snippet)
......
......@@ -2,7 +2,7 @@ module BuildsHelper
def build_summary(build, skip: false)
if build.has_trace?
if skip
link_to "View job trace", pipeline_build_url(build.pipeline, build)
link_to "View job trace", pipeline_job_url(build.pipeline, build)
else
build.trace.html(last_lines: 10).html_safe
end
......@@ -20,8 +20,8 @@ def sidebar_build_class(build, current_build)
def javascript_build_options
{
page_url: namespace_project_build_url(@project.namespace, @project, @build),
build_url: namespace_project_build_url(@project.namespace, @project, @build, :json),
page_url: namespace_project_job_url(@project.namespace, @project, @build),
build_url: namespace_project_job_url(@project.namespace, @project, @build, :json),
build_status: @build.status,
build_stage: @build.stage,
log_state: ''
......@@ -31,7 +31,7 @@ def javascript_build_options
def build_failed_issue_options
{
title: "Build Failed ##{@build.id}",
description: namespace_project_build_url(@project.namespace, @project, @build)
description: namespace_project_job_url(@project.namespace, @project, @build)
}
end
end
......@@ -50,8 +50,8 @@ def project_cycle_analytics_path(project, *args)
namespace_project_cycle_analytics_path(project.namespace, project, *args)
end
def project_builds_path(project, *args)
namespace_project_builds_path(project.namespace, project, *args)
def project_jobs_path(project, *args)
namespace_project_jobs_path(project.namespace, project, *args)
end
def project_ref_path(project, ref_name, *args)
......@@ -110,8 +110,8 @@ def pipeline_url(pipeline, *args)
namespace_project_pipeline_url(pipeline.project.namespace, pipeline.project, pipeline.id, *args)
end
def pipeline_build_url(pipeline, build, *args)
namespace_project_build_url(pipeline.project.namespace, pipeline.project, build.id, *args)
def pipeline_job_url(pipeline, build, *args)
namespace_project_job_url(pipeline.project.namespace, pipeline.project, build.id, *args)
end
def commits_url(entity, *args)
......@@ -215,13 +215,13 @@ def artifacts_action_path(path, project, build)
case action
when 'download'
download_namespace_project_build_artifacts_path(*args)
download_namespace_project_job_artifacts_path(*args)
when 'browse'
browse_namespace_project_build_artifacts_path(*args)
browse_namespace_project_job_artifacts_path(*args)
when 'file'
file_namespace_project_build_artifacts_path(*args)
file_namespace_project_job_artifacts_path(*args)
when 'raw'
raw_namespace_project_build_artifacts_path(*args)
raw_namespace_project_job_artifacts_path(*args)
end
end
......
......@@ -51,6 +51,12 @@ def persisted_environment
after_destroy :update_project_statistics
class << self
# This is needed for url_for to work,
# as the controller is JobsController
def model_name
ActiveModel::Name.new(self, nil, 'job')
end
def first_pending
pending.unstarted.order('created_at ASC').first
end
......
......@@ -25,7 +25,7 @@ class AnalyticsBuildEntity < Grape::Entity
end
expose :url do |build|
url_to(:namespace_project_build, build)
url_to(:namespace_project_job, build)
end
expose :commit_url do |build|
......
......@@ -6,7 +6,7 @@ class BuildActionEntity < Grape::Entity
end
expose :path do |build|
play_namespace_project_build_path(
play_namespace_project_job_path(
build.project.namespace,
build.project,
build)
......
......@@ -6,7 +6,7 @@ class BuildArtifactEntity < Grape::Entity
end
expose :path do |build|
download_namespace_project_build_artifacts_path(
download_namespace_project_job_artifacts_path(
build.project.namespace,
build.project,
build)
......
......@@ -5,15 +5,15 @@ class BuildEntity < Grape::Entity
expose :name
expose :build_path do |build|
path_to(:namespace_project_build, build)
path_to(:namespace_project_job, build)
end
expose :retry_path do |build|
path_to(:retry_namespace_project_build, build)
path_to(:retry_namespace_project_job, build)
end
expose :play_path, if: -> (*) { playable? } do |build|
path_to(:play_namespace_project_build, build)
path_to(:play_namespace_project_job, build)
end
expose :playable?, as: :playable
......
......@@ -97,6 +97,7 @@ class DynamicPathValidator < ActiveModel::EachValidator
find_file
gitlab-lfs/objects
info/lfs/objects
jobs
new
preview
raw
......
......@@ -20,7 +20,7 @@
%span
Groups
= nav_link path: 'builds#index' do
= link_to admin_builds_path, title: 'Jobs' do
= link_to admin_jobs_path, title: 'Jobs' do
%span
Jobs
= nav_link path: ['runners#index', 'runners#show'] do
......
......@@ -4,15 +4,15 @@
%div{ class: container_class }
.top-area
- build_path_proc = ->(scope) { admin_builds_path(scope: scope) }
- build_path_proc = ->(scope) { admin_jobs_path(scope: scope) }
= render "shared/builds/tabs", build_path_proc: build_path_proc, all_builds: @all_builds, scope: @scope
.nav-controls
- if @all_builds.running_or_pending.any?
= link_to 'Cancel all', cancel_all_admin_builds_path, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post
= link_to 'Cancel all', cancel_all_admin_jobs_path, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post
.row-content-block.second-block
#{(@scope || 'all').capitalize} jobs
%ul.content-list.builds-content-list.admin-builds-table
= render "projects/builds/table", builds: @builds, admin: true
= render "projects/jobs/table", builds: @builds, admin: true
......@@ -85,7 +85,7 @@
%tr.build
%td.id
- if project
= link_to namespace_project_build_path(project.namespace, project, build) do
= link_to namespace_project_job_path(project.namespace, project, build) do
%strong ##{build.id}
- else
%strong ##{build.id}
......
......@@ -92,7 +92,7 @@
-# Shortcut to Pipelines > Jobs
- if project_nav_tab? :builds
%li.hidden
= link_to project_builds_path(@project), title: 'Jobs', class: 'shortcuts-builds' do
= link_to project_jobs_path(@project), title: 'Jobs', class: 'shortcuts-builds' do
Jobs
-# Shortcut to commits page
......
%a{ href: pipeline_build_url(pipeline, build), style: "color:#3777b0;text-decoration:none;" }
%a{ href: pipeline_job_url(pipeline, build), style: "color:#3777b0;text-decoration:none;" }
= build.name
Job #<%= build.id %> ( <%= pipeline_build_url(pipeline, build) %> )
Job #<%= build.id %> ( <%= pipeline_job_url(pipeline, build) %> )
- path_to_directory = browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: directory.path)
- path_to_directory = browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: directory.path)
%tr.tree-item{ 'data-link' => path_to_directory }
%td.tree-item-file-name
......
- path_to_file = file_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: file.path)
- path_to_file = file_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: file.path)
%tr.tree-item{ 'data-link' => path_to_file }
- blob = file.blob
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment