Commit bc3ccf1e authored by Josianne Hyson's avatar Josianne Hyson Committed by Rémy Coutable

Create UI for Group export in Group Settings

We want to be able to export group data from the UI like we currently
can with projects. Update the Group settings page to have link to
export the group data and then download it.

Add documentation describing how to complete this process from the UI.

Relates to issue: https://gitlab.com/gitlab-org/gitlab/-/issues/211805
parent 31372511
......@@ -12,6 +12,16 @@ module ExportHelper
_('Issue Boards')
]
end
def group_export_descriptions
[
_('Milestones'),
_('Labels'),
_('Boards and Board Lists'),
_('Badges'),
_('Subgroups')
]
end
end
ExportHelper.prepend_if_ee('EE::ExportHelper')
......@@ -45,11 +45,11 @@
%section.settings.gs-advanced.no-animate#js-advanced-settings{ class: ('expanded' if expanded) }
.settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only{ role: 'button' }
= _('Path, transfer, remove')
= _('Advanced')
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _('Perform advanced options such as changing path, transferring, or removing the group.')
= _('Perform advanced options such as changing path, transferring, exporting, or removing the group.')
.settings-content
= render 'groups/settings/advanced'
......
= render 'groups/settings/export', group: @group
.sub-section
%h4.warning-title= s_('GroupSettings|Change group path')
= form_for @group, html: { multipart: true, class: 'gl-show-field-errors' }, authenticity_token: true do |f|
......
- return unless Feature.enabled?(:group_import_export, @group, default_enabled: true)
- group = local_assigns.fetch(:group)
.sub-section
%h4= s_('GroupSettings|Export group')
%p= _('Export this group with all related data to a new GitLab instance. Once complete, you can import the data file from the "New Group" page.')
.bs-callout.bs-callout-info
%p.append-bottom-0
%p= _('The following items will be exported:')
%ul
- group_export_descriptions.each do |description|
%li= description
%p= _('The following items will NOT be exported:')
%ul
%li= _('Projects')
%li= _('Runner tokens')
%li= _('SAML discovery tokens')
%p= _('Once the exported file is ready you can download it from this page.')
- if group.export_file_exists?
= link_to _('Regenerate export'), export_group_path(group),
method: :post, class: 'btn btn-default', data: { qa_selector: 'regenerate_export_group_link' }
= link_to _('Download export'), download_export_group_path(group),
rel: 'nofollow', method: :get, class: 'btn btn-default', data: { qa_selector: 'download_export_link' }
- else
= link_to _('Export group'), export_group_path(group),
method: :post, class: 'btn btn-default', data: { qa_selector: 'export_group_link' }
---
title: Add UI for exporting group data to the group settings
merge_request: 28573
author:
type: added
......@@ -25,7 +25,7 @@ POST /groups/:id/export
| Attribute | Type | Required | Description |
| --------- | -------------- | -------- | ---------------------------------------- |
| `id` | integer/string | yes | ID of the groupd owned by the authenticated user |
| `id` | integer/string | yes | ID of the group owned by the authenticated user |
```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/export
......
# Group Import/Export
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2888) in GitLab 13.0 as an experimental feature. May change in future releases.
Existing groups running on any GitLab instance or GitLab.com can be exported with all their related data and moved to a
new GitLab instance.
The **GitLab import/export** button is displayed if the group import option in enabled.
See also:
- [Group Import/Export API](../../../api/group_import_export.md)
- [Project Import/Export](../../project/settings/import_export.md)
- [Project Import/Export API](../../../api/project_import_export.md)
To enable GitLab import/export:
1. Navigate to **{admin}** **Admin Area >** **{settings}** **Settings > Visibility and access controls**.
1. Scroll to **Import sources**
1. Enable desired **Import sources**
## Important Notes
Note the following:
- Exports are stored in a temporary [shared directory](../../../development/shared_files.md) and are deleted every 24 hours by a specific worker.
- To preserve group-level relationships from imported projects, run the Group Import/Export first, to allow projects to
be imported into the desired group structure.
- Imported groups are given a `private` visibility level, unless imported into a parent group.
- If imported into a parent group, subgroups will inherit the same level of visibility unless otherwise restricted.
- To preserve the member list and their respective permissions on imported groups, review the users in these groups. Make
sure these users exist before importing the desired groups.
### Exported Contents
The following items will be exported:
- Milestones
- Labels
- Boards and Board Lists
- Badges
- Subgroups (including all the aforementioned data)
- Epics
- Events
The following items will NOT be exported:
- Projects
- Runners token
- SAML discovery tokens
NOTE: **Note:**
For more details on the specific data persisted in a group export, see the
[`import_export.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/import_export/group/import_export.yml) file.
## Exporting a Group
1. Navigate to your group's homepage.
1. Click **{settings}** **Settings** in the sidebar.
1. In the **Advanced** section, click the **Export Group** button.
![Export group panel](img/export_panel.png)
1. Once the export is generated, you can click **Download export** to download the [exported contents](#exported-contents)
in a compressed tar archive, with contents in JSON format. You can also return to this page to regenerate the export data.
## Rate Limits
To help avoid abuse, users are rate limited to:
| Request Type | Limit |
| ---------------- | ------------------------------ |
| Export | 1 group every 5 minutes |
| Download export | 10 downloads every 10 minutes |
......@@ -12,6 +12,7 @@ See also:
- [Project import/export API](../../../api/project_import_export.md)
- [Project import/export administration Rake tasks](../../../administration/raketasks/project_import_export.md) **(CORE ONLY)**
- [Group import/export](../../group/settings/import_export.md)
- [Group import/export API](../../../api/group_import_export.md)
To set up a project import/export:
......
......@@ -8,5 +8,10 @@ module EE
def project_export_descriptions
super + [_('Design Management files and data')]
end
override :group_export_descriptions
def group_export_descriptions
super + [_('Epics'), _('Events')]
end
end
end
......@@ -3084,6 +3084,9 @@ msgstr ""
msgid "Boards"
msgstr ""
msgid "Boards and Board Lists"
msgstr ""
msgid "Boards|Collapse"
msgstr ""
......@@ -8639,12 +8642,18 @@ msgstr ""
msgid "Export as CSV"
msgstr ""
msgid "Export group"
msgstr ""
msgid "Export issues"
msgstr ""
msgid "Export project"
msgstr ""
msgid "Export this group with all related data to a new GitLab instance. Once complete, you can import the data file from the \"New Group\" page."
msgstr ""
msgid "Export this project with all its related data in order to move your project to a new GitLab instance. Once the export is finished, you can import the file from the \"New Project\" page."
msgstr ""
......@@ -10508,6 +10517,9 @@ msgstr ""
msgid "GroupSettings|Disable group mentions"
msgstr ""
msgid "GroupSettings|Export group"
msgstr ""
msgid "GroupSettings|If the parent group's visibility is lower than the group current visibility, visibility levels for subgroups and projects will be changed to match the new parent group's visibility."
msgstr ""
......@@ -14105,6 +14117,9 @@ msgstr ""
msgid "Once removed, the fork relationship cannot be restored and you will no longer be able to send merge requests to the source."
msgstr ""
msgid "Once the exported file is ready you can download it from this page."
msgstr ""
msgid "Once the exported file is ready, you will receive a notification email with a download link, or you can download it from this page."
msgstr ""
......@@ -14617,9 +14632,6 @@ msgstr ""
msgid "Path"
msgstr ""
msgid "Path, transfer, remove"
msgstr ""
msgid "Path:"
msgstr ""
......@@ -14650,7 +14662,7 @@ msgstr ""
msgid "Percentage"
msgstr ""
msgid "Perform advanced options such as changing path, transferring, or removing the group."
msgid "Perform advanced options such as changing path, transferring, exporting, or removing the group."
msgstr ""
msgid "Perform common operations on GitLab project"
......@@ -16848,6 +16860,9 @@ msgid_plural "Refreshing in %d seconds to show the updated status..."
msgstr[0] ""
msgstr[1] ""
msgid "Regenerate export"
msgstr ""
msgid "Regenerate instance ID"
msgstr ""
......@@ -17639,6 +17654,9 @@ msgstr ""
msgid "Runner token"
msgstr ""
msgid "Runner tokens"
msgstr ""
msgid "Runner was not updated."
msgstr ""
......@@ -17693,6 +17711,9 @@ msgstr ""
msgid "SAML SSO for %{group_name}"
msgstr ""
msgid "SAML discovery tokens"
msgstr ""
msgid "SAML for %{group_name}"
msgstr ""
......
# frozen_string_literal: true
require 'spec_helper'
describe 'Group Export', :js do
include ExportFileHelper
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
context 'when the signed in user has the required permission level' do
before do
group.add_owner(user)
sign_in(user)
end
it 'allows the user to export the group', :sidekiq_inline do
visit edit_group_path(group)
expect(page).to have_content('Export group')
click_link('Export group')
expect(page).to have_content('Group export started')
expect(page).to have_content('Download export')
end
end
context 'when the group import/export FF is disabled' do
before do
stub_feature_flags(group_import_export: false)
group.add_owner(user)
sign_in(user)
end
it 'does not show the group export options' do
visit edit_group_path(group)
expect(page).to have_content('Advanced')
expect(page).not_to have_content('Export group')
end
end
context 'when the signed in user does not have the required permission level' do
before do
group.add_guest(user)
sign_in(user)
end
it 'does not let the user export the group' do
visit edit_group_path(group)
expect(page).to have_content('Page Not Found')
expect(page).not_to have_content('Export group')
end
end
end
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