mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 00:48:25 +00:00
Delete workspace_constant when not required
This commit is contained in:
parent
a52b2ac5c9
commit
b6bc83af6c
1 changed files with 13 additions and 3 deletions
|
|
@ -280,16 +280,26 @@ export class DataSourcesUtilService implements IDataSourcesUtilService {
|
|||
const credentialValue = option['value'];
|
||||
|
||||
if (option['encrypted']) {
|
||||
const existingCredentialId =
|
||||
dataSource?.options && dataSource.options[key] && dataSource.options[key]['credential_id'];
|
||||
|
||||
if (credentialValue && (credentialValue.includes('{{constants') || credentialValue.includes('{{secrets'))) {
|
||||
if (!parsedOptions[key]) {
|
||||
parsedOptions[key] = {};
|
||||
}
|
||||
parsedOptions[key].workspace_constant = credentialValue;
|
||||
} else {
|
||||
if (
|
||||
existingCredentialId &&
|
||||
credentialValue !== undefined &&
|
||||
credentialValue !== (await this.credentialService.getValue(existingCredentialId))
|
||||
) {
|
||||
if (parsedOptions[key]) {
|
||||
delete parsedOptions[key].workspace_constant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const existingCredentialId =
|
||||
dataSource?.options && dataSource.options[key] && dataSource.options[key]['credential_id'];
|
||||
|
||||
if (existingCredentialId) {
|
||||
if (credentialValue !== undefined) {
|
||||
await this.credentialService.update(existingCredentialId, credentialValue || '');
|
||||
|
|
|
|||
Loading…
Reference in a new issue