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
d6573b85
Commit
d6573b85
authored
Sep 25, 2020
by
Tristan Read
Committed by
Ezekiel Kigbo
Sep 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove internal fields from alert details table
parent
14025583
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
13 deletions
+47
-13
app/assets/javascripts/issue_show/components/incidents/incident_tabs.vue
...scripts/issue_show/components/incidents/incident_tabs.vue
+1
-8
app/assets/javascripts/vue_shared/components/alert_details_table.vue
...javascripts/vue_shared/components/alert_details_table.vue
+19
-4
changelogs/unreleased/tr-filter-internal-strings.yml
changelogs/unreleased/tr-filter-internal-strings.yml
+5
-0
spec/frontend/issue_show/components/incidents/incident_tabs_spec.js
...end/issue_show/components/incidents/incident_tabs_spec.js
+1
-1
spec/frontend/vue_shared/components/alert_detail_table_spec.js
...frontend/vue_shared/components/alert_detail_table_spec.js
+21
-0
No files found.
app/assets/javascripts/issue_show/components/incidents/incident_tabs.vue
View file @
d6573b85
...
...
@@ -45,13 +45,6 @@ export default {
loading
()
{
return
this
.
$apollo
.
queries
.
alert
.
loading
;
},
alertTableFields
()
{
if
(
this
.
alert
)
{
const
{
detailsUrl
,
__typename
,
...
restDetails
}
=
this
.
alert
;
return
restDetails
;
}
return
null
;
},
},
};
</
script
>
...
...
@@ -64,7 +57,7 @@ export default {
<description-component
v-bind=
"$attrs"
/>
</gl-tab>
<gl-tab
v-if=
"alert"
class=
"alert-management-details"
:title=
"s__('Incident|Alert details')"
>
<alert-details-table
:alert=
"alert
TableFields
"
:loading=
"loading"
/>
<alert-details-table
:alert=
"alert"
:loading=
"loading"
/>
</gl-tab>
</gl-tabs>
</div>
...
...
app/assets/javascripts/vue_shared/components/alert_details_table.vue
View file @
d6573b85
...
...
@@ -9,6 +9,22 @@ import {
const
thClass
=
'
gl-bg-transparent! gl-border-1! gl-border-b-solid! gl-border-gray-200!
'
;
const
tdClass
=
'
gl-border-gray-100! gl-p-5!
'
;
const
allowedFields
=
[
'
iid
'
,
'
title
'
,
'
severity
'
,
'
status
'
,
'
startedAt
'
,
'
eventCount
'
,
'
monitoringTool
'
,
'
service
'
,
'
description
'
,
'
endedAt
'
,
'
details
'
,
];
const
filterAllowedFields
=
([
fieldName
])
=>
allowedFields
.
includes
(
fieldName
);
const
arrayToObject
=
([
fieldName
,
value
])
=>
({
fieldName
,
value
});
export
default
{
components
:
{
...
...
@@ -46,10 +62,9 @@ export default {
if
(
!
this
.
alert
)
{
return
[];
}
return
Object
.
entries
(
this
.
alert
).
map
(([
fieldName
,
value
])
=>
({
fieldName
,
value
,
}));
return
Object
.
entries
(
this
.
alert
)
.
filter
(
filterAllowedFields
)
.
map
(
arrayToObject
);
},
},
};
...
...
changelogs/unreleased/tr-filter-internal-strings.yml
0 → 100644
View file @
d6573b85
---
title
:
Remove internal fields from alert details table
merge_request
:
43076
author
:
type
:
changed
spec/frontend/issue_show/components/incidents/incident_tabs_spec.js
View file @
d6573b85
...
...
@@ -79,7 +79,7 @@ describe('Incident Tabs component', () => {
it
(
'
renders the alert details table with the correct props
'
,
()
=>
{
const
alert
=
{
iid
:
mockAlert
.
iid
};
expect
(
findAlertDetailsComponent
().
props
(
'
alert
'
)).
to
Equal
(
alert
);
expect
(
findAlertDetailsComponent
().
props
(
'
alert
'
)).
to
MatchObject
(
alert
);
expect
(
findAlertDetailsComponent
().
props
(
'
loading
'
)).
toBe
(
true
);
});
...
...
spec/frontend/vue_shared/components/alert_detail_table_spec.js
View file @
d6573b85
...
...
@@ -14,6 +14,7 @@ const mockAlert = {
assignees
:
{
nodes
:
[]
},
notes
:
{
nodes
:
[]
},
todos
:
{
nodes
:
[]
},
__typename
:
'
AlertManagementAlert
'
,
};
describe
(
'
AlertDetails
'
,
()
=>
{
...
...
@@ -35,6 +36,8 @@ describe('AlertDetails', () => {
});
const
findTableComponent
=
()
=>
wrapper
.
find
(
GlTable
);
const
findTableKeys
=
()
=>
findTableComponent
().
findAll
(
'
tbody td:first-child
'
);
const
findTableField
=
(
fields
,
fieldName
)
=>
fields
.
filter
(
row
=>
row
.
text
()
===
fieldName
);
describe
(
'
Alert details
'
,
()
=>
{
describe
(
'
empty state
'
,
()
=>
{
...
...
@@ -69,6 +72,24 @@ describe('AlertDetails', () => {
it
(
'
renders a cell based on alert data
'
,
()
=>
{
expect
(
findTableComponent
().
text
()).
toContain
(
'
SyntaxError: Invalid or unexpected token
'
);
});
it
(
'
should show allowed alert fields
'
,
()
=>
{
const
fields
=
findTableKeys
();
expect
(
findTableField
(
fields
,
'
Iid
'
).
exists
()).
toBe
(
true
);
expect
(
findTableField
(
fields
,
'
Title
'
).
exists
()).
toBe
(
true
);
expect
(
findTableField
(
fields
,
'
Severity
'
).
exists
()).
toBe
(
true
);
expect
(
findTableField
(
fields
,
'
Status
'
).
exists
()).
toBe
(
true
);
});
it
(
'
should not show disallowed alert fields
'
,
()
=>
{
const
fields
=
findTableKeys
();
expect
(
findTableField
(
fields
,
'
Typename
'
).
exists
()).
toBe
(
false
);
expect
(
findTableField
(
fields
,
'
Todos
'
).
exists
()).
toBe
(
false
);
expect
(
findTableField
(
fields
,
'
Notes
'
).
exists
()).
toBe
(
false
);
expect
(
findTableField
(
fields
,
'
Assignees
'
).
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