tenforce / ember-mu-application-generator

Generator for a full browseable CRUD front-end for a mu-cl-resources back-end.
MIT License
0 stars 3 forks source link

BelongsTo Relation not shown #3

Closed asjongers closed 6 years ago

asjongers commented 7 years ago

I used the generator to create an application to change & display my graph store content. It's working quite fine, I can generate new resources and modify them without any problem... except on a specific resource. That resource sometimes appear with one (or more) "blank" belongsTo relation, even though both in the DB & the network tab, the linked resource is present.

I can change the link to another resource but as soon as I refresh, the cell will appear empty again.

As it doesn't mess with my data, it's not the biggest issue ever but I haven't been able to figure out where the problem was coming from on my own sooooo, here we are.

I'll copy the required info down below.

Screenshots of the issue: issue-generator-1 issue-generator-2

Resources model in domain.lisp:

(define-resource information ()
    :class (s-prefix "special:Information")
    :properties `(
    (:timestamp :datetime ,(s-prefix "special:timestamp"))
      (:label :string ,(s-prefix "special:label"))
      (:value :string ,(s-prefix "special:value"))
  )
  :has-one `(
        (subject :via ,(s-prefix "special:has_information")
          :inverse t
          :as "information-for")
      (information-type :via ,(s-prefix "special:has_information_type")
        :as "information-type")
      (information-origin :via ,(s-prefix "special:has_information_origin")
        :as "information-origin")
  )
    :has-many `(
        (consent :via ,(s-prefix "special:consent_for")
      :inverse t
      :as "consents")
    )
    :resource-base (s-url "http://temporary-namespace-special/resources/data_information/")
    :on-path "information")

(define-resource information-type ()
    :class (s-prefix "special:InformationType")
    :properties `(
      (:label :string ,(s-prefix "special:label"))
      (:name :string ,(s-prefix "special:name"))
      (:icon :string ,(s-prefix "special:icon"))
      (:tooltip :string ,(s-prefix "special:tooltip"))
      (:component :string ,(s-prefix "special:component"))
  )
  :has-one `(
      (information :via ,(s-prefix "special:has_information_type")
        :inverse t
        :as "type-for")
  )
    :resource-base (s-url "http://temporary-namespace-special/resources/data_information_type/")
    :on-path "information-types")

Relations as defined in Ember app models:

// Information
import Ember from 'ember';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';

export default Model.extend({
  // A string representation of this model, based on its attributes.
  // This is what mu-cl-resources uses to search on, and how the model will be presented while editing relationships.
  stringRep: Ember.computed.collect.apply(this,['id','timestamp', 'label', 'value']),

  timestamp: attr('datetime'),
  label: attr('string'),
  value: attr('string'),
  informationFor: belongsTo('subject', {inverse: "information" }),
  informationType: belongsTo('information-type', {inverse: "typeFor" }),
  informationOrigin: belongsTo('information-origin', {inverse: "originFor" }),
  consents: hasMany('consent', {inverse: "consentFor" })
});
// Information-type
import Ember from 'ember';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo } from 'ember-data/relationships';

export default Model.extend({
  // A string representation of this model, based on its attributes.
  // This is what mu-cl-resources uses to search on, and how the model will be presented while editing relationships.
  stringRep: Ember.computed.collect.apply(this,['id','label', 'name', 'icon', 'tooltip', 'component']),

  label: attr('string'),
  name: attr('string'),
  icon: attr('string'),
  tooltip: attr('string'),
  component: attr('string'),
  typeFor: belongsTo('information', {inverse: "informationType" })
});

Any help on this?

asjongers commented 6 years ago

As of 2017-11-20, I can no longer reproduce this issue. Closing.