mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
ACS-8404: consolidate application settings (#3952)
This commit is contained in:
@@ -30,14 +30,7 @@ import { BehaviorSubject, of, Subject } from 'rxjs';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { DefaultProjectorFn, MemoizedSelector, Store } from '@ngrx/store';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import {
|
||||
AppStore,
|
||||
isInfoDrawerOpened,
|
||||
NavigateToFolder,
|
||||
NavigateToPreviousPage,
|
||||
SetSelectedNodesAction,
|
||||
STORE_INITIAL_APP_DATA
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { AppStore, isInfoDrawerOpened, NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { NodeEntry, PathElement } from '@alfresco/js-api';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
|
||||
@@ -86,10 +79,6 @@ describe('DetailsComponent', () => {
|
||||
provide: PageTitleService,
|
||||
useValue: {}
|
||||
},
|
||||
{
|
||||
provide: STORE_INITIAL_APP_DATA,
|
||||
useValue: {}
|
||||
},
|
||||
{
|
||||
provide: AuthenticationService,
|
||||
useValue: {
|
||||
|
@@ -31,7 +31,6 @@ import {
|
||||
NavigateToFolder,
|
||||
SetInfoDrawerPreviewStateAction,
|
||||
SetInfoDrawerStateAction,
|
||||
showFacetFilter,
|
||||
ShowInfoDrawerPreviewAction,
|
||||
SnackbarErrorAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
@@ -95,7 +94,6 @@ import { DocumentListPresetRef, DynamicColumnComponent } from '@alfresco/adf-ext
|
||||
styleUrls: ['./search-results.component.scss']
|
||||
})
|
||||
export class SearchResultsComponent extends PageComponent implements OnInit {
|
||||
showFacetFilter$ = this.store.select(showFacetFilter);
|
||||
infoDrawerPreview$ = this.store.select(infoDrawerPreview);
|
||||
|
||||
searchedWord: string;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
(click)="toggleNavBar.emit()"
|
||||
(keypress)="toggleNavBar.emit()">
|
||||
<img
|
||||
src="{{ logo$ | async }}"
|
||||
src="{{ logoUrl }}"
|
||||
title="{{'APP.TOOLTIPS.COLLAPSE_NAVIGATION' | translate}}"
|
||||
alt="{{ 'CORE.HEADER.LOGO_ARIA' | translate }}" />
|
||||
</div>
|
||||
@@ -15,7 +15,7 @@
|
||||
class="aca-sidenav-header-title-text"
|
||||
data-automation-id="app-sidenav-header-title-text"
|
||||
[routerLink]="landingPage">
|
||||
{{ appName$ | async | translate }}
|
||||
{{ appName | translate }}
|
||||
</div>
|
||||
|
||||
<aca-toolbar [items]="actions"></aca-toolbar>
|
||||
|
@@ -23,9 +23,7 @@
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, inject, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Subject } from 'rxjs';
|
||||
import { AppStore, getAppName, getLogoPath } from '@alfresco/aca-shared/store';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { AppExtensionService, AppSettingsService, ToolbarComponent } from '@alfresco/aca-shared';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
@@ -43,12 +41,11 @@ import { RouterModule } from '@angular/router';
|
||||
})
|
||||
export class SidenavHeaderComponent implements OnInit, OnDestroy {
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
private store = inject<Store<AppStore>>(Store);
|
||||
private appSettings = inject(AppSettingsService);
|
||||
private appExtensions = inject(AppExtensionService);
|
||||
|
||||
appName$ = this.store.select(getAppName);
|
||||
logo$ = this.store.select(getLogoPath);
|
||||
appName = this.appSettings.appName;
|
||||
logoUrl = this.appSettings.appLogoUrl;
|
||||
landingPage = this.appSettings.landingPage;
|
||||
actions: Array<ContentActionRef> = [];
|
||||
|
||||
|
@@ -22,13 +22,12 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppHookService, ContentApiService, NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { AppHookService, AppSettingsService, ContentApiService, NodePermissionService } from '@alfresco/aca-shared';
|
||||
import {
|
||||
AppStore,
|
||||
DeletedNodeInfo,
|
||||
DeleteStatus,
|
||||
getAppSelection,
|
||||
getSharedUrl,
|
||||
NavigateRouteAction,
|
||||
NavigateToParentFolder,
|
||||
NodeInfo,
|
||||
@@ -91,7 +90,8 @@ export class ContentManagementService {
|
||||
private nodeAspectService: NodeAspectService,
|
||||
private appHookService: AppHookService,
|
||||
private newVersionUploaderService: NewVersionUploaderService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
private appSettingsService: AppSettingsService
|
||||
) {}
|
||||
|
||||
addFavorite(nodes: Array<NodeEntry>) {
|
||||
@@ -189,27 +189,24 @@ export class ContentManagementService {
|
||||
}
|
||||
}
|
||||
|
||||
openShareLinkDialog(node, focusedElementOnCloseSelector?: string) {
|
||||
this.store
|
||||
.select(getSharedUrl)
|
||||
.pipe(take(1))
|
||||
.subscribe((baseShareUrl) => {
|
||||
this.dialogRef
|
||||
.open(ShareDialogComponent, {
|
||||
restoreFocus: true,
|
||||
width: '600px',
|
||||
panelClass: 'adf-share-link-dialog',
|
||||
data: {
|
||||
node,
|
||||
baseShareUrl
|
||||
}
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe(() => {
|
||||
this.store.dispatch(new SetSelectedNodesAction([node]));
|
||||
this.appHookService.linksUnshared.next();
|
||||
this.focusAfterClose(focusedElementOnCloseSelector);
|
||||
});
|
||||
openShareLinkDialog(node: any, focusedElementOnCloseSelector?: string) {
|
||||
const baseShareUrl = this.appSettingsService.baseShareUrl;
|
||||
|
||||
this.dialogRef
|
||||
.open(ShareDialogComponent, {
|
||||
restoreFocus: true,
|
||||
width: '600px',
|
||||
panelClass: 'adf-share-link-dialog',
|
||||
data: {
|
||||
node,
|
||||
baseShareUrl
|
||||
}
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe(() => {
|
||||
this.store.dispatch(new SetSelectedNodesAction([node]));
|
||||
this.appHookService.linksUnshared.next();
|
||||
this.focusAfterClose(focusedElementOnCloseSelector);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -22,43 +22,4 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppState, AppStore } from '@alfresco/aca-shared/store';
|
||||
|
||||
export const INITIAL_APP_STATE: AppState = {
|
||||
appName: 'Alfresco Content Application',
|
||||
logoPath: 'assets/images/alfresco-logo-white.svg',
|
||||
customCssPath: '',
|
||||
webFontPath: '',
|
||||
sharedUrl: '',
|
||||
user: {
|
||||
isAdmin: null,
|
||||
id: null,
|
||||
firstName: '',
|
||||
lastName: ''
|
||||
},
|
||||
selection: {
|
||||
nodes: [],
|
||||
libraries: [],
|
||||
isEmpty: true,
|
||||
count: 0
|
||||
},
|
||||
navigation: {
|
||||
currentFolder: null
|
||||
},
|
||||
currentNodeVersion: null,
|
||||
infoDrawerOpened: false,
|
||||
infoDrawerPreview: false,
|
||||
infoDrawerMetadataAspect: '',
|
||||
showFacetFilter: true,
|
||||
fileUploadingDialog: true,
|
||||
showLoader: false,
|
||||
repository: {
|
||||
status: {
|
||||
isQuickShareEnabled: true
|
||||
}
|
||||
} as any
|
||||
};
|
||||
|
||||
export const INITIAL_STATE: AppStore = {
|
||||
app: INITIAL_APP_STATE
|
||||
};
|
||||
export { INITIAL_STATE, INITIAL_APP_STATE } from '@alfresco/aca-shared/store';
|
||||
|
@@ -29,7 +29,6 @@ import {
|
||||
SetUserProfileAction,
|
||||
SetCurrentFolderAction,
|
||||
SetCurrentUrlAction,
|
||||
SetInitialStateAction,
|
||||
SetSelectedNodesAction,
|
||||
SetRepositoryInfoAction,
|
||||
SetInfoDrawerStateAction,
|
||||
@@ -38,17 +37,14 @@ import {
|
||||
SetFileUploadingDialogAction,
|
||||
SetInfoDrawerPreviewStateAction,
|
||||
AppActionTypes,
|
||||
ShowLoaderAction
|
||||
ShowLoaderAction,
|
||||
INITIAL_APP_STATE
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { INITIAL_APP_STATE } from '../initial-state';
|
||||
|
||||
export function appReducer(state: AppState = INITIAL_APP_STATE, action: Action): AppState {
|
||||
let newState: AppState;
|
||||
|
||||
switch (action.type) {
|
||||
case AppActionTypes.SetInitialState:
|
||||
newState = { ...(action as SetInitialStateAction).payload };
|
||||
break;
|
||||
case NodeActionTypes.SetSelection:
|
||||
newState = updateSelectedNodes(state, action as SetSelectedNodesAction);
|
||||
break;
|
||||
|
@@ -44,7 +44,6 @@ import { INITIAL_STATE } from '../store/initial-state';
|
||||
import { BehaviorSubject, Observable, Subject, of } from 'rxjs';
|
||||
import { ContentManagementService } from '../services/content-management.service';
|
||||
import { DocumentBasePageService } from '@alfresco/aca-shared';
|
||||
import { STORE_INITIAL_APP_DATA } from '@alfresco/aca-shared/store';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -100,10 +99,6 @@ import { STORE_INITIAL_APP_DATA } from '@alfresco/aca-shared/store';
|
||||
{
|
||||
provide: PageTitleService,
|
||||
useValue: {}
|
||||
},
|
||||
{
|
||||
provide: STORE_INITIAL_APP_DATA,
|
||||
useValue: {}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
Reference in New Issue
Block a user