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
13c26a9b
Commit
13c26a9b
authored
Apr 02, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
df51928f
4d1116ef
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
6 deletions
+79
-6
app/finders/groups_finder.rb
app/finders/groups_finder.rb
+8
-0
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+3
-2
app/views/projects/settings/ci_cd/_form.html.haml
app/views/projects/settings/ci_cd/_form.html.haml
+6
-3
changelogs/unreleased/fix-transfer-group-possibilities.yml
changelogs/unreleased/fix-transfer-group-possibilities.yml
+5
-0
db/migrate/20190325165127_add_managed_to_cluster.rb
db/migrate/20190325165127_add_managed_to_cluster.rb
+17
-0
db/schema.rb
db/schema.rb
+2
-1
spec/factories/clusters/clusters.rb
spec/factories/clusters/clusters.rb
+5
-0
spec/helpers/groups_helper_spec.rb
spec/helpers/groups_helper_spec.rb
+33
-0
No files found.
app/finders/groups_finder.rb
View file @
13c26a9b
...
...
@@ -11,6 +11,7 @@
# parent: Group
# all_available: boolean (defaults to true)
# min_access_level: integer
# exclude_group_ids: array of integers
#
# Users with full private access can see all groups. The `owned` and `parent`
# params can be used to restrict the groups that are returned.
...
...
@@ -29,6 +30,7 @@ class GroupsFinder < UnionFinder
items
=
all_groups
.
map
do
|
item
|
item
=
by_parent
(
item
)
item
=
by_custom_attributes
(
item
)
item
=
exclude_group_ids
(
item
)
item
end
...
...
@@ -72,6 +74,12 @@ class GroupsFinder < UnionFinder
end
# rubocop: enable CodeReuse/ActiveRecord
def
exclude_group_ids
(
groups
)
return
groups
unless
params
[
:exclude_group_ids
]
groups
.
id_not_in
(
params
[
:exclude_group_ids
])
end
# rubocop: disable CodeReuse/ActiveRecord
def
by_parent
(
groups
)
return
groups
unless
params
[
:parent
]
...
...
app/helpers/groups_helper.rb
View file @
13c26a9b
...
...
@@ -118,11 +118,12 @@ module GroupsHelper
end
def
parent_group_options
(
current_group
)
groups
=
current_user
.
owned_groups
.
sort_by
(
&
:human_name
).
map
do
|
group
|
exclude_groups
=
current_group
.
self_and_descendants
.
pluck_primary_key
exclude_groups
<<
current_group
.
parent_id
if
current_group
.
parent_id
groups
=
GroupsFinder
.
new
(
current_user
,
min_access_level:
Gitlab
::
Access
::
OWNER
,
exclude_group_ids:
exclude_groups
).
execute
.
sort_by
(
&
:human_name
).
map
do
|
group
|
{
id:
group
.
id
,
text:
group
.
human_name
}
end
groups
.
delete_if
{
|
group
|
group
[
:id
]
==
current_group
.
id
}
groups
.
to_json
end
...
...
app/views/projects/settings/ci_cd/_form.html.haml
View file @
13c26a9b
...
...
@@ -101,18 +101,21 @@
%li
tap --coverage-report=text-summary (NodeJS) -
%code
^Statements\s*:\s*([^%]+)
%li
nyc npm test (NodeJS) -
%code
All files[^|]*\|[^|]*\s+([\d\.]+)
%li
excoveralls (Elixir) -
%code
\[TOTAL\]\s+(\d+\.\d+)%
%li
mix test --cover (Elixir) -
%code
\d+.\d+\%\s+\|\s+Total
%li
JaCoCo (Java/Kotlin)
%code
Total.*?([0-9]{1,3})%
%li
go test -cover (Go)
%code
coverage: \d+.\d+% of statements
%li
nyc npm test (NodeJS) -
%code
All files[^|]*\|[^|]*\s+([\d\.]+)
=
f
.
submit
_
(
'Save changes'
),
class:
"btn btn-success"
...
...
changelogs/unreleased/fix-transfer-group-possibilities.yml
0 → 100644
View file @
13c26a9b
---
title
:
Fix group transfer selection possibilities
merge_request
:
26123
author
:
Peter Marko
type
:
fixed
db/migrate/20190325165127_add_managed_to_cluster.rb
0 → 100644
View file @
13c26a9b
# frozen_string_literal: true
class
AddManagedToCluster
<
ActiveRecord
::
Migration
[
5.0
]
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
DOWNTIME
=
false
def
up
add_column_with_default
(
:clusters
,
:managed
,
:boolean
,
default:
true
)
end
def
down
remove_column
(
:clusters
,
:managed
)
end
end
db/schema.rb
View file @
13c26a9b
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2019032
2132835
)
do
ActiveRecord
::
Schema
.
define
(
version:
2019032
5165127
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -835,6 +835,7 @@ ActiveRecord::Schema.define(version: 20190322132835) do
t
.
string
"environment_scope"
,
default:
"*"
,
null:
false
t
.
integer
"cluster_type"
,
limit:
2
,
default:
3
,
null:
false
t
.
string
"domain"
t
.
boolean
"managed"
,
default:
true
,
null:
false
t
.
index
[
"enabled"
],
name:
"index_clusters_on_enabled"
,
using: :btree
t
.
index
[
"user_id"
],
name:
"index_clusters_on_user_id"
,
using: :btree
end
...
...
spec/factories/clusters/clusters.rb
View file @
13c26a9b
...
...
@@ -3,6 +3,7 @@ FactoryBot.define do
user
name
'test-cluster'
cluster_type
:project_type
managed
true
trait
:instance
do
cluster_type
{
Clusters
::
Cluster
.
cluster_types
[
:instance_type
]
}
...
...
@@ -63,5 +64,9 @@ FactoryBot.define do
trait
:with_domain
do
domain
'example.com'
end
trait
:user_managed
do
managed
false
end
end
end
spec/helpers/groups_helper_spec.rb
View file @
13c26a9b
...
...
@@ -229,4 +229,37 @@ describe GroupsHelper do
expect
(
helper
.
group_sidebar_links
).
not_to
include
(
*
cross_project_features
)
end
end
describe
'parent_group_options'
,
:nested_groups
do
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
name:
'group'
)
}
let
(
:group2
)
{
create
(
:group
,
name:
'group2'
)
}
before
do
group
.
add_owner
(
current_user
)
group2
.
add_owner
(
current_user
)
end
it
'includes explicitly owned groups except self'
do
expect
(
parent_group_options
(
group2
)).
to
eq
([{
id:
group
.
id
,
text:
group
.
human_name
}].
to_json
)
end
it
'excludes parent group'
do
subgroup
=
create
(
:group
,
parent:
group2
)
expect
(
parent_group_options
(
subgroup
)).
to
eq
([{
id:
group
.
id
,
text:
group
.
human_name
}].
to_json
)
end
it
'includes subgroups with inherited ownership'
do
subgroup
=
create
(
:group
,
parent:
group
)
expect
(
parent_group_options
(
group2
)).
to
eq
([{
id:
group
.
id
,
text:
group
.
human_name
},
{
id:
subgroup
.
id
,
text:
subgroup
.
human_name
}].
to_json
)
end
it
'excludes own subgroups'
do
create
(
:group
,
parent:
group2
)
expect
(
parent_group_options
(
group2
)).
to
eq
([{
id:
group
.
id
,
text:
group
.
human_name
}].
to_json
)
end
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