mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Add reports filter by appId
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user