Commit 5e7e505f authored by Sean McGivern's avatar Sean McGivern

Merge branch '12148-enable-the-exporting-importing-of-issue-boards' into 'master'

Resolve "Enable the exporting/importing of issue boards"

Closes #12148

See merge request gitlab-org/gitlab-ee!14122
parents 7640916a 44c2360d
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
class List < ApplicationRecord class List < ApplicationRecord
prepend ::EE::List # rubocop: disable Cop/InjectEnterpriseEditionModule prepend ::EE::List # rubocop: disable Cop/InjectEnterpriseEditionModule
include Importable
belongs_to :board belongs_to :board
belongs_to :label belongs_to :label
enum list_type: { backlog: 0, label: 1, closed: 2, assignee: 3, milestone: 4 } enum list_type: { backlog: 0, label: 1, closed: 2, assignee: 3, milestone: 4 }
validates :board, :list_type, presence: true validates :board, :list_type, presence: true, unless: :importing?
validates :label, :position, presence: true, if: :label? validates :label, :position, presence: true, if: :label?
validates :label_id, uniqueness: { scope: :board_id }, if: :label? validates :label_id, uniqueness: { scope: :board_id }, if: :label?
validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, if: :movable? validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, if: :movable?
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
%li= _('Project uploads') %li= _('Project uploads')
%li= _('Project configuration, including services') %li= _('Project configuration, including services')
%li= _('Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities') %li= _('Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities')
%li= _('Issue Boards')
%li= _('LFS objects') %li= _('LFS objects')
%p= _('The following items will NOT be exported:') %p= _('The following items will NOT be exported:')
%ul %ul
......
---
title: Make issue boards importable
merge_request: 31434
author: Jason Colyer
type: changed
...@@ -66,6 +66,7 @@ The following items will be exported: ...@@ -66,6 +66,7 @@ The following items will be exported:
- Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, - Issues with comments, merge requests with diffs and comments, labels, milestones, snippets,
and other project entities and other project entities
- LFS objects - LFS objects
- Issue boards
The following items will NOT be exported: The following items will NOT be exported:
......
...@@ -83,6 +83,13 @@ project_tree: ...@@ -83,6 +83,13 @@ project_tree:
- :ci_cd_settings - :ci_cd_settings
- :error_tracking_setting - :error_tracking_setting
- :metrics_setting - :metrics_setting
- boards:
- lists:
- label:
- :priorities
- milestone:
- events:
- :push_event_payload
# Only include the following attributes for the models specified. # Only include the following attributes for the models specified.
included_attributes: included_attributes:
...@@ -227,6 +234,8 @@ methods: ...@@ -227,6 +234,8 @@ methods:
- :action - :action
project_badges: project_badges:
- :type - :type
lists:
- :list_type
# EE specific relationships and settings to include. All of this will be merged # EE specific relationships and settings to include. All of this will be merged
# into the previous structures if EE is used. # into the previous structures if EE is used.
......
...@@ -469,3 +469,17 @@ incident_management_setting: ...@@ -469,3 +469,17 @@ incident_management_setting:
merge_trains: merge_trains:
- project - project
- merge_request - merge_request
boards:
- group
- lists
- destroyable_lists
- milestone
- board_labels
- board_assignee
- assignee
- labels
lists:
- user
- milestone
- board
- label
...@@ -7147,5 +7147,65 @@ ...@@ -7147,5 +7147,65 @@
"link_url": "http://www.example.com", "link_url": "http://www.example.com",
"image_url": "http://www.example.com" "image_url": "http://www.example.com"
} }
],
"boards": [
{
"id": 29,
"project_id": 49,
"created_at": "2019-06-06T14:01:06.204Z",
"updated_at": "2019-06-06T14:22:37.045Z",
"name": "TestBoardABC",
"milestone_id": null,
"group_id": null,
"weight": null,
"lists": [
{
"id": 59,
"board_id": 29,
"label_id": null,
"list_type": "backlog",
"position": null,
"created_at": "2019-06-06T14:01:06.214Z",
"updated_at": "2019-06-06T14:01:06.214Z",
"user_id": null,
"milestone_id": null
},
{
"id": 61,
"board_id": 29,
"label_id": 20,
"list_type": "label",
"position": 0,
"created_at": "2019-06-06T14:01:43.197Z",
"updated_at": "2019-06-06T14:01:43.197Z",
"user_id": null,
"milestone_id": null,
"label": {
"id": 20,
"title": "testlabel",
"color": "#0033CC",
"project_id": 49,
"created_at": "2019-06-06T14:01:19.698Z",
"updated_at": "2019-06-06T14:01:19.698Z",
"template": false,
"description": null,
"group_id": null,
"type": "ProjectLabel",
"priorities": []
}
},
{
"id": 60,
"board_id": 29,
"label_id": null,
"list_type": "closed",
"position": null,
"created_at": "2019-06-06T14:01:06.221Z",
"updated_at": "2019-06-06T14:01:06.221Z",
"user_id": null,
"milestone_id": null
}
]
}
] ]
} }
...@@ -160,7 +160,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -160,7 +160,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end end
it 'has project labels' do it 'has project labels' do
expect(ProjectLabel.count).to eq(2) expect(ProjectLabel.count).to eq(3)
end end
it 'has no group labels' do it 'has no group labels' do
...@@ -256,6 +256,14 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -256,6 +256,14 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(CommitStatus.all).to all(have_attributes(pipeline_id: a_value > 0)) expect(CommitStatus.all).to all(have_attributes(pipeline_id: a_value > 0))
end end
end end
it 'has issue boards' do
expect(Project.find_by_path('project').boards.count).to eq(1)
end
it 'has lists associated with the issue board' do
expect(Project.find_by_path('project').boards.find_by_name('TestBoardABC').lists.count).to eq(3)
end
end end
end end
......
...@@ -272,6 +272,10 @@ describe Gitlab::ImportExport::ProjectTreeSaver do ...@@ -272,6 +272,10 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
expect(saved_project_json).not_to include("runners_token" => 'token') expect(saved_project_json).not_to include("runners_token" => 'token')
end end
end end
it 'has a board and a list' do
expect(saved_project_json['boards'].first['lists']).not_to be_empty
end
end end
end end
...@@ -327,6 +331,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver do ...@@ -327,6 +331,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
create(:project_badge, project: project) create(:project_badge, project: project)
create(:project_badge, project: project) create(:project_badge, project: project)
board = create(:board, project: project, name: 'TestBoard')
create(:list, board: board, position: 0, label: project_label)
project project
end end
......
...@@ -687,3 +687,22 @@ ProjectMetricsSetting: ...@@ -687,3 +687,22 @@ ProjectMetricsSetting:
- external_dashboard_url - external_dashboard_url
- created_at - created_at
- updated_at - updated_at
Board:
- id
- project_id
- created_at
- updated_at
- group_id
- milestone_id
- weight
- name
List:
- id
- board_id
- label_id
- list_type
- position
- created_at
- updated_at
- milestone_id
- user_id
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