From 08b1d8e601aa2dfce4c89b82b252e33474ed8862 Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Wed, 23 Oct 2024 17:30:13 +0500 Subject: [PATCH 1/5] upload task interface added and placeholder api and functions created --- src/apps/api/views/tasks.py | 4 +++ src/static/js/ours/client.js | 3 ++ src/static/riot/tasks/management.tag | 47 ++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/src/apps/api/views/tasks.py b/src/apps/api/views/tasks.py index 71bfb59bd..2495e1e65 100644 --- a/src/apps/api/views/tasks.py +++ b/src/apps/api/views/tasks.py @@ -137,6 +137,10 @@ def delete_many(self, request): status=status.HTTP_400_BAD_REQUEST if errors else status.HTTP_200_OK ) + @action(detail=False, methods=('POST',)) + def upload_task(self, request): + pass + # This function allows for multiple errors when deleting multiple objects def check_delete_permissions(self, request, task): if request.user != task.created_by: diff --git a/src/static/js/ours/client.js b/src/static/js/ours/client.js index 489a01273..c1fb8c64d 100644 --- a/src/static/js/ours/client.js +++ b/src/static/js/ours/client.js @@ -257,6 +257,9 @@ CODALAB.api = { create_task: (data) => { return CODALAB.api.request('POST', `${URLS.API}tasks/`, data) }, + upload_task: (data_file) => { + return CODALAB.api.request('POST', URLS.API + 'tasks/upload_task/') + }, share_task: (pk, data) => { return CODALAB.api.request('PATCH', `${URLS.API}tasks/${pk}/`, data) }, diff --git a/src/static/riot/tasks/management.tag b/src/static/riot/tasks/management.tag index 927bdad3b..dd22598cd 100644 --- a/src/static/riot/tasks/management.tag +++ b/src/static/riot/tasks/management.tag @@ -7,6 +7,9 @@ +
+ Upload Task +
Create Task
@@ -167,6 +170,35 @@ + + +