Skip to content
Snippets Groups Projects
Commit e3c3e38e authored by Mathis Neumann's avatar Mathis Neumann
Browse files

improve documentation

parent a8e84414
No related branches found
No related tags found
No related merge requests found
/**
* Adapters will automatically be used for API/EmberData interaction, using adapters which
* are have the same name as the model, with a fallback to Application adapter
* @module adapters
*/
import Ember from 'ember'; import Ember from 'ember';
import RESTAdapter from 'ember-data/adapters/rest'; import RESTAdapter from 'ember-data/adapters/rest';
// import FixtureAdapter from 'ember-data-fixture-adapter'; // import FixtureAdapter from 'ember-data-fixture-adapter';
import ENV from 'iobserve-ui/config/environment'; import ENV from 'iobserve-ui/config/environment';
/**
* basic adapter for non-system based APIs (currently just System)
*
* @class BaseAdapter
* @extends DS.RESTAdapter
*/
export default RESTAdapter.extend({ export default RESTAdapter.extend({
/**
* the hostname of the api
*
* @property host
* @type {String}
*/
host: ENV.APP.API_ROOT, host: ENV.APP.API_ROOT,
/**
* the namespace is a path prefix, used as a version prefix
* @property host
* @type {String}
* @default v1
*/
namespace: 'v1', namespace: 'v1',
/**
* the injected session which stores the system id
* @property host
* @type {Session}
* @readonly
*/
session: Ember.inject.service() session: Ember.inject.service()
}); });
\ No newline at end of file
...@@ -2,15 +2,45 @@ import BaseAdapter from './_baseAdapter'; ...@@ -2,15 +2,45 @@ import BaseAdapter from './_baseAdapter';
import UrlTemplates from "ember-data-url-templates"; import UrlTemplates from "ember-data-url-templates";
/** /**
* Basic Adapter for all models, except System.
* Automatically uses the id of the current system in the URL path
*
* @class ApplicationAdapter
* @param {UrlTemplate} * @param {UrlTemplate}
* @param {Object} configuration for templates * @param {Object} configuration for templates
* @return {Adapter} adapter that is used for all metamodel models * @return {Adapter} adapter that is used for all metamodel models
*/ */
export default BaseAdapter.extend(UrlTemplates, { export default BaseAdapter.extend(UrlTemplates, {
/**
* template for building the url for requests.
* See https://github.com/amiel/ember-data-url-templates
*
* @property urlTemplate
* @type {String}
*/
urlTemplate: '{+host}/{+namespace}/{pathForType}{/id}', urlTemplate: '{+host}/{+namespace}/{pathForType}{/id}',
/**
* Automatically uses the id of the current system
* Template for building the findAll url for requests.
* See https://github.com/amiel/ember-data-url-templates.
*
* @property urlTemplate
* @type {String}
*/
findAllUrlTemplate: '{+host}/{+namespace}/systems{/systemId}/{pathForType}/{?query*}', findAllUrlTemplate: '{+host}/{+namespace}/systems{/systemId}/{pathForType}/{?query*}',
/**
* segment which can be used by referencing the name in the template syntax.
* See https://github.com/amiel/ember-data-url-templates
* @type {Object}
*/
urlSegments: { urlSegments: {
/**
* gets the current id of the system from the session service
* @return {String} the id of the system
* @method urlSegments.systemId
*/
systemId() { systemId() {
return this.get('session.system.id'); return this.get('session.system.id');
} }
......
/**
* All models which represent data structures for API interaction.
* Uses EmberData
* @module models
*/
import Model from 'ember-data/model'; import Model from 'ember-data/model';
import attr from 'ember-data/attr'; import attr from 'ember-data/attr';
/**
* Model for a system which encapsulates all other models
* @class BaseEntity
* @extends DS.Model
* @public
*/
export default Model.extend({ export default Model.extend({
// id: attr('string') - not allowed to be listed by ember // id: attr('string') - not allowed to be listed by ember
/**
* id of the system this entity is contained in
*
* @property systemId
* @type {String}
* @public
*/
systemId: attr('string'), systemId: attr('string'),
/**
* a unique type identifier, see API documentation
*
* @property type
* @type {String}
* @public
* @readonly
*/
type: attr('string'), type: attr('string'),
/**
* the revisionNumber in which this object was created or updated from the ChangelogParser
*
* @property revisionNumber
* @type {Number}
* @public
*/
revisionNumber: attr('number'), revisionNumber: attr('number'),
/**
* the changelogSequence in which this object was created or updated from the ChangelogParser
*
* @property changelogSequence
* @type {Number}
* @public
*/
changelogSequence: attr('number'), changelogSequence: attr('number'),
/**
* the date in which this object was created or updated from the ChangelogParser
*
* @property lastUpdate
* @type {Date}
* @public
* @readonly
*/
lastUpdate: attr('date') lastUpdate: attr('date')
}); });
import Measurable from './measurable'; import Measurable from './measurable';
import attr from 'ember-data/attr'; import attr from 'ember-data/attr';
/**
* represents an abstract communication which groups multiple CommunicationInstances
* @class Communication
*/
const Model = Measurable.extend({ const Model = Measurable.extend({
/**
* name of the technology used for communication
* @property technology
* @type String
*/
technology: attr('string'), technology: attr('string'),
/**
* id of the ServiceInstance which is the sender
* @property sourceId
* @type String
*/
sourceId: attr('string'), sourceId: attr('string'),
/**
* id of the ServiceInstance which is the sender
* @property sourceId
* @type String
*/
targetId: attr('string'), targetId: attr('string'),
workload: attr('number') workload: attr('number')
}); });
......
import BaseEntity from './baseentity';
import attr from 'ember-data/attr';
const Model = BaseEntity.extend({
technology: attr('string'),
sourceId: attr('string'),
targetId: attr('string'),
workload: attr('number')
});
export default Model;
\ No newline at end of file
...@@ -2,8 +2,25 @@ import BaseEntity from './baseentity'; ...@@ -2,8 +2,25 @@ import BaseEntity from './baseentity';
import attr from 'ember-data/attr'; import attr from 'ember-data/attr';
import { memberAction } from 'ember-api-actions'; import { memberAction } from 'ember-api-actions';
/**
* Model for a system which encapsulates all
* @class System
* @extends BaseEntity
* @public
*/
const Model = BaseEntity.extend({ const Model = BaseEntity.extend({
/**
* name of the system
* @type {String}
* @property name
* @for System
* @public
*/
name: attr('string'), name: attr('string'),
/**
* loads the current revision for the system instance from the server (without caching)
* @type {Promise|RevisionResponse} plain JS object containing the revisionNumber (number), lastUpdate (Date string), changelogSequence (number)
*/
getRevision: memberAction({ path: 'revision', type: 'GET', urlType: 'findRecord'}) getRevision: memberAction({ path: 'revision', type: 'GET', urlType: 'findRecord'})
}); });
...@@ -15,4 +32,34 @@ Model.reopenClass({ ...@@ -15,4 +32,34 @@ Model.reopenClass({
}] }]
}); });
export default Model; export default Model;
\ No newline at end of file
/**
* Response object from a revision class. This is only for improving the documentation, there is no real class existing.
* @class RevisionResponse
* @public
*/
const Revision = {
// jshint unused:false
/**
*
* @property revisionNumber
* @type {Number}
* @readonly
*/
revisionNumber: null,
/**
* @property lastUpdate
* @type {String|Date}
* @readonly
*/
lastUpdate: null,
/**
* @property changelogSequence
* @type {Number}
* @readonly
*/
changelogSequence: null
};
\ No newline at end of file
...@@ -5,8 +5,8 @@ import Ember from 'ember'; ...@@ -5,8 +5,8 @@ import Ember from 'ember';
* *
* @class SingleDeploymentsRoute * @class SingleDeploymentsRoute
* @extends {Ember.Route} * @extends {Ember.Route}
* @public
* @module routes * @module routes
* @public
*/ */
export default Ember.Route.extend({ export default Ember.Route.extend({
session: Ember.inject.service(), // loads services/session.js session: Ember.inject.service(), // loads services/session.js
......
/**
* @modules services
*/
import Ember from 'ember'; import Ember from 'ember';
/** /**
......
...@@ -11,8 +11,20 @@ ...@@ -11,8 +11,20 @@
"linkNatives": true, "linkNatives": true,
"quiet": true, "quiet": true,
"parseOnly": false, "parseOnly": false,
"lint": true, "lint": false,
"themedir": "node_modules/yuidoc-bootstrap-theme", "themedir": "node_modules/yuidoc-bootstrap-theme",
"helpers": ["node_modules/yuidoc-bootstrap-theme/helpers/helpers.js"] "helpers": ["node_modules/yuidoc-bootstrap-theme/helpers/helpers.js"],
"external": {
"data": [
{
"base": "http://emberjs.com/api/",
"json": "http://builds.emberjs.com/tags/v2.4.0/ember-docs.json"
},
{
"base": "http://emberjs.com/api/",
"json": "http://builds.emberjs.com/tags/v2.4.0/ember-data-docs.json"
}
]
}
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment