RepoSense icon indicating copy to clipboard operation
RepoSense copied to clipboard

[#2098] Add show more button for error messages

Open jonasongg opened this issue 1 year ago • 16 comments

Fixes #2098

Proposed commit message

Add show more button for error messages

Currently, if there are a lot of error messages, it can block the rest
of the page to the point where users may thing the report failed to
generate at all.

Let's hide extra messages automatically add a show more button if there
are more to display the messages in full.

Other information

Currently, I opted for an easier JS implementation of the feature that displays the button if the number of error messages are above 4. About this, I wanted to ask what the best place would be to put a constant that defines this number (maximum number of error messages displayed without showing more).

Regarding the design of the show more button, I wanted to also get some thoughts on what would work best for RepoSense: image

image (default a tag, bad contrast)

image (default MUI text button)

Lastly, with JS, the transition when clicking show more is visually a bit jarring as the new elements appear programmatically. If needed, I can investigate a way to better animate showing more through CSS, which would also eliminate the need to have a constant to define the number of error messages displayed by default (preliminarily, this would involve adding a transition to max-height).

jonasongg avatar Jan 30 '24 06:01 jonasongg

@sopa301 @asdfghjkxd Thanks for the insight! Fixed the linting issue also

jonasongg avatar Feb 02 '24 09:02 jonasongg

@jonasongg Thanks for tacking this issue!

About this, I wanted to ask what the best place would be to put a constant that defines this number (maximum number of error messages displayed without showing more).

For now, I think we can define it in the view file and later move it to a dedicated Vue component.

Regarding the design of the show more button, I wanted to also get some thoughts on what would work best for RepoSense.

Currently, the 'Show More' button takes up a lot of vertical space at the bottom of the error box. Moreover, we do not expect most users to click on 'Show More' so it can be more subtle. I think what would work better to fit in with the compact style of RepoSense is using a right-aligned button styled like a red link.

image

Lastly, with JS, the transition when clicking show more is visually a bit jarring as the new elements appear programmatically. If needed, I can investigate a way to better animate showing more through CSS, which would also eliminate the need to have a constant to define the number of error messages displayed by default (preliminarily, this would involve adding a transition to max-height).

I think the transition isn't too bad but if you're interested in implementing smoother transitions, please go ahead!

ckcherry23 avatar Feb 02 '24 18:02 ckcherry23

One other comment about the UI: I feel the fact that some errors have been omitted should be more apparent. The current Show more appears like a regular UI control that people will automatically ignore.

For example, the last line of error message could be

Remaining error messages omitted to save space. Show all ...

What do you all think? Other alternatives?

damithc avatar Feb 03 '24 04:02 damithc

For example, the last line of error message could be

Remaining error messages omitted to save space. Show all ...

Just some mockups for discussion:

image image

ckcherry23 avatar Feb 03 '24 10:02 ckcherry23

Just some mockups for discussion:

image image

Thanks @ckcherry23 I'm OK with either. Will leave you all to decide.

damithc avatar Feb 03 '24 11:02 damithc

@ckcherry23 @damithc Added the changes as specified! image

jonasongg avatar Feb 05 '24 04:02 jonasongg

@ckcherry23 Wondering if I should add some tests in chartView_errorSummary_messageBox.cy.js to test this show more button; if I do, then I will need to add some repos to summary.json

jonasongg avatar Feb 05 '24 04:02 jonasongg

Yes, it would be great if we added a test case to test this behaviour!

However, adding repos to summary.json may cause other test cases to break so we try to avoid making any changes to it (the RepoSense/cypress branch) unless absolutely necessary.

In your case, would it be okay to show only 3 errors by default?

ckcherry23 avatar Feb 05 '24 04:02 ckcherry23

If I'm not wrong, the default cypress configuration will only result in one error message, so I'm not too sure on how best to test this!

jonasongg avatar Feb 06 '24 14:02 jonasongg

If I'm not wrong, the default cypress configuration will only result in one error message, so I'm not too sure on how best to test this!

@jonasongg Okay, I thought the Cypress configuration had 4 errors, which is why I suggested the default of 3.

In that case, let's make changes to the cypress branch. You can go ahead and add more repos for analysis to the branch locally and see if all the Cypress tests pass, and fix any breaking tests.

ckcherry23 avatar Feb 06 '24 14:02 ckcherry23

@ckcherry23 Sorry for the late update, just added the aforementioned tests!

jonasongg avatar Feb 15 '24 06:02 jonasongg

@jonasongg Please edit the title of the PR to include the issue number

ckcherry23 avatar Feb 16 '24 16:02 ckcherry23

@ckcherry23 Made the changes! Thanks

jonasongg avatar Feb 17 '24 06:02 jonasongg

@vvidday @ckcherry23 I added the variable in data() as I'm not too sure what the idiomatic way to define constants in our Vue files are, let me know if I should change it!

jonasongg avatar Feb 17 '24 12:02 jonasongg

Tests seem to be failing due to the new title component + added error messages pushing the charts out of viewport - Might be worth looking into the visibility selectors in our tests.

https://github.com/reposense/RepoSense/assets/45852430/ae77f04c-77f7-42e3-a698-c5dea3443dfd

vvidday avatar Feb 19 '24 16:02 vvidday

@vvidday thanks for pointing this out! a very simple fix for most of these tests would like you suggested to remove the .should('be.visible') assertion in the tests, but i'm not sure if this is the right way to fix them? the assertion doesn't seem to be doing much as the test would already fail if the element cannot be found. another way could be to scroll down so that the elements are visible

jonasongg avatar Mar 04 '24 03:03 jonasongg

We can either use the exist assertion or we can use scrollIntoView as you mentioned. I think it would be better to use scrollIntoView because it would more closely follow an actual user's interaction.

sopa301 avatar Mar 09 '24 14:03 sopa301

@sopa301 Thanks for the suggestions! I decided to go with the exist assertion because it's an easier change (and also .click() will automatically scroll once the exist assertion passes). I also renamed zoomView_rampChart.js to zoomView_rampChart.cy.js so that the test actually appears

jonasongg avatar Mar 11 '24 05:03 jonasongg

The following links are for previewing this pull request:

  • Dashboard Preview: https://dashboard-2105-pr-reposense-reposense.surge.sh
  • Docs Preview: https://docs-2105-pr-reposense-reposense.surge.sh

github-actions[bot] avatar Mar 14 '24 04:03 github-actions[bot]