mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
This commit is contained in:
parent
e3cbff0e35
commit
c1493315bf
@ -139,6 +139,13 @@ export var reportDefParamTask = {
|
||||
'definition': '{ "parameters" :[{"id":"taskName","name":null,"nameKey":null,"type":"task","value":null,"dependsOn":"processDefinitionId"}]}'
|
||||
};
|
||||
|
||||
export var reportNoParameterDefinitions = {
|
||||
'id': 2006,
|
||||
'name': 'Fake Task service level agreement',
|
||||
'created': '2016-10-05T15:39:40.222+0000',
|
||||
'definition': '{ "parameters" : []}'
|
||||
};
|
||||
|
||||
export var reportDefParamTaskOptions = ['Fake task name 1', 'Fake task name 2'];
|
||||
|
||||
export var fieldProcessDef = new ReportParameterDetailsModel(
|
||||
|
@ -81,6 +81,9 @@ export class AnalyticsGeneratorComponent implements OnChanges {
|
||||
}
|
||||
|
||||
public generateReport(reportId, reportParamQuery) {
|
||||
if (reportParamQuery === undefined || reportParamQuery === null) {
|
||||
reportParamQuery = {};
|
||||
}
|
||||
this.analyticsService.getReportsByParams(reportId, reportParamQuery).subscribe(
|
||||
(res: Chart[]) => {
|
||||
this.reports = res;
|
||||
|
@ -342,6 +342,24 @@ describe('AnalyticsReportParametersComponent', () => {
|
||||
|
||||
});
|
||||
|
||||
it('Should create an empty valid form when there are no parameters definitions', () => {
|
||||
component.onSuccess.subscribe((res) => {
|
||||
expect(component.reportForm).toBeDefined();
|
||||
expect(component.reportForm.valid).toEqual(true);
|
||||
expect(component.reportForm.controls).toEqual({});
|
||||
});
|
||||
|
||||
let reportId = 1;
|
||||
let change = new SimpleChange(null, reportId);
|
||||
component.ngOnChanges({ 'reportId': change });
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'json',
|
||||
responseText: analyticParamsMock.reportNoParameterDefinitions
|
||||
});
|
||||
});
|
||||
|
||||
it('Should load the task list when a process definition is selected', () => {
|
||||
component.onSuccessReportParams.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
|
@ -195,6 +195,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
|
||||
if (this.reportParameters.hasParameters()) {
|
||||
this.onSuccessReportParams.emit(res);
|
||||
} else {
|
||||
this.reportForm = this.formBuilder.group({});
|
||||
this.onSuccess.emit();
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user