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
Boxiang Sun
gitlab-ce
Commits
744f6ed1
Commit
744f6ed1
authored
Dec 13, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable GraphQL API endpoint
parent
2bb468d6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
7 deletions
+11
-7
app/controllers/graphql_controller.rb
app/controllers/graphql_controller.rb
+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
No files found.
app/controllers/graphql_controller.rb
View file @
744f6ed1
...
@@ -43,6 +43,6 @@ class GraphqlController < ApplicationController
...
@@ -43,6 +43,6 @@ class GraphqlController < ApplicationController
end
end
def
check_graphql_feature_flag!
def
check_graphql_feature_flag!
render_404
unless
Feature
.
enabled?
(
:graphql
,
default_enabled:
true
)
render_404
unless
Gitlab
::
Graphql
.
enabled?
end
end
end
end
app/views/shared/issuable/_form.html.haml
View file @
744f6ed1
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
=
render
'shared/issuable/form/template_selector'
,
issuable:
issuable
=
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?
)
=
render
'shared/issuable/form/title'
,
issuable:
issuable
,
form:
form
,
has_wip_commits:
commits
&&
commits
.
detect
(
&
:work_in_progress?
)
-
if
Feature
.
enabled?
(
:graphql
,
default_enabled:
true
)
-
if
Gitlab
::
Graphql
.
enabled?
#js-suggestions
{
data:
{
project_path:
@project
.
full_path
}
}
#js-suggestions
{
data:
{
project_path:
@project
.
full_path
}
}
=
render
'shared/form_elements/description'
,
model:
issuable
,
form:
form
,
project:
project
=
render
'shared/form_elements/description'
,
model:
issuable
,
form:
form
,
project:
project
...
...
config/routes/api.rb
View file @
744f6ed1
constraints
(
::
Constraints
::
FeatureConstrainer
.
new
(
:graphql
))
do
constraints
(
::
Constraints
::
FeatureConstrainer
.
new
(
:graphql
,
nil
,
true
))
do
post
'/api/graphql'
,
to:
'graphql#execute'
post
'/api/graphql'
,
to:
'graphql#execute'
mount
GraphiQL
::
Rails
::
Engine
,
at:
'/-/graphql-explorer'
,
graphql_path:
'/api/graphql'
mount
GraphiQL
::
Rails
::
Engine
,
at:
'/-/graphql-explorer'
,
graphql_path:
'/api/graphql'
end
end
...
...
lib/constraints/feature_constrainer.rb
View file @
744f6ed1
...
@@ -2,14 +2,14 @@
...
@@ -2,14 +2,14 @@
module
Constraints
module
Constraints
class
FeatureConstrainer
class
FeatureConstrainer
attr_reader
:feature
attr_reader
:feature
,
:thing
,
:default_enabled
def
initialize
(
feature
)
def
initialize
(
feature
,
thing
,
default_enabled
)
@feature
=
feature
@feature
,
@thing
,
@default_enabled
=
feature
,
thing
,
default_enabled
end
end
def
matches?
(
_request
)
def
matches?
(
_request
)
Feature
.
enabled?
(
feature
)
Feature
.
enabled?
(
feature
,
@thing
,
default_enabled:
true
)
end
end
end
end
end
end
lib/gitlab/graphql.rb
View file @
744f6ed1
...
@@ -3,5 +3,9 @@
...
@@ -3,5 +3,9 @@
module
Gitlab
module
Gitlab
module
Graphql
module
Graphql
StandardGraphqlError
=
Class
.
new
(
StandardError
)
StandardGraphqlError
=
Class
.
new
(
StandardError
)
def
self
.
enabled?
Feature
.
enabled?
(
:graphql
,
default_enabled:
true
)
end
end
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