-
Notifications
You must be signed in to change notification settings - Fork 30
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
VV - Implement Classifier Tool/Task #6511
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.
I can run lib-classifier locally or app-project locally and see a viewer + task at https://local.zooniverse.org:3000/kieftrav/volumetric-viewer 👍
Two blocking things:
- I'm unable to run lib-classifier's Storybook on this branch. Every story errors with
Error: Cannot find module 'ajv-formats'
. Is that the case for you? - The handling of
disabled
in VolumetricTask is hardcoded and therefore contradicts its Readme statement about disabling the task UI until the subject's json content is loaded.
align-content: center; | ||
display: block; |
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.
This is display: block
not flex, so align-content
won't apply. Did you mean to include this change?
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.
So, when I revert this the alignment looks off. My understanding is that the align-content
helps with the current element in the context of it's parent flex
attribute. Could be wrong, but was trying to fix the visual issue you see in the screenshots below. Happy to revert if it should be handled in another way.
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.
Ah I see. Through PR history it looks like the display: block
was copy pasted from when the label text was a span
instead of a Grommet Text. This alignment change is fine to keep in this PR, but I recommend removing display: block
to avoid confusion during code read. TBH it doesn't even need the margin: 1em 0
either. That was probably an attempt to vertically align the text awhile back, now solved by align-content
instead.
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 - removed both and looks good.
|
||
<TaskInput | ||
checked={true} | ||
disabled={false} |
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.
The ReadMe for this components says "The volumetric task is disabled until the subject's JSON content is loaded". You've hardcoded disabled
as false
here. How is the task disabled while JSON content is loading? Did you mean to add that feature in a separate PR?
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.
I updated the README and code... I meant to disable the task until the Subject is loaded. This has been fixed/added and elaborated a bit more in my reply below.
</StyledInstructionText> | ||
|
||
<TaskInput | ||
checked={true} |
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.
Is this hardcoded as true
because there's only ever one active tool in any volumetric project? If that's the case please include a brief code comment here because checked
and index
props for TaskInput were originally designed for multi-tool drawing 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.
Yes - that's why. Added the comment.
it("should show the classification count", function () { | ||
render(<DefaultStory />) | ||
expect(screen.getByText("InputStatus.drawn")).to.be.ok() | ||
}) |
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.
This works for now, but InputStatus.drawn
also includes the variable count
. A more robust test would look for count = 3
(because that's what you've hardcoded it as for now), and when the annotations feature is added for volumetric subjects, then you'd pass annotations
to the VolumetricTask stories and look for the appropriate count number used in the stories.
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.
Yup - agreed. That'll come in the next PR.
@@ -0,0 +1,23 @@ | |||
import cuid from "cuid" |
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.
A comment just for awareness that if you'e going to continue using cuid
it is a deprecated third-party package as documented in #6493. All of the other task models still use it so this is just an fyi.
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.
Yup - thank you for the cross-reference visibility
return self.experimental_tools.includes('volumetricViewer') | ||
return self.experimental_tools.includes('volumetricProject') |
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.
I noticed the label on your staging project's admin page is still VolumetricViewer
. Are there still updates needed in the PFE codebase to align it with VolumetricProject
?
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.
Nope - these will be kept in sync when PFE PR #7227 merges & is deployed.
No - I did a
Good catch. I added in a check for the |
function VolumetricTask({ task }) { | ||
const stores = useContext(MobXProviderContext) | ||
const subjectReadyState = stores.classifierStore?.subjectViewer?.loadingState ?? asyncStates.loading |
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.
function VolumetricTask({ task }) { | |
const stores = useContext(MobXProviderContext) | |
const subjectReadyState = stores.classifierStore?.subjectViewer?.loadingState ?? asyncStates.loading | |
function VolumetricTask({ disabled = false, task }) { |
disabled
is already available as a prop from Tasks
Line 56 in 0a09c9d
disabled={disabled || !ready} |
No need to hook into context, you should use the disabled
prop already provided. Examples are in SurveyTask, SimpleDropdownTask, TextFromSubjectTask, SingleChoiceTask, etc.
(Sorry if this shows up as a dupe notification, I just wanted to re-comment with code changes suggested)
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.
Got this change incorporated as well. Thanks!
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.
Storybook looks good. See my two recent comments for non-blocking code clean up.
Package
Describe your changes
Create the Volumetric Tool/Task and properly wire it into the Classifier. Also creates the basic structure for the Annotation, but that will be refactored/fleshed out in the follow up PR. Specifically, there is a missing
VolumetricAnnotation.spec.js
file that is missing and will be added in the next PR (along with the incorporation of the Volumetric Viewer's annotation model).How to Review
General
yarn panic && yarn bootstrap
ordocker-compose up --build
and FEM works as expectedGeneral UX
Example Staging Project: i-fancy-cats
New Feature
Post-merge