[ADF-2297] App-list - The component shows "No Apps found" until all the apps are loaded (#2945)

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* added a way to pass custom no-apps template to adf-apps

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* added a way to pass custom no-apps template to adf-apps
This commit is contained in:
madhukar23
2018-02-20 15:55:53 +05:30
committed by Eugenio Romano
parent de575fd47b
commit 5955cc567d
6 changed files with 125 additions and 8 deletions

View File

@@ -15,8 +15,8 @@
* limitations under the License.
*/
import { AppsProcessService, TranslationService } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { AppsProcessService, TranslationService, EmptyListComponent } from '@alfresco/adf-core';
import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output, ContentChild } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import { AppDefinitionRepresentationModel } from '../task-list';
@@ -27,7 +27,7 @@ import { IconModel } from './icon.model';
templateUrl: 'apps-list.component.html',
styleUrls: ['./apps-list.component.scss']
})
export class AppsListComponent implements OnInit {
export class AppsListComponent implements OnInit, AfterContentInit {
public static LAYOUT_LIST: string = 'LIST';
public static LAYOUT_GRID: string = 'GRID';
@@ -37,6 +37,9 @@ export class AppsListComponent implements OnInit {
public static DEFAULT_TASKS_APP_ICON: string = 'glyphicon-asterisk';
public static DEFAULT_TASKS_APP_MATERIAL_ICON: string = 'favorite_border';
@ContentChild(EmptyListComponent)
emptyTemplate: EmptyListComponent;
/** (**required**) Defines the layout of the apps. There are two possible
* values, "GRID" and "LIST".
*/
@@ -64,6 +67,10 @@ export class AppsListComponent implements OnInit {
private iconsMDL: IconModel;
loading: boolean = false;
hasCustomEmptyListTemplate: boolean = false;
constructor(
private appsProcessService: AppsProcessService,
private translationService: TranslationService) {
@@ -82,7 +89,14 @@ export class AppsListComponent implements OnInit {
this.load();
}
ngAfterContentInit() {
if (this.emptyTemplate) {
this.hasCustomEmptyListTemplate = true;
}
}
private load() {
this.loading = true;
this.appsProcessService.getDeployedApplications()
.subscribe(
(res: AppDefinitionRepresentationModel[]) => {
@@ -94,10 +108,12 @@ export class AppsListComponent implements OnInit {
} else if (app.deploymentId) {
this.appsObserver.next(app);
}
this.loading = false;
});
},
(err) => {
this.error.emit(err);
this.loading = false;
}
);
}
@@ -185,6 +201,10 @@ export class AppsListComponent implements OnInit {
return this.appList.length === 0;
}
isLoading(): boolean {
return this.loading;
}
getTheme(app: AppDefinitionRepresentationModel): string {
return app.theme ? app.theme : '';
}