Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show success toast after resetting annotation in tasks view #3207

Merged
merged 4 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<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