Add design widget wrapper
What does this MR do and why?
This MR is first of 2 MRs for adding design widget to work items.
- adds designs widget to
work_item_definitions
table via a post migration - adds designs widget to issue work item types in
BaseTypeImporter
of work items - adds designs widget wrapper around work item to respond to design related methods(will be consumed in the next MR in GraphQl).
Issue: #387552 (closed)
GraphQl Query
{
workItem(id: "gid://gitlab/WorkItem/530") {
id,
workItemType {
id,
name
},
widgets {
type
... on WorkItemWidgetDesigns {
__typename,
designCollection {
__typename
copyState
designs {
__typename
nodes {
__typename
id
event
filename
notesCount
image
imageV432x230
currentUserTodos(state: pending) {
__typename
nodes {
__typename
id
}
}
}
}
versions {
__typename
nodes {
__typename
id
sha
createdAt
author {
__typename
id
name
avatarUrl
}
}
}
}
}
}
}
}
GraphQl Response
{
"data": {
"workItem": {
"id": "gid://gitlab/WorkItem/530",
"workItemType": {
"id": "gid://gitlab/WorkItems::Type/1",
"name": "Issue"
},
"widgets": [
{
"type": "ASSIGNEES"
},
{
"type": "LABELS"
},
{
"type": "DESCRIPTION"
},
{
"type": "HIERARCHY"
},
{
"type": "START_AND_DUE_DATE"
},
{
"type": "MILESTONE"
},
{
"type": "NOTES"
},
{
"type": "ITERATION"
},
{
"type": "WEIGHT"
},
{
"type": "HEALTH_STATUS"
},
{
"type": "NOTIFICATIONS"
},
{
"type": "CURRENT_USER_TODOS"
},
{
"type": "AWARD_EMOJI"
},
{
"type": "DESIGNS",
"__typename": "WorkItemWidgetDesigns",
"designCollection": {
"__typename": "DesignCollection",
"copyState": "READY",
"designs": {
"__typename": "DesignConnection",
"nodes": []
},
"versions": {
"__typename": "DesignVersionConnection",
"nodes": []
}
}
},
{
"type": "LINKED_ITEMS"
},
{
"type": "PARTICIPANTS"
}
]
}
}
}
Migrations
bundle exec rake db:migrate:up:main VERSION=20240130070854
main: == [advisory_lock_connection] object_id: 117480, pg_backend_pid: 21048
main: == 20240130070854 AddDesignsWidgetToWorkItemDefinitions: migrating ============
main: == 20240130070854 AddDesignsWidgetToWorkItemDefinitions: migrated (0.0298s) ===
main: == [advisory_lock_connection] object_id: 117480, pg_backend_pid: 21048
bundle exec rake db:migrate:up:ci VERSION=20240130070854
ci: == [advisory_lock_connection] object_id: 117420, pg_backend_pid: 22254
ci: == 20240130070854 AddDesignsWidgetToWorkItemDefinitions: migrating ============
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_internal, :gitlab_shared].
ci: == 20240130070854 AddDesignsWidgetToWorkItemDefinitions: migrated (0.0083s) ===
ci: == [advisory_lock_connection] object_id: 117420, pg_backend_pid: 22254
bundle exec rake db:migrate:down:main VERSION=20240130070854
main: == [advisory_lock_connection] object_id: 117420, pg_backend_pid: 19745
main: == 20240130070854 AddDesignsWidgetToWorkItemDefinitions: reverting ============
main: == 20240130070854 AddDesignsWidgetToWorkItemDefinitions: reverted (0.0539s) ===
main: == [advisory_lock_connection] object_id: 117420, pg_backend_pid: 19745
bundle exec rake db:migrate:down:ci VERSION=20240130070854
ci: == [advisory_lock_connection] object_id: 117420, pg_backend_pid: 20314
ci: == 20240130070854 AddDesignsWidgetToWorkItemDefinitions: reverting ============
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_internal, :gitlab_shared].
ci: == 20240130070854 AddDesignsWidgetToWorkItemDefinitions: reverted (0.0081s) ===
ci: == [advisory_lock_connection] object_id: 117420, pg_backend_pid: 20314
How to set up and validate locally
- Run
bundle exec rails db:migrate
- Once done, visit any issue on GDK and click on the issue, one you are on the issue show page, upload few designs to the issue.
- Now, replace
/issue/
in the URL to/work_items/
. You should see a work item view for the issue. Copy the Gid of it. - Got to
graphql-explorer
and enter the query mentioned above with the WotkItem GId. You should see default value for designs returned.
Related to #387552 (closed)
Edited by Abhilash Kotte