Add reports filter by appId

This commit is contained in:
mauriziovitale84
2016-10-12 20:16:25 +01:00
parent f23bb3e4c3
commit 72e33756fb
5 changed files with 98 additions and 35 deletions

View File

@@ -33,6 +33,9 @@ export class AnalyticsComponent implements OnInit, OnChanges {
@ViewChild('processDefinition')
processDefinition: any;
@Input()
appId: string;
@Input()
reportId: string;
@@ -85,13 +88,13 @@ export class AnalyticsComponent implements OnInit, OnChanges {
this.dropDownSub = this.onDropdownChanged.subscribe((field) => {
let paramDependOn: ReportParameterModel = this.reportDetails.definition.parameters.find(p => p.dependsOn === field.id);
if (paramDependOn) {
this.retrieveParameterOptions(this.reportDetails.definition.parameters, this.reportId, field.value);
this.retrieveParameterOptions(this.reportDetails.definition.parameters, this.appId, this.reportId, field.value);
}
});
this.paramOpts = this.onSuccessParamsReport.subscribe((report: ReportModel) => {
if (report.hasParameters()) {
this.retrieveParameterOptions(report.definition.parameters);
this.retrieveParameterOptions(report.definition.parameters, this.appId);
}
});
}
@@ -102,6 +105,12 @@ export class AnalyticsComponent implements OnInit, OnChanges {
this.getParamsReports(reportId.currentValue);
return;
}
let appId = changes['appId'];
if (appId && (appId.currentValue || appId.currentValue === null)) {
this.getParamsReports(this.reportId);
return;
}
}
public getParamsReports(reportId: string) {
@@ -119,9 +128,9 @@ export class AnalyticsComponent implements OnInit, OnChanges {
);
}
private retrieveParameterOptions(parameters: ReportParameterModel[], reportId?: string, processDefinitionId?: string) {
private retrieveParameterOptions(parameters: ReportParameterModel[], appId: string, reportId?: string, processDefinitionId?: string) {
parameters.forEach((param) => {
this.analyticsService.getParamValuesByType(param.type, this.reportId, processDefinitionId).subscribe(
this.analyticsService.getParamValuesByType(param.type, appId, reportId, processDefinitionId).subscribe(
(opts: ParameterValueModel[]) => {
param.options = opts;
this.onSuccessParamOpt.emit(opts);