From 5ede965c0c3dd365be4efde0699d5ec976a614c3 Mon Sep 17 00:00:00 2001 From: Ezhilarasi Date: Mon, 29 Jul 2019 20:07:04 +0530 Subject: Blueprint client backend integration fix Blueprint backend data integration fix Change-Id: If0e0b2c30bf07f06fc728ff26c509f265c5ee303 Issue-ID: CCSDK-1275 Signed-off-by: Ezhilarasi --- .../src/app/common/constants/app-constants.ts | 2 +- .../modify-template/editor/editor.component.ts | 27 +++++++++++----------- .../modify-template/editor/editor.service.ts | 23 ++++++++++-------- .../search-template/search-template.service.ts | 5 ++-- 4 files changed, 30 insertions(+), 27 deletions(-) (limited to 'cds-ui/client/src/app') diff --git a/cds-ui/client/src/app/common/constants/app-constants.ts b/cds-ui/client/src/app/common/constants/app-constants.ts index 49c6e6026..a01b7b27b 100644 --- a/cds-ui/client/src/app/common/constants/app-constants.ts +++ b/cds-ui/client/src/app/common/constants/app-constants.ts @@ -99,7 +99,7 @@ export const BlueprintURLs = { save: '/controllerblueprint/create-blueprint', publish: '/controllerblueprint/publish', enrich: '/controllerblueprint/enrich-blueprint', - download: '/controllerblueprint/download-blueprint/{name}/{version}', + download: '/controllerblueprint/download-blueprint/', deploy:'/controllerblueprint/deploy-blueprint' } 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, private apiservice: EditorService, + constructor(private store: Store, 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 { - return this.api.post(uri, body, { responseType: 'blob' }); + enrich(body: FormData): Observable { + 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 { + saveBlueprint(body: any | null, options?: any): Observable { + + return this.api.post(BlueprintURLs.save, body, options); + } + publishBlueprint(body: any | null, options?: any): Observable { - return this.api.post(uri, body, options); + return this.api.post(BlueprintURLs.publish, body, options); } - deployPost(uri: string, body: any | null, options?: any): Observable { + deployPost(body: any | null, options?: any): Observable { - 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{ - return this.api.post(uri, searchText); + searchByTags(searchText: String): Observable{ + return this.api.post(BlueprintURLs.searchByTag, searchText); } } -- cgit 1.2.3-korg 2 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
<?xml version="1.0" encoding="UTF-8" ?>
<!--
  ~ Copyright 2017 ZTE Corporation.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.onap.oparent</groupId>
        <artifactId>oparent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <groupId>org.onap.holmes.engine-management</groupId>
    <artifactId>holmes-engine-parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>holmes-engine-management</name>
    <modules>
        <module>engine-d</module>
        <module>engine-d-standalone</module>
    </modules>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.test.skip>false</maven.test.skip>
        <maven.test.failure.ignore>false</maven.test.failure.ignore>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <release.dir>${basedir}/target</release.dir>
        <bundle.name>${project.artifactId}-${project.version}</bundle.name>
        <pkgzip.dir>${basedir}/../release/pkgzip</pkgzip.dir>
        <excludesFile>**/*$*</excludesFile>
        <nexusproxy>https://nexus.open-o.org/content</nexusproxy>


        <stringtemplate.version>3.2.1</stringtemplate.version>
        <postgres.jdbc.driver.version>42.1.1</postgres.jdbc.driver.version>
        <dropwizard.version>0.8.0</dropwizard.version>
        <swagger.version>1.5.3</swagger.version>
        <lombok.version>1.16.4</lombok.version>
        <jersey.version>2.22.2</jersey.version>
        <jaxrs.consumer.version>5.0</jaxrs.consumer.version>
        <slf4j.version>1.6.1</slf4j.version>
        <reflections.version>0.9.9</reflections.version>
        <quartz.version>2.2.1</quartz.version>

        <packagename>onap-holmes-engine-d</packagename>
        <linux64id>linux64</linux64id>
        <win64id>win64</win64id>
        <linux64outputdir>target/assembly/${linux64id}</linux64outputdir>
        <win64outputdir>target/assembly/${win64id}</win64outputdir>
        <version.output>target/version</version.output>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${postgres.jdbc.driver.version}</version>
            </dependency>
            <dependency>
                <groupId>org.onap.msb.java-sdk</groupId>
                <artifactId>msb-java-sdk</artifactId>
                <version>1.0.0-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>org.reflections</groupId>
                <artifactId>reflections</artifactId>
                <version>${reflections.version}</version>
            </dependency>
            <dependency>
                <groupId>org.easymock</groupId>
                <artifactId>easymock</artifactId>
                <version>3.0</version>
            </dependency>
            <dependency>
                <groupId>org.onap.holmes.common</groupId>
                <artifactId>holmes-actions</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.onap.holmes.dsa</groupId>
                <artifactId>dmaap-dsa</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-core</artifactId>
                <version>${dropwizard.version}</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-db</artifactId>
                <version>${dropwizard.version}</version>
            </dependency>
            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-jersey2-jaxrs</artifactId>
                <version>${swagger.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>


            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>

            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>stringtemplate</artifactId>
                <version>${stringtemplate.version}</version>
            </dependency>

            <dependency>
                <groupId>org.quartz-scheduler</groupId>
                <artifactId>quartz</artifactId>
                <version>${quartz.version}</version>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.8.2</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-core</artifactId>
                <version>1.3</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-module-junit4</artifactId>
                <version>1.6.5</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.3.6</version>
            </dependency>

            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>19.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>