updated API to use array

This commit is contained in:
Kasra Bigdeli
2025-09-06 19:32:14 -07:00
parent e098ba900b
commit 9caba312a1
2 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
export interface OneClickAppValuePair {
key: string
value: string
}

View File

@@ -4,6 +4,7 @@ import {
IDockerComposeService,
IOneClickTemplate,
} from '../../models/IOneClickAppModels'
import { OneClickAppValuePair } from '../../models/OneClickApp'
import Utils from '../../utils/Utils'
import ServiceManager from '../ServiceManager'
import OneClickAppDeploymentHelper from './OneClickAppDeploymentHelper'
@@ -47,11 +48,28 @@ export default class OneClickAppDeployManager {
startDeployProcess(
template: IOneClickTemplate,
values: IHashMapGeneric<string>
valuesArray: OneClickAppValuePair[]
) {
const self = this
let stringified = JSON.stringify(template)
const values: IHashMapGeneric<string> = {}
valuesArray.forEach(element => {
values[element.key] = element.value
})
if (
!values[ONE_CLICK_APP_NAME_VAR_NAME] ||
values[ONE_CLICK_APP_NAME_VAR_NAME].trim().length === 0
) {
this.onDeploymentStateChanged({
steps: ['Parsing the template'],
error: `App name ($$cap_appname) is required.`,
currentStep: 0,
})
return
}
for (
let index = 0;
index < template.caproverOneClickApp.variables.length;