Commit 479814b2 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'fix/new-project-import-tooltip' into 'master'

Show tooltip on GitLab export link in new project page

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19993

When the project path/name is not filled, we should show a tooltip in the `GitLab export` link, plus a flash message if the user still tries to click on it.

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
  - [x] Added for this feature/bug
  - [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5363
parents cb9f418b 96572bd0
...@@ -158,6 +158,7 @@ v 8.10.0 (unreleased) ...@@ -158,6 +158,7 @@ v 8.10.0 (unreleased)
- Add builds badge to Pipelines settings page - Add builds badge to Pipelines settings page
- Export and import avatar as part of project import/export - Export and import avatar as part of project import/export
- Fix migration corrupting import data for old version upgrades - Fix migration corrupting import data for old version upgrades
- Show tooltip on GitLab export link in new project page
v 8.9.6 v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154 - Fix importing of events under notes for GitLab projects. !5154
......
...@@ -89,9 +89,9 @@ ...@@ -89,9 +89,9 @@
= link_to "#", class: 'btn js-toggle-button import_git' do = link_to "#", class: 'btn js-toggle-button import_git' do
%i.fa.fa-git %i.fa.fa-git
%span Repo by URL %span Repo by URL
%div %div{ class: 'import_gitlab_project' }
- if gitlab_project_import_enabled? - if gitlab_project_import_enabled?
= link_to new_import_gitlab_project_path, class: 'btn import_gitlab_project project-submit' do = link_to new_import_gitlab_project_path, class: 'btn btn_import_gitlab_project project-submit' do
%i.fa.fa-gitlab %i.fa.fa-gitlab
%span GitLab export %span GitLab export
...@@ -130,29 +130,29 @@ ...@@ -130,29 +130,29 @@
$(".modal").hide(); $(".modal").hide();
}); });
$('.import_gitlab_project').bind('click', function() { $('.btn_import_gitlab_project').bind('click', function() {
var _href = $("a.import_gitlab_project").attr("href"); var _href = $("a.btn_import_gitlab_project").attr("href");
$(".import_gitlab_project").attr("href", _href + '?namespace_id=' + $("#project_namespace_id").val() + '&path=' + $("#project_path").val()); $(".btn_import_gitlab_project").attr("href", _href + '?namespace_id=' + $("#project_namespace_id").val() + '&path=' + $("#project_path").val());
}); });
$('.import_gitlab_project').attr('disabled',true) $('.btn_import_gitlab_project').attr('disabled',true)
$('.import_gitlab_project').attr('title', 'Project path required.'); $('.import_gitlab_project').attr('title', 'Project path and name required.');
$('.import_gitlab_project').click(function( event ) { $('.import_gitlab_project').click(function( event ) {
if($('.import_gitlab_project').attr('disabled')) { if($('.btn_import_gitlab_project').attr('disabled')) {
event.preventDefault(); event.preventDefault();
new Flash("Please enter a path for the project to be imported to."); new Flash("Please enter path and name for the project to be imported to.");
} }
}); });
$('#project_path').keyup(function(){ $('#project_path').keyup(function(){
if($(this).val().length !=0) { if($(this).val().length !=0) {
$('.import_gitlab_project').attr('disabled', false); $('.btn_import_gitlab_project').attr('disabled', false);
$('.import_gitlab_project').attr('title',''); $('.import_gitlab_project').attr('title','');
$(".flash-container").html("") $(".flash-container").html("")
} else { } else {
$('.import_gitlab_project').attr('disabled',true); $('.btn_import_gitlab_project').attr('disabled',true);
$('.import_gitlab_project').attr('title', 'Project path required.'); $('.import_gitlab_project').attr('title', 'Project path and name required.');
} }
}); });
......
...@@ -59,6 +59,21 @@ feature 'project import', feature: true, js: true do ...@@ -59,6 +59,21 @@ feature 'project import', feature: true, js: true do
end end
end end
scenario 'project with no name' do
create(:project, namespace_id: 2)
visit new_project_path
select2('2', from: '#project_namespace_id')
# click on disabled element
find(:link, 'GitLab export').trigger('click')
page.within('.flash-container') do
expect(page).to have_content('Please enter path and name')
end
end
def wiki_exists? def wiki_exists?
wiki = ProjectWiki.new(project) wiki = ProjectWiki.new(project)
File.exist?(wiki.repository.path_to_repo) && !wiki.repository.empty? File.exist?(wiki.repository.path_to_repo) && !wiki.repository.empty?
......
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