1 import { Component, OnInit, OnDestroy } from '@angular/core';
2 import { DesignerStore } from '../designer.store';
3 import { PackageCreationUtils } from '../../package-creation/package-creation.utils';
4 import { RouterLink, Router } from '@angular/router';
5 import { Subject } from 'rxjs';
8 selector: 'app-designer-source-view',
9 templateUrl: './source-view.component.html',
10 styleUrls: ['./source-view.component.css']
12 export class DesignerSourceViewComponent implements OnInit, OnDestroy {
16 private controllerSideBar: boolean;
17 private ngUnsubscribe = new Subject();
19 constructor(private store: DesignerStore,
20 private packageCreationUtils: PackageCreationUtils,
21 private router: Router) {
22 this.controllerSideBar = true;
26 this.store.state$.subscribe(
29 this.content = this.packageCreationUtils.transformToJson(state.template);
34 convertAndOpenInDesingerView() {
35 // TODO validate json against scheme
36 console.log('convertAndOpenInDesingerView ...', this.content);
37 this.store.saveSourceContent(this.content);
38 this.router.navigateByUrl('/packages/designer');
42 this.ngUnsubscribe.next();
43 this.ngUnsubscribe.complete();