summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-08-11 08:02:49 +0000
committerDouwe Maan <douwe@gitlab.com>2015-08-11 08:02:49 +0000
commit2f706fbd231cabe7a76a5d17ac44285aaaf8592c (patch)
treebed79791b8eece8e8454665b695a6f6595524b89
parentb514a5ee06538baf13a068ef8a7785528d7e737b (diff)
parentf1a241e0ed66b8b8d46dec39ff84660d14387cca (diff)
downloadgitlab-ce-2f706fbd231cabe7a76a5d17ac44285aaaf8592c.tar.gz
Merge branch 'fix-broken-code-import' into 'master'
Fix broken code import and display error messages if something went wrong with creating project Clicking "Import" in Bitbucket import status page would result in: ``` Rendered import/base/create.js.haml (38.3ms) Completed 500 Internal Server Error in 1362ms (ActiveRecord: 20.2ms) NoMethodError - undefined method `namespace_projects_path' for #<#<Class:0x007fd6c0f29498>:0x007fd6c0cf09d8>: actionpack (4.1.11) lib/action_dispatch/routing/polymorphic_routes.rb:142:in `polymorphic_url' actionpack (4.1.11) lib/action_dispatch/routing/polymorphic_routes.rb:148:in `polymorphic_path' actionview (4.1.11) lib/action_view/routing_url_for.rb:87:in `url_for' turbolinks (2.5.3) lib/turbolinks/xhr_url_for.rb:12:in `url_for_with_xhr_referer' actionview (4.1.11) lib/action_view/helpers/url_helper.rb:181:in `link_to' app/views/import/base/create.js.haml:23:in `_app_views_import_base_create_js_haml__1092746368522631377_70280180507700' actionview (4.1.11) lib/action_view/template.rb:145:in `block in render' activesupport (4.1.11) lib/active_support/notifications.rb:161:in `instrument' actionview (4.1.11) lib/action_view/template.rb:339:in `instrument' actionview (4.1.11) lib/action_view/template.rb:143:in `render' rack-mini-profiler (0.9.0) lib/mini_profiler/profiling_methods.rb:108:in `block in profile_method' actionview (4.1.11) lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template' actionview (4.1.11) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument' activesupport (4.1.11) lib/active_support/notifications.rb:159:in `block in instrument' activesupport (4.1.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument' activesupport (4.1.11) lib/active_support/notifications.rb:159:in `instrument' ``` Also, if the project failed to save for some reason, the user was never informed. Screenshot of new error message dump: ![image](https://gitlab.com/stanhu/gitlab-ce/uploads/afc15aa6b0cde0080976eab3199cf18b/image.png) Closes #2241 See merge request !1134
-rw-r--r--CHANGELOG1
-rw-r--r--app/views/import/base/create.js.haml8
2 files changed, 7 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 816031ca8ed..8801cd6359f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased)
- Disable turbolinks when linking to Bitbucket import status (Stan Hu)
+ - Fix broken code import and display error messages if something went wrong with creating project (Stan Hu)
- Fix corrupted binary files when using API files endpoint (Stan Hu)
- Show incompatible projects in Bitbucket import status (Stan Hu)
- Fix coloring of diffs on MR Discussion-tab (Gert Goet)
diff --git a/app/views/import/base/create.js.haml b/app/views/import/base/create.js.haml
index 90a6f5f9d2d..9529f16c128 100644
--- a/app/views/import/base/create.js.haml
+++ b/app/views/import/base/create.js.haml
@@ -14,12 +14,16 @@
:plain
job = $("tr#repo_#{@repo_id}")
job.find(".import-actions").html("<p class='alert alert-danger'>Access denied! Please verify you can add deploy keys to this repository.</p>")
-- else
+- elsif @project.persisted?
:plain
job = $("tr#repo_#{@repo_id}")
job.attr("id", "project_#{@project.id}")
target_field = job.find(".import-target")
target_field.empty()
- target_field.append('<strong>#{link_to @project.path_with_namespace, [@project.namespace.becomes(Namespace), @project]}</strong>')
+ target_field.append('<strong>#{link_to @project.path_with_namespace, namespace_project_path(@project.namespace, @project)}</strong>')
$("table.import-jobs tbody").prepend(job)
job.addClass("active").find(".import-actions").html("<i class='fa fa-spinner fa-spin'></i> started")
+- else
+ :plain
+ job = $("tr#repo_#{@repo_id}")
+ job.find(".import-actions").html("<p class='alert alert-danger'>Error saving project: #{escape_javascript(@project.errors.messages.to_s)}</p>")