mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
support repository info with app state (#984)
This commit is contained in:
parent
4ec4012d89
commit
229e23f61d
@ -40,7 +40,7 @@ import {
|
|||||||
SetCurrentUrlAction,
|
SetCurrentUrlAction,
|
||||||
SetInitialStateAction,
|
SetInitialStateAction,
|
||||||
CloseModalDialogsAction,
|
CloseModalDialogsAction,
|
||||||
SetRepositoryStatusAction,
|
SetRepositoryInfoAction,
|
||||||
SetUserProfileAction
|
SetUserProfileAction
|
||||||
} from './store/actions';
|
} from './store/actions';
|
||||||
import {
|
import {
|
||||||
@ -136,7 +136,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
.getRepositoryInformation()
|
.getRepositoryInformation()
|
||||||
.subscribe((response: DiscoveryEntry) => {
|
.subscribe((response: DiscoveryEntry) => {
|
||||||
this.store.dispatch(
|
this.store.dispatch(
|
||||||
new SetRepositoryStatusAction(response.entry.repository.status)
|
new SetRepositoryInfoAction(response.entry.repository)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { RuleContext, RepositoryState } from '@alfresco/adf-extensions';
|
import { RuleContext } from '@alfresco/adf-extensions';
|
||||||
import { AuthenticationService } from '@alfresco/adf-core';
|
import { AuthenticationService } from '@alfresco/adf-core';
|
||||||
|
import { RepositoryInfo } from '@alfresco/js-api';
|
||||||
|
|
||||||
export interface AppRuleContext extends RuleContext {
|
export interface AppRuleContext extends RuleContext {
|
||||||
repository: RepositoryState;
|
repository: RepositoryInfo;
|
||||||
auth: AuthenticationService;
|
auth: AuthenticationService;
|
||||||
}
|
}
|
||||||
|
@ -30,5 +30,5 @@ export function hasQuickShareEnabled(
|
|||||||
context: AppRuleContext,
|
context: AppRuleContext,
|
||||||
...args: RuleParameter[]
|
...args: RuleParameter[]
|
||||||
): boolean {
|
): boolean {
|
||||||
return context.repository.isQuickShareEnabled;
|
return context.repository.status.isQuickShareEnabled;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ import {
|
|||||||
ExtensionService,
|
ExtensionService,
|
||||||
ProfileState,
|
ProfileState,
|
||||||
mergeObjects,
|
mergeObjects,
|
||||||
RepositoryState,
|
|
||||||
ExtensionRef
|
ExtensionRef
|
||||||
} from '@alfresco/adf-extensions';
|
} from '@alfresco/adf-extensions';
|
||||||
import { AppConfigService, AuthenticationService } from '@alfresco/adf-core';
|
import { AppConfigService, AuthenticationService } from '@alfresco/adf-core';
|
||||||
@ -56,6 +55,7 @@ import { DocumentListPresetRef } from './document-list.extensions';
|
|||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { IconRef } from './icon.extensions';
|
import { IconRef } from './icon.extensions';
|
||||||
import { AppRuleContext } from './app.interface';
|
import { AppRuleContext } from './app.interface';
|
||||||
|
import { RepositoryInfo } from '@alfresco/js-api';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -103,7 +103,7 @@ export class AppExtensionService implements AppRuleContext {
|
|||||||
selection: SelectionState;
|
selection: SelectionState;
|
||||||
navigation: NavigationState;
|
navigation: NavigationState;
|
||||||
profile: ProfileState;
|
profile: ProfileState;
|
||||||
repository: RepositoryState;
|
repository: RepositoryInfo;
|
||||||
|
|
||||||
references$: Observable<ExtensionRef[]>;
|
references$: Observable<ExtensionRef[]>;
|
||||||
|
|
||||||
|
@ -24,12 +24,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
import { RepositoryState } from '@alfresco/adf-extensions';
|
import { RepositoryInfo } from '@alfresco/js-api';
|
||||||
|
|
||||||
export const SET_REPOSITORY_STATUS = 'SET_REPOSITORY_STATUS';
|
export const SET_REPOSITORY_INFO = 'SET_REPOSITORY_INFO';
|
||||||
export const GET_REPOSITORY_STATUS = 'GET_REPOSITORY_STATUS';
|
|
||||||
|
|
||||||
export class SetRepositoryStatusAction implements Action {
|
export class SetRepositoryInfoAction implements Action {
|
||||||
readonly type = SET_REPOSITORY_STATUS;
|
readonly type = SET_REPOSITORY_INFO;
|
||||||
constructor(public payload: RepositoryState) {}
|
constructor(public payload: RepositoryInfo) {}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ import {
|
|||||||
SetSelectedNodesAction,
|
SetSelectedNodesAction,
|
||||||
SET_USER_PROFILE,
|
SET_USER_PROFILE,
|
||||||
SetUserProfileAction,
|
SetUserProfileAction,
|
||||||
SET_REPOSITORY_STATUS,
|
SET_REPOSITORY_INFO,
|
||||||
SetRepositoryStatusAction,
|
SetRepositoryInfoAction,
|
||||||
SET_LANGUAGE_PICKER,
|
SET_LANGUAGE_PICKER,
|
||||||
SetLanguagePickerAction,
|
SetLanguagePickerAction,
|
||||||
SET_CURRENT_FOLDER,
|
SET_CURRENT_FOLDER,
|
||||||
@ -86,10 +86,8 @@ export function appReducer(
|
|||||||
action
|
action
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case SET_REPOSITORY_STATUS:
|
case SET_REPOSITORY_INFO:
|
||||||
newState = updateRepositoryStatus(state, <SetRepositoryStatusAction>(
|
newState = updateRepositoryStatus(state, <SetRepositoryInfoAction>action);
|
||||||
action
|
|
||||||
));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
newState = Object.assign({}, state);
|
newState = Object.assign({}, state);
|
||||||
@ -241,7 +239,7 @@ function setInfoDrawer(state: AppState, action: SetInfoDrawerStateAction) {
|
|||||||
|
|
||||||
function updateRepositoryStatus(
|
function updateRepositoryStatus(
|
||||||
state: AppState,
|
state: AppState,
|
||||||
action: SetRepositoryStatusAction
|
action: SetRepositoryInfoAction
|
||||||
) {
|
) {
|
||||||
const newState = Object.assign({}, state);
|
const newState = Object.assign({}, state);
|
||||||
newState.repository = action.payload;
|
newState.repository = action.payload;
|
||||||
|
@ -90,7 +90,7 @@ export const repositoryStatus = createSelector(
|
|||||||
|
|
||||||
export const isQuickShareEnabled = createSelector(
|
export const isQuickShareEnabled = createSelector(
|
||||||
repositoryStatus,
|
repositoryStatus,
|
||||||
status => status.isQuickShareEnabled
|
info => info.status.isQuickShareEnabled
|
||||||
);
|
);
|
||||||
|
|
||||||
export const isAdmin = createSelector(
|
export const isAdmin = createSelector(
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
import {
|
import {
|
||||||
SelectionState,
|
SelectionState,
|
||||||
ProfileState,
|
ProfileState,
|
||||||
NavigationState,
|
NavigationState
|
||||||
RepositoryState
|
|
||||||
} from '@alfresco/adf-extensions';
|
} from '@alfresco/adf-extensions';
|
||||||
|
import { RepositoryInfo } from '@alfresco/js-api';
|
||||||
|
|
||||||
export interface AppState {
|
export interface AppState {
|
||||||
appName: string;
|
appName: string;
|
||||||
@ -41,7 +41,7 @@ export interface AppState {
|
|||||||
navigation: NavigationState;
|
navigation: NavigationState;
|
||||||
infoDrawerOpened: boolean;
|
infoDrawerOpened: boolean;
|
||||||
documentDisplayMode: string;
|
documentDisplayMode: string;
|
||||||
repository: RepositoryState;
|
repository: RepositoryInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INITIAL_APP_STATE: AppState = {
|
export const INITIAL_APP_STATE: AppState = {
|
||||||
@ -67,9 +67,11 @@ export const INITIAL_APP_STATE: AppState = {
|
|||||||
},
|
},
|
||||||
infoDrawerOpened: false,
|
infoDrawerOpened: false,
|
||||||
documentDisplayMode: 'list',
|
documentDisplayMode: 'list',
|
||||||
repository: {
|
repository: <any>{
|
||||||
|
status: <any>{
|
||||||
isQuickShareEnabled: true
|
isQuickShareEnabled: true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface AppStore {
|
export interface AppStore {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user