Skip to content
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

[Drools-3838] Improve error reporting in scenario result #1125

Merged
merged 40 commits into from
May 13, 2019

Conversation

yesamer
Copy link
Member

@yesamer yesamer commented Apr 23, 2019

@kkufova @gitgabrio @danielezonca @jomarko can you please test it and review it? Thanks!

https://issues.jboss.org/browse/DROOLS-3838

This PR contains the client sidechanges required for DROOLS-3838.
Related PR on drools-wb which contains backend change is here kiegroup/drools#2335

PRs list:
kiegroup/drools#2335

gitgabrio and others added 26 commits April 9, 2019 15:11
…ecated variable. TO be managed in a different ticket.
@kkufova
Copy link
Contributor

kkufova commented Apr 25, 2019

@yesamer, I noticed the following things:

  1. First of all, I thought there should be a small red icon added directly to the cell for displaying the message. These plans have changed?

  2. Secondly, I discovered a serious bug: if the expected value is null (and the test fails because the entered value is different), the following unexpected error is thrown every time you hover over the cell:

Uncaught exception: Exception caught: Exception caught: (TypeError) : Cannot read property 'toString' of undefined Caused by: Exception caught: (TypeError) : Cannot read property 'toString' of undefined Caused by: (TypeError) : Cannot read property 'toString' of undefined
  1. The same things happens with imported test scenarios. If you import a .scesim file, instead of displaying the message, an unexpected error is thrown when there's an error.

  2. I noticed that in the window, the Apply button is dark grey as opposed to the original design. Can this be fixed?

@yesamer
Copy link
Member Author

yesamer commented May 2, 2019

@kkufova Points 2,3,4 can be easily managed. Point 1 could be a little bit harder to implement.

@danielezonca
Copy link
Member

@kkufova @yesamer Please manage point 1 with a different ticket

@yesamer
Copy link
Member Author

yesamer commented May 7, 2019

I created https://issues.jboss.org/browse/DROOLS-3989 to manage point 1.
Point 2,3 and 4 are fixed.

@kkufova
Copy link
Contributor

kkufova commented May 7, 2019

@yesamer, I found the following issues:

  1. If a cell is highlighted, you fix the value and rerun the tests, the cell is still highlighted even though the tests are now passing. Can this be fixed?

  2. I noticed that Impossible to parse as boolean message keeps getting displayed instead of an actual help. For example, I used falsee instead of false. I think in this case we definitely need The expected value is 'false' but the actual one is 'falsee'. Another scenario: if the expected value is null but I enter [] instead, the error message is Error with this value: Impossible to parse as boolean. It doesn't say anything about the actual value being null.

  3. If the expected value is null and you use something else (such as true) and then click Apply, instead of adding null, the cell is empty.

All three bugs can be seed here.

@yesamer
Copy link
Member Author

yesamer commented May 8, 2019

@jomarko Hi Jozef, I fixed points 1 and 3 raised by @kkufova. Point 2 should be managed in another ticket in my opinion. Please consider that the changes contained in https://github.com/kiegroup/drools/pull/2335 are mandatory to test it.
Thanks.

Copy link

@jomarko jomarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review notes, manual check pending.

protected ErrorReportPopoverPresenter errorReportPopupPresenter;

protected Integer currentlyShownHeaderRowIndex = -1;
protected Integer currentlyShownHeaderColumnIndex = -1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentlyShownHeaderRowIndex and currentlyShownHeaderColumnIndex are never used, is it intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment these are not used, you right. Could be used in the future when a popover for the header cells is required. But I agree with you, they can be removed.
Done!

if (isHeader) {
return manageHeaderCoordinates(uiColumnIndex, scenarioGridColumn, gridClickPoint);
} else {
return (uiRowIndex == null || uiColumnIndex == null) ? manageBodyCoordinates(-1, -1) : manageBodyCoordinates(uiRowIndex, uiColumnIndex);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this line to simple return manageBodyCoordinates(uiRowIndex, uiColumnIndex) and add the check for null values inside of manageBodyCoordinates. This wil facilitate invocation from other places (if needed in future), what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, DONE!

@Override
protected boolean manageBodyCoordinates(Integer uiRowIndex, Integer uiColumnIndex) {
/* In this case, the mouse is out ot the GridLayer, then return false, without perform any action */
if (uiColumnIndex == -1 || uiRowIndex == -1) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to comment in AbstractScenarioSimulationGridPanelHandler. This if would change to uiColumnIndex == null || uiRowIndex == null

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, DONE!

currentlyShownBodyColumnIndex = uiColumnIndex;
/* It calculates the coordinates */
final GridColumn<?> column = scenarioGrid.getModel().getColumns().get(uiColumnIndex);
Point2D xYCell = retrieveCellMiddleXYPosition(column, uiRowIndex);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xYCell can be also final

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

} else {
errorReportPopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.errorReason(),
ScenarioSimulationEditorConstants.INSTANCE.errorPopoverMessageFailedWithException(
factMappingValue.getExceptionMessage()),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check null value here as we do for FAILED_WITH_ERROR and if test is positive use constant NULL?

Copy link
Member Author

@yesamer yesamer May 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to test if factMappingValue.getStatus() is null?
Yes, I agree to add it, but in another point. In my opinion, if that value is NULL, the popover shouldn't be visible at all. I put it in line 87.

}

@Override
public void show(final Optional<String> editorTitle, final int mx, final int my, Position position) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for consistency, please make also the last parameter final: final Position position

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE!

final String keepText,
final int mx,
final int my,
final Position position) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just formatting - indent of parameters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

close=Close
apply=Apply
errorPopoverMessageFailedWithError=The expected value is ''{0}'' but the actual one is ''{1}''.
errorPopoverMessageFailedWithException=Error with this value: {0}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this comes form UX mockups, but I would expect something more like - "Exception with detailed message: {0}"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my knowledge, this case is not handled in UX mockups.
Fine for me to put yours.
DONE!

@Mock
private FactMappingValue factMappingValueMock;
@Mock
private AbsolutePanel scrollPanel;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be consistent, please use name scrollPanelMock

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@Mock
private AbsolutePanel scrollPanel;
@Mock
private Element element;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent, please use name elementMock

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@jomarko
Copy link

jomarko commented May 10, 2019

jenkins execute full downstream build

@jomarko
Copy link

jomarko commented May 10, 2019

@yesamer thank you for the PR, works very nice. I can confirm pints 1. and 3. from comment are fixed. The point 2. will be addressed by DROOLS-3992. There remain two points that I would like to discuss:

  1. The text we show to user when some exception occurred during parsing cell value. The popover title is definitely fine - Error reason. However I think we should still improve the prefix of the exception message to make it maybe shorter and more clear? I think it is question to UX of your scrum team? What do you think? [1]
  2. If some issue was in multiple ceels of one row, and user decides to fix one value (Apply button is pressed) whole row highlight is lost. See [2]. Is this expected or not? if not, should I file a separate jira or worth of adding into this PR?

[1]
Screenshot from 2019-05-10 09-18-21

[2]
https://drive.google.com/file/d/1c-Hgc6ePD2OttI-ddVLhqj9UU0psrLPF/view?usp=sharing

@yesamer
Copy link
Member Author

yesamer commented May 10, 2019

@jomarko Thank you!
About your considerations:

  1. It could be a solution to involve UX team to find a better message. We can handle this in DROOLS-3992, in my opinon.
  2. I didn't manage the case you reported, then I agree with you to open a new ticket. Please assign it to me, I will work on it in the next sprint.
    Thank you for the review and the test

Copy link
Member

@danielezonca danielezonca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for me

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yesamer
Fine for me, but I would prefer to have a green build for that before merging

@danielezonca
Copy link
Member

jenkins execute full downstream build

@yesamer
Copy link
Member Author

yesamer commented May 13, 2019

Hi @manstis, can you please merge this PR and kiegroup/drools#2335?
Thanks,

@manstis manstis merged commit b84164a into kiegroup:master May 13, 2019
@yesamer yesamer deleted the DROOLS-3838 branch June 11, 2019 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants