mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
RdioScannerCalls index improvement and minor bug fix to search pane
This commit is contained in:
parent
1c62d9d1fc
commit
093ba42ff4
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, HostListener, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
import { Component, EventEmitter, HostListener, NgZone, OnDestroy, OnInit, Output, ViewChild } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from '@angular/material/paginator';
|
||||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||||
|
|
@ -35,6 +35,8 @@ interface RdioScannerSelection {
|
||||||
templateUrl: './rdio-scanner.component.html',
|
templateUrl: './rdio-scanner.component.html',
|
||||||
})
|
})
|
||||||
export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
@Output() readonly live = new EventEmitter<boolean>();
|
||||||
|
|
||||||
get call() { return this._call; }
|
get call() { return this._call; }
|
||||||
get callHistory() { return this._callHistory; }
|
get callHistory() { return this._callHistory; }
|
||||||
get callPrevious() { return this._callPrevious; }
|
get callPrevious() { return this._callPrevious; }
|
||||||
|
|
@ -297,6 +299,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.live.emit(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadAndPlay(call: RdioScannerCall): void {
|
loadAndPlay(call: RdioScannerCall): void {
|
||||||
|
|
@ -310,6 +314,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
this.live.complete();
|
||||||
|
|
||||||
this.unsubscribeLivefeed();
|
this.unsubscribeLivefeed();
|
||||||
|
|
||||||
this.unsubscribeSearchForm();
|
this.unsubscribeSearchForm();
|
||||||
|
|
@ -729,8 +735,6 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
if (!this.searchFormSubscription) {
|
if (!this.searchFormSubscription) {
|
||||||
this.searchFormSubscription = this.searchForm.valueChanges.subscribe((value) => {
|
this.searchFormSubscription = this.searchForm.valueChanges.subscribe((value) => {
|
||||||
if (!Object.keys(value).every((key) => value[key] === lastValue[key])) {
|
if (!Object.keys(value).every((key) => value[key] === lastValue[key])) {
|
||||||
lastValue = value;
|
|
||||||
|
|
||||||
if (value.system !== lastValue.system && value.talkgroup !== -1) {
|
if (value.system !== lastValue.system && value.talkgroup !== -1) {
|
||||||
lastValue.talkgroup = -1;
|
lastValue.talkgroup = -1;
|
||||||
this.searchForm.get('talkgroup').reset(lastValue.talkgroup);
|
this.searchForm.get('talkgroup').reset(lastValue.talkgroup);
|
||||||
|
|
@ -739,6 +743,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
this.matPaginator.firstPage();
|
this.matPaginator.firstPage();
|
||||||
|
|
||||||
this.loadStoredCalls(value);
|
this.loadStoredCalls(value);
|
||||||
|
|
||||||
|
lastValue = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
up: async (queryInterface, Sequelize) => {
|
up: async (queryInterface) => {
|
||||||
const transaction = await queryInterface.sequelize.transaction();
|
const transaction = await queryInterface.sequelize.transaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
up: async (queryInterface) => {
|
||||||
|
const transaction = await queryInterface.sequelize.transaction();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await queryInterface.addIndex('rdioScannerCalls', ['system'], { transaction });
|
||||||
|
|
||||||
|
await queryInterface.addIndex('rdioScannerCalls', ['system', 'talkgroup'], { transaction });
|
||||||
|
|
||||||
|
await transaction.commit();
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
down: async (queryInterface) => {
|
||||||
|
const transaction = queryInterface.sequelize.transaction();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await queryInterface.removeIndex('rdioScannerCalls', ['system'], { transaction });
|
||||||
|
|
||||||
|
await queryInterface.removeIndex('rdioScannerCalls', ['system', 'talkgroup'], { transaction });
|
||||||
|
|
||||||
|
await transaction.commit();
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue