List deployer LRNs in deployment configuration step #11

Merged
nabarun merged 9 commits from iv-deployer-dropdown into main 2024-10-23 15:36:20 +00:00
8 changed files with 51 additions and 2 deletions
Showing only changes of commit 055dd52a7d - Show all commits

View File

@ -597,4 +597,10 @@ export class Database {
return deployer; return deployer;
} }
async getDeployers(): Promise<Deployer[]> {
const deployerRepository = this.dataSource.getRepository(Deployer);
const deployers = await deployerRepository.find();
return deployers;
}
} }

View File

@ -76,6 +76,10 @@ export const createResolvers = async (service: Service): Promise<any> => {
) => { ) => {
return service.getAuctionData(auctionId); return service.getAuctionData(auctionId);
}, },
deployers: async (_: any, __: any, context: any) => {
return service.getDeployers();
},
}, },
// TODO: Return error in GQL response // TODO: Return error in GQL response

View File

@ -257,6 +257,7 @@ type Query {
searchProjects(searchText: String!): [Project!] searchProjects(searchText: String!): [Project!]
getAuctionData(auctionId: String!): Auction! getAuctionData(auctionId: String!): Auction!
domains(projectId: String!, filter: FilterDomainsInput): [Domain] domains(projectId: String!, filter: FilterDomainsInput): [Domain]
deployers: [Deployer]
} }
type Mutation { type Mutation {

View File

@ -443,6 +443,11 @@ export class Service {
return dbDeployments; return dbDeployments;
} }
async getDeployers(): Promise<Deployer[]> {
const dbDeployers = await this.db.getDeployers();
return dbDeployers;
}
async getEnvironmentVariablesByProjectId( async getEnvironmentVariablesByProjectId(
projectId: string, projectId: string,
): Promise<EnvironmentVariable[]> { ): Promise<EnvironmentVariable[]> {

View File

@ -1,9 +1,9 @@
import { useCallback, useState } from 'react'; import { useCallback, useState, useEffect } from 'react';
import { useForm, Controller } from 'react-hook-form'; import { useForm, Controller } from 'react-hook-form';
import { FormProvider, FieldValues } from 'react-hook-form'; import { FormProvider, FieldValues } from 'react-hook-form';
import { useNavigate, useSearchParams } from 'react-router-dom'; import { useNavigate, useSearchParams } from 'react-router-dom';
import { useMediaQuery } from 'usehooks-ts'; import { useMediaQuery } from 'usehooks-ts';
import { AddEnvironmentVariableInput, AuctionParams } from 'gql-client'; import { AddEnvironmentVariableInput, AuctionParams, Deployer } from 'gql-client';
import { import {
ArrowRightCircleFilledIcon, ArrowRightCircleFilledIcon,
@ -30,6 +30,8 @@ type ConfigureFormValues = ConfigureDeploymentFormValues &
const Configure = () => { const Configure = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [deployers, setDeployers] = useState<Deployer[]>([]);
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
const templateId = searchParams.get('templateId'); const templateId = searchParams.get('templateId');
const queryParams = new URLSearchParams(location.search); const queryParams = new URLSearchParams(location.search);
@ -171,6 +173,15 @@ const Configure = () => {
[client, createProject, dismiss, toast], [client, createProject, dismiss, toast],
); );
const fetchDeployers = useCallback(async () => {
const res = await client.getDeployers()
setDeployers(res.deployers)
}, [client])
useEffect(()=>{
fetchDeployers()
}, [])
return ( return (
<div className="space-y-7 px-4 py-6"> <div className="space-y-7 px-4 py-6">
<div className="flex justify-between mb-6"> <div className="flex justify-between mb-6">

View File

@ -424,4 +424,12 @@ export class GQLClient {
return data.getAuctionData; return data.getAuctionData;
} }
async getDeployers(): Promise<types.GetDeployersResponse> {
const { data } = await this.client.query({
query: queries.getDeployers,
});
return data;
}
} }

View File

@ -307,3 +307,13 @@ query ($auctionId: String!) {
} }
} }
`; `;
export const getDeployers = gql`
query {
deployers {
deployerApiUrl
deployerId
deployerLrn
}
}
`;

View File

@ -233,6 +233,10 @@ export type GetDomainsResponse = {
domains: Domain[]; domains: Domain[];
}; };
export type GetDeployersResponse = {
deployers: Deployer[];
};
export type SearchProjectsResponse = { export type SearchProjectsResponse = {
searchProjects: Project[]; searchProjects: Project[];
}; };