Remove `:graphql` feature flag
- Remove `FeatureConstrainer` call wrapping api endpoint - Remove `Feature.enabled?(:graphql)` conditionals in back and frontend - Modify graphql test to be graphql flag agnostic - Remove api routing spec - Remove frontend feature flag via `gon`
This commit is contained in:
parent
630a8e8050
commit
639ab5214c
|
@ -17,7 +17,5 @@ export default () => {
|
|||
new MilestoneSelect();
|
||||
new IssuableTemplateSelectors();
|
||||
|
||||
if (gon.features.graphql) {
|
||||
initSuggestions();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,8 +283,4 @@ 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
|
||||
|
|
|
@ -662,6 +662,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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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 => '/'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# 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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,9 +3,5 @@
|
|||
module Gitlab
|
||||
module Graphql
|
||||
StandardGraphqlError = Class.new(StandardError)
|
||||
|
||||
def self.enabled?
|
||||
Feature.enabled?(:graphql, default_enabled: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
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
|
Loading…
Reference in New Issue