@@ -26,6 +26,7 @@ import { TagPropertyService } from '../tag-property/tag-property.service';
2626export class DeviceListComponent implements OnInit , AfterViewInit {
2727
2828 readonly defAllColumns = [ 'select' , 'name' , 'address' , 'device' , 'type' , 'value' , 'timestamp' , 'description' , 'warning' , 'logger' , 'options' , 'remove' ] ;
29+ readonly defAllExtColumns = [ 'select' , 'name' , 'address' , 'device' , 'type' , 'value' , 'timestamp' , 'quality' , 'description' , 'warning' , 'logger' , 'options' , 'remove' ] ;
2930 readonly defInternalColumns = [ 'select' , 'name' , 'device' , 'type' , 'value' , 'timestamp' , 'description' , 'options' , 'remove' ] ;
3031 readonly defGpipColumns = [ 'select' , 'name' , 'device' , 'address' , 'direction' , 'value' , 'timestamp' , 'description' , 'logger' , 'options' , 'remove' ] ;
3132 readonly defWebcamColumns = [ 'select' , 'name' , 'device' , 'address' , 'value' , 'timestamp' , 'description' , 'logger' , 'options' , 'remove' ] ;
@@ -122,6 +123,9 @@ export class DeviceListComponent implements OnInit, AfterViewInit {
122123 } else if ( this . deviceSelected . type === DeviceType . WebCam ) {
123124 this . displayedColumns = this . defWebcamColumns ;
124125 this . tableWidth = this . defAllRowWidth ;
126+ } else if ( this . deviceSelected . type === DeviceType . REDIS ) {
127+ this . displayedColumns = this . defAllExtColumns ;
128+ this . tableWidth = this . defAllRowWidth ;
125129 } else {
126130 this . displayedColumns = this . defAllColumns ;
127131 this . tableWidth = this . defAllRowWidth ;
@@ -230,6 +234,14 @@ export class DeviceListComponent implements OnInit, AfterViewInit {
230234 }
231235 }
232236
237+ onScanRedisTag ( ) {
238+ if ( this . deviceSelected . type === DeviceType . REDIS ) {
239+ this . tagPropertyService . scanTagsRedis ( this . deviceSelected ) . subscribe ( result => {
240+ this . bindToTable ( this . deviceSelected . tags ) ;
241+ } ) ;
242+ }
243+ }
244+
233245 getTagLabel ( tag : Tag ) {
234246 if ( this . deviceSelected . type === DeviceType . BACnet || this . deviceSelected . type === DeviceType . WebAPI ) {
235247 return tag . label || tag . name ;
@@ -264,7 +276,7 @@ export class DeviceListComponent implements OnInit, AfterViewInit {
264276 if ( type === DeviceType . SiemensS7 || type === DeviceType . ModbusTCP || type === DeviceType . ModbusRTU ||
265277 type === DeviceType . internal || type === DeviceType . EthernetIP || type === DeviceType . FuxaServer ||
266278 type === DeviceType . OPCUA || type === DeviceType . GPIO || type === DeviceType . ADSclient ||
267- type === DeviceType . WebCam || type === DeviceType . MELSEC ) {
279+ type === DeviceType . WebCam || type === DeviceType . MELSEC || type === DeviceType . REDIS ) {
268280 return true ;
269281 } else if ( type === DeviceType . MQTTclient ) {
270282 if ( tag && tag . options && ( tag . options . pubs || tag . options . subs ) ) {
@@ -345,6 +357,13 @@ export class DeviceListComponent implements OnInit, AfterViewInit {
345357 } ) ;
346358 return ;
347359 }
360+ if ( this . deviceSelected . type === DeviceType . REDIS ) {
361+ this . tagPropertyService . editTagPropertyRedis ( this . deviceSelected , tag , checkToAdd ) . subscribe ( result => {
362+ this . tagsMap [ tag . id ] = tag ;
363+ this . bindToTable ( this . deviceSelected . tags ) ;
364+ } ) ;
365+ return ;
366+ }
348367 }
349368
350369 editTagOptions ( tags : Tag [ ] ) {
@@ -374,9 +393,11 @@ export class DeviceListComponent implements OnInit, AfterViewInit {
374393 let sigs = this . hmiService . getAllSignals ( ) ;
375394 for ( let id in sigs ) {
376395 if ( this . tagsMap [ id ] ) {
377- this . tagsMap [ id ] . value = sigs [ id ] . value ;
378- this . tagsMap [ id ] . error = sigs [ id ] . error ;
379- this . tagsMap [ id ] . timestamp = sigs [ id ] . timestamp ;
396+ const signal = sigs [ id ] ;
397+ this . tagsMap [ id ] . value = signal . value ;
398+ this . tagsMap [ id ] . error = signal . error ;
399+ this . tagsMap [ id ] . timestamp = signal . timestamp ;
400+ this . tagsMap [ id ] . quality = signal . quality ;
380401 }
381402 }
382403 this . changeDetector . detectChanges ( ) ;
0 commit comments