Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support group in widget item #118

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

mournfulCoroner
Copy link
Contributor

@mournfulCoroner mournfulCoroner commented Mar 6, 2024

Support for plugins that include a group of items. Each of the items should affect the state as if it were an independent element, but still be part of the same widget
The changes include edits in the setItem, the formation of queues and a state, the addition of a method addGroupToQueue
In onStateAndParamsChange there's need to put groupItemsIds in options for correct work

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

itemIds = [id].concat(item.data.tabs.map((tab) => tab.id));
}
if (isItemWithGroup(item)) {
itemIds = [id].concat(item.data.group.map((tab) => tab.id));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tab -> group

config: Config;
itemsStateAndParams: ItemsStateAndParams;
}

function getActualItems(items: ConfigItem[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here u receive items ids - not items
maybe rename like getActualItemsIds?

}).toEqual(addToQueue({id: DEFAULT_CONTROL_ID, config, itemsStateAndParams}));
});

it('remove unused items from queue after adding new item', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u add case where we have 1 items with 2 different groups in queue but one group id doesn't exist in the config? And we add something to queue - it should delete this group id from queue

@@ -392,6 +531,7 @@ export class UpdateManager {
const newTabId: string | undefined = stateAndParams.state?.tabId;
const isTabSwitched = isItemWithTabs(initiatorItem) && Boolean(newTabId);
const currentMeta = getItemsStateAndParamsMeta(itemsStateAndParams);
const groupItemId = options?.groupItemId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we add options.groupItemsIds instead of options.groupItemId?
Maybe sometimes you don't need update all groups in queue or you want to control order in queue for update all groups.

@mournfulCoroner mournfulCoroner added this pull request to the merge queue Mar 7, 2024
Merged via the queue into main with commit f480ee6 Mar 7, 2024
3 checks passed
@mournfulCoroner mournfulCoroner deleted the feat-support-group-in-widget branch March 7, 2024 15:12
mournfulCoroner added a commit that referenced this pull request Mar 7, 2024
* feat: support group in widget item

* chore: add tests

* fix: review issues
mournfulCoroner added a commit that referenced this pull request Mar 7, 2024
* feat: support group in widget item

* chore: add tests

* fix: review issues
mournfulCoroner added a commit that referenced this pull request Mar 7, 2024
* feat: support group in widget item

* chore: add tests

* fix: review issues
mournfulCoroner added a commit that referenced this pull request Mar 11, 2024
* feat: support group in widget item

* chore: add tests

* fix: review issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants