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
4354a6b9
Commit
4354a6b9
authored
May 20, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates alert status enum values
* Updates sorting vars in FE
parent
49cefe11
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
43 deletions
+43
-43
app/assets/javascripts/alert_management/components/alert_management_list.vue
...pts/alert_management/components/alert_management_list.vue
+9
-9
app/graphql/types/alert_management/alert_sort_enum.rb
app/graphql/types/alert_management/alert_sort_enum.rb
+6
-6
app/models/alert_management/alert.rb
app/models/alert_management/alert.rb
+7
-7
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+6
-6
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+6
-6
spec/finders/alert_management/alerts_finder_spec.rb
spec/finders/alert_management/alerts_finder_spec.rb
+6
-6
spec/frontend/alert_management/components/alert_management_list_spec.js
...alert_management/components/alert_management_list_spec.js
+1
-1
spec/graphql/resolvers/alert_management_alert_resolver_spec.rb
...graphql/resolvers/alert_management_alert_resolver_spec.rb
+2
-2
No files found.
app/assets/javascripts/alert_management/components/alert_management_list.vue
View file @
4354a6b9
...
...
@@ -52,14 +52,14 @@ export default {
sortable
:
true
,
},
{
key
:
'
start
Time
'
,
key
:
'
start
edAt
'
,
label
:
s__
(
'
AlertManagement|Start time
'
),
thClass
:
'
js-started-at
'
,
tdClass
,
sortable
:
true
,
},
{
key
:
'
end
Time
'
,
key
:
'
end
edAt
'
,
label
:
s__
(
'
AlertManagement|End time
'
),
tdClass
,
sortable
:
true
,
...
...
@@ -72,7 +72,7 @@ export default {
sortable
:
false
,
},
{
key
:
'
event
s
Count
'
,
key
:
'
eventCount
'
,
label
:
s__
(
'
AlertManagement|Events
'
),
thClass
:
'
text-right gl-pr-9 w-3rem
'
,
tdClass
:
`
${
tdClass
}
text-md-right`
,
...
...
@@ -164,7 +164,7 @@ export default {
errored
:
false
,
isAlertDismissed
:
false
,
isErrorAlertDismissed
:
false
,
sort
:
'
START
_TIME
_ASC
'
,
sort
:
'
START
ED_AT
_ASC
'
,
statusFilter
:
this
.
$options
.
statusTabs
[
4
].
filters
,
};
},
...
...
@@ -199,7 +199,7 @@ export default {
const
sortDirection
=
sortDesc
?
'
DESC
'
:
'
ASC
'
;
const
sortColumn
=
convertToSnakeCase
(
sortBy
).
toUpperCase
();
if
(
sortBy
!==
'
start
Time
'
)
{
if
(
sortBy
!==
'
start
edAt
'
)
{
findDefaultSortColumn
().
ariaSort
=
'
none
'
;
}
this
.
sort
=
`
${
sortColumn
}
_
${
sortDirection
}
`
;
...
...
@@ -294,15 +294,15 @@ export default {
</div>
</
template
>
<
template
#cell(start
Time
)=
"{ item }"
>
<
template
#cell(start
edAt
)=
"{ item }"
>
<time-ago
v-if=
"item.startedAt"
:time=
"item.startedAt"
/>
</
template
>
<
template
#cell(end
Time
)=
"{ item }"
>
<
template
#cell(end
edAt
)=
"{ item }"
>
<time-ago
v-if=
"item.endedAt"
:time=
"item.endedAt"
/>
</
template
>
<!-- TODO: Remove after: https://gitlab.com/gitlab-org/gitlab/-/issues/218467 -->
<
template
#cell(event
s
Count)=
"{ item }"
>
<
template
#cell(eventCount)=
"{ item }"
>
{{
item
.
eventCount
}}
</
template
>
...
...
app/graphql/types/alert_management/alert_sort_enum.rb
View file @
4354a6b9
...
...
@@ -6,16 +6,16 @@ module Types
graphql_name
'AlertManagementAlertSort'
description
'Values for sorting alerts'
value
'START
_TIME_ASC'
,
'Start time by ascending order'
,
value: :start_time
_asc
value
'START
_TIME_DESC'
,
'Start time by descending order'
,
value: :start_time
_desc
value
'END
_TIME_ASC'
,
'End time by ascending order'
,
value: :end_time
_asc
value
'END
_TIME_DESC'
,
'End time by descending order'
,
value: :end_time
_desc
value
'START
ED_AT_ASC'
,
'Start time by ascending order'
,
value: :started_at
_asc
value
'START
ED_AT_DESC'
,
'Start time by descending order'
,
value: :started_at
_desc
value
'END
ED_AT_ASC'
,
'End time by ascending order'
,
value: :ended_at
_asc
value
'END
ED_AT_DESC'
,
'End time by descending order'
,
value: :ended_at
_desc
value
'CREATED_TIME_ASC'
,
'Created time by ascending order'
,
value: :created_at_asc
value
'CREATED_TIME_DESC'
,
'Created time by descending order'
,
value: :created_at_desc
value
'UPDATED_TIME_ASC'
,
'Created time by ascending order'
,
value: :updated_at_asc
value
'UPDATED_TIME_DESC'
,
'Created time by descending order'
,
value: :updated_at_desc
value
'EVENT
S_COUNT_ASC'
,
'Events count by ascending order'
,
value: :events
_count_asc
value
'EVENT
S_COUNT_DESC'
,
'Events count by descending order'
,
value: :events
_count_desc
value
'EVENT
_COUNT_ASC'
,
'Events count by ascending order'
,
value: :event
_count_asc
value
'EVENT
_COUNT_DESC'
,
'Events count by descending order'
,
value: :event
_count_desc
value
'SEVERITY_ASC'
,
'Severity by ascending order'
,
value: :severity_asc
value
'SEVERITY_DESC'
,
'Severity by descending order'
,
value: :severity_desc
value
'STATUS_ASC'
,
'Status by ascending order'
,
value: :status_asc
...
...
app/models/alert_management/alert.rb
View file @
4354a6b9
...
...
@@ -102,7 +102,7 @@ module AlertManagement
scope
:order_start_time
,
->
(
sort_order
)
{
order
(
started_at:
sort_order
)
}
scope
:order_end_time
,
->
(
sort_order
)
{
order
(
ended_at:
sort_order
)
}
scope
:order_event
s_count
,
->
(
sort_order
)
{
order
(
events:
sort_order
)
}
scope
:order_event
_count
,
->
(
sort_order
)
{
order
(
events:
sort_order
)
}
scope
:order_severity
,
->
(
sort_order
)
{
order
(
severity:
sort_order
)
}
scope
:order_status
,
->
(
sort_order
)
{
order
(
status:
sort_order
)
}
...
...
@@ -110,12 +110,12 @@ module AlertManagement
def
self
.
sort_by_attribute
(
method
)
case
method
.
to_s
when
'start
_time
_asc'
then
order_start_time
(
:asc
)
when
'start
_time
_desc'
then
order_start_time
(
:desc
)
when
'end
_time
_asc'
then
order_end_time
(
:asc
)
when
'end
_time
_desc'
then
order_end_time
(
:desc
)
when
'event
s_count_asc'
then
order_events
_count
(
:asc
)
when
'event
s_count_desc'
then
order_events
_count
(
:desc
)
when
'start
ed_at
_asc'
then
order_start_time
(
:asc
)
when
'start
ed_at
_desc'
then
order_start_time
(
:desc
)
when
'end
ed_at
_asc'
then
order_end_time
(
:asc
)
when
'end
ed_at
_desc'
then
order_end_time
(
:desc
)
when
'event
_count_asc'
then
order_event
_count
(
:asc
)
when
'event
_count_desc'
then
order_event
_count
(
:desc
)
when
'severity_asc'
then
order_severity
(
:asc
)
when
'severity_desc'
then
order_severity
(
:desc
)
when
'status_asc'
then
order_status
(
:asc
)
...
...
doc/api/graphql/reference/gitlab_schema.graphql
View file @
4354a6b9
...
...
@@ -270,22 +270,22 @@ enum AlertManagementAlertSort {
"""
End
time
by
ascending
order
"""
END
_TIME
_ASC
END
ED_AT
_ASC
"""
End
time
by
descending
order
"""
END
_TIME
_DESC
END
ED_AT
_DESC
"""
Events
count
by
ascending
order
"""
EVENT
S
_COUNT_ASC
EVENT_COUNT_ASC
"""
Events
count
by
descending
order
"""
EVENT
S
_COUNT_DESC
EVENT_COUNT_DESC
"""
Severity
by
ascending
order
...
...
@@ -300,12 +300,12 @@ enum AlertManagementAlertSort {
"""
Start
time
by
ascending
order
"""
START
_TIME
_ASC
START
ED_AT
_ASC
"""
Start
time
by
descending
order
"""
START
_TIME
_DESC
START
ED_AT
_DESC
"""
Status
by
ascending
order
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
4354a6b9
...
...
@@ -769,25 +769,25 @@
"deprecationReason": null
},
{
"name": "START
_TIME
_ASC",
"name": "START
ED_AT
_ASC",
"description": "Start time by ascending order",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "START
_TIME
_DESC",
"name": "START
ED_AT
_DESC",
"description": "Start time by descending order",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "END
_TIME
_ASC",
"name": "END
ED_AT
_ASC",
"description": "End time by ascending order",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "END
_TIME
_DESC",
"name": "END
ED_AT
_DESC",
"description": "End time by descending order",
"isDeprecated": false,
"deprecationReason": null
...
...
@@ -817,13 +817,13 @@
"deprecationReason": null
},
{
"name": "EVENT
S
_COUNT_ASC",
"name": "EVENT_COUNT_ASC",
"description": "Events count by ascending order",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "EVENT
S
_COUNT_DESC",
"name": "EVENT_COUNT_DESC",
"description": "Events count by descending order",
"isDeprecated": false,
"deprecationReason": null
spec/finders/alert_management/alerts_finder_spec.rb
View file @
4354a6b9
...
...
@@ -100,13 +100,13 @@ describe AlertManagement::AlertsFinder, '#execute' do
context
'when sorting by start time'
do
context
'sorts alerts ascending'
do
let
(
:params
)
{
{
sort:
'start
_time
_asc'
}
}
let
(
:params
)
{
{
sort:
'start
ed_at
_asc'
}
}
it
{
is_expected
.
to
eq
[
alert_1
,
alert_2
]
}
end
context
'sorts alerts descending'
do
let
(
:params
)
{
{
sort:
'start
_time
_desc'
}
}
let
(
:params
)
{
{
sort:
'start
ed_at
_desc'
}
}
it
{
is_expected
.
to
eq
[
alert_2
,
alert_1
]
}
end
...
...
@@ -114,13 +114,13 @@ describe AlertManagement::AlertsFinder, '#execute' do
context
'when sorting by end time'
do
context
'sorts alerts ascending'
do
let
(
:params
)
{
{
sort:
'end
_time
_asc'
}
}
let
(
:params
)
{
{
sort:
'end
ed_at
_asc'
}
}
it
{
is_expected
.
to
eq
[
alert_1
,
alert_2
]
}
end
context
'sorts alerts descending'
do
let
(
:params
)
{
{
sort:
'end
_time
_desc'
}
}
let
(
:params
)
{
{
sort:
'end
ed_at
_desc'
}
}
it
{
is_expected
.
to
eq
[
alert_2
,
alert_1
]
}
end
...
...
@@ -131,13 +131,13 @@ describe AlertManagement::AlertsFinder, '#execute' do
let_it_be
(
:alert_count_3
)
{
create
(
:alert_management_alert
,
project:
project
,
events:
3
)
}
context
'sorts alerts ascending'
do
let
(
:params
)
{
{
sort:
'event
s
_count_asc'
}
}
let
(
:params
)
{
{
sort:
'event_count_asc'
}
}
it
{
is_expected
.
to
eq
[
alert_2
,
alert_1
,
alert_count_3
,
alert_count_6
]
}
end
context
'sorts alerts descending'
do
let
(
:params
)
{
{
sort:
'event
s
_count_desc'
}
}
let
(
:params
)
{
{
sort:
'event_count_desc'
}
}
it
{
is_expected
.
to
eq
[
alert_count_6
,
alert_count_3
,
alert_1
,
alert_2
]
}
end
...
...
spec/frontend/alert_management/components/alert_management_list_spec.js
View file @
4354a6b9
...
...
@@ -297,7 +297,7 @@ describe('AlertManagementList', () => {
beforeEach
(()
=>
{
mountComponent
({
props
:
{
alertManagementEnabled
:
true
,
userCanEnableAlertManagement
:
true
},
data
:
{
alerts
:
mockAlerts
,
errored
:
false
,
sort
:
'
START
_TIME
_ASC
'
,
alertsCount
},
data
:
{
alerts
:
mockAlerts
,
errored
:
false
,
sort
:
'
START
ED_AT
_ASC
'
,
alertsCount
},
loading
:
false
,
});
});
...
...
spec/graphql/resolvers/alert_management_alert_resolver_spec.rb
View file @
4354a6b9
...
...
@@ -45,11 +45,11 @@ describe Resolvers::AlertManagementAlertResolver do
let_it_be
(
:alert_count_3
)
{
create
(
:alert_management_alert
,
project:
project
,
events:
3
)
}
it
'sorts alerts ascending'
do
expect
(
resolve_alerts
(
sort: :event
s
_count_asc
)).
to
eq
[
alert_2
,
alert_1
,
alert_count_3
,
alert_count_6
]
expect
(
resolve_alerts
(
sort: :event_count_asc
)).
to
eq
[
alert_2
,
alert_1
,
alert_count_3
,
alert_count_6
]
end
it
'sorts alerts descending'
do
expect
(
resolve_alerts
(
sort: :event
s
_count_desc
)).
to
eq
[
alert_count_6
,
alert_count_3
,
alert_1
,
alert_2
]
expect
(
resolve_alerts
(
sort: :event_count_desc
)).
to
eq
[
alert_count_6
,
alert_count_3
,
alert_1
,
alert_2
]
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