From e293f359c99d0f8be6ef693d3bd357cea041d128 Mon Sep 17 00:00:00 2001 From: Benjamin Bearce Date: Mon, 22 Jan 2024 20:56:47 -0500 Subject: [PATCH 1/3] quota message details and link to user quote --- src/static/riot/competitions/detail/submission_upload.tag | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/static/riot/competitions/detail/submission_upload.tag b/src/static/riot/competitions/detail/submission_upload.tag index 1e2d89508..406a8ee81 100644 --- a/src/static/riot/competitions/detail/submission_upload.tag +++ b/src/static/riot/competitions/detail/submission_upload.tag @@ -488,7 +488,9 @@ } } - toastr.error("Creation failed, error occurred") + toastr.error(`Creation failed, error occurred: ${response.responseJSON.data_file[0]}`) + setTimeout(()=>{toastr.warning(`Click HERE to go to the Resources tab to see your user quote.`)}, 5000) + }) .always(function () { setTimeout(self.hide_progress_bar, 500) From e9ae970b460753a928ee407fca390fe3412b0b6b Mon Sep 17 00:00:00 2001 From: didayolo Date: Tue, 23 Jan 2024 15:03:54 +0100 Subject: [PATCH 2/3] Update quota error messages --- src/apps/api/tests/test_datasets.py | 2 +- src/apps/api/views/datasets.py | 2 +- src/static/riot/competitions/detail/submission_upload.tag | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/api/tests/test_datasets.py b/src/apps/api/tests/test_datasets.py index 40b4dbf5d..944981757 100644 --- a/src/apps/api/tests/test_datasets.py +++ b/src/apps/api/tests/test_datasets.py @@ -65,7 +65,7 @@ def test_dataset_api_check_quota(self): }) assert resp.status_code == 400 - assert resp.data["data_file"][0] == f"Insufficient space. Your available space is {pretty_bytes(available_space)}. The file size is {pretty_bytes(file_size)}. Please free up some space and try again." + assert resp.data["data_file"][0] == f'Insufficient space. Your available space is {pretty_bytes(available_space)}. The file size is {pretty_bytes(file_size)}. Please free up some space and try again. You can manage your files in the Resources page.' # Fake upload a small file file_size = available_space - 1024 diff --git a/src/apps/api/views/datasets.py b/src/apps/api/views/datasets.py index 1f4fffa65..2175b9dc0 100644 --- a/src/apps/api/views/datasets.py +++ b/src/apps/api/views/datasets.py @@ -86,7 +86,7 @@ def create(self, request, *args, **kwargs): if storage_used + file_size > quota: available_space = pretty_bytes(quota - storage_used) file_size = pretty_bytes(file_size) - message = f"Insufficient space. Your available space is {available_space}. The file size is {file_size}. Please free up some space and try again." + message = f'Insufficient space. Your available space is {available_space}. The file size is {file_size}. Please free up some space and try again. You can manage your files in the Resources page.' return Response({'data_file': [message]}, status=status.HTTP_400_BAD_REQUEST) # All good, let's proceed diff --git a/src/static/riot/competitions/detail/submission_upload.tag b/src/static/riot/competitions/detail/submission_upload.tag index 406a8ee81..e463e899a 100644 --- a/src/static/riot/competitions/detail/submission_upload.tag +++ b/src/static/riot/competitions/detail/submission_upload.tag @@ -489,7 +489,7 @@ } } toastr.error(`Creation failed, error occurred: ${response.responseJSON.data_file[0]}`) - setTimeout(()=>{toastr.warning(`Click HERE to go to the Resources tab to see your user quote.`)}, 5000) + setTimeout(()=>{toastr.warning(`Click HERE to go to the Resources tab to see your storage quota and manage your files.`)}, 5000) }) .always(function () { From ec29a31b14b3561c07da2f4f22b9883b36bda1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Pav=C3=A3o?= Date: Tue, 23 Jan 2024 17:43:53 +0100 Subject: [PATCH 3/3] Remove warning from submission_upload.tag --- src/static/riot/competitions/detail/submission_upload.tag | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/static/riot/competitions/detail/submission_upload.tag b/src/static/riot/competitions/detail/submission_upload.tag index e463e899a..75ecc8b2f 100644 --- a/src/static/riot/competitions/detail/submission_upload.tag +++ b/src/static/riot/competitions/detail/submission_upload.tag @@ -489,8 +489,6 @@ } } toastr.error(`Creation failed, error occurred: ${response.responseJSON.data_file[0]}`) - setTimeout(()=>{toastr.warning(`Click HERE to go to the Resources tab to see your storage quota and manage your files.`)}, 5000) - }) .always(function () { setTimeout(self.hide_progress_bar, 500)