aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.service.ts
blob: a8dfeafbb53d520f55929997feb035dcd0713f74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Injectable } from '@angular/core';
import { ApiService } from '../../../../common/core/services/api.typed.service';
import { BlueprintURLs } from '../../../../common/constants/app-constants';
import { Observable } from 'rxjs';
import { BlueprintDetailModel } from '../model/Blueprint.detail.model';


@Injectable({
    providedIn: 'root'
})
export class ConfigurationDashboardService {
    constructor(private api: ApiService<BlueprintDetailModel>) {

    }

    private getBlueprintModel(id: string): Observable<BlueprintDetailModel> {
        return this.api.getOne(BlueprintURLs.getOneBlueprint + '/' + id);
    }

    getPagedPackages(id: string) {
        return this.getBlueprintModel(id);
    }

    public downloadResource(path: string) {
        return this.api.getCustomized(BlueprintURLs.download + path, { responseType: 'blob' });
    }

    deployPost(body: any | null): Observable<any> {
        return this.api.post(BlueprintURLs.deploy, body, { responseType: 'text' });
    }
    deletePackage(id: string) {
        return this.api.delete(BlueprintURLs.getOneBlueprint + '/' + id, { observe: 'response' });
    }
}