Commit 26087322 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'make-issue-boards-importable' into 'master'

Make issue boards importable

See merge request gitlab-org/gitlab-ce!31434
parents 9edf06d9 651e89d2
......@@ -3,10 +3,11 @@
class List < ApplicationRecord
belongs_to :board
belongs_to :label
include Importable
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_id, uniqueness: { scope: :board_id }, if: :label?
validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, if: :movable?
......
......@@ -15,6 +15,7 @@
%li= _('Project configuration, including services')
%li= _('Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities')
%li= _('LFS objects')
%li= _('Issue Boards')
%p= _('The following items will NOT be exported:')
%ul
%li= _('Job traces and artifacts')
......
---
title: Make issue boards importable
merge_request: 31434
author: Jason Colyer
type: changed
......@@ -66,6 +66,7 @@ The following items will be exported:
- Issues with comments, merge requests with diffs and comments, labels, milestones, snippets,
and other project entities
- LFS objects
- Issue boards
The following items will NOT be exported:
......
......@@ -80,6 +80,10 @@ project_tree:
- :ci_cd_settings
- :error_tracking_setting
- :metrics_setting
- boards:
- lists:
- label:
- :priorities
# Only include the following attributes for the models specified.
included_attributes:
......@@ -216,6 +220,8 @@ methods:
- :action
project_badges:
- :type
lists:
- :list_type
# EE specific relationships and settings to include. All of this will be merged
# into the previous structures if EE is used.
......
......@@ -469,3 +469,17 @@ incident_management_setting:
merge_trains:
- project
- merge_request
boards:
- group
- lists
- destroyable_lists
- milestone
- board_labels
- board_assignee
- assignee
- labels
lists:
- user
- milestone
- board
- label
......@@ -7147,5 +7147,65 @@
"link_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,13 +160,21 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end
it 'has project labels' do
expect(ProjectLabel.count).to eq(2)
expect(ProjectLabel.count).to eq(3)
end
it 'has no group labels' do
expect(GroupLabel.count).to eq(0)
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
it 'has a project feature' do
expect(@project.project_feature).not_to be_nil
end
......
......@@ -272,6 +272,10 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
expect(saved_project_json).not_to include("runners_token" => 'token')
end
end
it 'has a board and a list' do
expect(saved_project_json['boards'].first['lists']).not_to be_empty
end
end
end
......@@ -327,6 +331,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
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
end
......
......@@ -693,3 +693,22 @@ ProjectMetricsSetting:
- external_dashboard_url
- created_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