Skip to content

Commit

Permalink
Show success toast after resetting annotation in tasks view (#3207)
Browse files Browse the repository at this point in the history
* show success toast after resetting annotation in tasks view

* update changelog
  • Loading branch information
philippotto authored Sep 13, 2018
1 parent 2e08469 commit 42c1890
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).

- Fixed a bug where large volume downloads contained invalid data.zip archives. [#3086](https://github.com/scalableminds/webknossos/pull/3086)
- Fixed the sorting of the dashboard task list and explorative annotation list. [#3153](https://github.com/scalableminds/webknossos/pull/3153)
- Fixed a missing notification when a task annotation was reset. [#3207](https://github.com/scalableminds/webknossos/pull/3207)
- Fixed a bug where non-privileged users were wrongly allowed to pause/unpause projects. [#3097](https://github.com/scalableminds/webknossos/pull/3097)
- Fixed a regression bug which caused the initial data loading to fail sometimes. [#3149](https://github.com/scalableminds/webknossos/pull/3149)
- Fixed a bug which caused a blank screen sometimes when the user is not logged in. [#3167](https://github.com/scalableminds/webknossos/pull/3167)
Expand Down
17 changes: 11 additions & 6 deletions app/assets/javascripts/admin/task/task_annotation_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
resetAnnotation,
deleteAnnotation,
} from "admin/admin_rest_api";
import Toast from "libs/toast";
import messages from "messages";
import TransferTaskModal from "dashboard/transfer_task_modal";
import type { APIUserType, APITaskType, APIAnnotationType } from "admin/api_flow_types";
Expand Down Expand Up @@ -64,6 +65,11 @@ class TaskAnnotationView extends React.PureComponent<Props & StateProps, State>
});
};

resetAnnotation = async (annotation: APIAnnotationType) => {
await resetAnnotation(annotation.id, annotation.typ);
Toast.success(messages["annotation.reset_success"]);
};

finishAnnotation = async (annotation: APIAnnotationType) => {
const updatedAnnotation = await finishAnnotation(annotation.id, annotation.typ);
this.updateAnnotationState(updatedAnnotation);
Expand All @@ -90,16 +96,15 @@ class TaskAnnotationView extends React.PureComponent<Props & StateProps, State>
doesAnnotationNotBelongToActiveUser = annotation.user.id !== this.props.activeUser.id;
}

// TODO use react fragments <> instead of spans
const label =
annotation.state === "Finished" || doesAnnotationNotBelongToActiveUser ? (
<span>
<React.Fragment>
<Icon type="eye-o" />View
</span>
</React.Fragment>
) : (
<span>
<React.Fragment>
<Icon type="play-circle-o" />Trace
</span>
</React.Fragment>
);

return (
Expand All @@ -123,7 +128,7 @@ class TaskAnnotationView extends React.PureComponent<Props & StateProps, State>
</a>
</Item>
<Item key={`${annotation.id}-reset`}>
<span onClick={() => resetAnnotation(annotation.id, annotation.typ)}>
<span onClick={() => this.resetAnnotation(annotation)}>
<Icon type="rollback" />Reset
</span>
</Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class DashboardTaskListView extends React.PureComponent<Props, State> {
okText: messages.yes,
onOk: async () => {
await resetAnnotation(annotation.id, annotation.typ);
Toast.success(messages["task.reset_success"]);
Toast.success(messages["annotation.reset_success"]);
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ In order to restore the current window, a reload is necessary.`,
"The next task will most likely be part of project <%- projectName %>",
),
"task.confirm_reset": "Do you really want to reset this task?",
"task.reset_success": "Annotation was successfully reset.",
"annotation.reset_success": "Annotation was successfully reset.",
"task.bulk_create_invalid":
"Can not parse task specification. It includes at least one invalid task.",
"dataset.clear_cache_success": "The dataset was reloaded successfully",
Expand Down

0 comments on commit 42c1890

Please sign in to comment.