diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 1b73c984d..1b3f545d2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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', diff --git a/src/app/components/custom-dl-row/custom-dl-row.component.ts b/src/app/components/custom-dl-row/custom-dl-row.component.ts index 0d18534d5..51a8b4514 100644 --- a/src/app/components/custom-dl-row/custom-dl-row.component.ts +++ b/src/app/components/custom-dl-row/custom-dl-row.component.ts @@ -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'; diff --git a/src/app/components/header/header.component.spec.ts b/src/app/components/header/header.component.spec.ts index d21790274..2728e3a54 100644 --- a/src/app/components/header/header.component.spec.ts +++ b/src/app/components/header/header.component.spec.ts @@ -23,20 +23,15 @@ * along with Alfresco. If not, see . */ +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; @@ -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 ] }) diff --git a/src/app/store/actions.ts b/src/app/store/actions.ts index 2ae594719..11e24413a 100644 --- a/src/app/store/actions.ts +++ b/src/app/store/actions.ts @@ -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 . + */ + +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'; diff --git a/src/app/store/actions/app-name.action.ts b/src/app/store/actions/app-name.action.ts deleted file mode 100644 index 2cc00a1df..000000000 --- a/src/app/store/actions/app-name.action.ts +++ /dev/null @@ -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) {} -} diff --git a/src/app/store/actions/app.actions.ts b/src/app/store/actions/app.actions.ts new file mode 100644 index 000000000..7b800f8fd --- /dev/null +++ b/src/app/store/actions/app.actions.ts @@ -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 . + */ + +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) {} +} diff --git a/src/app/store/actions/header-color.action.ts b/src/app/store/actions/header-color.action.ts deleted file mode 100644 index b265d19de..000000000 --- a/src/app/store/actions/header-color.action.ts +++ /dev/null @@ -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) {} -} diff --git a/src/app/store/actions/logo-path.action.ts b/src/app/store/actions/logo-path.action.ts deleted file mode 100644 index f01321cba..000000000 --- a/src/app/store/actions/logo-path.action.ts +++ /dev/null @@ -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) {} -} diff --git a/src/app/store/actions/node.action.ts b/src/app/store/actions/node.actions.ts similarity index 51% rename from src/app/store/actions/node.action.ts rename to src/app/store/actions/node.actions.ts index 9c7eec577..c8b1a9063 100644 --- a/src/app/store/actions/node.action.ts +++ b/src/app/store/actions/node.actions.ts @@ -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 . + */ + 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'; diff --git a/src/app/store/actions/router.action.ts b/src/app/store/actions/router.action.ts deleted file mode 100644 index 5bedc85af..000000000 --- a/src/app/store/actions/router.action.ts +++ /dev/null @@ -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) {} -} diff --git a/src/app/store/actions/router.actions.ts b/src/app/store/actions/router.actions.ts new file mode 100644 index 000000000..457b28ef4 --- /dev/null +++ b/src/app/store/actions/router.actions.ts @@ -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 . + */ + +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) {} +} diff --git a/src/app/store/actions/snackbar.action.ts b/src/app/store/actions/snackbar.actions.ts similarity index 50% rename from src/app/store/actions/snackbar.action.ts rename to src/app/store/actions/snackbar.actions.ts index 564addeed..baac9ef9e 100644 --- a/src/app/store/actions/snackbar.action.ts +++ b/src/app/store/actions/snackbar.actions.ts @@ -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 . + */ + import { Action } from '@ngrx/store'; export const SNACKBAR_INFO = 'SNACKBAR_INFO'; diff --git a/src/app/store/actions/viewer.action.ts b/src/app/store/actions/viewer.action.ts deleted file mode 100644 index ac7588bb6..000000000 --- a/src/app/store/actions/viewer.action.ts +++ /dev/null @@ -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) {} -} diff --git a/src/app/store/actions/viewer.actions.ts b/src/app/store/actions/viewer.actions.ts new file mode 100644 index 000000000..048a408eb --- /dev/null +++ b/src/app/store/actions/viewer.actions.ts @@ -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 . + */ + +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) {} +} diff --git a/src/app/store/app-store.module.ts b/src/app/store/app-store.module.ts index a2fc25b75..7000b3537 100644 --- a/src/app/store/app-store.module.ts +++ b/src/app/store/app-store.module.ts @@ -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 . + */ + import { NgModule } from '@angular/core'; import { StoreModule } from '@ngrx/store'; import { appReducer } from './reducers/app.reducer'; diff --git a/src/app/store/effects.ts b/src/app/store/effects.ts index c60b5856a..463ac1680 100644 --- a/src/app/store/effects.ts +++ b/src/app/store/effects.ts @@ -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 . + */ + export * from './effects/download.effects'; export * from './effects/node.effects'; export * from './effects/router.effects'; diff --git a/src/app/store/effects/download.effects.ts b/src/app/store/effects/download.effects.ts index 09298be89..20bea20e0 100644 --- a/src/app/store/effects/download.effects.ts +++ b/src/app/store/effects/download.effects.ts @@ -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 . + */ + +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() diff --git a/src/app/store/effects/node.effects.ts b/src/app/store/effects/node.effects.ts index 4149a2aec..b48f4ea63 100644 --- a/src/app/store/effects/node.effects.ts +++ b/src/app/store/effects/node.effects.ts @@ -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 . + */ + 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 { diff --git a/src/app/store/effects/router.effects.ts b/src/app/store/effects/router.effects.ts index a1d27e5bd..566d65db5 100644 --- a/src/app/store/effects/router.effects.ts +++ b/src/app/store/effects/router.effects.ts @@ -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 . + */ + 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; } diff --git a/src/app/store/effects/snackbar.effects.ts b/src/app/store/effects/snackbar.effects.ts index 8d2c8f68d..99dd419fe 100644 --- a/src/app/store/effects/snackbar.effects.ts +++ b/src/app/store/effects/snackbar.effects.ts @@ -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 . + */ + +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() diff --git a/src/app/store/effects/viewer.effects.ts b/src/app/store/effects/viewer.effects.ts index a74bc6f8c..42a97bb2e 100644 --- a/src/app/store/effects/viewer.effects.ts +++ b/src/app/store/effects/viewer.effects.ts @@ -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 . + */ + 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() diff --git a/src/app/store/models.ts b/src/app/store/models.ts index 45e4c79bb..2a4d65d9a 100644 --- a/src/app/store/models.ts +++ b/src/app/store/models.ts @@ -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 . + */ + export * from './models/delete-status.model'; export * from './models/deleted-node-info.model'; export * from './models/node-info.model'; diff --git a/src/app/store/reducers/app.reducer.ts b/src/app/store/reducers/app.reducer.ts index 5e0d0ca2d..daff5aeb9 100644 --- a/src/app/store/reducers/app.reducer.ts +++ b/src/app/store/reducers/app.reducer.ts @@ -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 . + */ + 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, action); + newState = updateAppName(state, action); break; case SET_HEADER_COLOR: - newState = updateHeaderColor(state, action); + newState = updateHeaderColor(state, action); break; case SET_LOGO_PATH: - newState = updateLogoPath(state, action); + newState = updateLogoPath(state, action); break; case SET_SELECTED_NODES: - newState = updateSelectedNodes(state, action); + newState = updateSelectedNodes(state, ( + 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; diff --git a/src/app/store/selectors/app.selectors.ts b/src/app/store/selectors/app.selectors.ts index 46dd9ca17..068e5ee26 100644 --- a/src/app/store/selectors/app.selectors.ts +++ b/src/app/store/selectors/app.selectors.ts @@ -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 . + */ + import { createSelector } from '@ngrx/store'; import { AppStore, AppState } from '../states/app.state'; diff --git a/src/app/store/states/app.state.ts b/src/app/store/states/app.state.ts index 7b91766be..3de91e926 100644 --- a/src/app/store/states/app.state.ts +++ b/src/app/store/states/app.state.ts @@ -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 . + */ + import { MinimalNodeEntity } from 'alfresco-js-api'; export interface AppState {