mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
ACS-8404: consolidate application settings (#3952)
This commit is contained in:
parent
74384f09f8
commit
2ff54affb2
@ -39,8 +39,6 @@
|
||||
"copyright": "APP.COPYRIGHT"
|
||||
},
|
||||
"viewer.maxRetries": 1,
|
||||
"customCssPath": "",
|
||||
"webFontPath": "",
|
||||
"pagination": {
|
||||
"size": 25,
|
||||
"supportedPageSizes": [25, 50, 100]
|
||||
|
@ -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,
|
||||
|
@ -59,7 +59,7 @@ module.exports = () => {
|
||||
global: {
|
||||
statements: 75,
|
||||
branches: 67,
|
||||
functions: 72,
|
||||
functions: 71,
|
||||
lines: 74
|
||||
}
|
||||
}
|
||||
|
@ -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: {}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
@ -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<boolean>;
|
||||
node: Node;
|
||||
selection: SelectionState;
|
||||
sharedPreviewUrl$: Observable<string>;
|
||||
actions: Array<ContentActionRef> = [];
|
||||
viewerToolbarActions: Array<ContentActionRef> = [];
|
||||
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
|
||||
|
@ -51,4 +51,50 @@ export class AppSettingsService {
|
||||
get mimeTypes(): AlfrescoMimeType[] {
|
||||
return this.appConfig.get<AlfrescoMimeType[]>('mimeTypes', DefaultMimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application name from the app settings.
|
||||
*/
|
||||
get appName(): string {
|
||||
return this.appConfig.get<string>('application.name', 'Alfresco Content Application');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application version from the app settings.
|
||||
*/
|
||||
get appVersion(): string {
|
||||
return this.appConfig.get<string>('application.version', '1.0.0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application logo URL from the app settings.
|
||||
*/
|
||||
get appLogoUrl(): string {
|
||||
return this.appConfig.get<string>('application.logo', 'assets/images/app-logo.svg');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom CSS stylesheet path from the app settings.
|
||||
*/
|
||||
get customCssPath(): string {
|
||||
return this.appConfig.get<string>('customCssPath', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom web font path from the app settings.
|
||||
*/
|
||||
get webFontPath(): string {
|
||||
return this.appConfig.get<string>('webFontPath', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base share URL from the app settings.
|
||||
*/
|
||||
get baseShareUrl(): string {
|
||||
let result = this.appConfig.get<string>('baseShareUrl', '');
|
||||
if (!result.endsWith('/')) {
|
||||
result += '/';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -22,7 +22,7 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<boolean>;
|
||||
|
||||
ready$: Observable<boolean>;
|
||||
@ -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<string>('baseShareUrl', '');
|
||||
if (!baseShareUrl.endsWith('/')) {
|
||||
baseShareUrl += '/';
|
||||
}
|
||||
|
||||
const state: AppState = {
|
||||
...this.initialAppState,
|
||||
appName: this.config.get<string>('application.name'),
|
||||
logoPath: this.config.get<string>('application.logo'),
|
||||
customCssPath: this.config.get<string>('customCssPath'),
|
||||
webFontPath: this.config.get<string>('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 {
|
||||
|
@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
export enum AppActionTypes {
|
||||
SetInitialState = 'SET_INITIAL_STATE',
|
||||
SetCurrentFolder = 'SET_CURRENT_FOLDER',
|
||||
SetCurrentVersion = 'SET_CURRENT_VERSION',
|
||||
SetCurrentUrl = 'SET_CURRENT_URL',
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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<AppState>('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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user