diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 64038389230..2aec15fd3dc 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -18,6 +18,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Added an "extrude segment" feature which is similar to the old "copy from previous slice" feature. The segment interpolation and the new segment extrusion feature are both available via the toolbar (see the dropdown icon which was added to the old interpolation button). [#6370](https://github.com/scalableminds/webknossos/pull/6370) - Added support for ad-hoc meshing for volume annotation layers with fallback segmentations. [#6369](https://github.com/scalableminds/webknossos/pull/6369) - Added new backend API route for requesting all publications. Those publications can now have also attached annotations. [#6315](https://github.com/scalableminds/webknossos/pull/6315) +- Added a "duplicate" button for annotations. [#6386](https://github.com/scalableminds/webknossos/pull/6386) ### Changed diff --git a/docs/tracing_ui.md b/docs/tracing_ui.md index 62ab2dc0922..6997e116725 100644 --- a/docs/tracing_ui.md +++ b/docs/tracing_ui.md @@ -24,6 +24,7 @@ The most common buttons are: - `Archive`: Closes the annotation and archives it, removing it from a user's dashboard. Archived annotations can be found on a user's dashboard under "Annotations" and by clicking on "Show Archived Annotations". Use this to declutter your dashboard. (Not available for tasks) - `Download`: Starts a download of the current annotation including any skeleton and volume data. Skeleton annotations are downloaded as [NML](./data_formats.md#nml) files. Volume annotation downloads contain the raw segmentation data as [WKW](./data_formats.md#wkw) files. - `Share`: Create a shareable link to your dataset containing the current position, rotation, zoom level etc. Use this to collaboratively work with colleagues. Read more about this feature in the [Sharing guide](./sharing.md). +- `Duplicate`: Create a duplicate of this annotation. The duplicate will be created in your account, even if the original annotation belongs to somebody else. - `Add Script`: Using the [webKnossos frontend API](https://webknossos.org/assets/docs/frontend-api/index.html) users can script and automate webKnossos interactions. Enter and execute your user scripts (Javascript) from here. Admins can curate a collection of frequently used scripts for your organization and make them available for quick selection to all users. - `Restore Older Version`: Opens a window that shows all previous versions of an annotation. webKnossos keeps a complete version history of all your changes to an annotation (separate for skeleton/volume). From this window, any older version can be selected, previewed, and restored. diff --git a/frontend/javascripts/admin/admin_rest_api.ts b/frontend/javascripts/admin/admin_rest_api.ts index 0b82b1e099c..60988562f8a 100644 --- a/frontend/javascripts/admin/admin_rest_api.ts +++ b/frontend/javascripts/admin/admin_rest_api.ts @@ -722,7 +722,7 @@ export function finishAllAnnotations(selectedAnnotationIds: Array): Prom ); } -export function copyAnnotationToUserAccount( +export function duplicateAnnotation( annotationId: string, annotationType: APIAnnotationType, ): Promise { diff --git a/frontend/javascripts/oxalis/view/action-bar/tracing_actions_view.tsx b/frontend/javascripts/oxalis/view/action-bar/tracing_actions_view.tsx index b0002e1c37c..294fac1ab90 100644 --- a/frontend/javascripts/oxalis/view/action-bar/tracing_actions_view.tsx +++ b/frontend/javascripts/oxalis/view/action-bar/tracing_actions_view.tsx @@ -4,6 +4,7 @@ import { CheckCircleOutlined, CheckOutlined, CodeSandboxOutlined, + CopyOutlined, DeleteOutlined, DisconnectOutlined, DownloadOutlined, @@ -30,7 +31,7 @@ import { AsyncButton, AsyncButtonProps } from "components/async_clickables"; import type { LayoutKeys } from "oxalis/view/layouting/default_layout_configs"; import { mapLayoutKeysToLanguage } from "oxalis/view/layouting/default_layout_configs"; import { - copyAnnotationToUserAccount, + duplicateAnnotation, finishAnnotation, reOpenAnnotation, createExplorational, @@ -302,11 +303,21 @@ class TracingActionsView extends React.PureComponent { }; handleCopyToAccount = async () => { - const newAnnotation = await copyAnnotationToUserAccount( + // duplicates the annotation in the current user account + const newAnnotation = await duplicateAnnotation( this.props.annotationId, this.props.annotationType, ); - location.href = `/annotations/Explorational/${newAnnotation.id}`; + location.href = `/annotations/${newAnnotation.id}`; + }; + + handleDuplicate = async () => { + await Model.ensureSavedState(); + const newAnnotation = await duplicateAnnotation( + this.props.annotationId, + this.props.annotationType, + ); + location.href = `/annotations/${newAnnotation.id}`; }; handleCopySandboxToAccount = async () => { @@ -583,6 +594,14 @@ class TracingActionsView extends React.PureComponent { annotationId={annotationId} />, ); + if (activeUser != null) { + elements.push( + + + Duplicate + , + ); + } elements.push(screenshotMenuItem); elements.push(