broken
This commit is contained in:
parent
a0e53e6ece
commit
f3173f03ea
8 changed files with 55 additions and 48 deletions
|
@ -77,7 +77,9 @@
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div class="toolbarButtons">
|
<div class="toolbarButtons">
|
||||||
<button class="sbButton" (click)="resetFilter()"><mat-icon class="material-symbols-outlined">reset_settings</mat-icon></button>
|
<button class="sbButton" (click)="resetFilter()">
|
||||||
|
<mat-icon class="material-symbols-outlined">reset_settings</mat-icon>
|
||||||
|
</button>
|
||||||
<button class="sbButton" (click)="refresh()">
|
<button class="sbButton" (click)="refresh()">
|
||||||
<mat-icon>refresh</mat-icon>
|
<mat-icon>refresh</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -21,7 +21,8 @@ table,
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbarButtons button, .toolbarButtons form,
|
.toolbarButtons button,
|
||||||
|
.toolbarButtons form,
|
||||||
.toolbarButtons form button {
|
.toolbarButtons form button {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
|
@ -95,4 +96,3 @@ form {
|
||||||
.tagSelect {
|
.tagSelect {
|
||||||
flex: 1 1 250px;
|
flex: 1 1 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,11 +291,13 @@ export class CallsComponent {
|
||||||
this.currentServerPage = 0;
|
this.currentServerPage = 0;
|
||||||
this.setPage(this.zeroPage());
|
this.setPage(this.zeroPage());
|
||||||
});
|
});
|
||||||
|
this.prefsSvc.get('callsPerPage').subscribe((cpp) => {
|
||||||
|
this.perPage = cpp;
|
||||||
this.setPage(<PageEvent>{
|
this.setPage(<PageEvent>{
|
||||||
pageIndex: 0,
|
pageIndex: 0,
|
||||||
pageSize: 25,
|
pageSize: 25,
|
||||||
});
|
});
|
||||||
this.perPage = this.prefsSvc.get('callsPerPage');
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFilter() {
|
resetFilter() {
|
||||||
|
|
|
@ -2,19 +2,27 @@ import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
|
concatMap,
|
||||||
Observable,
|
Observable,
|
||||||
shareReplay,
|
shareReplay,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
|
|
||||||
type Preferences = Map<string, any>;
|
type Preferences = Map<string, any>;
|
||||||
|
|
||||||
|
function mapToObj(map: Map<any, any>): { [key: string]: any } {
|
||||||
|
const obj: { [key: string]: any } = {};
|
||||||
|
map.forEach((value, key) => {
|
||||||
|
obj[key] = value;
|
||||||
|
});
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class PrefsService {
|
export class PrefsService {
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient) {
|
||||||
this.prefs$ = this.fetch().pipe(shareReplay(1));
|
this.prefs$ = this.fetch().pipe(shareReplay(1));
|
||||||
this.fillPrefs();
|
|
||||||
}
|
}
|
||||||
last = <Preferences>{};
|
last = <Preferences>{};
|
||||||
private readonly _getPref = new Map<string, Observable<any>>();
|
private readonly _getPref = new Map<string, Observable<any>>();
|
||||||
|
@ -24,31 +32,26 @@ export class PrefsService {
|
||||||
return this.http.get<Preferences>('/api/user/prefs/stillbox');
|
return this.http.get<Preferences>('/api/user/prefs/stillbox');
|
||||||
}
|
}
|
||||||
|
|
||||||
fillPrefs() {
|
|
||||||
this.prefs$.subscribe((prefs) => {
|
|
||||||
if (prefs.size > 0) {
|
|
||||||
prefs.forEach((k, v) => {
|
|
||||||
this._getPref.set(k, new BehaviorSubject<any>(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
get(k: string): any{
|
|
||||||
const r = this._getPref.get(k);
|
get(k: string): Observable<any> {
|
||||||
return r;
|
return this.prefs$.pipe(
|
||||||
|
concatMap((prefs) => {
|
||||||
|
if (prefs instanceof Map) {
|
||||||
|
const v = prefs.get(k) ?? new BehaviorSubject(null);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
return new BehaviorSubject(null);
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
set(pref: string, value: any) {
|
set(pref: string, value: any) {
|
||||||
if (this._getPref.get(pref) != value) {
|
this.prefs$.subscribe((prefs) => {
|
||||||
this._getPref.set(pref, value);
|
prefs.set(pref, value);
|
||||||
this.setPrefs();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setPrefs() {
|
|
||||||
this.http
|
this.http
|
||||||
.put<Preferences>('/api/user/prefs/stillbox', this._getPref)
|
.put<Preferences>('/api/user/prefs/stillbox', mapToObj(prefs))
|
||||||
.subscribe((event) => {});
|
.subscribe((event) => {});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,9 @@ export class TalkgroupTableComponent {
|
||||||
this.suppress = false;
|
this.suppress = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.perPage = this.prefsService.get('tgsPerPage');
|
this.prefsService.get('tgsPerPage').subscribe((tgpp) => {
|
||||||
|
this.perPage = tgpp;
|
||||||
|
});
|
||||||
this.talkgroups$.subscribe((event) => {
|
this.talkgroups$.subscribe((event) => {
|
||||||
if (event != null) {
|
if (event != null) {
|
||||||
this.dataSource.data = event!.talkgroups;
|
this.dataSource.data = event!.talkgroups;
|
||||||
|
|
|
@ -73,8 +73,10 @@ export class TalkgroupsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.perPage = this.prefsService.get('tgsPerPage');
|
this.prefsService.get('tgsPerPage').subscribe((tgpp) => {
|
||||||
|
this.perPage = tgpp;
|
||||||
this.switchPage(this.curPage);
|
this.switchPage(this.curPage);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient, HttpResponse } from '@angular/common/http';
|
import { HttpClient, HttpResponse } from '@angular/common/http';
|
||||||
import {
|
import { concatMap, Observable, ReplaySubject, shareReplay } from 'rxjs';
|
||||||
concatMap,
|
|
||||||
Observable,
|
|
||||||
ReplaySubject,
|
|
||||||
shareReplay,
|
|
||||||
} from 'rxjs';
|
|
||||||
import { Talkgroup, TalkgroupUpdate, TGID } from '../talkgroup';
|
import { Talkgroup, TalkgroupUpdate, TGID } from '../talkgroup';
|
||||||
|
|
||||||
export interface Pagination {
|
export interface Pagination {
|
||||||
|
@ -81,7 +76,9 @@ export class TalkgroupService {
|
||||||
|
|
||||||
allTags(): Observable<string[]> {
|
allTags(): Observable<string[]> {
|
||||||
if (!this.tags$) {
|
if (!this.tags$) {
|
||||||
this.tags$ = this.http.get<string[]>('/api/talkgroup/tags').pipe(shareReplay());
|
this.tags$ = this.http
|
||||||
|
.get<string[]>('/api/talkgroup/tags')
|
||||||
|
.pipe(shareReplay());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.tags$;
|
return this.tags$;
|
||||||
|
|
|
@ -109,14 +109,14 @@ html {
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Material Symbols Outlined';
|
font-family: "Material Symbols Outlined";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url("./assets/MatSymOutline.ttf") format("truetype");
|
src: url("./assets/MatSymOutline.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-symbols-outlined {
|
.material-symbols-outlined {
|
||||||
font-family: 'Material Symbols Outlined';
|
font-family: "Material Symbols Outlined";
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
|
@ -129,7 +129,6 @@ html {
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
a,
|
a,
|
||||||
a:visited {
|
a:visited {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
Loading…
Reference in a new issue