diff options
author | 2020-06-21 21:48:49 +0200 | |
---|---|---|
committer | 2020-06-22 12:11:40 +0000 | |
commit | a68a19fcb0b1c9f7d0a91338e08b1854c99cf1c7 (patch) | |
tree | d2706a4b80b7d750d19bece02e759b28f09354b3 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation | |
parent | 3579d15b41d9f786650f76c3b6a98d28f0052f1a (diff) |
solving continuous saving
Issue-ID: CCSDK-2336
Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I7e488950a77a19b7b1b4ac2e4c9044698b9ff757
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation')
7 files changed, 32 insertions, 38 deletions
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) { |