diff options
Diffstat (limited to 'admin/WebConsole3/frontend/src/app/api')
3 files changed, 54 insertions, 38 deletions
diff --git a/admin/WebConsole3/frontend/src/app/api/repository.service.ts b/admin/WebConsole3/frontend/src/app/api/repository.service.ts index 1561f41a..55fd88a0 100644 --- a/admin/WebConsole3/frontend/src/app/api/repository.service.ts +++ b/admin/WebConsole3/frontend/src/app/api/repository.service.ts @@ -1,27 +1,27 @@ -import { Injectable } from '@angular/core';
-import { HttpClient} from '@angular/common/http';
-
-import { environment } from '../../environments/environment';
-import { Repository } from '../model/repository';
-import { RepositorySerializer } from '../serializer/repository.serializer';
-
-import {ResourceService} from 'globunet-angular/core/providers/api/resource.service';
-import {Observable} from 'rxjs';
-
-
-@Injectable({
- providedIn: 'root'
-})
-export class RepositoryService extends ResourceService<Repository> {
-
- constructor(http: HttpClient) {
- super(http, environment.API_URL, 'repositories', new RepositorySerializer());
- }
-
- getInfo(repository: Repository) {
- const url = 'https://' + repository.ip + '/' + environment.BASE_DIR + environment.API_BASE_URL;
- return this.httpClient.get(url, {headers: {
- Authorization: repository.password
- }});
- }
-}
+import { Injectable } from '@angular/core'; +import { HttpClient} from '@angular/common/http'; + +import { environment } from '../../environments/environment'; +import { Repository } from '../model/repository'; +import { RepositorySerializer } from '../serializer/repository.serializer'; + +import {ResourceService} from 'globunet-angular/core/providers/api/resource.service'; +import {Observable} from 'rxjs'; + + +@Injectable({ + providedIn: 'root' +}) +export class RepositoryService extends ResourceService<Repository> { + + constructor(http: HttpClient) { + super(http, environment.API_URL, 'repositories', new RepositorySerializer()); + } + + getInfo(repository: Repository) { + const url = 'https://' + repository.ip + '/' + environment.BASE_DIR + environment.API_BASE_URL; + return this.httpClient.get(url, {headers: { + Authorization: repository.randomId + }}); + } +} diff --git a/admin/WebConsole3/frontend/src/app/api/software-component.service.ts b/admin/WebConsole3/frontend/src/app/api/software-component.service.ts index b154d41a..515f1cb4 100644 --- a/admin/WebConsole3/frontend/src/app/api/software-component.service.ts +++ b/admin/WebConsole3/frontend/src/app/api/software-component.service.ts @@ -14,7 +14,7 @@ import {ResourceService} from "globunet-angular/core/providers/api/resource.serv export class SoftwareComponentService extends ResourceService<SoftwareComponent> { constructor(http: HttpClient){ - super(http, environment.API_URL,"softwarecomponents", new SoftwareComponentSerializer()); + super(http, environment.API_URL,"softwares", new SoftwareComponentSerializer()); } } diff --git a/admin/WebConsole3/frontend/src/app/api/software-type.service.ts b/admin/WebConsole3/frontend/src/app/api/software-type.service.ts index ccc6eb8f..1c250b91 100644 --- a/admin/WebConsole3/frontend/src/app/api/software-type.service.ts +++ b/admin/WebConsole3/frontend/src/app/api/software-type.service.ts @@ -1,20 +1,36 @@ -import { Injectable } from '@angular/core'; -import { HttpClient} from '@angular/common/http'; +import {Injectable} from '@angular/core'; +import {HttpClient} from '@angular/common/http'; -import { environment } from '../../environments/environment'; -import { SoftwareType } from "../model/software-type"; -import { SoftwareTypeSerializer } from "../serializer/software-type.serializer"; +import {environment} from '../../environments/environment'; +import {SoftwareType} from '../model/software-type'; +import {SoftwareTypeSerializer} from '../serializer/software-type.serializer'; -import {ResourceService} from "globunet-angular/core/providers/api/resource.service"; +import {ResourceService} from 'globunet-angular/core/providers/api/resource.service'; +import {QueryOptions} from 'globunet-angular/core/providers/api/query-options'; +import {Observable} from 'rxjs'; +import {OgCommonService} from '../service/og-common.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class SoftwareTypeService extends ResourceService<SoftwareType> { - constructor(http: HttpClient){ - super(http, environment.API_URL,"softwaretypes", new SoftwareTypeSerializer()); - } + constructor(http: HttpClient, private ogCommonService: OgCommonService) { + super(http, environment.API_URL, 'softwaretypes', new SoftwareTypeSerializer()); + } + + list(queryOptions?: QueryOptions): Observable<SoftwareType[]> { + return new Observable<SoftwareType[]>((observer) => { + this.ogCommonService.loadEngineConfig().subscribe( + data => { + observer.next(data.constants.sofwaretypes); + }, + error => { + observer.error(error); + } + ); + }); + } } |