nayota-show-sdk 1.3.78 → 1.3.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -497,6 +497,28 @@ function normalizeLegacyStatus(status, props = []) {
|
|
|
497
497
|
function normalizeLegacyEasyListProp(source = {}, row = {}) {
|
|
498
498
|
const prop = withLegacyId(source.prop || {})
|
|
499
499
|
const propId = source.propId || source.devicePropertyId || prop._id || source._id || source.id
|
|
500
|
+
const thresholdRules = prop.thresholdRules !== undefined
|
|
501
|
+
? prop.thresholdRules
|
|
502
|
+
: source.thresholdRules !== undefined
|
|
503
|
+
? source.thresholdRules
|
|
504
|
+
: getNestedValue(prop, 'typeProperty.thresholdRules') !== undefined
|
|
505
|
+
? getNestedValue(prop, 'typeProperty.thresholdRules')
|
|
506
|
+
: getNestedValue(source, 'typeProperty.thresholdRules') !== undefined
|
|
507
|
+
? getNestedValue(source, 'typeProperty.thresholdRules')
|
|
508
|
+
: getNestedValue(prop, 'metadata.thresholdRules') !== undefined
|
|
509
|
+
? getNestedValue(prop, 'metadata.thresholdRules')
|
|
510
|
+
: getNestedValue(source, 'metadata.thresholdRules')
|
|
511
|
+
const isThresholdEnabled = prop.isThresholdEnabled !== undefined
|
|
512
|
+
? prop.isThresholdEnabled
|
|
513
|
+
: source.isThresholdEnabled !== undefined
|
|
514
|
+
? source.isThresholdEnabled
|
|
515
|
+
: getNestedValue(prop, 'typeProperty.isThresholdEnabled') !== undefined
|
|
516
|
+
? getNestedValue(prop, 'typeProperty.isThresholdEnabled')
|
|
517
|
+
: getNestedValue(source, 'typeProperty.isThresholdEnabled') !== undefined
|
|
518
|
+
? getNestedValue(source, 'typeProperty.isThresholdEnabled')
|
|
519
|
+
: getNestedValue(prop, 'metadata.isThresholdEnabled') !== undefined
|
|
520
|
+
? getNestedValue(prop, 'metadata.isThresholdEnabled')
|
|
521
|
+
: getNestedValue(source, 'metadata.isThresholdEnabled')
|
|
500
522
|
const value = prop.value !== undefined
|
|
501
523
|
? prop.value
|
|
502
524
|
: source.value !== undefined
|
|
@@ -528,7 +550,8 @@ function normalizeLegacyEasyListProp(source = {}, row = {}) {
|
|
|
528
550
|
company: prop.company || source.company,
|
|
529
551
|
valueMap: prop.valueMap !== undefined ? prop.valueMap : source.valueMap,
|
|
530
552
|
interval,
|
|
531
|
-
thresholdRules
|
|
553
|
+
thresholdRules,
|
|
554
|
+
isThresholdEnabled,
|
|
532
555
|
valueAt,
|
|
533
556
|
sort: prop.sort !== undefined ? prop.sort : source.sort,
|
|
534
557
|
parent: prop.parent !== undefined ? prop.parent : source.parent,
|
|
@@ -550,6 +573,8 @@ function normalizeLegacyEasyListProp(source = {}, row = {}) {
|
|
|
550
573
|
value,
|
|
551
574
|
valueStr,
|
|
552
575
|
interval,
|
|
576
|
+
thresholdRules,
|
|
577
|
+
isThresholdEnabled,
|
|
553
578
|
valueAt,
|
|
554
579
|
prop: legacyProp
|
|
555
580
|
})
|
|
@@ -710,7 +735,7 @@ function mapIotDeviceClassToLegacy(item = {}) {
|
|
|
710
735
|
departTag: bms.departTag || entity.departTag,
|
|
711
736
|
isSimulation: bms.isSimulation != null ? bms.isSimulation : entity.isSimulation,
|
|
712
737
|
isIpDevice: bms.isIpDevice != null ? bms.isIpDevice : entity.isIpDevice,
|
|
713
|
-
icon:
|
|
738
|
+
icon: entity.icon || display.icon || bms.deviceClassIcon
|
|
714
739
|
})
|
|
715
740
|
}
|
|
716
741
|
|
|
@@ -92,6 +92,33 @@ describe('iotModuleSpecs deviceClass UI compatibility', () => {
|
|
|
92
92
|
}
|
|
93
93
|
])
|
|
94
94
|
})
|
|
95
|
+
|
|
96
|
+
test('prefers current digital twin type icon over legacy metadata icon', () => {
|
|
97
|
+
const response = deviceClass.list.fromResponse({
|
|
98
|
+
code: 0,
|
|
99
|
+
data: {
|
|
100
|
+
total: 1,
|
|
101
|
+
items: [
|
|
102
|
+
{
|
|
103
|
+
id: 'type-1',
|
|
104
|
+
typeCode: 'PANEL',
|
|
105
|
+
name: '开关面板',
|
|
106
|
+
icon: 'tabler-current-panel',
|
|
107
|
+
metadata: {
|
|
108
|
+
display: {
|
|
109
|
+
icon: 'tabler-display-legacy'
|
|
110
|
+
},
|
|
111
|
+
bms: {
|
|
112
|
+
deviceClassIcon: 'tabler-bms-legacy'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
expect(response.data.rows[0].icon).toBe('tabler-current-panel')
|
|
121
|
+
})
|
|
95
122
|
})
|
|
96
123
|
|
|
97
124
|
describe('iotModuleSpecs departs hierarchy compatibility', () => {
|
|
@@ -257,6 +284,8 @@ describe('iotModuleSpecs devices easyList legacy compatibility', () => {
|
|
|
257
284
|
line: true,
|
|
258
285
|
value: 0.043,
|
|
259
286
|
company: 'A',
|
|
287
|
+
isThresholdEnabled: true,
|
|
288
|
+
thresholdRules: [{ level: 'warn', min: 0, max: 10 }],
|
|
260
289
|
valueAt: '2026-04-25T06:31:00.000Z',
|
|
261
290
|
prop: {
|
|
262
291
|
id: 'device-prop-electric'
|
|
@@ -322,6 +351,8 @@ describe('iotModuleSpecs devices easyList legacy compatibility', () => {
|
|
|
322
351
|
isImport: true,
|
|
323
352
|
line: true,
|
|
324
353
|
value: 0.043,
|
|
354
|
+
isThresholdEnabled: true,
|
|
355
|
+
thresholdRules: [{ level: 'warn', min: 0, max: 10 }],
|
|
325
356
|
valueAt: '2026-04-25T06:31:00.000Z'
|
|
326
357
|
})
|
|
327
358
|
)
|
|
@@ -330,6 +361,8 @@ describe('iotModuleSpecs devices easyList legacy compatibility', () => {
|
|
|
330
361
|
line: true,
|
|
331
362
|
value: 0.043,
|
|
332
363
|
company: 'A',
|
|
364
|
+
isThresholdEnabled: true,
|
|
365
|
+
thresholdRules: [{ level: 'warn', min: 0, max: 10 }],
|
|
333
366
|
valueAt: '2026-04-25T06:31:00.000Z'
|
|
334
367
|
})
|
|
335
368
|
)
|