mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-08 14:51:32 +00:00
[ACA-3712] Add appVersion multi-select dropdown in edit cloud process filter (#6321)
* [ACA-4053] Add appVersion multiselect dropdown in cloud filters * Call applications api to fetch the versions * Keep both old and new appVersion filter * minor changes * Add unit tests * Fix comments - remove appVersionMultiple input and use a common appVersion input
This commit is contained in:
@@ -18,10 +18,11 @@
|
||||
import { AlfrescoApiService, LogService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, Subject, throwError } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { ProcessInstanceCloud } from '../start-process/models/process-instance-cloud.model';
|
||||
import { BaseCloudService } from '../../services/base-cloud.service';
|
||||
import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model';
|
||||
import { ApplicationVersionModel, ApplicationVersionResponseModel } from '../../models/application-version.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -78,6 +79,27 @@ export class ProcessCloudService extends BaseCloudService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the application versions associated with an app.
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of Application Version Models
|
||||
*/
|
||||
getApplicationVersions(appName: string): Observable<ApplicationVersionModel[]> {
|
||||
if (appName) {
|
||||
const url = `${this.getBasePath(appName)}/query/v1/applications`;
|
||||
|
||||
return this.get<any>(url).pipe(
|
||||
map((appEntities: ApplicationVersionResponseModel) => {
|
||||
return appEntities.list.entries;
|
||||
}),
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
} else {
|
||||
this.logService.error('AppName is mandatory for querying the versions of an application');
|
||||
return throwError('AppName not configured');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels a process.
|
||||
* @param appName Name of the app
|
||||
@@ -98,4 +120,9 @@ export class ProcessCloudService extends BaseCloudService {
|
||||
return throwError('App name and process id not configured');
|
||||
}
|
||||
}
|
||||
|
||||
private handleError(error?: any) {
|
||||
this.logService.error(error);
|
||||
return throwError(error || 'Server error');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user