mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
[ADF-3841] Improve edit-task-filter-cloud by adding inputs to control filters, sort and actions (#4113)
* [ADF-3841] Improve edit-task-filter-cloud by adding inputs to control filters, sort and actions * Refactored editTask * Added translate keys related to the edittask filter * Created TaskFilterProperties model * * Refactored Edit Task Filter * Added method to fetch all running applications * * Added date validation error message * * Added css mixin * * Removed dateError flag * Used formController error * * Added default filter properties * * Refactored appsProcessCloudService * Added flexlayout to align all filter properties * * Modified unit test for the recent changes* Added few unit tests* Updated editTaskFilter documentation * * Rebased with the latest changes * updated doc * Updated translate keys
This commit is contained in:
committed by
Eugenio Romano
parent
8431f0b1f1
commit
6fdd419476
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { Observable, from, throwError, of } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, LogService } from '@alfresco/adf-core';
|
||||
@@ -26,22 +26,21 @@ import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
@Injectable()
|
||||
export class AppsProcessCloudService {
|
||||
|
||||
contextRoot = '';
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private appConfig: AppConfigService) {
|
||||
this.contextRoot = this.appConfig.get('bpmHost', '');
|
||||
}
|
||||
private appConfigService: AppConfigService) {}
|
||||
|
||||
/**
|
||||
* Gets a list of deployed apps for this user by status.
|
||||
* @returns The list of deployed apps
|
||||
*/
|
||||
getDeployedApplicationsByStatus(status: string): Observable<ApplicationInstanceModel[]> {
|
||||
if (status === '') {
|
||||
return of([]);
|
||||
}
|
||||
const api: Oauth2Auth = this.apiService.getInstance().oauth2Auth;
|
||||
const path = `${this.contextRoot}/alfresco-deployment-service/v1/applications`;
|
||||
const path = this.getApplicationUrl();
|
||||
const pathParams = {}, queryParams = {},
|
||||
headerParams = {}, formParams = {}, bodyParam = {},
|
||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
||||
@@ -49,17 +48,19 @@ export class AppsProcessCloudService {
|
||||
return from(api.callCustomApi(path, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||
contentTypes, accepts))
|
||||
.pipe(
|
||||
map((apps: Array<{}>) => {
|
||||
return apps.filter((app: ApplicationInstanceModel) => app.status === status)
|
||||
.map((app) => {
|
||||
return new ApplicationInstanceModel(app);
|
||||
});
|
||||
}
|
||||
),
|
||||
catchError((err) => this.handleError(err))
|
||||
map((applications: ApplicationInstanceModel[]) => {
|
||||
return applications.map((application) => {
|
||||
return new ApplicationInstanceModel(application);
|
||||
});
|
||||
}),
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
}
|
||||
|
||||
private getApplicationUrl() {
|
||||
return `${this.appConfigService.get('bpmHost')}/alfresco-deployment-service/v1/applications`;
|
||||
}
|
||||
|
||||
private handleError(error?: any) {
|
||||
this.logService.error(error);
|
||||
return throwError(error || 'Server error');
|
||||
|
Reference in New Issue
Block a user