mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
data store enhancements (#422)
* separate module for store * move NodeInfo to models folder * move store models to correct place
This commit is contained in:
@@ -32,11 +32,6 @@ import { TRANSLATION_PROVIDER, CoreModule, AppConfigService, PageTitleService }
|
||||
import { ContentModule } from '@alfresco/adf-content-services';
|
||||
import { ElectronModule } from '@ngstack/electron';
|
||||
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { StoreRouterConnectingModule } from '@ngrx/router-store';
|
||||
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { APP_ROUTES } from './app.routes';
|
||||
|
||||
@@ -77,18 +72,11 @@ import { HybridAppConfigService } from './common/services/hybrid-app-config.serv
|
||||
import { SortingPreferenceKeyDirective } from './directives/sorting-preference-key.directive';
|
||||
import { PageTitleService as AcaPageTitleService } from './common/services/page-title.service';
|
||||
|
||||
import { INITIAL_STATE } from './store/states/app.state';
|
||||
import { appReducer } from './store/reducers/app.reducer';
|
||||
import { InfoDrawerComponent } from './components/info-drawer/info-drawer.component';
|
||||
import { EditFolderDirective } from './directives/edit-folder.directive';
|
||||
import { SnackbarEffects } from './store/effects/snackbar.effects';
|
||||
import { NodeEffects } from './store/effects/node.effects';
|
||||
import { environment } from '../environments/environment';
|
||||
import { RouterEffects } from './store/effects/router.effects';
|
||||
import { CreateFolderDirective } from './directives/create-folder.directive';
|
||||
import { DownloadEffects } from './store/effects/download.effects';
|
||||
import { DownloadNodesDirective } from './directives/download-nodes.directive';
|
||||
import { ViewerEffects } from './store/effects/viewer.effects';
|
||||
import { AppStoreModule } from './store/app-store.module';
|
||||
|
||||
|
||||
@NgModule({
|
||||
@@ -109,17 +97,7 @@ import { ViewerEffects } from './store/effects/viewer.effects';
|
||||
CoreModule,
|
||||
ContentModule,
|
||||
ElectronModule,
|
||||
|
||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
|
||||
StoreRouterConnectingModule.forRoot({ stateKey: 'router' }),
|
||||
EffectsModule.forRoot([
|
||||
SnackbarEffects,
|
||||
NodeEffects,
|
||||
RouterEffects,
|
||||
DownloadEffects,
|
||||
ViewerEffects
|
||||
]),
|
||||
!environment.production ? StoreDevtoolsModule.instrument({ maxAge: 25 }) : []
|
||||
AppStoreModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
@@ -27,7 +27,8 @@ import { Directive, HostListener, Input } from '@angular/core';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { DeleteNodesAction, NodeInfo } from '../../store/actions';
|
||||
import { DeleteNodesAction } from '../../store/actions';
|
||||
import { NodeInfo } from '../../store/models';
|
||||
|
||||
@Directive({
|
||||
selector: '[acaDeleteNode]'
|
||||
|
@@ -30,7 +30,8 @@ import { ConfirmDialogComponent } from '@alfresco/adf-content-services';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { NodeInfo, PurgeDeletedNodesAction } from '../../store/actions';
|
||||
import { PurgeDeletedNodesAction } from '../../store/actions';
|
||||
import { NodeInfo } from '../../store/models';
|
||||
|
||||
@Directive({
|
||||
selector: '[acaPermanentDelete]'
|
||||
|
@@ -32,8 +32,7 @@ import {
|
||||
PathInfoEntity,
|
||||
DeletedNodesPaging
|
||||
} from 'alfresco-js-api';
|
||||
import { DeletedNodeInfo } from './deleted-node-info.interface';
|
||||
import { DeleteStatus } from './delete-status.interface';
|
||||
import { DeleteStatus, DeletedNodeInfo } from '../../store/models';
|
||||
import { ContentManagementService } from '../services/content-management.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Action } from '@ngrx/store';
|
||||
import { NodeInfo } from '../models/node-info.model';
|
||||
|
||||
export const SET_SELECTED_NODES = 'SET_SELECTED_NODES';
|
||||
export const DELETE_NODES = 'DELETE_NODES';
|
||||
@@ -7,14 +8,6 @@ export const RESTORE_DELETED_NODES = 'RESTORE_DELETED_NODES';
|
||||
export const PURGE_DELETED_NODES = 'PURGE_DELETED_NODES';
|
||||
export const DOWNLOAD_NODES = 'DOWNLOAD_NODES';
|
||||
|
||||
export interface NodeInfo {
|
||||
parentId?: string;
|
||||
id: string;
|
||||
name: string;
|
||||
isFile?: boolean;
|
||||
isFolder?: boolean;
|
||||
}
|
||||
|
||||
export class SetSelectedNodesAction implements Action {
|
||||
readonly type = SET_SELECTED_NODES;
|
||||
constructor(public payload: any[] = []) {}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Action } from '@ngrx/store';
|
||||
import { NodeInfo } from './node.action';
|
||||
import { NodeInfo } from '../models';
|
||||
|
||||
export const VIEW_NODE = 'VIEW_NODE';
|
||||
|
||||
|
36
src/app/store/app-store.module.ts
Normal file
36
src/app/store/app-store.module.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
import { appReducer } from './reducers/app.reducer';
|
||||
import { INITIAL_STATE } from './states/app.state';
|
||||
import { StoreRouterConnectingModule } from '@ngrx/router-store';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
||||
import {
|
||||
SnackbarEffects,
|
||||
NodeEffects,
|
||||
RouterEffects,
|
||||
DownloadEffects,
|
||||
ViewerEffects
|
||||
} from './effects';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
StoreModule.forRoot(
|
||||
{ app: appReducer },
|
||||
{ initialState: INITIAL_STATE }
|
||||
),
|
||||
StoreRouterConnectingModule.forRoot({ stateKey: 'router' }),
|
||||
EffectsModule.forRoot([
|
||||
SnackbarEffects,
|
||||
NodeEffects,
|
||||
RouterEffects,
|
||||
DownloadEffects,
|
||||
ViewerEffects
|
||||
]),
|
||||
!environment.production
|
||||
? StoreDevtoolsModule.instrument({ maxAge: 25 })
|
||||
: []
|
||||
]
|
||||
})
|
||||
export class AppStoreModule {}
|
5
src/app/store/effects.ts
Normal file
5
src/app/store/effects.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './effects/download.effects';
|
||||
export * from './effects/node.effects';
|
||||
export * from './effects/router.effects';
|
||||
export * from './effects/snackbar.effects';
|
||||
export * from './effects/viewer.effects';
|
@@ -4,8 +4,8 @@ import { map } from 'rxjs/operators';
|
||||
import { DownloadNodesAction, DOWNLOAD_NODES } from '../actions';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { NodeInfo } from '../actions/node.action';
|
||||
import { DownloadZipDialogComponent } from '@alfresco/adf-content-services';
|
||||
import { NodeInfo } from '../models';
|
||||
|
||||
@Injectable()
|
||||
export class DownloadEffects {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Effect, Actions, ofType } from '@ngrx/effects';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { DeleteStatus } from '../../common/directives/delete-status.interface';
|
||||
import { DeleteStatus, DeletedNodeInfo } from '../../store/models';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../states/app.state';
|
||||
import {
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
SnackbarErrorAction,
|
||||
PurgeDeletedNodesAction,
|
||||
PURGE_DELETED_NODES,
|
||||
NodeInfo,
|
||||
DeleteNodesAction,
|
||||
DELETE_NODES,
|
||||
SnackbarUserAction,
|
||||
@@ -20,8 +19,8 @@ import {
|
||||
} from '../actions';
|
||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { DeletedNodeInfo } from '../../common/directives/deleted-node-info.interface';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { NodeInfo } from '../models';
|
||||
|
||||
@Injectable()
|
||||
export class NodeEffects {
|
||||
|
3
src/app/store/models.ts
Normal file
3
src/app/store/models.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './models/delete-status.model';
|
||||
export * from './models/deleted-node-info.model';
|
||||
export * from './models/node-info.model';
|
32
src/app/store/models/node-info.model.ts
Normal file
32
src/app/store/models/node-info.model.ts
Normal file
@@ -0,0 +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/>.
|
||||
*/
|
||||
|
||||
export interface NodeInfo {
|
||||
parentId?: string;
|
||||
id: string;
|
||||
name: string;
|
||||
isFile?: boolean;
|
||||
isFolder?: boolean;
|
||||
}
|
Reference in New Issue
Block a user