diff options
author | 2020-12-13 20:16:17 +0200 | |
---|---|---|
committer | 2020-12-14 18:31:23 +0000 | |
commit | 768092342aa51614188d72bc63723973ba7a2f67 (patch) | |
tree | 86eecd334d2f82372f3850835c2b7233188dbe1c /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/topology-template/topology-template.component.ts | |
parent | b4bbb70118f3406ffc7bdd7df557a9b0d9d63f21 (diff) |
showing topology template in configuration dashboard
Issue-ID: CCSDK-3041
Signed-off-by: Eltanany Shaaban <shaaban.eltanany.ext@orange.com>
Change-Id: Iea8fc8f2712185ca3caf41b191e295319556b83c
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/topology-template/topology-template.component.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/topology-template/topology-template.component.ts | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/topology-template/topology-template.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/topology-template/topology-template.component.ts new file mode 100644 index 000000000..8fce6954d --- /dev/null +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/topology-template/topology-template.component.ts @@ -0,0 +1,56 @@ +import {Component, OnDestroy, OnInit} from '@angular/core'; +import {distinctUntilChanged, takeUntil} from 'rxjs/operators'; +import {DesignerStore} from '../../designer/designer.store'; +import {Subject} from 'rxjs'; +import {PackageCreationUtils} from '../package-creation.utils'; +import {PackageCreationStore} from '../package-creation.store'; + +@Component({ + selector: 'app-topology-template', + templateUrl: './topology-template.component.html', + styleUrls: ['./topology-template.component.css'] +}) +export class TopologyTemplateComponent implements OnInit, OnDestroy { + + ngUnsubscribe = new Subject(); + content = ' '; + private cbaPackage: any; + private designerState: any; + + constructor(private designerStore: DesignerStore, + private packageCreationUtils: PackageCreationUtils, + private packageCreationStore: PackageCreationStore) { + + 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.content = + this.packageCreationUtils.transformToJson(state.template); + console.log(this.content); + console.log(state.template); + }); + } + + ngOnInit() { + } + + textChanged($event: {}) { + this.cbaPackage.templateTopology.content = this.content; + this.designerState.template = JSON.parse(this.content); + + } + + ngOnDestroy() { + this.ngUnsubscribe.next(); + this.ngUnsubscribe.complete(); + } +} |