[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:
Deepak Paul
2019-05-28 22:38:38 +05:30
committed by Eugenio Romano
parent 90617ee3fd
commit d571480ddd
5 changed files with 58 additions and 66 deletions

View File

@@ -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([]);
}