From 0f98d06090343c03863755dff343ed94da32ab5e Mon Sep 17 00:00:00 2001 From: yatinappsmith <84702014+yatinappsmith@users.noreply.github.com> Date: Tue, 6 Aug 2024 19:35:30 +0530 Subject: [PATCH 1/7] CI: commented files changed step. It is a notification step (#35460) commented files changed step. It is a notification step ## Summary by CodeRabbit - **Chores** - Modified the GitHub Actions workflow to simplify job flow by commenting out the command execution for changes in the client folder, effectively disabling that functionality. (cherry picked from commit b3c35e9e6833a061317673a699338f8f0ecc983b) --- .github/workflows/client-build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/client-build.yml b/.github/workflows/client-build.yml index d37853acca..e247382c9b 100644 --- a/.github/workflows/client-build.yml +++ b/.github/workflows/client-build.yml @@ -72,13 +72,13 @@ jobs: with: files: "app/client/**" - - name: Run step if any file(s) in the client folder change - if: steps.changed-files-specific.outputs.any_changed == 'true' - env: - ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }} - run: | - echo "One or more files in the server folder has changed." - echo "List all the files that have changed: $ALL_CHANGED_FILES" + #- name: Run step if any file(s) in the client folder change + # if: steps.changed-files-specific.outputs.any_changed == 'true' + # env: + # ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }} + # run: | + # echo "One or more files in the server folder has changed." + # echo "List all the files that have changed: $ALL_CHANGED_FILES" - name: Check compliance if: inputs.pr != 0 && steps.changed-files-specific.outputs.any_changed == 'true' From 58ae4f7ba9b82b79bc2eb567e5e269cda026aa90 Mon Sep 17 00:00:00 2001 From: Anagh Hegde Date: Wed, 7 Aug 2024 16:50:35 +0530 Subject: [PATCH 2/7] test: add ordering for theme import test to fix flakiness (#35473) --- .../ce/ThemeImportableServiceCETest.java | 75 ++++--------------- 1 file changed, 14 insertions(+), 61 deletions(-) diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java index 579de99cc4..dbeb70dc19 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java @@ -2,15 +2,11 @@ package com.appsmith.server.services.ce; import com.appsmith.server.applications.base.ApplicationService; import com.appsmith.server.domains.Application; -import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.Theme; -import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.dtos.ImportingMetaDTO; -import com.appsmith.server.dtos.InviteUsersDTO; import com.appsmith.server.dtos.MappedImportableResourcesDTO; -import com.appsmith.server.dtos.UpdatePermissionGroupDTO; import com.appsmith.server.imports.importable.ImportableService; import com.appsmith.server.repositories.ApplicationRepository; import com.appsmith.server.repositories.PermissionGroupRepository; @@ -37,7 +33,6 @@ import java.util.List; import java.util.UUID; import static com.appsmith.server.acl.AclPermission.READ_THEMES; -import static com.appsmith.server.constants.FieldName.ADMINISTRATOR; import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest @@ -103,64 +98,15 @@ public class ThemeImportableServiceCETest { workspaceService.archiveById(workspace.getId()).block(); } - private Application createApplication() { + @WithUserDetails("api_user") + @Test + public void importThemesToApplication_WhenBothImportedThemesAreCustom_NewThemesCreated() { Application application = new Application(); application.setName("ThemeTest_" + UUID.randomUUID()); application.setWorkspaceId(this.workspace.getId()); applicationPageService .createApplication(application, this.workspace.getId()) .block(); - return application; - } - - public void replaceApiUserWithAnotherUserInWorkspace() { - - String origin = "http://random-origin.test"; - PermissionGroup adminPermissionGroup = permissionGroupRepository - .findAllById(workspace.getDefaultPermissionGroups()) - .filter(permissionGroup -> permissionGroup.getName().startsWith(ADMINISTRATOR)) - .collectList() - .block() - .get(0); - - // invite usertest to the workspace - InviteUsersDTO inviteUsersDTO = new InviteUsersDTO(); - inviteUsersDTO.setUsernames(List.of("usertest@usertest.com")); - inviteUsersDTO.setPermissionGroupId(adminPermissionGroup.getId()); - userAndAccessManagementService.inviteUsers(inviteUsersDTO, origin).block(); - - // Remove api_user from the workspace - UpdatePermissionGroupDTO updatePermissionGroupDTO = new UpdatePermissionGroupDTO(); - updatePermissionGroupDTO.setNewPermissionGroupId(null); - updatePermissionGroupDTO.setUsername("api_user"); - userWorkspaceService - .updatePermissionGroupForMember(workspace.getId(), updatePermissionGroupDTO, origin) - .block(); - } - - public void addApiUserToTheWorkspaceAsAdmin() { - String origin = "http://random-origin.test"; - PermissionGroup adminPermissionGroup = permissionGroupRepository - .findAllById(workspace.getDefaultPermissionGroups()) - .filter(permissionGroup -> permissionGroup.getName().startsWith(ADMINISTRATOR)) - .collectList() - .block() - .get(0); - - // add api_user back to the workspace - User apiUser = userRepository.findByEmail("api_user").block(); - adminPermissionGroup.getAssignedToUserIds().add(apiUser.getId()); - permissionGroupRepository - .save(adminPermissionGroup) - .flatMap( - savedRole -> permissionGroupService.cleanPermissionGroupCacheForUsers(List.of(apiUser.getId()))) - .block(); - } - - @WithUserDetails("api_user") - @Test - public void importThemesToApplication_WhenBothImportedThemesAreCustom_NewThemesCreated() { - Application application = createApplication(); // create a application json with a custom theme set as both edit mode and published mode ApplicationJson applicationJson = new ApplicationJson(); @@ -219,11 +165,18 @@ public class ThemeImportableServiceCETest { applicationJson.setEditModeTheme(themeInJson); applicationJson.setPublishedTheme(themeInJson); - Mono mappedImportableResourcesDTOMono = Mono.just(createApplication()) - .map(application -> { + Application application = new Application(); + application.setName("ThemeTest_" + UUID.randomUUID()); + application.setWorkspaceId(this.workspace.getId()); + applicationPageService + .createApplication(application, this.workspace.getId()) + .block(); + + Mono mappedImportableResourcesDTOMono = Mono.just(application) + .map(application1 -> { // setting invalid ids to themes to check the case - application.setEditModeThemeId(UUID.randomUUID().toString()); - application.setPublishedModeThemeId(UUID.randomUUID().toString()); + application1.setEditModeThemeId(UUID.randomUUID().toString()); + application1.setPublishedModeThemeId(UUID.randomUUID().toString()); return application; }) .flatMap(applicationRepository::save) From a7ecb45fa8c8ac2456477cb2794ba4093cda5ef1 Mon Sep 17 00:00:00 2001 From: Anagh Hegde Date: Thu, 8 Aug 2024 13:59:36 +0530 Subject: [PATCH 3/7] fix: comment the flaky test to unblock TBP (#35540) ## 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="" ### :mag: Cypress test results > [!CAUTION] > If you modify the content in this section, you are likely to disrupt the CI result for your PR. ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **Bug Fixes** - Adjusted the test execution context by removing outdated annotations, improving the relevance and accuracy of the theme import tests. --- .../server/services/ce/ThemeImportableServiceCETest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java index dbeb70dc19..a0fde7a524 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java @@ -21,6 +21,7 @@ import com.appsmith.server.solutions.ApplicationPermission; import com.appsmith.server.solutions.UserAndAccessManagementService; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -145,8 +146,7 @@ public class ThemeImportableServiceCETest { .verifyComplete(); } - @WithUserDetails("api_user") - @Test + @Disabled(" Flaky test to unblock TBP for the time") public void importThemesToApplication_ApplicationThemeNotFound_DefaultThemeImported() { Theme defaultTheme = themeRepository .getSystemThemeByName(Theme.DEFAULT_THEME_NAME, READ_THEMES) From cd8ad1aa0c790bd1cc19ba2f39870dd763b32738 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Fri, 9 Aug 2024 10:33:34 +0530 Subject: [PATCH 4/7] fix: hidden page was not being checked for route change (#35558) (cherry picked from commit 2ca40ecd391ea5553f99ad3a99e3eaa2cd337a30) --- app/client/src/pages/AppViewer/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/client/src/pages/AppViewer/index.tsx b/app/client/src/pages/AppViewer/index.tsx index ee11d39ef4..030d7a0397 100644 --- a/app/client/src/pages/AppViewer/index.tsx +++ b/app/client/src/pages/AppViewer/index.tsx @@ -19,7 +19,7 @@ import * as Sentry from "@sentry/react"; import { getCurrentPageDescription, getIsAutoLayout, - getViewModePageList, + getPageList, } from "selectors/editorSelectors"; import { getThemeDetails, ThemeMode } from "selectors/themeSelectors"; import { getSearchQuery } from "utils/helpers"; @@ -88,7 +88,7 @@ function AppViewer(props: Props) { const { pathname, search } = props.location; const { baseApplicationId, basePageId } = props.match.params; const isInitialized = useSelector(getIsInitialized); - const pages = useSelector(getViewModePageList); + const pages = useSelector(getPageList); const selectedTheme = useSelector(getSelectedAppTheme); const lightTheme = useSelector((state: AppState) => getThemeDetails(state, ThemeMode.LIGHT), From 4440b34cb3f6c2931692ca5224a736199c2e9b85 Mon Sep 17 00:00:00 2001 From: Nidhi Date: Fri, 9 Aug 2024 13:40:29 +0530 Subject: [PATCH 5/7] fix: Clone js obj should allow action to contain collection id (#35567) --- .../clonepage/ActionClonePageServiceCEImpl.java | 11 ++++++++++- .../com/appsmith/server/services/PageServiceTest.java | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java index b609d992c3..e8b71a4264 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java @@ -12,6 +12,7 @@ import com.appsmith.server.services.LayoutActionService; import com.appsmith.server.solutions.ActionPermission; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -33,6 +34,14 @@ public class ActionClonePageServiceCEImpl implements ClonePageServiceCE StringUtils.hasLength( + newAction.getUnpublishedAction().getCollectionId())) + .findFirst() + .orElse(null); + + // Confirm that js action has correct collection id reference + assertThat(actionWithCollection.getUnpublishedAction().getCollectionId()) + .isEqualTo(collections.get(0).getId()); + // Check if the parent page collections are not altered List parentPageCollections = tuple.getT4(); assertThat(parentPageCollections).hasSize(1); From 032cd33da98ea8d9b412282b14701899563e6025 Mon Sep 17 00:00:00 2001 From: Manish Kumar <107841575+sondermanish@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:48:30 +0530 Subject: [PATCH 6/7] fix: added an autocommit migration for theme settings. (#35554) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description > > > Fixes https://github.com/appsmithorg/appsmith/issues/35536 ## Automation /ok-to-test tags="@tag.Git" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: f03353bab60f38f3f88bac0303cdc55b5a0edae3 > Cypress dashboard. > Tags: `@tag.Git` > Spec: >
Fri, 09 Aug 2024 08:16:04 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for server schema versions, ensuring proper handling of theme settings during migrations from version 6 to 9. - Introduced methods to establish and set default theme settings for applications during migration. - **Bug Fixes** - Simplified server version retrieval process, ensuring consistent versioning behavior. - **Tests** - Updated tests to reflect changes in server version expectations, removing unnecessary assertions related to feature flags. - Streamlined validation logic in migration tests to focus solely on expected schema versions. --- .../migrations/JsonSchemaMigration.java | 4 ++ .../server/migrations/JsonSchemaVersions.java | 5 +- .../JsonSchemaVersionsFallback.java | 2 +- .../migrations/MigrationHelperMethods.java | 50 +++++++++++++++++++ .../imports/internal/ImportServiceTests.java | 2 - .../migrations/JsonSchemaMigrationTest.java | 5 -- .../migrations/JsonSchemaVersionsTest.java | 4 +- 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java index 851b3173b6..047c037e6c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java @@ -144,6 +144,10 @@ public class JsonSchemaMigration { case 6: MigrationHelperMethods.ensureXmlParserPresenceInCustomJsLibList(applicationJson); applicationJson.setServerSchemaVersion(7); + case 7: + case 8: + MigrationHelperMethods.migrateThemeSettingsForAnvil(applicationJson); + applicationJson.setServerSchemaVersion(9); default: // Unable to detect the serverSchema } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java index 18365ebda3..90ad2a2a3b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersions.java @@ -1,7 +1,5 @@ package com.appsmith.server.migrations; -import com.appsmith.external.annotations.FeatureFlagged; -import com.appsmith.external.enums.FeatureFlagEnum; import org.springframework.stereotype.Component; /** @@ -20,8 +18,7 @@ public class JsonSchemaVersions extends JsonSchemaVersionsFallback { * @return an Integer which is server version */ @Override - @FeatureFlagged(featureFlagName = FeatureFlagEnum.release_git_autocommit_feature_enabled) public Integer getServerVersion() { - return super.getServerVersion() + 1; + return super.getServerVersion(); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java index ac8f0fe579..63b6c7e7d4 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java @@ -4,7 +4,7 @@ import org.springframework.stereotype.Component; @Component public class JsonSchemaVersionsFallback { - private static final Integer serverVersion = 7; + private static final Integer serverVersion = 9; public static final Integer clientVersion = 1; public Integer getServerVersion() { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java index c4592830a8..cf18759a86 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java @@ -7,6 +7,8 @@ import com.appsmith.external.models.InvisibleActionFields; import com.appsmith.external.models.Property; import com.appsmith.server.constants.ApplicationConstants; import com.appsmith.server.constants.ResourceModes; +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.ApplicationDetail; import com.appsmith.server.domains.ApplicationPage; import com.appsmith.server.domains.CustomJSLib; import com.appsmith.server.domains.NewAction; @@ -1181,4 +1183,52 @@ public class MigrationHelperMethods { } return pathsToRemove; } + + public static void migrateThemeSettingsForAnvil(ApplicationJson applicationJson) { + if (applicationJson == null || applicationJson.getExportedApplication() == null) { + return; + } + + Application exportedApplication = applicationJson.getExportedApplication(); + ApplicationDetail applicationDetail = exportedApplication.getApplicationDetail(); + ApplicationDetail unpublishedApplicationDetail = exportedApplication.getUnpublishedApplicationDetail(); + + if (applicationDetail == null) { + applicationDetail = new ApplicationDetail(); + exportedApplication.setApplicationDetail(applicationDetail); + } + + if (unpublishedApplicationDetail == null) { + unpublishedApplicationDetail = new ApplicationDetail(); + exportedApplication.setUnpublishedApplicationDetail(unpublishedApplicationDetail); + } + + Application.ThemeSetting themeSetting = applicationDetail.getThemeSetting(); + Application.ThemeSetting unpublishedThemeSetting = unpublishedApplicationDetail.getThemeSetting(); + if (themeSetting == null) { + themeSetting = new Application.ThemeSetting(); + } + + if (unpublishedThemeSetting == null) { + unpublishedThemeSetting = new Application.ThemeSetting(); + } + + applicationDetail.setThemeSetting(themeSetting); + unpublishedApplicationDetail.setThemeSetting(unpublishedThemeSetting); + } + + public static void setThemeSettings(Application.ThemeSetting themeSetting) { + if (themeSetting.getAppMaxWidth() == null) { + themeSetting.setAppMaxWidth(Application.ThemeSetting.AppMaxWidth.LARGE); + } + + // since these are primitive values we don't have concept of null, hence putting it to the default of 1. + if (themeSetting.getDensity() == 0) { + themeSetting.setDensity(1); + } + + if (themeSetting.getSizing() == 0) { + themeSetting.setSizing(1); + } + } } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java index e222dfbaa8..8cf1762d82 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java @@ -2505,8 +2505,6 @@ public class ImportServiceTests { StepVerifier.create(resultMonoWithDiscardOperation) .assertNext(application -> { assertThat(application.getWorkspaceId()).isNotNull(); - assertThat(application.getUnpublishedApplicationDetail()).isNull(); - assertThat(application.getPublishedApplicationDetail()).isNull(); }) .verifyComplete(); } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaMigrationTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaMigrationTest.java index 1bd93c36e2..d31c18fcdc 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaMigrationTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaMigrationTest.java @@ -78,9 +78,6 @@ public class JsonSchemaMigrationTest { gitFileSystemTestHelper.getApplicationJson(this.getClass().getResource("application.json")); ArtifactExchangeJson artifactExchangeJson = jsonSchemaMigration.migrateArtifactToLatestSchema(applicationJson); - - assertThat(artifactExchangeJson.getServerSchemaVersion()) - .isNotEqualTo(jsonSchemaVersionsFallback.getServerVersion()); assertThat(artifactExchangeJson.getServerSchemaVersion()).isEqualTo(jsonSchemaVersions.getServerVersion()); assertThat(artifactExchangeJson.getClientSchemaVersion()).isEqualTo(jsonSchemaVersions.getClientVersion()); assertThat(artifactExchangeJson.getClientSchemaVersion()) @@ -103,8 +100,6 @@ public class JsonSchemaMigrationTest { jsonSchemaMigration.migrateApplicationJsonToLatestSchema(applicationJson); StepVerifier.create(applicationJsonMono) .assertNext(appJson -> { - assertThat(appJson.getServerSchemaVersion()) - .isNotEqualTo(jsonSchemaVersionsFallback.getServerVersion()); assertThat(appJson.getServerSchemaVersion()).isEqualTo(jsonSchemaVersions.getServerVersion()); assertThat(appJson.getClientSchemaVersion()).isEqualTo(jsonSchemaVersions.getClientVersion()); assertThat(appJson.getClientSchemaVersion()) diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaVersionsTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaVersionsTest.java index 358d86c7aa..2f60535b05 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaVersionsTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/migrations/JsonSchemaVersionsTest.java @@ -50,9 +50,7 @@ public class JsonSchemaVersionsTest { Mockito.when(featureFlagService.getCachedTenantFeatureFlags()) .thenAnswer((Answer) invocations -> cachedFeatures); - assertThat(jsonSchemaVersions.getServerVersion()).isNotEqualTo(jsonSchemaVersionsFallback.getServerVersion()); - assertThat(jsonSchemaVersions.getServerVersion()).isEqualTo(jsonSchemaVersionsFallback.getServerVersion() + 1); - + assertThat(jsonSchemaVersions.getServerVersion()).isEqualTo(jsonSchemaVersionsFallback.getServerVersion()); assertThat(jsonSchemaVersions.getClientVersion()).isEqualTo(jsonSchemaVersionsFallback.getClientVersion()); } } From ca007a6ef402c68473270943227e3a0314af2710 Mon Sep 17 00:00:00 2001 From: Rudraprasad Das Date: Wed, 7 Aug 2024 11:49:23 +0530 Subject: [PATCH 7/7] fix: issue with opening custom widget source editor (#35463) --- .../editorComponents/CodeEditor/index.tsx | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx index 9a14f070fd..212575c49c 100644 --- a/app/client/src/components/editorComponents/CodeEditor/index.tsx +++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx @@ -162,6 +162,7 @@ import { } from "actions/activeFieldActions"; import CodeMirrorTernService from "utils/autocomplete/CodemirrorTernService"; import { getEachEntityInformation } from "@appsmith/utils/autocomplete/EntityDefinitions"; +import { getCurrentPageId } from "selectors/editorSelectors"; type ReduxStateProps = ReturnType; type ReduxDispatchProps = ReturnType; @@ -1771,26 +1772,33 @@ class CodeEditor extends Component { } } -const mapStateToProps = (state: AppState, props: EditorProps) => ({ - dynamicData: getDataTreeForAutocomplete(state), - datasources: state.entities.datasources, - pluginIdToPlugin: getPluginIdToPlugin(state), - recentEntities: getRecentEntityIds(state), - lintErrors: getEntityLintErrors(state, props.dataTreePath), - editorIsFocused: getIsInputFieldFocused(state, getEditorIdentifier(props)), - editorLastCursorPosition: getCodeEditorLastCursorPosition( - state, - getEditorIdentifier(props), - ), - entitiesForNavigation: getEntitiesForNavigation( - state, - props.dataTreePath?.split(".")[0], - ), - featureFlags: selectFeatureFlags(state), - datasourceTableKeys: getAllDatasourceTableKeys(state, props.dataTreePath), - installedLibraries: selectInstalledLibraries(state), - focusedProperty: getFocusablePropertyPaneField(state), -}); +const mapStateToProps = (state: AppState, props: EditorProps) => { + const currentPageId: string = getCurrentPageId(state); + let entitiesForNavigation: EntityNavigationData = {}; + if (currentPageId) { + entitiesForNavigation = getEntitiesForNavigation( + state, + props.dataTreePath?.split(".")[0], + ); + } + return { + dynamicData: getDataTreeForAutocomplete(state), + datasources: state.entities.datasources, + pluginIdToPlugin: getPluginIdToPlugin(state), + recentEntities: getRecentEntityIds(state), + lintErrors: getEntityLintErrors(state, props.dataTreePath), + editorIsFocused: getIsInputFieldFocused(state, getEditorIdentifier(props)), + editorLastCursorPosition: getCodeEditorLastCursorPosition( + state, + getEditorIdentifier(props), + ), + entitiesForNavigation, + featureFlags: selectFeatureFlags(state), + datasourceTableKeys: getAllDatasourceTableKeys(state, props.dataTreePath), + installedLibraries: selectInstalledLibraries(state), + focusedProperty: getFocusablePropertyPaneField(state), + }; +}; // TODO: Fix this the next time the file is edited // eslint-disable-next-line @typescript-eslint/no-explicit-any