Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
4d69c6a3
Commit
4d69c6a3
authored
Oct 14, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor builds view
parent
09255eec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
31 deletions
+32
-31
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+5
-5
app/models/commit_status.rb
app/models/commit_status.rb
+1
-0
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+2
-1
app/views/projects/builds/_build.html.haml
app/views/projects/builds/_build.html.haml
+2
-4
app/views/projects/builds/index.html.haml
app/views/projects/builds/index.html.haml
+22
-21
No files found.
app/controllers/projects/builds_controller.rb
View file @
4d69c6a3
...
@@ -12,12 +12,12 @@ class Projects::BuildsController < Projects::ApplicationController
...
@@ -12,12 +12,12 @@ class Projects::BuildsController < Projects::ApplicationController
@builds
=
@builds
=
case
@scope
case
@scope
when
'pending'
when
'all'
@all_builds
.
pending
when
'running'
@all_builds
.
running
else
@all_builds
@all_builds
when
'finished'
@all_builds
.
finished
else
@all_builds
.
running_or_pending
end
end
end
end
...
...
app/models/commit_status.rb
View file @
4d69c6a3
...
@@ -16,6 +16,7 @@ class CommitStatus < ActiveRecord::Base
...
@@ -16,6 +16,7 @@ class CommitStatus < ActiveRecord::Base
scope
:success
,
->
{
where
(
status:
'success'
)
}
scope
:success
,
->
{
where
(
status:
'success'
)
}
scope
:failed
,
->
{
where
(
status:
'failed'
)
}
scope
:failed
,
->
{
where
(
status:
'failed'
)
}
scope
:running_or_pending
,
->
{
where
(
status
:[
:running
,
:pending
])
}
scope
:running_or_pending
,
->
{
where
(
status
:[
:running
,
:pending
])
}
scope
:finished
,
->
{
where
(
status
:[
:success
,
:failed
,
:canceled
])
}
scope
:latest
,
->
{
where
(
id:
unscope
(
:select
).
select
(
'max(id)'
).
group
(
:name
,
:ref
))
}
scope
:latest
,
->
{
where
(
id:
unscope
(
:select
).
select
(
'max(id)'
).
group
(
:name
,
:ref
))
}
scope
:ordered
,
->
{
order
(
:ref
,
:stage_idx
,
:name
)
}
scope
:ordered
,
->
{
order
(
:ref
,
:stage_idx
,
:name
)
}
scope
:for_ref
,
->
(
ref
)
{
where
(
ref:
ref
)
}
scope
:for_ref
,
->
(
ref
)
{
where
(
ref:
ref
)
}
...
...
app/views/layouts/nav/_project.html.haml
View file @
4d69c6a3
...
@@ -41,9 +41,10 @@
...
@@ -41,9 +41,10 @@
-
if
project_nav_tab?
:builds
-
if
project_nav_tab?
:builds
=
nav_link
(
controller:
%w(builds)
)
do
=
nav_link
(
controller:
%w(builds)
)
do
=
link_to
project_builds_path
(
@project
),
title:
'Builds'
,
class:
'shortcuts-builds'
,
data:
{
placement:
'right'
}
do
=
link_to
project_builds_path
(
@project
),
title:
'Builds'
,
class:
'shortcuts-builds'
,
data:
{
placement:
'right'
}
do
=
icon
(
'
link
fw'
)
=
icon
(
'
cubes
fw'
)
%span
%span
Builds
Builds
%span
.count.builds_counter
=
@project
.
ci_builds
.
running_or_pending
.
count
(
:all
)
-
if
project_nav_tab?
:network
-
if
project_nav_tab?
:network
=
nav_link
(
controller:
%w(network)
)
do
=
nav_link
(
controller:
%w(network)
)
do
...
...
app/views/projects/builds/_build.html.haml
View file @
4d69c6a3
...
@@ -10,12 +10,10 @@
...
@@ -10,12 +10,10 @@
%strong
Build ##{build.id}
%strong
Build ##{build.id}
%td
%td
=
link_to
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
build
.
sha
)
do
=
link_to
build
.
short_sha
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
build
.
sha
)
=
build
.
short_sha
%td
%td
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
build
.
ref
)
do
=
link_to
build
.
ref
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
build
.
ref
)
=
build
.
ref
%td
%td
-
if
build
.
runner
-
if
build
.
runner
...
...
app/views/projects/builds/index.html.haml
View file @
4d69c6a3
-
page_title
"Builds"
-
page_title
"Builds"
-
header_title
project_title
(
@project
,
"Builds"
,
project_builds_path
(
@project
))
-
header_title
project_title
(
@project
,
"Builds"
,
project_builds_path
(
@project
))
%ul
.center-top-menu
.project-issuable-filter
%li
{
class:
(
'active'
if
@scope
.
nil?
)}
.controls
=
link_to
project_builds_path
(
@project
)
do
All builds
%span
.badge.js-totalbuilds-count
=
@all_builds
.
size
%li
{
class:
(
'active'
if
@scope
==
'pending'
)}
=
link_to
project_builds_path
(
@project
,
scope: :pending
)
do
Pending
%span
.badge.js-pending-count
=
@all_builds
.
pending
.
size
%li
{
class:
(
'active'
if
@scope
==
'running'
)}
=
link_to
project_builds_path
(
@project
,
scope: :running
)
do
Running
%span
.badge.js-running-count
=
@all_builds
.
running
.
size
.gray-content-block
.oneline
List of all builds from this project
-
if
@ci_project
&&
current_user
&&
can?
(
current_user
,
:manage_builds
,
@project
)
-
if
@ci_project
&&
current_user
&&
can?
(
current_user
,
:manage_builds
,
@project
)
.pull-
right
.pull-
left.hidden-xs
-
if
@all_builds
.
running_or_pending
.
any?
-
if
@all_builds
.
running_or_pending
.
any?
=
link_to
'Cancel all'
,
cancel_all_namespace_project_builds_path
(
@project
.
namespace
,
@project
),
data:
{
confirm:
'Are you sure?'
},
method: :post
,
class:
'btn btn-danger'
=
link_to
'Cancel all'
,
cancel_all_namespace_project_builds_path
(
@project
.
namespace
,
@project
),
data:
{
confirm:
'Are you sure?'
},
method: :post
,
class:
'btn btn-danger'
%ul
.center-top-menu
%li
{
class:
(
'active'
if
@scope
.
nil?
)}
=
link_to
project_builds_path
(
@project
)
do
Running
%span
.badge.js-running-count
=
@all_builds
.
running_or_pending
.
size
%li
{
class:
(
'active'
if
@scope
==
'finished'
)}
=
link_to
project_builds_path
(
@project
,
scope: :finished
)
do
Finished
%span
.badge.js-running-count
=
@all_builds
.
finished
.
size
%li
{
class:
(
'active'
if
@scope
==
'all'
)}
=
link_to
project_builds_path
(
@project
,
scope: :all
)
do
All
%span
.badge.js-totalbuilds-count
=
@all_builds
.
size
.gray-content-block
List of
#{
@scope
||
'running'
}
builds from this project
%ul
.content-list
%ul
.content-list
-
if
@builds
.
blank?
-
if
@builds
.
blank?
%li
%li
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment