This repository has been archived by the owner on Jun 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
ItemStorage
jiajunGit edited this page Jul 24, 2017
·
2 revisions
ItemStorage is the component that contains structures holding information about the GitHub Labels that the issue page controllers have retrieved. This component is used by SelectedLabelsFactory, SearchFactory and LabelGroupsFactory to update their UI components with labels data.
ItemStorage stores the following information about a label:
- fullName - The full name of a label
- name - Name of the label without its group name
- color - The hex/rgb string representation of the label color
- selected - The selection status of the label
- id - The label's item id generated by the IDGenerator component
- groupID - The label's group id generated by the IDGenerator component
GroupInfo stores the following information about a group:
- groupName - Name of the group
- groupType - Type of group (e.g dot group, dashed group or non-grouped)
- isGroupExclusive - Group exclusive status (i.e you cannot select more than one label from an exclusive group)
- In order to add labels to ItemStorage, issue page controllers will first need to populate a LabelItem class with the label's full name, color and selection status. After initializing an LabelItem with the necessary information, issue page controllers will call
addItem(labelItem)
to add the label to ItemStorage. - Within the
addItem(labelItem)
function, thegetGroupData(fullItemName)
function will parse the name of the label using the regex:\\.|\-
to determine if the label belongs to a dot group, dashed group or non-grouped. Labels with names that do not precede a group symbol with nothing (e.g. -fixed) will be classified as non-grouped. - Selected labels are cached within ItemStorage so that applying labels would be faster.
- Components that use ItemStorage can use
selectItem(itemID)
to select labels or useunselectItem(itemID)
to unselect labels or useisItemSelected(itemID)
to check the selection status of a label withitemID
.