Commit 01ed1c15 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 06985d67 8ae4e242
...@@ -17,7 +17,5 @@ export default () => { ...@@ -17,7 +17,5 @@ export default () => {
new MilestoneSelect(); new MilestoneSelect();
new IssuableTemplateSelectors(); new IssuableTemplateSelectors();
if (gon.features.graphql) {
initSuggestions(); initSuggestions();
}
}; };
...@@ -11,7 +11,6 @@ class GraphqlController < ApplicationController ...@@ -11,7 +11,6 @@ class GraphqlController < ApplicationController
# around in GraphiQL. # around in GraphiQL.
protect_from_forgery with: :null_session, only: :execute protect_from_forgery with: :null_session, only: :execute
before_action :check_graphql_feature_flag!
before_action :authorize_access_api! before_action :authorize_access_api!
before_action(only: [:execute]) { authenticate_sessionless_user!(:api) } before_action(only: [:execute]) { authenticate_sessionless_user!(:api) }
...@@ -86,8 +85,4 @@ class GraphqlController < ApplicationController ...@@ -86,8 +85,4 @@ class GraphqlController < ApplicationController
render json: error, status: status render json: error, status: status
end end
def check_graphql_feature_flag!
render_404 unless Gitlab::Graphql.enabled?
end
end end
...@@ -45,8 +45,6 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -45,8 +45,6 @@ class Projects::IssuesController < Projects::ApplicationController
before_action :authorize_import_issues!, only: [:import_csv] before_action :authorize_import_issues!, only: [:import_csv]
before_action :authorize_download_code!, only: [:related_branches] before_action :authorize_download_code!, only: [:related_branches]
before_action :set_suggested_issues_feature_flags, only: [:new]
respond_to :html respond_to :html
def index def index
...@@ -285,10 +283,6 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -285,10 +283,6 @@ class Projects::IssuesController < Projects::ApplicationController
# 3. https://gitlab.com/gitlab-org/gitlab-ce/issues/42426 # 3. https://gitlab.com/gitlab-org/gitlab-ce/issues/42426
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42422') Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42422')
end end
def set_suggested_issues_feature_flags
push_frontend_feature_flag(:graphql, default_enabled: true)
end
end end
Projects::IssuesController.prepend(EE::Projects::IssuesController) Projects::IssuesController.prepend(EE::Projects::IssuesController)
...@@ -664,6 +664,6 @@ module ProjectsHelper ...@@ -664,6 +664,6 @@ module ProjectsHelper
end end
def vue_file_list_enabled? def vue_file_list_enabled?
Gitlab::Graphql.enabled? && Feature.enabled?(:vue_file_list, @project) Feature.enabled?(:vue_file_list, @project)
end end
end end
...@@ -17,8 +17,7 @@ ...@@ -17,8 +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 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
......
constraints(::Constraints::FeatureConstrainer.new(:graphql, default_enabled: 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
::API::API.logger Rails.logger ::API::API.logger Rails.logger
mount ::API::API => '/' mount ::API::API => '/'
# GraphQL API (Alpha) # GraphQL API
> [Introduced][ce-19008] in GitLab 11.0. > [Introduced][ce-19008] in GitLab 11.0.
...@@ -23,23 +23,13 @@ programmatically with GitLab. To achieve this, it needs full coverage - anything ...@@ -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. 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 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 the REST API for new features.
this from being a possibility at times.
There are no plans to deprecate the REST API. To reduce the technical burden of 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 supporting two APIs in parallel, they should share implementations as much as
possible. possible.
## Enabling the GraphQL feature As of the 12.1 release, GraphQL is always enabled.
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
```
## Available queries ## Available queries
......
...@@ -7,8 +7,6 @@ module API ...@@ -7,8 +7,6 @@ module API
# should be in app/graphql/ or lib/gitlab/graphql/ # should be in app/graphql/ or lib/gitlab/graphql/
module GraphqlHelpers module GraphqlHelpers
def conditionally_graphql!(fallback:, query:, context: {}, transform: nil) def conditionally_graphql!(fallback:, query:, context: {}, transform: nil)
return fallback.call unless Feature.enabled?(:graphql)
result = GitlabSchema.execute(query, context: context) result = GitlabSchema.execute(query, context: context)
if transform if transform
......
...@@ -3,9 +3,5 @@ ...@@ -3,9 +3,5 @@
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
...@@ -6,16 +6,6 @@ describe 'GraphQL' do ...@@ -6,16 +6,6 @@ describe 'GraphQL' do
let(:query) { graphql_query_for('echo', 'text' => 'Hello world' ) } 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 context 'logging' do
shared_examples 'logging a graphql query' do shared_examples 'logging a graphql query' do
let(:expected_params) do let(:expected_params) do
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment