mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-3992] cleanup the code before refactoring (#6301)
* use interface instead of class * cleanup code and fix html template typo * api cleanup * use interface instead of class * code cleanup and test fixes * use interface instead of class * use interface instead of class, fix typing issues * fix IDE support for spec files * fix IDE for spec files * unify filter compare * remove jest * use generics to reduce code duplication * generic saveas * unify code
This commit is contained in:
@@ -51,7 +51,7 @@ import moment from 'moment-es6';
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.options = this.options ? this.options : this.createDefaultRangeOptions();
|
this.options = this.options ? this.options : this.createDefaultRangeOptions();
|
||||||
const defaultProperties = this.createDefaultDateOptions();
|
const defaultProperties = this.createDefaultDateOptions();
|
||||||
this.filteredProperties = defaultProperties.filter((filterProperty: ProcessFilterOptions) => this.isValidProperty(this.options, filterProperty));
|
this.filteredProperties = defaultProperties.filter((filterProperty) => this.isValidProperty(this.options, filterProperty.value.toString()));
|
||||||
if (this.hasPreselectedValues()) {
|
if (this.hasPreselectedValues()) {
|
||||||
this.setPreselectedValues();
|
this.setPreselectedValues();
|
||||||
}
|
}
|
||||||
@@ -98,8 +98,8 @@ import moment from 'moment-es6';
|
|||||||
return this.processFilterProperty.value[attribute];
|
return this.processFilterProperty.value[attribute];
|
||||||
}
|
}
|
||||||
|
|
||||||
private isValidProperty(filterProperties: string[], filterProperty: any): boolean {
|
private isValidProperty(filterProperties: string[], key: string): boolean {
|
||||||
return filterProperties ? filterProperties.indexOf(filterProperty.value) >= 0 : true;
|
return filterProperties ? filterProperties.indexOf(key) >= 0 : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createDefaultRangeOptions(): DateCloudFilterType[] {
|
private createDefaultRangeOptions(): DateCloudFilterType[] {
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
<form [formGroup]="editProcessFilterForm" *ngIf="editProcessFilterForm">
|
<form [formGroup]="editProcessFilterForm" *ngIf="editProcessFilterForm">
|
||||||
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="10px" fxLayoutAlign="start center">
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="10px" fxLayoutAlign="start center">
|
||||||
<ng-container *ngFor="let processFilterProperty of processFilterProperties">
|
<ng-container *ngFor="let processFilterProperty of processFilterProperties">
|
||||||
<mat-form-field fxFlex="23%" *ngIf="isSelectType(processFilterProperty)" [attr.data-automation-id]="processFilterProperty.key">
|
<mat-form-field fxFlex="23%" *ngIf="processFilterProperty.type === 'select'" [attr.data-automation-id]="processFilterProperty.key">
|
||||||
<mat-select
|
<mat-select
|
||||||
placeholder="{{processFilterProperty.label | translate}}"
|
placeholder="{{processFilterProperty.label | translate}}"
|
||||||
[formControlName]="processFilterProperty.key"
|
[formControlName]="processFilterProperty.key"
|
||||||
@@ -34,21 +34,21 @@
|
|||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field fxFlex="23%" *ngIf="isTextType(processFilterProperty)" [attr.data-automation-id]="processFilterProperty.key">
|
<mat-form-field fxFlex="23%" *ngIf="processFilterProperty.type === 'text'" [attr.data-automation-id]="processFilterProperty.key">
|
||||||
<input matInput
|
<input matInput
|
||||||
[formControlName]="processFilterProperty.key"
|
[formControlName]="processFilterProperty.key"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="{{processFilterProperty.label | translate}}"
|
placeholder="{{processFilterProperty.label | translate}}"
|
||||||
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key"/>
|
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key"/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field fxFlex="23%" *ngIf="isNumberType(processFilterProperty)" [attr.data-automation-id]="processFilterProperty.key">
|
<mat-form-field fxFlex="23%" *ngIf="processFilterProperty.type === 'number'" [attr.data-automation-id]="processFilterProperty.key">
|
||||||
<input matInput
|
<input matInput
|
||||||
[formControlName]="processFilterProperty.key"
|
[formControlName]="processFilterProperty.key"
|
||||||
type="number" min="0"
|
type="number" min="0"
|
||||||
placeholder="{{processFilterProperty.label | translate}}"
|
placeholder="{{processFilterProperty.label | translate}}"
|
||||||
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key"/>
|
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key"/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field fxFlex="23%" *ngIf="isDateType(processFilterProperty)" [attr.data-automation-id]="processFilterProperty.key">
|
<mat-form-field fxFlex="23%" *ngIf="processFilterProperty.type === 'date'" [attr.data-automation-id]="processFilterProperty.key">
|
||||||
<mat-label>{{processFilterProperty.label | translate}}</mat-label>
|
<mat-label>{{processFilterProperty.label | translate}}</mat-label>
|
||||||
<input
|
<input
|
||||||
matInput
|
matInput
|
||||||
@@ -67,13 +67,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<adf-cloud-date-range-filter *ngIf="isDateRangeType(processFilterProperty)"
|
<adf-cloud-date-range-filter *ngIf="processFilterProperty.type === 'date-range'"
|
||||||
[processFilterProperty]="processFilterProperty"
|
[processFilterProperty]="processFilterProperty"
|
||||||
[options]="processFilterProperty.dateFilterOptions"
|
[options]="processFilterProperty.dateFilterOptions"
|
||||||
(dateTypeChange)="onDateTypeChange($event, processFilterProperty)"
|
(dateTypeChange)="onDateTypeChange($event, processFilterProperty)"
|
||||||
(dateChanged)="onDateRangeFilterChanged($event, processFilterProperty)"></adf-cloud-date-range-filter>
|
(dateChanged)="onDateRangeFilterChanged($event, processFilterProperty)"></adf-cloud-date-range-filter>
|
||||||
|
|
||||||
<div fxFlex="23%" *ngIf="isUserSelectType(processFilterProperty)">
|
<div fxFlex="23%" *ngIf="processFilterProperty.type === 'people'">
|
||||||
<adf-cloud-people
|
<adf-cloud-people
|
||||||
[preSelectUsers]="processFilterProperty.value"
|
[preSelectUsers]="processFilterProperty.value"
|
||||||
[title]="processFilterProperty.label"
|
[title]="processFilterProperty.label"
|
||||||
|
@@ -24,13 +24,11 @@ import { Subject, Observable } from 'rxjs';
|
|||||||
import moment from 'moment-es6';
|
import moment from 'moment-es6';
|
||||||
import { Moment } from 'moment';
|
import { Moment } from 'moment';
|
||||||
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
||||||
import { ProcessFilterCloudModel, ProcessFilterProperties, ProcessFilterAction, ProcessFilterOptions, ProcessSortFilterProperties } from '../models/process-filter-cloud.model';
|
import { ProcessFilterCloudModel, ProcessFilterProperties, ProcessFilterAction, ProcessFilterOptions, ProcessSortFilterProperty } from '../models/process-filter-cloud.model';
|
||||||
import { IdentityUserModel, TranslationService, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
import { IdentityUserModel, TranslationService, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||||
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
|
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
|
||||||
import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud.component';
|
import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud.component';
|
||||||
import { ApplicationInstanceModel } from '../../../app/models/application-instance.model';
|
|
||||||
import { ProcessCloudService } from '../../services/process-cloud.service';
|
import { ProcessCloudService } from '../../services/process-cloud.service';
|
||||||
import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model';
|
|
||||||
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
|
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -43,12 +41,6 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
public static ACTION_SAVE = 'save';
|
public static ACTION_SAVE = 'save';
|
||||||
public static ACTION_SAVE_AS = 'saveAs';
|
public static ACTION_SAVE_AS = 'saveAs';
|
||||||
public static ACTION_DELETE = 'delete';
|
public static ACTION_DELETE = 'delete';
|
||||||
public static APPLICATION_NAME: string = 'appName';
|
|
||||||
public static PROCESS_DEFINITION_NAME: string = 'processDefinitionName';
|
|
||||||
public static APP_RUNNING_STATUS: string = 'RUNNING';
|
|
||||||
public static LAST_MODIFIED: string = 'lastModified';
|
|
||||||
public static SORT: string = 'sort';
|
|
||||||
public static ORDER: string = 'order';
|
|
||||||
public static DEFAULT_PROCESS_FILTER_PROPERTIES = ['status', 'sort', 'order', 'lastModified'];
|
public static DEFAULT_PROCESS_FILTER_PROPERTIES = ['status', 'sort', 'order', 'lastModified'];
|
||||||
public static DEFAULT_SORT_PROPERTIES = ['id', 'name', 'status', 'startDate'];
|
public static DEFAULT_SORT_PROPERTIES = ['id', 'name', 'status', 'startDate'];
|
||||||
public static DEFAULT_ACTIONS = ['save', 'saveAs', 'delete'];
|
public static DEFAULT_ACTIONS = ['save', 'saveAs', 'delete'];
|
||||||
@@ -92,11 +84,11 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
|
|
||||||
/** Emitted when a process instance filter property changes. */
|
/** Emitted when a process instance filter property changes. */
|
||||||
@Output()
|
@Output()
|
||||||
filterChange: EventEmitter<ProcessFilterCloudModel> = new EventEmitter();
|
filterChange = new EventEmitter<ProcessFilterCloudModel>();
|
||||||
|
|
||||||
/** Emitted when a filter action occurs i.e Save, SaveAs, Delete. */
|
/** Emitted when a filter action occurs i.e Save, SaveAs, Delete. */
|
||||||
@Output()
|
@Output()
|
||||||
action: EventEmitter<ProcessFilterAction> = new EventEmitter();
|
action = new EventEmitter<ProcessFilterAction>();
|
||||||
|
|
||||||
processFilter: ProcessFilterCloudModel;
|
processFilter: ProcessFilterCloudModel;
|
||||||
changedProcessFilter: ProcessFilterCloudModel;
|
changedProcessFilter: ProcessFilterCloudModel;
|
||||||
@@ -163,7 +155,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFormControlsConfig(processFilterProperties: ProcessFilterProperties[]): any {
|
getFormControlsConfig(processFilterProperties: ProcessFilterProperties[]): any {
|
||||||
const properties = processFilterProperties.map((property: ProcessFilterProperties) => {
|
const properties = processFilterProperties.map((property) => {
|
||||||
if (!!property.attributes) {
|
if (!!property.attributes) {
|
||||||
return this.getAttributesControlConfig(property);
|
return this.getAttributesControlConfig(property);
|
||||||
} else {
|
} else {
|
||||||
@@ -219,16 +211,16 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
|
|
||||||
createAndFilterProperties(): ProcessFilterProperties[] {
|
createAndFilterProperties(): ProcessFilterProperties[] {
|
||||||
this.checkMandatoryFilterProperties();
|
this.checkMandatoryFilterProperties();
|
||||||
if (this.checkForProperty(EditProcessFilterCloudComponent.APPLICATION_NAME)) {
|
if (this.checkForProperty('appName')) {
|
||||||
this.applicationNames = [];
|
this.applicationNames = [];
|
||||||
this.getRunningApplications();
|
this.getRunningApplications();
|
||||||
}
|
}
|
||||||
if (this.checkForProperty(EditProcessFilterCloudComponent.PROCESS_DEFINITION_NAME)) {
|
if (this.checkForProperty('processDefinitionName')) {
|
||||||
this.processDefinitionNames = [];
|
this.processDefinitionNames = [];
|
||||||
this.getProcessDefinitions();
|
this.getProcessDefinitions();
|
||||||
}
|
}
|
||||||
const defaultProperties = this.createProcessFilterProperties(this.processFilter);
|
const defaultProperties = this.createProcessFilterProperties(this.processFilter);
|
||||||
let filteredProperties = defaultProperties.filter((filterProperty: ProcessFilterProperties) => this.isValidProperty(this.filterProperties, filterProperty));
|
let filteredProperties = defaultProperties.filter((filterProperty) => this.isValidProperty(this.filterProperties, filterProperty.key));
|
||||||
if (!this.hasSortProperty()) {
|
if (!this.hasSortProperty()) {
|
||||||
filteredProperties = this.removeOrderProperty(filteredProperties);
|
filteredProperties = this.removeOrderProperty(filteredProperties);
|
||||||
}
|
}
|
||||||
@@ -248,23 +240,21 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
return this.filterProperties ? this.filterProperties.indexOf(property) >= 0 : false;
|
return this.filterProperties ? this.filterProperties.indexOf(property) >= 0 : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private isValidProperty(filterProperties: string[], filterProperty: ProcessFilterProperties): boolean {
|
private isValidProperty(filterProperties: string[], key: string): boolean {
|
||||||
return filterProperties ? filterProperties.indexOf(filterProperty.key) >= 0 : true;
|
return filterProperties ? filterProperties.indexOf(key) >= 0 : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasSortProperty(): boolean {
|
private hasSortProperty(): boolean {
|
||||||
return this.filterProperties.indexOf(EditProcessFilterCloudComponent.SORT) >= 0;
|
return this.filterProperties.includes('sort');
|
||||||
}
|
}
|
||||||
|
|
||||||
hasLastModifiedProperty(): boolean {
|
private hasLastModifiedProperty(): boolean {
|
||||||
return this.filterProperties.indexOf(EditProcessFilterCloudComponent.LAST_MODIFIED) >= 0;
|
return this.filterProperties.includes('lastModified');
|
||||||
}
|
}
|
||||||
|
|
||||||
removeOrderProperty(filteredProperties: ProcessFilterProperties[]): ProcessFilterProperties[] {
|
removeOrderProperty(filteredProperties: ProcessFilterProperties[]): ProcessFilterProperties[] {
|
||||||
if (filteredProperties && filteredProperties.length > 0) {
|
if (filteredProperties && filteredProperties.length > 0) {
|
||||||
return filteredProperties.filter(
|
return filteredProperties.filter(property => property.key !== 'order');
|
||||||
property => property.key !== EditProcessFilterCloudComponent.ORDER
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -272,8 +262,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
get createSortProperties(): ProcessFilterOptions[] {
|
get createSortProperties(): ProcessFilterOptions[] {
|
||||||
this.checkMandatorySortProperties();
|
this.checkMandatorySortProperties();
|
||||||
const defaultSortProperties = this.createProcessSortProperties();
|
const defaultSortProperties = this.createProcessSortProperties();
|
||||||
const sortProperties = defaultSortProperties.filter((sortProperty: ProcessFilterProperties) => this.isValidProperty(this.sortProperties, sortProperty));
|
return defaultSortProperties.filter((sortProperty) => this.isValidProperty(this.sortProperties, sortProperty.key));
|
||||||
return sortProperties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkMandatorySortProperties() {
|
checkMandatorySortProperties() {
|
||||||
@@ -285,7 +274,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
createAndFilterActions() {
|
createAndFilterActions() {
|
||||||
this.checkMandatoryActions();
|
this.checkMandatoryActions();
|
||||||
const actions = this.createFilterActions();
|
const actions = this.createFilterActions();
|
||||||
return actions.filter((action: ProcessFilterAction) => this.isValidAction(this.actions, action));
|
return actions.filter((action) => this.isValidAction(this.actions, action));
|
||||||
}
|
}
|
||||||
|
|
||||||
checkMandatoryActions() {
|
checkMandatoryActions() {
|
||||||
@@ -294,7 +283,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private isValidAction(actions: string[], action: any): boolean {
|
private isValidAction(actions: string[], action: ProcessFilterAction): boolean {
|
||||||
return actions ? actions.indexOf(action.actionType) >= 0 : true;
|
return actions ? actions.indexOf(action.actionType) >= 0 : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,12 +298,13 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
onDateChanged(newDateValue: any, dateProperty: ProcessFilterProperties) {
|
onDateChanged(newDateValue: any, dateProperty: ProcessFilterProperties) {
|
||||||
if (newDateValue) {
|
if (newDateValue) {
|
||||||
const momentDate = moment(newDateValue, this.DATE_FORMAT, true);
|
const momentDate = moment(newDateValue, this.DATE_FORMAT, true);
|
||||||
|
const controller = this.getPropertyController(dateProperty);
|
||||||
|
|
||||||
if (momentDate.isValid()) {
|
if (momentDate.isValid()) {
|
||||||
this.getPropertyController(dateProperty).setValue(momentDate.toDate());
|
controller.setValue(momentDate.toDate());
|
||||||
this.getPropertyController(dateProperty).setErrors(null);
|
controller.setErrors(null);
|
||||||
} else {
|
} else {
|
||||||
this.getPropertyController(dateProperty).setErrors({ invalid: true });
|
controller.setErrors({ invalid: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,7 +327,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasError(property: ProcessFilterProperties): boolean {
|
hasError(property: ProcessFilterProperties): boolean {
|
||||||
return this.getPropertyController(property).errors && this.getPropertyController(property).errors.invalid;
|
const controller = this.getPropertyController(property);
|
||||||
|
return controller.errors && controller.errors.invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
compareFilters(editedQuery: ProcessFilterCloudModel, currentQuery: ProcessFilterCloudModel): boolean {
|
compareFilters(editedQuery: ProcessFilterCloudModel, currentQuery: ProcessFilterCloudModel): boolean {
|
||||||
@@ -346,9 +337,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
|
|
||||||
getRunningApplications() {
|
getRunningApplications() {
|
||||||
this.appsProcessCloudService
|
this.appsProcessCloudService
|
||||||
.getDeployedApplicationsByStatus(EditProcessFilterCloudComponent.APP_RUNNING_STATUS, this.role)
|
.getDeployedApplicationsByStatus('RUNNING', this.role)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.subscribe((applications) => {
|
||||||
.subscribe((applications: ApplicationInstanceModel[]) => {
|
|
||||||
if (applications && applications.length > 0) {
|
if (applications && applications.length > 0) {
|
||||||
applications.map((application) => {
|
applications.map((application) => {
|
||||||
this.applicationNames.push({ label: application.name, value: application.name });
|
this.applicationNames.push({ label: application.name, value: application.name });
|
||||||
@@ -358,9 +348,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
}
|
}
|
||||||
|
|
||||||
getProcessDefinitions() {
|
getProcessDefinitions() {
|
||||||
this.processCloudService.getProcessDefinitions(this.appName)
|
this.processCloudService.getProcessDefinitions(this.appName).subscribe((processDefinitions) => {
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
|
||||||
.subscribe((processDefinitions: ProcessDefinitionCloud[]) => {
|
|
||||||
if (processDefinitions && processDefinitions.length > 0) {
|
if (processDefinitions && processDefinitions.length > 0) {
|
||||||
this.processDefinitionNames.push(this.allProcessDefinitionNamesOption);
|
this.processDefinitionNames.push(this.allProcessDefinitionNamesOption);
|
||||||
processDefinitions.map((processDefinition) => {
|
processDefinitions.map((processDefinition) => {
|
||||||
@@ -383,7 +371,6 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
save(saveAction: ProcessFilterAction) {
|
save(saveAction: ProcessFilterAction) {
|
||||||
this.processFilterCloudService
|
this.processFilterCloudService
|
||||||
.updateFilter(this.changedProcessFilter)
|
.updateFilter(this.changedProcessFilter)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
saveAction.filter = this.changedProcessFilter;
|
saveAction.filter = this.changedProcessFilter;
|
||||||
this.action.emit(saveAction);
|
this.action.emit(saveAction);
|
||||||
@@ -403,8 +390,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
this.action.emit(deleteAction);
|
this.action.emit(deleteAction);
|
||||||
return filters.length === 0;
|
return filters.length === 0;
|
||||||
}),
|
}),
|
||||||
switchMap(() => this.restoreDefaultProcessFilters()),
|
switchMap(() => this.restoreDefaultProcessFilters()))
|
||||||
takeUntil(this.onDestroy$))
|
|
||||||
.subscribe(() => {});
|
.subscribe(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +418,6 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
const resultFilter: ProcessFilterCloudModel = Object.assign({}, this.changedProcessFilter, newFilter);
|
const resultFilter: ProcessFilterCloudModel = Object.assign({}, this.changedProcessFilter, newFilter);
|
||||||
this.processFilterCloudService
|
this.processFilterCloudService
|
||||||
.addFilter(resultFilter)
|
.addFilter(resultFilter)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
saveAsAction.filter = resultFilter;
|
saveAsAction.filter = resultFilter;
|
||||||
this.action.emit(saveAsAction);
|
this.action.emit(saveAsAction);
|
||||||
@@ -475,30 +460,6 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
this.toggleFilterActions = false;
|
this.toggleFilterActions = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isDateType(property: ProcessFilterProperties): boolean {
|
|
||||||
return property.type === 'date';
|
|
||||||
}
|
|
||||||
|
|
||||||
isDateRangeType(property: ProcessFilterProperties): boolean {
|
|
||||||
return property.type === 'date-range';
|
|
||||||
}
|
|
||||||
|
|
||||||
isSelectType(property: ProcessFilterProperties): boolean {
|
|
||||||
return property.type === 'select';
|
|
||||||
}
|
|
||||||
|
|
||||||
isTextType(property: ProcessFilterProperties): boolean {
|
|
||||||
return property.type === 'text';
|
|
||||||
}
|
|
||||||
|
|
||||||
isNumberType(property: ProcessFilterProperties): boolean {
|
|
||||||
return property.type === 'number';
|
|
||||||
}
|
|
||||||
|
|
||||||
isUserSelectType(property: ProcessFilterProperties): boolean {
|
|
||||||
return property.type === 'people';
|
|
||||||
}
|
|
||||||
|
|
||||||
isDisabledAction(action: ProcessFilterAction): boolean {
|
isDisabledAction(action: ProcessFilterAction): boolean {
|
||||||
return this.isDisabledForDefaultFilters(action) ? true : this.hasFormChanged(action);
|
return this.isDisabledForDefaultFilters(action) ? true : this.hasFormChanged(action);
|
||||||
}
|
}
|
||||||
@@ -538,42 +499,42 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
|
|
||||||
createFilterActions(): ProcessFilterAction[] {
|
createFilterActions(): ProcessFilterAction[] {
|
||||||
return [
|
return [
|
||||||
new ProcessFilterAction({
|
{
|
||||||
actionType: EditProcessFilterCloudComponent.ACTION_SAVE,
|
actionType: EditProcessFilterCloudComponent.ACTION_SAVE,
|
||||||
icon: 'save',
|
icon: 'save',
|
||||||
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.SAVE'
|
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.SAVE'
|
||||||
}),
|
},
|
||||||
new ProcessFilterAction({
|
{
|
||||||
actionType: EditProcessFilterCloudComponent.ACTION_SAVE_AS,
|
actionType: EditProcessFilterCloudComponent.ACTION_SAVE_AS,
|
||||||
icon: 'adf:save-as',
|
icon: 'adf:save-as',
|
||||||
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.SAVE_AS'
|
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.SAVE_AS'
|
||||||
}),
|
},
|
||||||
new ProcessFilterAction({
|
{
|
||||||
actionType: EditProcessFilterCloudComponent.ACTION_DELETE,
|
actionType: EditProcessFilterCloudComponent.ACTION_DELETE,
|
||||||
icon: 'delete',
|
icon: 'delete',
|
||||||
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.DELETE'
|
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.DELETE'
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
createLastModifiedProperty(): ProcessFilterProperties[] {
|
createLastModifiedProperty(): ProcessFilterProperties[] {
|
||||||
return [
|
return [
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.LAST_MODIFIED_DATE_FORM',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.LAST_MODIFIED_DATE_FORM',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
key: 'lastModifiedFrom',
|
key: 'lastModifiedFrom',
|
||||||
value: ''
|
value: ''
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.LAST_MODIFIED_TO',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.LAST_MODIFIED_TO',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
key: 'lastModifiedTo',
|
key: 'lastModifiedTo',
|
||||||
value: ''
|
value: ''
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
createProcessSortProperties(): ProcessSortFilterProperties[] {
|
createProcessSortProperties(): ProcessSortFilterProperty[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.ID',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.ID',
|
||||||
@@ -645,85 +606,85 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
|
|
||||||
createProcessFilterProperties(currentProcessFilter: ProcessFilterCloudModel): ProcessFilterProperties[] {
|
createProcessFilterProperties(currentProcessFilter: ProcessFilterCloudModel): ProcessFilterProperties[] {
|
||||||
return [
|
return [
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.APP_NAME',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.APP_NAME',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'appName',
|
key: 'appName',
|
||||||
value: currentProcessFilter.appName || '',
|
value: currentProcessFilter.appName || '',
|
||||||
options: this.applicationNames
|
options: this.applicationNames
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.APP_VERSION',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.APP_VERSION',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
key: 'appVersion',
|
key: 'appVersion',
|
||||||
value: currentProcessFilter.appVersion
|
value: currentProcessFilter.appVersion
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_INS_ID',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_INS_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'processInstanceId',
|
key: 'processInstanceId',
|
||||||
value: currentProcessFilter.processInstanceId || ''
|
value: currentProcessFilter.processInstanceId || ''
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'processName',
|
key: 'processName',
|
||||||
value: currentProcessFilter.processName || ''
|
value: currentProcessFilter.processName || ''
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_NAME',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_NAME',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'processDefinitionName',
|
key: 'processDefinitionName',
|
||||||
value: currentProcessFilter.processDefinitionName || '',
|
value: currentProcessFilter.processDefinitionName || '',
|
||||||
options: this.processDefinitionNames
|
options: this.processDefinitionNames
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STATUS',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STATUS',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'status',
|
key: 'status',
|
||||||
value: currentProcessFilter.status || this.status[0].value,
|
value: currentProcessFilter.status || this.status[0].value,
|
||||||
options: this.status
|
options: this.status
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_ID',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'processDefinitionId',
|
key: 'processDefinitionId',
|
||||||
value: currentProcessFilter.processDefinitionId || ''
|
value: currentProcessFilter.processDefinitionId || ''
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_KEY',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_DEF_KEY',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'processDefinitionKey',
|
key: 'processDefinitionKey',
|
||||||
value: currentProcessFilter.processDefinitionKey || ''
|
value: currentProcessFilter.processDefinitionKey || ''
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.SORT',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.SORT',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'sort',
|
key: 'sort',
|
||||||
value: currentProcessFilter.sort || this.createSortProperties[0].value,
|
value: currentProcessFilter.sort || this.createSortProperties[0].value,
|
||||||
options: this.createSortProperties
|
options: this.createSortProperties
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.DIRECTION',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.DIRECTION',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'order',
|
key: 'order',
|
||||||
value: currentProcessFilter.order || this.directions[0].value,
|
value: currentProcessFilter.order || this.directions[0].value,
|
||||||
options: this.directions
|
options: this.directions
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.COMPLETED_DATE',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.COMPLETED_DATE',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
key: 'completedDate',
|
key: 'completedDate',
|
||||||
value: currentProcessFilter.completedDate || false
|
value: currentProcessFilter.completedDate || false
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STARTED_BY',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STARTED_BY',
|
||||||
type: 'people',
|
type: 'people',
|
||||||
key: 'initiator',
|
key: 'initiator',
|
||||||
value: currentProcessFilter.initiator,
|
value: currentProcessFilter.initiator,
|
||||||
selectionMode: 'multiple'
|
selectionMode: 'multiple'
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.COMPLETED_DATE',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.COMPLETED_DATE',
|
||||||
type: 'date-range',
|
type: 'date-range',
|
||||||
key: 'completedDateRange',
|
key: 'completedDateRange',
|
||||||
@@ -733,8 +694,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
_completedFrom: currentProcessFilter.completedFrom || null,
|
_completedFrom: currentProcessFilter.completedFrom || null,
|
||||||
_completedTo: currentProcessFilter.completedTo || null
|
_completedTo: currentProcessFilter.completedTo || null
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
new ProcessFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STARTED_DATE',
|
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.STARTED_DATE',
|
||||||
type: 'date-range',
|
type: 'date-range',
|
||||||
key: 'startedDateRange',
|
key: 'startedDateRange',
|
||||||
@@ -744,7 +705,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
_startFrom: currentProcessFilter.startFrom || null,
|
_startFrom: currentProcessFilter.startFrom || null,
|
||||||
_startTo: currentProcessFilter.startTo || null
|
_startTo: currentProcessFilter.startTo || null
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,6 @@ import { ProcessFiltersCloudComponent } from './process-filters-cloud.component'
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||||
import { ProcessFiltersCloudModule } from '../process-filters-cloud.module';
|
import { ProcessFiltersCloudModule } from '../process-filters-cloud.module';
|
||||||
import { FilterParamsModel } from '../../../task/task-filters/models/filter-cloud.model';
|
|
||||||
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
@@ -194,7 +193,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
|||||||
it('should select the filter based on the input by name param', (done) => {
|
it('should select the filter based on the input by name param', (done) => {
|
||||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ name: 'FakeRunningProcesses' });
|
component.filterParam = { name: 'FakeRunningProcesses' };
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
|
|
||||||
@@ -212,7 +211,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
|||||||
it('should select the filter based on the input by key param', (done) => {
|
it('should select the filter based on the input by key param', (done) => {
|
||||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ key: 'completed-processes' });
|
component.filterParam = { key: 'completed-processes' };
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
|
|
||||||
@@ -231,7 +230,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
|||||||
it('should select the filter based on the input by index param', (done) => {
|
it('should select the filter based on the input by index param', (done) => {
|
||||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ index: 2 });
|
component.filterParam = { index: 2 };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
@@ -250,7 +249,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
|||||||
it('should select the filter based on the input by id param', (done) => {
|
it('should select the filter based on the input by id param', (done) => {
|
||||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ id: '12' });
|
component.filterParam = { id: '12' };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
@@ -269,7 +268,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
|||||||
it('should emit an event when a filter is selected', (done) => {
|
it('should emit an event when a filter is selected', (done) => {
|
||||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ id: '10' });
|
component.filterParam = { id: '10' };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
|
@@ -44,15 +44,15 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
|
|
||||||
/** Emitted when a filter is selected/clicked */
|
/** Emitted when a filter is selected/clicked */
|
||||||
@Output()
|
@Output()
|
||||||
filterClick: EventEmitter<ProcessFilterCloudModel> = new EventEmitter<ProcessFilterCloudModel>();
|
filterClick = new EventEmitter<ProcessFilterCloudModel>();
|
||||||
|
|
||||||
/** Emitted when filters are loaded successfully */
|
/** Emitted when filters are loaded successfully */
|
||||||
@Output()
|
@Output()
|
||||||
success: EventEmitter<any> = new EventEmitter<any>();
|
success = new EventEmitter<any>();
|
||||||
|
|
||||||
/** Emitted when any error occurs while loading the filters */
|
/** Emitted when any error occurs while loading the filters */
|
||||||
@Output()
|
@Output()
|
||||||
error: EventEmitter<any> = new EventEmitter<any>();
|
error = new EventEmitter<any>();
|
||||||
|
|
||||||
filters$: Observable<ProcessFilterCloudModel[]>;
|
filters$: Observable<ProcessFilterCloudModel[]>;
|
||||||
|
|
||||||
|
@@ -141,20 +141,11 @@ export class ProcessFilterCloudModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ProcessFilterAction {
|
export interface ProcessFilterAction {
|
||||||
actionType: string;
|
actionType?: string;
|
||||||
icon: string;
|
icon?: string;
|
||||||
tooltip: string;
|
tooltip?: string;
|
||||||
filter: ProcessFilterCloudModel;
|
filter?: ProcessFilterCloudModel;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
|
||||||
if (obj) {
|
|
||||||
this.actionType = obj.actionType || null;
|
|
||||||
this.icon = obj.icon || null;
|
|
||||||
this.tooltip = obj.tooltip || null;
|
|
||||||
this.filter = obj.filter || null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProcessFilterOptions {
|
export interface ProcessFilterOptions {
|
||||||
@@ -162,31 +153,18 @@ export interface ProcessFilterOptions {
|
|||||||
value?: string | object;
|
value?: string | object;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ProcessFilterProperties {
|
export interface ProcessFilterProperties {
|
||||||
label: string;
|
label?: string;
|
||||||
type: string;
|
type?: string;
|
||||||
value: string | object;
|
value?: any;
|
||||||
key: string;
|
key?: string;
|
||||||
attributes?: { [key: string]: string; };
|
attributes?: { [key: string]: string; };
|
||||||
options?: ProcessFilterOptions[];
|
options?: ProcessFilterOptions[];
|
||||||
dateFilterOptions?: DateCloudFilterType[];
|
dateFilterOptions?: DateCloudFilterType[];
|
||||||
selectionMode?: ComponentSelectionMode;
|
selectionMode?: ComponentSelectionMode;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
|
||||||
if (obj) {
|
|
||||||
this.label = obj.label || null;
|
|
||||||
this.type = obj.type || null;
|
|
||||||
this.value = obj.value || '';
|
|
||||||
this.key = obj.key || null;
|
|
||||||
this.attributes = obj.attributes || null;
|
|
||||||
this.options = obj.options || null;
|
|
||||||
this.dateFilterOptions = obj.dateFilterOptions || null;
|
|
||||||
this.selectionMode = obj.selectionMode || null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProcessSortFilterProperties {
|
export interface ProcessSortFilterProperty {
|
||||||
label: string;
|
label: string;
|
||||||
value: string | object;
|
value: string | object;
|
||||||
key: string;
|
key: string;
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
fxLayoutAlign="start center">
|
fxLayoutAlign="start center">
|
||||||
<ng-container *ngFor="let taskFilterProperty of taskFilterProperties">
|
<ng-container *ngFor="let taskFilterProperty of taskFilterProperties">
|
||||||
<mat-form-field fxFlex="23%"
|
<mat-form-field fxFlex="23%"
|
||||||
*ngIf="isSelectType(taskFilterProperty)"
|
*ngIf="taskFilterProperty.type === 'select'"
|
||||||
[attr.data-automation-id]="taskFilterProperty.key">
|
[attr.data-automation-id]="taskFilterProperty.key">
|
||||||
<mat-select placeholder="{{taskFilterProperty.label | translate}}"
|
<mat-select placeholder="{{taskFilterProperty.label | translate}}"
|
||||||
[formControlName]="taskFilterProperty.key"
|
[formControlName]="taskFilterProperty.key"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field fxFlex="23%"
|
<mat-form-field fxFlex="23%"
|
||||||
*ngIf="isTextType(taskFilterProperty)"
|
*ngIf="taskFilterProperty.type === 'text'"
|
||||||
[attr.data-automation-id]="taskFilterProperty.key">
|
[attr.data-automation-id]="taskFilterProperty.key">
|
||||||
<input matInput
|
<input matInput
|
||||||
[formControlName]="taskFilterProperty.key"
|
[formControlName]="taskFilterProperty.key"
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
[attr.data-automation-id]="'adf-cloud-edit-task-property-' + taskFilterProperty.key" />
|
[attr.data-automation-id]="'adf-cloud-edit-task-property-' + taskFilterProperty.key" />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field fxFlex="23%"
|
<mat-form-field fxFlex="23%"
|
||||||
*ngIf="isDateType(taskFilterProperty)"
|
*ngIf="taskFilterProperty.type === 'date'"
|
||||||
[attr.data-automation-id]="taskFilterProperty.key">
|
[attr.data-automation-id]="taskFilterProperty.key">
|
||||||
<mat-label>{{taskFilterProperty.label | translate}}</mat-label>
|
<mat-label>{{taskFilterProperty.label | translate}}</mat-label>
|
||||||
<input matInput
|
<input matInput
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
(dateChange)="onDateChanged($event.value, taskFilterProperty)"
|
(dateChange)="onDateChanged($event.value, taskFilterProperty)"
|
||||||
[matDatepicker]="dateController"
|
[matDatepicker]="dateController"
|
||||||
placeholder="{{taskFilterProperty.label | translate}}"
|
placeholder="{{taskFilterProperty.label | translate}}"
|
||||||
[attr.data-automation-id]="'adf-cloud-edit-task-`perty-' + taskFilterProperty.key">
|
[attr.data-automation-id]="'adf-cloud-edit-task-property-' + taskFilterProperty.key">
|
||||||
<mat-datepicker-toggle matSuffix
|
<mat-datepicker-toggle matSuffix
|
||||||
[for]="dateController"
|
[for]="dateController"
|
||||||
[attr.data-automation-id]="'adf-cloud-edit-task-property-date-toggle-' + taskFilterProperty.key">
|
[attr.data-automation-id]="'adf-cloud-edit-task-property-date-toggle-' + taskFilterProperty.key">
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div class="adf-edit-task-filter-checkbox"
|
<div class="adf-edit-task-filter-checkbox"
|
||||||
*ngIf="isCheckBoxType(taskFilterProperty)">
|
*ngIf="taskFilterProperty.type === 'checkbox'">
|
||||||
<mat-checkbox color="primary"
|
<mat-checkbox color="primary"
|
||||||
[formControlName]="taskFilterProperty.key"
|
[formControlName]="taskFilterProperty.key"
|
||||||
[attr.data-automation-id]="taskFilterProperty.key">
|
[attr.data-automation-id]="taskFilterProperty.key">
|
||||||
@@ -95,14 +95,14 @@
|
|||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<adf-cloud-date-range-filter *ngIf="isDateRangeType(taskFilterProperty)"
|
<adf-cloud-date-range-filter *ngIf="taskFilterProperty.type === 'date-range'"
|
||||||
[processFilterProperty]="taskFilterProperty"
|
[processFilterProperty]="taskFilterProperty"
|
||||||
[options]="taskFilterProperty.dateFilterOptions"
|
[options]="taskFilterProperty.dateFilterOptions"
|
||||||
(dateTypeChange)="onDateTypeChange($event, taskFilterProperty)"
|
(dateTypeChange)="onDateTypeChange($event, taskFilterProperty)"
|
||||||
(dateChanged)="onDateRangeFilterChanged($event, taskFilterProperty)">
|
(dateChanged)="onDateRangeFilterChanged($event, taskFilterProperty)">
|
||||||
</adf-cloud-date-range-filter>
|
</adf-cloud-date-range-filter>
|
||||||
|
|
||||||
<div fxFlex="23%" class="{{ 'adf-edit-task-filter-' + taskFilterProperty.key }}" *ngIf="isUserSelectType(taskFilterProperty)">
|
<div fxFlex="23%" class="{{ 'adf-edit-task-filter-' + taskFilterProperty.key }}" *ngIf="taskFilterProperty.type === 'people'">
|
||||||
<adf-cloud-people
|
<adf-cloud-people
|
||||||
[preSelectUsers]="taskFilterProperty.value"
|
[preSelectUsers]="taskFilterProperty.value"
|
||||||
[title]="taskFilterProperty.label"
|
[title]="taskFilterProperty.label"
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<adf-cloud-task-assignment-filter
|
<adf-cloud-task-assignment-filter
|
||||||
*ngIf="isAssignmentType(taskFilterProperty)"
|
*ngIf="taskFilterProperty.type === 'assignment'"
|
||||||
[taskFilterProperty]="taskFilterProperty"
|
[taskFilterProperty]="taskFilterProperty"
|
||||||
(assignedChange)="onAssignedChange($event)"
|
(assignedChange)="onAssignedChange($event)"
|
||||||
(assignedGroupChange)="onAssignedGroupsChange($event)"></adf-cloud-task-assignment-filter>
|
(assignedGroupChange)="onAssignedGroupsChange($event)"></adf-cloud-task-assignment-filter>
|
||||||
|
@@ -20,18 +20,19 @@ import { FilterOptions, TaskFilterAction, TaskFilterProperties } from '../../mod
|
|||||||
import { TaskCloudService } from './../../../services/task-cloud.service';
|
import { TaskCloudService } from './../../../services/task-cloud.service';
|
||||||
import { AppsProcessCloudService } from './../../../../app/services/apps-process-cloud.service';
|
import { AppsProcessCloudService } from './../../../../app/services/apps-process-cloud.service';
|
||||||
import { ApplicationInstanceModel } from './../../../../app/models/application-instance.model';
|
import { ApplicationInstanceModel } from './../../../../app/models/application-instance.model';
|
||||||
import { ProcessDefinitionCloud } from './../../../../models/process-definition-cloud.model';
|
|
||||||
import { DateCloudFilterType, DateRangeFilter } from '../../../../models/date-cloud-filter.model';
|
import { DateCloudFilterType, DateRangeFilter } from '../../../../models/date-cloud-filter.model';
|
||||||
import moment, { Moment } from 'moment';
|
import moment, { Moment } from 'moment';
|
||||||
import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms';
|
import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms';
|
||||||
import { debounceTime, filter, takeUntil } from 'rxjs/operators';
|
import { debounceTime, filter, finalize, switchMap, takeUntil } from 'rxjs/operators';
|
||||||
import { Subject } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { DateAdapter } from '@angular/material/core';
|
import { DateAdapter } from '@angular/material/core';
|
||||||
import { IdentityGroupModel, IdentityUserModel, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
import { IdentityGroupModel, IdentityUserModel, TranslationService, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||||
|
import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
// tslint:disable-next-line: directive-class-suffix
|
// tslint:disable-next-line: directive-class-suffix
|
||||||
export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestroy {
|
export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnChanges, OnDestroy {
|
||||||
|
|
||||||
public static ACTION_SAVE = 'save';
|
public static ACTION_SAVE = 'save';
|
||||||
public static ACTION_SAVE_AS = 'saveAs';
|
public static ACTION_SAVE_AS = 'saveAs';
|
||||||
@@ -91,7 +92,7 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
|
|
||||||
/** Emitted when a filter action occurs (i.e Save, Save As, Delete). */
|
/** Emitted when a filter action occurs (i.e Save, Save As, Delete). */
|
||||||
@Output()
|
@Output()
|
||||||
action: EventEmitter<TaskFilterAction> = new EventEmitter();
|
action = new EventEmitter<TaskFilterAction>();
|
||||||
|
|
||||||
protected applicationNames: any[] = [];
|
protected applicationNames: any[] = [];
|
||||||
protected processDefinitionNames: any[] = [];
|
protected processDefinitionNames: any[] = [];
|
||||||
@@ -102,6 +103,13 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
toggleFilterActions: boolean = false;
|
toggleFilterActions: boolean = false;
|
||||||
allProcessDefinitionNamesOption = { label: 'All', value: '' };
|
allProcessDefinitionNamesOption = { label: 'All', value: '' };
|
||||||
|
|
||||||
|
taskFilter: T;
|
||||||
|
changedTaskFilter: T;
|
||||||
|
|
||||||
|
/** Emitted when a task filter property changes. */
|
||||||
|
@Output()
|
||||||
|
filterChange = new EventEmitter<T>();
|
||||||
|
|
||||||
protected onDestroy$ = new Subject<boolean>();
|
protected onDestroy$ = new Subject<boolean>();
|
||||||
isLoading: boolean = false;
|
isLoading: boolean = false;
|
||||||
|
|
||||||
@@ -110,7 +118,9 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
protected dateAdapter: DateAdapter<Moment>,
|
protected dateAdapter: DateAdapter<Moment>,
|
||||||
protected userPreferencesService: UserPreferencesService,
|
protected userPreferencesService: UserPreferencesService,
|
||||||
protected appsProcessCloudService: AppsProcessCloudService,
|
protected appsProcessCloudService: AppsProcessCloudService,
|
||||||
protected taskCloudService: TaskCloudService) {
|
protected taskCloudService: TaskCloudService,
|
||||||
|
protected dialog: MatDialog,
|
||||||
|
protected translateService: TranslationService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -134,21 +144,21 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
|
|
||||||
createFilterActions(): TaskFilterAction[] {
|
createFilterActions(): TaskFilterAction[] {
|
||||||
return [
|
return [
|
||||||
new TaskFilterAction({
|
{
|
||||||
actionType: BaseEditTaskFilterCloudComponent.ACTION_SAVE,
|
actionType: BaseEditTaskFilterCloudComponent.ACTION_SAVE,
|
||||||
icon: 'save',
|
icon: 'save',
|
||||||
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.SAVE'
|
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.SAVE'
|
||||||
}),
|
},
|
||||||
new TaskFilterAction({
|
{
|
||||||
actionType: BaseEditTaskFilterCloudComponent.ACTION_SAVE_AS,
|
actionType: BaseEditTaskFilterCloudComponent.ACTION_SAVE_AS,
|
||||||
icon: 'adf:save-as',
|
icon: 'adf:save-as',
|
||||||
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.SAVE_AS'
|
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.SAVE_AS'
|
||||||
}),
|
},
|
||||||
new TaskFilterAction({
|
{
|
||||||
actionType: BaseEditTaskFilterCloudComponent.ACTION_DELETE,
|
actionType: BaseEditTaskFilterCloudComponent.ACTION_DELETE,
|
||||||
icon: 'delete',
|
icon: 'delete',
|
||||||
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.DELETE'
|
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.DELETE'
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,36 +184,12 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
this.toggleFilterActions = false;
|
this.toggleFilterActions = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isDateType(property: TaskFilterProperties): boolean {
|
|
||||||
return property.type === 'date';
|
|
||||||
}
|
|
||||||
|
|
||||||
isDateRangeType(property: TaskFilterProperties): boolean {
|
|
||||||
return property.type === 'date-range';
|
|
||||||
}
|
|
||||||
|
|
||||||
isUserSelectType(property: TaskFilterProperties): boolean {
|
|
||||||
return property.type === 'people';
|
|
||||||
}
|
|
||||||
|
|
||||||
isSelectType(property: TaskFilterProperties): boolean {
|
|
||||||
return property.type === 'select';
|
|
||||||
}
|
|
||||||
|
|
||||||
isTextType(property: TaskFilterProperties): boolean {
|
|
||||||
return property.type === 'text';
|
|
||||||
}
|
|
||||||
|
|
||||||
isCheckBoxType(property: TaskFilterProperties): boolean {
|
|
||||||
return property.type === 'checkbox';
|
|
||||||
}
|
|
||||||
|
|
||||||
isDisabledAction(action: TaskFilterAction): boolean {
|
isDisabledAction(action: TaskFilterAction): boolean {
|
||||||
return this.isDisabledForDefaultFilters(action) ? true : this.hasFormChanged(action);
|
return this.isDisabledForDefaultFilters(action) ? true : this.hasFormChanged(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
isAssignmentType(property: TaskFilterProperties): boolean {
|
protected deepCompare(left: any, right: any): boolean {
|
||||||
return property.type === 'assignment';
|
return JSON.stringify(left).toLowerCase() === JSON.stringify(right).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,11 +201,7 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
return nameWithHyphen.toLowerCase();
|
return nameWithHyphen.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private replaceSpaceWithHyphen(name: string): string {
|
||||||
* Return name with hyphen
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
replaceSpaceWithHyphen(name: string): string {
|
|
||||||
const regExt = new RegExp(' ', 'g');
|
const regExt = new RegExp(' ', 'g');
|
||||||
return name.replace(regExt, '-');
|
return name.replace(regExt, '-');
|
||||||
}
|
}
|
||||||
@@ -237,7 +219,6 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
getRunningApplications() {
|
getRunningApplications() {
|
||||||
this.appsProcessCloudService
|
this.appsProcessCloudService
|
||||||
.getDeployedApplicationsByStatus(BaseEditTaskFilterCloudComponent.APP_RUNNING_STATUS, this.role)
|
.getDeployedApplicationsByStatus(BaseEditTaskFilterCloudComponent.APP_RUNNING_STATUS, this.role)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
|
||||||
.subscribe((applications: ApplicationInstanceModel[]) => {
|
.subscribe((applications: ApplicationInstanceModel[]) => {
|
||||||
if (applications && applications.length > 0) {
|
if (applications && applications.length > 0) {
|
||||||
applications.map((application) => {
|
applications.map((application) => {
|
||||||
@@ -249,8 +230,7 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
|
|
||||||
getProcessDefinitions() {
|
getProcessDefinitions() {
|
||||||
this.taskCloudService.getProcessDefinitions(this.appName)
|
this.taskCloudService.getProcessDefinitions(this.appName)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.subscribe((processDefinitions) => {
|
||||||
.subscribe((processDefinitions: ProcessDefinitionCloud[]) => {
|
|
||||||
if (processDefinitions && processDefinitions.length > 0) {
|
if (processDefinitions && processDefinitions.length > 0) {
|
||||||
this.processDefinitionNames.push(this.allProcessDefinitionNamesOption);
|
this.processDefinitionNames.push(this.allProcessDefinitionNamesOption);
|
||||||
processDefinitions.map((processDefinition) => {
|
processDefinitions.map((processDefinition) => {
|
||||||
@@ -281,12 +261,13 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
onDateChanged(newDateValue: any, dateProperty: TaskFilterProperties) {
|
onDateChanged(newDateValue: any, dateProperty: TaskFilterProperties) {
|
||||||
if (newDateValue) {
|
if (newDateValue) {
|
||||||
const momentDate = moment(newDateValue, BaseEditTaskFilterCloudComponent.FORMAT_DATE, true);
|
const momentDate = moment(newDateValue, BaseEditTaskFilterCloudComponent.FORMAT_DATE, true);
|
||||||
|
const controller = this.getPropertyController(dateProperty);
|
||||||
|
|
||||||
if (momentDate.isValid()) {
|
if (momentDate.isValid()) {
|
||||||
this.getPropertyController(dateProperty).setValue(momentDate.toISOString(true));
|
controller.setValue(momentDate.toISOString(true));
|
||||||
this.getPropertyController(dateProperty).setErrors(null);
|
controller.setErrors(null);
|
||||||
} else {
|
} else {
|
||||||
this.getPropertyController(dateProperty).setErrors({ invalid: true });
|
controller.setErrors({ invalid: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,7 +302,8 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasError(property: TaskFilterProperties): boolean {
|
hasError(property: TaskFilterProperties): boolean {
|
||||||
return this.getPropertyController(property).errors && this.getPropertyController(property).errors.invalid;
|
const controller = this.getPropertyController(property);
|
||||||
|
return controller.errors && controller.errors.invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasLastModifiedProperty(): boolean {
|
hasLastModifiedProperty(): boolean {
|
||||||
@@ -330,10 +312,10 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
|
|
||||||
get createSortProperties(): FilterOptions[] {
|
get createSortProperties(): FilterOptions[] {
|
||||||
this.checkMandatorySortProperties();
|
this.checkMandatorySortProperties();
|
||||||
const sortProperties = this.sortProperties.map((property: string) => {
|
|
||||||
return <FilterOptions> { label: property.charAt(0).toUpperCase() + property.slice(1), value: property };
|
return this.sortProperties.map((property: string) => {
|
||||||
|
return { label: property.charAt(0).toUpperCase() + property.slice(1), value: property };
|
||||||
});
|
});
|
||||||
return sortProperties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createAndFilterActions(): TaskFilterAction[] {
|
createAndFilterActions(): TaskFilterAction[] {
|
||||||
@@ -341,8 +323,8 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
return this.createFilterActions().filter(action => this.isValidAction(this.actions, action));
|
return this.createFilterActions().filter(action => this.isValidAction(this.actions, action));
|
||||||
}
|
}
|
||||||
|
|
||||||
isValidProperty(filterProperties: string[], filterProperty: any): boolean {
|
isValidProperty(filterProperties: string[], key: string): boolean {
|
||||||
return filterProperties ? filterProperties.indexOf(filterProperty.key) >= 0 : true;
|
return filterProperties ? filterProperties.indexOf(key) >= 0 : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForProperty(property: string): boolean {
|
checkForProperty(property: string): boolean {
|
||||||
@@ -373,7 +355,7 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultProperties = this.createTaskFilterProperties();
|
const defaultProperties = this.createTaskFilterProperties();
|
||||||
let filteredProperties = defaultProperties.filter((filterProperty: TaskFilterProperties) => this.isValidProperty(this.filterProperties, filterProperty));
|
let filteredProperties = defaultProperties.filter((filterProperty) => this.isValidProperty(this.filterProperties, filterProperty.key));
|
||||||
|
|
||||||
if (!this.hasSortProperty()) {
|
if (!this.hasSortProperty()) {
|
||||||
filteredProperties = this.removeOrderProperty(filteredProperties);
|
filteredProperties = this.removeOrderProperty(filteredProperties);
|
||||||
@@ -398,7 +380,7 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFormControlsConfig(taskFilterProperties: TaskFilterProperties[]): any {
|
getFormControlsConfig(taskFilterProperties: TaskFilterProperties[]): any {
|
||||||
const properties = taskFilterProperties.map((property: TaskFilterProperties) => {
|
const properties = taskFilterProperties.map((property) => {
|
||||||
if (!!property.attributes) {
|
if (!!property.attributes) {
|
||||||
return this.getAttributesControlConfig(property);
|
return this.getAttributesControlConfig(property);
|
||||||
} else {
|
} else {
|
||||||
@@ -425,14 +407,93 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnChan
|
|||||||
this.editTaskFilterForm.get(property.attributes.dateType).setValue(dateType);
|
this.editTaskFilterForm.get(property.attributes.dateType).setValue(dateType);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract save(action: TaskFilterAction): void;
|
protected retrieveTaskFilterAndBuildForm() {
|
||||||
abstract saveAs(action: TaskFilterAction): void;
|
this.isLoading = true;
|
||||||
abstract delete(action: TaskFilterAction): void;
|
|
||||||
abstract checkMandatorySortProperties(): void;
|
this.getTaskFilterById(this.appName, this.id)
|
||||||
abstract checkMandatoryFilterProperties(): void;
|
.pipe(
|
||||||
|
finalize(() => this.isLoading = false),
|
||||||
|
takeUntil(this.onDestroy$)
|
||||||
|
)
|
||||||
|
.subscribe(response => {
|
||||||
|
this.taskFilter = response;
|
||||||
|
this.taskFilterProperties = this.createAndFilterProperties();
|
||||||
|
this.taskFilterActions = this.createAndFilterActions();
|
||||||
|
this.buildForm(this.taskFilterProperties);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(deleteAction: TaskFilterAction): void {
|
||||||
|
this.deleteFilter(this.taskFilter)
|
||||||
|
.pipe(
|
||||||
|
filter((filters) => {
|
||||||
|
deleteAction.filter = this.taskFilter;
|
||||||
|
this.action.emit(deleteAction);
|
||||||
|
return filters.length === 0;
|
||||||
|
}),
|
||||||
|
switchMap(() => this.restoreDefaultTaskFilters()),
|
||||||
|
takeUntil(this.onDestroy$))
|
||||||
|
.subscribe(() => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
save(saveAction: TaskFilterAction): void {
|
||||||
|
this.updateFilter(this.changedTaskFilter)
|
||||||
|
.pipe(takeUntil(this.onDestroy$))
|
||||||
|
.subscribe(() => {
|
||||||
|
saveAction.filter = this.changedTaskFilter;
|
||||||
|
this.action.emit(saveAction);
|
||||||
|
this.formHasBeenChanged = this.deepCompare(this.changedTaskFilter, this.taskFilter);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
saveAs(saveAsAction: TaskFilterAction): void {
|
||||||
|
const dialogRef = this.dialog.open(TaskFilterDialogCloudComponent, {
|
||||||
|
data: {
|
||||||
|
name: this.translateService.instant((this.taskFilter as any)?.name)
|
||||||
|
},
|
||||||
|
height: 'auto',
|
||||||
|
minWidth: '30%'
|
||||||
|
});
|
||||||
|
dialogRef.afterClosed().subscribe((result) => {
|
||||||
|
if (result && result.action === TaskFilterDialogCloudComponent.ACTION_SAVE) {
|
||||||
|
const filterId = Math.random().toString(36).substr(2, 9);
|
||||||
|
const filterKey = this.getSanitizeFilterName(result.name);
|
||||||
|
const newFilter = {
|
||||||
|
name: result.name,
|
||||||
|
icon: result.icon,
|
||||||
|
id: filterId,
|
||||||
|
key: 'custom-' + filterKey
|
||||||
|
};
|
||||||
|
const resultFilter: T = Object.assign({}, this.changedTaskFilter, newFilter);
|
||||||
|
this.addFilter(resultFilter).subscribe(() => {
|
||||||
|
saveAsAction.filter = resultFilter;
|
||||||
|
this.action.emit(saveAsAction);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
checkMandatoryFilterProperties() {
|
||||||
|
if (this.filterProperties === undefined || this.filterProperties.length === 0) {
|
||||||
|
this.filterProperties = this.getDefaultFilterProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkMandatorySortProperties(): void {
|
||||||
|
if (this.sortProperties === undefined || this.sortProperties.length === 0) {
|
||||||
|
this.sortProperties = this.getDefaultSortProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract getDefaultFilterProperties(): string[];
|
||||||
|
abstract getDefaultSortProperties(): string[];
|
||||||
abstract isDisabledForDefaultFilters(action: TaskFilterAction): boolean;
|
abstract isDisabledForDefaultFilters(action: TaskFilterAction): boolean;
|
||||||
abstract createTaskFilterProperties(): TaskFilterProperties[];
|
abstract createTaskFilterProperties(): TaskFilterProperties[];
|
||||||
abstract retrieveTaskFilterAndBuildForm(): void;
|
protected abstract getTaskFilterById(appName: string, id: string);
|
||||||
abstract assignNewFilter(formValues): void;
|
abstract assignNewFilter(formValues): void;
|
||||||
|
|
||||||
|
protected abstract restoreDefaultTaskFilters(): Observable<T[]>;
|
||||||
|
protected abstract addFilter(filterToAdd: T): Observable<any>;
|
||||||
|
protected abstract deleteFilter(filterToDelete: T): Observable<T[]>;
|
||||||
|
protected abstract updateFilter(filterToUpdate: T): Observable<any>;
|
||||||
}
|
}
|
||||||
|
@@ -15,16 +15,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Output, EventEmitter } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { DateAdapter } from '@angular/material/core';
|
import { DateAdapter } from '@angular/material/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { filter, takeUntil, finalize, switchMap } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Moment } from 'moment';
|
import { Moment } from 'moment';
|
||||||
|
|
||||||
import { TaskFilterProperties, TaskFilterAction, ServiceTaskFilterCloudModel } from '../../models/filter-cloud.model';
|
import { TaskFilterProperties, TaskFilterAction, ServiceTaskFilterCloudModel } from '../../models/filter-cloud.model';
|
||||||
import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component';
|
|
||||||
import { TranslationService, UserPreferencesService } from '@alfresco/adf-core';
|
import { TranslationService, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
|
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
|
||||||
import { TaskCloudService } from '../../../services/task-cloud.service';
|
import { TaskCloudService } from '../../../services/task-cloud.service';
|
||||||
@@ -36,135 +35,49 @@ import { BaseEditTaskFilterCloudComponent } from './base-edit-task-filter-cloud.
|
|||||||
templateUrl: './base-edit-task-filter-cloud.component.html',
|
templateUrl: './base-edit-task-filter-cloud.component.html',
|
||||||
styleUrls: ['./base-edit-task-filter-cloud.component.scss']
|
styleUrls: ['./base-edit-task-filter-cloud.component.scss']
|
||||||
})
|
})
|
||||||
export class EditServiceTaskFilterCloudComponent extends BaseEditTaskFilterCloudComponent {
|
export class EditServiceTaskFilterCloudComponent extends BaseEditTaskFilterCloudComponent<ServiceTaskFilterCloudModel> {
|
||||||
|
|
||||||
public static DEFAULT_TASK_FILTER_PROPERTIES = ['appName', 'activityName', 'status', 'sort', 'order'];
|
|
||||||
public static DEFAULT_TASK_SORT_PROPERTIES = ['id', 'activityName', 'startedDate', 'completedDate'];
|
|
||||||
public static DEFAULT_TASK_STATUS_PROPERTIES = [
|
|
||||||
{ label: 'ALL', value: '' },
|
|
||||||
{ label: 'STARTED', value: 'STARTED' },
|
|
||||||
{ label: 'COMPLETED', value: 'COMPLETED' },
|
|
||||||
{ label: 'CANCELLED', value: 'CANCELLED' },
|
|
||||||
{ label: 'ERROR', value: 'ERROR' }
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Emitted when a task filter property changes. */
|
|
||||||
@Output()
|
|
||||||
filterChange: EventEmitter<ServiceTaskFilterCloudModel> = new EventEmitter();
|
|
||||||
|
|
||||||
taskFilter: ServiceTaskFilterCloudModel;
|
|
||||||
changedTaskFilter: ServiceTaskFilterCloudModel;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected formBuilder: FormBuilder,
|
formBuilder: FormBuilder,
|
||||||
public dialog: MatDialog,
|
dialog: MatDialog,
|
||||||
private translateService: TranslationService,
|
translateService: TranslationService,
|
||||||
private serviceTaskFilterCloudService: ServiceTaskFilterCloudService,
|
private serviceTaskFilterCloudService: ServiceTaskFilterCloudService,
|
||||||
protected dateAdapter: DateAdapter<Moment>,
|
dateAdapter: DateAdapter<Moment>,
|
||||||
protected userPreferencesService: UserPreferencesService,
|
userPreferencesService: UserPreferencesService,
|
||||||
protected appsProcessCloudService: AppsProcessCloudService,
|
appsProcessCloudService: AppsProcessCloudService,
|
||||||
protected taskCloudService: TaskCloudService) {
|
taskCloudService: TaskCloudService) {
|
||||||
super(formBuilder, dateAdapter, userPreferencesService, appsProcessCloudService, taskCloudService);
|
super(formBuilder, dateAdapter, userPreferencesService, appsProcessCloudService, taskCloudService, dialog, translateService);
|
||||||
}
|
}
|
||||||
|
|
||||||
assignNewFilter(formValues: ServiceTaskFilterCloudModel) {
|
assignNewFilter(model: ServiceTaskFilterCloudModel) {
|
||||||
this.changedTaskFilter = Object.assign({}, this.taskFilter, formValues) as ServiceTaskFilterCloudModel;
|
this.changedTaskFilter = { ...this.taskFilter, ...model };
|
||||||
this.formHasBeenChanged = !this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
this.formHasBeenChanged = !this.deepCompare(this.changedTaskFilter, this.taskFilter);
|
||||||
this.filterChange.emit(this.changedTaskFilter);
|
this.filterChange.emit(this.changedTaskFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected getTaskFilterById(appName: string, id: string) {
|
||||||
* Fetches task filter by application name and filter id and creates filter properties, build form
|
return this.serviceTaskFilterCloudService.getTaskFilterById(appName, id);
|
||||||
*/
|
|
||||||
retrieveTaskFilterAndBuildForm() {
|
|
||||||
this.isLoading = true;
|
|
||||||
this.serviceTaskFilterCloudService.getTaskFilterById(this.appName, this.id)
|
|
||||||
.pipe(
|
|
||||||
finalize(() => this.isLoading = false),
|
|
||||||
takeUntil(this.onDestroy$)
|
|
||||||
)
|
|
||||||
.subscribe(response => {
|
|
||||||
this.taskFilter = response as ServiceTaskFilterCloudModel;
|
|
||||||
this.taskFilterProperties = this.createAndFilterProperties();
|
|
||||||
this.taskFilterActions = this.createAndFilterActions();
|
|
||||||
this.buildForm(this.taskFilterProperties);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkMandatoryFilterProperties() {
|
getDefaultFilterProperties(): string[] {
|
||||||
if (this.filterProperties === undefined || this.filterProperties.length === 0) {
|
return ['appName', 'activityName', 'status', 'sort', 'order'];
|
||||||
this.filterProperties = EditServiceTaskFilterCloudComponent.DEFAULT_TASK_FILTER_PROPERTIES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkMandatorySortProperties(): void {
|
getDefaultSortProperties(): string[] {
|
||||||
if (this.sortProperties === undefined || this.sortProperties.length === 0) {
|
return ['id', 'activityName', 'startedDate', 'completedDate'];
|
||||||
this.sortProperties = EditServiceTaskFilterCloudComponent.DEFAULT_TASK_SORT_PROPERTIES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected updateFilter(filterToUpdate: ServiceTaskFilterCloudModel) {
|
||||||
* Return true if both filters are same
|
return this.serviceTaskFilterCloudService.updateFilter(filterToUpdate);
|
||||||
* @param editedQuery, @param currentQuery
|
|
||||||
*/
|
|
||||||
compareFilters(
|
|
||||||
editedQuery: ServiceTaskFilterCloudModel,
|
|
||||||
currentQuery: ServiceTaskFilterCloudModel
|
|
||||||
): boolean {
|
|
||||||
return JSON.stringify(editedQuery).toLowerCase() === JSON.stringify(currentQuery).toLowerCase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save(saveAction: TaskFilterAction): void {
|
protected deleteFilter(filterToDelete: ServiceTaskFilterCloudModel): Observable<ServiceTaskFilterCloudModel[]> {
|
||||||
this.serviceTaskFilterCloudService
|
return this.serviceTaskFilterCloudService.deleteFilter(filterToDelete);
|
||||||
.updateFilter(this.changedTaskFilter)
|
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
|
||||||
.subscribe(() => {
|
|
||||||
saveAction.filter = this.changedTaskFilter;
|
|
||||||
this.action.emit(saveAction);
|
|
||||||
this.formHasBeenChanged = this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(deleteAction: TaskFilterAction): void {
|
protected addFilter(filterToAdd: ServiceTaskFilterCloudModel): Observable<any> {
|
||||||
this.serviceTaskFilterCloudService
|
return this.serviceTaskFilterCloudService
|
||||||
.deleteFilter(this.taskFilter)
|
.addFilter(filterToAdd)
|
||||||
.pipe(
|
.pipe(takeUntil(this.onDestroy$));
|
||||||
filter((filters) => {
|
|
||||||
deleteAction.filter = this.taskFilter;
|
|
||||||
this.action.emit(deleteAction);
|
|
||||||
return filters.length === 0;
|
|
||||||
}),
|
|
||||||
switchMap(() => this.restoreDefaultTaskFilters()),
|
|
||||||
takeUntil(this.onDestroy$))
|
|
||||||
.subscribe(() => { });
|
|
||||||
}
|
|
||||||
|
|
||||||
saveAs(saveAsAction: TaskFilterAction): void {
|
|
||||||
const dialogRef = this.dialog.open(TaskFilterDialogCloudComponent, {
|
|
||||||
data: {
|
|
||||||
name: this.translateService.instant(this.taskFilter.name)
|
|
||||||
},
|
|
||||||
height: 'auto',
|
|
||||||
minWidth: '30%'
|
|
||||||
});
|
|
||||||
dialogRef.afterClosed().subscribe((result) => {
|
|
||||||
if (result && result.action === TaskFilterDialogCloudComponent.ACTION_SAVE) {
|
|
||||||
const filterId = Math.random().toString(36).substr(2, 9);
|
|
||||||
const filterKey = this.getSanitizeFilterName(result.name);
|
|
||||||
const newFilter = {
|
|
||||||
name: result.name,
|
|
||||||
icon: result.icon,
|
|
||||||
id: filterId,
|
|
||||||
key: 'custom-' + filterKey
|
|
||||||
};
|
|
||||||
const resultFilter: ServiceTaskFilterCloudModel = Object.assign({}, this.changedTaskFilter, newFilter);
|
|
||||||
this.serviceTaskFilterCloudService.addFilter(resultFilter)
|
|
||||||
.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
|
||||||
saveAsAction.filter = resultFilter;
|
|
||||||
this.action.emit(saveAsAction);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isDisabledForDefaultFilters(action: TaskFilterAction): boolean {
|
isDisabledForDefaultFilters(action: TaskFilterAction): boolean {
|
||||||
@@ -178,90 +91,100 @@ export class EditServiceTaskFilterCloudComponent extends BaseEditTaskFilterCloud
|
|||||||
return this.serviceTaskFilterCloudService.getTaskListFilters(this.appName);
|
return this.serviceTaskFilterCloudService.getTaskListFilters(this.appName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getDefaultProperties() {
|
||||||
|
return [
|
||||||
|
{ label: 'ALL', value: '' },
|
||||||
|
{ label: 'STARTED', value: 'STARTED' },
|
||||||
|
{ label: 'COMPLETED', value: 'COMPLETED' },
|
||||||
|
{ label: 'CANCELLED', value: 'CANCELLED' },
|
||||||
|
{ label: 'ERROR', value: 'ERROR' }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
createTaskFilterProperties(): TaskFilterProperties[] {
|
createTaskFilterProperties(): TaskFilterProperties[] {
|
||||||
return [
|
return [
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.APP_NAME',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.APP_NAME',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'appName',
|
key: 'appName',
|
||||||
value: this.taskFilter.appName || '',
|
value: this.taskFilter.appName || '',
|
||||||
options: this.applicationNames
|
options: this.applicationNames
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.SERVICE_TASK_ID',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.SERVICE_TASK_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'serviceTaskId',
|
key: 'serviceTaskId',
|
||||||
value: this.taskFilter.serviceTaskId || ''
|
value: this.taskFilter.serviceTaskId || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.ELEMENT_ID',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.ELEMENT_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'elementId',
|
key: 'elementId',
|
||||||
value: this.taskFilter.elementId || ''
|
value: this.taskFilter.elementId || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.ACTIVITY_NAME',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.ACTIVITY_NAME',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'activityName',
|
key: 'activityName',
|
||||||
value: this.taskFilter.activityName || ''
|
value: this.taskFilter.activityName || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.ACTIVITY_TYPE',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.ACTIVITY_TYPE',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'activityType',
|
key: 'activityType',
|
||||||
value: this.taskFilter.activityType || ''
|
value: this.taskFilter.activityType || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.SORT',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.SORT',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'sort',
|
key: 'sort',
|
||||||
value: this.taskFilter.sort || this.createSortProperties[0].value,
|
value: this.taskFilter.sort || this.createSortProperties[0].value,
|
||||||
options: this.createSortProperties
|
options: this.createSortProperties
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.DIRECTION',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.DIRECTION',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'order',
|
key: 'order',
|
||||||
value: this.taskFilter.order || EditServiceTaskFilterCloudComponent.DIRECTIONS[0].value,
|
value: this.taskFilter.order || EditServiceTaskFilterCloudComponent.DIRECTIONS[0].value,
|
||||||
options: EditServiceTaskFilterCloudComponent.DIRECTIONS
|
options: EditServiceTaskFilterCloudComponent.DIRECTIONS
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.STATUS',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.STATUS',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'status',
|
key: 'status',
|
||||||
value: this.taskFilter.status || EditServiceTaskFilterCloudComponent.DEFAULT_TASK_STATUS_PROPERTIES[0].value,
|
value: this.taskFilter.status || this.getDefaultProperties()[0].value,
|
||||||
options: EditServiceTaskFilterCloudComponent.DEFAULT_TASK_STATUS_PROPERTIES
|
options: this.getDefaultProperties()
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.STARTED_DATE',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.STARTED_DATE',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
key: 'startedDate',
|
key: 'startedDate',
|
||||||
value: this.taskFilter.completedDate || false
|
value: this.taskFilter.completedDate || false
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.COMPLETED_DATE',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.COMPLETED_DATE',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
key: 'completedDate',
|
key: 'completedDate',
|
||||||
value: this.taskFilter.completedDate || false
|
value: this.taskFilter.completedDate || false
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.PROCESS_INSTANCE_ID',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.PROCESS_INSTANCE_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'processInstanceId',
|
key: 'processInstanceId',
|
||||||
value: this.taskFilter.processInstanceId || ''
|
value: this.taskFilter.processInstanceId || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.PROCESS_DEF_ID',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.PROCESS_DEF_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'processDefinitionId',
|
key: 'processDefinitionId',
|
||||||
value: this.taskFilter.processDefinitionId || ''
|
value: this.taskFilter.processDefinitionId || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.SERVICE_NAME',
|
label: 'ADF_CLOUD_EDIT_SERVICE_TASK_FILTER.LABEL.SERVICE_NAME',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'serviceName',
|
key: 'serviceName',
|
||||||
value: this.taskFilter.serviceName || ''
|
value: this.taskFilter.serviceName || ''
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,18 +15,17 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Output, EventEmitter } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { DateAdapter } from '@angular/material/core';
|
import { DateAdapter } from '@angular/material/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { filter, takeUntil, finalize, switchMap } from 'rxjs/operators';
|
import { takeUntil, map } from 'rxjs/operators';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import moment from 'moment-es6';
|
import moment from 'moment-es6';
|
||||||
import { Moment } from 'moment';
|
import { Moment } from 'moment';
|
||||||
|
|
||||||
import { TaskFilterCloudModel, TaskFilterProperties, TaskFilterAction } from '../../models/filter-cloud.model';
|
import { TaskFilterCloudModel, TaskFilterProperties, TaskFilterAction } from '../../models/filter-cloud.model';
|
||||||
import { TaskFilterCloudService } from '../../services/task-filter-cloud.service';
|
import { TaskFilterCloudService } from '../../services/task-filter-cloud.service';
|
||||||
import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component';
|
|
||||||
import { TranslationService, UserPreferencesService } from '@alfresco/adf-core';
|
import { TranslationService, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
|
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
|
||||||
import { DateCloudFilterType } from '../../../../models/date-cloud-filter.model';
|
import { DateCloudFilterType } from '../../../../models/date-cloud-filter.model';
|
||||||
@@ -38,76 +37,53 @@ import { BaseEditTaskFilterCloudComponent } from './base-edit-task-filter-cloud.
|
|||||||
templateUrl: './base-edit-task-filter-cloud.component.html',
|
templateUrl: './base-edit-task-filter-cloud.component.html',
|
||||||
styleUrls: ['./base-edit-task-filter-cloud.component.scss']
|
styleUrls: ['./base-edit-task-filter-cloud.component.scss']
|
||||||
})
|
})
|
||||||
export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudComponent {
|
export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudComponent<TaskFilterCloudModel> {
|
||||||
|
|
||||||
public static DEFAULT_TASK_FILTER_PROPERTIES = ['status', 'assignee', 'sort', 'order'];
|
|
||||||
public static DEFAULT_TASK_SORT_PROPERTIES = ['id', 'name', 'createdDate', 'priority'];
|
|
||||||
public static DEFAULT_TASK_STATUS_PROPERTIES = [
|
|
||||||
{ label: 'ALL', value: '' },
|
|
||||||
{ label: 'CREATED', value: 'CREATED' },
|
|
||||||
{ label: 'ASSIGNED', value: 'ASSIGNED' },
|
|
||||||
{ label: 'SUSPENDED', value: 'SUSPENDED' },
|
|
||||||
{ label: 'CANCELLED', value: 'CANCELLED' },
|
|
||||||
{ label: 'COMPLETED', value: 'COMPLETED' }
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Emitted when a task filter property changes. */
|
|
||||||
@Output()
|
|
||||||
filterChange: EventEmitter<TaskFilterCloudModel> = new EventEmitter();
|
|
||||||
|
|
||||||
taskFilter: TaskFilterCloudModel;
|
|
||||||
changedTaskFilter: TaskFilterCloudModel;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected formBuilder: FormBuilder,
|
formBuilder: FormBuilder,
|
||||||
public dialog: MatDialog,
|
dialog: MatDialog,
|
||||||
private translateService: TranslationService,
|
translateService: TranslationService,
|
||||||
private taskFilterCloudService: TaskFilterCloudService,
|
private taskFilterCloudService: TaskFilterCloudService,
|
||||||
protected dateAdapter: DateAdapter<Moment>,
|
dateAdapter: DateAdapter<Moment>,
|
||||||
protected userPreferencesService: UserPreferencesService,
|
userPreferencesService: UserPreferencesService,
|
||||||
protected appsProcessCloudService: AppsProcessCloudService,
|
appsProcessCloudService: AppsProcessCloudService,
|
||||||
protected taskCloudService: TaskCloudService) {
|
taskCloudService: TaskCloudService) {
|
||||||
super(formBuilder, dateAdapter, userPreferencesService, appsProcessCloudService, taskCloudService);
|
super(formBuilder, dateAdapter, userPreferencesService, appsProcessCloudService, taskCloudService, dialog, translateService);
|
||||||
}
|
}
|
||||||
|
|
||||||
assignNewFilter(formValues: TaskFilterCloudModel) {
|
assignNewFilter(model: TaskFilterCloudModel) {
|
||||||
this.setLastModifiedToFilter(<TaskFilterCloudModel> formValues);
|
this.setLastModifiedToFilter(model);
|
||||||
this.changedTaskFilter = new TaskFilterCloudModel(Object.assign({}, this.taskFilter, formValues));
|
this.changedTaskFilter = new TaskFilterCloudModel(Object.assign({}, this.taskFilter, model));
|
||||||
this.formHasBeenChanged = !this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
this.formHasBeenChanged = !this.deepCompare(this.changedTaskFilter, this.taskFilter);
|
||||||
this.filterChange.emit(this.changedTaskFilter);
|
this.filterChange.emit(this.changedTaskFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected getTaskFilterById(appName: string, id: string) {
|
||||||
* Fetches task filter by application name and filter id and creates filter properties, build form
|
return this.taskFilterCloudService
|
||||||
*/
|
.getTaskFilterById(appName, id)
|
||||||
retrieveTaskFilterAndBuildForm() {
|
|
||||||
this.isLoading = true;
|
|
||||||
this.taskFilterCloudService.getTaskFilterById(this.appName, this.id)
|
|
||||||
.pipe(
|
.pipe(
|
||||||
finalize(() => this.isLoading = false),
|
map(response => new TaskFilterCloudModel(response))
|
||||||
takeUntil(this.onDestroy$)
|
);
|
||||||
)
|
|
||||||
.subscribe(response => {
|
|
||||||
this.taskFilter = new TaskFilterCloudModel(response);
|
|
||||||
this.taskFilterProperties = this.createAndFilterProperties();
|
|
||||||
if (this.hasLastModifiedProperty()) {
|
|
||||||
this.taskFilterProperties = [...this.taskFilterProperties, ...this.createLastModifiedProperty()];
|
|
||||||
}
|
|
||||||
this.taskFilterActions = this.createAndFilterActions();
|
|
||||||
this.buildForm(this.taskFilterProperties);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkMandatoryFilterProperties() {
|
createAndFilterProperties() {
|
||||||
if (this.filterProperties === undefined || this.filterProperties.length === 0) {
|
const result = super.createAndFilterProperties();
|
||||||
this.filterProperties = EditTaskFilterCloudComponent.DEFAULT_TASK_FILTER_PROPERTIES;
|
|
||||||
|
if (this.hasLastModifiedProperty()) {
|
||||||
|
return [
|
||||||
|
...result,
|
||||||
|
...this.createLastModifiedProperty()
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkMandatorySortProperties(): void {
|
getDefaultFilterProperties(): string[] {
|
||||||
if (this.sortProperties === undefined || this.sortProperties.length === 0) {
|
return ['status', 'assignee', 'sort', 'order'];
|
||||||
this.sortProperties = EditTaskFilterCloudComponent.DEFAULT_TASK_SORT_PROPERTIES;
|
}
|
||||||
}
|
|
||||||
|
getDefaultSortProperties(): string[] {
|
||||||
|
return ['id', 'name', 'createdDate', 'priority'];
|
||||||
}
|
}
|
||||||
|
|
||||||
private setLastModifiedToFilter(formValues: TaskFilterCloudModel) {
|
private setLastModifiedToFilter(formValues: TaskFilterCloudModel) {
|
||||||
@@ -122,68 +98,18 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected updateFilter(filterToUpdate: TaskFilterCloudModel): Observable<any> {
|
||||||
* Return true if both filters are same
|
return this.taskFilterCloudService.updateFilter(filterToUpdate);
|
||||||
* @param editedQuery, @param currentQuery
|
|
||||||
*/
|
|
||||||
compareFilters(
|
|
||||||
editedQuery: TaskFilterCloudModel,
|
|
||||||
currentQuery: TaskFilterCloudModel
|
|
||||||
): boolean {
|
|
||||||
return JSON.stringify(editedQuery).toLowerCase() === JSON.stringify(currentQuery).toLowerCase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save(saveAction: TaskFilterAction): void {
|
protected deleteFilter(filterToDelete: TaskFilterCloudModel): Observable<TaskFilterCloudModel[]> {
|
||||||
this.taskFilterCloudService
|
return this.taskFilterCloudService.deleteFilter(filterToDelete);
|
||||||
.updateFilter(this.changedTaskFilter)
|
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
|
||||||
.subscribe(() => {
|
|
||||||
saveAction.filter = this.changedTaskFilter;
|
|
||||||
this.action.emit(saveAction);
|
|
||||||
this.formHasBeenChanged = this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(deleteAction: TaskFilterAction): void {
|
protected addFilter(filterToAdd: TaskFilterCloudModel): Observable<any> {
|
||||||
this.taskFilterCloudService
|
return this.taskFilterCloudService
|
||||||
.deleteFilter(this.taskFilter)
|
.addFilter(filterToAdd)
|
||||||
.pipe(
|
.pipe(takeUntil(this.onDestroy$));
|
||||||
filter((filters) => {
|
|
||||||
deleteAction.filter = this.taskFilter;
|
|
||||||
this.action.emit(deleteAction);
|
|
||||||
return filters.length === 0;
|
|
||||||
}),
|
|
||||||
switchMap(() => this.restoreDefaultTaskFilters()),
|
|
||||||
takeUntil(this.onDestroy$))
|
|
||||||
.subscribe(() => { });
|
|
||||||
}
|
|
||||||
|
|
||||||
saveAs(saveAsAction: TaskFilterAction): void {
|
|
||||||
const dialogRef = this.dialog.open(TaskFilterDialogCloudComponent, {
|
|
||||||
data: {
|
|
||||||
name: this.translateService.instant(this.taskFilter.name)
|
|
||||||
},
|
|
||||||
height: 'auto',
|
|
||||||
minWidth: '30%'
|
|
||||||
});
|
|
||||||
dialogRef.afterClosed().subscribe((result) => {
|
|
||||||
if (result && result.action === TaskFilterDialogCloudComponent.ACTION_SAVE) {
|
|
||||||
const filterId = Math.random().toString(36).substr(2, 9);
|
|
||||||
const filterKey = this.getSanitizeFilterName(result.name);
|
|
||||||
const newFilter = {
|
|
||||||
name: result.name,
|
|
||||||
icon: result.icon,
|
|
||||||
id: filterId,
|
|
||||||
key: 'custom-' + filterKey
|
|
||||||
};
|
|
||||||
const resultFilter: TaskFilterCloudModel = Object.assign({}, this.changedTaskFilter, newFilter);
|
|
||||||
this.taskFilterCloudService.addFilter(resultFilter)
|
|
||||||
.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
|
||||||
saveAsAction.filter = resultFilter;
|
|
||||||
this.action.emit(saveAsAction);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isDisabledForDefaultFilters(action: TaskFilterAction): boolean {
|
isDisabledForDefaultFilters(action: TaskFilterAction): boolean {
|
||||||
@@ -197,122 +123,132 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
|
|||||||
return this.taskFilterCloudService.getTaskListFilters(this.appName);
|
return this.taskFilterCloudService.getTaskListFilters(this.appName);
|
||||||
}
|
}
|
||||||
|
|
||||||
createLastModifiedProperty(): TaskFilterProperties[] {
|
private createLastModifiedProperty(): TaskFilterProperties[] {
|
||||||
return [
|
return [
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.LAST_MODIFIED_FROM',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.LAST_MODIFIED_FROM',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
key: 'lastModifiedFrom',
|
key: 'lastModifiedFrom',
|
||||||
value: ''
|
value: ''
|
||||||
}),
|
},
|
||||||
|
{
|
||||||
new TaskFilterProperties({
|
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.LAST_MODIFIED_TO',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.LAST_MODIFIED_TO',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
key: 'lastModifiedTo',
|
key: 'lastModifiedTo',
|
||||||
value: ''
|
value: ''
|
||||||
})
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private getDefaultProperties() {
|
||||||
|
return [
|
||||||
|
{ label: 'ALL', value: '' },
|
||||||
|
{ label: 'CREATED', value: 'CREATED' },
|
||||||
|
{ label: 'ASSIGNED', value: 'ASSIGNED' },
|
||||||
|
{ label: 'SUSPENDED', value: 'SUSPENDED' },
|
||||||
|
{ label: 'CANCELLED', value: 'CANCELLED' },
|
||||||
|
{ label: 'COMPLETED', value: 'COMPLETED' }
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
createTaskFilterProperties(): TaskFilterProperties[] {
|
createTaskFilterProperties(): TaskFilterProperties[] {
|
||||||
return [
|
return [
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.APP_NAME',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.APP_NAME',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'appName',
|
key: 'appName',
|
||||||
value: this.taskFilter.appName || '',
|
value: this.taskFilter.appName || '',
|
||||||
options: this.applicationNames
|
options: this.applicationNames
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.TASK_ID',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.TASK_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'taskId',
|
key: 'taskId',
|
||||||
value: ''
|
value: ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STATUS',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STATUS',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'status',
|
key: 'status',
|
||||||
value: this.taskFilter.status || EditTaskFilterCloudComponent.DEFAULT_TASK_STATUS_PROPERTIES[0].value,
|
value: this.taskFilter.status || this.getDefaultProperties()[0].value,
|
||||||
options: EditTaskFilterCloudComponent.DEFAULT_TASK_STATUS_PROPERTIES
|
options: this.getDefaultProperties()
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.ASSIGNMENT',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.ASSIGNMENT',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'assignee',
|
key: 'assignee',
|
||||||
value: this.taskFilter.assignee || ''
|
value: this.taskFilter.assignee || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_DEF_NAME',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_DEF_NAME',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'processDefinitionName',
|
key: 'processDefinitionName',
|
||||||
value: this.taskFilter.processDefinitionName || '',
|
value: this.taskFilter.processDefinitionName || '',
|
||||||
options: this.processDefinitionNames
|
options: this.processDefinitionNames
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_INSTANCE_ID',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_INSTANCE_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'processInstanceId',
|
key: 'processInstanceId',
|
||||||
value: this.taskFilter.processInstanceId || ''
|
value: this.taskFilter.processInstanceId || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_DEF_ID',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_DEF_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'processDefinitionId',
|
key: 'processDefinitionId',
|
||||||
value: this.taskFilter.processDefinitionId || ''
|
value: this.taskFilter.processDefinitionId || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.TASK_NAME',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.TASK_NAME',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'taskName',
|
key: 'taskName',
|
||||||
value: this.taskFilter.taskName || ''
|
value: this.taskFilter.taskName || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PARENT_TASK_ID',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PARENT_TASK_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'parentTaskId',
|
key: 'parentTaskId',
|
||||||
value: this.taskFilter.parentTaskId || ''
|
value: this.taskFilter.parentTaskId || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PRIORITY',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PRIORITY',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'priority',
|
key: 'priority',
|
||||||
value: this.taskFilter.priority || ''
|
value: this.taskFilter.priority || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.OWNER',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.OWNER',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
key: 'owner',
|
key: 'owner',
|
||||||
value: this.taskFilter.owner || ''
|
value: this.taskFilter.owner || ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.CREATED_DATE',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.CREATED_DATE',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
key: 'createdDate',
|
key: 'createdDate',
|
||||||
value: ''
|
value: ''
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'sort',
|
key: 'sort',
|
||||||
value: this.taskFilter.sort || this.createSortProperties[0].value,
|
value: this.taskFilter.sort || this.createSortProperties[0].value,
|
||||||
options: this.createSortProperties
|
options: this.createSortProperties
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DIRECTION',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DIRECTION',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'order',
|
key: 'order',
|
||||||
value: this.taskFilter.order || EditTaskFilterCloudComponent.DIRECTIONS[0].value,
|
value: this.taskFilter.order || EditTaskFilterCloudComponent.DIRECTIONS[0].value,
|
||||||
options: EditTaskFilterCloudComponent.DIRECTIONS
|
options: EditTaskFilterCloudComponent.DIRECTIONS
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STAND_ALONE',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STAND_ALONE',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
key: 'standalone',
|
key: 'standalone',
|
||||||
value: this.taskFilter.standalone || false
|
value: this.taskFilter.standalone || false
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DUE_DATE',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DUE_DATE',
|
||||||
type: 'date-range',
|
type: 'date-range',
|
||||||
key: 'dueDateRange',
|
key: 'dueDateRange',
|
||||||
@@ -329,8 +265,8 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
|
|||||||
DateCloudFilterType.NEXT_7_DAYS,
|
DateCloudFilterType.NEXT_7_DAYS,
|
||||||
DateCloudFilterType.RANGE
|
DateCloudFilterType.RANGE
|
||||||
]
|
]
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.COMPLETED_DATE',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.COMPLETED_DATE',
|
||||||
type: 'date-range',
|
type: 'date-range',
|
||||||
key: 'completedDateRange',
|
key: 'completedDateRange',
|
||||||
@@ -340,8 +276,8 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
|
|||||||
_completedFrom: this.taskFilter.completedFrom || null,
|
_completedFrom: this.taskFilter.completedFrom || null,
|
||||||
_completedTo: this.taskFilter.completedTo || null
|
_completedTo: this.taskFilter.completedTo || null
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.CREATED_DATE',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.CREATED_DATE',
|
||||||
type: 'date-range',
|
type: 'date-range',
|
||||||
key: 'createdDateRange',
|
key: 'createdDateRange',
|
||||||
@@ -351,15 +287,15 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
|
|||||||
_createdFrom: this.taskFilter.createdFrom || null,
|
_createdFrom: this.taskFilter.createdFrom || null,
|
||||||
_createdTo: this.taskFilter.createdTo || null
|
_createdTo: this.taskFilter.createdTo || null
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.COMPLETED_BY',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.COMPLETED_BY',
|
||||||
type: 'people',
|
type: 'people',
|
||||||
key: 'completedBy',
|
key: 'completedBy',
|
||||||
value: this.taskFilter.completedBy ? [this.taskFilter.completedBy] : null,
|
value: this.taskFilter.completedBy ? [this.taskFilter.completedBy] : null,
|
||||||
selectionMode: 'single'
|
selectionMode: 'single'
|
||||||
}),
|
},
|
||||||
new TaskFilterProperties({
|
{
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.ASSIGNMENT',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.ASSIGNMENT',
|
||||||
type: 'assignment',
|
type: 'assignment',
|
||||||
key: 'assignment',
|
key: 'assignment',
|
||||||
@@ -368,7 +304,7 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone
|
|||||||
assignee: this.taskFilter.assignee || null,
|
assignee: this.taskFilter.assignee || null,
|
||||||
candidateGroups: this.taskFilter.candidateGroups || []
|
candidateGroups: this.taskFilter.candidateGroups || []
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,6 @@ import { setupTestBed } from '@alfresco/adf-core';
|
|||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||||
import { FilterParamsModel } from '../models/filter-cloud.model';
|
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||||
import { TaskFiltersCloudModule } from '../task-filters-cloud.module';
|
import { TaskFiltersCloudModule } from '../task-filters-cloud.module';
|
||||||
@@ -184,7 +183,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
|||||||
it('should select the task filter based on the input by name param', async(() => {
|
it('should select the task filter based on the input by name param', async(() => {
|
||||||
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ name: 'FakeMyServiceTasks1' });
|
component.filterParam = { name: 'FakeMyServiceTasks1' };
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
|
|
||||||
@@ -202,7 +201,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
|||||||
it('should select the default task filter if filter input does not exist', async(() => {
|
it('should select the default task filter if filter input does not exist', async(() => {
|
||||||
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ name: 'UnexistableFilter' });
|
component.filterParam = { name: 'UnexistableFilter' };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
@@ -221,7 +220,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
|||||||
it('should select the task filter based on the input by index param', async(() => {
|
it('should select the task filter based on the input by index param', async(() => {
|
||||||
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ index: 2 });
|
component.filterParam = { index: 2 };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
@@ -240,7 +239,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
|||||||
it('should select the task filter based on the input by id param', async(() => {
|
it('should select the task filter based on the input by id param', async(() => {
|
||||||
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ id: 12 });
|
component.filterParam = { id: '12' };
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
|
|
||||||
@@ -258,7 +257,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
|||||||
it('should emit an event when a filter is selected', async(() => {
|
it('should emit an event when a filter is selected', async(() => {
|
||||||
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(serviceTaskFilterCloudService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ id: 12 });
|
component.filterParam = { id: '12' };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
@@ -344,7 +343,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return the current filter after one is selected', () => {
|
it('should return the current filter after one is selected', () => {
|
||||||
const filter = new FilterParamsModel({ name: 'FakeMyServiceTasks2' });
|
const filter = { name: 'FakeMyServiceTasks2' };
|
||||||
component.filters = fakeGlobalServiceFilters;
|
component.filters = fakeGlobalServiceFilters;
|
||||||
|
|
||||||
expect(component.currentFilter).toBeUndefined();
|
expect(component.currentFilter).toBeUndefined();
|
||||||
|
@@ -32,7 +32,7 @@ export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudCompon
|
|||||||
|
|
||||||
/** Emitted when a filter in the list is clicked. */
|
/** Emitted when a filter in the list is clicked. */
|
||||||
@Output()
|
@Output()
|
||||||
filterClick: EventEmitter<ServiceTaskFilterCloudModel> = new EventEmitter<ServiceTaskFilterCloudModel>();
|
filterClick = new EventEmitter<ServiceTaskFilterCloudModel>();
|
||||||
|
|
||||||
filters$: Observable<ServiceTaskFilterCloudModel[]>;
|
filters$: Observable<ServiceTaskFilterCloudModel[]>;
|
||||||
filters: ServiceTaskFilterCloudModel[] = [];
|
filters: ServiceTaskFilterCloudModel[] = [];
|
||||||
@@ -78,7 +78,7 @@ export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudCompon
|
|||||||
|
|
||||||
public selectFilter(paramFilter: FilterParamsModel) {
|
public selectFilter(paramFilter: FilterParamsModel) {
|
||||||
if (paramFilter) {
|
if (paramFilter) {
|
||||||
this.currentFilter = (this.filters as Array<ServiceTaskFilterCloudModel>).find((filter: any, index) =>
|
this.currentFilter = this.filters.find((filter, index) =>
|
||||||
paramFilter.index === index ||
|
paramFilter.index === index ||
|
||||||
paramFilter.key === filter.key ||
|
paramFilter.key === filter.key ||
|
||||||
paramFilter.id === filter.id ||
|
paramFilter.id === filter.id ||
|
||||||
|
@@ -21,7 +21,6 @@ import { setupTestBed } from '@alfresco/adf-core';
|
|||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||||
import { FilterParamsModel } from '../models/filter-cloud.model';
|
|
||||||
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
|
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
|
||||||
import { TaskFiltersCloudComponent } from './task-filters-cloud.component';
|
import { TaskFiltersCloudComponent } from './task-filters-cloud.component';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
@@ -184,7 +183,7 @@ describe('TaskFiltersCloudComponent', () => {
|
|||||||
it('should select the task filter based on the input by name param', async(() => {
|
it('should select the task filter based on the input by name param', async(() => {
|
||||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ name: 'FakeMyTasks1' });
|
component.filterParam = { name: 'FakeMyTasks1' };
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
|
|
||||||
@@ -202,7 +201,7 @@ describe('TaskFiltersCloudComponent', () => {
|
|||||||
it('should select the default task filter if filter input does not exist', async(() => {
|
it('should select the default task filter if filter input does not exist', async(() => {
|
||||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ name: 'UnexistableFilter' });
|
component.filterParam = { name: 'UnexistableFilter' };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
@@ -221,7 +220,7 @@ describe('TaskFiltersCloudComponent', () => {
|
|||||||
it('should select the task filter based on the input by index param', async(() => {
|
it('should select the task filter based on the input by index param', async(() => {
|
||||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ index: 2 });
|
component.filterParam = { index: 2 };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
@@ -240,7 +239,7 @@ describe('TaskFiltersCloudComponent', () => {
|
|||||||
it('should select the task filter based on the input by id param', async(() => {
|
it('should select the task filter based on the input by id param', async(() => {
|
||||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ id: 12 });
|
component.filterParam = { id: '12' };
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
|
|
||||||
@@ -258,7 +257,7 @@ describe('TaskFiltersCloudComponent', () => {
|
|||||||
it('should emit an event when a filter is selected', async(() => {
|
it('should emit an event when a filter is selected', async(() => {
|
||||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
component.filterParam = new FilterParamsModel({ id: 12 });
|
component.filterParam = { id: '12' };
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
const appName = 'my-app-1';
|
||||||
const change = new SimpleChange(null, appName, true);
|
const change = new SimpleChange(null, appName, true);
|
||||||
@@ -344,7 +343,7 @@ describe('TaskFiltersCloudComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return the current filter after one is selected', () => {
|
it('should return the current filter after one is selected', () => {
|
||||||
const filter = new FilterParamsModel({ name: 'FakeInvolvedTasks' });
|
const filter = { name: 'FakeInvolvedTasks' };
|
||||||
component.filters = fakeGlobalFilter;
|
component.filters = fakeGlobalFilter;
|
||||||
|
|
||||||
expect(component.currentFilter).toBeUndefined();
|
expect(component.currentFilter).toBeUndefined();
|
||||||
|
@@ -31,7 +31,7 @@ import { BaseTaskFiltersCloudComponent } from './base-task-filters-cloud.compone
|
|||||||
export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent implements OnInit, OnChanges {
|
export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent implements OnInit, OnChanges {
|
||||||
/** Emitted when a filter in the list is clicked. */
|
/** Emitted when a filter in the list is clicked. */
|
||||||
@Output()
|
@Output()
|
||||||
filterClick: EventEmitter<TaskFilterCloudModel> = new EventEmitter<TaskFilterCloudModel>();
|
filterClick = new EventEmitter<TaskFilterCloudModel>();
|
||||||
|
|
||||||
filters$: Observable<TaskFilterCloudModel[]>;
|
filters$: Observable<TaskFilterCloudModel[]>;
|
||||||
filters: TaskFilterCloudModel[] = [];
|
filters: TaskFilterCloudModel[] = [];
|
||||||
@@ -77,7 +77,7 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp
|
|||||||
|
|
||||||
public selectFilter(paramFilter: FilterParamsModel) {
|
public selectFilter(paramFilter: FilterParamsModel) {
|
||||||
if (paramFilter) {
|
if (paramFilter) {
|
||||||
this.currentFilter = this.filters.find((filter: any, index) =>
|
this.currentFilter = this.filters.find((filter, index) =>
|
||||||
paramFilter.index === index ||
|
paramFilter.index === index ||
|
||||||
paramFilter.key === filter.key ||
|
paramFilter.key === filter.key ||
|
||||||
paramFilter.id === filter.id ||
|
paramFilter.id === filter.id ||
|
||||||
|
@@ -205,42 +205,18 @@ export interface ServiceTaskFilterCloudModel {
|
|||||||
startedDate?: Date;
|
startedDate?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TaskType {
|
export interface FilterParamsModel {
|
||||||
UserTask = 'userTask',
|
|
||||||
ServiceTask = 'serviceTask'
|
|
||||||
}
|
|
||||||
|
|
||||||
export class FilterParamsModel {
|
|
||||||
|
|
||||||
id?: string;
|
id?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
key?: string;
|
key?: string;
|
||||||
index?: number;
|
index?: number;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
|
||||||
if (obj) {
|
|
||||||
this.id = obj.id || null;
|
|
||||||
this.name = obj.name || null;
|
|
||||||
this.key = obj.key || null;
|
|
||||||
this.index = obj.index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TaskFilterAction {
|
export interface TaskFilterAction {
|
||||||
actionType: string;
|
actionType?: string;
|
||||||
icon: string;
|
icon?: string;
|
||||||
tooltip: string;
|
tooltip?: string;
|
||||||
filter: TaskFilterCloudModel | ServiceTaskFilterCloudModel;
|
filter?: TaskFilterCloudModel | ServiceTaskFilterCloudModel;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
|
||||||
if (obj) {
|
|
||||||
this.actionType = obj.actionType || null;
|
|
||||||
this.icon = obj.icon || null;
|
|
||||||
this.tooltip = obj.tooltip || null;
|
|
||||||
this.filter = obj.filter || null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FilterOptions {
|
export interface FilterOptions {
|
||||||
@@ -254,26 +230,13 @@ export enum AssignmentType {
|
|||||||
CANDIDATE_GROUPS = 'CANDIDATE_GROUPS'
|
CANDIDATE_GROUPS = 'CANDIDATE_GROUPS'
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TaskFilterProperties {
|
export interface TaskFilterProperties {
|
||||||
label: string;
|
label?: string;
|
||||||
type: string;
|
type?: string;
|
||||||
value: any;
|
value?: any;
|
||||||
key: string;
|
key?: string;
|
||||||
attributes?: { [key: string]: string; };
|
attributes?: { [key: string]: string; };
|
||||||
options?: FilterOptions[];
|
options?: FilterOptions[];
|
||||||
dateFilterOptions?: DateCloudFilterType[];
|
dateFilterOptions?: DateCloudFilterType[];
|
||||||
selectionMode?: ComponentSelectionMode;
|
selectionMode?: ComponentSelectionMode;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
|
||||||
if (obj) {
|
|
||||||
this.label = obj.label || null;
|
|
||||||
this.type = obj.type || null;
|
|
||||||
this.value = obj.value || '';
|
|
||||||
this.key = obj.key || null;
|
|
||||||
this.attributes = obj.attributes || null;
|
|
||||||
this.options = obj.options || null;
|
|
||||||
this.dateFilterOptions = obj.dateFilterOptions || null;
|
|
||||||
this.selectionMode = obj.selectionMode || null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../dist/process-services-cloud/",
|
"outDir": "../dist/process-services-cloud/",
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"types": [],
|
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@alfresco/adf-extensions": ["../../dist/extensions"],
|
"@alfresco/adf-extensions": ["../../dist/extensions"],
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"types": ["jasmine"],
|
"types": ["jasmine", "node", "jasminewd2"],
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
|
@@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../../out-tsc/spec",
|
"outDir": "../../out-tsc/spec"
|
||||||
"types": [
|
|
||||||
"jasmine",
|
|
||||||
"node"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.spec.ts",
|
"**/*.spec.ts",
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
|
"types": ["jasmine", "node", "jasminewd2"],
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2018",
|
"es2018",
|
||||||
"esnext.array",
|
"esnext.array",
|
||||||
|
Reference in New Issue
Block a user