Display deployer LRNs in dropdown
This commit is contained in:
parent
055dd52a7d
commit
967eded8b1
@ -283,6 +283,7 @@ export class Registry {
|
||||
this.registryConfig.privateKey,
|
||||
fee
|
||||
);
|
||||
|
||||
log(`Application deployment request record published: ${result.id}`);
|
||||
log('Application deployment request data:', applicationDeploymentRequest);
|
||||
|
||||
|
@ -443,11 +443,6 @@ export class Service {
|
||||
return dbDeployments;
|
||||
}
|
||||
|
||||
async getDeployers(): Promise<Deployer[]> {
|
||||
const dbDeployers = await this.db.getDeployers();
|
||||
return dbDeployers;
|
||||
}
|
||||
|
||||
async getEnvironmentVariablesByProjectId(
|
||||
projectId: string,
|
||||
): Promise<EnvironmentVariable[]> {
|
||||
@ -1374,4 +1369,38 @@ export class Service {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async getDeployers(): Promise<Deployer[]> {
|
||||
const dbDeployers = await this.db.getDeployers();
|
||||
|
||||
if (dbDeployers.length > 0) {
|
||||
this.updateDeployersFromRegistry();
|
||||
return dbDeployers;
|
||||
} else {
|
||||
return await this.updateDeployersFromRegistry();
|
||||
}
|
||||
}
|
||||
|
||||
async updateDeployersFromRegistry(): Promise<Deployer[]> {
|
||||
const deployerRecords = await this.laconicRegistry.getDeployerRecordsByFilter({});
|
||||
|
||||
for (const record of deployerRecords) {
|
||||
const deployerId = record.id;
|
||||
const deployerLrn = record.names[0];
|
||||
|
||||
const deployerApiUrl = record.attributes.apiUrl;
|
||||
const baseDomain = deployerApiUrl.substring(deployerApiUrl.indexOf('.') + 1);
|
||||
|
||||
const deployerData = {
|
||||
deployerId,
|
||||
deployerLrn,
|
||||
deployerApiUrl,
|
||||
baseDomain
|
||||
};
|
||||
|
||||
await this.db.addDeployer(deployerData);
|
||||
}
|
||||
|
||||
return await this.db.getDeployers();
|
||||
}
|
||||
}
|
||||
|
@ -155,19 +155,19 @@ const Configure = () => {
|
||||
if (templateId) {
|
||||
createFormData.option === 'Auction'
|
||||
? navigate(
|
||||
`/${orgSlug}/projects/create/success/${projectId}?isAuction=true`,
|
||||
)
|
||||
`/${orgSlug}/projects/create/success/${projectId}?isAuction=true`,
|
||||
)
|
||||
: navigate(
|
||||
`/${orgSlug}/projects/create/template/deploy?projectId=${projectId}&templateId=${templateId}`,
|
||||
);
|
||||
`/${orgSlug}/projects/create/template/deploy?projectId=${projectId}&templateId=${templateId}`,
|
||||
);
|
||||
} else {
|
||||
createFormData.option === 'Auction'
|
||||
? navigate(
|
||||
`/${orgSlug}/projects/create/success/${projectId}?isAuction=true`,
|
||||
)
|
||||
`/${orgSlug}/projects/create/success/${projectId}?isAuction=true`,
|
||||
)
|
||||
: navigate(
|
||||
`/${orgSlug}/projects/create/deploy?projectId=${projectId}`,
|
||||
);
|
||||
`/${orgSlug}/projects/create/deploy?projectId=${projectId}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
[client, createProject, dismiss, toast],
|
||||
@ -176,9 +176,9 @@ const Configure = () => {
|
||||
const fetchDeployers = useCallback(async () => {
|
||||
const res = await client.getDeployers()
|
||||
setDeployers(res.deployers)
|
||||
}, [client])
|
||||
}, [client])
|
||||
|
||||
useEffect(()=>{
|
||||
useEffect(() => {
|
||||
fetchDeployers()
|
||||
}, [])
|
||||
|
||||
@ -236,15 +236,25 @@ const Configure = () => {
|
||||
>
|
||||
The app will be deployed by the configured deployer
|
||||
</Heading>
|
||||
<span className="text-sm text-elements-high-em">
|
||||
Enter LRN for deployer
|
||||
</span>
|
||||
<Controller
|
||||
name="lrn"
|
||||
control={methods.control}
|
||||
rules={{ required: true }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Input value={value} onChange={onChange} />
|
||||
<Select
|
||||
label="Select deployer LRN"
|
||||
value={{
|
||||
value: value || '',
|
||||
label: value || ''
|
||||
} as SelectOption}
|
||||
onChange={(selectedOption) =>
|
||||
onChange((selectedOption as SelectOption).value)
|
||||
}
|
||||
options={deployers.map(deployer => ({
|
||||
value: deployer.deployerLrn,
|
||||
label: deployer.deployerLrn
|
||||
}))}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
@ -102,7 +102,7 @@ export const AuctionCard = ({ project }: { project: Project }) => {
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{deployers?.length > 0 && (
|
||||
{deployers?.length > 0 ? (
|
||||
<div className="mt-3">
|
||||
<span className="text-elements-high-em text-sm font-medium tracking-tight">
|
||||
Deployer LRNs
|
||||
@ -113,6 +113,12 @@ export const AuctionCard = ({ project }: { project: Project }) => {
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="mt-3">
|
||||
<span className="text-elements-high-em text-sm font-medium tracking-tight">
|
||||
No winning deployers
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex justify-between items-center mt-1">
|
||||
|
Loading…
Reference in New Issue
Block a user