Commit ac6c128d authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch 'ar-update-labels-to-be-descriptive' into 'master'

Relabel access token fields

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