diff --git a/src/components/Resources/Schema/SchemasList.tsx b/src/components/Resources/Schema/SchemasList.tsx index 0c3760db6..bc1f9cfb6 100644 --- a/src/components/Resources/Schema/SchemasList.tsx +++ b/src/components/Resources/Schema/SchemasList.tsx @@ -23,7 +23,7 @@ import { checkEcosystem } from '../../../config/ecosystem'; import type { ICheckEcosystem } from '../../../config/ecosystem'; import { Create, SchemaEndorsement } from '../../Issuance/Constant'; -import { DidMethod, SchemaType } from '../../../common/enums'; +import { DidMethod, SchemaType, SchemaTypes } from '../../../common/enums'; const SchemaList = (props: { schemaSelectionCallback: ( @@ -57,6 +57,8 @@ const SchemaList = (props: { const [totalItem, setTotalItem] = useState(0); const [isEcosystemData, setIsEcosystemData] = useState(); const [searchValue, setSearchValue] = useState(''); + const [schemaType, setSchemaType] = useState(''); + const [w3cSchema,setW3CSchema]= useState(false); const [isNoLedger,setisNoLedger]= useState(false); @@ -70,7 +72,7 @@ const SchemaList = (props: { setLoading(true); let schemaList; if (allSchemaFlag) { - schemaList = await getAllSchemas(schemaListAPIParameter, SchemaType.INDY); + schemaList = await getAllSchemas(schemaListAPIParameter, schemaType); } else { schemaList = await getAllSchemasByOrgId( schemaListAPIParameter, @@ -229,9 +231,11 @@ const SchemaList = (props: { } if (did.includes(DidMethod.POLYGON) || did.includes(DidMethod.KEY) || did.includes(DidMethod.WEB)) { setW3CSchema(true); + setSchemaType(SchemaTypes.schema_W3C) } if (did.includes(DidMethod.INDY)) { setW3CSchema(false); + setSchemaType(SchemaTypes.schema_INDY) } if (did.includes(DidMethod.KEY) || did.includes(DidMethod.WEB)) { setisNoLedger(true); diff --git a/src/components/organization/walletCommonComponents/DedicatedAgent.tsx b/src/components/organization/walletCommonComponents/DedicatedAgent.tsx index 60817dcfe..f1c0b7369 100644 --- a/src/components/organization/walletCommonComponents/DedicatedAgent.tsx +++ b/src/components/organization/walletCommonComponents/DedicatedAgent.tsx @@ -19,6 +19,7 @@ import SetDomainValueInput from './SetDomainValueInput'; import SetPrivateKeyValueInput from './SetPrivateKeyValue'; import { getOrganizationById, setAgentConfigDetails } from '../../../api/organization'; import type { IDedicatedAgentConfig} from '../interfaces'; +import React from 'react'; const RequiredAsterisk = () => * @@ -36,6 +37,7 @@ const DedicatedAgentForm = ({ const [selectedLedger, setSelectedLedger] = useState(''); const [selectedDid, setSelectedDid] = useState(''); const [selectedMethod, setSelectedMethod]=useState('') + const [isSelectedNetwork, setIsSelectedNetwork]=useState('') const [privateKeyValue, setPrivateKeyValue] = useState(''); const [domainValue, setDomainValue] = useState(''); const [isLoading, setIsLoading] = useState(false); @@ -118,6 +120,7 @@ const DedicatedAgentForm = ({ const handleLedgerChanges = (e: ChangeEvent) => { setSelectedLedger(e.target.value); setSelectedMethod(''); + setIsSelectedNetwork(''); setSelectedDid(''); }; const handleMethodChanges = (e: ChangeEvent) => { @@ -248,6 +251,7 @@ const networkRenderOptions = (formikHandlers: { handleChange: (e: React.ChangeEv onChange={(e) => { formikHandlers.handleChange(e); handleNetworkChanges(e); + setIsSelectedNetwork(networks[network]) }} className="mr-2" /> @@ -258,7 +262,19 @@ const networkRenderOptions = (formikHandlers: { handleChange: (e: React.ChangeEv )); }; +const isSubmitButtonDisabled = () => { + if (!selectedLedger) { + return true; + } + else if ((selectedLedger === Ledgers.POLYGON && !privateKeyValue) || (selectedLedger === Ledgers.INDY && (!selectedMethod || !isSelectedNetwork))) { + return true; + } + else if ((selectedLedger === Ledgers.NO_LEDGER && !selectedMethod) ||(selectedLedger === Ledgers.NO_LEDGER && selectedMethod === DidMethod.WEB && !domainValue)) { + return true; + } + return false; +}; return ( <> @@ -565,6 +581,7 @@ const networkRenderOptions = (formikHandlers: { handleChange: (e: React.ChangeEv