Merge branch 'master' of github.com:warpc/rosa-build

This commit is contained in:
Vladimir Sharshov 2011-10-29 18:06:22 +04:00
commit 8f3ffbe827
10 changed files with 44 additions and 6 deletions

View File

@ -16,7 +16,10 @@ class BuildListsController < ApplicationController
@build_lists = BuildList.paginate :page => params[:page]
end
@action_url = all_build_lists_path
@build_server_status = BuildServer.get_status
#@build_server_status = {:client_count => '1', :count_new_task => '2', :count_build_task => 3}
render :action => 'index'
end

View File

@ -17,9 +17,13 @@ class UsersController < ApplicationController
def new
@user = User.new
@global_roles = Role.by_acter(User).by_target(:system) + Role.by_acter(:all).by_target(:system)
@global_roles.map! {|role| [role.name, role.id]}
end
def edit
@global_roles = Role.by_acter(User).by_target(:system) + Role.by_acter(:all).by_target(:system)
@global_roles.map! {|role| [role.name, role.id]}
end
def create
@ -34,6 +38,7 @@ class UsersController < ApplicationController
end
def update
puts params[:user].inspect
if @user.update_attributes(params[:user])
flash[:notice] = t('flash.user.saved')
redirect_to users_path

View File

@ -30,7 +30,7 @@ class User < ActiveRecord::Base
errors.add(:uname, I18n.t('flash.user.group_uname_exists')) if Group.exists? :uname => uname
}
attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :name, :ssh_key, :uname
attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :name, :ssh_key, :uname, :global_role_id
attr_readonly :uname
attr_accessor :login

View File

@ -6,7 +6,19 @@
%li.active= link_to t("layout.build_lists.all"), project_build_lists_path(@project)
.content
- if controller.action_name == 'all'
.inner
%h2= t('layout.build_lists.build_server_status.header')
.field
%span= t('layout.build_lists.build_server_status.client_count') + ":"
%span= @build_server_status[:client_count]
.field
%span= t('layout.build_lists.build_server_status.count_new_task') + ":"
%span= @build_server_status[:count_new_task]
.field
%span= t('layout.build_lists.build_server_status.count_build_task') + ":"
%span= @build_server_status[:count_build_task]
.inner
= render :partial => "build_lists/filter", :action_url => @action_url

View File

@ -7,6 +7,9 @@
.group
= f.label :email, t("activerecord.attributes.user.email"), :class => :label
= f.text_field :email, :class => 'text_field'
.group
= f.label :global_role_id, t("activerecord.attributes.user.global_role"), :class => :label
= f.select :global_role_id, options_for_select(@global_roles, @user.global_role_id)
.group
= f.label :ssh_key, t("activerecord.attributes.user.ssh_key"), :class => :label
= f.text_area :ssh_key, :class => 'text_area'

View File

@ -21,6 +21,11 @@
= t("activerecord.attributes.user.email")
\:
= @user.email
%p
%b
= t("activerecord.attributes.user.global_role")
\:
= @user.global_role.name
%p
%b
= t("activerecord.attributes.user.created_at")

View File

@ -229,6 +229,12 @@ ru:
cancel_successed: 'Сборка отменена.'
cancel_failed: 'При отмене сборки произошла ошибка!'
build_server_status:
header: Статус сборочного сервера
client_count: Число клиентов
count_new_task: Число заданий в очереди
count_build_task: Число выполняемых заданий
items:
statuses:
build_error: ошибка сборки

View File

@ -314,8 +314,8 @@ API для работы с ACL
- `can_perform? (target = :system)` -- может ли `current_user` выполнить
текущее действие
- `check_global_rights` -- делает редирект назад, если пользователь вообще
не может совершить текущее действие
- `check_global_access` -- делает редирект назад или на главную, если
пользователь вообще не может совершить текущее действие
- `roles_to(object)` -- возвращает список ролей `current_user`-а по отношению
к объекту
- `rights_to(object)` -- возвращает список прав `current_user`-а по отношению

View File

@ -75,6 +75,10 @@ class BuildServer
def self.delete_build_list idlist
self.client.call('delete_build_list', idlist)
end
def get_status
self.client.call('get_status')
end
def self.freeze platform_name, new_repo_name = nil
self.client.call('freeze_platform', platform_name, new_repo_name)

View File

@ -129,7 +129,7 @@ class ActiveRecord::Base
h
end
vis = vis[self.name]
return [] if !vis or vis.empty?
return where('1=2') if !vis or vis.empty?
if vis == self::VISIBILITIES
return scoped # all
else