-
Notifications
You must be signed in to change notification settings - Fork 75
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
Create Volumetric Task #7227
base: master
Are you sure you want to change the base?
Create Volumetric Task #7227
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review
Affects: Project Builder -> Workflow Editor (FEM Lab only)
This PR adds the "VolumetricTask" Task to the Workflow Editor.
On the project builder:
- If a project has the
volumetricViewer
andFEM Lab
experimental tools enabled, then the "Volumetric Task" will be listed as an option when adding a new Task.
On the PFE classifier:
- If a volunteer attempts to load a Volumetric Task on the PFE classifier, then the Task area will just show a placeholder with no input controls.
- The Volumetric Task is only valid on the FEM classifier.
Functionality checks out fine, but I've added a few comments to improve the code.
Testing
Testing project builder, on localhost:
- Enable required experimental tools on a test project.
- Go to, or create, a test workflow, e.g. https://local.zooniverse.org:3735/lab/1982/workflows/3841?femLab=true
- Add a Volumetric Task.
- Add Instructions and Help text to the task.
- Save, and then reload page to confirm changes.
I'm able to create and edit a VolumetricTask with no issues.
Testing PFE classifier, on localhost:
- View the workflow on the PFE classifier: https://local.zooniverse.org:3735/projects/darkeshard/example-1982/classify?reload=0&workflow=3841
Workflow loads fine. A placeholder is show in place of the Task. Nothing crashes.
Testing FEM classifier, on localhost, with app-project:
- Boot up FEM's app-project, on whatever branch of master is current.
- View the workflow on the FEM classifier: https://local.zooniverse.org:3000/projects/darkeshard/example-1982/classify/workflow/3841?env=staging
Workflow loads fine.
Status
LGTM, this meets minimum safety checks - functionality works as advertised for the project builder, and nothing seems to crash on PFE as a whole. 👍
I understand that the VolumetricTask is still in development, so my questions about e.g. "what's the structure of the VolumetricTask annotation?" should be deferred until those details are confirmed. (Or maybe I missed the PR/ADR on FEM.) We can always revisit this code to tweak, anyhoo.
Regarding my comments on the code in this PR:
- my main concern is that the default props, prop types, etc shouldn't add code that's unused, e.g. I don't think VolumetricTask uses tools.
- I'm assuming things like tools, _toolIndex etc are leftovers from using the code pattern from similar Tasks (Drawing Task?)
- If I'm wrong about this, please let me know - perhaps I need to those questions about annotation structure earlier.
- I'm also in favour of making the code clearer for future devs to read, so some things like the placeholder text on render() could use a minor text improvement.
workflow: { | ||
tasks: [], | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query: what's the workflow
used for?
If we're following the same Task pattern in PFE, then this parameter isn't required. We only really need task
and showRequiredNotice
.
(In practice, it double doesn't matter, since this Task shouldn't be working in PFE. 🤔 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome - thank you for the context. Removed.
|
||
VolumetricTask.getTaskText = (task) => task.instruction; | ||
|
||
VolumetricTask.getDefaultAnnotation = () => ({ _toolIndex: 0, value: [] }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this task annotation actually use _toolIndex
? If not, then this could just be VolumetricTask.getDefaultAnnotation = () => ({});
to avoid any confusion.
VolumetricTask.propTypes = { | ||
showRequiredNotice: PropTypes.bool, | ||
task: PropTypes.shape({ | ||
help: PropTypes.string, | ||
instruction: PropTypes.string, | ||
required: PropTypes.bool, | ||
tools: PropTypes.array, | ||
type: PropTypes.string, | ||
}), | ||
workflow: PropTypes.shape({ | ||
tasks: PropTypes.object, | ||
}), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query: are propTypes.task.tools
and propTypes.workflow
actually needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed - didn't need them.
super(props); | ||
} | ||
render() { | ||
return <div>{"VolumetricTask Tool"}</div>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[minor] This could be a bit more descriptive. e.g. "This is a placeholder for the Volumetric Task, which is only supposed to work on the FEM Classifier."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed and implemented.
Staging branch URL: https://pr-7227.pfe-preview.zooniverse.org
Describe your changes.
Required Manual Testing
Things you should be able to do:
Requests for PR Review
Standard Tests
Review Checklist
npm ci
and app works as expected?Optional
ChangeListener
orPromiseRenderer
components with code that updates component state?