mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-249] routing generic error (#9)
* generic error * rename folder and files
This commit is contained in:
committed by
Denys Vuika
parent
5269e68db8
commit
b501f01177
@@ -10,6 +10,7 @@ import { MaterialModule } from './common/material.module';
|
|||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { APP_ROUTES } from './app.routes';
|
import { APP_ROUTES } from './app.routes';
|
||||||
|
|
||||||
|
import { GenericErrorComponent } from './components/generic-error/generic-error.component';
|
||||||
import { LoginComponent } from './components/login/login.component';
|
import { LoginComponent } from './components/login/login.component';
|
||||||
import { PreviewComponent } from './components/preview/preview.component';
|
import { PreviewComponent } from './components/preview/preview.component';
|
||||||
import { FilesComponent } from './components/files/files.component';
|
import { FilesComponent } from './components/files/files.component';
|
||||||
@@ -37,6 +38,7 @@ import { SidenavComponent } from './components/sidenav/sidenav.component';
|
|||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
|
GenericErrorComponent,
|
||||||
LoginComponent,
|
LoginComponent,
|
||||||
LayoutComponent,
|
LayoutComponent,
|
||||||
HeaderComponent,
|
HeaderComponent,
|
||||||
|
@@ -29,8 +29,20 @@ import { TrashcanComponent } from './components/trashcan/trashcan.component';
|
|||||||
|
|
||||||
import { LoginComponent } from './components/login/login.component';
|
import { LoginComponent } from './components/login/login.component';
|
||||||
import { PreviewComponent } from './components/preview/preview.component';
|
import { PreviewComponent } from './components/preview/preview.component';
|
||||||
|
import { GenericErrorComponent } from './components/generic-error/generic-error.component';
|
||||||
|
|
||||||
export const APP_ROUTES: Routes = [
|
export const APP_ROUTES: Routes = [
|
||||||
|
{
|
||||||
|
path: 'preview/:nodeId',
|
||||||
|
component: PreviewComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'login',
|
||||||
|
component: LoginComponent,
|
||||||
|
data: {
|
||||||
|
title: 'Sign in'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: LayoutComponent,
|
component: LayoutComponent,
|
||||||
@@ -101,26 +113,15 @@ export const APP_ROUTES: Routes = [
|
|||||||
i18nTitle: 'APP.BROWSE.TRASHCAN.TITLE'
|
i18nTitle: 'APP.BROWSE.TRASHCAN.TITLE'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
path: '**',
|
||||||
|
component: GenericErrorComponent
|
||||||
|
}
|
||||||
],
|
],
|
||||||
canActivate: [
|
canActivate: [
|
||||||
AuthGuardEcm
|
AuthGuardEcm
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'preview/:nodeId',
|
|
||||||
component: PreviewComponent
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '**',
|
|
||||||
redirectTo: '/login',
|
|
||||||
pathMatch: 'full'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'login',
|
|
||||||
component: LoginComponent,
|
|
||||||
data: {
|
|
||||||
title: 'Sign in'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -78,7 +78,19 @@
|
|||||||
</adf-toolbar>
|
</adf-toolbar>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="inner-layout__content">
|
<div class="inner-layout__content"
|
||||||
|
[ngClass]="{
|
||||||
|
'inner-layout__content--hide': isValidPath,
|
||||||
|
'inner-layout__content--show': !isValidPath
|
||||||
|
}">
|
||||||
|
<app-generic-error></app-generic-error>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inner-layout__content"
|
||||||
|
[ngClass]="{
|
||||||
|
'inner-layout__content--hide': !isValidPath ,
|
||||||
|
'inner-layout__content--show': isValidPath
|
||||||
|
}">
|
||||||
<alfresco-upload-drag-area
|
<alfresco-upload-drag-area
|
||||||
[rootFolderId]="node?.id"
|
[rootFolderId]="node?.id"
|
||||||
[disabled]="!canCreateContent(node)"
|
[disabled]="!canCreateContent(node)"
|
||||||
|
@@ -26,6 +26,7 @@ import { CommonModule } from '../../common/common.module';
|
|||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||||
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
||||||
import { NodeActionsService } from '../../common/services/node-actions.service';
|
import { NodeActionsService } from '../../common/services/node-actions.service';
|
||||||
|
import { GenericErrorComponent } from '../generic-error/generic-error.component';
|
||||||
import { FilesComponent } from './files.component';
|
import { FilesComponent } from './files.component';
|
||||||
|
|
||||||
describe('FilesComponent', () => {
|
describe('FilesComponent', () => {
|
||||||
@@ -48,7 +49,8 @@ describe('FilesComponent', () => {
|
|||||||
CommonModule
|
CommonModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
FilesComponent
|
FilesComponent,
|
||||||
|
GenericErrorComponent
|
||||||
]
|
]
|
||||||
}).compileComponents()
|
}).compileComponents()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@@ -32,6 +32,7 @@ import { PageComponent } from '../page.component';
|
|||||||
})
|
})
|
||||||
export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||||
private routeData: any = {};
|
private routeData: any = {};
|
||||||
|
isValidPath = true;
|
||||||
|
|
||||||
private onCopyNode: Subscription;
|
private onCopyNode: Subscription;
|
||||||
private onRemoveItem: Subscription;
|
private onRemoveItem: Subscription;
|
||||||
@@ -69,12 +70,16 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.fetchNode(nodeId)
|
this.fetchNode(nodeId)
|
||||||
.do((node) => this.updateCurrentNode(node))
|
.do((node) => this.updateCurrentNode(node))
|
||||||
.flatMap((node) => {
|
.flatMap((node) => this.fetchNodes(node.id))
|
||||||
return this.fetchNodes(node.id);
|
|
||||||
})
|
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(page) => this.onPageLoaded(page),
|
(page) => {
|
||||||
error => this.onFetchError(error)
|
this.isValidPath = true;
|
||||||
|
this.onPageLoaded(page);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
this.isValidPath = false;
|
||||||
|
this.onFetchError(error);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
<div class="generic-error">
|
||||||
|
<mat-icon>ic_error</mat-icon>
|
||||||
|
<p class="generic-error__title">This file / folder no longer exists or you don't have permission to view it.</p>
|
||||||
|
</div>
|
@@ -0,0 +1,23 @@
|
|||||||
|
@import 'variables';
|
||||||
|
|
||||||
|
.generic-error {
|
||||||
|
color: $alfresco-secondary-text-color;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
color: $alfresco-warn-color--hue-2;
|
||||||
|
direction: rtl;
|
||||||
|
font-size: 52px;
|
||||||
|
height: 52px;
|
||||||
|
width: 52px;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-generic-error',
|
||||||
|
styleUrls: ['./generic-error.component.scss'],
|
||||||
|
templateUrl: './generic-error.component.html'
|
||||||
|
})
|
||||||
|
export class GenericErrorComponent {}
|
||||||
|
|
@@ -61,8 +61,20 @@ $app-inner-layout--footer-height: 48px;
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__content--hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__content--show {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
&__footer {
|
&__footer {
|
||||||
flex-basis: $app-inner-layout--footer-height;
|
flex-basis: $app-inner-layout--footer-height;
|
||||||
border-top: 1px solid $alfresco-divider-color;
|
border-top: 1px solid $alfresco-divider-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app-generic-error {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user