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
47d7099e
Commit
47d7099e
authored
Jul 13, 2020
by
Tristan Read
Committed by
Andrew Fontaine
Jul 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Highlight row when alert is new
parent
ec44773b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
4 deletions
+63
-4
app/assets/javascripts/alert_management/components/alert_management_table.vue
...ts/alert_management/components/alert_management_table.vue
+20
-4
app/assets/stylesheets/pages/alert_management/list.scss
app/assets/stylesheets/pages/alert_management/list.scss
+4
-0
changelogs/unreleased/tr-show-new-alerts.yml
changelogs/unreleased/tr-show-new-alerts.yml
+5
-0
spec/frontend/alert_management/components/alert_management_table_spec.js
...lert_management/components/alert_management_table_spec.js
+34
-0
No files found.
app/assets/javascripts/alert_management/components/alert_management_table.vue
View file @
47d7099e
...
...
@@ -44,6 +44,8 @@ const initialPaginationState = {
lastPageSize
:
null
,
};
const
TWELVE_HOURS_IN_MS
=
12
*
60
*
60
*
1000
;
export
default
{
i18n
:
{
noAlertsMsg
:
s__
(
...
...
@@ -149,9 +151,20 @@ export default {
update
(
data
)
{
const
{
alertManagementAlerts
:
{
nodes
:
list
=
[],
pageInfo
=
{}
}
=
{}
}
=
data
.
project
||
{};
const
now
=
new
Date
();
const
listWithData
=
list
.
map
(
alert
=>
{
const
then
=
new
Date
(
alert
.
startedAt
);
const
diff
=
now
-
then
;
return
{
...
alert
,
isNew
:
diff
<
TWELVE_HOURS_IN_MS
,
};
});
return
{
list
,
list
:
listWithData
,
pageInfo
,
};
},
...
...
@@ -207,9 +220,6 @@ export default {
hasAlerts
()
{
return
this
.
alerts
?.
list
?.
length
;
},
tbodyTrClass
()
{
return
!
this
.
loading
&&
this
.
hasAlerts
?
bodyTrClass
:
''
;
},
showPaginationControls
()
{
return
Boolean
(
this
.
prevPage
||
this
.
nextPage
);
},
...
...
@@ -290,6 +300,12 @@ export default {
resetPagination
()
{
this
.
pagination
=
initialPaginationState
;
},
tbodyTrClass
(
item
)
{
return
{
[
bodyTrClass
]:
!
this
.
loading
&&
this
.
hasAlerts
,
'
new-alert
'
:
item
?.
isNew
,
};
},
handleAlertError
(
errorMessage
)
{
this
.
errored
=
true
;
this
.
errorMessage
=
errorMessage
;
...
...
app/assets/stylesheets/pages/alert_management/list.scss
View file @
47d7099e
.alert-management-list
{
.new-alert
{
background-color
:
$issues-today-bg
;
}
// these styles need to be deleted once GlTable component looks in GitLab same as in @gitlab/ui
table
{
color
:
$gray-700
;
...
...
changelogs/unreleased/tr-show-new-alerts.yml
0 → 100644
View file @
47d7099e
---
title
:
Show when alert is new in the Alerts list
merge_request
:
35708
author
:
type
:
added
spec/frontend/alert_management/components/alert_management_table_spec.js
View file @
47d7099e
...
...
@@ -349,6 +349,40 @@ describe('AlertManagementTable', () => {
});
expect
(
findDateFields
().
exists
()).
toBe
(
false
);
});
describe
(
'
New Alert indicator
'
,
()
=>
{
const
oldAlert
=
mockAlerts
[
0
];
const
newAlert
=
{
...
oldAlert
,
isNew
:
true
};
it
(
'
should highlight the row when alert is new
'
,
()
=>
{
mountComponent
({
props
:
{
alertManagementEnabled
:
true
,
userCanEnableAlertManagement
:
true
},
data
:
{
alerts
:
{
list
:
[
newAlert
]
},
alertsCount
,
errored
:
false
},
loading
:
false
,
});
expect
(
findAlerts
()
.
at
(
0
)
.
classes
(),
).
toContain
(
'
new-alert
'
);
});
it
(
'
should not highlight the row when alert is not new
'
,
()
=>
{
mountComponent
({
props
:
{
alertManagementEnabled
:
true
,
userCanEnableAlertManagement
:
true
},
data
:
{
alerts
:
{
list
:
[
oldAlert
]
},
alertsCount
,
errored
:
false
},
loading
:
false
,
});
expect
(
findAlerts
()
.
at
(
0
)
.
classes
(),
).
not
.
toContain
(
'
new-alert
'
);
});
});
});
});
...
...
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