notification service demo and testing area (#3443)

* notification service demo and testing area

* fix typo
This commit is contained in:
Denys Vuika 2018-06-06 14:52:55 +01:00 committed by Eugenio Romano
parent 28ba09897e
commit 8ba68e4f1b
7 changed files with 101 additions and 1 deletions

View File

@ -42,6 +42,7 @@
"APP_LAYOUT": {
"APP_NAME": "ADF Demo Application",
"HOME": "Home",
"NOTIFICATIONS": "Notifications",
"CONTENT_SERVICES": "Content Services",
"BREADCRUMB": "Breadcrumb",
"PROCESS_SERVICES": "Process Services",

View File

@ -52,6 +52,7 @@ import { SharedLinkViewComponent } from './components/shared-link-view/shared-li
import { DemoPermissionComponent } from './components/permissions/demo-permissions.component';
import { PreviewService } from './services/preview.service';
import { BreadcrumbDemoComponent } from './components/breadcrumb-demo/breadcrumb-demo.component';
import { NotificationsComponent } from './components/notifications/notifications.component';
@NgModule({
imports: [
@ -103,7 +104,8 @@ import { BreadcrumbDemoComponent } from './components/breadcrumb-demo/breadcrumb
DemoPermissionComponent,
FormLoadingComponent,
BlobPreviewComponent,
BreadcrumbDemoComponent
BreadcrumbDemoComponent,
NotificationsComponent
],
providers: [
{ provide: AppConfigService, useClass: DebugAppConfigService },

View File

@ -48,6 +48,7 @@ import { FormLoadingComponent } from './components/form/form-loading.component';
import { DemoPermissionComponent } from './components/permissions/demo-permissions.component';
import { BlobPreviewComponent } from './components/blob-preview/blob-preview.component';
import { BreadcrumbDemoComponent } from './components/breadcrumb-demo/breadcrumb-demo.component';
import { NotificationsComponent } from './components/notifications/notifications.component';
export const appRoutes: Routes = [
{ path: 'login', component: LoginComponent },
@ -60,6 +61,16 @@ export const appRoutes: Routes = [
component: BreadcrumbDemoComponent,
canActivate: [AuthGuardEcm]
},
{
path: 'notifications',
component: AppLayoutComponent ,
children: [
{
path: '',
component: NotificationsComponent
}
]
},
{
path: '',
component: AppLayoutComponent,

View File

@ -33,6 +33,7 @@ export class AppLayoutComponent implements OnInit {
{ href: '/home', icon: 'home', title: 'APP_LAYOUT.HOME' },
{ href: '/files', icon: 'folder_open', title: 'APP_LAYOUT.CONTENT_SERVICES' },
{ href: '/breadcrumb', icon: 'label', title: 'APP_LAYOUT.BREADCRUMB' },
{ href: '/notifications', icon: 'alarm', title: 'APP_LAYOUT.NOTIFICATIONS'},
{ href: '/activiti', icon: 'device_hub', title: 'APP_LAYOUT.PROCESS_SERVICES' },
{ href: '/login', icon: 'vpn_key', title: 'APP_LAYOUT.LOGIN' },
{ href: '/trashcan', icon: 'delete', title: 'APP_LAYOUT.TRASHCAN' },

View File

@ -0,0 +1,35 @@
<div class="main-content">
<h1>Notification Service</h1>
<ul>
<li>Try setting custom message with unicode characters, for example: <strong>I ♥️ ADF</strong></li>
<li>Try setting custom i18n resource key, for example: <strong>APP_LAYOUT.NOTIFICATIONS</strong></li>
<li>Try toggling the action button. Clicking the action within SnackBar should update the label under the toggle button.</li>
<li>All elements support <em>data-automation-id</em> attributes and can be automated.</li>
</ul>
<mat-form-field>
<input
matInput
placeholder="Message"
[(ngModel)]="message"
data-automation-id="notification-message">
</mat-form-field>
<button mat-icon-button (click)="send()">
<mat-icon>send</mat-icon>
</button>
<div>
<mat-slide-toggle
[(ngModel)]="withAction"
data-automation-id="notification-action-toggle">
With action
</mat-slide-toggle>
</div>
<div data-automation-id="notification-action-output">
{{ actionOutput }}
</div>
</div>

View File

@ -0,0 +1,3 @@
.main-content {
padding: 10px;
}

View File

@ -0,0 +1,47 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component } from '@angular/core';
import { NotificationService } from '@alfresco/adf-core';
@Component({
templateUrl: './notifications.component.html',
styleUrls: ['./notifications.component.scss']
})
export class NotificationsComponent {
message = 'I ♥️ ADF';
withAction = false;
actionOutput = '';
constructor(private notificationService: NotificationService) {}
send() {
this.actionOutput = '';
if (this.message) {
if (this.withAction) {
this.notificationService
.openSnackMessageAction(this.message, 'Some action')
.onAction()
.subscribe(() => this.actionOutput = 'Action clicked');
} else {
this.notificationService.openSnackMessage(this.message);
}
}
}
}