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

[Vue] add manage goals store to share loaded idGoal with plugin components that extend goal management #19236

Merged
merged 7 commits into from May 24, 2022

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented May 18, 2022

Description:

Plugins can extend goal management with their own components. Each component provided by a plugin has to access the currently edited goal's ID. W/ angularjs this was done by looking for the manage goals root HTML element and getting the "show-goal" attribute, which was previously used to initiate an angularjs directive. This PR changes the system to use a store. ManageGoals sets a value in the store, and other components can read it at any given time. Vue's watch() method can be used to watch the idGoal if needed.

PiwikApiMock is also exported as it's used in an event and having the type is useful for the TypeScript migrations of some premium features. (It will still be removed in Matomo 5.)

Other changes (related to funnels):

  • allow vue-entry components to be used in the edit goal template event
  • for checkbox fields, undo the DOM .checked property change before emitting a model value change, so the parent component can decide whether it goes through. I had thought vue would do this itself since in this case the modelValue wouldn't match what the template sets it to, but I think since the value doesn't change, Vue doesn't initiate change detection and nothing happens, leaving the DOM value toggled. This would allow, for example, showing a modal when unchecking a checkbox to ask if the user is sure (which is done in Funnels when attempting to deactivate a funnel).
    • added this behavior to every field so the lock/unlock logic can be used for any field type
  • bump version to beta so plugin builds will be able to use this code

Review

@diosmosis diosmosis added this to the 4.11.0 milestone May 18, 2022
@diosmosis diosmosis marked this pull request as draft May 18, 2022 19:43
@diosmosis diosmosis marked this pull request as ready for review May 23, 2022 15:48
@diosmosis diosmosis added the Needs Review PRs that need a code review label May 23, 2022
@diosmosis diosmosis merged commit 4012707 into 4.x-dev May 24, 2022
@diosmosis diosmosis deleted the vue-manage-goals-store branch May 24, 2022 11:29
@justinvelluppillai justinvelluppillai added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. and removed Needs Review PRs that need a code review labels Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants