Commit 5ee505e4 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch '227321-use-gk-icon-in-alert-system-note' into 'master'

Use gl-icon component for alert system notes

See merge request gitlab-org/gitlab!42604
parents 9fad3ac5 1c78a3cf
<script> <script>
/* eslint-disable vue/no-v-html */ /* eslint-disable vue/no-v-html */
import { GlIcon } from '@gitlab/ui';
import NoteHeader from '~/notes/components/note_header.vue'; import NoteHeader from '~/notes/components/note_header.vue';
import { spriteIcon } from '~/lib/utils/common_utils';
export default { export default {
components: { components: {
NoteHeader, NoteHeader,
GlIcon,
}, },
props: { props: {
note: { note: {
...@@ -24,23 +25,23 @@ export default { ...@@ -24,23 +25,23 @@ export default {
} = this.note; } = this.note;
return { ...author, id: id?.split('/').pop() }; return { ...author, id: id?.split('/').pop() };
}, },
iconHtml() {
return spriteIcon(this.note?.systemNoteIconName);
},
}, },
}; };
</script> </script>
<template> <template>
<li :id="noteAnchorId" class="timeline-entry note system-note note-wrapper gl-px-0!"> <li :id="noteAnchorId" class="timeline-entry note system-note note-wrapper gl-p-0!">
<div class="timeline-entry-inner"> <div class="gl-display-inline-flex gl-align-items-center">
<div class="timeline-icon" v-html="iconHtml"></div> <div
<div class="timeline-content"> class="gl-display-inline gl-bg-white gl-text-gray-200 gl-border-gray-100 gl-border-1 gl-border-solid gl-rounded-full gl-box-sizing-content-box gl-p-3 gl-mt-n2 gl-mr-6"
<div class="note-header"> >
<note-header :author="noteAuthor" :created-at="note.createdAt" :note-id="note.id"> <gl-icon :name="note.systemNoteIconName" />
<span v-html="note.bodyHtml"></span> </div>
</note-header>
</div> <div class="note-header">
<note-header :author="noteAuthor" :created-at="note.createdAt" :note-id="note.id">
<span v-html="note.bodyHtml"></span>
</note-header>
</div> </div>
</div> </div>
</li> </li>
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
} }
.main-notes-list::before { .main-notes-list::before {
left: 15px !important; left: $gl-spacing-scale-5 !important;
} }
.note-header-info { .note-header-info {
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlIcon } from '@gitlab/ui';
import SystemNote from '~/alert_management/components/system_notes/system_note.vue'; import SystemNote from '~/alert_management/components/system_notes/system_note.vue';
import mockAlerts from '../../mocks/alerts.json'; import mockAlerts from '../../mocks/alerts.json';
...@@ -19,6 +20,7 @@ describe('Alert Details System Note', () => { ...@@ -19,6 +20,7 @@ describe('Alert Details System Note', () => {
afterEach(() => { afterEach(() => {
if (wrapper) { if (wrapper) {
wrapper.destroy(); wrapper.destroy();
wrapper = null;
} }
}); });
...@@ -29,10 +31,10 @@ describe('Alert Details System Note', () => { ...@@ -29,10 +31,10 @@ describe('Alert Details System Note', () => {
it('renders the correct system note', () => { it('renders the correct system note', () => {
const noteId = wrapper.find('.note-wrapper').attributes('id'); const noteId = wrapper.find('.note-wrapper').attributes('id');
const iconRoute = wrapper.find('use').attributes('href'); const iconName = wrapper.find(GlIcon).attributes('name');
expect(noteId).toBe('note_1628'); expect(noteId).toBe('note_1628');
expect(iconRoute.includes('user')).toBe(true); expect(iconName).toBe(mockAlert.notes.nodes[0].systemNoteIconName);
}); });
}); });
}); });
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