-
Notifications
You must be signed in to change notification settings - Fork 17
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
[MOD-165][Improvement] Add pending number next to moderation on dashboard #92
[MOD-165][Improvement] Add pending number next to moderation on dashboard #92
Conversation
c6c6e0b
to
48d0436
Compare
48d0436
to
01c8724
Compare
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.
Could cut the new requests in half, if not get rid of them entirely (with a backend change)
store: service(), | ||
theme: service(), | ||
|
||
tagName: 'ul', |
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.
These are now a bunch of lists with one item each, which seems weird.
fetchData: task(function* () { | ||
const provider = yield this.get('theme').loadProvider(this.get('provider.id')); | ||
const results = yield this.get('store').queryHasMany(provider, 'preprints', { | ||
'meta[reviews_state_counts]': true, |
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 counts are available on the provider, if you use ?related_counts=true
.
That only works when fetching one provider at a time, which would be fine, but if we wanted we could make a two-line change to the backend (would have sworn it already worked in the list view, alas) and get all the counts in that one request in load-providers
.
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.
Ahhhhh I was looking for that and I never found it...
}, | ||
|
||
fetchData: task(function* () { | ||
const provider = yield this.get('theme').loadProvider(this.get('provider.id')); |
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.
It feels wrong to use theme
on this non-provider-specific view. Could just ask store
for it.
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.
Yeah I tried using store
first but it didn't work. I'll try again though because it might have been user error.
@aaxelb, I considered changing the backend but we probably won't be able to get that released for a long time. What about adding a ticket for the backend changes in the next sprint as an improvement to this? |
@laurenbarker Sounds good to me. Depending how fast it loads with one request per provider, it might not be important to optimize. |
b6540f3
to
8a114eb
Compare
I'm not sure how to write tests for components that use ember-concurrency... I think it would involve refactoring the component so that the task is passed in. That way the task can be overwritten in tests. |
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.
Tiny nitpicks, otherwise 🇫🇯
app/styles/_util.scss
Outdated
@@ -2,3 +2,11 @@ | |||
pointer-events: none; | |||
opacity: 0.4; | |||
} | |||
|
|||
.unread-label { | |||
background-color: $color-bg-gray-light; |
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.
Are we back to 4-space indents for CSS?
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.
Oops... We should add a linter for that.
@@ -0,0 +1,42 @@ | |||
& { |
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.
Doesn't ember-component-css take care of making sure these styles only apply to this component? Do we need to wrap everything in & {}
?
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.
It's not for scoping; it allows you to set css on component. So really the only thing that needs to go in & {}
is the styling for the actual component. Should I pull everything else out?
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.
Ah, right, I skimmed right over the styles and just saw the classes. I guess it seems cleaner to use &
only for the styles on the component element itself, and pull everything else out, but that's not a strong preference.
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.
@aaxelb, they have been un-nested.
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 lied, I found a couple more nits to pick. Otherwise, 🇻🇺
<li> | ||
{{#link-to 'preprints.provider.moderation' provider.id}} | ||
{{t 'global.moderation'}} | ||
{{/link-to}} |
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.
FYI, because you took the time to remove the underline on the moderation count, you could get rid of this extended underline:
by stripping the whitespace inside the link-to
with strategic use of tildes
{{#content-placeholders as |placeholder|}} | ||
<span> | ||
<i class="fa-li icon--skeleton">{{placeholder.icon}}</i> | ||
{{placeholder.heading subtitle=false}} |
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.
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.
Did you run yarn install
? I made a change to ember-content-placeholders
.
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.
Oh whoops, I did not. All good 👍
Oh, and add this to the changelog, please! |
Update changelog
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.
🇹🇻
Purpose
Display pending count next to moderation on dashboard.
Changes
Before
After