-
Notifications
You must be signed in to change notification settings - Fork 23
/
report-viewer.ts
47 lines (43 loc) · 1.62 KB
/
report-viewer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { fetchSetup } from '@devexpress/analytics-core/analytics-utils';
import * as ko from 'knockout';
import { AuthorizeService } from '../../api-authorization/authorize.service';
@Component({
selector: 'report-viewer',
encapsulation: ViewEncapsulation.None,
templateUrl: './report-viewer.html',
styleUrls: [
"../../../node_modules/devextreme/dist/css/dx.material.blue.light.css",
"../../../node_modules/@devexpress/analytics-core/dist/css/dx-analytics.common.css",
"../../../node_modules/@devexpress/analytics-core/dist/css/dx-analytics.material.blue.light.css",
"../../../node_modules/devexpress-reporting/dist/css/dx-webdocumentviewer.css"
]
})
export class ReportViewerComponent implements OnInit {
get reportUrl() {
return this.koReportUrl();
};
set reportUrl(newUrl) {
this.koReportUrl(newUrl);
}
koReportUrl = ko.observable('');
invokeAction: string = '/DXXRDVAngular';
useSameTabExport = true;
useAsynchronousExport = true;
constructor(@Inject('BASE_URL') public hostUrl: string, private authorize: AuthorizeService, private activateRoute: ActivatedRoute) {
this.authorize.getAccessToken()
.subscribe(x => {
fetchSetup.fetchSettings = {
headers: {
'Authorization': 'Bearer ' + x
}
};
});
}
ngOnInit() {
if(this.activateRoute.snapshot.queryParams['reportId']) {
this.reportUrl = this.activateRoute.snapshot.queryParams['reportId'];
}
}
}