diff options
author | KAPIL SINGAL <ks220y@att.com> | 2020-06-22 18:14:05 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-06-22 18:14:05 +0000 |
commit | 201684fa7d04804d5d833d0876c6eb79f44232e1 (patch) | |
tree | 2717a7bb6899553f602aa2e817b46d033e43c172 /cds-ui/designer-client/src/app | |
parent | 214c8dfe0e56aff0fe0c2a3a5d7f76f2a4972710 (diff) | |
parent | a68a19fcb0b1c9f7d0a91338e08b1854c99cf1c7 (diff) |
Merge "solving continuous saving"
Diffstat (limited to 'cds-ui/designer-client/src/app')
9 files changed, 50 insertions, 44 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html index ebfad93c3..bf6bf1251 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html @@ -22,8 +22,8 @@ <div class="container"> <div class="creat-action-container"> - <a class="action-button save" (click)="editBluePrint()"> - <i class="icon-save-sm" aria-hidden="true"></i> + <a class="action-button save" (click)="editBluePrint()" > + <i class="icon-save-sm" aria-hidden="true" ></i> <span>Save</span> </a> <a href="#" class="action-button" (click)="goBacktoDashboard()"> @@ -62,7 +62,7 @@ <div class="col-12 package-name deployed"> {{viewedPackage.artifactName}} <img src="/assets/img/icon-deploy-inactive.svg" class="deply-status-icon"> - <span class="package-version">v1.0.2</span> + <span class="package-version">v{{viewedPackage.artifactVersion}}</span> </div> <div class="col-12 package-description"> Last modified {{ viewedPackage.createdDate | date:'short' }} By diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts index 4a92943e3..e1e33a39a 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts @@ -14,6 +14,7 @@ import {PackageCreationBuilder} from '../package-creation/creationModes/PackageC import {saveAs} from 'file-saver'; import {DesignerStore} from '../designer/designer.store'; import {DesignerService} from '../designer/designer.service'; +import {ToastrService} from 'ngx-toastr'; @Component({ selector: 'app-configuration-dashboard', @@ -42,7 +43,9 @@ export class ConfigurationDashboardComponent implements OnInit { private packageCreationUtils: PackageCreationUtils, private router: Router, private designerStore: DesignerStore, - private designerService: DesignerService) { + private designerService: DesignerService, + private toastService: ToastrService + ) { } ngOnInit() { @@ -164,8 +167,17 @@ export class ConfigurationDashboardComponent implements OnInit { this.create(); this.zipFile.generateAsync({type: 'blob'}) .then(blob => { - this.packageCreationStore.saveBluePrint(blob); - this.router.navigate(['/packages']); + this.packageCreationStore.saveBluePrint(blob).subscribe( + bluePrintDetailModels => { + if (bluePrintDetailModels) { + const id = bluePrintDetailModels.toString().split('id')[1].split(':')[1].split('"')[1]; + this.toastService.info('package updated successfully '); + this.router.navigate(['/packages/package/' + id]); + } + }, error => { + this.toastService.error('error happened when editing ' + error.message); + console.log('Error -' + error.message); + }); }); } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts index 5b8db6b6d..6b80358fd 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts @@ -20,9 +20,10 @@ export abstract class PackageCreationModes { } public static mapModeType(cbaPackage: CBAPackage) { - if (cbaPackage.metaData.mode.startsWith('Scripting')) { + console.log(cbaPackage.metaData.mode); + if (cbaPackage.metaData.mode.includes('Scripting')) { cbaPackage.metaData.mode = ModeType.Scripting; - } else if (cbaPackage.metaData.mode.startsWith('Designer')) { + } else if (cbaPackage.metaData.mode.includes('Designer') || cbaPackage.metaData.mode.includes('DEFAULT') ) { cbaPackage.metaData.mode = ModeType.Designer; } else { cbaPackage.metaData.mode = ModeType.Generic; diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/metadata/MetaDataTab.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/metadata/MetaDataTab.model.ts index 7200e1210..4d19cf61a 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/metadata/MetaDataTab.model.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/metadata/MetaDataTab.model.ts @@ -38,21 +38,6 @@ export class MetaDataTabModel { } -/*TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: PLATANIA, MARCO <platania@research.att.com> -Entry-Definitions: Definitions/vLB_CDS.json -Template-Name: baseconfiguration -Template-Version: 1.0.0 -Template-Type: DEFAULT -Template-Tags: vDNS-CDS-test1 -Content-Type: application/vnd.oasis.bpmn*/ - -export class MetaDataFile { - - -} - export interface FolderNodes { name: string; diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html index d73f7da76..28f8938a7 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html @@ -80,7 +80,7 @@ <span>To add New Custom Key, fill the first key then <b>Press ENTER</b></span> </div> - <div *ngFor="let map of customKeysMap | keyvalue; let i=index" class="single-custom-key"> + <div *ngFor="let map of this.metaDataTab.mapOfCustomKey | keyvalue; let i=index" class="single-custom-key"> <div class="single-line-custom-key"> <label class="label-name"><span>{{i + 1}}.</span> Name</label> <div class="label-input"> diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts index 204d76fdb..dd9f45bf4 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts @@ -56,6 +56,7 @@ export class MetadataTabComponent implements OnInit { } this.customKeysMap = element.metaData.mapOfCustomKey; + this.metaDataTab.mapOfCustomKey = this.customKeysMap; // this.tags = element.metaData.templateTags; } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts index 42db2688e..57c849761 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts @@ -30,6 +30,7 @@ import {PackageCreationBuilder} from './creationModes/PackageCreationBuilder'; import {PackageCreationUtils} from './package-creation.utils'; import {MetadataTabComponent} from './metadata-tab/metadata-tab.component'; import {Router} from '@angular/router'; +import {ToastrService} from 'ngx-toastr'; @Component({ @@ -44,7 +45,8 @@ export class PackageCreationComponent implements OnInit { constructor(private packageCreationStore: PackageCreationStore, private packageCreationUtils: PackageCreationUtils, - private router: Router) { + private router: Router, + private toastService: ToastrService) { } counter = 0; @@ -89,8 +91,17 @@ export class PackageCreationComponent implements OnInit { this.create(); this.zipFile.generateAsync({type: 'blob'}) .then(blob => { - this.packageCreationStore.saveBluePrint(blob); - this.router.navigate(['/packages']); + this.packageCreationStore.saveBluePrint(blob).subscribe( + bluePrintDetailModels => { + if (bluePrintDetailModels) { + const id = bluePrintDetailModels.toString().split('id')[1].split(':')[1].split('"')[1]; + this.toastService.info('package updated successfully '); + this.router.navigate(['/packages/package/' + id]); + } + }, error => { + // this.toastService.error('error happened when editing ' + error.message); + console.log('Error -' + error.message); + }); }); } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts index 494c9e555..818577a59 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts @@ -26,7 +26,7 @@ import {ApiService} from '../../../../common/core/services/api.service'; import {BlueprintURLs, ResourceDictionaryURLs} from '../../../../common/constants/app-constants'; import {PackagesApiService} from '../packages-api.service'; import {PackagesStore} from '../packages.store'; -import { ResourceDictionary } from './mapping-models/ResourceDictionary.model'; +import {ResourceDictionary} from './mapping-models/ResourceDictionary.model'; @Injectable({ providedIn: 'root' @@ -54,13 +54,8 @@ export class PackageCreationService { const formData = new FormData(); formData.append('file', blob); - this.saveBlueprint(formData) - .subscribe( - data => { - console.log('Success:' + JSON.stringify(data)); - }, error => { - console.log('Error -' + error.message); - }); + return this.saveBlueprint(formData); + } getTemplateAndMapping(variables: string[]): Observable<ResourceDictionary[]> { diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts index 8302697fe..ce5dc4884 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts @@ -19,15 +19,16 @@ limitations under the License. ============LICENSE_END============================================ */ -import { Injectable } from '@angular/core'; +import {Injectable} from '@angular/core'; -import { Store } from '../../../../common/core/stores/Store'; +import {Store} from '../../../../common/core/stores/Store'; -import { CBAPackage, DslDefinition } from './mapping-models/CBAPacakge.model'; -import { PackageCreationService } from './package-creation.service'; -import { MetaDataTabModel } from './mapping-models/metadata/MetaDataTab.model'; -import { Observable } from 'rxjs'; -import { ResourceDictionary } from './mapping-models/ResourceDictionary.model'; +import {CBAPackage, DslDefinition} from './mapping-models/CBAPacakge.model'; +import {PackageCreationService} from './package-creation.service'; +import {MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model'; +import {Observable} from 'rxjs'; +import {ResourceDictionary} from './mapping-models/ResourceDictionary.model'; +import {BluePrintDetailModel} from '../model/BluePrint.detail.model'; @Injectable({ @@ -92,8 +93,8 @@ export class PackageCreationStore extends Store<CBAPackage> { this.state.definitions.imports.delete(filename); } - saveBluePrint(blob) { - this.packageCreationService.savePackage(blob); + saveBluePrint(blob): Observable<BluePrintDetailModel> { + return this.packageCreationService.savePackage(blob); } addTemplate(filePath: string, fileContent: string) { |