Skip to content

Disable skip button if step is mandatory - #1211

Merged
nafiz1001 merged 10 commits into
masterfrom
skip-button
Oct 14, 2026
Merged

nafiz1001 merged 10 commits into
masterfrom
skip-button

Conversation

@nafiz1001

Copy link
Copy Markdown
Collaborator

No description provided.

@nafiz1001
nafiz1001 requested a review from UlysseFG October 2, 2026 20:59
exceptedSampleIDs,
serializeFilterParamsWithDescriptions(filters),
),
<Tooltip destroyOnHidden mouseEnterDelay={0} title={step.mandatory && actionName == "skip" ? `${step.step_name} cannot be skipped` : ""}>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

mouseEnterDelay default is much better than 0. 0 leads to useless popups coming up each time you move your mouse around.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

DONE

exceptedSampleIDs,
serializeFilterParamsWithDescriptions(filters),
),
<Tooltip destroyOnHidden mouseEnterDelay={0} title={step.mandatory && actionName == "skip" ? `${step.step_name} cannot be skipped` : ""}>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Your title have the option to actually give some information about the skip action might has well use it when the step is not mandatory. You could even pre-calculate a tooltip for each button shown.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

DONE

@nafiz1001
nafiz1001 requested a review from UlysseFG October 6, 2026 18:36
@UlysseFG

UlysseFG commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

You disable the last step of the whole process ... It would be much better to disable the first button on the workflow management page. I am aware that there is the issue of the step being skipable only for specific workflows. Let's explore how using the selected samples queued steps we can validate if each selected sample has at least one skipable queued step. if not we disable the main skip button.

can_samples_skip returns True if at least one selected sample is queued
to a non-mandatory step. Skip stays disabled when no selected sample is
queued, when all queued samples are at mandatory steps, or when more
than 960 samples are selected. The workflow assignment page uses it to
disable Skip with a tooltip. smartQuerySetLookup now always sends
id__in or id__not__in.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@action(detail=False, methods=["get"])
def can_samples_skip(self, request: Request):
"""
Returns True if at least one selected sample is queued to a step order that is not mandatory.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is not what we want ... We should have true if each sample is queued to at least one step order that is skippable ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

DONE

# SampleNextStepByStudyFilter lacks the custom ones (is_pooled, metadata, qPCR_status__in,
# qc_flag__in, project name, batch name/barcode).
samples = SampleFilter(request.GET, queryset=Sample.objects.all().distinct()).qs
if samples.count() > MAX_SELECTION:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

total > MAX_SELECTION or total == 0 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Eheh, I just had the same idea and outsmarted Claude in the process ;)

The previous any-sample rule allowed skipping mandatory steps.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Use SampleFilter, not SampleNextStepByStudyFilter: the table filters are sample filters, and
# SampleNextStepByStudyFilter lacks the custom ones (is_pooled, metadata, qPCR_status__in,
# qc_flag__in, project name, batch name/barcode).
samples = SampleFilter(request.GET, queryset=Sample.objects.all().distinct()).qs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe it would make more sense to have this endpoint on sample instead.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

DONE

Samples are selected with the sample table filters, so the endpoint
belongs on the sample viewset: /samples/can_skip/. Update the skip
button tooltip to match the all-samples-must-be-skippable rule.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nafiz1001
nafiz1001 requested a review from UlysseFG October 13, 2026 20:41
@nafiz1001
nafiz1001 merged commit a87c1f2 into master Oct 14, 2026
5 checks passed
@nafiz1001
nafiz1001 deleted the skip-button branch October 14, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants