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

[MOD-165][Improvement] Add pending number next to moderation on dashboard #92

Merged
merged 6 commits into from
Nov 14, 2017

Conversation

laurenbarker
Copy link
Contributor

Purpose

Display pending count next to moderation on dashboard.

Changes

  • Added request to get the pending number for each provider.
  • Added skeleton screen for dashboard sidebar.

Before

screen shot 2017-11-09 at 3 27 06 pm

After

screen shot 2017-11-09 at 3 04 35 pm

Copy link
Contributor

@aaxelb aaxelb left a 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',
Copy link
Contributor

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,
Copy link
Contributor

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.

Copy link
Contributor Author

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'));
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 18.482% when pulling 01c8724 on laurenbarker:improvement/MOD-165 into 9a54212 on CenterForOpenScience:develop.

@laurenbarker
Copy link
Contributor Author

@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?

@aaxelb
Copy link
Contributor

aaxelb commented Nov 9, 2017

@laurenbarker Sounds good to me. Depending how fast it loads with one request per provider, it might not be important to optimize.

@laurenbarker
Copy link
Contributor Author

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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 18.519% when pulling 8a114eb on laurenbarker:improvement/MOD-165 into 9a54212 on CenterForOpenScience:develop.

Copy link
Contributor

@aaxelb aaxelb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nitpicks, otherwise 🇫🇯

@@ -2,3 +2,11 @@
pointer-events: none;
opacity: 0.4;
}

.unread-label {
background-color: $color-bg-gray-light;
Copy link
Contributor

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?

Copy link
Contributor Author

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 @@
& {
Copy link
Contributor

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 & {}?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 18.519% when pulling aa75d36 on laurenbarker:improvement/MOD-165 into 9a54212 on CenterForOpenScience:develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 18.519% when pulling dcf90cb on laurenbarker:improvement/MOD-165 into 9a54212 on CenterForOpenScience:develop.

Copy link
Contributor

@aaxelb aaxelb left a 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}}
Copy link
Contributor

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:
screen shot 2017-11-14 at 3 12 55 pm
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}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's still adding a subtitle, and it looks weird:
screen shot 2017-11-14 at 3 11 54 pm

Copy link
Contributor Author

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.

Copy link
Contributor

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 👍

@aaxelb
Copy link
Contributor

aaxelb commented Nov 14, 2017

Oh, and add this to the changelog, please!

Update changelog
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 18.519% when pulling a740cb5 on laurenbarker:improvement/MOD-165 into 9a54212 on CenterForOpenScience:develop.

Copy link
Contributor

@aaxelb aaxelb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🇹🇻

@aaxelb aaxelb merged commit 7a8b800 into CenterForOpenScience:develop Nov 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants