mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3067] App-list Empty State. (#3432)
This commit is contained in:
committed by
Maurizio Vitale
parent
302091d338
commit
508308113c
@@ -24,9 +24,9 @@ If we intend to show a custom template if there are no apps present
|
|||||||
```html
|
```html
|
||||||
<adf-apps
|
<adf-apps
|
||||||
[layoutType]="'GRID'">
|
[layoutType]="'GRID'">
|
||||||
<adf-empty-list>
|
<adf-empty-custom-content>
|
||||||
<div adf-empty-list-header class="adf-empty-list-header">No apps present</div>
|
No Apps present
|
||||||
</adf-empty-list>
|
</adf-empty-custom-content>
|
||||||
</adf-apps>
|
</adf-apps>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -42,14 +42,15 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-template #empty>
|
<ng-template #empty>
|
||||||
|
<div class="adf-app-list-empty" *ngIf="isEmpty()">
|
||||||
|
<ng-content select="adf-empty-custom-content" *ngIf="hasEmptyCustomContentTemplate; else defaultEmptyTemplate" class="adf-custom-empty-template"></ng-content>
|
||||||
|
|
||||||
<ng-content *ngIf="hasCustomEmptyListTemplate; else defaulEmptyList" class="adf-custom-empty-template"></ng-content>
|
<ng-template #defaultEmptyTemplate>
|
||||||
|
<adf-empty-content
|
||||||
<ng-template #defaulEmptyList>
|
icon="apps"
|
||||||
<adf-empty-list *ngIf="isEmpty()">
|
[title]="'ADF_TASK_LIST.APPS.TITLE' | translate"
|
||||||
<div adf-empty-list-header class="adf-empty-list-header">
|
[subtitle]="'ADF_TASK_LIST.APPS.SUBTITLE' | translate">
|
||||||
{{ 'ADF_TASK_LIST.APPS.NONE' | translate }}
|
</adf-empty-content>
|
||||||
</div>
|
</ng-template>
|
||||||
</adf-empty-list>
|
</div>
|
||||||
</ng-template>
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
theme-10: (bg: #cabb33, color: #baab23)
|
theme-10: (bg: #cabb33, color: #baab23)
|
||||||
);
|
);
|
||||||
|
|
||||||
.adf-app-list-spinner {
|
.adf-app-list-spinner, .adf-app-list-empty {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
@@ -243,9 +243,9 @@ describe('AppsListComponent', () => {
|
|||||||
@Component({
|
@Component({
|
||||||
template: `
|
template: `
|
||||||
<adf-apps>
|
<adf-apps>
|
||||||
<adf-empty-list>
|
<adf-empty-custom-content>
|
||||||
<div adf-empty-list-header class="adf-empty-list-header">No Apps</div>
|
<p id="custom-id">No Apps</p>
|
||||||
</adf-empty-list>
|
</adf-empty-custom-content>
|
||||||
</adf-apps>
|
</adf-apps>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
@@ -272,7 +272,7 @@ describe('Custom CustomEmptyAppListTemplateComponent', () => {
|
|||||||
it('should render the custom no-apps template', async(() => {
|
it('should render the custom no-apps template', async(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
let title: any = fixture.debugElement.queryAll(By.css('[adf-empty-list-header]'));
|
let title: any = fixture.debugElement.queryAll(By.css('#custom-id'));
|
||||||
expect(title.length).toBe(1);
|
expect(title.length).toBe(1);
|
||||||
expect(title[0].nativeElement.innerText).toBe('No Apps');
|
expect(title[0].nativeElement.innerText).toBe('No Apps');
|
||||||
});
|
});
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AppsProcessService, TranslationService, EmptyListComponent } from '@alfresco/adf-core';
|
import { AppsProcessService, TranslationService, EmptyCustomContentDirective } from '@alfresco/adf-core';
|
||||||
import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output, ContentChild } from '@angular/core';
|
import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output, ContentChild } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { Observer } from 'rxjs/Observer';
|
import { Observer } from 'rxjs/Observer';
|
||||||
@@ -37,8 +37,8 @@ export class AppsListComponent implements OnInit, AfterContentInit {
|
|||||||
public static DEFAULT_TASKS_APP_ICON: string = 'glyphicon-asterisk';
|
public static DEFAULT_TASKS_APP_ICON: string = 'glyphicon-asterisk';
|
||||||
public static DEFAULT_TASKS_APP_MATERIAL_ICON: string = 'favorite_border';
|
public static DEFAULT_TASKS_APP_MATERIAL_ICON: string = 'favorite_border';
|
||||||
|
|
||||||
@ContentChild(EmptyListComponent)
|
@ContentChild(EmptyCustomContentDirective)
|
||||||
emptyTemplate: EmptyListComponent;
|
emptyCustomContent: EmptyCustomContentDirective;
|
||||||
|
|
||||||
/** (**required**) Defines the layout of the apps. There are two possible
|
/** (**required**) Defines the layout of the apps. There are two possible
|
||||||
* values, "GRID" and "LIST".
|
* values, "GRID" and "LIST".
|
||||||
@@ -69,7 +69,7 @@ export class AppsListComponent implements OnInit, AfterContentInit {
|
|||||||
|
|
||||||
loading: boolean = false;
|
loading: boolean = false;
|
||||||
|
|
||||||
hasCustomEmptyListTemplate: boolean = false;
|
hasEmptyCustomContentTemplate: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private appsProcessService: AppsProcessService,
|
private appsProcessService: AppsProcessService,
|
||||||
@@ -90,8 +90,8 @@ export class AppsListComponent implements OnInit, AfterContentInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
ngAfterContentInit() {
|
||||||
if (this.emptyTemplate) {
|
if (this.emptyCustomContent) {
|
||||||
this.hasCustomEmptyListTemplate = true;
|
this.hasEmptyCustomContentTemplate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ import { FlexLayoutModule } from '@angular/flex-layout';
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { MaterialModule } from '../material.module';
|
import { MaterialModule } from '../material.module';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { DataTableModule } from '@alfresco/adf-core';
|
import { CoreModule } from '@alfresco/adf-core';
|
||||||
|
|
||||||
import { AppsListComponent } from './apps-list.component';
|
import { AppsListComponent } from './apps-list.component';
|
||||||
import { SelectAppsDialogComponent } from './select-apps-dialog-component';
|
import { SelectAppsDialogComponent } from './select-apps-dialog-component';
|
||||||
@@ -31,7 +31,7 @@ import { SelectAppsDialogComponent } from './select-apps-dialog-component';
|
|||||||
MaterialModule,
|
MaterialModule,
|
||||||
FlexLayoutModule,
|
FlexLayoutModule,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
DataTableModule
|
CoreModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AppsListComponent,
|
AppsListComponent,
|
||||||
|
@@ -13,7 +13,8 @@
|
|||||||
},
|
},
|
||||||
"ADF_TASK_LIST": {
|
"ADF_TASK_LIST": {
|
||||||
"APPS": {
|
"APPS": {
|
||||||
"NONE": "No apps found",
|
"TITLE": "No Applications Found",
|
||||||
|
"SUBTITLE":"Create a new application that you want to easily find later",
|
||||||
"TASK_APP_NAME": "Task App"
|
"TASK_APP_NAME": "Task App"
|
||||||
},
|
},
|
||||||
"LIST": {
|
"LIST": {
|
||||||
|
Reference in New Issue
Block a user