Commit c394ad1a authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '229401-close-icon' into 'master'

Add closed icon for incidents

Closes #229401

See merge request gitlab-org/gitlab!37949
parents 729db3e0 d367f734
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
GlTooltipDirective, GlTooltipDirective,
GlButton, GlButton,
GlSearchBoxByType, GlSearchBoxByType,
GlIcon,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
...@@ -55,6 +56,7 @@ export default { ...@@ -55,6 +56,7 @@ export default {
GlButton, GlButton,
TimeAgoTooltip, TimeAgoTooltip,
GlSearchBoxByType, GlSearchBoxByType,
GlIcon,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -164,7 +166,15 @@ export default { ...@@ -164,7 +166,15 @@ export default {
@row-clicked="navigateToIncidentDetails" @row-clicked="navigateToIncidentDetails"
> >
<template #cell(title)="{ item }"> <template #cell(title)="{ item }">
<div class="gl-max-w-full text-truncate" :title="item.title">{{ item.title }}</div> <div class="gl-display-flex gl-justify-content-center">
<div class="gl-max-w-full text-truncate" :title="item.title">{{ item.title }}</div>
<gl-icon
v-if="item.state === 'closed'"
name="issue-close"
class="gl-fill-blue-500"
data-testid="incident-closed"
/>
</div>
</template> </template>
<template #cell(createdAt)="{ item }"> <template #cell(createdAt)="{ item }">
......
...@@ -10,6 +10,7 @@ query getIncidents( ...@@ -10,6 +10,7 @@ query getIncidents(
iid iid
title title
createdAt createdAt
state
labels { labels {
nodes { nodes {
title title
......
---
title: Add closed issue icon to incidents list for closed incidents
merge_request: 37949
author:
type: changed
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { visitUrl, joinPaths } from '~/lib/utils/url_utility';
import { GlAlert, GlLoadingIcon, GlTable, GlAvatar, GlSearchBoxByType } from '@gitlab/ui'; import { GlAlert, GlLoadingIcon, GlTable, GlAvatar, GlSearchBoxByType } from '@gitlab/ui';
import { visitUrl, joinPaths } from '~/lib/utils/url_utility';
import IncidentsList from '~/incidents/components/incidents_list.vue'; import IncidentsList from '~/incidents/components/incidents_list.vue';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import { I18N } from '~/incidents/constants'; import { I18N } from '~/incidents/constants';
...@@ -25,6 +25,7 @@ describe('Incidents List', () => { ...@@ -25,6 +25,7 @@ describe('Incidents List', () => {
const findAssingees = () => wrapper.findAll('[data-testid="incident-assignees"]'); const findAssingees = () => wrapper.findAll('[data-testid="incident-assignees"]');
const findCreateIncidentBtn = () => wrapper.find('[data-testid="createIncidentBtn"]'); const findCreateIncidentBtn = () => wrapper.find('[data-testid="createIncidentBtn"]');
const findSearch = () => wrapper.find(GlSearchBoxByType); const findSearch = () => wrapper.find(GlSearchBoxByType);
const findClosedIcon = () => wrapper.findAll("[data-testid='incident-closed']");
function mountComponent({ data = { incidents: [] }, loading = false }) { function mountComponent({ data = { incidents: [] }, loading = false }) {
wrapper = mount(IncidentsList, { wrapper = mount(IncidentsList, {
...@@ -127,6 +128,12 @@ describe('Incidents List', () => { ...@@ -127,6 +128,12 @@ describe('Incidents List', () => {
.trigger('click'); .trigger('click');
expect(visitUrl).toHaveBeenCalledWith(joinPaths(`/project/isssues/`, mockIncidents[0].iid)); expect(visitUrl).toHaveBeenCalledWith(joinPaths(`/project/isssues/`, mockIncidents[0].iid));
}); });
it('renders a closed icon for closed incidents', () => {
expect(findClosedIcon().length).toBe(
mockIncidents.filter(({ state }) => state === 'closed').length,
);
});
}); });
}); });
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"iid": "15", "iid": "15",
"title": "New: Incident", "title": "New: Incident",
"createdAt": "2020-06-03T15:46:08Z", "createdAt": "2020-06-03T15:46:08Z",
"assignees": {} "assignees": {},
"state": "opened"
}, },
{ {
"iid": "14", "iid": "14",
...@@ -18,18 +19,21 @@ ...@@ -18,18 +19,21 @@
"webUrl": "https://invalid" "webUrl": "https://invalid"
} }
] ]
} },
"state": "opened"
}, },
{ {
"iid": "13", "iid": "13",
"title": "Create issue3", "title": "Create issue3",
"createdAt": "2020-05-19T08:53:55Z", "createdAt": "2020-05-19T08:53:55Z",
"assignees": {} "assignees": {},
"state": "closed"
}, },
{ {
"iid": "12", "iid": "12",
"title": "Create issue2", "title": "Create issue2",
"createdAt": "2020-05-18T17:13:35Z", "createdAt": "2020-05-18T17:13:35Z",
"assignees": {} "assignees": {},
"state": "closed"
} }
] ]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment