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
Show 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
>
<
script
>
import
*
as
Sentry
from
'
@sentry/browser
'
;
import
{
import
{
GlAlert
,
GlLoadingIcon
,
GlLoadingIcon
,
GlNewDropdown
,
GlNewDropdown
,
GlNewDropdownItem
,
GlNewDropdownItem
,
...
@@ -19,10 +21,14 @@ export default {
...
@@ -19,10 +21,14 @@ export default {
resolved
:
s__
(
'
AlertManagement|Resolved
'
),
resolved
:
s__
(
'
AlertManagement|Resolved
'
),
},
},
i18n
:
{
i18n
:
{
errorMsg
:
s__
(
'
AlertManagement|There was an error displaying the alert. Please refresh the page to try again.
'
,
),
fullAlertDetailsTitle
:
s__
(
'
AlertManagement|Full Alert Details
'
),
fullAlertDetailsTitle
:
s__
(
'
AlertManagement|Full Alert Details
'
),
overviewTitle
:
s__
(
'
AlertManagement|Overview
'
),
overviewTitle
:
s__
(
'
AlertManagement|Overview
'
),
},
},
components
:
{
components
:
{
GlAlert
,
GlLoadingIcon
,
GlLoadingIcon
,
GlNewDropdown
,
GlNewDropdown
,
GlNewDropdownItem
,
GlNewDropdownItem
,
...
@@ -58,20 +64,35 @@ export default {
...
@@ -58,20 +64,35 @@ export default {
update
(
data
)
{
update
(
data
)
{
return
data
?.
project
?.
alertManagementAlerts
?.
nodes
?.[
0
]
??
null
;
return
data
?.
project
?.
alertManagementAlerts
?.
nodes
?.[
0
]
??
null
;
},
},
error
(
error
)
{
this
.
errored
=
true
;
Sentry
.
captureException
(
error
);
},
},
},
},
},
data
()
{
data
()
{
return
{
alert
:
null
};
return
{
alert
:
null
,
errored
:
false
,
isErrorDismissed
:
false
};
},
},
computed
:
{
computed
:
{
loading
()
{
loading
()
{
return
this
.
$apollo
.
queries
.
alert
.
loading
;
return
this
.
$apollo
.
queries
.
alert
.
loading
;
},
},
showErrorMsg
()
{
return
this
.
errored
&&
!
this
.
isErrorDismissed
;
},
},
methods
:
{
dismissError
()
{
this
.
isErrorDismissed
=
true
;
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div>
<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=
"loading"
><gl-loading-icon
size=
"lg"
class=
"mt-3"
/></div>
<div
<div
v-if=
"alert"
v-if=
"alert"
...
...
locale/gitlab.pot
View file @
aae32351
...
@@ -1792,6 +1792,9 @@ msgstr ""
...
@@ -1792,6 +1792,9 @@ msgstr ""
msgid "AlertManagement|Surface alerts in GitLab"
msgid "AlertManagement|Surface alerts in GitLab"
msgstr ""
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."
msgid "AlertManagement|There was an error displaying the alerts. Confirm your endpoint's configuration details to ensure alerts appear."
msgstr ""
msgstr ""
...
...
spec/frontend/alert_management/components/alert_management_detail_spec.js
View file @
aae32351
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
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
'
;
import
AlertDetails
from
'
~/alert_management/components/alert_details.vue
'
;
describe
(
'
AlertDetails
'
,
()
=>
{
describe
(
'
AlertDetails
'
,
()
=>
{
...
@@ -7,7 +7,7 @@ describe('AlertDetails', () => {
...
@@ -7,7 +7,7 @@ describe('AlertDetails', () => {
const
newIssuePath
=
'
root/alerts/-/issues/new
'
;
const
newIssuePath
=
'
root/alerts/-/issues/new
'
;
function
mountComponent
({
function
mountComponent
({
alert
=
{
},
data
=
{
alert
:
{}
},
createIssueFromAlertEnabled
=
false
,
createIssueFromAlertEnabled
=
false
,
loading
=
false
,
loading
=
false
,
}
=
{})
{
}
=
{})
{
...
@@ -18,7 +18,7 @@ describe('AlertDetails', () => {
...
@@ -18,7 +18,7 @@ describe('AlertDetails', () => {
newIssuePath
,
newIssuePath
,
},
},
data
()
{
data
()
{
return
{
alert
}
;
return
data
;
},
},
provide
:
{
provide
:
{
glFeatures
:
{
createIssueFromAlertEnabled
},
glFeatures
:
{
createIssueFromAlertEnabled
},
...
@@ -46,7 +46,7 @@ describe('AlertDetails', () => {
...
@@ -46,7 +46,7 @@ describe('AlertDetails', () => {
describe
(
'
Alert details
'
,
()
=>
{
describe
(
'
Alert details
'
,
()
=>
{
describe
(
'
when alert is null
'
,
()
=>
{
describe
(
'
when alert is null
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mountComponent
({
alert
:
null
});
mountComponent
({
data
:
{
alert
:
null
}
});
});
});
it
(
'
shows an empty state
'
,
()
=>
{
it
(
'
shows an empty state
'
,
()
=>
{
...
@@ -102,5 +102,17 @@ describe('AlertDetails', () => {
...
@@ -102,5 +102,17 @@ describe('AlertDetails', () => {
expect
(
wrapper
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
true
);
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