RdioScannerCalls index improvement and minor bug fix to search pane

This commit is contained in:
Chrystian Huot 2020-01-23 10:56:55 -05:00
parent 1c62d9d1fc
commit 093ba42ff4
3 changed files with 48 additions and 4 deletions

View file

@ -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 { MatPaginator } from '@angular/material/paginator';
import { BehaviorSubject, Subscription } from 'rxjs';
@ -35,6 +35,8 @@ interface RdioScannerSelection {
templateUrl: './rdio-scanner.component.html',
})
export class AppRdioScannerComponent implements OnDestroy, OnInit {
@Output() readonly live = new EventEmitter<boolean>();
get call() { return this._call; }
get callHistory() { return this._callHistory; }
get callPrevious() { return this._callPrevious; }
@ -297,6 +299,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
this.stop();
}
this.live.emit(status);
}
loadAndPlay(call: RdioScannerCall): void {
@ -310,6 +314,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
}
ngOnDestroy(): void {
this.live.complete();
this.unsubscribeLivefeed();
this.unsubscribeSearchForm();
@ -729,8 +735,6 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
if (!this.searchFormSubscription) {
this.searchFormSubscription = this.searchForm.valueChanges.subscribe((value) => {
if (!Object.keys(value).every((key) => value[key] === lastValue[key])) {
lastValue = value;
if (value.system !== lastValue.system && value.talkgroup !== -1) {
lastValue.talkgroup = -1;
this.searchForm.get('talkgroup').reset(lastValue.talkgroup);
@ -739,6 +743,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
this.matPaginator.firstPage();
this.loadStoredCalls(value);
lastValue = value;
}
});
}

View file

@ -2,7 +2,7 @@
module.exports = {
up: async (queryInterface, Sequelize) => {
up: async (queryInterface) => {
const transaction = await queryInterface.sequelize.transaction();
try {

View file

@ -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;
}
},
};