diff options
author | Brinda Santh Muthuramalingam <brindasanth@in.ibm.com> | 2019-07-29 14:59:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-29 14:59:23 +0000 |
commit | a19b41ed344b70860cdb9694d6bd918890545ee4 (patch) | |
tree | 8ddd14585e5b8e54d5c732f58fffa6c0804f53bd /cds-ui/client/src/app/feature-modules | |
parent | c3295a523d1ded477501b8efa9e56458f6eb3dc6 (diff) | |
parent | 5ede965c0c3dd365be4efde0699d5ec976a614c3 (diff) |
Merge "Blueprint client backend integration fix"
Diffstat (limited to 'cds-ui/client/src/app/feature-modules')
3 files changed, 29 insertions, 26 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts index 0a3a8d2ef..7b2eaeb17 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts @@ -35,7 +35,7 @@ import { Store } from '@ngrx/store'; import { Observable } from 'rxjs'; import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState.model'; import { LoadBlueprintSuccess, SetBlueprintState } from '../../../../common/core/store/actions/blueprint.action' -import { ApiService } from 'src/app/common/core/services/api.service'; + import { IMetaData } from 'src/app/common/core/store/models/metadata.model'; import { EditorService } from './editor.service'; import { SortPipe } from '../../../../common/shared/pipes/sort.pipe'; @@ -130,7 +130,7 @@ export class EditorComponent implements OnInit { artifactName: any; artifactVersion: any; - constructor(private store: Store<IAppState>, private apiservice: EditorService, + constructor(private store: Store<IAppState>, private editorService: EditorService, private alertService: NotificationHandlerService, private loader: LoaderService ) { @@ -244,7 +244,8 @@ export class EditorComponent implements OnInit { .then(blob => { const formData = new FormData(); formData.append("file", blob); - this.apiservice.enrich("/enrich-blueprint/", formData) + // this.editorService.enrich("/enrich-blueprint/", formData) + this.editorService.enrich(formData) .subscribe( (response) => { this.zipFile.files = {}; @@ -271,7 +272,8 @@ export class EditorComponent implements OnInit { .then(blob => { const formData = new FormData(); formData.append("file", blob); - this.apiservice.post("/create-blueprint/", formData) + // this.editorService.saveBlueprint("/create-blueprint/", formData) + this.editorService.saveBlueprint(formData) .subscribe( data => { this.alertService.success('Success:' + JSON.stringify(data)); @@ -289,7 +291,8 @@ export class EditorComponent implements OnInit { .then(blob => { const formData = new FormData(); formData.append("file", blob); - this.apiservice.deployPost("/deploy-blueprint/", formData) + // this.editorService.deployPost("/deploy-blueprint/", formData) + this.editorService.deployPost(formData) .subscribe(data => { this.alertService.success('Saved Successfully:' + JSON.stringify(data)); }, error=>{ @@ -305,7 +308,8 @@ export class EditorComponent implements OnInit { .then(blob => { const formData = new FormData(); formData.append("file", blob); - this.apiservice.post("/publish/", formData) + // this.editorService.post("/publish/", formData) + this.editorService.publishBlueprint(formData) .subscribe(data => { this.alertService.success('Published:' + JSON.stringify(data)) }, error=>{ @@ -326,7 +330,8 @@ export class EditorComponent implements OnInit { download() { console.log(this.artifactName); - status = this.apiservice.downloadCBA("/download-blueprint/" + this.artifactName + "/" + this.artifactVersion); + // status = this.editorService.downloadCBA("/download-blueprint/" + this.artifactName + "/" + this.artifactVersion); + status = this.editorService.downloadCBA("/"+this.artifactName + "/" + this.artifactVersion); window.alert(status); // .subscribe(response => { // console.log(response); @@ -338,14 +343,8 @@ export class EditorComponent implements OnInit { // console.log(error); // } // ); - - // this.create(); - // var zipFilename = "baseconfiguration.zip"; - // this.zipFile.generateAsync({ type: "blob" }) - // .then(blob => { - // saveAs(blob, zipFilename); - // }); } + setEditorMode() { switch (this.fileExtension) { case "xml": diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts index ec2524422..025fc95d4 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts @@ -25,19 +25,18 @@ import { HttpClient } from '@angular/common/http'; import { Observable, observable } from 'rxjs'; import { ApiService } from '../../../../common/core/services/api.service'; import { saveAs } from 'file-saver'; +import { BlueprintURLs } from '../../../../common/constants/app-constants'; @Injectable() export class EditorService { - // blueprintUrl = '../../constants/blueprint.json'; - constructor(private _http: HttpClient, private api: ApiService) { } - enrich(uri: string, body: FormData): Observable<any> { - return this.api.post(uri, body, { responseType: 'blob' }); + enrich(body: FormData): Observable<any> { + return this.api.post(BlueprintURLs.enrich, body, { responseType: 'blob' }); } - downloadCBA(uri: string): string { - this.api.get(uri, { responseType: 'blob' }) + downloadCBA(artifactDetails: string): string { + this.api.get(BlueprintURLs.download+artifactDetails, { responseType: 'blob' }) .subscribe(response => { let blob = new Blob([response], { 'type': "application/octet-stream" }); saveAs(blob, "CBA.zip"); @@ -46,13 +45,17 @@ export class EditorService { return "Download Success"; } - post(uri: string, body: any | null, options?: any): Observable<any> { + saveBlueprint(body: any | null, options?: any): Observable<any> { + + return this.api.post(BlueprintURLs.save, body, options); + } + publishBlueprint(body: any | null, options?: any): Observable<any> { - return this.api.post(uri, body, options); + return this.api.post(BlueprintURLs.publish, body, options); } - deployPost(uri: string, body: any | null, options?: any): Observable<any> { + deployPost(body: any | null, options?: any): Observable<any> { - return this.api.post(uri, body, { responseType: 'text' }); + return this.api.post(BlueprintURLs.deploy, body, { responseType: 'text' }); } }
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts index dd17a30d2..9ce714dc9 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts @@ -23,6 +23,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { ApiService } from '../../../../common/core/services/api.service'; +import { BlueprintURLs } from '../../../../common/constants/app-constants'; @Injectable({ providedIn: 'root' @@ -31,7 +32,7 @@ export class SearchTemplateService { constructor(private _http: HttpClient, private api: ApiService) { } - searchByTags(uri: string, searchText: String): Observable<any>{ - return this.api.post(uri, searchText); + searchByTags(searchText: String): Observable<any>{ + return this.api.post(BlueprintURLs.searchByTag, searchText); } } |