mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Select the first filter as default
This commit is contained in:
@@ -107,6 +107,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
|
||||
res.forEach((filter) => {
|
||||
this.filterObserver.next(filter);
|
||||
});
|
||||
this.selectFirstFilter();
|
||||
this.onSuccess.emit(res);
|
||||
},
|
||||
(err) => {
|
||||
@@ -120,6 +121,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
|
||||
this.activiti.getDeployedApplications(this.appName).subscribe(
|
||||
application => {
|
||||
this.filterByAppId(application.id);
|
||||
this.selectFirstFilter();
|
||||
},
|
||||
(err) => {
|
||||
console.log(err);
|
||||
@@ -136,6 +138,33 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
|
||||
this.filterClick.emit(filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the first filter of a list if present
|
||||
*/
|
||||
private selectFirstFilter() {
|
||||
if (!this.isFilterListEmpty()) {
|
||||
this.currentFilter = this.filters[0];
|
||||
} else {
|
||||
this.currentFilter = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current task
|
||||
* @returns {FilterRepresentationModel}
|
||||
*/
|
||||
getCurrentFilter(): FilterRepresentationModel {
|
||||
return this.currentFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the filter list is empty
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isFilterListEmpty(): boolean {
|
||||
return this.filters === undefined || (this.filters && this.filters.length === 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the filters properties
|
||||
*/
|
||||
|
@@ -106,6 +106,7 @@ export class ActivitiFilters implements OnInit, OnChanges {
|
||||
(res: FilterRepresentationModel[]) => {
|
||||
res.forEach((filter) => {
|
||||
this.filterObserver.next(filter);
|
||||
this.selectFirstFilter();
|
||||
});
|
||||
this.onSuccess.emit(res);
|
||||
},
|
||||
@@ -120,6 +121,7 @@ export class ActivitiFilters implements OnInit, OnChanges {
|
||||
this.activiti.getDeployedApplications(this.appName).subscribe(
|
||||
application => {
|
||||
this.filterByAppId(application.id);
|
||||
this.selectFirstFilter();
|
||||
},
|
||||
(err) => {
|
||||
console.log(err);
|
||||
@@ -136,6 +138,33 @@ export class ActivitiFilters implements OnInit, OnChanges {
|
||||
this.filterClick.emit(filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the first filter of a list if present
|
||||
*/
|
||||
private selectFirstFilter() {
|
||||
if (!this.isFilterListEmpty()) {
|
||||
this.currentFilter = this.filters[0];
|
||||
} else {
|
||||
this.currentFilter = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current task
|
||||
* @returns {FilterRepresentationModel}
|
||||
*/
|
||||
getCurrentFilter(): FilterRepresentationModel {
|
||||
return this.currentFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the filter list is empty
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isFilterListEmpty(): boolean {
|
||||
return this.filters === undefined || (this.filters && this.filters.length === 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the filters properties
|
||||
*/
|
||||
|
Reference in New Issue
Block a user