diff --git a/client/admin/src/app/alerts/alerts.component.spec.ts b/client/admin/src/app/alerts/alerts.component.spec.ts
index e5c0655..9884aec 100644
--- a/client/admin/src/app/alerts/alerts.component.spec.ts
+++ b/client/admin/src/app/alerts/alerts.component.spec.ts
@@ -8,9 +8,8 @@ describe('AlertsComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
- imports: [AlertsComponent]
- })
- .compileComponents();
+ imports: [AlertsComponent],
+ }).compileComponents();
fixture = TestBed.createComponent(AlertsComponent);
component = fixture.componentInstance;
diff --git a/client/admin/src/app/alerts/alerts.component.ts b/client/admin/src/app/alerts/alerts.component.ts
index 66b67b3..7749590 100644
--- a/client/admin/src/app/alerts/alerts.component.ts
+++ b/client/admin/src/app/alerts/alerts.component.ts
@@ -5,8 +5,6 @@ import { Component } from '@angular/core';
standalone: true,
imports: [],
templateUrl: './alerts.component.html',
- styleUrl: './alerts.component.css'
+ styleUrl: './alerts.component.css',
})
-export class AlertsComponent {
-
-}
+export class AlertsComponent {}
diff --git a/client/admin/src/app/app.component.html b/client/admin/src/app/app.component.html
index 654db75..d2967ad 100644
--- a/client/admin/src/app/app.component.html
+++ b/client/admin/src/app/app.component.html
@@ -1,63 +1,109 @@
diff --git a/client/admin/src/app/app.component.ts b/client/admin/src/app/app.component.ts
index 0e83e90..0ba2ca6 100644
--- a/client/admin/src/app/app.component.ts
+++ b/client/admin/src/app/app.component.ts
@@ -3,17 +3,47 @@ import { RouterModule, RouterOutlet, RouterLink } from '@angular/router';
import { CommonModule } from '@angular/common';
import { AuthService } from './login/auth.service';
import { NgIconComponent, provideIcons } from '@ng-icons/core';
-import { ionMenuOutline, ionChatbubbles, ionNewspaperOutline, ionAlertCircleOutline, ionRadioOutline, ionHome, ionMegaphoneOutline } from '@ng-icons/ionicons';
+import {
+ ionMenuOutline,
+ ionChatbubbles,
+ ionNewspaperOutline,
+ ionAlertCircleOutline,
+ ionRadioOutline,
+ ionHome,
+ ionMegaphoneOutline,
+ ionCreateOutline,
+} from '@ng-icons/ionicons';
@Component({
selector: 'app-root',
standalone: true,
- imports: [CommonModule, RouterOutlet, RouterModule, RouterLink, NgIconComponent],
+ imports: [
+ CommonModule,
+ RouterOutlet,
+ RouterModule,
+ RouterLink,
+ NgIconComponent,
+ ],
templateUrl: './app.component.html',
styleUrl: './app.component.css',
- providers: [ provideIcons({ ionMenuOutline, ionChatbubbles, ionNewspaperOutline, ionAlertCircleOutline, ionRadioOutline, ionHome, ionMegaphoneOutline })],
+ providers: [
+ provideIcons({
+ ionMenuOutline,
+ ionChatbubbles,
+ ionNewspaperOutline,
+ ionAlertCircleOutline,
+ ionRadioOutline,
+ ionHome,
+ ionMegaphoneOutline,
+ ionCreateOutline,
+ }),
+ ],
})
export class AppComponent {
auth: AuthService = inject(AuthService);
title = 'admin';
+
+ logout() {
+ this.auth.logout();
+ }
}
diff --git a/client/admin/src/app/app.config.ts b/client/admin/src/app/app.config.ts
index 511abb3..74fe6e8 100644
--- a/client/admin/src/app/app.config.ts
+++ b/client/admin/src/app/app.config.ts
@@ -7,7 +7,8 @@ import {
withInterceptors,
} from '@angular/common/http';
import { Observable } from 'rxjs';
-import { isDevMode } from '@angular/core';
+import { isDevMode, inject } from '@angular/core';
+import { AuthService } from './login/auth.service';
import { routes } from './app.routes';
import { provideHttpClient } from '@angular/common/http';
@@ -26,10 +27,28 @@ export function apiBaseInterceptor(
return next(apiReq);
}
+export function authIntercept(
+ req: HttpRequest,
+ next: HttpHandlerFn,
+): Observable> {
+ let authSvc: AuthService = inject(AuthService);
+ if (authSvc.loggedIn) {
+ req = req.clone({
+ setHeaders: {
+ 'Content-Type': 'application/json; charset=utf-8',
+ Accept: 'application/json',
+ Authorization: `Bearer ${authSvc.getToken()}`,
+ },
+ });
+ }
+
+ return next(req);
+}
+
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
- provideHttpClient(withInterceptors([apiBaseInterceptor])),
+ provideHttpClient(withInterceptors([apiBaseInterceptor, authIntercept])),
],
};
diff --git a/client/admin/src/app/calls/calls.component.spec.ts b/client/admin/src/app/calls/calls.component.spec.ts
index b21bcce..b4e0294 100644
--- a/client/admin/src/app/calls/calls.component.spec.ts
+++ b/client/admin/src/app/calls/calls.component.spec.ts
@@ -8,9 +8,8 @@ describe('CallsComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
- imports: [CallsComponent]
- })
- .compileComponents();
+ imports: [CallsComponent],
+ }).compileComponents();
fixture = TestBed.createComponent(CallsComponent);
component = fixture.componentInstance;
diff --git a/client/admin/src/app/calls/calls.component.ts b/client/admin/src/app/calls/calls.component.ts
index b2c1bef..8f3f317 100644
--- a/client/admin/src/app/calls/calls.component.ts
+++ b/client/admin/src/app/calls/calls.component.ts
@@ -5,8 +5,6 @@ import { Component } from '@angular/core';
standalone: true,
imports: [],
templateUrl: './calls.component.html',
- styleUrl: './calls.component.css'
+ styleUrl: './calls.component.css',
})
-export class CallsComponent {
-
-}
+export class CallsComponent {}
diff --git a/client/admin/src/app/home/home.component.html b/client/admin/src/app/home/home.component.html
index d21c1f0..841e271 100644
--- a/client/admin/src/app/home/home.component.html
+++ b/client/admin/src/app/home/home.component.html
@@ -1,3 +1 @@
-
-This will be a dashboard someday.
-
+This will be a dashboard someday.
diff --git a/client/admin/src/app/home/home.component.ts b/client/admin/src/app/home/home.component.ts
index 40cb439..14c5108 100644
--- a/client/admin/src/app/home/home.component.ts
+++ b/client/admin/src/app/home/home.component.ts
@@ -7,5 +7,4 @@ import { Component } from '@angular/core';
templateUrl: './home.component.html',
styleUrl: './home.component.css',
})
-export class HomeComponent {
-}
+export class HomeComponent {}
diff --git a/client/admin/src/app/incidents/incidents.component.spec.ts b/client/admin/src/app/incidents/incidents.component.spec.ts
index 7e7a549..b1b4516 100644
--- a/client/admin/src/app/incidents/incidents.component.spec.ts
+++ b/client/admin/src/app/incidents/incidents.component.spec.ts
@@ -8,9 +8,8 @@ describe('IncidentsComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
- imports: [IncidentsComponent]
- })
- .compileComponents();
+ imports: [IncidentsComponent],
+ }).compileComponents();
fixture = TestBed.createComponent(IncidentsComponent);
component = fixture.componentInstance;
diff --git a/client/admin/src/app/incidents/incidents.component.ts b/client/admin/src/app/incidents/incidents.component.ts
index dcbc656..1da8080 100644
--- a/client/admin/src/app/incidents/incidents.component.ts
+++ b/client/admin/src/app/incidents/incidents.component.ts
@@ -5,8 +5,6 @@ import { Component } from '@angular/core';
standalone: true,
imports: [],
templateUrl: './incidents.component.html',
- styleUrl: './incidents.component.css'
+ styleUrl: './incidents.component.css',
})
-export class IncidentsComponent {
-
-}
+export class IncidentsComponent {}
diff --git a/client/admin/src/app/login/auth.service.ts b/client/admin/src/app/login/auth.service.ts
index 1ed781d..f637668 100644
--- a/client/admin/src/app/login/auth.service.ts
+++ b/client/admin/src/app/login/auth.service.ts
@@ -41,4 +41,14 @@ export class AuthService {
}),
);
}
+
+ getToken(): string | null {
+ return sessionStorage.getItem('jwt');
+ }
+
+ logout() {
+ sessionStorage.removeItem('jwt');
+ this.loggedIn = false;
+ this._router.navigateByUrl('/login');
+ }
}
diff --git a/client/admin/src/app/talkgroup.ts b/client/admin/src/app/talkgroup.ts
new file mode 100644
index 0000000..ece582f
--- /dev/null
+++ b/client/admin/src/app/talkgroup.ts
@@ -0,0 +1,30 @@
+export interface TGID {
+ sys: number;
+ tg: number;
+}
+
+export interface AlertRule {
+ times: string[];
+ mult: number;
+}
+
+export interface System {
+ id: number;
+ name: string;
+}
+
+export interface Talkgroup {
+ id: number;
+ system_id: number;
+ tgid: number;
+ name: string;
+ alpha_tag: string;
+ tg_group: string;
+ frequency: number;
+ metadata: Object;
+ tags: string[];
+ alert: boolean;
+ alert_config: Map;
+ system: System;
+ weight: number;
+}
diff --git a/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.css b/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.html b/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.html
new file mode 100644
index 0000000..d2d08c7
--- /dev/null
+++ b/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.html
@@ -0,0 +1 @@
+TG comp
diff --git a/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.spec.ts b/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.spec.ts
new file mode 100644
index 0000000..d2c050f
--- /dev/null
+++ b/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.spec.ts
@@ -0,0 +1,22 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TalkgroupRecordComponent } from './talkgroup-record.component';
+
+describe('TalkgroupRecordComponent', () => {
+ let component: TalkgroupRecordComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [TalkgroupRecordComponent],
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(TalkgroupRecordComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.ts b/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.ts
new file mode 100644
index 0000000..994ab3e
--- /dev/null
+++ b/client/admin/src/app/talkgroups/talkgroup-record/talkgroup-record.component.ts
@@ -0,0 +1,16 @@
+import { Component } from '@angular/core';
+import { Talkgroup } from '../../talkgroup';
+
+@Component({
+ selector: 'talkgroup-record',
+ standalone: true,
+ imports: [],
+ templateUrl: './talkgroup-record.component.html',
+ styleUrl: './talkgroup-record.component.css',
+})
+export class TalkgroupRecordComponent {
+ tg: Talkgroup;
+ constructor(tg: Talkgroup) {
+ this.tg = tg;
+ }
+}
diff --git a/client/admin/src/app/talkgroups/talkgroups.component.html b/client/admin/src/app/talkgroups/talkgroups.component.html
index d574412..1e15fcb 100644
--- a/client/admin/src/app/talkgroups/talkgroups.component.html
+++ b/client/admin/src/app/talkgroups/talkgroups.component.html
@@ -1 +1,26 @@
-talkgroups works!
+
+
+
+
+
+ Sys |
+ Sys ID |
+ Name |
+ TG ID |
+ |
+
+
+
+
+ @for (tg of tgs; track tg.id) {
+
+ {{ tg.system.name }} |
+ {{ tg.system.id }} |
+ {{ tg.name }} |
+ {{ tg.tgid }} |
+ |
+
+ }
+
+
+
diff --git a/client/admin/src/app/talkgroups/talkgroups.component.spec.ts b/client/admin/src/app/talkgroups/talkgroups.component.spec.ts
index 2efde98..b4b8755 100644
--- a/client/admin/src/app/talkgroups/talkgroups.component.spec.ts
+++ b/client/admin/src/app/talkgroups/talkgroups.component.spec.ts
@@ -8,9 +8,8 @@ describe('TalkgroupsComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
- imports: [TalkgroupsComponent]
- })
- .compileComponents();
+ imports: [TalkgroupsComponent],
+ }).compileComponents();
fixture = TestBed.createComponent(TalkgroupsComponent);
component = fixture.componentInstance;
diff --git a/client/admin/src/app/talkgroups/talkgroups.component.ts b/client/admin/src/app/talkgroups/talkgroups.component.ts
index 2beb598..0422691 100644
--- a/client/admin/src/app/talkgroups/talkgroups.component.ts
+++ b/client/admin/src/app/talkgroups/talkgroups.component.ts
@@ -1,12 +1,26 @@
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
+import { TalkgroupService } from './talkgroups.service';
+import { Talkgroup } from '../talkgroup';
+import { NgIconComponent, provideIcons } from '@ng-icons/core';
+import { ionCreateOutline } from '@ng-icons/ionicons';
@Component({
- selector: 'app-talkgroups',
+ selector: 'talkgroups',
standalone: true,
- imports: [],
+ imports: [NgIconComponent],
templateUrl: './talkgroups.component.html',
- styleUrl: './talkgroups.component.css'
+ styleUrl: './talkgroups.component.css',
+ providers: [provideIcons({ ionCreateOutline })],
})
export class TalkgroupsComponent {
+ tgs: Talkgroup[] = [];
+ tgService: TalkgroupService = inject(TalkgroupService);
+ ngOnInit() {
+ this.getTalkgroups();
+ }
+
+ getTalkgroups() {
+ this.tgService.getTalkgroups().subscribe((tgs) => (this.tgs = tgs));
+ }
}
diff --git a/client/admin/src/app/talkgroups/talkgroups.service.spec.ts b/client/admin/src/app/talkgroups/talkgroups.service.spec.ts
new file mode 100644
index 0000000..0b7fc5e
--- /dev/null
+++ b/client/admin/src/app/talkgroups/talkgroups.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { APIService } from './api.service';
+
+describe('APIService', () => {
+ let service: APIService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(APIService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/client/admin/src/app/talkgroups/talkgroups.service.ts b/client/admin/src/app/talkgroups/talkgroups.service.ts
new file mode 100644
index 0000000..237d4f0
--- /dev/null
+++ b/client/admin/src/app/talkgroups/talkgroups.service.ts
@@ -0,0 +1,16 @@
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { Talkgroup } from '../talkgroup';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class TalkgroupService {
+ loggedIn: boolean = false;
+ constructor(private http: HttpClient) {}
+
+ getTalkgroups(): Observable {
+ return this.http.get('/api/talkgroup/');
+ }
+}