debian-mirror-gitlab/app/views/shared/_personal_access_tokens_table.html.haml

37 lines
1.6 KiB
Text
Raw Normal View History

2019-09-30 21:07:59 +05:30
- type = impersonation ? s_('Profiles|Impersonation') : s_('Profiles|Personal Access')
2017-08-17 22:00:37 +05:30
%hr
2019-09-30 21:07:59 +05:30
%h5
= _('Active %{type} Tokens (%{token_length})') % { type: type, 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')
%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)
%td
- if token.expires?
%span{ class: ('text-warning' if token.expires_soon?) }
In #{distance_of_time_in_words_to_now(token.expires_at)}
- else
2019-09-30 21:07:59 +05:30
%span.token-never-expires-label= _('Never')
%td= token.scopes.present? ? token.scopes.join(", ") : _('<no scopes selected>')
2017-08-17 22:00:37 +05:30
- path = impersonation ? revoke_admin_user_impersonation_token_path(token.user, token) : revoke_profile_personal_access_token_path(token)
2019-09-30 21:07:59 +05:30
%td= link_to _('Revoke'), path, method: :put, class: "btn btn-danger float-right qa-revoke-button", data: { confirm: _('Are you sure you want to revoke this %{type} Token? This action cannot be undone.') % { type: type } }
2017-08-17 22:00:37 +05:30
- else
.settings-message.text-center
2019-09-30 21:07:59 +05:30
= _('This user has no active %{type} Tokens.') % { type: type }