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
iv
gitlab-ce
Commits
d40b9ce2
Commit
d40b9ce2
authored
Jul 05, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Admin gitolite logs. Refactored project creation. Few style fixes.
parent
369df86e
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
66 additions
and
24 deletions
+66
-24
app/assets/stylesheets/gitlab_bootstrap.scss
app/assets/stylesheets/gitlab_bootstrap.scss
+7
-0
app/controllers/admin/logs_controller.rb
app/controllers/admin/logs_controller.rb
+6
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+6
-13
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-0
app/models/project.rb
app/models/project.rb
+18
-1
app/views/admin/logs/show.html.haml
app/views/admin/logs/show.html.haml
+6
-0
app/views/events/_event_last_push.html.haml
app/views/events/_event_last_push.html.haml
+1
-1
app/views/layouts/admin.html.haml
app/views/layouts/admin.html.haml
+2
-0
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+4
-5
app/views/projects/create.js.haml
app/views/projects/create.js.haml
+4
-1
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+1
-1
app/views/projects/new.html.haml
app/views/projects/new.html.haml
+1
-1
config/routes.rb
config/routes.rb
+2
-0
lib/gitlab/logger.rb
lib/gitlab/logger.rb
+6
-0
spec/requests/projects_spec.rb
spec/requests/projects_spec.rb
+1
-1
No files found.
app/assets/stylesheets/gitlab_bootstrap.scss
View file @
d40b9ce2
...
@@ -627,3 +627,10 @@ h3.page_title {
...
@@ -627,3 +627,10 @@ h3.page_title {
font-weight
:
600
;
font-weight
:
600
;
line-height
:
28px
;
line-height
:
28px
;
}
}
pre
.logs
{
.log
{
font-size
:
12px
;
line-height
:
18px
;
}
}
app/controllers/admin/logs_controller.rb
0 → 100644
View file @
d40b9ce2
class
Admin::LogsController
<
ApplicationController
layout
"admin"
before_filter
:authenticate_user!
before_filter
:authenticate_admin!
end
app/controllers/projects_controller.rb
View file @
d40b9ce2
...
@@ -21,20 +21,13 @@ class ProjectsController < ApplicationController
...
@@ -21,20 +21,13 @@ class ProjectsController < ApplicationController
@project
=
Project
.
create_by_user
(
params
[
:project
],
current_user
)
@project
=
Project
.
create_by_user
(
params
[
:project
],
current_user
)
respond_to
do
|
format
|
respond_to
do
|
format
|
if
@project
.
valid?
format
.
html
do
format
.
html
{
redirect_to
@project
,
notice:
'Project was successfully created.'
}
if
@project
.
saved?
format
.
js
redirect_to
(
@project
,
notice:
'Project was successfully created.'
)
else
else
format
.
html
{
render
action:
"new"
}
render
action:
"new"
format
.
js
end
end
end
end
rescue
Gitlab
::
Gitolite
::
AccessDenied
render
:js
=>
"location.href = '
#{
errors_githost_path
}
'"
and
return
rescue
StandardError
=>
ex
@project
.
errors
.
add
(
:base
,
"Cant save project. Please try again later"
)
respond_to
do
|
format
|
format
.
html
{
render
action:
"new"
}
format
.
js
format
.
js
end
end
end
end
...
...
app/helpers/application_helper.rb
View file @
d40b9ce2
...
@@ -127,6 +127,7 @@ module ApplicationHelper
...
@@ -127,6 +127,7 @@ module ApplicationHelper
when
:admin_projects
;
controller
.
controller_name
==
"projects"
when
:admin_projects
;
controller
.
controller_name
==
"projects"
when
:admin_emails
;
controller
.
controller_name
==
'mailer'
when
:admin_emails
;
controller
.
controller_name
==
'mailer'
when
:admin_resque
;
controller
.
controller_name
==
'resque'
when
:admin_resque
;
controller
.
controller_name
==
'resque'
when
:admin_logs
;
controller
.
controller_name
==
'logs'
else
else
false
false
...
...
app/models/project.rb
View file @
d40b9ce2
...
@@ -23,6 +23,8 @@ class Project < ActiveRecord::Base
...
@@ -23,6 +23,8 @@ class Project < ActiveRecord::Base
has_many
:wikis
,
:dependent
=>
:destroy
has_many
:wikis
,
:dependent
=>
:destroy
has_many
:protected_branches
,
:dependent
=>
:destroy
has_many
:protected_branches
,
:dependent
=>
:destroy
attr_accessor
:error_code
#
#
# Protected attributes
# Protected attributes
#
#
...
@@ -48,7 +50,7 @@ class Project < ActiveRecord::Base
...
@@ -48,7 +50,7 @@ class Project < ActiveRecord::Base
Project
.
transaction
do
Project
.
transaction
do
project
.
owner
=
user
project
.
owner
=
user
return
project
unless
project
.
save
project
.
save!
# Add user as project master
# Add user as project master
project
.
users_projects
.
create!
(
:project_access
=>
UsersProject
::
MASTER
,
:user
=>
user
)
project
.
users_projects
.
create!
(
:project_access
=>
UsersProject
::
MASTER
,
:user
=>
user
)
...
@@ -59,6 +61,21 @@ class Project < ActiveRecord::Base
...
@@ -59,6 +61,21 @@ class Project < ActiveRecord::Base
end
end
project
project
rescue
Gitlab
::
Gitolite
::
AccessDenied
=>
ex
project
.
error_code
=
:gitolite
project
rescue
=>
ex
project
.
error_code
=
:db
project
.
errors
.
add
(
:base
,
"Cant save project. Please try again later"
)
project
end
def
git_error?
error_code
==
:gitolite
end
def
saved?
id
&&
valid?
end
end
#
#
...
...
app/views/admin/logs/show.html.haml
0 → 100644
View file @
d40b9ce2
%h4
%i
.icon-file
githost.log
%pre
.logs
-
Gitlab
::
Logger
.
read_latest
.
each
do
|
line
|
%span
.log
=
line
app/views/events/_event_last_push.html.haml
View file @
d40b9ce2
...
@@ -12,5 +12,5 @@
...
@@ -12,5 +12,5 @@
=
time_ago_in_words
(
event
.
created_at
)
=
time_ago_in_words
(
event
.
created_at
)
ago.
ago.
=
link_to
new_mr_path_from_push_event
(
event
),
:title
=>
"New Merge Request"
,
:class
=>
"btn
small grouped
primary"
do
=
link_to
new_mr_path_from_push_event
(
event
),
:title
=>
"New Merge Request"
,
:class
=>
"btn
very_small
primary"
do
Create Merge Request
Create Merge Request
app/views/layouts/admin.html.haml
View file @
d40b9ce2
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
=
link_to
"Projects"
,
admin_projects_path
=
link_to
"Projects"
,
admin_projects_path
%li
{
:class
=>
tab_class
(
:admin_users
)}
%li
{
:class
=>
tab_class
(
:admin_users
)}
=
link_to
"Users"
,
admin_users_path
=
link_to
"Users"
,
admin_users_path
%li
{
:class
=>
tab_class
(
:admin_logs
)}
=
link_to
"Logs"
,
admin_logs_path
%li
{
:class
=>
tab_class
(
:admin_emails
)}
%li
{
:class
=>
tab_class
(
:admin_emails
)}
=
link_to
"Emails"
,
admin_emails_path
=
link_to
"Emails"
,
admin_emails_path
%li
{
:class
=>
tab_class
(
:admin_resque
)}
%li
{
:class
=>
tab_class
(
:admin_resque
)}
...
...
app/views/projects/_form.html.haml
View file @
d40b9ce2
...
@@ -10,17 +10,16 @@
...
@@ -10,17 +10,16 @@
.input
.input
=
f
.
text_field
:name
,
:placeholder
=>
"Example Project"
,
:class
=>
"xxlarge"
=
f
.
text_field
:name
,
:placeholder
=>
"Example Project"
,
:class
=>
"xxlarge"
%h
r
%h
5
.page_title
.alert.alert-info
.alert.alert-info
%h5
Advanced settings:
%h5
Advanced settings:
.clearfix
.clearfix
=
f
.
label
:path
do
=
f
.
label
:path
do
Git Clone
Path
.input
.input
.input-prepend
.input-prepend
%span
.add-on
=
Gitlab
.
config
.
ssh_path
%strong
=
f
.
text_field
:path
,
:placeholder
=>
"example_project"
,
:disabled
=>
!
@project
.
new_record?
=
text_field_tag
:ppath
,
@project
.
path_to_repo
,
:class
=>
"xlarge"
,
:disabled
=>
true
%span
.add-on
=
".git"
.clearfix
.clearfix
=
f
.
label
:code
do
=
f
.
label
:code
do
URL
URL
...
...
app/views/projects/create.js.haml
View file @
d40b9ce2
-
if
@project
.
vali
d?
-
if
@project
.
save
d?
:plain
:plain
location.href = "
#{
project_path
(
@project
,
:notice
=>
'Project was successfully created.'
)
}
";
location.href = "
#{
project_path
(
@project
,
:notice
=>
'Project was successfully created.'
)
}
";
-
else
-
else
-
if
@project
.
git_error?
location.href = "
#{
errors_githost_path
}
";
-
else
:plain
:plain
$('.project_new_holder').show();
$('.project_new_holder').show();
$("#new_project").replaceWith("
#{
escape_javascript
(
render
(
'new_form'
))
}
");
$("#new_project").replaceWith("
#{
escape_javascript
(
render
(
'new_form'
))
}
");
...
...
app/views/projects/edit.html.haml
View file @
d40b9ce2
=
render
"project_head"
=
render
"project_head"
.project_edit_holder
.project_edit_holder
%h3
Edit Project
%h3
.page_title
Edit Project
%hr
%hr
=
render
"projects/form"
=
render
"projects/form"
%div
.ajax_loader.hide
%div
.ajax_loader.hide
...
...
app/views/projects/new.html.haml
View file @
d40b9ce2
.project_new_holder
.project_new_holder
%h3
%h3
.page_title
New Project
New Project
%hr
%hr
=
render
'new_form'
=
render
'new_form'
...
...
config/routes.rb
View file @
d40b9ce2
...
@@ -50,6 +50,8 @@ Gitlab::Application.routes.draw do
...
@@ -50,6 +50,8 @@ Gitlab::Application.routes.draw do
get
'mailer/preview_note'
get
'mailer/preview_note'
get
'mailer/preview_user_new'
get
'mailer/preview_user_new'
get
'mailer/preview_issue_new'
get
'mailer/preview_issue_new'
resource
:logs
resource
:resque
,
:controller
=>
'resque'
resource
:resque
,
:controller
=>
'resque'
root
:to
=>
"dashboard#index"
root
:to
=>
"dashboard#index"
end
end
...
...
lib/gitlab/logger.rb
View file @
d40b9ce2
...
@@ -2,7 +2,13 @@ module Gitlab
...
@@ -2,7 +2,13 @@ module Gitlab
class
Logger
class
Logger
def
self
.
error
(
message
)
def
self
.
error
(
message
)
@@logger
||=
::
Logger
.
new
(
File
.
join
(
Rails
.
root
,
"log/githost.log"
))
@@logger
||=
::
Logger
.
new
(
File
.
join
(
Rails
.
root
,
"log/githost.log"
))
message
=
Time
.
now
.
to_s
(
:long
)
+
" -> "
+
message
@@logger
.
error
(
message
)
@@logger
.
error
(
message
)
end
end
def
self
.
read_latest
path
=
Rails
.
root
.
join
(
"log/githost.log"
)
logs
=
`tail -n 50
#{
path
}
`
.
split
(
"
\n
"
)
end
end
end
end
end
spec/requests/projects_spec.rb
View file @
d40b9ce2
...
@@ -120,7 +120,7 @@ describe "Projects" do
...
@@ -120,7 +120,7 @@ describe "Projects" do
visit
edit_project_path
(
@project
)
visit
edit_project_path
(
@project
)
fill_in
'project_name'
,
:with
=>
'Awesome'
fill_in
'project_name'
,
:with
=>
'Awesome'
fill_in
'project_
path
'
,
:with
=>
'gitlabhq'
fill_in
'project_
code
'
,
:with
=>
'gitlabhq'
click_button
"Save"
click_button
"Save"
@project
=
@project
.
reload
@project
=
@project
.
reload
end
end
...
...
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