mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
Prettier upgrade and e2e type checks (#1522)
* upgrade prettier * noImplicitAny rule * fix type * update tsconfig * upgrade to 150 print width
This commit is contained in:
@@ -25,8 +25,7 @@
|
||||
|
||||
import { Action } from '@ngrx/store';
|
||||
|
||||
export const SET_INFO_DRAWER_METADATA_ASPECT =
|
||||
'SET_INFO_DRAWER_METADATA_ASPECT';
|
||||
export const SET_INFO_DRAWER_METADATA_ASPECT = 'SET_INFO_DRAWER_METADATA_ASPECT';
|
||||
|
||||
export class SetInfoDrawerMetadataAspectAction implements Action {
|
||||
readonly type = SET_INFO_DRAWER_METADATA_ASPECT;
|
||||
|
@@ -35,10 +35,7 @@ export enum SearchActionTypes {
|
||||
|
||||
export class SearchByTermAction implements Action {
|
||||
readonly type = SearchActionTypes.SearchByTerm;
|
||||
constructor(
|
||||
public payload: string,
|
||||
public searchOptions?: SearchOptionModel[]
|
||||
) {}
|
||||
constructor(public payload: string, public searchOptions?: SearchOptionModel[]) {}
|
||||
}
|
||||
|
||||
export class ToggleSearchFilterAction implements Action {
|
||||
|
@@ -27,10 +27,7 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import {
|
||||
CloseModalDialogsAction,
|
||||
AppActionTypes
|
||||
} from '../actions/app.actions';
|
||||
import { CloseModalDialogsAction, AppActionTypes } from '../actions/app.actions';
|
||||
|
||||
@Injectable()
|
||||
export class DialogEffects {
|
||||
|
@@ -30,27 +30,17 @@ import { MinimalNodeEntryEntity, PathInfoEntity } from '@alfresco/js-api';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../states/app.state';
|
||||
import {
|
||||
NavigateUrlAction,
|
||||
RouterActionTypes,
|
||||
NavigateRouteAction,
|
||||
NavigateToFolder,
|
||||
NavigateToParentFolder
|
||||
} from '../actions/router.actions';
|
||||
import { NavigateUrlAction, RouterActionTypes, NavigateRouteAction, NavigateToFolder, NavigateToParentFolder } from '../actions/router.actions';
|
||||
import { SnackbarErrorAction } from '../actions/snackbar.actions';
|
||||
|
||||
@Injectable()
|
||||
export class RouterEffects {
|
||||
constructor(
|
||||
private store: Store<AppStore>,
|
||||
private actions$: Actions,
|
||||
private router: Router
|
||||
) {}
|
||||
constructor(private store: Store<AppStore>, private actions$: Actions, private router: Router) {}
|
||||
|
||||
@Effect({ dispatch: false })
|
||||
navigateUrl$ = this.actions$.pipe(
|
||||
ofType<NavigateUrlAction>(RouterActionTypes.NavigateUrl),
|
||||
map(action => {
|
||||
map((action) => {
|
||||
if (action.payload) {
|
||||
this.router.navigateByUrl(action.payload);
|
||||
}
|
||||
@@ -60,7 +50,7 @@ export class RouterEffects {
|
||||
@Effect({ dispatch: false })
|
||||
navigateRoute$ = this.actions$.pipe(
|
||||
ofType<NavigateRouteAction>(RouterActionTypes.NavigateRoute),
|
||||
map(action => {
|
||||
map((action) => {
|
||||
this.router.navigate(action.payload);
|
||||
})
|
||||
);
|
||||
@@ -68,7 +58,7 @@ export class RouterEffects {
|
||||
@Effect({ dispatch: false })
|
||||
navigateToFolder$ = this.actions$.pipe(
|
||||
ofType<NavigateToFolder>(RouterActionTypes.NavigateFolder),
|
||||
map(action => {
|
||||
map((action) => {
|
||||
if (action.payload && action.payload.entry) {
|
||||
this.navigateToFolder(action.payload.entry);
|
||||
}
|
||||
@@ -78,7 +68,7 @@ export class RouterEffects {
|
||||
@Effect({ dispatch: false })
|
||||
navigateToParentFolder$ = this.actions$.pipe(
|
||||
ofType<NavigateToParentFolder>(RouterActionTypes.NavigateParentFolder),
|
||||
map(action => {
|
||||
map((action) => {
|
||||
if (action.payload && action.payload.entry) {
|
||||
this.navigateToParentFolder(action.payload.entry);
|
||||
}
|
||||
@@ -131,18 +121,12 @@ export class RouterEffects {
|
||||
this.router.navigate(link);
|
||||
}, 10);
|
||||
} else {
|
||||
this.store.dispatch(
|
||||
new SnackbarErrorAction('APP.MESSAGES.ERRORS.CANNOT_NAVIGATE_LOCATION')
|
||||
);
|
||||
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.CANNOT_NAVIGATE_LOCATION'));
|
||||
}
|
||||
}
|
||||
|
||||
private isLibraryContent(path: PathInfoEntity): boolean {
|
||||
if (
|
||||
path &&
|
||||
path.elements.length >= 2 &&
|
||||
path.elements[1].name === 'Sites'
|
||||
) {
|
||||
if (path && path.elements.length >= 2 && path.elements[1].name === 'Sites') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -30,13 +30,7 @@ import { Actions, Effect, ofType } from '@ngrx/effects';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { AppStore } from '../states/app.state';
|
||||
import {
|
||||
SnackbarInfoAction,
|
||||
SnackbarActionTypes,
|
||||
SnackbarWarningAction,
|
||||
SnackbarErrorAction,
|
||||
SnackbarAction
|
||||
} from '../actions/snackbar.actions';
|
||||
import { SnackbarInfoAction, SnackbarActionTypes, SnackbarWarningAction, SnackbarErrorAction, SnackbarAction } from '../actions/snackbar.actions';
|
||||
|
||||
@Injectable()
|
||||
export class SnackbarEffects {
|
||||
|
@@ -28,80 +28,29 @@ import { createSelector } from '@ngrx/store';
|
||||
|
||||
export const selectApp = (state: AppStore) => state.app;
|
||||
|
||||
export const getHeaderColor = createSelector(
|
||||
selectApp,
|
||||
state => state.headerColor
|
||||
);
|
||||
export const getHeaderColor = createSelector(selectApp, (state) => state.headerColor);
|
||||
export const getAppName = createSelector(selectApp, (state) => state.appName);
|
||||
export const getLogoPath = createSelector(selectApp, (state) => state.logoPath);
|
||||
export const getHeaderImagePath = createSelector(selectApp, (state) => state.headerImagePath);
|
||||
export const getLanguagePickerState = createSelector(selectApp, (state) => state.languagePicker);
|
||||
export const getUserProfile = createSelector(selectApp, (state) => state.user);
|
||||
export const getCurrentFolder = createSelector(selectApp, (state) => state.navigation.currentFolder);
|
||||
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 showFacetFilter = createSelector(selectApp, (state) => state.showFacetFilter);
|
||||
export const getDocumentDisplayMode = createSelector(selectApp, (state) => state.documentDisplayMode);
|
||||
export const getRepositoryStatus = createSelector(selectApp, (state) => state.repository);
|
||||
export const isQuickShareEnabled = createSelector(getRepositoryStatus, (info) => info.status.isQuickShareEnabled);
|
||||
export const isAdmin = createSelector(selectApp, (state) => state.user.isAdmin);
|
||||
|
||||
export const getAppName = createSelector(selectApp, state => state.appName);
|
||||
export const getLogoPath = createSelector(selectApp, state => state.logoPath);
|
||||
|
||||
export const getHeaderImagePath = createSelector(
|
||||
selectApp,
|
||||
state => state.headerImagePath
|
||||
);
|
||||
|
||||
export const getLanguagePickerState = createSelector(
|
||||
selectApp,
|
||||
state => state.languagePicker
|
||||
);
|
||||
|
||||
export const getUserProfile = createSelector(selectApp, state => state.user);
|
||||
|
||||
export const getCurrentFolder = createSelector(
|
||||
selectApp,
|
||||
state => state.navigation.currentFolder
|
||||
);
|
||||
|
||||
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 showFacetFilter = createSelector(
|
||||
selectApp,
|
||||
state => state.showFacetFilter
|
||||
);
|
||||
|
||||
export const getDocumentDisplayMode = createSelector(
|
||||
selectApp,
|
||||
state => state.documentDisplayMode
|
||||
);
|
||||
|
||||
export const getRepositoryStatus = createSelector(
|
||||
selectApp,
|
||||
state => state.repository
|
||||
);
|
||||
|
||||
export const isQuickShareEnabled = createSelector(
|
||||
getRepositoryStatus,
|
||||
info => info.status.isQuickShareEnabled
|
||||
);
|
||||
|
||||
export const isAdmin = createSelector(selectApp, state => state.user.isAdmin);
|
||||
|
||||
export const getSideNavState = createSelector(
|
||||
getAppSelection,
|
||||
getNavigationState,
|
||||
(selection, navigation) => {
|
||||
return {
|
||||
selection,
|
||||
navigation
|
||||
};
|
||||
}
|
||||
);
|
||||
export const getSideNavState = createSelector(getAppSelection, getNavigationState, (selection, navigation) => {
|
||||
return {
|
||||
selection,
|
||||
navigation
|
||||
};
|
||||
});
|
||||
|
||||
export const getRuleContext = createSelector(
|
||||
getAppSelection,
|
||||
@@ -118,7 +67,4 @@ export const getRuleContext = createSelector(
|
||||
}
|
||||
);
|
||||
|
||||
export const infoDrawerMetadataAspect = createSelector(
|
||||
selectApp,
|
||||
state => state.infoDrawerMetadataAspect
|
||||
);
|
||||
export const infoDrawerMetadataAspect = createSelector(selectApp, (state) => state.infoDrawerMetadataAspect);
|
||||
|
@@ -23,11 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
SelectionState,
|
||||
ProfileState,
|
||||
NavigationState
|
||||
} from '@alfresco/adf-extensions';
|
||||
import { SelectionState, ProfileState, NavigationState } from '@alfresco/adf-extensions';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
|
||||
export interface AppState {
|
||||
|
@@ -30,8 +30,6 @@ import { DialogEffects } from './effects/dialog.effects';
|
||||
import { RouterEffects } from './effects/router.effects';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
EffectsModule.forFeature([SnackbarEffects, DialogEffects, RouterEffects])
|
||||
]
|
||||
imports: [EffectsModule.forFeature([SnackbarEffects, DialogEffects, RouterEffects])]
|
||||
})
|
||||
export class SharedStoreModule {}
|
||||
|
Reference in New Issue
Block a user