Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dedicated agent workflow #693

Merged
merged 46 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c5a2ef9
feat:Working on dedicated agent workflow
shitrerohit May 23, 2024
2717a9b
Merge branch 'develop' of https://github.com/credebl/studio into feat…
shitrerohit May 23, 2024
ddeade2
feat/dedicated agent ui form
pranalidhanavade May 29, 2024
c8911fe
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade May 29, 2024
2e8d59e
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade May 29, 2024
fc6ec4d
feat/ conditional rendering of forms
pranalidhanavade May 29, 2024
8f0e689
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 3, 2024
eb9822b
feat:add support for dedicated agent
pranalidhanavade Jun 7, 2024
752de81
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 7, 2024
5d972ce
feat:dedicated agent workflow integration
pranalidhanavade Jun 9, 2024
053bf42
feat:dedicated agent workflow integration
pranalidhanavade Jun 9, 2024
c4aac19
feat:dedicated agent workflow integration
pranalidhanavade Jun 9, 2024
2a9bd84
feat:dedicated agent workflow integration
pranalidhanavade Jun 9, 2024
23441c2
feat:dedicated agent workflow integration
pranalidhanavade Jun 9, 2024
eb853ba
feat:dedicated agent workflow integration
pranalidhanavade Jun 9, 2024
bdb17d0
fix: sonarcloud issues
pranalidhanavade Jun 10, 2024
c589141
fix: sonarcloud issues
pranalidhanavade Jun 10, 2024
4a1fc37
fix: sonarcloud issues
pranalidhanavade Jun 10, 2024
8cb1103
fix: sonarcloud issues
pranalidhanavade Jun 10, 2024
e22b753
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 11, 2024
dabdcad
feat:dedicated agent workflow ui
pranalidhanavade Jun 13, 2024
d162ef0
feat:dedicated agent workflow
pranalidhanavade Jun 17, 2024
1c4561a
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 17, 2024
145987e
fix:sonarcloud issues
pranalidhanavade Jun 17, 2024
32a8a5c
fix: duplication issue of sonarcloud
pranalidhanavade Jun 17, 2024
9151987
fix: duplication code issue of sonarcloud
pranalidhanavade Jun 17, 2024
4c60aec
fix: duplication code issue of sonarcloud
pranalidhanavade Jun 17, 2024
8026047
fix: sonarlint issues
pranalidhanavade Jun 17, 2024
06046f9
fix: sonarlint duplication issue
pranalidhanavade Jun 17, 2024
bb7bcc7
feat:dedicated agent workflow
pranalidhanavade Jun 18, 2024
9855d09
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 18, 2024
7bad82d
fixed:sonarcloud issues
pranalidhanavade Jun 18, 2024
0214be1
fixed:sonarcloud issues
pranalidhanavade Jun 18, 2024
1727aeb
fix: removed consoles
pranalidhanavade Jun 18, 2024
86114f0
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 18, 2024
ad59a60
feat: support for dedicated agent
pranalidhanavade Jun 18, 2024
afd18c1
fix: removed consoles
pranalidhanavade Jun 18, 2024
2e5cf7e
fix: removed consoles
pranalidhanavade Jun 18, 2024
2820d9f
fix: removed consoles
pranalidhanavade Jun 18, 2024
671d21a
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 19, 2024
378297f
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 19, 2024
81e4bdd
Merge branch 'develop' of https://github.com/credebl/studio into feat…
pranalidhanavade Jun 19, 2024
987cc63
fix: formik validations
pranalidhanavade Jun 20, 2024
21c380d
fix:dedicated agent formik validations
pranalidhanavade Jun 20, 2024
ed9079a
fix: yup formik validations
pranalidhanavade Jun 20, 2024
3124c9c
fix: static values from enum
pranalidhanavade Jun 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 29 additions & 1 deletion src/api/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { apiRoutes } from '../config/apiRoutes';
import { getFromLocalStorage } from './Auth';
import { getHeaderConfigs } from '../config/GetHeaderConfigs';
import { storageKeys } from '../config/CommonConstant';
import type { IUpdatePrimaryDid } from '../components/organization/interfaces';
import type { IDedicatedAgentConfig, IUpdatePrimaryDid } from '../components/organization/interfaces';

export const createOrganization = async (data: object) => {
const url = apiRoutes.organizations.create;
Expand Down Expand Up @@ -166,6 +166,34 @@ export const spinupDedicatedAgent = async (data: object, orgId: string) => {
}
};

export const setAgentConfigDetails = async (data: IDedicatedAgentConfig, orgId: string) => {
const url =`${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.setAgentConfig}`
const payload = data;

const token = await getFromLocalStorage(storageKeys.TOKEN);

const config = {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
};
const axiosPayload = {
url,
payload,
config,
};

try {
return await axiosPost(axiosPayload);
} catch (error) {
const err = error as Error;
return err?.message;
}
};



export const spinupSharedAgent = async (data: object, orgId: string) => {
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentSharedSpinup}`;
const payload = data;
Expand Down
6 changes: 6 additions & 0 deletions src/common/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,10 @@ export enum CommonConstants {

export enum Devices {
Linux = 'linux'
}

export enum Ledgers {
INDY = 'indy',
POLYGON = 'polygon',
NOLEDGER = 'noledger'
}
4 changes: 2 additions & 2 deletions src/commonComponents/EcosystemProfileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ const EcosystemProfileCard = ({getEndorsementListData}:IEndorsement) => {
>
<div className="mr-4">
{ecosystemDetails?.logoUrl ? (
<CustomAvatar size="80px" round src={ecosystemDetails?.logoUrl} />
<CustomAvatar size="80px" textSizeRatio={2.5} round src={ecosystemDetails?.logoUrl} />
) : (
<CustomAvatar size="80px" round name={ecosystemDetails?.name} />
<CustomAvatar size="80px" textSizeRatio={2.5} round name={ecosystemDetails?.name} />
)}
</div>

Expand Down
3 changes: 1 addition & 2 deletions src/components/Authentication/SignUpUserPasskey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const SignUpUserPasskey = ({ email, firstName, lastName }: { email: string, firs
if (window?.location?.search.length > 7) {
setEmailAutoFill(window?.location?.search.split('=')[1])
}

const platform = navigator.platform.toLowerCase();
if (platform.includes(Devices.Linux)) {
setIsDevice(true);
Expand Down Expand Up @@ -288,7 +287,7 @@ const SignUpUserPasskey = ({ email, firstName, lastName }: { email: string, firs
id='signupcreatepasskey'
isProcessing={loading}
onClick={() => {
registerWithPasskey(true)
registerWithPasskey(true)
}}
>

Expand Down
20 changes: 16 additions & 4 deletions src/components/organization/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { pathRoutes } from '../../config/pathRoutes';
import { AlertComponent } from '../AlertComponent';
import WalletSpinup from './walletCommonComponents/WalletSpinup';
import DashboardCard from '../../commonComponents/DashboardCard';
import React from 'react';

const Dashboard = () => {
const [orgData, setOrgData] = useState<Organisation | null>(null);
Expand All @@ -26,6 +27,9 @@ const Dashboard = () => {
const [userRoles, setUserRoles] = useState<string[]>([]);
const [orgSuccess, setOrgSuccess] = useState<string | null>(null);
const [openModal, setOpenModal] = useState<boolean>(false);
const [agentConfigure, setAgentConfigure]=useState<Boolean>(false);
const [isDidCreated, setIsDidCreated]=useState<Boolean>(false);


const EditOrgDetails = () => {
setOpenModal(true);
Expand All @@ -48,11 +52,14 @@ const Dashboard = () => {
const response = await getOrganizationById(orgId as string);
const { data } = response as AxiosResponse;
setLoading(false)
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
if (data?.data?.org_agents && data?.data?.org_agents?.length > 0) {
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {

if (data?.data?.org_agents?.length > 0 && data?.data?.org_agents[0]?.orgDid) {
setWalletStatus(true);
}

setOrgData(data?.data);

const organizationData = orgInfoData ? JSON.parse(orgInfoData) : {};
const {id, name, description, logoUrl} = data?.data || {};
const orgInfo = {
Expand All @@ -63,11 +70,13 @@ const Dashboard = () => {
...logoUrl && { logoUrl }
}
await setToLocalStorage(storageKeys.ORG_INFO, orgInfo);

} else {
setFailure(response as string);
}
setLoading(false);
};


const fetchOrganizationDashboard = async () => {
setLoading(true);
Expand All @@ -84,7 +93,7 @@ const Dashboard = () => {
}
}
setLoading(false);
};
};

useEffect(() => {
fetchOrganizationDetails();
Expand Down Expand Up @@ -112,6 +121,8 @@ const Dashboard = () => {
const redirectOrgUsers = () => {
window.location.href = pathRoutes.organizations.users;
};



return (
<div className="px-4 pt-2 w-full">
Expand Down Expand Up @@ -249,7 +260,8 @@ const Dashboard = () => {
</div>
) : (
walletStatus === true ? (
<OrganizationDetails orgData={orgData} />
<OrganizationDetails orgData={orgData} />

) : (
(userRoles.includes(Roles.OWNER) ||
userRoles.includes(Roles.ADMIN)) && (
Expand Down
17 changes: 11 additions & 6 deletions src/components/organization/OrganizationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import { Tooltip } from 'flowbite-react';
import DIDList from './configuration-settings/DidList';

const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => {

const { org_agents } = orgData as Organisation;
const agentData: OrgAgent | null =
org_agents.length > 0 ? org_agents[0] : null;

org_agents.length > 0 ? org_agents[0] : null;
const [loading, setLoading] = useState<boolean>(true);
const [connectionData, setConnectionData] = useState<Connection | null>(null);

Expand All @@ -43,8 +44,10 @@ const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => {
}, []);

return (
<>
<div className="mt-4 flex justify-start items-start flex-wrap p-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 sm:p-6 dark:bg-gray-800 gap-6">
<div>

<div>
<div className="mt-4 flex justify-start items-start flex-wrap p-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 sm:p-6 dark:bg-gray-800 gap-6">
<div className='flex justify-between w-full'>
<h3 className="mb-1 mt-1 text-xl font-bold text-gray-900 dark:text-white">
Web Wallet Details
Expand Down Expand Up @@ -231,8 +234,10 @@ const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => {
</div>
</div>
</div>
)}
</>
)} </div>

</div>

);
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/organization/OrganizationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ const OrganizationsList = () => {
<SearchInput onInputChange={searchInputChange} />
</div>
<RoleViewButton
disabled={currentPage.totalCount >= 10}
buttonTitle="Create"
feature={Features.CRETAE_ORG}
svgComponent={
Expand All @@ -268,7 +269,6 @@ const OrganizationsList = () => {
</div>
}
onClickEvent={createOrganizationModel}
disabled={currentPage.totalCount >= 10}
/>
</div>
<div>
Expand Down
6 changes: 6 additions & 0 deletions src/components/organization/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,19 @@ export interface IDidList {
export interface IFormikValues {
ledger: string;
method: string;
keyType:string;
network: string;
did: string;
domain: string;
privatekey: string;
endorserDid: string;
}

export interface IDedicatedAgentConfig {
walletName: string;
agentEndpoint: string;
apiKey: string;
}
interface IndySubDetails {
[key: string]: string;
}
Expand Down
Loading
Loading