mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
shared library (#1080)
* shared project scaffold * rules package * move evaluators to shared lib * add rxjs peer dependency * use dedicated material namespaces * create store package, move actions * move selectors to shared library * move generic effects to shared lib * move routing extensions * minor code reorg * fix unit tests * move content-api service * move permission service * update tests * update plint config * move page layout * css variables * use dedicated css property * move generic error component to shared lib * fix test
This commit is contained in:
@@ -29,10 +29,12 @@ import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { AppLayoutComponent } from './app-layout.component';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { SetSelectedNodesAction } from '../../../store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
SetSelectedNodesAction,
|
||||
getAppSelection
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { Router, NavigationStart } from '@angular/router';
|
||||
import { appSelection } from '../../../store/selectors/app.selectors';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
class MockRouter {
|
||||
@@ -145,7 +147,7 @@ describe('AppLayoutComponent', () => {
|
||||
|
||||
router.navigateByUrl('somewhere/over/the/rainbow');
|
||||
fixture.detectChanges();
|
||||
store.select(appSelection).subscribe(state => {
|
||||
store.select(getAppSelection).subscribe(state => {
|
||||
expect(state.isEmpty).toBe(true);
|
||||
done();
|
||||
});
|
||||
@@ -158,7 +160,7 @@ describe('AppLayoutComponent', () => {
|
||||
|
||||
router.navigateByUrl('/search;q=');
|
||||
fixture.detectChanges();
|
||||
store.select(appSelection).subscribe(state => {
|
||||
store.select(getAppSelection).subscribe(state => {
|
||||
expect(state.isEmpty).toBe(false);
|
||||
done();
|
||||
});
|
||||
|
@@ -39,11 +39,13 @@ import { NavigationEnd, Router, NavigationStart } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { filter, takeUntil, map, withLatestFrom } from 'rxjs/operators';
|
||||
import { NodePermissionService } from '../../../services/node-permission.service';
|
||||
import { currentFolder } from '../../../store/selectors/app.selectors';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { BreakpointObserver } from '@angular/cdk/layout';
|
||||
import { SetSelectedNodesAction } from '../../../store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
SetSelectedNodesAction,
|
||||
getCurrentFolder
|
||||
} from '@alfresco/aca-shared/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layout',
|
||||
@@ -97,7 +99,7 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
this.store
|
||||
.select(currentFolder)
|
||||
.select(getCurrentFolder)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(node => {
|
||||
this.currentFolderId = node ? node.id : null;
|
||||
|
@@ -33,11 +33,8 @@ import { AppSidenavModule } from '../sidenav/sidenav.module';
|
||||
import { AppUploadingDialogModule } from '../upload-dialog/upload.module';
|
||||
import { AppCommonModule } from '../common/common.module';
|
||||
import { AppHeaderModule } from '../header/header.module';
|
||||
import { PageLayoutComponent } from './page-layout/page-layout.component';
|
||||
import { PageLayoutHeaderComponent } from './page-layout/page-layout-header.component';
|
||||
import { PageLayoutContentComponent } from './page-layout/page-layout-content.component';
|
||||
import { PageLayoutErrorComponent } from './page-layout/page-layout-error.component';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { PageLayoutModule } from '@alfresco/aca-shared';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -49,21 +46,10 @@ import { HttpClientModule } from '@angular/common/http';
|
||||
AppSidenavModule,
|
||||
AppHeaderModule,
|
||||
HttpClientModule,
|
||||
AppUploadingDialogModule
|
||||
AppUploadingDialogModule,
|
||||
PageLayoutModule
|
||||
],
|
||||
declarations: [
|
||||
AppLayoutComponent,
|
||||
PageLayoutComponent,
|
||||
PageLayoutHeaderComponent,
|
||||
PageLayoutContentComponent,
|
||||
PageLayoutErrorComponent
|
||||
],
|
||||
exports: [
|
||||
AppLayoutComponent,
|
||||
PageLayoutComponent,
|
||||
PageLayoutHeaderComponent,
|
||||
PageLayoutContentComponent,
|
||||
PageLayoutErrorComponent
|
||||
]
|
||||
declarations: [AppLayoutComponent],
|
||||
exports: [AppLayoutComponent, PageLayoutModule]
|
||||
})
|
||||
export class AppLayoutModule {}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
@import './app-layout/app-layout.theme.scss';
|
||||
@import './page-layout/page-layout.theme.scss';
|
||||
|
||||
@mixin layout-theme($theme) {
|
||||
@include app-layout-theme($theme);
|
||||
@include app-page-layout-theme($theme);
|
||||
}
|
||||
|
@@ -1,47 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy,
|
||||
Input,
|
||||
HostBinding
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-layout-content',
|
||||
template: `
|
||||
<ng-content></ng-content>
|
||||
`,
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: { class: 'app-page-layout-content' }
|
||||
})
|
||||
export class PageLayoutContentComponent {
|
||||
@Input()
|
||||
@HostBinding('class.scrollable')
|
||||
scrollable = false;
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-layout-error',
|
||||
template: `
|
||||
<ng-content></ng-content>
|
||||
`,
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: { class: 'app-page-layout-error' }
|
||||
})
|
||||
export class PageLayoutErrorComponent {}
|
@@ -1,39 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-layout-header',
|
||||
template: '<ng-content></ng-content>',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: { class: 'app-page-layout-header' }
|
||||
})
|
||||
export class PageLayoutHeaderComponent {}
|
@@ -1,3 +0,0 @@
|
||||
<ng-content select="app-page-layout-header"></ng-content>
|
||||
<ng-content select="app-page-layout-error" *ngIf="hasError"></ng-content>
|
||||
<ng-content select="app-page-layout-content" *ngIf="!hasError"></ng-content>
|
@@ -1,43 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy,
|
||||
Input
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-layout',
|
||||
templateUrl: 'page-layout.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: { class: 'app-page-layout' },
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class PageLayoutComponent {
|
||||
@Input()
|
||||
hasError = false;
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
@mixin app-page-layout-theme($theme) {
|
||||
$foreground: map-get($theme, foreground);
|
||||
|
||||
.app-page-layout {
|
||||
@include flex-column;
|
||||
|
||||
.app-page-layout-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 0 0 65px;
|
||||
flex-basis: 48px;
|
||||
background: #fafafa;
|
||||
border-bottom: 1px solid mat-color($foreground, text, 0.07);
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
.app-page-layout-content {
|
||||
@include flex-row;
|
||||
}
|
||||
|
||||
.app-page-layout-error {
|
||||
@include flex-row;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
@include flex-column;
|
||||
border-right: 1px solid mat-color($foreground, text, 0.07);
|
||||
}
|
||||
|
||||
.scrollable {
|
||||
overflow: auto !important;
|
||||
|
||||
.main-content {
|
||||
overflow: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
display: block;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
max-width: 350px;
|
||||
width: 350px;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user