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
d837db8b
Commit
d837db8b
authored
Jun 16, 2020
by
Sean Arnold
Committed by
Peter Leitzen
Jun 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add search argument for AlertStatusCountsResolver
- Update docs also
parent
85a85254
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
2 deletions
+54
-2
app/graphql/resolvers/alert_management/alert_status_counts_resolver.rb
...esolvers/alert_management/alert_status_counts_resolver.rb
+4
-0
changelogs/unreleased/218707-search-criteria-for-alert-status-counts.yml
...leased/218707-search-criteria-for-alert-status-counts.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+6
-1
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+10
-1
spec/lib/gitlab/alert_management/alert_status_counts_spec.rb
spec/lib/gitlab/alert_management/alert_status_counts_spec.rb
+13
-0
spec/requests/api/graphql/project/alert_management/alert_status_counts_spec.rb
...phql/project/alert_management/alert_status_counts_spec.rb
+16
-0
No files found.
app/graphql/resolvers/alert_management/alert_status_counts_resolver.rb
View file @
d837db8b
...
@@ -5,6 +5,10 @@ module Resolvers
...
@@ -5,6 +5,10 @@ module Resolvers
class
AlertStatusCountsResolver
<
BaseResolver
class
AlertStatusCountsResolver
<
BaseResolver
type
Types
::
AlertManagement
::
AlertStatusCountsType
,
null:
true
type
Types
::
AlertManagement
::
AlertStatusCountsType
,
null:
true
argument
:search
,
GraphQL
::
STRING_TYPE
,
description:
'Search criteria for filtering alerts. This will search on title, description, service, monitoring_tool.'
,
required:
false
def
resolve
(
**
args
)
def
resolve
(
**
args
)
::
Gitlab
::
AlertManagement
::
AlertStatusCounts
.
new
(
context
[
:current_user
],
object
,
args
)
::
Gitlab
::
AlertManagement
::
AlertStatusCounts
.
new
(
context
[
:current_user
],
object
,
args
)
end
end
...
...
changelogs/unreleased/218707-search-criteria-for-alert-status-counts.yml
0 → 100644
View file @
d837db8b
---
title
:
Add search argument for AlertStatusCountsResolver
merge_request
:
34596
author
:
type
:
added
doc/api/graphql/reference/gitlab_schema.graphql
View file @
d837db8b
...
@@ -8349,7 +8349,12 @@ type Project {
...
@@ -8349,7 +8349,12 @@ type Project {
"""
"""
Counts
of
alerts
by
status
for
the
project
Counts
of
alerts
by
status
for
the
project
"""
"""
alertManagementAlertStatusCounts
:
AlertManagementAlertStatusCountsType
alertManagementAlertStatusCounts
(
"""
Search
criteria
for
filtering
alerts
.
This
will
search
on
title
,
description
,
service
,
monitoring_tool
.
"""
search
:
String
):
AlertManagementAlertStatusCountsType
"""
"""
Alert
Management
alerts
of
the
project
Alert
Management
alerts
of
the
project
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
d837db8b
...
@@ -24919,7 +24919,16 @@
...
@@ -24919,7 +24919,16 @@
"name": "alertManagementAlertStatusCounts",
"name": "alertManagementAlertStatusCounts",
"description": "Counts of alerts by status for the project",
"description": "Counts of alerts by status for the project",
"args": [
"args": [
{
"name": "search",
"description": "Search criteria for filtering alerts. This will search on title, description, service, monitoring_tool.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
}
],
],
"type": {
"type": {
"kind": "OBJECT",
"kind": "OBJECT",
spec/lib/gitlab/alert_management/alert_status_counts_spec.rb
View file @
d837db8b
...
@@ -50,6 +50,19 @@ describe Gitlab::AlertManagement::AlertStatusCounts do
...
@@ -50,6 +50,19 @@ describe Gitlab::AlertManagement::AlertStatusCounts do
expect
(
counts
.
acknowledged
).
to
eq
(
0
)
expect
(
counts
.
acknowledged
).
to
eq
(
0
)
end
end
end
end
context
'when search param is included'
do
let
(
:params
)
{
{
search:
alert_1
.
title
}
}
it
'returns the correct countss'
do
expect
(
counts
.
open
).
to
eq
(
0
)
expect
(
counts
.
all
).
to
eq
(
1
)
expect
(
counts
.
resolved
).
to
eq
(
1
)
expect
(
counts
.
ignored
).
to
eq
(
0
)
expect
(
counts
.
triggered
).
to
eq
(
0
)
expect
(
counts
.
acknowledged
).
to
eq
(
0
)
end
end
end
end
end
end
end
end
spec/requests/api/graphql/project/alert_management/alert_status_counts_spec.rb
View file @
d837db8b
...
@@ -56,6 +56,22 @@ describe 'getting Alert Management Alert counts by status' do
...
@@ -56,6 +56,22 @@ describe 'getting Alert Management Alert counts by status' do
'ignored'
=>
0
'ignored'
=>
0
)
)
end
end
context
'with search criteria'
do
let
(
:params
)
{
{
search:
alert_1
.
title
}
}
it_behaves_like
'a working graphql query'
it
'returns the correct counts for each status'
do
expect
(
alert_counts
).
to
eq
(
'open'
=>
0
,
'all'
=>
1
,
'triggered'
=>
0
,
'acknowledged'
=>
0
,
'resolved'
=>
1
,
'ignored'
=>
0
)
end
end
end
end
end
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