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

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