summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-03 14:35:08 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-03 14:35:08 +0300
commit5c03efdde80049f68c1a5b526b01b973d9e7c80c (patch)
treef3b80f906592f3d808c812e792d24bfbfb5d4449
parent2f66de0555d8229437777c83434f74d692f1f5a2 (diff)
downloadgitlab-ci-5c03efdde80049f68c1a5b526b01b973d9e7c80c.tar.gz
Project adding to REST. Restyle application. Left nav for project layout
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock8
-rw-r--r--app/assets/stylesheets/main.scss78
-rw-r--r--app/controllers/projects_controller.rb50
-rw-r--r--app/controllers/runner_projects_controller.rb1
-rw-r--r--app/views/layouts/_foot.html.haml8
-rw-r--r--app/views/layouts/_head.html.haml8
-rw-r--r--app/views/layouts/_info.html.haml13
-rw-r--r--app/views/layouts/_nav.html.haml27
-rw-r--r--app/views/layouts/application.html.haml51
-rw-r--r--app/views/layouts/project.html.haml43
-rw-r--r--app/views/projects/details.html.haml12
-rw-r--r--app/views/projects/edit.html.haml6
-rw-r--r--app/views/projects/gitlab.html.haml49
-rw-r--r--app/views/projects/show.html.haml23
-rw-r--r--app/views/projects/stats.html.haml3
-rw-r--r--app/views/runner_projects/index.html.haml113
-rw-r--r--app/views/runners/index.html.haml8
-rw-r--r--app/views/shared/_no_runners.html.haml7
-rw-r--r--app/views/user_sessions/new.html.haml7
20 files changed, 269 insertions, 248 deletions
diff --git a/Gemfile b/Gemfile
index 42d7ded..c5fefa6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -60,7 +60,7 @@ group :assets do
gem 'uglifier', '>= 1.0.3'
gem "therubyracer"
gem 'bootstrap-sass'
- gem "font-awesome-sass-rails", "~> 3.0.0"
+ gem "font-awesome-sass-rails"
end
diff --git a/Gemfile.lock b/Gemfile.lock
index fa90f04..ef9eb8e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -112,7 +112,7 @@ GEM
haml (>= 3.1, < 4.1)
railties (>= 3.1, < 4.1)
hashie (2.0.5)
- hike (1.2.2)
+ hike (1.2.3)
httparty (0.11.0)
multi_json (~> 1.0)
multi_xml (>= 0.5.2)
@@ -136,7 +136,7 @@ GEM
treetop (~> 1.4.8)
method_source (0.8.1)
mime-types (1.23)
- multi_json (1.7.5)
+ multi_json (1.7.7)
multi_xml (0.5.3)
mysql2 (0.3.11)
nokogiri (1.5.9)
@@ -178,7 +178,7 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
- rake (10.0.4)
+ rake (10.1.0)
rb-fsevent (0.9.3)
rb-inotify (0.9.0)
ffi (>= 0.5.0)
@@ -274,7 +274,7 @@ DEPENDENCIES
coveralls
factory_girl_rails
ffaker
- font-awesome-sass-rails (~> 3.0.0)
+ font-awesome-sass-rails
foreman
gitlab_ci_meta
grape
diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss
index c9df291..0e527b0 100644
--- a/app/assets/stylesheets/main.scss
+++ b/app/assets/stylesheets/main.scss
@@ -1,7 +1,11 @@
@import "bootstrap";
@import "font-awesome";
-$style_color: #5bc;
+$style_color: #289;
+
+.navbar-static-top {
+ margin-bottom: 20px;
+}
body {
color:#666;
@@ -9,10 +13,10 @@ body {
}
a {
- color: #3ab;
+ color: $style_color;
&:hover {
- color: #278;
+ color: #3AB;
}
}
@@ -24,12 +28,12 @@ a {
.navbar-ci {
.navbar-inner {
padding: 4px;
- background: #2AB;
+ background: $style_color;
.brand,
.nav > li > a {
color: #fff;
- text-shadow: 0 1px 0 #29b;
+ text-shadow: 0 1px 0 #167;
}
}
}
@@ -60,8 +64,6 @@ pre.trace {
margin-bottom: 5px;
}
-.navbar .navbar-inner { border-radius: 0; }
-
.builds {
@extend .table;
@@ -76,21 +78,10 @@ pre.trace {
}
.btn {
- background: $style_color;
- color: #fff;
- text-shadow: 0 1px 0 #29b;
- border-radius:0;
- border: none;
-
- &:hover {
- background: #6cd;
- color: #fff;
- text-shadow: 0 1px 0 #29b;
- }
-
&.btn-primary {
background: #29a;
border:1px solid #279;
+ padding: 4px 20px;
}
&.btn-danger {
@@ -100,18 +91,10 @@ pre.trace {
}
}
-.well {
- border-radius: 0;
-}
-
.form-actions {
background: none;
}
-.alert {
- border-radius: 0;
-}
-
h3.error { color: #B94A48; }
.padded {
@@ -162,15 +145,6 @@ h3.error { color: #B94A48; }
@include box-shadow(0 0 0 3px #eee);
}
-form {
- input[type="email"],
- input[type="password"],
- input[type="text"] {
- border-radius: 0;
- padding: 5px;
- }
-}
-
fieldset {
legend {
font-size: 18px;
@@ -213,3 +187,35 @@ td form {
padding: 20px;
background: #AAA;
}
+
+.login-box {
+ width: 400px;
+ position: relative;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ -ms-border-radius: 5px;
+ -o-border-radius: 5px;
+ border-radius: 5px;
+ margin: auto;
+ padding: 20px;
+ background: white;
+
+ input[type="email"], input[type="password"], input[type="text"], select {
+ width: 250px;
+ }
+}
+
+.table {
+ th {
+ background: #eee;
+ background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf));
+ background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf);
+ background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf);
+ background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf);
+ border-bottom: 1px solid #CCC;
+ }
+}
+
+.project-title {
+ margin: 0;
+}
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index b4138c3..722e4f7 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -4,6 +4,8 @@ class ProjectsController < ApplicationController
before_filter :authenticate_token!, only: [:build]
before_filter :no_cache, only: [:status]
+ layout 'project', except: [:index, :gitlab]
+
def index
@projects = Project.order('name ASC')
@projects = @projects.public unless current_user
@@ -26,23 +28,30 @@ class ProjectsController < ApplicationController
def details
end
- def new
- @project = Project.new
- end
+ def create
+ project = YAML.load(params[:project])
- def edit
- end
+ params = {
+ name: project.name_with_namespace,
+ gitlab_id: project.id,
+ gitlab_url: project.web_url,
+ scripts: 'ls -la',
+ default_ref: project.default_branch || 'master',
+ ssh_url_to_repo: project.ssh_url_to_repo
+ }
- def create
- @project = Project.new(params[:project])
+ @project = Project.new(params)
if @project.save
- redirect_to @project, notice: 'Project was successfully created.'
+ redirect_to project_path(@project, show_guide: true), notice: 'Project was successfully created.'
else
- render action: "new"
+ redirect_to :back, alert: 'Cannot save project'
end
end
+ def edit
+ end
+
def update
if project.update_attributes(params[:project])
redirect_to project, notice: 'Project was successfully updated.'
@@ -99,27 +108,8 @@ class ProjectsController < ApplicationController
def gitlab
@projects = Project.from_gitlab(current_user)
- end
-
- def add
- project = YAML.load(params[:project])
-
- params = {
- name: project.name_with_namespace,
- gitlab_id: project.id,
- gitlab_url: project.web_url,
- scripts: 'ls -la',
- default_ref: project.default_branch,
- ssh_url_to_repo: project.ssh_url_to_repo
- }
-
- @project = Project.new(params)
-
- if @project.save
- redirect_to project_path(@project, show_guide: true), notice: 'Project was successfully created.'
- else
- redirect_to :back, alert: 'Cannot save project'
- end
+ rescue
+ @error = 'Failed to fetch GitLab projects'
end
protected
diff --git a/app/controllers/runner_projects_controller.rb b/app/controllers/runner_projects_controller.rb
index 30c53e7..f57f317 100644
--- a/app/controllers/runner_projects_controller.rb
+++ b/app/controllers/runner_projects_controller.rb
@@ -1,5 +1,6 @@
class RunnerProjectsController < ApplicationController
before_filter :authenticate_user!
+ layout 'project'
def index
@runner_projects = project.runner_projects.all
diff --git a/app/views/layouts/_foot.html.haml b/app/views/layouts/_foot.html.haml
new file mode 100644
index 0000000..a3bc116
--- /dev/null
+++ b/app/views/layouts/_foot.html.haml
@@ -0,0 +1,8 @@
+%hr
+.container-fluid
+ .pull-right
+ %p.light
+ GitLab CI
+ %span= GitlabCi::Version
+ %small= GitlabCi::Revision
+
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
new file mode 100644
index 0000000..97503b6
--- /dev/null
+++ b/app/views/layouts/_head.html.haml
@@ -0,0 +1,8 @@
+%head
+ %meta{charset: "utf-8"}
+ %title GitLab CI
+ = stylesheet_link_tag "application", :media => "all"
+ = javascript_include_tag "application"
+ = csrf_meta_tags
+ = favicon_link_tag 'favicon.ico'
+
diff --git a/app/views/layouts/_info.html.haml b/app/views/layouts/_info.html.haml
new file mode 100644
index 0000000..e19197f
--- /dev/null
+++ b/app/views/layouts/_info.html.haml
@@ -0,0 +1,13 @@
+.container-fluid
+ - if alert || notice
+ - if alert
+ .alert= alert
+ - if notice
+ .alert.alert-info= notice
+
+ - if current_user
+ - if @project && @project.runners.count.zero? && !params[:show_guide]
+ .alert.alert-error
+ %span You should assign at least one runner to project for processing project builds. Visit #{link_to 'this page', project_runner_projects_path(@project)} to assign runner
+ - elsif Runner.count.zero?
+ = render 'shared/no_runners'
diff --git a/app/views/layouts/_nav.html.haml b/app/views/layouts/_nav.html.haml
new file mode 100644
index 0000000..d986b38
--- /dev/null
+++ b/app/views/layouts/_nav.html.haml
@@ -0,0 +1,27 @@
+.navbar.navbar-static-top.navbar-ci
+ .navbar-inner
+ .container-fluid
+ = link_to 'GitLab CI', root_path, class: "brand"
+ %ul.nav
+ - if current_user
+ %li
+ = link_to 'GitLab Projects', gitlab_projects_path
+ %li
+ = link_to runners_path do
+ Runners
+ %ul.nav.pull-right
+ - if current_user
+ %li
+ = link_to user_sessions_path do
+ .profile-holder
+ = image_tag gravatar_icon(current_user.email, 24)
+ %span= current_user.email
+ %li
+ = link_to user_sessions_path, class: "logout", method: :delete do
+ %i.icon-signout
+ Logout
+ - else
+ %li
+ = link_to 'Login', new_user_sessions_path
+
+
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index ee33b61..49b00b0 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -1,52 +1,9 @@
!!! 5
%html{ lang: "en"}
- %head
- %meta{charset: "utf-8"}
- %title GitLab CI
- = stylesheet_link_tag "application", :media => "all"
- = javascript_include_tag "application"
- = csrf_meta_tags
- = favicon_link_tag 'favicon.ico'
+ = render 'layouts/head'
%body
- .navbar.navbar-static-top.navbar-ci
- .navbar-inner
- .container-fluid
- = link_to 'GitLab CI', root_path, class: "brand"
- %ul.nav
- - if current_user
- %li
- = link_to 'GitLab Projects', gitlab_projects_path
- %li
- = link_to 'Runners', runners_path
- %ul.nav.pull-right
- - if current_user
- %li
- = link_to user_sessions_path do
- .profile-holder
- = image_tag gravatar_icon(current_user.email, 24)
- %span= current_user.email
- %li
- = link_to user_sessions_path, class: "logout", method: :delete do
- %i.icon-signout
- Logout
- - else
- %li
- = link_to 'Login', new_user_sessions_path
+ = render 'layouts/nav'
+ = render 'layouts/info'
.container-fluid
- - if alert || notice
- %br
- - if alert
- .alert= alert
- - if notice
- .alert.alert-info= notice
-
= yield
- .pull-left
- .padded
- .right
- .padded
- %p.light
- GitLab CI
- %span= GitlabCi::Version
- %small= GitlabCi::Revision
-
+ = render 'layouts/foot'
diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml
new file mode 100644
index 0000000..8f3d883
--- /dev/null
+++ b/app/views/layouts/project.html.haml
@@ -0,0 +1,43 @@
+!!! 5
+%html{ lang: "en"}
+ = render 'layouts/head'
+ %body
+ = render 'layouts/nav'
+ = render 'layouts/info'
+ .container-fluid
+ %h3.project-title
+ Project: #{@project.name}
+ - if @project.public
+ %small
+ %i.icon-globe
+ Public
+
+ - if @project.gitlab_url.present?
+ .pull-right
+ = link_to 'View on GitLab', @project.gitlab_url, class: 'btn'
+ %hr
+ .container-fluid
+ .row-fluid
+ - if current_user
+ .span2
+ %ul.nav.nav-tabs.nav-stacked
+ %li
+ = link_to project_path(@project) do
+ Builds
+ %small.pull-right= @project.builds.count
+ %li
+ = link_to project_runner_projects_path(@project) do
+ Runners
+ %small.pull-right= @project.runner_projects.count
+ %li
+ = link_to details_project_path(@project) do
+ Details
+ %li
+ = link_to stats_project_path(@project) do
+ Stats
+ %li
+ = link_to edit_project_path(@project) do
+ Settings
+ .span10
+ = yield
+ = render 'layouts/foot'
diff --git a/app/views/projects/details.html.haml b/app/views/projects/details.html.haml
index e3f848f..205c221 100644
--- a/app/views/projects/details.html.haml
+++ b/app/views/projects/details.html.haml
@@ -1,15 +1,3 @@
-%h3
- Project: #{link_to @project.name, @project} &rarr; Details
- - if @project.gitlab_url.present?
- %small= link_to 'View on GitLab', @project.gitlab_url
- .right
- = link_to project_path(@project), class: 'btn btn-small' do
- Builds
- %a.btn.btn-small{href: edit_project_path(@project)}
- %i.icon-edit.icon-white
- Edit
-
-
%p.lead Integration with GitLab and other services
%form.form-horizontal
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 1fa923f..bcc5832 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -1,7 +1 @@
-%h3
- Project: #{@project.name} &rarr; Edit
-= link_to project_path(@project) do
- &larr; Back to project
-%hr
-
= render 'form'
diff --git a/app/views/projects/gitlab.html.haml b/app/views/projects/gitlab.html.haml
index 91644e6..74a4c46 100644
--- a/app/views/projects/gitlab.html.haml
+++ b/app/views/projects/gitlab.html.haml
@@ -1,25 +1,32 @@
%h3 GitLab Owned projects:
-%table.table
- %tr
- %th ID
- %th Name
- %th Repo
- %th
- - @projects.each do |project|
+- if @error
+ .alert.alert-error
+ %h5
+ %i.icon-exclamation
+ = @error
+- else
+ %table.table
%tr
- %td
- = project.id
- %td
- = project.name_with_namespace
- %td
- = link_to project.web_url, project.web_url
- %td
- - if Project.already_added?(project)
- %strong
- Added
- - else
- = form_tag add_projects_path do
- = hidden_field_tag :project, project.to_yaml
- = submit_tag 'Add', class: 'btn btn-small'
+ %th ID
+ %th Name
+ %th Repo
+ %th
+
+ - @projects.each do |project|
+ %tr
+ %td
+ = project.id
+ %td
+ = project.name_with_namespace
+ %td
+ = link_to project.web_url, project.web_url
+ %td
+ - if Project.already_added?(project)
+ %strong
+ Added
+ - else
+ = form_tag projects_path do
+ = hidden_field_tag :project, project.to_yaml
+ = submit_tag 'Add', class: 'btn btn-small'
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index db854c9..ff4d0fc 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -1,28 +1,5 @@
= render 'shared/guide' if params[:show_guide].present?
-%h3
- Project: #{@project.name}
- - if @project.public
- %small (Public)
-
- - if @project.gitlab_url.present?
- %small= link_to 'View on GitLab', @project.gitlab_url
-
- - if current_user
- .pull-right
- %span
- = link_to 'Runners', project_runner_projects_path(@project), class: 'btn btn-small'
- %span
- = link_to details_project_path(@project), class: 'btn btn-small' do
- Details
- %span
- = link_to stats_project_path(@project), class: 'btn btn-small' do
- Stats
- %span
- = link_to edit_project_path(@project), class: 'btn btn-small' do
- %i.icon-edit.icon-white
- Edit
-
%ul.nav.nav-tabs
%li{class: ref_tab_class}
diff --git a/app/views/projects/stats.html.haml b/app/views/projects/stats.html.haml
index 0e977cd..1b78cc7 100644
--- a/app/views/projects/stats.html.haml
+++ b/app/views/projects/stats.html.haml
@@ -1,6 +1,3 @@
-%h3
- Project: #{link_to @project.name, @project} &rarr; Stats
-
%p.lead Some stats related to the project
.row-fluid
diff --git a/app/views/runner_projects/index.html.haml b/app/views/runner_projects/index.html.haml
index 8c34de6..f841a04 100644
--- a/app/views/runner_projects/index.html.haml
+++ b/app/views/runner_projects/index.html.haml
@@ -1,64 +1,57 @@
-%h3
- Project: #{link_to @project.name, @project} &rarr; Runners
-%br
-
-%p
+%p.lead
To register new runner visit #{link_to 'this page ', runners_path}
-%h5 Activated:
-
-%table.table
- %tr
- %th Runner ID
- %th Runner Token
- %th Last build
- %th Builds Stats
- %th Registered
- %th
-
- - @runner_projects.each do |runner_project|
- - runner = runner_project.runner
- - builds = runner.builds.where(project_id: @project.id)
- %tr
- %td
- %span.badge.badge-info= runner.id
- %td
- = runner.token
- %td
- - last_build = builds.last
- - if last_build
- = link_to last_build.short_sha, [last_build.project, last_build]
- - else
- unknown
- %td
- %span.badge.badge-success
- #{builds.success.count}
- %span /
- %span.badge.badge-important
- #{builds.failed.count}
- %td
- #{time_ago_in_words(runner_project.created_at)} ago
- %td
- = link_to 'Disable', [@project, runner_project], data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger btn-small right'
-
-- if @runner_projects.blank?
- .alert.alert-error
- %h5 You should add at least one runner to process project builds
+.row-fluid
+ .span7
+ %h5 Activated:
+ %table.table
+ %tr
+ %th Runner ID
+ %th Runner Token
+ %th Last build
+ %th Builds Stats
+ %th Registered
+ %th
-%h5 Available
-%table.table
- %tr
- %th ID
- %th Token
- %th
+ - @runner_projects.each do |runner_project|
+ - runner = runner_project.runner
+ - builds = runner.builds.where(project_id: @project.id)
+ %tr
+ %td
+ %span.badge.badge-info= runner.id
+ %td
+ = runner.token
+ %td
+ - last_build = builds.last
+ - if last_build
+ = link_to last_build.short_sha, [last_build.project, last_build]
+ - else
+ unknown
+ %td
+ %span.badge.badge-success
+ #{builds.success.count}
+ %span /
+ %span.badge.badge-important
+ #{builds.failed.count}
+ %td
+ #{time_ago_in_words(runner_project.created_at)} ago
+ %td
+ = link_to 'Disable', [@project, runner_project], data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger btn-small right'
+ .span5
+ %h5 Available
+ %table.table
+ %tr
+ %th ID
+ %th Token
+ %th
- - (Runner.all - @project.runners).each do |runner|
- %tr
- %td
- = runner.id
- %td
- = runner.token
- %td
- = form_for [@project, @runner_project] do |f|
- = f.hidden_field :runner_id, value: runner.id
- = f.submit 'Add', class: 'btn btn-small'
+ - (Runner.all - @project.runners).each do |runner|
+ %tr
+ %td
+ = runner.id
+ %td
+ = runner.token
+ %td
+ = form_for [@project, @runner_project] do |f|
+ = f.hidden_field :runner_id, value: runner.id
+ = f.submit 'Add', class: 'btn btn-small'
diff --git a/app/views/runners/index.html.haml b/app/views/runners/index.html.haml
index 815dc6e..72570c6 100644
--- a/app/views/runners/index.html.haml
+++ b/app/views/runners/index.html.haml
@@ -1,14 +1,16 @@
%h3
Runners
+.alert.alert-info
+ %strong To register new runner you should use next token
+ %code #{GitlabCi::RunnersToken}
+
%p
Runner is a process which run a build.
You can setup as much runners as you need.
%br
Runners can be placed on separate users, servers, even on your local machine
%br
- To register new runner you should use next token
- %code #{GitlabCi::RunnersToken}
%table.table
%tr
@@ -44,3 +46,5 @@
#{time_ago_in_words(runner.created_at)} ago
%td
= link_to 'Block', runner, data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger btn-small right'
+
+
diff --git a/app/views/shared/_no_runners.html.haml b/app/views/shared/_no_runners.html.haml
new file mode 100644
index 0000000..f4fb53e
--- /dev/null
+++ b/app/views/shared/_no_runners.html.haml
@@ -0,0 +1,7 @@
+.alert.alert-error
+ %p
+ Now you need Runners to process your builds.
+ %span
+ Checkout #{link_to 'runner repository', 'https://github.com/gitlabhq/gitlab-ci-runner#installation', target: '_blank'} to find out how install one
+
+
diff --git a/app/views/user_sessions/new.html.haml b/app/views/user_sessions/new.html.haml
index 8da16aa..60e1e39 100644
--- a/app/views/user_sessions/new.html.haml
+++ b/app/views/user_sessions/new.html.haml
@@ -1,3 +1,4 @@
-%h3 Sign in with GitLab account
-%hr
-= render 'form'
+.login-box
+ %h3 Sign in with GitLab account
+ %hr
+ = render 'form'