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>
/* eslint-disable vue/no-v-html */
import { GlIcon } from '@gitlab/ui';
import NoteHeader from '~/notes/components/note_header.vue';
import { spriteIcon } from '~/lib/utils/common_utils';
export default {
components: {
NoteHeader,
GlIcon,
},
props: {
note: {
......@@ -24,24 +25,24 @@ export default {
} = this.note;
return { ...author, id: id?.split('/').pop() };
},
iconHtml() {
return spriteIcon(this.note?.systemNoteIconName);
},
},
};
</script>
<template>
<li :id="noteAnchorId" class="timeline-entry note system-note note-wrapper gl-px-0!">
<div class="timeline-entry-inner">
<div class="timeline-icon" v-html="iconHtml"></div>
<div class="timeline-content">
<li :id="noteAnchorId" class="timeline-entry note system-note note-wrapper gl-p-0!">
<div class="gl-display-inline-flex gl-align-items-center">
<div
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"
>
<gl-icon :name="note.systemNoteIconName" />
</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>
</li>
</template>
......@@ -33,7 +33,7 @@
}
.main-notes-list::before {
left: 15px !important;
left: $gl-spacing-scale-5 !important;
}
.note-header-info {
......
import { shallowMount } from '@vue/test-utils';
import { GlIcon } from '@gitlab/ui';
import SystemNote from '~/alert_management/components/system_notes/system_note.vue';
import mockAlerts from '../../mocks/alerts.json';
......@@ -19,6 +20,7 @@ describe('Alert Details System Note', () => {
afterEach(() => {
if (wrapper) {
wrapper.destroy();
wrapper = null;
}
});
......@@ -29,10 +31,10 @@ describe('Alert Details System Note', () => {
it('renders the correct system note', () => {
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(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