Add method to fetch deployers while creating project
This commit is contained in:
parent
25283da940
commit
055dd52a7d
@ -597,4 +597,10 @@ export class Database {
|
||||
|
||||
return deployer;
|
||||
}
|
||||
|
||||
async getDeployers(): Promise<Deployer[]> {
|
||||
const deployerRepository = this.dataSource.getRepository(Deployer);
|
||||
const deployers = await deployerRepository.find();
|
||||
return deployers;
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,10 @@ export const createResolvers = async (service: Service): Promise<any> => {
|
||||
) => {
|
||||
return service.getAuctionData(auctionId);
|
||||
},
|
||||
|
||||
deployers: async (_: any, __: any, context: any) => {
|
||||
return service.getDeployers();
|
||||
},
|
||||
},
|
||||
|
||||
// TODO: Return error in GQL response
|
||||
|
@ -257,6 +257,7 @@ type Query {
|
||||
searchProjects(searchText: String!): [Project!]
|
||||
getAuctionData(auctionId: String!): Auction!
|
||||
domains(projectId: String!, filter: FilterDomainsInput): [Domain]
|
||||
deployers: [Deployer]
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
|
@ -443,6 +443,11 @@ export class Service {
|
||||
return dbDeployments;
|
||||
}
|
||||
|
||||
async getDeployers(): Promise<Deployer[]> {
|
||||
const dbDeployers = await this.db.getDeployers();
|
||||
return dbDeployers;
|
||||
}
|
||||
|
||||
async getEnvironmentVariablesByProjectId(
|
||||
projectId: string,
|
||||
): Promise<EnvironmentVariable[]> {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useCallback, useState, useEffect } from 'react';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { FormProvider, FieldValues } from 'react-hook-form';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { useMediaQuery } from 'usehooks-ts';
|
||||
import { AddEnvironmentVariableInput, AuctionParams } from 'gql-client';
|
||||
import { AddEnvironmentVariableInput, AuctionParams, Deployer } from 'gql-client';
|
||||
|
||||
import {
|
||||
ArrowRightCircleFilledIcon,
|
||||
@ -30,6 +30,8 @@ type ConfigureFormValues = ConfigureDeploymentFormValues &
|
||||
|
||||
const Configure = () => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [deployers, setDeployers] = useState<Deployer[]>([]);
|
||||
|
||||
const [searchParams] = useSearchParams();
|
||||
const templateId = searchParams.get('templateId');
|
||||
const queryParams = new URLSearchParams(location.search);
|
||||
@ -171,6 +173,15 @@ const Configure = () => {
|
||||
[client, createProject, dismiss, toast],
|
||||
);
|
||||
|
||||
const fetchDeployers = useCallback(async () => {
|
||||
const res = await client.getDeployers()
|
||||
setDeployers(res.deployers)
|
||||
}, [client])
|
||||
|
||||
useEffect(()=>{
|
||||
fetchDeployers()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="space-y-7 px-4 py-6">
|
||||
<div className="flex justify-between mb-6">
|
||||
|
@ -424,4 +424,12 @@ export class GQLClient {
|
||||
|
||||
return data.getAuctionData;
|
||||
}
|
||||
|
||||
async getDeployers(): Promise<types.GetDeployersResponse> {
|
||||
const { data } = await this.client.query({
|
||||
query: queries.getDeployers,
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
@ -307,3 +307,13 @@ query ($auctionId: String!) {
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const getDeployers = gql`
|
||||
query {
|
||||
deployers {
|
||||
deployerApiUrl
|
||||
deployerId
|
||||
deployerLrn
|
||||
}
|
||||
}
|
||||
`;
|
@ -233,6 +233,10 @@ export type GetDomainsResponse = {
|
||||
domains: Domain[];
|
||||
};
|
||||
|
||||
export type GetDeployersResponse = {
|
||||
deployers: Deployer[];
|
||||
};
|
||||
|
||||
export type SearchProjectsResponse = {
|
||||
searchProjects: Project[];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user