mirror of
				https://github.com/caprover/caprover
				synced 2025-10-30 01:57:03 +00:00 
			
		
		
		
	Fixing regression bugs
This commit is contained in:
		| @@ -1,3 +1,4 @@ | ||||
| import ApiStatusCodes from '../../../../api/ApiStatusCodes' | ||||
| import ServiceManager from '../../../../user/ServiceManager' | ||||
| import Logger from '../../../../utils/Logger' | ||||
| import { BaseHandlerResult } from '../../../BaseHandlerResult' | ||||
| @@ -26,8 +27,9 @@ export async function uploadCaptainDefinitionContent( | ||||
|     const hasCaptainDef = !!captainDefinitionContent | ||||
|  | ||||
|     if (hasTar === hasCaptainDef) { | ||||
|         throw new Error( | ||||
|             'Either tarballfile or captainDefinitionContent should be present.' | ||||
|         throw ApiStatusCodes.createError( | ||||
|             ApiStatusCodes.ILLEGAL_OPERATION, | ||||
|             'Either uploadedTarPathSource or captainDefinitionContent should be provided, but not both.' | ||||
|         ) | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -194,7 +194,7 @@ export async function updateAppDefinition( | ||||
|     // Defaults & normalization | ||||
|     const normalizedDescription = `${description || ''}` | ||||
|     const instanceCountNum = Number(instanceCount ?? 0) | ||||
|     const containerHttpPortNum = Number(containerHttpPort ?? 80) | ||||
|     const containerHttpPortNum = Number(containerHttpPort) || 80 | ||||
|     const normalizedEnvVars = envVars || [] | ||||
|     const normalizedVolumes = volumes || [] | ||||
|     const normalizedTags = tags || [] | ||||
|   | ||||
| @@ -11,7 +11,7 @@ export const ONE_CLICK_APP_NAME_VAR_NAME = '$$cap_appname' | ||||
|  | ||||
| interface IDeploymentStep { | ||||
|     stepName: string | ||||
|     stepPromise: () => Promise<void> | ||||
|     stepPromise: () => Promise<any> | ||||
| } | ||||
|  | ||||
| export interface IDeploymentState { | ||||
|   | ||||
| @@ -39,13 +39,13 @@ class ApiManager { | ||||
|         ) | ||||
|     } | ||||
|  | ||||
|     registerProject(projectDef: ProjectDefinition): Promise<any> { | ||||
|     registerProject(projectDef: ProjectDefinition) { | ||||
|         return registerProject(projectDef, this.dataStore) | ||||
|     } | ||||
|     getAllApps(): Promise<any> { | ||||
|     getAllApps() { | ||||
|         return getAllAppDefinitions(this.dataStore, this.serviceManager) | ||||
|     } | ||||
|     updateConfigAndSave(appName: string, appDef: IAppDef): Promise<any> { | ||||
|     updateConfigAndSave(appName: string, appDef: IAppDef) { | ||||
|         return updateAppDefinition({ appName, ...appDef }, this.serviceManager) | ||||
|     } | ||||
|     uploadCaptainDefinitionContent( | ||||
| @@ -53,7 +53,7 @@ class ApiManager { | ||||
|         captainDefinition: ICaptainDefinition, | ||||
|         gitHash: string, | ||||
|         isDetachedBuild: boolean | ||||
|     ): Promise<any> { | ||||
|     ) { | ||||
|         const captainDefinitionContent = JSON.stringify(captainDefinition) | ||||
|  | ||||
|         return uploadCaptainDefinitionContentHandler( | ||||
| @@ -105,8 +105,8 @@ export default class OneClickAppDeploymentHelper { | ||||
|             // change backend to ensure this returns project ID | ||||
|             return self.apiManager | ||||
|                 .registerProject(projectDef) | ||||
|                 .then(function (data) { | ||||
|                     projectMemoryCache.projectId = data.id | ||||
|                 .then(function (result) { | ||||
|                     projectMemoryCache.projectId = result.data.id | ||||
|                 }) | ||||
|         }) | ||||
|     } | ||||
| @@ -120,8 +120,8 @@ export default class OneClickAppDeploymentHelper { | ||||
|         return Promise.resolve().then(function () { | ||||
|             return self.apiManager | ||||
|                 .getAllApps() | ||||
|                 .then(function (data) { | ||||
|                     const appDefs = data.appDefinitions as IAppDef[] | ||||
|                 .then(function (result) { | ||||
|                     const appDefs = result.data.appDefinitions as IAppDef[] | ||||
|                     for (let index = 0; index < appDefs.length; index++) { | ||||
|                         const element = appDefs[index] | ||||
|                         if (element.appName === appName) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kasra Bigdeli
					Kasra Bigdeli