diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-02 12:16:24 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-11 12:22:57 +0300 |
commit | 88e640374a82c3058b2a8cb54407fdc1784484d9 (patch) | |
tree | c6d0451ca3947e92a56c4d39e00cbf5b0272d257 /app/views | |
parent | e68a547bc790d44a1df3c9ae8b07b004ab8dd47e (diff) | |
download | gitlab-ce-88e640374a82c3058b2a8cb54407fdc1784484d9.tar.gz |
Add manifest import feature
It allows user to automatically import multiple repositories
with nested structure by uploading a manifest xml file.
AOSP project was used as an example during development of this feature.
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/import/manifest/_form.html.haml | 22 | ||||
-rw-r--r-- | app/views/import/manifest/new.html.haml | 13 | ||||
-rw-r--r-- | app/views/import/manifest/status.html.haml | 57 | ||||
-rw-r--r-- | app/views/projects/_import_project_pane.html.haml | 18 | ||||
-rw-r--r-- | app/views/projects/new.html.haml | 13 |
5 files changed, 111 insertions, 12 deletions
diff --git a/app/views/import/manifest/_form.html.haml b/app/views/import/manifest/_form.html.haml new file mode 100644 index 00000000000..57980cfd58a --- /dev/null +++ b/app/views/import/manifest/_form.html.haml @@ -0,0 +1,22 @@ += form_tag upload_import_manifest_path, multipart: true do + .form-group + = label_tag :manifest, class: 'label-light' do + Manifest + = file_field_tag :manifest, class: 'form-control-file', required: true + .form-text.text-muted + Import multiple repositories by uploading a manifest file. + + .form-group + = label_tag :group_id, nil, class: 'label-light' do + Namespace + .input-group + .input-group-prepend.has-tooltip{ title: root_url } + .input-group-text + = root_url + = select_tag :group_id, namespaces_options(nil, display_path: true), { class: 'select2 js-select-namespace' } + .form-text.text-muted + Choose the top-level namespace for your repository imports. + + .append-bottom-10 + = submit_tag 'Import projects', class: 'btn btn-success' + = link_to 'Cancel', new_project_path, class: 'btn btn-cancel' diff --git a/app/views/import/manifest/new.html.haml b/app/views/import/manifest/new.html.haml new file mode 100644 index 00000000000..1f27dec1b2b --- /dev/null +++ b/app/views/import/manifest/new.html.haml @@ -0,0 +1,13 @@ +- page_title "Manifest Import" +- header_title "Projects", root_path + +%h3.page-title + = icon('git') + Import multiple repositories + +- if @errors.present? + .alert.alert-danger + - @errors.each do |error| + = error + += render 'form' diff --git a/app/views/import/manifest/status.html.haml b/app/views/import/manifest/status.html.haml new file mode 100644 index 00000000000..3355bed056b --- /dev/null +++ b/app/views/import/manifest/status.html.haml @@ -0,0 +1,57 @@ +- page_title "Manifest import" +- header_title "Projects", root_path +- provider = 'manifest' + +%h3.page-title + = icon('git') + = _('Import multiple repositories') + +%p + = button_tag class: "btn btn-import btn-success js-import-all" do + = import_all_githubish_repositories_button_label + = icon("spinner spin", class: "loading-icon") + +.table-responsive + %table.table.import-jobs + %colgroup.import-jobs-from-col + %colgroup.import-jobs-to-col + %colgroup.import-jobs-status-col + %thead + %tr + %th= _('Repository URL') + %th= _('To GitLab') + %th= _('Status') + %tbody + - @already_added_projects.each do |project| + %tr{ id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}" } + %td + = link_to_project project + %td + = project.import_url + %td.job-status + - if project.import_status == 'finished' + %span + = icon('check') + = _('Done') + - elsif project.import_status == 'started' + = icon("spinner spin") + = _('Started') + - elsif project.import_status == 'failed' + = _('Failed') + - else + = project.human_import_status_name + + - @repos.each do |repo| + %tr{ id: "repo_#{repo[:id]}" } + %td + = repo[:url] + %td.import-target + = import_project_target(@group.path, repo[:path]) + %td.import-actions.job-status + = button_tag class: "btn btn-import js-add-to-import" do + Import + = icon("spinner spin", class: "loading-icon") + +.js-importer-status{ data: { jobs_import_path: "#{url_for([:jobs, :import, provider])}", + import_path: "#{url_for([:import, provider])}", + ci_cd_only: "#{has_ci_cd_only_params?}" } } diff --git a/app/views/projects/_import_project_pane.html.haml b/app/views/projects/_import_project_pane.html.haml index 8f535b9d789..7cb5d51bec1 100644 --- a/app/views/projects/_import_project_pane.html.haml +++ b/app/views/projects/_import_project_pane.html.haml @@ -1,9 +1,8 @@ - active_tab = local_assigns.fetch(:active_tab, 'blank') -- f = local_assigns.fetch(:f) .project-import .form-group.import-btn-container.clearfix - = f.label :visibility_level, class: 'label-light' do #the label here seems wrong + %h5 Import project from .import-buttons - if gitlab_project_import_enabled? @@ -39,11 +38,20 @@ = link_to new_import_gitea_path, class: 'btn import_gitea' do = custom_icon('go_logo') Gitea - %div - - if git_import_enabled? + - if git_import_enabled? + %div %button.btn.js-toggle-button.js-import-git-toggle-button{ type: "button", data: { toggle_open_class: 'active' } } = icon('git', text: 'Repo by URL') + %div + %button.btn{ type: "button" } + = icon('git', text: 'Manifest file') + .js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') } - %hr + = form_for @project, html: { class: 'new_project' } do |f| + %hr = render "shared/import_form", f: f = render 'new_project_fields', f: f, project_name_id: "import-url-name" + + .toggle-manifest-form + %hr + = render 'import/manifest/form' diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 5bb1bfb7059..6c363345e38 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -55,13 +55,12 @@ = render 'project_templates', f: f .tab-pane.import-project-pane.js-toggle-container{ id: 'import-project-pane', class: active_when(active_tab == 'import'), role: 'tabpanel' } - = form_for @project, html: { class: 'new_project' } do |f| - - if import_sources_enabled? - = render 'import_project_pane', f: f, active_tab: active_tab - - else - .nothing-here-block - %h4 No import options available - %p Contact an administrator to enable options for importing your project. + - if import_sources_enabled? + = render 'import_project_pane', active_tab: active_tab + - else + .nothing-here-block + %h4 No import options available + %p Contact an administrator to enable options for importing your project. .save-project-loader.d-none .center |