Commit e57c58d1 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 5c84137d b8016f27
...@@ -21,7 +21,6 @@ Graphql/IDType: ...@@ -21,7 +21,6 @@ Graphql/IDType:
Exclude: Exclude:
- 'ee/app/graphql/ee/mutations/issues/update.rb' - 'ee/app/graphql/ee/mutations/issues/update.rb'
- 'app/graphql/mutations/boards/issues/issue_move_list.rb' - 'app/graphql/mutations/boards/issues/issue_move_list.rb'
- 'app/graphql/mutations/metrics/dashboard/annotations/delete.rb'
- 'app/graphql/resolvers/design_management/design_at_version_resolver.rb' - 'app/graphql/resolvers/design_management/design_at_version_resolver.rb'
- 'app/graphql/resolvers/design_management/design_resolver.rb' - 'app/graphql/resolvers/design_management/design_resolver.rb'
- 'app/graphql/resolvers/design_management/designs_resolver.rb' - 'app/graphql/resolvers/design_management/designs_resolver.rb'
......
...@@ -14,26 +14,10 @@ export default { ...@@ -14,26 +14,10 @@ export default {
GlDropdown, GlDropdown,
GlFormCheckbox, GlFormCheckbox,
}, },
data() {
return {
checked: false,
};
},
computed: { computed: {
...mapGetters('diffs', ['isInlineView', 'isParallelView']), ...mapGetters('diffs', ['isInlineView', 'isParallelView']),
...mapState('diffs', ['renderTreeList', 'showWhitespace', 'viewDiffsFileByFile']), ...mapState('diffs', ['renderTreeList', 'showWhitespace', 'viewDiffsFileByFile']),
}, },
watch: {
viewDiffsFileByFile() {
this.checked = this.viewDiffsFileByFile;
},
checked() {
eventHub.$emit(EVT_VIEW_FILE_BY_FILE, { setting: this.checked });
},
},
created() {
this.checked = this.viewDiffsFileByFile;
},
methods: { methods: {
...mapActions('diffs', [ ...mapActions('diffs', [
'setInlineDiffViewType', 'setInlineDiffViewType',
...@@ -110,7 +94,12 @@ export default { ...@@ -110,7 +94,12 @@ export default {
</label> </label>
</div> </div>
<div class="gl-mt-3 gl-px-3"> <div class="gl-mt-3 gl-px-3">
<gl-form-checkbox v-model="checked" data-testid="file-by-file" class="gl-mb-0"> <gl-form-checkbox
data-testid="file-by-file"
class="gl-mb-0"
:checked="viewDiffsFileByFile"
@input="toggleFileByFile"
>
{{ $options.i18n.fileByFile }} {{ $options.i18n.fileByFile }}
</gl-form-checkbox> </gl-form-checkbox>
</div> </div>
......
...@@ -11,7 +11,7 @@ module Mutations ...@@ -11,7 +11,7 @@ module Mutations
argument :id, ::Types::GlobalIDType[::Metrics::Dashboard::Annotation], argument :id, ::Types::GlobalIDType[::Metrics::Dashboard::Annotation],
required: true, required: true,
description: 'The global ID of the annotation to delete' description: 'Global ID of the annotation to delete'
def resolve(id:) def resolve(id:)
annotation = authorized_find!(id: id) annotation = authorized_find!(id: id)
......
...@@ -126,7 +126,7 @@ and they will assist you with any issues you are having. ...@@ -126,7 +126,7 @@ and they will assist you with any issues you are having.
kubectl get pods | grep task-runner kubectl get pods | grep task-runner
# enter it # enter it
kubectl exec -it <task-runner-pod-name> bash kubectl exec -it <task-runner-pod-name> -- bash
# open rails console # open rails console
# rails console can be also called from other GitLab pods # rails console can be also called from other GitLab pods
...@@ -139,10 +139,10 @@ and they will assist you with any issues you are having. ...@@ -139,10 +139,10 @@ and they will assist you with any issues you are having.
/usr/local/bin/gitlab-rake gitlab:check /usr/local/bin/gitlab-rake gitlab:check
# open console without entering pod # open console without entering pod
kubectl exec -it <task-runner-pod-name> /srv/gitlab/bin/rails console kubectl exec -it <task-runner-pod-name> -- /srv/gitlab/bin/rails console
# check the status of DB migrations # check the status of DB migrations
kubectl exec -it <task-runner-pod-name> /usr/local/bin/gitlab-rake db:migrate:status kubectl exec -it <task-runner-pod-name> -- /usr/local/bin/gitlab-rake db:migrate:status
``` ```
You can also use `gitlab-rake`, instead of `/usr/local/bin/gitlab-rake`. You can also use `gitlab-rake`, instead of `/usr/local/bin/gitlab-rake`.
......
...@@ -5415,7 +5415,7 @@ input DeleteAnnotationInput { ...@@ -5415,7 +5415,7 @@ input DeleteAnnotationInput {
clientMutationId: String clientMutationId: String
""" """
The global ID of the annotation to delete Global ID of the annotation to delete
""" """
id: MetricsDashboardAnnotationID! id: MetricsDashboardAnnotationID!
} }
......
...@@ -14822,7 +14822,7 @@ ...@@ -14822,7 +14822,7 @@
"inputFields": [ "inputFields": [
{ {
"name": "id", "name": "id",
"description": "The global ID of the annotation to delete", "description": "Global ID of the annotation to delete",
"type": { "type": {
"kind": "NON_NULL", "kind": "NON_NULL",
"name": null, "name": null,
...@@ -181,7 +181,7 @@ describe('Diff settings dropdown component', () => { ...@@ -181,7 +181,7 @@ describe('Diff settings dropdown component', () => {
${true} | ${true} ${true} | ${true}
${false} | ${false} ${false} | ${false}
`( `(
'sets { checked: $checked } if the fileByFile setting is $fileByFile', 'sets the checkbox to { checked: $checked } if the fileByFile setting is $fileByFile',
async ({ fileByFile, checked }) => { async ({ fileByFile, checked }) => {
createComponent(store => { createComponent(store => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
...@@ -191,7 +191,7 @@ describe('Diff settings dropdown component', () => { ...@@ -191,7 +191,7 @@ describe('Diff settings dropdown component', () => {
await vm.$nextTick(); await vm.$nextTick();
expect(vm.checked).toBe(checked); expect(getFileByFileCheckbox(wrapper).element.checked).toBe(checked);
}, },
); );
......
...@@ -55,7 +55,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -55,7 +55,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
describe 'with a single permission' do describe 'with a single permission' do
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :item, type, null: true, resolve: ->(obj, args, ctx) { test_object }, authorize: permission_single query.field :item, type, null: true, resolver: simple_resolver(test_object), authorize: permission_single
end end
end end
...@@ -66,7 +66,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -66,7 +66,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
let(:query_type) do let(:query_type) do
permissions = permission_collection permissions = permission_collection
query_factory do |qt| query_factory do |qt|
qt.field :item, type, null: true, resolve: ->(obj, args, ctx) { test_object } do qt.field :item, type, null: true, resolver: simple_resolver(test_object) do
authorize permissions authorize permissions
end end
end end
...@@ -79,7 +79,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -79,7 +79,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
describe 'Field authorizations when field is a built in type' do describe 'Field authorizations when field is a built in type' do
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :item, type, null: true, resolve: ->(obj, args, ctx) { test_object } query.field :item, type, null: true, resolver: simple_resolver(test_object)
end end
end end
...@@ -132,7 +132,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -132,7 +132,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
describe 'Type authorizations' do describe 'Type authorizations' do
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :item, type, null: true, resolve: ->(obj, args, ctx) { test_object } query.field :item, type, null: true, resolver: simple_resolver(test_object)
end end
end end
...@@ -169,7 +169,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -169,7 +169,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :item, type, null: true, resolve: ->(obj, args, ctx) { test_object }, authorize: permission_2 query.field :item, type, null: true, resolver: simple_resolver(test_object), authorize: permission_2
end end
end end
...@@ -188,7 +188,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -188,7 +188,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :item, type.connection_type, null: true, resolve: ->(obj, args, ctx) { [test_object, second_test_object] } query.field :item, type.connection_type, null: true, resolver: simple_resolver([test_object, second_test_object])
end end
end end
...@@ -208,9 +208,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -208,9 +208,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
describe 'limiting connections with multiple objects' do describe 'limiting connections with multiple objects' do
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :item, type.connection_type, null: true, resolve: ->(obj, args, ctx) do query.field :item, type.connection_type, null: true, resolver: simple_resolver([test_object, second_test_object])
[test_object, second_test_object]
end
end end
end end
...@@ -234,7 +232,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -234,7 +232,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :item, [type], null: true, resolve: ->(obj, args, ctx) { [test_object] } query.field :item, [type], null: true, resolver: simple_resolver([test_object])
end end
end end
...@@ -262,13 +260,13 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do ...@@ -262,13 +260,13 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
type_factory do |type| type_factory do |type|
type.graphql_name 'FakeProjectType' type.graphql_name 'FakeProjectType'
type.field :test_issues, issue_type.connection_type, null: false, type.field :test_issues, issue_type.connection_type, null: false,
resolve: -> (_, _, _) { Issue.where(project: [visible_project, other_project]).order(id: :asc) } resolver: simple_resolver(Issue.where(project: [visible_project, other_project]).order(id: :asc))
end end
end end
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :test_project, project_type, null: false, resolve: -> (_, _, _) { visible_project } query.field :test_project, project_type, null: false, resolver: simple_resolver(visible_project)
end end
end end
......
...@@ -23,7 +23,7 @@ RSpec.describe 'Graphql Field feature flags' do ...@@ -23,7 +23,7 @@ RSpec.describe 'Graphql Field feature flags' do
let(:query_type) do let(:query_type) do
query_factory do |query| query_factory do |query|
query.field :item, type, null: true, feature_flag: feature_flag, resolve: ->(obj, args, ctx) { test_object } query.field :item, type, null: true, feature_flag: feature_flag, resolver: simple_resolver(test_object)
end end
end end
......
...@@ -11,9 +11,13 @@ RSpec.describe Types::PermissionTypes::BasePermissionType do ...@@ -11,9 +11,13 @@ RSpec.describe Types::PermissionTypes::BasePermissionType do
Class.new(described_class) do Class.new(described_class) do
graphql_name 'TestClass' graphql_name 'TestClass'
permission_field :do_stuff, resolve: -> (_, _, _) { true } permission_field :do_stuff
ability_field(:read_issue) ability_field(:read_issue)
abilities :admin_issue abilities :admin_issue
define_method :do_stuff do
true
end
end end
end end
......
...@@ -22,6 +22,8 @@ RSpec.describe Gitlab::Graphql::MarkdownField do ...@@ -22,6 +22,8 @@ RSpec.describe Gitlab::Graphql::MarkdownField do
.to raise_error(expected_error) .to raise_error(expected_error)
end end
# TODO: remove as part of https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27536
# so that until that time, the developer check is there
it 'raises when passing a resolve block' do it 'raises when passing a resolve block' do
expect { class_with_markdown_field(:test_html, null: true, resolve: -> (_, _, _) { 'not really' } ) } expect { class_with_markdown_field(:test_html, null: true, resolve: -> (_, _, _) { 'not really' } ) }
.to raise_error(expected_error) .to raise_error(expected_error)
......
...@@ -150,6 +150,14 @@ module GraphqlHelpers ...@@ -150,6 +150,14 @@ module GraphqlHelpers
field.resolve_field(instance, args, context) field.resolve_field(instance, args, context)
end end
def simple_resolver(resolved_value = 'Resolved value')
Class.new(Resolvers::BaseResolver) do
define_method :resolve do |**_args|
resolved_value
end
end
end
# Recursively convert a Hash with Ruby-style keys to GraphQL fieldname-style keys # Recursively convert a Hash with Ruby-style keys to GraphQL fieldname-style keys
# #
# prepare_input_for_mutation({ 'my_key' => 1 }) # prepare_input_for_mutation({ 'my_key' => 1 })
......
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