diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-04-06 00:07:36 +0200 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-06 21:20:16 -0500 |
commit | 2c6c61815edada16c4477c938209c24c647e1798 (patch) | |
tree | 1d896b8ac1c5160b33116bc6d60e785df51cce79 /app/views/projects | |
parent | 6b2954ec8a2e17c913872c32386cb2b08f2db1c2 (diff) | |
download | gitlab-ce-2c6c61815edada16c4477c938209c24c647e1798.tar.gz |
Get rid of Redis when dealing with deploy tokens
We use controller actions to pass a newly created token and errors
Diffstat (limited to 'app/views/projects')
4 files changed, 20 insertions, 12 deletions
diff --git a/app/views/projects/deploy_tokens/_form.html.haml b/app/views/projects/deploy_tokens/_form.html.haml index 3e83a2aae46..d027b2ca4b4 100644 --- a/app/views/projects/deploy_tokens/_form.html.haml +++ b/app/views/projects/deploy_tokens/_form.html.haml @@ -1,7 +1,7 @@ %p.profile-settings-content = s_("DeployTokens|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: create_deploy_token_namespace_project_settings_repository_path(project.namespace, project), method: :post do |f| = form_errors(token) .form-group diff --git a/app/views/projects/deploy_tokens/_index.html.haml b/app/views/projects/deploy_tokens/_index.html.haml index 2ef9d1fb4a4..50e5950ced4 100644 --- a/app/views/projects/deploy_tokens/_index.html.haml +++ b/app/views/projects/deploy_tokens/_index.html.haml @@ -1,4 +1,4 @@ -- expanded = expand_deploy_tokens_section?(@deploy_tokens.temporal_token, @deploy_token) +- expanded = expand_deploy_tokens_section?(@new_deploy_token) %section.settings.no-animate{ class: ('expanded' if expanded) } .settings-header @@ -8,11 +8,11 @@ %p = s_('DeployTokens|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 - = s_('DeployTokens|Add a deploy token') - = render 'projects/deploy_tokens/form', project: @project, token: @deploy_token, presenter: @deploy_tokens - %hr + - if @new_deploy_token.persisted? + = render 'projects/deploy_tokens/new_deploy_token', deploy_token: @new_deploy_token + - else + %h5.prepend-top-0 + = s_('DeployTokens|Add a deploy token') + = render 'projects/deploy_tokens/form', project: @project, token: @new_deploy_token, presenter: @deploy_tokens + %hr = render 'projects/deploy_tokens/table', project: @project, active_tokens: @deploy_tokens diff --git a/app/views/projects/deploy_tokens/_new_deploy_token.html.haml b/app/views/projects/deploy_tokens/_new_deploy_token.html.haml index a701817ddab..82268e7900c 100644 --- a/app/views/projects/deploy_tokens/_new_deploy_token.html.haml +++ b/app/views/projects/deploy_tokens/_new_deploy_token.html.haml @@ -1,9 +1,15 @@ .created-deploy-token-container %h5.prepend-top-0 = s_('DeployTokens|Your New Deploy Token') + + .form-group + = text_field_tag 'deploy-token-user', deploy_token.username, readonly: true, class: 'deploy-token-field form-control js-select-on-focus' + = clipboard_button(text: deploy_token.username, title: s_('DeployTokens|Copy deploy token username to clipboard'), placement: 'left') + %span.help-block.prepend-top-5.text-success= s_("DeployTokens|Use this username as a login.") + .form-group - = 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_('DeployTokens|Copy deploy token to clipboard'), placement: 'left') - %span.deploy-token-help-block.prepend-top-5.text-danger= s_("DeployTokens|Make sure you save it - you won't be able to access it again.") + = text_field_tag 'deploy-token', deploy_token.token, readonly: true, class: 'deploy-token-field form-control js-select-on-focus' + = clipboard_button(text: deploy_token.token, title: s_('DeployTokens|Copy deploy token to clipboard'), placement: 'left') + %span.help-block.prepend-top-5.text-danger= s_("DeployTokens|Use this token as a password. Make sure you save it - you won't be able to access it again.") %hr diff --git a/app/views/projects/deploy_tokens/_table.html.haml b/app/views/projects/deploy_tokens/_table.html.haml index 7ef135df0f6..5013a9b250d 100644 --- a/app/views/projects/deploy_tokens/_table.html.haml +++ b/app/views/projects/deploy_tokens/_table.html.haml @@ -6,6 +6,7 @@ %thead %tr %th= s_('DeployTokens|Name') + %th= s_('DeployTokens|Username') %th= s_('DeployTokens|Created') %th= s_('DeployTokens|Expires') %th= s_('DeployTokens|Scopes') @@ -14,6 +15,7 @@ - active_tokens.each do |token| %tr %td= token.name + %td= token.username %td= token.created_at.to_date.to_s(:medium) %td - if token.expires? |