This repository has been archived by the owner on May 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New feature: All builds page for admin user
Signed-off-by: Dmitriy Zaporozhets <[email protected]>
- Loading branch information
1 parent
96906f2
commit 0a4a1af
Showing
7 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Admin::BuildsController < Admin::ApplicationController | ||
before_filter :authenticate_user! | ||
|
||
def index | ||
@builds = Build.order('created_at DESC').page(params[:page]).per(30) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
%tr.build.alert{class: build_status_alert_class(build)} | ||
%td.status | ||
= build.status | ||
|
||
%td.runner | ||
- if build.runner | ||
= link_to build.runner.id, admin_runner_path(build.runner) | ||
|
||
%td.build-link | ||
= link_to build_url(build) do | ||
%strong #{build.short_sha} | ||
|
||
%td.build-project | ||
= truncate build.project.name, length: 30 | ||
|
||
%td.build-message | ||
%span= truncate(build.git_commit_message, length: 50) | ||
|
||
%td.build-branch | ||
= build.ref | ||
|
||
%td.duration | ||
- if build.duration | ||
#{distance_of_time_in_words build.duration} | ||
|
||
%td.timestamp | ||
- if build.finished_at | ||
%span #{time_ago_in_words build.finished_at} ago |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
= content_for :title do | ||
%h3.project-title | ||
All builds | ||
|
||
.pull-right | ||
%small | ||
= pluralize(@builds.total_count, 'build') | ||
|
||
%table.builds | ||
%thead | ||
%tr | ||
%th Status | ||
%th Runner | ||
%th Commit | ||
%th Project | ||
%th Message | ||
%th Branch | ||
%th Duration | ||
%th Finished at | ||
|
||
= render @builds | ||
|
||
= paginate @builds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'spec_helper' | ||
|
||
describe "Admin Builds" do | ||
let(:project) { FactoryGirl.create :project } | ||
let(:build) { FactoryGirl.create :build, project: project } | ||
|
||
before do | ||
skip_admin_auth | ||
login_as :user | ||
end | ||
|
||
describe "GET /admin/builds" do | ||
before do | ||
build | ||
visit admin_builds_path | ||
end | ||
|
||
it { page.should have_content "All builds" } | ||
it { page.should have_content build.short_sha } | ||
end | ||
end |