mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
[ADF-4576] Remove duplicate getDeployedApplicationsByStatus service (#4740)
* * Remove overriding & added appconfig apps support * * Added tests * * Updated docs * [ADF-4576] Made one service private * * Fixed tests * * [ADF-4576] Improved tests
This commit is contained in:
committed by
Eugenio Romano
parent
90617ee3fd
commit
d571480ddd
@@ -26,10 +26,14 @@ import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
@Injectable()
|
||||
export class AppsProcessCloudService {
|
||||
|
||||
deployedApps: ApplicationInstanceModel[];
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private appConfigService: AppConfigService) {
|
||||
|
||||
this.loadApps();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,6 +42,23 @@ export class AppsProcessCloudService {
|
||||
* @returns The list of deployed apps
|
||||
*/
|
||||
getDeployedApplicationsByStatus(status: string): Observable<ApplicationInstanceModel[]> {
|
||||
return this.hasDeployedApps() ? of(this.deployedApps) : this.getApplicationsByStatus(status);
|
||||
}
|
||||
|
||||
hasDeployedApps(): boolean {
|
||||
return this.deployedApps && this.deployedApps.length > 0;
|
||||
}
|
||||
|
||||
loadApps() {
|
||||
const apps = this.appConfigService.get<any>('alfresco-deployed-apps', []);
|
||||
apps.map((app) => {
|
||||
app.theme = app.theme ? app.theme : 'theme-1';
|
||||
app.icon = app.icon ? app.icon : 'favorite';
|
||||
});
|
||||
this.deployedApps = apps;
|
||||
}
|
||||
|
||||
private getApplicationsByStatus(status: string): Observable<ApplicationInstanceModel[]> {
|
||||
if (status === '') {
|
||||
return of([]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user