Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 40x 5x 5x 5x 5x 5x 5x 5x 5x 37x 36x 36x 352x 36x 32x 6x 6x 6x 165x 6x 2x 2x | import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { TwinpadApiService } from '../../services/twinpad-api.service';
import { ListResponse } from '../../models/response';
import { Signal } from '../../models/signals';
import { MultiSelectFilterEvent } from 'primeng/multiselect';
import { MultiSelectModule } from 'primeng/multiselect';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'app-multi-select-signals',
imports: [MultiSelectModule, FormsModule],
templateUrl: './multi-select-signals.component.html',
styleUrl: './multi-select-signals.component.css'
})
export class MultiSelectSignalsComponent implements OnInit {
@Output() selectionChanged = new EventEmitter<string[]>();
selectedItems: string[] = [];
virtualScrollItemSize: number = 10;
totalSignals: number = 0;
isFiltering: boolean = false;
signalIds: string[];
signalIdsToPlot: string[];
constructor(private twinpadApiService: TwinpadApiService){}
ngOnInit(): void {
this.signalIds = [];
this.loadRecursively();
}
loadRecursively(){
this.twinpadApiService.getSignals(this.virtualScrollItemSize, this.signalIds.length, null, null, null).subscribe((data: ListResponse<Signal>) => {
this.totalSignals = data.total;
for (const signal of data.items){
this.signalIds.push(signal.signal_id);
}
if(this.signalIds.length < this.totalSignals)
{
this.loadRecursively();
}
});
}
filterSignal(event: MultiSelectFilterEvent){
this.isFiltering = true;
this.twinpadApiService.getSignals(0, 0, event.filter, null, null).subscribe((data: ListResponse<Signal>) => {
for (const signal of data.items){
Iif(!this.signalIds.includes(signal.signal_id)){
this.signalIds.push(signal.signal_id);
}
}
});
setTimeout(() => this.isFiltering = false, 1000);
}
onChangeSelection(newSelection: string[]){
this.selectedItems = newSelection;
this.selectionChanged.emit(this.selectedItems);
}
}
|