Version 4.7.1

This commit is contained in:
Chrystian Huot 2020-09-26 08:16:45 -04:00
parent 9ec483a531
commit f63111f2ab
7 changed files with 68 additions and 14 deletions

View file

@ -1,6 +1,6 @@
{
"name": "rdio-scanner-client",
"version": "4.7.0",
"version": "4.7.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -32,5 +32,5 @@
"build": "ng build --base-href ./ --prod",
"start": "ng serve"
},
"version": "4.7.0"
"version": "4.7.1"
}

View file

@ -682,7 +682,7 @@ export class AppRdioScannerService implements OnDestroy {
this.websocket.onclose = (ev: CloseEvent) => {
if (ev.code !== 1000) {
this.reconnectWebsocket();
timer(2000).subscribe(() => this.reconnectWebsocket());
}
};
@ -815,13 +815,13 @@ export class AppRdioScannerService implements OnDestroy {
private rebuildGroups(): void {
this.groups = Object.keys(this.config.groups || []).map((label) => {
const allOff = Object.keys(this.config.groups[label])
.map((sys) => +sys)
.every((sys: number) => this.config.groups[label][sys].every((tg) => !this.livefeedMap[sys][tg]));
const allOff = Object.keys(this.config.groups[label]).map((sys) => +sys)
.every((sys: number) => this.config.groups[label] && this.config.groups[label][sys]
.every((tg) => !this.livefeedMap[sys][tg]));
const allOn = Object.keys(this.config.groups[label])
.map((sys) => +sys)
.every((sys: number) => this.config.groups[label][sys].every((tg) => this.livefeedMap[sys][tg]));
const allOn = Object.keys(this.config.groups[label]).map((sys) => +sys)
.every((sys: number) => this.config.groups[label] && this.config.groups[label][sys]
.every((tg) => this.livefeedMap[sys][tg]));
const status = allOff ? RdioScannerGroupStatus.Off : allOn ? RdioScannerGroupStatus.On : RdioScannerGroupStatus.Partial;

View file

@ -11,5 +11,5 @@
"start": "node run",
"update": "node update"
},
"version": "4.7.0"
"version": "4.7.1"
}

View file

@ -294,12 +294,39 @@ class Controller extends EventEmitter {
async getConfig(scope) {
return Object.assign({}, this.getOptions(), {
groups: this.groups,
groups: this.getGroups(scope),
systems: await this.getSystems(scope),
tags: this.tags,
tags: this.getTags(scope),
});
}
getGroups(scope = {}) {
if (scope !== null && typeof scope === 'object') {
return Object.keys(this.groups).reduce((groups, group) => {
Object.keys(this.groups[group]).forEach((system) => {
if (Object.keys(scope).includes(system)) {
const talkgroups = this.groups[group][system]
.filter((talkgroup) => scope[system].includes(talkgroup));
if (talkgroups.length) {
if (!groups[group]) {
groups[group] = {};
}
groups[group][system] = talkgroups;
}
}
});
return groups;
}, {});
} else {
return this.groups;
}
}
getOptions() {
const options = this.config.options;
@ -414,6 +441,33 @@ class Controller extends EventEmitter {
}
}
getTags(scope = {}) {
if (scope !== null && typeof scope === 'object') {
return Object.keys(this.tags).reduce((tags, tag) => {
Object.keys(this.tags[tag]).forEach((system) => {
if (Object.keys(scope).includes(system)) {
const talkgroups = this.tags[tag][system]
.filter((talkgroup) => scope[system].includes(talkgroup));
if (talkgroups.length) {
if (!tags[tag]) {
tags[tag] = {};
}
tags[tag][system] = talkgroups;
}
}
});
return tags;
}, {});
} else {
return this.tags;
}
}
async importCall(call = {}) {
const system = this.config.systems.find((sys) => sys.id === call.system);

View file

@ -1,6 +1,6 @@
{
"name": "rdio-scanner-server",
"version": "4.7.0",
"version": "4.7.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -39,5 +39,5 @@
"build": "webpack",
"start": "nodemon"
},
"version": "4.7.0"
"version": "4.7.1"
}