New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ACA-3312] Add user-filter util class #6098
Conversation
2f4034d
to
9628215
Compare
return this.apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(new UserTaskFilterRepresentation( | ||
{appId: appId, name: newTaskFilterName, icon: iconName, filter: {sort: sortType, state: stateType, assignment: assignmentType}})); | ||
} catch (error) { | ||
Logger.error('Create Task Filter - Service error, Response: ', JSON.parse(JSON.stringify(error))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases, don't we want rethrow the error, beside displaying them? Like this, even if an error occurs, we just show a message, but the program's execution will continue. Is it exactly what we want here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the catch
block will never be executed in case of the errors in the async createUserTaskFilter
. I suggest not using try/catch here at all, as it's a test and we will see the error + stack trace anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@popovicsandras, @DenysVuika thanks for the comments. Regarding the catch's logger.error
... I was writing this in the same idea of what we already have (eg. lib/process-services/src/lib/process-list/services/process.service.ts) and I was keeping it like this because I was wondering that if not, we will stop the execution of the tests and the entire class will fail, right? I'm not sure if I'm actually right.
Currently, in a class we have multiple tests, most of them with different preconditions [this is available at least for all the tests from adw->Process Services extension]. If one precondition (required for just one test) will fail, currently the tests will keep running. From my point of view, we could keep using this approach until we will find a way to avoid making an entire class fail because of one precondition needed by a single test. 🤔
@DenysVuika I'm not sure if I've understood correctly the concern, but createUserTaskFilter
is an API used directly from js-api package (node_modules/@alfresco/js-api/src/api/activiti-rest-api/api/userFilters.api.ts). If something happens there, shouldn't be caught in async createATaskFilter
catch's Logger.error
? 🤔
try { | ||
return this.apiService.getInstance().activiti.userFiltersApi.orderUserTaskFilters(new UserFilterOrderRepresentation({appId: appId, order: filtersIdOrder})); | ||
} catch (error) { | ||
Logger.error('Re-order the list of user task filters - Service error, Response: ', JSON.parse(JSON.stringify(error))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
try { | ||
return this.apiService.getInstance().activiti.userFiltersApi.getUserTaskFilters({appId: appId}); | ||
} catch (error) { | ||
Logger.error('List task filters - Service error, Response: ', JSON.parse(JSON.stringify(error))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON.parse(JSON.stringify(obj)) is a hack to deep clone an object I don't see any reason why we should have it here
}); | ||
return chosenTaskFilter; | ||
} catch (error) { | ||
Logger.error('Get user task filters by name - Service error, Response: ', JSON.parse(JSON.stringify(error))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
try { | ||
return this.apiService.getInstance().activiti.userFiltersApi.deleteUserTaskFilter(filterId); | ||
} catch (error) { | ||
Logger.error('Delete a task filter - Service error, Response: ', JSON.parse(JSON.stringify(error))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
return this.apiService.getInstance().activiti.userFiltersApi.updateUserTaskFilter(filterId, new UserTaskFilterRepresentation( | ||
{appId: appId, name: updatedTaskFilterName, icon: updatedIconName, filter: {sort: updatedSortType, state: updatedStateType, assignment: updatedAssignmentType}})); | ||
} catch (error) { | ||
Logger.error('Delete a task filter - Service error, Response: ', JSON.parse(JSON.stringify(error))); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
9628215
to
7ad4a11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the comments
b6ffccd
to
9e3e620
Compare
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
isFilterHighlighted()
to returnfalse
.What is the current behaviour? (You can also link to an open issue here)
What is the new behaviour?
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information: