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

#10516 added ellipsis if more than 5 warnings occurs #10595

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

AkashNegi1
Copy link

@AkashNegi1 AkashNegi1 commented Dec 11, 2024

added ellipsis if more than 5 warnings occurs it will create an ellipsis which hold the additional warnings and we can use the final upload button without any warnings disturbances
Screenshot 2024-12-11 094011
Screenshot 2024-12-11 094028

fixes #10516

@tyrasd tyrasd added the usability An issue with ease-of-use or design label Dec 11, 2024
@AkashNegi1
Copy link
Author

@tyrasd can you tell me what I should do next or guide me further

Copy link
Member

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

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

Generally, iD uses chevron icons for collapsed/collapsible UI sections. It would be good to reuse this design pattern here.

image

In the iD code this is called a disclosure (see modules/ui/disclosure.js).

Maybe it would be most consistent to just use a similar collapsible list of warnings in the commit section as in the validation panel:

image

See modules/ui/sections/validation_issues.js for how that was implemented.

What do you think?

--

PS: can you please exclude the unrelated changes in the data directory from this PR?

modules/ui/commit_warnings.js Outdated Show resolved Hide resolved
@AkashNegi1 AkashNegi1 requested a review from tyrasd December 12, 2024 10:26
Copy link
Member

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

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

Thanks! A few more things need to be adjusted from a styling perspective:

  • to restore the whitespace/margins around the section: please wrap the selection in a div with css class modal-section (see how this container was set up in the previous implementation)
  • also, the yellow/red background color should be still applied for the respective warning/error sections (css class .warning-section/.error-section). Alternatively, we could change the styling to how it looks like in the validation sidebar (colored individual warning lines, see screenshot above). I don't have a strong preference between these two options.

@AkashNegi1
Copy link
Author

image
I've made the warning section look like this -^
@tyrasd need your review

@AkashNegi1 AkashNegi1 requested a review from tyrasd December 14, 2024 17:41
Copy link
Member

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

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

I don't like that the styling of the list is now suddenly more squished together. Please restore the previous css class of the <ul> to changeset-list, then it should be fine to merge.

@AkashNegi1
Copy link
Author

AkashNegi1 commented Dec 18, 2024

restored the css class of ul as it was before (i.e. to change-list)
Screenshot 2024-12-18 222018
@tyrasd I've updated the CSS class Could you please check it out

@AkashNegi1 AkashNegi1 requested a review from tyrasd December 18, 2024 16:56
Copy link
Member

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

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

Thanks, optically it looks fine now. There is a small regression caused by the changed css class in the last commit: the list is not duplicated when collapsing the section and un-collapsing it again. See below for a suggestion to fix the bug and at the same time improve the implementation slightly.

Additionally, I included some general code style suggestions below.

}
}

function renderIssuesList(selection, severity, issues) {
Copy link
Member

Choose a reason for hiding this comment

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

The function argument severity does not seem to be used inside the function. Please drop it.

}
}

function renderIssuesList(selection, severity, issues) {
selection.selectAll('.issues-list').remove();
Copy link
Member

Choose a reason for hiding this comment

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

While this could work (if the correct css class was referenced in the d3 select 😅 ), the approach to recreate the list from scratch every time the list needs to be rendered is not the best. See the suggestion in the next comment for a solution that does actually use a d3 data binding to make sure the ul is only created if needed, and an existing ul is reused if already present.

Comment on lines +51 to +56
selection.selectAll('.issues-list').remove();
var container = selection
.append('ul')
.attr('class', 'changeset-list');

container.exit().remove();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
selection.selectAll('.issues-list').remove();
var container = selection
.append('ul')
.attr('class', 'changeset-list');
container.exit().remove();
let container = selection
.selectAll('.changeset-list')
.data([0]);
container = container.enter()
.append('ul')
.attr('class', 'changeset-list')
.merge(container);

Notice the .data([0]) here: this assigns a constant 0 as a kind of dummy data to the list: this results in the list only to only be created once (in .enter().append(…)) and only if the selection is empty.

for (var severity in issuesBySeverity) {
var issues = issuesBySeverity[severity];
for (let severity in _issuesBySeverity) {
let issues = _issuesBySeverity[severity];
Copy link
Member

Choose a reason for hiding this comment

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

good idea to refactor some of the old code using var. Could you please also use const/let instead of var in the remaining new code of this PR?

Comment on lines +36 to 38
.disclosureContent(function(selection) {
return renderIssuesList(selection, severity, issues);
})
Copy link
Member

Choose a reason for hiding this comment

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

this could be an arrow function to be more concise and consistent with the .label() property a few lines above

Suggested change
.disclosureContent(function(selection) {
return renderIssuesList(selection, severity, issues);
})
.disclosureContent(selection => renderIssuesList(selection, ~~severity,~~ issues))

same also for the shouldDisplay callback and several ones called in renderIssuesList.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usability An issue with ease-of-use or design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Too many warnings hinders save
2 participants