aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app
diff options
context:
space:
mode:
authorAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-10-28 10:43:38 +0200
committerAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-10-28 10:43:38 +0200
commit3cf2196942c6a5378bb8b2483d7bdd9c0e76ab10 (patch)
tree2080e50c5ac6b19705b1ed26b939af726149bcae /cds-ui/designer-client/src/app
parentefc4ccc5334af213456cb105bb0c55663736a190 (diff)
add loader component to some action
Issue-ID: CCSDK-2433 Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> Change-Id: Id3c89405ed01d013dda0a0aa37d77f61d64d698d
Diffstat (limited to 'cds-ui/designer-client/src/app')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html2
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts79
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html1
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.ts43
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts1
5 files changed, 73 insertions, 53 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 a281aafae..4ce93057a 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
@@ -82,7 +82,7 @@
<div class="container-fluid body-container">
-
+ <ngx-ui-loader></ngx-ui-loader>
<div class="container">
<div class="creat-action-container">
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 7ca429dff..9c8271d68 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,25 +1,26 @@
-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} from '../package-creation/mapping-models/metadata/MetaDataTab.model';
-import {MetadataTabComponent} from '../package-creation/metadata-tab/metadata-tab.component';
+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 } 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, CBADefinition} from '../package-creation/mapping-models/definitions/CBADefinition';
-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';
-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, throwError} from 'rxjs';
+import { ConfigurationDashboardService } from './configuration-dashboard.service';
+import { TemplateTopology, CBADefinition } from '../package-creation/mapping-models/definitions/CBADefinition';
+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';
+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, throwError } from 'rxjs';
+import { NgxUiLoaderService } from 'ngx-ui-loader';
@Component({
selector: 'app-configuration-dashboard',
@@ -28,13 +29,13 @@ import {Subject, throwError} from 'rxjs';
})
export class ConfigurationDashboardComponent extends ComponentCanDeactivate implements OnInit, OnDestroy {
viewedPackage: BluePrintDetailModel = new BluePrintDetailModel();
- @ViewChild(MetadataTabComponent, {static: false})
+ @ViewChild(MetadataTabComponent, { static: false })
metadataTabComponent: MetadataTabComponent;
public customActionName = '';
entryDefinitionKeys: string[] = ['template_tags', 'user-groups',
'author-email', 'template_version', 'template_name', 'template_author', 'template_description'];
- @ViewChild('nameit', {static: true})
+ @ViewChild('nameit', { static: true })
elementRef: ElementRef;
uploadedFiles = [];
zipFile: JSZip = new JSZip();
@@ -61,6 +62,7 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
private router: Router,
private designerStore: DesignerStore,
private toastService: ToastrService,
+ private ngxService: NgxUiLoaderService,
private packageCreationExtractionService: PackageCreationExtractionService
) {
super();
@@ -118,13 +120,14 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
private downloadCBAPackage(bluePrintDetailModels: BluePrintDetailModel) {
this.configurationDashboardService.downloadResource(
this.viewedPackage.artifactName + '/' + this.viewedPackage.artifactVersion).subscribe(response => {
- const blob = new Blob([response], {type: 'application/octet-stream'});
- this.currentBlob = blob;
- this.packageCreationExtractionService.extractBlobToStore(blob);
- });
+ const blob = new Blob([response], { type: 'application/octet-stream' });
+ this.currentBlob = blob;
+ this.packageCreationExtractionService.extractBlobToStore(blob);
+ });
}
editBluePrint() {
+ this.ngxService.start();
this.configurationDashboardService.deletePackage(this.viewedPackage.id).subscribe(res => {
this.formTreeData();
this.saveBluePrintToDataBase();
@@ -148,7 +151,7 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
saveBluePrintToDataBase() {
this.create();
- this.zipFile.generateAsync({type: 'blob'})
+ this.zipFile.generateAsync({ type: 'blob' })
.then(blob => {
this.packageCreationService.savePackage(blob).subscribe(
bluePrintDetailModels => {
@@ -162,6 +165,8 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
}, error => {
this.toastService.error('error happened when editing ' + error.message);
console.log('Error -' + error.message);
+ }, () => {
+ this.ngxService.stop();
});
});
}
@@ -191,20 +196,23 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
}
downloadPackage(artifactName: string, artifactVersion: string) {
+ this.ngxService.start();
this.configurationDashboardService.downloadResource(artifactName + '/' + artifactVersion).subscribe(response => {
- const blob = new Blob([response], {type: 'application/octet-stream'});
+ const blob = new Blob([response], { type: 'application/octet-stream' });
saveAs(blob, artifactName + '-' + artifactVersion + '-CBA.zip');
+ this.ngxService.stop();
});
}
deployCurrentPackage() {
+ this.ngxService.start();
this.formTreeData();
this.deployPackage();
}
goToDesignerMode(id) {
- this.router.navigate(['/packages/designer', id, {actionName: this.customActionName}]);
+ this.router.navigate(['/packages/designer', id, { actionName: this.customActionName }]);
}
public dropped(files: NgxFileDropEntry[]) {
@@ -226,6 +234,7 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
}
enrichBluePrint() {
+ this.ngxService.start();
this.packageCreationStore.addTopologyTemplate(this.cbaPackage.templateTopology);
this.formTreeData();
this.enrichPackage();
@@ -236,11 +245,11 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
private enrichPackage() {
this.create();
- this.zipFile.generateAsync({type: 'blob'})
+ this.zipFile.generateAsync({ type: 'blob' })
.then(blob => {
this.packageCreationService.enrichPackage(blob).subscribe(response => {
console.log('success');
- const blobInfo = new Blob([response], {type: 'application/octet-stream'});
+ const blobInfo = new Blob([response], { type: 'application/octet-stream' });
this.currentBlob = blobInfo;
this.packageCreationStore.clear();
this.packageCreationExtractionService.extractBlobToStore(this.currentBlob);
@@ -250,12 +259,14 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
}, error => {
this.toastService.error('error happened when enrich ' + error.message);
console.error('Error -' + error.message);
+ }, () => {
+ this.ngxService.stop();
});
}
private deployPackage() {
this.create();
- this.zipFile.generateAsync({type: 'blob'})
+ this.zipFile.generateAsync({ type: 'blob' })
.then(blob => {
this.packageCreationService.deploy(blob).subscribe(response => {
this.toastService.info('deployed successfully ');
@@ -265,6 +276,8 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl
});
}, error => {
this.handleError(error);
+ }, () => {
+ this.ngxService.stop();
});
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html
index e42304ad6..fb21d3bd7 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html
@@ -76,6 +76,7 @@
</header>
<div class="container-fluid body-container">
+ <ngx-ui-loader></ngx-ui-loader>
<div class="container">
<div class="creat-action-container">
<!-- <a class="action-button save" [hidden]="!isSaveEnabled" (click)="saveBluePrint()">
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 c7285774e..96d798c86 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
@@ -19,22 +19,23 @@ limitations under the License.
============LICENSE_END============================================
*/
-import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core';
-import {FilesContent, FolderNodeElement, MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model';
+import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
+import { FilesContent, FolderNodeElement, MetaDataTabModel } from './mapping-models/metadata/MetaDataTab.model';
import * as JSZip from 'jszip';
-import {PackageCreationStore} from './package-creation.store';
-import {CBAPackage, Definition} from './mapping-models/CBAPacakge.model';
-import {PackageCreationModes} from './creationModes/PackageCreationModes';
-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';
-import {TourService} from 'ngx-tour-md-menu';
-import {PackageCreationService} from './package-creation.service';
-import {ComponentCanDeactivate} from '../../../../common/core/canDactivate/ComponentCanDeactivate';
-import {DesignerStore} from '../designer/designer.store';
+import { PackageCreationStore } from './package-creation.store';
+import { CBAPackage, Definition } from './mapping-models/CBAPacakge.model';
+import { PackageCreationModes } from './creationModes/PackageCreationModes';
+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';
+import { TourService } from 'ngx-tour-md-menu';
+import { PackageCreationService } from './package-creation.service';
+import { ComponentCanDeactivate } from '../../../../common/core/canDactivate/ComponentCanDeactivate';
+import { DesignerStore } from '../designer/designer.store';
+import { NgxUiLoaderService } from 'ngx-ui-loader';
@Component({
@@ -55,6 +56,7 @@ export class PackageCreationComponent extends ComponentCanDeactivate implements
private router: Router,
private tourService: TourService,
private toastService: ToastrService,
+ private ngxService: NgxUiLoaderService,
private designerStore: DesignerStore) {
super();
@@ -62,8 +64,8 @@ export class PackageCreationComponent extends ComponentCanDeactivate implements
counter = 0;
modes: object[] = [
- {name: 'Designer Mode', style: 'mode-icon icon-designer-mode'},
- {name: 'Scripting Mode', style: 'mode-icon icon-scripting-mode'}];
+ { name: 'Designer Mode', style: 'mode-icon icon-designer-mode' },
+ { name: 'Scripting Mode', style: 'mode-icon icon-scripting-mode' }];
metaDataTab: MetaDataTabModel = new MetaDataTabModel();
folder: FolderNodeElement = new FolderNodeElement();
zipFile: JSZip = new JSZip();
@@ -71,10 +73,10 @@ export class PackageCreationComponent extends ComponentCanDeactivate implements
definition: Definition = new Definition();
isSaveEnabled = false;
- @ViewChild(MetadataTabComponent, {static: false})
+ @ViewChild(MetadataTabComponent, { static: false })
metadataTabComponent: MetadataTabComponent;
- @ViewChild('nameit', {static: true})
+ @ViewChild('nameit', { static: true })
elementRef: ElementRef;
versionPattern = '^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$';
metadataClasses = 'nav-item nav-link active complete';
@@ -108,6 +110,7 @@ export class PackageCreationComponent extends ComponentCanDeactivate implements
}
saveBluePrint() {
+ this.ngxService.start();
console.log(this.cbaPackage);
FilesContent.clear();
let packageCreationModes: PackageCreationModes;
@@ -126,7 +129,7 @@ export class PackageCreationComponent extends ComponentCanDeactivate implements
saveBluePrintToDataBase() {
this.create();
- this.zipFile.generateAsync({type: 'blob'})
+ this.zipFile.generateAsync({ type: 'blob' })
.then(blob => {
this.packageCreationService.savePackage(blob).subscribe(
bluePrintDetailModels => {
@@ -139,6 +142,8 @@ export class PackageCreationComponent extends ComponentCanDeactivate implements
}, error => {
// this.toastService.error('error happened when editing ' + error.message);
console.log('Error -' + error.message);
+ }, () => {
+ this.ngxService.stop();
});
});
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts
index 30677f161..7e6bbbe59 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts
@@ -39,6 +39,7 @@ export class PackageListComponent implements OnInit {
ngOnInit() {
+ this.ngxLoader.start();
this.packagesStore.getAll();
}