Show Close instead of Apply in labels modal when there are no labels - #55
Open
hupponen wants to merge 1 commit into
Open
Show Close instead of Apply in labels modal when there are no labels#55hupponen wants to merge 1 commit into
hupponen wants to merge 1 commit into
Conversation
Applying label checkboxes is meaningless when the session has no labels, so the modal footer now falls back to a plain Close button in that case, same as when no files are selected. The Cancel button is hidden too, since it only makes sense next to Apply. Also use btn-secondary for the Cancel and Close buttons in both label modals, matching the other modal footers in the app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The labels modal showed an Apply button even when the session had no labels at all. With nothing to check, Apply had nothing to apply — clicking it just closed the modal. The Cancel button next to it was equally pointless in that state.
Change
Added a
canApply()helper — files selected and at least one label exists — and keyed the footer off it instead ofhasSelection():+ New labelCancelApply+ New labelCloseSo the no-labels case now behaves like the no-selection case: a single Close button.
hasSelection()is deliberately kept where it's still the right question — the header filename/count, the checkbox column, andaddCreatedLabelRow()(which must pre-check a newly created label even thoughrowsis still empty at that moment).Also switched the Cancel and Close buttons in both label modals from
btn-outline-secondarytobtn-secondary, matching the ~25 other modal footers in the app. Apply/Save stay primary.Notes
confirm()was already a no-op with zero rows (applyRowsToover an emptyrowsreturnsbeforeunchanged, sodatasetUpdatesis empty and the modal just closes). No requests are fired by the new Close button.datasetmodal.service.tsclearslabelsModalRefin both handlers), so hiding Cancel can't leave thetoggleLabelsModalguard stuck.