-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.ts
116 lines (108 loc) · 3.14 KB
/
index.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { NgModule, ModuleWithProviders } from '@angular/core';
import { HttpModule, Http } from '@angular/http';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
/**
* Import models
*/
import { Report } from './src/models/report';
/**
* Import components
*/
import { ReportFilter } from './src/components/reportFilter';
import { ReportNavigation } from './src/components/reportNavigation';
import { ReportViewer } from './src/components/reportViewer';
import { ReportsList } from './src/components/reportsList'
import { ReportDashboard } from './src/components/reportDashboard';
/**
* Import services
*/
import { PowerBIService } from './src/services/service';
import { ReportsListService, ReportsListServiceConfig } from './src/services/reportsList';
import { DocumentRef} from './src/services/documentRef';
import { WindowRef } from './src/services/windowRef';
/**
* Create barrel
*/
export {
Report,
WindowRef,
DocumentRef,
PowerBIService,
ReportsListService,
ReportsListServiceConfig,
ReportNavigation,
ReportViewer,
ReportFilter,
ReportsList,
ReportDashboard
}
/**
* Module definition.
*
* @class PowerBIModule
* @export
* @public
* @module
*/
@NgModule({
imports: [
CommonModule,
HttpModule,
RouterModule,
FormsModule
],
declarations: [
ReportNavigation,
ReportViewer,
ReportFilter,
ReportsList,
ReportDashboard
],
exports: [
CommonModule,
ReportNavigation,
ReportViewer,
ReportFilter,
ReportsList,
ReportDashboard
]
})
export class PowerBIModule {
/**
* Call forRoot() when importing the module in the application root module to create app wide services.
* Only call forRoot() once in your application.
*
* @param {string} webAPIServiceUrl - the url of the WebAPI service listing the reports and access tokens in the PowerBI workspace.
* @param {string} bearerToken - OAuth token to use to access the web api (if secured).
* @returns {ModuleWithProviders} - A module with injectable providers.
* @memberof PowerBIModule
* @method
* @public
* @static
*/
static forRoot(config?: ReportsListServiceConfig): ModuleWithProviders {
return {
ngModule: PowerBIModule,
providers: [
config ? { provide: ReportsListServiceConfig, useValue: config } : ReportsListServiceConfig,
{ provide: ReportsListService, deps: [Http, ReportsListServiceConfig], useFactory: ReportsListServiceFactory },
PowerBIService,
WindowRef,
DocumentRef
]
};
}
}
/**
* Factory function to the ReportsListService.
*
* @param {Http} http - An instance of the http service.
* @returns {ReportsListService} - An instance of the {@link ReportsListService}.
* @export
* @method
*/
export function ReportsListServiceFactory(http: Http, config: ReportsListServiceConfig): ReportsListService {
return new ReportsListService(http, config);
}