hash
stringlengths 40
40
| date
stringdate 2020-04-14 18:04:14
2025-03-25 16:48:49
| author
stringclasses 154
values | commit_message
stringlengths 15
172
| is_merge
bool 1
class | masked_commit_message
stringlengths 11
165
| type
stringclasses 7
values | git_diff
stringlengths 32
8.56M
|
|---|---|---|---|---|---|---|---|
24c5357f9df848b4920ca864f600580943ec0b5e
|
2021-02-16 15:56:09
|
Ashok Kumar M
|
fix: Shrink Entity explorer by 20% (#3005)
| false
|
Shrink Entity explorer by 20% (#3005)
|
fix
|
diff --git a/app/client/src/constants/DefaultTheme.tsx b/app/client/src/constants/DefaultTheme.tsx
index bb8a7fb72310..1ef8baa17171 100644
--- a/app/client/src/constants/DefaultTheme.tsx
+++ b/app/client/src/constants/DefaultTheme.tsx
@@ -1847,7 +1847,7 @@ export const theme: Theme = {
color: Colors.MYSTIC,
},
],
- sidebarWidth: "320px",
+ sidebarWidth: "250px",
homePage: {
header: 52,
leftPane: {
|
9079fa7bc494be11fb9ce9b66e413c15fd4de215
|
2023-01-12 18:07:19
|
balajisoundar
|
chore: send static anonymous id for anonymous users in usage pulse call (#19752)
| false
|
send static anonymous id for anonymous users in usage pulse call (#19752)
|
chore
|
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ApplicationURL_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ApplicationURL_spec.js
index d0b794c69ca9..1259aa6a1dcf 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ApplicationURL_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ApplicationURL_spec.js
@@ -154,7 +154,7 @@ describe("Slug URLs", () => {
cy.url().then((url) => {
cy.LogOut();
cy.visit(url + "?embed=true&a=b");
- cy.wait(6000);
+ //cy.wait(6000);
cy.location().should((loc) => {
expect(loc.search).to.eq(
`?redirectUrl=${encodeURIComponent(url + "?embed=true&a=b")}`,
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ForkApplication_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ForkApplication_spec.js
index 36665b61e570..f3cf2aeac93a 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ForkApplication_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ForkApplication_spec.js
@@ -83,9 +83,9 @@ describe("Fork application across workspaces", function() {
cy.get(homePage.signOutIcon).click();
cy.visit(forkableAppUrl);
- cy.reload();
- cy.visit(forkableAppUrl);
- cy.wait(5000);
+ //cy.reload();
+ //cy.visit(forkableAppUrl);
+ cy.wait(4000);
cy.get(applicationLocators.forkButton)
.first()
.click({ force: true });
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Workspace/ShareAppTests_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Workspace/ShareAppTests_spec.js
index 4603e9be5013..5ca7fb31a004 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Workspace/ShareAppTests_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Workspace/ShareAppTests_spec.js
@@ -153,7 +153,7 @@ describe("Create new workspace and share with a user", function() {
"response.body.responseMeta.status",
404,
);
- cy.wait(3000);
+ cy.wait(2000);
cy.contains("Sign in to your account").should("be.visible");
});
diff --git a/app/client/src/ce/sagas/userSagas.tsx b/app/client/src/ce/sagas/userSagas.tsx
index ed27e49c5889..d1e88dd31c37 100644
--- a/app/client/src/ce/sagas/userSagas.tsx
+++ b/app/client/src/ce/sagas/userSagas.tsx
@@ -55,10 +55,7 @@ import {
getFirstTimeUserOnboardingApplicationId,
getFirstTimeUserOnboardingIntroModalVisibility,
} from "utils/storage";
-import {
- initializeAnalyticsAndTrackers,
- initializeSegmentWithoutTracking,
-} from "utils/AppsmithUtils";
+import { initializeAnalyticsAndTrackers } from "utils/AppsmithUtils";
import { getAppsmithConfigs } from "ce/configs";
import { getSegmentState } from "selectors/analyticsSelectors";
import {
@@ -161,7 +158,8 @@ export function* getCurrentUserSaga() {
* We're initializing the segment api regardless of the enableTelemetry flag
* So we can use segement Id to fingerprint anonymous user in usage pulse call
*/
- yield initializeSegmentWithoutTracking();
+ //NOTE: commenting for now to fix a flaky cypress issue
+ // yield initializeSegmentWithoutTracking();
}
//To make sure that we're not tracking from previous session.
@@ -176,7 +174,7 @@ export function* getCurrentUserSaga() {
//@ts-expect-error: response is of type unknown
enableTelemetry && AnalyticsUtil.identifyUser(response.data);
} else {
- UsagePulse.userAnonymousId = AnalyticsUtil.getAnonymousId();
+ UsagePulse.userAnonymousId = "anonymousId";
if (!enableTelemetry) {
AnalyticsUtil.removeAnalytics();
|
72eb2cd4cb5f2a2acb40e21d4923116a1949b4ab
|
2024-11-19 12:05:10
|
Ankita Kinger
|
chore: Updating generate page interaction to show it in a modal following the IDE 2.0 interaction pattern (#37414)
| false
|
Updating generate page interaction to show it in a modal following the IDE 2.0 interaction pattern (#37414)
|
chore
|
diff --git a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts
index e174cd171cfa..e19bc35a8463 100644
--- a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts
+++ b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts
@@ -47,6 +47,7 @@ describe(
dataSources._dropdownOption,
"worldCountryInfo",
);
+ agHelper.GetNClick(dataSources._generatePageBtn);
GenerateCRUDNValidateDeployPage("ABW", "Aruba", "North America", "Code");
@@ -93,6 +94,7 @@ describe(
assertHelper.AssertNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.GetNClick(dataSources._selectTableDropdown, 0, true);
agHelper.GetNClickByContains(dataSources._dropdownOption, "customers");
+ agHelper.GetNClick(dataSources._generatePageBtn);
GenerateCRUDNValidateDeployPage(
"103",
@@ -110,6 +112,7 @@ describe(
it("3. Generate CRUD page from datasource present in ACTIVE section", function () {
EditorNavigation.SelectEntityByName(dsName, EntityType.Datasource);
dataSources.SelectTableFromPreviewSchemaList("employees");
+ agHelper.GetNClick(dataSources._datasourceCardGeneratePageBtn);
GenerateCRUDNValidateDeployPage(
"1002",
@@ -311,9 +314,6 @@ describe(
col3Text: string,
jsonFromHeader: string,
) {
- agHelper.GetNClick(
- `${dataSources._generatePageBtn}, ${dataSources._datasourceCardGeneratePageBtn}`,
- );
assertHelper.AssertNetworkStatus("@replaceLayoutWithCRUDPage", 201);
agHelper.AssertContains("Successfully generated a page");
//assertHelper.AssertNetworkStatus("@getActions", 200);//Since failing sometimes
diff --git a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts
index ce5773313e82..7cc2f30a82c7 100644
--- a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts
+++ b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts
@@ -399,9 +399,7 @@ describe(
col3Text: string,
jsonFromHeader: string,
) {
- agHelper.GetNClick(
- `${dataSources._generatePageBtn}, ${dataSources._datasourceCardGeneratePageBtn}`,
- );
+ agHelper.GetNClick(dataSources._datasourceCardGeneratePageBtn);
assertHelper.AssertNetworkStatus("@replaceLayoutWithCRUDPage", 201);
agHelper.AssertContains("Successfully generated a page");
//assertHelper.AssertNetworkStatus("@getActions", 200);//Since failing sometimes
diff --git a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts
index 8177679f27db..292e4289d05e 100644
--- a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts
+++ b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts
@@ -38,6 +38,7 @@ describe(
assertHelper.AssertNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.GetNClick(dataSources._selectTableDropdown, 0, true);
agHelper.GetNClickByContains(dataSources._dropdownOption, "film");
+ agHelper.GetNClick(dataSources._generatePageBtn);
GenerateCRUDNValidateDeployPage(
"ACADEMY DINOSAUR",
@@ -86,6 +87,7 @@ describe(
assertHelper.AssertNetworkStatus("@getDatasourceStructure"); //Making sure table dropdown is populated
agHelper.GetNClick(dataSources._selectTableDropdown, 0, true);
agHelper.GetNClickByContains(dataSources._dropdownOption, "suppliers");
+ agHelper.GetNClick(dataSources._generatePageBtn);
GenerateCRUDNValidateDeployPage(
"Exotic Liquids",
@@ -104,6 +106,7 @@ describe(
it("3. Generate CRUD page from datasource present in ACTIVE section", function () {
EditorNavigation.SelectEntityByName(dsName, EntityType.Datasource);
dataSources.SelectTableFromPreviewSchemaList("public.orders");
+ agHelper.GetNClick(dataSources._datasourceCardGeneratePageBtn);
GenerateCRUDNValidateDeployPage(
"VINET",
@@ -135,9 +138,6 @@ describe(
col3Text: string,
jsonFromHeader: string,
) {
- agHelper.GetNClick(
- `${dataSources._generatePageBtn}, ${dataSources._datasourceCardGeneratePageBtn}`,
- );
assertHelper.AssertNetworkStatus("@replaceLayoutWithCRUDPage", 201);
agHelper.AssertContains("Successfully generated a page");
//assertHelper.AssertNetworkStatus("@getActions", 200);//Since failing sometimes
diff --git a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js
index cb1be5c1cd5b..97a620c1060c 100644
--- a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js
+++ b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js
@@ -52,7 +52,7 @@ describe(
200,
);
- agHelper.AssertContains("Generate from data");
+ agHelper.AssertContains("Generate a page based on your data");
agHelper.GetNClick(generatePage.selectTableDropdown);
agHelper.GetNClickByContains(
generatePage.dropdownOption,
diff --git a/app/client/src/ce/RouteBuilder.ts b/app/client/src/ce/RouteBuilder.ts
index b8df54bcd135..d61b619d4c45 100644
--- a/app/client/src/ce/RouteBuilder.ts
+++ b/app/client/src/ce/RouteBuilder.ts
@@ -1,8 +1,6 @@
import {
ADD_PATH,
ADMIN_SETTINGS_PATH,
- GEN_TEMPLATE_FORM_ROUTE,
- GEN_TEMPLATE_URL,
getViewerCustomPath,
getViewerPath,
TEMPLATES_PATH,
@@ -122,12 +120,6 @@ export const saasEditorApiIdURL = (
}`,
});
-export const generateTemplateFormURL = (props: URLBuilderParams): string =>
- urlBuilder.build({
- ...props,
- suffix: `${GEN_TEMPLATE_URL}${GEN_TEMPLATE_FORM_ROUTE}`,
- });
-
export const onboardingCheckListUrl = (props: URLBuilderParams): string =>
urlBuilder.build({
...props,
diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx
index a4ef8ae1d025..0ecaa63d846e 100644
--- a/app/client/src/ce/constants/ReduxActionConstants.tsx
+++ b/app/client/src/ce/constants/ReduxActionConstants.tsx
@@ -1070,6 +1070,17 @@ const CurlImportActionErrorTypes = {
SUBMIT_CURL_FORM_ERROR: "SUBMIT_CURL_FORM_ERROR",
};
+const GeneratePageActionTypes = {
+ SET_GENERATE_PAGE_MODAL_OPEN: "SET_GENERATE_PAGE_MODAL_OPEN",
+ SET_GENERATE_PAGE_MODAL_CLOSE: "SET_GENERATE_PAGE_MODAL_CLOSE",
+ SUBMIT_GENERATE_PAGE_FORM_INIT: "SUBMIT_GENERATE_PAGE_FORM_INIT",
+ SUBMIT_GENERATE_PAGE_FORM_SUCCESS: "SUBMIT_GENERATE_PAGE_FORM_SUCCESS",
+};
+
+const GeneratePageActionErrorTypes = {
+ SUBMIT_GENERATE_PAGE_FORM_ERROR: "SUBMIT_GENERATE_PAGE_FORM_ERROR",
+};
+
const BatchUpdateActionTypes = {
BATCHED_UPDATE: "BATCHED_UPDATE",
EXECUTE_BATCH: "EXECUTE_BATCH",
@@ -1276,12 +1287,13 @@ export const ReduxActionTypes = {
...AppSettingsActionTypes,
...BatchUpdateActionTypes,
...BuildingBlocksActionTypes,
- ...DatasourceEditorActionTypes,
...CurlImportActionTypes,
+ ...DatasourceEditorActionTypes,
...ErrorManagementActionTypes,
...ExplorerActionTypes,
...EvaluationActionTypes,
...FeatureFlagActionTypes,
+ ...GeneratePageActionTypes,
...GitActionTypes,
...HelpActionTypes,
...IDEActionTypes,
@@ -1324,6 +1336,7 @@ export const ReduxActionErrorTypes = {
...DatasourceEditorActionErrorTypes,
...EvaluationActionErrorTypes,
...FeatureFlagActionErrorTypes,
+ ...GeneratePageActionErrorTypes,
...GitActionErrorTypes,
...IDEActionErrorTypes,
...ImportExportActionErrorTypes,
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index b5a102028ede..f525c40f0d38 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -752,7 +752,10 @@ export const BUILD_FROM_SCRATCH_ACTION_TITLE = () => "Build with drag & drop";
export const GENERATE_PAGE_ACTION_TITLE = () => "Generate page with data";
-export const GENERATE_PAGE_FORM_TITLE = () => "Generate from data";
+export const GENERATE_PAGE_FORM_TITLE = () =>
+ "Generate a page based on your data";
+export const GENERATE_PAGE_FORM_SUB_TITLE = () =>
+ "Use your datasource's schema to generate a simple CRUD page.";
export const GEN_CRUD_SUCCESS_MESSAGE = () =>
"Hurray! Your application is ready for use.";
diff --git a/app/client/src/ce/constants/routes/appRoutes.ts b/app/client/src/ce/constants/routes/appRoutes.ts
index 8031209435be..f4b2465b6f2d 100644
--- a/app/client/src/ce/constants/routes/appRoutes.ts
+++ b/app/client/src/ce/constants/routes/appRoutes.ts
@@ -70,10 +70,6 @@ export const APP_LIBRARIES_EDITOR_PATH = `/libraries`;
export const APP_PACKAGES_EDITOR_PATH = `/packages`;
export const APP_SETTINGS_EDITOR_PATH = `/settings`;
export const SAAS_GSHEET_EDITOR_ID_PATH = `/saas/google-sheets-plugin/datasources/:datasourceId`;
-export const GEN_TEMPLATE_URL = "generate-page";
-export const GENERATE_TEMPLATE_PATH = `/${GEN_TEMPLATE_URL}`;
-export const GEN_TEMPLATE_FORM_ROUTE = "/form";
-export const GENERATE_TEMPLATE_FORM_PATH = `${GENERATE_TEMPLATE_PATH}${GEN_TEMPLATE_FORM_ROUTE}`;
export const BUILDER_CHECKLIST_PATH = `/checklist`;
export const ADMIN_SETTINGS_PATH = "/settings";
export const ADMIN_SETTINGS_CATEGORY_DEFAULT_PATH = "/settings/general";
@@ -124,10 +120,6 @@ export const matchViewerForkPath = (pathName: string) =>
match(`${VIEWER_PATH}${VIEWER_FORK_PATH}`)(pathName) ||
match(`${VIEWER_CUSTOM_PATH}${VIEWER_FORK_PATH}`)(pathName) ||
match(`${VIEWER_PATH_DEPRECATED}${VIEWER_FORK_PATH}`)(pathName);
-export const matchGeneratePagePath = (pathName: string) =>
- match(`${BUILDER_PATH}${GENERATE_TEMPLATE_FORM_PATH}`)(pathName) ||
- match(`${BUILDER_CUSTOM_PATH}${GENERATE_TEMPLATE_FORM_PATH}`)(pathName) ||
- match(`${BUILDER_PATH_DEPRECATED}${GENERATE_TEMPLATE_FORM_PATH}`)(pathName);
export const matchAppLibrariesPath = (pathName: string) =>
match(`${BUILDER_PATH}${APP_LIBRARIES_EDITOR_PATH}`)(pathName);
diff --git a/app/client/src/ce/hooks/datasourceEditorHooks.tsx b/app/client/src/ce/hooks/datasourceEditorHooks.tsx
index d0e9fdc54813..5dde79d1f35d 100644
--- a/app/client/src/ce/hooks/datasourceEditorHooks.tsx
+++ b/app/client/src/ce/hooks/datasourceEditorHooks.tsx
@@ -1,4 +1,3 @@
-import { generateTemplateFormURL } from "ee/RouteBuilder";
import {
GENERATE_NEW_PAGE_BUTTON_TEXT,
createMessage,
@@ -18,7 +17,7 @@ import type { ApiDatasourceForm } from "entities/Datasource/RestAPIForm";
import NewActionButton from "pages/Editor/DataSourceEditor/NewActionButton";
import { useShowPageGenerationOnHeader } from "pages/Editor/DataSourceEditor/hooks";
import React from "react";
-import { useSelector } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
import {
getCurrentApplicationId,
getCurrentBasePageId,
@@ -26,10 +25,10 @@ import {
} from "selectors/editorSelectors";
import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors";
import { isEnabledForPreviewData } from "utils/editorContextUtils";
-import history from "utils/history";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { EditorNames } from "./";
import { getCurrentApplication } from "ee/selectors/applicationSelectors";
+import { openGeneratePageModal } from "pages/Editor/GeneratePage/store/generatePageActions";
export interface HeaderActionProps {
datasource: Datasource | ApiDatasourceForm | undefined;
@@ -47,7 +46,7 @@ export const useHeaderActions = (
showReconnectButton = false,
}: HeaderActionProps,
) => {
- const basePageId = useSelector(getCurrentBasePageId);
+ const dispatch = useDispatch();
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const releaseDragDropBuildingBlocks = useFeatureFlag(
FEATURE_FLAG.release_drag_drop_building_blocks_enabled,
@@ -97,13 +96,10 @@ export const useHeaderActions = (
}
AnalyticsUtil.logEvent("DATASOURCE_CARD_GEN_CRUD_PAGE_ACTION");
- history.push(
- generateTemplateFormURL({
- basePageId,
- params: {
- datasourceId: (datasource as Datasource).id,
- new_page: true,
- },
+ dispatch(
+ openGeneratePageModal({
+ datasourceId: (datasource as Datasource).id,
+ new_page: true,
}),
);
};
diff --git a/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx b/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx
index d0fdc4ecda05..cac3ae6f84a8 100644
--- a/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx
+++ b/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx
@@ -12,7 +12,6 @@ import {
BUILDER_PATH_DEPRECATED,
DATA_SOURCES_EDITOR_ID_PATH,
DATA_SOURCES_EDITOR_LIST_PATH,
- GENERATE_TEMPLATE_FORM_PATH,
INTEGRATION_EDITOR_PATH,
JS_COLLECTION_EDITOR_PATH,
JS_COLLECTION_ID_PATH,
@@ -33,7 +32,6 @@ import {
import DatasourceForm from "pages/Editor/SaaSEditor/DatasourceForm";
import DataSourceEditor from "pages/Editor/DataSourceEditor";
import DatasourceBlankState from "pages/Editor/DataSourceEditor/DatasourceBlankState";
-import GeneratePage from "pages/Editor/GeneratePage";
import type { RouteProps } from "react-router";
import { useSelector } from "react-redux";
import { combinedPreviewModeSelector } from "selectors/editorSelectors";
@@ -139,12 +137,6 @@ function useRoutes(path: string): RouteReturnType[] {
exact: true,
path: `${path}${SAAS_EDITOR_DATASOURCE_ID_PATH}`,
},
- {
- key: "GeneratePage",
- component: isPreviewMode ? WidgetsEditor : GeneratePage,
- exact: true,
- path: `${path}${GENERATE_TEMPLATE_FORM_PATH}`,
- },
];
}
diff --git a/app/client/src/components/editorComponents/GlobalSearch/utils.tsx b/app/client/src/components/editorComponents/GlobalSearch/utils.tsx
index f32a6c644075..4413d68053e6 100644
--- a/app/client/src/components/editorComponents/GlobalSearch/utils.tsx
+++ b/app/client/src/components/editorComponents/GlobalSearch/utils.tsx
@@ -28,7 +28,7 @@ import {
createNewAPIBasedOnParentEntity,
createNewJSCollectionBasedOnParentEntity,
} from "ee/actions/helpers";
-import { openCurlImportModal } from "pages/Editor/CurlImport/helpers";
+import { openCurlImportModal } from "pages/Editor/CurlImport/store/curlImportActions";
export type SelectEvent =
| React.MouseEvent
diff --git a/app/client/src/pages/Editor/CurlImport/ModalControls.tsx b/app/client/src/pages/Editor/CurlImport/ModalControls.tsx
index df0e15ed55b3..79ff227c6818 100644
--- a/app/client/src/pages/Editor/CurlImport/ModalControls.tsx
+++ b/app/client/src/pages/Editor/CurlImport/ModalControls.tsx
@@ -6,7 +6,10 @@ import {
} from "selectors/curlImportSelectors";
import { submit } from "redux-form";
import { CURL_IMPORT_FORM } from "ee/constants/forms";
-import { closeCurlImportModal, openCurlImportModal } from "./helpers";
+import {
+ closeCurlImportModal,
+ openCurlImportModal,
+} from "./store/curlImportActions";
import CurlLogo from "assets/images/Curl-logo.svg";
import { createMessage, IMPORT_BTN_LABEL } from "ee/constants/messages";
import {
diff --git a/app/client/src/pages/Editor/CurlImport/helpers.ts b/app/client/src/pages/Editor/CurlImport/helpers.ts
index 70d08206ecec..59e135cd1c71 100644
--- a/app/client/src/pages/Editor/CurlImport/helpers.ts
+++ b/app/client/src/pages/Editor/CurlImport/helpers.ts
@@ -1,6 +1,5 @@
import { submitCurlImportForm } from "../../../actions/importActions";
import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers";
-import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
export interface CurlImportFormValues {
curl: string;
@@ -17,15 +16,3 @@ export const curlImportSubmitHandler = (
) => {
dispatch(submitCurlImportForm(values));
};
-
-export const openCurlImportModal = () => {
- return {
- type: ReduxActionTypes.SET_CURL_MODAL_OPEN,
- };
-};
-
-export const closeCurlImportModal = () => {
- return {
- type: ReduxActionTypes.SET_CURL_MODAL_CLOSE,
- };
-};
diff --git a/app/client/src/pages/Editor/CurlImport/store/curlImportActions.ts b/app/client/src/pages/Editor/CurlImport/store/curlImportActions.ts
new file mode 100644
index 000000000000..16e971b680e2
--- /dev/null
+++ b/app/client/src/pages/Editor/CurlImport/store/curlImportActions.ts
@@ -0,0 +1,21 @@
+import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers";
+import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
+
+export interface CurlImportFormValues {
+ curl: string;
+ contextId: string;
+ name: string;
+ contextType: ActionParentEntityTypeInterface;
+}
+
+export const openCurlImportModal = () => {
+ return {
+ type: ReduxActionTypes.SET_CURL_MODAL_OPEN,
+ };
+};
+
+export const closeCurlImportModal = () => {
+ return {
+ type: ReduxActionTypes.SET_CURL_MODAL_CLOSE,
+ };
+};
diff --git a/app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx b/app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx
index 478693bb169d..f98787ab40b0 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx
@@ -52,7 +52,6 @@ const FieldWrapper = styled.div`
export const ViewModeWrapper = styled.div`
display: flex;
flex-direction: column;
- border-bottom: 1px solid var(--ads-v2-color-border);
padding: var(--ads-v2-spaces-7) 0;
gap: var(--ads-v2-spaces-4);
overflow: auto;
diff --git a/app/client/src/pages/Editor/Explorer/Pages/AddPageContextMenu.tsx b/app/client/src/pages/Editor/Explorer/Pages/AddPageContextMenu.tsx
index d80513b94a52..e1501da44948 100644
--- a/app/client/src/pages/Editor/Explorer/Pages/AddPageContextMenu.tsx
+++ b/app/client/src/pages/Editor/Explorer/Pages/AddPageContextMenu.tsx
@@ -2,8 +2,6 @@ import React, { useMemo, useState } from "react";
import { AddButtonWrapper, EntityClassNames } from "../Entity";
import EntityAddButton from "../Entity/AddButton";
import styled from "styled-components";
-import history from "utils/history";
-import { generateTemplateFormURL } from "ee/RouteBuilder";
import { useParams } from "react-router";
import { useDispatch } from "react-redux";
import type { ExplorerURLParams } from "ee/pages/Editor/Explorer/helpers";
@@ -32,6 +30,7 @@ import {
LayoutSystemFeatures,
useLayoutSystemFeatures,
} from "layoutSystems/common/useLayoutSystemFeatures";
+import { openGeneratePageModal } from "pages/Editor/GeneratePage/store/generatePageActions";
const Wrapper = styled.div`
.title {
@@ -85,7 +84,7 @@ function AddPageContextMenu({
items.push({
title: createMessage(GENERATE_PAGE_ACTION_TITLE),
icon: "database-2-line",
- onClick: () => history.push(generateTemplateFormURL({ basePageId })),
+ onClick: () => dispatch(openGeneratePageModal()),
"data-testid": "generate-page",
key: "GENERATE_PAGE",
});
diff --git a/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GeneratePageForm.tsx b/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GeneratePageForm.tsx
index 84178b81ac4e..ef53e385e747 100644
--- a/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GeneratePageForm.tsx
+++ b/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GeneratePageForm.tsx
@@ -11,23 +11,25 @@ import {
} from "ee/selectors/entitiesSelector";
import type { Datasource } from "entities/Datasource";
-import { fetchDatasourceStructure } from "actions/datasourceActions";
+import {
+ fetchDatasourceStructure,
+ setDatasourceViewModeFlag,
+} from "actions/datasourceActions";
import { generateTemplateToUpdatePage } from "actions/pageActions";
-import { useLocation } from "react-router";
import { INTEGRATION_TABS } from "constants/routes";
import history from "utils/history";
-import { getQueryParams } from "utils/URLUtils";
-import { getIsGeneratingTemplatePage } from "selectors/pageListSelectors";
+import {
+ getGeneratePageModalParams,
+ getIsGeneratingTemplatePage,
+} from "selectors/pageListSelectors";
import DataSourceOption, {
CONNECT_NEW_DATASOURCE_OPTION_ID,
DatasourceImage,
} from "../DataSourceOption";
-import { getQueryStringfromObject } from "ee/entities/URLRedirect/URLAssembly";
import type { DropdownOption } from "@appsmith/ads-old";
import { Button, Icon, Text, Select, Option, Tooltip } from "@appsmith/ads";
import GoogleSheetForm from "./GoogleSheetForm";
import {
- GENERATE_PAGE_FORM_TITLE,
createMessage,
GEN_CRUD_DATASOURCE_DROPDOWN_LABEL,
} from "ee/constants/messages";
@@ -70,6 +72,7 @@ import equal from "fast-deep-equal";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { getHasCreateDatasourcePermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
+import { closeGeneratePageModal } from "../../store/generatePageActions";
// ---------- Styles ----------
@@ -77,24 +80,11 @@ const TooltipWrapper = styled.div`
margin-left: 6px;
`;
-const Wrapper = styled.div`
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- border: none;
-`;
-
const FormWrapper = styled.div`
display: flex;
flex-direction: column;
`;
-const DescWrapper = styled.div`
- flex: 1;
- display: flex;
- flex-direction: column;
-`;
-
const Row = styled.p`
display: flex;
flex-direction: row;
@@ -218,7 +208,7 @@ const DatasourceOptionSelectedView = (props: any) => {
function GeneratePageForm() {
const dispatch = useDispatch();
- const querySearch = useLocation().search;
+ const params = useSelector(getGeneratePageModalParams);
const basePageId = useSelector(getCurrentBasePageId);
const pageId = useSelector(getCurrentPageId);
@@ -539,10 +529,9 @@ function GeneratePageForm() {
]);
useEffect(() => {
- if (querySearch) {
- const queryParams = getQueryParams();
- const datasourceId = queryParams.datasourceId;
- const generateNewPage = queryParams.new_page;
+ if (params?.datasourceId || params?.new_page) {
+ const datasourceId = params.datasourceId;
+ const generateNewPage = params.new_page;
if (datasourceId) {
if (generateNewPage || numberOfEntities > 0) {
@@ -552,15 +541,9 @@ function GeneratePageForm() {
}
setDatasourceIdToBeSelected(datasourceId);
- delete queryParams.datasourceId;
- delete queryParams.new_page;
- const redirectURL =
- window.location.pathname + getQueryStringfromObject(queryParams);
-
- history.replace(redirectURL);
}
}
- }, [numberOfEntities, querySearch, setDatasourceIdToBeSelected]);
+ }, [numberOfEntities, params, setDatasourceIdToBeSelected]);
const routeToCreateNewDatasource = () => {
AnalyticsUtil.logEvent("GEN_CRUD_PAGE_CREATE_NEW_DATASOURCE");
@@ -577,6 +560,7 @@ function GeneratePageForm() {
AnalyticsUtil.logEvent("NAVIGATE_TO_CREATE_NEW_DATASOURCE_PAGE", {
entryPoint,
});
+ dispatch(closeGeneratePageModal());
};
const generatePageAction = (data: GeneratePagePayload) => {
@@ -602,6 +586,7 @@ function GeneratePageForm() {
AnalyticsUtil.logEvent("GEN_CRUD_PAGE_FORM_SUBMIT");
dispatch(generateTemplateToUpdatePage(payload));
+ dispatch(closeGeneratePageModal());
};
const handleFormSubmit = () => {
@@ -625,6 +610,8 @@ function GeneratePageForm() {
});
history.push(redirectURL);
+ dispatch(setDatasourceViewModeFlag(false));
+ dispatch(closeGeneratePageModal());
};
// if the datasource has basic information to connect to db it is considered as a valid structure hence isValid true.
@@ -682,250 +669,247 @@ function GeneratePageForm() {
!selectedTable.value || !showSubmitButton || isSelectedTableEmpty;
return (
- <div>
- <Wrapper>
- <DescWrapper>
- <Text kind="heading-m">{GENERATE_PAGE_FORM_TITLE()}</Text>
- </DescWrapper>
- </Wrapper>
- <FormWrapper>
+ <FormWrapper>
+ <SelectWrapper width={DROPDOWN_DIMENSION.WIDTH}>
+ <Label>{createMessage(GEN_CRUD_DATASOURCE_DROPDOWN_LABEL)}</Label>
+ <Select
+ data-testid="t--datasource-dropdown"
+ getPopupContainer={(triggerNode) => triggerNode.parentNode.parentNode}
+ onChange={(value) => {
+ if (value === CONNECT_NEW_DATASOURCE_OPTION_ID) {
+ routeToCreateNewDatasource();
+ } else {
+ onSelectDataSource(
+ value,
+ dataSourceOptions.find((ds) => ds.value === value),
+ );
+ }
+ }}
+ style={{ width: DROPDOWN_DIMENSION.WIDTH }}
+ value={
+ selectedDatasource?.label !== DEFAULT_DROPDOWN_OPTION?.label
+ ? {
+ key: selectedDatasource?.value,
+ label: (
+ <DatasourceOptionSelectedView
+ iconType={GeneratePageSelectedViewIconEnum.PLUGIN_ICON}
+ option={selectedDatasource}
+ pluginImages={pluginImages}
+ />
+ ),
+ }
+ : selectedDatasource
+ }
+ // TODO: This needs to be fixed. Removed for cypress tests to pass
+ virtual={false}
+ >
+ {dataSourceOptions.map((option) => {
+ const isConnectNewDataSourceBtn =
+ CONNECT_NEW_DATASOURCE_OPTION_ID ===
+ (option as DropdownOption).id;
+ const isSupportedForTemplate = (option as DropdownOption)?.data
+ ?.isSupportedForTemplate;
+ const isNotSupportedDatasource =
+ !isSupportedForTemplate && !isConnectNewDataSourceBtn;
+
+ return (
+ <Option
+ disabled={isNotSupportedDatasource}
+ key={option.value}
+ value={option.value}
+ >
+ <DataSourceOption
+ dataTestid="t--datasource-dropdown-option"
+ extraProps={{ routeToCreateNewDatasource }}
+ key={(option as DropdownOption).id}
+ option={option}
+ optionWidth={DROPDOWN_DIMENSION.WIDTH}
+ />
+ </Option>
+ );
+ })}
+ </Select>
+ </SelectWrapper>
+ {selectedDatasource.value ? (
<SelectWrapper width={DROPDOWN_DIMENSION.WIDTH}>
- <Label>{createMessage(GEN_CRUD_DATASOURCE_DROPDOWN_LABEL)}</Label>
+ <Label>
+ Select {pluginField.TABLE} from
+ <Bold>{selectedDatasource.label}</Bold>
+ </Label>
+
<Select
- data-testid="t--datasource-dropdown"
- onChange={(value) => {
- if (value === CONNECT_NEW_DATASOURCE_OPTION_ID) {
- routeToCreateNewDatasource();
- } else {
- onSelectDataSource(
- value,
- dataSourceOptions.find((ds) => ds.value === value),
- );
- }
- }}
- style={{ width: DROPDOWN_DIMENSION.WIDTH }}
+ data-testid="t--table-dropdown"
+ getPopupContainer={(triggerNode) =>
+ triggerNode.parentNode.parentNode
+ }
+ isDisabled={!!tableDropdownErrorMsg}
+ isLoading={fetchingDatasourceConfigs}
+ isValid={!tableDropdownErrorMsg}
+ onChange={(value) =>
+ onSelectTable(
+ value,
+ datasourceTableOptions.find(
+ (table) => table.value === value,
+ ) as DatasourceTableDropdownOption,
+ )
+ }
value={
- selectedDatasource?.label !== DEFAULT_DROPDOWN_OPTION?.label
+ selectedTable?.label !== DEFAULT_DROPDOWN_OPTION?.label
? {
- key: selectedDatasource?.value,
+ key: selectedTable?.value,
label: (
<DatasourceOptionSelectedView
- iconType={GeneratePageSelectedViewIconEnum.PLUGIN_ICON}
- option={selectedDatasource}
- pluginImages={pluginImages}
+ iconType={GeneratePageSelectedViewIconEnum.ADS_ICON}
+ option={selectedTable}
/>
),
}
- : selectedDatasource
+ : selectedTable
}
// TODO: This needs to be fixed. Removed for cypress tests to pass
virtual={false}
>
- {dataSourceOptions.map((option) => {
- const isConnectNewDataSourceBtn =
- CONNECT_NEW_DATASOURCE_OPTION_ID ===
- (option as DropdownOption).id;
- const isSupportedForTemplate = (option as DropdownOption)?.data
- ?.isSupportedForTemplate;
- const isNotSupportedDatasource =
- !isSupportedForTemplate && !isConnectNewDataSourceBtn;
-
+ {datasourceTableOptions.map((table) => {
return (
- <Option
- disabled={isNotSupportedDatasource}
- key={option.value}
- value={option.value}
- >
- <DataSourceOption
- dataTestid="t--datasource-dropdown-option"
- extraProps={{ routeToCreateNewDatasource }}
- key={(option as DropdownOption).id}
- option={option}
- optionWidth={DROPDOWN_DIMENSION.WIDTH}
- />
+ <Option key={table.value} value={table.value}>
+ <OptionWrapper>
+ <StyledIconWrapper>
+ <Icon
+ color={table?.iconColor}
+ name={table.icon as string}
+ size={table.iconSize}
+ />
+ </StyledIconWrapper>
+ <Text renderAs="p">{table.label}</Text>
+ </OptionWrapper>
</Option>
);
})}
</Select>
+ {tableDropdownErrorMsg && (
+ <ErrorMsg className="ads-dropdown-errorMsg">
+ {tableDropdownErrorMsg}
+ </ErrorMsg>
+ )}
</SelectWrapper>
- {selectedDatasource.value ? (
- <SelectWrapper width={DROPDOWN_DIMENSION.WIDTH}>
- <Label>
- Select {pluginField.TABLE} from
- <Bold>{selectedDatasource.label}</Bold>
- </Label>
-
- <Select
- data-testid="t--table-dropdown"
- isDisabled={!!tableDropdownErrorMsg}
- isLoading={fetchingDatasourceConfigs}
- isValid={!tableDropdownErrorMsg}
- onChange={(value) =>
- onSelectTable(
- value,
- datasourceTableOptions.find(
- (table) => table.value === value,
- ) as DatasourceTableDropdownOption,
- )
- }
- value={
- selectedTable?.label !== DEFAULT_DROPDOWN_OPTION?.label
- ? {
- key: selectedTable?.value,
- label: (
- <DatasourceOptionSelectedView
- iconType={GeneratePageSelectedViewIconEnum.ADS_ICON}
- option={selectedTable}
- />
- ),
- }
- : selectedTable
- }
- // TODO: This needs to be fixed. Removed for cypress tests to pass
- virtual={false}
- >
- {datasourceTableOptions.map((table) => {
- return (
- <Option key={table.value} value={table.value}>
- <OptionWrapper>
- <StyledIconWrapper>
- <Icon
- color={table?.iconColor}
- name={table.icon as string}
- size={table.iconSize}
- />
- </StyledIconWrapper>
- <Text renderAs="p">{table.label}</Text>
- </OptionWrapper>
- </Option>
- );
- })}
- </Select>
- {tableDropdownErrorMsg && (
- <ErrorMsg className="ads-dropdown-errorMsg">
- {tableDropdownErrorMsg}
- </ErrorMsg>
- )}
- </SelectWrapper>
- ) : null}
- {showEditDatasourceBtn && (
- <div>
- <Button kind="primary" onClick={goToEditDatasource} size="md">
- Edit datasource
- </Button>
+ ) : null}
+ {showEditDatasourceBtn && (
+ <div>
+ <Button kind="primary" onClick={goToEditDatasource} size="md">
+ Edit datasource
+ </Button>
+ </div>
+ )}
+ {!isGoogleSheetPlugin ? (
+ <>
+ {showSearchableColumn && (
+ <SelectWrapper width={DROPDOWN_DIMENSION.WIDTH}>
+ <Row>
+ Select a searchable {pluginField.COLUMN} from the selected
+ {pluginField.TABLE}
+ <TooltipWrapper>
+ <Tooltip content="Only string values are allowed for searchable column">
+ <Icon name="question-line" size="md" />
+ </Tooltip>
+ </TooltipWrapper>
+ </Row>
+ <Select
+ data-testid="t--table-dropdown"
+ getPopupContainer={(triggerNode) =>
+ triggerNode.parentNode.parentNode
+ }
+ isDisabled={selectedTableColumnOptions.length === 0}
+ onChange={(value) =>
+ onSelectColumn(
+ value,
+ selectedTableColumnOptions.find(
+ (column) => column.value === value,
+ ),
+ )
+ }
+ value={
+ selectedColumn?.label !== DEFAULT_DROPDOWN_OPTION?.label
+ ? {
+ key: selectedColumn?.value,
+ label: (
+ <DatasourceOptionSelectedView
+ iconType={GeneratePageSelectedViewIconEnum.ADS_ICON}
+ option={selectedColumn}
+ />
+ ),
+ }
+ : selectedColumn
+ }
+ virtual={false}
+ >
+ {selectedTableColumnOptions.map((column) => {
+ return (
+ <Option key={column.value} value={column.value}>
+ <OptionWrapper>
+ <StyledIconWrapper>
+ <Icon
+ color={column?.iconColor}
+ name={column.icon as string}
+ size={column.iconSize}
+ />
+ </StyledIconWrapper>
+ <Text renderAs="p">{column.label}</Text>
+ <Text
+ className="datasource-sub-text"
+ color="var(--ads-v2-color-fg-muted)"
+ renderAs="span"
+ >
+ {column.subText}
+ </Text>
+ </OptionWrapper>
+ </Option>
+ );
+ })}
+ </Select>
+ <HelperMsg>
+ {selectedTableColumnOptions.length === 0
+ ? `* Optional (No searchable ${pluginField.COLUMN} to select)`
+ : "* Optional"}
+ </HelperMsg>
+ </SelectWrapper>
+ )}
+ <div className="mt-4">
+ <GeneratePageSubmitBtn
+ disabled={submitButtonDisable}
+ isLoading={!!isGeneratingTemplatePage}
+ onSubmit={handleFormSubmit}
+ showSubmitButton={!!showSubmitButton}
+ />
</div>
- )}
- {!isGoogleSheetPlugin ? (
- <>
- {showSearchableColumn && (
- <SelectWrapper width={DROPDOWN_DIMENSION.WIDTH}>
- <Row>
- Select a searchable {pluginField.COLUMN} from the
- selected
- {pluginField.TABLE}
- <TooltipWrapper>
- <Tooltip content="Only string values are allowed for searchable column">
- <Icon name="question-line" size="md" />
- </Tooltip>
- </TooltipWrapper>
- </Row>
- <Select
- data-testid="t--table-dropdown"
- isDisabled={selectedTableColumnOptions.length === 0}
- onChange={(value) =>
- onSelectColumn(
- value,
- selectedTableColumnOptions.find(
- (column) => column.value === value,
- ),
- )
- }
- value={
- selectedColumn?.label !== DEFAULT_DROPDOWN_OPTION?.label
- ? {
- key: selectedColumn?.value,
- label: (
- <DatasourceOptionSelectedView
- iconType={
- GeneratePageSelectedViewIconEnum.ADS_ICON
- }
- option={selectedColumn}
- />
- ),
- }
- : selectedColumn
- }
- virtual={false}
- >
- {selectedTableColumnOptions.map((column) => {
- return (
- <Option key={column.value} value={column.value}>
- <OptionWrapper>
- <StyledIconWrapper>
- <Icon
- color={column?.iconColor}
- name={column.icon as string}
- size={column.iconSize}
- />
- </StyledIconWrapper>
- <Text renderAs="p">{column.label}</Text>
- <Text
- className="datasource-sub-text"
- color="var(--ads-v2-color-fg-muted)"
- renderAs="span"
- >
- {column.subText}
- </Text>
- </OptionWrapper>
- </Option>
- );
- })}
- </Select>
- <HelperMsg>
- {selectedTableColumnOptions.length === 0
- ? `* Optional (No searchable ${pluginField.COLUMN} to select)`
- : "* Optional"}
- </HelperMsg>
- </SelectWrapper>
- )}
- <div className="mt-4">
- <GeneratePageSubmitBtn
- disabled={submitButtonDisable}
- isLoading={!!isGeneratingTemplatePage}
- onSubmit={handleFormSubmit}
- showSubmitButton={!!showSubmitButton}
- />
- </div>
- </>
- ) : (
- <GoogleSheetForm
- generatePageAction={generatePageAction}
- googleSheetPluginId={selectedDatasourcePluginId}
- renderSubmitButton={({
- disabled,
- isLoading,
- onSubmit,
- }: {
- onSubmit: () => void;
- disabled: boolean;
- isLoading: boolean;
- }) => (
- <GeneratePageSubmitBtn
- disabled={disabled}
- isLoading={!!isGeneratingTemplatePage || isLoading}
- onSubmit={onSubmit}
- showSubmitButton={!!showSubmitButton}
- />
- )}
- selectedDatasource={selectedDatasource}
- selectedSpreadsheet={selectedTable}
- sheetColumnsHeaderProps={sheetColumnsHeaderProps}
- sheetsListProps={sheetsListProps}
- spreadSheetsProps={spreadSheetsProps}
- />
- )}
- </FormWrapper>
- </div>
+ </>
+ ) : (
+ <GoogleSheetForm
+ generatePageAction={generatePageAction}
+ googleSheetPluginId={selectedDatasourcePluginId}
+ renderSubmitButton={({
+ disabled,
+ isLoading,
+ onSubmit,
+ }: {
+ onSubmit: () => void;
+ disabled: boolean;
+ isLoading: boolean;
+ }) => (
+ <GeneratePageSubmitBtn
+ disabled={disabled}
+ isLoading={!!isGeneratingTemplatePage || isLoading}
+ onSubmit={onSubmit}
+ showSubmitButton={!!showSubmitButton}
+ />
+ )}
+ selectedDatasource={selectedDatasource}
+ selectedSpreadsheet={selectedTable}
+ sheetColumnsHeaderProps={sheetColumnsHeaderProps}
+ sheetsListProps={sheetsListProps}
+ spreadSheetsProps={spreadSheetsProps}
+ />
+ )}
+ </FormWrapper>
);
}
diff --git a/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GoogleSheetForm.tsx b/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GoogleSheetForm.tsx
index d5e146788b13..afd4b55c8220 100644
--- a/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GoogleSheetForm.tsx
+++ b/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GoogleSheetForm.tsx
@@ -301,6 +301,9 @@ function GoogleSheetForm(props: Props) {
<Select
data-testid="t--sheetName-dropdown"
+ getPopupContainer={(triggerNode) =>
+ triggerNode.parentNode.parentNode
+ }
isLoading={isFetchingSheetsList}
onChange={(value) =>
onSelectSheetOption(
diff --git a/app/client/src/pages/Editor/GeneratePage/components/PageContent.tsx b/app/client/src/pages/Editor/GeneratePage/components/PageContent.tsx
deleted file mode 100644
index fce5f5c31655..000000000000
--- a/app/client/src/pages/Editor/GeneratePage/components/PageContent.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from "react";
-import styled from "styled-components";
-
-import GeneratePageForm from "./GeneratePageForm/GeneratePageForm";
-
-const Container = styled.div`
- display: flex;
- padding: var(--ads-v2-spaces-7) 0;
-`;
-
-function PageContent() {
- return (
- <Container>
- <GeneratePageForm />
- </Container>
- );
-}
-
-export default PageContent;
diff --git a/app/client/src/pages/Editor/GeneratePage/index.tsx b/app/client/src/pages/Editor/GeneratePage/index.tsx
index 92f7245ed6ee..72d181bd56b4 100644
--- a/app/client/src/pages/Editor/GeneratePage/index.tsx
+++ b/app/client/src/pages/Editor/GeneratePage/index.tsx
@@ -1,54 +1,52 @@
-import React from "react";
-import styled from "styled-components";
-import PageContent from "./components/PageContent";
-import { Text } from "@appsmith/ads";
-import { BackButton } from "components/utils/helperComponents";
-
-const Container = styled.div`
- display: flex;
- flex-direction: column;
- overflow-y: auto;
- height: 100%;
- padding: var(--ads-v2-spaces-7);
-`;
-
-const HeadingContainer = styled.div`
- display: flex;
- padding-top: var(--ads-v2-spaces-4);
-`;
-
-const Header = styled.div`
- width: 100%;
-
- > a {
- margin: 0;
- }
-`;
-
-function GeneratePage() {
- const isGenerateFormPage = window.location.pathname.includes("/form");
- const heading = isGenerateFormPage ? "Quick page wizard" : "New page";
+import React, { useCallback } from "react";
+import {
+ Modal,
+ ModalBody,
+ ModalContent,
+ ModalHeader,
+ Text,
+} from "@appsmith/ads";
+import {
+ createMessage,
+ GENERATE_PAGE_FORM_TITLE,
+ GENERATE_PAGE_FORM_SUB_TITLE,
+} from "ee/constants/messages";
+import GeneratePageForm from "./components/GeneratePageForm/GeneratePageForm";
+import { useSelector, useDispatch } from "react-redux";
+import { getIsGeneratePageModalOpen } from "selectors/pageListSelectors";
+import {
+ closeGeneratePageModal,
+ openGeneratePageModal,
+} from "./store/generatePageActions";
+
+function GeneratePageModal() {
+ const dispatch = useDispatch();
+ const isOpen = useSelector(getIsGeneratePageModalOpen);
+
+ const handleModalOpenChange = useCallback(
+ (modalState: boolean) => {
+ if (modalState) {
+ dispatch(openGeneratePageModal());
+ } else {
+ dispatch(closeGeneratePageModal());
+ }
+ },
+ [dispatch],
+ );
return (
- <Container>
- {isGenerateFormPage ? (
- <Header>
- <BackButton />
- </Header>
- ) : null}
-
- <HeadingContainer>
- <Text kind="heading-l">{heading}</Text>
- </HeadingContainer>
- {isGenerateFormPage ? (
- <Text renderAs="p">
- Auto create a simple CRUD interface on top of your data
- </Text>
- ) : null}
-
- <PageContent />
- </Container>
+ <Modal onOpenChange={handleModalOpenChange} open={isOpen}>
+ <ModalContent style={{ width: "444px" }}>
+ <ModalHeader>{createMessage(GENERATE_PAGE_FORM_TITLE)}</ModalHeader>
+ <ModalBody>
+ <Text renderAs="p">
+ {createMessage(GENERATE_PAGE_FORM_SUB_TITLE)}
+ </Text>
+ <GeneratePageForm />
+ </ModalBody>
+ </ModalContent>
+ </Modal>
);
}
-export default GeneratePage;
+export default GeneratePageModal;
diff --git a/app/client/src/pages/Editor/GeneratePage/store/generatePageActions.ts b/app/client/src/pages/Editor/GeneratePage/store/generatePageActions.ts
new file mode 100644
index 000000000000..a04a4f7872cf
--- /dev/null
+++ b/app/client/src/pages/Editor/GeneratePage/store/generatePageActions.ts
@@ -0,0 +1,15 @@
+import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
+import type { GeneratePageModalParams } from "reducers/entityReducers/pageListReducer";
+
+export const openGeneratePageModal = (payload?: GeneratePageModalParams) => {
+ return {
+ type: ReduxActionTypes.SET_GENERATE_PAGE_MODAL_OPEN,
+ payload,
+ };
+};
+
+export const closeGeneratePageModal = () => {
+ return {
+ type: ReduxActionTypes.SET_GENERATE_PAGE_MODAL_CLOSE,
+ };
+};
diff --git a/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx b/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx
index ec106af5fd08..583704198421 100644
--- a/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx
+++ b/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx
@@ -21,7 +21,6 @@ import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import NewActionButton from "../DataSourceEditor/NewActionButton";
import {
datasourcesEditorIdURL,
- generateTemplateFormURL,
saasEditorDatasourceIdURL,
} from "ee/RouteBuilder";
import {
@@ -57,6 +56,7 @@ import {
} from "ee/utils/BusinessFeatures/permissionPageHelpers";
import { useEditorType } from "ee/hooks";
import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors";
+import { openGeneratePageModal } from "../GeneratePage/store/generatePageActions";
const Wrapper = styled.div`
padding: 15px;
@@ -266,13 +266,10 @@ function DatasourceCard(props: DatasourceCardProps) {
}
AnalyticsUtil.logEvent("DATASOURCE_CARD_GEN_CRUD_PAGE_ACTION");
- history.push(
- generateTemplateFormURL({
- basePageId,
- params: {
- datasourceId: datasource.id,
- new_page: true,
- },
+ dispatch(
+ openGeneratePageModal({
+ datasourceId: datasource.id,
+ new_page: true,
}),
);
};
diff --git a/app/client/src/pages/Editor/index.tsx b/app/client/src/pages/Editor/index.tsx
index b42f724b6c2e..9e72edd21739 100644
--- a/app/client/src/pages/Editor/index.tsx
+++ b/app/client/src/pages/Editor/index.tsx
@@ -51,6 +51,7 @@ import { PartialImportModal } from "components/editorComponents/PartialImportExp
import type { Page } from "entities/Page";
import { AppCURLImportModal } from "ee/pages/Editor/CurlImport";
import { IDE_HEADER_HEIGHT } from "IDE";
+import GeneratePageModal from "./GeneratePage";
interface EditorProps {
currentApplicationId?: string;
@@ -210,6 +211,7 @@ class Editor extends Component<Props> {
<PartialExportModal />
<PartialImportModal />
<AppCURLImportModal />
+ <GeneratePageModal />
</GlobalHotKeys>
</div>
<RequestConfirmationModal />
diff --git a/app/client/src/pages/Templates/TemplatesModal/Header.tsx b/app/client/src/pages/Templates/TemplatesModal/Header.tsx
index 0e5794f300a8..42d17c41a64d 100644
--- a/app/client/src/pages/Templates/TemplatesModal/Header.tsx
+++ b/app/client/src/pages/Templates/TemplatesModal/Header.tsx
@@ -1,20 +1,9 @@
+import { Flex } from "@appsmith/ads";
import {
ADD_PAGE_FROM_TEMPLATE_MODAL,
createMessage,
} from "ee/constants/messages";
import React from "react";
-import styled from "styled-components";
-
-const BackText = styled.div<{ width?: number; hidden?: boolean }>`
- ${(props) => props.hidden && "visibility: hidden;"}
-`;
-const HeaderWrapper = styled.div`
- display: flex;
- align-items: center;
- .back-button {
- margin-right: 8px;
- }
-`;
interface TemplateModalHeaderProps {
className?: string;
@@ -22,9 +11,9 @@ interface TemplateModalHeaderProps {
function TemplateModalHeader(props: TemplateModalHeaderProps) {
return (
- <HeaderWrapper className={props.className}>
- <BackText>{createMessage(ADD_PAGE_FROM_TEMPLATE_MODAL.title)}</BackText>
- </HeaderWrapper>
+ <Flex alignItems="center" className={props.className}>
+ {createMessage(ADD_PAGE_FROM_TEMPLATE_MODAL.title)}
+ </Flex>
);
}
diff --git a/app/client/src/reducers/entityReducers/pageListReducer.tsx b/app/client/src/reducers/entityReducers/pageListReducer.tsx
index b001a7980803..7ad83177412d 100644
--- a/app/client/src/reducers/entityReducers/pageListReducer.tsx
+++ b/app/client/src/reducers/entityReducers/pageListReducer.tsx
@@ -20,6 +20,10 @@ import type { Page } from "entities/Page";
const initialState: PageListReduxState = {
pages: [],
isGeneratingTemplatePage: false,
+ generatePage: {
+ modalOpen: false,
+ params: {},
+ },
baseApplicationId: "",
applicationId: "",
currentBasePageId: "",
@@ -235,6 +239,27 @@ export const pageListReducer = createReducer(initialState, {
},
};
},
+ [ReduxActionTypes.SET_GENERATE_PAGE_MODAL_OPEN]: (
+ state: PageListReduxState,
+ action: ReduxAction<GeneratePageModalParams>,
+ ) => {
+ return {
+ ...state,
+ generatePage: {
+ modalOpen: true,
+ params: action.payload || {},
+ },
+ };
+ },
+ [ReduxActionTypes.SET_GENERATE_PAGE_MODAL_CLOSE]: (
+ state: PageListReduxState,
+ ) => ({
+ ...state,
+ generatePage: {
+ ...state.generatePage,
+ modalOpen: false,
+ },
+ }),
[ReduxActionTypes.GENERATE_TEMPLATE_PAGE_INIT]: (
state: PageListReduxState,
) => {
@@ -299,6 +324,11 @@ export interface AppLayoutConfig {
type: SupportedLayouts;
}
+export interface GeneratePageModalParams {
+ datasourceId?: string;
+ new_page?: boolean;
+}
+
export interface PageListReduxState {
pages: Page[];
baseApplicationId: string;
@@ -309,6 +339,10 @@ export interface PageListReduxState {
defaultPageId: string;
appLayout?: AppLayoutConfig;
isGeneratingTemplatePage?: boolean;
+ generatePage?: {
+ modalOpen: boolean;
+ params?: GeneratePageModalParams;
+ };
loading: Record<string, boolean>;
}
diff --git a/app/client/src/sagas/DatasourcesSagas.ts b/app/client/src/sagas/DatasourcesSagas.ts
index a7496c2b5df6..c4c50492829b 100644
--- a/app/client/src/sagas/DatasourcesSagas.ts
+++ b/app/client/src/sagas/DatasourcesSagas.ts
@@ -151,7 +151,6 @@ import {
import {
apiEditorIdURL,
datasourcesEditorIdURL,
- generateTemplateFormURL,
integrationEditorURL,
saasEditorDatasourceIdURL,
} from "ee/RouteBuilder";
@@ -189,6 +188,7 @@ import { executeGoogleApi } from "./loadGoogleApi";
import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers";
import { getCurrentModuleId } from "ee/selectors/modulesSelector";
import type { ApplicationPayload } from "entities/Application";
+import { openGeneratePageModalWithSelectedDS } from "../utils/GeneratePageUtils";
function* fetchDatasourcesSaga(
action: ReduxAction<
@@ -339,42 +339,36 @@ export function* addMockDbToDatasources(actionPayload: addMockDb) {
const isGeneratePageInitiator =
getIsGeneratePageInitiator(isGeneratePageMode);
- if (isGeneratePageInitiator) {
- history.push(
- generateTemplateFormURL({
- basePageId,
- params: {
- datasourceId: response.data.id,
- },
- }),
- );
- } else {
- if (skipRedirection) {
- return;
- }
-
- let url = "";
- const plugin: Plugin = yield select(getPlugin, response.data.pluginId);
+ if (skipRedirection) {
+ return;
+ }
- if (plugin && plugin.type === PluginType.SAAS) {
- url = saasEditorDatasourceIdURL({
- basePageId,
- pluginPackageName: plugin.packageName,
- datasourceId: response.data.id,
- params: {
- viewMode: true,
- },
- });
- } else {
- url = datasourcesEditorIdURL({
- basePageId,
- datasourceId: response.data.id,
- params: omit(getQueryParams(), "viewMode"),
- });
- }
+ let url = "";
+ const plugin: Plugin = yield select(getPlugin, response.data.pluginId);
- history.push(url);
+ if (plugin && plugin.type === PluginType.SAAS) {
+ url = saasEditorDatasourceIdURL({
+ basePageId,
+ pluginPackageName: plugin.packageName,
+ datasourceId: response.data.id,
+ params: {
+ viewMode: true,
+ },
+ });
+ } else {
+ url = datasourcesEditorIdURL({
+ basePageId,
+ datasourceId: response.data.id,
+ params: omit(getQueryParams(), "viewMode"),
+ });
}
+
+ history.push(url);
+
+ yield call(openGeneratePageModalWithSelectedDS, {
+ shouldOpenModalWIthSelectedDS: Boolean(isGeneratePageInitiator),
+ datasourceId: response.data.id,
+ });
}
} catch (error) {
yield put({
@@ -1519,7 +1513,6 @@ function* updateDatasourceSuccessSaga(action: UpdateDatasourceSuccessAction) {
const actionRouteInfo = get(state, "ui.datasourcePane.actionRouteInfo");
const generateCRUDSupportedPlugin: GenerateCRUDEnabledPluginMap =
yield select(getGenerateCRUDEnabledPluginMap);
- const basePageId: string = yield select(getCurrentBasePageId);
const updatedDatasource = action.payload;
const { queryParams = {} } = action;
@@ -1529,19 +1522,6 @@ function* updateDatasourceSuccessSaga(action: UpdateDatasourceSuccessAction) {
);
if (
- isGeneratePageInitiator &&
- updatedDatasource.pluginId &&
- generateCRUDSupportedPlugin[updatedDatasource.pluginId]
- ) {
- history.push(
- generateTemplateFormURL({
- basePageId,
- params: {
- datasourceId: updatedDatasource.id,
- },
- }),
- );
- } else if (
actionRouteInfo &&
updatedDatasource.id === actionRouteInfo.datasourceId &&
action.redirect
@@ -1554,6 +1534,15 @@ function* updateDatasourceSuccessSaga(action: UpdateDatasourceSuccessAction) {
);
}
+ yield call(openGeneratePageModalWithSelectedDS, {
+ shouldOpenModalWIthSelectedDS: Boolean(
+ isGeneratePageInitiator &&
+ updatedDatasource.pluginId &&
+ generateCRUDSupportedPlugin[updatedDatasource.pluginId],
+ ),
+ datasourceId: updatedDatasource.id,
+ });
+
yield put({
type: ReduxActionTypes.STORE_AS_DATASOURCE_COMPLETE,
});
diff --git a/app/client/src/sagas/QueryPaneSagas.ts b/app/client/src/sagas/QueryPaneSagas.ts
index 39bea13dfc13..6d98b2ca63ae 100644
--- a/app/client/src/sagas/QueryPaneSagas.ts
+++ b/app/client/src/sagas/QueryPaneSagas.ts
@@ -57,7 +57,6 @@ import type { EventLocation } from "ee/utils/analyticsUtilTypes";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import {
datasourcesEditorIdURL,
- generateTemplateFormURL,
integrationEditorURL,
queryEditorIdURL,
} from "ee/RouteBuilder";
@@ -85,6 +84,7 @@ import {
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers";
import { convertToBasePageIdSelector } from "selectors/pageListSelectors";
+import { openGeneratePageModalWithSelectedDS } from "../utils/GeneratePageUtils";
// Called whenever the query being edited is changed via the URL or query pane
function* changeQuerySaga(actionPayload: ReduxAction<ChangeQueryPayload>) {
@@ -464,25 +464,7 @@ function* handleDatasourceCreatedSaga(
const generateCRUDSupportedPlugin: GenerateCRUDEnabledPluginMap =
yield select(getGenerateCRUDEnabledPluginMap);
- // isGeneratePageInitiator ensures that datasource is being created from generate page with data
- // then we check if the current plugin is supported for generate page with data functionality
- // and finally isDBCreated ensures that datasource is not in temporary state and
- // user has explicitly saved the datasource, before redirecting back to generate page
if (
- isGeneratePageInitiator &&
- updatedDatasource.pluginId &&
- generateCRUDSupportedPlugin[updatedDatasource.pluginId] &&
- isDBCreated
- ) {
- history.push(
- generateTemplateFormURL({
- basePageId,
- params: {
- datasourceId: updatedDatasource.id,
- },
- }),
- );
- } else if (
!currentApplicationIdForCreateNewApp ||
(!!currentApplicationIdForCreateNewApp && payload.id !== TEMP_DATASOURCE_ID)
) {
@@ -498,6 +480,20 @@ function* handleDatasourceCreatedSaga(
}),
);
}
+
+ // isGeneratePageInitiator ensures that datasource is being created from generate page with data
+ // then we check if the current plugin is supported for generate page with data functionality
+ // and finally isDBCreated ensures that datasource is not in temporary state and
+ // user has explicitly saved the datasource, before redirecting back to generate page
+ yield call(openGeneratePageModalWithSelectedDS, {
+ shouldOpenModalWIthSelectedDS: Boolean(
+ isGeneratePageInitiator &&
+ updatedDatasource.pluginId &&
+ generateCRUDSupportedPlugin[updatedDatasource.pluginId] &&
+ isDBCreated,
+ ),
+ datasourceId: updatedDatasource.id,
+ });
}
function* handleNameChangeSaga(
diff --git a/app/client/src/sagas/SaaSPaneSagas.ts b/app/client/src/sagas/SaaSPaneSagas.ts
index b45eee11f2c8..38fb823aea99 100644
--- a/app/client/src/sagas/SaaSPaneSagas.ts
+++ b/app/client/src/sagas/SaaSPaneSagas.ts
@@ -1,4 +1,4 @@
-import { all, put, select, takeEvery } from "redux-saga/effects";
+import { all, call, put, select, takeEvery } from "redux-saga/effects";
import type { ApplicationPayload } from "entities/Application";
import type { ReduxAction } from "ee/constants/ReduxActionConstants";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
@@ -10,11 +10,7 @@ import {
import type { Action } from "entities/Action";
import { PluginType } from "entities/Action";
import type { GenerateCRUDEnabledPluginMap, Plugin } from "api/PluginApi";
-import {
- generateTemplateFormURL,
- saasEditorApiIdURL,
- saasEditorDatasourceIdURL,
-} from "ee/RouteBuilder";
+import { saasEditorApiIdURL, saasEditorDatasourceIdURL } from "ee/RouteBuilder";
import { getCurrentBasePageId } from "selectors/editorSelectors";
import type { CreateDatasourceSuccessAction } from "actions/datasourceActions";
import { getQueryParams } from "utils/URLUtils";
@@ -28,6 +24,7 @@ import {
} from "ee/selectors/applicationSelectors";
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
import { convertToBasePageIdSelector } from "selectors/pageListSelectors";
+import { openGeneratePageModalWithSelectedDS } from "../utils/GeneratePageUtils";
function* handleDatasourceCreatedSaga(
actionPayload: CreateDatasourceSuccessAction,
@@ -63,25 +60,7 @@ function* handleDatasourceCreatedSaga(
const generateCRUDSupportedPlugin: GenerateCRUDEnabledPluginMap =
yield select(getGenerateCRUDEnabledPluginMap);
- // isGeneratePageInitiator ensures that datasource is being created from generate page with data
- // then we check if the current plugin is supported for generate page with data functionality
- // and finally isDBCreated ensures that datasource is not in temporary state and
- // user has explicitly saved the datasource, before redirecting back to generate page
if (
- isGeneratePageInitiator &&
- updatedDatasource.pluginId &&
- generateCRUDSupportedPlugin[updatedDatasource.pluginId] &&
- isDBCreated
- ) {
- history.push(
- generateTemplateFormURL({
- basePageId,
- params: {
- datasourceId: updatedDatasource.id,
- },
- }),
- );
- } else if (
!currentApplicationIdForCreateNewApp ||
(!!currentApplicationIdForCreateNewApp && payload.id !== TEMP_DATASOURCE_ID)
) {
@@ -98,6 +77,20 @@ function* handleDatasourceCreatedSaga(
}),
);
}
+
+ // isGeneratePageInitiator ensures that datasource is being created from generate page with data
+ // then we check if the current plugin is supported for generate page with data functionality
+ // and finally isDBCreated ensures that datasource is not in temporary state and
+ // user has explicitly saved the datasource, before redirecting back to generate page
+ yield call(openGeneratePageModalWithSelectedDS, {
+ shouldOpenModalWIthSelectedDS: Boolean(
+ isGeneratePageInitiator &&
+ updatedDatasource.pluginId &&
+ generateCRUDSupportedPlugin[updatedDatasource.pluginId] &&
+ isDBCreated,
+ ),
+ datasourceId: updatedDatasource.id,
+ });
}
function* handleActionCreatedSaga(actionPayload: ReduxAction<Action>) {
diff --git a/app/client/src/selectors/pageListSelectors.tsx b/app/client/src/selectors/pageListSelectors.tsx
index 89e9ce6ecee1..239537bc0b7b 100644
--- a/app/client/src/selectors/pageListSelectors.tsx
+++ b/app/client/src/selectors/pageListSelectors.tsx
@@ -16,6 +16,12 @@ export const getIsGeneratingTemplatePage = createSelector(
(pageList: PageListReduxState) => pageList.isGeneratingTemplatePage,
);
+export const getIsGeneratePageModalOpen = (state: AppState) =>
+ state.entities.pageList.generatePage?.modalOpen;
+
+export const getGeneratePageModalParams = (state: AppState) =>
+ state.entities.pageList.generatePage?.params;
+
export const convertToPageIdSelector = (state: AppState, basePageId: string) =>
state.entities.pageList.pages?.find((page) => page.basePageId === basePageId)
?.pageId;
diff --git a/app/client/src/utils/GeneratePageUtils.ts b/app/client/src/utils/GeneratePageUtils.ts
new file mode 100644
index 000000000000..ec0c18146208
--- /dev/null
+++ b/app/client/src/utils/GeneratePageUtils.ts
@@ -0,0 +1,18 @@
+import { openGeneratePageModal } from "pages/Editor/GeneratePage/store/generatePageActions";
+import { put } from "redux-saga/effects";
+
+export function* openGeneratePageModalWithSelectedDS({
+ datasourceId,
+ shouldOpenModalWIthSelectedDS,
+}: {
+ shouldOpenModalWIthSelectedDS: boolean;
+ datasourceId: string;
+}) {
+ if (shouldOpenModalWIthSelectedDS) {
+ yield put(
+ openGeneratePageModal({
+ datasourceId,
+ }),
+ );
+ }
+}
|
b68f349eb6258e1f5089850a92b8ad13d90dfe5a
|
2024-02-05 10:05:07
|
albinAppsmith
|
fix: Navigating to page, navigate to last used segment instead of canvas (#30652)
| false
|
Navigating to page, navigate to last used segment instead of canvas (#30652)
|
fix
|
diff --git a/app/client/cypress/e2e/Regression/Apps/EchoApiCMS_spec.js b/app/client/cypress/e2e/Regression/Apps/EchoApiCMS_spec.js
index 4eeb13eca901..197d01bc3c8f 100644
--- a/app/client/cypress/e2e/Regression/Apps/EchoApiCMS_spec.js
+++ b/app/client/cypress/e2e/Regression/Apps/EchoApiCMS_spec.js
@@ -75,7 +75,7 @@ describe(
it("4. Send mail and verify post request body", function () {
// navigating to canvas
- cy.xpath(appPage.pagebutton).click();
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
cy.get(appPage.submitButton).should("be.visible");
cy.xpath("//span[text()='3']").click({ force: true });
cy.get(appPage.mailButton).closest("div").click();
@@ -89,7 +89,7 @@ describe(
.type("Task completed", { force: true });
cy.get(appPage.confirmButton).closest("div").click({ force: true });
cy.get(appPage.closeButton).closest("div").click({ force: true });
- cy.xpath(appPage.pagebutton).click({ force: true });
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
PageLeftPane.switchSegment(PagePaneSegment.Queries);
cy.xpath(appPage.postApi).click({ force: true });
cy.ResponseCheck("Test");
@@ -99,14 +99,14 @@ describe(
it("5. Delete proposal and verify delete request body", function () {
// navigating back to canvas
- cy.xpath(appPage.pagebutton).click({ force: true });
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
cy.get(appPage.submitButton).closest("div").should("be.visible");
cy.xpath("//span[text()='[email protected]']").click({ force: true });
// deleting the proposal and asserting delete call's response
cy.xpath(appPage.deleteButton).click({ force: true });
cy.xpath(appPage.deleteTaskText).should("be.visible");
cy.get(appPage.confirmButton).closest("div").click({ force: true });
- cy.xpath(appPage.pagebutton).click({ force: true });
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
EditorNavigation.SelectEntityByName("delete_proposal", EntityType.Api);
cy.ResponseCheck("[email protected]");
cy.ResponseCheck("Recusan");
diff --git a/app/client/cypress/e2e/Regression/Apps/PromisesApp_spec.js b/app/client/cypress/e2e/Regression/Apps/PromisesApp_spec.js
index faa619eee1dc..2a348e14a2c1 100644
--- a/app/client/cypress/e2e/Regression/Apps/PromisesApp_spec.js
+++ b/app/client/cypress/e2e/Regression/Apps/PromisesApp_spec.js
@@ -7,6 +7,8 @@ import {
} from "../../../support/Objects/ObjectsCore";
import EditorNavigation, {
EntityType,
+ PageLeftPane,
+ PagePaneSegment,
} from "../../../support/Pages/EditorNavigation";
const commonlocators = require("../../../locators/commonlocators.json");
@@ -59,7 +61,7 @@ describe(
shouldCreateNewJSObj: true,
},
);
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
cy.wait("@getConsolidatedData");
// verify text in the text widget
@@ -113,7 +115,7 @@ describe(
EditorNavigation.SelectEntityByName("JSObject1", EntityType.JSObject);
jsEditor.SelectFunctionDropdown("clearStore");
jsEditor.RunJSObj();
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
cy.xpath("//span[text()='Clear store']").click({ force: true });
cy.get(".t--draggable-textwidget span")
.eq(5)
diff --git a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Hide_Page_spec.js b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Hide_Page_spec.js
index 68af153851be..a3ae877c7329 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Hide_Page_spec.js
+++ b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Hide_Page_spec.js
@@ -1,5 +1,6 @@
import EditorNavigation, {
EntityType,
+ PageLeftPane,
} from "../../../../support/Pages/EditorNavigation";
import * as _ from "../../../../support/Objects/ObjectsCore";
@@ -16,6 +17,7 @@ describe(
entityNameinLeftSidebar: "Page2",
action: "Hide",
});
+ PageLeftPane.switchToAddNew();
cy.ClearSearch();
_.deployMode.DeployApp();
cy.get(".t--page-switch-tab").should("have.length", 2);
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js
index 783e3d9f50a5..c83f453e79ca 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js
+++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js
@@ -166,7 +166,7 @@ describe("Git import flow ", { tags: ["@tag.Git"] }, function () {
// verify jsObject is not duplicated
agHelper.Sleep(2000); //for cloning of table data to finish
EditorNavigation.SelectEntityByName(jsObject, EntityType.JSObject); //Also checking jsobject exists after cloning the page
- EditorNavigation.SelectEntityByName("Page1 Copy", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
cy.xpath("//input[@class='bp3-input' and @value='Success']").should(
"be.visible",
);
@@ -192,6 +192,7 @@ describe("Git import flow ", { tags: ["@tag.Git"] }, function () {
cy.xpath("//input[@value='Success']");
// navigate to Page1 and verify data
cy.get(".t--page-switch-tab").contains("Page1").click({ force: true });
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
table.AssertTableLoaded();
// verify api response binded to input widget
cy.xpath("//input[@value='this is a test']");
@@ -211,6 +212,7 @@ describe("Git import flow ", { tags: ["@tag.Git"] }, function () {
cy.xpath("//input[@value='Success']");
// navigate to Page1 and verify data
cy.get(".t--page-switch-tab").contains("Page1 Copy").click({ force: true });
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
table.AssertTableLoaded(0, 1, "v1");
cy.xpath("//input[@value='this is a test']");
cy.xpath("//input[@value='Success']");
diff --git a/app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts
index 6cae600c1d16..e09e085cf596 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts
+++ b/app/client/cypress/e2e/Regression/ClientSide/SetProperty/SetOptions_Spec.ts
@@ -11,6 +11,8 @@ import {
} from "../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
EntityType,
+ PageLeftPane,
+ PagePaneSegment,
} from "../../../../support/Pages/EditorNavigation";
describe(
@@ -37,7 +39,7 @@ describe(
},
);
jsEditor.RunJSObj();
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
agHelper
.GetText(
locators._widgetInDeployed(draggableWidgets.INPUT_V2) +
@@ -60,7 +62,7 @@ describe(
false,
);
jsEditor.RunJSObj();
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
agHelper
.GetText(
locators._widgetInDeployed(draggableWidgets.INPUT_V2) +
@@ -83,7 +85,7 @@ describe(
false,
);
jsEditor.RunJSObj();
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
agHelper
.GetText(
locators._widgetInDeployed(draggableWidgets.INPUT_V2) +
@@ -106,7 +108,7 @@ describe(
false,
);
jsEditor.RunJSObj();
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
agHelper
.GetText(
locators._widgetInDeployed(draggableWidgets.INPUT_V2) +
@@ -129,7 +131,7 @@ describe(
false,
);
jsEditor.RunJSObj();
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
agHelper
.GetText(
locators._widgetInDeployed(draggableWidgets.INPUT_V2) +
@@ -158,7 +160,7 @@ describe(
}
}`);
jsEditor.RunJSObj();
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
agHelper
.GetText(
locators._widgetInDeployed(draggableWidgets.INPUT_V2) +
diff --git a/app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
index 9fe3369221b0..7513a69e03fb 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
+++ b/app/client/cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
@@ -11,6 +11,8 @@ import {
} from "../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
EntityType,
+ PageLeftPane,
+ PagePaneSegment,
} from "../../../../support/Pages/EditorNavigation";
describe(
@@ -134,6 +136,7 @@ describe(
);
jsEditor.RunJSObj();
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
agHelper
.GetText(
locators._widgetInDeployed(draggableWidgets.INPUT_V2) +
diff --git a/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js b/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js
index d658c58898d3..34818e04f402 100644
--- a/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js
+++ b/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js
@@ -1,5 +1,6 @@
-import EditorNavigation, {
- EntityType,
+import {
+ PageLeftPane,
+ PagePaneSegment,
} from "../../../support/Pages/EditorNavigation";
const datasourceEditor = require("../../../locators/DatasourcesEditor.json");
@@ -47,7 +48,7 @@ describe(
);
cy.SaveAndRunAPI();
cy.ResponseCheck("killed");
- EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
cy.wait(2000);
// run kill query
cy.get(".bp3-button-text:contains('Kill Session')").should("be.visible");
diff --git a/app/client/cypress/support/ApiCommands.js b/app/client/cypress/support/ApiCommands.js
index cde24de7f66c..47b5084adb6e 100644
--- a/app/client/cypress/support/ApiCommands.js
+++ b/app/client/cypress/support/ApiCommands.js
@@ -85,7 +85,7 @@ Cypress.Commands.add("EditApiNameFromExplorer", (apiname) => {
.clear()
.type(apiname, { force: true })
.should("have.value", apiname)
- .blur();
+ .blur({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000);
});
diff --git a/app/client/src/pages/Editor/Explorer/Pages/index.tsx b/app/client/src/pages/Editor/Explorer/Pages/index.tsx
index 0cc0b5dfdb8d..6609be1909d2 100644
--- a/app/client/src/pages/Editor/Explorer/Pages/index.tsx
+++ b/app/client/src/pages/Editor/Explorer/Pages/index.tsx
@@ -12,45 +12,32 @@ import {
getCurrentPageId,
} from "selectors/editorSelectors";
import { EntityClassNames } from "../Entity";
-import history, { NavigationMethod } from "utils/history";
-import { createNewPageFromEntities, updatePage } from "actions/pageActions";
-import { defaultPageIcon, pageIcon } from "../ExplorerIcons";
+import { createNewPageFromEntities } from "actions/pageActions";
import { ADD_PAGE_TOOLTIP, createMessage } from "@appsmith/constants/messages";
import type { Page } from "@appsmith/constants/ReduxActionConstants";
import { getNextEntityName } from "utils/AppsmithUtils";
-import PageContextMenu from "./PageContextMenu";
-import { resolveAsSpaceChar } from "utils/helpers";
import { getExplorerPinned } from "selectors/explorerSelector";
import { setExplorerPinnedAction } from "actions/explorerActions";
import { selectAllPages } from "@appsmith/selectors/entitiesSelector";
-import { builderURL, widgetListURL } from "@appsmith/RouteBuilder";
import {
getExplorerStatus,
saveExplorerStatus,
} from "@appsmith/pages/Editor/Explorer/helpers";
import AddPageContextMenu from "./AddPageContextMenu";
-import AnalyticsUtil from "utils/AnalyticsUtil";
import { useLocation } from "react-router";
-import { toggleInOnboardingWidgetSelection } from "actions/onboardingActions";
import type { AppState } from "@appsmith/reducers";
import { getCurrentWorkspaceId } from "@appsmith/selectors/selectedWorkspaceSelectors";
import { getInstanceId } from "@appsmith//selectors/tenantSelectors";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
-import {
- getHasCreatePagePermission,
- getHasManagePagePermission,
-} from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
+import { getHasCreatePagePermission } from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
import {
ENTITY_HEIGHT,
RelativeContainer,
StyledEntity,
} from "../Common/components";
import { EntityExplorerResizeHandler } from "../Common/EntityExplorerResizeHandler";
-import {
- PERMISSION_TYPE,
- isPermitted,
-} from "@appsmith/utils/permissionHelpers";
+import { PageElement } from "pages/Editor/IDE/EditorPane/components/PageElement";
function Pages() {
const applicationId = useSelector(getCurrentApplicationId);
@@ -78,28 +65,6 @@ function Pages() {
}
}, [currentPageId]);
- const switchPage = useCallback(
- (page: Page) => {
- const navigateToUrl =
- currentPageId === page.pageId
- ? widgetListURL({})
- : builderURL({
- pageId: page.pageId,
- });
- AnalyticsUtil.logEvent("PAGE_NAME_CLICK", {
- name: page.pageName,
- fromUrl: location.pathname,
- type: "PAGES",
- toUrl: navigateToUrl,
- });
- dispatch(toggleInOnboardingWidgetSelection(true));
- history.push(navigateToUrl, {
- invokedBy: NavigationMethod.EntityExplorer,
- });
- },
- [location.pathname, currentPageId],
- );
-
const [isMenuOpen, openMenu] = useState(false);
const workspaceId = useSelector(getCurrentWorkspaceId);
@@ -148,59 +113,10 @@ function Pages() {
isFeatureEnabled,
userAppPermissions,
);
- const hasExportPermission = isPermitted(
- userAppPermissions ?? [],
- PERMISSION_TYPE.EXPORT_APPLICATION,
- );
const pageElements = useMemo(
- () =>
- pages.map((page) => {
- const icon = page.isDefault ? defaultPageIcon : pageIcon;
- const isCurrentPage = currentPageId === page.pageId;
- const pagePermissions = page.userPermissions;
- const canManagePages = getHasManagePagePermission(
- isFeatureEnabled,
- pagePermissions,
- );
-
- const contextMenu = (
- <PageContextMenu
- applicationId={applicationId as string}
- className={EntityClassNames.CONTEXT_MENU}
- hasExportPermission={hasExportPermission}
- isCurrentPage={isCurrentPage}
- isDefaultPage={page.isDefault}
- isHidden={!!page.isHidden}
- key={page.pageId + "_context-menu"}
- name={page.pageName}
- pageId={page.pageId}
- />
- );
-
- return (
- <StyledEntity
- action={() => switchPage(page)}
- active={isCurrentPage}
- canEditEntityName={canManagePages}
- className={`page ${isCurrentPage && "activePage"}`}
- contextMenu={contextMenu}
- disabled={page.isHidden}
- entityId={page.pageId}
- icon={icon}
- isDefaultExpanded={isCurrentPage}
- key={page.pageId}
- name={page.pageName}
- onNameEdit={resolveAsSpaceChar}
- searchKeyword={""}
- step={1}
- updateEntityName={(id, name) =>
- updatePage({ id, name, isHidden: !!page.isHidden })
- }
- />
- );
- }),
- [pages, currentPageId, applicationId, location.pathname],
+ () => pages.map((page) => <PageElement key={page.pageId} page={page} />),
+ [pages, location.pathname],
);
return (
diff --git a/app/client/src/pages/Editor/IDE/EditorPane/PagesSection.tsx b/app/client/src/pages/Editor/IDE/EditorPane/PagesSection.tsx
index ade47a04f656..bc7517d6c132 100644
--- a/app/client/src/pages/Editor/IDE/EditorPane/PagesSection.tsx
+++ b/app/client/src/pages/Editor/IDE/EditorPane/PagesSection.tsx
@@ -4,39 +4,22 @@ import { animated, useSpring } from "react-spring";
import { useDispatch, useSelector } from "react-redux";
import { useLocation } from "react-router";
-import {
- getCurrentPageId,
- selectAllPages,
-} from "@appsmith/selectors/entitiesSelector";
+import { selectAllPages } from "@appsmith/selectors/entitiesSelector";
import type { Page } from "@appsmith/constants/ReduxActionConstants";
-import PageContextMenu from "pages/Editor/Explorer/Pages/PageContextMenu";
-import { StyledEntity } from "pages/Editor/Explorer/Common/components";
-import { defaultPageIcon, pageIcon } from "pages/Editor/Explorer/ExplorerIcons";
-import {
- getHasCreatePagePermission,
- getHasManagePagePermission,
-} from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
+import { getHasCreatePagePermission } from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
import { getCurrentApplicationId } from "selectors/editorSelectors";
import { EntityClassNames } from "pages/Editor/Explorer/Entity";
-import {
- isPermitted,
- PERMISSION_TYPE,
-} from "@appsmith/utils/permissionHelpers";
import { getCurrentApplication } from "@appsmith/selectors/applicationSelectors";
import type { AppState } from "@appsmith/reducers";
-import { builderURL, widgetListURL } from "@appsmith/RouteBuilder";
-import AnalyticsUtil from "utils/AnalyticsUtil";
-import { toggleInOnboardingWidgetSelection } from "actions/onboardingActions";
-import history, { NavigationMethod } from "utils/history";
-import { resolveAsSpaceChar } from "utils/helpers";
-import { createNewPageFromEntities, updatePage } from "actions/pageActions";
+import { createNewPageFromEntities } from "actions/pageActions";
import { setIdeEditorPagesActiveStatus } from "actions/ideActions";
import AddPageContextMenu from "pages/Editor/Explorer/Pages/AddPageContextMenu";
import { getNextEntityName } from "utils/AppsmithUtils";
import { getCurrentWorkspaceId } from "@appsmith/selectors/selectedWorkspaceSelectors";
import { getInstanceId } from "@appsmith/selectors/tenantSelectors";
+import { PageElement } from "pages/Editor/IDE/EditorPane/components/PageElement";
const AnimatedFlex = animated(Flex);
@@ -44,7 +27,6 @@ const PagesSection = () => {
const dispatch = useDispatch();
const location = useLocation();
const pages: Page[] = useSelector(selectAllPages);
- const currentPageId = useSelector(getCurrentPageId);
const applicationId = useSelector(getCurrentApplicationId);
const userAppPermissions = useSelector(
(state: AppState) => getCurrentApplication(state)?.userPermissions ?? [],
@@ -61,11 +43,6 @@ const PagesSection = () => {
to: { opacity: 1, height: "100%" },
}));
- const hasExportPermission = isPermitted(
- userAppPermissions ?? [],
- PERMISSION_TYPE.EXPORT_APPLICATION,
- );
-
const canCreatePages = getHasCreatePagePermission(
isFeatureEnabled,
userAppPermissions,
@@ -75,29 +52,6 @@ const PagesSection = () => {
api.start();
}, []);
- const switchPage = useCallback(
- (page: Page) => {
- const navigateToUrl =
- currentPageId === page.pageId
- ? widgetListURL({})
- : builderURL({
- pageId: page.pageId,
- });
- AnalyticsUtil.logEvent("PAGE_NAME_CLICK", {
- name: page.pageName,
- fromUrl: location.pathname,
- type: "PAGES",
- toUrl: navigateToUrl,
- });
- dispatch(toggleInOnboardingWidgetSelection(true));
- dispatch(setIdeEditorPagesActiveStatus(false));
- history.push(navigateToUrl, {
- invokedBy: NavigationMethod.EntityExplorer,
- });
- },
- [location.pathname, currentPageId],
- );
-
const createPageCallback = useCallback(() => {
const name = getNextEntityName(
"Page",
@@ -118,53 +72,8 @@ const PagesSection = () => {
const onMenuClose = useCallback(() => setIsMenuOpen(false), [setIsMenuOpen]);
const pageElements = useMemo(
- () =>
- pages.map((page) => {
- const icon = page.isDefault ? defaultPageIcon : pageIcon;
- const isCurrentPage = currentPageId === page.pageId;
- const pagePermissions = page.userPermissions;
- const canManagePages = getHasManagePagePermission(
- isFeatureEnabled,
- pagePermissions,
- );
-
- const contextMenu = (
- <PageContextMenu
- applicationId={applicationId as string}
- className={EntityClassNames.CONTEXT_MENU}
- hasExportPermission={hasExportPermission}
- isCurrentPage={isCurrentPage}
- isDefaultPage={page.isDefault}
- isHidden={!!page.isHidden}
- key={page.pageId + "_context-menu"}
- name={page.pageName}
- pageId={page.pageId}
- />
- );
-
- return (
- <StyledEntity
- action={() => switchPage(page)}
- active={isCurrentPage}
- canEditEntityName={canManagePages}
- className={`page fullWidth ${isCurrentPage && "activePage"}`}
- contextMenu={contextMenu}
- disabled={page.isHidden}
- entityId={page.pageId}
- icon={icon}
- isDefaultExpanded={isCurrentPage}
- key={page.pageId}
- name={page.pageName}
- onNameEdit={resolveAsSpaceChar}
- searchKeyword={""}
- step={1}
- updateEntityName={(id, name) =>
- updatePage({ id, name, isHidden: !!page.isHidden })
- }
- />
- );
- }),
- [pages, currentPageId, applicationId, location.pathname],
+ () => pages.map((page) => <PageElement key={page.pageId} page={page} />),
+ [pages, location.pathname],
);
return (
diff --git a/app/client/src/pages/Editor/IDE/EditorPane/components/PageElement.tsx b/app/client/src/pages/Editor/IDE/EditorPane/components/PageElement.tsx
new file mode 100644
index 000000000000..c9ef7def2df7
--- /dev/null
+++ b/app/client/src/pages/Editor/IDE/EditorPane/components/PageElement.tsx
@@ -0,0 +1,108 @@
+import React, { useCallback } from "react";
+import { useDispatch, useSelector } from "react-redux";
+import { useLocation } from "react-router";
+
+import type { Page } from "@appsmith/constants/ReduxActionConstants";
+import { defaultPageIcon, pageIcon } from "pages/Editor/Explorer/ExplorerIcons";
+import { getCurrentPageId } from "@appsmith/selectors/entitiesSelector";
+import { getHasManagePagePermission } from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
+import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
+import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
+import PageContextMenu from "pages/Editor/Explorer/Pages/PageContextMenu";
+import { getCurrentApplicationId } from "selectors/editorSelectors";
+import { EntityClassNames } from "pages/Editor/Explorer/Entity";
+import {
+ PERMISSION_TYPE,
+ isPermitted,
+} from "@appsmith/utils/permissionHelpers";
+import { getCurrentApplication } from "@appsmith/selectors/applicationSelectors";
+import type { AppState } from "@appsmith/reducers";
+import { StyledEntity } from "pages/Editor/Explorer/Common/components";
+import { resolveAsSpaceChar } from "utils/helpers";
+import { updatePage } from "actions/pageActions";
+import { useGetPageFocusUrl } from "pages/Editor/IDE/hooks";
+import AnalyticsUtil from "utils/AnalyticsUtil";
+import { toggleInOnboardingWidgetSelection } from "actions/onboardingActions";
+import { setIdeEditorPagesActiveStatus } from "actions/ideActions";
+import history, { NavigationMethod } from "utils/history";
+
+const PageElement = ({ page }: { page: Page }) => {
+ const dispatch = useDispatch();
+ const location = useLocation();
+ const navigateToUrl = useGetPageFocusUrl(page.pageId);
+
+ const currentPageId = useSelector(getCurrentPageId);
+ const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
+ const applicationId = useSelector(getCurrentApplicationId);
+ const userAppPermissions = useSelector(
+ (state: AppState) => getCurrentApplication(state)?.userPermissions ?? [],
+ );
+
+ const icon = page.isDefault ? defaultPageIcon : pageIcon;
+ const isCurrentPage = currentPageId === page.pageId;
+ const pagePermissions = page.userPermissions;
+
+ const canManagePages = getHasManagePagePermission(
+ isFeatureEnabled,
+ pagePermissions,
+ );
+ const hasExportPermission = isPermitted(
+ userAppPermissions ?? [],
+ PERMISSION_TYPE.EXPORT_APPLICATION,
+ );
+
+ const switchPage = useCallback(
+ (page: Page) => {
+ AnalyticsUtil.logEvent("PAGE_NAME_CLICK", {
+ name: page.pageName,
+ fromUrl: location.pathname,
+ type: "PAGES",
+ toUrl: navigateToUrl,
+ });
+ dispatch(toggleInOnboardingWidgetSelection(true));
+ dispatch(setIdeEditorPagesActiveStatus(false));
+ history.push(navigateToUrl, {
+ invokedBy: NavigationMethod.EntityExplorer,
+ });
+ },
+ [location.pathname, currentPageId, navigateToUrl],
+ );
+
+ const contextMenu = (
+ <PageContextMenu
+ applicationId={applicationId as string}
+ className={EntityClassNames.CONTEXT_MENU}
+ hasExportPermission={hasExportPermission}
+ isCurrentPage={isCurrentPage}
+ isDefaultPage={page.isDefault}
+ isHidden={!!page.isHidden}
+ key={page.pageId + "_context-menu"}
+ name={page.pageName}
+ pageId={page.pageId}
+ />
+ );
+
+ return (
+ <StyledEntity
+ action={() => switchPage(page)}
+ active={isCurrentPage}
+ canEditEntityName={canManagePages}
+ className={`page fullWidth ${isCurrentPage && "activePage"}`}
+ contextMenu={contextMenu}
+ disabled={page.isHidden}
+ entityId={page.pageId}
+ icon={icon}
+ isDefaultExpanded={isCurrentPage}
+ key={page.pageId}
+ name={page.pageName}
+ onNameEdit={resolveAsSpaceChar}
+ searchKeyword={""}
+ step={1}
+ updateEntityName={(id, name) =>
+ updatePage({ id, name, isHidden: !!page.isHidden })
+ }
+ />
+ );
+};
+
+export { PageElement };
diff --git a/app/client/src/pages/Editor/IDE/hooks.ts b/app/client/src/pages/Editor/IDE/hooks.ts
index e904fd6d1177..96d3edadf507 100644
--- a/app/client/src/pages/Editor/IDE/hooks.ts
+++ b/app/client/src/pages/Editor/IDE/hooks.ts
@@ -13,11 +13,16 @@ import { getPropertyPaneWidth } from "selectors/propertyPaneSelectors";
import { getCurrentPageId } from "@appsmith/selectors/entitiesSelector";
import history, { NavigationMethod } from "utils/history";
import {
+ builderURL,
jsCollectionListURL,
queryListURL,
widgetListURL,
} from "@appsmith/RouteBuilder";
import { DEFAULT_EDITOR_PANE_WIDTH } from "constants/AppConstants";
+import isEmpty from "lodash/isEmpty";
+import pickBy from "lodash/pickBy";
+import { getFocusInfo } from "selectors/focusHistorySelectors";
+import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
export const useCurrentAppState = () => {
const [appState, setAppState] = useState(EditorState.EDITOR);
@@ -154,3 +159,42 @@ export const useSegmentNavigation = (): {
return { onSegmentChange };
};
+
+export const useGetPageFocusUrl = (pageId: string): string => {
+ const editorStateString = "EDITOR_STATE.";
+ const focusInfo = useSelector(getFocusInfo);
+ const branch = useSelector(getCurrentGitBranch);
+ const [focusPageUrl, setFocusPageUrl] = useState(
+ builderURL({ pageId: pageId }),
+ );
+
+ useEffect(() => {
+ const editorState = pickBy(
+ focusInfo,
+ (v, k) =>
+ k === editorStateString + pageId + "#" + (branch || "undefined"),
+ );
+
+ if (isEmpty(editorState)) {
+ return;
+ }
+
+ const segment =
+ Object.values(editorState)[0].state?.SelectedSegment ||
+ EditorEntityTab.UI;
+
+ switch (segment) {
+ case EditorEntityTab.UI:
+ setFocusPageUrl(widgetListURL({ pageId: pageId }));
+ break;
+ case EditorEntityTab.JS:
+ setFocusPageUrl(jsCollectionListURL({ pageId: pageId }));
+ break;
+ case EditorEntityTab.QUERIES:
+ setFocusPageUrl(queryListURL({ pageId: pageId }));
+ break;
+ }
+ }, [focusInfo, branch]);
+
+ return focusPageUrl;
+};
|
f97cd4c38a8bc5c666d45d04d0c538200923524e
|
2022-09-02 17:06:34
|
Dhruvik Neharia
|
feat: Add QR Scanner to System Themes (#16474)
| false
|
Add QR Scanner to System Themes (#16474)
|
feat
|
diff --git a/app/server/appsmith-server/src/main/resources/system-themes.json b/app/server/appsmith-server/src/main/resources/system-themes.json
index d5436f7eb60d..19bab7d64a5c 100644
--- a/app/server/appsmith-server/src/main/resources/system-themes.json
+++ b/app/server/appsmith-server/src/main/resources/system-themes.json
@@ -281,6 +281,11 @@
"fillColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
},
+ "QR_SCANNER_WIDGET": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
"RATE_WIDGET": {
"activeColor": "{{appsmith.theme.colors.primaryColor}}"
},
@@ -679,6 +684,11 @@
"fillColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
},
+ "QR_SCANNER_WIDGET": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
"RATE_WIDGET": {
"activeColor": "{{appsmith.theme.colors.primaryColor}}"
},
@@ -1072,6 +1082,11 @@
"fillColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
},
+ "QR_SCANNER_WIDGET": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
"RATE_WIDGET": {
"activeColor": "{{appsmith.theme.colors.primaryColor}}"
},
@@ -1461,6 +1476,11 @@
"fillColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
},
+ "QR_SCANNER_WIDGET": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
"RATE_WIDGET": {
"activeColor": "{{appsmith.theme.colors.primaryColor}}"
},
@@ -1850,6 +1870,11 @@
"fillColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
},
+ "QR_SCANNER_WIDGET": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
"RATE_WIDGET": {
"activeColor": "{{appsmith.theme.colors.primaryColor}}"
},
@@ -2239,6 +2264,11 @@
"fillColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
},
+ "QR_SCANNER_WIDGET": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
"RATE_WIDGET": {
"activeColor": "{{appsmith.theme.colors.primaryColor}}"
},
@@ -2628,6 +2658,11 @@
"fillColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
},
+ "QR_SCANNER_WIDGET": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
"RATE_WIDGET": {
"activeColor": "{{appsmith.theme.colors.primaryColor}}"
},
@@ -3017,6 +3052,11 @@
"fillColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
},
+ "QR_SCANNER_WIDGET": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
"RATE_WIDGET": {
"activeColor": "{{appsmith.theme.colors.primaryColor}}"
},
|
45009d0e63a89bf11ae583f301b67d8fa18c282d
|
2022-11-30 16:10:24
|
yatinappsmith
|
ci: fix-fat-failedspec (#18571)
| false
|
fix-fat-failedspec (#18571)
|
ci
|
diff --git a/.github/workflows/integration-tests-command.yml b/.github/workflows/integration-tests-command.yml
index dcda9cb00153..b58f05c5de3a 100644
--- a/.github/workflows/integration-tests-command.yml
+++ b/.github/workflows/integration-tests-command.yml
@@ -375,7 +375,7 @@ jobs:
if: failure()
run: |
cd ${{ github.workspace }}/app/client/cypress/
- find screenshots -type d|grep -i spec |sed 's/screenshots/cypress\/integration/g' > ~/failed_spec_fat/failed_spec-${{ matrix.job }}
+ find screenshots -type d|grep -i spec |sed 's/screenshots/cypress\/integration/g' > ~/failed_spec_fat/failed_spec_fat-${{ matrix.job }}
# Upload failed test list using common path for all matrix job
- name: Upload failed test list artifact
|
fdb483fc3c5b5418036a61e0d3d9831fabb5667e
|
2021-04-23 13:18:41
|
Confidence Okoghenun
|
chore: Adds officehours for Apr 8th and 15th
| false
|
Adds officehours for Apr 8th and 15th
|
chore
|
diff --git a/office_hours.md b/office_hours.md
index f17c85506d85..ed44f37fbc33 100644
--- a/office_hours.md
+++ b/office_hours.md
@@ -28,6 +28,26 @@ You can find the archives of the calls below with a brief summary of each sessio
## Archives
+<strong>15th April 2021: Bug fixes, Fusion charts demo</strong>
+
+<a href = "https://youtu.be/99qQzen8D9w">Video Link</a>
+
+#### Summary
+
+Nidhi from Appsmith talks about the issues that were discovered on the table widget and how they have been fixed. She also demos the new Fusion chart API that lets developers build custom charts using the chart widget.
+
+------------------
+
+<strong>8th April 2021: Thanks for the 4k Github stars, Sticky property pane, Custom charts</strong>
+
+<a href = "https://youtu.be/m0d9A7Yc2N0">Video Link</a>
+
+#### Summary
+
+Abhinav shows a handful of the cool new Appsmith features, some of which are sticky property pane, custom charts, tables in rich-text-editor, text widget styling, and auto data format detection in Datepicker widget. Also, Sumit from Appsmith talks about bug fixes and community feedback.
+
+------------------
+
<strong>25th Mar 2021: Intelligent JSON substitution, Generic S3 integration, Url table column type and new datepicker formats</strong>
<a href = "https://youtu.be/4De0f5-DEVs">Video Link</a>
|
f1bf7b17dc6143e055c08f23ec6565785d227309
|
2023-04-19 18:20:59
|
Sumesh Pradhan
|
feat: Display loading message in browser when Appsmith is starting (#22215)
| false
|
Display loading message in browser when Appsmith is starting (#22215)
|
feat
|
diff --git a/Dockerfile b/Dockerfile
index 998d7afc1366..acd38db0d8c3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -71,6 +71,8 @@ COPY ./deploy/docker/templates/nginx/* \
./deploy/docker/templates/docker.env.sh \
./deploy/docker/templates/mockdb_postgres.sql \
./deploy/docker/templates/users_postgres.sql \
+ ./deploy/docker/templates/appsmith_starting.html \
+ ./deploy/docker/templates/appsmith_initializing.html \
templates/
# Add bootstrapfile
diff --git a/deploy/docker/entrypoint.sh b/deploy/docker/entrypoint.sh
index defcc4301587..b5f768b668ac 100755
--- a/deploy/docker/entrypoint.sh
+++ b/deploy/docker/entrypoint.sh
@@ -271,6 +271,9 @@ configure_supervisord() {
fi
cp -f "$SUPERVISORD_CONF_PATH/application_process/"*.conf /etc/supervisor/conf.d
+
+ # Copy Supervisor Listiner confs to conf.d
+ cp -f "$SUPERVISORD_CONF_PATH/event_listeners/"*.conf /etc/supervisor/conf.d
# Disable services based on configuration
if [[ -z "${DYNO}" ]]; then
@@ -377,7 +380,20 @@ runEmbeddedPostgres=1
init_postgres || runEmbeddedPostgres=0
}
+init_loading_pages(){
+ local starting_page="/opt/appsmith/templates/appsmith_starting.html"
+ local initializing_page="/opt/appsmith/templates/appsmith_initializing.html"
+ local editor_load_page="/opt/appsmith/editor/loading.html"
+ # Update default nginx page for initializing page
+ cp "$initializing_page" /var/www/html/index.nginx-debian.html
+ # Start nginx page to display the Appsmith is Initializing page
+ nginx
+ # Update editor nginx page for starting page
+ cp "$starting_page" "$editor_load_page"
+}
+
# Main Section
+init_loading_pages
init_env_file
setup_proxy_variables
unset_unused_variables
@@ -413,7 +429,10 @@ fi
mkdir -p /appsmith-stacks/data/{backup,restore}
# Create sub-directory to store services log in the container mounting folder
-mkdir -p /appsmith-stacks/logs/{backend,cron,editor,rts,mongodb,redis,postgres}
+mkdir -p /appsmith-stacks/logs/{backend,cron,editor,rts,mongodb,redis,postgres,appsmithctl}
+
+# Stop nginx gracefully
+nginx -s quit
# Handle CMD command
exec "$@"
diff --git a/deploy/docker/scripts/supervisor_event_listener.py b/deploy/docker/scripts/supervisor_event_listener.py
new file mode 100644
index 000000000000..5b659dddc1e0
--- /dev/null
+++ b/deploy/docker/scripts/supervisor_event_listener.py
@@ -0,0 +1,74 @@
+import os
+import requests
+import sys
+import shutil
+import time
+
+LOADING_TEMPLATE_PAGE = r'/opt/appsmith/templates/appsmith_starting.html'
+LOADING_PAGE_EDITOR = r'/opt/appsmith/editor/loading.html'
+BACKEND_HEALTH_ENDPOINT = "http://localhost/api/v1/health"
+
+def write_stdout(s):
+ # only eventlistener protocol messages may be sent to stdout
+ sys.stdout.write(s)
+ sys.stdout.flush()
+
+def write_stderr(s):
+ sys.stderr.write(s)
+ sys.stderr.flush()
+
+def wait_until_backend_healthy():
+ sleep_sec = 3
+ timeout_sec = 120
+ for _ in range(timeout_sec//sleep_sec):
+ if requests.get(BACKEND_HEALTH_ENDPOINT).ok:
+ write_stderr('\nBackend is healthy\n')
+ break
+ time.sleep(sleep_sec)
+
+ else:
+ write_stderr('\nBackend health check timed out\n')
+
+ remove_loading_page()
+
+def remove_loading_page():
+ if os.path.exists(LOADING_PAGE_EDITOR):
+ os.remove(LOADING_PAGE_EDITOR)
+
+def main():
+ while True:
+ # transition from ACKNOWLEDGED to READY
+ write_stdout('READY\n')
+
+ # read header line and print it to stderr
+ line = sys.stdin.readline()
+ write_stderr(line)
+
+ # read event payload and print it to stderr
+ headers = dict(x.split(':', 1) for x in line.split())
+ data = sys.stdin.read(int(headers['len']))
+
+ if 'PROCESS_STATE_STARTING' in line:
+ data_params = dict([ x.split(':') for x in data.split()])
+ if data_params['groupname'] == 'backend':
+ write_stderr('\nBackend State: STARTING\n')
+ shutil.copyfile(LOADING_TEMPLATE_PAGE, LOADING_PAGE_EDITOR)
+
+ elif 'PROCESS_STATE_RUNNING' in line:
+ data_params = dict([ x.split(':') for x in data.split()])
+ if data_params['groupname'] == 'backend':
+ write_stderr('\nBackend State: RUNNING\n')
+ wait_until_backend_healthy()
+ write_stderr(data)
+
+ elif 'PROCESS_STATE_FATAL' in line:
+ data_params = dict([ x.split(':') for x in data.split()])
+ if data_params['groupname'] == 'backend':
+ write_stderr('\nBackend State: FATAL\n')
+ remove_loading_page()
+
+ # transition from READY to ACKNOWLEDGED
+ write_stdout('RESULT 2\nOK')
+
+if __name__ == '__main__':
+ main()
diff --git a/deploy/docker/templates/appsmith_initializing.html b/deploy/docker/templates/appsmith_initializing.html
new file mode 100644
index 000000000000..fba1f0dab20f
--- /dev/null
+++ b/deploy/docker/templates/appsmith_initializing.html
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" http-equiv="refresh" content="5"/>
+ <link
+ rel="shortcut icon"
+ href="https://assets.appsmith.com/appsmith-favicon-orange.ico"
+ />
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1, shrink-to-fit=no"
+ />
+ <title>Appsmith</title>
+ </head>
+ <body>
+ <div class="main">
+ <p class="bold-text">
+ Please wait
+ </p>
+ <p>Appsmith is initializing. This might take a few minutes.</p>
+ <div class="loader"></div>
+ </div>
+
+ <style>
+ body,
+ html {
+ height: 100%;
+ overflow-x: hidden;
+ width: 100%;
+ background-color: #fff;
+ margin: 0;
+ color: #182026;
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
+ Ubuntu, Cantarell, Open Sans, Helvetica Neue, Icons16, sans-serif;
+ font-size: 14px;
+ font-weight: 400;
+ letter-spacing: 0;
+ }
+ .main {
+ display: flex;
+ align-items: center;
+ height: 90%;
+ flex-direction: column;
+ margin-top: 5%;
+ text-align: center;
+ }
+ .bold-text {
+ font-family: system-ui;
+ font-weight: 700;
+ font-size: 24px;
+ margin: 24px 0 0;
+ }
+ .body-text {
+ margin: 8px 0 0;
+ }
+
+ /* Safari */
+ @-webkit-keyframes spin {
+ 0% {
+ -webkit-transform: rotate(0deg);
+ }
+ 100% {
+ -webkit-transform: rotate(360deg);
+ }
+ }
+
+ @keyframes spin {
+ 0% {
+ transform: rotate(0deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+ }
+
+ .loader {
+ border: 4px solid #f3f3f3;
+ border-radius: 50%;
+ border-top: 4px solid #939090;
+ width: 30px;
+ height: 30px;
+ -webkit-animation: spin 1s linear infinite; /* Safari */
+ animation: spin 1s linear infinite;
+ }
+ </style>
+ </body>
+</html>
diff --git a/deploy/docker/templates/appsmith_starting.html b/deploy/docker/templates/appsmith_starting.html
new file mode 100644
index 000000000000..007a0dfce28a
--- /dev/null
+++ b/deploy/docker/templates/appsmith_starting.html
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" http-equiv="refresh" content="3"/>
+ <link
+ rel="shortcut icon"
+ href="https://assets.appsmith.com/appsmith-favicon-orange.ico"
+ />
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1, shrink-to-fit=no"
+ />
+ <title>Appsmith</title>
+ </head>
+ <body>
+ <div class="main">
+ <p class="bold-text">
+ Appsmith is starting.
+ </p>
+ <p>Please wait until Appsmith is ready. This process usually takes a minute. </p>
+ <div class="loader"></div>
+ </div>
+
+ <style>
+ body,
+ html {
+ height: 100%;
+ overflow-x: hidden;
+ width: 100%;
+ background-color: #fff;
+ margin: 0;
+ color: #182026;
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
+ Ubuntu, Cantarell, Open Sans, Helvetica Neue, Icons16, sans-serif;
+ font-size: 14px;
+ font-weight: 400;
+ letter-spacing: 0;
+ }
+ .main {
+ display: flex;
+ align-items: center;
+ height: 90%;
+ flex-direction: column;
+ margin-top: 5%;
+ text-align: center;
+ }
+ .bold-text {
+ font-family: system-ui;
+ font-weight: 700;
+ font-size: 24px;
+ margin: 24px 0 0;
+ }
+ .body-text {
+ margin: 8px 0 0;
+ }
+
+ /* Safari */
+ @-webkit-keyframes spin {
+ 0% {
+ -webkit-transform: rotate(0deg);
+ }
+ 100% {
+ -webkit-transform: rotate(360deg);
+ }
+ }
+
+ @keyframes spin {
+ 0% {
+ transform: rotate(0deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+ }
+
+ .loader {
+ border: 4px solid #f3f3f3;
+ border-radius: 50%;
+ border-top: 4px solid #939090;
+ width: 30px;
+ height: 30px;
+ -webkit-animation: spin 1s linear infinite; /* Safari */
+ animation: spin 1s linear infinite;
+ }
+ </style>
+ </body>
+</html>
diff --git a/deploy/docker/templates/nginx/nginx-app-http.conf.template.sh b/deploy/docker/templates/nginx/nginx-app-http.conf.template.sh
index 44ba7c763dd5..8311fd337e6a 100644
--- a/deploy/docker/templates/nginx/nginx-app-http.conf.template.sh
+++ b/deploy/docker/templates/nginx/nginx-app-http.conf.template.sh
@@ -70,7 +70,7 @@ server {
proxy_set_header X-Forwarded-Host \$origin_host;
location / {
- try_files \$uri /index.html =404;
+ try_files /loading.html \$uri /index.html =404;
}
location ~ ^/static/(js|css|media)\b {
diff --git a/deploy/docker/templates/nginx/nginx-app-https.conf.template.sh b/deploy/docker/templates/nginx/nginx-app-https.conf.template.sh
index 875ac373fc6a..94c9e995dee6 100644
--- a/deploy/docker/templates/nginx/nginx-app-https.conf.template.sh
+++ b/deploy/docker/templates/nginx/nginx-app-https.conf.template.sh
@@ -87,7 +87,7 @@ server {
}
location / {
- try_files \$uri /index.html =404;
+ try_files /loading.html \$uri /index.html =404;
}
location ~ ^/static/(js|css|media)\b {
diff --git a/deploy/docker/templates/supervisord/application_process/backend.conf b/deploy/docker/templates/supervisord/application_process/backend.conf
index 0c99eeb16663..64ecaca2aa87 100644
--- a/deploy/docker/templates/supervisord/application_process/backend.conf
+++ b/deploy/docker/templates/supervisord/application_process/backend.conf
@@ -4,7 +4,7 @@ command=/opt/appsmith/run-with-env.sh /opt/appsmith/run-java.sh
priority=20
autostart=true
autorestart=true
-startsecs=10
+startsecs=20
startretries=3
stdout_logfile=/appsmith-stacks/logs/%(program_name)s/%(program_name)s-%(ENV_HOSTNAME)s.log
redirect_stderr=true
diff --git a/deploy/docker/templates/supervisord/event_listeners/eventlistener.conf b/deploy/docker/templates/supervisord/event_listeners/eventlistener.conf
new file mode 100644
index 000000000000..4b9be55ee8ec
--- /dev/null
+++ b/deploy/docker/templates/supervisord/event_listeners/eventlistener.conf
@@ -0,0 +1,5 @@
+[eventlistener:event_listener]
+command=python3 /opt/appsmith/supervisor_event_listener.py
+events=PROCESS_STATE
+stderr_logfile=/appsmith-stacks/logs/appsmithctl/eventlistener.log
+priority=1
\ No newline at end of file
|
a763a226a37d295a1676fb04ea8fa30a5e5368f7
|
2024-03-29 07:40:28
|
Nidhi
|
fix: Make sure order of vertices does not make opl calculations flaky (#32227)
| false
|
Make sure order of vertices does not make opl calculations flaky (#32227)
|
fix
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java
index 23f6dd507774..a998a695ffe2 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java
@@ -39,7 +39,6 @@
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -703,11 +702,11 @@ private DirectedAcyclicGraph<String, DefaultEdge> constructDAG(
Set<String> vertices = Set.of(source, target);
- AtomicReference<Boolean> isValidVertex = new AtomicReference<>(true);
+ boolean isValidEdge = true;
// Assert that the vertices which are entire property paths have a possible parent which is either
// an executable or a widget or a static variable provided by appsmith at page/application level.
- vertices.stream().forEach(vertex -> {
+ for (String vertex : vertices) {
Optional<String> validEntity = getPossibleParents(vertex).stream()
.filter(parent -> {
if (!executableNames.contains(parent)
@@ -718,17 +717,15 @@ private DirectedAcyclicGraph<String, DefaultEdge> constructDAG(
return true;
})
.findFirst();
-
// If any of the generated entity names from the path are valid appsmith entity name,
// the vertex is considered valid
- if (validEntity.isPresent()) {
- isValidVertex.set(TRUE);
- } else {
- isValidVertex.set(FALSE);
+ if (!validEntity.isPresent()) {
+ isValidEdge = FALSE;
+ break;
}
- });
+ }
- return isValidVertex.get();
+ return isValidEdge;
})
.collect(Collectors.toSet());
@@ -831,10 +828,10 @@ private List<Set<String>> computeOnPageLoadExecutablesSchedulingOrder(
BreadthFirstIterator<String, DefaultEdge> bfsIterator = new BreadthFirstIterator<>(dag, rootNodes);
- // Implementation of offline scheduler by using level by level traversal. Level i+1 executables would be
- // dependent
- // on Level i executables. All executables in a level can run independently and hence would get added to the
- // same set.
+ // Implementation of offline scheduler by using level by level traversal.
+ // Level i+1 executables would be dependent on Level i executables.
+ // All executables in a level can run independently
+ // and hence would get added to the same set.
while (bfsIterator.hasNext()) {
String vertex = bfsIterator.next();
|
057817d393e9014db659e7a78fa2a85305bee51e
|
2022-04-04 17:11:49
|
f0c1s
|
feat: migration changes hint (#12071)
| false
|
migration changes hint (#12071)
|
feat
|
diff --git a/app/client/src/assets/icons/ads/js.svg b/app/client/src/assets/icons/ads/js.svg
new file mode 100644
index 000000000000..8dbdbebc9122
--- /dev/null
+++ b/app/client/src/assets/icons/ads/js.svg
@@ -0,0 +1,5 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M4.8 20.2V3.8H12H15.1686L17.4343 6.06569L19.2 7.83137V12V20.2H4.8Z" fill="#ffffff" stroke="#575757" stroke-width="1.6"/>
+ <path d="M7.25391 16.0625C7.25391 17.3672 8.10938 18.1562 9.47656 18.1562C10.8438 18.1562 11.6641 17.4297 11.6641 16.1055V12.3633H10.0078V16.0938C10.0078 16.5352 9.8125 16.7695 9.44922 16.7695C9.07422 16.7695 8.83984 16.5039 8.83984 16.0625H7.25391Z" fill="#575757"/>
+ <path d="M12.7227 16.3555C12.7305 17.4727 13.6484 18.1562 15.1445 18.1562C16.6836 18.1562 17.6055 17.4297 17.6055 16.2109C17.6055 15.2969 17.0977 14.7773 16 14.5859L15.2305 14.4531C14.6914 14.3594 14.4609 14.2031 14.4609 13.9336C14.4609 13.6211 14.7422 13.4258 15.1719 13.4258C15.6133 13.4258 15.9609 13.6836 15.9727 14.0234H17.4883C17.4766 12.9414 16.5273 12.207 15.1367 12.207C13.7266 12.207 12.8164 12.9492 12.8164 14.0977C12.8164 15.0078 13.3789 15.6016 14.4141 15.7812L15.1602 15.9141C15.7656 16.0234 15.9766 16.1484 15.9766 16.4102C15.9766 16.7266 15.668 16.9336 15.2031 16.9336C14.6719 16.9336 14.3125 16.707 14.293 16.3555H12.7227Z" fill="#575757"/>
+</svg>
diff --git a/app/client/src/ce/constants/messages.test.ts b/app/client/src/ce/constants/messages.test.ts
index f7780e4fb253..2f29afcf174f 100644
--- a/app/client/src/ce/constants/messages.test.ts
+++ b/app/client/src/ce/constants/messages.test.ts
@@ -1,6 +1,9 @@
import {
CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES,
CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES,
+ CHANGES_ONLY_MIGRATION,
+ CHANGES_ONLY_USER,
+ CHANGES_USER_AND_MIGRATION,
COMMIT_AND_PUSH,
COMMIT_CHANGES,
COMMIT_TO,
@@ -256,10 +259,25 @@ describe("git-sync messages", () => {
key: "ERROR_GIT_INVALID_REMOTE",
value: "Remote repo doesn't exist or is unreachable.",
},
+ {
+ key: "CHANGES_ONLY_USER",
+ value: "Changes since last commit",
+ },
+ {
+ key: "CHANGES_ONLY_MIGRATION",
+ value: "Appsmith update changes since last commit",
+ },
+ {
+ key: "CHANGES_USER_AND_MIGRATION",
+ value: "Appsmith update and user changes since last commit",
+ },
];
const functions = [
CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES,
CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES,
+ CHANGES_ONLY_MIGRATION,
+ CHANGES_ONLY_USER,
+ CHANGES_USER_AND_MIGRATION,
COMMITTING_AND_PUSHING_CHANGES,
COMMIT_AND_PUSH,
COMMIT_CHANGES,
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index 8f7d8c642983..0799f7d7518d 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -588,7 +588,6 @@ export const GIT_DISCONNECT_POPUP_MAIN_HEADING = () => `Are you sure ?`;
export const GIT_CONNECTION = () => "Git Connection";
export const GIT_IMPORT = () => "Git Import";
-export const DEPLOY = () => "Deploy";
export const MERGE = () => "Merge";
export const GIT_SETTINGS = () => "Git Settings";
export const CONNECT_TO_GIT = () => "Connect to git repository";
@@ -618,7 +617,6 @@ export const CHECK_DP = () => "CHECK";
export const DEPLOY_TO_CLOUD = () => "Deploy to cloud";
export const DEPLOY_WITHOUT_GIT = () =>
"Deploy your application without version control";
-export const DEPLOY_YOUR_APPLICATION = () => "Deploy your application";
export const COMMIT_CHANGES = () => "Commit changes";
export const COMMIT_TO = () => "Commit to";
export const COMMIT_AND_PUSH = () => "Commit & push";
@@ -735,6 +733,16 @@ export const CONNECTING_TO_REPO_DISABLED = () =>
export const DURING_ONBOARDING_TOUR = () => "during the onboarding tour";
export const MERGED_SUCCESSFULLY = () => "Merged successfully";
+// GIT DEPLOY begin
+export const DEPLOY = () => "Deploy";
+export const DEPLOY_YOUR_APPLICATION = () => "Deploy your application";
+export const CHANGES_ONLY_USER = () => "Changes since last commit";
+export const CHANGES_ONLY_MIGRATION = () =>
+ "Appsmith update changes since last commit";
+export const CHANGES_USER_AND_MIGRATION = () =>
+ "Appsmith update and user changes since last commit";
+// GIT DEPLOY end
+
// GIT ERRORS begin
export const ERROR_GIT_AUTH_FAIL = () =>
"Please make sure that regenerated SSH key is added and has write access to the repo.";
diff --git a/app/client/src/components/ads/Icon.tsx b/app/client/src/components/ads/Icon.tsx
index 99a435127ece..e3f62ae10085 100644
--- a/app/client/src/components/ads/Icon.tsx
+++ b/app/client/src/components/ads/Icon.tsx
@@ -70,9 +70,10 @@ import { ReactComponent as WorkspaceIcon } from "assets/icons/ads/organizationIc
import { ReactComponent as SettingIcon } from "assets/icons/control/settings.svg";
import { ReactComponent as DropdownIcon } from "assets/icons/ads/dropdown.svg";
import { ReactComponent as ChatIcon } from "assets/icons/ads/app-icons/chat.svg";
+import { ReactComponent as JsIcon } from "assets/icons/ads/js.svg";
import styled from "styled-components";
-import { CommonComponentProps, Classes } from "./common";
+import { Classes, CommonComponentProps } from "./common";
import { noop } from "lodash";
import { theme } from "constants/DefaultTheme";
import Spinner from "./Spinner";
@@ -90,6 +91,7 @@ import CheckLineIcon from "remixicon-react/CheckLineIcon";
import CloseLineIcon from "remixicon-react/CloseLineIcon";
import CloseCircleIcon from "remixicon-react/CloseCircleFillIcon";
import CommentContextMenu from "remixicon-react/More2FillIcon";
+import More2FillIcon from "remixicon-react/More2FillIcon";
import CompassesLine from "remixicon-react/CompassesLineIcon";
import ContextMenuIcon from "remixicon-react/MoreFillIcon";
import CreateNewIcon from "remixicon-react/AddLineIcon";
@@ -102,8 +104,10 @@ import Download from "remixicon-react/DownloadCloud2LineIcon";
import DuplicateIcon from "remixicon-react/FileCopyLineIcon";
import EditIcon from "remixicon-react/PencilFillIcon";
import EditLineIcon from "remixicon-react/EditLineIcon";
+import EditUnderlineIcon from "remixicon-react/EditLineIcon";
import Emoji from "remixicon-react/EmotionLineIcon";
import ExpandMore from "remixicon-react/ArrowDownSLineIcon";
+import DownArrowIcon from "remixicon-react/ArrowDownSLineIcon";
import ExpandLess from "remixicon-react/ArrowUpSLineIcon";
import EyeOn from "remixicon-react/EyeLineIcon";
import EyeOff from "remixicon-react/EyeOffLineIcon";
@@ -122,7 +126,6 @@ import KeyIcon from "remixicon-react/Key2LineIcon";
import LeftArrowIcon2 from "remixicon-react/ArrowLeftSLineIcon";
import Link2 from "remixicon-react/LinkIcon";
import LeftArrowIcon from "remixicon-react/ArrowLeftLineIcon";
-import More2FillIcon from "remixicon-react/More2FillIcon";
import NewsPaperLine from "remixicon-react/NewspaperLineIcon";
import OvalCheck from "remixicon-react/CheckboxCircleLineIcon";
import OvalCheckFill from "remixicon-react/CheckboxCircleFillIcon";
@@ -137,10 +140,8 @@ import Trash from "remixicon-react/DeleteBinLineIcon";
import UpArrow from "remixicon-react/ArrowUpSFillIcon";
import WarningIcon from "remixicon-react/ErrorWarningFillIcon";
import WarningLineIcon from "remixicon-react/ErrorWarningLineIcon";
-import EditUnderlineIcon from "remixicon-react/EditLineIcon";
import LogoutIcon from "remixicon-react/LogoutBoxRLineIcon";
import ShareLineIcon from "remixicon-react/ShareLineIcon";
-import DownArrowIcon from "remixicon-react/ArrowDownSLineIcon";
import LoaderLineIcon from "remixicon-react/LoaderLineIcon";
import WidgetIcon from "remixicon-react/FunctionLineIcon";
import RefreshLineIcon from "remixicon-react/RefreshLineIcon";
@@ -344,6 +345,7 @@ const ICON_LOOKUP = {
hamburger: <HamburgerIcon />,
help: <HelpIcon />,
info: <InfoIcon />,
+ js: <JsIcon />,
key: <KeyIcon />,
lightning: <LightningIcon />,
link: <LinkIcon />,
diff --git a/app/client/src/constants/ReduxActionConstants.tsx b/app/client/src/constants/ReduxActionConstants.tsx
index d99c022acbd0..84030fc0db83 100644
--- a/app/client/src/constants/ReduxActionConstants.tsx
+++ b/app/client/src/constants/ReduxActionConstants.tsx
@@ -683,8 +683,8 @@ export const ReduxActionTypes = {
SET_TEMPLATE_NOTIFICATION_SEEN: "SET_TEMPLATE_NOTIFICATION_SEEN",
GET_TEMPLATE_NOTIFICATION_SEEN: "GET_TEMPLATE_NOTIFICATION_SEEN",
GET_SIMILAR_TEMPLATES_INIT: "GET_SIMILAR_TEMPLATES_INIT",
- GET_SIMILAR_TEMPLATES_SUCCESS: "GET_SIMILAR_TEMPLATES_SUCCESS",
- /* This action constants is for identifying the status of the updates of the entities */
+ GET_SIMILAR_TEMPLATES_SUCCESS:
+ "GET_SIMILAR_TEMPLATES_SUCCESS" /* This action constants is for identifying the status of the updates of the entities */,
ENTITY_UPDATE_STARTED: "ENTITY_UPDATE_STARTED",
ENTITY_UPDATE_SUCCESS: "ENTITY_UPDATE_SUCCESS",
FETCH_PLUGIN_AND_JS_ACTIONS_SUCCESS: "FETCH_PLUGIN_AND_JS_ACTIONS_SUCCESS",
@@ -925,6 +925,7 @@ export interface PromisePayload {
reject: any;
resolve: any;
}
+
export interface ReduxActionWithPromise<T> extends ReduxAction<T> {
payload: T & PromisePayload;
}
@@ -989,6 +990,8 @@ export interface ApplicationPayload {
modifiedAt?: string;
pages: ApplicationPagePayload[];
applicationVersion: ApplicationVersion;
+ isAutoUpdate?: boolean;
+ isManualUpdate?: boolean;
}
export type OrganizationDetails = {
diff --git a/app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.test.tsx b/app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.test.tsx
new file mode 100644
index 000000000000..58fa702ca020
--- /dev/null
+++ b/app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.test.tsx
@@ -0,0 +1,17 @@
+import { render, screen } from "test/testUtils";
+import BranchButton from "./BranchButton";
+import React from "react";
+
+describe("BranchButton", () => {
+ it("renders properly", async () => {
+ render(<BranchButton />);
+ const buttonContainer = await screen.queryByTestId(
+ "t--branch-button-container",
+ );
+ expect(buttonContainer).not.toBeNull();
+ const currentBranch = await screen.queryByTestId(
+ "t--branch-button-currentBranch",
+ );
+ expect(currentBranch?.innerHTML).toContain("*");
+ });
+});
diff --git a/app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.tsx b/app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.tsx
index c59e31fd4b65..241b1cfd2d81 100644
--- a/app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.tsx
+++ b/app/client/src/pages/Editor/gitSync/QuickGitActions/BranchButton.tsx
@@ -20,19 +20,24 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
const ButtonContainer = styled.div`
display: flex;
align-items: center;
+
& .label {
color: ${(props) => props.theme.colors.editorBottomBar.branchBtnText};
${(props) => getTypographyByKey(props, "p1")};
line-height: 18px;
}
+
& .icon {
height: 24px;
}
+
margin: 0 ${(props) => props.theme.spaces[4]}px;
cursor: pointer;
+
&:hover svg path {
fill: ${Colors.CHARCOAL};
}
+
& .label {
width: 100px;
overflow: hidden;
@@ -57,6 +62,7 @@ function BranchButton() {
return (
<Popover2
content={<BranchList setIsPopupOpen={setIsOpen} />}
+ data-testid={"t--git-branch-button-popover"}
hasBackdrop
isOpen={isOpen}
minimal
@@ -78,11 +84,18 @@ function BranchButton() {
hoverOpenDelay={1}
position={Position.TOP_LEFT}
>
- <ButtonContainer className="t--branch-button">
+ <ButtonContainer
+ className="t--branch-button"
+ data-testid={"t--branch-button-container"}
+ >
<div className="icon">
<Icon name="git-branch" size={IconSize.XXXXL} />
</div>
- <div className="label" ref={labelTarget}>
+ <div
+ className="label"
+ data-testid={"t--branch-button-currentBranch"}
+ ref={labelTarget}
+ >
{currentBranch}
{!status?.isClean && "*"}
</div>
diff --git a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx
index d76bd9c6ecc4..2ade4e6bddc5 100644
--- a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx
+++ b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx
@@ -72,18 +72,19 @@ const QuickActionButtonContainer = styled.div<{ disabled?: boolean }>`
.count {
position: absolute;
- width: 20px;
- height: 20px;
+ height: ${(props) => props.theme.spaces[7]}px;
display: flex;
justify-content: center;
align-items: center;
color: ${Colors.WHITE};
background-color: ${Colors.BLACK};
- top: -8px;
- left: 18px;
- border-radius: 50%;
+ top: ${(props) => -1 * props.theme.spaces[3]}px;
+ left: ${(props) => props.theme.spaces[8]}px;
+ border-radius: ${(props) => props.theme.spaces[3]}px;
${(props) => getTypographyByKey(props, "p3")};
z-index: 1;
+ padding: ${(props) => props.theme.spaces[1]}px
+ ${(props) => props.theme.spaces[2]}px;
}
`;
@@ -91,15 +92,6 @@ const capitalizeFirstLetter = (string = " ") => {
return string.charAt(0).toUpperCase() + string.toLowerCase().slice(1);
};
-// const SpinnerContainer = styled.div`
-// margin-left: ${(props) => props.theme.spaces[2]}px;
-// display: flex;
-// align-items: center;
-// justify-content: center;
-// width: 29px;
-// height: 26px;
-// `;
-
function QuickActionButton({
className = "",
count = 0,
diff --git a/app/client/src/pages/Editor/gitSync/Tabs/Deploy.tsx b/app/client/src/pages/Editor/gitSync/Tabs/Deploy.tsx
index e541d4686924..ec9f92ba315e 100644
--- a/app/client/src/pages/Editor/gitSync/Tabs/Deploy.tsx
+++ b/app/client/src/pages/Editor/gitSync/Tabs/Deploy.tsx
@@ -1,11 +1,14 @@
import React, { useEffect, useRef, useState } from "react";
-import { Title } from "../components/StyledComponents";
+import { Space, Title } from "../components/StyledComponents";
import {
- DEPLOY_YOUR_APPLICATION,
- COMMIT_TO,
- createMessage,
+ CHANGES_ONLY_MIGRATION,
+ CHANGES_ONLY_USER,
+ CHANGES_USER_AND_MIGRATION,
COMMIT_AND_PUSH,
+ COMMIT_TO,
COMMITTING_AND_PUSHING_CHANGES,
+ createMessage,
+ DEPLOY_YOUR_APPLICATION,
FETCH_GIT_STATUS,
GIT_NO_UPDATED_TOOLTIP,
GIT_UPSTREAM_CHANGES,
@@ -18,18 +21,17 @@ import Button, { Size } from "components/ads/Button";
import { LabelContainer } from "components/ads/Checkbox";
import {
+ getConflictFoundDocUrlDeploy,
+ getGitCommitAndPushError,
getGitStatus,
- getIsFetchingGitStatus,
+ getIsCommitSuccessful,
getIsCommittingInProgress,
+ getIsFetchingGitStatus,
getIsPullingProgress,
getPullFailed,
- getGitCommitAndPushError,
getUpstreamErrorDocUrl,
- getConflictFoundDocUrlDeploy,
} from "selectors/gitSyncSelectors";
import { useDispatch, useSelector } from "react-redux";
-
-import { Space } from "../components/StyledComponents";
import { Colors } from "constants/Colors";
import { getTypographyByKey, Theme } from "constants/DefaultTheme";
@@ -40,7 +42,6 @@ import {
fetchGitStatusInit,
gitPullInit,
} from "actions/gitSyncActions";
-import { getIsCommitSuccessful } from "selectors/gitSyncSelectors";
import StatusLoader from "../components/StatusLoader";
import { clearCommitSuccessfulState } from "../../../../actions/gitSyncActions";
import Statusbar, {
@@ -56,11 +57,15 @@ import Icon, { IconSize } from "components/ads/Icon";
import { isMac } from "utils/helpers";
import AnalyticsUtil from "utils/AnalyticsUtil";
-import { getApplicationLastDeployedAt } from "selectors/editorSelectors";
+import {
+ getApplicationLastDeployedAt,
+ getCurrentApplication,
+} from "selectors/editorSelectors";
import GIT_ERROR_CODES from "constants/GitErrorCodes";
import useAutoGrow from "utils/hooks/useAutoGrow";
const Section = styled.div`
+ margin-top: ${(props) => props.theme.spaces[11]}px;
margin-bottom: ${(props) => props.theme.spaces[11]}px;
`;
@@ -132,9 +137,21 @@ function Deploy() {
const currentBranch = gitMetaData?.branchName;
const dispatch = useDispatch();
+ const currentApplication = useSelector(getCurrentApplication);
+ const isAutoUpdate = currentApplication?.isAutoUpdate || false;
+ const isManualUpdate = currentApplication?.isManualUpdate || true;
+ const changeReason = isAutoUpdate
+ ? isManualUpdate
+ ? CHANGES_USER_AND_MIGRATION
+ : CHANGES_ONLY_MIGRATION
+ : CHANGES_ONLY_USER;
+ const changeReasonText = createMessage(changeReason);
+
const handleCommit = (doPush: boolean) => {
AnalyticsUtil.logEvent("GS_COMMIT_AND_PUSH_BUTTON_CLICK", {
source: "GIT_DEPLOY_MODAL",
+ isAutoUpdate,
+ isManualUpdate,
});
if (currentBranch) {
dispatch(
@@ -197,9 +214,15 @@ function Deploy() {
const autogrowHeight = useAutoGrow(commitMessageDisplay, 37);
return (
- <Container>
+ <Container data-testid={"t--deploy-tab-container"}>
<Title>{createMessage(DEPLOY_YOUR_APPLICATION)}</Title>
<Section>
+ <Text
+ data-testid={"t--git-deploy-change-reason-text"}
+ type={TextType.P1}
+ >
+ {changeReasonText}
+ </Text>
<GitChanged />
<Row>
<SectionTitle>
diff --git a/app/client/src/pages/Editor/gitSync/components/GitChanged.tsx b/app/client/src/pages/Editor/gitSync/components/GitChanged.tsx
index fd741df21d3e..ecab2133b7f5 100644
--- a/app/client/src/pages/Editor/gitSync/components/GitChanged.tsx
+++ b/app/client/src/pages/Editor/gitSync/components/GitChanged.tsx
@@ -3,97 +3,132 @@ import styled from "constants/DefaultTheme";
import { Classes } from "components/ads/common";
import Text, { TextType } from "components/ads/Text";
import { Colors } from "constants/Colors";
-import Icon, { IconName, IconSize } from "components/ads/Icon";
+import Icon, { IconSize } from "components/ads/Icon";
import { useSelector } from "react-redux";
import {
getGitStatus,
getIsFetchingGitStatus,
} from "selectors/gitSyncSelectors";
+import { GitStatusData } from "../../../../reducers/uiReducers/gitSyncReducer";
-const Skeleton = styled.div`
- width: 135px;
+const DummyChange = styled.div`
+ width: 50%;
height: ${(props) => props.theme.spaces[9]}px;
background: linear-gradient(
90deg,
${Colors.GREY_2} 0%,
rgba(240, 240, 240, 0) 100%
);
- margin-right: ${(props) => props.theme.spaces[8] + 5}px;
+ margin-top: ${(props) => props.theme.spaces[7]}px;
+ margin-bottom: ${(props) => props.theme.spaces[7]}px;
`;
const Wrapper = styled.div`
- width: 178px;
height: ${(props) => props.theme.spaces[9]}px;
+ margin-bottom: ${(props) => props.theme.spaces[7]}px;
display: flex;
+
.${Classes.ICON} {
margin-right: ${(props) => props.theme.spaces[3]}px;
}
+
.${Classes.TEXT} {
padding-top: ${(props) => props.theme.spaces[1] - 2}px;
}
`;
-const GitChangedRow = styled.div`
- display: flex;
- align-items: center;
+const Statuses = styled.div`
+ margin-top: ${(props) => props.theme.spaces[7]}px;
margin-bottom: ${(props) => props.theme.spaces[11]}px;
`;
export enum Kind {
- widget = "widget",
- query = "query",
- commit = "commit",
- // pullRequest = "pullRequest",
+ WIDGET = "WIDGET",
+ QUERY = "QUERY",
+ COMMIT = "COMMIT",
+ JS_OBJECT = "JS_OBJECT",
}
-type GitSyncProps = {
- type: Kind;
+type StatusProps = {
+ iconName: string;
+ message: string;
+ hasValue: boolean;
};
-function GitStatus(props: GitSyncProps) {
- const { type } = props;
- const status: any = useSelector(getGitStatus);
- const loading = useSelector(getIsFetchingGitStatus);
- // const loading = true;
- let message = "",
- iconName: IconName;
- switch (type) {
- case Kind.widget:
- message = `${status?.modifiedPages || 0} page${
- (status?.modifiedPages || 0) === 1 ? "" : "s"
- } updated`;
- iconName = "widget";
- break;
- case Kind.query:
- message = `${status?.modifiedQueries || 0} ${
- (status?.modifiedQueries || 0) === 1 ? "query" : "queries"
- } modified`;
- iconName = "query";
- break;
- case Kind.commit:
- message = `${status?.aheadCount || 0} commit${
- (status?.aheadCount || 0) === 1 ? "" : "s"
- } to push`;
- iconName = "git-commit";
- break;
- }
- return loading ? (
- <Skeleton />
- ) : (
+type StatusMap = {
+ [key in Kind]: (status: GitStatusData) => StatusProps;
+};
+
+const STATUS_MAP: StatusMap = {
+ [Kind.WIDGET]: (status: GitStatusData) => ({
+ message: `${status?.modifiedPages || 0} ${
+ (status?.modifiedPages || 0) <= 1 ? "page" : "pages"
+ } updated`,
+ iconName: "widget",
+ hasValue: (status?.modifiedPages || 0) > 0,
+ }),
+ [Kind.QUERY]: (status: GitStatusData) => ({
+ message: `${status?.modifiedQueries || 0} ${
+ (status?.modifiedQueries || 0) <= 1 ? "query" : "queries"
+ } modified`,
+ iconName: "query",
+ hasValue: (status?.modifiedQueries || 0) > 0,
+ }),
+ [Kind.COMMIT]: (status: GitStatusData) => ({
+ message: commitMessage(status),
+ iconName: "git-commit",
+ hasValue: (status?.aheadCount || 0) > 0 || (status?.behindCount || 0) > 0,
+ }),
+ [Kind.JS_OBJECT]: (status: GitStatusData) => ({
+ message: `${status?.modifiedJSObjects || 0} JS ${
+ (status?.modifiedJSObjects || 0) <= 1 ? "Object" : "Objects"
+ } modified`,
+ iconName: "js",
+ hasValue: (status?.modifiedJSObjects || 0) > 0,
+ }),
+};
+
+function commitMessage(status: GitStatusData) {
+ const aheadCount = status?.aheadCount || 0;
+ const behindCount = status?.behindCount || 0;
+ const aheadMessage =
+ aheadCount > 0
+ ? (aheadCount || 0) === 1
+ ? `${aheadCount || 0} commit ahead`
+ : `${aheadCount || 0} commits ahead`
+ : null;
+ const behindMessage =
+ behindCount > 0
+ ? (behindCount || 0) === 1
+ ? `${behindCount || 0} commit behind`
+ : `${behindCount || 0} commits behind `
+ : null;
+ return [aheadMessage, behindMessage].filter((i) => i !== null).join(" and ");
+}
+
+function Status(props: Partial<StatusProps>) {
+ const { iconName, message } = props;
+
+ return (
<Wrapper>
- <Icon fillColor={Colors.GREY_10} name={iconName} size={IconSize.XXL} />
+ <Icon name={iconName} size={IconSize.XXL} />
<Text type={TextType.P3}>{message}</Text>
</Wrapper>
);
}
export default function GitChanged() {
- const gitStatus: any = useSelector(getGitStatus);
- return (
- <GitChangedRow>
- <GitStatus type={Kind.widget} />
- <GitStatus type={Kind.query} />
- {gitStatus?.aheadCount > 0 && <GitStatus type={Kind.commit} />}
- </GitChangedRow>
+ const status: GitStatusData = useSelector(getGitStatus) as GitStatusData;
+ const loading = useSelector(getIsFetchingGitStatus);
+ const statuses = [Kind.WIDGET, Kind.QUERY, Kind.COMMIT, Kind.JS_OBJECT]
+ .map((type: Kind) => STATUS_MAP[type](status))
+ .map((s) =>
+ s.hasValue ? <Status {...s} key={`change-status-${s.iconName}`} /> : null,
+ )
+ .filter((s) => !!s);
+ return loading ? (
+ <DummyChange data-testid={"t--git-change-loading-dummy"} />
+ ) : (
+ <Statuses data-testid={"t--git-change-statuses"}>{statuses}</Statuses>
);
}
diff --git a/app/client/src/reducers/uiReducers/gitSyncReducer.ts b/app/client/src/reducers/uiReducers/gitSyncReducer.ts
index 751a1a65c787..05ca1ecff5da 100644
--- a/app/client/src/reducers/uiReducers/gitSyncReducer.ts
+++ b/app/client/src/reducers/uiReducers/gitSyncReducer.ts
@@ -450,6 +450,7 @@ export type GitStatusData = {
modifiedPages: number;
modifiedQueries: number;
remoteBranch: string;
+ modifiedJSObjects: number;
};
type GitErrorPayloadType = {
|
8d696f1c753beea8bce62cb946b158d606458997
|
2024-03-04 14:38:27
|
Anagh Hegde
|
feat: PGSql MTLS support (#31067)
| false
|
PGSql MTLS support (#31067)
|
feat
|
diff --git a/app/server/appsmith-interfaces/pom.xml b/app/server/appsmith-interfaces/pom.xml
index ef5e4621fa18..418de9925e22 100644
--- a/app/server/appsmith-interfaces/pom.xml
+++ b/app/server/appsmith-interfaces/pom.xml
@@ -239,6 +239,13 @@
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core-micrometer</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk18on</artifactId>
+ <version>1.74</version>
+ <scope>compile</scope>
+ </dependency>
+
</dependencies>
<build>
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/RSAKeyUtil.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/RSAKeyUtil.java
new file mode 100644
index 000000000000..0ddfaaaf7a58
--- /dev/null
+++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/RSAKeyUtil.java
@@ -0,0 +1,66 @@
+package com.appsmith.external.helpers;
+
+import org.bouncycastle.asn1.ASN1InputStream;
+import org.bouncycastle.asn1.pkcs.RSAPrivateKey;
+
+import java.security.GeneralSecurityException;
+import java.security.KeyFactory;
+import java.security.PrivateKey;
+import java.security.Security;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.RSAPrivateKeySpec;
+import java.util.Base64;
+
+public class RSAKeyUtil {
+
+ static {
+ Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
+ }
+
+ private static final String PKCS_1_PEM_HEADER = "-----BEGIN RSA PRIVATE KEY-----";
+ private static final String PKCS_1_PEM_FOOTER = "-----END RSA PRIVATE KEY-----";
+
+ private static final String PKCS_8_PEM_HEADER = "-----BEGIN PRIVATE KEY-----";
+ private static final String PKCS_8_PEM_FOOTER = "-----END PRIVATE KEY-----";
+
+ public static boolean isPkcs1Key(String key) {
+ return key.contains(PKCS_1_PEM_HEADER) && key.contains(PKCS_1_PEM_FOOTER);
+ }
+
+ public static String replaceHeaderAndFooterFromKey(String key) {
+ return key.replace(PKCS_1_PEM_HEADER, "")
+ .replace(PKCS_1_PEM_FOOTER, "")
+ .replace(PKCS_8_PEM_HEADER, "")
+ .replace(PKCS_8_PEM_FOOTER, "")
+ .replace("\n", "");
+ }
+
+ public static PrivateKey readPkcs8PrivateKey(byte[] pkcs8Bytes) throws GeneralSecurityException {
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA", "SunRsaSign");
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8Bytes);
+ try {
+ return keyFactory.generatePrivate(keySpec);
+ } catch (InvalidKeySpecException e) {
+ throw new IllegalArgumentException("Unexpected key format! Accepted key formats are pkcs8, pkcs1", e);
+ }
+ }
+
+ public static PrivateKey readPkcs1PrivateKey(String base64EncodedPKCS1) throws Exception {
+ // Decode the Base64-encoded PKCS#1 key
+ byte[] pkcs1KeyBytes = Base64.getDecoder().decode(base64EncodedPKCS1);
+
+ // Use Bouncy Castle's ASN1 classes to parse the ASN.1 structure of the PKCS#1 key
+ ASN1InputStream asn1InputStream = new ASN1InputStream(pkcs1KeyBytes);
+ RSAPrivateKey rsaPrivateKey = RSAPrivateKey.getInstance(asn1InputStream.readObject());
+ asn1InputStream.close();
+
+ // Convert ASN.1 structure to RSAPrivateKeySpec
+ RSAPrivateKeySpec rsaPrivateKeySpec =
+ new RSAPrivateKeySpec(rsaPrivateKey.getModulus(), rsaPrivateKey.getPrivateExponent());
+
+ // Generate the PrivateKey object
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ return keyFactory.generatePrivate(rsaPrivateKeySpec);
+ }
+}
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/SSLDetails.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/SSLDetails.java
index 83fb6714574d..b1700d4dc1db 100644
--- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/SSLDetails.java
+++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/SSLDetails.java
@@ -59,6 +59,7 @@ public enum CACertificateType {
AuthType authType;
+ // For Mutual TLS of datasource integration
CACertificateType caCertificateType;
UploadedFile keyFile;
diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java b/app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java
index 935377047a14..79c49916c0f8 100644
--- a/app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java
+++ b/app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java
@@ -30,6 +30,7 @@
import com.external.plugins.datatypes.PostgresSpecificDataTypes;
import com.external.plugins.exceptions.PostgresErrorMessages;
import com.external.plugins.exceptions.PostgresPluginError;
+import com.external.plugins.utils.MutualTLSCertValidatingFactory;
import com.external.plugins.utils.PostgresDatasourceUtils;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
@@ -87,6 +88,7 @@
import static com.appsmith.external.helpers.PluginUtils.getPSParamLabel;
import static com.appsmith.external.helpers.Sizeof.sizeof;
import static com.appsmith.external.helpers.SmartSubstitutionHelper.replaceQuestionMarkWithDollarIndex;
+import static com.appsmith.external.models.SSLDetails.AuthType.VERIFY_CA;
import static com.external.plugins.utils.PostgresDataTypeUtils.DataType.BOOL;
import static com.external.plugins.utils.PostgresDataTypeUtils.DataType.DATE;
import static com.external.plugins.utils.PostgresDataTypeUtils.DataType.DECIMAL;
@@ -1183,8 +1185,42 @@ private static HikariDataSource createConnectionPool(
break;
case DEFAULT:
/* do nothing - accept default driver setting */
+ break;
+
+ case VERIFY_CA:
+ case VERIFY_FULL:
+ config.addDataSourceProperty("ssl", "true");
+ if (sslAuthType == SSLDetails.AuthType.VERIFY_FULL) {
+ config.addDataSourceProperty("sslmode", "verify-full");
+ } else {
+ config.addDataSourceProperty("sslmode", "verify-ca");
+ }
+ // Common properties for both VERIFY_CA and VERIFY_FULL
+ config.addDataSourceProperty("sslfactory", MutualTLSCertValidatingFactory.class.getName());
+ config.addDataSourceProperty(
+ "clientCertString",
+ datasourceConfiguration
+ .getConnection()
+ .getSsl()
+ .getCertificateFile()
+ .getBase64Content());
+ config.addDataSourceProperty(
+ "clientKeyString",
+ datasourceConfiguration
+ .getConnection()
+ .getSsl()
+ .getKeyFile()
+ .getBase64Content());
+ config.addDataSourceProperty(
+ "serverCACertString",
+ datasourceConfiguration
+ .getConnection()
+ .getSsl()
+ .getCaCertificateFile()
+ .getBase64Content());
break;
+
default:
throw new AppsmithPluginException(
PostgresPluginError.POSTGRES_PLUGIN_ERROR,
diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/utils/MutualTLSCertValidatingFactory.java b/app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/utils/MutualTLSCertValidatingFactory.java
new file mode 100644
index 000000000000..8c0ddfb40a8a
--- /dev/null
+++ b/app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/utils/MutualTLSCertValidatingFactory.java
@@ -0,0 +1,70 @@
+package com.external.plugins.utils;
+
+import com.appsmith.external.helpers.RSAKeyUtil;
+import org.postgresql.ssl.WrappedFactory;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+import java.io.ByteArrayInputStream;
+import java.security.KeyStore;
+import java.security.PrivateKey;
+import java.security.SecureRandom;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Base64;
+import java.util.Properties;
+
+public class MutualTLSCertValidatingFactory extends WrappedFactory {
+
+ public MutualTLSCertValidatingFactory(Properties info) throws Exception {
+ // Convert String certificates and keys to objects
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+ // Client certificate
+ ByteArrayInputStream clientCertIS =
+ new ByteArrayInputStream(Base64.getDecoder().decode(info.getProperty("clientCertString")));
+ X509Certificate clientCertificate = (X509Certificate) cf.generateCertificate(clientCertIS);
+
+ // Client key and this assumes we are using RSA keys
+ PrivateKey privateKey;
+
+ if (RSAKeyUtil.isPkcs1Key(info.getProperty("clientKeyString"))) {
+ String rsaKey = RSAKeyUtil.replaceHeaderAndFooterFromKey(info.getProperty("clientKeyString"));
+ privateKey = RSAKeyUtil.readPkcs1PrivateKey(rsaKey);
+ } else {
+ String rsaKey = RSAKeyUtil.replaceHeaderAndFooterFromKey(info.getProperty("clientKeyString"));
+ privateKey = RSAKeyUtil.readPkcs8PrivateKey(Base64.getDecoder().decode(rsaKey));
+ }
+
+ // CA certificate for verifying the server
+ ByteArrayInputStream caCertIS =
+ new ByteArrayInputStream(Base64.getDecoder().decode(info.getProperty("serverCACertString")));
+ X509Certificate caCertificate = (X509Certificate) cf.generateCertificate(caCertIS);
+
+ // Client keystore
+ KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ keyStore.load(null, null);
+ keyStore.setCertificateEntry("client-cert", clientCertificate);
+ keyStore.setKeyEntry("client-key", privateKey, "password".toCharArray(), new java.security.cert.Certificate[] {
+ clientCertificate
+ });
+
+ // Truststore
+ KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ trustStore.load(null, null);
+ trustStore.setCertificateEntry("ca-cert", caCertificate);
+
+ // Initialize SSLContext
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ tmf.init(trustStore);
+
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+ kmf.init(keyStore, "password".toCharArray());
+
+ SSLContext sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom());
+
+ this.factory = sslContext.getSocketFactory();
+ }
+}
|
03b46483dce0d768fdea467ce6ddfedc308e0520
|
2022-04-07 11:09:15
|
arunvjn
|
fix: 404 on apps with names that start with api, login or oauth (#12619)
| false
|
404 on apps with names that start with api, login or oauth (#12619)
|
fix
|
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Applications/ApplicationURL_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Applications/ApplicationURL_spec.js
index df37864504f2..a69c007a5df1 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Applications/ApplicationURL_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Applications/ApplicationURL_spec.js
@@ -7,7 +7,7 @@ describe("Slug URLs", () => {
applicationId = localStorage.getItem("applicationId");
cy.location("pathname").then((pathname) => {
const pageId = pathname
- .split("/")[2]
+ .split("/")[3]
?.split("-")
.pop();
cy.visit(`/applications/${applicationId}/pages/${pageId}/edit`).then(
@@ -15,11 +15,13 @@ describe("Slug URLs", () => {
cy.wait(10000);
cy.location("pathname").then((pathname) => {
const pageId = pathname
- .split("/")[2]
+ .split("/")[3]
?.split("-")
.pop();
const appName = localStorage.getItem("AppName");
- expect(pathname).to.be.equal(`/${appName}/page1-${pageId}/edit`);
+ expect(pathname).to.be.equal(
+ `/app/${appName}/page1-${pageId}/edit`,
+ );
});
},
);
@@ -38,10 +40,10 @@ describe("Slug URLs", () => {
);
cy.location("pathname").then((pathname) => {
const pageId = pathname
- .split("/")[2]
+ .split("/")[3]
?.split("-")
.pop();
- expect(pathname).to.be.equal(`/${appName}/page1-${pageId}/edit`);
+ expect(pathname).to.be.equal(`/app/${appName}/page1-${pageId}/edit`);
});
});
});
@@ -64,16 +66,16 @@ describe("Slug URLs", () => {
);
cy.location("pathname").then((pathname) => {
const pageId = pathname
- .split("/")[2]
+ .split("/")[3]
?.split("-")
.pop();
expect(pathname).to.be.equal(
- `/${applicationName}/page-renamed-${pageId}/edit`,
+ `/app/${applicationName}/page-renamed-${pageId}/edit`,
);
});
});
- it("Check the url of old applications and upgrades version", () => {
+ it("Check the url of old applications, upgrades version and compares appsmith.URL values", () => {
cy.request("PUT", `/api/v1/applications/${applicationId}`, {
applicationVersion: 1,
}).then((response) => {
@@ -124,13 +126,13 @@ describe("Slug URLs", () => {
cy.location().should((loc) => {
expect(loc.pathname).includes(
- `/${application.slug}/${currentPage.slug}-${currentPage.id}`,
+ `/app/${application.slug}/${currentPage.slug}-${currentPage.id}`,
);
});
cy.get(".t--draggable-textwidget .bp3-ui-text").should(
"contain.text",
- `/${application.slug}/${currentPage.slug}-${currentPage.id}/edit`,
+ `/app/${application.slug}/${currentPage.slug}-${currentPage.id}/edit`,
);
});
});
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitSync/Git_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitSync/Git_spec.js
index 180e547a81a2..d8537245b57d 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitSync/Git_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitSync/Git_spec.js
@@ -224,7 +224,7 @@ describe("Git sync:", function() {
const { application, pages } = intercept2.response.body.data;
const defaultPage = pages.find((p) => p.isDefault);
legacyPathname = `/applications/${application.id}/pages/${defaultPage.id}`;
- newPathname = `/${application.slug}/${defaultPage.slug}-${defaultPage.id}`;
+ newPathname = `/app/${application.slug}/${defaultPage.slug}-${defaultPage.id}`;
});
cy.location().should((location) => {
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/LayoutOnLoadActions/OnLoadActions_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/LayoutOnLoadActions/OnLoadActions_Spec.ts
index 3e5406f72e15..e99d7f2109d6 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/LayoutOnLoadActions/OnLoadActions_Spec.ts
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/LayoutOnLoadActions/OnLoadActions_Spec.ts
@@ -20,7 +20,7 @@ describe("Layout OnLoad Actions tests", function () {
ee.SelectEntityByName("WIDGETS");
ee.SelectEntityByName("Page1");
cy.url().then((url) => {
- const pageid = url.split("/")[4]?.split("-").pop();
+ const pageid = url.split("/")[5]?.split("-").pop();
cy.log(pageid + "page id");
cy.request("GET", "api/v1/pages/" + pageid).then((response) => {
const respBody = JSON.stringify(response.body);
diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts
index a0bd68661073..6875532b14d3 100644
--- a/app/client/cypress/support/Pages/AggregateHelper.ts
+++ b/app/client/cypress/support/Pages/AggregateHelper.ts
@@ -10,7 +10,7 @@ export class AggregateHelper {
let pageid: string;
let layoutId;
cy.url().then((url) => {
- pageid = url.split("/")[4]?.split("-").pop() as string;
+ pageid = url.split("/")[5]?.split("-").pop() as string;
cy.log(pageid + "page id");
//Fetch the layout id
cy.request("GET", "api/v1/pages/" + pageid).then((response) => {
diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js
index 9f06bb4a7005..f85d23ab0f06 100644
--- a/app/client/cypress/support/commands.js
+++ b/app/client/cypress/support/commands.js
@@ -1940,7 +1940,7 @@ Cypress.Commands.add("addDsl", (dsl) => {
cy.url().then((url) => {
currentURL = url;
pageid = currentURL
- .split("/")[4]
+ .split("/")[5]
?.split("-")
.pop();
cy.log(pageidcopy + "page id copy");
diff --git a/app/client/perf/src/perf.js b/app/client/perf/src/perf.js
index efd87bfbb2d8..d2aa1b504323 100644
--- a/app/client/perf/src/perf.js
+++ b/app/client/perf/src/perf.js
@@ -109,7 +109,7 @@ module.exports = class Perf {
await this.page.waitForNavigation();
const currentUrl = this.page.url();
- const pageId = currentURL.split("/")[4]?.split("-").pop();
+ const pageId = currentURL.split("/")[5]?.split("-").pop();
await this.page.evaluate(
async ({ pageId, dsl }) => {
diff --git a/app/client/src/RouteBuilder.ts b/app/client/src/RouteBuilder.ts
index 2a197c74f1a2..856ad3af52cf 100644
--- a/app/client/src/RouteBuilder.ts
+++ b/app/client/src/RouteBuilder.ts
@@ -50,7 +50,7 @@ export const fillPathname = (
page: Page,
) => {
return pathname
- .replace(`/applications/${application.id}`, `/${application.slug}`)
+ .replace(`/applications/${application.id}`, `/app/${application.slug}`)
.replace(`/pages/${page.pageId}`, `/${page.slug}-${page.pageId}`);
};
@@ -144,7 +144,7 @@ function baseURLBuilder(
PLACEHOLDER_APP_SLUG;
pageSlug =
pageSlug || BASE_URL_BUILDER_PARAMS.pageSlug || PLACEHOLDER_PAGE_SLUG;
- basePath = `/${applicationSlug}/${pageSlug}-${pageId}`;
+ basePath = `/app/${applicationSlug}/${pageSlug}-${pageId}`;
}
basePath += mode === APP_MODE.EDIT ? "/edit" : "";
diff --git a/app/client/src/constants/routes.ts b/app/client/src/constants/routes.ts
index 5f1549198c1e..7d50b8697305 100644
--- a/app/client/src/constants/routes.ts
+++ b/app/client/src/constants/routes.ts
@@ -31,8 +31,8 @@ export const SIGNUP_SUCCESS_URL = `/signup-success`;
export const ORG_INVITE_USERS_PAGE_URL = `${ORG_URL}/invite`;
export const ORG_SETTINGS_PAGE_URL = `${ORG_URL}/settings`;
export const BUILDER_PATH_DEPRECATED = `/applications/:applicationId/(pages)?/:pageId?/edit`;
-export const BUILDER_PATH = `/:applicationSlug/:pageSlug(.*\-):pageId/edit`;
-export const VIEWER_PATH = `/:applicationSlug/:pageSlug(.*\-):pageId`;
+export const BUILDER_PATH = `/app/:applicationSlug/:pageSlug(.*\-):pageId/edit`;
+export const VIEWER_PATH = `/app/:applicationSlug/:pageSlug(.*\-):pageId`;
export const VIEWER_PATH_DEPRECATED = `/applications/:applicationId/(pages)?/:pageId?`;
export const VIEWER_FORK_PATH = `${VIEWER_PATH}/fork`;
export const INTEGRATION_EDITOR_PATH = `/datasources/:selectedTab`;
diff --git a/app/client/src/pages/Editor/BottomBar/ManualUpgrades.tsx b/app/client/src/pages/Editor/BottomBar/ManualUpgrades.tsx
index cab6a96654a2..4b4ecba2ce19 100644
--- a/app/client/src/pages/Editor/BottomBar/ManualUpgrades.tsx
+++ b/app/client/src/pages/Editor/BottomBar/ManualUpgrades.tsx
@@ -217,7 +217,7 @@ function ManualUpgrades() {
null,
window.location.href.replace(
`/applications/${applicationId}/pages/${pageId}`,
- `/${applicationSlug}/${pageSlug}-${pageId}`,
+ `/app/${applicationSlug}/${pageSlug}-${pageId}`,
),
),
),
diff --git a/app/client/src/pages/Editor/Explorer/helpers.test.ts b/app/client/src/pages/Editor/Explorer/helpers.test.ts
index 650837963539..ff96ccaf7068 100644
--- a/app/client/src/pages/Editor/Explorer/helpers.test.ts
+++ b/app/client/src/pages/Editor/Explorer/helpers.test.ts
@@ -5,7 +5,7 @@ describe("getActionIdFromUrl", () => {
window.history.pushState(
{},
"Api",
- "/applicationSlugName/pageSlugName-pageId/edit/api/apiId",
+ "/app/applicationSlugName/pageSlugName-pageId/edit/api/apiId",
);
const response = getActionIdFromURL();
expect(response).toBe("apiId");
@@ -14,7 +14,7 @@ describe("getActionIdFromUrl", () => {
window.history.pushState(
{},
"Query",
- "/applicationSlugName/pageSlugName-pageId/edit/queries/queryId",
+ "/app/applicationSlugName/pageSlugName-pageId/edit/queries/queryId",
);
const response = getActionIdFromURL();
expect(response).toBe("queryId");
@@ -24,7 +24,7 @@ describe("getActionIdFromUrl", () => {
window.history.pushState(
{},
"Query",
- "/applicationSlugName/pageSlugName-pageId/edit/saas/:pluginPackageName/api/saasActionId",
+ "/app/applicationSlugName/pageSlugName-pageId/edit/saas/:pluginPackageName/api/saasActionId",
);
const response = getActionIdFromURL();
expect(response).toBe("saasActionId");
diff --git a/app/client/src/pages/Editor/GlobalHotKeys.test.tsx b/app/client/src/pages/Editor/GlobalHotKeys.test.tsx
index 83232662e3ca..2449099dca5b 100644
--- a/app/client/src/pages/Editor/GlobalHotKeys.test.tsx
+++ b/app/client/src/pages/Editor/GlobalHotKeys.test.tsx
@@ -74,7 +74,7 @@ describe("Canvas Hot Keys", () => {
const component = render(
<MemoryRouter
- initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
>
<MockApplication>
<GlobalHotKeys>
@@ -194,7 +194,7 @@ describe("Canvas Hot Keys", () => {
const component = render(
<MemoryRouter
- initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
>
<MockApplication>
<GlobalHotKeys>
@@ -236,7 +236,7 @@ describe("Canvas Hot Keys", () => {
const component = render(
<MemoryRouter
- initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
>
<MockApplication>
<GlobalHotKeys>
@@ -321,7 +321,7 @@ describe("Canvas Hot Keys", () => {
const component = render(
<MemoryRouter
- initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
>
<MockApplication>
<GlobalHotKeys>
diff --git a/app/client/src/pages/Editor/MainContainer.test.tsx b/app/client/src/pages/Editor/MainContainer.test.tsx
index eaf4c24b897e..e189ad6edda7 100644
--- a/app/client/src/pages/Editor/MainContainer.test.tsx
+++ b/app/client/src/pages/Editor/MainContainer.test.tsx
@@ -72,7 +72,9 @@ const renderNestedComponent = () => {
});
return render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -134,7 +136,9 @@ describe("Drag and Drop widgets into Main container", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -232,7 +236,9 @@ describe("Drag and Drop widgets into Main container", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -337,7 +343,9 @@ describe("Drag and Drop widgets into Main container", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -443,7 +451,9 @@ describe("Drag and Drop widgets into Main container", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -546,7 +556,9 @@ describe("Drag and Drop widgets into Main container", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -652,7 +664,9 @@ describe("Drag and Drop widgets into Main container", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
diff --git a/app/client/src/pages/common/CanvasArenas/CanvasSelectionArena.test.tsx b/app/client/src/pages/common/CanvasArenas/CanvasSelectionArena.test.tsx
index 97a6bfc0decd..66e60a63269f 100644
--- a/app/client/src/pages/common/CanvasArenas/CanvasSelectionArena.test.tsx
+++ b/app/client/src/pages/common/CanvasArenas/CanvasSelectionArena.test.tsx
@@ -46,7 +46,9 @@ describe("Canvas selection test cases", () => {
spyGetCanvasWidgetDsl.mockImplementation(mockGetCanvasWidgetDsl);
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -102,7 +104,9 @@ describe("Canvas selection test cases", () => {
spyGetCanvasWidgetDsl.mockImplementation(mockGetCanvasWidgetDsl);
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -192,7 +196,9 @@ describe("Canvas selection test cases", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -321,7 +327,9 @@ describe("Canvas selection test cases", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
@@ -407,7 +415,9 @@ describe("Canvas selection test cases", () => {
mockGetIsFetchingPage.mockImplementation(() => false);
const component = render(
- <MemoryRouter initialEntries={["/applicationSlug/pageSlug-page_id/edit"]}>
+ <MemoryRouter
+ initialEntries={["/app/applicationSlug/pageSlug-page_id/edit"]}
+ >
<MockApplication>
<GlobalHotKeys>
<UpdatedMainContainer dsl={dsl} />
diff --git a/app/client/src/pages/tests/slug.test.tsx b/app/client/src/pages/tests/slug.test.tsx
index 35b01d475113..5156408855f1 100644
--- a/app/client/src/pages/tests/slug.test.tsx
+++ b/app/client/src/pages/tests/slug.test.tsx
@@ -47,12 +47,14 @@ describe("URL slug names", () => {
it("checks the update slug in URL method", () => {
const newAppSlug = "modified-app-slug";
const newPageSlug = "modified-page-slug";
- const pathname = "/my-app/pages-605c435a91dea93f0eaf91ba";
+ const pathname = "/app/my-app/pages-605c435a91dea93f0eaf91ba";
const url = getUpdatedRoute(pathname, {
applicationSlug: newAppSlug,
pageSlug: newPageSlug,
});
- expect(url).toBe(`/${newAppSlug}/${newPageSlug}-605c435a91dea93f0eaf91ba`);
+ expect(url).toBe(
+ `/app/${newAppSlug}/${newPageSlug}-605c435a91dea93f0eaf91ba`,
+ );
});
it("checks the isDeprecatedURL method", () => {
@@ -62,6 +64,10 @@ describe("URL slug names", () => {
"/applications/605c435a91dea93f0eaf91ba/pages/605c435a91dea93f0eaf91ba";
expect(isURLDeprecated(pathname1)).toBe(true);
expect(isURLDeprecated(pathname2)).toBe(true);
+
+ const pathname3 = "/app/apSlug/pages-605c435a91dea93f0eaf91ba";
+
+ expect(isURLDeprecated(pathname3)).toBe(false);
});
it("verifies that the baseURLBuilder uses applicationVersion", () => {
@@ -86,9 +92,9 @@ describe("URL slug names", () => {
});
const url4 = builderURL(params);
expect(url1).toBe("/applications/appId/pages/pageId/edit");
- expect(url2).toBe("/appSlug/pageSlug-pageId/edit");
+ expect(url2).toBe("/app/appSlug/pageSlug-pageId/edit");
expect(url3).toBe("/applications/appId/pages/pageId/edit");
- expect(url4).toBe("/appSlug/pageSlug-pageId/edit");
+ expect(url4).toBe("/app/appSlug/pageSlug-pageId/edit");
});
it("tests the manual upgrade option", () => {
@@ -129,7 +135,7 @@ describe("URL slug names", () => {
it("tests slug URLs utility methods", () => {
const legacyURL =
"/applications/605c435a91dea93f0eaf91ba/pages/605c435a91dea93f0eaf91ba/edit";
- const slugURL = "/my-application/my-page-605c435a91dea93f0eaf91ba/edit";
+ const slugURL = "/app/my-application/my-page-605c435a91dea93f0eaf91ba/edit";
expect(isURLDeprecated(legacyURL)).toBe(true);
expect(isURLDeprecated(slugURL)).toBe(false);
@@ -139,7 +145,7 @@ describe("URL slug names", () => {
applicationSlug: "my-app",
pageSlug: "page",
}),
- ).toBe("/my-app/page-605c435a91dea93f0eaf91ba/edit");
+ ).toBe("/app/my-app/page-605c435a91dea93f0eaf91ba/edit");
});
it("tests getPageUrl utility method", () => {
@@ -156,10 +162,10 @@ describe("URL slug names", () => {
);
expect(editPageURL).toBe(
- `/${currentApplication?.slug}/${page.slug}-${page.pageId}/edit`,
+ `/app/${currentApplication?.slug}/${page.slug}-${page.pageId}/edit`,
);
expect(viewPageURL).toBe(
- `/${currentApplication?.slug}/${page.slug}-${page.pageId}`,
+ `/app/${currentApplication?.slug}/${page.slug}-${page.pageId}`,
);
});
});
diff --git a/app/client/src/sagas/InitSagas.ts b/app/client/src/sagas/InitSagas.ts
index eda55e7c4c52..c1173ffd4be8 100644
--- a/app/client/src/sagas/InitSagas.ts
+++ b/app/client/src/sagas/InitSagas.ts
@@ -66,7 +66,11 @@ import {
import { getIsInitialized as getIsViewerInitialized } from "selectors/appViewSelectors";
import { fetchCommentThreadsInit } from "actions/commentActions";
import { fetchJSCollectionsForView } from "actions/jsActionActions";
-import { addBranchParam } from "constants/routes";
+import {
+ addBranchParam,
+ PLACEHOLDER_APP_SLUG,
+ PLACEHOLDER_PAGE_SLUG,
+} from "constants/routes";
import history from "utils/history";
import {
fetchGitStatusInit,
@@ -132,11 +136,11 @@ function* initiateURLUpdate(
getCurrentApplication,
);
- const applicationSlug = currentApplication.slug as string;
+ const applicationSlug = currentApplication.slug || PLACEHOLDER_APP_SLUG;
const currentPage: Page = yield select(getPageById(pageId));
- const pageSlug = currentPage?.slug as string;
+ const pageSlug = currentPage?.slug || PLACEHOLDER_PAGE_SLUG;
let originalUrl = "";
- const { pathname, search } = window.location;
+ const { hash, pathname, search } = window.location;
// For switching new URLs to old.
if (currentApplication.applicationVersion < ApplicationVersion.SLUG_URL) {
@@ -145,10 +149,11 @@ function* initiateURLUpdate(
// when switch from a branch with updated URL to another one with legacy URLs,
// we need to compute the legacy url
// This scenario can happen only in edit mode.
- originalUrl = builderURL({
- applicationId: currentApplication.id,
- pageId: pageId,
- });
+ originalUrl =
+ builderURL({
+ applicationId: currentApplication.id,
+ pageId: pageId,
+ }) + hash;
history.replace(originalUrl);
}
} else {
@@ -160,10 +165,12 @@ function* initiateURLUpdate(
// If edit mode, replace /applications/appId/pages/pageId with /appSlug/pageSlug-pageId,
// to not affect the rest of the url. eg. /api/apiId
originalUrl =
- fillPathname(pathname, currentApplication, currentPage) + search;
+ fillPathname(pathname, currentApplication, currentPage) +
+ search +
+ hash;
} else {
// View Mode - generate a new viewer URL - auto updates query params
- originalUrl = viewerURL({ applicationSlug, pageSlug, pageId });
+ originalUrl = viewerURL({ applicationSlug, pageSlug, pageId }) + hash;
}
} else {
// For urls which has pageId in it,
@@ -173,7 +180,9 @@ function* initiateURLUpdate(
applicationSlug,
pageSlug,
pageId,
- }) + search;
+ }) +
+ search +
+ hash;
}
history.replace(originalUrl);
}
|
7ba83bfb221ba8959d8f63aee042420f3242b146
|
2024-11-13 10:06:42
|
Anagh Hegde
|
chore: beautify the slack message for the sync to pg workflow message (#37318)
| false
|
beautify the slack message for the sync to pg workflow message (#37318)
|
chore
|
diff --git a/.github/workflows/sync-release-to-pg.yml b/.github/workflows/sync-release-to-pg.yml
index f5ad35e0669c..b5bd192f597d 100644
--- a/.github/workflows/sync-release-to-pg.yml
+++ b/.github/workflows/sync-release-to-pg.yml
@@ -59,9 +59,9 @@ jobs:
CONFLICTING_COMMIT: ${{ env.CONFLICTING_COMMIT }}
run: |
# Prepare the message for Slack
- message="Merge conflict detected while merging release into pg branch. Conflicted commits:\n"
+ message="Merge conflict detected while merging release into pg branch. Conflicted commits:"
commit_url="$REPOSITORY_URL/commit/$CONFLICTING_COMMIT"
- message+="$commit_url\n"
+ message+="$commit_url"
# Send the message to Slack
# This unwieldy horror of a sed command, converts standard Markdown links to Slack's unwieldy link syntax.
|
05ca82764cf52d6075d7e76d6465eb6c9172c6d0
|
2022-09-01 19:28:56
|
sneha122
|
fix: response table misalignment (#16267)
| false
|
response table misalignment (#16267)
|
fix
|
diff --git a/app/client/src/pages/Editor/QueryEditor/Table.tsx b/app/client/src/pages/Editor/QueryEditor/Table.tsx
index 816bf09e7617..aaec33b3c1fc 100644
--- a/app/client/src/pages/Editor/QueryEditor/Table.tsx
+++ b/app/client/src/pages/Editor/QueryEditor/Table.tsx
@@ -198,7 +198,17 @@ const renderCell = (props: any) => {
);
};
+// The function will return the scrollbar width that needs to be added
+// in the table body width, when scrollbar is shown the width should be > 0,
+// when scrollbar is not shown, width should be 0
+export const getScrollBarWidth = (tableBodyEle: any, scrollBarW: number) => {
+ return !!tableBodyEle && tableBodyEle.scrollHeight > tableBodyEle.clientHeight
+ ? scrollBarW
+ : 0;
+};
+
function Table(props: TableProps) {
+ const tableBodyRef = React.useRef<HTMLElement>();
const data = React.useMemo(() => {
const emptyString = "";
/* Check for length greater than 0 of rows returned from the query for mappings keys */
@@ -262,7 +272,9 @@ function Table(props: TableProps) {
useBlockLayout,
);
- const scrollBarSize = React.useMemo(() => scrollbarWidth(), []);
+ const tableBodyEle = tableBodyRef?.current;
+ const scrollBarW = React.useMemo(() => scrollbarWidth(), []);
+ const scrollBarSize = getScrollBarWidth(tableBodyEle, scrollBarW);
const RenderRow = React.useCallback(
({ index, style }) => {
@@ -338,6 +350,7 @@ function Table(props: TableProps) {
height={tableBodyHeightComputed || window.innerHeight}
itemCount={rows.length}
itemSize={35}
+ outerRef={tableBodyRef}
width={totalColumnsWidth + scrollBarSize}
>
{RenderRow}
diff --git a/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx b/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx
index c70f2729e2f1..2b12e494d67d 100644
--- a/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx
+++ b/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx
@@ -2,6 +2,16 @@ import React from "react";
import { render, screen } from "test/testUtils";
import "@testing-library/jest-dom";
import Table from "../QueryEditor/Table";
+import { getScrollBarWidth } from "../QueryEditor/Table";
+
+function createEle() {
+ return {
+ scrollHeight: 0,
+ clientHeight: 0,
+ }
+}
+
+const scrollW = 6;
describe("Query Editor Table", () => {
it("it should render table with missing key", () => {
@@ -9,4 +19,28 @@ describe("Query Editor Table", () => {
const date = screen.getByText(/Jan 1 1970 10:15AM/i);
expect(date).toBeInTheDocument();
});
+
+ it("13406: it should return scroll bar width 0 when table element is not defined", () => {
+ const ele = undefined;
+ const scrollWidth = getScrollBarWidth(ele, scrollW);
+ expect(scrollWidth).toBe(0);
+ });
+
+ it("13406: it should render table without scroll and scroll bar width would be 0", () => {
+ const ele = createEle();
+ ele.scrollHeight = 268;
+ ele.clientHeight = 268;
+
+ const scrollWidth = getScrollBarWidth(ele, scrollW);
+ expect(scrollWidth).toBe(0);
+ });
+
+ it("13406: it should render table with scroll and scroll bar width would be greater than 0", () => {
+ const ele = createEle();
+ ele.scrollHeight = 368;
+ ele.clientHeight = 268;
+
+ const scrollWidth = getScrollBarWidth(ele, scrollW);
+ expect(scrollWidth).toBeGreaterThan(0);
+ });
});
diff --git a/app/client/test/testMockedWidgets.tsx b/app/client/test/testMockedWidgets.tsx
index dadc21435961..26e73e3e00d7 100644
--- a/app/client/test/testMockedWidgets.tsx
+++ b/app/client/test/testMockedWidgets.tsx
@@ -9,7 +9,7 @@ import { useMockDsl } from "./testCommon";
export function MockCanvas() {
const canvasWidgetsStructure = useSelector(getCanvasWidgetsStructure);
- return <Canvas widgetsStructure={canvasWidgetsStructure} />;
+ return <Canvas widgetsStructure={canvasWidgetsStructure} pageId="" canvasWidth={0} />;
}
export function UpdateAppViewer({ dsl }: any) {
|
b1553e946afa8fbeee68803a4ca5bdcc69ad7ec0
|
2022-09-14 20:30:18
|
Goutham Pratapa
|
fix: docker entrypoint script to check mongo replicaset (#16751)
| false
|
docker entrypoint script to check mongo replicaset (#16751)
|
fix
|
diff --git a/deploy/docker/entrypoint.sh b/deploy/docker/entrypoint.sh
index d83281e3e6c4..e637aa545faf 100755
--- a/deploy/docker/entrypoint.sh
+++ b/deploy/docker/entrypoint.sh
@@ -168,7 +168,8 @@ init_replica_set() {
# Check mongodb cloud Replica Set
echo "Checking Replica Set of external MongoDB"
- if [[ $(mongo "$APPSMITH_MONGODB_URI" --quiet --eval "rs.status().ok") -eq 1 ]]; then
+ mongo_state="$(mongo --host "$APPSMITH_MONGODB_URI" --quiet --eval "rs.status().ok")"
+ if [[ ${mongo_state: -1} -eq 1 ]]; then
echo "Mongodb cloud Replica Set is enabled"
else
echo -e "\033[0;31m********************************************************************\033[0m"
|
501fb1c1ed448f299c29af5a3922bd52a98d8015
|
2022-04-29 12:08:09
|
Nayan
|
feat: Delete theme when application is deleted (#13252)
| false
|
Delete theme when application is deleted (#13252)
|
feat
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseAppsmithRepositoryImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseAppsmithRepositoryImpl.java
index 0e72e08b9423..d2acdd053a86 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseAppsmithRepositoryImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseAppsmithRepositoryImpl.java
@@ -163,12 +163,13 @@ public Mono<UpdateResult> updateById(String id, Update updateObj, AclPermission
});
}
- public Mono<UpdateResult> updateByCriteria(Criteria criteria, Update updateObj) {
- if (criteria == null) {
- return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "criteria"));
+ public Mono<UpdateResult> updateByCriteria(List<Criteria> criteriaList, Update updateObj) {
+ if (criteriaList == null) {
+ return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "criteriaList"));
}
- Query query = new Query(criteria);
- query.addCriteria(new Criteria().andOperator(notDeleted()));
+ List<Criteria> allCriterias = new ArrayList<>(criteriaList);
+ allCriterias.add(notDeleted());
+ Query query = new Query(new Criteria().andOperator(allCriterias));
return mongoOperations.updateMulti(query, updateObj, this.genericDomain);
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomCommentThreadRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomCommentThreadRepositoryCEImpl.java
index fe3470acc6d6..d05c0a76b169 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomCommentThreadRepositoryCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomCommentThreadRepositoryCEImpl.java
@@ -78,7 +78,7 @@ public Mono<UpdateResult> archiveByPageId(String pageId, ApplicationMode comment
Criteria criteria = where(fieldName(QCommentThread.commentThread.pageId)).is(pageId)
.and(fieldName(QCommentThread.commentThread.mode)).is(commentMode);
- return this.updateByCriteria(criteria, update);
+ return this.updateByCriteria(List.of(criteria), update);
}
@Override
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCE.java
index 44845df85c6d..a945291cb1bd 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCE.java
@@ -10,4 +10,6 @@ public interface CustomThemeRepositoryCE extends AppsmithRepository<Theme> {
Flux<Theme> getApplicationThemes(String applicationId, AclPermission aclPermission);
Flux<Theme> getSystemThemes();
Mono<Theme> getSystemThemeByName(String themeName);
+ Mono<Boolean> archiveByApplicationId(String applicationId);
+ Mono<Boolean> archiveDraftThemesById(String editModeThemeId, String publishedModeThemeId);
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCEImpl.java
index 02ec685332f9..8f25ddb7a5a2 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCEImpl.java
@@ -3,15 +3,19 @@
import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.domains.QTheme;
import com.appsmith.server.domains.Theme;
+import com.appsmith.server.domains.User;
import com.appsmith.server.repositories.BaseAppsmithRepositoryImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.mongodb.core.ReactiveMongoOperations;
import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Update;
+import org.springframework.security.core.context.ReactiveSecurityContextHolder;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
+import java.time.Instant;
import java.util.List;
import java.util.regex.Pattern;
@@ -46,4 +50,30 @@ public Mono<Theme> getSystemThemeByName(String themeName) {
.and(fieldName(QTheme.theme.isSystemTheme)).is(true);
return queryOne(List.of(criteria), AclPermission.READ_THEMES);
}
+
+ private Mono<Boolean> archiveThemeByCriteria(Criteria criteria) {
+ return ReactiveSecurityContextHolder.getContext()
+ .map(ctx -> ctx.getAuthentication())
+ .flatMap(auth -> {
+ User user = (User) auth.getPrincipal();
+ Criteria permissionCriteria = userAcl(user, AclPermission.MANAGE_THEMES);
+
+ Update update = new Update();
+ update.set(fieldName(QTheme.theme.deleted), true);
+ update.set(fieldName(QTheme.theme.deletedAt), Instant.now());
+ return updateByCriteria(List.of(criteria, permissionCriteria), update);
+ }).map(updateResult -> updateResult.getModifiedCount() > 0);
+ }
+
+ @Override
+ public Mono<Boolean> archiveByApplicationId(String applicationId) {
+ return archiveThemeByCriteria(where(fieldName(QTheme.theme.applicationId)).is(applicationId));
+ }
+
+ @Override
+ public Mono<Boolean> archiveDraftThemesById(String editModeThemeId, String publishedModeThemeId) {
+ Criteria criteria = where(fieldName(QTheme.theme.id)).in(editModeThemeId, publishedModeThemeId)
+ .and(fieldName(QTheme.theme.isSystemTheme)).is(false);
+ return archiveThemeByCriteria(criteria);
+ }
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
index 25b871247adc..1137089c7686 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
@@ -419,7 +419,7 @@ public Mono<Application> deleteApplicationByResource(Application application) {
return newPageService.archivePagesByApplicationId(application.getId(), MANAGE_PAGES)
.then(actionCollectionService.archiveActionCollectionByApplicationId(application.getId(), MANAGE_ACTIONS))
.then(newActionService.archiveActionsByApplicationId(application.getId(), MANAGE_ACTIONS))
- .thenReturn(application)
+ .then(themeService.archiveApplicationThemes(application))
.flatMap(applicationService::archive)
.flatMap(analyticsService::sendDeleteEvent);
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCE.java
index 9ebb8a74ce5a..9f5929df2958 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCE.java
@@ -27,7 +27,7 @@ public interface ThemeServiceCE extends CrudService<Theme, String> {
* Duplicates a theme if the theme is customized one.
* If the source theme is a system theme, it'll skip creating a new theme and return the system theme instead.
* @param srcThemeId ID of source theme that needs to be duplicated
- * @param destApplicationId ID of the application for which theme'll be created
+ * @param destApplication Application for which theme will ll be created
* @return newly created theme if source is not system theme, otherwise return the system theme
*/
Mono<Theme> cloneThemeToApplication(String srcThemeId, Application destApplication);
@@ -37,4 +37,5 @@ public interface ThemeServiceCE extends CrudService<Theme, String> {
Mono<Theme> save(Theme theme);
Mono<Theme> updateName(String id, Theme theme);
Mono<Theme> getOrSaveTheme(Theme theme, Application destApplication);
+ Mono<Application> archiveApplicationThemes(Application application);
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCEImpl.java
index 8ef509139832..3e08e85ac8cc 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCEImpl.java
@@ -394,4 +394,17 @@ public Mono<Theme> getOrSaveTheme(Theme theme, Application destApplication) {
return repository.save(theme);
}
}
+
+ /**
+ * This will archive themes related to the provided Application.
+ * It'll delete any theme that was saved for this application. It'll also delete the draft themes for this Application.
+ * @param application Application object
+ * @return Provided Application publisher
+ */
+ @Override
+ public Mono<Application> archiveApplicationThemes(Application application) {
+ return repository.archiveByApplicationId(application.getId())
+ .then(repository.archiveDraftThemesById(application.getEditModeThemeId(), application.getPublishedModeThemeId()))
+ .thenReturn(application);
+ }
}
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomThemeRepositoryTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomThemeRepositoryTest.java
index 65d87117a610..9c55f62b0faf 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomThemeRepositoryTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomThemeRepositoryTest.java
@@ -1,14 +1,19 @@
package com.appsmith.server.repositories;
+import com.appsmith.external.models.BaseDomain;
import com.appsmith.external.models.Policy;
+import com.appsmith.server.domains.QTheme;
import com.appsmith.server.domains.Theme;
import com.appsmith.server.helpers.PolicyUtils;
+import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.security.test.context.support.WithUserDetails;
import org.springframework.test.context.junit4.SpringRunner;
+import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
@@ -16,6 +21,7 @@
import java.util.Map;
import java.util.Set;
+import static com.appsmith.server.acl.AclPermission.MANAGE_THEMES;
import static com.appsmith.server.acl.AclPermission.READ_THEMES;
import static org.assertj.core.api.Assertions.assertThat;
@@ -29,6 +35,18 @@ public class CustomThemeRepositoryTest {
@Autowired
PolicyUtils policyUtils;
+ @After
+ public void cleanUp() {
+ // delete all themes except the system themes.
+ List<Criteria> nonSystemThemesCriteria = List.of(
+ Criteria.where(QTheme.theme.isSystemTheme.getMetadata().getName()).is(false)
+ );
+ themeRepository.queryAll(nonSystemThemesCriteria, null)
+ .map(BaseDomain::getId)
+ .collectList()
+ .flatMap(nonSystemThemeIds -> themeRepository.deleteAllById(nonSystemThemeIds)).block();
+ }
+
@WithUserDetails("api_user")
@Test
public void getSystemThemes_WhenThemesExists_ReturnsSystemThemes() {
@@ -78,4 +96,88 @@ public void getSystemThemeByName_WhenNameMatches_ReturnsTheme() {
assertThat(theme.isSystemTheme()).isTrue();
}).verifyComplete();
}
+
+ @WithUserDetails("api_user")
+ @Test
+ public void archiveByApplicationId_WhenThemeIsPresent_ThemeArchived() {
+ Map<String, Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(MANAGE_THEMES), "api_user"
+ );
+ String secondAppId = "second-app-id", firstAppId = "first-app-id";
+
+ Theme firstAppTheme = new Theme();
+ firstAppTheme.setApplicationId(firstAppId);
+ firstAppTheme.setPolicies(Set.of(themePolicies.get(MANAGE_THEMES.getValue())));
+
+ Theme secondAppThemeWithPermission = new Theme();
+ secondAppThemeWithPermission.setApplicationId(secondAppId);
+ secondAppThemeWithPermission.setPolicies(Set.of(themePolicies.get(MANAGE_THEMES.getValue())));
+
+ Theme secondAppThemeWithoutPermission = new Theme();
+ secondAppThemeWithoutPermission.setDisplayName("secondAppThemeWithoutPermission");
+ secondAppThemeWithoutPermission.setApplicationId(secondAppId);
+ secondAppThemeWithoutPermission.setPolicies(Set.of(themePolicies.get(READ_THEMES.getValue())));
+
+ Flux<Theme> existingThemesMono = themeRepository.saveAll(
+ List.of(firstAppTheme, secondAppThemeWithPermission, secondAppThemeWithoutPermission)
+ )
+ .then(themeRepository.archiveByApplicationId(secondAppId))
+ .thenMany(themeRepository.findAll()).cache();
+
+ Flux<Theme> systemThemesFlux = existingThemesMono.filter(Theme::isSystemTheme);
+ Flux<Theme> applicationThemesFlux = existingThemesMono.filter(theme -> !theme.isSystemTheme());
+
+ StepVerifier.create(systemThemesFlux).expectNextCount(4).verifyComplete();
+ StepVerifier.create(applicationThemesFlux.collectMultimap(Theme::getApplicationId))
+ .assertNext(themesListByApplicationId -> {
+ assertThat(themesListByApplicationId.size()).isEqualTo(2);
+ assertThat(themesListByApplicationId.get(firstAppId).size()).isEqualTo(1);
+ assertThat(themesListByApplicationId.get(secondAppId).size()).isEqualTo(1);
+ Theme secondAppTheme = themesListByApplicationId.get(secondAppId).iterator().next();
+ assertThat(secondAppTheme.getDisplayName()).isEqualTo("secondAppThemeWithoutPermission");
+ })
+ .verifyComplete();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void archiveDraftThemesById_WhenThemesPresent_ThemesArchived() {
+ Map<String, Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(MANAGE_THEMES), "api_user"
+ );
+ Theme firstAppTheme = new Theme();
+ firstAppTheme.setPolicies(Set.of(themePolicies.get(MANAGE_THEMES.getValue())));
+
+ Flux<Theme> existingThemeFlux = themeRepository.save(firstAppTheme)
+ .zipWith(themeRepository.getSystemThemeByName(Theme.DEFAULT_THEME_NAME))
+ .flatMap(themeTuple2 -> {
+ Theme customDraftTheme = themeTuple2.getT1();
+ Theme systemTheme = themeTuple2.getT2(); // this will not be deleted
+ return themeRepository.archiveDraftThemesById(customDraftTheme.getId(), systemTheme.getId());
+ })
+ .thenMany(themeRepository.findAll());
+ // we should get 4 system themes and no custom draft theme
+ StepVerifier.create(existingThemeFlux).expectNextCount(4).verifyComplete();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void archiveDraftThemesById_WhenPermissionNotMatched_ThemesNotArchived() {
+ Map<String, Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(READ_THEMES), "api_user"
+ );
+ Theme firstAppTheme = new Theme();
+ firstAppTheme.setPolicies(Set.of(themePolicies.get(READ_THEMES.getValue())));
+
+ Flux<Theme> existingThemeFlux = themeRepository.save(firstAppTheme)
+ .zipWith(themeRepository.getSystemThemeByName(Theme.DEFAULT_THEME_NAME))
+ .flatMap(themeTuple2 -> {
+ Theme customDraftTheme = themeTuple2.getT1();
+ Theme systemTheme = themeTuple2.getT2(); // this will not be deleted
+ return themeRepository.archiveDraftThemesById(customDraftTheme.getId(), systemTheme.getId());
+ })
+ .thenMany(themeRepository.findAll());
+ // we should get 4 system themes and one custom draft theme
+ StepVerifier.create(existingThemeFlux).expectNextCount(5).verifyComplete();
+ }
}
\ No newline at end of file
|
50240fc74b26e8cc75ed09876dfb8b3835f462ba
|
2023-07-07 12:26:55
|
Saroj
|
ci: Add command to run ci-test-limited (#25180)
| false
|
Add command to run ci-test-limited (#25180)
|
ci
|
diff --git a/.github/workflows/build-client-server.yml b/.github/workflows/build-client-server.yml
index 6ba3c6020d23..6bc5d71b9b6e 100644
--- a/.github/workflows/build-client-server.yml
+++ b/.github/workflows/build-client-server.yml
@@ -1,6 +1,8 @@
name: Build Client, Server & Run only Cypress
on:
+ repository_dispatch:
+ types: [ ci-test-limit-command ]
# This workflow can be triggered manually from the GitHub Actions page
workflow_dispatch:
inputs:
@@ -17,11 +19,42 @@ jobs:
outputs:
non_ts_files: ${{ steps.check_files.outputs.non_ts_files }}
non_ts_files_count: ${{ steps.check_files.outputs.non_ts_files_count }}
+ pr: ${{steps.args.outputs.pr}}
+ runId: ${{steps.args.outputs.runId}}
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v3
with:
fetch-depth: 0
+
+ - name: Get the PR number if workflow is triggered manually
+ id: fetch_pr
+ if: github.event_name == 'workflow_dispatch'
+ run: |
+ res=`curl -s -H "Authorization: Bearer ${{ secrets.APPSMITH_CI_TEST_PAT}}" https://api.github.com/repos/${{ github.repository }}/pulls?head=appsmithorg:${{ github.ref_name }}`
+ response_length=`echo "$res" | jq -r 'length'`
+ if [[ $response_length -ne 0 ]]; then
+ pr_number=`echo $res | jq -r '.[0] | .number'`
+ echo "pr=$pr_number" >> $GITHUB_OUTPUT
+ else
+ echo "pr=0" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Set args
+ id: args
+ run: |
+ if [[ ${{github.event_name}} == 'repository_dispatch' ]]; then
+ echo "pr=${{ github.event.client_payload.pull_request.number }}" >> $GITHUB_OUTPUT
+ checkArg=`echo '${{toJSON(github.event.client_payload.slash_command.args.named)}}' | jq 'has("runId")'`
+ if [[ $checkArg == 'true' ]]; then
+ echo "runId=${{ github.event.client_payload.slash_command.args.named.runId }}" >> $GITHUB_OUTPUT
+ else
+ echo "runId=0" >> $GITHUB_OUTPUT
+ fi
+ else
+ echo "runId=${{ inputs.previous_run_id }}" >> $GITHUB_OUTPUT
+ echo "pr=${{ steps.fetch_pr.outputs.pr }}" >> $GITHUB_OUTPUT
+ fi
- name: Get the diff from base branch
continue-on-error: true
@@ -39,74 +72,293 @@ jobs:
non_ts_files=()
for file in "${files[@]}"; do
if [[ $file != *.ts ]]; then
- non_ts_files+=("$file")
+ non_ts_files+=("<li> $file")
fi
done
echo "non_ts_files=${non_ts_files[@]}" >> $GITHUB_OUTPUT
echo "non_ts_files_count=${#non_ts_files[@]}" >> $GITHUB_OUTPUT
- name: Print the files
- if: steps.check_files.outputs.non_ts_files_count != 0
+ if: steps.check_files.outputs.non_ts_files_count != 0 && steps.args.outputs.pr == '0'
run: |
echo "${{ steps.check_files.outputs.non_ts_files }}"
- exit 1
+
+ - name: Comment the filenames if PR is there
+ if: steps.check_files.outputs.non_ts_files_count != 0 && steps.args.outputs.pr != '0'
+ uses: peter-evans/create-or-update-comment@v1
+ with:
+ issue-number: ${{ fromJson(steps.args.outputs.pr) }}
+ body: |
+ <b>Below new test files are written in js 🔴 </b>
+ <b>Expected format ts. Please fix and retrigger ci-test-limit:</b>
+ <ol>${{ steps.check_files.outputs.non_ts_files }}</ol>
+ - if: steps.check_files.outputs.non_ts_files_count != 0
+ run: exit 1
+
+ - name: Add a comment on the PR with link to workflow run
+ if: success() && steps.args.outputs.pr != '0'
+ uses: peter-evans/create-or-update-comment@v2
+ with:
+ issue-number: ${{ fromJson(steps.args.outputs.pr) }}
+ body: |
+ Tests running at: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
+ Workflow: `ci-test-limited`.
+ PR: ${{ fromJson(steps.args.outputs.pr) }}.
server-build:
name: server-build
needs: [file-check]
- if: success() && inputs.previous_run_id == '0'
+ if: success() && needs.file-check.outputs.runId == '0'
uses: ./.github/workflows/server-build.yml
secrets: inherit
with:
- pr: 0
+ pr: ${{fromJson(needs.file-check.outputs.pr)}}
skip-tests: "true"
client-build:
name: client-build
needs: [file-check]
- if: success() && inputs.previous_run_id == '0'
+ if: success() && needs.file-check.outputs.runId == '0'
uses: ./.github/workflows/client-build.yml
secrets: inherit
with:
- pr: 0
+ pr: ${{fromJson(needs.file-check.outputs.pr)}}
skip-tests: "true"
rts-build:
name: rts-build
needs: [file-check]
- if: success() && inputs.previous_run_id == '0'
+ if: success() && needs.file-check.outputs.runId == '0'
uses: ./.github/workflows/rts-build.yml
secrets: inherit
with:
- pr: 0
+ pr: ${{fromJson(needs.file-check.outputs.pr)}}
build-docker-image:
- needs: [ client-build, server-build, rts-build ]
+ needs: [ file-check, client-build, server-build, rts-build ]
# Only run if the build step is successful
- if: success() && inputs.previous_run_id == '0'
+ if: success() && needs.file-check.outputs.runId == '0'
name: build-docker-image
uses: ./.github/workflows/build-docker-image.yml
secrets: inherit
with:
- pr: 0
+ pr: ${{fromJson(needs.file-check.outputs.pr)}}
ci-test-limited:
- needs: [ build-docker-image ]
+ needs: [ file-check, build-docker-image ]
# Only run if the build step is successful
- if: success() && inputs.previous_run_id == '0'
+ if: success() && needs.file-check.outputs.runId == '0'
name: ci-test-limited
uses: ./.github/workflows/ci-test-limited.yml
secrets: inherit
with:
- pr: 0
+ pr: ${{fromJson(needs.file-check.outputs.pr)}}
ci-test-limited-existing-docker-image:
needs: [file-check]
# Only run if the previous run-id is provided
- if: success() && inputs.previous_run_id != '0'
+ if: success() && needs.file-check.outputs.runId != '0'
name: ci-test-limited-existing-image
uses: ./.github/workflows/ci-test-limited.yml
secrets: inherit
with:
- pr: 0
- previous-workflow-run-id: ${{ fromJson(inputs.previous_run_id) }}
+ pr: ${{fromJson(needs.file-check.outputs.pr)}}
+ previous-workflow-run-id: ${{ fromJson(needs.file-check.outputs.runId) }}
+
+ ci-test-result:
+ needs: [ file-check, ci-test-limited ]
+ # Only run if the ci-test-limited with matrices step is successful
+ if: always()
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+ steps:
+ # Deleting the existing dir's if any
+ - name: Delete existing directories
+ if: needs.ci-test-limited.result != 'success'
+ run: |
+ rm -f ~/failed_spec_ci
+ rm -f ~/combined_failed_spec_ci
+
+ # Force store previous cypress dashboard url from cache
+ - name: Store the previous cypress dashboard url
+ if: success()
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/cypress_url
+ key: ${{ github.run_id }}-dashboard-url-${{ github.run_attempt }}
+ restore-keys: |
+ ${{ github.run_id }}-dashboard-url
+
+ - name: Print cypress dashboard url
+ id: dashboard_url
+ run: |
+ cypress_url=$(cat ~/cypress_url)
+ echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
+
+ # Download failed_spec list for all jobs
+ - uses: actions/download-artifact@v3
+ if: needs.ci-test-limited.result != 'success'
+ id: download_ci
+ with:
+ name: failed-spec-ci
+ path: ~/failed_spec_ci
+
+ # In case for any ci job failure, create combined failed spec
+ - name: "combine all specs for CI"
+ if: needs.ci-test-limited.result != 'success'
+ run: |
+ echo "Debugging: failed specs in ~/failed_spec_ci/failed_spec_ci*"
+ cat ~/failed_spec_ci/failed_spec_ci*
+ cat ~/failed_spec_ci/failed_spec_ci* | sort -u >> ~/combined_failed_spec_ci
+
+ # Upload combined failed CI spec list to a file
+ # This is done for debugging.
+ - name: upload combined failed spec
+ if: needs.ci-test-limited.result != 'success'
+ uses: actions/upload-artifact@v3
+ with:
+ name: combined_failed_spec_ci
+ path: ~/combined_failed_spec_ci
+
+ - name: Get Latest flaky Tests
+ shell: bash
+ run: |
+ curl --request POST --url https://yatin-s-workspace-jk8ru5.us-east-1.xata.sh/db/CypressKnownFailures:main/tables/CypressKnownFailuires/query --header 'Authorization: Bearer ${{ secrets.XATA_TOKEN }}' --header 'Content-Type: application/json'|jq -r |grep Spec|cut -d ':' -f 2 2> /dev/null|sed 's/"//g'|sed 's/,//g' > ~/knownfailures
+
+ # Verify CI test failures against known failures
+ - name: Verify CI test failures against known failures
+ if: needs.ci-test-limited.result != 'success'
+ shell: bash
+ run: |
+ new_failed_spec_env="<ol>$(comm -1 -3 <(sort ~/knownfailures) <(sort -u ~/combined_failed_spec_ci) | sed 's/|cypress|cypress/\n/g' | sed 's/^/<li>/')</ol>"
+ echo "$new_failed_spec_env"
+ echo "new_failed_spec_env<<EOF" >> $GITHUB_ENV
+ echo "$new_failed_spec_env" >> $GITHUB_ENV
+ echo "EOF" >> $GITHUB_ENV
+
+ - name: Add a comment on the PR with new CI failures
+ if: needs.ci-test-limited.result != 'success'
+ uses: peter-evans/create-or-update-comment@v1
+ with:
+ issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
+ body: |
+ Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
+ Cypress dashboard: <a href="${{ steps.dashboard_url.outputs.dashboard_url }}" target="_blank"> Click here!</a>
+ The following are new failures, please fix them before merging the PR: ${{env.new_failed_spec_env}}
+ To know the list of identified flaky tests - <a href="https://app.appsmith.com/applications/613868bedd7786286ddd4a6a/pages/63ec710e8e503f763651791a" target="_blank">Refer here</a>
+
+ - name: Add a comment on the PR when ci-test-limited is success
+ if: needs.ci-test-limited.result == 'success'
+ uses: peter-evans/create-or-update-comment@v1
+ with:
+ issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
+ body: |
+ Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
+ Cypress dashboard url: <a href="${{ steps.dashboard_url.outputs.dashboard_url }}" target="_blank">Click here!</a>
+ All cypress tests have passed 🎉🎉🎉
+
+ - name: Check ci-test-limited set status
+ if: needs.ci-test-limited.result != 'success'
+ run: exit 1
+
+ ci-test-result-existing:
+ needs: [ file-check, ci-test-limited-existing-docker-image ]
+ # Only run if the ci-test-limited with matrices step is successful
+ if: needs.file-check.outputs.runId != '0'
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+ steps:
+ # Deleting the existing dir's if any
+ - name: Delete existing directories
+ if: needs.ci-test-limited-existing-docker-image.result != 'success'
+ run: |
+ rm -f ~/failed_spec_ci
+ rm -f ~/combined_failed_spec_ci
+
+ # Force store previous cypress dashboard url from cache
+ - name: Store the previous cypress dashboard url
+ if: success()
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/cypress_url
+ key: ${{ github.run_id }}-dashboard-url-${{ github.run_attempt }}
+ restore-keys: |
+ ${{ github.run_id }}-dashboard-url
+
+ - name: Print cypress dashboard url
+ id: dashboard_url
+ run: |
+ cypress_url=$(cat ~/cypress_url)
+ echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
+
+ # Download failed_spec list for all jobs
+ - uses: actions/download-artifact@v3
+ if: needs.ci-test-limited-existing-docker-image.result != 'success'
+ id: download_ci
+ with:
+ name: failed-spec-ci
+ path: ~/failed_spec_ci
+
+ # In case for any ci job failure, create combined failed spec
+ - name: "combine all specs for CI"
+ if: needs.ci-test-limited-existing-docker-image.result != 'success'
+ run: |
+ echo "Debugging: failed specs in ~/failed_spec_ci/failed_spec_ci*"
+ cat ~/failed_spec_ci/failed_spec_ci*
+ cat ~/failed_spec_ci/failed_spec_ci* | sort -u >> ~/combined_failed_spec_ci
+
+ # Upload combined failed CI spec list to a file
+ # This is done for debugging.
+ - name: upload combined failed spec
+ if: needs.ci-test-limited-existing-docker-image.result != 'success'
+ uses: actions/upload-artifact@v3
+ with:
+ name: combined_failed_spec_ci
+ path: ~/combined_failed_spec_ci
+
+ - name: Get Latest flaky Tests
+ shell: bash
+ run: |
+ curl --request POST --url https://yatin-s-workspace-jk8ru5.us-east-1.xata.sh/db/CypressKnownFailures:main/tables/CypressKnownFailuires/query --header 'Authorization: Bearer ${{ secrets.XATA_TOKEN }}' --header 'Content-Type: application/json'|jq -r |grep Spec|cut -d ':' -f 2 2> /dev/null|sed 's/"//g'|sed 's/,//g' > ~/knownfailures
+
+ # Verify CI test failures against known failures
+ - name: Verify CI test failures against known failures
+ if: needs.ci-test-limited-existing-docker-image.result != 'success'
+ shell: bash
+ run: |
+ new_failed_spec_env="<ol>$(comm -1 -3 <(sort ~/knownfailures) <(sort -u ~/combined_failed_spec_ci) | sed 's/|cypress|cypress/\n/g' | sed 's/^/<li>/')</ol>"
+ echo "$new_failed_spec_env"
+ echo "new_failed_spec_env<<EOF" >> $GITHUB_ENV
+ echo "$new_failed_spec_env" >> $GITHUB_ENV
+ echo "EOF" >> $GITHUB_ENV
+
+ - name: Add a comment on the PR with new CI failures
+ if: needs.ci-test-limited-existing-docker-image.result != 'success' && needs.file-check.outputs.pr != '0'
+ uses: peter-evans/create-or-update-comment@v1
+ with:
+ issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
+ body: |
+ Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
+ Cypress dashboard: <a href="${{ steps.dashboard_url.outputs.dashboard_url }}" target="_blank"> Click here!</a>
+ The following are new failures, please fix them before merging the PR: ${{env.new_failed_spec_env}}
+ To know the list of identified flaky tests - <a href="https://app.appsmith.com/applications/613868bedd7786286ddd4a6a/pages/63ec710e8e503f763651791a" target="_blank">Refer here</a>
+
+ - name: Add a comment on the PR when ci-test-limited-existing-docker-image is success
+ if: needs.ci-test-limited-existing-docker-image.result == 'success' && needs.file-check.outputs.pr != '0'
+ uses: peter-evans/create-or-update-comment@v1
+ with:
+ issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
+ body: |
+ Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
+ Cypress dashboard url: <a href="${{ steps.dashboard_url.outputs.dashboard_url }}" target="_blank">Click here!</a>
+ All cypress tests have passed 🎉🎉🎉
+
+ - name: Check ci-test-limited-existing-docker-image set status
+ if: needs.ci-test-limited-existing-docker-image.result != 'success'
+ run: exit 1
diff --git a/.github/workflows/ci-test-limited-command.yml b/.github/workflows/ci-test-limited-command.yml
new file mode 100644
index 000000000000..b4e360842ecb
--- /dev/null
+++ b/.github/workflows/ci-test-limited-command.yml
@@ -0,0 +1,22 @@
+# If someone with write access comments "/ci-test-limit" on a pull request, emit a repository_dispatch event
+name: CI Test Limited Command
+
+on:
+ issue_comment:
+ types: [created]
+
+jobs:
+ ci-test-limit:
+ runs-on: ubuntu-latest
+ # Only run for PRs, not issue comments
+ if: |
+ github.event.issue.pull_request
+ steps:
+
+ - name: Slash Command Dispatch
+ uses: peter-evans/slash-command-dispatch@v3
+ with:
+ issue-type: pull-request
+ token: ${{ secrets.APPSMITH_CI_TEST_PAT }}
+ commands: |
+ ci-test-limit
\ No newline at end of file
diff --git a/.github/workflows/ci-test-limited.yml b/.github/workflows/ci-test-limited.yml
index 5fad2376eecc..e4311793c71b 100644
--- a/.github/workflows/ci-test-limited.yml
+++ b/.github/workflows/ci-test-limited.yml
@@ -87,20 +87,28 @@ jobs:
run_result_env=$(cat ~/run_result)
echo "::set-output name=run_result::$run_result_env"
- # Download failed_spec list for all jobs in case of rerun
- - uses: actions/download-artifact@v3
+ # In case this is second attempt try restoring failed tests
+ - name: Restore the previous failed combine result
if: steps.run_result.outputs.run_result == 'failedtest'
+ uses: actions/download-artifact@v3
with:
- name: failed-spec-ci
- path: ~/failed_spec_ci
+ name: combined_failed_spec_ci
+ path: ~/combined_failed_spec_ci
- # In case of rerun combine all the failed specs and set it in env
- - name: combine all specs for CI in case of rerun
+ # failed_spec_env will contain list of all failed specs
+ # We are using environment variable instead of regular to support multiline
+ - name: Get failed_spec
+ id: failed_spec
if: steps.run_result.outputs.run_result == 'failedtest'
+ working-directory: app/client
run: |
- failed_spec_env=$(cat ~/failed_spec_ci/failed_spec_ci* | sort -u)
echo "failed_spec_env<<EOF" >> $GITHUB_ENV
- echo "$failed_spec_env" >> $GITHUB_ENV
+ while IFS= read -r line
+ do
+ spec_name=$(echo $line | awk -F'/' '{print $NF}')
+ failed_spec_env=$(find . -name $spec_name | sed 's|./||')
+ echo "$failed_spec_env" >> $GITHUB_ENV
+ done < ~/combined_failed_spec_ci/combined_failed_spec_ci
echo "EOF" >> $GITHUB_ENV
# Get specs to run
@@ -270,6 +278,7 @@ jobs:
echo Remote $COMMIT_INFO_REMOTE
- name: Run the cypress test
+ id: cypress_test
if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest'
uses: cypress-io/github-action@v5
env:
@@ -331,6 +340,7 @@ jobs:
# In case of second attempt only run failed specs
- name: Run the cypress test with failed tests
+ id: cypress_test_failedtest
if: steps.run_result.outputs.run_result == 'failedtest'
uses: cypress-io/github-action@v5
env:
@@ -460,6 +470,25 @@ jobs:
name: server-logs-${{ matrix.job }}
path: app/server/server-logs.log
+ - name: get cypress url dashboard url
+ id: dashboard_url
+ if: always()
+ run: |
+ if [[ "${{steps.run_result.outputs.run_result }}" != "success" && "${{steps.run_result.outputs.run_result }}" != "failedtest" ]]; then
+ echo ${{ steps.cypress_test.outputs.resultsUrl }} >> ~/cypress_url
+ elif [[ "${{steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
+ echo ${{ steps.cypress_test_failedtest.outputs.resultsUrl }} >> ~/cypress_url
+ fi
+
+ # Force store previous run result to cache
+ - name: Store the previous run result
+ if: success()
+ uses: actions/cache/save@v3
+ with:
+ path: |
+ ~/cypress_url
+ key: ${{ github.run_id }}-dashboard-url-${{ github.run_attempt }}
+
# Set status = success
- name: Save the status of the run
run: |
|
f310e858bffb2d6779292d0a4587f42f8253e081
|
2022-10-21 12:25:18
|
Pawan Kumar
|
feat: Add a read only mode to rating widget (#17465)
| false
|
Add a read only mode to rating widget (#17465)
|
feat
|
diff --git a/app/client/src/constants/WidgetConstants.tsx b/app/client/src/constants/WidgetConstants.tsx
index 157368684e79..e589725e85ed 100644
--- a/app/client/src/constants/WidgetConstants.tsx
+++ b/app/client/src/constants/WidgetConstants.tsx
@@ -70,7 +70,7 @@ export const layoutConfigurations: LayoutConfigurations = {
FLUID: { minWidth: -1, maxWidth: -1 },
};
-export const LATEST_PAGE_VERSION = 64;
+export const LATEST_PAGE_VERSION = 65;
export const GridDefaults = {
DEFAULT_CELL_SIZE: 1,
diff --git a/app/client/src/utils/DSLMigration.test.ts b/app/client/src/utils/DSLMigration.test.ts
index 31dc34d76f6e..83cd53b48e98 100644
--- a/app/client/src/utils/DSLMigration.test.ts
+++ b/app/client/src/utils/DSLMigration.test.ts
@@ -19,6 +19,7 @@ import * as selectWidgetMigration from "./migrations/SelectWidget";
import * as mapChartReskinningMigrations from "./migrations/MapChartReskinningMigrations";
import { LATEST_PAGE_VERSION } from "constants/WidgetConstants";
import { originalDSLForDSLMigrations } from "./testDSLs";
+import * as rateWidgetMigrations from "./migrations/RateWidgetMigrations";
type Migration = {
functionLookup: {
@@ -624,6 +625,15 @@ const migrations: Migration[] = [
],
version: 63,
},
+ {
+ functionLookup: [
+ {
+ moduleObj: rateWidgetMigrations,
+ functionName: "migrateRateWidgetDisabledState",
+ },
+ ],
+ version: 64,
+ },
];
const mockFnObj: Record<number, any> = {};
diff --git a/app/client/src/utils/DSLMigrations.ts b/app/client/src/utils/DSLMigrations.ts
index 34cb01554275..0eef63ca7f12 100644
--- a/app/client/src/utils/DSLMigrations.ts
+++ b/app/client/src/utils/DSLMigrations.ts
@@ -62,6 +62,7 @@ import { migrateCheckboxSwitchProperty } from "./migrations/PropertyPaneMigratio
import { migrateChartWidgetReskinningData } from "./migrations/ChartWidgetReskinningMigrations";
import { MigrateSelectTypeWidgetDefaultValue } from "./migrations/SelectWidget";
import { migrateMapChartWidgetReskinningData } from "./migrations/MapChartReskinningMigrations";
+import { migrateRateWidgetDisabledState } from "./migrations/RateWidgetMigrations";
/**
* adds logBlackList key for all list widget children
@@ -1121,6 +1122,11 @@ export const transformDSL = (
if (currentDSL.version === 63) {
currentDSL = migrateMapChartWidgetReskinningData(currentDSL);
+ currentDSL.version = 64;
+ }
+
+ if (currentDSL.version === 64) {
+ currentDSL = migrateRateWidgetDisabledState(currentDSL);
currentDSL.version = LATEST_PAGE_VERSION;
}
diff --git a/app/client/src/utils/migrations/RateWidgetMigrations.ts b/app/client/src/utils/migrations/RateWidgetMigrations.ts
new file mode 100644
index 000000000000..0c80d1486315
--- /dev/null
+++ b/app/client/src/utils/migrations/RateWidgetMigrations.ts
@@ -0,0 +1,52 @@
+import { isDynamicValue } from "utils/DynamicBindingUtils";
+import { WidgetProps } from "widgets/BaseWidget";
+import { DSLWidget } from "widgets/constants";
+
+// migrate all rate widgets with isDisabled = true to isReadOnly = true
+export function migrateRateWidgetDisabledState(currentDSL: DSLWidget) {
+ currentDSL.children = currentDSL.children?.map((child: WidgetProps) => {
+ if (child.type === "RATE_WIDGET") {
+ // if isDisabled is true, set isReadOnly to true
+ if (child.isDisabled === true) {
+ child.isDisabled = false;
+ child.isReadOnly = true;
+ } else if (
+ // if isDisabled is a dynamic value, set isReadOnly to the same dynamic value
+ typeof child.isDisabled === "string" &&
+ isDynamicValue(child.isDisabled)
+ ) {
+ child.isReadOnly = child.isDisabled;
+ child.isDisabled = false;
+
+ // add readonly to dynamic binding
+ child.dynamicBindingPathList = [
+ ...(child.dynamicBindingPathList || []),
+ {
+ key: "isReadOnly",
+ },
+ ];
+
+ child.dynamicPropertyPathList = [
+ ...(child.dynamicPropertyPathList || []),
+ {
+ key: "isReadOnly",
+ },
+ ];
+
+ // remove readonly from dynamic binding
+ child.dynamicBindingPathList = child.dynamicBindingPathList.filter(
+ (item) => item.key !== "isDisabled",
+ );
+
+ child.dynamicPropertyPathList = child.dynamicPropertyPathList.filter(
+ (item) => item.key !== "isDisabled",
+ );
+ }
+ } else if (child.children && child.children.length > 0) {
+ child = migrateRateWidgetDisabledState(child);
+ }
+ return child;
+ });
+
+ return currentDSL;
+}
diff --git a/app/client/src/widgets/RateWidget/component/index.tsx b/app/client/src/widgets/RateWidget/component/index.tsx
index 24caef7d16a6..2fbf4a696f7c 100644
--- a/app/client/src/widgets/RateWidget/component/index.tsx
+++ b/app/client/src/widgets/RateWidget/component/index.tsx
@@ -19,6 +19,7 @@ import { ComponentProps } from "widgets/BaseComponent";
interface RateContainerProps {
isDisabled: boolean;
+ readonly?: boolean;
}
export const RateContainer = styled.div<RateContainerProps>`
@@ -80,50 +81,53 @@ export interface RateComponentProps extends ComponentProps {
bottomRow?: number;
}
-function renderStarsWithTooltip(props: RateComponentProps) {
+const getIconColor = (props: RateComponentProps, isActive?: boolean) => {
+ const { activeColor, inactiveColor, isDisabled } = props;
+
+ if (isDisabled) {
+ return isActive
+ ? "var(--wds-color-bg-disabled-strong)"
+ : inactiveColor ?? "var(--wds-color-icon)";
+ }
+
+ return isActive
+ ? activeColor ?? "var(--wds-color-icon)"
+ : inactiveColor ?? "var(--wds-color-icon)";
+};
+
+function renderStarsWithTooltip(props: RateComponentProps, isActive?: boolean) {
const rateTooltips = props.tooltips || [];
const rateTooltipsCount = rateTooltips.length;
const deltaCount = props.maxCount - rateTooltipsCount;
if (rateTooltipsCount === 0) {
return (
<Star
- color={
- props.isDisabled
- ? "var(--wds-color-bg-disabled-strong)"
- : props.activeColor
- }
+ color={getIconColor(props, isActive)}
icon={IconNames.STAR}
iconSize={RATE_SIZES[props.size]}
- isActive
+ isActive={isActive}
isDisabled={props.isDisabled}
/>
);
}
+
const starWithTooltip = rateTooltips.map((tooltip) => (
<TooltipComponent content={tooltip} key={tooltip} position="top">
<Star
- color={
- props.isDisabled
- ? "var(--wds-color-bg-disabled-strong)"
- : props.activeColor
- }
+ color={getIconColor(props, isActive)}
icon={IconNames.STAR}
iconSize={RATE_SIZES[props.size]}
- isActive
+ isActive={isActive}
isDisabled={props.isDisabled}
/>
</TooltipComponent>
));
const starWithoutTooltip = _.times(deltaCount, (num: number) => (
<Star
- color={
- props.isDisabled
- ? "var(--wds-color-bg-disabled-strong)"
- : props.activeColor
- }
+ color={getIconColor(props, isActive)}
icon={IconNames.STAR}
iconSize={RATE_SIZES[props.size]}
- isActive
+ isActive={isActive}
isDisabled={props.isDisabled}
key={num}
/>
@@ -136,33 +140,24 @@ function RateComponent(props: RateComponentProps) {
const rateContainerRef = React.createRef<HTMLDivElement>();
const {
- inactiveColor,
isAllowHalf,
isDisabled,
maxCount,
onValueChanged,
readonly,
- size,
value,
} = props;
return (
- <RateContainer isDisabled={Boolean(isDisabled)} ref={rateContainerRef}>
+ <RateContainer
+ isDisabled={Boolean(isDisabled)}
+ readonly={readonly}
+ ref={rateContainerRef}
+ >
<Rating
- emptySymbol={
- <Star
- color={
- isDisabled
- ? "var(--wds-color-bg-strong)"
- : inactiveColor ?? "var(--wds-color-bg)"
- }
- icon={IconNames.STAR}
- iconSize={RATE_SIZES[size]}
- isDisabled={isDisabled}
- />
- }
+ emptySymbol={renderStarsWithTooltip(props, false)}
fractions={isAllowHalf ? 2 : 1}
- fullSymbol={renderStarsWithTooltip(props)}
+ fullSymbol={renderStarsWithTooltip(props, true)}
initialRating={value}
onChange={onValueChanged}
readonly={readonly}
diff --git a/app/client/src/widgets/RateWidget/index.ts b/app/client/src/widgets/RateWidget/index.ts
index 64c90e34d559..f7bca27d576b 100644
--- a/app/client/src/widgets/RateWidget/index.ts
+++ b/app/client/src/widgets/RateWidget/index.ts
@@ -20,6 +20,7 @@ export const CONFIG = {
isRequired: false,
isAllowHalf: false,
isDisabled: false,
+ isReadOnly: false,
tooltips: ["Terrible", "Bad", "Neutral", "Good", "Great"],
widgetName: "Rating",
},
diff --git a/app/client/src/widgets/RateWidget/widget/index.tsx b/app/client/src/widgets/RateWidget/widget/index.tsx
index 202c3253b647..098dd67e05b3 100644
--- a/app/client/src/widgets/RateWidget/widget/index.tsx
+++ b/app/client/src/widgets/RateWidget/widget/index.tsx
@@ -154,6 +154,16 @@ class RateWidget extends BaseWidget<RateWidgetProps, WidgetState> {
isTriggerProperty: false,
validation: { type: ValidationTypes.BOOLEAN },
},
+ {
+ propertyName: "isReadOnly",
+ helpText: "Makes the widget read only",
+ label: "Read only",
+ controlType: "SWITCH",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.BOOLEAN },
+ },
{
propertyName: "animateLoading",
label: "Animate Loading",
@@ -284,7 +294,7 @@ class RateWidget extends BaseWidget<RateWidgetProps, WidgetState> {
leftColumn={this.props.leftColumn}
maxCount={this.props.maxCount}
onValueChanged={this.valueChangedHandler}
- readonly={this.props.isDisabled}
+ readonly={this.props.isReadOnly}
rightColumn={this.props.rightColumn}
size={this.props.size}
tooltips={this.props.tooltips}
@@ -311,6 +321,7 @@ export interface RateWidgetProps extends WidgetProps {
isAllowHalf?: boolean;
onRateChanged?: string;
tooltips?: Array<string>;
+ isReadOnly?: boolean;
}
export default RateWidget;
|
7dac89098cc953a8f42f10dc87914849f7122af4
|
2024-03-29 11:48:59
|
Hetu Nandu
|
chore: Add Editor Pane segments context switch tests (#32224)
| false
|
Add Editor Pane segments context switch tests (#32224)
|
chore
|
diff --git a/app/client/cypress/e2e/Regression/ClientSide/IDE/Editor_Segment_Context_Switching_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/IDE/Editor_Segment_Context_Switching_spec.ts
new file mode 100644
index 000000000000..44feb6e5af78
--- /dev/null
+++ b/app/client/cypress/e2e/Regression/ClientSide/IDE/Editor_Segment_Context_Switching_spec.ts
@@ -0,0 +1,105 @@
+import { agHelper, homePage } from "../../../../support/Objects/ObjectsCore";
+
+import EditorNavigation, {
+ AppSidebar,
+ AppSidebarButton,
+ EntityType,
+ PageLeftPane,
+ PagePaneSegment,
+} from "../../../../support/Pages/EditorNavigation";
+import reconnectDatasourceModal from "../../../../locators/ReconnectLocators";
+
+describe("Editor Segment Context Switch", { tags: ["@tag.IDE"] }, function () {
+ before("Import the test application", () => {
+ homePage.CreateNewWorkspace("IDETest", true);
+ homePage.ImportApp("SampleAppIDETest.json", "IDETest");
+ cy.wait("@importNewApplication").then((interception) => {
+ agHelper.Sleep();
+ const { isPartialImport } = interception.response?.body.data;
+ cy.log("isPartialImport is", isPartialImport);
+ if (isPartialImport) {
+ // should reconnect modal
+ cy.get("body").then(($ele) => {
+ if ($ele.find(reconnectDatasourceModal.SkipToAppBtn))
+ agHelper.GetNClick(reconnectDatasourceModal.SkipToAppBtn, 0, true);
+ else agHelper.ClickButton("Got it");
+ agHelper.Sleep(2000);
+ });
+ } else {
+ homePage.AssertImportToast();
+ }
+ });
+ });
+ it("will select an item when switched to it", () => {
+ // Check JS item is selected
+ PageLeftPane.switchSegment(PagePaneSegment.JS);
+ PageLeftPane.selectedItem().should("be.visible");
+
+ // Check Query item is selected
+ PageLeftPane.switchSegment(PagePaneSegment.Queries);
+ PageLeftPane.selectedItem().should("be.visible");
+
+ // Check UI item is selected
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
+ PageLeftPane.selectedItem().should("be.visible");
+ });
+ it("will select previously selected item when switched to it", () => {
+ // Select a UI item
+ EditorNavigation.SelectEntityByName(
+ "txt_longitudeValue",
+ EntityType.Widget,
+ {},
+ ["con_userDetails"],
+ );
+
+ // Select a JS item
+ EditorNavigation.SelectEntityByName("Transformers", EntityType.JSObject);
+
+ // Select a Query item
+ EditorNavigation.SelectEntityByName("addUser", EntityType.Query);
+
+ // Check UI item is selected
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
+ PageLeftPane.selectedItem().contains("txt_longitudeValue");
+
+ // Check JS item is selected
+ PageLeftPane.switchSegment(PagePaneSegment.JS);
+ PageLeftPane.selectedItem().contains("Transformers");
+
+ // Check Query item is selected
+ PageLeftPane.switchSegment(PagePaneSegment.Queries);
+ PageLeftPane.selectedItem().contains("addUser");
+ });
+ it("will not retain the add state of the segment", () => {
+ // Switch to add new in UI
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
+ PageLeftPane.switchToAddNew();
+
+ // Switch to add new in Query
+ PageLeftPane.switchSegment(PagePaneSegment.Queries);
+ PageLeftPane.switchToAddNew();
+
+ // Assert add state not in UI
+ PageLeftPane.switchSegment(PagePaneSegment.UI);
+ // Assumes that selected item is not visible when in add state
+ PageLeftPane.selectedItem().should("be.visible");
+
+ // Assert add state not in Query
+ PageLeftPane.switchSegment(PagePaneSegment.Queries);
+ // Assumes that selected item is not visible when in add state
+ PageLeftPane.selectedItem().should("be.visible");
+ });
+
+ it("will retain segment and selected item on switching IDE state", () => {
+ // Switch to add new in Query
+ PageLeftPane.switchSegment(PagePaneSegment.Queries);
+ // Select a Query item
+ EditorNavigation.SelectEntityByName("updateUsers", EntityType.Query);
+ // Switch to Data state
+ AppSidebar.navigate(AppSidebarButton.Data);
+
+ // Switch back to Editor state
+ AppSidebar.navigate(AppSidebarButton.Editor);
+ PageLeftPane.selectedItem().contains("updateUsers");
+ });
+});
diff --git a/app/client/cypress/e2e/Regression/ClientSide/IDE/MaintainContext&Focus_spec.js b/app/client/cypress/e2e/Regression/ClientSide/IDE/MaintainContext&Focus_spec.js
index 78d60cf29eb1..a6d5681ba0cb 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/IDE/MaintainContext&Focus_spec.js
+++ b/app/client/cypress/e2e/Regression/ClientSide/IDE/MaintainContext&Focus_spec.js
@@ -16,7 +16,7 @@ const queryLocators = require("../../../../locators/QueryEditor.json");
describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {
before("Import the test application", () => {
homePage.CreateNewWorkspace("MaintainContext&Focus", true);
- homePage.ImportApp("ContextSwitching.json");
+ homePage.ImportApp("ContextSwitching.json", "MaintainContext");
cy.wait("@importNewApplication").then((interception) => {
agHelper.Sleep();
const { isPartialImport } = interception.response.body.data;
diff --git a/app/client/cypress/fixtures/SampleAppIDETest.json b/app/client/cypress/fixtures/SampleAppIDETest.json
new file mode 100644
index 000000000000..512677c53710
--- /dev/null
+++ b/app/client/cypress/fixtures/SampleAppIDETest.json
@@ -0,0 +1,2541 @@
+{
+ "artifactJsonType": "APPLICATION",
+ "clientSchemaVersion": 1.0,
+ "serverSchemaVersion": 7.0,
+ "exportedApplication": {
+ "name": "SampleAppForTest",
+ "isPublic": false,
+ "pages": [
+ {
+ "id": "Page1",
+ "isDefault": true
+ }
+ ],
+ "publishedPages": [
+ {
+ "isDefault": true
+ }
+ ],
+ "viewMode": false,
+ "appIsExample": false,
+ "unreadCommentThreads": 0.0,
+ "unpublishedApplicationDetail": {
+ "appPositioning": {
+ "type": "FIXED"
+ }
+ },
+ "publishedApplicationDetail": {
+ "appPositioning": {
+ "type": "FIXED"
+ }
+ },
+ "color": "#F4FFDE",
+ "icon": "flag",
+ "slug": "sampleappfortest",
+ "unpublishedCustomJSLibs": [
+ {
+ "uidString": "xmlParser_https://cdnjs.cloudflare.com/ajax/libs/fast-xml-parser/3.17.5/parser.min.js"
+ }
+ ],
+ "publishedCustomJSLibs": [],
+ "evaluationVersion": 2.0,
+ "applicationVersion": 2.0,
+ "collapseInvisibleWidgets": true,
+ "isManualUpdate": false,
+ "deleted": false
+ },
+ "datasourceList": [
+ {
+ "datasourceConfiguration": {
+ "connection": {
+ "mode": "READ_WRITE",
+ "ssl": {
+ "authType": "DEFAULT"
+ }
+ },
+ "endpoints": [
+ {
+ "host": "mockdb.internal.appsmith.com"
+ }
+ ]
+ },
+ "name": "users",
+ "pluginId": "postgres-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "isMock": true,
+ "deleted": false,
+ "gitSyncId": "650831bb7026ee62d69c4488_6508346300dedf0228b041f5"
+ }
+ ],
+ "customJSLibList": [
+ {
+ "name": "xmlParser",
+ "uidString": "xmlParser_https://cdnjs.cloudflare.com/ajax/libs/fast-xml-parser/3.17.5/parser.min.js",
+ "accessor": [
+ "xmlParser"
+ ],
+ "url": "https://cdnjs.cloudflare.com/ajax/libs/fast-xml-parser/3.17.5/parser.min.js",
+ "version": "3.17.5",
+ "defs": "{\"!name\":\"LIB/xmlParser\",\"xmlParser\":{\"parse\":{\"!type\":\"fn()\",\"prototype\":{}},\"convertTonimn\":{\"!type\":\"fn()\",\"prototype\":{}},\"getTraversalObj\":{\"!type\":\"fn()\",\"prototype\":{}},\"convertToJson\":{\"!type\":\"fn()\",\"prototype\":{}},\"convertToJsonString\":{\"!type\":\"fn()\",\"prototype\":{}},\"validate\":{\"!type\":\"fn()\",\"prototype\":{}},\"j2xParser\":{\"!type\":\"fn()\",\"prototype\":{\"parse\":{\"!type\":\"fn()\",\"prototype\":{}},\"j2x\":{\"!type\":\"fn()\",\"prototype\":{}}}},\"parseToNimn\":{\"!type\":\"fn()\",\"prototype\":{}}}}",
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ }
+ ],
+ "pageList": [
+ {
+ "unpublishedPage": {
+ "name": "Page1",
+ "slug": "page1",
+ "layouts": [
+ {
+ "viewMode": false,
+ "dsl": {
+ "widgetName": "MainContainer",
+ "backgroundColor": "none",
+ "rightColumn": 1224.0,
+ "snapColumns": 64.0,
+ "detachFromLayout": true,
+ "widgetId": "0",
+ "topRow": 0.0,
+ "bottomRow": 1300.0,
+ "containerStyle": "none",
+ "snapRows": 128.0,
+ "parentRowSpace": 1.0,
+ "type": "CANVAS_WIDGET",
+ "canExtend": true,
+ "version": 89.0,
+ "minHeight": 1300.0,
+ "parentColumnSpace": 1.0,
+ "dynamicBindingPathList": [],
+ "leftColumn": 0.0,
+ "children": [
+ {
+ "boxShadow": "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",
+ "widgetName": "con_userDetails",
+ "isCanvas": true,
+ "displayName": "Form",
+ "iconSVG": "/static/media/icon.ea3e08d130e59c56867ae40114c10eed.svg",
+ "searchTags": [
+ "group"
+ ],
+ "topRow": 5.0,
+ "bottomRow": 63.0,
+ "parentRowSpace": 10.0,
+ "type": "FORM_WIDGET",
+ "hideCard": false,
+ "shouldScrollContents": true,
+ "animateLoading": true,
+ "parentColumnSpace": 18.1875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 41.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "children": [
+ {
+ "boxShadow": "none",
+ "widgetName": "Canvas4CopyCopy",
+ "displayName": "Canvas",
+ "topRow": 0.0,
+ "bottomRow": 580.0,
+ "parentRowSpace": 1.0,
+ "type": "CANVAS_WIDGET",
+ "canExtend": false,
+ "hideCard": true,
+ "minHeight": 400.0,
+ "parentColumnSpace": 1.0,
+ "leftColumn": 0.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "accentColor"
+ }
+ ],
+ "children": [
+ {
+ "widgetName": "txt_userFullName",
+ "displayName": "Text",
+ "iconSVG": "/static/media/icon.97c59b523e6f70ba6f40a10fc2c7c5b5.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 2.0,
+ "bottomRow": 6.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "dynamicTriggerPathList": [],
+ "leftColumn": 18.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "#FFC13D",
+ "text": "{{tbl_userInfo.selectedRow.name}}",
+ "key": "799bmivq9p",
+ "isDeprecated": false,
+ "rightColumn": 60.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "FIXED",
+ "widgetId": "earpbnt9he",
+ "isVisible": true,
+ "fontStyle": "BOLD",
+ "textColor": "#231F20",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "maxDynamicHeight": 9000.0,
+ "fontSize": "1.25rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_countryValue",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 33.0,
+ "bottomRow": 37.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 25.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{tbl_userInfo.selectedRow.country}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 62.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "96g43uemr8",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 30.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 34.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_updatedAtValue",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 53.0,
+ "bottomRow": 57.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 26.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{Transformers.getDate(tbl_userInfo.selectedRow.updated_at)}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 63.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "7jznqzxq9h",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 50.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 54.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_createdAtValue",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 48.0,
+ "bottomRow": 52.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 26.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{Transformers.getDate(tbl_userInfo.selectedRow.created_at)}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 63.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "2d4osoei17",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 45.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 49.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_longitudeValue",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 43.0,
+ "bottomRow": 47.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 26.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{tbl_userInfo.selectedRow.longitude}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 63.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "a020tfv49j",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 40.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 44.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_latitudeValue",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 38.0,
+ "bottomRow": 42.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 26.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{tbl_userInfo.selectedRow.latitude}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 63.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "atp0j1o62g",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 35.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 39.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_phoneValue",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 27.0,
+ "bottomRow": 31.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 26.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{tbl_userInfo.selectedRow.phone}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 63.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "bp3i8o7ye2",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 25.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 29.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_dobValue",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 20.0,
+ "bottomRow": 24.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 25.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{Transformers.getDate(tbl_userInfo.selectedRow.dob)}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 62.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "bv594hfsam",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 19.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 23.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_genderValue",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 15.0,
+ "bottomRow": 19.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 25.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{tbl_userInfo.selectedRow.gender}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 62.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "qgs4juppeu",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 14.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 18.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_userEmail",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 6.0,
+ "bottomRow": 11.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 18.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "text"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "{{tbl_userInfo.selectedRow.email}}",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 61.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "uvx96wkpk2",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 6.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 10.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_country",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 33.0,
+ "bottomRow": 37.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Country",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 25.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "nspbxnrriu",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#71717a",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 30.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 34.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_updatedAt",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 53.0,
+ "bottomRow": 57.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Updated at",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 25.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "zyow7o455v",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#71717a",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 50.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 54.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_createdAt",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 48.0,
+ "bottomRow": 52.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Created at",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 25.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "ud2f8prz3e",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#71717a",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 45.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 49.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_longitude",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 43.0,
+ "bottomRow": 47.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Longitude",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 25.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "9kn2p05bw4",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#71717a",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 40.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 44.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_latitude",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 38.0,
+ "bottomRow": 42.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Latitude",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 25.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "1ry4ett1df",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#71717a",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 35.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 39.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_phone",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 27.0,
+ "bottomRow": 32.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Phone Number",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 25.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "2hvhr5009y",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#71717a",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 25.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 29.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_dob",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 20.0,
+ "bottomRow": 25.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Date of Birth",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 25.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "4ql90avlfn",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#71717a",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 19.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 23.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 9.0,
+ "widgetName": "txt_gender",
+ "displayName": "Text",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.a47d6d5dbbb718c4dc4b2eb4f218c1b7.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 15.0,
+ "bottomRow": 19.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 18.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "fontFamily"
+ },
+ {
+ "key": "borderRadius"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Gender",
+ "key": "jl31nlbh5s",
+ "isDeprecated": false,
+ "rightColumn": 25.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "9blbsfdbx4",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "",
+ "textColor": "#71717a",
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Suggested",
+ "Content"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 5.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 14.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 2.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 18.0,
+ "fontSize": "1rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "mobileBottomRow": 8.0,
+ "widgetName": "div_detailDivider",
+ "thickness": 2.0,
+ "displayName": "Divider",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.3b7d47d7bd70da418a827287042cbb7f.svg",
+ "searchTags": [
+ "line"
+ ],
+ "topRow": 11.0,
+ "bottomRow": 15.0,
+ "parentRowSpace": 10.0,
+ "type": "DIVIDER_WIDGET",
+ "capType": "nc",
+ "hideCard": false,
+ "mobileRightColumn": 38.0,
+ "animateLoading": true,
+ "parentColumnSpace": 5.5732421875,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [],
+ "key": "e0sxfu5i3g",
+ "dividerColor": "#f4f4f5",
+ "orientation": "horizontal",
+ "strokeStyle": "solid",
+ "isDeprecated": false,
+ "rightColumn": 61.0,
+ "widgetId": "2r36qxo36t",
+ "capSide": 0.0,
+ "minWidth": 450.0,
+ "isVisible": true,
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Layout"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 4.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 10.0,
+ "mobileLeftColumn": 18.0,
+ "originalBottomRow": 14.0
+ },
+ {
+ "boxShadow": "none",
+ "mobileBottomRow": 13.0,
+ "widgetName": "img_userImage",
+ "displayName": "Image",
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.69b0f0dd810281fbd6e34fc2c3f39344.svg",
+ "topRow": 1.0,
+ "bottomRow": 10.0,
+ "parentRowSpace": 10.0,
+ "type": "IMAGE_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 11.0,
+ "animateLoading": true,
+ "parentColumnSpace": 5.56884765625,
+ "dynamicTriggerPathList": [],
+ "imageShape": "RECTANGLE",
+ "leftColumn": 2.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "image"
+ }
+ ],
+ "defaultImage": "https://assets.appsmith.com/widgets/default.png",
+ "key": "0pndua8j2k",
+ "image": "{{tbl_userInfo.selectedRow.image}}",
+ "isDeprecated": false,
+ "rightColumn": 18.0,
+ "objectFit": "cover",
+ "widgetId": "7zythx25oq",
+ "isVisible": true,
+ "version": 1.0,
+ "parentId": "j3f4bcw9b3",
+ "tags": [
+ "Media"
+ ],
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 1.0,
+ "maxZoomLevel": 1.0,
+ "enableDownload": false,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 0.0,
+ "enableRotation": false
+ }
+ ],
+ "key": "tju5wikk1m",
+ "isDeprecated": false,
+ "rightColumn": 436.5,
+ "detachFromLayout": true,
+ "widgetId": "j3f4bcw9b3",
+ "accentColor": "{{appsmith.theme.colors.primaryColor}}",
+ "containerStyle": "none",
+ "isVisible": true,
+ "version": 1.0,
+ "parentId": "k0zzyht8o5",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ }
+ ],
+ "key": "b2g4hzss2y",
+ "backgroundColor": "#FFFFFF",
+ "isDeprecated": false,
+ "rightColumn": 63.0,
+ "dynamicHeight": "FIXED",
+ "widgetId": "k0zzyht8o5",
+ "isVisible": true,
+ "parentId": "0",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "maxDynamicHeight": 9000.0,
+ "minDynamicHeight": 10.0
+ },
+ {
+ "mobileBottomRow": 5.0,
+ "widgetName": "txt_pageTitle",
+ "displayName": "Text",
+ "iconSVG": "/static/media/icon.c3b6033f570046f8c6288d911333a827.svg",
+ "searchTags": [
+ "typography",
+ "paragraph",
+ "label"
+ ],
+ "topRow": 0.0,
+ "bottomRow": 4.0,
+ "parentRowSpace": 10.0,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "mobileRightColumn": 30.0,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "parentColumnSpace": 6.42333984375,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 1.0,
+ "dynamicBindingPathList": [
+ {
+ "key": "truncateButtonColor"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "fontFamily"
+ }
+ ],
+ "shouldTruncate": false,
+ "truncateButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "text": "Customer Information",
+ "key": "ph5glqkph7",
+ "isDeprecated": false,
+ "rightColumn": 22.0,
+ "textAlign": "LEFT",
+ "dynamicHeight": "AUTO_HEIGHT",
+ "widgetId": "s3xrf9fi96",
+ "minWidth": 450.0,
+ "isVisible": true,
+ "fontStyle": "BOLD",
+ "textColor": "#101828",
+ "version": 1.0,
+ "parentId": "0",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "mobileTopRow": 1.0,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 1.0,
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "mobileLeftColumn": 14.0,
+ "maxDynamicHeight": 9000.0,
+ "originalBottomRow": 5.0,
+ "fontSize": "1.25rem",
+ "minDynamicHeight": 4.0
+ },
+ {
+ "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}",
+ "borderColor": "#E0DEDE",
+ "isVisibleDownload": true,
+ "iconSVG": "https://appcdn.appsmith.com/static/media/icon.e6911f8bb94dc6c4a102a74740c41763.svg",
+ "topRow": 5.0,
+ "isSortable": true,
+ "type": "TABLE_WIDGET_V2",
+ "inlineEditingSaveOption": "ROW_LEVEL",
+ "animateLoading": true,
+ "dynamicBindingPathList": [
+ {
+ "key": "accentColor"
+ },
+ {
+ "key": "borderRadius"
+ },
+ {
+ "key": "boxShadow"
+ },
+ {
+ "key": "primaryColumns.id.computedValue"
+ },
+ {
+ "key": "primaryColumns.gender.computedValue"
+ },
+ {
+ "key": "primaryColumns.latitude.computedValue"
+ },
+ {
+ "key": "primaryColumns.longitude.computedValue"
+ },
+ {
+ "key": "primaryColumns.dob.computedValue"
+ },
+ {
+ "key": "primaryColumns.phone.computedValue"
+ },
+ {
+ "key": "primaryColumns.email.computedValue"
+ },
+ {
+ "key": "primaryColumns.image.computedValue"
+ },
+ {
+ "key": "primaryColumns.country.computedValue"
+ },
+ {
+ "key": "primaryColumns.name.computedValue"
+ },
+ {
+ "key": "primaryColumns.created_at.computedValue"
+ },
+ {
+ "key": "primaryColumns.updated_at.computedValue"
+ },
+ {
+ "key": "tableData"
+ }
+ ],
+ "needsHeightForContent": true,
+ "leftColumn": 1.0,
+ "delimiter": ",",
+ "defaultSelectedRowIndex": 0.0,
+ "accentColor": "{{appsmith.theme.colors.primaryColor}}",
+ "isVisibleFilters": true,
+ "isVisible": true,
+ "enableClientSideSearch": true,
+ "version": 2.0,
+ "totalRecordsCount": 0.0,
+ "tags": [
+ "Suggested",
+ "Display"
+ ],
+ "isLoading": false,
+ "childStylesheet": {
+ "button": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
+ "menuButton": {
+ "menuColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
+ "iconButton": {
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
+ },
+ "editActions": {
+ "saveButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "saveBorderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "discardButtonColor": "{{appsmith.theme.colors.primaryColor}}",
+ "discardBorderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ }
+ },
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "columnUpdatedAt": 1.699355743847E12,
+ "originalBottomRow": 59.0,
+ "defaultSelectedRowIndices": [
+ 0.0
+ ],
+ "mobileBottomRow": 45.0,
+ "widgetName": "tbl_userInfo",
+ "defaultPageSize": 0.0,
+ "columnOrder": [
+ "image",
+ "name",
+ "email",
+ "phone",
+ "id",
+ "gender",
+ "latitude",
+ "longitude",
+ "dob",
+ "country",
+ "created_at",
+ "updated_at"
+ ],
+ "dynamicPropertyPathList": [],
+ "displayName": "Table",
+ "bottomRow": 63.0,
+ "columnWidthMap": {
+ "id": 94.0,
+ "gender": 115.0,
+ "image": 85.0,
+ "name": 161.0
+ },
+ "parentRowSpace": 10.0,
+ "hideCard": false,
+ "mobileRightColumn": 35.0,
+ "parentColumnSpace": 18.880859375,
+ "dynamicTriggerPathList": [],
+ "borderWidth": "",
+ "primaryColumns": {
+ "id": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 0.0,
+ "width": 150.0,
+ "originalId": "id",
+ "id": "id",
+ "alias": "id",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "number",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": false,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "id",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"id\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "gender": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 1.0,
+ "width": 150.0,
+ "originalId": "gender",
+ "id": "gender",
+ "alias": "gender",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "gender",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"gender\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "latitude": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 2.0,
+ "width": 150.0,
+ "originalId": "latitude",
+ "id": "latitude",
+ "alias": "latitude",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": false,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "latitude",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"latitude\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "longitude": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 3.0,
+ "width": 150.0,
+ "originalId": "longitude",
+ "id": "longitude",
+ "alias": "longitude",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": false,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "longitude",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"longitude\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "dob": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 4.0,
+ "width": 150.0,
+ "originalId": "dob",
+ "id": "dob",
+ "alias": "dob",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "date",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "dob",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"dob\"]))}}",
+ "sticky": "",
+ "validation": {},
+ "outputFormat": "DD/MM/YYYY"
+ },
+ "phone": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 5.0,
+ "width": 150.0,
+ "originalId": "phone",
+ "id": "phone",
+ "alias": "phone",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "phone",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"phone\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "email": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 6.0,
+ "width": 150.0,
+ "originalId": "email",
+ "id": "email",
+ "alias": "email",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "email",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"email\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "image": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 7.0,
+ "width": 150.0,
+ "originalId": "image",
+ "id": "image",
+ "alias": "image",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "image",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": false,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "image",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"image\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "country": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 8.0,
+ "width": 150.0,
+ "originalId": "country",
+ "id": "country",
+ "alias": "country",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "country",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"country\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "name": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 9.0,
+ "width": 150.0,
+ "originalId": "name",
+ "id": "name",
+ "alias": "name",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "name",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"name\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "created_at": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 10.0,
+ "width": 150.0,
+ "originalId": "created_at",
+ "id": "created_at",
+ "alias": "created_at",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": false,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "created_at",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"created_at\"]))}}",
+ "sticky": "",
+ "validation": {}
+ },
+ "updated_at": {
+ "allowCellWrapping": false,
+ "allowSameOptionsInNewRow": true,
+ "index": 11.0,
+ "width": 150.0,
+ "originalId": "updated_at",
+ "id": "updated_at",
+ "alias": "updated_at",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "0.875rem",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": false,
+ "isDisabled": false,
+ "isCellEditable": false,
+ "isEditable": false,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "updated_at",
+ "isSaveVisible": true,
+ "isDiscardVisible": true,
+ "computedValue": "{{tbl_userInfo.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"updated_at\"]))}}",
+ "sticky": "",
+ "validation": {}
+ }
+ },
+ "key": "1hz6z5p49i",
+ "canFreezeColumn": true,
+ "isDeprecated": false,
+ "rightColumn": 41.0,
+ "textSize": "0.875rem",
+ "widgetId": "56er52c53d",
+ "enableServerSideFiltering": false,
+ "minWidth": 450.0,
+ "tableData": "{{getUsers.data}}",
+ "label": "Data",
+ "searchKey": "",
+ "parentId": "0",
+ "renderMode": "CANVAS",
+ "mobileTopRow": 17.0,
+ "horizontalAlignment": "LEFT",
+ "isVisibleSearch": true,
+ "responsiveBehavior": "fill",
+ "originalTopRow": 17.0,
+ "mobileLeftColumn": 1.0,
+ "isVisiblePagination": true,
+ "verticalAlignment": "CENTER"
+ }
+ ]
+ },
+ "layoutOnLoadActions": [
+ [
+ {
+ "id": "Page1_getUsers",
+ "name": "getUsers",
+ "confirmBeforeExecute": false,
+ "pluginType": "DB",
+ "jsonPathKeys": [],
+ "timeoutInMillisecond": 10000.0
+ }
+ ]
+ ],
+ "layoutOnLoadActionErrors": [],
+ "validOnPageLoadActions": true,
+ "id": "Page1",
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ }
+ ],
+ "userPermissions": [],
+ "policies": [],
+ "isHidden": false
+ },
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_66053b5a92512e6f280a4a77"
+ }
+ ],
+ "actionList": [
+ {
+ "pluginType": "DB",
+ "pluginId": "postgres-plugin",
+ "unpublishedAction": {
+ "name": "getUsers",
+ "datasource": {
+ "name": "users",
+ "pluginId": "postgres-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "id": "users",
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "pageId": "Page1",
+ "actionConfiguration": {
+ "timeoutInMillisecond": 10000.0,
+ "paginationType": "NONE",
+ "encodeParamsToggle": true,
+ "body": "SELECT *\nFROM public.\"users\"\nLIMIT 10;\n",
+ "selfReferencingDataPaths": [],
+ "pluginSpecifiedTemplates": [
+ {
+ "value": true
+ }
+ ]
+ },
+ "executeOnLoad": true,
+ "dynamicBindingPathList": [],
+ "isValid": true,
+ "invalids": [],
+ "messages": [],
+ "jsonPathKeys": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2023-09-27T07:04:15Z"
+ },
+ "publishedAction": {
+ "name": "getUsers",
+ "datasource": {
+ "name": "users",
+ "pluginId": "postgres-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "id": "users",
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "actionConfiguration": {
+ "timeoutInMillisecond": 10000.0,
+ "paginationType": "NONE",
+ "encodeParamsToggle": true,
+ "body": "SELECT *\nFROM public.\"users\"\nLIMIT 10;\n",
+ "selfReferencingDataPaths": [],
+ "pluginSpecifiedTemplates": [
+ {
+ "value": true
+ }
+ ]
+ },
+ "executeOnLoad": true,
+ "dynamicBindingPathList": [],
+ "isValid": true,
+ "invalids": [],
+ "messages": [],
+ "jsonPathKeys": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2023-09-27T07:04:15Z"
+ },
+ "id": "Page1_getUsers",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_66053b5a92512e6f280a4a7a"
+ },
+ {
+ "pluginType": "JS",
+ "pluginId": "js-plugin",
+ "unpublishedAction": {
+ "name": "getUsersData",
+ "fullyQualifiedName": "Transformers.getUsersData",
+ "datasource": {
+ "name": "UNUSED_DATASOURCE",
+ "pluginId": "js-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "pageId": "Page1",
+ "collectionId": "Page1_Transformers",
+ "actionConfiguration": {
+ "timeoutInMillisecond": 10000.0,
+ "paginationType": "NONE",
+ "encodeParamsToggle": true,
+ "body": "function () {\n return getUsers.data;\n}",
+ "selfReferencingDataPaths": [],
+ "jsArguments": []
+ },
+ "executeOnLoad": false,
+ "clientSideExecution": true,
+ "dynamicBindingPathList": [
+ {
+ "key": "body"
+ }
+ ],
+ "isValid": true,
+ "invalids": [],
+ "messages": [],
+ "jsonPathKeys": [
+ "function () {\n return getUsers.data;\n}"
+ ],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T09:41:57Z"
+ },
+ "publishedAction": {
+ "datasource": {
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "messages": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T09:41:57Z"
+ },
+ "id": "Page1_Transformers.getUsersData",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_66053b65e667843f9dd1be25"
+ },
+ {
+ "pluginType": "JS",
+ "pluginId": "js-plugin",
+ "unpublishedAction": {
+ "name": "getDate",
+ "fullyQualifiedName": "Transformers.getDate",
+ "datasource": {
+ "name": "UNUSED_DATASOURCE",
+ "pluginId": "js-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "pageId": "Page1",
+ "collectionId": "Page1_Transformers",
+ "actionConfiguration": {
+ "timeoutInMillisecond": 10000.0,
+ "paginationType": "NONE",
+ "encodeParamsToggle": true,
+ "body": "function (value) {\n return new Date(value).toDateString();\n}",
+ "selfReferencingDataPaths": [],
+ "jsArguments": [
+ {
+ "name": "value"
+ }
+ ]
+ },
+ "executeOnLoad": false,
+ "dynamicBindingPathList": [
+ {
+ "key": "body"
+ }
+ ],
+ "isValid": true,
+ "invalids": [],
+ "messages": [],
+ "jsonPathKeys": [
+ "function (value) {\n return new Date(value).toDateString();\n}"
+ ],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T09:43:35Z"
+ },
+ "publishedAction": {
+ "datasource": {
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "messages": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T09:43:35Z"
+ },
+ "id": "Page1_Transformers.getDate",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_66053bc7e6fe4503dedcdbab"
+ },
+ {
+ "pluginType": "JS",
+ "pluginId": "js-plugin",
+ "unpublishedAction": {
+ "name": "myFun1",
+ "fullyQualifiedName": "JSObject1.myFun1",
+ "datasource": {
+ "name": "UNUSED_DATASOURCE",
+ "pluginId": "js-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "pageId": "Page1",
+ "collectionId": "Page1_JSObject1",
+ "actionConfiguration": {
+ "timeoutInMillisecond": 10000.0,
+ "paginationType": "NONE",
+ "encodeParamsToggle": true,
+ "body": "function () {}",
+ "selfReferencingDataPaths": [],
+ "jsArguments": []
+ },
+ "executeOnLoad": false,
+ "clientSideExecution": true,
+ "dynamicBindingPathList": [
+ {
+ "key": "body"
+ }
+ ],
+ "isValid": true,
+ "invalids": [],
+ "messages": [],
+ "jsonPathKeys": [
+ "function () {}"
+ ],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T10:03:14Z"
+ },
+ "publishedAction": {
+ "datasource": {
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "messages": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T10:03:14Z"
+ },
+ "id": "Page1_JSObject1.myFun1",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_660540625c456a14800e503b"
+ },
+ {
+ "pluginType": "JS",
+ "pluginId": "js-plugin",
+ "unpublishedAction": {
+ "name": "myFun2",
+ "fullyQualifiedName": "JSObject1.myFun2",
+ "datasource": {
+ "name": "UNUSED_DATASOURCE",
+ "pluginId": "js-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "pageId": "Page1",
+ "collectionId": "Page1_JSObject1",
+ "actionConfiguration": {
+ "timeoutInMillisecond": 10000.0,
+ "paginationType": "NONE",
+ "encodeParamsToggle": true,
+ "body": "async function () {}",
+ "selfReferencingDataPaths": [],
+ "jsArguments": []
+ },
+ "executeOnLoad": false,
+ "clientSideExecution": true,
+ "dynamicBindingPathList": [
+ {
+ "key": "body"
+ }
+ ],
+ "isValid": true,
+ "invalids": [],
+ "messages": [],
+ "jsonPathKeys": [
+ "async function () {}"
+ ],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T10:03:14Z"
+ },
+ "publishedAction": {
+ "datasource": {
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "messages": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T10:03:14Z"
+ },
+ "id": "Page1_JSObject1.myFun2",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_660540625c456a14800e503c"
+ },
+ {
+ "pluginType": "DB",
+ "pluginId": "postgres-plugin",
+ "unpublishedAction": {
+ "name": "updateUsers",
+ "datasource": {
+ "name": "users",
+ "pluginId": "postgres-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "id": "users",
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "pageId": "Page1",
+ "actionConfiguration": {
+ "timeoutInMillisecond": 10000.0,
+ "paginationType": "NONE",
+ "encodeParamsToggle": true,
+ "body": "UPDATE public.\"users\" SET\n \"gender\" = '',\n \"latitude\" = '',\n \"longitude\" = '',\n \"dob\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET',\n \"phone\" = '',\n \"email\" = '',\n \"image\" = '',\n \"country\" = '',\n \"name\" = '',\n \"created_at\" = TIMESTAMP '2019-07-01 10:00:00',\n \"updated_at\" = TIMESTAMP '2019-07-01 10:00:00'\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!",
+ "selfReferencingDataPaths": [],
+ "pluginSpecifiedTemplates": [
+ {
+ "value": true
+ }
+ ]
+ },
+ "executeOnLoad": false,
+ "dynamicBindingPathList": [],
+ "isValid": true,
+ "invalids": [],
+ "messages": [],
+ "jsonPathKeys": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T10:03:46Z"
+ },
+ "publishedAction": {
+ "datasource": {
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "messages": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T10:03:46Z"
+ },
+ "id": "Page1_updateUsers",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_6605408200d9567931a736ae"
+ },
+ {
+ "pluginType": "DB",
+ "pluginId": "postgres-plugin",
+ "unpublishedAction": {
+ "name": "addUser",
+ "datasource": {
+ "name": "users",
+ "pluginId": "postgres-plugin",
+ "messages": [],
+ "isAutoGenerated": false,
+ "id": "users",
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "pageId": "Page1",
+ "actionConfiguration": {
+ "timeoutInMillisecond": 10000.0,
+ "paginationType": "NONE",
+ "encodeParamsToggle": true,
+ "body": "INSERT INTO public.\"users\" (\"gender\", \"latitude\", \"longitude\", \"dob\", \"phone\", \"email\", \"image\", \"country\", \"name\", \"created_at\", \"updated_at\")\n VALUES ('', '', '', TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '', '', '', '', '', TIMESTAMP '2019-07-01 10:00:00', TIMESTAMP '2019-07-01 10:00:00');",
+ "selfReferencingDataPaths": [],
+ "pluginSpecifiedTemplates": [
+ {
+ "value": true
+ }
+ ]
+ },
+ "executeOnLoad": false,
+ "dynamicBindingPathList": [],
+ "isValid": true,
+ "invalids": [],
+ "messages": [],
+ "jsonPathKeys": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T10:04:14Z"
+ },
+ "publishedAction": {
+ "datasource": {
+ "messages": [],
+ "isAutoGenerated": false,
+ "deleted": false,
+ "policies": [],
+ "userPermissions": []
+ },
+ "messages": [],
+ "userSetOnLoad": false,
+ "confirmBeforeExecute": false,
+ "policies": [],
+ "userPermissions": [],
+ "createdAt": "2024-03-28T10:04:14Z"
+ },
+ "id": "Page1_addUser",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_6605409e92512e6f280a4a8d"
+ }
+ ],
+ "actionCollectionList": [
+ {
+ "unpublishedCollection": {
+ "name": "Transformers",
+ "pageId": "Page1",
+ "pluginId": "js-plugin",
+ "pluginType": "JS",
+ "actions": [],
+ "archivedActions": [],
+ "body": "export default {\n\tmyVar1: [],\n\tmyVar2: {},\n\tgetUsersData () {\n\t\treturn getUsers.data;\n\t},\n\tgetDate (value) {\n\t\treturn new Date(value).toDateString()\n\t}\n}",
+ "variables": [
+ {
+ "name": "myVar1",
+ "value": "[]"
+ },
+ {
+ "name": "myVar2",
+ "value": "{}"
+ }
+ ],
+ "userPermissions": []
+ },
+ "id": "Page1_Transformers",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_66053b65e667843f9dd1be29"
+ },
+ {
+ "unpublishedCollection": {
+ "name": "JSObject1",
+ "pageId": "Page1",
+ "pluginId": "js-plugin",
+ "pluginType": "JS",
+ "actions": [],
+ "archivedActions": [],
+ "body": "export default {\n\tmyVar1: [],\n\tmyVar2: {},\n\tmyFun1 () {\n\t\t//\twrite code here\n\t\t//\tthis.myVar1 = [1,2,3]\n\t},\n\tasync myFun2 () {\n\t\t//\tuse async-await or promises\n\t\t//\tawait storeValue('varName', 'hello world')\n\t}\n}",
+ "variables": [
+ {
+ "name": "myVar1",
+ "value": "[]"
+ },
+ {
+ "name": "myVar2",
+ "value": "{}"
+ }
+ ],
+ "userPermissions": []
+ },
+ "id": "Page1_JSObject1",
+ "deleted": false,
+ "gitSyncId": "66053b50e667843f9dd1be1a_660540625c456a14800e503f"
+ }
+ ],
+ "editModeTheme": {
+ "name": "Default-New",
+ "displayName": "Modern",
+ "isSystemTheme": true,
+ "deleted": false
+ },
+ "publishedTheme": {
+ "name": "Default-New",
+ "displayName": "Modern",
+ "isSystemTheme": true,
+ "deleted": false
+ }
+}
diff --git a/app/client/cypress/support/Pages/EditorNavigation.ts b/app/client/cypress/support/Pages/EditorNavigation.ts
index b016731c4c1d..74a49f2fcb31 100644
--- a/app/client/cypress/support/Pages/EditorNavigation.ts
+++ b/app/client/cypress/support/Pages/EditorNavigation.ts
@@ -25,6 +25,7 @@ const pagePaneListItemSelector = (name: string) =>
export const PageLeftPane = new LeftPane(
pagePaneListItemSelector,
".ide-editor-left-pane",
+ ".ide-editor-left-pane__content .active.t--entity-item",
Object.values(PagePaneSegment),
);
diff --git a/app/client/cypress/support/Pages/IDE/LeftPane.ts b/app/client/cypress/support/Pages/IDE/LeftPane.ts
index b6298a8d451b..9648d21af638 100644
--- a/app/client/cypress/support/Pages/IDE/LeftPane.ts
+++ b/app/client/cypress/support/Pages/IDE/LeftPane.ts
@@ -11,17 +11,20 @@ export class LeftPane {
name +
"']/ancestor::div/span[contains(@class, 't--entity-collapse-toggle')]",
addItem: "button.t--add-item",
+ activeItemSelector: "",
selector: "",
};
constructor(
listItemSelector: (name: string) => string,
selector: string,
+ activeItemSelector: string,
segments?: string[],
) {
this.listItemSelector = listItemSelector;
this.segments = segments;
this.locators.selector = selector;
+ this.locators.activeItemSelector = activeItemSelector;
}
public assertAbsence(name: string) {
@@ -82,6 +85,11 @@ export class LeftPane {
}
});
}
+ public selectedItem(): Cypress.Chainable {
+ return ObjectsRegistry.AggregateHelper.GetElement(
+ this.locators.activeItemSelector,
+ );
+ }
public assertSelected(name: string) {
// TODO
|
6060ade54f7c19bc0b51c74a8f15e86dc22f3f6d
|
2023-05-11 17:09:05
|
PiyushPushkar02
|
fix: CURL empty command error msg fix (#23119)
| false
|
CURL empty command error msg fix (#23119)
|
fix
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java
index c0300105d2d7..de2195e55968 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java
@@ -12,6 +12,7 @@
public enum AppsmithError {
// Ref syntax for message templates: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/MessageFormat.html
INVALID_PARAMETER(400, AppsmithErrorCode.INVALID_PARAMETER.getCode(), "Please enter a valid parameter {0}.", AppsmithErrorAction.DEFAULT, "Invalid parameter", ErrorType.ARGUMENT_ERROR, null),
+ EMPTY_CURL_INPUT_STATEMENT(400, AppsmithErrorCode.EMPTY_CURL_INPUT_STATEMENT.getCode(), "Input CURL statement is empty / null. Please edit the input box to provide a valid CURL statement.", AppsmithErrorAction.DEFAULT, "Invalid parameter", ErrorType.ARGUMENT_ERROR, null),
PLUGIN_NOT_INSTALLED(400, AppsmithErrorCode.PLUGIN_NOT_INSTALLED.getCode(), "Plugin {0} not installed", AppsmithErrorAction.DEFAULT, "Plugin not installed", ErrorType.INTERNAL_ERROR, null),
PLUGIN_ID_NOT_GIVEN(400, AppsmithErrorCode.PLUGIN_ID_NOT_GIVEN.getCode(), "Missing plugin id. Please enter one.", AppsmithErrorAction.DEFAULT, "Missing plugin id", ErrorType.INTERNAL_ERROR, null),
DATASOURCE_NOT_GIVEN(400, AppsmithErrorCode.DATASOURCE_NOT_GIVEN.getCode(), "Missing datasource. Add/enter/connect a datasource to create a valid action.",
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithErrorCode.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithErrorCode.java
index fd99dd570cf1..39bcfa5a73fc 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithErrorCode.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithErrorCode.java
@@ -66,6 +66,7 @@ public enum AppsmithErrorCode {
GENERIC_BAD_REQUEST("AE-BAD-4000", "Generic bad request"),
GOOGLE_RECAPTCHA_FAILED("AE-CAP-4035", "Google recaptcha failed"),
INVALID_CRUD_PAGE_REQUEST("AE-CRD-4039", "Invalid crud page request"),
+ EMPTY_CURL_INPUT_STATEMENT("AE-CRL-4054","Invalid CURL input statement"),
INVALID_CURL_COMMAND("AE-CRL-4029", "Invalid curl command"),
INVALID_CURL_METHOD("AE-CRL-4032", "Invalid curl method"),
INVALID_CURL_HEADER("AE-CRL-4036", "Invalid curl header"),
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCEImpl.java
index 340f2a93405d..e959d78e1c93 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCEImpl.java
@@ -37,6 +37,7 @@
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
+import static org.apache.commons.lang3.StringUtils.isBlank;
@Slf4j
public class CurlImporterServiceCEImpl extends BaseApiImporter implements CurlImporterServiceCE {
@@ -80,8 +81,8 @@ public Mono<ActionDTO> importAction(Object input, String pageId, String name, St
ActionDTO action;
try {
- if (input == null) {
- throw new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.CURL_CODE);
+ if (isBlank((String) input)) {
+ throw new AppsmithException(AppsmithError.EMPTY_CURL_INPUT_STATEMENT, FieldName.CURL_CODE);
}
action = curlToAction((String) input, name);
} catch (AppsmithException e) {
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CurlImporterServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CurlImporterServiceTest.java
index 7ce1819050a9..ec0601d2f69e 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CurlImporterServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CurlImporterServiceTest.java
@@ -160,7 +160,7 @@ public void lexWhiteSpace() {
@Test
@WithUserDetails(value = "api_user")
- public void testImportAction_EmptyLex() {
+ public void testImportActionOnInvalidInput() {
setup();
// Set up the application & page for which this import curl action would be added
Application app = new Application();
@@ -180,6 +180,50 @@ public void testImportAction_EmptyLex() {
.verify();
}
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void testImportActionOnNullInput() {
+ setup();
+ // Set up the application & page for which this import curl action would be added
+ Application app = new Application();
+ app.setName("curlTest Incorrect Command");
+
+ Application application = applicationPageService.createApplication(app, workspaceId).block();
+ assert application != null;
+ PageDTO page = newPageService.findPageById(application.getPages().get(0).getId(), AclPermission.MANAGE_PAGES, false).block();
+
+ assert page != null;
+ Mono<ActionDTO> action = curlImporterService.importAction(null, page.getId(), "actionName", workspaceId, null);
+
+ StepVerifier
+ .create(action)
+ .expectErrorMatches(throwable -> throwable instanceof AppsmithException &&
+ throwable.getMessage().equals(AppsmithError.EMPTY_CURL_INPUT_STATEMENT.getMessage()))
+ .verify();
+ }
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void testImportActionOnEmptyInput() {
+ setup();
+ // Set up the application & page for which this import curl action would be added
+ Application app = new Application();
+ app.setName("curlTest Incorrect Command");
+
+ Application application = applicationPageService.createApplication(app, workspaceId).block();
+ assert application != null;
+ PageDTO page = newPageService.findPageById(application.getPages().get(0).getId(), AclPermission.MANAGE_PAGES, false).block();
+
+ assert page != null;
+ Mono<ActionDTO> action = curlImporterService.importAction("", page.getId(), "actionName", workspaceId, null);
+
+ StepVerifier
+ .create(action)
+ .expectErrorMatches(throwable -> throwable instanceof AppsmithException &&
+ throwable.getMessage().equals(AppsmithError.EMPTY_CURL_INPUT_STATEMENT.getMessage()))
+ .verify();
+ }
+
@Test
@WithUserDetails(value = "api_user")
public void importValidCurlCommand() {
|
4100fa931976de0fcaf02b84b503ea820532426e
|
2024-06-18 13:03:03
|
Rudraprasad Das
|
fix: learn more link in git connect success modal (#34297)
| false
|
learn more link in git connect success modal (#34297)
|
fix
|
diff --git a/app/client/src/constants/ThirdPartyConstants.tsx b/app/client/src/constants/ThirdPartyConstants.tsx
index 63b923f2fbf4..1682f615a1e8 100644
--- a/app/client/src/constants/ThirdPartyConstants.tsx
+++ b/app/client/src/constants/ThirdPartyConstants.tsx
@@ -30,7 +30,7 @@ export const PROVISIONING_SETUP_DOC =
export const DISCORD_URL = "https://discord.gg/rBTTVJp";
export const ENTERPRISE_PRICING_PAGE = "https://www.appsmith.com/enterprise";
export const DOCS_BRANCH_PROTECTION_URL =
- "https://docs.appsmith.com/advanced-concepts/version-control-with-git/working-with-branches#branch-protection";
+ "https://docs.appsmith.com/advanced-concepts/version-control-with-git/reference/git-settings#branch-protection";
export const DOCS_DEFAULT_BRANCH_URL =
"https://docs.appsmith.com/advanced-concepts/version-control-with-git/working-with-branches#default-branch";
export const PACKAGES_OVERVIEW_DOC =
diff --git a/app/client/src/pages/Editor/gitSync/Tabs/ConnectionSuccess.tsx b/app/client/src/pages/Editor/gitSync/Tabs/ConnectionSuccess.tsx
index 88db6941f99a..ce15366c6f97 100644
--- a/app/client/src/pages/Editor/gitSync/Tabs/ConnectionSuccess.tsx
+++ b/app/client/src/pages/Editor/gitSync/Tabs/ConnectionSuccess.tsx
@@ -98,8 +98,12 @@ function ConnectionSuccessBody() {
{createMessage(GIT_CONNECT_SUCCESS_PROTECTION_MSG)}
</Text>
</div>
- <LinkText isBold renderAs="p">
- <Link href={DOCS_BRANCH_PROTECTION_URL}>
+ <LinkText className="inline-block" isBold renderAs="p">
+ <Link
+ data-testid="t--git-success-modal-learn-more-link"
+ target="_blank"
+ to={DOCS_BRANCH_PROTECTION_URL}
+ >
{createMessage(GIT_CONNECT_SUCCESS_PROTECTION_DOC_CTA)}
</Link>
</LinkText>
diff --git a/app/client/src/pages/Editor/gitSync/Tabs/__tests__/ConnectionSuccess.test.tsx b/app/client/src/pages/Editor/gitSync/Tabs/__tests__/ConnectionSuccess.test.tsx
index 47b920ec37c7..a0cd6bde2dca 100644
--- a/app/client/src/pages/Editor/gitSync/Tabs/__tests__/ConnectionSuccess.test.tsx
+++ b/app/client/src/pages/Editor/gitSync/Tabs/__tests__/ConnectionSuccess.test.tsx
@@ -7,6 +7,7 @@ import { Provider } from "react-redux";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import { GitSettingsTab } from "reducers/uiReducers/gitSyncReducer";
import { BrowserRouter } from "react-router-dom";
+import { DOCS_BRANCH_PROTECTION_URL } from "constants/ThirdPartyConstants";
const initialState = {
ui: {
@@ -74,6 +75,20 @@ describe("Connection Success Modal", () => {
});
});
+ it("'Learn more' link has proper URL", () => {
+ const { queryByTestId } = renderComponent();
+ expect(
+ queryByTestId("t--git-success-modal-learn-more-link")?.getAttribute(
+ "href",
+ ),
+ ).toBe(DOCS_BRANCH_PROTECTION_URL);
+ expect(
+ queryByTestId("t--git-success-modal-learn-more-link")?.getAttribute(
+ "target",
+ ),
+ ).toBe("_blank");
+ });
+
it("'Continue' cta button is working", () => {
const { queryByTestId } = renderComponent();
expect(dispatch).toHaveBeenNthCalledWith(1, {
|
0b1e42691bef48b8bc65154fcd72db816912108e
|
2021-08-24 20:44:32
|
arunvjn
|
fix: Api pane url input height and datasource mouse click. (#6818)
| false
|
Api pane url input height and datasource mouse click. (#6818)
|
fix
|
diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx
index 6f2a233b8b0e..f6425916bb96 100644
--- a/app/client/src/components/editorComponents/CodeEditor/index.tsx
+++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx
@@ -326,7 +326,11 @@ class CodeEditor extends Component<Props, State> {
handleEditorFocus = () => {
this.setState({ isFocused: true });
- if (this.editor.getValue().length === 0)
+ const entityInformation = this.getEntityInformation();
+ if (
+ entityInformation.entityType === ENTITY_TYPE.WIDGET &&
+ this.editor.getValue().length === 0
+ )
this.handleAutocompleteVisibility(this.editor);
};
@@ -372,8 +376,7 @@ class CodeEditor extends Component<Props, State> {
CodeEditor.updateMarkings(this.editor, this.props.marking);
};
- handleAutocompleteVisibility = (cm: CodeMirror.Editor) => {
- if (!this.state.isFocused) return;
+ getEntityInformation = (): FieldEntityInformation => {
const { dataTreePath, dynamicData, expected } = this.props;
const entityInformation: FieldEntityInformation = {
expectedType: expected?.autocompleteDataType,
@@ -397,6 +400,12 @@ class CodeEditor extends Component<Props, State> {
if (isWidgetEntity(entity)) entityInformation.entityId = entity.widgetId;
entityInformation.propertyPath = propertyPath;
}
+ return entityInformation;
+ };
+
+ handleAutocompleteVisibility = (cm: CodeMirror.Editor) => {
+ if (!this.state.isFocused) return;
+ const entityInformation: FieldEntityInformation = this.getEntityInformation();
let hinterOpen = false;
for (let i = 0; i < this.hinters.length; i++) {
hinterOpen = this.hinters[i].showHint(cm, entityInformation, {
diff --git a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx b/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx
index 08a78cc4dd75..e95beb0ab3c3 100644
--- a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx
+++ b/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx
@@ -306,7 +306,7 @@ class EmbeddedDatasourcePathComponent extends React.Component<Props> {
return (
<DatasourceContainer>
- <CodeEditor {...props} />
+ <CodeEditor {...props} height="35px" />
{displayValue && datasource && !("id" in datasource) ? (
<StoreAsDatasource enable={!!displayValue} />
) : datasource && "id" in datasource ? (
|
eae84f2796ca209448160084def81e551cbda099
|
2023-08-03 16:34:54
|
Shrikant Sharat Kandula
|
chore: Delete entrypoint.sh for server slim image
| false
|
Delete entrypoint.sh for server slim image
|
chore
|
diff --git a/app/server/entrypoint.sh b/app/server/entrypoint.sh
deleted file mode 100755
index f9618082c3d2..000000000000
--- a/app/server/entrypoint.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Add an `authSource` query param to MongoDB URI, if missing.
-if [ -n "$APPSMITH_MONGODB_URI" ]; then
- if ! echo "$APPSMITH_MONGODB_URI" | grep -Fq "authSource="; then
- if echo "$APPSMITH_MONGODB_URI" | grep -Fq '?'; then
- APPSMITH_MONGODB_URI="$APPSMITH_MONGODB_URI&authSource=admin"
- else
- APPSMITH_MONGODB_URI="$APPSMITH_MONGODB_URI?authSource=admin"
- fi
- fi
-fi
-
-# Ref -Dlog4j2.formatMsgNoLookups=true https://spring.io/blog/2021/12/10/log4j2-vulnerability-and-spring-boot
-exec java -Djava.security.egd="file:/dev/./urandom" "$@" -Dlog4j2.formatMsgNoLookups=true --add-opens java.base/java.time=ALL-UNNAMED -jar server.jar
|
e6f4513b48dd028e060fb72703b3cbed8d904fc3
|
2021-12-24 19:42:04
|
Nidhi
|
fix: Appends authSource param to mongo URI if absent, also fixes inability to connect to mongo without user info (#9995)
| false
|
Appends authSource param to mongo URI if absent, also fixes inability to connect to mongo without user info (#9995)
|
fix
|
diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java b/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java
index 2a063117a4b8..43175cb5a296 100644
--- a/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java
+++ b/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java
@@ -66,13 +66,8 @@
import java.util.stream.Collectors;
import static com.appsmith.external.constants.ActionConstants.ACTION_CONFIGURATION_BODY;
-import static com.external.plugins.utils.MongoPluginUtils.convertMongoFormInputToRawCommand;
-import static com.external.plugins.utils.MongoPluginUtils.generateTemplatesAndStructureForACollection;
-import static com.external.plugins.utils.MongoPluginUtils.getDatabaseName;
import static com.appsmith.external.helpers.PluginUtils.getValueSafelyFromFormData;
-import static com.external.plugins.utils.MongoPluginUtils.isRawCommand;
import static com.appsmith.external.helpers.PluginUtils.setValueSafelyInFormData;
-import static com.external.plugins.utils.MongoPluginUtils.urlEncode;
import static com.appsmith.external.helpers.PluginUtils.validConfigurationPresentInFormData;
import static com.external.plugins.constants.FieldName.AGGREGATE_PIPELINE;
import static com.external.plugins.constants.FieldName.COUNT_QUERY;
@@ -83,8 +78,13 @@
import static com.external.plugins.constants.FieldName.FIND_SORT;
import static com.external.plugins.constants.FieldName.INSERT_DOCUMENT;
import static com.external.plugins.constants.FieldName.SMART_SUBSTITUTION;
-import static com.external.plugins.constants.FieldName.UPDATE_QUERY;
import static com.external.plugins.constants.FieldName.UPDATE_OPERATION;
+import static com.external.plugins.constants.FieldName.UPDATE_QUERY;
+import static com.external.plugins.utils.MongoPluginUtils.convertMongoFormInputToRawCommand;
+import static com.external.plugins.utils.MongoPluginUtils.generateTemplatesAndStructureForACollection;
+import static com.external.plugins.utils.MongoPluginUtils.getDatabaseName;
+import static com.external.plugins.utils.MongoPluginUtils.isRawCommand;
+import static com.external.plugins.utils.MongoPluginUtils.urlEncode;
import static java.lang.Boolean.TRUE;
public class MongoPlugin extends BasePlugin {
@@ -111,11 +111,11 @@ public class MongoPlugin extends BasePlugin {
/*
* - The regex matches the following two pattern types:
- * - mongodb+srv://user:pass@some-url/some-db....
- * - mongodb://user:pass@some-url:port,some-url:port,../some-db....
- * - It has been grouped like this: (mongodb+srv://)((user):(pass))(@some-url/(some-db....))
+ * - mongodb+srv://user:pass@some-url/some-db...
+ * - mongodb://user:pass@some-url:port,some-url:port,.../some-db...
+ * - It has been grouped like this: (mongodb+srv://)(user):(pass)@(some-url)/(some-db...)?(params...)
*/
- private static final String MONGO_URI_REGEX = "^(mongodb(\\+srv)?:\\/\\/)((.+):(.+))(@.+\\/(.+))$";
+ private static final String MONGO_URI_REGEX = "^(mongodb(?:\\+srv)?:\\/\\/)(?:(.+):(.+)@)?([^\\/\\?]+)\\/?([^\\?]+)?\\??(.+)?$";
/**
* This regex matches the following two patterns:
@@ -130,18 +130,22 @@ public class MongoPlugin extends BasePlugin {
private static final int REGEX_GROUP_HEAD = 1;
- private static final int REGEX_GROUP_USERNAME = 4;
+ private static final int REGEX_GROUP_USERNAME = 2;
- private static final int REGEX_GROUP_PASSWORD = 5;
+ private static final int REGEX_GROUP_PASSWORD = 3;
- private static final int REGEX_GROUP_TAIL = 6;
+ private static final int REGEX_HOST_PORT = 4;
- private static final int REGEX_GROUP_DBNAME = 7;
+ private static final int REGEX_GROUP_DBNAME = 5;
+
+ private static final int REGEX_GROUP_TAIL = 6;
private static final String KEY_USERNAME = "username";
private static final String KEY_PASSWORD = "password";
+ private static final String KEY_HOST_PORT = "hostPort";
+
private static final String KEY_URI_HEAD = "uriHead";
private static final String KEY_URI_TAIL = "uriTail";
@@ -578,13 +582,12 @@ private Map extractInfoFromConnectionStringURI(String uri, String regex) {
Matcher matcher = pattern.matcher(uri);
if (matcher.find()) {
Map extractedInfoMap = new HashMap();
- String username = matcher.group(REGEX_GROUP_USERNAME);
- extractedInfoMap.put(KEY_USERNAME, username == null ? "" : username);
- String password = matcher.group(REGEX_GROUP_PASSWORD);
- extractedInfoMap.put(KEY_PASSWORD, password == null ? "" : password);
extractedInfoMap.put(KEY_URI_HEAD, matcher.group(REGEX_GROUP_HEAD));
+ extractedInfoMap.put(KEY_USERNAME, matcher.group(REGEX_GROUP_USERNAME));
+ extractedInfoMap.put(KEY_PASSWORD, matcher.group(REGEX_GROUP_PASSWORD));
+ extractedInfoMap.put(KEY_HOST_PORT, matcher.group(REGEX_HOST_PORT));
+ extractedInfoMap.put(KEY_URI_DBNAME, matcher.group(REGEX_GROUP_DBNAME));
extractedInfoMap.put(KEY_URI_TAIL, matcher.group(REGEX_GROUP_TAIL));
- extractedInfoMap.put(KEY_URI_DBNAME, matcher.group(REGEX_GROUP_DBNAME).split("\\?")[0]);
return extractedInfoMap;
}
}
@@ -592,10 +595,34 @@ private Map extractInfoFromConnectionStringURI(String uri, String regex) {
return null;
}
- private String buildURIfromExtractedInfo(Map extractedInfo, String password) {
- return extractedInfo.get(KEY_URI_HEAD) + (extractedInfo.get(KEY_USERNAME) == null ? "" :
- extractedInfo.get(KEY_USERNAME) + ":") + (password == null ? "" : password)
- + extractedInfo.get(KEY_URI_TAIL);
+ private String buildURIFromExtractedInfo(Map extractedInfo, String password) {
+ String userInfo = "";
+ if (extractedInfo.get(KEY_USERNAME) != null) {
+ userInfo += extractedInfo.get(KEY_USERNAME) + ":";
+ if (password != null) {
+ userInfo += password;
+ }
+ userInfo += "@";
+ }
+
+ final String dbInfo = "/" + (extractedInfo.get(KEY_URI_DBNAME) == null ? "" : extractedInfo.get(KEY_URI_DBNAME));
+
+ String tailInfo = (String) (extractedInfo.get(KEY_URI_TAIL) == null ? "" : extractedInfo.get(KEY_URI_TAIL));
+ if (StringUtils.hasLength(tailInfo)) {
+ if (!tailInfo.contains("authSource")) {
+ tailInfo = "?" + tailInfo + "&authSource=admin";
+ } else {
+ tailInfo = "?" + tailInfo;
+ }
+ } else {
+ tailInfo = "?authSource=admin";
+ }
+
+ return extractedInfo.get(KEY_URI_HEAD)
+ + userInfo
+ + extractedInfo.get(KEY_HOST_PORT)
+ + dbInfo
+ + tailInfo;
}
public String buildClientURI(DatasourceConfiguration datasourceConfiguration) throws AppsmithPluginException {
@@ -607,7 +634,7 @@ public String buildClientURI(DatasourceConfiguration datasourceConfiguration) th
Map extractedInfo = extractInfoFromConnectionStringURI(uriWithHiddenPassword, MONGO_URI_REGEX);
if (extractedInfo != null) {
String password = ((DBAuth) datasourceConfiguration.getAuthentication()).getPassword();
- return buildURIfromExtractedInfo(extractedInfo, password);
+ return buildURIFromExtractedInfo(extractedInfo, password);
} else {
throw new AppsmithPluginException(
AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR,
@@ -771,7 +798,7 @@ public Set<String> validateDatasource(DatasourceConfiguration datasourceConfigur
invalids.add("Mongo Connection String URI does not seem to be in the correct format. " +
"Please check the URI once.");
} else if (!isAuthenticated(authentication, mongoUri)) {
- String mongoUriWithHiddenPassword = buildURIfromExtractedInfo(extractedInfo, "****");
+ String mongoUriWithHiddenPassword = buildURIFromExtractedInfo(extractedInfo, "****");
properties.get(DATASOURCE_CONFIG_MONGO_URI_PROPERTY_INDEX).setValue(mongoUriWithHiddenPassword);
authentication = (authentication == null) ? new DBAuth() : authentication;
authentication.setUsername((String) extractedInfo.get(KEY_USERNAME));
diff --git a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginTest.java b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginTest.java
index b8429d4b5383..b0473b3a550c 100644
--- a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginTest.java
+++ b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginTest.java
@@ -52,6 +52,7 @@
import static com.appsmith.external.helpers.PluginUtils.setValueSafelyInFormData;
import static com.external.plugins.constants.FieldName.AGGREGATE_PIPELINE;
import static com.external.plugins.constants.FieldName.COLLECTION;
+import static com.external.plugins.constants.FieldName.COMMAND;
import static com.external.plugins.constants.FieldName.COUNT_QUERY;
import static com.external.plugins.constants.FieldName.DELETE_LIMIT;
import static com.external.plugins.constants.FieldName.DELETE_QUERY;
@@ -63,10 +64,9 @@
import static com.external.plugins.constants.FieldName.FIND_SORT;
import static com.external.plugins.constants.FieldName.INSERT_DOCUMENT;
import static com.external.plugins.constants.FieldName.SMART_SUBSTITUTION;
-import static com.external.plugins.constants.FieldName.COMMAND;
import static com.external.plugins.constants.FieldName.UPDATE_LIMIT;
-import static com.external.plugins.constants.FieldName.UPDATE_QUERY;
import static com.external.plugins.constants.FieldName.UPDATE_OPERATION;
+import static com.external.plugins.constants.FieldName.UPDATE_QUERY;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -1929,4 +1929,57 @@ public void testSmartSubstitutionWithObjectIdInSingleQuotes() {
.verifyComplete();
}
+
+ @Test
+ public void testBuildClientURI_withoutUserInfoAndAuthSource() {
+
+ final String testUri = "mongodb://host:port/db?param";
+ final String resultUri = "mongodb://host:port/db?param&authSource=admin";
+
+ DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
+ final DBAuth dbAuth = new DBAuth();
+ datasourceConfiguration.setAuthentication(dbAuth);
+ datasourceConfiguration.setProperties(List.of(
+ new Property("0", "Yes"),
+ new Property("1", testUri)
+ ));
+ final String clientURI = pluginExecutor.buildClientURI(datasourceConfiguration);
+ assertEquals(resultUri, clientURI);
+ }
+
+ @Test
+ public void testBuildClientURI_withUserInfoAndAuthSource() {
+
+ final String testUri = "mongodb://user:pass@host:port/db?param&authSource=notAdmin";
+ final String resultUri = "mongodb://user:newPass@host:port/db?param&authSource=notAdmin";
+
+ DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
+ final DBAuth dbAuth = new DBAuth();
+ dbAuth.setPassword("newPass");
+ datasourceConfiguration.setAuthentication(dbAuth);
+ datasourceConfiguration.setProperties(List.of(
+ new Property("0", "Yes"),
+ new Property("1", testUri)
+ ));
+ final String clientURI = pluginExecutor.buildClientURI(datasourceConfiguration);
+ assertEquals(resultUri, clientURI);
+ }
+
+ @Test
+ public void testBuildClientURI_withoutDbInfoAndPortsAndParams() {
+
+ final String testUri = "mongodb://user:pass@host";
+ final String resultUri = "mongodb://user:newPass@host/?authSource=admin";
+
+ DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
+ final DBAuth dbAuth = new DBAuth();
+ dbAuth.setPassword("newPass");
+ datasourceConfiguration.setAuthentication(dbAuth);
+ datasourceConfiguration.setProperties(List.of(
+ new Property("0", "Yes"),
+ new Property("1", testUri)
+ ));
+ final String clientURI = pluginExecutor.buildClientURI(datasourceConfiguration);
+ assertEquals(resultUri, clientURI);
+ }
}
|
f060ab8c039789bc409365e3dee2653af0adcaf9
|
2022-02-23 12:02:18
|
Nayan
|
feat: Allow saving theme customizations (#11165)
| false
|
Allow saving theme customizations (#11165)
|
feat
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/acl/AclPermission.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/acl/AclPermission.java
index 82a8d3e930de..7f30021490ae 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/acl/AclPermission.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/acl/AclPermission.java
@@ -8,6 +8,7 @@
import com.appsmith.external.models.Datasource;
import com.appsmith.server.domains.Organization;
import com.appsmith.server.domains.Page;
+import com.appsmith.server.domains.Theme;
import com.appsmith.server.domains.User;
import lombok.Getter;
@@ -74,13 +75,15 @@ public enum AclPermission {
READ_DATASOURCES("read:datasources", Datasource.class),
EXECUTE_DATASOURCES("execute:datasources", Datasource.class),
- COMMENT_ON_THREAD("canComment:commentThreads", CommentThread.class),
- READ_THREAD("read:commentThreads", CommentThread.class),
- MANAGE_THREAD("manage:commentThreads", CommentThread.class),
+ COMMENT_ON_THREADS("canComment:commentThreads", CommentThread.class),
+ READ_THREADS("read:commentThreads", CommentThread.class),
+ MANAGE_THREADS("manage:commentThreads", CommentThread.class),
- READ_COMMENT("read:comments", Comment.class),
- MANAGE_COMMENT("manage:comments", Comment.class),
+ READ_COMMENTS("read:comments", Comment.class),
+ MANAGE_COMMENTS("manage:comments", Comment.class),
+ READ_THEMES("read:themes", Theme.class),
+ MANAGE_THEMES("manage:themes", Theme.class),
;
private final String value;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/acl/ce/PolicyGeneratorCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/acl/ce/PolicyGeneratorCE.java
index d7e776bf7aa8..dfc1ee6ccdd3 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/acl/ce/PolicyGeneratorCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/acl/ce/PolicyGeneratorCE.java
@@ -20,7 +20,7 @@
import java.util.stream.Collectors;
import static com.appsmith.server.acl.AclPermission.COMMENT_ON_APPLICATIONS;
-import static com.appsmith.server.acl.AclPermission.COMMENT_ON_THREAD;
+import static com.appsmith.server.acl.AclPermission.COMMENT_ON_THREADS;
import static com.appsmith.server.acl.AclPermission.EXECUTE_ACTIONS;
import static com.appsmith.server.acl.AclPermission.EXECUTE_DATASOURCES;
import static com.appsmith.server.acl.AclPermission.EXPORT_APPLICATIONS;
@@ -30,6 +30,7 @@
import static com.appsmith.server.acl.AclPermission.MANAGE_DATASOURCES;
import static com.appsmith.server.acl.AclPermission.MANAGE_ORGANIZATIONS;
import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
+import static com.appsmith.server.acl.AclPermission.MANAGE_THEMES;
import static com.appsmith.server.acl.AclPermission.MANAGE_USERS;
import static com.appsmith.server.acl.AclPermission.ORGANIZATION_EXPORT_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.ORGANIZATION_MANAGE_APPLICATIONS;
@@ -38,11 +39,12 @@
import static com.appsmith.server.acl.AclPermission.PUBLISH_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.READ_ACTIONS;
import static com.appsmith.server.acl.AclPermission.READ_APPLICATIONS;
-import static com.appsmith.server.acl.AclPermission.READ_COMMENT;
+import static com.appsmith.server.acl.AclPermission.READ_COMMENTS;
import static com.appsmith.server.acl.AclPermission.READ_DATASOURCES;
import static com.appsmith.server.acl.AclPermission.READ_ORGANIZATIONS;
import static com.appsmith.server.acl.AclPermission.READ_PAGES;
-import static com.appsmith.server.acl.AclPermission.READ_THREAD;
+import static com.appsmith.server.acl.AclPermission.READ_THEMES;
+import static com.appsmith.server.acl.AclPermission.READ_THREADS;
import static com.appsmith.server.acl.AclPermission.READ_USERS;
import static com.appsmith.server.acl.AclPermission.USER_MANAGE_ORGANIZATIONS;
import static com.appsmith.server.acl.AclPermission.USER_READ_ORGANIZATIONS;
@@ -81,6 +83,7 @@ public void createPolicyGraph() {
createPagePolicyGraph();
createActionPolicyGraph();
createCommentPolicyGraph();
+ createThemePolicyGraph();
}
/**
@@ -142,11 +145,17 @@ private void createPagePolicyGraph() {
}
private void createCommentPolicyGraph() {
- hierarchyGraph.addEdge(COMMENT_ON_APPLICATIONS, COMMENT_ON_THREAD);
+ hierarchyGraph.addEdge(COMMENT_ON_APPLICATIONS, COMMENT_ON_THREADS);
- lateralGraph.addEdge(COMMENT_ON_THREAD, READ_THREAD);
+ lateralGraph.addEdge(COMMENT_ON_THREADS, READ_THREADS);
- hierarchyGraph.addEdge(COMMENT_ON_THREAD, READ_COMMENT);
+ hierarchyGraph.addEdge(COMMENT_ON_THREADS, READ_COMMENTS);
+ }
+
+ private void createThemePolicyGraph() {
+ hierarchyGraph.addEdge(MANAGE_APPLICATIONS, MANAGE_THEMES);
+ hierarchyGraph.addEdge(READ_APPLICATIONS, READ_THEMES);
+ lateralGraph.addEdge(MANAGE_THEMES, READ_THEMES);
}
public Set<Policy> getLateralPolicies(AclPermission permission, Set<String> userNames, Class<? extends BaseDomain> destinationEntity) {
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/FieldName.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/FieldName.java
index 5d1d5be34405..48ae524bba6e 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/FieldName.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/FieldName.java
@@ -106,5 +106,6 @@ public class FieldName {
public static final String ACTION_LIST = "actionList";
public static final String ACTION_COLLECTION_LIST = "actionCollectionList";
public static final String DECRYPTED_FIELDS = "decryptedFields";
+ public static final String THEME = "theme";
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ThemeControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ThemeControllerCE.java
index 903f646d65fa..4257af339b01 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ThemeControllerCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ThemeControllerCE.java
@@ -4,18 +4,23 @@
import com.appsmith.server.domains.ApplicationMode;
import com.appsmith.server.domains.Theme;
import com.appsmith.server.dtos.ResponseDTO;
+import com.appsmith.server.exceptions.AppsmithError;
+import com.appsmith.server.exceptions.AppsmithException;
import com.appsmith.server.services.ThemeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import javax.validation.Valid;
+import java.util.List;
@Slf4j
@RequestMapping(Url.THEME_URL)
@@ -24,15 +29,38 @@ public ThemeControllerCE(ThemeService themeService) {
super(themeService);
}
+ @Override
+ public Mono<ResponseDTO<Theme>> create(Theme resource, String originHeader, ServerWebExchange exchange) {
+ throw new AppsmithException(AppsmithError.UNSUPPORTED_OPERATION);
+ }
+
@GetMapping("applications/{applicationId}")
- public Mono<ResponseDTO<Theme>> getThemes(@PathVariable String applicationId, @RequestParam(required = false, defaultValue = "EDIT") ApplicationMode mode) {
+ public Mono<ResponseDTO<List<Theme>>> getApplicationThemes(@PathVariable String applicationId) {
+ return service.getApplicationThemes(applicationId).collectList()
+ .map(themes -> new ResponseDTO<>(HttpStatus.OK.value(), themes, null));
+ }
+
+ @GetMapping("applications/{applicationId}/current")
+ public Mono<ResponseDTO<Theme>> getCurrentTheme(@PathVariable String applicationId, @RequestParam(required = false, defaultValue = "EDIT") ApplicationMode mode) {
return service.getApplicationTheme(applicationId, mode)
.map(theme -> new ResponseDTO<>(HttpStatus.OK.value(), theme, null));
}
- @PostMapping("applications/{applicationId}")
+ @PutMapping("applications/{applicationId}")
public Mono<ResponseDTO<Theme>> updateTheme(@PathVariable String applicationId, @Valid @RequestBody Theme resource) {
return service.updateTheme(applicationId, resource)
.map(theme -> new ResponseDTO<>(HttpStatus.OK.value(), theme, null));
}
+
+ @PatchMapping("applications/{applicationId}")
+ public Mono<ResponseDTO<Theme>> publishCurrentTheme(@PathVariable String applicationId, @RequestBody Theme resource) {
+ return service.persistCurrentTheme(applicationId, resource)
+ .map(theme -> new ResponseDTO<>(HttpStatus.OK.value(), theme, null));
+ }
+
+ @PatchMapping("{themeId}")
+ public Mono<ResponseDTO<Theme>> updateName(@PathVariable String themeId, @Valid @RequestBody Theme resource) {
+ return service.updateName(themeId, resource)
+ .map(theme -> new ResponseDTO<>(HttpStatus.OK.value(), theme, null));
+ }
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Theme.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Theme.java
index 9941dc9ceec2..71b1bfceac41 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Theme.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Theme.java
@@ -2,7 +2,6 @@
import com.appsmith.external.models.BaseDomain;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
@@ -11,7 +10,6 @@
import org.springframework.data.mongodb.core.mapping.Document;
import javax.validation.constraints.NotNull;
-import java.util.List;
import java.util.Map;
@Getter
@@ -23,23 +21,15 @@ public class Theme extends BaseDomain {
@NotNull
private String name;
- private Config config;
- private Properties properties;
- private Map<String, WidgetStyle> stylesheet;
+ private String applicationId;
+ private String organizationId;
+ private Object config;
+ private Object properties;
+ private Map<String, Object> stylesheet;
@JsonProperty("isSystemTheme") // manually setting property name to make sure it's compatible with Gson
private boolean isSystemTheme = false; // should be false by default
- @Data
- @AllArgsConstructor
- @NoArgsConstructor
- public static class Properties {
- private Colors colors;
- private BorderRadiusProperties borderRadius;
- private BoxShadowProperties boxShadow;
- private FontFamilyProperties fontFamily;
- }
-
@Data
@AllArgsConstructor
@NoArgsConstructor
@@ -47,87 +37,4 @@ public static class Colors {
private String primaryColor;
private String backgroundColor;
}
-
- @Data
- public static class Config {
- private Colors colors;
- private BorderRadius borderRadius;
- private BoxShadow boxShadow;
- private FontFamily fontFamily;
- }
-
- @Data
- public static class ResponsiveAttributes {
- @JsonProperty("none")
- @SerializedName("none")
- private String noneValue;
-
- @JsonProperty("DEFAULT")
- @SerializedName("DEFAULT")
- private String defaultValue;
-
- @JsonProperty("md")
- @SerializedName("md")
- private String mdValue;
-
- @JsonProperty("lg")
- @SerializedName("lg")
- private String lgValue;
-
- @JsonProperty("xl")
- @SerializedName("xl")
- private String xlValue;
-
- @JsonProperty("2xl")
- @SerializedName("2xl")
- private String doubleXlValue;
-
- @JsonProperty("3xl")
- @SerializedName("3xl")
- private String tripleXlValue;
-
- @JsonProperty("full")
- @SerializedName("full")
- private String fullValue;
- }
-
- @Data
- public static class BorderRadius {
- private ResponsiveAttributes appBorderRadius;
- }
-
- @Data
- public static class BoxShadow {
- private ResponsiveAttributes appBoxShadow;
- }
-
- @Data
- public static class FontFamily {
- private List<String> appFont;
- }
-
- @Data
- public static class FontFamilyProperties {
- private String appFont;
- }
-
- @Data
- public static class WidgetStyle {
- private String backgroundColor;
- private String borderRadius;
- private String boxShadow;
- private String primaryColor;
- private String menuColor;
- private String buttonColor;
- }
-
- @Data
- public static class BorderRadiusProperties {
- private String appBorderRadius;
- }
-
- @Data
- public static class BoxShadowProperties {
- private String appBoxShadow;
- }
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/PolicyUtils.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/PolicyUtils.java
index 78c5215c8016..deff21a92967 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/PolicyUtils.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/PolicyUtils.java
@@ -10,6 +10,7 @@
import com.appsmith.server.domains.CommentThread;
import com.appsmith.server.domains.NewAction;
import com.appsmith.server.domains.NewPage;
+import com.appsmith.server.domains.Theme;
import com.appsmith.server.domains.User;
import com.appsmith.server.repositories.ActionCollectionRepository;
import com.appsmith.server.repositories.ApplicationRepository;
@@ -17,9 +18,11 @@
import com.appsmith.server.repositories.DatasourceRepository;
import com.appsmith.server.repositories.NewActionRepository;
import com.appsmith.server.repositories.NewPageRepository;
+import com.appsmith.server.repositories.ThemeRepository;
import lombok.AllArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -35,6 +38,7 @@
import java.util.stream.Collectors;
import static com.appsmith.server.acl.AclPermission.MANAGE_DATASOURCES;
+import static com.appsmith.server.acl.AclPermission.READ_THEMES;
@Component
@AllArgsConstructor
@@ -47,6 +51,7 @@ public class PolicyUtils {
private final NewActionRepository newActionRepository;
private final CommentThreadRepository commentThreadRepository;
private final ActionCollectionRepository actionCollectionRepository;
+ private final ThemeRepository themeRepository;
public <T extends BaseDomain> T addPoliciesToExistingObject(Map<String, Policy> policyMap, T obj) {
// Making a deep copy here so we don't modify the `policyMap` object.
@@ -231,12 +236,37 @@ public Flux<NewPage> updateWithApplicationPermissionsToAllItsPages(String applic
.saveAll(updatedPages));
}
+ public Flux<Theme> updateThemePolicies(Application application, Map<String, Policy> themePolicyMap, boolean addPolicyToObject) {
+ Flux<Theme> applicationThemes = themeRepository.getApplicationThemes(application.getId(), READ_THEMES);
+ if(StringUtils.hasLength(application.getEditModeThemeId())) {
+ applicationThemes = applicationThemes.concatWith(
+ themeRepository.findById(application.getEditModeThemeId(), READ_THEMES)
+ );
+ }
+ if(StringUtils.hasLength(application.getPublishedModeThemeId())) {
+ applicationThemes = applicationThemes.concatWith(
+ themeRepository.findById(application.getPublishedModeThemeId(), READ_THEMES)
+ );
+ }
+ return applicationThemes
+ .filter(theme -> !theme.isSystemTheme()) // skip the system themes
+ .map(theme -> {
+ if (addPolicyToObject) {
+ return addPoliciesToExistingObject(themePolicyMap, theme);
+ } else {
+ return removePoliciesFromExistingObject(themePolicyMap, theme);
+ }
+ })
+ .collectList()
+ .flatMapMany(themeRepository::saveAll);
+ }
+
public Flux<CommentThread> updateCommentThreadPermissions(
String applicationId, Map<String, Policy> commentThreadPolicyMap, String username, boolean addPolicyToObject) {
return
// fetch comment threads with read permissions
- commentThreadRepository.findByApplicationId(applicationId, AclPermission.READ_THREAD)
+ commentThreadRepository.findByApplicationId(applicationId, AclPermission.READ_THREADS)
.switchIfEmpty(Mono.empty())
.map(thread -> {
if(!Boolean.TRUE.equals(thread.getIsPrivate())) {
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java
index 5b08b8d8eea1..366f92f401eb 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java
@@ -138,6 +138,7 @@
import static com.appsmith.server.acl.AclPermission.ORGANIZATION_EXPORT_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.ORGANIZATION_INVITE_USERS;
import static com.appsmith.server.acl.AclPermission.READ_ACTIONS;
+import static com.appsmith.server.acl.AclPermission.READ_THEMES;
import static com.appsmith.server.constants.FieldName.DEFAULT_RESOURCES;
import static com.appsmith.server.constants.FieldName.DYNAMIC_TRIGGER_PATH_LIST;
import static com.appsmith.server.helpers.CollectionUtils.isNullOrEmpty;
@@ -4744,37 +4745,6 @@ public void migrateFirestorePluginToUqi3(MongockTemplate mongockTemplate) {
mongockTemplate.save(firestorePlugin);
}
- @ChangeSet(order = "108", id = "create-system-themes", author = "")
- public void createSystemThemes(MongockTemplate mongockTemplate) throws IOException {
- Index uniqueApplicationIdIndex = new Index()
- .on(fieldName(QTheme.theme.isSystemTheme), Sort.Direction.ASC)
- .named("system_theme_index");
-
- ensureIndexes(mongockTemplate, Theme.class, uniqueApplicationIdIndex);
-
- final String themesJson = StreamUtils.copyToString(
- new DefaultResourceLoader().getResource("system-themes.json").getInputStream(),
- Charset.defaultCharset()
- );
- Theme[] themes = new Gson().fromJson(themesJson, Theme[].class);
-
- Theme legacyTheme = null;
- for (Theme theme : themes) {
- theme.setSystemTheme(true);
- Theme savedTheme = mongockTemplate.save(theme);
- if(savedTheme.getName().equalsIgnoreCase(Theme.LEGACY_THEME_NAME)) {
- legacyTheme = savedTheme;
- }
- }
-
- // migrate all applications and set legacy theme to them in both mode
- Update update = new Update().set(fieldName(QApplication.application.publishedModeThemeId), legacyTheme.getId())
- .set(fieldName(QApplication.application.editModeThemeId), legacyTheme.getId());
- mongockTemplate.updateMulti(
- new Query(where(fieldName(QApplication.application.deleted)).is(false)), update, Application.class
- );
- }
-
/**
* This method sets the key formData.aggregate.limit to 101 for all Mongo plugin actions.
* It iterates over each action id one by one to avoid out of memory error.
@@ -4817,6 +4787,11 @@ private boolean hasPublishedActionConfiguration(NewAction action) {
return true;
}
+ @ChangeSet(order = "108", id = "create-system-themes", author = "")
+ public void createSystemThemes(MongockTemplate mongockTemplate) throws IOException {
+ createSystemThemes2(mongockTemplate);
+ }
+
/**
* This migration adds a new field to Mongo aggregate command to set batchSize: formData.aggregate.limit. Its value
* is set by this migration to 101 for all existing actions since this is the default `batchSize` used by
@@ -5025,4 +5000,75 @@ public void updateNewActionActionCollectionIndexes(MongockTemplate mongockTempla
);
}
+ /**
+ * Adding this migration again because we've added permission to themes.
+ * Also there are couple of changes in the system theme properties.
+ * @param mongockTemplate
+ * @throws IOException
+ */
+ @ChangeSet(order = "117", id = "create-system-themes-v2", author = "")
+ public void createSystemThemes2(MongockTemplate mongockTemplate) throws IOException {
+ Index systemThemeIndex = new Index()
+ .on(fieldName(QTheme.theme.isSystemTheme), Sort.Direction.ASC)
+ .named("system_theme_index")
+ .background();
+
+ Index applicationIdIndex = new Index()
+ .on(fieldName(QTheme.theme.applicationId), Sort.Direction.ASC)
+ .on(fieldName(QTheme.theme.deleted), Sort.Direction.ASC)
+ .named("application_id_index")
+ .background();
+
+ dropIndexIfExists(mongockTemplate, Theme.class, "system_theme_index");
+ dropIndexIfExists(mongockTemplate, Theme.class, "application_id_index");
+ ensureIndexes(mongockTemplate, Theme.class, systemThemeIndex, applicationIdIndex);
+
+ final String themesJson = StreamUtils.copyToString(
+ new DefaultResourceLoader().getResource("system-themes.json").getInputStream(),
+ Charset.defaultCharset()
+ );
+ Theme[] themes = new Gson().fromJson(themesJson, Theme[].class);
+
+ Theme legacyTheme = null;
+ boolean themeExists = false;
+
+ Policy policyWithCurrentPermission = Policy.builder().permission(READ_THEMES.getValue())
+ .users(Set.of(FieldName.ANONYMOUS_USER)).build();
+
+ for (Theme theme : themes) {
+ theme.setSystemTheme(true);
+ theme.setCreatedAt(Instant.now());
+ theme.setPolicies(Set.of(policyWithCurrentPermission));
+ Query query = new Query(Criteria.where(fieldName(QTheme.theme.name)).is(theme.getName())
+ .and(fieldName(QTheme.theme.isSystemTheme)).is(true));
+
+ Theme savedTheme = mongockTemplate.findOne(query, Theme.class);
+ if(savedTheme == null) { // this theme does not exist, create it
+ savedTheme = mongockTemplate.save(theme);
+ } else { // theme already found, update
+ themeExists = true;
+ savedTheme.setPolicies(theme.getPolicies());
+ savedTheme.setConfig(theme.getConfig());
+ savedTheme.setProperties(theme.getProperties());
+ savedTheme.setStylesheet(theme.getStylesheet());
+ if(savedTheme.getCreatedAt() == null) {
+ savedTheme.setCreatedAt(Instant.now());
+ }
+ mongockTemplate.save(savedTheme);
+ }
+
+ if(theme.getName().equalsIgnoreCase(Theme.LEGACY_THEME_NAME)) {
+ legacyTheme = savedTheme;
+ }
+ }
+
+ if(!themeExists) { // this is the first time we're running the migration
+ // migrate all applications and set legacy theme to them in both mode
+ Update update = new Update().set(fieldName(QApplication.application.publishedModeThemeId), legacyTheme.getId())
+ .set(fieldName(QApplication.application.editModeThemeId), legacyTheme.getId());
+ mongockTemplate.updateMulti(
+ new Query(where(fieldName(QApplication.application.deleted)).is(false)), update, Application.class
+ );
+ }
+ }
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomCommentThreadRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomCommentThreadRepositoryCEImpl.java
index d40b45672f05..fe3470acc6d6 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomCommentThreadRepositoryCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomCommentThreadRepositoryCEImpl.java
@@ -58,13 +58,13 @@ public Mono<CommentThread> findPrivateThread(String applicationId) {
where(fieldName(QCommentThread.commentThread.applicationId)).is(applicationId),
where(fieldName(QCommentThread.commentThread.isPrivate)).is(TRUE)
);
- return queryOne(criteria, AclPermission.READ_THREAD);
+ return queryOne(criteria, AclPermission.READ_THREADS);
}
@Override
public Mono<UpdateResult> removeSubscriber(String threadId, String username) {
Update update = new Update().pull(fieldName(QCommentThread.commentThread.subscribers), username);
- return this.updateById(threadId, update, AclPermission.READ_THREAD);
+ return this.updateById(threadId, update, AclPermission.READ_THREADS);
}
@Override
@@ -92,7 +92,7 @@ public Mono<Long> countUnreadThreads(String applicationId, String userEmail) {
where(fieldName(QCommentThread.commentThread.applicationId)).is(applicationId),
where(resolvedActiveFieldKey).is(false)
);
- return count(criteriaList, AclPermission.READ_THREAD);
+ return count(criteriaList, AclPermission.READ_THREADS);
}
@Override
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCE.java
index a87099d01af7..44845df85c6d 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCE.java
@@ -1,11 +1,13 @@
package com.appsmith.server.repositories.ce;
+import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.domains.Theme;
import com.appsmith.server.repositories.AppsmithRepository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public interface CustomThemeRepositoryCE extends AppsmithRepository<Theme> {
+ Flux<Theme> getApplicationThemes(String applicationId, AclPermission aclPermission);
Flux<Theme> getSystemThemes();
Mono<Theme> getSystemThemeByName(String themeName);
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCEImpl.java
index ecd21d0273ec..02ec685332f9 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomThemeRepositoryCEImpl.java
@@ -1,5 +1,6 @@
package com.appsmith.server.repositories.ce;
+import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.domains.QTheme;
import com.appsmith.server.domains.Theme;
import com.appsmith.server.repositories.BaseAppsmithRepositoryImpl;
@@ -24,10 +25,18 @@ public CustomThemeRepositoryCEImpl(ReactiveMongoOperations mongoOperations, Mong
}
+ @Override
+ public Flux<Theme> getApplicationThemes(String applicationId, AclPermission aclPermission) {
+ Criteria appThemeCriteria = Criteria.where(fieldName(QTheme.theme.applicationId)).is(applicationId);
+ Criteria systemThemeCriteria = Criteria.where(fieldName(QTheme.theme.isSystemTheme)).is(Boolean.TRUE);
+ Criteria criteria = new Criteria().orOperator(appThemeCriteria, systemThemeCriteria);
+ return queryAll(List.of(criteria), aclPermission);
+ }
+
@Override
public Flux<Theme> getSystemThemes() {
- Criteria criteria = Criteria.where(fieldName(QTheme.theme.isSystemTheme)).is(Boolean.TRUE);
- return queryAll(List.of(criteria), null);
+ Criteria systemThemeCriteria = Criteria.where(fieldName(QTheme.theme.isSystemTheme)).is(Boolean.TRUE);
+ return queryAll(List.of(systemThemeCriteria), AclPermission.READ_THEMES);
}
@Override
@@ -35,6 +44,6 @@ public Mono<Theme> getSystemThemeByName(String themeName) {
String findNameRegex = String.format("^%s$", Pattern.quote(themeName));
Criteria criteria = where(fieldName(QTheme.theme.name)).regex(findNameRegex, "i")
.and(fieldName(QTheme.theme.isSystemTheme)).is(true);
- return queryOne(List.of(criteria), null);
+ return queryOne(List.of(criteria), AclPermission.READ_THEMES);
}
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ThemeServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ThemeServiceImpl.java
index cb071f2aaf00..c177a34877ec 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ThemeServiceImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ThemeServiceImpl.java
@@ -1,5 +1,6 @@
package com.appsmith.server.services;
+import com.appsmith.server.acl.PolicyGenerator;
import com.appsmith.server.repositories.ApplicationRepository;
import com.appsmith.server.repositories.ThemeRepository;
import com.appsmith.server.services.ce.ThemeServiceCEImpl;
@@ -14,7 +15,7 @@
@Slf4j
@Service
public class ThemeServiceImpl extends ThemeServiceCEImpl implements ThemeService {
- public ThemeServiceImpl(Scheduler scheduler, Validator validator, MongoConverter mongoConverter, ReactiveMongoTemplate reactiveMongoTemplate, ThemeRepository repository, AnalyticsService analyticsService, ApplicationRepository applicationRepository) {
- super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository, analyticsService, applicationRepository);
+ public ThemeServiceImpl(Scheduler scheduler, Validator validator, MongoConverter mongoConverter, ReactiveMongoTemplate reactiveMongoTemplate, ThemeRepository repository, AnalyticsService analyticsService, ApplicationRepository applicationRepository, PolicyGenerator policyGenerator) {
+ super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository, analyticsService, applicationRepository, policyGenerator);
}
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
index e96dc123c438..17b0f3a98558 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
@@ -697,16 +697,6 @@ public Mono<Application> cloneApplication(String applicationId, String branchNam
application1.setModifiedBy(applicationUserTuple2.getT2().getUsername()); // setting modified by to current user
return applicationService.createDefault(application1);
})
- // duplicate the source application's themes if required i.e. if they were customized
- .flatMap(application ->
- themeService.cloneThemeToApplication(sourceApplication.getEditModeThemeId(), application.getId())
- .zipWith(themeService.cloneThemeToApplication(sourceApplication.getPublishedModeThemeId(), application.getId()))
- .map(themesZip -> {
- application.setEditModeThemeId(themesZip.getT1().getId());
- application.setPublishedModeThemeId(themesZip.getT2().getId());
- return application;
- })
- )
// Now fetch the pages of the source application, clone and add them to this new application
.flatMap(savedApplication -> Flux.fromIterable(sourceApplication.getPages())
.flatMap(applicationPage -> {
@@ -728,6 +718,20 @@ public Mono<Application> cloneApplication(String applicationId, String branchNam
savedApplication.setPages(clonedPages);
return applicationService.save(savedApplication);
})
+ )
+ // duplicate the source application's themes if required i.e. if they were customized
+ .flatMap(application ->
+ themeService.cloneThemeToApplication(sourceApplication.getEditModeThemeId(), application)
+ .zipWith(themeService.cloneThemeToApplication(sourceApplication.getPublishedModeThemeId(), application))
+ .flatMap(themesZip -> {
+ String editModeThemeId = themesZip.getT1().getId();
+ String publishedModeThemeId = themesZip.getT2().getId();
+ application.setEditModeThemeId(editModeThemeId);
+ application.setPublishedModeThemeId(publishedModeThemeId);
+ return applicationService.setAppTheme(
+ application.getId(), editModeThemeId, publishedModeThemeId, MANAGE_APPLICATIONS
+ ).thenReturn(application);
+ })
);
});
@@ -842,9 +846,9 @@ public Mono<Application> publish(String applicationId, boolean isPublishedManual
.switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.APPLICATION, applicationId)))
.cache();
- Mono<Theme> publishThemeMono = applicationMono.flatMap(application -> themeService.publishTheme(
- application.getEditModeThemeId(), application.getPublishedModeThemeId(), application.getId()
- ));
+ Mono<Theme> publishThemeMono = applicationMono.flatMap(
+ application -> themeService.publishTheme(application.getId())
+ );
Flux<NewPage> publishApplicationAndPages = applicationMono
//Return all the pages in the Application
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCE.java
index 14b7d1c2f753..befa8314348c 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCE.java
@@ -5,6 +5,7 @@
import com.appsmith.server.domains.GitAuth;
import com.appsmith.server.dtos.ApplicationAccessDTO;
import com.appsmith.server.services.CrudService;
+import com.mongodb.client.result.UpdateResult;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -62,4 +63,6 @@ Mono<Application> findByBranchNameAndDefaultApplicationId(String branchName,
String getRandomAppCardColor();
+ Mono<UpdateResult> setAppTheme(String applicationId, String editModeThemeId, String publishedModeThemeId, AclPermission aclPermission);
+
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCEImpl.java
index 4a0e29b0ff01..586fd4bafa5b 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCEImpl.java
@@ -13,6 +13,7 @@
import com.appsmith.server.domains.NewAction;
import com.appsmith.server.domains.NewPage;
import com.appsmith.server.domains.Page;
+import com.appsmith.server.domains.Theme;
import com.appsmith.server.domains.User;
import com.appsmith.server.dtos.ActionDTO;
import com.appsmith.server.dtos.ApplicationAccessDTO;
@@ -28,6 +29,7 @@
import com.appsmith.server.services.BaseService;
import com.appsmith.server.services.ConfigService;
import com.appsmith.server.services.SessionUserService;
+import com.mongodb.client.result.UpdateResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
@@ -308,18 +310,23 @@ private Mono<? extends Application> generateAndSetPoliciesForPublicView(Applicat
Map<String, Policy> pagePolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(applicationPolicyMap, Application.class, Page.class);
Map<String, Policy> actionPolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(pagePolicyMap, Page.class, Action.class);
Map<String, Policy> datasourcePolicyMap = policyUtils.generatePolicyFromPermission(Set.of(EXECUTE_DATASOURCES), user);
+ Map<String, Policy> themePolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(
+ applicationPolicyMap, Application.class, Theme.class
+ );
final Flux<NewPage> updatedPagesFlux = policyUtils
.updateWithApplicationPermissionsToAllItsPages(application.getId(), pagePolicyMap, isPublic);
// Use the same policy map as actions for action collections since action collections have the same kind of permissions
final Flux<ActionCollection> updatedActionCollectionsFlux = policyUtils
.updateWithPagePermissionsToAllItsActionCollections(application.getId(), actionPolicyMap, isPublic);
-
+ Flux<Theme> updatedThemesFlux = policyUtils.updateThemePolicies(application, themePolicyMap, isPublic);
final Flux<NewAction> updatedActionsFlux = updatedPagesFlux
.collectList()
.thenMany(updatedActionCollectionsFlux)
.collectList()
.then(Mono.justOrEmpty(application.getId()))
+ .thenMany(updatedThemesFlux)
+ .collectList()
.flatMapMany(applicationId -> policyUtils.updateWithPagePermissionsToAllItsActions(application.getId(), actionPolicyMap, isPublic));
return updatedActionsFlux
@@ -547,4 +554,8 @@ public String getRandomAppCardColor() {
return ApplicationConstants.APP_CARD_COLORS[randomColorIndex];
}
+ @Override
+ public Mono<UpdateResult> setAppTheme(String applicationId, String editModeThemeId, String publishedModeThemeId, AclPermission aclPermission) {
+ return repository.setAppTheme(applicationId, editModeThemeId, publishedModeThemeId, aclPermission);
+ }
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommentServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommentServiceCEImpl.java
index 8ff28b7eab26..d290541af8d4 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommentServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommentServiceCEImpl.java
@@ -61,9 +61,9 @@
import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
import static com.appsmith.server.acl.AclPermission.READ_APPLICATIONS;
-import static com.appsmith.server.acl.AclPermission.READ_COMMENT;
+import static com.appsmith.server.acl.AclPermission.READ_COMMENTS;
import static com.appsmith.server.acl.AclPermission.READ_PAGES;
-import static com.appsmith.server.acl.AclPermission.READ_THREAD;
+import static com.appsmith.server.acl.AclPermission.READ_THREADS;
import static com.appsmith.server.constants.CommentConstants.APPSMITH_BOT_NAME;
import static com.appsmith.server.constants.CommentConstants.APPSMITH_BOT_USERNAME;
import static java.lang.Boolean.FALSE;
@@ -177,7 +177,7 @@ public Mono<Comment> create(String threadId, Comment comment, String originHeade
comment.setPageId(branchedPageId);
comment.setApplicationId(branchedApplicationId);
return threadRepository
- .findById(threadId, AclPermission.COMMENT_ON_THREAD)
+ .findById(threadId, AclPermission.COMMENT_ON_THREADS)
.switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.COMMENT_THREAD, threadId)))
.flatMap(commentThread -> updateThreadOnAddComment(commentThread, comment, user))
.flatMap(commentThread -> create(commentThread, user, comment, originHeader));
@@ -188,7 +188,7 @@ public Mono<Comment> create(String threadId, Comment comment, String originHeade
@Override
public Mono<Comment> findByIdAndBranchName(String id, String branchName) {
// Ignore branch name as comments are not shared across git branches
- return repository.findById(id, READ_COMMENT)
+ return repository.findById(id, READ_COMMENTS)
.map(responseUtils::updatePageAndAppIdWithDefaultResourcesForComments);
}
@@ -234,9 +234,9 @@ private Mono<CommentThread> convertToPublic(CommentThread commentThread) {
CommentThread.class
));
policies.add(policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.MANAGE_THREAD),
+ Set.of(AclPermission.MANAGE_THREADS),
commentThread.getAuthorUsername()
- ).get(AclPermission.MANAGE_THREAD.getValue()));
+ ).get(AclPermission.MANAGE_THREADS.getValue()));
commentThread.setPolicies(policies);
return commentThread;
});
@@ -266,9 +266,9 @@ private Mono<Comment> create(CommentThread commentThread, User user, Comment com
Comment.class
);
policies.add(policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.MANAGE_COMMENT),
+ Set.of(AclPermission.MANAGE_COMMENTS),
user
- ).get(AclPermission.MANAGE_COMMENT.getValue()));
+ ).get(AclPermission.MANAGE_COMMENTS.getValue()));
comment.setPolicies(policies);
Mono<Comment> commentMono;
@@ -429,7 +429,7 @@ public Mono<Comment> update(String id, Comment comment) {
// Comments and threads can't be moved between the pages and applications.
comment.setApplicationId(null);
comment.setPageId(null);
- return repository.updateById(id, comment, AclPermission.MANAGE_COMMENT)
+ return repository.updateById(id, comment, AclPermission.MANAGE_COMMENTS)
.flatMap(analyticsService::sendUpdateEvent)
.map(responseUtils::updatePageAndAppIdWithDefaultResourcesForComments);
}
@@ -447,7 +447,7 @@ public Mono<CommentThread> updateThread(String threadId, CommentThread commentTh
} else {
return Mono.just(user);
}
- }).zipWith(threadRepository.findById(threadId, AclPermission.READ_THREAD))
+ }).zipWith(threadRepository.findById(threadId, AclPermission.READ_THREADS))
.switchIfEmpty(Mono.error(
new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, "comment thread", threadId))
)
@@ -489,7 +489,7 @@ public Mono<CommentThread> updateThread(String threadId, CommentThread commentTh
}
return threadRepository
- .updateById(threadId, commentThread, AclPermission.READ_THREAD)
+ .updateById(threadId, commentThread, AclPermission.READ_THREADS)
.flatMap(updatedThread -> {
updatedThread.setIsViewed(true);
// Update branched applicationId and pageId with default Ids
@@ -520,7 +520,7 @@ public Mono<CommentThread> updateThread(String threadId, CommentThread commentTh
public Flux<Comment> get(MultiValueMap<String, String> params) {
// Remove branch name as comments are not shared across branches
params.remove(FieldName.DEFAULT_RESOURCES + "." + FieldName.BRANCH_NAME);
- return super.getWithPermission(params, READ_COMMENT)
+ return super.getWithPermission(params, READ_COMMENTS)
.map(responseUtils::updatePageAndAppIdWithDefaultResourcesForComments);
}
@@ -580,7 +580,7 @@ public Mono<List<CommentThread>> getThreadsByApplicationId(CommentThreadFilterDT
// user is app viewer, show only PUBLISHED comment threads
commentThreadFilterDTO.setMode(ApplicationMode.PUBLISHED);
}
- return threadRepository.find(commentThreadFilterDTO, AclPermission.READ_THREAD)
+ return threadRepository.find(commentThreadFilterDTO, AclPermission.READ_THREADS)
.collectList()
.flatMap(threads -> {
final Map<String, CommentThread> threadsByThreadId = new HashMap<>();
@@ -626,10 +626,10 @@ public Mono<List<CommentThread>> getThreadsByApplicationId(CommentThreadFilterDT
*/
@Override
public Mono<Comment> deleteComment(String id) {
- return repository.findById(id, AclPermission.MANAGE_COMMENT)
+ return repository.findById(id, AclPermission.MANAGE_COMMENTS)
.switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.COMMENT, id)))
.flatMap(repository::archive)
- .flatMap(comment -> threadRepository.findById(comment.getThreadId(), READ_THREAD).flatMap(commentThread ->
+ .flatMap(comment -> threadRepository.findById(comment.getThreadId(), READ_THREADS).flatMap(commentThread ->
sendCommentNotifications(commentThread.getSubscribers(), comment, CommentNotificationEvent.DELETED)
.thenReturn(comment)
))
@@ -639,7 +639,7 @@ public Mono<Comment> deleteComment(String id) {
@Override
public Mono<CommentThread> deleteThread(String threadId) {
- return threadRepository.findById(threadId, AclPermission.MANAGE_THREAD)
+ return threadRepository.findById(threadId, AclPermission.MANAGE_THREADS)
.flatMap(threadRepository::archive)
.flatMap(commentThread ->
notificationService.createNotification(
@@ -653,7 +653,7 @@ public Mono<CommentThread> deleteThread(String threadId) {
@Override
public Mono<Boolean> createReaction(String commentId, Comment.Reaction reaction) {
return Mono.zip(
- repository.findById(commentId, READ_COMMENT),
+ repository.findById(commentId, READ_COMMENTS),
sessionUserService.getCurrentUser()
)
.flatMap(tuple -> {
@@ -671,7 +671,7 @@ public Mono<Boolean> createReaction(String commentId, Comment.Reaction reaction)
@Override
public Mono<Boolean> deleteReaction(String commentId, Comment.Reaction reaction) {
return Mono.zip(
- repository.findById(commentId, READ_COMMENT),
+ repository.findById(commentId, READ_COMMENTS),
sessionUserService.getCurrentUser()
)
.flatMap(tuple -> {
@@ -702,7 +702,7 @@ private Mono<CommentThread> saveCommentThread(CommentThread commentThread, Appli
Mono<Long> commentSeq;
if (TRUE.equals(commentThread.getIsPrivate())) {
Collection<Policy> policyCollection = policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.MANAGE_THREAD, AclPermission.COMMENT_ON_THREAD),
+ Set.of(AclPermission.MANAGE_THREADS, AclPermission.COMMENT_ON_THREADS),
user
).values();
policies.addAll(policyCollection);
@@ -714,9 +714,9 @@ private Mono<CommentThread> saveCommentThread(CommentThread commentThread, Appli
CommentThread.class
));
policies.add(policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.MANAGE_THREAD),
+ Set.of(AclPermission.MANAGE_THREADS),
user
- ).get(AclPermission.MANAGE_THREAD.getValue()));
+ ).get(AclPermission.MANAGE_THREADS.getValue()));
commentSeq = sequenceService.getNext(CommentThread.class, application.getId());
}
commentThread.setPolicies(policies);
@@ -740,9 +740,9 @@ private Mono<Comment> createBotComment(CommentThread commentThread, User user, C
Comment.class
);
policies.add(policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.MANAGE_COMMENT),
+ Set.of(AclPermission.MANAGE_COMMENTS),
user
- ).get(AclPermission.MANAGE_COMMENT.getValue()));
+ ).get(AclPermission.MANAGE_COMMENTS.getValue()));
comment.setPolicies(policies);
Comment.Block block = new Comment.Block();
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCE.java
index 5bcdc2a8ad02..9ebb8a74ce5a 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCE.java
@@ -1,12 +1,18 @@
package com.appsmith.server.services.ce;
+import com.appsmith.server.acl.AclPermission;
+import com.appsmith.server.domains.Application;
import com.appsmith.server.domains.ApplicationMode;
import com.appsmith.server.domains.Theme;
import com.appsmith.server.services.CrudService;
+import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public interface ThemeServiceCE extends CrudService<Theme, String> {
Mono<Theme> getApplicationTheme(String applicationId, ApplicationMode applicationMode);
+ Flux<Theme> getApplicationThemes(String applicationId);
+ Flux<Theme> getSystemThemes();
+ Mono<Theme> getSystemTheme(String themeName);
Mono<Theme> updateTheme(String applicationId, Theme resource);
Mono<Theme> changeCurrentTheme(String themeId, String applicationId);
@@ -18,14 +24,17 @@ public interface ThemeServiceCE extends CrudService<Theme, String> {
Mono<String> getDefaultThemeId();
/**
- * Duplicates a theme if the theme is customized one. It'll set the application id to the new theme.
+ * Duplicates a theme if the theme is customized one.
* If the source theme is a system theme, it'll skip creating a new theme and return the system theme instead.
* @param srcThemeId ID of source theme that needs to be duplicated
* @param destApplicationId ID of the application for which theme'll be created
* @return newly created theme if source is not system theme, otherwise return the system theme
*/
- Mono<Theme> cloneThemeToApplication(String srcThemeId, String destApplicationId);
-
- Mono<Theme> publishTheme(String editModeThemeId, String publishedThemeId, String applicationId);
- void resetDefaultThemeIdCache();
+ Mono<Theme> cloneThemeToApplication(String srcThemeId, Application destApplication);
+ Mono<Theme> publishTheme(String applicationId);
+ Mono<Theme> persistCurrentTheme(String applicationId, Theme theme);
+ Mono<Theme> getThemeById(String themeId, AclPermission permission);
+ Mono<Theme> save(Theme theme);
+ Mono<Theme> updateName(String id, Theme theme);
+ Mono<Theme> getOrSaveTheme(Theme theme, Application destApplication);
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCEImpl.java
index 58d488c6cf03..06c669989240 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ThemeServiceCEImpl.java
@@ -1,7 +1,9 @@
package com.appsmith.server.services.ce;
import com.appsmith.server.acl.AclPermission;
+import com.appsmith.server.acl.PolicyGenerator;
import com.appsmith.server.constants.FieldName;
+import com.appsmith.server.domains.Application;
import com.appsmith.server.domains.ApplicationMode;
import com.appsmith.server.domains.Theme;
import com.appsmith.server.exceptions.AppsmithError;
@@ -19,43 +21,48 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Scheduler;
+import reactor.util.function.Tuples;
import javax.validation.Validator;
import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS;
+import static com.appsmith.server.acl.AclPermission.MANAGE_THEMES;
+import static com.appsmith.server.acl.AclPermission.READ_THEMES;
@Slf4j
public class ThemeServiceCEImpl extends BaseService<ThemeRepositoryCE, Theme, String> implements ThemeServiceCE {
private final ApplicationRepository applicationRepository;
+ private final PolicyGenerator policyGenerator;
private String defaultThemeId; // acts as a simple cache so that we don't need to fetch from DB always
- public ThemeServiceCEImpl(Scheduler scheduler, Validator validator, MongoConverter mongoConverter, ReactiveMongoTemplate reactiveMongoTemplate, ThemeRepository repository, AnalyticsService analyticsService, ApplicationRepository applicationRepository) {
+ public ThemeServiceCEImpl(Scheduler scheduler, Validator validator, MongoConverter mongoConverter, ReactiveMongoTemplate reactiveMongoTemplate, ThemeRepository repository, AnalyticsService analyticsService, ApplicationRepository applicationRepository, PolicyGenerator policyGenerator) {
super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository, analyticsService);
this.applicationRepository = applicationRepository;
- }
-
- @Override
- public Flux<Theme> get(MultiValueMap<String, String> params) {
- return repository.getSystemThemes(); // return the list of system themes
+ this.policyGenerator = policyGenerator;
}
@Override
public Mono<Theme> create(Theme resource) {
- // user can get the list of themes under an application only
- throw new UnsupportedOperationException();
+ return repository.save(resource);
}
@Override
public Mono<Theme> update(String s, Theme resource) {
// we don't allow to update a theme by id, user can only update a theme under their application
- throw new UnsupportedOperationException();
+ throw new AppsmithException(AppsmithError.UNSUPPORTED_OPERATION);
}
@Override
public Mono<Theme> getById(String s) {
- // TODO: better to add permission check
- return repository.findById(s);
+ // we don't allow to get a theme by id from DB
+ throw new AppsmithException(AppsmithError.UNSUPPORTED_OPERATION);
+ }
+
+ @Override
+ public Flux<Theme> get(MultiValueMap<String, String> params) {
+ // we return all system themes
+ return repository.getSystemThemes();
}
@Override
@@ -69,45 +76,75 @@ public Mono<Theme> getApplicationTheme(String applicationId, ApplicationMode app
if(applicationMode == ApplicationMode.PUBLISHED) {
themeId = application.getPublishedModeThemeId();
}
- if(!StringUtils.isEmpty(themeId)) {
- return repository.findById(themeId);
+ if(StringUtils.hasLength(themeId)) {
+ return repository.findById(themeId, READ_THEMES);
} else { // theme id is not present, return default theme
return repository.getSystemThemeByName(Theme.DEFAULT_THEME_NAME);
}
});
}
+ @Override
+ public Flux<Theme> getApplicationThemes(String applicationId) {
+ return repository.getApplicationThemes(applicationId, READ_THEMES);
+ }
+
+ @Override
+ public Flux<Theme> getSystemThemes() {
+ return repository.getSystemThemes();
+ }
+
@Override
public Mono<Theme> updateTheme(String applicationId, Theme resource) {
return applicationRepository.findById(applicationId, AclPermission.MANAGE_APPLICATIONS)
.flatMap(application -> {
// makes sure user has permission to edit application and an application exists by this applicationId
// check if this application has already a customized them
- return saveThemeForApplication(application.getEditModeThemeId(), resource, applicationId, ApplicationMode.EDIT);
+ return saveThemeForApplication(application.getEditModeThemeId(), resource, application, ApplicationMode.EDIT);
});
}
@Override
public Mono<Theme> changeCurrentTheme(String newThemeId, String applicationId) {
- // set provided theme to application and return that theme object
- Mono<Theme> setAppThemeMono = applicationRepository.setAppTheme(
- applicationId, newThemeId,null, MANAGE_APPLICATIONS
- ).then(repository.findById(newThemeId));
-
- // in case a customized theme was set to application, we need to delete that
return applicationRepository.findById(applicationId, AclPermission.MANAGE_APPLICATIONS)
.switchIfEmpty(Mono.error(
new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.APPLICATION, applicationId))
)
- .flatMap(application -> repository.findById(application.getEditModeThemeId())
+ .flatMap(application -> repository.findById(application.getEditModeThemeId(), READ_THEMES)
.defaultIfEmpty(new Theme())
- .flatMap(currentTheme -> {
- if (!StringUtils.isEmpty(currentTheme.getId()) && !currentTheme.isSystemTheme()) {
- // current theme is not a system theme but customized one, delete this
- return repository.delete(currentTheme).then(setAppThemeMono);
+ .zipWith(repository.findById(newThemeId, READ_THEMES))
+ .flatMap(themeTuple2 -> {
+ Theme currentTheme = themeTuple2.getT1();
+ Theme newTheme = themeTuple2.getT2();
+ Mono<Theme> saveThemeMono;
+ if(!newTheme.isSystemTheme()) {
+ // we'll create a copy of newTheme
+ newTheme.setId(null);
+ newTheme.setApplicationId(null);
+ newTheme.setOrganizationId(null);
+ newTheme.setPolicies(policyGenerator.getAllChildPolicies(
+ application.getPolicies(), Application.class, Theme.class
+ ));
+ saveThemeMono = repository.save(newTheme);
+ } else {
+ saveThemeMono = Mono.just(newTheme);
}
- return setAppThemeMono;
- }));
+
+ return saveThemeMono.flatMap(savedTheme -> {
+ if (StringUtils.hasLength(currentTheme.getId()) && !currentTheme.isSystemTheme()
+ && !StringUtils.hasLength(currentTheme.getApplicationId())) {
+ // current theme is neither a system theme nor app theme, delete the user customizations
+ return repository.delete(currentTheme).then(applicationRepository.setAppTheme(
+ applicationId, savedTheme.getId(),null, MANAGE_APPLICATIONS
+ )).thenReturn(savedTheme);
+ } else {
+ return applicationRepository.setAppTheme(
+ applicationId, savedTheme.getId(),null, MANAGE_APPLICATIONS
+ ).thenReturn(savedTheme);
+ }
+ });
+ })
+ );
}
@Override
@@ -122,79 +159,97 @@ public Mono<String> getDefaultThemeId() {
}
@Override
- public Mono<Theme> cloneThemeToApplication(String srcThemeId, String destApplicationId) {
- return applicationRepository.findById(destApplicationId, MANAGE_APPLICATIONS).then(
- // make sure the current user has permission to manage application
- repository.findById(srcThemeId).flatMap(theme -> {
- if (theme.isSystemTheme()) { // it's a system theme, no need to copy
- return Mono.just(theme);
- } else { // it's a customized theme, create a copy and return the copy
- theme.setId(null); // setting id to null so that save method will create a new instance
- return repository.save(theme);
- }
- })
- );
+ public Mono<Theme> cloneThemeToApplication(String srcThemeId, Application destApplication) {
+ return repository.findById(srcThemeId, READ_THEMES).flatMap(theme -> {
+ if (theme.isSystemTheme()) { // it's a system theme, no need to copy
+ return Mono.just(theme);
+ } else { // it's a customized theme, create a copy and return the copy
+ theme.setId(null); // setting id to null so that save method will create a new instance
+ theme.setApplicationId(null);
+ theme.setOrganizationId(null);
+ theme.setPolicies(policyGenerator.getAllChildPolicies(
+ destApplication.getPolicies(), Application.class, Theme.class
+ ));
+ return repository.save(theme);
+ }
+ });
}
+ /**
+ * Publishes a theme from edit mode to published mode
+ * @param applicationId application id
+ * @return Mono of theme object that was set in published mode
+ */
@Override
- public Mono<Theme> publishTheme(String editModeThemeId, String publishedThemeId, String applicationId) {
- Mono<Theme> editModeThemeMono;
- if(!StringUtils.hasLength(editModeThemeId)) { // theme id is empty, use the default theme
- editModeThemeMono = repository.getSystemThemeByName(Theme.LEGACY_THEME_NAME);
- } else { // theme id is not empty, fetch it by id
- editModeThemeMono = repository.findById(editModeThemeId);
- }
-
- Mono<Theme> publishThemeMono = editModeThemeMono.flatMap(editModeTheme -> {
- if (editModeTheme.isSystemTheme()) { // system theme is set as edit mode theme
- // just set the system theme id as edit and published mode theme id to application object
- return applicationRepository.setAppTheme(
- applicationId, editModeTheme.getId(), editModeTheme.getId(), MANAGE_APPLICATIONS
- ).thenReturn(editModeTheme);
- } else { // a customized theme is set as edit mode theme, copy that theme for published mode
- return saveThemeForApplication(publishedThemeId, editModeTheme, applicationId, ApplicationMode.PUBLISHED);
+ public Mono<Theme> publishTheme(String applicationId) {
+ // fetch application to make sure user has permission to manage this application
+ return applicationRepository.findById(applicationId, MANAGE_APPLICATIONS).flatMap(application -> {
+ Mono<Theme> editModeThemeMono;
+ if(!StringUtils.hasLength(application.getEditModeThemeId())) { // theme id is empty, use the default theme
+ editModeThemeMono = repository.getSystemThemeByName(Theme.LEGACY_THEME_NAME);
+ } else { // theme id is not empty, fetch it by id
+ editModeThemeMono = repository.findById(application.getEditModeThemeId(), READ_THEMES);
}
+
+ return editModeThemeMono.flatMap(editModeTheme -> {
+ if (editModeTheme.isSystemTheme()) { // system theme is set as edit mode theme
+ // Delete published mode theme if it was a copy of custom theme
+ return deletePublishedCustomizedThemeCopy(application.getPublishedModeThemeId()).then(
+ // Set the system theme id as edit and published mode theme id to application object
+ applicationRepository.setAppTheme(
+ applicationId, editModeTheme.getId(), editModeTheme.getId(), MANAGE_APPLICATIONS
+ )
+ ).thenReturn(editModeTheme);
+ } else { // a customized theme is set as edit mode theme, copy that theme for published mode
+ return saveThemeForApplication(
+ application.getPublishedModeThemeId(), editModeTheme, application, ApplicationMode.PUBLISHED
+ );
+ }
+ });
});
- // fetch application to make sure user has permission to manage this application
- return applicationRepository.findById(applicationId, MANAGE_APPLICATIONS).then(publishThemeMono);
}
/**
* Creates a new theme if Theme with provided themeId is a system theme.
* It sets the properties from the provided theme resource to the existing or newly created theme.
* It'll also update the application if a new theme was created.
- * @param themeId ID of the existing theme that might be updated
- * @param resource new theme DTO that'll be stored as a new theme or override the existing theme
- * @param applicationId Application that contains the theme
+ * @param currentThemeId ID of the existing theme that might be updated
+ * @param targetThemeResource new theme DTO that'll be stored as a new theme or override the existing theme
+ * @param application Application that contains the theme
* @param applicationMode In which mode this theme will be set
* @return Updated or newly created theme Publisher
*/
- private Mono<Theme> saveThemeForApplication(String themeId, Theme resource, String applicationId, ApplicationMode applicationMode) {
- return repository.findById(themeId)
- .flatMap(theme -> {
+ private Mono<Theme> saveThemeForApplication(String currentThemeId, Theme targetThemeResource, Application application, ApplicationMode applicationMode) {
+ return repository.findById(currentThemeId, READ_THEMES)
+ .flatMap(currentTheme -> {
// set the edit mode values to published mode theme
- theme.setConfig(resource.getConfig());
- theme.setStylesheet(resource.getStylesheet());
- theme.setProperties(resource.getProperties());
- theme.setName(resource.getName());
+ currentTheme.setConfig(targetThemeResource.getConfig());
+ currentTheme.setStylesheet(targetThemeResource.getStylesheet());
+ currentTheme.setProperties(targetThemeResource.getProperties());
+ if(StringUtils.hasLength(targetThemeResource.getName())) {
+ currentTheme.setName(targetThemeResource.getName());
+ }
boolean newThemeCreated = false;
- if (theme.isSystemTheme()) {
+ if (currentTheme.isSystemTheme()) {
// if this is a system theme, create a new one
- theme.setId(null); // setting id to null will create a new theme
- theme.setSystemTheme(false);
+ currentTheme.setId(null); // setting id to null will create a new theme
+ currentTheme.setSystemTheme(false);
+ currentTheme.setPolicies(policyGenerator.getAllChildPolicies(
+ application.getPolicies(), Application.class, Theme.class
+ ));
newThemeCreated = true;
}
- return repository.save(theme).zipWith(Mono.just(newThemeCreated));
+ return repository.save(currentTheme).zipWith(Mono.just(newThemeCreated));
}).flatMap(savedThemeTuple -> {
Theme theme = savedThemeTuple.getT1();
- if (savedThemeTuple.getT2()) { // new published theme created, update the application
+ if (savedThemeTuple.getT2()) { // new theme created, update the application
if(applicationMode == ApplicationMode.EDIT) {
return applicationRepository.setAppTheme(
- applicationId, theme.getId(), null, MANAGE_APPLICATIONS
+ application.getId(), theme.getId(), null, MANAGE_APPLICATIONS
).thenReturn(theme);
} else {
return applicationRepository.setAppTheme(
- applicationId, null, theme.getId(), MANAGE_APPLICATIONS
+ application.getId(), null, theme.getId(), MANAGE_APPLICATIONS
).thenReturn(theme);
}
} else {
@@ -204,7 +259,117 @@ private Mono<Theme> saveThemeForApplication(String themeId, Theme resource, Stri
}
@Override
- public void resetDefaultThemeIdCache() {
- defaultThemeId = null;
+ public Mono<Theme> persistCurrentTheme(String applicationId, Theme resource) {
+ return applicationRepository.findById(applicationId, MANAGE_APPLICATIONS)
+ .switchIfEmpty(Mono.error(
+ new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.APPLICATION, applicationId))
+ )
+ .flatMap(application -> {
+ String themeId = application.getEditModeThemeId();
+ if(!StringUtils.hasLength(themeId)) { // theme id is not present, raise error
+ return Mono.error(new AppsmithException(AppsmithError.UNSUPPORTED_OPERATION));
+ } else {
+ return repository.findById(themeId, READ_THEMES)
+ .map(theme -> Tuples.of(theme, application));
+ }
+ })
+ .flatMap(themeAndApplicationTuple -> {
+ Theme theme = themeAndApplicationTuple.getT1();
+ Application application = themeAndApplicationTuple.getT2();
+ theme.setId(null); // we'll create a copy so setting id to null
+ theme.setSystemTheme(false);
+ theme.setApplicationId(applicationId);
+ theme.setOrganizationId(application.getOrganizationId());
+ theme.setPolicies(policyGenerator.getAllChildPolicies(
+ application.getPolicies(), Application.class, Theme.class
+ ));
+
+ if(StringUtils.hasLength(resource.getName())) {
+ theme.setName(resource.getName());
+ } else {
+ theme.setName(theme.getName() + " copy");
+ }
+ return repository.save(theme);
+ });
+ }
+
+ /**
+ * This method will fetch a theme by id and delete this if it's not a system theme.
+ * When an app is published with a customized theme, we store a copy of that theme so that changes are available
+ * in published mode even user has changed the theme in edit mode. When user switches back to another theme and
+ * publish the application where that app was previously published with a custom theme, we should delete that copy.
+ * Otherwise there'll be a lot of orphan theme copies that were set a published mode once but are used no more.
+ * @param themeId id of the theme that'll be deleted
+ * @return deleted theme mono
+ */
+ private Mono<Theme> deletePublishedCustomizedThemeCopy(String themeId) {
+ if(!StringUtils.hasLength(themeId)) {
+ return Mono.empty();
+ }
+ return repository.findById(themeId).flatMap(theme -> {
+ if(!theme.isSystemTheme()) {
+ return repository.deleteById(themeId).thenReturn(theme);
+ }
+ return Mono.just(theme);
+ });
+ }
+
+ @Override
+ public Mono<Theme> delete(String themeId) {
+ return repository.findById(themeId, MANAGE_THEMES)
+ .switchIfEmpty(Mono.error(
+ new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.APPLICATION, FieldName.THEME))
+ ).flatMap(theme -> {
+ if (StringUtils.hasLength(theme.getApplicationId())) { // only persisted themes are allowed to delete
+ return repository.archive(theme);
+ } else {
+ return Mono.error(new AppsmithException(AppsmithError.UNSUPPORTED_OPERATION));
+ }
+ });
+ }
+
+ @Override
+ public Mono<Theme> getSystemTheme(String themeName) {
+ return repository.getSystemThemeByName(themeName);
+ }
+
+
+ @Override
+ public Mono<Theme> getThemeById(String themeId, AclPermission permission) {
+ return repository.findById(themeId, permission);
+ }
+
+ @Override
+ public Mono<Theme> save(Theme theme) {
+ return repository.save(theme);
+ }
+
+ @Override
+ public Mono<Theme> updateName(String id, Theme themeDto) {
+ return repository.findById(id, MANAGE_THEMES)
+ .switchIfEmpty(Mono.error(
+ new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.THEME, id))
+ ).flatMap(theme -> {
+ if(StringUtils.hasLength(themeDto.getName())) {
+ theme.setName(themeDto.getName());
+ }
+ return repository.save(theme);
+ });
+ }
+
+ @Override
+ public Mono<Theme> getOrSaveTheme(Theme theme, Application destApplication) {
+ if(theme == null) { // this application was exported without theme, assign the legacy theme to it
+ return repository.getSystemThemeByName(Theme.LEGACY_THEME_NAME); // return the default theme
+ } else if (theme.isSystemTheme()) {
+ return repository.getSystemThemeByName(theme.getName());
+ } else {
+ theme.setApplicationId(null);
+ theme.setOrganizationId(null);
+ theme.setPolicies(policyGenerator.getAllChildPolicies(
+ destApplication.getPolicies(), Application.class, Theme.class
+ ));
+ return repository.save(theme);
+ }
}
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserOrganizationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserOrganizationServiceCEImpl.java
index 271bae14ee8d..b2e606d3fab8 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserOrganizationServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserOrganizationServiceCEImpl.java
@@ -13,6 +13,7 @@
import com.appsmith.server.domains.NewPage;
import com.appsmith.server.domains.Organization;
import com.appsmith.server.domains.Page;
+import com.appsmith.server.domains.Theme;
import com.appsmith.server.domains.User;
import com.appsmith.server.domains.UserRole;
import com.appsmith.server.exceptions.AppsmithError;
@@ -172,6 +173,9 @@ public Mono<Organization> addUserToOrganizationGivenUserObject(Organization orga
Map<String, Policy> commentThreadPolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(
applicationPolicyMap, Application.class, CommentThread.class
);
+ Map<String, Policy> themePolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(
+ applicationPolicyMap, Application.class, Theme.class
+ );
//Now update the organization policies
Organization updatedOrganization = policyUtils.addPoliciesToExistingObject(orgPolicyMap, organization);
updatedOrganization.setUserRoles(userRoles);
@@ -179,7 +183,7 @@ public Mono<Organization> addUserToOrganizationGivenUserObject(Organization orga
// Update the underlying application/page/action
Flux<Datasource> updatedDatasourcesFlux = policyUtils.updateWithNewPoliciesToDatasourcesByOrgId(updatedOrganization.getId(), datasourcePolicyMap, true);
Flux<Application> updatedApplicationsFlux = policyUtils.updateWithNewPoliciesToApplicationsByOrgId(updatedOrganization.getId(), applicationPolicyMap, true)
- .cache();
+ .cache(); // .cache is very important, as we will execute once and reuse the results multiple times
Flux<NewPage> updatedPagesFlux = updatedApplicationsFlux
.flatMap(application -> policyUtils.updateWithApplicationPermissionsToAllItsPages(application.getId(), pagePolicyMap, true));
Flux<NewAction> updatedActionsFlux = updatedApplicationsFlux
@@ -188,14 +192,18 @@ public Mono<Organization> addUserToOrganizationGivenUserObject(Organization orga
.flatMap(application -> policyUtils.updateWithPagePermissionsToAllItsActionCollections(application.getId(), actionPolicyMap, true));
Flux<CommentThread> updatedThreadsFlux = updatedApplicationsFlux
.flatMap(application -> policyUtils.updateCommentThreadPermissions(application.getId(), commentThreadPolicyMap, user.getUsername(), true));
-
+ Flux<Theme> updatedThemesFlux = updatedApplicationsFlux
+ .flatMap(application -> policyUtils.updateThemePolicies(
+ application, themePolicyMap, true
+ ));
return Mono.zip(
updatedDatasourcesFlux.collectList(),
updatedPagesFlux.collectList(),
updatedActionsFlux.collectList(),
updatedActionCollectionsFlux.collectList(),
Mono.just(updatedOrganization),
- updatedThreadsFlux.collectList()
+ updatedThreadsFlux.collectList(),
+ updatedThemesFlux.collectList()
)
.flatMap(tuple -> {
//By now all the datasources/applications/pages/actions have been updated. Just save the organization now
@@ -256,6 +264,9 @@ private Mono<Organization> removeUserRoleFromOrganizationGivenUserObject(Organiz
Map<String, Policy> commentThreadPolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(
applicationPolicyMap, Application.class, CommentThread.class
);
+ Map<String, Policy> themePolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(
+ applicationPolicyMap, Application.class, Theme.class
+ );
//Now update the organization policies
Organization updatedOrganization = policyUtils.removePoliciesFromExistingObject(orgPolicyMap, organization);
@@ -264,7 +275,7 @@ private Mono<Organization> removeUserRoleFromOrganizationGivenUserObject(Organiz
// Update the underlying application/page/action
Flux<Datasource> updatedDatasourcesFlux = policyUtils.updateWithNewPoliciesToDatasourcesByOrgId(updatedOrganization.getId(), datasourcePolicyMap, false);
Flux<Application> updatedApplicationsFlux = policyUtils.updateWithNewPoliciesToApplicationsByOrgId(updatedOrganization.getId(), applicationPolicyMap, false)
- .cache();
+ .cache(); // .cache is very important, as we will execute once and reuse the results multiple times
Flux<NewPage> updatedPagesFlux = updatedApplicationsFlux
.flatMap(application -> policyUtils.updateWithApplicationPermissionsToAllItsPages(application.getId(), pagePolicyMap, false));
Flux<NewAction> updatedActionsFlux = updatedApplicationsFlux
@@ -275,6 +286,10 @@ private Mono<Organization> removeUserRoleFromOrganizationGivenUserObject(Organiz
.flatMap(application -> policyUtils.updateCommentThreadPermissions(
application.getId(), commentThreadPolicyMap, user.getUsername(), false
));
+ Flux<Theme> updatedThemesFlux = updatedApplicationsFlux
+ .flatMap(application -> policyUtils.updateThemePolicies(
+ application, themePolicyMap, false
+ ));
return Mono.zip(
updatedDatasourcesFlux.collectList(),
@@ -282,7 +297,8 @@ private Mono<Organization> removeUserRoleFromOrganizationGivenUserObject(Organiz
updatedActionsFlux.collectList(),
updatedActionCollectionsFlux.collectList(),
updatedThreadsFlux.collectList(),
- Mono.just(updatedOrganization)
+ Mono.just(updatedOrganization),
+ updatedThemesFlux.collectList()
).flatMap(tuple -> {
//By now all the datasources/applications/pages/actions have been updated. Just save the organization now
Organization updatedOrgBeforeSave = tuple.getT6();
@@ -435,6 +451,9 @@ public Mono<Organization> bulkAddUsersToOrganization(Organization organization,
applicationPolicyMap, Application.class, CommentThread.class
);
Map<String, Policy> actionPolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(pagePolicyMap, Page.class, Action.class);
+ Map<String, Policy> themePolicyMap = policyUtils.generateInheritedPoliciesFromSourcePolicies(
+ applicationPolicyMap, Application.class, Theme.class
+ );
// Now update the organization policies
Organization updatedOrganization = policyUtils.addPoliciesToExistingObject(orgPolicyMap, organization);
@@ -454,13 +473,19 @@ public Mono<Organization> bulkAddUsersToOrganization(Organization organization,
.flatMap(application -> policyUtils.updateCommentThreadPermissions(
application.getId(), commentThreadPolicyMap, null, true
));
+ Flux<Theme> updatedThemesFlux = updatedApplicationsFlux
+ .flatMap(application -> policyUtils.updateThemePolicies(
+ application, themePolicyMap, true
+ ));
return Mono.when(
- updatedDatasourcesFlux.collectList(),
- updatedPagesFlux.collectList(),
- updatedActionsFlux.collectList(),
- updatedActionCollectionsFlux.collectList(),
- updatedThreadsFlux.collectList())
+ updatedDatasourcesFlux.collectList(),
+ updatedPagesFlux.collectList(),
+ updatedActionsFlux.collectList(),
+ updatedActionCollectionsFlux.collectList(),
+ updatedThreadsFlux.collectList(),
+ updatedThemesFlux.collectList()
+ )
// By now all the
// data sources/applications/pages/actions/action collections/comment threads
// have been updated. Just save the organization now
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ExamplesOrganizationClonerImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ExamplesOrganizationClonerImpl.java
index 4569f4f843e3..8f525bf9c7f6 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ExamplesOrganizationClonerImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ExamplesOrganizationClonerImpl.java
@@ -13,6 +13,7 @@
import com.appsmith.server.services.NewActionService;
import com.appsmith.server.services.OrganizationService;
import com.appsmith.server.services.SessionUserService;
+import com.appsmith.server.services.ThemeService;
import com.appsmith.server.services.UserService;
import com.appsmith.server.solutions.ce.ExamplesOrganizationClonerCEImpl;
import lombok.extern.slf4j.Slf4j;
@@ -35,10 +36,11 @@ public ExamplesOrganizationClonerImpl(OrganizationService organizationService,
NewActionService newActionService,
LayoutActionService layoutActionService,
ActionCollectionService actionCollectionService,
- LayoutCollectionService layoutCollectionService) {
+ LayoutCollectionService layoutCollectionService,
+ ThemeService themeService) {
super(organizationService, organizationRepository, datasourceService, datasourceRepository, configService,
sessionUserService, userService, applicationService, applicationPageService, newPageRepository,
- newActionService, layoutActionService, actionCollectionService, layoutCollectionService);
+ newActionService, layoutActionService, actionCollectionService, layoutCollectionService, themeService);
}
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationServiceImpl.java
index 31efb7e34f4c..bf25f6994552 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationServiceImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationServiceImpl.java
@@ -5,7 +5,6 @@
import com.appsmith.server.repositories.NewActionRepository;
import com.appsmith.server.repositories.NewPageRepository;
import com.appsmith.server.repositories.PluginRepository;
-import com.appsmith.server.repositories.ThemeRepository;
import com.appsmith.server.services.ActionCollectionService;
import com.appsmith.server.services.ApplicationPageService;
import com.appsmith.server.services.ApplicationService;
@@ -15,6 +14,7 @@
import com.appsmith.server.services.OrganizationService;
import com.appsmith.server.services.SequenceService;
import com.appsmith.server.services.SessionUserService;
+import com.appsmith.server.services.ThemeService;
import com.appsmith.server.solutions.ce.ImportExportApplicationServiceCEImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -38,11 +38,11 @@ public ImportExportApplicationServiceImpl(DatasourceService datasourceService,
ExamplesOrganizationCloner examplesOrganizationCloner,
ActionCollectionRepository actionCollectionRepository,
ActionCollectionService actionCollectionService,
- ThemeRepository themeRepository) {
+ ThemeService themeService) {
super(datasourceService, sessionUserService, newActionRepository, datasourceRepository, pluginRepository,
organizationService, applicationService, newPageService, applicationPageService, newPageRepository,
newActionService, sequenceService, examplesOrganizationCloner, actionCollectionRepository,
- actionCollectionService, themeRepository);
+ actionCollectionService, themeService);
}
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ExamplesOrganizationClonerCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ExamplesOrganizationClonerCEImpl.java
index 3a1bf806e1ae..b498edce03bd 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ExamplesOrganizationClonerCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ExamplesOrganizationClonerCEImpl.java
@@ -6,6 +6,7 @@
import com.appsmith.external.models.BaseDomain;
import com.appsmith.external.models.Datasource;
import com.appsmith.external.models.DefaultResources;
+import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.constants.FieldName;
import com.appsmith.server.domains.ActionCollection;
import com.appsmith.server.domains.Application;
@@ -13,6 +14,7 @@
import com.appsmith.server.domains.Layout;
import com.appsmith.server.domains.NewPage;
import com.appsmith.server.domains.Organization;
+import com.appsmith.server.domains.Theme;
import com.appsmith.server.domains.User;
import com.appsmith.server.dtos.ActionCollectionDTO;
import com.appsmith.server.dtos.ActionDTO;
@@ -33,7 +35,9 @@
import com.appsmith.server.services.NewActionService;
import com.appsmith.server.services.OrganizationService;
import com.appsmith.server.services.SessionUserService;
+import com.appsmith.server.services.ThemeService;
import com.appsmith.server.services.UserService;
+import com.mongodb.client.result.UpdateResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.bson.types.ObjectId;
@@ -68,6 +72,7 @@ public class ExamplesOrganizationClonerCEImpl implements ExamplesOrganizationClo
private final LayoutActionService layoutActionService;
private final ActionCollectionService actionCollectionService;
private final LayoutCollectionService layoutCollectionService;
+ private final ThemeService themeService;
public Mono<Organization> cloneExamplesOrganization() {
return sessionUserService
@@ -417,17 +422,35 @@ private Flux<NewPage> doOnlyCloneApplicationObjectWithoutItsDependenciesAndRetur
.flatMapMany(
savedApplication -> {
applicationIds.add(savedApplication.getId());
- return newPageRepository
- .findByApplicationId(templateApplicationId)
- .map(newPage -> {
- log.info("Preparing page for cloning {} {}.", newPage.getUnpublishedPage().getName(), newPage.getId());
- newPage.setApplicationId(savedApplication.getId());
- return newPage;
- });
+ return forkThemes(application, savedApplication).thenMany(
+ newPageRepository
+ .findByApplicationId(templateApplicationId)
+ .map(newPage -> {
+ log.info("Preparing page for cloning {} {}.", newPage.getUnpublishedPage().getName(), newPage.getId());
+ newPage.setApplicationId(savedApplication.getId());
+ return newPage;
+ })
+ );
}
);
}
+ private Mono<UpdateResult> forkThemes(Application srcApplication, Application destApplication) {
+ return Mono.zip(
+ themeService.cloneThemeToApplication(srcApplication.getEditModeThemeId(), destApplication),
+ themeService.cloneThemeToApplication(srcApplication.getPublishedModeThemeId(), destApplication)
+ ).flatMap(themes -> {
+ Theme editModeTheme = themes.getT1();
+ Theme publishedModeTheme = themes.getT2();
+ return applicationService.setAppTheme(
+ destApplication.getId(),
+ editModeTheme.getId(),
+ publishedModeTheme.getId(),
+ AclPermission.MANAGE_APPLICATIONS
+ );
+ });
+ }
+
private Mono<Application> cloneApplicationDocument(Application application) {
if (!StringUtils.hasText(application.getName())) {
return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.NAME));
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java
index a88099451b22..0d1b8fc3c47f 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java
@@ -37,7 +37,6 @@
import com.appsmith.server.repositories.NewActionRepository;
import com.appsmith.server.repositories.NewPageRepository;
import com.appsmith.server.repositories.PluginRepository;
-import com.appsmith.server.repositories.ThemeRepository;
import com.appsmith.server.services.ActionCollectionService;
import com.appsmith.server.services.ApplicationPageService;
import com.appsmith.server.services.ApplicationService;
@@ -47,6 +46,7 @@
import com.appsmith.server.services.OrganizationService;
import com.appsmith.server.services.SequenceService;
import com.appsmith.server.services.SessionUserService;
+import com.appsmith.server.services.ThemeService;
import com.appsmith.server.solutions.ExamplesOrganizationCloner;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -77,6 +77,7 @@
import static com.appsmith.server.acl.AclPermission.MANAGE_ACTIONS;
import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
+import static com.appsmith.server.acl.AclPermission.READ_THEMES;
@Slf4j
@RequiredArgsConstructor
@@ -97,7 +98,7 @@ public class ImportExportApplicationServiceCEImpl implements ImportExportApplica
private final ExamplesOrganizationCloner examplesOrganizationCloner;
private final ActionCollectionRepository actionCollectionRepository;
private final ActionCollectionService actionCollectionService;
- private final ThemeRepository themeRepository;
+ private final ThemeService themeService;
private static final Set<MediaType> ALLOWED_CONTENT_TYPES = Set.of(MediaType.APPLICATION_JSON);
private static final String INVALID_JSON_FILE = "invalid json file";
@@ -153,8 +154,8 @@ public Mono<ApplicationJson> exportApplicationById(String applicationId, Seriali
return plugin;
})
.then(applicationMono)
- .flatMap(application -> themeRepository.findById(application.getEditModeThemeId())
- .zipWith(themeRepository.findById(application.getPublishedModeThemeId()))
+ .flatMap(application -> themeService.getThemeById(application.getEditModeThemeId(), READ_THEMES)
+ .zipWith(themeService.getThemeById(application.getPublishedModeThemeId(), READ_THEMES))
.map(themesTuple -> {
Theme editModeTheme = exportTheme(themesTuple.getT1());
Theme publishedModeTheme = exportTheme(themesTuple.getT2());
@@ -581,7 +582,6 @@ public Mono<Application> importApplicationInOrganization(String organizationId,
pluginMap.put(pluginReference, plugin.getId());
return plugin;
})
- .then(importThemes(importedApplication, importedDoc))
.then(organizationService.findById(organizationId, AclPermission.ORGANIZATION_MANAGE_APPLICATIONS))
.switchIfEmpty(Mono.error(
new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.ORGANIZATION, organizationId))
@@ -707,6 +707,7 @@ public Mono<Application> importApplicationInOrganization(String organizationId,
.then(applicationService.save(importedApplication));
})
)
+ .flatMap(savedAPP -> importThemes(savedAPP, importedDoc))
.flatMap(savedApp -> {
importedApplication.setId(savedApp.getId());
if (savedApp.getGitApplicationMetadata() != null) {
@@ -1524,26 +1525,23 @@ private Theme exportTheme(Theme srcTheme) {
}
private Mono<Application> importThemes(Application application, ApplicationJson importedApplicationJson) {
- Mono<Theme> importedEditModeTheme = getOrSaveTheme(importedApplicationJson.getEditModeTheme());
- Mono<Theme> importedPublishedModeTheme = getOrSaveTheme(importedApplicationJson.getPublishedTheme());
-
- return Mono.zip(importedEditModeTheme, importedPublishedModeTheme).map(importedThemesTuple -> {
- application.setEditModeThemeId(importedThemesTuple.getT1().getId());
- application.setPublishedModeThemeId(importedThemesTuple.getT2().getId());
- return application;
+ Mono<Theme> importedEditModeTheme = themeService.getOrSaveTheme(importedApplicationJson.getEditModeTheme(), application);
+ Mono<Theme> importedPublishedModeTheme = themeService.getOrSaveTheme(importedApplicationJson.getPublishedTheme(), application);
+
+ return Mono.zip(importedEditModeTheme, importedPublishedModeTheme).flatMap(importedThemesTuple -> {
+ String editModeThemeId = importedThemesTuple.getT1().getId();
+ String publishedModeThemeId = importedThemesTuple.getT2().getId();
+
+ application.setEditModeThemeId(editModeThemeId);
+ application.setPublishedModeThemeId(publishedModeThemeId);
+ // this will update the theme id in DB
+ // also returning the updated application object so that theme id are available to the next pipeline
+ return applicationService.setAppTheme(
+ application.getId(), editModeThemeId, publishedModeThemeId, MANAGE_APPLICATIONS
+ ).thenReturn(application);
});
}
- private Mono<Theme> getOrSaveTheme(Theme theme) {
- if(theme == null) { // this application was exported without theme, assign the legacy theme to it
- return themeRepository.getSystemThemeByName(Theme.LEGACY_THEME_NAME); // return the default theme
- } else if (theme.isSystemTheme()) {
- return themeRepository.getSystemThemeByName(theme.getName());
- } else {
- return themeRepository.save(theme);
- }
- }
-
private void removeUnwantedFieldsFromApplicationDuringExport(Application application) {
application.setOrganizationId(null);
application.setPages(null);
diff --git a/app/server/appsmith-server/src/main/resources/system-themes.json b/app/server/appsmith-server/src/main/resources/system-themes.json
index 60a4253e090b..7a5c854c32e2 100644
--- a/app/server/appsmith-server/src/main/resources/system-themes.json
+++ b/app/server/appsmith-server/src/main/resources/system-themes.json
@@ -10,8 +10,7 @@
"appBorderRadius": {
"none": "0px",
"md": "0.375rem",
- "lg": "1.5rem",
- "full": "9999px"
+ "lg": "1.5rem"
}
},
"boxShadow": {
@@ -41,135 +40,216 @@
"AUDIO_RECORDER_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"BUTTON_WIDGET": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"BUTTON_GROUP_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "CAMERA_WIDGET": {
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
},
"CHART_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"CHECKBOX_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"CHECKBOX_GROUP_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"CONTAINER_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
+ "CIRCULAR_PROGRESS_WIDGET": {
+ "fillColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ },
+ "CURRENCY_INPUT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "PHONE_INPUT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
"DATE_PICKER_WIDGET2": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
"FILE_PICKER_WIDGET_V2": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"FORM_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"FORM_BUTTON_WIDGET": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"ICON_BUTTON_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"IFRAME_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"IMAGE_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"INPUT_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "INPUT_WIDGET_V2": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
"LIST_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"MAP_WIDGET": {
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ },
+ "MAP_CHART_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"MENU_BUTTON_WIDGET": {
"menuColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MODAL_WIDGET": {
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MULTI_SELECT_TREE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MULTI_SELECT_WIDGET": {
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"DROP_DOWN_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
+ "PROGRESSBAR_WIDGET": {
+ "fillColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ },
+ "RATE_WIDGET": {
+ "activeColor": "{{appsmith.theme.colors.primaryColor}}"
+ },
"RADIO_GROUP_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}"
+ "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "boxShadow": "none"
},
"RICH_TEXT_EDITOR_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"STATBOX_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"SWITCH_WIDGET": {
+ "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "boxShadow": "none"
+ },
+ "SWITCH_GROUP_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}"
},
+ "SELECT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
"TABLE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"TABS_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"TEXT_WIDGET": {
},
"VIDEO_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"SINGLE_SELECT_TREE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
}
},
"properties": {
@@ -199,8 +279,7 @@
"appBorderRadius": {
"none": "0px",
"md": "0.375rem",
- "lg": "1.5rem",
- "full": "9999px"
+ "lg": "1.5rem"
}
},
"boxShadow": {
@@ -230,135 +309,216 @@
"AUDIO_RECORDER_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"BUTTON_WIDGET": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"BUTTON_GROUP_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "CAMERA_WIDGET": {
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
},
"CHART_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"CHECKBOX_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"CHECKBOX_GROUP_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"CONTAINER_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
+ "CIRCULAR_PROGRESS_WIDGET": {
+ "fillColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ },
+ "CURRENCY_INPUT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "PHONE_INPUT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
"DATE_PICKER_WIDGET2": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
"FILE_PICKER_WIDGET_V2": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"FORM_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"FORM_BUTTON_WIDGET": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"ICON_BUTTON_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"IFRAME_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"IMAGE_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"INPUT_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "INPUT_WIDGET_V2": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
"LIST_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"MAP_WIDGET": {
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ },
+ "MAP_CHART_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"MENU_BUTTON_WIDGET": {
"menuColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MODAL_WIDGET": {
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MULTI_SELECT_TREE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MULTI_SELECT_WIDGET": {
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"DROP_DOWN_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
+ "PROGRESSBAR_WIDGET": {
+ "fillColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ },
+ "RATE_WIDGET": {
+ "activeColor": "{{appsmith.theme.colors.primaryColor}}"
+ },
"RADIO_GROUP_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}"
+ "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "boxShadow": "none"
},
"RICH_TEXT_EDITOR_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"STATBOX_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"SWITCH_WIDGET": {
+ "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "boxShadow": "none"
+ },
+ "SWITCH_GROUP_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}"
},
+ "SELECT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
"TABLE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"TABS_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"TEXT_WIDGET": {
},
"VIDEO_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"SINGLE_SELECT_TREE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
}
},
"properties": {
@@ -388,8 +548,7 @@
"appBorderRadius": {
"none": "0px",
"md": "0.375rem",
- "lg": "1.5rem",
- "full": "9999px"
+ "lg": "1.5rem"
}
},
"boxShadow": {
@@ -419,135 +578,216 @@
"AUDIO_RECORDER_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"BUTTON_WIDGET": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"BUTTON_GROUP_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "CAMERA_WIDGET": {
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
},
"CHART_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"CHECKBOX_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"CHECKBOX_GROUP_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"CONTAINER_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
+ "CIRCULAR_PROGRESS_WIDGET": {
+ "fillColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ },
+ "CURRENCY_INPUT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "PHONE_INPUT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
"DATE_PICKER_WIDGET2": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
"FILE_PICKER_WIDGET_V2": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"FORM_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"FORM_BUTTON_WIDGET": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"ICON_BUTTON_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"IFRAME_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"IMAGE_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"INPUT_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "INPUT_WIDGET_V2": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
"LIST_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"MAP_WIDGET": {
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ },
+ "MAP_CHART_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"MENU_BUTTON_WIDGET": {
"menuColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MODAL_WIDGET": {
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MULTI_SELECT_TREE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MULTI_SELECT_WIDGET": {
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"DROP_DOWN_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
+ "PROGRESSBAR_WIDGET": {
+ "fillColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ },
+ "RATE_WIDGET": {
+ "activeColor": "{{appsmith.theme.colors.primaryColor}}"
+ },
"RADIO_GROUP_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}"
+ "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "boxShadow": "none"
},
"RICH_TEXT_EDITOR_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"STATBOX_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"SWITCH_WIDGET": {
+ "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "boxShadow": "none"
+ },
+ "SWITCH_GROUP_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}"
},
+ "SELECT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
"TABLE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"TABS_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"TEXT_WIDGET": {
},
"VIDEO_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"SINGLE_SELECT_TREE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
}
},
"properties": {
@@ -577,8 +817,7 @@
"appBorderRadius": {
"none": "0px",
"md": "0.375rem",
- "lg": "1.5rem",
- "full": "9999px"
+ "lg": "1.5rem"
}
},
"boxShadow": {
@@ -608,135 +847,216 @@
"AUDIO_RECORDER_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"BUTTON_WIDGET": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"BUTTON_GROUP_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "CAMERA_WIDGET": {
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "boxShadow": "none"
},
"CHART_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"CHECKBOX_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"CHECKBOX_GROUP_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"CONTAINER_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
+ "CIRCULAR_PROGRESS_WIDGET": {
+ "fillColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ },
+ "CURRENCY_INPUT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "PHONE_INPUT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
"DATE_PICKER_WIDGET2": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
"FILE_PICKER_WIDGET_V2": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"FORM_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"FORM_BUTTON_WIDGET": {
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"ICON_BUTTON_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"IFRAME_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"IMAGE_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"INPUT_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
+ "INPUT_WIDGET_V2": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
"LIST_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"MAP_WIDGET": {
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ },
+ "MAP_CHART_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"MENU_BUTTON_WIDGET": {
"menuColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
- "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MODAL_WIDGET": {
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MULTI_SELECT_TREE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"MULTI_SELECT_WIDGET": {
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
},
"DROP_DOWN_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "none"
},
+ "PROGRESSBAR_WIDGET": {
+ "fillColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ },
+ "RATE_WIDGET": {
+ "activeColor": "{{appsmith.theme.colors.primaryColor}}"
+ },
"RADIO_GROUP_WIDGET": {
- "backgroundColor": "{{appsmith.theme.colors.primaryColor}}"
+ "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "boxShadow": "none"
},
"RICH_TEXT_EDITOR_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"STATBOX_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"SWITCH_WIDGET": {
+ "backgroundColor": "{{appsmith.theme.colors.primaryColor}}",
+ "boxShadow": "none"
+ },
+ "SWITCH_GROUP_WIDGET": {
"backgroundColor": "{{appsmith.theme.colors.primaryColor}}"
},
+ "SELECT_WIDGET": {
+ "primaryColor": "{{appsmith.theme.colors.primaryColor}}",
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
+ },
"TABLE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"TABS_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"TEXT_WIDGET": {
},
"VIDEO_WIDGET": {
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"SINGLE_SELECT_TREE_WIDGET": {
"primaryColor": "{{appsmith.theme.colors.primaryColor}}",
- "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
+ "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
+ "fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
+ "boxShadow": "none"
}
},
"properties": {
@@ -745,7 +1065,7 @@
"backgroundColor": "#F6F6F6"
},
"borderRadius": {
- "appBorderRadius": "1rem"
+ "appBorderRadius": "1.5rem"
},
"boxShadow": {
"appBoxShadow": "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"
@@ -755,4 +1075,4 @@
}
}
}
-]
+]
\ No newline at end of file
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/PolicyUtilsTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/PolicyUtilsTest.java
index bb6aec84bb86..896c49624d04 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/PolicyUtilsTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/PolicyUtilsTest.java
@@ -46,7 +46,7 @@ public void updateWithApplicationPermissionsToAllItsCommentThreads_AddPermission
CommentThread commentThread = new CommentThread();
commentThread.setApplicationId(testApplicationId);
Map<String, Policy> commentThreadPolicies = policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.MANAGE_THREAD, AclPermission.COMMENT_ON_THREAD), "api_user"
+ Set.of(AclPermission.MANAGE_THREADS, AclPermission.COMMENT_ON_THREADS), "api_user"
);
commentThread.setPolicies(Set.copyOf(commentThreadPolicies.values()));
Mono<CommentThread> saveThreadMono = commentThreadRepository.save(commentThread);
@@ -54,7 +54,7 @@ public void updateWithApplicationPermissionsToAllItsCommentThreads_AddPermission
// add a new user and update the policies of the new user
String newUserName = "new_test_user";
Map<String, Policy> commentThreadPoliciesForNewUser = policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.COMMENT_ON_THREAD), newUserName
+ Set.of(AclPermission.COMMENT_ON_THREADS), newUserName
);
Flux<CommentThread> updateCommentThreads = policyUtils.updateCommentThreadPermissions(
testApplicationId, commentThreadPoliciesForNewUser, newUserName, true
@@ -64,7 +64,7 @@ public void updateWithApplicationPermissionsToAllItsCommentThreads_AddPermission
Mono<List<CommentThread>> applicationCommentList = saveThreadMono
.thenMany(updateCommentThreads)
.collectList()
- .thenMany(commentThreadRepository.findByApplicationId(testApplicationId, AclPermission.READ_THREAD))
+ .thenMany(commentThreadRepository.findByApplicationId(testApplicationId, AclPermission.READ_THREADS))
.collectList();
StepVerifier.create(applicationCommentList)
@@ -72,12 +72,12 @@ public void updateWithApplicationPermissionsToAllItsCommentThreads_AddPermission
assertThat(commentThreads.size()).isEqualTo(1);
CommentThread commentThread1 = commentThreads.get(0);
Set<Policy> policies = commentThread1.getPolicies();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.MANAGE_THREAD.getValue(), "api_user")).isTrue();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.MANAGE_THREAD.getValue(), newUserName)).isFalse();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.READ_THREAD.getValue(), "api_user")).isTrue();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.READ_THREAD.getValue(), newUserName)).isTrue();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.COMMENT_ON_THREAD.getValue(), "api_user")).isTrue();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.COMMENT_ON_THREAD.getValue(), newUserName)).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.MANAGE_THREADS.getValue(), "api_user")).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.MANAGE_THREADS.getValue(), newUserName)).isFalse();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.READ_THREADS.getValue(), "api_user")).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.READ_THREADS.getValue(), newUserName)).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.COMMENT_ON_THREADS.getValue(), "api_user")).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.COMMENT_ON_THREADS.getValue(), newUserName)).isTrue();
})
.verifyComplete();
}
@@ -100,7 +100,7 @@ public void updateWithApplicationPermissionsToAllItsCommentThreads_RemovePermiss
user2.setEmail(newUserName);
Map<String, Policy> commentThreadPolicies = policyUtils.generatePolicyFromPermissionForMultipleUsers(
- Set.of(AclPermission.MANAGE_THREAD, AclPermission.COMMENT_ON_THREAD), List.of(user1, user2)
+ Set.of(AclPermission.MANAGE_THREADS, AclPermission.COMMENT_ON_THREADS), List.of(user1, user2)
);
commentThread.setPolicies(Set.copyOf(commentThreadPolicies.values()));
@@ -108,7 +108,7 @@ public void updateWithApplicationPermissionsToAllItsCommentThreads_RemovePermiss
// remove an user and update the policies of the user
Map<String, Policy> commentThreadPoliciesForNewUser = policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.MANAGE_THREAD, AclPermission.COMMENT_ON_THREAD), newUserName
+ Set.of(AclPermission.MANAGE_THREADS, AclPermission.COMMENT_ON_THREADS), newUserName
);
Flux<CommentThread> updateCommentThreads = policyUtils.updateCommentThreadPermissions(
testApplicationId, commentThreadPoliciesForNewUser, newUserName, false
@@ -118,7 +118,7 @@ public void updateWithApplicationPermissionsToAllItsCommentThreads_RemovePermiss
Mono<List<CommentThread>> applicationCommentList = saveThreadMono
.thenMany(updateCommentThreads)
.collectList()
- .thenMany(commentThreadRepository.findByApplicationId(testApplicationId, AclPermission.READ_THREAD))
+ .thenMany(commentThreadRepository.findByApplicationId(testApplicationId, AclPermission.READ_THREADS))
.collectList();
StepVerifier.create(applicationCommentList)
@@ -126,12 +126,12 @@ public void updateWithApplicationPermissionsToAllItsCommentThreads_RemovePermiss
assertThat(commentThreads.size()).isEqualTo(1);
CommentThread commentThread1 = commentThreads.get(0);
Set<Policy> policies = commentThread1.getPolicies();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.MANAGE_THREAD.getValue(), "api_user")).isTrue();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.MANAGE_THREAD.getValue(), newUserName)).isFalse();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.READ_THREAD.getValue(), "api_user")).isTrue();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.READ_THREAD.getValue(), newUserName)).isFalse();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.COMMENT_ON_THREAD.getValue(), "api_user")).isTrue();
- assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.COMMENT_ON_THREAD.getValue(), newUserName)).isFalse();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.MANAGE_THREADS.getValue(), "api_user")).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.MANAGE_THREADS.getValue(), newUserName)).isFalse();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.READ_THREADS.getValue(), "api_user")).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.READ_THREADS.getValue(), newUserName)).isFalse();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.COMMENT_ON_THREADS.getValue(), "api_user")).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(policies, AclPermission.COMMENT_ON_THREADS.getValue(), newUserName)).isFalse();
})
.verifyComplete();
}
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomCommentThreadRepositoryImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomCommentThreadRepositoryImplTest.java
index 287e37ad9128..caba6d1e2535 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomCommentThreadRepositoryImplTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomCommentThreadRepositoryImplTest.java
@@ -40,7 +40,7 @@ private CommentThread createThreadWithPolicies(String userEmail) {
User user = new User();
user.setEmail(userEmail);
- Map<String, Policy> policyMap = policyUtils.generatePolicyFromPermission(Set.of(AclPermission.READ_THREAD), user);
+ Map<String, Policy> policyMap = policyUtils.generatePolicyFromPermission(Set.of(AclPermission.READ_THREADS), user);
thread.setPolicies(Set.copyOf(policyMap.values()));
return thread;
}
@@ -54,7 +54,7 @@ private CommentThread createThreadWithAllPermission(String userEmail, String app
user.setEmail(userEmail);
Map<String, Policy> policyMap = policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.MANAGE_THREAD, AclPermission.COMMENT_ON_THREAD), user);
+ Set.of(AclPermission.MANAGE_THREADS, AclPermission.COMMENT_ON_THREADS), user);
HashSet<Policy> policySet = new HashSet<>();
// not using Set.of here because the caller function may need to add more policies
@@ -167,7 +167,7 @@ public void findThread_WhenFilterExists_ReturnsFilteredResults() {
CommentThreadFilterDTO filterDTO = new CommentThreadFilterDTO();
filterDTO.setApplicationId("sample-application-id-1");
filterDTO.setResolved(false);
- return commentThreadRepository.find(filterDTO, AclPermission.READ_THREAD).collectList();
+ return commentThreadRepository.find(filterDTO, AclPermission.READ_THREADS).collectList();
});
StepVerifier.create(listMono).assertNext(
@@ -255,7 +255,7 @@ public void archiveByPageId_WhenCriteriaMatches_ThreadsDeleted() {
Mono<Map<String, Collection<CommentThread>>> pageIdThreadMono = commentThreadRepository.saveAll(threads)
.collectList()
.then(commentThreadRepository.archiveByPageId(pageOneId, ApplicationMode.EDIT))
- .thenMany(commentThreadRepository.findByApplicationId(applicationId, AclPermission.READ_THREAD))
+ .thenMany(commentThreadRepository.findByApplicationId(applicationId, AclPermission.READ_THREADS))
.collectMultimap(CommentThread::getPageId);
StepVerifier.create(pageIdThreadMono)
@@ -282,7 +282,7 @@ public void archiveByPageId_CriteriaDoesNotMatch_ThreadsNotDeleted() {
// add api_user to thread policy with read thread permission
for(Policy policy: thread.getPolicies()) {
- if(policy.getPermission().equals(AclPermission.READ_THREAD.getValue())) {
+ if(policy.getPermission().equals(AclPermission.READ_THREADS.getValue())) {
Set<String> users = new HashSet<>();
users.addAll(policy.getUsers());
users.add("api_user");
@@ -292,7 +292,7 @@ public void archiveByPageId_CriteriaDoesNotMatch_ThreadsNotDeleted() {
Mono<Map<String, Collection<CommentThread>>> pageIdThreadMono = commentThreadRepository.save(thread)
.then(commentThreadRepository.archiveByPageId(testPageId, ApplicationMode.EDIT)) // this will do nothing
- .thenMany(commentThreadRepository.findByApplicationId(applicationId, AclPermission.READ_THREAD))
+ .thenMany(commentThreadRepository.findByApplicationId(applicationId, AclPermission.READ_THREADS))
.collectMultimap(CommentThread::getPageId);
StepVerifier.create(pageIdThreadMono)
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomThemeRepositoryTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomThemeRepositoryTest.java
index 6cb581a57d8b..65d87117a610 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomThemeRepositoryTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/repositories/CustomThemeRepositoryTest.java
@@ -1,6 +1,8 @@
package com.appsmith.server.repositories;
+import com.appsmith.external.models.Policy;
import com.appsmith.server.domains.Theme;
+import com.appsmith.server.helpers.PolicyUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -11,7 +13,10 @@
import reactor.test.StepVerifier;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import static com.appsmith.server.acl.AclPermission.READ_THEMES;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
@@ -21,10 +26,20 @@ public class CustomThemeRepositoryTest {
@Autowired
ThemeRepository themeRepository;
+ @Autowired
+ PolicyUtils policyUtils;
+
@WithUserDetails("api_user")
@Test
public void getSystemThemes_WhenThemesExists_ReturnsSystemThemes() {
- Mono<List<Theme>> systemThemesMono = themeRepository.save(new Theme())
+ String testAppId = "second-app-id";
+ Theme firstAppTheme = new Theme();
+ firstAppTheme.setApplicationId("first-app-id");
+
+ Theme secondAppTheme = new Theme();
+ secondAppTheme.setApplicationId(testAppId);
+
+ Mono<List<Theme>> systemThemesMono = themeRepository.saveAll(List.of(firstAppTheme, secondAppTheme))
.then(themeRepository.getSystemThemes().collectList());
StepVerifier.create(systemThemesMono).assertNext(themes -> {
@@ -32,6 +47,28 @@ public void getSystemThemes_WhenThemesExists_ReturnsSystemThemes() {
}).verifyComplete();
}
+ @WithUserDetails("api_user")
+ @Test
+ public void getApplicationThemes_WhenThemesExists_ReturnsAppThemes() {
+ Map<String, Policy> themePolicies = policyUtils.generatePolicyFromPermission(Set.of(READ_THEMES), "api_user");
+
+ String testAppId = "second-app-id";
+ Theme firstAppTheme = new Theme();
+ firstAppTheme.setApplicationId("first-app-id");
+ firstAppTheme.setPolicies(Set.of(themePolicies.get(READ_THEMES.getValue())));
+
+ Theme secondAppTheme = new Theme();
+ secondAppTheme.setApplicationId(testAppId);
+ secondAppTheme.setPolicies(Set.of(themePolicies.get(READ_THEMES.getValue())));
+
+ Mono<List<Theme>> systemThemesMono = themeRepository.saveAll(List.of(firstAppTheme, secondAppTheme))
+ .then(themeRepository.getApplicationThemes(testAppId, READ_THEMES).collectList());
+
+ StepVerifier.create(systemThemesMono).assertNext(themes -> {
+ assertThat(themes.size()).isEqualTo(5); // 4 system themes were created from db migration
+ }).verifyComplete();
+ }
+
@WithUserDetails("api_user")
@Test
public void getSystemThemeByName_WhenNameMatches_ReturnsTheme() {
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java
index 502f9f0d2b07..f5cb22fdbf97 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java
@@ -21,6 +21,7 @@
import com.appsmith.server.domains.Organization;
import com.appsmith.server.domains.Plugin;
import com.appsmith.server.domains.PluginType;
+import com.appsmith.server.domains.Theme;
import com.appsmith.server.domains.User;
import com.appsmith.server.dtos.ActionCollectionDTO;
import com.appsmith.server.dtos.ActionDTO;
@@ -82,6 +83,7 @@
import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.MANAGE_DATASOURCES;
import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
+import static com.appsmith.server.acl.AclPermission.MANAGE_THEMES;
import static com.appsmith.server.acl.AclPermission.READ_ACTIONS;
import static com.appsmith.server.acl.AclPermission.READ_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.READ_DATASOURCES;
@@ -2252,4 +2254,42 @@ public void deleteApplication_WithDeployKeysNotConnectedToRemote_Success() {
.verifyComplete();
}
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void cloneApplication_WithCustomSavedTheme_ThemesAlsoCopied() {
+ Application testApplication = new Application();
+ String appName = "cloneApplication_WithCustomSavedTheme_ThemesAlsoCopied";
+ testApplication.setName(appName);
+
+ Theme theme = new Theme();
+ theme.setName("Custom theme");
+
+ Mono<Theme> createTheme = themeService.create(theme);
+
+ Mono<Tuple2<Theme, Tuple2<Application, Application>>> tuple2Application = createTheme
+ .then(applicationPageService.createApplication(testApplication, orgId))
+ .flatMap(application ->
+ themeService.updateTheme(application.getId(), theme).then(
+ themeService.persistCurrentTheme(application.getId(), new Theme())
+ .flatMap(theme1 -> Mono.zip(
+ applicationPageService.cloneApplication(application.getId(), null),
+ Mono.just(application))
+ )
+ )
+ ).flatMap(objects ->
+ themeService.getThemeById(objects.getT1().getEditModeThemeId(), MANAGE_THEMES)
+ .zipWith(Mono.just(objects))
+ );
+
+ StepVerifier.create(tuple2Application)
+ .assertNext(objects -> {
+ Theme clonedTheme = objects.getT1();
+ Application clonedApp = objects.getT2().getT1();
+ Application srcApp = objects.getT2().getT2();
+ assertThat(clonedApp.getEditModeThemeId()).isNotEqualTo(srcApp.getEditModeThemeId());
+ assertThat(clonedTheme.getApplicationId()).isNull();
+ assertThat(clonedTheme.getOrganizationId()).isNull();
+ })
+ .verifyComplete();
+ }
}
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CommentServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CommentServiceTest.java
index 5bb5908ae287..b68d8b071410 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CommentServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CommentServiceTest.java
@@ -141,15 +141,15 @@ public void setup() {
assertThat(thread.getId()).isNotEmpty();
//assertThat(thread.getResolved()).isNull();
assertThat(thread.getPolicies()).containsExactlyInAnyOrder(
- Policy.builder().permission(AclPermission.READ_THREAD.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build(),
- Policy.builder().permission(AclPermission.MANAGE_THREAD.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build(),
- Policy.builder().permission(AclPermission.COMMENT_ON_THREAD.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build()
+ Policy.builder().permission(AclPermission.READ_THREADS.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build(),
+ Policy.builder().permission(AclPermission.MANAGE_THREADS.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build(),
+ Policy.builder().permission(AclPermission.COMMENT_ON_THREADS.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build()
);
assertThat(thread.getComments()).hasSize(2); // one comment is from bot
assertThat(thread.getComments().get(0).getBody()).isEqualTo(makePlainTextComment("comment one").getBody());
assertThat(thread.getComments().get(0).getPolicies()).containsExactlyInAnyOrder(
- Policy.builder().permission(AclPermission.MANAGE_COMMENT.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build(),
- Policy.builder().permission(AclPermission.READ_COMMENT.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build()
+ Policy.builder().permission(AclPermission.MANAGE_COMMENTS.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build(),
+ Policy.builder().permission(AclPermission.READ_COMMENTS.getValue()).users(Set.of("api_user")).groups(Collections.emptySet()).build()
);
assertThat(threadsInApp).hasSize(1);
@@ -325,7 +325,7 @@ public void getUnreadCount() {
User user = new User();
user.setEmail("api_user");
Map<String, Policy> stringPolicyMap = policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.READ_THREAD),
+ Set.of(AclPermission.READ_THREADS),
user
);
Set<Policy> policies = Set.copyOf(stringPolicyMap.values());
@@ -369,7 +369,7 @@ public void getUnreadCount() {
public void create_WhenThreadIsResolvedAndAlreadyViewed_ThreadIsUnresolvedAndUnread() {
// create a thread first with resolved=true
Collection<Policy> threadPolicies = policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.COMMENT_ON_THREAD),
+ Set.of(AclPermission.COMMENT_ON_THREADS),
"api_user"
).values();
@@ -587,7 +587,7 @@ public void create_WhenUserHasProfilePhoto_PhotoIdIsSetToComment() {
// create a thread first with resolved=true
Collection<Policy> threadPolicies = policyUtils.generatePolicyFromPermission(
- Set.of(AclPermission.COMMENT_ON_THREAD),
+ Set.of(AclPermission.COMMENT_ON_THREADS),
"api_user"
).values();
CommentThread commentThread = new CommentThread();
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ThemeServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ThemeServiceTest.java
index 29424b4d0d93..06a74df0bd2b 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ThemeServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ThemeServiceTest.java
@@ -2,13 +2,15 @@
import com.appsmith.external.models.Policy;
import com.appsmith.server.acl.AclPermission;
+import com.appsmith.server.constants.FieldName;
import com.appsmith.server.domains.Application;
import com.appsmith.server.domains.ApplicationMode;
import com.appsmith.server.domains.Theme;
+import com.appsmith.server.dtos.ApplicationAccessDTO;
+import com.appsmith.server.exceptions.AppsmithError;
import com.appsmith.server.exceptions.AppsmithException;
import com.appsmith.server.helpers.PolicyUtils;
import com.appsmith.server.repositories.ApplicationRepository;
-import com.appsmith.server.repositories.ThemeRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -19,12 +21,17 @@
import reactor.test.StepVerifier;
import reactor.util.function.Tuple2;
import reactor.util.function.Tuple3;
+import reactor.util.function.Tuples;
import java.util.Collection;
+import java.util.List;
import java.util.Set;
import java.util.UUID;
+import static com.appsmith.server.acl.AclPermission.MAKE_PUBLIC_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS;
+import static com.appsmith.server.acl.AclPermission.MANAGE_THEMES;
+import static com.appsmith.server.acl.AclPermission.READ_THEMES;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
@@ -38,7 +45,7 @@ public class ThemeServiceTest {
ApplicationRepository applicationRepository;
@Autowired
- ThemeRepository themeRepository;
+ ApplicationService applicationService;
@Autowired
private ThemeService themeService;
@@ -55,20 +62,20 @@ private Application createApplication(String username, Set<AclPermission> permis
@WithUserDetails("api_user")
@Test
public void getApplicationTheme_WhenThemeIsSet_ThemesReturned() {
- Mono<Tuple2<Theme, Theme>> applicationThemesMono = themeRepository.getSystemThemeByName("Classic")
- .zipWith(themeRepository.getSystemThemeByName("Sharp"))
+ Mono<Tuple2<Theme, Theme>> applicationThemesMono = themeService.getSystemTheme("Classic")
+ .zipWith(themeService.getSystemTheme("Sharp"))
.flatMap(themesTuple -> {
Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
application.setEditModeThemeId(themesTuple.getT1().getId());
application.setPublishedModeThemeId(themesTuple.getT2().getId());
return applicationRepository.save(application);
})
- .flatMap(application -> {
- return Mono.zip(
- themeService.getApplicationTheme(application.getId(), ApplicationMode.EDIT),
- themeService.getApplicationTheme(application.getId(), ApplicationMode.PUBLISHED)
- );
- });
+ .flatMap(application ->
+ Mono.zip(
+ themeService.getApplicationTheme(application.getId(), ApplicationMode.EDIT),
+ themeService.getApplicationTheme(application.getId(), ApplicationMode.PUBLISHED)
+ )
+ );
StepVerifier.create(applicationThemesMono)
.assertNext(themesTuple -> {
@@ -82,20 +89,18 @@ public void getApplicationTheme_WhenThemeIsSet_ThemesReturned() {
@WithUserDetails("api_user")
@Test
public void getApplicationTheme_WhenUserHasNoPermission_ExceptionThrows() {
- Mono<Tuple2<Theme, Theme>> applicationThemesMono = themeRepository.getSystemThemeByName("Classic")
- .zipWith(themeRepository.getSystemThemeByName("Sharp"))
+ Mono<Tuple2<Theme, Theme>> applicationThemesMono = themeService.getSystemTheme("Classic")
+ .zipWith(themeService.getSystemTheme("Sharp"))
.flatMap(themesTuple -> {
Application application = createApplication("random_user", Set.of(MANAGE_APPLICATIONS));
application.setEditModeThemeId(themesTuple.getT1().getId());
application.setPublishedModeThemeId(themesTuple.getT2().getId());
return applicationRepository.save(application);
})
- .flatMap(application -> {
- return Mono.zip(
- themeService.getApplicationTheme(application.getId(), ApplicationMode.EDIT),
- themeService.getApplicationTheme(application.getId(), ApplicationMode.PUBLISHED)
- );
- });
+ .flatMap(application -> Mono.zip(
+ themeService.getApplicationTheme(application.getId(), ApplicationMode.EDIT),
+ themeService.getApplicationTheme(application.getId(), ApplicationMode.PUBLISHED)
+ ));
StepVerifier.create(applicationThemesMono)
.expectError(AppsmithException.class)
@@ -105,7 +110,7 @@ public void getApplicationTheme_WhenUserHasNoPermission_ExceptionThrows() {
@WithUserDetails("api_user")
@Test
public void changeCurrentTheme_WhenUserHasPermission_ThemesSetInEditMode() {
- Mono<Tuple2<Application, Application>> tuple2Mono = themeRepository.getSystemThemeByName("Classic")
+ Mono<Tuple2<Application, Application>> tuple2Mono = themeService.getSystemTheme("Classic")
.flatMap(theme -> {
Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
application.setEditModeThemeId(theme.getId());
@@ -113,7 +118,7 @@ public void changeCurrentTheme_WhenUserHasPermission_ThemesSetInEditMode() {
// setting classic theme to edit mode and published mode
return applicationRepository.save(application);
})
- .zipWith(themeRepository.getSystemThemeByName("Rounded"))
+ .zipWith(themeService.getSystemTheme("Rounded"))
.flatMap(tuple -> {
Application application = tuple.getT1();
Theme theme = tuple.getT2();
@@ -141,7 +146,7 @@ public void changeCurrentTheme_WhenUserHasPermission_ThemesSetInEditMode() {
@WithUserDetails("api_user")
@Test
public void changeCurrentTheme_WhenUserHasNoPermission_ThrowsException() {
- Mono<Theme> themeMono = themeRepository.getSystemThemeByName("Classic")
+ Mono<Theme> themeMono = themeService.getSystemTheme("Classic")
.flatMap(theme -> {
Application application = createApplication("some_other_user", Set.of(MANAGE_APPLICATIONS));
application.setEditModeThemeId(theme.getId());
@@ -157,16 +162,84 @@ public void changeCurrentTheme_WhenUserHasNoPermission_ThrowsException() {
StepVerifier.create(themeMono).expectError(AppsmithException.class).verify();
}
+ @WithUserDetails("api_user")
+ @Test
+ public void changeCurrentTheme_WhenSystemThemeSet_NoNewThemeCreated() {
+ Mono<String> defaultThemeIdMono = themeService.getDefaultThemeId().cache();
+
+ Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+ application.setOrganizationId("theme-test-org-id");
+ Mono<Theme> applicationThemeMono = defaultThemeIdMono
+ .flatMap(defaultThemeId -> {
+ application.setEditModeThemeId(defaultThemeId);
+ return applicationRepository.save(application);
+ })
+ .flatMap(savedApplication ->
+ defaultThemeIdMono.flatMap(themeId ->
+ themeService.changeCurrentTheme(themeId, savedApplication.getId())
+ .then(themeService.getApplicationTheme(savedApplication.getId(), ApplicationMode.EDIT))
+ )
+ );
+
+ StepVerifier.create(applicationThemeMono).assertNext(theme -> {
+ assertThat(theme.isSystemTheme()).isTrue();
+ assertThat(theme.getApplicationId()).isNull();
+ assertThat(theme.getOrganizationId()).isNull();
+ }).verifyComplete();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void changeCurrentTheme_WhenSystemThemeSetOverCustomTheme_NewThemeNotCreatedAndOldOneDeleted() {
+ Collection<Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(MANAGE_THEMES), "api_user"
+ ).values();
+
+ Theme customTheme = new Theme();
+ customTheme.setName("my-custom-theme");
+ customTheme.setPolicies(Set.copyOf(themePolicies));
+
+ Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+ application.setOrganizationId("theme-test-org-id");
+
+ Mono<Tuple2<Theme, Theme>> tuple2Mono = themeService.save(customTheme)
+ .flatMap(savedTheme -> {
+ application.setEditModeThemeId(savedTheme.getId());
+ return applicationRepository.save(application);
+ })
+ .flatMap(savedApplication ->
+ themeService.getDefaultThemeId()
+ .flatMap(themeId -> themeService.changeCurrentTheme(themeId, savedApplication.getId()))
+ .thenReturn(savedApplication)
+ ).flatMap(application1 ->
+ // get old theme and new
+ Mono.zip(
+ themeService.getApplicationTheme(application1.getId(), ApplicationMode.EDIT),
+ themeService.getThemeById(application1.getEditModeThemeId(), READ_THEMES)
+ .defaultIfEmpty(new Theme()) // this should be deleted, return empty theme
+ )
+ );
+
+ StepVerifier.create(tuple2Mono).assertNext(themeTuple2 -> {
+ Theme currentTheme = themeTuple2.getT1();
+ Theme oldTheme = themeTuple2.getT2();
+ assertThat(currentTheme.isSystemTheme()).isTrue();
+ assertThat(currentTheme.getApplicationId()).isNull();
+ assertThat(currentTheme.getOrganizationId()).isNull();
+ assertThat(oldTheme.getId()).isNull();
+ }).verifyComplete();
+ }
+
@WithUserDetails("api_user")
@Test
public void cloneThemeToApplication_WhenSrcThemeIsSystemTheme_NoNewThemeCreated() {
Application newApplication = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
Mono<Tuple2<Theme, Theme>> newAndOldThemeMono = applicationRepository.save(newApplication)
- .zipWith(themeRepository.getSystemThemeByName("Classic"))
+ .zipWith(themeService.getSystemTheme("Classic"))
.flatMap(applicationAndTheme -> {
Theme theme = applicationAndTheme.getT2();
Application application = applicationAndTheme.getT1();
- return themeService.cloneThemeToApplication(theme.getId(), application.getId()).zipWith(Mono.just(theme));
+ return themeService.cloneThemeToApplication(theme.getId(), application).zipWith(Mono.just(theme));
});
StepVerifier.create(newAndOldThemeMono)
@@ -182,13 +255,16 @@ public void cloneThemeToApplication_WhenSrcThemeIsCustomTheme_NewThemeCreated()
Application newApplication = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
Theme customTheme = new Theme();
customTheme.setName("custom theme");
+ customTheme.setPolicies(Set.copyOf(
+ policyUtils.generatePolicyFromPermission(Set.of(MANAGE_THEMES), "api_user").values()
+ ));
Mono<Tuple2<Theme, Theme>> newAndOldThemeMono = applicationRepository.save(newApplication)
- .zipWith(themeRepository.save(customTheme))
+ .zipWith(themeService.save(customTheme))
.flatMap(applicationAndTheme -> {
Theme theme = applicationAndTheme.getT2();
Application application = applicationAndTheme.getT1();
- return themeService.cloneThemeToApplication(theme.getId(), application.getId()).zipWith(Mono.just(theme));
+ return themeService.cloneThemeToApplication(theme.getId(), application).zipWith(Mono.just(theme));
});
StepVerifier.create(newAndOldThemeMono)
@@ -199,14 +275,57 @@ public void cloneThemeToApplication_WhenSrcThemeIsCustomTheme_NewThemeCreated()
.verifyComplete();
}
+ @WithUserDetails("api_user")
+ @Test
+ public void cloneThemeToApplication_WhenSrcThemeIsCustomSavedTheme_NewCustomThemeCreated() {
+ Application srcApplication = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+
+ Mono<Tuple2<Theme, Theme>> newAndOldThemeMono = applicationRepository.save(srcApplication)
+ .flatMap(application -> {
+ Theme srcCustomTheme = new Theme();
+ srcCustomTheme.setName("custom theme");
+ srcCustomTheme.setApplicationId(application.getId());
+ srcCustomTheme.setPolicies(Set.copyOf(
+ policyUtils.generatePolicyFromPermission(Set.of(MANAGE_THEMES), "api_user").values()
+ ));
+ return themeService.save(srcCustomTheme);
+ })
+ .zipWith(applicationRepository.save(createApplication("api_user", Set.of(MANAGE_APPLICATIONS))))
+ .flatMap(objects -> {
+ Theme srcTheme = objects.getT1();
+ Application destApp = objects.getT2();
+ return Mono.zip(
+ themeService.cloneThemeToApplication(srcTheme.getId(), destApp),
+ Mono.just(srcTheme)
+ );
+ });
+
+ StepVerifier.create(newAndOldThemeMono)
+ .assertNext(objects -> {
+ Theme clonnedTheme = objects.getT1();
+ Theme srcTheme = objects.getT2();
+
+ assertThat(clonnedTheme.getId()).isNotEqualTo(srcTheme.getId());
+ assertThat(clonnedTheme.getName()).isEqualTo(srcTheme.getName());
+ assertThat(clonnedTheme.getApplicationId()).isNull();
+ assertThat(clonnedTheme.getOrganizationId()).isNull();
+ })
+ .verifyComplete();
+ }
+
@WithUserDetails("api_user")
@Test
public void getApplicationTheme_WhenUserHasPermission_ThemeReturned() {
+ Collection<Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(MANAGE_THEMES), "api_user"
+ ).values();
+
Theme customTheme = new Theme();
customTheme.setName("custom theme for edit mode");
+ customTheme.setPolicies(Set.copyOf(themePolicies));
- Mono<Tuple2<Theme, Theme>> applicationThemesMono = themeRepository.save(customTheme)
- .zipWith(themeRepository.getSystemThemeByName("classic"))
+ Mono<Tuple2<Theme, Theme>> applicationThemesMono = themeService.save(customTheme)
+ .zipWith(themeService.getSystemTheme("classic"))
.flatMap(themes -> {
Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
application.setEditModeThemeId(themes.getT1().getId());
@@ -230,7 +349,7 @@ public void getApplicationTheme_WhenUserHasPermission_ThemeReturned() {
@WithUserDetails("api_user")
@Test
public void publishTheme_WhenSystemThemeIsSet_NoNewThemeCreated() {
- Mono<Theme> classicThemeMono = themeRepository.getSystemThemeByName("classic").cache();
+ Mono<Theme> classicThemeMono = themeService.getSystemTheme("classic").cache();
Mono<Tuple2<Application, Theme>> appAndThemeTuple = classicThemeMono
.flatMap(theme -> {
@@ -239,9 +358,8 @@ public void publishTheme_WhenSystemThemeIsSet_NoNewThemeCreated() {
application.setPublishedModeThemeId("this-id-should-be-overridden");
return applicationRepository.save(application);
}).flatMap(savedApplication ->
- themeService.publishTheme(savedApplication.getEditModeThemeId(),
- savedApplication.getPublishedModeThemeId(), savedApplication.getId()
- ).then(applicationRepository.findById(savedApplication.getId()))
+ themeService.publishTheme(savedApplication.getId())
+ .then(applicationRepository.findById(savedApplication.getId()))
)
.zipWith(classicThemeMono);
@@ -254,23 +372,53 @@ public void publishTheme_WhenSystemThemeIsSet_NoNewThemeCreated() {
}).verifyComplete();
}
+ @WithUserDetails("api_user")
+ @Test
+ public void publishTheme_WhenSystemThemeInEditModeAndCustomThemeInPublishedMode_PublisedCopyDeleted() {
+ Mono<Theme> classicThemeMono = themeService.getSystemTheme("classic").cache();
+
+ Theme customTheme = new Theme();
+ customTheme.setName("published-theme-copy");
+ Mono<Theme> publishedCustomThemeMono = themeService.save(customTheme);
+
+ Mono<Theme> deletedThemeMono = classicThemeMono
+ .zipWith(publishedCustomThemeMono)
+ .flatMap(themesTuple -> {
+ Theme systemTheme = themesTuple.getT1();
+ Theme savedCustomTheme = themesTuple.getT2();
+ Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+ application.setEditModeThemeId(systemTheme.getId());
+ application.setPublishedModeThemeId(savedCustomTheme.getId());
+ return applicationRepository.save(application);
+ }).flatMap(savedApplication ->
+ themeService.publishTheme(savedApplication.getId())
+ .then(themeService.getThemeById(savedApplication.getPublishedModeThemeId(), READ_THEMES))
+ );
+
+ StepVerifier.create(deletedThemeMono)
+ .verifyComplete();
+ }
+
@WithUserDetails("api_user")
@Test
public void publishTheme_WhenCustomThemeIsSet_ThemeCopiedForPublishedMode() {
+ Collection<Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(MANAGE_THEMES), "api_user"
+ ).values();
+
Theme customTheme = new Theme();
customTheme.setName("my-custom-theme");
+ customTheme.setPolicies(Set.copyOf(themePolicies));
- Mono<Tuple2<Theme, Theme>> appThemesMono = themeRepository.save(customTheme)
- .zipWith(themeRepository.getSystemThemeByName("classic"))
+ Mono<Tuple2<Theme, Theme>> appThemesMono = themeService.save(customTheme)
+ .zipWith(themeService.getSystemTheme("classic"))
.flatMap(themes -> {
Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
application.setEditModeThemeId(themes.getT1().getId()); // custom theme
application.setPublishedModeThemeId(themes.getT2().getId()); // system theme
return applicationRepository.save(application);
}).flatMap(application ->
- themeService.publishTheme(application.getEditModeThemeId(),
- application.getPublishedModeThemeId(), application.getId()
- ).then(Mono.zip(
+ themeService.publishTheme(application.getId()).then(Mono.zip(
themeService.getApplicationTheme(application.getId(), ApplicationMode.EDIT),
themeService.getApplicationTheme(application.getId(), ApplicationMode.PUBLISHED)
))
@@ -291,7 +439,7 @@ public void updateTheme_WhenSystemThemeIsSet_NewThemeCreated() {
Theme customTheme = new Theme();
customTheme.setName("My custom theme");
- Mono<Tuple2<Theme, Theme>> appThemesMono = themeRepository.getSystemThemeByName("classic")
+ Mono<Tuple2<Theme, Theme>> appThemesMono = themeService.getSystemTheme("classic")
.flatMap(theme -> {
Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
application.setEditModeThemeId(theme.getId()); // system theme
@@ -319,12 +467,17 @@ public void updateTheme_WhenSystemThemeIsSet_NewThemeCreated() {
@WithUserDetails("api_user")
@Test
public void updateTheme_WhenCustomThemeIsSet_ThemeIsOverridden() {
+ Collection<Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(MANAGE_THEMES), "api_user"
+ ).values();
Theme customTheme = new Theme();
customTheme.setName("My custom theme");
- Mono<Theme> saveCustomThemeMono = themeRepository.save(customTheme);
+ customTheme.setPolicies(Set.copyOf(themePolicies));
+
+ Mono<Theme> saveCustomThemeMono = themeService.save(customTheme);
Mono<Tuple3<Theme, Theme, Application>> appThemesMono = saveCustomThemeMono
- .zipWith(themeRepository.getSystemThemeByName("classic"))
+ .zipWith(themeService.getSystemTheme("classic"))
.flatMap(themes -> {
Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
application.setEditModeThemeId(themes.getT1().getId()); // custom theme
@@ -361,15 +514,14 @@ public void updateTheme_WhenCustomThemeIsSet_ThemeIsOverridden() {
@WithUserDetails("api_user")
@Test
public void publishTheme_WhenNoThemeIsSet_SystemDefaultThemeIsSetToPublishedMode() {
- Mono<Theme> classicThemeMono = themeRepository.getSystemThemeByName(Theme.LEGACY_THEME_NAME);
+ Mono<Theme> classicThemeMono = themeService.getSystemTheme(Theme.LEGACY_THEME_NAME);
Mono<Tuple2<Application, Theme>> appAndThemeTuple = applicationRepository.save(
createApplication("api_user", Set.of(MANAGE_APPLICATIONS))
)
.flatMap(savedApplication ->
- themeService.publishTheme(savedApplication.getEditModeThemeId(),
- savedApplication.getPublishedModeThemeId(), savedApplication.getId()
- ).then(applicationRepository.findById(savedApplication.getId()))
+ themeService.publishTheme(savedApplication.getId())
+ .then(applicationRepository.findById(savedApplication.getId()))
)
.zipWith(classicThemeMono);
@@ -380,4 +532,214 @@ public void publishTheme_WhenNoThemeIsSet_SystemDefaultThemeIsSetToPublishedMode
assertThat(application.getPublishedModeThemeId()).isEqualTo(classicSystemTheme.getId());
}).verifyComplete();
}
+
+ @WithUserDetails("api_user")
+ @Test
+ public void publishTheme_WhenApplicationIsPublic_PublishedThemeIsPublic() {
+ Collection<Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(MANAGE_THEMES), "api_user"
+ ).values();
+
+ Theme customTheme = new Theme();
+ customTheme.setName("my-custom-theme");
+ customTheme.setPolicies(Set.copyOf(themePolicies));
+
+ Mono<Theme> appThemesMono = themeService.save(customTheme)
+ .zipWith(themeService.getSystemTheme("classic"))
+ .flatMap(themes -> {
+ Application application = createApplication("api_user",
+ Set.of(MAKE_PUBLIC_APPLICATIONS, MANAGE_APPLICATIONS));
+ application.setEditModeThemeId(themes.getT1().getId()); // custom theme
+ application.setPublishedModeThemeId(themes.getT2().getId()); // system theme
+ return applicationRepository.save(application);
+ })
+ .flatMap(application -> {
+ // make the application public
+ ApplicationAccessDTO accessDTO = new ApplicationAccessDTO();
+ accessDTO.setPublicAccess(true);
+ return applicationService.changeViewAccess(application.getId(), accessDTO);
+ })
+ .flatMap(application ->
+ themeService.publishTheme(application.getId()).then(
+ themeService.getApplicationTheme(application.getId(), ApplicationMode.PUBLISHED)
+ )
+ );
+
+ StepVerifier.create(appThemesMono)
+ .assertNext(publishedModeTheme -> {
+ Boolean permissionPresentForAnonymousUser = policyUtils.isPermissionPresentForUser(
+ publishedModeTheme.getPolicies(), READ_THEMES.getValue(), FieldName.ANONYMOUS_USER
+ );
+ assertThat(permissionPresentForAnonymousUser).isTrue();
+ }).verifyComplete();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void persistCurrentTheme_WhenCustomThemeIsSet_NewApplicationThemeCreated() {
+ Collection<Policy> themePolicies = policyUtils.generatePolicyFromPermission(
+ Set.of(MANAGE_THEMES), "api_user"
+ ).values();
+
+ Theme customTheme = new Theme();
+ customTheme.setName("Classic");
+ customTheme.setPolicies(Set.copyOf(themePolicies));
+
+ Mono<Tuple3<List<Theme>, Theme, Application>> tuple3Mono = themeService.save(customTheme).flatMap(theme -> {
+ Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+ application.setEditModeThemeId(theme.getId());
+ application.setOrganizationId("theme-test-org-id");
+ return applicationRepository.save(application);
+ }).flatMap(application -> {
+ Theme theme = new Theme();
+ theme.setName("My custom theme");
+ return themeService.persistCurrentTheme(application.getId(), theme)
+ .map(theme1 -> Tuples.of(theme1, application));
+ }).flatMap(persistedThemeAndApp ->
+ themeService.getApplicationThemes(persistedThemeAndApp.getT2().getId()).collectList()
+ .map(themes -> Tuples.of(themes, persistedThemeAndApp.getT1(), persistedThemeAndApp.getT2()))
+ );
+
+ StepVerifier.create(tuple3Mono).assertNext(tuple3 -> {
+ List<Theme> availableThemes = tuple3.getT1();
+ Theme persistedTheme = tuple3.getT2();
+ Application application = tuple3.getT3();
+ assertThat(availableThemes.size()).isEqualTo(5); // one custom theme + 4 system themes
+ assertThat(persistedTheme.getApplicationId()).isNotEmpty(); // theme should have application id set
+ assertThat(persistedTheme.getOrganizationId()).isEqualTo("theme-test-org-id"); // theme should have org id set
+ assertThat(policyUtils.isPermissionPresentForUser(
+ persistedTheme.getPolicies(), READ_THEMES.getValue(), "api_user")
+ ).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(
+ persistedTheme.getPolicies(), MANAGE_THEMES.getValue(), "api_user")
+ ).isTrue();
+ assertThat(application.getEditModeThemeId()).isNotEqualTo(persistedTheme.getId()); // a new copy should be created
+ }).verifyComplete();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void persistCurrentTheme_WhenSystemThemeIsSet_NewApplicationThemeCreated() {
+ Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+ application.setOrganizationId("theme-test-org-id");
+ Mono<Tuple2<List<Theme>, Theme>> tuple2Mono = themeService.getDefaultThemeId()
+ .flatMap(defaultThemeId -> {
+ application.setEditModeThemeId(defaultThemeId);
+ return applicationRepository.save(application);
+ })
+ .flatMap(savedApplication -> {
+ Theme theme = new Theme();
+ theme.setName("My custom theme");
+ return themeService.persistCurrentTheme(savedApplication.getId(), theme)
+ .map(theme1 -> Tuples.of(theme1, savedApplication.getId()));
+ }).flatMap(persistedThemeAndAppId ->
+ themeService.getApplicationThemes(persistedThemeAndAppId.getT2()).collectList()
+ .map(themes -> Tuples.of(themes, persistedThemeAndAppId.getT1()))
+ );
+
+ StepVerifier.create(tuple2Mono).assertNext(tuple2 -> {
+ List<Theme> availableThemes = tuple2.getT1();
+ Theme currentTheme = tuple2.getT2();
+ assertThat(availableThemes.size()).isEqualTo(5); // one custom theme + 4 system themes
+ assertThat(currentTheme.isSystemTheme()).isFalse();
+ assertThat(currentTheme.getApplicationId()).isNotEmpty(); // theme should have application id set
+ assertThat(currentTheme.getOrganizationId()).isEqualTo("theme-test-org-id"); // theme should have org id set
+ assertThat(policyUtils.isPermissionPresentForUser(currentTheme.getPolicies(), READ_THEMES.getValue(), "api_user")).isTrue();
+ assertThat(policyUtils.isPermissionPresentForUser(currentTheme.getPolicies(), MANAGE_THEMES.getValue(), "api_user")).isTrue();
+ }).verifyComplete();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void delete_WhenSystemTheme_NotAllowed() {
+ StepVerifier.create(themeService.getDefaultThemeId().flatMap(themeService::delete))
+ .expectError(AppsmithException.class)
+ .verify();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void delete_WhenUnsavedCustomizedTheme_NotAllowed() {
+ Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+
+ Mono<Theme> deleteThemeMono = themeService.getDefaultThemeId()
+ .flatMap(s -> {
+ application.setEditModeThemeId(s);
+ return applicationRepository.save(application);
+ })
+ .flatMap(savedApplication -> {
+ Theme themeCustomization = new Theme();
+ themeCustomization.setName("Updated name");
+ return themeService.updateTheme(savedApplication.getId(), themeCustomization);
+ }).flatMap(customizedTheme -> themeService.delete(customizedTheme.getId()));
+
+ StepVerifier.create(deleteThemeMono)
+ .expectErrorMessage(AppsmithError.UNSUPPORTED_OPERATION.getMessage())
+ .verify();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void delete_WhenSavedCustomizedTheme_ThemeIsDeleted() {
+ Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+
+ Mono<Theme> deleteThemeMono = themeService.getDefaultThemeId()
+ .flatMap(s -> {
+ application.setEditModeThemeId(s);
+ return applicationRepository.save(application);
+ })
+ .flatMap(savedApplication -> {
+ Theme themeCustomization = new Theme();
+ themeCustomization.setName("Updated name");
+ return themeService.persistCurrentTheme(savedApplication.getId(), themeCustomization);
+ })
+ .flatMap(customizedTheme -> themeService.delete(customizedTheme.getId())
+ .then(themeService.getThemeById(customizedTheme.getId(), READ_THEMES)));
+
+ StepVerifier.create(deleteThemeMono).verifyComplete();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void updateName_WhenSystemTheme_NotAllowed() {
+ Mono<Theme> updateThemeNameMono = themeService.getDefaultThemeId().flatMap(themeId -> {
+ Theme theme = new Theme();
+ theme.setName("My theme");
+ return themeService.updateName(themeId, theme);
+ });
+ StepVerifier.create(updateThemeNameMono).expectError(AppsmithException.class).verify();
+ }
+
+ @WithUserDetails("api_user")
+ @Test
+ public void updateName_WhenCustomTheme_NameUpdated() {
+ Application application = createApplication("api_user", Set.of(MANAGE_APPLICATIONS));
+ application.setOrganizationId("test-org");
+
+ Mono<Theme> updateThemeNameMono = themeService.getDefaultThemeId()
+ .flatMap(s -> {
+ application.setEditModeThemeId(s);
+ return applicationRepository.save(application);
+ })
+ .flatMap(savedApplication -> {
+ Theme themeCustomization = new Theme();
+ themeCustomization.setName("old name");
+ return themeService.persistCurrentTheme(savedApplication.getId(), themeCustomization);
+ })
+ .flatMap(customizedTheme -> {
+ Theme theme = new Theme();
+ theme.setName("new name");
+ return themeService.updateName(customizedTheme.getId(), theme)
+ .then(themeService.getThemeById(customizedTheme.getId(), READ_THEMES));
+ });
+
+ StepVerifier.create(updateThemeNameMono).assertNext(theme -> {
+ assertThat(theme.getName()).isEqualTo("new name");
+ assertThat(theme.isSystemTheme()).isFalse();
+ assertThat(theme.getApplicationId()).isNotNull();
+ assertThat(theme.getOrganizationId()).isEqualTo("test-org");
+ assertThat(theme.getConfig()).isNotNull();
+ }).verifyComplete();
+ }
+
}
\ No newline at end of file
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserOrganizationServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserOrganizationServiceTest.java
index 408976913e15..09a5bbd63334 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserOrganizationServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserOrganizationServiceTest.java
@@ -277,10 +277,10 @@ public void updateRoleForMember_WhenCommentThreadExists_ThreadPoliciesUnchanged(
StepVerifier.create(commentThreadMono).assertNext(commentThread -> {
Set<Policy> policies = commentThread.getPolicies();
assertThat(policyUtils.isPermissionPresentForUser(
- policies, AclPermission.READ_THREAD.getValue(), "test_developer"
+ policies, AclPermission.READ_THREADS.getValue(), "test_developer"
)).isTrue();
assertThat(policyUtils.isPermissionPresentForUser(
- policies, AclPermission.READ_THREAD.getValue(), "api_user"
+ policies, AclPermission.READ_THREADS.getValue(), "api_user"
)).isTrue();
}).verifyComplete();
}
@@ -308,10 +308,10 @@ public void updateRoleForMember_WhenCommentThreadExistsAndUserRemoved_UserRemove
StepVerifier.create(commentThreadMono).assertNext(commentThread -> {
Set<Policy> policies = commentThread.getPolicies();
assertThat(policyUtils.isPermissionPresentForUser(
- policies, AclPermission.READ_THREAD.getValue(), "test_developer"
+ policies, AclPermission.READ_THREADS.getValue(), "test_developer"
)).isFalse();
assertThat(policyUtils.isPermissionPresentForUser(
- policies, AclPermission.READ_THREAD.getValue(), "api_user"
+ policies, AclPermission.READ_THREADS.getValue(), "api_user"
)).isTrue();
}).verifyComplete();
}
@@ -346,13 +346,13 @@ public void bulkAddUsersToOrganization_WhenNewUserAdded_ThreadPolicyUpdated() {
StepVerifier.create(saveUserMono.then(commentThreadMono)).assertNext(commentThread -> {
Set<Policy> policies = commentThread.getPolicies();
assertThat(policyUtils.isPermissionPresentForUser(
- policies, AclPermission.READ_THREAD.getValue(), "test_developer"
+ policies, AclPermission.READ_THREADS.getValue(), "test_developer"
)).isTrue();
assertThat(policyUtils.isPermissionPresentForUser(
- policies, AclPermission.READ_THREAD.getValue(), "new_test_user"
+ policies, AclPermission.READ_THREADS.getValue(), "new_test_user"
)).isTrue();
assertThat(policyUtils.isPermissionPresentForUser(
- policies, AclPermission.READ_THREAD.getValue(), "api_user"
+ policies, AclPermission.READ_THREADS.getValue(), "api_user"
)).isTrue();
}).verifyComplete();
}
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ApplicationForkingServiceTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ApplicationForkingServiceTests.java
index e0fcfff43652..d87eb8400e0b 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ApplicationForkingServiceTests.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ApplicationForkingServiceTests.java
@@ -9,12 +9,14 @@
import com.appsmith.server.constants.FieldName;
import com.appsmith.server.domains.ActionCollection;
import com.appsmith.server.domains.Application;
+import com.appsmith.server.domains.ApplicationMode;
import com.appsmith.server.domains.Layout;
import com.appsmith.server.domains.NewAction;
import com.appsmith.server.domains.NewPage;
import com.appsmith.server.domains.Organization;
import com.appsmith.server.domains.Plugin;
import com.appsmith.server.domains.PluginType;
+import com.appsmith.server.domains.Theme;
import com.appsmith.server.dtos.ActionCollectionDTO;
import com.appsmith.server.dtos.ActionDTO;
import com.appsmith.server.dtos.InviteUsersDTO;
@@ -34,6 +36,7 @@
import com.appsmith.server.services.NewPageService;
import com.appsmith.server.services.OrganizationService;
import com.appsmith.server.services.SessionUserService;
+import com.appsmith.server.services.ThemeService;
import com.appsmith.server.services.UserService;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -60,6 +63,8 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
+import reactor.util.function.Tuple3;
+import reactor.util.function.Tuple4;
import java.time.Duration;
import java.util.ArrayList;
@@ -67,6 +72,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import static com.appsmith.server.acl.AclPermission.READ_ACTIONS;
import static com.appsmith.server.acl.AclPermission.READ_APPLICATIONS;
@@ -137,6 +143,9 @@ public class ApplicationForkingServiceTests {
@Autowired
private LayoutCollectionService layoutCollectionService;
+ @Autowired
+ private ThemeService themeService;
+
private static String sourceAppId;
private static String testUserOrgId;
@@ -484,6 +493,192 @@ public void test4_validForkApplication_cancelledMidWay_createValidApplication()
}
+ @Test
+ @WithUserDetails("api_user")
+ public void forkApplicationToOrganization_WhenAppHasUnsavedThemeCustomization_ForkedWithCustomizations() {
+ String uniqueString = UUID.randomUUID().toString();
+ Organization organization = new Organization();
+ organization.setName("org_" + uniqueString);
+
+ Mono<Tuple4<Theme, Theme, Application, Application>> tuple4Mono = organizationService.create(organization)
+ .flatMap(createdOrg -> {
+ Application application = new Application();
+ application.setName("app_" + uniqueString);
+ return applicationPageService.createApplication(application, createdOrg.getId());
+ }).flatMap(srcApplication -> {
+ Theme theme = new Theme();
+ theme.setName("theme_" + uniqueString);
+ return themeService.updateTheme(srcApplication.getId(), theme)
+ .then(applicationService.findById(srcApplication.getId()));
+ }).flatMap(srcApplication -> {
+ Organization desOrg = new Organization();
+ desOrg.setName("org_dest_" + uniqueString);
+ return organizationService.create(desOrg).flatMap(createdOrg ->
+ applicationForkingService.forkApplicationToOrganization(srcApplication.getId(), createdOrg.getId())
+ ).zipWith(Mono.just(srcApplication));
+ }).flatMap(applicationTuple2 -> {
+ Application forkedApp = applicationTuple2.getT1();
+ Application srcApp = applicationTuple2.getT2();
+ return Mono.zip(
+ themeService.getApplicationTheme(forkedApp.getId(), ApplicationMode.EDIT),
+ themeService.getApplicationTheme(forkedApp.getId(), ApplicationMode.PUBLISHED),
+ Mono.just(forkedApp),
+ Mono.just(srcApp)
+ );
+ });
+
+ StepVerifier.create(tuple4Mono).assertNext(objects -> {
+ Theme editModeTheme = objects.getT1();
+ Theme publishedModeTheme = objects.getT2();
+ Application forkedApp = objects.getT3();
+ Application srcApp = objects.getT4();
+
+ assertThat(forkedApp.getEditModeThemeId()).isEqualTo(editModeTheme.getId());
+ assertThat(forkedApp.getPublishedModeThemeId()).isEqualTo(publishedModeTheme.getId());
+ assertThat(forkedApp.getEditModeThemeId()).isNotEqualTo(forkedApp.getPublishedModeThemeId());
+
+ // published mode should have the custom theme as we publish after forking the app
+ assertThat(publishedModeTheme.isSystemTheme()).isFalse();
+ // published mode theme will have no application id and org id set as the customizations were not saved
+ assertThat(publishedModeTheme.getOrganizationId()).isNullOrEmpty();
+ assertThat(publishedModeTheme.getApplicationId()).isNullOrEmpty();
+
+ // edit mode theme should be a custom one
+ assertThat(editModeTheme.isSystemTheme()).isFalse();
+ // edit mode theme will have no application id and org id set as the customizations were not saved
+ assertThat(editModeTheme.getOrganizationId()).isNullOrEmpty();
+ assertThat(editModeTheme.getApplicationId()).isNullOrEmpty();
+
+ // forked theme should have the same name as src theme
+ assertThat(editModeTheme.getName()).isEqualTo("theme_" + uniqueString);
+ assertThat(publishedModeTheme.getName()).isEqualTo("theme_" + uniqueString);
+
+ // forked application should have a new edit mode theme created, should not be same as src app theme
+ assertThat(srcApp.getEditModeThemeId()).isNotEqualTo(forkedApp.getEditModeThemeId());
+ assertThat(srcApp.getPublishedModeThemeId()).isNotEqualTo(forkedApp.getPublishedModeThemeId());
+ }).verifyComplete();
+ }
+
+ @Test
+ @WithUserDetails("api_user")
+ public void forkApplicationToOrganization_WhenAppHasSystemTheme_SystemThemeSet() {
+ String uniqueString = UUID.randomUUID().toString();
+ Organization organization = new Organization();
+ organization.setName("org_" + uniqueString);
+
+ Mono<Tuple3<Theme, Application, Application>> tuple3Mono = organizationService.create(organization)
+ .flatMap(createdOrg -> {
+ Application application = new Application();
+ application.setName("app_" + uniqueString);
+ return applicationPageService.createApplication(application, createdOrg.getId());
+ }).flatMap(srcApplication -> {
+ Organization desOrg = new Organization();
+ desOrg.setName("org_dest_" + uniqueString);
+ return organizationService.create(desOrg).flatMap(createdOrg ->
+ applicationForkingService.forkApplicationToOrganization(srcApplication.getId(), createdOrg.getId())
+ ).zipWith(Mono.just(srcApplication));
+ }).flatMap(applicationTuple2 -> {
+ Application forkedApp = applicationTuple2.getT1();
+ Application srcApp = applicationTuple2.getT2();
+ return Mono.zip(
+ themeService.getApplicationTheme(forkedApp.getId(), ApplicationMode.EDIT),
+ Mono.just(forkedApp),
+ Mono.just(srcApp)
+ );
+ });
+
+ StepVerifier.create(tuple3Mono).assertNext(objects -> {
+ Theme editModeTheme = objects.getT1();
+ Application forkedApp = objects.getT2();
+ Application srcApp = objects.getT3();
+
+ // same theme should be set to edit mode and published mode
+ assertThat(forkedApp.getEditModeThemeId()).isEqualTo(editModeTheme.getId());
+ assertThat(forkedApp.getPublishedModeThemeId()).isEqualTo(editModeTheme.getId());
+
+ // edit mode theme should be system theme
+ assertThat(editModeTheme.isSystemTheme()).isTrue();
+ // edit mode theme will have no application id and org id set as it's system theme
+ assertThat(editModeTheme.getOrganizationId()).isNullOrEmpty();
+ assertThat(editModeTheme.getApplicationId()).isNullOrEmpty();
+
+ // forked theme should be default theme
+ assertThat(editModeTheme.getName()).isEqualToIgnoringCase(Theme.DEFAULT_THEME_NAME);
+
+ // forked application should have same theme set
+ assertThat(srcApp.getEditModeThemeId()).isEqualTo(forkedApp.getEditModeThemeId());
+ }).verifyComplete();
+ }
+
+ @Test
+ @WithUserDetails("api_user")
+ public void forkApplicationToOrganization_WhenAppHasCustomSavedTheme_NewCustomThemeCreated() {
+ String uniqueString = UUID.randomUUID().toString();
+ Organization organization = new Organization();
+ organization.setName("org_" + uniqueString);
+
+ Mono<Tuple4<Theme, Theme, Application, Application>> tuple4Mono = organizationService.create(organization)
+ .flatMap(createdOrg -> {
+ Application application = new Application();
+ application.setName("app_" + uniqueString);
+ return applicationPageService.createApplication(application, createdOrg.getId());
+ }).flatMap(srcApplication -> {
+ Theme theme = new Theme();
+ theme.setName("theme_" + uniqueString);
+ return themeService.updateTheme(srcApplication.getId(), theme)
+ .then(themeService.persistCurrentTheme(srcApplication.getId(), theme))
+ .then(applicationService.findById(srcApplication.getId()));
+ }).flatMap(srcApplication -> {
+ Organization desOrg = new Organization();
+ desOrg.setName("org_dest_" + uniqueString);
+ return organizationService.create(desOrg).flatMap(createdOrg ->
+ applicationForkingService.forkApplicationToOrganization(srcApplication.getId(), createdOrg.getId())
+ ).zipWith(Mono.just(srcApplication));
+ }).flatMap(applicationTuple2 -> {
+ Application forkedApp = applicationTuple2.getT1();
+ Application srcApp = applicationTuple2.getT2();
+ return Mono.zip(
+ themeService.getApplicationTheme(forkedApp.getId(), ApplicationMode.EDIT),
+ themeService.getApplicationTheme(forkedApp.getId(), ApplicationMode.PUBLISHED),
+ Mono.just(forkedApp),
+ Mono.just(srcApp)
+ );
+ });
+
+ StepVerifier.create(tuple4Mono).assertNext(objects -> {
+ Theme editModeTheme = objects.getT1();
+ Theme publishedModeTheme = objects.getT2();
+ Application forkedApp = objects.getT3();
+ Application srcApp = objects.getT4();
+
+ assertThat(forkedApp.getEditModeThemeId()).isEqualTo(editModeTheme.getId());
+ assertThat(forkedApp.getPublishedModeThemeId()).isEqualTo(publishedModeTheme.getId());
+ assertThat(forkedApp.getEditModeThemeId()).isNotEqualTo(forkedApp.getPublishedModeThemeId());
+
+ // published mode should have the custom theme as we publish after forking the app
+ assertThat(publishedModeTheme.isSystemTheme()).isFalse();
+
+ // published mode theme will have no application id and org id set as it's a copy
+ assertThat(publishedModeTheme.getOrganizationId()).isNullOrEmpty();
+ assertThat(publishedModeTheme.getApplicationId()).isNullOrEmpty();
+
+ // edit mode theme should be a custom one
+ assertThat(editModeTheme.isSystemTheme()).isFalse();
+
+ // edit mode theme will have application id and org id set as the customizations were saved
+ assertThat(editModeTheme.getOrganizationId()).isNullOrEmpty();
+ assertThat(editModeTheme.getApplicationId()).isNullOrEmpty();
+
+ // forked theme should have the same name as src theme
+ assertThat(editModeTheme.getName()).isEqualTo("theme_" + uniqueString);
+ assertThat(publishedModeTheme.getName()).isEqualTo("theme_" + uniqueString);
+
+ // forked application should have a new edit mode theme created, should not be same as src app theme
+ assertThat(srcApp.getEditModeThemeId()).isNotEqualTo(forkedApp.getEditModeThemeId());
+ assertThat(srcApp.getPublishedModeThemeId()).isNotEqualTo(forkedApp.getPublishedModeThemeId());
+ }).verifyComplete();
+ }
+
private Flux<ActionDTO> getActionsInOrganization(Organization organization) {
return applicationService
.findByOrganizationId(organization.getId(), READ_APPLICATIONS)
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java
index ccbb270d76c2..f0c7d6000c54 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java
@@ -32,7 +32,6 @@
import com.appsmith.server.repositories.ApplicationRepository;
import com.appsmith.server.repositories.NewPageRepository;
import com.appsmith.server.repositories.PluginRepository;
-import com.appsmith.server.repositories.ThemeRepository;
import com.appsmith.server.services.ActionCollectionService;
import com.appsmith.server.services.ApplicationPageService;
import com.appsmith.server.services.DatasourceService;
@@ -42,6 +41,7 @@
import com.appsmith.server.services.NewPageService;
import com.appsmith.server.services.OrganizationService;
import com.appsmith.server.services.SessionUserService;
+import com.appsmith.server.services.ThemeService;
import com.appsmith.server.services.UserService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -90,6 +90,7 @@
import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.MANAGE_DATASOURCES;
import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
+import static com.appsmith.server.acl.AclPermission.MANAGE_THEMES;
import static com.appsmith.server.acl.AclPermission.READ_ACTIONS;
import static com.appsmith.server.acl.AclPermission.READ_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.READ_PAGES;
@@ -148,7 +149,7 @@ public class ImportExportApplicationServiceTests {
PluginExecutorHelper pluginExecutorHelper;
@Autowired
- ThemeRepository themeRepository;
+ ThemeService themeService;
private static final String INVALID_JSON_FILE = "invalid json file";
private static Plugin installedPlugin;
@@ -859,8 +860,8 @@ public void importApplicationInOrganization_WhenCustomizedThemes_ThemesCreated()
.create(resultMono
.flatMap(application -> Mono.zip(
Mono.just(application),
- themeRepository.findById(application.getEditModeThemeId()),
- themeRepository.findById(application.getPublishedModeThemeId())
+ themeService.getThemeById(application.getEditModeThemeId(), MANAGE_THEMES),
+ themeService.getThemeById(application.getPublishedModeThemeId(), MANAGE_THEMES)
)))
.assertNext(tuple -> {
final Application application = tuple.getT1();
@@ -869,9 +870,13 @@ public void importApplicationInOrganization_WhenCustomizedThemes_ThemesCreated()
assertThat(editTheme.isSystemTheme()).isFalse();
assertThat(editTheme.getName()).isEqualTo("Custom edit theme");
+ assertThat(editTheme.getOrganizationId()).isNull();
+ assertThat(editTheme.getApplicationId()).isNull();
assertThat(publishedTheme.isSystemTheme()).isFalse();
assertThat(publishedTheme.getName()).isEqualTo("Custom published theme");
+ assertThat(publishedTheme.getOrganizationId()).isNullOrEmpty();
+ assertThat(publishedTheme.getApplicationId()).isNullOrEmpty();
})
.verifyComplete();
}
diff --git a/app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/valid-application-with-custom-themes.json b/app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/valid-application-with-custom-themes.json
index 21512a2cd50f..d8ebd41fdc6b 100644
--- a/app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/valid-application-with-custom-themes.json
+++ b/app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/valid-application-with-custom-themes.json
@@ -632,11 +632,15 @@
"editModeTheme": {
"name": "Custom edit theme",
"new": true,
- "isSystemTheme": false
+ "isSystemTheme": false,
+ "applicationId": "dummy-app-id",
+ "organizationId": "dummy-org-id"
},
"publishedTheme": {
"name": "Custom published theme",
"new": true,
- "isSystemTheme": false
+ "isSystemTheme": false,
+ "applicationId": "dummy-app-id",
+ "organizationId": "dummy-org-id"
}
}
\ No newline at end of file
|
8a75928c2f1f2bad83ecb575b0a21ba4cf586a1a
|
2021-12-20 15:16:57
|
Anagh Hegde
|
fix: Fix the wrong CS url for private repo limit check (#9865)
| false
|
Fix the wrong CS url for private repo limit check (#9865)
|
fix
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java
index c2792d4e517e..3da2b920734e 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java
@@ -704,7 +704,7 @@ private Mono<Integer> getPrivateRepoLimitForOrg(String orgId) {
}
// Call the cloud service API
return WebClient
- .create(baseUrl + "api/v1/git/limit/" + key)
+ .create(baseUrl + "/api/v1/git/limit/" + key)
.get()
.exchange()
.flatMap(response -> {
|
5ad64598ac5f1fb7f987ca01e30731f9d0d4066f
|
2023-01-26 14:05:11
|
Goutham Pratapa
|
chore: Deploy preview of a PR (#19988)
| false
|
Deploy preview of a PR (#19988)
|
chore
|
diff --git a/.github/workflows/build-deploy-preview.yml b/.github/workflows/build-deploy-preview.yml
new file mode 100644
index 000000000000..22753c315869
--- /dev/null
+++ b/.github/workflows/build-deploy-preview.yml
@@ -0,0 +1,22 @@
+# If someone with write access comments "/build-deploy-preview" on a pull request, emit a repository_dispatch event
+name: Build Deploy Preview
+
+on:
+ issue_comment:
+ types: [created]
+
+jobs:
+ build-deploy-preview:
+ runs-on: ubuntu-latest
+ # Only run for PRs, not issue comments
+ if: |
+ github.event.issue.pull_request
+ steps:
+
+ - name: Slash Command Dispatch
+ uses: peter-evans/slash-command-dispatch@v3
+ with:
+ issue-type: pull-request
+ token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
+ commands: |
+ build-deploy-preview
diff --git a/.github/workflows/on-demand-build-docker-image-deploy-preview.yml b/.github/workflows/on-demand-build-docker-image-deploy-preview.yml
new file mode 100644
index 000000000000..28f454be14d7
--- /dev/null
+++ b/.github/workflows/on-demand-build-docker-image-deploy-preview.yml
@@ -0,0 +1,141 @@
+name: On demand build Docker image and deploy preview
+
+on:
+ # This workflow is only triggered by the `/build-deploy-preview` command dispatch
+ repository_dispatch:
+ types: [ build-deploy-preview-command ]
+
+jobs:
+ notify:
+ runs-on: ubuntu-latest
+ steps:
+ # This step creates a comment on the PR with a link to this workflow run.
+ - name: Add a comment on the PR with link to workflow run
+ uses: peter-evans/create-or-update-comment@v2
+ with:
+ issue-number: ${{ github.event.client_payload.pull_request.number }}
+ body: |
+ Deploying Your Preview: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
+ Workflow: `${{ github.workflow }}`.
+ PR: ${{ github.event.client_payload.pull_request.number }}.
+ URL: https://${{ github.event.client_payload.pull_request.number }}-ce.appsmith.com
+
+ server-build:
+ name: server-build
+ uses: ./.github/workflows/server-build.yml
+ secrets: inherit
+ with:
+ pr: ${{ github.event.client_payload.pull_request.number }}
+
+ client-build:
+ name: client-build
+ uses: ./.github/workflows/client-build.yml
+ secrets: inherit
+ with:
+ pr: ${{ github.event.client_payload.pull_request.number }}
+
+ rts-build:
+ name: rts-build
+ uses: ./.github/workflows/rts-build.yml
+ secrets: inherit
+ with:
+ pr: ${{ github.event.client_payload.pull_request.number }}
+
+ push-image:
+ needs: [client-build, rts-build, server-build]
+ runs-on: ubuntu-latest
+
+ if: success()
+
+ steps:
+
+ - name: Set up Depot CLI
+ uses: depot/setup-action@v1
+
+ # Check out merge commit
+ - name: Checkout PR
+ uses: actions/checkout@v3
+ with:
+ ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
+
+ # Timestamp will be used to create cache key
+ - id: timestamp
+ run: echo "timestamp=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
+
+ # get Git-hash will be used to create cache key
+ - id: git_hash
+ run: echo "git_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
+
+ - name: Download the react build artifact
+ uses: actions/download-artifact@v3
+ with:
+ name: build
+ path: app/client/build
+
+ - name: Download the server build artifact
+ uses: actions/download-artifact@v3
+ with:
+ name: build
+ path: app/server/dist
+
+ - name: Download the rts build artifact
+ uses: actions/download-artifact@v3
+ with:
+ name: rts-dist
+ path: app/rts/dist
+
+ - name: Untar the rts folder
+ run: |
+ tar -xvf app/rts/dist/rts-dist.tar -C app/rts/
+ echo "Cleaning up the tar files"
+ rm app/rts/dist/rts-dist.tar
+
+ - name: Push to Docker Hub
+ uses: docker/build-push-action@v1
+ with:
+ username: ${{ secrets.DOCKER_HUB_USERNAME }}
+ password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
+ repository: ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-ce
+ tags: ${{ steps.git_hash.outputs.git_hash }}
+ outputs:
+ imageHash: ${{ steps.git_hash.outputs.git_hash }}
+
+ build-deploy-preview:
+ needs: [push-image]
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: "."
+
+ if: success()
+ steps:
+
+ - name: Checkout PR
+ uses: actions/checkout@v3
+ with:
+ ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
+ fetch-depth: 0
+
+ - name: Install relevant packages
+ run: |
+ which aws
+ sudo apt update -q && sudo apt install -y curl unzip less jq
+ curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.23.6/bin/linux/amd64/kubectl && \
+ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
+ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && \
+ chmod 700 get_helm.sh; ./get_helm.sh
+
+ - name: Deploy Helm chart
+ env:
+ AWS_ROLE_ARN: ${{ secrets.APPSMITH_EKS_AWS_ROLE_ARN }}
+ AWS_ACCESS_KEY_ID: ${{ secrets.APPSMITH_CI_AWS_SECRET_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.APPSMITH_CI_AWS_SECRET_ACCESS_KEY }}
+ IMAGE_HASH: ${{ needs.push-image.outputs.imageHash }}
+ AWS_RELEASE_CERT: ${{ secrets.APPSMITH_AWS_RELEASE_CERT_RELEASE }}
+ DOCKER_HUB_ORGANIZATION: ${{ secrets.DOCKER_HUB_ORGANIZATION }}
+ DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
+ DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
+ PULL_REQUEST_NUMBER: ${{ github.event.client_payload.pull_request.number }}
+ run: |
+ echo "environment variables set to deploy the image" $IMAGE_HASH
+ /bin/bash ./scripts/deploy_preview.sh
diff --git a/scripts/deploy_preview.sh b/scripts/deploy_preview.sh
new file mode 100755
index 000000000000..31f9c4525edc
--- /dev/null
+++ b/scripts/deploy_preview.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Params are in environment variables as PARAM_{SLUG}, e.g. PARAM_USER_ID
+
+# Configure the AWS & kubectl environment
+
+mkdir ~/.aws; touch ~/.aws/config
+
+echo "[default]
+aws_access_key_id = $AWS_ACCESS_KEY_ID
+aws_secret_access_key = $AWS_SECRET_ACCESS_KEY" > ~/.aws/credentials
+
+echo "[default]
+[profile eksci]
+role_arn= $AWS_ROLE_ARN
+output = json
+region=ap-south-1
+source_profile = default" > ~/.aws/config
+
+export region=ap-south-1
+export cluster_name=uat-cluster
+
+echo "Region: $region"
+echo "Cluster name: $cluster_name"
+echo "Pull Request Number: $PULL_REQUEST_NUMBER"
+
+sts_output=$(aws sts assume-role --role-arn env.AWS_ROLE_ARN --role-session-name ekscisession
+export AWS_ACCESS_KEY_ID=$(echo $sts_output | jq -r '.Credentials''.AccessKeyId');\
+export AWS_SECRET_ACCESS_KEY=$(echo $sts_output | jq -r '.Credentials''.SecretAccessKey');\
+export AWS_SESSION_TOKEN=$(echo $sts_output | jq -r '.Credentials''.SessionToken');
+
+export NAMESPACE="$PULL_REQUEST_NUMBER"ce
+export SECRET="$PULL_REQUEST_NUMBER"ce
+export DOMAINNAME="$PULL_REQUEST_NUMBER"-ce.appsmith.com
+export HELMCHART="appsmith"
+export HELMCHART_URL="http://helm.appsmith.com"
+export HELMCHART_VERSION="2.0.0"
+
+aws eks update-kubeconfig --region $region --name $cluster_name --profile eksci
+
+echo "Set the default namespace"
+kubectl config set-context --current --namespace=default
+
+echo "Getting the pods"
+kubectl get pods
+
+echo "Delete previously created namespace"
+kubectl delete ns $NAMESPACE || echo "true"
+
+echo "Use kubernetes secret to Pull Image"
+kubectl create ns $NAMESPACE
+kubectl create secret docker-registry $SECRET \
+ --docker-server=https://index.docker.io/v1/ \
+ --docker-username=$DOCKER_HUB_USERNAME \
+ --docker-password=$DOCKER_HUB_ACCESS_TOKEN -n $NAMESPACE
+
+echo "Add appsmith-ce to helm repo"
+AWS_REGION=ap-south-1 helm repo add $HELMCHART $HELMCHART_URL
+
+echo "Deploy appsmith helm chart"
+helm install appsmith/appsmith --generate-name -n $NAMESPACE \
+ --create-namespace --set image.repository=$DOCKER_HUB_ORGANIZATION/appsmith-ce --set image.tag=$IMAGE_HASH \
+ --set image.pullSecrets=$SECRET --set redis.enabled=false --set mongodb.enabled=false --set ingress.enabled=true \
+ --set "ingress.annotations.service\.beta\.kubernetes\.io/aws-load-balancer-ssl-cert=$AWS_RELEASE_CERT" \
+ --set "ingress.hosts[0].host=$DOMAINNAME, ingress.hosts[0].paths[0].path=/, ingress.hosts[0].paths[0].pathType=Prefix" \
+ --set ingress.className="nginx" --set autoupdate.enabled="true" --version $HELMCHART_VERSION
|
2b8ba77fec2c618016fc0316008ef5da9f7b674b
|
2025-01-16 13:05:32
|
Hetu Nandu
|
fix: AI query not showing any bottom tabs (#38687)
| false
|
AI query not showing any bottom tabs (#38687)
|
fix
|
diff --git a/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx b/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx
index 6218ce15fcfe..6d6988b883f5 100644
--- a/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx
+++ b/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx
@@ -112,6 +112,7 @@ function usePluginActionResponseTabs() {
if (
[
PluginType.DB,
+ PluginType.AI,
PluginType.REMOTE,
PluginType.SAAS,
PluginType.INTERNAL,
|
e5d89e7099e3dab70611b920a3a345f933f9b008
|
2022-07-27 14:48:39
|
Favour Ohanekwu
|
chore: Upgrade astring version from v1.7.5 to v1.8.3 (#15245)
| false
|
Upgrade astring version from v1.7.5 to v1.8.3 (#15245)
|
chore
|
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug15283_spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug15283_spec.ts
new file mode 100644
index 000000000000..fd5196847126
--- /dev/null
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug15283_spec.ts
@@ -0,0 +1,107 @@
+import { ObjectsRegistry } from "../../../../support/Objects/Registry";
+
+const jsEditor = ObjectsRegistry.JSEditor,
+ ee = ObjectsRegistry.EntityExplorer,
+ locator = ObjectsRegistry.CommonLocators,
+ agHelper = ObjectsRegistry.AggregateHelper;
+
+const assertLintErrorAndOutput = (
+ code: string,
+ hasLintError: boolean,
+ output?: string,
+) => {
+ jsEditor.EditJSObj(code);
+ // Wait for parsing to be complete
+ agHelper.Sleep(3000);
+
+ hasLintError
+ ? agHelper.AssertElementExist(locator._lintErrorElement)
+ : agHelper.AssertElementAbsence(locator._lintErrorElement);
+
+ if (output) {
+ agHelper.GetNClick(jsEditor._runButton);
+ cy.contains(
+ output === "undefined" ? "did not return any data" : output,
+ ).should("exist");
+ }
+};
+
+describe("Correctly parses JS Function", () => {
+ before(() => {
+ ee.DragDropWidgetNVerify("singleselecttreewidget", 300, 500);
+ });
+ it("1. Preserves parenthesis in user's code", () => {
+ const JS_OBJECT_BODY = `export default{
+ labels: {
+ filterText: "Expected result"
+ },
+ testFun: (searchText)=>{
+ const filterText = searchText ?? (this.labels?.filterText + "s" || '');
+ return filterText;
+ }
+ }
+ `;
+ jsEditor.CreateJSObject(JS_OBJECT_BODY, {
+ paste: true,
+ completeReplace: true,
+ toRun: false,
+ shouldCreateNewJSObj: true,
+ });
+
+ // confirm there is no parse error
+ jsEditor.AssertParseError(false, false);
+ // Wait for parsing to be complete
+ agHelper.Sleep(2000);
+ // run
+ agHelper.GetNClick(jsEditor._runButton);
+
+ // confirm there is no function execution error
+ jsEditor.AssertParseError(false, false);
+
+ cy.contains("Expected results").should("exist");
+ });
+ it("2. TC 1970 - Outputs expected result", () => {
+ const getJSObjectBody = (expression: string) => `export default{
+ myFun1: ()=>{
+ const result = ${expression};
+ return result;
+ }
+ }
+ `;
+ const expression1 = `null ?? (TreeSelect1.selectedOptionLabel || undefined)`;
+ const expression2 = `null ?? (TreeSelect1.selectedOptionLabel && undefined)`;
+ const expression3 = `!null ?? (!TreeSelect1.selectedOptionLabel || !undefined)`;
+ const expression4 = `null ?? (TreeSelect1.selectedOptionLabel.unknown || undefined)`;
+ const expression5 = `null ?? (null || TreeSelect1.selectedOptionLabel + " hi")`;
+ const expression6 = `null ?? (TreeSelect1.selectedOptionLabel || "hi")`;
+ const expression7 = `null ?? (!TreeSelect1.selectedOptionLabel + " that" || "hi")`;
+ const expression8 = `null ?? (TreeSelect1.selectedOptionLabel && "hi")`;
+ const expression9 = `null ?? (TreeSelect1.selectedOptionLabel && undefined)`;
+ const expression10 = `null ?? (!TreeSelect1.selectedOptionLabel && "hi")`;
+ const expression11 = `(null || !TreeSelect1.selectedOptionLabel) ?? TreeSelect1.selectedOptionLabel.unknown`;
+ const expression12 = `(null && !TreeSelect1.selectedOptionLabel) ?? "hi"`;
+ const expression13 = `(true || "universe") ?? "hi"`;
+ const expression14 = `null ?? TreeSelect1.selectedOptionLabel || undefined`;
+ const expression15 = `null ?? TreeSelect1.selectedOptionLabel && undefined`;
+ const expression16 = `!null ?? !TreeSelect1.selectedOptionLabel || !undefined`;
+ const expression17 = `null ?? TreeSelect1.selectedOptionLabel || undefined`;
+
+ assertLintErrorAndOutput(getJSObjectBody(expression1), false, "B");
+ assertLintErrorAndOutput(getJSObjectBody(expression2), false, "B");
+ assertLintErrorAndOutput(getJSObjectBody(expression3), false, "true");
+ assertLintErrorAndOutput(getJSObjectBody(expression4), false, "undefined");
+ assertLintErrorAndOutput(getJSObjectBody(expression5), false, "B hi");
+ assertLintErrorAndOutput(getJSObjectBody(expression6), false, "hi");
+ assertLintErrorAndOutput(getJSObjectBody(expression7), false, "false that");
+ assertLintErrorAndOutput(getJSObjectBody(expression8), false, "hi");
+ assertLintErrorAndOutput(getJSObjectBody(expression9), false, "hi");
+ assertLintErrorAndOutput(getJSObjectBody(expression10), false, "hi");
+ assertLintErrorAndOutput(getJSObjectBody(expression11), false, "false");
+ assertLintErrorAndOutput(getJSObjectBody(expression12), false, "hi");
+ assertLintErrorAndOutput(getJSObjectBody(expression13), false, "true");
+ assertLintErrorAndOutput(getJSObjectBody(expression14), true, undefined);
+ assertLintErrorAndOutput(getJSObjectBody(expression15), true, undefined);
+ assertLintErrorAndOutput(getJSObjectBody(expression16), true, undefined);
+ assertLintErrorAndOutput(getJSObjectBody(expression17), true, undefined);
+ });
+});
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Linting/ErrorReporting_spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Linting/ErrorReporting_spec.ts
index e3c44c8e305a..2d502df22800 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Linting/ErrorReporting_spec.ts
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Linting/ErrorReporting_spec.ts
@@ -302,16 +302,12 @@ describe("Lint error reporting", () => {
agHelper.AssertElementAbsence(locator._lintErrorElement);
});
- function MouseHoverNVerify(
- lintOn: string,
- debugMsg: string,
- isError = true,
- ) {
+ function MouseHoverNVerify(lintOn: string, debugMsg: string, isError = true) {
agHelper.Sleep();
- let element = isError
+ const element = isError
? cy.get(locator._lintErrorElement)
: cy.get(locator._lintWarningElement);
- element
+ element
.contains(lintOn)
.should("exist")
.first()
diff --git a/app/client/src/workers/ast.ts b/app/client/src/workers/ast.ts
index d132b416a028..1b9a99bac4f0 100644
--- a/app/client/src/workers/ast.ts
+++ b/app/client/src/workers/ast.ts
@@ -384,7 +384,6 @@ export const parseJSObjectWithAST = (
}
},
});
-
JSObjectProperties.forEach((node) => {
let params = new Set<functionParams>();
const propertyNode = node;
diff --git a/app/client/yarn.lock b/app/client/yarn.lock
index e945b22fc6d4..53d19673a82a 100644
--- a/app/client/yarn.lock
+++ b/app/client/yarn.lock
@@ -4335,8 +4335,9 @@ astral-regex@^2.0.0:
resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz"
astring@^1.7.5:
- version "1.7.5"
- resolved "https://registry.npmjs.org/astring/-/astring-1.7.5.tgz"
+ version "1.8.3"
+ resolved "https://registry.yarnpkg.com/astring/-/astring-1.8.3.tgz#1a0ae738c7cc558f8e5ddc8e3120636f5cebcb85"
+ integrity sha512-sRpyiNrx2dEYIMmUXprS8nlpRg2Drs8m9ElX9vVEXaCB4XEAJhKfs7IcX0IwShjuOAjLR6wzIrgoptz1n19i1A==
async-limiter@~1.0.0:
version "1.0.1"
|
da9274de10e31eab315860954d0519aa01693f32
|
2020-09-09 11:16:06
|
vicky-primathon
|
feature: Table Widget - multi row selection (#507)
| false
|
Table Widget - multi row selection (#507)
|
feature
|
diff --git a/app/client/cypress/integration/Smoke_TestSuite/Binding/Bind_TableTextPagination_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Binding/Bind_TableTextPagination_spec.js
index 9089c61aac8f..072e8d0019a1 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/Binding/Bind_TableTextPagination_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/Binding/Bind_TableTextPagination_spec.js
@@ -30,7 +30,7 @@ describe("Test Create Api and Bind to Table widget", function() {
});
/**Validate Table data on current page(page1) */
cy.ValidateTableData("1");
- cy.get(commonlocators.rightArrowBtn).click({ force: true });
+ cy.get(commonlocators.tableNextPage).click({ force: true });
cy.validateToastMessage("done");
/**Validate Table data on next page(page2) */
cy.ValidateTableData("11");
@@ -39,7 +39,7 @@ describe("Test Create Api and Bind to Table widget", function() {
it("Table-Text, Validate Publish Mode on Server Side Pagination of Paginate with Table Page No", function() {
cy.PublishtheApp();
cy.ValidatePublishTableData("1");
- cy.get(commonlocators.rightArrowBtn).click({ force: true });
+ cy.get(commonlocators.tableNextPage).click({ force: true });
cy.validateToastMessage("done");
cy.ValidatePublishTableData("11");
cy.get(publishPage.backToEditor).click({ force: true });
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ExplorerTests/Entity_Explorer_Multiple_Widgets_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ExplorerTests/Entity_Explorer_Multiple_Widgets_spec.js
index 1f0690869851..01fa9d953912 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ExplorerTests/Entity_Explorer_Multiple_Widgets_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ExplorerTests/Entity_Explorer_Multiple_Widgets_spec.js
@@ -38,14 +38,15 @@ describe("Entity explorer tests related to widgets and validation", function() {
.last()
.click({ force: true });
cy.get(apiwidget.propertyList).then(function($lis) {
- expect($lis).to.have.length(7);
+ expect($lis).to.have.length(8);
expect($lis.eq(0)).to.contain("{{Table1.selectedRow}}");
- expect($lis.eq(1)).to.contain("{{Table1.selectedRowIndex}}");
- expect($lis.eq(2)).to.contain("{{Table1.tableData}}");
- expect($lis.eq(3)).to.contain("{{Table1.pageNo}}");
- expect($lis.eq(4)).to.contain("{{Table1.pageSize}}");
- expect($lis.eq(5)).to.contain("{{Table1.isVisible}}");
- expect($lis.eq(6)).to.contain("{{Table1.searchText}}");
+ expect($lis.eq(1)).to.contain("{{Table1.selectedRows}}");
+ expect($lis.eq(2)).to.contain("{{Table1.selectedRowIndex}}");
+ expect($lis.eq(3)).to.contain("{{Table1.tableData}}");
+ expect($lis.eq(4)).to.contain("{{Table1.pageNo}}");
+ expect($lis.eq(5)).to.contain("{{Table1.pageSize}}");
+ expect($lis.eq(6)).to.contain("{{Table1.isVisible}}");
+ expect($lis.eq(7)).to.contain("{{Table1.searchText}}");
});
});
diff --git a/app/client/cypress/locators/commonlocators.json b/app/client/cypress/locators/commonlocators.json
index 6a3b18ed3028..7b7e93205a86 100644
--- a/app/client/cypress/locators/commonlocators.json
+++ b/app/client/cypress/locators/commonlocators.json
@@ -63,5 +63,7 @@
"saveStatusContainer": ".t--save-status-container",
"saveStatusIsSaving": "t--save-status-is-saving",
"saveStatusSuccess": ".t--save-status-success",
- "saveStatusError": ".t--save-status-error"
+ "saveStatusError": ".t--save-status-error",
+ "tableNextPage": ".t--table-widget-next-page",
+ "tablePrevPage": ".t--table-widget-prev-page"
}
diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js
index 68a9a5bc19e5..7125e79cbd8d 100644
--- a/app/client/cypress/support/commands.js
+++ b/app/client/cypress/support/commands.js
@@ -1459,7 +1459,7 @@ Cypress.Commands.add("isSelectRow", index => {
Cypress.Commands.add("readTabledata", (rowNum, colNum) => {
// const selector = `.t--draggable-tablewidget .e-gridcontent.e-lib.e-droppable td[index=${rowNum}][aria-colindex=${colNum}]`;
- const selector = `.t--draggable-tablewidget .tbody .td[data-rowindex=${rowNum}][data-colindex=${colNum}] div`;
+ const selector = `.tbody .td[data-rowindex="${rowNum}"][data-colindex="${colNum}"] div`;
const tabVal = cy.get(selector).invoke("text");
return tabVal;
});
@@ -1630,10 +1630,10 @@ Cypress.Commands.add("NavigateToPaginationTab", () => {
});
Cypress.Commands.add("ValidateTableData", value => {
- cy.isSelectRow(0);
+ // cy.isSelectRow(0);
cy.readTabledata("0", "0").then(tabData => {
const tableData = tabData;
- expect(tableData).to.equal(value);
+ expect(tableData).to.equal(value.toString());
});
});
diff --git a/app/client/src/components/designSystems/appsmith/ReactTableComponent.tsx b/app/client/src/components/designSystems/appsmith/ReactTableComponent.tsx
index 5190e0f92563..87055ee56723 100644
--- a/app/client/src/components/designSystems/appsmith/ReactTableComponent.tsx
+++ b/app/client/src/components/designSystems/appsmith/ReactTableComponent.tsx
@@ -54,6 +54,8 @@ interface ReactTableComponentProps {
serverSidePaginationEnabled: boolean;
columnActions?: ColumnAction[];
selectedRowIndex: number;
+ selectedRowIndexes: number[];
+ multiRowSelection?: boolean;
hiddenColumns?: string[];
columnNameMap?: { [key: string]: string };
columnTypeMap?: {
@@ -263,7 +265,7 @@ const ReactTableComponent = (props: ReactTableComponentProps) => {
row: { original: object; index: number },
isSelected: boolean,
) => {
- if (!isSelected) {
+ if (!isSelected || !!props.multiRowSelection) {
props.onRowClick(row.original, row.index);
}
};
@@ -299,6 +301,7 @@ const ReactTableComponent = (props: ReactTableComponentProps) => {
}}
serverSidePaginationEnabled={props.serverSidePaginationEnabled}
selectedRowIndex={props.selectedRowIndex}
+ selectedRowIndexes={props.selectedRowIndexes}
disableDrag={() => {
props.disableDrag(true);
}}
diff --git a/app/client/src/components/designSystems/appsmith/Table.tsx b/app/client/src/components/designSystems/appsmith/Table.tsx
index 3aae6e6df98c..91ac503b6402 100644
--- a/app/client/src/components/designSystems/appsmith/Table.tsx
+++ b/app/client/src/components/designSystems/appsmith/Table.tsx
@@ -49,6 +49,7 @@ interface TableProps {
prevPageClick: () => void;
serverSidePaginationEnabled: boolean;
selectedRowIndex: number;
+ selectedRowIndexes: number[];
disableDrag: () => void;
enableDrag: () => void;
searchTableData: (searchKey: any) => void;
@@ -110,6 +111,7 @@ export const Table = (props: TableProps) => {
}
const subPage = page.slice(startIndex, endIndex);
const selectedRowIndex = props.selectedRowIndex;
+ const selectedRowIndexes = props.selectedRowIndexes;
const tableSizes = TABLE_SIZES[props.compactMode || CompactModeTypes.DEFAULT];
/* Subtracting 9px to handling widget padding */
return (
@@ -201,11 +203,20 @@ export const Table = (props: TableProps) => {
{...row.getRowProps()}
className={
"tr" +
- `${row.index === selectedRowIndex ? " selected-row" : ""}`
+ `${
+ row.index === selectedRowIndex ||
+ selectedRowIndexes.includes(row.index)
+ ? " selected-row"
+ : ""
+ }`
}
onClick={() => {
row.toggleRowSelected();
- props.selectTableRow(row, row.index === selectedRowIndex);
+ props.selectTableRow(
+ row,
+ row.index === selectedRowIndex ||
+ selectedRowIndexes.includes(row.index),
+ );
}}
key={rowIndex}
>
diff --git a/app/client/src/components/designSystems/appsmith/TableHeader.tsx b/app/client/src/components/designSystems/appsmith/TableHeader.tsx
index ab1ba8f278cc..86fb1de4d7fb 100644
--- a/app/client/src/components/designSystems/appsmith/TableHeader.tsx
+++ b/app/client/src/components/designSystems/appsmith/TableHeader.tsx
@@ -130,6 +130,7 @@ const TableHeader = (props: TableHeaderProps) => {
{props.serverSidePaginationEnabled && (
<PaginationWrapper>
<PaginationItemWrapper
+ className="t--table-widget-prev-page"
disabled={false}
onClick={() => {
props.prevPageClick();
@@ -141,6 +142,7 @@ const TableHeader = (props: TableHeaderProps) => {
{props.pageNo + 1}
</PaginationItemWrapper>
<PaginationItemWrapper
+ className="t--table-widget-next-page"
disabled={false}
onClick={() => {
props.nextPageClick();
@@ -156,6 +158,7 @@ const TableHeader = (props: TableHeaderProps) => {
Showing {props.currentPageIndex + 1}-{props.pageCount} items
</RowWrapper>
<PaginationItemWrapper
+ className="t--table-widget-prev-page"
disabled={props.currentPageIndex === 0}
onClick={() => {
const pageNo =
@@ -175,6 +178,7 @@ const TableHeader = (props: TableHeaderProps) => {
of {props.pageCount}
</RowWrapper>
<PaginationItemWrapper
+ className="t--table-widget-next-page"
disabled={props.currentPageIndex === props.pageCount - 1}
onClick={() => {
const pageNo =
diff --git a/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx b/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx
index 217250e3ce28..ebe3c7d889fb 100644
--- a/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx
+++ b/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx
@@ -156,6 +156,12 @@ const PropertyPaneConfigResponse: PropertyPaneConfigsResponse["data"] = {
label: "Visible",
controlType: "SWITCH",
},
+ {
+ id: "7.1.5",
+ propertyName: "multiRowSelection",
+ label: "Enable multi row selection",
+ controlType: "SWITCH",
+ },
],
},
{
diff --git a/app/client/src/utils/autocomplete/EntityDefinitions.ts b/app/client/src/utils/autocomplete/EntityDefinitions.ts
index 0870d8279eb5..8a80e04bb542 100644
--- a/app/client/src/utils/autocomplete/EntityDefinitions.ts
+++ b/app/client/src/utils/autocomplete/EntityDefinitions.ts
@@ -59,6 +59,7 @@ export const entityDefinitions = {
"The Table is the hero widget of Appsmith. You can display data from an API in a table, trigger an action when a user selects a row and even work with large paginated data sets",
"!url": "https://docs.appsmith.com/widget-reference/table",
selectedRow: generateTypeDef(widget.selectedRow),
+ selectedRows: generateTypeDef(widget.selectedRows),
selectedRowIndex: "number",
tableData: generateTypeDef(widget.tableData),
pageNo: "number",
diff --git a/app/client/src/widgets/TableWidget.tsx b/app/client/src/widgets/TableWidget.tsx
index 1d01469ab25c..5483027ab636 100644
--- a/app/client/src/widgets/TableWidget.tsx
+++ b/app/client/src/widgets/TableWidget.tsx
@@ -22,6 +22,7 @@ import { TriggerPropertiesMap } from "utils/WidgetFactory";
import Skeleton from "components/utils/Skeleton";
import moment from "moment";
import * as Sentry from "@sentry/react";
+
const ReactTableComponent = lazy(() =>
import("components/designSystems/appsmith/ReactTableComponent"),
);
@@ -92,8 +93,10 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
pageNo: 1,
pageSize: undefined,
selectedRowIndex: -1,
+ selectedRowIndexes: "",
searchText: undefined,
selectedRow: {},
+ selectedRows: [],
// The following meta property is used for rendering the table.
filteredTableData: undefined,
};
@@ -308,8 +311,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
return filteredTableData;
};
- getSelectedRow = (filteredTableData: object[]) => {
- const { selectedRowIndex } = this.props;
+ getSelectedRow = (filteredTableData: object[], selectedRowIndex?: number) => {
if (selectedRowIndex === undefined || selectedRowIndex === -1) {
const columnKeys: string[] = getAllTableColumnKeys(this.props.tableData);
const selectedRow: { [key: string]: any } = {};
@@ -324,9 +326,10 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
componentDidMount() {
const filteredTableData = this.filterTableData();
super.updateWidgetMetaProperty("filteredTableData", filteredTableData);
+ const { selectedRowIndex } = this.props;
super.updateWidgetMetaProperty(
"selectedRow",
- this.getSelectedRow(filteredTableData),
+ this.getSelectedRow(filteredTableData, selectedRowIndex),
);
}
componentDidUpdate(prevProps: TableWidgetProps) {
@@ -342,15 +345,69 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
) {
const filteredTableData = this.filterTableData();
super.updateWidgetMetaProperty("filteredTableData", filteredTableData);
- super.updateWidgetMetaProperty(
- "selectedRow",
- this.getSelectedRow(filteredTableData),
- );
+ if (!this.props.multiRowSelection) {
+ super.updateWidgetMetaProperty(
+ "selectedRow",
+ this.getSelectedRow(filteredTableData),
+ );
+ } else {
+ const selectedRowIndexes = this.getSelectedRowIndexes(
+ this.props.selectedRowIndexes,
+ );
+ super.updateWidgetMetaProperty(
+ "selectedRows",
+ filteredTableData.filter((item: object, i: number) => {
+ return selectedRowIndexes.includes(i);
+ }),
+ );
+ }
+ }
+ if (this.props.multiRowSelection !== prevProps.multiRowSelection) {
+ if (this.props.multiRowSelection) {
+ const selectedRowIndexes = this.props.selectedRowIndex
+ ? [this.props.selectedRowIndex]
+ : [];
+ super.updateWidgetMetaProperty(
+ "selectedRowIndexes",
+ selectedRowIndexes.join(","),
+ );
+ super.updateWidgetMetaProperty("selectedRowIndex", -1);
+ const filteredTableData = this.filterTableData();
+ super.updateWidgetMetaProperty(
+ "selectedRows",
+ filteredTableData.filter((item: object, i: number) => {
+ return selectedRowIndexes.includes(i);
+ }),
+ );
+ super.updateWidgetMetaProperty(
+ "selectedRow",
+ this.getSelectedRow(filteredTableData),
+ );
+ } else {
+ const filteredTableData = this.filterTableData();
+ super.updateWidgetMetaProperty("selectedRowIndexes", "");
+ super.updateWidgetMetaProperty("selectedRows", []);
+ super.updateWidgetMetaProperty(
+ "selectedRow",
+ this.getSelectedRow(filteredTableData),
+ );
+ }
}
}
+ getSelectedRowIndexes = (selectedRowIndexes: string) => {
+ return selectedRowIndexes
+ ? selectedRowIndexes.split(",").map(i => Number(i))
+ : [];
+ };
+
getPageView() {
- const { tableData, hiddenColumns, filteredTableData } = this.props;
+ const {
+ tableData,
+ hiddenColumns,
+ filteredTableData,
+ selectedRowIndexes,
+ } = this.props;
const tableColumns = this.getTableColumns(tableData);
const transformedData = this.transformData(
@@ -411,6 +468,8 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
? -1
: this.props.selectedRowIndex
}
+ multiRowSelection={this.props.multiRowSelection}
+ selectedRowIndexes={this.getSelectedRowIndexes(selectedRowIndexes)}
serverSidePaginationEnabled={serverSidePaginationEnabled}
onRowClick={this.handleRowClick}
pageNo={pageNo}
@@ -503,11 +562,33 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
handleRowClick = (rowData: object, index: number) => {
const { onRowSelected } = this.props;
- super.updateWidgetMetaProperty("selectedRowIndex", index);
- super.updateWidgetMetaProperty(
- "selectedRow",
- this.props.filteredTableData[index],
- );
+ if (this.props.multiRowSelection) {
+ const selectedRowIndexes = this.getSelectedRowIndexes(
+ this.props.selectedRowIndexes,
+ );
+ if (selectedRowIndexes.includes(index)) {
+ const rowIndex = selectedRowIndexes.indexOf(index);
+ selectedRowIndexes.splice(rowIndex, 1);
+ } else {
+ selectedRowIndexes.push(index);
+ }
+ super.updateWidgetMetaProperty(
+ "selectedRowIndexes",
+ selectedRowIndexes.join(","),
+ );
+ super.updateWidgetMetaProperty(
+ "selectedRows",
+ this.props.filteredTableData.filter((item: object, i: number) => {
+ return selectedRowIndexes.includes(i);
+ }),
+ );
+ } else {
+ super.updateWidgetMetaProperty("selectedRowIndex", index);
+ super.updateWidgetMetaProperty(
+ "selectedRow",
+ this.props.filteredTableData[index],
+ );
+ }
if (onRowSelected) {
super.executeAction({
dynamicString: onRowSelected,
@@ -535,6 +616,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
resetSelectedRowIndex = () => {
super.updateWidgetMetaProperty("selectedRowIndex", -1);
+ super.updateWidgetMetaProperty("selectedRowIndexes", "");
};
handlePrevPageClick = () => {
@@ -597,8 +679,10 @@ export interface TableWidgetProps extends WidgetProps {
onRowSelected?: string;
onSearchTextChanged: string;
selectedRowIndex?: number;
+ selectedRowIndexes: string;
columnActions?: ColumnAction[];
serverSidePaginationEnabled?: boolean;
+ multiRowSelection?: boolean;
hiddenColumns?: string[];
columnOrder?: string[];
columnNameMap?: { [key: string]: string };
|
e74664c32e981e1d235d2fe475c26a841bb761ac
|
2025-02-26 13:36:32
|
Subhrashis Das
|
fix: Add default RTS port in CE (#39444)
| false
|
Add default RTS port in CE (#39444)
|
fix
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/RTSCallerCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/RTSCallerCEImpl.java
index 812d54be3177..1e0210f06bd7 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/RTSCallerCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/RTSCallerCEImpl.java
@@ -22,7 +22,6 @@
import static com.appsmith.server.filters.MDCFilter.INTERNAL_REQUEST_ID_HEADER;
import static com.appsmith.server.filters.MDCFilter.REQUEST_ID_HEADER;
-import static org.apache.commons.lang3.StringUtils.isEmpty;
@Component
public class RTSCallerCEImpl implements RTSCallerCE {
@@ -42,10 +41,6 @@ public RTSCallerCEImpl(ObservationRegistry observationRegistry) {
@PostConstruct
private void makeWebClient() {
- if (isEmpty(rtsPort)) {
- rtsPort = "8091";
- }
-
final ConnectionProvider connectionProvider = ConnectionProvider.builder("rts-provider")
.maxConnections(100)
.maxIdleTime(Duration.ofSeconds(30))
diff --git a/app/server/appsmith-server/src/main/resources/application-ce.properties b/app/server/appsmith-server/src/main/resources/application-ce.properties
index 712eed456c1a..829965bfbd13 100644
--- a/app/server/appsmith-server/src/main/resources/application-ce.properties
+++ b/app/server/appsmith-server/src/main/resources/application-ce.properties
@@ -100,7 +100,7 @@ appsmith.plugin.response.size.max=${APPSMITH_PLUGIN_MAX_RESPONSE_SIZE_MB:5}
appsmith.admin.envfile=${APPSMITH_ENVFILE_PATH:/appsmith-stacks/configuration/docker.env}
# RTS port
-appsmith.rts.port=${APPSMITH_RTS_PORT:}
+appsmith.rts.port=${APPSMITH_RTS_PORT:8091}
appsmith.internal.password=${APPSMITH_INTERNAL_PASSWORD:}
|
72c4b4d9962b169a45b0e2b9076d26f159a1fa04
|
2023-11-03 19:15:00
|
Aman Agarwal
|
fix: gsheet preview data UI using tabs for preview and configuration (#28318)
| false
|
gsheet preview data UI using tabs for preview and configuration (#28318)
|
fix
|
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index 37ca1f337940..00485dcf0c54 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -1903,6 +1903,11 @@ export const ERR_FETCHING_DATASOURCE_PREVIEW_DATA = () =>
export const FETCHING_DATASOURCE_PREVIEW_DATA = () => "Loading data";
export const SCHEMA_PREVIEW_NO_DATA = () =>
"No data records to show or the table header begins with an index other than 1";
+export const GSHEET_SPREADSHEET_LABEL = () => "Spreadsheets";
+export const GSHEET_SPREADSHEET_LOADING = () => "Loading Spreadsheets";
+export const GSHEET_SHEET_LOADING = () => "Loading Sheets";
+export const GSHEET_DATA_LOADING = () => "Loading attributes";
+export const GSHEET_SEARCH_PLACEHOLDER = () => "Search for spreadsheet";
//Layout Conversion flow
export const CONVERT = () => "Convert layout";
@@ -2161,6 +2166,8 @@ export const COMMUNITY_TEMPLATES = {
export const EMPTY_TABLE_TITLE_TEXT = () => "Empty table";
export const EMPTY_TABLE_MESSAGE_TEXT = () =>
"There are no data records to show";
+export const LOADING_RECORDS_TITLE_TEXT = () => "Loading records";
+export const LOADING_RECORDS_MESSAGE_TEXT = () => "This may take a few seconds";
export const EMPTY_TABLE_SVG_ALT_TEXT = () => "Empty table image";
export const DATA_PANE_TITLE = () => "Datasources in your Workspace";
diff --git a/app/client/src/ce/utils/analyticsUtilTypes.ts b/app/client/src/ce/utils/analyticsUtilTypes.ts
index 4e6b55243764..d78da690573a 100644
--- a/app/client/src/ce/utils/analyticsUtilTypes.ts
+++ b/app/client/src/ce/utils/analyticsUtilTypes.ts
@@ -350,7 +350,8 @@ export type DATASOURCE_SCHEMA_EVENTS =
| "GSHEET_PREVIEW_DATA_SHOWN"
| "DATASOURCE_GENERATE_PAGE_BUTTON_CLICKED"
| "DATASOURCE_PREVIEW_TABLE_CHANGE"
- | "DATASOURCE_PREVIEW_DATA_SHOWN";
+ | "DATASOURCE_PREVIEW_DATA_SHOWN"
+ | "GSHEET_SPREADSHEET_SEARCH";
type WALKTHROUGH_EVENTS = "WALKTHROUGH_DISMISSED" | "WALKTHROUGH_SHOWN";
diff --git a/app/client/src/components/editorComponents/ActionRightPane/index.tsx b/app/client/src/components/editorComponents/ActionRightPane/index.tsx
index 5fa318850f87..042c62514540 100644
--- a/app/client/src/components/editorComponents/ActionRightPane/index.tsx
+++ b/app/client/src/components/editorComponents/ActionRightPane/index.tsx
@@ -51,6 +51,7 @@ import { getAssetUrl } from "@appsmith/utils/airgapHelpers";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
import { getHasManagePagePermission } from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
+import type { Datasource } from "entities/Datasource";
import { DatasourceStructureContext } from "entities/Datasource";
const SCHEMA_GUIDE_GIF = `${ASSETS_CDN_URL}/schema.gif`;
@@ -152,7 +153,7 @@ const Placeholder = styled.div`
`;
const DataStructureListWrapper = styled.div`
- overflow-y: auto;
+ overflow-y: hidden;
height: 100%;
display: flex;
flex-direction: column;
@@ -176,7 +177,7 @@ interface CollapsibleProps {
label: string;
CustomLabelComponent?: (props: any) => JSX.Element;
isDisabled?: boolean;
- datasourceId?: string;
+ datasource?: Partial<Datasource>;
containerRef?: MutableRefObject<HTMLDivElement | null>;
}
@@ -189,7 +190,7 @@ export function Collapsible({
children,
containerRef,
CustomLabelComponent,
- datasourceId,
+ datasource,
expand = true,
label,
}: CollapsibleProps) {
@@ -220,7 +221,7 @@ export function Collapsible({
/>
{!!CustomLabelComponent ? (
<CustomLabelComponent
- datasourceId={datasourceId}
+ datasource={datasource}
onRefreshCallback={() => handleCollapse(true)}
/>
) : (
@@ -427,7 +428,7 @@ function ActionSidebar({
<Collapsible
CustomLabelComponent={DatasourceStructureHeader}
containerRef={schemaRef}
- datasourceId={datasourceId}
+ datasource={{ id: datasourceId }}
expand={!showSuggestedWidgets}
label="Schema"
>
diff --git a/app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx b/app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx
index e3636825e45e..eaa4053b6f9d 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx
@@ -181,9 +181,11 @@ export function renderDatasourceSection(
if (
!value &&
!!viewMode &&
- !!section.hidden &&
- "comparison" in section.hidden &&
- section.hidden.comparison === ComparisonOperationsEnum.VIEW_MODE
+ (!section.hidden ||
+ (!!section.hidden &&
+ "comparison" in section.hidden &&
+ section.hidden.comparison ===
+ ComparisonOperationsEnum.VIEW_MODE))
) {
value = section.initialValue;
}
diff --git a/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx b/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
index 65bcc5f526e2..14c5df524bf8 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
@@ -78,12 +78,16 @@ export const ResizerContentContainer = styled.div`
border-bottom: 1px solid var(--ads-v2-color-border);
}
}
- &.db-form-resizer-content.db-form-resizer-content-show-tabs {
+ &.db-form-resizer-content.db-form-resizer-content-show-tabs,
+ &.saas-form-resizer-content.saas-form-resizer-content-show-tabs {
padding: 0;
& .t--ds-form-header {
border-bottom: none;
}
}
+ &.saas-form-resizer-content.saas-form-resizer-content-show-tabs form {
+ padding-bottom: 0;
+ }
border-top: none;
.db-form-content-container {
display: flex;
diff --git a/app/client/src/pages/Editor/DataSourceEditor/index.tsx b/app/client/src/pages/Editor/DataSourceEditor/index.tsx
index 08b79ebbe44a..26980a75f847 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/index.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/index.tsx
@@ -871,16 +871,9 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
};
shouldShowTabs = () => {
- const {
- isEnabledForDSViewModeSchema,
- isPluginAllowedToPreviewData,
- pluginDatasourceForm,
- } = this.props;
- const isRestAPI =
- pluginDatasourceForm === DatasourceComponentTypes.RestAPIDatasourceForm;
- return (
- isEnabledForDSViewModeSchema && isPluginAllowedToPreviewData && !isRestAPI
- );
+ const { isEnabledForDSViewModeSchema, isPluginAllowedToPreviewData } =
+ this.props;
+ return isEnabledForDSViewModeSchema && isPluginAllowedToPreviewData;
};
renderTabsForViewMode = () => {
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasorceTabs.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasorceTabs.tsx
index 9661bfa31831..891aa1cc6e58 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/DatasorceTabs.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/DatasorceTabs.tsx
@@ -13,8 +13,11 @@ import DatasourceViewModeSchema from "./DatasourceViewModeSchema";
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
import { isEnvironmentValid } from "@appsmith/utils/Environments";
import type { Datasource } from "entities/Datasource";
-import { isGoogleSheetPluginDS } from "utils/editorContextUtils";
-import { getPluginNameFromId } from "@appsmith/selectors/entitiesSelector";
+import {
+ isDatasourceAuthorizedForQueryCreation,
+ isGoogleSheetPluginDS,
+} from "utils/editorContextUtils";
+import { getPlugin } from "@appsmith/selectors/entitiesSelector";
import GoogleSheetSchema from "./GoogleSheetSchema";
const TabsContainer = styled(Tabs)`
@@ -55,14 +58,22 @@ const DatasourceTabs = (props: DatasourceTabProps) => {
const setDatasourceViewModeFlagClick = (value: boolean) => {
dispatch(setDatasourceViewModeFlag(value));
};
- const pluginName = useSelector((state) =>
- getPluginNameFromId(state, props.datasource.pluginId),
+ const plugin = useSelector((state) =>
+ getPlugin(state, props.datasource.pluginId),
);
- const isGoogleSheetPlugin = isGoogleSheetPluginDS(pluginName);
+ const isGoogleSheetPlugin = isGoogleSheetPluginDS(plugin?.packageName);
+ const isPluginAuthorized =
+ !!plugin && !!props.datasource
+ ? isDatasourceAuthorizedForQueryCreation(
+ props.datasource,
+ plugin,
+ currentEnvironmentId,
+ )
+ : false;
return (
<TabsContainer
defaultValue={
- isDatasourceValid
+ isDatasourceValid || isPluginAuthorized
? VIEW_MODE_TABS.VIEW_DATA
: VIEW_MODE_TABS.CONFIGURATIONS
}
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureContainer.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureContainer.tsx
index 0de08bbd5063..2c15e8d499dd 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureContainer.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureContainer.tsx
@@ -11,11 +11,10 @@ import React, { memo, useEffect, useState, useContext } from "react";
import EntityPlaceholder from "../Explorer/Entity/Placeholder";
import DatasourceStructure from "./DatasourceStructure";
import { SearchInput, Text } from "design-system";
-import styled from "styled-components";
import { getIsFetchingDatasourceStructure } from "@appsmith/selectors/entitiesSelector";
import { useSelector } from "react-redux";
import type { AppState } from "@appsmith/reducers";
-import DatasourceStructureLoadingContainer from "./DatasourceStructureLoadingContainer";
+import ItemLoadingIndicator from "./ItemLoadingIndicator";
import DatasourceStructureNotFound from "./DatasourceStructureNotFound";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { PluginName } from "entities/Action";
@@ -23,6 +22,7 @@ import WalkthroughContext from "components/featureWalkthrough/walkthroughContext
import { setFeatureWalkthroughShown } from "utils/storage";
import { FEATURE_WALKTHROUGH_KEYS } from "constants/WalkthroughConstants";
import { SCHEMA_SECTION_ID } from "entities/Action";
+import { DatasourceStructureSearchContainer } from "./SchemaViewModeCSS";
interface Props {
datasourceId: string;
@@ -50,15 +50,6 @@ export const SCHEMALESS_PLUGINS: Array<string> = [
PluginName.OPEN_AI,
];
-const DatasourceStructureSearchContainer = styled.div`
- margin-bottom: 8px;
- position: sticky;
- top: 0;
- overflow: hidden;
- z-index: 10;
- background: white;
-`;
-
const Container = (props: Props) => {
const isLoading = useSelector((state: AppState) =>
getIsFetchingDatasourceStructure(state, props.datasourceId),
@@ -113,7 +104,7 @@ const Container = (props: Props) => {
const filteredDastasourceStructure =
props.datasourceStructure.tables.filter((table) =>
- table.name.includes(value),
+ table.name.toLowerCase().includes(value.toLowerCase()),
);
setDatasourceStructure({ tables: filteredDastasourceStructure });
@@ -129,7 +120,9 @@ const Container = (props: Props) => {
view = (
<>
{props.context !== DatasourceStructureContext.EXPLORER && (
- <DatasourceStructureSearchContainer>
+ <DatasourceStructureSearchContainer
+ className={`t--search-container--${props.context.toLowerCase()}`}
+ >
<SearchInput
className="datasourceStructure-search"
endIcon="close"
@@ -137,7 +130,7 @@ const Container = (props: Props) => {
placeholder={createMessage(
DATASOURCE_STRUCTURE_INPUT_PLACEHOLDER_TEXT,
)}
- size={"md"}
+ size={"sm"}
startIcon="search"
type="text"
/>
@@ -199,7 +192,7 @@ const Container = (props: Props) => {
props.context !== DatasourceStructureContext.EXPLORER &&
isLoading
) {
- view = <DatasourceStructureLoadingContainer />;
+ view = <ItemLoadingIndicator type="SCHEMA" />;
}
return view;
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureHeader.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureHeader.tsx
index 5fec79494011..534437076602 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureHeader.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureHeader.tsx
@@ -1,15 +1,23 @@
import React, { useCallback } from "react";
-import { useDispatch } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
import { Button, Text } from "design-system";
import styled from "styled-components";
import { refreshDatasourceStructure } from "actions/datasourceActions";
-import { SCHEMA_LABEL, createMessage } from "@appsmith/constants/messages";
+import {
+ GSHEET_SPREADSHEET_LABEL,
+ SCHEMA_LABEL,
+ createMessage,
+} from "@appsmith/constants/messages";
+import type { Datasource } from "entities/Datasource";
import { DatasourceStructureContext } from "entities/Datasource";
+import { getPluginPackageNameFromId } from "@appsmith/selectors/entitiesSelector";
+import { isGoogleSheetPluginDS } from "utils/editorContextUtils";
interface Props {
- datasourceId: string;
+ datasource?: Datasource;
onRefreshCallback?: () => void;
paddingBottom?: boolean;
+ refetchFn?: () => void;
}
const HeaderWrapper = styled.div<{ paddingBottom: boolean }>`
@@ -24,19 +32,31 @@ export default function DatasourceStructureHeader(props: Props) {
const dispatch = useDispatch();
const dispatchRefresh = useCallback(
- (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
- event.stopPropagation();
- dispatch(
- refreshDatasourceStructure(
- props.datasourceId,
- DatasourceStructureContext.QUERY_EDITOR,
- ),
- );
-
- !!props.onRefreshCallback && props.onRefreshCallback();
+ (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
+ if (props.datasource?.id) {
+ event.stopPropagation();
+
+ if (props.refetchFn) {
+ props.refetchFn();
+ } else {
+ dispatch(
+ refreshDatasourceStructure(
+ props.datasource?.id,
+ DatasourceStructureContext.QUERY_EDITOR,
+ ),
+ );
+ }
+
+ !!props.onRefreshCallback && props.onRefreshCallback();
+ }
},
- [dispatch, props.datasourceId],
+ [dispatch, props.datasource?.id],
+ );
+
+ const pluginPackageName = useSelector((state) =>
+ getPluginPackageNameFromId(state, props.datasource?.pluginId || ""),
);
+ const isGoogleSheetPlugin = isGoogleSheetPluginDS(pluginPackageName);
return (
<HeaderWrapper
@@ -44,7 +64,9 @@ export default function DatasourceStructureHeader(props: Props) {
paddingBottom={!!props.paddingBottom}
>
<Text kind="heading-xs" renderAs="h3">
- {createMessage(SCHEMA_LABEL)}
+ {createMessage(
+ isGoogleSheetPlugin ? GSHEET_SPREADSHEET_LABEL : SCHEMA_LABEL,
+ )}
</Text>
<Button
className="datasourceStructure-refresh"
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureLoadingContainer.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureLoadingContainer.tsx
deleted file mode 100644
index 4b81c7bf8ed3..000000000000
--- a/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureLoadingContainer.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import React from "react";
-import { createMessage, LOADING_SCHEMA } from "@appsmith/constants/messages";
-import { Spinner, Text } from "design-system";
-import styled from "styled-components";
-
-const LoadingContainer = styled.div`
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
-
- & > p {
- margin-left: 0.5rem;
- }
-`;
-
-const SpinnerWrapper = styled.div`
- display: flex;
- justify-content: center;
- align-items: center;
-`;
-
-const DatasourceStructureLoadingContainer = () => {
- return (
- <LoadingContainer>
- <SpinnerWrapper>
- <Spinner size={"sm"} />
- </SpinnerWrapper>
- <Text kind="body-m" renderAs="p">
- {createMessage(LOADING_SCHEMA)}
- </Text>
- </LoadingContainer>
- );
-};
-
-export default DatasourceStructureLoadingContainer;
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx
index 2f9c3d6a8626..c55cf0edc417 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx
@@ -1,5 +1,4 @@
import React, { useState, useEffect, useRef } from "react";
-import styled from "styled-components";
import { useDispatch, useSelector } from "react-redux";
import { DatasourceStructureContainer as DatasourceStructureList } from "./DatasourceStructureContainer";
import {
@@ -8,16 +7,10 @@ import {
getNumberOfEntitiesInCurrentPage,
} from "@appsmith/selectors/entitiesSelector";
import DatasourceStructureHeader from "./DatasourceStructureHeader";
-import { MessageWrapper, TableWrapper } from "./GoogleSheetSchema";
-import { Spinner, Text, Button } from "design-system";
+import { Button } from "design-system";
import {
- ERR_FETCHING_DATASOURCE_PREVIEW_DATA,
- FETCHING_DATASOURCE_PREVIEW_DATA,
DATASOURCE_GENERATE_PAGE_BUTTON,
- EMPTY_TABLE_TITLE_TEXT,
- EMPTY_TABLE_MESSAGE_TEXT,
createMessage,
- EMPTY_TABLE_SVG_ALT_TEXT,
} from "@appsmith/constants/messages";
import Table from "pages/Editor/QueryEditor/Table";
import { generateTemplateToUpdatePage } from "actions/pageActions";
@@ -44,98 +37,22 @@ import {
getHasCreatePagePermission,
hasCreateDSActionPermissionInApp,
} from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
-import EmptyTableSVG from "assets/images/empty-table-in-display-preview.svg";
-
-const ViewModeSchemaContainer = styled.div`
- height: 100%;
- width: 100%;
- display: flex;
- flex-direction: column;
-`;
-
-const DataWrapperContainer = styled.div`
- display: flex;
- flex: 1;
- overflow: hidden;
-`;
-
-const StructureContainer = styled.div`
- height: 100%;
- width: 25%;
- padding: var(--ads-v2-spaces-4) var(--ads-v2-spaces-5);
- padding-left: var(--ads-v2-spaces-7);
- display: flex;
- flex-direction: column;
- overflow: hidden;
- border-right: 1px solid var(--ads-v2-color-gray-300);
- flex-shrink: 0;
-`;
-
-const DatasourceDataContainer = styled.div`
- height: 100%;
- width: 75%;
- display: flex;
- flex-direction: column;
-`;
-
-const DatasourceListContainer = styled.div`
- height: 100%;
- display: flex;
- flex-direction: column;
- div {
- flex-shrink: 0;
- }
- div ~ div {
- flex: 1;
- }
- .t--schema-virtuoso-container {
- height: 100%;
- }
-`;
-
-const SchemaStateMessageWrapper = styled.div`
- width: auto;
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative;
- img {
- padding-bottom: var(--ads-v2-spaces-7);
- }
- span:first-child {
- padding-bottom: var(--ads-v2-spaces-2);
- }
-`;
-
-const ButtonContainer = styled.div`
- display: flex;
- flex-shrink: 0;
- justify-content: flex-end;
- border-top: 1px solid var(--ads-v2-color-gray-300);
- padding: var(--ads-v2-spaces-4);
-`;
+import RenderInterimDataState from "./RenderInterimDataState";
+import {
+ ButtonContainer,
+ DataWrapperContainer,
+ DatasourceDataContainer,
+ DatasourceListContainer,
+ StructureContainer,
+ TableWrapper,
+ ViewModeSchemaContainer,
+} from "./SchemaViewModeCSS";
interface Props {
datasource: Datasource;
setDatasourceViewModeFlag: (viewMode: boolean) => void;
}
-const renderEmptyTablePage = () => {
- return (
- <SchemaStateMessageWrapper>
- {/* Render empty table image */}
- <img alt={createMessage(EMPTY_TABLE_SVG_ALT_TEXT)} src={EmptyTableSVG} />
- {/* Show description below the image */}
- {/* Show title */}
- <Text style={{ fontWeight: "bold" }}>
- {createMessage(EMPTY_TABLE_TITLE_TEXT)}
- </Text>
- {/* Show description */}
- <Text>{createMessage(EMPTY_TABLE_MESSAGE_TEXT)}</Text>
- </SchemaStateMessageWrapper>
- );
-};
-
const DatasourceViewModeSchema = (props: Props) => {
const dispatch = useDispatch();
@@ -200,6 +117,7 @@ const DatasourceViewModeSchema = (props: Props) => {
if (
isDatasourceStructureLoading ||
!datasourceStructure ||
+ !datasourceStructure.tables ||
(datasourceStructure && datasourceStructure?.error)
) {
setPreviewData([]);
@@ -248,6 +166,10 @@ const DatasourceViewModeSchema = (props: Props) => {
}
}, [previewData]);
+ useEffect(() => {
+ setPreviewData([]);
+ }, [props.datasource.id]);
+
const onEntityTableClick = (table: string) => {
AnalyticsUtil.logEvent("DATASOURCE_PREVIEW_TABLE_CHANGE", {
datasourceId: props.datasource.id,
@@ -304,10 +226,12 @@ const DatasourceViewModeSchema = (props: Props) => {
<ViewModeSchemaContainer>
<DataWrapperContainer>
<StructureContainer>
- <DatasourceStructureHeader
- datasourceId={props.datasource.id}
- paddingBottom
- />
+ {props.datasource && (
+ <DatasourceStructureHeader
+ datasource={props.datasource}
+ paddingBottom
+ />
+ )}
<DatasourceListContainer>
<DatasourceStructureList
context={DatasourceStructureContext.DATASOURCE_VIEW_MODE}
@@ -322,31 +246,25 @@ const DatasourceViewModeSchema = (props: Props) => {
</StructureContainer>
<DatasourceDataContainer>
<TableWrapper>
- {isLoading && (
- <MessageWrapper>
- <Spinner size="md" />
- <Text style={{ marginLeft: "8px" }}>
- {createMessage(FETCHING_DATASOURCE_PREVIEW_DATA)}
- </Text>
- </MessageWrapper>
- )}
- {!isLoading && failedFetchingPreviewData && (
- <MessageWrapper>
- <Text color="var(--ads-color-red-500)">
- {createMessage(ERR_FETCHING_DATASOURCE_PREVIEW_DATA)}
- </Text>
- </MessageWrapper>
+ {(isLoading || isDatasourceStructureLoading) && (
+ <RenderInterimDataState state="LOADING" />
)}
+ {(!isLoading || !isDatasourceStructureLoading) &&
+ (failedFetchingPreviewData || previewDataError) && (
+ <RenderInterimDataState state="FAILED" />
+ )}
{!isLoading &&
+ !isDatasourceStructureLoading &&
!failedFetchingPreviewData &&
!previewDataError &&
- previewData?.length > 0 && <Table data={previewData} />}
+ previewData?.length > 0 && (
+ <Table data={previewData} shouldResize={false} />
+ )}
{!isLoading &&
+ !isDatasourceStructureLoading &&
!failedFetchingPreviewData &&
!previewDataError &&
- previewData?.length < 1 && (
- <MessageWrapper>{renderEmptyTablePage()}</MessageWrapper>
- )}
+ !previewData?.length && <RenderInterimDataState state="NODATA" />}
</TableWrapper>
</DatasourceDataContainer>
</DataWrapperContainer>
diff --git a/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx b/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx
index 413d385c1c97..bc3a39a3aa7c 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx
@@ -1,24 +1,16 @@
import React, { useState, useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import type { DropdownOption } from "design-system-old";
-import { Button, Option, Select, Spinner, Text } from "design-system";
+import { Button, SearchInput } from "design-system";
import {
useSheetData,
useSheetsList,
useSpreadSheets,
} from "../GeneratePage/components/GeneratePageForm/hooks";
-import type {
- DatasourceTableDropdownOption,
- DropdownOptions,
-} from "../GeneratePage/components/constants";
-import {
- DEFAULT_DROPDOWN_OPTION,
- DROPDOWN_DIMENSION,
-} from "../GeneratePage/components/constants";
-import { SelectWrapper } from "../GeneratePage/components/GeneratePageForm/styles";
+import type { DropdownOptions } from "../GeneratePage/components/constants";
+import { DEFAULT_DROPDOWN_OPTION } from "../GeneratePage/components/constants";
import { isEmpty } from "lodash";
import Table from "pages/Editor/QueryEditor/Table";
-import styled from "styled-components";
import {
getCurrentApplicationId,
getPagePermissions,
@@ -26,10 +18,8 @@ import {
import { generateTemplateToUpdatePage } from "actions/pageActions";
import {
createMessage,
- ERR_FETCHING_DATASOURCE_PREVIEW_DATA,
- FETCHING_DATASOURCE_PREVIEW_DATA,
DATASOURCE_GENERATE_PAGE_BUTTON,
- SCHEMA_PREVIEW_NO_DATA,
+ GSHEET_SEARCH_PLACEHOLDER,
} from "@appsmith/constants/messages";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { getCurrentApplication } from "@appsmith/selectors/applicationSelectors";
@@ -41,76 +31,23 @@ import {
getHasCreatePagePermission,
hasCreateDSActionPermissionInApp,
} from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
-
-export const MessageWrapper = styled.div`
- display: flex;
- align-items: center;
- justify-content: center;
- height: 200px;
-`;
-
-export const TableWrapper = styled.div`
- overflow-x: auto;
- height: 100%;
- && > div {
- width: 100%;
- }
-
- && > ${MessageWrapper} {
- width: 100%;
- height: 100%;
- }
- && .t--table-response {
- border: none;
- height: 100%;
- overflow: hidden;
- }
- && .tableWrap {
- overflow: auto;
- }
- & .table {
- background: none;
- }
- & .table div:first-of-type .tr {
- background: var(--ads-v2-color-black-5);
- border-right: none;
- border-bottom: 1px solid var(--ads-v2-color-black-75);
- }
- && .table div.tbody .tr {
- background: var(--ads-v2-color-white);
- border-bottom: 1px solid var(--ads-v2-color-black-75);
- }
- && .table .td,
- && .table .th {
- border-right: none;
- border-bottom: none;
- }
- button {
- margin-right: 24px;
- }
- && .tableWrap {
- }
-`;
-
-const SelectContainer = styled.div`
- display: flex;
- margin-top: 16px;
- margin-bottom: 16px;
- .t--datasource-generate-page {
- align-self: flex-end;
- margin-left: auto;
- }
-`;
-
-const SelectListWrapper = styled.div`
- display: flex;
- flex-direction: column;
- width: 278px;
- margin-right: 16px;
- & div {
- margin-bottom: 0px;
- }
-`;
+import RenderInterimDataState from "./RenderInterimDataState";
+import {
+ ButtonContainer,
+ DataWrapperContainer,
+ DatasourceAttributesWrapper,
+ DatasourceDataContainer,
+ DatasourceListContainer,
+ DatasourceStructureSearchContainer,
+ StructureContainer,
+ TableWrapper,
+ ViewModeSchemaContainer,
+} from "./SchemaViewModeCSS";
+import DatasourceStructureHeader from "./DatasourceStructureHeader";
+import Entity from "../Explorer/Entity";
+import DatasourceField from "./DatasourceField";
+import { setEntityCollapsibleState } from "actions/editorContextActions";
+import ItemLoadingIndicator from "./ItemLoadingIndicator";
interface Props {
datasourceId: string;
@@ -122,25 +59,47 @@ const MAX_SHEET_ROWS_LENGTH = 12;
// ---------- GoogleSheetSchema Component -------
function GoogleSheetSchema(props: Props) {
- const [datasourceTableOptions, setSelectedDatasourceTableOptions] =
- useState<DropdownOptions>([]);
+ const [spreadsheetOptions, setSpreadsheetOptions] = useState<DropdownOptions>(
+ [],
+ );
+ const [sheetOptions, setSheetOptions] = useState<DropdownOptions>([]);
+ const [sheetData, setSheetData] = useState<any>([]);
+ const [selectedSpreadsheet, setSelectedSpreadsheet] =
+ useState<DropdownOption>({});
+ const [selectedSheet, setSelectedSheet] = useState<DropdownOption>({});
+ const [searchString, setSearchString] = useState<string>("");
const [selectedDatasourceIsInvalid, setSelectedDatasourceIsInvalid] =
useState(false);
const { fetchAllSpreadsheets, isFetchingSpreadsheets } = useSpreadSheets({
- setSelectedDatasourceTableOptions,
+ setSelectedDatasourceTableOptions: setSpreadsheetOptions,
setSelectedDatasourceIsInvalid,
});
- const {
- failedFetchingSheetsList,
- fetchSheetsList,
- isFetchingSheetsList,
- sheetsList,
- } = useSheetsList();
- const { fetchSheetData, isFetchingSheetData, sheetData } = useSheetData();
- const [selectedSpreadsheet, setSelectedSpreadsheet] =
- useState<DropdownOption>({});
- const [selectedSheet, setSelectedSheet] = useState<DropdownOption>({});
- const [currentSheetData, setCurrentSheetData] = useState<any>();
+
+ const handleSearch = (value: string) => {
+ setSearchString(value.toLowerCase());
+
+ AnalyticsUtil.logEvent("GSHEET_SPREADSHEET_SEARCH", {
+ datasourceId: props.datasourceId,
+ pluginId: props.pluginId,
+ });
+ };
+
+ const setSlicedSheetData = (response: DropdownOptions) => {
+ // Getting the top 12 rows as for experimentation we need to keep this number fixed for preview
+ AnalyticsUtil.logEvent("GSHEET_PREVIEW_DATA_SHOWN", {
+ datasourceId: props.datasourceId,
+ pluginId: props.pluginId,
+ });
+ setSheetData(response.slice(0, MAX_SHEET_ROWS_LENGTH));
+ };
+
+ const { failedFetchingSheetsList, fetchSheetsList, isFetchingSheetsList } =
+ useSheetsList({ setSheetOptions });
+ const { failedFetchingSheetData, fetchSheetData, isFetchingSheetData } =
+ useSheetData({
+ setSheetData: setSlicedSheetData,
+ });
+
const applicationId: string = useSelector(getCurrentApplicationId);
const datasource = useSelector((state) =>
getDatasource(state, props.datasourceId),
@@ -148,101 +107,176 @@ function GoogleSheetSchema(props: Props) {
const dispatch = useDispatch();
- // Fetch spreadsheets if datasourceId present
- useEffect(() => {
+ const scrollIntoView = (
+ elementId: string,
+ containerId: string,
+ offset: number = 0,
+ ) => {
+ try {
+ const element = document.querySelector(elementId);
+ const container = document.querySelector(containerId);
+ if (element && container) {
+ const elementRect = element.getBoundingClientRect();
+ const containerRect = container.getBoundingClientRect();
+ const scrollTop = container.scrollTop;
+
+ const scrollAmount =
+ elementRect.top - containerRect.top + scrollTop + offset;
+
+ container.scrollTop = scrollAmount;
+ }
+ } catch {}
+ };
+
+ const collapseAccordions = (
+ datasourceId: string,
+ spreadSheet?: string,
+ sheet?: string,
+ collapseSpreadsheet: boolean = true,
+ ) => {
+ if (!isEmpty(spreadSheet) && !isEmpty(sheet)) {
+ dispatch(
+ setEntityCollapsibleState(
+ `${datasourceId}-${spreadSheet}-${sheet}`,
+ false,
+ ),
+ );
+ }
+ if (!isEmpty(spreadSheet) && collapseSpreadsheet) {
+ dispatch(
+ setEntityCollapsibleState(`${datasourceId}-${spreadSheet}`, false),
+ );
+ }
+ };
+
+ const selectSpreadsheetAndToggle = (option: DropdownOption) => {
+ collapseAccordions(
+ datasource?.id || "",
+ selectedSpreadsheet.value,
+ selectedSheet.value,
+ );
+ setSelectedSheet(DEFAULT_DROPDOWN_OPTION);
+ setSheetOptions([]);
+ setSheetData(undefined);
+ dispatch(
+ setEntityCollapsibleState(`${datasource?.id}-${option.value}`, true),
+ );
+ scrollIntoView(
+ `#${CSS.escape(`entity-${datasource?.id}-${option.value}`)}`,
+ ".t--gsheet-structure",
+ );
+ setSelectedSpreadsheet(option);
+ fetchSheetsList({
+ requestObject: {},
+ selectedDatasourceId: props.datasourceId,
+ selectedSpreadsheetUrl: option.value || "",
+ pluginId: props.pluginId || "",
+ });
+ };
+
+ const selectSheetAndToggle = (option: DropdownOption) => {
+ collapseAccordions(
+ datasource?.id || "",
+ selectedSpreadsheet.value,
+ selectedSheet.value,
+ false,
+ );
+ dispatch(
+ setEntityCollapsibleState(
+ `${datasource?.id}-${selectedSpreadsheet.value}-${option.value}`,
+ true,
+ ),
+ );
+ scrollIntoView(
+ `#${CSS.escape(
+ `entity-${datasource?.id}-${selectedSpreadsheet.value}-${option.value}`,
+ )}`,
+ ".t--gsheet-structure",
+ -30,
+ );
+ setSelectedSheet(option);
+ setSheetData(undefined);
+ fetchSheetData({
+ selectedDatasourceId: datasource?.id || "",
+ selectedSpreadsheetUrl: selectedSpreadsheet.value || "",
+ selectedSheetName: option.value || "",
+ pluginId: props.pluginId || "",
+ });
+ };
+
+ const refetchAllSpreadsheets = () => {
if (!!props.datasourceId && !!props.pluginId) {
fetchAllSpreadsheets({
selectedDatasourceId: props.datasourceId,
pluginId: props.pluginId || "",
requestObject: {},
});
- }
- }, [props.datasourceId, props.pluginId, dispatch]);
-
- // When user selects a spreadsheet
- // Fetch all sheets inside that spreadsheet
- useEffect(() => {
- if (!!props.datasourceId && !!props.pluginId && selectedSpreadsheet.value) {
- setSelectedSheet(DEFAULT_DROPDOWN_OPTION);
- setCurrentSheetData(undefined);
- fetchSheetsList({
- requestObject: {},
- selectedDatasourceId: props.datasourceId,
- selectedSpreadsheetUrl: selectedSpreadsheet.value,
- pluginId: props.pluginId,
+ setSpreadsheetOptions([]);
+ setSheetOptions([]);
+ setSheetData(undefined);
+ setSelectedSpreadsheet((ss) => {
+ setSelectedSheet((s) => {
+ collapseAccordions(datasource?.id || "", ss.value, s.value);
+ return {};
+ });
+ return {};
});
}
- }, [
- selectedSpreadsheet.value,
- props.datasourceId,
- props.pluginId,
- dispatch,
- fetchSheetsList,
- ]);
+ };
- // When user selects a sheet name
- // Fetch all sheet data inside that sheet
+ // Fetch spreadsheets if datasourceId present
useEffect(() => {
- if (!!props.datasourceId && !!props.pluginId && selectedSheet.value) {
- setCurrentSheetData(undefined);
- fetchSheetData({
- selectedDatasourceId: props.datasourceId,
- selectedSpreadsheetUrl: selectedSpreadsheet.value || "",
- selectedSheetName: selectedSheet.value,
- pluginId: props.pluginId || "",
- });
- }
- }, [
- selectedSheet.value,
- props.datasourceId,
- props.pluginId,
- dispatch,
- fetchSheetData,
- ]);
+ fetchAllSpreadsheets({
+ selectedDatasourceId: props.datasourceId,
+ pluginId: props.pluginId || "",
+ requestObject: {},
+ });
+ }, [props.datasourceId, props.pluginId, dispatch]);
// Set first spreadsheet as default option in the dropdown
useEffect(() => {
- if (
- datasourceTableOptions?.length > 0 &&
- isEmpty(selectedSpreadsheet.value)
- ) {
- setSelectedSpreadsheet(datasourceTableOptions[0]);
+ if (spreadsheetOptions?.length > 0 && isEmpty(selectedSpreadsheet.value)) {
+ selectSpreadsheetAndToggle(spreadsheetOptions[0]);
}
- }, [selectedSpreadsheet, datasourceTableOptions]);
+ }, [selectedSpreadsheet, spreadsheetOptions]);
// Set first sheet as default option in the dropdown
useEffect(() => {
if (
- sheetsList?.length > 0 &&
+ sheetOptions?.length > 0 &&
isEmpty(selectedSheet.value) &&
- !isFetchingSheetsList
+ !isFetchingSheetsList &&
+ !isFetchingSpreadsheets
) {
- setSelectedSheet(sheetsList[0]);
+ selectSheetAndToggle(sheetOptions[0]);
}
- }, [selectedSheet, sheetsList, isFetchingSheetsList]);
+ }, [
+ selectedSheet,
+ sheetOptions,
+ isFetchingSheetsList,
+ isFetchingSpreadsheets,
+ ]);
- // Set current sheet data
useEffect(() => {
- if (sheetData) {
- // Getting the top 12 rows as for experimentation we need to keep this number fixed for preview
- AnalyticsUtil.logEvent("GSHEET_PREVIEW_DATA_SHOWN", {
- datasourceId: props.datasourceId,
- pluginId: props.pluginId,
- });
- setCurrentSheetData(sheetData.slice(0, MAX_SHEET_ROWS_LENGTH));
- }
- }, [sheetData]);
+ return () => {
+ collapseAccordions(
+ datasource?.id || "",
+ selectedSpreadsheet.value,
+ selectedSheet.value,
+ );
+ };
+ }, [datasource?.id]);
const onSelectSpreadsheet = (
table: string | undefined,
- tableObj: DatasourceTableDropdownOption | undefined,
+ tableObj: DropdownOption | undefined,
) => {
if (table && tableObj) {
AnalyticsUtil.logEvent("GSHEET_PREVIEW_SPREADSHEET_CHANGE", {
datasourceId: props.datasourceId,
pluginId: props.pluginId,
});
- setSelectedSpreadsheet(tableObj);
+ selectSpreadsheetAndToggle(tableObj);
}
};
@@ -255,25 +289,22 @@ function GoogleSheetSchema(props: Props) {
datasourceId: props.datasourceId,
pluginId: props.pluginId,
});
- setSelectedSheet(sheetObj);
+ selectSheetAndToggle(sheetObj);
}
};
- const isError = selectedDatasourceIsInvalid || failedFetchingSheetsList;
+ const isError =
+ selectedDatasourceIsInvalid ||
+ failedFetchingSheetsList ||
+ failedFetchingSheetData;
const isLoading =
- isFetchingSpreadsheets ||
- isFetchingSheetsList ||
- isFetchingSheetData ||
- (!isError && !currentSheetData);
+ isFetchingSpreadsheets || isFetchingSheetsList || isFetchingSheetData;
const onGsheetGeneratePage = () => {
const payload = {
applicationId: applicationId || "",
pageId: "",
- columns:
- !!currentSheetData && currentSheetData.length > 0
- ? Object.keys(currentSheetData[0])
- : [],
+ columns: sheetData?.length > 0 ? Object.keys(sheetData[0]) : [],
searchColumn: "",
tableName: selectedSheet?.value || "",
datasourceId: props.datasourceId || "",
@@ -312,76 +343,144 @@ function GoogleSheetSchema(props: Props) {
pagePermissions,
);
+ const refreshSpreadSheetButton = (option: DropdownOption) => (
+ <Button
+ isIconButton
+ kind="tertiary"
+ onClick={() => selectSpreadsheetAndToggle(option)}
+ startIcon="refresh"
+ />
+ );
+
const showGeneratePageBtn =
!isLoading &&
!isError &&
- currentSheetData &&
+ sheetData?.length &&
canCreateDatasourceActions &&
canCreatePages;
+ const filteredSpreadsheets = spreadsheetOptions.filter(
+ (option) => (option.label || "").toLowerCase()?.includes(searchString),
+ );
+
return (
- <>
- <SelectContainer>
- {!!props.datasourceId ? (
- <SelectListWrapper>
- <Text>Spreadsheet</Text>
- <SelectWrapper width={DROPDOWN_DIMENSION.WIDTH}>
- <Select
- data-testid="t--table-dropdown"
- isLoading={isFetchingSpreadsheets}
- onChange={(value: any) =>
- onSelectSpreadsheet(
- value,
- datasourceTableOptions.find(
- (table) => table.value === value,
- ) as DatasourceTableDropdownOption,
- )
- }
- value={selectedSpreadsheet}
- >
- {datasourceTableOptions.map((table) => {
- return (
- <Option key={table.value} value={table.value}>
- {table.label}
- </Option>
- );
- })}
- </Select>
- </SelectWrapper>
- </SelectListWrapper>
- ) : null}
- {selectedSpreadsheet.value ? (
- <SelectListWrapper>
- <Text>Sheet</Text>
- <SelectWrapper width={DROPDOWN_DIMENSION.WIDTH}>
- <Select
- data-testid="t--sheetName-dropdown"
- isLoading={isFetchingSheetsList}
- onChange={(value: any) =>
- onSelectSheetOption(
- value,
- sheetsList.find(
- (sheet: DropdownOption) => sheet.value === value,
- ),
- )
- }
- value={selectedSheet}
- >
- {sheetsList.map((sheet) => {
+ <ViewModeSchemaContainer>
+ <DataWrapperContainer>
+ <StructureContainer>
+ {datasource && (
+ <DatasourceStructureHeader
+ datasource={datasource}
+ paddingBottom
+ refetchFn={refetchAllSpreadsheets}
+ />
+ )}
+ <DatasourceListContainer className="t--gsheet-structure">
+ {!isFetchingSpreadsheets && (
+ <DatasourceStructureSearchContainer className="t--gsheet-search-container">
+ <SearchInput
+ className="datasourceStructure-search"
+ endIcon="close"
+ onChange={(value) => handleSearch(value)}
+ placeholder={createMessage(GSHEET_SEARCH_PLACEHOLDER)}
+ size={"sm"}
+ startIcon="search"
+ type="text"
+ />
+ </DatasourceStructureSearchContainer>
+ )}
+ <div className="t--gsheet-structure-list">
+ {isFetchingSpreadsheets ? (
+ <ItemLoadingIndicator type="SPREADSHEET" />
+ ) : (
+ filteredSpreadsheets.map((spreadsheet) => {
return (
- <Option key={sheet.label} value={sheet.label}>
- {sheet?.label}
- </Option>
+ <Entity
+ className="t--spreadsheet-structure"
+ customAddButton={refreshSpreadSheetButton(spreadsheet)}
+ entityId={`${datasource?.id}-${spreadsheet.value}`}
+ icon={null}
+ key={`${datasource?.id}-${spreadsheet.value}`}
+ name={spreadsheet.label as string}
+ onToggle={(isOpen) => {
+ isOpen &&
+ onSelectSpreadsheet(spreadsheet.value, spreadsheet);
+ }}
+ showAddButton={
+ spreadsheet.value === selectedSpreadsheet.value
+ }
+ step={0}
+ >
+ {isFetchingSheetsList ? (
+ <ItemLoadingIndicator type="SHEET" />
+ ) : sheetOptions.length > 0 ? (
+ sheetOptions.map((sheet) => (
+ <Entity
+ className={`t--sheet-structure ${
+ sheet.value === selectedSheet.value
+ ? "t--sheet-structure-active"
+ : ""
+ }`}
+ entityId={`${datasource?.id}-${selectedSpreadsheet.value}-${sheet.value}`}
+ icon={null}
+ key={`${datasource?.id}-${selectedSpreadsheet.value}-${sheet.value}`}
+ name={sheet.label as string}
+ onToggle={(isOpen) => {
+ isOpen && onSelectSheetOption(sheet.value, sheet);
+ }}
+ step={1}
+ >
+ {selectedSheet.value === sheet.value ? (
+ isFetchingSheetData ? (
+ <ItemLoadingIndicator type="DATA" />
+ ) : sheetData?.length > 0 ? (
+ <DatasourceAttributesWrapper>
+ {Object.keys(sheetData[0]).map(
+ (fieldValue, index) => (
+ <DatasourceField
+ field={{
+ name: fieldValue,
+ type: "string",
+ }}
+ key={`${fieldValue}${index}`}
+ step={2}
+ />
+ ),
+ )}
+ </DatasourceAttributesWrapper>
+ ) : null
+ ) : (
+ <ItemLoadingIndicator type="DATA" />
+ )}
+ </Entity>
+ ))
+ ) : (
+ <ItemLoadingIndicator type="SPREADSHEET" />
+ )}
+ </Entity>
);
- })}
- </Select>
- </SelectWrapper>
- </SelectListWrapper>
- ) : null}
- {showGeneratePageBtn && (
+ })
+ )}
+ </div>
+ </DatasourceListContainer>
+ </StructureContainer>
+ <DatasourceDataContainer>
+ <TableWrapper>
+ {isLoading ? (
+ <RenderInterimDataState state="LOADING" />
+ ) : isError ? (
+ <RenderInterimDataState state="FAILED" />
+ ) : sheetData?.length > 0 ? (
+ <Table data={sheetData} shouldResize={false} />
+ ) : (
+ <RenderInterimDataState state="NODATA" />
+ )}
+ </TableWrapper>
+ </DatasourceDataContainer>
+ </DataWrapperContainer>
+ {showGeneratePageBtn && (
+ <ButtonContainer>
<Button
className="t--datasource-generate-page"
- isDisabled={!currentSheetData || currentSheetData?.length == 0}
key="datasource-generate-page"
kind="secondary"
onClick={onGsheetGeneratePage}
@@ -389,29 +488,9 @@ function GoogleSheetSchema(props: Props) {
>
{createMessage(DATASOURCE_GENERATE_PAGE_BUTTON)}
</Button>
- )}
- </SelectContainer>
- <TableWrapper>
- {isLoading ? (
- <MessageWrapper>
- <Spinner size="md" />
- <Text style={{ marginLeft: "8px" }}>
- {createMessage(FETCHING_DATASOURCE_PREVIEW_DATA)}
- </Text>
- </MessageWrapper>
- ) : isError ? (
- <Text color="var(--ads-color-red-500)">
- {createMessage(ERR_FETCHING_DATASOURCE_PREVIEW_DATA)}
- </Text>
- ) : currentSheetData?.length > 0 ? (
- <Table data={currentSheetData} />
- ) : (
- <MessageWrapper>
- <Text>{createMessage(SCHEMA_PREVIEW_NO_DATA)}</Text>
- </MessageWrapper>
- )}
- </TableWrapper>
- </>
+ </ButtonContainer>
+ )}
+ </ViewModeSchemaContainer>
);
}
diff --git a/app/client/src/pages/Editor/DatasourceInfo/ItemLoadingIndicator.tsx b/app/client/src/pages/Editor/DatasourceInfo/ItemLoadingIndicator.tsx
new file mode 100644
index 000000000000..8e9407edef18
--- /dev/null
+++ b/app/client/src/pages/Editor/DatasourceInfo/ItemLoadingIndicator.tsx
@@ -0,0 +1,35 @@
+import React from "react";
+import {
+ createMessage,
+ GSHEET_DATA_LOADING,
+ GSHEET_SHEET_LOADING,
+ GSHEET_SPREADSHEET_LOADING,
+ LOADING_SCHEMA,
+} from "@appsmith/constants/messages";
+import { Spinner, Text } from "design-system";
+import { MessageWrapper } from "./SchemaViewModeCSS";
+
+type LoadingItemType = "SPREADSHEET" | "SHEET" | "DATA" | "SCHEMA";
+
+const ItemLoadingIndicator = ({ type }: { type: LoadingItemType }) => {
+ return (
+ <MessageWrapper
+ className={`t--item-loading-indicator t--item-loading-indicator--${type.toLowerCase()}`}
+ >
+ <Spinner size="md" />
+ <Text style={{ marginLeft: "8px" }}>
+ {createMessage(
+ type === "SPREADSHEET"
+ ? GSHEET_SPREADSHEET_LOADING
+ : type === "SHEET"
+ ? GSHEET_SHEET_LOADING
+ : type === "SCHEMA"
+ ? LOADING_SCHEMA
+ : GSHEET_DATA_LOADING,
+ )}
+ </Text>
+ </MessageWrapper>
+ );
+};
+
+export default ItemLoadingIndicator;
diff --git a/app/client/src/pages/Editor/DatasourceInfo/RenderInterimDataState.tsx b/app/client/src/pages/Editor/DatasourceInfo/RenderInterimDataState.tsx
new file mode 100644
index 000000000000..3f238f80475e
--- /dev/null
+++ b/app/client/src/pages/Editor/DatasourceInfo/RenderInterimDataState.tsx
@@ -0,0 +1,61 @@
+import React from "react";
+import EmptyTableSVG from "assets/images/empty-table-in-display-preview.svg";
+import { Spinner, Text } from "design-system";
+import {
+ EMPTY_TABLE_TITLE_TEXT,
+ EMPTY_TABLE_MESSAGE_TEXT,
+ createMessage,
+ EMPTY_TABLE_SVG_ALT_TEXT,
+ LOADING_RECORDS_MESSAGE_TEXT,
+ LOADING_RECORDS_TITLE_TEXT,
+ ERR_FETCHING_DATASOURCE_PREVIEW_DATA,
+} from "@appsmith/constants/messages";
+import { MessageWrapper, SchemaStateMessageWrapper } from "./SchemaViewModeCSS";
+
+type InterimState = "LOADING" | "NODATA" | "FAILED";
+
+interface RenderInterimDataStateProps {
+ state: InterimState;
+}
+
+const RenderInterimDataState = ({ state }: RenderInterimDataStateProps) => {
+ return (
+ <MessageWrapper>
+ <SchemaStateMessageWrapper>
+ {state === "NODATA" ? (
+ <>
+ {/* Render empty table image */}
+ <img
+ alt={createMessage(EMPTY_TABLE_SVG_ALT_TEXT)}
+ src={EmptyTableSVG}
+ />
+ {/* Show description below the image */}
+ {/* Show title */}
+ <Text style={{ fontWeight: "bold" }}>
+ {createMessage(EMPTY_TABLE_TITLE_TEXT)}
+ </Text>
+ {/* Show description */}
+ <Text>{createMessage(EMPTY_TABLE_MESSAGE_TEXT)}</Text>
+ </>
+ ) : state === "FAILED" ? (
+ <Text color="var(--ads-color-red-500)">
+ {createMessage(ERR_FETCHING_DATASOURCE_PREVIEW_DATA)}
+ </Text>
+ ) : state === "LOADING" ? (
+ <>
+ {/* Show spinner */}
+ <Spinner size="md" />
+ {/* Show title */}
+ <Text style={{ fontWeight: "bold" }}>
+ {createMessage(LOADING_RECORDS_TITLE_TEXT)}
+ </Text>
+ {/* Show description */}
+ <Text>{createMessage(LOADING_RECORDS_MESSAGE_TEXT)}</Text>
+ </>
+ ) : null}
+ </SchemaStateMessageWrapper>
+ </MessageWrapper>
+ );
+};
+
+export default RenderInterimDataState;
diff --git a/app/client/src/pages/Editor/DatasourceInfo/SchemaViewModeCSS.tsx b/app/client/src/pages/Editor/DatasourceInfo/SchemaViewModeCSS.tsx
new file mode 100644
index 000000000000..44535da78e6a
--- /dev/null
+++ b/app/client/src/pages/Editor/DatasourceInfo/SchemaViewModeCSS.tsx
@@ -0,0 +1,212 @@
+import styled from "styled-components";
+
+export const ViewModeSchemaContainer = styled.div`
+ height: 100%;
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+`;
+
+export const DataWrapperContainer = styled.div`
+ display: flex;
+ flex: 1;
+ overflow: hidden;
+ .t--datasource-column:hover {
+ background: none;
+ cursor: default;
+ }
+`;
+
+export const StructureContainer = styled.div`
+ height: 100%;
+ width: 25%;
+ padding: var(--ads-v2-spaces-4) 0 var(--ads-v2-spaces-4)
+ var(--ads-v2-spaces-5);
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ border-right: 1px solid var(--ads-v2-color-gray-300);
+ flex-shrink: 0;
+ & > .datasourceStructure-header {
+ padding: 0 var(--ads-v2-spaces-5);
+ }
+`;
+
+export const DatasourceDataContainer = styled.div`
+ height: 100%;
+ width: 75%;
+ display: flex;
+ flex-direction: column;
+`;
+
+export const DatasourceListContainer = styled.div`
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ padding-left: var(--ads-v2-spaces-5);
+ .t--entity.datasourceStructure-datasource-view-mode {
+ padding-right: var(--ads-v2-spaces-5);
+ }
+ &.t--gsheet-structure {
+ padding-bottom: var(--ads-v2-spaces-8);
+ .t--gsheet-structure-list {
+ overflow-y: auto;
+ flex-shrink: 1;
+ flex-grow: 0;
+ scrollbar-gutter: stable;
+ }
+ .t--spreadsheet-structure > .t--entity-item {
+ font-weight: var(--ads-v2-font-weight-bold);
+ height: 36px;
+ padding-left: 0;
+ & .ads-v2-button__content:hover {
+ background: none;
+ }
+ }
+ .t--spreadsheet-structure {
+ padding-right: var(--ads-spaces-3);
+ flex-grow: 0;
+ flex-shrink: 0;
+ }
+ .t--sheet-structure:not(:last-of-type) {
+ padding-bottom: var(--ads-spaces-3);
+ }
+ .t--sheet-structure .t--datasource-column {
+ padding-top: var(--ads-spaces-1);
+ padding-bottom: var(--ads-spaces-1);
+ }
+ .t--sheet-structure > .t--entity-item {
+ color: var(--ads-v2-color-gray-600);
+ height: 36px;
+ padding-left: var(--ads-spaces-10);
+ }
+ .t--sheet-structure .t--datasource-column {
+ color: var(--ads-v2-color-gray-600);
+ height: 30px;
+ padding-left: var(--ads-spaces-10);
+ }
+ .t--sheet-structure.t--sheet-structure-active > .t--entity-item {
+ background: var(--ads-v2-color-gray-100);
+ }
+ .t--sheet-structure .t--entity-name {
+ padding: var(--ads-spaces-2) 0;
+ }
+ }
+ .t--schema-virtuoso-container {
+ height: 100%;
+ }
+`;
+
+export const DatasourceAttributesWrapper = styled.div`
+ padding: var(--ads-spaces-1) 0 var(--ads-spaces-1) var(--ads-spaces-10);
+ .t--datasource-column > div > div:first-of-type {
+ padding-right: var(--ads-spaces-3);
+ }
+ .t--datasource-column > div > div:last-of-type {
+ flex-shrink: 0;
+ flex-grow: 0;
+ }
+`;
+
+export const ButtonContainer = styled.div`
+ display: flex;
+ flex-shrink: 0;
+ justify-content: flex-end;
+ border-top: 1px solid var(--ads-v2-color-gray-300);
+ padding: var(--ads-v2-spaces-4);
+`;
+
+export const MessageWrapper = styled.div`
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: auto;
+ &.t--item-loading-indicator {
+ justify-content: flex-start;
+ padding: var(--ads-spaces-1) 0 var(--ads-spaces-1) var(--ads-spaces-11);
+ }
+ &.t--item-loading-indicator--spreadsheet,
+ &.t--item-loading-indicator--schema {
+ padding-left: 0;
+ }
+`;
+
+export const SchemaStateMessageWrapper = styled.div`
+ width: auto;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ position: relative;
+ img {
+ padding-bottom: var(--ads-v2-spaces-7);
+ }
+ span:first-child {
+ padding-bottom: var(--ads-v2-spaces-2);
+ }
+`;
+
+export const TableWrapper = styled.div`
+ overflow-x: auto;
+ height: 100%;
+ && > div {
+ width: 100%;
+ }
+
+ && > ${MessageWrapper} {
+ width: 100%;
+ height: 100%;
+ }
+ && .t--table-response {
+ border: none;
+ height: 100%;
+ overflow: hidden;
+ }
+ && .tableWrap {
+ overflow: auto;
+ }
+ & .table {
+ background: none;
+ & > div:first-child {
+ position: sticky;
+ top: 0;
+ z-index: 1;
+ }
+ & .draggable-header {
+ cursor: default;
+ }
+ }
+ & .table div:first-of-type .tr {
+ background: var(--ads-v2-color-black-5);
+ border-right: none;
+ border-bottom: 1px solid var(--ads-v2-color-black-75);
+ }
+ && .table div.tbody .tr {
+ background: var(--ads-v2-color-white);
+ border-bottom: 1px solid var(--ads-v2-color-black-75);
+ }
+ && .table .td,
+ && .table .th {
+ border-right: none;
+ border-bottom: none;
+ }
+ button {
+ margin-right: 24px;
+ }
+ && .tableWrap {
+ }
+`;
+
+export const DatasourceStructureSearchContainer = styled.div`
+ margin: var(--ads-v2-spaces-3) 0 var(--ads-v2-spaces-4) 0;
+ background: white;
+ flex-shrink: 0;
+ padding-right: var(--ads-v2-spaces-5);
+ &.t--gsheet-search-container {
+ margin-top: var(--ads-v2-spaces-4);
+ margin-bottom: var(--ads-v2-spaces-3);
+ }
+ &.t--search-container--query-editor {
+ padding-right: 0;
+ }
+`;
diff --git a/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/hooks.ts b/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/hooks.ts
index 30aff491512d..4e8361f9bb84 100644
--- a/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/hooks.ts
+++ b/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/hooks.ts
@@ -272,7 +272,17 @@ export interface UseSheetDataReturn {
}: FetchSheetData) => void;
}
-export const useSheetsList = (): UseSheetListReturn => {
+export interface UseSheetListProps {
+ setSheetOptions?: (tableOptions: DropdownOptions) => void;
+}
+
+export interface UseSheetDataProps {
+ setSheetData?: (tableOptions: DropdownOptions) => void;
+}
+
+export const useSheetsList = (
+ props: UseSheetListProps = {},
+): UseSheetListReturn => {
const dispatch = useDispatch();
const [sheetsList, setSheetsList] = useState<DropdownOption[]>([]);
@@ -298,12 +308,13 @@ export const useSheetsList = (): UseSheetListReturn => {
const responseBody = payload.data.trigger;
if (Array.isArray(responseBody)) {
setSheetsList(responseBody);
+ props.setSheetOptions && props.setSheetOptions(responseBody);
} else {
// to handle error like "401 Unauthorized"
}
}
},
- [setSheetsList, setIsFetchingSheetsList],
+ [setSheetsList, setIsFetchingSheetsList, props.setSheetOptions],
);
const fetchSheetsList = useCallback(
@@ -314,6 +325,7 @@ export const useSheetsList = (): UseSheetListReturn => {
selectedSpreadsheetUrl,
}: FetchSheetsList) => {
setSheetsList([]);
+ props.setSheetOptions && props.setSheetOptions([]);
setIsFetchingSheetsList(true);
setFailedFetchingSheetsList(false);
const formattedRequestData = {
@@ -343,6 +355,7 @@ export const useSheetsList = (): UseSheetListReturn => {
onFetchAllSheetFailure,
setIsFetchingSheetsList,
setFailedFetchingSheetsList,
+ props.setSheetOptions,
],
);
@@ -354,7 +367,9 @@ export const useSheetsList = (): UseSheetListReturn => {
};
};
-export const useSheetData = (): UseSheetDataReturn => {
+export const useSheetData = (
+ props: UseSheetDataProps = {},
+): UseSheetDataReturn => {
const dispatch = useDispatch();
const [sheetData, setSheetData] = useState<any>([]);
@@ -380,12 +395,13 @@ export const useSheetData = (): UseSheetDataReturn => {
const responseBody = payload.data.trigger;
if (Array.isArray(responseBody)) {
setSheetData(responseBody);
+ props.setSheetData && props.setSheetData(responseBody);
} else {
// to handle error like "401 Unauthorized"
}
}
},
- [setSheetData, setIsFetchingSheetData],
+ [setSheetData, setIsFetchingSheetData, props.setSheetData],
);
const fetchSheetData = useCallback(
@@ -396,6 +412,7 @@ export const useSheetData = (): UseSheetDataReturn => {
selectedSpreadsheetUrl,
}: FetchSheetData) => {
setSheetData([]);
+ props.setSheetData && props.setSheetData([]);
setIsFetchingSheetData(true);
setFailedFetchingSheetData(false);
const formattedRequestData = {
@@ -428,6 +445,7 @@ export const useSheetData = (): UseSheetDataReturn => {
onFetchAllSheetFailure,
setIsFetchingSheetData,
setFailedFetchingSheetData,
+ props.setSheetData,
],
);
diff --git a/app/client/src/pages/Editor/QueryEditor/Table.tsx b/app/client/src/pages/Editor/QueryEditor/Table.tsx
index 8e8683a16609..af64c5e2a307 100644
--- a/app/client/src/pages/Editor/QueryEditor/Table.tsx
+++ b/app/client/src/pages/Editor/QueryEditor/Table.tsx
@@ -17,6 +17,7 @@ import type { Theme } from "constants/DefaultTheme";
interface TableProps {
data: Record<string, any>[];
tableBodyHeight?: number;
+ shouldResize?: boolean;
}
const TABLE_SIZES = {
@@ -208,6 +209,7 @@ export const getScrollBarWidth = (tableBodyEle: any, scrollBarW: number) => {
function Table(props: TableProps) {
const theme = useTheme() as Theme;
const tableBodyRef = React.useRef<HTMLElement>();
+ const { shouldResize = true } = props;
const data = React.useMemo(() => {
/* Check for length greater than 0 of rows returned from the query for mappings keys */
@@ -346,12 +348,14 @@ function Table(props: TableProps) {
>
<AutoToolTipComponent title={column.render("Header")}>
{column.render("Header")}
- <div
- {...column.getResizerProps()}
- className={`resizer ${
- column.isResizing ? "isResizing" : ""
- }`}
- />
+ {shouldResize && (
+ <div
+ {...column.getResizerProps()}
+ className={`resizer ${
+ column.isResizing ? "isResizing" : ""
+ }`}
+ />
+ )}
</AutoToolTipComponent>
</div>
</div>
diff --git a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
index 38ea342435e2..d85866331f27 100644
--- a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
+++ b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
@@ -90,7 +90,7 @@ import {
} from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
-import GoogleSheetSchema from "../DatasourceInfo/GoogleSheetSchema";
+import DatasourceTabs from "../DatasourceInfo/DatasorceTabs";
const ViewModeContainer = styled.div`
display: flex;
@@ -468,13 +468,77 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
}
renderDatasourceInfo = () => {
- const { datasource, formConfig, viewMode } = this.props;
+ const {
+ datasource,
+ formConfig,
+ formData,
+ isPluginAuthFailed,
+ isPluginAuthorized,
+ pageId,
+ plugin,
+ pluginPackageName,
+ viewMode,
+ } = this.props;
+ const isGoogleSheetPlugin = isGoogleSheetPluginDS(pluginPackageName);
+ const authErrorMessage = getDatasourceErrorMessage(
+ formData,
+ plugin,
+ this.state.filterParams.id,
+ );
+ const hideDatasourceSection =
+ isGoogleSheetPlugin &&
+ !isPluginAuthorized &&
+ authErrorMessage == GSHEET_AUTHORIZATION_ERROR;
+
return (
- <DatasourceInformation
- config={formConfig[0]}
- datasource={datasource}
- viewMode={viewMode}
- />
+ <ViewModeWrapper data-testid="t--ds-review-section">
+ {datasource &&
+ isGoogleSheetPlugin &&
+ isPluginAuthFailed &&
+ datasource.id !== TEMP_DATASOURCE_ID && (
+ <AuthMessage
+ actionType={ActionType.AUTHORIZE}
+ datasource={datasource}
+ description={authErrorMessage}
+ isInViewMode
+ pageId={pageId}
+ />
+ )}
+ {!isNil(formConfig) && !isNil(datasource) && !hideDatasourceSection && (
+ <DatasourceInformation
+ config={formConfig[0]}
+ datasource={datasource}
+ viewMode={viewMode}
+ />
+ )}
+ </ViewModeWrapper>
+ );
+ };
+
+ shouldShowTabs = () => {
+ const { datasource, isPluginAuthorized, pluginPackageName } = this.props;
+
+ const isGoogleSheetPlugin = isGoogleSheetPluginDS(pluginPackageName);
+
+ const isGoogleSheetSchemaAvailable =
+ isGoogleSheetPlugin && isPluginAuthorized;
+
+ return isGoogleSheetSchemaAvailable && datasource;
+ };
+
+ renderTabsForViewMode = () => {
+ const { datasource } = this.props;
+ return (
+ <ViewModeContainer>
+ {this.shouldShowTabs() ? (
+ <DatasourceTabs
+ configChild={this.renderDatasourceInfo()}
+ datasource={datasource as Datasource}
+ />
+ ) : (
+ this.renderDatasourceInfo()
+ )}
+ </ViewModeContainer>
);
};
@@ -486,7 +550,6 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
datasource,
datasourceButtonConfiguration,
datasourceId,
- formConfig,
formData,
gsheetProjectID,
gsheetToken,
@@ -526,13 +589,8 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
GOOGLE_SHEETS_INFO_BANNER_MESSAGE,
);
- const hideDatasourceSection =
- isGoogleSheetPlugin &&
- !isPluginAuthorized &&
- authErrorMessage == GSHEET_AUTHORIZATION_ERROR;
-
- const isGoogleSheetSchemaAvailable =
- isGoogleSheetPlugin && isPluginAuthorized;
+ const showingTabsOnViewMode =
+ this.shouldShowTabs() && viewMode && !isInsideReconnectModal;
return (
<>
@@ -546,6 +604,7 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
isDeleting={isDeleting}
isNewDatasource={createFlow}
isPluginAuthorized={isPluginAuthorized}
+ noBottomBorder={showingTabsOnViewMode}
pluginImage={pluginImage}
pluginName={plugin?.name || ""}
pluginType={plugin?.type || ""}
@@ -554,7 +613,11 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
/>
)}
<ResizerMainContainer>
- <ResizerContentContainer className="saas-form-resizer-content">
+ <ResizerContentContainer
+ className={`saas-form-resizer-content ${
+ showingTabsOnViewMode && "saas-form-resizer-content-show-tabs"
+ }`}
+ >
<DSEditorWrapper>
<DSDataFilter
filterId={this.state.filterParams.id}
@@ -601,35 +664,9 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
{""}
</>
)}
- {viewMode && !isInsideReconnectModal && (
- <ViewModeContainer>
- <ViewModeWrapper>
- {datasource &&
- isGoogleSheetPlugin &&
- isPluginAuthFailed ? (
- <AuthMessage
- actionType={ActionType.AUTHORIZE}
- datasource={datasource}
- description={authErrorMessage}
- isInViewMode
- pageId={pageId}
- />
- ) : null}
- {!isNil(formConfig) &&
- !isNil(datasource) &&
- !hideDatasourceSection
- ? this.renderDatasourceInfo()
- : undefined}
- </ViewModeWrapper>
- {isGoogleSheetSchemaAvailable && datasource && (
- <GoogleSheetSchema
- datasourceId={datasourceId}
- key={datasourceId}
- pluginId={plugin?.id}
- />
- )}
- </ViewModeContainer>
- )}
+ {viewMode &&
+ !isInsideReconnectModal &&
+ this.renderTabsForViewMode()}
</Form>
{/* Render datasource form call-to-actions */}
{datasource && (
diff --git a/app/client/src/widgets/TableWidget/component/TableStyledWrappers.tsx b/app/client/src/widgets/TableWidget/component/TableStyledWrappers.tsx
index f376e6ed6038..d88287132bc4 100644
--- a/app/client/src/widgets/TableWidget/component/TableStyledWrappers.tsx
+++ b/app/client/src/widgets/TableWidget/component/TableStyledWrappers.tsx
@@ -622,4 +622,5 @@ export const ColumnWrapper = styled.div`
display: flex;
align-items: center;
height: 100%;
+ width: 100%;
`;
|
8dc015e2a931ea676e2998dff9d174535e4bbf25
|
2023-09-13 11:39:56
|
Dipyaman Biswas
|
fix: fix 404 crash happening during first load (#27229)
| false
|
fix 404 crash happening during first load (#27229)
|
fix
|
diff --git a/app/client/src/ce/utils/BusinessFeatures/brandingPageHelpers.tsx b/app/client/src/ce/utils/BusinessFeatures/brandingPageHelpers.tsx
index 3dad0c7208ee..0bfc906c87f7 100644
--- a/app/client/src/ce/utils/BusinessFeatures/brandingPageHelpers.tsx
+++ b/app/client/src/ce/utils/BusinessFeatures/brandingPageHelpers.tsx
@@ -3,11 +3,11 @@ import { default as UpgradeBanner_CE } from "ce/pages/AdminSettings/Branding/Upg
import { default as UpgradeBanner_EE } from "@appsmith/pages/AdminSettings/Branding/UpgradeBanner";
import React from "react";
import {
- useHtmlPageTitle as useHtmlPageTitle_CE,
+ getHtmlPageTitle as getHtmlPageTitle_CE,
getPageTitle as getPageTitle_CE,
} from "ce/utils";
import {
- useHtmlPageTitle as useHtmlPageTitle_EE,
+ getHtmlPageTitle as getHtmlPageTitle_EE,
getPageTitle as getPageTitle_EE,
} from "@appsmith/utils";
@@ -17,18 +17,22 @@ export const getUpgradeBanner = (isEnabled: boolean) => {
} else return <UpgradeBanner_CE />;
};
-export const getHTMLPageTitle = (isEnabled: boolean) => {
+export const getHTMLPageTitle = (isEnabled: boolean, instanceName: string) => {
if (isEnabled) {
- return useHtmlPageTitle_EE;
+ return getHtmlPageTitle_EE(instanceName);
} else {
- return useHtmlPageTitle_CE;
+ return getHtmlPageTitle_CE(instanceName);
}
};
-export const getPageTitle = (isEnabled: boolean) => {
+export const getPageTitle = (
+ isEnabled: boolean,
+ displayName: string | undefined,
+ titleSuffix: string | undefined,
+) => {
if (isEnabled) {
- return getPageTitle_EE;
+ return getPageTitle_EE(displayName, titleSuffix);
} else {
- return getPageTitle_CE;
+ return getPageTitle_CE(displayName, titleSuffix);
}
};
diff --git a/app/client/src/ce/utils/index.ts b/app/client/src/ce/utils/index.ts
index 1f508e35f3b2..bc96aff19ed4 100644
--- a/app/client/src/ce/utils/index.ts
+++ b/app/client/src/ce/utils/index.ts
@@ -11,7 +11,8 @@ export const addItemsInContextMenu = (
return moreActionItems;
};
-export const useHtmlPageTitle = () => {
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+export const getHtmlPageTitle = (instanceName: string) => {
return "Appsmith";
};
diff --git a/app/client/src/pages/UserAuth/Login.tsx b/app/client/src/pages/UserAuth/Login.tsx
index 312674e6685c..45db178e44ee 100644
--- a/app/client/src/pages/UserAuth/Login.tsx
+++ b/app/client/src/pages/UserAuth/Login.tsx
@@ -45,6 +45,7 @@ import Container from "pages/UserAuth/Container";
import {
getThirdPartyAuths,
getIsFormLoginEnabled,
+ getTenantConfig,
} from "@appsmith/selectors/tenantSelectors";
import Helmet from "react-helmet";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
@@ -93,8 +94,9 @@ export function Login(props: LoginFormProps) {
const isBrandingEnabled = useFeatureFlag(
FEATURE_FLAG.license_branding_enabled,
);
- const pageTitle = getHTMLPageTitle(isBrandingEnabled);
- const htmlPageTitle = pageTitle();
+ const tentantConfig = useSelector(getTenantConfig);
+ const { instanceName } = tentantConfig;
+ const htmlPageTitle = getHTMLPageTitle(isBrandingEnabled, instanceName);
const invalidCredsForgotPasswordLinkText = createMessage(
LOGIN_PAGE_INVALID_CREDS_FORGOT_PASSWORD_LINK,
);
diff --git a/app/client/src/pages/UserAuth/SignUp.tsx b/app/client/src/pages/UserAuth/SignUp.tsx
index 25e2188c3292..0a87f65947c4 100644
--- a/app/client/src/pages/UserAuth/SignUp.tsx
+++ b/app/client/src/pages/UserAuth/SignUp.tsx
@@ -45,6 +45,7 @@ import { getIsSafeRedirectURL } from "utils/helpers";
import Container from "pages/UserAuth/Container";
import {
getIsFormLoginEnabled,
+ getTenantConfig,
getThirdPartyAuths,
} from "@appsmith/selectors/tenantSelectors";
import Helmet from "react-helmet";
@@ -104,8 +105,9 @@ export function SignUp(props: SignUpFormProps) {
const isBrandingEnabled = useFeatureFlag(
FEATURE_FLAG.license_branding_enabled,
);
- const pageTitle = getHTMLPageTitle(isBrandingEnabled);
- const htmlPageTitle = pageTitle();
+ const tentantConfig = useSelector(getTenantConfig);
+ const { instanceName } = tentantConfig;
+ const htmlPageTitle = getHTMLPageTitle(isBrandingEnabled, instanceName);
const recaptchaStatus = useScript(
`https://www.google.com/recaptcha/api.js?render=${googleRecaptchaSiteKey.apiKey}`,
diff --git a/app/client/src/pages/common/PageWrapper.tsx b/app/client/src/pages/common/PageWrapper.tsx
index a20966b78dd4..00092f0325a5 100644
--- a/app/client/src/pages/common/PageWrapper.tsx
+++ b/app/client/src/pages/common/PageWrapper.tsx
@@ -1,14 +1,16 @@
import type { ReactNode } from "react";
-import React from "react";
+import React, { useMemo } from "react";
import { Helmet } from "react-helmet";
import styled from "styled-components";
import { Banner } from "@appsmith/utils/licenseHelpers";
import {
- getHTMLPageTitle,
getPageTitle,
+ getHTMLPageTitle,
} from "@appsmith/utils/BusinessFeatures/brandingPageHelpers";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
+import { getTenantConfig } from "@appsmith/selectors/tenantSelectors";
+import { useSelector } from "react-redux";
export const Wrapper = styled.section<{ isFixed?: boolean }>`
${(props) =>
@@ -65,18 +67,26 @@ export type PageWrapperProps = {
export function PageWrapper(props: PageWrapperProps) {
const { isFixed = false, isSavable = false } = props;
const isBrandingEnabled = useFeatureFlag(
- FEATURE_FLAG.license_branding_enabled,
+ FEATURE_FLAG?.license_branding_enabled,
);
- const htmlPageTitleMethod = getHTMLPageTitle(isBrandingEnabled);
- const titleSuffix = htmlPageTitleMethod();
+ const tentantConfig = useSelector(getTenantConfig);
+ const { instanceName } = tentantConfig;
- const getPageTitleMethod = getPageTitle(isBrandingEnabled);
+ const titleSuffix = useMemo(
+ () => getHTMLPageTitle(isBrandingEnabled, instanceName),
+ [isBrandingEnabled, instanceName],
+ );
+
+ const pageTitle = useMemo(
+ () => getPageTitle(isBrandingEnabled, props.displayName, titleSuffix),
+ [isBrandingEnabled, props.displayName, titleSuffix],
+ );
return (
<Wrapper isFixed={isFixed}>
<Banner />
<Helmet>
- <title>{getPageTitleMethod(props.displayName, titleSuffix)}</title>
+ <title>{pageTitle}</title>
</Helmet>
<PageBody isSavable={isSavable}>{props.children}</PageBody>
</Wrapper>
|
ec246fdf986d243a553a6e435b6e3d7564fde8eb
|
2024-11-06 19:59:58
|
Alex
|
fix: adjust spacing for filter/sort/pagination form controls (#37221)
| false
|
adjust spacing for filter/sort/pagination form controls (#37221)
|
fix
|
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/styles.module.css b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/styles.module.css
index b63260f2d7d1..0af35a6d69c7 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/styles.module.css
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/styles.module.css
@@ -51,35 +51,7 @@
}
}
}
- /* PaginationControl hardcoded width is removed */
- & :global(.t--form-control-PAGINATION) {
- & > div {
- grid-gap: 1rem !important;
- grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
-
- & > div {
- width: unset !important;
- margin-right: 0 !important;
- }
- }
- }
- /* SortingControl hardcoded width is removed */
- & :global(.t--form-control-SORTING) {
- & :global(.sorting-dropdown-container) {
- width: unset;
- & > div {
- width: 100%;
- flex: 1;
- }
- }
- }
- /* WhereClauseControl hardcoded width is removed */
- & :global(.t--form-control-WHERE_CLAUSE) {
- & > div {
- padding-right: 0 !important;
- }
- }
/* DynamicInputTextControl min height and width removed */
& :global(.uqi-dynamic-input-text) {
width: unset !important;
diff --git a/app/client/src/components/formControls/PaginationControl.tsx b/app/client/src/components/formControls/PaginationControl.tsx
index d66a04a82c51..532f71877feb 100644
--- a/app/client/src/components/formControls/PaginationControl.tsx
+++ b/app/client/src/components/formControls/PaginationControl.tsx
@@ -10,7 +10,6 @@ import { PaginationSubComponent } from "components/formControls/utils";
export const StyledFormLabel = styled(FormLabel)`
margin-top: 5px;
- /* font-weight: 400; */
font-size: 12px;
color: var(--ads-v2-color-fg-muted);
line-height: 12px;
@@ -19,14 +18,13 @@ export const StyledFormLabel = styled(FormLabel)`
export const FormControlContainer = styled.div`
display: flex;
flex-direction: column;
- width: 270px;
- margin-right: 1rem;
`;
const PaginationContainer = styled.div`
display: grid;
- grid-gap: 5px 5px;
- grid-template-columns: repeat(auto-fill, 270px);
+ column-gap: var(--ads-v2-spaces-4);
+ row-gap: var(--ads-v2-spaces-2);
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
`;
// using query dynamic input text for both so user can dynamically change these values.
@@ -36,9 +34,6 @@ const valueFieldConfig: any = {
key: "value",
controlType: "QUERY_DYNAMIC_INPUT_TEXT",
placeholderText: "value",
- customStyles: {
- // width: "280px",
- },
};
// TODO: Fix this the next time the file is edited
@@ -91,7 +86,6 @@ export function Pagination(props: {
);
const defaultStyles = {
- // width: "280px",
...customStyles,
};
@@ -115,7 +109,6 @@ export function Pagination(props: {
/>
<StyledFormLabel>Limits the number of rows returned.</StyledFormLabel>
</FormControlContainer>
-
{/* form control for Offset field */}
<FormControlContainer>
<FormControl
diff --git a/app/client/src/components/formControls/SortingControl.tsx b/app/client/src/components/formControls/SortingControl.tsx
index 9f8454edde98..93e718ac3d88 100644
--- a/app/client/src/components/formControls/SortingControl.tsx
+++ b/app/client/src/components/formControls/SortingControl.tsx
@@ -54,13 +54,13 @@ const orderFieldConfig: any = {
const SortingContainer = styled.div`
display: flex;
- gap: 5px;
+ gap: var(--ads-v2-spaces-4);
flex-direction: column;
`;
const SortingDropdownContainer = styled.div`
display: flex;
- gap: 5px;
+ gap: var(--ads-v2-spaces-4);
`;
const SortingFields = styled.div<{ isBreakpointSmall: boolean }>`
@@ -69,7 +69,9 @@ const SortingFields = styled.div<{ isBreakpointSmall: boolean }>`
isBreakpointSmall ? "1fr" : "1fr 180px"};
grid-template-rows: ${({ isBreakpointSmall }) =>
isBreakpointSmall ? "1fr 1fr" : "1fr"};
- gap: 5px;
+ column-gap: var(--ads-v2-spaces-4);
+ row-gap: var(--ads-v2-spaces-2);
+ width: 100%;
`;
const ButtonWrapper = styled.div`
@@ -159,9 +161,6 @@ function SortingComponent(props: SortingComponentProps) {
<FormControl
config={{
...columnFieldConfig,
- customStyles: {
- width: "100%",
- },
configProperty: columnPath,
nestedFormControl: true,
}}
diff --git a/app/client/src/components/formControls/WhereClauseControl.tsx b/app/client/src/components/formControls/WhereClauseControl.tsx
index b220801ea7d2..3ac3f2fce376 100644
--- a/app/client/src/components/formControls/WhereClauseControl.tsx
+++ b/app/client/src/components/formControls/WhereClauseControl.tsx
@@ -90,7 +90,7 @@ const CenteredIconButton = styled(Button)<{
`;
// We are setting a background color for the last two nested levels
-const handleSecondaryBoxBackgroudColor = (
+const handleSecondaryBoxBackgroundColor = (
currentNestingLevel: number,
nestedLevels: number,
) => {
@@ -113,11 +113,12 @@ const SecondaryBox = styled.div<{
display: flex;
flex-direction: column;
position: relative;
- border-radius: var(--ads-v2-border-radius);
border: solid 1px var(--ads-v2-color-border);
+ border-radius: var(--ads-v2-border-radius);
border-width: ${(props) => (props?.showBorder ? "1px" : "0px")};
padding: ${(props) =>
- props?.showBorder ? "0px 12px 12px 8px" : "4px 12px 12px 0px"};
+ props?.showBorder ? "0px 12px 12px 8px" : "4px 0px 12px 0px"};
+
width: 100%;
// Setting a max width to not have it really elongate on very large screens
max-width: 2000px;
@@ -125,11 +126,10 @@ const SecondaryBox = styled.div<{
${(props) =>
props.size === "small" &&
`
- ${handleSecondaryBoxBackgroudColor(
+ ${handleSecondaryBoxBackgroundColor(
props.currentNestingLevel,
props.nestedLevels,
)}
- padding-bottom: 12px;
`}
`;
@@ -139,14 +139,13 @@ const ConditionWrapper = styled.div<{ size: string }>`
flex-direction: row;
align-items: center;
width: 100%;
- gap: 5px;
+ gap: var(--ads-v2-spaces-4);
margin-top: var(--ads-v2-spaces-3);
margin-bottom: 5px;
${(props) =>
props.size === "small" &&
`
- // margin-top: 0px;
gap: 0px;
flex-direction: column;
align-items: start;
@@ -163,8 +162,8 @@ const ConditionBox = styled.div<{ size?: string }>`
// The 4 elements(3 input fields and a close button) are horizontally aligned
// by default
grid-template-columns: auto 100px auto max-content;
- grid-column-gap: 5px;
- grid-row-gap: 5px;
+ column-gap: var(--ads-v2-spaces-4);
+ row-gap: var(--ads-v2-spaces-2);
width: 100%;
${(props) =>
@@ -178,7 +177,7 @@ const ConditionBox = styled.div<{ size?: string }>`
// are verticall aligned one below the other.
grid-template-columns: repeat(2, max-content);
grid-template-rows: repeat(3, max-content);
- grid-column-gap: 5px;
+ column-gap: var(--ads-v2-spaces-4);
// The three input fields will be in the first column
& :not(:nth-child(4)) {
grid-column-start: 1;
@@ -196,7 +195,7 @@ const ConditionBox = styled.div<{ size?: string }>`
const ActionBox = styled.div<{ marginLeft: string; size: string }>`
display: flex;
flex-direction: row;
- gap: 5px;
+ row-gap: var(--ads-v2-spaces-2);
background-color: inherit;
margin-left: ${(props) => props.marginLeft};
@@ -210,16 +209,15 @@ const ActionBox = styled.div<{ marginLeft: string; size: string }>`
const GroupConditionBox = styled.div<{ size: string }>`
display: flex;
flex-direction: row;
- gap: 5px;
+ gap: var(--ads-v2-spaces-4);
width: 100%;
${(props) =>
props.size === "small" &&
`
- gap: 5px;
- margin: 5px 0px;
- flex-direction: row;
- min-width: max-content;
+ margin: 5px 0px;
+ flex-direction: row;
+ min-width: max-content;
`}
`;
@@ -308,9 +306,8 @@ function ConditionBlock(props: any) {
// Smallest width of the component below which the individual input fields don't
// decrease in width anymore so we decide to shift to small space layout at this point
const size = useResponsiveBreakpoints(targetRef, [{ small: 505 }]);
- // TODO: Fix this the next time the file is edited
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const formValues: any = useSelector((state) =>
+
+ const formValues = useSelector((state) =>
getFormValues(props.formName)(state),
);
@@ -413,6 +410,7 @@ function ConditionBlock(props: any) {
<CenteredIconButton
alignSelf={"start"}
data-testid={`t--where-clause-delete-[${index}]`}
+ isIconButton
kind="tertiary"
onClick={(e: React.MouseEvent) => {
e.stopPropagation();
diff --git a/app/client/src/pages/Editor/FormConfig.tsx b/app/client/src/pages/Editor/FormConfig.tsx
index f9de6a8cf704..b71ebbe81a4f 100644
--- a/app/client/src/pages/Editor/FormConfig.tsx
+++ b/app/client/src/pages/Editor/FormConfig.tsx
@@ -204,10 +204,7 @@ function renderFormConfigTop(props: {
return (
<div className="form-config-top" key={props.config.label}>
{!nestedFormControl && // if the form control is a nested form control hide its label
- (label?.length > 0 ||
- encrypted ||
- tooltipText ||
- shouldRenderSubtitle) && (
+ (label?.length > 0 || encrypted || shouldRenderSubtitle) && (
<>
<FlexWrapper>
<FormLabel
diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/editor/fetch_many.json b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/editor/fetch_many.json
index cbb21cb0f91f..67aa325d2728 100644
--- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/editor/fetch_many.json
+++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/editor/fetch_many.json
@@ -198,6 +198,7 @@
},
"children": [
{
+ "label": "",
"configProperty": "actionConfiguration.formData.pagination.data",
"controlType": "PAGINATION",
"-subtitle": "Object",
|
928242d79b690a70258750bdf4fcb8fc52ee409c
|
2021-09-07 18:15:04
|
Rishabh Saxena
|
fix: center alignment for profile placeholder (#7197)
| false
|
center alignment for profile placeholder (#7197)
|
fix
|
diff --git a/app/client/src/pages/common/ProfileImage.tsx b/app/client/src/pages/common/ProfileImage.tsx
index a1a730e2af69..d5e9c240992f 100644
--- a/app/client/src/pages/common/ProfileImage.tsx
+++ b/app/client/src/pages/common/ProfileImage.tsx
@@ -14,6 +14,7 @@ export const Profile = styled.div<{ backgroundColor?: string; side?: number }>`
background-color: ${(props) => props.backgroundColor};
&& span {
color: ${(props) => props.theme.colors.text.highlight};
+ letter-spacing: normal;
}
img {
|
7ff703c7ded563f3c92112d6d7f7b5f5073b21bb
|
2024-10-16 18:29:10
|
Hetu Nandu
|
chore: Migrate sub components into Plugin Action Editor (#36844)
| false
|
Migrate sub components into Plugin Action Editor (#36844)
|
chore
|
diff --git a/app/client/src/PluginActionEditor/PluginActionEditor.tsx b/app/client/src/PluginActionEditor/PluginActionEditor.tsx
index 8eaa3bc51bac..ec035c0363a4 100644
--- a/app/client/src/PluginActionEditor/PluginActionEditor.tsx
+++ b/app/client/src/PluginActionEditor/PluginActionEditor.tsx
@@ -1,6 +1,4 @@
import React from "react";
-import { useLocation } from "react-router";
-import { identifyEntityFromPath } from "../navigation/FocusEntity";
import { useSelector } from "react-redux";
import {
getActionByBaseId,
@@ -20,15 +18,15 @@ import { useActionSettingsConfig } from "./hooks";
interface ChildrenProps {
children: React.ReactNode | React.ReactNode[];
+ actionId: string;
}
const PluginActionEditor = (props: ChildrenProps) => {
- const { pathname } = useLocation();
-
const isEditorInitialized = useIsEditorInitialised();
- const entity = identifyEntityFromPath(pathname);
- const action = useSelector((state) => getActionByBaseId(state, entity.id));
+ const action = useSelector((state) =>
+ getActionByBaseId(state, props.actionId),
+ );
const pluginId = get(action, "pluginId", "");
const plugin = useSelector((state) => getPlugin(state, pluginId));
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx
index 27464dcb3efc..d7ac7a21385a 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx
@@ -1,11 +1,11 @@
import React from "react";
-import APIEditorForm from "./components/APIEditorForm";
import { Flex } from "@appsmith/ads";
import { useChangeActionCall } from "./hooks/useChangeActionCall";
import { usePluginActionContext } from "../../PluginActionContext";
import { UIComponentTypes } from "api/PluginApi";
-import GraphQLEditorForm from "./components/GraphQLEditor/GraphQLEditorForm";
-import UQIEditorForm from "./components/UQIEditorForm";
+import APIEditorForm from "./components/ApiEditor";
+import GraphQLEditorForm from "./components/GraphQLEditor";
+import UQIEditorForm from "./components/UQIEditor";
const PluginActionForm = () => {
useChangeActionCall();
diff --git a/app/client/src/pages/Editor/ActionForm/Section/index.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Section/index.tsx
similarity index 100%
rename from app/client/src/pages/Editor/ActionForm/Section/index.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Section/index.tsx
diff --git a/app/client/src/pages/Editor/ActionForm/Section/styles.module.css b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Section/styles.module.css
similarity index 100%
rename from app/client/src/pages/Editor/ActionForm/Section/styles.module.css
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Section/styles.module.css
diff --git a/app/client/src/pages/Editor/ActionForm/Zone/index.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/index.tsx
similarity index 100%
rename from app/client/src/pages/Editor/ActionForm/Zone/index.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/index.tsx
diff --git a/app/client/src/pages/Editor/ActionForm/Zone/styles.module.css b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/styles.module.css
similarity index 100%
rename from app/client/src/pages/Editor/ActionForm/Zone/styles.module.css
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/styles.module.css
diff --git a/app/client/src/pages/Editor/ActionForm/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/index.ts
similarity index 100%
rename from app/client/src/pages/Editor/ActionForm/index.ts
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/index.ts
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/APIEditorForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/APIEditorForm.tsx
similarity index 84%
rename from app/client/src/PluginActionEditor/components/PluginActionForm/components/APIEditorForm.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/APIEditorForm.tsx
index a3065ba2e5e0..1546fcef01a0 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/APIEditorForm.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/APIEditorForm.tsx
@@ -1,14 +1,14 @@
import React from "react";
-import CommonEditorForm from "./CommonEditorForm";
-import { usePluginActionContext } from "PluginActionEditor";
+import CommonEditorForm from "../CommonEditorForm";
+import { usePluginActionContext } from "../../../../PluginActionContext";
import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import { API_EDITOR_FORM_NAME } from "ee/constants/forms";
-import { HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/CommonApiConstants";
-import PostBodyData from "pages/Editor/APIEditor/PostBodyData";
+import { HTTP_METHOD_OPTIONS } from "../../../../constants/CommonApiConstants";
+import PostBodyData from "./PostBodyData";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
-import Pagination from "pages/Editor/APIEditor/Pagination";
+import Pagination from "./Pagination";
import { reduxForm } from "redux-form";
import {
useHandleRunClick,
diff --git a/app/client/src/pages/Editor/APIEditor/Pagination.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/Pagination.tsx
similarity index 97%
rename from app/client/src/pages/Editor/APIEditor/Pagination.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/Pagination.tsx
index d188cd0aa580..ef9bb7321e67 100644
--- a/app/client/src/pages/Editor/APIEditor/Pagination.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/Pagination.tsx
@@ -7,8 +7,10 @@ import { PaginationType } from "entities/Action";
import RadioFieldGroup from "components/editorComponents/form/fields/RadioGroupField";
import { Classes, Text, TextType } from "@appsmith/ads-old";
import { Button } from "@appsmith/ads";
-import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
-import { CodeEditorBorder } from "components/editorComponents/CodeEditor/EditorConfig";
+import {
+ CodeEditorBorder,
+ type EditorTheme,
+} from "components/editorComponents/CodeEditor/EditorConfig";
import { GifPlayer } from "@appsmith/ads-old";
import thumbnail from "assets/icons/gifs/thumbnail.png";
import configPagination from "assets/icons/gifs/config_pagination.gif";
diff --git a/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/PostBodyData.tsx
similarity index 98%
rename from app/client/src/pages/Editor/APIEditor/PostBodyData.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/PostBodyData.tsx
index 72009d651d64..0ea4a678b20d 100644
--- a/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/PostBodyData.tsx
@@ -5,7 +5,7 @@ import { formValueSelector } from "redux-form";
import {
POST_BODY_FORMAT_OPTIONS,
POST_BODY_FORMAT_TITLES,
-} from "constants/ApiEditorConstants/CommonApiConstants";
+} from "../../../../constants/CommonApiConstants";
import { API_EDITOR_FORM_NAME } from "ee/constants/forms";
import KeyValueFieldArray from "components/editorComponents/form/fields/KeyValueFieldArray";
import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField";
@@ -22,7 +22,7 @@ import { Classes } from "@appsmith/ads-old";
import {
getPostBodyFormat,
updatePostBodyContentType,
-} from "PluginActionEditor/store";
+} from "../../../../store";
import type { CodeEditorExpected } from "components/editorComponents/CodeEditor";
import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType";
import { createMessage, API_PANE_NO_BODY } from "ee/constants/messages";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/index.ts
new file mode 100644
index 000000000000..e244d7c16851
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/index.ts
@@ -0,0 +1 @@
+export { default } from "./APIEditorForm";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields.tsx
index a2f1f7b7fc13..9df885b2c51d 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields.tsx
@@ -2,7 +2,7 @@ import React from "react";
import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import RequestDropdownField from "components/editorComponents/form/fields/RequestDropdownField";
import { replayHighlightClass } from "globalStyles/portals";
-import EmbeddedDatasourcePathField from "components/editorComponents/form/fields/EmbeddedDatasourcePathField";
+import EmbeddedDatasourcePathField from "./components/EmbeddedDatasourcePathField";
import styled from "styled-components";
import { Flex } from "@appsmith/ads";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs.tsx
index eda49d14634b..f3e0adb90657 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs.tsx
@@ -4,10 +4,10 @@ import FormLabel from "components/editorComponents/FormLabel";
import type { AutoGeneratedHeader } from "pages/Editor/APIEditor/helpers";
import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import React from "react";
-import { API_EDITOR_TABS } from "constants/ApiEditorConstants/CommonApiConstants";
+import { API_EDITOR_TABS } from "../../../../constants/CommonApiConstants";
import { DatasourceConfig } from "./components/DatasourceConfig";
import KeyValueFieldArray from "components/editorComponents/form/fields/KeyValueFieldArray";
-import ApiAuthentication from "pages/Editor/APIEditor/ApiAuthentication";
+import ApiAuthentication from "./components/ApiAuthentication";
import ActionSettings from "pages/Editor/ActionSettings";
import { API_EDITOR_TAB_TITLES, createMessage } from "ee/constants/messages";
import { useSelectedFormTab } from "./hooks/useSelectedFormTab";
diff --git a/app/client/src/pages/Editor/APIEditor/ApiAuthentication.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/ApiAuthentication.tsx
similarity index 98%
rename from app/client/src/pages/Editor/APIEditor/ApiAuthentication.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/ApiAuthentication.tsx
index 89468ca751b8..dab9c52f0d72 100644
--- a/app/client/src/pages/Editor/APIEditor/ApiAuthentication.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/ApiAuthentication.tsx
@@ -13,7 +13,7 @@ import {
SAVE_DATASOURCE_MESSAGE,
createMessage,
} from "ee/constants/messages";
-import StoreAsDatasource from "components/editorComponents/StoreAsDatasource";
+import StoreAsDatasource from "./StoreAsDatasource";
import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors";
import { Icon, Text } from "@appsmith/ads";
import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors";
diff --git a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/EmbeddedDatasourcePathField.tsx
similarity index 98%
rename from app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/EmbeddedDatasourcePathField.tsx
index 02671a9b06ba..136c51b0cce5 100644
--- a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/EmbeddedDatasourcePathField.tsx
@@ -23,7 +23,7 @@ import {
import { entityMarker } from "components/editorComponents/CodeEditor/MarkHelpers/entityMarker";
import { bindingHintHelper } from "components/editorComponents/CodeEditor/hintHelpers";
-import StoreAsDatasource from "components/editorComponents/StoreAsDatasource";
+import StoreAsDatasource from "./StoreAsDatasource";
import { DATASOURCE_URL_EXACT_MATCH_REGEX } from "constants/AppsmithActionConstants/ActionConstants";
import styled from "styled-components";
import * as FontFamilies from "constants/Fonts";
@@ -42,7 +42,7 @@ import {
getDatasource,
getDatasourcesByPluginId,
} from "ee/selectors/entitiesSelector";
-import { extractApiUrlPath } from "transformers/RestActionTransformer";
+import { extractApiUrlPath } from "../../../../../transformers/RestActionTransformer";
import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors";
import { Text } from "@appsmith/ads";
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
@@ -50,7 +50,7 @@ import LazyCodeEditor from "components/editorComponents/LazyCodeEditor";
import { getCodeMirrorNamespaceFromEditor } from "utils/getCodeMirrorNamespace";
import { isDynamicValue } from "utils/DynamicBindingUtils";
import { isEnvironmentValid } from "ee/utils/Environments";
-import { DEFAULT_DATASOURCE_NAME } from "constants/ApiEditorConstants/ApiEditorConstants";
+import { DEFAULT_DATASOURCE_NAME } from "../../../../../constants/ApiEditorConstants";
import { isString } from "lodash";
import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors";
import {
@@ -59,7 +59,7 @@ import {
} from "ee/utils/BusinessFeatures/permissionPageHelpers";
import { isGACEnabled } from "ee/utils/planHelpers";
import { selectFeatureFlags } from "ee/selectors/featureFlagsSelectors";
-import { getDatasourceInfo } from "PluginActionEditor/components/PluginActionForm/utils/getDatasourceInfo";
+import { getDatasourceInfo } from "../utils/getDatasourceInfo";
interface ReduxStateProps {
workspaceId: string;
diff --git a/app/client/src/components/editorComponents/StoreAsDatasource.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/StoreAsDatasource.tsx
similarity index 100%
rename from app/client/src/components/editorComponents/StoreAsDatasource.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/StoreAsDatasource.tsx
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useSelectedFormTab.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useSelectedFormTab.ts
index 6e3aada35dda..10da87f2b9f6 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useSelectedFormTab.ts
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useSelectedFormTab.ts
@@ -3,7 +3,7 @@ import { useDispatch, useSelector } from "react-redux";
import {
getPluginActionConfigSelectedTab,
setPluginActionEditorSelectedTab,
-} from "PluginActionEditor/store";
+} from "../../../../../store";
export function useSelectedFormTab(): [
string | undefined,
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/index.ts
index 46cb3624cb0f..d954cb3129a6 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/index.ts
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/index.ts
@@ -1,5 +1 @@
export { default } from "./CommonEditorForm";
-
-export { HintMessages } from "./HintMessages";
-export { InfoFields } from "./InfoFields";
-export { RequestTabs } from "./RequestTabs";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/utils/getDatasourceInfo.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/utils/getDatasourceInfo.ts
similarity index 100%
rename from app/client/src/PluginActionEditor/components/PluginActionForm/utils/getDatasourceInfo.ts
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/utils/getDatasourceInfo.ts
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/GraphQLEditorForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/GraphQLEditorForm.tsx
index 96a9782c98af..677bf16e032e 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/GraphQLEditorForm.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/GraphQLEditorForm.tsx
@@ -2,10 +2,10 @@ import React from "react";
import { reduxForm } from "redux-form";
import { API_EDITOR_FORM_NAME } from "ee/constants/forms";
import CommonEditorForm from "../CommonEditorForm";
-import Pagination from "pages/Editor/APIEditor/GraphQL/Pagination";
-import { GRAPHQL_HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/GraphQLEditorConstants";
+import Pagination from "./Pagination";
+import { GRAPHQL_HTTP_METHOD_OPTIONS } from "../../../../constants/GraphQLEditorConstants";
import PostBodyData from "./PostBodyData";
-import { usePluginActionContext } from "PluginActionEditor";
+import { usePluginActionContext } from "../../../../PluginActionContext";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
diff --git a/app/client/src/pages/Editor/APIEditor/GraphQL/Pagination.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/Pagination.tsx
similarity index 99%
rename from app/client/src/pages/Editor/APIEditor/GraphQL/Pagination.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/Pagination.tsx
index 07b74cf2e4cc..56a62a6f86d6 100644
--- a/app/client/src/pages/Editor/APIEditor/GraphQL/Pagination.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/Pagination.tsx
@@ -12,7 +12,7 @@ import { connect } from "react-redux";
import type { AppState } from "ee/reducers";
import { FormLabel } from "components/editorComponents/form/fields/StyledFormComponents";
import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField";
-import type { GRAPHQL_PAGINATION_TYPE } from "constants/ApiEditorConstants/GraphQLEditorConstants";
+import type { GRAPHQL_PAGINATION_TYPE } from "../../../../constants/GraphQLEditorConstants";
import {
LIMITBASED_PREFIX,
CURSORBASED_PREFIX,
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx
index 211042452700..c66aa4048582 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx
@@ -8,7 +8,7 @@ import {
TabBehaviour,
} from "components/editorComponents/CodeEditor/EditorConfig";
import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField";
-import { Section, Zone } from "pages/Editor/ActionForm";
+import { Section, Zone } from "../ActionForm";
import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType";
import FormLabel from "components/editorComponents/FormLabel";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/index.ts
new file mode 100644
index 000000000000..ecf70ec1144c
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/index.ts
@@ -0,0 +1 @@
+export { default } from "./GraphQLEditorForm";
diff --git a/app/client/src/pages/Editor/QueryEditor/FormRender.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx
similarity index 99%
rename from app/client/src/pages/Editor/QueryEditor/FormRender.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx
index ca9b82a5d46a..ce0e49eebc0f 100644
--- a/app/client/src/pages/Editor/QueryEditor/FormRender.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx
@@ -20,7 +20,7 @@ import {
updateEvaluatedSectionConfig,
} from "components/formControls/utils";
import { isValidFormConfig } from "reducers/evaluationReducers/formEvaluationReducer";
-import FormControl from "../FormControl";
+import FormControl from "pages/Editor/FormControl";
import type { ControlProps } from "components/formControls/BaseControl";
import { Spinner } from "@appsmith/ads";
import type { QueryAction, SaaSAction } from "entities/Action";
diff --git a/app/client/src/pages/Editor/QueryEditor/TemplateMenu.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/TemplateMenu.tsx
similarity index 100%
rename from app/client/src/pages/Editor/QueryEditor/TemplateMenu.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/TemplateMenu.tsx
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/UQIEditorForm.tsx
similarity index 90%
rename from app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/UQIEditorForm.tsx
index 5c51a2cab6ee..fdee4e73717f 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/UQIEditorForm.tsx
@@ -1,6 +1,6 @@
import React from "react";
-import FormRender from "pages/Editor/QueryEditor/FormRender";
-import { usePluginActionContext } from "../../../PluginActionContext";
+import FormRender from "./FormRender";
+import { usePluginActionContext } from "../../../../PluginActionContext";
import { QUERY_EDITOR_FORM_NAME } from "ee/constants/forms";
import { getFormValues, reduxForm } from "redux-form";
import type { QueryAction, SaaSAction } from "entities/Action";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/index.ts
new file mode 100644
index 000000000000..0aa4780f41b0
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/index.ts
@@ -0,0 +1 @@
+export { default } from "./UQIEditorForm";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.test.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.test.tsx
index f68dfa38cd5c..55029fbaefe4 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.test.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.test.tsx
@@ -1,7 +1,7 @@
import { renderHook } from "@testing-library/react-hooks/dom";
import { useDispatch } from "react-redux";
import { PluginType } from "entities/Action";
-import { usePluginActionContext } from "PluginActionEditor";
+import { usePluginActionContext } from "../../../PluginActionContext";
import { changeApi, changeQuery } from "../../../store";
import usePrevious from "utils/hooks/usePrevious";
import { useChangeActionCall } from "./useChangeActionCall";
@@ -15,7 +15,7 @@ jest.mock("../../../store", () => ({
changeQuery: jest.fn(),
}));
-jest.mock("PluginActionEditor", () => ({
+jest.mock("../../../PluginActionContext", () => ({
usePluginActionContext: jest.fn(),
}));
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.ts
index be76f258b79b..ac1620ddcb1b 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.ts
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.ts
@@ -1,8 +1,8 @@
import { useEffect } from "react";
import { useDispatch } from "react-redux";
import { PluginType } from "entities/Action";
-import { usePluginActionContext } from "PluginActionEditor";
-import { changeApi, changeQuery } from "PluginActionEditor/store";
+import { usePluginActionContext } from "../../../PluginActionContext";
+import { changeApi, changeQuery } from "../../../store";
import usePrevious from "utils/hooks/usePrevious";
export const useChangeActionCall = () => {
diff --git a/app/client/src/PluginActionEditor/components/PluginActionNameEditor.tsx b/app/client/src/PluginActionEditor/components/PluginActionNameEditor.tsx
index a51d6006dec0..55f32a5e4cd1 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionNameEditor.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionNameEditor.tsx
@@ -1,7 +1,7 @@
import React from "react";
import { useSelector } from "react-redux";
import ActionNameEditor from "components/editorComponents/ActionNameEditor";
-import { usePluginActionContext } from "PluginActionEditor/PluginActionContext";
+import { usePluginActionContext } from "../PluginActionContext";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx
index d2c5b0a25255..88524b915eb2 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx
@@ -1,6 +1,6 @@
import React, { useCallback } from "react";
import { IDEBottomView, ViewHideBehaviour } from "IDE";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "./constants";
import EntityBottomTabs from "components/editorComponents/EntityBottomTabs";
import { useDispatch, useSelector } from "react-redux";
import { setPluginActionEditorDebuggerState } from "../../store";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiFormatSegmentedResponse.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiFormatSegmentedResponse.tsx
index 4fe9f53b9054..d83a11b15f16 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiFormatSegmentedResponse.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiFormatSegmentedResponse.tsx
@@ -7,7 +7,7 @@ import { Flex, SegmentedControl } from "@appsmith/ads";
import type { ActionResponse } from "api/ActionAPI";
import { setActionResponseDisplayFormat } from "actions/pluginActionActions";
import { actionResponseDisplayDataFormats } from "pages/Editor/utils";
-import { ResponseDisplayFormats } from "constants/ApiEditorConstants/CommonApiConstants";
+import { ResponseDisplayFormats } from "../../../constants/CommonApiConstants";
import { useDispatch } from "react-redux";
import styled from "styled-components";
import { ResponseFormatTabs } from "./ResponseFormatTabs";
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx
index bb32f43ad198..a33f161f4775 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx
@@ -10,7 +10,7 @@ import {
import type { ActionResponse } from "api/ActionAPI";
import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import type { SourceEntity } from "entities/AppsmithConsole";
-import ApiResponseMeta from "components/editorComponents/ApiResponseMeta";
+import ApiResponseMeta from "./ApiResponseMeta";
import ActionExecutionInProgressView from "components/editorComponents/ActionExecutionInProgressView";
import LogAdditionalInfo from "components/editorComponents/Debugger/ErrorLogs/components/LogAdditionalInfo";
import LogHelper from "components/editorComponents/Debugger/ErrorLogs/components/LogHelper";
diff --git a/app/client/src/components/editorComponents/ApiResponseMeta.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseMeta.tsx
similarity index 96%
rename from app/client/src/components/editorComponents/ApiResponseMeta.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseMeta.tsx
index 928791c971d9..36eea06baa58 100644
--- a/app/client/src/components/editorComponents/ApiResponseMeta.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseMeta.tsx
@@ -2,12 +2,12 @@ import type { PropsWithChildren } from "react";
import React from "react";
import { Flex } from "@appsmith/ads";
import { Text, TextType } from "@appsmith/ads-old";
-import { formatBytes } from "../../utils/helpers";
import { isEmpty } from "lodash";
-import BindDataButton from "pages/Editor/QueryEditor/BindDataButton";
+import BindDataButton from "./BindDataButton";
import styled from "styled-components";
import type { ActionResponse } from "api/ActionAPI";
import { Text as BlueprintText } from "@blueprintjs/core/lib/esm/components/text/text";
+import { formatBytes } from "../utils/formatBytes";
interface TextStyleProps {
accent: "primary" | "secondary" | "error";
diff --git a/app/client/src/pages/Editor/QueryEditor/BindDataButton.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/BindDataButton.tsx
similarity index 100%
rename from app/client/src/pages/Editor/QueryEditor/BindDataButton.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/BindDataButton.tsx
diff --git a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.test.tsx
similarity index 100%
rename from app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.test.tsx
diff --git a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.tsx
similarity index 96%
rename from app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.tsx
index 97ecdfa432a2..525df80a8ad0 100644
--- a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.tsx
@@ -6,9 +6,9 @@ import {
ResponseTabErrorContainer,
ResponseTabErrorContent,
ResponseTabErrorDefaultMessage,
-} from "PluginActionEditor/components/PluginActionResponse/components/ApiResponse";
-import { ResponseFormatTabs } from "PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs";
-import { NoResponse } from "PluginActionEditor/components/PluginActionResponse/components/NoResponse";
+} from "./ApiResponse";
+import { ResponseFormatTabs } from "./ResponseFormatTabs";
+import { NoResponse } from "./NoResponse";
import LogAdditionalInfo from "components/editorComponents/Debugger/ErrorLogs/components/LogAdditionalInfo";
import LogHelper from "components/editorComponents/Debugger/ErrorLogs/components/LogHelper";
import LOG_TYPE from "entities/AppsmithConsole/logtype";
@@ -27,7 +27,7 @@ import { getUpdateTimestamp } from "components/editorComponents/Debugger/ErrorLo
import type { SourceEntity } from "entities/AppsmithConsole";
import type { Action } from "entities/Action";
import { getActionData } from "ee/selectors/entitiesSelector";
-import { actionResponseDisplayDataFormats } from "../utils";
+import { actionResponseDisplayDataFormats } from "pages/Editor/utils";
import { getErrorAsString } from "sagas/ActionExecution/errorUtils";
import { isString } from "lodash";
import ActionExecutionInProgressView from "components/editorComponents/ActionExecutionInProgressView";
@@ -36,7 +36,7 @@ import BindDataButton from "./BindDataButton";
import {
getPluginActionDebuggerState,
setPluginActionEditorSelectedTab,
-} from "PluginActionEditor/store";
+} from "../../../store";
import { EDITOR_TABS } from "constants/QueryEditorConstants";
import {
createMessage,
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs.tsx
index eb8dec8a7bf7..ab642d829c71 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs.tsx
@@ -1,8 +1,8 @@
import React from "react";
-import { ResponseDisplayFormats } from "constants/ApiEditorConstants/CommonApiConstants";
+import { ResponseDisplayFormats } from "../../../constants/CommonApiConstants";
import ReadOnlyEditor from "components/editorComponents/ReadOnlyEditor";
import { isString } from "lodash";
-import Table from "pages/Editor/QueryEditor/Table";
+import Table from "./Table";
type ResponseData = string | Record<string, unknown>[];
diff --git a/app/client/src/components/editorComponents/Debugger/Schema.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx
similarity index 94%
rename from app/client/src/components/editorComponents/Debugger/Schema.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx
index ffd16c40e302..cc29f5a715c3 100644
--- a/app/client/src/components/editorComponents/Debugger/Schema.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx
@@ -1,7 +1,10 @@
import { Flex } from "@appsmith/ads";
import React, { useEffect, useState } from "react";
-import type { DatasourceColumns, DatasourceKeys } from "entities/Datasource";
-import { DatasourceStructureContext } from "entities/Datasource";
+import {
+ DatasourceStructureContext,
+ type DatasourceColumns,
+ type DatasourceKeys,
+} from "entities/Datasource";
import { DatasourceStructureContainer as DatasourceStructureList } from "pages/Editor/DatasourceInfo/DatasourceStructureContainer";
import { useSelector } from "react-redux";
import {
@@ -12,7 +15,7 @@ import DatasourceField from "pages/Editor/DatasourceInfo/DatasourceField";
import { find } from "lodash";
import type { AppState } from "ee/reducers";
import RenderInterimDataState from "pages/Editor/DatasourceInfo/RenderInterimDataState";
-import { getPluginActionDebuggerState } from "PluginActionEditor/store";
+import { getPluginActionDebuggerState } from "../../../store";
interface Props {
datasourceId: string;
diff --git a/app/client/src/pages/Editor/QueryEditor/Table.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Table.tsx
similarity index 100%
rename from app/client/src/pages/Editor/QueryEditor/Table.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/Table.tsx
diff --git a/app/client/src/pages/Editor/APIEditor/constants.ts b/app/client/src/PluginActionEditor/components/PluginActionResponse/constants.ts
similarity index 100%
rename from app/client/src/pages/Editor/APIEditor/constants.ts
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/constants.ts
diff --git a/app/client/src/components/editorComponents/ActionRightPane/useShowSchema.ts b/app/client/src/PluginActionEditor/components/PluginActionResponse/hooks/useShowSchema.ts
similarity index 100%
rename from app/client/src/components/editorComponents/ActionRightPane/useShowSchema.ts
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/hooks/useShowSchema.ts
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/utils/formatBytes.ts b/app/client/src/PluginActionEditor/components/PluginActionResponse/utils/formatBytes.ts
new file mode 100644
index 000000000000..dff56245dfae
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/utils/formatBytes.ts
@@ -0,0 +1,14 @@
+export const formatBytes = (bytes: string | number) => {
+ if (!bytes) return;
+
+ const value = typeof bytes === "string" ? parseInt(bytes) : bytes;
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
+
+ if (value === 0) return "0 bytes";
+
+ const i = parseInt(String(Math.floor(Math.log(value) / Math.log(1024))));
+
+ if (i === 0) return bytes + " " + sizes[i];
+
+ return (value / Math.pow(1024, i)).toFixed(1) + " " + sizes[i];
+};
diff --git a/app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx b/app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx
index 5c0362be3190..c60a751490cc 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx
@@ -7,10 +7,10 @@ import {
useBlockExecution,
useHandleRunClick,
useAnalyticsOnRunClick,
-} from "PluginActionEditor/hooks";
+} from "../hooks";
import { useToggle } from "@mantine/hooks";
import { useSelector } from "react-redux";
-import { isActionRunning } from "PluginActionEditor/store";
+import { isActionRunning } from "../store";
interface PluginActionToolbarProps {
runOptions?: React.ReactNode;
diff --git a/app/client/src/constants/ApiEditorConstants/ApiEditorConstants.ts b/app/client/src/PluginActionEditor/constants/ApiEditorConstants.ts
similarity index 100%
rename from app/client/src/constants/ApiEditorConstants/ApiEditorConstants.ts
rename to app/client/src/PluginActionEditor/constants/ApiEditorConstants.ts
diff --git a/app/client/src/constants/ApiEditorConstants/AppsmithAIEditorConstants.ts b/app/client/src/PluginActionEditor/constants/AppsmithAIEditorConstants.ts
similarity index 100%
rename from app/client/src/constants/ApiEditorConstants/AppsmithAIEditorConstants.ts
rename to app/client/src/PluginActionEditor/constants/AppsmithAIEditorConstants.ts
diff --git a/app/client/src/constants/ApiEditorConstants/CommonApiConstants.ts b/app/client/src/PluginActionEditor/constants/CommonApiConstants.ts
similarity index 100%
rename from app/client/src/constants/ApiEditorConstants/CommonApiConstants.ts
rename to app/client/src/PluginActionEditor/constants/CommonApiConstants.ts
diff --git a/app/client/src/constants/ApiEditorConstants/GraphQLEditorConstants.ts b/app/client/src/PluginActionEditor/constants/GraphQLEditorConstants.ts
similarity index 100%
rename from app/client/src/constants/ApiEditorConstants/GraphQLEditorConstants.ts
rename to app/client/src/PluginActionEditor/constants/GraphQLEditorConstants.ts
diff --git a/app/client/src/PluginActionEditor/readme.md b/app/client/src/PluginActionEditor/readme.md
new file mode 100644
index 000000000000..8b72c5896f1b
--- /dev/null
+++ b/app/client/src/PluginActionEditor/readme.md
@@ -0,0 +1,102 @@
+## Plugin Action Editor
+
+Appsmith allows its users to connect their UI to various different
+data sources e.g. API end points or SQL Query Databases.
+These data sources are configured using "Plugins" that define various details about
+the configuration and execution. Each data source is a specific connection and
+users can have multiple "Actions" built on top of these data sources.
+
+Actions are implementations that can store and retrieve data from the data source.
+
+The Plugin Action Editor is a module that exposes the UX that is used by the users
+to implement details about these actions, its settings and test them in edit mode.
+
+### Contents
+
+This module is divided into 3 major composable sections.
+
+- **Toolbar**: A row for the tools on top of the Action. Comes with Settings, Run Buttons and an overflow menu CTA to add further management items like copy or delete. Allows to add more items in it
+- **Form**: A preset form based defined by the Plugin config.
+- **Response**: A tabbed bottom view to show the Response and other debugging tools
+
+One can use these 3 sections to define their compose different experiences.
+
+#### Plugin Action Context
+
+All the sections and its children are connected via the "Plugin Action Context" that allows for easy data passing.
+
+The Wrapper "PluginActionEditor" will pass this context down. This includes:
+
+- Action
+- Action Response
+- Plugin
+- Datasource
+- Form Configs
+- Setting Configs
+
+#### UI Store
+
+The UI state is managed via redux, and it is exposed out as well for use
+
+### How to use
+
+Below we illustrate how by using a Composable structure to create the Action Editor
+
+```typescript jsx
+const AppPluginActionEditor = () => {
+ // Define the actionId that needs to be configured via the editor.
+ // In the example we fetch it from the route
+ const actionId = getActionIDFromRoute();
+ return (
+ /** Plugin Action Editor is our wrapper composable fragment.
+ * This will fetch the action and other related info
+ * from state and pass it down to its children via "context".
+ * This will ensure all children have the same way to access the action
+ * i.e. via context. Hence, this component is only responsible for
+ * abstracting the
+ * action state management
+ */
+ <PluginActionEditor actionID={actionID}>
+ <PluginActionToolbar />
+ <PluginActionForm />
+ <PluginActionResponse />
+ </PluginActionEditor>
+ )
+}
+
+```
+
+It is completely possible to mix and match these components, and compose them further to build
+other experiences with them.
+For example if you need to just have the Response view without the form
+you can do the following
+
+```typescript jsx
+const PluginActionResponseView = () => {
+ // Define the actionId that needs to be configured via the editor.
+ // In the example we fetch it from the route
+ const actionId = getActionIDFromRoute();
+ return (
+ <PluginActionEditor actionID={actionID}>
+ <PluginActionResponse />
+ </PluginActionEditor>
+ )
+}
+```
+
+### Update Guide
+
+1. Update an existing functionality to be reflected in all variations
+ - Functionality updates should be done at the point of definition itself.
+ - Prefer having separate files for each functionality if it has a lot of logic or can be extended in EE
+2. Add new functionality for all variations
+ - Add the functionality close to the usage point.
+ - Avoid configuration of functionality via props since it is used for all.
+3. Add an EE variation to a functionality.
+ - Avoid adding any EE logic for this functionality as much as possible
+ - Ideally it should be exposed as a prop that can be updated in the EE usage point
+ - In case it needs to be done in place, make sure the functionality is its own file so that only that functionality
+ needs extension.
+4. Create a specific variance for a certain use case not applicable for all
+ - Avoid adding the logic inside the module instead override via composition
+ - If it affects any feature in the module, expose via prop
diff --git a/app/client/src/PluginActionEditor/constants.ts b/app/client/src/PluginActionEditor/store/constants.ts
similarity index 100%
rename from app/client/src/PluginActionEditor/constants.ts
rename to app/client/src/PluginActionEditor/store/constants.ts
diff --git a/app/client/src/PluginActionEditor/store/pluginActionEditorSelectors.ts b/app/client/src/PluginActionEditor/store/pluginActionEditorSelectors.ts
index a4cd810f1c35..7e0a1f5420d5 100644
--- a/app/client/src/PluginActionEditor/store/pluginActionEditorSelectors.ts
+++ b/app/client/src/PluginActionEditor/store/pluginActionEditorSelectors.ts
@@ -1,7 +1,7 @@
import type { AppState } from "ee/reducers";
import { createSelector } from "reselect";
-import { POST_BODY_FORM_DATA_KEY } from "../constants";
+import { POST_BODY_FORM_DATA_KEY } from "./constants";
export const getActionEditorSavingMap = (state: AppState) =>
state.ui.pluginActionEditor.isSaving;
diff --git a/app/client/src/PluginActionEditor/store/pluginEditorReducer.ts b/app/client/src/PluginActionEditor/store/pluginEditorReducer.ts
index 781ce8d71651..93a3d36bdc98 100644
--- a/app/client/src/PluginActionEditor/store/pluginEditorReducer.ts
+++ b/app/client/src/PluginActionEditor/store/pluginEditorReducer.ts
@@ -5,7 +5,7 @@ import {
ReduxActionErrorTypes,
} from "ee/constants/ReduxActionConstants";
import type { Action } from "entities/Action";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "../components/PluginActionResponse/constants";
import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/constants";
import type { ActionResponse } from "api/ActionAPI";
import { omit, set } from "lodash";
diff --git a/app/client/src/transformers/CurlImportTransformer.test.ts b/app/client/src/PluginActionEditor/transformers/CurlImportTransformer.test.ts
similarity index 88%
rename from app/client/src/transformers/CurlImportTransformer.test.ts
rename to app/client/src/PluginActionEditor/transformers/CurlImportTransformer.test.ts
index e0ce45e17406..bd1a9e10aa0f 100644
--- a/app/client/src/transformers/CurlImportTransformer.test.ts
+++ b/app/client/src/PluginActionEditor/transformers/CurlImportTransformer.test.ts
@@ -1,4 +1,4 @@
-import transformCurlImport from "transformers/CurlImportTransformer";
+import transformCurlImport from "./CurlImportTransformer";
describe("CurlImportTransformer", () => {
it("has quotes in start and end and escapes special characters", () => {
diff --git a/app/client/src/transformers/CurlImportTransformer.ts b/app/client/src/PluginActionEditor/transformers/CurlImportTransformer.ts
similarity index 100%
rename from app/client/src/transformers/CurlImportTransformer.ts
rename to app/client/src/PluginActionEditor/transformers/CurlImportTransformer.ts
diff --git a/app/client/src/transformers/RestAPIDatasourceFormTransformer.ts b/app/client/src/PluginActionEditor/transformers/RestAPIDatasourceFormTransformer.ts
similarity index 100%
rename from app/client/src/transformers/RestAPIDatasourceFormTransformer.ts
rename to app/client/src/PluginActionEditor/transformers/RestAPIDatasourceFormTransformer.ts
diff --git a/app/client/src/transformers/RestActionTransformer.ts b/app/client/src/PluginActionEditor/transformers/RestActionTransformer.ts
similarity index 98%
rename from app/client/src/transformers/RestActionTransformer.ts
rename to app/client/src/PluginActionEditor/transformers/RestActionTransformer.ts
index ccd31d302008..1ea3995f789f 100644
--- a/app/client/src/transformers/RestActionTransformer.ts
+++ b/app/client/src/PluginActionEditor/transformers/RestActionTransformer.ts
@@ -1,7 +1,7 @@
import {
HTTP_METHOD,
CONTENT_TYPE_HEADER_KEY,
-} from "constants/ApiEditorConstants/CommonApiConstants";
+} from "../constants/CommonApiConstants";
import type { ApiAction } from "entities/Action";
import isEmpty from "lodash/isEmpty";
import isString from "lodash/isString";
diff --git a/app/client/src/transformers/RestActionTransformers.test.ts b/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts
similarity index 98%
rename from app/client/src/transformers/RestActionTransformers.test.ts
rename to app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts
index d24ead8b4378..f775df96e2e9 100644
--- a/app/client/src/transformers/RestActionTransformers.test.ts
+++ b/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts
@@ -1,15 +1,14 @@
import {
extractApiUrlPath,
transformRestAction,
-} from "transformers/RestActionTransformer";
+} from "./RestActionTransformer";
import type { ApiAction } from "entities/Action";
import { PluginType } from "entities/Action";
import {
HTTP_PROTOCOL,
MultiPartOptionTypes,
POST_BODY_FORMAT_OPTIONS,
- // POST_BODY_FORMAT_OPTIONS_ENUM,
-} from "constants/ApiEditorConstants/CommonApiConstants";
+} from "../constants/CommonApiConstants";
// jest.mock("POST_");
diff --git a/app/client/src/api/helpers/validateJsonResponseMeta.ts b/app/client/src/api/helpers/validateJsonResponseMeta.ts
index de295660abdb..084e9b23f3b2 100644
--- a/app/client/src/api/helpers/validateJsonResponseMeta.ts
+++ b/app/client/src/api/helpers/validateJsonResponseMeta.ts
@@ -1,6 +1,6 @@
import * as Sentry from "@sentry/react";
import type { AxiosResponse } from "axios";
-import { CONTENT_TYPE_HEADER_KEY } from "constants/ApiEditorConstants/CommonApiConstants";
+import { CONTENT_TYPE_HEADER_KEY } from "PluginActionEditor/constants/CommonApiConstants";
export const validateJsonResponseMeta = (response: AxiosResponse) => {
if (
diff --git a/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx b/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx
index 5f6c1748462f..0ca2ba333b48 100644
--- a/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx
+++ b/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx
@@ -24,9 +24,9 @@ import {
isActionRunning,
} from "PluginActionEditor/store";
import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers";
-import useShowSchema from "components/editorComponents/ActionRightPane/useShowSchema";
-import Schema from "components/editorComponents/Debugger/Schema";
-import QueryResponseTab from "pages/Editor/QueryEditor/QueryResponseTab";
+import useShowSchema from "PluginActionEditor/components/PluginActionResponse/hooks/useShowSchema";
+import Schema from "PluginActionEditor/components/PluginActionResponse/components/Schema";
+import QueryResponseTab from "PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab";
import type { SourceEntity } from "entities/AppsmithConsole";
import { ENTITY_TYPE as SOURCE_ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils";
import {
diff --git a/app/client/src/ce/PluginActionEditor/hooks/useBlockExecution.ts b/app/client/src/ce/PluginActionEditor/hooks/useBlockExecution.ts
index e02bcc7231d0..a2acdd1f5594 100644
--- a/app/client/src/ce/PluginActionEditor/hooks/useBlockExecution.ts
+++ b/app/client/src/ce/PluginActionEditor/hooks/useBlockExecution.ts
@@ -1,7 +1,7 @@
import { getHasExecuteActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
-import { DEFAULT_DATASOURCE_NAME } from "constants/ApiEditorConstants/ApiEditorConstants";
+import { DEFAULT_DATASOURCE_NAME } from "PluginActionEditor/constants/ApiEditorConstants";
import { UIComponentTypes } from "api/PluginApi";
import { SQL_DATASOURCES } from "constants/QueryEditorConstants";
import { usePluginActionContext } from "PluginActionEditor/PluginActionContext";
diff --git a/app/client/src/ce/navigation/FocusElements/AppIDE.ts b/app/client/src/ce/navigation/FocusElements/AppIDE.ts
index a351dcb15b42..3806454b5bcc 100644
--- a/app/client/src/ce/navigation/FocusElements/AppIDE.ts
+++ b/app/client/src/ce/navigation/FocusElements/AppIDE.ts
@@ -73,7 +73,7 @@ import {
import { getFirstDatasourceId } from "selectors/datasourceSelectors";
import { FocusElement, FocusElementConfigType } from "navigation/FocusElements";
import type { FocusElementsConfigList } from "sagas/FocusRetentionSaga";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants";
import {
getPluginActionConfigSelectedTab,
getPluginActionDebuggerState,
@@ -81,7 +81,7 @@ import {
setPluginActionEditorSelectedTab,
} from "PluginActionEditor/store";
import { EDITOR_TABS } from "constants/QueryEditorConstants";
-import { API_EDITOR_TABS } from "constants/ApiEditorConstants/CommonApiConstants";
+import { API_EDITOR_TABS } from "PluginActionEditor/constants/CommonApiConstants";
export const AppIDEFocusElements: FocusElementsConfigList = {
[FocusEntity.DATASOURCE_LIST]: [
diff --git a/app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx b/app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx
index bad7cdba93c1..80f758bbca49 100644
--- a/app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx
+++ b/app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx
@@ -9,10 +9,15 @@ import {
ConvertToModuleCallout,
} from "./components/ConvertToModule";
import AppPluginActionToolbar from "./components/AppPluginActionToolbar";
+import { useLocation } from "react-router";
+import { identifyEntityFromPath } from "navigation/FocusEntity";
const AppPluginActionEditor = () => {
+ const { pathname } = useLocation();
+ const entity = identifyEntityFromPath(pathname);
+
return (
- <PluginActionEditor>
+ <PluginActionEditor actionId={entity.id}>
<ConvertToModuleDisabler>
<AppPluginActionToolbar />
<ConvertToModuleCallout />
diff --git a/app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx b/app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx
index 474ea6c4bf58..b148e4e40036 100644
--- a/app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx
+++ b/app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx
@@ -9,7 +9,7 @@ import { getCodeFromMoustache, getEvaluationVersion } from "../../utils";
import { ApiMethodIcon } from "pages/Editor/Explorer/ExplorerIcons";
import { getCurrentActions } from "ee/selectors/entitiesSelector";
import { useSelector } from "react-redux";
-import type { HTTP_METHOD } from "constants/ApiEditorConstants/CommonApiConstants";
+import type { HTTP_METHOD } from "PluginActionEditor/constants/CommonApiConstants";
function GetIconForAction(
actionType: ActionTree["actionType"],
diff --git a/app/client/src/components/editorComponents/ApiResponseView.tsx b/app/client/src/components/editorComponents/ApiResponseView.tsx
index 8bf6a400adb4..ef01cbd7d9ce 100644
--- a/app/client/src/components/editorComponents/ApiResponseView.tsx
+++ b/app/client/src/components/editorComponents/ApiResponseView.tsx
@@ -16,7 +16,7 @@ import type { BottomTab } from "./EntityBottomTabs";
import EntityBottomTabs from "./EntityBottomTabs";
import { DEBUGGER_TAB_KEYS } from "./Debugger/constants";
import { getErrorCount } from "selectors/debuggerSelectors";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants";
import type { Action } from "entities/Action";
import { EMPTY_RESPONSE } from "./emptyResponse";
import {
diff --git a/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx b/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx
index b4a71622d2c2..60115c31c370 100644
--- a/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx
+++ b/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx
@@ -22,7 +22,7 @@ import {
} from "ee/constants/messages";
import { DEBUGGER_TAB_KEYS } from "./constants";
import EntityBottomTabs from "../EntityBottomTabs";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants";
import { IDEBottomView, ViewHideBehaviour, ViewDisplayMode } from "IDE";
function DebuggerTabs() {
diff --git a/app/client/src/components/editorComponents/Debugger/Resizer/index.tsx b/app/client/src/components/editorComponents/Debugger/Resizer/index.tsx
index b4e7a5ecddc5..9f887d30edc7 100644
--- a/app/client/src/components/editorComponents/Debugger/Resizer/index.tsx
+++ b/app/client/src/components/editorComponents/Debugger/Resizer/index.tsx
@@ -2,7 +2,7 @@ import { Layers } from "constants/Layers";
import type { RefObject } from "react";
import React, { useState, useEffect } from "react";
import styled, { css } from "styled-components";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants";
export const ResizerCSS = css`
width: 100%;
diff --git a/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx b/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx
index 3d01a9550692..8e5e514dc38a 100644
--- a/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx
+++ b/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx
@@ -17,7 +17,7 @@ import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType";
import {
DEFAULT_MULTI_PART_DROPDOWN_PLACEHOLDER,
MULTI_PART_DROPDOWN_OPTIONS,
-} from "constants/ApiEditorConstants/CommonApiConstants";
+} from "PluginActionEditor/constants/CommonApiConstants";
import { Button, Text } from "@appsmith/ads";
import RequestDropdownField from "./RequestDropdownField";
diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts
index 927e5fdc9211..7816f5a280cd 100644
--- a/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts
+++ b/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts
@@ -5,7 +5,7 @@ import {
import {
HTTP_PROTOCOL,
HTTP_PROTOCOL_VERSIONS,
-} from "constants/ApiEditorConstants/CommonApiConstants";
+} from "PluginActionEditor/constants/CommonApiConstants";
export default [
{
diff --git a/app/client/src/entities/AppsmithConsole/index.ts b/app/client/src/entities/AppsmithConsole/index.ts
index 0692a902d974..bf8175040f3f 100644
--- a/app/client/src/entities/AppsmithConsole/index.ts
+++ b/app/client/src/entities/AppsmithConsole/index.ts
@@ -2,7 +2,7 @@ import type { ReduxAction } from "ee/constants/ReduxActionConstants";
import type LOG_TYPE from "./logtype";
import type { PropertyEvaluationErrorType } from "utils/DynamicBindingUtils";
import type { PluginType } from "entities/Action";
-import type { HTTP_METHOD } from "constants/ApiEditorConstants/CommonApiConstants";
+import type { HTTP_METHOD } from "PluginActionEditor/constants/CommonApiConstants";
import type {
ENTITY_TYPE,
PLATFORM_ERROR,
diff --git a/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx b/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx
index 43385e0143fe..84f5dd24b9f8 100644
--- a/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx
+++ b/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx
@@ -15,7 +15,7 @@ import equal from "fast-deep-equal/es6";
import { getPlugin } from "ee/selectors/entitiesSelector";
import type { AutoGeneratedHeader } from "./helpers";
import { noop } from "lodash";
-import { DEFAULT_DATASOURCE_NAME } from "constants/ApiEditorConstants/ApiEditorConstants";
+import { DEFAULT_DATASOURCE_NAME } from "PluginActionEditor/constants/ApiEditorConstants";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import {
@@ -25,11 +25,9 @@ import {
import { ApiEditorContext } from "./ApiEditorContext";
import ActionRightPane from "components/editorComponents/ActionRightPane";
import RunHistory from "ee/components/RunHistory";
-import {
- HintMessages,
- InfoFields,
- RequestTabs,
-} from "PluginActionEditor/components/PluginActionForm/components/CommonEditorForm";
+import { HintMessages } from "PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/HintMessages";
+import { InfoFields } from "PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields";
+import { RequestTabs } from "PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs";
import { getSavingStatusForActionName } from "selectors/actionSelectors";
import { getAssetUrl } from "ee/utils/airgapHelpers";
import { ActionUrlIcon } from "../Explorer/ExplorerIcons";
diff --git a/app/client/src/pages/Editor/APIEditor/GraphQL/GraphQLEditorForm.tsx b/app/client/src/pages/Editor/APIEditor/GraphQL/GraphQLEditorForm.tsx
index 45d6feb4cca1..ed1510ea3a34 100644
--- a/app/client/src/pages/Editor/APIEditor/GraphQL/GraphQLEditorForm.tsx
+++ b/app/client/src/pages/Editor/APIEditor/GraphQL/GraphQLEditorForm.tsx
@@ -12,8 +12,8 @@ import {
} from "ee/selectors/entitiesSelector";
import type { CommonFormProps } from "../CommonEditorForm";
import CommonEditorForm from "../CommonEditorForm";
-import Pagination from "./Pagination";
-import { GRAPHQL_HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/GraphQLEditorConstants";
+import Pagination from "PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/Pagination";
+import { GRAPHQL_HTTP_METHOD_OPTIONS } from "PluginActionEditor/constants/GraphQLEditorConstants";
import PostBodyData from "PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData";
type APIFormProps = {
diff --git a/app/client/src/pages/Editor/APIEditor/GraphQL/QueryWrapperWithCSS.tsx b/app/client/src/pages/Editor/APIEditor/GraphQL/QueryWrapperWithCSS.tsx
deleted file mode 100644
index 37882af84dbb..000000000000
--- a/app/client/src/pages/Editor/APIEditor/GraphQL/QueryWrapperWithCSS.tsx
+++ /dev/null
@@ -1,250 +0,0 @@
-// import { Colors } from "constants/Colors";
-import styled from "styled-components";
-
-const QueryWrapper = styled.div`
- display: flex;
- flex-direction: column;
- width: 100%;
- padding-left: 2px;
- /* This CSS is adopted from GraphiQL to maintain the consistency with the GraphiQL playground */
- /* COLORS */
-
- /* Comment */
- .cm-comment {
- color: #999;
- }
-
- /* Punctuation */
- .cm-punctuation {
- color: #555;
- }
-
- /* Keyword */
- .cm-keyword,
- span.cm-m-graphql.cm-attribute {
- color: #b11a04;
- }
-
- /* OperationName, FragmentName */
- .cm-def {
- color: #d2054e;
- }
-
- /* FieldName */
- .cm-property {
- color: #1f61a0;
- }
-
- /* FieldAlias */
- .cm-qualifier {
- color: #1c92a9;
- }
-
- /* ArgumentName and ObjectFieldName */
- .cm-attribute {
- color: #8b2bb9;
- }
-
- /* Number */
- .cm-number {
- color: #2882f9;
- }
-
- /* String */
- .cm-string {
- color: #d64292;
- }
-
- /* Boolean */
- .cm-builtin {
- color: #d47509;
- }
-
- /* EnumValue */
- .cm-string-2 {
- color: #0b7fc7;
- }
-
- /* Variable */
- .cm-variable {
- color: #397d13;
- }
-
- /* Directive */
- .cm-meta {
- color: #b33086;
- }
-
- /* Type */
- .cm-atom {
- color: #ca9800;
- }
-
- /* CURSOR */
-
- /* DEFAULT THEME */
-
- .cm-s-default .cm-keyword {
- color: #708;
- }
-
- .cm-s-default .cm-atom {
- color: #219;
- }
-
- .cm-s-default .cm-number {
- color: #164;
- }
-
- .cm-s-default .cm-def {
- color: #00f;
- }
-
- .cm-s-default .cm-variable-2 {
- color: #05a;
- }
-
- .cm-s-default .cm-variable-3 {
- color: #085;
- }
-
- .cm-s-default .cm-comment {
- color: #a50;
- }
-
- .cm-s-default .cm-string {
- color: #a11;
- }
-
- .cm-s-default .cm-string-2 {
- color: #f50;
- }
-
- .cm-s-default .cm-meta {
- color: #555;
- }
-
- .cm-s-default .cm-qualifier {
- color: #555;
- }
-
- .cm-s-default .cm-builtin {
- color: #30a;
- }
-
- .cm-s-default .cm-bracket {
- color: #997;
- }
-
- .cm-s-default .cm-tag {
- color: #170;
- }
-
- .cm-s-default .cm-attribute {
- color: #00c;
- }
-
- .cm-s-default .cm-header {
- color: blue;
- }
-
- .cm-s-default .cm-quote {
- color: #090;
- }
-
- .cm-s-default .cm-hr {
- color: #999;
- }
-
- .cm-s-default .cm-link {
- color: #00c;
- }
-
- .cm-negative {
- color: #d44;
- }
-
- .cm-positive {
- color: #292;
- }
-
- .cm-header,
- .cm-strong {
- font-weight: bold;
- }
-
- .cm-em {
- font-style: italic;
- }
-
- .cm-link {
- text-decoration: underline;
- }
-
- .cm-strikethrough {
- text-decoration: line-through;
- }
-
- .cm-s-default .cm-error {
- color: #f00;
- }
-
- .cm-invalidchar {
- color: #f00;
- }
-
- .CodeMirror-composing {
- border-bottom: 2px solid;
- }
-
- /* Default styles for common addons */
-
- div.CodeMirror span.CodeMirror-matchingbracket {
- color: #0f0;
- }
-
- .CodeMirror-matchingtag {
- background: rgba(255, 150, 0, 0.3);
- }
-
- .CodeMirror-activeline-background {
- background: #e8f2ff;
- }
-
- /* STOP */
-
- .CodeMirror-info .type-name {
- color: #ca9800;
- }
-
- .CodeMirror-info .field-name {
- color: #1f61a0;
- }
-
- .CodeMirror-info .enum-value {
- color: #0b7fc7;
- }
-
- .CodeMirror-info .arg-name {
- color: #8b2bb9;
- }
-
- .CodeMirror-info .directive-name {
- color: #b33086;
- }
-
- .CodeMirror-jump-token {
- text-decoration: underline;
- cursor: pointer;
- }
-
- &&&&& .CodeMirror {
- border: 0;
- }
-
- &&& .CodeMirror-gutters {
- background: var(--ads-v2-color-bg-subtle);
- }
-`;
-
-export default QueryWrapper;
diff --git a/app/client/src/pages/Editor/APIEditor/RestAPIForm.tsx b/app/client/src/pages/Editor/APIEditor/RestAPIForm.tsx
index 0df046c99766..ab58d98d45fd 100644
--- a/app/client/src/pages/Editor/APIEditor/RestAPIForm.tsx
+++ b/app/client/src/pages/Editor/APIEditor/RestAPIForm.tsx
@@ -4,7 +4,7 @@ import type { InjectedFormProps } from "redux-form";
import { formValueSelector, reduxForm } from "redux-form";
import { API_EDITOR_FORM_NAME } from "ee/constants/forms";
import type { Action } from "entities/Action";
-import PostBodyData from "./PostBodyData";
+import PostBodyData from "PluginActionEditor/components/PluginActionForm/components/ApiEditor/PostBodyData";
import type { AppState } from "ee/reducers";
import { getApiName } from "selectors/formSelectors";
import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
@@ -12,9 +12,9 @@ import get from "lodash/get";
import { getAction, getActionResponses } from "ee/selectors/entitiesSelector";
import type { CommonFormProps } from "./CommonEditorForm";
import CommonEditorForm from "./CommonEditorForm";
-import Pagination from "./Pagination";
+import Pagination from "PluginActionEditor/components/PluginActionForm/components/ApiEditor/Pagination";
import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors";
-import { HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/CommonApiConstants";
+import { HTTP_METHOD_OPTIONS } from "PluginActionEditor/constants/CommonApiConstants";
type APIFormProps = {
httpMethodFromForm: string;
diff --git a/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx b/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
index f02daa78013b..943bf78b5adb 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
@@ -22,7 +22,7 @@ import {
getErrorCount,
getResponsePaneHeight,
} from "selectors/debuggerSelectors";
-import { ActionExecutionResizerHeight } from "../APIEditor/constants";
+import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants";
import { IDEBottomView, ViewHideBehaviour } from "IDE";
export const ResizerMainContainer = styled.div`
diff --git a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx
index 4c0cfad1f82b..b93acce4e8d1 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx
@@ -19,7 +19,7 @@ import type { ReduxAction } from "ee/constants/ReduxActionConstants";
import {
datasourceToFormValues,
formValuesToDatasource,
-} from "transformers/RestAPIDatasourceFormTransformer";
+} from "PluginActionEditor/transformers/RestAPIDatasourceFormTransformer";
import type {
ApiDatasourceForm,
AuthorizationCode,
diff --git a/app/client/src/pages/Editor/DataSourceEditor/index.tsx b/app/client/src/pages/Editor/DataSourceEditor/index.tsx
index abb3af295319..2d07855c50ee 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/index.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/index.tsx
@@ -81,7 +81,7 @@ import {
} from "components/formControls/utils";
import type { ControlProps } from "components/formControls/BaseControl";
import type { ApiDatasourceForm } from "entities/Datasource/RestAPIForm";
-import { formValuesToDatasource } from "transformers/RestAPIDatasourceFormTransformer";
+import { formValuesToDatasource } from "PluginActionEditor/transformers/RestAPIDatasourceFormTransformer";
import { DSFormHeader } from "./DSFormHeader";
import type { PluginType } from "entities/Action";
import { PluginPackageName } from "entities/Action";
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx
index f7bb63c49aa2..9685a2d26388 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx
@@ -13,7 +13,7 @@ import {
DATASOURCE_GENERATE_PAGE_BUTTON,
createMessage,
} from "ee/constants/messages";
-import Table from "pages/Editor/QueryEditor/Table";
+import Table from "PluginActionEditor/components/PluginActionResponse/components/Table";
import { generateTemplateToUpdatePage } from "actions/pageActions";
import {
getCurrentApplicationId,
diff --git a/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx b/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx
index 53c06181a4fb..72ca15f920e2 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx
@@ -10,7 +10,7 @@ import {
import type { DropdownOptions } from "../GeneratePage/components/constants";
import { DEFAULT_DROPDOWN_OPTION } from "../GeneratePage/components/constants";
import { isEmpty } from "lodash";
-import Table from "pages/Editor/QueryEditor/Table";
+import Table from "PluginActionEditor/components/PluginActionResponse/components/Table";
import {
getCurrentApplicationId,
getPagePermissions,
diff --git a/app/client/src/pages/Editor/EntityNavigation/ActionPane/ApiPaneNavigation.ts b/app/client/src/pages/Editor/EntityNavigation/ActionPane/ApiPaneNavigation.ts
index 4671eaae08ba..605b2aadd2f2 100644
--- a/app/client/src/pages/Editor/EntityNavigation/ActionPane/ApiPaneNavigation.ts
+++ b/app/client/src/pages/Editor/EntityNavigation/ActionPane/ApiPaneNavigation.ts
@@ -1,7 +1,7 @@
import { call, delay, put } from "redux-saga/effects";
import type { EntityInfo, IApiPaneNavigationConfig } from "../types";
import { ActionPaneNavigation } from "./exports";
-import { API_EDITOR_TABS } from "constants/ApiEditorConstants/CommonApiConstants";
+import { API_EDITOR_TABS } from "PluginActionEditor/constants/CommonApiConstants";
import { setPluginActionEditorSelectedTab } from "PluginActionEditor/store";
import { NAVIGATION_DELAY } from "../costants";
diff --git a/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx b/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx
index 8aa0204af4ab..fe87497930b5 100644
--- a/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx
+++ b/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx
@@ -4,8 +4,10 @@ import { MenuIcons } from "icons/MenuIcons";
import type { Plugin } from "api/PluginApi";
import ImageAlt from "assets/images/placeholder-image.svg";
import styled from "styled-components";
-import type { HTTP_METHOD } from "constants/ApiEditorConstants/CommonApiConstants";
-import { HTTP_METHODS_COLOR } from "constants/ApiEditorConstants/CommonApiConstants";
+import {
+ HTTP_METHODS_COLOR,
+ type HTTP_METHOD,
+} from "PluginActionEditor/constants/CommonApiConstants";
import { PRIMARY_KEY, FOREIGN_KEY } from "constants/DatasourceEditorConstants";
import { Icon } from "@appsmith/ads";
import { getAssetUrl } from "ee/utils/airgapHelpers";
diff --git a/app/client/src/pages/Editor/FormControl.tsx b/app/client/src/pages/Editor/FormControl.tsx
index 6610130ee7f1..453696742e35 100644
--- a/app/client/src/pages/Editor/FormControl.tsx
+++ b/app/client/src/pages/Editor/FormControl.tsx
@@ -27,8 +27,8 @@ import {
} from "ee/selectors/entitiesSelector";
import { get } from "lodash";
import { SQL_PLUGINS_DEFAULT_TEMPLATE_TYPE } from "constants/Datasource";
-import TemplateMenu from "./QueryEditor/TemplateMenu";
-import { SQL_DATASOURCES } from "../../constants/QueryEditorConstants";
+import TemplateMenu from "PluginActionEditor/components/PluginActionForm/components/UQIEditor/TemplateMenu";
+import { SQL_DATASOURCES } from "constants/QueryEditorConstants";
import type { Datasource, DatasourceStructure } from "entities/Datasource";
import { getCurrentEditingEnvironmentId } from "ee/selectors/environmentSelectors";
diff --git a/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx b/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx
index d68a3989431b..5fffcc1dc9ec 100644
--- a/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx
+++ b/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx
@@ -29,12 +29,12 @@ import {
} from "PluginActionEditor/store";
import type { SourceEntity } from "entities/AppsmithConsole";
import { ENTITY_TYPE as SOURCE_ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils";
-import { DocsLink, openDoc } from "../../../constants/DocumentationLinks";
+import { DocsLink, openDoc } from "constants/DocumentationLinks";
import { QueryEditorContext } from "./QueryEditorContext";
import QueryDebuggerTabs from "./QueryDebuggerTabs";
-import useShowSchema from "components/editorComponents/ActionRightPane/useShowSchema";
+import useShowSchema from "PluginActionEditor/components/PluginActionResponse/hooks/useShowSchema";
import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers";
-import FormRender from "./FormRender";
+import FormRender from "PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender";
import QueryEditorHeader from "./QueryEditorHeader";
import RunHistory from "ee/components/RunHistory";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
diff --git a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx
index 5e3b7ae6fe5e..7d283d140f59 100644
--- a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx
+++ b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx
@@ -14,12 +14,12 @@ import {
} from "ee/constants/messages";
import DebuggerLogs from "components/editorComponents/Debugger/DebuggerLogs";
import ErrorLogs from "components/editorComponents/Debugger/Errors";
-import Schema from "components/editorComponents/Debugger/Schema";
+import Schema from "PluginActionEditor/components/PluginActionResponse/components/Schema";
import type { ActionResponse } from "api/ActionAPI";
import { isString } from "lodash";
import type { SourceEntity } from "entities/AppsmithConsole";
import type { Action } from "entities/Action";
-import QueryResponseTab from "./QueryResponseTab";
+import QueryResponseTab from "PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab";
import {
getDatasourceStructureById,
getPluginDatasourceComponentFromId,
diff --git a/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx b/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx
index fc854b4d5135..71da172c95cc 100644
--- a/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx
+++ b/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx
@@ -1,8 +1,9 @@
import React from "react";
import { render, screen } from "test/testUtils";
import "@testing-library/jest-dom";
-import Table from "../QueryEditor/Table";
-import { getScrollBarWidth } from "../QueryEditor/Table";
+import Table, {
+ getScrollBarWidth,
+} from "PluginActionEditor/components/PluginActionResponse/components/Table";
function createEle() {
return {
diff --git a/app/client/src/reducers/uiReducers/datasourcePaneReducer.ts b/app/client/src/reducers/uiReducers/datasourcePaneReducer.ts
index 7d68494232d1..0790740e1fca 100644
--- a/app/client/src/reducers/uiReducers/datasourcePaneReducer.ts
+++ b/app/client/src/reducers/uiReducers/datasourcePaneReducer.ts
@@ -3,7 +3,7 @@ import type { ReduxAction } from "ee/constants/ReduxActionConstants";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import type { Datasource } from "entities/Datasource";
import _ from "lodash";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants";
const initialState: DatasourcePaneReduxState = {
drafts: {},
diff --git a/app/client/src/reducers/uiReducers/debuggerReducer.ts b/app/client/src/reducers/uiReducers/debuggerReducer.ts
index 64e6b4df363f..022d72939b5b 100644
--- a/app/client/src/reducers/uiReducers/debuggerReducer.ts
+++ b/app/client/src/reducers/uiReducers/debuggerReducer.ts
@@ -4,7 +4,7 @@ import type { ReduxAction } from "ee/constants/ReduxActionConstants";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import { omit, isUndefined, isEmpty } from "lodash";
import equal from "fast-deep-equal";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants";
import { klona } from "klona";
export const DefaultDebuggerContext = {
diff --git a/app/client/src/reducers/uiReducers/jsPaneReducer.ts b/app/client/src/reducers/uiReducers/jsPaneReducer.ts
index 362f3d7443b2..c8d8af615f60 100644
--- a/app/client/src/reducers/uiReducers/jsPaneReducer.ts
+++ b/app/client/src/reducers/uiReducers/jsPaneReducer.ts
@@ -5,7 +5,7 @@ import {
ReduxActionErrorTypes,
} from "ee/constants/ReduxActionConstants";
import type { JSCollection } from "entities/JSCollection";
-import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
+import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants";
export enum JSEditorTab {
CODE = "CODE",
diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts
index 8bb94aa0c5b4..2dc50983aa6b 100644
--- a/app/client/src/sagas/ActionSagas.ts
+++ b/app/client/src/sagas/ActionSagas.ts
@@ -50,7 +50,7 @@ import {
} from "actions/pluginActionActions";
import { getDynamicBindingsChangesSaga } from "utils/DynamicBindingUtils";
import { validateResponse } from "./ErrorSagas";
-import { transformRestAction } from "transformers/RestActionTransformer";
+import { transformRestAction } from "PluginActionEditor/transformers/RestActionTransformer";
import {
getCurrentBasePageId,
getCurrentPageId,
@@ -125,8 +125,8 @@ import {
API_EDITOR_FORM_NAME,
QUERY_EDITOR_FORM_NAME,
} from "ee/constants/forms";
-import { DEFAULT_GRAPHQL_ACTION_CONFIG } from "constants/ApiEditorConstants/GraphQLEditorConstants";
-import { DEFAULT_API_ACTION_CONFIG } from "constants/ApiEditorConstants/ApiEditorConstants";
+import { DEFAULT_GRAPHQL_ACTION_CONFIG } from "PluginActionEditor/constants/GraphQLEditorConstants";
+import { DEFAULT_API_ACTION_CONFIG } from "PluginActionEditor/constants/ApiEditorConstants";
import { fetchDatasourceStructure } from "actions/datasourceActions";
import { setAIPromptTriggered } from "utils/storage";
import { getDefaultTemplateActionConfig } from "utils/editorContextUtils";
diff --git a/app/client/src/sagas/ApiPaneSagas.ts b/app/client/src/sagas/ApiPaneSagas.ts
index cf6f4cf79046..4c895bda0f2c 100644
--- a/app/client/src/sagas/ApiPaneSagas.ts
+++ b/app/client/src/sagas/ApiPaneSagas.ts
@@ -25,9 +25,9 @@ import {
HTTP_METHOD,
POST_BODY_FORMAT_OPTIONS,
POST_BODY_FORMAT_OPTIONS_ARRAY,
-} from "constants/ApiEditorConstants/CommonApiConstants";
-import { DEFAULT_CREATE_API_CONFIG } from "constants/ApiEditorConstants/ApiEditorConstants";
-import { DEFAULT_CREATE_GRAPHQL_CONFIG } from "constants/ApiEditorConstants/GraphQLEditorConstants";
+} from "PluginActionEditor/constants/CommonApiConstants";
+import { DEFAULT_CREATE_API_CONFIG } from "PluginActionEditor/constants/ApiEditorConstants";
+import { DEFAULT_CREATE_GRAPHQL_CONFIG } from "PluginActionEditor/constants/GraphQLEditorConstants";
import history from "utils/history";
import { autofill, change, initialize, reset } from "redux-form";
import type { Property } from "api/ActionAPI";
@@ -78,12 +78,12 @@ import {
getApplicationByIdFromWorkspaces,
getCurrentApplicationIdForCreateNewApp,
} from "ee/selectors/applicationSelectors";
-import { DEFAULT_CREATE_APPSMITH_AI_CONFIG } from "constants/ApiEditorConstants/AppsmithAIEditorConstants";
+import { DEFAULT_CREATE_APPSMITH_AI_CONFIG } from "PluginActionEditor/constants/AppsmithAIEditorConstants";
import { checkAndGetPluginFormConfigsSaga } from "./PluginSagas";
import { convertToBasePageIdSelector } from "selectors/pageListSelectors";
import type { ApplicationPayload } from "entities/Application";
import { klonaLiteWithTelemetry } from "utils/helpers";
-import { POST_BODY_FORM_DATA_KEY } from "../PluginActionEditor/constants";
+import { POST_BODY_FORM_DATA_KEY } from "PluginActionEditor/store/constants";
function* syncApiParamsSaga(
actionPayload: ReduxActionWithMeta<string, { field: string }>,
diff --git a/app/client/src/sagas/CurlImportSagas.ts b/app/client/src/sagas/CurlImportSagas.ts
index bee2fe553937..631b040469b2 100644
--- a/app/client/src/sagas/CurlImportSagas.ts
+++ b/app/client/src/sagas/CurlImportSagas.ts
@@ -10,7 +10,7 @@ import CurlImportApi from "api/ImportApi";
import type { ApiResponse } from "api/ApiResponses";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors";
-import transformCurlImport from "transformers/CurlImportTransformer";
+import transformCurlImport from "PluginActionEditor/transformers/CurlImportTransformer";
import history from "utils/history";
import { CURL } from "constants/AppsmithActionConstants/ActionConstants";
import { apiEditorIdURL } from "ee/RouteBuilder";
diff --git a/app/client/src/sagas/ReplaySaga.ts b/app/client/src/sagas/ReplaySaga.ts
index 8d49191a5a34..942c4f880d9f 100644
--- a/app/client/src/sagas/ReplaySaga.ts
+++ b/app/client/src/sagas/ReplaySaga.ts
@@ -55,7 +55,7 @@ import {
isQueryAction,
isSaaSAction,
} from "entities/Action";
-import { API_EDITOR_TABS } from "constants/ApiEditorConstants/CommonApiConstants";
+import { API_EDITOR_TABS } from "PluginActionEditor/constants/CommonApiConstants";
import { EDITOR_TABS } from "constants/QueryEditorConstants";
import _, { isEmpty } from "lodash";
import type { ReplayEditorUpdate } from "entities/Replay/ReplayEntity/ReplayEditor";
diff --git a/app/client/src/utils/ApiPaneUtils.test.ts b/app/client/src/utils/ApiPaneUtils.test.ts
index a6cb65882243..99c9ab11bbbe 100644
--- a/app/client/src/utils/ApiPaneUtils.test.ts
+++ b/app/client/src/utils/ApiPaneUtils.test.ts
@@ -1,4 +1,4 @@
-import { POST_BODY_FORMAT_OPTIONS } from "constants/ApiEditorConstants/CommonApiConstants";
+import { POST_BODY_FORMAT_OPTIONS } from "PluginActionEditor/constants/CommonApiConstants";
import {
getContentTypeHeaderValue,
getIndextoUpdate,
diff --git a/app/client/src/utils/ApiPaneUtils.tsx b/app/client/src/utils/ApiPaneUtils.tsx
index f4c3bdfaf05d..7239ccfeade9 100644
--- a/app/client/src/utils/ApiPaneUtils.tsx
+++ b/app/client/src/utils/ApiPaneUtils.tsx
@@ -1,4 +1,4 @@
-import { CONTENT_TYPE_HEADER_KEY } from "constants/ApiEditorConstants/CommonApiConstants";
+import { CONTENT_TYPE_HEADER_KEY } from "../PluginActionEditor/constants/CommonApiConstants";
import {
getDynamicStringSegments,
isDynamicValue,
diff --git a/app/client/src/utils/helpers.tsx b/app/client/src/utils/helpers.tsx
index 520581f313c0..698a7d122817 100644
--- a/app/client/src/utils/helpers.tsx
+++ b/app/client/src/utils/helpers.tsx
@@ -10,7 +10,7 @@ import {
DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS,
JAVASCRIPT_KEYWORDS,
} from "constants/WidgetValidation";
-import { get, isNil, has, uniq } from "lodash";
+import { get, has, isNil, uniq } from "lodash";
import type { Workspace } from "ee/constants/workspaceConstants";
import { hasCreateNewAppPermission } from "ee/utils/permissionHelpers";
import moment from "moment";
@@ -57,21 +57,6 @@ export const snapToGrid = (
return [snappedX, snappedY];
};
-export const formatBytes = (bytes: string | number) => {
- if (!bytes) return;
-
- const value = typeof bytes === "string" ? parseInt(bytes) : bytes;
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
-
- if (value === 0) return "0 bytes";
-
- const i = parseInt(String(Math.floor(Math.log(value) / Math.log(1024))));
-
- if (i === 0) return bytes + " " + sizes[i];
-
- return (value / Math.pow(1024, i)).toFixed(1) + " " + sizes[i];
-};
-
export const getAbsolutePixels = (size?: string | null) => {
if (!size) return 0;
|
220b28df3e2aed42f91552e6df0c6b29972c9d0d
|
2021-03-05 10:04:35
|
Pawan Kumar
|
fix: TypeError: e is undefined (#3337)
| false
|
TypeError: e is undefined (#3337)
|
fix
|
diff --git a/app/client/src/sagas/WidgetOperationSagas.tsx b/app/client/src/sagas/WidgetOperationSagas.tsx
index 12bfbc18cd9f..f2d0b401677e 100644
--- a/app/client/src/sagas/WidgetOperationSagas.tsx
+++ b/app/client/src/sagas/WidgetOperationSagas.tsx
@@ -896,6 +896,10 @@ function* batchUpdateWidgetPropertySaga(
const { modify = {}, remove = [] } = updates;
const stateWidget: WidgetProps = yield select(getWidget, widgetId);
+
+ // if there is no widget in the state, don't do anything
+ if (!stateWidget) return;
+
let widget = cloneDeep(stateWidget);
try {
if (Object.keys(modify).length > 0) {
|
f6d2e89ae306a9142920025229af36f4b84bdbf9
|
2021-09-28 13:28:50
|
Shrikant Sharat Kandula
|
fix: Actions not being deleted when app is deleted (#7880)
| false
|
Actions not being deleted when app is deleted (#7880)
|
fix
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java
index 39edcb9d5a87..41734737115d 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java
@@ -3251,4 +3251,37 @@ public void updatePluginPackageNameIndexToPluginNamePackageNameAndVersion(Mongoc
.unique().named("plugin_name_package_name_version_index")
);
}
+
+ @ChangeSet(order = "090", id = "delete-orphan-actions", author = "")
+ public void deleteOrphanActions(MongockTemplate mongockTemplate) {
+ final Update deletionUpdates = new Update();
+ deletionUpdates.set(fieldName(QNewAction.newAction.deleted), true);
+ deletionUpdates.set(fieldName(QNewAction.newAction.deletedAt), Instant.now());
+
+ final List<NewAction> actions = mongockTemplate.find(
+ query(where(fieldName(QNewAction.newAction.deleted)).ne(true)),
+ NewAction.class
+ );
+
+ for (final NewAction action : actions) {
+ final String applicationId = action.getApplicationId();
+
+ final boolean shouldDelete = StringUtils.isEmpty(applicationId) || mongockTemplate.exists(
+ query(
+ where(fieldName(QApplication.application.id)).is(applicationId)
+ .and(fieldName(QApplication.application.deleted)).is(true)
+ ),
+ Application.class
+ );
+
+ if (shouldDelete) {
+ mongockTemplate.updateFirst(
+ query(where(fieldName(QNewAction.newAction.id)).is(action.getId())),
+ deletionUpdates,
+ NewAction.class
+ );
+ }
+ }
+ }
+
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/CustomNewActionRepository.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/CustomNewActionRepository.java
index 345a8675458f..baf2636c9ee6 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/CustomNewActionRepository.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/CustomNewActionRepository.java
@@ -10,6 +10,8 @@
import java.util.Set;
public interface CustomNewActionRepository extends AppsmithRepository<NewAction> {
+ Flux<NewAction> findByApplicationId(String applicationId, AclPermission aclPermission);
+
Mono<NewAction> findByUnpublishedNameAndPageId(String name, String pageId, AclPermission aclPermission);
Flux<NewAction> findByPageId(String pageId, AclPermission aclPermission);
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/CustomNewActionRepositoryImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/CustomNewActionRepositoryImpl.java
index 6592a8fde2b9..92b6575c7b43 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/CustomNewActionRepositoryImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/CustomNewActionRepositoryImpl.java
@@ -33,6 +33,12 @@ public CustomNewActionRepositoryImpl(ReactiveMongoOperations mongoOperations,
super(mongoOperations, mongoConverter);
}
+ @Override
+ public Flux<NewAction> findByApplicationId(String applicationId, AclPermission aclPermission) {
+ Criteria applicationIdCriteria = where(fieldName(QNewAction.newAction.applicationId)).is(applicationId);
+ return queryAll(List.of(applicationIdCriteria), aclPermission);
+ }
+
@Override
public Mono<NewAction> findByUnpublishedNameAndPageId(String name, String pageId, AclPermission aclPermission) {
Criteria nameCriteria = where(fieldName(QNewAction.newAction.unpublishedAction) + "." + fieldName(QNewAction.newAction.unpublishedAction.name)).is(name);
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java
index 4e2d6b808eed..e8e18e7d490f 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java
@@ -303,8 +303,10 @@ public Mono<Application> deleteApplication(String id) {
.switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.APPLICATION, id)))
.flatMap(application -> {
log.debug("Archiving pages for applicationId: {}", id);
- return newPageService.archivePagesByApplicationId(id, MANAGE_PAGES)
- .thenReturn(application);
+ return Mono.when(
+ newPageService.archivePagesByApplicationId(id, MANAGE_PAGES),
+ newActionService.archiveActionsByApplicationId(id, MANAGE_ACTIONS)
+ ).thenReturn(application);
})
.flatMap(applicationService::archive);
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/NewActionService.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/NewActionService.java
index 594cb6ad406d..ef2046e6c9a2 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/NewActionService.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/NewActionService.java
@@ -71,6 +71,8 @@ public interface NewActionService extends CrudService<NewAction, String> {
Mono<NewAction> archive(String id);
+ Mono<List<NewAction>> archiveActionsByApplicationId(String applicationId, AclPermission permission);
+
List<String> extractMustacheKeysInOrder(String query);
String replaceMustacheWithQuestionMark(String query, List<String> mustacheBindings);
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/NewActionServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/NewActionServiceImpl.java
index 1bc01186198b..4fede45f4d7f 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/NewActionServiceImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/NewActionServiceImpl.java
@@ -1254,6 +1254,13 @@ public Mono<NewAction> archive(String id) {
.flatMap(analyticsService::sendArchiveEvent);
}
+ @Override
+ public Mono<List<NewAction>> archiveActionsByApplicationId(String applicationId, AclPermission permission) {
+ return repository.findByApplicationId(applicationId, permission)
+ .flatMap(repository::archive)
+ .collectList();
+ }
+
public List<String> extractMustacheKeysInOrder(String query) {
return MustacheHelper.extractMustacheKeysInOrder(query);
}
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java
index b4527a178e3c..e3dcee3f83de 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java
@@ -1,13 +1,13 @@
package com.appsmith.server.services;
import com.appsmith.external.models.ActionConfiguration;
+import com.appsmith.external.models.Datasource;
import com.appsmith.external.models.DatasourceConfiguration;
import com.appsmith.external.models.Policy;
import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.constants.FieldName;
import com.appsmith.server.domains.Application;
import com.appsmith.server.domains.ApplicationPage;
-import com.appsmith.external.models.Datasource;
import com.appsmith.server.domains.GitApplicationMetadata;
import com.appsmith.server.domains.GitAuth;
import com.appsmith.server.domains.Layout;
@@ -29,6 +29,7 @@
import com.appsmith.server.helpers.PolicyUtils;
import com.appsmith.server.repositories.ApplicationRepository;
import com.appsmith.server.repositories.NewPageRepository;
+import com.appsmith.server.repositories.PluginRepository;
import com.appsmith.server.solutions.ApplicationFetcher;
import com.appsmith.server.solutions.ReleaseNotesService;
import lombok.extern.slf4j.Slf4j;
@@ -117,6 +118,9 @@ public class ApplicationServiceTest {
@Autowired
private PolicyUtils policyUtils;
+ @Autowired
+ private PluginRepository pluginRepository;
+
@MockBean
ReleaseNotesService releaseNotesService;
@@ -1348,4 +1352,61 @@ public void generateSshKeyPair_WhenDefaultApplicationIdSet_DefaultApplicationUpd
})
.verifyComplete();
}
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void deleteApplicationWithPagesAndActions() {
+ Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any())).thenReturn(Mono.just(new MockPluginExecutor()));
+
+ Application testApplication = new Application();
+ String appName = "deleteApplicationWithPagesAndActions";
+ testApplication.setName(appName);
+
+ Mono<NewAction> resultMono = applicationPageService.createApplication(testApplication, orgId)
+ .flatMap(application -> {
+ PageDTO page = new PageDTO();
+ page.setName("New Page");
+ page.setApplicationId(application.getId());
+ Layout defaultLayout = newPageService.createDefaultLayout();
+ List<Layout> layouts = new ArrayList<>();
+ layouts.add(defaultLayout);
+ page.setLayouts(layouts);
+ return Mono.zip(
+ applicationPageService.createPage(page),
+ pluginRepository.findByPackageName("installed-plugin")
+ );
+ })
+ .flatMap(tuple -> {
+ final PageDTO page = tuple.getT1();
+ final Plugin installedPlugin = tuple.getT2();
+
+ final Datasource datasource = new Datasource();
+ datasource.setName("Default Database");
+ datasource.setOrganizationId(orgId);
+ datasource.setPluginId(installedPlugin.getId());
+ datasource.setDatasourceConfiguration(new DatasourceConfiguration());
+
+ ActionDTO action = new ActionDTO();
+ action.setName("validAction");
+ action.setPageId(page.getId());
+ action.setExecuteOnLoad(true);
+ ActionConfiguration actionConfiguration = new ActionConfiguration();
+ actionConfiguration.setHttpMethod(HttpMethod.GET);
+ action.setActionConfiguration(actionConfiguration);
+ action.setDatasource(datasource);
+
+ return layoutActionService.createSingleAction(action)
+ .flatMap(action1 -> {
+ return applicationService.findById(page.getApplicationId(), MANAGE_APPLICATIONS)
+ .flatMap(application -> applicationPageService.deleteApplication(application.getId()))
+ .flatMap(ignored -> newActionService.findById(action1.getId()));
+ });
+ });
+
+ StepVerifier
+ .create(resultMono)
+ // Since the action should be deleted, we exmpty the Mono to complete empty.
+ .verifyComplete();
+ }
+
}
|
16fce059304cc5265f44fa1b55783ee5255121f5
|
2024-04-30 14:57:04
|
Ashok Kumar M
|
fix: render only the currently open detached widgets. (#33040)
| false
|
render only the currently open detached widgets. (#33040)
|
fix
|
diff --git a/app/client/src/ce/reducers/index.tsx b/app/client/src/ce/reducers/index.tsx
index f736df31f02e..63c376c2bfcb 100644
--- a/app/client/src/ce/reducers/index.tsx
+++ b/app/client/src/ce/reducers/index.tsx
@@ -81,6 +81,7 @@ import type { ActiveField } from "reducers/uiReducers/activeFieldEditorReducer";
import type { SelectedWorkspaceReduxState } from "@appsmith/reducers/uiReducers/selectedWorkspaceReducer";
import type { ConsolidatedPageLoadState } from "reducers/uiReducers/consolidatedPageLoadReducer";
import type { BuildingBlocksReduxState } from "reducers/uiReducers/buildingBlockReducer";
+import type { AnvilDetachedWidgetsReduxState } from "layoutSystems/anvil/integrations/reducers/anvilDetachedWidgetsReducer";
export const reducerObject = {
entities: entityReducer,
@@ -146,6 +147,7 @@ export interface AppState {
oneClickBinding: OneClickBindingState;
activeField: ActiveField;
ide: IDEState;
+ anvilDetachedWidgets: AnvilDetachedWidgetsReduxState;
};
entities: {
canvasWidgetsStructure: CanvasWidgetStructure;
diff --git a/app/client/src/ce/reducers/uiReducers/index.tsx b/app/client/src/ce/reducers/uiReducers/index.tsx
index 5d5312798d24..79dcf5de0afd 100644
--- a/app/client/src/ce/reducers/uiReducers/index.tsx
+++ b/app/client/src/ce/reducers/uiReducers/index.tsx
@@ -50,6 +50,7 @@ import activeFieldReducer from "reducers/uiReducers/activeFieldEditorReducer";
import selectedWorkspaceReducer from "@appsmith/reducers/uiReducers/selectedWorkspaceReducer";
import ideReducer from "../../../reducers/uiReducers/ideReducer";
import consolidatedPageLoadReducer from "reducers/uiReducers/consolidatedPageLoadReducer";
+import anvilDetachedWidgetsReducer from "layoutSystems/anvil/integrations/reducers/anvilDetachedWidgetsReducer";
export const uiReducerObject = {
analytics: analyticsReducer,
@@ -104,4 +105,5 @@ export const uiReducerObject = {
activeField: activeFieldReducer,
ide: ideReducer,
consolidatedPageLoad: consolidatedPageLoadReducer,
+ anvilDetachedWidgets: anvilDetachedWidgetsReducer,
};
diff --git a/app/client/src/layoutSystems/anvil/common/hooks/detachedWidgetHooks.ts b/app/client/src/layoutSystems/anvil/common/hooks/detachedWidgetHooks.ts
index e5fa7d7db94d..c349a2269c5f 100644
--- a/app/client/src/layoutSystems/anvil/common/hooks/detachedWidgetHooks.ts
+++ b/app/client/src/layoutSystems/anvil/common/hooks/detachedWidgetHooks.ts
@@ -3,19 +3,12 @@ import { useDispatch, useSelector } from "react-redux";
import { useWidgetSelection } from "utils/hooks/useWidgetSelection";
import { combinedPreviewModeSelector } from "selectors/editorSelectors";
import { SELECT_ANVIL_WIDGET_CUSTOM_EVENT } from "layoutSystems/anvil/utils/constants";
-import { renderChildWidget } from "layoutSystems/common/utils/canvasUtils";
-import type { WidgetProps } from "widgets/BaseWidget";
-import { getRenderMode } from "selectors/editorSelectors";
-import { denormalize } from "utils/canvasStructureHelpers";
-import type { CanvasWidgetStructure } from "WidgetProvider/constants";
-import { getWidgets } from "sagas/selectors";
import log from "loglevel";
import { useEffect, useMemo } from "react";
import { getAnvilWidgetDOMId } from "layoutSystems/common/utils/LayoutElementPositionsObserver/utils";
-import {
- MAIN_CONTAINER_WIDGET_ID,
- type RenderModes,
-} from "constants/WidgetConstants";
+import { getCurrentlyOpenAnvilDetachedWidgets } from "layoutSystems/anvil/integrations/modalSelectors";
+import { getCanvasWidgetsStructure } from "@appsmith/selectors/entitiesSelector";
+import type { CanvasWidgetStructure } from "WidgetProvider/constants";
/**
* This hook is used to select and focus on a detached widget
* As detached widgets are outside of the layout flow, we need to access the correct element in the DOM
@@ -114,48 +107,25 @@ export function useAddBordersToDetachedWidgets(widgetId: string) {
* @param children
* @returns
*/
-function useDetachedChildren(children: CanvasWidgetStructure[]) {
+export function useDetachedChildren() {
const start = performance.now();
// Get all widgets
- const widgets = useSelector(getWidgets);
+ const widgets = useSelector(getCanvasWidgetsStructure);
+ const currentlyOpenWidgets = useSelector(
+ getCurrentlyOpenAnvilDetachedWidgets,
+ );
// Filter out the detached children and denormalise each of the detached widgets to generate
// a DSL like hierarchy
const detachedChildren = useMemo(() => {
- return children
- .map((child) => widgets[child.widgetId])
- .filter((child) => child.detachFromLayout === true)
- .map((child) => {
- return denormalize(child.widgetId, widgets);
- });
- }, [children, widgets]);
+ const allChildren = currentlyOpenWidgets.map((widgetId) => {
+ return (
+ widgets.children &&
+ widgets.children.find((each) => each.widgetId === widgetId)
+ );
+ });
+ return allChildren.filter((child) => !!child) as CanvasWidgetStructure[];
+ }, [currentlyOpenWidgets, widgets]);
const end = performance.now();
log.debug("### Computing detached children took:", end - start, "ms");
return detachedChildren;
}
-
-export function useRenderDetachedChildren(
- widgetId: string,
- children: CanvasWidgetStructure[],
-) {
- const renderMode: RenderModes = useSelector(getRenderMode);
- // Get the detached children to render on the canvas
- const detachedChildren = useDetachedChildren(children);
- let renderDetachedChildren = null;
- if (widgetId === MAIN_CONTAINER_WIDGET_ID) {
- renderDetachedChildren = detachedChildren.map((child) =>
- renderChildWidget({
- childWidgetData: child as WidgetProps,
- defaultWidgetProps: {
- className: `${getAnvilWidgetDOMId(child.widgetId)}`,
- },
- noPad: false,
- // Adding these properties as the type insists on providing this
- // while it is not required for detached children
- layoutSystemProps: { parentColumnSpace: 1, parentRowSpace: 1 },
- renderMode,
- widgetId: MAIN_CONTAINER_WIDGET_ID,
- }),
- );
- }
- return renderDetachedChildren;
-}
diff --git a/app/client/src/layoutSystems/anvil/integrations/actions/actionTypes.ts b/app/client/src/layoutSystems/anvil/integrations/actions/actionTypes.ts
index 724d13a8fea8..62d8f1fcd4a1 100644
--- a/app/client/src/layoutSystems/anvil/integrations/actions/actionTypes.ts
+++ b/app/client/src/layoutSystems/anvil/integrations/actions/actionTypes.ts
@@ -40,4 +40,7 @@ export enum AnvilReduxActionTypes {
ANVIL_SPACE_DISTRIBUTION_STOP = "ANVIL_SPACE_DISTRIBUTION_STOP",
ANVIL_SET_HIGHLIGHT_SHOWN = "ANVIL_SET_HIGHLIGHT_SHOWN",
ANVIL_WIDGET_SELECTION_CLICK = "ANVIL_WIDGET_SELECTION_CLICK",
+ SHOW_DETACHED_WIDGET = "SHOW_DETACHED_WIDGET",
+ HIDE_DETACHED_WIDGET = "HIDE_DETACHED_WIDGET",
+ RESET_DETACHED_WIDGETS = "RESET_DETACHED_WIDGETS",
}
diff --git a/app/client/src/layoutSystems/anvil/integrations/actions/detachedWidgetActions.ts b/app/client/src/layoutSystems/anvil/integrations/actions/detachedWidgetActions.ts
new file mode 100644
index 000000000000..197bf72d4e76
--- /dev/null
+++ b/app/client/src/layoutSystems/anvil/integrations/actions/detachedWidgetActions.ts
@@ -0,0 +1,21 @@
+import { AnvilReduxActionTypes } from "./actionTypes";
+
+export const showDetachedWidgetAction = (widgetId: string) => {
+ return {
+ type: AnvilReduxActionTypes.SHOW_DETACHED_WIDGET,
+ payload: widgetId,
+ };
+};
+
+export const hideDetachedWidgetAction = (widgetId: string) => {
+ return {
+ type: AnvilReduxActionTypes.HIDE_DETACHED_WIDGET,
+ payload: widgetId,
+ };
+};
+
+export const resetDetachedWidgetsAction = () => {
+ return {
+ type: AnvilReduxActionTypes.RESET_DETACHED_WIDGETS,
+ };
+};
diff --git a/app/client/src/layoutSystems/anvil/integrations/modalSelectors.ts b/app/client/src/layoutSystems/anvil/integrations/modalSelectors.ts
index 8b04d4c27c71..9f5c6a7e5cd5 100644
--- a/app/client/src/layoutSystems/anvil/integrations/modalSelectors.ts
+++ b/app/client/src/layoutSystems/anvil/integrations/modalSelectors.ts
@@ -1,16 +1,5 @@
import type { AppState } from "@appsmith/reducers";
-import { getWidgetIdsByType, getWidgetsMeta } from "sagas/selectors";
-import { WDSModalWidget } from "widgets/wds/WDSModalWidget";
-export const getCurrentlyOpenAnvilModal = (state: AppState) => {
- const allExistingModals = getWidgetIdsByType(state, WDSModalWidget.type);
- if (allExistingModals.length === 0) {
- return;
- }
- const metaWidgets = getWidgetsMeta(state);
- const currentlyOpenModal = allExistingModals.find((modalId) => {
- const modal = metaWidgets[modalId];
- return modal && modal.isVisible;
- });
- return currentlyOpenModal;
+export const getCurrentlyOpenAnvilDetachedWidgets = (state: AppState) => {
+ return state.ui.anvilDetachedWidgets.currentlyOpenDetachedWidgets;
};
diff --git a/app/client/src/layoutSystems/anvil/integrations/reducers/anvilDetachedWidgetsReducer.ts b/app/client/src/layoutSystems/anvil/integrations/reducers/anvilDetachedWidgetsReducer.ts
new file mode 100644
index 000000000000..b0aa0dcbd71e
--- /dev/null
+++ b/app/client/src/layoutSystems/anvil/integrations/reducers/anvilDetachedWidgetsReducer.ts
@@ -0,0 +1,36 @@
+import { createImmerReducer } from "utils/ReducerUtils";
+import {
+ AnvilReduxActionTypes,
+ type AnvilReduxAction,
+} from "../actions/actionTypes";
+
+export interface AnvilDetachedWidgetsReduxState {
+ currentlyOpenDetachedWidgets: string[];
+}
+const initialState: AnvilDetachedWidgetsReduxState = {
+ currentlyOpenDetachedWidgets: [],
+};
+const anvilDetachedWidgetsReducer = createImmerReducer(initialState, {
+ [AnvilReduxActionTypes.SHOW_DETACHED_WIDGET]: (
+ state: AnvilDetachedWidgetsReduxState,
+ action: AnvilReduxAction<string>,
+ ) => {
+ state.currentlyOpenDetachedWidgets.push(action.payload);
+ },
+ [AnvilReduxActionTypes.HIDE_DETACHED_WIDGET]: (
+ state: AnvilDetachedWidgetsReduxState,
+ action: AnvilReduxAction<string>,
+ ) => {
+ state.currentlyOpenDetachedWidgets =
+ state.currentlyOpenDetachedWidgets.filter(
+ (widgetId) => widgetId !== action.payload,
+ );
+ },
+ [AnvilReduxActionTypes.RESET_DETACHED_WIDGETS]: (
+ state: AnvilDetachedWidgetsReduxState,
+ ) => {
+ state.currentlyOpenDetachedWidgets = [];
+ },
+});
+
+export default anvilDetachedWidgetsReducer;
diff --git a/app/client/src/layoutSystems/anvil/integrations/sagas/anvilDetachedWidgetSagas.ts b/app/client/src/layoutSystems/anvil/integrations/sagas/anvilDetachedWidgetSagas.ts
new file mode 100644
index 000000000000..58dec5659723
--- /dev/null
+++ b/app/client/src/layoutSystems/anvil/integrations/sagas/anvilDetachedWidgetSagas.ts
@@ -0,0 +1,46 @@
+import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
+import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
+import { all, put, select, takeEvery, takeLatest } from "redux-saga/effects";
+import { callSagaOnlyForAnvil } from "./utils";
+import {
+ hideDetachedWidgetAction,
+ resetDetachedWidgetsAction,
+ showDetachedWidgetAction,
+} from "../actions/detachedWidgetActions";
+import { getWidgetByName } from "sagas/selectors";
+import type { FlattenedWidgetProps } from "WidgetProvider/constants";
+
+function* closeAnvilModalSaga(action: ReduxAction<{ modalName?: string }>) {
+ const { modalName } = action.payload;
+
+ if (modalName) {
+ const widget: FlattenedWidgetProps | undefined = yield select(
+ getWidgetByName,
+ modalName,
+ );
+ if (widget) {
+ hideDetachedWidgetAction(widget.widgetId);
+ }
+ } else {
+ yield put(resetDetachedWidgetsAction());
+ }
+}
+
+function* showAnvilModalSaga(action: ReduxAction<{ modalId: string }>) {
+ yield put(showDetachedWidgetAction(action.payload.modalId));
+}
+
+export default function* anvilDetachedWidgetSagas() {
+ yield all([
+ takeEvery(
+ ReduxActionTypes.CLOSE_MODAL,
+ callSagaOnlyForAnvil,
+ closeAnvilModalSaga,
+ ),
+ takeLatest(
+ ReduxActionTypes.SHOW_MODAL,
+ callSagaOnlyForAnvil,
+ showAnvilModalSaga,
+ ),
+ ]);
+}
diff --git a/app/client/src/layoutSystems/anvil/integrations/sagas/index.ts b/app/client/src/layoutSystems/anvil/integrations/sagas/index.ts
index 69337fd560eb..0ef168cf26e5 100644
--- a/app/client/src/layoutSystems/anvil/integrations/sagas/index.ts
+++ b/app/client/src/layoutSystems/anvil/integrations/sagas/index.ts
@@ -5,6 +5,7 @@ import anvilSectionSagas from "./sectionSagas";
import anvilSpaceDistributionSagas from "./anvilSpaceDistributionSagas";
import anvilWidgetSelectionSaga from "./anvilWidgetSelectionSaga";
import pasteSagas from "./pasteSagas";
+import anvilDetachedWidgetSagas from "./anvilDetachedWidgetSagas";
export default function* anvilSagas() {
yield fork(LayoutElementPositionsSaga);
@@ -13,4 +14,5 @@ export default function* anvilSagas() {
yield fork(anvilSpaceDistributionSagas);
yield fork(anvilWidgetSelectionSaga);
yield fork(pasteSagas);
+ yield fork(anvilDetachedWidgetSagas);
}
diff --git a/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas.ts b/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas.ts
index 2f8d264bcac7..65ffff384a53 100644
--- a/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas.ts
+++ b/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas.ts
@@ -7,7 +7,6 @@ import { updateAndSaveAnvilLayout } from "../../utils/anvilChecksUtils";
import { builderURL } from "@appsmith/RouteBuilder";
import { getCurrentPageId } from "selectors/editorSelectors";
import {
- type ReduxAction,
ReduxActionErrorTypes,
ReduxActionTypes,
} from "@appsmith/constants/ReduxActionConstants";
@@ -24,7 +23,7 @@ import { getDestinedParent } from "layoutSystems/anvil/utils/paste/destinationUt
import { pasteWidgetsIntoMainCanvas } from "layoutSystems/anvil/utils/paste/mainCanvasPasteUtils";
import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
import WidgetFactory from "WidgetProvider/factory";
-import { getIsAnvilLayout } from "../selectors";
+import { callSagaOnlyForAnvil } from "./utils";
function* pasteWidgetSagas() {
try {
@@ -122,18 +121,11 @@ function* pasteWidgetSagas() {
}
}
-function* shouldCallSaga(saga: any, action: ReduxAction<unknown>) {
- const isAnvilLayout: boolean = yield select(getIsAnvilLayout);
- if (isAnvilLayout) {
- yield call(saga, action);
- }
-}
-
export default function* pasteSagas() {
yield all([
takeLeading(
ReduxActionTypes.PASTE_COPIED_WIDGET_INIT,
- shouldCallSaga,
+ callSagaOnlyForAnvil,
pasteWidgetSagas,
),
]);
diff --git a/app/client/src/layoutSystems/anvil/integrations/sagas/utils.ts b/app/client/src/layoutSystems/anvil/integrations/sagas/utils.ts
new file mode 100644
index 000000000000..1c5f37cab019
--- /dev/null
+++ b/app/client/src/layoutSystems/anvil/integrations/sagas/utils.ts
@@ -0,0 +1,10 @@
+import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
+import { call, select } from "redux-saga/effects";
+import { getIsAnvilLayout } from "../selectors";
+
+export function* callSagaOnlyForAnvil(saga: any, action: ReduxAction<unknown>) {
+ const isAnvilLayout: boolean = yield select(getIsAnvilLayout);
+ if (isAnvilLayout) {
+ yield call(saga, action);
+ }
+}
diff --git a/app/client/src/layoutSystems/anvil/viewer/canvas/AnvilDetachedWidgets.tsx b/app/client/src/layoutSystems/anvil/viewer/canvas/AnvilDetachedWidgets.tsx
new file mode 100644
index 000000000000..650cde35595e
--- /dev/null
+++ b/app/client/src/layoutSystems/anvil/viewer/canvas/AnvilDetachedWidgets.tsx
@@ -0,0 +1,34 @@
+import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
+import { useDetachedChildren } from "layoutSystems/anvil/common/hooks/detachedWidgetHooks";
+import { getAnvilWidgetDOMId } from "layoutSystems/common/utils/LayoutElementPositionsObserver/utils";
+import { renderChildWidget } from "layoutSystems/common/utils/canvasUtils";
+import React from "react";
+import { useSelector } from "react-redux";
+import { getRenderMode } from "selectors/editorSelectors";
+import type { WidgetProps } from "widgets/BaseWidget";
+
+export const AnvilDetachedWidgets = () => {
+ const detachedChildren = useDetachedChildren();
+ const renderMode = useSelector(getRenderMode);
+ return (
+ <>
+ {detachedChildren.map((child) =>
+ renderChildWidget({
+ childWidgetData: child as WidgetProps,
+ defaultWidgetProps: {
+ className: `${getAnvilWidgetDOMId(child.widgetId)}`,
+ },
+ noPad: false,
+ // Adding these properties as the type insists on providing this
+ // while it is not required for detached children
+ layoutSystemProps: {
+ layoutId: "",
+ rowIndex: 0,
+ },
+ renderMode,
+ widgetId: MAIN_CONTAINER_WIDGET_ID,
+ }),
+ )}
+ </>
+ );
+};
diff --git a/app/client/src/layoutSystems/anvil/viewer/canvas/AnvilViewerCanvas.tsx b/app/client/src/layoutSystems/anvil/viewer/canvas/AnvilViewerCanvas.tsx
index ed9b89b4cf91..6d7389c422b1 100644
--- a/app/client/src/layoutSystems/anvil/viewer/canvas/AnvilViewerCanvas.tsx
+++ b/app/client/src/layoutSystems/anvil/viewer/canvas/AnvilViewerCanvas.tsx
@@ -2,8 +2,8 @@ import React, { useMemo } from "react";
import styles from "./styles.module.css";
import type { BaseWidgetProps } from "widgets/BaseWidgetHOC/withBaseWidgetHOC";
import { getAnvilCanvasId } from "./utils";
-import { useRenderDetachedChildren } from "layoutSystems/anvil/common/hooks/detachedWidgetHooks";
import { LayoutProvider } from "layoutSystems/anvil/layoutComponents/LayoutProvider";
+import { AnvilDetachedWidgets } from "./AnvilDetachedWidgets";
export const AnvilViewerCanvas = React.forwardRef(
(props: BaseWidgetProps, ref: React.ForwardedRef<HTMLDivElement>) => {
const className: string = useMemo(
@@ -11,14 +11,9 @@ export const AnvilViewerCanvas = React.forwardRef(
[props.classList],
);
- const renderDetachedChildren = useRenderDetachedChildren(
- props.widgetId,
- props.children,
- );
-
return (
<>
- {renderDetachedChildren}
+ <AnvilDetachedWidgets />
<div
className={className}
id={getAnvilCanvasId(props.widgetId)}
|
06168ecb60ddc1819c54692d35d4f522afb71c8c
|
2022-05-04 10:45:27
|
ashit-rath
|
fix: submit button not disabled in invalid json form on first load (#13415)
| false
|
submit button not disabled in invalid json form on first load (#13415)
|
fix
|
diff --git a/app/client/cypress/fixtures/jsonFormDslWithoutSchema.json b/app/client/cypress/fixtures/jsonFormDslWithoutSchema.json
index 71edcb5d5b8a..9e9e776cadf8 100644
--- a/app/client/cypress/fixtures/jsonFormDslWithoutSchema.json
+++ b/app/client/cypress/fixtures/jsonFormDslWithoutSchema.json
@@ -20,6 +20,32 @@
"dynamicBindingPathList": [],
"leftColumn": 0,
"children": [
+ {
+ "widgetName": "Text1",
+ "displayName": "Text",
+ "iconSVG": "/static/media/icon.97c59b52.svg",
+ "topRow": 54,
+ "bottomRow": 58,
+ "parentRowSpace": 10,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "animateLoading": true,
+ "parentColumnSpace": 18.0625,
+ "leftColumn": 22,
+ "text": "Label",
+ "key": "zgsygilz5a",
+ "rightColumn": 38,
+ "textAlign": "LEFT",
+ "widgetId": "ums2hvawa0",
+ "isVisible": true,
+ "fontStyle": "BOLD",
+ "textColor": "#231F20",
+ "version": 1,
+ "parentId": "0",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "fontSize": "PARAGRAPH"
+ },
{
"isVisible": true,
"backgroundColor": "#fff",
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/JSONFormWidget/JSONForm_FormProperties_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/JSONFormWidget/JSONForm_FormProperties_spec.js
index 6c51c201d7be..773ba1d324fc 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/JSONFormWidget/JSONForm_FormProperties_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/JSONFormWidget/JSONForm_FormProperties_spec.js
@@ -1,6 +1,8 @@
const commonlocators = require("../../../../../locators/commonlocators.json");
const dslWithSchema = require("../../../../../fixtures/jsonFormDslWithSchema.json");
+const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
+const publishPage = require("../../../../../locators/publishWidgetspage.json");
const backBtn = ".t--property-pane-back-btn";
const fieldPrefix = ".t--jsonformfield";
@@ -87,4 +89,68 @@ describe("JSON Form Widget Form Bindings", () => {
cy.get(`${widgetsPage.textWidget} .bp3-ui-text`).contains("true");
});
+
+ it("Should set isValid to false on first load when form is invalid", () => {
+ cy.addDsl(dslWithoutSchema);
+
+ const schema = {
+ name: "",
+ };
+
+ cy.openPropertyPane("textwidget");
+ cy.testJsontext("text", "{{JSONForm1.isValid}}");
+
+ cy.openPropertyPane("jsonformwidget");
+ cy.testJsontext("sourcedata", JSON.stringify(schema));
+
+ // make name field required
+ cy.openFieldConfiguration("name");
+ cy.togglebar(`${propertyControlPrefix}-required input`);
+
+ cy.PublishtheApp();
+
+ cy.get(".t--widget-textwidget .bp3-ui-text").contains("false");
+
+ cy.get(publishPage.backToEditor).click({ force: true });
+ });
+
+ it("Should set isValid to false on reset when form is invalid", () => {
+ cy.addDsl(dslWithoutSchema);
+
+ const schema = {
+ name: "",
+ };
+
+ cy.openPropertyPane("textwidget");
+ cy.testJsontext("text", "{{JSONForm1.isValid}}");
+
+ cy.openPropertyPane("jsonformwidget");
+ cy.testJsontext("sourcedata", JSON.stringify(schema));
+
+ // make name field required
+ cy.openFieldConfiguration("name");
+ cy.togglebar(`${propertyControlPrefix}-required input`);
+
+ cy.PublishtheApp();
+
+ cy.get(".t--widget-textwidget .bp3-ui-text").contains("false");
+
+ // Click reset button
+ cy.get("button")
+ .contains("Reset")
+ .click({ force: true });
+ cy.get(".t--widget-textwidget .bp3-ui-text").contains("false");
+
+ // Type JOHN in name field
+ cy.get(`${fieldPrefix}-name input`).type("JOHN");
+ cy.get(".t--widget-textwidget .bp3-ui-text").contains("true");
+
+ // Click reset button
+ cy.get("button")
+ .contains("Reset")
+ .click({ force: true });
+ cy.get(".t--widget-textwidget .bp3-ui-text").contains("false");
+
+ cy.get(publishPage.backToEditor).click({ force: true });
+ });
});
diff --git a/app/client/src/widgets/JSONFormWidget/component/Form.tsx b/app/client/src/widgets/JSONFormWidget/component/Form.tsx
index 956e37a67716..eb5d873b3dec 100644
--- a/app/client/src/widgets/JSONFormWidget/component/Form.tsx
+++ b/app/client/src/widgets/JSONFormWidget/component/Form.tsx
@@ -117,6 +117,10 @@ const StyledResetButtonWrapper = styled.div`
const DEBOUNCE_TIMEOUT = 200;
+const RESET_OPTIONS = {
+ keepErrors: true,
+};
+
function Form<TValues = any>({
backgroundColor,
children,
@@ -166,7 +170,7 @@ function Form<TValues = any>({
: {};
if (typeof defaultValues === "object") {
- reset(defaultValues);
+ reset(defaultValues, RESET_OPTIONS);
}
};
@@ -206,7 +210,7 @@ function Form<TValues = any>({
* race condition in ReactHookForm.
*/
setTimeout(() => {
- reset(convertedFormData);
+ reset(convertedFormData, RESET_OPTIONS);
}, 0);
}
}
diff --git a/app/client/src/widgets/JSONFormWidget/fields/useRegisterFieldValidity.ts b/app/client/src/widgets/JSONFormWidget/fields/useRegisterFieldValidity.ts
index 59ccdf651746..b031daab1ed4 100644
--- a/app/client/src/widgets/JSONFormWidget/fields/useRegisterFieldValidity.ts
+++ b/app/client/src/widgets/JSONFormWidget/fields/useRegisterFieldValidity.ts
@@ -25,16 +25,23 @@ function useRegisterFieldValidity({
const { setMetaInternalFieldState } = useContext(FormContext);
useEffect(() => {
- try {
- isValid
- ? clearErrors(fieldName)
- : setError(fieldName, {
- type: fieldType,
- message: "Invalid field",
- });
- } catch (e) {
- Sentry.captureException(e);
- }
+ /**
+ * TODO (Ashit): This setTimeout is a patch to avoid a plausible race-condition when a bunch
+ * of fields are registered in ReactHookForm and internally the error is lost.
+ * This needs to be further investigated.
+ */
+ setTimeout(() => {
+ try {
+ isValid
+ ? clearErrors(fieldName)
+ : setError(fieldName, {
+ type: fieldType,
+ message: "Invalid field",
+ });
+ } catch (e) {
+ Sentry.captureException(e);
+ }
+ }, 0);
setMetaInternalFieldState((prevState) => {
const metaInternalFieldState = klona(prevState.metaInternalFieldState);
diff --git a/app/client/src/widgets/JSONFormWidget/widget/index.tsx b/app/client/src/widgets/JSONFormWidget/widget/index.tsx
index 55d560b715ac..da9404a8d823 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/index.tsx
+++ b/app/client/src/widgets/JSONFormWidget/widget/index.tsx
@@ -22,7 +22,6 @@ import {
import { ButtonStyleProps } from "widgets/ButtonWidget/component";
import { BoxShadow } from "components/designSystems/appsmith/WidgetStyleContainer";
import { convertSchemaItemToFormData } from "../helper";
-import { DebouncedExecuteActionPayload } from "widgets/MetaHOC";
export interface JSONFormWidgetProps extends WidgetProps {
autoGenerateForm?: boolean;
@@ -207,16 +206,19 @@ class JSONFormWidget extends BaseWidget<
parseAndSaveFieldState = (
metaInternalFieldState: MetaInternalFieldState,
schema: Schema,
- afterUpdateAction?: DebouncedExecuteActionPayload,
+ afterUpdateAction?: ExecuteTriggerPayload,
) => {
const fieldState = generateFieldState(schema, metaInternalFieldState);
if (!equal(fieldState, this.props.fieldState)) {
- this.props.updateWidgetMetaProperty(
- "fieldState",
- fieldState,
- afterUpdateAction,
- );
+ /**
+ * Using syncUpdateWidgetMetaProperty to avoid race-condition when
+ * multiple properties are updating in quick succession. As sync fn
+ * does not support action execution as a callback, it has to be
+ * explicitly called.
+ */
+ this.props.syncUpdateWidgetMetaProperty("fieldState", fieldState);
+ afterUpdateAction && this.executeAction(afterUpdateAction);
}
};
@@ -260,7 +262,7 @@ class JSONFormWidget extends BaseWidget<
setMetaInternalFieldState = (
updateCallback: (prevState: JSONFormWidgetState) => JSONFormWidgetState,
- afterUpdateAction?: DebouncedExecuteActionPayload,
+ afterUpdateAction?: ExecuteTriggerPayload,
) => {
this.setState((prevState) => {
const newState = updateCallback(prevState);
|
8d34a2ac280e2263851fd24e720d26811545b625
|
2023-10-18 19:37:42
|
Shrikant Sharat Kandula
|
chore: Add BASE build arg to `local_testing.sh`
| false
|
Add BASE build arg to `local_testing.sh`
|
chore
|
diff --git a/scripts/local_testing.sh b/scripts/local_testing.sh
index 95734c1bc187..31766c153812 100755
--- a/scripts/local_testing.sh
+++ b/scripts/local_testing.sh
@@ -72,6 +72,11 @@ else
pretty_print "Local branch is now up to date. Starting server build ..."
fi
+edition=ce
+if [[ "$(git remote get-url origin)" == *"/appsmith-ee"* ]]; then
+ edition=ee
+fi
+
pretty_print "Starting server build ..."
pushd app/server > /dev/null && ./build.sh -DskipTests > /dev/null && pretty_print "Server build successful. Starting client build ..."
@@ -83,7 +88,11 @@ popd
pushd app/client/packages/rts/ > /dev/null && ./build.sh > /dev/null && pretty_print "RTS build successful. Starting Docker build ..."
popd
-docker build -t appsmith/appsmith-ce:local-testing --build-arg APPSMITH_CLOUD_SERVICES_BASE_URL="${cs_url:-https://release-cs.appsmith.com}" . > /dev/null
+docker build -t appsmith/appsmith-ce:local-testing \
+ --build-arg BASE="appsmith/base-$edition:release" \
+ --build-arg APPSMITH_CLOUD_SERVICES_BASE_URL="${cs_url:-https://release-cs.appsmith.com}" \
+ . \
+ > /dev/null
pretty_print "Docker image build successful. Triggering run now ..."
(docker stop appsmith || true) && (docker rm appsmith || true)
|
788adf259c898e011ae3f9574f5abbb11ca6fc4b
|
2023-10-17 12:34:38
|
Nidhi
|
chore: Added ce compatible layer for git (#28144)
| false
|
Added ce compatible layer for git (#28144)
|
chore
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java
index 701276a854ab..32dbafb58055 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java
@@ -14,7 +14,7 @@
import com.appsmith.server.newpages.base.NewPageService;
import com.appsmith.server.plugins.base.PluginService;
import com.appsmith.server.repositories.GitDeployKeysRepository;
-import com.appsmith.server.services.ce.GitServiceCEImpl;
+import com.appsmith.server.services.ce_compatible.GitServiceCECompatibleImpl;
import com.appsmith.server.solutions.ApplicationPermission;
import com.appsmith.server.solutions.DatasourcePermission;
import io.micrometer.observation.ObservationRegistry;
@@ -25,7 +25,7 @@
@Slf4j
@Service
@Import({GitExecutorImpl.class})
-public class GitServiceImpl extends GitServiceCEImpl implements GitService {
+public class GitServiceImpl extends GitServiceCECompatibleImpl implements GitService {
public GitServiceImpl(
UserService userService,
UserDataService userDataService,
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatible.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatible.java
new file mode 100644
index 000000000000..cab919506d99
--- /dev/null
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatible.java
@@ -0,0 +1,3 @@
+package com.appsmith.server.services.ce_compatible;
+
+public interface GitServiceCECompatible extends GitServiceCE {}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatibleImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatibleImpl.java
new file mode 100644
index 000000000000..623e28640687
--- /dev/null
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatibleImpl.java
@@ -0,0 +1,80 @@
+package com.appsmith.server.services.ce_compatible;
+
+import com.appsmith.external.git.GitExecutor;
+import com.appsmith.server.actioncollections.base.ActionCollectionService;
+import com.appsmith.server.configurations.EmailConfig;
+import com.appsmith.server.datasources.base.DatasourceService;
+import com.appsmith.server.export.internal.ImportExportApplicationService;
+import com.appsmith.server.helpers.GitFileUtils;
+import com.appsmith.server.helpers.GitPrivateRepoHelper;
+import com.appsmith.server.helpers.RedisUtils;
+import com.appsmith.server.helpers.ResponseUtils;
+import com.appsmith.server.newactions.base.NewActionService;
+import com.appsmith.server.newpages.base.NewPageService;
+import com.appsmith.server.plugins.base.PluginService;
+import com.appsmith.server.repositories.GitDeployKeysRepository;
+import com.appsmith.server.services.AnalyticsService;
+import com.appsmith.server.services.ApplicationPageService;
+import com.appsmith.server.services.ApplicationService;
+import com.appsmith.server.services.SessionUserService;
+import com.appsmith.server.services.UserDataService;
+import com.appsmith.server.services.UserService;
+import com.appsmith.server.services.WorkspaceService;
+import com.appsmith.server.services.ce.GitServiceCEImpl;
+import com.appsmith.server.solutions.ApplicationPermission;
+import com.appsmith.server.solutions.DatasourcePermission;
+import io.micrometer.observation.ObservationRegistry;
+import org.springframework.stereotype.Service;
+
+@Service
+public class GitServiceCECompatibleImpl extends GitServiceCEImpl implements GitServiceCECompatible {
+ public GitServiceCECompatibleImpl(
+ UserService userService,
+ UserDataService userDataService,
+ SessionUserService sessionUserService,
+ ApplicationService applicationService,
+ ApplicationPageService applicationPageService,
+ NewPageService newPageService,
+ NewActionService newActionService,
+ ActionCollectionService actionCollectionService,
+ GitFileUtils fileUtils,
+ ImportExportApplicationService importExportApplicationService,
+ GitExecutor gitExecutor,
+ ResponseUtils responseUtils,
+ EmailConfig emailConfig,
+ AnalyticsService analyticsService,
+ GitDeployKeysRepository gitDeployKeysRepository,
+ DatasourceService datasourceService,
+ PluginService pluginService,
+ DatasourcePermission datasourcePermission,
+ ApplicationPermission applicationPermission,
+ WorkspaceService workspaceService,
+ RedisUtils redisUtils,
+ ObservationRegistry observationRegistry,
+ GitPrivateRepoHelper gitPrivateRepoCountHelper) {
+ super(
+ userService,
+ userDataService,
+ sessionUserService,
+ applicationService,
+ applicationPageService,
+ newPageService,
+ newActionService,
+ actionCollectionService,
+ fileUtils,
+ importExportApplicationService,
+ gitExecutor,
+ responseUtils,
+ emailConfig,
+ analyticsService,
+ gitDeployKeysRepository,
+ datasourceService,
+ pluginService,
+ datasourcePermission,
+ applicationPermission,
+ workspaceService,
+ redisUtils,
+ observationRegistry,
+ gitPrivateRepoCountHelper);
+ }
+}
|
594e02edbd4daa8e3561a1a258794eed9e5535e1
|
2022-02-10 16:16:55
|
Satish Gandham
|
chore: Increase cooldown time after app import for the app to load. #UI-Performance-infra (#10845)
| false
|
Increase cooldown time after app import for the app to load. #UI-Performance-infra (#10845)
|
chore
|
diff --git a/app/client/perf/gen-summary.js b/app/client/perf/gen-summary.js
index 14b32910f24a..8dd38e8eb9a2 100644
--- a/app/client/perf/gen-summary.js
+++ b/app/client/perf/gen-summary.js
@@ -1,4 +1,3 @@
const { summaries } = require("./src/summary");
-console.log(__dirname);
summaries(`${__dirname}/traces/reports`);
diff --git a/app/client/perf/src/summary.js b/app/client/perf/src/summary.js
index 9743bf77b14e..f65d50647317 100644
--- a/app/client/perf/src/summary.js
+++ b/app/client/perf/src/summary.js
@@ -3,9 +3,6 @@ const path = require("path");
const sd = require("node-stdev");
var median = require("median");
-global.APP_ROOT = path.resolve(__dirname);
-global.APP_ROOT = "/Users/satish/work/appsmith/app/client/perf";
-
exports.summaries = async (directory) => {
const files = await fs.promises.readdir(directory);
const results = {};
diff --git a/app/client/perf/tests/golden-app.perf.js b/app/client/perf/tests/golden-app.perf.js
index 9a5e0d230668..31a6a96c020e 100644
--- a/app/client/perf/tests/golden-app.perf.js
+++ b/app/client/perf/tests/golden-app.perf.js
@@ -36,9 +36,9 @@ async function testTyping() {
// },
// );
- await perf.importApplication(`${APP_ROOT}/tests/dsl/blog-admin-app-dev.json`);
+ await perf.importApplication(`${APP_ROOT}/tests/dsl/blog-admin-app.json`);
- await delay(10000, "for newly created page to settle down");
+ await delay(20000, "for newly created page to settle down");
// Make the elements of the dropdown render
await page.waitForSelector(SEL.multiSelect);
await page.click(SEL.multiSelect);
|
27bdeb92b6a0b27e6afcbfe80a5cb0705c0812ac
|
2024-10-29 11:25:43
|
Nidhi
|
chore: Distributed tracing for client (#37101)
| false
|
Distributed tracing for client (#37101)
|
chore
|
diff --git a/app/client/jest.config.js b/app/client/jest.config.js
index 851fe78efa3b..47dc492327d8 100644
--- a/app/client/jest.config.js
+++ b/app/client/jest.config.js
@@ -99,6 +99,10 @@ module.exports = {
"__APPSMITH_NEW_RELIC_OTEL_EXPORTER_OTLP_ENDPOINT__",
),
},
+ observability: {
+ deploymentName: "jest-run",
+ serviceInstanceId: "appsmith-0",
+ },
fusioncharts: {
licenseKey: parseConfig("__APPSMITH_FUSIONCHARTS_LICENSE_KEY__"),
},
diff --git a/app/client/package.json b/app/client/package.json
index 9742d7ca3c77..add895688c86 100644
--- a/app/client/package.json
+++ b/app/client/package.json
@@ -72,6 +72,7 @@
"@mantine/hooks": "^5.10.1",
"@newrelic/browser-agent": "^1.255.0",
"@opentelemetry/api": "^1.9.0",
+ "@opentelemetry/auto-instrumentations-web": "^0.41.0",
"@opentelemetry/context-zone": "1.25.1",
"@opentelemetry/core": "^1.26.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.52.1",
@@ -81,7 +82,7 @@
"@opentelemetry/sdk-metrics": "1.25.1",
"@opentelemetry/sdk-trace-base": "1.25.1",
"@opentelemetry/sdk-trace-web": "1.25.1",
- "@opentelemetry/semantic-conventions": "1.25.1",
+ "@opentelemetry/semantic-conventions": "^1.27.0",
"@react-spring/web": "^9.7.4",
"@react-types/shared": "^3.23.0",
"@redux-saga/core": "1.1.3",
diff --git a/app/client/public/index.html b/app/client/public/index.html
index 4908ff380b9b..eee6c8123c73 100755
--- a/app/client/public/index.html
+++ b/app/client/public/index.html
@@ -228,6 +228,10 @@
apiKey: parseConfig('{{env "APPSMITH_SEGMENT_KEY"}}'),
ceKey: parseConfig('{{env "APPSMITH_SEGMENT_CE_KEY"}}'),
},
+ observability: {
+ deploymentName: parseConfig('{{env "APPSMITH_DEPLOYMENT_NAME"}}') || "self-hosted",
+ serviceInstanceId: parseConfig('{{env "HOSTNAME"}}') || "appsmith-0",
+ },
newRelic:{
enableNewRelic: parseConfig('{{env "APPSMITH_NEW_RELIC_ACCOUNT_ENABLE"}}'),
accountId: parseConfig('{{env "APPSMITH_NEW_RELIC_ACCOUNT_ID"}}'),
diff --git a/app/client/src/UITelemetry/auto-otel-web.ts b/app/client/src/UITelemetry/auto-otel-web.ts
index 62116e49282e..c7740666ca5d 100644
--- a/app/client/src/UITelemetry/auto-otel-web.ts
+++ b/app/client/src/UITelemetry/auto-otel-web.ts
@@ -4,12 +4,11 @@ import { ZoneContextManager } from "@opentelemetry/context-zone";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { Resource } from "@opentelemetry/resources";
import {
- SEMRESATTRS_SERVICE_NAME,
- SEMRESATTRS_SERVICE_VERSION,
- SEMRESATTRS_SERVICE_INSTANCE_ID,
-} from "@opentelemetry/semantic-conventions";
+ ATTR_DEPLOYMENT_NAME,
+ ATTR_SERVICE_INSTANCE_ID,
+} from "@opentelemetry/semantic-conventions/incubating";
+import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
import { getAppsmithConfigs } from "ee/configs";
-import { W3CTraceContextPropagator } from "@opentelemetry/core";
import {
MeterProvider,
PeriodicExportingMetricReader,
@@ -18,23 +17,19 @@ import {
OTLPMetricExporter,
AggregationTemporalityPreference,
} from "@opentelemetry/exporter-metrics-otlp-http";
-import type { Context, TextMapSetter } from "@opentelemetry/api";
import { metrics } from "@opentelemetry/api";
import { registerInstrumentations } from "@opentelemetry/instrumentation";
import { PageLoadInstrumentation } from "./PageLoadInstrumentation";
+import { getWebAutoInstrumentations } from "@opentelemetry/auto-instrumentations-web";
enum CompressionAlgorithm {
NONE = "none",
GZIP = "gzip",
}
-const { newRelic } = getAppsmithConfigs();
-const {
- applicationId,
- browserAgentEndpoint,
- otlpEndpoint,
- otlpLicenseKey,
- otlpServiceName,
-} = newRelic;
+const { newRelic, observability } = getAppsmithConfigs();
+const { browserAgentEndpoint, otlpEndpoint, otlpLicenseKey } = newRelic;
+
+const { deploymentName, serviceInstanceId, serviceName } = observability;
// This base domain is used to filter out the Smartlook requests from the browser agent
// There are some requests made to subdomains of smartlook.cloud which will also be filtered out
@@ -42,9 +37,9 @@ const smartlookBaseDomain = "smartlook.cloud";
const tracerProvider = new WebTracerProvider({
resource: new Resource({
- [SEMRESATTRS_SERVICE_NAME]: otlpServiceName,
- [SEMRESATTRS_SERVICE_INSTANCE_ID]: applicationId,
- [SEMRESATTRS_SERVICE_VERSION]: "1.0.0",
+ [ATTR_DEPLOYMENT_NAME]: deploymentName,
+ [ATTR_SERVICE_INSTANCE_ID]: serviceInstanceId,
+ [ATTR_SERVICE_NAME]: serviceName,
}),
});
@@ -71,32 +66,9 @@ const processor = new BatchSpanProcessor(
},
);
-const W3C_OTLP_TRACE_HEADER = "traceparent";
-const CUSTOM_OTLP_TRACE_HEADER = "traceparent-otlp";
-
-//We are overriding the default header "traceparent" used for trace context because the browser
-// agent shares the same header's distributed tracing
-class CustomW3CTraceContextPropagator extends W3CTraceContextPropagator {
- inject(
- context: Context,
- carrier: Record<string, unknown>,
- setter: TextMapSetter,
- ) {
- // Call the original inject method to get the default traceparent header
- super.inject(context, carrier, setter);
-
- // Modify the carrier to use a different header
- if (carrier[W3C_OTLP_TRACE_HEADER]) {
- carrier[CUSTOM_OTLP_TRACE_HEADER] = carrier[W3C_OTLP_TRACE_HEADER];
- delete carrier[W3C_OTLP_TRACE_HEADER]; // Remove the original traceparent header
- }
- }
-}
-
tracerProvider.addSpanProcessor(processor);
tracerProvider.register({
contextManager: new ZoneContextManager(),
- propagator: new CustomW3CTraceContextPropagator(),
});
const nrMetricsExporter = new OTLPMetricExporter({
@@ -110,9 +82,9 @@ const nrMetricsExporter = new OTLPMetricExporter({
const meterProvider = new MeterProvider({
resource: new Resource({
- [SEMRESATTRS_SERVICE_NAME]: otlpServiceName,
- [SEMRESATTRS_SERVICE_INSTANCE_ID]: applicationId,
- [SEMRESATTRS_SERVICE_VERSION]: "1.0.0",
+ [ATTR_DEPLOYMENT_NAME]: deploymentName,
+ [ATTR_SERVICE_INSTANCE_ID]: serviceInstanceId,
+ [ATTR_SERVICE_NAME]: serviceName,
}),
readers: [
new PeriodicExportingMetricReader({
@@ -136,5 +108,10 @@ registerInstrumentations({
smartlookBaseDomain,
],
}),
+ getWebAutoInstrumentations({
+ "@opentelemetry/instrumentation-xml-http-request": {
+ enabled: true,
+ },
+ }),
],
});
diff --git a/app/client/src/UITelemetry/generateTraces.ts b/app/client/src/UITelemetry/generateTraces.ts
index 12476bcbcfa1..0519ba7ceda6 100644
--- a/app/client/src/UITelemetry/generateTraces.ts
+++ b/app/client/src/UITelemetry/generateTraces.ts
@@ -122,14 +122,6 @@ export const startAndEndSpanForFn = <T>(
return res;
};
-// TODO: Fix this the next time the file is edited
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export function wrapFnWithParentTraceContext(parentSpan: Span, fn: () => any) {
- const parentContext = trace.setSpan(context.active(), parentSpan);
-
- return context.with(parentContext, fn);
-}
-
export function startAndEndSpan(
spanName: string,
startTime: number,
diff --git a/app/client/src/api/ActionAPI.tsx b/app/client/src/api/ActionAPI.tsx
index 94e9fb5d9f6a..d0957fb7336b 100644
--- a/app/client/src/api/ActionAPI.tsx
+++ b/app/client/src/api/ActionAPI.tsx
@@ -8,8 +8,6 @@ import axios from "axios";
import type { Action, ActionViewMode } from "entities/Action";
import type { APIRequest } from "constants/AppsmithActionConstants/ActionConstants";
import type { WidgetType } from "constants/WidgetConstants";
-import type { OtlpSpan } from "UITelemetry/generateTraces";
-import { wrapFnWithParentTraceContext } from "UITelemetry/generateTraces";
import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers";
export interface Property {
@@ -233,17 +231,10 @@ class ActionAPI extends API {
static async executeAction(
executeAction: FormData,
timeout?: number,
- parentSpan?: OtlpSpan,
): Promise<AxiosPromise<ActionExecutionResponse>> {
ActionAPI.abortActionExecutionTokenSource = axios.CancelToken.source();
- if (!parentSpan) {
- return this.executeApiCall(executeAction, timeout);
- }
-
- return wrapFnWithParentTraceContext(parentSpan, async () => {
- return await this.executeApiCall(executeAction, timeout);
- });
+ return await this.executeApiCall(executeAction, timeout);
}
static async moveAction(moveRequest: MoveActionRequest) {
diff --git a/app/client/src/ce/configs/index.ts b/app/client/src/ce/configs/index.ts
index 56f7b8f94c5a..b29d56ee4231 100644
--- a/app/client/src/ce/configs/index.ts
+++ b/app/client/src/ce/configs/index.ts
@@ -13,6 +13,10 @@ export interface INJECTED_CONFIGS {
apiKey: string;
ceKey: string;
};
+ observability: {
+ deploymentName: string;
+ serviceInstanceId: string;
+ };
newRelic: {
enableNewRelic: boolean;
accountId: string;
@@ -20,7 +24,6 @@ export interface INJECTED_CONFIGS {
browserAgentlicenseKey: string;
browserAgentEndpoint: string;
otlpLicenseKey: string;
- otlpServiceName: string;
otlpEndpoint: string;
};
fusioncharts: {
@@ -92,6 +95,10 @@ export const getConfigsFromEnvVars = (): INJECTED_CONFIGS => {
indexName: process.env.REACT_APP_ALGOLIA_SEARCH_INDEX_NAME || "",
snippetIndex: process.env.REACT_APP_ALGOLIA_SNIPPET_INDEX_NAME || "",
},
+ observability: {
+ deploymentName: process.env.APPSMITH_DEPLOYMENT_NAME || "self-hosted",
+ serviceInstanceId: process.env.HOSTNAME || "appsmith-0",
+ },
newRelic: {
enableNewRelic: !!process.env.APPSMITH_NEW_RELIC_ACCOUNT_ENABLE,
accountId: process.env.APPSMITH_NEW_RELIC_ACCOUNT_ID || "",
@@ -102,8 +109,6 @@ export const getConfigsFromEnvVars = (): INJECTED_CONFIGS => {
process.env.APPSMITH_NEW_RELIC_BROWSER_AGENT_ENDPOINT || "",
otlpLicenseKey: process.env.APPSMITH_NEW_RELIC_OTLP_LICENSE_KEY || "",
otlpEndpoint: process.env.APPSMITH_NEW_RELIC_OTEL_SERVICE_NAME || "",
- otlpServiceName:
- process.env.APPSMITH_NEW_RELIC_OTEL_EXPORTER_OTLP_ENDPOINT || "",
},
logLevel:
(process.env.REACT_APP_CLIENT_LOG_LEVEL as
@@ -171,6 +176,14 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => {
ENV_CONFIG.mixpanel.apiKey,
APPSMITH_FEATURE_CONFIGS?.mixpanel.apiKey,
);
+ const observabilityDeploymentName = getConfig(
+ ENV_CONFIG.observability.deploymentName,
+ APPSMITH_FEATURE_CONFIGS?.observability.deploymentName,
+ );
+ const observabilityServiceInstanceId = getConfig(
+ ENV_CONFIG.observability.serviceInstanceId,
+ APPSMITH_FEATURE_CONFIGS?.observability.serviceInstanceId,
+ );
const newRelicAccountId = getConfig(
ENV_CONFIG.newRelic.accountId,
APPSMITH_FEATURE_CONFIGS?.newRelic.accountId,
@@ -191,11 +204,6 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => {
ENV_CONFIG.newRelic.otlpLicenseKey,
APPSMITH_FEATURE_CONFIGS?.newRelic.otlpLicenseKey,
);
-
- const newRelicOtlpServiceName = getConfig(
- ENV_CONFIG.newRelic.otlpServiceName,
- APPSMITH_FEATURE_CONFIGS?.newRelic.otlpServiceName,
- );
const newRelicOtlpEndpoint = getConfig(
ENV_CONFIG.newRelic.otlpEndpoint,
APPSMITH_FEATURE_CONFIGS?.newRelic.otlpEndpoint,
@@ -271,7 +279,11 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => {
browserAgentEndpoint: newRelicBrowserAgentEndpoint.value,
otlpLicenseKey: newRelicOtlpLicenseKey.value,
otlpEndpoint: newRelicOtlpEndpoint.value,
- otlpServiceName: newRelicOtlpServiceName.value,
+ },
+ observability: {
+ deploymentName: observabilityDeploymentName.value,
+ serviceInstanceId: observabilityServiceInstanceId.value,
+ serviceName: "frontend",
},
fusioncharts: {
enabled: fusioncharts.enabled,
diff --git a/app/client/src/ce/configs/types.ts b/app/client/src/ce/configs/types.ts
index 00b3948a02bc..0b1868d7fb8a 100644
--- a/app/client/src/ce/configs/types.ts
+++ b/app/client/src/ce/configs/types.ts
@@ -20,6 +20,11 @@ export interface AppsmithUIConfigs {
enabled: boolean;
id: string;
};
+ observability: {
+ deploymentName: string;
+ serviceInstanceId: string;
+ serviceName: string;
+ };
newRelic: {
enableNewRelic: boolean;
accountId: string;
@@ -27,7 +32,6 @@ export interface AppsmithUIConfigs {
browserAgentlicenseKey: string;
browserAgentEndpoint: string;
otlpLicenseKey: string;
- otlpServiceName: string;
otlpEndpoint: string;
};
segment: {
diff --git a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts
index 0c4d09c8e8d4..59c312ba893d 100644
--- a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts
+++ b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts
@@ -1436,7 +1436,7 @@ function* executePluginActionSaga(
let response: ActionExecutionResponse;
try {
- response = yield ActionAPI.executeAction(formData, timeout, parentSpan);
+ response = yield ActionAPI.executeAction(formData, timeout);
const isError = isErrorResponse(response);
diff --git a/app/client/yarn.lock b/app/client/yarn.lock
index cafdbb43d8f0..da11c6eb1932 100644
--- a/app/client/yarn.lock
+++ b/app/client/yarn.lock
@@ -4786,6 +4786,22 @@ __metadata:
languageName: node
linkType: hard
+"@opentelemetry/auto-instrumentations-web@npm:^0.41.0":
+ version: 0.41.0
+ resolution: "@opentelemetry/auto-instrumentations-web@npm:0.41.0"
+ dependencies:
+ "@opentelemetry/instrumentation": ^0.53.0
+ "@opentelemetry/instrumentation-document-load": ^0.40.0
+ "@opentelemetry/instrumentation-fetch": ^0.53.0
+ "@opentelemetry/instrumentation-user-interaction": ^0.40.0
+ "@opentelemetry/instrumentation-xml-http-request": ^0.53.0
+ peerDependencies:
+ "@opentelemetry/api": ^1.3.0
+ zone.js: ^0.11.4 || ^0.13.0 || ^0.14.0
+ checksum: 9e73bc3654bfe325154a2e26d713033a3a6c1e4341a5f3803af75b5c945d1844e2f83b129b42c69b660ca9caf5f16b666c12143ac51744c8d12ea550d29935d5
+ languageName: node
+ linkType: hard
+
"@opentelemetry/context-async-hooks@npm:1.26.0":
version: 1.26.0
resolution: "@opentelemetry/context-async-hooks@npm:1.26.0"
@@ -4826,7 +4842,7 @@ __metadata:
languageName: node
linkType: hard
-"@opentelemetry/core@npm:1.26.0, @opentelemetry/core@npm:^1.26.0":
+"@opentelemetry/core@npm:1.26.0":
version: 1.26.0
resolution: "@opentelemetry/core@npm:1.26.0"
dependencies:
@@ -4837,6 +4853,17 @@ __metadata:
languageName: node
linkType: hard
+"@opentelemetry/core@npm:1.27.0, @opentelemetry/core@npm:^1.26.0, @opentelemetry/core@npm:^1.8.0":
+ version: 1.27.0
+ resolution: "@opentelemetry/core@npm:1.27.0"
+ dependencies:
+ "@opentelemetry/semantic-conventions": 1.27.0
+ peerDependencies:
+ "@opentelemetry/api": ">=1.0.0 <1.10.0"
+ checksum: 33ff551f89f0bb95830c9f9464c43b11adf88882ec1d3a03a5b9afcc89d2aafab33c36cb5047f18667d7929d6ab40ed0121649c42d0105f1cb33ffdca48f8b13
+ languageName: node
+ linkType: hard
+
"@opentelemetry/exporter-metrics-otlp-http@npm:0.52.1":
version: 0.52.1
resolution: "@opentelemetry/exporter-metrics-otlp-http@npm:0.52.1"
@@ -4867,6 +4894,35 @@ __metadata:
languageName: node
linkType: hard
+"@opentelemetry/instrumentation-document-load@npm:^0.40.0":
+ version: 0.40.0
+ resolution: "@opentelemetry/instrumentation-document-load@npm:0.40.0"
+ dependencies:
+ "@opentelemetry/core": ^1.8.0
+ "@opentelemetry/instrumentation": ^0.53.0
+ "@opentelemetry/sdk-trace-base": ^1.0.0
+ "@opentelemetry/sdk-trace-web": ^1.15.0
+ "@opentelemetry/semantic-conventions": ^1.27.0
+ peerDependencies:
+ "@opentelemetry/api": ^1.3.0
+ checksum: 5a06eeb5b68623c655fa728cc2bb036cdd0270488abfa1fca5e733891f3ce5b22067b014c4f3317e957be3c89acab5c70f199eb82c409dd01605960908c34048
+ languageName: node
+ linkType: hard
+
+"@opentelemetry/instrumentation-fetch@npm:^0.53.0":
+ version: 0.53.0
+ resolution: "@opentelemetry/instrumentation-fetch@npm:0.53.0"
+ dependencies:
+ "@opentelemetry/core": 1.26.0
+ "@opentelemetry/instrumentation": 0.53.0
+ "@opentelemetry/sdk-trace-web": 1.26.0
+ "@opentelemetry/semantic-conventions": 1.27.0
+ peerDependencies:
+ "@opentelemetry/api": ^1.0.0
+ checksum: 2c92c9ccccfa424adb3773424df42d64156b67bdbcc1a21fbe5f620370d68bbd64701279897a0807e0b259b4e7a9fdcfdc21fa064343793c592bd0d08c5483cf
+ languageName: node
+ linkType: hard
+
"@opentelemetry/instrumentation-http@npm:^0.53.0":
version: 0.53.0
resolution: "@opentelemetry/instrumentation-http@npm:0.53.0"
@@ -4881,6 +4937,34 @@ __metadata:
languageName: node
linkType: hard
+"@opentelemetry/instrumentation-user-interaction@npm:^0.40.0":
+ version: 0.40.0
+ resolution: "@opentelemetry/instrumentation-user-interaction@npm:0.40.0"
+ dependencies:
+ "@opentelemetry/core": ^1.8.0
+ "@opentelemetry/instrumentation": ^0.53.0
+ "@opentelemetry/sdk-trace-web": ^1.8.0
+ peerDependencies:
+ "@opentelemetry/api": ^1.3.0
+ zone.js: ^0.11.4 || ^0.13.0 || ^0.14.0
+ checksum: 24ae06b6a6ab2df39dc1074e7edf8ddaa2009e0376bf5e2bcb5d355bdf96bb4aeb09dc861a110150702a251d30e9984ee2a0bd7ba57e820e0859977f5807f369
+ languageName: node
+ linkType: hard
+
+"@opentelemetry/instrumentation-xml-http-request@npm:^0.53.0":
+ version: 0.53.0
+ resolution: "@opentelemetry/instrumentation-xml-http-request@npm:0.53.0"
+ dependencies:
+ "@opentelemetry/core": 1.26.0
+ "@opentelemetry/instrumentation": 0.53.0
+ "@opentelemetry/sdk-trace-web": 1.26.0
+ "@opentelemetry/semantic-conventions": 1.27.0
+ peerDependencies:
+ "@opentelemetry/api": ^1.0.0
+ checksum: 61dd00e30fbf4de611a7d1fa63aa8b004a0624c566d043dc9970dcaaef8eeb1f67e39a224bffd0d05c437e0d08371ee569f1d273429c05eb155e8c854e3fa818
+ languageName: node
+ linkType: hard
+
"@opentelemetry/instrumentation@npm:0.52.1":
version: 0.52.1
resolution: "@opentelemetry/instrumentation@npm:0.52.1"
@@ -4897,7 +4981,7 @@ __metadata:
languageName: node
linkType: hard
-"@opentelemetry/instrumentation@npm:0.53.0":
+"@opentelemetry/instrumentation@npm:0.53.0, @opentelemetry/instrumentation@npm:^0.53.0":
version: 0.53.0
resolution: "@opentelemetry/instrumentation@npm:0.53.0"
dependencies:
@@ -4988,6 +5072,18 @@ __metadata:
languageName: node
linkType: hard
+"@opentelemetry/resources@npm:1.27.0":
+ version: 1.27.0
+ resolution: "@opentelemetry/resources@npm:1.27.0"
+ dependencies:
+ "@opentelemetry/core": 1.27.0
+ "@opentelemetry/semantic-conventions": 1.27.0
+ peerDependencies:
+ "@opentelemetry/api": ">=1.0.0 <1.10.0"
+ checksum: 43d298afea7daf7524e6b98c1441bcce9fa73b76aecf17e36cabb1a4cfaae6818acf9759d3e42706b1fd91243644076d2291e78c3ed81641d3b351fcff6cb9a9
+ languageName: node
+ linkType: hard
+
"@opentelemetry/sdk-logs@npm:0.52.1":
version: 0.52.1
resolution: "@opentelemetry/sdk-logs@npm:0.52.1"
@@ -5040,6 +5136,19 @@ __metadata:
languageName: node
linkType: hard
+"@opentelemetry/sdk-trace-base@npm:1.27.0, @opentelemetry/sdk-trace-base@npm:^1.0.0":
+ version: 1.27.0
+ resolution: "@opentelemetry/sdk-trace-base@npm:1.27.0"
+ dependencies:
+ "@opentelemetry/core": 1.27.0
+ "@opentelemetry/resources": 1.27.0
+ "@opentelemetry/semantic-conventions": 1.27.0
+ peerDependencies:
+ "@opentelemetry/api": ">=1.0.0 <1.10.0"
+ checksum: d28c36724aeaf4884f7957e2ab138d9a0ca715a68b2ad23e2935ff0e39cd438c57fd0c8cc85fd5e280464857ede1ae8f9c8e40a37088a1e34d2e625e77276fee
+ languageName: node
+ linkType: hard
+
"@opentelemetry/sdk-trace-node@npm:^1.26.0":
version: 1.26.0
resolution: "@opentelemetry/sdk-trace-node@npm:1.26.0"
@@ -5069,6 +5178,32 @@ __metadata:
languageName: node
linkType: hard
+"@opentelemetry/sdk-trace-web@npm:1.26.0":
+ version: 1.26.0
+ resolution: "@opentelemetry/sdk-trace-web@npm:1.26.0"
+ dependencies:
+ "@opentelemetry/core": 1.26.0
+ "@opentelemetry/sdk-trace-base": 1.26.0
+ "@opentelemetry/semantic-conventions": 1.27.0
+ peerDependencies:
+ "@opentelemetry/api": ">=1.0.0 <1.10.0"
+ checksum: d8e0ae8f9088723fc250874290923dc81933b279958f04beb79ca7e312bf66a79b823d92dd06be4e707d6919030c2998f8a18167a47ee7281e573b3ef3cc9e10
+ languageName: node
+ linkType: hard
+
+"@opentelemetry/sdk-trace-web@npm:^1.15.0, @opentelemetry/sdk-trace-web@npm:^1.8.0":
+ version: 1.27.0
+ resolution: "@opentelemetry/sdk-trace-web@npm:1.27.0"
+ dependencies:
+ "@opentelemetry/core": 1.27.0
+ "@opentelemetry/sdk-trace-base": 1.27.0
+ "@opentelemetry/semantic-conventions": 1.27.0
+ peerDependencies:
+ "@opentelemetry/api": ">=1.0.0 <1.10.0"
+ checksum: 7c5c354fc9400adef70e6f169edd61a11ebcd36ca15993b366e8f6cfb296f248786be41d327ca971ad4f24b6623a5b8af2fb88fd760af6419c6313a7288ed6f9
+ languageName: node
+ linkType: hard
+
"@opentelemetry/semantic-conventions@npm:1.25.1":
version: 1.25.1
resolution: "@opentelemetry/semantic-conventions@npm:1.25.1"
@@ -12743,6 +12878,7 @@ __metadata:
"@newrelic/browser-agent": ^1.255.0
"@octokit/rest": ^20.0.1
"@opentelemetry/api": ^1.9.0
+ "@opentelemetry/auto-instrumentations-web": ^0.41.0
"@opentelemetry/context-zone": 1.25.1
"@opentelemetry/core": ^1.26.0
"@opentelemetry/exporter-metrics-otlp-http": 0.52.1
@@ -12752,7 +12888,7 @@ __metadata:
"@opentelemetry/sdk-metrics": 1.25.1
"@opentelemetry/sdk-trace-base": 1.25.1
"@opentelemetry/sdk-trace-web": 1.25.1
- "@opentelemetry/semantic-conventions": 1.25.1
+ "@opentelemetry/semantic-conventions": ^1.27.0
"@peculiar/webcrypto": ^1.4.3
"@react-spring/web": ^9.7.4
"@react-types/shared": ^3.23.0
|
bc0ddf14f40f7dd93f923317c39b4a6633257fc8
|
2023-06-15 20:02:20
|
Aishwarya-U-R
|
test: Cypress | Local config file syntax fix (#24500)
| false
|
Cypress | Local config file syntax fix (#24500)
|
test
|
diff --git a/app/client/cypress.config.ts b/app/client/cypress.config.ts
index fe7dcafe7a81..f66719af8a66 100644
--- a/app/client/cypress.config.ts
+++ b/app/client/cypress.config.ts
@@ -9,7 +9,7 @@ export default defineConfig({
videoUploadOnPasses: false,
videoCompression: false,
numTestsKeptInMemory: 5,
- experimentalMemoryManagement : true,
+ experimentalMemoryManagement: true,
reporterOptions: {
reportDir: "results",
overwrite: false,
@@ -28,7 +28,6 @@ export default defineConfig({
env: {
USERNAME: "xxxx",
PASSWORD: "xxx",
- },
},
setupNodeEvents(on, config) {
return require("./cypress/plugins/index.js")(on, config);
|
7d1c4d87b6ecb298b4d94a550da63557efc3203b
|
2023-04-26 13:44:08
|
Nidhi
|
ci: Fixed external dependencies in tests partially (#22639)
| false
|
Fixed external dependencies in tests partially (#22639)
|
ci
|
diff --git a/app/server/appsmith-interfaces/src/test/java/com/appsmith/external/connections/OAuth2ClientCredentialsTest.java b/app/server/appsmith-interfaces/src/test/java/com/appsmith/external/connections/OAuth2ClientCredentialsTest.java
index abbdf629c6dc..45df948f8afb 100644
--- a/app/server/appsmith-interfaces/src/test/java/com/appsmith/external/connections/OAuth2ClientCredentialsTest.java
+++ b/app/server/appsmith-interfaces/src/test/java/com/appsmith/external/connections/OAuth2ClientCredentialsTest.java
@@ -89,7 +89,7 @@ public void testStaleFilter() {
@Test
public void testCreate_withIsAuthorizationHeaderTrue_sendsCredentialsInHeader() throws InterruptedException {
- String baseUrl = String.format("http://localhost:%s", mockEndpoint.getPort());
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
final DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
OAuth2 oAuth2 = new OAuth2();
@@ -115,7 +115,7 @@ public void testCreate_withIsAuthorizationHeaderTrue_sendsCredentialsInHeader()
@Test
public void testCreate_withIsAuthorizationHeaderFalse_sendsCredentialsInBody() throws InterruptedException, EOFException {
- String baseUrl = String.format("http://localhost:%s", mockEndpoint.getPort());
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
final DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
OAuth2 oAuth2 = new OAuth2();
diff --git a/app/server/appsmith-plugins/graphqlPlugin/src/test/java/com/external/plugins/GraphQLPluginTest.java b/app/server/appsmith-plugins/graphqlPlugin/src/test/java/com/external/plugins/GraphQLPluginTest.java
index e81b988aac41..378d4b4ae364 100644
--- a/app/server/appsmith-plugins/graphqlPlugin/src/test/java/com/external/plugins/GraphQLPluginTest.java
+++ b/app/server/appsmith-plugins/graphqlPlugin/src/test/java/com/external/plugins/GraphQLPluginTest.java
@@ -18,15 +18,18 @@
import com.appsmith.external.services.SharedConfig;
import com.external.plugins.exceptions.GraphQLPluginError;
import com.external.utils.GraphQLHintMessageUtils;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
+import mockwebserver3.MockResponse;
+import mockwebserver3.MockWebServer;
+import mockwebserver3.RecordedRequest;
import net.minidev.json.JSONObject;
import net.minidev.json.parser.JSONParser;
import net.minidev.json.parser.ParseException;
+import okio.Buffer;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;
@@ -40,17 +43,19 @@
import reactor.util.function.Tuple2;
import javax.crypto.SecretKey;
+import java.io.EOFException;
+import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
+import java.util.concurrent.TimeUnit;
import static com.appsmith.external.constants.Authentication.API_KEY;
import static com.appsmith.external.constants.Authentication.OAUTH2;
@@ -71,7 +76,9 @@ public class GraphQLPluginTest {
private static GraphQLHintMessageUtils hintMessageUtils;
- public class MockSharedConfig implements SharedConfig {
+ private static MockWebServer mockEndpoint;
+
+ public static class MockSharedConfig implements SharedConfig {
@Override
public int getCodecSize() {
@@ -99,12 +106,19 @@ public String getRemoteExecutionUrl() {
.waitingFor(Wait.forHttp("/").forStatusCode(404));
@BeforeEach
- public void setUp() {
+ public void setUp() throws IOException {
hintMessageUtils = new GraphQLHintMessageUtils();
+ mockEndpoint = new MockWebServer();
+ mockEndpoint.start();
+ }
+
+ @AfterEach
+ public void tearDown() throws IOException {
+ mockEndpoint.shutdown();
}
private DatasourceConfiguration getDefaultDatasourceConfig() {
- String address = graphqlContainer.getContainerIpAddress();
+ String address = graphqlContainer.getHost();
Integer port = graphqlContainer.getFirstMappedPort();
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
dsConfig.setUrl("http://" + address + ":" + port + "/graphql");
@@ -115,15 +129,16 @@ private ActionConfiguration getDefaultActionConfiguration() {
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/json")));
actionConfig.setHttpMethod(HttpMethod.POST);
- String requestBody = "query {\n" +
- "\tallPosts(first: 1) {\n" +
- "\t\tnodes {\n" +
- "\t\t\tid\n" +
- "\t\t}\n" +
- "\t}\n" +
- "}";
+ String requestBody = """
+ query {
+ allPosts(first: 1) {
+ nodes {
+ id
+ }
+ }
+ }""";
actionConfig.setBody(requestBody);
- List<Property> properties = new ArrayList<Property>();
+ List<Property> properties = new ArrayList<>();
properties.add(new Property("smartSubstitution", "true"));
properties.add(new Property("queryVariables", ""));
actionConfig.setPluginSpecifiedTemplates(properties);
@@ -134,19 +149,21 @@ private ActionConfiguration getDefaultActionConfiguration() {
public void testValidGraphQLApiExecutionWithQueryVariablesWithHttpPost() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
ActionConfiguration actionConfig = getDefaultActionConfiguration();
- String queryBody = "query($limit: Int) {\n" +
- "\tallPosts(first: $limit) {\n" +
- "\t\tnodes {\n" +
- "\t\t\tid\n" +
- "\t\t}\n" +
- "\t}\n" +
- "}";
+ String queryBody = """
+ query($limit: Int) {
+ allPosts(first: $limit) {
+ nodes {
+ id
+ }
+ }
+ }""";
actionConfig.setBody(queryBody);
- List<Property> properties = new ArrayList<Property>();
+ List<Property> properties = new ArrayList<>();
properties.add(new Property("", "true"));
- properties.add(new Property("", "{\n" +
- " \"limit\": 2\n" +
- "}"));
+ properties.add(new Property("", """
+ {
+ "limit": 2
+ }"""));
actionConfig.setPluginSpecifiedTemplates(properties);
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, new ExecuteActionDTO(), dsConfig, actionConfig);
@@ -168,22 +185,24 @@ public void testValidGraphQLApiExecutionWithWhitespacesInUrl() {
//changing the url to add whitespaces at the start and end of the url
String url = dsConfig.getUrl();
- url = String.format("%-" + (url.length() + 4) + "s" ,url);
- url = String.format("%" + (url.length() + 4) + "s" ,url);
+ url = String.format("%-" + (url.length() + 4) + "s", url);
+ url = String.format("%" + (url.length() + 4) + "s", url);
dsConfig.setUrl(url);
- String queryBody = "query($limit: Int) {\n" +
- "\tallPosts(first: $limit) {\n" +
- "\t\tnodes {\n" +
- "\t\t\tid\n" +
- "\t\t}\n" +
- "\t}\n" +
- "}";
+ String queryBody = """
+ query($limit: Int) {
+ allPosts(first: $limit) {
+ nodes {
+ id
+ }
+ }
+ }""";
actionConfig.setBody(queryBody);
- List<Property> properties = new ArrayList<Property>();
+ List<Property> properties = new ArrayList<>();
properties.add(new Property("", "true"));
- properties.add(new Property("", "{\n" +
- " \"limit\": 2\n" +
- "}"));
+ properties.add(new Property("", """
+ {
+ "limit": 2
+ }"""));
actionConfig.setPluginSpecifiedTemplates(properties);
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, new ExecuteActionDTO(), dsConfig, actionConfig);
@@ -201,12 +220,14 @@ public void testValidGraphQLApiExecutionWithQueryVariablesWithHttpGet() {
dsConfig.setUrl("https://rickandmortyapi.com/graphql");
ActionConfiguration actionConfig = getDefaultActionConfiguration();
actionConfig.setHttpMethod(HttpMethod.GET);
- actionConfig.setBody("query Query {\n" +
- " character(id: 1) {\n" +
- " created\n" +
- " }\n" +
- "}\n");
- List<Property> properties = new ArrayList<Property>();
+ actionConfig.setBody("""
+ query Query {
+ character(id: 1) {
+ created
+ }
+ }
+ """);
+ List<Property> properties = new ArrayList<>();
properties.add(new Property("smartSubstitution", "true"));
properties.add(new Property("queryVariables", ""));
actionConfig.setPluginSpecifiedTemplates(properties);
@@ -264,14 +285,15 @@ public void testValidGraphQLApiExecutionWithContentTypeGraphql() {
public void testInvalidQueryBodyError() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
ActionConfiguration actionConfig = getDefaultActionConfiguration();
- actionConfig.setBody("query Capsules {\n" +
- " capsules(limit: 1, offset: 0) {\n" +
- " dragon \n" +
- " id\n" +
- " name\n" +
- " }\n" +
- " }\n" +
- "}");
+ actionConfig.setBody("""
+ query Capsules {
+ capsules(limit: 1, offset: 0) {
+ dragon\s
+ id
+ name
+ }
+ }
+ }""");
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, new ExecuteActionDTO(), dsConfig, actionConfig);
StepVerifier.create(resultMono)
@@ -287,32 +309,40 @@ public void testInvalidQueryBodyError() {
public void testInvalidQueryVariablesError() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
ActionConfiguration actionConfig = getDefaultActionConfiguration();
- actionConfig.setBody("query Capsules($limit: Int, $offset: Int) {\n" +
- " capsules(limit: $limit, offset: $offset) {\n" +
- " dragon {\n" +
- " id\n" +
- " name\n" +
- " }\n" +
- " }\n" +
- "}");
- actionConfig.getPluginSpecifiedTemplates().get(QUERY_VARIABLES_INDEX).setValue("{\n" +
- " \"limit\": 1\n" +
- " \"offset\": 0\n" +
- "}");
+ actionConfig.setBody("""
+ query Capsules($limit: Int, $offset: Int) {
+ capsules(limit: $limit, offset: $offset) {
+ dragon {
+ id
+ name
+ }
+ }
+ }""");
+ actionConfig.getPluginSpecifiedTemplates().get(QUERY_VARIABLES_INDEX).setValue("""
+ {
+ "limit": 1
+ "offset": 0
+ }""");
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, new ExecuteActionDTO(), dsConfig, actionConfig);
StepVerifier.create(resultMono)
.verifyErrorSatisfies(error -> {
assertTrue(error instanceof AppsmithPluginException);
String expectedMessage = "GraphQL query variables are not in proper JSON format: Expected a ',' " +
"or '}' at 18 [character 3 line 3]";
- assertTrue(expectedMessage.equals(error.getMessage()));
+ assertEquals(expectedMessage, error.getMessage());
});
}
@Test
public void testValidSignature() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
- dsConfig.setUrl("http://httpbin.org/headers");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
final String secretKey = "a-random-key-that-should-be-32-chars-long-at-least";
dsConfig.setProperties(List.of(
@@ -329,22 +359,29 @@ public void testValidSignature() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String token = ((ObjectNode) result.getBody()).get("headers").get("X-Appsmith-Signature").asText();
-
- final SecretKey key = Keys.hmacShaKeyFor(secretKey.getBytes(StandardCharsets.UTF_8));
- final String issuer = Jwts.parserBuilder()
- .setSigningKey(key)
- .build()
- .parseClaimsJws(token)
- .getBody()
- .getIssuer();
- assertEquals("Appsmith", issuer);
- final Iterator<Map.Entry<String, JsonNode>> fields = ((ObjectNode) result.getRequest().getHeaders()).fields();
- fields.forEachRemaining(field -> {
- if ("X-Appsmith-Signature".equalsIgnoreCase(field.getKey())) {
- assertEquals(token, field.getValue().get(0).asText());
- }
- });
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ String token = recordedRequest.getHeaders().get("X-Appsmith-Signature");
+
+ final SecretKey key = Keys.hmacShaKeyFor(secretKey.getBytes(StandardCharsets.UTF_8));
+ final String issuer = Jwts.parserBuilder()
+ .setSigningKey(key)
+ .build()
+ .parseClaimsJws(token)
+ .getBody()
+ .getIssuer();
+ assertEquals("Appsmith", issuer);
+ final Iterator<Map.Entry<String, JsonNode>> fields = ((ObjectNode) result.getRequest().getHeaders()).fields();
+ fields.forEachRemaining(field -> {
+ if ("X-Appsmith-Signature".equalsIgnoreCase(field.getKey())) {
+ assertEquals(token, field.getValue().get(0).asText());
+ }
+ });
+ } catch (InterruptedException e) {
+ assert false : e.getMessage();
+ }
})
.verifyComplete();
@@ -362,7 +399,7 @@ public void testValidateDatasource_invalidAuthentication() {
StepVerifier
.create(invalidsMono)
- .assertNext(invalids -> invalids.containsAll(Set.of("Missing Client ID", "Missing Client Secret", "Missing Access Token URL")));
+ .assertNext(invalids -> assertTrue(invalids.containsAll(Set.of("Missing Client ID", "Missing Client Secret", "Missing Access Token URL"))));
}
/**
@@ -375,19 +412,28 @@ public void testValidateDatasource_invalidAuthentication() {
@Test
public void testSmartSubstitutionInQueryBodyForNumberStringBooleanAndSchemaTypes() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
- dsConfig.setUrl("https://postman-echo.com/post");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = getDefaultActionConfiguration();
- actionConfig.setBody("query Capsules {\n" +
- " capsules(myNum: {{Input1.text}}, myStr: {{Input2.text}}, myBool: {{Input3.text}}) {\n" +
- " dragon {\n" +
- " {{Input4.text}}\n" +
- " name\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "\n");
+ actionConfig.setBody("""
+ query Capsules {
+ capsules(myNum: {{Input1.text}}, myStr: {{Input2.text}}, myBool: {{Input3.text}}) {
+ dragon {
+ {{Input4.text}}
+ name
+ }
+ }
+ }
+
+
+ """);
ExecuteActionDTO executeActionDTO = new ExecuteActionDTO();
List<Param> params = new ArrayList<>();
@@ -414,21 +460,35 @@ public void testSmartSubstitutionInQueryBodyForNumberStringBooleanAndSchemaTypes
executeActionDTO.setParams(params);
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, executeActionDTO, dsConfig, actionConfig);
+
StepVerifier.create(resultMono)
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String expectedQueryBody = "query Capsules {\n capsules(myNum: 3, myStr: \"this is a string! Yay" +
- " :D\", myBool: true) {\n dragon {\n id\n name\n }\n }\n}\n\n\n";
+ String expectedQueryBody = """
+ query Capsules {
+ capsules(myNum: 3, myStr: "this is a string! Yay :D", myBool: true) {
+ dragon {
+ id
+ name
+ }
+ }
+ }
+
+
+ """;
JSONParser jsonParser = new JSONParser(JSONParser.MODE_PERMISSIVE);
- ObjectMapper objectMapper = new ObjectMapper();
try {
- JSONObject resultJson = (JSONObject) jsonParser.parse(String.valueOf(result.getBody()));
- // Object resultData = ((JSONObject) resultJson.get("json")).get("query");
- String resultData = ((JSONObject) resultJson.get("json")).getAsString("query");
- String parsedJsonAsString = objectMapper.writeValueAsString(resultData);
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+ JSONObject resultJson = (JSONObject) jsonParser.parse(new String(bodyBytes));
+ String resultData = resultJson.getAsString("query");
assertEquals(expectedQueryBody, resultData);
- } catch (ParseException | JsonProcessingException e) {
+ } catch (ParseException | EOFException | InterruptedException e) {
assert false : e.getMessage();
}
@@ -436,23 +496,23 @@ public void testSmartSubstitutionInQueryBodyForNumberStringBooleanAndSchemaTypes
ActionExecutionRequest request = result.getRequest();
List<Map.Entry<String, String>> parameters =
(List<Map.Entry<String, String>>) request.getProperties().get("smart-substitution-parameters");
- assertEquals(parameters.size(), 4);
+ assertEquals(4, parameters.size());
Map.Entry<String, String> parameterEntry = parameters.get(0);
- assertEquals(parameterEntry.getKey(), "3");
- assertEquals(parameterEntry.getValue(), "GRAPHQL_BODY_INTEGER");
+ assertEquals("3", parameterEntry.getKey());
+ assertEquals("GRAPHQL_BODY_INTEGER", parameterEntry.getValue());
parameterEntry = parameters.get(1);
- assertEquals(parameterEntry.getKey(), "this is a string! Yay :D");
- assertEquals(parameterEntry.getValue(), "GRAPHQL_BODY_STRING");
+ assertEquals("this is a string! Yay :D", parameterEntry.getKey());
+ assertEquals("GRAPHQL_BODY_STRING", parameterEntry.getValue());
parameterEntry = parameters.get(2);
- assertEquals(parameterEntry.getKey(), "true");
- assertEquals(parameterEntry.getValue(), "GRAPHQL_BODY_BOOLEAN");
+ assertEquals("true", parameterEntry.getKey());
+ assertEquals("GRAPHQL_BODY_BOOLEAN", parameterEntry.getValue());
parameterEntry = parameters.get(3);
- assertEquals(parameterEntry.getKey(), "id");
- assertEquals(parameterEntry.getValue(), "GRAPHQL_BODY_PARTIAL");
+ assertEquals("id", parameterEntry.getKey());
+ assertEquals("GRAPHQL_BODY_PARTIAL", parameterEntry.getValue());
})
.verifyComplete();
}
@@ -463,7 +523,14 @@ public void testSmartSubstitutionInQueryBodyForNumberStringBooleanAndSchemaTypes
@Test
public void testSmartSubstitutionInQueryBodyForFullBodySubstitution() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
- dsConfig.setUrl("https://postman-echo.com/post");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = getDefaultActionConfiguration();
actionConfig.setBody("{{Input1.text}}");
@@ -472,14 +539,15 @@ public void testSmartSubstitutionInQueryBodyForFullBodySubstitution() {
List<Param> params = new ArrayList<>();
Param param1 = new Param();
param1.setKey("Input1.text");
- param1.setValue("query Capsules {\n" +
- " capsules(limit: 1, offset: 0) {\n" +
- " dragon {\n" +
- " id\n" +
- " name\n" +
- " }\n" +
- " }\n" +
- "}");
+ param1.setValue("""
+ query Capsules {
+ capsules(limit: 1, offset: 0) {
+ dragon {
+ id
+ name
+ }
+ }
+ }""");
param1.setClientDataType(ClientDataType.STRING);
params.add(param1);
executeActionDTO.setParams(params);
@@ -489,23 +557,29 @@ public void testSmartSubstitutionInQueryBodyForFullBodySubstitution() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String expectedQueryBody = "query Capsules {\n" +
- " capsules(limit: 1, offset: 0) {\n" +
- " dragon {\n" +
- " id\n" +
- " name\n" +
- " }\n" +
- " }\n" +
- "}";
+ String expectedQueryBody = """
+ query Capsules {
+ capsules(limit: 1, offset: 0) {
+ dragon {
+ id
+ name
+ }
+ }
+ }""";
JSONParser jsonParser = new JSONParser(JSONParser.MODE_PERMISSIVE);
- ObjectMapper objectMapper = new ObjectMapper();
try {
- JSONObject resultJson = (JSONObject) jsonParser.parse(String.valueOf(result.getBody()));
- // Object resultData = ((JSONObject) resultJson.get("json")).get("query");
- String resultData = ((JSONObject) resultJson.get("json")).getAsString("query");
- String parsedJsonAsString = objectMapper.writeValueAsString(resultData);
+
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ JSONObject resultJson = (JSONObject) jsonParser.parse(new String(bodyBytes));
+ String resultData = resultJson.getAsString("query");
assertEquals(expectedQueryBody, resultData);
- } catch (ParseException | JsonProcessingException e) {
+ } catch (ParseException | EOFException | InterruptedException e) {
assert false : e.getMessage();
}
@@ -513,18 +587,19 @@ public void testSmartSubstitutionInQueryBodyForFullBodySubstitution() {
ActionExecutionRequest request = result.getRequest();
List<Map.Entry<String, String>> parameters =
(List<Map.Entry<String, String>>) request.getProperties().get("smart-substitution-parameters");
- assertEquals(parameters.size(), 1);
+ assertEquals(1, parameters.size());
Map.Entry<String, String> parameterEntry = parameters.get(0);
- assertEquals(parameterEntry.getKey(), "query Capsules {\n" +
- " capsules(limit: 1, offset: 0) {\n" +
- " dragon {\n" +
- " id\n" +
- " name\n" +
- " }\n" +
- " }\n" +
- "}");
- assertEquals(parameterEntry.getValue(), "GRAPHQL_BODY_FULL");
+ assertEquals(parameterEntry.getKey(), """
+ query Capsules {
+ capsules(limit: 1, offset: 0) {
+ dragon {
+ id
+ name
+ }
+ }
+ }""");
+ assertEquals("GRAPHQL_BODY_FULL", parameterEntry.getValue());
})
.verifyComplete();
}
@@ -532,18 +607,26 @@ public void testSmartSubstitutionInQueryBodyForFullBodySubstitution() {
@Test
public void testSmartSubstitutionQueryVariables() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
- dsConfig.setUrl("https://postman-echo.com/post");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = getDefaultActionConfiguration();
- String queryVariables = "{\n" +
- "\t\"name\" : {{Input1.text}},\n" +
- "\t\"email\" : {{Input2.text}},\n" +
- "\t\"username\" : {{Input3.text}},\n" +
- "\t\"password\" : \"{{Input4.text}}\",\n" +
- "\t\"newField\" : \"{{Input5.text}}\",\n" +
- "\t\"tableRow\" : {{Table1.selectedRow}},\n" +
- "\t\"table\" : \"{{Table1.tableData}}\"\n" +
- "}";
+ String queryVariables = """
+ {
+ "name" : {{Input1.text}},
+ "email" : {{Input2.text}},
+ "username" : {{Input3.text}},
+ "password" : "{{Input4.text}}",
+ "newField" : "{{Input5.text}}",
+ "tableRow" : {{Table1.selectedRow}},
+ "table" : "{{Table1.tableData}}"
+ }""";
actionConfig.getPluginSpecifiedTemplates().get(QUERY_VARIABLES_INDEX).setValue(queryVariables);
ExecuteActionDTO executeActionDTO = new ExecuteActionDTO();
@@ -590,43 +673,48 @@ public void testSmartSubstitutionQueryVariables() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String resultBody = "{\"password\":\"12/01/2018\",\"name\":\"this is a string! Yay :D\",\"newField\":null,\"tableRow\":{\"orderAmount\":4.99,\"id\":2381224,\"userName\":\"Michael Lawson\",\"email\":\"[email protected]\",\"productName\":\"Chicken Sandwich\"},\"email\":true,\"table\":[{\"orderAmount\":4.99,\"id\":2381224,\"userName\":\"Michael Lawson\",\"email\":\"[email protected]\",\"productName\":\"Chicken Sandwich\"},{\"orderAmount\":9.99,\"id\":2736212,\"userName\":\"Lindsay Ferguson\",\"email\":\"[email protected]\",\"productName\":\"Tuna Salad\"},{\"orderAmount\":19.99,\"id\":6788734,\"userName\":\"Tobias Funke\",\"email\":\"[email protected]\",\"productName\":\"Beef steak\"}],\"username\":0}";
+ String expectedResultData = "{\"password\":\"12\\/01\\/2018\",\"name\":\"this is a string! Yay :D\",\"newField\":null,\"tableRow\":{\"orderAmount\":4.99,\"id\":2381224,\"userName\":\"Michael Lawson\",\"email\":\"[email protected]\",\"productName\":\"Chicken Sandwich\"},\"email\":true,\"table\":[{\"orderAmount\":4.99,\"id\":2381224,\"userName\":\"Michael Lawson\",\"email\":\"[email protected]\",\"productName\":\"Chicken Sandwich\"},{\"orderAmount\":9.99,\"id\":2736212,\"userName\":\"Lindsay Ferguson\",\"email\":\"[email protected]\",\"productName\":\"Tuna Salad\"},{\"orderAmount\":19.99,\"id\":6788734,\"userName\":\"Tobias Funke\",\"email\":\"[email protected]\",\"productName\":\"Beef steak\"}],\"username\":0}";
JSONParser jsonParser = new JSONParser(JSONParser.MODE_PERMISSIVE);
- ObjectMapper objectMapper = new ObjectMapper();
try {
- JSONObject resultJson = (JSONObject) jsonParser.parse(String.valueOf(result.getBody()));
- Object resultData = ((JSONObject) resultJson.get("json")).get("variables");
- String parsedJsonAsString = objectMapper.writeValueAsString(resultData);
- assertEquals(resultBody, parsedJsonAsString);
- } catch (ParseException | JsonProcessingException e) {
- e.printStackTrace();
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ JSONObject resultJson = (JSONObject) jsonParser.parse(new String(bodyBytes));
+ Object resultData = resultJson.getAsString("variables");
+ assertEquals(expectedResultData, resultData);
+ } catch (ParseException | EOFException | InterruptedException e) {
+ assert false : e.getMessage();
}
// Assert the debug request parameters are getting set.
ActionExecutionRequest request = result.getRequest();
List<Map.Entry<String, String>> parameters =
(List<Map.Entry<String, String>>) request.getProperties().get("smart-substitution-parameters");
- assertEquals(parameters.size(), 7);
+ assertEquals(7, parameters.size());
Map.Entry<String, String> parameterEntry = parameters.get(0);
- assertEquals(parameterEntry.getKey(), "this is a string! Yay :D");
- assertEquals(parameterEntry.getValue(), "STRING");
+ assertEquals("this is a string! Yay :D", parameterEntry.getKey());
+ assertEquals("STRING", parameterEntry.getValue());
parameterEntry = parameters.get(1);
- assertEquals(parameterEntry.getKey(), "true");
- assertEquals(parameterEntry.getValue(), "BOOLEAN");
+ assertEquals("true", parameterEntry.getKey());
+ assertEquals("BOOLEAN", parameterEntry.getValue());
parameterEntry = parameters.get(2);
- assertEquals(parameterEntry.getKey(), "0");
- assertEquals(parameterEntry.getValue(), "INTEGER");
+ assertEquals("0", parameterEntry.getKey());
+ assertEquals("INTEGER", parameterEntry.getValue());
parameterEntry = parameters.get(3);
- assertEquals(parameterEntry.getKey(), "12/01/2018");
- assertEquals(parameterEntry.getValue(), "STRING");
+ assertEquals("12/01/2018", parameterEntry.getKey());
+ assertEquals("STRING", parameterEntry.getValue());
parameterEntry = parameters.get(4);
- assertEquals(parameterEntry.getKey(), "null");
- assertEquals(parameterEntry.getValue(), "NULL");
+ assertEquals("null", parameterEntry.getKey());
+ assertEquals("NULL", parameterEntry.getValue());
})
.verifyComplete();
}
@@ -634,7 +722,15 @@ public void testSmartSubstitutionQueryVariables() {
@Test
public void testRequestWithApiKeyHeader() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
- dsConfig.setUrl("https://postman-echo.com/post");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
+
AuthenticationDTO authenticationDTO = new ApiKeyAuth(ApiKeyAuth.Type.HEADER, "api_key", "Token", "test");
dsConfig.setAuthentication(authenticationDTO);
@@ -711,7 +807,7 @@ public void testGetDuplicateHeadersAndParams() {
Set<String> expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("myHeader1");
expectedDuplicateHeaders.add("myHeader2");
- assertTrue(expectedDuplicateHeaders.equals(duplicateHeadersWithDsConfigOnly.get(DATASOURCE_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateHeaders, duplicateHeadersWithDsConfigOnly.get(DATASOURCE_CONFIG_ONLY));
/* Test duplicate query params in datasource configuration only */
Map<DUPLICATE_ATTRIBUTE_LOCATION, Set<String>> duplicateParamsWithDsConfigOnly =
@@ -722,7 +818,7 @@ public void testGetDuplicateHeadersAndParams() {
Set<String> expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("myParam1");
expectedDuplicateParams.add("myParam2");
- assertTrue(expectedDuplicateParams.equals(duplicateParamsWithDsConfigOnly.get(DATASOURCE_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateParams, duplicateParamsWithDsConfigOnly.get(DATASOURCE_CONFIG_ONLY));
/* Test duplicate headers in datasource + action configuration */
Map<DUPLICATE_ATTRIBUTE_LOCATION, Set<String>> allDuplicateHeaders =
@@ -732,19 +828,19 @@ public void testGetDuplicateHeadersAndParams() {
expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("myHeader1");
expectedDuplicateHeaders.add("myHeader2");
- assertTrue(expectedDuplicateHeaders.equals(allDuplicateHeaders.get(DATASOURCE_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateHeaders, allDuplicateHeaders.get(DATASOURCE_CONFIG_ONLY));
// Header duplicates in action config only
expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("myHeader4");
expectedDuplicateHeaders.add("myHeader4");
- assertTrue(expectedDuplicateHeaders.equals(allDuplicateHeaders.get(ACTION_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateHeaders, allDuplicateHeaders.get(ACTION_CONFIG_ONLY));
// Header duplicates with one instance in action and another in datasource config
expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("myHeader3");
expectedDuplicateHeaders.add("apiKey");
- assertTrue(expectedDuplicateHeaders.equals(allDuplicateHeaders.get(DATASOURCE_AND_ACTION_CONFIG)));
+ assertEquals(expectedDuplicateHeaders, allDuplicateHeaders.get(DATASOURCE_AND_ACTION_CONFIG));
/* Test duplicate query params in action + datasource config */
Map<DUPLICATE_ATTRIBUTE_LOCATION, Set<String>> allDuplicateParams =
@@ -755,17 +851,17 @@ public void testGetDuplicateHeadersAndParams() {
expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("myParam1");
expectedDuplicateParams.add("myParam2");
- assertTrue(expectedDuplicateParams.equals(allDuplicateParams.get(DATASOURCE_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateParams, allDuplicateParams.get(DATASOURCE_CONFIG_ONLY));
// Query param duplicates in action config only
expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("myParam4");
- assertTrue(expectedDuplicateParams.equals(allDuplicateParams.get(ACTION_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateParams, allDuplicateParams.get(ACTION_CONFIG_ONLY));
// Query param duplicates in action + datasource config
expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("myParam3");
- assertTrue(expectedDuplicateParams.equals(allDuplicateParams.get(DATASOURCE_AND_ACTION_CONFIG)));
+ assertEquals(expectedDuplicateParams, allDuplicateParams.get(DATASOURCE_AND_ACTION_CONFIG));
}
@Test
@@ -798,7 +894,7 @@ public void testGetDuplicateHeadersWithOAuth() {
// Header duplicates with one instance in action and another in datasource config
HashSet<String> expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("Authorization");
- assertTrue(expectedDuplicateHeaders.equals(allDuplicateHeaders.get(DATASOURCE_AND_ACTION_CONFIG)));
+ assertEquals(expectedDuplicateHeaders, allDuplicateHeaders.get(DATASOURCE_AND_ACTION_CONFIG));
}
@Test
@@ -833,7 +929,7 @@ public void testGetDuplicateParamsWithOAuth() {
// Param duplicates with one instance in action and another in datasource config
HashSet<String> expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("access_token");
- assertTrue(expectedDuplicateParams.equals(allDuplicateParams.get(DATASOURCE_AND_ACTION_CONFIG)));
+ assertEquals(expectedDuplicateParams, allDuplicateParams.get(DATASOURCE_AND_ACTION_CONFIG));
}
/**
@@ -872,7 +968,7 @@ public void testHintMessageForDuplicateHeadersAndParamsWithDatasourceConfigOnly(
" because this datasource has duplicate definition(s) for header(s): [myHeader1]. Please " +
"remove the duplicate definition(s) to resolve this warning. Please note that some of the" +
" authentication mechanisms also implicitly define a header.");
- assertTrue(expectedDatasourceHintMessages.equals(datasourceHintMessages));
+ assertEquals(expectedDatasourceHintMessages, datasourceHintMessages);
Set<String> actionHintMessages = tuple.getT2();
Set<String> expectedActionHintMessages = new HashSet<>();
@@ -883,7 +979,7 @@ public void testHintMessageForDuplicateHeadersAndParamsWithDatasourceConfigOnly(
expectedActionHintMessages.add("Your API query may not run as expected because its datasource has" +
" duplicate definition(s) for header(s): [myHeader1]. Please remove the duplicate " +
"definition(s) from the datasource to resolve this warning.");
- assertTrue(expectedActionHintMessages.equals(actionHintMessages));
+ assertEquals(expectedActionHintMessages, actionHintMessages);
})
.verifyComplete();
}
@@ -927,7 +1023,7 @@ public void testHintMessageForDuplicateHeadersAndParamsWithActionConfigOnly() {
expectedActionHintMessages.add("Your API query may not run as expected because it has duplicate " +
"definition(s) for param(s): [myParam1]. Please remove the duplicate definition(s) from " +
"the 'Params' tab to resolve this warning.");
- assertTrue(expectedActionHintMessages.equals(actionHintMessages));
+ assertEquals(expectedActionHintMessages, actionHintMessages);
})
.verifyComplete();
}
@@ -965,7 +1061,7 @@ public void testHintMessageForDuplicateHeaderWithOneInstanceEachInActionAndDsCon
" the 'Headers' section of either the API query or the datasource. Please note that some " +
"of the authentication mechanisms also implicitly define a header.");
- assertTrue(expectedActionHintMessages.equals(actionHintMessages));
+ assertEquals(expectedActionHintMessages, actionHintMessages);
})
.verifyComplete();
}
@@ -1004,7 +1100,7 @@ public void testHintMessageForDuplicateParamWithOneInstanceEachInActionAndDsConf
" the 'Params' section of either the API query or the datasource. Please note that some " +
"of the authentication mechanisms also implicitly define a param.");
- assertTrue(expectedActionHintMessages.equals(actionHintMessages));
+ assertEquals(expectedActionHintMessages, actionHintMessages);
})
.verifyComplete();
}
@@ -1012,7 +1108,14 @@ public void testHintMessageForDuplicateParamWithOneInstanceEachInActionAndDsConf
@Test
public void testQueryParamsInDatasource() {
DatasourceConfiguration dsConfig = getDefaultDatasourceConfig();
- dsConfig.setUrl("https://postman-echo.com/post");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = getDefaultActionConfiguration();
actionConfig.setEncodeParamsToggle(true);
@@ -1028,9 +1131,18 @@ public void testQueryParamsInDatasource() {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String expected_url = "\"https://postman-echo.com/post?query_key=query+val\"";
- JsonNode url = ((ObjectNode) result.getBody()).get("url");
- assertEquals(expected_url, url.toString());
+ try {
+ RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+
+ assert recordedRequest != null;
+ String recordedRequestPath = recordedRequest.getPath();
+
+ String expectedUrl = "/?query_key=query+val";
+ assertEquals(expectedUrl, recordedRequestPath);
+ } catch (InterruptedException e) {
+ assert false : e.getMessage();
+ }
+
})
.verifyComplete();
}
@@ -1088,7 +1200,7 @@ public void testNextCursorKeyIsSkippedWhenCursorValueIsNull() {
actionConfig.setPaginationType(PaginationType.CURSOR);
actionConfig.getPluginSpecifiedTemplates().get(QUERY_VARIABLES_INDEX).setValue("{}");
- Map<String, Object> paginationDataMap = new HashMap<String, Object>();
+ Map<String, Object> paginationDataMap = new HashMap<>();
setValueSafelyInFormData(paginationDataMap, "cursorBased.next.limit.name", "first");
setValueSafelyInFormData(paginationDataMap, "cursorBased.next.limit.value", "3");
setValueSafelyInFormData(paginationDataMap, "cursorBased.next.cursor.name", "endCursor");
@@ -1118,7 +1230,7 @@ public void testPrevCursorKeyIsSkippedWhenCursorValueIsNull() {
actionConfig.setPaginationType(PaginationType.CURSOR);
actionConfig.getPluginSpecifiedTemplates().get(QUERY_VARIABLES_INDEX).setValue("{}");
- Map<String, Object> paginationDataMap = new HashMap<String, Object>();
+ Map<String, Object> paginationDataMap = new HashMap<>();
setValueSafelyInFormData(paginationDataMap, "cursorBased.previous.limit.name", "last");
setValueSafelyInFormData(paginationDataMap, "cursorBased.previous.limit.value", "3");
setValueSafelyInFormData(paginationDataMap, "cursorBased.previous.cursor.name", "startCursor");
@@ -1150,7 +1262,7 @@ public void testNextCursorKeyIsSkippedWhenPaginationValueIsNull() {
actionConfig.setPaginationType(PaginationType.CURSOR);
actionConfig.getPluginSpecifiedTemplates().get(QUERY_VARIABLES_INDEX).setValue("{}");
- Map<String, Object> paginationDataMap = new HashMap<String, Object>();
+ Map<String, Object> paginationDataMap = new HashMap<>();
setValueSafelyInFormData(paginationDataMap, "cursorBased.next.limit.name", "first");
setValueSafelyInFormData(paginationDataMap, "cursorBased.next.limit.value", "3");
setValueSafelyInFormData(paginationDataMap, "cursorBased.next.cursor.name", "endCursor");
@@ -1171,11 +1283,14 @@ public void testNextCursorKeyIsSkippedWhenPaginationValueIsNull() {
@Test
public void verifyUniquenessOfGraphQLPluginErrorCode() {
- assert (Arrays.stream(GraphQLPluginError.values()).map(GraphQLPluginError::getAppErrorCode).distinct().count() == GraphQLPluginError.values().length);
-
- assert (Arrays.stream(GraphQLPluginError.values()).map(GraphQLPluginError::getAppErrorCode)
- .filter(appErrorCode-> appErrorCode.length() != 11 || !appErrorCode.startsWith("PE-GQL"))
- .collect(Collectors.toList()).size() == 0);
+ assertEquals(GraphQLPluginError.values().length, Arrays.stream(GraphQLPluginError.values()).map(GraphQLPluginError::getAppErrorCode).distinct().count());
+
+ assertEquals(0,
+ Arrays.stream(GraphQLPluginError.values())
+ .map(GraphQLPluginError::getAppErrorCode)
+ .filter(appErrorCode -> appErrorCode.length() != 11 || !appErrorCode.startsWith("PE-GQL"))
+ .toList()
+ .size());
}
diff --git a/app/server/appsmith-plugins/restApiPlugin/src/test/java/com/external/plugins/RestApiPluginTest.java b/app/server/appsmith-plugins/restApiPlugin/src/test/java/com/external/plugins/RestApiPluginTest.java
index b9a3bb4bf501..6879928d7a25 100644
--- a/app/server/appsmith-plugins/restApiPlugin/src/test/java/com/external/plugins/RestApiPluginTest.java
+++ b/app/server/appsmith-plugins/restApiPlugin/src/test/java/com/external/plugins/RestApiPluginTest.java
@@ -8,21 +8,17 @@
import com.appsmith.external.models.ActionConfiguration;
import com.appsmith.external.models.ActionExecutionRequest;
import com.appsmith.external.models.ActionExecutionResult;
-import com.appsmith.external.models.ApiContentType;
import com.appsmith.external.models.ApiKeyAuth;
import com.appsmith.external.models.AuthenticationDTO;
import com.appsmith.external.models.DatasourceConfiguration;
import com.appsmith.external.models.OAuth2;
-import com.appsmith.external.models.PaginationType;
import com.appsmith.external.models.PaginationField;
+import com.appsmith.external.models.PaginationType;
import com.appsmith.external.models.Param;
import com.appsmith.external.models.Property;
import com.appsmith.external.services.SharedConfig;
import com.external.plugins.exceptions.RestApiPluginError;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.jsonwebtoken.JwtParser;
import io.jsonwebtoken.Jwts;
@@ -31,10 +27,9 @@
import mockwebserver3.MockResponse;
import mockwebserver3.MockWebServer;
import mockwebserver3.RecordedRequest;
-import net.minidev.json.JSONObject;
-import net.minidev.json.parser.JSONParser;
-import net.minidev.json.parser.ParseException;
import okhttp3.HttpUrl;
+import okio.Buffer;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;
@@ -45,10 +40,13 @@
import reactor.util.function.Tuple2;
import javax.crypto.SecretKey;
+import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -56,8 +54,9 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Arrays;
-import java.util.stream.Collectors;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.zip.GZIPOutputStream;
import static com.appsmith.external.constants.Authentication.API_KEY;
import static com.appsmith.external.constants.Authentication.OAUTH2;
@@ -77,7 +76,9 @@ public class RestApiPluginTest {
private static HintMessageUtils hintMessageUtils;
- public class MockSharedConfig implements SharedConfig {
+ private static MockWebServer mockEndpoint;
+
+ public static class MockSharedConfig implements SharedConfig {
@Override
public int getCodecSize() {
@@ -98,14 +99,29 @@ public String getRemoteExecutionUrl() {
RestApiPlugin.RestApiPluginExecutor pluginExecutor = new RestApiPlugin.RestApiPluginExecutor(new MockSharedConfig());
@BeforeEach
- public void setUp() {
+ public void setUp() throws IOException {
hintMessageUtils = new HintMessageUtils();
+ mockEndpoint = new MockWebServer();
+ mockEndpoint.start();
}
+ @AfterEach
+ public void tearDown() throws IOException {
+ mockEndpoint.shutdown();
+ }
+
@Test
public void testValidJsonApiExecution() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
+
ActionConfiguration actionConfig = new ActionConfiguration();
final List<Property> headers = List.of(new Property("content-type", "application/json"));
@@ -119,10 +135,24 @@ public void testValidJsonApiExecution() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- JsonNode data = ((ObjectNode) result.getBody()).get("data");
- assertEquals(requestBody, data.toString());
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals(requestBody, new String(bodyBytes));
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
+
+
final ActionExecutionRequest request = result.getRequest();
- assertEquals("https://postman-echo.com/post", request.getUrl());
+ assertEquals(baseUrl, request.getUrl());
assertEquals(HttpMethod.POST, request.getHttpMethod());
assertEquals(requestBody, request.getBody().toString());
final Iterator<Map.Entry<String, JsonNode>> fields = ((ObjectNode) result.getRequest().getHeaders()).fields();
@@ -138,8 +168,15 @@ public void testValidJsonApiExecution() {
@Test
public void testValidApiExecutionWithWhitespacesInUrl() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
//added whitespaces in url to validate successful execution of the same
- dsConfig.setUrl(" https://postman-echo.com/post ");
+ dsConfig.setUrl(" " + baseUrl + " ");
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
final List<Property> headers = List.of(new Property("content-type", "application/json"));
@@ -159,13 +196,11 @@ public void testValidApiExecutionWithWhitespacesInUrl() {
@Test
public void testExecuteApiWithPaginationForPreviousUrl() throws IOException {
- MockWebServer mockWebServer = new MockWebServer();
- MockResponse mockRedirectResponse = new MockResponse()
- .setResponseCode(200);
- mockWebServer.enqueue(mockRedirectResponse);
- mockWebServer.start();
+ MockResponse mockRedirectResponse = new MockResponse().setResponseCode(200);
+ mockEndpoint.enqueue(mockRedirectResponse);
+ mockEndpoint.start();
- HttpUrl mockHttpUrl = mockWebServer.url("/mock");
+ HttpUrl mockHttpUrl = mockEndpoint.url("/mock");
String previousUrl = mockHttpUrl + "?pageSize=1&page=2&mock_filter=abc 11";
String nextUrl = mockHttpUrl + "?pageSize=1&page=4&mock_filter=abc 11";
@@ -180,9 +215,9 @@ public void testExecuteApiWithPaginationForPreviousUrl() throws IOException {
final List<Property> headers = List.of();
final List<Property> queryParameters = List.of(
- new Property("mock_filter","abc 11"),
- new Property("pageSize","1"),
- new Property("page","3")
+ new Property("mock_filter", "abc 11"),
+ new Property("pageSize", "1"),
+ new Property("page", "3")
);
ActionConfiguration actionConfig = new ActionConfiguration();
@@ -200,18 +235,19 @@ public void testExecuteApiWithPaginationForPreviousUrl() throws IOException {
actionConfig.setEncodeParamsToggle(true);
- actionConfig.setPluginSpecifiedTemplates(List.of(new Property(null,true)));
+ actionConfig.setPluginSpecifiedTemplates(List.of(new Property(null, true)));
- actionConfig.setFormData(Collections.singletonMap("apiContentType","none"));
+ actionConfig.setFormData(Collections.singletonMap("apiContentType", "none"));
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, executeActionDTO, dsConfig, actionConfig);
StepVerifier.create(resultMono)
.assertNext(result -> {
try {
- RecordedRequest recordedRequest = mockWebServer.takeRequest();
+ RecordedRequest recordedRequest = mockEndpoint.takeRequest();
HttpUrl requestUrl = recordedRequest.getRequestUrl();
String encodedPreviousUrl = mockHttpUrl + "?pageSize=1&page=2&mock_filter=abc+11";
+ assert requestUrl != null;
assertEquals(encodedPreviousUrl, requestUrl.toString());
} catch (InterruptedException e) {
fail("Mock web server failed to capture request.");
@@ -222,13 +258,11 @@ public void testExecuteApiWithPaginationForPreviousUrl() throws IOException {
@Test
public void testExecuteApiWithPaginationForPreviousEncodedUrl() throws IOException {
- MockWebServer mockWebServer = new MockWebServer();
- MockResponse mockRedirectResponse = new MockResponse()
- .setResponseCode(200);
- mockWebServer.enqueue(mockRedirectResponse);
- mockWebServer.start();
+ MockResponse mockRedirectResponse = new MockResponse().setResponseCode(200);
+ mockEndpoint.enqueue(mockRedirectResponse);
+ mockEndpoint.start();
- HttpUrl mockHttpUrl = mockWebServer.url("/mock");
+ HttpUrl mockHttpUrl = mockEndpoint.url("/mock");
String previousUrl = URLEncoder.encode(mockHttpUrl + "?pageSize=1&page=2&mock_filter=abc 11",
StandardCharsets.UTF_8);
@@ -244,9 +278,9 @@ public void testExecuteApiWithPaginationForPreviousEncodedUrl() throws IOExcepti
final List<Property> headers = List.of();
final List<Property> queryParameters = List.of(
- new Property("mock_filter","abc 11"),
- new Property("pageSize","1"),
- new Property("page","3")
+ new Property("mock_filter", "abc 11"),
+ new Property("pageSize", "1"),
+ new Property("page", "3")
);
ActionConfiguration actionConfig = new ActionConfiguration();
@@ -264,18 +298,19 @@ public void testExecuteApiWithPaginationForPreviousEncodedUrl() throws IOExcepti
actionConfig.setEncodeParamsToggle(true);
- actionConfig.setPluginSpecifiedTemplates(List.of(new Property(null,true)));
+ actionConfig.setPluginSpecifiedTemplates(List.of(new Property(null, true)));
- actionConfig.setFormData(Collections.singletonMap("apiContentType","none"));
+ actionConfig.setFormData(Collections.singletonMap("apiContentType", "none"));
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, executeActionDTO, dsConfig, actionConfig);
StepVerifier.create(resultMono)
.assertNext(result -> {
try {
- RecordedRequest recordedRequest = mockWebServer.takeRequest();
+ RecordedRequest recordedRequest = mockEndpoint.takeRequest();
HttpUrl requestUrl = recordedRequest.getRequestUrl();
String encodedPreviousUrl = mockHttpUrl + "?pageSize=1&page=2&mock_filter=abc+11";
+ assert requestUrl != null;
assertEquals(encodedPreviousUrl, requestUrl.toString());
} catch (InterruptedException e) {
fail("Mock web server failed to capture request.");
@@ -286,13 +321,11 @@ public void testExecuteApiWithPaginationForPreviousEncodedUrl() throws IOExcepti
@Test
public void testExecuteApiWithPaginationForNextUrl() throws IOException {
- MockWebServer mockWebServer = new MockWebServer();
- MockResponse mockRedirectResponse = new MockResponse()
- .setResponseCode(200);
- mockWebServer.enqueue(mockRedirectResponse);
- mockWebServer.start();
+ MockResponse mockRedirectResponse = new MockResponse().setResponseCode(200);
+ mockEndpoint.enqueue(mockRedirectResponse);
+ mockEndpoint.start();
- HttpUrl mockHttpUrl = mockWebServer.url("/mock");
+ HttpUrl mockHttpUrl = mockEndpoint.url("/mock");
String previousUrl = mockHttpUrl + "?pageSize=1&page=2&mock_filter=abc 11";
String nextUrl = mockHttpUrl + "?pageSize=1&page=4&mock_filter=abc 11";
@@ -307,9 +340,9 @@ public void testExecuteApiWithPaginationForNextUrl() throws IOException {
final List<Property> headers = List.of();
final List<Property> queryParameters = List.of(
- new Property("mock_filter","abc 11"),
- new Property("pageSize","1"),
- new Property("page","3")
+ new Property("mock_filter", "abc 11"),
+ new Property("pageSize", "1"),
+ new Property("page", "3")
);
ActionConfiguration actionConfig = new ActionConfiguration();
@@ -327,18 +360,19 @@ public void testExecuteApiWithPaginationForNextUrl() throws IOException {
actionConfig.setEncodeParamsToggle(true);
- actionConfig.setPluginSpecifiedTemplates(List.of(new Property(null,true)));
+ actionConfig.setPluginSpecifiedTemplates(List.of(new Property(null, true)));
- actionConfig.setFormData(Collections.singletonMap("apiContentType","none"));
+ actionConfig.setFormData(Collections.singletonMap("apiContentType", "none"));
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, executeActionDTO, dsConfig, actionConfig);
StepVerifier.create(resultMono)
.assertNext(result -> {
try {
- RecordedRequest recordedRequest = mockWebServer.takeRequest();
+ RecordedRequest recordedRequest = mockEndpoint.takeRequest();
HttpUrl requestUrl = recordedRequest.getRequestUrl();
String encodedNextUrl = mockHttpUrl + "?pageSize=1&page=4&mock_filter=abc+11";
+ assert requestUrl != null;
assertEquals(encodedNextUrl, requestUrl.toString());
} catch (InterruptedException e) {
fail("Mock web server failed to capture request.");
@@ -349,13 +383,11 @@ public void testExecuteApiWithPaginationForNextUrl() throws IOException {
@Test
public void testExecuteApiWithPaginationForNextEncodedUrl() throws IOException {
- MockWebServer mockWebServer = new MockWebServer();
- MockResponse mockRedirectResponse = new MockResponse()
- .setResponseCode(200);
- mockWebServer.enqueue(mockRedirectResponse);
- mockWebServer.start();
+ MockResponse mockRedirectResponse = new MockResponse().setResponseCode(200);
+ mockEndpoint.enqueue(mockRedirectResponse);
+ mockEndpoint.start();
- HttpUrl mockHttpUrl = mockWebServer.url("/mock");
+ HttpUrl mockHttpUrl = mockEndpoint.url("/mock");
String previousUrl = mockHttpUrl + "?pageSize=1&page=2&mock_filter=abc 11";
String nextUrl = URLEncoder.encode(mockHttpUrl + "?pageSize=1&page=4&mock_filter=abc 11", StandardCharsets.UTF_8);
@@ -370,9 +402,9 @@ public void testExecuteApiWithPaginationForNextEncodedUrl() throws IOException {
final List<Property> headers = List.of();
final List<Property> queryParameters = List.of(
- new Property("mock_filter","abc 11"),
- new Property("pageSize","1"),
- new Property("page","3")
+ new Property("mock_filter", "abc 11"),
+ new Property("pageSize", "1"),
+ new Property("page", "3")
);
ActionConfiguration actionConfig = new ActionConfiguration();
@@ -390,18 +422,19 @@ public void testExecuteApiWithPaginationForNextEncodedUrl() throws IOException {
actionConfig.setEncodeParamsToggle(true);
- actionConfig.setPluginSpecifiedTemplates(List.of(new Property(null,true)));
+ actionConfig.setPluginSpecifiedTemplates(List.of(new Property(null, true)));
- actionConfig.setFormData(Collections.singletonMap("apiContentType","none"));
+ actionConfig.setFormData(Collections.singletonMap("apiContentType", "none"));
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, executeActionDTO, dsConfig, actionConfig);
StepVerifier.create(resultMono)
.assertNext(result -> {
try {
- RecordedRequest recordedRequest = mockWebServer.takeRequest();
+ RecordedRequest recordedRequest = mockEndpoint.takeRequest();
HttpUrl requestUrl = recordedRequest.getRequestUrl();
String encodedNextUrl = mockHttpUrl + "?pageSize=1&page=4&mock_filter=abc+11";
+ assert requestUrl != null;
assertEquals(encodedNextUrl, requestUrl.toString());
} catch (InterruptedException e) {
fail("Mock web server failed to capture request.");
@@ -413,7 +446,14 @@ public void testExecuteApiWithPaginationForNextEncodedUrl() throws IOException {
@Test
public void testValidFormApiExecution() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
+
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/x-www-form-urlencoded")));
@@ -429,8 +469,21 @@ public void testValidFormApiExecution() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- JsonNode data = ((ObjectNode) result.getBody()).get("form");
- assertEquals("{\"key\":\"value\",\"key1\":\"value1\"}", data.toString());
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals("key=value&key1=value1", new String(bodyBytes));
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
+
assertEquals("key=value&key1=value1", result.getRequest().getBody());
})
.verifyComplete();
@@ -439,7 +492,15 @@ public void testValidFormApiExecution() {
@Test
public void testValidRawApiExecution() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
+
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "text/plain;charset=UTF-8")));
@@ -453,8 +514,20 @@ public void testValidRawApiExecution() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- JsonNode data = ((ObjectNode) result.getBody()).get("data");
- assertEquals("\"{\\\"key\\\":\\\"value\\\"}\"", data.toString());
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals(requestBody, new String(bodyBytes));
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
})
.verifyComplete();
}
@@ -462,7 +535,15 @@ public void testValidRawApiExecution() {
@Test
public void testValidSignature() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("http://httpbin.org/headers");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
+
final String secretKey = "a-random-key-that-should-be-32-chars-long-at-least";
dsConfig.setProperties(List.of(
@@ -478,22 +559,30 @@ public void testValidSignature() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String token = ((ObjectNode) result.getBody()).get("headers").get("X-Appsmith-Signature").asText();
-
- final SecretKey key = Keys.hmacShaKeyFor(secretKey.getBytes(StandardCharsets.UTF_8));
- final String issuer = Jwts.parserBuilder()
- .setSigningKey(key)
- .build()
- .parseClaimsJws(token)
- .getBody()
- .getIssuer();
- assertEquals("Appsmith", issuer);
- final Iterator<Map.Entry<String, JsonNode>> fields = ((ObjectNode) result.getRequest().getHeaders()).fields();
- fields.forEachRemaining(field -> {
- if ("X-Appsmith-Signature".equalsIgnoreCase(field.getKey())) {
- assertEquals(token, field.getValue().get(0).asText());
- }
- });
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+
+ String token = recordedRequest.getHeaders().get("X-Appsmith-Signature");
+ final SecretKey key = Keys.hmacShaKeyFor(secretKey.getBytes(StandardCharsets.UTF_8));
+ final String issuer = Jwts.parserBuilder()
+ .setSigningKey(key)
+ .build()
+ .parseClaimsJws(token)
+ .getBody()
+ .getIssuer();
+ assertEquals("Appsmith", issuer);
+ final Iterator<Map.Entry<String, JsonNode>> fields = ((ObjectNode) result.getRequest().getHeaders()).fields();
+ fields.forEachRemaining(field -> {
+ if ("X-Appsmith-Signature".equalsIgnoreCase(field.getKey())) {
+ assertEquals(token, field.getValue().get(0).asText());
+ }
+ });
+
+ } catch (InterruptedException e) {
+ assert false : e.getMessage();
+ }
})
.verifyComplete();
@@ -511,15 +600,15 @@ public void testHttpGetRequestRawBody() {
param.setPseudoBindingName("k0");
executeActionDTO.setParams(Collections.singletonList(param));
- executeActionDTO.setParamProperties(Collections.singletonMap("k0","string"));
- executeActionDTO.setParameterMap(Collections.singletonMap("Input1.text","k0"));
- executeActionDTO.setInvertParameterMap(Collections.singletonMap("k0","Input1.text"));
+ executeActionDTO.setParamProperties(Collections.singletonMap("k0", "string"));
+ executeActionDTO.setParameterMap(Collections.singletonMap("Input1.text", "k0"));
+ executeActionDTO.setInvertParameterMap(Collections.singletonMap("k0", "Input1.text"));
DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
datasourceConfiguration.setUrl("https://postman-echo.com/get");
final List<Property> headers = List.of(
- new Property("content-type",MediaType.TEXT_PLAIN_VALUE));
+ new Property("content-type", MediaType.TEXT_PLAIN_VALUE));
final List<Property> queryParameters = List.of();
@@ -534,13 +623,13 @@ public void testHttpGetRequestRawBody() {
actionConfiguration.setEncodeParamsToggle(true);
- actionConfiguration.setPluginSpecifiedTemplates(List.of(new Property(null,true)));
+ actionConfiguration.setPluginSpecifiedTemplates(List.of(new Property(null, true)));
actionConfiguration.setFormData(Collections.singletonMap("apiContentType", MediaType.TEXT_PLAIN_VALUE));
- String[] requestBodyList = {"abc is equals to {{Input1.text}}","{ \"abc\": {{Input1.text}} }",""};
+ String[] requestBodyList = {"abc is equals to {{Input1.text}}", "{ \"abc\": {{Input1.text}} }", ""};
- String[] finalRequestBodyList = {"abc is equals to \"123\"","{ \"abc\": \"123\" }",""};
+ String[] finalRequestBodyList = {"abc is equals to \"123\"", "{ \"abc\": \"123\" }", ""};
for (int requestBodyIndex = 0; requestBodyIndex < requestBodyList.length; requestBodyIndex++) {
@@ -556,15 +645,12 @@ public void testHttpGetRequestRawBody() {
JsonNode args = body.get("args");
int index = 0;
StringBuilder actualRequestBody = new StringBuilder();
- while (true) {
- if (!args.has(String.valueOf(index))) {
- break;
- }
+ while (args.has(String.valueOf(index))) {
JsonNode ans = args.get(String.valueOf(index));
index++;
actualRequestBody.append(ans.asText());
}
- assertEquals(finalRequestBodyList[currentIndex],actualRequestBody.toString());
+ assertEquals(finalRequestBodyList[currentIndex], actualRequestBody.toString());
final ActionExecutionRequest request = result.getRequest();
assertEquals(HttpMethod.GET, request.getHttpMethod());
})
@@ -575,7 +661,13 @@ public void testHttpGetRequestRawBody() {
@Test
public void testInvalidSignature() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("http://httpbin.org/headers");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
final String secretKey = "a-random-key-that-should-be-32-chars-long-at-least";
dsConfig.setProperties(List.of(
@@ -591,12 +683,20 @@ public void testInvalidSignature() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String token = ((ObjectNode) result.getBody()).get("headers").get("X-Appsmith-Signature").asText();
- final SecretKey key = Keys.hmacShaKeyFor((secretKey + "-abc").getBytes(StandardCharsets.UTF_8));
- final JwtParser parser = Jwts.parserBuilder().setSigningKey(key).build();
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ String token = recordedRequest.getHeaders().get("X-Appsmith-Signature");
+
+ final SecretKey key = Keys.hmacShaKeyFor((secretKey + "-abc").getBytes(StandardCharsets.UTF_8));
+ final JwtParser parser = Jwts.parserBuilder().setSigningKey(key).build();
+
+ assertThrows(SignatureException.class, () -> parser.parseClaimsJws(token));
+ } catch (InterruptedException e) {
+ assert false : e.getMessage();
+ }
- assertThrows(SignatureException.class, () -> parser.parseClaimsJws(token));
})
.verifyComplete();
}
@@ -604,7 +704,14 @@ public void testInvalidSignature() {
@Test
public void testEncodeParamsToggleOn() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/json")));
@@ -624,9 +731,23 @@ public void testEncodeParamsToggleOn() {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String expected_url = "\"https://postman-echo.com/post?query_key=query+val\"";
- JsonNode url = ((ObjectNode) result.getBody()).get("url");
- assertEquals(expected_url, url.toString());
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals(requestBody, new String(bodyBytes));
+
+ String requestPath = recordedRequest.getPath();
+ assertEquals("/?query_key=query+val", requestPath);
+
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
})
.verifyComplete();
}
@@ -634,7 +755,13 @@ public void testEncodeParamsToggleOn() {
@Test
public void testEncodeParamsToggleNull() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/json")));
@@ -654,9 +781,23 @@ public void testEncodeParamsToggleNull() {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String expected_url = "\"https://postman-echo.com/post?query_key=query+val\"";
- JsonNode url = ((ObjectNode) result.getBody()).get("url");
- assertEquals(expected_url, url.toString());
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals(requestBody, new String(bodyBytes));
+
+ String requestPath = recordedRequest.getPath();
+ assertEquals("/?query_key=query+val", requestPath);
+
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
})
.verifyComplete();
}
@@ -664,7 +805,13 @@ public void testEncodeParamsToggleNull() {
@Test
public void testEncodeParamsToggleOff() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/json")));
@@ -683,9 +830,8 @@ public void testEncodeParamsToggleOff() {
dsConfig,
actionConfig));
StepVerifier.create(resultMono)
- .assertNext(actionExecutionResult -> {
- assertTrue(actionExecutionResult.getPluginErrorDetails().getDownstreamErrorMessage().contains("Invalid character ' ' for QUERY_PARAM in \"query val\""));
- });
+ .assertNext(actionExecutionResult -> assertTrue(actionExecutionResult.getPluginErrorDetails().getDownstreamErrorMessage().contains("Invalid character ' ' for QUERY_PARAM in \"query val\"")))
+ .verifyComplete();
}
@Test
@@ -706,20 +852,27 @@ public void testValidateDatasource_invalidAuthentication() {
@Test
public void testSmartSubstitutionJSONBody() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/json")));
actionConfig.setHttpMethod(HttpMethod.POST);
- String requestBody = "{\n" +
- "\t\"name\" : {{Input1.text}},\n" +
- "\t\"email\" : {{Input2.text}},\n" +
- "\t\"username\" : {{Input3.text}},\n" +
- "\t\"password\" : \"{{Input4.text}}\",\n" +
- "\t\"newField\" : \"{{Input5.text}}\",\n" +
- "\t\"tableRow\" : {{Table1.selectedRow}},\n" +
- "\t\"table\" : \"{{Table1.tableData}}\"\n" +
- "}";
+ String requestBody = """
+ {
+ \t"name" : {{Input1.text}},
+ \t"email" : {{Input2.text}},
+ \t"username" : {{Input3.text}},
+ \t"password" : "{{Input4.text}}",
+ \t"newField" : "{{Input5.text}}",
+ \t"tableRow" : {{Table1.selectedRow}},
+ \t"table" : "{{Table1.tableData}}"
+ }""";
actionConfig.setBody(requestBody);
List<Property> pluginSpecifiedTemplates = new ArrayList<>();
pluginSpecifiedTemplates.add(new Property("jsonSmartSubstitution", "true"));
@@ -770,42 +923,46 @@ public void testSmartSubstitutionJSONBody() {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
String resultBody = "{\"password\":\"12/01/2018\",\"name\":\"this is a string! Yay :D\",\"newField\":null,\"tableRow\":{\"orderAmount\":4.99,\"id\":2381224,\"userName\":\"Michael Lawson\",\"email\":\"[email protected]\",\"productName\":\"Chicken Sandwich\"},\"email\":true,\"table\":[{\"orderAmount\":4.99,\"id\":2381224,\"userName\":\"Michael Lawson\",\"email\":\"[email protected]\",\"productName\":\"Chicken Sandwich\"},{\"orderAmount\":9.99,\"id\":2736212,\"userName\":\"Lindsay Ferguson\",\"email\":\"[email protected]\",\"productName\":\"Tuna Salad\"},{\"orderAmount\":19.99,\"id\":6788734,\"userName\":\"Tobias Funke\",\"email\":\"[email protected]\",\"productName\":\"Beef steak\"}],\"username\":0}";
- JSONParser jsonParser = new JSONParser(JSONParser.MODE_PERMISSIVE);
- ObjectMapper objectMapper = new ObjectMapper();
+
try {
- JSONObject resultJson = (JSONObject) jsonParser.parse(String.valueOf(result.getBody()));
- Object resultData = resultJson.get("json");
- String parsedJsonAsString = objectMapper.writeValueAsString(resultData);
- assertEquals(resultBody, parsedJsonAsString);
- } catch (ParseException | JsonProcessingException e) {
- e.printStackTrace();
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals(resultBody, new String(bodyBytes));
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
}
// Assert the debug request parameters are getting set.
ActionExecutionRequest request = result.getRequest();
List<Map.Entry<String, String>> parameters =
(List<Map.Entry<String, String>>) request.getProperties().get("smart-substitution-parameters");
- assertEquals(parameters.size(), 7);
+ assertEquals(7, parameters.size());
Map.Entry<String, String> parameterEntry = parameters.get(0);
- assertEquals(parameterEntry.getKey(), "this is a string! Yay :D");
- assertEquals(parameterEntry.getValue(), "STRING");
+ assertEquals("this is a string! Yay :D", parameterEntry.getKey());
+ assertEquals("STRING", parameterEntry.getValue());
parameterEntry = parameters.get(1);
- assertEquals(parameterEntry.getKey(), "true");
- assertEquals(parameterEntry.getValue(), "BOOLEAN");
+ assertEquals("true", parameterEntry.getKey());
+ assertEquals("BOOLEAN", parameterEntry.getValue());
parameterEntry = parameters.get(2);
- assertEquals(parameterEntry.getKey(), "0");
- assertEquals(parameterEntry.getValue(), "INTEGER");
+ assertEquals("0", parameterEntry.getKey());
+ assertEquals("INTEGER", parameterEntry.getValue());
parameterEntry = parameters.get(3);
- assertEquals(parameterEntry.getKey(), "12/01/2018");
- assertEquals(parameterEntry.getValue(), "STRING");
+ assertEquals("12/01/2018", parameterEntry.getKey());
+ assertEquals("STRING", parameterEntry.getValue());
parameterEntry = parameters.get(4);
- assertEquals(parameterEntry.getKey(), "null");
- assertEquals(parameterEntry.getValue(), "NULL");
+ assertEquals("null", parameterEntry.getKey());
+ assertEquals("NULL", parameterEntry.getValue());
})
.verifyComplete();
}
@@ -813,13 +970,18 @@ public void testSmartSubstitutionJSONBody() {
@Test
public void testMultipartFormData() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("http://httpbin.org/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setAutoGeneratedHeaders(List.of(new Property("content-type", "multipart/form-data")));
actionConfig.setHttpMethod(HttpMethod.POST);
- String requestBody = "{\"key1\":\"onlyValue\"}";
final Property key1 = new Property("key1", "onlyValue");
final Property key2 = new Property("key2", "{\"name\":\"fileName\", \"type\":\"application/json\", \"data\":{\"key\":\"value\"}}");
final Property key3 = new Property("key3", "[{\"name\":\"fileName2\", \"type\":\"application/json\", \"data\":{\"key2\":\"value2\"}}]");
@@ -839,10 +1001,39 @@ public void testMultipartFormData() {
"key2", "<file>",
"key3", "<file>"),
result.getRequest().getBody());
- JsonNode formDataResponse = ((ObjectNode) result.getBody()).get("form");
- assertEquals(requestBody, formDataResponse.toString());
- JsonNode fileDataResponse = ((ObjectNode) result.getBody()).get("files");
- assertEquals("{\"key2\":\"{key=value}\",\"key3\":\"{key2=value2}\"}", fileDataResponse.toString());
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ String bodyString = new String(bodyBytes);
+
+ assertTrue(bodyString.contains("""
+ Content-Disposition: form-data; name="key1"\r
+ Content-Type: text/plain;charset=UTF-8\r
+ Content-Length: 9\r
+ \r
+ onlyValue"""));
+
+ assertTrue(bodyString.contains("""
+ Content-Disposition: form-data; name="key2"; filename="fileName"\r
+ Content-Type: application/json\r
+ \r
+ {key=value}"""));
+
+ assertTrue(bodyString.contains("""
+ Content-Disposition: form-data; name="key3"; filename="fileName2"\r
+ Content-Type: application/json\r
+ \r
+ {key2=value2}"""));
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
})
.verifyComplete();
}
@@ -850,19 +1041,26 @@ public void testMultipartFormData() {
@Test
public void testParsingBodyWithInvalidJSONHeader() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://mock-api.appsmith.com/echo/raw");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("invalid json text")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/json")));
actionConfig.setHttpMethod(HttpMethod.POST);
- String requestBody = "{\n" +
- " \"headers\": {\n" +
- " \"Content-Type\": \"application/json\",\n" +
- " \"X-RANDOM-HEADER\": \"random-value\"\n" +
- " },\n" +
- " \"body\": \"invalid json text\"\n" +
- "}";
+ String requestBody = """
+ {
+ "headers": {
+ "Content-Type": "application/json",
+ "X-RANDOM-HEADER": "random-value"
+ },
+ "body": "invalid json text"
+ }""";
actionConfig.setBody(requestBody);
Mono<ActionExecutionResult> resultMono = pluginExecutor.executeParameterized(null, new ExecuteActionDTO(), dsConfig, actionConfig);
@@ -870,9 +1068,25 @@ public void testParsingBodyWithInvalidJSONHeader() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals("{\"headers\":{\"X-RANDOM-HEADER\":\"random-value\",\"Content-Type\":\"application/json\"},\"body\":\"invalid json text\"}",
+ new String(bodyBytes));
+
+ String contentType = recordedRequest.getHeaders().get("Content-Type");
+ assertEquals("application/json", contentType);
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
assertEquals("invalid json text", result.getBody());
- ArrayNode data = (ArrayNode) result.getHeaders().get("Content-Type");
- assertEquals("application/json; charset=utf-8", data.get(0).asText());
assertEquals(1, result.getMessages().size());
String expectedMessage = "The response returned by this API is not a valid JSON. Please " +
@@ -888,7 +1102,14 @@ public void testParsingBodyWithInvalidJSONHeader() {
@Test
public void testRequestWithApiKeyHeader() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
+
AuthenticationDTO authenticationDTO = new ApiKeyAuth(ApiKeyAuth.Type.HEADER, "api_key", "Token", "test");
dsConfig.setAuthentication(authenticationDTO);
@@ -897,7 +1118,7 @@ public void testRequestWithApiKeyHeader() {
new Property("content-type", "application/json"),
new Property(HttpHeaders.AUTHORIZATION, "auth-value")
));
- actionConfig.setAutoGeneratedHeaders(List.of(new Property("content-type","application/json")));
+ actionConfig.setAutoGeneratedHeaders(List.of(new Property("content-type", "application/json")));
actionConfig.setHttpMethod(HttpMethod.POST);
String requestBody = "{\"key\":\"value\"}";
@@ -923,15 +1144,22 @@ public void testRequestWithApiKeyHeader() {
@Test
public void testSmartSubstitutionEvaluatedValueContainingQuestionMark() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/json")));
actionConfig.setHttpMethod(HttpMethod.POST);
- String requestBody = "{\n" +
- "\t\"name\" : {{Input1.text}},\n" +
- "\t\"email\" : {{Input2.text}},\n" +
- "}";
+ String requestBody = """
+ {
+ \t"name" : {{Input1.text}},
+ \t"email" : {{Input2.text}},
+ }""";
actionConfig.setBody(requestBody);
List<Property> pluginSpecifiedTemplates = new ArrayList<>();
pluginSpecifiedTemplates.add(new Property("jsonSmartSubstitution", "true"));
@@ -956,16 +1184,19 @@ public void testSmartSubstitutionEvaluatedValueContainingQuestionMark() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String resultBody = "{\"name\":\"this is a string with a ? \",\"email\":\"[email protected]\"}";
- JSONParser jsonParser = new JSONParser(JSONParser.MODE_PERMISSIVE);
- ObjectMapper objectMapper = new ObjectMapper();
+
try {
- JSONObject resultJson = (JSONObject) jsonParser.parse(String.valueOf(result.getBody()));
- Object resultData = resultJson.get("json");
- String parsedJsonAsString = objectMapper.writeValueAsString(resultData);
- assertEquals(resultBody, parsedJsonAsString);
- } catch (ParseException | JsonProcessingException e) {
- e.printStackTrace();
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+ String resultBody = "{\"name\":\"this is a string with a ? \",\"email\":\"[email protected]\"}";
+ assertEquals(resultBody, new String(bodyBytes));
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
}
})
.verifyComplete();
@@ -1021,7 +1252,7 @@ public void testGetDuplicateHeadersAndParams() {
Set<String> expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("myHeader1");
expectedDuplicateHeaders.add("myHeader2");
- assertTrue(expectedDuplicateHeaders.equals(duplicateHeadersWithDsConfigOnly.get(DATASOURCE_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateHeaders, duplicateHeadersWithDsConfigOnly.get(DATASOURCE_CONFIG_ONLY));
/* Test duplicate query params in datasource configuration only */
Map<DUPLICATE_ATTRIBUTE_LOCATION, Set<String>> duplicateParamsWithDsConfigOnly =
@@ -1032,7 +1263,7 @@ public void testGetDuplicateHeadersAndParams() {
Set<String> expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("myParam1");
expectedDuplicateParams.add("myParam2");
- assertTrue(expectedDuplicateParams.equals(duplicateParamsWithDsConfigOnly.get(DATASOURCE_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateParams, duplicateParamsWithDsConfigOnly.get(DATASOURCE_CONFIG_ONLY));
/* Test duplicate headers in datasource + action configuration */
Map<DUPLICATE_ATTRIBUTE_LOCATION, Set<String>> allDuplicateHeaders =
@@ -1042,19 +1273,19 @@ public void testGetDuplicateHeadersAndParams() {
expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("myHeader1");
expectedDuplicateHeaders.add("myHeader2");
- assertTrue(expectedDuplicateHeaders.equals(allDuplicateHeaders.get(DATASOURCE_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateHeaders, allDuplicateHeaders.get(DATASOURCE_CONFIG_ONLY));
// Header duplicates in action config only
expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("myHeader4");
expectedDuplicateHeaders.add("myHeader4");
- assertTrue(expectedDuplicateHeaders.equals(allDuplicateHeaders.get(ACTION_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateHeaders, allDuplicateHeaders.get(ACTION_CONFIG_ONLY));
// Header duplicates with one instance in action and another in datasource config
expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("myHeader3");
expectedDuplicateHeaders.add("apiKey");
- assertTrue(expectedDuplicateHeaders.equals(allDuplicateHeaders.get(DATASOURCE_AND_ACTION_CONFIG)));
+ assertEquals(expectedDuplicateHeaders, allDuplicateHeaders.get(DATASOURCE_AND_ACTION_CONFIG));
/* Test duplicate query params in action + datasource config */
Map<DUPLICATE_ATTRIBUTE_LOCATION, Set<String>> allDuplicateParams =
@@ -1065,17 +1296,17 @@ public void testGetDuplicateHeadersAndParams() {
expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("myParam1");
expectedDuplicateParams.add("myParam2");
- assertTrue(expectedDuplicateParams.equals(allDuplicateParams.get(DATASOURCE_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateParams, allDuplicateParams.get(DATASOURCE_CONFIG_ONLY));
// Query param duplicates in action config only
expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("myParam4");
- assertTrue(expectedDuplicateParams.equals(allDuplicateParams.get(ACTION_CONFIG_ONLY)));
+ assertEquals(expectedDuplicateParams, allDuplicateParams.get(ACTION_CONFIG_ONLY));
// Query param duplicates in action + datasource config
expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("myParam3");
- assertTrue(expectedDuplicateParams.equals(allDuplicateParams.get(DATASOURCE_AND_ACTION_CONFIG)));
+ assertEquals(expectedDuplicateParams, allDuplicateParams.get(DATASOURCE_AND_ACTION_CONFIG));
}
@Test
@@ -1108,7 +1339,7 @@ public void testGetDuplicateHeadersWithOAuth() {
// Header duplicates with one instance in action and another in datasource config
HashSet<String> expectedDuplicateHeaders = new HashSet<>();
expectedDuplicateHeaders.add("Authorization");
- assertTrue(expectedDuplicateHeaders.equals(allDuplicateHeaders.get(DATASOURCE_AND_ACTION_CONFIG)));
+ assertEquals(expectedDuplicateHeaders, allDuplicateHeaders.get(DATASOURCE_AND_ACTION_CONFIG));
}
@Test
@@ -1143,7 +1374,7 @@ public void testGetDuplicateParamsWithOAuth() {
// Param duplicates with one instance in action and another in datasource config
HashSet<String> expectedDuplicateParams = new HashSet<>();
expectedDuplicateParams.add("access_token");
- assertTrue(expectedDuplicateParams.equals(allDuplicateParams.get(DATASOURCE_AND_ACTION_CONFIG)));
+ assertEquals(expectedDuplicateParams, allDuplicateParams.get(DATASOURCE_AND_ACTION_CONFIG));
}
/**
@@ -1181,7 +1412,7 @@ public void testHintMessageForDuplicateHeadersAndParamsWithDatasourceConfigOnly(
" because this datasource has duplicate definition(s) for header(s): [myHeader1]. Please " +
"remove the duplicate definition(s) to resolve this warning. Please note that some of the" +
" authentication mechanisms also implicitly define a header.");
- assertTrue(expectedDatasourceHintMessages.equals(datasourceHintMessages));
+ assertEquals(expectedDatasourceHintMessages, datasourceHintMessages);
Set<String> actionHintMessages = tuple.getT2();
Set<String> expectedActionHintMessages = new HashSet<>();
@@ -1192,7 +1423,7 @@ public void testHintMessageForDuplicateHeadersAndParamsWithDatasourceConfigOnly(
expectedActionHintMessages.add("Your API query may not run as expected because its datasource has" +
" duplicate definition(s) for header(s): [myHeader1]. Please remove the duplicate " +
"definition(s) from the datasource to resolve this warning.");
- assertTrue(expectedActionHintMessages.equals(actionHintMessages));
+ assertEquals(expectedActionHintMessages, actionHintMessages);
})
.verifyComplete();
}
@@ -1234,7 +1465,7 @@ public void testHintMessageForDuplicateHeadersAndParamsWithActionConfigOnly() {
expectedActionHintMessages.add("Your API query may not run as expected because it has duplicate " +
"definition(s) for param(s): [myParam1]. Please remove the duplicate definition(s) from " +
"the 'Params' tab to resolve this warning.");
- assertTrue(expectedActionHintMessages.equals(actionHintMessages));
+ assertEquals(expectedActionHintMessages, actionHintMessages);
})
.verifyComplete();
}
@@ -1272,7 +1503,7 @@ public void testHintMessageForDuplicateHeaderWithOneInstanceEachInActionAndDsCon
" the 'Headers' section of either the API query or the datasource. Please note that some " +
"of the authentication mechanisms also implicitly define a header.");
- assertTrue(expectedActionHintMessages.equals(actionHintMessages));
+ assertEquals(expectedActionHintMessages, actionHintMessages);
})
.verifyComplete();
}
@@ -1310,7 +1541,7 @@ public void testHintMessageForDuplicateParamWithOneInstanceEachInActionAndDsConf
" the 'Params' section of either the API query or the datasource. Please note that some " +
"of the authentication mechanisms also implicitly define a param.");
- assertTrue(expectedActionHintMessages.equals(actionHintMessages));
+ assertEquals(expectedActionHintMessages, actionHintMessages);
})
.verifyComplete();
}
@@ -1318,7 +1549,13 @@ public void testHintMessageForDuplicateParamWithOneInstanceEachInActionAndDsConf
@Test
public void testQueryParamsInDatasource() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(new Property("content-type", "application/json")));
@@ -1338,9 +1575,23 @@ public void testQueryParamsInDatasource() {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- String expected_url = "\"https://postman-echo.com/post?query_key=query+val\"";
- JsonNode url = ((ObjectNode) result.getBody()).get("url");
- assertEquals(expected_url, url.toString());
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals(requestBody, new String(bodyBytes));
+
+ String requestPath = recordedRequest.getPath();
+ assertEquals("/?query_key=query+val", requestPath);
+
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
})
.verifyComplete();
}
@@ -1399,14 +1650,14 @@ public void testDenyInstanceMetadataGcp() {
@Test
public void testDenyInstanceMetadataAwsWithRedirect() throws IOException {
// Generate a mock response which redirects to the invalid host
- MockWebServer mockWebServer = new MockWebServer();
+ mockEndpoint = new MockWebServer();
MockResponse mockRedirectResponse = new MockResponse()
.setResponseCode(301)
.addHeader("Location", "http://169.254.169.254.nip.io/latest/meta-data");
- mockWebServer.enqueue(mockRedirectResponse);
- mockWebServer.start();
+ mockEndpoint.enqueue(mockRedirectResponse);
+ mockEndpoint.start();
- HttpUrl mockHttpUrl = mockWebServer.url("/mock/redirect");
+ HttpUrl mockHttpUrl = mockEndpoint.url("/mock/redirect");
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
dsConfig.setUrl(mockHttpUrl.toString());
@@ -1452,8 +1703,32 @@ public void testGetApiWithBody() {
@Test
public void testAPIResponseEncodedInGzipFormat() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("http://postman-echo.com/gzip");
-
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ Function<String, byte[]> compressor = (data) -> {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream(data.length());
+ GZIPOutputStream gzip;
+ try {
+ gzip = new GZIPOutputStream(bos);
+
+ gzip.write(data.getBytes());
+ gzip.close();
+ byte[] compressed = bos.toByteArray();
+ bos.close();
+ return compressed;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ };
+ String body = "GzippedBody";
+
+ try (Buffer buffer = new Buffer()) {
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody(buffer.write(compressor.apply(body)))
+ .addHeader("Content-Encoding", "gzip"));
+ }
ActionConfiguration actionConfig = new ActionConfiguration();
actionConfig.setHeaders(List.of(
new Property("content-type", "application/json")
@@ -1464,13 +1739,9 @@ public void testAPIResponseEncodedInGzipFormat() {
StepVerifier.create(resultMono)
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
- assertNotNull(result.getRequest().getBody());
- final Iterator<Map.Entry<String, JsonNode>> fields = ((ObjectNode) result.getRequest().getHeaders()).fields();
- fields.forEachRemaining(field -> {
- if ("gzipped".equalsIgnoreCase(field.getKey())) {
- assertEquals("true", field.getValue().get(0).asText());
- }
- });
+ assertNotNull(result.getBody());
+
+ assertEquals(body, result.getBody());
})
.verifyComplete();
}
@@ -1478,7 +1749,13 @@ public void testAPIResponseEncodedInGzipFormat() {
@Test
public void testNumericStringHavingLeadingZero() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
final List<Property> headers = List.of(new Property("content-type", "application/json"));
@@ -1500,10 +1777,23 @@ public void testNumericStringHavingLeadingZero() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- JsonNode data = ((ObjectNode) result.getBody()).get("data");
- assertEquals(requestBody.replace("{{phoneNumber.text}}", param.getValue()), data.toString());
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals(requestBody.replace("{{phoneNumber.text}}", param.getValue()), new String(bodyBytes));
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
+
final ActionExecutionRequest request = result.getRequest();
- assertEquals("https://postman-echo.com/post", request.getUrl());
+ assertEquals(baseUrl, request.getUrl());
assertEquals(HttpMethod.POST, request.getHttpMethod());
final Iterator<Map.Entry<String, JsonNode>> fields = ((ObjectNode) result.getRequest().getHeaders()).fields();
fields.forEachRemaining(field -> {
@@ -1518,7 +1808,13 @@ public void testNumericStringHavingLeadingZero() {
@Test
public void whenBindingFoundWithoutValue_doNotReplaceWithNull() {
DatasourceConfiguration dsConfig = new DatasourceConfiguration();
- dsConfig.setUrl("https://postman-echo.com/post");
+ String baseUrl = String.format("http://%s:%s", mockEndpoint.getHostName(), mockEndpoint.getPort());
+ dsConfig.setUrl(baseUrl);
+
+ mockEndpoint
+ .enqueue(new MockResponse()
+ .setBody("{}")
+ .addHeader("Content-Type", "application/json"));
ActionConfiguration actionConfig = new ActionConfiguration();
final List<Property> headers = List.of(new Property("content-type", "application/json"));
@@ -1540,10 +1836,23 @@ public void whenBindingFoundWithoutValue_doNotReplaceWithNull() {
.assertNext(result -> {
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
- JsonNode data = ((ObjectNode) result.getBody()).get("data");
- assertEquals(requestBody.replace("{{Input1.text}}", param.getValue()), data.toString());
+
+ try {
+ final RecordedRequest recordedRequest = mockEndpoint.takeRequest(30, TimeUnit.SECONDS);
+ assert recordedRequest != null;
+ final Buffer recordedRequestBody = recordedRequest.getBody();
+ byte[] bodyBytes = new byte[(int) recordedRequestBody.size()];
+
+ recordedRequestBody.readFully(bodyBytes);
+ recordedRequestBody.close();
+
+ assertEquals(requestBody.replace("{{Input1.text}}", param.getValue()), new String(bodyBytes));
+ } catch (EOFException | InterruptedException e) {
+ assert false : e.getMessage();
+ }
+
final ActionExecutionRequest request = result.getRequest();
- assertEquals("https://postman-echo.com/post", request.getUrl());
+ assertEquals(baseUrl, request.getUrl());
assertEquals(HttpMethod.POST, request.getHttpMethod());
final Iterator<Map.Entry<String, JsonNode>> fields = ((ObjectNode) result.getRequest().getHeaders()).fields();
fields.forEachRemaining(field -> {
@@ -1557,11 +1866,10 @@ public void whenBindingFoundWithoutValue_doNotReplaceWithNull() {
@Test
public void verifyUniquenessOfRestApiPluginErrorCode() {
- assert (Arrays.stream(RestApiPluginError.values()).map(RestApiPluginError::getAppErrorCode).distinct().count() == RestApiPluginError.values().length);
+ assertEquals(RestApiPluginError.values().length, Arrays.stream(RestApiPluginError.values()).map(RestApiPluginError::getAppErrorCode).distinct().count());
- assert (Arrays.stream(RestApiPluginError.values()).map(RestApiPluginError::getAppErrorCode)
- .filter(appErrorCode-> appErrorCode.length() != 11 || !appErrorCode.startsWith("PE-RST"))
- .collect(Collectors.toList()).size() == 0);
+ assertEquals(0, Arrays.stream(RestApiPluginError.values()).map(RestApiPluginError::getAppErrorCode)
+ .filter(appErrorCode -> appErrorCode.length() != 11 || !appErrorCode.startsWith("PE-RST")).count());
}
}
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CurlImporterServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CurlImporterServiceTest.java
index 2dc2605f9c86..7ce1819050a9 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CurlImporterServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/CurlImporterServiceTest.java
@@ -89,51 +89,51 @@ public void setup() {
@Test
public void lexerTests() {
- assertThat(curlImporterService.lex("curl http://httpbin.org/get"))
- .isEqualTo(List.of("curl", "http://httpbin.org/get"));
- assertThat(curlImporterService.lex("curl -H 'X-Something: something else' http://httpbin.org/get"))
- .isEqualTo(List.of("curl", "-H", "X-Something: something else", "http://httpbin.org/get"));
- assertThat(curlImporterService.lex("curl -H \"X-Something: something else\" http://httpbin.org/get"))
- .isEqualTo(List.of("curl", "-H", "X-Something: something else", "http://httpbin.org/get"));
- assertThat(curlImporterService.lex("curl -H X-Something:\\ something\\ else http://httpbin.org/get"))
- .isEqualTo(List.of("curl", "-H", "X-Something: something else", "http://httpbin.org/get"));
-
- assertThat(curlImporterService.lex("curl -H \"X-Something: something \\\"quoted\\\" else\" http://httpbin.org/get"))
- .isEqualTo(List.of("curl", "-H", "X-Something: something \"quoted\" else", "http://httpbin.org/get"));
- assertThat(curlImporterService.lex("curl -H \"X-Something: something \\\\\\\"quoted\\\" else\" http://httpbin.org/get"))
- .isEqualTo(List.of("curl", "-H", "X-Something: something \\\"quoted\" else", "http://httpbin.org/get"));
+ assertThat(curlImporterService.lex("curl http://example.org/get"))
+ .isEqualTo(List.of("curl", "http://example.org/get"));
+ assertThat(curlImporterService.lex("curl -H 'X-Something: something else' http://example.org/get"))
+ .isEqualTo(List.of("curl", "-H", "X-Something: something else", "http://example.org/get"));
+ assertThat(curlImporterService.lex("curl -H \"X-Something: something else\" http://example.org/get"))
+ .isEqualTo(List.of("curl", "-H", "X-Something: something else", "http://example.org/get"));
+ assertThat(curlImporterService.lex("curl -H X-Something:\\ something\\ else http://example.org/get"))
+ .isEqualTo(List.of("curl", "-H", "X-Something: something else", "http://example.org/get"));
+
+ assertThat(curlImporterService.lex("curl -H \"X-Something: something \\\"quoted\\\" else\" http://example.org/get"))
+ .isEqualTo(List.of("curl", "-H", "X-Something: something \"quoted\" else", "http://example.org/get"));
+ assertThat(curlImporterService.lex("curl -H \"X-Something: something \\\\\\\"quoted\\\" else\" http://example.org/get"))
+ .isEqualTo(List.of("curl", "-H", "X-Something: something \\\"quoted\" else", "http://example.org/get"));
// The following tests are meant for cases when any of the components have nested quotes within them
// In this example, the header argument is surrounded by single quotes, the value for it is surrounded by double quotes,
// and the contents of the value has two single quotes
- assertThat(curlImporterService.lex("curl -H 'X-Something: \"something '\\''quoted with nesting'\\'' else\"' http://httpbin.org/get"))
- .isEqualTo(List.of("curl", "-H", "X-Something: \"something 'quoted with nesting' else\"", "http://httpbin.org/get"));
+ assertThat(curlImporterService.lex("curl -H 'X-Something: \"something '\\''quoted with nesting'\\'' else\"' http://example.org/get"))
+ .isEqualTo(List.of("curl", "-H", "X-Something: \"something 'quoted with nesting' else\"", "http://example.org/get"));
// In this example, the header argument is surrounded by single quotes, the value for it is surrounded by double quotes,
// and the contents of the value has one single quote
- assertThat(curlImporterService.lex("curl -H 'X-Something: \"something '\\''ed with nesting else\"' http://httpbin.org/get"))
- .isEqualTo(List.of("curl", "-H", "X-Something: \"something 'ed with nesting else\"", "http://httpbin.org/get"));
+ assertThat(curlImporterService.lex("curl -H 'X-Something: \"something '\\''ed with nesting else\"' http://example.org/get"))
+ .isEqualTo(List.of("curl", "-H", "X-Something: \"something 'ed with nesting else\"", "http://example.org/get"));
// In the following test, we're simulating a subshell. This subshell call is outside of quotes
try {
- curlImporterService.lex("curl -H 'X-Something: \"something '$(echo test)' quoted with nesting else\"' http://httpbin.org/get");
+ curlImporterService.lex("curl -H 'X-Something: \"something '$(echo test)' quoted with nesting else\"' http://example.org/get");
} catch (Exception e) {
assertThat(e).isInstanceOf(AppsmithException.class);
assertThat(e.getMessage()).isEqualTo(AppsmithError.GENERIC_BAD_REQUEST.getMessage("Please do not try to invoke a subshell in the cURL"));
}
try {
- curlImporterService.lex("curl -H 'X-Something: \"something '`echo test`' quoted with nesting else\"' http://httpbin.org/get");
+ curlImporterService.lex("curl -H 'X-Something: \"something '`echo test`' quoted with nesting else\"' http://example.org/get");
} catch (Exception e) {
assertThat(e).isInstanceOf(AppsmithException.class);
assertThat(e.getMessage()).isEqualTo(AppsmithError.GENERIC_BAD_REQUEST.getMessage("Please do not try to invoke a subshell in the cURL"));
}
// In the following test, we're simulating a subshell. Subshells can be inside double-quoted strings as well
try {
- curlImporterService.lex("curl -H \"X-Something: 'something $(echo test) quoted with nesting else'\" http://httpbin.org/get");
+ curlImporterService.lex("curl -H \"X-Something: 'something $(echo test) quoted with nesting else'\" http://example.org/get");
} catch (Exception e) {
assertThat(e).isInstanceOf(AppsmithException.class);
assertThat(e.getMessage()).isEqualTo(AppsmithError.GENERIC_BAD_REQUEST.getMessage("Please do not try to invoke a subshell in the cURL"));
}
try {
- curlImporterService.lex("curl -H \"X-Something: 'something `echo test` quoted with nesting else'\" http://httpbin.org/get");
+ curlImporterService.lex("curl -H \"X-Something: 'something `echo test` quoted with nesting else'\" http://example.org/get");
} catch (Exception e) {
assertThat(e).isInstanceOf(AppsmithException.class);
assertThat(e.getMessage()).isEqualTo(AppsmithError.GENERIC_BAD_REQUEST.getMessage("Please do not try to invoke a subshell in the cURL"));
@@ -760,9 +760,9 @@ public void parseWithJson() throws AppsmithException {
@Test
public void parseWithSpacedHeader() throws AppsmithException {
- ActionDTO action = curlImporterService.curlToAction("curl -H \"Accept:application/json\" http://httpbin.org/get");
+ ActionDTO action = curlImporterService.curlToAction("curl -H \"Accept:application/json\" http://example.org/get");
assertMethod(action, HttpMethod.GET);
- assertUrl(action, "http://httpbin.org");
+ assertUrl(action, "http://example.org");
assertPath(action, "/get");
assertHeaders(action, new Property("Accept", "application/json"));
assertEmptyBody(action);
@@ -797,9 +797,9 @@ public void parseMultipleData() throws AppsmithException {
public void parseMultiFormData() throws AppsmithException {
// In the curl command, we test for a combination of --form and -F
// Also some values are double-quoted while some aren't. This tests a permutation of all such fields
- ActionDTO action = curlImporterService.curlToAction("curl --request POST 'http://httpbin.org/post' -F 'somekey=value' --form 'anotherKey=\"anotherValue\"'");
+ ActionDTO action = curlImporterService.curlToAction("curl --request POST 'http://example.org/post' -F 'somekey=value' --form 'anotherKey=\"anotherValue\"'");
assertMethod(action, HttpMethod.POST);
- assertUrl(action, "http://httpbin.org");
+ assertUrl(action, "http://example.org");
assertPath(action, "/post");
assertHeaders(action, new Property("Content-Type", "multipart/form-data"));
assertEmptyBody(action);
@@ -812,9 +812,9 @@ public void parseMultiFormData() throws AppsmithException {
@Test
public void dontEatBackslashesInSingleQuotes() throws AppsmithException {
- ActionDTO action = curlImporterService.curlToAction("curl http://httpbin.org/post -d 'a\\n'");
+ ActionDTO action = curlImporterService.curlToAction("curl http://example.org/post -d 'a\\n'");
assertMethod(action, HttpMethod.POST);
- assertUrl(action, "http://httpbin.org");
+ assertUrl(action, "http://example.org");
assertPath(action, "/post");
assertBody(action, "a\\n");
assertEmptyBodyFormData(action);
@@ -822,14 +822,14 @@ public void dontEatBackslashesInSingleQuotes() throws AppsmithException {
@Test
public void importInvalidMethod() {
- assertThatThrownBy(() -> curlImporterService.curlToAction("curl -X incorrect-charactèrs http://httpbin.org/get"))
+ assertThatThrownBy(() -> curlImporterService.curlToAction("curl -X incorrect-charactèrs http://example.org/get"))
.isInstanceOf(AppsmithException.class)
.matches(err -> ((AppsmithException) err).getError() == AppsmithError.INVALID_CURL_METHOD);
}
@Test
public void importInvalidHeader() {
- assertThatThrownBy(() -> curlImporterService.curlToAction("curl -H x-custom http://httpbin.org/headers"))
+ assertThatThrownBy(() -> curlImporterService.curlToAction("curl -H x-custom http://example.org/headers"))
.isInstanceOf(AppsmithException.class)
.matches(err -> ((AppsmithException) err).getError() == AppsmithError.INVALID_CURL_HEADER);
}
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ExamplesWorkspaceClonerTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ExamplesWorkspaceClonerTests.java
index 8d4f07413b0c..2e727eb438c7 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ExamplesWorkspaceClonerTests.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ExamplesWorkspaceClonerTests.java
@@ -450,7 +450,7 @@ public void cloneWorkspaceWithOnlyDatasources() {
ds1.setPluginId(pluginId);
final DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
ds1.setDatasourceConfiguration(datasourceConfiguration);
- datasourceConfiguration.setUrl("http://httpbin.org/get");
+ datasourceConfiguration.setUrl("http://example.org/get");
datasourceConfiguration.setHeaders(List.of(
new Property("X-Answer", "42")
));
@@ -505,7 +505,7 @@ public void cloneWorkspaceWithOnlyDatasourcesSpecifiedExplicitly() {
ds1.setPluginId(installedPlugin.getId());
final DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
ds1.setDatasourceConfiguration(datasourceConfiguration);
- datasourceConfiguration.setUrl("http://httpbin.org/get");
+ datasourceConfiguration.setUrl("http://example.org/get");
datasourceConfiguration.setHeaders(List.of(
new Property("X-Answer", "42")
));
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java
index 2a7dedfbb683..d29c1a6b5f67 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java
@@ -215,7 +215,7 @@ public void setup() {
ds1.setWorkspaceId(workspaceId);
ds1.setPluginId(installedPlugin.getId());
final DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
- datasourceConfiguration.setUrl("http://httpbin.org/get");
+ datasourceConfiguration.setUrl("http://example.org/get");
datasourceConfiguration.setHeaders(List.of(
new Property("X-Answer", "42")
));
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceV2Tests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceV2Tests.java
index a2a4037532bd..305be775849b 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceV2Tests.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceV2Tests.java
@@ -223,7 +223,7 @@ public void setup() {
ds1.setWorkspaceId(workspaceId);
ds1.setPluginId(installedPlugin.getId());
final DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
- datasourceConfiguration.setUrl("http://httpbin.org/get");
+ datasourceConfiguration.setUrl("http://example.org/get");
datasourceConfiguration.setHeaders(List.of(
new Property("X-Answer", "42")
));
diff --git a/app/server/appsmith-server/src/test/resources/application-test.properties b/app/server/appsmith-server/src/test/resources/application-test.properties
index 0777b1f8d651..e78a9816ac73 100644
--- a/app/server/appsmith-server/src/test/resources/application-test.properties
+++ b/app/server/appsmith-server/src/test/resources/application-test.properties
@@ -1,2 +1,3 @@
# embedded mongo DB version which is used during junit tests
-de.flapdoodle.mongodb.embedded.version=5.0.5
\ No newline at end of file
+de.flapdoodle.mongodb.embedded.version=5.0.5
+logging.level.root=error
\ No newline at end of file
|
251ad6097b3298017ae216a96f2b9ee52ec56816
|
2022-04-27 23:16:24
|
Ankita Kinger
|
chore: Add analytic events on Authentication page (#13384)
| false
|
Add analytic events on Authentication page (#13384)
|
chore
|
diff --git a/app/client/src/ce/pages/AdminSettings/config/authentication/AuthPage.tsx b/app/client/src/ce/pages/AdminSettings/config/authentication/AuthPage.tsx
index 13667db915a7..1f37dd8916c4 100644
--- a/app/client/src/ce/pages/AdminSettings/config/authentication/AuthPage.tsx
+++ b/app/client/src/ce/pages/AdminSettings/config/authentication/AuthPage.tsx
@@ -23,6 +23,7 @@ import Icon from "components/ads/Icon";
import TooltipComponent from "components/ads/Tooltip";
import { Position } from "@blueprintjs/core";
import { adminSettingsCategoryUrl } from "RouteBuilder";
+import AnalyticsUtil from "utils/AnalyticsUtil";
const { intercomAppID } = getAppsmithConfigs();
@@ -149,6 +150,30 @@ export function AuthPage({ authMethods }: { authMethods: AuthMethodType[] }) {
}
};
+ const onClickHandler = (method: AuthMethodType) => {
+ if (!method.needsUpgrade || method.isConnected) {
+ AnalyticsUtil.logEvent(
+ method.isConnected
+ ? "ADMIN_SETTINGS_EDIT_AUTH_METHOD"
+ : "ADMIN_SETTINGS_ENABLE_AUTH_METHOD",
+ {
+ method: method.label,
+ },
+ );
+ history.push(
+ adminSettingsCategoryUrl({
+ category: SettingCategories.AUTHENTICATION,
+ subCategory: method.category,
+ }),
+ );
+ } else {
+ AnalyticsUtil.logEvent("ADMIN_SETTINGS_UPGRADE_AUTH_METHOD", {
+ method: method.label,
+ });
+ triggerIntercom(method.label);
+ }
+ };
+
return (
<Wrapper>
<SettingsFormWrapper>
@@ -211,16 +236,7 @@ export function AuthPage({ authMethods }: { authMethods: AuthMethodType[] }) {
: method.category
}`}
data-cy="btn-auth-account"
- onClick={() =>
- !method.needsUpgrade || method.isConnected
- ? history.push(
- adminSettingsCategoryUrl({
- category: SettingCategories.AUTHENTICATION,
- subCategory: method.category,
- }),
- )
- : triggerIntercom(method.label)
- }
+ onClick={() => onClickHandler(method)}
text={createMessage(
method.isConnected
? EDIT
diff --git a/app/client/src/ce/pages/AdminSettings/config/types.ts b/app/client/src/ce/pages/AdminSettings/config/types.ts
index b3464eae482a..dc5c2ded7b73 100644
--- a/app/client/src/ce/pages/AdminSettings/config/types.ts
+++ b/app/client/src/ce/pages/AdminSettings/config/types.ts
@@ -13,6 +13,7 @@ export enum SettingTypes {
UNEDITABLEFIELD = "UNEDITABLEFIELD",
ACCORDION = "ACCORDION",
TAGINPUT = "TAGINPUT",
+ DROPDOWN = "DROPDOWN",
}
export enum SettingSubtype {
@@ -52,6 +53,7 @@ export interface Setting {
isRequired?: boolean;
formName?: string;
fieldName?: string;
+ dropdownOptions?: Array<{ id: string; value: string; label?: string }>;
}
export interface Category {
diff --git a/app/client/src/components/ads/formFields/SelectField.tsx b/app/client/src/components/ads/formFields/SelectField.tsx
new file mode 100644
index 000000000000..4c6694cb5b8e
--- /dev/null
+++ b/app/client/src/components/ads/formFields/SelectField.tsx
@@ -0,0 +1,77 @@
+import React, { useEffect, useState } from "react";
+import {
+ Field,
+ WrappedFieldMetaProps,
+ WrappedFieldInputProps,
+} from "redux-form";
+import Dropdown from "components/ads/Dropdown";
+
+type DropdownWrapperProps = {
+ placeholder: string;
+ input?: {
+ value?: string;
+ onChange?: (value?: string) => void;
+ };
+ options: Array<{ id: string; value: string; label?: string }>;
+ fillOptions?: boolean;
+};
+
+function DropdownWrapper(props: DropdownWrapperProps) {
+ const [selectedOption, setSelectedOption] = useState({
+ value: props.placeholder,
+ });
+ const onSelectHandler = (value?: string) => {
+ props.input && props.input.onChange && props.input.onChange(value);
+ };
+
+ useEffect(() => {
+ if (props.input && props.input.value) {
+ setSelectedOption({ value: props.input.value });
+ } else if (props.placeholder) {
+ setSelectedOption({ value: props.placeholder });
+ }
+ }, [props.input, props.placeholder]);
+
+ return (
+ <Dropdown
+ fillOptions={props.fillOptions}
+ onSelect={onSelectHandler}
+ options={props.options}
+ selected={selectedOption}
+ />
+ );
+}
+
+const renderComponent = (
+ componentProps: SelectFieldProps & {
+ meta: Partial<WrappedFieldMetaProps>;
+ input: Partial<WrappedFieldInputProps>;
+ },
+) => {
+ return <DropdownWrapper {...componentProps} />;
+};
+
+type SelectFieldProps = {
+ name: string;
+ placeholder: string;
+ options: Array<{ id: string; value: string; label?: string }>;
+ size?: "large" | "small";
+ outline?: boolean;
+ fillOptions?: boolean;
+};
+
+export function SelectField(props: SelectFieldProps) {
+ return (
+ <Field
+ component={renderComponent}
+ fillOptions={props.fillOptions}
+ name={props.name}
+ options={props.options}
+ outline={props.outline}
+ placeholder={props.placeholder}
+ size={props.size}
+ />
+ );
+}
+
+export default SelectField;
diff --git a/app/client/src/pages/Settings/FormGroup/Common.tsx b/app/client/src/pages/Settings/FormGroup/Common.tsx
index b595c6faa26a..c4adfa199bed 100644
--- a/app/client/src/pages/Settings/FormGroup/Common.tsx
+++ b/app/client/src/pages/Settings/FormGroup/Common.tsx
@@ -20,16 +20,15 @@ const StyledIcon = styled(Icon)`
export const StyledFormGroup = styled.div`
width: 40rem;
margin-bottom: ${(props) => props.theme.spaces[7]}px;
- & span.bp3-popover-target {
- display: inline-block;
- background: ${(props) => props.theme.colors.menuItem.normalIcon};
- border-radius: ${(props) => props.theme.radii[2]}px;
- width: 14px;
- padding: 3px 3px;
- position: relative;
- top: -2px;
- left: 6px;
- cursor: default;
+ &.t--admin-settings-dropdown {
+ div {
+ width: 100%;
+ &:hover {
+ &:hover {
+ background-color: ${(props) => props.theme.colors.textInput.hover.bg};
+ }
+ }
+ }
}
& svg:hover {
cursor: default;
diff --git a/app/client/src/pages/Settings/FormGroup/Dropdown.tsx b/app/client/src/pages/Settings/FormGroup/Dropdown.tsx
new file mode 100644
index 000000000000..d05293ec7c9c
--- /dev/null
+++ b/app/client/src/pages/Settings/FormGroup/Dropdown.tsx
@@ -0,0 +1,28 @@
+import React from "react";
+import { FormGroup, SettingComponentProps } from "./Common";
+import SelectField from "components/ads/formFields/SelectField";
+
+export default function DropDown(
+ props: {
+ dropdownOptions: Array<{ id: string; value: string; label?: string }>;
+ } & SettingComponentProps,
+) {
+ const { dropdownOptions, setting } = props;
+
+ return (
+ <FormGroup
+ className={`t--admin-settings-dropdown t--admin-settings-${setting.name ||
+ setting.id}`}
+ setting={setting}
+ >
+ <SelectField
+ fillOptions
+ name={setting.id}
+ options={dropdownOptions}
+ outline={false}
+ placeholder="Select an option"
+ size="large"
+ />
+ </FormGroup>
+ );
+}
diff --git a/app/client/src/pages/Settings/FormGroup/group.tsx b/app/client/src/pages/Settings/FormGroup/group.tsx
index 0c8d0eca1330..b7137f183ac1 100644
--- a/app/client/src/pages/Settings/FormGroup/group.tsx
+++ b/app/client/src/pages/Settings/FormGroup/group.tsx
@@ -20,6 +20,7 @@ import { Callout } from "components/ads/CalloutV2";
import { CopyUrlReduxForm } from "components/ads/formFields/CopyUrlForm";
import Accordion from "./Accordion";
import TagInputField from "./TagInputField";
+import Dropdown from "./Dropdown";
import { Classes } from "@blueprintjs/core";
import { Colors } from "constants/Colors";
@@ -228,6 +229,21 @@ export default function Group({
/>
</div>
);
+ case SettingTypes.DROPDOWN:
+ return (
+ <div
+ className={setting.isHidden ? "hide" : ""}
+ data-testid="admin-settings-dropdown"
+ key={setting.name || setting.id}
+ >
+ {setting.dropdownOptions && (
+ <Dropdown
+ dropdownOptions={setting.dropdownOptions}
+ setting={setting}
+ />
+ )}
+ </div>
+ );
}
})}
</GroupBody>
diff --git a/app/client/src/pages/Settings/SettingsForm.tsx b/app/client/src/pages/Settings/SettingsForm.tsx
index d8e6deeb2524..39e39edbea7e 100644
--- a/app/client/src/pages/Settings/SettingsForm.tsx
+++ b/app/client/src/pages/Settings/SettingsForm.tsx
@@ -35,6 +35,7 @@ import {
connectedMethods,
saveAllowed,
} from "@appsmith/utils/adminSettingsHelpers";
+import AnalyticsUtil from "utils/AnalyticsUtil";
const Wrapper = styled.div`
flex-basis: calc(100% - ${(props) => props.theme.homePage.leftPane.width}px);
@@ -105,11 +106,20 @@ export function SettingsForm(
const onSave = () => {
if (checkMandatoryFileds()) {
if (saveAllowed(props.settings)) {
+ AnalyticsUtil.logEvent("ADMIN_SETTINGS_SAVE", {
+ method: pageTitle,
+ });
dispatch(saveSettings(props.settings));
} else {
+ AnalyticsUtil.logEvent("ADMIN_SETTINGS_ERROR", {
+ error: createMessage(DISCONNECT_AUTH_ERROR),
+ });
saveBlocked();
}
} else {
+ AnalyticsUtil.logEvent("ADMIN_SETTINGS_ERROR", {
+ error: createMessage(MANDATORY_FIELDS_ERROR),
+ });
Toaster.show({
text: createMessage(MANDATORY_FIELDS_ERROR),
variant: Variant.danger,
@@ -176,6 +186,9 @@ export function SettingsForm(
}
});
dispatch(saveSettings(updatedSettings));
+ AnalyticsUtil.logEvent("ADMIN_SETTINGS_DISCONNECT_AUTH_METHOD", {
+ method: pageTitle,
+ });
} else {
saveBlocked();
}
diff --git a/app/client/src/utils/AnalyticsUtil.tsx b/app/client/src/utils/AnalyticsUtil.tsx
index e35206329a5c..ef3e2861e627 100644
--- a/app/client/src/utils/AnalyticsUtil.tsx
+++ b/app/client/src/utils/AnalyticsUtil.tsx
@@ -199,6 +199,12 @@ export type EventName =
| "GS_REGENERATE_SSH_KEY_CONFIRM_CLICK"
| "GS_REGENERATE_SSH_KEY_MORE_CLICK"
| "GS_SWITCH_BRANCH"
+ | "ADMIN_SETTINGS_SAVE"
+ | "ADMIN_SETTINGS_ERROR"
+ | "ADMIN_SETTINGS_DISCONNECT_AUTH_METHOD"
+ | "ADMIN_SETTINGS_UPGRADE_AUTH_METHOD"
+ | "ADMIN_SETTINGS_EDIT_AUTH_METHOD"
+ | "ADMIN_SETTINGS_ENABLE_AUTH_METHOD"
| "REFLOW_BETA_FLAG"
| "CONTAINER_JUMP"
| "CONNECT_GIT_CLICK"
|
2fef626dcc3199f5e14a06e4a888a5dc24350553
|
2023-12-27 10:29:33
|
Rahul Barwal
|
feat: adds `see more` to canvas starter templates (#29777)
| false
|
adds `see more` to canvas starter templates (#29777)
|
feat
|
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Templates/TemplatesPage_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Templates/TemplatesPage_spec.ts
index 3e11b09840ed..11912ed87abc 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/Templates/TemplatesPage_spec.ts
+++ b/app/client/cypress/e2e/Regression/ClientSide/Templates/TemplatesPage_spec.ts
@@ -2,7 +2,6 @@ import { agHelper, templates } from "../../../../support/Objects/ObjectsCore";
describe("excludeForAirgap", "Templates page", () => {
it("1. Templates tab should have no impact of 'allowPageImport:true'", () => {
- agHelper.RefreshPage(); //is important for below intercept to go thru!
cy.fixture("Templates/AllowPageImportTemplates.json").then((data) => {
cy.intercept(
{
@@ -15,6 +14,7 @@ describe("excludeForAirgap", "Templates page", () => {
},
).as("fetchAllTemplates");
templates.SwitchToTemplatesTab();
+ agHelper.RefreshPage(); //is important for below intercept to go thru!
cy.wait("@fetchAllTemplates").then(({ request, response }) => {
if (response) {
// in the fixture data we are sending some tempaltes with `allowPageImport: false`
diff --git a/app/client/src/actions/templateActions.ts b/app/client/src/actions/templateActions.ts
index 5fef0c402241..65d27e8ff2d2 100644
--- a/app/client/src/actions/templateActions.ts
+++ b/app/client/src/actions/templateActions.ts
@@ -47,11 +47,15 @@ export const getTemplateInformation = (payload: string) => ({
payload,
});
-export const showTemplatesModal = (payload: boolean) => ({
+export const showTemplatesModal = (payload: { isOpenFromCanvas: boolean }) => ({
type: ReduxActionTypes.SHOW_TEMPLATES_MODAL,
payload,
});
+export const hideTemplatesModal = () => ({
+ type: ReduxActionTypes.HIDE_TEMPLATES_MODAL,
+});
+
export const importTemplateIntoApplication = (
templateId: string,
templateName: string,
diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx
index 5ad2ec0466ba..2cf2d8ebd8d7 100644
--- a/app/client/src/ce/constants/ReduxActionConstants.tsx
+++ b/app/client/src/ce/constants/ReduxActionConstants.tsx
@@ -756,6 +756,7 @@ const ActionTypes = {
RECORD_RECENTLY_ADDED_WIDGET: "RECORD_RECENTLY_ADDED_WIDGET",
REMOVE_FROM_RECENTLY_ADDED_WIDGET: "REMOVE_FROM_RECENTLY_ADDED_WIDGET",
SHOW_TEMPLATES_MODAL: "SHOW_TEMPLATES_MODAL",
+ HIDE_TEMPLATES_MODAL: "HIDE_TEMPLATES_MODAL",
GET_TEMPLATE_FILTERS_INIT: "GET_TEMPLATE_FILTERS_INIT",
GET_TEMPLATE_FILTERS_SUCCESS: "GET_TEMPLATE_FILTERS_SUCCESS",
INIT_TRIGGER_VALUES: "INIT_TRIGGER_VALUES",
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index a0c2d6829b2c..2cb52bd5bd81 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -1735,6 +1735,7 @@ export const TEMPLATE_CARD_TITLE = () => "Start from a template";
export const TEMPLATE_CARD_DESCRIPTION = () =>
"Create app from template by selecting pages";
export const FILTER_SELECTALL = () => "Select all";
+export const FILTER_SELECT_PAGE = () => "Add selected page";
export const FILTER_SELECT_PAGES = () => "Add selected pages";
export const FORKING_TEMPLATE = () => "Setting up the template";
export const FETCHING_TEMPLATES = () => "Loading template details";
@@ -2252,6 +2253,7 @@ export const STARTER_TEMPLATE_PAGE_LAYOUTS = {
or: () => "or",
dragAndDrop: () => "Drag and Drop Widgets",
importLoadingText: () => "Importing template",
+ seeMoreText: () => "See more",
};
// Create New Apps Intermediary step
@@ -2316,3 +2318,8 @@ export const PARTIAL_IMPORT_EXPORT = {
export const DATASOURCE_SECURELY_TITLE = () => "Secure & fast connection";
export const HTTP_PROTOCOL_INPUT_PLACEHOLDER = () => `Select HTTP Protocol`;
+
+export const ADD_PAGE_FROM_TEMPLATE_MODAL = {
+ title: () => "Add page(s) from a template",
+ buildingBlocksTitle: () => "Building Blocks",
+};
diff --git a/app/client/src/ce/pages/Applications/CreateNewAppsOption.tsx b/app/client/src/ce/pages/Applications/CreateNewAppsOption.tsx
index 18e5f80ca515..05706c41b871 100644
--- a/app/client/src/ce/pages/Applications/CreateNewAppsOption.tsx
+++ b/app/client/src/ce/pages/Applications/CreateNewAppsOption.tsx
@@ -11,8 +11,6 @@ import {
START_WITH_DATA_CONNECT_SUBHEADING,
START_WITH_DATA_SUBTITLE,
START_WITH_DATA_TITLE,
- START_WITH_TEMPLATE_CONNECT_HEADING,
- START_WITH_TEMPLATE_CONNECT_SUBHEADING,
createMessage,
} from "@appsmith/constants/messages";
import urlBuilder from "@appsmith/entities/URLRedirect/URLAssembly";
@@ -38,7 +36,6 @@ import { Flex, Link, Text } from "design-system";
import { isEmpty } from "lodash";
import CreateNewDatasourceTab from "pages/Editor/IntegrationEditor/CreateNewDatasourceTab";
import { TemplateView } from "pages/Templates/TemplateView";
-import StartWithTemplates from "pages/Templates/StartWithTemplates";
import { default as React, useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import {
@@ -59,6 +56,7 @@ import { fetchMockDatasources } from "actions/datasourceActions";
import DatasourceForm from "pages/Editor/SaaSEditor/DatasourceForm";
import type { Datasource } from "entities/Datasource";
import { fetchingEnvironmentConfigs } from "@appsmith/actions/environmentAction";
+import StartWithTemplatesWrapper from "./StartWithTemplatesWrapper";
const SectionWrapper = styled.div`
display: flex;
@@ -87,12 +85,6 @@ const BackWrapper = styled.div<{ hidden?: boolean }>`
${(props) => `${props.hidden && "visibility: hidden; opacity: 0;"}`}
`;
-const TemplateWrapper = styled.div`
- display: flex;
- flex-grow: 1;
- overflow: hidden;
-`;
-
const OptionWrapper = styled.div`
display: flex;
align-items: center;
@@ -446,20 +438,12 @@ const CreateNewAppsOption = ({
templateId={selectedTemplate}
/>
) : (
- <Flex flexDirection="column" pl="spaces-3" pr="spaces-3">
- <Header
- subtitle={createMessage(START_WITH_TEMPLATE_CONNECT_SUBHEADING)}
- title={createMessage(START_WITH_TEMPLATE_CONNECT_HEADING)}
- />
- <TemplateWrapper>
- <StartWithTemplates
- currentApplicationIdForCreateNewApp={
- currentApplicationIdForCreateNewApp
- }
- setSelectedTemplate={setSelectedTemplate}
- />
- </TemplateWrapper>
- </Flex>
+ <StartWithTemplatesWrapper
+ currentApplicationIdForCreateNewApp={
+ currentApplicationIdForCreateNewApp
+ }
+ setSelectedTemplate={setSelectedTemplate}
+ />
)
) : useType === START_WITH_TYPE.DATA ? (
<Flex flexDirection="column" pl="spaces-3" pr="spaces-3">
diff --git a/app/client/src/ce/pages/Applications/StartWithTemplatesWrapper.tsx b/app/client/src/ce/pages/Applications/StartWithTemplatesWrapper.tsx
new file mode 100644
index 000000000000..389855b900d5
--- /dev/null
+++ b/app/client/src/ce/pages/Applications/StartWithTemplatesWrapper.tsx
@@ -0,0 +1,91 @@
+import {
+ START_WITH_TEMPLATE_CONNECT_HEADING,
+ START_WITH_TEMPLATE_CONNECT_SUBHEADING,
+ createMessage,
+} from "@appsmith/constants/messages";
+import { getApplicationByIdFromWorkspaces } from "@appsmith/selectors/applicationSelectors";
+import {
+ importTemplateIntoApplicationViaOnboardingFlow,
+ setActiveLoadingTemplateId,
+} from "actions/templateActions";
+import type { Template } from "api/TemplatesApi";
+import { Flex, Text } from "design-system";
+import StartWithTemplates from "pages/Templates/StartWithTemplates";
+import React from "react";
+import { useDispatch, useSelector } from "react-redux";
+import {
+ getForkableWorkspaces,
+ isImportingTemplateToAppSelector,
+} from "selectors/templatesSelectors";
+import styled from "styled-components";
+import AnalyticsUtil from "utils/AnalyticsUtil";
+
+interface Props {
+ currentApplicationIdForCreateNewApp: string;
+ setSelectedTemplate: (id: string) => void;
+}
+
+const StartWithTemplatesWrapper = ({
+ currentApplicationIdForCreateNewApp,
+ setSelectedTemplate,
+}: Props) => {
+ const dispatch = useDispatch();
+ const isImportingTemplate = useSelector(isImportingTemplateToAppSelector);
+ const workspaceList = useSelector(getForkableWorkspaces);
+
+ const application = useSelector((state) =>
+ getApplicationByIdFromWorkspaces(
+ state,
+ currentApplicationIdForCreateNewApp,
+ ),
+ );
+ const onForkTemplateClick = (template: Template) => {
+ const title = template.title;
+ AnalyticsUtil.logEvent("FORK_TEMPLATE_WHEN_ONBOARDING", { title });
+ // When fork template is clicked to add a new app using the template
+ if (!isImportingTemplate && application) {
+ dispatch(setActiveLoadingTemplateId(template.id));
+ dispatch(
+ importTemplateIntoApplicationViaOnboardingFlow(
+ template.id,
+ template.title,
+ template.pages.map((p) => p.name),
+ application.id,
+ application.workspaceId,
+ ),
+ );
+ }
+ };
+ return (
+ <Flex flexDirection="column" pl="spaces-3" pr="spaces-3">
+ <Header
+ subtitle={createMessage(START_WITH_TEMPLATE_CONNECT_SUBHEADING)}
+ title={createMessage(START_WITH_TEMPLATE_CONNECT_HEADING)}
+ />
+ <TemplateWrapper>
+ <StartWithTemplates
+ isForkingEnabled={!!workspaceList.length}
+ onForkTemplateClick={onForkTemplateClick}
+ setSelectedTemplate={setSelectedTemplate}
+ />
+ </TemplateWrapper>
+ </Flex>
+ );
+};
+
+export default StartWithTemplatesWrapper;
+
+const TemplateWrapper = styled.div`
+ display: flex;
+ flex-grow: 1;
+ overflow: hidden;
+`;
+
+const Header = ({ subtitle, title }: { subtitle: string; title: string }) => {
+ return (
+ <Flex flexDirection="column" mb="spaces-14" mt="spaces-7">
+ <Text kind="heading-xl">{title}</Text>
+ <Text>{subtitle}</Text>
+ </Flex>
+ );
+};
diff --git a/app/client/src/ce/utils/analyticsUtilTypes.ts b/app/client/src/ce/utils/analyticsUtilTypes.ts
index 0b43d8d06bbd..9a77fddd0469 100644
--- a/app/client/src/ce/utils/analyticsUtilTypes.ts
+++ b/app/client/src/ce/utils/analyticsUtilTypes.ts
@@ -347,11 +347,15 @@ export type EventName =
| "GET_STARTED_CLICKED"
| "fork_APPLICATIONTEMPLATE"
| "DATA_FETCH_FAILED_POST_SCHEMA_FETCH"
- | "STARTER_BUILDING_BLOCK_HOVER"
- | "STARTER_BUILDING_BLOCK_CONNECT_DATA_CLICK"
| "START_FROM_TEMPLATES_CLICK_SKIP_BUTTON"
| "SUPPORT_REQUEST_INITIATED"
- | ONBOARDING_FLOW_EVENTS;
+ | ONBOARDING_FLOW_EVENTS
+ | CANVAS_STARTER_BUILDING_BLOCK_EVENTS;
+
+export type CANVAS_STARTER_BUILDING_BLOCK_EVENTS =
+ | "STARTER_BUILDING_BLOCK_HOVER"
+ | "STARTER_BUILDING_BLOCK_CONNECT_DATA_CLICK"
+ | "STARTER_BUILDING_BLOCK_SEE_MORE_CLICK";
export type ONBOARDING_FLOW_EVENTS =
| "CREATE_APP_FROM_TEMPLATE"
diff --git a/app/client/src/constants/TemplatesConstants.tsx b/app/client/src/constants/TemplatesConstants.tsx
index 532b03db2dfc..c7288d20abe6 100644
--- a/app/client/src/constants/TemplatesConstants.tsx
+++ b/app/client/src/constants/TemplatesConstants.tsx
@@ -4,6 +4,7 @@ import {
createMessage,
} from "@appsmith/constants/messages";
import { importSvg } from "@design-system/widgets-old/src/utils/icon-loadables";
+import { TEMPLATE_BUILDING_BLOCKS_FILTER_FUNCTION_VALUE } from "pages/Templates/constants";
export const COMMUNITY_PORTAL = {
BASE_URL: "https://community.appsmith.com",
@@ -74,3 +75,7 @@ export const STARTER_BUILDING_BLOCKS = {
},
],
};
+
+export const CANVAS_STARTER_TEMPLATES_SEE_MORE_BUILDING_BLOCKS_PRE_FILTER = {
+ functions: [TEMPLATE_BUILDING_BLOCKS_FILTER_FUNCTION_VALUE],
+};
diff --git a/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/StyledComponents.tsx b/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/StyledComponents.tsx
index 55e97af73e5b..32b0ed522478 100644
--- a/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/StyledComponents.tsx
+++ b/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/StyledComponents.tsx
@@ -78,25 +78,6 @@ export const TemplateLayoutRowItemDescription = styled.p<{
opacity: ${(props) => (props.layoutActive ? "1" : "0.7")};
`;
-export const TemplateLayoutOrText = styled.p<{ layoutActive: boolean }>`
- font-size: 14px;
- line-height: 20px;
- font-weight: 500;
- margin: 16px 0px;
- opacity: ${(props) => (props.layoutActive ? "0" : "0.7")};
- transition: opacity 0.3s ease;
-`;
-
-export const TemplateLayoutDragAndDropText = styled.p<{
- layoutActive: boolean;
-}>`
- font-size: 16px;
- line-height: 24px;
- font-weight: 600;
- opacity: ${(props) => (props.layoutActive ? "0" : "0.7")};
- transition: opacity 0.3s ease;
-`;
-
export const TemplateLayoutContentGrid = styled.div`
display: flex;
justify-content: center;
diff --git a/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/index.tsx b/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/index.tsx
index 7aa54e420547..f740445acb11 100644
--- a/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/index.tsx
+++ b/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/index.tsx
@@ -7,11 +7,15 @@ import {
import { saveExplorerStatus } from "@appsmith/pages/Editor/Explorer/helpers";
import { getAppMode } from "@appsmith/selectors/applicationSelectors";
import { getCurrentAppWorkspace } from "@appsmith/selectors/workspaceSelectors";
-import { importStarterBuildingBlockIntoApplication } from "actions/templateActions";
+import {
+ importStarterBuildingBlockIntoApplication,
+ showTemplatesModal,
+} from "actions/templateActions";
import {
STARTER_BUILDING_BLOCKS,
STARTER_BUILDING_BLOCK_TEMPLATE_NAME,
} from "constants/TemplatesConstants";
+import { Button } from "design-system";
import LoadingScreen from "pages/Templates/TemplatesModal/LoadingScreen";
import { useDispatch, useSelector } from "react-redux";
import {
@@ -26,10 +30,8 @@ import {
TemplateLayoutContentGrid,
TemplateLayoutContentItem,
TemplateLayoutContentItemContent,
- TemplateLayoutDragAndDropText,
TemplateLayoutFrame,
TemplateLayoutHeaderText,
- TemplateLayoutOrText,
TemplateLayoutRowItemDescription,
TemplateLayoutRowItemTitle,
} from "./StyledComponents";
@@ -41,6 +43,7 @@ function StarterBuildingBlocks() {
const [templateSreenshot, setTemplateScreenshot] = useState<string | null>(
null,
); // manage template background screenshot image
+
const currentApplication = useSelector(getCurrentApplication);
const applicationId = useSelector(getCurrentApplicationId);
const currentWorkSpace = useSelector(getCurrentAppWorkspace);
@@ -96,6 +99,15 @@ function StarterBuildingBlocks() {
});
};
+ const onSeeMoreClick = () => {
+ dispatch(showTemplatesModal({ isOpenFromCanvas: true }));
+ AnalyticsUtil.logEvent("STARTER_BUILDING_BLOCK_SEE_MORE_CLICK", {
+ applicationId: currentApplication?.id,
+ workspaceId: currentWorkSpace.id,
+ source: "canvas",
+ });
+ };
+
if (isImportingStarterBuildingBlockToApp) {
return (
<TemplateLayoutFrame>
@@ -148,15 +160,16 @@ function StarterBuildingBlocks() {
</TemplateLayoutContentItem>
))}
</TemplateLayoutContentGrid>
- </TemplateLayoutContainer>
- <TemplateLayoutOrText layoutActive={layoutActive}>
- {createMessage(STARTER_TEMPLATE_PAGE_LAYOUTS.or)}
- </TemplateLayoutOrText>
-
- <TemplateLayoutDragAndDropText layoutActive={layoutActive}>
- {createMessage(STARTER_TEMPLATE_PAGE_LAYOUTS.dragAndDrop)}
- </TemplateLayoutDragAndDropText>
+ <Button
+ className="mt-4"
+ kind="tertiary"
+ onClick={onSeeMoreClick}
+ size="md"
+ >
+ {createMessage(STARTER_TEMPLATE_PAGE_LAYOUTS.seeMoreText)}
+ </Button>
+ </TemplateLayoutContainer>
</TemplateLayoutFrame>
);
}
diff --git a/app/client/src/pages/Editor/Explorer/Pages/AddPageContextMenu.tsx b/app/client/src/pages/Editor/Explorer/Pages/AddPageContextMenu.tsx
index b61721d12917..9d0b2279a3e1 100644
--- a/app/client/src/pages/Editor/Explorer/Pages/AddPageContextMenu.tsx
+++ b/app/client/src/pages/Editor/Explorer/Pages/AddPageContextMenu.tsx
@@ -85,7 +85,8 @@ function AddPageContextMenu({
items.push({
title: createMessage(ADD_PAGE_FROM_TEMPLATE),
icon: "layout-2-line",
- onClick: () => dispatch(showTemplatesModal(true)),
+ onClick: () =>
+ dispatch(showTemplatesModal({ isOpenFromCanvas: false })),
"data-testid": "add-page-from-template",
key: "ADD_PAGE_FROM_TEMPLATE",
});
diff --git a/app/client/src/pages/Editor/WidgetsEditor/EmptyCanvasPrompts.tsx b/app/client/src/pages/Editor/WidgetsEditor/EmptyCanvasPrompts.tsx
index effb00e0187e..1a70b5eaa147 100644
--- a/app/client/src/pages/Editor/WidgetsEditor/EmptyCanvasPrompts.tsx
+++ b/app/client/src/pages/Editor/WidgetsEditor/EmptyCanvasPrompts.tsx
@@ -113,7 +113,7 @@ function EmptyCanvasPrompts(props: EmptyCanvasPromptsProps) {
if (!showCanvasTopSection || isPreview) return null;
const showTemplatesModal = () => {
- dispatch(showTemplatesModalAction(true));
+ dispatch(showTemplatesModalAction({ isOpenFromCanvas: false }));
AnalyticsUtil.logEvent("CANVAS_BLANK_PAGE_CTA_CLICK", {
item: "ADD_PAGE_FROM_TEMPLATE",
});
diff --git a/app/client/src/pages/Templates/StartWithTemplateContent/StyledComponents.tsx b/app/client/src/pages/Templates/StartWithTemplateContent/StyledComponents.tsx
index 6a6a03192fd1..16c42211c0a2 100644
--- a/app/client/src/pages/Templates/StartWithTemplateContent/StyledComponents.tsx
+++ b/app/client/src/pages/Templates/StartWithTemplateContent/StyledComponents.tsx
@@ -1,12 +1,17 @@
import styled from "styled-components";
import { Text } from "design-system";
-export const Wrapper = styled.div`
+export const Wrapper = styled.div<{ isModalLayout?: boolean }>`
+ ${(props) =>
+ !props.isModalLayout &&
+ `
padding: 48px;
- background-color: var(--ads-v2-color-bg);
- margin-right: 24px;
border: 1px solid var(--ads-v2-color-border);
border-radius: var(--ads-v2-border-radius);
+ background-color: var(--ads-v2-color-bg);
+ `}
+
+ margin-right: 24px;
.grid {
display: flex;
}
diff --git a/app/client/src/pages/Templates/StartWithTemplateContent/index.tsx b/app/client/src/pages/Templates/StartWithTemplateContent/index.tsx
index 761334957056..1f3abf3f7e64 100644
--- a/app/client/src/pages/Templates/StartWithTemplateContent/index.tsx
+++ b/app/client/src/pages/Templates/StartWithTemplateContent/index.tsx
@@ -1,3 +1,7 @@
+import {
+ ADD_PAGE_FROM_TEMPLATE_MODAL,
+ createMessage,
+} from "@appsmith/constants/messages";
import { getIsFetchingApplications } from "@appsmith/selectors/applicationSelectors";
import type { Template as TemplateInterface } from "api/TemplatesApi";
import React from "react";
@@ -24,6 +28,7 @@ import {
interface StartWithTemplateListProps {
isForkingEnabled: boolean;
+ isModalLayout?: boolean;
templates: TemplateInterface[];
onTemplateClick?: (id: string) => void;
onForkTemplateClick?: (template: TemplateInterface) => void;
@@ -59,10 +64,12 @@ function StartWithTemplateList(props: StartWithTemplateListProps) {
);
return (
- <Wrapper>
+ <Wrapper isModalLayout={props.isModalLayout}>
{showBuildingBlocksSection && (
<>
- <SubheadingText kind="heading-m">Building blocks</SubheadingText>
+ <SubheadingText kind="heading-m">
+ {createMessage(ADD_PAGE_FROM_TEMPLATE_MODAL.buildingBlocksTitle)}
+ </SubheadingText>
<TemplateGrid>
{buildingBlocks.map((template) => (
@@ -104,6 +111,7 @@ function StartWithTemplateList(props: StartWithTemplateListProps) {
}
interface StartWithTemplateContentProps {
+ isModalLayout?: boolean;
onTemplateClick?: (id: string) => void;
onForkTemplateClick?: (template: TemplateInterface) => void;
stickySearchBar?: boolean;
@@ -128,6 +136,7 @@ export function StartWithTemplateContent(props: StartWithTemplateContentProps) {
return (
<StartWithTemplateList
isForkingEnabled={props.isForkingEnabled}
+ isModalLayout={props.isModalLayout}
onForkTemplateClick={props.onForkTemplateClick}
onTemplateClick={props.onTemplateClick}
templates={templates}
diff --git a/app/client/src/pages/Templates/StartWithTemplateFilter/index.tsx b/app/client/src/pages/Templates/StartWithTemplateFilter/index.tsx
index c44d23ba672c..23ea7897a35e 100644
--- a/app/client/src/pages/Templates/StartWithTemplateFilter/index.tsx
+++ b/app/client/src/pages/Templates/StartWithTemplateFilter/index.tsx
@@ -43,6 +43,7 @@ interface FilterCategoryProps {
}
interface FilterWrapperProps {
+ initialFilters?: Record<string, string[]>;
stickySearchBar?: boolean;
}
@@ -210,8 +211,14 @@ const StartWithTemplateFilters = (props: FilterWrapperProps) => {
// Set default filter to "All" on mount
useEffect(() => {
- dispatch(filterTemplates("functions", ["All"]));
- }, []);
+ if (props.initialFilters) {
+ Object.keys(props.initialFilters).forEach((filter) => {
+ dispatch(filterTemplates(filter, props.initialFilters![filter]));
+ });
+ } else {
+ dispatch(filterTemplates("functions", ["All"]));
+ }
+ }, [props.initialFilters]);
return (
<FilterWrapper className="filter-wrapper">
diff --git a/app/client/src/pages/Templates/StartWithTemplates.tsx b/app/client/src/pages/Templates/StartWithTemplates.tsx
index ddac18bfc17f..26219b085d23 100644
--- a/app/client/src/pages/Templates/StartWithTemplates.tsx
+++ b/app/client/src/pages/Templates/StartWithTemplates.tsx
@@ -1,24 +1,16 @@
+import { getIsFetchingApplications } from "@appsmith/selectors/applicationSelectors";
+import type { Template as TemplateInterface } from "api/TemplatesApi";
import React from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useSelector } from "react-redux";
import {
- getForkableWorkspaces,
getTemplatesSelector,
isFetchingTemplatesSelector,
isImportingTemplateToAppSelector,
} from "selectors/templatesSelectors";
import styled from "styled-components";
import AnalyticsUtil from "utils/AnalyticsUtil";
-import StartWithTemplateFilters from "./StartWithTemplateFilter";
import { StartWithTemplateContent } from "./StartWithTemplateContent";
-import {
- getApplicationByIdFromWorkspaces,
- getIsFetchingApplications,
-} from "@appsmith/selectors/applicationSelectors";
-import {
- importTemplateIntoApplicationViaOnboardingFlow,
- setActiveLoadingTemplateId,
-} from "actions/templateActions";
-import type { Template } from "api/TemplatesApi";
+import StartWithTemplateFilters from "./StartWithTemplateFilter";
const FiltersWrapper = styled.div`
width: ${(props) => props.theme.homePage.sidebar}px;
@@ -29,53 +21,37 @@ const FiltersWrapper = styled.div`
.filter-wrapper {
height: 100%;
}
+ padding-left: 12px;
+ padding-right: 12px;
`;
const TemplateContentWrapper = styled.div`
flex-grow: 1;
overflow: auto;
+ height: 75vh;
+ padding-bottom: 24px;
`;
interface StartWithTemplatesProps {
- currentApplicationIdForCreateNewApp: string;
+ initialFilters?: Record<string, string[]>;
+ isForkingEnabled?: boolean;
+ isModalLayout?: boolean;
setSelectedTemplate: (id: string) => void;
+ onForkTemplateClick: (template: TemplateInterface) => void;
}
const StartWithTemplates = ({
- currentApplicationIdForCreateNewApp,
+ initialFilters,
+ isForkingEnabled = false,
+ isModalLayout,
+ onForkTemplateClick,
setSelectedTemplate,
}: StartWithTemplatesProps) => {
- const dispatch = useDispatch();
- const workspaceList = useSelector(getForkableWorkspaces);
const allTemplates = useSelector(getTemplatesSelector);
const isImportingTemplate = useSelector(isImportingTemplateToAppSelector);
const isFetchingApplications = useSelector(getIsFetchingApplications);
const isFetchingTemplates = useSelector(isFetchingTemplatesSelector);
const isLoading = isFetchingApplications || isFetchingTemplates;
- const application = useSelector((state) =>
- getApplicationByIdFromWorkspaces(
- state,
- currentApplicationIdForCreateNewApp,
- ),
- );
-
- const onForkTemplateClick = (template: Template) => {
- const title = template.title;
- AnalyticsUtil.logEvent("FORK_TEMPLATE_WHEN_ONBOARDING", { title });
- // When fork template is clicked to add a new app using the template
- if (!isImportingTemplate && application) {
- dispatch(setActiveLoadingTemplateId(template.id));
- dispatch(
- importTemplateIntoApplicationViaOnboardingFlow(
- template.id,
- template.title,
- template.pages.map((p) => p.name),
- application.id,
- application.workspaceId,
- ),
- );
- }
- };
const getTemplateById = (id: string) => {
return allTemplates.find((template) => template.id === id);
@@ -89,7 +65,7 @@ const StartWithTemplates = ({
title: template.title,
});
// When template is clicked to view the template details
- if (!isImportingTemplate) setSelectedTemplate(id);
+ if (!isImportingTemplate && setSelectedTemplate) setSelectedTemplate(id);
}
};
@@ -97,7 +73,9 @@ const StartWithTemplates = ({
<>
<TemplateContentWrapper>
<StartWithTemplateContent
- isForkingEnabled={!!workspaceList.length}
+ filterWithAllowPageImport={isModalLayout}
+ isForkingEnabled={isForkingEnabled}
+ isModalLayout={!!isModalLayout}
onForkTemplateClick={onForkTemplateClick}
onTemplateClick={onTemplateClick}
/>
@@ -105,7 +83,7 @@ const StartWithTemplates = ({
{!isLoading && (
<FiltersWrapper>
- <StartWithTemplateFilters />
+ <StartWithTemplateFilters initialFilters={initialFilters} />
</FiltersWrapper>
)}
</>
diff --git a/app/client/src/pages/Templates/TemplatesModal/Header.tsx b/app/client/src/pages/Templates/TemplatesModal/Header.tsx
index 4fc210da9e26..a143a9b482df 100644
--- a/app/client/src/pages/Templates/TemplatesModal/Header.tsx
+++ b/app/client/src/pages/Templates/TemplatesModal/Header.tsx
@@ -1,4 +1,8 @@
// import { Text, TextType } from "design-system-old";
+import {
+ ADD_PAGE_FROM_TEMPLATE_MODAL,
+ createMessage,
+} from "@appsmith/constants/messages";
import React from "react";
import styled from "styled-components";
@@ -22,7 +26,7 @@ interface TemplateModalHeaderProps {
function TemplateModalHeader(props: TemplateModalHeaderProps) {
return (
<HeaderWrapper className={props.className}>
- <BackText>Add page(s) from template</BackText>
+ <BackText>{createMessage(ADD_PAGE_FROM_TEMPLATE_MODAL.title)}</BackText>
</HeaderWrapper>
);
}
diff --git a/app/client/src/pages/Templates/TemplatesModal/PageSelection.tsx b/app/client/src/pages/Templates/TemplatesModal/PageSelection.tsx
index 677d097de96d..79365d83bcce 100644
--- a/app/client/src/pages/Templates/TemplatesModal/PageSelection.tsx
+++ b/app/client/src/pages/Templates/TemplatesModal/PageSelection.tsx
@@ -1,17 +1,22 @@
-import React, { useEffect, useState } from "react";
-import styled from "styled-components";
-import { Button, Checkbox, Divider, Icon, Text } from "design-system";
-import { useDispatch } from "react-redux";
-import { importTemplateIntoApplication } from "actions/templateActions";
-import type { Template } from "api/TemplatesApi";
import type { ApplicationPagePayload } from "@appsmith/api/ApplicationApi";
import {
- createMessage,
FILTER_SELECTALL,
+ FILTER_SELECT_PAGE,
FILTER_SELECT_PAGES,
PAGE,
PAGES,
+ createMessage,
} from "@appsmith/constants/messages";
+import { getCurrentAppWorkspace } from "@appsmith/selectors/workspaceSelectors";
+import { importTemplateIntoApplication } from "actions/templateActions";
+import type { Template } from "api/TemplatesApi";
+import { STARTER_BUILDING_BLOCK_TEMPLATE_NAME } from "constants/TemplatesConstants";
+import { Button, Checkbox, Divider, Icon, Text } from "design-system";
+import React, { useEffect, useState } from "react";
+import { useDispatch, useSelector } from "react-redux";
+import { getCurrentApplicationId } from "selectors/editorSelectors";
+import styled from "styled-components";
+import AnalyticsUtil from "utils/AnalyticsUtil";
const Wrapper = styled.div`
width: 280px;
@@ -60,6 +65,7 @@ const StyledButton = styled(Button)`
`;
interface PageSelectionProps {
+ isStartWithTemplateFlow: boolean;
pages: ApplicationPagePayload[];
template: Template;
onPageSelection: (pageId: string) => void;
@@ -74,6 +80,8 @@ function PageSelection(props: PageSelectionProps) {
props.pages.length > 1 || props.pages.length === 0
? createMessage(PAGES)
: createMessage(PAGE);
+ const applicationId = useSelector(getCurrentApplicationId);
+ const currentWorkSpace = useSelector(getCurrentAppWorkspace);
useEffect(() => {
setSelectedPages(props.pages.map((page) => page.name));
@@ -107,6 +115,17 @@ function PageSelection(props: PageSelectionProps) {
selectedPages,
),
);
+ if (props.isStartWithTemplateFlow) {
+ AnalyticsUtil.logEvent("fork_APPLICATIONTEMPLATE", {
+ applicationId: applicationId,
+ workspaceId: currentWorkSpace.id,
+ source: "canvas",
+ eventData: {
+ templateAppName: STARTER_BUILDING_BLOCK_TEMPLATE_NAME,
+ selectedPages,
+ },
+ });
+ }
};
return (
@@ -153,7 +172,9 @@ function PageSelection(props: PageSelectionProps) {
onClick={importPagesToApp}
size="md"
>
- {createMessage(FILTER_SELECT_PAGES)}
+ {createMessage(
+ props.pages.length === 1 ? FILTER_SELECT_PAGE : FILTER_SELECT_PAGES,
+ )}
</StyledButton>
</Card>
</Wrapper>
diff --git a/app/client/src/pages/Templates/TemplatesModal/TemplateDetailedView.tsx b/app/client/src/pages/Templates/TemplatesModal/TemplateDetailedView.tsx
index f63349527a33..9cfb34f065a6 100644
--- a/app/client/src/pages/Templates/TemplatesModal/TemplateDetailedView.tsx
+++ b/app/client/src/pages/Templates/TemplatesModal/TemplateDetailedView.tsx
@@ -62,6 +62,7 @@ const TemplateDescriptionWrapper = styled.div`
`;
interface TemplateDetailedViewProps {
+ isStartWithTemplateFlow: boolean;
templateId: string;
onBackPress: () => void;
onClose: () => void;
@@ -162,6 +163,7 @@ function TemplateDetailedView(props: TemplateDetailedViewProps) {
/>
</div>
<PageSelection
+ isStartWithTemplateFlow={props.isStartWithTemplateFlow}
onPageSelection={onPageSelection}
pages={currentTemplate.pages || []}
template={currentTemplate}
diff --git a/app/client/src/pages/Templates/TemplatesModal/TemplatesListLayoutSwitcher.tsx b/app/client/src/pages/Templates/TemplatesModal/TemplatesListLayoutSwitcher.tsx
new file mode 100644
index 000000000000..8b9ea36c7a72
--- /dev/null
+++ b/app/client/src/pages/Templates/TemplatesModal/TemplatesListLayoutSwitcher.tsx
@@ -0,0 +1,48 @@
+import type { Template as TemplateInterface } from "api/TemplatesApi";
+import { CANVAS_STARTER_TEMPLATES_SEE_MORE_BUILDING_BLOCKS_PRE_FILTER } from "constants/TemplatesConstants";
+import { Flex } from "design-system";
+import React, { useMemo } from "react";
+import styled from "styled-components";
+import StartWithTemplates from "../StartWithTemplates";
+
+interface Props {
+ isStartWithTemplateFlow?: boolean;
+ onTemplateClick: (id: string) => void;
+}
+
+const TemplatesListLayoutSwitcher = ({
+ isStartWithTemplateFlow,
+ onTemplateClick,
+}: Props) => {
+ const onForkTemplateClick = (template: TemplateInterface) => {
+ onTemplateClick(template.id);
+ };
+ const initFilters = useMemo(
+ () =>
+ isStartWithTemplateFlow
+ ? CANVAS_STARTER_TEMPLATES_SEE_MORE_BUILDING_BLOCKS_PRE_FILTER
+ : undefined,
+ [isStartWithTemplateFlow],
+ );
+ return (
+ <Flex flexDirection="column" pl="spaces-3" pr="spaces-3">
+ <TemplateWrapper>
+ <StartWithTemplates
+ initialFilters={initFilters}
+ isModalLayout
+ onForkTemplateClick={onForkTemplateClick}
+ setSelectedTemplate={onTemplateClick}
+ />
+ </TemplateWrapper>
+ </Flex>
+ );
+};
+
+export default TemplatesListLayoutSwitcher;
+
+const TemplateWrapper = styled.div`
+ display: flex;
+ flex-grow: 1;
+ overflow: hidden;
+ height: 100%;
+`;
diff --git a/app/client/src/pages/Templates/TemplatesModal/index.tsx b/app/client/src/pages/Templates/TemplatesModal/index.tsx
index 977e54ea72b4..0920027ecbb3 100644
--- a/app/client/src/pages/Templates/TemplatesModal/index.tsx
+++ b/app/client/src/pages/Templates/TemplatesModal/index.tsx
@@ -3,15 +3,14 @@ import styled from "styled-components";
import { useDispatch, useSelector } from "react-redux";
import {
allTemplatesFiltersSelector,
- templateModalOpenSelector,
+ templateModalSelector,
templatesCountSelector,
} from "selectors/templatesSelectors";
import {
getAllTemplates,
getTemplateFilters,
- showTemplatesModal,
+ hideTemplatesModal,
} from "actions/templateActions";
-import TemplatesList from "./TemplateList";
import { fetchDefaultPlugins } from "actions/pluginActions";
import TemplateDetailedView from "./TemplateDetailedView";
import { isEmpty } from "lodash";
@@ -19,6 +18,7 @@ import type { AppState } from "@appsmith/reducers";
import { Modal, ModalBody, ModalContent, ModalHeader } from "design-system";
import TemplateModalHeader from "./Header";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
+import TemplatesListLayoutSwitcher from "./TemplatesListLayoutSwitcher";
const ModalContentWrapper = styled(ModalContent)`
width: 100%;
@@ -30,7 +30,7 @@ const ModalBodyWrapper = styled(ModalBody)`
overflow-y: hidden;
`;
function TemplatesModal() {
- const templatesModalOpen = useSelector(templateModalOpenSelector);
+ const templatesModalInfo = useSelector(templateModalSelector);
const dispatch = useDispatch();
const templatesCount = useSelector(templatesCountSelector);
const pluginListLength = useSelector(
@@ -41,18 +41,18 @@ function TemplatesModal() {
useEffect(() => {
setShowTemplateDetails("");
- if (templatesModalOpen) {
+ if (templatesModalInfo.isOpen) {
dispatch({
type: ReduxActionTypes.RESET_TEMPLATE_FILTERS,
});
}
- }, [templatesModalOpen]);
+ }, [templatesModalInfo]);
useEffect(() => {
- if (!templatesCount && templatesModalOpen) {
+ if (!templatesCount && templatesModalInfo) {
dispatch(getAllTemplates());
}
- }, [templatesCount, templatesModalOpen]);
+ }, [templatesCount, templatesModalInfo]);
useEffect(() => {
if (!pluginListLength) {
@@ -68,7 +68,7 @@ function TemplatesModal() {
const onClose = (open: boolean) => {
if (open === false) {
- dispatch(showTemplatesModal(false));
+ dispatch(hideTemplatesModal());
setShowTemplateDetails("");
}
};
@@ -78,7 +78,10 @@ function TemplatesModal() {
};
return (
- <Modal onOpenChange={(open) => onClose(open)} open={templatesModalOpen}>
+ <Modal
+ onOpenChange={(open) => onClose(open)}
+ open={templatesModalInfo.isOpen}
+ >
<ModalContentWrapper data-testid="t--templates-dialog-component">
<ModalHeader>
{!!showTemplateDetails ? (
@@ -97,13 +100,14 @@ function TemplatesModal() {
<ModalBodyWrapper>
{!!showTemplateDetails ? (
<TemplateDetailedView
+ isStartWithTemplateFlow={templatesModalInfo.isOpenFromCanvas}
onBackPress={() => setShowTemplateDetails("")}
onClose={() => onClose(false)}
templateId={showTemplateDetails}
/>
) : (
- <TemplatesList
- onClose={() => onClose(false)}
+ <TemplatesListLayoutSwitcher
+ isStartWithTemplateFlow={templatesModalInfo.isOpenFromCanvas}
onTemplateClick={onTemplateClick}
/>
)}
diff --git a/app/client/src/reducers/uiReducers/templateReducer.ts b/app/client/src/reducers/uiReducers/templateReducer.ts
index cd912fb39071..694011a8eacb 100644
--- a/app/client/src/reducers/uiReducers/templateReducer.ts
+++ b/app/client/src/reducers/uiReducers/templateReducer.ts
@@ -26,7 +26,10 @@ const initialState: TemplatesReduxState = {
},
templateSearchQuery: "",
templateNotificationSeen: null,
- showTemplatesModal: false,
+ templatesModal: {
+ isOpen: false,
+ isOpenFromCanvas: false,
+ },
};
const templateReducer = createReducer(initialState, {
@@ -242,11 +245,23 @@ const templateReducer = createReducer(initialState, {
},
[ReduxActionTypes.SHOW_TEMPLATES_MODAL]: (
state: TemplatesReduxState,
- action: ReduxAction<boolean>,
+ action: ReduxAction<{ isOpenFromCanvas: boolean }>,
) => {
return {
...state,
- showTemplatesModal: action.payload,
+ templatesModal: {
+ isOpen: true,
+ isOpenFromCanvas: action.payload.isOpenFromCanvas,
+ },
+ };
+ },
+ [ReduxActionTypes.HIDE_TEMPLATES_MODAL]: (state: TemplatesReduxState) => {
+ return {
+ ...state,
+ templatesModal: {
+ isOpen: false,
+ isOpenFromCanvas: false,
+ },
};
},
[ReduxActionTypes.GET_TEMPLATE_FILTERS_INIT]: (
@@ -293,7 +308,10 @@ export interface TemplatesReduxState {
starterBuildingBlockDatasourcePrompt: boolean;
buildingBlockSourcePageId?: string;
templateNotificationSeen: boolean | null;
- showTemplatesModal: boolean;
+ templatesModal: {
+ isOpen: boolean;
+ isOpenFromCanvas: boolean;
+ };
loadingFilters: boolean;
}
diff --git a/app/client/src/sagas/TemplatesSagas.ts b/app/client/src/sagas/TemplatesSagas.ts
index b17e4b653fbe..3e2f8293a0eb 100644
--- a/app/client/src/sagas/TemplatesSagas.ts
+++ b/app/client/src/sagas/TemplatesSagas.ts
@@ -28,9 +28,9 @@ import { getDefaultPageId } from "@appsmith/sagas/ApplicationSagas";
import { getDefaultPageId as selectDefaultPageId } from "sagas/selectors";
import {
getAllTemplates,
+ hideTemplatesModal,
setTemplateNotificationSeenAction,
showStarterBuildingBlockDatasourcePrompt,
- showTemplatesModal,
} from "actions/templateActions";
import {
getTemplateNotificationSeen,
@@ -345,7 +345,7 @@ function* forkTemplateToApplicationSaga(
isValid: boolean;
} = yield call(apiCallForForkTemplateToApplicaion, action);
if (isValid) {
- yield put(showTemplatesModal(false));
+ yield put(hideTemplatesModal());
yield put(getAllTemplates());
toast.show(
diff --git a/app/client/src/selectors/templatesSelectors.tsx b/app/client/src/selectors/templatesSelectors.tsx
index 785cb660fa08..0a862270b0a1 100644
--- a/app/client/src/selectors/templatesSelectors.tsx
+++ b/app/client/src/selectors/templatesSelectors.tsx
@@ -222,8 +222,8 @@ export const getForkableWorkspaces = createSelector(
},
);
-export const templateModalOpenSelector = (state: AppState) =>
- state.ui.templates.showTemplatesModal;
+export const templateModalSelector = (state: AppState) =>
+ state.ui.templates.templatesModal;
export const templatesCountSelector = (state: AppState) =>
state.ui.templates.templates.length;
|
3902e7bd2c30ca601b0e910adef500a878ddc1e5
|
2023-02-08 17:14:39
|
Vijetha-Kaja
|
test: Fix flaky tests (#20483)
| false
|
Fix flaky tests (#20483)
|
test
|
diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/IDE/Command_Click_Navigation_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/IDE/Command_Click_Navigation_spec.js
index d7383413d168..c067a32c7560 100644
--- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/IDE/Command_Click_Navigation_spec.js
+++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/IDE/Command_Click_Navigation_spec.js
@@ -51,6 +51,8 @@ const JSInput2TestCode = `export default {
\t
}`;
+let repoName
+
describe("1. CommandClickNavigation", function() {
it("1. Import the test application", () => {
homePage.NavigateToHome();
@@ -143,6 +145,10 @@ describe("1. CommandClickNavigation", function() {
_.gitSync.CreateGitBranch(repoName);
});
+ cy.get("@gitRepoName").then((repName) => {
+ repoName = repName;
+ });
+
cy.SearchEntityandOpen("Text1");
cy.updateCodeInput(".t--property-control-text", "{{ JSObject1.myFun1() }}");
@@ -210,4 +216,9 @@ describe("1. CommandClickNavigation", function() {
.should("have.length", 1)
.click({ cmdKey: true });
});
+
+ after(() => {
+ //clean up
+ _.gitSync.DeleteTestGithubRepo(repoName);
+ });
});
diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/ForkApplication_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/ForkApplication_spec.js
index f3cf2aeac93a..98f62fd4faaa 100644
--- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/ForkApplication_spec.js
+++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/ForkApplication_spec.js
@@ -4,6 +4,7 @@ import applicationLocators from "../../../../locators/Applications.json";
import signupPageLocators from "../../../../locators/SignupPage.json";
import loginPageLocators from "../../../../locators/LoginPage.json";
import reconnectDatasourceModal from "../../../../locators/ReconnectLocators";
+import { agHelper } from "../../../../support/Objects/ObjectsCore";
let forkedApplicationDsl;
let parentApplicationDsl;
@@ -72,9 +73,19 @@ describe("Fork application across workspaces", function() {
}
cy.PublishtheApp();
+ agHelper.Sleep(1000);
cy.get("button:contains('Share')")
.first()
.click({ force: true });
+ agHelper.Sleep(1000);
+ cy.get("body").then(($ele) => {
+ if ($ele.find(homePage.enablePublicAccess).length <= 0) {
+ cy.contains("Retry").click();
+ cy.get("button:contains('Share')")
+ .first()
+ .click({ force: true });
+ }
+ });
cy.enablePublicAccess();
cy.url().then((url) => {
diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/TableV2/Add_new_row_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/TableV2/Add_new_row_spec.js
index 84e7dfa532f4..b5fd3dd36913 100644
--- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/TableV2/Add_new_row_spec.js
+++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/TableV2/Add_new_row_spec.js
@@ -306,6 +306,7 @@ describe("Table widget Add new row feature's", () => {
cy.discardTableCellValue(0, 0);
cy.wait(500);
cy.get(".t--add-new-row").click();
+ cy.wait(1000)
cy.enterTableCellValue(0, 0, "3");
cy.wait(500);
cy.get(`.t--inlined-cell-editor-has-error`).should("exist");
diff --git a/app/client/cypress/support/widgetCommands.js b/app/client/cypress/support/widgetCommands.js
index d1cee2dcfae4..3bd52fde6eaa 100644
--- a/app/client/cypress/support/widgetCommands.js
+++ b/app/client/cypress/support/widgetCommands.js
@@ -1618,7 +1618,9 @@ Cypress.Commands.add("makeColumnEditable", (column) => {
Cypress.Commands.add("enterTableCellValue", (x, y, text) => {
cy.get(
`[data-colindex="${x}"][data-rowindex="${y}"] .t--inlined-cell-editor input.bp3-input`,
- ).clear();
+ )
+ .click({ force: true })
+ .clear({ force: true} );
if (text) {
cy.get(
|
47fc1443f24f8c0fc2dfc0238546c10fcddee44a
|
2022-03-19 21:26:53
|
Aishwarya-U-R
|
test: Script fixes for flaky tests + Unskipping few skipped tests + Cypress upgraded (#11724)
| false
|
Script fixes for flaky tests + Unskipping few skipped tests + Cypress upgraded (#11724)
|
test
|
diff --git a/app/client/cypress.json b/app/client/cypress.json
index 23d785228ca0..08980d61de01 100644
--- a/app/client/cypress.json
+++ b/app/client/cypress.json
@@ -20,7 +20,7 @@
"**/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_spec.js"
],
"chromeWebSecurity": false,
- "viewportHeight": 900,
+ "viewportHeight": 1100,
"viewportWidth": 1400,
"retries": {
"runMode": 2,
diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/AForceMigration_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/Application/AForceMigration_Spec.ts
new file mode 100644
index 000000000000..9a7ed353748e
--- /dev/null
+++ b/app/client/cypress/integration/Smoke_TestSuite/Application/AForceMigration_Spec.ts
@@ -0,0 +1,507 @@
+// const widgetsPage = require("../../../locators/Widgets.json");
+// import homePage from "../../../locators/HomePage";
+
+// describe("Migration Validate", function () {
+// it("1. Import application and Validate Migration on pageload", function () {
+// // import application
+// cy.get(homePage.homeIcon).click();
+// cy.get(homePage.optionsIcon)
+// .first()
+// .click();
+// cy.get(homePage.orgImportAppOption).click({ force: true });
+// cy.get(homePage.orgImportAppModal).should("be.visible");
+// cy.xpath(homePage.uploadLogo)
+// .attachFile("TableMigrationAppExported.json")
+// .wait(500);
+// cy.get(homePage.orgImportAppButton)
+// .trigger("click")
+// .wait(500);
+// cy.get(homePage.orgImportAppModal).should("not.exist");
+
+// cy.wait("@importNewApplication").then((interception) => {
+// let appId = interception.response.body.data.id;
+// let defaultPage = interception.response.body.data.pages.find(
+// (eachPage) => !!eachPage.isDefault,
+// );
+
+// cy.get(homePage.toastMessage).should(
+// "contain",
+// "Application imported successfully",
+// );
+
+// //Renaming imported app!
+// const uuid = () => Cypress._.random(0, 1e4);
+// const name = uuid();
+// cy.wait(2000);
+// cy.get(homePage.applicationName)
+// .clear()
+// .type(`app${name}`);
+// cy.wrap(`app${name}`).as("appname");
+// cy.wait(2000);
+
+// // Validating data binding for the imported application - Page1
+
+// //Validating Latitude & Longitude are hidden columns:
+// cy.xpath(
+// "//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]//div[@role='columnheader']//div[text()='latitude']/parent::div/parent::div",
+// )
+// .invoke("attr", "class")
+// .then((classes) => {
+// cy.log("classes are:" + classes);
+// expect(classes).includes("hidden-header");
+// });
+
+// cy.xpath(
+// "//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]//div[@role='columnheader']//div[text()='longitude']/parent::div/parent::div",
+// )
+// .invoke("attr", "class")
+// .then((classes) => {
+// cy.log("classes are:" + classes);
+// expect(classes).includes("hidden-header");
+// });
+
+// //Validating order of header row!
+// cy.xpath(
+// "//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]",
+// )
+// .invoke("text")
+// .then((x) => {
+// expect(x).to.eq(
+// "Card NumberidNameاسمaddress住所PhoneemailCompanyjobimagessnPin CodeCreditLimitOutstandingStateAvailable LimitCard TypeChange Credit limitimageURLlatitudelongitude",
+// );
+// cy.log("header set is:" + x);
+// });
+
+// //Validating Id column sorting happens as Datatype is Number in app!
+// cy.xpath(
+// "//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]//div[@role='columnheader']//div[text()='id']",
+// )
+// .click()
+// .wait(2000);
+
+// cy.readTabledataPublish("0", "1").then((cellData) => {
+// expect(cellData).to.be.equal("100");
+// });
+
+// cy.readTabledataPublish("1", "1").then((cellData) => {
+// expect(cellData).to.be.equal("99");
+// });
+
+// cy.readTabledataPublish("2", "1").then((cellData) => {
+// expect(cellData).to.be.equal("98");
+// });
+
+// //Revert the Id column sorting!
+// cy.xpath(
+// "//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]//div[@role='columnheader']//div[text()='id']",
+// )
+// .click()
+// .wait(2000);
+
+// cy.readTabledataPublish("0", "1").then((cellData) => {
+// expect(cellData).to.be.equal("1");
+// });
+
+// cy.readTabledataPublish("1", "1").then((cellData) => {
+// expect(cellData).to.be.equal("2");
+// });
+
+// cy.readTabledataPublish("2", "1").then((cellData) => {
+// expect(cellData).to.be.equal("3");
+// });
+
+// //Validating image column is present:
+// cy.getTableDataSelector("0", "10").then((selector) => {
+// cy.get(selector + " div")
+// .invoke("attr", "class")
+// .then((classes) => {
+// cy.log("classes are:" + classes);
+// expect(classes).to.eq("image-cell");
+// });
+// });
+
+// //Card Number mapping to text widget!
+// cy.isSelectRow(2);
+// cy.wait(2500); //time for table row select to reflect!
+// cy.readTabledataPublish("2", "0").then((cardNumber) => {
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
+// .eq(1)
+// .invoke("text")
+// .then((cardNo) => {
+// var format = /^\d{4}-\d{4}-\d{4}(-\d{4})?$/;
+// expect(cardNumber).match(format);
+// expect(cardNumber).to.be.equal(cardNo);
+// });
+// });
+
+// //Address mapping to text widget!
+// cy.readTabledataPublish("2", "4").then((address) => {
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
+// .eq(1)
+// .invoke("text")
+// .then((addr) => {
+// expect(address.replace(/\r?\n|\r/, "")).to.eq(addr);
+// });
+// });
+
+// //Validating Available limit column computation maintained!
+// cy.readTabledataPublish("2", "16").then((availLimit) => {
+// cy.readTabledataPublish("2", "13").then((creditLimit) => {
+// cy.readTabledataPublish("2", "14").then((outstanding) => {
+// expect(Number(availLimit)).to.eq(creditLimit - outstanding);
+// });
+// });
+// });
+
+// //Validating State button click & binding & text widget mapping!
+// cy.getTableDataSelector("2", "15").then((selector) => {
+// cy.get(selector + " button.bp3-button")
+// .click()
+// .wait(3000);
+
+// cy.waitUntil(
+// () =>
+// cy
+// .xpath("//div[contains(@class, ' t--widget-textwidget')][2]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .should("contain.text", "State:"),
+// {
+// errorMsg: "Execute call did not complete evn after 10 secs",
+// timeout: 20000,
+// interval: 1000,
+// },
+// ).then(() => cy.wait(500));
+
+// cy.get(selector + " button span")
+// .invoke("text")
+// .then((statetxt) => {
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
+// .eq(0)
+// .invoke("text")
+// .then((txtWidtxt) => {
+// cy.log("statetxt is:" + statetxt);
+// let text =
+// statetxt == "Activate" ? "State:Inactive" : "State:Active";
+// expect(text).to.eq(txtWidtxt);
+// });
+// });
+// });
+
+// //Validating Image URL click & navigation!
+// cy.getTableDataSelector("2", "19").then((selector) => {
+// // Stubbing window.open to open in the same tab
+// cy.window().then((window) => {
+// cy.stub(window, "open").callsFake((url) => {
+// window.location.href = url; //.substring(1);
+// window.location.target = "_self";
+// });
+// });
+
+// cy.get(selector + " span.bp3-popover-target span")
+// .invoke("text")
+// .then((url) => {
+// cy.get(selector + " span.bp3-popover-target")
+// .click()
+// .wait(2000);
+// cy.wait("@postExecute");
+// cy.url().should("contain", url);
+// cy.go(-1);
+// });
+// });
+
+// // cy.wait(4000);
+// // cy.get("div.tableWrap").should("be.visible"); //wait for page load!
+
+// cy.waitUntil(
+// () => cy.get("div.tableWrap", { timeout: 30000 }).should("be.visible"),
+// {
+// errorMsg: "Page is not loaded evn after 10 secs",
+// timeout: 30000,
+// interval: 2000,
+// },
+// ).then(() => cy.wait(1000)); //wait for page load!
+
+// cy.isSelectRow(2); //as aft refresh row selection is also gone
+// cy.getTableDataSelector("2", "18").then((selector) => {
+// cy.get(selector + " button")
+// .click()
+// .wait(1000);
+
+// cy.xpath(
+// "//div//a[contains(@class, 'bp3-menu-item')]/div[text()='AddcreditLimit']/parent::a",
+// )
+// .click()
+// .wait(2000);
+
+// cy.waitUntil(
+// () =>
+// cy
+// .xpath("//div[contains(@class, ' t--widget-textwidget')][1]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .should("contain.text", "CreditLimit:"),
+// {
+// errorMsg: "Execute call did not complete evn after 10 secs",
+// timeout: 20000,
+// interval: 1000,
+// },
+// ).then(() => cy.wait(500)); //allow time for n/w to finish
+
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .invoke("text")
+// .then((addreduce) => {
+// expect(addreduce).to.eq("CreditLimit:Add");
+// });
+// });
+
+// //Manu Btn validation: - 2nd menu item
+// cy.getTableDataSelector("2", "18").then((selector) => {
+// cy.get(selector + " button")
+// .click()
+// .wait(1000);
+
+// cy.xpath(
+// "//div//a[contains(@class, 'bp3-menu-item')]/div[text()='Reducecreditlimit']/parent::a",
+// )
+// .click()
+// .wait(2000);
+
+// cy.waitUntil(
+// () =>
+// cy
+// .xpath("//div[contains(@class, ' t--widget-textwidget')][1]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .should("contain.text", "CreditLimit:"),
+// {
+// errorMsg: "Execute call did not complete evn after 10 secs",
+// timeout: 20000,
+// interval: 1000,
+// },
+// ).then(() => cy.wait(500)); //allow time for n/w to finish
+
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .invoke("text")
+// .then((addreduce) => {
+// expect(addreduce).to.eq("CreditLimit:Reduce");
+// });
+// });
+
+// //Another row!
+// //Card Number mapping to text widget!
+// cy.isSelectRow(4);
+// cy.wait(2500); //time for table row select to reflect!
+// cy.readTabledataPublish("4", "0").then((cardNumber) => {
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
+// .eq(1)
+// .invoke("text")
+// .then((cardNo) => {
+// var format = /^\d{4}-\d{4}-\d{4}(-\d{4})?$/;
+// expect(cardNumber).match(format);
+// expect(cardNumber).to.be.equal(cardNo);
+// });
+// });
+
+// //Address mapping to text widget!
+// cy.readTabledataPublish("4", "4").then((address) => {
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
+// .eq(1)
+// .invoke("text")
+// .then((addr) => {
+// expect(address.replace(/\r?\n|\r/, "")).to.eq(addr);
+// });
+// });
+
+// //Validating Available limit column computation maintained!
+// cy.readTabledataPublish("4", "16").then((availLimit) => {
+// cy.readTabledataPublish("4", "13").then((creditLimit) => {
+// cy.readTabledataPublish("4", "14").then((outstanding) => {
+// expect(Number(availLimit)).to.eq(creditLimit - outstanding);
+// });
+// });
+// });
+
+// //Validating State button click & binding & text widget mapping!
+// cy.getTableDataSelector("4", "15").then((selector) => {
+// cy.get(selector + " button.bp3-button")
+// .click()
+// .wait(2000);
+
+// cy.waitUntil(
+// () =>
+// cy
+// .xpath("//div[contains(@class, ' t--widget-textwidget')][2]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .should("contain.text", "State:"),
+// {
+// errorMsg: "Execute call did not complete evn after 10 secs",
+// timeout: 20000,
+// interval: 1000,
+// },
+// ).then(() => cy.wait(500));
+
+// cy.get(selector + " button span")
+// .invoke("text")
+// .then((statetxt) => {
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
+// .eq(0)
+// .invoke("text")
+// .then((txtWidtxt) => {
+// cy.log("statetxt is:" + statetxt);
+// let text =
+// statetxt == "Activate" ? "State:Inactive" : "State:Active";
+// expect(text).to.eq(txtWidtxt);
+// });
+// });
+// });
+
+// //Validating Image URL click & navigation!
+// cy.getTableDataSelector("4", "19").then((selector) => {
+// // Stubbing window.open to open in the same tab
+// cy.window().then((window) => {
+// cy.stub(window, "open").callsFake((url) => {
+// window.location.href = url; //.substring(1);
+// window.location.target = "_self";
+// });
+// });
+
+// cy.get(selector + " span.bp3-popover-target span")
+// .invoke("text")
+// .then((url) => {
+// cy.get(selector + " span.bp3-popover-target")
+// .click()
+// .wait(2000);
+// cy.wait("@postExecute");
+// cy.url().should("contain", url);
+// cy.go(-1);
+// });
+// });
+
+// //cy.wait(4000);
+// //cy.get("div.tableWrap").should("be.visible");
+
+// cy.waitUntil(
+// () => cy.get("div.tableWrap", { timeout: 30000 }).should("be.visible"),
+// {
+// errorMsg: "Page is not loaded evn after 10 secs",
+// timeout: 30000,
+// interval: 2000,
+// },
+// ).then(() => cy.wait(1000)); //wait for page load!
+
+// //Manu Btn validation: - 1st menu item
+// cy.isSelectRow(4); //as aft refresh row selection is also gone
+// cy.getTableDataSelector("4", "18").then((selector) => {
+// cy.get(selector + " button")
+// .click()
+// .wait(1000);
+
+// cy.xpath(
+// "//div//a[contains(@class, 'bp3-menu-item')]/div[text()='AddcreditLimit']/parent::a",
+// )
+// .click()
+// .wait(2000); //allow time for n/w to finish
+
+// cy.waitUntil(
+// () =>
+// cy
+// .xpath("//div[contains(@class, ' t--widget-textwidget')][1]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .should("contain.text", "CreditLimit:"),
+// {
+// errorMsg: "Execute call did not complete evn after 10 secs",
+// timeout: 20000,
+// interval: 1000,
+// },
+// ).then(() => cy.wait(500)); //allow time for n/w to finish
+
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .invoke("text")
+// .then((addreduce) => {
+// expect(addreduce).to.eq("CreditLimit:Add");
+// });
+// });
+
+// //Manu Btn validation: - 2nd menu item
+// cy.getTableDataSelector("4", "18").then((selector) => {
+// cy.get(selector + " button")
+// .click()
+// .wait(1000);
+
+// cy.xpath(
+// "//div//a[contains(@class, 'bp3-menu-item')]/div[text()='Reducecreditlimit']/parent::a",
+// )
+// .click()
+// .wait(2000); //allow time for n/w to finish
+
+// cy.waitUntil(
+// () =>
+// cy
+// .xpath("//div[contains(@class, ' t--widget-textwidget')][1]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .should("contain.text", "CreditLimit:"),
+// {
+// errorMsg: "Execute call did not complete evn after 10 secs",
+// timeout: 20000,
+// interval: 1000,
+// },
+// ).then(() => cy.wait(500)); //allow time for n/w to finish
+
+// cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]", {
+// timeout: 30000,
+// })
+// .eq(0)
+// .invoke("text")
+// .then((addreduce) => {
+// expect(addreduce).to.eq("CreditLimit:Reduce");
+// });
+// });
+// });
+
+// //Page 2 Validations:
+
+// cy.selectEntityByName("Change color and font");
+// cy.selectEntityByName("WIDGETS");
+// cy.selectEntityByName("Table1");
+
+// cy.get(widgetsPage.bold)
+// .invoke("attr", "aria-selected")
+// .then((sel) => expect(Boolean(sel)).to.be.true);
+// cy.get(widgetsPage.centerAlign)
+// .eq(0)
+// .invoke("attr", "aria-selected")
+// .then((sel) => expect(Boolean(sel)).to.be.true); //Text align
+// cy.get(widgetsPage.centerAlign)
+// .eq(1)
+// .invoke("attr", "aria-selected")
+// .then((sel) => expect(Boolean(sel)).to.be.true); //Vertical align
+// cy.get(widgetsPage.textColor)
+// .first()
+// .invoke("attr", "value")
+// .should("contain", "#2E3D49");
+// cy.get(`${widgetsPage.cellBackground} input`)
+// .first()
+// .invoke("attr", "value")
+// .should("contain", "#FFC13D");
+// cy.get(widgetsPage.selectedTextSize).should("have.text", "24px");
+// });
+// });
diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/MongoDBShoppingCart_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/MongoDBShoppingCart_spec.js
index 9d6f9d169253..54669898d461 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/Application/MongoDBShoppingCart_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/Application/MongoDBShoppingCart_spec.js
@@ -16,7 +16,6 @@ describe("Shopping cart App", function() {
it("1. Create MongoDB datasource and add Insert, Find, Update and Delete queries", function() {
cy.NavigateToDatasourceEditor();
cy.get(datasource.MongoDB).click();
- cy.getPluginFormsAndCreateDatasource();
cy.fillMongoDatasourceForm();
cy.testSaveDatasource();
cy.get("@createDatasource").then((httpResponse) => {
@@ -32,9 +31,7 @@ describe("Shopping cart App", function() {
cy.get(".CodeEditorTarget")
.first()
.type("Productnames");
- // cy.get(".CodeEditorTarget")
- // .eq(1)
- // .type("{}");
+ cy.assertPageSave();
cy.get(appPage.dropdownChevronLeft).click();
// EditProducts query to update the cart
cy.get(queryLocators.createQuery)
@@ -56,16 +53,15 @@ describe("Shopping cart App", function() {
cy.get(".CodeEditorTarget")
.eq(2)
.type(
- `{
- "title" : "{{title.text}}",
+ `{"title" : "{{title.text}}",
"description" :"{{description.text}}",
"price" : {{price.text}},
- "quantity":{{quantity.text}}
- `,
+ "quantity":{{quantity.text}}`,
{
parseSpecialCharSequences: false,
},
);
+ cy.assertPageSave();
cy.get(appPage.dropdownChevronLeft).click();
// Add product query
cy.get(queryLocators.createQuery)
@@ -82,14 +78,13 @@ describe("Shopping cart App", function() {
cy.get(".CodeEditorTarget")
.eq(1)
.type(
- `[{
- "title" : "{{Title.text}}",
+ `[{"title" : "{{Title.text}}",
"description": "{{Description.text}}",
"price" : {{Price.text}},
- "quantity" : {{Quantity.text}}
- `,
+ "quantity" : {{Quantity.text}}`,
{ parseSpecialCharSequences: false },
);
+ cy.assertPageSave();
cy.get(appPage.dropdownChevronLeft).click();
// delete product
cy.get(queryLocators.createQuery)
@@ -108,6 +103,8 @@ describe("Shopping cart App", function() {
.type('{"title":"{{Table1.selectedRow.title}}"}', {
parseSpecialCharSequences: false,
});
+ cy.assertPageSave();
+
cy.get(appPage.dropdownChevronLeft).click();
cy.get(appPage.dropdownChevronLeft).click();
});
@@ -161,6 +158,8 @@ describe("Shopping cart App", function() {
.closest("div")
.eq(0)
.click();
+ cy.assertPageSave();
+ cy.wait(5000);
// validating updated value in the cart
cy.get(".selected-row")
.children()
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActiveDatasource/ActiveDatasource.spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActiveDatasource/ActiveDatasource_spec.js
similarity index 95%
rename from app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActiveDatasource/ActiveDatasource.spec.js
rename to app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActiveDatasource/ActiveDatasource_spec.js
index ea247259312c..016f46dac57a 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActiveDatasource/ActiveDatasource.spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActiveDatasource/ActiveDatasource_spec.js
@@ -2,7 +2,7 @@ const datasourceEditor = require("../../../../locators/DatasourcesEditor.json");
const queryEditor = require("../../../../locators/QueryEditor.json");
let datasourceName, actionName;
-describe("Google Sheet datasource test cases", function() {
+describe("Mongo Active datasource test cases", function() {
before(() => {
cy.NavigateToDatasourceEditor();
cy.get(datasourceEditor.MongoDB).click();
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Applications/ForkApplication_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Applications/ForkApplication_spec.js
index a480cb640d78..0f5e4bff006e 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Applications/ForkApplication_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Applications/ForkApplication_spec.js
@@ -1,7 +1,5 @@
const dsl = require("../../../../fixtures/basicDsl.json");
import homePage from "../../../../locators/HomePage";
-const commonlocators = require("../../../../locators/commonlocators.json");
-const widgetsPage = require("../../../../locators/Widgets.json");
let forkedApplicationDsl;
let parentApplicationDsl;
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToInput_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToInput_Spec.ts
index 620421f048de..257ae1e40bc7 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToInput_Spec.ts
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToInput_Spec.ts
@@ -15,7 +15,7 @@ describe("Validate Create Api and Bind to Table widget via JSObject", () => {
it("1. Bind Input widget with JSObject", function () {
jsEditor.CreateJSObject('return "Success";', false);
- agHelper.SelectEntityByName("WIDGETS")//to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS")//to expand widgets
agHelper.expandCollapseEntity("Form1")
agHelper.SelectEntityByName("Input2")
cy.get("@jsObjName").then((jsObjName) => {
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Promises_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Promises_Spec.ts
index b3115ca38f10..611689957b6a 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Promises_Spec.ts
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Promises_Spec.ts
@@ -15,7 +15,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
cy.fixture('promisesBtnDsl').then((val: any) => {
agHelper.AddDsl(val)
});
- agHelper.SelectEntityByName("WIDGETS")//to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS")//to expand widgets
agHelper.SelectEntityByName("Button1");
jsEditor.EnterJSContext('onclick', "{{storeValue('date', Date()).then(() => showAlert(appsmith.store.date))}}", true, true);
agHelper.ClickButton('Submit')
@@ -29,7 +29,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
cy.fixture("promisesBtnDsl").then((val: any) => {
agHelper.AddDsl(val);
});
- agHelper.SelectEntityByName("WIDGETS");
+ agHelper.expandCollapseEntity("WIDGETS");
agHelper.SelectEntityByName("Button1");
jsEditor.EnterJSContext(
"onclick",
@@ -61,7 +61,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
key: "name",
value: "{{this.params.country}}",
}); // verifies Bug 10055
- agHelper.SelectEntityByName("WIDGETS");
+ agHelper.expandCollapseEntity("WIDGETS");
agHelper.SelectEntityByName("Button1");
jsEditor.EnterJSContext(
"onclick",
@@ -93,7 +93,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
"https://source.unsplash.com/collection/8439505",
"Christmas",
);
- agHelper.SelectEntityByName("WIDGETS"); //to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS"); //to expand widgets
agHelper.SelectEntityByName("Button1");
jsEditor.EnterJSContext(
"onclick",
@@ -108,7 +108,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
true,
);
agHelper.SelectEntityByName("Image1");
- jsEditor.EnterJSContext("image", `{{ Christmas.data }}`, true);
+ jsEditor.EnterJSContext("image", `{{Christmas.data}}`, true);
agHelper.WaitUntilEleDisappear(
locator._toastMsg,
"will be executed automatically on page load",
@@ -126,7 +126,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
apiPage.CreateAndFillApi("https://favqs.com/api/qotd", "InspiringQuotes");
jsEditor.CreateJSObject(`const user = 'You';
return InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + user + " is " + JSON.stringify(res.quote.body), 'success') }).catch(() => showAlert("Unable to fetch quote for " + user, 'warning'))`);
- agHelper.SelectEntityByName("WIDGETS"); //to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS"); //to expand widgets
agHelper.SelectEntityByName("Button1");
cy.get("@jsObjName").then((jsObjName) => {
jsEditor.EnterJSContext('onclick', "{{" + jsObjName + ".myFun1()}}", true, true);
@@ -137,35 +137,20 @@ return InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + us
.should("contain.text", "Today's quote for You");
});
- //Skipping until this bug is closed!
- it.skip("6. Bug 9782: Verify .then & .catch (show alert should trigger) via JS Objects without return keyword", () => {
- cy.fixture('promisesBtnDsl').then((val: any) => {
- agHelper.AddDsl(val)
- });
- jsEditor.CreateJSObject(`const user = 'You';
-InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + user + " is " + JSON.stringify(res.quote.body), 'success') }).catch(() => showAlert("Unable to fetch quote for " + user, 'warning'))`);
- agHelper.SelectEntityByName("Button1");
- cy.get("@jsObjName").then((jsObjName) => {
- jsEditor.EnterJSContext('onclick', "{{" + jsObjName + ".myFun1()}}", true, true);
- });
- agHelper.ClickButton('Submit')
- cy.get(locator._toastMsg).should("have.length", 1).should("contain.text", "Today's quote for You");
- });
-
- it("7. Verify Promise.race via direct Promises", () => {
+ it("6. Verify Promise.race via direct Promises", () => {
cy.fixture('promisesBtnDsl').then((val: any) => {
agHelper.AddDsl(val)
});
apiPage.CreateAndFillApi("https://api.agify.io?name={{this.params.person}}", "Agify")
apiPage.ValidateQueryParams({ key: "name", value: "{{this.params.person}}" }); // verifies Bug 10055
- agHelper.SelectEntityByName("WIDGETS")
+ agHelper.expandCollapseEntity("WIDGETS")
agHelper.SelectEntityByName("Button1");
jsEditor.EnterJSContext('onclick', `{{ Promise.race([Agify.run({ person: 'Melinda' }), Agify.run({ person: 'Trump' })]).then((res) => { showAlert('Winner is ' + JSON.stringify(res.name), 'success') }) }} `, true, true);
agHelper.ClickButton('Submit')
cy.get(locator._toastMsg).should("have.length", 1).contains(/Melinda|Trump/g)
})
- it("8. Verify maintaining context via direct Promises", () => {
+ it("7. Verify maintaining context via direct Promises", () => {
cy.fixture("promisesBtnListDsl").then((val: any) => {
agHelper.AddDsl(val);
});
@@ -173,7 +158,7 @@ InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + user + "
"https://api.jikan.moe/v3/search/anime?q={{this.params.name}}",
"GetAnime",
);
- agHelper.SelectEntityByName("WIDGETS"); //to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS"); //to expand widgets
agHelper.SelectEntityByName("List1");
jsEditor.EnterJSContext(
"items",
@@ -218,11 +203,11 @@ InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + user + "
.should("have.text", "Showing results for : fruits basket : the final");
});
- it("9: Verify Promise.all via direct Promises", () => {
+ it("8: Verify Promise.all via direct Promises", () => {
cy.fixture('promisesBtnDsl').then((val: any) => {
agHelper.AddDsl(val)
});
- agHelper.SelectEntityByName("WIDGETS")//to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS")//to expand widgets
agHelper.SelectEntityByName("Button1");
jsEditor.EnterJSContext('onclick', `{{
(function () {
@@ -239,60 +224,74 @@ InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + user + "
cy.get(locator._toastMsg).should("have.length", 1).should("have.text", "cat,dog,camel,rabbit,rat")
});
- //Skipping until this bug is closed!
-
- it.skip("10. Bug 10150: Verify Promise.all via JSObjects", () => {
+ it("9. Bug 10150: Verify Promise.all via JSObjects", () => {
let date = new Date().toDateString();
cy.fixture('promisesBtnDsl').then((val: any) => {
agHelper.AddDsl(val)
});
jsEditor.CreateJSObject(`let allFuncs = [Genderize.run({ country: 'India' }),
RandomUser.run(),
-GetAnime.run({ name: 'Odd Taxi' }),
+GetAnime.run({ name: 'Gintama' }),
InspiringQuotes.run(),
Agify.run({ person: 'Scripty' }),
Christmas.run()
]
-return Promise.all(allFuncs).then(() => showAlert("Wonderful! all apis executed", "success")).catch(() => showAlert("Please check your api's again", "error")); `)
+showAlert("Running all api's", "warning");
+return Promise.all(allFuncs).then(() =>
+showAlert("Wonderful! all apis executed", "success")).catch(() => showAlert("Please check your api's again", "error")); `)
- // apiPage.CreateAndFillApi("https://api.agify.io?name={{this.params.person}}", "Agify")
- // apiPage.ValidateQueryParams({ key: "name", value: "{{this.params.person}}" }); // verifies Bug 10055
- agHelper.SelectEntityByName("WIDGETS")
+ agHelper.expandCollapseEntity("WIDGETS")
agHelper.SelectEntityByName("Button1");
cy.get("@jsObjName").then((jsObjName) => {
- jsEditor.EnterJSContext('onclick', "{{storeValue('date', Date()).then(() => { showAlert(appsmith.store.date, 'success'); " + jsObjName + ".myFun1()})}}", true, true);
+ jsEditor.EnterJSContext('onclick', "{{storeValue('date', Date()).then(() => { showAlert(appsmith.store.date, 'success'); return " + jsObjName + ".myFun1()})}}", true, true);
});
agHelper.ClickButton('Submit')
- cy.get(locator._toastMsg).should("have.length", 2)
- cy.get(locator._toastMsg).first().should('contain.text', date)
+ agHelper.WaitUntilEleAppear(locator._toastMsg)
+ cy.get(locator._toastMsg).should("have.length", 3)
+ cy.get(locator._toastMsg).eq(0).should('contain.text', date)
+ cy.get(locator._toastMsg).eq(1).contains("Running all api's")
+ agHelper.WaitUntilEleAppear(locator._toastMsg)
cy.get(locator._toastMsg).last().contains(/Wonderful|Please check/g)
});
- //To skip until clarified
- it.skip("11. Verify Promises.any via direct Promises", () => {
+ it("10. Verify Promises.any via direct JSObjects", () => {
cy.fixture('promisesBtnDsl').then((val: any) => {
agHelper.AddDsl(val)
});
+ jsEditor.CreateJSObject(`export default {
+ func2: async () => {
+ return Promise.reject(new Error('fail')).then(showAlert("Promises reject from func2"));
+ },
+ func1: async () => {
+ showAlert("In func1")
+ return "func1"
+ },
+ func3: async () => {
+ showAlert("In func3")
+ return "func3"
+ },
+ runAny: async () => {
+ return Promise.any([this.func2(), this.func3(), this.func1()]).then((value) => showAlert("Resolved promise is:" + value))
+ }
+ }`, true, true)
+ agHelper.expandCollapseEntity('WIDGETS')
agHelper.SelectEntityByName("Button1");
- jsEditor.EnterJSContext('onclick', `{{
- const promise1 = Promise.reject(0);
- const promise2 = new Promise((resolve) => setTimeout(resolve, 100, 'quick'));
- const promise3 = new Promise((resolve) => setTimeout(resolve, 500, 'slow'));
- const promises = [promise1, promise2, promise3];
- Promise.any(promises).then((value) => showAlert("Resolved promise is:" + value));
- }} `, true, true);
+ cy.get("@jsObjName").then((jsObjName) => {
+ jsEditor.EnterJSContext('onclick', "{{" + jsObjName + ".runAny()}}", true, true);
+ });
agHelper.ClickButton('Submit')
cy.get(locator._toastMsg)
- .should("have.length", 1)
- .should("contain.text", "We are on planet Earth");
+ .should("have.length", 4)
+ cy.get(locator._toastMsg).eq(0).contains('Promises reject from func2')
+ cy.get(locator._toastMsg).last().contains('Resolved promise is:func3')
});
- it("12. Verify resetWidget via .then direct Promises", () => {
+ it("11. Bug : 11110 - Verify resetWidget via .then direct Promises", () => {
cy.fixture("promisesBtnDsl").then((dsl: any) => {
agHelper.AddDsl(dsl);
});
- agHelper.SelectEntityByName("WIDGETS"); //to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS"); //to expand widgets
agHelper.SelectEntityByName("Button1");
jsEditor.EnterJSContext(
"onclick",
@@ -310,6 +309,21 @@ return Promise.all(allFuncs).then(() => showAlert("Wonderful! all apis executed"
agHelper.NavigateBacktoEditor()
})
+ //Skipping until this bug this is addressed!
+ it.skip("12. Bug 9782: Verify .then & .catch (show alert should trigger) via JS Objects without return keyword", () => {
+ cy.fixture('promisesBtnDsl').then((val: any) => {
+ agHelper.AddDsl(val)
+ });
+ jsEditor.CreateJSObject(`const user = 'You';
+InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + user + " is " + JSON.stringify(res.quote.body), 'success') }).catch(() => showAlert("Unable to fetch quote for " + user, 'warning'))`);
+ agHelper.SelectEntityByName("Button1");
+ cy.get("@jsObjName").then((jsObjName) => {
+ jsEditor.EnterJSContext('onclick', "{{" + jsObjName + ".myFun1()}}", true, true);
+ });
+ agHelper.ClickButton('Submit')
+ cy.get(locator._toastMsg).should("have.length", 1).should("contain.text", "Today's quote for You");
+ });
+
})
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/ChartDataPoint_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/ChartDataPoint_Spec.ts
index d7c7ff25fdb2..42ad7250636b 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/ChartDataPoint_Spec.ts
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/ChartDataPoint_Spec.ts
@@ -21,7 +21,7 @@ describe("Input widget test with default value from chart datapoint", () => {
});
it("1. Input widget test with default value from another Input widget", () => {
- agHelper.SelectEntityByName("WIDGETS")
+ agHelper.expandCollapseEntity("WIDGETS")
agHelper.SelectEntityByName("Input1")
jsEditor.EnterJSContext("defaulttext", dataSet.bindChartData + "}}");
agHelper.ValidateNetworkCallRespPut('@updateLayout')
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/DocumentViewer_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/DocumentViewer_Spec.ts
index b6dc52340da8..8b1f0d9aca8b 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/DocumentViewer_Spec.ts
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/DocumentViewer_Spec.ts
@@ -11,7 +11,7 @@ describe("DocumentViewer Widget Functionality", () => {
it("2. Modify visibility & Publish app & verify", () => {
agHelper.NavigateToExplorer();
- cy.CheckAndUnfoldEntityItem("WIDGETS"); //to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS"); //to expand widgets
agHelper.SelectEntityByName("DocumentViewer1");
agHelper.ToggleOrDisable("visible", false);
agHelper.DeployApp();
@@ -22,7 +22,7 @@ describe("DocumentViewer Widget Functionality", () => {
});
it("3. Change visibility & Publish app & verify again", () => {
- cy.CheckAndUnfoldEntityItem("WIDGETS"); //to expand widgets
+ agHelper.expandCollapseEntity("WIDGETS"); //to expand widgets
agHelper.SelectEntityByName("DocumentViewer1");
agHelper.ToggleOrDisable("visible");
agHelper.DeployApp();
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Dropdown_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Dropdown_spec.js
index cb628053f057..1d550d9ca0d4 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Dropdown_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Dropdown_spec.js
@@ -66,12 +66,11 @@ describe("Dropdown Widget Functionality", function() {
);
});
- it.skip("should check that Objects can be added to Select Widget default value", () => {
+ it("should check that Objects can be added to Select Widget default value", () => {
cy.openPropertyPane("selectwidget");
cy.updateCodeInput(
".t--property-control-options",
- `[
- {
+ `[{
"label": "Blue",
"value": "BLUE"
},
@@ -82,25 +81,16 @@ describe("Dropdown Widget Functionality", function() {
{
"label": "Red",
"value": "RED"
- }
- ]`,
- );
- cy.updateCodeInput(
- ".t--property-control-defaultvalue",
- `
- {
- "label": "Green",
- "value": "GREEN"
- }
- `,
+ }]`,
);
+ cy.updateCodeInput(".t--property-control-defaultvalue", "BLUE");
cy.get(".t--property-control-options .t--codemirror-has-error").should(
"not.exist",
);
cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should(
"not.exist",
);
- cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Green");
+ cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Blue");
});
it("Dropdown Functionality To Check disabled Widget", function() {
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/List_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/List_spec.js
index 417b35579024..3fffe2de6a1b 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/List_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/List_spec.js
@@ -8,7 +8,7 @@ describe("List Widget Functionality", function() {
});
it("should validate that restricted widgets cannot be added to List", () => {
- cy.get(explorer.addWidget).click();
+ cy.get(explorer.widgetSwitchId).click();
const allowed = [
"audiowidget",
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Color_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Color_spec.js
new file mode 100644
index 000000000000..44f1f860b2f1
--- /dev/null
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Color_spec.js
@@ -0,0 +1,78 @@
+const widgetsPage = require("../../../../locators/Widgets.json");
+const dsl = require("../../../../fixtures/tableNewDsl.json");
+const publish = require("../../../../locators/publishWidgetspage.json");
+
+describe("Table Widget property pane feature validation", function() {
+ before(() => {
+ cy.addDsl(dsl);
+ });
+
+ it("1. Test to validate text color and text background", function() {
+ // Open property pane
+ cy.openPropertyPane("tablewidget");
+ // Click on text color input field
+ cy.get(widgetsPage.textColor)
+ .first()
+ .click({ force: true });
+ // Select green color
+ cy.get(widgetsPage.greenColor)
+ .last()
+ .click();
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
+ cy.wait(500);
+ cy.wait("@updateLayout");
+ // Verify the text color is green
+ cy.readTabledataValidateCSS("1", "0", "color", "rgb(3, 179, 101)");
+ // Change the text color and enter purple in input field
+ cy.get(widgetsPage.textColor)
+ .scrollIntoView()
+ .clear({ force: true })
+ .type("purple", { force: true });
+ cy.wait("@updateLayout");
+ // Verify the text color is purple
+ cy.readTabledataValidateCSS("1", "0", "color", "rgb(128, 0, 128)");
+ // Click on cell background color
+ cy.get(`${widgetsPage.cellBackground} input`)
+ .first()
+ .scrollIntoView()
+ .click({ force: true });
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
+ cy.wait(500);
+ // select the green color
+ cy.get(widgetsPage.greenColor)
+ .last()
+ .click();
+ cy.wait("@updateLayout");
+ cy.assertPageSave();
+ cy.PublishtheApp();
+ cy.wait(4000);
+
+ // Verify the cell background color is green
+ cy.readTabledataValidateCSS(
+ "1",
+ "1",
+ "background-color",
+ "rgb(3, 179, 101)",
+ );
+ cy.get(publish.backToEditor).click();
+ cy.openPropertyPane("tablewidget");
+
+ // Change the cell background color and enter purple in input field
+ cy.get(`${widgetsPage.cellBackground} input`)
+ .clear({ force: true })
+ .type("purple", { force: true });
+ cy.wait("@updateLayout");
+ cy.assertPageSave();
+ cy.PublishtheApp();
+ cy.wait(4000);
+
+ // Verify the cell background color is purple
+ cy.readTabledataValidateCSS(
+ "1",
+ "1",
+ "background-color",
+ "rgb(128, 0, 128)",
+ );
+ cy.get(publish.backToEditor).click();
+ });
+});
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_GeneralProperty_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_GeneralProperty_spec.js
index 8517c6ba268b..8b46421a4474 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_GeneralProperty_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_GeneralProperty_spec.js
@@ -199,74 +199,4 @@ describe("Table Widget property pane feature validation", function() {
cy.get(publish.backToEditor).click();
cy.wait(2000);
});
-
- it("11. Test to validate text color and text background", function() {
- // Open property pane
- cy.openPropertyPane("tablewidget");
- // Click on text color input field
- cy.get(widgetsPage.textColor)
- .first()
- .click({ force: true });
- // Select green color
- cy.get(widgetsPage.greenColor)
- .last()
- .click();
- // eslint-disable-next-line cypress/no-unnecessary-waiting
- cy.wait(500);
- cy.wait("@updateLayout");
- // Verify the text color is green
- cy.readTabledataValidateCSS("1", "0", "color", "rgb(3, 179, 101)");
- // Change the text color and enter purple in input field
- cy.get(widgetsPage.textColor)
- .scrollIntoView()
- .clear({ force: true })
- .type("purple", { force: true });
- cy.wait("@updateLayout");
- // Verify the text color is purple
- cy.readTabledataValidateCSS("1", "0", "color", "rgb(128, 0, 128)");
- // Click on cell background color
- cy.get(`${widgetsPage.cellBackground} input`)
- .first()
- .scrollIntoView()
- .click({ force: true });
- // eslint-disable-next-line cypress/no-unnecessary-waiting
- cy.wait(500);
- // select the green color
- cy.get(widgetsPage.greenColor)
- .last()
- .click();
- cy.wait("@updateLayout");
- cy.wait(2000);
-
- cy.PublishtheApp();
- cy.wait(4000);
-
- // Verify the cell background color is green
- cy.readTabledataValidateCSS(
- "1",
- "1",
- "background",
- "rgb(3, 179, 101) none repeat scroll 0% 0% / auto padding-box border-box",
- );
- cy.get(publish.backToEditor).click();
- cy.openPropertyPane("tablewidget");
-
- // Change the cell background color and enter purple in input field
- cy.get(`${widgetsPage.cellBackground} input`)
- .clear({ force: true })
- .type("purple", { force: true });
- cy.wait("@updateLayout");
- cy.wait(2000);
- cy.PublishtheApp();
- cy.wait(4000);
-
- // Verify the cell background color is purple
- cy.readTabledataValidateCSS(
- "1",
- "1",
- "background",
- "rgb(128, 0, 128) none repeat scroll 0% 0% / auto padding-box border-box",
- );
- cy.get(publish.backToEditor).click();
- });
});
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Widget_Add_button_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Widget_Add_button_spec.js
index d3bba9248e64..d39ecf37b259 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Widget_Add_button_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Widget_Add_button_spec.js
@@ -208,16 +208,16 @@ describe("Table Widget property pane feature validation", function() {
const color1 = "rgb(255, 255, 0)";
cy.get(widgetsPage.menuColor)
- .click({ force: true })
.clear()
+ .click({ force: true })
.type(color1);
cy.get(widgetsPage.tableBtn).should("have.css", "background-color", color1);
// Changing the color again to reproduce issue #9526
const color2 = "rgb(255, 0, 0)";
cy.get(widgetsPage.menuColor)
- .click({ force: true })
.clear()
+ .click({ force: true })
// following wait is required to reproduce #9526
.wait(500)
.type(color2);
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/LayoutWidgets/List_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/LayoutWidgets/List_spec.js
index 5af2edf63735..dd474c720315 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/LayoutWidgets/List_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/LayoutWidgets/List_spec.js
@@ -1,3 +1,5 @@
+/// <reference types="Cypress" />
+
const commonlocators = require("../../../../locators/commonlocators.json");
const widgetsPage = require("../../../../locators/Widgets.json");
const dsl = require("../../../../fixtures/listdsl.json");
@@ -8,11 +10,13 @@ describe("Container Widget Functionality", function() {
before(() => {
cy.addDsl(dsl);
+ cy.wait(5000);
});
- it("List-Unckeck Visible field Validation", function() {
+ it("1. List-Unckeck Visible field Validation", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
//Uncheck the disabled checkbox and validate
cy.UncheckWidgetProperties(commonlocators.visibleCheckbox);
cy.PublishtheApp();
@@ -20,9 +24,10 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("List-Check Visible field Validation", function() {
+ it("2. List-Check Visible field Validation", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
//Check the disableed checkbox and Validate
cy.CheckWidgetProperties(commonlocators.visibleCheckbox);
cy.PublishtheApp();
@@ -30,9 +35,10 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("Toggle JS - List-Unckeck Visible field Validation", function() {
+ it("3. Toggle JS - List-Unckeck Visible field Validation", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
//Uncheck the disabled checkbox using JS and validate
cy.get(widgetsPage.toggleVisible).click({ force: true });
cy.testJsontext("visible", "false");
@@ -41,9 +47,10 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("Toggle JS - List-Check Visible field Validation", function() {
+ it("4. Toggle JS - List-Check Visible field Validation", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
//Check the disabled checkbox using JS and Validate
cy.testJsontext("visible", "true");
cy.PublishtheApp();
@@ -51,16 +58,20 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("checks if list shows correct no. of items", function() {
+ it("5. checks if list shows correct no. of items", function() {
// Verify the length of list
cy.get(commonlocators.containerWidget).then(function($lis) {
expect($lis).to.have.length(2);
});
});
- it("checks currentItem binding", function() {
+ it("6. checks currentItem binding", function() {
// Open property pane
- cy.SearchEntityandOpen("Text1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.CheckAndUnfoldEntityItem("List1");
+ cy.CheckAndUnfoldEntityItem("Container1");
+ cy.selectEntityByName("Text1");
+ //cy.SearchEntityandOpen("Text1");
cy.testJsontext("text", `{{currentItem.first_name}}`);
cy.wait(1000);
@@ -72,11 +83,15 @@ describe("Container Widget Functionality", function() {
});
});
- it("checks button action", function() {
+ it("7. checks button action", function() {
// Open property pane
- cy.SearchEntityandOpen("Button1");
- cy.testJsontext("label", `{{currentItem.first_name}}`);
- cy.addAction("{{currentItem.first_name}}");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.CheckAndUnfoldEntityItem("List1");
+ cy.CheckAndUnfoldEntityItem("Container1");
+ cy.selectEntityByName("Button1");
+ //cy.SearchEntityandOpen("Button1");
+ cy.testJsontext("label", `{{currentItem.last_name}}`);
+ cy.addAction("{{currentItem.last_name}}");
cy.PublishtheApp();
// Verify Widget Button by clicking on it
@@ -84,14 +99,15 @@ describe("Container Widget Functionality", function() {
.first()
.click();
// Verify the click on first button
- cy.get(commonlocators.toastmsg).contains(items[0].first_name);
+ cy.get(commonlocators.toastmsg).contains(items[0].last_name);
});
- it("it checks onListItem click action", function() {
+ it("8. it checks onListItem click action", function() {
// Verify Clicking on list item shows message of first name
cy.get(publishPage.backToEditor).click({ force: true });
// Open property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
// Verify Action type and Message of List Item
cy.addAction("{{currentItem.first_name}}");
@@ -104,7 +120,7 @@ describe("Container Widget Functionality", function() {
cy.get(commonlocators.toastmsg).contains(items[0].first_name);
});
- it("it checks pagination", function() {
+ it("9. it checks pagination", function() {
// clicking on second pagination button
cy.get(`${commonlocators.paginationButton}-2`).click();
@@ -115,28 +131,23 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("Chart-Copy Verification", function() {
+ it("10. ListWidget-Copy & Delete Verification", function() {
const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl";
//Copy Chart and verify all properties
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
cy.copyWidget("List1Copy", commonlocators.containerWidget);
-
- // cy.PublishtheApp();
- });
-
- it("Chart-Delete Verification", function() {
- // Delete the Chart widget
- cy.SearchEntityandOpen("List1Copy");
cy.deleteWidget();
cy.PublishtheApp();
- // Verify the cart is deleted
- cy.get(commonlocators.containerWidget).should("not.exist");
+ // Verify the copied list widget is deleted
+ cy.get(commonlocators.containerWidget).should("have.length", 2);
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("List widget background colour and deploy ", function() {
+ it("11. List widget background colour and deploy ", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
// Scroll down to Styles and Add background colour
cy.selectColor("backgroundcolor");
cy.wait(1000);
@@ -158,9 +169,10 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("Toggle JS - List widget background colour and deploy ", function() {
+ it("12. Toggle JS - List widget background colour and deploy ", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
// Scroll down to Styles and Add background colour
cy.get(widgetsPage.backgroundColorToggle).click({ force: true });
cy.testJsontext("backgroundcolor", "#FFC13D");
@@ -184,9 +196,10 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("Add new item in the list widget array object", function() {
+ it("13. Add new item in the list widget array object", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
//Add the new item in the list
cy.testJsontext("items", JSON.stringify(this.data.ListItems));
cy.wait(2000);
@@ -194,9 +207,10 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("Adding large item Spacing for item card", function() {
+ it("14. Adding large item Spacing for item card", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
// Scroll down to Styles and Add item spacing for item card
cy.testJsontext("itemspacing\\(" + "px" + "\\)", 12);
cy.wait(2000);
@@ -205,9 +219,10 @@ describe("Container Widget Functionality", function() {
cy.get(publishPage.backToEditor).click({ force: true });
});
- it("Renaming the widget from Property pane and Entity explorer ", function() {
+ it("15. Renaming the widget from Property pane and Entity explorer ", function() {
// Open Property pane
- cy.SearchEntityandOpen("List1");
+ cy.CheckAndUnfoldEntityItem("WIDGETS");
+ cy.selectEntityByName("List1");
// Change the list widget name from property pane and Verify it
cy.widgetText(
"List2",
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Pages/Page_Load_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Pages/Page_Load_Spec.js
index d8bcc0779360..992837e227ea 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Pages/Page_Load_Spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Pages/Page_Load_Spec.js
@@ -15,7 +15,8 @@ describe("Page Load tests", () => {
cy.get("h2").contains("Drag and drop a widget here");
});
- it("Published page loads correctly", () => {
+
+ it("1. Published page loads correctly", () => {
//add page within page
cy.addDsl(dsl);
// Update the text to be asserted later
@@ -70,20 +71,17 @@ describe("Page Load tests", () => {
);
});
- it.skip("Hide Page and validate published app", () => {
+ it("2. Hide Page and validate published app", () => {
cy.get(publish.backToEditor).click();
- cy.GlobalSearchEntity("Page1");
- cy.xpath(pages.popover)
- .last()
- .click({ force: true });
- cy.get(pages.hidePage).click({ force: true });
- cy.ClearSearch();
+ cy.actionContextMenuByEntityName("Page1", "Hide");
cy.PublishtheApp();
// Assert active page DSL
cy.get(commonlocators.headingTextStyle).should(
"have.text",
"This is Page 1",
);
+ cy.contains("Page2").should("not.exist");
+
cy.get(publish.backToEditor).click();
cy.SearchEntityandOpen("Page2");
cy.PublishtheApp();
@@ -92,5 +90,6 @@ describe("Page Load tests", () => {
"have.text",
"This is Page 2",
);
+ cy.contains("Page1").should("not.exist");
});
});
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js
index 9824c2c0d05d..e0099ecbcab3 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js
@@ -29,7 +29,10 @@ describe("Undo/Redo functionality", function() {
cy.get(datasourceEditor.password).type(
datasourceFormData["postgres-password"],
);
- cy.get(datasourceEditor.sectionAuthentication).click();
+ cy.get(datasourceEditor.sectionAuthentication)
+ .trigger("click")
+ .wait(1000);
+
cy.get("body").type(`{${modifierKey}}z`);
cy.get(
`${datasourceEditor.sectionAuthentication} .bp3-icon-chevron-up`,
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/SMTPDatasource_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/SMTPDatasource_spec.js
index 79e0c0dc7d88..b7903d781b1b 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/SMTPDatasource_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/SMTPDatasource_spec.js
@@ -85,6 +85,7 @@ describe("SMTP datasource test cases using ted", function() {
);
});
});
+
/* it("3. On canvas, fill to email, from email, subject, body, attachment and run query", function() {
cy.get(`.t--entity-name:contains("smtpquery")`)
.should("be.visible")
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/EditorContextMenu_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/EditorContextMenu_Spec.ts
index 31bebf6a4798..bf9536798eac 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/EditorContextMenu_Spec.ts
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/EditorContextMenu_Spec.ts
@@ -9,6 +9,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
it("1. Validate JSObject creation & Run", () => {
jsEditor.CreateJSObject('return "Hello World";');
+ agHelper.expandCollapseEntity("QUERIES/JS");
agHelper.ValidateEntityPresenceInExplorer("JSObject1");
jsEditor.validateDefaultJSObjProperties("JSObject1");
});
@@ -45,7 +46,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
agHelper.AddNewPage();
agHelper.ValidateEntityPresenceInExplorer(newPageId);
agHelper.SelectEntityByName(pageId);
- cy.CheckAndUnfoldEntityItem("QUERIES/JS");
+ agHelper.expandCollapseEntity("QUERIES/JS");
agHelper.ActionContextMenuByEntityName(
"RenamedJSObjectCopy",
"Move to page",
@@ -58,7 +59,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () =
it("6. Validate Deletion of JSObject", function() {
agHelper.SelectEntityByName(pageId);
- cy.CheckAndUnfoldEntityItem("QUERIES/JS");
+ agHelper.expandCollapseEntity("QUERIES/JS");
agHelper.ActionContextMenuByEntityName("ExplorerRenamed", "Delete");
agHelper.ValidateEntityAbsenceInExplorer("ExplorerRenamed");
});
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/Entity_Explorer_CopyQuery_RenameDatasource_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/Entity_Explorer_CopyQuery_RenameDatasource_spec.js
index f4ec5177eefe..e65d776373f6 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/Entity_Explorer_CopyQuery_RenameDatasource_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/Entity_Explorer_CopyQuery_RenameDatasource_spec.js
@@ -13,7 +13,13 @@ describe("Entity explorer tests related to copy query", function() {
cy.startRoutesForDatasource();
});
- it("1. Create a query with dataSource in explorer", function() {
+ afterEach(function() {
+ if (this.currentTest.state === "failed") {
+ Cypress.runner.stop();
+ }
+ });
+
+ it("1. Create a query with dataSource in explorer, Create new Page", function() {
cy.Createpage(pageid);
cy.get(".t--entity-name")
.contains("Page1")
@@ -61,7 +67,7 @@ describe("Entity explorer tests related to copy query", function() {
});
});
- it("2. Create a page and copy query in explorer", function() {
+ it("2. Copy query in explorer to new page & verify Bindings are copied too", function() {
cy.get(".t--entity-name")
.contains("Page1")
.click({ force: true });
@@ -81,7 +87,7 @@ describe("Entity explorer tests related to copy query", function() {
});
});
- it("3. Delete query and rename datasource in explorer", function() {
+ it("3. Rename datasource in explorer, Delete query and try to Delete datasource", function() {
cy.get(".t--entity-name")
.contains("Page1")
.click({ force: true });
@@ -93,9 +99,9 @@ describe("Entity explorer tests related to copy query", function() {
cy.log("sliced id :" + updatedName);
cy.CheckAndUnfoldEntityItem("QUERIES/JS");
cy.EditEntityNameByDoubleClick(datasourceName, updatedName);
- cy.wait(2000);
- cy.hoverAndClick();
- cy.get(apiwidget.delete).click({ force: true });
+ cy.wait(1000);
+ agHelper.ActionContextMenuByEntityName(updatedName, "Delete");
+ cy.wait(1000);
cy.get("[data-cy=t--confirm-modal-btn]").click();
//This is check to make sure if a datasource is active 409
cy.wait("@deleteDatasource").should(
@@ -104,7 +110,6 @@ describe("Entity explorer tests related to copy query", function() {
409,
);
});
-
cy.get(".t--entity-name")
.contains("Query1")
.click({ force: true });
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Params/PassingParams_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Params/PassingParams_Spec.ts
index bfedd19018f4..94f2d5cadee9 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Params/PassingParams_Spec.ts
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Params/PassingParams_Spec.ts
@@ -37,7 +37,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break",
'Params1.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})',
);
});
- cy.CheckAndUnfoldEntityItem("WIDGETS");
+ agHelper.expandCollapseEntity("WIDGETS");
agHelper.SelectEntityByName("Button1");
cy.get("@jsObjName").then((jsObjName) => {
jsEditor.EnterJSContext(
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/Postgres_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/Postgres_Spec.js
index 357ff8dcdda5..e86369d365dd 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/Postgres_Spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/Postgres_Spec.js
@@ -207,7 +207,7 @@ describe("Validate CRUD queries for Postgres along with UI flow verifications",
cy.xpath(generatePage.genderField).type("Male");
cy.xpath(generatePage.emailField)
.type("[email protected]")
- .wait(1000); //Waiting for Submit button to get enabled
+ .wait(2000); //Waiting for Submit button to get enabled
cy.get(generatePage.submitBtn)
.closest("div")
.first()
@@ -216,6 +216,7 @@ describe("Validate CRUD queries for Postgres along with UI flow verifications",
cy.xpath(generatePage.sortByDropdown).click(); //Sorting by descending to verify newly added record - also sorting is verified
cy.xpath(generatePage.descending).click();
+ cy.wait(2000); //for descending to take effect!
cy.xpath(generatePage.currentNameField).should("have.value", "CRUD User31"); //Verifying Addition is success
//Verifying Delete from UI
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_spec.js
index ed4b06327469..46905da48744 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_spec.js
@@ -1,3 +1,5 @@
+/// <reference types="Cypress" />
+
const queryLocators = require("../../../../locators/QueryEditor.json");
const datasource = require("../../../../locators/DatasourcesEditor.json");
const generatePage = require("../../../../locators/GeneratePage.json");
@@ -445,8 +447,7 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications",
cy.actionContextMenuByEntityName("Assets-test.appsmith.com");
});
- //Open bug : 3836, 6492
- it.skip("7. Bug 9069, 9201, 6975, 9922, 3836, 6492: Upload/Update query is failing in S3 crud pages", function() {
+ it("7. Bug 9069, 9201, 6975, 9922, 3836, 6492, 11833: Upload/Update query is failing in S3 crud pages", function() {
cy.NavigateToDSGeneratePage(datasourceName);
cy.wait(3000);
//Verifying List of Files from UI
@@ -516,10 +517,10 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications",
fixturePath +
"']/ancestor::div[contains(@class, 't--widget-textwidget')]/following-sibling::div[contains(@class,'t--widget-iconbuttonwidget')]";
- cy.xpath(deleteIconButtonXPATH).should("be.visible");
-
cy.xpath(deleteIconButtonXPATH)
+ .should("exist")
.last()
+ .scrollIntoView()
.click(); //Verifies 8684
cy.VerifyErrorMsgAbsence("Cyclic dependency found while evaluating"); //Verifies 8686
@@ -531,9 +532,13 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications",
cy.wait("@postExecute").then(({ response }) => {
expect(response.body.data.isExecutionSuccess).to.eq(true);
});
- cy.get("span:contains('" + fixturePath + "')", { timeout: 10000 }).should(
- "not.exist",
- ); //verify Deletion of file is success from UI also
+
+ cy.xpath(
+ "//div[@data-cy='overlay-comments-wrapper']//span[text()='" +
+ fixturePath +
+ "']",
+ { timeout: 10000 },
+ ).should("not.exist"); //verify Deletion of file is success from UI also
//Upload: 2 - Bug verification 9201
fixturePath = "AAAFlowerVase.jpeg";
@@ -574,27 +579,32 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications",
"']",
).scrollIntoView();
+ cy.wait(3000);
//Verifying DeleteFile icon from UI
cy.xpath(
"//button/span[@icon='trash']/ancestor::div[contains(@class,'t--widget-iconbuttonwidget')]/preceding-sibling::div[contains(@class, 't--widget-textwidget')]//span[text()='" +
fixturePath +
"']/ancestor::div[contains(@class, 't--widget-textwidget')]/following-sibling::div[contains(@class,'t--widget-iconbuttonwidget')]",
)
- .should("be.visible")
+ .should("exist")
.last()
+ .scrollIntoView()
.click(); //Verifies 8684
cy.VerifyErrorMsgAbsence("Cyclic dependency found while evaluating"); //Verifies 8686
expect(
cy.xpath("//span[text()='Are you sure you want to delete the file?']"),
).to.exist; //verify Delete File dialog appears
- cy.clickButton("Confirm").wait(1000); //wait for Delete operation to be successfull, //Verifies 8684
+ cy.clickButton("Confirm").wait(3000); //wait for Delete operation to be successfull, //Verifies 8684
cy.wait("@postExecute").then(({ response }) => {
expect(response.body.data.isExecutionSuccess).to.eq(true);
});
- cy.get("span:contains('" + fixturePath + "')", { timeout: 10000 }).should(
- "not.exist",
- ); //verify Deletion of file is success from UI also
+ cy.xpath(
+ "//div[@data-cy='overlay-comments-wrapper']//span[text()='" +
+ fixturePath +
+ "']",
+ { timeout: 10000 },
+ ).should("not.exist"); //verify Deletion of file is success from UI also
//Deleting the page:
cy.actionContextMenuByEntityName("Assets-test.appsmith.com");
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/UserProfile/UpdateUsersName_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/UserProfile/UpdateUsersName_spec.js
index 4f9e2d945ff7..2d15f1f9cb47 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/UserProfile/UpdateUsersName_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/UserProfile/UpdateUsersName_spec.js
@@ -3,14 +3,16 @@ import homePage from "../../../../locators/HomePage";
describe("Update a user's name", function() {
let username;
- it("Update a user's name", function() {
+ it("1. Update a user's name", function() {
cy.get(homePage.profileMenu).click();
cy.get(".t--edit-profile").click({ force: true });
cy.generateUUID().then((uid) => {
username = uid;
cy.get("[data-cy=t--display-name]").clear();
- cy.get("[data-cy=t--display-name]").type(username);
+ cy.get("[data-cy=t--display-name]")
+ .click()
+ .type(username);
// Waiting as the input onchange has a debounce
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
@@ -21,7 +23,7 @@ describe("Update a user's name", function() {
});
});
- it("Validate email address and Reset pwd", function() {
+ it("2. Validate email address and Reset pwd", function() {
cy.intercept("POST", "/api/v1/users/forgotPassword", {
fixture: "resetPassword.json",
}).as("resetPwd");
diff --git a/app/client/cypress/support/Objects/CommonLocators.ts b/app/client/cypress/support/Objects/CommonLocators.ts
index c3c280a28365..d487cd7e2a8b 100644
--- a/app/client/cypress/support/Objects/CommonLocators.ts
+++ b/app/client/cypress/support/Objects/CommonLocators.ts
@@ -13,7 +13,7 @@ export class CommonLocators {
_codeMirrorTextArea = ".CodeMirror textarea"
_codeMirrorCode = ".CodeMirror-code"
_codeEditorTargetTextArea = ".CodeEditorTarget textarea"
- _codeEditorTarget = "//div[@class='CodeEditorTarget']"
+ _codeEditorTarget = "div.CodeEditorTarget"
_entityExplorersearch = "#entity-explorer-search"
_propertyControl = ".t--property-control-"
_textWidget = ".t--draggable-textwidget span"
@@ -32,8 +32,8 @@ export class CommonLocators {
_entityNameInExplorer = (entityNameinLeftSidebar: string) => "//div[contains(@class, 't--entity-name')][text()='" + entityNameinLeftSidebar + "']"
_expandCollapseArrow = (entityNameinLeftSidebar: string) => "//div[text()='" + entityNameinLeftSidebar + "']/ancestor::div/preceding-sibling::a[contains(@class, 't--entity-collapse-toggle')]"
_entityProperties = (entityNameinLeftSidebar: string) => "//div[text()='" + entityNameinLeftSidebar + "']/ancestor::div[contains(@class, 't--entity-item')]/following-sibling::div//div[contains(@class, 't--entity-property')]//code"
- _contextMenu = (entityNameinLeftSidebar: string) => "//div[text()='" + entityNameinLeftSidebar + "']/ancestor::div[contains(@class, 't--entity')]//span[contains(@class, 'entity-context-menu')]//div"
- _contextMenuItem = (item: string) => "//div[text()='" + item + "']/parent::a[contains(@class, 'single-select')]"
+ _contextMenu = (entityNameinLeftSidebar: string) => "//div[text()='" + entityNameinLeftSidebar + "']/ancestor::div[1]/following-sibling::div//div[contains(@class, 'entity-context-menu-icon')]"
+ _contextMenuItem = (item: string) => "//div[text()='" + item + "']/ancestor::a[contains(@class, 'single-select')]"
_entityNameEditing = (entityNameinLeftSidebar: string) => "//span[text()='" + entityNameinLeftSidebar + "']/parent::div[contains(@class, 't--entity-name editing')]/input"
_jsToggle = (controlToToggle: string) => ".t--property-control-" + controlToToggle + " .t--js-toggle"
_spanButton = (btnVisibleText: string) => "//span[text()='" + btnVisibleText + "']/parent::button"
diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts
index bdfbe62bc15f..ada1f151b455 100644
--- a/app/client/cypress/support/Pages/AggregateHelper.ts
+++ b/app/client/cypress/support/Pages/AggregateHelper.ts
@@ -23,15 +23,15 @@ export class AggregateHelper {
cy.request(
"PUT",
"api/v1/layouts/" + layoutId + "/pages/" + pageid,
- dsl,
- ).then((response) => {
- //cy.log("Pages resposne is : " + response.body);
- expect(response.status).equal(200);
+ dsl
+ ).then((dslDumpResp) => {
+ //cy.log("Pages resposne is : " + dslDumpResp.body);
+ expect(dslDumpResp.status).equal(200);
cy.reload();
});
});
});
- this.Sleep(2000)//settling time for dsl
+ this.Sleep(5000)//settling time for dsl
}
public NavigateToDSCreateNew() {
@@ -113,11 +113,11 @@ export class AggregateHelper {
public expandCollapseEntity(entityName: string, expand = true) {
cy.xpath(locator._expandCollapseArrow(entityName)).invoke('attr', 'name').then((arrow) => {
if (expand && arrow == 'arrow-right')
- cy.xpath(locator._expandCollapseArrow(entityName)).click({ multiple: true }).wait(500);
+ cy.xpath(locator._expandCollapseArrow(entityName)).trigger('click', { multiple: true }).wait(1000);
else if (!expand && arrow == 'arrow-down')
- cy.xpath(locator._expandCollapseArrow(entityName)).click({ multiple: true }).wait(500);
+ cy.xpath(locator._expandCollapseArrow(entityName)).trigger('click', { multiple: true }).wait(1000);
else
- cy.wait(500)
+ this.Sleep()
})
}
@@ -216,7 +216,7 @@ export class AggregateHelper {
.first()
.focus()
.type("{uparrow}", { force: true })
- .type("{ctrl}{shift}{downarrow}", { force: true });
+ .type("{ctrl}{shift}{downarrow}{del}", { force: true });
cy.focused().then(($cm: any) => {
if ($cm.contents != "") {
cy.log("The field is not empty");
@@ -329,15 +329,16 @@ export class AggregateHelper {
subAction = "") {
this.Sleep();
cy.xpath(locator._contextMenu(entityNameinLeftSidebar))
- .first()
+ .last()
.click({ force: true });
cy.xpath(locator._contextMenuItem(action))
.click({ force: true })
- .wait(500);
- if (subAction)
+ this.Sleep(500)
+ if (subAction) {
cy.xpath(locator._contextMenuItem(subAction))
.click({ force: true })
- .wait(500);
+ this.Sleep(500)
+ }
}
public ValidateEntityAbsenceInExplorer(entityNameinLeftSidebar: string) {
@@ -355,7 +356,7 @@ export class AggregateHelper {
this.UpdateCodeInput($field, valueToType);
});
} else {
- cy.xpath(locator._codeEditorTarget).then(($field: any) => {
+ cy.get(locator._codeEditorTarget).then(($field: any) => {
this.UpdateCodeInput($field, valueToType);
});
}
diff --git a/app/client/cypress/support/Pages/HomePage.ts b/app/client/cypress/support/Pages/HomePage.ts
index 1172fdc59d99..a63eb8b6e0c8 100644
--- a/app/client/cypress/support/Pages/HomePage.ts
+++ b/app/client/cypress/support/Pages/HomePage.ts
@@ -122,7 +122,7 @@ export class HomePage {
}
public CreateNewApplication() {
- cy.get(this._homePageAppCreateBtn).click({ force: true })
+ cy.get(this._homePageAppCreateBtn).first().click({ force: true })
cy.wait("@createNewApplication").should(
"have.nested.property",
"response.body.responseMeta.status",
diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts
index 43be9a7178c6..be8fd5040cc0 100644
--- a/app/client/cypress/support/Pages/JSEditor.ts
+++ b/app/client/cypress/support/Pages/JSEditor.ts
@@ -7,7 +7,6 @@ const locator = new CommonLocators();
export class JSEditor {
private _runButton = "//li//*[local-name() = 'svg' and @class='run-button']";
- private _outputConsole = ".CodeEditorTarget";
private _jsObjName = ".t--js-action-name-edit-field span";
private _jsObjTxt = ".t--js-action-name-edit-field input";
private _newJSobj = "span:contains('New JS Object')"
@@ -23,12 +22,34 @@ export class JSEditor {
agHelper.WaitUntilEleDisappear(locator._toastMsg, 'created successfully', 1000)
}
- public CreateJSObject(JSCode: string, paste = true) {
+ public CreateJSObject(JSCode: string, paste = true, completeReplace = false) {
this.NavigateToJSEditor();
- cy.get(locator._codeMirrorTextArea)
+
+ if (!completeReplace) {
+ cy.get(locator._codeMirrorTextArea)
+ .first()
+ .focus()
+ .type("{downarrow}{downarrow}{downarrow}{downarrow} ")
+ }
+ else {
+ cy.get(locator._codeMirrorTextArea)
.first()
.focus()
- .type("{downarrow}{downarrow}{downarrow}{downarrow} ")
+ .type("{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}")
+ .type("{shift}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}", { force: true })
+ .type("{backspace}",{ force: true });
+
+ // .type("{uparrow}", { force: true })
+ // .type("{ctrl}{shift}{downarrow}", { force: true })
+ // .type("{del}",{ force: true });
+
+ // cy.get(locator._codeEditorTarget).contains('export').click().closest(locator._codeEditorTarget)
+ // .type("{uparrow}", { force: true })
+ // .type("{ctrl}{shift}{downarrow}", { force: true })
+ // .type("{backspace}",{ force: true });
+ //.type("{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow} ")
+
+ }
cy.get(locator._codeMirrorTextArea)
.first()
@@ -75,7 +96,9 @@ export class JSEditor {
.first()
.focus()
.type("{uparrow}", { force: true })
- .type("{ctrl}{shift}{downarrow}", { force: true });
+ .type("{ctrl}{shift}{downarrow}", { force: true })
+ .type("{del}", { force: true });
+
cy.focused().then(($cm: any) => {
if ($cm.contents != "") {
cy.log("The field is not empty");
diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js
index 09fd39866759..577407c8f821 100644
--- a/app/client/cypress/support/commands.js
+++ b/app/client/cypress/support/commands.js
@@ -328,7 +328,7 @@ Cypress.Commands.add("AppSetupForRename", () => {
cy.get(homePage.applicationName).click({ force: true });
cy.get(homePage.portalMenuItem)
.contains("Edit Name", { matchCase: false })
- .click();
+ .click({ force: true });
}
});
});
@@ -1903,7 +1903,6 @@ Cypress.Commands.add("addDsl", (dsl) => {
cy.log(pageidcopy + "page id copy");
cy.log(pageid + "page id");
//Fetch the layout id
- cy.server();
cy.request("GET", "api/v1/pages/" + pageid).then((response) => {
const respBody = JSON.stringify(response.body);
layoutId = JSON.parse(respBody).data.layouts[0].id;
@@ -2279,16 +2278,16 @@ Cypress.Commands.add(
const hostAddress = shouldAddTrailingSpaces
? datasourceFormData["mongo-host"] + " "
: datasourceFormData["mongo-host"];
- const databaseName = shouldAddTrailingSpaces
- ? datasourceFormData["mongo-databaseName"] + " "
- : datasourceFormData["mongo-databaseName"];
+ // const databaseName = shouldAddTrailingSpaces
+ // ? datasourceFormData["mongo-databaseName"] + " "
+ // : datasourceFormData["mongo-databaseName"];
cy.get(datasourceEditor["host"]).type(hostAddress);
cy.get(datasourceEditor.port).type(datasourceFormData["mongo-port"]);
//cy.get(datasourceEditor["port"]).type(datasourceFormData["mongo-port"]);
//cy.get(datasourceEditor["selConnectionType"]).click();
//cy.contains(datasourceFormData["connection-type"]).click();
- cy.get(datasourceEditor["defaultDatabaseName"]).type(databaseName);
+ //cy.get(datasourceEditor["defaultDatabaseName"]).type(databaseName);//is optional hence removing
cy.get(datasourceEditor.sectionAuthentication).click();
cy.get(datasourceEditor["databaseName"])
@@ -3816,7 +3815,7 @@ Cypress.Commands.add(
cy.xpath(
"//div[text()='" +
action +
- "']/parent::a[contains(@class, 'single-select')]",
+ "']/ancestor::a[contains(@class, 'single-select')]",
)
.click({ force: true })
.wait(500);
@@ -3864,13 +3863,15 @@ Cypress.Commands.add(
},
);
+// Cypress >=8.3.x onwards
cy.all = function(...commands) {
const _ = Cypress._;
+ // eslint-disable-next-line
const chain = cy.wrap(null, { log: false });
- const stopCommand = _.find(cy.queue.commands, {
+ const stopCommand = _.find(cy.queue.get(), {
attributes: { chainerId: chain.chainerId },
});
- const startCommand = _.find(cy.queue.commands, {
+ const startCommand = _.find(cy.queue.get(), {
attributes: { chainerId: commands[0].chainerId },
});
const p = chain.then(() => {
@@ -3878,7 +3879,7 @@ cy.all = function(...commands) {
.map((cmd) => {
return cmd[chainStart]
? cmd[chainStart].attributes
- : _.find(cy.queue.commands, {
+ : _.find(cy.queue.get(), {
attributes: { chainerId: cmd.chainerId },
}).attributes;
})
diff --git a/app/client/package.json b/app/client/package.json
index d5efddf2d3de..a1452ec144c1 100644
--- a/app/client/package.json
+++ b/app/client/package.json
@@ -256,7 +256,7 @@
"cra-bundle-analyzer": "^0.1.0",
"craco-babel-loader": "^0.1.4",
"cy-verify-downloads": "^0.0.5",
- "cypress": "7.6.0",
+ "cypress": "8.7.0",
"cypress-file-upload": "^4.1.1",
"cypress-image-snapshot": "^4.0.1",
"cypress-multi-reporters": "^1.2.4",
diff --git a/app/client/yarn.lock b/app/client/yarn.lock
index d5337940ea40..5a231271bfc1 100644
--- a/app/client/yarn.lock
+++ b/app/client/yarn.lock
@@ -1740,9 +1740,10 @@
version "10.1.0"
resolved "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz"
-"@cypress/request@^2.88.5":
- version "2.88.5"
- resolved "https://registry.npmjs.org/@cypress/request/-/request-2.88.5.tgz"
+"@cypress/request@^2.88.6":
+ version "2.88.10"
+ resolved "https://registry.yarnpkg.com/@cypress/request/-/request-2.88.10.tgz#b66d76b07f860d3a4b8d7a0604d020c662752cce"
+ integrity sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg==
dependencies:
aws-sign2 "~0.7.0"
aws4 "^1.8.0"
@@ -1751,19 +1752,17 @@
extend "~3.0.2"
forever-agent "~0.6.1"
form-data "~2.3.2"
- har-validator "~5.1.3"
- http-signature "~1.2.0"
+ http-signature "~1.3.6"
is-typedarray "~1.0.0"
isstream "~0.1.2"
json-stringify-safe "~5.0.1"
mime-types "~2.1.19"
- oauth-sign "~0.9.0"
performance-now "^2.1.0"
qs "~6.5.2"
safe-buffer "^5.1.2"
tough-cookie "~2.5.0"
tunnel-agent "^0.6.0"
- uuid "^3.3.2"
+ uuid "^8.3.2"
"@cypress/xvfb@^1.2.4":
version "1.2.4"
@@ -3352,8 +3351,9 @@
integrity sha512-50ehC3IAijfkvoNqmQ+VL73S7orOxmAK8ljQAFBv8o7G66lAZyxQj1L3BAv2dD86myLXI+sgKP1kcxAaxW356w==
"@types/sinonjs__fake-timers@^6.0.2":
- version "6.0.3"
- resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.3.tgz#79df6f358ae8f79e628fe35a63608a0ea8e7cf08"
+ version "6.0.4"
+ resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.4.tgz#0ecc1b9259b76598ef01942f547904ce61a6a77d"
+ integrity sha512-IFQTJARgMUBF+xVd2b+hIgXWrZEjND3vJtRCvIelcFB5SIXfjV4bOHbHJ0eXKh+0COrBRc8MqteKAz/j88rE0A==
"@types/sizzle@^2.3.2":
version "2.3.2"
@@ -5514,13 +5514,13 @@ cli-spinners@^2.0.0:
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.6.0.tgz#36c7dc98fb6a9a76bd6238ec3f77e2425627e939"
cli-table3@~0.6.0:
- version "0.6.0"
- resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.0.tgz#b7b1bc65ca8e7b5cef9124e13dc2b21e2ce4faee"
+ version "0.6.1"
+ resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.1.tgz#36ce9b7af4847f288d3cdd081fbd09bf7bd237b8"
+ integrity sha512-w0q/enDHhPLq44ovMGdQeeDLvwxwavsJX7oQGYt/LrBlYsyaxyDnp6z3QzFut/6kLLKnlcUVJLrpB7KBfgG/RA==
dependencies:
- object-assign "^4.1.0"
string-width "^4.2.0"
optionalDependencies:
- colors "^1.1.2"
+ colors "1.4.0"
cli-truncate@^0.2.1:
version "0.2.1"
@@ -5685,9 +5685,10 @@ colorette@^1.2.1, colorette@^1.2.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.3.0.tgz#ff45d2f0edb244069d3b772adeb04fed38d0a0af"
-colors@^1.1.2:
[email protected]:
version "1.4.0"
- resolved "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz"
+ resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
+ integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
combined-stream@^1.0.6, combined-stream@~1.0.6:
version "1.0.8"
@@ -6380,11 +6381,12 @@ cypress-xpath@^1.4.0:
version "1.6.0"
resolved "https://registry.npmjs.org/cypress-xpath/-/cypress-xpath-1.6.0.tgz"
[email protected]:
- version "7.6.0"
- resolved "https://registry.yarnpkg.com/cypress/-/cypress-7.6.0.tgz#80fe7496cd4165a0fa06e25fc11413dda4544463"
[email protected]:
+ version "8.7.0"
+ resolved "https://registry.yarnpkg.com/cypress/-/cypress-8.7.0.tgz#2ee371f383d8f233d3425b6cc26ddeec2668b6da"
+ integrity sha512-b1bMC3VQydC6sXzBMFnSqcvwc9dTZMgcaOzT0vpSD+Gq1yFc+72JDWi55sfUK5eIeNLAtWOGy1NNb6UlhMvB+Q==
dependencies:
- "@cypress/request" "^2.88.5"
+ "@cypress/request" "^2.88.6"
"@cypress/xvfb" "^1.2.4"
"@types/node" "^14.14.31"
"@types/sinonjs__fake-timers" "^6.0.2"
@@ -6418,6 +6420,7 @@ [email protected]:
minimist "^1.2.5"
ospath "^1.2.2"
pretty-bytes "^5.6.0"
+ proxy-from-env "1.0.0"
ramda "~0.27.1"
request-progress "^3.0.0"
supports-color "^8.1.1"
@@ -9052,6 +9055,15 @@ http-signature@~1.2.0:
jsprim "^1.2.2"
sshpk "^1.7.0"
+http-signature@~1.3.6:
+ version "1.3.6"
+ resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9"
+ integrity sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==
+ dependencies:
+ assert-plus "^1.0.0"
+ jsprim "^2.0.2"
+ sshpk "^1.14.1"
+
https-browserify@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz"
@@ -10467,6 +10479,11 @@ [email protected]:
version "0.2.3"
resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz"
[email protected]:
+ version "0.4.0"
+ resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5"
+ integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==
+
json-stable-stringify-without-jsonify@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz"
@@ -10518,6 +10535,16 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.10.0"
+jsprim@^2.0.2:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d"
+ integrity sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==
+ dependencies:
+ assert-plus "1.0.0"
+ extsprintf "1.3.0"
+ json-schema "0.4.0"
+ verror "1.10.0"
+
"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.1.0.tgz"
@@ -13631,6 +13658,11 @@ proxy-addr@~2.0.5:
forwarded "~0.1.2"
ipaddr.js "1.9.1"
[email protected]:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee"
+ integrity sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=
+
proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz"
@@ -13768,8 +13800,9 @@ ramda@^0.25.0:
resolved "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz"
ramda@~0.27.1:
- version "0.27.1"
- resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.1.tgz#66fc2df3ef873874ffc2da6aa8984658abacf5c9"
+ version "0.27.2"
+ resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.2.tgz#84463226f7f36dc33592f6f4ed6374c48306c3f1"
+ integrity sha512-SbiLPU40JuJniHexQSAgad32hfwd+DRUdwF2PlVuI5RZD0/vahUco7R8vD86J/tcEKKF9vZrUVwgtmGCqlCKyA==
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0:
version "2.1.0"
@@ -15752,6 +15785,21 @@ sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz"
+sshpk@^1.14.1:
+ version "1.17.0"
+ resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz#578082d92d4fe612b13007496e543fa0fbcbe4c5"
+ integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==
+ dependencies:
+ asn1 "~0.2.3"
+ assert-plus "^1.0.0"
+ bcrypt-pbkdf "^1.0.0"
+ dashdash "^1.12.0"
+ ecc-jsbn "~0.1.1"
+ getpass "^0.1.1"
+ jsbn "~0.1.0"
+ safer-buffer "^2.0.2"
+ tweetnacl "~0.14.0"
+
sshpk@^1.7.0:
version "1.16.1"
resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz"
@@ -17003,7 +17051,7 @@ uuid@^7.0.0:
version "7.0.3"
resolved "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz"
-uuid@^8.3.0:
+uuid@^8.3.0, uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
|
9ac042a01543e4c1cbc8c26c46da9bce9eee0a8f
|
2023-06-02 15:34:57
|
Manish Kumar
|
fix: Fix for Google sheets datasource generate query pane inactive (#23963)
| false
|
Fix for Google sheets datasource generate query pane inactive (#23963)
|
fix
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java
index ba29074ef50a..709089d8a2e5 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java
@@ -9,6 +9,7 @@
import com.appsmith.external.models.AuthenticationResponse;
import com.appsmith.external.models.Datasource;
import com.appsmith.external.models.DatasourceStorage;
+import com.appsmith.external.models.DatasourceStorageDTO;
import com.appsmith.external.models.DefaultResources;
import com.appsmith.external.models.OAuth2;
import com.appsmith.external.models.OAuth2ResponseDTO;
@@ -450,18 +451,20 @@ public Mono<OAuth2ResponseDTO> getAccessTokenFromCloud(String datasourceId, Stri
// If yes, request for token and store in datasource
// Update datasource as being authorized
// Return control to client
- Mono<DatasourceStorage> datasourceStorageMono = datasourceService
- .findById(datasourceId, datasourcePermission.getEditPermission())
- .flatMap(datasource1 -> datasourceStorageService
- .findByDatasourceAndEnvironmentId(datasource1, environmentId))
+
+ Mono<Datasource> datasourceMonoCache = datasourceService
+ .findById(datasourceId, datasourcePermission.getEditPermission()).cache();
+
+ Mono<DatasourceStorage> datasourceStorageMonoCache = datasourceMonoCache
+ .flatMap(datasource1 -> datasourceStorageService.findByDatasourceAndEnvironmentId(datasource1, environmentId))
.cache();
- return datasourceStorageMono
- .filter(datasource -> AuthenticationDTO.AuthenticationStatus.IN_PROGRESS
- .equals(datasource.getDatasourceConfiguration().getAuthentication().getAuthenticationStatus()))
+ return datasourceStorageMonoCache
+ .filter(datasourceStorage -> AuthenticationDTO.AuthenticationStatus.IN_PROGRESS
+ .equals(datasourceStorage.getDatasourceConfiguration().getAuthentication().getAuthenticationStatus()))
.switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.DATASOURCE, datasourceId)))
.flatMap(this::validateRequiredFieldsForGenericOAuth2)
- .flatMap(datasource -> {
+ .flatMap(datasourceStorage -> {
UriComponentsBuilder uriBuilder = UriComponentsBuilder.newInstance();
try {
uriBuilder.uri(new URI(cloudServicesConfig.getBaseUrl() + "/api/v1/integrations/oauth/token"))
@@ -484,7 +487,7 @@ public Mono<OAuth2ResponseDTO> getAccessTokenFromCloud(String datasourceId, Stri
}
})
.flatMap(authenticationResponse -> {
- OAuth2 oAuth2 = (OAuth2) datasource.getDatasourceConfiguration().getAuthentication();
+ OAuth2 oAuth2 = (OAuth2) datasourceStorage.getDatasourceConfiguration().getAuthentication();
oAuth2.setAuthenticationResponse(authenticationResponse);
final Map tokenResponse = (Map) authenticationResponse.getTokenResponse();
if (tokenResponse != null && tokenResponse.containsKey("scope")) {
@@ -494,7 +497,7 @@ public Mono<OAuth2ResponseDTO> getAccessTokenFromCloud(String datasourceId, Stri
"Please provide access to all the requested scopes to use the integration correctly."));
}
}
- datasource.getDatasourceConfiguration().setAuthentication(oAuth2);
+ datasourceStorage.getDatasourceConfiguration().setAuthentication(oAuth2);
// When authentication scope is for specific sheets, we need to send token and project id
String accessToken = "";
@@ -513,12 +516,12 @@ public Mono<OAuth2ResponseDTO> getAccessTokenFromCloud(String datasourceId, Stri
Set<String> oauth2Scopes = oAuth2.getScope();
if (oauth2Scopes != null) {
if (oauth2Scopes.contains(FILE_SPECIFIC_DRIVE_SCOPE)) {
- datasource
+ datasourceStorage
.getDatasourceConfiguration()
.getAuthentication()
.setAuthenticationStatus(AuthenticationDTO.AuthenticationStatus.IN_PROGRESS_PERMISSIONS_GRANTED);
} else {
- datasource
+ datasourceStorage
.getDatasourceConfiguration()
.getAuthentication()
.setAuthenticationStatus(AuthenticationDTO.AuthenticationStatus.SUCCESS);
@@ -529,21 +532,30 @@ public Mono<OAuth2ResponseDTO> getAccessTokenFromCloud(String datasourceId, Stri
Mono<String> projectIdMono = Mono.just(projectID);
return pluginExecutorHelper
- .getPluginExecutor(pluginService.findById(datasource.getPluginId()))
+ .getPluginExecutor(pluginService.findById(datasourceStorage.getPluginId()))
.flatMap(pluginExecutor -> ((PluginExecutor<Object>) pluginExecutor)
- .getDatasourceMetadata(datasource.getDatasourceConfiguration()))
- .then(Mono.zip(Mono.just(datasource), accessTokenMono, projectIdMono));
+ .getDatasourceMetadata(datasourceStorage.getDatasourceConfiguration()))
+ .then(Mono.zip(Mono.just(datasourceStorage), accessTokenMono, projectIdMono, datasourceMonoCache));
});
})
.flatMap(tuple -> {
DatasourceStorage datasourceStorage = tuple.getT1();
String accessToken = tuple.getT2();
String projectID = tuple.getT3();
+ // This datasource is coming fresh from db which has all the metadata and permissions,
+ // which is required by client side in order to allow users to generate queries otherwise the
+ // buttons are disabled. we will be sending this datasource itself which has the permissions as a fix
+ // ref: https://github.com/appsmithorg/appsmith/issues/23840
+ Datasource datasource = tuple.getT4();
OAuth2ResponseDTO response = new OAuth2ResponseDTO();
response.setToken(accessToken);
response.setProjectID(projectID);
+ //since we are fetching our datasource fresh from db we are guaranteed that datasource won't have any storages
+ datasource.getDatasourceStorages()
+ .put(datasourceStorage.getEnvironmentId(), new DatasourceStorageDTO(datasourceStorage));
+
return datasourceService
- .convertToDatasourceDTO(new Datasource(datasourceStorage))
+ .convertToDatasourceDTO(datasource)
.flatMap(datasourceDTO -> {
response.setDatasource(datasourceDTO);
return datasourceStorageService.save(datasourceStorage)
@@ -555,7 +567,7 @@ public Mono<OAuth2ResponseDTO> getAccessTokenFromCloud(String datasourceId, Stri
AppsmithError.AUTHENTICATION_FAILURE,
"Unable to connect to Appsmith authentication server."
))
- .onErrorResume(BaseException.class, error -> datasourceStorageMono.flatMap(datasourceStorage -> {
+ .onErrorResume(BaseException.class, error -> datasourceStorageMonoCache.flatMap(datasourceStorage -> {
datasourceStorage.getDatasourceConfiguration().getAuthentication()
.setAuthenticationStatus(AuthenticationDTO.AuthenticationStatus.FAILURE);
return datasourceStorageService.save(datasourceStorage).then(Mono.error(error));
|
8166833efaf3435441e9481eade38c72fd147c7b
|
2022-10-06 11:33:10
|
Dhruvik Neharia
|
fix: add getMetaPropertiesMap() to code scanner (#17185)
| false
|
add getMetaPropertiesMap() to code scanner (#17185)
|
fix
|
diff --git a/app/client/src/widgets/CodeScannerWidget/widget/index.tsx b/app/client/src/widgets/CodeScannerWidget/widget/index.tsx
index f0838e378781..dc69fbc4826b 100644
--- a/app/client/src/widgets/CodeScannerWidget/widget/index.tsx
+++ b/app/client/src/widgets/CodeScannerWidget/widget/index.tsx
@@ -18,6 +18,12 @@ class CodeScannerWidget extends BaseWidget<
return styleConfig;
}
+ static getMetaPropertiesMap(): Record<string, any> {
+ return {
+ value: undefined,
+ };
+ }
+
onCodeDetected = (value: string) => {
this.props.updateWidgetMetaProperty("value", value, {
triggerPropertyName: "onCodeDetected",
|
8c1a4af4b9ef3c7fc7ad120eecfedd5e028bb66a
|
2022-07-01 01:48:16
|
albinAppsmith
|
ci: Added workflow for adding reviewers to PR if ads folder changed (#14880)
| false
|
Added workflow for adding reviewers to PR if ads folder changed (#14880)
|
ci
|
diff --git a/.github/reviewers.yml b/.github/reviewers.yml
new file mode 100644
index 000000000000..d24429e6c1d8
--- /dev/null
+++ b/.github/reviewers.yml
@@ -0,0 +1,4 @@
+files:
+ 'app/client/src/components/ads/**':
+ - albinAppsmith
+ - tanvibhakta
\ No newline at end of file
diff --git a/.github/workflows/design-system-reviewer.yml b/.github/workflows/design-system-reviewer.yml
new file mode 100644
index 000000000000..2145945d3053
--- /dev/null
+++ b/.github/workflows/design-system-reviewer.yml
@@ -0,0 +1,22 @@
+name: Add Design System Pod teammates as reviewers
+
+on:
+ pull_request:
+ branches: [release]
+ types: [opened, reopened, edited]
+
+# Change the working directory for all the jobs in this workflow
+defaults:
+ run:
+ working-directory: app/client
+
+jobs:
+ auto-request-review:
+ name: Auto Request Review
+ runs-on: ubuntu-latest
+ steps:
+ - name: Request review based on files changes and/or groups the author belongs to
+ uses: necojackarc/[email protected]
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ config: .github/reviewers.yml # Config file location override
|
52e4d32a3f1a2d7ddcc5e880f9463e1daff3e540
|
2023-01-19 20:12:22
|
Anagh Hegde
|
feat: Separate the js object code and metadata when used with git sync (#19156)
| false
|
Separate the js object code and metadata when used with git sync (#19156)
|
feat
|
diff --git a/app/server/appsmith-git/src/main/java/com/appsmith/git/constants/CommonConstants.java b/app/server/appsmith-git/src/main/java/com/appsmith/git/constants/CommonConstants.java
index 6f5c953baf7c..d7542668118b 100644
--- a/app/server/appsmith-git/src/main/java/com/appsmith/git/constants/CommonConstants.java
+++ b/app/server/appsmith-git/src/main/java/com/appsmith/git/constants/CommonConstants.java
@@ -2,11 +2,13 @@
public class CommonConstants {
// This field will be useful when we migrate fields within JSON files (currently this will be useful for Git feature)
- public static Integer fileFormatVersion = 2;
+ public static Integer fileFormatVersion = 3;
public static String FILE_FORMAT_VERSION = "fileFormatVersion";
public static final String CANVAS = "canvas";
public static final String APPLICATION = "application";
public static final String THEME = "theme";
public static final String METADATA = "metadata";
public static final String JSON_EXTENSION = ".json";
+ public static final String JS_EXTENSION = ".js";
+ public static final String JS_BODY = "body";
}
diff --git a/app/server/appsmith-git/src/main/java/com/appsmith/git/helpers/FileUtilsImpl.java b/app/server/appsmith-git/src/main/java/com/appsmith/git/helpers/FileUtilsImpl.java
index 482209d31bf9..8cff88ef863f 100644
--- a/app/server/appsmith-git/src/main/java/com/appsmith/git/helpers/FileUtilsImpl.java
+++ b/app/server/appsmith-git/src/main/java/com/appsmith/git/helpers/FileUtilsImpl.java
@@ -84,45 +84,67 @@ public class FileUtilsImpl implements FileInterface {
private final Scheduler scheduler = Schedulers.boundedElastic();
/**
- Application will be stored in the following structure:
-
- For v1:
- repo_name
- application.json
- metadata.json
- datasource
- datasource1Name.json
- datasource2Name.json
- queries (Only requirement here is the filename should be unique)
- action1_page1
- action2_page2
- jsobjects (Only requirement here is the filename should be unique)
- jsobject1_page1
- jsobject2_page2
- pages
- page1
- page2
-
- For v2:
- repo_name
- application.json
- metadata.json
- theme
- publishedTheme.json
- editModeTheme.json
- pages
- page1
- canvas.json
- queries
- Query1.json
- Query2.json
- jsobjects
- JSObject1.json
- page2
- page3
- datasources
- datasource1.json
- datasource2.json
+ Application will be stored in the following structure:
+
+ For v1:
+ repo_name
+ application.json
+ metadata.json
+ datasource
+ datasource1Name.json
+ datasource2Name.json
+ queries (Only requirement here is the filename should be unique)
+ action1_page1
+ action2_page2
+ jsobjects (Only requirement here is the filename should be unique)
+ jsobject1_page1
+ jsobject2_page2
+ pages
+ page1
+ page2
+
+ For v2:
+ repo_name
+ application.json
+ metadata.json
+ theme
+ publishedTheme.json
+ editModeTheme.json
+ pages
+ page1
+ canvas.json
+ queries
+ Query1.json
+ Query2.json
+ jsobjects
+ JSObject1.json
+ page2
+ page3
+ datasources
+ datasource1.json
+ datasource2.json
+
+ For v3:
+ repo_name
+ application.json
+ metadata.json
+ theme
+ publishedTheme.json
+ editModeTheme.json
+ pages
+ page1
+ canvas.json
+ queries
+ Query1.json
+ jsobjects
+ JSObject1
+ JSObject1.js
+ Metadata.json
+ page2
+ page3
+ datasources
+ datasource1.json
+ datasource2.json
*/
@@ -167,15 +189,15 @@ public Mono<Path> saveApplicationToGitRepo(Path baseRepoSuffix,
deleteDirectory(baseRepo.resolve(ACTION_COLLECTION_DIRECTORY));
// Save application
- saveFile(applicationGitReference.getApplication(), baseRepo.resolve(CommonConstants.APPLICATION + CommonConstants.JSON_EXTENSION), gson);
+ saveResource(applicationGitReference.getApplication(), baseRepo.resolve(CommonConstants.APPLICATION + CommonConstants.JSON_EXTENSION), gson);
// Save application metadata
JsonObject metadata = gson.fromJson(gson.toJson(applicationGitReference.getMetadata()), JsonObject.class);
metadata.addProperty(CommonConstants.FILE_FORMAT_VERSION, CommonConstants.fileFormatVersion);
- saveFile(metadata, baseRepo.resolve(CommonConstants.METADATA + CommonConstants.JSON_EXTENSION), gson);
+ saveResource(metadata, baseRepo.resolve(CommonConstants.METADATA + CommonConstants.JSON_EXTENSION), gson);
// Save application theme
- saveFile(applicationGitReference.getTheme(), baseRepo.resolve(CommonConstants.THEME + CommonConstants.JSON_EXTENSION), gson);
+ saveResource(applicationGitReference.getTheme(), baseRepo.resolve(CommonConstants.THEME + CommonConstants.JSON_EXTENSION), gson);
// Save pages
Path pageDirectory = baseRepo.resolve(PAGE_DIRECTORY);
@@ -187,7 +209,7 @@ public Mono<Path> saveApplicationToGitRepo(Path baseRepoSuffix,
Path pageSpecificDirectory = pageDirectory.resolve(pageName);
Boolean isResourceUpdated = updatedResources.get(PAGE_LIST).contains(pageName);
if(Boolean.TRUE.equals(isResourceUpdated)) {
- saveFile(pageResource.getValue(), pageSpecificDirectory.resolve(CommonConstants.CANVAS + CommonConstants.JSON_EXTENSION), gson);
+ saveResource(pageResource.getValue(), pageSpecificDirectory.resolve(CommonConstants.CANVAS + CommonConstants.JSON_EXTENSION), gson);
}
validPages.add(pageName);
}
@@ -206,7 +228,7 @@ public Mono<Path> saveApplicationToGitRepo(Path baseRepoSuffix,
Path jsLibSpecificFile =
jsLibDirectory.resolve(fileNameWithExtension);
if (isResourceUpdated) {
- saveFile(jsLibEntry.getValue(), jsLibSpecificFile, gson);
+ saveResource(jsLibEntry.getValue(), jsLibSpecificFile, gson);
}
validJsLibs.add(fileNameWithExtension);
});
@@ -239,7 +261,7 @@ public Mono<Path> saveApplicationToGitRepo(Path baseRepoSuffix,
}
validActionsMap.get(pageName).add(queryName + CommonConstants.JSON_EXTENSION);
if(Boolean.TRUE.equals(isResourceUpdated)) {
- saveFile(
+ saveResource(
resource.getValue(),
pageSpecificDirectory.resolve(ACTION_DIRECTORY).resolve(queryName + CommonConstants.JSON_EXTENSION),
gson
@@ -257,37 +279,42 @@ public Mono<Path> saveApplicationToGitRepo(Path baseRepoSuffix,
// Save JSObjects
for (Map.Entry<String, Object> resource : applicationGitReference.getActionCollections().entrySet()) {
// JSObjectName_pageName => nomenclature for the keys
- // TODO
- // JSObjectName => for app level JSObjects, this is not implemented yet
+ // TODO JSObjectName => for app level JSObjects, this is not implemented yet
String[] names = resource.getKey().split(NAME_SEPARATOR);
if (names.length > 1 && StringUtils.hasLength(names[1])) {
final String actionCollectionName = names[0];
final String pageName = names[1];
Path pageSpecificDirectory = pageDirectory.resolve(pageName);
+ Path actionCollectionSpecificDirectory = pageSpecificDirectory.resolve(ACTION_COLLECTION_DIRECTORY);
if(!validActionCollectionsMap.containsKey(pageName)) {
validActionCollectionsMap.put(pageName, new HashSet<>());
}
- validActionCollectionsMap.get(pageName).add(actionCollectionName + CommonConstants.JSON_EXTENSION);
+ validActionCollectionsMap.get(pageName).add(actionCollectionName);
Boolean isResourceUpdated = updatedResources.get(ACTION_COLLECTION_LIST).contains(resource.getKey());
if(Boolean.TRUE.equals(isResourceUpdated)) {
- saveFile(
+ saveActionCollection(
resource.getValue(),
- pageSpecificDirectory.resolve(ACTION_COLLECTION_DIRECTORY).resolve(actionCollectionName + CommonConstants.JSON_EXTENSION),
+ applicationGitReference.getActionCollectionBody().get(resource.getKey()),
+ actionCollectionName,
+ actionCollectionSpecificDirectory.resolve(actionCollectionName),
gson
);
+ // Delete the resource from the old file structure v2
+ deleteFile(actionCollectionSpecificDirectory.resolve(actionCollectionName + CommonConstants.JSON_EXTENSION));
}
}
}
+ // Verify if the old files are deleted
validActionCollectionsMap.forEach((pageName, validActionCollectionNames) -> {
Path pageSpecificDirectory = pageDirectory.resolve(pageName);
- scanAndDeleteFileForDeletedResources(validActionCollectionNames, pageSpecificDirectory.resolve(ACTION_COLLECTION_DIRECTORY));
+ scanAndDeleteDirectoryForDeletedResources(validActionCollectionNames, pageSpecificDirectory.resolve(ACTION_COLLECTION_DIRECTORY));
});
// Save datasources ref
for (Map.Entry<String, Object> resource : applicationGitReference.getDatasources().entrySet()) {
- saveFile(resource.getValue(), baseRepo.resolve(DATASOURCE_DIRECTORY).resolve(resource.getKey() + CommonConstants.JSON_EXTENSION), gson);
+ saveResource(resource.getValue(), baseRepo.resolve(DATASOURCE_DIRECTORY).resolve(resource.getKey() + CommonConstants.JSON_EXTENSION), gson);
validFileNames.add(resource.getKey() + CommonConstants.JSON_EXTENSION);
}
// Scan datasource directory and delete any unwanted files if present
@@ -307,19 +334,57 @@ public Mono<Path> saveApplicationToGitRepo(Path baseRepoSuffix,
* @param gson
* @return if the file operation is successful
*/
- private boolean saveFile(Object sourceEntity, Path path, Gson gson) {
+ private boolean saveResource(Object sourceEntity, Path path, Gson gson) {
try {
Files.createDirectories(path.getParent());
- try (BufferedWriter fileWriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
- gson.toJson(sourceEntity, fileWriter);
- return true;
- }
+ return writeToFile(sourceEntity, path, gson);
} catch (IOException e) {
log.debug(e.getMessage());
}
return false;
}
+ /**
+ * This method is used to write actionCollection specific resource to file system. We write the data in two steps
+ * 1. Actual js code
+ * 2. Metadata of the actionCollection
+ * @param sourceEntity the metadata of the action collection
+ * @param body actual js code written by the user
+ * @param resourceName name of the action collection
+ * @param path file path where the resource will be stored
+ * @param gson
+ * @return if the file operation is successful
+ */
+ private boolean saveActionCollection(Object sourceEntity, String body, String resourceName, Path path, Gson gson) {
+ try {
+ Files.createDirectories(path);
+ // Write the js Object body to .js file to make conflict handling easier
+ Path bodyPath = path.resolve(resourceName + CommonConstants.JS_EXTENSION);
+ writeStringToFile(body, bodyPath);
+
+ // Write metadata for the jsObject
+ Path metadataPath = path.resolve(CommonConstants.METADATA + CommonConstants.JSON_EXTENSION);
+ return writeToFile(sourceEntity, metadataPath, gson);
+ } catch (IOException e) {
+ log.debug(e.getMessage());
+ }
+ return false;
+ }
+
+ private boolean writeStringToFile(String data, Path path) throws IOException {
+ try (BufferedWriter fileWriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
+ fileWriter.write(data);
+ return true;
+ }
+ }
+
+ private boolean writeToFile(Object sourceEntity, Path path, Gson gson) throws IOException {
+ try (BufferedWriter fileWriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
+ gson.toJson(sourceEntity, fileWriter);
+ return true;
+ }
+ }
+
/**
* This method will delete the JSON resource available in local git directory on subsequent commit made after the
* deletion of respective resource from DB
@@ -417,8 +482,8 @@ public Mono<ApplicationGitReference> reconstructApplicationReferenceFromGitRepo(
// Instance creator is required while de-serialising using Gson as key instance can't be invoked with
// no-args constructor
Gson gson = new GsonBuilder()
- .registerTypeAdapter(DatasourceStructure.Key.class, new DatasourceStructure.KeyInstanceCreator())
- .create();
+ .registerTypeAdapter(DatasourceStructure.Key.class, new DatasourceStructure.KeyInstanceCreator())
+ .create();
ApplicationGitReference applicationGitReference = fetchApplicationReference(baseRepoPath, gson);
processStopwatch.stopAndLogTimeInMillis();
@@ -522,6 +587,42 @@ private Map<String, Object> readFiles(Path directoryPath, Gson gson, String keyS
return resource;
}
+ /**
+ * This method will read the content of the file as a plain text and does not apply the gson to json transformation
+ * @param filePath file path for files on which read operation will be performed
+ * @return content of the file in the path
+ */
+ private String readFileAsString(Path filePath) {
+ String data = "";
+ try {
+ data = FileUtils.readFileToString(filePath.toFile(), "UTF-8");
+ } catch (IOException e) {
+ log.error(" Error while reading the file from git repo {0} ", e.getMessage());
+ }
+ return data;
+ }
+
+ /**
+ * This method is to read the content for action and actionCollection or any nested resources which has the new structure - v3
+ * Where the user queries and the metadata is split into to different files
+ * @param directoryPath file path for files on which read operation will be performed
+ * @return resources stored in the directory
+ */
+ private Map<String, Object> readActionCollection(Path directoryPath, Gson gson, String keySuffix, Map<String, String> actionCollectionBodyMap) {
+ Map<String, Object> resource = new HashMap<>();
+ File directory = directoryPath.toFile();
+ if (directory.isDirectory()) {
+ for (File dirFile : Objects.requireNonNull(directory.listFiles())) {
+ String resourceName = dirFile.getName();
+ String body = readFileAsString(directoryPath.resolve(resourceName).resolve( resourceName + CommonConstants.JS_EXTENSION));
+ Object file = readFile(directoryPath.resolve(resourceName).resolve( CommonConstants.METADATA + CommonConstants.JSON_EXTENSION), gson);
+ actionCollectionBodyMap.put(resourceName + keySuffix, body);
+ resource.put(resourceName + keySuffix, file);
+ }
+ }
+ return resource;
+ }
+
private ApplicationGitReference fetchApplicationReference(Path baseRepoPath, Gson gson) {
ApplicationGitReference applicationGitReference = new ApplicationGitReference();
// Extract application metadata from the json
@@ -549,26 +650,8 @@ private ApplicationGitReference fetchApplicationReference(Path baseRepoPath, Gso
break;
case 2:
- // Extract pages and nested actions and actionCollections
- File directory = pageDirectory.toFile();
- Map<String, Object> pageMap = new HashMap<>();
- Map<String, Object> actionMap = new HashMap<>();
- Map<String, Object> actionCollectionMap = new HashMap<>();
- // TODO same approach should be followed for modules(app level actions, actionCollections, widgets etc)
- if (directory.isDirectory()) {
- // Loop through all the directories and nested directories inside the pages directory to extract
- // pages, actions and actionCollections from the JSON files
- for (File page : Objects.requireNonNull(directory.listFiles())) {
- pageMap.put(page.getName(), readFile(page.toPath().resolve(CommonConstants.CANVAS + CommonConstants.JSON_EXTENSION), gson));
- actionMap.putAll(readFiles(page.toPath().resolve(ACTION_DIRECTORY), gson, page.getName()));
- actionCollectionMap.putAll(readFiles(page.toPath().resolve(ACTION_COLLECTION_DIRECTORY), gson, page.getName()));
- }
- }
- applicationGitReference.setActions(actionMap);
- applicationGitReference.setActionCollections(actionCollectionMap);
- applicationGitReference.setPages(pageMap);
- // Extract datasources
- applicationGitReference.setDatasources(readFiles(baseRepoPath.resolve(DATASOURCE_DIRECTORY), gson, ""));
+ case 3:
+ updateGitApplicationReference(baseRepoPath, gson, applicationGitReference, pageDirectory, fileFormatVersion);
break;
default:
@@ -582,6 +665,36 @@ private ApplicationGitReference fetchApplicationReference(Path baseRepoPath, Gso
return applicationGitReference;
}
+ private void updateGitApplicationReference(Path baseRepoPath, Gson gson, ApplicationGitReference applicationGitReference, Path pageDirectory, int fileFormatVersion) {
+ // Extract pages and nested actions and actionCollections
+ File directory = pageDirectory.toFile();
+ Map<String, Object> pageMap = new HashMap<>();
+ Map<String, Object> actionMap = new HashMap<>();
+ Map<String, Object> actionBodyMap = new HashMap<>();
+ Map<String, Object> actionCollectionMap = new HashMap<>();
+ Map<String, String> actionCollectionBodyMap = new HashMap<>();
+ // TODO same approach should be followed for modules(app level actions, actionCollections, widgets etc)
+ if (directory.isDirectory()) {
+ // Loop through all the directories and nested directories inside the pages directory to extract
+ // pages, actions and actionCollections from the JSON files
+ for (File page : Objects.requireNonNull(directory.listFiles())) {
+ pageMap.put(page.getName(), readFile(page.toPath().resolve(CommonConstants.CANVAS + CommonConstants.JSON_EXTENSION), gson));
+ actionMap.putAll(readFiles(page.toPath().resolve(ACTION_DIRECTORY), gson, page.getName()));
+ if (fileFormatVersion == 3) {
+ actionCollectionMap.putAll(readActionCollection(page.toPath().resolve(ACTION_COLLECTION_DIRECTORY), gson, page.getName(), actionCollectionBodyMap));
+ } else {
+ actionCollectionMap.putAll(readFiles(page.toPath().resolve(ACTION_COLLECTION_DIRECTORY), gson, page.getName()));
+ }
+ }
+ }
+ applicationGitReference.setActions(actionMap);
+ applicationGitReference.setActionCollections(actionCollectionMap);
+ applicationGitReference.setActionCollectionBody(actionCollectionBodyMap);
+ applicationGitReference.setPages(pageMap);
+ // Extract datasources
+ applicationGitReference.setDatasources(readFiles(baseRepoPath.resolve(DATASOURCE_DIRECTORY), gson, ""));
+ }
+
private Integer getFileFormatVersion(Object metadata) {
if (metadata == null) {
return 1;
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ApplicationGitReference.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ApplicationGitReference.java
index 405a7bcb05a2..91ee23ddde0e 100644
--- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ApplicationGitReference.java
+++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ApplicationGitReference.java
@@ -19,6 +19,7 @@ public class ApplicationGitReference {
Object theme;
Map<String, Object> actions;
Map<String, Object> actionCollections;
+ Map<String, String> actionCollectionBody;
Map<String, Object> pages;
Map<String, Object> datasources;
Map<String, Object> jsLibraries;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationTemplateControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationTemplateControllerCE.java
index 9e9ad013e9ac..1fb74765da53 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationTemplateControllerCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationTemplateControllerCE.java
@@ -1,7 +1,6 @@
package com.appsmith.server.controllers.ce;
import com.appsmith.server.constants.FieldName;
-import com.appsmith.server.domains.Application;
import com.appsmith.server.dtos.ApplicationImportDTO;
import com.appsmith.server.dtos.ApplicationTemplate;
import com.appsmith.server.dtos.ResponseDTO;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java
index a658cb2742fa..910cc3938b16 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java
@@ -36,8 +36,6 @@
import org.springframework.web.bind.annotation.ResponseStatus;
import reactor.core.publisher.Mono;
-import java.util.ArrayList;
-import java.util.EnumSet;
import java.util.List;
import java.util.Map;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionCollection.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionCollection.java
index ebc2f761415d..532cfdcb39eb 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionCollection.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionCollection.java
@@ -1,7 +1,7 @@
package com.appsmith.server.domains;
-import com.appsmith.external.models.BaseDomain;
import com.appsmith.server.dtos.ActionCollectionDTO;
+import com.appsmith.external.models.BaseDomain;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionCollectionDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionCollectionDTO.java
index 093979d5f96b..4975fa2ddf68 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionCollectionDTO.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionCollectionDTO.java
@@ -1,13 +1,13 @@
package com.appsmith.server.dtos;
+import com.appsmith.server.constants.FieldName;
+import com.appsmith.server.exceptions.AppsmithError;
+import com.appsmith.external.exceptions.ErrorDTO;
import com.appsmith.external.models.ActionDTO;
import com.appsmith.external.models.DefaultResources;
import com.appsmith.external.models.JSValue;
-import com.appsmith.server.constants.FieldName;
-import com.appsmith.server.domains.ActionCollection;
import com.appsmith.external.models.PluginType;
-import com.appsmith.server.exceptions.AppsmithError;
-import com.appsmith.external.exceptions.ErrorDTO;
+import com.appsmith.server.domains.ActionCollection;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java
index 1cf7666884a8..5b942faa8819 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java
@@ -194,6 +194,7 @@ public ApplicationGitReference createApplicationReference(ApplicationJson applic
// Insert JSOObjects and also assign the keys which later will be used for saving the resource in actual filepath
// JSObjectName_pageName => nomenclature for the keys
+ Map<String, String> resourceMapBody = new HashMap<>();
applicationJson
.getActionCollectionList()
.stream()
@@ -207,9 +208,13 @@ public ApplicationGitReference createApplicationReference(ApplicationJson applic
: actionCollection.getPublishedCollection().getName() + NAME_SEPARATOR + actionCollection.getPublishedCollection().getPageId();
removeUnwantedFieldFromActionCollection(actionCollection);
+ String body = actionCollection.getUnpublishedCollection().getBody() != null ? actionCollection.getUnpublishedCollection().getBody() : "";
+ actionCollection.getUnpublishedCollection().setBody(null);
+ resourceMapBody.put(prefix, body);
resourceMap.put(prefix, actionCollection);
});
applicationReference.setActionCollections(new HashMap<>(resourceMap));
+ applicationReference.setActionCollectionBody(new HashMap<>(resourceMapBody));
applicationReference.setUpdatedResources(updatedResources);
resourceMap.clear();
@@ -401,10 +406,17 @@ private ApplicationJson getApplicationJsonFromGitReference(ApplicationGitReferen
if (CollectionUtils.isNullOrEmpty(applicationReference.getActionCollections())) {
applicationJson.setActionCollectionList(new ArrayList<>());
} else {
+ Map<String, String> actionCollectionBody = applicationReference.getActionCollectionBody();
List<ActionCollection> actionCollections = getApplicationResource(applicationReference.getActionCollections(), ActionCollection.class);
// Remove null values if present
org.apache.commons.collections.CollectionUtils.filter(actionCollections, PredicateUtils.notNullPredicate());
actionCollections.forEach(actionCollection -> {
+ // Set the js object body to the unpublished collection
+ // Since file version v3 we are splitting the js object code and metadata separately
+ String keyName = actionCollection.getUnpublishedCollection().getName() + actionCollection.getUnpublishedCollection().getPageId();
+ if (actionCollectionBody!= null && actionCollectionBody.containsKey(keyName)) {
+ actionCollection.getUnpublishedCollection().setBody(actionCollectionBody.get(keyName));
+ }
// As we are publishing the app and then committing to git we expect the published and unpublished
// actionCollectionDTO will be same, so we create a deep copy for the published version for
// actionCollection from unpublishedActionCollectionDTO
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommentServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommentServiceCEImpl.java
index 57586b7593c2..3703a9a59675 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommentServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommentServiceCEImpl.java
@@ -59,9 +59,7 @@
import java.util.Map;
import java.util.Set;
-import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
import static com.appsmith.server.acl.AclPermission.READ_COMMENTS;
-import static com.appsmith.server.acl.AclPermission.READ_PAGES;
import static com.appsmith.server.acl.AclPermission.READ_THREADS;
import static com.appsmith.server.constants.CommentConstants.APPSMITH_BOT_NAME;
import static com.appsmith.server.constants.CommentConstants.APPSMITH_BOT_USERNAME;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GoogleRecaptchaServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GoogleRecaptchaServiceCEImpl.java
index da5828f4984a..437f0d715c09 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GoogleRecaptchaServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GoogleRecaptchaServiceCEImpl.java
@@ -3,11 +3,9 @@
import com.appsmith.server.configurations.GoogleRecaptchaConfig;
import com.appsmith.server.exceptions.AppsmithError;
import com.appsmith.server.exceptions.AppsmithException;
-import com.appsmith.server.services.CaptchaService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutServiceCEImpl.java
index 3732463d3486..090143714e99 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutServiceCEImpl.java
@@ -1,6 +1,5 @@
package com.appsmith.server.services.ce;
-import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.constants.FieldName;
import com.appsmith.server.domains.Layout;
import com.appsmith.server.dtos.PageDTO;
@@ -18,9 +17,6 @@
import java.util.ArrayList;
import java.util.List;
-import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
-import static com.appsmith.server.acl.AclPermission.READ_PAGES;
-
@Slf4j
public class LayoutServiceCEImpl implements LayoutServiceCE {
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/MarketplaceServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/MarketplaceServiceCEImpl.java
index 2f5981ffbd61..4e57d722ceac 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/MarketplaceServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/MarketplaceServiceCEImpl.java
@@ -6,12 +6,10 @@
import com.appsmith.server.dtos.ProviderPaginatedDTO;
import com.appsmith.server.exceptions.AppsmithError;
import com.appsmith.server.exceptions.AppsmithException;
-import com.appsmith.server.services.MarketplaceService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/GitServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/GitServiceTest.java
index 9b872d8cc69d..2eac5191b96b 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/GitServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/GitServiceTest.java
@@ -10,9 +10,9 @@
import com.appsmith.external.models.DatasourceConfiguration;
import com.appsmith.external.models.DefaultResources;
import com.appsmith.external.models.JSValue;
-import com.appsmith.external.models.PluginType;
import com.appsmith.server.constants.FieldName;
import com.appsmith.server.domains.ActionCollection;
+import com.appsmith.external.models.PluginType;
import com.appsmith.server.domains.Application;
import com.appsmith.server.domains.ApplicationPage;
import com.appsmith.server.domains.GitApplicationMetadata;
|
2ad121a0920e75f38245ddbb667e45ca1c4e94cf
|
2022-02-24 12:34:31
|
Aswath K
|
feat: Keyboard accessible property pane header (#11339)
| false
|
Keyboard accessible property pane header (#11339)
|
feat
|
diff --git a/app/client/src/components/ads/Button.tsx b/app/client/src/components/ads/Button.tsx
index 815c2ec0f91f..d0b35668b20f 100644
--- a/app/client/src/components/ads/Button.tsx
+++ b/app/client/src/components/ads/Button.tsx
@@ -378,7 +378,8 @@ const ButtonStyles = css<ThemeProp & ButtonProps>`
fill: ${(props) => btnColorStyles(props, "main").txtColor};
}
}
- &:hover {
+ &:hover,
+ &:focus {
text-decoration: none;
background-color: ${(props) => btnColorStyles(props, "hover").bgColor};
color: ${(props) => btnColorStyles(props, "hover").txtColor};
diff --git a/app/client/src/components/ads/Dropdown.tsx b/app/client/src/components/ads/Dropdown.tsx
index 37bec2ec20bf..e42218c1316d 100644
--- a/app/client/src/components/ads/Dropdown.tsx
+++ b/app/client/src/components/ads/Dropdown.tsx
@@ -687,14 +687,6 @@ export function RenderDropdownOptions(props: DropdownOptionsProps) {
maxHeight={props.dropdownMaxHeight || "auto"}
>
{options.map((option: DropdownOption, index: number) => {
- if (renderOption) {
- return renderOption({
- option,
- index,
- optionClickHandler,
- optionWidth,
- });
- }
let isSelected = false;
if (
props.isMultiSelect &&
@@ -708,6 +700,15 @@ export function RenderDropdownOptions(props: DropdownOptionsProps) {
isSelected =
(props.selected as DropdownOption).value === option.value;
}
+ if (renderOption) {
+ return renderOption({
+ option,
+ index,
+ optionClickHandler,
+ optionWidth,
+ isSelectedNode: isSelected,
+ });
+ }
return !option.isSectionHeader ? (
<OptionWrapper
aria-selected={isSelected}
diff --git a/app/client/src/pages/Editor/PropertyPane/ConnectDataCTA.tsx b/app/client/src/pages/Editor/PropertyPane/ConnectDataCTA.tsx
index 853333629a5b..c7f269000f81 100644
--- a/app/client/src/pages/Editor/PropertyPane/ConnectDataCTA.tsx
+++ b/app/client/src/pages/Editor/PropertyPane/ConnectDataCTA.tsx
@@ -30,10 +30,11 @@ const StyledDiv = styled.div`
props.theme.spaces[7]}px;
margin: ${(props) => props.theme.spaces[2]}px 0px;
- a:first-child {
+ button:first-child {
margin-top: ${(props) => props.theme.spaces[2]}px;
+ width: 100%;
}
- a:nth-child(2) {
+ button:nth-child(2) {
border: none;
background-color: transparent;
text-transform: none;
@@ -43,7 +44,7 @@ const StyledDiv = styled.div`
${(props) => getTypographyByKey(props, "p3")}
margin-top: ${(props) => props.theme.spaces[2]}px;
- :hover {
+ :hover, :focus {
text-decoration: underline;
}
}
@@ -95,11 +96,15 @@ function ConnectDataCTA(props: ConnectDataCTAProps) {
category={Category.primary}
onClick={onClick}
size={Size.large}
+ tabIndex={0}
+ tag="button"
text="CONNECT DATA"
/>
<Button
category={Category.tertiary}
onClick={openHelpModal}
+ tabIndex={0}
+ tag="button"
text="Learn more"
/>
</StyledDiv>
diff --git a/app/client/src/pages/Editor/PropertyPane/PropertyPaneConnections.tsx b/app/client/src/pages/Editor/PropertyPane/PropertyPaneConnections.tsx
index 0cd472be623a..59ab49b667dd 100644
--- a/app/client/src/pages/Editor/PropertyPane/PropertyPaneConnections.tsx
+++ b/app/client/src/pages/Editor/PropertyPane/PropertyPaneConnections.tsx
@@ -1,4 +1,4 @@
-import React, { memo, useMemo, useCallback } from "react";
+import React, { memo, useMemo, useCallback, useEffect } from "react";
import styled from "styled-components";
import Icon, { IconSize } from "components/ads/Icon";
import Dropdown, {
@@ -125,6 +125,7 @@ const OptionWrapper = styled.div<{ hasError: boolean; fillIconColor: boolean }>`
const OptionContentWrapper = styled.div<{
hasError: boolean;
+ isSelected: boolean;
}>`
padding: ${(props) => props.theme.spaces[2] + 1}px
${(props) => props.theme.spaces[5]}px;
@@ -134,6 +135,10 @@ const OptionContentWrapper = styled.div<{
line-height: 8px;
flex: 1;
min-width: 0;
+ background-color: ${(props) =>
+ props.isSelected &&
+ !props.hasError &&
+ props.theme.colors.dropdown.hovered.bg};
span:first-child {
font-size: 10px;
@@ -210,7 +215,7 @@ const useDependencyList = (name: string) => {
const dependencyOptions =
entityDependencies?.directDependencies.map((e) => ({
label: e,
- value: getEntityId(e),
+ value: getEntityId(e) ?? e,
})) ?? [];
const inverseDependencyOptions =
entityDependencies?.inverseDependencies.map((e) => ({
@@ -245,12 +250,28 @@ function OptionNode(props: any) {
});
};
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (!props.isSelectedNode) return;
+ if (e.key === " " || e.key === "Enter") onClick();
+ };
+
+ useEffect(() => {
+ document.addEventListener("keydown", handleKeyDown);
+ return () => {
+ document.removeEventListener("keydown", handleKeyDown);
+ };
+ }, [props.isSelectedNode]);
+
return (
<OptionWrapper
fillIconColor={!entityInfo?.datasourceName}
hasError={!!entityInfo?.hasError}
>
- <OptionContentWrapper hasError={!!entityInfo?.hasError} onClick={onClick}>
+ <OptionContentWrapper
+ hasError={!!entityInfo?.hasError}
+ isSelected={props.isSelectedNode}
+ onClick={onClick}
+ >
<span>{entityInfo?.icon}</span>
<Text type={TextType.H6}>
{props.option.label}{" "}
@@ -297,6 +318,7 @@ const TriggerNode = memo((props: TriggerNodeProps) => {
<Tooltip
content={tooltipText}
disabled={props.isOpen}
+ openOnTargetFocus={false}
position={props.tooltipPosition}
>
{props.entityCount ? `${props.entityCount} ${ENTITY}` : "No Entity"}
@@ -360,7 +382,12 @@ function PropertyPaneConnections(props: PropertyPaneConnectionsProps) {
height={`${CONNECTION_HEIGHT}px`}
options={dependencies.dependencyOptions}
renderOption={(optionProps) => {
- return <OptionNode option={optionProps.option} />;
+ return (
+ <OptionNode
+ isSelectedNode={optionProps.isSelectedNode}
+ option={optionProps.option}
+ />
+ );
}}
selected={selectedOption}
showDropIcon={false}
diff --git a/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx b/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx
index 87f9e5b1b25f..6108c78ff0ca 100644
--- a/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx
+++ b/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx
@@ -73,7 +73,7 @@ function PropertyPaneView(
tooltipPosition: "bottom-right",
icon: (
<button
- className="p-1 hover:bg-warmGray-100 group t--copy-widget"
+ className="p-1 hover:bg-warmGray-100 focus:bg-warmGray-100 group t--copy-widget"
onClick={onCopy}
>
<CopyIcon className="w-4 h-4 text-gray-500" />
@@ -85,7 +85,7 @@ function PropertyPaneView(
tooltipPosition: "bottom-right",
icon: (
<button
- className="p-1 hover:bg-warmGray-100 group t--delete-widget"
+ className="p-1 hover:bg-warmGray-100 focus:bg-warmGray-100 group t--delete-widget"
onClick={onDelete}
>
<DeleteIcon className="w-4 h-4 text-gray-500" />
|
61648c6f34dc31583d7757ff76b7cb3605c218b1
|
2023-05-29 13:01:34
|
Ayush Pahwa
|
chore: code split for sidebar env split (#23806)
| false
|
code split for sidebar env split (#23806)
|
chore
|
diff --git a/app/client/src/ee/components/DSDataFilter/index.tsx b/app/client/src/ee/components/DSDataFilter/index.tsx
index e0c5849b3e4d..ae2f052bdf40 100644
--- a/app/client/src/ee/components/DSDataFilter/index.tsx
+++ b/app/client/src/ee/components/DSDataFilter/index.tsx
@@ -1,6 +1,12 @@
type DSDataFilterProps = {
- updateFilter: (id: string, name: string, userPermissions: string[]) => void;
+ updateFilter: (
+ id: string,
+ name: string,
+ userPermissions: string[],
+ showFilterPane: boolean,
+ ) => void;
pluginType: string;
+ showFilterComponent: boolean;
};
function DSDataFilter({}: DSDataFilterProps) {
diff --git a/app/client/src/pages/Editor/DataSourceEditor/DBForm.tsx b/app/client/src/pages/Editor/DataSourceEditor/DBForm.tsx
index 83df344b67f0..8b4f40ef5b05 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/DBForm.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/DBForm.tsx
@@ -30,18 +30,22 @@ interface DatasourceDBEditorProps extends JSONtoFormProps {
datasource: Datasource;
hiddenHeader?: boolean;
datasourceName?: string;
+ showFilterComponent: boolean;
}
type Props = DatasourceDBEditorProps &
InjectedFormProps<Datasource, DatasourceDBEditorProps>;
-export const Form = styled.form`
+export const Form = styled.form<{
+ showFilterComponent: boolean;
+}>`
display: flex;
flex-direction: column;
height: ${({ theme }) => `calc(100% - ${theme.backBanner})`};
overflow-y: scroll;
flex: 8 8 80%;
padding-bottom: 20px;
+ margin-left: ${(props) => (props.showFilterComponent ? "24px" : "0px")};
`;
export const ViewModeWrapper = styled.div`
@@ -76,6 +80,7 @@ class DatasourceDBEditor extends JSONtoForm<Props> {
formConfig,
messages,
pluginType,
+ showFilterComponent,
viewMode,
} = this.props;
@@ -84,6 +89,7 @@ class DatasourceDBEditor extends JSONtoForm<Props> {
onSubmit={(e) => {
e.preventDefault();
}}
+ showFilterComponent={showFilterComponent}
>
{messages &&
messages.map((msg, i) => {
diff --git a/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx b/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
index fd9810fceac0..d9535430eb26 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
@@ -73,7 +73,12 @@ export const ResizerContentContainer = styled.div`
&.saas-form-resizer-content,
&.api-datasource-content-container {
flex-direction: column;
- padding: 0 var(--ads-v2-spaces-7) var(--ads-v2-spaces-7);
+ padding: 0 var(--ads-v2-spaces-7) 0 var(--ads-v2-spaces-7);
+ }
+ .db-form-content-container {
+ display: flex;
+ flex-direction: column;
+ width: 100%;
}
`;
diff --git a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx
index fdae6929478e..f195e02b9a42 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx
@@ -65,6 +65,7 @@ interface DatasourceRestApiEditorProps {
formMeta: any;
messages?: Array<string>;
datasourceName: string;
+ showFilterComponent: boolean;
createDatasource: (
data: Datasource,
onSuccess?: ReduxAction<unknown>,
@@ -246,6 +247,7 @@ class DatasourceRestAPIEditor extends React.Component<Props> {
onSubmit={(e) => {
e.preventDefault();
}}
+ showFilterComponent={this.props.showFilterComponent}
>
{this.renderEditor()}
</Form>
diff --git a/app/client/src/pages/Editor/DataSourceEditor/index.tsx b/app/client/src/pages/Editor/DataSourceEditor/index.tsx
index 2a0f68fc4099..fa0c36bdbe4e 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/index.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/index.tsx
@@ -130,10 +130,18 @@ type Props = ReduxStateProps &
pageId: string;
}>;
+const DSEditorWrapper = styled.div`
+ height: calc(100vh - ${(props) => props.theme.headerHeight});
+ overflow: hidden;
+ display: flex;
+ flex-direction: row;
+`;
+
type DatasourceFilterState = {
id: string;
name: string;
userPermissions: string[];
+ showFilterPane: boolean;
};
/*
@@ -185,6 +193,7 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
id: "",
name: "",
userPermissions: [],
+ showFilterPane: true,
},
unblock: () => {
return undefined;
@@ -422,13 +431,19 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
}
}
- updateFilter = (id: string, name: string, userPermissions: string[]) => {
+ updateFilter = (
+ id: string,
+ name: string,
+ userPermissions: string[],
+ showFilterPane: boolean,
+ ) => {
this.setState({
...this.state,
filterParams: {
id,
name,
userPermissions,
+ showFilterPane,
},
});
};
@@ -447,7 +462,7 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
);
}
- renderForm() {
+ renderForm(showFilterComponent: boolean) {
const {
datasource,
datasourceId,
@@ -487,6 +502,7 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
pageId={pageId}
pluginName={pluginName}
pluginPackageName={pluginPackageName}
+ showFilterComponent={showFilterComponent}
/>
{this.renderSaveDisacardModal()}
</>
@@ -507,6 +523,7 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
pageId={pageId}
pluginType={pluginType}
setupConfig={this.setupConfig}
+ showFilterComponent={showFilterComponent}
viewMode={viewMode && !isInsideReconnectModal}
/>
{this.renderSaveDisacardModal()}
@@ -566,6 +583,11 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
return <EntityNotFoundPane />;
}
+ const showFilterComponent =
+ !viewMode &&
+ !isInsideReconnectModal &&
+ this.state.filterParams.showFilterPane;
+
// for saas form
if (pluginType === "SAAS") {
// todo check if we can remove the flag here
@@ -616,31 +638,39 @@ class DatasourceEditorRouter extends React.Component<Props, State> {
/>
)}
<ResizerMainContainer>
- <DSDataFilter
- pluginType={pluginType}
- updateFilter={this.updateFilter}
- />
<ResizerContentContainer className="db-form-resizer-content">
- {this.renderForm()}
- {/* Render datasource form call-to-actions */}
- {datasource && (
- <DatasourceAuth
- datasource={datasource as Datasource}
- datasourceButtonConfiguration={datasourceButtonConfiguration}
- formData={formData}
- getSanitizedFormData={memoize(this.getSanitizedData)}
- isFormDirty={this.props.isFormDirty}
- isInsideReconnectModal={isInsideReconnectModal}
- isInvalid={this.validateForm()}
- isSaving={isSaving}
- isTesting={isTesting}
- pluginName={pluginName}
- pluginPackageName={pluginPackageName}
- pluginType={pluginType as PluginType}
- triggerSave={triggerSave}
- viewMode={viewMode}
+ <DSEditorWrapper>
+ <DSDataFilter
+ pluginType={this.props.pluginType}
+ showFilterComponent={showFilterComponent}
+ updateFilter={this.updateFilter}
/>
- )}
+ <div className="db-form-content-container">
+ {this.renderForm(showFilterComponent)}
+ {/* Render datasource form call-to-actions */}
+ {datasource && (
+ <DatasourceAuth
+ datasource={datasource as Datasource}
+ datasourceButtonConfiguration={
+ datasourceButtonConfiguration
+ }
+ formData={formData}
+ getSanitizedFormData={memoize(this.getSanitizedData)}
+ isFormDirty={this.props.isFormDirty}
+ isInsideReconnectModal={isInsideReconnectModal}
+ isInvalid={this.validateForm()}
+ isSaving={isSaving}
+ isTesting={isTesting}
+ pluginName={pluginName}
+ pluginPackageName={pluginPackageName}
+ pluginType={pluginType as PluginType}
+ showFilterComponent={showFilterComponent}
+ triggerSave={triggerSave}
+ viewMode={viewMode}
+ />
+ )}
+ </div>
+ </DSEditorWrapper>
</ResizerContentContainer>
{showDebugger && <Debugger />}
</ResizerMainContainer>
diff --git a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
index 994835c712ad..6dda20c5a4b5 100644
--- a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
+++ b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
@@ -415,6 +415,7 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
onSubmit={(e) => {
e.preventDefault();
}}
+ showFilterComponent={false}
>
{(!viewMode || createFlow || isInsideReconnectModal) && (
<>
@@ -486,6 +487,7 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> {
pluginType={plugin?.type as PluginType}
scopeValue={scopeValue}
shouldDisplayAuthMessage={!isGoogleSheetPlugin}
+ showFilterComponent={false}
triggerSave={this.props.isDatasourceBeingSavedFromPopup}
viewMode={viewMode}
/>
diff --git a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx
index af0a2eef4916..5bb5ec8ee78a 100644
--- a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx
+++ b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx
@@ -80,7 +80,7 @@ const QuickActionButtonContainer = styled.div<{ disabled?: boolean }>`
}
`;
-const capitalizeFirstLetter = (string = " ") => {
+export const capitalizeFirstLetter = (string = " ") => {
return string.charAt(0).toUpperCase() + string.toLowerCase().slice(1);
};
diff --git a/app/client/src/pages/common/datasourceAuth/index.tsx b/app/client/src/pages/common/datasourceAuth/index.tsx
index 627033ae6932..f56bb1efcf54 100644
--- a/app/client/src/pages/common/datasourceAuth/index.tsx
+++ b/app/client/src/pages/common/datasourceAuth/index.tsx
@@ -55,6 +55,7 @@ interface Props {
triggerSave?: boolean;
isFormDirty?: boolean;
scopeValue?: string;
+ showFilterComponent: boolean;
}
export type DatasourceFormButtonTypes = Record<string, string[]>;
@@ -83,11 +84,13 @@ export const DatasourceButtonType: Record<
export const ActionButton = styled(Button)<{
floatLeft: boolean;
+ showFilterComponent: boolean;
}>`
&&& {
// Pulling button to the left if floatLeft is set as true
margin-right: ${(props) => (props.floatLeft ? "auto" : "9px")};
- margin-left: ${(props) => (props.floatLeft ? "20px" : "0px")};
+ // If filter component is present, then we need to push the button to the right
+ margin-left: ${(props) => (props.showFilterComponent ? "24px" : "0px")};
}
`;
@@ -135,6 +138,7 @@ function DatasourceAuth({
isFormDirty,
scopeValue,
isInsideReconnectModal,
+ showFilterComponent,
}: Props) {
const shouldRender = !viewMode || isInsideReconnectModal;
const authType =
@@ -298,6 +302,7 @@ function DatasourceAuth({
key={buttonType}
kind="secondary"
onClick={handleDatasourceTest}
+ showFilterComponent={showFilterComponent}
size="md"
>
{createMessage(TEST_BUTTON_TEXT)}
|
1082cb9ca3ff95676ba133cbc1cf75a1faa981f2
|
2021-08-24 16:30:55
|
arunvjn
|
fix: Sentry type error in DB form (#6817)
| false
|
Sentry type error in DB form (#6817)
|
fix
|
diff --git a/app/client/src/pages/Editor/DataSourceEditor/JSONtoForm.tsx b/app/client/src/pages/Editor/DataSourceEditor/JSONtoForm.tsx
index 382756ed88cb..58e1245ddb0f 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/JSONtoForm.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/JSONtoForm.tsx
@@ -107,7 +107,7 @@ export class JSONtoForm<
const fieldConfig = this.requiredFields[fieldConfigProperty];
if (fieldConfig.controlType === "KEYVALUE_ARRAY") {
const configProperty = fieldConfig.configProperty.split("[*].");
- const arrayValues = _.get(values, configProperty[0]);
+ const arrayValues = _.get(values, configProperty[0], []);
const keyValueArrayErrors: Record<string, string>[] = [];
arrayValues.forEach((value: any, index: number) => {
@@ -165,7 +165,7 @@ export class JSONtoForm<
if (checked[properties[0]]) continue;
checked[properties[0]] = 1;
- const values = _.get(formData, properties[0]);
+ const values = _.get(formData, properties[0], []);
const newValues: ({ [s: string]: unknown } | ArrayLike<unknown>)[] = [];
values.forEach(
|
f7208c97752952a7711220bfa8155d10316b306e
|
2023-10-09 11:36:37
|
Rahul Barwal
|
fix: Updates tab title from publish to showcase (#27867)
| false
|
Updates tab title from publish to showcase (#27867)
|
fix
|
diff --git a/app/client/build.sh b/app/client/build.sh
index b15fd524c3d1..74a34f58022b 100755
--- a/app/client/build.sh
+++ b/app/client/build.sh
@@ -18,6 +18,8 @@ fi
# build cra app
export REACT_APP_SENTRY_RELEASE=$GIT_SHA
export REACT_APP_CLIENT_LOG_LEVEL=ERROR
+export REACT_APP_CLOUD_HOSTING=true
+
# Disable CRA built-in ESLint checks since we have our own config and a separate step for this
export DISABLE_ESLINT_PLUGIN=true
craco --max-old-space-size=7168 build --config craco.build.config.js
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index 85ebf0d6c9b0..d3df5b10c4a7 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -2075,7 +2075,7 @@ export const DATASOURCE_DROPDOWN_OPTIONS = {
};
export const COMMUNITY_TEMPLATES = {
- publish: () => "Publish",
+ tabTitle: () => "Showcase",
cancel: () => "Cancel",
publishSuccessPage: {
title: () => "Live on Appsmith community",
diff --git a/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/CommunityTemplateForm.tsx b/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/CommunityTemplateForm.tsx
index a1d942f5e08a..04e387d26e3a 100644
--- a/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/CommunityTemplateForm.tsx
+++ b/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/CommunityTemplateForm.tsx
@@ -2,6 +2,8 @@ import {
COMMUNITY_TEMPLATES,
createMessage,
} from "@appsmith/constants/messages";
+import { getCurrentPageId } from "@appsmith/selectors/entitiesSelector";
+import { viewerURL } from "RouteBuilder";
import { publishCommunityTemplate } from "actions/communityTemplateActions";
import { Button, Checkbox } from "design-system";
import React, { useEffect, useMemo, useState } from "react";
@@ -18,10 +20,7 @@ import {
import ApplicationSettings from "./components/ApplicationSettings";
import AuthorDetailsInput from "./components/AuthorDetailsInput";
import PublishedInfo from "./components/PublishedInfo";
-import TemplateCardPreview from "./components/TemplateCardPreview";
import TemplateInfoForm from "./components/TemplateInfoForm";
-import { viewerURL } from "RouteBuilder";
-import { getCurrentPageId } from "@appsmith/selectors/entitiesSelector";
type Props = {
onPublishSuccess: () => void;
@@ -110,11 +109,11 @@ const CommunityTemplateForm = ({ onPublishSuccess }: Props) => {
return (
<>
<PublishPageBodyContainer>
- <TemplateCardPreview
+ {/*<TemplateCardPreview
excerpt={templateExcerpt}
templateName={templateName}
useCases={templateUseCases}
- />
+ />*/}
<PublishPageTemplateDetailsInputContainer>
<TemplateInfoForm
setTemplateDescription={setTemplateDescription}
diff --git a/app/client/src/pages/Editor/EditorHeader.tsx b/app/client/src/pages/Editor/EditorHeader.tsx
index fe25696c3be8..77d22ee33600 100644
--- a/app/client/src/pages/Editor/EditorHeader.tsx
+++ b/app/client/src/pages/Editor/EditorHeader.tsx
@@ -582,7 +582,7 @@ export function EditorHeader() {
{featureFlags.release_show_publish_app_to_community_enabled &&
cloudHosting && (
<Tab data-testid="t--tab-PUBLISH" value="publish">
- {createMessage(COMMUNITY_TEMPLATES.publish)}
+ {createMessage(COMMUNITY_TEMPLATES.tabTitle)}
</Tab>
)}
</TabsList>
|
4fa35210a8635c7f91c9d646171b6a13b0e846a1
|
2023-10-19 20:50:17
|
Abhinav Jha
|
chore: Update DSL for Anvil (#27966)
| false
|
Update DSL for Anvil (#27966)
|
chore
|
diff --git a/app/client/src/ce/api/ApplicationApi.tsx b/app/client/src/ce/api/ApplicationApi.tsx
index 4b3786b132bb..a78ac965d28a 100644
--- a/app/client/src/ce/api/ApplicationApi.tsx
+++ b/app/client/src/ce/api/ApplicationApi.tsx
@@ -9,7 +9,10 @@ import type { ApplicationVersion } from "@appsmith/actions/applicationActions";
import type { Datasource } from "entities/Datasource";
import type { NavigationSetting } from "constants/AppConstants";
import { getSnapShotAPIRoute } from "@appsmith/constants/ApiConstants";
-import type { LayoutSystemTypeConfig } from "layoutSystems/types";
+import type {
+ LayoutSystemTypeConfig,
+ LayoutSystemTypes,
+} from "layoutSystems/types";
export type EvaluationVersion = number;
@@ -86,6 +89,7 @@ export interface CreateApplicationRequest {
workspaceId: string;
color?: AppColorCode;
icon?: IconNames;
+ layoutSystemType: LayoutSystemTypes;
}
export interface SetDefaultPageRequest {
@@ -210,6 +214,7 @@ export interface UpdateApplicationResponse {
embedSetting: AppEmbedSetting;
applicationDetail?: {
navigationSetting?: NavigationSetting;
+ appPositioning?: LayoutSystemTypeConfig;
};
}
@@ -298,7 +303,11 @@ export class ApplicationApi extends Api {
return Api.post(
ApplicationApi.baseURL +
ApplicationApi.createApplicationPath(request.workspaceId),
- { name: request.name, color: request.color, icon: request.icon },
+ {
+ name: request.name,
+ color: request.color,
+ icon: request.icon,
+ },
);
}
diff --git a/app/client/src/ce/entities/FeatureFlag.ts b/app/client/src/ce/entities/FeatureFlag.ts
index 6e0670540a4e..f6db7e1ea564 100644
--- a/app/client/src/ce/entities/FeatureFlag.ts
+++ b/app/client/src/ce/entities/FeatureFlag.ts
@@ -24,6 +24,7 @@ export const FEATURE_FLAG = {
release_show_publish_app_to_community_enabled:
"release_show_publish_app_to_community_enabled",
license_gac_enabled: "license_gac_enabled",
+ release_anvil_enabled: "release_anvil_enabled",
release_app_sidebar_enabled: "release_app_sidebar_enabled",
} as const;
@@ -50,6 +51,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
license_private_embeds_enabled: false,
release_show_publish_app_to_community_enabled: false,
license_gac_enabled: false,
+ release_anvil_enabled: false,
release_app_sidebar_enabled: false,
};
diff --git a/app/client/src/ce/sagas/ApplicationSagas.tsx b/app/client/src/ce/sagas/ApplicationSagas.tsx
index cf02903b545f..f2a50f6ccb41 100644
--- a/app/client/src/ce/sagas/ApplicationSagas.tsx
+++ b/app/client/src/ce/sagas/ApplicationSagas.tsx
@@ -131,6 +131,9 @@ import {
import { setAllEntityCollapsibleStates } from "actions/editorContextActions";
import { getCurrentEnvironmentId } from "@appsmith/selectors/environmentSelectors";
import type { DeletingMultipleApps } from "@appsmith/reducers/uiReducers/applicationsReducer";
+import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors";
+import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
+import { LayoutSystemTypes } from "layoutSystems/types";
export const getDefaultPageId = (
pages?: ApplicationPagePayload[],
@@ -590,7 +593,22 @@ export function* createApplicationSaga(
icon: icon,
color: color,
workspaceId,
+ layoutSystemType: LayoutSystemTypes.FIXED, // Note: This may be provided as an action payload in the future
};
+
+ /** SPECIAL HANDLING FOR ANVIL DURING EXPERIMENTATION */
+ // Check if Anvil is enabled for the user
+ // If so, default to using Anvil as the layout system for the new app
+ const isAnvilEnabled: boolean = yield select(
+ selectFeatureFlagCheck,
+ FEATURE_FLAG.release_anvil_enabled,
+ );
+
+ if (isAnvilEnabled) {
+ request.layoutSystemType = LayoutSystemTypes.ANVIL;
+ }
+ /** EO SPECIAL HANDLING FOR ANVIL DURING EXPERIMENTATION */
+
const response: CreateApplicationResponse = yield call(
ApplicationApi.createApplication,
request,
diff --git a/app/client/src/layoutSystems/anvil/utils/AnvilDSLTransformer.test.ts b/app/client/src/layoutSystems/anvil/utils/AnvilDSLTransformer.test.ts
new file mode 100644
index 000000000000..8d09a1a46596
--- /dev/null
+++ b/app/client/src/layoutSystems/anvil/utils/AnvilDSLTransformer.test.ts
@@ -0,0 +1,35 @@
+import { anvilDSLTransformer } from "./AnvilDSLTransformer";
+import { mainContainerProps } from "mocks/widgetProps/input";
+describe("Test the DSL transformer for Anvil", () => {
+ it("should add a layout if it does not exist in the DSL", () => {
+ // Arrange
+ const dsl = mainContainerProps;
+
+ // Act
+ const result = anvilDSLTransformer(dsl);
+
+ // Assert
+ expect(result).toHaveProperty("layout");
+ expect(result.layout).toHaveLength(1);
+ });
+
+ it("should not add a layout if it already exists in the DSL", () => {
+ // Arrange
+ const dsl = {
+ ...mainContainerProps,
+ layout: [
+ {
+ layoutId: "existingLayout",
+ layoutType: "CUSTOM",
+ layout: [],
+ },
+ ],
+ };
+
+ // Act
+ const result = anvilDSLTransformer(dsl);
+
+ // Assert
+ expect(result).toEqual(dsl); // The result should be the same as the input since the layout exists
+ });
+});
diff --git a/app/client/src/layoutSystems/anvil/utils/AnvilDSLTransformer.ts b/app/client/src/layoutSystems/anvil/utils/AnvilDSLTransformer.ts
new file mode 100644
index 000000000000..50cbc17e6071
--- /dev/null
+++ b/app/client/src/layoutSystems/anvil/utils/AnvilDSLTransformer.ts
@@ -0,0 +1,37 @@
+import type { DSLWidget } from "WidgetProvider/constants";
+import { generateReactKey } from "utils/generators";
+
+/**
+ * This function transforms a page's DSL to become compatible with the Anvil Layout system
+ * Note: This also gets rid of any properties that are not needed for the Auto Layout system
+ * @returns dsl: The transformed DSL
+ */
+export function anvilDSLTransformer(dsl: DSLWidget) {
+ const _dsl = dsl; // new reference, we don't want to modify the args directly
+ // If there isn't a layout object, we need to create one for Anvil
+ // Assumptions:
+ // If there is no layout object, then we haven't run this function on this DSL yet
+ // If there is a layout object, we have never moved to another layout system for this DSL
+ if (!dsl.hasOwnProperty("layout")) {
+ _dsl.layout = [
+ {
+ layoutId: generateReactKey(),
+ layoutType: "ALIGNED_COLUMN",
+ layout: [],
+ layoutStyle: {
+ border: "none",
+ minHeight: "100%",
+ },
+ isDropTarget: true,
+ isPermanent: true,
+ childTemplate: {
+ layoutId: "",
+ layoutType: "ALIGNED_ROW",
+ layout: [],
+ insertChild: true,
+ },
+ },
+ ];
+ }
+ return _dsl;
+}
diff --git a/app/client/src/layoutSystems/autolayout/utils/AutoLayoutDSLTransformer.ts b/app/client/src/layoutSystems/autolayout/utils/AutoLayoutDSLTransformer.ts
new file mode 100644
index 000000000000..4580ca600c68
--- /dev/null
+++ b/app/client/src/layoutSystems/autolayout/utils/AutoLayoutDSLTransformer.ts
@@ -0,0 +1,17 @@
+import type { DSLWidget } from "WidgetProvider/constants";
+import convertDSLtoAutoAndUpdatePositions from "layoutSystems/common/DSLConversions/fixedToAutoLayout";
+import { checkIsDSLAutoLayout } from "./AutoLayoutUtils";
+
+/**
+ * This function transforms a page's DSL to become compatible with the Auto Layout system
+ * @param mainCanvasWidth The width of the Canvas in pixels
+ * @returns dsl: The transformed DSL
+ */
+export function autoLayoutDSLTransformer(mainCanvasWidth: number) {
+ return function (dsl: DSLWidget) {
+ if (checkIsDSLAutoLayout(dsl)) {
+ return dsl;
+ }
+ return convertDSLtoAutoAndUpdatePositions(dsl, mainCanvasWidth);
+ };
+}
diff --git a/app/client/src/utils/DSLConversions/autoToFixedLayout.ts b/app/client/src/layoutSystems/common/DSLConversions/autoToFixedLayout.ts
similarity index 100%
rename from app/client/src/utils/DSLConversions/autoToFixedLayout.ts
rename to app/client/src/layoutSystems/common/DSLConversions/autoToFixedLayout.ts
diff --git a/app/client/src/utils/DSLConversions/fixedToAutoLayout.ts b/app/client/src/layoutSystems/common/DSLConversions/fixedToAutoLayout.ts
similarity index 100%
rename from app/client/src/utils/DSLConversions/fixedToAutoLayout.ts
rename to app/client/src/layoutSystems/common/DSLConversions/fixedToAutoLayout.ts
diff --git a/app/client/src/utils/DSLConversions/tests/autoToFixedLayout.test.ts b/app/client/src/layoutSystems/common/DSLConversions/tests/autoToFixedLayout.test.ts
similarity index 99%
rename from app/client/src/utils/DSLConversions/tests/autoToFixedLayout.test.ts
rename to app/client/src/layoutSystems/common/DSLConversions/tests/autoToFixedLayout.test.ts
index d56890e037ca..c1d366756675 100644
--- a/app/client/src/utils/DSLConversions/tests/autoToFixedLayout.test.ts
+++ b/app/client/src/layoutSystems/common/DSLConversions/tests/autoToFixedLayout.test.ts
@@ -1,6 +1,5 @@
import type { CanvasWidgetsReduxState } from "reducers/entityReducers/canvasWidgetsReducer";
import { convertNormalizedDSLToFixed } from "../autoToFixedLayout";
-// import { convertNormalizedDSLToFixed } from "../autoToFixedLayout";
describe("test Auto to Fixed Conversion methods", () => {
const autoLayoutWidgets = {
diff --git a/app/client/src/utils/DSLConversions/tests/fixedToAutoLayout.test.ts b/app/client/src/layoutSystems/common/DSLConversions/tests/fixedToAutoLayout.test.ts
similarity index 100%
rename from app/client/src/utils/DSLConversions/tests/fixedToAutoLayout.test.ts
rename to app/client/src/layoutSystems/common/DSLConversions/tests/fixedToAutoLayout.test.ts
diff --git a/app/client/src/layoutSystems/common/utils/LayoutSystemDSLTransformer.ts b/app/client/src/layoutSystems/common/utils/LayoutSystemDSLTransformer.ts
new file mode 100644
index 000000000000..31845c39de05
--- /dev/null
+++ b/app/client/src/layoutSystems/common/utils/LayoutSystemDSLTransformer.ts
@@ -0,0 +1,24 @@
+import { LayoutSystemTypes } from "layoutSystems/types";
+import { autoLayoutDSLTransformer } from "layoutSystems/autolayout/utils/AutoLayoutDSLTransformer";
+import { anvilDSLTransformer } from "layoutSystems/anvil/utils/AnvilDSLTransformer";
+import type { DSLWidget } from "WidgetProvider/constants";
+
+/**
+ * This function is the API provided by the layout systems module to the rest of the app for transforming DSLs
+ * @param layoutSystemType The type of the Layout system (Fixed, Auto, Anvil)
+ * @param mainCanvasWidth The width of the main canvas in pixels (necessary for Auto Layout transformations, particularly for conversion between Fixed and Auto Layout)
+ * @returns dslTransformer A function that takes in a DSL and returns a transformed DSL
+ */
+export function getLayoutSystemDSLTransformer(
+ layoutSystemType: LayoutSystemTypes,
+ mainCanvasWidth: number,
+) {
+ switch (layoutSystemType) {
+ case LayoutSystemTypes.FIXED:
+ return (dsl: DSLWidget) => dsl;
+ case LayoutSystemTypes.AUTO:
+ return autoLayoutDSLTransformer(mainCanvasWidth);
+ case LayoutSystemTypes.ANVIL:
+ return anvilDSLTransformer;
+ }
+}
diff --git a/app/client/src/layoutSystems/types/index.ts b/app/client/src/layoutSystems/types/index.ts
index c33285754b2a..d818e8f0d098 100644
--- a/app/client/src/layoutSystems/types/index.ts
+++ b/app/client/src/layoutSystems/types/index.ts
@@ -7,7 +7,7 @@ export enum LayoutSystemTypes {
ANVIL = "ANVIL",
}
-// interface for appPositioning(aka layoutStystem) details.
+// interface for LayoutSystem details.
// It is part of applicationDetails Record of an Application
// Refer to ApplicationPayload
export interface LayoutSystemTypeConfig {
diff --git a/app/client/src/layoutSystems/withLayoutSystemWidgetHOC.tsx b/app/client/src/layoutSystems/withLayoutSystemWidgetHOC.tsx
index 5d569541f719..37ad716a7bdf 100644
--- a/app/client/src/layoutSystems/withLayoutSystemWidgetHOC.tsx
+++ b/app/client/src/layoutSystems/withLayoutSystemWidgetHOC.tsx
@@ -12,7 +12,7 @@ import { LayoutSystemTypes } from "./types";
/**
*
* @param renderMode - render mode specifies whether the application is in edit/deploy mode.
- * @param appPositioningType - layout system of the application.
+ * @param layoutSystemType - layout system of the application.
* @returns
* @property — widgetSystem - widget specific wrappers and enhancers of a layout system
* @property — canvasSystem - canvas specific implementation and enhancers of a layout system
diff --git a/app/client/src/mocks/widgetProps/input.ts b/app/client/src/mocks/widgetProps/input.ts
index 6c62523fbd62..bf2900a6f96b 100644
--- a/app/client/src/mocks/widgetProps/input.ts
+++ b/app/client/src/mocks/widgetProps/input.ts
@@ -14,3 +14,18 @@ export const inputProps: BaseWidgetProps = {
topRow: 0,
bottomRow: 7,
};
+
+export const mainContainerProps: BaseWidgetProps = {
+ type: "CANVAS_WIDGET",
+ widgetId: "0",
+ widgetName: "MainContainer",
+ renderMode: "CANVAS",
+ version: 1,
+ isLoading: false,
+ parentColumnSpace: 10,
+ parentRowSpace: 10,
+ leftColumn: 0,
+ rightColumn: 10,
+ topRow: 0,
+ bottomRow: 7,
+};
diff --git a/app/client/src/pages/Editor/CanvasPropertyPane/index.tsx b/app/client/src/pages/Editor/CanvasPropertyPane/index.tsx
index 355bc76fe0fd..bb8baf59446a 100644
--- a/app/client/src/pages/Editor/CanvasPropertyPane/index.tsx
+++ b/app/client/src/pages/Editor/CanvasPropertyPane/index.tsx
@@ -14,6 +14,8 @@ import {
useLayoutSystemFeatures,
} from "../../../layoutSystems/common/useLayoutSystemFeatures";
import { MainContainerWidthToggles } from "../MainContainerWidthToggles";
+import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
+import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
const Title = styled.p`
color: var(--ads-v2-color-fg);
@@ -23,6 +25,7 @@ const MainHeading = styled.h3`
`;
export function CanvasPropertyPane() {
const dispatch = useDispatch();
+ const isAnvilEnabled = useFeatureFlag(FEATURE_FLAG.release_anvil_enabled);
const openAppSettingsPane = () => {
AnalyticsUtil.logEvent("APP_SETTINGS_BUTTON_CLICK");
@@ -48,7 +51,7 @@ export function CanvasPropertyPane() {
<MainContainerWidthToggles />
</>
)}
- <ConversionButton />
+ {!isAnvilEnabled && <ConversionButton />}
<Tooltip
content={
<>
diff --git a/app/client/src/sagas/AutoLayoutUpdateSagas.tsx b/app/client/src/sagas/AutoLayoutUpdateSagas.tsx
index d04fe8c7b404..fd65a0e176ae 100644
--- a/app/client/src/sagas/AutoLayoutUpdateSagas.tsx
+++ b/app/client/src/sagas/AutoLayoutUpdateSagas.tsx
@@ -40,8 +40,8 @@ import {
} from "selectors/editorSelectors";
import type { MainCanvasReduxState } from "reducers/uiReducers/mainCanvasReducer";
import { updateLayoutForMobileBreakpointAction } from "actions/autoLayoutActions";
-import convertDSLtoAuto from "utils/DSLConversions/fixedToAutoLayout";
-import { convertNormalizedDSLToFixed } from "utils/DSLConversions/autoToFixedLayout";
+import convertDSLtoAuto from "layoutSystems/common/DSLConversions/fixedToAutoLayout";
+import { convertNormalizedDSLToFixed } from "layoutSystems/common/DSLConversions/autoToFixedLayout";
import { updateWidgetPositions } from "layoutSystems/autolayout/utils/positionUtils";
import { getCanvasWidth as getMainCanvasWidth } from "selectors/editorSelectors";
import {
diff --git a/app/client/src/sagas/PageSagas.tsx b/app/client/src/sagas/PageSagas.tsx
index 07f077f44bf4..5c95194a52d9 100644
--- a/app/client/src/sagas/PageSagas.tsx
+++ b/app/client/src/sagas/PageSagas.tsx
@@ -87,7 +87,6 @@ import {
getCurrentLayoutId,
getCurrentPageId,
getCurrentPageName,
- getIsAutoLayout,
getMainCanvasProps,
getPageById,
previewModeSelector,
@@ -150,6 +149,10 @@ import { selectFeatureFlags } from "@appsmith/selectors/featureFlagsSelectors";
import type { FeatureFlags } from "@appsmith/entities/FeatureFlag";
import { isGACEnabled } from "@appsmith/utils/planHelpers";
import { getHasManagePagePermission } from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
+import { getLayoutSystemType } from "selectors/layoutSystemSelectors";
+import { LayoutSystemTypes } from "layoutSystems/types";
+import { getLayoutSystemDSLTransformer } from "layoutSystems/common/utils/LayoutSystemDSLTransformer";
+import type { DSLWidget } from "WidgetProvider/constants";
const WidgetTypes = WidgetFactory.widgetTypes;
@@ -261,14 +264,12 @@ export function* refreshTheApp() {
export const getCanvasWidgetsPayload = (
pageResponse: FetchPageResponse,
- isAutoLayout?: boolean,
- mainCanvasWidth?: number,
+ dslTransformer?: (dsl: DSLWidget) => DSLWidget,
): UpdateCanvasPayload => {
- const extractedDSL = extractCurrentDSL(
- pageResponse,
- isAutoLayout,
- mainCanvasWidth,
- ).dsl;
+ const extractedDSL = extractCurrentDSL({
+ dslTransformer,
+ response: pageResponse,
+ }).dsl;
const flattenedDSL = flattenDSL(extractedDSL);
const pageWidgetId = MAIN_CONTAINER_WIDGET_ID;
return {
@@ -294,9 +295,13 @@ export function* handleFetchedPage({
pageId: string;
isFirstLoad?: boolean;
}) {
- const isAutoLayout: boolean = yield select(getIsAutoLayout);
+ const layoutSystemType: LayoutSystemTypes = yield select(getLayoutSystemType);
const mainCanvasProps: MainCanvasReduxState =
yield select(getMainCanvasProps);
+ const dslTransformer = getLayoutSystemDSLTransformer(
+ layoutSystemType,
+ mainCanvasProps.width,
+ );
const isValidResponse: boolean = yield validateResponse(fetchPageResponse);
const willPageBeMigrated = checkIfMigrationIsNeeded(fetchPageResponse);
const lastUpdatedTime = getLastUpdateTime(fetchPageResponse);
@@ -313,8 +318,7 @@ export function* handleFetchedPage({
// Get Canvas payload
const canvasWidgetsPayload = getCanvasWidgetsPayload(
fetchPageResponse,
- isAutoLayout,
- mainCanvasProps.width,
+ dslTransformer,
);
// Update the canvas
yield put(initCanvasLayout(canvasWidgetsPayload));
@@ -344,7 +348,10 @@ export function* handleFetchedPage({
// to compute dynamic height based on the new layout.
yield put(generateAutoHeightLayoutTreeAction(true, true));
- if (willPageBeMigrated) {
+ // If the type of the layoutSystem is ANVIL, then we need to save the layout
+ // This is because we have updated the DSL
+ // using the AnvilDSLTransformer when we called the getCanvasWidgetsPayload function
+ if (willPageBeMigrated || layoutSystemType === LayoutSystemTypes.ANVIL) {
yield put(saveLayout());
}
}
@@ -706,14 +713,23 @@ export function* createNewPageFromEntity(
createPageAction: ReduxAction<CreatePageActionPayload>,
) {
try {
- const isAutoLayout: boolean = yield select(getIsAutoLayout);
+ const layoutSystemType: LayoutSystemTypes =
+ yield select(getLayoutSystemType);
const mainCanvasProps: MainCanvasReduxState =
yield select(getMainCanvasProps);
- // Default layout is extracted by adding dynamically computed properties like min-height.
+ const dslTransformer = getLayoutSystemDSLTransformer(
+ layoutSystemType,
+ mainCanvasProps.width,
+ );
+
+ // This saga is called when creating a new page from the entity explorer
+ // In this flow, the server doesn't have a page DSL to return
+ // So, the client premptively uses the default page DSL
+ // The default page DSL is used and modified using the layout system
+ // specific dslTransformer
const defaultPageLayouts = [
{
- dsl: extractCurrentDSL(undefined, isAutoLayout, mainCanvasProps?.width)
- .dsl,
+ dsl: extractCurrentDSL({ dslTransformer }).dsl,
layoutOnLoadActions: [],
},
];
@@ -724,6 +740,10 @@ export function* createNewPageFromEntity(
const workspaceId: string = yield select(getCurrentWorkspaceId);
const instanceId: string | undefined = yield select(getInstanceId);
+ // So far this saga has only done the prep work to create a page
+ // It generates and structures the parameters needed for creating a page
+ // At the end we call the `createPage` saga that actually calls the API to
+ // create a page
yield put(
createPage(
applicationId,
@@ -748,9 +768,14 @@ export function* createPageSaga(
) {
try {
const guidedTourEnabled: boolean = yield select(inGuidedTour);
- const isAutoLayout: boolean = yield select(getIsAutoLayout);
+ const layoutSystemType: LayoutSystemTypes =
+ yield select(getLayoutSystemType);
const mainCanvasProps: MainCanvasReduxState =
yield select(getMainCanvasProps);
+ const dslTransformer = getLayoutSystemDSLTransformer(
+ layoutSystemType,
+ mainCanvasProps.width,
+ );
// Prevent user from creating a new page during the guided tour
if (guidedTourEnabled) {
@@ -773,12 +798,13 @@ export function* createPageSaga(
},
});
// Add this to the page DSLs for entity explorer
+ // The dslTransformer may not be necessary for the entity explorer
+ // However, we still transform for consistency.
yield put({
type: ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS,
payload: {
pageId: response.data.id,
- dsl: extractCurrentDSL(response, isAutoLayout, mainCanvasProps?.width)
- .dsl,
+ dsl: extractCurrentDSL({ dslTransformer, response }).dsl,
layoutId: response.data.layouts[0].id,
},
});
@@ -888,7 +914,10 @@ export function* clonePageSaga(
),
);
// Add this to the page DSLs for entity explorer
- const { dsl, layoutId } = extractCurrentDSL(response);
+ // We're not sending the `dslTransformer` to the `extractCurrentDSL` function
+ // as this is a clone operation, and any layout system specific
+ // updates to the DSL would have already been performed in the original page
+ const { dsl, layoutId } = extractCurrentDSL({ response });
yield put({
type: ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS,
payload: {
@@ -1129,9 +1158,14 @@ export function* setDataUrl() {
export function* fetchPageDSLSaga(pageId: string) {
try {
- const isAutoLayout: boolean = yield select(getIsAutoLayout);
+ const layoutSystemType: LayoutSystemTypes =
+ yield select(getLayoutSystemType);
const mainCanvasProps: MainCanvasReduxState =
yield select(getMainCanvasProps);
+ const dslTransformer = getLayoutSystemDSLTransformer(
+ layoutSystemType,
+ mainCanvasProps.width,
+ );
const fetchPageResponse: FetchPageResponse = yield call(PageApi.fetchPage, {
id: pageId,
});
@@ -1139,11 +1173,17 @@ export function* fetchPageDSLSaga(pageId: string) {
if (isValidResponse) {
// Wait for the Widget config to be loaded before we can migrate the DSL
yield call(waitForWidgetConfigBuild);
- const { dsl, layoutId } = extractCurrentDSL(
- fetchPageResponse,
- isAutoLayout,
- mainCanvasProps?.width,
- );
+ // DSL migrations will now happen on the server
+ // So, it may not be necessary to run dslTransformer on the pageDSL
+ // or to run the DSL by the extractCurrentDSL function
+ // Another caveat to note is that we have conversions happening
+ // between Auto Layout and Fixed layout systems, this means that
+ // particularly for these two layout systems the dslTransformer may be necessary
+ // unless we're no longer running any conversions
+ const { dsl, layoutId } = extractCurrentDSL({
+ dslTransformer,
+ response: fetchPageResponse,
+ });
return {
pageId,
dsl,
diff --git a/app/client/src/sagas/layoutConversionSagas.ts b/app/client/src/sagas/layoutConversionSagas.ts
index a987892098aa..7b453ba279f2 100644
--- a/app/client/src/sagas/layoutConversionSagas.ts
+++ b/app/client/src/sagas/layoutConversionSagas.ts
@@ -9,8 +9,8 @@ import { CONVERSION_STATES } from "reducers/uiReducers/layoutConversionReducer";
import type { PageWidgetsReduxState } from "reducers/uiReducers/pageWidgetsReducer";
import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { getPageWidgets } from "@appsmith/selectors/entitiesSelector";
-import { convertNormalizedDSLToFixed } from "utils/DSLConversions/autoToFixedLayout";
-import convertToAutoLayout from "utils/DSLConversions/fixedToAutoLayout";
+import { convertNormalizedDSLToFixed } from "layoutSystems/common/DSLConversions/autoToFixedLayout";
+import convertToAutoLayout from "layoutSystems/common/DSLConversions/fixedToAutoLayout";
import type { DSLWidget } from "WidgetProvider/constants";
import {
createSnapshotSaga,
diff --git a/app/client/src/selectors/layoutSystemSelectors.ts b/app/client/src/selectors/layoutSystemSelectors.ts
index 963a93f6124f..52494a009434 100644
--- a/app/client/src/selectors/layoutSystemSelectors.ts
+++ b/app/client/src/selectors/layoutSystemSelectors.ts
@@ -5,6 +5,10 @@ import { LayoutSystemTypes } from "layoutSystems/types";
* selector to fetch the application's layout type
*/
export const getLayoutSystemType = (state: AppState) => {
+ const featureFlag = state.ui.users.featureFlag.data;
+ if (featureFlag && featureFlag.release_anvil_enabled === true) {
+ return LayoutSystemTypes.ANVIL;
+ }
if (
state.ui.applications?.currentApplication?.applicationDetail?.appPositioning
?.type
diff --git a/app/client/src/utils/WidgetPropsUtils.test.tsx b/app/client/src/utils/WidgetPropsUtils.test.tsx
index b50529f811c3..6f6e32f2b383 100644
--- a/app/client/src/utils/WidgetPropsUtils.test.tsx
+++ b/app/client/src/utils/WidgetPropsUtils.test.tsx
@@ -915,9 +915,13 @@ describe("Initial value migration test", () => {
},
};
};
- const migratedDslV2: any = extractCurrentDSL(tabsWidgetDSL()).dsl;
+ const migratedDslV2: any = extractCurrentDSL({
+ response: tabsWidgetDSL(),
+ }).dsl;
expect(migratedDslV2.children[0].children[0].leftColumn).toBeNaN();
- const migratedDslV3: any = extractCurrentDSL(tabsWidgetDSL(2)).dsl;
+ const migratedDslV3: any = extractCurrentDSL({
+ response: tabsWidgetDSL(2),
+ }).dsl;
expect(migratedDslV3.children[0].version).toBe(3);
expect(migratedDslV3.children[0].children[0].leftColumn).not.toBeNaN();
expect(migratedDslV3.children[0].children[0].leftColumn).toBe(0);
diff --git a/app/client/src/utils/WidgetPropsUtils.tsx b/app/client/src/utils/WidgetPropsUtils.tsx
index 93e9dab03c8a..65a8f0fcbe49 100644
--- a/app/client/src/utils/WidgetPropsUtils.tsx
+++ b/app/client/src/utils/WidgetPropsUtils.tsx
@@ -19,8 +19,7 @@ import type { ContainerWidgetProps } from "widgets/ContainerWidget/widget";
import type { BlockSpace, GridProps } from "reflow/reflowTypes";
import type { Rect } from "./boxHelpers";
import { areIntersecting } from "./boxHelpers";
-import convertDSLtoAutoAndUpdatePositions from "./DSLConversions/fixedToAutoLayout";
-import { checkIsDSLAutoLayout } from "../layoutSystems/autolayout/utils/AutoLayoutUtils";
+
import type {
WidgetDraggingBlock,
XYCord,
@@ -34,36 +33,43 @@ export interface WidgetOperationParams {
const defaultDSL = defaultTemplate;
-export const extractCurrentDSL = (
- fetchPageResponse?: FetchPageResponse,
- isAutoLayout?: boolean,
- mainCanvasWidth?: number,
-): { dsl: DSLWidget; layoutId: string | undefined } => {
- const newPage = !fetchPageResponse;
- const currentDSL = fetchPageResponse?.data.layouts[0].dsl || {
+/**
+ * This function is responsible for the following operations:
+ * 1. Using the default DSL if the response doesn't give us a DSL
+ * 2. Running all the DSL migrations on the DSL (transformDSL)
+ * 3. Transforming the DSL for the specifications of the layout system (only if a DSLTransformer is passed as an argument)
+ * @param dslTransformer A function that takes a DSL and returns a DSL transformed for the specifications of the layout system
+ * @param fetchPageResponse The response from the fetchPage API Call
+ * @returns The updated DSL and the layoutId
+ */
+export const extractCurrentDSL = (params: {
+ dslTransformer?: (dsl: DSLWidget) => DSLWidget;
+ response?: FetchPageResponse;
+}): { dsl: DSLWidget; layoutId: string | undefined } => {
+ // If fetch page response doesn't exist
+ // It means we are creating a new page
+ const newPage = !params.response;
+ // Get the DSL from the response or default to the defaultDSL
+ const currentDSL = params.response?.data.layouts[0].dsl || {
...defaultDSL,
};
+ // Run all the migrations on this DSL
const transformedDSL = transformDSL(
currentDSL as ContainerWidgetProps<WidgetProps>,
newPage,
);
- if (!isAutoLayout || checkIsDSLAutoLayout(transformedDSL)) {
- return {
- dsl: transformedDSL,
- layoutId: fetchPageResponse?.data.layouts[0].id,
- };
+ let dsl = transformedDSL;
+ // If this DSL is meant to be transformed
+ // then the dslTransformer would have been passed by the caller
+ if (params.dslTransformer) {
+ dsl = params.dslTransformer(transformedDSL);
}
- const convertedDSL = convertDSLtoAutoAndUpdatePositions(
- transformedDSL,
- mainCanvasWidth,
- );
-
return {
- dsl: convertedDSL,
- layoutId: fetchPageResponse?.data.layouts[0].id,
+ dsl,
+ layoutId: params.response?.data.layouts[0].id,
};
};
diff --git a/app/client/test/testCommon.ts b/app/client/test/testCommon.ts
index 6e374d0ccb6d..512ab20be422 100644
--- a/app/client/test/testCommon.ts
+++ b/app/client/test/testCommon.ts
@@ -51,7 +51,7 @@ export const useMockDsl = (dsl: any, mode?: APP_MODE) => {
payload: [
{
pageId: mockResp.data.id,
- dsl: extractCurrentDSL(mockResp).dsl,
+ dsl: extractCurrentDSL({ response: mockResp }).dsl,
},
],
});
|
c83f7fb3c1a3472d92e1bbbe487072e1bb3745c6
|
2022-01-26 21:26:22
|
Anagh Hegde
|
feat: Git import api (#10282)
| false
|
Git import api (#10282)
|
feat
|
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Datasource.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Datasource.java
index 72f404a52cca..f89f38ed3018 100644
--- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Datasource.java
+++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Datasource.java
@@ -59,6 +59,14 @@ public class Datasource extends BaseDomain {
@JsonIgnore
DatasourceStructure structure;
+
+ /*
+ * This field is introduced as part of git sync feature, for the git import we will need to identify the datasource's
+ * which are not configured. This way user can configure those datasource, which may have been introduced as part of git import.
+ */
+ @Transient
+ Boolean isConfigured;
+
/**
* This method is here so that the JSON version of this class' instances have a `isValid` field, for backwards
* compatibility. It may be removed, when sure that no API received is relying on this field.
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/AnalyticsEvents.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/AnalyticsEvents.java
index d1f62a6af63d..f14ddead6bf0 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/AnalyticsEvents.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/AnalyticsEvents.java
@@ -27,7 +27,8 @@ public enum AnalyticsEvents {
GIT_PRUNE,
GIT_DISCONNECT,
GIT_CHECKOUT_BRANCH,
- GIT_CHECKOUT_REMOTE_BRANCH
+ GIT_CHECKOUT_REMOTE_BRANCH,
+ GIT_IMPORT
;
private final String eventName;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java
index ee90c5290413..6073c1fe14cc 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java
@@ -12,6 +12,7 @@
import com.appsmith.server.domains.GitProfile;
import com.appsmith.server.dtos.GitCommitDTO;
import com.appsmith.server.dtos.GitConnectDTO;
+import com.appsmith.server.dtos.GitImportDTO;
import com.appsmith.server.dtos.GitMergeDTO;
import com.appsmith.server.dtos.GitPullDTO;
import com.appsmith.server.dtos.ResponseDTO;
@@ -189,7 +190,15 @@ public Mono<ResponseDTO<String>> createConflictedBranch(@PathVariable String def
@GetMapping("/import/keys")
public Mono<ResponseDTO<GitAuth>> generateKeyForGitImport() {
- return service.generateSSHKey().map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null));
+ return service.generateSSHKey()
+ .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null));
+ }
+
+ @PostMapping("/import/{organizationId}")
+ public Mono<ResponseDTO<GitImportDTO>> importApplicationFromGit(@PathVariable String organizationId,
+ @RequestBody GitConnectDTO gitConnectDTO) {
+ return service.importApplicationFromGit(organizationId, gitConnectDTO)
+ .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null));
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/GitDeployKeys.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/GitDeployKeys.java
index 72fd75786d1f..6e91fcc1d51c 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/GitDeployKeys.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/GitDeployKeys.java
@@ -1,5 +1,6 @@
package com.appsmith.server.domains;
+import com.appsmith.external.models.AppsmithDomain;
import com.appsmith.external.models.BaseDomain;
import lombok.Data;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/GitImportDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/GitImportDTO.java
new file mode 100644
index 000000000000..8efce8b68029
--- /dev/null
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/GitImportDTO.java
@@ -0,0 +1,18 @@
+package com.appsmith.server.dtos;
+
+import com.appsmith.external.models.Datasource;
+import com.appsmith.server.domains.Application;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+@Getter
+@Setter
+public class GitImportDTO {
+ Application application;
+
+ List<Datasource> unConfiguredDatasourceList;
+
+ Boolean isPartialImport;
+}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/DefaultResourcesUtils.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/DefaultResourcesUtils.java
index 236738a4a43f..23ec2c0af9da 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/DefaultResourcesUtils.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/DefaultResourcesUtils.java
@@ -6,45 +6,91 @@
import com.appsmith.server.domains.NewPage;
import com.appsmith.server.dtos.ActionCollectionDTO;
import com.appsmith.server.dtos.ActionDTO;
+import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
public class DefaultResourcesUtils {
- public static <T> T createPristineDefaultIdsAndUpdateWithGivenResourceIds(T resource, String branchName) {
- DefaultResources defaultResources = new DefaultResources();
+ public static <T> T createDefaultIdsOrUpdateWithGivenResourceIds(T resource, String branchName) {
- defaultResources.setBranchName(branchName);
if (resource instanceof NewAction) {
NewAction action = (NewAction) resource;
- defaultResources.setApplicationId(action.getApplicationId());
- defaultResources.setActionId(action.getId());
- action.setDefaultResources(defaultResources);
+ DefaultResources actionDefaultResources = action.getDefaultResources();
+
+ if (Optional.ofNullable(actionDefaultResources).isEmpty()) {
+ actionDefaultResources = new DefaultResources();
+ }
+ final String defaultApplicationId = StringUtils.isEmpty(actionDefaultResources.getApplicationId())
+ ? action.getApplicationId()
+ : actionDefaultResources.getApplicationId();
+
+ final String defaultActionId = StringUtils.isEmpty(actionDefaultResources.getActionId())
+ ? action.getId()
+ : actionDefaultResources.getActionId();
+ actionDefaultResources.setApplicationId(defaultApplicationId);
+ actionDefaultResources.setActionId(defaultActionId);
+ actionDefaultResources.setBranchName(branchName);
+
+ if (Optional.ofNullable(action.getUnpublishedAction()).isPresent()) {
+ createDefaultIdsOrUpdateWithGivenResourceIds(action.getUnpublishedAction(), branchName);
+ }
- createPristineDefaultIdsAndUpdateWithGivenResourceIds(action.getUnpublishedAction(), branchName);
if (Optional.ofNullable(action.getPublishedAction()).isPresent()) {
- createPristineDefaultIdsAndUpdateWithGivenResourceIds(action.getPublishedAction(), branchName);
+ createDefaultIdsOrUpdateWithGivenResourceIds(action.getPublishedAction(), branchName);
}
+ action.setDefaultResources(actionDefaultResources);
} else if (resource instanceof ActionDTO) {
ActionDTO action = (ActionDTO) resource;
- defaultResources.setPageId(action.getPageId());
- defaultResources.setCollectionId(action.getCollectionId());
- action.setDefaultResources(defaultResources);
+ DefaultResources actionDefaultResources = action.getDefaultResources();
+ if (Optional.ofNullable(actionDefaultResources).isEmpty()) {
+ actionDefaultResources = new DefaultResources();
+ }
+ final String defaultPageId = StringUtils.isEmpty(actionDefaultResources.getPageId())
+ ? action.getPageId()
+ : actionDefaultResources.getPageId();
+
+ final String defaultCollectionId = StringUtils.isEmpty(actionDefaultResources.getCollectionId())
+ ? action.getCollectionId()
+ : actionDefaultResources.getCollectionId();
+
+ actionDefaultResources.setPageId(defaultPageId);
+ actionDefaultResources.setCollectionId(defaultCollectionId);
+ action.setDefaultResources(actionDefaultResources);
} else if (resource instanceof NewPage) {
NewPage page = (NewPage) resource;
- defaultResources.setApplicationId(page.getApplicationId());
- defaultResources.setPageId(page.getId());
- page.setDefaultResources(defaultResources);
+ DefaultResources pageDefaultResources = page.getDefaultResources();
+ boolean updateOnLoadActionTemp = false;
+ if (Optional.ofNullable(pageDefaultResources).isEmpty()) {
+ pageDefaultResources = new DefaultResources();
+ updateOnLoadActionTemp = true;
+ }
+
+ final String defaultApplicationId = StringUtils.isEmpty(pageDefaultResources.getApplicationId())
+ ? page.getApplicationId()
+ : pageDefaultResources.getApplicationId();
- // Copy layoutOnLoadAction Ids to defaultActionId
+ final String defaultPageId = StringUtils.isEmpty(pageDefaultResources.getPageId())
+ ? page.getId()
+ : pageDefaultResources.getPageId();
+ pageDefaultResources.setApplicationId(defaultApplicationId);
+ pageDefaultResources.setPageId(defaultPageId);
+ pageDefaultResources.setBranchName(branchName);
+
+ // Copy layoutOnLoadAction Ids to defaultPageId
+ final boolean updateOnLoadAction = updateOnLoadActionTemp;
page.getUnpublishedPage()
.getLayouts()
.forEach(layout -> {
if (!CollectionUtils.isNullOrEmpty(layout.getLayoutOnLoadActions())) {
layout.getLayoutOnLoadActions()
.forEach(dslActionDTOS -> dslActionDTOS
- .forEach(actionDTO -> actionDTO.setDefaultActionId(actionDTO.getId()))
+ .forEach(actionDTO -> {
+ if (updateOnLoadAction || StringUtils.isEmpty(actionDTO.getDefaultActionId())) {
+ actionDTO.setDefaultActionId(actionDTO.getId());
+ }
+ })
);
}
});
@@ -56,34 +102,66 @@ public static <T> T createPristineDefaultIdsAndUpdateWithGivenResourceIds(T reso
if (!CollectionUtils.isNullOrEmpty(layout.getLayoutOnLoadActions())) {
layout.getLayoutOnLoadActions()
.forEach(dslActionDTOS -> dslActionDTOS
- .forEach(actionDTO -> actionDTO.setDefaultActionId(actionDTO.getId()))
+ .forEach(actionDTO -> {
+ if (updateOnLoadAction || StringUtils.isEmpty(actionDTO.getDefaultActionId())) {
+ actionDTO.setDefaultActionId(actionDTO.getId());
+ }
+ })
);
}
});
}
-
+ page.setDefaultResources(pageDefaultResources);
} else if (resource instanceof ActionCollection) {
ActionCollection actionCollection = (ActionCollection) resource;
- defaultResources.setApplicationId(actionCollection.getApplicationId());
- defaultResources.setCollectionId(actionCollection.getId());
- actionCollection.setDefaultResources(defaultResources);
- createPristineDefaultIdsAndUpdateWithGivenResourceIds(actionCollection.getUnpublishedCollection(), branchName);
+ DefaultResources actionCollectionDefaultResources = actionCollection.getDefaultResources();
+ if (Optional.ofNullable(actionCollectionDefaultResources).isEmpty()) {
+ actionCollectionDefaultResources = new DefaultResources();
+ }
+
+ final String defaultApplicationId = StringUtils.isEmpty(actionCollectionDefaultResources.getApplicationId())
+ ? actionCollection.getApplicationId()
+ : actionCollectionDefaultResources.getApplicationId();
+
+ final String defaultActionCollectionId = StringUtils.isEmpty(actionCollectionDefaultResources.getCollectionId())
+ ? actionCollection.getId()
+ : actionCollectionDefaultResources.getCollectionId();
+ actionCollectionDefaultResources.setApplicationId(defaultApplicationId);
+ actionCollectionDefaultResources.setCollectionId(defaultActionCollectionId);
+ actionCollectionDefaultResources.setBranchName(branchName);
+
+ if (Optional.ofNullable(actionCollection.getUnpublishedCollection()).isPresent()) {
+ createDefaultIdsOrUpdateWithGivenResourceIds(actionCollection.getUnpublishedCollection(), branchName);
+ }
if (Optional.ofNullable(actionCollection.getPublishedCollection()).isPresent()) {
- createPristineDefaultIdsAndUpdateWithGivenResourceIds(actionCollection.getPublishedCollection(), branchName);
+ createDefaultIdsOrUpdateWithGivenResourceIds(actionCollection.getPublishedCollection(), branchName);
}
+ actionCollection.setDefaultResources(actionCollectionDefaultResources);
} else if (resource instanceof ActionCollectionDTO) {
ActionCollectionDTO collectionDTO = (ActionCollectionDTO) resource;
- defaultResources.setPageId(collectionDTO.getPageId());
- collectionDTO.setDefaultResources(defaultResources);
-
- Map<String, String> updatedActionIds = new HashMap<>();
- if (!CollectionUtils.isNullOrEmpty(collectionDTO.getDefaultToBranchedActionIdsMap())) {
- collectionDTO.getDefaultToBranchedActionIdsMap()
- .values()
- .forEach(val -> updatedActionIds.put(val, val));
- collectionDTO.setDefaultToBranchedActionIdsMap(updatedActionIds);
+ boolean updateActionIds = false;
+ DefaultResources collectionDTODefaultResources = collectionDTO.getDefaultResources();
+ if (Optional.ofNullable(collectionDTODefaultResources).isEmpty()) {
+ collectionDTODefaultResources = new DefaultResources();
+ updateActionIds = true;
+ }
+ final String defaultPageId = StringUtils.isEmpty(collectionDTODefaultResources.getPageId())
+ ? collectionDTO.getPageId()
+ : collectionDTODefaultResources.getPageId();
+
+ collectionDTODefaultResources.setPageId(defaultPageId);
+
+ if (updateActionIds) {
+ Map<String, String> updatedActionIds = new HashMap<>();
+ if (!CollectionUtils.isNullOrEmpty(collectionDTO.getDefaultToBranchedActionIdsMap())) {
+ collectionDTO.getDefaultToBranchedActionIdsMap()
+ .values()
+ .forEach(val -> updatedActionIds.put(val, val));
+ collectionDTO.setDefaultToBranchedActionIdsMap(updatedActionIds);
+ }
}
+ collectionDTO.setDefaultResources(collectionDTODefaultResources);
}
return resource;
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitDeployKeyGenerator.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitDeployKeyGenerator.java
index e192b4d19d87..86aa26d3e3f5 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitDeployKeyGenerator.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitDeployKeyGenerator.java
@@ -1,7 +1,7 @@
package com.appsmith.server.helpers;
import com.appsmith.git.helpers.StringOutputStream;
-import com.appsmith.server.constants.GitConstants;
+import com.appsmith.server.constants.Assets;
import com.appsmith.server.domains.GitAuth;
import com.appsmith.server.exceptions.AppsmithError;
import com.appsmith.server.exceptions.AppsmithException;
@@ -36,7 +36,7 @@ public static GitAuth generateSSHKey() {
gitAuth.setPublicKey(publicKeyOutput.toString());
gitAuth.setPrivateKey(privateKeyOutput.toString());
gitAuth.setGeneratedAt(Instant.now());
- gitAuth.setDocUrl(GitConstants.DEPLOY_KEY_DOC_URL);
+ gitAuth.setDocUrl(Assets.GIT_DEPLOY_KEY_DOC_URL);
return gitAuth;
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java
index c7c151bbcdad..2632904354da 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java
@@ -32,6 +32,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -74,6 +75,9 @@ public Mono<Path> saveApplicationToLocalRepo(Path baseRepoSuffix,
3. Save application to git repo
*/
ApplicationGitReference applicationReference = new ApplicationGitReference();
+
+ Application application = applicationJson.getExportedApplication();
+ removeUnwantedFieldsFromApplication(application);
// Pass application reference
applicationReference.setApplication(applicationJson.getExportedApplication());
@@ -127,10 +131,8 @@ public Mono<Path> saveApplicationToLocalRepo(Path baseRepoSuffix,
resourceMap.clear();
// Send datasources
- applicationJson.getDatasourceList().forEach(
- datasource -> {
- datasource.setUpdatedAt(null);
- datasource.setCreatedAt(null);
+ applicationJson.getDatasourceList().forEach(datasource -> {
+ removeUnwantedFieldsFromDatasource(datasource);
resourceMap.put(datasource.getName(), datasource);
}
);
@@ -242,6 +244,18 @@ private void removeUnwantedFieldsFromPage(NewPage page) {
}
}
+ private void removeUnwantedFieldsFromApplication(Application application) {
+ // Don't commit application name as while importing we are using the repoName as application name
+ application.setName(null);
+ }
+
+ private void removeUnwantedFieldsFromDatasource(Datasource datasource) {
+ datasource.setPolicies(new HashSet<>());
+ datasource.setStructure(null);
+ datasource.setUpdatedAt(null);
+ datasource.setCreatedAt(null);
+ }
+
private void removeUnwantedFieldFromAction(NewAction action) {
action.setDefaultResources(null);
action.setCreatedAt(null);
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitUtils.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitUtils.java
index b1a7f8f42c14..c3c492bfd3a2 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitUtils.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitUtils.java
@@ -21,7 +21,7 @@ public class GitUtils {
* @param sshUrl ssh url of repo
* @return https url supported by curl command extracted from ssh repo url
*/
- public static String convertSshUrlToHttpsCurlSupportedUrl(String sshUrl) {
+ public static String convertSshUrlToBrowserSupportedUrl(String sshUrl) {
if (StringUtils.isEmptyOrNull(sshUrl)) {
throw new AppsmithException(AppsmithError.INVALID_PARAMETER, "ssh url");
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java
index 92421dd7c61c..866f0d100f3e 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java
@@ -33,10 +33,13 @@ public GitServiceImpl(UserService userService,
EmailConfig emailConfig,
AnalyticsService analyticsService,
GitCloudServicesUtils gitCloudServicesUtils,
- GitDeployKeysRepository gitDeployKeysRepository) {
+ GitDeployKeysRepository gitDeployKeysRepository,
+ DatasourceService datasourceService,
+ PluginService pluginService) {
super(userService, userDataService, sessionUserService, applicationService, applicationPageService,
newPageService, newActionService, actionCollectionService, fileUtils, importExportApplicationService,
- gitExecutor, responseUtils, emailConfig, analyticsService, gitCloudServicesUtils, gitDeployKeysRepository);
+ gitExecutor, responseUtils, emailConfig, analyticsService, gitCloudServicesUtils, gitDeployKeysRepository,
+ datasourceService, pluginService);
}
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCE.java
index eee228a3b663..9582cd8b940f 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCE.java
@@ -57,4 +57,5 @@ public interface ApplicationPageServiceCE {
Mono<Application> deleteApplicationByResource(Application application);
+ Mono<Application> createOrUpdateSuffixedApplication(Application application, String name, int suffix);
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
index 5ebb69aecc91..1fca972de823 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java
@@ -45,6 +45,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.bson.types.ObjectId;
+import org.springframework.dao.DuplicateKeyException;
import org.springframework.util.StringUtils;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -1012,5 +1013,36 @@ public Mono<ApplicationPagesDTO> reorderPage(String defaultAppId, String default
.map(responseUtils::updateApplicationPagesDTOWithDefaultResources);
}
+ /**
+ * This method will create a new suffixed application or update the existing application if there is name conflict
+ * @param application resource which needs to be created or updated
+ * @param name name which should be assigned to the application
+ * @param suffix extension to application name
+ * @return updated application with modified name if duplicate key exception is thrown
+ */
+ public Mono<Application> createOrUpdateSuffixedApplication(Application application, String name, int suffix) {
+ final String actualName = name + (suffix == 0 ? "" : " (" + suffix + ")");
+ application.setName(actualName);
+
+ Mono<User> userMono = sessionUserService.getCurrentUser().cache();
+ Mono<Application> applicationWithPoliciesMono = this.setApplicationPolicies(userMono, application.getOrganizationId(), application);
+
+ return applicationWithPoliciesMono
+ .zipWith(userMono)
+ .flatMap(tuple -> {
+ Application application1 = tuple.getT1();
+ application1.setModifiedBy(tuple.getT2().getUsername()); // setting modified by to current user
+ // We can't use create or createApplication method here as we are expecting update operation if the
+ // _id is available with application object
+ return applicationService.save(application);
+ })
+ .onErrorResume(DuplicateKeyException.class, error -> {
+ if (error.getMessage() != null) {
+ return this.createOrUpdateSuffixedApplication(application, name, 1 + suffix);
+ }
+ throw error;
+ });
+ }
+
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCEImpl.java
index 78e2fd9d92a8..6c846680bf07 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationServiceCEImpl.java
@@ -1,7 +1,6 @@
package com.appsmith.server.services.ce;
import com.appsmith.external.models.Policy;
-import com.appsmith.git.helpers.StringOutputStream;
import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.constants.ApplicationConstants;
import com.appsmith.server.constants.Assets;
@@ -29,9 +28,6 @@
import com.appsmith.server.services.BaseService;
import com.appsmith.server.services.ConfigService;
import com.appsmith.server.services.SessionUserService;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.KeyPair;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCEImpl.java
index 18df9e4b862c..b82c44a66365 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCEImpl.java
@@ -43,6 +43,7 @@
import java.time.Instant;
import java.util.HashSet;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -97,11 +98,11 @@ public Mono<Datasource> create(@NotNull Datasource datasource) {
if (datasource.getId() != null) {
return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.ID));
}
- if (StringUtils.isEmpty(datasource.getGitSyncId())) {
+ if (!StringUtils.hasLength(datasource.getGitSyncId())) {
datasource.setGitSyncId(datasource.getOrganizationId() + "_" + new ObjectId());
}
Mono<Datasource> datasourceMono = Mono.just(datasource);
- if (StringUtils.isEmpty(datasource.getName())) {
+ if (!StringUtils.hasLength(datasource.getName())) {
datasourceMono = sequenceService
.getNextAsSuffix(Datasource.class, " for organization with _id : " + orgId)
.zipWith(datasourceMono, (sequenceNumber, datasource1) -> {
@@ -366,7 +367,11 @@ public Flux<Datasource> get(MultiValueMap<String, String> params) {
// Remove branch name as datasources are not shared across branches
params.remove(FieldName.DEFAULT_RESOURCES + "." + FieldName.BRANCH_NAME);
if (params.getFirst(FieldName.ORGANIZATION_ID) != null) {
- return findAllByOrganizationId(params.getFirst(FieldName.ORGANIZATION_ID), AclPermission.READ_DATASOURCES);
+ return findAllByOrganizationId(params.getFirst(FieldName.ORGANIZATION_ID), AclPermission.READ_DATASOURCES)
+ .map(datasource -> {
+ datasource.setIsConfigured(Optional.ofNullable(datasource.getDatasourceConfiguration()).isEmpty());
+ return datasource;
+ });
}
return Flux.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.ORGANIZATION_ID));
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCE.java
index 8bd4ee41adc4..0a4a9ed0ec01 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCE.java
@@ -4,12 +4,14 @@
import com.appsmith.external.dtos.GitLogDTO;
import com.appsmith.external.dtos.GitStatusDTO;
import com.appsmith.external.dtos.MergeStatusDTO;
+import com.appsmith.external.models.Datasource;
import com.appsmith.server.domains.Application;
import com.appsmith.server.domains.GitApplicationMetadata;
import com.appsmith.server.domains.GitAuth;
import com.appsmith.server.domains.GitProfile;
import com.appsmith.server.dtos.GitCommitDTO;
import com.appsmith.server.dtos.GitConnectDTO;
+import com.appsmith.server.dtos.GitImportDTO;
import com.appsmith.server.dtos.GitMergeDTO;
import com.appsmith.server.dtos.GitPullDTO;
import reactor.core.publisher.Mono;
@@ -57,7 +59,7 @@ public interface GitServiceCE {
Mono<String> createConflictedBranch(String defaultApplicationId, String branchName);
- Mono<Application> importApplicationFromGit();
+ Mono<GitImportDTO> importApplicationFromGit(String organisationId, GitConnectDTO gitConnectDTO);
Mono<GitAuth> generateSSHKey();
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java
index dbe8f3269c08..df19bc7980c6 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java
@@ -5,6 +5,7 @@
import com.appsmith.external.dtos.GitStatusDTO;
import com.appsmith.external.dtos.MergeStatusDTO;
import com.appsmith.external.git.GitExecutor;
+import com.appsmith.external.models.Datasource;
import com.appsmith.git.service.GitExecutorImpl;
import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.configurations.EmailConfig;
@@ -19,9 +20,12 @@
import com.appsmith.server.domains.GitAuth;
import com.appsmith.server.domains.GitDeployKeys;
import com.appsmith.server.domains.GitProfile;
+import com.appsmith.server.domains.NewAction;
+import com.appsmith.server.domains.Plugin;
import com.appsmith.server.domains.UserData;
import com.appsmith.server.dtos.GitCommitDTO;
import com.appsmith.server.dtos.GitConnectDTO;
+import com.appsmith.server.dtos.GitImportDTO;
import com.appsmith.server.dtos.GitMergeDTO;
import com.appsmith.server.dtos.GitPullDTO;
import com.appsmith.server.exceptions.AppsmithError;
@@ -37,8 +41,10 @@
import com.appsmith.server.services.AnalyticsService;
import com.appsmith.server.services.ApplicationPageService;
import com.appsmith.server.services.ApplicationService;
+import com.appsmith.server.services.DatasourceService;
import com.appsmith.server.services.NewActionService;
import com.appsmith.server.services.NewPageService;
+import com.appsmith.server.services.PluginService;
import com.appsmith.server.services.SessionUserService;
import com.appsmith.server.services.UserDataService;
import com.appsmith.server.services.UserService;
@@ -64,15 +70,17 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import static com.appsmith.server.acl.AclPermission.MANAGE_ACTIONS;
import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS;
+import static com.appsmith.server.acl.AclPermission.MANAGE_DATASOURCES;
import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
import static com.appsmith.server.acl.AclPermission.READ_APPLICATIONS;
import static com.appsmith.server.constants.CommentConstants.APPSMITH_BOT_USERNAME;
import static com.appsmith.server.constants.FieldName.DEFAULT;
-import static com.appsmith.server.helpers.DefaultResourcesUtils.createPristineDefaultIdsAndUpdateWithGivenResourceIds;
+import static com.appsmith.server.helpers.DefaultResourcesUtils.createDefaultIdsOrUpdateWithGivenResourceIds;
import static org.apache.commons.lang.ObjectUtils.defaultIfNull;
/**
@@ -107,6 +115,8 @@ public class GitServiceCEImpl implements GitServiceCE {
private final AnalyticsService analyticsService;
private final GitCloudServicesUtils gitCloudServicesUtils;
private final GitDeployKeysRepository gitDeployKeysRepository;
+ private final DatasourceService datasourceService;
+ private final PluginService pluginService;
private final static String DEFAULT_COMMIT_MESSAGE = "System generated commit, ";
private final static String EMPTY_COMMIT_ERROR_MESSAGE = "On current branch nothing to commit, working tree clean";
@@ -383,7 +393,7 @@ public Mono<String> commitApplication(GitCommitDTO commitDTO, String defaultAppl
if (!Boolean.TRUE.equals(dbIsRepoPrivate)) {
if (StringUtils.isEmptyOrNull(defaultGitMetadata.getBrowserSupportedRemoteUrl())) {
defaultGitMetadata.setBrowserSupportedRemoteUrl(
- GitUtils.convertSshUrlToHttpsCurlSupportedUrl(defaultGitMetadata.getRemoteUrl())
+ GitUtils.convertSshUrlToBrowserSupportedUrl(defaultGitMetadata.getRemoteUrl())
);
}
Boolean isRepoPrivateCurrentStatus = true;
@@ -625,7 +635,7 @@ public Mono<Application> connectApplicationToGit(String defaultApplicationId, Gi
.flatMap(application -> {
// Check if the repo is public
try {
- if(!GitUtils.isRepoPrivate(GitUtils.convertSshUrlToHttpsCurlSupportedUrl(gitConnectDTO.getRemoteUrl()))) {
+ if(!GitUtils.isRepoPrivate(GitUtils.convertSshUrlToBrowserSupportedUrl(gitConnectDTO.getRemoteUrl()))) {
return Mono.just(application);
}
} catch (IOException e) {
@@ -637,7 +647,7 @@ public Mono<Application> connectApplicationToGit(String defaultApplicationId, Gi
// get git connected apps count from db
return applicationService.getGitConnectedApplicationCount(application.getOrganizationId())
.flatMap(count -> {
- if (limitCount <= count) {
+ if (limitCount < count) {
return addAnalyticsForGitOperation(
AnalyticsEvents.GIT_PRIVATE_REPO_LIMIT_EXCEEDED.getEventName(),
application,
@@ -718,7 +728,7 @@ public Mono<Application> connectApplicationToGit(String defaultApplicationId, Gi
gitApplicationMetadata.setRemoteUrl(gitConnectDTO.getRemoteUrl());
gitApplicationMetadata.setRepoName(repoName);
gitApplicationMetadata.setBrowserSupportedRemoteUrl(
- GitUtils.convertSshUrlToHttpsCurlSupportedUrl(gitConnectDTO.getRemoteUrl())
+ GitUtils.convertSshUrlToBrowserSupportedUrl(gitConnectDTO.getRemoteUrl())
);
try {
gitApplicationMetadata.setIsRepoPrivate(
@@ -1024,15 +1034,36 @@ public Mono<Application> detachRemote(String defaultApplicationId) {
// will be deleted
Flux.fromIterable(application.getPages())
.flatMap(page -> newPageService.findById(page.getId(), MANAGE_PAGES))
- .map(newPage -> createPristineDefaultIdsAndUpdateWithGivenResourceIds(newPage, null))
+ .map(newPage -> {
+ newPage.setDefaultResources(null);
+ return createDefaultIdsOrUpdateWithGivenResourceIds(newPage, null);
+ })
.collectList()
.flatMapMany(newPageService::saveAll)
.flatMap(newPage -> newActionService.findByPageId(newPage.getId(), MANAGE_ACTIONS)
- .map(newAction -> createPristineDefaultIdsAndUpdateWithGivenResourceIds(newAction, null))
+ .map(newAction -> {
+ newAction.setDefaultResources(null);
+ if (newAction.getUnpublishedAction() != null) {
+ newAction.getUnpublishedAction().setDefaultResources(null);
+ }
+ if (newAction.getPublishedAction() != null) {
+ newAction.getPublishedAction().setDefaultResources(null);
+ }
+ return createDefaultIdsOrUpdateWithGivenResourceIds(newAction, null);
+ })
.collectList()
.flatMapMany(newActionService::saveAll)
.thenMany(actionCollectionService.findByPageId(newPage.getId()))
- .map(actionCollection -> createPristineDefaultIdsAndUpdateWithGivenResourceIds(actionCollection, null))
+ .map(actionCollection -> {
+ actionCollection.setDefaultResources(null);
+ if (actionCollection.getUnpublishedCollection() != null) {
+ actionCollection.getUnpublishedCollection().setDefaultResources(null);
+ }
+ if (actionCollection.getPublishedCollection() != null) {
+ actionCollection.getPublishedCollection().setDefaultResources(null);
+ }
+ return createDefaultIdsOrUpdateWithGivenResourceIds(actionCollection, null);
+ })
.collectList()
.flatMapMany(actionCollectionService::saveAll)
)
@@ -1870,8 +1901,179 @@ public Mono<String> createConflictedBranch(String defaultApplicationId, String b
}
@Override
- public Mono<Application> importApplicationFromGit() {
- return null;
+ public Mono<GitImportDTO> importApplicationFromGit(String organizationId, GitConnectDTO gitConnectDTO) {
+ // 1. Check private repo limit for organization
+ // 2. Create dummy application, clone repo from remote
+ // 3. Re-hydrate application to DB from local repo
+ // 1. Save the ssh keys in application object with other details
+ // 2. During import-export need to handle the DS(empty vs non-empty)
+ // 4. Return application
+
+ if (StringUtils.isEmptyOrNull(gitConnectDTO.getRemoteUrl())) {
+ return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "Remote Url"));
+ }
+
+ if (StringUtils.isEmptyOrNull(organizationId)) {
+ return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "Invalid organization id"));
+ }
+
+ boolean isRepoPrivateTemp;
+ try {
+ isRepoPrivateTemp = GitUtils.isRepoPrivate(GitUtils.convertSshUrlToBrowserSupportedUrl(gitConnectDTO.getRemoteUrl()));
+ } catch (IOException e) {
+ log.error("Error while checking if the repo is private: ", e);
+ isRepoPrivateTemp = true;
+ }
+ final boolean isRepoPrivate = isRepoPrivateTemp;
+ final String repoName = GitUtils.getRepoName(gitConnectDTO.getRemoteUrl());
+ Mono<GitImportDTO> importedApplicationMono = getSSHKeyForCurrentUser()
+ .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.INVALID_GIT_CONFIGURATION,
+ "Unable to find git configuration for logged-in user. Please contact Appsmith team for support")))
+ //Check the limit for number of private repo
+ .flatMap(gitAuth -> {
+ // Check if the repo is public
+ Application newApplication = new Application();
+ newApplication.setName(repoName);
+ newApplication.setOrganizationId(organizationId);
+ newApplication.setGitApplicationMetadata(new GitApplicationMetadata());
+ Mono<Application> applicationMono = applicationPageService
+ .createOrUpdateSuffixedApplication(newApplication, newApplication.getName(), 0);
+ if(!isRepoPrivate) {
+ return Mono.just(gitAuth).zipWith(applicationMono);
+ }
+ return gitCloudServicesUtils.getPrivateRepoLimitForOrg(organizationId, true)
+ .flatMap(limitCount -> {
+ // get git connected apps count from db
+ return applicationService.getGitConnectedApplicationCount(organizationId)
+ .flatMap(count -> {
+ if (limitCount < count) {
+ return addAnalyticsForGitOperation(
+ AnalyticsEvents.GIT_IMPORT.getEventName(),
+ newApplication,
+ AppsmithError.GIT_APPLICATION_LIMIT_ERROR.getTitle(),
+ AppsmithError.GIT_APPLICATION_LIMIT_ERROR.getMessage(),
+ false
+ ).flatMap(user -> Mono.error(new AppsmithException(AppsmithError.GIT_APPLICATION_LIMIT_ERROR)));
+ }
+ return Mono.just(gitAuth).zipWith(applicationMono);
+ });
+ });
+ })
+ .flatMap(tuple -> {
+ GitAuth gitAuth = tuple.getT1();
+ Application application = tuple.getT2();
+ Path repoPath = Paths.get(application.getOrganizationId(), application.getId(), repoName);
+ Mono<Map<String, GitProfile>> profileMono = updateOrCreateGitProfileForCurrentUser(gitConnectDTO.getGitProfile(), application.getId());
+
+ Mono<String> defaultBranchMono = gitExecutor.cloneApplication(
+ repoPath,
+ gitConnectDTO.getRemoteUrl(),
+ gitAuth.getPrivateKey(),
+ gitAuth.getPublicKey()
+ ).onErrorResume(error -> {
+ log.error("Error while cloning the remote repo, {}", error.getMessage());
+ return addAnalyticsForGitOperation(
+ AnalyticsEvents.GIT_IMPORT.getEventName(),
+ application,
+ error.getClass().getName(),
+ error.getMessage(),
+ false)
+ .flatMap(user -> fileUtils.detachRemote(repoPath)
+ .then(applicationPageService.deleteApplication(application.getId())))
+ .flatMap(application1 -> {
+ if (error instanceof TransportException) {
+ return Mono.error(new AppsmithException(AppsmithError.INVALID_GIT_CONFIGURATION, error.getMessage()));
+ } else if (error instanceof InvalidRemoteException) {
+ return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "remote url"));
+ } else if (error instanceof TimeoutException) {
+ return Mono.error(new AppsmithException(AppsmithError.GIT_EXECUTION_TIMEOUT));
+ }
+ return Mono.error(new AppsmithException(AppsmithError.GIT_ACTION_FAILED, "clone", error));
+ });
+ });
+
+ return defaultBranchMono
+ .flatMap(defaultBranch -> {
+ GitApplicationMetadata gitApplicationMetadata = new GitApplicationMetadata();
+ gitApplicationMetadata.setGitAuth(gitAuth);
+ gitApplicationMetadata.setDefaultApplicationId(application.getId());
+ gitApplicationMetadata.setBranchName(defaultBranch);
+ gitApplicationMetadata.setDefaultBranchName(defaultBranch);
+ gitApplicationMetadata.setRemoteUrl(gitConnectDTO.getRemoteUrl());
+ gitApplicationMetadata.setRepoName(repoName);
+ gitApplicationMetadata.setBrowserSupportedRemoteUrl(
+ GitUtils.convertSshUrlToBrowserSupportedUrl(gitConnectDTO.getRemoteUrl())
+ );
+ gitApplicationMetadata.setIsRepoPrivate(isRepoPrivate);
+
+ application.setGitApplicationMetadata(gitApplicationMetadata);
+ return Mono.just(application).zipWith(profileMono);
+ });
+ })
+ .flatMap(objects -> {
+ Application application = objects.getT1();
+ GitApplicationMetadata gitApplicationMetadata = application.getGitApplicationMetadata();
+ String defaultBranch = gitApplicationMetadata.getDefaultBranchName();
+
+ try {
+ Mono<List<Datasource>> datasourceMono = datasourceService.findAllByOrganizationId(organizationId, MANAGE_DATASOURCES).collectList();
+ Mono<List<Plugin>> pluginMono = pluginService.getDefaultPlugins().collectList();
+ Mono<ApplicationJson> applicationJsonMono = fileUtils.reconstructApplicationFromGitRepo(organizationId, application.getId(), gitApplicationMetadata.getRepoName(), defaultBranch);
+
+ return Mono.zip(applicationJsonMono, datasourceMono, pluginMono)
+ .flatMap(data -> {
+ ApplicationJson applicationJson = data.getT1();
+ List<Datasource> datasourceList = data.getT2();
+ List<Plugin> pluginList = data.getT3();
+
+ // If there is an existing datasource with the same name but a different type from that in the repo, the import api should fail
+ if(checkIsDatasourceNameConflict(datasourceList, applicationJson.getDatasourceList(), pluginList)) {
+ return deleteApplicationCreatedFromGitImport(application.getId(), application.getOrganizationId(), gitApplicationMetadata.getRepoName())
+ .then(Mono.error(new AppsmithException(AppsmithError.GIT_ACTION_FAILED,
+ "import",
+ "Datasource already exists with the same name"))
+ );
+ }
+
+ applicationJson.getExportedApplication().setGitApplicationMetadata(gitApplicationMetadata);
+ applicationJson.getExportedApplication().setName(application.getName());
+ return importExportApplicationService
+ .importApplicationInOrganization(organizationId, applicationJson, application.getId(), defaultBranch)
+ .zipWith(datasourceMono)
+ .onErrorResume(throwable -> {
+ return deleteApplicationCreatedFromGitImport(application.getId(), application.getOrganizationId(), gitApplicationMetadata.getRepoName())
+ .flatMap(application1 -> Mono.error(new AppsmithException(AppsmithError.GIT_FILE_SYSTEM_ERROR, throwable.getMessage())));
+ });
+ });
+
+ } catch (GitAPIException | IOException e) {
+ log.error("Error while constructing application from git repo", e);
+ return deleteApplicationCreatedFromGitImport(application.getId(), application.getOrganizationId(), gitApplicationMetadata.getRepoName())
+ .flatMap(application1 -> Mono.error(new AppsmithException(AppsmithError.GIT_FILE_SYSTEM_ERROR)));
+ }
+ })
+ .flatMap(objects -> {
+ Application application = objects.getT1();
+ List<Datasource> datasourceMono = objects.getT2();
+ return Mono.zip(Mono.just(application), findNonConfiguredDatasourceByApplicationId(application.getId(), datasourceMono));
+ })
+ // Add analytics event
+ .flatMap(objects -> {
+ Application application = objects.getT1();
+ GitImportDTO gitImportDTO = new GitImportDTO();
+ gitImportDTO.setApplication(application);
+ gitImportDTO.setUnConfiguredDatasourceList(objects.getT2());
+ gitImportDTO.setIsPartialImport(objects.getT2().size() > 0);
+ return addAnalyticsForGitOperation(
+ AnalyticsEvents.GIT_IMPORT.getEventName(),
+ application,
+ application.getGitApplicationMetadata().getIsRepoPrivate()
+ ).thenReturn(gitImportDTO);
+ });
+
+ return Mono.create(sink -> importedApplicationMono
+ .subscribe(sink::success, sink::error, null, sink.currentContext())
+ );
}
@Override
@@ -1886,8 +2088,11 @@ public Mono<GitAuth> generateSSHKey() {
gitDeployKeys.setEmail(user.getEmail());
return gitDeployKeysRepository.findByEmail(user.getEmail())
.switchIfEmpty(gitDeployKeysRepository.save(gitDeployKeys))
- // Over write the existing keys
.flatMap(gitDeployKeys1 -> {
+ if (gitDeployKeys.equals(gitDeployKeys1)) {
+ return Mono.just(gitDeployKeys1);
+ }
+ // Over write the existing keys
gitDeployKeys1.setGitAuth(gitDeployKeys.getGitAuth());
return gitDeployKeysRepository.save(gitDeployKeys1);
});
@@ -1895,6 +2100,71 @@ public Mono<GitAuth> generateSSHKey() {
.thenReturn(gitAuth);
}
+ private Mono<List<Datasource>> findNonConfiguredDatasourceByApplicationId(String applicationId,
+ List<Datasource> datasourceList) {
+ return newActionService.findAllByApplicationIdAndViewMode(applicationId, false, AclPermission.READ_ACTIONS, null)
+ .collectList()
+ .flatMap(actionList -> {
+ List<String> usedDatasource = actionList.stream()
+ .map(newAction -> newAction.getUnpublishedAction().getDatasource().getId())
+ .collect(Collectors.toList());
+
+ datasourceList.removeIf(datasource -> !usedDatasource.contains(datasource.getId()));
+
+ return Mono.just(datasourceList);
+ })
+ .map(datasources -> {
+ for (Datasource datasource:datasources) {
+ datasource.setIsConfigured(Optional.ofNullable(datasource.getDatasourceConfiguration()).isEmpty());
+ }
+ return datasources;
+ });
+ }
+
+ private Mono<Application> deleteApplicationCreatedFromGitImport(String applicationId, String organizationId, String repoName) {
+ return fileUtils.detachRemote(Paths.get(organizationId, applicationId, repoName))
+ .then(applicationPageService.deleteApplication(applicationId));
+ }
+
+
+ private Mono<GitAuth> getSSHKeyForCurrentUser() {
+ return sessionUserService.getCurrentUser()
+ .flatMap(user -> gitDeployKeysRepository.findByEmail(user.getEmail()))
+ .map(GitDeployKeys::getGitAuth);
+ }
+
+ private boolean checkIsDatasourceNameConflict(List<Datasource> existingDatasources,
+ List<Datasource> importedDatasources,
+ List<Plugin> pluginList) {
+ // If we have an existing datasource with the same name but a different type from that in the repo, the import api should fail
+ for( Datasource datasource : importedDatasources) {
+ // Collect the datasource(existing in organization) which has same as of imported datasource
+ // As names are unique we will need filter first element to check if the plugin id is matched
+ Datasource filteredDatasource = existingDatasources
+ .stream()
+ .filter(datasource1 -> datasource1.getName().equals(datasource.getName()))
+ .findFirst()
+ .orElse(null);
+
+ // Check if both of the datasource's are of the same plugin type
+ if (filteredDatasource != null) {
+ long matchCount = pluginList.stream()
+ .filter(plugin -> {
+ final String pluginReference = plugin.getPluginName() == null ? plugin.getPackageName() : plugin.getPluginName();
+
+ return plugin.getId().equals(filteredDatasource.getPluginId())
+ && !datasource.getPluginId().equals(pluginReference);
+ })
+ .count();
+ if (matchCount > 0) {
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
private boolean isInvalidDefaultApplicationGitMetadata(GitApplicationMetadata gitApplicationMetadata) {
return Optional.ofNullable(gitApplicationMetadata).isEmpty()
|| Optional.ofNullable(gitApplicationMetadata.getGitAuth()).isEmpty()
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java
index 08d71bbc5615..0bf4753a5401 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java
@@ -1089,7 +1089,7 @@ public Mono<ActionDTO> createAction(ActionDTO action, AppsmithEventContext event
}
if (action.getDefaultResources() == null) {
- DefaultResourcesUtils.createPristineDefaultIdsAndUpdateWithGivenResourceIds(action, null);
+ DefaultResourcesUtils.createDefaultIdsOrUpdateWithGivenResourceIds(action, null);
}
NewAction newAction = new NewAction();
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutCollectionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutCollectionServiceCEImpl.java
index fcf0dcdacd7d..29ba0ce7893b 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutCollectionServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutCollectionServiceCEImpl.java
@@ -78,7 +78,7 @@ public Mono<ActionCollectionDTO> createCollection(ActionCollectionDTO collection
DefaultResources defaultResources = collection.getDefaultResources();
if (defaultResources == null) {
- DefaultResourcesUtils.createPristineDefaultIdsAndUpdateWithGivenResourceIds(collection, null);
+ DefaultResourcesUtils.createDefaultIdsOrUpdateWithGivenResourceIds(collection, null);
}
final String pageId = collection.getPageId();
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java
index 8ab708935601..dbedd637a37b 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java
@@ -56,6 +56,7 @@
import org.apache.commons.lang.StringUtils;
import org.bson.types.ObjectId;
import org.springframework.core.io.buffer.DataBufferUtils;
+import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.MediaType;
import org.springframework.http.codec.multipart.Part;
import reactor.core.publisher.Flux;
@@ -621,14 +622,15 @@ public Mono<Application> importApplicationInOrganization(String organizationId,
datasource.setOrganizationId(organizationId);
// Check if any decrypted fields are present for datasource
- if (importedDoc.getDecryptedFields().get(datasource.getName()) != null) {
+ if (importedDoc.getDecryptedFields()!= null
+ && importedDoc.getDecryptedFields().get(datasource.getName()) != null) {
DecryptedSensitiveFields decryptedFields =
importedDoc.getDecryptedFields().get(datasource.getName());
updateAuthenticationDTO(datasource, decryptedFields);
}
- return createUniqueDatasourceIfNotPresent(existingDatasourceFlux, datasource, organizationId);
+ return createUniqueDatasourceIfNotPresent(existingDatasourceFlux, datasource, organizationId, applicationId);
})
.map(datasource -> {
datasourceMap.put(datasource.getName(), datasource.getId());
@@ -666,7 +668,18 @@ public Mono<Application> importApplicationInOrganization(String organizationId,
// the changes from remote
// We are using the save instead of update as we are using @Encrypted
// for GitAuth
- return applicationService.save(existingApplication);
+ return applicationService.save(existingApplication)
+ .onErrorResume(DuplicateKeyException.class, error -> {
+ if (error.getMessage() != null) {
+ return applicationPageService
+ .createOrUpdateSuffixedApplication(
+ existingApplication,
+ existingApplication.getName(),
+ 0
+ );
+ }
+ throw error;
+ });
});
}
return applicationService
@@ -1129,80 +1142,36 @@ private Flux<NewPage> importAndSavePages(List<NewPage> pages,
}
private Mono<NewPage> saveNewPageAndUpdateDefaultResources(NewPage newPage, String branchName) {
+ NewPage update = new NewPage();
return newPageService.save(newPage)
.flatMap(page -> {
- if (page.getDefaultResources() == null) {
- NewPage update = new NewPage();
- update.setDefaultResources(DefaultResourcesUtils.createPristineDefaultIdsAndUpdateWithGivenResourceIds(page, branchName).getDefaultResources());
- return newPageService.update(page.getId(), update);
- }
- return Mono.just(page);
+ update.setDefaultResources(DefaultResourcesUtils.createDefaultIdsOrUpdateWithGivenResourceIds(page, branchName).getDefaultResources());
+ return newPageService.update(page.getId(), update);
});
}
private Mono<NewAction> saveNewActionAndUpdateDefaultResources(NewAction newAction, String branchName) {
return newActionService.save(newAction)
.flatMap(action -> {
- if (action.getDefaultResources() == null) {
- NewAction update = new NewAction();
- update.setDefaultResources(
- DefaultResourcesUtils
- .createPristineDefaultIdsAndUpdateWithGivenResourceIds(action, branchName).getDefaultResources());
- if (action.getUnpublishedAction() != null) {
- update.setUnpublishedAction(action.getUnpublishedAction());
- update.getUnpublishedAction()
- .setDefaultResources(
- DefaultResourcesUtils
- .createPristineDefaultIdsAndUpdateWithGivenResourceIds(action.getUnpublishedAction(), branchName)
- .getDefaultResources()
- );
- }
- if (action.getPublishedAction() != null) {
- update.setPublishedAction(action.getPublishedAction());
- update.getPublishedAction()
- .setDefaultResources(
- DefaultResourcesUtils
- .createPristineDefaultIdsAndUpdateWithGivenResourceIds(action.getPublishedAction(), branchName)
- .getDefaultResources()
- );
- }
- return newActionService.update(action.getId(), update);
- }
- return Mono.just(action);
+ NewAction update = new NewAction();
+ update.setDefaultResources(
+ DefaultResourcesUtils
+ .createDefaultIdsOrUpdateWithGivenResourceIds(action, branchName).getDefaultResources()
+ );
+ return newActionService.update(action.getId(), update);
});
}
private Mono<ActionCollection> saveNewCollectionAndUpdateDefaultResources(ActionCollection actionCollection, String branchName) {
return actionCollectionService.create(actionCollection)
.flatMap(actionCollection1 -> {
- if (actionCollection1.getDefaultResources() == null) {
- ActionCollection update = new ActionCollection();
- update.setDefaultResources(
- DefaultResourcesUtils
- .createPristineDefaultIdsAndUpdateWithGivenResourceIds(actionCollection1, branchName)
- .getDefaultResources()
- );
- if (actionCollection1.getUnpublishedCollection() != null) {
- update.setUnpublishedCollection(actionCollection1.getUnpublishedCollection());
- update.getUnpublishedCollection()
- .setDefaultResources(
- DefaultResourcesUtils
- .createPristineDefaultIdsAndUpdateWithGivenResourceIds(actionCollection1.getUnpublishedCollection(), branchName)
- .getDefaultResources()
- );
- }
- if (actionCollection1.getPublishedCollection() != null) {
- update.setPublishedCollection(actionCollection1.getPublishedCollection());
- update.getPublishedCollection()
- .setDefaultResources(
- DefaultResourcesUtils
- .createPristineDefaultIdsAndUpdateWithGivenResourceIds(actionCollection1.getPublishedCollection(), branchName)
- .getDefaultResources()
- );
- }
- return actionCollectionService.update(actionCollection1.getId(), update);
- }
- return Mono.just(actionCollection1);
+ ActionCollection update = new ActionCollection();
+ update.setDefaultResources(
+ DefaultResourcesUtils
+ .createDefaultIdsOrUpdateWithGivenResourceIds(actionCollection1, branchName)
+ .getDefaultResources()
+ );
+ return actionCollectionService.update(actionCollection1.getId(), update);
});
}
@@ -1348,7 +1317,8 @@ private Mono<NewPage> mapActionIdWithPageLayout(NewPage page, Map<String, String
*/
private Mono<Datasource> createUniqueDatasourceIfNotPresent(Flux<Datasource> existingDatasourceFlux,
Datasource datasource,
- String organizationId) {
+ String organizationId,
+ String applicationId) {
/*
1. If same datasource is present return
@@ -1372,7 +1342,8 @@ private Mono<Datasource> createUniqueDatasourceIfNotPresent(Flux<Datasource> exi
}
return ds;
})
- .filter(ds -> ds.softEquals(datasource))
+ // For git import exclude datasource configuration
+ .filter(ds -> applicationId != null ? ds.getName().equals(datasource.getName()) : ds.softEquals(datasource))
.next() // Get the first matching datasource, we don't need more than one here.
.switchIfEmpty(Mono.defer(() -> {
if (datasourceConfig != null && datasourceConfig.getAuthentication() != null) {
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/GitServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/GitServiceTest.java
index e1576b2e69b5..c2d21295a518 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/GitServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/GitServiceTest.java
@@ -4,6 +4,7 @@
import com.appsmith.external.dtos.GitStatusDTO;
import com.appsmith.external.dtos.MergeStatusDTO;
import com.appsmith.external.git.GitExecutor;
+import com.appsmith.external.helpers.BeanCopyUtils;
import com.appsmith.external.models.ActionConfiguration;
import com.appsmith.external.models.Datasource;
import com.appsmith.external.models.DatasourceConfiguration;
@@ -26,6 +27,7 @@
import com.appsmith.server.dtos.ActionDTO;
import com.appsmith.server.dtos.GitCommitDTO;
import com.appsmith.server.dtos.GitConnectDTO;
+import com.appsmith.server.dtos.GitImportDTO;
import com.appsmith.server.dtos.GitMergeDTO;
import com.appsmith.server.dtos.GitPullDTO;
import com.appsmith.server.dtos.PageDTO;
@@ -34,12 +36,10 @@
import com.appsmith.server.helpers.CollectionUtils;
import com.appsmith.server.helpers.GitCloudServicesUtils;
import com.appsmith.server.helpers.GitFileUtils;
-import com.appsmith.server.helpers.GitUtils;
import com.appsmith.server.helpers.MockPluginExecutor;
import com.appsmith.server.helpers.PluginExecutorHelper;
import com.appsmith.server.repositories.OrganizationRepository;
import com.appsmith.server.repositories.PluginRepository;
-import com.appsmith.server.solutions.ImportExportApplicationService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -56,7 +56,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -86,7 +85,6 @@
import java.util.List;
import java.util.Map;
-import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.READ_ACTIONS;
import static com.appsmith.server.acl.AclPermission.READ_APPLICATIONS;
import static com.appsmith.server.acl.AclPermission.READ_PAGES;
@@ -103,6 +101,9 @@ public class GitServiceTest {
@Autowired
GitService gitService;
+ @Autowired
+ OrganizationService organizationService;
+
@Autowired
OrganizationRepository organizationRepository;
@@ -131,7 +132,7 @@ public class GitServiceTest {
PluginRepository pluginRepository;
@Autowired
- ImportExportApplicationService importExportApplicationService;
+ DatasourceService datasourceService;
@MockBean
GitExecutor gitExecutor;
@@ -173,11 +174,6 @@ public void setup() throws IOException {
}
Organization testOrg = organizationRepository.findByName("Another Test Organization", AclPermission.READ_ORGANIZATIONS).block();
orgId = testOrg.getId();
- MockedStatic<GitUtils> gitUtilsMockedStatic = Mockito.mockStatic(GitUtils.class);
- gitUtilsMockedStatic.when(() -> GitUtils.isRepoPrivate(Mockito.anyString()))
- .thenReturn(Boolean.FALSE);
- gitUtilsMockedStatic.when(() -> GitUtils.convertSshUrlToHttpsCurlSupportedUrl(Mockito.anyString()))
- .thenReturn("https://test.com");
gitConnectedApplication = createApplicationConnectedToGit("gitConnectedApplication", DEFAULT_BRANCH);
@@ -289,7 +285,7 @@ public void connectApplicationToGit_EmptyRemoteUrl_ThrowInvalidParameterExceptio
@WithUserDetails(value = "api_user")
public void connectApplicationToGit_EmptyOriginHeader_ThrowInvalidParameterException() {
- GitConnectDTO gitConnectDTO = getConnectRequest("sshUrl", testUserProfile);
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testRepo.git", testUserProfile);
Mono<Application> applicationMono = gitService.connectApplicationToGit("testID", gitConnectDTO, null);
StepVerifier
@@ -309,7 +305,7 @@ public void connectApplicationToGit_InvalidGitApplicationMetadata_ThrowInvalidGi
testApplication.setOrganizationId(orgId);
Application application1 = applicationPageService.createApplication(testApplication).block();
- GitConnectDTO gitConnectDTO = getConnectRequest("test.url.git", testUserProfile);
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testRepo.git", testUserProfile);
Mono<Application> applicationMono = gitService.connectApplicationToGit(application1.getId(), gitConnectDTO, "baseUrl");
StepVerifier
@@ -338,7 +334,7 @@ public void connectApplicationToGit_EmptyPrivateKey_ThrowInvalidGitConfiguration
testApplication.setGitApplicationMetadata(gitApplicationMetadata);
Application application1 = applicationPageService.createApplication(testApplication).block();
- GitConnectDTO gitConnectDTO = getConnectRequest("test.url.git", testUserProfile);
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testRepo.git", testUserProfile);
Mono<Application> applicationMono = gitService.connectApplicationToGit(application1.getId(), gitConnectDTO, "baseUrl");
StepVerifier
@@ -362,7 +358,7 @@ public void connectApplicationToGit_EmptyPublicKey_ThrowInvalidGitConfigurationE
testApplication.setGitApplicationMetadata(gitApplicationMetadata);
Application application1 = applicationPageService.createApplication(testApplication).block();
- GitConnectDTO gitConnectDTO = getConnectRequest("test.url.git", testUserProfile);
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testRepo.git", testUserProfile);
Mono<Application> applicationMono = gitService.connectApplicationToGit(application1.getId(), gitConnectDTO, "baseUrl");
StepVerifier
@@ -1193,6 +1189,10 @@ public void pullChanges_upstreamChangesAvailable_pullSuccess() throws IOExceptio
mergeStatusDTO.setStatus("2 commits pulled");
mergeStatusDTO.setMergeAble(true);
+ ApplicationJson applicationJson = new ApplicationJson();
+ BeanCopyUtils.copyNewFieldValuesIntoOldObject(validAppJson, applicationJson);
+ applicationJson.getExportedApplication().setName("upstreamChangesAvailable_pullSuccess");
+
GitStatusDTO gitStatusDTO = new GitStatusDTO();
gitStatusDTO.setAheadCount(2);
gitStatusDTO.setBehindCount(0);
@@ -1221,7 +1221,7 @@ public void pullChanges_upstreamChangesAvailable_pullSuccess() throws IOExceptio
})
.verifyComplete();
}
-
+
@Test
@WithUserDetails(value = "api_user")
public void pullChanges_FileSystemAccessError_throwError() throws IOException, GitAPIException {
@@ -2083,5 +2083,262 @@ public void generateSSHKey_KeyExistsInCollection_Success() {
.verifyComplete();
}
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void importApplicationFromGit_InvalidRemoteUrl_ThrowError() {
+ GitConnectDTO gitConnectDTO = getConnectRequest(null, testUserProfile);
+ Mono<GitImportDTO> applicationMono = gitService.importApplicationFromGit("testID", gitConnectDTO);
+
+ StepVerifier
+ .create(applicationMono)
+ .expectErrorMatches(throwable -> throwable instanceof AppsmithException
+ && throwable.getMessage().contains(AppsmithError.INVALID_PARAMETER.getMessage("Remote Url")))
+ .verify();
+ }
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void importApplicationFromGit_emptyOrganizationId_ThrowError() {
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testRepo.git", testUserProfile);
+ Mono<GitImportDTO> applicationMono = gitService.importApplicationFromGit(null, gitConnectDTO);
+
+ StepVerifier
+ .create(applicationMono)
+ .expectErrorMatches(throwable -> throwable instanceof AppsmithException
+ && throwable.getMessage().contains(AppsmithError.INVALID_PARAMETER.getMessage("Invalid organization id")))
+ .verify();
+ }
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void importApplicationFromGit_privateRepoLimitReached_ThrowApplicationLimitError() {
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testRepo.git", testUserProfile);
+ gitService.generateSSHKey().block();
+ Mockito
+ .when(gitCloudServicesUtils.getPrivateRepoLimitForOrg(Mockito.any(), Mockito.anyBoolean()))
+ .thenReturn(Mono.just(0));
+
+ Mono<GitImportDTO> applicationMono = gitService.importApplicationFromGit(orgId, gitConnectDTO);
+
+ StepVerifier
+ .create(applicationMono)
+ .expectErrorMatches(throwable -> throwable instanceof AppsmithException
+ && throwable.getMessage().contains(AppsmithError.GIT_APPLICATION_LIMIT_ERROR.getMessage(AppsmithError.GIT_APPLICATION_LIMIT_ERROR.getMessage())))
+ .verify();
+ }
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void importApplicationFromGit_validRequest_Success() throws GitAPIException, IOException {
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testRepo.git", testUserProfile);
+ GitAuth gitAuth = gitService.generateSSHKey().block();
+
+ ApplicationJson applicationJson = createAppJson(filePath).block();
+ applicationJson.getExportedApplication().setName("testRepo");
+ applicationJson.setDatasourceList(new ArrayList<>());
+
+ Mockito.when(gitExecutor.cloneApplication(Mockito.any(Path.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just("defaultBranch"));
+ Mockito.when(gitFileUtils.reconstructApplicationFromGitRepo(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just(applicationJson));
+
+ Mono<GitImportDTO> applicationMono = gitService.importApplicationFromGit(orgId, gitConnectDTO);
+
+ StepVerifier
+ .create(applicationMono)
+ .assertNext(gitImportDTO -> {
+ Application application = gitImportDTO.getApplication();
+ assertThat(application.getName()).isEqualTo("testRepo");
+ assertThat(application.getGitApplicationMetadata()).isNotNull();
+ assertThat(application.getGitApplicationMetadata().getBranchName()).isEqualTo("defaultBranch");
+ assertThat(application.getGitApplicationMetadata().getDefaultBranchName()).isEqualTo("defaultBranch");
+ assertThat(application.getGitApplicationMetadata().getRemoteUrl()).isEqualTo("[email protected]:test/testRepo.git");
+ assertThat(application.getGitApplicationMetadata().getIsRepoPrivate()).isEqualTo(true);
+ assertThat(application.getGitApplicationMetadata().getGitAuth().getPublicKey()).isEqualTo(gitAuth.getPublicKey());
+
+ })
+ .verifyComplete();
+ }
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void importApplicationFromGit_validRequestWithDuplicateApplicationName_Success() throws GitAPIException, IOException {
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testGitRepo.git", testUserProfile);
+ GitAuth gitAuth = gitService.generateSSHKey().block();
+
+ ApplicationJson applicationJson = createAppJson(filePath).block();
+ applicationJson.getExportedApplication().setName("testGitRepo (1)");
+ applicationJson.setDatasourceList(new ArrayList<>());
+
+ Application testApplication = new Application();
+ testApplication.setName("testGitRepo");
+ testApplication.setOrganizationId(orgId);
+ applicationPageService.createApplication(testApplication).block();
+
+ Mockito.when(gitExecutor.cloneApplication(Mockito.any(Path.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just("defaultBranch"));
+ Mockito.when(gitFileUtils.reconstructApplicationFromGitRepo(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just(applicationJson));
+
+ Mono<GitImportDTO> applicationMono = gitService.importApplicationFromGit(orgId, gitConnectDTO);
+
+ StepVerifier
+ .create(applicationMono)
+ .assertNext(gitImportDTO -> {
+ Application application = gitImportDTO.getApplication();
+ assertThat(application.getName()).isEqualTo("testGitRepo (1)");
+ assertThat(application.getGitApplicationMetadata()).isNotNull();
+ assertThat(application.getGitApplicationMetadata().getBranchName()).isEqualTo("defaultBranch");
+ assertThat(application.getGitApplicationMetadata().getDefaultBranchName()).isEqualTo("defaultBranch");
+ assertThat(application.getGitApplicationMetadata().getRemoteUrl()).isEqualTo("[email protected]:test/testGitRepo.git");
+ assertThat(application.getGitApplicationMetadata().getIsRepoPrivate()).isEqualTo(true);
+ assertThat(application.getGitApplicationMetadata().getGitAuth().getPublicKey()).isEqualTo(gitAuth.getPublicKey());
+
+ })
+ .verifyComplete();
+ }
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void importApplicationFromGit_validRequestWithDuplicateDatasourceOfSameType_Success() throws GitAPIException, IOException {
+ Organization organization = new Organization();
+ organization.setName("gitImportOrg");
+ final String testOrgId = organizationService.create(organization)
+ .map(Organization::getId)
+ .block();
+
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testGitImportRepo.git", testUserProfile);
+ GitAuth gitAuth = gitService.generateSSHKey().block();
+
+ ApplicationJson applicationJson = createAppJson(filePath).block();
+ applicationJson.getExportedApplication().setName("testGitImportRepo");
+ applicationJson.getDatasourceList().get(0).setName("db-auth-testGitImportRepo");
+
+ String pluginId = pluginRepository.findByPackageName("mongo-plugin").block().getId();
+ Datasource datasource = new Datasource();
+ datasource.setName("db-auth-testGitImportRepo");
+ datasource.setPluginId(pluginId);
+ datasource.setOrganizationId(testOrgId);
+ datasourceService.create(datasource).block();
+
+ Mockito.when(gitExecutor.cloneApplication(Mockito.any(Path.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just("defaultBranch"));
+ Mockito.when(gitFileUtils.reconstructApplicationFromGitRepo(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just(applicationJson));
+ Mockito.when(gitFileUtils.detachRemote(Mockito.any(Path.class))).thenReturn(Mono.just(true));
+
+ Mono<GitImportDTO> applicationMono = gitService.importApplicationFromGit(orgId, gitConnectDTO);
+
+ StepVerifier
+ .create(applicationMono)
+ .assertNext(gitImportDTO -> {
+ Application application = gitImportDTO.getApplication();
+ assertThat(application.getName()).isEqualTo("testGitImportRepo");
+ assertThat(application.getGitApplicationMetadata()).isNotNull();
+ assertThat(application.getGitApplicationMetadata().getBranchName()).isEqualTo("defaultBranch");
+ assertThat(application.getGitApplicationMetadata().getDefaultBranchName()).isEqualTo("defaultBranch");
+ assertThat(application.getGitApplicationMetadata().getRemoteUrl()).isEqualTo("[email protected]:test/testGitImportRepo.git");
+ assertThat(application.getGitApplicationMetadata().getIsRepoPrivate()).isEqualTo(true);
+ assertThat(application.getGitApplicationMetadata().getGitAuth().getPublicKey()).isEqualTo(gitAuth.getPublicKey());
+
+ })
+ .verifyComplete();
+ }
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void importApplicationFromGit_validRequestWithDuplicateDatasourceOfSameTypeCancelledMidway_Success() throws GitAPIException, IOException {
+ Organization organization = new Organization();
+ organization.setName("gitImportOrgCancelledMidway");
+ final String testOrgId = organizationService.create(organization)
+ .map(Organization::getId)
+ .block();
+
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testGitImportRepo.git", testUserProfile);
+ GitAuth gitAuth = gitService.generateSSHKey().block();
+
+ ApplicationJson applicationJson = createAppJson(filePath).block();
+ applicationJson.getExportedApplication().setName("testGitImportRepoCancelledMidway");
+ applicationJson.getDatasourceList().get(0).setName("db-auth-testGitImportRepo");
+
+ String pluginId = pluginRepository.findByPackageName("mongo-plugin").block().getId();
+ Datasource datasource = new Datasource();
+ datasource.setName("db-auth-testGitImportRepo");
+ datasource.setPluginId(pluginId);
+ datasource.setOrganizationId(testOrgId);
+ datasourceService.create(datasource).block();
+
+ Mockito.when(gitExecutor.cloneApplication(Mockito.any(Path.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just("defaultBranch"));
+ Mockito.when(gitFileUtils.reconstructApplicationFromGitRepo(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just(applicationJson));
+ Mockito.when(gitFileUtils.detachRemote(Mockito.any(Path.class))).thenReturn(Mono.just(true));
+
+ gitService.importApplicationFromGit(testOrgId, gitConnectDTO)
+ .timeout(Duration.ofMillis(10))
+ .subscribe();
+
+ // Wait for git clone to complete
+ Mono<Application> gitConnectedAppFromDbMono = Mono.just(testOrgId)
+ .flatMap(application -> {
+ try {
+ // Before fetching the git connected application, sleep for 5 seconds to ensure that the clone
+ // completes
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return applicationService.findByOrganizationId(testOrgId, READ_APPLICATIONS)
+ .filter(application1 -> "testGitImportRepoCancelledMidway".equals(application1.getName()))
+ .next();
+ });
+
+ StepVerifier
+ .create(gitConnectedAppFromDbMono)
+ .assertNext(application -> {
+ assertThat(application.getName()).isEqualTo("testGitImportRepoCancelledMidway");
+ assertThat(application.getGitApplicationMetadata()).isNotNull();
+ assertThat(application.getGitApplicationMetadata().getBranchName()).isEqualTo("defaultBranch");
+ assertThat(application.getGitApplicationMetadata().getDefaultBranchName()).isEqualTo("defaultBranch");
+ assertThat(application.getGitApplicationMetadata().getRemoteUrl()).isEqualTo("[email protected]:test/testGitImportRepo.git");
+ assertThat(application.getGitApplicationMetadata().getIsRepoPrivate()).isEqualTo(true);
+ assertThat(application.getGitApplicationMetadata().getGitAuth().getPublicKey()).isEqualTo(gitAuth.getPublicKey());
+
+ })
+ .verifyComplete();
+ }
+
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void importApplicationFromGit_validRequestWithDuplicateDatasourceOfDifferentType_ThrowError() throws GitAPIException, IOException {
+ GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/testGitImportRepo1.git", testUserProfile);
+ gitService.generateSSHKey().block();
+ ApplicationJson applicationJson = createAppJson(filePath).block();
+ applicationJson.getExportedApplication().setName("testGitImportRepo1");
+ applicationJson.getDatasourceList().get(0).setName("db-auth-1");
+
+ String pluginId = pluginRepository.findByPackageName("postgres-plugin").block().getId();
+ Datasource datasource = new Datasource();
+ datasource.setName("db-auth-1");
+ datasource.setPluginId(pluginId);
+ datasource.setOrganizationId(orgId);
+ datasourceService.create(datasource).block();
+
+ Mockito.when(gitExecutor.cloneApplication(Mockito.any(Path.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just("defaultBranch"));
+ Mockito.when(gitFileUtils.reconstructApplicationFromGitRepo(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(Mono.just(applicationJson));
+ Mockito.when(gitFileUtils.detachRemote(Mockito.any(Path.class)))
+ .thenReturn(Mono.just(true));
+
+ Mono<GitImportDTO> applicationMono = gitService.importApplicationFromGit(orgId, gitConnectDTO);
+
+ StepVerifier
+ .create(applicationMono)
+ .expectErrorMatches(throwable -> throwable instanceof AppsmithException
+ && throwable.getMessage().contains("Datasource already exists with the same name"))
+ .verify();
+ }
+
// TODO TCs for merge is pending
}
\ No newline at end of file
|
dcddf4cb8644fdf3ff740c364ff16c9d87b459b6
|
2022-04-08 02:07:03
|
Favour Ohanekwu
|
chore: Add data property in entity explorer as part of "show bindings" (#12590)
| false
|
Add data property in entity explorer as part of "show bindings" (#12590)
|
chore
|
diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts
index c8e474e102d1..903e1687b624 100644
--- a/app/client/cypress/support/Pages/JSEditor.ts
+++ b/app/client/cypress/support/Pages/JSEditor.ts
@@ -1,7 +1,6 @@
-import { ObjectsRegistry } from "../Objects/Registry"
+import { ObjectsRegistry } from "../Objects/Registry";
export class JSEditor {
-
- public agHelper = ObjectsRegistry.AggregateHelper
+ public agHelper = ObjectsRegistry.AggregateHelper;
public locator = ObjectsRegistry.CommonLocators;
public ee = ObjectsRegistry.EntityExplorer;
@@ -16,6 +15,7 @@ export class JSEditor {
_dialog = (dialogHeader: string) => "//div[contains(@class, 'bp3-dialog')]//h4[contains(text(), '" + dialogHeader + "')]"
private _closeSettings = "span[icon='small-cross']"
+
public NavigateToJSEditor() {
cy.get(this.locator._createNew)
.last()
@@ -24,24 +24,33 @@ export class JSEditor {
//cy.waitUntil(() => cy.get(this.locator._toastMsg).should('not.be.visible')) // fails sometimes
//this.agHelper.WaitUntilEleDisappear(this.locator._toastMsg, 'created successfully')
- this.agHelper.Sleep()
+ this.agHelper.Sleep();
}
- public CreateJSObject(JSCode: string, paste = true, completeReplace = false, toRun = true) {
+ public CreateJSObject(
+ JSCode: string,
+ paste = true,
+ completeReplace = false,
+ toRun = true,
+ ) {
this.NavigateToJSEditor();
if (!completeReplace) {
cy.get(this.locator._codeMirrorTextArea)
.first()
.focus()
- .type("{downarrow}{downarrow}{downarrow}{downarrow} ")
- }
- else {
+ .type("{downarrow}{downarrow}{downarrow}{downarrow} ");
+ } else {
cy.get(this.locator._codeMirrorTextArea)
.first()
.focus()
- .type("{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}")
- .type("{shift}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}", { force: true })
+ .type(
+ "{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}",
+ )
+ .type(
+ "{shift}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}{uparrow}",
+ { force: true },
+ )
.type("{backspace}", { force: true });
// .type("{uparrow}", { force: true })
@@ -53,7 +62,6 @@ export class JSEditor {
// .type("{ctrl}{shift}{downarrow}", { force: true })
// .type("{backspace}",{ force: true });
//.type("{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow}{downarrow} ")
-
}
cy.get(this.locator._codeMirrorTextArea)
@@ -62,15 +70,16 @@ export class JSEditor {
const input = cy.get(el);
if (paste) {
//input.invoke("val", value);
- this.agHelper.Paste(el, JSCode)
+ this.agHelper.Paste(el, JSCode);
} else {
input.type(JSCode, {
- parseSpecialCharSequences: false, delay: 150
+ parseSpecialCharSequences: false,
+ delay: 150,
});
}
});
- this.agHelper.AssertAutoSave()//Ample wait due to open bug # 10284
+ this.agHelper.AssertAutoSave(); //Ample wait due to open bug # 10284
//this.agHelper.Sleep(5000)//Ample wait due to open bug # 10284
if (toRun) {
@@ -79,22 +88,31 @@ export class JSEditor {
cy.xpath(this._runButton)
.first()
.click()
- .wait(3000)
- })
- cy.get(this.locator._empty).should('not.exist')
- cy.get(this.locator._toastMsg).should("have.length", 0)
+ .wait(3000);
+ });
+ cy.get(this.locator._empty).should("not.exist");
+ cy.get(this.locator._toastMsg).should("have.length", 0);
}
- this.GetJSObjectName()
+ this.GetJSObjectName();
}
//Not working - To improve!
public EditJSObj(existingTxt: string, newTxt: string) {
- cy.get(this.locator._codeEditorTarget).contains(existingTxt).dblclick()//.type("{backspace}").type(newTxt)
- cy.get('body').type("{backspace}").type(newTxt)
- this.agHelper.AssertAutoSave()//Ample wait due to open bug # 10284
+ cy.get(this.locator._codeEditorTarget)
+ .contains(existingTxt)
+ .dblclick(); //.type("{backspace}").type(newTxt)
+ cy.get("body")
+ .type("{backspace}")
+ .type(newTxt);
+ this.agHelper.AssertAutoSave(); //Ample wait due to open bug # 10284
}
- public EnterJSContext(endp: string, value: string, paste = true, toToggleOnJS = false) {
+ public EnterJSContext(
+ endp: string,
+ value: string,
+ paste = true,
+ toToggleOnJS = false,
+ ) {
if (toToggleOnJS) {
cy.get(this.locator._jsToggle(endp.replace(/ +/g, "").toLowerCase()))
.invoke("attr", "class")
@@ -106,7 +124,6 @@ export class JSEditor {
}
});
}
-
// cy.get(this.locator._propertyControl + endp + " " + this.locator._codeMirrorTextArea)
// .first()
// .focus()
@@ -162,6 +179,7 @@ export class JSEditor {
// });
this.agHelper.AssertAutoSave()//Allowing time for Evaluate value to capture value
+
}
public RenameJSObjFromForm(renameVal: string) {
@@ -184,14 +202,16 @@ export class JSEditor {
}
public GetJSObjectName() {
- cy.get(this._jsObjName).invoke("text").then((text) => cy.wrap(text).as("jsObjName")
- );
+ cy.get(this._jsObjName)
+ .invoke("text")
+ .then((text) => cy.wrap(text).as("jsObjName"));
}
public validateDefaultJSObjProperties(jsObjName: string) {
this.ee.ActionContextMenuByEntityName(jsObjName, "Show Bindings");
- cy.get(this._propertyList).then(function ($lis) {
- expect($lis).to.have.length(4);
+ cy.get(this._propertyList).then(function($lis) {
+ const bindingsLength = $lis.length;
+ expect(bindingsLength).to.be.at.least(4);
expect($lis.eq(0).text()).to.be.oneOf([
"{{" + jsObjName + ".myFun2()}}",
"{{" + jsObjName + ".myFun1()}}",
@@ -199,13 +219,20 @@ export class JSEditor {
expect($lis.eq(1).text()).to.be.oneOf([
"{{" + jsObjName + ".myFun2()}}",
"{{" + jsObjName + ".myFun1()}}",
+ "{{" + jsObjName + ".myFun2.data}}",
+ "{{" + jsObjName + ".myFun1.data}}",
]);
- expect($lis.eq(2).text()).to.contain("{{" + jsObjName + ".myVar1}}");
- expect($lis.eq(3).text()).to.contain("{{" + jsObjName + ".myVar2}}");
+ expect($lis.eq(bindingsLength - 2).text()).to.contain(
+ "{{" + jsObjName + ".myVar1}}",
+ );
+ expect($lis.eq(bindingsLength - 1).text()).to.contain(
+ "{{" + jsObjName + ".myVar2}}",
+ );
});
cy.get(this._bindingsClose).click({ force: true });
}
+
public EnableOnPageLoad(funName: string, onLoad = true, bfrCalling = true) {
this.agHelper.XpathNClick(this._responseTabAction(funName))
@@ -217,4 +244,5 @@ export class JSEditor {
this.agHelper.GetNClick(this._closeSettings)
}
+
}
diff --git a/app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx b/app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx
index 8bf35d674150..07af91a64052 100644
--- a/app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx
+++ b/app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx
@@ -14,10 +14,10 @@ import { getPropsForJSActionEntity } from "utils/autocomplete/EntityDefinitions"
import { isEmpty } from "lodash";
import { getCurrentPageId } from "selectors/editorSelectors";
import classNames from "classnames";
-import { JSCollection } from "entities/JSCollection";
import styled from "styled-components";
import { ControlIcons } from "icons/ControlIcons";
import { ReduxActionTypes } from "constants/ReduxActionConstants";
+import { JSCollectionData } from "reducers/entityReducers/jsActionsReducer";
const CloseIcon = ControlIcons.CLOSE_CONTROL;
@@ -122,15 +122,15 @@ export function EntityProperties() {
if (!entity) return null;
switch (entityType) {
case ENTITY_TYPE.JSACTION:
- const jsAction = entity.config as JSCollection;
- const properties = getPropsForJSActionEntity(jsAction);
+ const jsCollection = entity as JSCollectionData;
+ const properties = getPropsForJSActionEntity(jsCollection);
if (properties) {
entityProperties = Object.keys(properties).map(
(actionProperty: string) => {
const value = properties[actionProperty];
return {
propertyName: actionProperty,
- entityName: jsAction.name,
+ entityName: jsCollection.config.name,
value: value,
};
},
diff --git a/app/client/src/utils/autocomplete/EntityDefinitions.ts b/app/client/src/utils/autocomplete/EntityDefinitions.ts
index e78d3ca0974a..35baedfbfe1c 100644
--- a/app/client/src/utils/autocomplete/EntityDefinitions.ts
+++ b/app/client/src/utils/autocomplete/EntityDefinitions.ts
@@ -4,8 +4,8 @@ import {
DataTreeAppsmith,
} from "entities/DataTree/dataTreeFactory";
import _ from "lodash";
-import { JSCollection } from "entities/JSCollection";
import { EVALUATION_PATH } from "utils/DynamicBindingUtils";
+import { JSCollectionData } from "reducers/entityReducers/jsActionsReducer";
const isVisible = {
"!type": "bool",
@@ -669,17 +669,21 @@ export const GLOBAL_FUNCTIONS = {
},
};
-export const getPropsForJSActionEntity = (
- entity: JSCollection,
-): Record<string, string> => {
- const properties: Record<string, string> = {};
- const actions = entity.actions;
+export const getPropsForJSActionEntity = ({
+ config,
+ data,
+}: JSCollectionData): Record<string, string> => {
+ const properties: Record<string, any> = {};
+ const actions = config.actions;
if (actions && actions.length > 0)
- for (let i = 0; i < entity.actions.length; i++) {
- const action = entity.actions[i];
+ for (let i = 0; i < config.actions.length; i++) {
+ const action = config.actions[i];
properties[action.name + "()"] = "Function";
+ if (data && action.id in data) {
+ properties[action.name + ".data"] = data[action.id];
+ }
}
- const variablesProps = entity.variables;
+ const variablesProps = config.variables;
if (variablesProps && variablesProps.length > 0) {
for (let i = 0; i < variablesProps.length; i++) {
const variableProp = variablesProps[i];
|
4c56cc5bda5106ae6003e1d38abaad1c6dd20bbc
|
2022-07-28 21:45:47
|
sidhantgoel
|
feat: Annotation based Caching library similar to spring's Cacheable with WebFlux support (#14416)
| false
|
Annotation based Caching library similar to spring's Cacheable with WebFlux support (#14416)
|
feat
|
diff --git a/app/server/pom.xml b/app/server/pom.xml
index ec0757384614..ff23f4254698 100644
--- a/app/server/pom.xml
+++ b/app/server/pom.xml
@@ -72,6 +72,7 @@
<module>appsmith-plugins</module>
<module>appsmith-server</module>
<module>appsmith-git</module>
+ <module>reactive-caching</module>
</modules>
</project>
diff --git a/app/server/reactive-caching/pom.xml b/app/server/reactive-caching/pom.xml
new file mode 100644
index 000000000000..b3ad052fb513
--- /dev/null
+++ b/app/server/reactive-caching/pom.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>com.appsmith</groupId>
+ <artifactId>integrated</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.appsmith</groupId>
+ <artifactId>reactiveCaching</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <name>reactiveCaching</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <java.version>11</java.version>
+ <org.pf4j.version>3.4.1</org.pf4j.version>
+ <org.projectlombok.version>1.18.22</org.projectlombok.version>
+ <org.testcontainers.junit-jupiter.version>1.17.2</org.testcontainers.junit-jupiter.version>
+ <uk.co.jemos.podam.podam.version>7.2.5.RELEASE</uk.co.jemos.podam.podam.version>
+ <maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.pf4j</groupId>
+ <artifactId>pf4j</artifactId>
+ <version>${org.pf4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.projectreactor</groupId>
+ <artifactId>reactor-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-aop</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- junit 5 -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${org.projectlombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <version>${org.testcontainers.junit-jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>uk.co.jemos.podam</groupId>
+ <artifactId>podam</artifactId>
+ <version>${uk.co.jemos.podam.podam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.datatype</groupId>
+ <artifactId>jackson-datatype-jsr310</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${maven-surefire-plugin.version}</version>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
diff --git a/app/server/reactive-caching/src/main/java/com/appsmith/caching/annotations/Cache.java b/app/server/reactive-caching/src/main/java/com/appsmith/caching/annotations/Cache.java
new file mode 100644
index 000000000000..4ac132a03d2a
--- /dev/null
+++ b/app/server/reactive-caching/src/main/java/com/appsmith/caching/annotations/Cache.java
@@ -0,0 +1,26 @@
+package com.appsmith.caching.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to mark a method to cache the result of a method call.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Cache {
+
+ /*
+ * This is the name of the cache.
+ */
+ String cacheName();
+
+ /**
+ * SPEL expression used to generate the key for the method call
+ * All method arguments can be used in the expression
+ */
+ String key() default "";
+
+}
diff --git a/app/server/reactive-caching/src/main/java/com/appsmith/caching/annotations/CacheEvict.java b/app/server/reactive-caching/src/main/java/com/appsmith/caching/annotations/CacheEvict.java
new file mode 100644
index 000000000000..99cc9a7e9a20
--- /dev/null
+++ b/app/server/reactive-caching/src/main/java/com/appsmith/caching/annotations/CacheEvict.java
@@ -0,0 +1,31 @@
+package com.appsmith.caching.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to mark a method as a reactive cache evictor.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface CacheEvict {
+
+ /*
+ * This is the name of the cache.
+ */
+ String cacheName();
+
+ /**
+ * SPEL expression used to generate the key for the method call
+ * All method arguments can be used in the expression
+ */
+ String key() default "";
+
+ /**
+ * Whether to evict all keys for a given cache name.
+ */
+ boolean all() default false;
+
+}
diff --git a/app/server/reactive-caching/src/main/java/com/appsmith/caching/aspects/CacheAspect.java b/app/server/reactive-caching/src/main/java/com/appsmith/caching/aspects/CacheAspect.java
new file mode 100644
index 000000000000..3e66dbf43f73
--- /dev/null
+++ b/app/server/reactive-caching/src/main/java/com/appsmith/caching/aspects/CacheAspect.java
@@ -0,0 +1,204 @@
+package com.appsmith.caching.aspects;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.interceptor.SimpleKey;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.expression.EvaluationContext;
+import org.springframework.expression.ExpressionParser;
+import org.springframework.expression.spel.standard.SpelExpressionParser;
+import org.springframework.expression.spel.support.StandardEvaluationContext;
+
+import com.appsmith.caching.annotations.CacheEvict;
+import com.appsmith.caching.annotations.Cache;
+import com.appsmith.caching.components.CacheManager;
+
+import lombok.extern.slf4j.Slf4j;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * CacheAspect is an aspect that is used to cache the results of a method call annotated with Cache.
+ * It is also possible to evict the cached result by annotating method with CacheEvict.
+ */
+@Aspect
+@Configuration
+@Slf4j
+public class CacheAspect {
+
+ private final CacheManager cacheManager;
+
+ public static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser();
+
+ @Autowired
+ public CacheAspect(CacheManager cacheManager) {
+ this.cacheManager = cacheManager;
+ }
+
+ /**
+ * This method is used to call original Mono<T> returning method and return the the result after caching it with CacheManager
+ * @param joinPoint The join point of the method call
+ * @param cacheName The name of the cache
+ * @param key The key to be used for caching
+ * @return The result of the method call
+ */
+ private Mono<Object> callMonoMethodAndCache(ProceedingJoinPoint joinPoint, String cacheName, String key) {
+ try {
+ return ((Mono<?>) joinPoint.proceed())
+ .zipWhen(value -> cacheManager.put(cacheName, key, value)) //Call CacheManager.put() to cache the object
+ .flatMap(value -> Mono.just(value.getT1())); //Maps to the original object
+ } catch (Throwable e) {
+ log.error("Error occurred in saving to cache when invoking function {}", joinPoint.getSignature().getName(), e);
+ return Mono.error(e);
+ }
+ }
+
+
+ /**
+ * This method is used to call original Flux<T> returning method and return the the result after caching it with CacheManager
+ * @param joinPoint The join point
+ * @param cacheName The name of the cache
+ * @param key The key to be used for caching
+ * @return The result of the method call after caching
+ */
+ private Flux<?> callFluxMethodAndCache(ProceedingJoinPoint joinPoint, String cacheName, String key) {
+ try {
+ return ((Flux<?>) joinPoint.proceed())
+ .collectList() // Collect Flux<T> into Mono<List<T>>
+ .zipWhen(value -> cacheManager.put(cacheName, key, value)) //Call CacheManager.put() to cache the list
+ .flatMap(value -> Mono.just(value.getT1())) //Maps to the original list
+ .flatMapMany(Flux::fromIterable); //Convert it back to Flux<T>
+ } catch (Throwable e) {
+ log.error("Error occurred in saving to cache when invoking function {}", joinPoint.getSignature().getName(), e);
+ return Flux.error(e);
+ }
+ }
+
+ /**
+ * This method is used to derive the key name for caching the result of a method call based on method arguments.
+ * This uses original strategy used by Spring's Cacheable annotation.
+ * @param args Arguments of original method call
+ * @return Key name for caching the result of the method call
+ */
+ private String deriveKeyWithArguments(Object[] args) {
+ if(args.length == 0) { //If there are no arguments, return SimpleKey.EMPTY
+ return SimpleKey.EMPTY.toString();
+ }
+
+ if(args.length == 1) { //If there is only one argument, return its toString() value
+ return args[0].toString();
+ }
+
+ SimpleKey simpleKey = new SimpleKey(args); //Create SimpleKey from arguments and return its toString() value
+ return simpleKey.toString();
+ }
+
+ /**
+ * This method is used to derive the key name for caching the result of a method call based on method arguments and expression provided.
+ * @param expression SPEL Expression to derive the key name
+ * @param parameterNames Names of the method arguments of original method call
+ * @param args Arguments of original method call
+ * @return Key name for caching the result of the method call
+ */
+ private String deriveKeyWithExpression(String expression, String[] parameterNames, Object[] args) {
+ //Create EvaluationContext for the expression
+ EvaluationContext evaluationContext = new StandardEvaluationContext();
+ for (int i = 0; i < args.length; i ++) {
+ //Add method arguments to evaluation context
+ evaluationContext.setVariable(parameterNames[i], args[i]);
+ }
+ //Parse expression and return the result
+ return EXPRESSION_PARSER.parseExpression(expression).getValue(evaluationContext, String.class);
+ }
+
+ /**
+ * This method is used to derive the key name for caching the result of a method call
+ * @param expression SPEL Expression to derive the key name
+ * @param parameterNames Names of the method arguments of original method call
+ * @param args Arguments of original method call
+ * @return Key name for caching the result of the method call
+ */
+ private String deriveKey(String expression, String[] parameterNames, Object[] args) {
+ if(expression.isEmpty()) { //If expression is empty, use default strategy
+ return deriveKeyWithArguments(args);
+ }
+
+ //If expression is not empty, use expression strategy
+ return deriveKeyWithExpression(expression, parameterNames, args);
+ }
+
+ /**
+ * This method defines a Aspect to handle method calls annotated with Cache.
+ * @param joinPoint ProceedingJoinPoint of the method call
+ * @return Result of the method call, either cached or after calling the original method
+ * @throws Throwable
+ */
+ @Around("execution(public * *(..)) && @annotation(com.appsmith.caching.annotations.Cache)")
+ public Object cacheable(ProceedingJoinPoint joinPoint) throws Throwable {
+ MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+ Method method = signature.getMethod();
+ Cache annotation = method.getAnnotation(Cache.class);
+ String cacheName = annotation.cacheName();
+
+ //derive key
+ String[] parameterNames = signature.getParameterNames();
+ Object[] args = joinPoint.getArgs();
+ String key = deriveKey(annotation.key(), parameterNames, args);
+
+ Class<?> returnType = method.getReturnType();
+ if (returnType.isAssignableFrom(Mono.class)) { //If method returns Mono<T>
+ return cacheManager.get(cacheName, key)
+ .switchIfEmpty(Mono.defer(() -> callMonoMethodAndCache(joinPoint, cacheName, key))); //defer the creation of Mono until subscription as it will call original function
+ }
+
+ if (returnType.isAssignableFrom(Flux.class)) { //If method returns Flux<T>
+ return cacheManager.get(cacheName, key)
+ .switchIfEmpty(Mono.defer(() -> callFluxMethodAndCache(joinPoint, cacheName, key).collectList())) //defer the creation of Flux until subscription as it will call original function
+ .map(value -> (List<?>) value)
+ .flatMapMany(Flux::fromIterable);
+ }
+
+ //If method does not returns Mono<T> or Flux<T> raise exception
+ throw new RuntimeException("Invalid usage of @Cache annotation. Only reactive objects Mono and Flux are supported for caching.");
+ }
+
+ /**
+ * This method defines a Aspect to handle method calls annotated with ReactiveEvict.
+ * Original method should return Mono<?>
+ * @param joinPoint ProceedingJoinPoint of the method call
+ * @return Mono<Void> that will complete after evicting the key from the cache
+ * @throws Throwable
+ */
+ @Around("execution(public * *(..)) && @annotation(com.appsmith.caching.annotations.CacheEvict)")
+ public Object cacheEvict(ProceedingJoinPoint joinPoint) throws Throwable {
+ MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+ Method method = signature.getMethod();
+ CacheEvict annotation = method.getAnnotation(CacheEvict.class);
+ String cacheName = annotation.cacheName();
+ boolean all = annotation.all();
+ Class<?> returnType = method.getReturnType();
+
+ if (!returnType.isAssignableFrom(Mono.class)) {
+ throw new RuntimeException("Invalid usage of @CacheEvict for " + method.getName() + ". Only Mono<?> is allowed.");
+ }
+
+ if(all) { //If all is true, evict all keys from the cache
+ return cacheManager.evictAll(cacheName)
+ .then((Mono<?>) joinPoint.proceed());
+ }
+
+ //derive key
+ String[] parameterNames = signature.getParameterNames();
+ Object[] args = joinPoint.getArgs();
+ String key = deriveKey(annotation.key(), parameterNames, args);
+ //Evict key from the cache then call the original method
+ return cacheManager.evict(cacheName, key)
+ .then((Mono<?>) joinPoint.proceed());
+ }
+}
diff --git a/app/server/reactive-caching/src/main/java/com/appsmith/caching/components/CacheManager.java b/app/server/reactive-caching/src/main/java/com/appsmith/caching/components/CacheManager.java
new file mode 100644
index 000000000000..d433dd49980f
--- /dev/null
+++ b/app/server/reactive-caching/src/main/java/com/appsmith/caching/components/CacheManager.java
@@ -0,0 +1,42 @@
+package com.appsmith.caching.components;
+
+import reactor.core.publisher.Mono;
+
+public interface CacheManager {
+ /**
+ * This will log the cache stats with INFO severity.
+ */
+ void logStats();
+
+ /**
+ * This will get item from the cache, Mono.empty() if not found.
+ * @param cacheName The name of the cache.
+ * @param key The key of the item.
+ * @return The Mono of the item.
+ */
+ Mono<Object> get(String cacheName, String key);
+
+ /**
+ * This will put item into the cache.
+ * @param cacheName The name of the cache.
+ * @param key The key of the item.
+ * @param value The value of the item.
+ * @return Mono<Boolean> true if put was successful, false otherwise.
+ */
+ Mono<Boolean> put(String cacheName, String key, Object value);
+
+ /**
+ * This will remove item from the cache.
+ * @param cacheName The name of the cache.
+ * @param key The key of the item.
+ * @return Mono<Void> that will complete after the item is removed.
+ */
+ Mono<Void> evict(String cacheName, String key);
+
+ /**
+ * This will remove all items from the cache.
+ * @param cacheName The name of the cache.
+ * @return Mono<Void> that will complete after the items are removed.
+ */
+ Mono<Void> evictAll(String cacheName);
+}
diff --git a/app/server/reactive-caching/src/main/java/com/appsmith/caching/components/RedisCacheManagerImpl.java b/app/server/reactive-caching/src/main/java/com/appsmith/caching/components/RedisCacheManagerImpl.java
new file mode 100644
index 000000000000..896711cca672
--- /dev/null
+++ b/app/server/reactive-caching/src/main/java/com/appsmith/caching/components/RedisCacheManagerImpl.java
@@ -0,0 +1,109 @@
+package com.appsmith.caching.components;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.data.redis.core.ReactiveRedisOperations;
+import org.springframework.data.redis.core.ReactiveRedisTemplate;
+import org.springframework.data.redis.core.script.RedisScript;
+import org.springframework.stereotype.Component;
+
+import com.appsmith.caching.model.CacheStats;
+
+import lombok.extern.slf4j.Slf4j;
+import reactor.core.publisher.Mono;
+
+/**
+ * RedisCacheManagerImpl is a class that implements the CacheManager interface.
+ * Used Redis as the cache backend.
+ */
+@Component
+@ConditionalOnClass({ReactiveRedisTemplate.class})
+@Slf4j
+public class RedisCacheManagerImpl implements CacheManager {
+
+ private final ReactiveRedisTemplate<String, Object> reactiveRedisTemplate;
+ private final ReactiveRedisOperations<String, String> reactiveRedisOperations;
+
+ Map<String, CacheStats> statsMap = new ConcurrentHashMap<>();
+
+ /**
+ * Ensures that the key for cacheName is present in statsMap.
+ * @param cacheName The name of the cache.
+ */
+ private void ensureStats(String cacheName) {
+ if (!statsMap.containsKey(cacheName)) {
+ statsMap.put(cacheName, CacheStats.newInstance());
+ }
+ }
+
+ @Override
+ public void logStats() {
+ statsMap.keySet().forEach(key -> {
+ CacheStats stats = statsMap.get(key);
+ log.info("Cache {} stats: hits = {}, misses = {}, singleEvictions = {}, completeEvictions = {}", key, stats.getHits(), stats.getMisses(), stats.getSingleEvictions(), stats.getCompleteEvictions());
+ });
+ }
+
+ /**
+ * Resets the stats.
+ */
+ public void resetStats() {
+ statsMap.clear();
+ }
+
+ @Autowired
+ public RedisCacheManagerImpl(ReactiveRedisTemplate<String, Object> reactiveRedisTemplate,
+ ReactiveRedisOperations<String, String> reactiveRedisOperations) {
+ this.reactiveRedisTemplate = reactiveRedisTemplate;
+ this.reactiveRedisOperations = reactiveRedisOperations;
+ }
+
+ @Override
+ public Mono<Object> get(String cacheName, String key) {
+ ensureStats(cacheName);
+ String path = cacheName + ":" + key;
+ return reactiveRedisTemplate.opsForValue().get(path)
+ .map(value -> {
+ //This is a cache hit, update stats and return value
+ statsMap.get(cacheName).getHits().incrementAndGet();
+ return value;
+ })
+ .switchIfEmpty(Mono.defer(() -> {
+ //This is a cache miss, update stats and return empty
+ statsMap.get(cacheName).getMisses().incrementAndGet();
+ return Mono.empty();
+ }));
+ }
+
+ @Override
+ public Mono<Boolean> put(String cacheName, String key, Object value) {
+ ensureStats(cacheName);
+ String path = cacheName + ":" + key;
+ return reactiveRedisTemplate.opsForValue().set(path, value);
+ }
+
+ @Override
+ public Mono<Void> evict(String cacheName, String key) {
+ ensureStats(cacheName);
+ statsMap.get(cacheName).getSingleEvictions().incrementAndGet();
+ String path = cacheName + ":" + key;
+ return reactiveRedisTemplate.delete(path).then();
+ }
+
+ @Override
+ public Mono<Void> evictAll(String cacheName) {
+ ensureStats(cacheName);
+ statsMap.get(cacheName).getCompleteEvictions().incrementAndGet();
+ String path = cacheName;
+ //Remove all matching keys with wildcard
+ final String script =
+ "for _,k in ipairs(redis.call('keys','" + path + ":*'))" +
+ " do redis.call('del',k) " +
+ "end";
+ return reactiveRedisOperations.execute(RedisScript.of(script)).then();
+ }
+
+}
diff --git a/app/server/reactive-caching/src/main/java/com/appsmith/caching/model/CacheStats.java b/app/server/reactive-caching/src/main/java/com/appsmith/caching/model/CacheStats.java
new file mode 100644
index 000000000000..cd39a54b1ad9
--- /dev/null
+++ b/app/server/reactive-caching/src/main/java/com/appsmith/caching/model/CacheStats.java
@@ -0,0 +1,34 @@
+package com.appsmith.caching.model;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * This is a CacheStats class that is used to store the stats of a cache.
+ * It is maintained for all cacheNames in the memory
+ */
+@Data
+@NoArgsConstructor(staticName = "newInstance")
+public class CacheStats {
+ /**
+ * The number of times the cache was hit.
+ */
+ private AtomicInteger hits = new AtomicInteger(0);
+
+ /**
+ * The number of times the cache was missed.
+ */
+ private AtomicInteger misses = new AtomicInteger(0);
+
+ /**
+ * The number of times the cache was evicted (single key).
+ */
+ private AtomicInteger singleEvictions = new AtomicInteger(0);
+
+ /**
+ * The number of times the cache was evicted (all keys).
+ */
+ private AtomicInteger completeEvictions = new AtomicInteger(0);
+}
diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/CacheApplication.java b/app/server/reactive-caching/src/test/java/com/appsmith/caching/CacheApplication.java
new file mode 100644
index 000000000000..ffeb04006de2
--- /dev/null
+++ b/app/server/reactive-caching/src/test/java/com/appsmith/caching/CacheApplication.java
@@ -0,0 +1,11 @@
+package com.appsmith.caching;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class CacheApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(CacheApplication.class, args);
+ }
+}
diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/configuration/RedisTestContainerConfig.java b/app/server/reactive-caching/src/test/java/com/appsmith/caching/configuration/RedisTestContainerConfig.java
new file mode 100644
index 000000000000..4e0fc637cf75
--- /dev/null
+++ b/app/server/reactive-caching/src/test/java/com/appsmith/caching/configuration/RedisTestContainerConfig.java
@@ -0,0 +1,58 @@
+package com.appsmith.caching.configuration;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
+import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
+import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
+import org.springframework.data.redis.core.ReactiveRedisOperations;
+import org.springframework.data.redis.core.ReactiveRedisTemplate;
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.RedisSerializationContext;
+import org.springframework.data.redis.serializer.RedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+import org.testcontainers.utility.DockerImageName;
+
+@Configuration
+@Testcontainers
+public class RedisTestContainerConfig {
+
+ @Container
+ public static GenericContainer redisContainer = new GenericContainer(DockerImageName.parse("redis:6.2.6-alpine"))
+ .withExposedPorts(6379);
+
+ @Bean
+ @Primary
+ public ReactiveRedisConnectionFactory reactiveRedisConnectionFactory() {
+ redisContainer.start();
+ RedisStandaloneConfiguration redisConf = new RedisStandaloneConfiguration(redisContainer.getHost(),
+ redisContainer.getMappedPort(6379));
+ return new LettuceConnectionFactory(redisConf);
+ }
+
+ @Primary
+ @Bean
+ ReactiveRedisTemplate<String, Object> reactiveRedisTemplate(ReactiveRedisConnectionFactory factory) {
+ RedisSerializer<String> keySerializer = new StringRedisSerializer();
+ RedisSerializer<Object> defaultSerializer = new GenericJackson2JsonRedisSerializer();
+ RedisSerializationContext<String, Object> serializationContext = RedisSerializationContext
+ .<String, Object>newSerializationContext(defaultSerializer).key(keySerializer).hashKey(keySerializer)
+ .build();
+ return new ReactiveRedisTemplate<>(factory, serializationContext);
+ }
+
+ @Primary
+ @Bean
+ ReactiveRedisOperations<String, String> reactiveRedisOperations(ReactiveRedisConnectionFactory factory) {
+ Jackson2JsonRedisSerializer<String> serializer = new Jackson2JsonRedisSerializer<>(String.class);
+ RedisSerializationContext.RedisSerializationContextBuilder<String, String> builder =
+ RedisSerializationContext.newSerializationContext(new StringRedisSerializer());
+ RedisSerializationContext<String, String> context = builder.value(serializer).build();
+ return new ReactiveRedisTemplate<>(factory, context);
+ }
+}
\ No newline at end of file
diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ArgumentModel.java b/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ArgumentModel.java
new file mode 100644
index 000000000000..0d7255696ffd
--- /dev/null
+++ b/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ArgumentModel.java
@@ -0,0 +1,10 @@
+package com.appsmith.caching.model;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+@Data
+@AllArgsConstructor(staticName = "of")
+public class ArgumentModel {
+ private String name;
+}
diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/NestedModel.java b/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/NestedModel.java
new file mode 100644
index 000000000000..3795e2bd8756
--- /dev/null
+++ b/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/NestedModel.java
@@ -0,0 +1,10 @@
+package com.appsmith.caching.model;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode
+public class NestedModel {
+ private int nestedIntValue;
+}
diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ParentModel.java b/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ParentModel.java
new file mode 100644
index 000000000000..946cb1f2b2fd
--- /dev/null
+++ b/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/ParentModel.java
@@ -0,0 +1,10 @@
+package com.appsmith.caching.model;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode
+public class ParentModel {
+ private int parentIntValue;
+}
diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/TestModel.java b/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/TestModel.java
new file mode 100644
index 000000000000..d6b4a6da23d2
--- /dev/null
+++ b/app/server/reactive-caching/src/test/java/com/appsmith/caching/model/TestModel.java
@@ -0,0 +1,19 @@
+package com.appsmith.caching.model;
+
+import java.time.Instant;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class TestModel extends ParentModel {
+ private int intValue;
+ private String stringValue;
+ private Integer integerValue;
+ private Boolean booleanValue;
+ private Long longValue;
+ private Double doubleValue;
+ private NestedModel nestedModel;
+ private String id;
+}
diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/service/CacheTestService.java b/app/server/reactive-caching/src/test/java/com/appsmith/caching/service/CacheTestService.java
new file mode 100644
index 000000000000..a5a98995db3e
--- /dev/null
+++ b/app/server/reactive-caching/src/test/java/com/appsmith/caching/service/CacheTestService.java
@@ -0,0 +1,113 @@
+package com.appsmith.caching.service;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import com.appsmith.caching.annotations.CacheEvict;
+import com.appsmith.caching.annotations.Cache;
+import com.appsmith.caching.model.ArgumentModel;
+import com.appsmith.caching.model.TestModel;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import uk.co.jemos.podam.api.PodamFactory;
+import uk.co.jemos.podam.api.PodamFactoryImpl;
+
+@Service
+public class CacheTestService {
+
+ PodamFactory factory = new PodamFactoryImpl();
+
+ /**
+ * This method is used to test the caching functionality for Mono<T>.
+ * @param id The id
+ * @return The Mono<TestModel> object, random every time
+ */
+ @Cache(cacheName = "objectcache")
+ public Mono<TestModel> getObjectFor(String id) {
+ TestModel model = factory.manufacturePojo(TestModel.class);
+ model.setId(id);
+ return Mono.just(model).delayElement(Duration.ofSeconds(2));
+ }
+
+ /**
+ * This method is used to test the eviction functionality for Mono<T>.
+ * @param id The id
+ * @return Mono<Void> that completes after eviction
+ */
+ @CacheEvict(cacheName = "objectcache")
+ public Mono<Void> evictObjectFor(String id) {
+ return Mono.empty();
+ }
+
+ /**
+ * This method is used to test eviction functionality for Mono<T>, complete cache.
+ * @return Mono<Void> that completes after eviction
+ */
+ @CacheEvict(cacheName = "objectcache", all = true)
+ public Mono<Void> evictAllObjects() {
+ return Mono.empty();
+ }
+
+ /**
+ * This method is used to test the caching functionality for Flux<T>.
+ * @param id The id
+ * @return The Flux<TestModel>, random every time
+ */
+ @Cache(cacheName = "listcache")
+ public Flux<TestModel> getListFor(String id) {
+ List<TestModel> testModels = new ArrayList<>();
+ for(int i = 0;i < 5;i++) {
+ TestModel model = factory.manufacturePojo(TestModel.class);
+ model.setId(id);
+ testModels.add(model);
+ }
+ return Flux.fromIterable(testModels).delayElements(Duration.ofMillis(200));
+ }
+
+ /**
+ * This method is used to test the eviction functionality for Flux<T>.
+ * @param id The id
+ * @return Mono<Void> that completes after eviction
+ */
+ @CacheEvict(cacheName = "listcache")
+ public Mono<Void> evictListFor(String id) {
+ return Mono.empty();
+ }
+
+ /**
+ * This method is used to test eviction functionality for Flux<T>, complete cache.
+ * @return Mono<Void> that completes after eviction
+ */
+ @CacheEvict(cacheName = "listcache", all = true)
+ public Mono<Void> evictAllLists() {
+ return Mono.empty();
+ }
+
+
+ /**
+ * This method is used to test SPEL expression in the caching annotation.
+ * @param ArgumentModel The argument model
+ * @return The Mono<TestModel> object, random every time
+ */
+ @Cache(cacheName = "objectcache1", key = "#argumentModel.name")
+ public Mono<TestModel> getObjectForWithKey(ArgumentModel argumentModel) {
+ TestModel model = factory.manufacturePojo(TestModel.class);
+ model.setId(argumentModel.getName());
+ return Mono.just(model).delayElement(Duration.ofSeconds(2));
+ }
+
+ /**
+ * This method is used to test SPEL expression in the caching annotation.
+ * Key generated will be same as getObjectForWithKey but with different expression
+ * @param id The id
+ * @return The Mono<Boolean> that will complete after the item is removed.
+ */
+ @CacheEvict(cacheName = "objectcache1", key = "#id")
+ public Mono<Void> evictObjectForWithKey(String id) {
+ return Mono.empty();
+ }
+}
diff --git a/app/server/reactive-caching/src/test/java/com/appsmith/caching/test/TestCachingMethods.java b/app/server/reactive-caching/src/test/java/com/appsmith/caching/test/TestCachingMethods.java
new file mode 100644
index 000000000000..9684691910e3
--- /dev/null
+++ b/app/server/reactive-caching/src/test/java/com/appsmith/caching/test/TestCachingMethods.java
@@ -0,0 +1,124 @@
+package com.appsmith.caching.test;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+import java.util.List;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import com.appsmith.caching.components.CacheManager;
+import com.appsmith.caching.model.ArgumentModel;
+import com.appsmith.caching.model.TestModel;
+import com.appsmith.caching.service.CacheTestService;
+
+import lombok.extern.slf4j.Slf4j;
+
+@SpringBootTest
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+@Slf4j
+public class TestCachingMethods {
+
+ @Autowired
+ private CacheTestService cacheTestService;
+
+ @Autowired
+ private CacheManager cacheManager;
+
+ /**
+ * This Test is used to test the caching of a method that returns a Mono<T>
+ */
+ @Test
+ public void testCacheAndEvictMono() {
+ TestModel model = cacheTestService.getObjectFor("test1").block();
+ TestModel model2 = cacheTestService.getObjectFor("test1").block();
+ assertEquals(model, model2);
+
+ cacheTestService.evictObjectFor("test1").block();
+
+ // If not evicted with above call, this will return the same object
+ model2 = cacheTestService.getObjectFor("test1").block();
+ assertNotEquals(model, model2);
+ }
+
+ /**
+ * This Test is used to test the caching of a method that returns a Flux<T>
+ */
+ @Test
+ public void testCacheAndEvictFlux() {
+ List<TestModel> model = cacheTestService.getListFor("test1").collectList().block();
+ List<TestModel> model2 = cacheTestService.getListFor("test1").collectList().block();
+ assertArrayEquals(model.toArray(), model2.toArray());
+
+ cacheTestService.evictListFor("test1").block();
+
+ // If not evicted with above call, this will return the same object
+ model2 = cacheTestService.getListFor("test1").collectList().block();
+ for(int i = model.size() - 1; i >= 0; i--) {
+ assertNotEquals(model.get(i), model2.get(i));
+ }
+ }
+
+ /**
+ * This Test is used to test evict all
+ */
+ @Test
+ public void testEvictAll() {
+ TestModel model1 = cacheTestService.getObjectFor("test1").block();
+ TestModel model2 = cacheTestService.getObjectFor("test2").block();
+
+ cacheTestService.evictAllObjects().block();
+
+ TestModel model1_2 = cacheTestService.getObjectFor("test1").block();
+ TestModel model2_2 = cacheTestService.getObjectFor("test2").block();
+
+ assertNotEquals(model1, model1_2);
+ assertNotEquals(model2, model2_2);
+ }
+
+ /**
+ * This Test is used to test SPEL expression in key field.
+ */
+ @Test
+ public void testExpression() {
+ TestModel model = cacheTestService.getObjectForWithKey(ArgumentModel.of("test1")).block();
+ TestModel model2 = cacheTestService.getObjectForWithKey(ArgumentModel.of("test1")).block();
+ assertEquals(model, model2);
+
+ cacheTestService.evictObjectForWithKey("test1").block();
+
+ // If not evicted with above call, this will return the same object
+ model2 = cacheTestService.getObjectForWithKey(ArgumentModel.of("test1")).block();
+ assertNotEquals(model, model2);
+ }
+
+ /**
+ * Test to measure performance of caching
+ */
+ @Test
+ public void measurePerformance() {
+ // Cache first
+ TestModel model1 = cacheTestService.getObjectFor("test1").block();
+ long initialTime = System.nanoTime();
+ int count = 100;
+ for(int i = 0; i < count; i++) {
+ cacheTestService.getObjectFor("test1").block();
+ }
+ long finalTime = System.nanoTime();
+ long timeTaken = finalTime - initialTime;
+ log.info("Time taken for cache operation " + (timeTaken / count) + " nanos");
+ }
+
+ /**
+ * Log stats in the end
+ */
+ @AfterAll
+ public void tearDown() {
+ cacheManager.logStats();
+ }
+}
|
3d967e2df3329209847b01435de492144e56870d
|
2021-09-03 15:45:04
|
Bhavin K
|
feat: statbox widget (#6556)
| false
|
statbox widget (#6556)
|
feat
|
diff --git a/app/client/cypress/fixtures/StatboxDsl.json b/app/client/cypress/fixtures/StatboxDsl.json
new file mode 100644
index 000000000000..6cb58484eeca
--- /dev/null
+++ b/app/client/cypress/fixtures/StatboxDsl.json
@@ -0,0 +1,136 @@
+{
+ "dsl": {
+ "widgetName": "MainContainer",
+ "backgroundColor": "none",
+ "rightColumn": 1280,
+ "snapColumns": 64,
+ "detachFromLayout": true,
+ "widgetId": "0",
+ "topRow": 0,
+ "bottomRow": 1230,
+ "containerStyle": "none",
+ "snapRows": 125,
+ "parentRowSpace": 1,
+ "type": "CANVAS_WIDGET",
+ "canExtend": true,
+ "version": 31,
+ "minHeight": 1240,
+ "parentColumnSpace": 1,
+ "dynamicTriggerPathList": [],
+ "dynamicBindingPathList": [],
+ "leftColumn": 0,
+ "children": [
+ {
+ "widgetName": "Statbox1",
+ "backgroundColor": "white",
+ "rightColumn": 30,
+ "widgetId": "3sii8uhhjs",
+ "topRow": 17,
+ "bottomRow": 33,
+ "parentRowSpace": 10,
+ "isVisible": true,
+ "type": "STATBOX_WIDGET",
+ "parentId": "0",
+ "isLoading": false,
+ "parentColumnSpace": 19.8125,
+ "leftColumn": 14,
+ "children": [
+ {
+ "widgetName": "Canvas1",
+ "rightColumn": 317,
+ "detachFromLayout": true,
+ "widgetId": "l752czyef7",
+ "containerStyle": "none",
+ "topRow": 0,
+ "bottomRow": 160,
+ "parentRowSpace": 1,
+ "isVisible": true,
+ "canExtend": false,
+ "type": "CANVAS_WIDGET",
+ "version": 1,
+ "parentId": "3sii8uhhjs",
+ "minHeight": 160,
+ "isLoading": false,
+ "parentColumnSpace": 1,
+ "leftColumn": 0,
+ "children": [
+ {
+ "widgetName": "Text1",
+ "rightColumn": 37.5,
+ "textAlign": "LEFT",
+ "widgetId": "4mtayc9eas",
+ "topRow": 0.5,
+ "bottomRow": 4.5,
+ "isVisible": true,
+ "fontStyle": "BOLD",
+ "type": "TEXT_WIDGET",
+ "textColor": "#999999",
+ "version": 1,
+ "parentId": "l752czyef7",
+ "isLoading": false,
+ "leftColumn": 1.5,
+ "fontSize": "PARAGRAPH2",
+ "text": "Page Views"
+ },
+ {
+ "widgetName": "Text2",
+ "rightColumn": 37.5,
+ "textAlign": "LEFT",
+ "widgetId": "ii2tk6m48f",
+ "topRow": 5.5,
+ "bottomRow": 9.5,
+ "isVisible": true,
+ "fontStyle": "BOLD",
+ "type": "TEXT_WIDGET",
+ "textColor": "#231F20",
+ "version": 1,
+ "parentId": "l752czyef7",
+ "isLoading": false,
+ "leftColumn": 1.5,
+ "fontSize": "HEADING1",
+ "text": "2.6 M"
+ },
+ {
+ "widgetName": "Text3",
+ "rightColumn": 37.5,
+ "textAlign": "LEFT",
+ "widgetId": "ptbhksx9p1",
+ "topRow": 10,
+ "bottomRow": 14,
+ "isVisible": true,
+ "fontStyle": "BOLD",
+ "type": "TEXT_WIDGET",
+ "textColor": "#03B365",
+ "version": 1,
+ "parentId": "l752czyef7",
+ "isLoading": false,
+ "leftColumn": 1.5,
+ "fontSize": "PARAGRAPH2",
+ "text": "21% more than last month"
+ },
+ {
+ "boxShadow": "NONE",
+ "widgetName": "IconButton1",
+ "rightColumn": 61,
+ "iconName": "arrow-top-right",
+ "widgetId": "x35ni1hugn",
+ "buttonStyle": "PRIMARY",
+ "topRow": 3,
+ "bottomRow": 11,
+ "isVisible": true,
+ "type": "ICON_BUTTON_WIDGET",
+ "version": 1,
+ "parentId": "l752czyef7",
+ "isLoading": false,
+ "borderRadius": "CIRCLE",
+ "leftColumn": 45,
+ "buttonVariant": "SOLID",
+ "isDisabled": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Statbox_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Statbox_spec.js
new file mode 100644
index 000000000000..93eb813bf19b
--- /dev/null
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Statbox_spec.js
@@ -0,0 +1,17 @@
+const dsl = require("../../../../fixtures/StatboxDsl.json");
+const explorer = require("../../../../locators/explorerlocators.json");
+
+describe("Statbox Widget Functionality", function() {
+ beforeEach(() => {
+ cy.addDsl(dsl);
+ });
+
+ it("Open Existing Statbox from created Widgets list", () => {
+ cy.get(".bp3-icon-caret-right ~ .t--entity-name:contains(Widgets)").click({
+ multiple: true,
+ });
+ cy.get(".bp3-icon-caret-right ~ .t--entity-name:contains(Statbox1)").click({
+ multiple: true,
+ });
+ });
+});
diff --git a/app/client/src/assets/icons/widget/statbox.svg b/app/client/src/assets/icons/widget/statbox.svg
new file mode 100644
index 000000000000..5377cc5845ef
--- /dev/null
+++ b/app/client/src/assets/icons/widget/statbox.svg
@@ -0,0 +1,3 @@
+<svg width="32" height="16" viewBox="0 0 32 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2C0 0.895431 0.895431 0 2 0H30C31.1046 0 32 0.895431 32 2V14C32 15.1046 31.1046 16 30 16H2C0.895431 16 0 15.1046 0 14V2ZM22.9758 5.77803C22.9746 5.64692 23.0255 5.52156 23.1174 5.42952C23.2092 5.33749 23.3345 5.28631 23.4656 5.28725L27.6613 5.31788C27.7924 5.31886 27.9187 5.37187 28.0123 5.46526C28.1058 5.55865 28.1591 5.68476 28.1603 5.81588L28.1995 10.0115C28.1984 10.1411 28.1465 10.2643 28.0549 10.3545C27.9633 10.4447 27.8393 10.4947 27.7096 10.4938C27.58 10.4928 27.455 10.441 27.3617 10.3495C27.2684 10.2579 27.2141 10.134 27.2107 10.0043L27.1827 7.00232L23.1695 11.0237C23.0776 11.1157 22.9523 11.1669 22.8212 11.1659C22.6901 11.165 22.5638 11.112 22.4702 11.0186C22.3766 10.9251 22.3233 10.799 22.3221 10.6679C22.3209 10.5367 22.3718 10.4113 22.4637 10.3193L26.4769 6.29794L23.4748 6.27603C23.3437 6.27505 23.2175 6.22204 23.1239 6.12865C23.0303 6.03526 22.9771 5.90914 22.9758 5.77803ZM4.94141 4.95703V12H6.25391V3.54492H4.94727L2.7207 5.11523V6.45703L4.8418 4.95703H4.94141ZM10.2414 4.08398C9.71016 4.57617 9.44453 5.21094 9.44453 5.98828V6.00586H10.6867V5.98828C10.6867 5.53516 10.8293 5.16992 11.1145 4.89258C11.4035 4.61523 11.7805 4.47656 12.2453 4.47656C12.6828 4.47656 13.048 4.60547 13.341 4.86328C13.634 5.12109 13.7805 5.44336 13.7805 5.83008C13.7805 6.14258 13.6867 6.44922 13.4992 6.75C13.3117 7.04688 12.9367 7.48828 12.3742 8.07422L9.51484 11.0508V12H15.2102V10.8223H11.343V10.7227L13.2238 8.81836C13.9309 8.10352 14.4152 7.52734 14.677 7.08984C14.9426 6.64844 15.0754 6.20312 15.0754 5.75391C15.0754 5.05859 14.8117 4.48242 14.2844 4.02539C13.757 3.56836 13.091 3.33984 12.2863 3.33984C11.4543 3.33984 10.7727 3.58789 10.2414 4.08398Z" fill="#C4C4C4"/>
+</svg>
diff --git a/app/client/src/components/designSystems/appsmith/IconButtonComponent.tsx b/app/client/src/components/designSystems/appsmith/IconButtonComponent.tsx
index 69858cfc986e..38368a6bf1fd 100644
--- a/app/client/src/components/designSystems/appsmith/IconButtonComponent.tsx
+++ b/app/client/src/components/designSystems/appsmith/IconButtonComponent.tsx
@@ -31,13 +31,15 @@ export interface ButtonStyleProps {
buttonStyle?: ButtonStyle;
buttonVariant?: ButtonVariant;
dimension?: number;
+ hasOnClickAction?: boolean;
}
export const StyledButton = styled(Button)<ThemeProp & ButtonStyleProps>`
+
background-image: none !important;
height: ${({ dimension }) => (dimension ? `${dimension}px` : "auto")};
width: ${({ dimension }) => (dimension ? `${dimension}px` : "auto")};
- ${({ buttonStyle, buttonVariant, theme }) => `
+ ${({ buttonStyle, buttonVariant, hasOnClickAction, theme }) => `
&:enabled {
background: ${
buttonStyle === ButtonStyleTypes.WARNING
@@ -62,35 +64,36 @@ export const StyledButton = styled(Button)<ThemeProp & ButtonStyleProps>`
} !important;
}
- &:hover:enabled, &:active:enabled {
- background: ${
- buttonStyle === ButtonStyleTypes.WARNING
- ? buttonVariant === ButtonVariantTypes.OUTLINE
- ? theme.colors.button.warning.outline.hoverColor
+ ${hasOnClickAction &&
+ `&:hover:enabled, &:active:enabled {
+ background: ${
+ buttonStyle === ButtonStyleTypes.WARNING
+ ? buttonVariant === ButtonVariantTypes.OUTLINE
+ ? theme.colors.button.warning.outline.hoverColor
+ : buttonVariant === ButtonVariantTypes.GHOST
+ ? theme.colors.button.warning.ghost.hoverColor
+ : theme.colors.button.warning.solid.hoverColor
+ : buttonStyle === ButtonStyleTypes.DANGER
+ ? buttonVariant === ButtonVariantTypes.SOLID
+ ? theme.colors.button.danger.solid.hoverColor
+ : theme.colors.button.danger.outline.hoverColor
+ : buttonStyle === ButtonStyleTypes.INFO
+ ? buttonVariant === ButtonVariantTypes.SOLID
+ ? theme.colors.button.info.solid.hoverColor
+ : theme.colors.button.info.outline.hoverColor
+ : buttonStyle === ButtonStyleTypes.SECONDARY
+ ? buttonVariant === ButtonVariantTypes.OUTLINE
+ ? theme.colors.button.secondary.outline.hoverColor
+ : buttonVariant === ButtonVariantTypes.GHOST
+ ? theme.colors.button.secondary.ghost.hoverColor
+ : theme.colors.button.secondary.solid.hoverColor
+ : buttonVariant === ButtonVariantTypes.OUTLINE
+ ? theme.colors.button.primary.outline.hoverColor
: buttonVariant === ButtonVariantTypes.GHOST
- ? theme.colors.button.warning.ghost.hoverColor
- : theme.colors.button.warning.solid.hoverColor
- : buttonStyle === ButtonStyleTypes.DANGER
- ? buttonVariant === ButtonVariantTypes.SOLID
- ? theme.colors.button.danger.solid.hoverColor
- : theme.colors.button.danger.outline.hoverColor
- : buttonStyle === ButtonStyleTypes.INFO
- ? buttonVariant === ButtonVariantTypes.SOLID
- ? theme.colors.button.info.solid.hoverColor
- : theme.colors.button.info.outline.hoverColor
- : buttonStyle === ButtonStyleTypes.SECONDARY
- ? buttonVariant === ButtonVariantTypes.OUTLINE
- ? theme.colors.button.secondary.outline.hoverColor
- : buttonVariant === ButtonVariantTypes.GHOST
- ? theme.colors.button.secondary.ghost.hoverColor
- : theme.colors.button.secondary.solid.hoverColor
- : buttonVariant === ButtonVariantTypes.OUTLINE
- ? theme.colors.button.primary.outline.hoverColor
- : buttonVariant === ButtonVariantTypes.GHOST
- ? theme.colors.button.primary.ghost.hoverColor
- : theme.colors.button.primary.solid.hoverColor
- } !important;
- }
+ ? theme.colors.button.primary.ghost.hoverColor
+ : theme.colors.button.primary.solid.hoverColor
+ } !important;
+ }`}
&:disabled {
background-color: ${theme.colors.button.disabled.bgColor} !important;
@@ -193,6 +196,7 @@ export interface IconButtonComponentProps extends ComponentProps {
boxShadowColor: string;
isDisabled: boolean;
isVisible: boolean;
+ hasOnClickAction: boolean;
onClick: () => void;
height: number;
width: number;
@@ -205,6 +209,7 @@ function IconButtonComponent(props: IconButtonComponentProps) {
boxShadowColor,
buttonStyle,
buttonVariant,
+ hasOnClickAction,
height,
isDisabled,
onClick,
@@ -234,6 +239,7 @@ function IconButtonComponent(props: IconButtonComponentProps) {
buttonVariant={buttonVariant}
dimension={dimension}
disabled={isDisabled}
+ hasOnClickAction={hasOnClickAction}
icon={props.iconName}
large
onClick={onClick}
diff --git a/app/client/src/constants/HelpConstants.ts b/app/client/src/constants/HelpConstants.ts
index 94011ebf8518..1d04943cc7e9 100644
--- a/app/client/src/constants/HelpConstants.ts
+++ b/app/client/src/constants/HelpConstants.ts
@@ -143,6 +143,10 @@ export const HelpMap = {
path: "/widget-reference/icon-button",
searchKey: "Icon Button",
},
+ STATBOX_WIDGET: {
+ path: "/widget-reference/statbox",
+ searchKey: "Stat Box",
+ },
CHECKBOX_GROUP_WIDGET: {
path: "/widget-reference/checkbox-group",
searchKey: "Checkbox Group",
diff --git a/app/client/src/constants/WidgetConstants.tsx b/app/client/src/constants/WidgetConstants.tsx
index 3c36023ee774..d188da4853e5 100644
--- a/app/client/src/constants/WidgetConstants.tsx
+++ b/app/client/src/constants/WidgetConstants.tsx
@@ -32,6 +32,7 @@ export enum WidgetTypes {
RATE_WIDGET = "RATE_WIDGET",
IFRAME_WIDGET = "IFRAME_WIDGET",
DIVIDER_WIDGET = "DIVIDER_WIDGET",
+ STATBOX_WIDGET = "STATBOX_WIDGET",
MENU_BUTTON_WIDGET = "MENU_BUTTON_WIDGET",
ICON_BUTTON_WIDGET = "ICON_BUTTON_WIDGET",
CHECKBOX_GROUP_WIDGET = "CHECKBOX_GROUP_WIDGET",
@@ -120,6 +121,7 @@ export const DroppableWidgets: WidgetType[] = [
WidgetTypes.FORM_WIDGET,
WidgetTypes.LIST_WIDGET,
WidgetTypes.TABS_WIDGET,
+ WidgetTypes.STATBOX_WIDGET,
WidgetTypes.MODAL_WIDGET,
];
diff --git a/app/client/src/icons/WidgetIcons.tsx b/app/client/src/icons/WidgetIcons.tsx
index 3db9aa22ca26..95d088a68015 100644
--- a/app/client/src/icons/WidgetIcons.tsx
+++ b/app/client/src/icons/WidgetIcons.tsx
@@ -28,6 +28,7 @@ import { ReactComponent as EmbedIcon } from "assets/icons/widget/embed.svg";
import { ReactComponent as DividerIcon } from "assets/icons/widget/divider.svg";
import { ReactComponent as MenuButtonIcon } from "assets/icons/widget/menu-button.svg";
import { ReactComponent as IconButtonIcon } from "assets/icons/widget/icon-button.svg";
+import { ReactComponent as StatboxIcon } from "assets/icons/widget/statbox.svg";
import { ReactComponent as CheckboxGroupIcon } from "assets/icons/widget/checkbox-group.svg";
/* eslint-disable react/display-name */
@@ -180,6 +181,11 @@ export const WidgetIcons: {
<IconButtonIcon />
</IconWrapper>
),
+ STATBOX_WIDGET: (props: IconProps) => (
+ <IconWrapper {...props}>
+ <StatboxIcon />
+ </IconWrapper>
+ ),
CHECKBOX_GROUP_WIDGET: (props: IconProps) => (
<IconWrapper {...props}>
<CheckboxGroupIcon />
diff --git a/app/client/src/mockResponses/WidgetConfigResponse.tsx b/app/client/src/mockResponses/WidgetConfigResponse.tsx
index b4ce3fa978e7..ed434f824ada 100644
--- a/app/client/src/mockResponses/WidgetConfigResponse.tsx
+++ b/app/client/src/mockResponses/WidgetConfigResponse.tsx
@@ -1306,6 +1306,97 @@ const WidgetConfigResponse: WidgetConfigReducerState = {
widgetName: "IconButton",
version: 1,
},
+ [WidgetTypes.STATBOX_WIDGET]: {
+ rows: 3.5 * GRID_DENSITY_MIGRATION_V1,
+ columns: 4 * GRID_DENSITY_MIGRATION_V1,
+ widgetName: "Statbox",
+ backgroundColor: "white",
+ children: [],
+ blueprint: {
+ view: [
+ {
+ type: "CANVAS_WIDGET",
+ position: { top: 0, left: 0 },
+ props: {
+ containerStyle: "none",
+ canExtend: false,
+ detachFromLayout: true,
+ children: [],
+ version: 1,
+ blueprint: {
+ view: [
+ {
+ type: "TEXT_WIDGET",
+ size: {
+ rows: 1 * GRID_DENSITY_MIGRATION_V1,
+ cols: 9 * GRID_DENSITY_MIGRATION_V1,
+ },
+ position: { top: 0, left: 1 },
+ props: {
+ text: "Page Views",
+ fontSize: "PARAGRAPH2",
+ textColor: "#999999",
+ version: 1,
+ },
+ },
+ {
+ type: "TEXT_WIDGET",
+ size: {
+ rows: 1 * GRID_DENSITY_MIGRATION_V1,
+ cols: 9 * GRID_DENSITY_MIGRATION_V1,
+ },
+ position: {
+ top: 1 * GRID_DENSITY_MIGRATION_V1,
+ left: 1,
+ },
+ props: {
+ text: "2.6 M",
+ fontSize: "HEADING1",
+ fontStyle: "BOLD",
+ version: 1,
+ },
+ },
+ {
+ type: "TEXT_WIDGET",
+ size: {
+ rows: 1 * GRID_DENSITY_MIGRATION_V1,
+ cols: 9 * GRID_DENSITY_MIGRATION_V1,
+ },
+ position: {
+ top: 2 * GRID_DENSITY_MIGRATION_V1,
+ left: 1,
+ },
+ props: {
+ text: "21% more than last month",
+ fontSize: "PARAGRAPH2",
+ textColor: Colors.GREEN,
+ version: 1,
+ },
+ },
+ {
+ type: "ICON_BUTTON_WIDGET",
+ size: {
+ rows: 2 * GRID_DENSITY_MIGRATION_V1,
+ cols: 4 * GRID_DENSITY_MIGRATION_V1,
+ },
+ position: {
+ top: 2,
+ left: 11.5 * GRID_DENSITY_MIGRATION_V1,
+ },
+ props: {
+ iconName: "arrow-top-right",
+ buttonStyle: "PRIMARY",
+ buttonVariant: "SOLID",
+ version: 1,
+ },
+ },
+ ],
+ },
+ },
+ },
+ ],
+ },
+ },
[WidgetTypes.CHECKBOX_GROUP_WIDGET]: {
rows: 2 * GRID_DENSITY_MIGRATION_V1,
columns: 1.5 * GRID_DENSITY_MIGRATION_V1,
diff --git a/app/client/src/mockResponses/WidgetSidebarResponse.tsx b/app/client/src/mockResponses/WidgetSidebarResponse.tsx
index adf7a1eca3bf..d0210f8e6c66 100644
--- a/app/client/src/mockResponses/WidgetSidebarResponse.tsx
+++ b/app/client/src/mockResponses/WidgetSidebarResponse.tsx
@@ -134,6 +134,11 @@ const WidgetSidebarResponse: WidgetCardProps[] = [
widgetCardName: "Icon Button",
key: generateReactKey(),
},
+ {
+ type: "STATBOX_WIDGET",
+ widgetCardName: "Stat Box",
+ key: generateReactKey(),
+ },
{
type: "CHECKBOX_GROUP_WIDGET",
widgetCardName: "Checkbox Group",
diff --git a/app/client/src/reducers/entityReducers/widgetConfigReducer.tsx b/app/client/src/reducers/entityReducers/widgetConfigReducer.tsx
index 5359f2d6655d..34cbe44ff48a 100644
--- a/app/client/src/reducers/entityReducers/widgetConfigReducer.tsx
+++ b/app/client/src/reducers/entityReducers/widgetConfigReducer.tsx
@@ -37,6 +37,7 @@ import { RateWidgetProps } from "widgets/RateWidget";
import { IframeWidgetProps } from "widgets/IframeWidget";
import { MenuButtonWidgetProps } from "widgets/MenuButtonWidget";
import { IconButtonWidgetProps } from "widgets/IconButtonWidget";
+import { StatboxWidgetProps } from "widgets/StatboxWidget";
import { CheckboxGroupWidgetProps } from "widgets/CheckboxGroupWidget";
const initialState: WidgetConfigReducerState = WidgetConfigResponse;
@@ -98,6 +99,7 @@ export interface WidgetConfigReducerState {
IFRAME_WIDGET: Partial<IframeWidgetProps> & WidgetConfigProps;
MENU_BUTTON_WIDGET: Partial<MenuButtonWidgetProps> & WidgetConfigProps;
ICON_BUTTON_WIDGET: Partial<IconButtonWidgetProps> & WidgetConfigProps;
+ STATBOX_WIDGET: Partial<StatboxWidgetProps> & WidgetConfigProps;
CHECKBOX_GROUP_WIDGET: Partial<CheckboxGroupWidgetProps> &
WidgetConfigProps;
};
diff --git a/app/client/src/utils/WidgetRegistry.tsx b/app/client/src/utils/WidgetRegistry.tsx
index 4d7c58ba5c27..e831c2854cfd 100644
--- a/app/client/src/utils/WidgetRegistry.tsx
+++ b/app/client/src/utils/WidgetRegistry.tsx
@@ -132,6 +132,7 @@ import IconButtonWidget, {
IconButtonWidgetProps,
ProfiledIconButtonWidget,
} from "widgets/IconButtonWidget";
+import StatboxWidget, { ProfiledStatboxWidget } from "widgets/StatboxWidget";
import CheckboxGroupWidget, {
CheckboxGroupWidgetProps,
ProfiledCheckboxGroupWidget,
@@ -579,6 +580,21 @@ export default class WidgetBuilderRegistry {
IconButtonWidget.getPropertyPaneConfig(),
);
+ WidgetFactory.registerWidgetBuilder(
+ WidgetTypes.STATBOX_WIDGET,
+ {
+ buildWidget(
+ widgetProps: ContainerWidgetProps<WidgetProps>,
+ ): JSX.Element {
+ return <ProfiledStatboxWidget {...widgetProps} />;
+ },
+ },
+ StatboxWidget.getDerivedPropertiesMap(),
+ StatboxWidget.getDefaultPropertiesMap(),
+ StatboxWidget.getMetaPropertiesMap(),
+ StatboxWidget.getPropertyPaneConfig(),
+ );
+
WidgetFactory.registerWidgetBuilder(
WidgetTypes.CHECKBOX_GROUP_WIDGET,
{
diff --git a/app/client/src/utils/autocomplete/EntityDefinitions.ts b/app/client/src/utils/autocomplete/EntityDefinitions.ts
index 6a2ee1fa4147..890b41a7228f 100644
--- a/app/client/src/utils/autocomplete/EntityDefinitions.ts
+++ b/app/client/src/utils/autocomplete/EntityDefinitions.ts
@@ -329,6 +329,11 @@ export const entityDefinitions = {
options: "[dropdownOption]",
selectedValues: "[string]",
},
+ STATBOX_WIDGET: {
+ "!doc": "Show and highlight stats from your data sources",
+ "!url": "https://docs.appsmith.com/widget-reference/stat-box",
+ isVisible: isVisible,
+ },
};
export const GLOBAL_DEFS = {
diff --git a/app/client/src/widgets/IconButtonWidget.tsx b/app/client/src/widgets/IconButtonWidget.tsx
index 7d0224b372d3..d3d74e474084 100644
--- a/app/client/src/widgets/IconButtonWidget.tsx
+++ b/app/client/src/widgets/IconButtonWidget.tsx
@@ -205,6 +205,7 @@ class IconButtonWidget extends BaseWidget<IconButtonWidgetProps, WidgetState> {
boxShadowColor={boxShadowColor}
buttonStyle={buttonStyle}
buttonVariant={buttonVariant}
+ hasOnClickAction={!!this.props.onClick}
height={
(this.props.bottomRow - this.props.topRow) * this.props.parentRowSpace
}
diff --git a/app/client/src/widgets/StatboxWidget.tsx b/app/client/src/widgets/StatboxWidget.tsx
new file mode 100644
index 000000000000..7443613b7bb7
--- /dev/null
+++ b/app/client/src/widgets/StatboxWidget.tsx
@@ -0,0 +1,71 @@
+import { WidgetType } from "constants/WidgetConstants";
+import { WidgetProps } from "./BaseWidget";
+import ContainerWidget from "widgets/ContainerWidget";
+import { ContainerComponentProps } from "components/designSystems/appsmith/ContainerComponent";
+import * as Sentry from "@sentry/react";
+import withMeta from "./MetaHOC";
+import { ValidationTypes } from "constants/WidgetValidation";
+
+class StatboxWidget extends ContainerWidget {
+ static getPropertyPaneConfig() {
+ return [
+ {
+ sectionName: "General",
+ children: [
+ {
+ propertyName: "backgroundColor",
+ label: "Background Color",
+ helpText: "Use a html color name, HEX, RGB or RGBA value",
+ placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
+ controlType: "COLOR_PICKER",
+ isBindProperty: true,
+ isJSConvertible: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.TEXT },
+ },
+ {
+ helpText: "Controls the visibility of the widget",
+ propertyName: "isVisible",
+ label: "Visible",
+ controlType: "SWITCH",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.BOOLEAN },
+ },
+ {
+ propertyName: "shouldScrollContents",
+ label: "Scroll Contents",
+ controlType: "SWITCH",
+ isBindProperty: false,
+ isTriggerProperty: false,
+ },
+ ],
+ },
+ ];
+ }
+
+ renderChildWidget(childWidgetData: WidgetProps): React.ReactNode {
+ if (childWidgetData.children) {
+ childWidgetData.children.forEach((grandChild: WidgetProps) => {
+ if (grandChild.type === "ICON_BUTTON_WIDGET" && !!grandChild.onClick) {
+ grandChild.boxShadow = "VARIANT1";
+ }
+ });
+ }
+ return super.renderChildWidget(childWidgetData);
+ }
+
+ getWidgetType(): WidgetType {
+ return "STATBOX_WIDGET";
+ }
+}
+
+export interface StatboxWidgetProps extends ContainerComponentProps {
+ backgroundColor: string;
+}
+
+export default StatboxWidget;
+export const ProfiledStatboxWidget = Sentry.withProfiler(
+ withMeta(StatboxWidget),
+);
|
99e1b445263a8e603601de5e1666e13c46d5316a
|
2023-08-23 11:43:26
|
Pawan Kumar
|
chore: Move stories to component level (#26489)
| false
|
Move stories to component level (#26489)
|
chore
|
diff --git a/app/client/package.json b/app/client/package.json
index b41e9a0af70e..da08cf23181b 100644
--- a/app/client/package.json
+++ b/app/client/package.json
@@ -50,6 +50,7 @@
"@blueprintjs/icons": "3.22.0",
"@blueprintjs/popover2": "^0.5.0",
"@blueprintjs/select": "^3.10.0",
+ "@design-system/storybook": "workspace:^",
"@design-system/theming": "workspace:^",
"@design-system/widgets": "workspace:^",
"@design-system/widgets-old": "workspace:^",
diff --git a/app/client/packages/design-system/headless/src/components/Button/index.ts b/app/client/packages/design-system/headless/src/components/Button/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/headless/src/components/Button/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/headless/src/components/Button/Button.tsx b/app/client/packages/design-system/headless/src/components/Button/src/Button.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Button/Button.tsx
rename to app/client/packages/design-system/headless/src/components/Button/src/Button.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Button/index.tsx b/app/client/packages/design-system/headless/src/components/Button/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Button/index.tsx
rename to app/client/packages/design-system/headless/src/components/Button/src/index.ts
diff --git a/app/client/packages/storybook/stories/design-system/headless/Button.stories.mdx b/app/client/packages/design-system/headless/src/components/Button/stories/Button.stories.mdx
similarity index 99%
rename from app/client/packages/storybook/stories/design-system/headless/Button.stories.mdx
rename to app/client/packages/design-system/headless/src/components/Button/stories/Button.stories.mdx
index 96696daaad03..e144e016156b 100644
--- a/app/client/packages/storybook/stories/design-system/headless/Button.stories.mdx
+++ b/app/client/packages/design-system/headless/src/components/Button/stories/Button.stories.mdx
@@ -1,6 +1,5 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
-
import { Button } from "@design-system/headless";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/Headless/Button"
diff --git a/app/client/packages/design-system/headless/src/components/Checkbox/index.ts b/app/client/packages/design-system/headless/src/components/Checkbox/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/headless/src/components/Checkbox/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/headless/src/components/Checkbox/Checkbox.tsx b/app/client/packages/design-system/headless/src/components/Checkbox/src/Checkbox.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Checkbox/Checkbox.tsx
rename to app/client/packages/design-system/headless/src/components/Checkbox/src/Checkbox.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Checkbox/CheckboxGroup.tsx b/app/client/packages/design-system/headless/src/components/Checkbox/src/CheckboxGroup.tsx
similarity index 94%
rename from app/client/packages/design-system/headless/src/components/Checkbox/CheckboxGroup.tsx
rename to app/client/packages/design-system/headless/src/components/Checkbox/src/CheckboxGroup.tsx
index 1425b9243556..c5a3863780eb 100644
--- a/app/client/packages/design-system/headless/src/components/Checkbox/CheckboxGroup.tsx
+++ b/app/client/packages/design-system/headless/src/components/Checkbox/src/CheckboxGroup.tsx
@@ -6,9 +6,9 @@ import { useCheckboxGroup } from "@react-aria/checkbox";
import { useCheckboxGroupState } from "@react-stately/checkbox";
import type { SpectrumCheckboxGroupProps } from "@react-types/checkbox";
-import { Field } from "../Field";
-import type { LabelProps } from "../Field";
+import { Field } from "@design-system/headless";
import { CheckboxGroupContext } from "./context";
+import type { LabelProps } from "@design-system/headless";
export type CheckboxGroupRef = DOMRef<HTMLDivElement>;
export interface CheckboxGroupProps
diff --git a/app/client/packages/design-system/headless/src/components/Checkbox/context.ts b/app/client/packages/design-system/headless/src/components/Checkbox/src/context.ts
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Checkbox/context.ts
rename to app/client/packages/design-system/headless/src/components/Checkbox/src/context.ts
diff --git a/app/client/packages/design-system/headless/src/components/Checkbox/icons/CheckIcon.tsx b/app/client/packages/design-system/headless/src/components/Checkbox/src/icons/CheckIcon.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Checkbox/icons/CheckIcon.tsx
rename to app/client/packages/design-system/headless/src/components/Checkbox/src/icons/CheckIcon.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Checkbox/icons/SubtractIcon.tsx b/app/client/packages/design-system/headless/src/components/Checkbox/src/icons/SubtractIcon.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Checkbox/icons/SubtractIcon.tsx
rename to app/client/packages/design-system/headless/src/components/Checkbox/src/icons/SubtractIcon.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Checkbox/index.tsx b/app/client/packages/design-system/headless/src/components/Checkbox/src/index.ts
similarity index 69%
rename from app/client/packages/design-system/headless/src/components/Checkbox/index.tsx
rename to app/client/packages/design-system/headless/src/components/Checkbox/src/index.ts
index 3335b95eafdd..8f28dd176d47 100644
--- a/app/client/packages/design-system/headless/src/components/Checkbox/index.tsx
+++ b/app/client/packages/design-system/headless/src/components/Checkbox/src/index.ts
@@ -1,4 +1,6 @@
export { Checkbox } from "./Checkbox";
export { CheckboxGroup } from "./CheckboxGroup";
+export { CheckboxGroupContext } from "./context";
+export type { CheckboxGroupContextType } from "./context";
export type { CheckboxProps, CheckboxRef, InlineLabelProps } from "./Checkbox";
export type { CheckboxGroupProps, CheckboxGroupRef } from "./CheckboxGroup";
diff --git a/app/client/packages/storybook/stories/design-system/headless/CheckboxGroup.stories.mdx b/app/client/packages/design-system/headless/src/components/Checkbox/stories/CheckboxGroup.stories.mdx
similarity index 99%
rename from app/client/packages/storybook/stories/design-system/headless/CheckboxGroup.stories.mdx
rename to app/client/packages/design-system/headless/src/components/Checkbox/stories/CheckboxGroup.stories.mdx
index 875b874268fd..0a3168bbcc5b 100644
--- a/app/client/packages/storybook/stories/design-system/headless/CheckboxGroup.stories.mdx
+++ b/app/client/packages/design-system/headless/src/components/Checkbox/stories/CheckboxGroup.stories.mdx
@@ -1,6 +1,5 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
-
import { CheckboxGroup, Checkbox } from "@design-system/headless";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/Headless/CheckboxGroup"
diff --git a/app/client/packages/design-system/headless/src/components/Field/index.ts b/app/client/packages/design-system/headless/src/components/Field/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/headless/src/components/Field/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/headless/src/components/Field/ErrorText.tsx b/app/client/packages/design-system/headless/src/components/Field/src/ErrorText.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Field/ErrorText.tsx
rename to app/client/packages/design-system/headless/src/components/Field/src/ErrorText.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Field/Field.tsx b/app/client/packages/design-system/headless/src/components/Field/src/Field.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Field/Field.tsx
rename to app/client/packages/design-system/headless/src/components/Field/src/Field.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Field/Label.tsx b/app/client/packages/design-system/headless/src/components/Field/src/Label.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Field/Label.tsx
rename to app/client/packages/design-system/headless/src/components/Field/src/Label.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Field/icons/AlertIcon.tsx b/app/client/packages/design-system/headless/src/components/Field/src/icons/AlertIcon.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Field/icons/AlertIcon.tsx
rename to app/client/packages/design-system/headless/src/components/Field/src/icons/AlertIcon.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Field/icons/AsteriskIcon.tsx b/app/client/packages/design-system/headless/src/components/Field/src/icons/AsteriskIcon.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Field/icons/AsteriskIcon.tsx
rename to app/client/packages/design-system/headless/src/components/Field/src/icons/AsteriskIcon.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Field/index.tsx b/app/client/packages/design-system/headless/src/components/Field/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Field/index.tsx
rename to app/client/packages/design-system/headless/src/components/Field/src/index.ts
diff --git a/app/client/packages/design-system/headless/src/components/Icon/index.ts b/app/client/packages/design-system/headless/src/components/Icon/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/headless/src/components/Icon/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/headless/src/components/Icon/Icon.tsx b/app/client/packages/design-system/headless/src/components/Icon/src/Icon.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Icon/Icon.tsx
rename to app/client/packages/design-system/headless/src/components/Icon/src/Icon.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Icon/index.tsx b/app/client/packages/design-system/headless/src/components/Icon/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Icon/index.tsx
rename to app/client/packages/design-system/headless/src/components/Icon/src/index.ts
diff --git a/app/client/packages/design-system/headless/src/components/Radio/index.ts b/app/client/packages/design-system/headless/src/components/Radio/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/headless/src/components/Radio/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/headless/src/components/Radio/Radio.tsx b/app/client/packages/design-system/headless/src/components/Radio/src/Radio.tsx
similarity index 97%
rename from app/client/packages/design-system/headless/src/components/Radio/Radio.tsx
rename to app/client/packages/design-system/headless/src/components/Radio/src/Radio.tsx
index b69f4708f96b..cdf2a95fafa4 100644
--- a/app/client/packages/design-system/headless/src/components/Radio/Radio.tsx
+++ b/app/client/packages/design-system/headless/src/components/Radio/src/Radio.tsx
@@ -10,7 +10,7 @@ import type { FocusableRef, StyleProps } from "@react-types/shared";
import { RadioContext } from "./context";
import type { RadioGroupContext } from "./context";
-import type { InlineLabelProps } from "../Checkbox";
+import type { InlineLabelProps } from "../../Checkbox";
export interface RadioProps
extends Omit<SpectrumRadioProps, keyof StyleProps>,
diff --git a/app/client/packages/design-system/headless/src/components/Radio/RadioGroup.tsx b/app/client/packages/design-system/headless/src/components/Radio/src/RadioGroup.tsx
similarity index 93%
rename from app/client/packages/design-system/headless/src/components/Radio/RadioGroup.tsx
rename to app/client/packages/design-system/headless/src/components/Radio/src/RadioGroup.tsx
index 3c3d827d2b57..ef0c6c0e167f 100644
--- a/app/client/packages/design-system/headless/src/components/Radio/RadioGroup.tsx
+++ b/app/client/packages/design-system/headless/src/components/Radio/src/RadioGroup.tsx
@@ -6,9 +6,9 @@ import type { StyleProps } from "@react-types/shared";
import { useRadioGroupState } from "@react-stately/radio";
import type { SpectrumRadioGroupProps } from "@react-types/radio";
-import { Field } from "../Field";
import { RadioContext } from "./context";
-import type { LabelProps } from "../Field";
+import { Field } from "@design-system/headless";
+import type { LabelProps } from "@design-system/headless";
export type RadioGroupRef = DOMRef<HTMLDivElement>;
export interface RadioGroupProps
diff --git a/app/client/packages/design-system/headless/src/components/Radio/context.ts b/app/client/packages/design-system/headless/src/components/Radio/src/context.ts
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Radio/context.ts
rename to app/client/packages/design-system/headless/src/components/Radio/src/context.ts
diff --git a/app/client/packages/design-system/headless/src/components/Radio/index.tsx b/app/client/packages/design-system/headless/src/components/Radio/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Radio/index.tsx
rename to app/client/packages/design-system/headless/src/components/Radio/src/index.ts
diff --git a/app/client/packages/storybook/stories/design-system/headless/RadioGroup.stories.mdx b/app/client/packages/design-system/headless/src/components/Radio/stories/RadioGroup.stories.mdx
similarity index 99%
rename from app/client/packages/storybook/stories/design-system/headless/RadioGroup.stories.mdx
rename to app/client/packages/design-system/headless/src/components/Radio/stories/RadioGroup.stories.mdx
index e5fe0c6cc5c9..904a43d8a3bb 100644
--- a/app/client/packages/storybook/stories/design-system/headless/RadioGroup.stories.mdx
+++ b/app/client/packages/design-system/headless/src/components/Radio/stories/RadioGroup.stories.mdx
@@ -1,6 +1,5 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
-
import { RadioGroup, Radio } from "@design-system/headless";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/Headless/RadioGroup"
diff --git a/app/client/packages/design-system/headless/src/components/Switch/Switch.tsx b/app/client/packages/design-system/headless/src/components/Switch/Switch.tsx
index 94ddba0960e3..857fe7785c1a 100644
--- a/app/client/packages/design-system/headless/src/components/Switch/Switch.tsx
+++ b/app/client/packages/design-system/headless/src/components/Switch/Switch.tsx
@@ -10,9 +10,9 @@ import { useVisuallyHidden } from "@react-aria/visually-hidden";
import type { SpectrumSwitchProps } from "@react-types/switch";
import type { FocusableRef, StyleProps, Validation } from "@react-types/shared";
+import { CheckboxGroupContext } from "../Checkbox";
import type { InlineLabelProps } from "../Checkbox";
-import { CheckboxGroupContext } from "../Checkbox/context";
-import type { CheckboxGroupContextType } from "../Checkbox/context";
+import type { CheckboxGroupContextType } from "../Checkbox";
export interface SwitchProps
extends Omit<SpectrumSwitchProps, keyof StyleProps>,
diff --git a/app/client/packages/design-system/headless/src/components/Switch/index.tsx b/app/client/packages/design-system/headless/src/components/Switch/index.tsx
index b1fbed9cb216..1cae8b5e65be 100644
--- a/app/client/packages/design-system/headless/src/components/Switch/index.tsx
+++ b/app/client/packages/design-system/headless/src/components/Switch/index.tsx
@@ -2,6 +2,6 @@ export { Switch } from "./Switch";
export type {
CheckboxGroupProps as SwitchGroupProps,
CheckboxGroupRef as SwitchGroupRef,
-} from "../Checkbox/CheckboxGroup";
+} from "../Checkbox";
export type { SwitchProps, SwitchRef } from "./Switch";
-export { CheckboxGroup as SwitchGroup } from "../Checkbox/CheckboxGroup";
+export { CheckboxGroup as SwitchGroup } from "../Checkbox";
diff --git a/app/client/packages/design-system/headless/src/components/Tooltip/index.ts b/app/client/packages/design-system/headless/src/components/Tooltip/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/headless/src/components/Tooltip/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/headless/src/components/Tooltip/TooltipContent.tsx b/app/client/packages/design-system/headless/src/components/Tooltip/src/TooltipContent.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Tooltip/TooltipContent.tsx
rename to app/client/packages/design-system/headless/src/components/Tooltip/src/TooltipContent.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Tooltip/TooltipContext.tsx b/app/client/packages/design-system/headless/src/components/Tooltip/src/TooltipContext.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Tooltip/TooltipContext.tsx
rename to app/client/packages/design-system/headless/src/components/Tooltip/src/TooltipContext.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Tooltip/TooltipRoot.tsx b/app/client/packages/design-system/headless/src/components/Tooltip/src/TooltipRoot.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Tooltip/TooltipRoot.tsx
rename to app/client/packages/design-system/headless/src/components/Tooltip/src/TooltipRoot.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Tooltip/TooltipTrigger.tsx b/app/client/packages/design-system/headless/src/components/Tooltip/src/TooltipTrigger.tsx
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Tooltip/TooltipTrigger.tsx
rename to app/client/packages/design-system/headless/src/components/Tooltip/src/TooltipTrigger.tsx
diff --git a/app/client/packages/design-system/headless/src/components/Tooltip/index.tsx b/app/client/packages/design-system/headless/src/components/Tooltip/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Tooltip/index.tsx
rename to app/client/packages/design-system/headless/src/components/Tooltip/src/index.ts
diff --git a/app/client/packages/design-system/headless/src/components/Tooltip/useTooltip.ts b/app/client/packages/design-system/headless/src/components/Tooltip/src/useTooltip.ts
similarity index 100%
rename from app/client/packages/design-system/headless/src/components/Tooltip/useTooltip.ts
rename to app/client/packages/design-system/headless/src/components/Tooltip/src/useTooltip.ts
diff --git a/app/client/packages/storybook/stories/design-system/headless/Tooltip.stories.mdx b/app/client/packages/design-system/headless/src/components/Tooltip/stories/Tooltip.stories.mdx
similarity index 99%
rename from app/client/packages/storybook/stories/design-system/headless/Tooltip.stories.mdx
rename to app/client/packages/design-system/headless/src/components/Tooltip/stories/Tooltip.stories.mdx
index 189fcee73684..92fe4d2fcaa3 100644
--- a/app/client/packages/storybook/stories/design-system/headless/Tooltip.stories.mdx
+++ b/app/client/packages/design-system/headless/src/components/Tooltip/stories/Tooltip.stories.mdx
@@ -1,11 +1,10 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
-
import {
TooltipRoot,
TooltipTrigger,
TooltipContent,
Button,
} from "@design-system/headless";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/Headless/Tooltip"
diff --git a/app/client/packages/design-system/theming/src/color/index.ts b/app/client/packages/design-system/theming/src/color/index.ts
index ace4940b8fde..3bd16e178a03 100644
--- a/app/client/packages/design-system/theming/src/color/index.ts
+++ b/app/client/packages/design-system/theming/src/color/index.ts
@@ -1,4 +1 @@
-export * from "./ColorsAccessor";
-export * from "./DarkModeTheme";
-export * from "./LightModeTheme";
-export * from "./types";
+export * from "./src";
diff --git a/app/client/packages/design-system/theming/src/color/ColorsAccessor.ts b/app/client/packages/design-system/theming/src/color/src/ColorsAccessor.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/color/ColorsAccessor.ts
rename to app/client/packages/design-system/theming/src/color/src/ColorsAccessor.ts
diff --git a/app/client/packages/design-system/theming/src/color/DarkModeTheme.ts b/app/client/packages/design-system/theming/src/color/src/DarkModeTheme.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/color/DarkModeTheme.ts
rename to app/client/packages/design-system/theming/src/color/src/DarkModeTheme.ts
diff --git a/app/client/packages/design-system/theming/src/color/LightModeTheme.ts b/app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/color/LightModeTheme.ts
rename to app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts
diff --git a/app/client/packages/design-system/theming/src/color/src/index.ts b/app/client/packages/design-system/theming/src/color/src/index.ts
new file mode 100644
index 000000000000..ace4940b8fde
--- /dev/null
+++ b/app/client/packages/design-system/theming/src/color/src/index.ts
@@ -0,0 +1,4 @@
+export * from "./ColorsAccessor";
+export * from "./DarkModeTheme";
+export * from "./LightModeTheme";
+export * from "./types";
diff --git a/app/client/packages/design-system/theming/src/color/types.ts b/app/client/packages/design-system/theming/src/color/src/types.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/color/types.ts
rename to app/client/packages/design-system/theming/src/color/src/types.ts
diff --git a/app/client/packages/design-system/theming/src/color/DarkModeTheme.test.ts b/app/client/packages/design-system/theming/src/color/tests/DarkModeTheme.test.ts
similarity index 97%
rename from app/client/packages/design-system/theming/src/color/DarkModeTheme.test.ts
rename to app/client/packages/design-system/theming/src/color/tests/DarkModeTheme.test.ts
index e068448bfa37..e5e1808a7b17 100644
--- a/app/client/packages/design-system/theming/src/color/DarkModeTheme.test.ts
+++ b/app/client/packages/design-system/theming/src/color/tests/DarkModeTheme.test.ts
@@ -1,4 +1,4 @@
-import { DarkModeTheme } from "./DarkModeTheme";
+import { DarkModeTheme } from "../src/DarkModeTheme";
describe("@design-system/theming/color/DarkModeTheme", () => {
it("checks bg color", () => {
diff --git a/app/client/packages/design-system/theming/src/color/LightModeTheme.test.ts b/app/client/packages/design-system/theming/src/color/tests/LightModeTheme.test.ts
similarity index 98%
rename from app/client/packages/design-system/theming/src/color/LightModeTheme.test.ts
rename to app/client/packages/design-system/theming/src/color/tests/LightModeTheme.test.ts
index f4ec50d59af3..5f6f813c0bce 100644
--- a/app/client/packages/design-system/theming/src/color/LightModeTheme.test.ts
+++ b/app/client/packages/design-system/theming/src/color/tests/LightModeTheme.test.ts
@@ -1,4 +1,4 @@
-import { LightModeTheme } from "./LightModeTheme";
+import { LightModeTheme } from "../src/LightModeTheme";
describe("@design-system/theming/color/LightModeTheme", () => {
it("checks bg color", () => {
diff --git a/app/client/packages/design-system/theming/src/theme/index.ts b/app/client/packages/design-system/theming/src/theme/index.ts
index 594fd2680864..3bd16e178a03 100644
--- a/app/client/packages/design-system/theming/src/theme/index.ts
+++ b/app/client/packages/design-system/theming/src/theme/index.ts
@@ -1,4 +1 @@
-export * from "./ThemeContext";
-export * from "./ThemeProvider";
-export * from "./types";
-export * from "./useTheme";
+export * from "./src";
diff --git a/app/client/packages/design-system/theming/src/theme/ThemeContext.tsx b/app/client/packages/design-system/theming/src/theme/src/ThemeContext.tsx
similarity index 100%
rename from app/client/packages/design-system/theming/src/theme/ThemeContext.tsx
rename to app/client/packages/design-system/theming/src/theme/src/ThemeContext.tsx
diff --git a/app/client/packages/design-system/theming/src/theme/ThemeProvider.tsx b/app/client/packages/design-system/theming/src/theme/src/ThemeProvider.tsx
similarity index 93%
rename from app/client/packages/design-system/theming/src/theme/ThemeProvider.tsx
rename to app/client/packages/design-system/theming/src/theme/src/ThemeProvider.tsx
index 04cbddcd4f48..4c28d80651b2 100644
--- a/app/client/packages/design-system/theming/src/theme/ThemeProvider.tsx
+++ b/app/client/packages/design-system/theming/src/theme/src/ThemeProvider.tsx
@@ -1,9 +1,10 @@
import React from "react";
-import { createGlobalFontStack } from "../typography";
-import { StyledProvider } from "./index.styled";
-import { ThemeContext } from "./ThemeContext";
import { createGlobalStyle } from "styled-components";
+import { ThemeContext } from "./ThemeContext";
+import { StyledProvider } from "./index.styled";
+import { createGlobalFontStack } from "../../typography";
+
import type { ThemeProviderProps } from "./types";
const { fontFaces } = createGlobalFontStack();
diff --git a/app/client/packages/design-system/theming/src/theme/index.styled.tsx b/app/client/packages/design-system/theming/src/theme/src/index.styled.tsx
similarity index 100%
rename from app/client/packages/design-system/theming/src/theme/index.styled.tsx
rename to app/client/packages/design-system/theming/src/theme/src/index.styled.tsx
diff --git a/app/client/packages/design-system/theming/src/theme/src/index.ts b/app/client/packages/design-system/theming/src/theme/src/index.ts
new file mode 100644
index 000000000000..594fd2680864
--- /dev/null
+++ b/app/client/packages/design-system/theming/src/theme/src/index.ts
@@ -0,0 +1,4 @@
+export * from "./ThemeContext";
+export * from "./ThemeProvider";
+export * from "./types";
+export * from "./useTheme";
diff --git a/app/client/packages/design-system/theming/src/theme/types.ts b/app/client/packages/design-system/theming/src/theme/src/types.ts
similarity index 75%
rename from app/client/packages/design-system/theming/src/theme/types.ts
rename to app/client/packages/design-system/theming/src/theme/src/types.ts
index ebe53004f2bd..6638024b79be 100644
--- a/app/client/packages/design-system/theming/src/theme/types.ts
+++ b/app/client/packages/design-system/theming/src/theme/src/types.ts
@@ -1,8 +1,8 @@
import type { ReactNode } from "react";
-import type { ColorMode } from "../color";
-import type { FontFamily } from "../typography";
-import type { RootUnit, ThemeToken } from "../token";
+import type { ColorMode } from "../../color";
+import type { FontFamily } from "../../typography";
+import type { RootUnit, ThemeToken } from "../../token";
export type Theme = ThemeToken & {
typography?: string;
diff --git a/app/client/packages/design-system/theming/src/theme/useTheme.tsx b/app/client/packages/design-system/theming/src/theme/src/useTheme.tsx
similarity index 100%
rename from app/client/packages/design-system/theming/src/theme/useTheme.tsx
rename to app/client/packages/design-system/theming/src/theme/src/useTheme.tsx
diff --git a/app/client/packages/storybook/stories/design-system/theming/BorderRadius.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/BorderRadius.stories.mdx
similarity index 92%
rename from app/client/packages/storybook/stories/design-system/theming/BorderRadius.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/BorderRadius.stories.mdx
index 42fa5f18c1e5..14f83d5fc4f7 100644
--- a/app/client/packages/storybook/stories/design-system/theming/BorderRadius.stories.mdx
+++ b/app/client/packages/design-system/theming/src/theme/stories/BorderRadius.stories.mdx
@@ -1,6 +1,6 @@
import { Meta } from "@storybook/addon-docs";
import { useTheme, ThemeProvider } from "@design-system/theming";
-import { TokenTable, StyledSquarePreview } from "./components";
+import { TokenTable, StyledSquarePreview } from "@design-system/storybook";
<Meta title="Design-system/Theme/Tokens/BorderRadius" />
diff --git a/app/client/packages/storybook/stories/design-system/theming/BoxShadow.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/BoxShadow.stories.mdx
similarity index 92%
rename from app/client/packages/storybook/stories/design-system/theming/BoxShadow.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/BoxShadow.stories.mdx
index f0fc5e24ccb9..dca862db1d6b 100644
--- a/app/client/packages/storybook/stories/design-system/theming/BoxShadow.stories.mdx
+++ b/app/client/packages/design-system/theming/src/theme/stories/BoxShadow.stories.mdx
@@ -1,6 +1,6 @@
import { Meta } from "@storybook/addon-docs";
import { useTheme, ThemeProvider } from "@design-system/theming";
-import { TokenTable, StyledSquarePreview } from "./components";
+import { TokenTable, StyledSquarePreview } from "@design-system/storybook";
<Meta title="Design-system/Theme/Tokens/BoxShadow" />
diff --git a/app/client/packages/storybook/stories/design-system/theming/Color.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/Color.stories.mdx
similarity index 97%
rename from app/client/packages/storybook/stories/design-system/theming/Color.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/Color.stories.mdx
index d3c90fb09426..39d649cd2706 100644
--- a/app/client/packages/storybook/stories/design-system/theming/Color.stories.mdx
+++ b/app/client/packages/design-system/theming/src/theme/stories/Color.stories.mdx
@@ -1,6 +1,10 @@
+import {
+ TokenTable,
+ StyledTable,
+ StyledSquarePreview,
+} from "@design-system/storybook";
import { Meta } from "@storybook/addon-docs";
import { useTheme, ThemeProvider } from "@design-system/theming";
-import { TokenTable, StyledTable, StyledSquarePreview } from "./components";
<Meta title="Design-system/Theme/Tokens/Color" />
diff --git a/app/client/packages/storybook/stories/design-system/theming/Opacity.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/Opacity.stories.mdx
similarity index 92%
rename from app/client/packages/storybook/stories/design-system/theming/Opacity.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/Opacity.stories.mdx
index 207d0c6421f9..baba689047e9 100644
--- a/app/client/packages/storybook/stories/design-system/theming/Opacity.stories.mdx
+++ b/app/client/packages/design-system/theming/src/theme/stories/Opacity.stories.mdx
@@ -1,6 +1,6 @@
import { Meta } from "@storybook/addon-docs";
import { useTheme, ThemeProvider } from "@design-system/theming";
-import { TokenTable, StyledSquarePreview } from "./components";
+import { TokenTable, StyledSquarePreview } from "@design-system/storybook";
<Meta title="Design-system/Theme/Tokens/Opacity" />
diff --git a/app/client/packages/storybook/stories/design-system/theming/RootUnit.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/RootUnit.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/theming/RootUnit.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/RootUnit.stories.mdx
diff --git a/app/client/packages/storybook/stories/design-system/theming/Sizing.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/Sizing.stories.mdx
similarity index 93%
rename from app/client/packages/storybook/stories/design-system/theming/Sizing.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/Sizing.stories.mdx
index 4a4256aa7668..1905f151a3bb 100644
--- a/app/client/packages/storybook/stories/design-system/theming/Sizing.stories.mdx
+++ b/app/client/packages/design-system/theming/src/theme/stories/Sizing.stories.mdx
@@ -1,6 +1,6 @@
import { Meta } from "@storybook/addon-docs";
import { useTheme, ThemeProvider } from "@design-system/theming";
-import { TokenTable, StyledLinePreview } from "./components";
+import { TokenTable, StyledLinePreview } from "@design-system/storybook";
<Meta title="Design-system/Theme/Tokens/Sizing" />
diff --git a/app/client/packages/storybook/stories/design-system/theming/Spacing.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/Spacing.stories.mdx
similarity index 94%
rename from app/client/packages/storybook/stories/design-system/theming/Spacing.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/Spacing.stories.mdx
index 57dc0f06c1b8..56ede4f20333 100644
--- a/app/client/packages/storybook/stories/design-system/theming/Spacing.stories.mdx
+++ b/app/client/packages/design-system/theming/src/theme/stories/Spacing.stories.mdx
@@ -1,6 +1,6 @@
import { Meta } from "@storybook/addon-docs";
import { useTheme, ThemeProvider } from "@design-system/theming";
-import { TokenTable, StyledLinePreview } from "./components";
+import { TokenTable, StyledLinePreview } from "@design-system/storybook";
<Meta title="Design-system/Theme/Tokens/Spacing" />
diff --git a/app/client/packages/storybook/stories/design-system/theming/Theme.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/Theme.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/theming/Theme.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/Theme.stories.mdx
diff --git a/app/client/packages/storybook/stories/design-system/theming/Typography.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/Typography.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/theming/Typography.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/Typography.stories.mdx
diff --git a/app/client/packages/storybook/stories/design-system/theming/ZIndex.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/ZIndex.stories.mdx
similarity index 92%
rename from app/client/packages/storybook/stories/design-system/theming/ZIndex.stories.mdx
rename to app/client/packages/design-system/theming/src/theme/stories/ZIndex.stories.mdx
index 6ad130dbbb45..70ea3d45c550 100644
--- a/app/client/packages/storybook/stories/design-system/theming/ZIndex.stories.mdx
+++ b/app/client/packages/design-system/theming/src/theme/stories/ZIndex.stories.mdx
@@ -1,6 +1,6 @@
import { Meta } from "@storybook/addon-docs";
import { useTheme, ThemeProvider } from "@design-system/theming";
-import { TokenTable, StyledSquarePreview } from "./components";
+import { TokenTable, StyledSquarePreview } from "@design-system/storybook";
<Meta title="Design-system/Theme/Tokens/ZIndex" />
diff --git a/app/client/packages/design-system/theming/src/token/index.ts b/app/client/packages/design-system/theming/src/token/index.ts
index 7db55b7e366b..3bd16e178a03 100644
--- a/app/client/packages/design-system/theming/src/token/index.ts
+++ b/app/client/packages/design-system/theming/src/token/index.ts
@@ -1,6 +1 @@
-export * from "./TokensAccessor";
-export * from "./types";
-export * from "./fluid";
-
-export { default as defaultTokens } from "./defaultTokens.json";
-export { default as themeTokens } from "./themeTokens.json";
+export * from "./src";
diff --git a/app/client/packages/design-system/theming/src/token/TokensAccessor.ts b/app/client/packages/design-system/theming/src/token/src/TokensAccessor.ts
similarity index 95%
rename from app/client/packages/design-system/theming/src/token/TokensAccessor.ts
rename to app/client/packages/design-system/theming/src/token/src/TokensAccessor.ts
index 538e2bbd9202..4e30252fe660 100644
--- a/app/client/packages/design-system/theming/src/token/TokensAccessor.ts
+++ b/app/client/packages/design-system/theming/src/token/src/TokensAccessor.ts
@@ -1,9 +1,9 @@
import kebabCase from "lodash/kebabCase";
-import { DarkModeTheme, LightModeTheme } from "../color";
-import { createTypographyStringMap } from "../typography";
+import { DarkModeTheme, LightModeTheme } from "../../color";
+import { createTypographyStringMap } from "../../typography";
-import type { ColorMode, ColorTypes } from "../color";
-import type { FontFamily, Typography } from "../typography";
+import type { ColorMode, ColorTypes } from "../../color";
+import type { FontFamily, Typography } from "../../typography";
import type {
RootUnit,
ThemeToken,
diff --git a/app/client/packages/design-system/theming/src/token/defaultTokens.json b/app/client/packages/design-system/theming/src/token/src/defaultTokens.json
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/defaultTokens.json
rename to app/client/packages/design-system/theming/src/token/src/defaultTokens.json
diff --git a/app/client/packages/design-system/theming/src/token/fluid/calculateFluidScales.ts b/app/client/packages/design-system/theming/src/token/src/fluid/calculateFluidScales.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/fluid/calculateFluidScales.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/calculateFluidScales.ts
diff --git a/app/client/packages/design-system/theming/src/token/fluid/calculateScales.ts b/app/client/packages/design-system/theming/src/token/src/fluid/calculateScales.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/fluid/calculateScales.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/calculateScales.ts
diff --git a/app/client/packages/design-system/theming/src/token/fluid/getFluidRootUnit.ts b/app/client/packages/design-system/theming/src/token/src/fluid/getFluidRootUnit.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/fluid/getFluidRootUnit.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/getFluidRootUnit.ts
diff --git a/app/client/packages/design-system/theming/src/token/fluid/getFluidSizing.ts b/app/client/packages/design-system/theming/src/token/src/fluid/getFluidSizing.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/fluid/getFluidSizing.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/getFluidSizing.ts
diff --git a/app/client/packages/design-system/theming/src/token/fluid/getFluidSpacing.ts b/app/client/packages/design-system/theming/src/token/src/fluid/getFluidSpacing.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/fluid/getFluidSpacing.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/getFluidSpacing.ts
diff --git a/app/client/packages/design-system/theming/src/token/fluid/getFluidTypography.ts b/app/client/packages/design-system/theming/src/token/src/fluid/getFluidTypography.ts
similarity index 88%
rename from app/client/packages/design-system/theming/src/token/fluid/getFluidTypography.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/getFluidTypography.ts
index d35eafae2a2a..b8c989e48ba4 100644
--- a/app/client/packages/design-system/theming/src/token/fluid/getFluidTypography.ts
+++ b/app/client/packages/design-system/theming/src/token/src/fluid/getFluidTypography.ts
@@ -1,9 +1,8 @@
-import { TypographyVariant } from "../../typography";
-import { calculateFluidScales } from "./calculateFluidScales";
-import { calculateScales } from "./calculateScales";
-
-import type { Typography } from "../../typography";
import type { FluidConfig } from "./types";
+import { calculateScales } from "./calculateScales";
+import type { Typography } from "../../../typography";
+import { TypographyVariant } from "../../../typography";
+import { calculateFluidScales } from "./calculateFluidScales";
export const getFluidTypography = (
scaleConfig: FluidConfig,
diff --git a/app/client/packages/design-system/theming/src/token/fluid/index.ts b/app/client/packages/design-system/theming/src/token/src/fluid/index.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/fluid/index.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/index.ts
diff --git a/app/client/packages/design-system/theming/src/token/fluid/types.ts b/app/client/packages/design-system/theming/src/token/src/fluid/types.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/fluid/types.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/types.ts
diff --git a/app/client/packages/design-system/theming/src/token/fluid/useFluidTokens.ts b/app/client/packages/design-system/theming/src/token/src/fluid/useFluidTokens.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/fluid/useFluidTokens.ts
rename to app/client/packages/design-system/theming/src/token/src/fluid/useFluidTokens.ts
diff --git a/app/client/packages/design-system/theming/src/token/src/index.ts b/app/client/packages/design-system/theming/src/token/src/index.ts
new file mode 100644
index 000000000000..7db55b7e366b
--- /dev/null
+++ b/app/client/packages/design-system/theming/src/token/src/index.ts
@@ -0,0 +1,6 @@
+export * from "./TokensAccessor";
+export * from "./types";
+export * from "./fluid";
+
+export { default as defaultTokens } from "./defaultTokens.json";
+export { default as themeTokens } from "./themeTokens.json";
diff --git a/app/client/packages/design-system/theming/src/token/themeTokens.json b/app/client/packages/design-system/theming/src/token/src/themeTokens.json
similarity index 100%
rename from app/client/packages/design-system/theming/src/token/themeTokens.json
rename to app/client/packages/design-system/theming/src/token/src/themeTokens.json
diff --git a/app/client/packages/design-system/theming/src/token/types.ts b/app/client/packages/design-system/theming/src/token/src/types.ts
similarity index 85%
rename from app/client/packages/design-system/theming/src/token/types.ts
rename to app/client/packages/design-system/theming/src/token/src/types.ts
index 59878c60e1bc..57392027f2d4 100644
--- a/app/client/packages/design-system/theming/src/token/types.ts
+++ b/app/client/packages/design-system/theming/src/token/src/types.ts
@@ -1,5 +1,5 @@
-import type { ColorMode, ColorTypes } from "../color";
-import type { FontFamily, Typography } from "../typography";
+import type { ColorMode, ColorTypes } from "../../color";
+import type { FontFamily, Typography } from "../../typography";
export type ThemeToken = {
[key in TokenType]?: { [key: string]: Token };
diff --git a/app/client/packages/design-system/theming/src/typography/index.ts b/app/client/packages/design-system/theming/src/typography/index.ts
index 6e90b17bc081..3bd16e178a03 100644
--- a/app/client/packages/design-system/theming/src/typography/index.ts
+++ b/app/client/packages/design-system/theming/src/typography/index.ts
@@ -1,2 +1 @@
-export * from "./typography";
-export * from "./types";
+export * from "./src";
diff --git a/app/client/packages/design-system/theming/src/typography/src/index.ts b/app/client/packages/design-system/theming/src/typography/src/index.ts
new file mode 100644
index 000000000000..6e90b17bc081
--- /dev/null
+++ b/app/client/packages/design-system/theming/src/typography/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./typography";
+export * from "./types";
diff --git a/app/client/packages/design-system/theming/src/typography/types.ts b/app/client/packages/design-system/theming/src/typography/src/types.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/typography/types.ts
rename to app/client/packages/design-system/theming/src/typography/src/types.ts
diff --git a/app/client/packages/design-system/theming/src/typography/typography.ts b/app/client/packages/design-system/theming/src/typography/src/typography.ts
similarity index 100%
rename from app/client/packages/design-system/theming/src/typography/typography.ts
rename to app/client/packages/design-system/theming/src/typography/src/typography.ts
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/Button.stories.tsx b/app/client/packages/design-system/widgets-old/src/Button/Button.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/Button.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/Button/Button.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/Dropdown.stories.tsx b/app/client/packages/design-system/widgets-old/src/Dropdown/Dropdown.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/Dropdown.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/Dropdown/Dropdown.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/Icon.stories.tsx b/app/client/packages/design-system/widgets-old/src/Icon/Icon.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/Icon.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/Icon/Icon.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/LabelWithTooltip.stories.tsx b/app/client/packages/design-system/widgets-old/src/LabelWithTooltip/LabelWithTooltip.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/LabelWithTooltip.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/LabelWithTooltip/LabelWithTooltip.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/ListSegmentHeader.stories.tsx b/app/client/packages/design-system/widgets-old/src/ListSegmentHeader/ListSegmentHeader.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/ListSegmentHeader.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/ListSegmentHeader/ListSegmentHeader.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/MenuDivider.stories.tsx b/app/client/packages/design-system/widgets-old/src/MenuDivider/MenuDivider.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/MenuDivider.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/MenuDivider/MenuDivider.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/ScrollIndicator.stories.tsx b/app/client/packages/design-system/widgets-old/src/ScrollIndicator/ScrollIndicator.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/ScrollIndicator.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/ScrollIndicator/ScrollIndicator.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/SearchComponent.stories.tsx b/app/client/packages/design-system/widgets-old/src/SearchComponent/SearchComponent.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/SearchComponent.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/SearchComponent/SearchComponent.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/Spinner.stories.tsx b/app/client/packages/design-system/widgets-old/src/Spinner/Spinner.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/Spinner.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/Spinner/Spinner.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/TableDropdown.stories.tsx b/app/client/packages/design-system/widgets-old/src/TableDropdown/TableDropdown.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/TableDropdown.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/TableDropdown/TableDropdown.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/Text.stories.tsx b/app/client/packages/design-system/widgets-old/src/Text/Text.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/Text.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/Text/Text.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/Toast.stories.tsx b/app/client/packages/design-system/widgets-old/src/Toast/Toast.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/Toast.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/Toast/Toast.stories.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets-old/Tooltip.stories.tsx b/app/client/packages/design-system/widgets-old/src/Tooltip/Tooltip.stories.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets-old/Tooltip.stories.tsx
rename to app/client/packages/design-system/widgets-old/src/Tooltip/Tooltip.stories.tsx
diff --git a/app/client/packages/storybook/chromatic/design-system/widgets/Button.chromatic.stories.tsx b/app/client/packages/design-system/widgets/src/components/Button/chromatic/Button.chromatic.stories.tsx
similarity index 92%
rename from app/client/packages/storybook/chromatic/design-system/widgets/Button.chromatic.stories.tsx
rename to app/client/packages/design-system/widgets/src/components/Button/chromatic/Button.chromatic.stories.tsx
index a3110759701a..92e6547a847d 100644
--- a/app/client/packages/storybook/chromatic/design-system/widgets/Button.chromatic.stories.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Button/chromatic/Button.chromatic.stories.tsx
@@ -7,9 +7,7 @@ import {
} from "@design-system/widgets";
import { importRemixIcon } from "design-system-old";
import type { Meta, StoryObj } from "@storybook/react";
-
-import { StoryGrid } from "../../../helpers/StoryGrid";
-import { DataAttrWrapper } from "../../../helpers/DataAttrWrapper";
+import { StoryGrid, DataAttrWrapper } from "@design-system/storybook";
const StarIcon = importRemixIcon(() => import("remixicon-react/StarFillIcon"));
diff --git a/app/client/packages/design-system/widgets/src/components/Button/index.ts b/app/client/packages/design-system/widgets/src/components/Button/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/Button/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/Button/Button.tsx b/app/client/packages/design-system/widgets/src/components/Button/src/Button.tsx
similarity index 97%
rename from app/client/packages/design-system/widgets/src/components/Button/Button.tsx
rename to app/client/packages/design-system/widgets/src/components/Button/src/Button.tsx
index b29b5bbed98c..be165033683f 100644
--- a/app/client/packages/design-system/widgets/src/components/Button/Button.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Button/src/Button.tsx
@@ -5,13 +5,14 @@ import type {
import React, { forwardRef } from "react";
import { Icon as HeadlessIcon } from "@design-system/headless";
import { useVisuallyHidden } from "@react-aria/visually-hidden";
-import { Text } from "../Text";
-import { Spinner } from "../Spinner";
+
import type {
BUTTON_COLORS,
BUTTON_VARIANTS,
BUTTON_ICON_POSITIONS,
} from "./types";
+import { Text } from "../../Text";
+import { Spinner } from "../../Spinner";
import { DragContainer, StyledButton } from "./index.styled";
export interface ButtonProps extends Omit<HeadlessButtonProps, "className"> {
diff --git a/app/client/packages/design-system/widgets/src/components/Button/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/Button/src/index.styled.tsx
similarity index 98%
rename from app/client/packages/design-system/widgets/src/components/Button/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/Button/src/index.styled.tsx
index a0a5670881fa..71e51bef5da7 100644
--- a/app/client/packages/design-system/widgets/src/components/Button/index.styled.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Button/src/index.styled.tsx
@@ -2,7 +2,7 @@ import styled, { css } from "styled-components";
import { Button as HeadlessButton } from "@design-system/headless";
import type { ButtonProps } from "./Button";
-import type { PickRename } from "../../utils";
+import type { PickRename } from "../../../utils";
type StyledButtonProps = PickRename<
ButtonProps,
diff --git a/app/client/packages/design-system/widgets/src/components/Button/index.tsx b/app/client/packages/design-system/widgets/src/components/Button/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Button/index.tsx
rename to app/client/packages/design-system/widgets/src/components/Button/src/index.ts
index 7a23efc0f328..3510e48efe85 100644
--- a/app/client/packages/design-system/widgets/src/components/Button/index.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Button/src/index.ts
@@ -1,3 +1,3 @@
+export * from "./types";
export { Button } from "./Button";
export type { ButtonProps } from "./Button";
-export * from "./types";
diff --git a/app/client/packages/design-system/widgets/src/components/Button/types.ts b/app/client/packages/design-system/widgets/src/components/Button/src/types.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Button/types.ts
rename to app/client/packages/design-system/widgets/src/components/Button/src/types.ts
diff --git a/app/client/packages/storybook/stories/design-system/widgets/Button.stories.mdx b/app/client/packages/design-system/widgets/src/components/Button/stories/Button.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/Button.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/Button/stories/Button.stories.mdx
index 2e4570cdb378..ebf218370c94 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/Button.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/Button/stories/Button.stories.mdx
@@ -1,6 +1,6 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/blocks";
import { Button } from "@design-system/widgets";
import { Icon } from "@design-system/headless";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/blocks";
import EmotionHappyLineIcon from "remixicon-react/EmotionHappyLineIcon";
<Meta
diff --git a/app/client/packages/design-system/widgets/src/components/Button/Button.test.tsx b/app/client/packages/design-system/widgets/src/components/Button/tests/Button.test.tsx
similarity index 98%
rename from app/client/packages/design-system/widgets/src/components/Button/Button.test.tsx
rename to app/client/packages/design-system/widgets/src/components/Button/tests/Button.test.tsx
index ca5420b05b33..f61101670d83 100644
--- a/app/client/packages/design-system/widgets/src/components/Button/Button.test.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Button/tests/Button.test.tsx
@@ -3,7 +3,7 @@ import "@testing-library/jest-dom";
import { Icon } from "@design-system/headless";
import { render, screen } from "@testing-library/react";
-import { Button } from "./";
+import { Button } from "../";
// Adapted from remixicon-react/EmotionHappyLineIcon (https://github.com/Remix-Design/RemixIcon/blob/f88a51b6402562c6c2465f61a3e845115992e4c6/icons/User%20%26%20Faces/emotion-happy-line.svg)
const EmotionHappyLineIcon = ({ ...props }: Record<string, string>) => {
diff --git a/app/client/packages/design-system/widgets/src/components/ButtonGroup/index.ts b/app/client/packages/design-system/widgets/src/components/ButtonGroup/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/ButtonGroup/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/ButtonGroup/index.tsx b/app/client/packages/design-system/widgets/src/components/ButtonGroup/index.tsx
deleted file mode 100644
index 806780255a0a..000000000000
--- a/app/client/packages/design-system/widgets/src/components/ButtonGroup/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { ButtonGroup } from "./ButtonGroup";
diff --git a/app/client/packages/design-system/widgets/src/components/ButtonGroup/ButtonGroup.tsx b/app/client/packages/design-system/widgets/src/components/ButtonGroup/src/ButtonGroup.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/ButtonGroup/ButtonGroup.tsx
rename to app/client/packages/design-system/widgets/src/components/ButtonGroup/src/ButtonGroup.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/ButtonGroup/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/ButtonGroup/src/index.styled.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/ButtonGroup/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/ButtonGroup/src/index.styled.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/ButtonGroup/src/index.tsx b/app/client/packages/design-system/widgets/src/components/ButtonGroup/src/index.tsx
new file mode 100644
index 000000000000..560c3eb230a5
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/ButtonGroup/src/index.tsx
@@ -0,0 +1,2 @@
+export { ButtonGroup } from "./ButtonGroup";
+export type { ButtonGroupProps } from "./ButtonGroup";
diff --git a/app/client/packages/storybook/stories/design-system/widgets/ButtonGroup.stories.mdx b/app/client/packages/design-system/widgets/src/components/ButtonGroup/stories/ButtonGroup.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/ButtonGroup.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/ButtonGroup/stories/ButtonGroup.stories.mdx
index 6af9b85aba72..7c8fa0786686 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/ButtonGroup.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/ButtonGroup/stories/ButtonGroup.stories.mdx
@@ -1,5 +1,5 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
import { Flex, Button, ButtonGroup } from "@design-system/widgets";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta title="Design-system/Widgets/Button Group" />
diff --git a/app/client/packages/design-system/widgets/src/components/ButtonGroup/ButtonGroup.test.tsx b/app/client/packages/design-system/widgets/src/components/ButtonGroup/tests/ButtonGroup.test.tsx
similarity index 87%
rename from app/client/packages/design-system/widgets/src/components/ButtonGroup/ButtonGroup.test.tsx
rename to app/client/packages/design-system/widgets/src/components/ButtonGroup/tests/ButtonGroup.test.tsx
index 2f09d4417fda..d771f06424db 100644
--- a/app/client/packages/design-system/widgets/src/components/ButtonGroup/ButtonGroup.test.tsx
+++ b/app/client/packages/design-system/widgets/src/components/ButtonGroup/tests/ButtonGroup.test.tsx
@@ -2,9 +2,9 @@ import React from "react";
import "@testing-library/jest-dom";
import { render, screen } from "@testing-library/react";
-import { Button } from "../Button/Button";
-import type { ButtonGroupProps } from "./ButtonGroup";
-import { ButtonGroup } from "./ButtonGroup";
+import { ButtonGroup } from "../";
+import { Button } from "../../Button";
+import type { ButtonGroupProps } from "../";
const renderComponent = (props: ButtonGroupProps = {}) => {
return render(
diff --git a/app/client/packages/storybook/chromatic/design-system/widgets/Checkbox.chromatic.stories.tsx b/app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx
similarity index 89%
rename from app/client/packages/storybook/chromatic/design-system/widgets/Checkbox.chromatic.stories.tsx
rename to app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx
index 1a0bb89e2c87..f2a9def2a6fa 100644
--- a/app/client/packages/storybook/chromatic/design-system/widgets/Checkbox.chromatic.stories.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx
@@ -1,9 +1,7 @@
import React from "react";
-import type { Meta, StoryObj } from "@storybook/react";
-
import { Checkbox } from "@design-system/widgets";
-import { StoryGrid } from "../../../helpers/StoryGrid";
-import { DataAttrWrapper } from "../../../helpers/DataAttrWrapper";
+import type { Meta, StoryObj } from "@storybook/react";
+import { StoryGrid, DataAttrWrapper } from "@design-system/storybook";
const meta: Meta<typeof Checkbox> = {
component: Checkbox,
diff --git a/app/client/packages/design-system/widgets/src/components/Checkbox/index.ts b/app/client/packages/design-system/widgets/src/components/Checkbox/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/Checkbox/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/Checkbox/Checkbox.tsx b/app/client/packages/design-system/widgets/src/components/Checkbox/src/Checkbox.tsx
similarity index 94%
rename from app/client/packages/design-system/widgets/src/components/Checkbox/Checkbox.tsx
rename to app/client/packages/design-system/widgets/src/components/Checkbox/src/Checkbox.tsx
index 95a116dcaf48..d8b8c9b50ce4 100644
--- a/app/client/packages/design-system/widgets/src/components/Checkbox/Checkbox.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Checkbox/src/Checkbox.tsx
@@ -5,7 +5,7 @@ import type {
CheckboxProps as HeadlessCheckboxProps,
} from "@design-system/headless";
-import { Text } from "../Text";
+import { Text } from "../../Text";
import { StyledCheckbox } from "./index.styled";
export type CheckboxProps = HeadlessCheckboxProps;
diff --git a/app/client/packages/design-system/widgets/src/components/Checkbox/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/Checkbox/src/index.styled.tsx
similarity index 97%
rename from app/client/packages/design-system/widgets/src/components/Checkbox/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/Checkbox/src/index.styled.tsx
index 8c70bbd78e8f..73d6c62c2f06 100644
--- a/app/client/packages/design-system/widgets/src/components/Checkbox/index.styled.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Checkbox/src/index.styled.tsx
@@ -2,7 +2,7 @@ import styled from "styled-components";
import { Checkbox as HeadlessCheckbox } from "@design-system/headless";
import type { CheckboxProps } from ".";
-import { inlineLabelStyles } from "../../styles/inlineLabelStyles";
+import { inlineLabelStyles } from "../../../styles";
export const StyledCheckbox = styled(HeadlessCheckbox)<CheckboxProps>`
${inlineLabelStyles}
diff --git a/app/client/packages/design-system/widgets/src/components/Checkbox/index.tsx b/app/client/packages/design-system/widgets/src/components/Checkbox/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Checkbox/index.tsx
rename to app/client/packages/design-system/widgets/src/components/Checkbox/src/index.ts
diff --git a/app/client/packages/storybook/stories/design-system/widgets/Checkbox.stories.mdx b/app/client/packages/design-system/widgets/src/components/Checkbox/stories/Checkbox.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/Checkbox.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/Checkbox/stories/Checkbox.stories.mdx
index 92632828315d..441a7ac12ca8 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/Checkbox.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/Checkbox/stories/Checkbox.stories.mdx
@@ -1,6 +1,6 @@
+import { Checkbox } from "@design-system/widgets";
import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
import EmotionHappyLineIcon from "remixicon-react/EmotionHappyLineIcon";
-import { Checkbox } from "@design-system/widgets";
<Meta
title="Design-system/Widgets/Checkbox"
diff --git a/app/client/packages/design-system/widgets/src/components/Checkbox/Checkbox.test.tsx b/app/client/packages/design-system/widgets/src/components/Checkbox/tests/Checkbox.test.tsx
similarity index 98%
rename from app/client/packages/design-system/widgets/src/components/Checkbox/Checkbox.test.tsx
rename to app/client/packages/design-system/widgets/src/components/Checkbox/tests/Checkbox.test.tsx
index be0f6b39febb..cc3ae4cda199 100644
--- a/app/client/packages/design-system/widgets/src/components/Checkbox/Checkbox.test.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Checkbox/tests/Checkbox.test.tsx
@@ -1,10 +1,9 @@
import React from "react";
import "@testing-library/jest-dom";
import { Icon } from "@design-system/headless";
-import { render, screen } from "@testing-library/react";
+import { Checkbox } from "@design-system/widgets";
import userEvent from "@testing-library/user-event";
-
-import { Checkbox } from "./Checkbox";
+import { render, screen } from "@testing-library/react";
// Adapted from remixicon-react/EmotionHappyLineIcon (https://github.com/Remix-Design/RemixIcon/blob/f88a51b6402562c6c2465f61a3e845115992e4c6/icons/User%20%26%20Faces/emotion-happy-line.svg)
const EmotionHappyLineIcon = ({ ...props }: Record<string, string>) => {
diff --git a/app/client/packages/storybook/chromatic/design-system/widgets/Group.chromatic.stories.tsx b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/chromatic/Group.chromatic.stories.tsx
similarity index 95%
rename from app/client/packages/storybook/chromatic/design-system/widgets/Group.chromatic.stories.tsx
rename to app/client/packages/design-system/widgets/src/components/CheckboxGroup/chromatic/Group.chromatic.stories.tsx
index 017417780add..630a1512e84c 100644
--- a/app/client/packages/storybook/chromatic/design-system/widgets/Group.chromatic.stories.tsx
+++ b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/chromatic/Group.chromatic.stories.tsx
@@ -9,7 +9,7 @@ import {
SwitchGroup,
Radio,
} from "@design-system/widgets";
-import { StoryGrid } from "../../../helpers/StoryGrid";
+import { StoryGrid } from "@design-system/storybook";
const meta: Meta<typeof Switch> = {
component: Switch,
diff --git a/app/client/packages/design-system/widgets/src/components/CheckboxGroup/index.ts b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/CheckboxGroup/CheckboxGroup.tsx b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/src/CheckboxGroup.tsx
similarity index 95%
rename from app/client/packages/design-system/widgets/src/components/CheckboxGroup/CheckboxGroup.tsx
rename to app/client/packages/design-system/widgets/src/components/CheckboxGroup/src/CheckboxGroup.tsx
index 0eae957c9222..7d9d2fafaeea 100644
--- a/app/client/packages/design-system/widgets/src/components/CheckboxGroup/CheckboxGroup.tsx
+++ b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/src/CheckboxGroup.tsx
@@ -5,7 +5,7 @@ import type {
CheckboxGroupProps as HeadlessCheckboxGroupProps,
} from "@design-system/headless";
-import { Text } from "../Text";
+import { Text } from "../../Text";
import { StyledCheckboxGroup } from "./index.styled";
export interface CheckboxGroupProps extends HeadlessCheckboxGroupProps {
diff --git a/app/client/packages/design-system/widgets/src/components/CheckboxGroup/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/src/index.styled.tsx
similarity index 84%
rename from app/client/packages/design-system/widgets/src/components/CheckboxGroup/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/CheckboxGroup/src/index.styled.tsx
index 06ce4e907a76..2516a209f328 100644
--- a/app/client/packages/design-system/widgets/src/components/CheckboxGroup/index.styled.tsx
+++ b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/src/index.styled.tsx
@@ -1,8 +1,8 @@
import styled from "styled-components";
+import type { CheckboxGroupProps } from "./CheckboxGroup";
import { CheckboxGroup as HeadlessCheckboxGroup } from "@design-system/headless";
-import { fieldStyles } from "../../styles/fieldStyles";
-import type { CheckboxGroupProps } from "./CheckboxGroup";
+import { fieldStyles } from "../../../styles";
export const StyledCheckboxGroup = styled(
HeadlessCheckboxGroup,
diff --git a/app/client/packages/design-system/widgets/src/components/CheckboxGroup/index.tsx b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/CheckboxGroup/index.tsx
rename to app/client/packages/design-system/widgets/src/components/CheckboxGroup/src/index.ts
diff --git a/app/client/packages/storybook/stories/design-system/widgets/CheckboxGroup.stories.mdx b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/stories/CheckboxGroup.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/CheckboxGroup.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/CheckboxGroup/stories/CheckboxGroup.stories.mdx
index c501663f322e..a6cd680ad686 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/CheckboxGroup.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/stories/CheckboxGroup.stories.mdx
@@ -1,5 +1,5 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
import { CheckboxGroup, Checkbox } from "@design-system/widgets";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/Widgets/CheckboxGroup"
diff --git a/app/client/packages/design-system/widgets/src/components/CheckboxGroup/CheckboxGroup.test.tsx b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/tests/CheckboxGroup.test.tsx
similarity index 96%
rename from app/client/packages/design-system/widgets/src/components/CheckboxGroup/CheckboxGroup.test.tsx
rename to app/client/packages/design-system/widgets/src/components/CheckboxGroup/tests/CheckboxGroup.test.tsx
index 36cfa967b91e..cbf33f993790 100644
--- a/app/client/packages/design-system/widgets/src/components/CheckboxGroup/CheckboxGroup.test.tsx
+++ b/app/client/packages/design-system/widgets/src/components/CheckboxGroup/tests/CheckboxGroup.test.tsx
@@ -1,10 +1,10 @@
import React from "react";
import "@testing-library/jest-dom";
-import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
+import { render, screen } from "@testing-library/react";
-import { Checkbox } from "../Checkbox/Checkbox";
-import { CheckboxGroup } from "./CheckboxGroup";
+import { CheckboxGroup } from "../";
+import { Checkbox } from "../../Checkbox";
describe("@design-system/widgets/CheckboxGroup", () => {
it("should render the checkbox group", () => {
diff --git a/app/client/packages/design-system/widgets/src/components/Flex/index.ts b/app/client/packages/design-system/widgets/src/components/Flex/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/Flex/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/Flex/Flex.tsx b/app/client/packages/design-system/widgets/src/components/Flex/src/Flex.tsx
similarity index 99%
rename from app/client/packages/design-system/widgets/src/components/Flex/Flex.tsx
rename to app/client/packages/design-system/widgets/src/components/Flex/src/Flex.tsx
index d4b76200e829..69201f82bf31 100644
--- a/app/client/packages/design-system/widgets/src/components/Flex/Flex.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Flex/src/Flex.tsx
@@ -1,6 +1,7 @@
import React, { forwardRef } from "react";
-import { StyledContainerFlex, StyledFlex } from "./index.styled";
+
import type { FlexProps } from "./types";
+import { StyledContainerFlex, StyledFlex } from "./index.styled";
const _Flex = (props: FlexProps, ref: React.Ref<HTMLDivElement>) => {
const {
diff --git a/app/client/packages/design-system/widgets/src/components/Flex/dimensions.ts b/app/client/packages/design-system/widgets/src/components/Flex/src/dimensions.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Flex/dimensions.ts
rename to app/client/packages/design-system/widgets/src/components/Flex/src/dimensions.ts
diff --git a/app/client/packages/design-system/widgets/src/components/Flex/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/Flex/src/index.styled.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Flex/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/Flex/src/index.styled.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/Flex/index.tsx b/app/client/packages/design-system/widgets/src/components/Flex/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Flex/index.tsx
rename to app/client/packages/design-system/widgets/src/components/Flex/src/index.ts
diff --git a/app/client/packages/design-system/widgets/src/components/Flex/types.ts b/app/client/packages/design-system/widgets/src/components/Flex/src/types.ts
similarity index 99%
rename from app/client/packages/design-system/widgets/src/components/Flex/types.ts
rename to app/client/packages/design-system/widgets/src/components/Flex/src/types.ts
index 8c63d8c935bb..96bf707c97ae 100644
--- a/app/client/packages/design-system/widgets/src/components/Flex/types.ts
+++ b/app/client/packages/design-system/widgets/src/components/Flex/src/types.ts
@@ -1,5 +1,5 @@
+import type { OmitRename } from "../../../utils";
import type { CSSProperties, ReactNode } from "react";
-import type { OmitRename } from "../../utils";
import type { SizingDimension, SpacingDimension } from "./dimensions";
export type Responsive<T> =
diff --git a/app/client/packages/storybook/stories/design-system/widgets/Flex.stories.mdx b/app/client/packages/design-system/widgets/src/components/Flex/stories/Flex.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/Flex.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/Flex/stories/Flex.stories.mdx
index c03f05c77869..74807c8fec40 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/Flex.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/Flex/stories/Flex.stories.mdx
@@ -1,7 +1,7 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
import { useState } from "react";
-import { Flex, Text, RadioGroup, Radio } from "@design-system/widgets";
import styled from "styled-components";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
+import { Flex, Text, RadioGroup, Radio } from "@design-system/widgets";
<Meta
title="Design-system/Widgets/Flex"
diff --git a/app/client/packages/storybook/chromatic/design-system/widgets/Radio.chromatic.stories.tsx b/app/client/packages/design-system/widgets/src/components/Radio/chromatic/Radio.chromatic.stories.tsx
similarity index 89%
rename from app/client/packages/storybook/chromatic/design-system/widgets/Radio.chromatic.stories.tsx
rename to app/client/packages/design-system/widgets/src/components/Radio/chromatic/Radio.chromatic.stories.tsx
index 333623f3ed09..8bd564944453 100644
--- a/app/client/packages/storybook/chromatic/design-system/widgets/Radio.chromatic.stories.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Radio/chromatic/Radio.chromatic.stories.tsx
@@ -1,9 +1,7 @@
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
-
import { Radio, RadioGroup } from "@design-system/widgets";
-import { StoryGrid } from "../../../helpers/StoryGrid";
-import { DataAttrWrapper } from "../../../helpers/DataAttrWrapper";
+import { StoryGrid, DataAttrWrapper } from "@design-system/storybook";
const meta: Meta<typeof Radio> = {
component: Radio,
diff --git a/app/client/packages/design-system/widgets/src/components/Radio/index.ts b/app/client/packages/design-system/widgets/src/components/Radio/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/Radio/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/Radio/Radio.tsx b/app/client/packages/design-system/widgets/src/components/Radio/src/Radio.tsx
similarity index 92%
rename from app/client/packages/design-system/widgets/src/components/Radio/Radio.tsx
rename to app/client/packages/design-system/widgets/src/components/Radio/src/Radio.tsx
index 99a35c1ca771..c9ca869441e7 100644
--- a/app/client/packages/design-system/widgets/src/components/Radio/Radio.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Radio/src/Radio.tsx
@@ -5,7 +5,7 @@ import type {
RadioProps as HeadlessRadioProps,
} from "@design-system/headless";
-import { Text } from "../Text";
+import { Text } from "@design-system/widgets";
import { StyledRadio } from "./index.styled";
export type RadioProps = HeadlessRadioProps;
diff --git a/app/client/packages/design-system/widgets/src/components/Radio/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/Radio/src/index.styled.tsx
similarity index 97%
rename from app/client/packages/design-system/widgets/src/components/Radio/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/Radio/src/index.styled.tsx
index f6c36b744f51..66170ed9c774 100644
--- a/app/client/packages/design-system/widgets/src/components/Radio/index.styled.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Radio/src/index.styled.tsx
@@ -2,7 +2,7 @@ import styled from "styled-components";
import { Radio as HeadlessRadio } from "@design-system/headless";
import type { RadioProps } from ".";
-import { inlineLabelStyles } from "../../styles/inlineLabelStyles";
+import { inlineLabelStyles } from "../../../styles";
export const StyledRadio = styled(HeadlessRadio)<RadioProps>`
${inlineLabelStyles}
diff --git a/app/client/packages/design-system/widgets/src/components/Radio/index.tsx b/app/client/packages/design-system/widgets/src/components/Radio/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Radio/index.tsx
rename to app/client/packages/design-system/widgets/src/components/Radio/src/index.ts
diff --git a/app/client/packages/design-system/widgets/src/components/RadioGroup/index.ts b/app/client/packages/design-system/widgets/src/components/RadioGroup/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/RadioGroup/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/RadioGroup/RadioGroup.tsx b/app/client/packages/design-system/widgets/src/components/RadioGroup/src/RadioGroup.tsx
similarity index 95%
rename from app/client/packages/design-system/widgets/src/components/RadioGroup/RadioGroup.tsx
rename to app/client/packages/design-system/widgets/src/components/RadioGroup/src/RadioGroup.tsx
index 34045dffe672..74a81f0c4cf9 100644
--- a/app/client/packages/design-system/widgets/src/components/RadioGroup/RadioGroup.tsx
+++ b/app/client/packages/design-system/widgets/src/components/RadioGroup/src/RadioGroup.tsx
@@ -5,7 +5,7 @@ import type {
RadioGroupProps as HeadlessRadioGroupProps,
} from "@design-system/headless";
-import { Text } from "../Text";
+import { Text } from "../../Text";
import { StyledRadioGroup } from "./index.styled";
export interface RadioGroupProps extends HeadlessRadioGroupProps {
diff --git a/app/client/packages/design-system/widgets/src/components/RadioGroup/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/RadioGroup/src/index.styled.tsx
similarity index 82%
rename from app/client/packages/design-system/widgets/src/components/RadioGroup/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/RadioGroup/src/index.styled.tsx
index f1fa0dc4497f..22e7f6d34fb2 100644
--- a/app/client/packages/design-system/widgets/src/components/RadioGroup/index.styled.tsx
+++ b/app/client/packages/design-system/widgets/src/components/RadioGroup/src/index.styled.tsx
@@ -1,7 +1,7 @@
import styled from "styled-components";
import { RadioGroup as HeadlessRadioGroup } from "@design-system/headless";
-import { fieldStyles } from "../../styles/fieldStyles";
+import { fieldStyles } from "../../../styles";
import type { RadioGroupProps } from "./RadioGroup";
export const StyledRadioGroup = styled(HeadlessRadioGroup)<RadioGroupProps>`
diff --git a/app/client/packages/design-system/widgets/src/components/RadioGroup/index.tsx b/app/client/packages/design-system/widgets/src/components/RadioGroup/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/RadioGroup/index.tsx
rename to app/client/packages/design-system/widgets/src/components/RadioGroup/src/index.ts
diff --git a/app/client/packages/storybook/stories/design-system/widgets/RadioGroup.stories.mdx b/app/client/packages/design-system/widgets/src/components/RadioGroup/stories/RadioGroup.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/RadioGroup.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/RadioGroup/stories/RadioGroup.stories.mdx
index b0fcb854e043..3dc1a91638ae 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/RadioGroup.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/RadioGroup/stories/RadioGroup.stories.mdx
@@ -1,5 +1,5 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
import { RadioGroup, Radio } from "@design-system/widgets";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/Widgets/RadioGroup"
diff --git a/app/client/packages/design-system/widgets/src/components/RadioGroup/RadioGroup.test.tsx b/app/client/packages/design-system/widgets/src/components/RadioGroup/tests/RadioGroup.test.tsx
similarity index 97%
rename from app/client/packages/design-system/widgets/src/components/RadioGroup/RadioGroup.test.tsx
rename to app/client/packages/design-system/widgets/src/components/RadioGroup/tests/RadioGroup.test.tsx
index f6744becb0d6..e69d67a1097f 100644
--- a/app/client/packages/design-system/widgets/src/components/RadioGroup/RadioGroup.test.tsx
+++ b/app/client/packages/design-system/widgets/src/components/RadioGroup/tests/RadioGroup.test.tsx
@@ -1,10 +1,10 @@
import React from "react";
import "@testing-library/jest-dom";
-import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
+import { render, screen } from "@testing-library/react";
-import { Radio } from "../Radio";
-import { RadioGroup } from "./";
+import { RadioGroup } from "../";
+import { Radio } from "../../Radio";
describe("@design-system/widgets/RadioGroup", () => {
it("should render the Radio group", () => {
diff --git a/app/client/packages/design-system/widgets/src/components/Spinner/index.ts b/app/client/packages/design-system/widgets/src/components/Spinner/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/Spinner/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/Spinner/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/Spinner/src/index.styled.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Spinner/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/Spinner/src/index.styled.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/Spinner/index.tsx b/app/client/packages/design-system/widgets/src/components/Spinner/src/index.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Spinner/index.tsx
rename to app/client/packages/design-system/widgets/src/components/Spinner/src/index.tsx
diff --git a/app/client/packages/storybook/chromatic/design-system/widgets/Switch.chromatic.stories.tsx b/app/client/packages/design-system/widgets/src/components/Switch/chromatic/Switch.chromatic.stories.tsx
similarity index 87%
rename from app/client/packages/storybook/chromatic/design-system/widgets/Switch.chromatic.stories.tsx
rename to app/client/packages/design-system/widgets/src/components/Switch/chromatic/Switch.chromatic.stories.tsx
index 8dcc48773cd2..19104df11723 100644
--- a/app/client/packages/storybook/chromatic/design-system/widgets/Switch.chromatic.stories.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Switch/chromatic/Switch.chromatic.stories.tsx
@@ -1,9 +1,7 @@
import React from "react";
-import type { Meta, StoryObj } from "@storybook/react";
-
import { Switch } from "@design-system/widgets";
-import { StoryGrid } from "../../../helpers/StoryGrid";
-import { DataAttrWrapper } from "../../../helpers/DataAttrWrapper";
+import type { Meta, StoryObj } from "@storybook/react";
+import { StoryGrid, DataAttrWrapper } from "@design-system/storybook";
const meta: Meta<typeof Switch> = {
component: Switch,
diff --git a/app/client/packages/design-system/widgets/src/components/Switch/index.ts b/app/client/packages/design-system/widgets/src/components/Switch/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/Switch/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/Switch/Switch.tsx b/app/client/packages/design-system/widgets/src/components/Switch/src/Switch.tsx
similarity index 94%
rename from app/client/packages/design-system/widgets/src/components/Switch/Switch.tsx
rename to app/client/packages/design-system/widgets/src/components/Switch/src/Switch.tsx
index a2634bfebf2c..e5a8287bcf23 100644
--- a/app/client/packages/design-system/widgets/src/components/Switch/Switch.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Switch/src/Switch.tsx
@@ -5,7 +5,7 @@ import type {
SwitchProps as HeadlessSwitchProps,
} from "@design-system/headless";
-import { Text } from "../Text";
+import { Text } from "../../Text";
import { StyledSwitch } from "./index.styled";
export type SwitchProps = Omit<HeadlessSwitchProps, "icon" | "isIndeterminate">;
diff --git a/app/client/packages/design-system/widgets/src/components/Switch/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/Switch/src/index.styled.tsx
similarity index 96%
rename from app/client/packages/design-system/widgets/src/components/Switch/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/Switch/src/index.styled.tsx
index 4fa5da4b9769..ebc28ae07e49 100644
--- a/app/client/packages/design-system/widgets/src/components/Switch/index.styled.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Switch/src/index.styled.tsx
@@ -2,7 +2,7 @@ import styled from "styled-components";
import { Switch as HeadlessSwitch } from "@design-system/headless";
import type { SwitchProps } from ".";
-import { inlineLabelStyles } from "../../styles/inlineLabelStyles";
+import { inlineLabelStyles } from "../../../styles";
export const StyledSwitch = styled(HeadlessSwitch)<SwitchProps>`
${inlineLabelStyles}
diff --git a/app/client/packages/design-system/widgets/src/components/Switch/index.tsx b/app/client/packages/design-system/widgets/src/components/Switch/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Switch/index.tsx
rename to app/client/packages/design-system/widgets/src/components/Switch/src/index.ts
diff --git a/app/client/packages/storybook/stories/design-system/widgets/Switch.stories.mdx b/app/client/packages/design-system/widgets/src/components/Switch/stories/Switch.stories.mdx
similarity index 99%
rename from app/client/packages/storybook/stories/design-system/widgets/Switch.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/Switch/stories/Switch.stories.mdx
index cb0a6799fa40..cc21da42c647 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/Switch.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/Switch/stories/Switch.stories.mdx
@@ -1,6 +1,5 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
-
import { Switch } from "@design-system/widgets";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/widgets/Switch"
diff --git a/app/client/packages/design-system/widgets/src/components/SwitchGroup/index.ts b/app/client/packages/design-system/widgets/src/components/SwitchGroup/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/SwitchGroup/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/SwitchGroup/index.tsx b/app/client/packages/design-system/widgets/src/components/SwitchGroup/index.tsx
deleted file mode 100644
index bf13531db195..000000000000
--- a/app/client/packages/design-system/widgets/src/components/SwitchGroup/index.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-export { CheckboxGroup as SwitchGroup } from "../CheckboxGroup";
-export type { CheckboxGroupProps as SwitchGroupProps } from "../CheckboxGroup";
diff --git a/app/client/packages/design-system/widgets/src/components/SwitchGroup/src/index.ts b/app/client/packages/design-system/widgets/src/components/SwitchGroup/src/index.ts
new file mode 100644
index 000000000000..d5aca9a47078
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/SwitchGroup/src/index.ts
@@ -0,0 +1,2 @@
+export { CheckboxGroup as SwitchGroup } from "../../CheckboxGroup";
+export type { CheckboxGroupProps as SwitchGroupProps } from "../../CheckboxGroup";
diff --git a/app/client/packages/storybook/stories/design-system/widgets/SwitchGroup.stories.mdx b/app/client/packages/design-system/widgets/src/components/SwitchGroup/stories/SwitchGroup.stories.mdx
similarity index 99%
rename from app/client/packages/storybook/stories/design-system/widgets/SwitchGroup.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/SwitchGroup/stories/SwitchGroup.stories.mdx
index 9eb3cc6c8b49..8e36b5ba7a25 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/SwitchGroup.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/SwitchGroup/stories/SwitchGroup.stories.mdx
@@ -1,6 +1,5 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
-
import { Switch, SwitchGroup } from "@design-system/widgets";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/widgets/SwitchGroup"
diff --git a/app/client/packages/storybook/chromatic/design-system/widgets/Text.chromatic.stories.tsx b/app/client/packages/design-system/widgets/src/components/Text/chromatic/Text.chromatic.stories.tsx
similarity index 97%
rename from app/client/packages/storybook/chromatic/design-system/widgets/Text.chromatic.stories.tsx
rename to app/client/packages/design-system/widgets/src/components/Text/chromatic/Text.chromatic.stories.tsx
index 7942b4e0d9f4..a98de72cbab5 100644
--- a/app/client/packages/storybook/chromatic/design-system/widgets/Text.chromatic.stories.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Text/chromatic/Text.chromatic.stories.tsx
@@ -1,13 +1,12 @@
import React from "react";
-import type { Meta, StoryObj } from "@storybook/react";
-
-import { Text } from "@design-system/widgets";
-import { StoryGrid } from "../../../helpers/StoryGrid";
import {
TypographyColor,
TypographyVariant,
TypographyFontWeight,
} from "@design-system/theming";
+import { Text } from "@design-system/widgets";
+import { StoryGrid } from "@design-system/storybook";
+import type { Meta, StoryObj } from "@storybook/react";
const meta: Meta<typeof Text> = {
component: Text,
diff --git a/app/client/packages/design-system/widgets/src/components/Text/index.ts b/app/client/packages/design-system/widgets/src/components/Text/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/Text/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/Text/Text.tsx b/app/client/packages/design-system/widgets/src/components/Text/src/Text.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Text/Text.tsx
rename to app/client/packages/design-system/widgets/src/components/Text/src/Text.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/Text/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/Text/src/index.styled.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Text/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/Text/src/index.styled.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/Text/index.tsx b/app/client/packages/design-system/widgets/src/components/Text/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Text/index.tsx
rename to app/client/packages/design-system/widgets/src/components/Text/src/index.ts
diff --git a/app/client/packages/design-system/widgets/src/components/Text/types.ts b/app/client/packages/design-system/widgets/src/components/Text/src/types.ts
similarity index 96%
rename from app/client/packages/design-system/widgets/src/components/Text/types.ts
rename to app/client/packages/design-system/widgets/src/components/Text/src/types.ts
index 69e2a166387b..d5ce9183e6bf 100644
--- a/app/client/packages/design-system/widgets/src/components/Text/types.ts
+++ b/app/client/packages/design-system/widgets/src/components/Text/src/types.ts
@@ -4,7 +4,7 @@ import type {
TypographyFontWeight,
} from "@design-system/theming";
import type { ReactNode } from "react";
-import type { OmitRename } from "../../utils";
+import type { OmitRename } from "../../../utils";
export interface TextProps {
/** Variant of the text
diff --git a/app/client/packages/storybook/stories/design-system/widgets/Text.stories.mdx b/app/client/packages/design-system/widgets/src/components/Text/stories/Text.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/Text.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/Text/stories/Text.stories.mdx
index a2c98a157bbd..13601df2fc7f 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/Text.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/Text/stories/Text.stories.mdx
@@ -1,10 +1,10 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
-import { Text, Flex } from "@design-system/widgets";
import {
TypographyVariant,
TypographyColor,
TypographyFontWeight,
} from "@design-system/theming";
+import { Text, Flex } from "@design-system/widgets";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/Widgets/Text"
diff --git a/app/client/packages/design-system/widgets/src/components/Text/Text.test.tsx b/app/client/packages/design-system/widgets/src/components/Text/tests/Text.test.tsx
similarity index 94%
rename from app/client/packages/design-system/widgets/src/components/Text/Text.test.tsx
rename to app/client/packages/design-system/widgets/src/components/Text/tests/Text.test.tsx
index 524714b8da84..dd105e0024c3 100644
--- a/app/client/packages/design-system/widgets/src/components/Text/Text.test.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Text/tests/Text.test.tsx
@@ -2,7 +2,7 @@ import React from "react";
import "@testing-library/jest-dom";
import { render, screen } from "@testing-library/react";
-import { Text } from "./Text";
+import { Text } from "../";
describe("@design-system/widgets/Text", () => {
it("should render the text", () => {
diff --git a/app/client/packages/storybook/chromatic/design-system/widgets/Tooltip.chromatic.stories.tsx b/app/client/packages/design-system/widgets/src/components/Tooltip/chromatic/Tooltip.chromatic.stories.tsx
similarity index 95%
rename from app/client/packages/storybook/chromatic/design-system/widgets/Tooltip.chromatic.stories.tsx
rename to app/client/packages/design-system/widgets/src/components/Tooltip/chromatic/Tooltip.chromatic.stories.tsx
index af7765f94937..6c82e9025037 100644
--- a/app/client/packages/storybook/chromatic/design-system/widgets/Tooltip.chromatic.stories.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Tooltip/chromatic/Tooltip.chromatic.stories.tsx
@@ -1,13 +1,12 @@
import React from "react";
-import type { Meta, StoryObj } from "@storybook/react";
-
import {
Button,
TooltipTrigger,
TooltipContent,
TooltipRoot as Tooltip,
} from "@design-system/widgets";
-import { StoryGrid } from "../../../helpers/StoryGrid";
+import { StoryGrid } from "@design-system/storybook";
+import type { Meta, StoryObj } from "@storybook/react";
const meta: Meta<typeof Tooltip> = {
component: Tooltip,
diff --git a/app/client/packages/design-system/widgets/src/components/Tooltip/index.ts b/app/client/packages/design-system/widgets/src/components/Tooltip/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/components/Tooltip/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/components/Tooltip/Tooltip.tsx b/app/client/packages/design-system/widgets/src/components/Tooltip/src/Tooltip.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Tooltip/Tooltip.tsx
rename to app/client/packages/design-system/widgets/src/components/Tooltip/src/Tooltip.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/Tooltip/TooltipContent.tsx b/app/client/packages/design-system/widgets/src/components/Tooltip/src/TooltipContent.tsx
similarity index 96%
rename from app/client/packages/design-system/widgets/src/components/Tooltip/TooltipContent.tsx
rename to app/client/packages/design-system/widgets/src/components/Tooltip/src/TooltipContent.tsx
index fdbb656c7533..40930837380f 100644
--- a/app/client/packages/design-system/widgets/src/components/Tooltip/TooltipContent.tsx
+++ b/app/client/packages/design-system/widgets/src/components/Tooltip/src/TooltipContent.tsx
@@ -1,15 +1,15 @@
-import { useThemeContext } from "@design-system/theming";
import React, { forwardRef } from "react";
+import { useThemeContext } from "@design-system/theming";
-const BORDER_RADIUS_THRESHOLD = 6;
-
-import { Text } from "../Text";
import type {
TooltipContentRef as HeadlessTooltipContentRef,
TooltipContentProps as HeadlessTooltipContentProps,
} from "@design-system/headless";
+import { Text } from "../../Text";
import { StyledTooltipContent } from "./index.styled";
+const BORDER_RADIUS_THRESHOLD = 6;
+
const _TooltipContent = (
props: HeadlessTooltipContentProps,
ref: HeadlessTooltipContentRef,
diff --git a/app/client/packages/design-system/widgets/src/components/Tooltip/TooltipTrigger.tsx b/app/client/packages/design-system/widgets/src/components/Tooltip/src/TooltipTrigger.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Tooltip/TooltipTrigger.tsx
rename to app/client/packages/design-system/widgets/src/components/Tooltip/src/TooltipTrigger.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/Tooltip/index.styled.tsx b/app/client/packages/design-system/widgets/src/components/Tooltip/src/index.styled.tsx
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Tooltip/index.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/Tooltip/src/index.styled.tsx
diff --git a/app/client/packages/design-system/widgets/src/components/Tooltip/index.tsx b/app/client/packages/design-system/widgets/src/components/Tooltip/src/index.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/components/Tooltip/index.tsx
rename to app/client/packages/design-system/widgets/src/components/Tooltip/src/index.ts
diff --git a/app/client/packages/storybook/stories/design-system/widgets/Tooltip.stories.mdx b/app/client/packages/design-system/widgets/src/components/Tooltip/stories/Tooltip.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/Tooltip.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/Tooltip/stories/Tooltip.stories.mdx
index e96da7d82465..6a4796b2c1ae 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/Tooltip.stories.mdx
+++ b/app/client/packages/design-system/widgets/src/components/Tooltip/stories/Tooltip.stories.mdx
@@ -1,4 +1,3 @@
-import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
import {
Button,
ButtonGroup,
@@ -7,6 +6,7 @@ import {
TooltipContent,
Tooltip,
} from "@design-system/widgets";
+import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
<Meta
title="Design-system/Widgets/Tooltip"
diff --git a/app/client/packages/storybook/stories/design-system/widgets/testing/ColorGrid.stories.mdx b/app/client/packages/design-system/widgets/src/components/testing/ColorGrid.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/testing/ColorGrid.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/testing/ColorGrid.stories.mdx
diff --git a/app/client/packages/storybook/stories/design-system/widgets/testing/ColorGrid.styled.tsx b/app/client/packages/design-system/widgets/src/components/testing/ColorGrid.styled.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/testing/ColorGrid.styled.tsx
rename to app/client/packages/design-system/widgets/src/components/testing/ColorGrid.styled.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets/testing/ColorGrid.tsx b/app/client/packages/design-system/widgets/src/components/testing/ColorGrid.tsx
similarity index 98%
rename from app/client/packages/storybook/stories/design-system/widgets/testing/ColorGrid.tsx
rename to app/client/packages/design-system/widgets/src/components/testing/ColorGrid.tsx
index 0c2d42c54de3..556129d7a4c2 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/testing/ColorGrid.tsx
+++ b/app/client/packages/design-system/widgets/src/components/testing/ColorGrid.tsx
@@ -50,6 +50,7 @@ const getTestObj = (steps: number, source: "oklch" | "hex") => {
return obj;
};
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const ColorGrid = (props: any) => {
const {
children,
diff --git a/app/client/packages/storybook/stories/design-system/widgets/testing/CompareTokens.stories.mdx b/app/client/packages/design-system/widgets/src/components/testing/CompareTokens.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/testing/CompareTokens.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/testing/CompareTokens.stories.mdx
diff --git a/app/client/packages/storybook/stories/design-system/widgets/testing/CompareTokens.tsx b/app/client/packages/design-system/widgets/src/components/testing/CompareTokens.tsx
similarity index 98%
rename from app/client/packages/storybook/stories/design-system/widgets/testing/CompareTokens.tsx
rename to app/client/packages/design-system/widgets/src/components/testing/CompareTokens.tsx
index 2b76c196d3da..3e4bea0583e4 100644
--- a/app/client/packages/storybook/stories/design-system/widgets/testing/CompareTokens.tsx
+++ b/app/client/packages/design-system/widgets/src/components/testing/CompareTokens.tsx
@@ -11,6 +11,7 @@ export const CompareTokens = () => {
const [rightBd, setRightBd] = useState<string>();
const theme = useThemeContext();
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
const color = theme?.color as any;
return (
diff --git a/app/client/packages/storybook/stories/design-system/widgets/testing/ComplexForm.stories.mdx b/app/client/packages/design-system/widgets/src/components/testing/ComplexForm.stories.mdx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/testing/ComplexForm.stories.mdx
rename to app/client/packages/design-system/widgets/src/components/testing/ComplexForm.stories.mdx
diff --git a/app/client/packages/storybook/stories/design-system/widgets/testing/ComplexForm.tsx b/app/client/packages/design-system/widgets/src/components/testing/ComplexForm.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/testing/ComplexForm.tsx
rename to app/client/packages/design-system/widgets/src/components/testing/ComplexForm.tsx
diff --git a/app/client/packages/storybook/stories/design-system/widgets/testing/colors.ts b/app/client/packages/design-system/widgets/src/components/testing/colors.ts
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/widgets/testing/colors.ts
rename to app/client/packages/design-system/widgets/src/components/testing/colors.ts
diff --git a/app/client/packages/design-system/widgets/src/index.ts b/app/client/packages/design-system/widgets/src/index.ts
index f3ea2263e1be..b986b537ca9c 100644
--- a/app/client/packages/design-system/widgets/src/index.ts
+++ b/app/client/packages/design-system/widgets/src/index.ts
@@ -12,4 +12,7 @@ export * from "./components/Radio";
export * from "./components/RadioGroup";
export * from "./components/Switch";
export * from "./components/SwitchGroup";
+export * from "./components/Spinner";
+
export * from "./utils";
+export * from "./styles";
diff --git a/app/client/packages/design-system/widgets/src/styles/index.ts b/app/client/packages/design-system/widgets/src/styles/index.ts
new file mode 100644
index 000000000000..3bd16e178a03
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/styles/index.ts
@@ -0,0 +1 @@
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/styles/fieldStyles.ts b/app/client/packages/design-system/widgets/src/styles/src/fieldStyles.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/styles/fieldStyles.ts
rename to app/client/packages/design-system/widgets/src/styles/src/fieldStyles.ts
diff --git a/app/client/packages/design-system/widgets/src/styles/src/index.ts b/app/client/packages/design-system/widgets/src/styles/src/index.ts
new file mode 100644
index 000000000000..dab951dd1546
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/styles/src/index.ts
@@ -0,0 +1,2 @@
+export { fieldStyles } from "./fieldStyles";
+export { inlineLabelStyles } from "./inlineLabelStyles";
diff --git a/app/client/packages/design-system/widgets/src/styles/inlineLabelStyles.ts b/app/client/packages/design-system/widgets/src/styles/src/inlineLabelStyles.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/styles/inlineLabelStyles.ts
rename to app/client/packages/design-system/widgets/src/styles/src/inlineLabelStyles.ts
diff --git a/app/client/packages/design-system/widgets/src/utils/index.ts b/app/client/packages/design-system/widgets/src/utils/index.ts
index f21d71999e60..3bd16e178a03 100644
--- a/app/client/packages/design-system/widgets/src/utils/index.ts
+++ b/app/client/packages/design-system/widgets/src/utils/index.ts
@@ -1,2 +1 @@
-export type { PickRename } from "./PickRename";
-export type { OmitRename } from "./OmitRename";
+export * from "./src";
diff --git a/app/client/packages/design-system/widgets/src/utils/OmitRename.ts b/app/client/packages/design-system/widgets/src/utils/src/OmitRename.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/utils/OmitRename.ts
rename to app/client/packages/design-system/widgets/src/utils/src/OmitRename.ts
diff --git a/app/client/packages/design-system/widgets/src/utils/PickRename.ts b/app/client/packages/design-system/widgets/src/utils/src/PickRename.ts
similarity index 100%
rename from app/client/packages/design-system/widgets/src/utils/PickRename.ts
rename to app/client/packages/design-system/widgets/src/utils/src/PickRename.ts
diff --git a/app/client/packages/design-system/widgets/src/utils/src/index.ts b/app/client/packages/design-system/widgets/src/utils/src/index.ts
new file mode 100644
index 000000000000..f21d71999e60
--- /dev/null
+++ b/app/client/packages/design-system/widgets/src/utils/src/index.ts
@@ -0,0 +1,2 @@
+export type { PickRename } from "./PickRename";
+export type { OmitRename } from "./OmitRename";
diff --git a/app/client/packages/storybook/.storybook/main.ts b/app/client/packages/storybook/.storybook/main.ts
index f370f4e5a73d..5a26edb6b275 100644
--- a/app/client/packages/storybook/.storybook/main.ts
+++ b/app/client/packages/storybook/.storybook/main.ts
@@ -3,12 +3,12 @@ import svgr from "vite-plugin-svgr";
function getStories() {
if (process.env.CHROMATIC) {
- return ["../chromatic/**/*.chromatic.stories.@(js|jsx|ts|tsx)"];
+ return ["../../design-system/**/*.chromatic.stories.@(js|jsx|ts|tsx)"];
}
return [
- "../stories/**/*.stories.mdx",
- "../stories/**/*.stories.@(js|jsx|ts|tsx)",
+ "../../design-system/**/*.stories.mdx",
+ "../../design-system/**/*.stories.@(js|jsx|ts|tsx)",
];
}
diff --git a/app/client/packages/storybook/stories/design-system/theming/components/CopyLink.tsx b/app/client/packages/storybook/src/components/CopyLink.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/theming/components/CopyLink.tsx
rename to app/client/packages/storybook/src/components/CopyLink.tsx
diff --git a/app/client/packages/storybook/helpers/DataAttrWrapper.tsx b/app/client/packages/storybook/src/components/DataAttrWrapper.tsx
similarity index 93%
rename from app/client/packages/storybook/helpers/DataAttrWrapper.tsx
rename to app/client/packages/storybook/src/components/DataAttrWrapper.tsx
index 121a2292e582..055ee39cf7f8 100644
--- a/app/client/packages/storybook/helpers/DataAttrWrapper.tsx
+++ b/app/client/packages/storybook/src/components/DataAttrWrapper.tsx
@@ -10,6 +10,7 @@ export const DataAttrWrapper = (props: DataAttrWrapperProps) => {
// Adding any type here because WDS components has different types for ref
// some are HTMLElement and some are objects only ( For e.g - CheckboxRef )
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
const ref = useRef<any>(null);
useEffect(() => {
diff --git a/app/client/packages/storybook/helpers/StoryGrid.tsx b/app/client/packages/storybook/src/components/StoryGrid.tsx
similarity index 100%
rename from app/client/packages/storybook/helpers/StoryGrid.tsx
rename to app/client/packages/storybook/src/components/StoryGrid.tsx
diff --git a/app/client/packages/storybook/stories/design-system/theming/components/TokenTable.tsx b/app/client/packages/storybook/src/components/TokenTable.tsx
similarity index 100%
rename from app/client/packages/storybook/stories/design-system/theming/components/TokenTable.tsx
rename to app/client/packages/storybook/src/components/TokenTable.tsx
diff --git a/app/client/packages/storybook/src/index.ts b/app/client/packages/storybook/src/index.ts
new file mode 100644
index 000000000000..4122a19ed958
--- /dev/null
+++ b/app/client/packages/storybook/src/index.ts
@@ -0,0 +1,4 @@
+export * from "./components/TokenTable";
+export { CopyLink } from "./components/CopyLink";
+export { StoryGrid } from "./components/StoryGrid";
+export { DataAttrWrapper } from "./components/DataAttrWrapper";
diff --git a/app/client/packages/storybook/stories/design-system/theming/components/index.ts b/app/client/packages/storybook/stories/design-system/theming/components/index.ts
deleted file mode 100644
index aedc68c2781d..000000000000
--- a/app/client/packages/storybook/stories/design-system/theming/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./TokenTable";
diff --git a/app/client/yarn.lock b/app/client/yarn.lock
index 2e45ab992469..67962cea2b33 100644
--- a/app/client/yarn.lock
+++ b/app/client/yarn.lock
@@ -2312,7 +2312,7 @@ __metadata:
languageName: unknown
linkType: soft
-"@design-system/storybook@workspace:packages/storybook":
+"@design-system/storybook@workspace:^, @design-system/storybook@workspace:packages/storybook":
version: 0.0.0-use.local
resolution: "@design-system/storybook@workspace:packages/storybook"
dependencies:
@@ -9806,6 +9806,7 @@ __metadata:
"@blueprintjs/popover2": ^0.5.0
"@blueprintjs/select": ^3.10.0
"@craco/craco": ^7.0.0
+ "@design-system/storybook": "workspace:^"
"@design-system/theming": "workspace:^"
"@design-system/widgets": "workspace:^"
"@design-system/widgets-old": "workspace:^"
|
8a7845065952584c5618765d54e0918e54ed97b3
|
2023-03-13 22:59:58
|
Nilansh Bansal
|
chore: fix flaky test publishApplication_withPageIconSet_success (#21355)
| false
|
fix flaky test publishApplication_withPageIconSet_success (#21355)
|
chore
|
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ApplicationServiceCETest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ApplicationServiceCETest.java
index 9a699bae0d91..fbf93f66cd48 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ApplicationServiceCETest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ApplicationServiceCETest.java
@@ -2448,6 +2448,7 @@ public void publishApplication_withPageIconSet_success() {
page.setIcon("flight");
page.setApplicationId(testApplication.getId());
page = applicationPageService.createPage(page).block();
+ applicationPageService.reorderPage(testApplication.getId(), page.getId(), 1, null).block();
Mono<Application> applicationMono = applicationPageService.publish(testApplication.getId(), true);
|
05c2b7eca74f07e6307ada686a59a27841676199
|
2023-08-03 12:42:30
|
Vijetha-Kaja
|
test: Cypress - Flaky Fix (#25937)
| false
|
Cypress - Flaky Fix (#25937)
|
test
|
diff --git a/app/client/cypress/e2e/Regression/ClientSide/AdminSettings/Admin_settings_spec.js b/app/client/cypress/e2e/Regression/ClientSide/AdminSettings/Admin_settings_spec.js
index 8d4e9bb9c6bf..d07a87d64174 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/AdminSettings/Admin_settings_spec.js
+++ b/app/client/cypress/e2e/Regression/ClientSide/AdminSettings/Admin_settings_spec.js
@@ -31,7 +31,7 @@ describe("Admin settings page", function () {
it("2. Should test that settings page is not accessible to normal users", () => {
cy.wait(2000);
- cy.LoginFromAPI(Cypress.env("TESTUSERNAME1"), Cypress.env("TESTPASSWORD1"));
+ cy.LoginFromAPI(Cypress.env("TESTUSERNAME3"), Cypress.env("TESTPASSWORD3"));
cy.get(".admin-settings-menu-option").should("not.exist");
cy.visit("/settings/general", { timeout: 60000 });
// non super users are redirected to home page
diff --git a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Admin_settings_2_spec.js b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Admin_settings_2_spec.js
index 4da3685cf5d7..70020fe1e654 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Admin_settings_2_spec.js
+++ b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Admin_settings_2_spec.js
@@ -146,7 +146,7 @@ describe("Admin settings page", function () {
it("6. should test that settings page is not accessible to normal users", () => {
cy.LogOut();
cy.wait(2000);
- cy.LoginFromAPI(Cypress.env("TESTUSERNAME1"), Cypress.env("TESTPASSWORD1"));
+ cy.LoginFromAPI(Cypress.env("TESTUSERNAME3"), Cypress.env("TESTPASSWORD3"));
cy.get(".admin-settings-menu-option").should("not.exist");
cy.visit(routes.GENERAL, { timeout: 60000 });
// non super users are redirected to home page
diff --git a/app/client/cypress/e2e/Sanity/Datasources/AuthenticatedApiDatasource_spec.js b/app/client/cypress/e2e/Sanity/Datasources/AuthenticatedApiDatasource_spec.js
index 65e21acb99f2..127d13de43ce 100644
--- a/app/client/cypress/e2e/Sanity/Datasources/AuthenticatedApiDatasource_spec.js
+++ b/app/client/cypress/e2e/Sanity/Datasources/AuthenticatedApiDatasource_spec.js
@@ -41,28 +41,23 @@ describe("Authenticated API Datasource", function () {
dataSources.DeleteDatasouceFromActiveTab(dsName);
});
- //skipping this test as it is failing in pipeline - "authorizationURL": "https://oauth.mocklab.io/oauth/authorize",
- it.skip("4. Bug: 18051 - Save and Authorise should return to datasource page in view mode and not new datasource page", () => {
- cy.NavigateToAPI_Panel();
- cy.get(apiwidget.createAuthApiDatasource).click();
- cy.generateUUID().then((uuid) => {
- cy.renameDatasource(uuid);
- cy.fillAuthenticatedAPIForm();
- dataSources.AddOAuth2AuthorizationCodeDetails(
- testdata.accessTokenUrl,
- testdata.clientID,
- testdata.clientSecret,
- testdata.authorizationURL,
- );
- dataSources.AuthAPISaveAndAuthorize();
- cy.xpath('//input[@name="email"]').type("[email protected]");
- cy.xpath('//input[@name="email"]').type("Test");
- cy.xpath("//input[@name='password']").type("Test@123");
- cy.xpath("//input[@id='login-submit']").click();
- cy.wait(2000);
- cy.reload();
- cy.get(".t--edit-datasource").should("be.visible");
- dataSources.DeleteDatasouceFromActiveTab(uuid);
+ it("4. Bug: 18051 - Save and Authorise should return to datasource page in view mode and not new datasource page", () => {
+ dataSources.CreateOAuthClient("authorization_code");
+ agHelper.GenerateUUID();
+ cy.get("@guid").then((uid) => {
+ cy.get("@OAuthClientID").then((clientId) => {
+ cy.get("@OAuthClientSecret").then((clientSecret) => {
+ dataSources.CreateOAuthDatasource(
+ "TED_OAuth" + uid,
+ "AuthCode",
+ clientId,
+ clientSecret,
+ );
+ agHelper.RefreshPage();
+ agHelper.AssertElementVisible(dataSources._editButton);
+ dataSources.DeleteDatasouceFromActiveTab("TED_OAuth" + uid);
+ });
+ });
});
});
});
diff --git a/app/client/cypress/e2e/Sanity/Datasources/AuthenticatedApiWithOAuth_spec.ts b/app/client/cypress/e2e/Sanity/Datasources/AuthenticatedApiWithOAuth_spec.ts
index 539367e42276..f7deaf1ba4b1 100644
--- a/app/client/cypress/e2e/Sanity/Datasources/AuthenticatedApiWithOAuth_spec.ts
+++ b/app/client/cypress/e2e/Sanity/Datasources/AuthenticatedApiWithOAuth_spec.ts
@@ -2,33 +2,33 @@ import {
agHelper,
apiPage,
dataSources,
+ tedTestConfig,
} from "../../../support/Objects/ObjectsCore";
describe("Authentiacted Api with OAuth 2.O authorization code test cases", function () {
it("1. Create & Save an Authenticated API with OAuth 2.O authorization code", function () {
// Create OAuth client
- cy.fixture("datasources").then((datasourceFormData: any) => {
- dataSources.CreateOAuthClient("authorization_code");
- // Create datasource
- agHelper.GenerateUUID();
- cy.get("@guid").then((uid) => {
- cy.get("@OAuthClientID").then((clientId: any) => {
- cy.get("@OAuthClientSecret").then((clientSecret: any) => {
- dataSources.CreateOAuthDatasource(
- "TED_OAuth" + uid,
- "AuthCode",
- clientId,
- clientSecret,
- );
- //Create API from datasource
- apiPage.CreateAndFillApi(
- datasourceFormData["OAuth_ApiUrl"] + "/api/echo/get?ASDSA=ASDSA",
- "EchoOauth",
- 10000,
- "GET",
- true,
- );
- });
+ dataSources.CreateOAuthClient("authorization_code");
+ // Create datasource
+ agHelper.GenerateUUID();
+ cy.get("@guid").then((uid) => {
+ cy.get("@OAuthClientID").then((clientId: any) => {
+ cy.get("@OAuthClientSecret").then((clientSecret: any) => {
+ dataSources.CreateOAuthDatasource(
+ "TED_OAuth" + uid,
+ "AuthCode",
+ clientId,
+ clientSecret,
+ );
+ //Create API from datasource
+ apiPage.CreateAndFillApi(
+ tedTestConfig.dsValues[tedTestConfig.defaultEnviorment]
+ .OAuth_ApiUrl + "/api/echo/get?ASDSA=ASDSA",
+ "EchoOauth",
+ 10000,
+ "GET",
+ true,
+ );
});
});
});
diff --git a/app/client/cypress/e2e/Sanity/Datasources/RestApiOAuth2Validation_spec.js b/app/client/cypress/e2e/Sanity/Datasources/RestApiOAuth2Validation_spec.js
deleted file mode 100644
index 80b7a7fe0f37..000000000000
--- a/app/client/cypress/e2e/Sanity/Datasources/RestApiOAuth2Validation_spec.js
+++ /dev/null
@@ -1,59 +0,0 @@
-const testdata = require("../../../fixtures/testdata.json");
-const datasource = require("../../../locators/DatasourcesEditor.json");
-import {
- agHelper,
- entityExplorer,
- entityItems,
- apiPage,
- dataSources,
-} from "../../../support/Objects/ObjectsCore";
-
-describe("Datasource form OAuth2 client credentials related tests", function () {
- it("1. Create an API with app url and save as Datasource for Client Credentials test", function () {
- apiPage.CreateAndFillApi(testdata.appUrl, "TestOAuth");
- agHelper.GetNClick(apiPage._saveAsDS);
-
- // Add Oauth details to datasource and save
- cy.get(datasource.saveBtn).should("not.be.disabled");
- dataSources.AddOAuth2AuthorizationCodeDetails(
- testdata.accessTokenUrl,
- testdata.clientID,
- testdata.clientSecret,
- testdata.oauth2Scopes,
- );
-
- // since we are moving to different, it will show unsaved changes dialog
- // save datasource and then proceed
- dataSources.SaveDatasource();
- agHelper.ValidateToastMessage("datasource created"); //verifying there is no error toast, Bug 14566
- entityExplorer.SelectEntityByName("TestOAuth", "Queries/JS");
- agHelper.ActionContextMenuWithInPane({
- action: "Delete",
- entityType: entityItems.Api,
- });
- });
-
- it("2. Create an API with app url and save as Datasource for Authorization code details test", function () {
- apiPage.CreateAndFillApi(testdata.appUrl, "TestOAuth");
- agHelper.GetNClick(apiPage._saveAsDS);
- //Add Oauth details to datasource and save
- cy.get(datasource.saveBtn).should("not.be.disabled");
- dataSources.AddOAuth2AuthorizationCodeDetails(
- testdata.accessTokenUrl,
- testdata.clientID,
- testdata.clientSecret,
- testdata.authorizationURL,
- );
- });
-
- //skipping this test as it is failing in pipeline - "authorizationURL": "https://oauth.mocklab.io/oauth/authorize",
- it.skip("3. Validate save and Authorise", function () {
- cy.get(datasource.saveAndAuthorize).click();
- cy.contains("#login-submit", "Login");
- cy.url().should("include", "oauth.mocklab.io/oauth/authorize");
- cy.xpath('//input[@name="email"]').type("[email protected]");
- cy.xpath('//input[@name="email"]').type("Test");
- cy.xpath("//input[@name='password']").type("Test@123");
- cy.xpath("//input[@id='login-submit']").click();
- });
-});
diff --git a/app/client/cypress/e2e/Sanity/Datasources/RestApiOAuth2Validation_spec.ts b/app/client/cypress/e2e/Sanity/Datasources/RestApiOAuth2Validation_spec.ts
new file mode 100644
index 000000000000..c23db7dd33f6
--- /dev/null
+++ b/app/client/cypress/e2e/Sanity/Datasources/RestApiOAuth2Validation_spec.ts
@@ -0,0 +1,76 @@
+import {
+ agHelper,
+ assertHelper,
+ entityExplorer,
+ entityItems,
+ apiPage,
+ dataSources,
+ tedTestConfig,
+} from "../../../support/Objects/ObjectsCore";
+
+describe("Datasource form OAuth2 client credentials related tests", function () {
+ let clientId, clientSecret;
+ it("1. Create an API with app url and save as Datasource for Client Credentials test", function () {
+ dataSources.CreateOAuthClient("authorization_code");
+ apiPage.CreateAndFillApi(
+ tedTestConfig.dsValues[tedTestConfig.defaultEnviorment].OAuth_ApiUrl +
+ "/api/echo/get?ASDSA=ASDSA",
+ "TestOAuth",
+ );
+ agHelper.GetNClick(apiPage._saveAsDS);
+
+ // Add Oauth details to datasource and save
+ agHelper.AssertElementEnabledDisabled(dataSources._saveDs, 0, false);
+ cy.get("@OAuthClientID").then((id) => {
+ cy.get("@OAuthClientSecret").then((secret) => {
+ clientId = id;
+ clientSecret = secret;
+ dataSources.AddOAuth2AuthorizationCodeDetails(
+ tedTestConfig.dsValues[tedTestConfig.defaultEnviorment]
+ .OAUth_AccessTokenUrl,
+ clientId,
+ clientSecret,
+ "profile",
+ );
+ });
+ });
+ // since we are moving to different, it will show unsaved changes dialog
+ // save datasource and then proceed
+ dataSources.SaveDatasource();
+ agHelper.ValidateToastMessage("datasource created"); //verifying there is no error toast, Bug 14566
+ entityExplorer.SelectEntityByName("TestOAuth", "Queries/JS");
+ agHelper.ActionContextMenuWithInPane({
+ action: "Delete",
+ entityType: entityItems.Api,
+ });
+ });
+
+ it("2. Create an API with app url and save as Datasource for Authorization code details test", function () {
+ apiPage.CreateAndFillApi(
+ tedTestConfig.dsValues[tedTestConfig.defaultEnviorment].OAuth_ApiUrl +
+ "/api/echo/get?ASDSA=ASDSA",
+ "TestOAuth",
+ );
+ agHelper.GetNClick(apiPage._saveAsDS);
+ //Add Oauth details to datasource and save
+ agHelper.AssertElementEnabledDisabled(dataSources._saveDs, 0, false);
+ dataSources.AddOAuth2AuthorizationCodeDetails(
+ tedTestConfig.dsValues[tedTestConfig.defaultEnviorment]
+ .OAUth_AccessTokenUrl,
+ clientId,
+ clientSecret,
+ tedTestConfig.dsValues[tedTestConfig.defaultEnviorment].OAuth_AuthUrl,
+ );
+ });
+
+ it("3. Validate save and Authorise", function () {
+ agHelper.GetNClick(dataSources._saveAndAuthorizeDS);
+
+ //Accept consent
+ agHelper.GetNClick(dataSources._consent);
+ agHelper.GetNClick(dataSources._consentSubmit);
+
+ //Validate save
+ assertHelper.AssertNetworkStatus("@saveDatasource", 201);
+ });
+});
diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts
index f9cd634e76fe..87b874a6ff85 100644
--- a/app/client/cypress/support/Pages/DataSources.ts
+++ b/app/client/cypress/support/Pages/DataSources.ts
@@ -209,8 +209,8 @@ export class DataSources {
private _grantType = "[data-testid='authentication.grantType']";
private _authorizationURL =
"[data-testid='authentication.authorizationUrl'] input";
- private _consent = '[name="confirm"]';
- private _consentSubmit = "//button[text()='Submit']";
+ _consent = '[name="confirm"]';
+ _consentSubmit = "//button[text()='Submit']";
public _datasourceModalSave = ".t--datasource-modal-save";
public _datasourceModalDoNotSave = ".t--datasource-modal-do-not-save";
public _cancelEditDatasourceButton = ".t--cancel-edit-datasource";
|
def8f5c03a5d1cb2f3a29030bc9f686ae1cdde95
|
2022-10-07 23:50:44
|
Kishore
|
fix: Arango plugin: change default db name to _system (#16198)
| false
|
Arango plugin: change default db name to _system (#16198)
|
fix
|
diff --git a/app/server/appsmith-plugins/arangoDBPlugin/src/main/resources/form.json b/app/server/appsmith-plugins/arangoDBPlugin/src/main/resources/form.json
index 36b4681aefa8..f8093eb5140d 100644
--- a/app/server/appsmith-plugins/arangoDBPlugin/src/main/resources/form.json
+++ b/app/server/appsmith-plugins/arangoDBPlugin/src/main/resources/form.json
@@ -27,7 +27,7 @@
"configProperty": "datasourceConfiguration.authentication.databaseName",
"controlType": "INPUT_TEXT",
"placeholderText": "Database name",
- "initialValue": "default"
+ "initialValue": "_system"
}
]
},
|
166e0fad86a05cb0b57926eaa83a4e87e1862566
|
2023-08-08 16:24:10
|
sharanya-appsmith
|
test: Cypress - progress widget cases (#25981)
| false
|
Cypress - progress widget cases (#25981)
|
test
|
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/Progress_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/Progress_spec.js
index 1aeeff5a9e50..15900d587aea 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/Progress_spec.js
+++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/Progress_spec.js
@@ -1,17 +1,23 @@
-const explorer = require("../../../../../locators/explorerlocators.json");
+const widgets = require("../../../../../locators/Widgets.json");
+import {
+ agHelper,
+ deployMode,
+ draggableWidgets,
+ entityExplorer,
+ fakerHelper,
+ propPane,
+} from "../../../../../support/Objects/ObjectsCore";
+import { progressWidgetProgress } from "../../../../../locators/WidgetLocators";
describe("Progress Widget", function () {
- it("Add a new Progress widget and text widget", function () {
- cy.get(explorer.addWidget).click();
- cy.dragAndDropToCanvas("progresswidget", { x: 300, y: 300 });
- cy.get(".t--widget-progresswidget").should("exist");
- cy.dragAndDropToCanvas("textwidget", { x: 300, y: 500 });
- cy.openPropertyPane("textwidget");
- cy.updateCodeInput(".t--property-control-text", "");
+ before(() => {
+ entityExplorer.DragDropWidgetNVerify(draggableWidgets.PROGRESS);
+ entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 500, 200);
+ propPane.UpdatePropertyFieldValue("Text", "");
});
// Linear progress
- it("Property: isIndeterminate, Toggle infinite loading", function () {
+ it("1. Property: isIndeterminate, Toggle infinite loading", function () {
cy.openPropertyPane("progresswidget");
// enable infinite loading
cy.togglebar(".t--property-control-infiniteloading input[type='checkbox']");
@@ -26,7 +32,7 @@ describe("Progress Widget", function () {
// show determinate linear progress
cy.get("[data-testid='50']").should("exist");
});
- it("Property: value, Change progress value", function () {
+ it("2.Property: value, Change progress value", function () {
cy.updateCodeInput(".t--property-control-progress", "60");
cy.wait("@updateLayout").should(
"have.nested.property",
@@ -36,7 +42,7 @@ describe("Progress Widget", function () {
// pass 60
cy.get("[data-testid='60']").should("exist");
});
- it("Property: showResult, Toggle show result", function () {
+ it("3. Property: showResult, Toggle show result", function () {
// enable show result
cy.togglebar(".t--property-control-showresult input[type='checkbox']");
// show label
@@ -48,7 +54,7 @@ describe("Progress Widget", function () {
// does not show any label
cy.get("[data-testid='60']").first().next().should("not.exist");
});
- it("Property: steps, Change steps", function () {
+ it("4. Property: steps, Change steps", function () {
cy.updateCodeInput(".t--property-control-numberofsteps", "2");
// show progress with steps
cy.get("[data-testid='step']").should("have.length", 2);
@@ -58,12 +64,12 @@ describe("Progress Widget", function () {
});
// Circular progress
- it("Property: type, Change type to Circular", function () {
+ it("5. Property: type, Change type to Circular", function () {
// Switch to circular mode
cy.get("[data-value='circular']").click({ force: true });
cy.get("[data-testid='circular']").should("exist");
});
- it("Property: isIndeterminate, Toggle infinite loading", function () {
+ it("6. Property: isIndeterminate, Toggle infinite loading", function () {
cy.openPropertyPane("progresswidget");
// enable infinite loading
cy.togglebar(".t--property-control-infiniteloading input[type='checkbox']");
@@ -81,7 +87,7 @@ describe("Progress Widget", function () {
200,
);
});
- it("Property: value, Change progress value", function () {
+ it("7. Property: value, Change progress value", function () {
cy.updateCodeInput(".t--property-control-progress", "50");
cy.wait("@updateLayout").should(
"have.nested.property",
@@ -91,7 +97,7 @@ describe("Progress Widget", function () {
// The path element with 50 should exist
cy.get("[data-testvalue='50']").should("exist");
});
- it("Property: showResult, Toggle show result", function () {
+ it("8. Property: showResult, Toggle show result", function () {
// enable show result
cy.togglebar(".t--property-control-showresult input[type='checkbox']");
// show label
@@ -103,7 +109,7 @@ describe("Progress Widget", function () {
// does not show any label
cy.get("[data-testid='circular-label']").should("not.exist");
});
- it("Property: steps, Change steps", function () {
+ it("9. Property: steps, Change steps", function () {
cy.updateCodeInput(".t--property-control-numberofsteps", "2");
// show circular progress with steps
cy.get("[data-testid='separator']").should("have.length", 2);
@@ -111,7 +117,7 @@ describe("Progress Widget", function () {
// does not show progress with steps
cy.get("[data-testid='separator']").should("not.exist");
});
- it("Property: counterClockwise,Change counterclockwise", function () {
+ it("10. Property: counterClockwise,Change counterclockwise", function () {
// enable counterclockwise
cy.togglebar(
".t--property-control-counterclockwise input[type='checkbox']",
@@ -130,7 +136,7 @@ describe("Progress Widget", function () {
.should("not.match", /-/);
});
- it("The binding property, progress should be exposed for an auto suggestion", function () {
+ it("11. The binding property, progress should be exposed for an auto suggestion", function () {
cy.openPropertyPane("textwidget");
cy.get(".t--property-control-text .CodeMirror textarea").type(
"{{Progress1.",
@@ -138,4 +144,52 @@ describe("Progress Widget", function () {
);
cy.get("ul.CodeMirror-hints").contains("progress").should("exist");
});
+
+ it("12. Check Progress, Number of steps, Counterclockwise, Show result disabled on infite looping enablement", function () {
+ // on enabling infite loading assert the absence of elements
+ agHelper.GetNClick(widgets.progressWidget);
+ propPane.TogglePropertyState("Infinite loading", "On");
+ agHelper.AssertElementAbsence(propPane._labelContains("Progress"));
+ agHelper.AssertElementAbsence(propPane._labelContains("Number of steps"));
+ agHelper.AssertElementAbsence(propPane._labelContains("Counterclockwise"));
+ agHelper.AssertElementAbsence(propPane._labelContains("Show result"));
+ propPane.TogglePropertyState("Infinite loading", "Off");
+ });
+
+ it("13. Check binding in Progress ", function () {
+ agHelper.GetNClick(widgets.linearProgressWidget);
+ entityExplorer.DragDropWidgetNVerify(draggableWidgets.INPUT_V2, 600, 100);
+ agHelper.GetNClick(widgets.progressWidget);
+ // assert error texts in Progress property
+ propPane.UpdatePropertyFieldValue("Progress", "-1");
+ agHelper.VerifyEvaluatedErrorMessage("Minimum allowed value: 0");
+ propPane.UpdatePropertyFieldValue("Progress", fakerHelper.GetRandomText());
+ agHelper.VerifyEvaluatedErrorMessage(
+ "This value does not evaluate to type number Max: 100",
+ );
+ propPane.UpdatePropertyFieldValue("Progress", "101");
+ agHelper.VerifyEvaluatedErrorMessage("Maximum allowed value: 100");
+ // set input entered in text widget to progress
+ propPane.UpdatePropertyFieldValue("Progress", "{{Input1.text}}");
+ deployMode.DeployApp();
+ agHelper.EnterInputText("Label", "10");
+ // assert if the text in text widget is reflected in progress bar
+ agHelper.AssertElementExist(progressWidgetProgress("10"));
+ agHelper.EnterInputText("Label", "20", true);
+ agHelper.AssertElementExist(progressWidgetProgress("20"));
+ deployMode.NavigateBacktoEditor();
+ });
+
+ it("14. Check progress widget visibility based on visible state - Deploy mode", function () {
+ agHelper.GetNClick(widgets.progressWidget);
+ propPane.TogglePropertyState("Visible", "Off");
+ deployMode.DeployApp();
+ agHelper.AssertElementAbsence(widgets.progressWidget);
+ deployMode.NavigateBacktoEditor();
+ agHelper.GetNClick(widgets.progressWidget);
+ propPane.TogglePropertyState("Visible", "On");
+ deployMode.DeployApp();
+ agHelper.AssertElementExist(widgets.progressWidget);
+ agHelper.GetNClick(widgets.progressWidget);
+ });
});
diff --git a/app/client/cypress/locators/WidgetLocators.ts b/app/client/cypress/locators/WidgetLocators.ts
index ac9cf76032c1..037f00db226e 100644
--- a/app/client/cypress/locators/WidgetLocators.ts
+++ b/app/client/cypress/locators/WidgetLocators.ts
@@ -66,3 +66,8 @@ export const getWidgetInputSelector = (widget: ValueOf<typeof WIDGET>) =>
`.t--widget-${widget} input`;
export const modalWidgetSelector = ".t--modal-widget";
+
+// export data-testid with user input
+export const progressWidgetProgress = (input: any) => `[data-testid='${input}']`
+
+
diff --git a/app/client/cypress/locators/Widgets.json b/app/client/cypress/locators/Widgets.json
index 629bea1a71e4..e5e60b130775 100644
--- a/app/client/cypress/locators/Widgets.json
+++ b/app/client/cypress/locators/Widgets.json
@@ -200,5 +200,8 @@
"filepickerwidgetv2CloseModalBtn": "button.uppy-Dashboard-close",
"codescannerwidget": ".t--widget-codescannerwidget",
"widgetNameSpan": ".t--widget-propertypane-toggle > .t--widget-name",
- "listWidgetv2": ".t--widget-listwidgetv2"
+ "listWidgetv2": ".t--widget-listwidgetv2",
+ "progressWidget":".t--widget-progresswidget",
+ "circularProgressWidget":"[data-value='circular']",
+ "linearProgressWidget": "[data-value='linear']"
}
diff --git a/app/client/cypress/support/Pages/PropertyPane.ts b/app/client/cypress/support/Pages/PropertyPane.ts
index 78bdd7367bfa..181aaaf610aa 100644
--- a/app/client/cypress/support/Pages/PropertyPane.ts
+++ b/app/client/cypress/support/Pages/PropertyPane.ts
@@ -121,7 +121,7 @@ export class PropertyPane {
_autoHeightLimitMin_div =
"[data-testid='t--auto-height-overlay-handles-min'] div";
_autoHeightLimitMax = "[data-testid='t--auto-height-overlay-handles-max']";
- _labelContains = (value: string) => `label:Contains('${value}')`;
+ public _labelContains = (value: string) => `label:Contains('${value}')`;
_showColumnButton = ".t--show-column-btn";
_propertyPaneHeightLabel =
".t--property-pane-section-general .t--property-control-label:contains('Height')";
|
b3b33a4ffcd1e5d33aa9acaf6fce0cf74e82ba8b
|
2025-01-06 19:07:03
|
Nidhi
|
chore: Allow context to determine path in file dir (#38498)
| false
|
Allow context to determine path in file dir (#38498)
|
chore
|
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<GitResourceIdentity, Object> 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
|
fd9efb81a7be464fb5e2f882312979ae78306d50
|
2024-12-06 14:05:46
|
Rudraprasad Das
|
chore: git mod - migrating apis for git (#37984)
| false
|
git mod - migrating apis for git (#37984)
|
chore
|
diff --git a/app/client/src/git/actions/helpers/singleArtifactInitialState.ts b/app/client/src/git/actions/helpers/singleArtifactInitialState.ts
index 0c8e0cb282f8..26735b772c47 100644
--- a/app/client/src/git/actions/helpers/singleArtifactInitialState.ts
+++ b/app/client/src/git/actions/helpers/singleArtifactInitialState.ts
@@ -3,7 +3,7 @@ import {
GitImportStep,
GitOpsTab,
GitSettingsTab,
-} from "../../enums";
+} from "../../constants/enums";
import type {
GitSingleArtifactAPIResponsesReduxState,
GitSingleArtifactUIReduxState,
diff --git a/app/client/src/git/components/QuickActions/index.test.tsx b/app/client/src/git/components/QuickActions/index.test.tsx
index b920e6b51fde..189b3ea67be9 100644
--- a/app/client/src/git/components/QuickActions/index.test.tsx
+++ b/app/client/src/git/components/QuickActions/index.test.tsx
@@ -2,7 +2,7 @@ import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import QuickActions from ".";
-import { GitSettingsTab } from "git/enums";
+import { GitSettingsTab } from "../../constants/enums";
import { GitSyncModalTab } from "entities/GitSync";
import { theme } from "constants/DefaultTheme";
import { ThemeProvider } from "styled-components";
diff --git a/app/client/src/git/components/QuickActions/index.tsx b/app/client/src/git/components/QuickActions/index.tsx
index cab336ca1e52..21483fb83ad4 100644
--- a/app/client/src/git/components/QuickActions/index.tsx
+++ b/app/client/src/git/components/QuickActions/index.tsx
@@ -12,7 +12,7 @@ import { GitSyncModalTab } from "entities/GitSync";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import type { GitMetadata, GitStatus } from "../../types";
import { getPullBtnStatus } from "./helpers";
-import { GitSettingsTab } from "../../enums";
+import { GitSettingsTab } from "../../constants/enums";
import ConnectButton from "./ConnectButton";
import QuickActionButton from "./QuickActionButton";
import AutocommitStatusbar from "./AutocommitStatusbar";
diff --git a/app/client/src/git/enums.ts b/app/client/src/git/constants/enums.ts
similarity index 69%
rename from app/client/src/git/enums.ts
rename to app/client/src/git/constants/enums.ts
index fe72149e9fe7..e431e6323ca8 100644
--- a/app/client/src/git/enums.ts
+++ b/app/client/src/git/constants/enums.ts
@@ -25,3 +25,12 @@ export enum GitSettingsTab {
General = "General",
Branch = "Branch",
}
+
+export enum AutocommitStatus {
+ IN_PROGRESS = "IN_PROGRESS",
+ LOCKED = "LOCKED",
+ PUBLISHED = "PUBLISHED",
+ IDLE = "IDLE",
+ NOT_REQUIRED = "NOT_REQUIRED",
+ NON_GIT_APP = "NON_GIT_APP",
+}
diff --git a/app/client/src/git/requests/checkoutBranchRequest.ts b/app/client/src/git/requests/checkoutBranchRequest.ts
new file mode 100644
index 000000000000..4df5da6112d3
--- /dev/null
+++ b/app/client/src/git/requests/checkoutBranchRequest.ts
@@ -0,0 +1,17 @@
+import type { AxiosResponse } from "axios";
+import type {
+ CheckoutBranchRequestParams,
+ CheckoutBranchResponse,
+} from "./checkoutBranchRequest.types";
+import { GIT_BASE_URL } from "./constants";
+import Api from "api/Api";
+
+export default async function checkoutBranchRequest(
+ branchedApplicationId: string,
+ params: CheckoutBranchRequestParams,
+): Promise<AxiosResponse<CheckoutBranchResponse>> {
+ return Api.get(
+ `${GIT_BASE_URL}/checkout-branch/app/${branchedApplicationId}`,
+ params,
+ );
+}
diff --git a/app/client/src/git/requests/checkoutBranchRequest.types.ts b/app/client/src/git/requests/checkoutBranchRequest.types.ts
new file mode 100644
index 000000000000..8c465fc624ee
--- /dev/null
+++ b/app/client/src/git/requests/checkoutBranchRequest.types.ts
@@ -0,0 +1,8 @@
+export interface CheckoutBranchRequestParams {
+ branchName: string;
+}
+
+export interface CheckoutBranchResponse {
+ id: string; // applicationId
+ baseId: string; // baseApplicationId
+}
diff --git a/app/client/src/git/requests/commitRequest.ts b/app/client/src/git/requests/commitRequest.ts
new file mode 100644
index 000000000000..69541d030368
--- /dev/null
+++ b/app/client/src/git/requests/commitRequest.ts
@@ -0,0 +1,17 @@
+import Api from "api/Api";
+import type {
+ CommitRequestParams,
+ CommitResponse,
+} from "./commitRequest.types";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+
+export default async function commitRequest(
+ branchedApplicationId: string,
+ params: CommitRequestParams,
+): Promise<AxiosResponse<CommitResponse>> {
+ return Api.post(
+ `${GIT_BASE_URL}/commit/app/${branchedApplicationId}`,
+ params,
+ );
+}
diff --git a/app/client/src/git/requests/commitRequest.types.ts b/app/client/src/git/requests/commitRequest.types.ts
new file mode 100644
index 000000000000..b9c4bd7d7871
--- /dev/null
+++ b/app/client/src/git/requests/commitRequest.types.ts
@@ -0,0 +1,6 @@
+export interface CommitRequestParams {
+ commitMessage: string;
+ doPush: boolean;
+}
+
+export type CommitResponse = string;
diff --git a/app/client/src/git/requests/connectRequest.ts b/app/client/src/git/requests/connectRequest.ts
new file mode 100644
index 000000000000..b62578361024
--- /dev/null
+++ b/app/client/src/git/requests/connectRequest.ts
@@ -0,0 +1,14 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type {
+ ConnectRequestParams,
+ ConnectResponse,
+} from "./connectRequest.types";
+import type { AxiosResponse } from "axios";
+
+export default async function connectRequest(
+ baseApplicationId: string,
+ params: ConnectRequestParams,
+): Promise<AxiosResponse<ConnectResponse>> {
+ return Api.post(`${GIT_BASE_URL}/connect/app/${baseApplicationId}`, params);
+}
diff --git a/app/client/src/git/requests/connectRequest.types.ts b/app/client/src/git/requests/connectRequest.types.ts
new file mode 100644
index 000000000000..ef529d1bc1ff
--- /dev/null
+++ b/app/client/src/git/requests/connectRequest.types.ts
@@ -0,0 +1,24 @@
+export interface ConnectRequestParams {
+ remoteUrl: string;
+ gitProfile?: {
+ authorName: string;
+ authorEmail: string;
+ useDefaultProfile?: boolean;
+ };
+}
+
+export interface ConnectResponse {
+ id: string;
+ baseId: string;
+ gitApplicationMetadata: {
+ branchName: string;
+ browserSupportedRemoteUrl: string;
+ defaultApplicationId: string;
+ defaultArtifactId: string;
+ defaultBranchName: string;
+ isRepoPrivate: boolean;
+ lastCommitedAt: string;
+ remoteUrl: string;
+ repoName: string;
+ };
+}
diff --git a/app/client/src/git/requests/constants.ts b/app/client/src/git/requests/constants.ts
new file mode 100644
index 000000000000..e8626c4cc4a0
--- /dev/null
+++ b/app/client/src/git/requests/constants.ts
@@ -0,0 +1,2 @@
+export const GIT_BASE_URL = "/v1/git";
+export const APPLICATION_BASE_URL = "/v1/applications";
diff --git a/app/client/src/git/requests/createBranchRequest.ts b/app/client/src/git/requests/createBranchRequest.ts
new file mode 100644
index 000000000000..a67b5ee04099
--- /dev/null
+++ b/app/client/src/git/requests/createBranchRequest.ts
@@ -0,0 +1,17 @@
+import type { AxiosResponse } from "axios";
+import type {
+ CreateBranchRequestParams,
+ CreateBranchResponse,
+} from "./createBranchRequest.types";
+import { GIT_BASE_URL } from "./constants";
+import Api from "api/Api";
+
+export default async function createBranchRequest(
+ branchedApplicationId: string,
+ params: CreateBranchRequestParams,
+): Promise<AxiosResponse<CreateBranchResponse>> {
+ return Api.post(
+ `${GIT_BASE_URL}/create-branch/app/${branchedApplicationId}`,
+ params,
+ );
+}
diff --git a/app/client/src/git/requests/createBranchRequest.types.ts b/app/client/src/git/requests/createBranchRequest.types.ts
new file mode 100644
index 000000000000..28735db75183
--- /dev/null
+++ b/app/client/src/git/requests/createBranchRequest.types.ts
@@ -0,0 +1,8 @@
+export interface CreateBranchRequestParams {
+ branchName: string;
+}
+
+export interface CreateBranchResponse {
+ id: string; // applicationId
+ baseId: string; // baseApplicationId
+}
diff --git a/app/client/src/git/requests/deleteBranchRequest.ts b/app/client/src/git/requests/deleteBranchRequest.ts
new file mode 100644
index 000000000000..63f718506d48
--- /dev/null
+++ b/app/client/src/git/requests/deleteBranchRequest.ts
@@ -0,0 +1,14 @@
+import type { AxiosResponse } from "axios";
+import type {
+ DeleteBranchRequestParams,
+ DeleteBranchResponse,
+} from "./deleteBranchRequest.types";
+import { GIT_BASE_URL } from "./constants";
+import Api from "api/Api";
+
+export default async function deleteBranchRequest(
+ baseApplicationId: string,
+ params: DeleteBranchRequestParams,
+): Promise<AxiosResponse<DeleteBranchResponse>> {
+ return Api.delete(`${GIT_BASE_URL}/branch/app/${baseApplicationId}`, params);
+}
diff --git a/app/client/src/git/requests/deleteBranchRequest.types.ts b/app/client/src/git/requests/deleteBranchRequest.types.ts
new file mode 100644
index 000000000000..f7db6f834859
--- /dev/null
+++ b/app/client/src/git/requests/deleteBranchRequest.types.ts
@@ -0,0 +1,8 @@
+export interface DeleteBranchRequestParams {
+ branchName: string;
+}
+
+export interface DeleteBranchResponse {
+ id: string; // applicationId
+ baseId: string; // baseApplicationId
+}
diff --git a/app/client/src/git/requests/discardRequest.ts b/app/client/src/git/requests/discardRequest.ts
new file mode 100644
index 000000000000..fda452fc206c
--- /dev/null
+++ b/app/client/src/git/requests/discardRequest.ts
@@ -0,0 +1,9 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+
+export default async function discardRequest(
+ branchedApplicationId: string,
+): Promise<AxiosResponse<void>> {
+ return Api.put(`${GIT_BASE_URL}/discard/app/${branchedApplicationId}`);
+}
diff --git a/app/client/src/git/requests/disconnectRequest.ts b/app/client/src/git/requests/disconnectRequest.ts
new file mode 100644
index 000000000000..9ec9b3a4e2b9
--- /dev/null
+++ b/app/client/src/git/requests/disconnectRequest.ts
@@ -0,0 +1,10 @@
+import type { AxiosResponse } from "axios";
+import { GIT_BASE_URL } from "./constants";
+import type { DisconnectResponse } from "./disconnectRequest.types";
+import Api from "api/Api";
+
+export default async function disconnectRequest(
+ baseApplicationId: string,
+): Promise<AxiosResponse<DisconnectResponse>> {
+ return Api.post(`${GIT_BASE_URL}/disconnect/app/${baseApplicationId}`);
+}
diff --git a/app/client/src/git/requests/disconnectRequest.types.ts b/app/client/src/git/requests/disconnectRequest.types.ts
new file mode 100644
index 000000000000..34ac4728a324
--- /dev/null
+++ b/app/client/src/git/requests/disconnectRequest.types.ts
@@ -0,0 +1,3 @@
+export interface DisconnectResponse {
+ [key: string]: string;
+}
diff --git a/app/client/src/git/requests/fetchAutocommitProgressRequest.ts b/app/client/src/git/requests/fetchAutocommitProgressRequest.ts
new file mode 100644
index 000000000000..8ad1c71d22c8
--- /dev/null
+++ b/app/client/src/git/requests/fetchAutocommitProgressRequest.ts
@@ -0,0 +1,12 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+import type { FetchAutocommitProgressResponse } from "./fetchAutocommitProgressRequest.types";
+
+export default async function fetchAutocommitProgressRequest(
+ baseApplicationId: string,
+): Promise<AxiosResponse<FetchAutocommitProgressResponse>> {
+ return Api.get(
+ `${GIT_BASE_URL}/auto-commit/progress/app/${baseApplicationId}`,
+ );
+}
diff --git a/app/client/src/git/requests/fetchAutocommitProgressRequest.types.ts b/app/client/src/git/requests/fetchAutocommitProgressRequest.types.ts
new file mode 100644
index 000000000000..60f10b5fc6b3
--- /dev/null
+++ b/app/client/src/git/requests/fetchAutocommitProgressRequest.types.ts
@@ -0,0 +1,7 @@
+import type { AutocommitStatus } from "../constants/enums";
+
+export interface FetchAutocommitProgressResponse {
+ autoCommitResponse: AutocommitStatus;
+ progress: number;
+ branchName: string;
+}
diff --git a/app/client/src/git/requests/fetchBranchesRequest.ts b/app/client/src/git/requests/fetchBranchesRequest.ts
new file mode 100644
index 000000000000..90fdbf73d94a
--- /dev/null
+++ b/app/client/src/git/requests/fetchBranchesRequest.ts
@@ -0,0 +1,21 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type {
+ FetchBranchesRequestParams,
+ FetchBranchesResponse,
+} from "./fetchBranchesRequest.types";
+import type { AxiosResponse } from "axios";
+
+export default async function fetchBranchesRequest(
+ branchedApplicationId: string,
+ params?: FetchBranchesRequestParams,
+): Promise<AxiosResponse<FetchBranchesResponse>> {
+ const queryParams = {} as FetchBranchesRequestParams;
+
+ if (params?.pruneBranches) queryParams.pruneBranches = true;
+
+ return Api.get(
+ `${GIT_BASE_URL}/branch/app/${branchedApplicationId}`,
+ queryParams,
+ );
+}
diff --git a/app/client/src/git/requests/fetchBranchesRequest.types.ts b/app/client/src/git/requests/fetchBranchesRequest.types.ts
new file mode 100644
index 000000000000..e86e545b309e
--- /dev/null
+++ b/app/client/src/git/requests/fetchBranchesRequest.types.ts
@@ -0,0 +1,11 @@
+export interface FetchBranchesRequestParams {
+ pruneBranches: boolean;
+}
+
+interface SingleBranch {
+ branchName: string;
+ createdFromLocal: string;
+ default: boolean;
+}
+
+export type FetchBranchesResponse = SingleBranch[];
diff --git a/app/client/src/git/requests/fetchGitMetadataRequest.ts b/app/client/src/git/requests/fetchGitMetadataRequest.ts
new file mode 100644
index 000000000000..136f5776f557
--- /dev/null
+++ b/app/client/src/git/requests/fetchGitMetadataRequest.ts
@@ -0,0 +1,10 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+import type { FetchGitMetadataResponse } from "./fetchGitMetadataRequest.types";
+
+export default async function fetchGitMetadataRequest(
+ baseApplicationId: string,
+): Promise<AxiosResponse<FetchGitMetadataResponse>> {
+ return Api.get(`${GIT_BASE_URL}/metadata/app/${baseApplicationId}`);
+}
diff --git a/app/client/src/git/requests/fetchGitMetadataRequest.types.ts b/app/client/src/git/requests/fetchGitMetadataRequest.types.ts
new file mode 100644
index 000000000000..95ef9f6ec3ab
--- /dev/null
+++ b/app/client/src/git/requests/fetchGitMetadataRequest.types.ts
@@ -0,0 +1,15 @@
+export interface FetchGitMetadataResponse {
+ branchName: string;
+ defaultBranchName: string;
+ remoteUrl: string;
+ repoName: string;
+ browserSupportedUrl?: string;
+ isRepoPrivate?: boolean;
+ browserSupportedRemoteUrl: string;
+ defaultApplicationId: string;
+ isProtectedBranch: boolean;
+ autoCommitConfig: {
+ enabled: boolean;
+ };
+ isAutoDeploymentEnabled?: boolean;
+}
diff --git a/app/client/src/git/requests/fetchGlobalConfigRequest.ts b/app/client/src/git/requests/fetchGlobalConfigRequest.ts
new file mode 100644
index 000000000000..32b048c0bbf0
--- /dev/null
+++ b/app/client/src/git/requests/fetchGlobalConfigRequest.ts
@@ -0,0 +1,10 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+import type { FetchGlobalConfigResponse } from "./fetchGlobalConfigRequest.types";
+
+export default async function fetchGlobalConfigRequest(): Promise<
+ AxiosResponse<FetchGlobalConfigResponse>
+> {
+ return Api.get(`${GIT_BASE_URL}/profile/default`);
+}
diff --git a/app/client/src/git/requests/fetchGlobalConfigRequest.types.ts b/app/client/src/git/requests/fetchGlobalConfigRequest.types.ts
new file mode 100644
index 000000000000..1939b2df65fd
--- /dev/null
+++ b/app/client/src/git/requests/fetchGlobalConfigRequest.types.ts
@@ -0,0 +1,4 @@
+export interface FetchGlobalConfigResponse {
+ authorName: string;
+ authorEmail: string;
+}
diff --git a/app/client/src/git/requests/fetchLocalConfigRequest.ts b/app/client/src/git/requests/fetchLocalConfigRequest.ts
new file mode 100644
index 000000000000..53159fc886f7
--- /dev/null
+++ b/app/client/src/git/requests/fetchLocalConfigRequest.ts
@@ -0,0 +1,10 @@
+import Api from "api/Api";
+import type { AxiosResponse } from "axios";
+import { GIT_BASE_URL } from "./constants";
+import type { FetchLocalConfigResponse } from "./fetchLocalConfigRequest.types";
+
+export default async function fetchLocalConfigRequest(
+ baseApplicationId: string,
+): Promise<AxiosResponse<FetchLocalConfigResponse>> {
+ return Api.get(`${GIT_BASE_URL}/profile/app/${baseApplicationId}`);
+}
diff --git a/app/client/src/git/requests/fetchLocalConfigRequest.types.ts b/app/client/src/git/requests/fetchLocalConfigRequest.types.ts
new file mode 100644
index 000000000000..abc83e1d83ba
--- /dev/null
+++ b/app/client/src/git/requests/fetchLocalConfigRequest.types.ts
@@ -0,0 +1,5 @@
+export interface FetchLocalConfigResponse {
+ authorName: string;
+ authorEmail: string;
+ useGlobalProfile: boolean;
+}
diff --git a/app/client/src/git/requests/fetchMergeStatusRequest.ts b/app/client/src/git/requests/fetchMergeStatusRequest.ts
new file mode 100644
index 000000000000..95701d5cadc8
--- /dev/null
+++ b/app/client/src/git/requests/fetchMergeStatusRequest.ts
@@ -0,0 +1,17 @@
+import type { AxiosResponse } from "axios";
+import type {
+ FetchMergeStatusRequestParams,
+ FetchMergeStatusResponse,
+} from "./fetchMergeStatusRequest.types";
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+
+export default async function fetchMergeStatusRequest(
+ branchedApplicationId: string,
+ params: FetchMergeStatusRequestParams,
+): Promise<AxiosResponse<FetchMergeStatusResponse>> {
+ return Api.post(
+ `${GIT_BASE_URL}/merge/status/app/${branchedApplicationId}`,
+ params,
+ );
+}
diff --git a/app/client/src/git/requests/fetchMergeStatusRequest.types.ts b/app/client/src/git/requests/fetchMergeStatusRequest.types.ts
new file mode 100644
index 000000000000..76965ee37ff5
--- /dev/null
+++ b/app/client/src/git/requests/fetchMergeStatusRequest.types.ts
@@ -0,0 +1,10 @@
+export interface FetchMergeStatusRequestParams {
+ sourceBranch: string;
+ destinationBranch: string;
+}
+
+export interface FetchMergeStatusResponse {
+ isMergeAble: boolean;
+ status: string; // merge status
+ message: string;
+}
diff --git a/app/client/src/git/requests/fetchProtectedBranchesRequest.ts b/app/client/src/git/requests/fetchProtectedBranchesRequest.ts
new file mode 100644
index 000000000000..492a23c5eeca
--- /dev/null
+++ b/app/client/src/git/requests/fetchProtectedBranchesRequest.ts
@@ -0,0 +1,10 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+import type { FetchProtectedBranches } from "./fetchProtectedBranchesRequest.types";
+
+export default async function fetchProtectedBranchesRequest(
+ baseApplicationId: string,
+): Promise<AxiosResponse<FetchProtectedBranches>> {
+ return Api.get(`${GIT_BASE_URL}/branch/app/${baseApplicationId}/protected`);
+}
diff --git a/app/client/src/git/requests/fetchProtectedBranchesRequest.types.ts b/app/client/src/git/requests/fetchProtectedBranchesRequest.types.ts
new file mode 100644
index 000000000000..166cc05322ed
--- /dev/null
+++ b/app/client/src/git/requests/fetchProtectedBranchesRequest.types.ts
@@ -0,0 +1 @@
+export type FetchProtectedBranches = string[];
diff --git a/app/client/src/git/requests/fetchSSHKeyRequest.ts b/app/client/src/git/requests/fetchSSHKeyRequest.ts
new file mode 100644
index 000000000000..e61884e28a3b
--- /dev/null
+++ b/app/client/src/git/requests/fetchSSHKeyRequest.ts
@@ -0,0 +1,10 @@
+import type { AxiosResponse } from "axios";
+import type { FetchSSHKeyResponse } from "./fetchSSHKeyRequest.types";
+import Api from "api/Api";
+import { APPLICATION_BASE_URL } from "./constants";
+
+export default async function fetchSSHKeyRequest(
+ baseApplicationId: string,
+): Promise<AxiosResponse<FetchSSHKeyResponse>> {
+ return Api.get(`${APPLICATION_BASE_URL}/ssh-keypair/${baseApplicationId}`);
+}
diff --git a/app/client/src/git/requests/fetchSSHKeyRequest.types.ts b/app/client/src/git/requests/fetchSSHKeyRequest.types.ts
new file mode 100644
index 000000000000..55b4f305b666
--- /dev/null
+++ b/app/client/src/git/requests/fetchSSHKeyRequest.types.ts
@@ -0,0 +1,6 @@
+export interface FetchSSHKeyResponse {
+ publicKey: string;
+ docUrl: string;
+ isRegeneratedKey: boolean;
+ regeneratedKey: boolean;
+}
diff --git a/app/client/src/git/requests/fetchStatusRequest.ts b/app/client/src/git/requests/fetchStatusRequest.ts
new file mode 100644
index 000000000000..587b4f66ea0b
--- /dev/null
+++ b/app/client/src/git/requests/fetchStatusRequest.ts
@@ -0,0 +1,14 @@
+import Api from "api/Api";
+import type {
+ FetchStatusRequestParams,
+ FetchStatusResponse,
+} from "./fetchStatusRequest.types";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+
+export default async function fetchStatusRequest(
+ branchedApplicationId: string,
+ params: FetchStatusRequestParams,
+): Promise<AxiosResponse<FetchStatusResponse>> {
+ return Api.get(`${GIT_BASE_URL}/status/app/${branchedApplicationId}`, params);
+}
diff --git a/app/client/src/git/requests/fetchStatusRequest.types.ts b/app/client/src/git/requests/fetchStatusRequest.types.ts
new file mode 100644
index 000000000000..9a63fc879487
--- /dev/null
+++ b/app/client/src/git/requests/fetchStatusRequest.types.ts
@@ -0,0 +1,38 @@
+export interface FetchStatusRequestParams {
+ compareRemote: boolean;
+}
+
+export interface FetchStatusResponse {
+ added: string[];
+ aheadCount: number;
+ behindCount: number;
+ conflicting: string[];
+ datasourcesAdded: string[];
+ datasourcesModified: string[];
+ datasourcesRemoved: string[];
+ discardDocUrl: string;
+ isClean: boolean;
+ jsLibsAdded: string[];
+ jsLibsModified: string[];
+ jsLibsRemoved: string[];
+ jsObjectsAdded: string[];
+ jsObjectsModified: string[];
+ jsObjectsRemoved: string[];
+ migrationMessage: string;
+ modified: string[];
+ modifiedDatasources: number;
+ modifiedJSLibs: number;
+ modifiedJSObjects: number;
+ modifiedModuleInstances: number;
+ modifiedModules: number;
+ modifiedPages: number;
+ modifiedQueries: number;
+ pagesAdded: string[];
+ pagesModified: string[];
+ pagesRemoved: string[];
+ queriesAdded: string[];
+ queriesModified: string[];
+ queriesRemoved: string[];
+ remoteBranch: string;
+ removed: string[];
+}
diff --git a/app/client/src/git/requests/generateSSHKeyRequest.ts b/app/client/src/git/requests/generateSSHKeyRequest.ts
new file mode 100644
index 000000000000..525c0423a16f
--- /dev/null
+++ b/app/client/src/git/requests/generateSSHKeyRequest.ts
@@ -0,0 +1,18 @@
+import type { AxiosResponse } from "axios";
+import type {
+ GenerateSSHKeyRequestParams,
+ GenerateSSHKeyResponse,
+} from "./generateSSHKeyRequest.types";
+import { APPLICATION_BASE_URL, GIT_BASE_URL } from "./constants";
+import Api from "api/Api";
+
+export default async function generateSSHKeyRequest(
+ baseApplicationId: string,
+ params: GenerateSSHKeyRequestParams,
+): Promise<AxiosResponse<GenerateSSHKeyResponse>> {
+ const url = params.isImporting
+ ? `${GIT_BASE_URL}/import/keys?keyType=${params.keyType}`
+ : `${APPLICATION_BASE_URL}/ssh-keypair/${baseApplicationId}?keyType=${params.keyType}`;
+
+ return params.isImporting ? Api.get(url) : Api.post(url);
+}
diff --git a/app/client/src/git/requests/generateSSHKeyRequest.types.ts b/app/client/src/git/requests/generateSSHKeyRequest.types.ts
new file mode 100644
index 000000000000..ced29ad6dbc0
--- /dev/null
+++ b/app/client/src/git/requests/generateSSHKeyRequest.types.ts
@@ -0,0 +1,11 @@
+export interface GenerateSSHKeyRequestParams {
+ keyType: string;
+ isImporting: boolean;
+}
+
+export interface GenerateSSHKeyResponse {
+ publicKey: string;
+ docUrl: string;
+ isRegeneratedKey: boolean;
+ regeneratedKey: boolean;
+}
diff --git a/app/client/src/git/requests/importGitRequest.ts b/app/client/src/git/requests/importGitRequest.ts
new file mode 100644
index 000000000000..e9378361da88
--- /dev/null
+++ b/app/client/src/git/requests/importGitRequest.ts
@@ -0,0 +1,14 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type {
+ ImportGitRequestParams,
+ ImportGitResponse,
+} from "./importGitRequest.types";
+import type { AxiosResponse } from "axios";
+
+export default async function importGitRequest(
+ workspaceId: string,
+ params: ImportGitRequestParams,
+): Promise<AxiosResponse<ImportGitResponse>> {
+ return Api.post(`${GIT_BASE_URL}/import/${workspaceId}`, params);
+}
diff --git a/app/client/src/git/requests/importGitRequest.types.ts b/app/client/src/git/requests/importGitRequest.types.ts
new file mode 100644
index 000000000000..b0f3113d7a6e
--- /dev/null
+++ b/app/client/src/git/requests/importGitRequest.types.ts
@@ -0,0 +1,24 @@
+export interface ImportGitRequestParams {
+ remoteUrl: string;
+ gitProfile?: {
+ authorName: string;
+ authorEmail: string;
+ useDefaultProfile?: boolean;
+ };
+}
+
+export interface ImportGitResponse {
+ id: string;
+ baseId: string;
+ gitApplicationMetadata: {
+ branchName: string;
+ browserSupportedRemoteUrl: string;
+ defaultApplicationId: string;
+ defaultArtifactId: string;
+ defaultBranchName: string;
+ isRepoPrivate: boolean;
+ lastCommitedAt: string;
+ remoteUrl: string;
+ repoName: string;
+ };
+}
diff --git a/app/client/src/git/requests/mergeRequest.ts b/app/client/src/git/requests/mergeRequest.ts
new file mode 100644
index 000000000000..ee30566c4936
--- /dev/null
+++ b/app/client/src/git/requests/mergeRequest.ts
@@ -0,0 +1,11 @@
+import Api from "api/Api";
+import type { MergeRequestParams, MergeResponse } from "./mergeRequest.types";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+
+export default async function mergeRequest(
+ branchedApplicationId: string,
+ params: MergeRequestParams,
+): Promise<AxiosResponse<MergeResponse>> {
+ return Api.post(`${GIT_BASE_URL}/merge/app/${branchedApplicationId}`, params);
+}
diff --git a/app/client/src/git/requests/mergeRequest.types.ts b/app/client/src/git/requests/mergeRequest.types.ts
new file mode 100644
index 000000000000..7ec27500b1ed
--- /dev/null
+++ b/app/client/src/git/requests/mergeRequest.types.ts
@@ -0,0 +1,9 @@
+export interface MergeRequestParams {
+ sourceBranch: string;
+ destinationBranch: string;
+}
+
+export interface MergeResponse {
+ isMergAble: boolean;
+ status: string; // merge status
+}
diff --git a/app/client/src/git/requests/pullRequest.ts b/app/client/src/git/requests/pullRequest.ts
new file mode 100644
index 000000000000..21bd6f4f2a3c
--- /dev/null
+++ b/app/client/src/git/requests/pullRequest.ts
@@ -0,0 +1,10 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+import type { PullRequestResponse } from "./pullRequest.types";
+
+export default async function pullRequest(
+ branchedApplicationId: string,
+): Promise<AxiosResponse<PullRequestResponse>> {
+ return Api.get(`${GIT_BASE_URL}/pull/app/${branchedApplicationId}`);
+}
diff --git a/app/client/src/git/requests/pullRequest.types.ts b/app/client/src/git/requests/pullRequest.types.ts
new file mode 100644
index 000000000000..abfb2586ca8e
--- /dev/null
+++ b/app/client/src/git/requests/pullRequest.types.ts
@@ -0,0 +1,6 @@
+export interface PullRequestResponse {
+ mergeStatus: {
+ isMergeAble: boolean;
+ status: string; // pull merge status
+ };
+}
diff --git a/app/client/src/git/requests/toggleAutocommitRequest.ts b/app/client/src/git/requests/toggleAutocommitRequest.ts
new file mode 100644
index 000000000000..deba662ded3f
--- /dev/null
+++ b/app/client/src/git/requests/toggleAutocommitRequest.ts
@@ -0,0 +1,12 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+import type { ToggleAutocommitResponse } from "./toggleAutocommitRequest.types";
+
+export default async function toggleAutocommitRequest(
+ baseApplicationId: string,
+): Promise<AxiosResponse<ToggleAutocommitResponse>> {
+ return Api.patch(
+ `${GIT_BASE_URL}/auto-commit/toggle/app/${baseApplicationId}`,
+ );
+}
diff --git a/app/client/src/git/requests/toggleAutocommitRequest.types.ts b/app/client/src/git/requests/toggleAutocommitRequest.types.ts
new file mode 100644
index 000000000000..9dc99ed84528
--- /dev/null
+++ b/app/client/src/git/requests/toggleAutocommitRequest.types.ts
@@ -0,0 +1 @@
+export type ToggleAutocommitResponse = boolean;
diff --git a/app/client/src/git/requests/triggerAutocommitRequest.ts b/app/client/src/git/requests/triggerAutocommitRequest.ts
new file mode 100644
index 000000000000..01c603cb4ce5
--- /dev/null
+++ b/app/client/src/git/requests/triggerAutocommitRequest.ts
@@ -0,0 +1,10 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type { AxiosResponse } from "axios";
+import type { TriggerAutocommitResponse } from "./triggerAutocommitRequest.types";
+
+export default async function triggerAutocommitRequest(
+ branchedApplicationId: string,
+): Promise<AxiosResponse<TriggerAutocommitResponse>> {
+ return Api.post(`${GIT_BASE_URL}/auto-commit/app/${branchedApplicationId}`);
+}
diff --git a/app/client/src/git/requests/triggerAutocommitRequest.types.ts b/app/client/src/git/requests/triggerAutocommitRequest.types.ts
new file mode 100644
index 000000000000..6abf80ecf226
--- /dev/null
+++ b/app/client/src/git/requests/triggerAutocommitRequest.types.ts
@@ -0,0 +1,7 @@
+import type { AutocommitStatus } from "../constants/enums";
+
+export interface TriggerAutocommitResponse {
+ autoCommitResponse: AutocommitStatus;
+ progress: number;
+ branchName: string;
+}
diff --git a/app/client/src/git/requests/updateGlobalConfigRequest.ts b/app/client/src/git/requests/updateGlobalConfigRequest.ts
new file mode 100644
index 000000000000..a20cb5beb877
--- /dev/null
+++ b/app/client/src/git/requests/updateGlobalConfigRequest.ts
@@ -0,0 +1,13 @@
+import type { AxiosResponse } from "axios";
+import type {
+ UpdateGlobalConfigRequestParams,
+ UpdateGlobalConfigResponse,
+} from "./updateGlobalConfigRequest.types";
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+
+export default async function updateGlobalConfigRequest(
+ params: UpdateGlobalConfigRequestParams,
+): Promise<AxiosResponse<UpdateGlobalConfigResponse>> {
+ return Api.post(`${GIT_BASE_URL}/profile/default`, params);
+}
diff --git a/app/client/src/git/requests/updateGlobalConfigRequest.types.ts b/app/client/src/git/requests/updateGlobalConfigRequest.types.ts
new file mode 100644
index 000000000000..10116f7dc991
--- /dev/null
+++ b/app/client/src/git/requests/updateGlobalConfigRequest.types.ts
@@ -0,0 +1,11 @@
+export interface UpdateGlobalConfigRequestParams {
+ authorName: string;
+ authorEmail: string;
+}
+
+export interface UpdateGlobalConfigResponse {
+ default: {
+ authorName: string;
+ authorEmail: string;
+ };
+}
diff --git a/app/client/src/git/requests/updateLocalConfigRequest.ts b/app/client/src/git/requests/updateLocalConfigRequest.ts
new file mode 100644
index 000000000000..4b69bc72c27d
--- /dev/null
+++ b/app/client/src/git/requests/updateLocalConfigRequest.ts
@@ -0,0 +1,14 @@
+import type { AxiosResponse } from "axios";
+import type {
+ UpdateLocalConfigRequestParams,
+ UpdateLocalConfigResponse,
+} from "./updateLocalConfigRequest.types";
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+
+export default async function updateLocalConfigRequest(
+ baseApplicationId: string,
+ params: UpdateLocalConfigRequestParams,
+): Promise<AxiosResponse<UpdateLocalConfigResponse>> {
+ return Api.put(`${GIT_BASE_URL}/profile/app/${baseApplicationId}`, params);
+}
diff --git a/app/client/src/git/requests/updateLocalConfigRequest.types.ts b/app/client/src/git/requests/updateLocalConfigRequest.types.ts
new file mode 100644
index 000000000000..5414637a46c8
--- /dev/null
+++ b/app/client/src/git/requests/updateLocalConfigRequest.types.ts
@@ -0,0 +1,13 @@
+export interface UpdateLocalConfigRequestParams {
+ authorName: string;
+ authorEmail: string;
+ useGlobalProfile: boolean;
+}
+
+export interface UpdateLocalConfigResponse {
+ [baseApplicationId: string]: {
+ authorName: string;
+ authorEmail: string;
+ useGlobalProfile: boolean;
+ };
+}
diff --git a/app/client/src/git/requests/updateProtectedBranchesRequest.ts b/app/client/src/git/requests/updateProtectedBranchesRequest.ts
new file mode 100644
index 000000000000..5af603ecaa7d
--- /dev/null
+++ b/app/client/src/git/requests/updateProtectedBranchesRequest.ts
@@ -0,0 +1,17 @@
+import Api from "api/Api";
+import { GIT_BASE_URL } from "./constants";
+import type {
+ UpdateProtectedBranchesRequestParams,
+ UpdateProtectedBranchesResponse,
+} from "./updateProtectedBranchesRequest.types";
+import type { AxiosResponse } from "axios";
+
+export default async function updateProtectedBranchesRequest(
+ baseApplicationId: string,
+ params: UpdateProtectedBranchesRequestParams,
+): Promise<AxiosResponse<UpdateProtectedBranchesResponse>> {
+ return Api.post(
+ `${GIT_BASE_URL}/branch/app/${baseApplicationId}/protected`,
+ params,
+ );
+}
diff --git a/app/client/src/git/requests/updateProtectedBranchesRequest.types.ts b/app/client/src/git/requests/updateProtectedBranchesRequest.types.ts
new file mode 100644
index 000000000000..fff7073624e4
--- /dev/null
+++ b/app/client/src/git/requests/updateProtectedBranchesRequest.types.ts
@@ -0,0 +1,5 @@
+export interface UpdateProtectedBranchesRequestParams {
+ branchNames: string[];
+}
+
+export type UpdateProtectedBranchesResponse = string[];
diff --git a/app/client/src/git/types.ts b/app/client/src/git/types.ts
index 7786dcc1b4a0..af349c168fb8 100644
--- a/app/client/src/git/types.ts
+++ b/app/client/src/git/types.ts
@@ -5,7 +5,7 @@ import type {
GitImportStep,
GitOpsTab,
GitSettingsTab,
-} from "./enums";
+} from "./constants/enums";
// These will be updated when contracts are finalized
export type GitMetadata = Record<string, unknown>;
|
756d27b00e9f8efdeb083ef34da3dc9a0f0d4953
|
2022-09-29 10:54:49
|
Aswath K
|
chore: Property pane config cleanup (#16639)
| false
|
Property pane config cleanup (#16639)
|
chore
|
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js
index 878390c10e82..111a512f5f3a 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js
@@ -27,10 +27,9 @@ Cyclic Depedency Error if occurs, Message would be shown in following 6 cases:
describe("Cyclic Dependency Informational Error Messagaes", function() {
before(() => {
cy.addDsl(dsl);
- cy.wait(3000); //dsl to settle!
+ cy.wait(3000); //dsl to settle!
});
-
it("1. Create Users Sample DB & Sample DB Query", () => {
//Step1
cy.wait(2000);
@@ -84,10 +83,8 @@ describe("Cyclic Dependency Informational Error Messagaes", function() {
cy.assertPageSave();
});
-
-
//Case 1: On page load actions
- it ("3. Reload Page and it should provide errors in response", () => {
+ it("3. Reload Page and it should provide errors in response", () => {
// cy.get(widgetsPage.NavHomePage).click({ force: true });
cy.reload();
cy.openPropertyPane("inputwidgetv2");
@@ -98,7 +95,7 @@ describe("Cyclic Dependency Informational Error Messagaes", function() {
);
});
- it ("4. update input widget's placeholder property and check errors array", () => {
+ it("4. update input widget's placeholder property and check errors array", () => {
// Case 2: When updating DSL attribute
cy.get(widgetsPage.placeholder).type("cyclic placeholder");
cy.wait("@updateLayout").should(
@@ -122,8 +119,8 @@ describe("Cyclic Dependency Informational Error Messagaes", function() {
toRun: true,
shouldCreateNewJSObj: true,
},
- )
- jsEditor.RenameJSObjFromPane("newName")
+ );
+ jsEditor.RenameJSObjFromPane("newName");
cy.wait("@renameJsAction").should(
"have.nested.property",
@@ -148,7 +145,6 @@ describe("Cyclic Dependency Informational Error Messagaes", function() {
// Case 5: When updating DSL name
it("6. Update Widget Name and check for errors", () => {
-
let entityName = "gender";
let newEntityName = "newInput";
ee.SelectEntityByName(entityName, "Widgets");
@@ -158,7 +154,6 @@ describe("Cyclic Dependency Informational Error Messagaes", function() {
"response.body.data.layoutOnLoadActionErrors.length",
1,
);
-
});
// Case 6: When updating Datasource query
@@ -169,16 +164,16 @@ describe("Cyclic Dependency Informational Error Messagaes", function() {
// update query and check for cyclic depedency issue
cy.get(queryLocators.query).click({ force: true });
cy.get(".CodeMirror textarea")
- .first()
- .focus()
- .type(" ", {
- force: true,
- parseSpecialCharSequences: false,
- });
+ .first()
+ .focus()
+ .type(" ", {
+ force: true,
+ parseSpecialCharSequences: false,
+ });
cy.wait("@saveAction").should(
"have.nested.property",
"response.body.data.errorReports.length",
1,
);
});
-});
\ No newline at end of file
+});
diff --git a/app/client/generators/widget/templates/index.js.hbs b/app/client/generators/widget/templates/index.js.hbs
index e7a346ab434c..49d9092a0b66 100644
--- a/app/client/generators/widget/templates/index.js.hbs
+++ b/app/client/generators/widget/templates/index.js.hbs
@@ -17,8 +17,9 @@ export const CONFIG = {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
- config: Widget.getPropertyPaneConfig(),
+ contentConfig: Widget.getPropertyPaneContentConfig(),
+ styleConfig: Widget.getPropertyPaneStyleConfig(),
},
};
-export default Widget;
\ No newline at end of file
+export default Widget;
diff --git a/app/client/generators/widget/templates/widget/index.js.hbs b/app/client/generators/widget/templates/widget/index.js.hbs
index cba96aa7c4ca..640a52519361 100644
--- a/app/client/generators/widget/templates/widget/index.js.hbs
+++ b/app/client/generators/widget/templates/widget/index.js.hbs
@@ -1,5 +1,4 @@
import React from "react";
-import styled from "styled-components";
import BaseWidget, { WidgetProps, WidgetState } from "widgets/BaseWidget";
import { DerivedPropertiesMap } from "utils/WidgetFactory";
@@ -7,7 +6,11 @@ import { DerivedPropertiesMap } from "utils/WidgetFactory";
import {{name}}Component from "../component";
class {{suffixed name}} extends BaseWidget<{{suffixed name}}Props, WidgetState> {
- static getPropertyPaneConfig() {
+ static getPropertyPaneContentConfig() {
+ return [];
+ }
+
+ static getPropertyPaneStyleConfig() {
return [];
}
diff --git a/app/client/src/constants/PropertyControlConstants.tsx b/app/client/src/constants/PropertyControlConstants.tsx
index 8136ebf9a678..4a171b060bce 100644
--- a/app/client/src/constants/PropertyControlConstants.tsx
+++ b/app/client/src/constants/PropertyControlConstants.tsx
@@ -33,7 +33,7 @@ export type PanelConfig = {
editableTitle: boolean;
titlePropertyName: string;
panelIdPropertyName: string;
- children: PropertyPaneConfig[];
+ children?: PropertyPaneConfig[];
contentChildren?: PropertyPaneConfig[];
styleChildren?: PropertyPaneConfig[];
updateHook: (
@@ -50,7 +50,7 @@ export type PropertyPaneControlConfig = {
// Serves in the tooltip
helpText?: string;
//Dynamic text serves below the property pane inputs
- helperText?: ((props: WidgetProps) => string) | string;
+ helperText?: ((props: any) => string) | string;
isJSConvertible?: boolean;
customJSControl?: string;
controlType: ControlType;
diff --git a/app/client/src/entities/Widget/utils.test.ts b/app/client/src/entities/Widget/utils.test.ts
index 704ff27556db..d564ea9f7023 100644
--- a/app/client/src/entities/Widget/utils.test.ts
+++ b/app/client/src/entities/Widget/utils.test.ts
@@ -1,7 +1,10 @@
import { getAllPathsFromPropertyConfig } from "./utils";
import { RenderModes } from "constants/WidgetConstants";
import tablePropertyPaneConfig from "widgets/TableWidget/widget/propertyConfig";
-import chartPorpertyConfig from "widgets/ChartWidget/widget/propertyConfig";
+import {
+ contentConfig,
+ styleConfig,
+} from "widgets/ChartWidget/widget/propertyConfig";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
import { ValidationTypes } from "constants/WidgetValidation";
@@ -507,7 +510,7 @@ describe("getAllPathsFromPropertyConfig", () => {
],
setAdaptiveYMin: "0",
};
- const config = chartPorpertyConfig;
+ const config = [...contentConfig, ...styleConfig];
const bindingPaths = {
chartType: EvaluationSubstitutionType.TEMPLATE,
diff --git a/app/client/src/entities/Widget/utils.ts b/app/client/src/entities/Widget/utils.ts
index b5b924341a48..d3f51b82372c 100644
--- a/app/client/src/entities/Widget/utils.ts
+++ b/app/client/src/entities/Widget/utils.ts
@@ -83,7 +83,15 @@ const childHasPanelConfig = (
const { panelIdPropertyName } = config.panelConfig;
const propertyPath = `${basePath}.${widgetPanelPropertyValue[panelIdPropertyName]}`;
- config.panelConfig.children.forEach((panelColumnConfig: any) => {
+ let panelConfigChildren = [
+ ...(config.panelConfig.contentChildren || []),
+ ...(config.panelConfig.styleChildren || []),
+ ];
+
+ if (panelConfigChildren.length === 0)
+ panelConfigChildren = config.panelConfig.children;
+
+ panelConfigChildren.forEach((panelColumnConfig: any) => {
let isSectionHidden = false;
if ("hidden" in panelColumnConfig) {
isSectionHidden = panelColumnConfig.hidden(
@@ -93,64 +101,138 @@ const childHasPanelConfig = (
}
if (!isSectionHidden) {
panelColumnConfig.children.forEach(
- (panelColumnControlConfig: any) => {
- const panelPropertyConfigPath = `${propertyPath}.${panelColumnControlConfig.propertyName}`;
- let isControlHidden = false;
- if ("hidden" in panelColumnControlConfig) {
- isControlHidden = panelColumnControlConfig.hidden(
- originalWidget,
- panelPropertyConfigPath,
+ (panelColumnControlOrSectionConfig: any) => {
+ if (
+ panelColumnControlOrSectionConfig.sectionName !== undefined
+ ) {
+ panelColumnControlOrSectionConfig.children.forEach(
+ (panelColumnControlConfig: any) => {
+ const panelPropertyConfigPath = `${propertyPath}.${panelColumnControlConfig.propertyName}`;
+ let isControlHidden = false;
+ if ("hidden" in panelColumnControlConfig) {
+ isControlHidden = panelColumnControlConfig.hidden(
+ originalWidget,
+ panelPropertyConfigPath,
+ );
+ }
+ if (!isControlHidden) {
+ const {
+ configBindingPaths,
+ configReactivePaths,
+ configTriggerPaths,
+ configValidationPaths,
+ } = checkPathsInConfig(
+ panelColumnControlConfig,
+ panelPropertyConfigPath,
+ );
+ bindingPaths = {
+ ...configBindingPaths,
+ ...bindingPaths,
+ };
+ reactivePaths = {
+ ...configReactivePaths,
+ ...reactivePaths,
+ };
+ triggerPaths = {
+ ...configTriggerPaths,
+ ...triggerPaths,
+ };
+ validationPaths = {
+ ...configValidationPaths,
+ ...validationPaths,
+ };
+ // Has child Panel Config
+ if (panelColumnControlConfig.panelConfig) {
+ const {
+ bindingPaths: panelBindingPaths,
+ reactivePaths: panelReactivePaths,
+ triggerPaths: panelTriggerPaths,
+ validationPaths: panelValidationPaths,
+ } = childHasPanelConfig(
+ panelColumnControlConfig,
+ widgetPanelPropertyValue,
+ panelPropertyConfigPath,
+ originalWidget,
+ );
+ bindingPaths = {
+ ...panelBindingPaths,
+ ...bindingPaths,
+ };
+ reactivePaths = {
+ ...panelReactivePaths,
+ ...reactivePaths,
+ };
+ triggerPaths = {
+ ...panelTriggerPaths,
+ ...triggerPaths,
+ };
+ validationPaths = {
+ ...panelValidationPaths,
+ ...validationPaths,
+ };
+ }
+ }
+ },
);
- }
- if (!isControlHidden) {
- const {
- configBindingPaths,
- configReactivePaths,
- configTriggerPaths,
- configValidationPaths,
- } = checkPathsInConfig(
- panelColumnControlConfig,
- panelPropertyConfigPath,
- );
- bindingPaths = {
- ...configBindingPaths,
- ...bindingPaths,
- };
- reactivePaths = {
- ...configReactivePaths,
- ...reactivePaths,
- };
- triggerPaths = { ...configTriggerPaths, ...triggerPaths };
- validationPaths = {
- ...configValidationPaths,
- ...validationPaths,
- };
- // Has child Panel Config
- if (panelColumnControlConfig.panelConfig) {
+ } else {
+ const panelPropertyConfigPath = `${propertyPath}.${panelColumnControlOrSectionConfig.propertyName}`;
+ let isControlHidden = false;
+ if ("hidden" in panelColumnControlOrSectionConfig) {
+ isControlHidden = panelColumnControlOrSectionConfig.hidden(
+ originalWidget,
+ panelPropertyConfigPath,
+ );
+ }
+ if (!isControlHidden) {
const {
- bindingPaths: panelBindingPaths,
- reactivePaths: panelReactivePaths,
- triggerPaths: panelTriggerPaths,
- validationPaths: panelValidationPaths,
- } = childHasPanelConfig(
- panelColumnControlConfig,
- widgetPanelPropertyValue,
+ configBindingPaths,
+ configReactivePaths,
+ configTriggerPaths,
+ configValidationPaths,
+ } = checkPathsInConfig(
+ panelColumnControlOrSectionConfig,
panelPropertyConfigPath,
- originalWidget,
);
bindingPaths = {
- ...panelBindingPaths,
+ ...configBindingPaths,
...bindingPaths,
};
reactivePaths = {
- ...panelReactivePaths,
+ ...configReactivePaths,
...reactivePaths,
};
- triggerPaths = { ...panelTriggerPaths, ...triggerPaths };
+ triggerPaths = { ...configTriggerPaths, ...triggerPaths };
validationPaths = {
- ...panelValidationPaths,
+ ...configValidationPaths,
...validationPaths,
};
+ // Has child Panel Config
+ if (panelColumnControlOrSectionConfig.panelConfig) {
+ const {
+ bindingPaths: panelBindingPaths,
+ reactivePaths: panelReactivePaths,
+ triggerPaths: panelTriggerPaths,
+ validationPaths: panelValidationPaths,
+ } = childHasPanelConfig(
+ panelColumnControlOrSectionConfig,
+ widgetPanelPropertyValue,
+ panelPropertyConfigPath,
+ originalWidget,
+ );
+ bindingPaths = {
+ ...panelBindingPaths,
+ ...bindingPaths,
+ };
+ reactivePaths = {
+ ...panelReactivePaths,
+ ...reactivePaths,
+ };
+ triggerPaths = { ...panelTriggerPaths, ...triggerPaths };
+ validationPaths = {
+ ...panelValidationPaths,
+ ...validationPaths,
+ };
+ }
}
}
},
diff --git a/app/client/src/utils/WidgetFactory.tsx b/app/client/src/utils/WidgetFactory.tsx
index 459efac81893..93088a4af77e 100644
--- a/app/client/src/utils/WidgetFactory.tsx
+++ b/app/client/src/utils/WidgetFactory.tsx
@@ -206,13 +206,24 @@ class WidgetFactory {
return map;
}
+ static getWidgetPropertyPaneCombinedConfig(
+ type: WidgetType,
+ ): readonly PropertyPaneConfig[] {
+ const contentConfig = this.propertyPaneContentConfigsMap.get(type) || [];
+ const styleConfig = this.propertyPaneStyleConfigsMap.get(type) || [];
+ return [...contentConfig, ...styleConfig];
+ }
+
static getWidgetPropertyPaneConfig(
type: WidgetType,
): readonly PropertyPaneConfig[] {
const map = this.propertyPaneConfigsMap.get(type);
- if (!map) {
- log.error("Widget property pane configs not defined", type);
- return [];
+ if (!map || (map && map.length === 0)) {
+ const config = WidgetFactory.getWidgetPropertyPaneCombinedConfig(type);
+ if (config.length === 0) {
+ log.error("Widget property pane config not defined", type);
+ }
+ return config;
}
return map;
}
diff --git a/app/client/src/utils/WidgetFactoryHelpers.ts b/app/client/src/utils/WidgetFactoryHelpers.ts
index 1c0213ddb15a..d61e718170e4 100644
--- a/app/client/src/utils/WidgetFactoryHelpers.ts
+++ b/app/client/src/utils/WidgetFactoryHelpers.ts
@@ -115,6 +115,31 @@ export function convertFunctionsToString(config: PropertyPaneConfig[]) {
(sectionOrControlConfig as PropertyPaneControlConfig) = config;
}
+
+ if (
+ config.panelConfig &&
+ config.panelConfig.contentChildren &&
+ Array.isArray(config.panelConfig.contentChildren)
+ ) {
+ config.panelConfig.contentChildren = convertFunctionsToString(
+ config.panelConfig.contentChildren,
+ );
+
+ (sectionOrControlConfig as PropertyPaneControlConfig) = config;
+ }
+
+ if (
+ config.panelConfig &&
+ config.panelConfig.styleChildren &&
+ Array.isArray(config.panelConfig.styleChildren)
+ ) {
+ config.panelConfig.styleChildren = convertFunctionsToString(
+ config.panelConfig.styleChildren,
+ );
+
+ (sectionOrControlConfig as PropertyPaneControlConfig) = config;
+ }
+
return sectionOrControlConfig;
});
}
diff --git a/app/client/src/utils/testPropertyPaneConfig.test.ts b/app/client/src/utils/testPropertyPaneConfig.test.ts
index d851b9026aea..13b61370ae2b 100644
--- a/app/client/src/utils/testPropertyPaneConfig.test.ts
+++ b/app/client/src/utils/testPropertyPaneConfig.test.ts
@@ -64,8 +64,20 @@ function validatePropertyControl(config: PropertyPaneConfig): boolean | string {
}
}
if (_config.panelConfig) {
- const res = validatePropertyPaneConfig(_config.panelConfig.children);
- if (res !== true) return `${_config.propertyName}.${res}`;
+ if (_config.panelConfig.children) {
+ const res = validatePropertyPaneConfig(_config.panelConfig.children);
+ if (res !== true) return `${_config.propertyName}.${res}`;
+ }
+ if (_config.panelConfig.contentChildren) {
+ const res = validatePropertyPaneConfig(
+ _config.panelConfig.contentChildren,
+ );
+ if (res !== true) return `${_config.propertyName}.${res}`;
+ }
+ if (_config.panelConfig.styleChildren) {
+ const res = validatePropertyPaneConfig(_config.panelConfig.styleChildren);
+ if (res !== true) return `${_config.propertyName}.${res}`;
+ }
}
return true;
}
@@ -83,9 +95,11 @@ function validateValidationStructure(
}
return true;
}
+
const isNotFloat = (n: any) => {
return Number(n) === n && n % 1 === 0;
};
+
describe("Tests all widget's propertyPane config", () => {
beforeAll(() => {
registerWidgets();
@@ -94,10 +108,17 @@ describe("Tests all widget's propertyPane config", () => {
const [widget, config]: any = widgetAndConfig;
it(`Checks ${widget.getWidgetType()}'s propertyPaneConfig`, () => {
const propertyPaneConfig = widget.getPropertyPaneConfig();
- const validatedPropertyPaneConfig = validatePropertyPaneConfig(
- propertyPaneConfig,
+ expect(validatePropertyPaneConfig(propertyPaneConfig)).toStrictEqual(
+ true,
+ );
+ const propertyPaneContentConfig = widget.getPropertyPaneContentConfig();
+ expect(
+ validatePropertyPaneConfig(propertyPaneContentConfig),
+ ).toStrictEqual(true);
+ const propertyPaneStyleConfig = widget.getPropertyPaneStyleConfig();
+ expect(validatePropertyPaneConfig(propertyPaneStyleConfig)).toStrictEqual(
+ true,
);
- expect(validatedPropertyPaneConfig).toStrictEqual(true);
});
it(`Check if ${widget.getWidgetType()}'s dimensions are always integers`, () => {
expect(isNotFloat(config.defaults.rows)).toBe(true);
diff --git a/app/client/src/widgets/AudioRecorderWidget/widget/index.tsx b/app/client/src/widgets/AudioRecorderWidget/widget/index.tsx
index d5f123884ae9..4cf53d3bd05a 100644
--- a/app/client/src/widgets/AudioRecorderWidget/widget/index.tsx
+++ b/app/client/src/widgets/AudioRecorderWidget/widget/index.tsx
@@ -26,119 +26,6 @@ class AudioRecorderWidget extends BaseWidget<
AudioRecorderWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "isDisabled",
- label: "Disabled",
- controlType: "SWITCH",
- helpText: "Disables input to this widget",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the recording starts",
- propertyName: "onRecordingStart",
- label: "onRecordingStart",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the recording ends",
- propertyName: "onRecordingComplete",
- label: "onRecordingComplete",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "accentColor",
- helpText: "Changes the color of the recorder button",
- label: "Button Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "iconColor",
- helpText: "Sets the icon color of the widget",
- label: "Icon color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/AudioWidget/widget/index.test.tsx b/app/client/src/widgets/AudioWidget/widget/index.test.tsx
index 880a2f595821..26af9a1b1a5c 100644
--- a/app/client/src/widgets/AudioWidget/widget/index.test.tsx
+++ b/app/client/src/widgets/AudioWidget/widget/index.test.tsx
@@ -19,10 +19,10 @@ const urlTests = [
];
describe("urlRegexValidation", () => {
- const generalSectionProperties: PropertyPaneControlConfig[] = AudioWidget.getPropertyPaneConfig().filter(
- (x) => x.sectionName === "General",
+ const dataSectionProperties: PropertyPaneControlConfig[] = AudioWidget.getPropertyPaneContentConfig().filter(
+ (x) => x.sectionName === "Data",
)[0].children;
- const urlPropertyControl = generalSectionProperties.filter(
+ const urlPropertyControl = dataSectionProperties.filter(
(x) => x.propertyName === "url",
)[0];
const regEx = urlPropertyControl.validation?.params?.regex;
diff --git a/app/client/src/widgets/AudioWidget/widget/index.tsx b/app/client/src/widgets/AudioWidget/widget/index.tsx
index a1d5d5520663..535912142b31 100644
--- a/app/client/src/widgets/AudioWidget/widget/index.tsx
+++ b/app/client/src/widgets/AudioWidget/widget/index.tsx
@@ -18,100 +18,6 @@ export enum PlayState {
}
class AudioWidget extends BaseWidget<AudioWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "url",
- label: "URL",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter url",
- inputType: "TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/,
- expected: {
- type: "Audio URL",
- example:
- "https://assets.appsmith.com/widgets/birds_chirping.mp3",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- propertyName: "autoPlay",
- label: "Auto Play",
- helpText: "Audio will be automatically played",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the audio is played",
- propertyName: "onPlay",
- label: "onPlay",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the audio is paused",
- propertyName: "onPause",
- label: "onPause",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the audio ends",
- propertyName: "onEnd",
- label: "onEnd",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/BaseInputWidget/widget/index.tsx b/app/client/src/widgets/BaseInputWidget/widget/index.tsx
index 858df84479f2..c48fb57ebd9d 100644
--- a/app/client/src/widgets/BaseInputWidget/widget/index.tsx
+++ b/app/client/src/widgets/BaseInputWidget/widget/index.tsx
@@ -21,360 +21,6 @@ class BaseInputWidget<
super(props);
}
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText:
- "Adds a validation to the input which displays an error on failure",
- propertyName: "regex",
- label: "Regex",
- controlType: "INPUT_TEXT",
- placeholderText: "^\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}$",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.REGEX },
- },
- {
- helpText: "Sets the input validity based on a JS expression",
- propertyName: "validation",
- label: "Valid",
- controlType: "INPUT_TEXT",
- placeholderText: "{{ Input1.text.length > 0 }}",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- params: {
- default: true,
- },
- },
- },
- {
- helpText:
- "The error message to display if the regex or valid property check fails",
- propertyName: "errorMessage",
- label: "Error Message",
- controlType: "INPUT_TEXT",
- placeholderText: "Not a valid value!",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets a placeholder text for the input",
- propertyName: "placeholderText",
- label: "Placeholder",
- controlType: "INPUT_TEXT",
- placeholderText: "Placeholder",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Show help text or details about current input",
- propertyName: "tooltip",
- label: "Tooltip",
- controlType: "INPUT_TEXT",
- placeholderText: "Value must be atleast 6 chars",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Disables input to this widget",
- propertyName: "isDisabled",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Clears the input value after submit",
- propertyName: "resetOnSubmit",
- label: "Reset on submit",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Focus input automatically on load",
- propertyName: "autoFocus",
- label: "Auto Focus",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isSpellCheck",
- label: "Spellcheck",
- helpText:
- "Defines whether the text input may be checked for spelling errors",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (props: BaseInputWidgetProps) => {
- return props.inputType !== InputTypes.TEXT;
- },
- dependencies: ["inputType"],
- },
- ],
- },
- {
- sectionName: "Actions",
- children: [
- {
- helpText: "Triggers an action when the text is changed",
- propertyName: "onTextChanged",
- label: "onTextChanged",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText:
- "Triggers an action on submit (when the enter key is pressed)",
- propertyName: "onSubmit",
- label: "onSubmit",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "label",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Name:",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: BaseInputWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: BaseInputWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Label Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- {
- propertyName: "labelTextSize",
- label: "Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "accentColor",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- invisible: true,
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/BaseWidget.tsx b/app/client/src/widgets/BaseWidget.tsx
index 0a103905db0f..a7b4d0dc006c 100644
--- a/app/client/src/widgets/BaseWidget.tsx
+++ b/app/client/src/widgets/BaseWidget.tsx
@@ -62,6 +62,14 @@ abstract class BaseWidget<
return [];
}
+ static getPropertyPaneContentConfig(): PropertyPaneConfig[] {
+ return [];
+ }
+
+ static getPropertyPaneStyleConfig(): PropertyPaneConfig[] {
+ return [];
+ }
+
static getDerivedPropertiesMap(): DerivedPropertiesMap {
return {};
}
diff --git a/app/client/src/widgets/ButtonGroupWidget/widget/index.tsx b/app/client/src/widgets/ButtonGroupWidget/widget/index.tsx
index 7c35f1de601d..ff1751c08ef1 100644
--- a/app/client/src/widgets/ButtonGroupWidget/widget/index.tsx
+++ b/app/client/src/widgets/ButtonGroupWidget/widget/index.tsx
@@ -19,492 +19,6 @@ class ButtonGroupWidget extends BaseWidget<
ButtonGroupWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Controls widget orientation",
- propertyName: "orientation",
- label: "Orientation",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Horizontal",
- value: "horizontal",
- },
- {
- label: "Vertical",
- value: "vertical",
- },
- ],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- controlType: "SWITCH",
- helpText: "Disables clicks to this widget",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Buttons",
- children: [
- {
- helpText: "Group Buttons",
- propertyName: "groupButtons",
- controlType: "GROUP_BUTTONS",
- label: "",
- isBindProperty: false,
- isTriggerProperty: false,
- dependencies: ["childStylesheet"],
- panelConfig: {
- editableTitle: true,
- titlePropertyName: "label",
- panelIdPropertyName: "id",
- updateHook: (
- props: any,
- propertyPath: string,
- propertyValue: string,
- ) => {
- return [
- {
- propertyPath,
- propertyValue,
- },
- ];
- },
- children: [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "label",
- helpText: "Sets the label of a menu item",
- label: "Label",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "buttonType",
- label: "Button Type",
- controlType: "DROP_DOWN",
- helpText: "Sets button type",
- options: [
- {
- label: "Simple",
- value: "SIMPLE",
- },
- {
- label: "Menu",
- value: "MENU",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["SIMPLE", "MENU"],
- },
- },
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables input to the widget",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Icon Options",
- children: [
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used for a button",
- controlType: "ICON_SELECT",
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "placement",
- label: "Placement",
- controlType: "DROP_DOWN",
- helpText: "Sets the space between items",
- options: [
- {
- label: "Start",
- value: ButtonPlacementTypes.START,
- },
- {
- label: "Between",
- value: ButtonPlacementTypes.BETWEEN,
- },
- {
- label: "Center",
- value: ButtonPlacementTypes.CENTER,
- },
- ],
- defaultValue: ButtonPlacementTypes.CENTER,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonPlacementTypes.START,
- ButtonPlacementTypes.BETWEEN,
- ButtonPlacementTypes.CENTER,
- ],
- default: ButtonPlacementTypes.CENTER,
- },
- },
- },
- {
- propertyName: "iconAlign",
- label: "Icon alignment",
- helpText: "Sets the icon alignment of a button",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Menu Items",
- hidden: (
- props: ButtonGroupWidgetProps,
- propertyPath: string,
- ) => {
- const buttonType = get(
- props,
- `${propertyPath}.buttonType`,
- "",
- );
- return buttonType !== "MENU";
- },
- children: [
- {
- helpText: "Menu Items",
- propertyName: "menuItems",
- controlType: "MENU_ITEMS",
- label: "",
- isBindProperty: false,
- isTriggerProperty: false,
- panelConfig: {
- editableTitle: true,
- titlePropertyName: "label",
- panelIdPropertyName: "id",
- updateHook: (
- props: any,
- propertyPath: string,
- propertyValue: string,
- ) => {
- return [
- {
- propertyPath,
- propertyValue,
- },
- ];
- },
- children: [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "label",
- helpText: "Sets the label of a menu item",
- label: "Label",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
-
- {
- propertyName: "isDisabled",
- helpText: "Disables menu item",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText:
- "Controls the visibility of menu item",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Icon Options",
- children: [
- {
- propertyName: "iconName",
- label: "Icon",
- helpText:
- "Sets the icon to be used for a menu item",
- controlType: "ICON_SELECT",
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
-
- {
- propertyName: "iconAlign",
- label: "Icon alignment",
- helpText:
- "Sets the icon alignment of a menu item",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText:
- "Triggers an action when the menu item is clicked",
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Style",
- children: [
- {
- propertyName: "iconColor",
- helpText: "Sets the icon color of a menu item",
- label: "Icon color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "backgroundColor",
- helpText:
- "Sets the background color of a menu item",
- label: "Background color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "textColor",
- helpText: "Sets the text color of a menu item",
- label: "Text color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
- },
- ],
- },
- },
- ],
- },
- {
- sectionName: "Events",
- hidden: (
- props: ButtonGroupWidgetProps,
- propertyPath: string,
- ) => {
- const buttonType = get(
- props,
- `${propertyPath}.buttonType`,
- "",
- );
- return buttonType === "MENU";
- },
- children: [
- {
- helpText: "Triggers an action when the button is clicked",
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- getStylesheetValue,
- propertyName: "buttonColor",
- helpText: "Changes the color of the button",
- label: "Button Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ],
- },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "buttonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- helpText: "Sets the variant of the button",
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- default: ButtonVariantTypes.PRIMARY,
- },
- },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/ButtonWidget/widget/index.tsx b/app/client/src/widgets/ButtonWidget/widget/index.tsx
index 611b9f7e33fa..80c7d3b9b1fd 100644
--- a/app/client/src/widgets/ButtonWidget/widget/index.tsx
+++ b/app/client/src/widgets/ButtonWidget/widget/index.tsx
@@ -352,302 +352,6 @@ class ButtonWidget extends BaseWidget<ButtonWidgetProps, ButtonWidgetState> {
];
}
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "text",
- label: "Label",
- helpText: "Sets the label of the button",
- controlType: "INPUT_TEXT",
- placeholderText: "Submit",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Show helper text with button on hover",
- propertyName: "tooltip",
- label: "Tooltip",
- controlType: "INPUT_TEXT",
- placeholderText: "Submits Form",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "googleRecaptchaKey",
- label: "Google reCAPTCHA Key",
- helpText: "Sets Google reCAPTCHA site key for the button",
- controlType: "INPUT_TEXT",
- placeholderText: "reCAPTCHA Key",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "recaptchaType",
- label: "Google reCAPTCHA Version",
- controlType: "DROP_DOWN",
- helpText: "Select reCAPTCHA version",
- options: [
- {
- label: "reCAPTCHA v3",
- value: RecaptchaTypes.V3,
- },
- {
- label: "reCAPTCHA v2",
- value: RecaptchaTypes.V2,
- },
- ],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [RecaptchaTypes.V3, RecaptchaTypes.V2],
- default: RecaptchaTypes.V3,
- },
- },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- controlType: "SWITCH",
- helpText: "Disables clicks to this widget",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- // TODO: refactor widgetParentProps implementation when we address #10659
- {
- sectionName: "Form options",
- children: [
- {
- helpText:
- "Disabled if the form is invalid, if this widget exists directly within a Form widget.",
- propertyName: "disabledWhenInvalid",
- label: "Disabled Invalid Forms",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText:
- "Resets the fields of the form, on click, if this widget exists directly within a Form widget.",
- propertyName: "resetFormOnClick",
- label: "Reset Form on Success",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the button is clicked",
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "buttonColor",
- helpText: "Changes the color of the button",
- label: "Button Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "buttonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- helpText: "Sets the variant of the icon button",
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- default: ButtonVariantTypes.PRIMARY,
- },
- },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isBindProperty: true,
- isJSConvertible: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used for the button",
- controlType: "ICON_SELECT",
- isBindProperty: false,
- isTriggerProperty: false,
- updateHook: (
- props: ButtonWidgetProps,
- propertyPath: string,
- propertyValue: string,
- ) => {
- const propertiesToUpdate = [{ propertyPath, propertyValue }];
- if (!props.iconAlign) {
- propertiesToUpdate.push({
- propertyPath: "iconAlign",
- propertyValue: Alignment.LEFT,
- });
- }
- return propertiesToUpdate;
- },
- dependencies: ["iconAlign"],
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: "placement",
- label: "Placement",
- controlType: "DROP_DOWN",
- helpText: "Sets the space between items",
- options: [
- {
- label: "Start",
- value: ButtonPlacementTypes.START,
- },
- {
- label: "Between",
- value: ButtonPlacementTypes.BETWEEN,
- },
- {
- label: "Center",
- value: ButtonPlacementTypes.CENTER,
- },
- ],
- defaultValue: ButtonPlacementTypes.CENTER,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonPlacementTypes.START,
- ButtonPlacementTypes.BETWEEN,
- ButtonPlacementTypes.CENTER,
- ],
- default: ButtonPlacementTypes.CENTER,
- },
- },
- },
- {
- propertyName: "iconAlign",
- label: "Icon Alignment",
- helpText: "Sets the icon alignment of the button",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["center", "left", "right"],
- },
- },
- },
- ],
- },
- ];
- }
-
static getMetaPropertiesMap(): Record<string, any> {
return {
recaptchaToken: undefined,
diff --git a/app/client/src/widgets/CameraWidget/widget/index.tsx b/app/client/src/widgets/CameraWidget/widget/index.tsx
index 119403cf8945..e0dcde04cdff 100644
--- a/app/client/src/widgets/CameraWidget/widget/index.tsx
+++ b/app/client/src/widgets/CameraWidget/widget/index.tsx
@@ -16,160 +16,6 @@ import {
} from "../constants";
class CameraWidget extends BaseWidget<CameraWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "mode",
- label: "Mode",
- controlType: "DROP_DOWN",
- helpText: "Whether a picture is taken or a video is recorded",
- options: [
- {
- label: "Image",
- value: "CAMERA",
- },
- {
- label: "Video",
- value: "VIDEO",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["CAMERA", "VIDEO"],
- },
- },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- controlType: "SWITCH",
- helpText: "Disables clicks to this widget",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isMirrored",
- label: "Mirrored",
- helpText: "Show camera preview and get the screenshot mirrored",
- controlType: "SWITCH",
- dependencies: ["mode"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Actions",
- children: [
- {
- helpText: "Triggers an action when the image is captured",
- propertyName: "onImageCapture",
- label: "OnImageCapture",
- controlType: "ACTION_SELECTOR",
- hidden: () => true,
- dependencies: ["mode"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the image is saved",
- propertyName: "onImageSave",
- label: "OnImageSave",
- controlType: "ACTION_SELECTOR",
- hidden: (props: CameraWidgetProps) =>
- props.mode === CameraModeTypes.VIDEO,
- dependencies: ["mode"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the video recording get started",
- propertyName: "onRecordingStart",
- label: "OnRecordingStart",
- controlType: "ACTION_SELECTOR",
- hidden: () => true,
- dependencies: ["mode"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the video recording stops",
- propertyName: "onRecordingStop",
- label: "OnRecordingStop",
- controlType: "ACTION_SELECTOR",
- hidden: () => true,
- dependencies: ["mode"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the video recording is saved",
- propertyName: "onVideoSave",
- label: "OnVideoSave",
- controlType: "ACTION_SELECTOR",
- hidden: (props: CameraWidgetProps) =>
- props.mode === CameraModeTypes.CAMERA,
- dependencies: ["mode"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/CategorySliderWidget/index.ts b/app/client/src/widgets/CategorySliderWidget/index.ts
index d4112afe1314..8cc2386e7cb6 100644
--- a/app/client/src/widgets/CategorySliderWidget/index.ts
+++ b/app/client/src/widgets/CategorySliderWidget/index.ts
@@ -40,7 +40,6 @@ export const CONFIG = {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
- config: Widget.getPropertyPaneConfig(),
contentConfig: Widget.getPropertyPaneContentConfig(),
styleConfig: Widget.getPropertyPaneStyleConfig(),
},
diff --git a/app/client/src/widgets/CategorySliderWidget/widget/index.tsx b/app/client/src/widgets/CategorySliderWidget/widget/index.tsx
index 239692709888..f85a98673ad3 100644
--- a/app/client/src/widgets/CategorySliderWidget/widget/index.tsx
+++ b/app/client/src/widgets/CategorySliderWidget/widget/index.tsx
@@ -40,10 +40,6 @@ class CategorySliderWidget extends BaseWidget<
CategorySliderWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [...contentConfig, ...styleConfig];
- }
-
static getPropertyPaneContentConfig() {
return contentConfig;
}
diff --git a/app/client/src/widgets/ChartWidget/widget/index.tsx b/app/client/src/widgets/ChartWidget/widget/index.tsx
index d910cf7b7059..7f59dcf25d07 100644
--- a/app/client/src/widgets/ChartWidget/widget/index.tsx
+++ b/app/client/src/widgets/ChartWidget/widget/index.tsx
@@ -4,7 +4,7 @@ import BaseWidget, { WidgetProps, WidgetState } from "widgets/BaseWidget";
import Skeleton from "components/utils/Skeleton";
import { retryPromise } from "utils/AppsmithUtils";
import { EventType } from "constants/AppsmithActionConstants/ActionConstants";
-import propertyConfig, { contentConfig, styleConfig } from "./propertyConfig";
+import { contentConfig, styleConfig } from "./propertyConfig";
import {
ChartType,
CustomFusionChartConfig,
@@ -31,10 +31,6 @@ class ChartWidget extends BaseWidget<ChartWidgetProps, WidgetState> {
};
}
- static getPropertyPaneConfig() {
- return propertyConfig;
- }
-
static getPropertyPaneContentConfig() {
return contentConfig;
}
diff --git a/app/client/src/widgets/ChartWidget/widget/propertyConfig.test.ts b/app/client/src/widgets/ChartWidget/widget/propertyConfig.test.ts
index e7f91e549458..e610482eced4 100644
--- a/app/client/src/widgets/ChartWidget/widget/propertyConfig.test.ts
+++ b/app/client/src/widgets/ChartWidget/widget/propertyConfig.test.ts
@@ -1,9 +1,11 @@
/* eslint-disable @typescript-eslint/no-namespace */
import { isString, get } from "lodash";
-import config from "./propertyConfig";
+import { styleConfig, contentConfig } from "./propertyConfig";
import { PropertyPaneControlConfig } from "constants/PropertyControlConstants";
+const config = [...contentConfig, ...styleConfig];
+
declare global {
namespace jest {
interface Matchers<R> {
@@ -72,7 +74,7 @@ describe("Validate Chart Widget's property config", () => {
it("Validates config when chartType is CUSTOM_FUSION_CHART", () => {
const hiddenFn: (props: any) => boolean = get(
config,
- "[0].children.[2].hidden",
+ "[0].children.[1].hidden", // propertyName: "customFusionChartConfig"
);
let result = true;
if (hiddenFn) result = hiddenFn({ chartType: "CUSTOM_FUSION_CHART" });
@@ -81,10 +83,10 @@ describe("Validate Chart Widget's property config", () => {
it("Validates that sections are hidden when chartType is CUSTOM_FUSION_CHART", () => {
const hiddenFns = [
- get(config, "[0].children.[3].hidden"),
- get(config, "[1].children.[0].hidden"),
- get(config, "[1].children.[1].hidden"),
- get(config, "[1].children.[2].hidden"),
+ get(config, "[0].children.[2].hidden"), // propertyName: "chartData"
+ get(config, "[2].children.[1].hidden"), // propertyName: "xAxisName"
+ get(config, "[2].children.[2].hidden"), // propertyName: "yAxisName"
+ get(config, "[2].children.[3].hidden"), // propertyName: "labelOrientation",
];
hiddenFns.forEach((fn: (props: any) => boolean) => {
const result = fn({ chartType: "CUSTOM_FUSION_CHART" });
diff --git a/app/client/src/widgets/ChartWidget/widget/propertyConfig.ts b/app/client/src/widgets/ChartWidget/widget/propertyConfig.ts
index e4f641e3d7e1..81fa1b1cf263 100644
--- a/app/client/src/widgets/ChartWidget/widget/propertyConfig.ts
+++ b/app/client/src/widgets/ChartWidget/widget/propertyConfig.ts
@@ -4,349 +4,6 @@ import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
import { CUSTOM_CHART_TYPES, LabelOrientation } from "../constants";
import { isLabelOrientationApplicableFor } from "../component";
-export default [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Adds a title to the chart",
- placeholderText: "Sales Report",
- propertyName: "chartName",
- label: "Title",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Changes the visualisation of the chart data",
- propertyName: "chartType",
- label: "Chart Type",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Line Chart",
- value: "LINE_CHART",
- },
- {
- label: "Bar Chart",
- value: "BAR_CHART",
- },
- {
- label: "Pie Chart",
- value: "PIE_CHART",
- },
- {
- label: "Column Chart",
- value: "COLUMN_CHART",
- },
- {
- label: "Area Chart",
- value: "AREA_CHART",
- },
- {
- label: "Custom Chart",
- value: "CUSTOM_FUSION_CHART",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- "LINE_CHART",
- "BAR_CHART",
- "PIE_CHART",
- "COLUMN_CHART",
- "AREA_CHART",
- "CUSTOM_FUSION_CHART",
- ],
- },
- },
- },
- {
- helpText: "Configure a Custom FusionChart see docs.appsmith.com",
- placeholderText: `Fusion Chart Config`,
- propertyName: "customFusionChartConfig",
- label: "Custom Fusion Chart",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- type: ValidationTypes.TEXT,
- name: "type",
- params: {
- allowedValues: CUSTOM_CHART_TYPES,
- default: "",
- required: true,
- },
- },
- {
- type: ValidationTypes.OBJECT,
- name: "dataSource",
- params: {
- allowedKeys: [
- {
- name: "chart",
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "paletteColors",
- type: ValidationTypes.TEXT,
- params: {
- strict: true,
- ignoreCase: true,
- },
- },
- ],
- default: {},
- },
- },
- {
- name: "data",
- type: ValidationTypes.ARRAY,
- params: {
- default: [],
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- },
- {
- name: "value",
- type: ValidationTypes.NUMBER,
- },
- ],
- },
- },
- },
- },
- ],
- },
- },
- ],
- },
- },
- hidden: (props: ChartWidgetProps) =>
- props.chartType !== "CUSTOM_FUSION_CHART",
- dependencies: ["chartType"],
- evaluationSubstitutionType: EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Populates the chart with the data",
- propertyName: "chartData",
- placeholderText: '[{ "x": "2021", "y": "94000" }]',
- label: "Chart Series",
- controlType: "CHART_DATA",
- isBindProperty: false,
- isTriggerProperty: false,
- hidden: (props: ChartWidgetProps) =>
- props.chartType === "CUSTOM_FUSION_CHART",
- dependencies: ["chartType"],
- children: [
- {
- helpText: "Series data",
- propertyName: "data",
- label: "Series Data",
- controlType: "INPUT_TEXT_AREA",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- required: true,
- allowedKeys: [
- {
- name: "x",
- type: ValidationTypes.TEXT,
- params: {
- required: true,
- default: "",
- },
- },
- {
- name: "y",
- type: ValidationTypes.NUMBER,
- params: {
- required: true,
- default: 10,
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Series Name",
- propertyName: "seriesName",
- label: "Series Name",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Enables scrolling inside the chart",
- propertyName: "allowScroll",
- label: "Allow scroll",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- hidden: (x: ChartWidgetProps) =>
- x.chartType === "CUSTOM_FUSION_CHART" || x.chartType === "PIE_CHART",
- dependencies: ["chartType"],
- },
- ],
- },
- {
- sectionName: "Axis",
- children: [
- {
- helpText: "Specifies the label of the x-axis",
- propertyName: "xAxisName",
- placeholderText: "Dates",
- label: "x-axis Label",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (x: any) => x.chartType === "CUSTOM_FUSION_CHART",
- dependencies: ["chartType"],
- },
- {
- helpText: "Specifies the label of the y-axis",
- propertyName: "yAxisName",
- placeholderText: "Revenue",
- label: "y-axis Label",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (x: any) => x.chartType === "CUSTOM_FUSION_CHART",
- dependencies: ["chartType"],
- },
- {
- helpText: "Changes the x-axis label orientation",
- propertyName: "labelOrientation",
- label: "x-axis Label Orientation",
- hidden: (x: ChartWidgetProps) =>
- !isLabelOrientationApplicableFor(x.chartType),
- isBindProperty: false,
- isTriggerProperty: false,
- dependencies: ["chartType"],
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Auto",
- value: LabelOrientation.AUTO,
- },
- {
- label: "Slant",
- value: LabelOrientation.SLANT,
- },
- {
- label: "Rotate",
- value: LabelOrientation.ROTATE,
- },
- {
- label: "Stagger",
- value: LabelOrientation.STAGGER,
- },
- ],
- },
- {
- propertyName: "setAdaptiveYMin",
- label: "Adaptive Axis",
- helpText: "Define the minimum scale for X/Y axis",
- controlType: "SWITCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the chart data point is clicked",
- propertyName: "onDataPointClick",
- label: "onDataPointClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
-];
-
export const contentConfig = [
{
sectionName: "Data",
diff --git a/app/client/src/widgets/CheckboxGroupWidget/widget/index.tsx b/app/client/src/widgets/CheckboxGroupWidget/widget/index.tsx
index 9e4a86b6ca32..a280baf8a50a 100644
--- a/app/client/src/widgets/CheckboxGroupWidget/widget/index.tsx
+++ b/app/client/src/widgets/CheckboxGroupWidget/widget/index.tsx
@@ -55,378 +55,6 @@ class CheckboxGroupWidget extends BaseWidget<
CheckboxGroupWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Displays a list of unique checkbox options",
- propertyName: "options",
- label: "Options",
- controlType: "OPTION_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- default: [],
- unique: ["value"],
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- required: true,
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- required: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Sets the values of the options checked by default",
- propertyName: "defaultSelectedValues",
- label: "Default Selected Values",
- placeholderText: '["apple", "orange"]',
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultSelectedValuesValidation,
- expected: {
- type: "String or Array<string>",
- example: `apple | ["apple", "orange"]`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- controlType: "SWITCH",
- helpText: "Disables input to this widget",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "isInline",
- label: "Inline",
- controlType: "SWITCH",
- helpText: "Displays the checkboxes horizontally",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "isSelectAll",
- label: "Select All Options",
- controlType: "SWITCH",
- helpText: "Controls whether select all option is shown",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "labelText",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: CheckboxGroupWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: CheckboxGroupWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "optionAlignment",
- label: "Alignment",
- controlType: "DROP_DOWN",
- helpText: "Sets alignment between options.",
- options: [
- {
- label: "None",
- value: CheckboxGroupAlignmentTypes.NONE,
- },
- {
- label: "Start",
- value: CheckboxGroupAlignmentTypes.START,
- },
- {
- label: "End",
- value: CheckboxGroupAlignmentTypes.END,
- },
- {
- label: "Center",
- value: CheckboxGroupAlignmentTypes.CENTER,
- },
- {
- label: "Between",
- value: CheckboxGroupAlignmentTypes.SPACE_BETWEEN,
- },
- {
- label: "Around",
- value: CheckboxGroupAlignmentTypes.SPACE_AROUND,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- CheckboxGroupAlignmentTypes.NONE,
- CheckboxGroupAlignmentTypes.START,
- CheckboxGroupAlignmentTypes.END,
- CheckboxGroupAlignmentTypes.CENTER,
- CheckboxGroupAlignmentTypes.SPACE_BETWEEN,
- CheckboxGroupAlignmentTypes.SPACE_AROUND,
- ],
- },
- },
- },
- {
- propertyName: "labelTextColor",
- label: "Label Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Label Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "accentColor",
- helpText: "Sets the checked state color of the checkbox",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
-
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the check state is changed",
- propertyName: "onSelectionChange",
- label: "onSelectionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/CheckboxWidget/widget/index.tsx b/app/client/src/widgets/CheckboxWidget/widget/index.tsx
index 6c3a368cd89a..533ad76c091f 100644
--- a/app/client/src/widgets/CheckboxWidget/widget/index.tsx
+++ b/app/client/src/widgets/CheckboxWidget/widget/index.tsx
@@ -9,234 +9,6 @@ import { LabelPosition } from "components/constants";
import { AlignWidgetTypes } from "widgets/constants";
class CheckboxWidget extends BaseWidget<CheckboxWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "Label",
- children: [
- {
- propertyName: "label",
- label: "Label",
- controlType: "INPUT_TEXT",
- helpText: "Displays a label next to the widget",
- placeholderText: "I agree to the T&C",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Right", value: LabelPosition.Right },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "alignWidget",
- helpText: "Sets the alignment of the widget",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- isBindProperty: true,
- isTriggerProperty: false,
- options: [
- {
- icon: "LEFT_ALIGN",
- value: AlignWidgetTypes.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: AlignWidgetTypes.RIGHT,
- },
- ],
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "General",
- children: [
- {
- propertyName: "defaultCheckedState",
- label: "Default Selected",
- helpText: "Sets the default checked state of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- controlType: "SWITCH",
- helpText: "Disables input to this widget",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the check state is changed",
- propertyName: "onCheckChange",
- label: "onCheckChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Label Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- {
- propertyName: "labelTextSize",
- label: "Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "accentColor",
- helpText: "Sets the checked state color of the checkbox",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/CodeScannerWidget/index.ts b/app/client/src/widgets/CodeScannerWidget/index.ts
index f20e9f24d767..73c6d4c65757 100644
--- a/app/client/src/widgets/CodeScannerWidget/index.ts
+++ b/app/client/src/widgets/CodeScannerWidget/index.ts
@@ -29,7 +29,6 @@ export const CONFIG = {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
- config: Widget.getPropertyPaneConfig(),
styleConfig: Widget.getPropertyPaneStyleConfig(),
contentConfig: Widget.getPropertyPaneContentConfig(),
},
diff --git a/app/client/src/widgets/CodeScannerWidget/widget/index.tsx b/app/client/src/widgets/CodeScannerWidget/widget/index.tsx
index d7b44fee9c4d..f0838e378781 100644
--- a/app/client/src/widgets/CodeScannerWidget/widget/index.tsx
+++ b/app/client/src/widgets/CodeScannerWidget/widget/index.tsx
@@ -10,10 +10,6 @@ class CodeScannerWidget extends BaseWidget<
CodeScannerWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [...contentConfig, ...styleConfig];
- }
-
static getPropertyPaneContentConfig() {
return contentConfig;
}
diff --git a/app/client/src/widgets/ContainerWidget/widget/index.tsx b/app/client/src/widgets/ContainerWidget/widget/index.tsx
index 744e2cde67eb..a526c6666538 100644
--- a/app/client/src/widgets/ContainerWidget/widget/index.tsx
+++ b/app/client/src/widgets/ContainerWidget/widget/index.tsx
@@ -30,103 +30,6 @@ class ContainerWidget extends BaseWidget<
this.renderChildWidget = this.renderChildWidget.bind(this);
}
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Enables scrolling for content inside the widget",
- propertyName: "shouldScrollContents",
- label: "Scroll Contents",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- helpText: "Use a html color name, HEX, RGB or RGBA value",
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- propertyName: "backgroundColor",
- label: "Background Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Use a html color name, HEX, RGB or RGBA value",
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- propertyName: "borderColor",
- label: "Border Color",
- controlType: "COLOR_PICKER",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Enter value for border width",
- propertyName: "borderWidth",
- label: "Border Width",
- placeholderText: "Enter value in px",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/CurrencyInputWidget/widget/index.tsx b/app/client/src/widgets/CurrencyInputWidget/widget/index.tsx
index f3a31df6fd0c..9c06d16c99c8 100644
--- a/app/client/src/widgets/CurrencyInputWidget/widget/index.tsx
+++ b/app/client/src/widgets/CurrencyInputWidget/widget/index.tsx
@@ -96,89 +96,6 @@ class CurrencyInputWidget extends BaseInputWidget<
CurrencyInputWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return mergeWidgetConfig(
- [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "allowCurrencyChange",
- label: "Allow currency change",
- helpText: "Search by currency or country",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Changes the type of currency",
- propertyName: "defaultCurrencyCode",
- label: "Currency",
- enableSearch: true,
- dropdownHeight: "156px",
- controlType: "DROP_DOWN",
- searchPlaceholderText: "Search by code or name",
- options: CurrencyDropdownOptions,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- helpText: "No. of decimals in currency input",
- propertyName: "decimals",
- label: "Decimals",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "0",
- value: 0,
- },
- {
- label: "1",
- value: 1,
- },
- {
- label: "2",
- value: 2,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- helpText:
- "Sets the default text of the widget. The text is updated if the default text changes",
- propertyName: "defaultText",
- label: "Default Text",
- controlType: "INPUT_TEXT",
- placeholderText: "100",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultValueValidation,
- expected: {
- type: "number",
- example: `100`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- dependencies: ["decimals"],
- },
- ],
- },
- ],
- super.getPropertyPaneConfig(),
- );
- }
-
static getPropertyPaneContentConfig() {
return mergeWidgetConfig(
[
diff --git a/app/client/src/widgets/DatePickerWidget2/widget/index.tsx b/app/client/src/widgets/DatePickerWidget2/widget/index.tsx
index 79c3c81c056f..6c43a489d775 100644
--- a/app/client/src/widgets/DatePickerWidget2/widget/index.tsx
+++ b/app/client/src/widgets/DatePickerWidget2/widget/index.tsx
@@ -25,380 +25,6 @@ function allowedRange(value: any) {
};
}
class DatePickerWidget extends BaseWidget<DatePickerWidget2Props, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "defaultDate",
- label: "Default Date",
- helpText:
- "Sets the default date of the widget. The date is updated if the default date changes",
- controlType: "DATE_PICKER",
- placeholderText: "Enter Default Date",
- useValidationMessage: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.DATE_ISO_STRING },
- },
- {
- helpText: "Sets the format of the selected date",
- propertyName: "dateFormat",
- label: "Date Format",
- controlType: "DROP_DOWN",
- isJSConvertible: true,
- optionWidth: "340px",
- options: DateFormatOptions,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hideSubText: true,
- },
- {
- propertyName: "timePrecision",
- label: "Time precision",
- controlType: "DROP_DOWN",
- helpText: "Sets the different time picker or hide.",
- defaultValue: TimePrecision.MINUTE,
- options: [
- {
- label: "None",
- value: TimePrecision.NONE,
- },
- {
- label: "Minute",
- value: TimePrecision.MINUTE,
- },
- {
- label: "Second",
- value: TimePrecision.SECOND,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- TimePrecision.NONE,
- TimePrecision.MINUTE,
- TimePrecision.SECOND,
- ],
- default: TimePrecision.MINUTE,
- },
- },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- helpText: "Disables input to this widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "closeOnSelection",
- label: "Close On Selection",
- helpText: "Calender should close when a date is selected",
- controlType: "SWITCH",
- defaultValue: true,
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "shortcuts",
- label: "Show Shortcuts",
- helpText: "Choose to show shortcut menu",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "minDate",
- label: "Min Date",
- helpText: "Defines the min date for this widget",
- controlType: "DATE_PICKER",
- useValidationMessage: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.DATE_ISO_STRING },
- },
- {
- propertyName: "maxDate",
- label: "Max Date",
- helpText: "Defines the max date for this widget",
- controlType: "DATE_PICKER",
- useValidationMessage: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.DATE_ISO_STRING },
- },
- {
- propertyName: "firstDayOfWeek",
- label: "First Day Of Week",
- helpText: "Defines the first day of the week for calendar",
- controlType: "INPUT_TEXT",
- defaultValue: "0",
- inputType: "INTEGER",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: allowedRange,
- expected: {
- type:
- "0 : sunday\n1 : monday\n2 : tuesday\n3 : wednesday\n4 : thursday\n5 : friday\n6 : saturday",
- example: "0",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "label",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: DatePickerWidget2Props) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: DatePickerWidget2Props) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Label Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Label Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- propertyName: "onDateSelected",
- label: "onDateSelected",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
-
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "accentColor",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- invisible: true,
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/DividerWidget/widget/index.tsx b/app/client/src/widgets/DividerWidget/widget/index.tsx
index f5140be0693c..74c376ddffc7 100644
--- a/app/client/src/widgets/DividerWidget/widget/index.tsx
+++ b/app/client/src/widgets/DividerWidget/widget/index.tsx
@@ -6,182 +6,6 @@ import DividerComponent from "../component";
import { ValidationTypes } from "constants/WidgetValidation";
class DividerWidget extends BaseWidget<DividerWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Controls widget orientation",
- propertyName: "orientation",
- label: "Orientation",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Horizontal",
- value: "horizontal",
- },
- {
- label: "Vertical",
- value: "vertical",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- helpText: "Controls the style of the divider",
- propertyName: "strokeStyle",
- label: "Dash Style",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Solid",
- value: "solid",
- icon: "cap-solid",
- iconSize: "large",
- },
- {
- label: "Dashed",
- value: "dashed",
- icon: "line-dashed",
- iconSize: "large",
- },
- {
- label: "Dotted",
- value: "dotted",
- icon: "line-dotted",
- iconSize: "large",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Controls the thickness of divider",
- propertyName: "thickness",
- label: "Thickness (px)",
- controlType: "INPUT_TEXT",
- placeholderText: "5",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.NUMBER,
- params: { min: 0, default: 0 },
- },
- },
- {
- helpText: "Controls the stroke color of divider",
- propertyName: "dividerColor",
- label: "Divider Color",
- controlType: "COLOR_PICKER",
- isBindProperty: true,
- isJSConvertible: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- {
- helpText: "Controls the type of divider cap",
- propertyName: "capType",
- label: "Cap",
- controlType: "DROP_DOWN",
- isJSConvertible: true,
- options: [
- {
- label: "No Cap",
- value: "nc",
- icon: "cap-solid",
- iconSize: "large",
- },
- {
- label: "Arrow",
- value: "arrow",
- icon: "arrow-forward",
- iconSize: "large",
- },
- {
- label: "Dot",
- value: "dot",
- icon: "cap-dot",
- iconSize: "large",
- },
- ],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["nc", "arrow", "dot"],
- required: true,
- default: "nc",
- },
- },
- },
- {
- helpText:
- "Changes the position of the cap if a valid cap is selected.",
- propertyName: "capSide",
- label: "Cap Position",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "DIVIDER_CAP_LEFT",
- value: -1,
- },
- {
- icon: "DIVIDER_CAP_ALL",
- value: 0,
- width: 48,
- },
- {
- icon: "DIVIDER_CAP_RIGHT",
- value: 1,
- },
- ],
- defaultValue: "0",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/DocumentViewerWidget/widget/index.tsx b/app/client/src/widgets/DocumentViewerWidget/widget/index.tsx
index b1a9bd2db12e..a1a7b85d6576 100644
--- a/app/client/src/widgets/DocumentViewerWidget/widget/index.tsx
+++ b/app/client/src/widgets/DocumentViewerWidget/widget/index.tsx
@@ -64,58 +64,6 @@ class DocumentViewerWidget extends BaseWidget<
DocumentViewerWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText:
- "Document url for preview. for URL, supported extensions are txt, pdf, docx, ppt, pptx, xlsx. ppt is currently not supported by base64.",
- propertyName: "docUrl",
- label: "Document Link",
- controlType: "INPUT_TEXT",
- placeholderText: "URL / Base64",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: documentUrlValidation,
- expected: {
- type: "URL / Base64",
- example: "https://www.example.com",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- helpText: "Controls visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/FilePickerWidgetV2/widget/index.tsx b/app/client/src/widgets/FilePickerWidgetV2/widget/index.tsx
index 319917a145ac..b1af48b38282 100644
--- a/app/client/src/widgets/FilePickerWidgetV2/widget/index.tsx
+++ b/app/client/src/widgets/FilePickerWidgetV2/widget/index.tsx
@@ -211,230 +211,6 @@ class FilePickerWidget extends BaseWidget<
};
}
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "label",
- label: "Label",
- controlType: "INPUT_TEXT",
- helpText: "Sets the label of the button",
- placeholderText: "Select Files",
- inputType: "TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "maxNumFiles",
- label: "Max No. files",
- helpText:
- "Sets the maximum number of files that can be uploaded at once",
- controlType: "INPUT_TEXT",
- placeholderText: "1",
- inputType: "INTEGER",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- },
- {
- propertyName: "maxFileSize",
- helpText: "Sets the maximum size of each file that can be uploaded",
- label: "Max file size(Mb)",
- controlType: "INPUT_TEXT",
- placeholderText: "5",
- inputType: "INTEGER",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.NUMBER,
- params: { min: 1, max: 100, default: 5 },
- },
- },
- {
- propertyName: "allowedFileTypes",
- helpText: "Restricts the type of files which can be uploaded",
- label: "Allowed File Types",
- controlType: "DROP_DOWN",
- isMultiSelect: true,
- placeholderText: "Select File types",
- options: [
- {
- label: "Any File",
- value: "*",
- },
- {
- label: "Images",
- value: "image/*",
- },
- {
- label: "Videos",
- value: "video/*",
- },
- {
- label: "Audio",
- value: "audio/*",
- },
- {
- label: "Text",
- value: "text/*",
- },
- {
- label: "MS Word",
- value: ".doc",
- },
- {
- label: "JPEG",
- value: "image/jpeg",
- },
- {
- label: "PNG",
- value: ".png",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- unique: true,
- children: {
- type: ValidationTypes.TEXT,
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Set the format of the data read from the files",
- propertyName: "fileDataType",
- label: "Data Format",
- controlType: "DROP_DOWN",
- options: [
- {
- label: FileDataTypes.Base64,
- value: FileDataTypes.Base64,
- },
- {
- label: FileDataTypes.Binary,
- value: FileDataTypes.Binary,
- },
- {
- label: FileDataTypes.Text,
- value: FileDataTypes.Text,
- },
- {
- label: CSV_ARRAY_LABEL,
- value: FileDataTypes.Array,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disable",
- helpText: "Disables input to this widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText:
- "Triggers an action when the user selects a file. Upload files to a CDN and stores their URLs in filepicker.files",
- propertyName: "onFilesSelected",
- label: "onFilesSelected",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
-
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "buttonColor",
- helpText: "Changes the color of the button",
- label: "Button Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
-
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/FormButtonWidget/widget/index.tsx b/app/client/src/widgets/FormButtonWidget/widget/index.tsx
index 0d4c9cc20e37..02725ac8d540 100644
--- a/app/client/src/widgets/FormButtonWidget/widget/index.tsx
+++ b/app/client/src/widgets/FormButtonWidget/widget/index.tsx
@@ -10,12 +10,15 @@ import { ValidationTypes } from "constants/WidgetValidation";
import ButtonWidget from "widgets/ButtonWidget";
import {
ButtonBorderRadius,
+ ButtonPlacementTypes,
ButtonVariant,
+ ButtonVariantTypes,
RecaptchaType,
RecaptchaTypes,
} from "components/constants";
import { IconName } from "@blueprintjs/icons";
import { Alignment } from "@blueprintjs/core";
+import { ButtonWidgetProps } from "widgets/ButtonWidget/widget";
class FormButtonWidget extends ButtonWidget {
constructor(props: FormButtonWidgetProps) {
@@ -23,89 +26,288 @@ class FormButtonWidget extends ButtonWidget {
}
static getPropertyPaneConfig() {
- const buttonPropertyPaneConfig = super.getPropertyPaneConfig().slice(1);
- buttonPropertyPaneConfig.unshift({
- sectionName: "General",
- children: [
- {
- propertyName: "text",
- label: "Label",
- helpText: "Sets the label of the button",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Show helper text with button on hover",
- propertyName: "tooltip",
- label: "Tooltip",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter tooltip text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "googleRecaptchaKey",
- label: "Google Recaptcha Key",
- helpText: "Sets Google Recaptcha v3 site key for button",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter google recaptcha key",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "recaptchaType",
- label: "Google reCAPTCHA Version",
- controlType: "DROP_DOWN",
- helpText: "Select reCAPTCHA version",
- options: [
- {
- label: "reCAPTCHA v3",
- value: RecaptchaTypes.V3,
+ return [
+ {
+ sectionName: "General",
+ children: [
+ {
+ propertyName: "text",
+ label: "Label",
+ helpText: "Sets the label of the button",
+ controlType: "INPUT_TEXT",
+ placeholderText: "Enter label text",
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.TEXT },
+ },
+ {
+ helpText: "Show helper text with button on hover",
+ propertyName: "tooltip",
+ label: "Tooltip",
+ controlType: "INPUT_TEXT",
+ placeholderText: "Enter tooltip text",
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.TEXT },
+ },
+ {
+ propertyName: "isVisible",
+ label: "Visible",
+ helpText: "Controls the visibility of the widget",
+ controlType: "SWITCH",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.BOOLEAN },
+ },
+ {
+ propertyName: "animateLoading",
+ label: "Animate Loading",
+ controlType: "SWITCH",
+ helpText: "Controls the loading of the widget",
+ defaultValue: true,
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.BOOLEAN },
+ },
+ {
+ propertyName: "googleRecaptchaKey",
+ label: "Google Recaptcha Key",
+ helpText: "Sets Google Recaptcha v3 site key for button",
+ controlType: "INPUT_TEXT",
+ placeholderText: "Enter google recaptcha key",
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.TEXT },
+ },
+ {
+ propertyName: "recaptchaType",
+ label: "Google reCAPTCHA Version",
+ controlType: "DROP_DOWN",
+ helpText: "Select reCAPTCHA version",
+ options: [
+ {
+ label: "reCAPTCHA v3",
+ value: RecaptchaTypes.V3,
+ },
+ {
+ label: "reCAPTCHA v2",
+ value: RecaptchaTypes.V2,
+ },
+ ],
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: [RecaptchaTypes.V3, RecaptchaTypes.V2],
+ default: RecaptchaTypes.V3,
+ },
+ },
+ },
+ ],
+ },
+ {
+ sectionName: "Form options",
+ children: [
+ {
+ helpText:
+ "Disabled if the form is invalid, if this widget exists directly within a Form widget.",
+ propertyName: "disabledWhenInvalid",
+ label: "Disabled Invalid Forms",
+ controlType: "SWITCH",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.BOOLEAN },
+ },
+ {
+ helpText:
+ "Resets the fields of the form, on click, if this widget exists directly within a Form widget.",
+ propertyName: "resetFormOnClick",
+ label: "Reset Form on Success",
+ controlType: "SWITCH",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.BOOLEAN },
+ },
+ ],
+ },
+ {
+ sectionName: "Events",
+ children: [
+ {
+ helpText: "Triggers an action when the button is clicked",
+ propertyName: "onClick",
+ label: "onClick",
+ controlType: "ACTION_SELECTOR",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: true,
+ },
+ ],
+ },
+ {
+ sectionName: "Styles",
+ children: [
+ {
+ propertyName: "buttonColor",
+ helpText: "Changes the color of the button",
+ label: "Button Color",
+ controlType: "COLOR_PICKER",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.TEXT },
+ },
+ {
+ propertyName: "buttonVariant",
+ label: "Button Variant",
+ controlType: "DROP_DOWN",
+ helpText: "Sets the variant of the icon button",
+ options: [
+ {
+ label: "Primary",
+ value: ButtonVariantTypes.PRIMARY,
+ },
+ {
+ label: "Secondary",
+ value: ButtonVariantTypes.SECONDARY,
+ },
+ {
+ label: "Tertiary",
+ value: ButtonVariantTypes.TERTIARY,
+ },
+ ],
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: [
+ ButtonVariantTypes.PRIMARY,
+ ButtonVariantTypes.SECONDARY,
+ ButtonVariantTypes.TERTIARY,
+ ],
+ default: ButtonVariantTypes.PRIMARY,
+ },
},
- {
- label: "reCAPTCHA v2",
- value: RecaptchaTypes.V2,
+ },
+ {
+ propertyName: "borderRadius",
+ label: "Border Radius",
+ helpText:
+ "Rounds the corners of the icon button's outer border edge",
+ controlType: "BORDER_RADIUS_OPTIONS",
+ isBindProperty: true,
+ isJSConvertible: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TEXT,
+ },
+ },
+ {
+ propertyName: "boxShadow",
+ label: "Box Shadow",
+ helpText:
+ "Enables you to cast a drop shadow from the frame of the widget",
+ controlType: "BOX_SHADOW_OPTIONS",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.TEXT },
+ },
+ {
+ propertyName: "iconName",
+ label: "Icon",
+ helpText: "Sets the icon to be used for the button",
+ controlType: "ICON_SELECT",
+ isBindProperty: false,
+ isTriggerProperty: false,
+ updateHook: (
+ props: ButtonWidgetProps,
+ propertyPath: string,
+ propertyValue: string,
+ ) => {
+ const propertiesToUpdate = [{ propertyPath, propertyValue }];
+ if (!props.iconAlign) {
+ propertiesToUpdate.push({
+ propertyPath: "iconAlign",
+ propertyValue: Alignment.LEFT,
+ });
+ }
+ return propertiesToUpdate;
},
- ],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [RecaptchaTypes.V3, RecaptchaTypes.V2],
- default: RecaptchaTypes.V3,
+ dependencies: ["iconAlign"],
+ validation: {
+ type: ValidationTypes.TEXT,
},
},
- },
- ],
- });
- return buttonPropertyPaneConfig;
+ {
+ propertyName: "placement",
+ label: "Placement",
+ controlType: "DROP_DOWN",
+ helpText: "Sets the space between items",
+ options: [
+ {
+ label: "Start",
+ value: ButtonPlacementTypes.START,
+ },
+ {
+ label: "Between",
+ value: ButtonPlacementTypes.BETWEEN,
+ },
+ {
+ label: "Center",
+ value: ButtonPlacementTypes.CENTER,
+ },
+ ],
+ defaultValue: ButtonPlacementTypes.CENTER,
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: [
+ ButtonPlacementTypes.START,
+ ButtonPlacementTypes.BETWEEN,
+ ButtonPlacementTypes.CENTER,
+ ],
+ default: ButtonPlacementTypes.CENTER,
+ },
+ },
+ },
+ {
+ propertyName: "iconAlign",
+ label: "Icon Alignment",
+ helpText: "Sets the icon alignment of the button",
+ controlType: "ICON_TABS",
+ options: [
+ {
+ icon: "VERTICAL_LEFT",
+ value: "left",
+ },
+ {
+ icon: "VERTICAL_RIGHT",
+ value: "right",
+ },
+ ],
+ isBindProperty: false,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: ["center", "left", "right"],
+ },
+ },
+ },
+ ],
+ },
+ ];
}
clickWithRecaptcha(token: string) {
diff --git a/app/client/src/widgets/IconButtonWidget/widget/index.tsx b/app/client/src/widgets/IconButtonWidget/widget/index.tsx
index e5423aa932ea..c445a6dd46c3 100644
--- a/app/client/src/widgets/IconButtonWidget/widget/index.tsx
+++ b/app/client/src/widgets/IconButtonWidget/widget/index.tsx
@@ -26,164 +26,6 @@ export interface IconButtonWidgetProps extends WidgetProps {
}
class IconButtonWidget extends BaseWidget<IconButtonWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used for the icon button",
- controlType: "ICON_SELECT",
- defaultIconName: "plus",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
- default: IconNames.PLUS,
- },
- },
- },
- {
- helpText: "Show helper text with button on hover",
- propertyName: "tooltip",
- label: "Tooltip",
- controlType: "INPUT_TEXT",
- placeholderText: "Add Input Field",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables input to the widget",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the button is clicked",
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "buttonColor",
- helpText: "Sets the style of the icon button",
- label: "Button Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- {
- propertyName: "buttonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- helpText: "Sets the variant of the icon button",
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- default: ButtonVariantTypes.PRIMARY,
- },
- },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/IframeWidget/widget/index.tsx b/app/client/src/widgets/IframeWidget/widget/index.tsx
index fb2d91289fb0..b84df0efec5c 100644
--- a/app/client/src/widgets/IframeWidget/widget/index.tsx
+++ b/app/client/src/widgets/IframeWidget/widget/index.tsx
@@ -6,156 +6,6 @@ import IframeComponent from "../component";
import { IframeWidgetProps } from "../constants";
class IframeWidget extends BaseWidget<IframeWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "source",
- helpText: "The URL of the page to embed",
- label: "URL",
- controlType: "INPUT_TEXT",
- placeholderText: "https://docs.appsmith.com",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.SAFE_URL,
- params: {
- default: "https://www.example.com",
- },
- },
- },
- {
- propertyName: "srcDoc",
- helpText: "Inline HTML to embed, overriding the src attribute",
- label: "srcDoc",
- controlType: "INPUT_TEXT",
- placeholderText: "<p>Inline HTML</p>",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: "title",
- helpText: "Label the content of the page to embed",
- label: "Title",
- controlType: "INPUT_TEXT",
- placeholderText: "Documentation",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the source URL is changed",
- propertyName: "onURLChanged",
- label: "onURLChanged",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the srcDoc is changed",
- propertyName: "onSrcDocChanged",
- label: "onSrcDocChanged",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when a message event is received",
- propertyName: "onMessageReceived",
- label: "onMessageReceived",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "borderColor",
- label: "Border Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderOpacity",
- label: "Border Opacity (%)",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- inputType: "NUMBER",
- validation: {
- type: ValidationTypes.NUMBER,
- params: { min: 0, max: 100, default: 100 },
- },
- },
- {
- propertyName: "borderWidth",
- label: "Border Width (px)",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- inputType: "NUMBER",
- validation: {
- type: ValidationTypes.NUMBER,
- params: { min: 0, default: 1 },
- },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/ImageWidget/widget/index.tsx b/app/client/src/widgets/ImageWidget/widget/index.tsx
index 1a87247b65ba..8a08d8ee6a6e 100644
--- a/app/client/src/widgets/ImageWidget/widget/index.tsx
+++ b/app/client/src/widgets/ImageWidget/widget/index.tsx
@@ -13,185 +13,6 @@ class ImageWidget extends BaseWidget<ImageWidgetProps, WidgetState> {
this.onImageClick = this.onImageClick.bind(this);
}
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Sets the image to be displayed",
- propertyName: "image",
- label: "Image",
- controlType: "INPUT_TEXT",
- placeholderText: "URL / Base64",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.IMAGE_URL },
- },
- {
- helpText: "Sets the default image to be displayed when load fails",
- propertyName: "defaultImage",
- label: "Default Image",
- controlType: "INPUT_TEXT",
- placeholderText: "URL / Base64",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.IMAGE_URL },
- },
- {
- helpText:
- "Sets how the Image should be resized to fit its container.",
- propertyName: "objectFit",
- label: "Object Fit",
- controlType: "DROP_DOWN",
- defaultValue: "contain",
- options: [
- {
- label: "Contain",
- value: "contain",
- },
- {
- label: "Cover",
- value: "cover",
- },
- {
- label: "Auto",
- value: "auto",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["contain", "cover", "auto"],
- },
- },
- },
- {
- helpText: "Controls the max zoom of the widget",
- propertyName: "maxZoomLevel",
- label: "Max Zoom Level",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "1x (No Zoom)",
- value: 1,
- },
- {
- label: "2x",
- value: 2,
- },
- {
- label: "4x",
- value: 4,
- },
- {
- label: "8x",
- value: 8,
- },
- {
- label: "16x",
- value: 16,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.NUMBER,
- params: { allowedValues: [1, 2, 4, 8, 16] },
- },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls if the image is allowed to rotate",
- propertyName: "enableRotation",
- label: "Enable Rotation",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls if the image is allowed to download",
- propertyName: "enableDownload",
- label: "Enable Download",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText:
- "Triggers an action when a user changes the selected option",
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/InputWidgetV2/widget/index.tsx b/app/client/src/widgets/InputWidgetV2/widget/index.tsx
index ff78af4942b7..418c67e70693 100644
--- a/app/client/src/widgets/InputWidgetV2/widget/index.tsx
+++ b/app/client/src/widgets/InputWidgetV2/widget/index.tsx
@@ -173,173 +173,6 @@ export function maxValueValidation(max: any, props: InputWidgetProps, _?: any) {
}
}
class InputWidget extends BaseInputWidget<InputWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return mergeWidgetConfig(
- [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Changes the type of data captured in the input",
- propertyName: "inputType",
- label: "Data Type",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Text",
- value: "TEXT",
- },
- {
- label: "Number",
- value: "NUMBER",
- },
- {
- label: "Password",
- value: "PASSWORD",
- },
- {
- label: "Email",
- value: "EMAIL",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- helpText: "Sets maximum allowed text length",
- propertyName: "maxChars",
- label: "Max Chars",
- controlType: "INPUT_TEXT",
- placeholderText: "255",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.NUMBER,
- params: { min: 1, natural: true },
- },
- hidden: (props: InputWidgetProps) => {
- return props.inputType !== InputTypes.TEXT;
- },
- dependencies: ["inputType"],
- },
- {
- helpText:
- "Sets the default text of the widget. The text is updated if the default text changes",
- propertyName: "defaultText",
- label: "Default Text",
- controlType: "INPUT_TEXT",
- placeholderText: "John Doe",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultValueValidation,
- expected: {
- type: "string or number",
- example: `John | 123`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- dependencies: ["inputType"],
- },
- {
- helpText: "Sets the minimum allowed value",
- propertyName: "minNum",
- label: "Min",
- controlType: "INPUT_TEXT",
- placeholderText: "1",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: minValueValidation,
- expected: {
- type: "number",
- example: `1`,
- autocompleteDataType: AutocompleteDataType.NUMBER,
- },
- },
- },
- hidden: (props: InputWidgetProps) => {
- return props.inputType !== InputTypes.NUMBER;
- },
- dependencies: ["inputType"],
- },
- {
- helpText: "Sets the maximum allowed value",
- propertyName: "maxNum",
- label: "Max",
- controlType: "INPUT_TEXT",
- placeholderText: "100",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: maxValueValidation,
- expected: {
- type: "number",
- example: `100`,
- autocompleteDataType: AutocompleteDataType.NUMBER,
- },
- },
- },
- hidden: (props: InputWidgetProps) => {
- return props.inputType !== InputTypes.NUMBER;
- },
- dependencies: ["inputType"],
- },
- ],
- },
- {
- sectionName: "Icon Options",
- children: [
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used in input field",
- controlType: "ICON_SELECT",
- isBindProperty: true,
- isTriggerProperty: false,
- isJSConvertible: true,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
- },
- },
- },
- {
- propertyName: "iconAlign",
- label: "Icon alignment",
- helpText: "Sets the icon alignment of input field",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: InputWidgetProps) => !props.iconName,
- dependencies: ["iconName"],
- },
- ],
- },
- ],
- super.getPropertyPaneConfig(),
- );
- }
-
static getPropertyPaneContentConfig() {
return mergeWidgetConfig(
[
diff --git a/app/client/src/widgets/JSONFormWidget/widget/index.tsx b/app/client/src/widgets/JSONFormWidget/widget/index.tsx
index 94b2bf56b33e..b81f5d891575 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/index.tsx
+++ b/app/client/src/widgets/JSONFormWidget/widget/index.tsx
@@ -6,7 +6,7 @@ import { klona } from "klona";
import BaseWidget, { WidgetProps, WidgetState } from "widgets/BaseWidget";
import JSONFormComponent from "../component";
-import propertyConfig, { contentConfig, styleConfig } from "./propertyConfig";
+import { contentConfig, styleConfig } from "./propertyConfig";
import { AppState } from "@appsmith/reducers";
import { DerivedPropertiesMap } from "utils/WidgetFactory";
import {
@@ -99,10 +99,6 @@ class JSONFormWidget extends BaseWidget<
metaInternalFieldState: {},
};
- static getPropertyPaneConfig() {
- return propertyConfig;
- }
-
static getPropertyPaneContentConfig() {
return contentConfig;
}
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.test.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.test.ts
index 7a95adbc4bed..6a7578243a8c 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.test.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.test.ts
@@ -10,7 +10,7 @@ describe(".generatePanelPropertyConfig", () => {
it("ACTION_SELECTOR control field should not have customJSControl and have additionalAutoComplete", (done) => {
const panelConfig = generatePanelPropertyConfig(1);
- panelConfig?.children.forEach((section) => {
+ panelConfig?.children?.forEach((section) => {
if ("sectionName" in section) {
section.children?.forEach((property) => {
if ("propertyName" in property) {
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.ts
index 7b61d71dc894..997de01182b6 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.ts
@@ -103,161 +103,6 @@ export const onGenerateFormClick = ({
const generateFormCTADisabled = (widgetProps: JSONFormWidgetProps) =>
widgetProps.autoGenerateForm;
-const generateButtonStyleControlsFor = (prefix: string) => [
- {
- propertyName: `${prefix}.buttonColor`,
- helpText: "Changes the color of the button",
- label: "Button Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: `${prefix}.buttonVariant`,
- label: "Button Variant",
- controlType: "DROP_DOWN",
- helpText: "Sets the variant of the icon button",
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- default: ButtonVariantTypes.PRIMARY,
- },
- },
- },
- {
- propertyName: `${prefix}.borderRadius`,
- label: "Border Radius",
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: `${prefix}.boxShadow`,
- label: "Box Shadow",
- helpText: "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: `${prefix}.iconName`,
- label: "Icon",
- helpText: "Sets the icon to be used for the button",
- controlType: "ICON_SELECT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- updateHook: (
- props: ButtonWidgetProps,
- propertyPath: string,
- propertyValue: string,
- ) => {
- const propertiesToUpdate = [{ propertyPath, propertyValue }];
- if (!props.iconAlign) {
- propertiesToUpdate.push({
- propertyPath: `${prefix}.iconAlign`,
- propertyValue: Alignment.LEFT,
- });
- }
- return propertiesToUpdate;
- },
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: `${prefix}.placement`,
- label: "Placement",
- controlType: "DROP_DOWN",
- helpText: "Sets the space between items",
- options: [
- {
- label: "Start",
- value: ButtonPlacementTypes.START,
- },
- {
- label: "Between",
- value: ButtonPlacementTypes.BETWEEN,
- },
- {
- label: "Center",
- value: ButtonPlacementTypes.CENTER,
- },
- ],
- defaultValue: ButtonPlacementTypes.CENTER,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonPlacementTypes.START,
- ButtonPlacementTypes.BETWEEN,
- ButtonPlacementTypes.CENTER,
- ],
- default: ButtonPlacementTypes.CENTER,
- },
- },
- },
- {
- propertyName: `${prefix}.iconAlign`,
- label: "Icon Alignment",
- helpText: "Sets the icon alignment of the button",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["center", "left", "right"],
- },
- },
- },
-];
-
export const contentConfig = [
{
sectionName: "Data",
@@ -678,246 +523,3 @@ export const styleConfig = [
hidden: (props: JSONFormWidgetProps) => !props.showReset,
},
];
-
-export default [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "title",
- label: "Title",
- helpText: "Sets the title of the form",
- controlType: "INPUT_TEXT",
- placeholderText: "Update Order",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "sourceData",
- helpText: "Input JSON sample for default form layout",
- label: "Source Data",
- controlType: "INPUT_TEXT",
- placeholderText: '{ "name": "John", "age": 24 }',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: sourceDataValidationFn,
- expected: {
- type: "JSON",
- example: `{ "name": "John Doe", "age": 29 }`,
- autocompleteDataType: AutocompleteDataType.OBJECT,
- },
- },
- },
- evaluationSubstitutionType: EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- propertyName: "autoGenerateForm",
- helpText:
- "Caution: When auto generate form is enabled, the form fields would regenerate if there is any change of source data (keys change or value type changes eg from string to number). If disabled then the fields and their configuration won't change with the change of source data.",
- label: "Auto Generate Form",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- customJSControl: "INPUT_TEXT",
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "generateFormButton",
- label: "",
- controlType: "BUTTON",
- isJSConvertible: false,
- isBindProperty: false,
- buttonLabel: "Generate Form",
- onClick: onGenerateFormClick,
- isDisabled: generateFormCTADisabled,
- isTriggerProperty: false,
- dependencies: [
- "autoGenerateForm",
- "schema",
- "fieldLimitExceeded",
- "childStylesheet",
- ],
- evaluatedDependencies: ["sourceData"],
- },
- {
- propertyName: `schema.${ROOT_SCHEMA_KEY}.children`,
- helpText: "Field configuration",
- label: "Field Configuration",
- controlType: "FIELD_CONFIGURATION",
- isBindProperty: false,
- isTriggerProperty: false,
- panelConfig,
- dependencies: ["schema", "childStylesheet"],
- },
- {
- propertyName: "disabledWhenInvalid",
- helpText:
- "Disables the submit button when the parent form has a required widget that is not filled",
- label: "Disabled Invalid Forms",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "fixedFooter",
- helpText: "Makes the footer always stick to the bottom of the form",
- label: "Fixed Footer",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "scrollContents",
- helpText: "Allows scrolling of the form",
- label: "Scroll Contents",
- controlType: "SWITCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "showReset",
- helpText: "Show/Hide reset form button",
- label: "Show Reset",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "submitButtonLabel",
- helpText: "Changes the label of the submit button",
- label: "Submit Button Label",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "resetButtonLabel",
- helpText: "Changes the label of the reset button",
- label: "Reset Button Label",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Actions",
- children: [
- {
- propertyName: "onSubmit",
- helpText: "Triggers an action when the submit button is clicked",
- label: "onSubmit",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Form Styles",
- isDefaultOpen: false,
- children: [
- {
- propertyName: "backgroundColor",
- helpText: "Use a html color name, HEX, RGB or RGBA value",
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- label: "Background Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderColor",
- helpText: "Use a html color name, HEX, RGB or RGBA value",
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- label: "Border Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderWidth",
- helpText: "Enter value for border width",
- label: "Border Width",
- placeholderText: "Enter value in px",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- },
- {
- propertyName: "borderRadius",
- helpText: "Enter value for border radius",
- label: "Border Radius",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Submit Button Styles",
- isDefaultOpen: false,
- children: generateButtonStyleControlsFor("submitButtonStyles"),
- },
- {
- sectionName: "Reset Button Styles",
- isDefaultOpen: false,
- children: generateButtonStyleControlsFor("resetButtonStyles"),
- dependencies: ["showReset"],
- hidden: (props: JSONFormWidgetProps) => !props.showReset,
- },
-];
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/generatePanelPropertyConfig.test.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/generatePanelPropertyConfig.test.ts
index 5bab06fcf593..bc3c6b1adc98 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/generatePanelPropertyConfig.test.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/generatePanelPropertyConfig.test.ts
@@ -16,8 +16,8 @@ describe(".generatePanelPropertyConfig", () => {
expect(currentPropertyConfig?.titlePropertyName).toEqual("label");
expect(currentPropertyConfig?.panelIdPropertyName).toEqual("identifier");
- const fieldConfigurationProperty = (currentPropertyConfig?.children[0]
- .children as PropertyPaneControlConfig[]).find(
+ const fieldConfigurationProperty = (currentPropertyConfig
+ ?.contentChildren?.[0].children as PropertyPaneControlConfig[]).find(
({ propertyName }) => propertyName === "children",
);
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/generatePanelPropertyConfig.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/generatePanelPropertyConfig.ts
index 19899478111c..db32280e0703 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/generatePanelPropertyConfig.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/generatePanelPropertyConfig.ts
@@ -1,11 +1,7 @@
import { get, isEmpty } from "lodash";
import { PanelConfig } from "constants/PropertyControlConstants";
-import {
- ARRAY_ITEM_KEY,
- FieldType,
- SchemaItem,
-} from "widgets/JSONFormWidget/constants";
+import { FieldType, SchemaItem } from "widgets/JSONFormWidget/constants";
import {
getSchemaItem,
HiddenFnParams,
@@ -34,94 +30,6 @@ function generatePanelPropertyConfig(
editableTitle: true,
titlePropertyName: "label",
panelIdPropertyName: "identifier",
- children: [
- {
- sectionName: "General",
- children: [
- ...COMMON_PROPERTIES.fieldType,
- ...COMMON_PROPERTIES.customField,
- ...COMMON_PROPERTIES.options,
- ...ARRAY_PROPERTIES.general,
- ...CHECKBOX_PROPERTIES.general,
- ...DATE_PROPERTIES.general,
- ...INPUT_PROPERTIES.general,
- ...MULTI_SELECT_PROPERTIES.general,
- ...RADIO_GROUP_PROPERTIES.general,
- ...SELECT_PROPERTIES.general,
- ...SWITCH_PROPERTIES.general,
- ...COMMON_PROPERTIES.accessibility,
- ...ARRAY_PROPERTIES.accessibility,
- {
- propertyName: "children",
- label: "Field Configuration",
- controlType: "FIELD_CONFIGURATION",
- isBindProperty: false,
- isTriggerProperty: false,
- panelConfig: generatePanelPropertyConfig(nestingLevel - 1),
- hidden: (...args: HiddenFnParams) => {
- return getSchemaItem(...args).compute((schemaItem) => {
- return (
- schemaItem.fieldType !== FieldType.OBJECT &&
- isEmpty(schemaItem.children)
- );
- });
- },
- dependencies: ["schema", "childStylesheet"],
- },
- ],
- },
- {
- sectionName: "Label Styles",
- children: [...COMMON_PROPERTIES.labelStyles],
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const schemaItem: SchemaItem = get(props, propertyPath, {});
-
- return (
- schemaItem.identifier === ARRAY_ITEM_KEY &&
- schemaItem.fieldType === FieldType.OBJECT
- );
- },
- },
- {
- sectionName: "Styles",
- children: [...COMMON_PROPERTIES.styles],
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const schemaItem: SchemaItem = get(props, propertyPath, {});
-
- // Array and Object handle their own style sections
- return (
- schemaItem.fieldType === FieldType.OBJECT ||
- schemaItem.fieldType === FieldType.ARRAY
- );
- },
- },
- ...OBJECT_PROPERTIES.sections,
- ...ARRAY_PROPERTIES.sections,
- {
- sectionName: "Actions",
- children: [
- ...INPUT_PROPERTIES.actions,
- ...CHECKBOX_PROPERTIES.actions,
- ...DATE_PROPERTIES.actions,
- ...RADIO_GROUP_PROPERTIES.actions,
- ...SELECT_PROPERTIES.actions,
- ...SWITCH_PROPERTIES.actions,
- ...MULTI_SELECT_PROPERTIES.actions,
- ...COMMON_PROPERTIES.actions,
- ],
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const schemaItem: SchemaItem = get(props, propertyPath, {});
-
- return (
- schemaItem.fieldType === FieldType.OBJECT ||
- schemaItem.fieldType === FieldType.ARRAY ||
- schemaItem.identifier === ARRAY_ITEM_KEY
- );
- },
- },
- ],
- // Add contentChildren & styleChildren here
- // And make use of them in PanelPropertiesEditor
contentChildren: [
{
sectionName: "Data",
@@ -200,7 +108,7 @@ function generatePanelPropertyConfig(
{
sectionName: "Events",
children: [
- ...CHECKBOX_PROPERTIES.actions,
+ ...CHECKBOX_PROPERTIES.content.events,
...DATE_PROPERTIES.content.events,
...MULTI_SELECT_PROPERTIES.content.events,
...INPUT_PROPERTIES.content.events,
@@ -248,8 +156,8 @@ function generatePanelPropertyConfig(
);
},
},
- ...OBJECT_PROPERTIES.sections.map((x) => ({ ...x, isDefaultOpen: true })),
- ...ARRAY_PROPERTIES.sections.map((x) => ({ ...x, isDefaultOpen: true })),
+ ...OBJECT_PROPERTIES.style.root,
+ ...ARRAY_PROPERTIES.style.root,
],
} as PanelConfig;
}
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/array.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/array.ts
index 0208702e23a5..5140226923fc 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/array.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/array.ts
@@ -6,210 +6,176 @@ import { JSONFormWidgetProps } from "../..";
import { HiddenFnParams, getSchemaItem, getStylesheetValue } from "../helper";
const PROPERTIES = {
- general: [
- {
- helpText:
- "Sets the default value of the field. The array is updated when the default value changes",
- propertyName: "defaultValue",
- label: "Default Value",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "[]",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.ARRAY),
- dependencies: ["schema"],
- },
- ],
- accessibility: [
- {
- propertyName: "isCollapsible",
- label: "Collapsible",
- helpText: "Makes the array items collapsible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.ARRAY),
- dependencies: ["schema"],
- },
- ],
-
- sections: [
- {
- sectionName: "Array Styles",
- isDefaultOpen: false,
- children: [
- {
- propertyName: "backgroundColor",
- label: "Background Color",
- controlType: "COLOR_PICKER",
- helpText: "Changes the background color",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
+ style: {
+ root: [
+ {
+ sectionName: "Array Styles",
+ children: [
+ {
+ propertyName: "backgroundColor",
+ label: "Background Color",
+ controlType: "COLOR_PICKER",
+ helpText: "Changes the background color",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
},
+ dependencies: ["schema"],
},
- dependencies: ["schema"],
- },
- {
- propertyName: "borderWidth",
- helpText: "Enter value for border width",
- label: "Border Width",
- placeholderText: "Enter value in px",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- },
- {
- propertyName: "borderColor",
- label: "Border Color",
- helpText: "Changes the border color of Object",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
+ {
+ propertyName: "borderWidth",
+ helpText: "Enter value for border width",
+ label: "Border Width",
+ placeholderText: "Enter value in px",
+ controlType: "INPUT_TEXT",
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.NUMBER },
+ },
+ {
+ propertyName: "borderColor",
+ label: "Border Color",
+ helpText: "Changes the border color of Object",
+ controlType: "COLOR_PICKER",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
},
+ dependencies: ["schema"],
},
- dependencies: ["schema"],
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- getStylesheetValue,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["schema"],
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- getStylesheetValue,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["schema"],
- },
- ],
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const schemaItem: SchemaItem = get(props, propertyPath, {});
+ {
+ propertyName: "borderRadius",
+ label: "Border Radius",
+ helpText:
+ "Rounds the corners of the icon button's outer border edge",
+ controlType: "BORDER_RADIUS_OPTIONS",
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ getStylesheetValue,
+ validation: { type: ValidationTypes.TEXT },
+ dependencies: ["schema"],
+ },
+ {
+ propertyName: "boxShadow",
+ label: "Box Shadow",
+ helpText:
+ "Enables you to cast a drop shadow from the frame of the widget",
+ controlType: "BOX_SHADOW_OPTIONS",
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ getStylesheetValue,
+ validation: { type: ValidationTypes.TEXT },
+ dependencies: ["schema"],
+ },
+ ],
+ hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
+ const schemaItem: SchemaItem = get(props, propertyPath, {});
- // Hidden if not ARRAY
- return schemaItem.fieldType !== FieldType.ARRAY;
+ // Hidden if not ARRAY
+ return schemaItem.fieldType !== FieldType.ARRAY;
+ },
},
- },
- {
- sectionName: "Item Styles",
- isDefaultOpen: false,
- children: [
- {
- propertyName: "cellBackgroundColor",
- label: "Background Color",
- controlType: "COLOR_PICKER",
- helpText: "Changes the background color of the item",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
+ {
+ sectionName: "Item Styles",
+ children: [
+ {
+ propertyName: "cellBackgroundColor",
+ label: "Background Color",
+ controlType: "COLOR_PICKER",
+ helpText: "Changes the background color of the item",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
},
+ dependencies: ["schema"],
},
- dependencies: ["schema"],
- },
- {
- propertyName: "cellBorderWidth",
- helpText: "Enter value for border width of the item",
- label: "Border Width",
- placeholderText: "Enter value in px",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- },
- {
- propertyName: "cellBorderColor",
- label: "Border Color",
- helpText: "Changes the border color of the item",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
+ {
+ propertyName: "cellBorderWidth",
+ helpText: "Enter value for border width of the item",
+ label: "Border Width",
+ placeholderText: "Enter value in px",
+ controlType: "INPUT_TEXT",
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.NUMBER },
+ },
+ {
+ propertyName: "cellBorderColor",
+ label: "Border Color",
+ helpText: "Changes the border color of the item",
+ controlType: "COLOR_PICKER",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
},
+ dependencies: ["schema"],
},
- dependencies: ["schema"],
- },
- {
- propertyName: "cellBorderRadius",
- label: "Border Radius",
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- getStylesheetValue,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["schema"],
- },
- {
- propertyName: "cellBoxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- getStylesheetValue,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["schema"],
- },
- ],
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const schemaItem: SchemaItem = get(props, propertyPath, {});
+ {
+ propertyName: "cellBorderRadius",
+ label: "Border Radius",
+ helpText:
+ "Rounds the corners of the icon button's outer border edge",
+ controlType: "BORDER_RADIUS_OPTIONS",
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ getStylesheetValue,
+ validation: { type: ValidationTypes.TEXT },
+ dependencies: ["schema"],
+ },
+ {
+ propertyName: "cellBoxShadow",
+ label: "Box Shadow",
+ helpText:
+ "Enables you to cast a drop shadow from the frame of the widget",
+ controlType: "BOX_SHADOW_OPTIONS",
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ getStylesheetValue,
+ validation: { type: ValidationTypes.TEXT },
+ dependencies: ["schema"],
+ },
+ ],
+ hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
+ const schemaItem: SchemaItem = get(props, propertyPath, {});
- // Hidden if not ARRAY
- return schemaItem.fieldType !== FieldType.ARRAY;
+ // Hidden if not ARRAY
+ return schemaItem.fieldType !== FieldType.ARRAY;
+ },
},
- },
- ],
-
+ ],
+ },
content: {
data: [
{
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/checkbox.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/checkbox.ts
index ad96b2fa786b..e72c92178937 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/checkbox.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/checkbox.ts
@@ -7,58 +7,6 @@ import {
} from "../helper";
const PROPERTIES = {
- general: [
- {
- propertyName: "defaultValue",
- label: "Default Selected",
- helpText: "Sets the default checked state of the field",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.CHECKBOX),
- dependencies: ["schema", "sourceData"],
- },
- {
- propertyName: "alignWidget",
- helpText: "Sets the alignment of the field",
- label: "Alignment",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Left",
- value: "LEFT",
- },
- {
- label: "Right",
- value: "RIGHT",
- },
- ],
- isBindProperty: true,
- isTriggerProperty: false,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.CHECKBOX),
- dependencies: ["schema"],
- },
- ],
- actions: [
- {
- helpText: "Triggers an action when the check state is changed",
- propertyName: "onCheckChange",
- label: "onCheckChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.CHECKBOX),
- dependencies: ["schema"],
- },
- ],
content: {
data: [
{
@@ -76,6 +24,21 @@ const PROPERTIES = {
dependencies: ["schema", "sourceData"],
},
],
+ events: [
+ {
+ helpText: "Triggers an action when the check state is changed",
+ propertyName: "onCheckChange",
+ label: "onCheckChange",
+ controlType: "ACTION_SELECTOR",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: true,
+ additionalAutoComplete: getAutocompleteProperties,
+ hidden: (...args: HiddenFnParams) =>
+ getSchemaItem(...args).fieldTypeNotMatches(FieldType.CHECKBOX),
+ dependencies: ["schema"],
+ },
+ ],
label: [
{
propertyName: "alignWidget",
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/common.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/common.ts
index ff384b7cbfb0..16711509f01e 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/common.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/common.ts
@@ -116,336 +116,6 @@ function accessorValidation(
}
const COMMON_PROPERTIES = {
- fieldType: [
- {
- propertyName: "fieldType",
- label: "Field Type",
- controlType: "DROP_DOWN",
- isBindProperty: false,
- isTriggerProperty: false,
- options: Object.values(FieldType).map((option) => ({
- label: option,
- value: option,
- })),
- dependencies: ["schema", "childStylesheet", "dynamicBindingPathList"],
- updateHook: fieldTypeUpdateHook,
- },
- ],
- options: [
- {
- propertyName: "options",
- helpText:
- "Allows users to select from the given option(s). Values must be unique",
- label: "Options",
- controlType: "INPUT_TEXT",
- placeholderText: '[{ "label": "Option1", "value": "Option2" }]',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- unique: ["value"],
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- required: true,
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- required: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- required: true,
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType: EvaluationSubstitutionType.SMART_SUBSTITUTE,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(FIELD_EXPECTING_OPTIONS),
- dependencies: ["schema", "sourceData"],
- },
- ],
- customField: [
- {
- propertyName: "accessor",
- helpText:
- "Sets the property name of the field which can be used to access the value in formData and fieldState.",
- label: "Property Name",
- controlType: "INPUT_TEXT",
- placeholderText: "name",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: accessorValidation,
- expected: {
- type: "unique string",
- example: `firstName | last_name | age14`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const parentPath = getParentPropertyPath(propertyPath);
- const schemaItem: SchemaItem = get(props, parentPath, {});
- const isArrayItem = schemaItem.identifier === ARRAY_ITEM_KEY;
-
- if (isArrayItem) return true;
- },
- dependencies: ["schema"],
- },
- ],
- accessibility: [
- {
- propertyName: "label",
- helpText: "Sets the label text of the field",
- label: "Label",
- controlType: "INPUT_TEXT",
- placeholderText: "Name:",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: hiddenIfArrayItemIsObject,
- dependencies: ["schema", "sourceData"],
- },
- {
- label: "Required",
- propertyName: "isRequired",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) => {
- return getSchemaItem(...args).compute(
- (schemaItem) =>
- schemaItem.fieldType === FieldType.OBJECT ||
- schemaItem.fieldType === FieldType.ARRAY,
- );
- },
- dependencies: ["schema", "sourceData"],
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the field",
- label: "Visible",
- controlType: "SWITCH",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) => {
- return getSchemaItem(...args).compute(
- (schemaItem) => schemaItem.identifier === ARRAY_ITEM_KEY,
- );
- },
- dependencies: ["schema", "sourceData"],
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables the field",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- dependencies: ["schema", "sourceData"],
- updateHook: updateChildrenDisabledStateHook,
- },
- {
- propertyName: "tooltip",
- helpText: "Show help text or details about current field",
- label: "Tooltip",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "Passwords must be at-least 6 chars",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: hiddenIfArrayItemIsObject,
- dependencies: ["schema", "sourceData"],
- },
- ],
- labelStyles: [
- {
- propertyName: "labelTextColor",
- label: "Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- dependencies: ["schema", "sourceData"],
- },
- {
- propertyName: "labelTextSize",
- label: "Text Size",
- defaultValue: "0.875rem",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["schema", "sourceData"],
- },
- ],
- actions: [
- {
- propertyName: "onFocus",
- helpText: "Triggers an action when focused.",
- label: "onFocus",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- dependencies: ["schema", "sourceData"],
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(
- FIELD_SUPPORTING_FOCUS_EVENTS,
- ),
- },
- {
- propertyName: "onBlur",
- helpText: "Triggers an action when the field loses focus.",
- label: "onBlur",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- dependencies: ["schema", "sourceData"],
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(
- FIELD_SUPPORTING_FOCUS_EVENTS,
- ),
- },
- ],
- styles: [
- {
- propertyName: "accentColor",
- helpText: "Sets the accent color",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- getStylesheetValue,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(FIELDS_WITH_ACCENT_COLOR),
- dependencies: ["schema"],
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- getStylesheetValue,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeIncludes(FIELDS_WITHOUT_BORDER_RADIUS),
- dependencies: ["schema"],
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- getStylesheetValue,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeIncludes(FIELDS_WITHOUT_BOX_SHADOW),
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["schema"],
- },
- ],
-
content: {
data: [
{
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/date.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/date.ts
index 5719ed819aa9..fcab64994184 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/date.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/date.ts
@@ -93,167 +93,6 @@ export const dateFormatOptions = [
];
const PROPERTIES = {
- general: [
- {
- propertyName: "defaultValue",
- label: "Default Date",
- helpText:
- "Sets the default date of the widget. The date is updated if the default date changes",
- controlType: "DATE_PICKER",
- placeholderText: "Enter Default Date",
- useValidationMessage: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.DATE_ISO_STRING },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- {
- helpText: "Sets the format of the selected date",
- propertyName: "dateFormat",
- label: "Date Format",
- controlType: "DROP_DOWN",
- isJSConvertible: true,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- optionWidth: "340px",
- options: dateFormatOptions,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hideSubText: true,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- {
- propertyName: "timePrecision",
- label: "Time precision",
- controlType: "DROP_DOWN",
- helpText: "Sets the different time picker or hide.",
- defaultValue: TimePrecision.MINUTE,
- options: [
- {
- label: "None",
- value: TimePrecision.NONE,
- },
- {
- label: "Minute",
- value: TimePrecision.MINUTE,
- },
- {
- label: "Second",
- value: TimePrecision.SECOND,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- TimePrecision.NONE,
- TimePrecision.MINUTE,
- TimePrecision.SECOND,
- ],
- default: TimePrecision.MINUTE,
- },
- },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- {
- propertyName: "closeOnSelection",
- label: "Close On Selection",
- helpText: "Calender should close when a date is selected",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- {
- propertyName: "shortcuts",
- label: "Show Shortcuts",
- helpText: "Choose to show shortcut menu",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- {
- propertyName: "convertToISO",
- label: "Convert to ISO format",
- helpText:
- "Enabling this always converts the value in ISO form in the formData irrespective of the 'Date Format' selected",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- {
- propertyName: "minDate",
- label: "Min Date",
- helpText: "Defines the min date for the field",
- controlType: "DATE_PICKER",
- useValidationMessage: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.DATE_ISO_STRING },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- {
- propertyName: "maxDate",
- label: "Max Date",
- helpText: "Defines the max date for the field",
- controlType: "DATE_PICKER",
- useValidationMessage: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.DATE_ISO_STRING },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- ],
- actions: [
- {
- propertyName: "onDateSelected",
- label: "onDateSelected",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.DATEPICKER),
- dependencies: ["schema"],
- },
- ],
content: {
data: [
{
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/input.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/input.ts
index e9adb3448e10..869866fba8e0 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/input.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/input.ts
@@ -178,321 +178,6 @@ export function maxValueValidation(
}
const PROPERTIES = {
- general: [
- {
- helpText:
- "Sets the default text of the field. The text is updated if the default text changes",
- propertyName: "defaultValue",
- label: "Default Value",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "John Doe",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultValueValidation,
- expected: {
- type: "string or number",
- example: `John | 123`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(INPUT_TYPES),
- dependencies: ["schema"],
- },
- {
- propertyName: "allowCurrencyChange",
- label: "Allow currency change",
- helpText: "Search by currency or country",
- controlType: "SWITCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.CURRENCY_INPUT),
- dependencies: ["schema"],
- },
- {
- helpText: "Changes the type of currency",
- propertyName: "currencyCountryCode",
- label: "Currency",
- enableSearch: true,
- dropdownHeight: "195px",
- controlType: "DROP_DOWN",
- searchPlaceholderText: "Search by code or name",
- options: CurrencyDropdownOptions,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.CURRENCY_INPUT),
- dependencies: ["schema"],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- helpText: "No. of decimals in currency input",
- propertyName: "decimalsInCurrency",
- label: "Decimals",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "0",
- value: 0,
- },
- {
- label: "1",
- value: 1,
- },
- {
- label: "2",
- value: 2,
- },
- ],
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.CURRENCY_INPUT),
- dependencies: ["schema"],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "allowDialCodeChange",
- label: "Allow country code change",
- helpText: "Search by country",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(
- FieldType.PHONE_NUMBER_INPUT,
- ),
- dependencies: ["schema"],
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Changes the country code",
- propertyName: "dialCode",
- label: "Default Country Code",
- enableSearch: true,
- dropdownHeight: "195px",
- controlType: "DROP_DOWN",
- searchPlaceholderText: "Search by code or country name",
- options: ISDCodeDropdownOptions,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(
- FieldType.PHONE_NUMBER_INPUT,
- ),
- dependencies: ["schema"],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- helpText: "Sets maximum allowed text length",
- propertyName: "maxChars",
- label: "Max Chars",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "255",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.TEXT_INPUT),
- dependencies: ["schema"],
- },
- {
- helpText: "Sets the minimum allowed value",
- propertyName: "minNum",
- label: "Min",
- controlType: "INPUT_TEXT",
- placeholderText: "1",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: minValueValidation,
- expected: {
- type: "number",
- example: `1`,
- autocompleteDataType: AutocompleteDataType.NUMBER,
- },
- },
- },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.NUMBER_INPUT),
- dependencies: ["schema"],
- },
- {
- helpText: "Sets the maximum allowed value",
- propertyName: "maxNum",
- label: "Max",
- controlType: "INPUT_TEXT",
- placeholderText: "100",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: maxValueValidation,
- expected: {
- type: "number",
- example: `100`,
- autocompleteDataType: AutocompleteDataType.NUMBER,
- },
- },
- },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.NUMBER_INPUT),
- dependencies: ["schema"],
- },
- {
- helpText:
- "Adds a validation to the input which displays an error on failure",
- propertyName: "regex",
- label: "Regex",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "^\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}$",
- inputType: "TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.REGEX },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(INPUT_TYPES),
- dependencies: ["schema"],
- },
- {
- helpText: "Sets the input validity based on a JS expression",
- propertyName: "validation",
- label: "Valid",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "{{ Input1.text.length > 0 }}",
- inputType: "TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN, params: { default: true } },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(INPUT_TYPES),
- dependencies: ["schema"],
- },
- {
- helpText:
- "The error message to display if the regex or valid property check fails",
- propertyName: "errorMessage",
- label: "Error Message",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "Not a valid email!",
- inputType: "TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(INPUT_TYPES),
- dependencies: ["schema"],
- },
- {
- helpText: "Sets a placeholder text for the input",
- propertyName: "placeholderText",
- label: "Placeholder",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "Placeholder",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(INPUT_TYPES),
- dependencies: ["schema"],
- },
- {
- propertyName: "isSpellCheck",
- label: "Spellcheck",
- helpText:
- "Defines whether the text input may be checked for spelling errors",
- controlType: "SWITCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.TEXT_INPUT),
- dependencies: ["schema"],
- },
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used in input field",
- controlType: "ICON_SELECT",
- isBindProperty: true,
- isTriggerProperty: false,
- isJSConvertible: true,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
- },
- },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes([
- FieldType.TEXT_INPUT,
- FieldType.EMAIL_INPUT,
- FieldType.PASSWORD_INPUT,
- FieldType.NUMBER_INPUT,
- ]),
- dependencies: ["schema"],
- },
- {
- propertyName: "iconAlign",
- label: "Icon alignment",
- helpText: "Sets the icon alignment of input field",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem<InputFieldProps["schemaItem"]>(...args).compute(
- (schemaItem) => !schemaItem.iconName,
- ),
- dependencies: ["schema"],
- },
- ],
- actions: [
- {
- propertyName: "onTextChanged",
- helpText: "Triggers an action when the text is changed",
- label: "onTextChanged",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(INPUT_TYPES),
- dependencies: ["schema"],
- },
- {
- propertyName: "onEnterKeyPress",
- helpText: "Triggers an action on submit (when the enter key is pressed)",
- label: "onEnterKeyPress",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotIncludes(INPUT_TYPES),
- dependencies: ["schema"],
- },
- ],
-
content: {
data: [
{
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/object.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/object.ts
index 0f1ccee37329..e64fddc360af 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/object.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/object.ts
@@ -83,122 +83,123 @@ const objectStyleProperties = [
];
const PROPERTIES = {
- sections: [
- {
- sectionName: "Object Styles",
- isDefaultOpen: false,
- children: objectStyleProperties,
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const schemaItem: SchemaItem = get(props, propertyPath, {});
+ style: {
+ root: [
+ {
+ sectionName: "Object Styles",
+ children: objectStyleProperties,
+ hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
+ const schemaItem: SchemaItem = get(props, propertyPath, {});
- if (schemaItem.fieldType !== FieldType.OBJECT) return true;
+ if (schemaItem.fieldType !== FieldType.OBJECT) return true;
- // Hide if array item is object
- return schemaItem.identifier === ARRAY_ITEM_KEY;
+ // Hide if array item is object
+ return schemaItem.identifier === ARRAY_ITEM_KEY;
+ },
},
- },
- {
- sectionName: "Item Styles",
- isDefaultOpen: false,
- children: [
- {
- propertyName: "cellBackgroundColor",
- label: "Background Color",
- controlType: "COLOR_PICKER",
- helpText: "Changes the background color of the item",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
+ {
+ sectionName: "Item Styles",
+ children: [
+ {
+ propertyName: "cellBackgroundColor",
+ label: "Background Color",
+ controlType: "COLOR_PICKER",
+ helpText: "Changes the background color of the item",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
},
+ dependencies: ["schema"],
},
- dependencies: ["schema"],
- },
- {
- propertyName: "cellBorderColor",
- label: "Border Color",
- helpText: "Changes the border color of the item",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
+ {
+ propertyName: "cellBorderColor",
+ label: "Border Color",
+ helpText: "Changes the border color of the item",
+ controlType: "COLOR_PICKER",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
},
+ dependencies: ["schema"],
},
- dependencies: ["schema"],
- },
- {
- propertyName: "cellBorderWidth",
- helpText: "Enter value for border width of the item",
- label: "Border Width",
- placeholderText: "Enter value in px",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- },
- {
- propertyName: "cellBorderRadius",
- label: "Border Radius",
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- getStylesheetValue,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["schema"],
- },
- {
- propertyName: "cellBoxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- getStylesheetValue,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["schema"],
- },
- ],
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const schemaItem: SchemaItem = get(props, propertyPath, {});
+ {
+ propertyName: "cellBorderWidth",
+ helpText: "Enter value for border width of the item",
+ label: "Border Width",
+ placeholderText: "Enter value in px",
+ controlType: "INPUT_TEXT",
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: { type: ValidationTypes.NUMBER },
+ },
+ {
+ propertyName: "cellBorderRadius",
+ label: "Border Radius",
+ helpText:
+ "Rounds the corners of the icon button's outer border edge",
+ controlType: "BORDER_RADIUS_OPTIONS",
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ getStylesheetValue,
+ validation: { type: ValidationTypes.TEXT },
+ dependencies: ["schema"],
+ },
+ {
+ propertyName: "cellBoxShadow",
+ label: "Box Shadow",
+ helpText:
+ "Enables you to cast a drop shadow from the frame of the widget",
+ controlType: "BOX_SHADOW_OPTIONS",
+ customJSControl: "JSON_FORM_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ getStylesheetValue,
+ validation: { type: ValidationTypes.TEXT },
+ dependencies: ["schema"],
+ },
+ ],
+ hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
+ const schemaItem: SchemaItem = get(props, propertyPath, {});
- if (schemaItem.fieldType !== FieldType.OBJECT) return true;
+ if (schemaItem.fieldType !== FieldType.OBJECT) return true;
- // Hide if array item is object
- return schemaItem.identifier === ARRAY_ITEM_KEY;
+ // Hide if array item is object
+ return schemaItem.identifier === ARRAY_ITEM_KEY;
+ },
},
- },
- {
- /**
- * This is for an edge case where an array item is an object
- * Here we only want to change the cell** styles
- */
- sectionName: "Styles",
- children: objectStyleProperties,
- hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
- const schemaItem: SchemaItem = get(props, propertyPath, {});
+ {
+ /**
+ * This is for an edge case where an array item is an object
+ * Here we only want to change the cell** styles
+ */
+ sectionName: "Styles",
+ children: objectStyleProperties,
+ hidden: (props: JSONFormWidgetProps, propertyPath: string) => {
+ const schemaItem: SchemaItem = get(props, propertyPath, {});
- if (schemaItem.fieldType !== FieldType.OBJECT) return true;
+ if (schemaItem.fieldType !== FieldType.OBJECT) return true;
- // Hide if array item is not object
- return schemaItem.identifier !== ARRAY_ITEM_KEY;
+ // Hide if array item is not object
+ return schemaItem.identifier !== ARRAY_ITEM_KEY;
+ },
},
- },
- ],
+ ],
+ },
};
export default PROPERTIES;
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/radioGroup.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/radioGroup.ts
index 4ca250844e9b..128e0181dccb 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/radioGroup.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/radioGroup.ts
@@ -49,71 +49,6 @@ function defaultOptionValidation(
}
const PROPERTIES = {
- general: [
- {
- propertyName: "options",
- helpText:
- "Allows users to select from the given option(s). Values must be unique",
- label: "Options",
- controlType: "INPUT_TEXT",
- placeholderText: '[{ "label": "Option1", "value": "Option2" }]',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: optionsValidation,
- expected: {
- type: 'Array<{ "label": "string", "value": "string" | number}>',
- example: `[{"label": "One", "value": "one"}]`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- evaluationSubstitutionType: EvaluationSubstitutionType.SMART_SUBSTITUTE,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.RADIO_GROUP),
- dependencies: ["schema"],
- },
- {
- propertyName: "defaultValue",
- helpText: "Sets a default selected option",
- label: "Default Selected Value",
- placeholderText: "Y",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultOptionValidation,
- expected: {
- type: `string |\nnumber (only works in mustache syntax)`,
- example: `abc | {{1}}`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.RADIO_GROUP),
- dependencies: ["schema", "sourceData"],
- },
- ],
- actions: [
- {
- propertyName: "onSelectionChange",
- helpText: "Triggers an action when a user changes the selected option",
- label: "onSelectionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.RADIO_GROUP),
- dependencies: ["schema", "sourceData"],
- },
- ],
content: {
data: [
{
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/select.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/select.ts
index ce0f1f435a42..7988ac94cc0d 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/select.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/select.ts
@@ -76,105 +76,6 @@ export function defaultOptionValueValidation(
}
const PROPERTIES = {
- general: [
- {
- propertyName: "defaultValue",
- helpText: "Selects the option with value by default",
- label: "Default Value",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: '{ "label": "Option1", "value": "Option2" }',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultOptionValueValidation,
- expected: {
- type: 'value1 or { "label": "label1", "value": "value1" }',
- example: `value1 | { "label": "label1", "value": "value1" }`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- evaluationSubstitutionType: EvaluationSubstitutionType.SMART_SUBSTITUTE,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.SELECT),
- dependencies: ["schema"],
- },
- {
- propertyName: "placeholderText",
- label: "Placeholder",
- controlType: "JSON_FORM_COMPUTE_VALUE",
- placeholderText: "Enter placeholder text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.SELECT),
- dependencies: ["schema"],
- },
- {
- propertyName: "isFilterable",
- label: "Filterable",
- helpText: "Makes the dropdown list filterable",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.SELECT),
- dependencies: ["schema", "sourceData"],
- },
- {
- propertyName: "serverSideFiltering",
- helpText: "Enables server side filtering of the data",
- label: "Server Side Filtering",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.SELECT),
- dependencies: ["schema", "sourceData"],
- },
- ],
- actions: [
- {
- propertyName: "onOptionChange",
- helpText: "Triggers an action when a user selects an option",
- label: "onOptionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.SELECT),
- dependencies: ["schema", "sourceData"],
- },
- {
- propertyName: "onFilterUpdate",
- helpText: "Trigger an action on change of filterText",
- label: "onFilterUpdate",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- dependencies: ["schema", "sourceData"],
- additionalAutoComplete: getAutocompleteProperties,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem<SelectFieldProps["schemaItem"]>(...args).compute(
- (schemaItem) => {
- if (schemaItem.fieldType !== FieldType.SELECT) return true;
- return !schemaItem.serverSideFiltering;
- },
- ),
- },
- ],
content: {
data: [
{
diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/switch.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/switch.ts
index c6c3a6430edc..863db4b520eb 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/switch.ts
+++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/switch.ts
@@ -7,58 +7,6 @@ import {
} from "../helper";
const PROPERTIES = {
- general: [
- {
- propertyName: "defaultValue",
- label: "Default Selected",
- helpText: "Sets the On/Off default state of the field",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- customJSControl: "JSON_FORM_COMPUTE_VALUE",
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.SWITCH),
- dependencies: ["schema", "sourceData"],
- },
- {
- propertyName: "alignWidget",
- helpText: "Sets the alignment of the field",
- label: "Alignment",
- controlType: "DROP_DOWN",
- isBindProperty: true,
- isTriggerProperty: false,
- options: [
- {
- label: "Left",
- value: "LEFT",
- },
- {
- label: "Right",
- value: "RIGHT",
- },
- ],
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.SWITCH),
- dependencies: ["schema"],
- },
- ],
- actions: [
- {
- helpText: "Triggers an action when the switch state is changed",
- propertyName: "onChange",
- label: "onChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: getAutocompleteProperties,
- hidden: (...args: HiddenFnParams) =>
- getSchemaItem(...args).fieldTypeNotMatches(FieldType.SWITCH),
- dependencies: ["schema", "sourceData"],
- },
- ],
content: {
data: [
{
diff --git a/app/client/src/widgets/ListWidget/widget/index.tsx b/app/client/src/widgets/ListWidget/widget/index.tsx
index a88f446b2845..8b661c7bfacd 100644
--- a/app/client/src/widgets/ListWidget/widget/index.tsx
+++ b/app/client/src/widgets/ListWidget/widget/index.tsx
@@ -26,7 +26,7 @@ import ListComponent, {
ListComponentEmpty,
ListComponentLoading,
} from "../component";
-import propertyPaneConfig, {
+import {
PropertyPaneContentConfig,
PropertyPaneStyleConfig,
} from "./propertyConfig";
@@ -57,13 +57,6 @@ class ListWidget extends BaseWidget<ListWidgetProps<WidgetProps>, WidgetState> {
page: 1,
};
- /**
- * returns the property pane config of the widget
- */
- static getPropertyPaneConfig() {
- return propertyPaneConfig;
- }
-
static getPropertyPaneContentConfig() {
return PropertyPaneContentConfig;
}
diff --git a/app/client/src/widgets/ListWidget/widget/propertyConfig.ts b/app/client/src/widgets/ListWidget/widget/propertyConfig.ts
index 706df2438199..5aa7d3f3a29e 100644
--- a/app/client/src/widgets/ListWidget/widget/propertyConfig.ts
+++ b/app/client/src/widgets/ListWidget/widget/propertyConfig.ts
@@ -7,189 +7,6 @@ import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
import { EVAL_VALUE_PATH } from "utils/DynamicBindingUtils";
import { AutocompleteDataType } from "utils/autocomplete/TernServer";
-const PropertyPaneConfig = [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Takes in an array of objects to display items in the list.",
- propertyName: "listData",
- label: "Items",
- controlType: "INPUT_TEXT",
- placeholderText: '[{ "name": "John" }]',
- inputType: "ARRAY",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.ARRAY },
- evaluationSubstitutionType: EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText:
- "Bind the List.pageNo property in your API and call it onPageChange",
- propertyName: "serverSidePaginationEnabled",
- label: "Server Side Pagination",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when a grid list item is clicked",
- propertyName: "onListItemClick",
- label: "onListItemClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- additionalAutoComplete: (props: ListWidgetProps<WidgetProps>) => {
- let items = get(props, `${EVAL_VALUE_PATH}.listData`, []);
-
- if (Array.isArray(items)) {
- items = items.filter(Boolean);
- } else {
- items = [];
- }
-
- return {
- currentItem: Object.assign(
- {},
- ...Object.keys(get(items, "0", {})).map((key) => ({
- [key]: "",
- })),
- ),
- };
- },
- dependencies: ["listData"],
- },
- {
- helpText: "Triggers an action when a list page is changed",
- propertyName: "onPageChange",
- label: "onPageChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- hidden: (props: ListWidgetProps<WidgetProps>) =>
- !props.serverSidePaginationEnabled,
- dependencies: ["serverSidePaginationEnabled"],
- },
- {
- helpText: "Triggers an action when a list page size is changed",
- propertyName: "onPageSizeChange",
- label: "onPageSizeChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- hidden: (props: ListWidgetProps<WidgetProps>) =>
- !props.serverSidePaginationEnabled,
- dependencies: ["serverSidePaginationEnabled"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "backgroundColor",
- label: "Background Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- expected: {
- type: "Color name | hex code",
- example: "#FFFFFF",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- propertyName: "itemBackgroundColor",
- label: "Item Background Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- defaultValue: "#FFFFFF",
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- expected: {
- type: "Color name | hex code",
- example: "#FFFFFF",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- helpText: "Spacing between items in Pixels",
- placeholderText: "0",
- propertyName: "gridGap",
- label: "Item Spacing (px)",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- inputType: "INTEGER",
- validation: { type: ValidationTypes.NUMBER, params: { min: -8 } },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
-];
-
export const PropertyPaneContentConfig = [
{
sectionName: "Data",
@@ -395,5 +212,3 @@ export const PropertyPaneStyleConfig = [
],
},
];
-
-export { PropertyPaneConfig as default };
diff --git a/app/client/src/widgets/MapChartWidget/widget/index.tsx b/app/client/src/widgets/MapChartWidget/widget/index.tsx
index 01f9dfebd898..169b5eb77414 100644
--- a/app/client/src/widgets/MapChartWidget/widget/index.tsx
+++ b/app/client/src/widgets/MapChartWidget/widget/index.tsx
@@ -59,258 +59,6 @@ const updateDataSet = (
};
class MapChartWidget extends BaseWidget<MapChartWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Sets the map type",
- propertyName: "mapType",
- label: "Map Type",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "World",
- value: MapTypes.WORLD,
- },
- {
- label: "World with Antarctica",
- value: MapTypes.WORLD_WITH_ANTARCTICA,
- },
- {
- label: "Europe",
- value: MapTypes.EUROPE,
- },
- {
- label: "North America",
- value: MapTypes.NORTH_AMERICA,
- },
- {
- label: "South America",
- value: MapTypes.SOURTH_AMERICA,
- },
- {
- label: "Asia",
- value: MapTypes.ASIA,
- },
- {
- label: "Oceania",
- value: MapTypes.OCEANIA,
- },
- {
- label: "Africa",
- value: MapTypes.AFRICA,
- },
- {
- label: "USA",
- value: MapTypes.USA,
- },
- ],
- isJSconvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- updateHook: updateDataSet,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- MapTypes.WORLD,
- MapTypes.WORLD_WITH_ANTARCTICA,
- MapTypes.EUROPE,
- MapTypes.NORTH_AMERICA,
- MapTypes.SOURTH_AMERICA,
- MapTypes.ASIA,
- MapTypes.OCEANIA,
- MapTypes.AFRICA,
- MapTypes.USA,
- ],
- },
- },
- },
- {
- helpText: "Sets the map title",
- placeholderText: "Enter title",
- propertyName: "mapTitle",
- label: "Title",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Map Chart Data",
- children: [
- {
- helpText: "Populates the map with the data",
- propertyName: "data",
- label: "Data",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- unique: true,
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- required: true,
- allowedKeys: [
- {
- name: "id",
- type: ValidationTypes.TEXT,
- params: {
- unique: true,
- required: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- required: true,
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- propertyName: "showLabels",
- label: "Show Labels",
- helpText: "Sets whether entity labels will be shown or hidden",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- helpText:
- "Defines ranges for categorizing entities on a map based on their data values.",
- propertyName: "colorRange",
- label: "Color Range",
- controlType: "INPUT_TEXT",
- placeholderText: "Color range object",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- unique: true,
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "minValue",
- type: ValidationTypes.NUMBER,
- params: {
- required: true,
- },
- },
- {
- name: "maxValue",
- type: ValidationTypes.NUMBER,
- params: {
- required: true,
- },
- },
- {
- name: "displayValue",
- type: ValidationTypes.TEXT,
- },
- {
- name: "code",
- type: ValidationTypes.TEXT,
- params: {
- expected: {
- type: "Hex color (6-digit)",
- example: "#FF04D7",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- {
- name: "alpha",
- type: ValidationTypes.NUMBER,
- params: {
- min: 0,
- max: 100,
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Actions",
- children: [
- {
- helpText:
- "Triggers an action when the map chart data point is clicked",
- propertyName: "onDataPointClick",
- label: "onDataPointClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/MapWidget/widget/index.tsx b/app/client/src/widgets/MapWidget/widget/index.tsx
index 0efbba7e6e16..925566c6b295 100644
--- a/app/client/src/widgets/MapWidget/widget/index.tsx
+++ b/app/client/src/widgets/MapWidget/widget/index.tsx
@@ -45,217 +45,6 @@ type Center = {
[x: string]: any;
};
class MapWidget extends BaseWidget<MapWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "mapCenter",
- label: "Initial location",
- isJSConvertible: true,
- controlType: "LOCATION_SEARCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "lat",
- type: ValidationTypes.NUMBER,
- params: {
- min: -90,
- max: 90,
- default: 0,
- required: true,
- },
- },
- {
- name: "long",
- type: ValidationTypes.NUMBER,
- params: {
- min: -180,
- max: 180,
- default: 0,
- required: true,
- },
- },
- ],
- },
- },
- },
- {
- propertyName: "defaultMarkers",
- label: "Default markers",
- controlType: "INPUT_TEXT",
- inputType: "ARRAY",
- helpText: "Sets the default markers on the map",
- placeholderText: '[{ "lat": "val1", "long": "val2" }]',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- required: true,
- allowedKeys: [
- {
- name: "lat",
- type: ValidationTypes.NUMBER,
- params: {
- min: -90,
- max: 90,
- default: 0,
- required: true,
- },
- },
- {
- name: "long",
- type: ValidationTypes.NUMBER,
- params: {
- min: -180,
- max: 180,
- default: 0,
- required: true,
- },
- },
- {
- name: "title",
- type: ValidationTypes.TEXT,
- },
- {
- name: "color",
- type: ValidationTypes.TEXT,
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- propertyName: "isClickedMarkerCentered",
- label: "Map & Marker centering",
- helpText:
- "Controls whether the clicked marker is centered on the map",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "enableSearch",
- label: "Enable search location",
- helpText: "Allows a user to search for a location",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "enablePickLocation",
- label: "Enable pick location",
- helpText: "Allows a user to pick their location",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "enableCreateMarker",
- label: "Create new marker",
- helpText: "Allows users to mark locations on the map",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "zoomLevel",
- label: "Zoom Level",
- controlType: "STEP",
- helpText: "Changes the default zoom of the map",
- stepType: "ZOOM_PERCENTAGE",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- propertyName: "onMarkerClick",
- label: "onMarkerClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- propertyName: "onCreateMarker",
- label: "onCreateMarker",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
-
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
-
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/MenuButtonWidget/widget/index.tsx b/app/client/src/widgets/MenuButtonWidget/widget/index.tsx
index 7c9fd16f300d..09157bf89e2f 100644
--- a/app/client/src/widgets/MenuButtonWidget/widget/index.tsx
+++ b/app/client/src/widgets/MenuButtonWidget/widget/index.tsx
@@ -46,363 +46,6 @@ export interface MenuButtonWidgetProps extends WidgetProps {
}
class MenuButtonWidget extends BaseWidget<MenuButtonWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "label",
- helpText: "Sets the label of a menu",
- label: "Label",
- controlType: "INPUT_TEXT",
- placeholderText: "Open",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Menu items",
- propertyName: "menuItems",
- controlType: "MENU_ITEMS",
- label: "Menu Items",
- isBindProperty: false,
- isTriggerProperty: false,
- panelConfig: {
- editableTitle: true,
- titlePropertyName: "label",
- panelIdPropertyName: "id",
- updateHook: (
- props: any,
- propertyPath: string,
- propertyValue: string,
- ) => {
- return [
- {
- propertyPath,
- propertyValue,
- },
- ];
- },
- children: [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "label",
- helpText: "Sets the label of a menu item",
- label: "Label",
- controlType: "INPUT_TEXT",
- placeholderText: "Download",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables input to the widget",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Icon Options",
- children: [
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used for a menu item",
- controlType: "ICON_SELECT",
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
-
- {
- propertyName: "iconAlign",
- label: "Icon alignment",
- helpText: "Sets the icon alignment of a menu item",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText:
- "Triggers an action when the menu item is clicked",
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "iconColor",
- helpText: "Sets the icon color of a menu item",
- label: "Icon color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "backgroundColor",
- helpText: "Sets the background color of a menu item",
- label: "Background color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "textColor",
- helpText: "Sets the text color of a menu item",
- label: "Text color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
- },
- ],
- },
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables input to the widget",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isCompact",
- helpText: "Decides if menu items will consume lesser space",
- label: "Compact",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "menuColor",
- helpText: "Sets the style of the Menu button",
- label: "Menu Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "menuVariant",
- label: "Menu Variant",
- controlType: "DROP_DOWN",
- helpText: "Sets the variant of the menu button",
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- default: ButtonVariantTypes.PRIMARY,
- },
- },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used for the menu button",
- controlType: "ICON_SELECT",
- isBindProperty: false,
- isTriggerProperty: false,
- updateHook: (
- props: MenuButtonWidgetProps,
- propertyPath: string,
- propertyValue: string,
- ) => {
- const propertiesToUpdate = [{ propertyPath, propertyValue }];
- if (!props.iconAlign) {
- propertiesToUpdate.push({
- propertyPath: "iconAlign",
- propertyValue: Alignment.LEFT,
- });
- }
- return propertiesToUpdate;
- },
- dependencies: ["iconAlign"],
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: "placement",
- label: "Placement",
- controlType: "DROP_DOWN",
- helpText: "Sets the space between items",
- options: [
- {
- label: "Start",
- value: ButtonPlacementTypes.START,
- },
- {
- label: "Between",
- value: ButtonPlacementTypes.BETWEEN,
- },
- {
- label: "Center",
- value: ButtonPlacementTypes.CENTER,
- },
- ],
- defaultValue: ButtonPlacementTypes.CENTER,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: [
- ButtonPlacementTypes.START,
- ButtonPlacementTypes.BETWEEN,
- ButtonPlacementTypes.CENTER,
- ],
- default: ButtonPlacementTypes.CENTER,
- },
- },
- },
- {
- propertyName: "iconAlign",
- label: "Icon Alignment",
- helpText: "Sets the icon alignment of the menu button",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["center", "left", "right"],
- },
- },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
@@ -441,122 +84,6 @@ class MenuButtonWidget extends BaseWidget<MenuButtonWidgetProps, WidgetState> {
},
];
},
- // TODO(aswathkk): Delete the following
- children: [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "label",
- helpText: "Sets the label of a menu item",
- label: "Label",
- controlType: "INPUT_TEXT",
- placeholderText: "Download",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables input to the widget",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Icon Options",
- children: [
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used for a menu item",
- controlType: "ICON_SELECT",
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
-
- {
- propertyName: "iconAlign",
- label: "Icon alignment",
- helpText: "Sets the icon alignment of a menu item",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText:
- "Triggers an action when the menu item is clicked",
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "iconColor",
- helpText: "Sets the icon color of a menu item",
- label: "Icon color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "backgroundColor",
- helpText: "Sets the background color of a menu item",
- label: "Background color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "textColor",
- helpText: "Sets the text color of a menu item",
- label: "Text color",
- controlType: "COLOR_PICKER",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
- },
- ],
contentChildren: [
{
sectionName: "Basic",
diff --git a/app/client/src/widgets/ModalWidget/widget/index.tsx b/app/client/src/widgets/ModalWidget/widget/index.tsx
index cc7feb11457b..a98e81ae34bf 100644
--- a/app/client/src/widgets/ModalWidget/widget/index.tsx
+++ b/app/client/src/widgets/ModalWidget/widget/index.tsx
@@ -19,85 +19,6 @@ import { ValidationTypes } from "constants/WidgetValidation";
const minSize = 100;
export class ModalWidget extends BaseWidget<ModalWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Enables scrolling for content inside the widget",
- propertyName: "shouldScrollContents",
- label: "Scroll Contents",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "canOutsideClickClose",
- label: "Quick Dismiss",
- helpText: "Allows dismissing the modal when user taps outside",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the modal is closed",
- propertyName: "onClose",
- label: "onClose",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
-
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "backgroundColor",
- helpText: "Sets the background color of the widget",
- label: "Background color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
-
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/MultiSelectTreeWidget/widget/index.tsx b/app/client/src/widgets/MultiSelectTreeWidget/widget/index.tsx
index f225b7ea62bf..fa5cc9d365ac 100644
--- a/app/client/src/widgets/MultiSelectTreeWidget/widget/index.tsx
+++ b/app/client/src/widgets/MultiSelectTreeWidget/widget/index.tsx
@@ -46,393 +46,6 @@ class MultiSelectTreeWidget extends BaseWidget<
MultiSelectTreeWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Mode to Display options",
- propertyName: "mode",
- label: "Mode",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Display only parent items",
- value: "SHOW_PARENT",
- },
- {
- label: "Display only child items",
- value: "SHOW_CHILD",
- },
- {
- label: "Display all items",
- value: "SHOW_ALL",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- helpText:
- "Allows users to select multiple options. Values must be unique",
- propertyName: "options",
- label: "Options",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter option value",
- isBindProperty: true,
- isTriggerProperty: false,
- isJSConvertible: false,
- validation: {
- type: ValidationTypes.NESTED_OBJECT_ARRAY,
- params: {
- unique: ["value"],
- default: [],
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- required: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- },
- },
- {
- name: "children",
- type: ValidationTypes.ARRAY,
- required: false,
- params: {
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- required: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- },
- },
- ],
- },
- },
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Selects the option with value by default",
- propertyName: "defaultOptionValue",
- label: "Default Value",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter option value",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultOptionValueValidation,
- expected: {
- type: "Array of values",
- example: `['value1', 'value2']`,
- autocompleteDataType: AutocompleteDataType.ARRAY,
- },
- },
- },
- },
- {
- helpText: "Sets a Placeholder Text",
- propertyName: "placeholderText",
- label: "Placeholder",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter placeholder text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- helpText: "Disables input to this widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "allowClear",
- label: "Clear all Selections",
- helpText: "Enables Icon to clear all Selections",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "expandAll",
- label: "Expand all by default",
- helpText: "Expand All nested options",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when a user selects an option",
- propertyName: "onOptionChange",
- label: "onOptionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "labelText",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: MultiSelectTreeWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: MultiSelectTreeWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "accentColor",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- invisible: true,
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
-
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextColor",
- label: "Label Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Label Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx b/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx
index 180306fb1e05..01f03f1a7a1d 100644
--- a/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx
+++ b/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx
@@ -181,368 +181,6 @@ class MultiSelectWidget extends BaseWidget<
MultiSelectWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText:
- "Allows users to select multiple options. Values must be unique",
- propertyName: "options",
- label: "Options",
- controlType: "INPUT_TEXT",
- placeholderText: '[{ "label": "Option1", "value": "Option2" }]',
- isBindProperty: true,
- isTriggerProperty: false,
- isJSConvertible: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- unique: ["value"],
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- required: true,
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- requiredKey: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- requiredKey: true,
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Selects the option(s) with value by default",
- propertyName: "defaultOptionValue",
- label: "Default Value",
- controlType: "SELECT_DEFAULT_VALUE_CONTROL",
- placeholderText: "[GREEN]",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultOptionValueValidation,
- expected: {
- type: "Array of values",
- example: ` "option1, option2" | ['option1', 'option2'] | [{ "label": "label1", "value": "value1" }]`,
- autocompleteDataType: AutocompleteDataType.ARRAY,
- },
- },
- },
- dependencies: ["serverSideFiltering", "options"],
- },
- {
- helpText: "Sets a Placeholder Text",
- propertyName: "placeholderText",
- label: "Placeholder",
- controlType: "INPUT_TEXT",
- placeholderText: "Search",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- helpText: "Disables input to this widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isFilterable",
- label: "Filterable",
- helpText: "Makes the dropdown list filterable",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Enables server side filtering of the data",
- propertyName: "serverSideFiltering",
- label: "Server Side Filtering",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText:
- "Controls the visibility of select all option in dropdown.",
- propertyName: "allowSelectAll",
- label: "Allow Select All",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when a user selects an option",
- propertyName: "onOptionChange",
- label: "onOptionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Trigger an action on change of filterText",
- hidden: (props: MultiSelectWidgetProps) =>
- !props.serverSideFiltering,
- dependencies: ["serverSideFiltering"],
- propertyName: "onFilterUpdate",
- label: "onFilterUpdate",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "labelText",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: MultiSelectWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: MultiSelectWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Label Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Label Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "2xl",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3xl",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isBindProperty: true,
- isJSConvertible: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "accentColor",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- invisible: true,
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/NumberSliderWidget/index.ts b/app/client/src/widgets/NumberSliderWidget/index.ts
index 63d009de83fb..f3c7f27583f1 100644
--- a/app/client/src/widgets/NumberSliderWidget/index.ts
+++ b/app/client/src/widgets/NumberSliderWidget/index.ts
@@ -42,7 +42,6 @@ export const CONFIG = {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
- config: Widget.getPropertyPaneConfig(),
contentConfig: Widget.getPropertyPaneContentConfig(),
styleConfig: Widget.getPropertyPaneStyleConfig(),
},
diff --git a/app/client/src/widgets/NumberSliderWidget/widget/index.tsx b/app/client/src/widgets/NumberSliderWidget/widget/index.tsx
index 637fa598f43a..2e4cc9eb3c67 100644
--- a/app/client/src/widgets/NumberSliderWidget/widget/index.tsx
+++ b/app/client/src/widgets/NumberSliderWidget/widget/index.tsx
@@ -30,10 +30,6 @@ class NumberSliderWidget extends BaseWidget<
NumberSliderWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [...contentConfig, ...styleConfig];
- }
-
static getPropertyPaneContentConfig() {
return contentConfig;
}
diff --git a/app/client/src/widgets/PhoneInputWidget/widget/index.tsx b/app/client/src/widgets/PhoneInputWidget/widget/index.tsx
index 49cdd543b67a..3521cc468d61 100644
--- a/app/client/src/widgets/PhoneInputWidget/widget/index.tsx
+++ b/app/client/src/widgets/PhoneInputWidget/widget/index.tsx
@@ -68,76 +68,6 @@ class PhoneInputWidget extends BaseInputWidget<
PhoneInputWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return mergeWidgetConfig(
- [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "allowDialCodeChange",
- label: "Allow country code change",
- helpText: "Search by country",
- controlType: "SWITCH",
- isJSConvertible: false,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Changes the country code",
- propertyName: "defaultDialCode",
- label: "Default Country Code",
- enableSearch: true,
- dropdownHeight: "156px",
- controlType: "DROP_DOWN",
- searchPlaceholderText: "Search by code or country name",
- options: ISDCodeDropdownOptions,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- helpText:
- "Sets the default text of the widget. The text is updated if the default text changes",
- propertyName: "defaultText",
- label: "Default Text",
- controlType: "INPUT_TEXT",
- placeholderText: "(000) 000-0000",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultValueValidation,
- expected: {
- type: "string",
- example: `(000) 000-0000`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- propertyName: "allowFormatting",
- label: "Enable Formatting",
- helpText: "Formats the phone number as per the country selected",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- ],
- super.getPropertyPaneConfig(),
- );
- }
-
static getPropertyPaneContentConfig() {
return mergeWidgetConfig(
[
diff --git a/app/client/src/widgets/ProgressWidget/widget/index.tsx b/app/client/src/widgets/ProgressWidget/widget/index.tsx
index 3c0e51ff9ab2..0593dae44a45 100644
--- a/app/client/src/widgets/ProgressWidget/widget/index.tsx
+++ b/app/client/src/widgets/ProgressWidget/widget/index.tsx
@@ -9,133 +9,6 @@ import { ValidationTypes } from "constants/WidgetValidation";
import { Colors } from "constants/Colors";
class ProgressWidget extends BaseWidget<ProgressWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText:
- "Determines if progress indicator will be determinate or not",
- propertyName: "isIndeterminate",
- label: "Infinite Loading",
- controlType: "SWITCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Determines the shape of the progress indicator",
- propertyName: "progressType",
- label: "Type",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Circular",
- value: ProgressType.CIRCULAR,
- },
- {
- label: "Linear",
- value: ProgressType.LINEAR,
- },
- ],
- defaultValue: ProgressType.LINEAR,
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- helpText: "Sets the value of the progress indicator",
- propertyName: "progress",
- label: "Progress",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter progress value",
- isBindProperty: true,
- isTriggerProperty: false,
- defaultValue: 50,
- validation: {
- type: ValidationTypes.NUMBER,
- params: { min: 0, max: 100, default: 50 },
- },
- hidden: (props: ProgressWidgetProps) => props.isIndeterminate,
- dependencies: ["isIndeterminate"],
- },
- {
- helpText: "Sets the number of steps",
- propertyName: "steps",
- label: "Number of steps",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter number of steps",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.NUMBER,
- params: { min: 1, max: 100, default: 1, natural: true },
- },
- hidden: (props: ProgressWidgetProps) => props.isIndeterminate,
- dependencies: ["isIndeterminate"],
- },
- {
- propertyName: "counterClockwise",
- helpText: "Whether to rotate in counterclockwise direction",
- label: "Counterclockwise",
- controlType: "SWITCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (props: ProgressWidgetProps) =>
- props.progressType === ProgressType.LINEAR ||
- props.isIndeterminate,
- dependencies: ["isIndeterminate", "progressType"],
- },
- {
- helpText:
- "Controls the visibility with the value of progress indicator",
- propertyName: "showResult",
- label: "Show Result",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- hidden: (props: ProgressWidgetProps) => props.isIndeterminate,
- dependencies: ["isIndeterminate"],
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- helpText: "Sets the color of the progress indicator",
- propertyName: "fillColor",
- label: "Fill Color",
- controlType: "COLOR_PICKER",
- defaultColor: Colors.GREEN,
- isBindProperty: true,
- isJSConvertible: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/RadioGroupWidget/widget/index.tsx b/app/client/src/widgets/RadioGroupWidget/widget/index.tsx
index 39d6d362fbe7..dffef7b6d94f 100644
--- a/app/client/src/widgets/RadioGroupWidget/widget/index.tsx
+++ b/app/client/src/widgets/RadioGroupWidget/widget/index.tsx
@@ -146,305 +146,6 @@ function defaultOptionValidation(
}
class RadioGroupWidget extends BaseWidget<RadioGroupWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText: "Displays a list of unique options",
- propertyName: "options",
- label: "Options",
- controlType: "OPTION_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: optionsCustomValidation,
- expected: {
- type:
- 'Array<{ "label": "string", "value": "string" | number}>',
- example: `[{"label": "One", "value": "one"}]`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Sets a default selected option",
- propertyName: "defaultOptionValue",
- label: "Default Selected Value",
- placeholderText: "Y",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- /**
- * Changing the validation to FUNCTION.
- * If the user enters Integer inside {{}} e.g. {{1}} then value should evalute to integer.
- * If user enters 1 e.g. then it should evaluate as string.
- */
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultOptionValidation,
- expected: {
- type: `string |\nnumber (only works in mustache syntax)`,
- example: `abc | {{1}}`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- propertyName: "isInline",
- helpText:
- "Whether the radio buttons are to be displayed inline horizontally",
- label: "Inline",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- helpText: "Disables input to this widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "alignment",
- helpText: "Sets the alignment of the widget",
- label: "Alignment",
- controlType: "DROP_DOWN",
- isBindProperty: true,
- isTriggerProperty: false,
- options: [
- {
- label: "Left",
- value: Alignment.LEFT,
- },
- {
- label: "Right",
- value: Alignment.RIGHT,
- },
- ],
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "label",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: RadioGroupWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: RadioGroupWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Label Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Label Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "accentColor",
- helpText: "Sets the accent color of the widget",
- label: "Accent color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText:
- "Triggers an action when a user changes the selected option",
- propertyName: "onSelectionChange",
- label: "onSelectionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/RadioGroupWidget/widget/propertyPaneConfig.test.ts b/app/client/src/widgets/RadioGroupWidget/widget/propertyPaneConfig.test.ts
index 3fa196f96da2..bd42cd783024 100644
--- a/app/client/src/widgets/RadioGroupWidget/widget/propertyPaneConfig.test.ts
+++ b/app/client/src/widgets/RadioGroupWidget/widget/propertyPaneConfig.test.ts
@@ -3,11 +3,11 @@ import RadioGroupWidget from "./index";
describe("unit test case for property config pane", () => {
it("case: check the value returned by defaultOptionValue", () => {
- const generalSection: any = RadioGroupWidget.getPropertyPaneConfig().filter(
- (section: any) => section.sectionName === "General",
+ const dataSection: any = RadioGroupWidget.getPropertyPaneContentConfig().filter(
+ (section: any) => section.sectionName === "Data",
);
- const dsv = generalSection[0].children.filter(
+ const dsv = dataSection[0].children.filter(
(child: any) => child.propertyName === "defaultOptionValue",
)[0];
diff --git a/app/client/src/widgets/RangeSliderWidget/index.ts b/app/client/src/widgets/RangeSliderWidget/index.ts
index 9bb9810f3f7d..a8d0b2e22bd7 100644
--- a/app/client/src/widgets/RangeSliderWidget/index.ts
+++ b/app/client/src/widgets/RangeSliderWidget/index.ts
@@ -43,7 +43,6 @@ export const CONFIG = {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
- config: Widget.getPropertyPaneConfig(),
contentConfig: Widget.getPropertyPaneContentConfig(),
styleConfig: Widget.getPropertyPaneStyleConfig(),
},
diff --git a/app/client/src/widgets/RangeSliderWidget/widget/index.tsx b/app/client/src/widgets/RangeSliderWidget/widget/index.tsx
index 83c9a6545cb8..fff4658f617a 100644
--- a/app/client/src/widgets/RangeSliderWidget/widget/index.tsx
+++ b/app/client/src/widgets/RangeSliderWidget/widget/index.tsx
@@ -48,10 +48,6 @@ class RangeSliderWidget extends BaseWidget<
RangeSliderWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [...contentConfig, ...styleConfig];
- }
-
static getPropertyPaneContentConfig() {
return contentConfig;
}
diff --git a/app/client/src/widgets/RateWidget/widget/index.tsx b/app/client/src/widgets/RateWidget/widget/index.tsx
index ba8ca31b0314..264061945cb7 100644
--- a/app/client/src/widgets/RateWidget/widget/index.tsx
+++ b/app/client/src/widgets/RateWidget/widget/index.tsx
@@ -67,163 +67,6 @@ function validateDefaultRate(value: unknown, props: any, _: any) {
}
class RateWidget extends BaseWidget<RateWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "maxCount",
- helpText: "Sets the maximum allowed rating",
- label: "Max Rating",
- controlType: "INPUT_TEXT",
- placeholderText: "5",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.NUMBER,
- params: { natural: true },
- },
- },
- {
- propertyName: "defaultRate",
- helpText: "Sets the default rating",
- label: "Default Rating",
- controlType: "INPUT_TEXT",
- placeholderText: "2.5",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: validateDefaultRate,
- expected: {
- type: "number",
- example: 5,
- autocompleteDataType: AutocompleteDataType.NUMBER,
- },
- },
- },
- dependencies: ["maxCount", "isAllowHalf"],
- },
-
- {
- propertyName: "tooltips",
- helpText: "Sets the tooltip contents of stars",
- label: "Tooltips",
- controlType: "INPUT_TEXT",
- placeholderText: '["Bad", "Neutral", "Good"]',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: { children: { type: ValidationTypes.TEXT } },
- },
- },
- {
- propertyName: "size",
- label: "Size",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Small",
- value: "SMALL",
- },
- {
- label: "Medium",
- value: "MEDIUM",
- },
- {
- label: "Large",
- value: "LARGE",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "isAllowHalf",
- helpText: "Controls if user can submit half stars",
- label: "Allow half stars",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables input to the widget",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the rate is changed",
- propertyName: "onRateChanged",
- label: "onChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "activeColor",
- label: "Active color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "inactiveColor",
- label: "Inactive color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/RichTextEditorWidget/widget/index.tsx b/app/client/src/widgets/RichTextEditorWidget/widget/index.tsx
index 42d8afc44ff1..2f5344793a9c 100644
--- a/app/client/src/widgets/RichTextEditorWidget/widget/index.tsx
+++ b/app/client/src/widgets/RichTextEditorWidget/widget/index.tsx
@@ -26,283 +26,6 @@ class RichTextEditorWidget extends BaseWidget<
RichTextEditorWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "inputType",
- helpText:
- "Sets the input type of the default text property in widget.",
- label: "Input Type",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Markdown",
- value: "markdown",
- },
- {
- label: "HTML",
- value: "html",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "defaultText",
- helpText:
- "Sets the default text of the widget. The text is updated if the default text changes",
- label: "Default text",
- controlType: "INPUT_TEXT",
- placeholderText: "<b>Hello World</b>",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disable",
- helpText: "Disables input to this widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isToolbarHidden",
- label: "Hide toolbar",
- helpText: "Controls the visibility of the toolbar",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "labelText",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: RichTextEditorWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: RichTextEditorWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Label Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the text is changed",
- propertyName: "onTextChange",
- label: "onTextChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
-
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/SelectWidget/widget/index.tsx b/app/client/src/widgets/SelectWidget/widget/index.tsx
index 3e1007f5f444..63f38d58e56a 100644
--- a/app/client/src/widgets/SelectWidget/widget/index.tsx
+++ b/app/client/src/widgets/SelectWidget/widget/index.tsx
@@ -119,353 +119,6 @@ class SelectWidget extends BaseWidget<SelectWidgetProps, WidgetState> {
super(props);
}
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText:
- "Allows users to select a single option. Values must be unique",
- propertyName: "options",
- label: "Options",
- controlType: "INPUT_TEXT",
- placeholderText: '[{ "label": "label1", "value": "value1" }]',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- unique: ["value"],
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- required: true,
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- requiredKey: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- requiredKey: true,
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Selects the option with value by default",
- propertyName: "defaultOptionValue",
- label: "Default Value",
- controlType: "SELECT_DEFAULT_VALUE_CONTROL",
- placeholderText: '{ "label": "label1", "value": "value1" }',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultOptionValueValidation,
- expected: {
- type: 'value1 or { "label": "label1", "value": "value1" }',
- example: `value1 | { "label": "label1", "value": "value1" }`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- dependencies: ["serverSideFiltering", "options"],
- },
- {
- helpText: "Sets a Placeholder Text",
- propertyName: "placeholderText",
- label: "Placeholder",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter placeholder text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- helpText: "Disables input to this widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isFilterable",
- label: "Filterable",
- helpText: "Makes the dropdown list filterable",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Enables server side filtering of the data",
- propertyName: "serverSideFiltering",
- label: "Server Side Filtering",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when a user selects an option",
- propertyName: "onOptionChange",
- label: "onOptionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Trigger an action on change of filterText",
- hidden: (props: SelectWidgetProps) => !props.serverSideFiltering,
- dependencies: ["serverSideFiltering"],
- propertyName: "onFilterUpdate",
- label: "onFilterUpdate",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "labelText",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: SelectWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: SelectWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Label Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Label Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "accentColor",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- invisible: true,
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/SingleSelectTreeWidget/widget/index.tsx b/app/client/src/widgets/SingleSelectTreeWidget/widget/index.tsx
index aae41a2802ad..41bba8c0b172 100644
--- a/app/client/src/widgets/SingleSelectTreeWidget/widget/index.tsx
+++ b/app/client/src/widgets/SingleSelectTreeWidget/widget/index.tsx
@@ -31,371 +31,6 @@ class SingleSelectTreeWidget extends BaseWidget<
SingleSelectTreeWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText:
- "Allows users to select multiple options. Values must be unique",
- propertyName: "options",
- label: "Options",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter option value",
- isBindProperty: true,
- isTriggerProperty: false,
- isJSConvertible: false,
- validation: {
- type: ValidationTypes.NESTED_OBJECT_ARRAY,
- params: {
- unique: ["value"],
- default: [],
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- required: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- },
- },
- {
- name: "children",
- type: ValidationTypes.ARRAY,
- required: false,
- params: {
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- required: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- },
- },
- ],
- },
- },
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Selects the option with value by default",
- propertyName: "defaultOptionValue",
- label: "Default Value",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter option value",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: defaultOptionValueValidation,
- expected: {
- type: "value",
- example: `value1`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- helpText: "Sets a Placeholder Text",
- propertyName: "placeholderText",
- label: "Placeholder",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter placeholder text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- helpText: "Disables input to this widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "allowClear",
- label: "Allow Clearing Value",
- helpText: "Enables Icon to clear all Selections",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "expandAll",
- label: "Expand all by default",
- helpText: "Expand All nested options",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when a user selects an option",
- propertyName: "onOptionChange",
- label: "onOptionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "labelText",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: SingleSelectTreeWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: SingleSelectTreeWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "accentColor",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- invisible: true,
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
-
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextColor",
- label: "Label Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Label Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/StatboxWidget/widget/index.tsx b/app/client/src/widgets/StatboxWidget/widget/index.tsx
index ff69bcf0d4e8..e9a1bb0f2b5e 100644
--- a/app/client/src/widgets/StatboxWidget/widget/index.tsx
+++ b/app/client/src/widgets/StatboxWidget/widget/index.tsx
@@ -4,104 +4,6 @@ import ContainerWidget from "widgets/ContainerWidget";
import { ValidationTypes } from "constants/WidgetValidation";
class StatboxWidget extends ContainerWidget {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "shouldScrollContents",
- helpText: "Enables scrolling for content inside the widget",
- label: "Scroll Contents",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "backgroundColor",
- helpText: "Use a html color name, HEX, RGB or RGBA value",
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- label: "Background Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderColor",
- helpText: "Use a html color name, HEX, RGB or RGBA value",
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- label: "Border Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderWidth",
- helpText: "Enter value for border width",
- label: "Border Width",
- placeholderText: "Enter value in px",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/SwitchGroupWidget/widget/index.tsx b/app/client/src/widgets/SwitchGroupWidget/widget/index.tsx
index 4743a01db170..7b9ca454c51e 100644
--- a/app/client/src/widgets/SwitchGroupWidget/widget/index.tsx
+++ b/app/client/src/widgets/SwitchGroupWidget/widget/index.tsx
@@ -17,318 +17,6 @@ class SwitchGroupWidget extends BaseWidget<
SwitchGroupWidgetProps,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- helpText:
- "Displays a list of options for a user to select. Values must be unique",
- propertyName: "options",
- label: "Options",
- controlType: "INPUT_TEXT",
- placeholderText: '[{ "label": "Option1", "value": "Option2" }]',
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- children: {
- type: ValidationTypes.OBJECT,
- params: {
- allowedKeys: [
- {
- name: "label",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- required: true,
- unique: true,
- },
- },
- {
- name: "value",
- type: ValidationTypes.TEXT,
- params: {
- default: "",
- unique: true,
- },
- },
- ],
- },
- },
- },
- },
- evaluationSubstitutionType:
- EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText:
- "Selects values of the options checked by default. Enter comma separated values for multiple selected",
- propertyName: "defaultSelectedValues",
- label: "Default Selected Values",
- placeholderText: "Enter option values",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- default: [],
- children: {
- type: ValidationTypes.TEXT,
- },
- strict: true,
- },
- },
- },
- {
- propertyName: "isInline",
- helpText:
- "Whether switches are to be displayed inline horizontally",
- label: "Inline",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isRequired",
- label: "Required",
- helpText: "Makes input to the widget mandatory",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables input to the widget",
- label: "Disabled",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "alignment",
- helpText: "Sets the alignment of the widget",
- label: "Alignment",
- controlType: "DROP_DOWN",
- isBindProperty: true,
- isTriggerProperty: false,
- options: [
- {
- label: "Left",
- value: Alignment.LEFT,
- },
- {
- label: "Right",
- value: Alignment.RIGHT,
- },
- ],
- },
- ],
- },
- {
- sectionName: "Label",
- children: [
- {
- helpText: "Sets the label text of the widget",
- propertyName: "labelText",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label text",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Top", value: LabelPosition.Top },
- { label: "Auto", value: LabelPosition.Auto },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label alignment of the widget",
- propertyName: "labelAlignment",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: Alignment.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: Alignment.RIGHT,
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- hidden: (props: SwitchGroupWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- {
- helpText:
- "Sets the label width of the widget as the number of columns",
- propertyName: "labelWidth",
- label: "Width (in columns)",
- controlType: "NUMERIC_INPUT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- min: 0,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- natural: true,
- },
- },
- hidden: (props: SwitchGroupWidgetProps) =>
- props.labelPosition !== LabelPosition.Left,
- dependencies: ["labelPosition"],
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Label Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelTextSize",
- label: "Label Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "accentColor",
- helpText: "Sets the background color of the widget",
- label: "Accent color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Actions",
- children: [
- {
- helpText:
- "Triggers an action when a switch state inside the group is changed",
- propertyName: "onSelectionChange",
- label: "onSelectionChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/SwitchWidget/widget/index.tsx b/app/client/src/widgets/SwitchWidget/widget/index.tsx
index 5bf1c7aa6113..d438220b97bd 100644
--- a/app/client/src/widgets/SwitchWidget/widget/index.tsx
+++ b/app/client/src/widgets/SwitchWidget/widget/index.tsx
@@ -10,214 +10,6 @@ import { DerivedPropertiesMap } from "utils/WidgetFactory";
import { LabelPosition } from "components/constants";
import { AlignWidgetTypes } from "widgets/constants";
class SwitchWidget extends BaseWidget<SwitchWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "Label",
- children: [
- {
- propertyName: "label",
- label: "Label",
- controlType: "INPUT_TEXT",
- helpText: "Displays a label next to the widget",
- placeholderText: "Enable Option",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Sets the label position of the widget",
- propertyName: "labelPosition",
- label: "Position",
- controlType: "DROP_DOWN",
- options: [
- { label: "Left", value: LabelPosition.Left },
- { label: "Right", value: LabelPosition.Right },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "alignWidget",
- helpText: "Sets the alignment of the widget",
- label: "Alignment",
- controlType: "LABEL_ALIGNMENT_OPTIONS",
- isBindProperty: true,
- isTriggerProperty: false,
- options: [
- {
- icon: "LEFT_ALIGN",
- value: AlignWidgetTypes.LEFT,
- },
- {
- icon: "RIGHT_ALIGN",
- value: AlignWidgetTypes.RIGHT,
- },
- ],
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "General",
- children: [
- {
- propertyName: "defaultSwitchState",
- label: "Default Selected",
- helpText:
- "On / Off the Switch by default. Changes to the default selection update the widget state",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isDisabled",
- label: "Disabled",
- controlType: "SWITCH",
- helpText: "Disables input to this widget",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the switch state is changed",
- propertyName: "onChange",
- label: "onChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Label Styles",
- children: [
- {
- propertyName: "labelTextColor",
- label: "Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- {
- propertyName: "labelTextSize",
- label: "Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "0.875rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "labelStyle",
- label: "Label Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "accentColor",
- helpText: "Sets the background color of the widget",
- label: "Accent color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/TableWidgetV2/index.ts b/app/client/src/widgets/TableWidgetV2/index.ts
index 442b817be84e..3651f7ece6b3 100644
--- a/app/client/src/widgets/TableWidgetV2/index.ts
+++ b/app/client/src/widgets/TableWidgetV2/index.ts
@@ -230,7 +230,6 @@ export const CONFIG = {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
- config: Widget.getPropertyPaneConfig(),
contentConfig: Widget.getPropertyPaneContentConfig(),
styleConfig: Widget.getPropertyPaneStyleConfig(),
loadingProperties: Widget.getLoadingProperties(),
diff --git a/app/client/src/widgets/TableWidgetV2/widget/index.tsx b/app/client/src/widgets/TableWidgetV2/widget/index.tsx
index 4ecb710a9b82..611388dbd28a 100644
--- a/app/client/src/widgets/TableWidgetV2/widget/index.tsx
+++ b/app/client/src/widgets/TableWidgetV2/widget/index.tsx
@@ -58,7 +58,6 @@ import {
CompactModeTypes,
SortOrderTypes,
} from "../component/Constants";
-import tablePropertyPaneConfig from "./propertyConfig";
import contentConfig from "./propertyConfig/contentConfig";
import styleConfig from "./propertyConfig/styleConfig";
import { BatchPropertyUpdatePayload } from "actions/controlActions";
@@ -93,10 +92,6 @@ const defaultFilter = [
class TableWidgetV2 extends BaseWidget<TableWidgetProps, WidgetState> {
inlineEditTimer: number | null = null;
- static getPropertyPaneConfig() {
- return tablePropertyPaneConfig;
- }
-
static getPropertyPaneContentConfig() {
return contentConfig;
}
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/Events.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/Events.ts
deleted file mode 100644
index da3c3b883ea0..000000000000
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/Events.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-export default {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when a table row is selected",
- propertyName: "onRowSelected",
- label: "onRowSelected",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when a table page is changed",
- propertyName: "onPageChange",
- label: "onPageChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when a table page size is changed",
- propertyName: "onPageSizeChange",
- label: "onPageSizeChange",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- propertyName: "onSearchTextChanged",
- label: "onSearchTextChanged",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when a table column is sorted",
- propertyName: "onSort",
- label: "onSort",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
-};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/General.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/General.ts
deleted file mode 100644
index feb763dd5b0a..000000000000
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/General.ts
+++ /dev/null
@@ -1,283 +0,0 @@
-import { ValidationTypes } from "constants/WidgetValidation";
-import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
-import { AutocompleteDataType } from "utils/autocomplete/TernServer";
-import {
- InlineEditingSaveOptions,
- TableWidgetProps,
-} from "widgets/TableWidgetV2/constants";
-import {
- totalRecordsCountValidation,
- uniqueColumnNameValidation,
- updateColumnOrderHook,
- updateInlineEditingSaveOptionHook,
- updateInlineEditingOptionDropdownVisibilityHook,
-} from "../propertyUtils";
-import {
- createMessage,
- TABLE_WIDGET_TOTAL_RECORD_TOOLTIP,
-} from "@appsmith/constants/messages";
-import panelConfig from "./PanelConfig";
-import { composePropertyUpdateHook } from "widgets/WidgetUtils";
-
-export default {
- sectionName: "General",
- children: [
- {
- helpText:
- "Takes in an array of objects to display rows in the table. Bind data from an API using {{}}",
- propertyName: "tableData",
- label: "Table Data",
- controlType: "INPUT_TEXT",
- placeholderText: '[{ "name": "John" }]',
- inputType: "ARRAY",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.OBJECT_ARRAY,
- params: {
- default: [],
- },
- },
- evaluationSubstitutionType: EvaluationSubstitutionType.SMART_SUBSTITUTE,
- },
- {
- helpText: "Columns",
- propertyName: "primaryColumns",
- controlType: "PRIMARY_COLUMNS_V2",
- label: "Columns",
- updateHook: composePropertyUpdateHook([
- updateColumnOrderHook,
- updateInlineEditingOptionDropdownVisibilityHook,
- ]),
- dependencies: [
- "columnOrder",
- "childStylesheet",
- "inlineEditingSaveOption",
- "textColor",
- "textSize",
- "fontStyle",
- "cellBackground",
- "verticalAlignment",
- "horizontalAlignment",
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: uniqueColumnNameValidation,
- expected: {
- type: "Unique Column Names",
- example: "abc",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- panelConfig,
- },
- {
- propertyName: "inlineEditingSaveOption",
- helpText: "Choose the save experience to save the edited cell",
- label: "Update Mode",
- controlType: "DROP_DOWN",
- isBindProperty: true,
- isTriggerProperty: false,
- hidden: (props: TableWidgetProps) => {
- return (
- !props.showInlineEditingOptionDropdown &&
- !Object.values(props.primaryColumns).find(
- (column) => column.isEditable,
- )
- );
- },
- dependencies: [
- "primaryColumns",
- "columnOrder",
- "childStylesheet",
- "showInlineEditingOptionDropdown",
- ],
- options: [
- {
- label: "Row level",
- value: InlineEditingSaveOptions.ROW_LEVEL,
- },
- {
- label: "Custom",
- value: InlineEditingSaveOptions.CUSTOM,
- },
- ],
- updateHook: updateInlineEditingSaveOptionHook,
- },
- {
- helpText:
- "Assigns a unique column which helps maintain selectedRows and triggeredRows based on value",
- propertyName: "primaryColumnId",
- dependencies: ["primaryColumns"],
- label: "Primary key column",
- controlType: "PRIMARY_COLUMNS_DROPDOWN",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "defaultSearchText",
- label: "Default Search Text",
- controlType: "INPUT_TEXT",
- placeholderText: "{{appsmith.user.name}}",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText: "Selects row(s) by default",
- propertyName: "defaultSelectedRowIndices",
- label: "Default Selected Rows",
- controlType: "INPUT_TEXT",
- placeholderText: "[0]",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.ARRAY,
- params: {
- children: {
- type: ValidationTypes.NUMBER,
- params: {
- min: -1,
- default: -1,
- },
- },
- },
- },
- hidden: (props: TableWidgetProps) => {
- return !props.multiRowSelection;
- },
- dependencies: ["multiRowSelection"],
- },
- {
- helpText: "Selects row by default",
- propertyName: "defaultSelectedRowIndex",
- label: "Default Selected Row",
- controlType: "INPUT_TEXT",
- placeholderText: "0",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.NUMBER,
- params: {
- min: -1,
- default: -1,
- },
- },
- hidden: (props: TableWidgetProps) => {
- return props.multiRowSelection;
- },
- dependencies: ["multiRowSelection"],
- },
- {
- propertyName: "compactMode",
- helpText: "Selects row height",
- label: "Default Row Height",
- controlType: "DROP_DOWN",
- defaultValue: "DEFAULT",
- isBindProperty: true,
- isTriggerProperty: false,
- options: [
- {
- label: "Short",
- value: "SHORT",
- },
- {
- label: "Default",
- value: "DEFAULT",
- },
- {
- label: "Tall",
- value: "TALL",
- },
- ],
- },
- {
- helpText:
- "Bind the Table.pageNo property in your API and call it onPageChange",
- propertyName: "serverSidePaginationEnabled",
- label: "Server Side Pagination",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- helpText: createMessage(TABLE_WIDGET_TOTAL_RECORD_TOOLTIP),
- propertyName: "totalRecordsCount",
- label: "Total Record Count",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter total record count",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: totalRecordsCountValidation,
- expected: {
- type: "Number",
- example: "10",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- hidden: (props: TableWidgetProps) => !!!props.serverSidePaginationEnabled,
- dependencies: ["serverSidePaginationEnabled"],
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- isJSConvertible: true,
- label: "Visible",
- controlType: "SWITCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls sorting in View Mode",
- propertyName: "isSortable",
- isJSConvertible: true,
- label: "Sortable",
- controlType: "SWITCH",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.BOOLEAN,
- params: {
- default: true,
- },
- },
- },
- {
- propertyName: "multiRowSelection",
- label: "Enable multi row selection",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "enableClientSideSearch",
- label: "Enable client side search",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- ],
-};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/HeaderOptions.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/HeaderOptions.ts
deleted file mode 100644
index 947dc3205275..000000000000
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/HeaderOptions.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { ValidationTypes } from "constants/WidgetValidation";
-import { TableWidgetProps } from "widgets/TableWidgetV2/constants";
-
-export default {
- sectionName: "Header options",
- children: [
- {
- propertyName: "isVisibleSearch",
- helpText: "Toggle visibility of the search box",
- label: "Search",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisibleFilters",
- helpText: "Toggle visibility of the filters",
- label: "Filters",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisibleDownload",
- helpText: "Toggle visibility of the data download",
- label: "Download",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "isVisiblePagination",
- helpText: "Toggle visibility of the pagination",
- label: "Pagination",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "delimiter",
- label: "CSV Separator",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter CSV separator",
- helpText: "The character used for separating the CSV download file.",
- isBindProperty: true,
- isTriggerProperty: false,
- defaultValue: ",",
- validation: {
- type: ValidationTypes.TEXT,
- },
- hidden: (props: TableWidgetProps) => !props.isVisibleDownload,
- dependencies: ["isVisibleDownload"],
- },
- ],
-};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/BorderAndShadow.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/BorderAndShadow.ts
new file mode 100644
index 000000000000..0566723b628f
--- /dev/null
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/BorderAndShadow.ts
@@ -0,0 +1,62 @@
+import { ValidationTypes } from "constants/WidgetValidation";
+import { ColumnTypes, TableWidgetProps } from "widgets/TableWidgetV2/constants";
+import {
+ hideByColumnType,
+ removeBoxShadowColorProp,
+} from "../../propertyUtils";
+
+export default {
+ sectionName: "Border and Shadow",
+ children: [
+ {
+ propertyName: "borderRadius",
+ label: "Border Radius",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ helpText: "Rounds the corners of the icon button's outer border edge",
+ controlType: "BORDER_RADIUS_OPTIONS",
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [
+ ColumnTypes.ICON_BUTTON,
+ ColumnTypes.MENU_BUTTON,
+ ColumnTypes.BUTTON,
+ ]);
+ },
+ dependencies: ["primaryColumns", "columnOrder"],
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ },
+ },
+ },
+ {
+ propertyName: "boxShadow",
+ label: "Box Shadow",
+ helpText:
+ "Enables you to cast a drop shadow from the frame of the widget",
+ controlType: "BOX_SHADOW_OPTIONS",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ updateHook: removeBoxShadowColorProp,
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [
+ ColumnTypes.ICON_BUTTON,
+ ColumnTypes.MENU_BUTTON,
+ ColumnTypes.BUTTON,
+ ]);
+ },
+ dependencies: ["primaryColumns", "columnOrder"],
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ },
+ },
+ },
+ ],
+};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/ButtonProperties.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/ButtonProperties.ts
deleted file mode 100644
index ed7e77766e39..000000000000
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/ButtonProperties.ts
+++ /dev/null
@@ -1,318 +0,0 @@
-import { ValidationTypes } from "constants/WidgetValidation";
-import { ColumnTypes, TableWidgetProps } from "widgets/TableWidgetV2/constants";
-import { ButtonVariantTypes } from "components/constants";
-import {
- hideByColumnType,
- removeBoxShadowColorProp,
- updateIconAlignment,
-} from "../../propertyUtils";
-import { IconNames } from "@blueprintjs/icons";
-
-const ICON_NAMES = Object.keys(IconNames).map(
- (name: string) => IconNames[name as keyof typeof IconNames],
-);
-
-export default {
- sectionName: "Button Properties",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(
- props,
- propertyPath,
- [ColumnTypes.BUTTON, ColumnTypes.MENU_BUTTON, ColumnTypes.ICON_BUTTON],
- true,
- );
- },
- children: [
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used for the icon button",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [ColumnTypes.ICON_BUTTON]);
- },
- updateHook: updateIconAlignment,
- dependencies: ["primaryColumns", "columnOrder"],
- controlType: "ICON_SELECT",
- customJSControl: "TABLE_COMPUTE_VALUE",
- defaultIconName: "add",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
- default: IconNames.ADD,
- },
- },
- },
- },
- {
- propertyName: "menuButtoniconName",
- label: "Icon",
- helpText: "Sets the icon to be used for the menu button",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
- },
- updateHook: updateIconAlignment,
- dependencies: ["primaryColumns", "columnOrder"],
- controlType: "ICON_SELECT",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
- },
- },
- },
- },
- {
- propertyName: "iconAlign",
- label: "Icon Alignment",
- helpText: "Sets the icon alignment of the menu button",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["center", "left", "right"],
- },
- },
- },
- {
- propertyName: "buttonLabel",
- label: "Label",
- controlType: "TABLE_COMPUTE_VALUE",
- defaultValue: "Action",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [ColumnTypes.BUTTON]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: false,
- },
- {
- propertyName: "menuButtonLabel",
- label: "Label",
- controlType: "TABLE_COMPUTE_VALUE",
- defaultValue: "Open Menu",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: false,
- },
- {
- propertyName: "buttonColor",
- label: "Button Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- helpText: "Changes the color of the button",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.BUTTON,
- ColumnTypes.ICON_BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- isTriggerProperty: false,
- },
- {
- propertyName: "buttonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Sets the variant",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.ICON_BUTTON,
- ColumnTypes.BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- defaultValue: ButtonVariantTypes.PRIMARY,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- default: ButtonVariantTypes.PRIMARY,
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- },
- },
- },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.ICON_BUTTON,
- ColumnTypes.MENU_BUTTON,
- ColumnTypes.BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- },
- },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- updateHook: removeBoxShadowColorProp,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.ICON_BUTTON,
- ColumnTypes.MENU_BUTTON,
- ColumnTypes.BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- },
- },
- },
- {
- propertyName: "menuColor",
- helpText: "Sets the custom color preset based on the menu button variant",
- label: "Menu Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
- },
- dependencies: ["primaryColumns", "columnOrder", "childStylesheet"],
- },
- {
- propertyName: "menuVariant",
- label: "Menu Variant",
- controlType: "DROP_DOWN",
- customJSControl: "TABLE_COMPUTE_VALUE",
- helpText: "Sets the variant of the menu button",
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- isJSConvertible: true,
- dependencies: ["primaryColumns", "columnOrder"],
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
- },
- isBindProperty: true,
- isTriggerProperty: false,
- defaultValue: ButtonVariantTypes.PRIMARY,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- default: ButtonVariantTypes.PRIMARY,
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- },
- },
- },
- },
- ],
-};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Color.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Color.ts
new file mode 100644
index 000000000000..4612b985f4a3
--- /dev/null
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Color.ts
@@ -0,0 +1,105 @@
+import { ValidationTypes } from "constants/WidgetValidation";
+import { ColumnTypes, TableWidgetProps } from "widgets/TableWidgetV2/constants";
+import { hideByColumnType } from "../../propertyUtils";
+
+export default {
+ sectionName: "Color",
+ children: [
+ {
+ propertyName: "buttonColor",
+ label: "Button Color",
+ controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
+ helpText: "Changes the color of the button",
+ isJSConvertible: true,
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [
+ ColumnTypes.BUTTON,
+ ColumnTypes.ICON_BUTTON,
+ ]);
+ },
+ dependencies: ["primaryColumns", "columnOrder"],
+ isBindProperty: true,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
+ },
+ },
+ isTriggerProperty: false,
+ },
+ {
+ propertyName: "menuColor",
+ helpText: "Sets the custom color preset based on the menu button variant",
+ label: "Button Color",
+ controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
+ },
+ },
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
+ },
+ dependencies: ["primaryColumns", "columnOrder", "childStylesheet"],
+ },
+ {
+ propertyName: "cellBackground",
+ label: "Cell Background",
+ controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
+ isJSConvertible: true,
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ dependencies: ["primaryColumns", "columnOrder"],
+ isBindProperty: true,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
+ },
+ },
+ isTriggerProperty: false,
+ },
+ {
+ propertyName: "textColor",
+ label: "Text Color",
+ controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
+ isJSConvertible: true,
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ dependencies: ["primaryColumns", "columnOrder"],
+ isBindProperty: true,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
+ },
+ },
+ isTriggerProperty: false,
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [
+ ColumnTypes.TEXT,
+ ColumnTypes.DATE,
+ ColumnTypes.NUMBER,
+ ColumnTypes.URL,
+ ]);
+ },
+ },
+ ],
+};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/DiscardButtonproperties.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/DiscardButtonproperties.ts
index 44aaf879469f..7ed5afe64d4a 100644
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/DiscardButtonproperties.ts
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/DiscardButtonproperties.ts
@@ -1,11 +1,9 @@
+import { get } from "lodash";
import { ValidationTypes } from "constants/WidgetValidation";
-import {
- ColumnTypes,
- ICON_NAMES,
- TableWidgetProps,
-} from "widgets/TableWidgetV2/constants";
+import { ColumnTypes, TableWidgetProps } from "widgets/TableWidgetV2/constants";
+import { hideByColumnType, getBasePropertyPath } from "../../propertyUtils";
import { ButtonVariantTypes } from "components/constants";
-import { hideByColumnType } from "../../propertyUtils";
+import { ICON_NAMES } from "widgets/constants";
export default {
sectionName: "Discard Button",
@@ -19,170 +17,223 @@ export default {
},
children: [
{
- propertyName: "isDiscardVisible",
- dependencies: ["primaryColumns"],
- label: "Visible",
- helpText: "Controls the visibility of the discard button",
- defaultValue: true,
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- },
- {
- propertyName: "isDiscardDisabled",
- label: "Disabled",
- defaultValue: false,
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- dependencies: ["primaryColumns"],
- },
- {
- propertyName: "discardActionLabel",
- label: "Action label",
- controlType: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- isTriggerProperty: false,
- },
- {
- propertyName: "discardButtonColor",
- label: "Button Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- helpText: "Changes the color of the button",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
+ sectionName: "Label",
+ collapsible: false,
+ children: [
+ {
+ propertyName: "discardActionLabel",
+ label: "Text",
+ controlType: "TABLE_COMPUTE_VALUE",
+ dependencies: ["primaryColumns"],
+ isBindProperty: true,
+ isTriggerProperty: false,
},
- },
- isTriggerProperty: false,
+ ],
},
{
- propertyName: "discardButtonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Sets the variant of the discard button",
- dependencies: ["primaryColumns"],
- options: [
+ sectionName: "General",
+ collapsible: false,
+ children: [
{
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
+ propertyName: "onDiscard",
+ label: "onDiscard",
+ controlType: "ACTION_SELECTOR",
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ const baseProperty = getBasePropertyPath(propertyPath);
+ const columnType = get(props, `${baseProperty}.columnType`, "");
+ return columnType !== ColumnTypes.EDIT_ACTIONS;
+ },
+ dependencies: ["primaryColumns"],
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: true,
},
{
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
+ propertyName: "isDiscardVisible",
+ dependencies: ["primaryColumns"],
+ label: "Visible",
+ helpText: "Controls the visibility of the discard button",
+ defaultValue: true,
+ controlType: "SWITCH",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.BOOLEAN,
+ },
+ },
},
{
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- defaultValue: ButtonVariantTypes.PRIMARY,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- default: ButtonVariantTypes.PRIMARY,
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
+ propertyName: "isDiscardDisabled",
+ label: "Disabled",
+ defaultValue: false,
+ controlType: "SWITCH",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.BOOLEAN,
+ },
},
+ dependencies: ["primaryColumns"],
},
- },
+ ],
},
+ ],
+};
+
+export const discardButtonStyleConfig = {
+ sectionName: "Discard Button",
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(
+ props,
+ propertyPath,
+ [ColumnTypes.EDIT_ACTIONS],
+ true,
+ );
+ },
+ children: [
{
- propertyName: "discardBorderRadius",
- label: "Border Radius",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Rounds the corners of the discard button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
+ sectionName: "General",
+ collapsible: false,
+ children: [
+ {
+ propertyName: "discardButtonColor",
+ label: "Button Color",
+ controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
+ helpText: "Changes the color of the button",
+ isJSConvertible: true,
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ dependencies: ["primaryColumns"],
+ isBindProperty: true,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
+ },
+ },
+ isTriggerProperty: false,
},
- },
- },
- {
- propertyName: "discardActionIconName",
- label: "Action Icon",
- helpText: "Sets the icon to be used for the discard action button",
- dependencies: ["primaryColumns", "columnOrder"],
- controlType: "ICON_SELECT",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
+ {
+ propertyName: "discardButtonVariant",
+ label: "Button Variant",
+ controlType: "DROP_DOWN",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ helpText: "Sets the variant of the discard button",
+ dependencies: ["primaryColumns"],
+ options: [
+ {
+ label: "Primary",
+ value: ButtonVariantTypes.PRIMARY,
+ },
+ {
+ label: "Secondary",
+ value: ButtonVariantTypes.SECONDARY,
+ },
+ {
+ label: "Tertiary",
+ value: ButtonVariantTypes.TERTIARY,
+ },
+ ],
+ defaultValue: ButtonVariantTypes.PRIMARY,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ default: ButtonVariantTypes.PRIMARY,
+ allowedValues: [
+ ButtonVariantTypes.PRIMARY,
+ ButtonVariantTypes.SECONDARY,
+ ButtonVariantTypes.TERTIARY,
+ ],
+ },
+ },
+ },
+ },
+ {
+ propertyName: "discardBorderRadius",
+ label: "Border Radius",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ helpText:
+ "Rounds the corners of the discard button's outer border edge",
+ controlType: "BORDER_RADIUS_OPTIONS",
+ dependencies: ["primaryColumns"],
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ },
},
},
- },
+ ],
},
{
- propertyName: "discardIconAlign",
- label: "Icon Alignment",
- helpText: "Sets the icon alignment of the discard button",
- controlType: "ICON_TABS",
- defaultValue: "left",
- options: [
+ sectionName: "Icon",
+ collapsible: false,
+ children: [
{
- icon: "VERTICAL_LEFT",
- value: "left",
+ propertyName: "discardActionIconName",
+ label: "Icon",
+ helpText: "Sets the icon to be used for the discard action button",
+ dependencies: ["primaryColumns", "columnOrder"],
+ controlType: "ICON_SELECT",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: ICON_NAMES,
+ },
+ },
+ },
},
{
- icon: "VERTICAL_RIGHT",
- value: "right",
+ propertyName: "discardIconAlign",
+ label: "Position",
+ helpText: "Sets the icon alignment of the discard button",
+ controlType: "ICON_TABS",
+ defaultValue: "left",
+ options: [
+ {
+ icon: "VERTICAL_LEFT",
+ value: "left",
+ },
+ {
+ icon: "VERTICAL_RIGHT",
+ value: "right",
+ },
+ ],
+ isBindProperty: false,
+ isTriggerProperty: false,
+ dependencies: ["primaryColumns"],
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: ["left", "right"],
+ },
+ },
},
],
- isBindProperty: false,
- isTriggerProperty: false,
- dependencies: ["primaryColumns"],
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["left", "right"],
- },
- },
},
],
};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Events.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Events.ts
index 894086b1874b..a72f6e45657a 100644
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Events.ts
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Events.ts
@@ -1,23 +1,15 @@
import { ColumnTypes, TableWidgetProps } from "widgets/TableWidgetV2/constants";
import { get } from "lodash";
-import { getBasePropertyPath, hideByColumnType } from "../../propertyUtils";
+import {
+ getBasePropertyPath,
+ showByColumnType,
+ hideByColumnType,
+} from "../../propertyUtils";
export default {
sectionName: "Events",
hidden: (props: TableWidgetProps, propertyPath: string) => {
- if (
- !hideByColumnType(
- props,
- propertyPath,
- [
- ColumnTypes.BUTTON,
- ColumnTypes.ICON_BUTTON,
- ColumnTypes.IMAGE,
- ColumnTypes.EDIT_ACTIONS,
- ],
- true,
- )
- ) {
+ if (showByColumnType(props, propertyPath, [ColumnTypes.IMAGE], true)) {
return false;
} else {
const columnType = get(props, `${propertyPath}.columnType`, "");
@@ -33,31 +25,6 @@ export default {
}
},
children: [
- // Button, iconButton onClick
- {
- helpText: "Triggers an action when the button is clicked",
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- additionalAutoComplete: (props: TableWidgetProps) => ({
- currentRow: Object.assign(
- {},
- ...Object.keys(props.primaryColumns).map((key) => ({
- [key]: "",
- })),
- ),
- }),
- isJSConvertible: true,
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: true,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.BUTTON,
- ColumnTypes.ICON_BUTTON,
- ]);
- },
- },
// Image onClick
{
propertyName: "onClick",
@@ -126,33 +93,5 @@ export default {
isBindProperty: true,
isTriggerProperty: true,
},
- {
- propertyName: "onSave",
- label: "onSave",
- controlType: "ACTION_SELECTOR",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- const baseProperty = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${baseProperty}.columnType`, "");
- return columnType !== ColumnTypes.EDIT_ACTIONS;
- },
- dependencies: ["primaryColumns"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- propertyName: "onDiscard",
- label: "onDiscard",
- controlType: "ACTION_SELECTOR",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- const baseProperty = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${baseProperty}.columnType`, "");
- return columnType !== ColumnTypes.EDIT_ACTIONS;
- },
- dependencies: ["primaryColumns"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
],
};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/General.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/General.ts
index a143464ce9d1..f4c6c622f982 100644
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/General.ts
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/General.ts
@@ -9,6 +9,7 @@ import {
} from "../../propertyUtils";
import { isColumnTypeEditable } from "../../utilities";
import { composePropertyUpdateHook } from "widgets/WidgetUtils";
+import { ButtonVariantTypes } from "components/constants";
export default {
sectionName: "General",
@@ -137,3 +138,98 @@ export default {
},
],
};
+
+export const GeneralStyle = {
+ sectionName: "General",
+ children: [
+ {
+ propertyName: "buttonVariant",
+ label: "Button Variant",
+ controlType: "DROP_DOWN",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ helpText: "Sets the variant",
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [
+ ColumnTypes.ICON_BUTTON,
+ ColumnTypes.BUTTON,
+ ]);
+ },
+ dependencies: ["primaryColumns", "columnOrder"],
+ options: [
+ {
+ label: "Primary",
+ value: ButtonVariantTypes.PRIMARY,
+ },
+ {
+ label: "Secondary",
+ value: ButtonVariantTypes.SECONDARY,
+ },
+ {
+ label: "Tertiary",
+ value: ButtonVariantTypes.TERTIARY,
+ },
+ ],
+ defaultValue: ButtonVariantTypes.PRIMARY,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ default: ButtonVariantTypes.PRIMARY,
+ allowedValues: [
+ ButtonVariantTypes.PRIMARY,
+ ButtonVariantTypes.SECONDARY,
+ ButtonVariantTypes.TERTIARY,
+ ],
+ },
+ },
+ },
+ },
+ {
+ propertyName: "menuVariant",
+ label: "Button Variant",
+ controlType: "DROP_DOWN",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ helpText: "Sets the variant of the menu button",
+ options: [
+ {
+ label: "Primary",
+ value: ButtonVariantTypes.PRIMARY,
+ },
+ {
+ label: "Secondary",
+ value: ButtonVariantTypes.SECONDARY,
+ },
+ {
+ label: "Tertiary",
+ value: ButtonVariantTypes.TERTIARY,
+ },
+ ],
+ isJSConvertible: true,
+ dependencies: ["primaryColumns", "columnOrder"],
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
+ },
+ isBindProperty: true,
+ isTriggerProperty: false,
+ defaultValue: ButtonVariantTypes.PRIMARY,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ default: ButtonVariantTypes.PRIMARY,
+ allowedValues: [
+ ButtonVariantTypes.PRIMARY,
+ ButtonVariantTypes.SECONDARY,
+ ButtonVariantTypes.TERTIARY,
+ ],
+ },
+ },
+ },
+ },
+ ],
+};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Icon.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Icon.ts
new file mode 100644
index 000000000000..d5587eb41745
--- /dev/null
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Icon.ts
@@ -0,0 +1,65 @@
+import { ValidationTypes } from "constants/WidgetValidation";
+import {
+ ColumnTypes,
+ ICON_NAMES,
+ TableWidgetProps,
+} from "widgets/TableWidgetV2/constants";
+import { hideByColumnType, updateIconAlignment } from "../../propertyUtils";
+
+export default {
+ sectionName: "Icon",
+ children: [
+ {
+ propertyName: "menuButtoniconName",
+ label: "Icon",
+ helpText: "Sets the icon to be used for the menu button",
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
+ },
+ updateHook: updateIconAlignment,
+ dependencies: ["primaryColumns", "columnOrder"],
+ controlType: "ICON_SELECT",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: ICON_NAMES,
+ },
+ },
+ },
+ },
+ {
+ propertyName: "iconAlign",
+ label: "Position",
+ helpText: "Sets the icon alignment of the menu button",
+ controlType: "ICON_TABS",
+ options: [
+ {
+ icon: "VERTICAL_LEFT",
+ value: "left",
+ },
+ {
+ icon: "VERTICAL_RIGHT",
+ value: "right",
+ },
+ ],
+ isBindProperty: false,
+ isTriggerProperty: false,
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(props, propertyPath, [ColumnTypes.MENU_BUTTON]);
+ },
+ dependencies: ["primaryColumns", "columnOrder"],
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: ["center", "left", "right"],
+ },
+ },
+ },
+ ],
+};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/MenuItems.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/MenuItems.ts
deleted file mode 100644
index a7a26953109a..000000000000
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/MenuItems.ts
+++ /dev/null
@@ -1,183 +0,0 @@
-import { ValidationTypes } from "constants/WidgetValidation";
-import { ColumnTypes, TableWidgetProps } from "widgets/TableWidgetV2/constants";
-import { hideByColumnType } from "../../propertyUtils";
-
-export default {
- sectionName: "Menu Items",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(
- props,
- propertyPath,
- [ColumnTypes.MENU_BUTTON],
- true,
- );
- },
- children: [
- {
- helpText: "Menu items",
- propertyName: "menuItems",
- controlType: "MENU_ITEMS",
- label: "",
- isBindProperty: false,
- isTriggerProperty: false,
- dependencies: ["columnOrder"],
- panelConfig: {
- editableTitle: true,
- titlePropertyName: "label",
- panelIdPropertyName: "id",
- dependencies: ["primaryColumns", "columnOrder"],
- children: [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "label",
- helpText: "Sets the label of a menu item",
- label: "Label",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter label",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["primaryColumns", "columnOrder"],
- },
- {
- propertyName: "backgroundColor",
- helpText: "Sets the background color of a menu item",
- label: "Background color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- dependencies: ["primaryColumns", "columnOrder"],
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- },
- {
- propertyName: "textColor",
- helpText: "Sets the text color of a menu item",
- label: "Text color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- dependencies: ["primaryColumns", "columnOrder"],
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- },
- {
- propertyName: "isDisabled",
- helpText: "Disables input to the widget",
- label: "Disabled",
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- dependencies: ["primaryColumns", "columnOrder"],
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- dependencies: ["primaryColumns", "columnOrder"],
- },
- ],
- },
- {
- sectionName: "Icon Options",
- children: [
- {
- propertyName: "iconName",
- label: "Icon",
- helpText: "Sets the icon to be used for a menu item",
- controlType: "ICON_SELECT",
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["primaryColumns", "columnOrder"],
- },
- {
- propertyName: "iconColor",
- helpText: "Sets the icon color of a menu item",
- label: "Icon color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- isBindProperty: false,
- isTriggerProperty: false,
- dependencies: ["primaryColumns", "columnOrder"],
- },
- {
- propertyName: "iconAlign",
- label: "Icon alignment",
- helpText: "Sets the icon alignment of a menu item",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- dependencies: ["primaryColumns", "columnOrder"],
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the menu item is clicked",
- propertyName: "onClick",
- label: "onItemClick",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- dependencies: ["primaryColumns", "columnOrder"],
- },
- ],
- },
- ],
- },
- },
- ],
-};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/SaveButtonProperties.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/SaveButtonProperties.ts
index 18e4e9979aa7..e00354bb43fd 100644
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/SaveButtonProperties.ts
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/SaveButtonProperties.ts
@@ -1,11 +1,9 @@
+import { get } from "lodash";
import { ValidationTypes } from "constants/WidgetValidation";
-import {
- ColumnTypes,
- ICON_NAMES,
- TableWidgetProps,
-} from "widgets/TableWidgetV2/constants";
+import { ColumnTypes, TableWidgetProps } from "widgets/TableWidgetV2/constants";
+import { hideByColumnType, getBasePropertyPath } from "../../propertyUtils";
import { ButtonVariantTypes } from "components/constants";
-import { hideByColumnType } from "../../propertyUtils";
+import { ICON_NAMES } from "widgets/constants";
export default {
sectionName: "Save Button",
@@ -19,170 +17,222 @@ export default {
},
children: [
{
- propertyName: "isSaveVisible",
- dependencies: ["primaryColumns"],
- label: "Visible",
- helpText: "Controls the visibility of the save button",
- defaultValue: true,
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- },
- {
- propertyName: "isSaveDisabled",
- label: "Disabled",
- defaultValue: false,
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- dependencies: ["primaryColumns"],
- },
- {
- propertyName: "saveActionLabel",
- label: "Action label",
- controlType: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- isTriggerProperty: false,
- },
- {
- propertyName: "saveButtonColor",
- label: "Button Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- helpText: "Changes the color of the button",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
+ sectionName: "Label",
+ collapsible: false,
+ children: [
+ {
+ propertyName: "saveActionLabel",
+ label: "Text",
+ controlType: "TABLE_COMPUTE_VALUE",
+ dependencies: ["primaryColumns"],
+ isBindProperty: true,
+ isTriggerProperty: false,
},
- },
- isTriggerProperty: false,
+ ],
},
{
- propertyName: "saveButtonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Sets the variant of the save button",
- dependencies: ["primaryColumns"],
- options: [
+ sectionName: "General",
+ collapsible: false,
+ children: [
{
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
+ propertyName: "onSave",
+ label: "onSave",
+ controlType: "ACTION_SELECTOR",
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ const baseProperty = getBasePropertyPath(propertyPath);
+ const columnType = get(props, `${baseProperty}.columnType`, "");
+ return columnType !== ColumnTypes.EDIT_ACTIONS;
+ },
+ dependencies: ["primaryColumns"],
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: true,
},
{
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
+ propertyName: "isSaveVisible",
+ dependencies: ["primaryColumns"],
+ label: "Visible",
+ helpText: "Controls the visibility of the save button",
+ defaultValue: true,
+ controlType: "SWITCH",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.BOOLEAN,
+ },
+ },
},
{
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- defaultValue: ButtonVariantTypes.PRIMARY,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- default: ButtonVariantTypes.PRIMARY,
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
+ propertyName: "isSaveDisabled",
+ label: "Disabled",
+ defaultValue: false,
+ controlType: "SWITCH",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.BOOLEAN,
+ },
},
+ dependencies: ["primaryColumns"],
},
- },
+ ],
},
+ ],
+};
+
+export const saveButtonStyleConfig = {
+ sectionName: "Save Button",
+ hidden: (props: TableWidgetProps, propertyPath: string) => {
+ return hideByColumnType(
+ props,
+ propertyPath,
+ [ColumnTypes.EDIT_ACTIONS],
+ true,
+ );
+ },
+ children: [
{
- propertyName: "saveBorderRadius",
- label: "Border Radius",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Rounds the corners of the save button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
+ sectionName: "General",
+ collapsible: false,
+ children: [
+ {
+ propertyName: "saveButtonColor",
+ label: "Button Color",
+ controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
+ helpText: "Changes the color of the button",
+ isJSConvertible: true,
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ dependencies: ["primaryColumns"],
+ isBindProperty: true,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ regex: /^(?![<|{{]).+/,
+ },
+ },
+ },
+ isTriggerProperty: false,
},
- },
- },
- {
- propertyName: "saveActionIconName",
- label: "Action Icon",
- helpText: "Sets the icon to be used for the save action button",
- dependencies: ["primaryColumns", "columnOrder"],
- controlType: "ICON_SELECT",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
+ {
+ propertyName: "saveButtonVariant",
+ label: "Button Variant",
+ controlType: "DROP_DOWN",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ helpText: "Sets the variant of the save button",
+ dependencies: ["primaryColumns"],
+ options: [
+ {
+ label: "Primary",
+ value: ButtonVariantTypes.PRIMARY,
+ },
+ {
+ label: "Secondary",
+ value: ButtonVariantTypes.SECONDARY,
+ },
+ {
+ label: "Tertiary",
+ value: ButtonVariantTypes.TERTIARY,
+ },
+ ],
+ defaultValue: ButtonVariantTypes.PRIMARY,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ default: ButtonVariantTypes.PRIMARY,
+ allowedValues: [
+ ButtonVariantTypes.PRIMARY,
+ ButtonVariantTypes.SECONDARY,
+ ButtonVariantTypes.TERTIARY,
+ ],
+ },
+ },
+ },
+ },
+ {
+ propertyName: "saveBorderRadius",
+ label: "Border Radius",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ helpText: "Rounds the corners of the save button's outer border edge",
+ controlType: "BORDER_RADIUS_OPTIONS",
+ dependencies: ["primaryColumns"],
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ },
},
},
- },
+ ],
},
{
- propertyName: "saveIconAlign",
- label: "Icon Alignment",
- helpText: "Sets the icon alignment of the save button",
- controlType: "ICON_TABS",
- defaultValue: "left",
- options: [
+ sectionName: "Icon",
+ collapsible: false,
+ children: [
{
- icon: "VERTICAL_LEFT",
- value: "left",
+ propertyName: "saveActionIconName",
+ label: "Icon",
+ helpText: "Sets the icon to be used for the save action button",
+ dependencies: ["primaryColumns", "columnOrder"],
+ controlType: "ICON_SELECT",
+ customJSControl: "TABLE_COMPUTE_VALUE",
+ isJSConvertible: true,
+ isBindProperty: true,
+ isTriggerProperty: false,
+ validation: {
+ type: ValidationTypes.TABLE_PROPERTY,
+ params: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: ICON_NAMES,
+ },
+ },
+ },
},
{
- icon: "VERTICAL_RIGHT",
- value: "right",
+ propertyName: "saveIconAlign",
+ label: "Position",
+ helpText: "Sets the icon alignment of the save button",
+ controlType: "ICON_TABS",
+ defaultValue: "left",
+ options: [
+ {
+ icon: "VERTICAL_LEFT",
+ value: "left",
+ },
+ {
+ icon: "VERTICAL_RIGHT",
+ value: "right",
+ },
+ ],
+ isBindProperty: false,
+ isTriggerProperty: false,
+ dependencies: ["primaryColumns"],
+ validation: {
+ type: ValidationTypes.TEXT,
+ params: {
+ allowedValues: ["center", "left", "right"],
+ },
+ },
},
],
- isBindProperty: false,
- isTriggerProperty: false,
- dependencies: ["primaryColumns"],
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["center", "left", "right"],
- },
- },
},
],
};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Styles.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/TextFormatting.ts
similarity index 70%
rename from app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Styles.ts
rename to app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/TextFormatting.ts
index fcb270edb8c1..f28b9925ff75 100644
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Styles.ts
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/TextFormatting.ts
@@ -4,75 +4,14 @@ import { ColumnTypes, TableWidgetProps } from "widgets/TableWidgetV2/constants";
import { getBasePropertyPath, hideByColumnType } from "../../propertyUtils";
export default {
- sectionName: "Styles",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(
- props,
- propertyPath,
- [
- ColumnTypes.TEXT,
- ColumnTypes.DATE,
- ColumnTypes.NUMBER,
- ColumnTypes.URL,
- ColumnTypes.CHECKBOX,
- ColumnTypes.SWITCH,
- ],
- true,
- );
+ sectionName: (props: TableWidgetProps, propertyPath: string) => {
+ const columnType = get(props, `${propertyPath}.columnType`);
+ return columnType === ColumnTypes.CHECKBOX ||
+ columnType === ColumnTypes.SWITCH
+ ? "Alignment"
+ : "Text Formatting";
},
- dependencies: ["primaryColumns", "columnOrder"],
children: [
- {
- propertyName: "horizontalAlignment",
- label: (props: TableWidgetProps, propertyPath: string) => {
- const basePropertyPath = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${basePropertyPath}.columnType`);
- return columnType === ColumnTypes.CHECKBOX ||
- columnType === ColumnTypes.SWITCH
- ? "Horizontal Alignment"
- : "Text Align";
- },
- controlType: "ICON_TABS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: "LEFT",
- },
- {
- icon: "CENTER_ALIGN",
- value: "CENTER",
- },
- {
- icon: "RIGHT_ALIGN",
- value: "RIGHT",
- },
- ],
- defaultValue: "LEFT",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["LEFT", "CENTER", "RIGHT"],
- },
- },
- },
- isTriggerProperty: false,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.TEXT,
- ColumnTypes.DATE,
- ColumnTypes.NUMBER,
- ColumnTypes.URL,
- ColumnTypes.CHECKBOX,
- ColumnTypes.SWITCH,
- ]);
- },
- },
{
propertyName: "textSize",
label: "Text Size",
@@ -121,7 +60,7 @@ export default {
},
{
propertyName: "fontStyle",
- label: "Font Style",
+ label: "Emphasis",
controlType: "BUTTON_TABS",
options: [
{
@@ -158,21 +97,28 @@ export default {
},
},
{
- propertyName: "verticalAlignment",
- label: "Vertical Alignment",
+ propertyName: "horizontalAlignment",
+ label: (props: TableWidgetProps, propertyPath: string) => {
+ const basePropertyPath = getBasePropertyPath(propertyPath);
+ const columnType = get(props, `${basePropertyPath}.columnType`);
+ return columnType === ColumnTypes.CHECKBOX ||
+ columnType === ColumnTypes.SWITCH
+ ? "Horizontal Alignment"
+ : "Text Align";
+ },
controlType: "ICON_TABS",
options: [
{
- icon: "VERTICAL_TOP",
- value: "TOP",
+ icon: "LEFT_ALIGN",
+ value: "LEFT",
},
{
- icon: "VERTICAL_CENTER",
+ icon: "CENTER_ALIGN",
value: "CENTER",
},
{
- icon: "VERTICAL_BOTTOM",
- value: "BOTTOM",
+ icon: "RIGHT_ALIGN",
+ value: "RIGHT",
},
],
defaultValue: "LEFT",
@@ -185,7 +131,7 @@ export default {
params: {
type: ValidationTypes.TEXT,
params: {
- allowedValues: ["TOP", "CENTER", "BOTTOM"],
+ allowedValues: ["LEFT", "CENTER", "RIGHT"],
},
},
},
@@ -196,43 +142,30 @@ export default {
ColumnTypes.DATE,
ColumnTypes.NUMBER,
ColumnTypes.URL,
- ColumnTypes.EDIT_ACTIONS,
ColumnTypes.CHECKBOX,
ColumnTypes.SWITCH,
]);
},
},
{
- propertyName: "textColor",
- label: "Text Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
+ propertyName: "verticalAlignment",
+ label: "Vertical Alignment",
+ controlType: "ICON_TABS",
+ options: [
+ {
+ icon: "VERTICAL_TOP",
+ value: "TOP",
},
- },
- isTriggerProperty: false,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.TEXT,
- ColumnTypes.DATE,
- ColumnTypes.NUMBER,
- ColumnTypes.URL,
- ]);
- },
- },
- {
- propertyName: "cellBackground",
- label: "Cell Background",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
+ {
+ icon: "VERTICAL_CENTER",
+ value: "CENTER",
+ },
+ {
+ icon: "VERTICAL_BOTTOM",
+ value: "BOTTOM",
+ },
+ ],
+ defaultValue: "LEFT",
isJSConvertible: true,
customJSControl: "TABLE_COMPUTE_VALUE",
dependencies: ["primaryColumns", "columnOrder"],
@@ -242,7 +175,7 @@ export default {
params: {
type: ValidationTypes.TEXT,
params: {
- regex: /^(?![<|{{]).+/,
+ allowedValues: ["TOP", "CENTER", "BOTTOM"],
},
},
},
@@ -253,7 +186,6 @@ export default {
ColumnTypes.DATE,
ColumnTypes.NUMBER,
ColumnTypes.URL,
- ColumnTypes.EDIT_ACTIONS,
ColumnTypes.CHECKBOX,
ColumnTypes.SWITCH,
]);
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/index.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/index.ts
index 49d7032d51a8..3953ea180bc0 100644
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/index.ts
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/index.ts
@@ -1,29 +1,17 @@
-import { ValidationTypes } from "constants/WidgetValidation";
-import {
- ColumnTypes,
- ICON_NAMES,
- TableWidgetProps,
-} from "widgets/TableWidgetV2/constants";
-import { get } from "lodash";
-import {
- getBasePropertyPath,
- hideByColumnType,
- removeBoxShadowColorProp,
- showByColumnType,
- updateIconAlignment,
-} from "../../propertyUtils";
-
-import ColumnControl from "./ColumnControl";
-import Styles from "./Styles";
-import ButtonProperties from "./ButtonProperties";
-import MenuItems from "./MenuItems";
import Events from "./Events";
import Data from "./Data";
-import General from "./General";
+import General, { GeneralStyle } from "./General";
import Basic from "./Basic";
-import SaveButtonProperties from "./SaveButtonProperties";
-import DiscardButtonproperties from "./DiscardButtonproperties";
-import { ButtonVariantTypes } from "components/constants";
+import SaveButtonProperties, {
+ saveButtonStyleConfig,
+} from "./SaveButtonProperties";
+import DiscardButtonproperties, {
+ discardButtonStyleConfig,
+} from "./DiscardButtonproperties";
+import Icon from "./Icon";
+import TextFormatting from "./TextFormatting";
+import Color from "./Color";
+import BorderAndShadow from "./BorderAndShadow";
import Validations from "./Validation";
export default {
@@ -31,1085 +19,22 @@ export default {
titlePropertyName: "label",
panelIdPropertyName: "id",
dependencies: ["primaryColumns", "columnOrder"],
- children: [
- ColumnControl,
- Validations,
- ButtonProperties,
- SaveButtonProperties,
- DiscardButtonproperties,
- MenuItems,
- Styles,
- Events,
- ],
-
- // TODO(aswathkk): Once we remove feature flag, refactor the following configs in to separate files
contentChildren: [
Data,
Basic,
General,
Validations,
- {
- sectionName: "Save Button",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(
- props,
- propertyPath,
- [ColumnTypes.EDIT_ACTIONS],
- true,
- );
- },
- children: [
- {
- sectionName: "Label",
- collapsible: false,
- children: [
- {
- propertyName: "saveActionLabel",
- label: "Text",
- controlType: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- isTriggerProperty: false,
- },
- ],
- },
- {
- sectionName: "General",
- collapsible: false,
- children: [
- {
- propertyName: "onSave",
- label: "onSave",
- controlType: "ACTION_SELECTOR",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- const baseProperty = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${baseProperty}.columnType`, "");
- return columnType !== ColumnTypes.EDIT_ACTIONS;
- },
- dependencies: ["primaryColumns"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- propertyName: "isSaveVisible",
- dependencies: ["primaryColumns"],
- label: "Visible",
- helpText: "Controls the visibility of the save button",
- defaultValue: true,
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- },
- {
- propertyName: "isSaveDisabled",
- label: "Disabled",
- defaultValue: false,
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- dependencies: ["primaryColumns"],
- },
- ],
- },
- ],
- },
- {
- sectionName: "Discard Button",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(
- props,
- propertyPath,
- [ColumnTypes.EDIT_ACTIONS],
- true,
- );
- },
- children: [
- {
- sectionName: "Label",
- collapsible: false,
- children: [
- {
- propertyName: "discardActionLabel",
- label: "Text",
- controlType: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- isTriggerProperty: false,
- },
- ],
- },
- {
- sectionName: "General",
- collapsible: false,
- children: [
- {
- propertyName: "onDiscard",
- label: "onDiscard",
- controlType: "ACTION_SELECTOR",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- const baseProperty = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${baseProperty}.columnType`, "");
- return columnType !== ColumnTypes.EDIT_ACTIONS;
- },
- dependencies: ["primaryColumns"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- propertyName: "isDiscardVisible",
- dependencies: ["primaryColumns"],
- label: "Visible",
- helpText: "Controls the visibility of the discard button",
- defaultValue: true,
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- },
- {
- propertyName: "isDiscardDisabled",
- label: "Disabled",
- defaultValue: false,
- controlType: "SWITCH",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.BOOLEAN,
- },
- },
- dependencies: ["primaryColumns"],
- },
- ],
- },
- ],
- },
- {
- sectionName: "Events",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- if (showByColumnType(props, propertyPath, [ColumnTypes.IMAGE], true)) {
- return false;
- } else {
- const columnType = get(props, `${propertyPath}.columnType`, "");
- const isEditable = get(props, `${propertyPath}.isEditable`, "");
- return (
- !(
- columnType === ColumnTypes.TEXT ||
- columnType === ColumnTypes.NUMBER ||
- columnType === ColumnTypes.CHECKBOX ||
- columnType === ColumnTypes.SWITCH
- ) || !isEditable
- );
- }
- },
- children: [
- // Image onClick
- {
- propertyName: "onClick",
- label: "onClick",
- controlType: "ACTION_SELECTOR",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- const baseProperty = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${baseProperty}.columnType`, "");
- return columnType !== ColumnTypes.IMAGE;
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- propertyName: "onSubmit",
- label: "onSubmit",
- controlType: "ACTION_SELECTOR",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- const baseProperty = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${baseProperty}.columnType`, "");
- const isEditable = get(props, `${baseProperty}.isEditable`, "");
- return (
- !(
- columnType === ColumnTypes.TEXT ||
- columnType === ColumnTypes.NUMBER
- ) || !isEditable
- );
- },
- dependencies: ["primaryColumns", "inlineEditingSaveOption"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- propertyName: "onOptionChange",
- label: "onOptionChange",
- controlType: "ACTION_SELECTOR",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- const baseProperty = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${baseProperty}.columnType`, "");
- const isEditable = get(props, `${baseProperty}.isEditable`, "");
- return columnType !== ColumnTypes.SELECT || !isEditable;
- },
- dependencies: ["primaryColumns"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- propertyName: "onCheckChange",
- label: (props: TableWidgetProps, propertyPath: string) => {
- const basePropertyPath = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${basePropertyPath}.columnType`);
- return columnType === ColumnTypes.SWITCH
- ? "onChange"
- : "onCheckChange";
- },
- controlType: "ACTION_SELECTOR",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.CHECKBOX,
- ColumnTypes.SWITCH,
- ]);
- },
- dependencies: ["primaryColumns"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
+ SaveButtonProperties,
+ DiscardButtonproperties,
+ Events,
],
styleChildren: [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "buttonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Sets the variant",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.ICON_BUTTON,
- ColumnTypes.BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- defaultValue: ButtonVariantTypes.PRIMARY,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- default: ButtonVariantTypes.PRIMARY,
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- },
- },
- },
- },
- {
- propertyName: "menuVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- customJSControl: "TABLE_COMPUTE_VALUE",
- helpText: "Sets the variant of the menu button",
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- isJSConvertible: true,
- dependencies: ["primaryColumns", "columnOrder"],
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.MENU_BUTTON,
- ]);
- },
- isBindProperty: true,
- isTriggerProperty: false,
- defaultValue: ButtonVariantTypes.PRIMARY,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- default: ButtonVariantTypes.PRIMARY,
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- },
- },
- },
- },
- ],
- },
- {
- sectionName: "Icon",
- children: [
- {
- propertyName: "menuButtoniconName",
- label: "Icon",
- helpText: "Sets the icon to be used for the menu button",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.MENU_BUTTON,
- ]);
- },
- updateHook: updateIconAlignment,
- dependencies: ["primaryColumns", "columnOrder"],
- controlType: "ICON_SELECT",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
- },
- },
- },
- },
- {
- propertyName: "iconAlign",
- label: "Position",
- helpText: "Sets the icon alignment of the menu button",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.MENU_BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["center", "left", "right"],
- },
- },
- },
- ],
- },
- {
- sectionName: (props: TableWidgetProps, propertyPath: string) => {
- const columnType = get(props, `${propertyPath}.columnType`);
- return columnType === ColumnTypes.CHECKBOX ||
- columnType === ColumnTypes.SWITCH
- ? "Alignment"
- : "Text Formatting";
- },
- children: [
- {
- propertyName: "textSize",
- label: "Text Size",
- controlType: "DROP_DOWN",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- ],
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- },
- },
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.TEXT,
- ColumnTypes.DATE,
- ColumnTypes.NUMBER,
- ColumnTypes.URL,
- ]);
- },
- },
- {
- propertyName: "fontStyle",
- label: "Emphasis",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- {
- icon: "UNDERLINE",
- value: "UNDERLINE",
- },
- ],
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- },
- },
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.TEXT,
- ColumnTypes.DATE,
- ColumnTypes.NUMBER,
- ColumnTypes.URL,
- ]);
- },
- },
- {
- propertyName: "horizontalAlignment",
- label: (props: TableWidgetProps, propertyPath: string) => {
- const basePropertyPath = getBasePropertyPath(propertyPath);
- const columnType = get(props, `${basePropertyPath}.columnType`);
- return columnType === ColumnTypes.CHECKBOX ||
- columnType === ColumnTypes.SWITCH
- ? "Horizontal Alignment"
- : "Text Align";
- },
- controlType: "ICON_TABS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: "LEFT",
- },
- {
- icon: "CENTER_ALIGN",
- value: "CENTER",
- },
- {
- icon: "RIGHT_ALIGN",
- value: "RIGHT",
- },
- ],
- defaultValue: "LEFT",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["LEFT", "CENTER", "RIGHT"],
- },
- },
- },
- isTriggerProperty: false,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.TEXT,
- ColumnTypes.DATE,
- ColumnTypes.NUMBER,
- ColumnTypes.URL,
- ColumnTypes.CHECKBOX,
- ColumnTypes.SWITCH,
- ]);
- },
- },
- {
- propertyName: "verticalAlignment",
- label: "Vertical Alignment",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "VERTICAL_TOP",
- value: "TOP",
- },
- {
- icon: "VERTICAL_CENTER",
- value: "CENTER",
- },
- {
- icon: "VERTICAL_BOTTOM",
- value: "BOTTOM",
- },
- ],
- defaultValue: "LEFT",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["TOP", "CENTER", "BOTTOM"],
- },
- },
- },
- isTriggerProperty: false,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.TEXT,
- ColumnTypes.DATE,
- ColumnTypes.NUMBER,
- ColumnTypes.URL,
- ColumnTypes.CHECKBOX,
- ColumnTypes.SWITCH,
- ]);
- },
- },
- ],
- },
- {
- sectionName: "Color",
- children: [
- {
- propertyName: "buttonColor",
- label: "Button Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- helpText: "Changes the color of the button",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.BUTTON,
- ColumnTypes.ICON_BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- isTriggerProperty: false,
- },
- {
- propertyName: "menuColor",
- helpText:
- "Sets the custom color preset based on the menu button variant",
- label: "Button Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.MENU_BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder", "childStylesheet"],
- },
- {
- propertyName: "cellBackground",
- label: "Cell Background",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- isTriggerProperty: false,
- },
- {
- propertyName: "textColor",
- label: "Text Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- isTriggerProperty: false,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.TEXT,
- ColumnTypes.DATE,
- ColumnTypes.NUMBER,
- ColumnTypes.URL,
- ]);
- },
- },
- ],
- },
- {
- sectionName: "Save Button",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(
- props,
- propertyPath,
- [ColumnTypes.EDIT_ACTIONS],
- true,
- );
- },
- children: [
- {
- sectionName: "General",
- collapsible: false,
- children: [
- {
- propertyName: "saveButtonColor",
- label: "Button Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- helpText: "Changes the color of the button",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- isTriggerProperty: false,
- },
- {
- propertyName: "saveButtonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Sets the variant of the save button",
- dependencies: ["primaryColumns"],
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- defaultValue: ButtonVariantTypes.PRIMARY,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- default: ButtonVariantTypes.PRIMARY,
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- },
- },
- },
- },
- {
- propertyName: "saveBorderRadius",
- label: "Border Radius",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText:
- "Rounds the corners of the save button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- },
- },
- },
- ],
- },
- {
- sectionName: "Icon",
- collapsible: false,
- children: [
- {
- propertyName: "saveActionIconName",
- label: "Icon",
- helpText: "Sets the icon to be used for the save action button",
- dependencies: ["primaryColumns", "columnOrder"],
- controlType: "ICON_SELECT",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
- },
- },
- },
- },
- {
- propertyName: "saveIconAlign",
- label: "Position",
- helpText: "Sets the icon alignment of the save button",
- controlType: "ICON_TABS",
- defaultValue: "left",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- dependencies: ["primaryColumns"],
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["center", "left", "right"],
- },
- },
- },
- ],
- },
- ],
- },
- {
- sectionName: "Discard Button",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(
- props,
- propertyPath,
- [ColumnTypes.EDIT_ACTIONS],
- true,
- );
- },
- children: [
- {
- sectionName: "General",
- collapsible: false,
- children: [
- {
- propertyName: "discardButtonColor",
- label: "Button Color",
- controlType: "PRIMARY_COLUMNS_COLOR_PICKER_V2",
- helpText: "Changes the color of the button",
- isJSConvertible: true,
- customJSControl: "TABLE_COMPUTE_VALUE",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- isTriggerProperty: false,
- },
- {
- propertyName: "discardButtonVariant",
- label: "Button Variant",
- controlType: "DROP_DOWN",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Sets the variant of the discard button",
- dependencies: ["primaryColumns"],
- options: [
- {
- label: "Primary",
- value: ButtonVariantTypes.PRIMARY,
- },
- {
- label: "Secondary",
- value: ButtonVariantTypes.SECONDARY,
- },
- {
- label: "Tertiary",
- value: ButtonVariantTypes.TERTIARY,
- },
- ],
- defaultValue: ButtonVariantTypes.PRIMARY,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- default: ButtonVariantTypes.PRIMARY,
- allowedValues: [
- ButtonVariantTypes.PRIMARY,
- ButtonVariantTypes.SECONDARY,
- ButtonVariantTypes.TERTIARY,
- ],
- },
- },
- },
- },
- {
- propertyName: "discardBorderRadius",
- label: "Border Radius",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText:
- "Rounds the corners of the discard button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- dependencies: ["primaryColumns"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- },
- },
- },
- ],
- },
- {
- sectionName: "Icon",
- collapsible: false,
- children: [
- {
- propertyName: "discardActionIconName",
- label: "Icon",
- helpText:
- "Sets the icon to be used for the discard action button",
- dependencies: ["primaryColumns", "columnOrder"],
- controlType: "ICON_SELECT",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ICON_NAMES,
- },
- },
- },
- },
- {
- propertyName: "discardIconAlign",
- label: "Position",
- helpText: "Sets the icon alignment of the discard button",
- controlType: "ICON_TABS",
- defaultValue: "left",
- options: [
- {
- icon: "VERTICAL_LEFT",
- value: "left",
- },
- {
- icon: "VERTICAL_RIGHT",
- value: "right",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- dependencies: ["primaryColumns"],
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- allowedValues: ["left", "right"],
- },
- },
- },
- ],
- },
- ],
- },
- {
- sectionName: "Border and Shadow",
- children: [
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.ICON_BUTTON,
- ColumnTypes.MENU_BUTTON,
- ColumnTypes.BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- },
- },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- customJSControl: "TABLE_COMPUTE_VALUE",
- isJSConvertible: true,
- updateHook: removeBoxShadowColorProp,
- hidden: (props: TableWidgetProps, propertyPath: string) => {
- return hideByColumnType(props, propertyPath, [
- ColumnTypes.ICON_BUTTON,
- ColumnTypes.MENU_BUTTON,
- ColumnTypes.BUTTON,
- ]);
- },
- dependencies: ["primaryColumns", "columnOrder"],
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TABLE_PROPERTY,
- params: {
- type: ValidationTypes.TEXT,
- },
- },
- },
- ],
- },
+ GeneralStyle,
+ Icon,
+ TextFormatting,
+ Color,
+ saveButtonStyleConfig,
+ discardButtonStyleConfig,
+ BorderAndShadow,
],
};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/Styles.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/Styles.ts
deleted file mode 100644
index be16a18a4281..000000000000
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/Styles.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-import { ValidationTypes } from "constants/WidgetValidation";
-import { updateColumnStyles } from "../propertyUtils";
-
-export default {
- sectionName: "Styles",
- children: [
- {
- propertyName: "cellBackground",
- label: "Cell Background Color",
- controlType: "COLOR_PICKER",
- updateHook: updateColumnStyles,
- dependencies: ["primaryColumns"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "accentColor",
- label: "Accent Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- invisible: true,
- },
- {
- propertyName: "textColor",
- label: "Text Color",
- controlType: "COLOR_PICKER",
- updateHook: updateColumnStyles,
- dependencies: ["primaryColumns"],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "textSize",
- label: "Text Size",
- controlType: "DROP_DOWN",
- updateHook: updateColumnStyles,
- dependencies: ["primaryColumns"],
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "fontStyle",
- label: "Font Style",
- controlType: "BUTTON_TABS",
- updateHook: updateColumnStyles,
- dependencies: ["primaryColumns"],
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "horizontalAlignment",
- label: "Text Align",
- controlType: "ICON_TABS",
- updateHook: updateColumnStyles,
- dependencies: ["primaryColumns"],
- options: [
- {
- icon: "LEFT_ALIGN",
- value: "LEFT",
- },
- {
- icon: "CENTER_ALIGN",
- value: "CENTER",
- },
- {
- icon: "RIGHT_ALIGN",
- value: "RIGHT",
- },
- ],
- defaultValue: "LEFT",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "verticalAlignment",
- label: "Vertical Alignment",
- controlType: "ICON_TABS",
- updateHook: updateColumnStyles,
- dependencies: ["primaryColumns"],
- options: [
- {
- icon: "VERTICAL_TOP",
- value: "TOP",
- },
- {
- icon: "VERTICAL_CENTER",
- value: "CENTER",
- },
- {
- icon: "VERTICAL_BOTTOM",
- value: "BOTTOM",
- },
- ],
- defaultValue: "LEFT",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText: "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
-};
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/index.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/index.ts
deleted file mode 100644
index 1716a8aba8af..000000000000
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { PropertyPaneConfig } from "constants/PropertyControlConstants";
-import General from "./General";
-import Events from "./Events";
-import HeaderOptions from "./HeaderOptions";
-import Styles from "./Styles";
-
-export default [General, Events, HeaderOptions, Styles] as PropertyPaneConfig[];
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/styleConfig.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/styleConfig.ts
index 7d1e6cdf471e..f5debcd846e7 100644
--- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/styleConfig.ts
+++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/styleConfig.ts
@@ -140,7 +140,7 @@ export default [
],
defaultValue: "CENTER",
isJSConvertible: true,
- isBindProperty: false,
+ isBindProperty: true,
isTriggerProperty: false,
validation: {
type: ValidationTypes.TEXT,
diff --git a/app/client/src/widgets/TabsWidget/widget/index.tsx b/app/client/src/widgets/TabsWidget/widget/index.tsx
index a7fdad741d36..7286b1285f66 100644
--- a/app/client/src/widgets/TabsWidget/widget/index.tsx
+++ b/app/client/src/widgets/TabsWidget/widget/index.tsx
@@ -33,186 +33,6 @@ class TabsWidget extends BaseWidget<
TabsWidgetProps<TabContainerWidgetProps>,
WidgetState
> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "tabsObj",
- isJSConvertible: false,
- label: "Tabs",
- controlType: "TABS_INPUT",
- isBindProperty: false,
- isTriggerProperty: false,
- updateRelatedWidgetProperties: (
- propertyPath: string,
- propertyValue: string,
- props: WidgetProperties,
- ) => {
- const propertyPathSplit = propertyPath.split(".");
- const property = propertyPathSplit.pop();
- if (property === "label") {
- const itemId = propertyPathSplit.pop() || "";
- const item = props.tabsObj[itemId];
- if (item) {
- return [
- {
- widgetId: item.widgetId,
- updates: {
- modify: {
- tabName: propertyValue,
- },
- },
- },
- ];
- }
- }
- return [];
- },
- panelConfig: {
- editableTitle: true,
- titlePropertyName: "label",
- panelIdPropertyName: "id",
- updateHook: (
- props: any,
- propertyPath: string,
- propertyValue: string,
- ) => {
- return [
- {
- propertyPath,
- propertyValue,
- },
- ];
- },
- children: [
- {
- sectionName: "Tab Control",
- children: [
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the tab",
- controlType: "SWITCH",
- useValidationMessage: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- ],
- },
- },
- {
- propertyName: "defaultTab",
- helpText: "Selects a tab name specified by default",
- placeholderText: "Tab 1",
- label: "Default Tab",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.FUNCTION,
- params: {
- fn: selectedTabValidation,
- expected: {
- type: "Tab Name (string)",
- example: "Tab 1",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- dependencies: ["tabsObj", "tabs"],
- },
- {
- propertyName: "shouldShowTabs",
- helpText:
- "Hides the tabs so that different widgets can be displayed based on the default tab",
- label: "Show Tabs",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- helpText: "Enables scrolling for content inside the widget",
- propertyName: "shouldScrollContents",
- label: "Scroll Contents",
- controlType: "SWITCH",
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "isVisible",
- label: "Visible",
- helpText: "Controls the visibility of the widget",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the button is clicked",
- propertyName: "onTabSelected",
- label: "onTabSelected",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
-
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
-
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/TextWidget/widget/index.tsx b/app/client/src/widgets/TextWidget/widget/index.tsx
index f3784052ad24..42adac39fa34 100644
--- a/app/client/src/widgets/TextWidget/widget/index.tsx
+++ b/app/client/src/widgets/TextWidget/widget/index.tsx
@@ -17,301 +17,6 @@ import { pick } from "lodash";
const MAX_HTML_PARSING_LENGTH = 1000;
class TextWidget extends BaseWidget<TextWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "text",
- helpText: "Sets the text of the widget",
- label: "Text",
- controlType: "INPUT_TEXT",
- placeholderText: "Name:",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: { limitLineBreaks: true },
- },
- },
- {
- propertyName: "overflow",
- label: "Overflow",
- helpText: "Controls the text behavior when length of text exceeds",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "Scroll contents",
- value: OverflowTypes.SCROLL,
- },
- {
- label: "Truncate text",
- value: OverflowTypes.TRUNCATE,
- },
- {
- label: "No overflow",
- value: OverflowTypes.NONE,
- },
- ],
- defaultValue: OverflowTypes.NONE,
- isBindProperty: false,
- isTriggerProperty: false,
- },
- {
- propertyName: "isVisible",
- helpText: "Controls the visibility of the widget",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "disableLink",
- helpText: "Controls parsing text as Link",
- label: "Disable Link",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "backgroundColor",
- label: "Cell Background Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^((?![<|{{]).+){0,1}/,
- expected: {
- type: "string (HTML color name or HEX value)",
- example: `red | #9C0D38`,
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- propertyName: "textColor",
- label: "Text Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- },
- {
- propertyName: "truncateButtonColor",
- label: "Truncate Button Color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /^(?![<|{{]).+/,
- },
- },
- dependencies: ["overflow"],
- hidden: (props: TextWidgetProps) => {
- return props.overflow !== OverflowTypes.TRUNCATE;
- },
- },
- {
- helpText: "Use a html color name, HEX, RGB or RGBA value",
- placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)",
- propertyName: "borderColor",
- label: "Border Color",
- controlType: "COLOR_PICKER",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- helpText:
- "Enter value for border width which can also use as margin",
- propertyName: "borderWidth",
- label: "Border Width",
- placeholderText: "Enter value in px",
- controlType: "INPUT_TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.NUMBER },
- },
- {
- propertyName: "fontSize",
- label: "Text Size",
- controlType: "DROP_DOWN",
- defaultValue: "1rem",
- options: [
- {
- label: "S",
- value: "0.875rem",
- subText: "0.875rem",
- },
- {
- label: "M",
- value: "1rem",
- subText: "1rem",
- },
- {
- label: "L",
- value: "1.25rem",
- subText: "1.25rem",
- },
- {
- label: "XL",
- value: "1.875rem",
- subText: "1.875rem",
- },
- {
- label: "XXL",
- value: "3rem",
- subText: "3rem",
- },
- {
- label: "3XL",
- value: "3.75rem",
- subText: "3.75rem",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: "fontFamily",
- label: "Font Family",
- controlType: "DROP_DOWN",
- options: [
- {
- label: "System Default",
- value: "System Default",
- },
- {
- label: "Nunito Sans",
- value: "Nunito Sans",
- },
- {
- label: "Poppins",
- value: "Poppins",
- },
- {
- label: "Inter",
- value: "Inter",
- },
- {
- label: "Montserrat",
- value: "Montserrat",
- },
- {
- label: "Noto Sans",
- value: "Noto Sans",
- },
- {
- label: "Open Sans",
- value: "Open Sans",
- },
- {
- label: "Roboto",
- value: "Roboto",
- },
- {
- label: "Rubik",
- value: "Rubik",
- },
- {
- label: "Ubuntu",
- value: "Ubuntu",
- },
- ],
- defaultValue: "System Default",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- },
- },
- {
- propertyName: "fontStyle",
- label: "Font Style",
- controlType: "BUTTON_TABS",
- options: [
- {
- icon: "BOLD_FONT",
- value: "BOLD",
- },
- {
- icon: "ITALICS_FONT",
- value: "ITALIC",
- },
- ],
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "textAlign",
- label: "Text Align",
- controlType: "ICON_TABS",
- options: [
- {
- icon: "LEFT_ALIGN",
- value: "LEFT",
- },
- {
- icon: "CENTER_ALIGN",
- value: "CENTER",
- },
- {
- icon: "RIGHT_ALIGN",
- value: "RIGHT",
- },
- ],
- defaultValue: "LEFT",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/client/src/widgets/VideoWidget/widget/index.tsx b/app/client/src/widgets/VideoWidget/widget/index.tsx
index ca2b8490d0f8..bcd66ced6d9f 100644
--- a/app/client/src/widgets/VideoWidget/widget/index.tsx
+++ b/app/client/src/widgets/VideoWidget/widget/index.tsx
@@ -19,137 +19,6 @@ export enum PlayState {
}
class VideoWidget extends BaseWidget<VideoWidgetProps, WidgetState> {
- static getPropertyPaneConfig() {
- return [
- {
- sectionName: "General",
- children: [
- {
- propertyName: "url",
- label: "URL",
- controlType: "INPUT_TEXT",
- placeholderText: "Enter URL",
- inputType: "TEXT",
- isBindProperty: true,
- isTriggerProperty: false,
- validation: {
- type: ValidationTypes.TEXT,
- params: {
- regex: /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/,
- expected: {
- type: "Video URL",
- example: "https://assets.appsmith.com/widgets/bird.mp4",
- autocompleteDataType: AutocompleteDataType.STRING,
- },
- },
- },
- },
- {
- propertyName: "autoPlay",
- label: "Auto Play",
- helpText:
- "Video will be automatically played, by enabling this feature, video will be muted by default.",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- helpText: "Controls the visibility of the widget",
- propertyName: "isVisible",
- label: "Visible",
- controlType: "SWITCH",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- {
- propertyName: "animateLoading",
- label: "Animate Loading",
- controlType: "SWITCH",
- helpText: "Controls the loading of the widget",
- defaultValue: true,
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.BOOLEAN },
- },
- ],
- },
- {
- sectionName: "Events",
- children: [
- {
- helpText: "Triggers an action when the video is played",
- propertyName: "onPlay",
- label: "onPlay",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the video is paused",
- propertyName: "onPause",
- label: "onPause",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- {
- helpText: "Triggers an action when the video ends",
- propertyName: "onEnd",
- label: "onEnd",
- controlType: "ACTION_SELECTOR",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: true,
- },
- ],
- },
- {
- sectionName: "Styles",
- children: [
- {
- propertyName: "backgroundColor",
- helpText: "Sets the background color of the widget",
- label: "Background color",
- controlType: "COLOR_PICKER",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "borderRadius",
- label: "Border Radius",
- helpText:
- "Rounds the corners of the icon button's outer border edge",
- controlType: "BORDER_RADIUS_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- {
- propertyName: "boxShadow",
- label: "Box Shadow",
- helpText:
- "Enables you to cast a drop shadow from the frame of the widget",
- controlType: "BOX_SHADOW_OPTIONS",
- isJSConvertible: true,
- isBindProperty: true,
- isTriggerProperty: false,
- validation: { type: ValidationTypes.TEXT },
- },
- ],
- },
- ];
- }
-
static getPropertyPaneContentConfig() {
return [
{
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/featureflags/FeatureFlagEnum.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/featureflags/FeatureFlagEnum.java
index 035caf33e757..224efbeb1e74 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/featureflags/FeatureFlagEnum.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/featureflags/FeatureFlagEnum.java
@@ -30,6 +30,5 @@ public enum FeatureFlagEnum {
GIT,
GIT_IMPORT,
APP_TEMPLATE,
- PROPERTY_PANE_GROUPING,
TEMPLATES_PHASE_2
}
diff --git a/app/server/appsmith-server/src/main/resources/features/init-flags.yml b/app/server/appsmith-server/src/main/resources/features/init-flags.yml
index ac632f544e59..65d721bae2a2 100644
--- a/app/server/appsmith-server/src/main/resources/features/init-flags.yml
+++ b/app/server/appsmith-server/src/main/resources/features/init-flags.yml
@@ -62,15 +62,6 @@ ff4j:
- name: weight
value: 1
- - uid: PROPERTY_PANE_GROUPING
- enable: true
- description: Group the properties into content & style tab also adds search option in property pane
- flipstrategy:
- class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy
- param:
- - name: emails
- value: [email protected]
-
- uid: TEMPLATES_PHASE_2
enable: true
description: Allow importing particular pages from templates in existing apps
|
dc7582f35b980ebd4690e8354f661cde6c10660c
|
2023-01-10 10:04:55
|
arunvjn
|
fix: Remove sentry logging for errors with no types (#19515)
| false
|
Remove sentry logging for errors with no types (#19515)
|
fix
|
diff --git a/app/client/src/sagas/PostEvaluationSagas.ts b/app/client/src/sagas/PostEvaluationSagas.ts
index 88aace254cd1..b6d2d55c552a 100644
--- a/app/client/src/sagas/PostEvaluationSagas.ts
+++ b/app/client/src/sagas/PostEvaluationSagas.ts
@@ -277,7 +277,6 @@ export function* evalErrorHandler(
break;
}
default: {
- Sentry.captureException(error);
log.debug(error);
}
}
|
9ce2598e76b5d360dfcb8b1d33c7ad3f661a7a8f
|
2025-01-05 15:51:23
|
Rudraprasad Das
|
chore: git mod - integration with applications (#38439)
| false
|
git mod - integration with applications (#38439)
|
chore
|
diff --git a/app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx b/app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx
index 47e819cb8aae..30170ae254ec 100644
--- a/app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx
+++ b/app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx
@@ -1103,6 +1103,10 @@ const ContentTypeRaw = importSvg(
async () => import("../__assets__/icons/ads/content-type-raw.svg"),
);
+const CloudIconV2 = importSvg(
+ async () => import("../__assets__/icons/ads/cloudy-line.svg"),
+);
+
const NotionIcon = importSvg(
async () => import("../__assets__/icons/ads/notion.svg"),
);
@@ -1225,6 +1229,7 @@ const ICON_LOOKUP = {
"close-modal": CloseLineIcon,
"close-x": CloseLineIcon,
"cloud-off-line": CloudOfflineIcon,
+ "cloud-v2": CloudIconV2,
"collapse-control": CollapseIcon,
"column-freeze": ColumnFreeze,
"column-unfreeze": SubtractIcon,
diff --git a/app/client/src/api/interceptors/request/apiRequestInterceptor.ts b/app/client/src/api/interceptors/request/apiRequestInterceptor.ts
index 5371cbbcf23c..4a9d2ed633cc 100644
--- a/app/client/src/api/interceptors/request/apiRequestInterceptor.ts
+++ b/app/client/src/api/interceptors/request/apiRequestInterceptor.ts
@@ -30,6 +30,7 @@ const blockAirgappedRoutes = (config: InternalAxiosRequestConfig) => {
const addGitBranchHeader = (config: InternalAxiosRequestConfig) => {
const state = store.getState();
+ // ! git mod - not sure how to replace this, we could directly read state if required
const branch = getCurrentGitBranch(state) || getQueryParamsObject().branch;
return _addGitBranchHeader(config, { branch });
diff --git a/app/client/src/ce/entities/FeatureFlag.ts b/app/client/src/ce/entities/FeatureFlag.ts
index d3048a86f9f1..4e3020fd98e2 100644
--- a/app/client/src/ce/entities/FeatureFlag.ts
+++ b/app/client/src/ce/entities/FeatureFlag.ts
@@ -48,6 +48,7 @@ export const FEATURE_FLAG = {
"release_table_html_column_type_enabled",
release_gs_all_sheets_options_enabled:
"release_gs_all_sheets_options_enabled",
+ release_git_modularisation_enabled: "release_git_modularisation_enabled",
ab_premium_datasources_view_enabled: "ab_premium_datasources_view_enabled",
kill_session_recordings_enabled: "kill_session_recordings_enabled",
config_mask_session_recordings_enabled:
@@ -95,6 +96,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
release_evaluation_scope_cache: false,
release_table_html_column_type_enabled: false,
release_gs_all_sheets_options_enabled: false,
+ release_git_modularisation_enabled: false,
ab_premium_datasources_view_enabled: false,
kill_session_recordings_enabled: false,
config_user_session_recordings_enabled: true,
diff --git a/app/client/src/ce/navigation/FocusStrategy/AppIDEFocusStrategy.ts b/app/client/src/ce/navigation/FocusStrategy/AppIDEFocusStrategy.ts
index 5729a7e8c59d..fe5440f22f27 100644
--- a/app/client/src/ce/navigation/FocusStrategy/AppIDEFocusStrategy.ts
+++ b/app/client/src/ce/navigation/FocusStrategy/AppIDEFocusStrategy.ts
@@ -2,7 +2,6 @@ import { all, select, take } from "redux-saga/effects";
import type { FocusPath, FocusStrategy } from "sagas/FocusRetentionSaga";
import type { AppsmithLocationState } from "utils/history";
import { NavigationMethod } from "utils/history";
-import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import type { FocusEntityInfo } from "navigation/FocusEntity";
import {
FocusEntity,
@@ -18,6 +17,7 @@ import {
widgetListURL,
} from "ee/RouteBuilder";
import AppIDEFocusElements from "../FocusElements/AppIDE";
+import { selectGitApplicationCurrentBranch } from "selectors/gitModSelectors";
function shouldSetState(
prevPath: string,
@@ -86,8 +86,17 @@ const isPageChange = (prevPath: string, currentPath: string) => {
);
};
-export const createEditorFocusInfoKey = (basePageId: string, branch?: string) =>
- `EDITOR_STATE.${basePageId}#${branch}`;
+export const createEditorFocusInfoKey = (
+ basePageId: string,
+ branch: string | null = null,
+) => {
+ const r = branch
+ ? `EDITOR_STATE.${basePageId}#${branch}`
+ : `EDITOR_STATE.${basePageId}`;
+
+ return r;
+};
+
export const createEditorFocusInfo = (basePageId: string, branch?: string) => ({
key: createEditorFocusInfoKey(basePageId, branch),
entityInfo: {
@@ -109,7 +118,9 @@ export const AppIDEFocusStrategy: FocusStrategy = {
return [];
}
- const branch: string | undefined = yield select(getCurrentGitBranch);
+ const branch: string | undefined = yield select(
+ selectGitApplicationCurrentBranch,
+ );
const entities: Array<{ entityInfo: FocusEntityInfo; key: string }> = [];
const prevEntityInfo = identifyEntityFromPath(previousPath);
const currentEntityInfo = identifyEntityFromPath(currentPath);
@@ -136,7 +147,9 @@ export const AppIDEFocusStrategy: FocusStrategy = {
return entities;
},
*getEntitiesForStore(path: string, currentPath: string) {
- const branch: string | undefined = yield select(getCurrentGitBranch);
+ const branch: string | undefined = yield select(
+ selectGitApplicationCurrentBranch,
+ );
const entities: Array<FocusPath> = [];
const currentFocusEntityInfo = identifyEntityFromPath(currentPath);
const prevFocusEntityInfo = identifyEntityFromPath(path);
@@ -179,7 +192,9 @@ export const AppIDEFocusStrategy: FocusStrategy = {
appState: EditorState.EDITOR,
params: prevFocusEntityInfo.params,
},
- key: `EDITOR_STATE.${prevFocusEntityInfo.params.basePageId}#${branch}`,
+ key: branch
+ ? `EDITOR_STATE.${prevFocusEntityInfo.params.basePageId}#${branch}`
+ : `EDITOR_STATE.${prevFocusEntityInfo.params.basePageId}`,
});
}
diff --git a/app/client/src/ce/pages/Applications/CreateNewAppsOption.test.tsx b/app/client/src/ce/pages/Applications/CreateNewAppsOption.test.tsx
index 180268afb6a9..06940dc36fcc 100644
--- a/app/client/src/ce/pages/Applications/CreateNewAppsOption.test.tsx
+++ b/app/client/src/ce/pages/Applications/CreateNewAppsOption.test.tsx
@@ -9,6 +9,10 @@ import CreateNewAppsOption from "./CreateNewAppsOption";
import { BrowserRouter as Router } from "react-router-dom";
import { unitTestBaseMockStore } from "layoutSystems/common/dropTarget/unitTestUtils";
+jest.mock("selectors/gitModSelectors", () => ({
+ selectCombinedPreviewMode: jest.fn(() => false),
+}));
+
const defaultStoreState = {
...unitTestBaseMockStore,
tenant: {
diff --git a/app/client/src/ce/pages/Applications/index.tsx b/app/client/src/ce/pages/Applications/index.tsx
index edd2b60af280..19b45abd74e1 100644
--- a/app/client/src/ce/pages/Applications/index.tsx
+++ b/app/client/src/ce/pages/Applications/index.tsx
@@ -122,7 +122,6 @@ import { MOBILE_MAX_WIDTH } from "constants/AppConstants";
import { Indices } from "constants/Layers";
import ImportModal from "pages/common/ImportModal";
import SharedUserList from "pages/common/SharedUserList";
-import GitSyncModal from "pages/Editor/gitSync/GitSyncModal";
import ReconnectDatasourceModal from "pages/Editor/gitSync/ReconnectDatasourceModal";
import RepoLimitExceededErrorModal from "pages/Editor/gitSync/RepoLimitExceededErrorModal";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
@@ -133,6 +132,15 @@ import { getAssetUrl } from "ee/utils/airgapHelpers";
import { ASSETS_CDN_URL } from "constants/ThirdPartyConstants";
import { LayoutSystemTypes } from "layoutSystems/types";
import { getIsAnvilLayoutEnabled } from "layoutSystems/anvil/integrations/selectors";
+import OldGitSyncModal from "pages/Editor/gitSync/GitSyncModal";
+import { useGitModEnabled } from "pages/Editor/gitSync/hooks/modHooks";
+import { GitImportModal as NewGitImportModal } from "git";
+
+function GitImportModal() {
+ const isGitModEnabled = useGitModEnabled();
+
+ return isGitModEnabled ? <NewGitImportModal /> : <OldGitSyncModal isImport />;
+}
export const { cloudHosting } = getAppsmithConfigs();
@@ -955,7 +963,7 @@ export function ApplicationsSection(props: any) {
isMobile={isMobile}
>
{workspacesListComponent}
- <GitSyncModal isImport />
+ <GitImportModal />
<ReconnectDatasourceModal />
</ApplicationContainer>
);
diff --git a/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx b/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx
index cac3ae6f84a8..8f16afc63327 100644
--- a/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx
+++ b/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx
@@ -34,12 +34,12 @@ import DataSourceEditor from "pages/Editor/DataSourceEditor";
import DatasourceBlankState from "pages/Editor/DataSourceEditor/DatasourceBlankState";
import type { RouteProps } from "react-router";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
import { lazy, Suspense } from "react";
import React from "react";
import { retryPromise } from "utils/AppsmithUtils";
import Skeleton from "widgets/Skeleton";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
const FirstTimeUserOnboardingChecklist = lazy(async () =>
retryPromise(
@@ -67,7 +67,7 @@ export interface RouteReturnType extends RouteProps {
*/
function useRoutes(path: string): RouteReturnType[] {
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
return [
{
diff --git a/app/client/src/ce/reducers/index.tsx b/app/client/src/ce/reducers/index.tsx
index f6bb8801940e..73842c65b5df 100644
--- a/app/client/src/ce/reducers/index.tsx
+++ b/app/client/src/ce/reducers/index.tsx
@@ -77,6 +77,8 @@ import type { ActiveField } from "reducers/uiReducers/activeFieldEditorReducer";
import type { SelectedWorkspaceReduxState } from "ee/reducers/uiReducers/selectedWorkspaceReducer";
import type { ConsolidatedPageLoadState } from "reducers/uiReducers/consolidatedPageLoadReducer";
import type { BuildingBlocksReduxState } from "reducers/uiReducers/buildingBlockReducer";
+import type { GitArtifactRootReduxState, GitGlobalReduxState } from "git";
+import { gitReducer } from "git/store";
export const reducerObject = {
entities: entityReducer,
@@ -86,6 +88,7 @@ export const reducerObject = {
settings: SettingsReducer,
tenant: tenantReducer,
linting: lintErrorReducer,
+ git: gitReducer,
};
export interface AppState {
@@ -176,4 +179,8 @@ export interface AppState {
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tenant: TenantReduxState<any>;
+ git: {
+ global: GitGlobalReduxState;
+ artifacts: GitArtifactRootReduxState;
+ };
}
diff --git a/app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx b/app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx
index dd2f5b5c4060..97830da22ff3 100644
--- a/app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx
+++ b/app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx
@@ -25,6 +25,8 @@ import {
import produce from "immer";
import { isEmpty } from "lodash";
import type { ApplicationPayload } from "entities/Application";
+import { gitConnectSuccess, type GitConnectSuccessPayload } from "git";
+import type { PayloadAction } from "@reduxjs/toolkit";
export const initialState: ApplicationsReduxState = {
isSavingAppName: false,
@@ -744,6 +746,20 @@ export const handlers = {
isSavingNavigationSetting: false,
};
},
+ // git
+ [gitConnectSuccess.type]: (
+ state: ApplicationsReduxState,
+ action: PayloadAction<GitConnectSuccessPayload>,
+ ) => {
+ return {
+ ...state,
+ currentApplication: {
+ ...state.currentApplication,
+ gitApplicationMetadata:
+ action.payload.responseData.gitApplicationMetadata,
+ },
+ };
+ },
};
const applicationsReducer = createReducer(initialState, handlers);
diff --git a/app/client/src/ce/sagas/PageSagas.tsx b/app/client/src/ce/sagas/PageSagas.tsx
index d1c8e1e86837..aad81e9f8720 100644
--- a/app/client/src/ce/sagas/PageSagas.tsx
+++ b/app/client/src/ce/sagas/PageSagas.tsx
@@ -75,7 +75,6 @@ import {
import { IncorrectBindingError, validateResponse } from "sagas/ErrorSagas";
import type { ApiResponse } from "api/ApiResponses";
import {
- combinedPreviewModeSelector,
getCurrentApplicationId,
getCurrentLayoutId,
getCurrentPageId,
@@ -128,7 +127,6 @@ import { getPageList } from "ee/selectors/entitiesSelector";
import { setPreviewModeAction } from "actions/editorActions";
import { SelectionRequestType } from "sagas/WidgetSelectUtils";
import { toast } from "@appsmith/ads";
-import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import type { MainCanvasReduxState } from "reducers/uiReducers/mainCanvasReducer";
import { UserCancelledActionExecutionError } from "sagas/ActionExecution/errorUtils";
import { getInstanceId } from "ee/selectors/tenantSelectors";
@@ -150,6 +148,10 @@ import { getIsAnvilLayout } from "layoutSystems/anvil/integrations/selectors";
import { convertToBasePageIdSelector } from "selectors/pageListSelectors";
import type { Page } from "entities/Page";
import { ConsolidatedPageLoadApi } from "api";
+import {
+ selectCombinedPreviewMode,
+ selectGitApplicationCurrentBranch,
+} from "selectors/gitModSelectors";
export const checkIfMigrationIsNeeded = (
fetchPageResponse?: FetchPageResponse,
@@ -172,7 +174,9 @@ export function* refreshTheApp() {
const currentPageId: string = yield select(getCurrentPageId);
const defaultBasePageId: string = yield select(getDefaultBasePageId);
const pagesList: Page[] = yield select(getPageList);
- const gitBranch: string = yield select(getCurrentGitBranch);
+ const gitBranch: string | undefined = yield select(
+ selectGitApplicationCurrentBranch,
+ );
const isCurrentPageIdInList =
pagesList.filter((page) => page.pageId === currentPageId).length > 0;
@@ -637,7 +641,7 @@ export function* saveLayoutSaga(action: ReduxAction<{ isRetry?: boolean }>) {
try {
const currentPageId: string = yield select(getCurrentPageId);
const currentPage: Page = yield select(getPageById(currentPageId));
- const isPreviewMode: boolean = yield select(combinedPreviewModeSelector);
+ const isPreviewMode: boolean = yield select(selectCombinedPreviewMode);
const appMode: APP_MODE | undefined = yield select(getAppMode);
@@ -1401,7 +1405,7 @@ export function* setCanvasCardsStateSaga(action: ReduxAction<string>) {
}
export function* setPreviewModeInitSaga(action: ReduxAction<boolean>) {
- const isPreviewMode: boolean = yield select(combinedPreviewModeSelector);
+ const isPreviewMode: boolean = yield select(selectCombinedPreviewMode);
if (action.payload) {
// we animate out elements and then move to the canvas
diff --git a/app/client/src/ce/sagas/index.tsx b/app/client/src/ce/sagas/index.tsx
index 844f9406af82..af60e7dc4b93 100644
--- a/app/client/src/ce/sagas/index.tsx
+++ b/app/client/src/ce/sagas/index.tsx
@@ -52,6 +52,7 @@ import sendSideBySideWidgetHoverAnalyticsEventSaga from "sagas/AnalyticsSaga";
/* Sagas that are registered by a module that is designed to be independent of the core platform */
import ternSagas from "sagas/TernSaga";
+import gitSagas from "git/sagas";
export const sagas = [
initSagas,
@@ -106,4 +107,5 @@ export const sagas = [
ternSagas,
ideSagas,
sendSideBySideWidgetHoverAnalyticsEventSaga,
+ gitSagas,
];
diff --git a/app/client/src/ce/selectors/entitiesSelector.ts b/app/client/src/ce/selectors/entitiesSelector.ts
index d744e14e773b..5cc97210bc54 100644
--- a/app/client/src/ce/selectors/entitiesSelector.ts
+++ b/app/client/src/ce/selectors/entitiesSelector.ts
@@ -54,7 +54,7 @@ import { getEntityNameAndPropertyPath } from "ee/workers/Evaluation/evaluationUt
import { getFormValues } from "redux-form";
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
import type { Module } from "ee/constants/ModuleConstants";
-import { getAnvilSpaceDistributionStatus } from "layoutSystems/anvil/integrations/selectors";
+// import { getAnvilSpaceDistributionStatus } from "layoutSystems/anvil/integrations/selectors";
import {
getCurrentWorkflowActions,
getCurrentWorkflowJSActions,
@@ -167,47 +167,48 @@ export const getDatasourceStructureById = (
return state.entities.datasources.structure[id];
};
+// ! git mod - the following function is not getting used
/**
* Selector to indicate if the widget name should be shown/drawn on canvas
*/
-export const getShouldShowWidgetName = createSelector(
- (state: AppState) => state.ui.widgetDragResize.isResizing,
- (state: AppState) => state.ui.widgetDragResize.isDragging,
- (state: AppState) => state.ui.editor.isPreviewMode,
- (state: AppState) => state.ui.widgetDragResize.isAutoCanvasResizing,
- getAnvilSpaceDistributionStatus,
- // cannot import other selectors, breaks the app
- (state) => {
- const gitMetaData =
- state.ui.applications.currentApplication?.gitApplicationMetadata;
- const isGitConnected = !!(gitMetaData && gitMetaData?.remoteUrl);
- const currentBranch = gitMetaData?.branchName;
- const { protectedBranches = [] } = state.ui.gitSync;
-
- if (!isGitConnected || !currentBranch) {
- return false;
- } else {
- return protectedBranches.includes(currentBranch);
- }
- },
- (
- isResizing,
- isDragging,
- isPreviewMode,
- isAutoCanvasResizing,
- isDistributingSpace,
- isProtectedMode,
- ) => {
- return (
- !isResizing &&
- !isDragging &&
- !isPreviewMode &&
- !isAutoCanvasResizing &&
- !isDistributingSpace &&
- !isProtectedMode
- );
- },
-);
+// export const getShouldShowWidgetName = createSelector(
+// (state: AppState) => state.ui.widgetDragResize.isResizing,
+// (state: AppState) => state.ui.widgetDragResize.isDragging,
+// (state: AppState) => state.ui.editor.isPreviewMode,
+// (state: AppState) => state.ui.widgetDragResize.isAutoCanvasResizing,
+// getAnvilSpaceDistributionStatus,
+// // cannot import other selectors, breaks the app
+// (state) => {
+// const gitMetaData =
+// state.ui.applications.currentApplication?.gitApplicationMetadata;
+// const isGitConnected = !!(gitMetaData && gitMetaData?.remoteUrl);
+// const currentBranch = gitMetaData?.branchName;
+// const { protectedBranches = [] } = state.ui.gitSync;
+
+// if (!isGitConnected || !currentBranch) {
+// return false;
+// } else {
+// return protectedBranches.includes(currentBranch);
+// }
+// },
+// (
+// isResizing,
+// isDragging,
+// isPreviewMode,
+// isAutoCanvasResizing,
+// isDistributingSpace,
+// isProtectedMode,
+// ) => {
+// return (
+// !isResizing &&
+// !isDragging &&
+// !isPreviewMode &&
+// !isAutoCanvasResizing &&
+// !isDistributingSpace &&
+// !isProtectedMode
+// );
+// },
+// );
export const getDatasourceTableColumns =
(datasourceId: string, tableName: string) => (state: AppState) => {
diff --git a/app/client/src/components/BottomBar/index.tsx b/app/client/src/components/BottomBar/index.tsx
index 565844eacfb4..1b7ad839d868 100644
--- a/app/client/src/components/BottomBar/index.tsx
+++ b/app/client/src/components/BottomBar/index.tsx
@@ -1,5 +1,4 @@
-import React from "react";
-import QuickGitActions from "pages/Editor/gitSync/QuickGitActions";
+import React, { useCallback } from "react";
import { DebuggerTrigger } from "components/editorComponents/Debugger";
import HelpButton from "pages/Editor/HelpButton";
import ManualUpgrades from "./ManualUpgrades";
@@ -16,19 +15,30 @@ import { softRefreshActions } from "actions/pluginActionActions";
import { START_SWITCH_ENVIRONMENT } from "ee/constants/messages";
import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors";
import PackageUpgradeStatus from "ee/components/BottomBar/PackageUpgradeStatus";
+import OldGitQuickActions from "pages/Editor/gitSync/QuickGitActions";
+import { GitQuickActions } from "git";
+import { useGitModEnabled } from "pages/Editor/gitSync/hooks/modHooks";
+
+function GitActions() {
+ const isGitModEnabled = useGitModEnabled();
+
+ return isGitModEnabled ? <GitQuickActions /> : <OldGitQuickActions />;
+}
export default function BottomBar() {
const appId = useSelector(getCurrentApplicationId) || "";
- const isPreviewMode = useSelector(previewModeSelector);
- const dispatch = useDispatch();
// We check if the current application is an Anvil application.
// If it is an Anvil application, we remove the Git features from the bottomBar
// as they donot yet work correctly with Anvil.
const isAnvilEnabled = useSelector(getIsAnvilEnabledInCurrentApplication);
+ const isPreviewMode = useSelector(previewModeSelector);
+ const isGitEnabled = !isAnvilEnabled && !isPreviewMode;
+
+ const dispatch = useDispatch();
- const onChangeEnv = () => {
+ const onChangeEnv = useCallback(() => {
dispatch(softRefreshActions());
- };
+ }, [dispatch]);
return (
<Container>
@@ -41,7 +51,7 @@ export default function BottomBar() {
viewMode={isPreviewMode}
/>
)}
- {!isPreviewMode && !isAnvilEnabled && <QuickGitActions />}
+ {isGitEnabled && <GitActions />}
</Wrapper>
{!isPreviewMode && (
<Wrapper>
diff --git a/app/client/src/components/designSystems/appsmith/header/DeployLinkButton.tsx b/app/client/src/components/designSystems/appsmith/header/DeployLinkButton.tsx
index 3257d962223b..91eea09ab4ab 100644
--- a/app/client/src/components/designSystems/appsmith/header/DeployLinkButton.tsx
+++ b/app/client/src/components/designSystems/appsmith/header/DeployLinkButton.tsx
@@ -1,8 +1,7 @@
import type { ReactNode } from "react";
-import React from "react";
+import React, { useCallback } from "react";
import { Menu, MenuItem, MenuContent, MenuTrigger } from "@appsmith/ads";
import { useSelector, useDispatch } from "react-redux";
-import { getIsGitConnected } from "selectors/gitSyncSelectors";
import { setIsGitSyncModalOpen } from "actions/gitSyncActions";
import { GitSyncModalTab } from "entities/GitSync";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
@@ -14,32 +13,54 @@ import { Button } from "@appsmith/ads";
import { KBEditorMenuItem } from "ee/pages/Editor/KnowledgeBase/KBEditorMenuItem";
import { useHasConnectToGitPermission } from "pages/Editor/gitSync/hooks/gitPermissionHooks";
import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors";
+import {
+ useGitConnected,
+ useGitModEnabled,
+} from "pages/Editor/gitSync/hooks/modHooks";
+import { GitDeployMenuItems as GitDeployMenuItemsNew } from "git";
-interface Props {
- trigger: ReactNode;
- link: string;
-}
+function GitDeployMenuItems() {
+ const isGitModEnabled = useGitModEnabled();
-export const DeployLinkButton = (props: Props) => {
const dispatch = useDispatch();
- const isGitConnected = useSelector(getIsGitConnected);
- const isConnectToGitPermitted = useHasConnectToGitPermission();
- // We check if the current application is an Anvil application.
- // If it is an Anvil application, we remove the Git features from the deploy button
- // as they donot yet work correctly with Anvil.
- const isAnvilEnabled = useSelector(getIsAnvilEnabledInCurrentApplication);
-
- const goToGitConnectionPopup = () => {
+ const goToGitConnectionPopup = useCallback(() => {
AnalyticsUtil.logEvent("GS_CONNECT_GIT_CLICK", {
source: "Deploy button",
});
+
dispatch(
setIsGitSyncModalOpen({
isOpen: true,
tab: GitSyncModalTab.GIT_CONNECTION,
}),
);
- };
+ }, [dispatch]);
+
+ return isGitModEnabled ? (
+ <GitDeployMenuItemsNew />
+ ) : (
+ <MenuItem
+ className="t--connect-to-git-btn"
+ onClick={goToGitConnectionPopup}
+ startIcon="git-branch"
+ >
+ {CONNECT_TO_GIT_OPTION()}
+ </MenuItem>
+ );
+}
+
+interface Props {
+ trigger: ReactNode;
+ link: string;
+}
+
+export const DeployLinkButton = (props: Props) => {
+ const isGitConnected = useGitConnected();
+ const isConnectToGitPermitted = useHasConnectToGitPermission();
+ // We check if the current application is an Anvil application.
+ // If it is an Anvil application, we remove the Git features from the deploy button
+ // as they donot yet work correctly with Anvil.
+ const isAnvilEnabled = useSelector(getIsAnvilEnabledInCurrentApplication);
return (
<Menu>
@@ -54,13 +75,7 @@ export const DeployLinkButton = (props: Props) => {
</MenuTrigger>
<MenuContent>
{!isGitConnected && isConnectToGitPermitted && !isAnvilEnabled && (
- <MenuItem
- className="t--connect-to-git-btn"
- onClick={goToGitConnectionPopup}
- startIcon="git-branch"
- >
- {CONNECT_TO_GIT_OPTION()}
- </MenuItem>
+ <GitDeployMenuItems />
)}
<MenuItem
className="t--current-deployed-preview-btn"
diff --git a/app/client/src/components/editorComponents/ApiResponseView.test.tsx b/app/client/src/components/editorComponents/ApiResponseView.test.tsx
index 11601be68554..9ad68895e52f 100644
--- a/app/client/src/components/editorComponents/ApiResponseView.test.tsx
+++ b/app/client/src/components/editorComponents/ApiResponseView.test.tsx
@@ -17,6 +17,10 @@ jest.mock("./EntityBottomTabs", () => ({
default: () => <div />,
}));
+jest.mock("selectors/gitModSelectors", () => ({
+ selectCombinedPreviewMode: jest.fn(() => false),
+}));
+
const mockStore = configureStore([]);
const storeState = {
diff --git a/app/client/src/components/editorComponents/GlobalSearch/HelpBar.tsx b/app/client/src/components/editorComponents/GlobalSearch/HelpBar.tsx
index c52eb62c9ef2..0a8fb41ffabe 100644
--- a/app/client/src/components/editorComponents/GlobalSearch/HelpBar.tsx
+++ b/app/client/src/components/editorComponents/GlobalSearch/HelpBar.tsx
@@ -1,14 +1,13 @@
-import React from "react";
+import React, { useCallback } from "react";
import styled from "styled-components";
-import { connect } from "react-redux";
+import { useDispatch } from "react-redux";
import { getTypographyByKey, Text, TextType } from "@appsmith/ads-old";
import { Icon } from "@appsmith/ads";
import { setGlobalSearchCategory } from "actions/globalSearchActions";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { modText } from "utils/helpers";
import { filterCategories, SEARCH_CATEGORY_ID } from "./utils";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
-import type { AppState } from "ee/reducers";
+import { useGitProtectedMode } from "pages/Editor/gitSync/hooks/modHooks";
const StyledHelpBar = styled.button`
padding: 0 var(--ads-v2-spaces-3);
@@ -42,12 +41,18 @@ const StyledHelpBar = styled.button`
}
`;
-interface Props {
- toggleShowModal: () => void;
- isProtectedMode: boolean;
-}
+function HelpBar() {
+ const isProtectedMode = useGitProtectedMode();
+
+ const dispatch = useDispatch();
+
+ const toggleShowModal = useCallback(() => {
+ AnalyticsUtil.logEvent("OPEN_OMNIBAR", { source: "NAVBAR_CLICK" });
+ dispatch(
+ setGlobalSearchCategory(filterCategories[SEARCH_CATEGORY_ID.INIT]),
+ );
+ }, [dispatch]);
-function HelpBar({ isProtectedMode, toggleShowModal }: Props) {
return (
<StyledHelpBar
className="t--global-search-modal-trigger"
@@ -63,19 +68,4 @@ function HelpBar({ isProtectedMode, toggleShowModal }: Props) {
);
}
-const mapStateToProps = (state: AppState) => ({
- isProtectedMode: protectedModeSelector(state),
-});
-
-// TODO: Fix this the next time the file is edited
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-const mapDispatchToProps = (dispatch: any) => ({
- toggleShowModal: () => {
- AnalyticsUtil.logEvent("OPEN_OMNIBAR", { source: "NAVBAR_CLICK" });
- dispatch(
- setGlobalSearchCategory(filterCategories[SEARCH_CATEGORY_ID.INIT]),
- );
- },
-});
-
-export default connect(mapStateToProps, mapDispatchToProps)(HelpBar);
+export default HelpBar;
diff --git a/app/client/src/components/gitContexts/GitApplicationContextProvider.tsx b/app/client/src/components/gitContexts/GitApplicationContextProvider.tsx
new file mode 100644
index 000000000000..728636e2f6dd
--- /dev/null
+++ b/app/client/src/components/gitContexts/GitApplicationContextProvider.tsx
@@ -0,0 +1,36 @@
+import React from "react";
+import { useSelector } from "react-redux";
+import { GitArtifactType, GitContextProvider } from "git";
+import { getCurrentApplication } from "ee/selectors/applicationSelectors";
+import { hasCreateNewAppPermission } from "ee/utils/permissionHelpers";
+import { setWorkspaceIdForImport } from "ee/actions/applicationActions";
+import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors";
+import { applicationStatusTransformer } from "git/artifact-helpers/application";
+
+interface GitApplicationContextProviderProps {
+ children: React.ReactNode;
+}
+
+export default function GitApplicationContextProvider({
+ children,
+}: GitApplicationContextProviderProps) {
+ const artifactType = GitArtifactType.Application;
+ const application = useSelector(getCurrentApplication);
+ const workspace = useSelector(getCurrentAppWorkspace);
+ const isCreateNewApplicationPermitted = hasCreateNewAppPermission(
+ workspace.userPermissions,
+ );
+
+ return (
+ <GitContextProvider
+ artifact={application ?? null}
+ artifactType={artifactType}
+ baseArtifactId={application?.baseId ?? ""}
+ isCreateArtifactPermitted={isCreateNewApplicationPermitted}
+ setWorkspaceIdForImport={setWorkspaceIdForImport}
+ statusTransformer={applicationStatusTransformer}
+ >
+ {children}
+ </GitContextProvider>
+ );
+}
diff --git a/app/client/src/entities/Engine/AppEditorEngine.ts b/app/client/src/entities/Engine/AppEditorEngine.ts
index f5b0f04b228b..a0bfb5372c20 100644
--- a/app/client/src/entities/Engine/AppEditorEngine.ts
+++ b/app/client/src/entities/Engine/AppEditorEngine.ts
@@ -1,14 +1,4 @@
import { fetchMockDatasources } from "actions/datasourceActions";
-import {
- fetchGitProtectedBranchesInit,
- fetchGitStatusInit,
- remoteUrlInputValue,
- resetPullMergeStatus,
- fetchBranchesInit,
- triggerAutocommitInitAction,
- getGitMetadataInitAction,
-} from "actions/gitSyncActions";
-import { restoreRecentEntitiesRequest } from "actions/globalSearchActions";
import { resetEditorSuccess } from "actions/initActions";
import {
fetchAllPageEntityCompletion,
@@ -24,7 +14,6 @@ import {
ReduxActionErrorTypes,
ReduxActionTypes,
} from "ee/constants/ReduxActionConstants";
-import { addBranchParam } from "constants/routes";
import type { APP_MODE } from "entities/App";
import { call, fork, put, select, spawn } from "redux-saga/effects";
import type { EditConsolidatedApi } from "sagas/InitSagas";
@@ -33,12 +22,9 @@ import {
reportSWStatus,
waitForWidgetConfigBuild,
} from "sagas/InitSagas";
-import {
- getCurrentGitBranch,
- isGitPersistBranchEnabledSelector,
-} from "selectors/gitSyncSelectors";
+import { isGitPersistBranchEnabledSelector } from "selectors/gitSyncSelectors";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
-import history from "utils/history";
+// import history from "utils/history";
import type { AppEnginePayload } from ".";
import AppEngine, {
ActionsNotFoundError,
@@ -71,6 +57,24 @@ import { endSpan, startNestedSpan } from "instrumentation/generateTraces";
import { getCurrentUser } from "selectors/usersSelectors";
import type { User } from "constants/userConstants";
import log from "loglevel";
+import { gitArtifactActions } from "git/store/gitArtifactSlice";
+import { restoreRecentEntitiesRequest } from "actions/globalSearchActions";
+import {
+ fetchBranchesInit,
+ fetchGitProtectedBranchesInit,
+ fetchGitStatusInit,
+ getGitMetadataInitAction,
+ remoteUrlInputValue,
+ resetPullMergeStatus,
+ triggerAutocommitInitAction,
+} from "actions/gitSyncActions";
+import history from "utils/history";
+import { addBranchParam } from "constants/routes";
+import {
+ selectGitApplicationCurrentBranch,
+ selectGitModEnabled,
+} from "selectors/gitModSelectors";
+import { applicationArtifact } from "git/artifact-helpers/application";
export default class AppEditorEngine extends AppEngine {
constructor(mode: APP_MODE) {
@@ -281,6 +285,9 @@ export default class AppEditorEngine extends AppEngine {
const currentApplication: ApplicationPayload = yield select(
getCurrentApplication,
);
+ const currentBranch: string | undefined = yield select(
+ selectGitApplicationCurrentBranch,
+ );
const isGitPersistBranchEnabled: boolean = yield select(
isGitPersistBranchEnabledSelector,
@@ -288,7 +295,6 @@ export default class AppEditorEngine extends AppEngine {
if (isGitPersistBranchEnabled) {
const currentUser: User = yield select(getCurrentUser);
- const currentBranch: string = yield select(getCurrentGitBranch);
if (currentUser?.email && currentApplication?.baseId && currentBranch) {
yield setLatestGitBranchInLocal(
@@ -317,6 +323,15 @@ export default class AppEditorEngine extends AppEngine {
});
}
+ if (currentApplication?.id) {
+ yield put(
+ restoreRecentEntitiesRequest({
+ applicationId: currentApplication.id,
+ branch: currentBranch,
+ }),
+ );
+ }
+
if (isFirstTimeUserOnboardingComplete) {
yield put({
type: ReduxActionTypes.SET_FIRST_TIME_USER_ONBOARDING_APPLICATION_IDS,
@@ -359,22 +374,32 @@ export default class AppEditorEngine extends AppEngine {
public *loadGit(applicationId: string, rootSpan: Span) {
const loadGitSpan = startNestedSpan("AppEditorEngine.loadGit", rootSpan);
+ const isGitModEnabled: boolean = yield select(selectGitModEnabled);
- const branchInStore: string = yield select(getCurrentGitBranch);
+ if (isGitModEnabled) {
+ const currentApplication: ApplicationPayload = yield select(
+ getCurrentApplication,
+ );
- yield put(
- restoreRecentEntitiesRequest({
- applicationId,
- branch: branchInStore,
- }),
- );
- // init of temporary remote url from old application
- yield put(remoteUrlInputValue({ tempRemoteUrl: "" }));
- // add branch query to path and fetch status
+ yield put(
+ gitArtifactActions.initGitForEditor({
+ artifactDef: applicationArtifact(currentApplication.baseId),
+ artifact: currentApplication,
+ }),
+ );
+ } else {
+ const currentBranch: string = yield select(
+ selectGitApplicationCurrentBranch,
+ );
+
+ // init of temporary remote url from old application
+ yield put(remoteUrlInputValue({ tempRemoteUrl: "" }));
+ // add branch query to path and fetch status
- if (branchInStore) {
- history.replace(addBranchParam(branchInStore));
- yield fork(this.loadGitInBackground);
+ if (currentBranch) {
+ history.replace(addBranchParam(currentBranch));
+ yield fork(this.loadGitInBackground);
+ }
}
endSpan(loadGitSpan);
@@ -383,7 +408,6 @@ export default class AppEditorEngine extends AppEngine {
private *loadGitInBackground() {
yield put(fetchBranchesInit());
yield put(fetchGitProtectedBranchesInit());
- yield put(fetchGitProtectedBranchesInit());
yield put(getGitMetadataInitAction());
yield put(triggerAutocommitInitAction());
yield put(fetchGitStatusInit({ compareRemote: true }));
diff --git a/app/client/src/entities/Engine/index.ts b/app/client/src/entities/Engine/index.ts
index aadfd66a4316..b4eb39475753 100644
--- a/app/client/src/entities/Engine/index.ts
+++ b/app/client/src/entities/Engine/index.ts
@@ -17,10 +17,10 @@ import history from "utils/history";
import type URLRedirect from "entities/URLRedirect/index";
import URLGeneratorFactory from "entities/URLRedirect/factory";
import { updateBranchLocally } from "actions/gitSyncActions";
-import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import { restoreIDEEditorViewMode } from "actions/ideActions";
import type { Span } from "instrumentation/types";
import { endSpan, startNestedSpan } from "instrumentation/generateTraces";
+import { selectGitApplicationCurrentBranch } from "selectors/gitModSelectors";
export interface AppEnginePayload {
applicationId?: string;
@@ -114,12 +114,13 @@ export default abstract class AppEngine {
}
const application: ApplicationPayload = yield select(getCurrentApplication);
- const currentGitBranch: ReturnType<typeof getCurrentGitBranch> =
- yield select(getCurrentGitBranch);
+ const currentBranch: string | undefined = yield select(
+ selectGitApplicationCurrentBranch,
+ );
yield put(
updateAppStore(
- getPersistentAppStore(application.id, branch || currentGitBranch),
+ getPersistentAppStore(application.id, branch || currentBranch),
),
);
const defaultPageId: string = yield select(getDefaultPageId);
diff --git a/app/client/src/git/artifact-helpers/application/applicationArtifact.ts b/app/client/src/git/artifact-helpers/application/applicationArtifact.ts
new file mode 100644
index 000000000000..7337db575ac6
--- /dev/null
+++ b/app/client/src/git/artifact-helpers/application/applicationArtifact.ts
@@ -0,0 +1,11 @@
+import { GitArtifactType } from "git/constants/enums";
+import type { GitArtifactDef } from "git/store/types";
+
+export default function applicationArtifact(
+ baseApplicationId: string,
+): GitArtifactDef {
+ return {
+ artifactType: GitArtifactType.Application,
+ baseArtifactId: baseApplicationId,
+ };
+}
diff --git a/app/client/src/git/artifactHelpers/application/statusTransformer.ts b/app/client/src/git/artifact-helpers/application/applicationStatusTransformer.ts
similarity index 62%
rename from app/client/src/git/artifactHelpers/application/statusTransformer.ts
rename to app/client/src/git/artifact-helpers/application/applicationStatusTransformer.ts
index 9ac95d9c424e..b803cddfea66 100644
--- a/app/client/src/git/artifactHelpers/application/statusTransformer.ts
+++ b/app/client/src/git/artifact-helpers/application/applicationStatusTransformer.ts
@@ -1,6 +1,11 @@
import type { FetchStatusResponseData } from "git/requests/fetchStatusRequest.types";
import { objectKeys } from "@appsmith/utils";
-import type { StatusTreeStruct } from "git/components/StatusChanges/StatusTree";
+import {
+ createMessage,
+ NOT_PUSHED_YET,
+ TRY_TO_PULL,
+} from "ee/constants/messages";
+import type { StatusTreeStruct } from "git/components/StatusChanges/types";
const ICON_LOOKUP = {
query: "query",
@@ -8,19 +13,29 @@ const ICON_LOOKUP = {
page: "page-line",
datasource: "database-2-line",
jsLib: "package",
+ settings: "settings-v3",
+ theme: "sip-line",
+ remote: "git-commit",
+ package: "package",
+ module: "package",
+ moduleInstance: "package",
};
interface TreeNodeDef {
subject: string;
verb: string;
type: keyof typeof ICON_LOOKUP;
+ extra?: string;
}
function createTreeNode(nodeDef: TreeNodeDef) {
- return {
- icon: ICON_LOOKUP[nodeDef.type],
- message: `${nodeDef.subject} ${nodeDef.verb}`,
- };
+ let message = `${nodeDef.subject} ${nodeDef.verb}`;
+
+ if (nodeDef.extra) {
+ message += ` ${nodeDef.extra}`;
+ }
+
+ return { icon: ICON_LOOKUP[nodeDef.type], message };
}
function determineVerbForDefs(defs: TreeNodeDef[]) {
@@ -45,7 +60,11 @@ function createTreeNodeGroup(nodeDefs: TreeNodeDef[], subject: string) {
return {
icon: ICON_LOOKUP[nodeDefs[0].type],
message: `${nodeDefs.length} ${subject} ${determineVerbForDefs(nodeDefs)}`,
- children: nodeDefs.map(createTreeNode),
+ children: nodeDefs
+ .sort((a, b) =>
+ a.subject.localeCompare(b.subject, undefined, { sensitivity: "base" }),
+ )
+ .map(createTreeNode),
};
}
@@ -125,6 +144,10 @@ function statusPageTransformer(status: FetchStatusResponseData) {
tree.push({ ...createTreeNode(pageDef), children });
});
+ tree.sort((a, b) =>
+ a.message.localeCompare(b.message, undefined, { sensitivity: "base" }),
+ );
+
objectKeys(pageDefLookup).forEach((page) => {
if (!pageEntityDefLookup[page]) {
tree.push(createTreeNode(pageDefLookup[page]));
@@ -186,13 +209,121 @@ function statusJsLibTransformer(status: FetchStatusResponseData) {
return tree;
}
+function statusRemoteCountTransformer(status: FetchStatusResponseData) {
+ const { aheadCount, behindCount } = status;
+ const tree = [] as StatusTreeStruct[];
+
+ if (behindCount > 0) {
+ tree.push(
+ createTreeNode({
+ subject: `${behindCount} commit${behindCount > 1 ? "s" : ""}`,
+ verb: "behind",
+ type: "remote",
+ extra: createMessage(TRY_TO_PULL),
+ }),
+ );
+ }
+
+ if (aheadCount > 0) {
+ tree.push(
+ createTreeNode({
+ subject: `${aheadCount} commit${aheadCount > 1 ? "s" : ""}`,
+ verb: "ahead",
+ type: "remote",
+ extra: createMessage(NOT_PUSHED_YET),
+ }),
+ );
+ }
+
+ return tree;
+}
+
+function statusSettingsTransformer(status: FetchStatusResponseData) {
+ const { modified } = status;
+ const tree = [] as StatusTreeStruct[];
+
+ if (modified.includes("application.json")) {
+ tree.push(
+ createTreeNode({
+ subject: "Application settings",
+ verb: "modified",
+ type: "settings",
+ }),
+ );
+ }
+
+ return tree;
+}
+
+function statusThemeTransformer(status: FetchStatusResponseData) {
+ const { modified } = status;
+ const tree = [] as StatusTreeStruct[];
+
+ if (modified.includes("theme.json")) {
+ tree.push(
+ createTreeNode({
+ subject: "Theme",
+ verb: "modified",
+ type: "theme",
+ }),
+ );
+ }
+
+ return tree;
+}
+
+function statusPackagesTransformer(status: FetchStatusResponseData) {
+ const {
+ modifiedModuleInstances = 0,
+ modifiedModules = 0,
+ modifiedPackages = 0,
+ } = status;
+ const tree = [] as StatusTreeStruct[];
+
+ if (modifiedPackages > 0) {
+ tree.push(
+ createTreeNode({
+ subject: `${modifiedPackages} package${modifiedPackages > 1 ? "s" : ""}`,
+ verb: "modified",
+ type: "package",
+ }),
+ );
+ }
+
+ if (modifiedModules > 0) {
+ tree.push(
+ createTreeNode({
+ subject: `${modifiedModules} module${modifiedModules > 1 ? "s" : ""}`,
+ verb: "modified",
+ type: "module",
+ }),
+ );
+ }
+
+ if (modifiedModuleInstances > 0) {
+ tree.push(
+ createTreeNode({
+ subject: `${modifiedModuleInstances} module instance${modifiedModuleInstances > 1 ? "s" : ""}`,
+ verb: "modified",
+ type: "moduleInstance",
+ }),
+ );
+ }
+
+ return tree;
+}
+
export default function applicationStatusTransformer(
status: FetchStatusResponseData,
) {
const tree = [
+ ...statusRemoteCountTransformer(status),
...statusPageTransformer(status),
...statusDatasourceTransformer(status),
...statusJsLibTransformer(status),
+ ...statusSettingsTransformer(status),
+ ...statusThemeTransformer(status),
+ ...statusPackagesTransformer(status),
] as StatusTreeStruct[];
return tree;
diff --git a/app/client/src/git/artifact-helpers/application/index.ts b/app/client/src/git/artifact-helpers/application/index.ts
new file mode 100644
index 000000000000..579a99c7d975
--- /dev/null
+++ b/app/client/src/git/artifact-helpers/application/index.ts
@@ -0,0 +1,2 @@
+export { default as applicationArtifact } from "./applicationArtifact";
+export { default as applicationStatusTransformer } from "./applicationStatusTransformer";
diff --git a/app/client/src/git/ce/components/GitModals/index.tsx b/app/client/src/git/ce/components/GitModals/index.tsx
index a5fcb8c7be36..8bd094fa1ffe 100644
--- a/app/client/src/git/ce/components/GitModals/index.tsx
+++ b/app/client/src/git/ce/components/GitModals/index.tsx
@@ -1,5 +1,6 @@
import ConflictErrorModal from "git/components/ConflictErrorModal";
import ConnectModal from "git/components/ConnectModal";
+import ConnectSuccessModal from "git/components/ConnectSuccessModal";
import DisableAutocommitModal from "git/components/DisableAutocommitModal";
import DisconnectModal from "git/components/DisconnectModal";
import OpsModal from "git/components/OpsModal";
@@ -10,6 +11,7 @@ function GitModals() {
return (
<>
<ConnectModal />
+ <ConnectSuccessModal />
<OpsModal />
<SettingsModal />
<DisconnectModal />
diff --git a/app/client/src/git/ce/hooks/useDefaultBranch.ts b/app/client/src/git/ce/hooks/useDefaultBranch.ts
index 6bc27c1c08c0..53a0f4a1fb01 100644
--- a/app/client/src/git/ce/hooks/useDefaultBranch.ts
+++ b/app/client/src/git/ce/hooks/useDefaultBranch.ts
@@ -1,17 +1,11 @@
-import { useGitContext } from "git/components/GitContextProvider";
-import { selectDefaultBranch } from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
-import { useSelector } from "react-redux";
+import useArtifactSelector from "git/hooks/useArtifactSelector";
+import { selectDefaultBranch } from "git/store/selectors/gitArtifactSelectors";
function useDefaultBranch() {
- const { artifactDef } = useGitContext();
-
- const defaultBranch = useSelector((state: GitRootState) =>
- selectDefaultBranch(state, artifactDef),
- );
+ const defaultBranch = useArtifactSelector(selectDefaultBranch);
return {
- defaultBranch,
+ defaultBranch: defaultBranch ?? null,
};
}
diff --git a/app/client/src/git/components/ConflictErrorModal/ConflictErrorModalView.tsx b/app/client/src/git/components/ConflictErrorModal/ConflictErrorModalView.tsx
index d59ff023af40..5090e39c7643 100644
--- a/app/client/src/git/components/ConflictErrorModal/ConflictErrorModalView.tsx
+++ b/app/client/src/git/components/ConflictErrorModal/ConflictErrorModalView.tsx
@@ -6,7 +6,7 @@ import {
CONFLICTS_FOUND_WHILE_PULLING_CHANGES,
} from "ee/constants/messages";
-import { Button } from "@appsmith/ads";
+import { Button, Flex } from "@appsmith/ads";
import noop from "lodash/noop";
import ConflictError from "../ConflictError";
@@ -62,18 +62,12 @@ function ConflictErrorModalView({
>
<div className={Classes.OVERLAY_CONTENT}>
<div className="git-error-popup">
- <div
- // ! case: remove inline styles
- style={{
- display: "flex",
- justifyContent: "space-between",
- }}
- >
- <div style={{ display: "flex", alignItems: "center" }}>
+ <Flex justifyContent="space-between">
+ <Flex alignItems="center">
<span className="title">
{createMessage(CONFLICTS_FOUND_WHILE_PULLING_CHANGES)}
</span>
- </div>
+ </Flex>
<Button
isIconButton
kind="tertiary"
@@ -81,7 +75,7 @@ function ConflictErrorModalView({
size="sm"
startIcon="close-modal"
/>
- </div>
+ </Flex>
<ConflictError />
</div>
</div>
diff --git a/app/client/src/git/components/ConflictErrorModal/index.tsx b/app/client/src/git/components/ConflictErrorModal/index.tsx
index db9568836032..a67a429aff35 100644
--- a/app/client/src/git/components/ConflictErrorModal/index.tsx
+++ b/app/client/src/git/components/ConflictErrorModal/index.tsx
@@ -3,11 +3,11 @@ import ConflictErrorModalView from "./ConflictErrorModalView";
import useOps from "git/hooks/useOps";
export default function ConflictErrorModal() {
- const { conflictErrorModalOpen, toggleConflictErrorModal } = useOps();
+ const { isConflictErrorModalOpen, toggleConflictErrorModal } = useOps();
return (
<ConflictErrorModalView
- isConflictErrorModalOpen={conflictErrorModalOpen}
+ isConflictErrorModalOpen={isConflictErrorModalOpen}
toggleConflictErrorModal={toggleConflictErrorModal}
/>
);
diff --git a/app/client/src/git/components/ConnectModal/ConnectInitialize/AddDeployKey.test.tsx b/app/client/src/git/components/ConnectModal/ConnectInitialize/AddDeployKey.test.tsx
deleted file mode 100644
index 176dc5247887..000000000000
--- a/app/client/src/git/components/ConnectModal/ConnectInitialize/AddDeployKey.test.tsx
+++ /dev/null
@@ -1,231 +0,0 @@
-import React from "react";
-import { render, screen, fireEvent, waitFor } from "@testing-library/react";
-import type { AddDeployKeyProps } from "./AddDeployKey";
-import AddDeployKey from "./AddDeployKey";
-import AnalyticsUtil from "ee/utils/AnalyticsUtil";
-import "@testing-library/jest-dom";
-
-jest.mock("ee/utils/AnalyticsUtil", () => ({
- logEvent: jest.fn(),
-}));
-
-jest.mock("copy-to-clipboard", () => ({
- __esModule: true,
- default: () => true,
-}));
-
-const DEFAULT_DOCS_URL =
- "https://docs.appsmith.com/advanced-concepts/version-control-with-git/connecting-to-git-repository";
-
-const defaultProps: AddDeployKeyProps = {
- connectError: null,
- isLoading: false,
- onChange: jest.fn(),
- value: {
- gitProvider: "github",
- isAddedDeployKey: false,
- remoteUrl: "[email protected]:owner/repo.git",
- },
- fetchSSHKey: jest.fn(),
- generateSSHKey: jest.fn(),
- isFetchSSHKeyLoading: false,
- isGenerateSSHKeyLoading: false,
- sshPublicKey: "ecdsa-sha2-nistp256 AAAAE2VjZHNhAAAIBaj...",
-};
-
-describe("AddDeployKey Component", () => {
- beforeEach(() => {
- jest.clearAllMocks();
- });
-
- it("renders without crashing and shows default UI", () => {
- render(<AddDeployKey {...defaultProps} />);
- expect(
- screen.getByText("Add deploy key & give write access"),
- ).toBeInTheDocument();
- expect(screen.getByRole("combobox")).toBeInTheDocument();
- // Should show ECDSA by default since sshKeyPair includes "ecdsa"
- expect(
- screen.getByText(defaultProps.sshPublicKey as string),
- ).toBeInTheDocument();
- expect(
- screen.getByText("I've added the deploy key and gave it write access"),
- ).toBeInTheDocument();
- });
-
- it("calls fetchSSHKey if modal is open and not importing", () => {
- render(<AddDeployKey {...defaultProps} isImport={false} />);
- expect(defaultProps.fetchSSHKey).toHaveBeenCalledTimes(1);
- });
-
- it("does not call fetchSSHKey if importing", () => {
- render(<AddDeployKey {...defaultProps} isImport />);
- expect(defaultProps.fetchSSHKey).not.toHaveBeenCalled();
- });
-
- it("shows dummy key loader if loading keys", () => {
- render(
- <AddDeployKey {...defaultProps} isFetchSSHKeyLoading sshPublicKey="" />,
- );
- // The actual key text should not be displayed
- expect(screen.queryByText("ecdsa-sha2-nistp256")).not.toBeInTheDocument();
- });
-
- it("changes SSH key type when user selects a different type and triggers generateSSHKey if needed", async () => {
- const generateSSHKey = jest.fn();
-
- render(
- <AddDeployKey
- {...defaultProps}
- generateSSHKey={generateSSHKey}
- sshPublicKey="" // No key to force generation
- />,
- );
-
- fireEvent.mouseDown(screen.getByRole("combobox"));
- const rsaOption = screen.getByText("RSA 4096");
-
- fireEvent.click(rsaOption);
-
- await waitFor(() => {
- expect(generateSSHKey).toHaveBeenCalledWith("RSA", false);
- });
- });
-
- it("displays a generic error when errorData is provided and error code is not AE-GIT-4032 or AE-GIT-4033", () => {
- // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop
- const connectError = {
- code: "GENERIC-ERROR",
- errorType: "Some Error",
- message: "Something went wrong",
- };
-
- render(<AddDeployKey {...defaultProps} connectError={connectError} />);
- expect(screen.getByText("Some Error")).toBeInTheDocument();
- expect(screen.getByText("Something went wrong")).toBeInTheDocument();
- });
-
- it("displays a misconfiguration error if error code is AE-GIT-4032", () => {
- // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop
- const connectError = {
- code: "AE-GIT-4032",
- errorType: "SSH Key Error",
- message: "SSH Key misconfiguration",
- };
-
- render(<AddDeployKey {...defaultProps} connectError={connectError} />);
- expect(screen.getByText("SSH key misconfiguration")).toBeInTheDocument();
- expect(
- screen.getByText(
- "It seems that your SSH key hasn't been added to your repository. To proceed, please revisit the steps below and configure your SSH key correctly.",
- ),
- ).toBeInTheDocument();
- });
-
- it("invokes onChange callback when checkbox is toggled", () => {
- const onChange = jest.fn();
-
- render(<AddDeployKey {...defaultProps} onChange={onChange} />);
- const checkbox = screen.getByTestId("t--added-deploy-key-checkbox");
-
- fireEvent.click(checkbox);
- expect(onChange).toHaveBeenCalledWith({ isAddedDeployKey: true });
- });
-
- it("calls AnalyticsUtil on copy button click", () => {
- render(<AddDeployKey {...defaultProps} />);
- const copyButton = screen.getByTestId("t--copy-generic");
-
- fireEvent.click(copyButton);
- expect(AnalyticsUtil.logEvent).toHaveBeenCalledWith(
- "GS_COPY_SSH_KEY_BUTTON_CLICK",
- );
- });
-
- it("hides copy button when connectLoading is true", () => {
- render(<AddDeployKey {...defaultProps} isLoading />);
- expect(screen.queryByTestId("t--copy-generic")).not.toBeInTheDocument();
- });
-
- it("shows repository settings link if gitProvider is known and not 'others'", () => {
- render(<AddDeployKey {...defaultProps} />);
- const link = screen.getByRole("link", { name: "repository settings." });
-
- expect(link).toHaveAttribute(
- "href",
- "https://github.com/owner/repo/settings/keys",
- );
- });
-
- it("does not show repository link if gitProvider = 'others'", () => {
- render(
- <AddDeployKey
- {...defaultProps}
- // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop
- value={{ gitProvider: "others", remoteUrl: "[email protected]:repo.git" }}
- />,
- );
- expect(
- screen.queryByRole("link", { name: "repository settings." }),
- ).not.toBeInTheDocument();
- });
-
- it("shows collapsible section if gitProvider is not 'others'", () => {
- render(
- <AddDeployKey
- {...defaultProps}
- // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop
- value={{
- gitProvider: "gitlab",
- remoteUrl: "[email protected]:owner/repo.git",
- }}
- />,
- );
- expect(
- screen.getByText("How to paste SSH Key in repo and give write access?"),
- ).toBeInTheDocument();
- expect(screen.getByAltText("Add deploy key in gitlab")).toBeInTheDocument();
- });
-
- it("does not display collapsible if gitProvider = 'others'", () => {
- render(
- <AddDeployKey
- {...defaultProps}
- // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop
- value={{ gitProvider: "others", remoteUrl: "[email protected]:repo.git" }}
- />,
- );
- expect(
- screen.queryByText("How to paste SSH Key in repo and give write access?"),
- ).not.toBeInTheDocument();
- });
-
- it("uses default documentation link if none provided", () => {
- render(<AddDeployKey {...defaultProps} />);
- const docsLink = screen.getByRole("link", { name: "Read Docs" });
-
- expect(docsLink).toHaveAttribute("href", DEFAULT_DOCS_URL);
- });
-
- it("generates SSH key if none is present and conditions are met", async () => {
- const fetchSSHKey = jest.fn();
- const generateSSHKey = jest.fn();
-
- render(
- <AddDeployKey
- {...defaultProps}
- fetchSSHKey={fetchSSHKey}
- generateSSHKey={generateSSHKey}
- isFetchSSHKeyLoading={false}
- isGenerateSSHKeyLoading={false}
- sshPublicKey=""
- />,
- );
-
- expect(fetchSSHKey).toHaveBeenCalledTimes(1);
-
- await waitFor(() => {
- expect(generateSSHKey).toHaveBeenCalledWith("ECDSA", false);
- });
- });
-});
diff --git a/app/client/src/git/components/ConnectModal/ConnectInitialize/AddDeployKey.tsx b/app/client/src/git/components/ConnectModal/ConnectInitialize/AddDeployKey.tsx
index 75a4a7a50e86..09dcb7df1122 100644
--- a/app/client/src/git/components/ConnectModal/ConnectInitialize/AddDeployKey.tsx
+++ b/app/client/src/git/components/ConnectModal/ConnectInitialize/AddDeployKey.tsx
@@ -135,93 +135,83 @@ const DEPLOY_DOCS_URL =
"https://docs.appsmith.com/advanced-concepts/version-control-with-git/connecting-to-git-repository";
export interface AddDeployKeyProps {
- connectError: GitApiError | null;
- fetchSSHKey: () => void;
- generateSSHKey: (keyType: string, isImport?: boolean) => void;
- isFetchSSHKeyLoading: boolean;
- isGenerateSSHKeyLoading: boolean;
- isImport?: boolean;
- isLoading: boolean;
+ error: GitApiError | null;
+ isSubmitLoading: boolean;
+ isSSHKeyLoading: boolean;
onChange: (args: Partial<ConnectFormDataState>) => void;
+ onFetchSSHKey?: () => void;
+ onGenerateSSHKey: (keyType: string) => void;
sshPublicKey: string | null;
value: Partial<ConnectFormDataState> | null;
}
function AddDeployKey({
- connectError = null,
- fetchSSHKey = noop,
- generateSSHKey = noop,
- isFetchSSHKeyLoading = false,
- isGenerateSSHKeyLoading = false,
- isImport = false,
- isLoading = false,
+ error = null,
+ isSSHKeyLoading = false,
+ isSubmitLoading = false,
onChange = noop,
+ onFetchSSHKey = noop,
+ onGenerateSSHKey = noop,
sshPublicKey = null,
value = null,
}: AddDeployKeyProps) {
const [fetched, setFetched] = useState(false);
- const [sshKeyType, setSshKeyType] = useState<string>();
+ const [keyType, setKeyType] = useState<string>();
useEffect(
function fetchKeyPairOnInitEffect() {
- if (!isImport) {
- if (!fetched) {
- fetchSSHKey();
- setFetched(true);
- // doesn't support callback anymore
- // fetchSSHKey({
- // onSuccessCallback: () => {
- // setFetched(true);
- // },
- // onErrorCallback: () => {
- // setFetched(true);
- // },
- // });
- }
- } else {
- if (!fetched) {
- setFetched(true);
- }
+ if (!fetched) {
+ onFetchSSHKey();
+ setFetched(true);
+ // doesn't support callback anymore
+ // fetchSSHKey({
+ // onSuccessCallback: () => {
+ // setFetched(true);
+ // },
+ // onErrorCallback: () => {
+ // setFetched(true);
+ // },
+ // });
}
},
- [isImport, fetched, fetchSSHKey],
+ [fetched, onFetchSSHKey],
);
useEffect(
function setSSHKeyTypeonInitEffect() {
- if (fetched && !isFetchSSHKeyLoading) {
+ if (fetched && !isSSHKeyLoading) {
if (sshPublicKey && sshPublicKey.includes("rsa")) {
- setSshKeyType("RSA");
+ setKeyType("RSA");
} else if (
!sshPublicKey &&
value?.remoteUrl &&
value.remoteUrl.toString().toLocaleLowerCase().includes("azure")
) {
- setSshKeyType("RSA");
+ setKeyType("RSA");
} else {
- setSshKeyType("ECDSA");
+ setKeyType("ECDSA");
}
}
},
- [fetched, sshPublicKey, isFetchSSHKeyLoading, value?.remoteUrl],
+ [fetched, sshPublicKey, value?.remoteUrl, isSSHKeyLoading],
);
useEffect(
function generateSSHOnInitEffect() {
if (
- (sshKeyType && !sshPublicKey) ||
- (sshKeyType && !sshPublicKey?.includes(sshKeyType.toLowerCase()))
+ (keyType && !sshPublicKey) ||
+ (keyType && !sshPublicKey?.includes(keyType.toLowerCase()))
) {
- generateSSHKey(sshKeyType, isImport);
+ onGenerateSSHKey(keyType);
// doesn't support callback anymore
- // generateSSHKey(sshKeyType, {
+ // generateSSHKey(keyType, {
// onSuccessCallback: () => {
// toast.show("SSH Key generated successfully", { kind: "success" });
// },
// });
}
},
- [sshKeyType, sshPublicKey, generateSSHKey, isImport],
+ [keyType, sshPublicKey, onGenerateSSHKey],
);
const repositorySettingsUrl = getRepositorySettingsUrl(
@@ -229,7 +219,7 @@ function AddDeployKey({
value?.remoteUrl,
);
- const loading = isFetchSSHKeyLoading || isGenerateSSHKeyLoading;
+ // const loading = isFetchSSHKeyLoading || isGenerateSSHKeyLoading;
const onCopy = useCallback(() => {
AnalyticsUtil.logEvent("GS_COPY_SSH_KEY_BUTTON_CLICK");
@@ -244,19 +234,19 @@ function AddDeployKey({
return (
<>
- {connectError &&
- connectError.code !== "AE-GIT-4033" &&
- connectError.code !== "AE-GIT-4032" && (
+ {error &&
+ error.code !== "AE-GIT-4033" &&
+ error.code !== "AE-GIT-4032" && (
<ErrorCallout kind="error">
<Text kind="heading-xs" renderAs="h3">
- {connectError.errorType}
+ {error.errorType}
</Text>
- <Text renderAs="p">{connectError.message}</Text>
+ <Text renderAs="p">{error.message}</Text>
</ErrorCallout>
)}
{/* hardcoding message because server doesn't support feature flag. Will change this later */}
- {connectError && connectError.code === "AE-GIT-4032" && (
+ {error && error.code === "AE-GIT-4032" && (
<ErrorCallout kind="error">
<Text kind="heading-xs" renderAs="h3">
{createMessage(ERROR_SSH_KEY_MISCONF_TITLE)}
@@ -301,20 +291,20 @@ function AddDeployKey({
Now, give write access to it.
</WellText>
<FieldContainer>
- <StyledSelect onChange={setSshKeyType} size="sm" value={sshKeyType}>
+ <StyledSelect onChange={setKeyType} size="sm" value={keyType}>
<Option value="ECDSA">ECDSA 256</Option>
<Option value="RSA">RSA 4096</Option>
</StyledSelect>
- {!loading ? (
+ {!isSSHKeyLoading ? (
<DeployedKeyContainer>
<StyledIcon
color="var(--ads-v2-color-fg)"
name="key-2-line"
size="md"
/>
- <KeyType>{sshKeyType}</KeyType>
+ <KeyType>{keyType}</KeyType>
<KeyText>{sshPublicKey}</KeyText>
- {!isLoading && (
+ {!isSubmitLoading && (
<CopyButton
onCopy={onCopy}
tooltipMessage={createMessage(COPY_SSH_KEY)}
diff --git a/app/client/src/git/components/ConnectModal/ConnectInitialize/ChooseGitProvider.test.tsx b/app/client/src/git/components/ConnectModal/ConnectInitialize/ChooseGitProvider.test.tsx
index 62a5f43858db..8d536c71686d 100644
--- a/app/client/src/git/components/ConnectModal/ConnectInitialize/ChooseGitProvider.test.tsx
+++ b/app/client/src/git/components/ConnectModal/ConnectInitialize/ChooseGitProvider.test.tsx
@@ -23,8 +23,7 @@ const defaultProps = {
isImport: false,
canCreateNewArtifact: true,
toggleConnectModal: jest.fn(),
- isCreateArtifactPermitted: true,
- setImportWorkspaceId: jest.fn(),
+ onOpenImport: jest.fn(),
};
describe("ChooseGitProvider Component", () => {
@@ -169,19 +168,19 @@ describe("ChooseGitProvider Component", () => {
});
it("clicking on 'Import via git' link calls onImportFromCalloutLinkClick", () => {
- const mockSetImportWorkspaceId = jest.fn();
+ const onOpenImport = jest.fn();
render(
<Router>
<ChooseGitProvider
{...defaultProps}
- setImportWorkspaceId={mockSetImportWorkspaceId}
+ onOpenImport={onOpenImport}
value={{ gitProvider: "github", gitEmptyRepoExists: "no" }}
/>
</Router>,
);
fireEvent.click(screen.getByText("Import via git"));
- expect(mockSetImportWorkspaceId).toHaveBeenCalledTimes(1);
+ expect(onOpenImport).toHaveBeenCalledTimes(1);
});
it("when isImport = true, shows a checkbox for existing repo", () => {
@@ -214,11 +213,11 @@ describe("ChooseGitProvider Component", () => {
});
it("respects canCreateNewArtifact and device conditions for links", () => {
- // If canCreateNewArtifact is false, "Import via git" should not appear even if conditions are met
+ // If onOpenImport is null, "Import via git" should not appear even if conditions are met
render(
<ChooseGitProvider
{...defaultProps}
- isCreateArtifactPermitted={false}
+ onOpenImport={null}
value={{ gitProvider: "github", gitEmptyRepoExists: "no" }}
/>,
);
diff --git a/app/client/src/git/components/ConnectModal/ConnectInitialize/ChooseGitProvider.tsx b/app/client/src/git/components/ConnectModal/ConnectInitialize/ChooseGitProvider.tsx
index d24c31de20de..b8aceed5baf4 100644
--- a/app/client/src/git/components/ConnectModal/ConnectInitialize/ChooseGitProvider.tsx
+++ b/app/client/src/git/components/ConnectModal/ConnectInitialize/ChooseGitProvider.tsx
@@ -34,9 +34,7 @@ import {
} from "ee/constants/messages";
import log from "loglevel";
import type { ConnectFormDataState } from "./types";
-import history from "utils/history";
import { useIsMobileDevice } from "utils/hooks/useDeviceDetect";
-import AnalyticsUtil from "ee/utils/AnalyticsUtil";
const WellInnerContainer = styled.div`
padding-left: 16px;
@@ -53,21 +51,17 @@ export type GitProvider = (typeof GIT_PROVIDERS)[number];
interface ChooseGitProviderProps {
artifactType: string;
- isCreateArtifactPermitted: boolean;
isImport?: boolean;
onChange: (args: Partial<ConnectFormDataState>) => void;
- setImportWorkspaceId: () => void;
- toggleConnectModal: (open: boolean) => void;
+ onOpenImport: (() => void) | null;
value: Partial<ConnectFormDataState>;
}
function ChooseGitProvider({
artifactType,
- isCreateArtifactPermitted,
isImport = false,
onChange = noop,
- setImportWorkspaceId = noop,
- toggleConnectModal = noop,
+ onOpenImport = null,
value = {},
}: ChooseGitProviderProps) {
const isMobile = useIsMobileDevice();
@@ -97,19 +91,19 @@ function ChooseGitProvider({
[onChange],
);
- const handleClickOnImport = useCallback(() => {
- toggleConnectModal(false);
- history.push("/applications");
- setImportWorkspaceId();
- toggleConnectModal(true);
- AnalyticsUtil.logEvent("GS_IMPORT_VIA_GIT_DURING_GC");
- }, [setImportWorkspaceId, toggleConnectModal]);
+ // const handleClickOnImport = useCallback(() => {
+ // toggleConnectModal(false);
+ // history.push("/applications");
+ // setImportWorkspaceId();
+ // toggleConnectModal(true);
+ // AnalyticsUtil.logEvent("GS_IMPORT_VIA_GIT_DURING_GC");
+ // }, [setImportWorkspaceId, toggleConnectModal]);
const importCalloutLinks = useMemo(() => {
- return !isMobile && isCreateArtifactPermitted
- ? [{ children: "Import via git", onClick: handleClickOnImport }]
+ return !isMobile && onOpenImport && typeof onOpenImport === "function"
+ ? [{ children: "Import via git", onClick: onOpenImport }]
: [];
- }, [handleClickOnImport, isCreateArtifactPermitted, isMobile]);
+ }, [onOpenImport, isMobile]);
return (
<>
@@ -208,7 +202,7 @@ function ChooseGitProvider({
)}
</WellInnerContainer>
</WellContainer>
- {!isImport && value?.gitEmptyRepoExists === "no" ? (
+ {!isImport && onOpenImport && value?.gitEmptyRepoExists === "no" ? (
<Callout kind="info" links={importCalloutLinks}>
{createMessage(IMPORT_ARTIFACT_IF_NOT_EMPTY, artifactType)}
</Callout>
diff --git a/app/client/src/git/components/ConnectModal/ConnectInitialize/GenerateSSH.test.tsx b/app/client/src/git/components/ConnectModal/ConnectInitialize/GenerateSSH.test.tsx
index d082ee44546d..fc53b8531a4f 100644
--- a/app/client/src/git/components/ConnectModal/ConnectInitialize/GenerateSSH.test.tsx
+++ b/app/client/src/git/components/ConnectModal/ConnectInitialize/GenerateSSH.test.tsx
@@ -16,7 +16,7 @@ const defaultProps = {
gitProvider: "github" as GitProvider,
remoteUrl: "",
},
- connectError: null,
+ error: null,
};
describe("GenerateSSH Component", () => {
@@ -38,7 +38,7 @@ describe("GenerateSSH Component", () => {
code: "AE-GIT-4033",
};
- render(<GenerateSSH {...defaultProps} connectError={errorData} />);
+ render(<GenerateSSH {...defaultProps} error={errorData} />);
expect(
screen.getByText("The repo you added isn't empty"),
).toBeInTheDocument();
@@ -55,7 +55,7 @@ describe("GenerateSSH Component", () => {
code: "SOME_OTHER_ERROR",
};
- render(<GenerateSSH {...defaultProps} connectError={errorData} />);
+ render(<GenerateSSH {...defaultProps} error={errorData} />);
expect(
screen.queryByText("The repo you added isn't empty"),
).not.toBeInTheDocument();
diff --git a/app/client/src/git/components/ConnectModal/ConnectInitialize/GenerateSSH.tsx b/app/client/src/git/components/ConnectModal/ConnectInitialize/GenerateSSH.tsx
index 5318b0bd8554..6a8b7536f903 100644
--- a/app/client/src/git/components/ConnectModal/ConnectInitialize/GenerateSSH.tsx
+++ b/app/client/src/git/components/ConnectModal/ConnectInitialize/GenerateSSH.tsx
@@ -41,17 +41,13 @@ interface GenerateSSHState {
interface GenerateSSHProps {
onChange: (args: Partial<GenerateSSHState>) => void;
value: Partial<GenerateSSHState>;
- connectError: GitApiError | null;
+ error: GitApiError | null;
}
const CONNECTING_TO_GIT_DOCS_URL =
"https://docs.appsmith.com/advanced-concepts/version-control-with-git/connecting-to-git-repository";
-function GenerateSSH({
- connectError,
- onChange = noop,
- value = {},
-}: GenerateSSHProps) {
+function GenerateSSH({ error, onChange = noop, value = {} }: GenerateSSHProps) {
const [isTouched, setIsTouched] = useState(false);
const isInvalid =
isTouched &&
@@ -69,7 +65,7 @@ function GenerateSSH({
return (
<>
{/* hardcoding messages because server doesn't support feature flag. Will change this later */}
- {connectError && connectError?.code === "AE-GIT-4033" && (
+ {error && error?.code === "AE-GIT-4033" && (
<ErrorCallout kind="error">
<Text kind="heading-xs" renderAs="h3">
{createMessage(ERROR_REPO_NOT_EMPTY_TITLE)}
diff --git a/app/client/src/git/components/ConnectModal/ConnectInitialize/index.test.tsx b/app/client/src/git/components/ConnectModal/ConnectInitialize/index.test.tsx
index 6ac8b83b0761..21f46cf03525 100644
--- a/app/client/src/git/components/ConnectModal/ConnectInitialize/index.test.tsx
+++ b/app/client/src/git/components/ConnectModal/ConnectInitialize/index.test.tsx
@@ -21,19 +21,15 @@ jest.mock("@appsmith/ads", () => ({
const defaultProps = {
artifactType: "Application",
- connect: jest.fn(),
- connectError: null,
- fetchSSHKey: jest.fn(),
- generateSSHKey: jest.fn(),
- gitImport: jest.fn(),
- isConnectLoading: false,
- isFetchSSHKeyLoading: false,
- isGenerateSSHKeyLoading: false,
- isGitImportLoading: false,
+ error: null,
+ onFetchSSHKey: jest.fn(),
+ onGenerateSSHKey: jest.fn(),
+ isSubmitLoading: false,
+ isSSHKeyLoading: false,
isImport: false,
+ onSubmit: jest.fn(),
+ onOpenImport: null,
sshPublicKey: "ssh-rsa AAAAB3...",
- isCreateArtifactPermitted: true,
- setImportWorkspaceId: jest.fn(),
toggleConnectModal: jest.fn(),
};
@@ -126,7 +122,7 @@ describe("ConnectModal Component", () => {
completeAddDeployKeyStep();
await waitFor(() => {
- expect(defaultProps.connect).toHaveBeenCalledWith(
+ expect(defaultProps.onSubmit).toHaveBeenCalledWith(
expect.objectContaining({
remoteUrl: "[email protected]:user/repo.git",
gitProfile: {
@@ -139,14 +135,14 @@ describe("ConnectModal Component", () => {
});
});
- it("calls gitImport on completing AddDeployKey step in import mode", async () => {
+ it("calls onSubmit on completing AddDeployKey step in import mode", async () => {
render(<ConnectInitialize {...defaultProps} isImport />);
completeChooseProviderStep(true);
completeGenerateSSHKeyStep();
completeAddDeployKeyStep();
await waitFor(() => {
- expect(defaultProps.gitImport).toHaveBeenCalledWith(
+ expect(defaultProps.onSubmit).toHaveBeenCalledWith(
expect.objectContaining({
remoteUrl: "[email protected]:user/repo.git",
gitProfile: {
@@ -167,13 +163,11 @@ describe("ConnectModal Component", () => {
message: "",
};
- rerender(
- <ConnectInitialize {...defaultProps} connectError={connectError} />,
- );
+ rerender(<ConnectInitialize {...defaultProps} error={connectError} />);
});
const { rerender } = render(
- <ConnectInitialize {...defaultProps} connect={mockConnect} />,
+ <ConnectInitialize {...defaultProps} onSubmit={mockConnect} />,
);
completeChooseProviderStep();
@@ -216,7 +210,7 @@ describe("ConnectModal Component", () => {
});
it("renders loading state and removes buttons when connecting", () => {
- render(<ConnectInitialize {...defaultProps} isConnectLoading />);
+ render(<ConnectInitialize {...defaultProps} isSubmitLoading />);
expect(
screen.getByText("Please wait while we connect to Git..."),
).toBeInTheDocument();
diff --git a/app/client/src/git/components/ConnectModal/ConnectInitialize/index.tsx b/app/client/src/git/components/ConnectModal/ConnectInitialize/index.tsx
index 05046d250d09..72ba9d797c1d 100644
--- a/app/client/src/git/components/ConnectModal/ConnectInitialize/index.tsx
+++ b/app/client/src/git/components/ConnectModal/ConnectInitialize/index.tsx
@@ -71,41 +71,31 @@ interface StyledModalFooterProps {
loading?: boolean;
}
-interface ConnectModalViewProps {
+export interface ConnectInitializeProps {
artifactType: string;
- connect: (params: ConnectRequestParams) => void;
- connectError: GitApiError | null;
- fetchSSHKey: () => void;
- generateSSHKey: (keyType: string) => void;
- gitImport: (params: GitImportRequestParams) => void;
- isConnectLoading: boolean;
- isCreateArtifactPermitted: boolean;
- isFetchSSHKeyLoading: boolean;
- isGenerateSSHKeyLoading: boolean;
- isGitImportLoading: boolean;
+ error: GitApiError | null;
isImport: boolean;
- setImportWorkspaceId: () => void;
+ isSSHKeyLoading: boolean;
+ isSubmitLoading: boolean;
+ onFetchSSHKey: () => void;
+ onGenerateSSHKey: (keyType: string) => void;
+ onOpenImport: (() => void) | null;
+ onSubmit: (params: ConnectRequestParams | GitImportRequestParams) => void;
sshPublicKey: string | null;
- toggleConnectModal: (open: boolean) => void;
}
function ConnectInitialize({
artifactType,
- connect = noop,
- connectError = null,
- fetchSSHKey = noop,
- generateSSHKey = noop,
- gitImport = noop,
- isConnectLoading = false,
- isCreateArtifactPermitted = false,
- isFetchSSHKeyLoading = false,
- isGenerateSSHKeyLoading = false,
- isGitImportLoading = false,
+ error = null,
isImport = false,
- setImportWorkspaceId = noop,
+ isSSHKeyLoading = false,
+ isSubmitLoading = false,
+ onFetchSSHKey = noop,
+ onGenerateSSHKey = noop,
+ onOpenImport = null,
+ onSubmit = noop,
sshPublicKey = null,
- toggleConnectModal = noop,
-}: ConnectModalViewProps) {
+}: ConnectInitializeProps) {
const nextStepText = {
[GIT_CONNECT_STEPS.CHOOSE_PROVIDER]: createMessage(CONFIGURE_GIT),
[GIT_CONNECT_STEPS.GENERATE_SSH_KEY]: createMessage(GENERATE_SSH_KEY_STEP),
@@ -127,8 +117,8 @@ function ConnectInitialize({
GIT_CONNECT_STEPS.CHOOSE_PROVIDER,
);
- const isLoading =
- (!isImport && isConnectLoading) || (isImport && isGitImportLoading);
+ // const isSubmitLoading =
+ // (!isImport && isConnectLoading) || (isImport && isGitImportLoading);
const currentIndex = steps.findIndex((s) => s.key === activeStep);
@@ -181,43 +171,40 @@ function ConnectInitialize({
};
if (formData.remoteUrl) {
- if (!isImport) {
- AnalyticsUtil.logEvent(
- "GS_CONNECT_BUTTON_ON_GIT_SYNC_MODAL_CLICK",
- { repoUrl: formData?.remoteUrl, connectFlow: "v2" },
- );
- connect({
- remoteUrl: formData.remoteUrl,
- gitProfile,
- });
- } else {
- gitImport({
- remoteUrl: formData.remoteUrl,
- gitProfile,
- });
- }
+ onSubmit({
+ remoteUrl: formData.remoteUrl,
+ gitProfile,
+ });
+ // if (!isImport) {
+ // AnalyticsUtil.logEvent(
+ // "GS_CONNECT_BUTTON_ON_GIT_SYNC_MODAL_CLICK",
+ // { repoUrl: formData?.remoteUrl, connectFlow: "v2" },
+ // );
+ // connect({
+ // remoteUrl: formData.remoteUrl,
+ // gitProfile,
+ // });
+ // } else {
+ // gitImport({
+ // remoteUrl: formData.remoteUrl,
+ // gitProfile,
+ // });
+ // }
}
break;
}
}
}
- }, [
- activeStep,
- connect,
- currentIndex,
- formData.remoteUrl,
- gitImport,
- isImport,
- ]);
+ }, [activeStep, currentIndex, formData.remoteUrl, onSubmit]);
useEffect(
function changeStepOnErrorEffect() {
- if (connectError?.code === GitErrorCodes.REPO_NOT_EMPTY) {
+ if (error?.code === GitErrorCodes.REPO_NOT_EMPTY) {
setActiveStep(GIT_CONNECT_STEPS.GENERATE_SSH_KEY);
}
},
- [connectError?.code],
+ [error?.code],
);
return (
@@ -236,45 +223,38 @@ function ConnectInitialize({
{activeStep === GIT_CONNECT_STEPS.CHOOSE_PROVIDER && (
<ChooseGitProvider
artifactType={artifactType}
- isCreateArtifactPermitted={isCreateArtifactPermitted}
isImport={isImport}
onChange={handleChange}
- setImportWorkspaceId={setImportWorkspaceId}
- toggleConnectModal={toggleConnectModal}
+ onOpenImport={onOpenImport}
value={formData}
/>
)}
{activeStep === GIT_CONNECT_STEPS.GENERATE_SSH_KEY && (
- <GenerateSSH
- connectError={connectError}
- onChange={handleChange}
- value={formData}
- />
+ <GenerateSSH error={error} onChange={handleChange} value={formData} />
)}
{activeStep === GIT_CONNECT_STEPS.ADD_DEPLOY_KEY && (
<AddDeployKey
- connectError={connectError}
- fetchSSHKey={fetchSSHKey}
- generateSSHKey={generateSSHKey}
- isFetchSSHKeyLoading={isFetchSSHKeyLoading}
- isGenerateSSHKeyLoading={isGenerateSSHKeyLoading}
- isLoading={isLoading}
+ error={error}
+ isSSHKeyLoading={isSSHKeyLoading}
+ isSubmitLoading={isSubmitLoading}
onChange={handleChange}
+ onFetchSSHKey={onFetchSSHKey}
+ onGenerateSSHKey={onGenerateSSHKey}
sshPublicKey={sshPublicKey}
value={formData}
/>
)}
</StyledModalBody>
- <StyledModalFooter loading={isLoading}>
- {isLoading && (
+ <StyledModalFooter loading={isSubmitLoading}>
+ {isSubmitLoading && (
<Statusbar
- completed={!isLoading}
+ completed={!isSubmitLoading}
message={createMessage(
isImport ? GIT_IMPORT_WAITING : GIT_CONNECT_WAITING,
)}
/>
)}
- {!isLoading && (
+ {!isSubmitLoading && (
<Button
data-testid="t--git-connect-next-button"
endIcon={
@@ -289,10 +269,10 @@ function ConnectInitialize({
)}
{possibleSteps.includes(activeStep) &&
currentIndex > 0 &&
- !isLoading && (
+ !isSubmitLoading && (
<Button
data-testid="t--git-connect-prev-button"
- isDisabled={isLoading}
+ isDisabled={isSubmitLoading}
kind="secondary"
onClick={handlePreviousStep}
size="md"
diff --git a/app/client/src/git/components/ConnectModal/ConnectModalView.tsx b/app/client/src/git/components/ConnectModal/ConnectModalView.tsx
index 0146a5cf9237..1732a6099ff7 100644
--- a/app/client/src/git/components/ConnectModal/ConnectModalView.tsx
+++ b/app/client/src/git/components/ConnectModal/ConnectModalView.tsx
@@ -1,12 +1,9 @@
import { Modal, ModalContent } from "@appsmith/ads";
-import type { ConnectRequestParams } from "git/requests/connectRequest.types";
-import type { GitImportRequestParams } from "git/requests/gitImportRequest.types";
-import type { GitApiError } from "git/store/types";
import React, { useCallback } from "react";
-import ConnectInitialize from "./ConnectInitialize";
-import ConnectSuccess from "./ConnectSuccess";
+import ConnectInitialize, {
+ type ConnectInitializeProps,
+} from "./ConnectInitialize";
import { noop } from "lodash";
-import type { GitSettingsTab } from "git/constants/enums";
import styled from "styled-components";
const StyledModalContent = styled(ModalContent)`
@@ -19,82 +16,33 @@ const StyledModalContent = styled(ModalContent)`
}
`;
-interface ConnectModalViewProps {
- artifactType: string;
- connect: (params: ConnectRequestParams) => void;
- connectError: GitApiError | null;
- fetchSSHKey: () => void;
- generateSSHKey: (keyType: string) => void;
- gitImport: (params: GitImportRequestParams) => void;
- isConnectLoading: boolean;
- isConnectModalOpen: boolean;
- isFetchSSHKeyLoading: boolean;
- isGenerateSSHKeyLoading: boolean;
- isGitImportLoading: boolean;
- isImport: boolean;
- resetFetchSSHKey: () => void;
- resetGenerateSSHKey: () => void;
- sshPublicKey: string | null;
- toggleConnectModal: (open: boolean) => void;
- isGitConnected: boolean;
- remoteUrl: string | null;
- toggleSettingsModal: (
- open: boolean,
- tab?: keyof typeof GitSettingsTab,
- ) => void;
- defaultBranch: string | null;
- repoName: string | null;
- setImportWorkspaceId: () => void;
- isCreateArtifactPermitted: boolean;
+interface ConnectModalViewProps extends ConnectInitializeProps {
+ isModalOpen: boolean;
+ resetSSHKey: () => void;
+ toggleModalOpen: (open: boolean) => void;
}
function ConnectModalView({
- defaultBranch = null,
- isConnectModalOpen = false,
- isGitConnected = false,
- remoteUrl = null,
- repoName = null,
- resetFetchSSHKey = noop,
- resetGenerateSSHKey = noop,
- toggleConnectModal = noop,
- toggleSettingsModal = noop,
+ isModalOpen = false,
+ resetSSHKey = noop,
+ toggleModalOpen = noop,
...rest
}: ConnectModalViewProps) {
const handleModalOpenChange = useCallback(
(open: boolean) => {
if (!open) {
- resetFetchSSHKey();
- resetGenerateSSHKey();
+ resetSSHKey();
}
- toggleConnectModal(open);
+ toggleModalOpen(open);
},
- [resetFetchSSHKey, resetGenerateSSHKey, toggleConnectModal],
+ [resetSSHKey, toggleModalOpen],
);
return (
- <Modal onOpenChange={handleModalOpenChange} open={isConnectModalOpen}>
+ <Modal onOpenChange={handleModalOpenChange} open={isModalOpen}>
<StyledModalContent data-testid="t--git-connect-modal">
- {isConnectModalOpen ? (
- // need fragment to arrange conditions properly
- // eslint-disable-next-line react/jsx-no-useless-fragment
- <>
- {isGitConnected ? (
- <ConnectSuccess
- defaultBranch={defaultBranch}
- remoteUrl={remoteUrl}
- repoName={repoName}
- toggleConnectModal={toggleConnectModal}
- toggleSettingsModal={toggleSettingsModal}
- />
- ) : (
- <ConnectInitialize
- toggleConnectModal={toggleConnectModal}
- {...rest}
- />
- )}
- </>
- ) : null}
+ {isModalOpen ? <ConnectInitialize {...rest} /> : null}
</StyledModalContent>
</Modal>
);
diff --git a/app/client/src/git/components/ConnectModal/index.tsx b/app/client/src/git/components/ConnectModal/index.tsx
index a8f268132d95..651626e933a7 100644
--- a/app/client/src/git/components/ConnectModal/index.tsx
+++ b/app/client/src/git/components/ConnectModal/index.tsx
@@ -1,67 +1,78 @@
-import React from "react";
+import React, { useCallback } from "react";
import ConnectModalView from "./ConnectModalView";
import { useGitContext } from "../GitContextProvider";
import useConnect from "git/hooks/useConnect";
-import useMetadata from "git/hooks/useMetadata";
-import useSettings from "git/hooks/useSettings";
+import { GitArtifactType } from "git/constants/enums";
+import type { ConnectRequestParams } from "git/requests/connectRequest.types";
+import AnalyticsUtil from "ee/utils/AnalyticsUtil";
+import useSSHKey from "git/hooks/useSSHKey";
+import useImport from "git/hooks/useImport";
+import history from "utils/history";
-interface ConnectModalProps {
- isImport?: boolean;
-}
-
-function ConnectModal({ isImport = false }: ConnectModalProps) {
+function ConnectModal() {
const { artifactDef, isCreateArtifactPermitted, setImportWorkspaceId } =
useGitContext();
const {
connect,
connectError,
- fetchSSHKey,
- generateSSHKey,
- gitImport,
isConnectLoading,
isConnectModalOpen,
+ toggleConnectModal,
+ } = useConnect();
+ const { toggleImportModal } = useImport();
+ const {
+ fetchSSHKey,
+ generateSSHKey,
isFetchSSHKeyLoading,
isGenerateSSHKeyLoading,
- isGitImportLoading,
resetFetchSSHKey,
resetGenerateSSHKey,
sshKey,
- toggleConnectModal,
- } = useConnect();
- const { isGitConnected, metadata } = useMetadata();
- const { toggleSettingsModal } = useSettings();
+ } = useSSHKey();
- const { artifactType } = artifactDef;
+ const artifactType = artifactDef?.artifactType ?? GitArtifactType.Application;
const sshPublicKey = sshKey?.publicKey ?? null;
- const remoteUrl = metadata?.remoteUrl ?? null;
- const repoName = metadata?.repoName ?? null;
- const defaultBranch = metadata?.defaultBranchName ?? null;
+ const isSSHKeyLoading = isFetchSSHKeyLoading || isGenerateSSHKeyLoading;
+
+ const onSubmit = useCallback(
+ (params: ConnectRequestParams) => {
+ AnalyticsUtil.logEvent("GS_CONNECT_BUTTON_ON_GIT_SYNC_MODAL_CLICK", {
+ repoUrl: params?.remoteUrl,
+ connectFlow: "v2",
+ });
+ connect(params);
+ },
+ [connect],
+ );
+
+ const onOpenImport = useCallback(() => {
+ toggleConnectModal(false);
+ history.push("/applications");
+ setImportWorkspaceId();
+ toggleImportModal(true);
+ AnalyticsUtil.logEvent("GS_IMPORT_VIA_GIT_DURING_GC");
+ }, [setImportWorkspaceId, toggleConnectModal, toggleImportModal]);
+
+ const resetSSHKey = useCallback(() => {
+ resetFetchSSHKey();
+ resetGenerateSSHKey();
+ }, [resetFetchSSHKey, resetGenerateSSHKey]);
return (
<ConnectModalView
artifactType={artifactType}
- connect={connect}
- connectError={connectError}
- defaultBranch={defaultBranch}
- fetchSSHKey={fetchSSHKey}
- generateSSHKey={generateSSHKey}
- gitImport={gitImport}
- isConnectLoading={isConnectLoading}
- isConnectModalOpen={isConnectModalOpen}
- isCreateArtifactPermitted={isCreateArtifactPermitted}
- isFetchSSHKeyLoading={isFetchSSHKeyLoading}
- isGenerateSSHKeyLoading={isGenerateSSHKeyLoading}
- isGitConnected={isGitConnected}
- isGitImportLoading={isGitImportLoading}
- isImport={isImport}
- remoteUrl={remoteUrl}
- repoName={repoName}
- resetFetchSSHKey={resetFetchSSHKey}
- resetGenerateSSHKey={resetGenerateSSHKey}
- setImportWorkspaceId={setImportWorkspaceId}
+ error={connectError}
+ isImport={false}
+ isModalOpen={isConnectModalOpen}
+ isSSHKeyLoading={isSSHKeyLoading}
+ isSubmitLoading={isConnectLoading}
+ onFetchSSHKey={fetchSSHKey}
+ onGenerateSSHKey={generateSSHKey}
+ onOpenImport={isCreateArtifactPermitted ? onOpenImport : null}
+ onSubmit={onSubmit}
+ resetSSHKey={resetSSHKey}
sshPublicKey={sshPublicKey}
- toggleConnectModal={toggleConnectModal}
- toggleSettingsModal={toggleSettingsModal}
+ toggleModalOpen={toggleConnectModal}
/>
);
}
diff --git a/app/client/src/git/components/ConnectModal/ConnectSuccess/index.tsx b/app/client/src/git/components/ConnectSuccessModal/ConnectSuccessModalView.tsx
similarity index 64%
rename from app/client/src/git/components/ConnectModal/ConnectSuccess/index.tsx
rename to app/client/src/git/components/ConnectSuccessModal/ConnectSuccessModalView.tsx
index 47f762b6bb5b..af8390a76321 100644
--- a/app/client/src/git/components/ConnectModal/ConnectSuccess/index.tsx
+++ b/app/client/src/git/components/ConnectSuccessModal/ConnectSuccessModalView.tsx
@@ -17,13 +17,15 @@ import {
Text,
Link,
Tooltip,
+ Modal,
+ ModalContent,
} from "@appsmith/ads";
import React, { useCallback } from "react";
import styled from "styled-components";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { DOCS_BRANCH_PROTECTION_URL } from "constants/ThirdPartyConstants";
import noop from "lodash/noop";
-import type { GitSettingsTab } from "git/constants/enums";
+import { GitSettingsTab } from "git/constants/enums";
const TitleText = styled(Text)`
flex: 1;
@@ -51,15 +53,15 @@ function ConnectionSuccessTitle() {
);
}
-interface ConnectSuccessModalViewProps {
+interface ConnectSuccessContentProps {
repoName: string | null;
defaultBranch: string | null;
}
-function ConnectSuccessModalView({
+function ConnectSuccessContent({
defaultBranch,
repoName,
-}: ConnectSuccessModalViewProps) {
+}: ConnectSuccessContentProps) {
return (
<>
<div className="flex gap-x-4 mb-6">
@@ -112,67 +114,84 @@ function ConnectSuccessModalView({
);
}
-interface ConnectSuccessProps {
+const StyledModalContent = styled(ModalContent)`
+ &&& {
+ width: 640px;
+ transform: none !important;
+ top: 100px;
+ left: calc(50% - 320px);
+ max-height: calc(100vh - 200px);
+ }
+`;
+
+export interface ConnectSuccessModalViewProps {
defaultBranch: string | null;
+ isConnectSuccessModalOpen: boolean;
remoteUrl: string | null;
repoName: string | null;
- toggleConnectModal: (open: boolean) => void;
+ toggleConnectSuccessModal: (open: boolean) => void;
toggleSettingsModal: (
open: boolean,
tab?: keyof typeof GitSettingsTab,
) => void;
}
-function ConnectSuccess({
- defaultBranch,
+function ConnectSuccessModalView({
+ defaultBranch = null,
+ isConnectSuccessModalOpen = false,
remoteUrl = null,
- repoName,
- toggleConnectModal = noop,
+ repoName = null,
+ toggleConnectSuccessModal = noop,
toggleSettingsModal = noop,
-}: ConnectSuccessProps) {
+}: ConnectSuccessModalViewProps) {
const handleStartGit = useCallback(() => {
- toggleConnectModal(false);
+ toggleConnectSuccessModal(false);
AnalyticsUtil.logEvent("GS_START_USING_GIT", {
repoUrl: remoteUrl,
});
- }, [remoteUrl, toggleConnectModal]);
+ }, [remoteUrl, toggleConnectSuccessModal]);
const handleOpenSettings = useCallback(() => {
- toggleConnectModal(false);
- toggleSettingsModal(true);
+ toggleConnectSuccessModal(false);
+ toggleSettingsModal(true, GitSettingsTab.Branch);
AnalyticsUtil.logEvent("GS_OPEN_GIT_SETTINGS", {
repoUrl: remoteUrl,
});
- }, [remoteUrl, toggleConnectModal, toggleSettingsModal]);
+ }, [remoteUrl, toggleConnectSuccessModal, toggleSettingsModal]);
return (
- <>
- <ModalBody data-testid="t--git-success-modal-body">
- <ConnectionSuccessTitle />
- <ConnectSuccessModalView
- defaultBranch={defaultBranch}
- repoName={repoName}
- />
- </ModalBody>
- <ModalFooter>
- <Button
- data-testid="t--git-success-modal-open-settings-cta"
- kind="secondary"
- onClick={handleOpenSettings}
- size="md"
- >
- {createMessage(GIT_CONNECT_SUCCESS_ACTION_SETTINGS)}
- </Button>
- <Button
- data-testid="t--git-success-modal-start-using-git-cta"
- onClick={handleStartGit}
- size="md"
- >
- {createMessage(GIT_CONNECT_SUCCESS_ACTION_CONTINUE)}
- </Button>
- </ModalFooter>
- </>
+ <Modal
+ onOpenChange={toggleConnectSuccessModal}
+ open={isConnectSuccessModalOpen}
+ >
+ <StyledModalContent data-testid="t--git-connect-modal">
+ <ModalBody data-testid="t--git-success-modal-body">
+ <ConnectionSuccessTitle />
+ <ConnectSuccessContent
+ defaultBranch={defaultBranch}
+ repoName={repoName}
+ />
+ </ModalBody>
+ <ModalFooter>
+ <Button
+ data-testid="t--git-success-modal-open-settings-cta"
+ kind="secondary"
+ onClick={handleOpenSettings}
+ size="md"
+ >
+ {createMessage(GIT_CONNECT_SUCCESS_ACTION_SETTINGS)}
+ </Button>
+ <Button
+ data-testid="t--git-success-modal-start-using-git-cta"
+ onClick={handleStartGit}
+ size="md"
+ >
+ {createMessage(GIT_CONNECT_SUCCESS_ACTION_CONTINUE)}
+ </Button>
+ </ModalFooter>
+ </StyledModalContent>
+ </Modal>
);
}
-export default ConnectSuccess;
+export default ConnectSuccessModalView;
diff --git a/app/client/src/git/components/ConnectSuccessModal/index.tsx b/app/client/src/git/components/ConnectSuccessModal/index.tsx
new file mode 100644
index 000000000000..c492e5aa4bb3
--- /dev/null
+++ b/app/client/src/git/components/ConnectSuccessModal/index.tsx
@@ -0,0 +1,29 @@
+import React from "react";
+import ConnectSuccessModalView from "./ConnectSuccessModalView";
+import useMetadata from "git/hooks/useMetadata";
+import useConnect from "git/hooks/useConnect";
+import useSettings from "git/hooks/useSettings";
+
+function ConnectSuccessModal() {
+ const { isConnectSuccessModalOpen, toggleConnectSuccessModal } = useConnect();
+ const { toggleSettingsModal } = useSettings();
+
+ const { metadata } = useMetadata();
+
+ const remoteUrl = metadata?.remoteUrl ?? null;
+ const repoName = metadata?.repoName ?? null;
+ const defaultBranch = metadata?.defaultBranchName ?? null;
+
+ return (
+ <ConnectSuccessModalView
+ defaultBranch={defaultBranch}
+ isConnectSuccessModalOpen={isConnectSuccessModalOpen}
+ remoteUrl={remoteUrl}
+ repoName={repoName}
+ toggleConnectSuccessModal={toggleConnectSuccessModal}
+ toggleSettingsModal={toggleSettingsModal}
+ />
+ );
+}
+
+export default ConnectSuccessModal;
diff --git a/app/client/src/git/components/DeployMenuItems/DeployMenuItemsView.tsx b/app/client/src/git/components/DeployMenuItems/DeployMenuItemsView.tsx
new file mode 100644
index 000000000000..09ce5be3178a
--- /dev/null
+++ b/app/client/src/git/components/DeployMenuItems/DeployMenuItemsView.tsx
@@ -0,0 +1,32 @@
+import React, { useCallback } from "react";
+import { MenuItem } from "@appsmith/ads";
+import { CONNECT_TO_GIT_OPTION, createMessage } from "ee/constants/messages";
+import AnalyticsUtil from "ee/utils/AnalyticsUtil";
+import noop from "lodash/noop";
+
+interface DeployMenuItemsViewProps {
+ toggleConnectModal: (open: boolean) => void;
+}
+
+function DeployMenuItemsView({
+ toggleConnectModal = noop,
+}: DeployMenuItemsViewProps) {
+ const handleClickOnConnect = useCallback(() => {
+ AnalyticsUtil.logEvent("GS_CONNECT_GIT_CLICK", {
+ source: "Deploy button",
+ });
+ toggleConnectModal(true);
+ }, [toggleConnectModal]);
+
+ return (
+ <MenuItem
+ className="t--connect-to-git-btn"
+ onClick={handleClickOnConnect}
+ startIcon="git-branch"
+ >
+ {createMessage(CONNECT_TO_GIT_OPTION)}
+ </MenuItem>
+ );
+}
+
+export default DeployMenuItemsView;
diff --git a/app/client/src/git/components/DeployMenuItems/index.tsx b/app/client/src/git/components/DeployMenuItems/index.tsx
new file mode 100644
index 000000000000..de6c61f9af9b
--- /dev/null
+++ b/app/client/src/git/components/DeployMenuItems/index.tsx
@@ -0,0 +1,11 @@
+import useConnect from "git/hooks/useConnect";
+import React from "react";
+import DeployMenuItemsView from "./DeployMenuItemsView";
+
+function DeployMenuItems() {
+ const { toggleConnectModal } = useConnect();
+
+ return <DeployMenuItemsView toggleConnectModal={toggleConnectModal} />;
+}
+
+export default DeployMenuItems;
diff --git a/app/client/src/git/components/GitContextProvider/index.tsx b/app/client/src/git/components/GitContextProvider/index.tsx
index 4d4b88b4f6ad..89736de113eb 100644
--- a/app/client/src/git/components/GitContextProvider/index.tsx
+++ b/app/client/src/git/components/GitContextProvider/index.tsx
@@ -2,14 +2,12 @@ import React, { createContext, useCallback, useContext, useMemo } from "react";
import type { GitArtifactType } from "git/constants/enums";
import type { ApplicationPayload } from "entities/Application";
import type { FetchStatusResponseData } from "git/requests/fetchStatusRequest.types";
-import type { StatusTreeStruct } from "../StatusChanges/StatusTree";
import { useDispatch } from "react-redux";
+import type { GitArtifactDef } from "git/store/types";
+import type { StatusTreeStruct } from "../StatusChanges/types";
export interface GitContextValue {
- artifactDef: {
- artifactType: keyof typeof GitArtifactType;
- baseArtifactId: string;
- };
+ artifactDef: GitArtifactDef | null;
artifact: ApplicationPayload | null;
statusTransformer: (
status: FetchStatusResponseData,
@@ -27,8 +25,8 @@ export const useGitContext = () => {
};
interface GitContextProviderProps {
- artifactType: keyof typeof GitArtifactType;
- baseArtifactId: string;
+ artifactType: keyof typeof GitArtifactType | null;
+ baseArtifactId: string | null;
artifact: ApplicationPayload | null;
isCreateArtifactPermitted: boolean;
setWorkspaceIdForImport: (params: {
@@ -50,10 +48,13 @@ export default function GitContextProvider({
setWorkspaceIdForImport,
statusTransformer,
}: GitContextProviderProps) {
- const artifactDef = useMemo(
- () => ({ artifactType, baseArtifactId }),
- [artifactType, baseArtifactId],
- );
+ const artifactDef = useMemo(() => {
+ if (artifactType && baseArtifactId) {
+ return { artifactType, baseArtifactId };
+ }
+
+ return null;
+ }, [artifactType, baseArtifactId]);
const dispatch = useDispatch();
diff --git a/app/client/src/git/components/GlobalProfile/GlobalProfileView.tsx b/app/client/src/git/components/GlobalProfile/GlobalProfileView.tsx
new file mode 100644
index 000000000000..ddb2d7935387
--- /dev/null
+++ b/app/client/src/git/components/GlobalProfile/GlobalProfileView.tsx
@@ -0,0 +1,148 @@
+import React, { useCallback, useEffect, useState } from "react";
+import {
+ createMessage,
+ AUTHOR_EMAIL,
+ AUTHOR_NAME,
+ SUBMIT,
+} from "ee/constants/messages";
+import { Classes } from "@blueprintjs/core";
+import { Button, Input, toast } from "@appsmith/ads";
+import { emailValidator } from "@appsmith/ads-old";
+import styled from "styled-components";
+import type { FetchGlobalProfileResponseData } from "git/requests/fetchGlobalProfileRequest.types";
+import type { UpdateGlobalProfileInitPayload } from "git/store/actions/updateGlobalProfileActions";
+import noop from "lodash/noop";
+
+const Wrapper = styled.div`
+ width: 320px;
+ & > div {
+ margin-bottom: 16px;
+ }
+`;
+
+const FieldWrapper = styled.div`
+ .user-profile-image-picker {
+ width: 166px;
+ margin-top: 4px;
+ }
+`;
+
+const Loader = styled.div`
+ height: 38px;
+ width: 320px;
+ border-radius: 0;
+`;
+
+interface GlobalProfileViewProps {
+ globalProfile: FetchGlobalProfileResponseData | null;
+ isFetchGlobalProfileLoading: boolean;
+ isUpdateGlobalProfileLoading: boolean;
+ updateGlobalProfile: (data: UpdateGlobalProfileInitPayload) => void;
+}
+
+export default function GlobalProfileView({
+ globalProfile = null,
+ isFetchGlobalProfileLoading = false,
+ isUpdateGlobalProfileLoading = false,
+ updateGlobalProfile = noop,
+}: GlobalProfileViewProps) {
+ const [areFormValuesUpdated, setAreFormValuesUpdated] = useState(false);
+
+ const [authorName, setAuthorNameInState] = useState(
+ globalProfile?.authorName,
+ );
+ const [authorEmail, setAuthorEmailInState] = useState(
+ globalProfile?.authorEmail,
+ );
+
+ const isSubmitDisabled = !authorName || !authorEmail || !areFormValuesUpdated;
+
+ const isLoading = isFetchGlobalProfileLoading || isUpdateGlobalProfileLoading;
+
+ const setAuthorName = useCallback(
+ (value: string) => {
+ setAuthorNameInState(value);
+
+ if (authorName) setAreFormValuesUpdated(true);
+ },
+ [authorName],
+ );
+
+ const setAuthorEmail = useCallback(
+ (value: string) => {
+ setAuthorEmailInState(value);
+
+ if (authorEmail) setAreFormValuesUpdated(true);
+ },
+ [authorEmail],
+ );
+
+ const onClickUpdate = useCallback(() => {
+ if (authorName && authorEmail && emailValidator(authorEmail).isValid) {
+ setAreFormValuesUpdated(false);
+ updateGlobalProfile({ authorName, authorEmail });
+ } else {
+ toast.show("Please enter valid user details");
+ }
+ }, [authorEmail, authorName, updateGlobalProfile]);
+
+ useEffect(
+ function resetOnInitEffect() {
+ setAreFormValuesUpdated(false);
+ setAuthorNameInState(globalProfile?.authorName ?? "");
+ setAuthorEmailInState(globalProfile?.authorEmail ?? "");
+ },
+ [globalProfile],
+ );
+
+ return (
+ <Wrapper>
+ <FieldWrapper>
+ {isLoading && <Loader className={Classes.SKELETON} />}
+ {!isLoading && (
+ <Input
+ data-testid="t--git-author-name"
+ isRequired
+ label={createMessage(AUTHOR_NAME)}
+ labelPosition="top"
+ onChange={setAuthorName}
+ placeholder={createMessage(AUTHOR_NAME)}
+ renderAs="input"
+ size="md"
+ type="text"
+ value={authorName}
+ />
+ )}
+ </FieldWrapper>
+ <FieldWrapper>
+ {isLoading && <Loader className={Classes.SKELETON} />}
+ {!isLoading && (
+ <Input
+ data-testid="t--git-author-email"
+ isRequired
+ label={createMessage(AUTHOR_EMAIL)}
+ labelPosition="top"
+ onChange={setAuthorEmail}
+ placeholder={createMessage(AUTHOR_EMAIL)}
+ renderAs="input"
+ size="md"
+ type="text"
+ value={authorEmail}
+ />
+ )}
+ </FieldWrapper>
+ <FieldWrapper>
+ <div style={{ flex: 1, display: "flex", justifyContent: "flex-end" }}>
+ <Button
+ isDisabled={isSubmitDisabled}
+ isLoading={isLoading}
+ onClick={onClickUpdate}
+ size="md"
+ >
+ {createMessage(SUBMIT)}
+ </Button>
+ </div>
+ </FieldWrapper>
+ </Wrapper>
+ );
+}
diff --git a/app/client/src/git/components/GlobalProfile/index.tsx b/app/client/src/git/components/GlobalProfile/index.tsx
new file mode 100644
index 000000000000..5ecc06e70c87
--- /dev/null
+++ b/app/client/src/git/components/GlobalProfile/index.tsx
@@ -0,0 +1,23 @@
+import useGlobalProfile from "git/hooks/useGlobalProfile";
+import React from "react";
+import GlobalProfileView from "./GlobalProfileView";
+
+function GlobalProfile() {
+ const {
+ globalProfile,
+ isFetchGlobalProfileLoading,
+ isUpdateGlobalProfileLoading,
+ updateGlobalProfile,
+ } = useGlobalProfile();
+
+ return (
+ <GlobalProfileView
+ globalProfile={globalProfile}
+ isFetchGlobalProfileLoading={isFetchGlobalProfileLoading}
+ isUpdateGlobalProfileLoading={isUpdateGlobalProfileLoading}
+ updateGlobalProfile={updateGlobalProfile}
+ />
+ );
+}
+
+export default GlobalProfile;
diff --git a/app/client/src/git/components/ImportModal/index.tsx b/app/client/src/git/components/ImportModal/index.tsx
index f55a468d702b..8192fa9e88a7 100644
--- a/app/client/src/git/components/ImportModal/index.tsx
+++ b/app/client/src/git/components/ImportModal/index.tsx
@@ -1,8 +1,51 @@
-import React from "react";
-import ConnectModal from "../ConnectModal";
+import React, { useCallback } from "react";
+import ConnectModalView from "../ConnectModal/ConnectModalView";
+import type { GitImportRequestParams } from "git/requests/gitImportRequest.types";
+import useImport from "git/hooks/useImport";
+import useGlobalSSHKey from "git/hooks/useGlobalSSHKey";
+import noop from "lodash/noop";
function ImportModal() {
- return <ConnectModal isImport />;
+ const {
+ gitImport,
+ gitImportError,
+ isGitImportLoading,
+ isImportModalOpen,
+ toggleImportModal,
+ } = useImport();
+ const {
+ fetchGlobalSSHKey,
+ globalSSHKey,
+ isFetchGlobalSSHKeyLoading,
+ resetGlobalSSHKey,
+ } = useGlobalSSHKey();
+
+ const sshPublicKey = globalSSHKey?.publicKey ?? null;
+
+ const onSubmit = useCallback(
+ (params: GitImportRequestParams) => {
+ gitImport(params);
+ },
+ [gitImport],
+ );
+
+ return (
+ <ConnectModalView
+ artifactType="artifact"
+ error={gitImportError}
+ isImport
+ isModalOpen={isImportModalOpen}
+ isSSHKeyLoading={isFetchGlobalSSHKeyLoading}
+ isSubmitLoading={isGitImportLoading}
+ onFetchSSHKey={noop}
+ onGenerateSSHKey={fetchGlobalSSHKey}
+ onOpenImport={null}
+ onSubmit={onSubmit}
+ resetSSHKey={resetGlobalSSHKey}
+ sshPublicKey={sshPublicKey}
+ toggleModalOpen={toggleImportModal}
+ />
+ );
}
export default ImportModal;
diff --git a/app/client/src/git/components/OpsModal/TabDeploy/DeployPreview.tsx b/app/client/src/git/components/OpsModal/TabDeploy/DeployPreview.tsx
index 79abbe1439dc..311019abdc24 100644
--- a/app/client/src/git/components/OpsModal/TabDeploy/DeployPreview.tsx
+++ b/app/client/src/git/components/OpsModal/TabDeploy/DeployPreview.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useCallback, useEffect, useState } from "react";
import styled from "styled-components";
import { useSelector } from "react-redux";
@@ -15,32 +15,47 @@ import SuccessTick from "pages/common/SuccessTick";
import { howMuchTimeBeforeText } from "utils/helpers";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { viewerURL } from "ee/RouteBuilder";
-import { Link, Text } from "@appsmith/ads";
-import { importSvg } from "@appsmith/ads-old";
+import { Icon, Link, Text } from "@appsmith/ads";
-const CloudyIcon = importSvg(
- async () => import("assets/icons/ads/cloudy-line.svg"),
-);
+const StyledIcon = styled(Icon)`
+ svg {
+ width: 30px;
+ height: 30px;
+ }
+`;
const Container = styled.div`
display: flex;
flex: 1;
flex-direction: row;
gap: ${(props) => props.theme.spaces[6]}px;
-
- .cloud-icon {
- stroke: var(--ads-v2-color-fg);
- }
`;
-export default function DeployPreview() {
- // ! case: should reset after timer
- const showSuccess = false;
+interface DeployPreviewProps {
+ isCommitSuccess: boolean;
+}
+
+export default function DeployPreview({ isCommitSuccess }: DeployPreviewProps) {
+ const [showSuccess, setShowSuccess] = useState(false);
+
+ useEffect(
+ function startTimerForCommitSuccessEffect() {
+ if (isCommitSuccess) {
+ setShowSuccess(true);
+ const timer = setTimeout(() => {
+ setShowSuccess(false);
+ }, 5000);
+
+ return () => clearTimeout(timer);
+ }
+ },
+ [isCommitSuccess],
+ );
const basePageId = useSelector(getCurrentBasePageId);
const lastDeployedAt = useSelector(getApplicationLastDeployedAt);
- const showDeployPreview = () => {
+ const showDeployPreview = useCallback(() => {
AnalyticsUtil.logEvent("GS_LAST_DEPLOYED_PREVIEW_LINK_CLICK", {
source: "GIT_DEPLOY_MODAL",
});
@@ -49,7 +64,7 @@ export default function DeployPreview() {
});
window.open(path, "_blank");
- };
+ }, [basePageId]);
const lastDeployedAtMsg = lastDeployedAt
? `${createMessage(LATEST_DP_SUBTITLE)} ${howMuchTimeBeforeText(
@@ -66,7 +81,7 @@ export default function DeployPreview() {
{showSuccess ? (
<SuccessTick height="30px" width="30px" />
) : (
- <CloudyIcon className="cloud-icon" />
+ <StyledIcon color="var(--ads-v2-color-fg)" name="cloud-v2" />
)}
</div>
<div>
diff --git a/app/client/src/git/components/OpsModal/TabDeploy/TabDeployView.tsx b/app/client/src/git/components/OpsModal/TabDeploy/TabDeployView.tsx
index d22c93f79b97..a2db0f28805d 100644
--- a/app/client/src/git/components/OpsModal/TabDeploy/TabDeployView.tsx
+++ b/app/client/src/git/components/OpsModal/TabDeploy/TabDeployView.tsx
@@ -108,6 +108,7 @@ function TabDeployView({
statusBehindCount = 0,
statusIsClean = false,
}: TabDeployViewProps) {
+ const [hasSubmitted, setHasSubmitted] = useState(false);
const hasChangesToCommit = !statusIsClean;
const commitInputRef = useRef<HTMLInputElement>(null);
const [commitMessage, setCommitMessage] = useState(
@@ -157,6 +158,10 @@ function TabDeployView({
((pullRequired && !isConflicting) ||
(statusBehindCount > 0 && statusIsClean));
+ const isCommitSuccess = useMemo(() => {
+ return hasSubmitted && !isCommitLoading;
+ }, [isCommitLoading, hasSubmitted]);
+
useEffect(
function focusCommitInputEffect() {
if (!commitInputDisabled && commitInputRef.current) {
@@ -200,6 +205,7 @@ function TabDeployView({
});
if (currentBranch) {
+ setHasSubmitted(true);
commit(commitMessage.trim());
}
}, [commit, commitMessage, currentBranch]);
@@ -353,7 +359,9 @@ function TabDeployView({
/>
)}
- {!pullRequired && !isConflicting && <DeployPreview />}
+ {!pullRequired && !isConflicting && (
+ <DeployPreview isCommitSuccess={isCommitSuccess} />
+ )}
</div>
</ModalBody>
<StyledModalFooter key="footer">
diff --git a/app/client/src/git/components/OpsModal/index.tsx b/app/client/src/git/components/OpsModal/index.tsx
index 114439c29902..66ea3ddf0182 100644
--- a/app/client/src/git/components/OpsModal/index.tsx
+++ b/app/client/src/git/components/OpsModal/index.tsx
@@ -1,14 +1,15 @@
import React from "react";
import OpsModalView from "./OpsModalView";
-import useProtectedBranches from "git/hooks/useProtectedBranches";
import useMetadata from "git/hooks/useMetadata";
import useStatus from "git/hooks/useStatus";
import useOps from "git/hooks/useOps";
+import useProtectedMode from "git/hooks/useProtectedMode";
+import { GitOpsTab } from "git/constants/enums";
export default function OpsModal() {
- const { opsModalOpen, opsModalTab, toggleOpsModal } = useOps();
+ const { isOpsModalOpen, opsModalTab, toggleOpsModal } = useOps();
const { fetchStatus } = useStatus();
- const { isProtectedMode } = useProtectedBranches();
+ const isProtectedMode = useProtectedMode();
const { metadata } = useMetadata();
@@ -17,9 +18,9 @@ export default function OpsModal() {
return (
<OpsModalView
fetchStatus={fetchStatus}
- isOpsModalOpen={opsModalOpen}
+ isOpsModalOpen={isOpsModalOpen}
isProtectedMode={isProtectedMode}
- opsModalTab={opsModalTab}
+ opsModalTab={opsModalTab ?? GitOpsTab.Deploy}
repoName={repoName}
toggleOpsModal={toggleOpsModal}
/>
diff --git a/app/client/src/git/components/ProtectedBranchCallout/ProtectedBranchCalloutView.tsx b/app/client/src/git/components/ProtectedBranchCallout/ProtectedBranchCalloutView.tsx
new file mode 100644
index 000000000000..89b37bbfa239
--- /dev/null
+++ b/app/client/src/git/components/ProtectedBranchCallout/ProtectedBranchCalloutView.tsx
@@ -0,0 +1,85 @@
+import React, { useCallback, useMemo } from "react";
+import { Callout } from "@appsmith/ads";
+import styled from "styled-components";
+import {
+ BRANCH_PROTECTION_CALLOUT_CREATE_BRANCH,
+ BRANCH_PROTECTION_CALLOUT_MSG,
+ BRANCH_PROTECTION_CALLOUT_UNPROTECT,
+ BRANCH_PROTECTION_CALLOUT_UNPROTECT_LOADING,
+ createMessage,
+} from "ee/constants/messages";
+import { noop } from "lodash";
+import type { FetchProtectedBranchesResponseData } from "git/requests/fetchProtectedBranchesRequest.types";
+
+export const PROTECTED_CALLOUT_HEIGHT = 70;
+
+const StyledCallout = styled(Callout)`
+ height: ${PROTECTED_CALLOUT_HEIGHT}px;
+ overflow-y: hidden;
+`;
+
+interface ProtectedBranchCalloutViewProps {
+ currentBranch: string | null;
+ isUpdateProtectedBranchesLoading: boolean;
+ protectedBranches: FetchProtectedBranchesResponseData | null;
+ toggleBranchPopup: (isOpen: boolean) => void;
+ updateProtectedBranches: (branches: string[]) => void;
+}
+
+function ProtectedBranchCalloutView({
+ currentBranch = null,
+ isUpdateProtectedBranchesLoading = false,
+ protectedBranches = null,
+ toggleBranchPopup = noop,
+ updateProtectedBranches = noop,
+}: ProtectedBranchCalloutViewProps) {
+ const handleClickOnNewBranch = useCallback(() => {
+ toggleBranchPopup(true);
+ }, [toggleBranchPopup]);
+
+ const handleClickOnUnprotect = useCallback(() => {
+ const allBranches = protectedBranches || [];
+ const remainingBranches = allBranches.filter(
+ (protectedBranch) => protectedBranch !== currentBranch,
+ );
+
+ updateProtectedBranches(remainingBranches);
+ }, [currentBranch, protectedBranches, updateProtectedBranches]);
+
+ const links = useMemo(
+ () => [
+ {
+ key: "create-branch",
+ "data-testid": "t--git-protected-create-branch-cta",
+ children: createMessage(BRANCH_PROTECTION_CALLOUT_CREATE_BRANCH),
+ onClick: handleClickOnNewBranch,
+ },
+ {
+ key: "unprotect",
+ "data-testid": "t--git-protected-unprotect-branch-cta",
+ children: isUpdateProtectedBranchesLoading
+ ? createMessage(BRANCH_PROTECTION_CALLOUT_UNPROTECT_LOADING)
+ : createMessage(BRANCH_PROTECTION_CALLOUT_UNPROTECT),
+ onClick: handleClickOnUnprotect,
+ isDisabled: isUpdateProtectedBranchesLoading,
+ },
+ ],
+ [
+ handleClickOnNewBranch,
+ handleClickOnUnprotect,
+ isUpdateProtectedBranchesLoading,
+ ],
+ );
+
+ return (
+ <StyledCallout
+ data-testid="t--git-protected-branch-callout"
+ kind="info"
+ links={links}
+ >
+ {createMessage(BRANCH_PROTECTION_CALLOUT_MSG)}
+ </StyledCallout>
+ );
+}
+
+export default ProtectedBranchCalloutView;
diff --git a/app/client/src/git/components/ProtectedBranchCallout/index.tsx b/app/client/src/git/components/ProtectedBranchCallout/index.tsx
new file mode 100644
index 000000000000..aca08dfc1e87
--- /dev/null
+++ b/app/client/src/git/components/ProtectedBranchCallout/index.tsx
@@ -0,0 +1,33 @@
+import React from "react";
+import ProtectedBranchCalloutView from "./ProtectedBranchCalloutView";
+import useProtectedBranches from "git/hooks/useProtectedBranches";
+import useCurrentBranch from "git/hooks/useCurrentBranch";
+import useBranches from "git/hooks/useBranches";
+import useProtectedMode from "git/hooks/useProtectedMode";
+
+function ProtectedBranchCallout() {
+ const isProtectedMode = useProtectedMode();
+ const currentBranch = useCurrentBranch();
+ const { toggleBranchPopup } = useBranches();
+ const {
+ isUpdateProtectedBranchesLoading,
+ protectedBranches,
+ updateProtectedBranches,
+ } = useProtectedBranches();
+
+ if (!isProtectedMode) {
+ return null;
+ }
+
+ return (
+ <ProtectedBranchCalloutView
+ currentBranch={currentBranch}
+ isUpdateProtectedBranchesLoading={isUpdateProtectedBranchesLoading}
+ protectedBranches={protectedBranches}
+ toggleBranchPopup={toggleBranchPopup}
+ updateProtectedBranches={updateProtectedBranches}
+ />
+ );
+}
+
+export default ProtectedBranchCallout;
diff --git a/app/client/src/git/components/QuickActions/QuickActionsView.test.tsx b/app/client/src/git/components/QuickActions/QuickActionsView.test.tsx
index 6e696ddffe55..f6bc193bfc7e 100644
--- a/app/client/src/git/components/QuickActions/QuickActionsView.test.tsx
+++ b/app/client/src/git/components/QuickActions/QuickActionsView.test.tsx
@@ -29,7 +29,7 @@ describe("QuickActionsView Component", () => {
isConnectPermitted: true,
isDiscardLoading: false,
isFetchStatusLoading: false,
- isGitConnected: false,
+ isConnected: false,
isProtectedMode: false,
isPullFailing: false,
isPullLoading: false,
@@ -48,7 +48,7 @@ describe("QuickActionsView Component", () => {
jest.clearAllMocks();
});
- it("should render ConnectButton when isGitConnected is false", () => {
+ it("should render ConnectButton when isConnected is false", () => {
render(
<ThemeProvider theme={theme}>
<QuickActionsView {...defaultProps} />
@@ -57,10 +57,10 @@ describe("QuickActionsView Component", () => {
expect(screen.getByTestId("connect-button")).toBeInTheDocument();
});
- it("should render QuickActionButtons when isGitConnected is true", () => {
+ it("should render QuickActionButtons when isConnected is true", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
};
const { container } = render(
@@ -86,7 +86,7 @@ describe("QuickActionsView Component", () => {
it("should render Statusbar when isAutocommitEnabled and isPollingAutocommit are true", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
isAutocommitEnabled: true,
isAutocommitPolling: true,
};
@@ -106,7 +106,7 @@ describe("QuickActionsView Component", () => {
it("should call onCommitClick when commit button is clicked", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
};
const { container } = render(
@@ -131,7 +131,7 @@ describe("QuickActionsView Component", () => {
it("should call onPullClick when pull button is clicked", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
isDiscardLoading: false,
isPullLoading: false,
isFetchStatusLoading: false,
@@ -159,7 +159,7 @@ describe("QuickActionsView Component", () => {
it("should call onMerge when merge button is clicked", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
};
const { container } = render(
@@ -184,7 +184,7 @@ describe("QuickActionsView Component", () => {
it("should call onSettingsClick when settings button is clicked", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
};
const { container } = render(
@@ -209,7 +209,7 @@ describe("QuickActionsView Component", () => {
it("should disable commit button when isProtectedMode is true", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
isProtectedMode: true,
};
@@ -228,7 +228,7 @@ describe("QuickActionsView Component", () => {
it("should show loading state on pull button when showPullLoadingState is true", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
isPullLoading: true,
};
@@ -250,7 +250,7 @@ describe("QuickActionsView Component", () => {
it("should display changesToCommit count on commit button", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
statusChangeCount: 5,
};
@@ -267,7 +267,7 @@ describe("QuickActionsView Component", () => {
it("should not display count on commit button when isProtectedMode is true", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
isProtectedMode: true,
statusChangeCount: 5,
};
@@ -292,7 +292,7 @@ describe("QuickActionsView Component", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
};
const { container } = render(
@@ -310,7 +310,7 @@ describe("QuickActionsView Component", () => {
it("should show behindCount on pull button", () => {
const props = {
...defaultProps,
- isGitConnected: true,
+ isConnected: true,
statusBehindCount: 3,
statusIsClean: true,
};
diff --git a/app/client/src/git/components/QuickActions/QuickActionsView.tsx b/app/client/src/git/components/QuickActions/QuickActionsView.tsx
index 396984788015..274dd00f3dba 100644
--- a/app/client/src/git/components/QuickActions/QuickActionsView.tsx
+++ b/app/client/src/git/components/QuickActions/QuickActionsView.tsx
@@ -33,7 +33,7 @@ interface QuickActionsViewProps {
isConnectPermitted: boolean;
isDiscardLoading: boolean;
isFetchStatusLoading: boolean;
- isGitConnected: boolean;
+ isConnected: boolean;
isProtectedMode: boolean;
isPullFailing: boolean;
isPullLoading: boolean;
@@ -57,10 +57,10 @@ function QuickActionsView({
isAutocommitEnabled = false,
isAutocommitPolling = false,
isBranchPopupOpen = false,
+ isConnected = false,
isConnectPermitted = false,
isDiscardLoading = false,
isFetchStatusLoading = false,
- isGitConnected = false,
isProtectedMode = false,
isPullFailing = false,
isPullLoading = false,
@@ -131,7 +131,7 @@ function QuickActionsView({
toggleConnectModal(true);
}, [toggleConnectModal]);
- return isGitConnected ? (
+ return isConnected ? (
<Container>
<BranchButton
currentBranch={currentBranch}
diff --git a/app/client/src/git/components/QuickActions/index.tsx b/app/client/src/git/components/QuickActions/index.tsx
index 2b03ee8bdd1d..af155116075e 100644
--- a/app/client/src/git/components/QuickActions/index.tsx
+++ b/app/client/src/git/components/QuickActions/index.tsx
@@ -1,25 +1,25 @@
import React from "react";
import QuickActionsView from "./QuickActionsView";
import useStatusChangeCount from "./hooks/useStatusChangeCount";
-import useProtectedBranches from "git/hooks/useProtectedBranches";
import useGitPermissions from "git/hooks/useGitPermissions";
import useAutocommit from "git/hooks/useAutocommit";
import useSettings from "git/hooks/useSettings";
-import useMetadata from "git/hooks/useMetadata";
import useConnect from "git/hooks/useConnect";
import useDiscard from "git/hooks/useDiscard";
import usePull from "git/hooks/usePull";
import useStatus from "git/hooks/useStatus";
import useOps from "git/hooks/useOps";
import useBranches from "git/hooks/useBranches";
+import useConnected from "git/hooks/useConnected";
+import useProtectedMode from "git/hooks/useProtectedMode";
function QuickActions() {
+ const isConnected = useConnected();
const { toggleOpsModal } = useOps();
const { isFetchStatusLoading, status } = useStatus();
const { isPullLoading, pull, pullError } = usePull();
const { discard, isDiscardLoading } = useDiscard();
- const { isGitConnected } = useMetadata();
- const { isProtectedMode } = useProtectedBranches();
+ const isProtectedMode = useProtectedMode();
const { isConnectPermitted } = useGitPermissions();
const {
isAutocommitEnabled,
@@ -43,9 +43,9 @@ function QuickActions() {
isAutocommitPolling={isAutocommitPolling}
isBranchPopupOpen={isBranchPopupOpen}
isConnectPermitted={isConnectPermitted}
+ isConnected={isConnected}
isDiscardLoading={isDiscardLoading}
isFetchStatusLoading={isFetchStatusLoading}
- isGitConnected={isGitConnected}
isProtectedMode={isProtectedMode}
isPullFailing={isPullFailing}
isPullLoading={isPullLoading}
diff --git a/app/client/src/git/components/SettingsModal/index.tsx b/app/client/src/git/components/SettingsModal/index.tsx
index 47ca695ab500..968c8030312e 100644
--- a/app/client/src/git/components/SettingsModal/index.tsx
+++ b/app/client/src/git/components/SettingsModal/index.tsx
@@ -2,6 +2,7 @@ import React from "react";
import SettingsModalView from "./SettingsModalView";
import useGitPermissions from "git/hooks/useGitPermissions";
import useSettings from "git/hooks/useSettings";
+import { GitSettingsTab } from "git/constants/enums";
function SettingsModal() {
const { isSettingsModalOpen, settingsModalTab, toggleSettingsModal } =
@@ -21,7 +22,7 @@ function SettingsModal() {
isManageDefaultBranchPermitted={isManageDefaultBranchPermitted}
isManageProtectedBranchesPermitted={isManageProtectedBranchesPermitted}
isSettingsModalOpen={isSettingsModalOpen}
- settingsModalTab={settingsModalTab}
+ settingsModalTab={settingsModalTab ?? GitSettingsTab.General}
toggleSettingsModal={toggleSettingsModal}
/>
);
diff --git a/app/client/src/git/components/StatusChanges/StatusChangesView.tsx b/app/client/src/git/components/StatusChanges/StatusChangesView.tsx
index c3768c0d866c..f8e6f0c41dfa 100644
--- a/app/client/src/git/components/StatusChanges/StatusChangesView.tsx
+++ b/app/client/src/git/components/StatusChanges/StatusChangesView.tsx
@@ -1,14 +1,19 @@
import type { FetchStatusResponseData } from "git/requests/fetchStatusRequest.types";
import React, { useMemo } from "react";
-import type { StatusTreeStruct } from "./StatusTree";
import StatusTree from "./StatusTree";
-import { Text } from "@appsmith/ads";
+import { Callout, Text } from "@appsmith/ads";
import { createMessage } from "@appsmith/ads-old";
import {
CHANGES_SINCE_LAST_DEPLOYMENT,
FETCH_GIT_STATUS,
} from "ee/constants/messages";
-import StatusLoader from "pages/Editor/gitSync/components/StatusLoader";
+import StatusLoader from "./StatusLoader";
+import type { StatusTreeStruct } from "./types";
+import styled from "styled-components";
+
+const CalloutContainer = styled.div`
+ margin-top: 16px;
+`;
const noopStatusTransformer = () => null;
@@ -49,6 +54,11 @@ export default function StatusChangesView({
{createMessage(CHANGES_SINCE_LAST_DEPLOYMENT)}
</Text>
<StatusTree tree={statusTree} />
+ {status.migrationMessage ? (
+ <CalloutContainer>
+ <Callout kind="info">{status.migrationMessage}</Callout>
+ </CalloutContainer>
+ ) : null}
</div>
);
}
diff --git a/app/client/src/git/components/StatusChanges/StatusLoader.tsx b/app/client/src/git/components/StatusChanges/StatusLoader.tsx
index bc0427bd6521..9026b75b38fa 100644
--- a/app/client/src/git/components/StatusChanges/StatusLoader.tsx
+++ b/app/client/src/git/components/StatusChanges/StatusLoader.tsx
@@ -6,16 +6,18 @@ const LoaderWrapper = styled.div`
display: flex;
flex-direction: row;
align-items: center;
- margin-top: ${(props) => `${props.theme.spaces[3]}px`};
+ margin-bottom: 8px;
+`;
+
+const LoaderText = styled(Text)`
+ margin-left: 8px;
`;
function StatusLoader({ loaderMsg }: { loaderMsg: string }) {
return (
<LoaderWrapper data-testid="t--git-merge-loader">
<Spinner size="md" />
- <Text kind={"body-m"} style={{ marginLeft: 8 }}>
- {loaderMsg}
- </Text>
+ <LoaderText kind="body-m">{loaderMsg}</LoaderText>
</LoaderWrapper>
);
}
diff --git a/app/client/src/git/components/StatusChanges/StatusTree.tsx b/app/client/src/git/components/StatusChanges/StatusTree.tsx
index 289d2d28b796..437163d394df 100644
--- a/app/client/src/git/components/StatusChanges/StatusTree.tsx
+++ b/app/client/src/git/components/StatusChanges/StatusTree.tsx
@@ -7,12 +7,17 @@ import {
Text,
} from "@appsmith/ads";
import clsx from "clsx";
+import styled from "styled-components";
+import type { StatusTreeStruct } from "./types";
-export interface StatusTreeStruct {
- icon: string;
- message: string;
- children?: StatusTreeStruct[];
-}
+const StyledCollapsible = styled(Collapsible)`
+ gap: 0;
+`;
+
+const StyledCollapsibleHeader = styled(CollapsibleHeader)`
+ padding-top: 0;
+ padding-bottom: 0;
+`;
interface StatusTreeNodeProps {
icon: string;
@@ -43,29 +48,31 @@ interface SingleStatusTreeProps {
function SingleStatusTree({ depth = 1, tree }: SingleStatusTreeProps) {
if (!tree) return null;
+ const noEmphasis = depth > 1 && !tree.children;
+
if (!tree.children) {
return (
<StatusTreeNode
icon={tree.icon}
message={tree.message}
- noEmphasis={depth > 2}
+ noEmphasis={noEmphasis}
/>
);
}
return (
- <Collapsible className="!mt-0 !gap-0">
- <CollapsibleHeader>
+ <StyledCollapsible className="space-y-2">
+ <StyledCollapsibleHeader arrowPosition="start">
<StatusTreeNode icon={tree.icon} message={tree.message} />
- </CollapsibleHeader>
+ </StyledCollapsibleHeader>
<CollapsibleContent
- className={clsx("ml-6", depth < 2 ? "space-y-2" : "space-y-1")}
+ className={clsx("ml-6", noEmphasis ? "space-y-1" : "space-y-2")}
>
{tree.children.map((child, index) => (
<SingleStatusTree depth={depth + 1} key={index} tree={child} />
))}
</CollapsibleContent>
- </Collapsible>
+ </StyledCollapsible>
);
}
diff --git a/app/client/src/git/components/StatusChanges/types.ts b/app/client/src/git/components/StatusChanges/types.ts
new file mode 100644
index 000000000000..61a8e074714b
--- /dev/null
+++ b/app/client/src/git/components/StatusChanges/types.ts
@@ -0,0 +1,5 @@
+export interface StatusTreeStruct {
+ icon: string;
+ message: string;
+ children?: StatusTreeStruct[];
+}
diff --git a/app/client/src/git/components/index.tsx b/app/client/src/git/components/index.tsx
deleted file mode 100644
index c3a1640dbd01..000000000000
--- a/app/client/src/git/components/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export { default as GitModals } from "git/ee/components/GitModals";
-export { default as GitImportModal } from "./ImportModal";
-export { default as GitQuickActions } from "./QuickActions";
diff --git a/app/client/src/git/hooks/useArtifactSelector.ts b/app/client/src/git/hooks/useArtifactSelector.ts
new file mode 100644
index 000000000000..dba2a0808bf3
--- /dev/null
+++ b/app/client/src/git/hooks/useArtifactSelector.ts
@@ -0,0 +1,29 @@
+import { useGitContext } from "git/components/GitContextProvider";
+import type { GitArtifactDef, GitRootState } from "git/store/types";
+import { useSelector } from "react-redux";
+import type { Tail } from "redux-saga/effects";
+
+/**
+ * This hook is used to select data from the redux store based on the artifactDef.
+ **/
+export default function useArtifactSelector<
+ // need any type to properly infer the return type
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ Fn extends (state: any, artifactDef: GitArtifactDef, ...args: any[]) => any,
+>(selector: Fn, ...args: Tail<Tail<Parameters<Fn>>>): ReturnType<Fn> | null {
+ const { artifactDef } = useGitContext();
+
+ return useSelector((state: GitRootState) => {
+ if (typeof selector !== "function" || !artifactDef) {
+ return null;
+ }
+
+ const { artifactType, baseArtifactId } = artifactDef;
+
+ if (!state.git?.artifacts?.[artifactType]?.[baseArtifactId]) {
+ return null;
+ }
+
+ return selector(state, artifactDef, ...args);
+ });
+}
diff --git a/app/client/src/git/hooks/useAutocommit.ts b/app/client/src/git/hooks/useAutocommit.ts
index 73d7d955caca..91ad0e8aaae5 100644
--- a/app/client/src/git/hooks/useAutocommit.ts
+++ b/app/client/src/git/hooks/useAutocommit.ts
@@ -6,50 +6,50 @@ import {
selectAutocommitPolling,
selectToggleAutocommitState,
selectTriggerAutocommitState,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useAutocommit() {
const { artifactDef } = useGitContext();
const dispatch = useDispatch();
- const toggleAutocommitState = useSelector((state: GitRootState) =>
- selectToggleAutocommitState(state, artifactDef),
+ const toggleAutocommitState = useArtifactSelector(
+ selectToggleAutocommitState,
);
- const triggerAutocommitState = useSelector((state: GitRootState) =>
- selectTriggerAutocommitState(state, artifactDef),
+ const triggerAutocommitState = useArtifactSelector(
+ selectTriggerAutocommitState,
);
const toggleAutocommit = useCallback(() => {
- dispatch(gitArtifactActions.toggleAutocommitInit(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.toggleAutocommitInit({ artifactDef }));
+ }
}, [artifactDef, dispatch]);
- const isAutocommitDisableModalOpen = useSelector((state: GitRootState) =>
- selectAutocommitDisableModalOpen(state, artifactDef),
+ const isAutocommitDisableModalOpen = useArtifactSelector(
+ selectAutocommitDisableModalOpen,
);
const toggleAutocommitDisableModal = useCallback(
(open: boolean) => {
- dispatch(
- gitArtifactActions.toggleAutocommitDisableModal({
- ...artifactDef,
- open,
- }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.toggleAutocommitDisableModal({
+ artifactDef,
+ open,
+ }),
+ );
+ }
},
[artifactDef, dispatch],
);
- const isAutocommitEnabled = useSelector((state: GitRootState) =>
- selectAutocommitEnabled(state, artifactDef),
- );
+ const isAutocommitEnabled = useArtifactSelector(selectAutocommitEnabled);
- const isAutocommitPolling = useSelector((state: GitRootState) =>
- selectAutocommitPolling(state, artifactDef),
- );
+ const isAutocommitPolling = useArtifactSelector(selectAutocommitPolling);
return {
isToggleAutocommitLoading: toggleAutocommitState?.loading ?? false,
@@ -57,9 +57,9 @@ export default function useAutocommit() {
toggleAutocommit,
isTriggerAutocommitLoading: triggerAutocommitState?.loading ?? false,
triggerAutocommitError: triggerAutocommitState?.error ?? null,
- isAutocommitDisableModalOpen,
+ isAutocommitDisableModalOpen: isAutocommitDisableModalOpen ?? false,
toggleAutocommitDisableModal,
- isAutocommitEnabled,
- isAutocommitPolling,
+ isAutocommitEnabled: isAutocommitEnabled ?? false,
+ isAutocommitPolling: isAutocommitPolling ?? false,
};
}
diff --git a/app/client/src/git/hooks/useBranches.ts b/app/client/src/git/hooks/useBranches.ts
index 4a0ecead44d7..fe85a318b8d4 100644
--- a/app/client/src/git/hooks/useBranches.ts
+++ b/app/client/src/git/hooks/useBranches.ts
@@ -8,103 +8,105 @@ import {
selectCreateBranchState,
selectDeleteBranchState,
selectCurrentBranch,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useBranches() {
- const { artifactDef } = useGitContext();
+ const { artifact, artifactDef } = useGitContext();
+ const artifactId = artifact?.id;
const dispatch = useDispatch();
// fetch branches
- const branchesState = useSelector((state: GitRootState) =>
- selectFetchBranchesState(state, artifactDef),
- );
+ const branchesState = useArtifactSelector(selectFetchBranchesState);
+
const fetchBranches = useCallback(() => {
- dispatch(
- gitArtifactActions.fetchBranchesInit({
- ...artifactDef,
- pruneBranches: true,
- }),
- );
- }, [artifactDef, dispatch]);
+ if (artifactDef && artifactId) {
+ dispatch(
+ gitArtifactActions.fetchBranchesInit({
+ artifactId,
+ artifactDef,
+ pruneBranches: true,
+ }),
+ );
+ }
+ }, [artifactDef, artifactId, dispatch]);
// create branch
- const createBranchState = useSelector((state: GitRootState) =>
- selectCreateBranchState(state, artifactDef),
- );
+ const createBranchState = useArtifactSelector(selectCreateBranchState);
const createBranch = useCallback(
(branchName: string) => {
- dispatch(
- gitArtifactActions.createBranchInit({
- ...artifactDef,
- branchName,
- }),
- );
+ if (artifactDef && artifactId) {
+ dispatch(
+ gitArtifactActions.createBranchInit({
+ artifactDef,
+ artifactId,
+ branchName,
+ }),
+ );
+ }
},
- [artifactDef, dispatch],
+ [artifactDef, artifactId, dispatch],
);
// delete branch
- const deleteBranchState = useSelector((state: GitRootState) =>
- selectDeleteBranchState(state, artifactDef),
- );
+ const deleteBranchState = useArtifactSelector(selectDeleteBranchState);
const deleteBranch = useCallback(
(branchName: string) => {
- dispatch(
- gitArtifactActions.deleteBranchInit({
- ...artifactDef,
- branchName,
- }),
- );
+ if (artifactDef && artifactId) {
+ dispatch(
+ gitArtifactActions.deleteBranchInit({
+ artifactId,
+ artifactDef,
+ branchName,
+ }),
+ );
+ }
},
- [artifactDef, dispatch],
+ [artifactDef, artifactId, dispatch],
);
// checkout branch
- const checkoutBranchState = useSelector((state: GitRootState) =>
- selectCheckoutBranchState(state, artifactDef),
- );
+ const checkoutBranchState = useArtifactSelector(selectCheckoutBranchState);
const checkoutBranch = useCallback(
(branchName: string) => {
- dispatch(
- gitArtifactActions.checkoutBranchInit({
- ...artifactDef,
- branchName,
- }),
- );
+ if (artifactDef && artifactId) {
+ dispatch(
+ gitArtifactActions.checkoutBranchInit({
+ artifactDef,
+ artifactId,
+ branchName,
+ }),
+ );
+ }
},
- [artifactDef, dispatch],
+ [artifactDef, artifactId, dispatch],
);
- const checkoutDestBranch = useSelector((state: GitRootState) =>
- selectCheckoutDestBranch(state, artifactDef),
- );
+ const checkoutDestBranch = useArtifactSelector(selectCheckoutDestBranch);
// derived
- const currentBranch = useSelector((state: GitRootState) =>
- selectCurrentBranch(state, artifactDef),
- );
+ const currentBranch = useArtifactSelector(selectCurrentBranch);
// git branch list popup
- const isBranchPopupOpen = useSelector((state: GitRootState) =>
- selectBranchPopupOpen(state, artifactDef),
- );
+ const isBranchPopupOpen = useArtifactSelector(selectBranchPopupOpen);
const toggleBranchPopup = useCallback(
(open: boolean) => {
- dispatch(
- gitArtifactActions.toggleBranchPopup({
- ...artifactDef,
- open,
- }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.toggleBranchPopup({
+ artifactDef,
+ open,
+ }),
+ );
+ }
},
[artifactDef, dispatch],
);
return {
- branches: branchesState?.value,
+ branches: branchesState?.value ?? null,
isFetchBranchesLoading: branchesState?.loading ?? false,
fetchBranchesError: branchesState?.error ?? null,
fetchBranches,
@@ -119,7 +121,7 @@ export default function useBranches() {
checkoutBranch,
checkoutDestBranch,
currentBranch: currentBranch ?? null,
- isBranchPopupOpen,
+ isBranchPopupOpen: isBranchPopupOpen ?? false,
toggleBranchPopup,
};
}
diff --git a/app/client/src/git/hooks/useCommit.ts b/app/client/src/git/hooks/useCommit.ts
index 56f78cc11bcd..6a468046a84b 100644
--- a/app/client/src/git/hooks/useCommit.ts
+++ b/app/client/src/git/hooks/useCommit.ts
@@ -1,38 +1,43 @@
import { useGitContext } from "git/components/GitContextProvider";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
-import { selectCommitState } from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+import { selectCommitState } from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useCommit() {
- const { artifactDef } = useGitContext();
+ const { artifact, artifactDef } = useGitContext();
+ const artifactId = artifact?.id;
+
const dispatch = useDispatch();
- const commitState = useSelector((state: GitRootState) =>
- selectCommitState(state, artifactDef),
- );
+ const commitState = useArtifactSelector(selectCommitState);
const commit = useCallback(
(commitMessage: string) => {
- dispatch(
- gitArtifactActions.commitInit({
- ...artifactDef,
- commitMessage,
- doPush: true,
- }),
- );
+ if (artifactDef && artifactId) {
+ dispatch(
+ gitArtifactActions.commitInit({
+ artifactId,
+ artifactDef,
+ commitMessage,
+ doPush: true,
+ }),
+ );
+ }
},
- [artifactDef, dispatch],
+ [artifactDef, artifactId, dispatch],
);
const clearCommitError = useCallback(() => {
- dispatch(gitArtifactActions.clearCommitError(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.clearCommitError({ artifactDef }));
+ }
}, [artifactDef, dispatch]);
return {
isCommitLoading: commitState?.loading ?? false,
- commitError: commitState?.error,
+ commitError: commitState?.error ?? null,
commit,
clearCommitError,
};
diff --git a/app/client/src/git/hooks/useConnect.ts b/app/client/src/git/hooks/useConnect.ts
index 1064ce7ff26e..884addac0fd7 100644
--- a/app/client/src/git/hooks/useConnect.ts
+++ b/app/client/src/git/hooks/useConnect.ts
@@ -4,82 +4,53 @@ import { gitArtifactActions } from "git/store/gitArtifactSlice";
import {
selectConnectModalOpen,
selectConnectState,
- selectFetchSSHKeysState,
- selectGenerateSSHKeyState,
- selectGitImportState,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+ selectConnectSuccessModalOpen,
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
import { useDispatch } from "react-redux";
-import { useSelector } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useConnect() {
const { artifactDef } = useGitContext();
const dispatch = useDispatch();
- const connectState = useSelector((state: GitRootState) =>
- selectConnectState(state, artifactDef),
- );
+ const connectState = useArtifactSelector(selectConnectState);
const connect = useCallback(
(params: ConnectRequestParams) => {
- dispatch(gitArtifactActions.connectInit({ ...artifactDef, ...params }));
- },
- [artifactDef, dispatch],
- );
-
- const gitImportState = useSelector((state: GitRootState) =>
- selectGitImportState(state, artifactDef),
- );
-
- const gitImport = useCallback(
- (params) => {
- dispatch(gitArtifactActions.gitImportInit({ ...artifactDef, ...params }));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.connectInit({ artifactDef, ...params }));
+ }
},
[artifactDef, dispatch],
);
- const fetchSSHKeyState = useSelector((state: GitRootState) =>
- selectFetchSSHKeysState(state, artifactDef),
- );
-
- const fetchSSHKey = useCallback(() => {
- dispatch(gitArtifactActions.fetchSSHKeyInit(artifactDef));
- }, [artifactDef, dispatch]);
-
- const resetFetchSSHKey = useCallback(() => {
- dispatch(gitArtifactActions.resetFetchSSHKey(artifactDef));
- }, [artifactDef, dispatch]);
-
- const generateSSHKeyState = useSelector((state: GitRootState) =>
- selectGenerateSSHKeyState(state, artifactDef),
- );
+ const isConnectModalOpen = useArtifactSelector(selectConnectModalOpen);
- const generateSSHKey = useCallback(
- (keyType: string, isImport: boolean = false) => {
- dispatch(
- gitArtifactActions.generateSSHKeyInit({
- ...artifactDef,
- keyType,
- isImport,
- }),
- );
+ const toggleConnectModal = useCallback(
+ (open: boolean) => {
+ if (artifactDef) {
+ dispatch(gitArtifactActions.toggleConnectModal({ artifactDef, open }));
+ }
},
[artifactDef, dispatch],
);
- const resetGenerateSSHKey = useCallback(() => {
- dispatch(gitArtifactActions.resetGenerateSSHKey(artifactDef));
- }, [artifactDef, dispatch]);
-
- const isConnectModalOpen = useSelector((state: GitRootState) =>
- selectConnectModalOpen(state, artifactDef),
+ const isConnectSuccessModalOpen = useArtifactSelector(
+ selectConnectSuccessModalOpen,
);
- const toggleConnectModal = useCallback(
+ const toggleConnectSuccessModal = useCallback(
(open: boolean) => {
- dispatch(gitArtifactActions.toggleConnectModal({ ...artifactDef, open }));
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.toggleConnectSuccessModal({
+ artifactDef,
+ open,
+ }),
+ );
+ }
},
[artifactDef, dispatch],
);
@@ -88,19 +59,9 @@ export default function useConnect() {
isConnectLoading: connectState?.loading ?? false,
connectError: connectState?.error ?? null,
connect,
- isGitImportLoading: gitImportState?.loading ?? false,
- gitImportError: gitImportState?.error ?? null,
- gitImport,
- sshKey: fetchSSHKeyState?.value ?? null,
- isFetchSSHKeyLoading: fetchSSHKeyState?.loading ?? false,
- fetchSSHKeyError: fetchSSHKeyState?.error ?? null,
- fetchSSHKey,
- resetFetchSSHKey,
- isGenerateSSHKeyLoading: generateSSHKeyState?.loading ?? false,
- generateSSHKeyError: generateSSHKeyState?.error ?? null,
- generateSSHKey,
- resetGenerateSSHKey,
- isConnectModalOpen,
+ isConnectModalOpen: isConnectModalOpen ?? false,
toggleConnectModal,
+ isConnectSuccessModalOpen: isConnectSuccessModalOpen ?? false,
+ toggleConnectSuccessModal,
};
}
diff --git a/app/client/src/git/hooks/useConnected.ts b/app/client/src/git/hooks/useConnected.ts
new file mode 100644
index 000000000000..39cfa55ca245
--- /dev/null
+++ b/app/client/src/git/hooks/useConnected.ts
@@ -0,0 +1,8 @@
+import { selectConnected } from "git/store/selectors/gitArtifactSelectors";
+import useArtifactSelector from "./useArtifactSelector";
+
+export default function useConnected() {
+ const isConnected = useArtifactSelector(selectConnected);
+
+ return isConnected ?? false;
+}
diff --git a/app/client/src/git/hooks/useCurrentBranch.ts b/app/client/src/git/hooks/useCurrentBranch.ts
new file mode 100644
index 000000000000..797d8d598ba5
--- /dev/null
+++ b/app/client/src/git/hooks/useCurrentBranch.ts
@@ -0,0 +1,8 @@
+import { selectCurrentBranch } from "git/store/selectors/gitArtifactSelectors";
+import useArtifactSelector from "./useArtifactSelector";
+
+export default function useCurrentBranch() {
+ const currentBranch = useArtifactSelector(selectCurrentBranch);
+
+ return currentBranch;
+}
diff --git a/app/client/src/git/hooks/useDiscard.ts b/app/client/src/git/hooks/useDiscard.ts
index 2f71c11608f9..19818cb7f8fa 100644
--- a/app/client/src/git/hooks/useDiscard.ts
+++ b/app/client/src/git/hooks/useDiscard.ts
@@ -1,24 +1,26 @@
import { useGitContext } from "git/components/GitContextProvider";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
-import { selectDiscardState } from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+import { selectDiscardState } from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useDiscard() {
const { artifactDef } = useGitContext();
const dispatch = useDispatch();
- const discardState = useSelector((state: GitRootState) =>
- selectDiscardState(state, artifactDef),
- );
+ const discardState = useArtifactSelector(selectDiscardState);
const discard = useCallback(() => {
- dispatch(gitArtifactActions.discardInit(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.discardInit({ artifactDef }));
+ }
}, [artifactDef, dispatch]);
const clearDiscardError = useCallback(() => {
- dispatch(gitArtifactActions.clearDiscardError(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.clearDiscardError({ artifactDef }));
+ }
}, [artifactDef, dispatch]);
return {
diff --git a/app/client/src/git/hooks/useDisconnect.ts b/app/client/src/git/hooks/useDisconnect.ts
index 36dfd2cf8cf9..42fd878319fd 100644
--- a/app/client/src/git/hooks/useDisconnect.ts
+++ b/app/client/src/git/hooks/useDisconnect.ts
@@ -4,10 +4,10 @@ import {
selectDisconnectArtifactName,
selectDisconnectBaseArtifactId,
selectDisconnectState,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useDisconnect() {
const { artifact, artifactDef } = useGitContext();
@@ -15,30 +15,38 @@ export default function useDisconnect() {
const dispatch = useDispatch();
- const disconnectState = useSelector((state: GitRootState) =>
- selectDisconnectState(state, artifactDef),
- );
+ const disconnectState = useArtifactSelector(selectDisconnectState);
const disconnect = useCallback(() => {
- dispatch(gitArtifactActions.disconnectInit(artifactDef));
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.disconnectInit({
+ artifactDef,
+ }),
+ );
+ }
}, [artifactDef, dispatch]);
- const disconnectBaseArtifactId = useSelector((state: GitRootState) =>
- selectDisconnectBaseArtifactId(state, artifactDef),
+ const disconnectBaseArtifactId = useArtifactSelector(
+ selectDisconnectBaseArtifactId,
);
- const disconnectArtifactName = useSelector((state: GitRootState) =>
- selectDisconnectArtifactName(state, artifactDef),
+ const disconnectArtifactName = useArtifactSelector(
+ selectDisconnectArtifactName,
);
const openDisconnectModal = useCallback(() => {
- dispatch(
- gitArtifactActions.openDisconnectModal({ ...artifactDef, artifactName }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.openDisconnectModal({ artifactDef, artifactName }),
+ );
+ }
}, [artifactDef, artifactName, dispatch]);
const closeDisconnectModal = useCallback(() => {
- dispatch(gitArtifactActions.closeDisconnectModal(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.closeDisconnectModal({ artifactDef }));
+ }
}, [artifactDef, dispatch]);
return {
diff --git a/app/client/src/git/hooks/useGitPermissions.ts b/app/client/src/git/hooks/useGitPermissions.ts
index 3279dcd3e00e..13ca2404a161 100644
--- a/app/client/src/git/hooks/useGitPermissions.ts
+++ b/app/client/src/git/hooks/useGitPermissions.ts
@@ -10,47 +10,46 @@ import { useMemo } from "react";
export default function useGitPermissions() {
const { artifact, artifactDef } = useGitContext();
- const { artifactType } = artifactDef;
const isConnectPermitted = useMemo(() => {
if (artifact) {
- if (artifactType === GitArtifactType.Application) {
+ if (artifactDef?.artifactType === GitArtifactType.Application) {
return hasConnectToGitPermission(artifact.userPermissions);
}
}
return false;
- }, [artifact, artifactType]);
+ }, [artifact, artifactDef?.artifactType]);
const isManageDefaultBranchPermitted = useMemo(() => {
if (artifact) {
- if (artifactType === GitArtifactType.Application) {
+ if (artifactDef?.artifactType === GitArtifactType.Application) {
return hasManageDefaultBranchPermission(artifact.userPermissions);
}
}
return false;
- }, [artifact, artifactType]);
+ }, [artifact, artifactDef?.artifactType]);
const isManageProtectedBranchesPermitted = useMemo(() => {
if (artifact) {
- if (artifactType === GitArtifactType.Application) {
+ if (artifactDef?.artifactType === GitArtifactType.Application) {
return hasManageProtectedBranchesPermission(artifact.userPermissions);
}
}
return false;
- }, [artifact, artifactType]);
+ }, [artifact, artifactDef?.artifactType]);
const isManageAutocommitPermitted = useMemo(() => {
if (artifact) {
- if (artifactType === GitArtifactType.Application) {
+ if (artifactDef?.artifactType === GitArtifactType.Application) {
return hasManageAutoCommitPermission(artifact.userPermissions);
}
}
return false;
- }, [artifact, artifactType]);
+ }, [artifact, artifactDef?.artifactType]);
return {
isConnectPermitted,
diff --git a/app/client/src/git/hooks/useGlobalProfile.ts b/app/client/src/git/hooks/useGlobalProfile.ts
index f319f9c1f5db..3cc3a80aad98 100644
--- a/app/client/src/git/hooks/useGlobalProfile.ts
+++ b/app/client/src/git/hooks/useGlobalProfile.ts
@@ -1,9 +1,9 @@
import type { UpdateGlobalProfileRequestParams } from "git/requests/updateGlobalProfileRequest.types";
-import { gitConfigActions } from "git/store/gitConfigSlice";
+import { gitGlobalActions } from "git/store/gitGlobalSlice";
import {
selectFetchGlobalProfileState,
selectUpdateGlobalProfileState,
-} from "git/store/selectors/gitConfigSelectors";
+} from "git/store/selectors/gitGlobalSelectors";
import type { GitRootState } from "git/store/types";
import { useCallback } from "react";
@@ -16,7 +16,7 @@ export default function useGlobalProfile() {
);
const fetchGlobalProfile = useCallback(() => {
- dispatch(gitConfigActions.fetchGlobalProfileInit());
+ dispatch(gitGlobalActions.fetchGlobalProfileInit());
}, [dispatch]);
const updateGlobalProfileState = useSelector((state: GitRootState) =>
@@ -25,7 +25,7 @@ export default function useGlobalProfile() {
const updateGlobalProfile = useCallback(
(params: UpdateGlobalProfileRequestParams) => {
- dispatch(gitConfigActions.updateGlobalProfileInit(params));
+ dispatch(gitGlobalActions.updateGlobalProfileInit(params));
},
[dispatch],
);
diff --git a/app/client/src/git/hooks/useGlobalSSHKey.ts b/app/client/src/git/hooks/useGlobalSSHKey.ts
new file mode 100644
index 000000000000..ac7216045a6a
--- /dev/null
+++ b/app/client/src/git/hooks/useGlobalSSHKey.ts
@@ -0,0 +1,29 @@
+import { useCallback } from "react";
+import { useDispatch, useSelector } from "react-redux";
+import { selectFetchGlobalSSHKeyState } from "git/store/selectors/gitGlobalSelectors";
+import { gitGlobalActions } from "git/store/gitGlobalSlice";
+
+export default function useGlobalSSHKey() {
+ const dispatch = useDispatch();
+
+ const globalSSHKeyState = useSelector(selectFetchGlobalSSHKeyState);
+
+ const fetchGlobalSSHKey = useCallback(
+ (keyType: string) => {
+ dispatch(gitGlobalActions.fetchGlobalSSHKeyInit({ keyType }));
+ },
+ [dispatch],
+ );
+
+ const resetGlobalSSHKey = useCallback(() => {
+ dispatch(gitGlobalActions.resetGlobalSSHKey());
+ }, [dispatch]);
+
+ return {
+ globalSSHKey: globalSSHKeyState?.value ?? null,
+ globalSSHKeyError: globalSSHKeyState?.error ?? null,
+ isFetchGlobalSSHKeyLoading: globalSSHKeyState?.loading ?? false,
+ fetchGlobalSSHKey,
+ resetGlobalSSHKey,
+ };
+}
diff --git a/app/client/src/git/hooks/useImport.ts b/app/client/src/git/hooks/useImport.ts
new file mode 100644
index 000000000000..62069b888d68
--- /dev/null
+++ b/app/client/src/git/hooks/useImport.ts
@@ -0,0 +1,38 @@
+import { useCallback } from "react";
+import { useDispatch, useSelector } from "react-redux";
+import {
+ selectGitImportState,
+ selectImportModalOpen,
+} from "git/store/selectors/gitGlobalSelectors";
+import { gitGlobalActions } from "git/store/gitGlobalSlice";
+import type { GitImportRequestParams } from "git/requests/gitImportRequest.types";
+
+export default function useImport() {
+ const dispatch = useDispatch();
+
+ const gitImportState = useSelector(selectGitImportState);
+
+ const gitImport = useCallback(
+ (params: GitImportRequestParams) => {
+ dispatch(gitGlobalActions.gitImportInit(params));
+ },
+ [dispatch],
+ );
+
+ const isImportModalOpen = useSelector(selectImportModalOpen);
+
+ const toggleImportModal = useCallback(
+ (open: boolean) => {
+ dispatch(gitGlobalActions.toggleImportModal({ open }));
+ },
+ [dispatch],
+ );
+
+ return {
+ isGitImportLoading: gitImportState?.loading ?? false,
+ gitImportError: gitImportState?.error ?? null,
+ gitImport,
+ isImportModalOpen: isImportModalOpen ?? false,
+ toggleImportModal,
+ };
+}
diff --git a/app/client/src/git/hooks/useLocalProfile.ts b/app/client/src/git/hooks/useLocalProfile.ts
index e770ad6356bc..8d77899a7602 100644
--- a/app/client/src/git/hooks/useLocalProfile.ts
+++ b/app/client/src/git/hooks/useLocalProfile.ts
@@ -4,36 +4,40 @@ import { gitArtifactActions } from "git/store/gitArtifactSlice";
import {
selectFetchLocalProfileState,
selectUpdateLocalProfileState,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useLocalProfile() {
const { artifactDef } = useGitContext();
const dispatch = useDispatch();
- const fetchLocalProfileState = useSelector((state: GitRootState) =>
- selectFetchLocalProfileState(state, artifactDef),
+ const fetchLocalProfileState = useArtifactSelector(
+ selectFetchLocalProfileState,
);
const fetchLocalProfile = useCallback(() => {
- dispatch(gitArtifactActions.fetchLocalProfileInit(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.fetchLocalProfileInit({ artifactDef }));
+ }
}, [artifactDef, dispatch]);
- const updateLocalProfileState = useSelector((state: GitRootState) =>
- selectUpdateLocalProfileState(state, artifactDef),
+ const updateLocalProfileState = useArtifactSelector(
+ selectUpdateLocalProfileState,
);
const updateLocalProfile = useCallback(
(params: UpdateLocalProfileRequestParams) => {
- dispatch(
- gitArtifactActions.updateLocalProfileInit({
- ...artifactDef,
- ...params,
- }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.updateLocalProfileInit({
+ artifactDef,
+ ...params,
+ }),
+ );
+ }
},
[artifactDef, dispatch],
);
diff --git a/app/client/src/git/hooks/useMerge.ts b/app/client/src/git/hooks/useMerge.ts
index f7394601b191..8fa79b16049f 100644
--- a/app/client/src/git/hooks/useMerge.ts
+++ b/app/client/src/git/hooks/useMerge.ts
@@ -3,10 +3,10 @@ import { gitArtifactActions } from "git/store/gitArtifactSlice";
import {
selectMergeState,
selectMergeStatusState,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useMerge() {
const { artifact, artifactDef } = useGitContext();
@@ -14,44 +14,46 @@ export default function useMerge() {
const dispatch = useDispatch();
// merge
- const mergeState = useSelector((state: GitRootState) =>
- selectMergeState(state, artifactDef),
- );
+ const mergeState = useArtifactSelector(selectMergeState);
const merge = useCallback(() => {
- dispatch(gitArtifactActions.mergeInit(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.mergeInit({ artifactDef }));
+ }
}, [artifactDef, dispatch]);
// merge status
- const mergeStatusState = useSelector((state: GitRootState) =>
- selectMergeStatusState(state, artifactDef),
- );
+ const mergeStatusState = useArtifactSelector(selectMergeStatusState);
const fetchMergeStatus = useCallback(
(sourceBranch: string, destinationBranch: string) => {
- dispatch(
- gitArtifactActions.fetchMergeStatusInit({
- ...artifactDef,
- artifactId: artifactId ?? "",
- sourceBranch,
- destinationBranch,
- }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.fetchMergeStatusInit({
+ artifactDef,
+ artifactId: artifactId ?? "",
+ sourceBranch,
+ destinationBranch,
+ }),
+ );
+ }
},
[artifactId, artifactDef, dispatch],
);
const clearMergeStatus = useCallback(() => {
- dispatch(gitArtifactActions.clearMergeStatus(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.clearMergeStatus({ artifactDef }));
+ }
}, [artifactDef, dispatch]);
return {
isMergeLoading: mergeState?.loading ?? false,
- mergeError: mergeState?.error,
+ mergeError: mergeState?.error ?? null,
merge,
- mergeStatus: mergeStatusState?.value,
+ mergeStatus: mergeStatusState?.value ?? null,
isFetchMergeStatusLoading: mergeStatusState?.loading ?? false,
- fetchMergeStatusError: mergeStatusState?.error,
+ fetchMergeStatusError: mergeStatusState?.error ?? null,
fetchMergeStatus,
clearMergeStatus,
};
diff --git a/app/client/src/git/hooks/useMetadata.ts b/app/client/src/git/hooks/useMetadata.ts
index 9bd5356ad763..2ccd15d7ec89 100644
--- a/app/client/src/git/hooks/useMetadata.ts
+++ b/app/client/src/git/hooks/useMetadata.ts
@@ -1,26 +1,12 @@
-import { useGitContext } from "git/components/GitContextProvider";
-import {
- selectGitConnected,
- selectMetadataState,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
-import { useSelector } from "react-redux";
+import { selectMetadataState } from "git/store/selectors/gitArtifactSelectors";
+import useArtifactSelector from "./useArtifactSelector";
export default function useMetadata() {
- const { artifactDef } = useGitContext();
-
- const metadataState = useSelector((state: GitRootState) =>
- selectMetadataState(state, artifactDef),
- );
-
- const isGitConnected = useSelector((state: GitRootState) =>
- selectGitConnected(state, artifactDef),
- );
+ const metadataState = useArtifactSelector(selectMetadataState);
return {
metadata: metadataState?.value ?? null,
isFetchMetadataLoading: metadataState?.loading ?? false,
fetchMetadataError: metadataState?.error ?? null,
- isGitConnected,
};
}
diff --git a/app/client/src/git/hooks/useOps.ts b/app/client/src/git/hooks/useOps.ts
index 32eec997cf25..9b15bd035d85 100644
--- a/app/client/src/git/hooks/useOps.ts
+++ b/app/client/src/git/hooks/useOps.ts
@@ -5,10 +5,10 @@ import {
selectConflictErrorModalOpen,
selectOpsModalOpen,
selectOpsModalTab,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useOps() {
const { artifactDef } = useGitContext();
@@ -16,42 +16,40 @@ export default function useOps() {
const dispatch = useDispatch();
// ops modal
- const opsModalOpen = useSelector((state: GitRootState) =>
- selectOpsModalOpen(state, artifactDef),
- );
+ const opsModalOpen = useArtifactSelector(selectOpsModalOpen);
- const opsModalTab = useSelector((state: GitRootState) =>
- selectOpsModalTab(state, artifactDef),
- );
+ const opsModalTab = useArtifactSelector(selectOpsModalTab);
const toggleOpsModal = useCallback(
(open: boolean, tab: keyof typeof GitOpsTab = GitOpsTab.Deploy) => {
- dispatch(
- gitArtifactActions.toggleOpsModal({ ...artifactDef, open, tab }),
- );
+ if (artifactDef) {
+ dispatch(gitArtifactActions.toggleOpsModal({ artifactDef, open, tab }));
+ }
},
[artifactDef, dispatch],
);
// conflict error modal
- const conflictErrorModalOpen = useSelector((state: GitRootState) =>
- selectConflictErrorModalOpen(state, artifactDef),
+ const conflictErrorModalOpen = useArtifactSelector(
+ selectConflictErrorModalOpen,
);
const toggleConflictErrorModal = useCallback(
(open: boolean) => {
- dispatch(
- gitArtifactActions.toggleConflictErrorModal({ ...artifactDef, open }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.toggleConflictErrorModal({ artifactDef, open }),
+ );
+ }
},
[artifactDef, dispatch],
);
return {
opsModalTab,
- opsModalOpen,
+ isOpsModalOpen: opsModalOpen ?? false,
toggleOpsModal,
- conflictErrorModalOpen,
+ isConflictErrorModalOpen: conflictErrorModalOpen ?? false,
toggleConflictErrorModal,
};
}
diff --git a/app/client/src/git/hooks/useProtectedBranches.ts b/app/client/src/git/hooks/useProtectedBranches.ts
index fa3b2ef89307..6ec68ee23b74 100644
--- a/app/client/src/git/hooks/useProtectedBranches.ts
+++ b/app/client/src/git/hooks/useProtectedBranches.ts
@@ -2,55 +2,55 @@ import { useGitContext } from "git/components/GitContextProvider";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
import {
selectFetchProtectedBranchesState,
- selectProtectedMode,
selectUpdateProtectedBranchesState,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
function useProtectedBranches() {
const { artifactDef } = useGitContext();
const dispatch = useDispatch();
- const fetchProtectedBranchesState = useSelector((state: GitRootState) =>
- selectFetchProtectedBranchesState(state, artifactDef),
+ const fetchProtectedBranchesState = useArtifactSelector(
+ selectFetchProtectedBranchesState,
);
const fetchProtectedBranches = useCallback(() => {
- dispatch(gitArtifactActions.fetchProtectedBranchesInit(artifactDef));
+ if (artifactDef) {
+ dispatch(gitArtifactActions.fetchProtectedBranchesInit({ artifactDef }));
+ }
}, [dispatch, artifactDef]);
- const updateProtectedBranchesState = useSelector((state: GitRootState) =>
- selectUpdateProtectedBranchesState(state, artifactDef),
+ const updateProtectedBranchesState = useArtifactSelector(
+ selectUpdateProtectedBranchesState,
);
const updateProtectedBranches = useCallback(
(branches: string[]) => {
- dispatch(
- gitArtifactActions.updateProtectedBranchesInit({
- ...artifactDef,
- branchNames: branches,
- }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.updateProtectedBranchesInit({
+ artifactDef,
+ branchNames: branches,
+ }),
+ );
+ }
},
[dispatch, artifactDef],
);
- const isProtectedMode = useSelector((state: GitRootState) =>
- selectProtectedMode(state, artifactDef),
- );
-
return {
- protectedBranches: fetchProtectedBranchesState.value,
- isFetchProtectedBranchesLoading: fetchProtectedBranchesState.loading,
- fetchProtectedBranchesError: fetchProtectedBranchesState.error,
+ protectedBranches: fetchProtectedBranchesState?.value ?? null,
+ isFetchProtectedBranchesLoading:
+ fetchProtectedBranchesState?.loading ?? false,
+ fetchProtectedBranchesError: fetchProtectedBranchesState?.error ?? null,
fetchProtectedBranches,
- isUpdateProtectedBranchesLoading: updateProtectedBranchesState.loading,
- updateProtectedBranchesError: updateProtectedBranchesState.error,
+ isUpdateProtectedBranchesLoading:
+ updateProtectedBranchesState?.loading ?? false,
+ updateProtectedBranchesError: updateProtectedBranchesState?.error ?? null,
updateProtectedBranches,
- isProtectedMode,
};
}
diff --git a/app/client/src/git/hooks/useProtectedMode.ts b/app/client/src/git/hooks/useProtectedMode.ts
new file mode 100644
index 000000000000..e8e86e9f04a2
--- /dev/null
+++ b/app/client/src/git/hooks/useProtectedMode.ts
@@ -0,0 +1,8 @@
+import { selectProtectedMode } from "git/store/selectors/gitArtifactSelectors";
+import useArtifactSelector from "./useArtifactSelector";
+
+export default function useProtectedMode() {
+ const isProtectedMode = useArtifactSelector(selectProtectedMode);
+
+ return isProtectedMode ?? false;
+}
diff --git a/app/client/src/git/hooks/usePull.ts b/app/client/src/git/hooks/usePull.ts
index 992866f2c277..19900c98f38e 100644
--- a/app/client/src/git/hooks/usePull.ts
+++ b/app/client/src/git/hooks/usePull.ts
@@ -1,26 +1,26 @@
import { useGitContext } from "git/components/GitContextProvider";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
-import { selectPullState } from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+import { selectPullState } from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function usePull() {
const { artifact, artifactDef } = useGitContext();
const artifactId = artifact?.id;
const dispatch = useDispatch();
- const pullState = useSelector((state: GitRootState) =>
- selectPullState(state, artifactDef),
- );
+ const pullState = useArtifactSelector(selectPullState);
const pull = useCallback(() => {
- dispatch(
- gitArtifactActions.pullInit({
- ...artifactDef,
- artifactId: artifactId ?? "",
- }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.pullInit({
+ artifactDef,
+ artifactId: artifactId ?? "",
+ }),
+ );
+ }
}, [artifactDef, artifactId, dispatch]);
return {
diff --git a/app/client/src/git/hooks/useSSHKey.ts b/app/client/src/git/hooks/useSSHKey.ts
new file mode 100644
index 000000000000..93c95ade8d31
--- /dev/null
+++ b/app/client/src/git/hooks/useSSHKey.ts
@@ -0,0 +1,63 @@
+import { useGitContext } from "git/components/GitContextProvider";
+import { gitArtifactActions } from "git/store/gitArtifactSlice";
+import {
+ selectFetchSSHKeysState,
+ selectGenerateSSHKeyState,
+} from "git/store/selectors/gitArtifactSelectors";
+import { useCallback } from "react";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
+
+export default function useSSHKey() {
+ const { artifactDef } = useGitContext();
+
+ const dispatch = useDispatch();
+
+ const fetchSSHKeyState = useArtifactSelector(selectFetchSSHKeysState);
+
+ const fetchSSHKey = useCallback(() => {
+ if (artifactDef) {
+ dispatch(gitArtifactActions.fetchSSHKeyInit({ artifactDef }));
+ }
+ }, [artifactDef, dispatch]);
+
+ const resetFetchSSHKey = useCallback(() => {
+ if (artifactDef) {
+ dispatch(gitArtifactActions.resetFetchSSHKey({ artifactDef }));
+ }
+ }, [artifactDef, dispatch]);
+
+ const generateSSHKeyState = useArtifactSelector(selectGenerateSSHKeyState);
+
+ const generateSSHKey = useCallback(
+ (keyType: string) => {
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.generateSSHKeyInit({
+ artifactDef,
+ keyType,
+ }),
+ );
+ }
+ },
+ [artifactDef, dispatch],
+ );
+
+ const resetGenerateSSHKey = useCallback(() => {
+ if (artifactDef) {
+ dispatch(gitArtifactActions.resetGenerateSSHKey({ artifactDef }));
+ }
+ }, [artifactDef, dispatch]);
+
+ return {
+ sshKey: fetchSSHKeyState?.value ?? null,
+ isFetchSSHKeyLoading: fetchSSHKeyState?.loading ?? false,
+ fetchSSHKeyError: fetchSSHKeyState?.error ?? null,
+ fetchSSHKey,
+ resetFetchSSHKey,
+ isGenerateSSHKeyLoading: generateSSHKeyState?.loading ?? false,
+ generateSSHKeyError: generateSSHKeyState?.error ?? null,
+ generateSSHKey,
+ resetGenerateSSHKey,
+ };
+}
diff --git a/app/client/src/git/hooks/useSettings.ts b/app/client/src/git/hooks/useSettings.ts
index d94f9c0e530b..0a8b48aa368c 100644
--- a/app/client/src/git/hooks/useSettings.ts
+++ b/app/client/src/git/hooks/useSettings.ts
@@ -4,39 +4,37 @@ import { gitArtifactActions } from "git/store/gitArtifactSlice";
import {
selectSettingsModalOpen,
selectSettingsModalTab,
-} from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+} from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useSettings() {
const { artifactDef } = useGitContext();
const dispatch = useDispatch();
- const settingsModalOpen = useSelector((state: GitRootState) =>
- selectSettingsModalOpen(state, artifactDef),
- );
+ const settingsModalOpen = useArtifactSelector(selectSettingsModalOpen);
- const settingsModalTab = useSelector((state: GitRootState) =>
- selectSettingsModalTab(state, artifactDef),
- );
+ const settingsModalTab = useArtifactSelector(selectSettingsModalTab);
const toggleSettingsModal = useCallback(
(
open: boolean,
tab: keyof typeof GitSettingsTab = GitSettingsTab.General,
) => {
- dispatch(
- gitArtifactActions.toggleSettingsModal({ ...artifactDef, open, tab }),
- );
+ if (artifactDef) {
+ dispatch(
+ gitArtifactActions.toggleSettingsModal({ artifactDef, open, tab }),
+ );
+ }
},
[artifactDef, dispatch],
);
return {
isSettingsModalOpen: settingsModalOpen ?? false,
- settingsModalTab: settingsModalTab ?? GitSettingsTab.General,
+ settingsModalTab: settingsModalTab,
toggleSettingsModal,
};
}
diff --git a/app/client/src/git/hooks/useStatus.ts b/app/client/src/git/hooks/useStatus.ts
index 97b09b57498a..37a5584911aa 100644
--- a/app/client/src/git/hooks/useStatus.ts
+++ b/app/client/src/git/hooks/useStatus.ts
@@ -1,31 +1,33 @@
import { useGitContext } from "git/components/GitContextProvider";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
-import { selectStatusState } from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitRootState } from "git/store/types";
+import { selectStatusState } from "git/store/selectors/gitArtifactSelectors";
import { useCallback } from "react";
-import { useDispatch, useSelector } from "react-redux";
+import { useDispatch } from "react-redux";
+import useArtifactSelector from "./useArtifactSelector";
export default function useStatus() {
- const { artifactDef } = useGitContext();
+ const { artifact, artifactDef } = useGitContext();
+ const artifactId = artifact?.id;
const dispatch = useDispatch();
- const statusState = useSelector((state: GitRootState) =>
- selectStatusState(state, artifactDef),
- );
+ const statusState = useArtifactSelector(selectStatusState);
const fetchStatus = useCallback(() => {
- dispatch(
- gitArtifactActions.fetchStatusInit({
- ...artifactDef,
- compareRemote: true,
- }),
- );
- }, [artifactDef, dispatch]);
+ if (artifactDef && artifactId) {
+ dispatch(
+ gitArtifactActions.fetchStatusInit({
+ artifactId,
+ artifactDef,
+ compareRemote: true,
+ }),
+ );
+ }
+ }, [artifactDef, artifactId, dispatch]);
return {
- status: statusState?.value,
+ status: statusState?.value ?? null,
isFetchStatusLoading: statusState?.loading ?? false,
- fetchStatusError: statusState?.error,
+ fetchStatusError: statusState?.error ?? null,
fetchStatus,
};
}
diff --git a/app/client/src/git/index.ts b/app/client/src/git/index.ts
new file mode 100644
index 000000000000..892ca77d7f43
--- /dev/null
+++ b/app/client/src/git/index.ts
@@ -0,0 +1,39 @@
+// enums
+export { GitArtifactType, GitOpsTab } from "./constants/enums";
+
+// components
+export { default as GitContextProvider } from "./components/GitContextProvider";
+export { default as GitModals } from "./ee/components/GitModals";
+export { default as GitImportModal } from "./components/ImportModal";
+export { default as GitQuickActions } from "./components/QuickActions";
+export { default as GitProtectedBranchCallout } from "./components/ProtectedBranchCallout";
+export { default as GitGlobalProfile } from "./components/GlobalProfile";
+export { default as GitDeployMenuItems } from "./components/DeployMenuItems";
+
+// hooks
+export { default as useGitCurrentBranch } from "./hooks/useCurrentBranch";
+export { default as useGitProtectedMode } from "./hooks/useProtectedMode";
+export { default as useGitConnected } from "./hooks/useConnected";
+export { default as useGitOps } from "./hooks/useOps";
+
+// actions
+import { gitGlobalActions } from "./store/gitGlobalSlice";
+export const fetchGitGlobalProfile = gitGlobalActions.fetchGlobalProfileInit;
+export const toggleGitImportModal = gitGlobalActions.toggleImportModal;
+
+import { gitArtifactActions } from "./store/gitArtifactSlice";
+export const gitConnectSuccess = gitArtifactActions.connectSuccess;
+
+// selectors
+export {
+ selectCurrentBranch as selectGitCurrentBranch,
+ selectProtectedMode as selectGitProtectedMode,
+} from "./store/selectors/gitArtifactSelectors";
+
+// types
+export type {
+ GitArtifactDef,
+ GitArtifactRootReduxState,
+ GitGlobalReduxState,
+} from "./store/types";
+export type { ConnectSuccessPayload as GitConnectSuccessPayload } from "./store/actions/connectActions";
diff --git a/app/client/src/git/requests/connectRequest.types.ts b/app/client/src/git/requests/connectRequest.types.ts
index 7e31cf32bf82..d47cc4114b21 100644
--- a/app/client/src/git/requests/connectRequest.types.ts
+++ b/app/client/src/git/requests/connectRequest.types.ts
@@ -1,4 +1,5 @@
import type { ApiResponse } from "api/types";
+import type { ApplicationPayload } from "entities/Application";
export interface ConnectRequestParams {
remoteUrl: string;
@@ -9,20 +10,6 @@ export interface ConnectRequestParams {
};
}
-export interface ConnectResponseData {
- id: string;
- baseId: string;
- gitApplicationMetadata: {
- branchName: string;
- browserSupportedRemoteUrl: string;
- defaultApplicationId: string;
- defaultArtifactId: string;
- defaultBranchName: string;
- isRepoPrivate: boolean;
- lastCommitedAt: string;
- remoteUrl: string;
- repoName: string;
- };
-}
+export interface ConnectResponseData extends ApplicationPayload {}
export type ConnectResponse = ApiResponse<ConnectResponseData>;
diff --git a/app/client/src/git/requests/disconnectRequest.types.ts b/app/client/src/git/requests/disconnectRequest.types.ts
index 2cbf5969ccca..b1cd5827d951 100644
--- a/app/client/src/git/requests/disconnectRequest.types.ts
+++ b/app/client/src/git/requests/disconnectRequest.types.ts
@@ -1,7 +1,6 @@
import type { ApiResponse } from "api/types";
+import type { ApplicationPayload } from "entities/Application";
-export interface DisconnectResponseData {
- [key: string]: string;
-}
+export interface DisconnectResponseData extends ApplicationPayload {}
export type DisconnectResponse = ApiResponse<DisconnectResponseData>;
diff --git a/app/client/src/git/requests/fetchGlobalSSHKeyRequest.ts b/app/client/src/git/requests/fetchGlobalSSHKeyRequest.ts
new file mode 100644
index 000000000000..00d900637f42
--- /dev/null
+++ b/app/client/src/git/requests/fetchGlobalSSHKeyRequest.ts
@@ -0,0 +1,15 @@
+import type { AxiosPromise } from "axios";
+import { GIT_BASE_URL } from "./constants";
+import Api from "api/Api";
+import type {
+ FetchGlobalSSHKeyRequestParams,
+ FetchGlobalSSHKeyResponse,
+} from "./fetchGlobalSSHKeyRequest.types";
+
+export default async function fetchGlobalSSHKeyRequest(
+ params: FetchGlobalSSHKeyRequestParams,
+): AxiosPromise<FetchGlobalSSHKeyResponse> {
+ const url = `${GIT_BASE_URL}/import/keys?keyType=${params.keyType}`;
+
+ return Api.get(url);
+}
diff --git a/app/client/src/git/requests/fetchGlobalSSHKeyRequest.types.ts b/app/client/src/git/requests/fetchGlobalSSHKeyRequest.types.ts
new file mode 100644
index 000000000000..7b092ceccff2
--- /dev/null
+++ b/app/client/src/git/requests/fetchGlobalSSHKeyRequest.types.ts
@@ -0,0 +1,15 @@
+import type { ApiResponse } from "api/types";
+
+export interface FetchGlobalSSHKeyRequestParams {
+ keyType: string;
+}
+
+export interface FetchGlobalSSHKeyResponseData {
+ publicKey: string;
+ docUrl: string;
+ isRegeneratedKey: boolean;
+ regeneratedKey: boolean;
+}
+
+export type FetchGlobalSSHKeyResponse =
+ ApiResponse<FetchGlobalSSHKeyResponseData>;
diff --git a/app/client/src/git/requests/fetchStatusRequest.types.ts b/app/client/src/git/requests/fetchStatusRequest.types.ts
index c4400688b794..feb064d3618d 100644
--- a/app/client/src/git/requests/fetchStatusRequest.types.ts
+++ b/app/client/src/git/requests/fetchStatusRequest.types.ts
@@ -24,6 +24,7 @@ export interface FetchStatusResponseData {
modifiedDatasources: number;
modifiedJSLibs: number;
modifiedJSObjects: number;
+ modifiedPackages: number;
modifiedModuleInstances: number;
modifiedModules: number;
modifiedPages: number;
diff --git a/app/client/src/git/requests/generateSSHKeyRequest.ts b/app/client/src/git/requests/generateSSHKeyRequest.ts
index 896426347f30..b0bea4f20ff8 100644
--- a/app/client/src/git/requests/generateSSHKeyRequest.ts
+++ b/app/client/src/git/requests/generateSSHKeyRequest.ts
@@ -3,16 +3,14 @@ import type {
GenerateSSHKeyRequestParams,
GenerateSSHKeyResponse,
} from "./generateSSHKeyRequest.types";
-import { APPLICATION_BASE_URL, GIT_BASE_URL } from "./constants";
+import { APPLICATION_BASE_URL } from "./constants";
import Api from "api/Api";
export default async function generateSSHKeyRequest(
baseApplicationId: string,
params: GenerateSSHKeyRequestParams,
): AxiosPromise<GenerateSSHKeyResponse> {
- const url = params.isImport
- ? `${GIT_BASE_URL}/import/keys?keyType=${params.keyType}`
- : `${APPLICATION_BASE_URL}/ssh-keypair/${baseApplicationId}?keyType=${params.keyType}`;
+ const url = `${APPLICATION_BASE_URL}/ssh-keypair/${baseApplicationId}?keyType=${params.keyType}`;
- return params.isImport ? Api.get(url) : Api.post(url);
+ return Api.post(url);
}
diff --git a/app/client/src/git/requests/generateSSHKeyRequest.types.ts b/app/client/src/git/requests/generateSSHKeyRequest.types.ts
index 45374e42d5b1..fbc4a4c0e959 100644
--- a/app/client/src/git/requests/generateSSHKeyRequest.types.ts
+++ b/app/client/src/git/requests/generateSSHKeyRequest.types.ts
@@ -2,7 +2,6 @@ import type { ApiResponse } from "api/types";
export interface GenerateSSHKeyRequestParams {
keyType: string;
- isImport: boolean;
}
export interface GenerateSSHKeyResponseData {
diff --git a/app/client/src/git/requests/gitImportRequest.types.ts b/app/client/src/git/requests/gitImportRequest.types.ts
index 9f76b379c9cc..4eb29b11a88b 100644
--- a/app/client/src/git/requests/gitImportRequest.types.ts
+++ b/app/client/src/git/requests/gitImportRequest.types.ts
@@ -1,4 +1,6 @@
import type { ApiResponse } from "api/types";
+import type { ApplicationResponsePayload } from "ee/api/ApplicationApi";
+import type { Datasource } from "entities/Datasource";
export interface GitImportRequestParams {
remoteUrl: string;
@@ -10,19 +12,9 @@ export interface GitImportRequestParams {
}
export interface GitImportResponseData {
- id: string;
- baseId: string;
- gitApplicationMetadata: {
- branchName: string;
- browserSupportedRemoteUrl: string;
- defaultApplicationId: string;
- defaultArtifactId: string;
- defaultBranchName: string;
- isRepoPrivate: boolean;
- lastCommitedAt: string;
- remoteUrl: string;
- repoName: string;
- };
+ application: ApplicationResponsePayload;
+ isPartialImport: boolean;
+ unconfiguredDatasourceList?: Datasource[];
}
export type GitImportResponse = ApiResponse<GitImportResponseData>;
diff --git a/app/client/src/git/sagas/checkoutBranchSaga.ts b/app/client/src/git/sagas/checkoutBranchSaga.ts
index 34e48434626c..7fc454f36bc0 100644
--- a/app/client/src/git/sagas/checkoutBranchSaga.ts
+++ b/app/client/src/git/sagas/checkoutBranchSaga.ts
@@ -25,8 +25,7 @@ import { captureException } from "@sentry/react";
export default function* checkoutBranchSaga(
action: GitArtifactPayloadAction<CheckoutBranchInitPayload>,
) {
- const { artifactType, baseArtifactId, branchName } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId, branchName } = action.payload;
let response: CheckoutBranchResponse | undefined;
try {
@@ -34,12 +33,12 @@ export default function* checkoutBranchSaga(
branchName,
};
- response = yield call(checkoutBranchRequest, baseArtifactId, params);
+ response = yield call(checkoutBranchRequest, artifactId, params);
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
- if (artifactType === GitArtifactType.Application) {
- yield put(gitArtifactActions.checkoutBranchSuccess(basePayload));
+ if (artifactDef.artifactType === GitArtifactType.Application) {
+ yield put(gitArtifactActions.checkoutBranchSuccess({ artifactDef }));
const trimmedBranch = branchName.replace(/^origin\//, "");
const destinationHref = addBranchParam(trimmedBranch);
@@ -49,7 +48,7 @@ export default function* checkoutBranchSaga(
yield put(
gitArtifactActions.toggleBranchPopup({
- ...basePayload,
+ artifactDef,
open: false,
}),
);
@@ -118,7 +117,7 @@ export default function* checkoutBranchSaga(
yield put(
gitArtifactActions.checkoutBranchError({
- ...basePayload,
+ artifactDef,
error,
}),
);
diff --git a/app/client/src/git/sagas/commitSaga.ts b/app/client/src/git/sagas/commitSaga.ts
index 159021acc145..7ebcb70b9a71 100644
--- a/app/client/src/git/sagas/commitSaga.ts
+++ b/app/client/src/git/sagas/commitSaga.ts
@@ -17,8 +17,7 @@ import { validateResponse } from "sagas/ErrorSagas";
export default function* commitSaga(
action: GitArtifactPayloadAction<CommitInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = action.payload;
let response: CommitResponse | undefined;
@@ -28,20 +27,21 @@ export default function* commitSaga(
doPush: action.payload.doPush,
};
- response = yield call(commitRequest, baseArtifactId, params);
+ response = yield call(commitRequest, artifactId, params);
const isValidResponse: boolean = yield validateResponse(response, false);
if (isValidResponse) {
- yield put(gitArtifactActions.commitSuccess(basePayload));
+ yield put(gitArtifactActions.commitSuccess({ artifactDef }));
yield put(
gitArtifactActions.fetchStatusInit({
- ...basePayload,
+ artifactDef,
+ artifactId,
compareRemote: true,
}),
);
- if (artifactType === GitArtifactType.Application) {
+ if (artifactDef.artifactType === GitArtifactType.Application) {
// ! case for updating lastDeployedAt in application manually?
}
}
@@ -52,13 +52,13 @@ export default function* commitSaga(
if (error.code === GitErrorCodes.REPO_LIMIT_REACHED) {
yield put(
gitArtifactActions.toggleRepoLimitErrorModal({
- ...basePayload,
+ artifactDef,
open: true,
}),
);
}
- yield put(gitArtifactActions.commitError({ ...basePayload, error }));
+ yield put(gitArtifactActions.commitError({ artifactDef, error }));
} else {
log.error(e);
captureException(e);
diff --git a/app/client/src/git/sagas/connectSaga.ts b/app/client/src/git/sagas/connectSaga.ts
index b13c2f6c2c2a..b6de0cdea53e 100644
--- a/app/client/src/git/sagas/connectSaga.ts
+++ b/app/client/src/git/sagas/connectSaga.ts
@@ -8,7 +8,7 @@ import { GitArtifactType, GitErrorCodes } from "../constants/enums";
import type { GitArtifactPayloadAction } from "../store/types";
import type { ConnectInitPayload } from "../store/actions/connectActions";
-import { call, put } from "redux-saga/effects";
+import { call, put, select } from "redux-saga/effects";
// Internal dependencies
import { validateResponse } from "sagas/ErrorSagas";
@@ -17,12 +17,12 @@ import history from "utils/history";
import { addBranchParam } from "constants/routes";
import log from "loglevel";
import { captureException } from "@sentry/react";
+import { getCurrentPageId } from "selectors/editorSelectors";
export default function* connectSaga(
action: GitArtifactPayloadAction<ConnectInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: ConnectResponse | undefined;
@@ -32,34 +32,50 @@ export default function* connectSaga(
gitProfile: action.payload.gitProfile,
};
- response = yield call(connectRequest, baseArtifactId, params);
+ response = yield call(connectRequest, artifactDef.baseArtifactId, params);
const isValidResponse: boolean = yield validateResponse(response, false);
if (response && isValidResponse) {
- yield put(gitArtifactActions.connectSuccess(basePayload));
+ yield put(
+ gitArtifactActions.connectSuccess({
+ artifactDef,
+ responseData: response.data,
+ }),
+ );
// needs to happen only when artifactType is application
- if (artifactType === GitArtifactType.Application) {
- const { branchedPageId } = action.payload;
+ if (artifactDef.artifactType === GitArtifactType.Application) {
+ const pageId: string = yield select(getCurrentPageId);
- if (branchedPageId) {
- yield put(fetchPageAction(branchedPageId));
- }
+ yield put(fetchPageAction(pageId));
+
+ const branch = response.data?.gitApplicationMetadata?.branchName;
+
+ if (branch) {
+ const newUrl = addBranchParam(branch);
- const branch = response.data.gitApplicationMetadata.branchName;
- const newUrl = addBranchParam(branch);
+ history.replace(newUrl);
+ }
- history.replace(newUrl);
// ! case for updating lastDeployedAt in application manually?
}
yield put(
gitArtifactActions.initGitForEditor({
- ...basePayload,
+ artifactDef,
artifact: response.data,
}),
);
+ yield put(
+ gitArtifactActions.toggleConnectModal({ artifactDef, open: false }),
+ );
+ yield put(
+ gitArtifactActions.toggleConnectSuccessModal({
+ artifactDef,
+ open: true,
+ }),
+ );
}
} catch (e) {
if (response && response.responseMeta.error) {
@@ -68,13 +84,13 @@ export default function* connectSaga(
if (GitErrorCodes.REPO_LIMIT_REACHED === error.code) {
yield put(
gitArtifactActions.toggleRepoLimitErrorModal({
- ...basePayload,
+ artifactDef,
open: true,
}),
);
}
- yield put(gitArtifactActions.connectError({ ...basePayload, error }));
+ yield put(gitArtifactActions.connectError({ artifactDef, error }));
} else {
log.error(e);
captureException(e);
diff --git a/app/client/src/git/sagas/createBranchSaga.ts b/app/client/src/git/sagas/createBranchSaga.ts
index 7796f43d74bd..d8aa65418977 100644
--- a/app/client/src/git/sagas/createBranchSaga.ts
+++ b/app/client/src/git/sagas/createBranchSaga.ts
@@ -16,8 +16,8 @@ import log from "loglevel";
export default function* createBranchSaga(
action: GitArtifactPayloadAction<CreateBranchInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = action.payload;
+ const basePayload = { artifactDef };
let response: CreateBranchResponse | undefined;
try {
@@ -25,27 +25,29 @@ export default function* createBranchSaga(
branchName: action.payload.branchName,
};
- response = yield call(createBranchRequest, baseArtifactId, params);
+ response = yield call(createBranchRequest, artifactId, params);
const isValidResponse: boolean = yield validateResponse(response);
if (isValidResponse) {
yield put(gitArtifactActions.createBranchSuccess(basePayload));
yield put(
gitArtifactActions.toggleBranchPopup({
- ...basePayload,
+ artifactDef,
open: false,
}),
);
yield put(
gitArtifactActions.fetchBranchesInit({
- ...basePayload,
+ artifactDef,
+ artifactId,
pruneBranches: true,
}),
);
yield put(
gitArtifactActions.checkoutBranchInit({
- ...basePayload,
+ artifactDef,
+ artifactId,
branchName: action.payload.branchName,
}),
);
@@ -56,7 +58,7 @@ export default function* createBranchSaga(
yield put(
gitArtifactActions.createBranchError({
- ...basePayload,
+ artifactDef,
error,
}),
);
diff --git a/app/client/src/git/sagas/deleteBranchSaga.ts b/app/client/src/git/sagas/deleteBranchSaga.ts
index 4f6bdde2f7fc..ecf560889f1c 100644
--- a/app/client/src/git/sagas/deleteBranchSaga.ts
+++ b/app/client/src/git/sagas/deleteBranchSaga.ts
@@ -16,8 +16,7 @@ import { captureException } from "@sentry/react";
export default function* deleteBranchSaga(
action: GitArtifactPayloadAction<DeleteBranchInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = action.payload;
let response: DeleteBranchResponse | undefined;
try {
@@ -25,14 +24,19 @@ export default function* deleteBranchSaga(
branchName: action.payload.branchName,
};
- response = yield call(deleteBranchRequest, baseArtifactId, params);
+ response = yield call(
+ deleteBranchRequest,
+ artifactDef.baseArtifactId,
+ params,
+ );
const isValidResponse: boolean = yield validateResponse(response);
if (isValidResponse) {
- yield put(gitArtifactActions.deleteBranchSuccess(basePayload));
+ yield put(gitArtifactActions.deleteBranchSuccess({ artifactDef }));
yield put(
gitArtifactActions.fetchBranchesInit({
- ...basePayload,
+ artifactDef,
+ artifactId,
pruneBranches: true,
}),
);
@@ -41,12 +45,7 @@ export default function* deleteBranchSaga(
if (response && response.responseMeta.error) {
const { error } = response.responseMeta;
- yield put(
- gitArtifactActions.deleteBranchError({
- ...basePayload,
- error,
- }),
- );
+ yield put(gitArtifactActions.deleteBranchError({ artifactDef, error }));
} else {
log.error(e);
captureException(e);
diff --git a/app/client/src/git/sagas/disconnectSaga.ts b/app/client/src/git/sagas/disconnectSaga.ts
index 3dc25f1ff079..ef6315c25cd5 100644
--- a/app/client/src/git/sagas/disconnectSaga.ts
+++ b/app/client/src/git/sagas/disconnectSaga.ts
@@ -12,26 +12,30 @@ import { validateResponse } from "sagas/ErrorSagas";
import history from "utils/history";
export default function* disconnectSaga(action: GitArtifactPayloadAction) {
- const { artifactType, baseArtifactId } = action.payload;
- const artifactDef = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: DisconnectResponse | undefined;
try {
- response = yield call(disconnectRequest, baseArtifactId);
+ response = yield call(disconnectRequest, artifactDef.baseArtifactId);
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
- yield put(gitArtifactActions.disconnectSuccess(artifactDef));
+ yield put(gitArtifactActions.disconnectSuccess({ artifactDef }));
const url = new URL(window.location.href);
url.searchParams.delete(GIT_BRANCH_QUERY_KEY);
- history.push(url.toString().slice(url.origin.length));
- yield put(gitArtifactActions.closeDisconnectModal(artifactDef));
- // !case: why?
- // yield put(importAppViaGitStatusReset());
+ history.replace(url.toString().slice(url.origin.length));
+ yield put(gitArtifactActions.unmount({ artifactDef }));
+ yield put(
+ gitArtifactActions.initGitForEditor({
+ artifactDef,
+ artifact: response.data,
+ }),
+ );
+ yield put(gitArtifactActions.closeDisconnectModal({ artifactDef }));
yield put(
gitArtifactActions.toggleOpsModal({
- ...artifactDef,
+ artifactDef,
open: false,
tab: GitOpsTab.Deploy,
}),
@@ -52,7 +56,7 @@ export default function* disconnectSaga(action: GitArtifactPayloadAction) {
if (response && response.responseMeta.error) {
const { error } = response.responseMeta;
- yield put(gitArtifactActions.disconnectError({ ...artifactDef, error }));
+ yield put(gitArtifactActions.disconnectError({ artifactDef, error }));
} else {
log.error(e);
captureException(e);
diff --git a/app/client/src/git/sagas/fetchBranchesSaga.ts b/app/client/src/git/sagas/fetchBranchesSaga.ts
index 465310e01a4f..5141db03e34f 100644
--- a/app/client/src/git/sagas/fetchBranchesSaga.ts
+++ b/app/client/src/git/sagas/fetchBranchesSaga.ts
@@ -14,8 +14,7 @@ import { captureException } from "@sentry/react";
export default function* fetchBranchesSaga(
action: GitArtifactPayloadAction<FetchBranchesInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = action.payload;
let response: FetchBranchesResponse | undefined;
try {
@@ -23,13 +22,13 @@ export default function* fetchBranchesSaga(
pruneBranches: action.payload.pruneBranches,
};
- response = yield call(fetchBranchesRequest, baseArtifactId, params);
+ response = yield call(fetchBranchesRequest, artifactId, params);
const isValidResponse: boolean = yield validateResponse(response, false);
if (response && isValidResponse) {
yield put(
gitArtifactActions.fetchBranchesSuccess({
- ...basePayload,
+ artifactDef,
responseData: response.data,
}),
);
@@ -40,7 +39,7 @@ export default function* fetchBranchesSaga(
yield put(
gitArtifactActions.fetchBranchesError({
- ...basePayload,
+ artifactDef,
error,
}),
);
diff --git a/app/client/src/git/sagas/fetchGlobalProfileSaga.ts b/app/client/src/git/sagas/fetchGlobalProfileSaga.ts
index 71e7ca1a9c29..86713acf8787 100644
--- a/app/client/src/git/sagas/fetchGlobalProfileSaga.ts
+++ b/app/client/src/git/sagas/fetchGlobalProfileSaga.ts
@@ -1,12 +1,12 @@
import { call, put } from "redux-saga/effects";
import fetchGlobalProfileRequest from "../requests/fetchGlobalProfileRequest";
import type { FetchGlobalProfileResponse } from "../requests/fetchGlobalProfileRequest.types";
-import { gitConfigActions } from "../store/gitConfigSlice";
// internal dependencies
import { validateResponse } from "sagas/ErrorSagas";
import log from "loglevel";
import { captureException } from "@sentry/react";
+import { gitGlobalActions } from "git/store/gitGlobalSlice";
export default function* fetchGlobalProfileSaga() {
let response: FetchGlobalProfileResponse | undefined;
@@ -18,7 +18,7 @@ export default function* fetchGlobalProfileSaga() {
if (response && isValidResponse) {
yield put(
- gitConfigActions.fetchGlobalProfileSuccess({
+ gitGlobalActions.fetchGlobalProfileSuccess({
responseData: response.data,
}),
);
@@ -28,7 +28,7 @@ export default function* fetchGlobalProfileSaga() {
const { error } = response.responseMeta;
yield put(
- gitConfigActions.fetchGlobalProfileError({
+ gitGlobalActions.fetchGlobalProfileError({
error,
}),
);
diff --git a/app/client/src/git/sagas/fetchGlobalSSHKeySaga.ts b/app/client/src/git/sagas/fetchGlobalSSHKeySaga.ts
new file mode 100644
index 000000000000..e72711961844
--- /dev/null
+++ b/app/client/src/git/sagas/fetchGlobalSSHKeySaga.ts
@@ -0,0 +1,44 @@
+import { captureException } from "@sentry/react";
+import fetchGlobalSSHKeyRequest from "git/requests/fetchGlobalSSHKeyRequest";
+import type {
+ GenerateSSHKeyRequestParams,
+ GenerateSSHKeyResponse,
+} from "git/requests/generateSSHKeyRequest.types";
+import type { FetchGlobalSSHKeyInitPayload } from "git/store/actions/fetchGlobalSSHKeyActions";
+import { gitGlobalActions } from "git/store/gitGlobalSlice";
+import type { GitArtifactPayloadAction } from "git/store/types";
+import log from "loglevel";
+import { call, put } from "redux-saga/effects";
+import { validateResponse } from "sagas/ErrorSagas";
+
+export function* fetchGlobalSSHKeySaga(
+ action: GitArtifactPayloadAction<FetchGlobalSSHKeyInitPayload>,
+) {
+ let response: GenerateSSHKeyResponse | undefined;
+
+ try {
+ const params: GenerateSSHKeyRequestParams = {
+ keyType: action.payload.keyType,
+ };
+
+ response = yield call(fetchGlobalSSHKeyRequest, params);
+ const isValidResponse: boolean = yield validateResponse(response);
+
+ if (response && isValidResponse) {
+ yield put(
+ gitGlobalActions.fetchGlobalSSHKeySuccess({
+ responseData: response.data,
+ }),
+ );
+ }
+ } catch (e) {
+ if (response && response.responseMeta.error) {
+ const { error } = response.responseMeta;
+
+ yield put(gitGlobalActions.fetchGlobalSSHKeyError({ error }));
+ } else {
+ log.error(e);
+ captureException(e);
+ }
+ }
+}
diff --git a/app/client/src/git/sagas/fetchLocalProfileSaga.ts b/app/client/src/git/sagas/fetchLocalProfileSaga.ts
index c568129beab9..28f24ef2198d 100644
--- a/app/client/src/git/sagas/fetchLocalProfileSaga.ts
+++ b/app/client/src/git/sagas/fetchLocalProfileSaga.ts
@@ -10,18 +10,17 @@ import { captureException } from "@sentry/react";
export default function* fetchLocalProfileSaga(
action: GitArtifactPayloadAction,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: FetchLocalProfileResponse | undefined;
try {
- response = yield call(fetchLocalProfileRequest, baseArtifactId);
+ response = yield call(fetchLocalProfileRequest, artifactDef.baseArtifactId);
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
yield put(
gitArtifactActions.fetchLocalProfileSuccess({
- ...basePayload,
+ artifactDef,
responseData: response.data,
}),
);
@@ -31,7 +30,7 @@ export default function* fetchLocalProfileSaga(
const { error } = response.responseMeta;
yield put(
- gitArtifactActions.fetchLocalProfileError({ ...basePayload, error }),
+ gitArtifactActions.fetchLocalProfileError({ artifactDef, error }),
);
} else {
log.error(e);
diff --git a/app/client/src/git/sagas/fetchMergeStatusSaga.ts b/app/client/src/git/sagas/fetchMergeStatusSaga.ts
index 684233de206d..024954b017c5 100644
--- a/app/client/src/git/sagas/fetchMergeStatusSaga.ts
+++ b/app/client/src/git/sagas/fetchMergeStatusSaga.ts
@@ -14,8 +14,7 @@ import { validateResponse } from "sagas/ErrorSagas";
export default function* fetchMergeStatusSaga(
action: GitArtifactPayloadAction<FetchMergeStatusInitPayload>,
) {
- const { artifactId, artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = action.payload;
let response: FetchMergeStatusResponse | undefined;
try {
@@ -30,7 +29,7 @@ export default function* fetchMergeStatusSaga(
if (response && isValidResponse) {
yield put(
gitArtifactActions.fetchMergeStatusSuccess({
- ...basePayload,
+ artifactDef,
responseData: response.data,
}),
);
@@ -40,10 +39,7 @@ export default function* fetchMergeStatusSaga(
const { error } = response.responseMeta;
yield put(
- gitArtifactActions.fetchMergeStatusError({
- ...basePayload,
- error,
- }),
+ gitArtifactActions.fetchMergeStatusError({ artifactDef, error }),
);
} else {
log.error(e);
diff --git a/app/client/src/git/sagas/fetchMetadataSaga.ts b/app/client/src/git/sagas/fetchMetadataSaga.ts
index 3e2029b6c6b8..9f8285847ee7 100644
--- a/app/client/src/git/sagas/fetchMetadataSaga.ts
+++ b/app/client/src/git/sagas/fetchMetadataSaga.ts
@@ -8,18 +8,17 @@ import { call, put } from "redux-saga/effects";
import { validateResponse } from "sagas/ErrorSagas";
export default function* fetchMetadataSaga(action: GitArtifactPayloadAction) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: FetchMetadataResponse | undefined;
try {
- response = yield call(fetchMetadataRequest, baseArtifactId);
+ response = yield call(fetchMetadataRequest, artifactDef.baseArtifactId);
const isValidResponse: boolean = yield validateResponse(response, false);
if (response && isValidResponse) {
yield put(
gitArtifactActions.fetchMetadataSuccess({
- ...basePayload,
+ artifactDef,
responseData: response.data,
}),
);
@@ -30,7 +29,7 @@ export default function* fetchMetadataSaga(action: GitArtifactPayloadAction) {
yield put(
gitArtifactActions.fetchMetadataError({
- ...basePayload,
+ artifactDef,
error,
}),
);
diff --git a/app/client/src/git/sagas/fetchProtectedBranchesSaga.ts b/app/client/src/git/sagas/fetchProtectedBranchesSaga.ts
index 9c81123ea26f..62f36f8ce93c 100644
--- a/app/client/src/git/sagas/fetchProtectedBranchesSaga.ts
+++ b/app/client/src/git/sagas/fetchProtectedBranchesSaga.ts
@@ -10,19 +10,21 @@ import { validateResponse } from "sagas/ErrorSagas";
export default function* fetchProtectedBranchesSaga(
action: GitArtifactPayloadAction,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: FetchProtectedBranchesResponse | undefined;
try {
- response = yield call(fetchProtectedBranchesRequest, baseArtifactId);
+ response = yield call(
+ fetchProtectedBranchesRequest,
+ artifactDef.baseArtifactId,
+ );
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
yield put(
gitArtifactActions.fetchProtectedBranchesSuccess({
- ...basePayload,
+ artifactDef,
responseData: response.data,
}),
);
@@ -33,7 +35,7 @@ export default function* fetchProtectedBranchesSaga(
yield put(
gitArtifactActions.fetchProtectedBranchesError({
- ...basePayload,
+ artifactDef,
error,
}),
);
diff --git a/app/client/src/git/sagas/fetchSSHKeySaga.ts b/app/client/src/git/sagas/fetchSSHKeySaga.ts
index 02f797edae66..16736e92f5d1 100644
--- a/app/client/src/git/sagas/fetchSSHKeySaga.ts
+++ b/app/client/src/git/sagas/fetchSSHKeySaga.ts
@@ -8,18 +8,17 @@ import { call, put } from "redux-saga/effects";
import { validateResponse } from "sagas/ErrorSagas";
export function* fetchSSHKeySaga(action: GitArtifactPayloadAction) {
- const { artifactType, baseArtifactId } = action.payload;
- const artifactDef = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: FetchSSHKeyResponse | undefined;
try {
- response = yield call(fetchSSHKeyRequest, baseArtifactId);
+ response = yield call(fetchSSHKeyRequest, artifactDef.baseArtifactId);
const isValidResponse: boolean = yield validateResponse(response, false);
if (response && isValidResponse) {
yield put(
gitArtifactActions.fetchSSHKeySuccess({
- ...artifactDef,
+ artifactDef,
responseData: response.data,
}),
);
@@ -28,7 +27,7 @@ export function* fetchSSHKeySaga(action: GitArtifactPayloadAction) {
if (response && response.responseMeta.error) {
const { error } = response.responseMeta;
- yield put(gitArtifactActions.fetchSSHKeyError({ ...artifactDef, error }));
+ yield put(gitArtifactActions.fetchSSHKeyError({ artifactDef, error }));
} else {
log.error(e);
captureException(e);
diff --git a/app/client/src/git/sagas/fetchStatusSaga.ts b/app/client/src/git/sagas/fetchStatusSaga.ts
index 4c714a22c0da..733f18cce776 100644
--- a/app/client/src/git/sagas/fetchStatusSaga.ts
+++ b/app/client/src/git/sagas/fetchStatusSaga.ts
@@ -11,18 +11,17 @@ import { validateResponse } from "sagas/ErrorSagas";
export default function* fetchStatusSaga(
action: GitArtifactPayloadAction<FetchStatusInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = action.payload;
let response: FetchStatusResponse | undefined;
try {
- response = yield call(fetchStatusRequest, baseArtifactId);
+ response = yield call(fetchStatusRequest, artifactId);
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
yield put(
gitArtifactActions.fetchStatusSuccess({
- ...basePayload,
+ artifactDef,
responseData: response.data,
}),
);
@@ -33,7 +32,7 @@ export default function* fetchStatusSaga(
yield put(
gitArtifactActions.fetchStatusError({
- ...basePayload,
+ artifactDef,
error,
}),
);
diff --git a/app/client/src/git/sagas/generateSSHKeySaga.ts b/app/client/src/git/sagas/generateSSHKeySaga.ts
index 09773f9dc0d4..afbccf24b2e6 100644
--- a/app/client/src/git/sagas/generateSSHKeySaga.ts
+++ b/app/client/src/git/sagas/generateSSHKeySaga.ts
@@ -15,23 +15,25 @@ import { validateResponse } from "sagas/ErrorSagas";
export function* generateSSHKeySaga(
action: GitArtifactPayloadAction<GenerateSSHKeyInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const artifactDef = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: GenerateSSHKeyResponse | undefined;
try {
const params: GenerateSSHKeyRequestParams = {
keyType: action.payload.keyType,
- isImport: action.payload.isImport,
};
- response = yield call(generateSSHKeyRequest, baseArtifactId, params);
+ response = yield call(
+ generateSSHKeyRequest,
+ artifactDef.baseArtifactId,
+ params,
+ );
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
yield put(
gitArtifactActions.generateSSHKeySuccess({
- ...artifactDef,
+ artifactDef,
responseData: response.data,
}),
);
@@ -43,15 +45,13 @@ export function* generateSSHKeySaga(
if (GitErrorCodes.REPO_LIMIT_REACHED === error.code) {
yield put(
gitArtifactActions.toggleRepoLimitErrorModal({
- ...artifactDef,
+ artifactDef,
open: true,
}),
);
}
- yield put(
- gitArtifactActions.generateSSHKeyError({ ...artifactDef, error }),
- );
+ yield put(gitArtifactActions.generateSSHKeyError({ artifactDef, error }));
} else {
log.error(e);
captureException(e);
diff --git a/app/client/src/git/sagas/gitImportSaga.ts b/app/client/src/git/sagas/gitImportSaga.ts
new file mode 100644
index 000000000000..ecf3d718ae08
--- /dev/null
+++ b/app/client/src/git/sagas/gitImportSaga.ts
@@ -0,0 +1,92 @@
+import log from "loglevel";
+import { call, put, select } from "redux-saga/effects";
+import { validateResponse } from "sagas/ErrorSagas";
+import history from "utils/history";
+import { toast } from "@appsmith/ads";
+import type { PayloadAction } from "@reduxjs/toolkit";
+import { captureException } from "@sentry/react";
+import gitImportRequest from "git/requests/gitImportRequest";
+import type { GitImportResponse } from "git/requests/gitImportRequest.types";
+import type { GitImportInitPayload } from "git/store/actions/gitImportActions";
+import { gitGlobalActions } from "git/store/gitGlobalSlice";
+import { createMessage, IMPORT_APP_SUCCESSFUL } from "ee/constants/messages";
+import { builderURL } from "ee/RouteBuilder";
+import { getWorkspaceIdForImport } from "ee/selectors/applicationSelectors";
+import { showReconnectDatasourceModal } from "ee/actions/applicationActions";
+import type { Workspace } from "ee/constants/workspaceConstants";
+import { getFetchedWorkspaces } from "ee/selectors/workspaceSelectors";
+
+export default function* gitImportSaga(
+ action: PayloadAction<GitImportInitPayload>,
+) {
+ const { ...params } = action.payload;
+ const workspaceId: string = yield select(getWorkspaceIdForImport);
+
+ let response: GitImportResponse | undefined;
+
+ try {
+ response = yield call(gitImportRequest, workspaceId, params);
+ const isValidResponse: boolean = yield validateResponse(response);
+
+ if (response && isValidResponse) {
+ const allWorkspaces: Workspace[] = yield select(getFetchedWorkspaces);
+ const currentWorkspace = allWorkspaces.filter(
+ (el: Workspace) => el.id === workspaceId,
+ );
+
+ if (currentWorkspace.length > 0) {
+ const { application, isPartialImport, unconfiguredDatasourceList } =
+ response.data;
+
+ yield put(gitGlobalActions.gitImportSuccess());
+ yield put(gitGlobalActions.toggleImportModal({ open: false }));
+
+ // there is configuration-missing datasources
+ if (isPartialImport) {
+ yield put(
+ showReconnectDatasourceModal({
+ application: application,
+ unConfiguredDatasourceList: unconfiguredDatasourceList ?? [],
+ workspaceId,
+ }),
+ );
+ } else {
+ let basePageId = "";
+
+ if (application.pages && application.pages.length > 0) {
+ const defaultPage = application.pages.find(
+ (eachPage) => !!eachPage.isDefault,
+ );
+
+ basePageId = defaultPage ? defaultPage.baseId : "";
+ }
+
+ const pageURL = builderURL({
+ basePageId,
+ });
+
+ history.push(pageURL);
+ toast.show(createMessage(IMPORT_APP_SUCCESSFUL), {
+ kind: "success",
+ });
+ }
+ }
+ }
+ } catch (e) {
+ // const isRepoLimitReachedError: boolean = yield call(
+ // handleRepoLimitReachedError,
+ // response,
+ // );
+
+ // if (isRepoLimitReachedError) return;
+
+ if (response?.responseMeta?.error) {
+ yield put(
+ gitGlobalActions.gitImportError({ error: response.responseMeta.error }),
+ );
+ } else {
+ log.error(e);
+ captureException(e);
+ }
+ }
+}
diff --git a/app/client/src/git/sagas/index.ts b/app/client/src/git/sagas/index.ts
index 13e19bd4c9f8..61c0a0747330 100644
--- a/app/client/src/git/sagas/index.ts
+++ b/app/client/src/git/sagas/index.ts
@@ -8,7 +8,6 @@ import {
import type { TakeableChannel } from "redux-saga";
import type { PayloadAction } from "@reduxjs/toolkit";
import { objectKeys } from "@appsmith/utils";
-import { gitConfigActions } from "../store/gitConfigSlice";
import { gitArtifactActions } from "../store/gitArtifactSlice";
import connectSaga from "./connectSaga";
import commitSaga from "./commitSaga";
@@ -37,6 +36,9 @@ import {
blockingActionSagas as blockingActionSagasExtended,
nonBlockingActionSagas as nonBlockingActionSagasExtended,
} from "git/ee/sagas";
+import { gitGlobalActions } from "git/store/gitGlobalSlice";
+import { fetchGlobalSSHKeySaga } from "./fetchGlobalSSHKeySaga";
+import gitImportSaga from "./gitImportSaga";
const blockingActionSagas: Record<
string,
@@ -50,6 +52,9 @@ const blockingActionSagas: Record<
[gitArtifactActions.connectInit.type]: connectSaga,
[gitArtifactActions.disconnectInit.type]: disconnectSaga,
+ // import
+ [gitGlobalActions.gitImportInit.type]: gitImportSaga,
+
// ops
[gitArtifactActions.commitInit.type]: commitSaga,
[gitArtifactActions.fetchStatusInit.type]: fetchStatusSaga,
@@ -65,8 +70,8 @@ const blockingActionSagas: Record<
// user profiles
[gitArtifactActions.fetchLocalProfileInit.type]: fetchLocalProfileSaga,
[gitArtifactActions.updateLocalProfileInit.type]: updateLocalProfileSaga,
- [gitConfigActions.fetchGlobalProfileInit.type]: fetchGlobalProfileSaga,
- [gitConfigActions.updateGlobalProfileInit.type]: updateGlobalProfileSaga,
+ [gitGlobalActions.fetchGlobalProfileInit.type]: fetchGlobalProfileSaga,
+ [gitGlobalActions.updateGlobalProfileInit.type]: updateGlobalProfileSaga,
// protected branches
[gitArtifactActions.fetchProtectedBranchesInit.type]:
@@ -93,6 +98,7 @@ const nonBlockingActionSagas: Record<
// ssh key
[gitArtifactActions.fetchSSHKeyInit.type]: fetchSSHKeySaga,
[gitArtifactActions.generateSSHKeyInit.type]: generateSSHKeySaga,
+ [gitGlobalActions.fetchGlobalSSHKeyInit.type]: fetchGlobalSSHKeySaga,
// EE
...nonBlockingActionSagasExtended,
diff --git a/app/client/src/git/sagas/initGitSaga.ts b/app/client/src/git/sagas/initGitSaga.ts
index aa50efce17b1..b880b1854c41 100644
--- a/app/client/src/git/sagas/initGitSaga.ts
+++ b/app/client/src/git/sagas/initGitSaga.ts
@@ -7,24 +7,25 @@ import { put, take } from "redux-saga/effects";
export default function* initGitForEditorSaga(
action: GitArtifactPayloadAction<InitGitForEditorPayload>,
) {
- const { artifact, artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifact, artifactDef } = action.payload;
+ const artifactId = artifact?.id;
- yield put(gitArtifactActions.mount(basePayload));
+ yield put(gitArtifactActions.mount({ artifactDef }));
- if (artifactType === GitArtifactType.Application) {
- if (!!artifact.gitApplicationMetadata?.remoteUrl) {
- yield put(gitArtifactActions.fetchMetadataInit(basePayload));
+ if (artifactId && artifactDef.artifactType === GitArtifactType.Application) {
+ if (!!artifact?.gitApplicationMetadata?.remoteUrl) {
+ yield put(gitArtifactActions.fetchMetadataInit({ artifactDef }));
yield take(gitArtifactActions.fetchMetadataSuccess.type);
yield put(
- gitArtifactActions.triggerAutocommitInit({
- ...basePayload,
- artifactId: artifact.id,
- }),
+ gitArtifactActions.triggerAutocommitInit({ artifactDef, artifactId }),
+ );
+ yield put(
+ gitArtifactActions.fetchBranchesInit({ artifactDef, artifactId }),
+ );
+ yield put(gitArtifactActions.fetchProtectedBranchesInit({ artifactDef }));
+ yield put(
+ gitArtifactActions.fetchStatusInit({ artifactDef, artifactId }),
);
- yield put(gitArtifactActions.fetchBranchesInit(basePayload));
- yield put(gitArtifactActions.fetchProtectedBranchesInit(basePayload));
- yield put(gitArtifactActions.fetchStatusInit(basePayload));
}
}
}
diff --git a/app/client/src/git/sagas/pullSaga.ts b/app/client/src/git/sagas/pullSaga.ts
index eafb4a5c098b..07347326e3e0 100644
--- a/app/client/src/git/sagas/pullSaga.ts
+++ b/app/client/src/git/sagas/pullSaga.ts
@@ -4,7 +4,7 @@ import type { PullResponse } from "git/requests/pullRequest.types";
import type { PullInitPayload } from "git/store/actions/pullActions";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
import type { GitArtifactPayloadAction } from "git/store/types";
-import { selectCurrentBranch } from "git/store/selectors/gitSingleArtifactSelectors";
+import { selectCurrentBranch } from "git/store/selectors/gitArtifactSelectors";
// internal dependencies
import { validateResponse } from "sagas/ErrorSagas";
@@ -17,8 +17,7 @@ import { captureException } from "@sentry/react";
export default function* pullSaga(
action: GitArtifactPayloadAction<PullInitPayload>,
) {
- const { artifactId, artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = action.payload;
let response: PullResponse | undefined;
try {
@@ -26,12 +25,12 @@ export default function* pullSaga(
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
- yield put(gitArtifactActions.pullSuccess(basePayload));
+ yield put(gitArtifactActions.pullSuccess({ artifactDef }));
const currentBasePageId: string = yield select(getCurrentBasePageId);
const currentBranch: string = yield select(
selectCurrentBranch,
- basePayload,
+ artifactDef,
);
yield put(
@@ -51,7 +50,7 @@ export default function* pullSaga(
// yield put(setIsGitErrorPopupVisible({ isVisible: true }));
// }
- yield put(gitArtifactActions.pullError({ ...basePayload, error }));
+ yield put(gitArtifactActions.pullError({ artifactDef, error }));
} else {
log.error(e);
captureException(e);
diff --git a/app/client/src/git/sagas/toggleAutocommitSaga.ts b/app/client/src/git/sagas/toggleAutocommitSaga.ts
index cf8b0e923c67..4f97d0289543 100644
--- a/app/client/src/git/sagas/toggleAutocommitSaga.ts
+++ b/app/client/src/git/sagas/toggleAutocommitSaga.ts
@@ -10,24 +10,23 @@ import { validateResponse } from "sagas/ErrorSagas";
export default function* toggleAutocommitSaga(
action: GitArtifactPayloadAction,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const artifactDef = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: ToggleAutocommitResponse | undefined;
try {
- response = yield call(toggleAutocommitRequest, baseArtifactId);
+ response = yield call(toggleAutocommitRequest, artifactDef.baseArtifactId);
const isValidResponse: boolean = yield validateResponse(response);
if (isValidResponse) {
- yield put(gitArtifactActions.toggleAutocommitSuccess(artifactDef));
- yield put(gitArtifactActions.fetchMetadataInit(artifactDef));
+ yield put(gitArtifactActions.toggleAutocommitSuccess({ artifactDef }));
+ yield put(gitArtifactActions.fetchMetadataInit({ artifactDef }));
}
} catch (e) {
if (response && response.responseMeta.error) {
const { error } = response.responseMeta;
yield put(
- gitArtifactActions.toggleAutocommitError({ ...artifactDef, error }),
+ gitArtifactActions.toggleAutocommitError({ artifactDef, error }),
);
} else {
log.error(e);
diff --git a/app/client/src/git/sagas/triggerAutocommitSaga.ts b/app/client/src/git/sagas/triggerAutocommitSaga.ts
index d0b316f594ec..6725fb0d59f9 100644
--- a/app/client/src/git/sagas/triggerAutocommitSaga.ts
+++ b/app/client/src/git/sagas/triggerAutocommitSaga.ts
@@ -1,8 +1,5 @@
import { triggerAutocommitSuccessAction } from "actions/gitSyncActions";
-import {
- AutocommitStatusState,
- type GitArtifactType,
-} from "git/constants/enums";
+import { AutocommitStatusState } from "git/constants/enums";
import fetchAutocommitProgressRequest from "git/requests/fetchAutocommitProgressRequest";
import type {
FetchAutocommitProgressResponse,
@@ -15,8 +12,8 @@ import type {
} from "git/requests/triggerAutocommitRequest.types";
import type { TriggerAutocommitInitPayload } from "git/store/actions/triggerAutocommitActions";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
-import { selectAutocommitEnabled } from "git/store/selectors/gitSingleArtifactSelectors";
-import type { GitArtifactPayloadAction } from "git/store/types";
+import { selectAutocommitEnabled } from "git/store/selectors/gitArtifactSelectors";
+import type { GitArtifactDef, GitArtifactPayloadAction } from "git/store/types";
import {
call,
cancel,
@@ -39,8 +36,7 @@ const AUTOCOMMIT_WHITELISTED_STATES = [
];
interface PollAutocommitProgressParams {
- artifactType: keyof typeof GitArtifactType;
- baseArtifactId: string;
+ artifactDef: GitArtifactDef;
artifactId: string;
}
@@ -57,8 +53,7 @@ function isAutocommitHappening(
}
function* pollAutocommitProgressSaga(params: PollAutocommitProgressParams) {
- const { artifactId, artifactType, baseArtifactId } = params;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = params;
let triggerResponse: TriggerAutocommitResponse | undefined;
try {
@@ -66,14 +61,14 @@ function* pollAutocommitProgressSaga(params: PollAutocommitProgressParams) {
const isValidResponse: boolean = yield validateResponse(triggerResponse);
if (triggerResponse && isValidResponse) {
- yield put(gitArtifactActions.triggerAutocommitSuccess(basePayload));
+ yield put(gitArtifactActions.triggerAutocommitSuccess({ artifactDef }));
}
} catch (e) {
if (triggerResponse && triggerResponse.responseMeta.error) {
const { error } = triggerResponse.responseMeta;
yield put(
- gitArtifactActions.triggerAutocommitError({ ...basePayload, error }),
+ gitArtifactActions.triggerAutocommitError({ artifactDef, error }),
);
} else {
log.error(e);
@@ -85,39 +80,47 @@ function* pollAutocommitProgressSaga(params: PollAutocommitProgressParams) {
try {
if (isAutocommitHappening(triggerResponse?.data)) {
- yield put(gitArtifactActions.pollAutocommitProgressStart(basePayload));
+ yield put(
+ gitArtifactActions.pollAutocommitProgressStart({ artifactDef }),
+ );
while (true) {
- yield put(gitArtifactActions.fetchAutocommitProgressInit(basePayload));
+ yield put(
+ gitArtifactActions.fetchAutocommitProgressInit({ artifactDef }),
+ );
progressResponse = yield call(
fetchAutocommitProgressRequest,
- baseArtifactId,
+ artifactDef.baseArtifactId,
);
const isValidResponse: boolean =
yield validateResponse(progressResponse);
if (isValidResponse && !isAutocommitHappening(progressResponse?.data)) {
- yield put(gitArtifactActions.pollAutocommitProgressStop(basePayload));
+ yield put(
+ gitArtifactActions.pollAutocommitProgressStop({ artifactDef }),
+ );
}
if (!isValidResponse) {
- yield put(gitArtifactActions.pollAutocommitProgressStop(basePayload));
+ yield put(
+ gitArtifactActions.pollAutocommitProgressStop({ artifactDef }),
+ );
}
yield delay(AUTOCOMMIT_POLL_DELAY);
}
} else {
- yield put(gitArtifactActions.pollAutocommitProgressStop(basePayload));
+ yield put(gitArtifactActions.pollAutocommitProgressStop({ artifactDef }));
}
} catch (e) {
- yield put(gitArtifactActions.pollAutocommitProgressStop(basePayload));
+ yield put(gitArtifactActions.pollAutocommitProgressStop({ artifactDef }));
if (progressResponse && progressResponse.responseMeta.error) {
const { error } = progressResponse.responseMeta;
yield put(
gitArtifactActions.fetchAutocommitProgressError({
- ...basePayload,
+ artifactDef,
error,
}),
);
@@ -131,15 +134,14 @@ function* pollAutocommitProgressSaga(params: PollAutocommitProgressParams) {
export default function* triggerAutocommitSaga(
action: GitArtifactPayloadAction<TriggerAutocommitInitPayload>,
) {
- const { artifactId, artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef, artifactId } = action.payload;
const isAutocommitEnabled: boolean = yield select(
selectAutocommitEnabled,
- basePayload,
+ artifactDef,
);
if (isAutocommitEnabled) {
- const params = { artifactType, baseArtifactId, artifactId };
+ const params = { artifactDef, artifactId };
const pollTask: Task = yield fork(pollAutocommitProgressSaga, params);
yield take(gitArtifactActions.pollAutocommitProgressStop.type);
diff --git a/app/client/src/git/sagas/updateGlobalProfileSaga.ts b/app/client/src/git/sagas/updateGlobalProfileSaga.ts
index 2ce98fe47fb4..d7466b1ed007 100644
--- a/app/client/src/git/sagas/updateGlobalProfileSaga.ts
+++ b/app/client/src/git/sagas/updateGlobalProfileSaga.ts
@@ -6,12 +6,12 @@ import type {
UpdateGlobalProfileRequestParams,
UpdateGlobalProfileResponse,
} from "../requests/updateGlobalProfileRequest.types";
-import { gitConfigActions } from "../store/gitConfigSlice";
// internal dependencies
import { validateResponse } from "sagas/ErrorSagas";
import log from "loglevel";
import { captureException } from "@sentry/react";
+import { gitGlobalActions } from "git/store/gitGlobalSlice";
export default function* updateGlobalProfileSaga(
action: PayloadAction<UpdateGlobalProfileInitPayload>,
@@ -29,14 +29,14 @@ export default function* updateGlobalProfileSaga(
const isValidResponse: boolean = yield validateResponse(response, true);
if (response && isValidResponse) {
- yield put(gitConfigActions.updateGlobalProfileSuccess());
- yield put(gitConfigActions.fetchGlobalProfileInit());
+ yield put(gitGlobalActions.updateGlobalProfileSuccess());
+ yield put(gitGlobalActions.fetchGlobalProfileInit());
}
} catch (e) {
if (response && response.responseMeta.error) {
const { error } = response.responseMeta;
- yield put(gitConfigActions.updateGlobalProfileError({ error }));
+ yield put(gitGlobalActions.updateGlobalProfileError({ error }));
} else {
log.error(e);
captureException(e);
diff --git a/app/client/src/git/sagas/updateLocalProfileSaga.ts b/app/client/src/git/sagas/updateLocalProfileSaga.ts
index 74579562b058..3b7253a391fe 100644
--- a/app/client/src/git/sagas/updateLocalProfileSaga.ts
+++ b/app/client/src/git/sagas/updateLocalProfileSaga.ts
@@ -14,8 +14,7 @@ import { captureException } from "@sentry/react";
export default function* updateLocalProfileSaga(
action: GitArtifactPayloadAction<UpdateLocalProfileInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const basePayload = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: UpdateLocalProfileResponse | undefined;
try {
@@ -25,20 +24,24 @@ export default function* updateLocalProfileSaga(
useGlobalProfile: action.payload.useGlobalProfile,
};
- response = yield call(updateLocalProfileRequest, baseArtifactId, params);
+ response = yield call(
+ updateLocalProfileRequest,
+ artifactDef.baseArtifactId,
+ params,
+ );
const isValidResponse: boolean = yield validateResponse(response);
if (isValidResponse) {
- yield put(gitArtifactActions.updateLocalProfileSuccess(basePayload));
- yield put(gitArtifactActions.fetchLocalProfileInit(basePayload));
+ yield put(gitArtifactActions.updateLocalProfileSuccess({ artifactDef }));
+ yield put(gitArtifactActions.fetchLocalProfileInit({ artifactDef }));
}
} catch (e) {
if (response && response.responseMeta.error) {
const { error } = response.responseMeta;
yield put(
- gitArtifactActions.updateLocalProfileError({ ...basePayload, error }),
+ gitArtifactActions.updateLocalProfileError({ artifactDef, error }),
);
} else {
log.error(e);
diff --git a/app/client/src/git/sagas/updateProtectedBranchesSaga.ts b/app/client/src/git/sagas/updateProtectedBranchesSaga.ts
index 3f7bd121270e..f24b20ee9290 100644
--- a/app/client/src/git/sagas/updateProtectedBranchesSaga.ts
+++ b/app/client/src/git/sagas/updateProtectedBranchesSaga.ts
@@ -14,8 +14,7 @@ import { validateResponse } from "sagas/ErrorSagas";
export default function* updateProtectedBranchesSaga(
action: GitArtifactPayloadAction<UpdateProtectedBranchesInitPayload>,
) {
- const { artifactType, baseArtifactId } = action.payload;
- const artifactDef = { artifactType, baseArtifactId };
+ const { artifactDef } = action.payload;
let response: UpdateProtectedBranchesResponse | undefined;
try {
@@ -25,14 +24,16 @@ export default function* updateProtectedBranchesSaga(
response = yield call(
updateProtectedBranchesRequest,
- baseArtifactId,
+ artifactDef.baseArtifactId,
params,
);
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
- yield put(gitArtifactActions.updateProtectedBranchesSuccess(artifactDef));
- yield put(gitArtifactActions.fetchProtectedBranchesInit(artifactDef));
+ yield put(
+ gitArtifactActions.updateProtectedBranchesSuccess({ artifactDef }),
+ );
+ yield put(gitArtifactActions.fetchProtectedBranchesInit({ artifactDef }));
}
} catch (e) {
if (response && response.responseMeta.error) {
@@ -40,7 +41,7 @@ export default function* updateProtectedBranchesSaga(
yield put(
gitArtifactActions.updateProtectedBranchesError({
- ...artifactDef,
+ artifactDef,
error,
}),
);
diff --git a/app/client/src/git/store/actions/checkoutBranchActions.ts b/app/client/src/git/store/actions/checkoutBranchActions.ts
index c771d1887e34..e9451a614d7f 100644
--- a/app/client/src/git/store/actions/checkoutBranchActions.ts
+++ b/app/client/src/git/store/actions/checkoutBranchActions.ts
@@ -1,12 +1,13 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitAsyncErrorPayload } from "../types";
import type { CheckoutBranchRequestParams } from "git/requests/checkoutBranchRequest.types";
-export interface CheckoutBranchInitPayload
- extends CheckoutBranchRequestParams {}
+export interface CheckoutBranchInitPayload extends CheckoutBranchRequestParams {
+ artifactId: string;
+}
export const checkoutBranchInitAction =
- createSingleArtifactAction<CheckoutBranchInitPayload>((state, action) => {
+ createArtifactAction<CheckoutBranchInitPayload>((state, action) => {
state.apiResponses.checkoutBranch.loading = true;
state.apiResponses.checkoutBranch.error = null;
state.ui.checkoutDestBranch = action.payload.branchName;
@@ -14,18 +15,16 @@ export const checkoutBranchInitAction =
return state;
});
-export const checkoutBranchSuccessAction = createSingleArtifactAction(
- (state) => {
- state.apiResponses.checkoutBranch.loading = false;
- state.apiResponses.checkoutBranch.error = null;
- state.ui.checkoutDestBranch = null;
+export const checkoutBranchSuccessAction = createArtifactAction((state) => {
+ state.apiResponses.checkoutBranch.loading = false;
+ state.apiResponses.checkoutBranch.error = null;
+ state.ui.checkoutDestBranch = null;
- return state;
- },
-);
+ return state;
+});
export const checkoutBranchErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.checkoutBranch.loading = false;
diff --git a/app/client/src/git/store/actions/commitActions.ts b/app/client/src/git/store/actions/commitActions.ts
index 9ebb8d37db60..876463e803a9 100644
--- a/app/client/src/git/store/actions/commitActions.ts
+++ b/app/client/src/git/store/actions/commitActions.ts
@@ -1,10 +1,12 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitAsyncErrorPayload } from "../types";
import type { CommitRequestParams } from "git/requests/commitRequest.types";
-export interface CommitInitPayload extends CommitRequestParams {}
+export interface CommitInitPayload extends CommitRequestParams {
+ artifactId: string;
+}
-export const commitInitAction = createSingleArtifactAction<CommitInitPayload>(
+export const commitInitAction = createArtifactAction<CommitInitPayload>(
(state) => {
state.apiResponses.commit.loading = true;
state.apiResponses.commit.error = null;
@@ -13,23 +15,24 @@ export const commitInitAction = createSingleArtifactAction<CommitInitPayload>(
},
);
-export const commitSuccessAction = createSingleArtifactAction((state) => {
+export const commitSuccessAction = createArtifactAction((state) => {
state.apiResponses.commit.loading = false;
return state;
});
-export const commitErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+export const commitErrorAction = createArtifactAction<GitAsyncErrorPayload>(
+ (state, action) => {
const { error } = action.payload;
state.apiResponses.commit.loading = false;
state.apiResponses.commit.error = error;
return state;
- });
+ },
+);
-export const clearCommitErrorAction = createSingleArtifactAction((state) => {
+export const clearCommitErrorAction = createArtifactAction((state) => {
state.apiResponses.commit.error = null;
return state;
diff --git a/app/client/src/git/store/actions/connectActions.ts b/app/client/src/git/store/actions/connectActions.ts
index 7fed98500000..9e5e2bcf10b1 100644
--- a/app/client/src/git/store/actions/connectActions.ts
+++ b/app/client/src/git/store/actions/connectActions.ts
@@ -1,12 +1,13 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
-import type { GitAsyncErrorPayload } from "../types";
-import type { ConnectRequestParams } from "git/requests/connectRequest.types";
+import { createArtifactAction } from "../helpers/createArtifactAction";
+import type { GitAsyncErrorPayload, GitAsyncSuccessPayload } from "../types";
+import type {
+ ConnectRequestParams,
+ ConnectResponseData,
+} from "git/requests/connectRequest.types";
-export interface ConnectInitPayload extends ConnectRequestParams {
- branchedPageId?: string;
-}
+export interface ConnectInitPayload extends ConnectRequestParams {}
-export const connectInitAction = createSingleArtifactAction<ConnectInitPayload>(
+export const connectInitAction = createArtifactAction<ConnectInitPayload>(
(state) => {
state.apiResponses.connect.loading = true;
state.apiResponses.connect.error = null;
@@ -15,18 +16,24 @@ export const connectInitAction = createSingleArtifactAction<ConnectInitPayload>(
},
);
-export const connectSuccessAction = createSingleArtifactAction((state) => {
- state.apiResponses.connect.loading = false;
+export interface ConnectSuccessPayload
+ extends GitAsyncSuccessPayload<ConnectResponseData> {}
- return state;
-});
+export const connectSuccessAction = createArtifactAction<ConnectSuccessPayload>(
+ (state) => {
+ state.apiResponses.connect.loading = false;
+
+ return state;
+ },
+);
-export const connectErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+export const connectErrorAction = createArtifactAction<GitAsyncErrorPayload>(
+ (state, action) => {
const { error } = action.payload;
state.apiResponses.connect.loading = false;
state.apiResponses.connect.error = error;
return state;
- });
+ },
+);
diff --git a/app/client/src/git/store/actions/createBranchActions.ts b/app/client/src/git/store/actions/createBranchActions.ts
index be0e08445de2..010a7550888f 100644
--- a/app/client/src/git/store/actions/createBranchActions.ts
+++ b/app/client/src/git/store/actions/createBranchActions.ts
@@ -1,25 +1,27 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitAsyncErrorPayload } from "../types";
import type { CreateBranchRequestParams } from "git/requests/createBranchRequest.types";
-export interface CreateBranchInitPayload extends CreateBranchRequestParams {}
+export interface CreateBranchInitPayload extends CreateBranchRequestParams {
+ artifactId: string;
+}
export const createBranchInitAction =
- createSingleArtifactAction<CreateBranchInitPayload>((state) => {
+ createArtifactAction<CreateBranchInitPayload>((state) => {
state.apiResponses.createBranch.loading = true;
state.apiResponses.createBranch.error = null;
return state;
});
-export const createBranchSuccessAction = createSingleArtifactAction((state) => {
+export const createBranchSuccessAction = createArtifactAction((state) => {
state.apiResponses.createBranch.loading = false;
return state;
});
export const createBranchErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.createBranch.loading = false;
diff --git a/app/client/src/git/store/actions/deleteBranchActions.ts b/app/client/src/git/store/actions/deleteBranchActions.ts
index 09296625f0d6..0656886f39d4 100644
--- a/app/client/src/git/store/actions/deleteBranchActions.ts
+++ b/app/client/src/git/store/actions/deleteBranchActions.ts
@@ -1,25 +1,27 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitAsyncErrorPayload } from "../types";
import type { DeleteBranchRequestParams } from "../../requests/deleteBranchRequest.types";
-export interface DeleteBranchInitPayload extends DeleteBranchRequestParams {}
+export interface DeleteBranchInitPayload extends DeleteBranchRequestParams {
+ artifactId: string;
+}
export const deleteBranchInitAction =
- createSingleArtifactAction<DeleteBranchInitPayload>((state) => {
+ createArtifactAction<DeleteBranchInitPayload>((state) => {
state.apiResponses.deleteBranch.loading = true;
state.apiResponses.deleteBranch.error = null;
return state;
});
-export const deleteBranchSuccessAction = createSingleArtifactAction((state) => {
+export const deleteBranchSuccessAction = createArtifactAction((state) => {
state.apiResponses.deleteBranch.loading = false;
return state;
});
export const deleteBranchErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.deleteBranch.loading = false;
diff --git a/app/client/src/git/store/actions/discardActions.ts b/app/client/src/git/store/actions/discardActions.ts
index 35d37c0a6d0e..0f514cd0e585 100644
--- a/app/client/src/git/store/actions/discardActions.ts
+++ b/app/client/src/git/store/actions/discardActions.ts
@@ -1,20 +1,20 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitArtifactErrorPayloadAction } from "../types";
-export const discardInitAction = createSingleArtifactAction((state) => {
+export const discardInitAction = createArtifactAction((state) => {
state.apiResponses.discard.loading = true;
state.apiResponses.discard.error = null;
return state;
});
-export const discardSuccessAction = createSingleArtifactAction((state) => {
+export const discardSuccessAction = createArtifactAction((state) => {
state.apiResponses.discard.loading = false;
return state;
});
-export const discardErrorAction = createSingleArtifactAction(
+export const discardErrorAction = createArtifactAction(
(state, action: GitArtifactErrorPayloadAction) => {
const { error } = action.payload;
@@ -25,7 +25,7 @@ export const discardErrorAction = createSingleArtifactAction(
},
);
-export const clearDiscardErrorAction = createSingleArtifactAction((state) => {
+export const clearDiscardErrorAction = createArtifactAction((state) => {
state.apiResponses.discard.error = null;
return state;
diff --git a/app/client/src/git/store/actions/disconnectActions.ts b/app/client/src/git/store/actions/disconnectActions.ts
index dba26c0de629..082aa91b7970 100644
--- a/app/client/src/git/store/actions/disconnectActions.ts
+++ b/app/client/src/git/store/actions/disconnectActions.ts
@@ -1,20 +1,20 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitArtifactErrorPayloadAction } from "../types";
-export const disconnectInitAction = createSingleArtifactAction((state) => {
+export const disconnectInitAction = createArtifactAction((state) => {
state.apiResponses.disconnect.loading = true;
state.apiResponses.disconnect.error = null;
return state;
});
-export const disconnectSuccessAction = createSingleArtifactAction((state) => {
+export const disconnectSuccessAction = createArtifactAction((state) => {
state.apiResponses.disconnect.loading = false;
return state;
});
-export const disconnectErrorAction = createSingleArtifactAction(
+export const disconnectErrorAction = createArtifactAction(
(state, action: GitArtifactErrorPayloadAction) => {
const { error } = action.payload;
diff --git a/app/client/src/git/store/actions/fetchAutocommitProgressActions.ts b/app/client/src/git/store/actions/fetchAutocommitProgressActions.ts
index a7d92793e4aa..bbde6e4dd649 100644
--- a/app/client/src/git/store/actions/fetchAutocommitProgressActions.ts
+++ b/app/client/src/git/store/actions/fetchAutocommitProgressActions.ts
@@ -1,7 +1,7 @@
import type { GitAsyncErrorPayload } from "../types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
-export const fetchAutocommitProgressInitAction = createSingleArtifactAction(
+export const fetchAutocommitProgressInitAction = createArtifactAction(
(state) => {
state.apiResponses.autocommitProgress.loading = true;
state.apiResponses.autocommitProgress.error = null;
@@ -10,7 +10,7 @@ export const fetchAutocommitProgressInitAction = createSingleArtifactAction(
},
);
-export const fetchAutocommitProgressSuccessAction = createSingleArtifactAction(
+export const fetchAutocommitProgressSuccessAction = createArtifactAction(
(state) => {
state.apiResponses.autocommitProgress.loading = false;
@@ -19,7 +19,7 @@ export const fetchAutocommitProgressSuccessAction = createSingleArtifactAction(
);
export const fetchAutocommitProgressErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.autocommitProgress.loading = false;
diff --git a/app/client/src/git/store/actions/fetchBranchesActions.ts b/app/client/src/git/store/actions/fetchBranchesActions.ts
index e83ce0325e59..6758ad918eb0 100644
--- a/app/client/src/git/store/actions/fetchBranchesActions.ts
+++ b/app/client/src/git/store/actions/fetchBranchesActions.ts
@@ -3,19 +3,21 @@ import type {
FetchBranchesResponseData,
} from "../../requests/fetchBranchesRequest.types";
import type { GitAsyncErrorPayload, GitAsyncSuccessPayload } from "../types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
-export interface FetchBranchesInitPayload extends FetchBranchesRequestParams {}
+export interface FetchBranchesInitPayload extends FetchBranchesRequestParams {
+ artifactId: string;
+}
export const fetchBranchesInitAction =
- createSingleArtifactAction<FetchBranchesInitPayload>((state) => {
+ createArtifactAction<FetchBranchesInitPayload>((state) => {
state.apiResponses.branches.loading = true;
state.apiResponses.branches.error = null;
return state;
});
-export const fetchBranchesSuccessAction = createSingleArtifactAction<
+export const fetchBranchesSuccessAction = createArtifactAction<
GitAsyncSuccessPayload<FetchBranchesResponseData>
>((state, action) => {
state.apiResponses.branches.loading = false;
@@ -25,7 +27,7 @@ export const fetchBranchesSuccessAction = createSingleArtifactAction<
});
export const fetchBranchesErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.branches.loading = false;
diff --git a/app/client/src/git/store/actions/fetchGlobalProfileActions.ts b/app/client/src/git/store/actions/fetchGlobalProfileActions.ts
index 7cfb2390b021..bc2d0b6b92a3 100644
--- a/app/client/src/git/store/actions/fetchGlobalProfileActions.ts
+++ b/app/client/src/git/store/actions/fetchGlobalProfileActions.ts
@@ -2,11 +2,11 @@ import type { FetchGlobalProfileResponseData } from "git/requests/fetchGlobalPro
import type {
GitAsyncSuccessPayload,
GitAsyncErrorPayload,
- GitConfigReduxState,
+ GitGlobalReduxState,
} from "../types";
import type { PayloadAction } from "@reduxjs/toolkit";
-export const fetchGlobalProfileInitAction = (state: GitConfigReduxState) => {
+export const fetchGlobalProfileInitAction = (state: GitGlobalReduxState) => {
state.globalProfile.loading = true;
state.globalProfile.error = null;
@@ -14,7 +14,7 @@ export const fetchGlobalProfileInitAction = (state: GitConfigReduxState) => {
};
export const fetchGlobalProfileSuccessAction = (
- state: GitConfigReduxState,
+ state: GitGlobalReduxState,
action: PayloadAction<GitAsyncSuccessPayload<FetchGlobalProfileResponseData>>,
) => {
state.globalProfile.loading = false;
@@ -24,7 +24,7 @@ export const fetchGlobalProfileSuccessAction = (
};
export const fetchGlobalProfileErrorAction = (
- state: GitConfigReduxState,
+ state: GitGlobalReduxState,
action: PayloadAction<GitAsyncErrorPayload>,
) => {
const { error } = action.payload;
diff --git a/app/client/src/git/store/actions/fetchGlobalSSHKeyActions.ts b/app/client/src/git/store/actions/fetchGlobalSSHKeyActions.ts
new file mode 100644
index 000000000000..de9add1c5ee0
--- /dev/null
+++ b/app/client/src/git/store/actions/fetchGlobalSSHKeyActions.ts
@@ -0,0 +1,55 @@
+import type {
+ FetchGlobalSSHKeyRequestParams,
+ FetchGlobalSSHKeyResponseData,
+} from "git/requests/fetchGlobalSSHKeyRequest.types";
+import type {
+ GitAsyncSuccessPayload,
+ GitAsyncErrorPayload,
+ GitGlobalReduxState,
+} from "../types";
+import type { PayloadAction } from "@reduxjs/toolkit";
+
+export interface FetchGlobalSSHKeyInitPayload
+ extends FetchGlobalSSHKeyRequestParams {}
+
+export const fetchGlobalSSHKeyInitAction = (
+ state: GitGlobalReduxState,
+ // need action to better define action type
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ action: PayloadAction<FetchGlobalSSHKeyInitPayload>,
+) => {
+ state.globalSSHKey.loading = true;
+ state.globalSSHKey.error = null;
+
+ return state;
+};
+
+export const fetchGlobalSSHKeySuccessAction = (
+ state: GitGlobalReduxState,
+ action: PayloadAction<GitAsyncSuccessPayload<FetchGlobalSSHKeyResponseData>>,
+) => {
+ state.globalSSHKey.loading = false;
+ state.globalSSHKey.value = action.payload.responseData;
+
+ return state;
+};
+
+export const fetchGlobalSSHKeyErrorAction = (
+ state: GitGlobalReduxState,
+ action: PayloadAction<GitAsyncErrorPayload>,
+) => {
+ const { error } = action.payload;
+
+ state.globalSSHKey.loading = false;
+ state.globalSSHKey.error = error;
+
+ return state;
+};
+
+export const resetGlobalSSHKeyAction = (state: GitGlobalReduxState) => {
+ state.globalSSHKey.loading = false;
+ state.globalSSHKey.value = null;
+ state.globalSSHKey.error = null;
+
+ return state;
+};
diff --git a/app/client/src/git/store/actions/fetchLocalProfileActions.ts b/app/client/src/git/store/actions/fetchLocalProfileActions.ts
index 3559a2814c35..33a62514f44c 100644
--- a/app/client/src/git/store/actions/fetchLocalProfileActions.ts
+++ b/app/client/src/git/store/actions/fetchLocalProfileActions.ts
@@ -3,18 +3,16 @@ import type {
GitArtifactErrorPayloadAction,
GitAsyncSuccessPayload,
} from "../types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
-export const fetchLocalProfileInitAction = createSingleArtifactAction(
- (state) => {
- state.apiResponses.localProfile.loading = true;
- state.apiResponses.localProfile.error = null;
+export const fetchLocalProfileInitAction = createArtifactAction((state) => {
+ state.apiResponses.localProfile.loading = true;
+ state.apiResponses.localProfile.error = null;
- return state;
- },
-);
+ return state;
+});
-export const fetchLocalProfileSuccessAction = createSingleArtifactAction<
+export const fetchLocalProfileSuccessAction = createArtifactAction<
GitAsyncSuccessPayload<FetchLocalProfileResponseData>
>((state, action) => {
state.apiResponses.localProfile.loading = false;
@@ -23,7 +21,7 @@ export const fetchLocalProfileSuccessAction = createSingleArtifactAction<
return state;
});
-export const fetchLocalProfileErrorAction = createSingleArtifactAction(
+export const fetchLocalProfileErrorAction = createArtifactAction(
(state, action: GitArtifactErrorPayloadAction) => {
const { error } = action.payload;
diff --git a/app/client/src/git/store/actions/fetchMergeStatusActions.ts b/app/client/src/git/store/actions/fetchMergeStatusActions.ts
index 65ed313114cb..26b72829fadd 100644
--- a/app/client/src/git/store/actions/fetchMergeStatusActions.ts
+++ b/app/client/src/git/store/actions/fetchMergeStatusActions.ts
@@ -1,5 +1,5 @@
import type { GitAsyncSuccessPayload, GitAsyncErrorPayload } from "../types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type {
FetchMergeStatusRequestParams,
FetchMergeStatusResponseData,
@@ -11,14 +11,14 @@ export interface FetchMergeStatusInitPayload
}
export const fetchMergeStatusInitAction =
- createSingleArtifactAction<FetchMergeStatusInitPayload>((state) => {
+ createArtifactAction<FetchMergeStatusInitPayload>((state) => {
state.apiResponses.mergeStatus.loading = true;
state.apiResponses.mergeStatus.error = null;
return state;
});
-export const fetchMergeStatusSuccessAction = createSingleArtifactAction<
+export const fetchMergeStatusSuccessAction = createArtifactAction<
GitAsyncSuccessPayload<FetchMergeStatusResponseData>
>((state, action) => {
state.apiResponses.mergeStatus.loading = false;
@@ -28,7 +28,7 @@ export const fetchMergeStatusSuccessAction = createSingleArtifactAction<
});
export const fetchMergeStatusErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.mergeStatus.loading = false;
@@ -37,7 +37,7 @@ export const fetchMergeStatusErrorAction =
return state;
});
-export const clearMergeStatusAction = createSingleArtifactAction((state) => {
+export const clearMergeStatusAction = createArtifactAction((state) => {
state.apiResponses.mergeStatus.loading = false;
state.apiResponses.mergeStatus.error = null;
state.apiResponses.mergeStatus.value = null;
diff --git a/app/client/src/git/store/actions/fetchMetadataActions.ts b/app/client/src/git/store/actions/fetchMetadataActions.ts
index 176413dfbaaa..6e7a9f2f1e3d 100644
--- a/app/client/src/git/store/actions/fetchMetadataActions.ts
+++ b/app/client/src/git/store/actions/fetchMetadataActions.ts
@@ -1,15 +1,15 @@
import type { GitAsyncErrorPayload, GitAsyncSuccessPayload } from "../types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { FetchMetadataResponseData } from "git/requests/fetchMetadataRequest.types";
-export const fetchMetadataInitAction = createSingleArtifactAction((state) => {
+export const fetchMetadataInitAction = createArtifactAction((state) => {
state.apiResponses.metadata.loading = true;
state.apiResponses.metadata.error = null;
return state;
});
-export const fetchMetadataSuccessAction = createSingleArtifactAction<
+export const fetchMetadataSuccessAction = createArtifactAction<
GitAsyncSuccessPayload<FetchMetadataResponseData>
>((state, action) => {
state.apiResponses.metadata.loading = false;
@@ -19,7 +19,7 @@ export const fetchMetadataSuccessAction = createSingleArtifactAction<
});
export const fetchMetadataErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.metadata.loading = false;
diff --git a/app/client/src/git/store/actions/fetchProtectedBranchesActions.ts b/app/client/src/git/store/actions/fetchProtectedBranchesActions.ts
index dc66ff2290c0..1ad38bf4096c 100644
--- a/app/client/src/git/store/actions/fetchProtectedBranchesActions.ts
+++ b/app/client/src/git/store/actions/fetchProtectedBranchesActions.ts
@@ -1,8 +1,8 @@
import type { GitAsyncSuccessPayload, GitAsyncErrorPayload } from "../types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { FetchProtectedBranchesResponseData } from "git/requests/fetchProtectedBranchesRequest.types";
-export const fetchProtectedBranchesInitAction = createSingleArtifactAction(
+export const fetchProtectedBranchesInitAction = createArtifactAction(
(state) => {
state.apiResponses.protectedBranches.loading = true;
state.apiResponses.protectedBranches.error = null;
@@ -11,7 +11,7 @@ export const fetchProtectedBranchesInitAction = createSingleArtifactAction(
},
);
-export const fetchProtectedBranchesSuccessAction = createSingleArtifactAction<
+export const fetchProtectedBranchesSuccessAction = createArtifactAction<
GitAsyncSuccessPayload<FetchProtectedBranchesResponseData>
>((state, action) => {
state.apiResponses.protectedBranches.loading = false;
@@ -21,7 +21,7 @@ export const fetchProtectedBranchesSuccessAction = createSingleArtifactAction<
});
export const fetchProtectedBranchesErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.protectedBranches.loading = false;
diff --git a/app/client/src/git/store/actions/fetchSSHKeyActions.ts b/app/client/src/git/store/actions/fetchSSHKeyActions.ts
index 828cf6ebcb75..386dd4643411 100644
--- a/app/client/src/git/store/actions/fetchSSHKeyActions.ts
+++ b/app/client/src/git/store/actions/fetchSSHKeyActions.ts
@@ -1,15 +1,15 @@
import type { GitAsyncErrorPayload, GitAsyncSuccessPayload } from "../types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { FetchSSHKeyResponseData } from "git/requests/fetchSSHKeyRequest.types";
-export const fetchSSHKeyInitAction = createSingleArtifactAction((state) => {
+export const fetchSSHKeyInitAction = createArtifactAction((state) => {
state.apiResponses.sshKey.loading = true;
state.apiResponses.sshKey.error = null;
return state;
});
-export const fetchSSHKeySuccessAction = createSingleArtifactAction<
+export const fetchSSHKeySuccessAction = createArtifactAction<
GitAsyncSuccessPayload<FetchSSHKeyResponseData>
>((state, action) => {
state.apiResponses.sshKey.loading = false;
@@ -20,7 +20,7 @@ export const fetchSSHKeySuccessAction = createSingleArtifactAction<
});
export const fetchSSHKeyErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.sshKey.loading = false;
@@ -29,7 +29,7 @@ export const fetchSSHKeyErrorAction =
return state;
});
-export const resetFetchSSHKeyAction = createSingleArtifactAction((state) => {
+export const resetFetchSSHKeyAction = createArtifactAction((state) => {
state.apiResponses.sshKey.loading = false;
state.apiResponses.sshKey.error = null;
state.apiResponses.sshKey.value = null;
diff --git a/app/client/src/git/store/actions/fetchStatusActions.ts b/app/client/src/git/store/actions/fetchStatusActions.ts
index 1121e368d012..47097593260b 100644
--- a/app/client/src/git/store/actions/fetchStatusActions.ts
+++ b/app/client/src/git/store/actions/fetchStatusActions.ts
@@ -3,19 +3,21 @@ import type {
FetchStatusResponseData,
} from "git/requests/fetchStatusRequest.types";
import type { GitAsyncErrorPayload, GitAsyncSuccessPayload } from "../types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
-export interface FetchStatusInitPayload extends FetchStatusRequestParams {}
+export interface FetchStatusInitPayload extends FetchStatusRequestParams {
+ artifactId: string;
+}
export const fetchStatusInitAction =
- createSingleArtifactAction<FetchStatusInitPayload>((state) => {
+ createArtifactAction<FetchStatusInitPayload>((state) => {
state.apiResponses.status.loading = true;
state.apiResponses.status.error = null;
return state;
});
-export const fetchStatusSuccessAction = createSingleArtifactAction<
+export const fetchStatusSuccessAction = createArtifactAction<
GitAsyncSuccessPayload<FetchStatusResponseData>
>((state, action) => {
state.apiResponses.status.loading = false;
@@ -25,7 +27,7 @@ export const fetchStatusSuccessAction = createSingleArtifactAction<
});
export const fetchStatusErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.status.loading = false;
diff --git a/app/client/src/git/store/actions/generateSSHKeyActions.ts b/app/client/src/git/store/actions/generateSSHKeyActions.ts
index fa70c3a1ba28..569d7d9995c2 100644
--- a/app/client/src/git/store/actions/generateSSHKeyActions.ts
+++ b/app/client/src/git/store/actions/generateSSHKeyActions.ts
@@ -2,21 +2,21 @@ import type {
GenerateSSHKeyRequestParams,
GenerateSSHKeyResponseData,
} from "git/requests/generateSSHKeyRequest.types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitAsyncErrorPayload, GitAsyncSuccessPayload } from "../types";
export interface GenerateSSHKeyInitPayload
extends GenerateSSHKeyRequestParams {}
export const generateSSHKeyInitAction =
- createSingleArtifactAction<GenerateSSHKeyInitPayload>((state) => {
+ createArtifactAction<GenerateSSHKeyInitPayload>((state) => {
state.apiResponses.generateSSHKey.loading = true;
state.apiResponses.generateSSHKey.error = null;
return state;
});
-export const generateSSHKeySuccessAction = createSingleArtifactAction<
+export const generateSSHKeySuccessAction = createArtifactAction<
GitAsyncSuccessPayload<GenerateSSHKeyResponseData>
>((state, action) => {
state.apiResponses.generateSSHKey.loading = false;
@@ -27,7 +27,7 @@ export const generateSSHKeySuccessAction = createSingleArtifactAction<
});
export const generateSSHKeyErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.generateSSHKey.loading = false;
@@ -36,7 +36,7 @@ export const generateSSHKeyErrorAction =
return state;
});
-export const resetGenerateSSHKeyAction = createSingleArtifactAction((state) => {
+export const resetGenerateSSHKeyAction = createArtifactAction((state) => {
state.apiResponses.generateSSHKey.loading = false;
state.apiResponses.generateSSHKey.error = null;
diff --git a/app/client/src/git/store/actions/gitImportActions.ts b/app/client/src/git/store/actions/gitImportActions.ts
index 49411b55dd55..30e9c7417b2d 100644
--- a/app/client/src/git/store/actions/gitImportActions.ts
+++ b/app/client/src/git/store/actions/gitImportActions.ts
@@ -1,25 +1,35 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
-import type { GitAsyncErrorPayload } from "../types";
+import type { PayloadAction } from "@reduxjs/toolkit";
+import type { GitAsyncErrorPayload, GitGlobalReduxState } from "../types";
+import type { GitImportRequestParams } from "git/requests/gitImportRequest.types";
-export const gitImportInitAction = createSingleArtifactAction((state) => {
- state.apiResponses.gitImport.loading = true;
- state.apiResponses.gitImport.error = null;
+export interface GitImportInitPayload extends GitImportRequestParams {}
+
+export const gitImportInitAction = (
+ state: GitGlobalReduxState,
+ // need type for better import
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ action: PayloadAction<GitImportInitPayload>,
+) => {
+ state.gitImport.loading = true;
+ state.gitImport.error = null;
return state;
-});
+};
-export const gitImportSuccessAction = createSingleArtifactAction((state) => {
- state.apiResponses.gitImport.loading = false;
+export const gitImportSuccessAction = (state: GitGlobalReduxState) => {
+ state.gitImport.loading = false;
return state;
-});
+};
-export const gitImportErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
- const { error } = action.payload;
+export const gitImportErrorAction = (
+ state: GitGlobalReduxState,
+ action: PayloadAction<GitAsyncErrorPayload>,
+) => {
+ const { error } = action.payload;
- state.apiResponses.gitImport.loading = false;
- state.apiResponses.gitImport.error = error;
+ state.gitImport.loading = false;
+ state.gitImport.error = error;
- return state;
- });
+ return state;
+};
diff --git a/app/client/src/git/store/actions/initGitActions.ts b/app/client/src/git/store/actions/initGitActions.ts
index d93cf955eeec..ebe588555a24 100644
--- a/app/client/src/git/store/actions/initGitActions.ts
+++ b/app/client/src/git/store/actions/initGitActions.ts
@@ -1,15 +1,11 @@
-import type { FetchMetadataResponseData } from "git/requests/fetchMetadataRequest.types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
+import type { ApplicationPayload } from "entities/Application";
export interface InitGitForEditorPayload {
- artifact: {
- id: string;
- baseId: string;
- gitApplicationMetadata?: Partial<FetchMetadataResponseData>;
- };
+ artifact: ApplicationPayload | null;
}
export const initGitForEditorAction =
- createSingleArtifactAction<InitGitForEditorPayload>((state) => {
+ createArtifactAction<InitGitForEditorPayload>((state) => {
return state;
});
diff --git a/app/client/src/git/store/actions/mergeActions.ts b/app/client/src/git/store/actions/mergeActions.ts
index 5bb17a351ce6..0d4e67eea8fe 100644
--- a/app/client/src/git/store/actions/mergeActions.ts
+++ b/app/client/src/git/store/actions/mergeActions.ts
@@ -1,20 +1,20 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitArtifactErrorPayloadAction } from "../types";
-export const mergeInitAction = createSingleArtifactAction((state) => {
+export const mergeInitAction = createArtifactAction((state) => {
state.apiResponses.merge.loading = true;
state.apiResponses.merge.error = null;
return state;
});
-export const mergeSuccessAction = createSingleArtifactAction((state) => {
+export const mergeSuccessAction = createArtifactAction((state) => {
state.apiResponses.merge.loading = false;
return state;
});
-export const mergeErrorAction = createSingleArtifactAction(
+export const mergeErrorAction = createArtifactAction(
(state, action: GitArtifactErrorPayloadAction) => {
const { error } = action.payload;
diff --git a/app/client/src/git/store/actions/mountActions.ts b/app/client/src/git/store/actions/mountActions.ts
index 07a08ee2b566..8d35126d9502 100644
--- a/app/client/src/git/store/actions/mountActions.ts
+++ b/app/client/src/git/store/actions/mountActions.ts
@@ -1,26 +1,31 @@
import type { PayloadAction } from "@reduxjs/toolkit";
-import type { GitArtifactBasePayload, GitArtifactReduxState } from "../types";
-import { gitSingleArtifactInitialState } from "../helpers/gitSingleArtifactInitialState";
+import type {
+ GitArtifactBasePayload,
+ GitArtifactRootReduxState,
+} from "../types";
+import { gitArtifactInitialState } from "../helpers/initialState";
// ! This might be removed later
export const mountAction = (
- state: GitArtifactReduxState,
+ state: GitArtifactRootReduxState,
action: PayloadAction<GitArtifactBasePayload>,
) => {
- const { artifactType, baseArtifactId } = action.payload;
+ const { artifactDef } = action.payload;
+ const { artifactType, baseArtifactId } = artifactDef;
state[artifactType] ??= {};
- state[artifactType][baseArtifactId] ??= gitSingleArtifactInitialState;
+ state[artifactType][baseArtifactId] ??= gitArtifactInitialState;
return state;
};
export const unmountAction = (
- state: GitArtifactReduxState,
+ state: GitArtifactRootReduxState,
action: PayloadAction<GitArtifactBasePayload>,
) => {
- const { artifactType, baseArtifactId } = action.payload;
+ const { artifactDef } = action.payload;
+ const { artifactType, baseArtifactId } = artifactDef;
delete state?.[artifactType]?.[baseArtifactId];
diff --git a/app/client/src/git/store/actions/pullActions.ts b/app/client/src/git/store/actions/pullActions.ts
index 00a0d00f2033..48d3398e18c6 100644
--- a/app/client/src/git/store/actions/pullActions.ts
+++ b/app/client/src/git/store/actions/pullActions.ts
@@ -1,26 +1,24 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitAsyncErrorPayload } from "../types";
export interface PullInitPayload {
artifactId: string;
}
-export const pullInitAction = createSingleArtifactAction<PullInitPayload>(
- (state) => {
- state.apiResponses.pull.loading = true;
- state.apiResponses.pull.error = null;
+export const pullInitAction = createArtifactAction<PullInitPayload>((state) => {
+ state.apiResponses.pull.loading = true;
+ state.apiResponses.pull.error = null;
- return state;
- },
-);
+ return state;
+});
-export const pullSuccessAction = createSingleArtifactAction((state) => {
+export const pullSuccessAction = createArtifactAction((state) => {
state.apiResponses.pull.loading = false;
return state;
});
-export const pullErrorAction = createSingleArtifactAction<GitAsyncErrorPayload>(
+export const pullErrorAction = createArtifactAction<GitAsyncErrorPayload>(
(state, action) => {
const { error } = action.payload;
diff --git a/app/client/src/git/store/actions/repoLimitErrorModalActions.ts b/app/client/src/git/store/actions/repoLimitErrorModalActions.ts
index b1867c1d5926..a2c96bac7721 100644
--- a/app/client/src/git/store/actions/repoLimitErrorModalActions.ts
+++ b/app/client/src/git/store/actions/repoLimitErrorModalActions.ts
@@ -1,16 +1,14 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
interface ToggleRepoLimitModalActionPayload {
open: boolean;
}
export const toggleRepoLimitErrorModalAction =
- createSingleArtifactAction<ToggleRepoLimitModalActionPayload>(
- (state, action) => {
- const { open } = action.payload;
+ createArtifactAction<ToggleRepoLimitModalActionPayload>((state, action) => {
+ const { open } = action.payload;
- state.ui.repoLimitErrorModalOpen = open;
+ state.ui.repoLimitErrorModalOpen = open;
- return state;
- },
- );
+ return state;
+ });
diff --git a/app/client/src/git/store/actions/toggleAutocommitActions.ts b/app/client/src/git/store/actions/toggleAutocommitActions.ts
index 96721698196f..d9c700cbb457 100644
--- a/app/client/src/git/store/actions/toggleAutocommitActions.ts
+++ b/app/client/src/git/store/actions/toggleAutocommitActions.ts
@@ -1,24 +1,20 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitArtifactErrorPayloadAction } from "../types";
-export const toggleAutocommitInitAction = createSingleArtifactAction(
- (state) => {
- state.apiResponses.toggleAutocommit.loading = true;
- state.apiResponses.toggleAutocommit.error = null;
+export const toggleAutocommitInitAction = createArtifactAction((state) => {
+ state.apiResponses.toggleAutocommit.loading = true;
+ state.apiResponses.toggleAutocommit.error = null;
- return state;
- },
-);
+ return state;
+});
-export const toggleAutocommitSuccessAction = createSingleArtifactAction(
- (state) => {
- state.apiResponses.toggleAutocommit.loading = false;
+export const toggleAutocommitSuccessAction = createArtifactAction((state) => {
+ state.apiResponses.toggleAutocommit.loading = false;
- return state;
- },
-);
+ return state;
+});
-export const toggleAutocommitErrorAction = createSingleArtifactAction(
+export const toggleAutocommitErrorAction = createArtifactAction(
(state, action: GitArtifactErrorPayloadAction) => {
const { error } = action.payload;
diff --git a/app/client/src/git/store/actions/triggerAutocommitActions.ts b/app/client/src/git/store/actions/triggerAutocommitActions.ts
index 28e88ecd2f16..da8075bc347f 100644
--- a/app/client/src/git/store/actions/triggerAutocommitActions.ts
+++ b/app/client/src/git/store/actions/triggerAutocommitActions.ts
@@ -1,4 +1,4 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitAsyncErrorPayload } from "../types";
export interface TriggerAutocommitInitPayload {
@@ -6,23 +6,21 @@ export interface TriggerAutocommitInitPayload {
}
export const triggerAutocommitInitAction =
- createSingleArtifactAction<TriggerAutocommitInitPayload>((state) => {
+ createArtifactAction<TriggerAutocommitInitPayload>((state) => {
state.apiResponses.triggerAutocommit.loading = true;
state.apiResponses.triggerAutocommit.error = null;
return state;
});
-export const triggerAutocommitSuccessAction = createSingleArtifactAction(
- (state) => {
- state.apiResponses.triggerAutocommit.loading = false;
+export const triggerAutocommitSuccessAction = createArtifactAction((state) => {
+ state.apiResponses.triggerAutocommit.loading = false;
- return state;
- },
-);
+ return state;
+});
export const triggerAutocommitErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.triggerAutocommit.loading = false;
@@ -31,7 +29,7 @@ export const triggerAutocommitErrorAction =
return state;
});
-export const pollAutocommitProgressStartAction = createSingleArtifactAction(
+export const pollAutocommitProgressStartAction = createArtifactAction(
(state) => {
state.ui.autocommitPolling = true;
@@ -39,7 +37,7 @@ export const pollAutocommitProgressStartAction = createSingleArtifactAction(
},
);
-export const pollAutocommitProgressStopAction = createSingleArtifactAction(
+export const pollAutocommitProgressStopAction = createArtifactAction(
(state) => {
state.ui.autocommitPolling = false;
diff --git a/app/client/src/git/store/actions/uiActions.ts b/app/client/src/git/store/actions/uiActions.ts
index 577d1dfa3d10..162382c3b876 100644
--- a/app/client/src/git/store/actions/uiActions.ts
+++ b/app/client/src/git/store/actions/uiActions.ts
@@ -1,5 +1,7 @@
import type { GitOpsTab, GitSettingsTab } from "git/constants/enums";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
+import type { GitGlobalReduxState } from "../types";
+import type { PayloadAction } from "@reduxjs/toolkit";
// connect modal
export interface ToggleConnectModalPayload {
@@ -7,7 +9,7 @@ export interface ToggleConnectModalPayload {
}
export const toggleConnectModalAction =
- createSingleArtifactAction<ToggleConnectModalPayload>((state, action) => {
+ createArtifactAction<ToggleConnectModalPayload>((state, action) => {
const { open } = action.payload;
state.ui.connectModalOpen = open;
@@ -15,27 +17,54 @@ export const toggleConnectModalAction =
return state;
});
+export interface ToggleConnectSuccessModalPayload {
+ open: boolean;
+}
+
+export const toggleConnectSuccessModalAction =
+ createArtifactAction<ToggleConnectSuccessModalPayload>((state, action) => {
+ const { open } = action.payload;
+
+ state.ui.connectSuccessModalOpen = open;
+
+ return state;
+ });
+
+export interface ToggleImportModalPayload {
+ open: boolean;
+}
+
+export const toggleImportModalAction = (
+ state: GitGlobalReduxState,
+ action: PayloadAction<ToggleImportModalPayload>,
+) => {
+ const { open } = action.payload;
+
+ state.isImportModalOpen = open;
+
+ return state;
+};
+
// disconnect modal
export interface OpenDisconnectModalPayload {
artifactName: string;
}
export const openDisconnectModalAction =
- createSingleArtifactAction<OpenDisconnectModalPayload>((state, action) => {
- state.ui.disconnectBaseArtifactId = action.payload.baseArtifactId;
+ createArtifactAction<OpenDisconnectModalPayload>((state, action) => {
+ state.ui.disconnectBaseArtifactId =
+ action.payload.artifactDef.baseArtifactId;
state.ui.disconnectArtifactName = action.payload.artifactName;
return state;
});
-export const closeDisconnectModalAction = createSingleArtifactAction(
- (state) => {
- state.ui.disconnectBaseArtifactId = null;
- state.ui.disconnectArtifactName = null;
+export const closeDisconnectModalAction = createArtifactAction((state) => {
+ state.ui.disconnectBaseArtifactId = null;
+ state.ui.disconnectArtifactName = null;
- return state;
- },
-);
+ return state;
+});
// ops modal
@@ -44,15 +73,16 @@ export interface ToggleOpsModalPayload {
tab: keyof typeof GitOpsTab;
}
-export const toggleOpsModalAction =
- createSingleArtifactAction<ToggleOpsModalPayload>((state, action) => {
+export const toggleOpsModalAction = createArtifactAction<ToggleOpsModalPayload>(
+ (state, action) => {
const { open, tab } = action.payload;
state.ui.opsModalOpen = open;
state.ui.opsModalTab = tab;
return state;
- });
+ },
+);
// settings modal
export interface ToggleSettingsModalPayload {
@@ -61,7 +91,7 @@ export interface ToggleSettingsModalPayload {
}
export const toggleSettingsModalAction =
- createSingleArtifactAction<ToggleSettingsModalPayload>((state, action) => {
+ createArtifactAction<ToggleSettingsModalPayload>((state, action) => {
const { open, tab } = action.payload;
state.ui.settingsModalOpen = open;
@@ -76,29 +106,28 @@ interface ToggleAutocommitDisableModalPayload {
}
export const toggleAutocommitDisableModalAction =
- createSingleArtifactAction<ToggleAutocommitDisableModalPayload>(
- (state, action) => {
- const { open } = action.payload;
+ createArtifactAction<ToggleAutocommitDisableModalPayload>((state, action) => {
+ const { open } = action.payload;
- state.ui.autocommitDisableModalOpen = open;
+ state.ui.autocommitDisableModalOpen = open;
- return state;
- },
- );
+ return state;
+ });
// branch popup
interface BranchPopupPayload {
open: boolean;
}
-export const toggleBranchPopupAction =
- createSingleArtifactAction<BranchPopupPayload>((state, action) => {
+export const toggleBranchPopupAction = createArtifactAction<BranchPopupPayload>(
+ (state, action) => {
const { open } = action.payload;
state.ui.branchPopupOpen = open;
return state;
- });
+ },
+);
// error modals
interface ToggleRepoLimitModalPayload {
@@ -106,7 +135,7 @@ interface ToggleRepoLimitModalPayload {
}
export const toggleRepoLimitErrorModalAction =
- createSingleArtifactAction<ToggleRepoLimitModalPayload>((state, action) => {
+ createArtifactAction<ToggleRepoLimitModalPayload>((state, action) => {
const { open } = action.payload;
state.ui.repoLimitErrorModalOpen = open;
@@ -119,12 +148,10 @@ interface ToggleConflictErrorModalPayload {
}
export const toggleConflictErrorModalAction =
- createSingleArtifactAction<ToggleConflictErrorModalPayload>(
- (state, action) => {
- const { open } = action.payload;
+ createArtifactAction<ToggleConflictErrorModalPayload>((state, action) => {
+ const { open } = action.payload;
- state.ui.conflictErrorModalOpen = open;
+ state.ui.conflictErrorModalOpen = open;
- return state;
- },
- );
+ return state;
+ });
diff --git a/app/client/src/git/store/actions/updateGlobalProfileActions.ts b/app/client/src/git/store/actions/updateGlobalProfileActions.ts
index b4d25b0b57d7..3549672deb56 100644
--- a/app/client/src/git/store/actions/updateGlobalProfileActions.ts
+++ b/app/client/src/git/store/actions/updateGlobalProfileActions.ts
@@ -1,14 +1,14 @@
import type { UpdateGlobalProfileRequestParams } from "git/requests/updateGlobalProfileRequest.types";
-import type { GitAsyncErrorPayload, GitConfigReduxState } from "../types";
+import type { GitAsyncErrorPayload, GitGlobalReduxState } from "../types";
import type { PayloadAction } from "@reduxjs/toolkit";
export interface UpdateGlobalProfileInitPayload
extends UpdateGlobalProfileRequestParams {}
type UpdateGlobalProfileInitAction = (
- state: GitConfigReduxState,
+ state: GitGlobalReduxState,
action: PayloadAction<UpdateGlobalProfileInitPayload>,
-) => GitConfigReduxState;
+) => GitGlobalReduxState;
export const updateGlobalProfileInitAction: UpdateGlobalProfileInitAction = (
state,
@@ -20,7 +20,7 @@ export const updateGlobalProfileInitAction: UpdateGlobalProfileInitAction = (
};
export const updateGlobalProfileSuccessAction = (
- state: GitConfigReduxState,
+ state: GitGlobalReduxState,
) => {
state.updateGlobalProfile.loading = false;
@@ -28,7 +28,7 @@ export const updateGlobalProfileSuccessAction = (
};
export const updateGlobalProfileErrorAction = (
- state: GitConfigReduxState,
+ state: GitGlobalReduxState,
action: PayloadAction<GitAsyncErrorPayload>,
) => {
const { error } = action.payload;
diff --git a/app/client/src/git/store/actions/updateLocalProfileActions.ts b/app/client/src/git/store/actions/updateLocalProfileActions.ts
index 717bb388cb9b..84ac561a5026 100644
--- a/app/client/src/git/store/actions/updateLocalProfileActions.ts
+++ b/app/client/src/git/store/actions/updateLocalProfileActions.ts
@@ -1,4 +1,4 @@
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitAsyncErrorPayload } from "../types";
import type { UpdateLocalProfileRequestParams } from "git/requests/updateLocalProfileRequest.types";
@@ -6,23 +6,21 @@ export interface UpdateLocalProfileInitPayload
extends UpdateLocalProfileRequestParams {}
export const updateLocalProfileInitAction =
- createSingleArtifactAction<UpdateLocalProfileInitPayload>((state) => {
+ createArtifactAction<UpdateLocalProfileInitPayload>((state) => {
state.apiResponses.updateLocalProfile.loading = true;
state.apiResponses.updateLocalProfile.error = null;
return state;
});
-export const updateLocalProfileSuccessAction = createSingleArtifactAction(
- (state) => {
- state.apiResponses.updateLocalProfile.loading = false;
+export const updateLocalProfileSuccessAction = createArtifactAction((state) => {
+ state.apiResponses.updateLocalProfile.loading = false;
- return state;
- },
-);
+ return state;
+});
export const updateLocalProfileErrorAction =
- createSingleArtifactAction<GitAsyncErrorPayload>((state, action) => {
+ createArtifactAction<GitAsyncErrorPayload>((state, action) => {
const { error } = action.payload;
state.apiResponses.updateLocalProfile.loading = false;
diff --git a/app/client/src/git/store/actions/updateProtectedBranchesActions.ts b/app/client/src/git/store/actions/updateProtectedBranchesActions.ts
index 6e45bf0dcca5..a19926b673f9 100644
--- a/app/client/src/git/store/actions/updateProtectedBranchesActions.ts
+++ b/app/client/src/git/store/actions/updateProtectedBranchesActions.ts
@@ -1,19 +1,19 @@
import type { UpdateProtectedBranchesRequestParams } from "git/requests/updateProtectedBranchesRequest.types";
-import { createSingleArtifactAction } from "../helpers/createSingleArtifactAction";
+import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitArtifactErrorPayloadAction } from "../types";
export interface UpdateProtectedBranchesInitPayload
extends UpdateProtectedBranchesRequestParams {}
export const updateProtectedBranchesInitAction =
- createSingleArtifactAction<UpdateProtectedBranchesInitPayload>((state) => {
+ createArtifactAction<UpdateProtectedBranchesInitPayload>((state) => {
state.apiResponses.updateProtectedBranches.loading = true;
state.apiResponses.updateProtectedBranches.error = null;
return state;
});
-export const updateProtectedBranchesSuccessAction = createSingleArtifactAction(
+export const updateProtectedBranchesSuccessAction = createArtifactAction(
(state) => {
state.apiResponses.updateProtectedBranches.loading = false;
@@ -21,7 +21,7 @@ export const updateProtectedBranchesSuccessAction = createSingleArtifactAction(
},
);
-export const updateProtectedBranchesErrorAction = createSingleArtifactAction(
+export const updateProtectedBranchesErrorAction = createArtifactAction(
(state, action: GitArtifactErrorPayloadAction) => {
const { error } = action.payload;
diff --git a/app/client/src/git/store/gitArtifactSlice.ts b/app/client/src/git/store/gitArtifactSlice.ts
index 924785f80c76..15bbb4de65d2 100644
--- a/app/client/src/git/store/gitArtifactSlice.ts
+++ b/app/client/src/git/store/gitArtifactSlice.ts
@@ -1,5 +1,5 @@
import { createSlice } from "@reduxjs/toolkit";
-import type { GitArtifactReduxState } from "./types";
+import type { GitArtifactRootReduxState } from "./types";
import { mountAction, unmountAction } from "./actions/mountActions";
import {
connectErrorAction,
@@ -62,6 +62,7 @@ import {
openDisconnectModalAction,
closeDisconnectModalAction,
toggleAutocommitDisableModalAction,
+ toggleConnectSuccessModalAction,
} from "./actions/uiActions";
import {
checkoutBranchErrorAction,
@@ -119,11 +120,6 @@ import {
disconnectInitAction,
disconnectSuccessAction,
} from "./actions/disconnectActions";
-import {
- gitImportErrorAction,
- gitImportInitAction,
- gitImportSuccessAction,
-} from "./actions/gitImportActions";
import {
fetchSSHKeyErrorAction,
fetchSSHKeyInitAction,
@@ -137,7 +133,7 @@ import {
resetGenerateSSHKeyAction,
} from "./actions/generateSSHKeyActions";
-const initialState: GitArtifactReduxState = {};
+const initialState: GitArtifactRootReduxState = {};
export const gitArtifactSlice = createSlice({
name: "git/artifact",
@@ -156,9 +152,6 @@ export const gitArtifactSlice = createSlice({
connectInit: connectInitAction,
connectSuccess: connectSuccessAction,
connectError: connectErrorAction,
- gitImportInit: gitImportInitAction,
- gitImportSuccess: gitImportSuccessAction,
- gitImportError: gitImportErrorAction,
fetchSSHKeyInit: fetchSSHKeyInitAction,
fetchSSHKeySuccess: fetchSSHKeySuccessAction,
fetchSSHKeyError: fetchSSHKeyErrorAction,
@@ -171,6 +164,7 @@ export const gitArtifactSlice = createSlice({
disconnectSuccess: disconnectSuccessAction,
disconnectError: disconnectErrorAction,
toggleConnectModal: toggleConnectModalAction,
+ toggleConnectSuccessModal: toggleConnectSuccessModalAction,
openDisconnectModal: openDisconnectModalAction,
closeDisconnectModal: closeDisconnectModalAction,
toggleRepoLimitErrorModal: toggleRepoLimitErrorModalAction,
diff --git a/app/client/src/git/store/gitConfigSlice.ts b/app/client/src/git/store/gitConfigSlice.ts
deleted file mode 100644
index a07a45d9730b..000000000000
--- a/app/client/src/git/store/gitConfigSlice.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { createSlice } from "@reduxjs/toolkit";
-import {
- fetchGlobalProfileErrorAction,
- fetchGlobalProfileInitAction,
- fetchGlobalProfileSuccessAction,
-} from "./actions/fetchGlobalProfileActions";
-import {
- updateGlobalProfileErrorAction,
- updateGlobalProfileInitAction,
- updateGlobalProfileSuccessAction,
-} from "./actions/updateGlobalProfileActions";
-import { gitConfigInitialState } from "./helpers/gitConfigInitialState";
-
-export const gitConfigSlice = createSlice({
- name: "git/config",
- initialState: gitConfigInitialState,
- reducers: {
- fetchGlobalProfileInit: fetchGlobalProfileInitAction,
- fetchGlobalProfileSuccess: fetchGlobalProfileSuccessAction,
- fetchGlobalProfileError: fetchGlobalProfileErrorAction,
- updateGlobalProfileInit: updateGlobalProfileInitAction,
- updateGlobalProfileSuccess: updateGlobalProfileSuccessAction,
- updateGlobalProfileError: updateGlobalProfileErrorAction,
- },
-});
-
-export const gitConfigActions = gitConfigSlice.actions;
-
-export const gitConfigReducer = gitConfigSlice.reducer;
diff --git a/app/client/src/git/store/gitGlobalSlice.ts b/app/client/src/git/store/gitGlobalSlice.ts
new file mode 100644
index 000000000000..4a26f5d6132f
--- /dev/null
+++ b/app/client/src/git/store/gitGlobalSlice.ts
@@ -0,0 +1,49 @@
+import { createSlice } from "@reduxjs/toolkit";
+import {
+ fetchGlobalProfileErrorAction,
+ fetchGlobalProfileInitAction,
+ fetchGlobalProfileSuccessAction,
+} from "./actions/fetchGlobalProfileActions";
+import {
+ updateGlobalProfileErrorAction,
+ updateGlobalProfileInitAction,
+ updateGlobalProfileSuccessAction,
+} from "./actions/updateGlobalProfileActions";
+import { gitGlobalInitialState } from "./helpers/initialState";
+import { toggleImportModalAction } from "./actions/uiActions";
+import {
+ gitImportErrorAction,
+ gitImportInitAction,
+ gitImportSuccessAction,
+} from "./actions/gitImportActions";
+import {
+ fetchGlobalSSHKeyErrorAction,
+ fetchGlobalSSHKeyInitAction,
+ fetchGlobalSSHKeySuccessAction,
+ resetGlobalSSHKeyAction,
+} from "./actions/fetchGlobalSSHKeyActions";
+
+export const gitGlobalSlice = createSlice({
+ name: "git/config",
+ initialState: gitGlobalInitialState,
+ reducers: {
+ fetchGlobalProfileInit: fetchGlobalProfileInitAction,
+ fetchGlobalProfileSuccess: fetchGlobalProfileSuccessAction,
+ fetchGlobalProfileError: fetchGlobalProfileErrorAction,
+ updateGlobalProfileInit: updateGlobalProfileInitAction,
+ updateGlobalProfileSuccess: updateGlobalProfileSuccessAction,
+ updateGlobalProfileError: updateGlobalProfileErrorAction,
+ fetchGlobalSSHKeyInit: fetchGlobalSSHKeyInitAction,
+ fetchGlobalSSHKeySuccess: fetchGlobalSSHKeySuccessAction,
+ fetchGlobalSSHKeyError: fetchGlobalSSHKeyErrorAction,
+ resetGlobalSSHKey: resetGlobalSSHKeyAction,
+ gitImportInit: gitImportInitAction,
+ gitImportSuccess: gitImportSuccessAction,
+ gitImportError: gitImportErrorAction,
+ toggleImportModal: toggleImportModalAction,
+ },
+});
+
+export const gitGlobalActions = gitGlobalSlice.actions;
+
+export const gitGlobalReducer = gitGlobalSlice.reducer;
diff --git a/app/client/src/git/store/helpers/createArtifactAction.ts b/app/client/src/git/store/helpers/createArtifactAction.ts
new file mode 100644
index 000000000000..c138af710d53
--- /dev/null
+++ b/app/client/src/git/store/helpers/createArtifactAction.ts
@@ -0,0 +1,35 @@
+import type {
+ GitArtifactBasePayload,
+ GitArtifactPayloadAction,
+ GitArtifactReduxState,
+ GitArtifactRootReduxState,
+} from "../types";
+import { gitArtifactInitialState } from "./initialState";
+
+type ArtifactStateCb<T> = (
+ artifactState: GitArtifactReduxState,
+ action: GitArtifactPayloadAction<T>,
+) => GitArtifactReduxState;
+
+export const createArtifactAction = <T = GitArtifactBasePayload>(
+ artifactStateCb: ArtifactStateCb<T>,
+) => {
+ return (
+ state: GitArtifactRootReduxState,
+ action: GitArtifactPayloadAction<T>,
+ ) => {
+ const { artifactType, baseArtifactId } = action.payload.artifactDef;
+
+ state[artifactType] ??= {};
+ state[artifactType][baseArtifactId] ??= gitArtifactInitialState;
+
+ const artifactState = state[artifactType][baseArtifactId];
+
+ state[artifactType][baseArtifactId] = artifactStateCb(
+ artifactState,
+ action,
+ );
+
+ return state;
+ };
+};
diff --git a/app/client/src/git/store/helpers/createSingleArtifactAction.ts b/app/client/src/git/store/helpers/createSingleArtifactAction.ts
deleted file mode 100644
index 2e0642959be8..000000000000
--- a/app/client/src/git/store/helpers/createSingleArtifactAction.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import type {
- GitArtifactBasePayload,
- GitArtifactPayloadAction,
- GitArtifactReduxState,
- GitSingleArtifactReduxState,
-} from "../types";
-import { gitSingleArtifactInitialState } from "./gitSingleArtifactInitialState";
-
-type SingleArtifactStateCb<T> = (
- singleArtifactState: GitSingleArtifactReduxState,
- action: GitArtifactPayloadAction<T>,
-) => GitSingleArtifactReduxState;
-
-export const createSingleArtifactAction = <T = GitArtifactBasePayload>(
- singleArtifactStateCb: SingleArtifactStateCb<T>,
-) => {
- return (
- state: GitArtifactReduxState,
- action: GitArtifactPayloadAction<T>,
- ) => {
- const { artifactType, baseArtifactId } = action.payload;
-
- state[artifactType] ??= {};
- state[artifactType][baseArtifactId] ??= gitSingleArtifactInitialState;
-
- const singleArtifactState = state[artifactType][baseArtifactId];
-
- state[artifactType][baseArtifactId] = singleArtifactStateCb(
- singleArtifactState,
- action,
- );
-
- return state;
- };
-};
diff --git a/app/client/src/git/store/helpers/gitConfigInitialState.ts b/app/client/src/git/store/helpers/gitConfigInitialState.ts
deleted file mode 100644
index 7017399dfb16..000000000000
--- a/app/client/src/git/store/helpers/gitConfigInitialState.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import type { GitConfigReduxState } from "../types";
-
-export const gitConfigInitialState: GitConfigReduxState = {
- globalProfile: {
- value: null,
- loading: false,
- error: null,
- },
- updateGlobalProfile: {
- loading: false,
- error: null,
- },
-};
diff --git a/app/client/src/git/store/helpers/gitSingleArtifactInitialState.ts b/app/client/src/git/store/helpers/gitSingleArtifactInitialState.ts
deleted file mode 100644
index b17c93a126cb..000000000000
--- a/app/client/src/git/store/helpers/gitSingleArtifactInitialState.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-import {
- gitArtifactAPIResponsesInitialState as gitArtifactAPIResponsesInitialStateExtended,
- gitArtifactUIInitialState as gitArtifactUIInitialStateExtended,
-} from "git/ee/store/helpers/initialState";
-import { GitOpsTab, GitSettingsTab } from "../../constants/enums";
-import type {
- GitSingleArtifactAPIResponsesReduxState,
- GitSingleArtifactUIReduxState,
- GitSingleArtifactReduxState,
-} from "../types";
-
-const gitSingleArtifactInitialUIState: GitSingleArtifactUIReduxState = {
- connectModalOpen: false,
- disconnectBaseArtifactId: null,
- disconnectArtifactName: null,
- branchPopupOpen: false,
- checkoutDestBranch: null,
- opsModalOpen: false,
- opsModalTab: GitOpsTab.Deploy,
- settingsModalOpen: false,
- settingsModalTab: GitSettingsTab.General,
- autocommitDisableModalOpen: false,
- autocommitPolling: false,
- conflictErrorModalOpen: false,
- repoLimitErrorModalOpen: false,
- // EE
- ...gitArtifactUIInitialStateExtended,
-};
-
-const gitSingleArtifactInitialAPIResponses: GitSingleArtifactAPIResponsesReduxState =
- {
- metadata: {
- value: null,
- loading: false,
- error: null,
- },
- connect: {
- loading: false,
- error: null,
- },
- gitImport: {
- loading: false,
- error: null,
- },
- status: {
- value: null,
- loading: false,
- error: null,
- },
- commit: {
- loading: false,
- error: null,
- },
- pull: {
- loading: false,
- error: null,
- },
- discard: {
- loading: false,
- error: null,
- },
- mergeStatus: {
- value: null,
- loading: false,
- error: null,
- },
- merge: {
- loading: false,
- error: null,
- },
- branches: {
- value: null,
- loading: false,
- error: null,
- },
- checkoutBranch: {
- loading: false,
- error: null,
- },
- createBranch: {
- loading: false,
- error: null,
- },
- deleteBranch: {
- loading: false,
- error: null,
- },
- localProfile: {
- value: null,
- loading: false,
- error: null,
- },
- updateLocalProfile: {
- loading: false,
- error: null,
- },
- disconnect: {
- loading: false,
- error: null,
- },
- protectedBranches: {
- value: null,
- loading: false,
- error: null,
- },
- updateProtectedBranches: {
- loading: false,
- error: null,
- },
- autocommitProgress: {
- loading: false,
- error: null,
- },
- toggleAutocommit: {
- loading: false,
- error: null,
- },
- triggerAutocommit: {
- loading: false,
- error: null,
- },
- generateSSHKey: {
- loading: false,
- error: null,
- },
- sshKey: {
- value: null,
- loading: false,
- error: null,
- },
- // EE
- ...gitArtifactAPIResponsesInitialStateExtended,
- };
-
-export const gitSingleArtifactInitialState: GitSingleArtifactReduxState = {
- ui: gitSingleArtifactInitialUIState,
- apiResponses: gitSingleArtifactInitialAPIResponses,
-};
diff --git a/app/client/src/git/store/helpers/initialState.ts b/app/client/src/git/store/helpers/initialState.ts
new file mode 100644
index 000000000000..382833be2782
--- /dev/null
+++ b/app/client/src/git/store/helpers/initialState.ts
@@ -0,0 +1,157 @@
+import {
+ gitArtifactAPIResponsesInitialState as gitArtifactAPIResponsesInitialStateExtended,
+ gitArtifactUIInitialState as gitArtifactUIInitialStateExtended,
+} from "git/ee/store/helpers/initialState";
+import { GitOpsTab, GitSettingsTab } from "../../constants/enums";
+import type {
+ GitArtifactAPIResponsesReduxState,
+ GitArtifactUIReduxState,
+ GitArtifactReduxState,
+ GitGlobalReduxState,
+} from "../types";
+
+const gitArtifactInitialUIState: GitArtifactUIReduxState = {
+ connectModalOpen: false,
+ connectSuccessModalOpen: false,
+ disconnectBaseArtifactId: null,
+ disconnectArtifactName: null,
+ branchPopupOpen: false,
+ checkoutDestBranch: null,
+ opsModalOpen: false,
+ opsModalTab: GitOpsTab.Deploy,
+ settingsModalOpen: false,
+ settingsModalTab: GitSettingsTab.General,
+ autocommitDisableModalOpen: false,
+ autocommitPolling: false,
+ conflictErrorModalOpen: false,
+ repoLimitErrorModalOpen: false,
+ // EE
+ ...gitArtifactUIInitialStateExtended,
+};
+
+const gitArtifactInitialAPIResponses: GitArtifactAPIResponsesReduxState = {
+ metadata: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ connect: {
+ loading: false,
+ error: null,
+ },
+ status: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ commit: {
+ loading: false,
+ error: null,
+ },
+ pull: {
+ loading: false,
+ error: null,
+ },
+ discard: {
+ loading: false,
+ error: null,
+ },
+ mergeStatus: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ merge: {
+ loading: false,
+ error: null,
+ },
+ branches: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ checkoutBranch: {
+ loading: false,
+ error: null,
+ },
+ createBranch: {
+ loading: false,
+ error: null,
+ },
+ deleteBranch: {
+ loading: false,
+ error: null,
+ },
+ localProfile: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ updateLocalProfile: {
+ loading: false,
+ error: null,
+ },
+ disconnect: {
+ loading: false,
+ error: null,
+ },
+ protectedBranches: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ updateProtectedBranches: {
+ loading: false,
+ error: null,
+ },
+ autocommitProgress: {
+ loading: false,
+ error: null,
+ },
+ toggleAutocommit: {
+ loading: false,
+ error: null,
+ },
+ triggerAutocommit: {
+ loading: false,
+ error: null,
+ },
+ generateSSHKey: {
+ loading: false,
+ error: null,
+ },
+ sshKey: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ // EE
+ ...gitArtifactAPIResponsesInitialStateExtended,
+};
+
+export const gitArtifactInitialState: GitArtifactReduxState = {
+ ui: gitArtifactInitialUIState,
+ apiResponses: gitArtifactInitialAPIResponses,
+};
+
+export const gitGlobalInitialState: GitGlobalReduxState = {
+ globalProfile: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ updateGlobalProfile: {
+ loading: false,
+ error: null,
+ },
+ globalSSHKey: {
+ value: null,
+ loading: false,
+ error: null,
+ },
+ gitImport: {
+ loading: false,
+ error: null,
+ },
+ isImportModalOpen: false,
+};
diff --git a/app/client/src/git/store/index.ts b/app/client/src/git/store/index.ts
index f5337e564f97..6d210139ada4 100644
--- a/app/client/src/git/store/index.ts
+++ b/app/client/src/git/store/index.ts
@@ -1,8 +1,8 @@
import { combineReducers } from "@reduxjs/toolkit";
import { gitArtifactReducer } from "./gitArtifactSlice";
-import { gitConfigReducer } from "./gitConfigSlice";
+import { gitGlobalReducer } from "./gitGlobalSlice";
export const gitReducer = combineReducers({
artifacts: gitArtifactReducer,
- config: gitConfigReducer,
+ global: gitGlobalReducer,
});
diff --git a/app/client/src/git/store/selectors/gitSingleArtifactSelectors.ts b/app/client/src/git/store/selectors/gitArtifactSelectors.ts
similarity index 92%
rename from app/client/src/git/store/selectors/gitSingleArtifactSelectors.ts
rename to app/client/src/git/store/selectors/gitArtifactSelectors.ts
index 845a2cfe41fe..5bf8267df889 100644
--- a/app/client/src/git/store/selectors/gitSingleArtifactSelectors.ts
+++ b/app/client/src/git/store/selectors/gitArtifactSelectors.ts
@@ -1,10 +1,4 @@
-import type { GitArtifactType } from "git/constants/enums";
-import type { GitRootState } from "../types";
-
-export interface GitArtifactDef {
- artifactType: keyof typeof GitArtifactType;
- baseArtifactId: string;
-}
+import type { GitArtifactDef, GitRootState } from "../types";
export const selectGitArtifact = (
state: GitRootState,
@@ -21,7 +15,7 @@ export const selectMetadataState = (
artifactDef: GitArtifactDef,
) => selectGitArtifact(state, artifactDef)?.apiResponses.metadata;
-export const selectGitConnected = (
+export const selectConnected = (
state: GitRootState,
artifactDef: GitArtifactDef,
) => !!selectMetadataState(state, artifactDef)?.value;
@@ -32,11 +26,6 @@ export const selectConnectState = (
artifactDef: GitArtifactDef,
) => selectGitArtifact(state, artifactDef)?.apiResponses.connect;
-export const selectGitImportState = (
- state: GitRootState,
- artifactDef: GitArtifactDef,
-) => selectGitArtifact(state, artifactDef)?.apiResponses.gitImport;
-
export const selectFetchSSHKeysState = (
state: GitRootState,
artifactDef: GitArtifactDef,
@@ -52,6 +41,11 @@ export const selectConnectModalOpen = (
artifactDef: GitArtifactDef,
) => selectGitArtifact(state, artifactDef)?.ui.connectModalOpen;
+export const selectConnectSuccessModalOpen = (
+ state: GitRootState,
+ artifactDef: GitArtifactDef,
+) => selectGitArtifact(state, artifactDef)?.ui.connectSuccessModalOpen;
+
export const selectDisconnectState = (
state: GitRootState,
artifactDef: GitArtifactDef,
@@ -117,11 +111,14 @@ export const selectConflictErrorModalOpen = (
export const selectCurrentBranch = (
state: GitRootState,
+ // need this to preserve interface
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
artifactDef: GitArtifactDef,
) => {
- const gitMetadataState = selectMetadataState(state, artifactDef).value;
-
- return gitMetadataState?.branchName;
+ return (
+ state?.ui?.applications?.currentApplication?.gitApplicationMetadata
+ ?.branchName ?? null
+ );
};
export const selectFetchBranchesState = (
@@ -220,10 +217,8 @@ export const selectProtectedMode = (
artifactDef: GitArtifactDef,
) => {
const currentBranch = selectCurrentBranch(state, artifactDef);
- const protectedBranches = selectFetchProtectedBranchesState(
- state,
- artifactDef,
- ).value;
+ const protectedBranches =
+ selectFetchProtectedBranchesState(state, artifactDef)?.value ?? [];
return protectedBranches?.includes(currentBranch ?? "") ?? false;
};
diff --git a/app/client/src/git/store/selectors/gitConfigSelectors.ts b/app/client/src/git/store/selectors/gitConfigSelectors.ts
deleted file mode 100644
index be31a23cda5e..000000000000
--- a/app/client/src/git/store/selectors/gitConfigSelectors.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import type { GitRootState } from "../types";
-
-export const selectGitConfig = (state: GitRootState) => {
- return state.git.config;
-};
-
-// global profile
-export const selectFetchGlobalProfileState = (state: GitRootState) =>
- selectGitConfig(state).globalProfile;
-
-export const selectUpdateGlobalProfileState = (state: GitRootState) =>
- selectGitConfig(state).updateGlobalProfile;
diff --git a/app/client/src/git/store/selectors/gitGlobalSelectors.ts b/app/client/src/git/store/selectors/gitGlobalSelectors.ts
new file mode 100644
index 000000000000..1d1fdb555d0c
--- /dev/null
+++ b/app/client/src/git/store/selectors/gitGlobalSelectors.ts
@@ -0,0 +1,21 @@
+import type { GitRootState } from "../types";
+
+export const selectGitGlobal = (state: GitRootState) => {
+ return state.git.global;
+};
+
+// global profile
+export const selectFetchGlobalProfileState = (state: GitRootState) =>
+ selectGitGlobal(state).globalProfile;
+
+export const selectUpdateGlobalProfileState = (state: GitRootState) =>
+ selectGitGlobal(state).updateGlobalProfile;
+
+export const selectImportModalOpen = (state: GitRootState) =>
+ selectGitGlobal(state).isImportModalOpen;
+
+export const selectGitImportState = (state: GitRootState) =>
+ selectGitGlobal(state).gitImport;
+
+export const selectFetchGlobalSSHKeyState = (state: GitRootState) =>
+ selectGitGlobal(state).globalSSHKey;
diff --git a/app/client/src/git/store/types.ts b/app/client/src/git/store/types.ts
index ccb67a2e7a8b..90a2e72998a5 100644
--- a/app/client/src/git/store/types.ts
+++ b/app/client/src/git/store/types.ts
@@ -17,6 +17,7 @@ import type {
GitArtifactAPIResponsesReduxState as GitArtifactAPIResponsesReduxStateExtended,
GitArtifactUIReduxState as GitArtifactUIReduxStateExtended,
} from "git/ee/store/types";
+import type { FetchGlobalSSHKeyResponseData } from "git/requests/fetchGlobalSSHKeyRequest.types";
export interface GitApiError extends ApiResponseError {
errorType?: string;
@@ -33,11 +34,10 @@ export interface GitAsyncStateWithoutValue {
loading: boolean;
error: GitApiError | null;
}
-export interface GitSingleArtifactAPIResponsesReduxState
+export interface GitArtifactAPIResponsesReduxState
extends GitArtifactAPIResponsesReduxStateExtended {
metadata: GitAsyncState<FetchMetadataResponseData>;
connect: GitAsyncStateWithoutValue;
- gitImport: GitAsyncStateWithoutValue;
status: GitAsyncState<FetchStatusResponseData>;
commit: GitAsyncStateWithoutValue;
pull: GitAsyncStateWithoutValue;
@@ -60,9 +60,10 @@ export interface GitSingleArtifactAPIResponsesReduxState
generateSSHKey: GitAsyncStateWithoutValue;
}
-export interface GitSingleArtifactUIReduxState
+export interface GitArtifactUIReduxState
extends GitArtifactUIReduxStateExtended {
connectModalOpen: boolean;
+ connectSuccessModalOpen: boolean;
disconnectBaseArtifactId: string | null;
disconnectArtifactName: string | null;
branchPopupOpen: boolean;
@@ -76,30 +77,51 @@ export interface GitSingleArtifactUIReduxState
conflictErrorModalOpen: boolean;
repoLimitErrorModalOpen: boolean;
}
-export interface GitSingleArtifactReduxState {
- ui: GitSingleArtifactUIReduxState;
- apiResponses: GitSingleArtifactAPIResponsesReduxState;
-}
+export interface GitArtifactDef {
+ artifactType: keyof typeof GitArtifactType;
+ baseArtifactId: string;
+}
export interface GitArtifactReduxState {
- [key: string]: Record<string, GitSingleArtifactReduxState>;
+ ui: GitArtifactUIReduxState;
+ apiResponses: GitArtifactAPIResponsesReduxState;
}
-export interface GitConfigReduxState {
+export interface GitGlobalReduxState {
globalProfile: GitAsyncState<FetchGlobalProfileResponseData>;
updateGlobalProfile: GitAsyncStateWithoutValue;
+ gitImport: GitAsyncStateWithoutValue;
+ globalSSHKey: GitAsyncState<FetchGlobalSSHKeyResponseData>;
+ // ui
+ isImportModalOpen: boolean;
+}
+
+export type GitArtifactRootReduxState = Record<
+ string,
+ Record<string, GitArtifactReduxState>
+>;
+
+export interface GitReduxState {
+ artifacts: GitArtifactRootReduxState;
+ global: GitGlobalReduxState;
}
export interface GitRootState {
- git: {
- artifacts: GitArtifactReduxState;
- config: GitConfigReduxState;
+ // will have to remove this later, once metadata is fixed
+ ui: {
+ applications: {
+ currentApplication?: {
+ gitApplicationMetadata?: {
+ branchName: string;
+ };
+ };
+ };
};
+ git: GitReduxState;
}
export interface GitArtifactBasePayload {
- artifactType: keyof typeof GitArtifactType;
- baseArtifactId: string;
+ artifactDef: GitArtifactDef;
}
export interface GitAsyncErrorPayload {
diff --git a/app/client/src/layoutSystems/anvil/common/hooks/detachedWidgetHooks.ts b/app/client/src/layoutSystems/anvil/common/hooks/detachedWidgetHooks.ts
index c3ad4a82bd8d..6bf86d26a55d 100644
--- a/app/client/src/layoutSystems/anvil/common/hooks/detachedWidgetHooks.ts
+++ b/app/client/src/layoutSystems/anvil/common/hooks/detachedWidgetHooks.ts
@@ -1,7 +1,6 @@
import { useWidgetBorderStyles } from "./useWidgetBorderStyles";
import { useDispatch, useSelector } from "react-redux";
import { useWidgetSelection } from "utils/hooks/useWidgetSelection";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
import { SELECT_ANVIL_WIDGET_CUSTOM_EVENT } from "layoutSystems/anvil/utils/constants";
import log from "loglevel";
import { useEffect, useMemo } from "react";
@@ -9,6 +8,7 @@ import { getAnvilWidgetDOMId } from "layoutSystems/common/utils/LayoutElementPos
import { getCurrentlyOpenAnvilDetachedWidgets } from "layoutSystems/anvil/integrations/modalSelectors";
import { getCanvasWidgetsStructure } from "ee/selectors/entitiesSelector";
import type { CanvasWidgetStructure } from "WidgetProvider/constants";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
/**
* This hook is used to select and focus on a detached widget
* As detached widgets are outside of the layout flow, we need to access the correct element in the DOM
@@ -17,7 +17,7 @@ import type { CanvasWidgetStructure } from "WidgetProvider/constants";
*/
export function useHandleDetachedWidgetSelect(widgetId: string) {
const dispatch = useDispatch();
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const className = getAnvilWidgetDOMId(widgetId);
const element = document.querySelector(`.${className}`);
diff --git a/app/client/src/layoutSystems/anvil/common/hooks/useWidgetBorderStyles.ts b/app/client/src/layoutSystems/anvil/common/hooks/useWidgetBorderStyles.ts
index fea0cc19424c..1213f9134b3a 100644
--- a/app/client/src/layoutSystems/anvil/common/hooks/useWidgetBorderStyles.ts
+++ b/app/client/src/layoutSystems/anvil/common/hooks/useWidgetBorderStyles.ts
@@ -7,8 +7,8 @@ import {
getWidgetsDistributingSpace,
} from "layoutSystems/anvil/integrations/selectors";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
import { isWidgetFocused, isWidgetSelected } from "selectors/widgetSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
export function useWidgetBorderStyles(widgetId: string, widgetType: string) {
/** Selectors */
@@ -32,7 +32,7 @@ export function useWidgetBorderStyles(widgetId: string, widgetType: string) {
const widgetsEffectedBySpaceDistribution = useSelector(
getWidgetsDistributingSpace,
);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
/** EO selectors */
diff --git a/app/client/src/layoutSystems/anvil/editor/AnvilEditorWidgetOnion.tsx b/app/client/src/layoutSystems/anvil/editor/AnvilEditorWidgetOnion.tsx
index f5a6505a2be2..839c055f0f40 100644
--- a/app/client/src/layoutSystems/anvil/editor/AnvilEditorWidgetOnion.tsx
+++ b/app/client/src/layoutSystems/anvil/editor/AnvilEditorWidgetOnion.tsx
@@ -4,7 +4,7 @@ import type { BaseWidgetProps } from "widgets/BaseWidgetHOC/withBaseWidgetHOC";
import { AnvilWidgetComponent } from "../common/widgetComponent/AnvilWidgetComponent";
import { getWidgetSizeConfiguration } from "../utils/widgetUtils";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { AnvilEditorFlexComponent } from "./AnvilEditorFlexComponent";
import { AnvilFlexComponent } from "../common/AnvilFlexComponent";
import { SKELETON_WIDGET_TYPE } from "constants/WidgetConstants";
@@ -25,7 +25,7 @@ import { SKELETON_WIDGET_TYPE } from "constants/WidgetConstants";
* @returns Enhanced Widget
*/
export const AnvilEditorWidgetOnion = (props: BaseWidgetProps) => {
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const { widgetSize, WidgetWrapper } = useMemo(() => {
return {
widgetSize: getWidgetSizeConfiguration(props.type, props, isPreviewMode),
diff --git a/app/client/src/layoutSystems/anvil/editor/hooks/useAnvilWidgetHover.ts b/app/client/src/layoutSystems/anvil/editor/hooks/useAnvilWidgetHover.ts
index abdb88561f68..e51d921bf1bd 100644
--- a/app/client/src/layoutSystems/anvil/editor/hooks/useAnvilWidgetHover.ts
+++ b/app/client/src/layoutSystems/anvil/editor/hooks/useAnvilWidgetHover.ts
@@ -2,7 +2,7 @@ import type { AppState } from "ee/reducers";
import { getAnvilSpaceDistributionStatus } from "layoutSystems/anvil/integrations/selectors";
import { useCallback, useEffect } from "react";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { isWidgetFocused } from "selectors/widgetSelectors";
import { useWidgetSelection } from "utils/hooks/useWidgetSelection";
@@ -12,7 +12,7 @@ export const useAnvilWidgetHover = (
) => {
// Retrieve state from the Redux store
const isFocused = useSelector(isWidgetFocused(widgetId));
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isDistributingSpace = useSelector(getAnvilSpaceDistributionStatus);
const isDragging = useSelector(
(state: AppState) => state.ui.widgetDragResize.isDragging,
diff --git a/app/client/src/layoutSystems/anvil/integrations/sagas/LayoutElementPositionsSaga.ts b/app/client/src/layoutSystems/anvil/integrations/sagas/LayoutElementPositionsSaga.ts
index a882919710b1..2cddcc974bc8 100644
--- a/app/client/src/layoutSystems/anvil/integrations/sagas/LayoutElementPositionsSaga.ts
+++ b/app/client/src/layoutSystems/anvil/integrations/sagas/LayoutElementPositionsSaga.ts
@@ -8,7 +8,7 @@ import log from "loglevel";
import type { AppState } from "ee/reducers";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import { APP_MODE } from "entities/App";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { getAppMode } from "ee/selectors/entitiesSelector";
import type { RefObject } from "react";
import { getAnvilSpaceDistributionStatus } from "../selectors";
@@ -87,7 +87,7 @@ function* readAndUpdateLayoutElementPositions() {
// The positions are used only in the editor, so we should not be running this saga
// in the viewer or the preview mode.
- const isPreviewMode: boolean = yield select(combinedPreviewModeSelector);
+ const isPreviewMode: boolean = yield select(selectCombinedPreviewMode);
const appMode: APP_MODE = yield select(getAppMode);
if (isPreviewMode || appMode === APP_MODE.PUBLISHED) {
diff --git a/app/client/src/layoutSystems/anvil/layoutComponents/components/zone/useZoneMinWidth.ts b/app/client/src/layoutSystems/anvil/layoutComponents/components/zone/useZoneMinWidth.ts
index fe49ee655230..c8ba600c5fb6 100644
--- a/app/client/src/layoutSystems/anvil/layoutComponents/components/zone/useZoneMinWidth.ts
+++ b/app/client/src/layoutSystems/anvil/layoutComponents/components/zone/useZoneMinWidth.ts
@@ -3,22 +3,20 @@ import { ChildrenMapContext } from "layoutSystems/anvil/context/childrenMapConte
import type { WidgetProps } from "widgets/BaseWidget";
import { RenderModes } from "constants/WidgetConstants";
import { useSelector } from "react-redux";
-import {
- combinedPreviewModeSelector,
- getRenderMode,
-} from "selectors/editorSelectors";
+import { getRenderMode } from "selectors/editorSelectors";
import type { SizeConfig } from "WidgetProvider/constants";
import { getWidgetSizeConfiguration } from "layoutSystems/anvil/utils/widgetUtils";
import type { CanvasWidgetsReduxState } from "reducers/entityReducers/canvasWidgetsReducer";
import { getWidgets } from "sagas/selectors";
import isObject from "lodash/isObject";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
export function useZoneMinWidth() {
const childrenMap: Record<string, WidgetProps> =
useContext(ChildrenMapContext);
const widgets: CanvasWidgetsReduxState = useSelector(getWidgets);
const renderMode: RenderModes = useSelector(getRenderMode);
- const isPreviewMode: boolean = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode: boolean = useSelector(selectCombinedPreviewMode);
if (renderMode === RenderModes.CANVAS && !isPreviewMode) return "auto";
diff --git a/app/client/src/layoutSystems/anvil/sectionSpaceDistributor/SectionSpaceDistributor.tsx b/app/client/src/layoutSystems/anvil/sectionSpaceDistributor/SectionSpaceDistributor.tsx
index fd719bfd1f6f..25e94d38d9e8 100644
--- a/app/client/src/layoutSystems/anvil/sectionSpaceDistributor/SectionSpaceDistributor.tsx
+++ b/app/client/src/layoutSystems/anvil/sectionSpaceDistributor/SectionSpaceDistributor.tsx
@@ -2,7 +2,7 @@ import { getLayoutElementPositions } from "layoutSystems/common/selectors";
import type { LayoutElementPosition } from "layoutSystems/common/types";
import React, { useMemo } from "react";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import type { WidgetLayoutProps } from "../utils/anvilTypes";
import { getWidgetByID } from "sagas/selectors";
import { getDefaultSpaceDistributed } from "./utils/spaceRedistributionSagaUtils";
@@ -113,7 +113,7 @@ export const SectionSpaceDistributor = (
props: SectionSpaceDistributorProps,
) => {
const { zones } = props;
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isWidgetSelectionBlocked = useSelector(getWidgetSelectionBlock);
const isDragging = useSelector(
(state) => state.ui.widgetDragResize.isDragging,
diff --git a/app/client/src/layoutSystems/anvil/viewer/AnvilViewerWidgetOnion.tsx b/app/client/src/layoutSystems/anvil/viewer/AnvilViewerWidgetOnion.tsx
index 99ca7dddf492..763785755918 100644
--- a/app/client/src/layoutSystems/anvil/viewer/AnvilViewerWidgetOnion.tsx
+++ b/app/client/src/layoutSystems/anvil/viewer/AnvilViewerWidgetOnion.tsx
@@ -5,7 +5,7 @@ import { AnvilWidgetComponent } from "../common/widgetComponent/AnvilWidgetCompo
import type { SizeConfig } from "WidgetProvider/constants";
import { getWidgetSizeConfiguration } from "../utils/widgetUtils";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
/**
* AnvilViewerWidgetOnion
@@ -20,7 +20,7 @@ import { combinedPreviewModeSelector } from "selectors/editorSelectors";
* @returns Enhanced Widget
*/
export const AnvilViewerWidgetOnion = (props: BaseWidgetProps) => {
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const widgetSize: SizeConfig = useMemo(
() => getWidgetSizeConfiguration(props.type, props, isPreviewMode),
[isPreviewMode, props.type],
diff --git a/app/client/src/layoutSystems/autolayout/common/FlexComponent.tsx b/app/client/src/layoutSystems/autolayout/common/FlexComponent.tsx
index 20edbf4ce0d8..334ca9fd95ec 100644
--- a/app/client/src/layoutSystems/autolayout/common/FlexComponent.tsx
+++ b/app/client/src/layoutSystems/autolayout/common/FlexComponent.tsx
@@ -4,10 +4,7 @@ import styled from "styled-components";
import { WIDGET_PADDING } from "constants/WidgetConstants";
import { useSelector } from "react-redux";
-import {
- combinedPreviewModeSelector,
- snipingModeSelector,
-} from "selectors/editorSelectors";
+import { snipingModeSelector } from "selectors/editorSelectors";
import { getIsResizing } from "selectors/widgetSelectors";
import { useClickToSelectWidget } from "utils/hooks/useClickToSelectWidget";
import { usePositionedContainerZIndex } from "utils/hooks/usePositionedContainerZIndex";
@@ -16,6 +13,7 @@ import { RESIZE_BORDER_BUFFER } from "layoutSystems/common/resizer/common";
import { checkIsDropTarget } from "WidgetProvider/factory/helpers";
import type { FlexComponentProps } from "../../autolayout/utils/types";
import { useHoverToFocusWidget } from "utils/hooks/useHoverToFocusWidget";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
const FlexWidget = styled.div`
position: relative;
@@ -58,7 +56,7 @@ export function FlexComponent(props: FlexComponentProps) {
)} t--widget-${props.widgetName.toLowerCase()}`,
[props.parentId, props.widgetId, props.widgetType, props.widgetName],
);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isResizing = useSelector(getIsResizing);
const widgetDimensionsViewCss = {
diff --git a/app/client/src/layoutSystems/common/dropTarget/DropTargetComponent.tsx b/app/client/src/layoutSystems/common/dropTarget/DropTargetComponent.tsx
index d1df63825448..fcb93c9205a6 100644
--- a/app/client/src/layoutSystems/common/dropTarget/DropTargetComponent.tsx
+++ b/app/client/src/layoutSystems/common/dropTarget/DropTargetComponent.tsx
@@ -21,10 +21,7 @@ import {
} from "actions/autoHeightActions";
import { useDispatch } from "react-redux";
import { getDragDetails } from "sagas/selectors";
-import {
- combinedPreviewModeSelector,
- getOccupiedSpacesSelectorForContainer,
-} from "selectors/editorSelectors";
+import { getOccupiedSpacesSelectorForContainer } from "selectors/editorSelectors";
import { getCanvasSnapRows } from "utils/WidgetPropsUtils";
import { useAutoHeightUIState } from "utils/hooks/autoHeightUIHooks";
import { useShowPropertyPane } from "utils/hooks/dragResizeHooks";
@@ -42,6 +39,7 @@ import {
import DragLayerComponent from "./DragLayerComponent";
import Onboarding from "./OnBoarding";
import { isDraggingBuildingBlockToCanvas } from "selectors/buildingBlocksSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
export type DropTargetComponentProps = PropsWithChildren<{
snapColumnSpace: number;
@@ -196,7 +194,7 @@ function useUpdateRows(
export function DropTargetComponent(props: DropTargetComponentProps) {
// Get if this is in preview mode.
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
);
diff --git a/app/client/src/layoutSystems/common/resizer/ModalResizableLayer.tsx b/app/client/src/layoutSystems/common/resizer/ModalResizableLayer.tsx
index 559556bbbf42..1a516b9623fe 100644
--- a/app/client/src/layoutSystems/common/resizer/ModalResizableLayer.tsx
+++ b/app/client/src/layoutSystems/common/resizer/ModalResizableLayer.tsx
@@ -19,11 +19,9 @@ import {
} from "./ResizeStyledComponents";
import type { UIElementSize } from "./ResizableUtils";
import { useModalWidth } from "widgets/ModalWidget/component/useModalWidth";
-import {
- combinedPreviewModeSelector,
- snipingModeSelector,
-} from "selectors/editorSelectors";
+import { snipingModeSelector } from "selectors/editorSelectors";
import { getWidgetSelectionBlock } from "../../../selectors/ui";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
const minSize = 100;
/**
@@ -101,7 +99,7 @@ export const ModalResizableLayer = ({
widgetType: "MODAL_WIDGET",
});
};
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isSnipingMode = useSelector(snipingModeSelector);
const isWidgetSelectionBlocked = useSelector(getWidgetSelectionBlock);
const enableResizing =
diff --git a/app/client/src/layoutSystems/common/resizer/ResizableComponent.tsx b/app/client/src/layoutSystems/common/resizer/ResizableComponent.tsx
index f0336f382b87..fb5aca05d16f 100644
--- a/app/client/src/layoutSystems/common/resizer/ResizableComponent.tsx
+++ b/app/client/src/layoutSystems/common/resizer/ResizableComponent.tsx
@@ -17,10 +17,7 @@ import { FixedLayoutResizable } from "layoutSystems/fixedlayout/common/resizer/F
import { SelectionRequestType } from "sagas/WidgetSelectUtils";
import { getIsAutoLayout } from "selectors/canvasSelectors";
import { getIsAppSettingsPaneWithNavigationTabOpen } from "selectors/appSettingsPaneSelectors";
-import {
- combinedPreviewModeSelector,
- snipingModeSelector,
-} from "selectors/editorSelectors";
+import { snipingModeSelector } from "selectors/editorSelectors";
import {
getParentToOpenSelector,
isWidgetFocused,
@@ -69,6 +66,7 @@ import {
getAltBlockWidgetSelection,
getWidgetSelectionBlock,
} from "selectors/ui";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
export type ResizableComponentProps = WidgetProps & {
paddingOffset: number;
@@ -83,7 +81,7 @@ export const ResizableComponent = memo(function ResizableComponent(
const isAutoLayout = useSelector(getIsAutoLayout);
const Resizable = isAutoLayout ? AutoLayoutResizable : FixedLayoutResizable;
const isSnipingMode = useSelector(snipingModeSelector);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isWidgetSelectionBlock = useSelector(getWidgetSelectionBlock);
const isAltWidgetSelectionBlock = useSelector(getAltBlockWidgetSelection);
const isAppSettingsPaneWithNavigationTabOpen: boolean = useSelector(
diff --git a/app/client/src/layoutSystems/common/utils/LayoutElementPositionsObserver/usePositionObserver.ts b/app/client/src/layoutSystems/common/utils/LayoutElementPositionsObserver/usePositionObserver.ts
index 1d5a9c38f354..9c981c66f397 100644
--- a/app/client/src/layoutSystems/common/utils/LayoutElementPositionsObserver/usePositionObserver.ts
+++ b/app/client/src/layoutSystems/common/utils/LayoutElementPositionsObserver/usePositionObserver.ts
@@ -3,7 +3,7 @@ import { useEffect } from "react";
import { positionObserver } from ".";
import { APP_MODE } from "entities/App";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { getAppMode } from "ee/selectors/entitiesSelector";
import { getAnvilLayoutDOMId, getAnvilWidgetDOMId } from "./utils";
import { LayoutComponentTypes } from "layoutSystems/anvil/utils/anvilTypes";
@@ -13,7 +13,7 @@ export function useObserveDetachedWidget(widgetId: string) {
// We don't need the observer in preview mode or the published app
// This is because the positions need to be observed only to enable
// editor features
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const appMode = useSelector(getAppMode);
if (isPreviewMode || appMode === APP_MODE.PUBLISHED) {
@@ -54,7 +54,7 @@ export function usePositionObserver(
},
ref: RefObject<HTMLDivElement>,
) {
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const appMode = useSelector(getAppMode);
useEffect(() => {
diff --git a/app/client/src/layoutSystems/common/widgetName/index.tsx b/app/client/src/layoutSystems/common/widgetName/index.tsx
index bb8c265946e5..8d5770b995a0 100644
--- a/app/client/src/layoutSystems/common/widgetName/index.tsx
+++ b/app/client/src/layoutSystems/common/widgetName/index.tsx
@@ -8,7 +8,6 @@ import { SelectionRequestType } from "sagas/WidgetSelectUtils";
import { getIsAppSettingsPaneWithNavigationTabOpen } from "selectors/appSettingsPaneSelectors";
import { hideErrors } from "selectors/debuggerSelectors";
import {
- combinedPreviewModeSelector,
getIsAutoLayout,
snipingModeSelector,
} from "selectors/editorSelectors";
@@ -31,6 +30,7 @@ import { RESIZE_BORDER_BUFFER } from "layoutSystems/common/resizer/common";
import { Layers } from "constants/Layers";
import memoize from "micro-memoize";
import { NavigationMethod } from "utils/history";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
const WidgetTypes = WidgetFactory.widgetTypes;
@@ -78,7 +78,7 @@ interface WidgetNameComponentProps {
export function WidgetNameComponent(props: WidgetNameComponentProps) {
const dispatch = useDispatch();
const isSnipingMode = useSelector(snipingModeSelector);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
);
diff --git a/app/client/src/layoutSystems/fixedlayout/common/autoHeightOverlay/index.tsx b/app/client/src/layoutSystems/fixedlayout/common/autoHeightOverlay/index.tsx
index 89519283f7cb..48015d2efff1 100644
--- a/app/client/src/layoutSystems/fixedlayout/common/autoHeightOverlay/index.tsx
+++ b/app/client/src/layoutSystems/fixedlayout/common/autoHeightOverlay/index.tsx
@@ -3,7 +3,7 @@ import type { CSSProperties } from "react";
import React, { memo } from "react";
import { useSelector } from "react-redux";
import { getIsAppSettingsPaneWithNavigationTabOpen } from "selectors/appSettingsPaneSelectors";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import type { WidgetProps } from "widgets/BaseWidget";
import AutoHeightOverlayWithStateContext from "./AutoHeightOverlayWithStateContext";
@@ -31,7 +31,7 @@ const AutoHeightOverlayContainer: React.FC<AutoHeightOverlayContainerProps> =
selectedWidgets,
} = useSelector((state: AppState) => state.ui.widgetDragResize);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
);
diff --git a/app/client/src/layoutSystems/fixedlayout/editor/FixedLayoutCanvasArenas/CanvasSelectionArena.tsx b/app/client/src/layoutSystems/fixedlayout/editor/FixedLayoutCanvasArenas/CanvasSelectionArena.tsx
index c0cf29167981..c299eaef18db 100644
--- a/app/client/src/layoutSystems/fixedlayout/editor/FixedLayoutCanvasArenas/CanvasSelectionArena.tsx
+++ b/app/client/src/layoutSystems/fixedlayout/editor/FixedLayoutCanvasArenas/CanvasSelectionArena.tsx
@@ -21,7 +21,6 @@ import {
getIsDraggingForSelection,
} from "selectors/canvasSelectors";
import {
- combinedPreviewModeSelector,
getCurrentApplicationLayout,
getCurrentPageId,
} from "selectors/editorSelectors";
@@ -31,6 +30,7 @@ import type { XYCord } from "layoutSystems/common/canvasArenas/ArenaTypes";
import { useCanvasDragToScroll } from "layoutSystems/common/canvasArenas/useCanvasDragToScroll";
import { StickyCanvasArena } from "layoutSystems/common/canvasArenas/StickyCanvasArena";
import { getWidgetSelectionBlock } from "../../../../selectors/ui";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
export interface SelectedArenaDimensions {
top: number;
@@ -71,7 +71,7 @@ export function CanvasSelectionArena({
(parentWidget && parentWidget.detachFromLayout)
);
const appMode = useSelector(getAppMode);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isWidgetSelectionBlocked = useSelector(getWidgetSelectionBlock);
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
diff --git a/app/client/src/pages/AppViewer/Navigation/Sidebar.tsx b/app/client/src/pages/AppViewer/Navigation/Sidebar.tsx
index 3b6b80aa7328..5ad23ff2e567 100644
--- a/app/client/src/pages/AppViewer/Navigation/Sidebar.tsx
+++ b/app/client/src/pages/AppViewer/Navigation/Sidebar.tsx
@@ -12,10 +12,7 @@ import ShareButton from "./components/ShareButton";
import PrimaryCTA from "../PrimaryCTA";
import { useHref } from "pages/Editor/utils";
import { builderURL } from "ee/RouteBuilder";
-import {
- combinedPreviewModeSelector,
- getCurrentBasePageId,
-} from "selectors/editorSelectors";
+import { getCurrentBasePageId } from "selectors/editorSelectors";
import type { User } from "constants/userConstants";
import SidebarProfileComponent from "./components/SidebarProfileComponent";
import CollapseButton from "./components/CollapseButton";
@@ -36,6 +33,7 @@ import MenuItemContainer from "./components/MenuItemContainer";
import BackToAppsButton from "./components/BackToAppsButton";
import { IDE_HEADER_HEIGHT } from "@appsmith/ads";
import { BOTTOM_BAR_HEIGHT } from "components/BottomBar/constants";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
interface SidebarProps {
currentApplicationDetails?: ApplicationPayload;
@@ -81,7 +79,7 @@ export function Sidebar(props: SidebarProps) {
const isPinned = useSelector(getAppSidebarPinned);
const [isOpen, setIsOpen] = useState(true);
const { x } = useMouse();
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
);
diff --git a/app/client/src/pages/AppViewer/Navigation/TopInline.tsx b/app/client/src/pages/AppViewer/Navigation/TopInline.tsx
index f15dd093ff21..af09e8497fd1 100644
--- a/app/client/src/pages/AppViewer/Navigation/TopInline.tsx
+++ b/app/client/src/pages/AppViewer/Navigation/TopInline.tsx
@@ -5,14 +5,12 @@ import MenuItem from "./components/MenuItem";
import { Container } from "./TopInline.styled";
import MenuItemContainer from "./components/MenuItemContainer";
import MoreDropdownButton from "./components/MoreDropdownButton";
-import {
- combinedPreviewModeSelector,
- getCanvasWidth,
-} from "selectors/editorSelectors";
+import { getCanvasWidth } from "selectors/editorSelectors";
import { useSelector } from "react-redux";
import { getIsAppSettingsPaneWithNavigationTabOpen } from "selectors/appSettingsPaneSelectors";
import { throttle } from "lodash";
import type { NavigationProps } from "./constants";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
export function TopInline(props: NavigationProps) {
const { currentApplicationDetails, pages } = props;
@@ -23,7 +21,7 @@ export function TopInline(props: NavigationProps) {
const maxMenuItemWidth = 220;
const [maxMenuItemsThatCanFit, setMaxMenuItemsThatCanFit] = useState(0);
const { width: screenWidth } = useWindowSizeHooks();
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
);
diff --git a/app/client/src/pages/AppViewer/PrimaryCTA.test.tsx b/app/client/src/pages/AppViewer/PrimaryCTA.test.tsx
index 3b03a559fbfb..63b76d0e0fcc 100644
--- a/app/client/src/pages/AppViewer/PrimaryCTA.test.tsx
+++ b/app/client/src/pages/AppViewer/PrimaryCTA.test.tsx
@@ -7,6 +7,11 @@ import { lightTheme } from "selectors/themeSelectors";
import PrimaryCTA from "./PrimaryCTA";
import configureStore from "redux-mock-store";
+jest.mock("pages/Editor/gitSync/hooks/modHooks", () => ({
+ ...jest.requireActual("pages/Editor/gitSync/hooks/modHooks"),
+ useGitProtectedMode: jest.fn(() => false),
+}));
+
jest.mock("react-router", () => ({
...jest.requireActual("react-router"),
useHistory: () => ({ push: jest.fn() }),
diff --git a/app/client/src/pages/AppViewer/PrimaryCTA.tsx b/app/client/src/pages/AppViewer/PrimaryCTA.tsx
index 9e2816166454..97d0363bbf5f 100644
--- a/app/client/src/pages/AppViewer/PrimaryCTA.tsx
+++ b/app/client/src/pages/AppViewer/PrimaryCTA.tsx
@@ -25,8 +25,8 @@ import { Icon, Tooltip } from "@appsmith/ads";
import { getApplicationNameTextColor } from "./utils";
import { ButtonVariantTypes } from "components/constants";
import { setPreviewModeInitAction } from "actions/editorActions";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
import { getCurrentApplication } from "ee/selectors/applicationSelectors";
+import { useGitProtectedMode } from "pages/Editor/gitSync/hooks/modHooks";
/**
* ---------------------------------------------------------------------------------------------------
@@ -67,7 +67,7 @@ function PrimaryCTA(props: Props) {
const canEdit = isPermitted(userPermissions, permissionRequired);
const [isForkModalOpen, setIsForkModalOpen] = useState(false);
const isPreviewMode = useSelector(previewModeSelector);
- const isProtectedMode = useSelector(protectedModeSelector);
+ const isProtectedMode = useGitProtectedMode();
const dispatch = useDispatch();
const location = useLocation();
const queryParams = new URLSearchParams(location.search);
diff --git a/app/client/src/pages/Editor/AppSettingsPane/AppSettings/ImportAppSettings.tsx b/app/client/src/pages/Editor/AppSettingsPane/AppSettings/ImportAppSettings.tsx
index 8da3b25343c3..b721e7c5c7af 100644
--- a/app/client/src/pages/Editor/AppSettingsPane/AppSettings/ImportAppSettings.tsx
+++ b/app/client/src/pages/Editor/AppSettingsPane/AppSettings/ImportAppSettings.tsx
@@ -8,8 +8,8 @@ import ImportModal from "pages/common/ImportModal";
import React from "react";
import { useSelector } from "react-redux";
import { getCurrentApplicationId } from "selectors/editorSelectors";
-import { getIsGitConnected } from "selectors/gitSyncSelectors";
import styled from "styled-components";
+import { useGitConnected } from "pages/Editor/gitSync/hooks/modHooks";
const SettingWrapper = styled.div`
display: flex;
@@ -21,7 +21,7 @@ const SettingWrapper = styled.div`
export function ImportAppSettings() {
const appId = useSelector(getCurrentApplicationId);
const workspace = useSelector(getCurrentAppWorkspace);
- const isGitConnected = useSelector(getIsGitConnected);
+ const isGitConnected = useGitConnected();
const [isModalOpen, setIsModalOpen] = React.useState(false);
function handleClose() {
diff --git a/app/client/src/pages/Editor/Canvas.tsx b/app/client/src/pages/Editor/Canvas.tsx
index 742e6d8a74b1..c34f2fc358c8 100644
--- a/app/client/src/pages/Editor/Canvas.tsx
+++ b/app/client/src/pages/Editor/Canvas.tsx
@@ -5,7 +5,7 @@ import * as Sentry from "@sentry/react";
import { useDispatch, useSelector } from "react-redux";
import type { CanvasWidgetStructure } from "WidgetProvider/constants";
import useWidgetFocus from "utils/hooks/useWidgetFocus";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { getSelectedAppTheme } from "selectors/appThemingSelectors";
import { getViewportClassName } from "layoutSystems/autolayout/utils/AutoLayoutUtils";
import {
@@ -44,7 +44,7 @@ const Wrapper = styled.section<{
`;
const Canvas = (props: CanvasProps) => {
const { canvasWidth } = props;
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
);
diff --git a/app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx b/app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx
index 651f57e792c0..1e01349df831 100644
--- a/app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx
+++ b/app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx
@@ -45,8 +45,8 @@ import { toast } from "@appsmith/ads";
import { showDebuggerFlag } from "selectors/debuggerSelectors";
import { getIsFirstTimeUserOnboardingEnabled } from "selectors/onboardingSelectors";
import WalkthroughContext from "components/featureWalkthrough/walkthroughContext";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
import { setPreviewModeInitAction } from "actions/editorActions";
+import { selectGitApplicationProtectedMode } from "selectors/gitModSelectors";
interface Props {
copySelectedWidget: () => void;
@@ -372,15 +372,17 @@ class GlobalHotKeys extends React.Component<Props> {
}
}
-const mapStateToProps = (state: AppState) => ({
- selectedWidget: getLastSelectedWidget(state),
- selectedWidgets: getSelectedWidgets(state),
- isDebuggerOpen: showDebuggerFlag(state),
- appMode: getAppMode(state),
- isPreviewMode: previewModeSelector(state),
- isProtectedMode: protectedModeSelector(state),
- isSignpostingEnabled: getIsFirstTimeUserOnboardingEnabled(state),
-});
+const mapStateToProps = (state: AppState) => {
+ return {
+ selectedWidget: getLastSelectedWidget(state),
+ selectedWidgets: getSelectedWidgets(state),
+ isDebuggerOpen: showDebuggerFlag(state),
+ appMode: getAppMode(state),
+ isPreviewMode: previewModeSelector(state),
+ isProtectedMode: selectGitApplicationProtectedMode(state),
+ isSignpostingEnabled: getIsFirstTimeUserOnboardingEnabled(state),
+ };
+};
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
diff --git a/app/client/src/pages/Editor/IDE/Header/DeployButton.tsx b/app/client/src/pages/Editor/IDE/Header/DeployButton.tsx
new file mode 100644
index 000000000000..843da728dddf
--- /dev/null
+++ b/app/client/src/pages/Editor/IDE/Header/DeployButton.tsx
@@ -0,0 +1,131 @@
+import { Button, Tooltip } from "@appsmith/ads";
+import { objectKeys } from "@appsmith/utils";
+import { showConnectGitModal } from "actions/gitSyncActions";
+import { publishApplication } from "ee/actions/applicationActions";
+import { getCurrentApplication } from "ee/selectors/applicationSelectors";
+import type { NavigationSetting } from "constants/AppConstants";
+import {
+ createMessage,
+ DEPLOY_BUTTON_TOOLTIP,
+ DEPLOY_MENU_OPTION,
+ PACKAGE_UPGRADING_ACTION_STATUS,
+} from "ee/constants/messages";
+import { getIsPackageUpgrading } from "ee/selectors/packageSelectors";
+import AnalyticsUtil from "ee/utils/AnalyticsUtil";
+import { useGitOps, useGitProtectedMode } from "git";
+import {
+ useGitConnected,
+ useGitModEnabled,
+} from "pages/Editor/gitSync/hooks/modHooks";
+import React, { useCallback } from "react";
+import { useDispatch, useSelector } from "react-redux";
+import {
+ getCurrentApplicationId,
+ getIsPublishingApplication,
+} from "selectors/editorSelectors";
+import styled from "styled-components";
+
+// This wrapper maintains pointer events for tooltips when the child button is disabled.
+// Without this, disabled buttons won't trigger tooltips because they have pointer-events: none
+const StyledTooltipTarget = styled.span`
+ display: inline-block;
+`;
+
+function DeployButton() {
+ const applicationId = useSelector(getCurrentApplicationId);
+ const currentApplication = useSelector(getCurrentApplication);
+ const isPackageUpgrading = useSelector(getIsPackageUpgrading);
+ const isProtectedMode = useGitProtectedMode();
+ const isDeployDisabled = isPackageUpgrading || isProtectedMode;
+ const isPublishing = useSelector(getIsPublishingApplication);
+ const isGitConnected = useGitConnected();
+ const isGitModEnabled = useGitModEnabled();
+ const { toggleOpsModal } = useGitOps();
+
+ const deployTooltipText = isPackageUpgrading
+ ? createMessage(PACKAGE_UPGRADING_ACTION_STATUS, "deploy this app")
+ : createMessage(DEPLOY_BUTTON_TOOLTIP);
+
+ const dispatch = useDispatch();
+
+ const handlePublish = useCallback(() => {
+ if (applicationId) {
+ dispatch(publishApplication(applicationId));
+
+ const appName = currentApplication ? currentApplication.name : "";
+ const pageCount = currentApplication?.pages?.length;
+ const navigationSettingsWithPrefix: Record<
+ string,
+ NavigationSetting[keyof NavigationSetting]
+ > = {};
+
+ if (currentApplication?.applicationDetail?.navigationSetting) {
+ const settingKeys = objectKeys(
+ currentApplication.applicationDetail.navigationSetting,
+ ) as Array<keyof NavigationSetting>;
+
+ settingKeys.map((key: keyof NavigationSetting) => {
+ if (currentApplication?.applicationDetail?.navigationSetting?.[key]) {
+ const value: NavigationSetting[keyof NavigationSetting] =
+ currentApplication.applicationDetail.navigationSetting[key];
+
+ navigationSettingsWithPrefix[`navigationSetting_${key}`] = value;
+ }
+ });
+ }
+
+ AnalyticsUtil.logEvent("PUBLISH_APP", {
+ appId: applicationId,
+ appName,
+ pageCount,
+ ...navigationSettingsWithPrefix,
+ isPublic: !!currentApplication?.isPublic,
+ templateTitle: currentApplication?.forkedFromTemplateTitle,
+ });
+ }
+ }, [applicationId, currentApplication, dispatch]);
+
+ const handleClickDeploy = useCallback(() => {
+ if (isGitConnected) {
+ if (isGitModEnabled) {
+ toggleOpsModal(true);
+ } else {
+ dispatch(showConnectGitModal());
+ }
+
+ AnalyticsUtil.logEvent("GS_DEPLOY_GIT_CLICK", {
+ source: "Deploy button",
+ });
+ } else {
+ handlePublish();
+ }
+ }, [
+ dispatch,
+ handlePublish,
+ isGitConnected,
+ isGitModEnabled,
+ toggleOpsModal,
+ ]);
+
+ return (
+ <Tooltip content={deployTooltipText} placement="bottomRight">
+ <StyledTooltipTarget>
+ <Button
+ className="t--application-publish-btn"
+ data-guided-tour-iid="deploy"
+ id={"application-publish-btn"}
+ isDisabled={isDeployDisabled}
+ isLoading={isPublishing}
+ kind="tertiary"
+ onClick={handleClickDeploy}
+ size="md"
+ startIcon={"rocket"}
+ >
+ {createMessage(DEPLOY_MENU_OPTION)}
+ </Button>
+ </StyledTooltipTarget>
+ </Tooltip>
+ );
+}
+
+export default DeployButton;
diff --git a/app/client/src/pages/Editor/IDE/Header/index.tsx b/app/client/src/pages/Editor/IDE/Header/index.tsx
index f8e75cda9db7..c26b641ba40d 100644
--- a/app/client/src/pages/Editor/IDE/Header/index.tsx
+++ b/app/client/src/pages/Editor/IDE/Header/index.tsx
@@ -1,7 +1,6 @@
-import React, { useCallback, useState } from "react";
+import React, { useState } from "react";
import {
Flex,
- Tooltip,
Divider,
Modal,
ModalContent,
@@ -11,7 +10,6 @@ import {
TabsList,
Tab,
TabPanel,
- Button,
Link,
IDEHeader,
IDEHeaderTitle,
@@ -24,19 +22,15 @@ import {
APPLICATION_INVITE,
COMMUNITY_TEMPLATES,
createMessage,
- DEPLOY_BUTTON_TOOLTIP,
- DEPLOY_MENU_OPTION,
IN_APP_EMBED_SETTING,
INVITE_TAB,
HEADER_TITLES,
- PACKAGE_UPGRADING_ACTION_STATUS,
} from "ee/constants/messages";
import EditorName from "pages/Editor/EditorName";
import {
getCurrentApplicationId,
getCurrentPageId,
getIsPageSaving,
- getIsPublishingApplication,
getPageById,
getPageSavingError,
} from "selectors/editorSelectors";
@@ -46,10 +40,7 @@ import {
getIsErroredSavingAppName,
getIsSavingAppName,
} from "ee/selectors/applicationSelectors";
-import {
- publishApplication,
- updateApplication,
-} from "ee/actions/applicationActions";
+import { updateApplication } from "ee/actions/applicationActions";
import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors";
import { Omnibar } from "pages/Editor/commons/Omnibar";
import ToggleModeButton from "pages/Editor/ToggleModeButton";
@@ -62,13 +53,6 @@ import DeployLinkButtonDialog from "components/designSystems/appsmith/header/Dep
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { getAppsmithConfigs } from "ee/configs";
-import {
- getIsGitConnected,
- protectedModeSelector,
-} from "selectors/gitSyncSelectors";
-import { showConnectGitModal } from "actions/gitSyncActions";
-import AnalyticsUtil from "ee/utils/AnalyticsUtil";
-import type { NavigationSetting } from "constants/AppConstants";
import { useHref } from "pages/Editor/utils";
import { viewerURL } from "ee/RouteBuilder";
import HelpBar from "components/editorComponents/GlobalSearch/HelpBar";
@@ -80,7 +64,8 @@ import { APPLICATIONS_URL } from "constants/routes";
import { useNavigationMenuData } from "../../EditorName/useNavigationMenuData";
import useLibraryHeaderTitle from "ee/pages/Editor/IDE/Header/useLibraryHeaderTitle";
import { AppsmithLink } from "pages/Editor/AppsmithLink";
-import { getIsPackageUpgrading } from "ee/selectors/packageSelectors";
+import DeployButton from "./DeployButton";
+import GitApplicationContextProvider from "components/gitContexts/GitApplicationContextProvider";
const StyledDivider = styled(Divider)`
height: 50%;
@@ -88,12 +73,6 @@ const StyledDivider = styled(Divider)`
margin-right: 8px;
`;
-// This wrapper maintains pointer events for tooltips when the child button is disabled.
-// Without this, disabled buttons won't trigger tooltips because they have pointer-events: none
-const StyledTooltipTarget = styled.span`
- display: inline-block;
-`;
-
const { cloudHosting } = getAppsmithConfigs();
interface HeaderTitleProps {
@@ -137,19 +116,11 @@ const Header = () => {
const currentApplication = useSelector(getCurrentApplication);
const isErroredSavingName = useSelector(getIsErroredSavingAppName);
const applicationList = useSelector(getApplicationList);
- const isProtectedMode = useSelector(protectedModeSelector);
- const isPackageUpgrading = useSelector(getIsPackageUpgrading);
- const isPublishing = useSelector(getIsPublishingApplication);
- const isGitConnected = useSelector(getIsGitConnected);
const pageId = useSelector(getCurrentPageId) as string;
const currentPage = useSelector(getPageById(pageId));
const appState = useCurrentAppState();
const isSaving = useSelector(getIsPageSaving);
const pageSaveError = useSelector(getPageSavingError);
- const isDeployDisabled = isPackageUpgrading || isProtectedMode;
- const deployTooltipText = isPackageUpgrading
- ? createMessage(PACKAGE_UPGRADING_ACTION_STATUS, "deploy this app")
- : createMessage(DEPLOY_BUTTON_TOOLTIP);
// states
const [isPopoverOpen, setIsPopoverOpen] = useState<boolean>(false);
const [showModal, setShowModal] = useState<boolean>(false);
@@ -179,56 +150,8 @@ const Header = () => {
dispatch(updateApplication(id, data));
};
- const handlePublish = useCallback(() => {
- if (applicationId) {
- dispatch(publishApplication(applicationId));
-
- const appName = currentApplication ? currentApplication.name : "";
- const pageCount = currentApplication?.pages?.length;
- const navigationSettingsWithPrefix: Record<
- string,
- NavigationSetting[keyof NavigationSetting]
- > = {};
-
- if (currentApplication?.applicationDetail?.navigationSetting) {
- const settingKeys = Object.keys(
- currentApplication.applicationDetail.navigationSetting,
- ) as Array<keyof NavigationSetting>;
-
- settingKeys.map((key: keyof NavigationSetting) => {
- if (currentApplication?.applicationDetail?.navigationSetting?.[key]) {
- const value: NavigationSetting[keyof NavigationSetting] =
- currentApplication.applicationDetail.navigationSetting[key];
-
- navigationSettingsWithPrefix[`navigationSetting_${key}`] = value;
- }
- });
- }
-
- AnalyticsUtil.logEvent("PUBLISH_APP", {
- appId: applicationId,
- appName,
- pageCount,
- ...navigationSettingsWithPrefix,
- isPublic: !!currentApplication?.isPublic,
- templateTitle: currentApplication?.forkedFromTemplateTitle,
- });
- }
- }, [applicationId, currentApplication, dispatch]);
-
- const handleClickDeploy = useCallback(() => {
- if (isGitConnected) {
- dispatch(showConnectGitModal());
- AnalyticsUtil.logEvent("GS_DEPLOY_GIT_CLICK", {
- source: "Deploy button",
- });
- } else {
- handlePublish();
- }
- }, [dispatch, handlePublish, isGitConnected]);
-
return (
- <>
+ <GitApplicationContextProvider>
<IDEHeader>
<IDEHeader.Left logo={<AppsmithLink />}>
<HeaderTitleComponent appState={appState} />
@@ -338,30 +261,13 @@ const Header = () => {
showModal={showPublishCommunityTemplateModal}
/>
<div className="flex items-center">
- <Tooltip content={deployTooltipText} placement="bottomRight">
- <StyledTooltipTarget>
- <Button
- className="t--application-publish-btn"
- data-guided-tour-iid="deploy"
- id={"application-publish-btn"}
- isDisabled={isDeployDisabled}
- isLoading={isPublishing}
- kind="tertiary"
- onClick={handleClickDeploy}
- size="md"
- startIcon={"rocket"}
- >
- {DEPLOY_MENU_OPTION()}
- </Button>
- </StyledTooltipTarget>
- </Tooltip>
-
+ <DeployButton />
<DeployLinkButtonDialog link={deployLink} trigger="" />
</div>
</IDEHeader.Right>
</IDEHeader>
<Omnibar />
- </>
+ </GitApplicationContextProvider>
);
};
diff --git a/app/client/src/pages/Editor/IDE/Layout/AnimatedLayout.tsx b/app/client/src/pages/Editor/IDE/Layout/AnimatedLayout.tsx
index 952b3542c3f8..bc6d2970d014 100644
--- a/app/client/src/pages/Editor/IDE/Layout/AnimatedLayout.tsx
+++ b/app/client/src/pages/Editor/IDE/Layout/AnimatedLayout.tsx
@@ -2,7 +2,6 @@ import React from "react";
import { useGridLayoutTemplate } from "./hooks/useGridLayoutTemplate";
import EditorWrapperContainer from "pages/Editor/commons/EditorWrapperContainer";
import { AnimatedGridLayout, LayoutArea } from "components/AnimatedGridLayout";
-import { useSelector } from "react-redux";
import BottomBar from "components/BottomBar";
import Sidebar from "../Sidebar";
import LeftPane from "../LeftPane";
@@ -10,10 +9,28 @@ import MainPane from "../MainPane";
import RightPane from "../RightPane";
import { Areas } from "./constants";
import ProtectedCallout from "../ProtectedCallout";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
+import {
+ useGitModEnabled,
+ useGitProtectedMode,
+} from "pages/Editor/gitSync/hooks/modHooks";
+import { GitProtectedBranchCallout as GitProtectedBranchCalloutNew } from "git";
+
+function GitProtectedBranchCallout() {
+ const isGitModEnabled = useGitModEnabled();
+ const isProtectedMode = useGitProtectedMode();
+
+ if (isGitModEnabled) {
+ return <GitProtectedBranchCalloutNew />;
+ }
+
+ if (isProtectedMode) {
+ return <ProtectedCallout />;
+ }
+
+ return null;
+}
function AnimatedLayout() {
- const isProtectedMode = useSelector(protectedModeSelector);
const { areas, columns, rows } = useGridLayoutTemplate();
if (columns.length === 0) {
@@ -22,7 +39,7 @@ function AnimatedLayout() {
return (
<>
- {isProtectedMode && <ProtectedCallout />}
+ <GitProtectedBranchCallout />
<EditorWrapperContainer>
<AnimatedGridLayout
areas={areas}
diff --git a/app/client/src/pages/Editor/IDE/Layout/StaticLayout.tsx b/app/client/src/pages/Editor/IDE/Layout/StaticLayout.tsx
index 57e2fd104fe7..6a4bcdb31f12 100644
--- a/app/client/src/pages/Editor/IDE/Layout/StaticLayout.tsx
+++ b/app/client/src/pages/Editor/IDE/Layout/StaticLayout.tsx
@@ -1,5 +1,4 @@
import React from "react";
-import { useSelector } from "react-redux";
import BottomBar from "components/BottomBar";
import EditorWrapperContainer from "../../commons/EditorWrapperContainer";
@@ -7,11 +6,30 @@ import Sidebar from "pages/Editor/IDE/Sidebar";
import LeftPane from "../LeftPane";
import MainPane from "../MainPane";
import RightPane from "../RightPane";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
import ProtectedCallout from "../ProtectedCallout";
import { useGridLayoutTemplate } from "./hooks/useGridLayoutTemplate";
import styled from "styled-components";
import { Areas } from "./constants";
+import {
+ useGitModEnabled,
+ useGitProtectedMode,
+} from "pages/Editor/gitSync/hooks/modHooks";
+import { GitProtectedBranchCallout as GitProtectedBranchCalloutNew } from "git";
+
+function GitProtectedBranchCallout() {
+ const isGitModEnabled = useGitModEnabled();
+ const isProtectedMode = useGitProtectedMode();
+
+ if (isGitModEnabled) {
+ return <GitProtectedBranchCalloutNew />;
+ }
+
+ if (isProtectedMode) {
+ return <ProtectedCallout />;
+ }
+
+ return null;
+}
const GridContainer = styled.div`
display: grid;
@@ -26,14 +44,13 @@ const LayoutContainer = styled.div<{ name: string }>`
`;
export const StaticLayout = React.memo(() => {
- const isProtectedMode = useSelector(protectedModeSelector);
const { areas, columns } = useGridLayoutTemplate();
const isSidebarVisible = columns[0] !== "0px";
return (
<>
- {isProtectedMode && <ProtectedCallout />}
+ <GitProtectedBranchCallout />
<EditorWrapperContainer>
<GridContainer
style={{
diff --git a/app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts b/app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts
index ace70208b26d..fe8dfd7e8a6a 100644
--- a/app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts
+++ b/app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts
@@ -11,7 +11,7 @@ import { getPropertyPaneWidth } from "selectors/propertyPaneSelectors";
import { EditorEntityTab, EditorViewMode } from "ee/entities/IDE/constants";
import { useCurrentEditorState } from "../../hooks";
import { previewModeSelector } from "selectors/editorSelectors";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
+import { useGitProtectedMode } from "pages/Editor/gitSync/hooks/modHooks";
export const useEditorStateLeftPaneWidth = (): number => {
const [windowWidth] = useWindowDimensions();
@@ -20,7 +20,7 @@ export const useEditorStateLeftPaneWidth = (): number => {
const { segment } = useCurrentEditorState();
const propertyPaneWidth = useSelector(getPropertyPaneWidth);
const isPreviewMode = useSelector(previewModeSelector);
- const isProtectedMode = useSelector(protectedModeSelector);
+ const isProtectedMode = useGitProtectedMode();
useEffect(
function updateWidth() {
diff --git a/app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts b/app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts
index b2dc0558af59..bf97ce71790b 100644
--- a/app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts
+++ b/app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts
@@ -7,7 +7,6 @@ import { useCurrentAppState } from "../../hooks/useCurrentAppState";
import { getPropertyPaneWidth } from "selectors/propertyPaneSelectors";
import { previewModeSelector } from "selectors/editorSelectors";
import { getIDEViewMode } from "selectors/ideSelectors";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
import {
EditorEntityTab,
EditorState,
@@ -20,6 +19,7 @@ import {
} from "constants/AppConstants";
import { useEditorStateLeftPaneWidth } from "./useEditorStateLeftPaneWidth";
import { type Area, Areas, SIDEBAR_WIDTH } from "../constants";
+import { useGitProtectedMode } from "pages/Editor/gitSync/hooks/modHooks";
interface ReturnValue {
areas: Area[][];
@@ -43,7 +43,7 @@ function useGridLayoutTemplate(): ReturnValue {
const appState = useCurrentAppState();
const isPreviewMode = useSelector(previewModeSelector);
const editorMode = useSelector(getIDEViewMode);
- const isProtectedMode = useSelector(protectedModeSelector);
+ const isProtectedMode = useGitProtectedMode();
React.useEffect(
function updateIDEColumns() {
diff --git a/app/client/src/pages/Editor/IDE/ProtectedCallout.test.tsx b/app/client/src/pages/Editor/IDE/ProtectedCallout.test.tsx
index 2a60c70f3f86..d735d5663d88 100644
--- a/app/client/src/pages/Editor/IDE/ProtectedCallout.test.tsx
+++ b/app/client/src/pages/Editor/IDE/ProtectedCallout.test.tsx
@@ -3,11 +3,11 @@ import { render } from "@testing-library/react";
import { merge } from "lodash";
import { Provider } from "react-redux";
import configureStore from "redux-mock-store";
-import IDE from ".";
import { BrowserRouter } from "react-router-dom";
import "@testing-library/jest-dom";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import store from "store";
+import ProtectedCallout from "./ProtectedCallout";
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -64,7 +64,7 @@ describe("Protected callout test cases", () => {
const { getByTestId } = render(
<Provider store={store}>
<BrowserRouter>
- <IDE />
+ <ProtectedCallout />
</BrowserRouter>
</Provider>,
);
@@ -72,33 +72,6 @@ describe("Protected callout test cases", () => {
expect(getByTestId("t--git-protected-branch-callout")).toBeInTheDocument();
});
- it("should not render the protected view if branch is not protected", () => {
- const store = getMockStore({
- ui: {
- applications: {
- currentApplication: {
- gitApplicationMetadata: {
- branchName: "branch-1",
- },
- },
- },
- gitSync: {
- protectedBranches: ["main"],
- },
- },
- });
- const { queryByTestId } = render(
- <Provider store={store}>
- <BrowserRouter>
- <IDE />
- </BrowserRouter>
- </Provider>,
- );
-
- expect(
- queryByTestId("t--git-protected-branch-callout"),
- ).not.toBeInTheDocument();
- });
it("should unprotect only the current branch if clicked on unprotect cta", () => {
const store = getMockStore({
ui: {
@@ -117,7 +90,7 @@ describe("Protected callout test cases", () => {
const { queryByTestId } = render(
<Provider store={store}>
<BrowserRouter>
- <IDE />
+ <ProtectedCallout />
</BrowserRouter>
</Provider>,
);
diff --git a/app/client/src/pages/Editor/IDE/hooks.test.tsx b/app/client/src/pages/Editor/IDE/hooks.test.tsx
index 0a12538bf260..9e5e40d6e98f 100644
--- a/app/client/src/pages/Editor/IDE/hooks.test.tsx
+++ b/app/client/src/pages/Editor/IDE/hooks.test.tsx
@@ -6,6 +6,12 @@ import { useGetPageFocusUrl } from "./hooks";
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { createEditorFocusInfo } from "../../../ce/navigation/FocusStrategy/AppIDEFocusStrategy";
+const mockUseGitCurrentBranch = jest.fn<string | null, []>(() => null);
+
+jest.mock("../gitSync/hooks/modHooks", () => ({
+ useGitCurrentBranch: () => mockUseGitCurrentBranch(),
+}));
+
describe("useGetPageFocusUrl", () => {
const pages = PageFactory.buildList(4);
@@ -42,6 +48,7 @@ describe("useGetPageFocusUrl", () => {
const wrapper = hookWrapper({ initialState: state });
it("works for JS focus history", () => {
+ mockUseGitCurrentBranch.mockReturnValue(null);
const { result } = renderHook(() => useGetPageFocusUrl(pages[0].pageId), {
wrapper,
});
@@ -83,10 +90,13 @@ describe("useGetPageFocusUrl", () => {
it("returns correct state when branches exist", () => {
const branch = "featureBranch";
+
+ mockUseGitCurrentBranch.mockReturnValue(branch);
const page1FocusHistoryWithBranch = createEditorFocusInfo(
pages[0].pageId,
branch,
);
+
const state = getIDETestState({
pages,
focusHistory: {
diff --git a/app/client/src/pages/Editor/IDE/hooks.ts b/app/client/src/pages/Editor/IDE/hooks.ts
index 178a02e94222..6d356af8626b 100644
--- a/app/client/src/pages/Editor/IDE/hooks.ts
+++ b/app/client/src/pages/Editor/IDE/hooks.ts
@@ -15,7 +15,6 @@ import {
widgetListURL,
} from "ee/RouteBuilder";
import { getCurrentFocusInfo } from "selectors/focusHistorySelectors";
-import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import { getIsAltFocusWidget, getWidgetSelectionBlock } from "selectors/ui";
import { altFocusWidget, setWidgetSelectionBlock } from "actions/widgetActions";
import { useJSAdd } from "ee/pages/Editor/IDE/EditorPane/JS/hooks";
@@ -27,6 +26,7 @@ import { closeJSActionTab } from "actions/jsActionActions";
import { closeQueryActionTab } from "actions/pluginActionActions";
import { getCurrentBasePageId } from "selectors/editorSelectors";
import { getCurrentEntityInfo } from "../utils";
+import { useGitCurrentBranch } from "../gitSync/hooks/modHooks";
import { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";
import { useBoolean } from "usehooks-ts";
@@ -102,7 +102,8 @@ export const useSegmentNavigation = (): {
export const useGetPageFocusUrl = (basePageId: string): string => {
const [focusPageUrl, setFocusPageUrl] = useState(builderURL({ basePageId }));
- const branch = useSelector(getCurrentGitBranch);
+ const branch = useGitCurrentBranch();
+
const editorStateFocusInfo = useSelector((appState) =>
getCurrentFocusInfo(appState, createEditorFocusInfoKey(basePageId, branch)),
);
diff --git a/app/client/src/pages/Editor/WidgetsEditor/components/LayoutSystemBasedPageViewer.tsx b/app/client/src/pages/Editor/WidgetsEditor/components/LayoutSystemBasedPageViewer.tsx
index a430ed2fd02e..935e67cd90f0 100644
--- a/app/client/src/pages/Editor/WidgetsEditor/components/LayoutSystemBasedPageViewer.tsx
+++ b/app/client/src/pages/Editor/WidgetsEditor/components/LayoutSystemBasedPageViewer.tsx
@@ -8,9 +8,9 @@ import {
getCurrentPageId,
previewModeSelector,
} from "selectors/editorSelectors";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
import { getAppSettingsPaneContext } from "selectors/appSettingsPaneSelectors";
import { useShowSnapShotBanner } from "pages/Editor/CanvasLayoutConversion/hooks/useShowSnapShotBanner";
+import { useGitProtectedMode } from "pages/Editor/gitSync/hooks/modHooks";
/**
* LayoutSystemBasedPageViewer
@@ -25,7 +25,7 @@ export const LayoutSystemBasedPageViewer = ({
}) => {
const currentPageId = useSelector(getCurrentPageId);
const isPreviewMode = useSelector(previewModeSelector);
- const isProtectedMode = useSelector(protectedModeSelector);
+ const isProtectedMode = useGitProtectedMode();
const appSettingsPaneContext = useSelector(getAppSettingsPaneContext);
const canvasWidth = useSelector(getCanvasWidth);
const shouldShowSnapShotBanner = useShowSnapShotBanner(
diff --git a/app/client/src/pages/Editor/WidgetsEditor/components/NavigationAdjustedPageViewer.tsx b/app/client/src/pages/Editor/WidgetsEditor/components/NavigationAdjustedPageViewer.tsx
index 7ec7cdd62ec4..6eb0f1ff10a6 100644
--- a/app/client/src/pages/Editor/WidgetsEditor/components/NavigationAdjustedPageViewer.tsx
+++ b/app/client/src/pages/Editor/WidgetsEditor/components/NavigationAdjustedPageViewer.tsx
@@ -4,7 +4,7 @@ import { EditorState } from "ee/entities/IDE/constants";
import { useCurrentAppState } from "pages/Editor/IDE/hooks/useCurrentAppState";
import { getIsAppSettingsPaneWithNavigationTabOpen } from "selectors/appSettingsPaneSelectors";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { PageViewWrapper } from "pages/AppViewer/AppPage";
import classNames from "classnames";
import { APP_MODE } from "entities/App";
@@ -27,7 +27,7 @@ import { getIsAnvilLayout } from "layoutSystems/anvil/integrations/selectors";
export const NavigationAdjustedPageViewer = (props: {
children: ReactNode;
}) => {
- const isPreview = useSelector(combinedPreviewModeSelector);
+ const isPreview = useSelector(selectCombinedPreviewMode);
const currentApplicationDetails = useSelector(getCurrentApplication);
const isAppSidebarPinned = useSelector(getAppSidebarPinned);
const sidebarWidth = useSelector(getSidebarWidth);
diff --git a/app/client/src/pages/Editor/WidgetsEditor/components/NavigationPreview.tsx b/app/client/src/pages/Editor/WidgetsEditor/components/NavigationPreview.tsx
index 0478d6f63439..8f2aa0e23c24 100644
--- a/app/client/src/pages/Editor/WidgetsEditor/components/NavigationPreview.tsx
+++ b/app/client/src/pages/Editor/WidgetsEditor/components/NavigationPreview.tsx
@@ -2,7 +2,7 @@ import type { LegacyRef } from "react";
import React, { forwardRef } from "react";
import classNames from "classnames";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { Navigation } from "pages/AppViewer/Navigation";
import { useCurrentAppState } from "pages/Editor/IDE/hooks/useCurrentAppState";
import { EditorState } from "ee/entities/IDE/constants";
@@ -22,7 +22,7 @@ const NavigationPreview = forwardRef(
const appState = useCurrentAppState();
const isAppSettingsPaneWithNavigationTabOpen =
appState === EditorState.SETTINGS && isNavigationSelectedInSettings;
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
return (
<div
diff --git a/app/client/src/pages/Editor/WidgetsEditor/components/WidgetEditorContentWrapper.tsx b/app/client/src/pages/Editor/WidgetsEditor/components/WidgetEditorContentWrapper.tsx
index 517413ff0274..1f6cc4985526 100644
--- a/app/client/src/pages/Editor/WidgetsEditor/components/WidgetEditorContentWrapper.tsx
+++ b/app/client/src/pages/Editor/WidgetsEditor/components/WidgetEditorContentWrapper.tsx
@@ -1,19 +1,17 @@
import React, { type ReactNode, useCallback, useMemo } from "react";
import { useDispatch, useSelector } from "react-redux";
-import {
- combinedPreviewModeSelector,
- getIsAutoLayout,
-} from "selectors/editorSelectors";
+import { getIsAutoLayout } from "selectors/editorSelectors";
import { setCanvasSelectionFromEditor } from "actions/canvasSelectionActions";
import { useAllowEditorDragToSelect } from "utils/hooks/useAllowEditorDragToSelect";
import { useAutoHeightUIState } from "utils/hooks/autoHeightUIHooks";
import { getSelectedAppTheme } from "selectors/appThemingSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
export const WidgetEditorContentWrapper = (props: { children: ReactNode }) => {
const allowDragToSelect = useAllowEditorDragToSelect();
const { isAutoHeightWithLimitsChanging } = useAutoHeightUIState();
const dispatch = useDispatch();
- const isCombinedPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isCombinedPreviewMode = useSelector(selectCombinedPreviewMode);
const handleWrapperClick = useCallback(
(e) => {
diff --git a/app/client/src/pages/Editor/WidgetsEditor/components/WidgetEditorNavigation.tsx b/app/client/src/pages/Editor/WidgetsEditor/components/WidgetEditorNavigation.tsx
index 852c210685ee..d7b7d2869271 100644
--- a/app/client/src/pages/Editor/WidgetsEditor/components/WidgetEditorNavigation.tsx
+++ b/app/client/src/pages/Editor/WidgetsEditor/components/WidgetEditorNavigation.tsx
@@ -7,7 +7,7 @@ import {
getIsAppSettingsPaneWithNavigationTabOpen,
} from "selectors/appSettingsPaneSelectors";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { getCurrentApplication } from "ee/selectors/applicationSelectors";
/**
@@ -20,7 +20,7 @@ import { getCurrentApplication } from "ee/selectors/applicationSelectors";
export const useNavigationPreviewHeight = () => {
const [navigationHeight, setNavigationHeight] = useState(0);
const navigationPreviewRef = useRef(null);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const appSettingsPaneContext = useSelector(getAppSettingsPaneContext);
const currentApplicationDetails = useSelector(getCurrentApplication);
@@ -54,7 +54,7 @@ type DivRef = React.Ref<HTMLDivElement>;
*/
export const WidgetEditorNavigation = forwardRef(
(props, navigationPreviewRef: DivRef) => {
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isNavigationSelectedInSettings = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
);
diff --git a/app/client/src/pages/Editor/commons/EditorWrapperContainer.tsx b/app/client/src/pages/Editor/commons/EditorWrapperContainer.tsx
index 990004cbbec5..3b34d1beecd4 100644
--- a/app/client/src/pages/Editor/commons/EditorWrapperContainer.tsx
+++ b/app/client/src/pages/Editor/commons/EditorWrapperContainer.tsx
@@ -2,11 +2,11 @@ import React from "react";
import styled from "styled-components";
import classNames from "classnames";
import { useSelector } from "react-redux";
-import { combinedPreviewModeSelector } from "../../../selectors/editorSelectors";
-import { protectedModeSelector } from "selectors/gitSyncSelectors";
import { IDE_HEADER_HEIGHT } from "@appsmith/ads";
import { BOTTOM_BAR_HEIGHT } from "../../../components/BottomBar/constants";
import { PROTECTED_CALLOUT_HEIGHT } from "../IDE/ProtectedCallout";
+import { useGitProtectedMode } from "../gitSync/hooks/modHooks";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
interface EditorWrapperContainerProps {
children: React.ReactNode;
@@ -25,8 +25,8 @@ const Wrapper = styled.div<{
`;
function EditorWrapperContainer({ children }: EditorWrapperContainerProps) {
- const isCombinedPreviewMode = useSelector(combinedPreviewModeSelector);
- const isProtectedMode = useSelector(protectedModeSelector);
+ const isCombinedPreviewMode = useSelector(selectCombinedPreviewMode);
+ const isProtectedMode = useGitProtectedMode();
return (
<Wrapper
diff --git a/app/client/src/pages/Editor/gitSync/components/DeployPreview.tsx b/app/client/src/pages/Editor/gitSync/components/DeployPreview.tsx
index 68c5d609429b..9ead5d9d65c9 100644
--- a/app/client/src/pages/Editor/gitSync/components/DeployPreview.tsx
+++ b/app/client/src/pages/Editor/gitSync/components/DeployPreview.tsx
@@ -58,7 +58,6 @@ export default function DeployPreview(props: { showSuccess: boolean }) {
: "";
return lastDeployedAt ? (
- // ! case: can use flex?
<Container className="t--git-deploy-preview">
<div>
{props.showSuccess ? (
diff --git a/app/client/src/pages/Editor/gitSync/hooks/modHooks.ts b/app/client/src/pages/Editor/gitSync/hooks/modHooks.ts
new file mode 100644
index 000000000000..e4d4b7fb4b7a
--- /dev/null
+++ b/app/client/src/pages/Editor/gitSync/hooks/modHooks.ts
@@ -0,0 +1,44 @@
+// temp file will be removed after git mod is fully rolled out
+
+import { useSelector } from "react-redux";
+import {
+ getCurrentGitBranch,
+ getIsGitConnected,
+ protectedModeSelector,
+} from "selectors/gitSyncSelectors";
+import {
+ useGitProtectedMode as useGitProtectedModeNew,
+ useGitCurrentBranch as useGitCurrentBranchNew,
+ useGitConnected as useGitConnectedNew,
+} from "git";
+import { selectGitModEnabled } from "selectors/gitModSelectors";
+
+export function useGitModEnabled() {
+ const isGitModEnabled = useSelector(selectGitModEnabled);
+
+ return isGitModEnabled;
+}
+
+export function useGitCurrentBranch() {
+ const isGitModEnabled = useGitModEnabled();
+ const currentBranchOld = useSelector(getCurrentGitBranch) ?? null;
+ const currentBranchNew = useGitCurrentBranchNew();
+
+ return isGitModEnabled ? currentBranchNew : currentBranchOld;
+}
+
+export function useGitProtectedMode() {
+ const isGitModEnabled = useGitModEnabled();
+ const isProtectedModeOld = useSelector(protectedModeSelector);
+ const isProtectedModeNew = useGitProtectedModeNew();
+
+ return isGitModEnabled ? isProtectedModeNew : isProtectedModeOld;
+}
+
+export function useGitConnected() {
+ const isGitModEnabled = useGitModEnabled();
+ const isGitConnectedOld = useSelector(getIsGitConnected);
+ const isGitConnectedNew = useGitConnectedNew();
+
+ return isGitModEnabled ? isGitConnectedNew : isGitConnectedOld;
+}
diff --git a/app/client/src/pages/Editor/index.tsx b/app/client/src/pages/Editor/index.tsx
index a7bfff34f2cb..746b7ca56733 100644
--- a/app/client/src/pages/Editor/index.tsx
+++ b/app/client/src/pages/Editor/index.tsx
@@ -25,12 +25,9 @@ import { getTheme, ThemeMode } from "selectors/themeSelectors";
import { ThemeProvider } from "styled-components";
import type { Theme } from "constants/DefaultTheme";
import GlobalHotKeys from "./GlobalHotKeys";
-import GitSyncModal from "pages/Editor/gitSync/GitSyncModal";
-import DisconnectGitModal from "pages/Editor/gitSync/DisconnectGitModal";
import { setupPageAction, updateCurrentPage } from "actions/pageActions";
import { getCurrentPageId } from "selectors/editorSelectors";
import { getSearchQuery } from "utils/helpers";
-import RepoLimitExceededErrorModal from "./gitSync/RepoLimitExceededErrorModal";
import ImportedApplicationSuccessModal from "./gitSync/ImportSuccessModal";
import { getIsBranchUpdated } from "../utils";
import { APP_MODE } from "entities/App";
@@ -42,16 +39,40 @@ import SignpostingOverlay from "pages/Editor/FirstTimeUserOnboarding/Overlay";
import { editorInitializer } from "../../utils/editor/EditorUtils";
import { widgetInitialisationSuccess } from "../../actions/widgetActions";
import urlBuilder from "ee/entities/URLRedirect/URLAssembly";
-import DisableAutocommitModal from "./gitSync/DisableAutocommitModal";
-import GitSettingsModal from "./gitSync/GitSettingsModal";
-import ReconfigureCDKeyModal from "ee/components/gitComponents/ReconfigureCDKeyModal";
-import DisableCDModal from "ee/components/gitComponents/DisableCDModal";
import { PartialExportModal } from "components/editorComponents/PartialImportExport/PartialExportModal";
import { PartialImportModal } from "components/editorComponents/PartialImportExport/PartialImportModal";
import type { Page } from "entities/Page";
import { AppCURLImportModal } from "ee/pages/Editor/CurlImport";
import { IDE_HEADER_HEIGHT } from "@appsmith/ads";
import GeneratePageModal from "./GeneratePage";
+import { GitModals as NewGitModals } from "git";
+import GitSyncModal from "./gitSync/GitSyncModal";
+import GitSettingsModal from "./gitSync/GitSettingsModal";
+import DisconnectGitModal from "./gitSync/DisconnectGitModal";
+import DisableAutocommitModal from "./gitSync/DisableAutocommitModal";
+import ReconfigureCDKeyModal from "ee/components/gitComponents/ReconfigureCDKeyModal";
+import DisableCDModal from "ee/components/gitComponents/DisableCDModal";
+import RepoLimitExceededErrorModal from "./gitSync/RepoLimitExceededErrorModal";
+import { useGitModEnabled } from "./gitSync/hooks/modHooks";
+import GitApplicationContextProvider from "components/gitContexts/GitApplicationContextProvider";
+
+function GitModals() {
+ const isGitModEnabled = useGitModEnabled();
+
+ return isGitModEnabled ? (
+ <NewGitModals />
+ ) : (
+ <>
+ <GitSyncModal />
+ <GitSettingsModal />
+ <DisableCDModal />
+ <ReconfigureCDKeyModal />
+ <DisconnectGitModal />
+ <DisableAutocommitModal />
+ <RepoLimitExceededErrorModal />
+ </>
+ );
+}
interface EditorProps {
currentApplicationId?: string;
@@ -195,24 +216,20 @@ class Editor extends Component<Props> {
{`${this.props.currentApplicationName} | Editor | Appsmith`}
</title>
</Helmet>
- <GlobalHotKeys>
- <IDE />
- <GitSyncModal />
- <GitSettingsModal />
- <DisableCDModal />
- <ReconfigureCDKeyModal />
- <DisconnectGitModal />
- <DisableAutocommitModal />
- <RepoLimitExceededErrorModal />
- <TemplatesModal />
- <ImportedApplicationSuccessModal />
- <ReconnectDatasourceModal />
- <SignpostingOverlay />
- <PartialExportModal />
- <PartialImportModal />
- <AppCURLImportModal />
- <GeneratePageModal />
- </GlobalHotKeys>
+ <GitApplicationContextProvider>
+ <GlobalHotKeys>
+ <IDE />
+ <GitModals />
+ <TemplatesModal />
+ <ImportedApplicationSuccessModal />
+ <ReconnectDatasourceModal />
+ <SignpostingOverlay />
+ <PartialExportModal />
+ <PartialImportModal />
+ <AppCURLImportModal />
+ <GeneratePageModal />
+ </GlobalHotKeys>
+ </GitApplicationContextProvider>
</div>
<RequestConfirmationModal />
</ThemeProvider>
diff --git a/app/client/src/pages/UserProfile/index.tsx b/app/client/src/pages/UserProfile/index.tsx
index a715171bc31d..f77d74fedb50 100644
--- a/app/client/src/pages/UserProfile/index.tsx
+++ b/app/client/src/pages/UserProfile/index.tsx
@@ -3,12 +3,23 @@ import PageWrapper from "pages/common/PageWrapper";
import styled from "styled-components";
import { Tabs, Tab, TabsList, TabPanel } from "@appsmith/ads";
import General from "./General";
-import GitConfig from "./GitConfig";
+import OldGitConfig from "./GitConfig";
import { useLocation } from "react-router";
import { GIT_PROFILE_ROUTE } from "constants/routes";
import { BackButton } from "components/utils/helperComponents";
import { useDispatch } from "react-redux";
import { fetchGlobalGitConfigInit } from "actions/gitSyncActions";
+import { useGitModEnabled } from "pages/Editor/gitSync/hooks/modHooks";
+import {
+ fetchGitGlobalProfile,
+ GitGlobalProfile as GitGlobalProfileNew,
+} from "git";
+
+function GitGlobalProfile() {
+ const isGitModEnabled = useGitModEnabled();
+
+ return isGitModEnabled ? <GitGlobalProfileNew /> : <OldGitConfig />;
+}
const ProfileWrapper = styled.div`
width: 978px;
@@ -25,6 +36,7 @@ const ProfileWrapper = styled.div`
function UserProfile() {
const location = useLocation();
const dispatch = useDispatch();
+ const isGitModEnabled = useGitModEnabled();
let initialTab = "general";
const tabs = [
@@ -39,7 +51,7 @@ function UserProfile() {
tabs.push({
key: "gitConfig",
title: "Git user config",
- panelComponent: <GitConfig />,
+ panelComponent: <GitGlobalProfile />,
icon: "git-branch",
});
@@ -49,10 +61,16 @@ function UserProfile() {
const [selectedTab, setSelectedTab] = useState(initialTab);
- useEffect(() => {
- // onMount Fetch Global config
- dispatch(fetchGlobalGitConfigInit());
- }, []);
+ useEffect(
+ function fetchGlobalGitConfigOnInitEffect() {
+ if (isGitModEnabled) {
+ dispatch(fetchGitGlobalProfile());
+ } else {
+ dispatch(fetchGlobalGitConfigInit());
+ }
+ },
+ [dispatch, isGitModEnabled],
+ );
return (
<PageWrapper displayName={"Profile"}>
diff --git a/app/client/src/pages/common/ImportModal.tsx b/app/client/src/pages/common/ImportModal.tsx
index b19974788529..12cefc5dec8c 100644
--- a/app/client/src/pages/common/ImportModal.tsx
+++ b/app/client/src/pages/common/ImportModal.tsx
@@ -30,6 +30,8 @@ import {
import useMessages from "ee/hooks/importModal/useMessages";
import useMethods from "ee/hooks/importModal/useMethods";
import { getIsAnvilLayoutEnabled } from "layoutSystems/anvil/integrations/selectors";
+import { useGitModEnabled } from "pages/Editor/gitSync/hooks/modHooks";
+import { toggleGitImportModal } from "git";
const TextWrapper = styled.div`
padding: 0;
@@ -203,6 +205,7 @@ function ImportModal(props: ImportModalProps) {
toEditor = false,
workspaceId,
} = props;
+ const isGitModEnabled = useGitModEnabled();
const { mainDescription, title } = useMessages();
const {
appFileToBeUploaded,
@@ -223,15 +226,21 @@ function ImportModal(props: ImportModalProps) {
setWorkspaceIdForImport({ editorId: editorId || "", workspaceId }),
);
- dispatch(
- setIsGitSyncModalOpen({
- isOpen: true,
- tab: GitSyncModalTab.GIT_CONNECTION,
- }),
- );
-
- // dispatch(setIsReconnectingDatasourcesModalOpen({ isOpen: true }));
- }, []);
+ if (isGitModEnabled) {
+ dispatch(
+ toggleGitImportModal({
+ open: true,
+ }),
+ );
+ } else {
+ dispatch(
+ setIsGitSyncModalOpen({
+ isOpen: true,
+ tab: GitSyncModalTab.GIT_CONNECTION,
+ }),
+ );
+ }
+ }, [dispatch, editorId, isGitModEnabled, onClose, workspaceId]);
useEffect(() => {
// finished of importing application
diff --git a/app/client/src/sagas/ActionExecution/StoreActionSaga.ts b/app/client/src/sagas/ActionExecution/StoreActionSaga.ts
index 4bcd909aabf0..ee6d99630ffd 100644
--- a/app/client/src/sagas/ActionExecution/StoreActionSaga.ts
+++ b/app/client/src/sagas/ActionExecution/StoreActionSaga.ts
@@ -4,7 +4,6 @@ import localStorage from "utils/localStorage";
import { updateAppStore } from "actions/pageActions";
import AppsmithConsole from "utils/AppsmithConsole";
import { getAppStoreData } from "ee/selectors/entitiesSelector";
-import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import { getCurrentApplicationId } from "selectors/editorSelectors";
import type { AppStoreState } from "reducers/entityReducers/appReducer";
import { Severity, LOG_CATEGORY } from "entities/AppsmithConsole";
@@ -13,6 +12,7 @@ import type {
TRemoveValueDescription,
TStoreValueDescription,
} from "workers/Evaluation/fns/storeFns";
+import { selectGitApplicationCurrentBranch } from "selectors/gitModSelectors";
type StoreOperation =
| TStoreValueDescription
@@ -21,7 +21,9 @@ type StoreOperation =
export function* handleStoreOperations(triggers: StoreOperation[]) {
const applicationId: string = yield select(getCurrentApplicationId);
- const branch: string | undefined = yield select(getCurrentGitBranch);
+ const branch: string | undefined = yield select(
+ selectGitApplicationCurrentBranch,
+ );
const appStoreName = getAppStoreName(applicationId, branch);
const existingLocalStore = localStorage.getItem(appStoreName) || "{}";
let parsedLocalStore = JSON.parse(existingLocalStore);
diff --git a/app/client/src/sagas/DatasourcesSagas.ts b/app/client/src/sagas/DatasourcesSagas.ts
index 189fe5b80bc4..841be4eae950 100644
--- a/app/client/src/sagas/DatasourcesSagas.ts
+++ b/app/client/src/sagas/DatasourcesSagas.ts
@@ -714,6 +714,7 @@ function* redirectAuthorizationCodeSaga(
const { contextId, contextType, datasourceId, pluginType } =
actionPayload.payload;
const isImport: string = yield select(getWorkspaceIdForImport);
+ // ! git mod - not sure how to handle this, there is no definition for the artifact used here
const branchName: string | undefined = yield select(getCurrentGitBranch);
if (pluginType === PluginType.API) {
diff --git a/app/client/src/sagas/FocusRetentionSaga.ts b/app/client/src/sagas/FocusRetentionSaga.ts
index 45232d9560dc..e92be7bae11b 100644
--- a/app/client/src/sagas/FocusRetentionSaga.ts
+++ b/app/client/src/sagas/FocusRetentionSaga.ts
@@ -18,10 +18,10 @@ import type { AppsmithLocationState } from "utils/history";
import type { Action } from "entities/Action";
import { getAction, getPlugin } from "ee/selectors/entitiesSelector";
import type { Plugin } from "api/PluginApi";
-import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import { getIDETypeByUrl } from "ee/entities/IDE/utils";
import { getIDEFocusStrategy } from "ee/navigation/FocusStrategy";
import { IDE_TYPE } from "ee/entities/IDE/constants";
+import { selectGitApplicationCurrentBranch } from "selectors/gitModSelectors";
export interface FocusPath {
key: string;
@@ -123,7 +123,9 @@ class FocusRetention {
}
public *handleRemoveFocusHistory(url: string) {
- const branch: string | undefined = yield select(getCurrentGitBranch);
+ const branch: string | undefined = yield select(
+ selectGitApplicationCurrentBranch,
+ );
const removeKeys: string[] = [];
const focusEntityInfo = identifyEntityFromPath(url);
diff --git a/app/client/src/sagas/GlobalSearchSagas.ts b/app/client/src/sagas/GlobalSearchSagas.ts
index 17cf81e719b3..93e29c0b29dc 100644
--- a/app/client/src/sagas/GlobalSearchSagas.ts
+++ b/app/client/src/sagas/GlobalSearchSagas.ts
@@ -21,19 +21,21 @@ import {
} from "selectors/editorSelectors";
import type { RecentEntity } from "components/editorComponents/GlobalSearch/utils";
import log from "loglevel";
-import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import type { FocusEntity, FocusEntityInfo } from "navigation/FocusEntity";
import { convertToPageIdSelector } from "selectors/pageListSelectors";
+import { selectGitApplicationCurrentBranch } from "selectors/gitModSelectors";
const getRecentEntitiesKey = (applicationId: string, branch?: string) =>
branch ? `${applicationId}-${branch}` : applicationId;
export function* updateRecentEntitySaga(entityInfo: FocusEntityInfo) {
try {
- const branch: string | undefined = yield select(getCurrentGitBranch);
-
const applicationId: string = yield select(getCurrentApplicationId);
+ const branch: string | undefined = yield select(
+ selectGitApplicationCurrentBranch,
+ );
+
const recentEntitiesRestored: boolean = yield select(
(state: AppState) => state.ui.globalSearch.recentEntitiesRestored,
);
diff --git a/app/client/src/sagas/autoHeightSagas/helpers.ts b/app/client/src/sagas/autoHeightSagas/helpers.ts
index da276f65d769..3ac3086a9d53 100644
--- a/app/client/src/sagas/autoHeightSagas/helpers.ts
+++ b/app/client/src/sagas/autoHeightSagas/helpers.ts
@@ -11,7 +11,7 @@ import type {
} from "reducers/entityReducers/canvasWidgetsReducer";
import { select } from "redux-saga/effects";
import { getWidgetMetaProps, getWidgets } from "sagas/selectors";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { getAppMode } from "ee/selectors/entitiesSelector";
import { isAutoHeightEnabledForWidget } from "widgets/WidgetUtils";
import { getCanvasHeightOffset } from "utils/WidgetSizeUtils";
@@ -20,7 +20,7 @@ import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { getDataTree } from "selectors/dataTreeSelectors";
export function* shouldWidgetsCollapse() {
- const isPreviewMode: boolean = yield select(combinedPreviewModeSelector);
+ const isPreviewMode: boolean = yield select(selectCombinedPreviewMode);
const appMode: APP_MODE = yield select(getAppMode);
return isPreviewMode || appMode === APP_MODE.PUBLISHED;
diff --git a/app/client/src/selectors/debuggerSelectors.tsx b/app/client/src/selectors/debuggerSelectors.tsx
index a827b65b3a0e..5c7b42516c29 100644
--- a/app/client/src/selectors/debuggerSelectors.tsx
+++ b/app/client/src/selectors/debuggerSelectors.tsx
@@ -11,8 +11,8 @@ import {
isWidget,
} from "ee/workers/Evaluation/evaluationUtils";
import { getDataTree } from "./dataTreeSelectors";
-import { combinedPreviewModeSelector } from "./editorSelectors";
import type { CanvasDebuggerState } from "reducers/uiReducers/debuggerReducer";
+import { selectCombinedPreviewMode } from "./gitModSelectors";
interface ErrorObejct {
[k: string]: Log;
@@ -169,7 +169,7 @@ export const getDebuggerOpen = (state: AppState) => state.ui.debugger.isOpen;
export const showDebuggerFlag = createSelector(
getDebuggerOpen,
- combinedPreviewModeSelector,
+ selectCombinedPreviewMode,
(isOpen, isPreview) => isOpen && !isPreview,
);
diff --git a/app/client/src/selectors/editorSelectors.tsx b/app/client/src/selectors/editorSelectors.tsx
index ee3560dd5034..39bd1d46c1b6 100644
--- a/app/client/src/selectors/editorSelectors.tsx
+++ b/app/client/src/selectors/editorSelectors.tsx
@@ -990,9 +990,3 @@ export const getGsheetToken = (state: AppState) =>
export const getGsheetProjectID = (state: AppState) =>
state.entities.datasources.gsheetProjectID;
-
-export const combinedPreviewModeSelector = createSelector(
- previewModeSelector,
- protectedModeSelector,
- (isPreviewMode, isProtectedMode) => isPreviewMode || isProtectedMode,
-);
diff --git a/app/client/src/selectors/gitModSelectors.ts b/app/client/src/selectors/gitModSelectors.ts
new file mode 100644
index 000000000000..35fe32fbbff7
--- /dev/null
+++ b/app/client/src/selectors/gitModSelectors.ts
@@ -0,0 +1,50 @@
+// temp file will be removed after git mod is fully rolled out
+
+import { selectFeatureFlags } from "ee/selectors/featureFlagsSelectors";
+import { createSelector } from "reselect";
+import { getCurrentGitBranch, protectedModeSelector } from "./gitSyncSelectors";
+import {
+ selectGitCurrentBranch as selectGitCurrentBranchNew,
+ selectGitProtectedMode as selectGitProtectedModeNew,
+} from "git";
+import {
+ getCurrentBaseApplicationId,
+ previewModeSelector,
+} from "./editorSelectors";
+import { applicationArtifact } from "git/artifact-helpers/application";
+
+export const selectGitModEnabled = createSelector(
+ selectFeatureFlags,
+ (featureFlags) => featureFlags.release_git_modularisation_enabled ?? false,
+);
+
+export const selectGitApplicationArtifactDef = createSelector(
+ getCurrentBaseApplicationId,
+ (baseApplicationId) => applicationArtifact(baseApplicationId),
+);
+
+export const selectGitApplicationCurrentBranch = createSelector(
+ selectGitModEnabled,
+ getCurrentGitBranch,
+ (state) =>
+ selectGitCurrentBranchNew(state, selectGitApplicationArtifactDef(state)),
+ (isGitModEnabled, currentBranchOld, currentBranchNew) => {
+ return isGitModEnabled ? currentBranchNew : currentBranchOld;
+ },
+);
+
+export const selectGitApplicationProtectedMode = createSelector(
+ selectGitModEnabled,
+ protectedModeSelector,
+ (state) =>
+ selectGitProtectedModeNew(state, selectGitApplicationArtifactDef(state)),
+ (isGitModEnabled, protectedModeOld, protectedModeNew) => {
+ return isGitModEnabled ? protectedModeNew : protectedModeOld;
+ },
+);
+
+export const selectCombinedPreviewMode = createSelector(
+ previewModeSelector,
+ selectGitApplicationProtectedMode,
+ (isPreviewMode, isProtectedMode) => isPreviewMode || isProtectedMode,
+);
diff --git a/app/client/src/selectors/widgetDragSelectors.ts b/app/client/src/selectors/widgetDragSelectors.ts
index 0a2b35eb7e1f..21d5848d5175 100644
--- a/app/client/src/selectors/widgetDragSelectors.ts
+++ b/app/client/src/selectors/widgetDragSelectors.ts
@@ -1,11 +1,9 @@
import type { AppState } from "ee/reducers";
import { createSelector } from "reselect";
import { getIsAppSettingsPaneWithNavigationTabOpen } from "./appSettingsPaneSelectors";
-import {
- combinedPreviewModeSelector,
- snipingModeSelector,
-} from "./editorSelectors";
+import { snipingModeSelector } from "./editorSelectors";
import { getWidgetSelectionBlock } from "./ui";
+import { selectCombinedPreviewMode } from "./gitModSelectors";
export const getIsDragging = (state: AppState) =>
state.ui.widgetDragResize.isDragging;
@@ -23,7 +21,7 @@ export const getShouldAllowDrag = createSelector(
getIsResizing,
getIsDragging,
getIsDraggingDisabledInEditor,
- combinedPreviewModeSelector,
+ selectCombinedPreviewMode,
snipingModeSelector,
getIsAppSettingsPaneWithNavigationTabOpen,
getWidgetSelectionBlock,
diff --git a/app/client/src/selectors/widgetSelectors.ts b/app/client/src/selectors/widgetSelectors.ts
index 4d45777ef4c9..35d648da50bf 100644
--- a/app/client/src/selectors/widgetSelectors.ts
+++ b/app/client/src/selectors/widgetSelectors.ts
@@ -21,8 +21,8 @@ import { APP_MODE } from "entities/App";
import { getIsTableFilterPaneVisible } from "selectors/tableFilterSelectors";
import { getIsAutoHeightWithLimitsChanging } from "utils/hooks/autoHeightUIHooks";
import { getIsPropertyPaneVisible } from "./propertyPaneSelectors";
-import { combinedPreviewModeSelector } from "./editorSelectors";
import { getIsAnvilLayout } from "layoutSystems/anvil/integrations/selectors";
+import { selectCombinedPreviewMode } from "./gitModSelectors";
export const getIsDraggingOrResizing = (state: AppState) =>
state.ui.widgetDragResize.isResizing || state.ui.widgetDragResize.isDragging;
@@ -186,7 +186,7 @@ export const shouldWidgetIgnoreClicksSelector = (widgetId: string) => {
(state: AppState) => state.ui.widgetDragResize.isDragging,
(state: AppState) => state.ui.canvasSelection.isDraggingForSelection,
getAppMode,
- combinedPreviewModeSelector,
+ selectCombinedPreviewMode,
getIsAutoHeightWithLimitsChanging,
getAltBlockWidgetSelection,
(
diff --git a/app/client/src/utils/hooks/useAllowEditorDragToSelect.ts b/app/client/src/utils/hooks/useAllowEditorDragToSelect.ts
index e074a099ac70..a09f5492d648 100644
--- a/app/client/src/utils/hooks/useAllowEditorDragToSelect.ts
+++ b/app/client/src/utils/hooks/useAllowEditorDragToSelect.ts
@@ -1,13 +1,11 @@
import type { AppState } from "ee/reducers";
-import {
- snipingModeSelector,
- combinedPreviewModeSelector,
-} from "selectors/editorSelectors";
+import { snipingModeSelector } from "selectors/editorSelectors";
import { useSelector } from "react-redux";
import { getIsAppSettingsPaneWithNavigationTabOpen } from "selectors/appSettingsPaneSelectors";
import { getLayoutSystemType } from "selectors/layoutSystemSelectors";
import { LayoutSystemTypes } from "layoutSystems/types";
import { getWidgetSelectionBlock } from "../../selectors/ui";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
export const useAllowEditorDragToSelect = () => {
// This state tells us whether a `ResizableComponent` is resizing
@@ -42,7 +40,7 @@ export const useAllowEditorDragToSelect = () => {
// True when any widget is dragging or resizing, including this one
const isResizingOrDragging = !!isResizing || !!isDragging || !!isSelecting;
const isSnipingMode = useSelector(snipingModeSelector);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
getIsAppSettingsPaneWithNavigationTabOpen,
);
diff --git a/app/client/src/utils/hooks/useHoverToFocusWidget.ts b/app/client/src/utils/hooks/useHoverToFocusWidget.ts
index 10e5f764f06e..a6cf7962de9a 100644
--- a/app/client/src/utils/hooks/useHoverToFocusWidget.ts
+++ b/app/client/src/utils/hooks/useHoverToFocusWidget.ts
@@ -2,7 +2,7 @@ import { useWidgetSelection } from "./useWidgetSelection";
import { useSelector } from "react-redux";
import { isWidgetFocused } from "selectors/widgetSelectors";
import { getAnvilSpaceDistributionStatus } from "layoutSystems/anvil/integrations/selectors";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import type { AppState } from "ee/reducers";
import type React from "react";
import { useCurrentAppState } from "pages/Editor/IDE/hooks/useCurrentAppState";
@@ -35,7 +35,7 @@ export const useHoverToFocusWidget = (
const isResizingOrDragging = isResizing || isDragging;
// This state tells us whether space redistribution is in process
const isDistributingSpace = useSelector(getAnvilSpaceDistributionStatus);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
// When mouse is over this draggable
const handleMouseOver = (e: React.MouseEvent) => {
focusWidget &&
diff --git a/app/client/src/widgets/ChartWidget/component/index.test.tsx b/app/client/src/widgets/ChartWidget/component/index.test.tsx
index 8c043acb36a3..ee53792993a8 100644
--- a/app/client/src/widgets/ChartWidget/component/index.test.tsx
+++ b/app/client/src/widgets/ChartWidget/component/index.test.tsx
@@ -22,6 +22,11 @@ import { APP_MODE } from "entities/App";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let container: any;
+jest.mock("selectors/gitModSelectors", () => ({
+ ...jest.requireActual("selectors/gitModSelectors"),
+ selectCombinedPreviewMode: jest.fn(() => false),
+}));
+
describe("Chart Widget", () => {
const seriesData1: ChartData = {
seriesName: "series1",
diff --git a/app/client/src/widgets/ChartWidget/component/index.tsx b/app/client/src/widgets/ChartWidget/component/index.tsx
index 4ed693b142c3..f2a3280bd7a1 100644
--- a/app/client/src/widgets/ChartWidget/component/index.tsx
+++ b/app/client/src/widgets/ChartWidget/component/index.tsx
@@ -28,7 +28,7 @@ import { CustomEChartIFrameComponent } from "./CustomEChartIFrameComponent";
import type { AppState } from "ee/reducers";
import { connect } from "react-redux";
import { getWidgetPropsForPropertyPane } from "selectors/propertyPaneSelectors";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { getAppMode } from "ee/selectors/applicationSelectors";
import { APP_MODE } from "entities/App";
// Leaving this require here. Ref: https://stackoverflow.com/questions/41292559/could-not-find-a-declaration-file-for-module-module-name-path-to-module-nam/42505940#42505940
@@ -406,7 +406,7 @@ export const mapStateToProps = (
state: AppState,
ownProps: ChartComponentProps,
) => {
- const isPreviewMode = combinedPreviewModeSelector(state);
+ const isPreviewMode = selectCombinedPreviewMode(state);
const appMode = getAppMode(state);
return {
diff --git a/app/client/src/widgets/CustomWidget/component/index.tsx b/app/client/src/widgets/CustomWidget/component/index.tsx
index eb6740b48cd0..a3cf98d4afbb 100644
--- a/app/client/src/widgets/CustomWidget/component/index.tsx
+++ b/app/client/src/widgets/CustomWidget/component/index.tsx
@@ -19,7 +19,7 @@ import type { BoxShadow } from "components/designSystems/appsmith/WidgetStyleCon
import type { Color } from "constants/Colors";
import { connect } from "react-redux";
import type { AppState } from "ee/reducers";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
import { getWidgetPropsForPropertyPane } from "selectors/propertyPaneSelectors";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { EVENTS } from "./customWidgetscript";
@@ -311,7 +311,7 @@ export const mapStateToProps = (
state: AppState,
ownProps: CustomComponentProps,
) => {
- const isPreviewMode = combinedPreviewModeSelector(state);
+ const isPreviewMode = selectCombinedPreviewMode(state);
return {
needsOverlay:
diff --git a/app/client/src/widgets/IframeWidget/component/index.tsx b/app/client/src/widgets/IframeWidget/component/index.tsx
index 1958ebd55e36..b16f5bdb2fcb 100644
--- a/app/client/src/widgets/IframeWidget/component/index.tsx
+++ b/app/client/src/widgets/IframeWidget/component/index.tsx
@@ -9,7 +9,7 @@ import { getAppMode } from "ee/selectors/applicationSelectors";
import { APP_MODE } from "entities/App";
import type { RenderMode } from "constants/WidgetConstants";
import { getAppsmithConfigs } from "ee/configs";
-import { combinedPreviewModeSelector } from "selectors/editorSelectors";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
interface IframeContainerProps {
borderColor?: string;
@@ -145,7 +145,7 @@ function IframeComponent(props: IframeComponentProps) {
}, [srcDoc]);
const appMode = useSelector(getAppMode);
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const selectedWidget = useSelector(getWidgetPropsForPropertyPane);
return (
diff --git a/app/client/src/widgets/withWidgetProps.tsx b/app/client/src/widgets/withWidgetProps.tsx
index 73dfd519687b..5a0f13d6c19d 100644
--- a/app/client/src/widgets/withWidgetProps.tsx
+++ b/app/client/src/widgets/withWidgetProps.tsx
@@ -25,7 +25,6 @@ import {
getMetaWidget,
getIsAutoLayoutMobileBreakPoint,
getCanvasWidth,
- combinedPreviewModeSelector,
} from "selectors/editorSelectors";
import {
createCanvasWidget,
@@ -50,6 +49,7 @@ import { isWidgetSelectedForPropertyPane } from "selectors/propertyPaneSelectors
import WidgetFactory from "WidgetProvider/factory";
import { getIsAnvilLayout } from "layoutSystems/anvil/integrations/selectors";
import { endSpan, startRootSpan } from "instrumentation/generateTraces";
+import { selectCombinedPreviewMode } from "selectors/gitModSelectors";
const WIDGETS_WITH_CHILD_WIDGETS = ["LIST_WIDGET", "FORM_WIDGET"];
const WIDGETS_REQUIRING_SELECTED_ANCESTRY = ["MODAL_WIDGET", "TABS_WIDGET"];
@@ -69,7 +69,7 @@ function withWidgetProps(WrappedWidget: typeof BaseWidget) {
} = props;
const span = startRootSpan("withWidgetProps", { widgetType: type });
- const isPreviewMode = useSelector(combinedPreviewModeSelector);
+ const isPreviewMode = useSelector(selectCombinedPreviewMode);
const canvasWidget = useSelector((state: AppState) =>
getWidget(state, widgetId),
diff --git a/app/client/test/testUtils.tsx b/app/client/test/testUtils.tsx
index 9b99d698bb90..0d57bddfc09a 100644
--- a/app/client/test/testUtils.tsx
+++ b/app/client/test/testUtils.tsx
@@ -49,9 +49,12 @@ interface State {
}
const setupState = (state?: State) => {
let reduxStore = store;
+
window.history.pushState({}, "Appsmith", state?.url || "/");
+
if (state && (state.initialState || state.featureFlags)) {
reduxStore = testStore(state.initialState || {});
+
if (state.featureFlags) {
reduxStore.dispatch(
fetchFeatureFlagsSuccess({
@@ -61,10 +64,12 @@ const setupState = (state?: State) => {
);
}
}
+
if (state && state.sagasToRun) {
reduxStore = testStoreWithTestMiddleWare(reduxStore.getState());
testSagaMiddleware.run(() => rootSaga(state.sagasToRun));
}
+
const defaultTheme = getCurrentThemeDetails(reduxStore.getState());
return { reduxStore, defaultTheme };
@@ -76,6 +81,7 @@ const customRender = (
options?: Omit<RenderOptions, "queries">,
) => {
const { defaultTheme, reduxStore } = setupState(state);
+
return render(
<BrowserRouter>
<Provider store={reduxStore}>
@@ -92,6 +98,7 @@ const customRender = (
const hookWrapper = (state: State) => {
return ({ children }: { children: ReactElement }) => {
const { defaultTheme, reduxStore } = setupState(state);
+
return (
<BrowserRouter>
<Provider store={reduxStore}>
|
a2ecee7c6a4d67712e4671339214708be4a45cb8
|
2023-08-30 10:15:31
|
ChandanBalajiBP
|
fix: PhoneInputWidget crash on switching environment (#26726)
| false
|
PhoneInputWidget crash on switching environment (#26726)
|
fix
|
diff --git a/app/client/src/widgets/PhoneInputWidget/widget/index.tsx b/app/client/src/widgets/PhoneInputWidget/widget/index.tsx
index 4392c705c075..57e48499c7f3 100644
--- a/app/client/src/widgets/PhoneInputWidget/widget/index.tsx
+++ b/app/client/src/widgets/PhoneInputWidget/widget/index.tsx
@@ -276,11 +276,13 @@ class PhoneInputWidget extends BaseInputWidget<
) {
const formattedValue = this.getFormattedPhoneNumber(this.props.text);
- this.props.updateWidgetMetaProperty(
- "value",
- parseIncompletePhoneNumber(formattedValue),
- );
- this.props.updateWidgetMetaProperty("text", formattedValue);
+ if (formattedValue) {
+ this.props.updateWidgetMetaProperty(
+ "value",
+ parseIncompletePhoneNumber(formattedValue),
+ );
+ this.props.updateWidgetMetaProperty("text", formattedValue);
+ }
}
// If defaultText property has changed, reset isDirty to false
|
77193b6227c23a08fab8d6ee950268d41bb5a9c3
|
2024-05-14 09:55:26
|
Apeksha Bhosale
|
fix: update markings on update of same editor value (#33394)
| false
|
update markings on update of same editor value (#33394)
|
fix
|
diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx
index d1bcd036552f..b4463eb600cd 100644
--- a/app/client/src/components/editorComponents/CodeEditor/index.tsx
+++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx
@@ -648,6 +648,10 @@ class CodeEditor extends Component<Props, State> {
prevProps.customErrors !== this.props.customErrors
) {
this.lintCode(this.editor);
+ } else {
+ if (!!this.updateLintingCallback) {
+ this.updateLintingCallback(this.editor, this.annotations);
+ }
}
if (this.props.datasourceTableKeys !== prevProps.datasourceTableKeys) {
sqlHint.setDatasourceTableKeys(this.props.datasourceTableKeys);
@@ -1436,12 +1440,12 @@ class CodeEditor extends Component<Props, State> {
lintErrors.push(...this.props.customErrors);
}
- const annotations = getLintAnnotations(editor.getValue(), lintErrors, {
+ this.annotations = getLintAnnotations(editor.getValue(), lintErrors, {
isJSObject,
contextData,
});
- this.updateLintingCallback(editor, annotations);
+ this.updateLintingCallback(editor, this.annotations);
}
static updateMarkings = (
|
1f8e7d25cad2d136c82c71fb725cf6754f9b42db
|
2023-03-10 23:49:15
|
Saroj
|
ci: Fixing the working directory in perf-test.yml (#21341)
| false
|
Fixing the working directory in perf-test.yml (#21341)
|
ci
|
diff --git a/.github/workflows/perf-test.yml b/.github/workflows/perf-test.yml
index 23c1f06ef3e5..013dffb5f373 100644
--- a/.github/workflows/perf-test.yml
+++ b/.github/workflows/perf-test.yml
@@ -117,7 +117,6 @@ jobs:
uses: actions/download-artifact@v3
with:
name: cicontainer
- path: app/client
- name: Load Docker image from tar file
working-directory: "."
|
b05f0e493922f17591f20568a1ed89c1b4ddef02
|
2023-06-07 18:50:30
|
Shrikant Sharat Kandula
|
fix: NPE when TLS option not set at all (#24187) (#24211)
| false
|
NPE when TLS option not set at all (#24187) (#24211)
|
fix
|
diff --git a/app/client/src/pages/Settings/config/email.ts b/app/client/src/pages/Settings/config/email.ts
index 93a6cc834939..70008f3bacca 100644
--- a/app/client/src/pages/Settings/config/email.ts
+++ b/app/client/src/pages/Settings/config/email.ts
@@ -109,7 +109,8 @@ export const config: AdminConfigType = {
smtpHost: settings["APPSMITH_MAIL_HOST"],
smtpPort: settings["APPSMITH_MAIL_PORT"],
fromEmail: settings["APPSMITH_MAIL_FROM"],
- starttlsEnabled: settings["APPSMITH_MAIL_SMTP_TLS_ENABLED"],
+ starttlsEnabled:
+ settings["APPSMITH_MAIL_SMTP_TLS_ENABLED"] || false,
username: settings["APPSMITH_MAIL_USERNAME"],
password: settings["APPSMITH_MAIL_PASSWORD"],
},
|
d645d7ea8c3701377a6572b617740c66c5f23383
|
2023-10-13 14:04:27
|
Rahul Barwal
|
fix: UI enhancements for community template upload flow. (#27894)
| false
|
UI enhancements for community template upload flow. (#27894)
|
fix
|
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index 8267044a8826..76ae05963d33 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -2078,7 +2078,7 @@ export const DATASOURCE_DROPDOWN_OPTIONS = {
};
export const COMMUNITY_TEMPLATES = {
- publish: () => "Publish",
+ tabTitle: () => "Showcase",
cancel: () => "Cancel",
publishSuccessPage: {
title: () => "Live on Appsmith community",
diff --git a/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/CommunityTemplateForm.tsx b/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/CommunityTemplateForm.tsx
index b6ea9833fe7f..cdeb1efee569 100644
--- a/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/CommunityTemplateForm.tsx
+++ b/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/CommunityTemplateForm.tsx
@@ -18,7 +18,6 @@ import {
import ApplicationSettings from "./components/ApplicationSettings";
import AuthorDetailsInput from "./components/AuthorDetailsInput";
import PublishedInfo from "./components/PublishedInfo";
-import TemplateCardPreview from "./components/TemplateCardPreview";
import TemplateInfoForm from "./components/TemplateInfoForm";
import { viewerURL } from "@appsmith/RouteBuilder";
import { getCurrentPageId } from "@appsmith/selectors/entitiesSelector";
@@ -110,11 +109,11 @@ const CommunityTemplateForm = ({ onPublishSuccess }: Props) => {
return (
<>
<PublishPageBodyContainer>
- <TemplateCardPreview
+ {/*<TemplateCardPreview
excerpt={templateExcerpt}
templateName={templateName}
useCases={templateUseCases}
- />
+ />*/}
<PublishPageTemplateDetailsInputContainer>
<TemplateInfoForm
setTemplateDescription={setTemplateDescription}
diff --git a/app/client/src/pages/Editor/EditorHeader.tsx b/app/client/src/pages/Editor/EditorHeader.tsx
index 0ce471b6fa85..0a2c8a2fca40 100644
--- a/app/client/src/pages/Editor/EditorHeader.tsx
+++ b/app/client/src/pages/Editor/EditorHeader.tsx
@@ -330,7 +330,7 @@ export function EditorHeader() {
{featureFlags.release_show_publish_app_to_community_enabled &&
cloudHosting && (
<Tab data-testid="t--tab-PUBLISH" value="publish">
- {createMessage(COMMUNITY_TEMPLATES.publish)}
+ {createMessage(COMMUNITY_TEMPLATES.tabTitle)}
</Tab>
)}
</TabsList>
|
fcb90940d353b26f559b6eb419404ad044b4286e
|
2023-10-24 11:45:43
|
arunvjn
|
fix: spacing issues in debugger (#27968)
| false
|
spacing issues in debugger (#27968)
|
fix
|
diff --git a/app/client/src/components/editorComponents/EntityBottomTabs.tsx b/app/client/src/components/editorComponents/EntityBottomTabs.tsx
index 0506ae66ef23..0ec58fd193b3 100644
--- a/app/client/src/components/editorComponents/EntityBottomTabs.tsx
+++ b/app/client/src/components/editorComponents/EntityBottomTabs.tsx
@@ -10,9 +10,6 @@ import { LIST_HEADER_HEIGHT } from "./Debugger/DebuggerLogs";
const TabPanelWrapper = styled(TabPanel)`
margin-top: 0;
height: calc(100% - ${LIST_HEADER_HEIGHT});
- & > div {
- padding-top: var(--ads-v2-spaces-4);
- }
&.ads-v2-tabs__panel {
overflow: auto;
}
diff --git a/app/client/src/components/editorComponents/JSResponseView.tsx b/app/client/src/components/editorComponents/JSResponseView.tsx
index d92cfe9e34d0..1d14e0a310b7 100644
--- a/app/client/src/components/editorComponents/JSResponseView.tsx
+++ b/app/client/src/components/editorComponents/JSResponseView.tsx
@@ -71,6 +71,7 @@ const ResponseContainer = styled.div`
const ResponseTabWrapper = styled.div`
display: flex;
width: 100%;
+ height: 100%;
&.disable * {
opacity: 0.8;
diff --git a/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx b/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx
index 161d35461cea..acd00ffbda9c 100644
--- a/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx
+++ b/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx
@@ -326,6 +326,7 @@ const SidebarWrapper = styled.div<{ show: boolean }>`
export const SegmentedControlContainer = styled.div`
padding: 0 var(--ads-v2-spaces-7);
+ padding-top: var(--ads-v2-spaces-4);
display: flex;
flex-direction: column;
gap: var(--ads-v2-spaces-4);
|
8d4f6166176d00db207f6b7d7468411a1fe321b9
|
2025-02-19 18:12:58
|
Rudraprasad Das
|
chore: git pkg - package integration with git (#39342)
| false
|
git pkg - package integration with git (#39342)
|
chore
|
diff --git a/.gitignore b/.gitignore
index 8d9bcfba4528..ce30cb8280c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ app/client/yalc.lock
.idea
.fleet/*
app/client/.fleet/*
+.lens
# Observability related local storage
utils/observability/tempo-data/*
diff --git a/app/client/src/git-artifact-helpers/application/sagas/applicationImportFromGitSaga.ts b/app/client/src/git-artifact-helpers/application/sagas/applicationImportFromGitSaga.ts
new file mode 100644
index 000000000000..f77549611140
--- /dev/null
+++ b/app/client/src/git-artifact-helpers/application/sagas/applicationImportFromGitSaga.ts
@@ -0,0 +1,54 @@
+import { toast } from "@appsmith/ads";
+import { createMessage, IMPORT_APP_SUCCESSFUL } from "ee/constants/messages";
+import { builderURL } from "ee/RouteBuilder";
+import { showReconnectDatasourceModal } from "ee/actions/applicationActions";
+import type { ApplicationResponsePayload } from "ee/api/ApplicationApi";
+import type { GitImportSuccessPayload } from "git/store/actions/gitImportActions";
+import type { GitArtifactPayloadAction } from "git/store/types";
+import { put } from "redux-saga/effects";
+import history from "utils/history";
+
+export default function* applicationImportFromGitSaga(
+ action: GitArtifactPayloadAction<GitImportSuccessPayload>,
+) {
+ const { responseData } = action.payload;
+ const { isPartialImport, unConfiguredDatasourceList } = responseData;
+
+ const application =
+ (responseData.application as ApplicationResponsePayload) ?? null;
+
+ if (!application) return;
+
+ // there is configuration-missing datasources
+ if (isPartialImport) {
+ yield put(
+ showReconnectDatasourceModal({
+ application: application as ApplicationResponsePayload,
+ unConfiguredDatasourceList: unConfiguredDatasourceList ?? [],
+ workspaceId: application?.workspaceId ?? "",
+ }),
+ );
+ } else {
+ let basePageId = "";
+
+ if (application.pages && application.pages.length > 0) {
+ const defaultPage = application.pages.find(
+ (eachPage) => !!eachPage.isDefault,
+ );
+
+ basePageId = defaultPage ? defaultPage.baseId : "";
+ }
+
+ const branch = application?.gitApplicationMetadata?.branchName;
+
+ const pageURL = builderURL({
+ basePageId,
+ branch,
+ });
+
+ history.push(pageURL);
+ toast.show(createMessage(IMPORT_APP_SUCCESSFUL), {
+ kind: "success",
+ });
+ }
+}
diff --git a/app/client/src/git-artifact-helpers/application/sagas/index.ts b/app/client/src/git-artifact-helpers/application/sagas/index.ts
index d6d98ee95b36..e4942f06beae 100644
--- a/app/client/src/git-artifact-helpers/application/sagas/index.ts
+++ b/app/client/src/git-artifact-helpers/application/sagas/index.ts
@@ -5,12 +5,15 @@ import {
gitCheckoutBranchSuccess,
gitConnectSuccess,
gitDiscardSuccess,
+ gitImportSuccess,
gitPullSuccess,
} from "git/store";
+import applicationImportFromGitSaga from "./applicationImportFromGitSaga";
export default function* gitApplicationSagas() {
yield all([
takeLatest(gitConnectSuccess.type, applicationConnectToGitSaga),
+ takeLatest(gitImportSuccess.type, applicationImportFromGitSaga),
takeLatest(gitDiscardSuccess.type, applicationRedirectToClosestEntitySaga),
takeLatest(
gitCheckoutBranchSuccess.type,
diff --git a/app/client/src/git/requests/gitImportRequest.types.ts b/app/client/src/git/requests/gitImportRequest.types.ts
index 034dc7aed402..bfa4def95548 100644
--- a/app/client/src/git/requests/gitImportRequest.types.ts
+++ b/app/client/src/git/requests/gitImportRequest.types.ts
@@ -1,6 +1,6 @@
import type { ApiResponse } from "api/types";
-import type { ApplicationResponsePayload } from "ee/api/ApplicationApi";
import type { Datasource } from "entities/Datasource";
+import type { GitApplicationArtifact, GitPackageArtifact } from "git/types";
export interface GitImportRequestParams {
remoteUrl: string;
@@ -12,7 +12,8 @@ export interface GitImportRequestParams {
}
export interface GitImportResponseData {
- application: ApplicationResponsePayload;
+ application?: GitApplicationArtifact;
+ package?: GitPackageArtifact;
isPartialImport: boolean;
unConfiguredDatasourceList?: Datasource[];
}
diff --git a/app/client/src/git/sagas/gitImportSaga.ts b/app/client/src/git/sagas/gitImportSaga.ts
index e6b1bdfeb311..5f55c4772ebc 100644
--- a/app/client/src/git/sagas/gitImportSaga.ts
+++ b/app/client/src/git/sagas/gitImportSaga.ts
@@ -1,18 +1,11 @@
import { call, put, select } from "redux-saga/effects";
import { validateResponse } from "sagas/ErrorSagas";
-import history from "utils/history";
-import { toast } from "@appsmith/ads";
import type { PayloadAction } from "@reduxjs/toolkit";
import gitImportRequest from "git/requests/gitImportRequest";
import type { GitImportResponse } from "git/requests/gitImportRequest.types";
import type { GitImportInitPayload } from "git/store/actions/gitImportActions";
import { gitGlobalActions } from "git/store/gitGlobalSlice";
-import { createMessage, IMPORT_APP_SUCCESSFUL } from "ee/constants/messages";
-import { builderURL } from "ee/RouteBuilder";
import { getWorkspaceIdForImport } from "ee/selectors/applicationSelectors";
-import { showReconnectDatasourceModal } from "ee/actions/applicationActions";
-import type { Workspace } from "ee/constants/workspaceConstants";
-import { getFetchedWorkspaces } from "ee/selectors/workspaceSelectors";
import { GitErrorCodes } from "git/constants/enums";
import { selectGitApiContractsEnabled } from "git/store/selectors/gitFeatureFlagSelectors";
import handleApiErrors from "./helpers/handleApiErrors";
@@ -39,52 +32,10 @@ export default function* gitImportSaga(
const isValidResponse: boolean = yield validateResponse(response);
if (response && isValidResponse) {
- const allWorkspaces: Workspace[] = yield select(getFetchedWorkspaces);
- const currentWorkspace = allWorkspaces.filter(
- (el: Workspace) => el.id === workspaceId,
+ yield put(
+ gitGlobalActions.gitImportSuccess({ responseData: response.data }),
);
-
- if (currentWorkspace.length > 0) {
- const { application, isPartialImport, unConfiguredDatasourceList } =
- response.data;
-
- yield put(gitGlobalActions.gitImportSuccess());
- yield put(gitGlobalActions.toggleImportModal({ open: false }));
-
- // there is configuration-missing datasources
- if (isPartialImport) {
- yield put(
- showReconnectDatasourceModal({
- application: application,
- unConfiguredDatasourceList: unConfiguredDatasourceList ?? [],
- workspaceId,
- }),
- );
- } else {
- let basePageId = "";
-
- if (application.pages && application.pages.length > 0) {
- const defaultPage = application.pages.find(
- (eachPage) => !!eachPage.isDefault,
- );
-
- basePageId = defaultPage ? defaultPage.baseId : "";
- }
-
- const branch =
- response.data?.application?.gitApplicationMetadata?.branchName;
-
- const pageURL = builderURL({
- basePageId,
- branch,
- });
-
- history.push(pageURL);
- toast.show(createMessage(IMPORT_APP_SUCCESSFUL), {
- kind: "success",
- });
- }
- }
+ yield put(gitGlobalActions.toggleImportModal({ open: false }));
}
} catch (e) {
const error = handleApiErrors(e as Error, response);
diff --git a/app/client/src/git/store/actions/gitImportActions.ts b/app/client/src/git/store/actions/gitImportActions.ts
index 30e9c7417b2d..a823ca7b6d4b 100644
--- a/app/client/src/git/store/actions/gitImportActions.ts
+++ b/app/client/src/git/store/actions/gitImportActions.ts
@@ -1,12 +1,19 @@
import type { PayloadAction } from "@reduxjs/toolkit";
-import type { GitAsyncErrorPayload, GitGlobalReduxState } from "../types";
-import type { GitImportRequestParams } from "git/requests/gitImportRequest.types";
+import type {
+ GitAsyncErrorPayload,
+ GitAsyncSuccessPayload,
+ GitGlobalReduxState,
+} from "../types";
+import type {
+ GitImportRequestParams,
+ GitImportResponseData,
+} from "git/requests/gitImportRequest.types";
export interface GitImportInitPayload extends GitImportRequestParams {}
export const gitImportInitAction = (
state: GitGlobalReduxState,
- // need type for better import
+ // need this here to preserve interface
// eslint-disable-next-line @typescript-eslint/no-unused-vars
action: PayloadAction<GitImportInitPayload>,
) => {
@@ -16,7 +23,15 @@ export const gitImportInitAction = (
return state;
};
-export const gitImportSuccessAction = (state: GitGlobalReduxState) => {
+export type GitImportSuccessPayload =
+ GitAsyncSuccessPayload<GitImportResponseData>;
+
+export const gitImportSuccessAction = (
+ state: GitGlobalReduxState,
+ // need this here to preserve interface
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ action: PayloadAction<GitImportSuccessPayload>,
+) => {
state.gitImport.loading = false;
return state;
diff --git a/app/client/src/git/store/index.ts b/app/client/src/git/store/index.ts
index 3e298092e32f..990e50a361af 100644
--- a/app/client/src/git/store/index.ts
+++ b/app/client/src/git/store/index.ts
@@ -17,3 +17,4 @@ export const gitDiscardSuccess = gitArtifactActions.discardSuccess;
export const gitCheckoutBranchSuccess =
gitArtifactActions.checkoutBranchSuccess;
export const gitPullSuccess = gitArtifactActions.pullSuccess;
+export const gitImportSuccess = gitGlobalActions.gitImportSuccess;
|
6e2606586511fc39d5a0ee5d00c1b5b1c44bbbcf
|
2022-04-03 22:11:59
|
rashmi rai
|
fix: fetchOptionsCondtionally (#12347)
| false
|
fetchOptionsCondtionally (#12347)
|
fix
|
diff --git a/app/client/src/utils/FormControlRegistry.tsx b/app/client/src/utils/FormControlRegistry.tsx
index 173a7d7b4ded..d4fd124293ef 100644
--- a/app/client/src/utils/FormControlRegistry.tsx
+++ b/app/client/src/utils/FormControlRegistry.tsx
@@ -151,7 +151,7 @@ class FormControlRegistry {
buildPropertyControl(controlProps: DropDownControlProps): JSX.Element {
return (
<DropDownControl
- fetchOptionsCondtionally
+ fetchOptionsCondtionally={controlProps?.fetchOptionsCondtionally}
isMultiSelect
isSearchable
{...controlProps}
|
0bbb8008b044fbaefd2941a7e5e5a9381be9b7a1
|
2023-06-16 19:01:00
|
Nilesh Sarupriya
|
fix: move instance-name to tenant config; move update tenant config flow to CE (#24468)
| false
|
move instance-name to tenant config; move update tenant config flow to CE (#24468)
|
fix
|
diff --git a/app/client/cypress/e2e/Regression/ClientSide/AdminSettings/Admin_settings_spec.js b/app/client/cypress/e2e/Regression/ClientSide/AdminSettings/Admin_settings_spec.js
index ff501e65747d..4902ed117efd 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/AdminSettings/Admin_settings_spec.js
+++ b/app/client/cypress/e2e/Regression/ClientSide/AdminSettings/Admin_settings_spec.js
@@ -14,6 +14,9 @@ describe("Admin settings page", function () {
cy.intercept("PUT", "/api/v1/admin/env", {
body: { responseMeta: { status: 200, success: true }, data: {} },
}).as("postEnvVariables");
+ cy.intercept("PUT", "/api/v1/tenants", {
+ body: { responseMeta: { status: 200, success: true }, data: {} },
+ }).as("postTenantConfig");
});
it("1. Should test that settings page is accessible to super user", () => {
@@ -196,17 +199,10 @@ describe("Admin settings page", function () {
});
cy.get(adminsSettings.saveButton).should("be.visible");
cy.get(adminsSettings.saveButton).should("not.be.disabled");
- cy.intercept("POST", "/api/v1/admin/restart", {
- body: { responseMeta: { status: 200, success: true }, data: true },
- });
cy.get(adminsSettings.saveButton).click();
- cy.wait("@postEnvVariables").then((interception) => {
- expect(interception.request.body.APPSMITH_INSTANCE_NAME).to.equal(
- instanceName,
- );
+ cy.wait("@postTenantConfig").then((interception) => {
+ expect(interception.request.body.instanceName).to.equal(instanceName);
});
- cy.get(adminsSettings.restartNotice).should("be.visible");
- cy.wait(3000);
cy.get(adminsSettings.restartNotice).should("not.exist");
cy.wait(3000);
});
@@ -235,10 +231,10 @@ describe("Admin settings page", function () {
body: { responseMeta: { status: 200, success: true }, data: true },
});
cy.get(adminsSettings.saveButton).click();
+ cy.wait("@postTenantConfig").then((interception) => {
+ expect(interception.request.body.instanceName).to.equal(instanceName);
+ });
cy.wait("@postEnvVariables").then((interception) => {
- expect(interception.request.body.APPSMITH_INSTANCE_NAME).to.equal(
- instanceName,
- );
expect(interception.request.body.APPSMITH_MAIL_FROM).to.equal(
`${fromAddress}@appsmith.com`,
);
diff --git a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Admin_settings_spec.js b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Admin_settings_spec.js
index 74cebd3eaee6..740c8357acf3 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Admin_settings_spec.js
+++ b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Admin_settings_spec.js
@@ -29,6 +29,9 @@ describe("Admin settings page", function () {
cy.intercept("PUT", "/api/v1/admin/env", {
body: { responseMeta: { status: 200, success: true }, data: {} },
}).as("postEnvVariables");
+ cy.intercept("PUT", "/api/v1/tenants", {
+ body: { responseMeta: { status: 200, success: true }, data: {} },
+ }).as("postTenantConfig");
});
it("1. should test that settings page is accessible to super user", () => {
@@ -139,17 +142,10 @@ describe("Admin settings page", function () {
});
cy.get(adminsSettings.saveButton).should("be.visible");
cy.get(adminsSettings.saveButton).should("not.be.disabled");
- cy.intercept("POST", "/api/v1/admin/restart", {
- body: { responseMeta: { status: 200, success: true }, data: true },
- });
cy.get(adminsSettings.saveButton).click();
- cy.wait("@postEnvVariables").then((interception) => {
- expect(interception.request.body.APPSMITH_INSTANCE_NAME).to.equal(
- instanceName,
- );
+ cy.wait("@postTenantConfig").then((interception) => {
+ expect(interception.request.body.instanceName).to.equal(instanceName);
});
- cy.get(adminsSettings.restartNotice).should("be.visible");
- cy.wait(3000);
cy.get(adminsSettings.restartNotice).should("not.exist");
cy.wait(3000);
});
@@ -178,10 +174,10 @@ describe("Admin settings page", function () {
body: { responseMeta: { status: 200, success: true }, data: true },
});
cy.get(adminsSettings.saveButton).click();
+ cy.wait("@postTenantConfig").then((interception) => {
+ expect(interception.request.body.instanceName).to.equal(instanceName);
+ });
cy.wait("@postEnvVariables").then((interception) => {
- expect(interception.request.body.APPSMITH_INSTANCE_NAME).to.equal(
- instanceName,
- );
expect(interception.request.body.APPSMITH_MAIL_FROM).to.equal(
`${fromAddress}@appsmith.com`,
);
diff --git a/app/client/cypress/e2e/Regression/Enterprise/AdminSettings/Admin_settings_spec.js b/app/client/cypress/e2e/Regression/Enterprise/AdminSettings/Admin_settings_spec.js
index a71fc0a12d55..b4add7163a90 100644
--- a/app/client/cypress/e2e/Regression/Enterprise/AdminSettings/Admin_settings_spec.js
+++ b/app/client/cypress/e2e/Regression/Enterprise/AdminSettings/Admin_settings_spec.js
@@ -17,6 +17,9 @@ describe("Admin settings page", function () {
cy.intercept("PUT", "/api/v1/admin/env", {
body: { responseMeta: { status: 200, success: true }, data: {} },
}).as("postEnvVariables");
+ cy.intercept("PUT", "/api/v1/tenants", {
+ body: { responseMeta: { status: 200, success: true }, data: {} },
+ }).as("postTenantConfig");
});
it("1. should test that settings page is redirected to default tab", () => {
diff --git a/app/client/cypress/locators/AdminsSettings.js b/app/client/cypress/locators/AdminsSettings.js
index 768225e7f3af..7012070ab55f 100644
--- a/app/client/cypress/locators/AdminsSettings.js
+++ b/app/client/cypress/locators/AdminsSettings.js
@@ -14,7 +14,7 @@ export default {
saveButton: ".t--admin-settings-save-button",
resetButton: ".t--admin-settings-reset-button",
textInput: ".t--admin-settings-text-input input",
- instanceName: ".t--admin-settings-APPSMITH_INSTANCE_NAME input",
+ instanceName: ".t--admin-settings-instanceName input",
adminEmails: ".t--admin-settings-APPSMITH_ADMIN_EMAILS input",
fromAddress: ".t--admin-settings-APPSMITH_MAIL_FROM input",
restartNotice: ".t--admin-settings-restart-notice",
diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js
index 76781294b3a0..dba3c112f538 100644
--- a/app/client/cypress/support/commands.js
+++ b/app/client/cypress/support/commands.js
@@ -1120,6 +1120,9 @@ Cypress.Commands.add("startServerAndRoutes", () => {
cy.intercept("GET", "/settings/general").as("getGeneral");
cy.intercept("GET", "/api/v1/tenants/current").as("signUpLogin");
+ cy.intercept("PUT", "/api/v1/tenants", (req) => {
+ req.headers["origin"] = "Cypress";
+ }).as("postTenant");
});
Cypress.Commands.add("startErrorRoutes", () => {
diff --git a/app/client/src/ce/api/TenantApi.ts b/app/client/src/ce/api/TenantApi.ts
index cfaabaf0d12b..4b83aae03e46 100644
--- a/app/client/src/ce/api/TenantApi.ts
+++ b/app/client/src/ce/api/TenantApi.ts
@@ -27,10 +27,7 @@ export class TenantApi extends Api {
static updateTenantConfig(
request: UpdateTenantConfigRequest,
): AxiosPromise<UpdateTenantConfigResponse> {
- return Api.put(
- `${TenantApi.tenantsUrl}/updateDefaultTenantConfiguration`,
- request.tenantConfiguration,
- );
+ return Api.put(`${TenantApi.tenantsUrl}`, request.tenantConfiguration);
}
}
diff --git a/app/client/src/ce/constants/tenantConstants.ts b/app/client/src/ce/constants/tenantConstants.ts
index da4a9641bbc8..cd318ef0662e 100644
--- a/app/client/src/ce/constants/tenantConstants.ts
+++ b/app/client/src/ce/constants/tenantConstants.ts
@@ -1,4 +1,4 @@
-export const tenantConfigConnection: string[] = [];
+export const tenantConfigConnection: string[] = ["instanceName"];
export const RESTART_POLL_TIMEOUT = 2 * 60 * 1000;
export const RESTART_POLL_INTERVAL = 2000;
diff --git a/app/client/src/ce/pages/AdminSettings/config/authentication/AuthPage.tsx b/app/client/src/ce/pages/AdminSettings/config/authentication/AuthPage.tsx
index afeafbbf4ab2..2a886ee2b685 100644
--- a/app/client/src/ce/pages/AdminSettings/config/authentication/AuthPage.tsx
+++ b/app/client/src/ce/pages/AdminSettings/config/authentication/AuthPage.tsx
@@ -9,7 +9,6 @@ import {
createMessage,
EDIT,
UPGRADE,
- UPGRADE_TO_EE,
AUTHENTICATION_METHOD_ENABLED,
BUSINESS_TAG,
} from "@appsmith/constants/messages";
@@ -115,7 +114,6 @@ export function ActionButton({ method }: { method: AuthMethodType }) {
const { onUpgrade } = useOnUpgrade({
logEventName: "ADMIN_SETTINGS_UPGRADE_AUTH_METHOD",
logEventData: { method: method.label },
- intercomMessage: createMessage(UPGRADE_TO_EE, method.label),
});
const onClickHandler = (method: AuthMethodType) => {
diff --git a/app/client/src/ce/pages/AdminSettings/config/branding/UpgradeBanner.tsx b/app/client/src/ce/pages/AdminSettings/config/branding/UpgradeBanner.tsx
index 90a16073dddb..04f6241fa7cc 100644
--- a/app/client/src/ce/pages/AdminSettings/config/branding/UpgradeBanner.tsx
+++ b/app/client/src/ce/pages/AdminSettings/config/branding/UpgradeBanner.tsx
@@ -4,7 +4,6 @@ import { ContentBox } from "pages/Settings/components";
import {
ADMIN_BRANDING_SETTINGS_SUBTITLE,
ADMIN_BRANDING_SETTINGS_TITLE,
- ADMIN_BRANDING_UPGRADE_INTERCOM_MESSAGE,
BUSINESS_TAG,
createMessage,
} from "@appsmith/constants/messages";
@@ -22,7 +21,6 @@ const StyledSettingsSubHeader = styled(SettingsSubHeader)`
const UpgradeBanner = () => {
const { onUpgrade } = useOnUpgrade({
logEventName: "BRANDING_UPGRADE_CLICK",
- intercomMessage: createMessage(ADMIN_BRANDING_UPGRADE_INTERCOM_MESSAGE),
});
return (
diff --git a/app/client/src/ce/pages/AdminSettings/config/general.tsx b/app/client/src/ce/pages/AdminSettings/config/general.tsx
index 1764f232a587..5a1cebc4e5a9 100644
--- a/app/client/src/ce/pages/AdminSettings/config/general.tsx
+++ b/app/client/src/ce/pages/AdminSettings/config/general.tsx
@@ -17,7 +17,7 @@ import localStorage from "utils/localStorage";
import isUndefined from "lodash/isUndefined";
export const APPSMITH_INSTANCE_NAME_SETTING_SETTING: Setting = {
- id: "APPSMITH_INSTANCE_NAME",
+ id: "instanceName",
category: SettingCategories.GENERAL,
controlType: SettingTypes.TEXTINPUT,
controlSubType: SettingSubtype.TEXT,
@@ -80,9 +80,6 @@ export const APPSMITH_HIDE_WATERMARK_SETTING: Setting = {
needsUpgrade: true,
isDisabled: () => true,
textSuffix: <BrandingBadge />,
- upgradeLogEventName: "ADMIN_SETTINGS_UPGRADE_WATERMARK",
- upgradeIntercomMessage:
- "Hello, I would like to upgrade and remove the watermark.",
};
export enum AppsmithFrameAncestorsSetting {
diff --git a/app/client/src/ce/pages/AdminSettings/config/types.ts b/app/client/src/ce/pages/AdminSettings/config/types.ts
index b8a32ef3f288..75375c09b05b 100644
--- a/app/client/src/ce/pages/AdminSettings/config/types.ts
+++ b/app/client/src/ce/pages/AdminSettings/config/types.ts
@@ -1,7 +1,6 @@
import type React from "react";
import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
import type { Dispatch } from "react";
-import type { EventName } from "utils/AnalyticsUtil";
import type { RadioOptionProps } from "pages/Settings/FormGroup/Radio";
import type { CalloutKind, SelectOptionProps } from "design-system";
@@ -84,8 +83,6 @@ export type Setting = ControlType & {
fieldName?: string;
dropdownOptions?: Partial<SelectOptionProps>[];
needsUpgrade?: boolean;
- upgradeLogEventName?: EventName;
- upgradeIntercomMessage?: string;
tooltip?: string;
};
diff --git a/app/client/src/ce/pages/Upgrade/AccessControlUpgradePage.tsx b/app/client/src/ce/pages/Upgrade/AccessControlUpgradePage.tsx
index 8e750ab5011c..6c8d910b918d 100644
--- a/app/client/src/ce/pages/Upgrade/AccessControlUpgradePage.tsx
+++ b/app/client/src/ce/pages/Upgrade/AccessControlUpgradePage.tsx
@@ -16,7 +16,6 @@ import {
RESTRICT_PUBLIC_EXPOSURE_DETAIL1,
SECURITY_APPS_LEAST_PRIVILEGE,
SECURITY_APPS_LEAST_PRIVILEGE_DETAIL1,
- UPGRADE_TO_EE_FEATURE,
} from "@appsmith/constants/messages";
import useOnUpgrade from "utils/hooks/useOnUpgrade";
@@ -24,10 +23,6 @@ export function AccessControlUpgradePage() {
const { onUpgrade } = useOnUpgrade({
logEventName: "GAC_UPGRADE_CLICK_ADMIN_SETTINGS",
logEventData: { source: "Granular Access Control" },
- intercomMessage: createMessage(
- UPGRADE_TO_EE_FEATURE,
- "Granular Access Control for teams",
- ),
});
const header: Header = {
diff --git a/app/client/src/ce/pages/Upgrade/AuditLogsUpgradePage.tsx b/app/client/src/ce/pages/Upgrade/AuditLogsUpgradePage.tsx
index b65e7a0f78cf..a2c922d205d2 100644
--- a/app/client/src/ce/pages/Upgrade/AuditLogsUpgradePage.tsx
+++ b/app/client/src/ce/pages/Upgrade/AuditLogsUpgradePage.tsx
@@ -16,7 +16,6 @@ import {
SECURITY_AND_COMPLIANCE,
SECURITY_AND_COMPLIANCE_DETAIL1,
SECURITY_AND_COMPLIANCE_DETAIL2,
- UPGRADE_TO_EE_FEATURE,
} from "@appsmith/constants/messages";
import useOnUpgrade from "utils/hooks/useOnUpgrade";
@@ -24,7 +23,6 @@ export function AuditLogsUpgradePage() {
const { onUpgrade } = useOnUpgrade({
logEventName: "AUDIT_LOGS_UPGRADE_ADMIN_SETTINGS",
logEventData: { source: "AuditLogs" },
- intercomMessage: createMessage(UPGRADE_TO_EE_FEATURE, "Audit Logs"),
});
const header: Header = {
diff --git a/app/client/src/pages/Settings/FormGroup/Checkbox.tsx b/app/client/src/pages/Settings/FormGroup/Checkbox.tsx
index 4959e376d1b9..35afe0dba203 100644
--- a/app/client/src/pages/Settings/FormGroup/Checkbox.tsx
+++ b/app/client/src/pages/Settings/FormGroup/Checkbox.tsx
@@ -7,7 +7,6 @@ import type { FormTextFieldProps } from "components/utils/ReduxFormTextField";
import { Checkbox, Tag, Text } from "design-system";
import { useSelector } from "react-redux";
import { SETTINGS_FORM_NAME } from "@appsmith/constants/forms";
-import type { EventName } from "utils/AnalyticsUtil";
import { isTenantConfig } from "@appsmith/utils/adminSettingsHelpers";
import { BUSINESS_TAG, createMessage } from "@appsmith/constants/messages";
@@ -26,8 +25,6 @@ type CheckboxProps = {
needsUpgrade?: boolean;
text: string;
labelSuffix?: React.ReactElement;
- upgradeLogEventName?: EventName;
- upgradeIntercomMessage?: string;
isPropertyDisabled?: boolean;
};
@@ -100,8 +97,6 @@ export function CheckboxComponent({ setting }: SettingComponentProps) {
isDisabled: setting.isDisabled && setting.isDisabled(settings),
needsUpgrade: setting.needsUpgrade,
labelSuffix: setting.textSuffix,
- upgradeLogEventName: setting.upgradeLogEventName,
- upgradeIntercomMessage: setting.upgradeIntercomMessage,
isPropertyDisabled: isTenantConfig(setting.id)
? false
: !setting.name?.toLowerCase().includes("enable"),
diff --git a/app/client/src/utils/hooks/useOnUpgrade.ts b/app/client/src/utils/hooks/useOnUpgrade.ts
index 5707c144f145..f2656cd80bf7 100644
--- a/app/client/src/utils/hooks/useOnUpgrade.ts
+++ b/app/client/src/utils/hooks/useOnUpgrade.ts
@@ -6,7 +6,6 @@ import AnalyticsUtil from "utils/AnalyticsUtil";
import { getAppsmithConfigs } from "@appsmith/configs";
type Props = {
- intercomMessage?: string;
logEventName?: EventName;
logEventData?: any;
};
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java
index c91fa8c12626..7b4704a5a203 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java
@@ -33,9 +33,6 @@ public class CommonConfig {
private static final String ELASTIC_THREAD_POOL_NAME = "appsmith-elastic-pool";
public static final Integer LATEST_INSTANCE_SCHEMA_VERSION = 2;
- @Value("${appsmith.instance.name:}")
- private String instanceName;
-
@Setter(AccessLevel.NONE)
private boolean isSignupDisabled = false;
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Appsmith.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Appsmith.java
index ef04c8c4dfa0..1efb2c503279 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Appsmith.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Appsmith.java
@@ -5,4 +5,6 @@ public class Appsmith {
public final static String INSTANCE_SCHEMA_VERSION = "schemaVersion";
// We default the origin header to the production deployment of the client's URL
public static final String DEFAULT_ORIGIN_HEADER = "https://app.appsmith.com";
+ public static final String DEFAULT_INSTANCE_NAME = "Appsmith";
+
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/TenantControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/TenantControllerCE.java
index 1bf5c00352d4..ee752232da5d 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/TenantControllerCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/TenantControllerCE.java
@@ -3,11 +3,14 @@
import com.appsmith.external.views.Views;
import com.appsmith.server.constants.Url;
import com.appsmith.server.domains.Tenant;
+import com.appsmith.server.domains.TenantConfiguration;
import com.appsmith.server.dtos.ResponseDTO;
import com.appsmith.server.services.TenantService;
import com.fasterxml.jackson.annotation.JsonView;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import reactor.core.publisher.Mono;
@@ -38,4 +41,10 @@ public Mono<ResponseDTO<Tenant>> getTenantConfig() {
.map(resource -> new ResponseDTO<>(HttpStatus.OK.value(), resource, null));
}
+ @PutMapping("")
+ public Mono<ResponseDTO<Tenant>> updateTenantConfiguration(@RequestBody TenantConfiguration tenantConfiguration) {
+ return service.updateDefaultTenantConfiguration(tenantConfiguration)
+ .map(tenant -> new ResponseDTO<>(HttpStatus.OK.value(), tenant, null));
+ }
+
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/TenantConfigurationCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/TenantConfigurationCE.java
index 202e7554f548..acab0844a8b7 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/TenantConfigurationCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/TenantConfigurationCE.java
@@ -1,5 +1,6 @@
package com.appsmith.server.domains.ce;
+import com.appsmith.server.domains.TenantConfiguration;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -13,6 +14,8 @@ public class TenantConfigurationCE {
private Boolean isFormLoginEnabled;
+ private String instanceName;
+
// We add `JsonInclude` here, so that this field is included in the JSON response, even if it is `null`. Reason is,
// if this field is not present, then the existing value in client's state doesn't get updated. It's just the way
// the splat (`...`) operator works in the client. Evidently, we'll want this for all fields in this class.
@@ -28,4 +31,8 @@ public void addThirdPartyAuth(String auth) {
thirdPartyAuths.add(auth);
}
+ public void copyNonSensitiveValues(TenantConfiguration tenantConfiguration) {
+ this.instanceName = tenantConfiguration.getInstanceName();
+ }
+
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration003AddInstanceNameToTenantConfiguration.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration003AddInstanceNameToTenantConfiguration.java
new file mode 100644
index 000000000000..8054397aab56
--- /dev/null
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration003AddInstanceNameToTenantConfiguration.java
@@ -0,0 +1,52 @@
+package com.appsmith.server.migrations.db.ce;
+
+import com.appsmith.server.domains.QTenant;
+import com.appsmith.server.domains.Tenant;
+import com.appsmith.server.domains.TenantConfiguration;
+import io.mongock.api.annotations.ChangeUnit;
+import io.mongock.api.annotations.Execution;
+import io.mongock.api.annotations.RollbackExecution;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Query;
+
+import java.util.Objects;
+
+import static com.appsmith.server.constants.Appsmith.DEFAULT_INSTANCE_NAME;
+import static com.appsmith.server.constants.EnvVariables.APPSMITH_INSTANCE_NAME;
+import static com.appsmith.server.constants.FieldName.DEFAULT;
+import static com.appsmith.server.repositories.ce.BaseAppsmithRepositoryCEImpl.fieldName;
+import static org.springframework.data.mongodb.core.query.Criteria.where;
+
+@Slf4j
+@ChangeUnit(order = "003", id="add-instance-name-env-variable-tenant-configuration")
+public class Migration003AddInstanceNameToTenantConfiguration {
+ private final MongoTemplate mongoTemplate;
+
+ public Migration003AddInstanceNameToTenantConfiguration(MongoTemplate mongoTemplate) {
+ this.mongoTemplate = mongoTemplate;
+ }
+
+ @RollbackExecution
+ public void executionRollback() {
+ }
+
+ @Execution
+ public void addInstanceNameEnvVarToTenantConfiguration() {
+ Query tenantQuery = new Query();
+ tenantQuery.addCriteria(where(fieldName(QTenant.tenant.slug)).is(DEFAULT));
+ Tenant defaultTenant = mongoTemplate.findOne(tenantQuery, Tenant.class);
+
+ // Using default name as Appsmith here.
+ String instanceName = StringUtils.defaultIfEmpty(System.getenv(String.valueOf(APPSMITH_INSTANCE_NAME)), DEFAULT_INSTANCE_NAME);
+
+ TenantConfiguration defaultTenantConfiguration = new TenantConfiguration();
+ if (Objects.nonNull(defaultTenant.getTenantConfiguration())) {
+ defaultTenantConfiguration = defaultTenant.getTenantConfiguration();
+ }
+ defaultTenantConfiguration.setInstanceName(instanceName);
+ defaultTenant.setTenantConfiguration(defaultTenantConfiguration);
+ mongoTemplate.save(defaultTenant);
+ }
+}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/TenantServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/TenantServiceCE.java
index 41573a85746d..25b869ae7694 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/TenantServiceCE.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/TenantServiceCE.java
@@ -19,4 +19,8 @@ public interface TenantServiceCE extends CrudService<Tenant, String> {
* start saving other pertinent environment variables in the tenant collection
*/
Mono<Tenant> getTenantConfiguration();
+
+ Mono<Tenant> getDefaultTenant();
+
+ Mono<Tenant> updateDefaultTenantConfiguration(TenantConfiguration tenantConfiguration);
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/TenantServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/TenantServiceCEImpl.java
index 82e1e832603a..caadd756e7a3 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/TenantServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/TenantServiceCEImpl.java
@@ -80,7 +80,8 @@ public Mono<Tenant> findById(String tenantId, AclPermission permission) {
*/
@Override
public Mono<Tenant> getTenantConfiguration() {
- return configService.getInstanceId()
+ Mono<Tenant> dbTenantMono = getDefaultTenant();
+ Mono<Tenant> clientTenantMono = configService.getInstanceId()
.map(instanceId -> {
final Tenant tenant = new Tenant();
tenant.setInstanceId(instanceId);
@@ -102,6 +103,51 @@ public Mono<Tenant> getTenantConfiguration() {
return tenant;
});
+
+ return Mono.zip(dbTenantMono, clientTenantMono)
+ .map(tuple -> {
+ Tenant dbTenant = tuple.getT1();
+ Tenant clientTenant = tuple.getT2();
+ return getClientPertinentTenant(dbTenant, clientTenant);
+ });
+ }
+
+ @Override
+ public Mono<Tenant> getDefaultTenant() {
+ // Get the default tenant object from the DB and then populate the relevant user permissions in that
+ // We are doing this differently because `findBySlug` is a Mongo JPA query and not a custom Appsmith query
+ return repository.findBySlug(FieldName.DEFAULT)
+ .flatMap(tenant -> repository.setUserPermissionsInObject(tenant)
+ .switchIfEmpty(Mono.just(tenant)));
+ }
+
+ @Override
+ public Mono<Tenant> updateDefaultTenantConfiguration(TenantConfiguration tenantConfiguration) {
+ return getDefaultTenantId()
+ .flatMap(tenantId -> updateTenantConfiguration(tenantId, tenantConfiguration));
+ }
+
+ /**
+ * To get the Tenant with values that are pertinent to the client
+ * @param dbTenant Original tenant from the database
+ * @param clientTenant Tenant object that is sent to the client, can be null
+ * @return Tenant
+ */
+ protected Tenant getClientPertinentTenant(Tenant dbTenant, Tenant clientTenant) {
+ TenantConfiguration tenantConfiguration;
+ if (clientTenant == null) {
+ clientTenant = new Tenant();
+ tenantConfiguration = new TenantConfiguration();
+ } else {
+ tenantConfiguration = clientTenant.getTenantConfiguration();
+ }
+
+ // Only copy the values that are pertinent to the client
+ tenantConfiguration.copyNonSensitiveValues(dbTenant.getTenantConfiguration());
+ clientTenant.setTenantConfiguration(tenantConfiguration);
+ clientTenant.setUserPermissions(dbTenant.getUserPermissions());
+
+ return clientTenant;
}
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/EnvManagerCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/EnvManagerCEImpl.java
index fe1ce55f9e92..8a1f1db547c5 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/EnvManagerCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/EnvManagerCEImpl.java
@@ -75,7 +75,6 @@
import static com.appsmith.server.constants.EnvVariables.APPSMITH_ADMIN_EMAILS;
import static com.appsmith.server.constants.EnvVariables.APPSMITH_DISABLE_TELEMETRY;
-import static com.appsmith.server.constants.EnvVariables.APPSMITH_INSTANCE_NAME;
import static com.appsmith.server.constants.EnvVariables.APPSMITH_MAIL_ENABLED;
import static com.appsmith.server.constants.EnvVariables.APPSMITH_MAIL_FROM;
import static com.appsmith.server.constants.EnvVariables.APPSMITH_MAIL_HOST;
@@ -391,10 +390,6 @@ public Mono<EnvChangesResponseDTO> applyChanges(Map<String, String> changes) {
// Try and update any at runtime, that can be.
final Map<String, String> changesCopy = new HashMap<>(changes);
- if (changesCopy.containsKey(APPSMITH_INSTANCE_NAME.name())) {
- commonConfig.setInstanceName(changesCopy.remove(APPSMITH_INSTANCE_NAME.name()));
- }
-
if (changesCopy.containsKey(APPSMITH_SIGNUP_DISABLED.name())) {
commonConfig.setSignupDisabled(changesCopy.remove(APPSMITH_SIGNUP_DISABLED.name()));
}
@@ -629,11 +624,6 @@ public Mono<Map<String, String>> getAll() {
// set the default values to response
Map<String, String> envKeyValueMap = parseToMap(originalContent);
- if (!envKeyValueMap.containsKey(APPSMITH_INSTANCE_NAME.name())) {
- // no APPSMITH_INSTANCE_NAME set in env file, set the default value
- envKeyValueMap.put(APPSMITH_INSTANCE_NAME.name(), commonConfig.getInstanceName());
- }
-
return Mono.justOrEmpty(envKeyValueMap);
});
}
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserSignupCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserSignupCEImpl.java
index 98402a6d8b91..4b1453218ca8 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserSignupCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserSignupCEImpl.java
@@ -53,7 +53,6 @@
import static com.appsmith.server.constants.Appsmith.DEFAULT_ORIGIN_HEADER;
import static com.appsmith.server.constants.EnvVariables.APPSMITH_ADMIN_EMAILS;
import static com.appsmith.server.constants.EnvVariables.APPSMITH_DISABLE_TELEMETRY;
-import static com.appsmith.server.constants.EnvVariables.APPSMITH_INSTANCE_NAME;
import static com.appsmith.server.constants.ce.FieldNameCE.EMAIL;
import static com.appsmith.server.constants.ce.FieldNameCE.NAME;
import static com.appsmith.server.constants.ce.FieldNameCE.ROLE;
@@ -275,8 +274,6 @@ public Mono<User> signupAndLoginSuper(UserSignupRequestDTO userFromRequest, Serv
Mono<EnvChangesResponseDTO> applyEnvManagerChangesMono = envManager.applyChanges(Map.of(
APPSMITH_DISABLE_TELEMETRY.name(),
String.valueOf(!userFromRequest.isAllowCollectingAnonymousData()),
- APPSMITH_INSTANCE_NAME.name(),
- commonConfig.getInstanceName(),
APPSMITH_ADMIN_EMAILS.name(),
user.getEmail()
))
diff --git a/app/server/appsmith-server/src/main/resources/application.properties b/app/server/appsmith-server/src/main/resources/application.properties
index 0cdab53fb414..881c983d853c 100644
--- a/app/server/appsmith-server/src/main/resources/application.properties
+++ b/app/server/appsmith-server/src/main/resources/application.properties
@@ -108,8 +108,5 @@ appsmith.plugin.response.size.max=${APPSMITH_PLUGIN_MAX_RESPONSE_SIZE_MB:5}
# Location env file with environment variables, that can be configured from the UI.
appsmith.admin.envfile=${APPSMITH_ENVFILE_PATH:/appsmith-stacks/configuration/docker.env}
-# Name of this instance
-appsmith.instance.name=${APPSMITH_INSTANCE_NAME:Appsmith}
-
# RTS port
appsmith.rts.port=${APPSMITH_RTS_PORT:8091}
|
7dbe9ccf2667cca4dd97ffcb93cbf2f050769493
|
2022-05-04 12:53:48
|
ashit-rath
|
fix: JSONForm placed in modal does not update default value from source data (#13453)
| false
|
JSONForm placed in modal does not update default value from source data (#13453)
|
fix
|
diff --git a/app/client/cypress/fixtures/jsonFormInModalDsl.json b/app/client/cypress/fixtures/jsonFormInModalDsl.json
new file mode 100644
index 000000000000..6288cab1b686
--- /dev/null
+++ b/app/client/cypress/fixtures/jsonFormInModalDsl.json
@@ -0,0 +1,508 @@
+{
+ "dsl": {
+ "widgetName": "MainContainer",
+ "backgroundColor": "none",
+ "rightColumn": 4896,
+ "snapColumns": 64,
+ "detachFromLayout": true,
+ "widgetId": "0",
+ "topRow": 0,
+ "bottomRow": 1290,
+ "containerStyle": "none",
+ "snapRows": 125,
+ "parentRowSpace": 1,
+ "type": "CANVAS_WIDGET",
+ "canExtend": true,
+ "version": 57,
+ "minHeight": 1292,
+ "parentColumnSpace": 1,
+ "dynamicBindingPathList": [],
+ "leftColumn": 0,
+ "children": [
+ {
+ "widgetName": "Modal1",
+ "isCanvas": true,
+ "displayName": "Modal",
+ "iconSVG": "/static/media/icon.4975978e.svg",
+ "topRow": 26,
+ "bottomRow": 50,
+ "parentRowSpace": 10,
+ "type": "MODAL_WIDGET",
+ "hideCard": false,
+ "shouldScrollContents": true,
+ "animateLoading": true,
+ "parentColumnSpace": 20.796875,
+ "leftColumn": 19,
+ "children": [
+ {
+ "widgetName": "Canvas1",
+ "rightColumn": 499.125,
+ "detachFromLayout": true,
+ "displayName": "Canvas",
+ "widgetId": "elonff8ppg",
+ "topRow": 0,
+ "bottomRow": 840,
+ "parentRowSpace": 1,
+ "isVisible": true,
+ "type": "CANVAS_WIDGET",
+ "canExtend": true,
+ "version": 1,
+ "hideCard": true,
+ "parentId": "wvl7cnbcsx",
+ "shouldScrollContents": false,
+ "minHeight": 846,
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "parentColumnSpace": 1,
+ "leftColumn": 0,
+ "children": [
+ {
+ "boxShadow": "NONE",
+ "widgetName": "IconButton1",
+ "onClick": "{{closeModal('Modal1')}}",
+ "buttonColor": "#2E3D49",
+ "displayName": "Icon Button",
+ "iconSVG": "/static/media/icon.1a0c634a.svg",
+ "topRow": 1,
+ "bottomRow": 5,
+ "type": "ICON_BUTTON_WIDGET",
+ "hideCard": false,
+ "animateLoading": true,
+ "leftColumn": 56,
+ "iconSize": 24,
+ "isDisabled": false,
+ "key": "bfqu52408k",
+ "rightColumn": 64,
+ "iconName": "cross",
+ "widgetId": "tojyty4uqs",
+ "isVisible": true,
+ "version": 1,
+ "parentId": "elonff8ppg",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "borderRadius": "SHARP",
+ "buttonVariant": "TERTIARY"
+ },
+ {
+ "widgetName": "Text2",
+ "displayName": "Text",
+ "iconSVG": "/static/media/icon.97c59b52.svg",
+ "topRow": 1,
+ "bottomRow": 5,
+ "type": "TEXT_WIDGET",
+ "hideCard": false,
+ "animateLoading": true,
+ "overflow": "NONE",
+ "leftColumn": 1,
+ "shouldTruncate": false,
+ "truncateButtonColor": "#FFC13D",
+ "text": "Modal Title",
+ "key": "kl9cwzi6b1",
+ "rightColumn": 41,
+ "textAlign": "LEFT",
+ "widgetId": "7qjeufltuc",
+ "isVisible": true,
+ "fontStyle": "BOLD",
+ "textColor": "#231F20",
+ "version": 1,
+ "parentId": "elonff8ppg",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "fontSize": "HEADING1"
+ },
+ {
+ "widgetName": "Button1",
+ "onClick": "{{closeModal('Modal1')}}",
+ "buttonColor": "#03B365",
+ "displayName": "Button",
+ "iconSVG": "/static/media/icon.cca02633.svg",
+ "topRow": 74,
+ "bottomRow": 78,
+ "type": "BUTTON_WIDGET",
+ "hideCard": false,
+ "animateLoading": true,
+ "leftColumn": 37,
+ "text": "Close",
+ "isDisabled": false,
+ "key": "r8bpa6wnda",
+ "rightColumn": 49,
+ "isDefaultClickDisabled": true,
+ "widgetId": "gmj9emgskp",
+ "buttonStyle": "PRIMARY",
+ "isVisible": true,
+ "recaptchaType": "V3",
+ "version": 1,
+ "parentId": "elonff8ppg",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "buttonVariant": "SECONDARY",
+ "placement": "CENTER"
+ },
+ {
+ "widgetName": "Button2",
+ "buttonColor": "#03B365",
+ "displayName": "Button",
+ "iconSVG": "/static/media/icon.cca02633.svg",
+ "topRow": 74,
+ "bottomRow": 78,
+ "type": "BUTTON_WIDGET",
+ "hideCard": false,
+ "animateLoading": true,
+ "leftColumn": 49,
+ "text": "Confirm",
+ "isDisabled": false,
+ "key": "r8bpa6wnda",
+ "rightColumn": 61,
+ "isDefaultClickDisabled": true,
+ "widgetId": "wg5svs8aa5",
+ "buttonStyle": "PRIMARY_BUTTON",
+ "isVisible": true,
+ "recaptchaType": "V3",
+ "version": 1,
+ "parentId": "elonff8ppg",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "buttonVariant": "PRIMARY",
+ "placement": "CENTER"
+ },
+ {
+ "schema": {
+ "__root_schema__": {
+ "children": {
+ "step": {
+ "children": {},
+ "dataType": "string",
+ "defaultValue": "{{((sourceData, formData, fieldState) => (sourceData.step))(JSONForm2.sourceData, JSONForm2.formData, JSONForm2.fieldState)}}",
+ "fieldType": "Text Input",
+ "sourceData": "#1",
+ "isCustomField": false,
+ "accessor": "step",
+ "identifier": "step",
+ "position": 0,
+ "originalIdentifier": "step",
+ "iconAlign": "left",
+ "isDisabled": false,
+ "isRequired": false,
+ "isSpellCheck": false,
+ "isVisible": true,
+ "label": "Step"
+ },
+ "task": {
+ "children": {},
+ "dataType": "string",
+ "defaultValue": "{{((sourceData, formData, fieldState) => (sourceData.task))(JSONForm2.sourceData, JSONForm2.formData, JSONForm2.fieldState)}}",
+ "fieldType": "Text Input",
+ "sourceData": "Drop a table",
+ "isCustomField": false,
+ "accessor": "task",
+ "identifier": "task",
+ "position": 1,
+ "originalIdentifier": "task",
+ "iconAlign": "left",
+ "isDisabled": false,
+ "isRequired": false,
+ "isSpellCheck": false,
+ "isVisible": true,
+ "label": "Task"
+ },
+ "status": {
+ "children": {},
+ "dataType": "string",
+ "defaultValue": "{{((sourceData, formData, fieldState) => (sourceData.status))(JSONForm2.sourceData, JSONForm2.formData, JSONForm2.fieldState)}}",
+ "fieldType": "Text Input",
+ "sourceData": "Done",
+ "isCustomField": false,
+ "accessor": "status",
+ "identifier": "status",
+ "position": 2,
+ "originalIdentifier": "status",
+ "iconAlign": "left",
+ "isDisabled": false,
+ "isRequired": false,
+ "isSpellCheck": false,
+ "isVisible": true,
+ "label": "Status"
+ },
+ "action": {
+ "children": {},
+ "dataType": "string",
+ "defaultValue": "{{((sourceData, formData, fieldState) => (sourceData.action))(JSONForm2.sourceData, JSONForm2.formData, JSONForm2.fieldState)}}",
+ "fieldType": "Text Input",
+ "sourceData": "",
+ "isCustomField": false,
+ "accessor": "action",
+ "identifier": "action",
+ "position": 3,
+ "originalIdentifier": "action",
+ "iconAlign": "left",
+ "isDisabled": false,
+ "isRequired": false,
+ "isSpellCheck": false,
+ "isVisible": true,
+ "label": "Action"
+ }
+ },
+ "dataType": "object",
+ "defaultValue": "{{((sourceData, formData, fieldState) => (sourceData))(JSONForm2.sourceData, JSONForm2.formData, JSONForm2.fieldState)}}",
+ "fieldType": "Object",
+ "sourceData": {
+ "step": "#1",
+ "task": "Drop a table",
+ "status": "Done",
+ "action": ""
+ },
+ "isCustomField": false,
+ "accessor": "__root_schema__",
+ "identifier": "__root_schema__",
+ "position": -1,
+ "originalIdentifier": "__root_schema__",
+ "isDisabled": false,
+ "isRequired": false,
+ "isVisible": true,
+ "label": ""
+ }
+ },
+ "widgetName": "JSONForm2",
+ "submitButtonStyles": {
+ "buttonColor": "#03B365",
+ "buttonVariant": "PRIMARY"
+ },
+ "dynamicPropertyPathList": [
+ {
+ "key": "schema.__root_schema__.children.date_of_birth.defaultValue"
+ },
+ {
+ "key": "schema.__root_schema__.children.dob.defaultValue"
+ },
+ {
+ "key": "schema.__root_schema__.children.migrant.defaultValue"
+ }
+ ],
+ "displayName": "JSON Form",
+ "iconSVG": "/static/media/icon.5b428de1.svg",
+ "topRow": 5,
+ "bottomRow": 67,
+ "fieldLimitExceeded": false,
+ "parentRowSpace": 10,
+ "title": "Form",
+ "type": "JSON_FORM_WIDGET",
+ "hideCard": false,
+ "animateLoading": true,
+ "parentColumnSpace": 18.15625,
+ "dynamicTriggerPathList": [],
+ "leftColumn": 8,
+ "dynamicBindingPathList": [
+ {
+ "key": "schema.__root_schema__.defaultValue"
+ },
+ {
+ "key": "sourceData"
+ },
+ {
+ "key": "schema.__root_schema__.children.step.defaultValue"
+ },
+ {
+ "key": "schema.__root_schema__.children.task.defaultValue"
+ },
+ {
+ "key": "schema.__root_schema__.children.status.defaultValue"
+ },
+ {
+ "key": "schema.__root_schema__.children.action.defaultValue"
+ }
+ ],
+ "sourceData": "{{Table1.triggeredRow}}",
+ "showReset": true,
+ "resetButtonLabel": "Reset",
+ "key": "jwjed2l17v",
+ "backgroundColor": "#fff",
+ "rightColumn": 55,
+ "autoGenerateForm": true,
+ "widgetId": "gp2nvh2jvq",
+ "resetButtonStyles": {
+ "buttonColor": "#03B365",
+ "buttonVariant": "SECONDARY"
+ },
+ "isVisible": true,
+ "version": 1,
+ "parentId": "elonff8ppg",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "scrollContents": true,
+ "fixedFooter": true,
+ "submitButtonLabel": "Submit",
+ "disabledWhenInvalid": true
+ }
+ ],
+ "isDisabled": false,
+ "key": "f3byh826p4"
+ }
+ ],
+ "key": "al77tl94xm",
+ "height": 846,
+ "rightColumn": 43,
+ "detachFromLayout": true,
+ "widgetId": "wvl7cnbcsx",
+ "canOutsideClickClose": true,
+ "canEscapeKeyClose": true,
+ "version": 2,
+ "parentId": "0",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "width": 956
+ },
+ {
+ "widgetName": "Table1",
+ "defaultPageSize": 0,
+ "columnOrder": [
+ "step",
+ "task",
+ "status",
+ "action"
+ ],
+ "isVisibleDownload": true,
+ "displayName": "Table",
+ "iconSVG": "/static/media/icon.db8a9cbd.svg",
+ "topRow": 15,
+ "bottomRow": 43,
+ "isSortable": true,
+ "parentRowSpace": 10,
+ "type": "TABLE_WIDGET",
+ "defaultSelectedRow": "0",
+ "hideCard": false,
+ "animateLoading": true,
+ "parentColumnSpace": 20.796875,
+ "dynamicTriggerPathList": [
+ {
+ "key": "primaryColumns.action.onClick"
+ }
+ ],
+ "dynamicBindingPathList": [
+ {
+ "key": "primaryColumns.step.computedValue"
+ },
+ {
+ "key": "primaryColumns.task.computedValue"
+ },
+ {
+ "key": "primaryColumns.status.computedValue"
+ },
+ {
+ "key": "primaryColumns.action.computedValue"
+ },
+ {
+ "key": "primaryColumns.action.buttonLabel"
+ }
+ ],
+ "leftColumn": 13,
+ "primaryColumns": {
+ "step": {
+ "index": 0,
+ "width": 150,
+ "id": "step",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "PARAGRAPH",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "step",
+ "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.step))}}",
+ "buttonColor": "#03B365",
+ "menuColor": "#03B365",
+ "labelColor": "#FFFFFF"
+ },
+ "task": {
+ "index": 1,
+ "width": 150,
+ "id": "task",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "PARAGRAPH",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "task",
+ "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.task))}}",
+ "buttonColor": "#03B365",
+ "menuColor": "#03B365",
+ "labelColor": "#FFFFFF"
+ },
+ "status": {
+ "index": 2,
+ "width": 150,
+ "id": "status",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "text",
+ "textSize": "PARAGRAPH",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isCellVisible": true,
+ "isDerived": false,
+ "label": "status",
+ "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.status))}}",
+ "buttonColor": "#03B365",
+ "menuColor": "#03B365",
+ "labelColor": "#FFFFFF"
+ },
+ "action": {
+ "index": 3,
+ "width": 150,
+ "id": "action",
+ "horizontalAlignment": "LEFT",
+ "verticalAlignment": "CENTER",
+ "columnType": "button",
+ "textSize": "PARAGRAPH",
+ "enableFilter": true,
+ "enableSort": true,
+ "isVisible": true,
+ "isCellVisible": true,
+ "isDisabled": false,
+ "isDerived": false,
+ "label": "action",
+ "onClick": "{{showModal('Modal1')}}",
+ "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.action))}}",
+ "buttonColor": "#03B365",
+ "menuColor": "#03B365",
+ "labelColor": "#FFFFFF",
+ "buttonLabel": "{{Table1.sanitizedTableData.map((currentRow) => ( 'Action'))}}"
+ }
+ },
+ "delimiter": ",",
+ "key": "soxontyqmf",
+ "derivedColumns": {},
+ "rightColumn": 47,
+ "textSize": "PARAGRAPH",
+ "widgetId": "9gv3lc013m",
+ "isVisibleFilters": true,
+ "tableData": "[\n {\n \"step\": \"#1\",\n \"task\": \"Drop a table\",\n \"status\": \"Done\",\n \"action\": \"\"\n },\n {\n \"step\": \"#2\",\n \"task\": \"Create a query fetch_users with the Mock DB\",\n \"status\": \"Pending\",\n \"action\": \"\"\n },\n {\n \"step\": \"#3\",\n \"task\": \"Bind the query using => fetch_users.data\",\n \"status\": \"New\",\n \"action\": \"\"\n }\n]",
+ "isVisible": true,
+ "label": "Data",
+ "searchKey": "",
+ "enableClientSideSearch": true,
+ "version": 3,
+ "totalRecordsCount": 0,
+ "parentId": "0",
+ "renderMode": "CANVAS",
+ "isLoading": false,
+ "horizontalAlignment": "LEFT",
+ "isVisibleSearch": true,
+ "isVisiblePagination": true,
+ "verticalAlignment": "CENTER",
+ "columnSizeMap": {
+ "task": 245,
+ "step": 62,
+ "status": 75
+ }
+ }
+ ]
+}
+}
\ No newline at end of file
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/JSONFormWidget/JSONFrom_Modal_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/JSONFormWidget/JSONFrom_Modal_spec.js
new file mode 100644
index 000000000000..864b509e8858
--- /dev/null
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/JSONFormWidget/JSONFrom_Modal_spec.js
@@ -0,0 +1,84 @@
+const jsonFormInModalDsl = require("../../../../../fixtures/jsonFormInModalDsl.json");
+const publishPage = require("../../../../../locators/publishWidgetspage.json");
+
+const fieldPrefix = ".t--jsonformfield";
+
+const checkFormModalValues = (value) => {
+ // Check if modal present
+ cy.get(".t--modal-widget").should("exist");
+
+ cy.get(`${fieldPrefix}-step label`).contains("Step");
+ cy.get(`${fieldPrefix}-step input`).then((input) => {
+ cy.wrap(input).should("have.value", value.step);
+ cy.wrap(input)
+ .invoke("attr", "type")
+ .should("contain", "text");
+ });
+
+ cy.get(`${fieldPrefix}-task label`).contains("Task");
+ cy.get(`${fieldPrefix}-task input`).then((input) => {
+ cy.wrap(input).should("have.value", value.task);
+ cy.wrap(input)
+ .invoke("attr", "type")
+ .should("contain", "text");
+ });
+
+ cy.get(`${fieldPrefix}-status label`).contains("Status");
+ cy.get(`${fieldPrefix}-status input`).then((input) => {
+ cy.wrap(input).should("have.value", value.status);
+ cy.wrap(input)
+ .invoke("attr", "type")
+ .should("contain", "text");
+ });
+
+ // Close the modal
+ cy.get(".t--widget-iconbuttonwidget button").click({ force: true });
+
+ // Check if modal closed
+ cy.get(".t--modal-widget").should("not.exist");
+};
+
+describe("JSONForm in Modal", () => {
+ it("should show the JSONForm with default values from Table widget", () => {
+ const tableData = [
+ {
+ step: "#1",
+ task: "Drop a table",
+ status: "Done",
+ action: "",
+ },
+ {
+ step: "#2",
+ task: "Create a query fetch_users with the Mock DB",
+ status: "Pending",
+ action: "",
+ },
+ {
+ step: "#3",
+ task: "Bind the query using => fetch_users.data",
+ status: "New",
+ action: "",
+ },
+ ];
+ cy.addDsl(jsonFormInModalDsl);
+
+ cy.PublishtheApp();
+
+ // Click action button of first row
+ cy.get(".t--widget-tablewidget .tableWrap")
+ .find("button")
+ .first()
+ .click({ force: true });
+ // Check the contents of the form
+ checkFormModalValues(tableData[0]);
+
+ // Click action button of third row
+ cy.get(".t--widget-tablewidget .tableWrap")
+ .find("button")
+ .last()
+ .click({ force: true });
+ checkFormModalValues(tableData[2]);
+
+ cy.get(publishPage.backToEditor).click({ force: true });
+ });
+});
diff --git a/app/client/src/widgets/JSONFormWidget/component/Form.tsx b/app/client/src/widgets/JSONFormWidget/component/Form.tsx
index eb5d873b3dec..70f5b3396a9d 100644
--- a/app/client/src/widgets/JSONFormWidget/component/Form.tsx
+++ b/app/client/src/widgets/JSONFormWidget/component/Form.tsx
@@ -24,6 +24,7 @@ export type FormProps<TValues = any> = PropsWithChildren<{
getFormData: () => TValues;
hideFooter: boolean;
isSubmitting: boolean;
+ isWidgetMounting: boolean;
onFormValidityUpdate: (isValid: boolean) => void;
onSubmit: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
registerResetObserver: (callback: () => void) => void;
@@ -129,6 +130,7 @@ function Form<TValues = any>({
getFormData,
hideFooter,
isSubmitting,
+ isWidgetMounting,
onFormValidityUpdate,
onSubmit,
registerResetObserver,
@@ -188,7 +190,24 @@ function Form<TValues = any>({
* In this case the formData (meta) is used to hydrate the form.
*/
if (schema && schema[ROOT_SCHEMA_KEY]) {
- if (isEmpty(formData)) {
+ /**
+ * There are 3 ways this effect can get called
+ * 1. New widget drop / first page load
+ * 2. Widget drag
+ * 3. Widget in modal
+ *
+ * For case 1 the formData is always empty
+ * For case 2 the formData can have some data and hence would be used to
+ * hydrated in the else condition (this component would mount but the widget won't so
+ * isWidgetMounting would be false)
+ * For case 3 the formData would be always be present even if the modal is open or
+ * closed. When the modal opens the widget would be mounted and we need to know if
+ * we need to use the formData or the defaultData to hydrate the form fields as during a
+ * drag operation this Form component also remounts but the widget doesn't. So the isWidgetMounting
+ * flag is used to check if the widget is mounting or not (modal) thus indicating if this needs
+ * to be hydrated with the default value rather than the formData.
+ */
+ if (isEmpty(formData) || isWidgetMounting) {
const defaultValues = schemaItemDefaultValue(
schema[ROOT_SCHEMA_KEY],
"accessor",
diff --git a/app/client/src/widgets/JSONFormWidget/component/index.tsx b/app/client/src/widgets/JSONFormWidget/component/index.tsx
index 22b9d5f092e8..978db9dbd90b 100644
--- a/app/client/src/widgets/JSONFormWidget/component/index.tsx
+++ b/app/client/src/widgets/JSONFormWidget/component/index.tsx
@@ -36,6 +36,7 @@ export type JSONFormComponentProps<TValues = any> = {
fieldLimitExceeded: boolean;
fixedFooter: boolean;
getFormData: () => TValues;
+ isWidgetMounting: boolean;
isSubmitting: boolean;
onFormValidityUpdate: (isValid: boolean) => void;
onSubmit: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -95,6 +96,7 @@ function JSONFormComponent<TValues>({
fieldLimitExceeded,
getFormData,
isSubmitting,
+ isWidgetMounting,
onFormValidityUpdate,
registerResetObserver,
renderMode,
@@ -175,6 +177,7 @@ function JSONFormComponent<TValues>({
getFormData={getFormData}
hideFooter={hideFooter}
isSubmitting={isSubmitting}
+ isWidgetMounting={isWidgetMounting}
onFormValidityUpdate={onFormValidityUpdate}
onSubmit={rest.onSubmit}
registerResetObserver={registerResetObserver}
diff --git a/app/client/src/widgets/JSONFormWidget/widget/index.tsx b/app/client/src/widgets/JSONFormWidget/widget/index.tsx
index da9404a8d823..3bfd448f8248 100644
--- a/app/client/src/widgets/JSONFormWidget/widget/index.tsx
+++ b/app/client/src/widgets/JSONFormWidget/widget/index.tsx
@@ -66,12 +66,17 @@ class JSONFormWidget extends BaseWidget<
WidgetState & JSONFormWidgetState
> {
debouncedParseAndSaveFieldState: any;
+ isWidgetMounting: boolean;
+
constructor(props: JSONFormWidgetProps) {
super(props);
+
this.debouncedParseAndSaveFieldState = debounce(
this.parseAndSaveFieldState,
SAVE_FIELD_STATE_DEBOUNCE_TIMEOUT,
);
+
+ this.isWidgetMounting = true;
}
state = {
@@ -103,6 +108,7 @@ class JSONFormWidget extends BaseWidget<
componentDidMount() {
this.constructAndSaveSchemaIfRequired();
+ this.isWidgetMounting = false;
}
componentDidUpdate(prevProps: JSONFormWidgetProps) {
@@ -309,6 +315,7 @@ class JSONFormWidget extends BaseWidget<
fixedFooter={this.props.fixedFooter}
getFormData={this.getFormData}
isSubmitting={this.state.isSubmitting}
+ isWidgetMounting={this.isWidgetMounting}
onFormValidityUpdate={this.onFormValidityUpdate}
onSubmit={this.onSubmit}
registerResetObserver={this.registerResetObserver}
|
579cb7d0a62ab49e18394387fcf675fb2eaed7a3
|
2024-10-10 15:16:42
|
albinAppsmith
|
feat: Updated GraphQL form UI (#36728)
| false
|
Updated GraphQL form UI (#36728)
|
feat
|
diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx
index f897d38246e9..211042452700 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx
@@ -1,107 +1,87 @@
-import React, { useCallback, useRef } from "react";
+import React from "react";
import styled from "styled-components";
-import QueryEditor from "pages/Editor/APIEditor/GraphQL/QueryEditor";
-import VariableEditor from "pages/Editor/APIEditor/GraphQL/VariableEditor";
-import useHorizontalResize from "utils/hooks/useHorizontalResize";
-import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
-import classNames from "classnames";
-import { tailwindLayers } from "constants/Layers";
-
-const ResizableDiv = styled.div`
- display: flex;
- height: 100%;
- flex-shrink: 0;
-`;
+import {
+ CodeEditorBorder,
+ EditorModes,
+ EditorSize,
+ EditorTheme,
+ TabBehaviour,
+} from "components/editorComponents/CodeEditor/EditorConfig";
+import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField";
+import { Section, Zone } from "pages/Editor/ActionForm";
+import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType";
+import FormLabel from "components/editorComponents/FormLabel";
const PostBodyContainer = styled.div`
- display: flex;
- height: 100%;
- overflow: hidden;
&&&& .CodeMirror {
- height: 100%;
- border-top: 1px solid var(--ads-v2-color-border);
- border-bottom: 1px solid var(--ads-v2-color-border);
- border-radius: 0;
- padding: 0;
- }
- & .CodeMirror-scroll {
- margin: 0px;
- padding: 0px;
- overflow: auto !important;
+ height: auto;
+ min-height: 250px;
}
`;
-const ResizerHandler = styled.div<{ resizing: boolean }>`
- width: 6px;
- height: 100%;
- margin-left: 2px;
- border-right: 1px solid var(--ads-v2-color-border);
- background: ${(props) =>
- props.resizing ? "var(--ads-v2-color-border)" : "transparent"};
- &:hover {
- background: var(--ads-v2-color-border);
- border-color: transparent;
+const StyledFormLabel = styled(FormLabel)`
+ && {
+ margin-bottom: var(--ads-v2-spaces-2);
+ padding: 0;
}
`;
-const DEFAULT_GRAPHQL_VARIABLE_WIDTH = 300;
-
interface Props {
actionName: string;
}
+const EXPECTED_VARIABLE = {
+ type: "object",
+ example:
+ '{\n "name":"{{ inputName.property }}",\n "preference":"{{ dropdownName.property }}"\n}',
+ autocompleteDataType: AutocompleteDataType.OBJECT,
+};
+
function PostBodyData(props: Props) {
const { actionName } = props;
const theme = EditorTheme.LIGHT;
- const resizeableRef = useRef<HTMLDivElement>(null);
- const [variableEditorWidth, setVariableEditorWidth] = React.useState(
- DEFAULT_GRAPHQL_VARIABLE_WIDTH,
- );
- /**
- * Variable Editor's resizeable handler for the changing of width
- */
- const onVariableEditorWidthChange = useCallback((newWidth) => {
- setVariableEditorWidth(newWidth);
- }, []);
-
- const { onMouseDown, onMouseUp, onTouchStart, resizing } =
- useHorizontalResize(
- resizeableRef,
- onVariableEditorWidthChange,
- undefined,
- true,
- );
return (
<PostBodyContainer>
- <QueryEditor
- dataTreePath={`${actionName}.config.body`}
- height="100%"
- name="actionConfiguration.body"
- theme={theme}
- />
- <div
- className={`w-2 h-full -ml-2 group cursor-ew-resize ${tailwindLayers.resizer}`}
- onMouseDown={onMouseDown}
- onTouchEnd={onMouseUp}
- onTouchStart={onTouchStart}
- >
- <ResizerHandler
- className={classNames({
- "transform transition": true,
- })}
- resizing={resizing}
- />
- </div>
- <ResizableDiv
- ref={resizeableRef}
- style={{
- width: `${variableEditorWidth}px`,
- paddingRight: "2px",
- }}
- >
- <VariableEditor actionName={actionName} theme={theme} />
- </ResizableDiv>
+ <Section isFullWidth>
+ <Zone layout="single_column">
+ <div className="t--graphql-query-editor">
+ <StyledFormLabel>Query</StyledFormLabel>
+ <DynamicTextField
+ border={CodeEditorBorder.ALL_SIDE}
+ dataTreePath={`${actionName}.config.body`}
+ evaluatedPopUpLabel={"Query"}
+ mode={EditorModes.GRAPHQL_WITH_BINDING}
+ name="actionConfiguration.body"
+ placeholder={`{{\n\t{name: inputName.property, preference: dropdownName.property}\n}}`}
+ showLineNumbers
+ size={EditorSize.EXTENDED}
+ tabBehaviour={TabBehaviour.INDENT}
+ theme={theme}
+ />
+ </div>
+ </Zone>
+ <Zone layout="single_column">
+ <div className="t--graphql-variable-editor">
+ <StyledFormLabel>Query variables</StyledFormLabel>
+ <DynamicTextField
+ border={CodeEditorBorder.ALL_SIDE}
+ dataTreePath={`${props.actionName}.config.pluginSpecifiedTemplates[1].value`}
+ evaluatedPopUpLabel={"Query variables"}
+ expected={EXPECTED_VARIABLE}
+ height="100%"
+ mode={EditorModes.JSON_WITH_BINDING}
+ name="actionConfiguration.pluginSpecifiedTemplates[1].value"
+ placeholder={`${EXPECTED_VARIABLE.example}\n\n\\\\Take widget inputs using {{ }}`}
+ showLightningMenu={false}
+ showLineNumbers
+ size={EditorSize.EXTENDED}
+ tabBehaviour={TabBehaviour.INDENT}
+ theme={theme}
+ />
+ </div>
+ </Zone>
+ </Section>
</PostBodyContainer>
);
}
diff --git a/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx b/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx
index 71baf3d547d4..80a1748ad0c7 100644
--- a/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx
+++ b/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx
@@ -111,6 +111,7 @@ const Wrapper = styled.div`
flex-direction: row;
height: 100%;
position: relative;
+ overflow: hidden;
`;
const MainContainer = styled.div`
diff --git a/app/client/src/pages/Editor/APIEditor/Editor.tsx b/app/client/src/pages/Editor/APIEditor/Editor.tsx
index 5ce681b23e05..1e6fab13010d 100644
--- a/app/client/src/pages/Editor/APIEditor/Editor.tsx
+++ b/app/client/src/pages/Editor/APIEditor/Editor.tsx
@@ -229,9 +229,10 @@ class ApiEditor extends React.Component<Props> {
const formStyles: CSSProperties = {
position: "relative",
- height: "100%",
display: "flex",
flexDirection: "column",
+ flexGrow: "1",
+ overflow: "auto",
};
// TODO: Fix this the next time the file is edited
diff --git a/app/client/src/pages/Editor/APIEditor/GraphQL/QueryEditor.tsx b/app/client/src/pages/Editor/APIEditor/GraphQL/QueryEditor.tsx
deleted file mode 100644
index 53948e1520b4..000000000000
--- a/app/client/src/pages/Editor/APIEditor/GraphQL/QueryEditor.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import React from "react";
-import { Field } from "redux-form";
-// // Codemirror GraphQL plugins
-import "codemirror-graphql/hint";
-import "codemirror-graphql/info";
-import "codemirror-graphql/jump";
-import "codemirror-graphql/mode";
-
-import QueryWrapper from "./QueryWrapperWithCSS";
-import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
-import {
- CodeEditorBorder,
- EditorModes,
- EditorSize,
- TabBehaviour,
-} from "components/editorComponents/CodeEditor/EditorConfig";
-import styled from "styled-components";
-import { Text, TextType } from "@appsmith/ads-old";
-import LazyCodeEditor from "components/editorComponents/LazyCodeEditor";
-
-const QueryHeader = styled(Text)`
- background: var(--ads-v2-color-bg-subtle);
- padding: 8px 16px;
-`;
-
-interface QueryProps {
- // Path to store the value in the actual data object
- dataTreePath: string;
- // Height for the editor
- height: string;
- // Name of the field of the form
- name: string;
- // Theme to be used in CodeEditor
- theme: EditorTheme;
-}
-
-/**
- * Query Editor is for writing Graphql query using the Codemirror Editor which we use
- * @param props Props that are required by the CodeEditor to render the query editor
- * @returns Component with Editor
- */
-function QueryEditor(props: QueryProps) {
- const editorProps = {
- mode: EditorModes.GRAPHQL_WITH_BINDING,
- tabBehaviour: TabBehaviour.INDENT,
- size: EditorSize.EXTENDED,
- showLineNumbers: true,
- };
-
- return (
- <QueryWrapper className="t--graphql-query-editor">
- <QueryHeader color={"var(--ads-v2-color-fg)"} type={TextType.H6}>
- Query
- </QueryHeader>
- <Field
- border={CodeEditorBorder.NONE}
- borderLess
- component={LazyCodeEditor}
- evaluatedPopUpLabel="Query"
- {...props}
- {...editorProps}
- />
- </QueryWrapper>
- );
-}
-
-export default QueryEditor;
diff --git a/app/client/src/pages/Editor/APIEditor/GraphQL/VariableEditor.tsx b/app/client/src/pages/Editor/APIEditor/GraphQL/VariableEditor.tsx
deleted file mode 100644
index 89a3d3b96d34..000000000000
--- a/app/client/src/pages/Editor/APIEditor/GraphQL/VariableEditor.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import React from "react";
-import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
-import {
- CodeEditorBorder,
- EditorModes,
- EditorSize,
- TabBehaviour,
-} from "components/editorComponents/CodeEditor/EditorConfig";
-import styled from "styled-components";
-import { Text, TextType } from "@appsmith/ads-old";
-import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField";
-import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType";
-
-const VariableWrapper = styled.div`
- display: flex;
- flex-direction: column;
- width: 100%;
- flex-shrink: 0;
- &&&&& .CodeMirror {
- border: 0px;
- }
- &&& .CodeMirror-gutters {
- background: var(--ads-v2-color-bg-subtle);
- }
-`;
-
-const VariableHeader = styled(Text)`
- background: var(--ads-v2-color-bg-subtle);
- padding: 8px 16px;
-`;
-
-const EXPECTED_VARIABLE = {
- type: "object",
- example:
- '{\n "name":"{{ inputName.property }}",\n "preference":"{{ dropdownName.property }}"\n}',
- autocompleteDataType: AutocompleteDataType.OBJECT,
-};
-
-interface VariableProps {
- // Name of the action to define the path to the config property
- actionName: string;
- // Theme to be used in CodeEditor
- theme: EditorTheme;
-}
-
-/**
- * Variable Editor is for writing Graphql variables using the Codemirror Editor which we use for JSON
- * @param props Props that are required by the CodeEditor to render the variable editor
- * @returns Component with Editor
- */
-function VariableEditor(props: VariableProps) {
- return (
- <VariableWrapper className="t--graphql-variable-editor">
- <VariableHeader color={"var(--ads-v2-color-fg)"} type={TextType.H6}>
- Query variables
- </VariableHeader>
- <DynamicTextField
- border={CodeEditorBorder.NONE}
- borderLess
- dataTreePath={`${props.actionName}.config.pluginSpecifiedTemplates[1].value`}
- evaluatedPopUpLabel={"Query variables"}
- expected={EXPECTED_VARIABLE}
- height="100%"
- mode={EditorModes.JSON_WITH_BINDING}
- name="actionConfiguration.pluginSpecifiedTemplates[1].value"
- placeholder={`${EXPECTED_VARIABLE.example}\n\n\\\\Take widget inputs using {{ }}`}
- showLightningMenu={false}
- showLineNumbers
- size={EditorSize.EXTENDED}
- tabBehaviour={TabBehaviour.INDENT}
- theme={props.theme}
- />
- </VariableWrapper>
- );
-}
-
-export default VariableEditor;
diff --git a/app/client/src/pages/Editor/ActionForm/Section/index.tsx b/app/client/src/pages/Editor/ActionForm/Section/index.tsx
index 937ad0b631d5..7b664e119607 100644
--- a/app/client/src/pages/Editor/ActionForm/Section/index.tsx
+++ b/app/client/src/pages/Editor/ActionForm/Section/index.tsx
@@ -5,11 +5,13 @@ import styles from "./styles.module.css";
interface SectionProps extends React.HTMLAttributes<HTMLDivElement> {
children: React.ReactNode;
isStandalone?: boolean;
+ isFullWidth?: boolean;
}
const Section: React.FC<SectionProps> = ({
children,
className,
+ isFullWidth = false,
isStandalone = false,
...props
}) => {
@@ -18,6 +20,7 @@ const Section: React.FC<SectionProps> = ({
return (
<div
className={classNames}
+ data-fullwidth={isFullWidth.toString()}
data-standalone={isStandalone.toString()}
{...props}
>
diff --git a/app/client/src/pages/Editor/ActionForm/Section/styles.module.css b/app/client/src/pages/Editor/ActionForm/Section/styles.module.css
index e3d2a2d2f309..fb03da7ffbd3 100644
--- a/app/client/src/pages/Editor/ActionForm/Section/styles.module.css
+++ b/app/client/src/pages/Editor/ActionForm/Section/styles.module.css
@@ -13,4 +13,8 @@
&[data-standalone="false"]:not(:last-child) {
border-bottom: 1px solid var(--ads-v2-color-border);
}
+
+ &[data-fullwidth="true"] {
+ max-width: none;
+ }
}
|
37b4aca089d450fde215d89a0334b9b2c69b9c83
|
2025-03-21 19:00:45
|
Abhijeet
|
chore: Remove postgres setup from services as embedded postgres will be started with prerequisites on demand by entrypoint (#39859)
| false
|
Remove postgres setup from services as embedded postgres will be started with prerequisites on demand by entrypoint (#39859)
|
chore
|
diff --git a/.github/workflows/ci-test-limited.yml b/.github/workflows/ci-test-limited.yml
index 5a140dd58b63..4c5b65c1ecfd 100644
--- a/.github/workflows/ci-test-limited.yml
+++ b/.github/workflows/ci-test-limited.yml
@@ -45,10 +45,6 @@ jobs:
image: redis
ports:
- 6379:6379
- postgres:
- image: postgres:14
- ports:
- - 5432:5432
mongo:
image: mongo
ports:
|
4dd417a51147baba436c5dfb06f6b8c78f008cbb
|
2023-07-14 07:27:58
|
arunvjn
|
chore: Stop logging uncaught user generated error into sentry (#25338)
| false
|
Stop logging uncaught user generated error into sentry (#25338)
|
chore
|
diff --git a/app/client/src/workers/Evaluation/evaluation.worker.ts b/app/client/src/workers/Evaluation/evaluation.worker.ts
index dc157e392a9f..3847a99cae5f 100644
--- a/app/client/src/workers/Evaluation/evaluation.worker.ts
+++ b/app/client/src/workers/Evaluation/evaluation.worker.ts
@@ -45,14 +45,12 @@ self.addEventListener("message", syncRequestMessageListener);
self.addEventListener("message", asyncRequestMessageListener);
self.addEventListener("error", (e) => {
- if (e instanceof ErrorEvent) {
- console.error(e.message);
- } else {
- console.error(e);
- }
+ e.preventDefault();
+ console.error(e.message);
});
self.addEventListener("unhandledrejection", (e) => {
+ e.preventDefault();
// We might want to send this error to the main thread in the future.
// console error will log the error to the logs tab against trigger field.
console.error(e.reason.message);
|
9c4cfe16f1106d80930a85075633021ed5d18a43
|
2022-11-04 11:25:25
|
Aman Agarwal
|
fix: delete individual ds without blocking other ds (#17949)
| false
|
delete individual ds without blocking other ds (#17949)
|
fix
|
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index 0b79a3dbccc9..cb3a51aa44ce 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -1181,6 +1181,7 @@ export const CONTEXT_MOVE = () => "Move to page";
export const CONTEXT_COPY = () => "Copy to page";
export const CONTEXT_DELETE = () => "Delete";
export const CONFIRM_CONTEXT_DELETE = () => "Are you sure?";
+export const CONFIRM_CONTEXT_DELETING = () => "Deleting";
export const CONTEXT_NO_PAGE = () => "No pages";
export const CONTEXT_REFRESH = () => "Refresh";
export const CONTEXT_CLONE = () => "Clone";
diff --git a/app/client/src/entities/Datasource/index.ts b/app/client/src/entities/Datasource/index.ts
index 881ea9016610..77c0ebd302ff 100644
--- a/app/client/src/entities/Datasource/index.ts
+++ b/app/client/src/entities/Datasource/index.ts
@@ -62,6 +62,7 @@ interface BaseDatasource {
workspaceId: string;
isValid: boolean;
isConfigured?: boolean;
+ isDeleting?: boolean;
}
export const isEmbeddedRestDatasource = (
diff --git a/app/client/src/pages/Editor/DataSourceEditor/index.tsx b/app/client/src/pages/Editor/DataSourceEditor/index.tsx
index c9fcfb6a42eb..f190399693ee 100644
--- a/app/client/src/pages/Editor/DataSourceEditor/index.tsx
+++ b/app/client/src/pages/Editor/DataSourceEditor/index.tsx
@@ -171,7 +171,7 @@ const mapStateToProps = (state: AppState, props: any): ReduxStateProps => {
fromImporting: props.fromImporting ?? false,
pluginId,
isSaving: datasources.loading,
- isDeleting: datasources.isDeleting,
+ isDeleting: !!datasource?.isDeleting,
isTesting: datasources.isTesting,
formConfig: formConfigs[pluginId] || [],
isNewDatasource: datasourcePane.newDatasource === datasourceId,
diff --git a/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx b/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx
index 8d0c07c1bcca..002038b6f709 100644
--- a/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx
+++ b/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx
@@ -1,6 +1,6 @@
import { Datasource } from "entities/Datasource";
import { isStoredDatasource, PluginType } from "entities/Action";
-import React, { useCallback, useEffect, useState } from "react";
+import React, { memo, useCallback, useEffect, useState } from "react";
import { isNil } from "lodash";
import { useDispatch, useSelector } from "react-redux";
import { Colors } from "constants/Colors";
@@ -26,10 +26,7 @@ import {
MenuItem,
} from "design-system";
import { deleteDatasource } from "actions/datasourceActions";
-import {
- getGenerateCRUDEnabledPluginMap,
- getIsDeletingDatasource,
-} from "selectors/entitiesSelector";
+import { getGenerateCRUDEnabledPluginMap } from "selectors/entitiesSelector";
import { GenerateCRUDEnabledPluginMap, Plugin } from "api/PluginApi";
import AnalyticsUtil from "utils/AnalyticsUtil";
import NewActionButton from "../DataSourceEditor/NewActionButton";
@@ -42,6 +39,7 @@ import {
CONTEXT_DELETE,
CONFIRM_CONTEXT_DELETE,
createMessage,
+ CONFIRM_CONTEXT_DELETING,
} from "@appsmith/constants/messages";
import { getCurrentPageId } from "selectors/editorSelectors";
@@ -91,7 +89,7 @@ const DatasourceIconWrapper = styled.div`
align-items: center;
`;
-const GenerateTemplateButton = styled(Button)`
+const GenerateTemplateOrReconnect = styled(Button)`
padding: 10px 10px;
font-size: 12px;
@@ -199,10 +197,10 @@ function DatasourceCard(props: DatasourceCardProps) {
action.config.datasource.id === datasource.id,
).length;
- const isDeletingDatasource = useSelector(getIsDeletingDatasource);
-
const [confirmDelete, setConfirmDelete] = useState(false);
+ const isDeletingDatasource = !!datasource.isDeleting;
+
useEffect(() => {
if (confirmDelete && !isDeletingDatasource) {
setConfirmDelete(false);
@@ -261,6 +259,7 @@ function DatasourceCard(props: DatasourceCardProps) {
};
const deleteAction = () => {
+ if (isDeletingDatasource) return;
AnalyticsUtil.logEvent("DATASOURCE_CARD_DELETE_ACTION");
dispatch(deleteDatasource({ id: datasource.id }));
};
@@ -295,117 +294,77 @@ function DatasourceCard(props: DatasourceCardProps) {
: "No query in this application is using this datasource"}
</Queries>
</div>
- {datasource.isConfigured && (
- <ButtonsWrapper className="action-wrapper">
- {supportTemplateGeneration && (
- <GenerateTemplateButton
- category={Category.tertiary}
- className="t--generate-template"
- disabled={!supportTemplateGeneration}
- onClick={routeToGeneratePage}
- text="GENERATE NEW PAGE"
- />
- )}
+ <ButtonsWrapper className="action-wrapper">
+ {(!datasource.isConfigured || supportTemplateGeneration) && (
+ <GenerateTemplateOrReconnect
+ category={Category.tertiary}
+ className={
+ datasource.isConfigured
+ ? "t--generate-template"
+ : "t--reconnect-btn"
+ }
+ onClick={
+ datasource.isConfigured ? routeToGeneratePage : editDatasource
+ }
+ text={
+ datasource.isConfigured ? "GENERATE NEW PAGE" : "RECONNECT"
+ }
+ />
+ )}
+ {datasource.isConfigured && (
<NewActionButton
datasource={datasource}
eventFrom="active-datasources"
plugin={plugin}
/>
- <MenuWrapper
- className="t--datasource-menu-option"
- onClick={(e) => {
- e.stopPropagation();
- }}
+ )}
+ <MenuWrapper
+ className="t--datasource-menu-option"
+ onClick={(e) => {
+ e.stopPropagation();
+ }}
+ >
+ <MenuComponent
+ menuItemWrapperWidth="160px"
+ position={Position.BOTTOM_RIGHT}
+ target={
+ <MoreOptionsContainer>
+ <Icon
+ fillColor={
+ datasource.isConfigured ? Colors.GREY_8 : Colors.GRAY2
+ }
+ name="comment-context-menu"
+ size={IconSize.XXXL}
+ />
+ </MoreOptionsContainer>
+ }
>
- <MenuComponent
- menuItemWrapperWidth="160px"
- onClose={() => setConfirmDelete(false)}
- position={Position.BOTTOM_RIGHT}
- target={
- <MoreOptionsContainer>
- <Icon
- fillColor={Colors.GREY_8}
- name="comment-context-menu"
- size={IconSize.XXXL}
- />
- </MoreOptionsContainer>
- }
- >
- <MenuItem
- className="t--datasource-option-edit"
- icon="edit"
- onSelect={editDatasource}
- text="Edit"
- />
- <RedMenuItem
- className="t--datasource-option-delete"
- icon="delete"
- isLoading={isDeletingDatasource}
- onSelect={() => {
+ <MenuItem
+ className="t--datasource-option-edit"
+ icon="edit"
+ onSelect={editDatasource}
+ text="Edit"
+ />
+ <RedMenuItem
+ className="t--datasource-option-delete"
+ icon="delete"
+ isLoading={isDeletingDatasource}
+ onSelect={() => {
+ if (!isDeletingDatasource) {
confirmDelete ? deleteAction() : setConfirmDelete(true);
- }}
- text={
- confirmDelete
- ? createMessage(CONFIRM_CONTEXT_DELETE)
- : createMessage(CONTEXT_DELETE)
}
- />
- </MenuComponent>
- </MenuWrapper>
- </ButtonsWrapper>
- )}
- {!datasource.isConfigured && (
- <ButtonsWrapper className="action-wrapper">
- <GenerateTemplateButton
- category={Category.tertiary}
- className="t--reconnect-btn"
- onClick={editDatasource}
- text="RECONNECT"
- />
-
- <MenuWrapper
- className="t--datasource-menu-option"
- onClick={(e) => {
- e.stopPropagation();
- }}
- >
- <MenuComponent
- menuItemWrapperWidth="160px"
- onClose={() => setConfirmDelete(false)}
- position={Position.BOTTOM_RIGHT}
- target={
- <MoreOptionsContainer>
- <Icon
- fillColor={Colors.GRAY2}
- name="comment-context-menu"
- size={IconSize.XXXL}
- />
- </MoreOptionsContainer>
+ }}
+ text={
+ isDeletingDatasource
+ ? createMessage(CONFIRM_CONTEXT_DELETING)
+ : confirmDelete
+ ? createMessage(CONFIRM_CONTEXT_DELETE)
+ : createMessage(CONTEXT_DELETE)
}
- >
- <MenuItem
- className="t--datasource-option-edit"
- icon="edit"
- onSelect={editDatasource}
- text="Edit"
- />
- <RedMenuItem
- className="t--datasource-option-delete"
- icon="delete"
- isLoading={isDeletingDatasource}
- onSelect={() => {
- confirmDelete ? deleteAction() : setConfirmDelete(true);
- }}
- text={
- confirmDelete
- ? createMessage(CONFIRM_CONTEXT_DELETE)
- : createMessage(CONTEXT_DELETE)
- }
- />
- </MenuComponent>
- </MenuWrapper>
- </ButtonsWrapper>
- )}
+ />
+ </MenuComponent>
+ </MenuWrapper>
+ </ButtonsWrapper>
</DatasourceCardHeader>
</DatasourceCardMainBody>
{!isNil(currentFormConfig) && (
@@ -425,4 +384,4 @@ function DatasourceCard(props: DatasourceCardProps) {
);
}
-export default DatasourceCard;
+export default memo(DatasourceCard);
diff --git a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
index d3fc2a3945c0..d685562e62b6 100644
--- a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
+++ b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
@@ -181,7 +181,7 @@ const mapStateToProps = (state: AppState, props: any) => {
datasourceButtonConfiguration,
datasourceId,
isSaving: datasources.loading,
- isDeleting: datasources.isDeleting,
+ isDeleting: !!datasource?.isDeleting,
formData: formData,
formConfig,
isNewDatasource: datasourcePane.newDatasource === datasourceId,
diff --git a/app/client/src/pages/common/datasourceAuth/index.tsx b/app/client/src/pages/common/datasourceAuth/index.tsx
index 1de7286119bc..10b4e0c886fb 100644
--- a/app/client/src/pages/common/datasourceAuth/index.tsx
+++ b/app/client/src/pages/common/datasourceAuth/index.tsx
@@ -107,7 +107,7 @@ function DatasourceAuth({
formData &&
formData?.datasourceConfiguration?.authentication?.authenticationType;
- const { id: datasourceId } = datasource;
+ const { id: datasourceId, isDeleting } = datasource;
const applicationId = useSelector(getCurrentApplicationId);
// hooks
@@ -159,7 +159,7 @@ function DatasourceAuth({
// selectors
const {
- datasources: { isDeleting, isTesting, loading: isSaving },
+ datasources: { isTesting, loading: isSaving },
} = useSelector(getEntities);
const delayConfirmDeleteToFalse = debounce(
diff --git a/app/client/src/reducers/entityReducers/datasourceReducer.ts b/app/client/src/reducers/entityReducers/datasourceReducer.ts
index 0a5b1bd6d86b..570f65931eb9 100644
--- a/app/client/src/reducers/entityReducers/datasourceReducer.ts
+++ b/app/client/src/reducers/entityReducers/datasourceReducer.ts
@@ -14,7 +14,6 @@ export interface DatasourceDataState {
list: Datasource[];
loading: boolean;
isTesting: boolean;
- isDeleting: boolean;
isListing: boolean; // fetching unconfigured datasource list
fetchingDatasourceStructure: boolean;
isRefreshingStructure: boolean;
@@ -30,7 +29,6 @@ const initialState: DatasourceDataState = {
list: [],
loading: false,
isTesting: false,
- isDeleting: false,
isListing: false,
fetchingDatasourceStructure: false,
isRefreshingStructure: false,
@@ -97,8 +95,20 @@ const datasourceReducer = createReducer(initialState, {
[ReduxActionTypes.TEST_DATASOURCE_INIT]: (state: DatasourceDataState) => {
return { ...state, isTesting: true };
},
- [ReduxActionTypes.DELETE_DATASOURCE_INIT]: (state: DatasourceDataState) => {
- return { ...state, isDeleting: true };
+ [ReduxActionTypes.DELETE_DATASOURCE_INIT]: (
+ state: DatasourceDataState,
+ action: ReduxAction<Datasource>,
+ ) => {
+ return {
+ ...state,
+ list: state.list.map((datasource) => {
+ if (datasource.id === action.payload.id) {
+ return { ...datasource, isDeleting: true };
+ }
+
+ return datasource;
+ }),
+ };
},
[ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_INIT]: (
state: DatasourceDataState,
@@ -204,7 +214,6 @@ const datasourceReducer = createReducer(initialState, {
) => {
return {
...state,
- isDeleting: false,
list: state.list.filter(
(datasource) => datasource.id !== action.payload.id,
),
@@ -212,10 +221,17 @@ const datasourceReducer = createReducer(initialState, {
},
[ReduxActionTypes.DELETE_DATASOURCE_CANCELLED]: (
state: DatasourceDataState,
+ action: ReduxAction<Datasource>,
) => {
return {
...state,
- isDeleting: false,
+ list: state.list.map((datasource) => {
+ if (datasource.id === action.payload.id) {
+ return { ...datasource, isDeleting: false };
+ }
+
+ return datasource;
+ }),
};
},
[ReduxActionTypes.CREATE_DATASOURCE_SUCCESS]: (
@@ -290,8 +306,18 @@ const datasourceReducer = createReducer(initialState, {
},
[ReduxActionErrorTypes.DELETE_DATASOURCE_ERROR]: (
state: DatasourceDataState,
+ action: ReduxAction<Datasource>,
) => {
- return { ...state, isDeleting: false };
+ return {
+ ...state,
+ list: state.list.map((datasource) => {
+ if (datasource.id === action.payload.id) {
+ return { ...datasource, isDeleting: false };
+ }
+
+ return datasource;
+ }),
+ };
},
[ReduxActionErrorTypes.TEST_DATASOURCE_ERROR]: (
state: DatasourceDataState,
diff --git a/app/client/src/selectors/entitiesSelector.ts b/app/client/src/selectors/entitiesSelector.ts
index 647433ae92c0..3ae3f87ab7e1 100644
--- a/app/client/src/selectors/entitiesSelector.ts
+++ b/app/client/src/selectors/entitiesSelector.ts
@@ -51,10 +51,6 @@ export const getMockDatasources = (state: AppState): MockDatasource[] => {
return state.entities.datasources.mockDatasourceList;
};
-export const getIsDeletingDatasource = (state: AppState): boolean => {
- return state.entities.datasources.isDeleting;
-};
-
export const getDefaultPlugins = (state: AppState): DefaultPlugin[] =>
state.entities.plugins.defaultPluginList;
|
508865f1dcbe2856632f93f3ed46a5f812d0801f
|
2021-12-16 17:03:40
|
Nidhi
|
fix: Added handling for refactor of default list elements (#9774)
| false
|
Added handling for refactor of default list elements (#9774)
|
fix
|
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java
index 9ecf9a43947e..43d167822e88 100644
--- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java
+++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java
@@ -40,6 +40,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -452,12 +453,39 @@ public Mono<LayoutDTO> refactorName(String pageId, String layoutId, String oldNa
}
private JsonNode replaceStringInJsonNode(JsonNode jsonNode, Pattern oldNamePattern, String newName) {
- // Is this is a text node, perform replacement directly
+ // If this is a text node, perform replacement directly
if (jsonNode.isTextual()) {
Matcher matcher = oldNamePattern.matcher(jsonNode.asText());
String valueAfterReplacement = matcher.replaceAll(newName);
return new TextNode(valueAfterReplacement);
}
+
+ // TODO This is special handling for the list widget that has been added to allow refactoring of
+ // just the default widgets inside the list. This is required because for the list, the widget names
+ // exist as keys at the location List1.template(.Text1) [Ref #9281]
+ // Ideally, we should avoid any non-structural elements as keys. This will be improved in list widget v2
+ if (jsonNode.has("type") && "LIST_WIDGET".equals(jsonNode.get("type").asText())) {
+ final JsonNode template = jsonNode.get("template");
+ JsonNode newJsonNode = null;
+ String fieldName = null;
+ final Iterator<String> templateIterator = template.fieldNames();
+ while (templateIterator.hasNext()) {
+ fieldName = templateIterator.next();
+
+ // For each element within template, check whether it would match the replacement pattern
+ final Matcher listWidgetTemplateKeyMatcher = oldNamePattern.matcher(fieldName);
+ if (listWidgetTemplateKeyMatcher.find()) {
+ newJsonNode = template.get(fieldName);
+ break;
+ }
+ }
+ if (newJsonNode != null) {
+ // If such a pattern is found, remove that element and attach it back with the new name
+ ((ObjectNode) template).remove(fieldName);
+ ((ObjectNode) template).set(newName, newJsonNode);
+ }
+ }
+
final Iterator<Map.Entry<String, JsonNode>> iterator = jsonNode.fields();
// Go through each field to recursively operate on it
while (iterator.hasNext()) {
diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java
index 8fb2cea81055..67b3c3551259 100644
--- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java
+++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java
@@ -70,6 +70,7 @@
import static com.appsmith.server.constants.FieldName.DEFAULT_PAGE_LAYOUT;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
@RunWith(SpringRunner.class)
@SpringBootTest
@@ -949,6 +950,46 @@ public void simpleWidgetNameRefactor() {
.verifyComplete();
}
+ @Test
+ @WithUserDetails(value = "api_user")
+ public void testRefactorWidgetName_forDefaultWidgetsInList_updatesBothWidgetsAndTemplateReferences() {
+ Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any())).thenReturn(Mono.just(new MockPluginExecutor()));
+
+ JSONObject dsl = new JSONObject();
+ dsl.put("widgetName", "List1");
+ dsl.put("type", "LIST_WIDGET");
+ JSONObject template = new JSONObject();
+ template.put("oldWidgetName", "irrelevantContent");
+ dsl.put("template", template);
+ final JSONArray children = new JSONArray();
+ final JSONObject defaultWidget = new JSONObject();
+ defaultWidget.put("widgetName", "oldWidgetName");
+ defaultWidget.put("type", "TEXT_WIDGET");
+ children.add(defaultWidget);
+ dsl.put("children", children);
+ Layout layout = testPage.getLayouts().get(0);
+ layout.setDsl(dsl);
+
+ layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block();
+
+ RefactorNameDTO refactorNameDTO = new RefactorNameDTO();
+ refactorNameDTO.setPageId(testPage.getId());
+ refactorNameDTO.setLayoutId(layout.getId());
+ refactorNameDTO.setOldName("oldWidgetName");
+ refactorNameDTO.setNewName("newWidgetName");
+
+ Mono<LayoutDTO> widgetRenameMono = layoutActionService.refactorWidgetName(refactorNameDTO).cache();
+
+ StepVerifier
+ .create(widgetRenameMono)
+ .assertNext(updatedLayout -> {
+ assertTrue(((Map) updatedLayout.getDsl().get("template")).containsKey("newWidgetName"));
+ assertEquals("newWidgetName",
+ ((Map)(((List)updatedLayout.getDsl().get("children")).get(0))).get("widgetName"));
+ })
+ .verifyComplete();
+ }
+
@Test
@WithUserDetails(value = "api_user")
public void testWidgetNameRefactor_withSimpleUpdate_refactorsActionCollectionAndItsAction() {
|
58c801f8592d6e561172defcf6c448bab25211b5
|
2023-09-18 14:08:25
|
Sumit Kumar
|
chore: move MySQL datasource validation tests to a separate file (#27373)
| false
|
move MySQL datasource validation tests to a separate file (#27373)
|
chore
|
diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySQLDatasourceValidationTest.java b/app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySQLDatasourceValidationTest.java
index 7d14aa31efbe..d12a4cd2359c 100644
--- a/app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySQLDatasourceValidationTest.java
+++ b/app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySQLDatasourceValidationTest.java
@@ -10,8 +10,11 @@
import com.appsmith.external.models.SSLDetails;
import com.appsmith.external.models.UploadedFile;
import org.junit.jupiter.api.Test;
+import reactor.core.publisher.Mono;
+import reactor.test.StepVerifier;
import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import static com.appsmith.external.exceptions.pluginExceptions.BasePluginErrorMessages.DS_INVALID_SSH_HOSTNAME_ERROR_MSG;
@@ -24,13 +27,13 @@
public class MySQLDatasourceValidationTest {
static MySqlPlugin.MySqlPluginExecutor pluginExecutor = new MySqlPlugin.MySqlPluginExecutor();
- private DatasourceConfiguration getDatasourceConfigurationWithSSHConnectionMethod() {
+ private DatasourceConfiguration getDatasourceConfigurationWithStandardConnectionMethod() {
DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
/* Set connection method toggle */
ArrayList<Property> properties = new ArrayList<>();
properties.add(null);
- properties.add(new Property("Connection method", "SSH"));
+ properties.add(new Property("Connection method", "STANDARD"));
datasourceConfiguration.setProperties(properties);
/* Set connection mode */
@@ -42,6 +45,25 @@ private DatasourceConfiguration getDatasourceConfigurationWithSSHConnectionMetho
mysqlEndpoints.add(new Endpoint("mysqlHost", 3306L));
datasourceConfiguration.setEndpoints(mysqlEndpoints);
+ /* Set DB username and password */
+ datasourceConfiguration.setAuthentication(new DBAuth(null, "username", "password", "dbname"));
+
+ /* Set ssl mode */
+ datasourceConfiguration.getConnection().setSsl(new SSLDetails());
+ datasourceConfiguration.getConnection().getSsl().setAuthType(SSLDetails.AuthType.DEFAULT);
+
+ return datasourceConfiguration;
+ }
+
+ private DatasourceConfiguration getDatasourceConfigurationWithSSHConnectionMethod() {
+ DatasourceConfiguration datasourceConfiguration = getDatasourceConfigurationWithStandardConnectionMethod();
+
+ /* Set connection method toggle */
+ ArrayList<Property> properties = new ArrayList<>();
+ properties.add(null);
+ properties.add(new Property("Connection method", "SSH"));
+ datasourceConfiguration.setProperties(properties);
+
/* Set SSH endpoints */
ArrayList<Endpoint> sshEndpoints = new ArrayList<>();
sshEndpoints.add(new Endpoint("sshHost", 22L));
@@ -53,13 +75,6 @@ private DatasourceConfiguration getDatasourceConfigurationWithSSHConnectionMetho
sshConnection.setPrivateKey(new SSHPrivateKey(new UploadedFile("key", "base64Key"), null));
datasourceConfiguration.setSshProxy(sshConnection);
- /* Set DB username and password */
- datasourceConfiguration.setAuthentication(new DBAuth(null, "username", "password", "dbname"));
-
- /* Set ssl mode */
- datasourceConfiguration.getConnection().setSsl(new SSLDetails());
- datasourceConfiguration.getConnection().getSsl().setAuthType(SSLDetails.AuthType.DEFAULT);
-
return datasourceConfiguration;
}
@@ -111,4 +126,67 @@ public void testErrorMessageOnEmptySSHKey() {
assertTrue(validationErrors.size() > 0);
assertTrue(validationErrors.contains(DS_MISSING_SSH_KEY_ERROR_MSG), validationErrors::toString);
}
+
+ @Test
+ public void testValidateDatasourceNullCredentials() {
+ DatasourceConfiguration dsConfig = getDatasourceConfigurationWithStandardConnectionMethod();
+ dsConfig.setConnection(new com.appsmith.external.models.Connection());
+ DBAuth auth = (DBAuth) dsConfig.getAuthentication();
+ auth.setUsername(null);
+ auth.setPassword(null);
+ auth.setDatabaseName("someDbName");
+ Set<String> output = pluginExecutor.validateDatasource(dsConfig);
+ assertTrue(output.contains("Missing username for authentication."));
+ assertTrue(output.contains("Missing password for authentication."));
+ }
+
+ @Test
+ public void testValidateDatasourceMissingDBName() {
+ DatasourceConfiguration dsConfig = getDatasourceConfigurationWithStandardConnectionMethod();
+ ((DBAuth) dsConfig.getAuthentication()).setDatabaseName("");
+ Set<String> output = pluginExecutor.validateDatasource(dsConfig);
+ assertTrue(output.stream().anyMatch(error -> error.contains("Missing database name.")));
+ }
+
+ @Test
+ public void testValidateDatasourceNullEndpoint() {
+ DatasourceConfiguration dsConfig = getDatasourceConfigurationWithStandardConnectionMethod();
+ dsConfig.setEndpoints(null);
+ Set<String> output = pluginExecutor.validateDatasource(dsConfig);
+ assertTrue(output.stream().anyMatch(error -> error.contains("Missing endpoint and url")));
+ }
+
+ @Test
+ public void testValidateDatasource_NullHost() {
+ DatasourceConfiguration dsConfig = getDatasourceConfigurationWithStandardConnectionMethod();
+ dsConfig.setEndpoints(List.of(new Endpoint()));
+ Set<String> output = pluginExecutor.validateDatasource(dsConfig);
+ assertTrue(output.stream().anyMatch(error -> error.contains("Host value cannot be empty")));
+ }
+
+ @Test
+ public void testValidateDatasourceInvalidEndpoint() {
+ DatasourceConfiguration dsConfig = getDatasourceConfigurationWithStandardConnectionMethod();
+ String hostname = "r2dbc:mysql://localhost";
+ dsConfig.getEndpoints().get(0).setHost(hostname);
+ Set<String> output = pluginExecutor.validateDatasource(dsConfig);
+ assertTrue(output.contains("Host value cannot contain `/` or `:` characters. Found `" + hostname + "`."));
+ }
+
+ @Test
+ public void testSslToggleMissingError() {
+ DatasourceConfiguration datasourceConfiguration = getDatasourceConfigurationWithStandardConnectionMethod();
+ datasourceConfiguration.getConnection().getSsl().setAuthType(null);
+
+ Mono<Set<String>> invalidsMono =
+ Mono.just(pluginExecutor).map(executor -> executor.validateDatasource(datasourceConfiguration));
+
+ StepVerifier.create(invalidsMono)
+ .assertNext(invalids -> {
+ String expectedError = "Appsmith server has failed to fetch SSL configuration from datasource "
+ + "configuration form. Please reach out to Appsmith customer support to resolve this.";
+ assertTrue(invalids.stream().anyMatch(error -> expectedError.equals(error)));
+ })
+ .verifyComplete();
+ }
}
diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySqlPluginTest.java b/app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySqlPluginTest.java
index a1dbfd53d591..56e46edc0495 100755
--- a/app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySqlPluginTest.java
+++ b/app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySqlPluginTest.java
@@ -483,52 +483,6 @@ public void testStaleConnectionCheck() {
.verify();
}
- @Test
- public void testValidateDatasourceNullCredentials() {
- dsConfig.setConnection(new com.appsmith.external.models.Connection());
- DBAuth auth = (DBAuth) dsConfig.getAuthentication();
- auth.setUsername(null);
- auth.setPassword(null);
- auth.setDatabaseName("someDbName");
- Set<String> output = pluginExecutor.validateDatasource(dsConfig);
- assertTrue(output.contains("Missing username for authentication."));
- assertTrue(output.contains("Missing password for authentication."));
- }
-
- @Test
- public void testValidateDatasourceMissingDBName() {
- ((DBAuth) dsConfig.getAuthentication()).setDatabaseName("");
- Set<String> output = pluginExecutor.validateDatasource(dsConfig);
- assertTrue(output.stream().anyMatch(error -> error.contains("Missing database name.")));
- }
-
- @Test
- public void testValidateDatasourceNullEndpoint() {
- dsConfig.setEndpoints(null);
- Set<String> output = pluginExecutor.validateDatasource(dsConfig);
- assertTrue(output.stream().anyMatch(error -> error.contains("Missing endpoint and url")));
- }
-
- @Test
- public void testValidateDatasource_NullHost() {
- dsConfig.setEndpoints(List.of(new Endpoint()));
- Set<String> output = pluginExecutor.validateDatasource(dsConfig);
- assertTrue(output.stream().anyMatch(error -> error.contains("Host value cannot be empty")));
-
- Endpoint endpoint = new Endpoint();
- endpoint.setHost(address);
- endpoint.setPort(port.longValue());
- dsConfig.setEndpoints(List.of(endpoint));
- }
-
- @Test
- public void testValidateDatasourceInvalidEndpoint() {
- String hostname = "r2dbc:mysql://localhost";
- dsConfig.getEndpoints().get(0).setHost(hostname);
- Set<String> output = pluginExecutor.validateDatasource(dsConfig);
- assertTrue(output.contains("Host value cannot contain `/` or `:` characters. Found `" + hostname + "`."));
- }
-
@Test
public void testAliasColumnNames() {
DatasourceConfiguration dsConfig = createDatasourceConfiguration();
@@ -1085,23 +1039,6 @@ public void testStructure() {
.verifyComplete();
}
- @Test
- public void testSslToggleMissingError() {
- DatasourceConfiguration datasourceConfiguration = createDatasourceConfiguration();
- datasourceConfiguration.getConnection().getSsl().setAuthType(null);
-
- Mono<Set<String>> invalidsMono =
- Mono.just(pluginExecutor).map(executor -> executor.validateDatasource(datasourceConfiguration));
-
- StepVerifier.create(invalidsMono)
- .assertNext(invalids -> {
- String expectedError = "Appsmith server has failed to fetch SSL configuration from datasource "
- + "configuration form. Please reach out to Appsmith customer support to resolve this.";
- assertTrue(invalids.stream().anyMatch(error -> expectedError.equals(error)));
- })
- .verifyComplete();
- }
-
@Test
public void testSslDisabled() {
ActionConfiguration actionConfiguration = new ActionConfiguration();
|
6edf161edf0fe6a535b9e48c78e526fe4060f248
|
2022-09-03 20:37:31
|
Arsalan Yaldram
|
fix: added tablet landscape icon (#16436)
| false
|
added tablet landscape icon (#16436)
|
fix
|
diff --git a/app/client/src/pages/Editor/MainContainerLayoutControl.tsx b/app/client/src/pages/Editor/MainContainerLayoutControl.tsx
index 0cd0672bf297..2da594286f15 100644
--- a/app/client/src/pages/Editor/MainContainerLayoutControl.tsx
+++ b/app/client/src/pages/Editor/MainContainerLayoutControl.tsx
@@ -37,12 +37,12 @@ const AppsmithLayouts: AppsmithLayoutConfigOption[] = [
icon: "desktop",
},
{
- name: "Tablet(Large)",
+ name: "Tablet (Landscape)",
type: "TABLET_LARGE",
- icon: "tablet",
+ icon: "tabletLandscape",
},
{
- name: "Tablet",
+ name: "Tablet (Portrait)",
type: "TABLET",
icon: "tablet",
},
|
38108cc0985ffdb0980506c11d3e2141a912510c
|
2022-02-05 00:51:45
|
dependabot[bot]
|
chore: bump postgresql in /app/server/appsmith-plugins/postgresPlugin (#10809)
| false
|
bump postgresql in /app/server/appsmith-plugins/postgresPlugin (#10809)
|
chore
|
diff --git a/app/server/appsmith-plugins/postgresPlugin/pom.xml b/app/server/appsmith-plugins/postgresPlugin/pom.xml
index 46e27d17d0aa..4b5723c4e8d0 100644
--- a/app/server/appsmith-plugins/postgresPlugin/pom.xml
+++ b/app/server/appsmith-plugins/postgresPlugin/pom.xml
@@ -33,7 +33,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>42.2.12</version>
+ <version>42.2.25</version>
</dependency>
<dependency>
|
b1ed82dbcf11f9cdd49814459368649f1b6518fd
|
2024-09-27 15:37:57
|
Rudraprasad Das
|
fix: fixed autocommit spec for airgap (#36579)
| false
|
fixed autocommit spec for airgap (#36579)
|
fix
|
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts
index 9d38aa357dcd..c55b51711cea 100644
--- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts
+++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts
@@ -1,5 +1,4 @@
import ReconnectLocators from "../../../../locators/ReconnectLocators";
-import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import {
agHelper,
gitSync,
@@ -7,7 +6,7 @@ import {
} from "../../../../support/Objects/ObjectsCore";
let wsName: string;
-let repoName: string = "TED-testrepo1";
+let repoName: string = "TED-autocommit-test-1";
describe(
"Git Autocommit",
@@ -15,8 +14,8 @@ describe(
tags: [
"@tag.Git",
"@tag.GitAutocommit",
- "@tag.excludeForAirgap",
"@tag.Sanity",
+ "@tag.TedMigration",
],
},
function () {
|
6f856b5ab5200901324b3833d070963872a365be
|
2024-07-11 15:37:25
|
Diljit
|
chore: Add newrelic tracking spans to AppViewer engine and AppEditor engine (#34716)
| false
|
Add newrelic tracking spans to AppViewer engine and AppEditor engine (#34716)
|
chore
|
diff --git a/app/client/src/UITelemetry/generateTraces.ts b/app/client/src/UITelemetry/generateTraces.ts
index 08b977a62dea..c051fa0840a6 100644
--- a/app/client/src/UITelemetry/generateTraces.ts
+++ b/app/client/src/UITelemetry/generateTraces.ts
@@ -76,15 +76,15 @@ export function startNestedSpan(
return generatorTrace.startSpan(spanName, spanOptions, parentContext);
}
-export function endSpan(span: Span) {
- span.end();
+export function endSpan(span?: Span) {
+ span?.end();
}
export function setAttributesToSpan(
- span: Span,
- spanAttributes: SpanAttributes,
+ span?: Span,
+ spanAttributes: SpanAttributes = {},
) {
- span.setAttributes(spanAttributes);
+ span?.setAttributes(spanAttributes);
}
export function wrapFnWithParentTraceContext(parentSpan: Span, fn: () => any) {
diff --git a/app/client/src/entities/Engine/AppEditorEngine.ts b/app/client/src/entities/Engine/AppEditorEngine.ts
index 407c72fa0b54..c5c91ac69a8c 100644
--- a/app/client/src/entities/Engine/AppEditorEngine.ts
+++ b/app/client/src/entities/Engine/AppEditorEngine.ts
@@ -66,6 +66,8 @@ import {
fetchAppThemesAction,
fetchSelectedAppThemeAction,
} from "actions/appThemingActions";
+import type { Span } from "@opentelemetry/api";
+import { endSpan, startNestedSpan } from "UITelemetry/generateTraces";
export default class AppEditorEngine extends AppEngine {
constructor(mode: APP_MODE) {
@@ -87,10 +89,17 @@ export default class AppEditorEngine extends AppEngine {
* @param AppEnginePayload
* @returns
*/
- public *setupEngine(payload: AppEnginePayload): any {
- yield* super.setupEngine.call(this, payload);
+ public *setupEngine(payload: AppEnginePayload, rootSpan: Span): any {
+ const editorSetupSpan = startNestedSpan(
+ "AppEditorEngine.setupEngine",
+ rootSpan,
+ );
+
+ yield* super.setupEngine.call(this, payload, rootSpan);
yield put(resetEditorSuccess());
CodemirrorTernService.resetServer();
+
+ endSpan(editorSetupSpan);
}
public startPerformanceTracking() {
@@ -109,7 +118,13 @@ export default class AppEditorEngine extends AppEngine {
toLoadPageId: string,
applicationId: string,
allResponses: EditConsolidatedApi,
+ rootSpan: Span,
) {
+ const loadPageThemesAndActionsSpan = startNestedSpan(
+ "AppEditorEngine.loadPageThemesAndActions",
+ rootSpan,
+ );
+
const {
currentTheme,
customJSLibraries,
@@ -157,13 +172,39 @@ export default class AppEditorEngine extends AppEngine {
`Unable to fetch actions for the application: ${applicationId}`,
);
+ const waitForUserSpan = startNestedSpan(
+ "AppEditorEngine.waitForFetchUserSuccess",
+ rootSpan,
+ );
yield call(waitForFetchUserSuccess);
+ endSpan(waitForUserSpan);
+
+ const waitForSegmentInitSpan = startNestedSpan(
+ "AppEditorEngine.waitForSegmentInit",
+ rootSpan,
+ );
yield call(waitForSegmentInit, true);
+ endSpan(waitForSegmentInitSpan);
+
+ const waitForFetchEnvironmentsSpan = startNestedSpan(
+ "AppEditorEngine.waitForFetchEnvironments",
+ rootSpan,
+ );
yield call(waitForFetchEnvironments);
+ endSpan(waitForFetchEnvironmentsSpan);
+
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
+ endSpan(loadPageThemesAndActionsSpan);
}
- private *loadPluginsAndDatasources(allResponses: EditConsolidatedApi) {
+ private *loadPluginsAndDatasources(
+ allResponses: EditConsolidatedApi,
+ rootSpan: Span,
+ ) {
+ const loadPluginsAndDatasourcesSpan = startNestedSpan(
+ "AppEditorEngine.loadPluginsAndDatasources",
+ rootSpan,
+ );
const { mockDatasources, pluginFormConfigs } = allResponses || {};
const isAirgappedInstance = isAirgapped();
const currentWorkspaceId: string = yield select(getCurrentWorkspaceId);
@@ -195,6 +236,9 @@ export default class AppEditorEngine extends AppEngine {
[ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_SUCCESS],
[ReduxActionErrorTypes.FETCH_PLUGIN_FORM_CONFIGS_ERROR],
);
+
+ endSpan(loadPluginsAndDatasourcesSpan);
+
if (!pluginFormCall)
throw new PluginFormConfigsNotFoundError(
"Unable to fetch plugin form configs",
@@ -205,17 +249,24 @@ export default class AppEditorEngine extends AppEngine {
toLoadPageId: string,
applicationId: string,
allResponses: EditConsolidatedApi,
+ rootSpan: Span,
): any {
yield call(
this.loadPageThemesAndActions,
toLoadPageId,
applicationId,
allResponses,
+ rootSpan,
);
- yield call(this.loadPluginsAndDatasources, allResponses);
+ yield call(this.loadPluginsAndDatasources, allResponses, rootSpan);
}
- public *completeChore() {
+ public *completeChore(rootSpan: Span) {
+ const completeChoreSpan = startNestedSpan(
+ "AppEditorEngine.completeChore",
+ rootSpan,
+ );
+
const isFirstTimeUserOnboardingComplete: boolean = yield select(
getFirstTimeUserOnboardingComplete,
);
@@ -272,9 +323,13 @@ export default class AppEditorEngine extends AppEngine {
yield put({
type: ReduxActionTypes.INITIALIZE_EDITOR_SUCCESS,
});
+
+ endSpan(completeChoreSpan);
}
- public *loadGit(applicationId: string) {
+ public *loadGit(applicationId: string, rootSpan: Span) {
+ const loadGitSpan = startNestedSpan("AppEditorEngine.loadGit", rootSpan);
+
const branchInStore: string = yield select(getCurrentGitBranch);
yield put(
restoreRecentEntitiesRequest({
@@ -285,10 +340,13 @@ export default class AppEditorEngine extends AppEngine {
// init of temporary remote url from old application
yield put(remoteUrlInputValue({ tempRemoteUrl: "" }));
// add branch query to path and fetch status
+
if (branchInStore) {
history.replace(addBranchParam(branchInStore));
yield fork(this.loadGitInBackground);
}
+
+ endSpan(loadGitSpan);
}
private *loadGitInBackground() {
diff --git a/app/client/src/entities/Engine/AppViewerEngine.ts b/app/client/src/entities/Engine/AppViewerEngine.ts
index b67a87267f2d..5f3c023d8f68 100644
--- a/app/client/src/entities/Engine/AppViewerEngine.ts
+++ b/app/client/src/entities/Engine/AppViewerEngine.ts
@@ -34,7 +34,8 @@ import {
fetchAppThemesAction,
fetchSelectedAppThemeAction,
} from "actions/appThemingActions";
-
+import type { Span } from "@opentelemetry/api";
+import { endSpan, startNestedSpan } from "UITelemetry/generateTraces";
export default class AppViewerEngine extends AppEngine {
constructor(mode: APP_MODE) {
super(mode);
@@ -50,16 +51,30 @@ export default class AppViewerEngine extends AppEngine {
return;
}
- *completeChore() {
+ *completeChore(rootSpan: Span) {
+ const completeChoreSpan = startNestedSpan(
+ "AppViewerEngine.completeChore",
+ rootSpan,
+ );
+
yield call(waitForWidgetConfigBuild);
yield put({
type: ReduxActionTypes.INITIALIZE_PAGE_VIEWER_SUCCESS,
});
yield spawn(reportSWStatus);
+
+ endSpan(completeChoreSpan);
}
- *setupEngine(payload: AppEnginePayload) {
- yield call(super.setupEngine.bind(this), payload);
+ *setupEngine(payload: AppEnginePayload, rootSpan: Span) {
+ const viewerSetupSpan = startNestedSpan(
+ "AppViewerEngine.setupEngine",
+ rootSpan,
+ );
+
+ yield call(super.setupEngine.bind(this), payload, rootSpan);
+
+ endSpan(viewerSetupSpan);
}
startPerformanceTracking() {
@@ -78,7 +93,13 @@ export default class AppViewerEngine extends AppEngine {
toLoadPageId: string,
applicationId: string,
allResponses: DeployConsolidatedApi,
+ rootSpan: Span,
): any {
+ const loadAppEntitiesSpan = startNestedSpan(
+ "AppViewerEngine.loadAppEntities",
+ rootSpan,
+ );
+
const {
currentTheme,
customJSLibraries,
@@ -128,9 +149,29 @@ export default class AppViewerEngine extends AppEngine {
`Unable to fetch actions for the application: ${applicationId}`,
);
+ const waitForUserSpan = startNestedSpan(
+ "AppViewerEngine.waitForFetchUserSuccess",
+ rootSpan,
+ );
yield call(waitForFetchUserSuccess);
+ endSpan(waitForUserSpan);
+
+ const waitForSegmentSpan = startNestedSpan(
+ "AppViewerEngine.waitForSegmentInit",
+ rootSpan,
+ );
yield call(waitForSegmentInit, true);
+ endSpan(waitForSegmentSpan);
+
+ const waitForEnvironmentsSpan = startNestedSpan(
+ "AppViewerEngine.waitForFetchEnvironments",
+ rootSpan,
+ );
yield call(waitForFetchEnvironments);
+ endSpan(waitForEnvironmentsSpan);
+
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
+
+ endSpan(loadAppEntitiesSpan);
}
}
diff --git a/app/client/src/entities/Engine/index.ts b/app/client/src/entities/Engine/index.ts
index a281fc67d8b1..6c8e9776a51f 100644
--- a/app/client/src/entities/Engine/index.ts
+++ b/app/client/src/entities/Engine/index.ts
@@ -19,6 +19,8 @@ import URLGeneratorFactory from "entities/URLRedirect/factory";
import { updateBranchLocally } from "actions/gitSyncActions";
import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import { restoreIDEEditorViewMode } from "actions/ideActions";
+import type { Span } from "@opentelemetry/api";
+import { endSpan, startNestedSpan } from "UITelemetry/generateTraces";
export interface AppEnginePayload {
applicationId?: string;
@@ -29,10 +31,14 @@ export interface AppEnginePayload {
}
export interface IAppEngine {
- setupEngine(payload: AppEnginePayload): any;
- loadAppData(payload: AppEnginePayload): any;
+ setupEngine(payload: AppEnginePayload, rootSpan: Span): any;
+ loadAppData(payload: AppEnginePayload, rootSpan: Span): any;
loadAppURL(pageId: string, pageIdInUrl?: string): any;
- loadAppEntities(toLoadPageId: string, applicationId: string): any;
+ loadAppEntities(
+ toLoadPageId: string,
+ applicationId: string,
+ rootSpan: Span,
+ ): any;
loadGit(applicationId: string): any;
completeChore(): any;
}
@@ -55,13 +61,19 @@ export default abstract class AppEngine {
toLoadPageId: string,
applicationId: string,
allResponses: InitConsolidatedApi,
+ rootSpan: Span,
): any;
- abstract loadGit(applicationId: string): any;
+ abstract loadGit(applicationId: string, rootSpan: Span): any;
abstract startPerformanceTracking(): any;
abstract stopPerformanceTracking(): any;
- abstract completeChore(): any;
+ abstract completeChore(rootSpan: Span): any;
- *loadAppData(payload: AppEnginePayload, allResponses: InitConsolidatedApi) {
+ *loadAppData(
+ payload: AppEnginePayload,
+ allResponses: InitConsolidatedApi,
+ rootSpan: Span,
+ ) {
+ const loadAppDataSpan = startNestedSpan("AppEngine.loadAppData", rootSpan);
const { applicationId, branch, pageId } = payload;
const { pages } = allResponses;
const apiCalls: boolean = yield failFastApiCalls(
@@ -82,8 +94,11 @@ export default abstract class AppEngine {
ReduxActionErrorTypes.FETCH_PAGE_LIST_ERROR,
],
);
- if (!apiCalls)
+
+ if (!apiCalls) {
throw new PageNotFoundError(`Cannot find page with id: ${pageId}`);
+ }
+
const application: ApplicationPayload = yield select(getCurrentApplication);
const currentGitBranch: ReturnType<typeof getCurrentGitBranch> =
yield select(getCurrentGitBranch);
@@ -97,25 +112,44 @@ export default abstract class AppEngine {
application.applicationVersion,
this._mode,
);
+
+ endSpan(loadAppDataSpan);
return { toLoadPageId, applicationId: application.id };
}
- *setupEngine(payload: AppEnginePayload): any {
+ *setupEngine(payload: AppEnginePayload, rootSpan: Span): any {
+ const setupEngineSpan = startNestedSpan("AppEngine.setupEngine", rootSpan);
+
const { branch } = payload;
yield put(updateBranchLocally(branch || ""));
yield put(setAppMode(this._mode));
yield put(restoreIDEEditorViewMode());
yield put({ type: ReduxActionTypes.START_EVALUATION });
+
+ endSpan(setupEngineSpan);
}
- *loadAppURL(pageId: string, pageIdInUrl?: string) {
+ *loadAppURL({
+ pageId,
+ pageIdInUrl,
+ rootSpan,
+ }: {
+ pageId: string;
+ pageIdInUrl?: string;
+ rootSpan: Span;
+ }) {
try {
if (!this._urlRedirect) return;
+
+ const loadAppUrlSpan = startNestedSpan("AppEngine.loadAppURL", rootSpan);
const newURL: string = yield call(
this._urlRedirect.generateRedirectURL.bind(this),
pageId,
pageIdInUrl,
);
+
+ endSpan(loadAppUrlSpan);
+
if (!newURL) return;
history.replace(newURL);
} catch (e) {
diff --git a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts
index b39ccdf54bf9..5de49ecf7b6a 100644
--- a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts
+++ b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts
@@ -535,10 +535,11 @@ export default function* executePluginActionTriggerSaga(
},
actionId,
);
- span &&
- setAttributesToSpan(span, {
- actionId: actionId,
- });
+
+ setAttributesToSpan(span, {
+ actionId: actionId,
+ });
+
const action = shouldBeDefined<Action>(
yield select(getAction, actionId),
`Action not found for id - ${actionId}`,
@@ -1262,7 +1263,7 @@ function* executePageLoadActionsSaga(
getLayoutOnLoadIssues,
);
const actionCount = flatten(pageActions).length;
- span && setAttributesToSpan(span, { numActions: actionCount });
+ setAttributesToSpan(span, { numActions: actionCount });
// when cyclical depedency issue is there,
// none of the page load actions would be executed
PerformanceTracker.startAsyncTracking(
@@ -1320,11 +1321,12 @@ function* executePluginActionSaga(
) {
const actionId = pluginAction.id;
const pluginActionNameToDisplay = getPluginActionNameToDisplay(pluginAction);
- parentSpan &&
- setAttributesToSpan(parentSpan, {
- actionId,
- pluginName: pluginActionNameToDisplay,
- });
+
+ setAttributesToSpan(parentSpan, {
+ actionId,
+ pluginName: pluginActionNameToDisplay,
+ });
+
if (pluginAction.confirmBeforeExecute) {
const modalPayload = {
name: pluginActionNameToDisplay,
diff --git a/app/client/src/sagas/InitSagas.ts b/app/client/src/sagas/InitSagas.ts
index 7598b4d4a66d..f6081ce82813 100644
--- a/app/client/src/sagas/InitSagas.ts
+++ b/app/client/src/sagas/InitSagas.ts
@@ -85,6 +85,11 @@ import type { Datasource } from "entities/Datasource";
import type { Plugin, PluginFormPayload } from "api/PluginApi";
import ConsolidatedPageLoadApi from "api/ConsolidatedPageLoadApi";
import { axiosConnectionAbortedCode } from "@appsmith/api/ApiUtils";
+import {
+ endSpan,
+ startNestedSpan,
+ startRootSpan,
+} from "UITelemetry/generateTraces";
export const URL_CHANGE_ACTIONS = [
ReduxActionTypes.CURRENT_APPLICATION_NAME_UPDATE,
@@ -284,32 +289,56 @@ export function* getInitResponses({
}
export function* startAppEngine(action: ReduxAction<AppEnginePayload>) {
+ const rootSpan = startRootSpan("startAppEngine", {
+ mode: action.payload.mode,
+ pageId: action.payload.pageId,
+ applicationId: action.payload.applicationId,
+ branch: action.payload.branch,
+ });
+
try {
const engine: AppEngine = AppEngineFactory.create(
action.payload.mode,
action.payload.mode,
);
engine.startPerformanceTracking();
- yield call(engine.setupEngine, action.payload);
+ yield call(engine.setupEngine, action.payload, rootSpan);
+
+ const getInitResponsesSpan = startNestedSpan(
+ "getInitResponsesSpan",
+ rootSpan,
+ );
+
const allResponses: InitConsolidatedApi = yield call(getInitResponses, {
...action.payload,
});
+
+ endSpan(getInitResponsesSpan);
+
yield put({ type: ReduxActionTypes.LINT_SETUP });
+
const { applicationId, toLoadPageId } = yield call(
engine.loadAppData,
action.payload,
allResponses,
+ rootSpan,
);
- yield call(engine.loadAppURL, toLoadPageId, action.payload.pageId);
+
+ yield call(engine.loadAppURL, {
+ pageId: toLoadPageId,
+ pageIdInUrl: action.payload.pageId,
+ rootSpan,
+ });
yield call(
engine.loadAppEntities,
toLoadPageId,
applicationId,
allResponses,
+ rootSpan,
);
- yield call(engine.loadGit, applicationId);
- yield call(engine.completeChore);
+ yield call(engine.loadGit, applicationId, rootSpan);
+ yield call(engine.completeChore, rootSpan);
yield put(generateAutoHeightLayoutTreeAction(true, false));
engine.stopPerformanceTracking();
} catch (e) {
@@ -317,6 +346,8 @@ export function* startAppEngine(action: ReduxAction<AppEnginePayload>) {
if (e instanceof AppEngineApiError) return;
Sentry.captureException(e);
yield put(safeCrashAppRequest());
+ } finally {
+ endSpan(rootSpan);
}
}
diff --git a/app/client/src/sagas/__tests__/initSagas.test.ts b/app/client/src/sagas/__tests__/initSagas.test.ts
index 1a8883cefbd6..4b365b9d9865 100644
--- a/app/client/src/sagas/__tests__/initSagas.test.ts
+++ b/app/client/src/sagas/__tests__/initSagas.test.ts
@@ -10,6 +10,7 @@ import type { AppEnginePayload } from "entities/Engine";
import { testSaga } from "redux-saga-test-plan";
import { generateAutoHeightLayoutTreeAction } from "actions/autoHeightActions";
import mockResponse from "./mockConsolidatedApiResponse.json";
+import { startRootSpan } from "UITelemetry/generateTraces";
jest.mock("../../api/Api", () => ({
__esModule: true,
@@ -50,33 +51,40 @@ describe("tests the sagas in initSagas", () => {
stopPerformanceTracking: jest.fn(),
};
+ const mockRootSpan = startRootSpan("startAppEngine");
+
(AppEngineFactory.create as jest.Mock).mockReturnValue(engine);
testSaga(startAppEngine, action)
.next()
- .call(engine.setupEngine, action.payload)
+ .call(engine.setupEngine, action.payload, mockRootSpan)
.next()
.call(getInitResponses, { ...action.payload })
.next(mockResponse.data)
.put({ type: ReduxActionTypes.LINT_SETUP })
.next()
- .call(engine.loadAppData, action.payload, mockResponse.data)
+ .call(engine.loadAppData, action.payload, mockResponse.data, mockRootSpan)
.next({
applicationId: action.payload.applicationId,
toLoadPageId: action.payload.pageId,
})
- .call(engine.loadAppURL, action.payload.pageId, action.payload.pageId)
+ .call(engine.loadAppURL, {
+ pageId: action.payload.pageId,
+ pageIdInUrl: action.payload.pageId,
+ rootSpan: mockRootSpan,
+ })
.next()
.call(
engine.loadAppEntities,
action.payload.pageId,
action.payload.applicationId,
mockResponse.data,
+ mockRootSpan,
)
.next()
- .call(engine.loadGit, action.payload.applicationId)
+ .call(engine.loadGit, action.payload.applicationId, mockRootSpan)
.next()
- .call(engine.completeChore)
+ .call(engine.completeChore, mockRootSpan)
.next()
.put(generateAutoHeightLayoutTreeAction(true, false))
.next()
|
18fbb0ebc7a381efbd1104bce6d0d0cbf9c675fe
|
2023-07-04 11:07:43
|
Sumit Kumar
|
fix: Mongo plugin: fix test datasource with URI (#24894)
| false
|
Mongo plugin: fix test datasource with URI (#24894)
|
fix
|
diff --git a/app/client/cypress/e2e/Sanity/Datasources/MongoDatasourceURI_spec.ts b/app/client/cypress/e2e/Sanity/Datasources/MongoDatasourceURI_spec.ts
new file mode 100644
index 000000000000..7904586f1781
--- /dev/null
+++ b/app/client/cypress/e2e/Sanity/Datasources/MongoDatasourceURI_spec.ts
@@ -0,0 +1,23 @@
+import { agHelper, dataSources } from "../../../support/Objects/ObjectsCore";
+
+let dsName: any;
+
+// TODO: add another test case to test URI with username and password when the following issue is fixed:
+// https://github.com/appsmithorg/TestEventDriver/issues/40
+describe("Create, test, save then delete a mongo datasource using URI", function () {
+ it("1. Create, test, save then delete a mongo datasource using URI without username and password - #24897 ", function () {
+ dataSources.NavigateToDSCreateNew();
+ agHelper.GenerateUUID();
+ cy.get("@guid").then((uid) => {
+ // using CreatePlugIn function instead of CreateDatasource,
+ // because I do not need to fill the datasource form and use the same default data
+ dataSources.CreatePlugIn("MongoDB");
+ dsName = "Mongo" + uid;
+ agHelper.RenameWithInPane(dsName, false);
+
+ dataSources.FillMongoDatasourceFormWithURI();
+ dataSources.TestSaveDatasource(true);
+ dataSources.DeleteDatasouceFromActiveTab(dsName);
+ });
+ });
+});
diff --git a/app/client/cypress/fixtures/datasources.json b/app/client/cypress/fixtures/datasources.json
index 3cfa9433914f..f84aa6368fd4 100644
--- a/app/client/cypress/fixtures/datasources.json
+++ b/app/client/cypress/fixtures/datasources.json
@@ -3,7 +3,7 @@
"mongo-host": "host.docker.internal",
"mongo-port": 28017,
"mongo-databaseName": "mongo_samples",
- "mongo-uri": "mongodb+srv://localhost:[email protected]/mock?retryWrites=true&w=majority",
+ "mongo-uri": "mongodb://host.docker.internal:28017/mongo_samples?retryWrites=true&w=majority",
"postgres-host": "host.docker.internal",
"postgres-port": 5432,
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/PluginConstants.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/PluginConstants.java
index fbf25c10d207..4609cfee8ce7 100644
--- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/PluginConstants.java
+++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/PluginConstants.java
@@ -12,6 +12,8 @@ interface PackageName {
String GOOGLE_SHEETS_PLUGIN = "google-sheets-plugin";
}
+ public static final String DEFAULT_REST_DATASOURCE = "DEFAULT_REST_DATASOURCE";
+
interface PluginName {
public static final String S3_PLUGIN_NAME = "S3";
public static final String ARANGO_PLUGIN_NAME = "Arango";
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStorage.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStorage.java
index 9c41305c451f..f4753abd6416 100644
--- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStorage.java
+++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStorage.java
@@ -15,6 +15,8 @@
import java.util.Map;
import java.util.Set;
+import static com.appsmith.external.constants.PluginConstants.DEFAULT_REST_DATASOURCE;
+
@Getter
@Setter
@AllArgsConstructor
@@ -168,6 +170,11 @@ public void sanitiseToExportResource(Map<String, String> pluginMap) {
}
public boolean isEmbedded() {
- return this.getDatasourceId() == null;
+ /**
+ * We cannot just rely on datasourceId == null check because it will always be true for all cases when the
+ * user clicks on `test datasource` button.
+ * DEFAULT_REST_DATASOURCE is the embedded datasource name for both REST API plugin and GraphQL plugin.
+ */
+ return DEFAULT_REST_DATASOURCE.equals(this.name) && this.getDatasourceId() == null;
}
}
diff --git a/app/server/appsmith-interfaces/src/test/java/com/appsmith/external/models/DatasourceStorageTest.java b/app/server/appsmith-interfaces/src/test/java/com/appsmith/external/models/DatasourceStorageTest.java
new file mode 100644
index 000000000000..bb8708a3be43
--- /dev/null
+++ b/app/server/appsmith-interfaces/src/test/java/com/appsmith/external/models/DatasourceStorageTest.java
@@ -0,0 +1,29 @@
+package com.appsmith.external.models;
+
+import org.junit.jupiter.api.Test;
+
+import static com.appsmith.external.constants.PluginConstants.DEFAULT_REST_DATASOURCE;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class DatasourceStorageTest {
+ @Test
+ public void testIsEmbeddedDatasourceWithNameMismatch() {
+ DatasourceStorage datasourceStorage = new DatasourceStorage();
+ assertFalse(datasourceStorage.isEmbedded());
+ }
+
+ @Test
+ public void testIsEmbeddedDatasourceWithNonNullId() {
+ DatasourceStorage datasourceStorage = new DatasourceStorage();
+ datasourceStorage.setDatasourceId("id");
+ assertFalse(datasourceStorage.isEmbedded());
+ }
+
+ @Test
+ public void testIsEmbeddedDatasourceWithNullIdAndNameMatch() {
+ DatasourceStorage datasourceStorage = new DatasourceStorage();
+ datasourceStorage.setName(DEFAULT_REST_DATASOURCE);
+ assertTrue(datasourceStorage.isEmbedded());
+ }
+}
diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java b/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java
index 50eafa6d99cd..7fd7a127f929 100644
--- a/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java
+++ b/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java
@@ -120,6 +120,7 @@
import static com.external.plugins.utils.DatasourceUtils.KEY_PASSWORD;
import static com.external.plugins.utils.DatasourceUtils.KEY_URI_DEFAULT_DBNAME;
import static com.external.plugins.utils.DatasourceUtils.KEY_USERNAME;
+import static com.external.plugins.utils.DatasourceUtils.MONGO_URI_REGEX;
import static com.external.plugins.utils.DatasourceUtils.buildClientURI;
import static com.external.plugins.utils.DatasourceUtils.buildURIFromExtractedInfo;
import static com.external.plugins.utils.DatasourceUtils.extractInfoFromConnectionStringURI;
@@ -156,14 +157,6 @@ public class MongoPlugin extends BasePlugin {
private static final int TEST_DATASOURCE_TIMEOUT_SECONDS = 15;
- /*
- * - The regex matches the following two pattern types:
- * - mongodb+srv://user:pass@some-url/some-db...
- * - mongodb://user:pass@some-url:port,some-url:port,.../some-db...
- * - It has been grouped like this: (mongodb+srv://)(user):(pass)@(some-url)/(some-db...)?(params...)
- */
- private static final String MONGO_URI_REGEX = "^(mongodb(?:\\+srv)?://)(?:(.+):(.+)@)?([^/?]+)/?([^?]+)?\\??(.+)?$";
-
/**
* We use this regex to identify the $regex attribute and the respective argument provided:
* e.g. {"code" : {$regex: value, $options: value}} / {"code" : {$regex: value}}
diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/utils/DatasourceUtils.java b/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/utils/DatasourceUtils.java
index ba5256ff4d56..23c6f3ee8a77 100644
--- a/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/utils/DatasourceUtils.java
+++ b/app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/utils/DatasourceUtils.java
@@ -31,19 +31,20 @@ public class DatasourceUtils {
* - mongodb://user:pass@some-url:port,some-url:port,.../some-db...
* - It has been grouped like this: (mongodb+srv://)(user):(pass)@(some-url)/(some-db...)?(params...)
*/
- private static final String MONGO_URI_REGEX = "^(mongodb(?:\\+srv)?:\\/\\/)(?:(.+):(.+)@)?([^\\/\\?]+)\\/?([^\\?]+)?\\??(.+)?$";
+ public static final String MONGO_URI_REGEX = "^(mongodb(?:\\+srv)?://)(?:((.+):(.+))?@)?([^/?]+)/?([^?]+)?\\??(" +
+ ".+)?$";
private static final int REGEX_GROUP_HEAD = 1;
- private static final int REGEX_GROUP_USERNAME = 2;
+ private static final int REGEX_GROUP_USERNAME = 3;
- private static final int REGEX_GROUP_PASSWORD = 3;
+ private static final int REGEX_GROUP_PASSWORD = 4;
- private static final int REGEX_HOST_PORT = 4;
+ private static final int REGEX_HOST_PORT = 5;
- private static final int REGEX_GROUP_DBNAME = 5;
+ private static final int REGEX_GROUP_DBNAME = 6;
- private static final int REGEX_GROUP_TAIL = 6;
+ private static final int REGEX_GROUP_TAIL = 7;
public static final String KEY_USERNAME = "username";
diff --git a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginDatasourceTest.java b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginDatasourceTest.java
index 72be9def4ff0..8b717f922a7e 100644
--- a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginDatasourceTest.java
+++ b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginDatasourceTest.java
@@ -2,90 +2,52 @@
import com.appsmith.external.dtos.ExecuteActionDTO;
import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError;
-import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException;
-import com.appsmith.external.exceptions.pluginExceptions.StaleConnectionException;
-import com.appsmith.external.helpers.PluginUtils;
import com.appsmith.external.models.ActionConfiguration;
-import com.appsmith.external.models.ActionExecutionRequest;
import com.appsmith.external.models.ActionExecutionResult;
import com.appsmith.external.models.Connection;
import com.appsmith.external.models.DBAuth;
import com.appsmith.external.models.DatasourceConfiguration;
-import com.appsmith.external.models.DatasourceStructure;
import com.appsmith.external.models.DatasourceTestResult;
import com.appsmith.external.models.Endpoint;
-import com.appsmith.external.models.Param;
import com.appsmith.external.models.ParsedDataType;
import com.appsmith.external.models.Property;
-import com.appsmith.external.models.RequestParamDTO;
import com.appsmith.external.models.SSLDetails;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.mongodb.DBRef;
import com.mongodb.MongoCommandException;
-import com.mongodb.MongoSecurityException;
-import com.mongodb.MongoSocketWriteException;
import com.mongodb.reactivestreams.client.MongoClient;
-import com.mongodb.reactivestreams.client.MongoClients;
-import com.mongodb.reactivestreams.client.MongoCollection;
-import com.mongodb.reactivestreams.client.MongoDatabase;
-import org.bson.Document;
-import org.bson.types.BSONTimestamp;
-import org.bson.types.Decimal128;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
-import java.math.BigDecimal;
-import java.sql.Date;
-import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import static com.appsmith.external.constants.ActionConstants.ACTION_CONFIGURATION_BODY;
import static com.appsmith.external.constants.DisplayDataType.JSON;
import static com.appsmith.external.constants.DisplayDataType.RAW;
-import static com.appsmith.external.helpers.PluginUtils.OBJECT_TYPE;
-import static com.appsmith.external.helpers.PluginUtils.STRING_TYPE;
-import static com.appsmith.external.helpers.PluginUtils.getDataValueSafelyFromFormData;
import static com.appsmith.external.helpers.PluginUtils.setDataValueSafelyInFormData;
-import static com.external.plugins.constants.FieldName.AGGREGATE_LIMIT;
-import static com.external.plugins.constants.FieldName.AGGREGATE_PIPELINES;
import static com.external.plugins.constants.FieldName.BODY;
-import static com.external.plugins.constants.FieldName.COLLECTION;
import static com.external.plugins.constants.FieldName.COMMAND;
-import static com.external.plugins.constants.FieldName.COUNT_QUERY;
-import static com.external.plugins.constants.FieldName.DELETE_LIMIT;
-import static com.external.plugins.constants.FieldName.DELETE_QUERY;
-import static com.external.plugins.constants.FieldName.DISTINCT_KEY;
-import static com.external.plugins.constants.FieldName.DISTINCT_QUERY;
-import static com.external.plugins.constants.FieldName.FIND_LIMIT;
-import static com.external.plugins.constants.FieldName.FIND_PROJECTION;
-import static com.external.plugins.constants.FieldName.FIND_QUERY;
-import static com.external.plugins.constants.FieldName.INSERT_DOCUMENT;
import static com.external.plugins.constants.FieldName.SMART_SUBSTITUTION;
-import static com.external.plugins.constants.FieldName.UPDATE_LIMIT;
-import static com.external.plugins.constants.FieldName.UPDATE_OPERATION;
-import static com.external.plugins.constants.FieldName.UPDATE_QUERY;
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static com.external.plugins.utils.DatasourceUtils.KEY_HOST_PORT;
+import static com.external.plugins.utils.DatasourceUtils.KEY_PASSWORD;
+import static com.external.plugins.utils.DatasourceUtils.KEY_URI_DEFAULT_DBNAME;
+import static com.external.plugins.utils.DatasourceUtils.KEY_URI_HEAD;
+import static com.external.plugins.utils.DatasourceUtils.KEY_URI_TAIL;
+import static com.external.plugins.utils.DatasourceUtils.KEY_USERNAME;
+import static com.external.plugins.utils.DatasourceUtils.MONGO_URI_REGEX;
+import static com.external.plugins.utils.DatasourceUtils.extractInfoFromConnectionStringURI;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -102,8 +64,6 @@ public class MongoPluginDatasourceTest {
private static String address;
private static Integer port;
- private JsonNode value;
- private static MongoClient mongoClient;
@SuppressWarnings("rawtypes")
@Container
@@ -113,9 +73,6 @@ public class MongoPluginDatasourceTest {
public static void setUp() {
address = mongoContainer.getContainerIpAddress();
port = mongoContainer.getFirstMappedPort();
- String uri = "mongodb://" + address + ":" + port;
- mongoClient = MongoClients.create(uri);
-
}
private DatasourceConfiguration createDatasourceConfiguration() {
@@ -459,4 +416,42 @@ public void testValidateDatasource_withoutDefaultDBInURIString_returnsInvalid()
assertTrue(strings.contains("Missing default database name."));
}
+ @Test
+ public void testURIRegexPassWithValidURIWithUsernamePassword() {
+ String uri = "mongodb://user:pass@localhost:28017/mongo_samples?w=majority&retrywrites=true&authsource=admin" +
+ "&minpoolsize=0";
+ Map extractedInfo = extractInfoFromConnectionStringURI(uri, MONGO_URI_REGEX);
+ assertEquals("mongodb://", extractedInfo.get(KEY_URI_HEAD));
+ assertEquals("user", extractedInfo.get(KEY_USERNAME));
+ assertEquals("pass", extractedInfo.get(KEY_PASSWORD));
+ assertEquals("localhost:28017", extractedInfo.get(KEY_HOST_PORT));
+ assertEquals("mongo_samples", extractedInfo.get(KEY_URI_DEFAULT_DBNAME));
+ assertEquals("w=majority&retrywrites=true&authsource=admin&minpoolsize=0", extractedInfo.get(KEY_URI_TAIL));
+ }
+
+ @Test
+ public void testURIRegexPassWithValidURIWithoutUsernamePassword() {
+ String uri = "mongodb://@localhost:28017/mongo_samples?w=majority&retrywrites=true&authsource=admin" +
+ "&minpoolsize=0";
+ Map extractedInfo = extractInfoFromConnectionStringURI(uri, MONGO_URI_REGEX);
+ assertEquals("mongodb://", extractedInfo.get(KEY_URI_HEAD));
+ assertEquals(null, extractedInfo.get(KEY_USERNAME));
+ assertEquals(null, extractedInfo.get(KEY_PASSWORD));
+ assertEquals("localhost:28017", extractedInfo.get(KEY_HOST_PORT));
+ assertEquals("mongo_samples", extractedInfo.get(KEY_URI_DEFAULT_DBNAME));
+ assertEquals("w=majority&retrywrites=true&authsource=admin&minpoolsize=0", extractedInfo.get(KEY_URI_TAIL));
+ }
+
+ @Test
+ public void testURIRegexPassWithValidURIWithoutAtUsernamePassword() {
+ String uri = "mongodb://localhost:28017/mongo_samples?w=majority&retrywrites=true&authsource=admin" +
+ "&minpoolsize=0";
+ Map extractedInfo = extractInfoFromConnectionStringURI(uri, MONGO_URI_REGEX);
+ assertEquals("mongodb://", extractedInfo.get(KEY_URI_HEAD));
+ assertEquals(null, extractedInfo.get(KEY_USERNAME));
+ assertEquals(null, extractedInfo.get(KEY_PASSWORD));
+ assertEquals("localhost:28017", extractedInfo.get(KEY_HOST_PORT));
+ assertEquals("mongo_samples", extractedInfo.get(KEY_URI_DEFAULT_DBNAME));
+ assertEquals("w=majority&retrywrites=true&authsource=admin&minpoolsize=0", extractedInfo.get(KEY_URI_TAIL));
+ }
}
\ No newline at end of file
|
cf5b36a630ceedf5052abc9da2475e01c8b7e9b4
|
2024-05-27 15:20:20
|
yatinappsmith
|
ci: CI-Test-Result should fail depending on unit tests (#33643)
| false
|
CI-Test-Result should fail depending on unit tests (#33643)
|
ci
|
diff --git a/.github/workflows/test-build-docker-image.yml b/.github/workflows/test-build-docker-image.yml
index 0f8afa6cb59d..c769ee67ed37 100644
--- a/.github/workflows/test-build-docker-image.yml
+++ b/.github/workflows/test-build-docker-image.yml
@@ -264,12 +264,24 @@ jobs:
- name: Return status for ui-matrix
run: |
- if [[ "${{ needs.ci-test.result }}" == "success" ]]; then
- echo "Integration tests completed successfully!";
+ if [[ "${{ needs.ci-test.result }}" == "success" && "${{ needs.client-unit-tests.result }}" == "success" && "${{ needs.server-unit-tests.result }}" == "success" ]]; then
+ echo "Integration, Client unit and Server unit tests completed successfully!";
exit 0;
elif [[ "${{ needs.ci-test.result }}" == "skipped" ]]; then
echo "Integration tests were skipped";
exit 1;
+ elif [[ "${{ needs.client-unit-tests.result }}" == "skipped" ]]; then
+ echo "Client unit tests were skipped";
+ exit 1;
+ elif [[ "${{ needs.server-unit-tests.result }}" == "skipped" ]]; then
+ echo "Server unit tests were skipped";
+ exit 1;
+ elif [[ "${{ needs.client-unit-tests.result }}" == "failure" ]]; then
+ echo "Client unit tests have failed";
+ exit 1;
+ elif [[ "${{ needs.server-unit-tests.result }}" == "failure" ]]; then
+ echo "Server unit tests have failed";
+ exit 1;
else
echo "Integration tests have failed";
exit 1;
|
f413924fd4847e037acd3a26d8b9315942042853
|
2021-08-04 15:36:13
|
akash-codemonk
|
fix: Keep inspect entity in sync with the widget selection in the entity explorer
| false
|
Keep inspect entity in sync with the widget selection in the entity explorer
|
fix
|
diff --git a/app/client/src/components/editorComponents/Debugger/hooks.ts b/app/client/src/components/editorComponents/Debugger/hooks.ts
index 84c5abd1579d..c15b0d3a2a14 100644
--- a/app/client/src/components/editorComponents/Debugger/hooks.ts
+++ b/app/client/src/components/editorComponents/Debugger/hooks.ts
@@ -12,10 +12,6 @@ import {
getCurrentPageId,
} from "selectors/editorSelectors";
import { getAction, getDatasource } from "selectors/entitiesSelector";
-import {
- getCurrentWidgetId,
- getIsPropertyPaneVisible,
-} from "selectors/propertyPaneSelectors";
import { isWidget, isAction } from "workers/evaluationUtils";
import {
onApiEditor,
@@ -24,6 +20,7 @@ import {
doesEntityHaveErrors,
} from "./helpers";
import history from "utils/history";
+import { getSelectedWidget } from "selectors/ui";
import { getDebuggerErrors } from "selectors/debuggerSelectors";
import { isEqual, keyBy } from "lodash";
import {
@@ -94,10 +91,9 @@ export const useSelectedEntity = () => {
return null;
});
- const isPropertyPaneVisible = useSelector(getIsPropertyPaneVisible);
- const selectedWidget = useSelector(getCurrentWidgetId);
+ const selectedWidget = useSelector(getSelectedWidget);
const widget = useSelector((state: AppState) => {
- if (onCanvas(applicationId, currentPageId) && isPropertyPaneVisible) {
+ if (onCanvas(applicationId, currentPageId)) {
return selectedWidget ? getWidget(state, selectedWidget) : null;
}
|
5db7aa0fa18377cd8c177e0bab5539420ba2c709
|
2022-09-11 20:50:59
|
Arpit Mohan
|
ci: Reverting the permission check on ok-to-test
| false
|
Reverting the permission check on ok-to-test
|
ci
|
diff --git a/.github/workflows/ok-to-test.yml b/.github/workflows/ok-to-test.yml
index 7f1da6561af6..040cc36c2c1f 100644
--- a/.github/workflows/ok-to-test.yml
+++ b/.github/workflows/ok-to-test.yml
@@ -30,4 +30,4 @@ jobs:
commands: |
ok-to-test
perf-test
- permission: write
+ permission: none
|
291481b1218921f50a6884cfc816e156dfe1d1a5
|
2023-10-30 08:45:19
|
Diljit
|
chore: Remove ask ai in action creator fields (#28230)
| false
|
Remove ask ai in action creator fields (#28230)
|
chore
|
diff --git a/app/client/src/components/editorComponents/ActionCreator/viewComponents/TextView/index.tsx b/app/client/src/components/editorComponents/ActionCreator/viewComponents/TextView/index.tsx
index 750dba1c5292..e3f90deac972 100644
--- a/app/client/src/components/editorComponents/ActionCreator/viewComponents/TextView/index.tsx
+++ b/app/client/src/components/editorComponents/ActionCreator/viewComponents/TextView/index.tsx
@@ -65,6 +65,7 @@ export function TextView(props: TextViewProps) {
<InputText
additionalAutocomplete={props.additionalAutoComplete}
dataTreePath={props.dataTreePath}
+ enableAI={false}
evaluatedValue={value}
expected={{
type: "string",
diff --git a/app/client/src/components/propertyControls/InputTextControl.tsx b/app/client/src/components/propertyControls/InputTextControl.tsx
index 73689d994b6c..5be2b7888b8a 100644
--- a/app/client/src/components/propertyControls/InputTextControl.tsx
+++ b/app/client/src/components/propertyControls/InputTextControl.tsx
@@ -31,9 +31,11 @@ export function InputText(props: {
additionalAutocomplete?: AdditionalDynamicDataTree;
theme?: EditorTheme;
hideEvaluatedValue?: boolean;
+ enableAI?: boolean;
}) {
const {
dataTreePath,
+ enableAI = true,
evaluatedValue,
expected,
hideEvaluatedValue,
@@ -51,7 +53,7 @@ export function InputText(props: {
return (
<StyledDynamicInput>
<LazyCodeEditor
- AIAssisted
+ AIAssisted={enableAI}
additionalDynamicData={props.additionalAutocomplete}
border={CodeEditorBorder.ALL_SIDE}
dataTreePath={dataTreePath}
diff --git a/app/client/src/utils/storage.ts b/app/client/src/utils/storage.ts
index d6bf0a21aed4..2625f8ea626a 100644
--- a/app/client/src/utils/storage.ts
+++ b/app/client/src/utils/storage.ts
@@ -281,7 +281,7 @@ export const setAIRecentQuery = async (
let applicationTypeQueries = applicationRecentQueries[type] || [];
if (!applicationTypeQueries.includes(query)) {
- if (applicationTypeQueries.length >= 5) {
+ if (applicationTypeQueries.length >= 3) {
applicationTypeQueries.pop();
}
applicationTypeQueries = [query, ...applicationTypeQueries];
@@ -312,7 +312,10 @@ export const getApplicationAIRecentQueriesByType = async (
[task: string]: string[];
};
} | null = await store.getItem(STORAGE_KEYS.AI_RECENT_QUERIES);
- return recentQueries?.[applicationId]?.[type] ?? defaultRecentQueries;
+ return (
+ recentQueries?.[applicationId]?.[type]?.slice(0, 3) ??
+ defaultRecentQueries
+ );
} catch (error) {
log.error("An error occurred while fetching AI_RECENT_QUERIES");
log.error(error);
|
93b13243352cfc0df51ec5804c58d18ead6d79e0
|
2024-03-04 16:10:07
|
Shrikant Sharat Kandula
|
chore: Support configurable body max size in Caddyfile (#31461)
| false
|
Support configurable body max size in Caddyfile (#31461)
|
chore
|
diff --git a/deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs b/deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs
index 68a199a4d727..193c61b38c06 100644
--- a/deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs
+++ b/deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs
@@ -73,7 +73,7 @@ parts.push(`
}
request_body {
- max_size 150MB
+ max_size ${process.env.APPSMITH_CODEC_SIZE || 150}MB
}
handle {
|
c1da8a68666b111de3db2fb10e6321b310249e37
|
2022-06-09 17:17:47
|
rahulramesha
|
fix: paste widgets on a new page (#14295)
| false
|
paste widgets on a new page (#14295)
|
fix
|
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/WidgetCopyPaste/WidgetCopyPaste_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/WidgetCopyPaste/WidgetCopyPaste_spec.js
index 5d809a5c38bf..90867ed75cbf 100644
--- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/WidgetCopyPaste/WidgetCopyPaste_spec.js
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/WidgetCopyPaste/WidgetCopyPaste_spec.js
@@ -2,6 +2,7 @@ const widgetsPage = require("../../../../locators/Widgets.json");
const commonLocators = require("../../../../locators/commonlocators.json");
const explorer = require("../../../../locators/explorerlocators.json");
const dsl = require("../../../../fixtures/WidgetCopyPaste.json");
+const generatePage = require("../../../../locators/GeneratePage.json");
describe("Widget Copy paste", function() {
const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl";
@@ -152,4 +153,17 @@ describe("Widget Copy paste", function() {
.find(widgetsPage.listWidget)
.should("have.length", 0);
});
+
+ it("should be able to paste widget on the initial generate Page", function() {
+ cy.Createpage("NewPage", false);
+
+ //verify that it is in generate page
+ cy.get(generatePage.buildFromScratchActionCard).should("have.length", 1);
+
+ //paste
+ cy.get("body").type(`{${modifierKey}}{v}`);
+
+ //verify a pasted list widget
+ cy.get(widgetsPage.listWidget).should("have.length", 1);
+ });
});
diff --git a/app/client/cypress/support/widgetCommands.js b/app/client/cypress/support/widgetCommands.js
index cbd03559f0db..b620cb0688cc 100644
--- a/app/client/cypress/support/widgetCommands.js
+++ b/app/client/cypress/support/widgetCommands.js
@@ -716,7 +716,7 @@ Cypress.Commands.add("DeleteModal", () => {
.click({ force: true });
});
-Cypress.Commands.add("Createpage", (pageName) => {
+Cypress.Commands.add("Createpage", (pageName, navigateToCanvasPage = true) => {
let pageId;
cy.get(pages.AddPage)
.first()
@@ -734,7 +734,9 @@ Cypress.Commands.add("Createpage", (pageName) => {
pageidcopy = pageName;
cy.wrap(pageId).as("currentPageId");
}
- cy.get(generatePage.buildFromScratchActionCard).click();
+ if (navigateToCanvasPage) {
+ cy.get(generatePage.buildFromScratchActionCard).click();
+ }
cy.get("#loading").should("not.exist");
});
});
diff --git a/app/client/src/constants/routes.ts b/app/client/src/constants/routes.ts
index 32fb3935229c..441ed1c30d0d 100644
--- a/app/client/src/constants/routes.ts
+++ b/app/client/src/constants/routes.ts
@@ -74,6 +74,9 @@ export const matchViewerForkPath = (pathName: string) =>
match(`${VIEWER_PATH_DEPRECATED}${VIEWER_FORK_PATH}`)(pathName);
export const matchTemplatesPath = match(TEMPLATES_PATH);
export const matchTemplatesIdPath = match(TEMPLATES_ID_PATH);
+export const matchGeneratePagePath = (pathName: string) =>
+ match(`${BUILDER_PATH}${GENERATE_TEMPLATE_PATH}`)(pathName) ||
+ match(`${BUILDER_PATH_DEPRECATED}${GENERATE_TEMPLATE_PATH}`)(pathName);
export const addBranchParam = (branch: string) => {
const url = new URL(window.location.href);
diff --git a/app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx b/app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx
index b3f47e04663c..76ab31439a87 100644
--- a/app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx
+++ b/app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx
@@ -50,7 +50,7 @@ import { getExplorerPinned } from "selectors/explorerSelector";
import { setExplorerPinnedAction } from "actions/explorerActions";
import { setIsGitSyncModalOpen } from "actions/gitSyncActions";
import { GitSyncModalTab } from "entities/GitSync";
-import { matchBuilderPath } from "constants/routes";
+import { matchBuilderPath, matchGeneratePagePath } from "constants/routes";
import { commentModeSelector } from "selectors/commentsSelectors";
type Props = {
@@ -216,9 +216,14 @@ class GlobalHotKeys extends React.Component<Props> {
group="Canvas"
label="Paste Widget"
onKeyDown={() => {
- this.props.pasteCopiedWidget(
- this.props.getMousePosition() || { x: 0, y: 0 },
- );
+ if (
+ matchBuilderPath(window.location.pathname) ||
+ matchGeneratePagePath(window.location.pathname)
+ ) {
+ this.props.pasteCopiedWidget(
+ this.props.getMousePosition() || { x: 0, y: 0 },
+ );
+ }
}}
/>
<Hotkey
diff --git a/app/client/src/sagas/WidgetOperationSagas.tsx b/app/client/src/sagas/WidgetOperationSagas.tsx
index 17e2b007ec44..c0dcc0b22542 100644
--- a/app/client/src/sagas/WidgetOperationSagas.tsx
+++ b/app/client/src/sagas/WidgetOperationSagas.tsx
@@ -139,6 +139,9 @@ import { reflow } from "reflow";
import { getBottomMostRow } from "reflow/reflowUtils";
import { flashElementsById } from "utils/helpers";
import { getSlidingCanvasName } from "constants/componentClassNameConstants";
+import { matchGeneratePagePath } from "constants/routes";
+import { builderURL } from "RouteBuilder";
+import history from "utils/history";
export function* resizeSaga(resizeAction: ReduxAction<WidgetResize>) {
try {
@@ -1538,6 +1541,14 @@ function* pasteWidgetSaga(
yield put(updateAndSaveLayout(reflowedWidgets));
+ if (
+ copiedWidgetGroups &&
+ copiedWidgetGroups.length > 0 &&
+ matchGeneratePagePath(window.location.pathname)
+ ) {
+ history.push(builderURL());
+ }
+
yield put({
type: ReduxActionTypes.RECORD_RECENTLY_ADDED_WIDGET,
payload: newlyCreatedWidgetIds,
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.