2018-03-21 14:18:08 -07:00
|
|
|
define([
|
|
|
|
'lodash'
|
|
|
|
], function (
|
|
|
|
_
|
|
|
|
) {
|
|
|
|
|
|
|
|
var METADATA_BY_TYPE = {
|
|
|
|
'generator': {
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
key: "name",
|
2020-03-31 15:56:06 -07:00
|
|
|
name: "Name",
|
|
|
|
format: "string"
|
2018-03-21 14:18:08 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "utc",
|
|
|
|
name: "Time",
|
|
|
|
format: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "yesterday",
|
|
|
|
name: "Yesterday",
|
|
|
|
format: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 2
|
|
|
|
}
|
|
|
|
},
|
2021-09-18 13:00:16 -07:00
|
|
|
{
|
|
|
|
key: "cos",
|
|
|
|
name: "Cosine",
|
|
|
|
unit: "deg",
|
|
|
|
formatString: '%0.2f',
|
|
|
|
hints: {
|
|
|
|
domain: 3
|
|
|
|
}
|
|
|
|
},
|
2020-07-01 09:50:18 -07:00
|
|
|
// Need to enable "LocalTimeSystem" plugin to make use of this
|
|
|
|
// {
|
|
|
|
// key: "local",
|
|
|
|
// name: "Time",
|
|
|
|
// format: "local-format",
|
|
|
|
// source: "utc",
|
|
|
|
// hints: {
|
|
|
|
// domain: 3
|
|
|
|
// }
|
|
|
|
// },
|
2018-03-21 14:18:08 -07:00
|
|
|
{
|
|
|
|
key: "sin",
|
|
|
|
name: "Sine",
|
2020-07-31 13:13:58 -07:00
|
|
|
unit: "Hz",
|
2018-06-29 15:52:15 -07:00
|
|
|
formatString: '%0.2f',
|
2018-03-21 14:18:08 -07:00
|
|
|
hints: {
|
|
|
|
range: 1
|
2019-03-14 13:49:37 -07:00
|
|
|
}
|
2018-03-21 14:18:08 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "cos",
|
|
|
|
name: "Cosine",
|
2020-07-31 13:13:58 -07:00
|
|
|
unit: "deg",
|
2018-06-29 15:52:15 -07:00
|
|
|
formatString: '%0.2f',
|
2018-03-21 14:18:08 -07:00
|
|
|
hints: {
|
|
|
|
range: 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'example.state-generator': {
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
key: "name",
|
2020-05-18 11:40:05 -07:00
|
|
|
name: "Name",
|
|
|
|
format: "string"
|
2018-03-21 14:18:08 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "utc",
|
|
|
|
name: "Time",
|
|
|
|
format: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 1
|
|
|
|
}
|
|
|
|
},
|
2020-07-01 09:50:18 -07:00
|
|
|
{
|
|
|
|
key: "local",
|
|
|
|
name: "Time",
|
|
|
|
format: "utc",
|
|
|
|
source: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 2
|
|
|
|
}
|
|
|
|
},
|
2018-03-21 14:18:08 -07:00
|
|
|
{
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2021-09-18 13:00:16 -07:00
|
|
|
},
|
|
|
|
'example.spectral-generator': {
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
key: "name",
|
|
|
|
name: "Name",
|
|
|
|
format: "string"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "utc",
|
|
|
|
name: "Time",
|
|
|
|
format: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "wavelength",
|
|
|
|
name: "Wavelength",
|
|
|
|
unit: "Hz",
|
|
|
|
formatString: '%0.2f',
|
|
|
|
hints: {
|
|
|
|
domain: 2,
|
|
|
|
spectralAttribute: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "cos",
|
|
|
|
name: "Cosine",
|
|
|
|
unit: "deg",
|
|
|
|
formatString: '%0.2f',
|
|
|
|
hints: {
|
|
|
|
range: 2,
|
|
|
|
spectralAttribute: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'example.spectral-aggregate-generator': {
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
key: "name",
|
|
|
|
name: "Name",
|
|
|
|
format: "string"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "utc",
|
|
|
|
name: "Time",
|
|
|
|
format: "utc",
|
|
|
|
hints: {
|
|
|
|
domain: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "ch1",
|
|
|
|
name: "Channel 1",
|
|
|
|
format: "string",
|
|
|
|
hints: {
|
|
|
|
range: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "ch2",
|
|
|
|
name: "Channel 2",
|
|
|
|
format: "string",
|
|
|
|
hints: {
|
|
|
|
range: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "ch3",
|
|
|
|
name: "Channel 3",
|
|
|
|
format: "string",
|
|
|
|
hints: {
|
|
|
|
range: 3
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "ch4",
|
|
|
|
name: "Channel 4",
|
|
|
|
format: "string",
|
|
|
|
hints: {
|
|
|
|
range: 4
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "ch5",
|
|
|
|
name: "Channel 5",
|
|
|
|
format: "string",
|
|
|
|
hints: {
|
|
|
|
range: 5
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2018-03-21 14:18:08 -07:00
|
|
|
}
|
2020-07-31 12:11:03 -07:00
|
|
|
};
|
2018-03-21 14:18:08 -07:00
|
|
|
|
|
|
|
function GeneratorMetadataProvider() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
|
2020-08-10 11:23:35 -07:00
|
|
|
return Object.prototype.hasOwnProperty.call(METADATA_BY_TYPE, domainObject.type);
|
2018-03-21 14:18:08 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
2020-05-27 10:59:02 -07:00
|
|
|
return Object.assign(
|
2019-06-26 14:25:03 -07:00
|
|
|
{},
|
|
|
|
domainObject.telemetry,
|
|
|
|
METADATA_BY_TYPE[domainObject.type]
|
|
|
|
);
|
2018-03-21 14:18:08 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
return GeneratorMetadataProvider;
|
|
|
|
|
|
|
|
});
|