Skip to content

Commit

Permalink
fix: update service with correct description
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanya-atatakai committed Dec 27, 2024
1 parent 48df788 commit 7234fdd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
16 changes: 9 additions & 7 deletions frontend/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,17 @@ export type ChainData = {
};
};

export type EnvVariableAttributes = {
name: string;
description: string;
value: string;
provision_type: EnvProvisionType;
};

export type MiddlewareServiceResponse = {
service_config_id: string; // TODO: update with uuid once middleware integrated
name: string;
description: string;
hash: string;
hash_history: {
[block: string]: string;
Expand All @@ -61,13 +69,7 @@ export type MiddlewareServiceResponse = {
chain_data: ChainData;
};
};
};

export type EnvVariableAttributes = {
name: string;
description: string;
value: string;
provision_type: EnvProvisionType;
env_variables: { [key: string]: EnvVariableAttributes };
};

export type ServiceTemplate = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const useServiceDeployment = () => {
let middlewareServiceResponse;
if (!service) {
try {
return ServicesService.createService({
middlewareServiceResponse = await ServicesService.createService({
stakingProgramId: selectedStakingProgramId,
serviceTemplate,
deploy: false, // TODO: deprecated will remove
Expand Down Expand Up @@ -256,6 +256,19 @@ const useServiceDeployment = () => {
}
}

// Temporary: update the service if it has the default description
if (service && service.description === 'Memeooorr @twitter_handle') {
const xUsername = service.env_variables?.TWIKIT_USERNAME?.value;
if (xUsername) {
await ServicesService.updateService({
serviceConfigId: service.service_config_id,
partialServiceTemplate: {
description: `Memeooorr @${xUsername}`,
},
});
}
}

// Start the service
try {
const serviceToStart = service ?? middlewareServiceResponse;
Expand Down

0 comments on commit 7234fdd

Please sign in to comment.