mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-2116] search results available actions (#895)
* add item.id to File Libraries * add method to wait for node to be indexed * create separate methods in queries API to wait for sites or wait for nodes * improvements, renaming * renaming * fix * add tests for actions on search results * add wait and use new method * fix * another fix * use correct method * more fixes * create method for clickView button * fixes * no message
This commit is contained in:
committed by
Denys Vuika
parent
0471b783a4
commit
d2e0f688e8
@@ -42,7 +42,17 @@ export class QueriesApi extends RepoApi {
|
||||
return this.alfrescoJsApi.core.queriesApi.findSites(searchTerm, data);
|
||||
}
|
||||
|
||||
async waitForApi(searchTerm, data) {
|
||||
async findNodes(searchTerm: string) {
|
||||
const data = {
|
||||
term: searchTerm,
|
||||
fields: ['name']
|
||||
};
|
||||
|
||||
await this.apiAuth();
|
||||
return this.alfrescoJsApi.core.queriesApi.findNodes(searchTerm, data);
|
||||
}
|
||||
|
||||
async waitForSites(searchTerm, data) {
|
||||
try {
|
||||
const sites = async () => {
|
||||
const totalItems = (await this.findSites(searchTerm)).list.pagination.totalItems;
|
||||
@@ -58,4 +68,21 @@ export class QueriesApi extends RepoApi {
|
||||
console.log('-----> catch queries findSites: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
async waitForFilesAndFolders(searchTerm, data) {
|
||||
try {
|
||||
const nodes = async () => {
|
||||
const totalItems = (await this.findNodes(searchTerm)).list.pagination.totalItems;
|
||||
if ( totalItems !== data.expect ) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(nodes);
|
||||
} catch (error) {
|
||||
console.log('-----> catch queries findFilesAndFolders: ', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -47,7 +47,36 @@ export class SearchApi extends RepoApi {
|
||||
|
||||
await this.apiAuth();
|
||||
return this.alfrescoJsApi.search.searchApi.search(data);
|
||||
}
|
||||
|
||||
async queryNodesNames(searchTerm: string) {
|
||||
const data = {
|
||||
query: {
|
||||
query: `cm:name:\"${searchTerm}*\"`,
|
||||
language: 'afts'
|
||||
},
|
||||
filterQueries: [
|
||||
{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'`}
|
||||
]
|
||||
};
|
||||
|
||||
await this.apiAuth();
|
||||
return this.alfrescoJsApi.search.searchApi.search(data);
|
||||
}
|
||||
|
||||
async queryNodesExactNames(searchTerm: string) {
|
||||
const data = {
|
||||
query: {
|
||||
query: `cm:name:\"${searchTerm}\"`,
|
||||
language: 'afts'
|
||||
},
|
||||
filterQueries: [
|
||||
{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'`}
|
||||
]
|
||||
};
|
||||
|
||||
await this.apiAuth();
|
||||
return this.alfrescoJsApi.search.searchApi.search(data);
|
||||
}
|
||||
|
||||
async waitForApi(username, data) {
|
||||
@@ -66,4 +95,21 @@ export class SearchApi extends RepoApi {
|
||||
console.log('-----> catch search: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
async waitForNodes(searchTerm: string, data) {
|
||||
try {
|
||||
const nodes = async () => {
|
||||
const totalItems = (await this.queryNodesNames(searchTerm)).list.pagination.totalItems;
|
||||
if ( totalItems !== data.expect) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(nodes);
|
||||
} catch (error) {
|
||||
console.log('-----> catch search nodes: ', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user