Skip to content

Revised upload page #1255

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

Merged
merged 5 commits into from
Dec 10, 2024
Merged

Revised upload page #1255

merged 5 commits into from
Dec 10, 2024

Conversation

jstucke
Copy link
Collaborator

@jstucke jstucke commented Sep 2, 2024

  • removed moment.js package (apparently unused for quite a while)
  • revised upload page:
    • replaced "select" elements on upload page with dropdown menus
    • inputs are always visible
    • changed the styling to be more coherent
    • removed validity check (it is not possible to send an invalid request using the unedited upload page because of the required tags)
      • it could be possible to send an invalid request by manually crafting one but that would only generate an error in the frontend
    • added optional filter inputs for device classes, names and vendors
    • added custom autocomplete menus for inputs with dropdown menu

@jstucke jstucke requested review from dorpvom and maringuu September 2, 2024 12:37
@jstucke jstucke self-assigned this Sep 2, 2024
@jstucke jstucke force-pushed the revised-upload-page branch from 591d58b to 04fe945 Compare September 3, 2024 14:23
@jstucke jstucke mentioned this pull request Sep 3, 2024
1 task
@maringuu
Copy link
Collaborator

Nice!

Can we make the right arrow trigger the list of all possible entries?
The dropdown search on the right looks redundant to me.
image

@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 3 lines in your changes missing coverage. Please review.

Project coverage is 91.85%. Comparing base (ad4d6d8) to head (144dbb7).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/web_interface/components/analysis_routes.py 66.66% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1255      +/-   ##
==========================================
- Coverage   92.23%   91.85%   -0.38%     
==========================================
  Files         379      378       -1     
  Lines       23188    20920    -2268     
==========================================
- Hits        21387    19216    -2171     
+ Misses       1801     1704      -97     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…ogging

the check_for_errors method is not useful anymore, since all non-optional form fields are 'required' (meaning you cannot click on 'submit' if they are missing) and if they are missing, we get a BadRequestKeyError anyway

the improved error logging for BadRequestKeyError will show which key is missing (otherwise it would fail silently)
replaced bootstrap selects with dropdowns and made styling more coherent
@maringuu maringuu force-pushed the revised-upload-page branch from f26d91b to efff551 Compare December 5, 2024 16:02
Copy link
Collaborator

@maringuu maringuu left a comment

Choose a reason for hiding this comment

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

In addition to the commend below, I have two request but I am approving anyways to not get this stuck another week.

  1. Please make the button toggle the list. See the example code linked in the above comment.
  2. Please make the list scroll if it overflows.
    For example, the following cs makes it show 10 items and add a scrollbar if it overflows.
.autocomplete-items {
         // [...]
	max-height: 1000%;
	overflow-x: hidden;
	overflow-y: auto;
}

Comment on lines 131 to 145
function closeAll(currentElement) {
if (currentElement && currentElement.id.endsWith("-button")) {
// if we clicked on the dropdown button we don't want to close the autocomplete list (we just opened)
currentElement = getAutocompleteElement(currentElement.parentNode.parentNode);
} else if (currentElement && currentElement.tagName.toLowerCase() === "input") {
// also don't close the autocomplete that belongs to an input we just clicked
currentElement = getAutocompleteElement(currentElement.parentNode);
}
const elements = document.getElementsByClassName("autocomplete-items");
Array.from(elements).forEach((element) => {
if (currentElement !== element) {
element.parentNode.removeChild(element);
}
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why remove the elements instead of setting them to display: none like in this example?
Can we generate the list in jinja instead of javascript if we do this?

Removing the elements seems unusual to me, but more importantly is very annoying when interactively designing the css.
(I wanted to add a scrollbar to the lists if they are too large, and I had to re-select it everytime because the whole list was removed from html)

Copy link
Collaborator Author

@jstucke jstucke Dec 6, 2024

Choose a reason for hiding this comment

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

Why remove the elements instead of setting them to display: none

I followed another guide. display: none seems to generally work, too, but sometimes it seems to get buggy (e.g. the up/down keys not working for selecting the dropdown entries), so I'm in favor of simply leaving it as it is

Can we generate the list in jinja instead of javascript if we do this?

No, because the "Device Name" list gets generated dynamically (i.e. client-side with JavaScript) after selecting device class and vendor (only device names for that particular combination are displayed)

@jstucke
Copy link
Collaborator Author

jstucke commented Dec 6, 2024

In addition to the commend below, I have two request but I am approving anyways to not get this stuck another week.

1. Please make the button _toggle_ the list. See the example code linked in the above comment.

2. Please make the list scroll if it overflows.
   For example, the following cs makes it show 10 items and add a scrollbar if it overflows.

I think I found a way to fix both issues (see 144dbb7)

@jstucke jstucke merged commit 78d9363 into master Dec 10, 2024
10 checks passed
@jstucke jstucke deleted the revised-upload-page branch December 10, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants