From 9d723fbbeaf5b5668be9cb7cdc2267bcdaa0b08a Mon Sep 17 00:00:00 2001 From: kieftrav Date: Mon, 16 Dec 2024 07:06:37 -0600 Subject: [PATCH] Create Volumetric Task (#7227) * Create Volumetric Task * Clean up based on PR feedback --- app/classifier/tasks/generic-editor.cjsx | 1 + app/classifier/tasks/index.js | 4 +- app/classifier/tasks/volumetric/index.jsx | 44 +++++++++++++++++++ .../project-status/experimental-features.jsx | 2 +- app/pages/lab-fem/workflow.jsx | 10 ++++- 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 app/classifier/tasks/volumetric/index.jsx diff --git a/app/classifier/tasks/generic-editor.cjsx b/app/classifier/tasks/generic-editor.cjsx index 009e19e95d..690a17736d 100644 --- a/app/classifier/tasks/generic-editor.cjsx +++ b/app/classifier/tasks/generic-editor.cjsx @@ -47,6 +47,7 @@ module.exports = createReactClass when 'slider' then ['instruction'] when 'highlighter' then ['instruction', 'highlighterLabels'] when 'dataVisAnnotation' then ['instruction', 'tools'] + when 'volumetric' then ['instruction'] isAQuestion = @props.task.type in ['single', 'multiple'] canBeRequired = @props.task.type in ['single', 'multiple', 'text'] diff --git a/app/classifier/tasks/index.js b/app/classifier/tasks/index.js index 56eda24575..745fac33be 100644 --- a/app/classifier/tasks/index.js +++ b/app/classifier/tasks/index.js @@ -13,6 +13,7 @@ import Highlighter from './highlighter'; import TranscriptionTask from './transcription'; import SubjectGroupComparisonTask from './subjectGroupComparison'; import DataVisAnnotationTask from './dataVisAnnotation' +import VolumetricTask from './volumetric'; const tasks = { combo: ComboTask, @@ -29,7 +30,8 @@ const tasks = { highlighter: Highlighter, transcription: TranscriptionTask, subjectGroupComparison: SubjectGroupComparisonTask, - dataVisAnnotation: DataVisAnnotationTask + dataVisAnnotation: DataVisAnnotationTask, + volumetric: VolumetricTask }; export default tasks; diff --git a/app/classifier/tasks/volumetric/index.jsx b/app/classifier/tasks/volumetric/index.jsx new file mode 100644 index 0000000000..076d0327af --- /dev/null +++ b/app/classifier/tasks/volumetric/index.jsx @@ -0,0 +1,44 @@ +import PropTypes from "prop-types"; +import React from "react"; +import GenericTaskEditor from "../generic-editor"; + +export default class VolumetricTask extends React.Component { + render() { + return
This is a placeholder for the Volumetric Task, which is only visible in the FEM Classifier
; + } +} + +VolumetricTask.Editor = GenericTaskEditor; + +VolumetricTask.getDefaultTask = () => ({ + help: "", + instruction: "Describe how to use this tool", + type: "volumetric", +}); + +VolumetricTask.getTaskText = (task) => task.instruction; + +VolumetricTask.getDefaultAnnotation = () => ({ value: [] }); + +VolumetricTask.defaultProps = { + showRequiredNotice: false, + task: { + help: "", + required: false, + type: "volumetric", + instruction: "Describe how to use this tool", + }, + workflow: { + tasks: [], + }, +}; + +VolumetricTask.propTypes = { + showRequiredNotice: PropTypes.bool, + task: PropTypes.shape({ + help: PropTypes.string, + instruction: PropTypes.string, + required: PropTypes.bool, + type: PropTypes.string, + }) +}; diff --git a/app/pages/admin/project-status/experimental-features.jsx b/app/pages/admin/project-status/experimental-features.jsx index 045d064977..994f1fe2b8 100644 --- a/app/pages/admin/project-status/experimental-features.jsx +++ b/app/pages/admin/project-status/experimental-features.jsx @@ -34,7 +34,7 @@ const experimentalFeatures = [ 'textFromSubject', // textFromSubject task only works in FEM! 'transcription-task', 'translator-role', - 'volumetricViewer', + 'volumetricProject', // Turns a project into a Volumetric-enabled Project 'wildcam classroom', // Indicates a Project is linked to a "WildCam Lab"-type Zooniverse Classroom. Allows the classifier to select a workflow (i.e. "classroom assignment") directly via ID. 'workflow assignment', 'worldwide telescope' diff --git a/app/pages/lab-fem/workflow.jsx b/app/pages/lab-fem/workflow.jsx index 7361dbf575..02be530229 100644 --- a/app/pages/lab-fem/workflow.jsx +++ b/app/pages/lab-fem/workflow.jsx @@ -151,7 +151,7 @@ class EditWorkflowPage extends Component { } = this.props.workflow.configuration; if (hide_classification_summaries === undefined) { hide_classification_summaries = true; } - const isCaesarDataFetchingEnabled = this.props.workflow?.configuration?.enable_caesar_data_fetching ?? false; + const isCaesarDataFetchingEnabled = this.props.workflow?.configuration?.enable_caesar_data_fetching ?? false; return (
@@ -301,6 +301,14 @@ class EditWorkflowPage extends Component { Data annotation : undefined}{' '} + {this.canUseTask(this.props.project, "volumetricProject") ? + + + : undefined}{' '}
: undefined}