-
Notifications
You must be signed in to change notification settings - Fork 40
[IN-54][Ember-OSF] Update ember-osf to work with reviews and preprints #327
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
[IN-54][Ember-OSF] Update ember-osf to work with reviews and preprints #327
Conversation
* Update models for reviews API * ReviewLog adapter and serializer * Fix log creator model
…Science#3) * Include reviewable when creating review logs * Add title/contributors fields to preprint model * Clean up serializing relationships
…nScience#2) * Rename `review-log` to `action` * plac8 flake8 * Fix test errors
…r's add page (CenterForOpenScience#11) * Apply requested changes * rename * Apply requested changes * Fix * minor change * Apply requested change * Restore comment * Update search link
* Only use SCSS * Use/Upgrade ember-bootstrap * Update EmberCLI * Remove postinstall * Remove i18n hackery
| - dropzone-widget now has custom dropzone class that extends dropzone functionality to conditionally disallow folders and multiple files from being dropped | ||
| - 'Search' button in navbar to link to search page | ||
| - Consolidate logic for serializing dirty relationships into `osf-serializer` | ||
| - Override `relationshipTypes` in a serializer to include `fieldName: 'apiType'` pairs of all relationships which may be included when saving updates |
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 changes are already in develop (see three lines down), could you make sure this PR is based on the right branch/commit of ember-osf?
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.
Delete these lines
* update translation and total-share-results component
aaxelb
left a comment
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.
Looks pretty good, had a few thoughts and questions
| - dropzone-widget now has custom dropzone class that extends dropzone functionality to conditionally disallow folders and multiple files from being dropped | ||
| - 'Search' button in navbar to link to search page | ||
| - Consolidate logic for serializing dirty relationships into `osf-serializer` | ||
| - Override `relationshipTypes` in a serializer to include `fieldName: 'apiType'` pairs of all relationships which may be included when saving updates |
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.
Delete these lines
| { | ||
| name: session.get('isAuthenticated') ? 'eosf.navbar.myProjects' : 'eosf.navbar.browse', | ||
| href: session.get('isAuthenticated') ? serviceLinks.myProjects : serviceLinks.exploreActivity, | ||
| }, |
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 intend to add navbar links? That doesn't seem like it belongs in this PR.
| links.HOME.splice(1, 0, | ||
| { | ||
| name: 'eosf.navbar.support', | ||
| href: serviceLinks.osfSupport |
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, does this belong in this PR?
addon/utils/preprint-word.js
Outdated
| } | ||
|
|
||
| export default function preprintWord() { | ||
| const entries = ['document', 'paper', 'preprint', 'thesis']; |
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 should live in the translation file, so we can someday translate the site to other languages. I'd be in favor of updating the translation file to use the new keys (plural, singular, etc.), and maybe changing preprintWord to documentType.
| backendUrlConfig.accessToken = eitherConfig('PERSONAL_ACCESS_TOKEN'); | ||
| backendUrlConfig.isLocal = true; | ||
| if (eitherConfig('PERSONAL_ACCESS_TOKEN')) { | ||
| backendUrlConfig.accessToken = eitherConfig('PERSONAL_ACCESS_TOKEN'); |
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 seems redundant with the assignment to accessToken three lines up.
index.js
Outdated
| // This allows apps using this addon to import all the scss they want using "@import 'ember-osf'" | ||
| // The actual 'ember-osf' namespace is exported by app/styles/_ember-osf.scss | ||
| treeForStyles: function(tree) { | ||
| tree = this._super.treeForStyles.apply(this, arguments); |
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.
Don't assign to function arguments. This should probably be function() { and const tree = ...
tests/.jshintrc
Outdated
| @@ -0,0 +1,52 @@ | |||
| { | |||
| "predef": [ | |||
| "document", | |||
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.
Ironic that .jshintrc is formatted wrong.
| `); | ||
|
|
||
| assert.equal(this.$()[0].innerText, 'My Projects Search Support'); | ||
| assert.equal(this.$()[0].innerText, 'My Projects My Projects Search Support'); |
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.
Why are there two "My Projects"s?
| assert.ok(true, 'promise rejects on error'); | ||
| done(); | ||
| }); | ||
| assert.ok(stub.calledWithExactly('GET', request.url, {}), '_waterbutlerRequest was called with correct parameters'); |
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.
Your changes make sense, and are more like actual unit tests, but there are no longer tests for the methods you consistently stub, like _waterbutlerRequest.
…er-osf into feature/EOSF-915 # Conflicts: # package.json # yarn.lock
aaxelb
left a comment
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 seems like a good chunk of this is reinventing the ember-component-css wheel. Could we use that addon instead of all the manually-updated lists of stylesheets?
| @@ -0,0 +1,21 @@ | |||
| // Internal Styles | |||
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.
So this is a second file that needs to be updated for each new component? If this exists, it seems like it should be imported by addon/styles/addon.scss, instead of having two things to update.
Or we should use ember-component-css's built-in addon support, and remove both these lists.
| @@ -1,24 +1,27 @@ | |||
| // Internal Styles | |||
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.
Hm, I didn't realize we don't use ember-component-css. Maybe it didn't work with addons back when ember-osf was new, but it appears to support addons now. Not sure if this is beyond the scope of this ticket, but it would be good to use ember-component-css instead of this manual approach.
|
|
||
| // Outputs all pod scss files into the style tree but prefixed with ember-osf | ||
| // This allows apps using this addon to import all the scss they want using "@import 'ember-osf'" | ||
| // The actual 'ember-osf' namespace is exported by app/styles/_ember-osf.scss |
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 (again) feels like we're reinventing ember-component-css. It's possible there's a good reason for that, but I suspect that good reason may have expired a year ago.
|
|
||
| export default Ember.Service.extend({ | ||
| i18n: Ember.inject.service(), | ||
| getPreprintWord() { |
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 service doesn't do/provide anything that i18n doesn't already. What's the point of it?
| test: path.join(app.bowerDirectory, 'ember/ember-template-compiler.js') | ||
| }); | ||
| app.import(path.join(app.bowerDirectory, 'ember/ember-template-compiler.js')); | ||
| app.import(path.join(app.bowerDirectory, 'jquery-mockjax/dist/jquery.mockjax.js')); |
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.
Does this add mockjax to our production builds? I think we want it only in development.
aaxelb
left a comment
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'm fine with this as-is, given that it works with both preprints and reviews. I think there should be separate tickets to address a couple things (problems which existed before this PR):
- Use ember-component-css instead of a custom half-solution (see index.js, addon/styles/addon.scss, app/styles/_ember-osf.scss)
- Look at how "preprint words" works in reviews and preprints, figure out a unified solution to make sure translations are defined only once and (ideally) accessed in a consistent way
Otherwise, looks good.
(cc @alexschiller )
alexschiller
left a comment
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.
Alright, merging this into release/next-next-interfaces
Tickets have been created for the two things Abram was concerned about and all should be good 👍 and I've been briefed on all of the changes, so LGTM
df77162
into
CenterForOpenScience:release/next-next-interfaces
Purpose
Update ember-osf to have a unified version that works with preprints and reviews.
Summary of Changes
Side Effects / Testing Notes
This PR needs to be merged before the ember-preprints PR.
Ticket
https://openscience.atlassian.net/browse/IN-54
Another ticket is created to handle the needed changes for registries
Reviewer Checklist
CHANGELOG.md