From fd8c25ed041b6913bad42c164904d04dff5d162e Mon Sep 17 00:00:00 2001 From: christopheresivwekpe Date: Tue, 30 Jan 2024 18:43:24 +0100 Subject: [PATCH] Issue fixes --- .../app/(webapp)/(components)/StatusBox.tsx | 5 ++ .../(webapp)/(components)/TableElement.tsx | 4 +- .../(components)/TransparentPanel.tsx | 56 +++++++++++-------- .../activity/(components)/ActivityDetails.tsx | 8 +-- .../(components)/ActivitySections.tsx | 26 ++++++--- .../activity/(components)/ActivityTable.tsx | 2 + .../app/api-management/activity/page.tsx | 2 +- .../api-management/collections/[id]/page.tsx | 10 +++- .../(components)/AddPermissionButton.tsx | 2 +- .../(components)/ConsumerDetails.tsx | 34 ++++++++--- .../consumers/(components)/ConsumersTable.tsx | 21 ++++--- .../(components)/EditPermissionButton.tsx | 2 +- .../app/api-management/consumers/page.tsx | 3 +- apps/web/data/activityData.ts | 8 +-- apps/web/data/collectionDatas.tsx | 21 ++++++- apps/web/data/consumerData.tsx | 14 +++-- 16 files changed, 151 insertions(+), 67 deletions(-) diff --git a/apps/web/app/(webapp)/(components)/StatusBox.tsx b/apps/web/app/(webapp)/(components)/StatusBox.tsx index c33bfa2e..371eecf8 100644 --- a/apps/web/app/(webapp)/(components)/StatusBox.tsx +++ b/apps/web/app/(webapp)/(components)/StatusBox.tsx @@ -73,6 +73,11 @@ const StatusBox = ({ status }: StatusBoxProps) => { Rejected ) + : sanitizedStatus === 'denied' ? ( + + Denied + + ) : sanitizedStatus === 'declined' ? ( Declined diff --git a/apps/web/app/(webapp)/(components)/TableElement.tsx b/apps/web/app/(webapp)/(components)/TableElement.tsx index 176590fd..4488ddcf 100644 --- a/apps/web/app/(webapp)/(components)/TableElement.tsx +++ b/apps/web/app/(webapp)/(components)/TableElement.tsx @@ -38,7 +38,7 @@ const TableElement = ({ columnHelper.accessor(item?.accessor, { header: () => item?.header, cell: ({ column, cell, renderValue }) => { - if(column.id === 'status' || column.id === 'user_type') { + if(column.id === 'status' || column.id === 'user_type' || column.id === 'kyb_status') { return } else { return renderValue(); @@ -91,7 +91,7 @@ const TableElement = ({ first-of-type:rounded-tl-[8px] last-of-type:rounded-tr-[8px] text-o-text-medium px-[16px] text-f12 font-[500] ${header.id == 'actions' && '!min-w-[60px] !max-w-0 !w-auto'} - ${header.id == 'status' && '!min-w-[100px] !max-w-0 !w-auto'} + ${(header.id == 'status' || header.id == 'kyb_status') && '!min-w-[100px] !max-w-0 !w-auto'} ${header.id == 'user_type' && '!min-w-[120px] !max-w-0 !w-auto'} ${header.id == 'velocity' && '!min-w-[100px] !max-w-0 !w-auto'} ${header.id == 'amount' && '!min-w-[100px] !max-w-0 !w-auto'} diff --git a/apps/web/app/(webapp)/(components)/TransparentPanel.tsx b/apps/web/app/(webapp)/(components)/TransparentPanel.tsx index 5f8b66b3..835b4cfe 100644 --- a/apps/web/app/(webapp)/(components)/TransparentPanel.tsx +++ b/apps/web/app/(webapp)/(components)/TransparentPanel.tsx @@ -29,33 +29,45 @@ const TransparentPanel = ({ } }; + let userInterface = (data: any) => { + return( +
handleClick(data?.value)} + > +
+ {data?.label} +
+ + { + currentValue == data?.value && + + } +
+ ); + } + return (
{ - panel?.map((data) => ( - data?.type?.includes(status || '') && -
handleClick(data?.value)} - > -
- {data?.label} -
- - { - currentValue == data?.value && - - } -
- )) + panel?.map((data) => { + if (status) { + return ( + data?.type?.includes(status || '') ? + userInterface(data) : null + ); + } else { + return userInterface(data); + } + }) }
) diff --git a/apps/web/app/(webapp)/app/api-management/activity/(components)/ActivityDetails.tsx b/apps/web/app/(webapp)/app/api-management/activity/(components)/ActivityDetails.tsx index d295b7cc..139f9ab4 100644 --- a/apps/web/app/(webapp)/app/api-management/activity/(components)/ActivityDetails.tsx +++ b/apps/web/app/(webapp)/app/api-management/activity/(components)/ActivityDetails.tsx @@ -14,7 +14,7 @@ const ActivityDetails = ({ }: ActivitySectionsProps) => { const router = useRouter(); const activity_details = rawData; - console.log(activity_details) + // console.log(activity_details); useEffect(() => { const slug = updateSearchParams('slug', 'Activity Details'); @@ -48,13 +48,13 @@ const ActivityDetails = ({
- + /> */} "response": { "headers": { - "access-control-allow-credentials": "${response?.headers?.['access-control-allow-credentials']}", "access-control-allow-origin": "${response?.headers?.['access-control-allow-origin']}", "connection": "${response?.headers?.connection}", - "content-length": "${response?.headers?.['content-length']}", "content-type": "${response?.headers?.['content-type']}", "date": "${response?.headers?.date}", - "server": "${response?.headers?.server}", + "etag": "${response?.headers?.etag}", + "request-id": "${response?.headers?.['request-id']}", + "transfer-encoding": "${response?.headers?.['transfer-encoding']}", + "vary": "${response?.headers?.vary}", "via": "${response?.headers?.via}", "x-kong-proxy-latency": "${response?.headers?.['x-kong-proxy-latency']}", "x-kong-upstream-latency": "${response?.headers?.['x-kong-upstream-latency']}" + "x-ratelimit-limit": "${response?.headers?.['x-ratelimit-limit']}", + "x-ratelimit-remaining": "${response?.headers?.['x-ratelimit-remaining']}", + "x-ratelimit-reset": "${response?.headers?.['x-ratelimit-reset']}", + "x-srv-span": "${response?.headers?.['x-srv-span']}", + "x-srv-trace": "${response?.headers?.['x-srv-trace']}", }, "size": "${response?.size}", "status": "${response?.status}" diff --git a/apps/web/app/(webapp)/app/api-management/activity/(components)/ActivityTable.tsx b/apps/web/app/(webapp)/app/api-management/activity/(components)/ActivityTable.tsx index 01d10618..0f7f8169 100644 --- a/apps/web/app/(webapp)/app/api-management/activity/(components)/ActivityTable.tsx +++ b/apps/web/app/(webapp)/app/api-management/activity/(components)/ActivityTable.tsx @@ -18,6 +18,8 @@ const ActivityTable = ({ }: TableProps) => { const columnHelper = createColumnHelper(); + // console.log(rawData); + const actionColumn = columnHelper.accessor('actions', { header: () => '', cell: ({ row }) => ( diff --git a/apps/web/app/(webapp)/app/api-management/activity/page.tsx b/apps/web/app/(webapp)/app/api-management/activity/page.tsx index 7c356132..2bc8b77a 100644 --- a/apps/web/app/(webapp)/app/api-management/activity/page.tsx +++ b/apps/web/app/(webapp)/app/api-management/activity/page.tsx @@ -39,7 +39,7 @@ const ActivityPage = async({ searchParams }: UrlParamsProps) => { return({ ...activity, reference_id: activity?.id, - consumer_name: activity?.consumer_name, + consumer_name: activity?.company?.name, email_address: activity?.email_address, api_name: activity?.name, status: activity?.status, diff --git a/apps/web/app/(webapp)/app/api-management/collections/[id]/page.tsx b/apps/web/app/(webapp)/app/api-management/collections/[id]/page.tsx index 252ecbae..2cf5dd86 100644 --- a/apps/web/app/(webapp)/app/api-management/collections/[id]/page.tsx +++ b/apps/web/app/(webapp)/app/api-management/collections/[id]/page.tsx @@ -1,7 +1,7 @@ import { UrlParamsProps } from '@/types/webappTypes/appTypes' import React from 'react' import { CollectionSection } from '../(components)'; -import { COLLECTIONS_API_HEADERS, COLLECTIONS_REQUEST_METHOD, COLLECTIONS_TIER } from '@/data/collectionDatas'; +import { COLLECTIONS_API_HEADERS, COLLECTIONS_API_CONSUMER_HEADERS, COLLECTIONS_REQUEST_METHOD, COLLECTIONS_TIER } from '@/data/collectionDatas'; import { applyAxiosRequest } from '@/hooks'; import * as API from '@/config/endpoints'; import Logout from '@/components/globalComponents/Logout'; @@ -63,6 +63,8 @@ const CollectionPage = async ({ params, searchParams }: UrlParamsProps) => { }); }) + const userType = profile?.user?.role?.parent?.slug; + // const details = COLLECTIONS_TABLE_DATA.find((data: any) => data?.collection_name == collectionId); // const collections_api = COLLECTIONS_APIS; const request_method_list = COLLECTIONS_REQUEST_METHOD?.map(method => { @@ -80,7 +82,11 @@ const CollectionPage = async ({ params, searchParams }: UrlParamsProps) => { }) const filters = [search_query, request_method, tier] - let table_headers = COLLECTIONS_API_HEADERS; + let table_headers = ( + userType == 'api-consumer' ? + COLLECTIONS_API_CONSUMER_HEADERS : + COLLECTIONS_API_HEADERS + ); const total_pages = meta_data?.totalNumberOfPages; const total_elements_in_page = collections_api_list?.length || meta_data?.pageSize; const total_elements = meta_data?.totalNumberOfRecords; diff --git a/apps/web/app/(webapp)/app/api-management/consumers/(components)/AddPermissionButton.tsx b/apps/web/app/(webapp)/app/api-management/consumers/(components)/AddPermissionButton.tsx index eb83c9f0..21ebebbe 100644 --- a/apps/web/app/(webapp)/app/api-management/consumers/(components)/AddPermissionButton.tsx +++ b/apps/web/app/(webapp)/app/api-management/consumers/(components)/AddPermissionButton.tsx @@ -151,7 +151,7 @@ const AddPermissionButton = ({
+ } + /> { + const getAction = (kyb_status: string, status: string) => { return actions.filter(action => { - return ( - action?.type == status?.toLowerCase() || - action?.type == 'all' - ); + if (kyb_status?.includes('approved')) { + return ( + action?.type?.includes(status?.toLowerCase()) || + action?.type?.includes('all') + ); + } else { + return ( + action?.type?.includes(kyb_status?.toLowerCase()) || + action?.type?.includes('all') + ); + } }); } @@ -109,7 +116,7 @@ const ConsumersTable = ({ data }); - if (result?.status == 201) { + if (result?.status == 200) { setLoading(false); close2FAModal(); router.refresh(); @@ -148,7 +155,7 @@ const ConsumersTable = ({
{ - getAction(row.original.status)?.map((action) => ( + getAction(row.original.kyb_status, row.original.status)?.map((action) => (