From 905aa467af1ccf2000b5ebd0efe03fbbd69063da Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 6 Jan 2025 18:58:05 +0530 Subject: [PATCH] chore: Allow context to determine path in file dir --- .../appsmith/server/helpers/ce/CommonGitFileUtilsCE.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java index 5ab89e4acf55..37bdd06a6262 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java @@ -11,6 +11,7 @@ import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.ArtifactGitReference; import com.appsmith.external.models.BaseDomain; +import com.appsmith.external.models.CreatorContextType; import com.appsmith.external.models.DatasourceStorage; import com.appsmith.external.models.PluginType; import com.appsmith.git.constants.CommonConstants; @@ -310,6 +311,10 @@ protected void setArtifactIndependentResources( setActionCollectionsInResourceMap(artifactExchangeJson, resourceMap); } + protected String getContextDirectoryByType(CreatorContextType contextType) { + return PAGE_DIRECTORY; + } + protected void setNewActionsInResourceMap( ArtifactExchangeJson artifactExchangeJson, Map resourceMap) { if (artifactExchangeJson.getActionList() == null) { @@ -325,7 +330,7 @@ protected void setNewActionsInResourceMap( removeUnwantedFieldFromAction(newAction); ActionDTO action = newAction.getUnpublishedAction(); final String actionFileName = action.getValidName().replace(".", "-"); - final String filePathPrefix = PAGE_DIRECTORY + final String filePathPrefix = getContextDirectoryByType(action.getContextType()) + DELIMITER_PATH + action.calculateContextId() + DELIMITER_PATH @@ -383,7 +388,7 @@ protected void setActionCollectionsInResourceMap( .forEach(actionCollection -> { removeUnwantedFieldFromActionCollection(actionCollection); ActionCollectionDTO collection = actionCollection.getUnpublishedCollection(); - final String filePathPrefix = PAGE_DIRECTORY + final String filePathPrefix = getContextDirectoryByType(collection.getContextType()) + DELIMITER_PATH + collection.calculateContextId() + DELIMITER_PATH