-
Notifications
You must be signed in to change notification settings - Fork 8.6k
DEV: Change admin site settings filter to be route based #33167
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
Conversation
21b7efa
to
c1eb0dd
Compare
f241e92
to
93cd89c
Compare
93cd89c
to
193dd0e
Compare
siteSettings: categories[n], | ||
}; | ||
}); | ||
static async findAll(params = {}) { |
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.
The only change here is to add async
/await
. Unfortunately that touches all lines.
this.router.replaceWith( | ||
"adminSiteSettingsCategory", | ||
this.controllerFor("adminSiteSettings").get("visibleSiteSettings")[0] | ||
.nameKey | ||
); |
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.
No need to be so fancy here. This just evaluates to "required"
.
if (!controller.get("visibleSiteSettings")) { | ||
controller.set("visibleSiteSettings", siteSettings); | ||
async model(params) { | ||
if (!this._siteSettings) { |
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.
We could consider clearing this when exiting the site settings area so it has to be refetched, but I'm not sure if that'd serve any use TBH.
Looks good to me. I also played with that on my local and didn't notice any regression 🎊 |
app/assets/javascripts/admin/addon/routes/admin-site-settings.js
Outdated
Show resolved
Hide resolved
filteredContent(category) { | ||
return category ? category.siteSettings : []; | ||
} | ||
@alias("model") filteredSiteSettings; |
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.
do we need alias each time? (this one and the ones in app/assets/javascripts/admin/addon/controllers/admin-site-settings.js). I don't like alias it makes things super hard to debug.
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.
Is it the decorator that interferes with debugging? I.e. would manually defining a getter be okay?
app/assets/javascripts/admin/addon/routes/admin-site-settings-category.js
Outdated
Show resolved
Hide resolved
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.
Only few comments, which are not directly related to your change for most of them, would be nice to get to it, but I can already approve it. Thanks!
What is this change?
The filtering is currently being done in the controller. This leads to weird things where the filter loop might already be initiated and we get double filtering, as well as the issue that we can't abort like we could with a route transition.
How does it work?
model
in the route.