diff --git a/frontend/client/types.ts b/frontend/client/types.ts index ccfd2c36..f8efb1f0 100644 --- a/frontend/client/types.ts +++ b/frontend/client/types.ts @@ -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; @@ -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 = { diff --git a/frontend/components/MainPage/header/AgentButton/AgentNotRunningButton.tsx b/frontend/components/MainPage/header/AgentButton/AgentNotRunningButton.tsx index 3d347bc3..85d12ec2 100644 --- a/frontend/components/MainPage/header/AgentButton/AgentNotRunningButton.tsx +++ b/frontend/components/MainPage/header/AgentButton/AgentNotRunningButton.tsx @@ -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 @@ -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;