[ADF-4867] adf-error-component refactor (#5056)

* Refactor the adf-error-component
Move the custom buttons on demoshell
Fix unit test
Remove usefull e2e

* Add basic example
This commit is contained in:
Maurizio Vitale
2019-09-07 10:29:19 +01:00
committed by Eugenio Romano
parent 4d7c07ef93
commit 4de00fd6ca
12 changed files with 98 additions and 97 deletions

View File

@@ -0,0 +1,15 @@
<div fxLayout="column" fxLayoutAlign="center center">
<adf-error-content [errorCode]="errorCode">
<div adf-error-content-actions class="adf-error-content-buttons">
<a a id="adf-secondary-button" mat-raised-button color="primary"
(click)="onReportIssue()"
class="adf-error-content-description-link">
{{ 'ERROR_CONTENT.' + errorCode + '.SECONDARY_BUTTON.TEXT' | translate | uppercase }}
</a>
<a id="adf-return-button" mat-raised-button color="primary" (click)="onReturnButton()">
{{ 'ERROR_CONTENT.' + errorCode + '.RETURN_BUTTON.TEXT' | translate | uppercase }}
</a>
</div>
</adf-error-content>
</div>

View File

@@ -0,0 +1,9 @@
.adf-error-content {
&-buttons {
display: flex;
width: 100%;
justify-content: space-evenly;
}
}

View File

@@ -0,0 +1,51 @@
/*!
* @license
* Copyright 2019 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, OnInit } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
@Component({
selector: 'app-demo-error',
styleUrls: ['./demo-error.component.scss'],
templateUrl: './demo-error.component.html'
})
export class DemoErrorComponent implements OnInit {
errorCode: string = '';
constructor(private route: ActivatedRoute, private router: Router) {
}
ngOnInit() {
if (this.route) {
this.route.params.forEach((params: Params) => {
if (params['id']) {
this.errorCode = params['id'];
}
});
}
}
onReportIssue() {
this.router.navigate(['/report-issue']);
}
onReturnButton() {
this.router.navigate(['/']);
}
}