This commit is contained in:
Daniel 2024-11-13 08:22:55 -05:00
parent f2b325c8a4
commit 7af1dd1720
3 changed files with 7 additions and 4 deletions

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>

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> {