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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
92cbf945
Commit
92cbf945
authored
Apr 26, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to using ProjectCiCdSetting for group_runners_enabled and remove ProjectSettings
parent
c80e6b9c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
60 deletions
+6
-60
app/controllers/projects/runners_controller.rb
app/controllers/projects/runners_controller.rb
+1
-1
app/models/project.rb
app/models/project.rb
+3
-11
app/models/project_settings.rb
app/models/project_settings.rb
+0
-3
db/migrate/20171030155459_create_project_settings.rb
db/migrate/20171030155459_create_project_settings.rb
+0
-14
db/schema.rb
db/schema.rb
+0
-9
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-22
No files found.
app/controllers/projects/runners_controller.rb
View file @
92cbf945
...
...
@@ -53,7 +53,7 @@ class Projects::RunnersController < Projects::ApplicationController
end
def
toggle_group_runners
project
.
toggle_settings!
(
:group_runners_enabled
)
project
.
toggle_
ci_cd_
settings!
(
:group_runners_enabled
)
redirect_to
project_settings_ci_cd_path
(
@project
)
end
...
...
app/models/project.rb
View file @
92cbf945
...
...
@@ -236,14 +236,6 @@ class Project < ActiveRecord::Base
has_many
:project_badges
,
class_name:
'ProjectBadge'
has_one
:ci_cd_settings
,
class_name:
'ProjectCiCdSetting'
has_one
:settings
,
->
(
project
)
{
query
=
where
(
project_id:
project
)
query
.
presence
||
begin
ProjectSettings
.
create
(
project_id:
project
.
id
)
query
end
},
class_name:
'ProjectSettings'
accepts_nested_attributes_for
:variables
,
allow_destroy:
true
accepts_nested_attributes_for
:project_feature
,
update_only:
true
accepts_nested_attributes_for
:import_data
...
...
@@ -253,7 +245,7 @@ class Project < ActiveRecord::Base
delegate
:members
,
to: :team
,
prefix:
true
delegate
:add_user
,
:add_users
,
to: :team
delegate
:add_guest
,
:add_reporter
,
:add_developer
,
:add_master
,
:add_role
,
to: :team
delegate
:group_runners_enabled
,
:group_runners_enabled
=
,
:group_runners_enabled?
,
to: :settings
delegate
:group_runners_enabled
,
:group_runners_enabled
=
,
:group_runners_enabled?
,
to: :
ci_cd_
settings
# Validations
validates
:creator
,
presence:
true
,
on: :create
...
...
@@ -1879,8 +1871,8 @@ class Project < ActiveRecord::Base
[]
end
def
toggle_settings!
(
settings_attribute
)
settings
.
toggle!
(
settings_attribute
)
def
toggle_
ci_cd_
settings!
(
settings_attribute
)
ci_cd_
settings
.
toggle!
(
settings_attribute
)
end
def
gitlab_deploy_token
...
...
app/models/project_settings.rb
deleted
100644 → 0
View file @
c80e6b9c
class
ProjectSettings
<
ActiveRecord
::
Base
belongs_to
:project
end
db/migrate/20171030155459_create_project_settings.rb
deleted
100644 → 0
View file @
c80e6b9c
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
CreateProjectSettings
<
ActiveRecord
::
Migration
DOWNTIME
=
false
def
change
create_table
:project_settings
do
|
t
|
t
.
references
:project
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
boolean
:group_runners_enabled
,
default:
true
,
index:
true
end
end
end
db/schema.rb
View file @
92cbf945
...
...
@@ -1511,14 +1511,6 @@ ActiveRecord::Schema.define(version: 20180425131009) do
add_index
"project_import_data"
,
[
"project_id"
],
name:
"index_project_import_data_on_project_id"
,
using: :btree
create_table
"project_settings"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
boolean
"group_runners_enabled"
,
default:
true
end
add_index
"project_settings"
,
[
"group_runners_enabled"
],
name:
"index_project_settings_on_group_runners_enabled"
,
using: :btree
add_index
"project_settings"
,
[
"project_id"
],
name:
"index_project_settings_on_project_id"
,
using: :btree
create_table
"project_statistics"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
integer
"namespace_id"
,
null:
false
...
...
@@ -2200,7 +2192,6 @@ ActiveRecord::Schema.define(version: 20180425131009) do
add_foreign_key
"project_features"
,
"projects"
,
name:
"fk_18513d9b92"
,
on_delete: :cascade
add_foreign_key
"project_group_links"
,
"projects"
,
name:
"fk_daa8cee94c"
,
on_delete: :cascade
add_foreign_key
"project_import_data"
,
"projects"
,
name:
"fk_ffb9ee3a10"
,
on_delete: :cascade
add_foreign_key
"project_settings"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_statistics"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"protected_branch_merge_access_levels"
,
"protected_branches"
,
name:
"fk_8a3072ccb3"
,
on_delete: :cascade
add_foreign_key
"protected_branch_push_access_levels"
,
"protected_branches"
,
name:
"fk_9ffc86a3d9"
,
on_delete: :cascade
...
...
spec/models/project_spec.rb
View file @
92cbf945
...
...
@@ -123,26 +123,6 @@ describe Project do
expect
(
subject
.
boards
.
size
).
to
eq
1
end
end
describe
'#settings'
do
it
'creates lazily a settings record when the project does not have one associated'
do
project
=
create
:project
expect
(
ProjectSettings
.
count
).
to
eq
0
expect
(
project
.
settings
).
to
be_a
ProjectSettings
expect
(
ProjectSettings
.
count
).
to
eq
1
end
it
'returns the associated record when the project has one associated'
do
project
=
create
:project
,
settings:
create
(
:project_settings
)
expect
(
ProjectSettings
.
count
).
to
eq
1
expect
(
project
.
settings
).
to
be_a
ProjectSettings
expect
(
ProjectSettings
.
count
).
to
eq
1
end
end
end
describe
'modules'
do
...
...
@@ -3595,13 +3575,13 @@ describe Project do
end
end
describe
'#toggle_settings!'
do
describe
'#toggle_
ci_cd_
settings!'
do
it
'toggles the value on #settings'
do
project
=
create
:project
,
group_runners_enabled:
false
expect
(
project
.
group_runners_enabled
).
to
be
false
project
.
toggle_settings!
(
:group_runners_enabled
)
project
.
toggle_
ci_cd_
settings!
(
:group_runners_enabled
)
expect
(
project
.
group_runners_enabled
).
to
be
true
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