diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index c43f6c08572..914c946bd3e 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -26,7 +26,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fixed support for rendering of negative floats. [#6895](https://github.com/scalableminds/webknossos/pull/6895) - Fixed caching issues with webworkers. [#6932](https://github.com/scalableminds/webknossos/pull/6932) - Fixed download button for annotations which was disabled in some cases. [#6931](https://github.com/scalableminds/webknossos/pull/6931) - +- Fixed antd deprecation warning for Dropdown menus. [#6898](https://github.com/scalableminds/webknossos/pull/6898) ### Removed ### Breaking Changes diff --git a/frontend/javascripts/admin/task/task_annotation_view.tsx b/frontend/javascripts/admin/task/task_annotation_view.tsx index d600640e562..2ff8b4ca534 100644 --- a/frontend/javascripts/admin/task/task_annotation_view.tsx +++ b/frontend/javascripts/admin/task/task_annotation_view.tsx @@ -1,4 +1,4 @@ -import { Dropdown, Menu, Modal } from "antd"; +import { Dropdown, MenuProps, Modal } from "antd"; import { EyeOutlined, PlayCircleOutlined, @@ -30,7 +30,6 @@ import Toast from "libs/toast"; import TransferTaskModal from "dashboard/transfer_task_modal"; import messages from "messages"; import { getVolumeDescriptors } from "oxalis/model/accessors/volumetracing_accessor"; -const { Item } = Menu; const { confirm } = Modal; type OwnProps = { task: APITask; @@ -101,7 +100,7 @@ class TaskAnnotationView extends React.PureComponent { })); }; - getDropdownMenu(annotation: APIAnnotation) { + getDropdownMenu(annotation: APIAnnotation): MenuProps { let doesAnnotationNotBelongToActiveUser = true; if (annotation.owner && this.props.activeUser) { @@ -120,57 +119,64 @@ class TaskAnnotationView extends React.PureComponent { Open ); - return ( - - - {label} - - - + return { + items: [ + { + key: `${annotation.id}-view`, + label: {label}, + }, + { + key: `${annotation.id}-transfer`, + onClick: () => this.setState({ currentAnnotation: annotation, isTransferModalOpen: true, - }) - } - > - - Transfer - - - { - const isVolumeIncluded = getVolumeDescriptors(annotation).length > 0; - return downloadAnnotation(annotation.id, "Task", isVolumeIncluded); - }} - icon={} - > - Download - - - this.resetAnnotation(annotation)}> - - Reset - - this.deleteAnnotation(annotation)}> - - Reset and Cancel - - {annotation.state === "Finished" ? ( - this.reOpenAnnotation(annotation)}> - - Reopen - - ) : ( - this.finishAnnotation(annotation)}> - - Finish - - )} - - ); + }), + icon: , + label: "Transfer", + }, + { + key: `${annotation.id}-download`, + label: ( + { + const isVolumeIncluded = getVolumeDescriptors(annotation).length > 0; + return downloadAnnotation(annotation.id, "Task", isVolumeIncluded); + }} + icon={} + > + Download + + ), + }, + { + key: `${annotation.id}-reset`, + onClick: () => this.resetAnnotation(annotation), + icon: , + label: "Reset", + }, + { + key: `${annotation.id}-delete`, + onClick: () => this.deleteAnnotation(annotation), + icon: , + label: "Reset and Cancel", + }, + annotation.state === "Finished" + ? { + key: `${annotation.id}-reopen`, + onClick: () => this.reOpenAnnotation(annotation), + icon: , + label: "Reopen", + } + : { + key: `${annotation.id}-finish`, + onClick: () => this.finishAnnotation(annotation), + icon: , + label: "Finish", + }, + ], + }; } render() { @@ -206,7 +212,7 @@ class TaskAnnotationView extends React.PureComponent { - + Actions diff --git a/frontend/javascripts/admin/task/task_search_form.tsx b/frontend/javascripts/admin/task/task_search_form.tsx index 25d0a19201a..4a99977d5f4 100644 --- a/frontend/javascripts/admin/task/task_search_form.tsx +++ b/frontend/javascripts/admin/task/task_search_form.tsx @@ -1,4 +1,4 @@ -import { Form, Row, Dropdown, Menu, Col, Button, Input, Select } from "antd"; +import { Form, Row, Dropdown, Col, Button, Input, Select } from "antd"; import { FormInstance } from "antd/lib/form"; import { DownloadOutlined, DownOutlined, RetweetOutlined } from "@ant-design/icons"; // @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@sca... Remove this comment to see the full error message @@ -276,14 +276,16 @@ class TaskSearchForm extends React.Component { }} > this.handleSearchFormFinish(true)}> - - - Show random subset - - - } + menu={{ + onClick: () => this.handleSearchFormFinish(true), + items: [ + { + key: "1", + icon: , + label: "Show random subset", + }, + ], + }} > - +