mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
e2e cleanup (#2951)
* reduce the code * reduce code * reduce code * reduce code * cleanup tests * more readable code * cleanup code * fix code * even more cleanup * remove some deprecated apis * code fixes * cleanup files * more files switching to user actions
This commit is contained in:
@@ -35,7 +35,7 @@ export class SearchApi extends RepoApi {
|
||||
super(username, password);
|
||||
}
|
||||
|
||||
async queryRecentFiles(username: string) {
|
||||
private async queryRecentFiles(username: string) {
|
||||
const data = {
|
||||
query: {
|
||||
query: '*',
|
||||
@@ -66,7 +66,7 @@ export class SearchApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async queryNodesNames(searchTerm: string) {
|
||||
private async queryNodesNames(searchTerm: string) {
|
||||
const data = {
|
||||
query: {
|
||||
query: `cm:name:\"${searchTerm}*\"`,
|
||||
@@ -84,33 +84,6 @@ export class SearchApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async getSearchByTermTotalItems(searchTerm: string): Promise<number> {
|
||||
try {
|
||||
return (await this.queryNodesNames(searchTerm)).list.pagination.totalItems;
|
||||
} catch (error) {
|
||||
this.handleError(`SearchApi getSearchByTermTotalItems : catch : `, error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
async queryNodesExactNames(searchTerm: string) {
|
||||
const data = {
|
||||
query: {
|
||||
query: `cm:name:\"${searchTerm}\"`,
|
||||
language: 'afts'
|
||||
},
|
||||
filterQueries: [{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'` }]
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
return this.searchApi.search(data);
|
||||
} catch (error) {
|
||||
this.handleError(`SearchApi queryNodesExactNames : catch : `, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async waitForApi(username: string, data: { expect: number }) {
|
||||
try {
|
||||
const recentFiles = async () => {
|
||||
@@ -134,7 +107,7 @@ export class SearchApi extends RepoApi {
|
||||
|
||||
const apiCall = async () => {
|
||||
try {
|
||||
return await this.getSearchByTermTotalItems(searchTerm);
|
||||
return (await this.queryNodesNames(searchTerm)).list.pagination.totalItems;
|
||||
} catch (error) {
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user