Compare commits

...

2 commits

Author SHA1 Message Date
fc34e3b1d9 import wip 2024-11-13 10:51:02 -05:00
7af1dd1720 import 2024-11-13 08:22:55 -05:00
4 changed files with 18 additions and 5 deletions

View file

@ -29,6 +29,10 @@ export interface System {
name: string; name: string;
} }
export interface Metadata {
encrypted: boolean|null;
}
export interface Talkgroup { export interface Talkgroup {
id: number; id: number;
system_id: number; system_id: number;
@ -37,7 +41,7 @@ export interface Talkgroup {
alpha_tag: string; alpha_tag: string;
tg_group: string; tg_group: string;
frequency: number; frequency: number;
metadata: Object; metadata: Metadata|null;
tags: string[]; tags: string[];
alert: boolean; alert: boolean;
alert_config: AlertRule[]; alert_config: AlertRule[];

View file

@ -6,6 +6,7 @@
placeholder="Paste RadioReference page here" placeholder="Paste RadioReference page here"
formControlName="contents" formControlName="contents"
></textarea> ></textarea>
<input type="number" class="input input-bordered" formControlName="systemID" id="systemID" />
<input type="submit" class="btn btn-secondary" value="Save" /> <input type="submit" class="btn btn-secondary" value="Save" />
</form> </form>
</div> </div>
@ -16,8 +17,11 @@
<tr> <tr>
<th>Sys</th> <th>Sys</th>
<th>Sys ID</th> <th>Sys ID</th>
<th>Group</th>
<th>Alpha</th>
<th>Name</th> <th>Name</th>
<th>TG ID</th> <th>TG ID</th>
<th>Enc</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -26,8 +30,11 @@
<tr> <tr>
<td>{{ tg.system.name }}</td> <td>{{ tg.system.name }}</td>
<td>{{ tg.system.id }}</td> <td>{{ tg.system.id }}</td>
<td>{{ tg.tg_group }}</td>
<td>{{ tg.alpha_tag }}</td>
<td>{{ tg.name }}</td> <td>{{ tg.name }}</td>
<td>{{ tg.tgid }}</td> <td>{{ tg.tgid }}</td>
<td>{{ tg?.metadata?.encrypted ? 'E' : '' }}</td>
</tr> </tr>
} }
</tbody> </tbody>

View file

@ -26,11 +26,13 @@ export class ImportComponent {
ngOnInit() { ngOnInit() {
this.form = new FormGroup({ this.form = new FormGroup({
contents: new FormControl(''), contents: new FormControl(''),
systemID: new FormControl(0),
}); });
} }
submit() { submit() {
let content = this.form.controls['contents'].value; let content = this.form.controls['contents'].value;
this.tgService.importRR(content) let sysID = Number(this.form.controls['systemID'].value);
this.tgService.importRR(sysID, content)
.pipe( .pipe(
catchError(() => { catchError(() => {
return of(null); return of(null);

View file

@ -18,9 +18,9 @@ export class TalkgroupService {
return this.http.get<Talkgroup>(`/api/talkgroup/${sys}/${tg}`); return this.http.get<Talkgroup>(`/api/talkgroup/${sys}/${tg}`);
} }
importRR(content: string): Observable<Talkgroup[]> { importRR(sysID: number, content: string): Observable<Talkgroup[]> {
return this.http.put<Talkgroup[]>('/api/talkgroup/import', return this.http.post<Talkgroup[]>('/api/talkgroup/import',
{type: 'radioreference', body: content}); {systemID: sysID, type: 'radioreference', body: content});
} }
putTalkgroup(tu: TalkgroupUpdate): Observable<Talkgroup> { putTalkgroup(tu: TalkgroupUpdate): Observable<Talkgroup> {