2018-03-21 21:18:08 +00:00
|
|
|
define([
|
|
|
|
'lodash'
|
|
|
|
], function (
|
|
|
|
_
|
|
|
|
) {
|
|
|
|
|
|
|
|
var METADATA_BY_TYPE = {
|
|
|
|
'generator': {
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
key: "name",
|
|
|
|
name: "Name"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "utc",
|
|
|
|
name: "Time",
|
|
|
|
format: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "yesterday",
|
|
|
|
name: "Yesterday",
|
|
|
|
format: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "sin",
|
|
|
|
name: "Sine",
|
2018-06-29 22:52:15 +00:00
|
|
|
formatString: '%0.2f',
|
2018-03-21 21:18:08 +00:00
|
|
|
hints: {
|
|
|
|
range: 1
|
2019-03-14 20:49:37 +00:00
|
|
|
}
|
2018-03-21 21:18:08 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "cos",
|
|
|
|
name: "Cosine",
|
2018-06-29 22:52:15 +00:00
|
|
|
formatString: '%0.2f',
|
2018-03-21 21:18:08 +00:00
|
|
|
hints: {
|
|
|
|
range: 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'example.state-generator': {
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
key: "name",
|
|
|
|
name: "Name"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "utc",
|
|
|
|
name: "Time",
|
|
|
|
format: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "state",
|
|
|
|
source: "value",
|
|
|
|
name: "State",
|
|
|
|
format: "enum",
|
|
|
|
enumerations: [
|
|
|
|
{
|
|
|
|
value: 0,
|
|
|
|
string: "OFF"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 1,
|
|
|
|
string: "ON"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
hints: {
|
|
|
|
range: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "value",
|
|
|
|
name: "Value",
|
|
|
|
hints: {
|
|
|
|
range: 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function GeneratorMetadataProvider() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
|
|
|
|
return METADATA_BY_TYPE.hasOwnProperty(domainObject.type);
|
|
|
|
};
|
|
|
|
|
|
|
|
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
|
|
|
return _.extend(
|
2019-06-26 21:25:03 +00:00
|
|
|
{},
|
|
|
|
domainObject.telemetry,
|
|
|
|
METADATA_BY_TYPE[domainObject.type]
|
|
|
|
);
|
2018-03-21 21:18:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return GeneratorMetadataProvider;
|
|
|
|
|
|
|
|
});
|