mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-2215] toggle search filter (#998)
* support for toggling search filter * update docs * disable e2e test * update e2e
This commit is contained in:
parent
22a256f09b
commit
92a5ec44e8
@ -118,3 +118,6 @@ Below is the list of public actions types you can use in the plugin definitions
|
|||||||
| FULLSCREEN_VIEWER | n/a | Enters fullscreen mode to view the file opened in the Viewer. |
|
| FULLSCREEN_VIEWER | n/a | Enters fullscreen mode to view the file opened in the Viewer. |
|
||||||
| LOGOUT | n/a | Log out and redirect to Login screen. |
|
| LOGOUT | n/a | Log out and redirect to Login screen. |
|
||||||
| RELOAD_DOCUMENT_LIST | n/a | Reload active document list |
|
| RELOAD_DOCUMENT_LIST | n/a | Reload active document list |
|
||||||
|
| TOGGLE_SEARCH_FILTER | n/a | Toggle Filter component visibility in Search Results. |
|
||||||
|
| SHOW_SEARCH_FILTER | n/a | Show Filter component in Search Results. |
|
||||||
|
| HIDE_SEARCH_FILTER | n/a | Hide Filter component in Search Results |
|
||||||
|
@ -36,6 +36,7 @@ export class Toolbar extends Component {
|
|||||||
share: `.mat-icon-button[title='Share']`,
|
share: `.mat-icon-button[title='Share']`,
|
||||||
shareEdit: `.mat-icon-button[title='Shared link settings']`,
|
shareEdit: `.mat-icon-button[title='Shared link settings']`,
|
||||||
view: `.mat-icon-button[title='View']`,
|
view: `.mat-icon-button[title='View']`,
|
||||||
|
searchFilterToggle: `.mat-icon-button[title='Toggle search filter']`,
|
||||||
download: `.mat-icon-button[title='Download']`,
|
download: `.mat-icon-button[title='Download']`,
|
||||||
editFolder: 'app.toolbar.editFolder',
|
editFolder: 'app.toolbar.editFolder',
|
||||||
viewDetails: `.mat-icon-button[title='View details']`,
|
viewDetails: `.mat-icon-button[title='View details']`,
|
||||||
@ -52,6 +53,7 @@ export class Toolbar extends Component {
|
|||||||
shareButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.share));
|
shareButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.share));
|
||||||
shareEditButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.shareEdit));
|
shareEditButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.shareEdit));
|
||||||
viewButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.view));
|
viewButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.view));
|
||||||
|
searchFiltersToggleButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.searchFilterToggle));
|
||||||
downloadButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.download));
|
downloadButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.download));
|
||||||
editFolderButton: ElementFinder = this.component.element(by.id(Toolbar.selectors.editFolder));
|
editFolderButton: ElementFinder = this.component.element(by.id(Toolbar.selectors.editFolder));
|
||||||
viewDetailsButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.viewDetails));
|
viewDetailsButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.viewDetails));
|
||||||
@ -71,6 +73,10 @@ export class Toolbar extends Component {
|
|||||||
return count === 0;
|
return count === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async numberOfAvailableActions() {
|
||||||
|
return await this.buttons.count();
|
||||||
|
}
|
||||||
|
|
||||||
async isButtonPresent(title: string) {
|
async isButtonPresent(title: string) {
|
||||||
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
|
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
|
||||||
return await elem.isPresent();
|
return await elem.isPresent();
|
||||||
@ -121,6 +127,10 @@ export class Toolbar extends Component {
|
|||||||
return await browser.isElementPresent(this.viewButton);
|
return await browser.isElementPresent(this.viewButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isToggleSearchFiltersPresent() {
|
||||||
|
return await browser.isElementPresent(this.searchFiltersToggleButton);
|
||||||
|
}
|
||||||
|
|
||||||
async isDownloadPresent() {
|
async isDownloadPresent() {
|
||||||
return await browser.isElementPresent(this.downloadButton);
|
return await browser.isElementPresent(this.downloadButton);
|
||||||
}
|
}
|
||||||
@ -232,7 +242,6 @@ export class Toolbar extends Component {
|
|||||||
return await this.menu.clickMenuItem('Upload new version');
|
return await this.menu.clickMenuItem('Upload new version');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async clickFullScreen() {
|
async clickFullScreen() {
|
||||||
return await this.fullScreenButton.click();
|
return await this.fullScreenButton.click();
|
||||||
}
|
}
|
||||||
|
@ -673,12 +673,13 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('actions are not displayed when no item is selected - [C291815]', async () => {
|
it('nodes actions are not displayed when no item is selected - [C291815]', async () => {
|
||||||
await searchInput.clickSearchButton();
|
await searchInput.clickSearchButton();
|
||||||
await searchInput.checkFilesAndFolders();
|
await searchInput.checkFilesAndFolders();
|
||||||
await searchInput.searchForTextAndCloseSearchOptions(fileInSite);
|
await searchInput.searchForTextAndCloseSearchOptions(fileInSite);
|
||||||
|
|
||||||
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
|
expect(await toolbar.isToggleSearchFiltersPresent()).toBe(true, `Search filter toggle is not displayed`);
|
||||||
|
expect(await toolbar.numberOfAvailableActions()).toBe(1, `more than 1 action is present`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a file is selected - [C291816]', async () => {
|
it('correct actions appear when a file is selected - [C291816]', async () => {
|
||||||
|
@ -13,7 +13,10 @@
|
|||||||
<div class="adf-search-results">
|
<div class="adf-search-results">
|
||||||
<adf-search-filter
|
<adf-search-filter
|
||||||
#searchFilter
|
#searchFilter
|
||||||
[ngClass]="{ 'adf-search-filter--hidden': hideSearchFilter() }"
|
[ngClass]="{
|
||||||
|
'adf-search-filter--hidden':
|
||||||
|
hideSearchFilter() || !(showFacetFilter$ | async)
|
||||||
|
}"
|
||||||
></adf-search-filter>
|
></adf-search-filter>
|
||||||
<div class="adf-search-results__content">
|
<div class="adf-search-results__content">
|
||||||
<mat-progress-bar
|
<mat-progress-bar
|
||||||
|
@ -38,6 +38,8 @@ import { NavigateToFolder } from '../../../store/actions';
|
|||||||
import { AppExtensionService } from '../../../extensions/extension.service';
|
import { AppExtensionService } from '../../../extensions/extension.service';
|
||||||
import { ContentManagementService } from '../../../services/content-management.service';
|
import { ContentManagementService } from '../../../services/content-management.service';
|
||||||
import { AppConfigService } from '@alfresco/adf-core';
|
import { AppConfigService } from '@alfresco/adf-core';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { showFacetFilter } from '../../../store/selectors/app.selectors';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'aca-search-results',
|
selector: 'aca-search-results',
|
||||||
@ -51,6 +53,8 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
|
|||||||
@ViewChild('searchFilter')
|
@ViewChild('searchFilter')
|
||||||
searchFilter: SearchFilterComponent;
|
searchFilter: SearchFilterComponent;
|
||||||
|
|
||||||
|
showFacetFilter$: Observable<boolean>;
|
||||||
|
|
||||||
searchedWord: string;
|
searchedWord: string;
|
||||||
queryParamName = 'q';
|
queryParamName = 'q';
|
||||||
data: NodePaging;
|
data: NodePaging;
|
||||||
@ -73,6 +77,8 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
|
|||||||
skipCount: 0,
|
skipCount: 0,
|
||||||
maxItems: 25
|
maxItems: 25
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.showFacetFilter$ = store.select(showFacetFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -26,8 +26,23 @@
|
|||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
export const SEARCH_BY_TERM = 'SEARCH_BY_TERM';
|
export const SEARCH_BY_TERM = 'SEARCH_BY_TERM';
|
||||||
|
export const TOGGLE_SEARCH_FILTER = 'TOGGLE_SEARCH_FILTER';
|
||||||
|
export const SHOW_SEARCH_FILTER = 'SHOW_SEARCH_FILTER';
|
||||||
|
export const HIDE_SEARCH_FILTER = 'HIDE_SEARCH_FILTER';
|
||||||
|
|
||||||
export class SearchByTermAction implements Action {
|
export class SearchByTermAction implements Action {
|
||||||
readonly type = SEARCH_BY_TERM;
|
readonly type = SEARCH_BY_TERM;
|
||||||
constructor(public payload: string, public searchOptions?: any) {}
|
constructor(public payload: string, public searchOptions?: any) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ToggleSearchFilterAction implements Action {
|
||||||
|
readonly type = TOGGLE_SEARCH_FILTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ShowSearchFilterAction implements Action {
|
||||||
|
readonly type = SHOW_SEARCH_FILTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class HideSearchFilterAction implements Action {
|
||||||
|
readonly type = HIDE_SEARCH_FILTER;
|
||||||
|
}
|
||||||
|
@ -49,6 +49,11 @@ import {
|
|||||||
SET_INITIAL_STATE,
|
SET_INITIAL_STATE,
|
||||||
SetInitialStateAction
|
SetInitialStateAction
|
||||||
} from '../actions/app.actions';
|
} from '../actions/app.actions';
|
||||||
|
import {
|
||||||
|
TOGGLE_SEARCH_FILTER,
|
||||||
|
SHOW_SEARCH_FILTER,
|
||||||
|
HIDE_SEARCH_FILTER
|
||||||
|
} from '../actions/search.actions';
|
||||||
|
|
||||||
export function appReducer(
|
export function appReducer(
|
||||||
state: AppState = INITIAL_APP_STATE,
|
state: AppState = INITIAL_APP_STATE,
|
||||||
@ -89,6 +94,15 @@ export function appReducer(
|
|||||||
case SET_REPOSITORY_INFO:
|
case SET_REPOSITORY_INFO:
|
||||||
newState = updateRepositoryStatus(state, <SetRepositoryInfoAction>action);
|
newState = updateRepositoryStatus(state, <SetRepositoryInfoAction>action);
|
||||||
break;
|
break;
|
||||||
|
case TOGGLE_SEARCH_FILTER:
|
||||||
|
newState = toggleSearchFilter(state);
|
||||||
|
break;
|
||||||
|
case SHOW_SEARCH_FILTER:
|
||||||
|
newState = showSearchFilter(state);
|
||||||
|
break;
|
||||||
|
case HIDE_SEARCH_FILTER:
|
||||||
|
newState = hideSearchFilter(state);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
newState = Object.assign({}, state);
|
newState = Object.assign({}, state);
|
||||||
}
|
}
|
||||||
@ -96,6 +110,24 @@ export function appReducer(
|
|||||||
return newState;
|
return newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleSearchFilter(state: AppState): AppState {
|
||||||
|
const newState = Object.assign({}, state);
|
||||||
|
newState.showFacetFilter = !newState.showFacetFilter;
|
||||||
|
return newState;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideSearchFilter(state: AppState): AppState {
|
||||||
|
const newState = Object.assign({}, state);
|
||||||
|
newState.showFacetFilter = false;
|
||||||
|
return newState;
|
||||||
|
}
|
||||||
|
|
||||||
|
function showSearchFilter(state: AppState): AppState {
|
||||||
|
const newState = Object.assign({}, state);
|
||||||
|
newState.showFacetFilter = true;
|
||||||
|
return newState;
|
||||||
|
}
|
||||||
|
|
||||||
function updateLanguagePicker(
|
function updateLanguagePicker(
|
||||||
state: AppState,
|
state: AppState,
|
||||||
action: SetLanguagePickerAction
|
action: SetLanguagePickerAction
|
||||||
|
@ -78,6 +78,11 @@ export const infoDrawerOpened = createSelector(
|
|||||||
state => state.infoDrawerOpened
|
state => state.infoDrawerOpened
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const showFacetFilter = createSelector(
|
||||||
|
selectApp,
|
||||||
|
state => state.showFacetFilter
|
||||||
|
);
|
||||||
|
|
||||||
export const documentDisplayMode = createSelector(
|
export const documentDisplayMode = createSelector(
|
||||||
selectApp,
|
selectApp,
|
||||||
state => state.documentDisplayMode
|
state => state.documentDisplayMode
|
||||||
|
@ -40,6 +40,7 @@ export interface AppState {
|
|||||||
user: ProfileState;
|
user: ProfileState;
|
||||||
navigation: NavigationState;
|
navigation: NavigationState;
|
||||||
infoDrawerOpened: boolean;
|
infoDrawerOpened: boolean;
|
||||||
|
showFacetFilter: boolean;
|
||||||
documentDisplayMode: string;
|
documentDisplayMode: string;
|
||||||
repository: RepositoryInfo;
|
repository: RepositoryInfo;
|
||||||
}
|
}
|
||||||
@ -66,6 +67,7 @@ export const INITIAL_APP_STATE: AppState = {
|
|||||||
currentFolder: null
|
currentFolder: null
|
||||||
},
|
},
|
||||||
infoDrawerOpened: false,
|
infoDrawerOpened: false,
|
||||||
|
showFacetFilter: true,
|
||||||
documentDisplayMode: 'list',
|
documentDisplayMode: 'list',
|
||||||
repository: <any>{
|
repository: <any>{
|
||||||
status: <any>{
|
status: <any>{
|
||||||
|
@ -417,6 +417,18 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"toolbar": [
|
"toolbar": [
|
||||||
|
{
|
||||||
|
"id": "app.toolbar.searchFilter",
|
||||||
|
"order": 50,
|
||||||
|
"title": "APP.BROWSE.SEARCH.TOGGLE_SEARCH_FILTER",
|
||||||
|
"icon": "view_list",
|
||||||
|
"actions": {
|
||||||
|
"click": "TOGGLE_SEARCH_FILTER"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"visible": "app.navigation.isSearchResults"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "app.toolbar.share",
|
"id": "app.toolbar.share",
|
||||||
"order": 100,
|
"order": 100,
|
||||||
|
@ -168,7 +168,8 @@
|
|||||||
"SIZE": "Size"
|
"SIZE": "Size"
|
||||||
},
|
},
|
||||||
"UNKNOWN_LOCATION": "Unknown",
|
"UNKNOWN_LOCATION": "Unknown",
|
||||||
"NO_RESULTS": "Your search returned 0 results"
|
"NO_RESULTS": "Your search returned 0 results",
|
||||||
|
"TOGGLE_SEARCH_FILTER": "Toggle search filter"
|
||||||
},
|
},
|
||||||
"SEARCH_LIBRARIES": {
|
"SEARCH_LIBRARIES": {
|
||||||
"TITLE": "Libraries found...",
|
"TITLE": "Libraries found...",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user