aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client
diff options
context:
space:
mode:
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-06-21 21:48:49 +0200
committerShaaban Ebrahim <shaaban.eltanany.ext@orange.com>2020-06-22 12:11:40 +0000
commita68a19fcb0b1c9f7d0a91338e08b1854c99cf1c7 (patch)
treed2706a4b80b7d750d19bece02e759b28f09354b3 /cds-ui/designer-client
parent3579d15b41d9f786650f76c3b6a98d28f0052f1a (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')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html6
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts18
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/creationModes/PackageCreationModes.ts5
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/metadata/MetaDataTab.model.ts15
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.html2
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts1
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts17
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts11
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.store.ts19
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) {