fix(influx): accept tagCode camelCase and emit positionVsParent tag
The asset config standardised on tagCode (camelCase) but the InfluxDB tag emitter still read the lowercase tagcode, so any node saved through the new editor silently emitted tags.tagcode: undefined. Read both spellings so old + new configs both produce the tag. Also surfaces functionality.positionVsParent as a tag so dashboards can filter by upstream/downstream side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -104,9 +104,10 @@ class OutputUtils {
|
|||||||
// functionality properties
|
// functionality properties
|
||||||
softwareType: config.functionality?.softwareType,
|
softwareType: config.functionality?.softwareType,
|
||||||
role: config.functionality?.role,
|
role: config.functionality?.role,
|
||||||
|
positionVsParent: config.functionality?.positionVsParent,
|
||||||
// asset properties (exclude machineCurve)
|
// asset properties (exclude machineCurve)
|
||||||
uuid: config.asset?.uuid,
|
uuid: config.asset?.uuid,
|
||||||
tagcode: config.asset?.tagcode,
|
tagcode: config.asset?.tagCode || config.asset?.tagcode,
|
||||||
geoLocation: config.asset?.geoLocation,
|
geoLocation: config.asset?.geoLocation,
|
||||||
category: config.asset?.category,
|
category: config.asset?.category,
|
||||||
type: config.asset?.type,
|
type: config.asset?.type,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const config = {
|
|||||||
general: { id: 'abc', unit: 'mbar' },
|
general: { id: 'abc', unit: 'mbar' },
|
||||||
asset: {
|
asset: {
|
||||||
uuid: 'u1',
|
uuid: 'u1',
|
||||||
tagcode: 't1',
|
tagCode: 't1',
|
||||||
geoLocation: { lat: 51.6, lon: 4.7 },
|
geoLocation: { lat: 51.6, lon: 4.7 },
|
||||||
category: 'measurement',
|
category: 'measurement',
|
||||||
type: 'pressure',
|
type: 'pressure',
|
||||||
@@ -38,5 +38,6 @@ test('influx format flattens tags and stringifies tag values', () => {
|
|||||||
assert.equal(msg.payload.measurement, 'measurement_abc');
|
assert.equal(msg.payload.measurement, 'measurement_abc');
|
||||||
assert.equal(msg.payload.tags.geoLocation_lat, '51.6');
|
assert.equal(msg.payload.tags.geoLocation_lat, '51.6');
|
||||||
assert.equal(msg.payload.tags.geoLocation_lon, '4.7');
|
assert.equal(msg.payload.tags.geoLocation_lon, '4.7');
|
||||||
|
assert.equal(msg.payload.tags.tagcode, 't1');
|
||||||
assert.ok(msg.payload.timestamp instanceof Date);
|
assert.ok(msg.payload.timestamp instanceof Date);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user