From 5e4ef57aff0dec336e133cc917259a97c8125c82 Mon Sep 17 00:00:00 2001 From: kieftrav Date: Tue, 26 Nov 2024 08:42:14 -0600 Subject: [PATCH 1/2] Create Volumetric Task --- app/classifier/tasks/generic-editor.cjsx | 1 + app/classifier/tasks/index.js | 4 +- app/classifier/tasks/volumetric/index.jsx | 50 +++++++++++++++++++ .../project-status/experimental-features.jsx | 2 +- app/pages/lab-fem/workflow.jsx | 10 +++- 5 files changed, 64 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..abd159c195 --- /dev/null +++ b/app/classifier/tasks/volumetric/index.jsx @@ -0,0 +1,50 @@ +import PropTypes from "prop-types"; +import React from "react"; +import GenericTaskEditor from "../generic-editor"; + +export default class VolumetricTask extends React.Component { + constructor(props) { + super(props); + } + render() { + return
{"VolumetricTask Tool"}
; + } +} + +VolumetricTask.Editor = GenericTaskEditor; + +VolumetricTask.getDefaultTask = () => ({ + help: "", + instruction: "Describe how to use this tool", + type: "volumetric", +}); + +VolumetricTask.getTaskText = (task) => task.instruction; + +VolumetricTask.getDefaultAnnotation = () => ({ _toolIndex: 0, value: [] }); + +VolumetricTask.defaultProps = { + showRequiredNotice: false, + task: { + help: "", + 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, + tools: PropTypes.array, + type: PropTypes.string, + }), + workflow: PropTypes.shape({ + tasks: PropTypes.object, + }), +}; 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} From 3f00f50d4d3ad06fc1e8dd6e7cae8ec8483d7762 Mon Sep 17 00:00:00 2001 From: kieftrav Date: Mon, 9 Dec 2024 10:57:30 -0600 Subject: [PATCH 2/2] Clean up based on PR feedback --- app/classifier/tasks/volumetric/index.jsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/classifier/tasks/volumetric/index.jsx b/app/classifier/tasks/volumetric/index.jsx index abd159c195..076d0327af 100644 --- a/app/classifier/tasks/volumetric/index.jsx +++ b/app/classifier/tasks/volumetric/index.jsx @@ -3,11 +3,8 @@ import React from "react"; import GenericTaskEditor from "../generic-editor"; export default class VolumetricTask extends React.Component { - constructor(props) { - super(props); - } render() { - return
{"VolumetricTask Tool"}
; + return
This is a placeholder for the Volumetric Task, which is only visible in the FEM Classifier
; } } @@ -21,12 +18,13 @@ VolumetricTask.getDefaultTask = () => ({ VolumetricTask.getTaskText = (task) => task.instruction; -VolumetricTask.getDefaultAnnotation = () => ({ _toolIndex: 0, value: [] }); +VolumetricTask.getDefaultAnnotation = () => ({ value: [] }); VolumetricTask.defaultProps = { showRequiredNotice: false, task: { help: "", + required: false, type: "volumetric", instruction: "Describe how to use this tool", }, @@ -41,10 +39,6 @@ VolumetricTask.propTypes = { help: PropTypes.string, instruction: PropTypes.string, required: PropTypes.bool, - tools: PropTypes.array, type: PropTypes.string, - }), - workflow: PropTypes.shape({ - tasks: PropTypes.object, - }), + }) };