ngrx store cleanup (#425)

* merge app actions into single file

* rename action containers and cleanup imports

* fix tests

* license headers
This commit is contained in:
Denys Vuika
2018-06-15 21:20:26 +01:00
committed by GitHub
parent 90215350a1
commit 8c7cbd4caf
25 changed files with 543 additions and 113 deletions

View File

@@ -32,9 +32,7 @@ import {
import { ElectronService } from '@ngstack/electron';
import { Store } from '@ngrx/store';
import { AppStore } from './store/states/app.state';
import { SetHeaderColorAction } from './store/actions/header-color.action';
import { SetAppNameAction } from './store/actions/app-name.action';
import { SetLogoPathAction } from './store/actions/logo-path.action';
import { SetHeaderColorAction, SetAppNameAction, SetLogoPathAction } from './store/actions';
@Component({
selector: 'app-root',

View File

@@ -25,7 +25,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { ViewNodeAction } from '../../store/actions/viewer.action';
import { ViewNodeAction } from '../../store/actions/viewer.actions';
import { Store } from '@ngrx/store';
import { AppStore } from '../../store/states/app.state';

View File

@@ -23,20 +23,15 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { AppConfigService, PeopleContentService } from '@alfresco/adf-core';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppConfigService, PeopleContentService, TranslationService, TranslationMock } from '@alfresco/adf-core';
import { HttpClientModule } from '@angular/common/http';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs/Rx';
import { SetAppNameAction, SetHeaderColorAction } from '../../store/actions';
import { AppStore } from '../../store/states/app.state';
import { AppTestingModule } from '../../testing/app-testing.module';
import { HeaderComponent } from './header.component';
import { TranslateModule } from '@ngx-translate/core';
import { StoreModule, Store } from '@ngrx/store';
import { appReducer } from '../../store/reducers/app.reducer';
import { INITIAL_STATE, AppStore } from '../../store/states/app.state';
import { SetAppNameAction } from '../../store/actions/app-name.action';
import { SetHeaderColorAction } from '../../store/actions/header-color.action';
describe('HeaderComponent', () => {
let fixture: ComponentFixture<HeaderComponent>;
@@ -47,18 +42,14 @@ describe('HeaderComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
HttpClientModule,
RouterTestingModule,
TranslateModule.forRoot(),
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE })
AppTestingModule
],
declarations: [
HeaderComponent
],
providers: [
AppConfigService,
PeopleContentService,
{ provide: TranslationService, useClass: TranslationMock },
PeopleContentService
],
schemas: [ NO_ERRORS_SCHEMA ]
})

View File

@@ -1,7 +1,30 @@
export * from './actions/app-name.action';
export * from './actions/header-color.action';
export * from './actions/logo-path.action';
export * from './actions/node.action';
export * from './actions/snackbar.action';
export * from './actions/router.action';
export * from './actions/viewer.action';
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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/>.
*/
export * from './actions/app.actions';
export * from './actions/node.actions';
export * from './actions/snackbar.actions';
export * from './actions/router.actions';
export * from './actions/viewer.actions';

View File

@@ -1,8 +0,0 @@
import { Action } from '@ngrx/store';
export const SET_APP_NAME = 'SET_APP_NAME';
export class SetAppNameAction implements Action {
readonly type = SET_APP_NAME;
constructor(public payload: string) {}
}

View File

@@ -0,0 +1,45 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Action } from '@ngrx/store';
export const SET_APP_NAME = 'SET_APP_NAME';
export const SET_HEADER_COLOR = 'SET_HEADER_COLOR';
export const SET_LOGO_PATH = 'SET_LOGO_PATH';
export class SetAppNameAction implements Action {
readonly type = SET_APP_NAME;
constructor(public payload: string) {}
}
export class SetHeaderColorAction implements Action {
readonly type = SET_HEADER_COLOR;
constructor(public payload: string) {}
}
export class SetLogoPathAction implements Action {
readonly type = SET_LOGO_PATH;
constructor(public payload: string) {}
}

View File

@@ -1,8 +0,0 @@
import { Action } from '@ngrx/store';
export const SET_HEADER_COLOR = 'SET_HEADER_COLOR';
export class SetHeaderColorAction implements Action {
readonly type = SET_HEADER_COLOR;
constructor(public payload: string) {}
}

View File

@@ -1,8 +0,0 @@
import { Action } from '@ngrx/store';
export const SET_LOGO_PATH = 'SET_LOGO_PATH';
export class SetLogoPathAction implements Action {
readonly type = SET_LOGO_PATH;
constructor(public payload: string) {}
}

View File

@@ -1,5 +1,30 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Action } from '@ngrx/store';
import { NodeInfo } from '../models/node-info.model';
import { NodeInfo } from '../models';
export const SET_SELECTED_NODES = 'SET_SELECTED_NODES';
export const DELETE_NODES = 'DELETE_NODES';

View File

@@ -1,14 +0,0 @@
import { Action } from '@ngrx/store';
export const NAVIGATE_ROUTE = 'NAVIGATE_ROUTE';
export const NAVIGATE_LOCATION = 'NAVIGATE_LOCATION';
export class NavigateRouteAction implements Action {
readonly type = NAVIGATE_ROUTE;
constructor(public payload: any[]) {}
}
export class NavigateToLocationAction implements Action {
readonly type = NAVIGATE_LOCATION;
constructor(public payload: any) {}
}

View File

@@ -0,0 +1,39 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Action } from '@ngrx/store';
export const NAVIGATE_ROUTE = 'NAVIGATE_ROUTE';
export const NAVIGATE_LOCATION = 'NAVIGATE_LOCATION';
export class NavigateRouteAction implements Action {
readonly type = NAVIGATE_ROUTE;
constructor(public payload: any[]) {}
}
export class NavigateToLocationAction implements Action {
readonly type = NAVIGATE_LOCATION;
constructor(public payload: any) {}
}

View File

@@ -1,3 +1,28 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Action } from '@ngrx/store';
export const SNACKBAR_INFO = 'SNACKBAR_INFO';

View File

@@ -1,9 +0,0 @@
import { Action } from '@ngrx/store';
import { NodeInfo } from '../models';
export const VIEW_NODE = 'VIEW_NODE';
export class ViewNodeAction implements Action {
readonly type = VIEW_NODE;
constructor(public payload: NodeInfo) {}
}

View File

@@ -0,0 +1,34 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Action } from '@ngrx/store';
import { NodeInfo } from '../models';
export const VIEW_NODE = 'VIEW_NODE';
export class ViewNodeAction implements Action {
readonly type = VIEW_NODE;
constructor(public payload: NodeInfo) {}
}

View File

@@ -1,3 +1,28 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { appReducer } from './reducers/app.reducer';

View File

@@ -1,3 +1,28 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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/>.
*/
export * from './effects/download.effects';
export * from './effects/node.effects';
export * from './effects/router.effects';

View File

@@ -1,10 +1,35 @@
import { Effect, Actions, ofType } from '@ngrx/effects';
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { DownloadZipDialogComponent } from '@alfresco/adf-content-services';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { map } from 'rxjs/operators';
import { DownloadNodesAction, DOWNLOAD_NODES } from '../actions';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { MatDialog } from '@angular/material';
import { DownloadZipDialogComponent } from '@alfresco/adf-content-services';
import { NodeInfo } from '../models';
@Injectable()

View File

@@ -1,7 +1,31 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import { DeleteStatus, DeletedNodeInfo } from '../../store/models';
import { Store } from '@ngrx/store';
import { AppStore } from '../states/app.state';
import {
@@ -20,7 +44,7 @@ import {
import { ContentManagementService } from '../../common/services/content-management.service';
import { Observable } from 'rxjs/Rx';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { NodeInfo } from '../models';
import { NodeInfo, DeleteStatus, DeletedNodeInfo } from '../models';
@Injectable()
export class NodeEffects {

View File

@@ -1,11 +1,39 @@
import { Effect, Actions, ofType } from '@ngrx/effects';
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Injectable } from '@angular/core';
import { PathInfoEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
import {
NavigateRouteAction, NAVIGATE_ROUTE, NavigateToLocationAction, NAVIGATE_LOCATION
} from '../actions/router.action';
import { map } from 'rxjs/operators';
import { Router } from '@angular/router';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { MinimalNodeEntryEntity, PathInfoEntity } from 'alfresco-js-api';
import { map } from 'rxjs/operators';
import {
NavigateRouteAction,
NavigateToLocationAction,
NAVIGATE_LOCATION,
NAVIGATE_ROUTE
} from '../actions';
@Injectable()
export class RouterEffects {
@@ -40,10 +68,10 @@ export class RouterEffects {
const area = isLibraryPath ? '/libraries' : '/personal-files';
if (!isLibraryPath) {
link = [ area, parent.id ];
link = [area, parent.id];
} else {
// parent.id could be 'Site' folder or child as 'documentLibrary'
link = [ area, (parent.name === 'Sites' ? {} : parent.id) ];
link = [area, parent.name === 'Sites' ? {} : parent.id];
}
}
@@ -53,7 +81,11 @@ export class RouterEffects {
}
private isLibraryContent(path: PathInfoEntity): boolean {
if (path && path.elements.length >= 2 && path.elements[1].name === 'Sites') {
if (
path &&
path.elements.length >= 2 &&
path.elements[1].name === 'Sites'
) {
return true;
}

View File

@@ -1,18 +1,43 @@
import { Effect, Actions, ofType } from '@ngrx/effects';
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { TranslationService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { map } from 'rxjs/operators';
import {
SnackbarAction,
SnackbarErrorAction,
SNACKBAR_ERROR,
SNACKBAR_INFO,
SnackbarInfoAction,
SnackbarWarningAction,
SNACKBAR_WARNING,
SnackbarAction
SNACKBAR_ERROR,
SNACKBAR_INFO,
SNACKBAR_WARNING
} from '../actions';
import { MatSnackBar } from '@angular/material';
import { TranslationService } from '@alfresco/adf-core';
import { map } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { AppStore } from '../states/app.state';
@Injectable()

View File

@@ -1,7 +1,32 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import { ViewNodeAction, VIEW_NODE } from '../actions/viewer.action';
import { ViewNodeAction, VIEW_NODE } from '../actions/viewer.actions';
import { Router } from '@angular/router';
@Injectable()

View File

@@ -1,3 +1,28 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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/>.
*/
export * from './models/delete-status.model';
export * from './models/deleted-node-info.model';
export * from './models/node-info.model';

View File

@@ -1,26 +1,61 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { Action } from '@ngrx/store';
import { AppState, INITIAL_APP_STATE } from '../states/app.state';
import { SET_HEADER_COLOR, SetHeaderColorAction } from '../actions/header-color.action';
import { SET_APP_NAME, SetAppNameAction } from '../actions/app-name.action';
import { SET_LOGO_PATH, SetLogoPathAction } from '../actions/logo-path.action';
import { SET_SELECTED_NODES, SetSelectedNodesAction } from '../actions/node.action';
import {
SET_HEADER_COLOR,
SetHeaderColorAction,
SET_APP_NAME,
SetAppNameAction,
SET_LOGO_PATH,
SetLogoPathAction,
SET_SELECTED_NODES,
SetSelectedNodesAction
} from '../actions';
export function appReducer(state: AppState = INITIAL_APP_STATE, action: Action): AppState {
export function appReducer(
state: AppState = INITIAL_APP_STATE,
action: Action
): AppState {
let newState: AppState;
switch (action.type) {
case SET_APP_NAME:
newState = updateAppName(state, <SetAppNameAction> action);
newState = updateAppName(state, <SetAppNameAction>action);
break;
case SET_HEADER_COLOR:
newState = updateHeaderColor(state, <SetHeaderColorAction> action);
newState = updateHeaderColor(state, <SetHeaderColorAction>action);
break;
case SET_LOGO_PATH:
newState = updateLogoPath(state, <SetLogoPathAction> action);
newState = updateLogoPath(state, <SetLogoPathAction>action);
break;
case SET_SELECTED_NODES:
newState = updateSelectedNodes(state, <SetSelectedNodesAction> action);
newState = updateSelectedNodes(state, <SetSelectedNodesAction>(
action
));
break;
default:
newState = Object.assign({}, state);
@@ -29,7 +64,10 @@ export function appReducer(state: AppState = INITIAL_APP_STATE, action: Action):
return newState;
}
function updateHeaderColor(state: AppState, action: SetHeaderColorAction): AppState {
function updateHeaderColor(
state: AppState,
action: SetHeaderColorAction
): AppState {
const newState = Object.assign({}, state);
newState.headerColor = action.payload;
return newState;
@@ -47,7 +85,10 @@ function updateLogoPath(state: AppState, action: SetLogoPathAction): AppState {
return newState;
}
function updateSelectedNodes(state: AppState, action: SetSelectedNodesAction): AppState {
function updateSelectedNodes(
state: AppState,
action: SetSelectedNodesAction
): AppState {
const newState = Object.assign({}, state);
newState.selectedNodes = [...action.payload];
return newState;

View File

@@ -1,3 +1,28 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { createSelector } from '@ngrx/store';
import { AppStore, AppState } from '../states/app.state';

View File

@@ -1,3 +1,28 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { MinimalNodeEntity } from 'alfresco-js-api';
export interface AppState {