Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webapp: add config.* files missing from 2b3c181
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
mythtv/html/backend/src/app/services/config.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { ConfigService } from './config.service'; | ||
|
||
describe('ConfigServiceService', () => { | ||
let service: ConfigService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
service = TestBed.inject(ConfigService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient, HttpHeaders, HttpParams, HttpErrorResponse } from '@angular/common/http'; | ||
import { Observable, throwError } from 'rxjs'; | ||
import { catchError, tap } from 'rxjs/operators'; | ||
import { MythConnectionInfo, Database } from './interfaces/myth.interface'; | ||
import { MythDatabaseStatus, MythCountryList, MythLanguageList, Country, Language } from './interfaces/config.interface'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ConfigService { | ||
|
||
constructor(private httpClient: HttpClient) { } | ||
|
||
public GetDatabaseStatus(): Observable<MythDatabaseStatus> { | ||
return this.httpClient.get<MythDatabaseStatus>('/Config/GetDatabaseStatus') | ||
} | ||
|
||
public SetDatabaseCredentials(data: Database): Observable<Database> { | ||
return this.httpClient.post<Database>('/Config/SetDatabaseCredentials', data) | ||
} | ||
public GetCountries(): Observable<MythCountryList> { | ||
return this.httpClient.get<MythCountryList>('/Config/GetCountries') | ||
} | ||
|
||
public GetLanguages(): Observable<MythLanguageList> { | ||
return this.httpClient.get<MythLanguageList>('/Config/GetLanguages') | ||
} | ||
} | ||
|
44 changes: 44 additions & 0 deletions
44
mythtv/html/backend/src/app/services/interfaces/config.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
export interface MythDatabaseStatus { | ||
DatabaseStatus: { | ||
Host: string; // can be hostname or ip address | ||
Port: number; // default is 3306 | ||
UserName: string; | ||
Password: string; | ||
Name: string; // default is mythconverg | ||
Ping: boolean; | ||
Type: string; | ||
LocalEnabled: boolean; | ||
LocalHostName: string; | ||
|
||
Connected: boolean; | ||
HaveDatabase: boolean; | ||
SchemaVersion: number; | ||
} | ||
} | ||
|
||
export interface Language { | ||
Code: string; | ||
Language: string; | ||
NativeLanguage?: string; | ||
Image?: string; | ||
} | ||
|
||
export interface MythLanguageList { | ||
LanguageList: { | ||
Languages: Language[] | ||
} | ||
} | ||
|
||
export interface Country { | ||
Code: string; | ||
Country: string; | ||
NativeCountry?: string; | ||
Image?: string; | ||
} | ||
|
||
export interface MythCountryList { | ||
CountryList: { | ||
Countries: Country[] | ||
} | ||
} | ||
|