Coder Social home page Coder Social logo

centerforopenscience / ember-osf Goto Github PK

View Code? Open in Web Editor NEW
15.0 11.0 38.0 10.27 MB

Ember Addon for interacting with the Open Science Framework

Home Page: http://centerforopenscience.github.io/ember-osf/

License: Apache License 2.0

JavaScript 76.27% HTML 0.37% CSS 0.02% Dockerfile 0.05% Handlebars 20.30% SCSS 2.99%
osf ember science addon

ember-osf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-osf's Issues

The link for replies relationships has a syntax error in the query params.

For example, when requesting a list of comments for a project ...

Request: GET /v2/nodes/<project_id>/comments/?filter[target]=<project_id>

I get this response:

...
"replies": {
  "links": {
     "related": {
        "href" : "https://staging-api.osf.io/v2/nodes/<project>/comments/?filter=%5Btarget%5D=ug69r64m5asn"

where the query params are ?filter=[target]=ug69r64m5asn
there is an extra '=' that should be removed.
the link should look like this ?filter[target]=ug69r64m5asn

I believe this is causing complications for our application when trying to retrieve comments' replies.
This may also be related to similar problems reported in #95

Dates possibly not being loaded from data

I noticed that the date created and modified are both wrong. After investigating the issue, I found that they are sent in the json, but end up blank. Looking at this ember-moment code inside helper-compute.js, I discovered this:

if (isBlank(datetime)) {
  if (allowEmpty) {
    return;
  } else {
    Ember.Logger.warn('ember-moment: an empty value (null, undefined, or "") was passed to moment-format');
  }
}

The warning is logged which implies that it is coming back as blank.Title and category work fine and even setting the attr type of dateCreated and dateModified to string didn't do anything either. It still came in empty.

Cannot Get Client ID

So whatever was updated most recently has broke our ability to develop further on our own app. I followed your README.md file and I am assuming that you want me to run the configuration within my own app root folder. I have created a .yml file in my config directory that has the same name as my computer name "my_computer.yml". When I try to run the ember server using BACKEND=stage ember s, I get a error: WARNING: No configurations found in configuration directory:/home/username/Documents/Projects//osf-ember-app/ember-osf/config and a lot of WARNING: you have specified a backend 'stage' that you have not configured in your config/<hostname>.yml

The server starts, but when it sends me to the OSF login, I get undefined for client id and the token in the URL, and an error from OSF stating that the client id is a invalid or missing parameter.

If I run ember g ember-osf-settings echo $HOSTNAME, I get an error about ENOENT: no such file or directory and the directory in question is node_modules/node-sass/vendor having , and everything instantly breaks. No configuration file is even created. So now in my ember-osf directory I cannot even get the dummy app to run. In my own app, I can't get past OSF authentication because of the client ID.

Look into comments

Two things to look into:

  • The Node.comments relationship is not filtering correctly. We may need to double check the that this uses the URL provided in the relationships link on the Node's payload.
  • The Comment.replies relationships also is not filtering correctly.

Fix a broken reference in models/node.js

Hi,

I had a problem calling node.save(); which resulted in this error:

TypeError: Cannot read property 'get' of undefined
    at node.js:140
    at Array.filter (<anonymous>)
    at Class.save (node.js:139)
    at Class.superWrapper [as save] (ember.debug.js:45374)

I found the culprit in addons/models/node.js
Within the line

contributors.members.list.filter(m => !m.record.get('isNew') ...

Where record was not found in m. However, I did find that m contained _record.

So my solution was to just change all references of m.record to m._record and this fixed the issue for me. Not entirely sure if this is a correct solution though.

Remove Bootstrap Dependencies

This maybe more of a feature request, but I think that all Bootstrap dependencies should be removed. We are using Semantic-UI in our project and of course they conflict. There are Bootstrap dependencies in the ember-cli-build.js file and bower.json. The dummy app really does not need Bootstrap.

Fix modelFor('application') in dummy app's nodes route

The nodes route is trying to fetch the current user (loaded in the application route's model hook-- this.modelFor('application')). Unfortunately the application route's model hook is only run once (when the SPA is first loaded) and there is a slight timing issue between the dummy app's login route (which parses the OAuth token from the query string and "logs in" the user) and when the application route runs. Basically on redirect from the OSF CAS:

ApplicationRoute.model returns null -> LoginRoute parses token and authenticates user -> redirected to index page -> you click "My Nodes", but the ApplicationRoute's model is still null

So when you refresh the page or visit the nodes page directly, the ApplicationRoute is able to correctly fetch the current user.

Server intermittently omits the Access-Control-Allow-Origin header from XHR responses.

Sorry for the lack of useful information on this one. At the moment, the problem seemingly occurs at random when issuing a batch of requests. I'm seeing an error that looks like this:

XMLHttpRequest cannot load https://staging-api.osf.io/v2/nodes/<node_id>/. 
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:4200' is therefore not allowed access.

The only info I have is this:

  • At a rough estimate, I'll say that it happens about 1 out of every 10 requests.
  • It seems it can happen with any OSF endpoint, but have observed /v2/nodes/, node relationship links, and /v2/users/
  • It seems? that I'm able to greatly mitigate the problem by throttling requests down to ~1 per second (at the cost of making the user wait for page content).
  • I've only tested against host staging-api.osf.io.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.