Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/common/interfaces/mainflux.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export interface MsgFilters {
publisher?: string;
subtopic?: string;
name?: string;
format?: string;
v?: string;
vs?: string;
vd?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,23 @@
<div class="col-1 form-key">
Value:
</div>
<div class="col-2">
<div class="col-1">
<input nbInput fullWidth fieldSize="tiny"
[(ngModel)]='httpAdaptVal'>
[(ngModel)]='value'>
</div>
<div class="col-1">
<nb-select [(selected)]="valueType" size="tiny">
<nb-option *ngFor="let type of this.valueTypes" [value]="type">{{type}}</nb-option>
</nb-select>
</div>
</div>
<div class="row form-row" *ngIf="mode == 'json'">
<div class="col-1 form-key">
Format:
</div>
<div class="col-1">
<nb-select class="right" [(selected)]="httpAdaptType" size="tiny">
<nb-option *ngFor="let type of this.httpAdaptTypes" [value]="type">{{type}}</nb-option>
<nb-select [(selected)]="format" size="tiny">
<nb-option *ngFor="let format of formats" [value]="format">{{format}}</nb-option>
</nb-select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ 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'];
value: any;
valueType: string = 'float';
valueTypes: string[] = ['float', 'bool', 'string', 'data'];
format: string = 'senml';
formats: string[] = ['senml', 'json'];

msgDatasets: Dataset[] = [];

Expand All @@ -29,6 +31,7 @@ export class MessageMonitorComponent implements OnInit, OnChanges, OnDestroy {
limit: 20,
publisher: '',
subtopic: '',
format: '',
name: '',
from: 0,
to: 0,
Expand Down Expand Up @@ -87,18 +90,27 @@ 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;
}

switch (this.format) {
case 'senml':
this.filters.format = 'messages';
break;
case 'json':
this.filters.format = this.format;
break;
}

Expand Down