Commit b1072b3f authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '352358-project-access-tokens-frontend' into 'master'

Fix layout issues for project tokens in credentials inventory

See merge request gitlab-org/gitlab!80273
parents bcf42ad0 308c4bac
.table-holder .table-holder
.thead-white.gl-white-space-nowrap.gl-responsive-table-row.table-row-header{ role: 'row' } .thead-white.gl-white-space-nowrap.gl-responsive-table-row.table-row-header{ role: 'row' }
.table-section.section-10{ role: 'rowheader' }= _('Name') .table-section.section-10{ role: 'rowheader' }= _('Name')
.table-section.section-10{ role: 'rowheader' }= _('Scopes') .table-section.section-15{ role: 'rowheader' }= _('Scopes')
.table-section.section-15{ role: 'rowheader' }= _('Project') .table-section.section-15{ role: 'rowheader' }= _('Project')
.table-section.section-20{ role: 'rowheader' }= _('Creator') .table-section.section-20{ role: 'rowheader' }= _('Creator')
.table-section.section-15{ role: 'rowheader' }= _('Created on') .table-section.section-10{ role: 'rowheader' }= _('Created on')
.table-section.section-10{ role: 'rowheader' }= _('Last used') .table-section.section-10{ role: 'rowheader' }= _('Last used')
.table-section.section-10{ role: 'rowheader' }= _('Expires') .table-section.section-10{ role: 'rowheader' }= _('Expires')
.table-section.section-10{ role: 'rowheader' }= _('Revoke')
= render partial: 'shared/credentials_inventory/project_access_tokens/project_access_token', collection: credentials = render partial: 'shared/credentials_inventory/project_access_tokens/project_access_token', collection: credentials
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
.table-section.section-10 .table-section.section-10
.table-mobile-header{ role: 'rowheader' } .table-mobile-header{ role: 'rowheader' }
= _('Name') = _('Name')
.table-mobile-content .table-mobile-content.gl-white-space-normal.gl-word-break-word.gl-pr-5
= project_access_token.name = project_access_token.name
.table-section.section-10 .table-section.section-15
.table-mobile-header{ role: 'rowheader' } .table-mobile-header{ role: 'rowheader' }
= _('Scopes') = _('Scopes')
.table-mobile-content.gl-white-space-normal .table-mobile-content.gl-white-space-normal
...@@ -14,30 +14,29 @@ ...@@ -14,30 +14,29 @@
.table-section.section-15 .table-section.section-15
.table-mobile-header{ role: 'rowheader' } .table-mobile-header{ role: 'rowheader' }
= _('Project') = _('Project')
.table-mobile-content .table-mobile-content.gl-white-space-normal.gl-word-break-word.gl-pr-5
= link_to project.name, project.full_path = link_to project.name, project_url(project)
.table-section.section-20 .table-section.section-20
.table-mobile-header{ role: 'rowheader' } .table-mobile-header{ role: 'rowheader' }
= _('Creator') = _('Creator')
.table-mobile-content .table-mobile-content
= render 'shared/credentials_inventory/users/user_detail', user: project_access_token.user.created_by = render 'shared/credentials_inventory/users/user_detail', user: project_access_token.user.created_by
.table-section.section-15 .table-section.section-10
.table-mobile-header{ role: 'rowheader' } .table-mobile-header{ role: 'rowheader' }
= _('Created on') = _('Created on')
.table-mobile-content .table-mobile-content
= project_access_token.created_at = project_access_token.created_at&.to_date
.table-section.section-10 .table-section.section-10
.table-mobile-header{ role: 'rowheader' } .table-mobile-header{ role: 'rowheader' }
= _('Last used') = _('Last used')
.table-mobile-content .table-mobile-content
= project_access_token.last_used_at || _('Never') = project_access_token.last_used_at&.to_date || _('Never')
.table-section.section-10 .table-section.section-10
.table-mobile-header{ role: 'rowheader' } .table-mobile-header{ role: 'rowheader' }
= _('Expires') = _('Expires')
.table-mobile-content .table-mobile-content
= project_access_token.expires_at || _('Never') = project_access_token.expires_at&.to_date || _('Never')
.table-section.section-10 .table-section.section-10
.table-mobile-header{ role: 'rowheader' } .table-mobile-header{ role: 'rowheader' }
= _('Revoke')
.table-mobile-content .table-mobile-content
= link_to _('Revoke'), admin_credential_project_revoke_path(credential_id: project_access_token, project_id: project.id), method: :put, data: { confirm: _('Are you sure you want to revoke this project access token? This action cannot be undone.') }, class: 'btn btn-danger btn-danger-secondary btn-md btn-secondary gl-button' = link_to _('Revoke'), admin_credential_project_revoke_path(credential_id: project_access_token, project_id: project.id), method: :put, data: { confirm: _('Are you sure you want to revoke this project access token? This action cannot be undone.') }, class: 'btn btn-danger btn-danger-secondary btn-md btn-secondary gl-button'
...@@ -32,7 +32,7 @@ RSpec.describe('shared/credentials_inventory/personal_access_tokens/_project_acc ...@@ -32,7 +32,7 @@ RSpec.describe('shared/credentials_inventory/personal_access_tokens/_project_acc
end end
it 'shows the created date' do it 'shows the created date' do
expect(rendered).to have_text(project_access_token.created_at.to_s) expect(rendered).to have_text(project_access_token.created_at.to_date)
end end
context 'last used date' do context 'last used date' do
...@@ -48,7 +48,7 @@ RSpec.describe('shared/credentials_inventory/personal_access_tokens/_project_acc ...@@ -48,7 +48,7 @@ RSpec.describe('shared/credentials_inventory/personal_access_tokens/_project_acc
let_it_be(:project_access_token) { create(:personal_access_token, user: project_member.user, scopes: %w(read_repository api), last_used_at: DateTime.new(2001, 2, 3, 4, 5, 6)) } let_it_be(:project_access_token) { create(:personal_access_token, user: project_member.user, scopes: %w(read_repository api), last_used_at: DateTime.new(2001, 2, 3, 4, 5, 6)) }
it 'displays the time last used' do it 'displays the time last used' do
expect(rendered).to have_text('2001-02-03 04:05:06 UTC') expect(rendered).to have_text('2001-02-03')
end end
end end
end end
...@@ -66,7 +66,7 @@ RSpec.describe('shared/credentials_inventory/personal_access_tokens/_project_acc ...@@ -66,7 +66,7 @@ RSpec.describe('shared/credentials_inventory/personal_access_tokens/_project_acc
let_it_be(:project_access_token) { create(:personal_access_token, user: project_member.user, scopes: %w(read_repository api), last_used_at: DateTime.new(2004, 2, 3, 4, 5, 6)) } let_it_be(:project_access_token) { create(:personal_access_token, user: project_member.user, scopes: %w(read_repository api), last_used_at: DateTime.new(2004, 2, 3, 4, 5, 6)) }
it 'displays the expiration date' do it 'displays the expiration date' do
expect(rendered).to have_text('2004-02-03 04:05:06 UTC') expect(rendered).to have_text('2004-02-03')
end end
end end
end end
......
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