Browse Source

fixes

pull/8337/head
Maksym Dudnik 3 years ago
parent
commit
17016e4bbf
  1. 16
      ui-ngx/src/app/shared/components/device/gateway-logs.component.ts
  2. 6
      ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts

16
ui-ngx/src/app/shared/components/device/gateway-logs.component.ts

@ -167,13 +167,22 @@ export class GatewayLogsComponent extends PageComponent implements AfterViewInit
updateData(sort?) {
if (this.ctx.defaultSubscription.data.length) {
console.log(this.ctx.defaultSubscription.data[0].dataKey.name === "LOGS")
let attrData = this.ctx.defaultSubscription.data[0].data.map(data => {
return {
let result = {
ts: data[0],
key: this.activeLink.key,
status: data[1].match(/\|(\w+)\|/)? data[1].match(/\|(\w+)\|/)[1] : "",
message: /\[(.*)/.exec(data[1])[0]
message: /\[(.*)/.exec(data[1])[0],
status: 'INVALID LOG FORMAT'
};
try {
result.status= data[1].match(/\|(\w+)\|/)[1];
} catch (e) {
result.status = 'INVALID LOG FORMAT'
}
return result;
});
if (this.activeLink.filterFn) {
attrData = attrData.filter(data => this.activeLink.filterFn(data));
@ -202,6 +211,7 @@ export class GatewayLogsComponent extends PageComponent implements AfterViewInit
case GatewayLogLevel.info:
default:
return "status status-info"
return "status status-info"
}
}

6
ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts

@ -64,7 +64,7 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi
public dialog: MatDialog) {
super(store);
this.statisticForm = this.fb.group({
statisticKey: [this.statisticsKeys[0], []]
statisticKey: [null, []]
})
this.statisticForm.get('statisticKey').valueChanges.subscribe(value=>{
@ -126,7 +126,7 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi
changeSubscription(init?: boolean) {
if (this.ctx.datasources[0].entity) {
if (this.flot) {
if (this.flot && init) {
this.flot.destroy();
delete this.flot;
}
@ -143,7 +143,7 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi
this.ctx.defaultSubscription.callbacks.onDataUpdated = () => {
this.updateChart();
}
this.cd.detectChanges();
}
}

Loading…
Cancel
Save