[ADF-3713] Implement Search radio component tests (#3948)

* [ADF-3713] Implement Search radio component tests

* Fixing the double quotes and whitespaces

* Changing names of methods

* More renamings

* Removing trailing whitespace

* Refactoring of search filters tests

* Small changes
This commit is contained in:
jdosti
2018-11-20 00:41:07 +00:00
committed by Eugenio Romano
parent c2bdbba0dc
commit 6e8677a768
9 changed files with 679 additions and 189 deletions

View File

@@ -23,7 +23,7 @@ import { DatePickerPage } from '../../../pages/adf/material/datePickerPage';
import { NavigationBarPage } from '../../../pages/adf/navigationBarPage';
import { ConfigEditorPage } from '../../../pages/adf/configEditorPage';
import { SearchFiltersPage } from '../../../pages/adf/searchFiltersPage';
import path = require('path');
import { SearchConfiguration } from '../search.config';
import TestConfig = require('../../../test.config');
@@ -95,7 +95,7 @@ describe('Search Filters', () => {
});
});
it('[C277119] FROM and TO dates should depend on each other', () => {
it('[C277119] FROM and TO dates should depend on each other', () => {
dateRangeFilter.checkFromDateToggleIsDisplayed().openFromDatePicker()
.checkDatesAfterDateAreDisabled(new Date())
.closeDatePicker();
@@ -200,28 +200,37 @@ describe('Search Filters', () => {
.checkFromErrorMessageIsNotDisplayed();
});
it('[C277117] Should be able to change date format', () => {
let json = JSON.parse(require('fs').readFileSync(path.join(TestConfig.main.rootPath, '/content-services/search/search.config.json'), 'utf8'));
json.categories[4].component.settings.dateFormat = 'MM-DD-YY';
describe('configuration change', () => {
navigationBar.clickConfigEditorButton();
configEditor.clickSearchConfiguration();
configEditor.clickClearButton();
configEditor.enterBigConfigurationText(JSON.stringify(json));
configEditor.clickSaveButton();
let jsonFile;
searchDialog.clickOnSearchIcon().enterTextAndPressEnter('*');
searchFilters.checkCreatedRangeFilterIsDisplayed()
.clickCreatedRangeFilterHeader()
.checkCreatedRangeFilterIsExpanded();
dateRangeFilter.checkFromFieldIsDisplayed()
.openFromDatePicker();
beforeAll(() => {
let searchConfiguration = new SearchConfiguration();
jsonFile = searchConfiguration.getConfiguration();
});
let todayDate = datePicker.convertDateToNewFormat(new Date());
datePicker.selectTodayDate();
it('[C277117] Should be able to change date format', () => {
jsonFile.categories[4].component.settings.dateFormat = 'MM-DD-YY';
browser.controlFlow().execute(async () => {
await expect(dateRangeFilter.getFromDate()).toEqual(todayDate);
navigationBar.clickConfigEditorButton();
configEditor.clickSearchConfiguration();
configEditor.clickClearButton();
configEditor.enterBigConfigurationText(JSON.stringify(jsonFile));
configEditor.clickSaveButton();
searchDialog.clickOnSearchIcon().enterTextAndPressEnter('*');
searchFilters.checkCreatedRangeFilterIsDisplayed()
.clickCreatedRangeFilterHeader()
.checkCreatedRangeFilterIsExpanded();
dateRangeFilter.checkFromFieldIsDisplayed()
.openFromDatePicker();
let todayDate = datePicker.convertDateToNewFormat(new Date());
datePicker.selectTodayDate();
browser.controlFlow().execute(async () => {
await expect(dateRangeFilter.getFromDate()).toEqual(todayDate);
});
});
});
});

View File

@@ -0,0 +1,323 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LoginPage } from '../../../pages/adf/loginPage';
import { SearchFiltersPage } from '../../../pages/adf/searchFiltersPage';
import ContentList = require('../../../pages/adf/dialog/contentList');
import { ConfigEditorPage } from '../../../pages/adf/configEditorPage';
import { NavigationBarPage } from '../../../pages/adf/navigationBarPage';
import SearchDialog = require('../../../pages/adf/dialog/searchDialog');
import AcsUserModel = require('../../../models/ACS/acsUserModel');
import TestConfig = require('../../../test.config');
import { SearchConfiguration } from '../search.config';
import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from '../../../actions/ACS/upload.actions';
import { browser } from 'protractor';
describe('Search Radio Component', () => {
const loginPage = new LoginPage();
const searchFiltersPage = new SearchFiltersPage();
const contentList = new ContentList();
const configEditorPage = new ConfigEditorPage();
const navigationBarPage = new NavigationBarPage();
const searchDialog = new SearchDialog();
let acsUser = new AcsUserModel();
let uploadActions = new UploadActions();
let filterType = {
none: 'None',
all: 'All',
folder: 'Folder',
document: 'Document',
custom: 'TEST_NAME'
};
let nodeNames = {
document: 'this_is_a_unique_name.txt',
folder: 'this_is_a_unique_name'
};
let createdFile, createdFolder;
beforeAll(async (done) => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
createdFolder = await this.alfrescoJsApi.nodes.addNode('-my-', {name: nodeNames.folder, nodeType: 'cm:folder'});
createdFile = await this.alfrescoJsApi.nodes.addNode('-my-', {
name: nodeNames.document,
nodeType: 'cm:content'
});
await browser.driver.sleep(15000);
loginPage.loginToContentServicesUsingUserModel(acsUser);
browser.get(TestConfig.adf.url + '/search;q=' + nodeNames.folder + '');
done();
});
afterAll(async (done) => {
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, createdFile.entry.id);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, createdFolder.entry.id);
done();
});
it('[C277039] Should be able to choose only one option at a time', () => {
searchFiltersPage.checkTypeFilterIsDisplayed();
searchFiltersPage.checkTypeFilterIsCollapsed();
searchFiltersPage.clickTypeFilterHeader();
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.none);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.all);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.folder);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.document);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.none);
contentList.checkContentIsDisplayed(nodeNames.folder);
contentList.checkContentIsDisplayed(nodeNames.document);
searchFiltersPage.typeFiltersPage().clickFilterRadioButton(filterType.folder);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.folder);
contentList.checkContentIsDisplayed(nodeNames.folder);
contentList.checkContentIsNotDisplayed(nodeNames.document);
searchFiltersPage.typeFiltersPage().clickFilterRadioButton(filterType.document);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.document);
contentList.checkContentIsDisplayed(nodeNames.document);
contentList.checkContentIsNotDisplayed(nodeNames.folder);
searchFiltersPage.typeFiltersPage().clickFilterRadioButton(filterType.all);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.all);
contentList.checkContentIsDisplayed(nodeNames.folder);
contentList.checkContentIsDisplayed(nodeNames.document);
});
describe('configuration change', () => {
let jsonFile;
beforeEach(() => {
let searchConfiguration = new SearchConfiguration();
jsonFile = searchConfiguration.getConfiguration();
});
it('[C277147] Should be able to customise the pageSize value', () => {
navigationBarPage.clickConfigEditorButton();
jsonFile.categories[5].component.settings.pageSize = 10;
for (let numberOfOptions = 0; numberOfOptions < 6; numberOfOptions++) {
jsonFile.categories[5].component.settings.options.push({
'name': 'APP.SEARCH.RADIO.FOLDER',
'value': "TYPE:'cm:folder'"
});
}
configEditorPage.clickSearchConfiguration();
configEditorPage.clickClearButton();
configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile));
configEditorPage.clickSaveButton();
searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(nodeNames.folder);
searchFiltersPage.clickTypeFilterHeader();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(10);
browser.refresh();
navigationBarPage.clickConfigEditorButton();
jsonFile.categories[5].component.settings.pageSize = 11;
configEditorPage.clickSearchConfiguration();
configEditorPage.clickClearButton();
configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile));
configEditorPage.clickSaveButton();
searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(nodeNames.folder);
searchFiltersPage.clickTypeFilterHeader();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(10);
browser.refresh();
navigationBarPage.clickConfigEditorButton();
jsonFile.categories[5].component.settings.pageSize = 9;
configEditorPage.clickSearchConfiguration();
configEditorPage.clickClearButton();
configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile));
configEditorPage.clickSaveButton();
searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(nodeNames.folder);
searchFiltersPage.clickTypeFilterHeader();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(9);
searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
browser.refresh();
});
it('[C277148] Should be able to click show more/less button', () => {
navigationBarPage.clickConfigEditorButton();
jsonFile.categories[5].component.settings.pageSize = 0;
for (let numberOfOptions = 0; numberOfOptions < 6; numberOfOptions++) {
jsonFile.categories[5].component.settings.options.push({
'name': 'APP.SEARCH.RADIO.FOLDER',
'value': "TYPE:'cm:folder'"
});
}
configEditorPage.clickSearchConfiguration();
configEditorPage.clickClearButton();
configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile));
configEditorPage.clickSaveButton();
searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(nodeNames.folder);
searchFiltersPage.clickTypeFilterHeader();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(5);
searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
searchFiltersPage.typeFiltersPage().clickShowMoreButton();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(10);
searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsNotDisplayed();
searchFiltersPage.typeFiltersPage().checkShowLessButtonIsDisplayed();
searchFiltersPage.typeFiltersPage().clickShowLessButton();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(5);
searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
browser.refresh();
navigationBarPage.clickConfigEditorButton();
delete jsonFile.categories[5].component.settings.pageSize;
configEditorPage.clickSearchConfiguration();
configEditorPage.clickClearButton();
configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile));
configEditorPage.clickSaveButton();
searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(nodeNames.folder);
searchFiltersPage.clickTypeFilterHeader();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(5);
searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
searchFiltersPage.typeFiltersPage().clickShowMoreButton();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(10);
searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsNotDisplayed();
searchFiltersPage.typeFiltersPage().checkShowLessButtonIsDisplayed();
searchFiltersPage.typeFiltersPage().clickShowLessButton();
expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(5);
searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
});
});
describe('Properties', () => {
let jsonFile;
beforeEach(() => {
let searchConfiguration = new SearchConfiguration();
jsonFile = searchConfiguration.getConfiguration();
});
beforeAll(async (done) => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
it('[C277033] Should be able to add a new option', () => {
navigationBarPage.clickConfigEditorButton();
jsonFile.categories[5].component.settings.options.push({
'name': filterType.custom,
'value': "TYPE:'cm:content'"
});
configEditorPage.clickSearchConfiguration();
configEditorPage.clickClearButton();
configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile));
configEditorPage.clickSaveButton();
searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(nodeNames.folder);
searchFiltersPage.clickTypeFilterHeader();
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.none);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.all);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.folder);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.document);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.custom);
searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.none);
searchFiltersPage.typeFiltersPage().clickFilterRadioButton(filterType.custom);
contentList.checkContentIsDisplayed(nodeNames.document);
contentList.checkContentIsNotDisplayed(nodeNames.folder);
});
});
});

View File

@@ -30,7 +30,8 @@ import { SearchResultsPage } from '../../../pages/adf/searchResultsPage';
import { SearchFiltersPage } from '../../../pages/adf/searchFiltersPage';
import { ConfigEditorPage } from '../../../pages/adf/configEditorPage';
import { NavigationBarPage } from '../../../pages/adf/navigationBarPage';
import path = require('path');
import { SearchConfiguration } from '../search.config';
describe('Search component - Text widget', () => {
@@ -43,7 +44,7 @@ describe('Search component - Text widget', () => {
let searchResultPage = new SearchResultsPage();
let acsUser = new AcsUserModel();
let newFolderModel = new FolderModel({ 'name': 'newFolder' , 'description': 'newDescription' });
let newFolderModel = new FolderModel({'name': 'newFolder', 'description': 'newDescription'});
beforeAll(async (done) => {
@@ -62,9 +63,9 @@ describe('Search component - Text widget', () => {
'name': newFolderModel.name,
'nodeType': 'cm:folder',
'properties':
{
'cm:description': newFolderModel.description
}
{
'cm:description': newFolderModel.description
}
}, {}, {});
await browser.driver.sleep(10000);
@@ -82,42 +83,51 @@ describe('Search component - Text widget', () => {
expect(searchFiltersPage.textFiltersPage().getNamePlaceholder()).toEqual('Enter the name');
});
it('[C289330] Should be able to change the Field setting', () => {
browser.get(TestConfig.adf.url + '/search;q=*');
searchResultPage.tableIsLoaded();
describe('configuration change', () => {
searchFiltersPage.checkCheckListFilterIsDisplayed();
searchFiltersPage.clickCheckListFilter();
searchFiltersPage.checkListFiltersPage().clickCheckListOption('Folder');
let jsonFile;
searchFiltersPage.checkNameFilterIsDisplayed();
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.name);
searchResultPage.checkContentIsDisplayed(newFolderModel.name);
beforeAll(() => {
let searchConfiguration = new SearchConfiguration();
jsonFile = searchConfiguration.getConfiguration();
});
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.description);
searchResultPage.checkContentIsNotDisplayed(newFolderModel.name);
it('[C289330] Should be able to change the Field setting', () => {
browser.get(TestConfig.adf.url + '/search;q=*');
searchResultPage.tableIsLoaded();
let json = JSON.parse(require('fs').readFileSync(path.join(TestConfig.main.rootPath, '/content-services/search/search.config.json'), 'utf8'));
json.categories[0].component.settings.field = 'cm:description';
searchFiltersPage.checkCheckListFilterIsDisplayed();
searchFiltersPage.clickCheckListFilter();
searchFiltersPage.checkListFiltersPage().clickCheckListOption('Folder');
navigationBarPage.clickConfigEditorButton();
configEditorPage.clickSearchConfiguration();
configEditorPage.clickClearButton();
configEditorPage.enterBigConfigurationText(JSON.stringify(json));
configEditorPage.clickSaveButton();
searchFiltersPage.checkNameFilterIsDisplayed();
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.name);
searchResultPage.checkContentIsDisplayed(newFolderModel.name);
searchDialog.clickOnSearchIcon().enterTextAndPressEnter('*');
searchResultPage.tableIsLoaded();
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.description);
searchResultPage.checkContentIsNotDisplayed(newFolderModel.name);
searchFiltersPage.checkCheckListFilterIsDisplayed();
searchFiltersPage.clickCheckListFilter();
searchFiltersPage.checkListFiltersPage().clickCheckListOption('Folder');
jsonFile.categories[0].component.settings.field = 'cm:description';
searchFiltersPage.checkNameFilterIsDisplayed();
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.name);
searchResultPage.checkContentIsNotDisplayed(newFolderModel.name);
navigationBarPage.clickConfigEditorButton();
configEditorPage.clickSearchConfiguration();
configEditorPage.clickClearButton();
configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile));
configEditorPage.clickSaveButton();
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.description);
searchResultPage.checkContentIsDisplayed(newFolderModel.name);
searchDialog.clickOnSearchIcon().enterTextAndPressEnter('*');
searchResultPage.tableIsLoaded();
searchFiltersPage.checkCheckListFilterIsDisplayed();
searchFiltersPage.clickCheckListFilter();
searchFiltersPage.checkListFiltersPage().clickCheckListOption('Folder');
searchFiltersPage.checkNameFilterIsDisplayed();
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.name);
searchResultPage.checkContentIsNotDisplayed(newFolderModel.name);
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.description);
searchResultPage.checkContentIsDisplayed(newFolderModel.name);
});
});
});

View File

@@ -1,135 +0,0 @@
{
"include": ["path", "allowableOperations"],
"sorting": {
"options": [
{ "key": "name", "label": "Name", "type": "FIELD", "field": "cm:name", "ascending": true },
{ "key": "content.sizeInBytes", "label": "Size", "type": "FIELD", "field": "content.size", "ascending": true },
{ "key": "description", "label": "Description", "type": "FIELD", "field": "cm:description", "ascending": true },
{ "key": "createdByUser", "label": "Author", "type": "FIELD", "field": "cm:creator", "ascending": true },
{ "key": "createdAt", "label": "Created", "type": "FIELD", "field": "cm:created", "ascending": true }
],
"defaults": [
{ "key": "name", "type": "FIELD", "field": "cm:name", "ascending": true }
]
},
"filterQueries": [
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
{ "query": "NOT cm:creator:System" }
],
"facetFields": {
"expanded": true,
"fields": [
{ "field": "content.mimetype", "mincount": 1, "label": "1:Type" },
{ "field": "content.size", "mincount": 1, "label": "2:Size" },
{ "field": "creator", "mincount": 1, "label": "3:Creator" },
{ "field": "modifier", "mincount": 1, "label": "4:Modifier" },
{ "field": "created", "mincount": 1, "label": "5:Created" }
]
},
"facetQueries": {
"label": "My facet queries",
"pageSize": 5,
"queries": [
{ "query": "created:2018", "label": "1.Created This Year" },
{ "query": "content.mimetype", "label": "2.Type" },
{ "query": "content.size:[0 TO 10240]", "label": "3.Size: xtra small"},
{ "query": "content.size:[10240 TO 102400]", "label": "4.Size: small"},
{ "query": "content.size:[102400 TO 1048576]", "label": "5.Size: medium" },
{ "query": "content.size:[1048576 TO 16777216]", "label": "6.Size: large" },
{ "query": "content.size:[16777216 TO 134217728]", "label": "7.Size: xtra large" },
{ "query": "content.size:[134217728 TO MAX]", "label": "8.Size: XX large" }
]
},
"categories": [
{
"id": "queryName",
"name": "Name",
"enabled": true,
"expanded": true,
"component": {
"selector": "text",
"settings": {
"pattern": "cm:name:'(.*?)'",
"field": "cm:name",
"placeholder": "Enter the name"
}
}
},
{
"id": "checkList",
"name": "Check List",
"enabled": true,
"component": {
"selector": "check-list",
"settings": {
"pageSize": 5,
"operator": "OR",
"options": [
{ "name": "Folder", "value": "TYPE:'cm:folder'" },
{ "name": "Document", "value": "TYPE:'cm:content'" }
]
}
}
},
{
"id": "contentSize",
"name": "Content Size",
"enabled": true,
"component": {
"selector": "slider",
"settings": {
"field": "cm:content.size",
"min": 0,
"max": 18,
"step": 1,
"thumbLabel": true
}
}
},
{
"id": "contentSizeRange",
"name": "Content Size (range)",
"enabled": true,
"component": {
"selector": "number-range",
"settings": {
"field": "cm:content.size",
"format": "[{FROM} TO {TO}]"
}
}
},
{
"id": "createdDateRange",
"name": "Created Date (range)",
"enabled": true,
"component": {
"selector": "date-range",
"settings": {
"field": "cm:created",
"dateFormat": "DD-MMM-YY"
}
}
},
{
"id": "queryType",
"name": "Type",
"enabled": true,
"component": {
"selector": "radio",
"settings": {
"field": null,
"pageSize": 5,
"options": [
{ "name": "APP.SEARCH.RADIO.NONE", "value": "", "default": true },
{ "name": "APP.SEARCH.RADIO.ALL", "value": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
{ "name": "APP.SEARCH.RADIO.FOLDER", "value": "TYPE:'cm:folder'" },
{ "name": "APP.SEARCH.RADIO.DOCUMENT", "value": "TYPE:'cm:content'" }
]
}
}
}
]
}

View File

@@ -0,0 +1,175 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class SearchConfiguration {
constructor() {
}
getConfiguration() {
return {
'include': ['path', 'allowableOperations'],
'sorting': {
'options': [
{'key': 'name', 'label': 'Name', 'type': 'FIELD', 'field': 'cm:name', 'ascending': true},
{
'key': 'content.sizeInBytes',
'label': 'Size',
'type': 'FIELD',
'field': 'content.size',
'ascending': true
},
{
'key': 'description',
'label': 'Description',
'type': 'FIELD',
'field': 'cm:description',
'ascending': true
},
{
'key': 'createdByUser',
'label': 'Author',
'type': 'FIELD',
'field': 'cm:creator',
'ascending': true
},
{'key': 'createdAt', 'label': 'Created', 'type': 'FIELD', 'field': 'cm:created', 'ascending': true}
],
'defaults': [
{'key': 'name', 'type': 'FIELD', 'field': 'cm:name', 'ascending': true}
]
},
'filterQueries': [
{'query': "TYPE:'cm:folder' OR TYPE:'cm:content'"},
{'query': 'NOT cm:creator:System'}
],
'facetFields': {
'expanded': true,
'fields': [
{'field': 'content.mimetype', 'mincount': 1, 'label': '1:Type'},
{'field': 'content.size', 'mincount': 1, 'label': '2:Size'},
{'field': 'creator', 'mincount': 1, 'label': '3:Creator'},
{'field': 'modifier', 'mincount': 1, 'label': '4:Modifier'},
{'field': 'created', 'mincount': 1, 'label': '5:Created'}
]
},
'facetQueries': {
'label': 'My facet queries',
'pageSize': 5,
'queries': [
{'query': 'created:2018', 'label': '1.Created This Year'},
{'query': 'content.mimetype', 'label': '2.Type'},
{'query': 'content.size:[0 TO 10240]', 'label': '3.Size: xtra small'},
{'query': 'content.size:[10240 TO 102400]', 'label': '4.Size: small'},
{'query': 'content.size:[102400 TO 1048576]', 'label': '5.Size: medium'},
{'query': 'content.size:[1048576 TO 16777216]', 'label': '6.Size: large'},
{'query': 'content.size:[16777216 TO 134217728]', 'label': '7.Size: xtra large'},
{'query': 'content.size:[134217728 TO MAX]', 'label': '8.Size: XX large'}
]
},
'categories': [
{
'id': 'queryName',
'name': 'Name',
'enabled': true,
'expanded': true,
'component': {
'selector': 'text',
'settings': {
'pattern': "cm:name:'(.*?)'",
'field': 'cm:name',
'placeholder': 'Enter the name'
}
}
},
{
'id': 'checkList',
'name': 'Check List',
'enabled': true,
'component': {
'selector': 'check-list',
'settings': {
'pageSize': 5,
'operator': 'OR',
'options': [
{'name': 'Folder', 'value': "TYPE:'cm:folder'"},
{'name': 'Document', 'value': "TYPE:'cm:content'"}
]
}
}
},
{
'id': 'contentSize',
'name': 'Content Size',
'enabled': true,
'component': {
'selector': 'slider',
'settings': {
'field': 'cm:content.size',
'min': 0,
'max': 18,
'step': 1,
'thumbLabel': true
}
}
},
{
'id': 'contentSizeRange',
'name': 'Content Size (range)',
'enabled': true,
'component': {
'selector': 'number-range',
'settings': {
'field': 'cm:content.size',
'format': '[{FROM} TO {TO}]'
}
}
},
{
'id': 'createdDateRange',
'name': 'Created Date (range)',
'enabled': true,
'component': {
'selector': 'date-range',
'settings': {
'field': 'cm:created',
'dateFormat': 'DD-MMM-YY'
}
}
},
{
'id': 'queryType',
'name': 'Type',
'enabled': true,
'component': {
'selector': 'radio',
'settings': {
'field': null,
'pageSize': 5,
'options': [
{'name': 'APP.SEARCH.RADIO.NONE', 'value': '', 'default': true},
{'name': 'APP.SEARCH.RADIO.ALL', 'value': "TYPE:'cm:folder' OR TYPE:'cm:content'"},
{'name': 'APP.SEARCH.RADIO.FOLDER', 'value': "TYPE:'cm:folder'"},
{'name': 'APP.SEARCH.RADIO.DOCUMENT', 'value': "TYPE:'cm:content'"}
]
}
}
}
]
};
}
}