summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html151
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts261
2 files changed, 187 insertions, 225 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 0ffd9cb5e..a281aafae 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
@@ -13,60 +13,70 @@
</h2>
<div class="col profile-help">
<nav class="navbar navbar-expand-lg navbar-light">
- <ul class="navbar-nav ml-auto">
- <!-- <li class="nav-item help-btn">
- <a class="nav-link mr-2" href="https://wiki.onap.org/display/DW/CDS+Designer+Guide" target="_blank"
- [delay]="300" tooltip="Help" placement="bottom"><i class="icon-info" aria-hidden="true"></i></a>
- </li> -->
- <!--Help Menu-->
- <div class="nav-item dropdown helpMenu">
- <input class="dropdown-toggle" type="text">
- <div class="dropdown-text"><i class="icon-info" aria-hidden="true"></i></div>
- <ul class="dropdown-content">
- <!-- <li>
- <i class="icon-get_started" aria-hidden="true"></i>
- <p>
- <input id="clicker3" [checked]="startTour" type="checkbox" />
- <label for="clicker">
- Getting Started
- <span>Quick steps to help you get started</span>
- </label>
- </p>
+ <ul class="navbar-nav ml-auto">
+ <!-- <li class="nav-item help-btn">
+ <a class="nav-link mr-2" href="https://wiki.onap.org/display/DW/CDS+Designer+Guide" target="_blank"
+ [delay]="300" tooltip="Help" placement="bottom"><i class="icon-info" aria-hidden="true"></i></a>
</li> -->
- <li>
- <a href="https://wiki.onap.org/display/DW/CDS+Designer+Guide" target="_blank">
- <i class="icon-user_guide" aria-hidden="true"></i>
- <p>
- Tutorials
- <span>CDS Designer's User Guide</span>
- </p>
- </a>
- </li>
- </ul>
- </div>
- <!--User Menu-->
- <div class="nav-item dropdown userMenu">
- <input class="dropdown-toggle" type="text">
- <div class="dropdown-text"><img src="../assets/img/img-user.jpeg" align="right"></div>
- <ul class="dropdown-content">
- <li>
- <a href="#">Username</a>
- </li>
- <li>
- <a href="#">Settings</a>
- </li>
- <li>
- <a href="#">Projects</a>
- </li>
- <li>
- <a href="#">Log out</a>
- </li>
- </ul>
- </div>
+ <!--Help Menu-->
+ <div class="nav-item dropdown helpMenu">
+ <input class="dropdown-toggle" type="text">
+ <div class="dropdown-text"><i class="icon-info" aria-hidden="true"></i></div>
+ <ul class="dropdown-content">
+ <li>
+ <i class="icon-get_started" aria-hidden="true"></i>
+ <p>
+ <input id="clicker3" type="checkbox"/>
+ <label for="clicker">
+ Getting Started
+ <span>Quick steps to help you get started</span>
+ </label>
+ </p>
+ </li>
+ <!-- <li>
+ <i class="icon-get_started" aria-hidden="true"></i>
+ <p>
+ <input id="clicker3" [checked]="startTour" type="checkbox" />
+ <label for="clicker">
+ Getting Started
+ <span>Quick steps to help you get started</span>
+ </label>
+ </p>
+ </li> -->
+ <li>
+ <a href="https://wiki.onap.org/display/DW/CDS+Designer+Guide" target="_blank">
+ <i class="icon-user_guide" aria-hidden="true"></i>
+ <p>
+ Tutorials
+ <span>CDS Designer's User Guide</span>
+ </p>
+ </a>
+ </li>
+ </ul>
+ </div>
+ <!--User Menu-->
+ <div class="nav-item dropdown userMenu">
+ <input class="dropdown-toggle" type="text">
+ <div class="dropdown-text"><img src="../assets/img/img-user.jpeg" align="right"></div>
+ <ul class="dropdown-content">
+ <li>
+ <a href="#">Username</a>
+ </li>
+ <li>
+ <a href="#">Settings</a>
+ </li>
+ <li>
+ <a href="#">Projects</a>
+ </li>
+ <li>
+ <a href="#">Log out</a>
+ </li>
+ </ul>
+ </div>
- </ul>
+ </ul>
</nav>
- </div>
+ </div>
</div>
</header>
@@ -103,7 +113,7 @@
<span>Download</span>
</a>
- <a data-target="#removePackageModal" data-toggle="modal" class="action-button">
+ <a data-target="#removePackageModal" data-toggle="modal" class="action-button delete">
<i class="icon-delete-sm" aria-hidden="true"></i>
<span>Delete</span>
</a>
@@ -127,7 +137,8 @@
<div class="row package-auth-info">
<div class="col-3">
<p><b>Author Name</b></p>
- <span> {{viewedPackage.updatedBy ? viewedPackage.updatedBy.split('<')[0] : ""}}</span>
+ <span>
+ {{viewedPackage.updatedBy ? viewedPackage.updatedBy.split('<')[0] : ""}}</span>
</div>
<!--<div class="col-4">
<p><b>Author Email</b></p>
@@ -167,8 +178,8 @@
</button> -->
<!-- Button trigger modal - 1st Action -->
- <button type="button" class="btn btn-sm btn-primary mb-2" data-toggle="modal"
- data-target="#exampleModalLong">
+ <button (click)="checkSkipTypesOfAction()" type="button" class="btn btn-sm btn-primary mb-2"
+ data-toggle="modal" [attr.data-target]="dataTarget">
<i class="icon-topologyView-active"></i> Designer Mode
</button>
<!-- Designer Modal -->
@@ -270,7 +281,7 @@
</div>
<div class="row">
<div class="col text-center">
- <button class="btn skip-btn"
+ <button class="btn skip-btn" data-dismiss="modal"
(click)="goToDesignerMode(viewedPackage.id)">
Skip
to Designer Canvas
@@ -288,7 +299,7 @@
<input type="text" [(ngModel)]="customActionName"
class="form-control customAction"
placeholder="Type Action Name" autofocus>
- <button type="button"
+ <button type="button" data-dismiss="modal"
(click)="goToDesignerMode(viewedPackage.id)"
class="btn submit">Start
</button>
@@ -460,7 +471,7 @@
<div class="row">
<div class="col text-center">
<p class="selectedActions">0 selected</p>
- <button type="button"
+ <button type="button" data-dismiss="modal"
(click)="goToDesignerMode(viewedPackage.id)"
class="btn submit">Start
</button>
@@ -641,8 +652,7 @@
<div class="row">
<div class="col text-center">
<p class="selectedActions">0 selected</p>
- <button type="button"
- class="btn submit">Start
+ <button type="button" class="btn submit">Start
</button>
</div>
</div>
@@ -706,8 +716,7 @@
</div>
<div class="row">
<div class="col text-center">
- <button type="button"
- class="btn submit mt-4">Import
+ <button type="button" class="btn submit mt-4">Import
</button>
</div>
</div>
@@ -757,7 +766,7 @@
<div class="col">
<div class="tab-content" id="nav-tabContent" (change)="clickEvent()">
<div class="tab-pane fade show active" id="nav-metadata" role="tabpanel"
- aria-labelledby="nav-metadata-tab" >
+ aria-labelledby="nav-metadata-tab">
<app-metadata-tab></app-metadata-tab>
</div>
<div class="tab-pane fade" id="nav-template" role="tabpanel"
@@ -806,11 +815,10 @@
<li>1. Copy and paste "workflows" and "node_templates"</li>
<li>2. Press <b>Enrich</b> button</li>
</ul>
- <ace-editor [(text)]="vlbDefinition.topology_template.content" [mode]="'javascript'"
- [autoUpdateContent]="true"
- [durationBeforeCallback]="1000" (textChanged)="textChanged($event)" [theme]="'eclipse'"
- #editor
- style="height:300px;">
+ <ace-editor [(text)]="this.vlbDefinition.topology_template.content" [mode]="'json'"
+ [autoUpdateContent]="true" [durationBeforeCallback]="1000" [theme]="'eclipse'"
+ (textChanged)="textChanged($event)"
+ #editor style="height:300px;">
</ace-editor>
</div>
<div class="modal-footer">
@@ -838,8 +846,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
- <button type="button" (click)="deletePackage()" data-dismiss="modal"
- class="btn btn-primary">Delete
+ <button type="button" (click)="deletePackage()" data-dismiss="modal" class="btn btn-primary">Delete
</button>
</div>
</div>
@@ -861,8 +868,8 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
- <button type="button" (click)="discardChanges()" data-dismiss="modal"
- class="btn btn-primary">Discard Changes
+ <button type="button" (click)="discardChanges()" data-dismiss="modal" class="btn btn-primary">Discard
+ Changes
</button>
</div>
</div>
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 029601d67..dc5697f78 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
@@ -1,13 +1,13 @@
-import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
+import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {BluePrintDetailModel} from '../model/BluePrint.detail.model';
import {PackageCreationStore} from '../package-creation/package-creation.store';
-import {FilesContent, FolderNodeElement, MetaDataTabModel} from '../package-creation/mapping-models/metadata/MetaDataTab.model';
+import {FilesContent, FolderNodeElement} from '../package-creation/mapping-models/metadata/MetaDataTab.model';
import {MetadataTabComponent} from '../package-creation/metadata-tab/metadata-tab.component';
import * as JSZip from 'jszip';
import {ConfigurationDashboardService} from './configuration-dashboard.service';
import {TemplateTopology, VlbDefinition} from '../package-creation/mapping-models/definitions/VlbDefinition';
-import {DslDefinition} from '../package-creation/mapping-models/CBAPacakge.model';
+import {CBAPackage} from '../package-creation/mapping-models/CBAPacakge.model';
import {PackageCreationUtils} from '../package-creation/package-creation.utils';
import {PackageCreationModes} from '../package-creation/creationModes/PackageCreationModes';
import {PackageCreationBuilder} from '../package-creation/creationModes/PackageCreationBuilder';
@@ -15,13 +15,18 @@ import {saveAs} from 'file-saver';
import {DesignerStore} from '../designer/designer.store';
import {ToastrService} from 'ngx-toastr';
import {NgxFileDropEntry} from 'ngx-file-drop';
+import {PackageCreationService} from '../package-creation/package-creation.service';
+import {ComponentCanDeactivate} from '../../../../common/core/canDactivate/ComponentCanDeactivate';
+import {PackageCreationExtractionService} from '../package-creation/package-creation-extraction.service';
+import {distinctUntilChanged, takeUntil} from 'rxjs/operators';
+import {Subject} from 'rxjs';
@Component({
selector: 'app-configuration-dashboard',
templateUrl: './configuration-dashboard.component.html',
styleUrls: ['./configuration-dashboard.component.css'],
})
-export class ConfigurationDashboardComponent implements OnInit {
+export class ConfigurationDashboardComponent extends ComponentCanDeactivate implements OnInit, OnDestroy {
viewedPackage: BluePrintDetailModel = new BluePrintDetailModel();
@ViewChild(MetadataTabComponent, {static: false})
metadataTabComponent: MetadataTabComponent;
@@ -42,43 +47,65 @@ export class ConfigurationDashboardComponent implements OnInit {
isSaveEnabled = false;
versionPattern = '^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$';
metadataClasses = 'nav-item nav-link active';
+ private cbaPackage: CBAPackage = new CBAPackage();
+ dataTarget: any = '';
+ ngUnsubscribe = new Subject();
+ private designerState: any;
constructor(
private route: ActivatedRoute,
private configurationDashboardService: ConfigurationDashboardService,
private packageCreationStore: PackageCreationStore,
+ private packageCreationService: PackageCreationService,
private packageCreationUtils: PackageCreationUtils,
private router: Router,
private designerStore: DesignerStore,
- private toastService: ToastrService
+ private toastService: ToastrService,
+ private packageCreationExtractionService: PackageCreationExtractionService
) {
+ super();
+
+
}
ngOnInit() {
this.vlbDefinition.topology_template = new TemplateTopology();
-
+ this.packageCreationStore.state$
+ .pipe(distinctUntilChanged((a: any, b: any) => JSON.stringify(a) === JSON.stringify(b)),
+ takeUntil(this.ngUnsubscribe))
+ .subscribe(
+ cbaPackage => {
+ this.cbaPackage = cbaPackage;
+ });
+ this.designerStore.state$.pipe(
+ distinctUntilChanged((a: any, b: any) => JSON.stringify(a) === JSON.stringify(b)),
+ takeUntil(this.ngUnsubscribe))
+ .subscribe(state => {
+ this.designerState = state;
+ this.vlbDefinition.topology_template.content = this.packageCreationUtils.transformToJson(state.template);
+ });
this.elementRef.nativeElement.focus();
this.refreshCurrentPackage();
const regexp = RegExp(this.versionPattern);
- this.packageCreationStore.state$.subscribe(
- cbaPackage => {
- if (cbaPackage && cbaPackage.metaData && cbaPackage.metaData.description
- && cbaPackage.metaData.name && cbaPackage.metaData.version &&
- regexp.test(cbaPackage.metaData.version)) {
- if (!this.metadataClasses.includes('complete')) {
- this.metadataClasses += ' complete';
- }
- } else {
- this.metadataClasses = this.metadataClasses.replace('complete', '');
- this.isSaveEnabled = false;
- }
+ if (this.cbaPackage && this.cbaPackage.metaData && this.cbaPackage.metaData.description
+ && this.cbaPackage.metaData.name && this.cbaPackage.metaData.version &&
+ regexp.test(this.cbaPackage.metaData.version)) {
+ if (!this.metadataClasses.includes('complete')) {
+ this.metadataClasses += ' complete';
+ }
+ } else {
+ this.metadataClasses = this.metadataClasses.replace('complete', '');
+ this.isSaveEnabled = false;
+ }
+
- });
}
- private refreshCurrentPackage() {
+ private refreshCurrentPackage(id?) {
this.id = this.route.snapshot.paramMap.get('id');
- this.configurationDashboardService.getPagedPackages(this.id).subscribe(
+ console.log(this.id);
+ id = id ? id : this.id;
+ this.configurationDashboardService.getPagedPackages(id).subscribe(
(bluePrintDetailModels) => {
if (bluePrintDetailModels) {
this.viewedPackage = bluePrintDetailModels[0];
@@ -90,122 +117,47 @@ export class ConfigurationDashboardComponent implements OnInit {
private downloadCBAPackage(bluePrintDetailModels: BluePrintDetailModel) {
this.configurationDashboardService.downloadResource(
- bluePrintDetailModels[0].artifactName + '/' + bluePrintDetailModels[0].artifactVersion).subscribe(response => {
+ this.viewedPackage.artifactName + '/' + this.viewedPackage.artifactVersion).subscribe(response => {
const blob = new Blob([response], {type: 'application/octet-stream'});
this.currentBlob = blob;
- this.extractBlobToStore(blob, bluePrintDetailModels);
- });
- }
-
- private extractBlobToStore(blob: Blob, bluePrintDetailModels: BluePrintDetailModel) {
- this.zipFile.loadAsync(blob).then((zip) => {
- Object.keys(zip.files).forEach((filename) => {
- zip.files[filename].async('string').then((fileData) => {
- console.log(filename);
- if (fileData) {
- if (filename.includes('Scripts/')) {
- this.setScripts(filename, fileData);
- } else if (filename.includes('Templates/')) {
- if (filename.includes('-mapping.')) {
- this.setMapping(filename, fileData);
- } else if (filename.includes('-template.')) {
- this.setTemplates(filename, fileData);
- }
-
- } else if (filename.includes('Definitions/')) {
- this.setImports(filename, fileData, bluePrintDetailModels);
- } else if (filename.includes('TOSCA-Metadata/')) {
- const metaDataTabInfo: MetaDataTabModel = this.getMetaDataTabInfo(fileData);
- this.setMetaData(metaDataTabInfo, bluePrintDetailModels[0]);
- }
- }
- });
- });
+ this.packageCreationExtractionService.extractBlobToStore(blob);
});
}
- setScripts(filename: string, fileData: any) {
- this.packageCreationStore.addScripts(filename, fileData);
- }
-
- setImports(filename: string, fileData: any, bluePrintDetailModels: BluePrintDetailModel) {
- if (filename.includes(bluePrintDetailModels[0].artifactName)) {
- let definition = new VlbDefinition();
- definition = fileData as VlbDefinition;
- definition = JSON.parse(fileData);
- const dslDefinition = new DslDefinition();
- dslDefinition.content = this.packageCreationUtils.transformToJson(definition.dsl_definitions);
- const mapOfCustomKeys = new Map<string, string>();
- for (const metadataKey in definition.metadata) {
- if (!this.entryDefinitionKeys.includes(metadataKey + '')) {
- mapOfCustomKeys.set(metadataKey + '', definition.metadata[metadataKey + '']);
- }
- }
- this.packageCreationStore.changeDslDefinition(dslDefinition);
- this.packageCreationStore.setCustomKeys(mapOfCustomKeys);
- if (definition.topology_template && definition.topology_template.content) {
- this.designerStore.saveSourceContent(definition.topology_template.content);
- }
-
- }
- this.packageCreationStore.addDefinition(filename, fileData);
-
- }
-
- setTemplates(filename: string, fileData: any) {
- this.packageCreationStore.addTemplate(filename, fileData);
- }
-
- setMapping(fileName: string, fileData: string) {
- this.packageCreationStore.addMapping(fileName, fileData);
- }
-
editBluePrint() {
- this.packageCreationStore.state$.subscribe(
- cbaPackage => {
- FilesContent.clear();
- let packageCreationModes: PackageCreationModes;
- cbaPackage = PackageCreationModes.mapModeType(cbaPackage);
- cbaPackage.metaData = PackageCreationModes.setEntryPoint(cbaPackage.metaData);
- packageCreationModes = PackageCreationBuilder.getCreationMode(cbaPackage);
- packageCreationModes.execute(cbaPackage, this.packageCreationUtils);
- this.filesData.push(this.folder.TREE_DATA);
- this.saveBluePrintToDataBase();
- });
- }
+ this.configurationDashboardService.deletePackage(this.viewedPackage.id).subscribe(res => {
+ this.formTreeData();
+ this.saveBluePrintToDataBase();
- setMetaData(metaDataObject: MetaDataTabModel, bluePrintDetailModel: BluePrintDetailModel) {
- metaDataObject.description = bluePrintDetailModel.artifactDescription;
- this.packageCreationStore.changeMetaData(metaDataObject);
+ });
+ }
+ private formTreeData() {
+ FilesContent.clear();
+ let packageCreationModes: PackageCreationModes;
+ this.cbaPackage = PackageCreationModes.mapModeType(this.cbaPackage);
+ this.cbaPackage.metaData = PackageCreationModes.setEntryPoint(this.cbaPackage.metaData);
+ packageCreationModes = PackageCreationBuilder.getCreationMode(this.cbaPackage);
+ packageCreationModes.execute(this.cbaPackage, this.packageCreationUtils);
+ this.filesData.push(this.folder.TREE_DATA);
}
saveMetaData() {
this.metadataTabComponent.saveMetaDataToStore();
-
- }
-
- getMetaDataTabInfo(fileData: string) {
- const metaDataTabModel = new MetaDataTabModel();
- const arrayOfLines = fileData.split('\n');
- metaDataTabModel.entryFileName = arrayOfLines[3].split(':')[1];
- metaDataTabModel.name = arrayOfLines[4].split(':')[1];
- metaDataTabModel.version = arrayOfLines[5].split(':')[1];
- metaDataTabModel.mode = arrayOfLines[6].split(':')[1];
- metaDataTabModel.templateTags = new Set<string>(arrayOfLines[7].split(':')[1].split(','));
- return metaDataTabModel;
}
saveBluePrintToDataBase() {
this.create();
this.zipFile.generateAsync({type: 'blob'})
.then(blob => {
- this.packageCreationStore.saveBluePrint(blob).subscribe(
+ this.packageCreationService.savePackage(blob).subscribe(
bluePrintDetailModels => {
if (bluePrintDetailModels) {
const id = bluePrintDetailModels.toString().split('id')[1].split(':')[1].split('"')[1];
this.toastService.info('package updated successfully ');
+ this.isSaveEnabled = false;
this.router.navigate(['/packages/package/' + id]);
+ this.refreshCurrentPackage(id);
}
}, error => {
this.toastService.error('error happened when editing ' + error.message);
@@ -218,6 +170,7 @@ export class ConfigurationDashboardComponent implements OnInit {
this.configurationDashboardService.deletePackage(this.id).subscribe(res => {
console.log('Deleted');
console.log(res);
+ this.isSaveEnabled = false;
this.router.navigate(['/packages']);
}, err => {
console.log(err);
@@ -245,13 +198,12 @@ export class ConfigurationDashboardComponent implements OnInit {
}
deployCurrentPackage() {
- this.collectZipFileFromStore();
+ this.formTreeData();
this.deployPackage();
}
goToDesignerMode(id) {
- // this.designerService.setActionName(this.customActionName);
this.router.navigate(['/packages/designer', id, {actionName: this.customActionName}]);
}
@@ -268,52 +220,36 @@ export class ConfigurationDashboardComponent implements OnInit {
}
textChanged($event: {}) {
- this.packageCreationStore.addTopologyTemplate(this.vlbDefinition.topology_template);
+ this.cbaPackage.templateTopology.node_templates = this.designerState.template.node_templates;
+ this.cbaPackage.templateTopology.workflows = this.designerState.template.workflows;
+ this.cbaPackage.templateTopology.content = this.vlbDefinition.topology_template.content;
}
enrichBluePrint() {
-
- this.collectZipFileFromStore();
+ this.packageCreationStore.addTopologyTemplate(this.cbaPackage.templateTopology);
+ this.formTreeData();
this.enrichPackage();
+ this.designerStore.clear();
+ this.packageCreationStore.clear();
}
- private collectZipFileFromStore() {
- this.packageCreationStore.state$.subscribe(
- cbaPackage => {
- FilesContent.clear();
- console.log(cbaPackage);
- let packageCreationModes: PackageCreationModes;
- cbaPackage = PackageCreationModes.mapModeType(cbaPackage);
- cbaPackage.metaData = PackageCreationModes.setEntryPoint(cbaPackage.metaData);
- packageCreationModes = PackageCreationBuilder.getCreationMode(cbaPackage);
- packageCreationModes.execute(cbaPackage, this.packageCreationUtils);
- this.filesData.push(this.folder.TREE_DATA);
- });
- }
private enrichPackage() {
this.create();
this.zipFile.generateAsync({type: 'blob'})
.then(blob => {
- this.packageCreationStore.enrichBluePrint(blob).subscribe(response => {
+ this.packageCreationService.enrichPackage(blob).subscribe(response => {
console.log('success');
const blobInfo = new Blob([response], {type: 'application/octet-stream'});
- this.configurationDashboardService.getPagedPackages(this.id).subscribe(
- (bluePrintDetailModels) => {
- if (bluePrintDetailModels) {
- this.packageCreationStore.clear();
- this.extractBlobToStore(blob, bluePrintDetailModels);
- this.isSaveEnabled = true;
- this.toastService.info('enriched successfully ');
- }
- });
-
- // saveAs(blobInfo, 'test' + '-' + '1.0.0' + '-CBA.zip');
-
+ this.currentBlob = blobInfo;
+ this.packageCreationStore.clear();
+ this.packageCreationExtractionService.extractBlobToStore(this.currentBlob);
+ this.isSaveEnabled = true;
+ this.toastService.info('enriched successfully ');
});
}, error => {
- this.toastService.error('error happened when editing ' + error.message);
- console.log('Error -' + error.message);
+ this.toastService.error('error happened when enrich ' + error.message);
+ console.error('Error -' + error.message);
});
}
@@ -321,12 +257,11 @@ export class ConfigurationDashboardComponent implements OnInit {
this.create();
this.zipFile.generateAsync({type: 'blob'})
.then(blob => {
- this.packageCreationStore.deployBluePrint(blob).subscribe(response => {
- console.log('success');
- console.log(response);
-
- // saveAs(blobInfo, 'test' + '-' + '1.0.0' + '-CBA.zip');
-
+ this.packageCreationService.deploy(blob).subscribe(response => {
+ this.toastService.info('deployed successfully ');
+ const id = response.toString().split('id')[1].split(':')[1].split('"')[1];
+ this.isSaveEnabled = false;
+ this.router.navigate(['/packages/package/' + id]);
});
}, error => {
this.toastService.error('error happened when deploying ' + error.message);
@@ -337,4 +272,24 @@ export class ConfigurationDashboardComponent implements OnInit {
clickEvent() {
this.isSaveEnabled = true;
}
+
+ canDeactivate(): boolean {
+ return this.isSaveEnabled;
+ }
+
+ ngOnDestroy() {
+ this.ngUnsubscribe.next();
+ this.ngUnsubscribe.complete();
+ }
+
+ checkSkipTypesOfAction() {
+ console.log(this.cbaPackage);
+ if (this.cbaPackage.templateTopology && this.cbaPackage.templateTopology.node_templates
+ && this.cbaPackage.templateTopology.workflows) {
+ this.goToDesignerMode(this.id);
+ } else {
+ this.dataTarget = '#exampleModalLong';
+ }
+ }
}
+