Skip to content

Commit

Permalink
feat(#204): Open existing template instead of new one
Browse files Browse the repository at this point in the history
  • Loading branch information
AudreyLR committed Nov 22, 2018
1 parent d574a55 commit 628bc89
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/app/report-configuration/report-configuration.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,15 +33,16 @@ export class ReportConfigurationComponent implements OnInit {
});
this.templateIdentifiers = [];
this.fetchTemplateIdentifiers();
this.selectedTemplate = new ConfigurationTemplate();
//this.selectedTemplate = new ConfigurationTemplate();
this.selectedTemplate = this.reportConfigurationService.currentReport;
}

fetchTemplateIdentifiers(): void {
this.reportConfigurationService.getTemplateList().subscribe(data => {
data.forEach((templateIdentifier) => {
this.templateIdentifiers.push(templateIdentifier);
});
this.openDialog();
//this.openDialog();
});
}

Expand All @@ -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();
Expand All @@ -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) {
Expand Down

0 comments on commit 628bc89

Please sign in to comment.