diff --git a/projects/aca-shared/rules/src/app.rules.ts b/projects/aca-shared/rules/src/app.rules.ts
index cb8c78070..567bac9d8 100644
--- a/projects/aca-shared/rules/src/app.rules.ts
+++ b/projects/aca-shared/rules/src/app.rules.ts
@@ -495,3 +495,16 @@ export function canShowLogout(context: AcaRuleContext): boolean {
export function isLibraryManager(context: RuleContext): boolean {
return hasLibrarySelected(context) && context.selection.library.entry && context.selection.library.entry.role === 'SiteManager';
}
+
+/**
+ * Checks if the preview button for search results can be showed
+ * JSON ref: `canInfoPreview`
+ * @param context Rule execution context
+ */
+export function canInfoPreview(context: RuleContext): boolean {
+ return navigation.isSearchResults(context) && !isMultiselection(context) && !hasFolderSelected(context) && !navigation.isPreview(context);
+}
+
+export function showInfoSelectionButton(context: RuleContext): boolean {
+ return navigation.isSearchResults(context) && !navigation.isPreview(context);
+}
diff --git a/projects/aca-shared/src/lib/components/info-drawer/info-drawer.component.html b/projects/aca-shared/src/lib/components/info-drawer/info-drawer.component.html
index 47e911092..0a309120a 100644
--- a/projects/aca-shared/src/lib/components/info-drawer/info-drawer.component.html
+++ b/projects/aca-shared/src/lib/components/info-drawer/info-drawer.component.html
@@ -9,7 +9,7 @@
>
-
+
diff --git a/projects/aca-shared/src/lib/components/info-drawer/info-drawer.component.ts b/projects/aca-shared/src/lib/components/info-drawer/info-drawer.component.ts
index c1ade264c..96f5beca8 100644
--- a/projects/aca-shared/src/lib/components/info-drawer/info-drawer.component.ts
+++ b/projects/aca-shared/src/lib/components/info-drawer/info-drawer.component.ts
@@ -27,12 +27,11 @@ import { Component, HostListener, Input, OnChanges, OnDestroy, OnInit } from '@a
import { MinimalNodeEntity, MinimalNodeEntryEntity, SiteEntry } from '@alfresco/js-api';
import { ContentActionRef, SidebarTabRef } from '@alfresco/adf-extensions';
import { Store } from '@ngrx/store';
-import { getAppSelection, SetInfoDrawerStateAction, ToggleInfoDrawerAction } from '@alfresco/aca-shared/store';
+import { getAppSelection, SetInfoDrawerStateAction, ToggleInfoDrawerAction, infoDrawerPreview } from '@alfresco/aca-shared/store';
import { AppExtensionService } from '../../services/app.extension.service';
import { ContentApiService } from '../../services/content-api.service';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
-
@Component({
selector: 'aca-info-drawer',
templateUrl: './info-drawer.component.html'
@@ -49,6 +48,7 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
tabs: Array = [];
actions: Array = [];
onDestroy$ = new Subject();
+ preventFromClosing = false;
@HostListener('keydown.escape')
onEscapeKeyboardEvent(): void {
@@ -65,12 +65,21 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
.subscribe(() => {
this.actions = this.extensions.getAllowedSidebarActions();
});
+
+ this.store
+ .select(infoDrawerPreview)
+ .pipe(takeUntil(this.onDestroy$))
+ .subscribe((isInfoDrawerPreviewOpened) => {
+ this.preventFromClosing = isInfoDrawerPreviewOpened;
+ });
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
- this.store.dispatch(new SetInfoDrawerStateAction(false));
+ if (!this.preventFromClosing) {
+ this.store.dispatch(new SetInfoDrawerStateAction(false));
+ }
}
ngOnChanges() {
diff --git a/projects/aca-shared/store/src/actions/app.actions.ts b/projects/aca-shared/store/src/actions/app.actions.ts
index 01679f437..6f4ac3b2a 100644
--- a/projects/aca-shared/store/src/actions/app.actions.ts
+++ b/projects/aca-shared/store/src/actions/app.actions.ts
@@ -44,7 +44,9 @@ export enum AppActionTypes {
SetInfoDrawerState = 'SET_INFO_DRAWER_STATE',
SetInfoDrawerMetadataAspect = 'SET_INFO_DRAWER_METADATA_ASPECT',
CloseModalDialogs = 'CLOSE_MODAL_DIALOGS',
- SetFileUploadingDialog = 'SET_FILE_UPLOADING_DIALOG'
+ SetFileUploadingDialog = 'SET_FILE_UPLOADING_DIALOG',
+ ShowInfoDrawerPreview = 'SHOW_INFO_DRAWER_PREVIEW',
+ SetInfoDrawerPreviewState = 'SET_INFO_DRAWER_PREVIEW_STATE'
}
export class SetSettingsParameterAction implements Action {
@@ -134,3 +136,13 @@ export class SetFileUploadingDialogAction implements Action {
constructor(public payload: boolean) {}
}
+
+export class ShowInfoDrawerPreviewAction implements Action {
+ readonly type = AppActionTypes.ShowInfoDrawerPreview;
+}
+
+export class SetInfoDrawerPreviewStateAction implements Action {
+ readonly type = AppActionTypes.SetInfoDrawerPreviewState;
+
+ constructor(public payload: boolean) {}
+}
diff --git a/projects/aca-shared/store/src/selectors/app.selectors.ts b/projects/aca-shared/store/src/selectors/app.selectors.ts
index 709311fc2..6b57b7113 100644
--- a/projects/aca-shared/store/src/selectors/app.selectors.ts
+++ b/projects/aca-shared/store/src/selectors/app.selectors.ts
@@ -39,6 +39,7 @@ export const getAppSelection = createSelector(selectApp, (state) => state.select
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 getDocumentDisplayMode = createSelector(selectApp, (state) => state.documentDisplayMode);
export const getRepositoryStatus = createSelector(selectApp, (state) => state.repository);
diff --git a/projects/aca-shared/store/src/states/app.state.ts b/projects/aca-shared/store/src/states/app.state.ts
index 9b30803aa..984c8570b 100644
--- a/projects/aca-shared/store/src/states/app.state.ts
+++ b/projects/aca-shared/store/src/states/app.state.ts
@@ -37,6 +37,7 @@ export interface AppState {
user: ProfileState;
navigation: NavigationState;
infoDrawerOpened: boolean;
+ infoDrawerPreview: boolean;
infoDrawerMetadataAspect: string;
showFacetFilter: boolean;
documentDisplayMode: string;
diff --git a/src/app/components/search/search-results/search-results.component.html b/src/app/components/search/search-results/search-results.component.html
index af905470b..04350b64d 100644
--- a/src/app/components/search/search-results/search-results.component.html
+++ b/src/app/components/search/search-results/search-results.component.html
@@ -112,8 +112,33 @@
-