提交 46a6036c 编写于 作者: M Mayra Cabrera

Addreses frontend review

Also fixes spec failures on presenter and docs
上级 560ed922
......@@ -299,7 +299,8 @@
margin-left: 5px;
}
.help-block {
margin-top: 4px;
.deploy-token-help-block {
display: block;
margin-bottom: 0;
}
}
......@@ -44,8 +44,8 @@ module Projects
def scope_descriptions
{
'read_repo' => 'Allows read-only access to the repository',
'read_registry' => 'Allows read-only access to the registry images'
'read_repo' => s_('Allows read-only access to the repository'),
'read_registry' => s_('Allows read-only access to the registry images')
}
end
......
%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_errors(token)
.form-group
= 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
= 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
= f.label :scopes, class: 'label-light'
......@@ -18,4 +18,4 @@
= render 'projects/deploy_tokens/scope_form', token: token, scope: scope, presenter: presenter
.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 @@
%section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4
Deploy Tokens
%button.btn.js-settings-toggle.qa-expand-deploy-keys
%h4= s_('Deploy Tokens')
%button.btn.js-settings-toggle.qa-expand-deploy-keys{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%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
- if @deploy_tokens.temporal_token
= render 'projects/deploy_tokens/new_deploy_token', new_token: @deploy_tokens.temporal_token
%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
%hr
= render 'projects/deploy_tokens/table', project: @project, active_tokens: @deploy_tokens
.created-deploy-token-container
%h5.prepend-top-0
Your New Deploy Token
= s_('Your New Deploy Token')
.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"
= clipboard_button(text: new_token, title: "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.
= 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: s_('Copy deploy token to clipboard'), placement: 'left')
%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
......@@ -5,13 +5,13 @@
%h4.modal-title.pull-left
Revoke
%b #{token.name}?
%button.close.pull-right{ "aria-label" => "Close", data: { dismiss: "modal"} }
%span{ "aria-hidden" => "true" } ×
%button.close{ 'aria-label' => 'Close', 'data-dismiss' => 'modal', type: 'button' }
%span{ 'aria-hidden' => 'true' } ×
.modal-body
%p
You are about to revoke
= s_('You are about to revoke')
%b #{token.name}.
This action cannot be undone.
= s_('This action cannot be undone.')
.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'
......@@ -37,7 +37,7 @@ the following table.
| Scope | Description |
| ----- | ----------- |
|`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
......@@ -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-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
end
end
describe '#new_deploy_token' do
describe '#temporal_token' do
context 'when a deploy token has been created recently' do
it 'returns the token of the deploy' do
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
context 'when a deploy token has not been created recently' do
it 'does returns nil' do
expect(presenter.new_deploy_token).to be_nil
expect(presenter.temporal_token).to be_nil
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册