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 piwik-reporting-menu directive to vue #18423

Merged
merged 418 commits into from Dec 9, 2021
Merged

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Dec 1, 2021

Description:

Changes:

  • Add jquery.js (no min.js) to asset ordering so it can be specified in addJavaScript files if its needed to debug jquery. Without this, it will be added out of order.
  • Migrate side-nav directive.
  • Migrate reporting-menu model service to store.
  • Migrate piwik-reporting-menu directive to vue.
  • Add a $timeout() call after AjaxHelper finishes a request (since angularjs triggers a digest after $http uses).
  • Move URL comma replacing logic to MatomoUrl.
  • Allow prepending notifications even if not going to a modal dialog.
  • Make reporting pages store adapter's more immutable.
  • Add clone helper method for creating angularjs adapters (angularjs adapter results are not allowed to modify Vue store data, but must still be mutable because angularjs expects it).
  • Fix to jqueryNativeEventTrigger.ts for click events on links.
  • Add window.widgetsHelper typings to index.d.ts.

image

Review

@diosmosis
Copy link
Member Author

Tests should be passing for this one. Fixed a bunch of smaller bugs towards the end.

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.

Left a couple of comments for stuff I found while looking through the code & test changes. Did not yet complete the manual testing. will add further comments if I find anything else...

Comment on lines +21 to +23
oldValue: null,
modifiers: {},
dir: {},
Copy link
Member

Choose a reason for hiding this comment

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

Just out of curiosity: Are those attributes needed for anything? Can't see that they are used anywhere 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

These are required by the DirectiveBinding interface in Vue. If you remove them, phpstorm should complain. Typescript will also complain, but possibly not when calling vue:build. For the adapter we're passing a fake object just to trigger the directive logic correctly.

plugins/Dashboard/tests/UI/DashboardManager_spec.js Outdated Show resolved Hide resolved
plugins/CoreHome/vue/src/ReportingMenu/ReportingMenu.vue Outdated Show resolved Hide resolved
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.

Had a quick look at the UI file changes. Seems one css change needs to be reverted. And on the PrivacyManager tests it looks like that before the All Websites entry was preselected in the site selector. Now that switched to a specific site. Would it be easy to change that? Otherwise we could also define that as expected behavior and add according attributes to the site selector on the privacy settings pages, so that all websites is preselected

plugins/CoreHome/stylesheets/layout.less Outdated Show resolved Hide resolved
@diosmosis
Copy link
Member Author

@sgiehl

And on the PrivacyManager tests it looks like that before the All Websites entry was preselected in the site selector. Now that switched to a specific site. Would it be easy to change that?

Oh, I thought it didn't have an initial site set, but it is initialized in the controller. Looked into a bit, this is a different issue, though I'm not sure what... Setting data on the vue app isn't working, it doesn't propagate to the root component in the app. Will see if I can figure it out.

@diosmosis
Copy link
Member Author

@sgiehl fixed it w/ an extra nextTick(). Not sure why this works, but it seems to.

@sgiehl
Copy link
Member

sgiehl commented Dec 8, 2021

@diosmosis there still seem to be some changes in the UI files that look unexpected. The usermanagers results changed, but imho they shouldn't have

Copy link
Contributor

@peterhashair peterhashair left a comment

Choose a reason for hiding this comment

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

working as expected, I think the test is being fixed.

@diosmosis
Copy link
Member Author

@sgiehl: @peterhashair was faster by a couple minutes, but it looks like the change was a fix to some broken behavior, the first failure is for role_for.png, in the test we select for a site named "relentless": https://github.com/matomo-org/matomo/blob/4.x-dev/plugins/UsersManager/tests/UI/UsersManager_spec.js#L68, but in the 4.x-dev screenshot the wrong site is selected. Will merge in a couple hours if there are no further comments.

@diosmosis diosmosis merged commit c77bd82 into 4.x-dev Dec 9, 2021
@diosmosis diosmosis deleted the vue-reporting-menu branch December 9, 2021 08:14
@sgiehl
Copy link
Member

sgiehl commented Dec 9, 2021

@diosmosis I guess some ui changes might still be some sort of incorrect:
tests/UI/expected-screenshots/Menus_admin_loaded.png shouldn't have been updated. Guess that one will now fail on 4.x-dev. Maybe you can directly fix that there.
plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png did you check why the menu switched from being displayed fully, to be collapsible? Fo me it looks like the menu isn't updated anymore when a dashboard has been removed.

@diosmosis
Copy link
Member Author

Maybe you can directly fix that there.
plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png did you check why the menu switched from being displayed fully, to be collapsible?

This works for me locally (when using tests/PHPUnit/proxy). It might be a race condition. The menu is updated, that's something I specifically had to fix (specifically due to a race condition w/ the jquery dashboard code not waiting for dashboard load to finish) though it might be possible the fix is in a different PR. I'll look a bit more to see if I can reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants