summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-03-29 20:11:36 -0600
committerMayra Cabrera <mcabrera@gitlab.com>2018-04-06 21:20:16 -0500
commit345ac03b7afb1dc9b941c53bc45cc3dfcf22e61c (patch)
tree42da609254928d746a961465d9ecfbff3ab71ad4 /app/controllers/projects
parent370fc05da7f95bf6621867a71d51493cf3899e25 (diff)
downloadgitlab-ce-345ac03b7afb1dc9b941c53bc45cc3dfcf22e61c.tar.gz
Address UX review
- Keep 'Deploy Section' open upon save, otherwise the token might get lost - When an error appears, display the error inside the form and also keep the Deploy Section open - Changue copy of revoke modal
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/deploy_tokens_controller.rb6
-rw-r--r--app/controllers/projects/settings/repository_controller.rb8
2 files changed, 4 insertions, 10 deletions
diff --git a/app/controllers/projects/deploy_tokens_controller.rb b/app/controllers/projects/deploy_tokens_controller.rb
index ecc6db50f2f..1b1bd461b27 100644
--- a/app/controllers/projects/deploy_tokens_controller.rb
+++ b/app/controllers/projects/deploy_tokens_controller.rb
@@ -3,16 +3,12 @@ class Projects::DeployTokensController < Projects::ApplicationController
def create
@token = DeployTokens::CreateService.new(@project, current_user, deploy_token_params).execute
- token_params = {}
if @token.valid?
flash[:notice] = 'Your new project deploy token has been created.'
- else
- token_params = @token.attributes.slice("name", "scopes", "expires_at")
- flash[:alert] = @token.errors.full_messages.join(', ').html_safe
end
- redirect_to project_settings_repository_path(project, deploy_token: token_params)
+ redirect_to project_settings_repository_path(project)
end
def revoke
diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb
index 28897cc5946..ab6d8b3b10c 100644
--- a/app/controllers/projects/settings/repository_controller.rb
+++ b/app/controllers/projects/settings/repository_controller.rb
@@ -55,11 +55,9 @@ module Projects
end
def define_deploy_token
- @deploy_token = @project.deploy_tokens.build(deploy_token_attributes)
- end
-
- def deploy_token_attributes
- params.fetch(:deploy_token, {}).permit(:name, :expires_at, scopes: [])
+ attributes = @deploy_tokens.attributes_deploy_token
+ @deploy_token = @project.deploy_tokens.build(attributes)
+ @deploy_token.valid? unless attributes.empty?
end
end
end