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

63 lines
2.7 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)
2021-09-30 23:02:18 +05:30
- project = local_assigns.fetch(:project, false)
- personal = !impersonation && !project
2020-05-24 23:13:21 +05:30
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 }
2021-10-27 15:23:28 +05:30
2021-09-30 23:02:18 +05:30
- if personal && !personal_access_token_expiration_enforced?
%p.profile-settings-content
= _("Personal access tokens are not revoked upon expiration.")
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
2021-10-27 15:23:28 +05:30
- if personal
= render_if_exists 'profiles/personal_access_tokens/token_expiry_notification', active_tokens: active_tokens
2017-08-17 22:00:37 +05:30
- if active_tokens.present?
.table-responsive
%table.table.active-tokens
%thead
%tr
2021-09-30 23:02:18 +05:30
%th= _('Token name')
%th= _('Scopes')
2019-09-30 21:07:59 +05:30
%th= s_('AccessTokens|Created')
2020-07-28 23:09:34 +05:30
%th
= _('Last Used')
2021-06-08 01:23:25 +05:30
= link_to sprite_icon('question-o'), help_page_path('user/profile/personal_access_tokens.md', anchor: 'view-the-last-time-a-token-was-used'), target: '_blank'
2019-09-30 21:07:59 +05:30
%th= _('Expires')
2021-09-30 23:02:18 +05:30
- if project
%th= _('Role')
2017-08-17 22:00:37 +05:30
%th
%tbody
- active_tokens.each do |token|
%tr
%td= token.name
2021-09-30 23:02:18 +05:30
%td= token.scopes.present? ? token.scopes.join(', ') : _('no scopes selected')
2017-08-17 22:00:37 +05:30
%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?
2021-10-27 15:23:28 +05:30
- if token.expired? || token.expired_but_not_enforced?
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?) }
2021-11-11 11:23:49 +05:30
= time_ago_with_tooltip(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-09-30 23:02:18 +05:30
- if project
%td= project.project_member(token.user).human_access
%td= link_to _('Revoke'), revoke_route_helper.call(token), method: :put, class: "gl-button btn btn-danger btn-sm float-right qa-revoke-button #{'btn-danger-secondary' unless token.expires?}", 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