Skip to content

Commit 94606d9

Browse files
committed
GUI New Feature => On add 2 or more QoE VMAF charts, add an additional chart with the average
1 parent dbd2063 commit 94606d9

File tree

4 files changed

+221
-44
lines changed

4 files changed

+221
-44
lines changed

elastest-torm-gui/src/app/elastest-etm/etm-monitoring-view/etm-chart-group/etm-chart-group.component.ts

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ export class EtmChartGroupComponent implements OnInit, AfterViewInit, AfterViewC
7373
startDate: Date;
7474
endDate: Date;
7575

76+
qoeVmafAvgChartName: string = 'QoE VMAF Average';
77+
qoeVmafMetrics: MetricsFieldModel[] = [];
78+
7679
constructor(private monitoringService: MonitoringService, private elastestRabbitmqService: ElastestRabbitmqService) {}
7780

7881
ngOnInit(): void {}
@@ -186,6 +189,8 @@ export class EtmChartGroupComponent implements OnInit, AfterViewInit, AfterViewC
186189
this.initAIO();
187190
}
188191

192+
this.qoeVmafMetrics = [];
193+
189194
for (let metric of this.tJob.execDashboardConfigModel.allMetricsFields.fieldsList) {
190195
if (metric.activated) {
191196
let individualMetrics: ESRabComplexMetricsModel = this.initializeBasicAttrByMetric(metric);
@@ -238,14 +243,20 @@ export class EtmChartGroupComponent implements OnInit, AfterViewInit, AfterViewC
238243
);
239244
}
240245
}
246+
247+
this.storeMetricIfIsQoEVmafActivated(metric);
241248
}
242249
}
250+
243251
this.createGroupedMetricList();
244252
this.firstTimeInitialized = true;
245253

246254
if (this.tJob.execDashboardConfigModel.combineMetricsInPairs) {
247255
this.initMetricsPairs();
248256
}
257+
258+
// QoE Vmaf average chart
259+
this.initQoEVmafAverage();
249260
}
250261

251262
addChartToList(individualMetrics: ESRabComplexMetricsModel, isCombinedPair: boolean = false): number {
@@ -257,6 +268,7 @@ export class EtmChartGroupComponent implements OnInit, AfterViewInit, AfterViewC
257268
if (this.tJob.execDashboardConfigModel.combineMetricsInPairs) {
258269
this.initMetricsPairs();
259270
}
271+
260272
return pos;
261273
}
262274
}
@@ -348,6 +360,62 @@ export class EtmChartGroupComponent implements OnInit, AfterViewInit, AfterViewC
348360
return individualMetrics;
349361
}
350362

363+
// If is qoe vmaf and is activated, add to list (for create average chart)
364+
storeMetricIfIsQoEVmafActivated(metric: MetricsFieldModel): void {
365+
if (metric.etType === 'vmaf' && metric.activated) {
366+
this.qoeVmafMetrics.push(metric);
367+
}
368+
}
369+
370+
initQoEVmafAverage(): void {
371+
if (!this.live) {
372+
let posIfExist: number = this.returnPositionIfExist(this.qoeVmafAvgChartName);
373+
if (posIfExist > -1) {
374+
this.removeAndUnsubscribeByListAndPos(posIfExist);
375+
}
376+
377+
if (this.qoeVmafMetrics && this.qoeVmafMetrics.length > 1) {
378+
let ignoreComponent: string = this.getIgnoreComponent();
379+
let chart: ESRabComplexMetricsModel = new ESRabComplexMetricsModel(this.monitoringService, ignoreComponent);
380+
chart.startDate = this.startDate;
381+
chart.endDate = this.endDate;
382+
chart.name = this.qoeVmafAvgChartName;
383+
chart.hidePrevBtn = !this.live;
384+
385+
let monitoringIndex: string = this.tJobExec.monitoringIndex;
386+
387+
// If Multi Parent
388+
if (this.tJobExec instanceof TJobExecModel && this.tJobExec.isParent()) {
389+
monitoringIndex = this.tJobExec.getChildsMonitoringIndices();
390+
}
391+
392+
chart.monitoringIndex = monitoringIndex;
393+
394+
for (let chartLine of this.qoeVmafMetrics) {
395+
chartLine.unit = chartLine.unit ? chartLine.unit : '%';
396+
chart.setUnits(chartLine.unit);
397+
398+
chart.allMetricsFields.addMetricsFieldToList(
399+
chartLine,
400+
chartLine.component,
401+
chart.stream,
402+
chartLine.streamType,
403+
chartLine.activated,
404+
);
405+
}
406+
chart.getAllMetrics().subscribe(
407+
(loaded: boolean) => {
408+
chart.convertChartToUniqueAxisAverage(this.qoeVmafAvgChartName);
409+
410+
this.addChartToList(chart);
411+
this.createGroupedMetricList();
412+
},
413+
(error: Error) => console.log(error),
414+
);
415+
}
416+
}
417+
}
418+
351419
initMetricsPairs(): void {
352420
this.combinedPairChartsList = [];
353421
let metricsPairsList: MetricsFieldModel[][] = allArrayPairCombinations(this.getChartsListMetricFieldModels());
@@ -541,13 +609,20 @@ export class EtmChartGroupComponent implements OnInit, AfterViewInit, AfterViewC
541609
return component + ' ' + stream + ' ' + etType;
542610
}
543611

544-
alreadyExist(name: string): boolean {
612+
returnPositionIfExist(name: string): number {
613+
let currentPos: number = 0;
545614
for (let metric of this.chartsList) {
546-
if (metric.name === name) {
547-
return true;
615+
if (metric.name.trim() === name.trim()) {
616+
return currentPos;
548617
}
618+
currentPos++;
549619
}
550-
return false;
620+
621+
return -1;
622+
}
623+
624+
alreadyExist(name: string): boolean {
625+
return this.returnPositionIfExist(name) > -1;
551626
}
552627

553628
createGroupedMetricList(): void {

elastest-torm-gui/src/app/elastest-etm/etm-monitoring-view/etm-monitoring-view.component.ts

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ export class EtmMonitoringViewComponent implements OnInit {
6666

6767
ngOnInit(): void {}
6868

69-
initView(tJob: AbstractTJobModel, tJobExec: AbstractTJobExecModel, customStartDate?: Date, customEndDate?: Date): void {
69+
initView(
70+
tJob: AbstractTJobModel,
71+
tJobExec: AbstractTJobExecModel,
72+
customStartDate?: Date,
73+
customEndDate?: Date,
74+
): void {
7075
this.tJob = tJob;
7176
this.tJobExec = tJobExec;
7277

@@ -324,7 +329,11 @@ export class EtmMonitoringViewComponent implements OnInit {
324329
} else {
325330
// Disable from tjob object before save
326331
let logField: LogFieldModel = new LogFieldModel(log.component, log.stream);
327-
this.tJob.execDashboardConfigModel.allLogsTypes.disableLogField(logField.name, logField.component, logField.stream);
332+
this.tJob.execDashboardConfigModel.allLogsTypes.disableLogField(
333+
logField.name,
334+
logField.component,
335+
logField.stream,
336+
);
328337
// Remove
329338
this.removeLogCard(log);
330339
}
@@ -337,7 +346,12 @@ export class EtmMonitoringViewComponent implements OnInit {
337346
this.metricName = '';
338347
// Enable in tjob object before save
339348
let logField: LogFieldModel = new LogFieldModel(log.component, log.stream);
340-
this.tJob.execDashboardConfigModel.allLogsTypes.addLogFieldToList(logField.name, logField.component, logField.stream, true);
349+
this.tJob.execDashboardConfigModel.allLogsTypes.addLogFieldToList(
350+
logField.name,
351+
logField.component,
352+
logField.stream,
353+
true,
354+
);
341355

342356
this.addMore(showPopup, 'log');
343357
}
@@ -355,7 +369,11 @@ export class EtmMonitoringViewComponent implements OnInit {
355369
} else {
356370
// Disable from tjob object before save
357371
let logField: LogFieldModel = new LogFieldModel(log.component, log.stream);
358-
this.tJob.execDashboardConfigModel.allLogsTypes.disableLogField(logField.name, logField.component, logField.stream);
372+
this.tJob.execDashboardConfigModel.allLogsTypes.disableLogField(
373+
logField.name,
374+
logField.component,
375+
logField.stream,
376+
);
359377
// Remove
360378
this.removeLogComparisonTab(logField);
361379
}
@@ -369,9 +387,19 @@ export class EtmMonitoringViewComponent implements OnInit {
369387

370388
// Enable in tjob object before save
371389
let logField: LogFieldModel = new LogFieldModel(log.component, log.stream);
372-
this.tJob.execDashboardConfigModel.allLogsTypes.addLogFieldToList(logField.name, logField.component, logField.stream, true);
390+
this.tJob.execDashboardConfigModel.allLogsTypes.addLogFieldToList(
391+
logField.name,
392+
logField.component,
393+
logField.stream,
394+
true,
395+
);
373396

374-
let added: boolean = this.logsGroup.addMoreLogsComparisons(this.tJobExec, logField.name, this.stream, this.component);
397+
let added: boolean = this.logsGroup.addMoreLogsComparisons(
398+
this.tJobExec,
399+
logField.name,
400+
this.stream,
401+
this.component,
402+
);
375403

376404
if (showPopup) {
377405
if (added) {
@@ -388,6 +416,7 @@ export class EtmMonitoringViewComponent implements OnInit {
388416

389417
updateMetricsFromList(metricsList: any[]): void {
390418
this.activatedMetrics = [];
419+
this.metricsGroup.qoeVmafMetrics = [];
391420

392421
// First, remove all metrics pairs cards
393422
this.metricsGroup.removeAllMetricsPairs();
@@ -411,6 +440,8 @@ export class EtmMonitoringViewComponent implements OnInit {
411440
this.removeMetricCard(metric);
412441
}
413442
}
443+
444+
this.metricsGroup.initQoEVmafAverage();
414445
}
415446

416447
updateMetric(metric: any, showPopup: boolean = false): void {
@@ -441,6 +472,9 @@ export class EtmMonitoringViewComponent implements OnInit {
441472
);
442473

443474
this.addMore(showPopup, 'metric');
475+
476+
// If is qoe vmaf and is activated, add to list (for create average chart)
477+
this.metricsGroup.storeMetricIfIsQoEVmafActivated(metricField);
444478
}
445479

446480
removeMetricCard(metric: any): void {
@@ -481,7 +515,7 @@ export class EtmMonitoringViewComponent implements OnInit {
481515
}
482516
}
483517
})
484-
.catch((e) => {
518+
.catch(e => {
485519
this.waitForUnlock(functionsToExec, parentTJobExec);
486520
});
487521
}

0 commit comments

Comments
 (0)