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
ee492f62
Commit
ee492f62
authored
Jun 05, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move AlertManagementAlertResolver into module
- Update references and specs, too
parent
e63b05bd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
36 deletions
+38
-36
app/graphql/mutations/alert_management/base.rb
app/graphql/mutations/alert_management/base.rb
+1
-1
app/graphql/resolvers/alert_management/alert_resolver.rb
app/graphql/resolvers/alert_management/alert_resolver.rb
+33
-0
app/graphql/resolvers/alert_management_alert_resolver.rb
app/graphql/resolvers/alert_management_alert_resolver.rb
+0
-31
app/graphql/types/project_type.rb
app/graphql/types/project_type.rb
+2
-2
spec/graphql/mutations/alert_management/update_alert_status_spec.rb
...ql/mutations/alert_management/update_alert_status_spec.rb
+1
-1
spec/graphql/resolvers/alert_management/alert_resolver_spec.rb
...graphql/resolvers/alert_management/alert_resolver_spec.rb
+1
-1
No files found.
app/graphql/mutations/alert_management/base.rb
View file @
ee492f62
...
...
@@ -32,7 +32,7 @@ module Mutations
return
unless
project
resolver
=
Resolvers
::
AlertManagementAlertResolver
.
single
.
new
(
object:
project
,
context:
context
,
field:
nil
)
resolver
=
Resolvers
::
AlertManagement
::
AlertResolver
.
single
.
new
(
object:
project
,
context:
context
,
field:
nil
)
resolver
.
resolve
(
iid:
iid
)
end
end
...
...
app/graphql/resolvers/alert_management/alert_resolver.rb
0 → 100644
View file @
ee492f62
# frozen_string_literal: true
module
Resolvers
module
AlertManagement
class
AlertResolver
<
BaseResolver
argument
:iid
,
GraphQL
::
STRING_TYPE
,
required:
false
,
description:
'IID of the alert. For example, "1"'
argument
:statuses
,
[
Types
::
AlertManagement
::
StatusEnum
],
as: :status
,
required:
false
,
description:
'Alerts with the specified statues. For example, [TRIGGERED]'
argument
:sort
,
Types
::
AlertManagement
::
AlertSortEnum
,
description:
'Sort alerts by this criteria'
,
required:
false
argument
:search
,
GraphQL
::
STRING_TYPE
,
description:
'Search criteria for filtering alerts. This will search on title, description, service, monitoring_tool.'
,
required:
false
type
Types
::
AlertManagement
::
AlertType
,
null:
true
def
resolve
(
**
args
)
parent
=
object
.
respond_to?
(
:sync
)
?
object
.
sync
:
object
return
::
AlertManagement
::
Alert
.
none
if
parent
.
nil?
::
AlertManagement
::
AlertsFinder
.
new
(
context
[
:current_user
],
parent
,
args
).
execute
end
end
end
end
app/graphql/resolvers/alert_management_alert_resolver.rb
deleted
100644 → 0
View file @
e63b05bd
# frozen_string_literal: true
module
Resolvers
class
AlertManagementAlertResolver
<
BaseResolver
argument
:iid
,
GraphQL
::
STRING_TYPE
,
required:
false
,
description:
'IID of the alert. For example, "1"'
argument
:statuses
,
[
Types
::
AlertManagement
::
StatusEnum
],
as: :status
,
required:
false
,
description:
'Alerts with the specified statues. For example, [TRIGGERED]'
argument
:sort
,
Types
::
AlertManagement
::
AlertSortEnum
,
description:
'Sort alerts by this criteria'
,
required:
false
argument
:search
,
GraphQL
::
STRING_TYPE
,
description:
'Search criteria for filtering alerts. This will search on title, description, service, monitoring_tool.'
,
required:
false
type
Types
::
AlertManagement
::
AlertType
,
null:
true
def
resolve
(
**
args
)
parent
=
object
.
respond_to?
(
:sync
)
?
object
.
sync
:
object
return
::
AlertManagement
::
Alert
.
none
if
parent
.
nil?
::
AlertManagement
::
AlertsFinder
.
new
(
context
[
:current_user
],
parent
,
args
).
execute
end
end
end
app/graphql/types/project_type.rb
View file @
ee492f62
...
...
@@ -216,13 +216,13 @@ module Types
Types
::
AlertManagement
::
AlertType
.
connection_type
,
null:
true
,
description:
'Alert Management alerts of the project'
,
resolver:
Resolvers
::
AlertManagementAlertResolver
resolver:
Resolvers
::
AlertManagement
::
AlertResolver
field
:alert_management_alert
,
Types
::
AlertManagement
::
AlertType
,
null:
true
,
description:
'A single Alert Management alert of the project'
,
resolver:
Resolvers
::
AlertManagementAlertResolver
.
single
resolver:
Resolvers
::
AlertManagement
::
AlertResolver
.
single
field
:alert_management_alert_status_counts
,
Types
::
AlertManagement
::
AlertStatusCountsType
,
...
...
spec/graphql/mutations/alert_management/update_alert_status_spec.rb
View file @
ee492f62
...
...
@@ -33,7 +33,7 @@ describe Mutations::AlertManagement::UpdateAlertStatus do
context
'error occurs when updating'
do
it
'returns the alert with errors'
do
# Stub an error on the alert
allow_next_instance_of
(
Resolvers
::
AlertManagementAlertResolver
)
do
|
resolver
|
allow_next_instance_of
(
Resolvers
::
AlertManagement
::
AlertResolver
)
do
|
resolver
|
allow
(
resolver
).
to
receive
(
:resolve
).
and_return
(
alert
)
end
...
...
spec/graphql/resolvers/alert_management
_
alert_resolver_spec.rb
→
spec/graphql/resolvers/alert_management
/
alert_resolver_spec.rb
View file @
ee492f62
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
describe
Resolvers
::
AlertManagementAlertResolver
do
describe
Resolvers
::
AlertManagement
::
AlertResolver
do
include
GraphqlHelpers
let_it_be
(
:current_user
)
{
create
(
:user
)
}
...
...
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