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] remove angularjs from the Live plugin #19418

Merged
merged 36 commits into from Aug 25, 2022
Merged

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Jun 28, 2022

Description:

This PR is based off of #19390.

Changes:

  • Add Passthrough component to CoreHome for easy way to conditionally surround elements w/ a component (see LivePage.vue for use).
  • Move twig contents in Live that use angularjs directives to new Vue components.
  • Replace uses of $rootScope.$emit w/ Matomo.postEvent.

Review

…ainer for more convenient embedding of vue-entry use from within other Vue components (primarily for supporting twig Template... events in Vue).
@diosmosis diosmosis marked this pull request as draft June 28, 2022 00:07
@diosmosis diosmosis added the Needs Review PRs that need a code review label Jul 11, 2022
@diosmosis diosmosis marked this pull request as ready for review July 11, 2022 02:28
@github-actions
Copy link
Contributor

This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers

@github-actions github-actions bot added the Stale The label used by the Close Stale Issues action label Jul 19, 2022
@diosmosis diosmosis added the Do not close PRs with this label won't be marked as stale by the Close Stale Issues action label Jul 19, 2022
@github-actions github-actions bot removed the Stale The label used by the Close Stale Issues action label Jul 20, 2022
@github-actions
Copy link
Contributor

This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers

@github-actions github-actions bot added the Stale The label used by the Close Stale Issues action label Jul 28, 2022
@diosmosis
Copy link
Member Author

@sgiehl I see, should be fixed

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
Copy link
Member

sgiehl commented Aug 16, 2022

@diosmosis found another issue. It seems that the real time widget looses its head on the first refresh. Guess that is caused by this code:

AjaxHelper.fetch(
{
module: 'Live',
action: 'ajaxTotalVisitors',
segment,
},
{
format: 'html',
},
).then((r) => {
$(el).find('#visitsTotal').replaceWith(r);
});

Guess the vue component would need to be initialized after the content was replaced...

@diosmosis
Copy link
Member Author

@sgiehl fixed

@sgiehl
Copy link
Member

sgiehl commented Aug 17, 2022

@diosmosis this seems to work on the real time page now. but not when displayed as a widget. In the widget the header seems not to be replaced at all.

@diosmosis
Copy link
Member Author

@sgiehl interesting, I only tested in the widget on the dashboard. Tested again on both sites and it works for me. Could it be a caching issue on your end? Can you test again?

@sgiehl
Copy link
Member

sgiehl commented Aug 18, 2022

Tried it again. But it still doesn't work in the widget. I can see that the requests are sent out. But the result seems not be placed in the widget. I have the visitor generator running in parallel to ensure the numbers in the widget would change. So I'm able to validated that they don't 🤷

@diosmosis
Copy link
Member Author

Ok, I'll try again w/ visitor generator running in parallel

@diosmosis
Copy link
Member Author

diosmosis commented Aug 19, 2022

@sgiehl ok, its definitely working for me. I looked at the network tab for getLastVisitsStart requests and checked that the response was used when completed. When the response had different HTML there was a visual change in the widget. I did notice however, it took quite a while for that response to actually be different. From previous experience w/ the visitor generator I think it might be due to time zone issues w/ visits being tracked, or visits tracked out of order, or something like that, so they don't always register as more recent than what's displayed.

@sgiehl
Copy link
Member

sgiehl commented Aug 22, 2022

@diosmosis the list of visits is refreshing correctly. What doesn't seem to refresh is the summary above. That should be handled by the request for ajaxTotalVisitors. The numbers shown for last 24h / 30m always stay the same, even if the request would contain other numbers.

@diosmosis
Copy link
Member Author

@sgiehl I see, I get it now. Apologies it took a while for me to understand. Will take a look.

@diosmosis
Copy link
Member Author

@sgiehl Ok, I checked again, and this is working for me too. I saw the following scenarios:

  • The visits list doesn't change, so the following code in live.js does not trigger:

    if ($('#' + visitId, this.element).html() != $(item).html()) {
        this.updated = true;
    }
    

    This results in the onUpdate() function not being called, which means the count doesn't update.

  • The visits list changes, but ajaxTotalVisits returns the same count as before.

  • The visits list changes and the ajaxTotalVisits request returns a different count, in which case it updates.

Can you check that:

  • the getLastVisitsStart request returns something different
  • when it does, ajaxTotalVisits is then requested,
  • when the response for ajaxTotalVisits is different, the value is updated in the UI
    ?

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.

Can't see any further issues right now.

@sgiehl sgiehl merged commit f679725 into 5.x-dev Aug 25, 2022
@sgiehl sgiehl deleted the vue-remove-angularjs-Live branch August 25, 2022 12:46
@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 Sep 29, 2022
bx80 pushed a commit that referenced this pull request Nov 25, 2022
* Remove use of angularjs from SitesManager plugin and add VueEntryContainer for more convenient embedding of vue-entry use from within other Vue components (primarily for supporting twig Template... events in Vue).

* remove use of angularjs from Live plugin

* built vue files

* forgot to export

* built vue files

* fix ui test issues

* move inline script to vue directive + fix a couple vue warnings

* remove use of unneeded html_attr escape

* remove use of unneeded twig html_attr escape

* use html filter explicitly

* use href so command+click works

* get rid of two vue warnings

* use anonymous function for jquery event so this can be used properly

* destroy/compile vue components when refreshing live widget

* built vue files

* try to fix live refresh issue

* improve css, so whitespaces are always hidden between images

Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: sgiehl <sgiehl@users.noreply.github.com>
bx80 pushed a commit that referenced this pull request Nov 25, 2022
* Remove use of angularjs from SitesManager plugin and add VueEntryContainer for more convenient embedding of vue-entry use from within other Vue components (primarily for supporting twig Template... events in Vue).

* remove use of angularjs from Live plugin

* built vue files

* forgot to export

* built vue files

* fix ui test issues

* move inline script to vue directive + fix a couple vue warnings

* remove use of unneeded html_attr escape

* remove use of unneeded twig html_attr escape

* use html filter explicitly

* use href so command+click works

* get rid of two vue warnings

* use anonymous function for jquery event so this can be used properly

* destroy/compile vue components when refreshing live widget

* built vue files

* try to fix live refresh issue

* improve css, so whitespaces are always hidden between images

Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: sgiehl <sgiehl@users.noreply.github.com>
bx80 pushed a commit that referenced this pull request Nov 25, 2022
* Remove use of angularjs from SitesManager plugin and add VueEntryContainer for more convenient embedding of vue-entry use from within other Vue components (primarily for supporting twig Template... events in Vue).

* remove use of angularjs from Live plugin

* built vue files

* forgot to export

* built vue files

* fix ui test issues

* move inline script to vue directive + fix a couple vue warnings

* remove use of unneeded html_attr escape

* remove use of unneeded twig html_attr escape

* use html filter explicitly

* use href so command+click works

* get rid of two vue warnings

* use anonymous function for jquery event so this can be used properly

* destroy/compile vue components when refreshing live widget

* built vue files

* try to fix live refresh issue

* improve css, so whitespaces are always hidden between images

Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: sgiehl <sgiehl@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do not close PRs with this label won't be marked as stale by the Close Stale Issues action 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