@alfresco/aca-content 7.2.0-18457055417 → 7.2.0-18489428076

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ import { ContentApiService, NodePermissionService, AppHookService, AppSettingsSe
10
10
  import * as rules from '@alfresco/aca-shared/rules';
11
11
  import * as i1 from '@ngrx/store';
12
12
  import { Store, createSelector, provideStore } from '@ngrx/store';
13
- import { INITIAL_APP_STATE, AppActionTypes, NodeActionTypes, getRepositoryStatus, getAppSelection, getCurrentVersion, SetSelectedNodesAction, UnlockWriteAction, NavigateRouteAction, ViewNodeVersionAction, RefreshPreviewAction, ShowLoaderAction, NavigateToParentFolder, getCurrentFolder, SetInfoDrawerStateAction, NavigateUrlAction, ViewerActionTypes, SearchActionTypes, SearchOptionIds, LibraryActionTypes, NavigateLibraryAction, UploadActionTypes, CreateFromTemplate, TemplateActionTypes, CreateFromTemplateSuccess, ContextMenuActionTypes, SearchAiActionTypes, RouterEffects, ShareNodeAction, isAdmin, UpdateLibraryAction, infoDrawerMetadataAspect, EditOfflineAction, DownloadNodesAction, isInfoDrawerOpened, ToggleInfoDrawerAction, ViewNodeAction, SearchByTermAiAction, ToggleAISearchInput, showLoaderSelector, SetCurrentFolderAction, UploadFileVersionAction, SearchByTermAction, getSearchItemsTotalCount, infoDrawerPreview, SetSearchItemsTotalCountAction, NavigateToFolder, ShowInfoDrawerPreviewAction, SetInfoDrawerPreviewStateAction, NavigateToPreviousPage, getFileUploadingDialog, getSideNavState } from '@alfresco/aca-shared/store';
13
+ import { INITIAL_APP_STATE, AppActionTypes, NodeActionTypes, getRepositoryStatus, getAppSelection, getCurrentVersion, SetSelectedNodesAction, UnlockWriteAction, NavigateRouteAction, ViewNodeVersionAction, RefreshPreviewAction, ShowLoaderAction, NavigateToParentFolder, getCurrentFolder, SetInfoDrawerStateAction, NavigateUrlAction, ViewerActionTypes, SearchActionTypes, SearchOptionIds, LibraryActionTypes, isAdmin, UploadActionTypes, CreateFromTemplate, TemplateActionTypes, CreateFromTemplateSuccess, ContextMenuActionTypes, SearchAiActionTypes, RouterEffects, ShareNodeAction, UpdateLibraryAction, infoDrawerMetadataAspect, EditOfflineAction, DownloadNodesAction, isInfoDrawerOpened, ToggleInfoDrawerAction, ViewNodeAction, SearchByTermAiAction, ToggleAISearchInput, showLoaderSelector, SetCurrentFolderAction, UploadFileVersionAction, NavigateLibraryAction, SearchByTermAction, getSearchItemsTotalCount, infoDrawerPreview, SetSearchItemsTotalCountAction, NavigateToFolder, ShowInfoDrawerPreviewAction, SetInfoDrawerPreviewStateAction, NavigateToPreviousPage, getFileUploadingDialog, getSideNavState } from '@alfresco/aca-shared/store';
14
14
  export { INITIAL_APP_STATE } from '@alfresco/aca-shared/store';
15
15
  import { provideRouterStore, FullRouterStateSerializer } from '@ngrx/router-store';
16
16
  import * as i1$6 from '@ngrx/effects';
@@ -2980,17 +2980,32 @@ class LibraryEffects {
2980
2980
  });
2981
2981
  }
2982
2982
  })), { dispatch: false });
2983
- createLibrary$ = createEffect(() => this.actions$.pipe(ofType(LibraryActionTypes.Create), mergeMap(() => this.content.createLibrary()), map((libraryId) => new NavigateLibraryAction(libraryId))), { dispatch: true });
2984
- navigateLibrary$ = createEffect(() => this.actions$.pipe(ofType(LibraryActionTypes.Navigate), map((action) => {
2985
- const libraryId = action.payload;
2986
- if (libraryId) {
2987
- this.contentApi
2988
- .getNode(libraryId, { relativePath: '/documentLibrary' })
2989
- .pipe(map((node) => node.entry.id))
2990
- .subscribe((id) => {
2991
- const route = action.route ? action.route : 'libraries';
2983
+ createLibrary$ = createEffect(() => this.actions$.pipe(ofType(LibraryActionTypes.Create), mergeMap(() => this.content.createLibrary()), tap((libraryId) => this.navigateToLibraryById(libraryId))), { dispatch: false });
2984
+ navigateLibrary$ = createEffect(() => this.actions$.pipe(ofType(LibraryActionTypes.Navigate), tap((action) => {
2985
+ const payload = action.payload;
2986
+ if (payload && 'guid' in payload) {
2987
+ this.store
2988
+ .select(isAdmin)
2989
+ .pipe(take(1))
2990
+ .subscribe((isUserAdmin) => {
2991
+ if (!isUserAdmin && payload.visibility !== 'PUBLIC' && !payload.role) {
2992
+ this.notificationService.showError('APP.BROWSE.LIBRARIES.LIBRARY_NO_PERMISSIONS_WARNING');
2993
+ }
2994
+ else {
2995
+ this.navigateToLibraryById(payload.guid, action.route);
2996
+ }
2997
+ });
2998
+ }
2999
+ })), { dispatch: false });
3000
+ navigateToLibraryById(libraryId, route = 'libraries') {
3001
+ this.contentApi
3002
+ .getNode(libraryId, { relativePath: '/documentLibrary' })
3003
+ .pipe(map((node) => node.entry.id), take(1))
3004
+ .subscribe({
3005
+ next: (id) => {
2992
3006
  this.store.dispatch(new NavigateRouteAction([route, id]));
2993
- }, (error) => {
3007
+ },
3008
+ error: (error) => {
2994
3009
  switch (error.status) {
2995
3010
  case 403:
2996
3011
  this.notificationService.showWarning('APP.BROWSE.LIBRARIES.LIBRARY_NO_PERMISSIONS_WARNING');
@@ -3001,9 +3016,9 @@ class LibraryEffects {
3001
3016
  default:
3002
3017
  this.notificationService.showError('APP.BROWSE.LIBRARIES.ERRORS.LIBRARY_LOADING_ERROR');
3003
3018
  }
3004
- });
3005
- }
3006
- })), { dispatch: false });
3019
+ }
3020
+ });
3021
+ }
3007
3022
  updateLibrary$ = createEffect(() => this.actions$.pipe(ofType(LibraryActionTypes.Update), map((action) => {
3008
3023
  this.store
3009
3024
  .select(getAppSelection)
@@ -6627,7 +6642,7 @@ class LibrariesComponent extends PageComponent {
6627
6642
  }
6628
6643
  navigateTo(node) {
6629
6644
  if (node?.entry?.guid) {
6630
- this.store.dispatch(new NavigateLibraryAction(node.entry.guid));
6645
+ this.store.dispatch(new NavigateLibraryAction(node.entry));
6631
6646
  }
6632
6647
  }
6633
6648
  handleNodeClick(event) {
@@ -6714,7 +6729,7 @@ class FavoriteLibrariesComponent extends PageComponent {
6714
6729
  }
6715
6730
  navigateTo(node) {
6716
6731
  if (node?.entry?.guid) {
6717
- this.store.dispatch(new NavigateLibraryAction(node.entry.guid, 'favorite/libraries'));
6732
+ this.store.dispatch(new NavigateLibraryAction(node.entry, 'favorite/libraries'));
6718
6733
  }
6719
6734
  }
6720
6735
  handleNodeClick(event) {
@@ -8006,7 +8021,7 @@ class SearchLibrariesResultsComponent extends PageComponent {
8006
8021
  }
8007
8022
  navigateTo(node) {
8008
8023
  if (node?.entry?.guid) {
8009
- this.store.dispatch(new NavigateLibraryAction(node.entry.guid));
8024
+ this.store.dispatch(new NavigateLibraryAction(node.entry));
8010
8025
  }
8011
8026
  }
8012
8027
  handleNodeClick(event) {