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
cf21f45c
Commit
cf21f45c
authored
Dec 14, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
8f066ece
0a69dbd2
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
95 additions
and
33 deletions
+95
-33
app/assets/javascripts/pages/projects/issues/form.js
app/assets/javascripts/pages/projects/issues/form.js
+1
-1
app/controllers/graphql_controller.rb
app/controllers/graphql_controller.rb
+1
-1
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-2
app/presenters/clusters/cluster_presenter.rb
app/presenters/clusters/cluster_presenter.rb
+8
-0
app/views/clusters/clusters/_cluster.html.haml
app/views/clusters/clusters/_cluster.html.haml
+1
-1
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+1
-1
config/routes/api.rb
config/routes/api.rb
+1
-1
lib/constraints/feature_constrainer.rb
lib/constraints/feature_constrainer.rb
+4
-4
lib/gitlab/graphql.rb
lib/gitlab/graphql.rb
+4
-0
spec/features/issues/user_creates_issue_spec.rb
spec/features/issues/user_creates_issue_spec.rb
+6
-4
spec/features/projects/labels/user_views_labels_spec.rb
spec/features/projects/labels/user_views_labels_spec.rb
+5
-3
spec/lib/constraints/feature_constrainer_spec.rb
spec/lib/constraints/feature_constrainer_spec.rb
+11
-0
spec/lib/gitlab/background_migration/migrate_build_stage_spec.rb
...b/gitlab/background_migration/migrate_build_stage_spec.rb
+15
-5
spec/lib/gitlab/background_migration/migrate_stage_status_spec.rb
.../gitlab/background_migration/migrate_stage_status_spec.rb
+22
-10
spec/presenters/clusters/cluster_presenter_spec.rb
spec/presenters/clusters/cluster_presenter_spec.rb
+14
-0
No files found.
app/assets/javascripts/pages/projects/issues/form.js
View file @
cf21f45c
...
...
@@ -18,7 +18,7 @@ export default () => {
new
MilestoneSelect
();
new
IssuableTemplateSelectors
();
if
(
gon
.
features
.
issueSuggestions
&&
gon
.
features
.
graphql
)
{
if
(
gon
.
features
.
graphql
)
{
initSuggestions
();
}
...
...
app/controllers/graphql_controller.rb
View file @
cf21f45c
...
...
@@ -43,6 +43,6 @@ class GraphqlController < ApplicationController
end
def
check_graphql_feature_flag!
render_404
unless
Feature
.
enabled?
(
:graphql
)
render_404
unless
Gitlab
::
Graphql
.
enabled?
end
end
app/controllers/projects/issues_controller.rb
View file @
cf21f45c
...
...
@@ -270,7 +270,6 @@ class Projects::IssuesController < Projects::ApplicationController
end
def
set_suggested_issues_feature_flags
push_frontend_feature_flag
(
:graphql
)
push_frontend_feature_flag
(
:issue_suggestions
)
push_frontend_feature_flag
(
:graphql
,
default_enabled:
true
)
end
end
app/presenters/clusters/cluster_presenter.rb
View file @
cf21f45c
...
...
@@ -12,6 +12,14 @@ module Clusters
can?
(
current_user
,
:update_cluster
,
cluster
)
&&
created?
end
def
cluster_type_description
if
cluster
.
project_type?
s_
(
"ClusterIntegration|Project cluster"
)
elsif
cluster
.
group_type?
s_
(
"ClusterIntegration|Group cluster"
)
end
end
def
show_path
if
cluster
.
project_type?
project_cluster_path
(
project
,
cluster
)
...
...
app/views/clusters/clusters/_cluster.html.haml
View file @
cf21f45c
...
...
@@ -13,4 +13,4 @@
.table-mobile-header
{
role:
"rowheader"
}
.table-mobile-content
%span
.badge.badge-light
=
cluster
.
project_type?
?
s_
(
"ClusterIntegration|Project cluster"
)
:
s_
(
"ClusterIntegration|Group cluster"
)
=
cluster
.
cluster_type_description
app/views/shared/issuable/_form.html.haml
View file @
cf21f45c
...
...
@@ -17,7 +17,7 @@
=
render
'shared/issuable/form/template_selector'
,
issuable:
issuable
=
render
'shared/issuable/form/title'
,
issuable:
issuable
,
form:
form
,
has_wip_commits:
commits
&&
commits
.
detect
(
&
:work_in_progress?
)
-
if
Feature
.
enabled?
(
:issue_suggestions
)
&&
Feature
.
enabled?
(
:graphql
)
-
if
Gitlab
::
Graphql
.
enabled?
#js-suggestions
{
data:
{
project_path:
@project
.
full_path
}
}
=
render
'shared/form_elements/description'
,
model:
issuable
,
form:
form
,
project:
project
...
...
config/routes/api.rb
View file @
cf21f45c
constraints
(
::
Constraints
::
FeatureConstrainer
.
new
(
:graphql
))
do
constraints
(
::
Constraints
::
FeatureConstrainer
.
new
(
:graphql
,
default_enabled:
true
))
do
post
'/api/graphql'
,
to:
'graphql#execute'
mount
GraphiQL
::
Rails
::
Engine
,
at:
'/-/graphql-explorer'
,
graphql_path:
'/api/graphql'
end
...
...
lib/constraints/feature_constrainer.rb
View file @
cf21f45c
...
...
@@ -2,14 +2,14 @@
module
Constraints
class
FeatureConstrainer
attr_reader
:
feature
attr_reader
:
args
def
initialize
(
feature
)
@
feature
=
feature
def
initialize
(
*
args
)
@
args
=
args
end
def
matches?
(
_request
)
Feature
.
enabled?
(
feature
)
Feature
.
enabled?
(
*
args
)
end
end
end
lib/gitlab/graphql.rb
View file @
cf21f45c
...
...
@@ -3,5 +3,9 @@
module
Gitlab
module
Graphql
StandardGraphqlError
=
Class
.
new
(
StandardError
)
def
self
.
enabled?
Feature
.
enabled?
(
:graphql
,
default_enabled:
true
)
end
end
end
spec/features/issues/user_creates_issue_spec.rb
View file @
cf21f45c
# frozen_string_literal: true
require
"spec_helper"
describe
"User creates issue"
do
...
...
@@ -64,10 +66,10 @@ describe "User creates issue" do
end
context
"with labels"
do
LABEL_TITLES
=
%w(bug feature enhancement)
.
freeze
let
(
:label_titles
)
{
%w(bug feature enhancement)
}
before
do
LABEL_TITLES
.
each
do
|
title
|
label_titles
.
each
do
|
title
|
create
(
:label
,
project:
project
,
title:
title
)
end
end
...
...
@@ -77,13 +79,13 @@ describe "User creates issue" do
fill_in
(
"Title"
,
with:
issue_title
)
click_button
(
"Label"
)
click_link
(
LABEL_TITLES
.
first
)
click_link
(
label_titles
.
first
)
click_button
(
"Submit issue"
)
expect
(
page
).
to
have_content
(
issue_title
)
.
and
have_content
(
user
.
name
)
.
and
have_content
(
project
.
name
)
.
and
have_content
(
LABEL_TITLES
.
first
)
.
and
have_content
(
label_titles
.
first
)
end
end
end
...
...
spec/features/projects/labels/user_views_labels_spec.rb
View file @
cf21f45c
# frozen_string_literal: true
require
"spec_helper"
describe
"User views labels"
do
set
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
set
(
:user
)
{
create
(
:user
)
}
LABEL_TITLES
=
%w[bug enhancement feature]
.
freeze
let
(
:label_titles
)
{
%w[bug enhancement feature]
}
before
do
LABEL_TITLES
.
each
{
|
title
|
create
(
:label
,
project:
project
,
title:
title
)
}
label_titles
.
each
{
|
title
|
create
(
:label
,
project:
project
,
title:
title
)
}
project
.
add_guest
(
user
)
sign_in
(
user
)
...
...
@@ -17,7 +19,7 @@ describe "User views labels" do
it
"shows all labels"
do
page
.
within
(
'.other-labels .manage-labels-list'
)
do
LABEL_TITLES
.
each
{
|
title
|
expect
(
page
).
to
have_content
(
title
)
}
label_titles
.
each
{
|
title
|
expect
(
page
).
to
have_content
(
title
)
}
end
end
end
spec/lib/constraints/feature_constrainer_spec.rb
0 → 100644
View file @
cf21f45c
require
'spec_helper'
describe
Constraints
::
FeatureConstrainer
do
describe
'#matches'
do
it
'calls Feature.enabled? with the correct arguments'
do
expect
(
Feature
).
to
receive
(
:enabled?
).
with
(
:feature_name
,
"an object"
,
default_enabled:
true
)
described_class
.
new
(
:feature_name
,
"an object"
,
default_enabled:
true
).
matches?
(
double
(
'request'
))
end
end
end
spec/lib/gitlab/background_migration/migrate_build_stage_spec.rb
View file @
cf21f45c
...
...
@@ -6,8 +6,18 @@ describe Gitlab::BackgroundMigration::MigrateBuildStage, :migration, schema: 201
let
(
:stages
)
{
table
(
:ci_stages
)
}
let
(
:jobs
)
{
table
(
:ci_builds
)
}
STATUSES
=
{
created:
0
,
pending:
1
,
running:
2
,
success:
3
,
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}.
freeze
let
(
:statuses
)
do
{
created:
0
,
pending:
1
,
running:
2
,
success:
3
,
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}
end
before
do
projects
.
create!
(
id:
123
,
name:
'gitlab'
,
path:
'gitlab-ce'
)
...
...
@@ -36,9 +46,9 @@ describe Gitlab::BackgroundMigration::MigrateBuildStage, :migration, schema: 201
expect
(
stages
.
all
.
pluck
(
:name
)).
to
match_array
%w[test build deploy]
expect
(
jobs
.
where
(
stage_id:
nil
)).
to
be_one
expect
(
jobs
.
find_by
(
stage_id:
nil
).
id
).
to
eq
6
expect
(
stages
.
all
.
pluck
(
:status
)).
to
match_array
[
STATUSES
[
:success
],
STATUSES
[
:failed
],
STATUSES
[
:pending
]]
expect
(
stages
.
all
.
pluck
(
:status
)).
to
match_array
[
statuses
[
:success
],
statuses
[
:failed
],
statuses
[
:pending
]]
end
it
'recovers from unique constraint violation only twice'
do
...
...
spec/lib/gitlab/background_migration/migrate_stage_status_spec.rb
View file @
cf21f45c
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
BackgroundMigration
::
MigrateStageStatus
,
:migration
,
schema:
20170711145320
do
...
...
@@ -6,8 +8,18 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
let
(
:stages
)
{
table
(
:ci_stages
)
}
let
(
:jobs
)
{
table
(
:ci_builds
)
}
STATUSES
=
{
created:
0
,
pending:
1
,
running:
2
,
success:
3
,
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}.
freeze
let
(
:statuses
)
do
{
created:
0
,
pending:
1
,
running:
2
,
success:
3
,
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}
end
before
do
projects
.
create!
(
id:
1
,
name:
'gitlab1'
,
path:
'gitlab1'
)
...
...
@@ -26,8 +38,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
it
'sets a correct stage status'
do
described_class
.
new
.
perform
(
1
,
2
)
expect
(
stages
.
first
.
status
).
to
eq
STATUSES
[
:running
]
expect
(
stages
.
second
.
status
).
to
eq
STATUSES
[
:failed
]
expect
(
stages
.
first
.
status
).
to
eq
statuses
[
:running
]
expect
(
stages
.
second
.
status
).
to
eq
statuses
[
:failed
]
end
end
...
...
@@ -35,8 +47,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
it
'sets a skipped stage status'
do
described_class
.
new
.
perform
(
1
,
2
)
expect
(
stages
.
first
.
status
).
to
eq
STATUSES
[
:skipped
]
expect
(
stages
.
second
.
status
).
to
eq
STATUSES
[
:skipped
]
expect
(
stages
.
first
.
status
).
to
eq
statuses
[
:skipped
]
expect
(
stages
.
second
.
status
).
to
eq
statuses
[
:skipped
]
end
end
...
...
@@ -50,8 +62,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
it
'sets a correct stage status'
do
described_class
.
new
.
perform
(
1
,
2
)
expect
(
stages
.
first
.
status
).
to
eq
STATUSES
[
:canceled
]
expect
(
stages
.
second
.
status
).
to
eq
STATUSES
[
:success
]
expect
(
stages
.
first
.
status
).
to
eq
statuses
[
:canceled
]
expect
(
stages
.
second
.
status
).
to
eq
statuses
[
:success
]
end
end
...
...
@@ -65,8 +77,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
it
'sets a correct stage status'
do
described_class
.
new
.
perform
(
1
,
2
)
expect
(
stages
.
first
.
status
).
to
eq
STATUSES
[
:manual
]
expect
(
stages
.
second
.
status
).
to
eq
STATUSES
[
:success
]
expect
(
stages
.
first
.
status
).
to
eq
statuses
[
:manual
]
expect
(
stages
.
second
.
status
).
to
eq
statuses
[
:success
]
end
end
...
...
spec/presenters/clusters/cluster_presenter_spec.rb
View file @
cf21f45c
...
...
@@ -74,6 +74,20 @@ describe Clusters::ClusterPresenter do
end
end
describe
'#cluster_type_description'
do
subject
{
described_class
.
new
(
cluster
).
cluster_type_description
}
context
'project_type cluster'
do
it
{
is_expected
.
to
eq
(
'Project cluster'
)
}
end
context
'group_type cluster'
do
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:group
)
}
it
{
is_expected
.
to
eq
(
'Group cluster'
)
}
end
end
describe
'#show_path'
do
subject
{
described_class
.
new
(
cluster
).
show_path
}
...
...
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