Skip to content

Commit

Permalink
[ACA-3700] - add suspended date filter (#6886)
Browse files Browse the repository at this point in the history
* [ACA-3700] - add suspended date filter

* fix process list filtering

Co-authored-by: Silviu Constantin Popa <silviucpopa@L3700101120.ness.com>
  • Loading branch information
SilviuCPopa and Silviu Constantin Popa authored Apr 20, 2021
1 parent d376081 commit e376d2f
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/process-services-cloud/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"PROCESS_NAME": "Process Name",
"APP_VERSION": "AppVersion",
"STARTED_DATE": "Started Date",
"SUSPENDED_DATE": "Suspended Date",
"STARTED_BY": "Started by",
"COMPLETED_DATE": "Completed Date",
"DATE_RANGE": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,21 @@ describe('EditProcessFilterCloudComponent', () => {
});
});

it('should get form attributes for suspendedData', async() => {
fixture.detectChanges();
component.filterProperties = ['appName', 'suspendedDateRange'];
fixture.detectChanges();
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
component.ngOnChanges({ 'id': processFilterIdChange });
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(component.editProcessFilterForm.get('_suspendedFrom')).toBeDefined();
expect(component.editProcessFilterForm.get('_suspendedTo')).toBeDefined();
expect(component.editProcessFilterForm.get('suspendedDateType')).toBeDefined();
});
});

it('should able to build a editProcessFilter form with default properties if input is empty', async(() => {
fixture.detectChanges();
component.filterProperties = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,17 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
_startFrom: filterModel.startFrom || null,
_startTo: filterModel.startTo || null
}
},
{
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.SUSPENDED_DATE',
type: 'date-range',
key: 'suspendedDateRange',
attributes: { dateType: 'suspendedDateType', from: '_suspendedFrom', to: '_suspendedTo'},
value: {
suspendedDateType: filterModel.suspendedDateType || null,
_startFrom: filterModel.suspendedFrom || null,
_startTo: filterModel.suspendedTo || null
}
}
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ export class ProcessFilterCloudModel {
startedDate: Date;
completedDateType: DateCloudFilterType;
startedDateType: DateCloudFilterType;
suspendedDateType: DateCloudFilterType;
completedDate: Date;

private _completedFrom: string;
private _completedTo: string;
private _startFrom: string;
private _startTo: string;
private _suspendedFrom: string;
private _suspendedTo: string;

constructor(obj?: any) {
if (obj) {
Expand Down Expand Up @@ -82,9 +85,12 @@ export class ProcessFilterCloudModel {
this.startTo = obj._startTo || null;
this.completedDateType = obj.completedDateType || null;
this.startedDateType = obj.startedDateType || null;
this.suspendedDateType = obj.suspendedDateType || null;
this.completedFrom = obj._completedFrom || null;
this.completedTo = obj._completedTo || null;
this.completedDate = obj.completedDate || null;
this._suspendedFrom = obj._suspendedFrom || null;
this._suspendedTo = obj._suspendedTo || null;
}
}

Expand Down Expand Up @@ -132,6 +138,28 @@ export class ProcessFilterCloudModel {
return this.getEndDate(this.startedDateType);
}

set suspendedFrom(suspendedFrom: string) {
this._suspendedFrom = suspendedFrom;
}

set suspendedTo(suspendedTo: string) {
this._suspendedTo = suspendedTo;
}

get suspendedFrom(): string {
if (this.isDateRangeType(this.suspendedDateType)) {
return this._suspendedFrom;
}
return this.getEndDate(this.suspendedDateType);
}

get suspendedTo(): string {
if (this.isDateRangeType(this.suspendedDateType)) {
return this._suspendedTo;
}
return this.getEndDate(this.suspendedDateType);
}

private getStartDate(key: DateCloudFilterType) {
return this.dateRangeFilterService.getDateRange(key).startDate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
@Input()
completedDate: string = '';

/** Filter the processes. Display only process with suspendedFrom equal to the supplied date. */
@Input()
suspendedFrom: string = '';

/** Filter the processes. Display only process with suspendedTo equal to the supplied date. */
@Input()
suspendedTo: string = '';

/**
* Row selection mode. Can be "none", "single" or "multiple".
* For multiple mode, you can use Cmd (macOS) or Ctrl (Win) modifier
Expand Down Expand Up @@ -341,6 +349,8 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
startTo: this.startTo,
completedFrom: this.completedFrom,
completedTo: this.completedTo,
suspendedFrom: this.suspendedFrom,
suspendedTo: this.suspendedTo,
completedDate: this.completedDate,
sorting: this.sorting
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export class ProcessQueryCloudRequestModel {
startTo?: string;
completedFrom?: string;
completedTo?: string;
suspendedFrom?: string;
suspendedTo?: string;
completedDate?: string;
maxItems: number;
skipCount: number;
Expand All @@ -60,6 +62,8 @@ export class ProcessQueryCloudRequestModel {
this.startTo = obj.startTo;
this.completedFrom = obj.completedFrom;
this.completedTo = obj.completedTo;
this.suspendedFrom = obj.suspendedFrom;
this.suspendedTo = obj.suspendedTo;
this.completedDate = obj.completedDate;
this.maxItems = obj.maxItems;
this.skipCount = obj.skipCount;
Expand Down

0 comments on commit e376d2f

Please sign in to comment.