2018-03-21 21:18:08 +00:00
|
|
|
define(['lodash'], function (_) {
|
|
|
|
var METADATA_BY_TYPE = {
|
|
|
|
generator: {
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
key: 'name',
|
2020-03-31 22:56:06 +00:00
|
|
|
name: 'Name',
|
|
|
|
format: 'string'
|
2018-03-21 21:18:08 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'utc',
|
|
|
|
name: 'Time',
|
|
|
|
format: 'utc',
|
|
|
|
hints: {
|
|
|
|
domain: 1
|
2021-09-18 20:00:16 +00:00
|
|
|
}
|
|
|
|
},
|
2020-07-01 16:50:18 +00:00
|
|
|
{
|
|
|
|
key: 'yesterday',
|
|
|
|
name: 'Yesterday',
|
|
|
|
format: 'utc',
|
|
|
|
hints: {
|
|
|
|
domain: 2
|
2019-03-14 20:49:37 +00:00
|
|
|
}
|
2018-03-21 21:18:08 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'wavelengths',
|
|
|
|
name: 'Wavelength',
|
2020-07-31 20:13:58 +00:00
|
|
|
unit: 'nm',
|
2018-06-29 22:52:15 +00:00
|
|
|
format: 'string[]',
|
2022-06-04 02:32:32 +00:00
|
|
|
hints: {
|
|
|
|
range: 4
|
2018-03-21 21:18:08 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
// Need to enable "LocalTimeSystem" plugin to make use of this
|
|
|
|
// {
|
|
|
|
// key: "local",
|
|
|
|
// name: "Time",
|
|
|
|
// format: "local-format",
|
|
|
|
// source: "utc",
|
|
|
|
// hints: {
|
|
|
|
// domain: 3
|
|
|
|
// }
|
|
|
|
// },
|
2020-07-01 16:50:18 +00:00
|
|
|
{
|
|
|
|
key: 'sin',
|
|
|
|
name: 'Sine',
|
|
|
|
unit: 'Hz',
|
|
|
|
formatString: '%0.2f',
|
|
|
|
hints: {
|
|
|
|
range: 1
|
|
|
|
}
|
|
|
|
},
|
2018-03-21 21:18:08 +00:00
|
|
|
{
|
|
|
|
key: 'cos',
|
|
|
|
name: 'Cosine',
|
|
|
|
unit: 'deg',
|
|
|
|
formatString: '%0.2f',
|
|
|
|
hints: {
|
|
|
|
range: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'intensities',
|
|
|
|
name: 'Intensities',
|
2022-06-04 02:32:32 +00:00
|
|
|
format: 'number[]',
|
2018-03-21 21:18:08 +00:00
|
|
|
hints: {
|
|
|
|
range: 3
|
|
|
|
}
|
|
|
|
}
|
2023-05-18 21:54:46 +00:00
|
|
|
]
|
2020-07-31 19:11:03 +00:00
|
|
|
},
|
2018-03-21 21:18:08 +00:00
|
|
|
'example.state-generator': {
|
|
|
|
values: [
|
2023-05-18 21:54:46 +00:00
|
|
|
{
|
|
|
|
key: 'name',
|
2020-05-18 18:40:05 +00:00
|
|
|
name: 'Name',
|
2022-06-04 02:32:32 +00:00
|
|
|
format: 'string'
|
2023-05-18 21:54:46 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'utc',
|
|
|
|
name: 'Time',
|
2022-06-04 02:32:32 +00:00
|
|
|
format: 'utc',
|
2023-05-18 21:54:46 +00:00
|
|
|
hints: {
|
2018-03-21 21:18:08 +00:00
|
|
|
domain: 1
|
2023-05-18 21:54:46 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'local',
|
|
|
|
name: 'Time',
|
2022-06-04 02:32:32 +00:00
|
|
|
format: 'utc',
|
2020-07-01 16:50:18 +00:00
|
|
|
source: 'utc',
|
2023-05-18 21:54:46 +00:00
|
|
|
hints: {
|
|
|
|
domain: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2018-03-21 21:18:08 +00:00
|
|
|
key: 'state',
|
|
|
|
source: 'value',
|
2023-05-18 21:54:46 +00:00
|
|
|
name: 'State',
|
2018-03-21 21:18:08 +00:00
|
|
|
format: 'enum',
|
|
|
|
enumerations: [
|
2023-05-18 21:54:46 +00:00
|
|
|
{
|
2018-03-21 21:18:08 +00:00
|
|
|
value: 0,
|
|
|
|
string: 'OFF'
|
2023-05-18 21:54:46 +00:00
|
|
|
},
|
|
|
|
{
|
2018-03-21 21:18:08 +00:00
|
|
|
value: 1,
|
2023-05-18 21:54:46 +00:00
|
|
|
string: 'ON'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
hints: {
|
|
|
|
range: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'value',
|
|
|
|
name: 'Value',
|
|
|
|
hints: {
|
|
|
|
range: 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2018-03-21 21:18:08 +00:00
|
|
|
}
|
2023-05-18 21:54:46 +00:00
|
|
|
};
|
2018-03-21 21:18:08 +00:00
|
|
|
|
|
|
|
function GeneratorMetadataProvider() {}
|
|
|
|
|
|
|
|
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
|
2019-06-26 21:25:03 +00:00
|
|
|
return Object.prototype.hasOwnProperty.call(METADATA_BY_TYPE, domainObject.type);
|
2018-03-21 21:18:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
|
|
|
return Object.assign({}, domainObject.telemetry, METADATA_BY_TYPE[domainObject.type]);
|
2023-05-18 21:54:46 +00:00
|
|
|
};
|
2018-03-21 21:18:08 +00:00
|
|
|
|
2020-08-10 18:23:35 +00:00
|
|
|
return GeneratorMetadataProvider;
|
2018-03-21 21:18:08 +00:00
|
|
|
});
|