Skip to content

Commit

Permalink
Fix analytics event for dataset-upload-page (#5526)
Browse files Browse the repository at this point in the history
* fix analytics event for dataset-upload-page and never show error for failed analytics requests

* update changelog
  • Loading branch information
philippotto authored May 31, 2021
1 parent 0d9c58e commit b3316c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed a bug where NMLs with huge tree IDs uploaded via back-end produced broken annotations. [#5484](https://github.com/scalableminds/webknossos/pull/5484)
- Fixed a bug where the upload of multiple NMLs failed if some of them have an organization attribute and others don’t. [#5483](https://github.com/scalableminds/webknossos/pull/5483)
- Fixed a bug in the application of agglomerate files where the `cumsum.json` was not used correctly. [#5499](https://github.com/scalableminds/webknossos/pull/5499)
- Fixed an innocuous error toast when opening the dataset import view. [#5526](https://github.com/scalableminds/webknossos/pull/5526)

### Removed
- Removed the button to load or refresh the isosurface of the centered cell from the 3D view. Instead, this action can be triggered from the "Meshes" tab. [#5440](https://github.com/scalableminds/webknossos/pull/5440)
Expand Down
10 changes: 4 additions & 6 deletions frontend/javascripts/admin/admin_rest_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,20 @@ export function doWithToken<T>(fn: (token: string) => Promise<T>, tries: number
});
}

export function sendAnalyticsEvent(eventType: string, eventProperties: Object): void {
export function sendAnalyticsEvent(eventType: string, eventProperties: {} = {}): void {
// Note that the Promise from sendJSONReceiveJSON is not awaited or returned here,
// since failing analytics events should not have an impact on the application logic.
Request.sendJSONReceiveJSON(`/api/analytics/${eventType}`, {
method: "POST",
data: eventProperties,
showErrorToast: false,
});
}

export function sendFailedRequestAnalyticsEvent(
requestType: string,
error: Object,
requestProperties: Object,
requestProperties: {},
): void {
const eventProperties = {
request_type: requestType,
Expand Down Expand Up @@ -1035,10 +1036,7 @@ export function createResumableUpload(
);
}

export function finishDatasetUpload(
datastoreHost: string,
uploadInformation: Object,
): Promise<void> {
export function finishDatasetUpload(datastoreHost: string, uploadInformation: {}): Promise<void> {
return doWithToken(token =>
Request.sendJSONReceiveJSON(`/data/datasets/finishUpload?token=${token}`, {
data: uploadInformation,
Expand Down

0 comments on commit b3316c8

Please sign in to comment.