Commit 46a6036c authored by Mayra Cabrera's avatar Mayra Cabrera

Addreses frontend review

Also fixes spec failures on presenter and docs
parent 560ed922
...@@ -299,7 +299,8 @@ ...@@ -299,7 +299,8 @@
margin-left: 5px; margin-left: 5px;
} }
.help-block { .deploy-token-help-block {
margin-top: 4px; display: block;
margin-bottom: 0;
} }
} }
...@@ -44,8 +44,8 @@ module Projects ...@@ -44,8 +44,8 @@ module Projects
def scope_descriptions def scope_descriptions
{ {
'read_repo' => 'Allows read-only access to the repository', 'read_repo' => s_('Allows read-only access to the repository'),
'read_registry' => 'Allows read-only access to the registry images' 'read_registry' => s_('Allows read-only access to the registry images')
} }
end end
......
%p.profile-settings-content %p.profile-settings-content
Pick a name for the application, and we'll give you a unique deploy token. = s_("Pick a name for the application, and we'll give you a unique deploy token.")
= form_for token, url: project_deploy_tokens_path(project), method: :post do |f| = form_for token, url: project_deploy_tokens_path(project), method: :post do |f|
= form_errors(token) = form_errors(token)
.form-group .form-group
= f.label :name, class: 'label-light' = f.label :name, class: 'label-light'
= f.text_field :name, class: "form-control", required: true = f.text_field :name, class: 'form-control', required: true
.form-group .form-group
= f.label :expires_at, class: 'label-light' = f.label :expires_at, class: 'label-light'
= f.text_field :expires_at, class: "datepicker form-control" = f.text_field :expires_at, class: 'datepicker form-control'
.form-group .form-group
= f.label :scopes, class: 'label-light' = f.label :scopes, class: 'label-light'
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
= render 'projects/deploy_tokens/scope_form', token: token, scope: scope, presenter: presenter = render 'projects/deploy_tokens/scope_form', token: token, scope: scope, presenter: presenter
.prepend-top-default .prepend-top-default
= f.submit "Create deploy token", class: "btn btn-create" = f.submit s_('Create deploy token'), class: 'btn btn-success'
...@@ -2,18 +2,17 @@ ...@@ -2,18 +2,17 @@
%section.settings.no-animate{ class: ('expanded' if expanded) } %section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4= s_('Deploy Tokens')
Deploy Tokens %button.btn.js-settings-toggle.qa-expand-deploy-keys{ type: 'button' }
%button.btn.js-settings-toggle.qa-expand-deploy-keys
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
Deploy tokens allow read-only access to your repository and registry images. = s_('Deploy tokens allow read-only access to your repository and registry images.')
.settings-content .settings-content
- if @deploy_tokens.temporal_token - if @deploy_tokens.temporal_token
= render 'projects/deploy_tokens/new_deploy_token', new_token: @deploy_tokens.temporal_token = render 'projects/deploy_tokens/new_deploy_token', new_token: @deploy_tokens.temporal_token
%h5.prepend-top-0 %h5.prepend-top-0
Add a deploy token = s_('Add a deploy token')
= render 'projects/deploy_tokens/form', project: @project, token: @deploy_token, presenter: @deploy_tokens = render 'projects/deploy_tokens/form', project: @project, token: @deploy_token, presenter: @deploy_tokens
%hr %hr
= render 'projects/deploy_tokens/table', project: @project, active_tokens: @deploy_tokens = render 'projects/deploy_tokens/table', project: @project, active_tokens: @deploy_tokens
.created-deploy-token-container .created-deploy-token-container
%h5.prepend-top-0 %h5.prepend-top-0
Your New Deploy Token = s_('Your New Deploy Token')
.form-group .form-group
= text_field_tag 'deploy-token', new_token, readonly: true, class: "deploy-token-field form-control js-select-on-focus", 'aria-describedby' => "deploy-token-help-block" = text_field_tag 'deploy-token', new_token, readonly: true, class: 'deploy-token-field form-control js-select-on-focus'
= clipboard_button(text: new_token, title: "Copy deploy token to clipboard", placement: "left") = clipboard_button(text: new_token, title: s_('Copy deploy token to clipboard'), placement: 'left')
%span.deploy-token.help-block.text-danger Make sure you save it - you won't be able to access it again. %span.deploy-token-help-block.prepend-top-5.text-danger= s_("Make sure you save it - you won't be able to access it again.")
%hr %hr
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
%h4.modal-title.pull-left %h4.modal-title.pull-left
Revoke Revoke
%b #{token.name}? %b #{token.name}?
%button.close.pull-right{ "aria-label" => "Close", data: { dismiss: "modal"} } %button.close{ 'aria-label' => 'Close', 'data-dismiss' => 'modal', type: 'button' }
%span{ "aria-hidden" => "true" } × %span{ 'aria-hidden' => 'true' } ×
.modal-body .modal-body
%p %p
You are about to revoke = s_('You are about to revoke')
%b #{token.name}. %b #{token.name}.
This action cannot be undone. = s_('This action cannot be undone.')
.modal-footer .modal-footer
%a{ href: '#', data: { dismiss: 'modal' }, class: 'btn btn-default' } Cancel %a{ href: '#', data: { dismiss: 'modal' }, class: 'btn btn-default' }= s_('Cancel')
= link_to "Revoke #{token.name}", revoke_project_deploy_token_path(project, token), method: :put, class: 'btn btn-danger' = link_to "Revoke #{token.name}", revoke_project_deploy_token_path(project, token), method: :put, class: 'btn btn-danger'
...@@ -37,7 +37,7 @@ the following table. ...@@ -37,7 +37,7 @@ the following table.
| Scope | Description | | Scope | Description |
| ----- | ----------- | | ----- | ----------- |
|`read_repo` | Allows read-access to the repository through `git clone` | |`read_repo` | Allows read-access to the repository through `git clone` |
| `read_registry` | Allows read-access to[container registry] images if a project is private and authorization is required. | | `read_registry` | Allows read-access to [container registry] images if a project is private and authorization is required. |
## Usage ## Usage
...@@ -69,4 +69,4 @@ Just replace `<username>` and `<deploy_token>` with the proper values. ...@@ -69,4 +69,4 @@ Just replace `<username>` and `<deploy_token>` with the proper values.
[ce-17894]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17894 [ce-17894]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17894
[ce-11845]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11845 [ce-11845]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11845
[container registry]: ../project/container_registry.md [container registry]: ../container_registry.md
...@@ -28,18 +28,18 @@ describe Projects::Settings::DeployTokensPresenter do ...@@ -28,18 +28,18 @@ describe Projects::Settings::DeployTokensPresenter do
end end
end end
describe '#new_deploy_token' do describe '#temporal_token' do
context 'when a deploy token has been created recently' do context 'when a deploy token has been created recently' do
it 'returns the token of the deploy' do it 'returns the token of the deploy' do
deploy_token = ::DeployTokens::CreateService.new(project, user, attributes_for(:deploy_token)).execute deploy_token = ::DeployTokens::CreateService.new(project, user, attributes_for(:deploy_token)).execute
expect(presenter.new_deploy_token).to eq(deploy_token.token) expect(presenter.temporal_token).to eq(deploy_token.token)
end end
end end
context 'when a deploy token has not been created recently' do context 'when a deploy token has not been created recently' do
it 'does returns nil' do it 'does returns nil' do
expect(presenter.new_deploy_token).to be_nil expect(presenter.temporal_token).to be_nil
end end
end end
end end
......
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