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:
Denys Vuika
2019-04-25 14:56:54 +01:00
committed by GitHub
parent f3c5ffb977
commit 9db1c2989f
175 changed files with 1552 additions and 1153 deletions

View File

@@ -26,9 +26,11 @@
import { Component, ViewEncapsulation } from '@angular/core';
import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states';
import { documentDisplayMode } from '../../../store/selectors/app.selectors';
import { ToggleDocumentDisplayMode } from '../../../store/actions';
import {
AppStore,
ToggleDocumentDisplayMode,
getDocumentDisplayMode
} from '@alfresco/aca-shared/store';
@Component({
selector: 'app-document-display-mode',
@@ -45,7 +47,7 @@ export class DocumentDisplayModeComponent {
displayMode$: Observable<string>;
constructor(private store: Store<AppStore>) {
this.displayMode$ = store.select(documentDisplayMode);
this.displayMode$ = store.select(getDocumentDisplayMode);
}
onClick() {

View File

@@ -33,7 +33,7 @@ import {
DownloadNodesAction,
EditOfflineAction,
SnackbarErrorAction
} from '../../../store/actions';
} from '@alfresco/aca-shared/store';
describe('ToggleEditOfflineComponent', () => {
let fixture;

View File

@@ -23,16 +23,16 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states';
import { appSelection } from '../../../store/selectors/app.selectors';
import {
AppStore,
DownloadNodesAction,
EditOfflineAction,
SnackbarErrorAction
} from '../../../store/actions';
SnackbarErrorAction,
getAppSelection
} from '@alfresco/aca-shared/store';
import { MinimalNodeEntity } from '@alfresco/js-api';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Store } from '@ngrx/store';
@Component({
selector: 'app-toggle-edit-offline',
@@ -70,7 +70,7 @@ export class ToggleEditOfflineComponent implements OnInit {
constructor(private store: Store<AppStore>) {}
ngOnInit() {
this.store.select(appSelection).subscribe(({ file }) => {
this.store.select(getAppSelection).subscribe(({ file }) => {
this.selection = file;
});
}

View File

@@ -25,8 +25,7 @@
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states';
import { appSelection } from '../../../store/selectors/app.selectors';
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
import { Observable } from 'rxjs';
import { SelectionState } from '@alfresco/adf-extensions';
import { ContentManagementService } from '../../../services/content-management.service';
@@ -73,7 +72,7 @@ export class ToggleFavoriteLibraryComponent implements OnInit {
'/favorite/libraries'
);
this.selection$ = this.store.select(appSelection).pipe(
this.selection$ = this.store.select(getAppSelection).pipe(
distinctUntilChanged(),
map(selection => {
// favorite libraries list should already be marked as favorite

View File

@@ -25,11 +25,13 @@
import { Component, ViewEncapsulation } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states';
import { appSelection } from '../../../store/selectors/app.selectors';
import { Observable } from 'rxjs';
import { SelectionState } from '@alfresco/adf-extensions';
import { ReloadDocumentListAction } from '../../../store/actions';
import {
AppStore,
ReloadDocumentListAction,
getAppSelection
} from '@alfresco/aca-shared/store';
@Component({
selector: 'app-toggle-favorite',
@@ -56,7 +58,7 @@ export class ToggleFavoriteComponent {
selection$: Observable<SelectionState>;
constructor(private store: Store<AppStore>) {
this.selection$ = this.store.select(appSelection);
this.selection$ = this.store.select(getAppSelection);
}
onToggleEvent() {

View File

@@ -26,9 +26,10 @@
import { Component, ViewEncapsulation } from '@angular/core';
import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states';
import { infoDrawerOpened } from '../../../store/selectors/app.selectors';
import { ToggleInfoDrawerAction } from '../../../store/actions';
import {
ToggleInfoDrawerAction,
isInfoDrawerOpened
} from '@alfresco/aca-shared/store';
@Component({
selector: 'app-toggle-info-drawer',
@@ -48,8 +49,8 @@ import { ToggleInfoDrawerAction } from '../../../store/actions';
export class ToggleInfoDrawerComponent {
infoDrawerOpened$: Observable<boolean>;
constructor(private store: Store<AppStore>) {
this.infoDrawerOpened$ = this.store.select(infoDrawerOpened);
constructor(private store: Store<any>) {
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened);
}
onClick() {

View File

@@ -23,22 +23,22 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import {
AppStore,
SetSelectedNodesAction,
SnackbarErrorAction,
SnackbarInfoAction,
getAppSelection
} from '@alfresco/aca-shared/store';
import { SelectionState } from '@alfresco/adf-extensions';
import { Component, ViewEncapsulation } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states';
import { appSelection } from '../../../store/selectors/app.selectors';
import { Observable } from 'rxjs';
import { SelectionState } from '@alfresco/adf-extensions';
import { ContentManagementService } from '../../../services/content-management.service';
import {
SnackbarErrorAction,
SnackbarInfoAction
} from '../../../store/actions/snackbar.actions';
import { SetSelectedNodesAction } from '../../../store/actions/node.actions';
import {
LibraryMembershipToggleEvent,
LibraryMembershipErrorEvent
LibraryMembershipErrorEvent,
LibraryMembershipToggleEvent
} from '../../../directives/library-membership.directive';
import { ContentManagementService } from '../../../services/content-management.service';
@Component({
selector: 'app-toggle-join-library-button',
@@ -73,7 +73,7 @@ export class ToggleJoinLibraryButtonComponent {
private store: Store<AppStore>,
private content: ContentManagementService
) {
this.selection$ = this.store.select(appSelection);
this.selection$ = this.store.select(getAppSelection);
}
onToggleEvent(event: LibraryMembershipToggleEvent) {

View File

@@ -25,7 +25,7 @@
import { Component, ViewEncapsulation } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states';
import { AppStore } from '@alfresco/aca-shared/store';
import { ContentManagementService } from '../../../services/content-management.service';
import { ToggleJoinLibraryButtonComponent } from './toggle-join-library-button.component';

View File

@@ -32,7 +32,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
import {
SnackbarErrorAction,
SnackbarInfoAction
} from '../../../store/actions/snackbar.actions';
} from '@alfresco/aca-shared/store';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { ContentManagementService } from '../../../services/content-management.service';
import { ToggleJoinLibraryButtonComponent } from './toggle-join-library-button.component';