From 1bffda3da59addf8d6da3d5afee8dce4006e38e6 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Fri, 3 Nov 2023 11:20:22 -0700 Subject: [PATCH 1/3] fix(CentralIdentity): fix instructor verification pagination --- .../CentralIdentity/CentralIdentityInstructorVerifications.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/screens/conductor/controlpanel/CentralIdentity/CentralIdentityInstructorVerifications.tsx b/client/src/screens/conductor/controlpanel/CentralIdentity/CentralIdentityInstructorVerifications.tsx index 4a3f3698..69074001 100644 --- a/client/src/screens/conductor/controlpanel/CentralIdentity/CentralIdentityInstructorVerifications.tsx +++ b/client/src/screens/conductor/controlpanel/CentralIdentity/CentralIdentityInstructorVerifications.tsx @@ -61,6 +61,7 @@ const CentralIdentityInstructorVerifications = () => { const res = await axios.get("/central-identity/verification-requests", { params: { activePage, + limit: itemsPerPage, query: searchString, status: 'open', }, From eb0072c793cf523d238f276ccce97243ff288d5f Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Fri, 3 Nov 2023 13:35:17 -0700 Subject: [PATCH 2/3] feat(Instructors): select all default libs function --- .../ApproveVerificationRequestModal.tsx | 78 +++++++++++-------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/client/src/components/controlpanel/CentralIdentity/ApproveVerificationRequestModal.tsx b/client/src/components/controlpanel/CentralIdentity/ApproveVerificationRequestModal.tsx index ee1b163b..04493b7f 100644 --- a/client/src/components/controlpanel/CentralIdentity/ApproveVerificationRequestModal.tsx +++ b/client/src/components/controlpanel/CentralIdentity/ApproveVerificationRequestModal.tsx @@ -36,6 +36,7 @@ const ApproveVerificationRequestModal: React.FC< const [request, setRequest] = useState(); const [allApps, setAllApps] = useState([]); const [approvedApps, setApprovedApps] = useState([]); + const [showDefaultLibs, setShowDefaultLibs] = useState(false); // Effects useEffect(() => { @@ -170,6 +171,13 @@ const ApproveVerificationRequestModal: React.FC< } } + function handleSelectAllLibs() { + const defaultLibs = allApps.filter((app) => app.is_default_library); + for (let i = 0; i < defaultLibs.length; i++) { + handleCheckApp(defaultLibs[i].id); + } + } + return ( @@ -213,38 +221,44 @@ const ApproveVerificationRequestModal: React.FC< className="mb-1r" /> ))} - - Change Default Libraries - - ), - }, - content: { - content: ( -
- {allApps - .filter((app) => app.is_default_library) - .map((app) => ( - handleCheckApp(app.id)} - className="mb-1r" - /> - ))} -
- ), - }, - }, - ]} - /> + + setShowDefaultLibs(!showDefaultLibs)} + > +
+
+ + Change Default Libraries +
+

{ + e.stopPropagation(); + handleSelectAllLibs(); + }} + > + Select All +

+
+
+ +
+ {allApps + .filter((app) => app.is_default_library) + .map((app) => ( + handleCheckApp(app.id)} + className="mb-1r" + /> + ))} +
+
+
)} From f4f45a832e818cadd1620830bab7d96ce125862c Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Fri, 3 Nov 2023 13:49:08 -0700 Subject: [PATCH 3/3] feat(CentralIdentity): select all apps feat when editing user --- .../CentralIdentity/AddUserAppModal.tsx | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/client/src/components/controlpanel/CentralIdentity/AddUserAppModal.tsx b/client/src/components/controlpanel/CentralIdentity/AddUserAppModal.tsx index 94e246e9..1af5bfef 100644 --- a/client/src/components/controlpanel/CentralIdentity/AddUserAppModal.tsx +++ b/client/src/components/controlpanel/CentralIdentity/AddUserAppModal.tsx @@ -59,13 +59,17 @@ const AddUserAppModal: React.FC = ({ setLoading(false); } } + async function submitAddUserApp() { try { setLoading(true); - const res = await axios.post(`/central-identity/users/${userId}/applications`, { - applications: appsToAdd, - }); + const res = await axios.post( + `/central-identity/users/${userId}/applications`, + { + applications: appsToAdd, + } + ); if (res.data.err) { handleGlobalError(res.data.err); @@ -80,8 +84,20 @@ const AddUserAppModal: React.FC = ({ } } + function handleSelectAll() { + setAppsToAdd(availableApps.map((app) => app.id.toString())); + } + + function handleSelectAllDefaultLibs() { + setAppsToAdd( + availableApps + .filter((app) => app.is_default_library) + .map((app) => app.id.toString()) + ); + } + return ( - + Add User Application(s) {loading && ( @@ -90,20 +106,35 @@ const AddUserAppModal: React.FC = ({ )} {!loading && ( -
+
+
+

+ Select All +

+

+ Select Default Libraries +

+
({ key: app.id, - value: app.id, + value: app.id.toString(), text: app.name, }))} onChange={(_e, { value }) => { if (!value) return; setAppsToAdd(value as string[]); }} + value={appsToAdd.map((app) => app.toString())} fluid multiple search @@ -111,6 +142,7 @@ const AddUserAppModal: React.FC = ({ scrolling loading={loading} disabled={loading} + clearable />