How to use the ember-data-model-fragments/attributes.array function in ember-data-model-fragments

To help you get started, we’ve selected a few ember-data-model-fragments examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github danielspaniel / ember-data-change-tracker / tests / dummy / app / models / user.js View on Github external
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';
import {array, fragment, fragmentArray} from 'ember-data-model-fragments/attributes';

export default Model.extend({
  changeTracker: {trackHasMany: true, auto: true, enableIsDirty: true},
  name: attr('string'),
  style: attr('string'),
  // object type
  info: attr('object'),
  blob: attr('json'),
  // fragments
  list: array('number'),
  location: fragment('location'),
  things: fragmentArray('things'),
  // associations
  company: belongsTo('company', { async: true, polymorphic: true }),
  profile: belongsTo('profile', { async: false }),
  projects: hasMany('project', { async: true }),
  pets: hasMany('pet', { async: false, polymorphic: true })
});
github hashicorp / consul / ui / packages / consul-ui / app / models / health-check.js View on Github external
allowedValues: ['serf', 'script', 'http', 'tcp', 'ttl', 'docker', 'grpc', 'alias'],
  },
};

export default class HealthCheck extends Fragment {
  @attr('string') Name;
  @attr('string') CheckID;
  // an empty Type means its the Consul serf Check
  @replace('', 'serf') @attr('string') Type;
  @attr('string') Status;
  @attr('string') Notes;
  @attr('string') Output;
  @attr('string') ServiceName;
  @attr('string') ServiceID;
  @attr('string') Node;
  @nullValue([]) @array('string') ServiceTags;
  @attr() Definition; // {}

  // Exposed is only set correct if this Check is accessed via instance.MeshChecks
  // essentially this is a lazy MeshHealthCheckModel
  @attr('boolean') Exposed;

  @computed('ServiceID')
  get Kind() {
    return this.ServiceID === '' ? 'node' : 'service';
  }

  @computed('Type')
  get Exposable() {
    return ['http', 'grpc'].includes(this.Type);
  }
}
github danielspaniel / ember-data-factory-guy / tests / dummy / app / models / employee.js View on Github external
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { array, fragment, fragmentArray } from 'ember-data-model-fragments/attributes';

export default Model.extend({
  designation: fragment('name'),
  name: fragment('name'),
  titles: array('string'),
  gender: attr('string'),
  birthDate: attr('date'),
  position: attr(),
  departmentEmployments: fragmentArray('department-employment')
});
github danielspaniel / ember-data-factory-guy / tests / dummy / app / models / salary.js View on Github external
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { array } from 'ember-data-model-fragments/attributes';

export default Model.extend({
  income: attr('number'),
  benefits: array('string')
});
github hashicorp / consul / ui / packages / consul-ui / app / models / intention-permission-http.js View on Github external
export const schema = {
  PathType: {
    allowedValues: ['PathPrefix', 'PathExact', 'PathRegex'],
  },
  Methods: {
    allowedValues: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
  },
};

export default class IntentionPermissionHttp extends Fragment {
  @attr('string') PathExact;
  @attr('string') PathPrefix;
  @attr('string') PathRegex;

  @fragmentArray('intention-permission-http-header') Header;
  @array('string') Methods;

  @or(...schema.PathType.allowedValues) Path;

  @computed(...schema.PathType.allowedValues)
  get PathType() {
    return schema.PathType.allowedValues.find(prop => typeof this[prop] === 'string');
  }
}
github streamlink / streamlink-twitch-gui / src / app / data / models / twitch / ticket / product / features / fragment.js View on Github external
import attr from "ember-data/attr";
import Fragment from "ember-data-model-fragments/fragment";
import { array } from "ember-data-model-fragments/attributes";


export default class TwitchTicketProductFeatures extends Fragment {
	@attr( "number" )
	base_emoticon_set_id;
	@array( "number" )
	emoticon_set_ids;
	@attr( "string" )
	tier;
}
github hashicorp / consul / ui-v2 / app / models / intention-permission-http.js View on Github external
export const schema = {
  PathType: {
    allowedValues: ['PathPrefix', 'PathExact', 'PathRegex'],
  },
  Methods: {
    allowedValues: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
  },
};

export default Fragment.extend({
  PathExact: attr('string'),
  PathPrefix: attr('string'),
  PathRegex: attr('string'),

  Header: fragmentArray('intention-permission-http-header'),
  Methods: array('string'),

  Path: or(...schema.PathType.allowedValues),
  PathType: computed(...schema.PathType.allowedValues, function() {
    return schema.PathType.allowedValues.find(prop => typeof this[prop] === 'string');
  }),
});