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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user