Skip to content

Conversation

@sheriefvt
Copy link
Contributor

@sheriefvt sheriefvt commented Dec 8, 2017

Purpose

Update ember-osf to have a unified version that works with preprints and reviews.

Summary of Changes

  • Merge changes and resolve conflicts between develop and feature/reviews branches
  • Update dependencies
  • Update translation service
  • Update ember-cli-build
  • Add new service for preprint-words with a unit test
  • Refactor/update existing tests

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

  • meets requirements
  • easy to understand
  • DRY
  • testable and includes test(s)
  • changes described in CHANGELOG.md

aaxelb and others added 30 commits September 14, 2017 09:18
* 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
Copy link
Contributor

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?

Copy link
Contributor

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
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.

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

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

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

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?

}

export default function preprintWord() {
const entries = ['document', 'paper', 'preprint', 'thesis'];
Copy link
Contributor

@aaxelb aaxelb Dec 14, 2017

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

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

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

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

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

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.

@laurenbarker laurenbarker changed the title [Improvement][EOSF-915] Update ember-osf to work with reviews and preprints [Improvement][IN-54] Update ember-osf to work with reviews and preprints Jan 25, 2018
@alexschiller alexschiller changed the title [Improvement][IN-54] Update ember-osf to work with reviews and preprints [IN-54][Ember-OSF] Update ember-osf to work with reviews and preprints Jan 25, 2018
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.

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

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

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

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() {
Copy link
Contributor

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

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.

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'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 )

@laurenbarker
Copy link
Contributor

Created IN-162 for the ember-component-css change and IN-163 for the preprint word improvement.

@alexschiller alexschiller changed the base branch from develop to release/next-next-interfaces February 12, 2018 18:54
Copy link
Contributor

@alexschiller alexschiller left a 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

@alexschiller alexschiller merged commit df77162 into CenterForOpenScience:release/next-next-interfaces Feb 12, 2018
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.

5 participants