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
Tatuya Kamada
gitlab-ce
Commits
52ba3a2d
Commit
52ba3a2d
authored
May 18, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display validation errors when admin edits a runner
parent
bf9cc351
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
app/controllers/admin/runners_controller.rb
app/controllers/admin/runners_controller.rb
+16
-10
app/views/projects/runners/_form.html.haml
app/views/projects/runners/_form.html.haml
+1
-1
No files found.
app/controllers/admin/runners_controller.rb
View file @
52ba3a2d
...
@@ -9,19 +9,13 @@ class Admin::RunnersController < Admin::ApplicationController
...
@@ -9,19 +9,13 @@ class Admin::RunnersController < Admin::ApplicationController
end
end
def
show
def
show
@builds
=
@runner
.
builds
.
order
(
'id DESC'
).
first
(
30
)
set_builds_and_projects
@projects
=
if
params
[
:search
].
present?
::
Project
.
search
(
params
[
:search
])
else
Project
.
all
end
@projects
=
@projects
.
where
.
not
(
id:
@runner
.
projects
.
select
(
:id
))
if
@runner
.
projects
.
any?
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
end
end
def
update
def
update
@runner
.
update_attributes
(
runner_params
)
unless
@runner
.
update_attributes
(
runner_params
)
set_builds_and_projects
and
return
render
'show'
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
js
format
.
js
...
@@ -60,4 +54,16 @@ class Admin::RunnersController < Admin::ApplicationController
...
@@ -60,4 +54,16 @@ class Admin::RunnersController < Admin::ApplicationController
def
runner_params
def
runner_params
params
.
require
(
:runner
).
permit
(
Ci
::
Runner
::
FORM_EDITABLE
)
params
.
require
(
:runner
).
permit
(
Ci
::
Runner
::
FORM_EDITABLE
)
end
end
def
set_builds_and_projects
@builds
=
runner
.
builds
.
order
(
'id DESC'
).
first
(
30
)
@projects
=
if
params
[
:search
].
present?
::
Project
.
search
(
params
[
:search
])
else
Project
.
all
end
@projects
=
@projects
.
where
.
not
(
id:
runner
.
projects
.
select
(
:id
))
if
runner
.
projects
.
any?
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
end
end
end
app/views/projects/runners/_form.html.haml
View file @
52ba3a2d
=
form_for
runner
,
url:
runner_form_url
,
html:
{
class:
'form-horizontal'
}
do
|
f
|
=
form_for
runner
,
url:
runner_form_url
,
html:
{
class:
'form-horizontal'
}
do
|
f
|
=
form_errors
(
@
runner
)
=
form_errors
(
runner
)
.form-group
.form-group
=
label
:active
,
"Active"
,
class:
'control-label'
=
label
:active
,
"Active"
,
class:
'control-label'
.col-sm-10
.col-sm-10
...
...
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