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
5 changed files with 67 additions and 21 deletions
Showing only changes of commit 967eded8b1 - Show all commits

View File

@ -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);

View File

@ -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();
}
}

View File

@ -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>

View File

@ -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">