Commit d31dc22d authored by Illya Klymov's avatar Illya Klymov Committed by Filipa Lacerda

Make audit events table responsive

Refactor audit events table to gl-responsive-table
This allows to utilize existing breakpoints in project
parent 8de65e70
---
title: Added responsiveness to audit events table
merge_request: 18859
author:
type: added
- if defined?(events) - if defined?(events)
%table.table#audits .audit-table#audits
%thead .gl-responsive-table-row.table-row-header{ role: 'row' }
%tr .table-section.section-15{ role: 'rowheader' }
%th Author = _('Author')
%th Action .table-section.section-50{ role: 'rowheader' }
%th Target = s_('AuditEvents|Action')
%th At .table-section.section-15{ role: 'rowheader' }
= s_('AuditEvents|Target')
%tbody .table-section.section-20{ role: 'rowheader' }
= s_('AuditEvents|At')
- events.each do |event| - events.each do |event|
%tr .gl-responsive-table-row
%td .table-section.section-15
.table-mobile-header{ role: 'rowheader' }
= _('Author')
.table-mobile-content
- if event.author_name - if event.author_name
#{event.author_name} = event.author_name
- else - else
(removed) = s_('AuditEvents|(removed)')
%td .table-section.section-50.flex-truncate-parent.audit-action.js-audit-action
%span= sanitize(human_text(event.details), tags: %w(strong)) %span= sanitize(human_text(event.details), tags: %w(strong))
%td= event.details[:target_details] .table-section.section-15.flex-truncate-parent
%td= event.created_at = event.details[:target_details]
.table-section.section-20
= event.created_at
= paginate events, theme: "gitlab" = paginate events, theme: "gitlab"
...@@ -54,7 +54,7 @@ describe 'Groups > Audit Events', :js do ...@@ -54,7 +54,7 @@ describe 'Groups > Audit Events', :js do
click_link 'Audit Events' click_link 'Audit Events'
page.within('table#audits') do page.within('#audits') do
expect(page).to have_content 'Change access level from developer to maintainer' expect(page).to have_content 'Change access level from developer to maintainer'
expect(page).to have_content(user.name) expect(page).to have_content(user.name)
expect(page).to have_content('Pete') expect(page).to have_content('Pete')
......
...@@ -109,7 +109,7 @@ describe 'Projects > Audit Events', :js do ...@@ -109,7 +109,7 @@ describe 'Projects > Audit Events', :js do
click_link 'Audit Events' click_link 'Audit Events'
page.within('table#audits') do page.within('#audits') do
expect(page).to have_content 'Change access level from developer to maintainer' expect(page).to have_content 'Change access level from developer to maintainer'
expect(page).to have_content(project.owner.name) expect(page).to have_content(project.owner.name)
expect(page).to have_content('Pete') expect(page).to have_content('Pete')
......
...@@ -28,7 +28,7 @@ shared_examples 'audit event contains custom message' do ...@@ -28,7 +28,7 @@ shared_examples 'audit event contains custom message' do
let(:custom_message) { 'Message <strong>with</strong> <i>deleted</i> tags' } let(:custom_message) { 'Message <strong>with</strong> <i>deleted</i> tags' }
it 'allows only <strong> tag' do it 'allows only <strong> tag' do
message_row = find('td', text: 'Message with deleted tags') message_row = find('.js-audit-action', text: 'Message with deleted tags')
expect(message_row).to have_selector('strong') expect(message_row).to have_selector('strong')
expect(message_row).to have_no_selector('i') expect(message_row).to have_no_selector('i')
......
...@@ -2179,6 +2179,18 @@ msgstr "" ...@@ -2179,6 +2179,18 @@ msgstr ""
msgid "Audit Events is a way to keep track of important events that happened in GitLab." msgid "Audit Events is a way to keep track of important events that happened in GitLab."
msgstr "" msgstr ""
msgid "AuditEvents|(removed)"
msgstr ""
msgid "AuditEvents|Action"
msgstr ""
msgid "AuditEvents|At"
msgstr ""
msgid "AuditEvents|Target"
msgstr ""
msgid "Aug" msgid "Aug"
msgstr "" msgstr ""
......
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