Delete workspace_constant when not required

This commit is contained in:
parthy007 2025-07-07 17:01:54 +05:30
parent a52b2ac5c9
commit b6bc83af6c

View file

@ -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 || '');