Commit 53180d13 authored by Austin Regnery's avatar Austin Regnery Committed by Olena Horal-Koretska

Relabel access token fields

Changelog: changed
parent 853aafad
......@@ -19,7 +19,8 @@
path: admin_user_impersonation_tokens_path,
impersonation: true,
token: @impersonation_token,
scopes: @scopes
scopes: @scopes,
help_path: help_page_path('api/README', anchor: 'impersonation-tokens')
= render 'shared/access_tokens/table',
type: type,
......
......@@ -24,7 +24,8 @@
type: type,
path: profile_personal_access_tokens_path,
token: @personal_access_token,
scopes: @scopes
scopes: @scopes,
help_path: help_page_path('user/profile/personal_access_tokens.md', anchor: 'personal-access-token-scopes')
= render 'shared/access_tokens/table',
type: type,
......
......@@ -35,7 +35,8 @@
path: project_settings_access_tokens_path(@project),
token: @project_access_token,
scopes: @scopes,
prefix: :project_access_token
prefix: :project_access_token,
help_path: help_page_path('user/project/settings/project_access_tokens', anchor: 'limiting-scopes-of-a-project-access-token')
= render 'shared/access_tokens/table',
active_tokens: @active_project_access_tokens,
......
- title = local_assigns.fetch(:title, _('Add a %{type}') % { type: type })
- prefix = local_assigns.fetch(:prefix, :personal_access_token)
- help_path = local_assigns.fetch(:help_path)
%h5.gl-mt-0
= title
......@@ -11,13 +12,16 @@
= form_errors(token)
.row
.form-group.col-md-6
= f.label :name, _('Name'), class: 'label-bold'
= f.text_field :name, class: 'form-control gl-form-input', required: true, data: { qa_selector: 'access_token_name_field' }
.form-group.col
.row
= f.label :name, _('Token name'), class: 'label-bold col-md-12'
.col-md-6
= f.text_field :name, class: 'form-control gl-form-input', required: true, data: { qa_selector: 'access_token_name_field' }, :'aria-describedby' => 'access_token_help_text'
%span.form-text.text-muted.col-md-12#access_token_help_text= _('For example, the application using the token or the purpose of the token.')
.row
.form-group.col-md-6
= f.label :expires_at, _('Expires at'), class: 'label-bold'
= f.label :expires_at, _('Expiration date'), class: 'label-bold'
.input-icon-wrapper
= render_if_exists 'personal_access_tokens/callout_max_personal_access_token_lifetime'
......@@ -26,7 +30,11 @@
= f.text_field :expires_at, class: 'datepicker gl-datepicker-input form-control gl-form-input', placeholder: 'YYYY-MM-DD', autocomplete: 'off', data: { js_name: 'expiresAt' }
.form-group
= f.label :scopes, _('Scopes'), class: 'label-bold'
%b{ :'aria-describedby' => 'select_scope_help_text' }
= s_('Tokens|Select scopes')
%p.text-secondary#select_scope_help_text
= s_('Tokens|Scopes set the permission levels granted to the token.')
= link_to "Learn more.", help_path, target: '_blank'
= render 'shared/tokens/scopes_form', prefix: prefix, token: token, scopes: scopes
- if prefix == :personal_access_token && Feature.enabled?(:personal_access_tokens_scoped_to_projects, current_user)
......
......@@ -14,7 +14,7 @@
%table.table.active-tokens
%thead
%tr
%th= _('Name')
%th= _('Token name')
%th= s_('AccessTokens|Created')
%th
= _('Last Used')
......
......@@ -13326,9 +13326,6 @@ msgstr ""
msgid "Expires"
msgstr ""
msgid "Expires at"
msgstr ""
msgid "Expires at (optional)"
msgstr ""
......@@ -14269,6 +14266,9 @@ msgstr ""
msgid "For each job, re-use the project workspace. If the workspace doesn't exist, use %{code_open}git clone%{code_close}."
msgstr ""
msgid "For example, the application using the token or the purpose of the token."
msgstr ""
msgid "For general work"
msgstr ""
......@@ -34291,9 +34291,18 @@ msgstr ""
msgid "Token"
msgstr ""
msgid "Token name"
msgstr ""
msgid "Token valid until revoked"
msgstr ""
msgid "Tokens|Scopes set the permission levels granted to the token."
msgstr ""
msgid "Tokens|Select scopes"
msgstr ""
msgid "Tomorrow"
msgstr ""
......
......@@ -28,10 +28,10 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do
name = 'Hello World'
visit admin_user_impersonation_tokens_path(user_id: user.username)
fill_in "Name", with: name
fill_in "Token name", with: name
# Set date to 1st of next month
find_field("Expires at").click
find_field("Expiration date").click
find(".pika-next").click
click_on "1"
......
......@@ -42,10 +42,10 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
name = 'My PAT'
visit profile_personal_access_tokens_path
fill_in "Name", with: name
fill_in "Token name", with: name
# Set date to 1st of next month
find_field("Expires at").click
find_field("Expiration date").click
find(".pika-next").click
click_on "1"
......@@ -66,7 +66,7 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
it "displays an error message" do
disallow_personal_access_token_saves!
visit profile_personal_access_tokens_path
fill_in "Name", with: 'My PAT'
fill_in "Token name", with: 'My PAT'
expect { click_on "Create personal access token" }.not_to change { PersonalAccessToken.count }
expect(page).to have_content("Name cannot be nil")
......
......@@ -51,10 +51,10 @@ RSpec.describe 'Project > Settings > Access Tokens', :js do
name = 'My project access token'
visit project_settings_access_tokens_path(project)
fill_in 'Name', with: name
fill_in 'Token name', with: name
# Set date to 1st of next month
find_field('Expires at').click
find_field('Expiration date').click
find('.pika-next').click
click_on '1'
......
......@@ -39,7 +39,7 @@ RSpec.describe 'User searches project settings', :js do
visit project_settings_access_tokens_path(project)
end
it_behaves_like 'can highlight results', 'Expires at'
it_behaves_like 'can highlight results', 'Expiration date'
end
context 'in Repository page' do
......
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