fix: linked variable already being a variable

This commit is contained in:
Ruben Fiszel
2023-12-07 00:41:51 +01:00
parent 4cb7a121e6
commit 9c4f1e0333
2 changed files with 17 additions and 26 deletions
+17 -14
View File
@@ -264,20 +264,23 @@
const resourceValue = args
if (!manual || linkedSecret != undefined) {
await VariableService.createVariable({
workspace: $workspaceStore!,
requestBody: {
path,
value: manual ? args[linkedSecret ?? ''] : value,
is_secret: true,
description: emptyString(description)
? `${manual ? 'Token' : 'OAuth token'} for ${resource_type}`
: description,
is_oauth: !manual,
account: account
}
})
resourceValue[linkedSecret ?? 'token'] = `$var:${path}`
let v = manual ? args[linkedSecret ?? ''] : value
if (!v.startsWith('$var:')) {
await VariableService.createVariable({
workspace: $workspaceStore!,
requestBody: {
path,
value: v,
is_secret: true,
description: emptyString(description)
? `${manual ? 'Token' : 'OAuth token'} for ${resource_type}`
: description,
is_oauth: !manual,
account: account
}
})
resourceValue[linkedSecret ?? 'token'] = `$var:${path}`
}
}
await ResourceService.createResource({
@@ -91,18 +91,6 @@
}
}
function setDurationStatus(key: string, value: DurationStatus) {
if (!deepEqual($localDurationStatuses[key], value)) {
$localDurationStatuses[key] = value
globalDurationStatuses.forEach((s) => {
s.update((x) => {
x[key] = JSON.parse(JSON.stringify(value))
return x
})
})
}
}
function setDurationStatusByJob(key: string, id: string, value: any) {
if (!deepEqual($localDurationStatuses[key]?.byJob[id], value)) {
$localDurationStatuses[key].byJob[id] = value