From 33bcccfbe27dd3dbf9593df6dbfc22e973f53ba6 Mon Sep 17 00:00:00 2001 From: Manuel Imperiale Date: Fri, 26 Nov 2021 15:26:46 +0100 Subject: [PATCH 1/2] NOISSUE - Add format http param to message-monitor Signed-off-by: Manuel Imperiale --- .../common/interfaces/mainflux.interface.ts | 1 + .../message-monitor.component.html | 18 +++++++++++---- .../message-monitor.component.ts | 22 ++++++++++++------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/app/common/interfaces/mainflux.interface.ts b/src/app/common/interfaces/mainflux.interface.ts index b6b2a1b7..9a6eeba4 100644 --- a/src/app/common/interfaces/mainflux.interface.ts +++ b/src/app/common/interfaces/mainflux.interface.ts @@ -97,6 +97,7 @@ export interface MsgFilters { publisher?: string; subtopic?: string; name?: string; + format?: string; v?: string; vs?: string; vd?: string; diff --git a/src/app/shared/components/message-monitor/message-monitor.component.html b/src/app/shared/components/message-monitor/message-monitor.component.html index 14168808..0389c05d 100644 --- a/src/app/shared/components/message-monitor/message-monitor.component.html +++ b/src/app/shared/components/message-monitor/message-monitor.component.html @@ -92,13 +92,23 @@
Value:
-
+
+ [(ngModel)]='value'> +
+
+ + {{type}} + +
+
+
+
+ Format:
- - {{type}} + + {{format}}
diff --git a/src/app/shared/components/message-monitor/message-monitor.component.ts b/src/app/shared/components/message-monitor/message-monitor.component.ts index 82f530f0..b64d762d 100644 --- a/src/app/shared/components/message-monitor/message-monitor.component.ts +++ b/src/app/shared/components/message-monitor/message-monitor.component.ts @@ -18,9 +18,10 @@ export class MessageMonitorComponent implements OnInit, OnChanges, OnDestroy { mode: string = 'json'; modes: string[] = ['json', 'table', 'chart']; - httpAdaptType: string = 'float'; - httpAdaptVal: any; - httpAdaptTypes: string[] = ['float', 'bool', 'string', 'data']; + valueType: string = 'float'; + value: any; + valueTypes: string[] = ['float', 'bool', 'string', 'data']; + formats: string[] = ['senml', 'json']; msgDatasets: Dataset[] = []; @@ -29,6 +30,7 @@ export class MessageMonitorComponent implements OnInit, OnChanges, OnDestroy { limit: 20, publisher: '', subtopic: '', + format: '', name: '', from: 0, to: 0, @@ -87,21 +89,25 @@ export class MessageMonitorComponent implements OnInit, OnChanges, OnDestroy { return; } - switch (this.httpAdaptType) { + switch (this.valueType) { case 'string': - this.filters.vs = this.httpAdaptVal; + this.filters.vs = this.value; break; case 'data': - this.filters.vd = this.httpAdaptVal; + this.filters.vd = this.value; break; case 'bool': - this.filters.vb = this.httpAdaptVal; + this.filters.vb = this.value; break; case 'float': - this.filters.v = this.httpAdaptVal; + this.filters.v = this.value; break; } + if (this.filters.format === 'senml') { + this.filters.format = 'messages'; + } + this.messagesPage.rows = []; this.messagesService.getMessages(this.chanID, this.thingKey, this.filters, this.readerUrl).subscribe( (resp: any) => { From 2fca21d0dea24076ce7d90af39264ff3f2787cbf Mon Sep 17 00:00:00 2001 From: Manuel Imperiale Date: Fri, 26 Nov 2021 15:32:46 +0100 Subject: [PATCH 2/2] Use senml as default Signed-off-by: Manuel Imperiale --- .../message-monitor/message-monitor.component.html | 2 +- .../message-monitor/message-monitor.component.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/shared/components/message-monitor/message-monitor.component.html b/src/app/shared/components/message-monitor/message-monitor.component.html index 0389c05d..8d9b785d 100644 --- a/src/app/shared/components/message-monitor/message-monitor.component.html +++ b/src/app/shared/components/message-monitor/message-monitor.component.html @@ -107,7 +107,7 @@ Format:
- + {{format}}
diff --git a/src/app/shared/components/message-monitor/message-monitor.component.ts b/src/app/shared/components/message-monitor/message-monitor.component.ts index b64d762d..f95ececf 100644 --- a/src/app/shared/components/message-monitor/message-monitor.component.ts +++ b/src/app/shared/components/message-monitor/message-monitor.component.ts @@ -18,9 +18,10 @@ export class MessageMonitorComponent implements OnInit, OnChanges, OnDestroy { mode: string = 'json'; modes: string[] = ['json', 'table', 'chart']; - valueType: string = 'float'; value: any; + valueType: string = 'float'; valueTypes: string[] = ['float', 'bool', 'string', 'data']; + format: string = 'senml'; formats: string[] = ['senml', 'json']; msgDatasets: Dataset[] = []; @@ -104,8 +105,13 @@ export class MessageMonitorComponent implements OnInit, OnChanges, OnDestroy { break; } - if (this.filters.format === 'senml') { - this.filters.format = 'messages'; + switch (this.format) { + case 'senml': + this.filters.format = 'messages'; + break; + case 'json': + this.filters.format = this.format; + break; } this.messagesPage.rows = [];