From 628bc897651e20393744d0dc3d227fef92ff4819 Mon Sep 17 00:00:00 2001 From: audrey Date: Sun, 25 Nov 2018 08:20:45 -0500 Subject: [PATCH] feat(#204): Open existing template instead of new one --- .../report-configuration.component.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/report-configuration/report-configuration.component.ts b/src/app/report-configuration/report-configuration.component.ts index 3d402cfc..7660b523 100644 --- a/src/app/report-configuration/report-configuration.component.ts +++ b/src/app/report-configuration/report-configuration.component.ts @@ -12,7 +12,7 @@ import {PlaceholderGroup} from './shared/models/placeholder-group'; selector: 'app-report-configuration', templateUrl: './report-configuration.component.html', styleUrls: ['./report-configuration.component.scss'], - providers: [ReportTemplateService] + providers: [/* ReportTemplateService */] }) export class ReportConfigurationComponent implements OnInit { selectedTemplate: ConfigurationTemplate; @@ -33,7 +33,8 @@ export class ReportConfigurationComponent implements OnInit { }); this.templateIdentifiers = []; this.fetchTemplateIdentifiers(); - this.selectedTemplate = new ConfigurationTemplate(); + //this.selectedTemplate = new ConfigurationTemplate(); + this.selectedTemplate = this.reportConfigurationService.currentReport; } fetchTemplateIdentifiers(): void { @@ -41,7 +42,7 @@ export class ReportConfigurationComponent implements OnInit { data.forEach((templateIdentifier) => { this.templateIdentifiers.push(templateIdentifier); }); - this.openDialog(); + //this.openDialog(); }); } @@ -61,7 +62,7 @@ export class ReportConfigurationComponent implements OnInit { }); } - openDialog() { + /* openDialog() { // Needs tp be run inside the NgZone because the function is sometimes called as an emit from CKEditor this.ngZone.run(() => { const dialogConfig = new MatDialogConfig(); @@ -72,15 +73,15 @@ export class ReportConfigurationComponent implements OnInit { dialogConfig.data = { id: 1, templateIdentifiers: this.templateIdentifiers - }; + }; - const dialogRef = this.dialog.open(SelectTemplateDialogComponent, dialogConfig); + const dialogRef = this.dialog.open(SelectTemplateComponent, dialogConfig); dialogRef.afterClosed().subscribe(result => { this.selectOrCreateTemplate(result); }); }); - } + } */ selectOrCreateTemplate(template: ConfigurationTemplate) { if (template == null) {