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,
|
||||
SetInitialStateAction,
|
||||
CloseModalDialogsAction,
|
||||
SetRepositoryStatusAction,
|
||||
SetRepositoryInfoAction,
|
||||
SetUserProfileAction
|
||||
} from './store/actions';
|
||||
import {
|
||||
@ -136,7 +136,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
.getRepositoryInformation()
|
||||
.subscribe((response: DiscoveryEntry) => {
|
||||
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/>.
|
||||
*/
|
||||
|
||||
import { RuleContext, RepositoryState } from '@alfresco/adf-extensions';
|
||||
import { RuleContext } from '@alfresco/adf-extensions';
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
|
||||
export interface AppRuleContext extends RuleContext {
|
||||
repository: RepositoryState;
|
||||
repository: RepositoryInfo;
|
||||
auth: AuthenticationService;
|
||||
}
|
||||
|
@ -30,5 +30,5 @@ export function hasQuickShareEnabled(
|
||||
context: AppRuleContext,
|
||||
...args: RuleParameter[]
|
||||
): boolean {
|
||||
return context.repository.isQuickShareEnabled;
|
||||
return context.repository.status.isQuickShareEnabled;
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ import {
|
||||
ExtensionService,
|
||||
ProfileState,
|
||||
mergeObjects,
|
||||
RepositoryState,
|
||||
ExtensionRef
|
||||
} from '@alfresco/adf-extensions';
|
||||
import { AppConfigService, AuthenticationService } from '@alfresco/adf-core';
|
||||
@ -56,6 +55,7 @@ import { DocumentListPresetRef } from './document-list.extensions';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { IconRef } from './icon.extensions';
|
||||
import { AppRuleContext } from './app.interface';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -103,7 +103,7 @@ export class AppExtensionService implements AppRuleContext {
|
||||
selection: SelectionState;
|
||||
navigation: NavigationState;
|
||||
profile: ProfileState;
|
||||
repository: RepositoryState;
|
||||
repository: RepositoryInfo;
|
||||
|
||||
references$: Observable<ExtensionRef[]>;
|
||||
|
||||
|
@ -24,12 +24,11 @@
|
||||
*/
|
||||
|
||||
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 GET_REPOSITORY_STATUS = 'GET_REPOSITORY_STATUS';
|
||||
export const SET_REPOSITORY_INFO = 'SET_REPOSITORY_INFO';
|
||||
|
||||
export class SetRepositoryStatusAction implements Action {
|
||||
readonly type = SET_REPOSITORY_STATUS;
|
||||
constructor(public payload: RepositoryState) {}
|
||||
export class SetRepositoryInfoAction implements Action {
|
||||
readonly type = SET_REPOSITORY_INFO;
|
||||
constructor(public payload: RepositoryInfo) {}
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ import {
|
||||
SetSelectedNodesAction,
|
||||
SET_USER_PROFILE,
|
||||
SetUserProfileAction,
|
||||
SET_REPOSITORY_STATUS,
|
||||
SetRepositoryStatusAction,
|
||||
SET_REPOSITORY_INFO,
|
||||
SetRepositoryInfoAction,
|
||||
SET_LANGUAGE_PICKER,
|
||||
SetLanguagePickerAction,
|
||||
SET_CURRENT_FOLDER,
|
||||
@ -86,10 +86,8 @@ export function appReducer(
|
||||
action
|
||||
));
|
||||
break;
|
||||
case SET_REPOSITORY_STATUS:
|
||||
newState = updateRepositoryStatus(state, <SetRepositoryStatusAction>(
|
||||
action
|
||||
));
|
||||
case SET_REPOSITORY_INFO:
|
||||
newState = updateRepositoryStatus(state, <SetRepositoryInfoAction>action);
|
||||
break;
|
||||
default:
|
||||
newState = Object.assign({}, state);
|
||||
@ -241,7 +239,7 @@ function setInfoDrawer(state: AppState, action: SetInfoDrawerStateAction) {
|
||||
|
||||
function updateRepositoryStatus(
|
||||
state: AppState,
|
||||
action: SetRepositoryStatusAction
|
||||
action: SetRepositoryInfoAction
|
||||
) {
|
||||
const newState = Object.assign({}, state);
|
||||
newState.repository = action.payload;
|
||||
|
@ -90,7 +90,7 @@ export const repositoryStatus = createSelector(
|
||||
|
||||
export const isQuickShareEnabled = createSelector(
|
||||
repositoryStatus,
|
||||
status => status.isQuickShareEnabled
|
||||
info => info.status.isQuickShareEnabled
|
||||
);
|
||||
|
||||
export const isAdmin = createSelector(
|
||||
|
@ -26,9 +26,9 @@
|
||||
import {
|
||||
SelectionState,
|
||||
ProfileState,
|
||||
NavigationState,
|
||||
RepositoryState
|
||||
NavigationState
|
||||
} from '@alfresco/adf-extensions';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
|
||||
export interface AppState {
|
||||
appName: string;
|
||||
@ -41,7 +41,7 @@ export interface AppState {
|
||||
navigation: NavigationState;
|
||||
infoDrawerOpened: boolean;
|
||||
documentDisplayMode: string;
|
||||
repository: RepositoryState;
|
||||
repository: RepositoryInfo;
|
||||
}
|
||||
|
||||
export const INITIAL_APP_STATE: AppState = {
|
||||
@ -67,8 +67,10 @@ export const INITIAL_APP_STATE: AppState = {
|
||||
},
|
||||
infoDrawerOpened: false,
|
||||
documentDisplayMode: 'list',
|
||||
repository: {
|
||||
isQuickShareEnabled: true
|
||||
repository: <any>{
|
||||
status: <any>{
|
||||
isQuickShareEnabled: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user