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

Pages Editor: add "Choose Starting Page" dropdown #7088

Merged
merged 9 commits into from
May 17, 2024

Conversation

shaunanoordin
Copy link
Member

@shaunanoordin shaunanoordin commented Apr 26, 2024

PR Overview

Part of: Pages Editor MVP project and FEM Lab super-project
Follows #7079
Staging branch URL: https://pr-7088.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging

This PR adds the ability for project owners to set the starting page/step of a workflow, by selecting the appropriate page/step in a dropdown.

NOTE: in this PR, the term "first page/step" means the "first item in the workflow.steps data array". The term "starting page/step" means the initial page/step a volunteer sees on the FEM Classifier for this workflow. Functionally, these are the same.

New changes in this PR:

  • ⭐ Added "choose starting page" dropdown
    • Selecting a page/task in the "choose starting page" dropdown will now rearrange the target page/step so it's the first step.
    • Dropdown will clearly spell out which page/step is the "starting page".
    • (update) Dropdown is hidden when there are 0 steps.
  • Workflow header rearrange and restyled.
    • "Preview Workflow" link now moved to the top of the page.
  • Minor/misc:
    • several bit of code have existential safeties (e.g. e.target.name -> e?.target?.name) added.
    • ExperimentalPanel's functions now blanks out the first_task, to be safe.

Screenshot: "preview link" moved to the top of the page. The "choose starting page" dropdown (seen as "Starting Page: T0") is visible next to the "Add New Task" button.

image

Dev Notes

⚠️ Due to how the FEM Classifier defines the "starting page/step/task", "choosing the starting page" may not work the way you expect, if you came from PFE.

  • History: in PFE, workflow.first_task is used to define the first Task a volunteer works on, on the PFE Classifier. (This older classifier organises by tasks, not by steps.)
  • Observation: On FEM's Classifier, workflow.first_task is ignored if a workflow has (a non-empty) workflow.steps. This means explicitly setting workflow.first_task = 'P3' (step key) or workflow.first_task = 'T3' (task key, assuming the task is in the target page) does nothing.
  • Observation: On FEM's Classifier, the first item in a (non-empty) workflow.steps array defines the starting page/step presented to the volunteer.
  • Solution: when "choosing the starting page", the chosen page/step will become the first page/step in the workflow.steps array.

Testing

  • Go to the testing URL.
  • Click on "Quick Setup" in the debug panel, or create a multi-page workflow.
  • The "choose starting page" dropdown should indicate which is the starting page (i.e. the first step/page in the array)
  • Clicking on a Page option dropdown should 1. rearrange the workflow's steps so the target Page is now the first step, and 2. update the result in the dropdown accordingly.
  • Clicking on "Preview Workflow" should take you to the FEM Classifier, where the first step/page is the starting step/page.

Other conditions:

  • If a workflow has 0 Pages, the dropdown should just show the "Choose starting page" option. is hidden.
    • (🤔 thought: maybe I should make this invisible then.)
  • If the "Choose starting page" (default) option is chosen for whatever reason... nothing happens.
  • If a Page is manually rearranged (e.g. dragged-and-dropped) to be the first step/page in the array, the dropdown should also update its details accordingly.

Status

Ready for review. 👌

Requires 7079 to be merged first before this can be merged.

@shaunanoordin shaunanoordin requested a review from a team April 26, 2024 18:02
@shaunanoordin
Copy link
Member Author

PR Update

  • 🆕 "choose starting page" dropdown now hidden when there are no steps.
image

Copy link
Contributor

@goplayoutside3 goplayoutside3 left a comment

Choose a reason for hiding this comment

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

Looks good! I can use the dropdown to select the intended first page.

Comment on lines 199 to 203
// Limited Branching Rule:
// 0. a Step can only have 1 branching task (single answer question task)
// 1. if a Step has a branching task, it can't have any other tasks.
// 2. if a Step already has at least one task, any added question task must be a multiple answer question task.
// 3. if a Step already has many tasks, any multiple answer question task can't be transformed into a single answer question task.
Copy link
Contributor

Choose a reason for hiding this comment

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

This description is different than the solution described in Challenge 3.5 in the notes doc.

disallow a single-answer question task to be combined with another single-answer question task, not disallowing the possibility of combining it with all task types.

Do you plan to change enforceLimitedBranchingRule after this PR? Before or after internal testing?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's correct, the Limited Branching Rule in this PR is the old version. The new version will be implemented in a future PR, with a target to be done before internal testing starts.

(Slack ToDo list, 13 May)

Base automatically changed from pages-editor-pt20 to master May 17, 2024 21:56
@coveralls
Copy link

Coverage Status

coverage: 56.98%. remained the same
when pulling 16b0df0 on pages-editor-pt21
into 229aeab on master.

@shaunanoordin
Copy link
Member Author

Thanks again, Delilah!

@shaunanoordin shaunanoordin merged commit d270c1a into master May 17, 2024
5 checks passed
@shaunanoordin shaunanoordin deleted the pages-editor-pt21 branch May 17, 2024 22:31
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.

3 participants