chore: split changes for EE plugin transformations (#40464)
## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/14717200799> > Commit: 39c7018798f1e3a6f4b309232b9457b40b3805dd > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14717200799&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Mon, 28 Apr 2025 21:33:11 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a transformation layer for plugin UI configuration data, ensuring configurations are processed before being displayed or used. - **Tests** - Updated tests to support the new plugin configuration transformation functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
This commit is contained in:
parent
7239cdd134
commit
f83dc1cf37
|
|
@ -13,6 +13,7 @@ import com.appsmith.server.dtos.WorkspacePluginStatus;
|
|||
import com.appsmith.server.exceptions.AppsmithError;
|
||||
import com.appsmith.server.exceptions.AppsmithException;
|
||||
import com.appsmith.server.helpers.LoadShifter;
|
||||
import com.appsmith.server.plugins.solutions.PluginTransformationSolution;
|
||||
import com.appsmith.server.repositories.PluginRepository;
|
||||
import com.appsmith.server.services.AnalyticsService;
|
||||
import com.appsmith.server.services.BaseService;
|
||||
|
|
@ -71,6 +72,8 @@ public class PluginServiceCEImpl extends BaseService<PluginRepository, Plugin, S
|
|||
private final ObjectMapper objectMapper;
|
||||
private final CloudServicesConfig cloudServicesConfig;
|
||||
|
||||
private final PluginTransformationSolution pluginTransformationSolution;
|
||||
|
||||
private final Map<String, Mono<Map<?, ?>>> formCache = new HashMap<>();
|
||||
private final Map<String, Mono<Map<String, String>>> templateCache = new HashMap<>();
|
||||
private final Map<String, Mono<Map>> labelCache = new HashMap<>();
|
||||
|
|
@ -104,7 +107,8 @@ public class PluginServiceCEImpl extends BaseService<PluginRepository, Plugin, S
|
|||
ChannelTopic topic,
|
||||
ObjectMapper objectMapper,
|
||||
CloudServicesConfig cloudServicesConfig,
|
||||
ConfigService configService) {
|
||||
ConfigService configService,
|
||||
PluginTransformationSolution pluginTransformationSolution) {
|
||||
super(validator, repository, analyticsService);
|
||||
this.workspaceService = workspaceService;
|
||||
this.pluginManager = pluginManager;
|
||||
|
|
@ -113,6 +117,7 @@ public class PluginServiceCEImpl extends BaseService<PluginRepository, Plugin, S
|
|||
this.objectMapper = objectMapper;
|
||||
this.cloudServicesConfig = cloudServicesConfig;
|
||||
this.configService = configService;
|
||||
this.pluginTransformationSolution = pluginTransformationSolution;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -342,7 +347,7 @@ public class PluginServiceCEImpl extends BaseService<PluginRepository, Plugin, S
|
|||
formCache.put(pluginId, resourceMono);
|
||||
}
|
||||
|
||||
return formCache.get(pluginId);
|
||||
return formCache.get(pluginId).flatMap(input -> pluginTransformationSolution.transform(pluginId, input));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -667,7 +672,17 @@ public class PluginServiceCEImpl extends BaseService<PluginRepository, Plugin, S
|
|||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toUnmodifiableSet());
|
||||
|
||||
return repository.findAllById(pluginIds);
|
||||
return repository.findAllById(pluginIds).flatMap(plugin -> {
|
||||
if (Objects.nonNull(plugin.getActionUiConfig())) {
|
||||
return pluginTransformationSolution
|
||||
.transform(plugin.getId(), plugin.getActionUiConfig())
|
||||
.flatMap(transformedActionUiConfig -> {
|
||||
plugin.setActionUiConfig(transformedActionUiConfig);
|
||||
return Mono.just(plugin);
|
||||
});
|
||||
}
|
||||
return Mono.just(plugin);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.appsmith.server.plugins.base;
|
||||
|
||||
import com.appsmith.server.configurations.CloudServicesConfig;
|
||||
import com.appsmith.server.plugins.solutions.PluginTransformationSolution;
|
||||
import com.appsmith.server.repositories.PluginRepository;
|
||||
import com.appsmith.server.services.AnalyticsService;
|
||||
import com.appsmith.server.services.ConfigService;
|
||||
|
|
@ -27,7 +28,8 @@ public class PluginServiceImpl extends PluginServiceCEImpl implements PluginServ
|
|||
ChannelTopic topic,
|
||||
ObjectMapper objectMapper,
|
||||
CloudServicesConfig cloudServicesConfig,
|
||||
ConfigService configService) {
|
||||
ConfigService configService,
|
||||
PluginTransformationSolution pluginTransformationSolution) {
|
||||
|
||||
super(
|
||||
validator,
|
||||
|
|
@ -39,6 +41,7 @@ public class PluginServiceImpl extends PluginServiceCEImpl implements PluginServ
|
|||
topic,
|
||||
objectMapper,
|
||||
cloudServicesConfig,
|
||||
configService);
|
||||
configService,
|
||||
pluginTransformationSolution);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
package com.appsmith.server.plugins.solutions;
|
||||
|
||||
public interface PluginTransformationSolution extends PluginTransformationSolutionCE {}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.appsmith.server.plugins.solutions;
|
||||
|
||||
import lombok.NonNull;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface PluginTransformationSolutionCE {
|
||||
Mono<Map<?, ?>> transform(@NonNull String pluginId, @NonNull Map<?, ?> input);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.appsmith.server.plugins.solutions;
|
||||
|
||||
import lombok.NonNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class PluginTransformationSolutionCEImpl implements PluginTransformationSolutionCE {
|
||||
@Override
|
||||
public Mono<Map<?, ?>> transform(@NonNull String pluginId, @NonNull Map<?, ?> input) {
|
||||
return Mono.just(input);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.appsmith.server.plugins.solutions;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginTransformationSolutionImpl extends PluginTransformationSolutionCEImpl
|
||||
implements PluginTransformationSolution {}
|
||||
|
|
@ -4,6 +4,7 @@ import com.appsmith.server.configurations.CloudServicesConfig;
|
|||
import com.appsmith.server.domains.Plugin;
|
||||
import com.appsmith.server.plugins.base.PluginServiceCE;
|
||||
import com.appsmith.server.plugins.base.PluginServiceCEImpl;
|
||||
import com.appsmith.server.plugins.solutions.PluginTransformationSolution;
|
||||
import com.appsmith.server.repositories.PluginRepository;
|
||||
import com.appsmith.server.services.AnalyticsService;
|
||||
import com.appsmith.server.services.ConfigService;
|
||||
|
|
@ -55,6 +56,9 @@ public class PluginServiceCEImplTest {
|
|||
@MockBean
|
||||
ChannelTopic topic;
|
||||
|
||||
@MockBean
|
||||
PluginTransformationSolution pluginTransformationSolution;
|
||||
|
||||
ObjectMapper objectMapper;
|
||||
|
||||
PluginServiceCE pluginService;
|
||||
|
|
@ -74,7 +78,8 @@ public class PluginServiceCEImplTest {
|
|||
topic,
|
||||
objectMapper,
|
||||
cloudServicesConfig,
|
||||
configService);
|
||||
configService,
|
||||
pluginTransformationSolution);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user