Integrate SP auctions for app deployment #2

Merged
nabarun merged 42 commits from ng-integrate-auction into main 2024-10-18 12:37:01 +00:00
6 changed files with 31 additions and 47 deletions
Showing only changes of commit 24dccd421a - Show all commits

View File

@ -322,8 +322,6 @@ export class Service {
); );
for (const project of projectsToBedeployed) { for (const project of projectsToBedeployed) {
log(`Auction ${project!.auctionId} completed`);
const deployerLrns = await this.laconicRegistry.getAuctionWinningDeployers(project!.auctionId!); const deployerLrns = await this.laconicRegistry.getAuctionWinningDeployers(project!.auctionId!);
if (!deployerLrns) { if (!deployerLrns) {

View File

@ -1,6 +1,6 @@
import { useCallback, useState } from 'react'; import { useCallback, useState } from 'react';
import { useForm, Controller, SubmitHandler } from 'react-hook-form'; import { useForm, Controller, SubmitHandler } from 'react-hook-form';
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'; import { useNavigate, useSearchParams } from 'react-router-dom';
import { useMediaQuery } from 'usehooks-ts'; import { useMediaQuery } from 'usehooks-ts';
import { AuctionParams } from 'gql-client'; import { AuctionParams } from 'gql-client';
@ -25,8 +25,16 @@ type ConfigureFormValues = {
const Configure = () => { const Configure = () => {
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
const templateId = searchParams.get('templateId'); const templateId = searchParams.get('templateId');
const location = useLocation(); const queryParams = new URLSearchParams(location.search);
const { templateOwner, templateRepo, owner, name, isPrivate, orgSlug, repository } = location.state || {};
const owner = queryParams.get('owner');
const name = queryParams.get('name');
const defaultBranch = queryParams.get('defaultBranch');
const fullName = queryParams.get('fullName');
const orgSlug = queryParams.get('orgSlug');
const templateOwner = queryParams.get('templateOwner');
const templateRepo = queryParams.get('templateRepo');
const isPrivate = queryParams.get('isPrivate') === 'true';
const navigate = useNavigate(); const navigate = useNavigate();
const { toast, dismiss } = useToast(); const { toast, dismiss } = useToast();
@ -70,7 +78,7 @@ const Configure = () => {
}; };
const { addProjectFromTemplate } = await client.addProjectFromTemplate( const { addProjectFromTemplate } = await client.addProjectFromTemplate(
orgSlug, orgSlug!,
projectData, projectData,
lrn, lrn,
auctionParams auctionParams
@ -78,19 +86,18 @@ const Configure = () => {
data.option === 'Auction' data.option === 'Auction'
? navigate( ? navigate(
`/${orgSlug}/projects/create/success/${addProjectFromTemplate.id}`, `/${orgSlug}/projects/create/success/${addProjectFromTemplate.id}?isAuction=true`,
{ state: { isAuction: true } }
) )
: navigate( : navigate(
`/${orgSlug}/projects/create/template/deploy?projectId=${addProjectFromTemplate.id}&templateId=${templateId}` `/${orgSlug}/projects/create/template/deploy?projectId=${addProjectFromTemplate.id}&templateId=${templateId}`
); );
} else { } else {
const { addProject } = await client.addProject( const { addProject } = await client.addProject(
orgSlug, orgSlug!,
{ {
name: repository.fullName, name: fullName!,
prodBranch: repository.defaultBranch, prodBranch: defaultBranch!,
repository: repository.fullName, repository: fullName!,
template: 'webapp', template: 'webapp',
}, },
lrn, lrn,
@ -99,8 +106,7 @@ const Configure = () => {
data.option === 'Auction' data.option === 'Auction'
? navigate( ? navigate(
`/${orgSlug}/projects/create/success/${addProject.id}`, `/${orgSlug}/projects/create/success/${addProject.id}?isAuction=true`
{ state: { isAuction: true } }
) )
: navigate( : navigate(
`/${orgSlug}/projects/create/deploy?projectId=${addProject.id}` `/${orgSlug}/projects/create/deploy?projectId=${addProject.id}`

View File

@ -38,18 +38,8 @@ export const ProjectRepoCard: React.FC<ProjectRepoCardProps> = ({
}); });
} }
navigate(`configure`, navigate(
{ `configure?owner=${repository.owner?.login}&name=${repository.name}&defaultBranch=${repository.default_branch}&fullName=${repository.full_name}&orgSlug=${orgSlug}`
state: {
repository: {
owner: repository.owner?.login,
name: repository.name,
defaultBranch: repository.default_branch,
fullName: repository.full_name,
},
orgSlug,
},
}
); );
}, [client, repository, orgSlug, setIsLoading, navigate, toast]); }, [client, repository, orgSlug, setIsLoading, navigate, toast]);

View File

@ -1,4 +1,4 @@
import { Link, useLocation, useParams } from 'react-router-dom'; import { Link, useParams, useSearchParams } from 'react-router-dom';
import Lottie from 'lottie-react'; import Lottie from 'lottie-react';
import { Badge } from 'components/shared/Badge'; import { Badge } from 'components/shared/Badge';
@ -18,8 +18,8 @@ const Id = () => {
const { id, orgSlug } = useParams(); const { id, orgSlug } = useParams();
const client = useGQLClient(); const client = useGQLClient();
const [project, setProject] = useState<Project | null>(null); const [project, setProject] = useState<Project | null>(null);
const location = useLocation(); const [searchParams] = useSearchParams();
const { isAuction } = location.state || {}; const isAuction = searchParams.get('isAuction') === 'true';
const handleSetupDomain = async () => { const handleSetupDomain = async () => {
if (id) { if (id) {

View File

@ -54,17 +54,7 @@ const CreateRepo = () => {
setIsLoading(true); setIsLoading(true);
navigate( navigate(
`configure?templateId=${template.id}`, `configure?templateId=${template.id}&templateOwner=${owner}&templateRepo=${repo}&owner=${data.account}&name=${data.repoName}&isPrivate=false&orgSlug=${orgSlug}`
{
state: {
templateOwner: owner,
templateRepo: repo,
owner: data.account,
name: data.repoName,
isPrivate: false,
orgSlug
},
}
); );
} catch (err) { } catch (err) {
setIsLoading(false); setIsLoading(false);

View File

@ -57,7 +57,7 @@ export const addProjectFromTemplate = gql`
`; `;
export const addProject = gql` export const addProject = gql`
mutation ($organizationSlug: String!, $data: AddProjectInput!, $lrn: String, $auctionParams: Auctionparams) { mutation ($organizationSlug: String!, $data: AddProjectInput!, $lrn: String, $auctionParams: AuctionParams) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionParams: $auctionParams) { addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionParams: $auctionParams) {
id id
} }