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
01ed1c15
Commit
01ed1c15
authored
Jul 09, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
06985d67
8ae4e242
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
8 additions
and
73 deletions
+8
-73
app/assets/javascripts/pages/projects/issues/form.js
app/assets/javascripts/pages/projects/issues/form.js
+1
-3
app/controllers/graphql_controller.rb
app/controllers/graphql_controller.rb
+0
-5
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+0
-6
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-1
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+1
-2
config/routes/api.rb
config/routes/api.rb
+2
-4
doc/api/graphql/index.md
doc/api/graphql/index.md
+3
-13
lib/api/helpers/graphql_helpers.rb
lib/api/helpers/graphql_helpers.rb
+0
-2
lib/gitlab/graphql.rb
lib/gitlab/graphql.rb
+0
-4
spec/requests/api/graphql_spec.rb
spec/requests/api/graphql_spec.rb
+0
-10
spec/routing/api_routing_spec.rb
spec/routing/api_routing_spec.rb
+0
-23
No files found.
app/assets/javascripts/pages/projects/issues/form.js
View file @
01ed1c15
...
...
@@ -17,7 +17,5 @@ export default () => {
new
MilestoneSelect
();
new
IssuableTemplateSelectors
();
if
(
gon
.
features
.
graphql
)
{
initSuggestions
();
}
};
app/controllers/graphql_controller.rb
View file @
01ed1c15
...
...
@@ -11,7 +11,6 @@ class GraphqlController < ApplicationController
# around in GraphiQL.
protect_from_forgery
with: :null_session
,
only: :execute
before_action
:check_graphql_feature_flag!
before_action
:authorize_access_api!
before_action
(
only:
[
:execute
])
{
authenticate_sessionless_user!
(
:api
)
}
...
...
@@ -86,8 +85,4 @@ class GraphqlController < ApplicationController
render
json:
error
,
status:
status
end
def
check_graphql_feature_flag!
render_404
unless
Gitlab
::
Graphql
.
enabled?
end
end
app/controllers/projects/issues_controller.rb
View file @
01ed1c15
...
...
@@ -45,8 +45,6 @@ class Projects::IssuesController < Projects::ApplicationController
before_action
:authorize_import_issues!
,
only:
[
:import_csv
]
before_action
:authorize_download_code!
,
only:
[
:related_branches
]
before_action
:set_suggested_issues_feature_flags
,
only:
[
:new
]
respond_to
:html
def
index
...
...
@@ -285,10 +283,6 @@ class Projects::IssuesController < Projects::ApplicationController
# 3. https://gitlab.com/gitlab-org/gitlab-ce/issues/42426
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-ce/issues/42422'
)
end
def
set_suggested_issues_feature_flags
push_frontend_feature_flag
(
:graphql
,
default_enabled:
true
)
end
end
Projects
::
IssuesController
.
prepend
(
EE
::
Projects
::
IssuesController
)
app/helpers/projects_helper.rb
View file @
01ed1c15
...
...
@@ -664,6 +664,6 @@ module ProjectsHelper
end
def
vue_file_list_enabled?
Gitlab
::
Graphql
.
enabled?
&&
Feature
.
enabled?
(
:vue_file_list
,
@project
)
Feature
.
enabled?
(
:vue_file_list
,
@project
)
end
end
app/views/shared/issuable/_form.html.haml
View file @
01ed1c15
...
...
@@ -17,8 +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
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
...
...
config/routes/api.rb
View file @
01ed1c15
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
post
'/api/graphql'
,
to:
'graphql#execute'
mount
GraphiQL
::
Rails
::
Engine
,
at:
'/-/graphql-explorer'
,
graphql_path:
'/api/graphql'
::
API
::
API
.
logger
Rails
.
logger
mount
::
API
::
API
=>
'/'
doc/api/graphql/index.md
View file @
01ed1c15
# GraphQL API
(Alpha)
# GraphQL API
> [Introduced][ce-19008] in GitLab 11.0.
...
...
@@ -23,23 +23,13 @@ programmatically with GitLab. To achieve this, it needs full coverage - anything
possible in the REST API should also be possible in the GraphQL API.
To help us meet this vision, the frontend should use GraphQL in preference to
the REST API for new features, although the alpha status of GraphQL may prevent
this from being a possibility at times.
the REST API for new features.
There are no plans to deprecate the REST API. To reduce the technical burden of
supporting two APIs in parallel, they should share implementations as much as
possible.
## Enabling the GraphQL feature
The GraphQL API itself is currently in Alpha, and therefore hidden behind a
feature flag. You can enable the feature using the
[
features api
][
features-api
]
on a self-hosted instance.
For example:
```
shell
curl
--data
"value=100"
--header
"PRIVATE-TOKEN: <your_access_token>"
https://gitlab.example.com/api/v4/features/graphql
```
As of the 12.1 release, GraphQL is always enabled.
## Available queries
...
...
lib/api/helpers/graphql_helpers.rb
View file @
01ed1c15
...
...
@@ -7,8 +7,6 @@ module API
# should be in app/graphql/ or lib/gitlab/graphql/
module
GraphqlHelpers
def
conditionally_graphql!
(
fallback
:,
query
:,
context:
{},
transform:
nil
)
return
fallback
.
call
unless
Feature
.
enabled?
(
:graphql
)
result
=
GitlabSchema
.
execute
(
query
,
context:
context
)
if
transform
...
...
lib/gitlab/graphql.rb
View file @
01ed1c15
...
...
@@ -3,9 +3,5 @@
module
Gitlab
module
Graphql
StandardGraphqlError
=
Class
.
new
(
StandardError
)
def
self
.
enabled?
Feature
.
enabled?
(
:graphql
,
default_enabled:
true
)
end
end
end
spec/requests/api/graphql_spec.rb
View file @
01ed1c15
...
...
@@ -6,16 +6,6 @@ describe 'GraphQL' do
let
(
:query
)
{
graphql_query_for
(
'echo'
,
'text'
=>
'Hello world'
)
}
context
'graphql is disabled by feature flag'
do
before
do
stub_feature_flags
(
graphql:
false
)
end
it
'does not generate a route for GraphQL'
do
expect
{
post_graphql
(
query
)
}.
to
raise_error
(
ActionController
::
RoutingError
)
end
end
context
'logging'
do
shared_examples
'logging a graphql query'
do
let
(
:expected_params
)
do
...
...
spec/routing/api_routing_spec.rb
deleted
100644 → 0
View file @
06985d67
require
'spec_helper'
describe
'api'
,
'routing'
do
context
'when graphql is disabled'
do
before
do
stub_feature_flags
(
graphql:
false
)
end
it
'does not route to the GraphqlController'
do
expect
(
post
(
'/api/graphql'
)).
not_to
route_to
(
'graphql#execute'
)
end
end
context
'when graphql is enabled'
do
before
do
stub_feature_flags
(
graphql:
true
)
end
it
'routes to the GraphqlController'
do
expect
(
post
(
'/api/graphql'
)).
to
route_to
(
'graphql#execute'
)
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