From 8eaa2fcb7b9f3ababb901fa3dc549b30f740d426 Mon Sep 17 00:00:00 2001 From: Krishna Mahato Date: Sat, 13 Aug 2022 14:10:02 +0530 Subject: [PATCH] feat(UI): Upload permissions page UI and API Implementation done --- src/Routes.jsx | 8 + src/api/upload.js | 25 ++ src/assets/images/loader.svg | 6 + src/components/Header/index.jsx | 6 + src/components/Widgets/Input/index.jsx | 10 +- src/constants/constants.js | 38 ++ src/constants/endpoints.js | 4 + src/constants/routes.js | 1 + src/pages/Admin/uploadPermissions/index.jsx | 411 ++++++++++++++++++++ src/services/upload.js | 16 + src/utils/index.js | 53 +++ 11 files changed, 574 insertions(+), 4 deletions(-) create mode 100644 src/assets/images/loader.svg create mode 100644 src/pages/Admin/uploadPermissions/index.jsx create mode 100644 src/utils/index.js diff --git a/src/Routes.jsx b/src/Routes.jsx index 7f5f48603..a0d7d6bb4 100644 --- a/src/Routes.jsx +++ b/src/Routes.jsx @@ -91,6 +91,9 @@ const UploadDelete = React.lazy(() => import("pages/Organize/Uploads/Delete")); // Admin Pages const GroupCreate = React.lazy(() => import("pages/Admin/Group/Create")); const DeleteUser = React.lazy(() => import("pages/Admin/Users/Delete")); +const UploadPermissions = React.lazy(() => + import("pages/Admin/uploadPermissions") +); const AddLicense = React.lazy(() => import("pages/Admin/License/Create")); const SelectLicense = React.lazy(() => import("pages/Admin/License/SelectLicense") @@ -294,6 +297,11 @@ const Routes = () => { path={routes.admin.license.selectLicense} component={SelectLicense} /> + { }); }; +// Getting all groups with permissions based on upload ID +export const getGroupsWithPermissionsApi = (uploadId) => { + const url = endpoints.upload.getGroupsWithPermissions(uploadId); + return sendRequest({ + url, + method: "GET", + headers: { + Authorization: getToken(), + }, + }); +}; + +// change permissions for a upload for different groups +export const changeUploadPermissionsApi = (payload) => { + const url = endpoints.upload.uploadPermissions(payload.uploadId); + return sendRequest({ + url, + method: "PUT", + body: payload, + headers: { + Authorization: getToken(), + }, + }); +}; + // Getting a Upload License export const getUploadLicenseApi = (uploadId, agent) => { const url = endpoints.upload.getLicense(uploadId); diff --git a/src/assets/images/loader.svg b/src/assets/images/loader.svg new file mode 100644 index 000000000..7c0fcc2ea --- /dev/null +++ b/src/assets/images/loader.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/components/Header/index.jsx b/src/components/Header/index.jsx index b1c310d0a..edecf679b 100644 --- a/src/components/Header/index.jsx +++ b/src/components/Header/index.jsx @@ -261,6 +261,12 @@ const Header = () => { + + Upload Permissions + {children && ( - + <> + +   + )} -