diff --git a/app/src/app.config.json b/app/src/app.config.json index 84af6795fa..62c09f205e 100644 --- a/app/src/app.config.json +++ b/app/src/app.config.json @@ -39,8 +39,6 @@ "copyright": "APP.COPYRIGHT" }, "viewer.maxRetries": 1, - "customCssPath": "", - "webFontPath": "", "pagination": { "size": 25, "supportedPageSizes": [25, 50, 100] diff --git a/app/src/app/app.module.ts b/app/src/app/app.module.ts index 19e23f18a0..e0e2189778 100644 --- a/app/src/app/app.module.ts +++ b/app/src/app/app.module.ts @@ -51,15 +51,8 @@ import localeSv from '@angular/common/locales/sv'; import { TranslateModule } from '@ngx-translate/core'; import { RouterModule } from '@angular/router'; import { AppComponent } from './app.components'; -import { - ContentUrlService, - INITIAL_APP_STATE, - CONTENT_LAYOUT_ROUTES, - ContentServiceExtensionModule, - CoreExtensionsModule -} from '@alfresco/aca-content'; +import { ContentUrlService, CONTENT_LAYOUT_ROUTES, ContentServiceExtensionModule, CoreExtensionsModule } from '@alfresco/aca-content'; import { ContentVersionService } from '@alfresco/adf-content-services'; -import { STORE_INITIAL_APP_DATA } from '@alfresco/aca-shared/store'; import { ShellModule, SHELL_APP_SERVICE, SHELL_AUTH_TOKEN } from '@alfresco/adf-core/shell'; import { StoreDevtoolsModule } from '@ngrx/store-devtools'; import { APP_ROUTES } from './app.routes'; @@ -112,10 +105,6 @@ registerLocaleData(localeSv); provide: SHELL_AUTH_TOKEN, useClass: AuthGuard }, - { - provide: STORE_INITIAL_APP_DATA, - useValue: INITIAL_APP_STATE - }, { provide: TRANSLATION_PROVIDER, multi: true, diff --git a/karma.conf.js b/karma.conf.js index ee90a2d143..cfc277142e 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -59,7 +59,7 @@ module.exports = () => { global: { statements: 75, branches: 67, - functions: 72, + functions: 71, lines: 74 } } diff --git a/projects/aca-content/src/lib/components/details/details.component.spec.ts b/projects/aca-content/src/lib/components/details/details.component.spec.ts index aec571cac2..df79c005ce 100644 --- a/projects/aca-content/src/lib/components/details/details.component.spec.ts +++ b/projects/aca-content/src/lib/components/details/details.component.spec.ts @@ -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: { diff --git a/projects/aca-content/src/lib/components/search/search-results/search-results.component.ts b/projects/aca-content/src/lib/components/search/search-results/search-results.component.ts index 981e97b499..b5d6173077 100644 --- a/projects/aca-content/src/lib/components/search/search-results/search-results.component.ts +++ b/projects/aca-content/src/lib/components/search/search-results/search-results.component.ts @@ -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; diff --git a/projects/aca-content/src/lib/components/sidenav/components/sidenav-header.component.html b/projects/aca-content/src/lib/components/sidenav/components/sidenav-header.component.html index eddcc32a5c..886537acb9 100644 --- a/projects/aca-content/src/lib/components/sidenav/components/sidenav-header.component.html +++ b/projects/aca-content/src/lib/components/sidenav/components/sidenav-header.component.html @@ -6,7 +6,7 @@ (click)="toggleNavBar.emit()" (keypress)="toggleNavBar.emit()"> {{ 'CORE.HEADER.LOGO_ARIA' | translate }} @@ -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 }} diff --git a/projects/aca-content/src/lib/components/sidenav/components/sidenav-header.component.ts b/projects/aca-content/src/lib/components/sidenav/components/sidenav-header.component.ts index bf180a6042..294d66f477 100644 --- a/projects/aca-content/src/lib/components/sidenav/components/sidenav-header.component.ts +++ b/projects/aca-content/src/lib/components/sidenav/components/sidenav-header.component.ts @@ -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(); - private store = inject>(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 = []; diff --git a/projects/aca-content/src/lib/services/content-management.service.ts b/projects/aca-content/src/lib/services/content-management.service.ts index a1e5e0839c..a7f70d4cd4 100644 --- a/projects/aca-content/src/lib/services/content-management.service.ts +++ b/projects/aca-content/src/lib/services/content-management.service.ts @@ -22,13 +22,12 @@ * from Hyland Software. If not, see . */ -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) { @@ -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); }); } diff --git a/projects/aca-content/src/lib/store/initial-state.ts b/projects/aca-content/src/lib/store/initial-state.ts index 3ea831161c..05977a05f5 100644 --- a/projects/aca-content/src/lib/store/initial-state.ts +++ b/projects/aca-content/src/lib/store/initial-state.ts @@ -22,43 +22,4 @@ * from Hyland Software. If not, see . */ -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'; diff --git a/projects/aca-content/src/lib/store/reducers/app.reducer.ts b/projects/aca-content/src/lib/store/reducers/app.reducer.ts index 52bdf8e725..73cf64ef71 100644 --- a/projects/aca-content/src/lib/store/reducers/app.reducer.ts +++ b/projects/aca-content/src/lib/store/reducers/app.reducer.ts @@ -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; diff --git a/projects/aca-content/src/lib/testing/app-testing.module.ts b/projects/aca-content/src/lib/testing/app-testing.module.ts index 1cb6ae27fb..d440b2fa6d 100644 --- a/projects/aca-content/src/lib/testing/app-testing.module.ts +++ b/projects/aca-content/src/lib/testing/app-testing.module.ts @@ -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: {} } ] }) diff --git a/projects/aca-shared/src/lib/components/document-base-page/document-base-page.component.ts b/projects/aca-shared/src/lib/components/document-base-page/document-base-page.component.ts index fe17f45c29..ed28b2950e 100644 --- a/projects/aca-shared/src/lib/components/document-base-page/document-base-page.component.ts +++ b/projects/aca-shared/src/lib/components/document-base-page/document-base-page.component.ts @@ -37,7 +37,6 @@ import { getCurrentFolder, getAppSelection, isInfoDrawerOpened, - getSharedUrl, ViewNodeAction, ViewNodeExtras, SetSelectedNodesAction @@ -60,7 +59,6 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges { infoDrawerOpened$: Observable; node: Node; selection: SelectionState; - sharedPreviewUrl$: Observable; actions: Array = []; viewerToolbarActions: Array = []; canUpdateNode = false; @@ -89,7 +87,6 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges { this.createActions = actions; }); - this.sharedPreviewUrl$ = this.store.select(getSharedUrl); this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened); this.store diff --git a/projects/aca-shared/src/lib/services/app-settings.service.ts b/projects/aca-shared/src/lib/services/app-settings.service.ts index 281751826f..4a37168d8d 100644 --- a/projects/aca-shared/src/lib/services/app-settings.service.ts +++ b/projects/aca-shared/src/lib/services/app-settings.service.ts @@ -51,4 +51,50 @@ export class AppSettingsService { get mimeTypes(): AlfrescoMimeType[] { return this.appConfig.get('mimeTypes', DefaultMimeTypes); } + + /** + * Get the application name from the app settings. + */ + get appName(): string { + return this.appConfig.get('application.name', 'Alfresco Content Application'); + } + + /** + * Get the application version from the app settings. + */ + get appVersion(): string { + return this.appConfig.get('application.version', '1.0.0'); + } + + /** + * Get the application logo URL from the app settings. + */ + get appLogoUrl(): string { + return this.appConfig.get('application.logo', 'assets/images/app-logo.svg'); + } + + /** + * Get the custom CSS stylesheet path from the app settings. + */ + get customCssPath(): string { + return this.appConfig.get('customCssPath', ''); + } + + /** + * Get the custom web font path from the app settings. + */ + get webFontPath(): string { + return this.appConfig.get('webFontPath', ''); + } + + /** + * Get the base share URL from the app settings. + */ + get baseShareUrl(): string { + let result = this.appConfig.get('baseShareUrl', ''); + if (!result.endsWith('/')) { + result += '/'; + } + return result; + } } diff --git a/projects/aca-shared/src/lib/services/app.service.spec.ts b/projects/aca-shared/src/lib/services/app.service.spec.ts index 2787e6a3e5..acedcac914 100644 --- a/projects/aca-shared/src/lib/services/app.service.spec.ts +++ b/projects/aca-shared/src/lib/services/app.service.spec.ts @@ -45,7 +45,6 @@ import { UploadService } from '@alfresco/adf-content-services'; import { ActivatedRoute } from '@angular/router'; -import { STORE_INITIAL_APP_DATA } from '../../../store/src/states/app.state'; import { provideMockStore } from '@ngrx/store/testing'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; @@ -53,9 +52,9 @@ import { RepositoryInfo, VersionInfo } from '@alfresco/js-api'; import { MatDialogModule } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; import { Store } from '@ngrx/store'; -import { SnackbarErrorAction } from '../../../store/src/actions/snackbar.actions'; import { ContentApiService } from './content-api.service'; -import { SetRepositoryInfoAction, SetUserProfileAction } from '../../../store/src/actions/app.actions'; +import { SetRepositoryInfoAction, SetUserProfileAction, SnackbarErrorAction } from '@alfresco/aca-shared/store'; +import { AppSettingsService } from '@alfresco/aca-shared'; describe('AppService', () => { let service: AppService; @@ -68,6 +67,7 @@ describe('AppService', () => { let contentApi: ContentApiService; let groupService: GroupService; let preferencesService: UserPreferencesService; + let appSettingsService: AppSettingsService; beforeEach(() => { TestBed.configureTestingModule({ @@ -99,10 +99,6 @@ describe('AppService', () => { snapshot: {} } }, - { - provide: STORE_INITIAL_APP_DATA, - useValue: {} - }, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock @@ -121,6 +117,7 @@ describe('AppService', () => { ] }); + appSettingsService = TestBed.inject(AppSettingsService); appConfig = TestBed.inject(AppConfigService); auth = TestBed.inject(AuthenticationService); searchQueryBuilderService = TestBed.inject(SearchQueryBuilderService); @@ -172,7 +169,7 @@ describe('AppService', () => { await expect(resetToDefaults).toHaveBeenCalled(); }); - it('should rase notification on share link error', () => { + it('should raise notification on share link error', () => { spyOn(store, 'select').and.returnValue(of('')); service.init(); const dispatch = spyOn(store, 'dispatch'); @@ -216,7 +213,7 @@ describe('AppService', () => { it('should load custom css', () => { const appendChild = spyOn(document.head, 'appendChild'); - spyOn(store, 'select').and.returnValue(of('/custom.css')); + spyOnProperty(appSettingsService, 'customCssPath').and.returnValue('/custom.css'); service.init(); const cssLinkElement = document.createElement('link'); diff --git a/projects/aca-shared/src/lib/services/app.service.ts b/projects/aca-shared/src/lib/services/app.service.ts index 9f41bd3dd8..f0a2238ff8 100644 --- a/projects/aca-shared/src/lib/services/app.service.ts +++ b/projects/aca-shared/src/lib/services/app.service.ts @@ -22,7 +22,7 @@ * from Hyland Software. If not, see . */ -import { Inject, Injectable, OnDestroy } from '@angular/core'; +import { Injectable, OnDestroy } from '@angular/core'; import { AuthenticationService, AppConfigService, AlfrescoApiService, PageTitleService, UserPreferencesService } from '@alfresco/adf-core'; import { Observable, BehaviorSubject, Subject } from 'rxjs'; import { GroupService, SearchQueryBuilderService, SharedLinksApiService, UploadService, FileUploadErrorEvent } from '@alfresco/adf-content-services'; @@ -30,14 +30,9 @@ import { OverlayContainer } from '@angular/cdk/overlay'; import { ActivatedRoute, ActivationEnd, NavigationStart, Router } from '@angular/router'; import { filter, map, tap } from 'rxjs/operators'; import { - AppState, AppStore, CloseModalDialogsAction, - getCustomCssPath, - getCustomWebFontPath, - STORE_INITIAL_APP_DATA, SetCurrentUrlAction, - SetInitialStateAction, SetRepositoryInfoAction, SetUserProfileAction, SnackbarErrorAction, @@ -48,12 +43,14 @@ import { RouterExtensionService } from './router.extension.service'; import { Store } from '@ngrx/store'; import { DiscoveryEntry, GroupEntry, Group } from '@alfresco/js-api'; import { AcaMobileAppSwitcherService } from './aca-mobile-app-switcher.service'; +import { ShellAppService } from '@alfresco/adf-core/shell'; +import { AppSettingsService } from './app-settings.service'; @Injectable({ providedIn: 'root' }) // After moving shell to ADF to core, AppService will implement ShellAppService -export class AppService implements OnDestroy { +export class AppService implements ShellAppService, OnDestroy { private ready: BehaviorSubject; ready$: Observable; @@ -89,9 +86,9 @@ export class AppService implements OnDestroy { private sharedLinksApiService: SharedLinksApiService, private groupService: GroupService, private overlayContainer: OverlayContainer, - @Inject(STORE_INITIAL_APP_DATA) private initialAppState: AppState, searchQueryBuilderService: SearchQueryBuilderService, - private acaMobileAppSwitcherService: AcaMobileAppSwitcherService + private acaMobileAppSwitcherService: AcaMobileAppSwitcherService, + private appSettingsService: AppSettingsService ) { this.ready = new BehaviorSubject(this.authenticationService.isLoggedIn() || this.withCredentials); this.ready$ = this.ready.asObservable(); @@ -137,8 +134,6 @@ export class AppService implements OnDestroy { } }); - this.loadAppSettings(); - this.loadCustomCss(); this.loadCustomWebFont(); @@ -202,24 +197,6 @@ export class AppService implements OnDestroy { }); } - loadAppSettings() { - let baseShareUrl = this.config.get('baseShareUrl', ''); - if (!baseShareUrl.endsWith('/')) { - baseShareUrl += '/'; - } - - const state: AppState = { - ...this.initialAppState, - appName: this.config.get('application.name'), - logoPath: this.config.get('application.logo'), - customCssPath: this.config.get('customCssPath'), - webFontPath: this.config.get('webFontPath'), - sharedUrl: baseShareUrl - }; - - this.store.dispatch(new SetInitialStateAction(state)); - } - onFileUploadedError(error: FileUploadErrorEvent) { let message = 'APP.MESSAGES.UPLOAD.ERROR.GENERIC'; @@ -247,19 +224,17 @@ export class AppService implements OnDestroy { } private loadCustomCss(): void { - this.store.select(getCustomCssPath).subscribe((cssPath) => { - if (cssPath) { - this.createLink(cssPath); - } - }); + const customCssPath = this.appSettingsService.customCssPath; + if (customCssPath) { + this.createLink(customCssPath); + } } private loadCustomWebFont(): void { - this.store.select(getCustomWebFontPath).subscribe((fontUrl) => { - if (fontUrl) { - this.createLink(fontUrl); - } - }); + const webFontPath = this.appSettingsService.webFontPath; + if (webFontPath) { + this.createLink(webFontPath); + } } private createLink(url: string): void { diff --git a/projects/aca-shared/store/src/actions/app-action-types.ts b/projects/aca-shared/store/src/actions/app-action-types.ts index 016d9a5502..6aef4a830b 100644 --- a/projects/aca-shared/store/src/actions/app-action-types.ts +++ b/projects/aca-shared/store/src/actions/app-action-types.ts @@ -23,7 +23,6 @@ */ export enum AppActionTypes { - SetInitialState = 'SET_INITIAL_STATE', SetCurrentFolder = 'SET_CURRENT_FOLDER', SetCurrentVersion = 'SET_CURRENT_VERSION', SetCurrentUrl = 'SET_CURRENT_URL', diff --git a/projects/aca-shared/store/src/actions/app.actions.ts b/projects/aca-shared/store/src/actions/app.actions.ts index c957ae64b9..402216d4ca 100644 --- a/projects/aca-shared/store/src/actions/app.actions.ts +++ b/projects/aca-shared/store/src/actions/app.actions.ts @@ -24,15 +24,8 @@ import { Action } from '@ngrx/store'; import { Node, Person, Group, RepositoryInfo, VersionEntry } from '@alfresco/js-api'; -import { AppState } from '../states/app.state'; import { AppActionTypes } from './app-action-types'; -export class SetInitialStateAction implements Action { - readonly type = AppActionTypes.SetInitialState; - - constructor(public payload: AppState) {} -} - export class SetCurrentFolderAction implements Action { readonly type = AppActionTypes.SetCurrentFolder; diff --git a/projects/aca-shared/store/src/selectors/app.selectors.ts b/projects/aca-shared/store/src/selectors/app.selectors.ts index bffd6861c0..3271dfabb7 100644 --- a/projects/aca-shared/store/src/selectors/app.selectors.ts +++ b/projects/aca-shared/store/src/selectors/app.selectors.ts @@ -28,19 +28,13 @@ import { createSelector } from '@ngrx/store'; const HXI_CONNECTOR = 'alfresco-hxinsight-connector-prediction-applier-extension'; export const selectApp = (state: AppStore) => state.app; -export const getAppName = createSelector(selectApp, (state) => state.appName); -export const getLogoPath = createSelector(selectApp, (state) => state.logoPath); -export const getCustomCssPath = createSelector(selectApp, (state) => state.customCssPath); -export const getCustomWebFontPath = createSelector(selectApp, (state) => state.webFontPath); export const getUserProfile = createSelector(selectApp, (state) => state.user); export const getCurrentFolder = createSelector(selectApp, (state) => state.navigation.currentFolder); export const getCurrentVersion = createSelector(selectApp, (state) => state.currentNodeVersion); export const getAppSelection = createSelector(selectApp, (state) => state.selection); -export const getSharedUrl = createSelector(selectApp, (state) => state.sharedUrl); export const getNavigationState = createSelector(selectApp, (state) => state.navigation); export const isInfoDrawerOpened = createSelector(selectApp, (state) => state.infoDrawerOpened); export const infoDrawerPreview = createSelector(selectApp, (state) => state.infoDrawerPreview); -export const showFacetFilter = createSelector(selectApp, (state) => state.showFacetFilter); export const getRepositoryStatus = createSelector(selectApp, (state) => state.repository); export const isQuickShareEnabled = createSelector(getRepositoryStatus, (info) => info.status.isQuickShareEnabled); export const isHXIConnectorEnabled = createSelector(getRepositoryStatus, (info) => !!info?.modules?.find((module) => module.id === HXI_CONNECTOR)); diff --git a/projects/aca-shared/store/src/states/app.state.ts b/projects/aca-shared/store/src/states/app.state.ts index 45f2af4d22..e19ca048f0 100644 --- a/projects/aca-shared/store/src/states/app.state.ts +++ b/projects/aca-shared/store/src/states/app.state.ts @@ -26,14 +26,44 @@ import { SelectionState, ProfileState, NavigationState } from '@alfresco/adf-ext import { RepositoryInfo, VersionEntry } from '@alfresco/js-api'; import { InjectionToken } from '@angular/core'; +/** @deprecated no longer used */ export const STORE_INITIAL_APP_DATA = new InjectionToken('STORE_INITIAL_APP_DATA'); +export const INITIAL_APP_STATE: AppState = { + user: { + isAdmin: null, + id: null, + firstName: '', + lastName: '' + }, + selection: { + nodes: [], + libraries: [], + isEmpty: true, + count: 0 + }, + navigation: { + currentFolder: null + }, + currentNodeVersion: null, + infoDrawerOpened: false, + infoDrawerPreview: false, + infoDrawerMetadataAspect: '', + fileUploadingDialog: true, + showLoader: false, + repository: { + status: { + isQuickShareEnabled: true + } + } as any +}; + +/** @deprecated no longer used */ +export const INITIAL_STATE: AppStore = { + app: INITIAL_APP_STATE +}; + export interface AppState { - appName: string; - logoPath: string; - customCssPath: string; - webFontPath: string; - sharedUrl: string; currentNodeVersion: VersionEntry; selection: SelectionState; user: ProfileState; @@ -41,7 +71,6 @@ export interface AppState { infoDrawerOpened: boolean; infoDrawerPreview: boolean; infoDrawerMetadataAspect: string; - showFacetFilter: boolean; repository: RepositoryInfo; fileUploadingDialog: boolean; showLoader: boolean;