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
Return all websites my default for API method Sites.getPatternMatchSites #8459
Conversation
…ternMatchSites
}); | ||
if (!limitPromise) { | ||
limitPromise = piwikApi.fetch({method: 'SitesManager.getNumWebsitesToDisplayPerPage'}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this request here, would it be better to allow specifying the limit as a HTML attribute in the directive? Then it could default to the result of this API call. I think since the result of this call is used to change how much data the site selector displays and not what it displays, it should be handled by the directive or controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it not as HTML attribute since we wanna get rid of our Controllers/Twig one day ;) and everything needs to be requested via API then. You're right it rather belongs to a JS controller or directive but put it here as it was easiest and it seems unlikely that we will reuse this model (eg loadSite
also belongs in controller etc and in other components like All Websites Dashboard we needed to access the MultiSites
API and not SitesManager
). I will have a look to move it to controller or directive probably by the end of the week
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, what I meant was adding it as a recognized attribute in the directive (ie, in the scope:
property) not so much a twig template :)
It's probably not necessary to move it for 2.15, maybe it would be a good idea for 3.0, just to keep technical debt from collecting. I'll leave it up to you whether a new ticket should be created.
@tsteur Feel free to merge if you don't want to move code from the siteselector model, I don't consider it required for this PR. |
Fixes #7700, return all websites my default for API method SitesManager.getPatternMatchSites and specify explicit limit in site selector directive. Includes new limit query parameter in SitesManager.getPatternMatchSites API used instead of filter_limit in order to keep the API method fast when there are tens or hundreds of thousands of sites.
fixes #7700
There's still a
$limit
URL parameter to make sure the All Websites Dashboard stays fast when having 30.000 websites or more.$limit
directly limits the number of websites in the MySQL query whereas$filter_limit
returns all sites and then removes the not needed sites in the response builder.