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] migrate manage goals directive and twig templates to Vue #18917

Merged
merged 21 commits into from Mar 11, 2022

Conversation

diosmosis
Copy link
Member

Description:

Changes:

  • Convert _addEditGoal.twig and dependent twig templates + piwik-manage-goals directive to Vue.
  • Add exception for target=_blank to DOMPurify configuration (only if rel="noopener noreferrer" is present).
  • Allow model value for FieldCheckbox to be a number as well as boolean.
  • Remove use of const in piwikHelper.js as that should be vanilla JS.
  • Modify piwikHelper.compileVueEntryComponents so it can support multiple named slots.

Notes:

  • There are several twig events that had to be respected during migration. BC is provided through two separate methods:
    • vue-entry + named slots: Using the Vue component directly (ManageGoals), and supplying named slots where the twig postEvent call is used. This is the simpler approach and works in cases where the twig template was not parameterized. It doesn't work when, eg, the event is called inside a twig for loop, as that can't be translated to a v-for loop in the frontend.
    • using {% set %} to save the result of a postEvent call in twig, passing this into the template, and referencing this as a dynamic component via <component :is=.... This allows us to iterate over data in the twig template, save the result and pass it to Vue for use. The <component :is usage is done specifically so the HTML is directly inserted. Using v-html would require a parent element which is not always acceptable (eg, when a postEvent() call is made between <th> or <td> elements.

Both approaches will be documented.

Review

@diosmosis diosmosis added this to the 4.9.0 milestone Mar 9, 2022
@diosmosis diosmosis marked this pull request as draft March 9, 2022 21:05
@diosmosis diosmosis added the Needs Review PRs that need a code review label Mar 9, 2022
@diosmosis diosmosis marked this pull request as ready for review March 9, 2022 23:55
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

@diosmosis This seems to work smoothly on the reporting pages. But when going to goal management within the admin it seems the info about funnels and multi attribution are not shown:

image

It's also not loaded when editing or creating the goal there.

plugins/Goals/vue/src/ManageGoals/ManageGoals.vue Outdated Show resolved Hide resolved
…g events since piwik-manage-goals is selected for in plugins and because angularjs directives are sometimes pre-compiled, sometimes not
@diosmosis
Copy link
Member Author

@sgiehl hopefully its fixed

@sgiehl sgiehl removed the Needs Review PRs that need a code review label Mar 11, 2022
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

works now 👍

@sgiehl sgiehl merged commit 222f2d9 into 4.x-dev Mar 11, 2022
@sgiehl sgiehl deleted the vue-manage-goals branch March 11, 2022 10:41
@justinvelluppillai justinvelluppillai added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Apr 11, 2022
@diosmosis diosmosis restored the vue-manage-goals branch May 23, 2022 19:24
@sgiehl sgiehl deleted the vue-manage-goals branch April 5, 2023 16:35
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

4 participants