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
aae32351
Commit
aae32351
authored
May 13, 2020
by
Tristan Read
Committed by
Kushal Pandya
May 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error state for Alert Detail view
parent
d9145389
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
5 deletions
+41
-5
app/assets/javascripts/alert_management/components/alert_details.vue
...javascripts/alert_management/components/alert_details.vue
+22
-1
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/alert_management/components/alert_management_detail_spec.js
...ert_management/components/alert_management_detail_spec.js
+16
-4
No files found.
app/assets/javascripts/alert_management/components/alert_details.vue
View file @
aae32351
<
script
>
import
*
as
Sentry
from
'
@sentry/browser
'
;
import
{
GlAlert
,
GlLoadingIcon
,
GlNewDropdown
,
GlNewDropdownItem
,
...
...
@@ -19,10 +21,14 @@ export default {
resolved
:
s__
(
'
AlertManagement|Resolved
'
),
},
i18n
:
{
errorMsg
:
s__
(
'
AlertManagement|There was an error displaying the alert. Please refresh the page to try again.
'
,
),
fullAlertDetailsTitle
:
s__
(
'
AlertManagement|Full Alert Details
'
),
overviewTitle
:
s__
(
'
AlertManagement|Overview
'
),
},
components
:
{
GlAlert
,
GlLoadingIcon
,
GlNewDropdown
,
GlNewDropdownItem
,
...
...
@@ -58,20 +64,35 @@ export default {
update
(
data
)
{
return
data
?.
project
?.
alertManagementAlerts
?.
nodes
?.[
0
]
??
null
;
},
error
(
error
)
{
this
.
errored
=
true
;
Sentry
.
captureException
(
error
);
},
},
},
data
()
{
return
{
alert
:
null
};
return
{
alert
:
null
,
errored
:
false
,
isErrorDismissed
:
false
};
},
computed
:
{
loading
()
{
return
this
.
$apollo
.
queries
.
alert
.
loading
;
},
showErrorMsg
()
{
return
this
.
errored
&&
!
this
.
isErrorDismissed
;
},
},
methods
:
{
dismissError
()
{
this
.
isErrorDismissed
=
true
;
},
},
};
</
script
>
<
template
>
<div>
<gl-alert
v-if=
"showErrorMsg"
variant=
"danger"
@
dismiss=
"dismissError"
>
{{
$options
.
i18n
.
errorMsg
}}
</gl-alert>
<div
v-if=
"loading"
><gl-loading-icon
size=
"lg"
class=
"mt-3"
/></div>
<div
v-if=
"alert"
...
...
locale/gitlab.pot
View file @
aae32351
...
...
@@ -1792,6 +1792,9 @@ msgstr ""
msgid "AlertManagement|Surface alerts in GitLab"
msgstr ""
msgid "AlertManagement|There was an error displaying the alert. Please refresh the page to try again."
msgstr ""
msgid "AlertManagement|There was an error displaying the alerts. Confirm your endpoint's configuration details to ensure alerts appear."
msgstr ""
...
...
spec/frontend/alert_management/components/alert_management_detail_spec.js
View file @
aae32351
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
Gl
Alert
,
Gl
LoadingIcon
}
from
'
@gitlab/ui
'
;
import
AlertDetails
from
'
~/alert_management/components/alert_details.vue
'
;
describe
(
'
AlertDetails
'
,
()
=>
{
...
...
@@ -7,7 +7,7 @@ describe('AlertDetails', () => {
const
newIssuePath
=
'
root/alerts/-/issues/new
'
;
function
mountComponent
({
alert
=
{
},
data
=
{
alert
:
{}
},
createIssueFromAlertEnabled
=
false
,
loading
=
false
,
}
=
{})
{
...
...
@@ -18,7 +18,7 @@ describe('AlertDetails', () => {
newIssuePath
,
},
data
()
{
return
{
alert
}
;
return
data
;
},
provide
:
{
glFeatures
:
{
createIssueFromAlertEnabled
},
...
...
@@ -46,7 +46,7 @@ describe('AlertDetails', () => {
describe
(
'
Alert details
'
,
()
=>
{
describe
(
'
when alert is null
'
,
()
=>
{
beforeEach
(()
=>
{
mountComponent
({
alert
:
null
});
mountComponent
({
data
:
{
alert
:
null
}
});
});
it
(
'
shows an empty state
'
,
()
=>
{
...
...
@@ -102,5 +102,17 @@ describe('AlertDetails', () => {
expect
(
wrapper
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
error state
'
,
()
=>
{
it
(
'
displays a error state correctly
'
,
()
=>
{
mountComponent
({
data
:
{
errored
:
true
}
});
expect
(
wrapper
.
find
(
GlAlert
).
exists
()).
toBe
(
true
);
});
it
(
'
does not display an error when dismissed
'
,
()
=>
{
mountComponent
({
data
:
{
errored
:
true
,
isErrorDismissed
:
true
}
});
expect
(
wrapper
.
find
(
GlAlert
).
exists
()).
toBe
(
false
);
});
});
});
});
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