Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/development/work_items_widgets.md')
-rw-r--r--doc/development/work_items_widgets.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/development/work_items_widgets.md b/doc/development/work_items_widgets.md
index ba15a3f0163..5b9602595bb 100644
--- a/doc/development/work_items_widgets.md
+++ b/doc/development/work_items_widgets.md
@@ -112,3 +112,28 @@ for work items widgets development:
- `ee/app/assets/javascripts/boards/components/assignee_select.vue`
- `ee/app/assets/javascripts/boards/components/milestone_select.vue`
+
+## Mapping widgets to work item types
+
+All Work Item types share the same pool of predefined widgets and are customized by which widgets are active on a specific type. Because we plan to allow users to create new Work Item types and define a set of widgets for them, mapping of widgets for each Work Item type is stored in database. Mapping of widgets is stored in widget_definitions table and it can be used for defining widgets both for default Work Item types and also in future for custom types. More details about expected database table structure can be found in [this issue description](https://gitlab.com/gitlab-org/gitlab/-/issues/374092).
+
+### Adding new widget to a work item type
+
+Because information about what widgets are assigned to each work item type is stored in database, adding new widget to a work item type needs to be done through a database migration. Also widgets importer (`lib/gitlab/database_importers/work_items/widgets_importer.rb`) should be updated.
+
+### Structure of widget definitions table
+
+Each record in the table defines mapping of a widget to a work item type. Currently only "global" definitions (definitions with NULL namespace_id) are used. In next iterations we plan to allow customization of these mappings. For example table below defines that:
+
+- Weight widget is enabled for work item types 0 and 1
+- in namespace 1 Weight widget is renamed to MyWeight. When user renames widget's name, it makes sense to rename all widget mappings in the namespace - because `name` attribute is denormalized, we have to create namespaced mappings for all work item types for this widget type.
+- Weight widget can be disabled for specific work item types (in namespace 3 it's disabled for work item type 0, while still left enabled for work item type 1)
+
+| ID | Namespace_id | Work_item_type_id | Widget_type_enum | Position | Name | Disabled |
+|----| ------------ | ----------------- |----------------- |--------- |---------- |-------|
+| 1 | | 0 | 1 | 1 | Weight | false |
+| 2 | | 1 | 1 | 1 | Weight | false |
+| 3 | 1 | 0 | 1 | 0 | MyWeight | false |
+| 4 | 1 | 1 | 1 | 0 | MyWeight | false |
+| 5 | 2 | 0 | 1 | 1 | Other Weight | false |
+| 6 | 3 | 0 | 1 | 1 | Weight | true |