debian-mirror-gitlab/app/views/shared/access_tokens/_table.html.haml

50 lines
2.2 KiB
Text
Raw Normal View History

2020-05-24 23:13:21 +05:30
- no_active_tokens_message = local_assigns.fetch(:no_active_tokens_message, _('This user has no active %{type}.') % { type: type_plural })
- impersonation = local_assigns.fetch(:impersonation, false)
2017-08-17 22:00:37 +05:30
%hr
2019-09-30 21:07:59 +05:30
%h5
2020-05-24 23:13:21 +05:30
= _('Active %{type} (%{token_length})') % { type: type_plural, token_length: active_tokens.length }
2017-08-17 22:00:37 +05:30
- if impersonation
%p.profile-settings-content
2019-09-30 21:07:59 +05:30
= _("To see all the user's personal access tokens you must impersonate them first.")
2017-08-17 22:00:37 +05:30
- if active_tokens.present?
.table-responsive
%table.table.active-tokens
%thead
%tr
2019-09-30 21:07:59 +05:30
%th= _('Name')
%th= s_('AccessTokens|Created')
2020-07-28 23:09:34 +05:30
%th
= _('Last Used')
2020-11-24 15:15:51 +05:30
= link_to sprite_icon('question-o'), help_page_path('user/profile/personal_access_tokens.md', anchor: 'token-activity'), target: '_blank'
2019-09-30 21:07:59 +05:30
%th= _('Expires')
%th= _('Scopes')
2017-08-17 22:00:37 +05:30
%th
%tbody
- active_tokens.each do |token|
%tr
%td= token.name
%td= token.created_at.to_date.to_s(:medium)
2020-07-28 23:09:34 +05:30
%td
- if token.last_used_at?
%span.token-last-used-label= _(time_ago_with_tooltip(token.last_used_at))
- else
%span.token-never-used-label= _('Never')
2017-08-17 22:00:37 +05:30
%td
- if token.expires?
2020-07-28 23:09:34 +05:30
- if token.expires_at.past? || token.expires_at.today?
2020-11-24 15:15:51 +05:30
%span{ class: 'text-danger has-tooltip', title: _('Token valid until revoked') }
2020-07-28 23:09:34 +05:30
= _('Expired')
- else
%span{ class: ('text-warning' if token.expires_soon?) }
= _('In %{time_to_now}') % { time_to_now: distance_of_time_in_words_to_now(token.expires_at) }
2017-08-17 22:00:37 +05:30
- else
2019-09-30 21:07:59 +05:30
%span.token-never-expires-label= _('Never')
2021-02-22 17:27:13 +05:30
%td= token.scopes.present? ? token.scopes.join(', ') : _('no scopes selected')
2020-05-24 23:13:21 +05:30
%td= link_to _('Revoke'), revoke_route_helper.call(token), method: :put, class: 'btn btn-danger float-right qa-revoke-button', data: { confirm: _('Are you sure you want to revoke this %{type}? This action cannot be undone.') % { type: type } }
2017-08-17 22:00:37 +05:30
- else
.settings-message.text-center
2020-05-24 23:13:21 +05:30
= no_active_tokens_message