-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to print scenarios from UI (#76)
* added ngx-markdown as dependency * added printable endpoint * added printable component * printable component and ngx-markdown init * routing for printable page * printable button
- Loading branch information
Showing
10 changed files
with
172 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div [innerHTML]="scenario | markdown"></div> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PrintableComponent } from './printable.component'; | ||
|
||
describe('PrintableComponent', () => { | ||
let component: PrintableComponent; | ||
let fixture: ComponentFixture<PrintableComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ PrintableComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(PrintableComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { HttpErrorResponse } from '@angular/common/http'; | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute, ParamMap } from '@angular/router'; | ||
import { first, switchMap } from 'rxjs/operators'; | ||
import { ScenarioService } from '../data/scenario.service'; | ||
|
||
@Component({ | ||
selector: 'app-printable', | ||
templateUrl: './printable.component.html', | ||
styleUrls: ['./printable.component.scss'] | ||
}) | ||
export class PrintableComponent implements OnInit { | ||
|
||
public scenario: string = ""; | ||
|
||
constructor( | ||
public route: ActivatedRoute, | ||
public scenarioService: ScenarioService | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.route.paramMap | ||
.pipe( | ||
first(), | ||
switchMap((p: ParamMap) => { | ||
return this.scenarioService.printable(p.get("scenario")) | ||
}) | ||
).subscribe( | ||
(content: any) => { | ||
this.scenario = content; | ||
}, | ||
(error: HttpErrorResponse) => { | ||
this.scenario = "There was an error rendering printable scenario content: " + error.message | ||
} | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters