From 102c2b378fd44e7315b70d8781e84099ba47f600 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Thu, 26 Oct 2023 11:22:13 +0530 Subject: [PATCH 01/19] feat: conversion id into uuid Signed-off-by: bhavanakarwade --- src/api/Agent.ts | 2 +- src/api/Schema.ts | 8 ++--- src/api/ecosystem.ts | 6 ++-- src/api/invitations.ts | 8 ++--- src/api/organization.ts | 8 ++--- src/commonComponents/AgentHealth.tsx | 2 +- .../CreateEcosystemOrgModal/index.tsx | 2 +- .../Ecosystem/Endorsement/index.tsx | 2 +- src/components/Ecosystem/interfaces/index.ts | 2 +- .../EcoSystemReceivedInvitations.tsx | 6 ++-- src/components/Issuance/Issuance.tsx | 6 ++-- src/components/Resources/Schema/Create.tsx | 6 ++-- .../Resources/Schema/ViewSchema.tsx | 12 +++---- .../Resources/Schema/interfaces/index.ts | 11 +++--- src/components/Tooltip/index.tsx | 4 --- src/components/User/UserDashBoard.tsx | 4 +-- src/components/User/interfaces/index.ts | 4 +-- src/components/Verification/Verification.tsx | 4 +-- src/components/organization/OrgDropDown.tsx | 2 +- src/components/organization/WalletSpinup.tsx | 4 +-- .../organization/interfaces/index.ts | 34 +++++++++---------- .../organization/interfaces/invitations.ts | 6 ++-- .../organization/interfaces/users.ts | 2 +- .../invitations/ReceivedInvitations.tsx | 4 --- .../invitations/SendInvitationModal.tsx | 6 ++-- .../organization/users/EditUserRolesModal.tsx | 6 ++-- .../OrganisationPublicProfile.tsx | 2 +- src/types/entities.ts | 2 +- 28 files changed, 78 insertions(+), 87 deletions(-) diff --git a/src/api/Agent.ts b/src/api/Agent.ts index 3e23c0d98..f6f5f68e4 100644 --- a/src/api/Agent.ts +++ b/src/api/Agent.ts @@ -3,7 +3,7 @@ import { apiRoutes } from "../config/apiRoutes"; import { getFromLocalStorage } from "./Auth"; import { storageKeys } from "../config/CommonConstant"; -export const getAgentHealth = async (orgId:number) => { +export const getAgentHealth = async (orgId:string) => { const token = await getFromLocalStorage(storageKeys.TOKEN) const details = { url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.checkAgentHealth}`, diff --git a/src/api/Schema.ts b/src/api/Schema.ts index a86d4b49a..1372d2f48 100644 --- a/src/api/Schema.ts +++ b/src/api/Schema.ts @@ -49,7 +49,7 @@ export const getAllSchemasByOrgId = async ({ search, itemPerPage, page }: GetAll } } -export const addSchema = async (payload: createSchema, orgId: number) => { +export const addSchema = async (payload: createSchema, orgId: string) => { const token = await getFromLocalStorage(storageKeys.TOKEN) const details = { url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.create}`, @@ -72,7 +72,7 @@ export const addSchema = async (payload: createSchema, orgId: number) => { } } -export const getSchemaById = async (schemaId: string, orgId: number) => { +export const getSchemaById = async (schemaId: string, orgId: string) => { const token = await getFromLocalStorage(storageKeys.TOKEN) const details = { url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getSchemaById}/${schemaId}`, @@ -94,7 +94,7 @@ export const getSchemaById = async (schemaId: string, orgId: number) => { } } -export const createCredentialDefinition = async (payload: createCredDeffFieldName, orgId:number) => { +export const createCredentialDefinition = async (payload: createCredDeffFieldName, orgId:string) => { const token = await getFromLocalStorage(storageKeys.TOKEN) const details = { url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.createCredentialDefinition}`, @@ -118,7 +118,7 @@ export const createCredentialDefinition = async (payload: createCredDeffFieldNam } } -export const getCredDeffById = async (schemaId: string, orgId: number) => { +export const getCredDeffById = async (schemaId: string, orgId: string) => { const token = await getFromLocalStorage(storageKeys.TOKEN) const details = { url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getCredDefBySchemaId}/${schemaId}/cred-defs`, diff --git a/src/api/ecosystem.ts b/src/api/ecosystem.ts index bab35e7ca..3b823121b 100644 --- a/src/api/ecosystem.ts +++ b/src/api/ecosystem.ts @@ -10,7 +10,7 @@ interface CreateEcosystemPayload { description: string; logo: string; tags?: string; - userId: number; + userId: string; } export interface GetEndorsementListParameter { @@ -105,7 +105,7 @@ export const getEndorsementList = async ( export const createSchemaRequest = async ( data: object, endorsementId: string, - orgId: number, + orgId: string, ) => { const url = `${apiRoutes.Ecosystem.root}/${endorsementId}/${orgId}${apiRoutes.Ecosystem.endorsements.createSchemaRequest}`; const payload = data; @@ -126,7 +126,7 @@ export const createSchemaRequest = async ( export const createCredDefRequest = async ( data: object, ecosystemId: string, - orgId: number, + orgId: string, ) => { const url = `${apiRoutes.Ecosystem.root}/${ecosystemId}/${orgId}${apiRoutes.Ecosystem.endorsements.createCredDefRequest}`; const payload = data; diff --git a/src/api/invitations.ts b/src/api/invitations.ts index 47bfbd2d5..76d6534cb 100644 --- a/src/api/invitations.ts +++ b/src/api/invitations.ts @@ -43,7 +43,7 @@ export const createInvitations = async (invitationList: Array) => { const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.organizations.invitations}` const payload = { invitations: invitationList, - orgId: Number(orgId) + orgId: orgId } const token = await getFromLocalStorage(storageKeys.TOKEN) @@ -233,7 +233,7 @@ export const getEcosystemInvitations = async (pageNumber: number, pageSize: numb } // Accept/ Reject Invitations -export const acceptRejectEcosystemInvitations = async (invitationId: string, orgId: number, status: string, orgName: string, orgDid: string) => { +export const acceptRejectEcosystemInvitations = async (invitationId: string, orgId: string, status: string, orgName: string, orgDid: string) => { const url = `${apiRoutes.Ecosystem.root}/${orgId}${apiRoutes.Ecosystem.invitations}/${invitationId}` @@ -265,12 +265,12 @@ export const acceptRejectEcosystemInvitations = async (invitationId: string, org } } -export const acceptRejectInvitations = async (invitationId: number, orgId: number, status: string) => { +export const acceptRejectInvitations = async (invitationId: string, orgId: string, status: string) => { const url = `${apiRoutes.users.invitations}/${invitationId}` const payload = { - orgId: Number(orgId), + orgId: orgId, status } const token = await getFromLocalStorage(storageKeys.TOKEN) diff --git a/src/api/organization.ts b/src/api/organization.ts index 236e7450e..818be26e5 100644 --- a/src/api/organization.ts +++ b/src/api/organization.ts @@ -138,7 +138,7 @@ export const getOrgDashboard = async (orgId: string) => { } } -export const spinupDedicatedAgent = async (data: object, orgId:number) => { +export const spinupDedicatedAgent = async (data: object, orgId:string) => { const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentDedicatedSpinup}` const payload = data @@ -166,7 +166,7 @@ export const spinupDedicatedAgent = async (data: object, orgId:number) => { } } -export const spinupSharedAgent = async (data: object, orgId:number) => { +export const spinupSharedAgent = async (data: object, orgId:string) => { const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentSharedSpinup}` const payload = data @@ -247,7 +247,7 @@ export const getOrganizationUsers = async (pageNumber: number, pageSize: number, } // Edit user roles -export const editOrganizationUserRole = async (userId: number, roles: number[]) => { +export const editOrganizationUserRole = async (userId: string, roles: string[]) => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID) @@ -284,7 +284,7 @@ export const createConnection = async (orgName: string) => { label: orgName, multiUseInvitation: true, autoAcceptConnection: true, - orgId: Number(orgId) + orgId: orgId } const payload = data diff --git a/src/commonComponents/AgentHealth.tsx b/src/commonComponents/AgentHealth.tsx index d6372657f..8ada6fd8d 100644 --- a/src/commonComponents/AgentHealth.tsx +++ b/src/commonComponents/AgentHealth.tsx @@ -29,7 +29,7 @@ const AgentHealth = () => { const organizationId = await getFromLocalStorage(storageKeys.ORG_ID); setCheckOrgExist(Number(organizationId)) if (Number(organizationId) !== 0) { - const agentData = await getAgentHealth(Number(organizationId)); + const agentData = await getAgentHealth(organizationId); const { data } = agentData as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { setAgentHealthDetails(data?.data); diff --git a/src/components/CreateEcosystemOrgModal/index.tsx b/src/components/CreateEcosystemOrgModal/index.tsx index 5ebda9078..264b49303 100644 --- a/src/components/CreateEcosystemOrgModal/index.tsx +++ b/src/components/CreateEcosystemOrgModal/index.tsx @@ -169,7 +169,7 @@ const CreateEcosystemOrgModal = (props: IProps) => { description: values.description, logo: logoImage?.imagePreviewUrl as string || "", tags: "", - userId: Number(user_data?.id), + userId: user_data?.id, orgName: orgDetails?.orgName, orgDid: orgDetails?.orgDid } diff --git a/src/components/Ecosystem/Endorsement/index.tsx b/src/components/Ecosystem/Endorsement/index.tsx index 0ad712257..91f58327d 100644 --- a/src/components/Ecosystem/Endorsement/index.tsx +++ b/src/components/Ecosystem/Endorsement/index.tsx @@ -41,7 +41,7 @@ interface IEndorsementList { status: string; type: string; ecosystemOrgs: { - orgId: number; + orgId: string; }; requestPayload: string; responsePayload: string; diff --git a/src/components/Ecosystem/interfaces/index.ts b/src/components/Ecosystem/interfaces/index.ts index bd8f6c334..46dbce67b 100644 --- a/src/components/Ecosystem/interfaces/index.ts +++ b/src/components/Ecosystem/interfaces/index.ts @@ -7,7 +7,7 @@ export interface IEcosystem { } export interface Ecosystem { - id: number + id: string createDateTime: string createdBy: number lastChangedDateTime: string diff --git a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx index 85bb62408..e45d23d4c 100644 --- a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx +++ b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx @@ -53,7 +53,7 @@ const ReceivedInvitations = () => { const [error, setError] = useState(null); const [organizationsList, setOrganizationsList] = useState | null>(null); const [currentPage, setCurrentPage] = useState(initialPageState); - const [selectedId, setSelectedId] = useState(); + const [selectedId, setSelectedId] = useState(''); const [searchText, setSearchText] = useState(''); const [invitationsData, setInvitationsData] = useState | null>(null); const [getOrgError, setGetOrgError] = useState(null); @@ -147,7 +147,7 @@ const ReceivedInvitations = () => { if (orgDid) { const response = await acceptRejectEcosystemInvitations( invite.id, - Number(selectedId), + selectedId, status, orgName, orgDid @@ -215,7 +215,7 @@ const ReceivedInvitations = () => { const getOrgId = async () => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); if (orgId) { - setSelectedId(Number(orgId)); + setSelectedId(orgId); } }; diff --git a/src/components/Issuance/Issuance.tsx b/src/components/Issuance/Issuance.tsx index ae7f6491f..c3cdc1677 100644 --- a/src/components/Issuance/Issuance.tsx +++ b/src/components/Issuance/Issuance.tsx @@ -36,7 +36,7 @@ interface IssuanceFormPayload { connectionId: string; attributes: Attributes[]; credentialDefinitionId: string; - orgId: number; + orgId: string; } interface DataTypeAttributes { @@ -81,7 +81,7 @@ const IssueCred = () => { const selectedUsers = await getSelectedUsers(); const attributes = await getSchemaDetails(); if (attributes && attributes.length) { - createIssuanceForm(selectedUsers, attributes, credDefId, Number(orgId)); + createIssuanceForm(selectedUsers, attributes, credDefId, orgId); } else { setFailure('Attributes are not available'); } @@ -91,7 +91,7 @@ const IssueCred = () => { selectedUsers: SelectedUsers[], attributes: DataTypeAttributes[], credDefId: string, - orgId: number, + orgId: string, ) => { const attrObj = attributes.map((attr) => ({ name: attr?.attributeName, diff --git a/src/components/Resources/Schema/Create.tsx b/src/components/Resources/Schema/Create.tsx index 23d6830cc..8462ec646 100644 --- a/src/components/Resources/Schema/Create.tsx +++ b/src/components/Resources/Schema/Create.tsx @@ -37,7 +37,7 @@ interface IFormData { const CreateSchema = () => { const [failure, setFailure] = useState(null); - const [orgId, setOrgId] = useState(0); + const [orgId, setOrgId] = useState(''); const [createloader, setCreateLoader] = useState(false); const [showPopup, setShowPopup] = useState(false) const [isEcosystemData, setIsEcosystemData] = useState(); @@ -58,7 +58,7 @@ const CreateSchema = () => { const fetchData = async () => { const organizationId = await getFromLocalStorage( storageKeys.ORG_ID); - setOrgId(Number(organizationId)); + setOrgId(organizationId); }; fetchData(); @@ -81,7 +81,7 @@ const CreateSchema = () => { orgId: orgId, }; - const createSchema = await addSchema(schemaFieldName, orgId); + const createSchema = await addSchema(schemaFieldName, String(orgId)); const { data } = createSchema as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { diff --git a/src/components/Resources/Schema/ViewSchema.tsx b/src/components/Resources/Schema/ViewSchema.tsx index 831ed31f5..d6fb0f782 100644 --- a/src/components/Resources/Schema/ViewSchema.tsx +++ b/src/components/Resources/Schema/ViewSchema.tsx @@ -58,7 +58,7 @@ const ViewSchemas = () => { const [credDefListErr, setCredDefListErr] = useState(null) const [schemaDetailErr, setSchemaDetailErr] = useState(null) const [failure, setFailure] = useState(null) - const [orgId, setOrgId] = useState(0) + const [orgId, setOrgId] = useState('') const [credDefAuto, setCredDefAuto] = useState('') const [isEcosystemData, setIsEcosystemData] = useState(); @@ -66,7 +66,7 @@ const ViewSchemas = () => { const [userRoles, setUserRoles] = useState([]) - const getSchemaDetails = async (SchemaId: string, organizationId: number) => { + const getSchemaDetails = async (SchemaId: string, organizationId: string) => { try { setLoading(true); const SchemaDetails = await getSchemaById(SchemaId, organizationId); @@ -87,7 +87,7 @@ const ViewSchemas = () => { } }; - const getCredentialDefinitionList = async (id: string, orgId: number) => { + const getCredentialDefinitionList = async (id: string, orgId: string) => { try { setCredDeffloader(true); const credentialDefinitions = await getCredDeffById(id, orgId); @@ -112,12 +112,12 @@ const ViewSchemas = () => { useEffect(() => { const fetchData = async () => { const organizationId = await getFromLocalStorage(storageKeys.ORG_ID); - setOrgId(Number(organizationId)); + setOrgId(String(organizationId)); if (window?.location?.search) { const str = window?.location?.search; const schemaId = str.substring(str.indexOf('=') + 1); - await getSchemaDetails(schemaId, Number(organizationId)); - await getCredentialDefinitionList(schemaId, Number(organizationId)); + await getSchemaDetails(schemaId, String(organizationId)); + await getCredentialDefinitionList(schemaId, String(organizationId)); } }; diff --git a/src/components/Resources/Schema/interfaces/index.ts b/src/components/Resources/Schema/interfaces/index.ts index d4dd1d444..26bc66268 100644 --- a/src/components/Resources/Schema/interfaces/index.ts +++ b/src/components/Resources/Schema/interfaces/index.ts @@ -1,4 +1,3 @@ -import { Pagination } from 'flowbite-react'; export interface GetAllSchemaListParameter { itemPerPage: number, page: number, @@ -27,7 +26,7 @@ type DataItem = { schemaLedgerId: string; createdBy: number; publisherDid: string; - orgId: number; + orgId: string; issuerId: string; }; @@ -53,7 +52,7 @@ export type PaginationData = { export interface CredDeffFieldNameType { tag: string; revocable: boolean; - orgId: number; + orgId: string; schemaLedgerId: string; } @@ -61,7 +60,7 @@ export interface FieldName { schemaName: string; schemaVersion: string; attributes: IAttributes[] - orgId: number; + orgId: string; } @@ -69,13 +68,13 @@ export interface createSchema { schemaName: string; schemaVersion: string; attributes: IAttributes[] - orgId: number; + orgId: string; } export interface createCredDeffFieldName { tag: string; revocable: boolean; - orgId: number; + orgId: string; schemaLedgerId: string; } diff --git a/src/components/Tooltip/index.tsx b/src/components/Tooltip/index.tsx index 912a20ba3..40e30c9ec 100644 --- a/src/components/Tooltip/index.tsx +++ b/src/components/Tooltip/index.tsx @@ -1,7 +1,5 @@ import { Tooltip } from 'flowbite-react'; import moment from 'moment'; -import { dateConversion } from '../../utils/DateConversion'; -import type { ChildrenType } from 'react-tooltip'; interface DateProps { date: string @@ -11,11 +9,9 @@ interface DateProps { const DateTooltip = ({date, children}: DateProps) => { - const updatedDate = new Date(date); const formattedDate = date ? moment(updatedDate).format("MMM DD, YYYY, h:mm A z") : ''; - return ( { checkOrgId(); }, []); - const goToOrgDashboard = async (orgId: number, roles: string[]) => { - await setToLocalStorage(storageKeys.ORG_ID, orgId.toString()); + const goToOrgDashboard = async (orgId: string, roles: string[]) => { + await setToLocalStorage(storageKeys.ORG_ID, orgId); window.location.href = pathRoutes.organizations.dashboard; }; diff --git a/src/components/User/interfaces/index.ts b/src/components/User/interfaces/index.ts index f74b10de4..5ea002f5a 100644 --- a/src/components/User/interfaces/index.ts +++ b/src/components/User/interfaces/index.ts @@ -1,7 +1,7 @@ export interface UserActivity { id: number - userId: number - orgId: number + userId: string + orgId: string action: string details: string createDateTime: string diff --git a/src/components/Verification/Verification.tsx b/src/components/Verification/Verification.tsx index 8d0365a04..3ad2d3d62 100644 --- a/src/components/Verification/Verification.tsx +++ b/src/components/Verification/Verification.tsx @@ -32,7 +32,7 @@ interface VerifyCredentialPayload { credDefId?: string ; }>; comment: string; - orgId: number; + orgId: string; } const VerificationCred = () => { @@ -161,7 +161,7 @@ const VerificationCred = () => { connectionId: `${selectedUsers[0].connectionId}`, attributes: attributes, comment: "string", - orgId: Number(orgId) + orgId: orgId }; if (attributes) { const response = await verifyCredential(verifyCredentialPayload); diff --git a/src/components/organization/OrgDropDown.tsx b/src/components/organization/OrgDropDown.tsx index 4169a7abb..52aa56710 100644 --- a/src/components/organization/OrgDropDown.tsx +++ b/src/components/organization/OrgDropDown.tsx @@ -49,7 +49,7 @@ const OrgDropDown = () => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID) if (orgId) { - activeOrg = organizations?.find(org => org.id === Number(orgId)) as Organisation + activeOrg = organizations?.find(org => org.id === String(orgId)) as Organisation setactiveOrg(activeOrg || null) } else { activeOrg = organizations && organizations[0] diff --git a/src/components/organization/WalletSpinup.tsx b/src/components/organization/WalletSpinup.tsx index 8028e0f2e..c759ccb33 100644 --- a/src/components/organization/WalletSpinup.tsx +++ b/src/components/organization/WalletSpinup.tsx @@ -95,7 +95,7 @@ const WalletSpinup = (props: { }; setLoading(true); const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const spinupRes = await spinupDedicatedAgent(payload, parseInt(orgId)); + const spinupRes = await spinupDedicatedAgent(payload, orgId); const { data } = spinupRes as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { @@ -120,7 +120,7 @@ const WalletSpinup = (props: { }; const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const spinupRes = await spinupSharedAgent(payload, parseInt(orgId)); + const spinupRes = await spinupSharedAgent(payload, orgId); const { data } = spinupRes as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { diff --git a/src/components/organization/interfaces/index.ts b/src/components/organization/interfaces/index.ts index 45a533425..7ec60da48 100644 --- a/src/components/organization/interfaces/index.ts +++ b/src/components/organization/interfaces/index.ts @@ -1,14 +1,14 @@ export interface UserOrgRole { - id: number - userId: number - orgRoleId: number - orgId: number + id: string + userId: string + orgRoleId: string + orgId: string orgRole: OrgRole } export interface Organisation { logoFile: string - id: number + id: string createDateTime: string createdBy: number lastChangedDateTime: string @@ -25,7 +25,7 @@ export interface Organisation { } export interface OrgRole { - id: number + id: string name: string description: string createDateTime?: string @@ -36,7 +36,7 @@ export interface OrgRole { } export interface OrgAgent { - id: number + id: string createDateTime: string createdBy: number lastChangedDateTime: string @@ -50,16 +50,16 @@ export interface OrgAgent { agentOptions: any walletName: string tenantId: any - agentsTypeId: number - orgId: number - orgAgentTypeId: number + agentsTypeId: string + orgId: string + orgAgentTypeId: string ledgers: ledgers org_agent_type: org_agent_type agents_type: AgentsType } export interface AgentsType { - id: number + id: string createDateTime: string createdBy: number lastChangedDateTime: string @@ -68,7 +68,7 @@ export interface AgentsType { } export interface org_agent_type{ -id: number +id: string createDateTime: string createdBy: number lastChangedDateTime: string @@ -80,7 +80,7 @@ agent: string export interface ledgers{ createDateTime: string createdBy: number -id: number +id: string isActive: boolean lastChangedBy: number lastChangedDateTime: string @@ -98,9 +98,9 @@ export interface OrgDashboard { } export interface Connection { - id: number - orgId: number - agentId: number + id: string + orgId: string + agentId: string connectionInvitation: string multiUse: boolean createDateTime: string @@ -143,7 +143,7 @@ export interface UserDetails { firstName: string; email: string; publicProfile: boolean; - id: number; + id: string; username: string; } diff --git a/src/components/organization/interfaces/invitations.ts b/src/components/organization/interfaces/invitations.ts index 45da32baf..294e65e73 100644 --- a/src/components/organization/interfaces/invitations.ts +++ b/src/components/organization/interfaces/invitations.ts @@ -2,14 +2,14 @@ import type { OrgRole, Organisation } from "." export interface Invitation { ecosystem: any - id: number + id: string createDateTime: string createdBy: number lastChangedDateTime: string lastChangedBy: number deletedAt: any - userId: number - orgId: number + userId: string + orgId: string status: string orgRoles: OrgRole[] email: string diff --git a/src/components/organization/interfaces/users.ts b/src/components/organization/interfaces/users.ts index 2bf7e4cb2..6e4994656 100644 --- a/src/components/organization/interfaces/users.ts +++ b/src/components/organization/interfaces/users.ts @@ -1,7 +1,7 @@ import type { UserOrgRole } from "." export interface User { - id: number + id: string username: string email: string firstName: string diff --git a/src/components/organization/invitations/ReceivedInvitations.tsx b/src/components/organization/invitations/ReceivedInvitations.tsx index 65ae411ec..958b72a74 100644 --- a/src/components/organization/invitations/ReceivedInvitations.tsx +++ b/src/components/organization/invitations/ReceivedInvitations.tsx @@ -9,9 +9,7 @@ import type { Invitation } from '../interfaces/invitations'; import type { OrgRole } from '../interfaces' import SearchInput from '../../SearchInput'; import SendInvitationModal from './SendInvitationModal'; -import { TextTittlecase } from '../../../utils/TextTransform'; import { apiStatusCodes } from '../../../config/CommonConstant'; -import { getOrganizations } from '../../../api/organization'; import { pathRoutes } from '../../../config/pathRoutes'; import { EmptyListMessage } from '../../EmptyListComponent'; import CustomSpinner from '../../CustomSpinner'; @@ -30,7 +28,6 @@ const ReceivedInvitations = () => { const [error, setError] = useState(null) const [currentPage, setCurrentPage] = useState(initialPageState); - const timestamp = Date.now(); const onPageChange = (page: number) => { setCurrentPage({ @@ -104,7 +101,6 @@ const ReceivedInvitations = () => { } } - return (
diff --git a/src/components/organization/invitations/SendInvitationModal.tsx b/src/components/organization/invitations/SendInvitationModal.tsx index aa1bd45f3..ef91182cd 100644 --- a/src/components/organization/invitations/SendInvitationModal.tsx +++ b/src/components/organization/invitations/SendInvitationModal.tsx @@ -21,11 +21,11 @@ interface Values { interface Invitations { email: string; role: string; - roleId: number; + roleId: string; } interface RoleI { - id: number; + id: string; name: string; } @@ -87,7 +87,7 @@ const SendInvitationModal = (props: { { email: values.email, role: memberRole?.name as string, - roleId: memberRole?.id as number, + roleId: String(memberRole?.id), }, ]); }; diff --git a/src/components/organization/users/EditUserRolesModal.tsx b/src/components/organization/users/EditUserRolesModal.tsx index af813a2ff..544ab0c43 100644 --- a/src/components/organization/users/EditUserRolesModal.tsx +++ b/src/components/organization/users/EditUserRolesModal.tsx @@ -8,7 +8,7 @@ import type { User } from "../interfaces/users"; import { apiStatusCodes } from "../../../config/CommonConstant"; interface RoleI { - id: number + id: string name: string, checked: boolean disabled: boolean @@ -64,7 +64,7 @@ const EditUserRoleModal = (props: { openModal: boolean; user: User; setMessage: const roleIds = roles?.filter(role => role.checked).map(role => role.id) - const response = await editOrganizationUserRole(props.user.id, roleIds as number[]) + const response = await editOrganizationUserRole(props.user.id, roleIds as string[]) const { data } = response as AxiosResponse @@ -79,7 +79,7 @@ const EditUserRoleModal = (props: { openModal: boolean; user: User; setMessage: } - const onRoleChanged = (event: any, id: number) => { + const onRoleChanged = (event: any, id: string) => { if ( (event?.target?.name === 'issuer' && event?.target?.checked === true) || (event?.target?.name === 'verifier' && event?.target?.checked === true) diff --git a/src/components/publicProfile/OrganisationPublicProfile.tsx b/src/components/publicProfile/OrganisationPublicProfile.tsx index 533deda82..dcc3d1ac0 100644 --- a/src/components/publicProfile/OrganisationPublicProfile.tsx +++ b/src/components/publicProfile/OrganisationPublicProfile.tsx @@ -102,7 +102,7 @@ const OrganisationPublicProfile = () => { logoUrl: string; name: string; description: string; - id: number; + id: string; orgSlug: string; }) => ( Date: Fri, 27 Oct 2023 16:28:37 +0530 Subject: [PATCH 02/19] feat: conversion of id's into uuid Signed-off-by: bhavanakarwade --- src/api/invitations.ts | 2 +- src/components/Ecosystem/interfaces/index.ts | 4 +-- .../EcoSystemReceivedInvitations.tsx | 4 +-- .../EcosystemInvite/SentInvitations.tsx | 2 +- src/components/Profile/interfaces/index.ts | 2 +- .../Resources/Schema/interfaces/index.ts | 2 +- src/components/User/interfaces/index.ts | 4 +-- .../organization/interfaces/index.ts | 29 +++++++++---------- .../organization/interfaces/invitations.ts | 4 +-- 9 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/api/invitations.ts b/src/api/invitations.ts index 76d6534cb..c687945e0 100644 --- a/src/api/invitations.ts +++ b/src/api/invitations.ts @@ -296,7 +296,7 @@ export const acceptRejectInvitations = async (invitationId: string, orgId: strin } } -export const deleteEcosystemInvitations = async (invitationId: number) => { +export const deleteEcosystemInvitations = async (invitationId: string) => { const ecosystemId = await getFromLocalStorage(storageKeys.ECOSYSTEM_ID); const orgId = await getFromLocalStorage(storageKeys.ORG_ID) diff --git a/src/components/Ecosystem/interfaces/index.ts b/src/components/Ecosystem/interfaces/index.ts index 46dbce67b..621027521 100644 --- a/src/components/Ecosystem/interfaces/index.ts +++ b/src/components/Ecosystem/interfaces/index.ts @@ -9,9 +9,9 @@ export interface IEcosystem { export interface Ecosystem { id: string createDateTime: string - createdBy: number + createdBy: string lastChangedDateTime: string - lastChangedBy: number + lastChangedBy: string name: string description: string logoUrl: string diff --git a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx index e45d23d4c..52e32e317 100644 --- a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx +++ b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx @@ -33,9 +33,9 @@ export interface EcosystemInvitation { ecosystem: [] id: string createDateTime: string - createdBy: number + createdBy: string lastChangedDateTime: string - lastChangedBy: number + lastChangedBy: string deletedAt: any userId: string orgId: string diff --git a/src/components/EcosystemInvite/SentInvitations.tsx b/src/components/EcosystemInvite/SentInvitations.tsx index 8f77d434b..c17bb0875 100644 --- a/src/components/EcosystemInvite/SentInvitations.tsx +++ b/src/components/EcosystemInvite/SentInvitations.tsx @@ -66,7 +66,7 @@ const SentInvitations = () => { setLoading(false); }; - const deletInvitations = async (invitationId: number) => { + const deletInvitations = async (invitationId: string) => { const response = await deleteEcosystemInvitations(invitationId); const { data } = response as AxiosResponse; diff --git a/src/components/Profile/interfaces/index.ts b/src/components/Profile/interfaces/index.ts index 6ed2fa620..249fda505 100644 --- a/src/components/Profile/interfaces/index.ts +++ b/src/components/Profile/interfaces/index.ts @@ -39,7 +39,7 @@ export interface UserEmail { } export interface UserProfile { - id: number + id: string profileImg?: string username?: string email: string diff --git a/src/components/Resources/Schema/interfaces/index.ts b/src/components/Resources/Schema/interfaces/index.ts index 26bc66268..f65ed2149 100644 --- a/src/components/Resources/Schema/interfaces/index.ts +++ b/src/components/Resources/Schema/interfaces/index.ts @@ -24,7 +24,7 @@ type DataItem = { version: string; attributes: string[]; schemaLedgerId: string; - createdBy: number; + createdBy: string; publisherDid: string; orgId: string; issuerId: string; diff --git a/src/components/User/interfaces/index.ts b/src/components/User/interfaces/index.ts index 5ea002f5a..66f6784ec 100644 --- a/src/components/User/interfaces/index.ts +++ b/src/components/User/interfaces/index.ts @@ -5,8 +5,8 @@ export interface UserActivity { action: string details: string createDateTime: string - createdBy: number + createdBy: string lastChangedDateTime: string - lastChangedBy: number + lastChangedBy: string deletedAt: any } diff --git a/src/components/organization/interfaces/index.ts b/src/components/organization/interfaces/index.ts index 7ec60da48..38fe0a864 100644 --- a/src/components/organization/interfaces/index.ts +++ b/src/components/organization/interfaces/index.ts @@ -10,9 +10,9 @@ export interface Organisation { logoFile: string id: string createDateTime: string - createdBy: number + createdBy: string lastChangedDateTime: string - lastChangedBy: number + lastChangedBy: string name: string description: string logoUrl: string @@ -29,18 +29,18 @@ export interface OrgRole { name: string description: string createDateTime?: string - createdBy?: number + createdBy?: string lastChangedDateTime?: string - lastChangedBy?: number + lastChangedBy?: string deletedAt?: any } export interface OrgAgent { id: string createDateTime: string - createdBy: number + createdBy: string lastChangedDateTime: string - lastChangedBy: number + lastChangedBy: string orgDid: string verkey: string agentEndPoint: string @@ -61,28 +61,28 @@ export interface OrgAgent { export interface AgentsType { id: string createDateTime: string - createdBy: number + createdBy: string lastChangedDateTime: string - lastChangedBy: number + lastChangedBy: string agent: string } export interface org_agent_type{ id: string createDateTime: string -createdBy: number +createdBy: string lastChangedDateTime: string -lastChangedBy: number +lastChangedBy: string agent: string } export interface ledgers{ createDateTime: string -createdBy: number +createdBy: string id: string isActive: boolean -lastChangedBy: number +lastChangedBy: string lastChangedDateTime: string name: string networkString: string @@ -104,9 +104,9 @@ export interface Connection { connectionInvitation: string multiUse: boolean createDateTime: string - createdBy: number + createdBy: string lastChangedDateTime: string - lastChangedBy: number + lastChangedBy: string } export interface EcosystemDashboard { @@ -114,7 +114,6 @@ export interface Connection { endorsementsCount: number } - export interface OrgInterface { name: string; website: string; diff --git a/src/components/organization/interfaces/invitations.ts b/src/components/organization/interfaces/invitations.ts index 294e65e73..0d7500b29 100644 --- a/src/components/organization/interfaces/invitations.ts +++ b/src/components/organization/interfaces/invitations.ts @@ -4,9 +4,9 @@ export interface Invitation { ecosystem: any id: string createDateTime: string - createdBy: number + createdBy: string lastChangedDateTime: string - lastChangedBy: number + lastChangedBy: string deletedAt: any userId: string orgId: string From cd97faa60af16b4dc8a6ef140ce962d039556831 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Mon, 6 Nov 2023 20:38:16 +0530 Subject: [PATCH 03/19] resolved conflicts Signed-off-by: bhavanakarwade --- src/components/Resources/Schema/Create.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Resources/Schema/Create.tsx b/src/components/Resources/Schema/Create.tsx index b28c9fa39..37d191a66 100644 --- a/src/components/Resources/Schema/Create.tsx +++ b/src/components/Resources/Schema/Create.tsx @@ -16,6 +16,7 @@ import { ICheckEcosystem, checkEcosystem, getEcosystemId } from '../../../config import { createSchemaRequest } from '../../../api/ecosystem'; import ConfirmModal from '../../../commonComponents/ConfirmPopup'; import EcosystemProfileCard from '../../../commonComponents/EcosystemProfileCard' +import React from 'react'; const options = [ { value: 'string', label: 'String' }, From afc34c32fd12440fb3c7e3c2718ddc703ec244e8 Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 22 Nov 2023 00:20:55 +0530 Subject: [PATCH 04/19] fix: minor fixes Signed-off-by: karan --- src/common/enums.ts | 19 ++++++++++++ src/components/Issuance/History.tsx | 34 +++++++++++++--------- src/components/Issuance/HistoryDetails.tsx | 3 +- 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/common/enums.ts b/src/common/enums.ts index 7283a230b..bd3205134 100644 --- a/src/common/enums.ts +++ b/src/common/enums.ts @@ -57,3 +57,22 @@ export enum EcosystemRoles { export enum PlatformRoles { platformAdmin = "platform_admin" } + +export enum BulkIssuanceHistory { + started = 'PROCESS_STARTED', + completed = 'PROCESS_COMPLETED', + interrupted= 'PROCESS_INTERRUPTED', + retry= 'PROCESS_REINITIATED' +} + +export enum BulkIssuanceHistoryData { + started = 'Process Started', + completed = 'Process Completed', + interrupted= 'Process Interrupted', + retry= 'Process Reinitiated' +} + +export enum BulkIssuanceStatus { + successful= 'Successful', + failed= 'Failed' +} diff --git a/src/components/Issuance/History.tsx b/src/components/Issuance/History.tsx index 072124742..9a4a5b104 100644 --- a/src/components/Issuance/History.tsx +++ b/src/components/Issuance/History.tsx @@ -18,6 +18,7 @@ import SearchInput from '../SearchInput'; import { Button, Pagination } from 'flowbite-react'; import { getFilesHistory, retryBulkIssuance } from '../../api/BulkIssuance'; import SOCKET from '../../config/SocketConfig'; +import { BulkIssuanceHistory, BulkIssuanceHistoryData } from '../../common/enums'; const HistoryBulkIssuance = () => { const initialPageState = { @@ -54,9 +55,9 @@ const HistoryBulkIssuance = () => { if (data?.data) { setLoading(false); setSuccess(data?.message); - setTimeout(()=>{ + setTimeout(() => { getConnections(); - },500) + }, 500); } else { setLoading(false); } @@ -149,21 +150,26 @@ const HistoryBulkIssuance = () => { { data: failedRecords }, { - data: - status === 'PROCESS_STARTED' ? ( -

- Process Started -

- ) : ( -

- Process Completed -

- ), + data: ( +

+ {status === BulkIssuanceHistory.started ? BulkIssuanceHistoryData.started : status === BulkIssuanceHistory.completed ? BulkIssuanceHistoryData.completed : status === BulkIssuanceHistory.interrupted ? BulkIssuanceHistoryData.interrupted : BulkIssuanceHistoryData.retry } +

+ ), }, { data: (

Confirmation

{props.message}

- -
- - + + + + +

Issue

+
From 909cce14966ea5e3ee00ce2d16d996322d998835 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Wed, 22 Nov 2023 18:14:42 +0530 Subject: [PATCH 06/19] refactor:certificate meta tag title and description Signed-off-by: pranalidhanavade --- src/components/UserCertificate.astro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/UserCertificate.astro b/src/components/UserCertificate.astro index 4440d5cca..d41a8d30b 100644 --- a/src/components/UserCertificate.astro +++ b/src/components/UserCertificate.astro @@ -13,10 +13,10 @@ const imageUrl = fetchApi?.imageUrl; --- - - + +
- UserCertificate + World Memory Championship Certificate
From a197296a13d8fc431c51a2cab5b16417ced38310 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Wed, 22 Nov 2023 18:16:35 +0530 Subject: [PATCH 07/19] refactor:certificate meta tag title and description Signed-off-by: pranalidhanavade --- src/components/UserCertificate.astro | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/UserCertificate.astro b/src/components/UserCertificate.astro index d41a8d30b..ee10bce4e 100644 --- a/src/components/UserCertificate.astro +++ b/src/components/UserCertificate.astro @@ -11,7 +11,6 @@ const fetchApi = await API({ }); const imageUrl = fetchApi?.imageUrl; --- - From 273bd3366bc4c54d6b3dbcdde7396cff2b3c80d0 Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 22 Nov 2023 19:59:21 +0530 Subject: [PATCH 08/19] fix: socket and status for retry Signed-off-by: karan --- src/api/BulkIssuance.ts | 2 +- src/common/enums.ts | 7 +- src/components/Issuance/BulkIssuance.tsx | 2 +- src/components/Issuance/History.tsx | 129 +++++++++-------------- 4 files changed, 59 insertions(+), 81 deletions(-) diff --git a/src/api/BulkIssuance.ts b/src/api/BulkIssuance.ts index 5f8713d3e..adfdad9e3 100644 --- a/src/api/BulkIssuance.ts +++ b/src/api/BulkIssuance.ts @@ -116,7 +116,7 @@ export const retryBulkIssuance = async (fileId:string, clientId:string) => { const axiosPayload = { url, - payload: clientId, + payload:{clientId:clientId}, config: await getHeaderConfigs(), }; diff --git a/src/common/enums.ts b/src/common/enums.ts index bd3205134..f4f869552 100644 --- a/src/common/enums.ts +++ b/src/common/enums.ts @@ -62,14 +62,17 @@ export enum BulkIssuanceHistory { started = 'PROCESS_STARTED', completed = 'PROCESS_COMPLETED', interrupted= 'PROCESS_INTERRUPTED', - retry= 'PROCESS_REINITIATED' + retry= 'PROCESS_REINITIATED', + partially_completed= 'PARTIALLY_COMPLETED' + } export enum BulkIssuanceHistoryData { started = 'Process Started', completed = 'Process Completed', interrupted= 'Process Interrupted', - retry= 'Process Reinitiated' + retry= 'Process Reinitiated', + partially_completed= "Process Failed" } export enum BulkIssuanceStatus { diff --git a/src/components/Issuance/BulkIssuance.tsx b/src/components/Issuance/BulkIssuance.tsx index c0e873beb..da9818c5b 100644 --- a/src/components/Issuance/BulkIssuance.tsx +++ b/src/components/Issuance/BulkIssuance.tsx @@ -186,7 +186,7 @@ const BulkIssuance = () => { SOCKET.on('error-in-bulk-issuance-process', () => { console.log(`error-in-bulk-issuance-process-initiated`); - toast.error('Issuance process failed, please retry', { + toast.error('Issuance process failed. Please retry', { position: 'top-right', autoClose: 3000, hideProgressBar: false, diff --git a/src/components/Issuance/History.tsx b/src/components/Issuance/History.tsx index 6f6d7adba..1e5bf0b8f 100644 --- a/src/components/Issuance/History.tsx +++ b/src/components/Issuance/History.tsx @@ -17,7 +17,10 @@ import SearchInput from '../SearchInput'; import { Button, Pagination } from 'flowbite-react'; import { getFilesHistory, retryBulkIssuance } from '../../api/BulkIssuance'; import SOCKET from '../../config/SocketConfig'; -import { BulkIssuanceHistory, BulkIssuanceHistoryData } from '../../common/enums'; +import { + BulkIssuanceHistory, + BulkIssuanceHistoryData, +} from '../../common/enums'; import { ToastContainer, toast } from 'react-toastify'; const HistoryBulkIssuance = () => { @@ -47,19 +50,15 @@ const HistoryBulkIssuance = () => { }; const handleRetry = async (fileId: string) => { - setSuccess("Issuance process reinitiated. Please await a moment.") + setSuccess('Issuance process reinitiated. Please wait a moment.'); setLoading(true); const retryIssunace = await retryBulkIssuance(fileId, SOCKET.id); const { data } = retryIssunace as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { - setSuccess(null) if (data?.data) { setLoading(false); - setSuccess(data?.message); - setTimeout(() => { - getConnections(); - }, 500); + getConnections(); } else { setLoading(false); } @@ -72,62 +71,37 @@ const HistoryBulkIssuance = () => { } }; -useEffect(()=>{ - SOCKET.emit('bulk-connection', (res) => { - console.log(6448, res) - }) - SOCKET.on('bulk-issuance-process-completed', () => { - console.log(`bulk-issuance-process-initiated`); - toast.success('Bulk issuance process initiated.', { - position: 'top-right', - autoClose: 5000, - hideProgressBar: false, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: 'colored', - }); - }); - - SOCKET.on('error-in-bulk-issuance-process', () => { - console.log(`error-in-bulk-issuance-process-initiated`); - toast.error('Oops! Something went wrong.', { - position: 'top-right', - autoClose: 5000, - hideProgressBar: false, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: 'colored', - }); - }); - - -},[]) - - useEffect(() => { + SOCKET.emit('bulk-connection'); + SOCKET.on('bulk-issuance-process-completed', () => { + console.log(`bulk-issuance-process-completed`); + toast.success('Bulk issuance process completed.', { + position: 'top-right', + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: 'colored', + }); + setSuccess("Bulk issuance process completed."); + }); - SOCKET.emit('bulk-connection', (res) => { - console.log(6448, res) - }) - - SOCKET.on('bulk-issuance-process-completed', () => { - console.log(`bulk-issuance-process-initiated`); - toast.success('Bulk issuance process initiated.', { - position: 'top-right', - autoClose: 5000, - hideProgressBar: false, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: 'colored', - }); - }); - + SOCKET.on('error-in-bulk-issuance-process', () => { + console.log(`error-in-bulk-issuance-retry-process-initiated`); + toast.error('Issuance process failed. Please retry', { + position: 'top-right', + autoClose: 3000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: 'colored', + }); + setError('Issuance process failed, please retry'); + }); let getData: NodeJS.Timeout; @@ -200,13 +174,25 @@ useEffect(()=>{ className={`${ status === BulkIssuanceHistory.started ? 'bg-primary-100 text-primary-800 dark:bg-gray-700 dark:text-primary-400 border border-primary-100 dark:border-primary-500' - : status === BulkIssuanceHistory.completed + : status === BulkIssuanceHistory.completed || + status === BulkIssuanceHistory.retry ? 'bg-green-100 text-green-800 dark:bg-gray-700 dark:text-green-400 border border-green-100 dark:border-green-500' - :status === BulkIssuanceHistory.interrupted ? 'bg-orange-100 text-orange-800 dark:bg-orange-700 dark:text-orange-400 border border-orange-100 dark:border-orange-500': - 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400 border border-gray-100 dark:border-gray-500' + : status === BulkIssuanceHistory.interrupted + ? 'bg-orange-100 text-orange-800 dark:bg-orange-700 dark:text-orange-400 border border-orange-100 dark:border-orange-500' + : status === BulkIssuanceHistory.partially_completed + ? 'bg-red-100 text-red-800 dark:bg-red-700 dark:text-red-400 border border-red-100 dark:border-red-500' + : 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400 border border-gray-100 dark:border-gray-500' } text-sm font-medium mr-0.5 px-0.5 py-0.5 rounded-md flex justify-center items-center max-w-[180px]`} > - {status === BulkIssuanceHistory.started ? BulkIssuanceHistoryData.started : status === BulkIssuanceHistory.completed ? BulkIssuanceHistoryData.completed : status === BulkIssuanceHistory.interrupted ? BulkIssuanceHistoryData.interrupted : BulkIssuanceHistoryData.retry } + {status === BulkIssuanceHistory.started + ? BulkIssuanceHistoryData.started + : status === BulkIssuanceHistory.completed + ? BulkIssuanceHistoryData.completed + : status === BulkIssuanceHistory.interrupted + ? BulkIssuanceHistoryData.interrupted + : status === BulkIssuanceHistory.partially_completed + ? BulkIssuanceHistoryData.partially_completed + : BulkIssuanceHistoryData.retry}

), }, @@ -302,18 +288,7 @@ useEffect(()=>{ return (
- +
From de154acbee25e46d3e2602c79581140ac0381f2b Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 22 Nov 2023 20:38:24 +0530 Subject: [PATCH 09/19] refactor: refresh button added Signed-off-by: karan --- src/components/Issuance/BulkIssuance.tsx | 1 - src/components/Issuance/History.tsx | 29 ++++++++++++++--- src/components/Issuance/IssuancePopup.tsx | 39 ++++------------------- 3 files changed, 30 insertions(+), 39 deletions(-) diff --git a/src/components/Issuance/BulkIssuance.tsx b/src/components/Issuance/BulkIssuance.tsx index da9818c5b..d9c0422bb 100644 --- a/src/components/Issuance/BulkIssuance.tsx +++ b/src/components/Issuance/BulkIssuance.tsx @@ -730,7 +730,6 @@ const BulkIssuance = () => { diff --git a/src/components/Issuance/History.tsx b/src/components/Issuance/History.tsx index 1e5bf0b8f..fe3afe9d2 100644 --- a/src/components/Issuance/History.tsx +++ b/src/components/Issuance/History.tsx @@ -74,7 +74,7 @@ const HistoryBulkIssuance = () => { useEffect(() => { SOCKET.emit('bulk-connection'); SOCKET.on('bulk-issuance-process-completed', () => { - console.log(`bulk-issuance-process-completed`); + console.log(`bulk-issuance-process-completed`); toast.success('Bulk issuance process completed.', { position: 'top-right', autoClose: 5000, @@ -85,7 +85,7 @@ const HistoryBulkIssuance = () => { progress: undefined, theme: 'colored', }); - setSuccess("Bulk issuance process completed."); + setSuccess('Bulk issuance process completed.'); }); SOCKET.on('error-in-bulk-issuance-process', () => { @@ -178,9 +178,9 @@ const HistoryBulkIssuance = () => { status === BulkIssuanceHistory.retry ? 'bg-green-100 text-green-800 dark:bg-gray-700 dark:text-green-400 border border-green-100 dark:border-green-500' : status === BulkIssuanceHistory.interrupted - ? 'bg-orange-100 text-orange-800 dark:bg-orange-700 dark:text-orange-400 border border-orange-100 dark:border-orange-500' + ? 'bg-orange-100 text-orange-800 dark:bg-gray-700 dark:text-orange-400 border border-orange-100 dark:border-orange-400' : status === BulkIssuanceHistory.partially_completed - ? 'bg-red-100 text-red-800 dark:bg-red-700 dark:text-red-400 border border-red-100 dark:border-red-500' + ? 'bg-red-100 text-red-800 dark:bg-gray-700 dark:text-red-400 border border-red-100 dark:border-red-500' : 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400 border border-gray-100 dark:border-gray-500' } text-sm font-medium mr-0.5 px-0.5 py-0.5 rounded-md flex justify-center items-center max-w-[180px]`} > @@ -291,7 +291,26 @@ const HistoryBulkIssuance = () => {
- + +
+ + + +
void; onSuccess: (flag: boolean) => void; - message: string; isProcessing: boolean; } @@ -94,34 +93,21 @@ const IssuancePopup = (props: IProps) => { -

Confirmation

+

Confirmation

- {props.message} + Are you sure you want to Offer Credentials ?

From ef03e697ac5aa25fe506823e9a4e7af93882b987 Mon Sep 17 00:00:00 2001 From: Moulika Kulkarni Date: Wed, 22 Nov 2023 20:59:58 +0530 Subject: [PATCH 10/19] fix:id-to-uuid-conversion Signed-off-by: Moulika Kulkarni --- src/components/Resources/Schema/Create.tsx | 4 ++-- src/components/organization/WalletSpinup.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Resources/Schema/Create.tsx b/src/components/Resources/Schema/Create.tsx index 8d7ace738..3a7adeaa0 100644 --- a/src/components/Resources/Schema/Create.tsx +++ b/src/components/Resources/Schema/Create.tsx @@ -41,7 +41,7 @@ interface IFormData { const CreateSchema = () => { const [failure, setFailure] = useState(null); const [orgId, setOrgId] = useState(''); - const [createloader, setCreateLoader] = useState(false); + const [createLoader, setCreateLoader] = useState(false); const [showPopup, setShowPopup] = useState(false) const [isEcosystemData, setIsEcosystemData] = useState(); @@ -84,7 +84,7 @@ const CreateSchema = () => { orgId, }; - const createSchema = await addSchema(schemaFieldName, String(orgId)); + const createSchema = await addSchema(schemaFieldName, orgId); const { data } = createSchema as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { diff --git a/src/components/organization/WalletSpinup.tsx b/src/components/organization/WalletSpinup.tsx index cf9c50dc3..32b73bd1b 100644 --- a/src/components/organization/WalletSpinup.tsx +++ b/src/components/organization/WalletSpinup.tsx @@ -67,7 +67,7 @@ const fetchNetworks = async () => { try { const { data } = await getLedgers() as AxiosResponse if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - return data?.data + return data?.data } return [] } catch (err) { @@ -479,7 +479,7 @@ const WalletSpinup = (props: { walletPassword: passwordEncryption(values.password), did: values.did, ledgerId: [ - Number(values.network) + (values.network.toString()) ], clientSocketId: SOCKET.id } @@ -507,14 +507,14 @@ const WalletSpinup = (props: { label: values.label, seed: values.seed || seeds, ledgerId: [ - Number(values.network) + (values.network.toString()) ], did: values.did, clientSocketId: SOCKET.id, }; const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const spinupRes = await spinupSharedAgent(payload, parseInt(orgId)); + const spinupRes = await spinupSharedAgent(payload, orgId); const { data } = spinupRes as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { From 542410f0ba394bcdec93e8e7c1f25f92c5db6c3a Mon Sep 17 00:00:00 2001 From: sanjay-k1910 Date: Wed, 22 Nov 2023 21:45:30 +0530 Subject: [PATCH 11/19] refactor: bulk issuance Signed-off-by: sanjay-k1910 --- src/api/BulkIssuance.ts | 6 +- src/common/global.css | 7 + src/components/Issuance/BulkIssuance.tsx | 768 +++++++++--------- src/components/Issuance/Connections.tsx | 11 +- src/components/Issuance/IssuancePopup.tsx | 1 + src/components/Issuance/IssuedCrdentials.tsx | 34 +- src/components/RoleViewButton/index.tsx | 25 +- src/config/pathRoutes.ts | 1 + .../credentials/bulk-issuance.astro | 16 + 9 files changed, 465 insertions(+), 404 deletions(-) create mode 100644 src/pages/organizations/credentials/bulk-issuance.astro diff --git a/src/api/BulkIssuance.ts b/src/api/BulkIssuance.ts index 4b087365a..e8904673d 100644 --- a/src/api/BulkIssuance.ts +++ b/src/api/BulkIssuance.ts @@ -24,9 +24,8 @@ export const getSchemaCredDef = async () => { } }; -export const DownloadCsvTemplate = async () => { +export const DownloadCsvTemplate = async (credDefId: string) => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const credDefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID); const url = `${apiRoutes.organizations.root}/${orgId}/${credDefId}${apiRoutes.Issuance.download}`; const axiosPayload = { @@ -46,9 +45,8 @@ export const DownloadCsvTemplate = async () => { // upload file -export const uploadCsvFile = async (payload: any) => { +export const uploadCsvFile = async (payload: any, credefId: string) => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const credefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID); const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.bulk.uploadCsv}?credDefId=${credefId}`; diff --git a/src/common/global.css b/src/common/global.css index e590fde14..de61c66fc 100644 --- a/src/common/global.css +++ b/src/common/global.css @@ -17,6 +17,13 @@ ul[role="tablist"] li[role="presentation"] button[aria-selected="true"] { @apply text-primary-700 border-primary-700; } +button.role-btn span { + @apply overflow-hidden; + border-radius: 8px; + padding-top: 6.5px; + padding-bottom: 6.5px; +} + .word-break-word{ word-break: break-word !important; } diff --git a/src/components/Issuance/BulkIssuance.tsx b/src/components/Issuance/BulkIssuance.tsx index c0e873beb..7b2d79971 100644 --- a/src/components/Issuance/BulkIssuance.tsx +++ b/src/components/Issuance/BulkIssuance.tsx @@ -14,6 +14,8 @@ import { pathRoutes } from '../../config/pathRoutes'; import IssuancePopup from './IssuancePopup'; import SOCKET from '../../config/SocketConfig'; import { ToastContainer, toast } from 'react-toastify'; +import BreadCrumbs from '../BreadCrumbs'; +import BackButton from '../../commonComponents/backbutton' interface IValues { value: string; @@ -111,13 +113,13 @@ const BulkIssuance = () => { const DownloadSchemaTemplate = async () => { setProcess(true); - const credDefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID); - - if (credDefId) { + // const credDefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID); +console.log(65658, credentialSelected) + if (credentialSelected) { try { setProcess(true); - const response = await DownloadCsvTemplate(); + const response = await DownloadCsvTemplate(credentialSelected); const { data } = response as AxiosResponse; if (data) { @@ -221,8 +223,7 @@ const BulkIssuance = () => { await wait(500); - - const response = await uploadCsvFile(payload); + const response = await uploadCsvFile(payload, credentialSelected); const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes?.API_STATUS_CREATED) { @@ -342,6 +343,7 @@ const BulkIssuance = () => { const response = await issueBulkCredential(requestId, SOCKET.id); const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { + if (data?.data) { setLoading(false); setOpenModal(false); @@ -372,227 +374,254 @@ const BulkIssuance = () => { ); return ( -
- - {(success || failure) && ( - { - setSuccess(null); - setFailure(null); - }} - viewButton={Boolean((success && success === "Issuance process completed") || (error && error === "Issuance process failed, please retry"))} - path={pathRoutes.organizations.Issuance.history} - /> - )} -
-
-

- Bulk Issuance -

- Bulk issuance by .csv +
+
+
+ +
-
-
- +
+ + {(success || failure) && ( + { + setSuccess(null); + setFailure(null); + }} + viewButton={Boolean((success && success === "Issuance process completed") || (error && error === "Issuance process failed, please retry"))} + path={pathRoutes.organizations.Issuance.history} + /> + )} +
-
-
-
- { + setCredentialSelected(value?.value ?? ""); + }} + /> +
+
+ {credentialSelected && ( + +
+

+ Schema: + {selectedCred?.schemaName || ""}{' '} + [{selectedCred?.schemaVersion}] +

+

+ {' '} + + Credential Definition: + {' '} + {selectedCred?.credentialDefinition} +

+ Attributes: +
+ {selectedCred?.schemaAttributes.map( + (element: IAttributes) => ( +
+ + {element.attributeName} + +
+ ), + )} +
-
- - )} -
-
- -
-
- {/* ---------------- */} -
-
-
-
+
+ +
+
+ {/* ---------------- */} +
+
+
+ -
-
- + {' '} + {' '} + {' '} + + +

+ Drag file here +

+
+ +
+
+ +
-
-
- {uploadedFileName && ( -
-

- {uploadedFileName} -

- +
+ )} + {error && ( +
+

{error}

{ d="M6 18L18 6M6 6l12 12" /> - -
- )} - {error && ( -
-

{error}

- - - -
- )} +
+ )} +
-
-
- - {csvData && csvData.length > 0 && ( - -
-
-
- {csvData && csvData.length > 0 && ( -
- - - - - {csvData.length > 0 && - Object.keys(csvData[0]).map((header, index) => ( - - ))} - - - - {csvData && - csvData.length > 0 && - csvData.map((row, rowIndex) => ( - - {Object.values(row).map((cell, cellIndex) => ( - + + + {csvData && + csvData.length > 0 && + csvData.map((row, rowIndex) => ( + + {Object.values(row).map((cell, cellIndex) => ( + + ))} + + ))} + +
- {header} -
+ + {csvData && csvData.length > 0 && ( + +
+
+
+ {csvData && csvData.length > 0 && ( +
+ + + + + {csvData.length > 0 && + Object.keys(csvData[0]).map((header, index) => ( + ))} - - ))} - -
- {cell} - + {header} +
-
- )} +
+ {cell} +
+
+ )} +
-
- {currentPage.total > 1 && ( -
- -
- )} - - )} -
- {!isCredSelected && ( - <> -

Steps

-
    -
  • -

    - Select and Download -

    -

    - Select credential definition and download .CSV file -

    -
  • -
  • -

    - Fill the data -

    -

    - Fill issuance data in the downloaded .CSV file -

    -
  • -
  • -

    - Upload and Issue -

    -

    - Upload .CSV file and click on issue -

    -
  • -
- + {currentPage.total > 1 && ( +
+ +
+ )} + )} +
+ {!isCredSelected && ( + <> +

Steps

+
    +
  • +

    + Select and Download +

    +

    + Select credential definition and download .CSV file +

    +
  • +
  • +

    + Fill the data +

    +

    + Fill issuance data in the downloaded .CSV file +

    +
  • +
  • +

    + Upload and Issue +

    +

    + Upload .CSV file and click on issue +

    +
  • +
+ + )} - + -
- - + + + + + Reset + +
@@ -793,4 +803,4 @@ const BulkIssuance = () => { ); }; -export default BulkIssuance; +export default BulkIssuance; \ No newline at end of file diff --git a/src/components/Issuance/Connections.tsx b/src/components/Issuance/Connections.tsx index dfc204ef3..fffdc7e5f 100644 --- a/src/components/Issuance/Connections.tsx +++ b/src/components/Issuance/Connections.tsx @@ -10,7 +10,6 @@ import { pathRoutes } from '../../config/pathRoutes'; import BreadCrumbs from '../BreadCrumbs'; import ConnectionList from './ConnectionList'; import BackButton from '../../commonComponents/backbutton'; -import BulkIssuance from './BulkIssuance'; const Connections = () => { const [selectedConnectionList, setSelectedConnectionList] = useState< @@ -63,7 +62,8 @@ const Connections = () => { Connection -
  • + {/* Keep this code as it is, this is required in future use. */} + {/*
  • -
  • + */}
    @@ -129,14 +129,15 @@ const Connections = () => { )}
    -
    -
    +
    */}
    ); diff --git a/src/components/Issuance/IssuancePopup.tsx b/src/components/Issuance/IssuancePopup.tsx index fe874fde5..9fbe2d97b 100644 --- a/src/components/Issuance/IssuancePopup.tsx +++ b/src/components/Issuance/IssuancePopup.tsx @@ -90,6 +90,7 @@ const IssuancePopup = (props: IProps) => { disabled={props.isProcessing} onClick={() => { props.onSuccess(true); + window.scrollTo({top: 0, left: 0, behavior: 'smooth'}); }} className="bg-primary-700 hover:!bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800 font-medium rounded-lg inline-flex items-center text-center ml-2" > diff --git a/src/components/Issuance/IssuedCrdentials.tsx b/src/components/Issuance/IssuedCrdentials.tsx index 657c68979..db311429e 100644 --- a/src/components/Issuance/IssuedCrdentials.tsx +++ b/src/components/Issuance/IssuedCrdentials.tsx @@ -150,25 +150,49 @@ const CredentialList = () => {
    -
    +

    Credentials

    -
    +
    + { walletCreated && - - + + } onClickEvent={schemeSelection} /> } + { + walletCreated && + + + + + + + + + + + + + + } + onClickEvent={() => window.location.href = pathRoutes.organizations.Issuance.bulkIssuance} + /> + }
    diff --git a/src/components/RoleViewButton/index.tsx b/src/components/RoleViewButton/index.tsx index 1c2f0616b..1023fd678 100644 --- a/src/components/RoleViewButton/index.tsx +++ b/src/components/RoleViewButton/index.tsx @@ -11,10 +11,11 @@ interface RoleViewButtonProps { svgComponent?: ReactElement, onClickEvent?: () => void, feature: string + isOutline?: boolean } -const RoleViewButton = ({ buttonTitle, svgComponent, onClickEvent, feature }: RoleViewButtonProps) => { +const RoleViewButton = ({ buttonTitle, svgComponent, onClickEvent, feature, isOutline }: RoleViewButtonProps) => { const [userRoles, setUserRoles] = useState([]) @@ -30,25 +31,25 @@ const RoleViewButton = ({ buttonTitle, svgComponent, onClickEvent, feature }: Ro const isRoleAccess = (): boolean => { - if(feature === Features.CRETAE_ORG){ + if (feature === Features.CRETAE_ORG) { return true } else if (feature === Features.ISSUENCE) { - if (userRoles.includes(Roles.OWNER) - || userRoles.includes(Roles.ADMIN) - || userRoles.includes(Roles.ISSUER) + if (userRoles.includes(Roles.OWNER) + || userRoles.includes(Roles.ADMIN) + || userRoles.includes(Roles.ISSUER) ) { return true } return false - }else if (feature === Features.VERIFICATION) { - if (userRoles.includes(Roles.OWNER) - || userRoles.includes(Roles.ADMIN) - || userRoles.includes(Roles.VERIFIER) + } else if (feature === Features.VERIFICATION) { + if (userRoles.includes(Roles.OWNER) + || userRoles.includes(Roles.ADMIN) + || userRoles.includes(Roles.VERIFIER) ) { return true } return false - }else if (userRoles.includes(Roles.OWNER) || userRoles.includes(Roles.ADMIN)) { + } else if (userRoles.includes(Roles.OWNER) || userRoles.includes(Roles.ADMIN)) { return true } else { return false @@ -61,8 +62,10 @@ const RoleViewButton = ({ buttonTitle, svgComponent, onClickEvent, feature }: Ro { isRoleAccess() &&