@diosmosis opened this Pull Request on May 18th 2022 Member


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


This Pull Request was closed on May 24th 2022
Powered by GitHub Issue Mirror