-
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-136][Improvement] Loading for the dashboard #73
[MOD-136][Improvement] Loading for the dashboard #73
Conversation
ad2c1e8
to
0e16f50
Compare
c0a75ed
to
fce23bc
Compare
fce23bc
to
5dc2f39
Compare
Use skeleton screen on action-feed
5dc2f39
to
04b8a49
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.
Overall, looks awesome, just a smattering of small things.
Tiny bug: I think something happened moving data out of the route -- when I refresh the settings page, the count on the moderation tab is initially correct, then changes to 0
after a second.
...and there were some tests merged earlier today that this breaks, sorry about that.
@@ -1,14 +1,18 @@ | |||
{{#if listLoading}} | |||
{{loading-indicator classes='ball-dark text-center loading'}} | |||
{{#if (and loadActions.isRunning (not loadingMore))}} |
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 think we could get rid of loadingMore
and DRY this up a little...
{{#each actionsList ...}}
entry
{{else if (not loadActions.isRunning)}}
No actions
{{/if}}
{{#if loadActions.isRunning}}
dummy list
{{else if moreActions}}
see more
{{/if}}
app/controllers/index.js
Outdated
}, | ||
|
||
fetchData: task(function* () { | ||
yield timeout(1000); |
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 this left over from debugging?
app/routes/index.js
Outdated
@@ -1,26 +1,4 @@ | |||
import { inject as service } from '@ember/service'; | |||
import Route from '@ember/routing/route'; | |||
|
|||
export default Route.extend({ |
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.
Can we delete this file?
const page = this.get('page'); | ||
try { | ||
const results = yield this.get('currentUser.user') | ||
.then(user => this.get('store').queryHasMany(user, 'actions', { page })); |
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.
This isn't directly related to your changes, but would it load faster if we added embed: 'target'
here?
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.
Embedding isn't faster but it prevents the piecemeal loading.
loadActions: task(function* () { | ||
const page = this.get('page'); | ||
try { | ||
const results = yield this.get('currentUser.user') |
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.
Thoughts on the ember-concurrency idiom instead of chaining promises?
const user = yield this.get('currentUser.user');
const actions = yield this.get('store').queryHasMany(user, ...);
this.get('actionsList').pushObjects(actions.toArray());
...
nextPage() { | ||
this.incrementProperty('page'); | ||
this.set('loadingMore', true); | ||
this.loadPage(); | ||
this.get('loadActions').perform(); |
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.
If you add .drop()
to loadActions
, seems like we could safely increment page
inside it and get rid of nextPage
@@ -1,10 +1,6 @@ | |||
& { | |||
clear: both; | |||
|
|||
.entry-body { | |||
padding: 20px 15px; |
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.
Aw...I forgot about the hover box. The top of the list looks out of line with the provider box with top padding.
Remove extra file Chaining promises --> ember-concurrency Embed target DRY up code
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.
Found a little bug and had a few suggestions.
<div class="icon--skeleton">{{placeholder.icon}}</div> | ||
{{/content-placeholders}} | ||
<div class="action-body--skeleton"> | ||
{{#content-placeholders as |placeholder|}} |
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 these two {{#content-placeholders as |placeholder|}}
blocks be combined in one?
this.transitionToRoute('preprints.provider.preprint-detail', provider.get('id'), reviewable.get('id')); | ||
}, | ||
setupProvider(provider) { | ||
this.transitionToRoute('preprints.provider.setup', 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.
Uncaught TypeError: this.transitionToRoute is not a function
The router
service would help.
{{loading-indicator-page}} | ||
{{else}} | ||
{{#if showDashboard}} | ||
<div class='reviews-dashboard content'> |
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.
If we're doing all components, I think it'd be nice to make the landing page and dashboard separate components. Maybe the logic to switch between them would make sense on the controller? Not super important, but now seems like a convenient time to clean this up, if you don't mind...
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 request for providers is what messes up the other pages. So I can move some stuff around but I don't think the logic to switch between them can go in the controller since it's called when the app refreshes no matter what page the user is on (that was the bug on the settings page).
this.setProperties({ | ||
totalPages: Math.ceil(response.get('links.meta.total') / response.get('links.meta.per_page')), | ||
listLoading: false, | ||
actionsList: [], | ||
loadingMore: 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.
loadingMore
is gone
14662e0
to
6468cef
Compare
Condense placeholders
6468cef
to
4f66212
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.
Just one last thing, if it makes sense to you.
</div> | ||
<div class='col-md-8 col-md-pull-4'> | ||
{{action-feed | ||
toDetail=(action transitionToDetail) |
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.
Since transitionToDetail
is already a closure action, I think you could just do toDetail=transitionToDetail
. But more than that, it feels wrong to pass this action so far down (controller => reviews-dashboard => action-feed => action-feed-entry) when action-feed-entry could just use the router service and trigger a transition all by itself.
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 was trying to avoid that since it seems very anti-Ember but we are ignoring pretty much everything they recommend so I guess it doesn't really matter. I do hate passing things down 10 levels.
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 think it'd make more sense if these components were meant to be reusable outside this app, or the action varied depending on other state, or it did anything other than a simple transition.
They added router
, though, so I figure we may as well use 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.
@aaxelb, bad news. We can't use the router service yet because their is a bug that breaks when all query params aren't present. So when we try and use this.get('router').transitionTo(...)
we always get an error about the ticket query parameter on the application route.
"Assertion Failed: You passed the `false` query parameter during a transition into application, please update to ticket"
Fix release:
Apologies for not getting this in for 2.16, I'll get the changes into the next 2.17 beta release and once some folks can confirm all is working well for us I'll pull down into 2.16 for the LTS.
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.
That fix is in 2.16.1... we should upgrade. In another ticket.
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 nice, I missed that. I'll add a ticket 👍
<div class="text-center m-t-lg col-xs-12"> | ||
<div class="m-b-lg reviews-brand"></div> | ||
{{#if showSetup}} | ||
{{start-moderating action=(action setupProvider) providers=providersToSetup}} |
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.
Same thing here: It seems cleaner for start-moderating to use the router service and trigger the transition itself, rather than passing setupProvider
all the way down from the controller.
TODO
Changes