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
da1f065ba95bce3be5a3bfd6759218e8fed32d8e
2023-07-12 19:16:38
Vijetha-Kaja
test: Cypress - Skipping test to unblock CI (#25337)
false
Cypress - Skipping test to unblock CI (#25337)
test
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC2_spec.ts index 42c76171eecf..23a1c1b117d4 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC2_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC2_spec.ts @@ -106,7 +106,7 @@ describe("Autocomplete tests", () => { }); }); - it("3. Bug #15429 Random keystrokes trigger autocomplete to show up", () => { + it.skip("3. Bug #15429 Random keystrokes trigger autocomplete to show up", () => { // create js object & assert no hints just show up jsEditor.CreateJSObject( `export default
686f510b5dc74bc5085180ed1363d71d4c1cad9f
2024-05-20 20:36:41
sneha122
fix: hide gs from airgap from most popular section (#33597)
false
hide gs from airgap from most popular section (#33597)
fix
diff --git a/app/client/src/pages/Editor/IntegrationEditor/CreateNewDatasourceTab.tsx b/app/client/src/pages/Editor/IntegrationEditor/CreateNewDatasourceTab.tsx index ed5177abb205..3b06739a0efc 100644 --- a/app/client/src/pages/Editor/IntegrationEditor/CreateNewDatasourceTab.tsx +++ b/app/client/src/pages/Editor/IntegrationEditor/CreateNewDatasourceTab.tsx @@ -147,6 +147,8 @@ function CreateNewDatasource({ } }, [active]); + const isAirgappedInstance = isAirgapped(); + return ( <div id="new-datasources" ref={newDatasourceRef}> <Text kind="heading-m"> @@ -158,6 +160,7 @@ function CreateNewDatasource({ editorId={editorId} editorType={editorType} history={history} + isAirgappedInstance={isAirgappedInstance} isCreating={isCreating} location={location} parentEntityId={parentEntityId || (isOnboardingScreen && pageId) || ""} diff --git a/app/client/src/pages/Editor/IntegrationEditor/DatasourceHome.tsx b/app/client/src/pages/Editor/IntegrationEditor/DatasourceHome.tsx index 880cf9215536..1ab57f68ad92 100644 --- a/app/client/src/pages/Editor/IntegrationEditor/DatasourceHome.tsx +++ b/app/client/src/pages/Editor/IntegrationEditor/DatasourceHome.tsx @@ -129,6 +129,7 @@ interface DatasourceHomeScreenProps { showMostPopularPlugins?: boolean; isCreating?: boolean; showUnsupportedPluginDialog: (callback: any) => void; + isAirgappedInstance?: boolean; } interface ReduxDispatchProps { @@ -287,13 +288,20 @@ class DatasourceHomeScreen extends React.Component<Props> { const mapStateToProps = ( state: AppState, - props: { showMostPopularPlugins?: boolean }, + props: { showMostPopularPlugins?: boolean; isAirgappedInstance?: boolean }, ) => { const { datasources } = state.entities; + const mostPopularPlugins = getMostPopularPlugins(state); + const filteredMostPopularPlugins: Plugin[] = !!props?.isAirgappedInstance + ? mostPopularPlugins.filter( + (plugin: Plugin) => + plugin?.packageName !== PluginPackageName.GOOGLE_SHEETS, + ) + : mostPopularPlugins; return { pluginImages: getPluginImages(state), plugins: !!props?.showMostPopularPlugins - ? getMostPopularPlugins(state) + ? filteredMostPopularPlugins : getDBPlugins(state), currentApplication: getCurrentApplication(state), isSaving: datasources.loading, diff --git a/app/client/src/pages/Editor/IntegrationEditor/NewQuery.tsx b/app/client/src/pages/Editor/IntegrationEditor/NewQuery.tsx index 1bc4cc247401..03bf5b526872 100644 --- a/app/client/src/pages/Editor/IntegrationEditor/NewQuery.tsx +++ b/app/client/src/pages/Editor/IntegrationEditor/NewQuery.tsx @@ -29,6 +29,7 @@ interface QueryHomeScreenProps { }; showMostPopularPlugins?: boolean; showUnsupportedPluginDialog: (callback: any) => void; + isAirgappedInstance?: boolean; } class QueryHomeScreen extends React.Component<QueryHomeScreenProps> { @@ -37,6 +38,7 @@ class QueryHomeScreen extends React.Component<QueryHomeScreenProps> { editorId, editorType, history, + isAirgappedInstance, isCreating, location, parentEntityId, @@ -51,6 +53,7 @@ class QueryHomeScreen extends React.Component<QueryHomeScreenProps> { editorId={editorId} editorType={editorType} history={history} + isAirgappedInstance={isAirgappedInstance} isCreating={isCreating} location={location} parentEntityId={parentEntityId}
3cfec83356573307dad346151d1da31ee979d6dc
2023-09-20 13:44:46
arunvjn
fix: clear debugger logs filter using backspace (#27398)
false
clear debugger logs filter using backspace (#27398)
fix
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts index 8f993d90907e..aa22350549e1 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts @@ -22,6 +22,7 @@ describe("excludeForAirgap", "JSObjects", () => { entityType: entityItems.JSObject, }); }); + it("2. Focus and position cursor on the ch,line having an error", () => { const JS_OBJECT_BODY = `export default { myVar1: [], @@ -53,4 +54,44 @@ describe("excludeForAirgap", "JSObjects", () => { entityType: entityItems.JSObject, }); }); + + it("3. Bug 24990 Clears logs filter using backspace", function () { + const JS_OBJECT_BODY = `export default { + myVar1: [], + myVar2: {}, + myFun1 () { + // write code here + return [1,2,3] + }, + async myFun2 () { + return [] + } + }`; + jsEditor.CreateJSObject(JS_OBJECT_BODY, { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + }); + jsEditor.SelectFunctionDropdown("myFun1"); + jsEditor.RunJSObj(); + debuggerHelper.ClickLogsTab(); + agHelper.AssertText( + debuggerHelper.locators._debuggerFilter, + "val", + "JSObject1", + ); + agHelper.TypeText( + debuggerHelper.locators._debuggerFilter, + "{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}", + { delay: 50, parseSpecialCharSeq: true }, + ); + agHelper.AssertText(debuggerHelper.locators._debuggerFilter, "val", ""); + debuggerHelper.DebuggerLogsFilter("JSObject1"); + debuggerHelper.DebuggerLogsFilter("{backspace}"); + agHelper.AssertText(debuggerHelper.locators._debuggerFilter, "val", ""); + debuggerHelper.DebuggerLogsFilter("JSObject1"); + agHelper.GetNClick(debuggerHelper.locators._debuggerFilterClear); + agHelper.AssertText(debuggerHelper.locators._debuggerFilter, "val", ""); + }); }); diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts index e13c2e84ce66..29216e4034d8 100644 --- a/app/client/cypress/support/Pages/DebuggerHelper.ts +++ b/app/client/cypress/support/Pages/DebuggerHelper.ts @@ -46,6 +46,8 @@ export class DebuggerHelper { _intercomOption: "#intercom-trigger", _intercomConsentText: "[data-testid='t--intercom-consent-text']", _logsTab: "[data-testid='t--tab-LOGS_TAB']", + _debuggerFilterClear: + "//input[@data-testid='t--debugger-search']/following-sibling::span", _logsGroup: "[data-testid='t--log-filter']", _logGroupOption: (option: string) => `[data-testid='t--log-filter-${option}']`, diff --git a/app/client/src/components/editorComponents/Debugger/FilterHeader.tsx b/app/client/src/components/editorComponents/Debugger/FilterHeader.tsx index 1d210b1fc8c8..5d68cd8d0d2b 100644 --- a/app/client/src/components/editorComponents/Debugger/FilterHeader.tsx +++ b/app/client/src/components/editorComponents/Debugger/FilterHeader.tsx @@ -22,8 +22,7 @@ const Wrapper = styled.div` justify-content: start; align-items: center; gap: 8px; - padding: 0 8px 8px 8px; - + padding: var(--ads-v2-spaces-4); .debugger-filter { width: 220px; } @@ -79,7 +78,7 @@ function FilterHeader(props: FilterHeaderProps) { onChange={props.onChange} placeholder="Filter" ref={searchRef} - value={props.value || props.defaultValue} + value={props.value} /> </div> <Select
970ac5d912acfc64dc5a5d989005500505ff2dff
2024-03-30 20:46:50
Shrikant Sharat Kandula
chore: Remove unused `getIdCriteria`
false
Remove unused `getIdCriteria`
chore
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java index 93a70338333c..eeec19d6324d 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java @@ -45,7 +45,6 @@ import static org.apache.commons.collections.CollectionUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isBlank; -import static org.springframework.data.mongodb.core.query.Criteria.where; /** * In case you are wondering why we have two different repository implementation classes i.e. @@ -112,15 +111,6 @@ public static Criteria userAcl(Set<String> permissionGroups, AclPermission permi .is(permission.getValue())); } - /** - * @deprecated Consider using {@code queryBuilder().byId(id)} or {@code Bridge.equal(BaseDomain.Fields.id, id)} - * instead. - */ - @Deprecated(forRemoval = true) - protected Criteria getIdCriteria(Object id) { - return where("id").is(id); - } - protected DBObject getDbObject(Object o) { BasicDBObject basicDBObject = new BasicDBObject(); mongoConverter.write(o, basicDBObject);
5542d121239bb81c857228fb0349010dabdc14b0
2022-12-07 14:52:43
Hetu Nandu
ci: Improve the test file check workflow (#18741)
false
Improve the test file check workflow (#18741)
ci
diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 2b96fe7f7346..2d853d5120a1 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -12,21 +12,4 @@ jobs: steps: - uses: appsmithorg/labeler@master env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - - name: Get changed files using defaults - id: changed-files - uses: trilom/[email protected] - continue-on-error: true - - - name: Run step when a file changes - uses: actions-ecosystem/action-create-comment@v1 - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - if: | - contains(steps.changed-files.outputs.files_modified, 'cypress') == false && - contains(steps.changed-files.outputs.files_modified, 'test') == false - with: - github_token: ${{ secrets.github_token }} - body: | - Unable to find test scripts. Please add necessary tests to the PR. \ No newline at end of file + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/pr-test-file-check.yml b/.github/workflows/pr-test-file-check.yml new file mode 100644 index 000000000000..5305bc927dc1 --- /dev/null +++ b/.github/workflows/pr-test-file-check.yml @@ -0,0 +1,33 @@ +name: Check for test files + +on: + pull_request: + branches: [ release ] + types: [ opened, reopened, edited ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Get changed files using defaults + id: changed-files + uses: trilom/[email protected] + continue-on-error: true + + - name: Ger labels of the PR + id: labels + uses: joerick/[email protected] + continue-on-error: true + + - name: Comment if test files not found + uses: actions-ecosystem/action-create-comment@v1 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: | + contains(fromJson('["cypress", "test"]'), toJson(steps.changed-files.outputs.files_modified)) == false && + contains(fromJson('["Bug", "Enhancement", "Pod"]'), toJson(steps.labels.outputs.labels)) == true + with: + github_token: ${{ secrets.github_token }} + body: | + Unable to find test scripts. Please add necessary tests to the PR. \ No newline at end of file
a0ea8c21bac1974705f6b3c6e69d3802add3ba26
2021-11-19 09:49:33
Nayan
fix: [Fix] Set user email to lowercase before creating the user and in reset password (#9179)
false
[Fix] Set user email to lowercase before creating the user and in reset password (#9179)
fix
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java index c53934803fab..a373b783dcff 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java @@ -194,8 +194,8 @@ public Mono<User> switchCurrentOrganization(String orgId) { * This function creates a one-time token for resetting the user's password. This token is stored in the `passwordResetToken` * collection with an expiry time of 48 hours. The user must provide this one-time token when updating with the new password. * - * @param resetUserPasswordDTO - * @return + * @param resetUserPasswordDTO DTO object containing the request params from form + * @return True if email is sent successfully */ @Override public Mono<Boolean> forgotPasswordTokenGenerate(ResetUserPasswordDTO resetUserPasswordDTO) { @@ -212,34 +212,34 @@ public Mono<Boolean> forgotPasswordTokenGenerate(ResetUserPasswordDTO resetUserP // Create a random token to be sent out. final String token = UUID.randomUUID().toString(); - log.debug("Password reset Token: {} for email: {}", token, email); // Check if the user exists in our DB. If not, we will not send a password reset link to the user - Mono<User> userMono = repository.findByEmail(email) - .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.USER, email))); - - // Generate the password reset link for the user - Mono<PasswordResetToken> passwordResetTokenMono = passwordResetTokenRepository.findByEmail(email) - .switchIfEmpty(Mono.defer(() -> { - PasswordResetToken passwordResetToken = new PasswordResetToken(); - passwordResetToken.setEmail(email); - passwordResetToken.setRequestCount(0); - passwordResetToken.setFirstRequestTime(Instant.now()); - return Mono.just(passwordResetToken); - })) - .map(resetToken -> { - // check the validity of the token - validateResetLimit(resetToken); - resetToken.setTokenHash(passwordEncoder.encode(token)); - return resetToken; - }); + return repository.findByEmail(email) + .switchIfEmpty(repository.findByCaseInsensitiveEmail(email)) + .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.USER, email))) + .flatMap(user -> { + // an user found with the provided email address + // Generate the password reset link for the user + return passwordResetTokenRepository.findByEmail(user.getEmail()) + .switchIfEmpty(Mono.defer(() -> { + PasswordResetToken passwordResetToken = new PasswordResetToken(); + passwordResetToken.setEmail(user.getEmail()); + passwordResetToken.setRequestCount(0); + passwordResetToken.setFirstRequestTime(Instant.now()); + return Mono.just(passwordResetToken); + })) + .map(resetToken -> { + // check the validity of the token + validateResetLimit(resetToken); + resetToken.setTokenHash(passwordEncoder.encode(token)); + return resetToken; + }); + }).flatMap(passwordResetTokenRepository::save) + .flatMap(passwordResetToken -> { + log.debug("Password reset Token: {} for email: {}", token, passwordResetToken.getEmail()); - // Save the password reset link and send email to the user - Mono<Boolean> resetFlowMono = passwordResetTokenMono - .flatMap(passwordResetTokenRepository::save) - .flatMap(obj -> { List<NameValuePair> nameValuePairs = new ArrayList<>(2); - nameValuePairs.add(new BasicNameValuePair("email", email)); + nameValuePairs.add(new BasicNameValuePair("email", passwordResetToken.getEmail())); nameValuePairs.add(new BasicNameValuePair("token", token)); String urlParams = URLEncodedUtils.format(nameValuePairs, StandardCharsets.UTF_8); String resetUrl = String.format( @@ -248,6 +248,8 @@ public Mono<Boolean> forgotPasswordTokenGenerate(ResetUserPasswordDTO resetUserP encryptionService.encryptString(urlParams) ); + log.debug("Password reset url for email: {}: {}", passwordResetToken.getEmail(), resetUrl); + Map<String, String> params = Map.of("resetUrl", resetUrl); return emailSender.sendMail( email, @@ -257,9 +259,6 @@ public Mono<Boolean> forgotPasswordTokenGenerate(ResetUserPasswordDTO resetUserP ); }) .thenReturn(true); - - // Connect the components to first find a valid user and then initiate the password reset flow - return userMono.then(resetFlowMono); } /** @@ -450,6 +449,9 @@ private Set<Policy> crudUserPolicy(User user) { public Mono<User> userCreate(User user) { // It is assumed here that the user's password has already been encoded. + // convert the user email to lowercase + user.setEmail(user.getEmail().toLowerCase()); + // Set the permissions for the user user.getPolicies().addAll(crudUserPolicy(user)); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java index 27fb39ea139e..f32b1956ae3e 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java @@ -242,6 +242,52 @@ public void createNewUserValid() { .verifyComplete(); } + @Test + @WithMockAppsmithUser + public void createNewUser_WhenEmailHasUpperCase_SavedInLowerCase() { + String sampleEmail = "[email protected]"; + String sampleEmailLowercase = sampleEmail.toLowerCase(); + + User newUser = new User(); + newUser.setEmail(sampleEmail); + newUser.setPassword("new-user-test-password"); + + Policy manageUserPolicy = Policy.builder() + .permission(MANAGE_USERS.getValue()) + .users(Set.of(sampleEmailLowercase)).build(); + + Policy manageUserOrgPolicy = Policy.builder() + .permission(USER_MANAGE_ORGANIZATIONS.getValue()) + .users(Set.of(sampleEmailLowercase)).build(); + + Policy readUserPolicy = Policy.builder() + .permission(READ_USERS.getValue()) + .users(Set.of(sampleEmailLowercase)).build(); + + Policy readUserOrgPolicy = Policy.builder() + .permission(USER_READ_ORGANIZATIONS.getValue()) + .users(Set.of(sampleEmailLowercase)).build(); + + Mono<User> userMono = userService.create(newUser); + + StepVerifier.create(userMono) + .assertNext(user -> { + assertThat(user).isNotNull(); + assertThat(user.getId()).isNotNull(); + assertThat(user.getEmail()).isEqualTo(sampleEmailLowercase); + assertThat(user.getName()).isNullOrEmpty(); + assertThat(user.getPolicies()).isNotEmpty(); + assertThat(user.getPolicies()).containsAll( + Set.of(manageUserPolicy, manageUserOrgPolicy, readUserPolicy, readUserOrgPolicy) + ); + // Since there is a template organization, the user won't have an empty default organization. They + // will get a clone of the default organization when they first login. So, we expect it to be + // empty here. + assertThat(user.getOrganizationIds()).hasSize(1); + }) + .verifyComplete(); + } + @Test @DirtiesContext @WithUserDetails(value = "api_user")
bc165cf8274aff6ea32b8de33b82abd184cbaf2c
2024-11-04 15:32:30
Vemparala Surya Vamsi
chore: decouple editor components (#37102)
false
decouple editor components (#37102)
chore
diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts index a8ed3d4fbac3..832c83048d97 100644 --- a/app/client/cypress/support/Pages/JSEditor.ts +++ b/app/client/cypress/support/Pages/JSEditor.ts @@ -113,6 +113,7 @@ export class JSEditor { ); //Checking JS object was created successfully this.assertHelper.AssertNetworkStatus("@createNewJSCollection", 201); + cy.get(this._jsObjName).click({ force: true }); this.agHelper.AssertElementVisibility(this._jsObjTxt); // Assert that the name of the JS Object is focused when newly created this.agHelper.PressEnter(); diff --git a/app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts b/app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.tsx similarity index 67% rename from app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts rename to app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.tsx index 58614a67abe9..34ce88dd556a 100644 --- a/app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts +++ b/app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.tsx @@ -1,4 +1,5 @@ -import { useCallback } from "react"; +import { lazy, Suspense, useCallback, useMemo } from "react"; +import React from "react"; import { useDispatch, useSelector } from "react-redux"; import { createNewJSCollection } from "actions/jsPaneActions"; import { getCurrentPageId } from "selectors/editorSelectors"; @@ -7,17 +8,16 @@ import { createMessage, EDITOR_PANE_TEXTS } from "ee/constants/messages"; import { JsFileIconV2 } from "pages/Editor/Explorer/ExplorerIcons"; import { SEARCH_ITEM_TYPES } from "components/editorComponents/GlobalSearch/utils"; import type { UseRoutes } from "ee/entities/IDE/constants"; -import JSEditor from "pages/Editor/JSEditor"; -import AddJS from "pages/Editor/IDE/EditorPane/JS/Add"; import { ADD_PATH } from "ee/constants/routes/appRoutes"; import history from "utils/history"; import { FocusEntity, identifyEntityFromPath } from "navigation/FocusEntity"; import { useModuleOptions } from "ee/utils/moduleInstanceHelpers"; import { getJSUrl } from "ee/pages/Editor/IDE/EditorPane/JS/utils"; -import { JSBlankState } from "pages/Editor/JSEditor/JSBlankState"; import { getIDEViewMode } from "selectors/ideSelectors"; import { EditorViewMode } from "ee/entities/IDE/constants"; import { setListViewActiveState } from "actions/ideActions"; +import { retryPromise } from "utils/AppsmithUtils"; +import Skeleton from "widgets/Skeleton"; export const useJSAdd = () => { const pageId = useSelector(getCurrentPageId); @@ -93,25 +93,64 @@ export const useGroupedAddJsOperations = (): GroupedAddOperations => { ]; }; +const AddJS = lazy(async () => + retryPromise( + async () => + import( + /* webpackChunkName: "AddJS" */ "pages/Editor/IDE/EditorPane/JS/Add" + ), + ), +); +const JSEditor = lazy(async () => + retryPromise( + async () => + import(/* webpackChunkName: "JSEditor" */ "pages/Editor/JSEditor"), + ), +); + +const JSEmpty = lazy(async () => + retryPromise( + async () => + import( + /* webpackChunkName: "JSEmpty" */ "pages/Editor/JSEditor/JSBlankState" + ), + ), +); + export const useJSEditorRoutes = (path: string): UseRoutes => { - return [ - { - exact: true, - key: "AddJS", - component: AddJS, - path: [`${path}${ADD_PATH}`, `${path}/:baseCollectionId${ADD_PATH}`], - }, - { - exact: true, - key: "JSEditor", - component: JSEditor, - path: [path + "/:baseCollectionId"], - }, - { - key: "JSEmpty", - component: JSBlankState, - exact: true, - path: [path], - }, - ]; + return useMemo( + () => [ + { + exact: true, + key: "AddJS", + component: (args) => ( + <Suspense fallback={<Skeleton />}> + <AddJS {...args} /> + </Suspense> + ), + path: [`${path}${ADD_PATH}`, `${path}/:baseCollectionId${ADD_PATH}`], + }, + { + exact: true, + key: "JSEditor", + component: (args) => ( + <Suspense fallback={<Skeleton />}> + <JSEditor {...args} /> + </Suspense> + ), + path: [path + "/:baseCollectionId"], + }, + { + key: "JSEmpty", + component: (args) => ( + <Suspense fallback={<Skeleton />}> + <JSEmpty {...args} /> + </Suspense> + ), + exact: true, + path: [path], + }, + ], + [path], + ); }; diff --git a/app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx b/app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx index 73ffb6ab8a74..7eeba362e2e1 100644 --- a/app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx +++ b/app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx @@ -1,4 +1,5 @@ -import { useCallback, useMemo } from "react"; +import { lazy, Suspense, useCallback, useMemo } from "react"; +import React from "react"; import history from "utils/history"; import { useLocation } from "react-router"; import { FocusEntity, identifyEntityFromPath } from "navigation/FocusEntity"; @@ -23,19 +24,17 @@ import { BUILDER_PATH_DEPRECATED, } from "ee/constants/routes/appRoutes"; import { SAAS_EDITOR_API_ID_PATH } from "pages/Editor/SaaSEditor/constants"; -import ApiEditor from "pages/Editor/APIEditor"; import type { UseRoutes } from "ee/entities/IDE/constants"; -import QueryEditor from "pages/Editor/QueryEditor"; -import AddQuery from "pages/Editor/IDE/EditorPane/Query/Add"; import type { AppState } from "ee/reducers"; import keyBy from "lodash/keyBy"; import { getPluginEntityIcon } from "pages/Editor/Explorer/ExplorerIcons"; import type { ListItemProps } from "@appsmith/ads"; import { createAddClassName } from "pages/Editor/IDE/EditorPane/utils"; -import { QueriesBlankState } from "pages/Editor/QueryEditor/QueriesBlankState"; import { getIDEViewMode } from "selectors/ideSelectors"; import { EditorViewMode } from "ee/entities/IDE/constants"; import { setListViewActiveState } from "actions/ideActions"; +import { retryPromise } from "utils/AppsmithUtils"; +import Skeleton from "widgets/Skeleton"; export const useQueryAdd = () => { const location = useLocation(); @@ -114,47 +113,107 @@ export const useGroupedAddQueryOperations = (): GroupedAddOperations => { return groups; }; +const ApiEditor = lazy(async () => + retryPromise( + async () => + import(/* webpackChunkName: "APIEditor" */ "pages/Editor/APIEditor"), + ), +); + +const AddQuery = lazy(async () => + retryPromise( + async () => + import( + /* webpackChunkName: "AddQuery" */ "pages/Editor/IDE/EditorPane/Query/Add" + ), + ), +); +const QueryEditor = lazy(async () => + retryPromise( + async () => + import(/* webpackChunkName: "QueryEditor" */ "pages/Editor/QueryEditor"), + ), +); + +const QueryEmpty = lazy(async () => + retryPromise( + async () => + import( + /* webpackChunkName: "QueryEmpty" */ "pages/Editor/QueryEditor/QueriesBlankState" + ), + ), +); + export const useQueryEditorRoutes = (path: string): UseRoutes => { - return [ - { - key: "ApiEditor", - component: ApiEditor, - exact: true, - path: [ - BUILDER_PATH + API_EDITOR_ID_PATH, - BUILDER_CUSTOM_PATH + API_EDITOR_ID_PATH, - BUILDER_PATH_DEPRECATED + API_EDITOR_ID_PATH, - ], - }, - { - key: "AddQuery", - exact: true, - component: AddQuery, - path: [`${path}${ADD_PATH}`, `${path}/:baseQueryId${ADD_PATH}`], - }, - { - key: "SAASEditor", - component: QueryEditor, - exact: true, - path: [ - BUILDER_PATH + SAAS_EDITOR_API_ID_PATH, - BUILDER_CUSTOM_PATH + SAAS_EDITOR_API_ID_PATH, - BUILDER_PATH_DEPRECATED + SAAS_EDITOR_API_ID_PATH, - ], - }, - { - key: "QueryEditor", - component: QueryEditor, - exact: true, - path: [path + "/:baseQueryId"], - }, - { - key: "QueryEmpty", - component: QueriesBlankState, - exact: true, - path: [path], - }, - ]; + return useMemo( + () => [ + { + key: "ApiEditor", + component: (args) => { + return ( + <Suspense fallback={<Skeleton />}> + <ApiEditor {...args} /> + </Suspense> + ); + }, + exact: true, + path: [ + BUILDER_PATH + API_EDITOR_ID_PATH, + BUILDER_CUSTOM_PATH + API_EDITOR_ID_PATH, + BUILDER_PATH_DEPRECATED + API_EDITOR_ID_PATH, + ], + }, + { + key: "AddQuery", + exact: true, + component: (args) => ( + <Suspense fallback={<Skeleton />}> + <AddQuery {...args} /> + </Suspense> + ), + path: [`${path}${ADD_PATH}`, `${path}/:baseQueryId${ADD_PATH}`], + }, + { + key: "SAASEditor", + component: (args) => { + return ( + <Suspense fallback={<Skeleton />}> + <QueryEditor {...args} /> + </Suspense> + ); + }, + exact: true, + path: [ + BUILDER_PATH + SAAS_EDITOR_API_ID_PATH, + BUILDER_CUSTOM_PATH + SAAS_EDITOR_API_ID_PATH, + BUILDER_PATH_DEPRECATED + SAAS_EDITOR_API_ID_PATH, + ], + }, + { + key: "QueryEditor", + component: (args) => { + return ( + <Suspense fallback={<Skeleton />}> + <QueryEditor {...args} /> + </Suspense> + ); + }, + exact: true, + path: [path + "/:baseQueryId"], + }, + { + key: "QueryEmpty", + component: (args) => ( + <Suspense fallback={<Skeleton />}> + <QueryEmpty {...args} /> + </Suspense> + ), + exact: true, + path: [path], + }, + ], + [path], + ); }; export const useAddQueryListItems = () => { diff --git a/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.ts b/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx similarity index 85% rename from app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.ts rename to app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx index c49f522c1c33..d0fdc4ecda05 100644 --- a/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.ts +++ b/app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx @@ -24,7 +24,6 @@ import { WIDGETS_EDITOR_ID_PATH, } from "constants/routes"; import CreateNewDatasourceTab from "pages/Editor/IntegrationEditor/CreateNewDatasourceTab"; -import OnboardingChecklist from "pages/Editor/FirstTimeUserOnboarding/Checklist"; import { SAAS_EDITOR_API_ID_ADD_PATH, SAAS_EDITOR_API_ID_PATH, @@ -38,7 +37,28 @@ import GeneratePage from "pages/Editor/GeneratePage"; 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"; + +const FirstTimeUserOnboardingChecklist = lazy(async () => + retryPromise( + async () => + import( + /* webpackChunkName: "FirstTimeUserOnboardingChecklist" */ "pages/Editor/FirstTimeUserOnboarding/Checklist" + ), + ), +); + +export const LazilyLoadedFirstTimeUserOnboardingChecklist = () => { + return ( + <Suspense fallback={<Skeleton />}> + <FirstTimeUserOnboardingChecklist /> + </Suspense> + ); +}; export interface RouteReturnType extends RouteProps { key: string; } @@ -95,7 +115,9 @@ function useRoutes(path: string): RouteReturnType[] { }, { key: "OnboardingChecklist", - component: isPreviewMode ? WidgetsEditor : OnboardingChecklist, + component: isPreviewMode + ? WidgetsEditor + : FirstTimeUserOnboardingChecklist, exact: true, path: `${path}${BUILDER_CHECKLIST_PATH}`, }, diff --git a/app/client/src/pages/Editor/FirstTimeUserOnboarding/Modal.tsx b/app/client/src/pages/Editor/FirstTimeUserOnboarding/Modal.tsx index a0a70f11d605..6cd288820d19 100644 --- a/app/client/src/pages/Editor/FirstTimeUserOnboarding/Modal.tsx +++ b/app/client/src/pages/Editor/FirstTimeUserOnboarding/Modal.tsx @@ -1,11 +1,29 @@ -import React from "react"; +import React, { lazy, Suspense } from "react"; import { MenuContent } from "@appsmith/ads"; import styled from "styled-components"; -import Checklist from "./Checklist"; import HelpMenu from "./HelpMenu"; import { useDispatch } from "react-redux"; import { showSignpostingModal } from "actions/onboardingActions"; +import { retryPromise } from "utils/AppsmithUtils"; +import Skeleton from "widgets/Skeleton"; + +const Checklist = lazy(async () => + retryPromise( + async () => + import( + /* webpackChunkName: "FirstTimeUserOnboardingChecklist" */ "./Checklist" + ), + ), +); + +export const LazilyLoadedChecklist = () => { + return ( + <Suspense fallback={<Skeleton />}> + <Checklist /> + </Suspense> + ); +}; const SIGNPOSTING_POPUP_WIDTH = "360px"; const StyledMenuContent = styled(MenuContent)<{ animate: boolean }>` @@ -48,7 +66,7 @@ function OnboardingModal(props: { width={SIGNPOSTING_POPUP_WIDTH} > <Wrapper> - {!props.showIntercomConsent && <Checklist />} + {!props.showIntercomConsent && <LazilyLoadedChecklist />} <HelpMenu setShowIntercomConsent={props.setShowIntercomConsent} showIntercomConsent={props.showIntercomConsent} diff --git a/app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx b/app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx index b0decd243581..fa0c0f25f28c 100644 --- a/app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx +++ b/app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx @@ -1,5 +1,5 @@ import localStorage from "utils/localStorage"; -import { render } from "test/testUtils"; +import { render, waitFor } from "test/testUtils"; import { Route } from "react-router-dom"; import { BUILDER_PATH } from "ee/constants/routes/appRoutes"; import IDE from "pages/Editor/IDE/index"; @@ -19,8 +19,8 @@ const basePageId = "0123456789abcdef00000000"; describe("IDE Render: JS", () => { localStorage.setItem("SPLITPANE_ANNOUNCEMENT", "false"); describe("JS Blank State", () => { - it("Renders Fullscreen Blank State", () => { - const { getByRole, getByText } = render( + it("Renders Fullscreen Blank State", async () => { + const { findByText, getByRole, getByText } = render( <Route path={BUILDER_PATH}> <IDE /> </Route>, @@ -31,7 +31,7 @@ describe("IDE Render: JS", () => { ); // Main pane text - getByText(createMessage(EDITOR_PANE_TEXTS.js_blank_state)); + await findByText(createMessage(EDITOR_PANE_TEXTS.js_blank_state)); // Left pane text getByText(createMessage(EDITOR_PANE_TEXTS.js_blank_state_description)); @@ -68,8 +68,8 @@ describe("IDE Render: JS", () => { }); }); - it("Renders Fullscreen Add in Blank State", () => { - const { getByTestId, getByText } = render( + it("Renders Fullscreen Add in Blank State", async () => { + const { findByText, getByTestId, getByText } = render( <Route path={BUILDER_PATH}> <IDE /> </Route>, @@ -80,7 +80,7 @@ describe("IDE Render: JS", () => { ); // Main pane text - getByText(createMessage(EDITOR_PANE_TEXTS.js_create_tab_title)); + await findByText(createMessage(EDITOR_PANE_TEXTS.js_create_tab_title)); // Left pane description getByText(createMessage(EDITOR_PANE_TEXTS.js_blank_state_description)); @@ -117,7 +117,7 @@ describe("IDE Render: JS", () => { }); describe("JS Edit Render", () => { - it("Renders JS routes in Full screen", () => { + it("Renders JS routes in Full screen", async () => { const page = PageFactory.build(); const js1 = JSObjectFactory.build({ pageId: page.pageId, @@ -143,6 +143,15 @@ describe("IDE Render: JS", () => { }, ); + await waitFor( + async () => { + const elements = getAllByText("JSObject1"); // Use the common test ID or selector + + expect(elements).toHaveLength(3); // Wait until there are exactly 3 elements + }, + { timeout: 3000, interval: 500 }, + ); + // There will be 3 JSObject1 text (Left pane list, editor tab and Editor form) expect(getAllByText("JSObject1").length).toEqual(3); // Left pane active state diff --git a/app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx b/app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx index 3bc3dca089ba..65314ae7a727 100644 --- a/app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx +++ b/app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx @@ -12,7 +12,7 @@ import { sagasToRunForTests } from "test/sagas"; import userEvent from "@testing-library/user-event"; import { getIDETestState } from "test/factories/AppIDEFactoryUtils"; import { PageFactory } from "test/factories/PageFactory"; -import { screen } from "@testing-library/react"; +import { screen, waitFor } from "@testing-library/react"; import { GoogleSheetFactory } from "test/factories/Actions/GoogleSheetFactory"; const FeatureFlags = { @@ -24,8 +24,8 @@ const basePageId = "0123456789abcdef00000000"; describe("IDE URL rendering of Queries", () => { localStorage.setItem("SPLITPANE_ANNOUNCEMENT", "false"); describe("Query Blank State", () => { - it("Renders Fullscreen Blank State", () => { - const { getByRole, getByText } = render( + it("Renders Fullscreen Blank State", async () => { + const { findByText, getByRole, getByText } = render( <Route path={BUILDER_PATH}> <IDE /> </Route>, @@ -36,7 +36,7 @@ describe("IDE URL rendering of Queries", () => { ); // Main pane text - getByText(createMessage(EDITOR_PANE_TEXTS.query_blank_state)); + await findByText(createMessage(EDITOR_PANE_TEXTS.query_blank_state)); // Left pane text getByText(createMessage(EDITOR_PANE_TEXTS.query_blank_state_description)); @@ -69,8 +69,8 @@ describe("IDE URL rendering of Queries", () => { getByText(/new query \/ api/i); }); - it("Renders Fullscreen Add in Blank State", () => { - const { getByTestId, getByText } = render( + it("Renders Fullscreen Add in Blank State", async () => { + const { findByText, getByTestId, getByText } = render( <Route path={BUILDER_PATH}> <IDE /> </Route>, @@ -81,7 +81,9 @@ describe("IDE URL rendering of Queries", () => { ); // Create options are rendered - getByText(createMessage(EDITOR_PANE_TEXTS.queries_create_from_existing)); + await findByText( + createMessage(EDITOR_PANE_TEXTS.queries_create_from_existing), + ); getByText("New datasource"); getByText("REST API"); // Check new tab presence @@ -130,7 +132,7 @@ describe("IDE URL rendering of Queries", () => { }); describe("API Routes", () => { - it("Renders Api routes in Full screen", () => { + it("Renders Api routes in Full screen", async () => { const page = PageFactory.build(); const anApi = APIFactory.build({ pageId: page.pageId }); const state = getIDETestState({ @@ -153,6 +155,15 @@ describe("IDE URL rendering of Queries", () => { }, ); + await waitFor( + async () => { + const elements = getAllByText("Api1"); // Use the common test ID or selector + + expect(elements).toHaveLength(3); // Wait until there are exactly 3 elements + }, + { timeout: 3000, interval: 500 }, + ); + // There will be 3 Api1 text (Left pane list, editor tab and Editor form) expect(getAllByText("Api1").length).toEqual(3); // Left pane active state @@ -343,6 +354,14 @@ describe("IDE URL rendering of Queries", () => { }, ); + await waitFor( + async () => { + const elements = getAllByText("Query1"); // Use the common test ID or selector + + expect(elements).toHaveLength(3); // Wait until there are exactly 3 elements + }, + { timeout: 3000, interval: 500 }, + ); // There will be 3 Query1 text (Left pane list, editor tab and Editor form) expect(getAllByText("Query1").length).toBe(3); // Left pane active state diff --git a/app/client/src/pages/Editor/JSEditor/JSBlankState.tsx b/app/client/src/pages/Editor/JSEditor/JSBlankState.tsx index acf141ca0bec..303f41b1893b 100644 --- a/app/client/src/pages/Editor/JSEditor/JSBlankState.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSBlankState.tsx @@ -26,4 +26,4 @@ const JSBlankState = () => { ); }; -export { JSBlankState }; +export default JSBlankState; diff --git a/app/client/src/pages/Editor/JSEditor/index.tsx b/app/client/src/pages/Editor/JSEditor/index.tsx index e625d5057013..6fcd8956119b 100644 --- a/app/client/src/pages/Editor/JSEditor/index.tsx +++ b/app/client/src/pages/Editor/JSEditor/index.tsx @@ -15,7 +15,6 @@ import AppJSEditorContextMenu from "./AppJSEditorContextMenu"; import { updateFunctionProperty } from "actions/jsPaneActions"; import type { OnUpdateSettingsProps } from "./JSEditorToolbar"; import { saveJSObjectName } from "actions/jsActionActions"; - const LoadingContainer = styled(CenteredWrapper)` height: 50%; `; diff --git a/app/client/src/pages/Editor/QueryEditor/QueriesBlankState.tsx b/app/client/src/pages/Editor/QueryEditor/QueriesBlankState.tsx index 2b6aae11ce00..0f23cd2c0751 100644 --- a/app/client/src/pages/Editor/QueryEditor/QueriesBlankState.tsx +++ b/app/client/src/pages/Editor/QueryEditor/QueriesBlankState.tsx @@ -26,4 +26,4 @@ const QueriesBlankState = () => { ); }; -export { QueriesBlankState }; +export default QueriesBlankState;
1b9f3af763b196a12cd06e3aeef9074cb2e15da0
2024-01-17 18:39:52
Rahul Barwal
chore: Adds new test file for onboarding start from scratch userflow (#30385)
false
Adds new test file for onboarding start from scratch userflow (#30385)
chore
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Onboarding/CanvasStarterBuildingBlockSeeMore_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Onboarding/StartFromScratch_spec.ts similarity index 57% rename from app/client/cypress/e2e/Regression/ClientSide/Onboarding/CanvasStarterBuildingBlockSeeMore_spec.ts rename to app/client/cypress/e2e/Regression/ClientSide/Onboarding/StartFromScratch_spec.ts index 5ac9fb6f7270..8aa31844532a 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Onboarding/CanvasStarterBuildingBlockSeeMore_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Onboarding/StartFromScratch_spec.ts @@ -4,14 +4,19 @@ import { agHelper, onboarding, templates, + dataSources, } from "../../../../support/Objects/ObjectsCore"; import FirstTimeUserOnboardingLocators from "../../../../locators/FirstTimeUserOnboarding.json"; +import { + AppSidebar, + AppSidebarButton, +} from "../../../../support/Pages/EditorNavigation"; describe( "Start with scratch userflow", { tags: ["@tag.excludeForAirgap", "@tag.Templates"] }, function () { - before(() => { + beforeEach(() => { featureFlagIntercept({ ab_show_templates_instead_of_blank_canvas_enabled: true, ab_create_new_apps_enabled: true, @@ -20,9 +25,6 @@ describe( cy.get("@guid").then((uid) => { (cy as any).Signup(`${uid}@appsmithtest.com`, uid); }); - }); - - it("1. onboarding flow - should check page entity selection in explorer", function () { agHelper.GetNClick(onboarding.locators.startFromScratchCard); agHelper.GetNClick(FirstTimeUserOnboardingLocators.introModalCloseBtn); @@ -30,6 +32,12 @@ describe( featureFlagIntercept({ ab_show_templates_instead_of_blank_canvas_enabled: true, }); + agHelper + .GetElement(templates.locators._buildingBlockCardOnCanvas) + .should("have.length", 3); + }); + + it("1. onboarding flow - should check page entity selection in explorer", function () { agHelper.GetNClick(onboarding.locators.seeMoreButtonOnCanvas, 0, true); agHelper.AssertElementVisibility(template.templateDialogBox); @@ -45,5 +53,30 @@ describe( .prev() .should("have.text", "Building Blocks"); }); + + it("2. `Connect your data` pop up should come up when we fork a building block from canvas.", function () { + agHelper.GetNClick(templates.locators._buildingBlockCardOnCanvas); + + agHelper.WaitUntilEleDisappear("Importing template"); + agHelper.AssertElementVisibility( + templates.locators._datasourceConnectPromptSubmitBtn, + ); + agHelper.GetNClick(templates.locators._datasourceConnectPromptSubmitBtn); + cy.url().should("include", "datasources/NEW"); + }); + + it("3. `Connect your data` pop up should NOT come up when user already has a datasource.", function () { + dataSources.CreateMockDB("Users"); + AppSidebar.navigate(AppSidebarButton.Editor); + + agHelper.GetNClick(templates.locators._buildingBlockCardOnCanvas, 0); + + agHelper.WaitUntilEleDisappear("Importing template"); + + agHelper.AssertElementAbsence( + templates.locators._datasourceConnectPromptSubmitBtn, + 4000, + ); + }); }, ); diff --git a/app/client/cypress/support/Pages/Templates.ts b/app/client/cypress/support/Pages/Templates.ts index 398406fd20d6..b802f2f5080f 100644 --- a/app/client/cypress/support/Pages/Templates.ts +++ b/app/client/cypress/support/Pages/Templates.ts @@ -8,6 +8,9 @@ export class Templates { _templatesTab: ".t--templates-tab", _forkApp: ".t--fork-template", _templateCard: "[data-testid='template-card']", + _buildingBlockCardOnCanvas: "[data-testid='t--canvas-building-block-item']", + _datasourceConnectPromptSubmitBtn: + "[data-testid='t--datasource-connect-prompt-submit-btn']", _templatesSearchInput: "[data-testid='t--application-search-input']", _resultsHeader: "[data-testid='t--application-templates-results-header']", _templateViewGoBack: "[data-testid='t--template-view-goback']", diff --git a/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/index.tsx b/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/index.tsx index 4f800d20777a..25e247a3e9e0 100644 --- a/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/index.tsx +++ b/app/client/src/layoutSystems/common/dropTarget/starterBuildingBlocks/index.tsx @@ -135,6 +135,7 @@ function StarterBuildingBlocks() { <TemplateLayoutContentGrid> {layoutItems.map((item, index) => ( <TemplateLayoutContentItem + data-testid="t--canvas-building-block-item" key={item.id} onClick={() => onClick( diff --git a/app/client/src/pages/Editor/Explorer/Datasources/DatasourceStarterLayoutPrompt.tsx b/app/client/src/pages/Editor/Explorer/Datasources/DatasourceStarterLayoutPrompt.tsx index 9d5adb7ad5e0..abfde687be53 100644 --- a/app/client/src/pages/Editor/Explorer/Datasources/DatasourceStarterLayoutPrompt.tsx +++ b/app/client/src/pages/Editor/Explorer/Datasources/DatasourceStarterLayoutPrompt.tsx @@ -109,7 +109,10 @@ function DatasourceStarterLayoutPrompt() { </PopoverBody> <BtnContainer> - <Button onClick={onClickConnect}> + <Button + data-testid="t--datasource-connect-prompt-submit-btn" + onClick={onClickConnect} + > {createMessage( STARTER_TEMPLATE_PAGE_LAYOUTS.datasourceConnectPrompt.buttonText, )}
e102ee781f71c8eadfd140065c7ca25feb2a8d0a
2021-09-14 22:25:29
balajisoundar
fix: Suppress unauthorised error, when user visits welcome page (#7435)
false
Suppress unauthorised error, when user visits welcome page (#7435)
fix
diff --git a/app/client/src/AppRouter.tsx b/app/client/src/AppRouter.tsx index 9f08eec7233f..895aa50e7e9c 100644 --- a/app/client/src/AppRouter.tsx +++ b/app/client/src/AppRouter.tsx @@ -134,7 +134,7 @@ class AppRouter extends React.Component<any, any> { component={UnsubscribeEmail} path={UNSUBSCRIBE_EMAIL_URL} /> - <SentryRoute component={Setup} path={SETUP} /> + <SentryRoute component={Setup} exact path={SETUP} /> <SentryRoute component={PageNotFound} /> </Switch> </>
80442153c669ec22fbff8c5a70dc99cc7ac37993
2024-04-24 10:41:42
Vemparala Surya Vamsi
chore: disable sending webworker logs in production (#32892)
false
disable sending webworker logs in production (#32892)
chore
diff --git a/app/client/src/sagas/EvaluationsSaga.ts b/app/client/src/sagas/EvaluationsSaga.ts index 88c513f915fa..a6bd4727b453 100644 --- a/app/client/src/sagas/EvaluationsSaga.ts +++ b/app/client/src/sagas/EvaluationsSaga.ts @@ -262,6 +262,8 @@ export function* evaluateTreeSaga( const widgetsMeta: ReturnType<typeof getWidgetsMeta> = yield select(getWidgetsMeta); + const shouldRespondWithLogs = log.getLevel() === log.levels.DEBUG; + const evalTreeRequestData: EvalTreeRequestData = { unevalTree: unEvalAndConfigTree, widgetTypeConfigMap, @@ -273,6 +275,7 @@ export function* evaluateTreeSaga( metaWidgets, appMode, widgetsMeta, + shouldRespondWithLogs, }; const workerResponse: EvalTreeResponseData = yield call( diff --git a/app/client/src/workers/Evaluation/handlers/evalTree.ts b/app/client/src/workers/Evaluation/handlers/evalTree.ts index 244e2cd9dee3..ca62439233fa 100644 --- a/app/client/src/workers/Evaluation/handlers/evalTree.ts +++ b/app/client/src/workers/Evaluation/handlers/evalTree.ts @@ -68,6 +68,7 @@ export function evalTree(request: EvalWorkerSyncRequest) { forceEvaluation, metaWidgets, shouldReplay, + shouldRespondWithLogs, theme, unevalTree: __unevalTree__, widgets, @@ -292,7 +293,9 @@ export function evalTree(request: EvalWorkerSyncRequest) { evaluationOrder: evalOrder, jsUpdates, webworkerTelemetry, - logs, + // be weary of the payload size of logs it can be huge and contribute to transmission overhead + // we are only sending logs in local debug mode + logs: shouldRespondWithLogs ? logs : [], unEvalUpdates, isCreateFirstTree, configTree, diff --git a/app/client/src/workers/Evaluation/types.ts b/app/client/src/workers/Evaluation/types.ts index 071600570485..55017e5475db 100644 --- a/app/client/src/workers/Evaluation/types.ts +++ b/app/client/src/workers/Evaluation/types.ts @@ -43,6 +43,7 @@ export interface EvalTreeRequestData { metaWidgets: MetaWidgetsReduxState; appMode?: APP_MODE; widgetsMeta: Record<string, any>; + shouldRespondWithLogs?: boolean; } export interface EvalTreeResponseData {
8a16903f31417065286d80f93ac8fc3e7d895c1a
2024-12-23 16:33:50
Rishabh Rathod
feat: Add currentPage, workspace, application name to appsmith context (#38114)
false
Add currentPage, workspace, application name to appsmith context (#38114)
feat
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts index f8190d48f01a..d37b4389a20d 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts @@ -298,7 +298,7 @@ describe("Autocomplete tests", { tags: ["@tag.JS", "@tag.Binding"] }, () => { ) .type("."); - agHelper.GetNAssertElementText(locators._hints, "geolocation"); + agHelper.GetNAssertElementText(locators._hints, "appName"); }); }); @@ -313,6 +313,6 @@ describe("Autocomplete tests", { tags: ["@tag.JS", "@tag.Binding"] }, () => { .type("{downArrow}{leftArrow}{leftArrow}"); agHelper.TypeText(locators._codeMirrorTextArea, "."); - agHelper.GetNAssertElementText(locators._hints, "geolocation"); + agHelper.GetNAssertElementText(locators._hints, "appName"); }); }); diff --git a/app/client/src/ce/entities/DataTree/types.ts b/app/client/src/ce/entities/DataTree/types.ts index a2fcbcbc9d2d..42652009b95e 100644 --- a/app/client/src/ce/entities/DataTree/types.ts +++ b/app/client/src/ce/entities/DataTree/types.ts @@ -190,6 +190,9 @@ export interface AppsmithEntity extends Omit<AppDataState, "store"> { ENTITY_TYPE: typeof ENTITY_TYPE.APPSMITH; store: Record<string, unknown>; theme: AppTheme["properties"]; + currentPageName: string; + workspaceName: string; + appName: string; } export interface DataTreeSeed { diff --git a/app/client/src/selectors/dataTreeSelectors.ts b/app/client/src/selectors/dataTreeSelectors.ts index 1babbe0563bd..b64f4fbba4f5 100644 --- a/app/client/src/selectors/dataTreeSelectors.ts +++ b/app/client/src/selectors/dataTreeSelectors.ts @@ -41,6 +41,9 @@ import { getCurrentWorkflowActions, getCurrentWorkflowJSActions, } from "ee/selectors/workflowSelectors"; +import { getCurrentApplication } from "ee/selectors/applicationSelectors"; +import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors"; +import type { PageListReduxState } from "reducers/entityReducers/pageListReducer"; export const getLoadingEntities = (state: AppState) => state.evaluations.loadingEntities; @@ -130,6 +133,15 @@ const getMetaWidgetsFromUnevaluatedDataTree = createSelector( DataTreeFactory.metaWidgets(metaWidgets, widgetsMeta, loadingEntities), ); +// * This is only for internal use to avoid cyclic dependency issue +const getPageListState = (state: AppState) => state.entities.pageList; +const getCurrentPageName = createSelector( + getPageListState, + (pageList: PageListReduxState) => + pageList.pages.find((page) => page.pageId === pageList.currentPageId) + ?.pageName, +); + export const getUnevaluatedDataTree = createSelector( getActionsFromUnevaluatedDataTree, getJSActionsFromUnevaluatedDataTree, @@ -137,7 +149,20 @@ export const getUnevaluatedDataTree = createSelector( getMetaWidgetsFromUnevaluatedDataTree, getAppData, getSelectedAppThemeProperties, - (actions, jsActions, widgets, metaWidgets, appData, theme) => { + getCurrentAppWorkspace, + getCurrentApplication, + getCurrentPageName, + ( + actions, + jsActions, + widgets, + metaWidgets, + appData, + theme, + currentWorkspace, + currentApplication, + getCurrentPageName, + ) => { let dataTree: UnEvalTree = { ...actions.dataTree, ...jsActions.dataTree, @@ -155,6 +180,9 @@ export const getUnevaluatedDataTree = createSelector( // taking precedence in case the key is the same store: appData.store, theme, + currentPageName: getCurrentPageName, + workspaceName: currentWorkspace.name, + appName: currentApplication?.name, } as AppsmithEntity; (dataTree.appsmith as AppsmithEntity).ENTITY_TYPE = ENTITY_TYPE.APPSMITH; dataTree = { ...dataTree, ...metaWidgets.dataTree };
4f20df633a95e32e568909cadb88a6f9e42cb905
2023-09-13 15:35:19
sneha122
feat: only movies collection shown for mock DB A/B (#27049)
false
only movies collection shown for mock DB A/B (#27049)
feat
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java index bb42b35cfeb9..2a46491cb42d 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java @@ -182,6 +182,24 @@ default Mono<DatasourceStructure> getStructure(C connection, DatasourceConfigura return Mono.empty(); } + /** + * This function fetches the structure of the tables/collections in the datasource. It's used to make query creation + * easier for the user. This method is specifically for mock datasources + * + * @param connection + * @param datasourceConfiguration + * @param isMock + * @param isMongoSchemaEnabledForMockDB + * @return + */ + default Mono<DatasourceStructure> getStructure( + C connection, + DatasourceConfiguration datasourceConfiguration, + Boolean isMock, + Boolean isMongoSchemaEnabledForMockDB) { + return this.getStructure(connection, datasourceConfiguration); + } + /** * Appsmith Server calls this function for execution of the action. * Default implementation which takes the variables that need to be substituted and then calls the plugin execute function 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 afce901c3d8b..49c0cafbd83c 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 @@ -157,6 +157,8 @@ public class MongoPlugin extends BasePlugin { private static final int TEST_DATASOURCE_TIMEOUT_SECONDS = 15; + private static final String MOCK_DB_MOVIES_COLLECTION_NAME = "movies"; + /** * We use this regex to identify the $regex attribute and the respective argument provided: * e.g. {"code" : {$regex: value, $options: value}} / {"code" : {$regex: value}} @@ -896,7 +898,10 @@ public Mono<DatasourceTestResult> testDatasource(DatasourceConfiguration datasou @Override public Mono<DatasourceStructure> getStructure( - MongoClient mongoClient, DatasourceConfiguration datasourceConfiguration) { + MongoClient mongoClient, + DatasourceConfiguration datasourceConfiguration, + Boolean isMock, + Boolean isMongoSchemaEnabledForMockDB) { final DatasourceStructure structure = new DatasourceStructure(); List<DatasourceStructure.Table> tables = new ArrayList<>(); structure.setTables(tables); @@ -904,6 +909,15 @@ public Mono<DatasourceStructure> getStructure( final MongoDatabase database = mongoClient.getDatabase(getDatabaseName(datasourceConfiguration)); return Flux.from(database.listCollectionNames()) + .filter(collectionName -> { + if (isMock != null + && isMock == true + && isMongoSchemaEnabledForMockDB != null + && isMongoSchemaEnabledForMockDB == true) { + return collectionName.equals(MOCK_DB_MOVIES_COLLECTION_NAME); + } + return true; + }) .flatMap(collectionName -> { final ArrayList<DatasourceStructure.Column> columns = new ArrayList<>(); final ArrayList<DatasourceStructure.Template> templates = new ArrayList<>(); diff --git a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginErrorsTest.java b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginErrorsTest.java index 341b84ce7c4b..43beac875b46 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginErrorsTest.java +++ b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginErrorsTest.java @@ -248,7 +248,7 @@ public void testGetStructureReadPermissionError() { DatasourceConfiguration dsConfig = createDatasourceConfiguration(); Mono<DatasourceStructure> structureMono = pluginExecutor .datasourceCreate(dsConfig) - .flatMap(connection -> pluginExecutor.getStructure(mockConnection, dsConfig)); + .flatMap(connection -> pluginExecutor.getStructure(mockConnection, dsConfig, null, null)); StepVerifier.create(structureMono).verifyErrorSatisfies(error -> { assertTrue(error instanceof AppsmithPluginException); diff --git a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginQueriesTest.java b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginQueriesTest.java index b4817987e04f..aee5e2c63661 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginQueriesTest.java +++ b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginQueriesTest.java @@ -398,7 +398,7 @@ public void testStructure() { DatasourceConfiguration dsConfig = createDatasourceConfiguration(); Mono<DatasourceStructure> structureMono = pluginExecutor .datasourceCreate(dsConfig) - .flatMap(connection -> pluginExecutor.getStructure(connection, dsConfig)); + .flatMap(connection -> pluginExecutor.getStructure(connection, dsConfig, null, null)); StepVerifier.create(structureMono) .assertNext(structure -> { diff --git a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginStaleConnTest.java b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginStaleConnTest.java index a6fdb5d44cd6..18b6c0a98cd3 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginStaleConnTest.java +++ b/app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginStaleConnTest.java @@ -134,7 +134,7 @@ public void testStaleConnectionOnIllegalStateExceptionOnGetStructure() { doReturn(Mono.error(new IllegalStateException())).when(spyMongoDatabase).listCollectionNames(); DatasourceConfiguration dsConfig = createDatasourceConfiguration(); - Mono<DatasourceStructure> structureMono = pluginExecutor.getStructure(spyMongoClient, dsConfig); + Mono<DatasourceStructure> structureMono = pluginExecutor.getStructure(spyMongoClient, dsConfig, null, null); StepVerifier.create(structureMono) .expectErrorMatches(throwable -> throwable instanceof StaleConnectionException) .verify(); @@ -150,7 +150,7 @@ public void testStaleConnectionOnMongoSocketWriteExceptionOnGetStructure() { .listCollectionNames(); DatasourceConfiguration dsConfig = createDatasourceConfiguration(); - Mono<DatasourceStructure> structureMono = pluginExecutor.getStructure(spyMongoClient, dsConfig); + Mono<DatasourceStructure> structureMono = pluginExecutor.getStructure(spyMongoClient, dsConfig, null, null); StepVerifier.create(structureMono) .expectErrorMatches(throwable -> throwable instanceof StaleConnectionException) .verify(); 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 72154059f5ce..23d2f8a6b29e 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 @@ -27,6 +27,7 @@ public enum FeatureFlagEnum { release_datasource_environments_enabled, APP_NAVIGATION_LOGO_UPLOAD, release_embed_hide_share_settings_enabled, + ab_mock_mongo_schema_enabled, // Add EE flags below this line, to avoid conflicts. } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/DatasourceStructureSolutionImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/DatasourceStructureSolutionImpl.java index 3a6fb7516152..4f502bcd2aa6 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/DatasourceStructureSolutionImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/DatasourceStructureSolutionImpl.java @@ -6,6 +6,7 @@ import com.appsmith.server.services.DatasourceService; import com.appsmith.server.services.DatasourceStorageService; import com.appsmith.server.services.DatasourceStructureService; +import com.appsmith.server.services.FeatureFlagService; import com.appsmith.server.services.PluginService; import com.appsmith.server.solutions.ce.DatasourceStructureSolutionCEImpl; import lombok.extern.slf4j.Slf4j; @@ -24,7 +25,8 @@ public DatasourceStructureSolutionImpl( DatasourcePermission datasourcePermission, DatasourceStructureService datasourceStructureService, AnalyticsService analyticsService, - EnvironmentPermission environmentPermission) { + EnvironmentPermission environmentPermission, + FeatureFlagService featureFlagService) { super( datasourceService, datasourceStorageService, @@ -34,6 +36,7 @@ public DatasourceStructureSolutionImpl( datasourcePermission, datasourceStructureService, analyticsService, - environmentPermission); + environmentPermission, + featureFlagService); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceStructureSolutionCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceStructureSolutionCEImpl.java index ec82d135a7f0..70616680cd7f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceStructureSolutionCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceStructureSolutionCEImpl.java @@ -15,12 +15,14 @@ import com.appsmith.server.constants.FieldName; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.featureflags.FeatureFlagEnum; import com.appsmith.server.helpers.PluginExecutorHelper; import com.appsmith.server.services.AnalyticsService; import com.appsmith.server.services.DatasourceContextService; import com.appsmith.server.services.DatasourceService; import com.appsmith.server.services.DatasourceStorageService; import com.appsmith.server.services.DatasourceStructureService; +import com.appsmith.server.services.FeatureFlagService; import com.appsmith.server.services.PluginService; import com.appsmith.server.solutions.DatasourcePermission; import com.appsmith.server.solutions.EnvironmentPermission; @@ -49,6 +51,7 @@ public class DatasourceStructureSolutionCEImpl implements DatasourceStructureSol private final DatasourceStructureService datasourceStructureService; private final AnalyticsService analyticsService; private final EnvironmentPermission environmentPermission; + private final FeatureFlagService featureFlagService; @Override public Mono<DatasourceStructure> getStructure(String datasourceId, boolean ignoreCache, String environmentId) { @@ -101,16 +104,25 @@ public Mono<DatasourceStructure> getStructure(DatasourceStorage datasourceStorag datasourceStructureService.getByDatasourceIdAndEnvironmentId( datasourceStorage.getDatasourceId(), datasourceStorage.getEnvironmentId()); + Mono<Boolean> flagMono = featureFlagService.check(FeatureFlagEnum.ab_mock_mongo_schema_enabled); + Mono<DatasourceStructure> fetchAndStoreNewStructureMono = pluginExecutorHelper .getPluginExecutor(pluginService.findById(datasourceStorage.getPluginId())) .switchIfEmpty(Mono.error(new AppsmithException( AppsmithError.NO_RESOURCE_FOUND, FieldName.PLUGIN, datasourceStorage.getPluginId()))) .flatMap(pluginExecutor -> { + return Mono.zip(Mono.just(pluginExecutor), flagMono); + }) + .flatMap(tuple -> { + PluginExecutor pluginExecutor = tuple.getT1(); + Boolean isMongoSchemaEnabledForMockDB = tuple.getT2(); return datasourceContextService.retryOnce( datasourceStorage, resourceContext -> ((PluginExecutor<Object>) pluginExecutor) .getStructure( resourceContext.getConnection(), - datasourceStorage.getDatasourceConfiguration())); + datasourceStorage.getDatasourceConfiguration(), + datasourceStorage.getIsMock(), + isMongoSchemaEnabledForMockDB)); }) .timeout(Duration.ofSeconds(GET_STRUCTURE_TIMEOUT_SECONDS)) .onErrorMap(
b9cb7a7c8680c3a10c9e180e0eab102e3a7b88e4
2023-04-20 16:40:44
Nilesh Sarupriya
chore: add helper method to be used in ee (#22303)
false
add helper method to be used in ee (#22303)
chore
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java index 7ee652d6ccfc..3261fad04b29 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java @@ -166,5 +166,9 @@ public class FieldNameCE { public static final String VIEW_MODE = "viewMode"; public static final String USER_EMAILS = "userEmails"; public static final String NUMBER_OF_USERS_INVITED = "numberOfUsersInvited"; -} + public static final String ASSIGNED_USERS_TO_PERMISSION_GROUPS = "assigned_users"; + public static final String UNASSIGNED_USERS_FROM_PERMISSION_GROUPS = "unassigned_users"; + public static final String NUMBER_OF_ASSIGNED_USERS = "numberOfAssignedUsers"; + public static final String NUMBER_OF_UNASSIGNED_USERS = "numberOfUnassignedUsers"; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PermissionGroupServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PermissionGroupServiceCE.java index 91680176eae7..515c9eea8739 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PermissionGroupServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PermissionGroupServiceCE.java @@ -53,4 +53,12 @@ public interface PermissionGroupServiceCE extends CrudService<PermissionGroup, S Mono<String> getPublicPermissionGroupId(); boolean isEntityAccessible(BaseDomain object, String permission, String publicPermissionGroupId); + + Mono<PermissionGroup> assignToUserAndSendEvent(PermissionGroup permissionGroup, User user); + + Mono<PermissionGroup> bulkAssignToUserAndSendEvent(PermissionGroup permissionGroup, List<User> users); + + Mono<PermissionGroup> unAssignFromUserAndSendEvent(PermissionGroup permissionGroup, User user); + + Mono<PermissionGroup> bulkUnAssignFromUserAndSendEvent(PermissionGroup permissionGroup, List<User> users); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PermissionGroupServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PermissionGroupServiceCEImpl.java index fa848743f530..fe525f0697f0 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PermissionGroupServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PermissionGroupServiceCEImpl.java @@ -1,8 +1,10 @@ package com.appsmith.server.services.ce; +import com.appsmith.external.constants.AnalyticsEvents; import com.appsmith.external.models.BaseDomain; import com.appsmith.external.models.Policy; import com.appsmith.server.acl.AclPermission; +import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.QPermissionGroup; import com.appsmith.server.domains.User; @@ -19,6 +21,7 @@ import com.appsmith.server.services.SessionUserService; import com.appsmith.server.services.TenantService; import com.appsmith.server.solutions.PermissionGroupPermission; +import org.apache.commons.collections.CollectionUtils; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; import org.springframework.data.mongodb.core.convert.MongoConverter; import org.springframework.data.mongodb.core.query.Update; @@ -306,4 +309,57 @@ public boolean isEntityAccessible(BaseDomain object, String permission, String p .isPresent(); } + protected Mono<PermissionGroup> sendEventUsersAssociatedToRole(PermissionGroup permissionGroup, + List<String> usernames) { + Mono<PermissionGroup> sendAssignedUsersToPermissionGroupEvent = Mono.just(permissionGroup); + if (CollectionUtils.isNotEmpty(usernames)) { + Map<String, Object> eventData = Map.of(FieldName.ASSIGNED_USERS_TO_PERMISSION_GROUPS, usernames); + Map<String, Object> extraPropsForCloudHostedInstance = Map.of(FieldName.ASSIGNED_USERS_TO_PERMISSION_GROUPS, usernames); + Map<String, Object> analyticsProperties = Map.of(FieldName.NUMBER_OF_ASSIGNED_USERS, usernames.size(), + FieldName.EVENT_DATA, eventData, + FieldName.CLOUD_HOSTED_EXTRA_PROPS, extraPropsForCloudHostedInstance); + sendAssignedUsersToPermissionGroupEvent = analyticsService.sendObjectEvent( + AnalyticsEvents.ASSIGNED_USERS_TO_PERMISSION_GROUP, permissionGroup, analyticsProperties); + } + return sendAssignedUsersToPermissionGroupEvent; + } + + protected Mono<PermissionGroup> sendEventUserRemovedFromRole(PermissionGroup permissionGroup, + List<String> usernames) { + Mono<PermissionGroup> sendUnAssignedUsersToPermissionGroupEvent = Mono.just(permissionGroup); + if (CollectionUtils.isNotEmpty(usernames)) { + Map<String, Object> eventData = Map.of(FieldName.UNASSIGNED_USERS_FROM_PERMISSION_GROUPS, usernames); + Map<String, Object> extraPropsForCloudHostedInstance = Map.of(FieldName.UNASSIGNED_USERS_FROM_PERMISSION_GROUPS, usernames); + Map<String, Object> analyticsProperties = Map.of(FieldName.NUMBER_OF_UNASSIGNED_USERS, usernames.size(), + FieldName.EVENT_DATA, eventData, + FieldName.CLOUD_HOSTED_EXTRA_PROPS, extraPropsForCloudHostedInstance); + sendUnAssignedUsersToPermissionGroupEvent = analyticsService.sendObjectEvent( + AnalyticsEvents.UNASSIGNED_USERS_FROM_PERMISSION_GROUP, permissionGroup, analyticsProperties); + } + return sendUnAssignedUsersToPermissionGroupEvent; + } + + @Override + public Mono<PermissionGroup> assignToUserAndSendEvent(PermissionGroup permissionGroup, User user) { + return bulkAssignToUserAndSendEvent(permissionGroup, List.of(user)); + } + + @Override + public Mono<PermissionGroup> bulkAssignToUserAndSendEvent(PermissionGroup permissionGroup, List<User> users) { + List<String> usernames = users.stream().map(User::getUsername).toList(); + return bulkAssignToUsers(permissionGroup, users) + .flatMap(permissionGroup1 -> sendEventUsersAssociatedToRole(permissionGroup, usernames)); + } + + @Override + public Mono<PermissionGroup> unAssignFromUserAndSendEvent(PermissionGroup permissionGroup, User user) { + return bulkUnAssignFromUserAndSendEvent(permissionGroup, List.of(user)); + } + + @Override + public Mono<PermissionGroup> bulkUnAssignFromUserAndSendEvent(PermissionGroup permissionGroup, List<User> users) { + List<String> usernames = users.stream().map(User::getUsername).toList(); + return bulkUnassignFromUsers(permissionGroup, users) + .flatMap(permissionGroup1 -> sendEventUserRemovedFromRole(permissionGroup, usernames)); + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserAndAccessManagementServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserAndAccessManagementServiceCEImpl.java index 2dcf7f5dce29..4ae3bd5f7550 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserAndAccessManagementServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserAndAccessManagementServiceCEImpl.java @@ -166,7 +166,7 @@ public Mono<List<User>> inviteUsers(InviteUsersDTO inviteUsersDTO, String origin .flatMap(tuple -> { PermissionGroup permissionGroup = tuple.getT1(); List<User> users = tuple.getT2(); - return permissionGroupService.bulkAssignToUsers(permissionGroup, users); + return permissionGroupService.bulkAssignToUserAndSendEvent(permissionGroup, users); }).cache(); // Send analytics event
e3c7d2b3f2a7074e69b5e966b73449a0cf70ba6d
2022-04-04 23:24:42
Anagh Hegde
fix: While importing the application page sequence does not match with the source application (#12539)
false
While importing the application page sequence does not match with the source application (#12539)
fix
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 90e800d91fff..d19580475f09 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 @@ -21,6 +21,7 @@ import com.appsmith.server.domains.Application; import com.appsmith.server.domains.ApplicationJson; import com.appsmith.server.domains.ApplicationPage; +import com.appsmith.server.domains.Collection; import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Theme; @@ -71,6 +72,8 @@ import java.lang.reflect.Type; import java.time.Instant; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -226,6 +229,7 @@ public Mono<ApplicationJson> exportApplicationById(String applicationId, Seriali // Refactor application to remove the ids final String organizationId = application.getOrganizationId(); + List<String> pageOrderList = application.getPages().stream().map(applicationPage -> applicationPage.getId()).collect(Collectors.toList()); removeUnwantedFieldsFromApplicationDuringExport(application); examplesOrganizationCloner.makePristine(application); applicationJson.setExportedApplication(application); @@ -237,6 +241,11 @@ public Mono<ApplicationJson> exportApplicationById(String applicationId, Seriali return pageFlux .collectList() + // Maintain the page order while exporting the application + .flatMap(newPages -> { + Collections.sort(newPages, Comparator.comparing(newPage -> pageOrderList.indexOf(newPage.getId()))); + return Mono.just(newPages); + }) .flatMap(newPageList -> { // Extract mongoEscapedWidgets from pages and save it to applicationJson object as this // field is JsonIgnored. Also remove any ids those are present in the page objects 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 962faf40cfe2..bca0af1e8344 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 @@ -1948,7 +1948,7 @@ public void applySchemaMigration_jsonFileWithFirstVersion_migratedToLatestVersio */ @Test @WithUserDetails(value = "api_user") - public void test1_exportApplication_withDatasourceConfig_exportedWithDecryptedFields() { + public void exportApplication_withDatasourceConfig_exportedWithDecryptedFields() { Organization newOrganization = new Organization(); newOrganization.setName("template-org-with-ds"); @@ -2170,7 +2170,7 @@ public void test1_exportApplication_withDatasourceConfig_exportedWithDecryptedFi */ @Test @WithUserDetails(value = "[email protected]") - public void test2_exportApplication_withReadOnlyAccess_exportedWithDecryptedFields() { + public void exportApplication_withReadOnlyAccess_exportedWithDecryptedFields() { Mono<ApplicationJson> exportApplicationMono = importExportApplicationService .exportApplicationById(exportWithConfigurationAppId, SerialiseApplicationObjective.SHARE); @@ -2289,4 +2289,43 @@ public void importApplication_datasourceWithSameNameAndPlugin_importedWithValidA .verifyComplete(); } + @Test + @WithUserDetails(value = "api_user") + public void exportApplication_withMultiplePages_PagesOrderIsMaintainedINExportedAppJson() { + Organization newOrganization = new Organization(); + newOrganization.setName("template-org-with-ds"); + + Application testApplication = new Application(); + testApplication.setName("exportApplication_withMultiplePages_PagesOrderIsMaintainedINExportedAppJson"); + testApplication.setExportWithConfiguration(true); + testApplication = applicationPageService.createApplication(testApplication, orgId).block(); + assert testApplication != null; + + PageDTO testPage = new PageDTO(); + testPage.setName("123"); + testPage.setApplicationId(testApplication.getId()); + PageDTO page1 = applicationPageService.createPage(testPage).block(); + + testPage = new PageDTO(); + testPage.setName("abc"); + testPage.setApplicationId(testApplication.getId()); + PageDTO page2 = applicationPageService.createPage(testPage).block(); + + // Set order for the newly created pages + applicationPageService.reorderPage(testApplication.getId(), page1.getId(), 0, null).block(); + applicationPageService.reorderPage(testApplication.getId(), page2.getId(), 1, null).block(); + + Mono<ApplicationJson> applicationJsonMono = importExportApplicationService.exportApplicationById(testApplication.getId(), ""); + + StepVerifier + .create(applicationJsonMono) + .assertNext(applicationJson -> { + List<NewPage> pageList = applicationJson.getPageList(); + assertThat(pageList.get(0).getUnpublishedPage().getName()).isEqualTo("123"); + assertThat(pageList.get(1).getUnpublishedPage().getName()).isEqualTo("abc"); + assertThat(pageList.get(2).getUnpublishedPage().getName()).isEqualTo("Page1"); + }) + .verifyComplete(); + } + }
b47f04206f0920e467b960dc9c630ea31a2f0944
2022-10-10 19:57:54
akash-codemonk
chore: fix templates feature flag param name (#17391)
false
fix templates feature flag param name (#17391)
chore
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 65d721bae2a2..1138fbf16970 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 @@ -68,5 +68,5 @@ ff4j: flipstrategy: class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy param: - - name: emails + - name: emailDomains value: appsmith.com,moolya.com
54a0f2b3c0c3995777242b844e04d047db1e5dff
2024-09-20 19:19:22
Abhishek Pandey
fix: show bindings menu does not appear in split mode (#36378)
false
show bindings menu does not appear in split mode (#36378)
fix
diff --git a/app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx b/app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx index 437d82314830..21846b52a95d 100644 --- a/app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx +++ b/app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx @@ -13,6 +13,8 @@ import { Button } from "@appsmith/ads"; import { getEntityProperties } from "ee/pages/Editor/Explorer/Entity/getEntityProperties"; import store from "store"; import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory"; +import { getIDEViewMode } from "selectors/ideSelectors"; +import { EditorViewMode } from "ee/entities/IDE/constants"; import { DEFAULT_EXPLORER_PANE_WIDTH } from "constants/AppConstants"; import { BOTTOM_BAR_HEIGHT } from "components/BottomBar/constants"; @@ -44,6 +46,8 @@ export function EntityProperties() { (state: AppState) => state.ui.widgetDragResize.lastSelectedWidget, ); + const ideViewMode = useSelector(getIDEViewMode); + useEffect(() => { document.addEventListener("click", handleOutsideClick); @@ -123,7 +127,10 @@ export function EntityProperties() { ref.current.style.bottom = "unset"; } - ref.current.style.left = DEFAULT_EXPLORER_PANE_WIDTH + "px"; + ref.current.style.left = + ideViewMode === EditorViewMode.SplitScreen + ? "100%" + : DEFAULT_EXPLORER_PANE_WIDTH + "px"; } }, [entityId]);
9877fe4b05f057d77fc45372e47a65310fee0df2
2021-09-20 16:50:22
akash-codemonk
fix: Switch to the debugger error tab when clicked on the debug button in toast (#7455)
false
Switch to the debugger error tab when clicked on the debug button in toast (#7455)
fix
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Debugger/Widget_Error_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Debugger/Widget_Error_spec.js index e82aff467708..3082b5a97695 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Debugger/Widget_Error_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Debugger/Widget_Error_spec.js @@ -1,6 +1,7 @@ const dsl = require("../../../../fixtures/buttondsl.json"); const debuggerLocators = require("../../../../locators/Debugger.json"); const commonlocators = require("../../../../locators/commonlocators.json"); +const widgetLocators = require("../../../../locators/Widgets.json"); describe("Widget error state", function() { before(() => { @@ -24,15 +25,26 @@ describe("Widget error state", function() { cy.get(debuggerLocators.debuggerLogState).contains("Test"); }); - it("All errors should be expanded by default", function() { - cy.testJsontext("label", "{{[]}}"); + it("Switch to error tab when clicked on the debug button", function() { + cy.get("[data-cy=t--tab-LOGS_TAB]").click(); + cy.get(".t--property-control-onclick") + .find(".t--js-toggle") + .click(); + cy.testJsontext("onclick", "{{testApi.run()}}"); + cy.get(widgetLocators.buttonWidget).click(); + cy.get(".t--toast-debug-button").click(); + cy.contains(".react-tabs__tab--selected", "Errors"); + }); + + it("All errors should be expanded by default", function() { cy.get(debuggerLocators.errorMessage) .should("be.visible") .should("have.length", 2); }); it("Recent errors are shown at the top of the list", function() { + cy.testJsontext("label", "{{[]}}"); cy.get(debuggerLocators.debuggerLogState) .first() .contains("text"); diff --git a/app/client/src/actions/debuggerActions.ts b/app/client/src/actions/debuggerActions.ts index 0ca69c4ac099..9672660b0e0a 100644 --- a/app/client/src/actions/debuggerActions.ts +++ b/app/client/src/actions/debuggerActions.ts @@ -1,3 +1,4 @@ +import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/helpers"; import { ReduxActionTypes } from "constants/ReduxActionConstants"; import { ENTITY_TYPE, Log, Message } from "entities/AppsmithConsole"; import { EventName } from "utils/AnalyticsUtil"; @@ -73,3 +74,8 @@ export const hideDebuggerErrors = (payload: boolean) => ({ type: ReduxActionTypes.HIDE_DEBUGGER_ERRORS, payload, }); + +export const setCurrentTab = (payload: DEBUGGER_TAB_KEYS) => ({ + type: ReduxActionTypes.SET_CURRENT_DEBUGGER_TAB, + payload, +}); diff --git a/app/client/src/components/ads/Toast.tsx b/app/client/src/components/ads/Toast.tsx index 953e0f273e1d..2e568d30b286 100644 --- a/app/client/src/components/ads/Toast.tsx +++ b/app/client/src/components/ads/Toast.tsx @@ -142,7 +142,10 @@ function ToastComponent(props: ToastProps & { undoAction?: () => void }) { <ToastTextWrapper> <Text type={TextType.P1}>{props.text}</Text> {props.variant === Variant.danger && props.showDebugButton ? ( - <StyledDebugButton source={"TOAST"} /> + <StyledDebugButton + className="t--toast-debug-button" + source={"TOAST"} + /> ) : null} </ToastTextWrapper> </FlexContainer> diff --git a/app/client/src/components/editorComponents/Debugger/DebugCTA.tsx b/app/client/src/components/editorComponents/Debugger/DebugCTA.tsx index c250ca92a520..624bef089677 100644 --- a/app/client/src/components/editorComponents/Debugger/DebugCTA.tsx +++ b/app/client/src/components/editorComponents/Debugger/DebugCTA.tsx @@ -1,7 +1,7 @@ import React from "react"; import styled from "styled-components"; import Button from "components/ads/Button"; -import { showDebugger } from "actions/debuggerActions"; +import { setCurrentTab, showDebugger } from "actions/debuggerActions"; import { useDispatch, useSelector } from "react-redux"; import { Classes, Variant } from "components/ads/common"; import { getAppMode } from "selectors/applicationSelectors"; @@ -11,6 +11,7 @@ import Icon, { IconSize } from "components/ads/Icon"; import { Message } from "entities/AppsmithConsole"; import ContextualMenu from "./ContextualMenu"; import { Position } from "@blueprintjs/core"; +import { DEBUGGER_TAB_KEYS } from "./helpers"; import { Colors } from "constants/Colors"; const EVDebugButton = styled.button` @@ -119,6 +120,7 @@ function DebugCTA(props: DebugCTAProps) { source: props.source, }); dispatch(showDebugger(true)); + dispatch(setCurrentTab(DEBUGGER_TAB_KEYS.ERROR_TAB)); }; return <DebugButton className={props.className} onClick={onClick} />; diff --git a/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx b/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx index 0866742a67c1..512782a337ac 100644 --- a/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx +++ b/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx @@ -1,10 +1,10 @@ -import React, { RefObject, useRef, useState } from "react"; +import React, { RefObject, useEffect, useRef, useState } from "react"; import styled from "styled-components"; import { TabComponent } from "components/ads/Tabs"; import Icon, { IconSize } from "components/ads/Icon"; import DebuggerLogs from "./DebuggerLogs"; -import { useDispatch } from "react-redux"; -import { showDebugger } from "actions/debuggerActions"; +import { useDispatch, useSelector } from "react-redux"; +import { setCurrentTab, showDebugger } from "actions/debuggerActions"; import Errors from "./Errors"; import Resizer, { ResizerCSS } from "./Resizer"; import AnalyticsUtil from "utils/AnalyticsUtil"; @@ -16,6 +16,8 @@ import { INSPECT_ENTITY, } from "constants/messages"; import { stopEventPropagation } from "utils/AppsmithUtils"; +import { getCurrentDebuggerTab } from "selectors/debuggerSelectors"; +import { DEBUGGER_TAB_KEYS } from "./helpers"; const TABS_HEADER_HEIGHT = 36; @@ -48,17 +50,17 @@ type DebuggerTabsProps = { const DEBUGGER_TABS = [ { - key: "ERROR", + key: DEBUGGER_TAB_KEYS.ERROR_TAB, title: createMessage(DEBUGGER_ERRORS), panelComponent: <Errors hasShortCut />, }, { - key: "LOGS", + key: DEBUGGER_TAB_KEYS.LOGS_TAB, title: createMessage(DEBUGGER_LOGS), panelComponent: <DebuggerLogs hasShortCut />, }, { - key: "INSPECT_ELEMENTS", + key: DEBUGGER_TAB_KEYS.INSPECT_TAB, title: createMessage(INSPECT_ENTITY), panelComponent: <EntityDeps />, }, @@ -66,17 +68,28 @@ const DEBUGGER_TABS = [ function DebuggerTabs(props: DebuggerTabsProps) { const [selectedIndex, setSelectedIndex] = useState(props.defaultIndex); + const currentTab = useSelector(getCurrentDebuggerTab); const dispatch = useDispatch(); const panelRef: RefObject<HTMLDivElement> = useRef(null); const onTabSelect = (index: number) => { AnalyticsUtil.logEvent("DEBUGGER_TAB_SWITCH", { tabName: DEBUGGER_TABS[index].key, }); - setSelectedIndex(index); + dispatch(setCurrentTab(DEBUGGER_TABS[index].key)); }; const onClose = () => dispatch(showDebugger(false)); + useEffect(() => { + const index = DEBUGGER_TABS.findIndex((tab) => tab.key === currentTab); + + if (index >= 0) { + onTabSelect(index); + } else { + onTabSelect(0); + } + }, [currentTab]); + return ( <Container onClick={stopEventPropagation} ref={panelRef}> <Resizer panelRef={panelRef} /> diff --git a/app/client/src/components/editorComponents/Debugger/helpers.tsx b/app/client/src/components/editorComponents/Debugger/helpers.tsx index 77290eef72a0..7f54524ccd25 100644 --- a/app/client/src/components/editorComponents/Debugger/helpers.tsx +++ b/app/client/src/components/editorComponents/Debugger/helpers.tsx @@ -48,6 +48,12 @@ export function BlankState(props: { ); } +export enum DEBUGGER_TAB_KEYS { + ERROR_TAB = "ERROR", + LOGS_TAB = "LOGS_TAB", + INSPECT_TAB = "INSPECT_TAB", +} + export const SeverityIcon: Record<Severity, string> = { [Severity.INFO]: "success", [Severity.ERROR]: "error", diff --git a/app/client/src/constants/ReduxActionConstants.tsx b/app/client/src/constants/ReduxActionConstants.tsx index 4a4cb86df611..891a5a879f31 100644 --- a/app/client/src/constants/ReduxActionConstants.tsx +++ b/app/client/src/constants/ReduxActionConstants.tsx @@ -168,6 +168,7 @@ export const ReduxActionTypes = { CLEAR_DEBUGGER_LOGS: "CLEAR_DEBUGGER_LOGS", SHOW_DEBUGGER: "SHOW_DEBUGGER", HIDE_DEBUGGER_ERRORS: "HIDE_DEBUGGER_ERRORS", + SET_CURRENT_DEBUGGER_TAB: "SET_CURRENT_DEBUGGER_TAB", SET_ACTION_TABS_INITIAL_INDEX: "SET_ACTION_TABS_INITIAL_INDEX", SET_THEME: "SET_THEME", FETCH_WIDGET_CARDS: "FETCH_WIDGET_CARDS", diff --git a/app/client/src/reducers/uiReducers/debuggerReducer.ts b/app/client/src/reducers/uiReducers/debuggerReducer.ts index bae5a831a048..f8858b978e5e 100644 --- a/app/client/src/reducers/uiReducers/debuggerReducer.ts +++ b/app/client/src/reducers/uiReducers/debuggerReducer.ts @@ -2,6 +2,7 @@ import { createReducer } from "utils/AppsmithUtils"; import { Log } from "entities/AppsmithConsole"; import { ReduxAction, ReduxActionTypes } from "constants/ReduxActionConstants"; import { omit, isUndefined } from "lodash"; +import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/helpers"; const initialState: DebuggerReduxState = { logs: [], @@ -9,6 +10,7 @@ const initialState: DebuggerReduxState = { errors: {}, expandId: "", hideErrors: true, + currentTab: DEBUGGER_TAB_KEYS.LOGS_TAB, }; const debuggerReducer = createReducer(initialState, { @@ -70,6 +72,15 @@ const debuggerReducer = createReducer(initialState, { hideErrors: action.payload, }; }, + [ReduxActionTypes.SET_CURRENT_DEBUGGER_TAB]: ( + state: DebuggerReduxState, + action: ReduxAction<DEBUGGER_TAB_KEYS>, + ) => { + return { + ...state, + currentTab: action.payload, + }; + }, [ReduxActionTypes.INIT_CANVAS_LAYOUT]: () => { return { ...initialState, @@ -83,6 +94,7 @@ export interface DebuggerReduxState { errors: Record<string, Log>; expandId: string; hideErrors: boolean; + currentTab: DEBUGGER_TAB_KEYS; } export default debuggerReducer; diff --git a/app/client/src/selectors/debuggerSelectors.tsx b/app/client/src/selectors/debuggerSelectors.tsx index 3783894de1bd..b4d29ff0e904 100644 --- a/app/client/src/selectors/debuggerSelectors.tsx +++ b/app/client/src/selectors/debuggerSelectors.tsx @@ -11,6 +11,8 @@ export const getFilteredErrors = createSelector( return errors; }, ); +export const getCurrentDebuggerTab = (state: AppState) => + state.ui.debugger.currentTab; export const getMessageCount = createSelector(getFilteredErrors, (errors) => { const errorKeys = Object.keys(errors);
927383b82a97380f8134122cd89f382f2277ab76
2025-01-29 16:13:11
Rudraprasad Das
chore: git pkg - adding baseIds in package based urls (#38827)
false
git pkg - adding baseIds in package based urls (#38827)
chore
diff --git a/app/client/src/ce/constants/ModuleConstants.ts b/app/client/src/ce/constants/ModuleConstants.ts index aa69b5ff2f18..c5743837df3b 100644 --- a/app/client/src/ce/constants/ModuleConstants.ts +++ b/app/client/src/ce/constants/ModuleConstants.ts @@ -20,6 +20,7 @@ export interface ModuleInputSection { export interface Module extends Pick<ModuleMetadata, "pluginId" | "pluginType" | "datasourceId"> { id: ID; + baseId: ID; name: string; packageId: ID; inputsForm: ModuleInputSection[]; diff --git a/app/client/src/ce/constants/PackageConstants.ts b/app/client/src/ce/constants/PackageConstants.ts index 653d2a3accae..5d0ea3610732 100644 --- a/app/client/src/ce/constants/PackageConstants.ts +++ b/app/client/src/ce/constants/PackageConstants.ts @@ -2,6 +2,7 @@ type ID = string; export interface Package { id: ID; + baseId: ID; name: string; // Name of the package. icon: string; color: string; diff --git a/app/client/src/navigation/FocusEntity.ts b/app/client/src/navigation/FocusEntity.ts index 2d61ce557e89..7b50baa57cb0 100644 --- a/app/client/src/navigation/FocusEntity.ts +++ b/app/client/src/navigation/FocusEntity.ts @@ -63,8 +63,8 @@ export interface MatchEntityFromPath { baseApplicationId?: string; customSlug?: string; applicationSlug?: string; - packageId?: string; - moduleId?: string; + basePackageId?: string; + baseModuleId?: string; workflowId?: string; pageSlug?: string; baseApiId?: string;
9fc8c92b0277821c588e1add848cb2a4aa722b59
2021-10-06 12:17:59
balajisoundar
chore: show canvas when user selects widgets tab during signposting flow (#8205)
false
show canvas when user selects widgets tab during signposting flow (#8205)
chore
diff --git a/app/client/src/components/editorComponents/Sidebar.tsx b/app/client/src/components/editorComponents/Sidebar.tsx index a879e057b40b..87994d09a3a5 100644 --- a/app/client/src/components/editorComponents/Sidebar.tsx +++ b/app/client/src/components/editorComponents/Sidebar.tsx @@ -24,6 +24,7 @@ import { } from "selectors/editorSelectors"; import { BUILDER_PAGE_URL } from "constants/routes"; import history from "utils/history"; +import { toggleInOnboardingWidgetSelection } from "actions/onboardingActions"; const SidebarWrapper = styled.div<{ inOnboarding: boolean }>` background-color: ${Colors.WHITE}; @@ -54,6 +55,9 @@ export const Sidebar = memo(() => { const dispatch = useDispatch(); const applicationId = useSelector(getCurrentApplicationId); const pageId = useSelector(getCurrentPageId); + const isFirstTimeUserOnboardingEnabled = useSelector( + getIsFirstTimeUserOnboardingEnabled, + ); const switches = [ { id: "explorer", @@ -68,6 +72,9 @@ export const Sidebar = memo(() => { BUILDER_PAGE_URL(applicationId, pageId) === window.location.pathname ) && history.push(BUILDER_PAGE_URL(applicationId, pageId)); setTimeout(() => dispatch(forceOpenWidgetPanel(true)), 0); + if (isFirstTimeUserOnboardingEnabled) { + dispatch(toggleInOnboardingWidgetSelection(true)); + } }, }, ];
9a48da44366f1929b34fe21c5603a6c2acf30742
2025-03-18 20:31:35
Valera Melnikov
chore: remove anvil flag for git (#39785)
false
remove anvil flag for git (#39785)
chore
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts index d74522682e29..8a9505d8a7f1 100644 --- a/app/client/src/ce/constants/messages.ts +++ b/app/client/src/ce/constants/messages.ts @@ -682,8 +682,6 @@ export const ERROR_IMPORTING_APPLICATION_TO_WORKSPACE = () => export const IMPORT_APPLICATION_MODAL_TITLE = () => "Import application"; export const IMPORT_APPLICATION_MODAL_LABEL = () => "Where would you like to import your application from?"; -export const IMPORT_FROM_GIT_DISABLED_IN_ANVIL = () => - "Importing from Git repositories is not yet supported in Anvil α"; export const IMPORT_APP_FROM_FILE_TITLE = () => "Import from file"; export const UPLOADING_JSON = () => "Uploading JSON file"; export const UPLOADING_APPLICATION = () => "Uploading application"; diff --git a/app/client/src/pages/common/ImportModal.tsx b/app/client/src/pages/common/ImportModal.tsx index d22ddffd0e13..dc6ee7141df1 100644 --- a/app/client/src/pages/common/ImportModal.tsx +++ b/app/client/src/pages/common/ImportModal.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from "react"; import React, { useCallback, useEffect } from "react"; import styled, { useTheme, css } from "styled-components"; -import { useDispatch, useSelector } from "react-redux"; +import { useDispatch } from "react-redux"; import { setWorkspaceIdForImport } from "ee/actions/applicationActions"; import { createMessage, @@ -9,7 +9,6 @@ import { IMPORT_APP_FROM_FILE_TITLE, IMPORT_APP_FROM_GIT_MESSAGE, IMPORT_APP_FROM_GIT_TITLE, - IMPORT_FROM_GIT_DISABLED_IN_ANVIL, UPLOADING_JSON, } from "ee/constants/messages"; import { FilePickerV2, FileType } from "@appsmith/ads-old"; @@ -19,17 +18,9 @@ import { ReduxActionTypes } from "ee/constants/ReduxActionConstants"; import Statusbar from "pages/Editor/gitSync/components/Statusbar"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import type { Theme } from "constants/DefaultTheme"; -import { - Callout, - Icon, - Modal, - ModalContent, - ModalHeader, - Text, -} from "@appsmith/ads"; +import { Icon, Modal, ModalContent, ModalHeader, Text } from "@appsmith/ads"; 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 { gitToggleImportModal } from "git/store"; @@ -215,8 +206,6 @@ function ImportModal(props: ImportModalProps) { resetAppFileToBeUploaded, uploadingText, } = useMethods({ editorId, workspaceId }); - - const isAnvilEnabled = useSelector(getIsAnvilLayoutEnabled); const dispatch = useDispatch(); const onGitImport = useCallback(() => { onClose && onClose(); @@ -281,15 +270,6 @@ function ImportModal(props: ImportModalProps) { ? createMessage(UPLOADING_JSON) : mainDescription} </Text> - { - // If Anvil is enabled, we disable the import via Git option. - // This callout informs the user of this. - isAnvilEnabled && ( - <Callout kind="warning" onClose={() => {}}> - {createMessage(IMPORT_FROM_GIT_DISABLED_IN_ANVIL)} - </Callout> - ) - } </TextWrapper> {!isImporting && ( @@ -309,9 +289,7 @@ function ImportModal(props: ImportModalProps) { uploadIcon="file-line" /> </FileImportCard> - {!toEditor && !isAnvilEnabled && ( - <GitImportCard handler={onGitImport} /> - )} + {!toEditor && <GitImportCard handler={onGitImport} />} </Row> )} {isImporting && (
e592eceaa862bd6b500774a8d14289cf1c6a5066
2024-09-18 15:38:02
albinAppsmith
fix: Datasource preview not taking full height (#36389)
false
Datasource preview not taking full height (#36389)
fix
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasorceTabs.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasorceTabs.tsx index 5771adb85dad..d89d837e27f0 100644 --- a/app/client/src/pages/Editor/DatasourceInfo/DatasorceTabs.tsx +++ b/app/client/src/pages/Editor/DatasourceInfo/DatasorceTabs.tsx @@ -25,6 +25,7 @@ const TabsContainer = styled(Tabs)` overflow: hidden; display: flex; flex-direction: column; + max-height: unset; `; const TabListWrapper = styled(TabsList)`
072d35b08fb09cfe48e266d7a764a59836ef3c8d
2023-06-26 17:56:43
Manish Kumar
fix: returning empty datasourceStucture instead of empty on invalid (#24802)
false
returning empty datasourceStucture instead of empty on invalid (#24802)
fix
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceStructureSolutionCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceStructureSolutionCEImpl.java index 9ca09a3ff3d4..e680a0b1d4b8 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceStructureSolutionCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceStructureSolutionCEImpl.java @@ -80,7 +80,9 @@ public Mono<DatasourceStructure> getStructure(DatasourceStorage datasourceStorag boolean ignoreCache) { if (Boolean.FALSE.equals(datasourceStorage.getIsValid())) { - return Mono.empty(); + return analyticsService.sendObjectEvent(AnalyticsEvents.DS_SCHEMA_FETCH_EVENT_FAILED, + datasourceStorage, getAnalyticsPropertiesForTestEventStatus(datasourceStorage, false)) + .then(Mono.just(new DatasourceStructure())); } Mono<DatasourceStorageStructure> configurationStructureMono = datasourceStructureService diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/DatasourceStructureSolutionTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/DatasourceStructureSolutionTest.java index 74100a27e3d5..482e71b7eb45 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/DatasourceStructureSolutionTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/DatasourceStructureSolutionTest.java @@ -4,6 +4,7 @@ import com.appsmith.external.models.DBAuth; import com.appsmith.external.models.Datasource; import com.appsmith.external.models.DatasourceConfiguration; +import com.appsmith.external.models.DatasourceStorage; import com.appsmith.external.models.DatasourceStorageDTO; import com.appsmith.external.models.DatasourceStorageStructure; import com.appsmith.external.models.DatasourceStructure; @@ -38,6 +39,7 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.util.HashSet; import java.util.List; import static com.appsmith.external.models.DatasourceStructure.TableType.TABLE; @@ -403,4 +405,30 @@ public void verifyDuplicateKeyErrorOnSave() { }); } + + @Test + @WithUserDetails(value = "api_user") + public void verifyEmptyDatasourceStructureObjectIfDatasourceIsInvalid() { + DatasourceStorage datasourceStorage = new DatasourceStorage(); + datasourceStorage.setDatasourceId(datasourceId); + datasourceStorage.setEnvironmentId(defaultEnvironmentId); + datasourceStorage.setInvalids(new HashSet<>()); + datasourceStorage.getInvalids().add("random invalid"); + + doReturn(Mono.just(datasourceStorage)) + .when(datasourceStorageService).findByDatasourceAndEnvironmentId(any(), any()); + + Mono<DatasourceStructure> datasourceStructureMono = + datasourceStructureSolution.getStructure(datasourceId, Boolean.FALSE, defaultEnvironmentId); + + StepVerifier + .create(datasourceStructureMono) + .assertNext(datasourceStructure -> { + assertThat(datasourceStructure.getTables()).isNull(); + assertThat(datasourceStructure.getError()).isNull(); + }) + .verifyComplete(); + + } + }
022d45714fc94bfe276bfed255c7384487e3c11c
2024-05-06 18:02:52
Ayush Pahwa
fix: disable main js rename from entity pane (#33202)
false
disable main js rename from entity pane (#33202)
fix
diff --git a/app/client/src/pages/Editor/Explorer/Entity/index.tsx b/app/client/src/pages/Editor/Explorer/Entity/index.tsx index 1ec18753f39b..9870d7545a0c 100644 --- a/app/client/src/pages/Editor/Explorer/Entity/index.tsx +++ b/app/client/src/pages/Editor/Explorer/Entity/index.tsx @@ -29,6 +29,7 @@ import { createMessage, EXPLORER_BETA_ENTITY, } from "@appsmith/constants/messages"; +import classNames from "classnames"; export enum EntityClassNames { CONTEXT_MENU = "entity-context-menu", @@ -361,9 +362,12 @@ export const Entity = forwardRef( <EntityItem active={!!props.active} alwaysShowRightIcon={props.alwaysShowRightIcon} - className={`${props.highlight ? "highlighted" : ""} ${ - props.active ? "active" : "" - } t--entity-item`} + className={classNames({ + highlighted: props.highlight, + active: props.active, + editable: canEditEntityName, + "t--entity-item": true, + })} data-guided-tour-id={`explorer-entity-${props.name}`} data-guided-tour-iid={props.name} data-testid={`t--entity-item-${props.name}`} diff --git a/app/client/src/pages/Editor/Explorer/JSActions/JSActionEntity.tsx b/app/client/src/pages/Editor/Explorer/JSActions/JSActionEntity.tsx index b558c7611b0b..f7d0c7e0bb6a 100644 --- a/app/client/src/pages/Editor/Explorer/JSActions/JSActionEntity.tsx +++ b/app/client/src/pages/Editor/Explorer/JSActions/JSActionEntity.tsx @@ -92,7 +92,9 @@ export const ExplorerJSCollectionEntity = memo( <Entity action={navigateToJSCollection} active={props.isActive} - canEditEntityName={canManageJSAction} + canEditEntityName={ + canManageJSAction && !Boolean(jsAction?.isMainJSCollection) + } className="t--jsaction" contextMenu={contextMenu} entityId={jsAction.id} diff --git a/app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx b/app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx index cb1418467f4a..8485c729ac79 100644 --- a/app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx +++ b/app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx @@ -306,5 +306,56 @@ describe("IDE Render: JS", () => { // Close button is rendered getByRole("button", { name: "Close pane" }); }); + + it("Prevents edit of main JS object", () => { + const page = PageFactory.build(); + const Main_JS = JSObjectFactory.build({ + id: "js_id", + name: "Main", + pageId: page.pageId, + }); + Main_JS.isMainJSCollection = true; + + const Normal_JS = JSObjectFactory.build({ + id: "js_id2", + name: "Normal", + pageId: page.pageId, + }); + + const state = getIDETestState({ + pages: [page], + js: [Main_JS, Normal_JS], + tabs: { + [EditorEntityTab.QUERIES]: [], + [EditorEntityTab.JS]: ["js_id"], + }, + }); + + const { getByTestId } = render( + <Route path={BUILDER_PATH}> + <IDE /> + </Route>, + { + url: "/app/applicationSlug/pageSlug-page_id/edit/jsObjects/js_id", + initialState: state, + featureFlags: FeatureFlags, + }, + ); + + // Normal JS object should be editable + const normalJsObjectEntity = getByTestId("t--entity-item-Normal"); + expect(normalJsObjectEntity.classList.contains("editable")).toBe(true); + + // should have `t--context-menu` as a child of the normalJsObjectEntity + expect( + normalJsObjectEntity.querySelector(".t--context-menu"), + ).not.toBeNull(); + + // Main JS object should not be editable + const mainJsObjectEntity = getByTestId("t--entity-item-Main"); + expect(mainJsObjectEntity.classList.contains("editable")).toBe(false); + // should not have `t--context-menu` as a child of the mainJsObjectEntity + expect(mainJsObjectEntity.querySelector(".t--context-menu")).toBeNull(); + }); }); });
5a80e9b0146fb04d709abf03eac85aeefc414ab2
2021-10-20 20:05:12
akash-codemonk
fix: scroll bar shifting widget sidebar content on windows (#8524)
false
scroll bar shifting widget sidebar content on windows (#8524)
fix
diff --git a/app/client/src/components/editorComponents/Debugger/DebuggerLogs.tsx b/app/client/src/components/editorComponents/Debugger/DebuggerLogs.tsx index 9a8ab37fa7fb..f578ffd5319c 100644 --- a/app/client/src/components/editorComponents/Debugger/DebuggerLogs.tsx +++ b/app/client/src/components/editorComponents/Debugger/DebuggerLogs.tsx @@ -10,6 +10,7 @@ import { createMessage, NO_LOGS } from "constants/messages"; import { useSelector } from "react-redux"; import { getCurrentUser } from "selectors/usersSelectors"; import { bootIntercom } from "utils/helpers"; +import { thinScrollbar } from "constants/DefaultTheme"; const LIST_HEADER_HEIGHT = "38px"; @@ -21,6 +22,7 @@ const ContainerWrapper = styled.div` const ListWrapper = styled.div` overflow: auto; height: calc(100% - ${LIST_HEADER_HEIGHT}); + ${thinScrollbar}; `; type Props = { diff --git a/app/client/src/components/editorComponents/Debugger/EntityDependecies.tsx b/app/client/src/components/editorComponents/Debugger/EntityDependecies.tsx index c5e7dc7d0642..0dde9f1d30c0 100644 --- a/app/client/src/components/editorComponents/Debugger/EntityDependecies.tsx +++ b/app/client/src/components/editorComponents/Debugger/EntityDependecies.tsx @@ -18,7 +18,7 @@ import { import { getDependenciesFromInverseDependencies } from "./helpers"; import { useSelectedEntity, useEntityLink } from "./hooks/debuggerHooks"; import AnalyticsUtil from "utils/AnalyticsUtil"; -import { getTypographyByKey } from "constants/DefaultTheme"; +import { getTypographyByKey, thinScrollbar } from "constants/DefaultTheme"; import Tooltip from "components/ads/Tooltip"; import Text, { TextType } from "components/ads/Text"; import { ENTITY_TYPE } from "entities/AppsmithConsole"; @@ -90,6 +90,7 @@ const ConnectionFlow = styled.div` const Wrapper = styled.div` display: flex; height: 100%; + ${thinScrollbar}; align-items: center; justify-content: center; padding: 0px 100px; diff --git a/app/client/src/components/editorComponents/Debugger/Errors.tsx b/app/client/src/components/editorComponents/Debugger/Errors.tsx index e962522ee1fa..4140ec7acf43 100644 --- a/app/client/src/components/editorComponents/Debugger/Errors.tsx +++ b/app/client/src/components/editorComponents/Debugger/Errors.tsx @@ -7,6 +7,7 @@ import { BlankState } from "./helpers"; import { createMessage, NO_ERRORS } from "constants/messages"; import { getCurrentUser } from "selectors/usersSelectors"; import { bootIntercom } from "utils/helpers"; +import { thinScrollbar } from "constants/DefaultTheme"; const ContainerWrapper = styled.div` overflow: hidden; @@ -15,6 +16,7 @@ const ContainerWrapper = styled.div` const ListWrapper = styled.div` overflow: auto; + ${thinScrollbar}; height: 100%; `; diff --git a/app/client/src/constants/DefaultTheme.tsx b/app/client/src/constants/DefaultTheme.tsx index 347e53eef609..9e5a59233a8c 100644 --- a/app/client/src/constants/DefaultTheme.tsx +++ b/app/client/src/constants/DefaultTheme.tsx @@ -43,43 +43,6 @@ export enum Skin { DARK, } -export const hideScrollbar = css` - scrollbar-width: none; - -ms-overflow-style: none; - &::-webkit-scrollbar { - display: none; - -webkit-appearance: none; - } -`; - -export const thinScrollbar = css` - ::-webkit-scrollbar { - width: 4px; - } - - /* Track */ - ::-webkit-scrollbar-track { - border-radius: 10px; - } - - /* Handle */ - ::-webkit-scrollbar-thumb { - background: transparent; - border-radius: 10px; - } - &:hover { - ::-webkit-scrollbar-thumb { - background: ${Colors.PORCELAIN}; - border-radius: 10px; - } - } - - /* Handle on hover */ - ::-webkit-scrollbar-thumb:hover { - background: ${Colors.PORCELAIN}; - } -`; - export const truncateTextUsingEllipsis = css` text-overflow: ellipsis; overflow: hidden; @@ -505,6 +468,42 @@ export const labelStyle = css` font-weight: ${(props) => props.theme.fontWeights[3]}; `; +export const hideScrollbar = css` + scrollbar-width: none; + -ms-overflow-style: none; + &::-webkit-scrollbar { + display: none; + -webkit-appearance: none; + } +`; + +export const thinScrollbar = css` + ::-webkit-scrollbar { + width: 4px; + } + + /* Track */ + ::-webkit-scrollbar-track { + border-radius: 10px; + } + + /* Handle */ + ::-webkit-scrollbar-thumb { + background: transparent; + border-radius: 10px; + } + &:hover { + ::-webkit-scrollbar-thumb { + background: ${getColorWithOpacity(Colors.CHARCOAL, 0.5)}; + border-radius: 10px; + } + } + + /* Handle on hover */ + ::-webkit-scrollbar-thumb:hover { + background: ${getColorWithOpacity(Colors.CHARCOAL, 0.5)}; + } +`; // export const adsTheme: any = { // space: [0, 3, 14, 7, 16, 11, 26, 10, 4, 26, 30, 36, 4, 6, 11], // }; diff --git a/app/client/src/pages/Applications/index.tsx b/app/client/src/pages/Applications/index.tsx index 59a5c58703ca..77b5af7f7a69 100644 --- a/app/client/src/pages/Applications/index.tsx +++ b/app/client/src/pages/Applications/index.tsx @@ -10,7 +10,10 @@ import { connect, useDispatch, useSelector } from "react-redux"; import { useLocation } from "react-router-dom"; import { AppState } from "reducers"; import { Classes as BlueprintClasses } from "@blueprintjs/core"; -import { truncateTextUsingEllipsis } from "constants/DefaultTheme"; +import { + thinScrollbar, + truncateTextUsingEllipsis, +} from "constants/DefaultTheme"; import { getApplicationList, getApplicationSearchKeyword, @@ -314,6 +317,7 @@ const StyledAnchor = styled.a` const WorkpsacesNavigator = styled.div` overflow: auto; height: calc(100vh - ${(props) => props.theme.homePage.header + 252}px); + ${thinScrollbar}; /* padding-bottom: 160px; */ `; diff --git a/app/client/src/pages/Editor/Explorer/Entity/Name.tsx b/app/client/src/pages/Editor/Explorer/Entity/Name.tsx index 08ef634e3054..314430673361 100644 --- a/app/client/src/pages/Editor/Explorer/Entity/Name.tsx +++ b/app/client/src/pages/Editor/Explorer/Entity/Name.tsx @@ -77,7 +77,6 @@ export interface EntityNameProps { exitEditMode: () => void; nameTransformFn?: (input: string, limit?: number) => string; } - export const EntityName = forwardRef( (props: EntityNameProps, ref: React.Ref<HTMLDivElement>) => { const { name, searchKeyword, updateEntityName } = props; diff --git a/app/client/src/pages/Editor/Explorer/ExplorerSearch.tsx b/app/client/src/pages/Editor/Explorer/ExplorerSearch.tsx index 642bf5a7ea06..0dc32af1cf38 100644 --- a/app/client/src/pages/Editor/Explorer/ExplorerSearch.tsx +++ b/app/client/src/pages/Editor/Explorer/ExplorerSearch.tsx @@ -11,9 +11,9 @@ const ExplorerSearchWrapper = styled.div<{ isHidden?: boolean }>` height: 48px; justify-content: flex-start; align-items: center; - position: sticky; + // for the input underline + position: relative; font-size: 14px; - top: 0; z-index: 1; background: ${Colors.ALABASTER_ALT}; & { diff --git a/app/client/src/pages/Editor/WidgetSidebar.tsx b/app/client/src/pages/Editor/WidgetSidebar.tsx index 5df66e67139f..6dbc2584f82d 100644 --- a/app/client/src/pages/Editor/WidgetSidebar.tsx +++ b/app/client/src/pages/Editor/WidgetSidebar.tsx @@ -19,19 +19,20 @@ import { matchBuilderPath } from "constants/routes"; import OnboardingIndicator from "components/editorComponents/Onboarding/Indicator"; import { useLocation } from "react-router"; import { AppState } from "reducers"; +import { hideScrollbar } from "constants/DefaultTheme"; +import ScrollIndicator from "components/ads/ScrollIndicator"; const MainWrapper = styled.div` text-transform: capitalize; - padding: 10px 10px 20px 10px; height: 100%; overflow: hidden; - + padding: 0px 10px 20px 10px; &:active, &:focus, &:hover { overflow: auto; + ${hideScrollbar} } - &::-webkit-scrollbar-track { background-color: transparent; } @@ -46,6 +47,7 @@ const CardsWrapper = styled.div` `; const Header = styled.div` + padding: 10px 10px 0px 10px; display: grid; grid-template-columns: 7fr 1fr; `; @@ -70,6 +72,7 @@ function WidgetSidebar(props: IPanelProps) { const isForceOpenWidgetPanel = useSelector( (state: AppState) => state.ui.onBoarding.forceOpenWidgetPanel, ); + const sidebarRef = useRef<HTMLDivElement | null>(null); const [filteredCards, setFilteredCards] = useState(cards); const searchInputRef = useRef<HTMLInputElement | null>(null); const filterCards = (keyword: string) => { @@ -136,13 +139,12 @@ function WidgetSidebar(props: IPanelProps) { ref={searchInputRef} /> </Boxed> - - <MainWrapper> - <Header> - <Info> - <p>{createMessage(WIDGET_SIDEBAR_CAPTION)}</p> - </Info> - </Header> + <Header> + <Info> + <p>{createMessage(WIDGET_SIDEBAR_CAPTION)}</p> + </Info> + </Header> + <MainWrapper ref={sidebarRef}> <CardsWrapper> {filteredCards.map((card) => ( <Boxed @@ -174,6 +176,7 @@ function WidgetSidebar(props: IPanelProps) { </Boxed> ))} </CardsWrapper> + <ScrollIndicator containerRef={sidebarRef} top={"90px"} /> </MainWrapper> </> );
350f9b616f2ebdd46482eb42958668b628dbd88b
2023-05-30 18:06:54
vadim
chore: refine WDS color `bdAccent` (#23872)
false
refine WDS color `bdAccent` (#23872)
chore
diff --git a/app/client/packages/design-system/theming/src/utils/TokensAccessor/DarkModeTheme.ts b/app/client/packages/design-system/theming/src/utils/TokensAccessor/DarkModeTheme.ts index 5139826d34f7..bf0fe27a0447 100644 --- a/app/client/packages/design-system/theming/src/utils/TokensAccessor/DarkModeTheme.ts +++ b/app/client/packages/design-system/theming/src/utils/TokensAccessor/DarkModeTheme.ts @@ -186,13 +186,13 @@ export class DarkModeTheme implements ColorModeTheme { if (this.bg.contrastAPCA(this.seedColor) >= -25) { if (this.seedIsAchromatic) { - color.oklch.l = 0.985; + color.oklch.l = 0.82; color.oklch.c = 0; return color; } - color.oklch.l = 0.985; - color.oklch.c = 0.016; + color.oklch.l = 0.75; + color.oklch.c = 0.15; return color; } diff --git a/app/client/packages/design-system/theming/src/utils/TokensAccessor/LightModeTheme.ts b/app/client/packages/design-system/theming/src/utils/TokensAccessor/LightModeTheme.ts index 902e80dad81d..2dd57fb363d2 100644 --- a/app/client/packages/design-system/theming/src/utils/TokensAccessor/LightModeTheme.ts +++ b/app/client/packages/design-system/theming/src/utils/TokensAccessor/LightModeTheme.ts @@ -287,13 +287,13 @@ export class LightModeTheme implements ColorModeTheme { if (this.bg.contrastAPCA(this.seedColor) <= 25) { if (this.seedIsAchromatic) { - color.oklch.l = 0.15; + color.oklch.l = 0.3; color.oklch.c = 0; return color; } - color.oklch.l = 0.15; - color.oklch.c = 0.064; + color.oklch.l = 0.55; + color.oklch.c = 0.25; return color; }
a1a774f7fe7e2fe2cc6c45fdb8690e711d06ef3b
2022-02-10 23:33:12
Favour Ohanekwu
fix: js editor not showing falsy values 🐞 (#10946)
false
js editor not showing falsy values 🐞 (#10946)
fix
diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx index c6bf9d15d752..35830b9b27c1 100644 --- a/app/client/src/components/editorComponents/CodeEditor/index.tsx +++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx @@ -233,7 +233,7 @@ class CodeEditor extends Component<Props, State> { } // Set value of the editor - const inputValue = getInputValue(this.props.input.value || ""); + const inputValue = getInputValue(this.props.input.value) || ""; if (this.props.size === EditorSize.COMPACT) { options.value = removeNewLineChars(inputValue); } else { @@ -293,6 +293,8 @@ class CodeEditor extends Component<Props, State> { const editorValue = this.editor.getValue(); // Safe update of value of the editor when value updated outside the editor const inputValue = getInputValue(this.props.input.value); + const previousInputValue = getInputValue(prevProps.input.value); + if (!!inputValue || inputValue === "") { if (inputValue !== editorValue && isString(inputValue)) { this.editor.setValue(inputValue); @@ -302,6 +304,9 @@ class CodeEditor extends Component<Props, State> { //So, if it is hidden it does not reflect in UI, this code is to refresh editor if it was just made visible. this.editor.refresh(); } + } else if (previousInputValue !== inputValue) { + // handles case when inputValue changes from a truthy to a falsy value + this.editor.setValue(""); } CodeEditor.updateMarkings(this.editor, this.props.marking); } else { diff --git a/app/client/src/components/editorComponents/JSResponseView.tsx b/app/client/src/components/editorComponents/JSResponseView.tsx index ab3cfcb176d8..dda7bbb10c41 100644 --- a/app/client/src/components/editorComponents/JSResponseView.tsx +++ b/app/client/src/components/editorComponents/JSResponseView.tsx @@ -177,7 +177,7 @@ function JSResponseView(props: Props) { const actionList = jsObject?.actions; const sortedActionList = actionList && sortBy(actionList, "name"); const response = - selectActionId && !!responses[selectActionId] + selectActionId && selectActionId in responses ? responses[selectActionId] : ""; const isRunning = selectActionId && !!isExecuting[selectActionId];
b41cbe86b80196fa1de7556d014bb655b569873c
2023-12-06 06:00:46
Shrikant Sharat Kandula
ci: Disable extra logging during tests
false
Disable extra logging during tests
ci
diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index 17a01c05b755..0b152bbc49c6 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -138,6 +138,7 @@ jobs: APPSMITH_ENCRYPTION_SALT: "salt" APPSMITH_IS_SELF_HOSTED: false APPSMITH_ENVFILE_PATH: /tmp/dummy.env + APPSMITH_VERBOSE_LOGGING_ENABLED: false run: | if [[ "${{ inputs.skip-tests }}" == "true" ]] then
b8f0bfb0b3ee64d918c5d96397f34571510bb8a5
2024-04-08 18:33:14
Shrikant Sharat Kandula
chore: Add more Bridge APIs needed for EE (#32496)
false
Add more Bridge APIs needed for EE (#32496)
chore
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/bridge/Bridge.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/bridge/Bridge.java index 1719677ecba0..aa979820ae54 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/bridge/Bridge.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/bridge/Bridge.java @@ -65,6 +65,17 @@ public static <T extends BaseDomain> BridgeQuery<T> equal(@NonNull String key, @ return Bridge.<T>query().equal(key, value); } + /** + * Prefer using `.isTrue()` or `.isFalse()` instead of this method **if possible**. + */ + public static <T extends BaseDomain> BridgeQuery<T> equal(@NonNull String key, boolean value) { + return Bridge.<T>query().equal(key, value); + } + + public static <T extends BaseDomain> BridgeQuery<T> regexMatchIgnoreCase(@NonNull String key, String regexPattern) { + return Bridge.<T>query().regexMatchIgnoreCase(key, regexPattern); + } + public static <T extends BaseDomain> BridgeQuery<T> in(@NonNull String key, @NonNull Collection<String> value) { return Bridge.<T>query().in(key, value); } @@ -77,6 +88,10 @@ public static <T extends BaseDomain> BridgeQuery<T> isNull(@NonNull String key) return Bridge.<T>query().isNull(key); } + public static <T extends BaseDomain> BridgeQuery<T> isNotNull(@NonNull String key) { + return Bridge.<T>query().isNotNull(key); + } + public static <T extends BaseDomain> BridgeQuery<T> isTrue(@NonNull String key) { return Bridge.<T>query().isTrue(key); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/bridge/BridgeQuery.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/bridge/BridgeQuery.java index 4f92bf26d646..335ab1f89fdd 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/bridge/BridgeQuery.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/bridge/BridgeQuery.java @@ -58,6 +58,11 @@ public BridgeQuery<T> equal(@NonNull String key, boolean value) { return this; } + public BridgeQuery<T> regexMatchIgnoreCase(@NonNull String key, @NonNull String regexPattern) { + checks.add(Criteria.where(key).regex(regexPattern, "i")); + return this; + } + public BridgeQuery<T> in(@NonNull String key, @NonNull Collection<String> value) { checks.add(Criteria.where(key).in(value)); return this; @@ -123,4 +128,8 @@ public Document getCriteriaObject() { return new Criteria().andOperator(checks.toArray(new Criteria[0])).getCriteriaObject(); } + + public boolean isEmpty() { + return checks.isEmpty(); + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/params/QueryAllParams.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/params/QueryAllParams.java index 7a59a9e4d1fb..4063ad61e75c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/params/QueryAllParams.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/params/QueryAllParams.java @@ -105,9 +105,11 @@ public QueryAllParams<T> criteria(Criteria c) { return this; } - if (c instanceof BridgeQuery<?> bq && bq.getCriteriaObject().isEmpty()) { - throw new IllegalArgumentException( - "Empty bridge criteria leads to subtle bugs. Just don't call `.criteria()` in such cases."); + if (c instanceof BridgeQuery<?> bq && bq.isEmpty()) { + // Empty bridge criteria leads to subtle bugs. Just don't call `.criteria()` in such cases. + // So ignore it and act as if this method hasn't been called at all, because there's some styles of using + // this API that make such use just so convenient. + return this; } criteria.add(c);
49c3b929e9dfbd857c073dbb6add46dbe362602a
2022-11-03 06:51:34
Vaibhav Tanwar
feat: Default port for Elastic Search plugin (#17468)
false
Default port for Elastic Search plugin (#17468)
feat
diff --git a/app/server/appsmith-plugins/elasticSearchPlugin/src/main/java/com/external/plugins/ElasticSearchPlugin.java b/app/server/appsmith-plugins/elasticSearchPlugin/src/main/java/com/external/plugins/ElasticSearchPlugin.java index 470ddff3eba6..d21874212bd2 100644 --- a/app/server/appsmith-plugins/elasticSearchPlugin/src/main/java/com/external/plugins/ElasticSearchPlugin.java +++ b/app/server/appsmith-plugins/elasticSearchPlugin/src/main/java/com/external/plugins/ElasticSearchPlugin.java @@ -52,6 +52,8 @@ public class ElasticSearchPlugin extends BasePlugin { + private static final long ELASTIC_SEARCH_DEFAULT_PORT = 9200L; + public ElasticSearchPlugin(PluginWrapper wrapper) { super(wrapper); } @@ -166,6 +168,15 @@ private static boolean isBulkQuery(String path) { return path.split("\\?", 1)[0].matches(".*\\b_bulk$"); } + public Long getPort(Endpoint endpoint) { + + if (endpoint.getPort() == null) { + return ELASTIC_SEARCH_DEFAULT_PORT; + } + + return endpoint.getPort(); + } + @Override public Mono<RestClient> datasourceCreate(DatasourceConfiguration datasourceConfiguration) { @@ -184,7 +195,7 @@ public Mono<RestClient> datasourceCreate(DatasourceConfiguration datasourceConfi scheme = url.getProtocol(); } - hosts.add(new HttpHost(url.getHost(), endpoint.getPort().intValue(), scheme)); + hosts.add(new HttpHost(url.getHost(), getPort(endpoint).intValue(), scheme)); } final RestClientBuilder clientBuilder = RestClient.builder(hosts.toArray(new HttpHost[]{})); @@ -247,9 +258,6 @@ public Set<String> validateDatasource(DatasourceConfiguration datasourceConfigur } } - if (endpoint.getPort() == null) { - invalids.add("Missing port for endpoint"); - } } } diff --git a/app/server/appsmith-plugins/elasticSearchPlugin/src/test/java/com/external/plugins/ElasticSearchPluginTest.java b/app/server/appsmith-plugins/elasticSearchPlugin/src/test/java/com/external/plugins/ElasticSearchPluginTest.java index d99cceaf8a72..2538b0654c44 100755 --- a/app/server/appsmith-plugins/elasticSearchPlugin/src/test/java/com/external/plugins/ElasticSearchPluginTest.java +++ b/app/server/appsmith-plugins/elasticSearchPlugin/src/test/java/com/external/plugins/ElasticSearchPluginTest.java @@ -113,6 +113,17 @@ private Mono<ActionExecutionResult> execute(HttpMethod method, String path, Stri .flatMap(conn -> pluginExecutor.execute(conn, dsConfig, actionConfiguration)); } + @Test + public void testDefaultPort() { + + Endpoint endpoint = new Endpoint(); + endpoint.setHost(host); + + Long defaultPort = pluginExecutor.getPort(endpoint); + + assertEquals(9200L,defaultPort); + } + @Test public void testGet() { StepVerifier.create(execute(HttpMethod.GET, "/planets/doc/id1", null)) @@ -273,7 +284,7 @@ public void itShouldValidateDatasourceWithEmptyPort() { endpoint.setHost(host); datasourceConfiguration.setEndpoints(Collections.singletonList(endpoint)); - assertEquals(Set.of("Missing port for endpoint"), + assertEquals(Set.of(), pluginExecutor.validateDatasource(datasourceConfiguration)); } @@ -296,7 +307,7 @@ public void itShouldValidateDatasourceWithMissingEndpoint() { Endpoint endpoint = new Endpoint(); datasourceConfiguration.setEndpoints(Collections.singletonList(endpoint)); - assertEquals(Set.of("Missing port for endpoint", "Missing host for endpoint"), + assertEquals(Set.of("Missing host for endpoint"), pluginExecutor.validateDatasource(datasourceConfiguration)); }
9f6b6a4bf37a3c4ef0b87aee1259d0d521013030
2023-02-24 18:51:56
Favour Ohanekwu
fix: Only show boundaries when siblings are dragged (#20752)
false
Only show boundaries when siblings are dragged (#20752)
fix
diff --git a/app/client/src/components/editorComponents/DraggableComponent.tsx b/app/client/src/components/editorComponents/DraggableComponent.tsx index e2315e05da59..7c383d8cc839 100644 --- a/app/client/src/components/editorComponents/DraggableComponent.tsx +++ b/app/client/src/components/editorComponents/DraggableComponent.tsx @@ -96,6 +96,11 @@ function DraggableComponent(props: DraggableComponentProps) { (state: AppState) => state.ui.widgetDragResize.isDragging, ); + const isDraggingSibling = useSelector( + (state) => + state.ui.widgetDragResize?.dragDetails?.draggedOn === props.parentId, + ); + // This state tells us to disable dragging, // This is usually true when widgets themselves implement drag/drop // This flag resolves conflicting drag/drop triggers. @@ -107,6 +112,7 @@ function DraggableComponent(props: DraggableComponentProps) { const isResizingOrDragging = !!isResizing || !!isDragging; const isCurrentWidgetDragging = isDragging && isSelected; const isCurrentWidgetResizing = isResizing && isSelected; + const showBoundary = isCurrentWidgetDragging || isDraggingSibling; // When mouse is over this draggable const handleMouseOver = (e: any) => { @@ -190,10 +196,12 @@ function DraggableComponent(props: DraggableComponentProps) { style={dragWrapperStyle} > {shouldRenderComponent && props.children} - <WidgetBoundaries - className={`widget-boundary-${props.widgetId}`} - style={dragBoundariesStyle} - /> + {showBoundary && ( + <WidgetBoundaries + className={`widget-boundary-${props.widgetId}`} + style={dragBoundariesStyle} + /> + )} </DraggableWrapper> ); }
2c03cecbb136305c592bc467ffa92e313e3e1616
2022-08-09 18:35:00
Vishnu Gp
feat: Added more data to existing analytics events (#15684)
false
Added more data to existing analytics events (#15684)
feat
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 eccbf731ddbf..9f5860bd3132 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 @@ -115,7 +115,11 @@ public class FieldName { public static final String THEME = "theme"; public static final String EDIT_MODE_THEME = "editModeTheme"; public static final String FLOW_NAME = "flowName"; - public static final String AUDIT_DATA = "auditData"; + public static final String EVENT_DATA = "eventData"; public static final String MODE_OF_LOGIN = "modeOfLogin"; public static final String FORM_LOGIN = "FormLogin"; + public static final String VIEW_MODE = "viewMode"; + public static final String ACTION_EXECUTION_REQUEST = "actionExecutionRequest"; + public static final String ACTION_EXECUTION_RESULT = "actionExecutionResult"; + public static final String ACTION_EXECUTION_TIME = "actionExecutionTime"; } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java index 6e4d4fc339d7..b70645317400 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java @@ -164,7 +164,8 @@ public <T extends BaseDomain> Mono<T> sendObjectEvent(AnalyticsEvents event, T o return Mono.just(object); } - final String eventTag = event.getEventName() + "_" + object.getClass().getSimpleName().toUpperCase(); + // In case of action execution, event.getEventName() only is used to support backward compatibility of event name + final String eventTag = AnalyticsEvents.EXECUTE_ACTION.equals(event) ? event.getEventName() : event.getEventName() + "_" + object.getClass().getSimpleName().toUpperCase(); // We will create an anonymous user object for event tracking if no user is present // Without this, a lot of flows meant for anonymous users will error out @@ -197,8 +198,8 @@ public <T extends BaseDomain> Mono<T> sendObjectEvent(AnalyticsEvents event, T o analyticsProperties.put("oid", object.getId()); if (extraProperties != null) { analyticsProperties.putAll(extraProperties); - // To avoid sending extra audit data to analytics - analyticsProperties.remove(FieldName.AUDIT_DATA); + // To avoid sending extra event data to analytics + analyticsProperties.remove(FieldName.EVENT_DATA); } sendEvent(eventTag, username, analyticsProperties); 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 f7689c08f2fa..0c981155af23 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 @@ -1117,7 +1117,7 @@ public Mono<Application> createOrUpdateSuffixedApplication(Application applicati private Mono<Application> sendCloneApplicationAnalyticsEvent(Application sourceApplication, Application application) { return workspaceService.getById(application.getWorkspaceId()) .flatMap(workspace -> { - final Map<String, Object> auditData = Map.of( + final Map<String, Object> eventData = Map.of( FieldName.SOURCE_APPLICATION, sourceApplication, FieldName.APPLICATION, application, FieldName.WORKSPACE, workspace @@ -1127,7 +1127,7 @@ private Mono<Application> sendCloneApplicationAnalyticsEvent(Application sourceA FieldName.SOURCE_APPLICATION_ID, sourceApplication.getId(), FieldName.APPLICATION_ID, application.getId(), FieldName.WORKSPACE_ID, workspace.getId(), - FieldName.AUDIT_DATA, auditData + FieldName.EVENT_DATA, eventData ); return analyticsService.sendObjectEvent(AnalyticsEvents.CLONE, application, data); @@ -1145,13 +1145,12 @@ private Mono<NewPage> sendPageViewAnalyticsEvent(NewPage newPage, boolean viewMo return Mono.empty(); } - //TODO: Add more audit data - final Map<String, Object> auditData = Map.of( + final Map<String, Object> eventData = Map.of( FieldName.PAGE, newPage ); final Map<String, Object> data = Map.of( - FieldName.AUDIT_DATA, auditData + FieldName.EVENT_DATA, eventData ); return analyticsService.sendObjectEvent(AnalyticsEvents.VIEW, newPage, data); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java index 7415fc81fa28..2cf58f35f501 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java @@ -990,13 +990,15 @@ private Mono<ActionExecutionRequest> sendExecuteAnalyticsEvent( ActionExecutionResult actionExecutionResult, Long timeElapsed ) { - // Since we're loading the application from DB *only* for analytics, we check if analytics is // active before making the call to DB. if (!analyticsService.isActive()) { + // This is to have consistency in how the AnalyticsService is being called. + // Even though sendObjectEvent is triggered, AnalyticsService would still reject this and prevent the event + // from being sent to analytics provider if telemetry is disabled. + analyticsService.sendObjectEvent(AnalyticsEvents.EXECUTE_ACTION, action); return Mono.empty(); } - ActionExecutionRequest actionExecutionRequest = actionExecutionResult.getRequest(); ActionExecutionRequest request; if (actionExecutionRequest != null) { @@ -1123,8 +1125,18 @@ private Mono<ActionExecutionRequest> sendExecuteAnalyticsEvent( "statusCode", actionExecutionResult.getStatusCode() )); } - - analyticsService.sendEvent(AnalyticsEvents.EXECUTE_ACTION.getEventName(), user.getUsername(), data); + final Map<String, Object> eventData = Map.of( + FieldName.ACTION, action, + FieldName.DATASOURCE, datasource, + FieldName.VIEW_MODE, viewMode, + FieldName.ACTION_EXECUTION_RESULT, actionExecutionResult, + FieldName.ACTION_EXECUTION_TIME, timeElapsed, + FieldName.ACTION_EXECUTION_REQUEST, request, + FieldName.APPLICATION, application, + FieldName.PLUGIN, plugin + ); + data.put(FieldName.EVENT_DATA, eventData); + analyticsService.sendObjectEvent(AnalyticsEvents.EXECUTE_ACTION, action, data); return request; }) .onErrorResume(error -> { @@ -1860,7 +1872,10 @@ private Map<String, Object> getAnalyticsProperties(NewAction savedAction, Dataso if (!StringUtils.hasLength(savedAction.getUnpublishedAction().getPluginName())) { savedAction.getUnpublishedAction().setPluginName(datasource.getPluginName()); } - return this.getAnalyticsProperties(savedAction); + Map<String, Object> analyticsProperties = this.getAnalyticsProperties(savedAction); + Map<String, Object> eventData = Map.of(FieldName.DATASOURCE, datasource); + analyticsProperties.put(FieldName.EVENT_DATA, eventData); + return analyticsProperties; } @Override diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ApplicationForkingServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ApplicationForkingServiceCEImpl.java index 6bd2395f3d40..72bb85cb9a2e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ApplicationForkingServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ApplicationForkingServiceCEImpl.java @@ -22,6 +22,7 @@ import reactor.core.publisher.Mono; import java.util.Collections; +import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -47,11 +48,14 @@ public Mono<Application> forkApplicationToWorkspace(String srcApplicationId, Str Mono<User> userMono = sessionUserService.getCurrentUser(); + // For collecting all the possible event data + Map<String, Object> eventData = new HashMap<>(); Mono<Application> forkApplicationMono = Mono.zip(sourceApplicationMono, targetWorkspaceMono, userMono) .flatMap(tuple -> { final Application application = tuple.getT1(); final Workspace targetWorkspace = tuple.getT2(); final User user = tuple.getT3(); + eventData.put(FieldName.WORKSPACE, targetWorkspace); //If the forking application is connected to git, do not copy those data to the new forked application application.setGitApplicationMetadata(null); @@ -76,7 +80,7 @@ public Mono<Application> forkApplicationToWorkspace(String srcApplicationId, Str final String newApplicationId = applicationIds.get(0); return applicationService.getById(newApplicationId) .flatMap(application -> - sendForkApplicationAnalyticsEvent(srcApplicationId, targetWorkspaceId, application)); + sendForkApplicationAnalyticsEvent(srcApplicationId, targetWorkspaceId, application, eventData)); }); // Fork application is currently a slow API because it needs to create application, clone all the pages, and then @@ -116,14 +120,15 @@ public Mono<Application> forkApplicationToWorkspace(String srcApplicationId, .map(responseUtils::updateApplicationWithDefaultResources); } - private Mono<Application> sendForkApplicationAnalyticsEvent(String applicationId, String workspaceId, Application application) { + private Mono<Application> sendForkApplicationAnalyticsEvent(String applicationId, String workspaceId, Application application, Map<String, Object> eventData) { return applicationService.findById(applicationId, AclPermission.READ_APPLICATIONS) .flatMap(sourceApplication -> { final Map<String, Object> data = Map.of( "forkedFromAppId", applicationId, "forkedToOrgId", workspaceId, - "forkedFromAppName", sourceApplication.getName() + "forkedFromAppName", sourceApplication.getName(), + FieldName.EVENT_DATA, eventData ); return analyticsService.sendObjectEvent(AnalyticsEvents.FORK, application, data); 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 d2802975ac48..117370464eae 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 @@ -2116,7 +2116,7 @@ private Mono<Application> sendImportExportApplicationAnalyticsEvent(String appli .flatMap(tuple -> { Application application = tuple.getT1(); Workspace workspace = tuple.getT2(); - final Map<String, Object> auditData = Map.of( + final Map<String, Object> eventData = Map.of( FieldName.APPLICATION, application, FieldName.WORKSPACE, workspace ); @@ -2124,7 +2124,7 @@ private Mono<Application> sendImportExportApplicationAnalyticsEvent(String appli final Map<String, Object> data = Map.of( FieldName.APPLICATION_ID, application.getId(), FieldName.WORKSPACE_ID, workspace.getId(), - FieldName.AUDIT_DATA, auditData + FieldName.EVENT_DATA, eventData ); return analyticsService.sendObjectEvent(event, application, data);
fc453c8b5f51adbb6d597b263127c14a006e2e51
2024-03-18 21:39:11
Rishabh Rathod
chore: Remove JS_VARIABLE_MUTATED event (#31884)
false
Remove JS_VARIABLE_MUTATED event (#31884)
chore
diff --git a/app/client/src/ce/utils/analyticsUtilTypes.ts b/app/client/src/ce/utils/analyticsUtilTypes.ts index aa90800f9ab7..8c08d61df733 100644 --- a/app/client/src/ce/utils/analyticsUtilTypes.ts +++ b/app/client/src/ce/utils/analyticsUtilTypes.ts @@ -326,7 +326,6 @@ export type EventName = | "LEARN_MORE_TELEMETRY_CALLOUT" | ONE_CLICK_BINDING_EVENT_NAMES | "JS_VARIABLE_CREATED" - | "JS_VARIABLE_MUTATED" | "EXPLORER_WIDGET_CLICK" | "WIDGET_SEARCH" | "MAKE_APPLICATION_PUBLIC" diff --git a/app/client/src/ce/workers/Evaluation/evalWorkerActions.ts b/app/client/src/ce/workers/Evaluation/evalWorkerActions.ts index 78ffdc65a5f7..ac8778ee17dc 100644 --- a/app/client/src/ce/workers/Evaluation/evalWorkerActions.ts +++ b/app/client/src/ce/workers/Evaluation/evalWorkerActions.ts @@ -33,7 +33,6 @@ export enum MAIN_THREAD_ACTION { PROCESS_LOGS = "PROCESS_LOGS", LINT_TREE = "LINT_TREE", PROCESS_JS_FUNCTION_EXECUTION = "PROCESS_JS_FUNCTION_EXECUTION", - PROCESS_JS_VAR_MUTATION_EVENTS = "PROCESS_JS_VAR_MUTATION_EVENTS", UPDATE_DATATREE = "UPDATE_DATATREE", SET_META_PROP_FROM_SETTER = "SET_META_PROP_FROM_SETTER", } diff --git a/app/client/src/sagas/EvalWorkerActionSagas.ts b/app/client/src/sagas/EvalWorkerActionSagas.ts index 9bb61e464532..6b0889923891 100644 --- a/app/client/src/sagas/EvalWorkerActionSagas.ts +++ b/app/client/src/sagas/EvalWorkerActionSagas.ts @@ -2,7 +2,6 @@ import { all, call, put, spawn, take } from "redux-saga/effects"; import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; import { MAIN_THREAD_ACTION } from "@appsmith/workers/Evaluation/evalWorkerActions"; import log from "loglevel"; -import { logJSVarMutationEvent } from "../sagas/PostEvaluationSagas"; import type { Channel } from "redux-saga"; import { storeLogs } from "../sagas/DebuggerSagas"; import type { @@ -18,10 +17,7 @@ import { updateDataTreeHandler, } from "../sagas/EvaluationsSaga"; import { handleStoreOperations } from "./ActionExecution/StoreActionSaga"; -import type { - EvalTreeResponseData, - JSVarMutatedEvents, -} from "workers/Evaluation/types"; +import type { EvalTreeResponseData } from "workers/Evaluation/types"; import isEmpty from "lodash/isEmpty"; import type { UnEvalTree } from "entities/DataTree/dataTreeTypes"; import { sortJSExecutionDataByCollectionId } from "workers/Evaluation/JSObject/utils"; @@ -151,11 +147,6 @@ export function* handleEvalWorkerMessage(message: TMessage<any>) { }); break; } - - case MAIN_THREAD_ACTION.PROCESS_JS_VAR_MUTATION_EVENTS: { - const jsVarMutatedEvents: JSVarMutatedEvents = data; - yield call(logJSVarMutationEvent, jsVarMutatedEvents); - } } yield call(evalErrorHandler, data?.errors || []); diff --git a/app/client/src/sagas/PostEvaluationSagas.ts b/app/client/src/sagas/PostEvaluationSagas.ts index 3716422c959d..189850cc74ea 100644 --- a/app/client/src/sagas/PostEvaluationSagas.ts +++ b/app/client/src/sagas/PostEvaluationSagas.ts @@ -44,10 +44,7 @@ import SuccessfulBindingMap from "utils/SuccessfulBindingsMap"; import { logActionExecutionError } from "./ActionExecution/errorUtils"; import { getCurrentWorkspaceId } from "@appsmith/selectors/selectedWorkspaceSelectors"; import { getInstanceId } from "@appsmith/selectors/tenantSelectors"; -import type { - EvalTreeResponseData, - JSVarMutatedEvents, -} from "workers/Evaluation/types"; +import type { EvalTreeResponseData } from "workers/Evaluation/types"; import { endSpan, startRootSpan } from "UITelemetry/generateTraces"; import { getCollectionNameToDisplay } from "@appsmith/utils/actionExecutionUtils"; @@ -66,17 +63,6 @@ export function* logJSVarCreatedEvent( }); } -export function* logJSVarMutationEvent( - jsVarsMutationEvent: JSVarMutatedEvents, -) { - Object.values(jsVarsMutationEvent).forEach(({ path, type }) => { - AnalyticsUtil.logEvent("JS_VARIABLE_MUTATED", { - path, - type, - }); - }); -} - export function* dynamicTriggerErrorHandler(errors: any[]) { if (errors.length > 0) { for (const error of errors) { diff --git a/app/client/src/workers/Evaluation/fns/utils/TriggerEmitter.ts b/app/client/src/workers/Evaluation/fns/utils/TriggerEmitter.ts index 5f50e6345637..3d3aa62f7c60 100644 --- a/app/client/src/workers/Evaluation/fns/utils/TriggerEmitter.ts +++ b/app/client/src/workers/Evaluation/fns/utils/TriggerEmitter.ts @@ -4,10 +4,6 @@ import { WorkerMessenger } from "workers/Evaluation/fns/utils/Messenger"; import type { UpdatedPathsMap } from "workers/Evaluation/JSObject/JSVariableUpdates"; import { applyJSVariableUpdatesToEvalTree } from "workers/Evaluation/JSObject/JSVariableUpdates"; import ExecutionMetaData from "./ExecutionMetaData"; -import { get } from "lodash"; -import { getType } from "utils/TypeHelpers"; -import type { JSVarMutatedEvents } from "workers/Evaluation/types"; -import { dataTreeEvaluator } from "workers/Evaluation/handlers/evalTree"; import type { TriggerKind, TriggerSource, @@ -27,7 +23,6 @@ export enum BatchKey { process_batched_fn_execution = "process_batched_fn_execution", process_js_variable_updates = "process_js_variable_updates", process_batched_fn_invoke_log = "process_batched_fn_invoke_log", - process_js_var_mutation_events = "process_js_var_mutation_events", } const TriggerEmitter = new EventEmitter(); @@ -149,31 +144,6 @@ TriggerEmitter.on( fnExecutionDataHandler, ); -export const jsVariableMutationEventHandler = deferredBatchedActionHandler( - (batchedUpdatesMap: UpdatedPathsMap[]) => { - const jsVarMutatedEvents: JSVarMutatedEvents = {}; - for (const batchedUpdateMap of batchedUpdatesMap) { - for (const path in batchedUpdateMap) { - const variableValue = get(dataTreeEvaluator?.getEvalTree() || {}, path); - jsVarMutatedEvents[path] = { - path, - type: getType(variableValue), - }; - } - } - - WorkerMessenger.ping({ - method: MAIN_THREAD_ACTION.PROCESS_JS_VAR_MUTATION_EVENTS, - data: jsVarMutatedEvents, - }); - }, -); - -TriggerEmitter.on( - BatchKey.process_js_var_mutation_events, - jsVariableMutationEventHandler, -); - const jsVariableUpdatesHandler = priorityBatchedActionHandler<Patch>( (batchedData) => { const updatesMap: UpdatedPathsMap = {}; @@ -182,10 +152,6 @@ const jsVariableUpdatesHandler = priorityBatchedActionHandler<Patch>( } applyJSVariableUpdatesToEvalTree(updatesMap); - - TriggerEmitter.emit(BatchKey.process_js_var_mutation_events, { - ...updatesMap, - }); }, ); diff --git a/app/client/src/workers/Evaluation/types.ts b/app/client/src/workers/Evaluation/types.ts index 63ac95344598..071600570485 100644 --- a/app/client/src/workers/Evaluation/types.ts +++ b/app/client/src/workers/Evaluation/types.ts @@ -63,5 +63,3 @@ export interface EvalTreeResponseData { webworkerTelemetry?: Record<string, WebworkerSpanData>; updates: string; } - -export type JSVarMutatedEvents = Record<string, { path: string; type: string }>;
ab0160200d3c4dfd7972a0cb525208b7b216e0e8
2022-09-29 16:14:39
Aman Agarwal
fix: failing rts build due to jest config (#17177)
false
failing rts build due to jest config (#17177)
fix
diff --git a/app/rts/build.sh b/app/rts/build.sh index 32a59562009b..642edfae0f61 100755 --- a/app/rts/build.sh +++ b/app/rts/build.sh @@ -3,6 +3,7 @@ set -o errexit cd "$(dirname "$0")" +rm -rf dist/ yarn install --frozen-lockfile npx tsc && npx tsc-alias # Copying node_modules directory into dist as rts server requires node_modules to run server build properly. diff --git a/app/rts/package.json b/app/rts/package.json index 30dc659c89bc..4312cb8f8600 100644 --- a/app/rts/package.json +++ b/app/rts/package.json @@ -26,7 +26,7 @@ "typescript": "^4.2.3" }, "scripts": { - "test:unit": "export APPSMITH_API_BASE_URL=http APPSMITH_MONGODB_URI=mongodb && $(npm bin)/jest -b --colors --no-cache --silent --coverage --collectCoverage=true --coverageDirectory='../../' --coverageReporters='json-summary'", + "test:unit": "export APPSMITH_API_BASE_URL=http APPSMITH_MONGODB_URI=mongodb && $(npm bin)/jest -b --colors --no-cache --silent --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary'", "test:jest": "export APPSMITH_API_BASE_URL=http APPSMITH_MONGODB_URI=mongodb && $(npm bin)/jest --watch ", "preinstall": "CURRENT_SCOPE=rts node ../shared/build-shared-dep.js", "build": "./build.sh", diff --git a/app/rts/tsconfig.json b/app/rts/tsconfig.json index 9ee5400337f4..d292fcb10f90 100644 --- a/app/rts/tsconfig.json +++ b/app/rts/tsconfig.json @@ -17,5 +17,6 @@ "@utils/*": ["./src/utils/*"] } }, + "exclude": ["jest.config.js", "src/test"], "lib": ["es2015"] }
1c56186b531a2a159dd9e7a0ef1cfd9eded29f3c
2023-05-08 14:33:21
Ankit Srivastava
fix: sending usage pulse when the app is private and user is logged in. (#22933)
false
sending usage pulse when the app is private and user is logged in. (#22933)
fix
diff --git a/app/client/src/ce/api/ApplicationApi.tsx b/app/client/src/ce/api/ApplicationApi.tsx index 641e0e0fece7..81b88757245d 100644 --- a/app/client/src/ce/api/ApplicationApi.tsx +++ b/app/client/src/ce/api/ApplicationApi.tsx @@ -60,6 +60,7 @@ export interface ApplicationResponsePayload { gitApplicationMetadata: GitApplicationMetadata; slug: string; applicationVersion: ApplicationVersion; + isPublic?: boolean; } export interface FetchApplicationPayload { diff --git a/app/client/src/ce/pages/Editor/Explorer/helpers.tsx b/app/client/src/ce/pages/Editor/Explorer/helpers.tsx index 8ea608610179..498f9bab63b6 100644 --- a/app/client/src/ce/pages/Editor/Explorer/helpers.tsx +++ b/app/client/src/ce/pages/Editor/Explorer/helpers.tsx @@ -10,6 +10,7 @@ import { BUILDER_CUSTOM_PATH, matchBuilderPath, matchViewerPath, + BUILDER_VIEWER_PATH_PREFIX, } from "constants/routes"; import { @@ -79,6 +80,21 @@ export const getActionIdFromURL = () => { } }; +export function getAppViewerPageIdFromPath(path: string): string | null { + const regexes = [ + `${BUILDER_VIEWER_PATH_PREFIX}:applicationSlug/:pageSlug(.*\\-):pageId`, // VIEWER_PATH + `${BUILDER_VIEWER_PATH_PREFIX}:customSlug(.*\\-):pageId`, // VIEWER_CUSTOM_PATH + `/applications/:applicationId/pages/:pageId`, // VIEWER_PATH_DEPRECATED + ]; + for (const regex of regexes) { + const match = matchPath<{ pageId: string }>(path, { path: regex }); + if (match?.params.pageId) { + return match.params.pageId; + } + } + return null; +} + export const isEditorPath = (path: string) => { return !!matchBuilderPath(path, { end: false }); }; diff --git a/app/client/src/usagePulse/index.ts b/app/client/src/usagePulse/index.ts index 8acbbaceb2ff..06b1f65dfb11 100644 --- a/app/client/src/usagePulse/index.ts +++ b/app/client/src/usagePulse/index.ts @@ -1,4 +1,5 @@ import { + getAppViewerPageIdFromPath, isEditorPath, isViewerPath, } from "@appsmith/pages/Editor/Explorer/helpers"; @@ -11,6 +12,11 @@ import { PULSE_INTERVAL, USER_ACTIVITY_LISTENER_EVENTS, } from "@appsmith/constants/UsagePulse"; +import PageApi from "api/PageApi"; +import { APP_MODE } from "entities/App"; +import type { FetchApplicationResponse } from "ce/api/ApplicationApi"; +import type { AxiosResponse } from "axios"; +import { getFirstTimeUserOnboardingIntroModalVisibility } from "utils/storage"; class UsagePulse { static userAnonymousId: string | undefined; @@ -23,8 +29,35 @@ class UsagePulse { * Function to check if the given URL is trakable or not. * app builder and viewer urls are trackable */ - static isTrackableUrl(path: string) { - return isEditorPath(path) || isViewerPath(path); + static async isTrackableUrl(path: string) { + if (isViewerPath(path)) { + if (UsagePulse.isAnonymousUser) { + /* + In App view mode for non-logged in user, first we must have to check if the app is public or not. + If it is private app with non-logged in user, we do not send pulse at this point instead we redirect to the login page. + And for login page no usage pulse is required. + */ + const response: AxiosResponse<FetchApplicationResponse, any> = + await PageApi.fetchAppAndPages({ + pageId: getAppViewerPageIdFromPath(path), + mode: APP_MODE.PUBLISHED, + }); + const { data } = response.data || {}; + if (data?.application && !data.application.isPublic) { + return false; + } + } + return true; + } else if (isEditorPath(path)) { + /* + During onboarding we show the Intro Modal and let user use the app for the first time. + During this exploration period, we do no send usage pulse. + */ + const isFirstTimeOnboarding = + await getFirstTimeUserOnboardingIntroModalVisibility(); + if (!isFirstTimeOnboarding) return true; + } + return false; } static sendPulse() { @@ -59,9 +92,9 @@ class UsagePulse { * Function to register a history change event and trigger * a callback and unlisten when the user goes to a trackable URL */ - static watchForTrackableUrl(callback: () => void) { - UsagePulse.unlistenRouteChange = history.listen(() => { - if (UsagePulse.isTrackableUrl(window.location.pathname)) { + static async watchForTrackableUrl(callback: () => void) { + UsagePulse.unlistenRouteChange = history.listen(async () => { + if (await UsagePulse.isTrackableUrl(window.location.pathname)) { UsagePulse.unlistenRouteChange(); setTimeout(callback, 0); } @@ -99,12 +132,12 @@ class UsagePulse { * triggers a pulse and schedules the pulse , if user is on a trackable url, otherwise * registers listeners to wait for the user to go to a trackable url */ - static track() { - if (UsagePulse.isTrackableUrl(window.location.pathname)) { + static async track() { + if (await UsagePulse.isTrackableUrl(window.location.pathname)) { UsagePulse.sendPulse(); UsagePulse.scheduleNextActivityListeners(); } else { - UsagePulse.watchForTrackableUrl(UsagePulse.track); + await UsagePulse.watchForTrackableUrl(UsagePulse.track); } } diff --git a/app/client/src/usagePulse/usagePulse.test.ts b/app/client/src/usagePulse/usagePulse.test.ts index e40648c6aa65..9929128ea5df 100644 --- a/app/client/src/usagePulse/usagePulse.test.ts +++ b/app/client/src/usagePulse/usagePulse.test.ts @@ -24,8 +24,8 @@ describe("Usage pulse", () => { "/signup", "/settings", "/generate-page", - ].forEach((url) => { - expect(UsagePulse.isTrackableUrl(url)).toBeFalsy(); + ].forEach(async (url) => { + expect(await UsagePulse.isTrackableUrl(url)).toBeFalsy(); }); }); });
3990162ca64c5f06c75979d54d54231acb4d792b
2022-08-16 14:33:55
Satish Gandham
ci: Update the access token in ci script. (#16032)
false
Update the access token in ci script. (#16032)
ci
diff --git a/.github/workflows/integration-tests-command.yml b/.github/workflows/integration-tests-command.yml index 168a818397bf..4f97efd19775 100644 --- a/.github/workflows/integration-tests-command.yml +++ b/.github/workflows/integration-tests-command.yml @@ -1355,7 +1355,7 @@ jobs: uses: actions/checkout@v3 with: repository: appsmithorg/performance-infra - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN }} ref: main path: app/client/perf diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/AllWidgets_default_meta_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/AllWidgets_default_meta_spec.js index 0049e3dfbaab..6e90d509fa6e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/AllWidgets_default_meta_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/AllWidgets_default_meta_spec.js @@ -13,7 +13,6 @@ import { } from "../../../../locators/WidgetLocators"; const widgetsToTest = { - [WIDGET.MULTISELECT_WIDGET]: { widgetName: "MultiSelect", widgetPrefixName: "MultiSelect1",
c44c35609ca3e00f47bcc6f825f748c369c870ae
2024-09-10 15:29:02
Sagar Khalasi
fix: Fixed flaky fork template test case (#36200)
false
Fixed flaky fork template test case (#36200)
fix
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_To_App_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_To_App_spec.ts index 2838e49a8674..46bd1a99a335 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_To_App_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_To_App_spec.ts @@ -15,17 +15,14 @@ describe( it("1. Fork a template to the current app + Bug 17477", () => { PageList.AddNewPage("Add page from template"); agHelper.AssertElementVisibility(template.templateDialogBox); - agHelper.GetNClick("//h1[text()='Applicant Tracker-test']"); + agHelper.GetNClick(template.templateCard, 0, true); agHelper.FailIfErrorToast("INTERNAL_SERVER_ERROR"); agHelper.GetNClick(template.templateViewForkButton); agHelper.WaitUntilToastDisappear("template added successfully"); assertHelper.AssertNetworkStatus("updateLayout"); - // [Bug]: Getting 'Resource not found' error on deploying template #17477 + PageList.AddNewPage("Generate page with data"); deployMode.DeployApp(); - agHelper.GetNClickByContains( - ".t--page-switch-tab", - "1 Track Applications", - ); + agHelper.GetNClick(locators._deployedPage, 0, true); deployMode.NavigateBacktoEditor(); homePage.NavigateToHome(); agHelper.WaitUntilAllToastsDisappear(); @@ -35,14 +32,13 @@ describe( homePage.CreateNewApplication(); PageList.AddNewPage("Add page from template"); agHelper.AssertElementVisibility(template.templateDialogBox); - agHelper.GetNClick("//h1[text()='Applicant Tracker-test']"); + agHelper.GetNClick(template.templateCard, 0, true); agHelper.FailIfErrorToast( "Internal server error while processing request", ); assertHelper.AssertNetworkStatus("getTemplatePages"); agHelper.CheckUncheck(template.selectAllPages, false); agHelper.GetNClick(template.selectCheckbox, 1); - // [Bug]: On forking selected pages from a template, resource not found error is shown #17270 agHelper.GetNClick(template.templateViewForkButton); agHelper.AssertElementAbsence( locators._visibleTextSpan("Setting up the template"),
74c3dbbc1af91dc1684a193a0f02f3628fefab31
2022-10-11 11:02:44
Nidhi
fix: Modified on page load actions calculation using AST (#17074)
false
Modified on page load actions calculation using AST (#17074)
fix
diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/EchoApiCMS_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/EchoApiCMS_spec.js index 2b8fcd425095..91218f389fad 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/EchoApiCMS_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/EchoApiCMS_spec.js @@ -2,10 +2,8 @@ const dsl = require("../../../fixtures/CMSdsl.json"); const apiwidget = require("../../../locators/apiWidgetslocator.json"); import apiEditor from "../../../locators/ApiEditor"; import appPage from "../../../locators/CMSApplocators"; -const commonlocators = require("../../../locators/commonlocators.json"); -describe("Content Management System App", function() { - let repoName; +describe("Content Management System App", function() { before(() => { cy.addDsl(dsl); }); @@ -13,7 +11,7 @@ describe("Content Management System App", function() { cy.startRoutesForDatasource(); }); - it("1.Create Get echo Api call", function() { + it.only("1.Create Get echo Api call", function() { cy.NavigateToAPI_Panel(); cy.CreateAPI("get_data"); // creating get request using echo diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/ImportExportForkApplication_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/ImportExportForkApplication_spec.js index 37d5ae4c5c56..340b14011c27 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/ImportExportForkApplication_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/ImportExportForkApplication_spec.js @@ -3,7 +3,6 @@ const reconnectDatasourceModal = require("../../../locators/ReconnectLocators"); describe("Import, Export and Fork application and validate data binding", function() { let workspaceId; - let appid; let newWorkspaceName; let appName; it("Import application from json and validate data on pageload", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/PgAdmin_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/PgAdmin_spec.js index aad547b7a1bc..d63dcad9d9a3 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/PgAdmin_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/PgAdmin_spec.js @@ -6,14 +6,12 @@ const widgetsPage = require("../../../locators/Widgets.json"); const appPage = require("../../../locators/PgAdminlocators.json"); describe("PgAdmin Clone App", function() { - let workspaceId; - let newWorkspaceName; - let appname; let datasourceName; before(() => { cy.addDsl(dsl); }); + beforeEach(() => { cy.startRoutesForDatasource(); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/PromisesApp_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/PromisesApp_spec.js index d4b86e53bb7d..dc48bf06a3ba 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/PromisesApp_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/PromisesApp_spec.js @@ -1,13 +1,9 @@ import { ObjectsRegistry } from "../../../support/Objects/Registry"; const homePage = require("../../../locators/HomePage"); const dsl = require("../../../fixtures/promisesStoreValueDsl.json"); -const widgetsPage = require("../../../locators/Widgets.json"); const commonlocators = require("../../../locators/commonlocators.json"); const jsEditorLocators = require("../../../locators/JSEditor.json"); -let agHelper = ObjectsRegistry.AggregateHelper, - ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor; -const newPage = "TableTest"; +let jsEditor = ObjectsRegistry.JSEditor; describe("JSEditor tests", function() { before(() => { @@ -16,6 +12,7 @@ describe("JSEditor tests", function() { beforeEach(() => { cy.startServerAndRoutes(); }); + it("Testing promises with resetWidget, storeValue action and API call", () => { cy.NavigateToAPI_Panel(); cy.CreateAPI("TC1api"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/NavigateTo_spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/NavigateTo_spec.ts index f2eb6e58a88d..6dd7186379bd 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/NavigateTo_spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/NavigateTo_spec.ts @@ -1,5 +1,4 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - const { AggregateHelper: agHelper, CommonLocators: locator, @@ -9,10 +8,18 @@ const { } = ObjectsRegistry; describe("Navigate To feature", () => { + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("1. Navigates to page name clicked from the page name tab of navigate to", () => { // create a new page ee.AddNewPage(); // page 2 - ee.SelectEntityByName("Page1"); cy.fixture("promisesBtnDsl").then((val: any) => { agHelper.AddDsl(val, locator._spanButton("Submit")); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_API_with_List_Widget_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_API_with_List_Widget_spec.js index 92be48249cc5..000f300ab546 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_API_with_List_Widget_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_API_with_List_Widget_spec.js @@ -5,7 +5,6 @@ const publishPage = require("../../../../locators/publishWidgetspage.json"); import apiPage from "../../../../locators/ApiEditor"; describe("Test Create Api and Bind to List widget", function() { - let apiData; let valueToTest; before(() => { cy.addDsl(dsl); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_DatePicker_Text_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_DatePicker_Text_spec.js index efd357f1ace5..c5d3f029f385 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_DatePicker_Text_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_DatePicker_Text_spec.js @@ -2,7 +2,6 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../../locators/FormWidgets.json"); const dsl = require("../../../../fixtures/uiBindDsl.json"); const publishPage = require("../../../../locators/publishWidgetspage.json"); -const pages = require("../../../../locators/Pages.json"); describe("Binding the Datepicker and Text Widget", function() { let nextDay; diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_MultiSelect_Button_Text_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_MultiSelect_Button_Text_spec.js index 79c97c0937b9..87ada8a1dbc2 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_MultiSelect_Button_Text_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_MultiSelect_Button_Text_spec.js @@ -1,8 +1,9 @@ /// <reference types="Cypress" /> const dsl = require("../../../../fixtures/defaultMetadataDsl.json"); -const publishPage = require("../../../../locators/publishWidgetspage.json"); const explorer = require("../../../../locators/explorerlocators.json"); +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; import { WIDGET, @@ -28,6 +29,13 @@ const widgetsToTest = { Object.entries(widgetsToTest).forEach(([widgetSelector, testConfig]) => { describe(`${testConfig.widgetName} widget test for validating reset action`, function() { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); before(() => { cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableTextPagination_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableTextPagination_spec.js index 2469d54b9837..01ec3b73e1ad 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableTextPagination_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableTextPagination_spec.js @@ -7,7 +7,6 @@ describe("Test Create Api and Bind to Table widget", function() { before(() => { cy.addDsl(dsl); }); - it("Test_Add Paginate with Table Page No and Execute the Api", function() { cy.wait(30000); /**Create an Api1 of Paginate with Table Page No */ diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableV2_Widget_API_Derived_Column_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableV2_Widget_API_Derived_Column_spec.js index be6aa195bd15..b10d7a203acf 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableV2_Widget_API_Derived_Column_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableV2_Widget_API_Derived_Column_spec.js @@ -7,7 +7,6 @@ describe("Test Create Api and Bind to Table widget", function() { before(() => { cy.addDsl(dsl); }); - it("1. Create an API and Execute the API and bind with TableV2", function() { cy.createAndFillApi(this.data.paginationUrl, this.data.paginationParam); cy.RunAPI(); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableV2_Widget_API_Pagination_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableV2_Widget_API_Pagination_spec.js index cab9062ccf6e..88ed566b8e3e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableV2_Widget_API_Pagination_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_TableV2_Widget_API_Pagination_spec.js @@ -5,7 +5,6 @@ describe("Test Create Api and Bind to Table widget V2", function() { before(() => { cy.addDsl(dsl); }); - it("1. Create an API and Execute the API and bind with Table", function() { cy.createAndFillApi(this.data.paginationUrl, this.data.paginationParam); cy.RunAPI(); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_tableV2Api_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_tableV2Api_spec.js index 0ee31de9761c..1d8ef4f8df56 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_tableV2Api_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_tableV2Api_spec.js @@ -7,7 +7,6 @@ describe("Test Create Api and Bind to Table widget V2", function() { before(() => { cy.addDsl(dsl); }); - it("1. Test_Add users api and execute api", function() { cy.createAndFillApi(this.data.userApi, "/users"); cy.RunAPI(); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/ButtonGroup_binding_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/ButtonGroup_binding_spec.js index 6948491cff41..13fd5352c105 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/ButtonGroup_binding_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/ButtonGroup_binding_spec.js @@ -1,12 +1,10 @@ const dsl = require("../../../../fixtures/buttonGroupDsl.json"); const commonlocators = require("../../../../locators/commonlocators.json"); -const publishPage = require("../../../../locators/publishWidgetspage.json"); describe("Widget Grouping", function() { before(() => { cy.addDsl(dsl); }); - it("Button widgets widget on click info message valdiation ", function() { cy.get(".t--buttongroup-widget button") .contains("Add") diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/ChartText_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/ChartText_spec.js index 66260275b295..52765346acf4 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/ChartText_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/ChartText_spec.js @@ -2,7 +2,6 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const viewWidgetsPage = require("../../../../locators/ViewWidgets.json"); const publish = require("../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../fixtures/ChartTextDsl.json"); -const pages = require("../../../../locators/Pages.json"); describe("Text-Chart Binding Functionality", function() { before(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/InputWidgets_NavigateTo_validation_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/InputWidgets_NavigateTo_validation_spec.js index 7fd90e1ff9de..06e033302933 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/InputWidgets_NavigateTo_validation_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/InputWidgets_NavigateTo_validation_spec.js @@ -7,8 +7,18 @@ const publish = require("../../../../locators/publishWidgetspage.json"); const testdata = require("../../../../fixtures/testdata.json"); const dsl2 = require("../../../../fixtures/displayWidgetDsl.json"); const pageid = "MyPage"; +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; describe("Binding the multiple Widgets and validating NavigateTo Page", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + before(() => { cy.addDsl(dsl); cy.wait(5000); //dsl to settle! @@ -17,6 +27,7 @@ describe("Binding the multiple Widgets and validating NavigateTo Page", function it("1. Create MyPage and valdiate if its successfully created", function() { cy.Createpage(pageid); cy.addDsl(dsl2); + cy.wait(5000); //dsl to settle! // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(3000); cy.CheckAndUnfoldEntityItem("Pages"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Invalid_binding_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Invalid_binding_spec.js index 703de9cce974..669a9ff4e953 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Invalid_binding_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Invalid_binding_spec.js @@ -1,9 +1,4 @@ -const commonlocators = require("../../../../locators/commonlocators.json"); -const formWidgetsPage = require("../../../../locators/FormWidgets.json"); const dsl = require("../../../../fixtures/Invalid_binding_dsl.json"); -const pages = require("../../../../locators/Pages.json"); -const widgetsPage = require("../../../../locators/Widgets.json"); -const publish = require("../../../../locators/publishWidgetspage.json"); const testdata = require("../../../../fixtures/testdata.json"); describe("Binding the multiple widgets and validating default data", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/NavigateToFeatureValidation_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/NavigateToFeatureValidation_spec.js index d6991cfbb505..82aba0f7ffd6 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/NavigateToFeatureValidation_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/NavigateToFeatureValidation_spec.js @@ -2,13 +2,21 @@ const widgetsPage = require("../../../../locators/Widgets.json"); const commonlocators = require("../../../../locators/commonlocators.json"); const publish = require("../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../fixtures/navigateTotabledsl.json"); -const pages = require("../../../../locators/Pages.json"); const testdata = require("../../../../fixtures/testdata.json"); const dsl2 = require("../../../../fixtures/navigateToInputDsl.json"); -const explorer = require("../../../../locators/explorerlocators.json"); const pageid = "MyPage"; +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("Table Widget with Input Widget and Navigate to functionality validation", function() { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + before(() => { cy.addDsl(dsl); }); 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 30274c7c62c0..9df5755ec1fb 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 @@ -9,6 +9,15 @@ const agHelper = ObjectsRegistry.AggregateHelper, propPane = ObjectsRegistry.PropertyPane; describe("Validate basic Promises", () => { + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("1. Verify storeValue via .then via direct Promises", () => { const date = new Date().toDateString(); cy.fixture("promisesBtnDsl").then((val: any) => { @@ -356,6 +365,7 @@ InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + user + " cy.get("@jsObjName").then((jsObjName) => { propPane.EnterJSContext("onClick", "{{" + jsObjName + ".myFun1()}}"); }); + deployMode.DeployApp(); agHelper.ClickButton("Submit"); agHelper.Sleep(1000); agHelper diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/SmartSubstitutionWidgets_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/SmartSubstitutionWidgets_spec.js index 179f927a072d..674fbe4aa5b5 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/SmartSubstitutionWidgets_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/SmartSubstitutionWidgets_spec.js @@ -1,8 +1,6 @@ -const commonlocators = require("../../../../locators/commonlocators.json"); const widgetLocators = require("../../../../locators/Widgets.json"); const publish = require("../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../fixtures/tableAndChart.json"); -const pages = require("../../../../locators/Pages.json"); const viewWidgetsPage = require("../../../../locators/ViewWidgets.json"); describe("Text-Table Binding Functionality", function() { @@ -23,6 +21,7 @@ describe("Text-Table Binding Functionality", function() { before(() => { cy.addDsl(dsl); }); + it("Update table data and assert", function() { cy.openPropertyPane("tablewidget"); @@ -33,6 +32,7 @@ describe("Text-Table Binding Functionality", function() { }); }); }); + it("Update chart data and assert", function() { cy.openPropertyPane("chartwidget"); cy.get(".t--property-control-chart-series-data-control").then(($el) => { @@ -48,6 +48,7 @@ describe("Text-Table Binding Functionality", function() { .should("have.length.greaterThan", 0); }); }); + it("Publish and assert", function() { cy.PublishtheApp(); cy.readTabledata("1", "0").then((cellData) => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableV2Widgets_NavigateTo_Validation_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableV2Widgets_NavigateTo_Validation_spec.js index 8c9d70232f8d..6060f00a1cf8 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableV2Widgets_NavigateTo_Validation_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableV2Widgets_NavigateTo_Validation_spec.js @@ -5,9 +5,21 @@ const testdata = require("../../../../fixtures/testdata.json"); const dsl2 = require("../../../../fixtures/displayWidgetDsl.json"); const pageid = "MyPage"; +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; + describe("Table Widget V2 and Navigate to functionality validation", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + before(() => { cy.addDsl(dsl); + cy.wait(2000); //dsl to settle! }); it("1. Create MyPage and validate if its successfully created", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableV2_Widget__CondtionalFormatting_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableV2_Widget__CondtionalFormatting_spec.js index 5f2f6bdb9909..4f97a87c3f10 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableV2_Widget__CondtionalFormatting_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableV2_Widget__CondtionalFormatting_spec.js @@ -1,5 +1,6 @@ /* eslint-disable cypress/no-unnecessary-waiting */ const dsl = require("../../../../fixtures/tableV2WidgetCondnFormatDsl.json"); + describe("Table Widget V2 condtional formatting to remain consistent", function() { before(() => { cy.addDsl(dsl); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableWidgets_NavigateTo_Validation_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableWidgets_NavigateTo_Validation_spec.js index 7c23687261b6..c02ff8a23fd7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableWidgets_NavigateTo_Validation_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TableWidgets_NavigateTo_Validation_spec.js @@ -1,13 +1,24 @@ const widgetsPage = require("../../../../locators/Widgets.json"); const commonlocators = require("../../../../locators/commonlocators.json"); -const dsl = require("../../../../fixtures/tableWidgetDsl.json"); const testdata = require("../../../../fixtures/testdata.json"); +const dsl = require("../../../../fixtures/tableWidgetDsl.json"); const dsl2 = require("../../../../fixtures/displayWidgetDsl.json"); const pageid = "MyPage"; +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; describe("Table Widget and Navigate to functionality validation", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + before(() => { cy.addDsl(dsl); + cy.wait(2000); //dsl to settle! }); it("Create MyPage and valdiate if its successfully created", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TextTable_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TextTable_spec.js index 81c2cf89b45f..33165181b668 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TextTable_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/TextTable_spec.js @@ -1,7 +1,6 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const publish = require("../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../fixtures/TextTabledsl.json"); -const pages = require("../../../../locators/Pages.json"); describe("Text-Table Binding Functionality", function() { Cypress.on("uncaught:exception", (err, runnable) => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/autocomplete_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/autocomplete_spec.js index 81417a7e844f..06436faf57d4 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/autocomplete_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/autocomplete_spec.js @@ -1,5 +1,4 @@ const dsl = require("../../../../fixtures/autocomp.json"); -const pages = require("../../../../locators/Pages.json"); const dynamicInputLocators = require("../../../../locators/DynamicInput.json"); const apiwidget = require("../../../../locators/apiWidgetslocator.json"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/AllWidgets_Reset_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/AllWidgets_Reset_Spec.ts index 8379daf27c21..bba9f220967b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/AllWidgets_Reset_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/AllWidgets_Reset_Spec.ts @@ -1,7 +1,6 @@ import testdata from "../../../../fixtures/testdata.json"; import commonlocators from "../../../../locators/commonlocators.json"; import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - const agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, deployMode = ObjectsRegistry.DeployMode, @@ -308,13 +307,15 @@ function listwidgetAndReset() { agHelper.GetNAssertElementText( locator._textWidgetInDeployed, "002", - "contain.text", 6 + "contain.text", + 6, ); agHelper.ClickButton("Submit"); agHelper.GetNAssertElementText( locator._textWidgetInDeployed, "001", - "contain.text", 6 + "contain.text", + 6, ); } @@ -421,13 +422,18 @@ function filePickerWidgetAndReset() { Object.entries(widgetsToTest).forEach(([widgetSelector, testConfig]) => { describe(`${testConfig.widgetName} widget test for validating reset assertWidgetReset`, () => { - before(() => { - cy.fixture("defaultMetaDsl").then((val: any) => { - agHelper.AddDsl(val); - }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); }); it(`1. DragDrop Widget ${testConfig.widgetName}`, () => { + cy.fixture("defaultMetaDsl").then((val: any) => { + agHelper.AddDsl(val); + }); ee.DragDropWidgetNVerify(widgetSelector, 300, 100); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug16702_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug16702_Spec.ts index 81663dd4025c..096c8f3828a7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug16702_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug16702_Spec.ts @@ -1,8 +1,4 @@ import datasourceFormData from "../../../../fixtures/datasources.json"; -import { - ERROR_ACTION_EXECUTE_FAIL, - createMessage, -} from "../../../../support/Objects/CommonErrorMessages"; import { ObjectsRegistry } from "../../../../support/Objects/Registry"; const locator = ObjectsRegistry.CommonLocators, @@ -44,6 +40,7 @@ describe("Binding Expressions should not be truncated in Url and path extraction cy.get(".t--graphql-query-editor pre.CodeMirror-line span") .contains("__limit__") + .trigger("mouseover") .click() .type("{{JSObject1."); agHelper.GetNClickByContains(locator._hints, "limitValue"); @@ -66,6 +63,7 @@ describe("Binding Expressions should not be truncated in Url and path extraction cy.get(".t--graphql-query-editor pre.CodeMirror-line span") .contains("__offset__") + .trigger("mouseover") .should($el => { expect(Cypress.dom.isDetached($el)).to.false; }) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Entity_Naming_conflict_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Entity_Naming_conflict_spec.js index 7bc2a5078a30..22bd258bbd18 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Entity_Naming_conflict_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Entity_Naming_conflict_spec.js @@ -1,11 +1,5 @@ -const commonlocators = require("../../../../locators/commonlocators.json"); -const Layoutpage = require("../../../../locators/Layout.json"); -const widgetsPage = require("../../../../locators/Widgets.json"); -const publish = require("../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../fixtures/basicTabledsl.json"); -const pages = require("../../../../locators/Pages.json"); const apiwidget = require("../../../../locators/apiWidgetslocator.json"); -const tabname = "UpdatedTab"; describe("Tab widget test", function() { const apiName = "Table1"; diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Multiple_Widgets_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Multiple_Widgets_spec.js index a3fc40a4628b..0daf7adb82d2 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Multiple_Widgets_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Multiple_Widgets_spec.js @@ -2,13 +2,22 @@ const tdsl = require("../../../../fixtures/tableWidgetDsl.json"); const commonlocators = require("../../../../locators/commonlocators.json"); const dsl = require("../../../../fixtures/displayWidgetDsl.json"); const widgetsPage = require("../../../../locators/Widgets.json"); -const testdata = require("../../../../fixtures/testdata.json"); -const pages = require("../../../../locators/Pages.json"); const apiwidget = require("../../../../locators/apiWidgetslocator.json"); const explorer = require("../../../../locators/explorerlocators.json"); const pageid = "MyPage"; +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; + describe("Entity explorer tests related to widgets and validation", function() { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("Add a widget to default page and verify the properties", function() { cy.addDsl(dsl); cy.OpenBindings("Text1"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Pin_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Pin_spec.js index ec9b96e7d6ac..208fbb954226 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Pin_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Pin_spec.js @@ -1,7 +1,7 @@ const dsl = require("../../../../fixtures/displayWidgetDsl.json"); describe("Entity explorer tests related to pinning and unpinning", function() { - beforeEach(() => { + before(() => { cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Tab_rename_Delete_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Tab_rename_Delete_spec.js index c6462302b9ef..f6e5ddf2ee8a 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Tab_rename_Delete_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Tab_rename_Delete_spec.js @@ -1,11 +1,7 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const Layoutpage = require("../../../../locators/Layout.json"); const explorer = require("../../../../locators/explorerlocators.json"); -const widgetsPage = require("../../../../locators/Widgets.json"); -const publish = require("../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../fixtures/tabdsl.json"); -const pages = require("../../../../locators/Pages.json"); -const tabname = "UpdatedTab"; describe("Tab widget test", function() { const tabname = "UpdatedTab"; diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Delete_Undo_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Delete_Undo_spec.js index 5dce254e27ef..6999fbe56745 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Delete_Undo_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Delete_Undo_spec.js @@ -3,8 +3,6 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../../locators/FormWidgets.json"); const dsl = require("../../../../fixtures/formWidgetdsl.json"); -const pageid = "MyPage"; - before(() => { cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Paste_Delete_Undo_Keyboard_Event_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Paste_Delete_Undo_Keyboard_Event_spec.js index 566c7851a659..77d6193bb349 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Paste_Delete_Undo_Keyboard_Event_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Paste_Delete_Undo_Keyboard_Event_spec.js @@ -3,10 +3,8 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../../locators/FormWidgets.json"); const dsl = require("../../../../fixtures/formWithInputdsl.json"); import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - let ee = ObjectsRegistry.EntityExplorer; -const pageid = "MyPage"; before(() => { cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_spec.js index c9c42720b035..5dd1cc931ace 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_spec.js @@ -1,9 +1,8 @@ const dsl = require("../../../../fixtures/displayWidgetDsl.json"); const apiwidget = require("../../../../locators/apiWidgetslocator.json"); -const explorer = require("../../../../locators/explorerlocators.json"); describe("Entity explorer tests related to widgets and validation", function() { - beforeEach(() => { + before(() => { cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Page_Load_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Page_Load_Spec.js index 998f74209940..fdc54a0ead10 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Page_Load_Spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Page_Load_Spec.js @@ -2,11 +2,21 @@ const dsl = require("../../../../fixtures/PageLoadDsl.json"); const commonlocators = require("../../../../locators/commonlocators.json"); const publish = require("../../../../locators/publishWidgetspage.json"); +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; + describe("Page Load tests", () => { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + before(() => { cy.addDsl(dsl); cy.CreatePage(); - cy.get("h2").contains("Drag and drop a widget here"); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js index cf67e98330cf..31dc6f4f8a3a 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js @@ -6,6 +6,7 @@ const pages = require("../../../../../locators/Pages.json"); import homePage from "../../../../../locators/HomePage"; import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; let ee = ObjectsRegistry.EntityExplorer; +let agHelper = ObjectsRegistry.AggregateHelper; const pagename = "ChildPage"; const tempBranch = "feat/tempBranch"; const tempBranch0 = "tempBranch0"; @@ -14,6 +15,14 @@ const jsObject = "JSObject1"; let repoName; describe("Git sync Bug #10773", function() { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + before(() => { cy.NavigateToHome(); cy.createWorkspace(); @@ -30,7 +39,7 @@ describe("Git sync Bug #10773", function() { }); }); - it("Bug:10773 When user delete a resource form the child branch and merge it back to parent branch, still the deleted resource will show up in the newly created branch", () => { + it("1. Bug:10773 When user delete a resource form the child branch and merge it back to parent branch, still the deleted resource will show up in the newly created branch", () => { // adding a new page "ChildPage" to master cy.Createpage(pagename); cy.get(".t--entity-name:contains('Page1')").click(); @@ -59,10 +68,8 @@ describe("Git sync Bug #10773", function() { cy.CheckAndUnfoldEntityItem("Pages"); cy.get(`.t--entity-name:contains("${pagename}")`).should("not.exist"); }); -}); -describe("Git Bug: Fix clone page issue where JSObject are not showing up in destination page when application is connected to git", function() { - it("Connect app to git, clone the Page ,verify JSobject duplication should not happen and validate data binding in deploy mode and edit mode", () => { + it("2. Connect app to git, clone the Page ,verify JSobject duplication should not happen and validate data binding in deploy mode and edit mode", () => { cy.NavigateToHome(); cy.createWorkspace(); cy.wait("@createWorkspace").then((interception) => { @@ -129,7 +136,7 @@ describe("Git Bug: Fix clone page issue where JSObject are not showing up in des cy.wait(1000); }); - it("Bug:12724 Js objects are merged to single page when user creates a new branch", () => { + it("3. Bug:12724 Js objects are merged to single page when user creates a new branch", () => { // create a new branch, clone page and validate jsObject data binding cy.createGitBranch(tempBranch); cy.wait(2000); @@ -159,14 +166,10 @@ describe("Git Bug: Fix clone page issue where JSObject are not showing up in des "response.body.responseMeta.status", 201, ); - }); - - after(() => { cy.deleteTestGithubRepo(repoName); }); -}); -describe("Git synced app with JSObject", function() { - it("Create an app with JSObject, connect it to git and verify its data in edit and deploy mode", function() { + + it("4. Create an app with JSObject, connect it to git and verify its data in edit and deploy mode", function() { cy.NavigateToHome(); cy.createWorkspace(); cy.wait("@createWorkspace").then((interception) => { @@ -262,13 +265,10 @@ describe("Git synced app with JSObject", function() { ); }); }); - }); - after(() => { cy.deleteTestGithubRepo(repoName); }); -}); -describe("Git sync Bug #13385", function() { - it("Bug:13385 : Unable to see application in home page after the git connect flow is aborted in middle", () => { + + it("5. Bug:13385 : Unable to see application in home page after the git connect flow is aborted in middle", () => { cy.NavigateToHome(); cy.createWorkspace(); cy.wait("@createWorkspace").then((interception) => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ExportApplication_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ExportApplication_spec.js index b35596e38d09..f1cf88dabf6c 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ExportApplication_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/ExportApplication_spec.js @@ -2,8 +2,7 @@ const dsl = require("../../../../fixtures/displayWidgetDsl.json"); import homePage from "../../../../locators/HomePage"; import { ObjectsRegistry } from "../../../../support/Objects/Registry"; const commonlocators = require("../../../../locators/commonlocators.json"); -let HomePage = ObjectsRegistry.HomePage, - agHelper = ObjectsRegistry.AggregateHelper; +let HomePage = ObjectsRegistry.HomePage; describe("Export application as a JSON file", function() { let workspaceId; diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/Omnibar_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/Omnibar_spec.js index f489cd17eb5b..81f619a81420 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/Omnibar_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/Omnibar_spec.js @@ -1,9 +1,6 @@ const omnibar = require("../../../../locators/Omnibar.json"); const dsl = require("../../../../fixtures/omnibarDsl.json"); const commonlocators = require("../../../../locators/commonlocators.json"); -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - -let agHelper = ObjectsRegistry.AggregateHelper; describe("Omnibar functionality test cases", () => { const apiName = "Omnibar1"; diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/Unique_key_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/Unique_key_spec.js index 6a3299f18767..37b1943ebc1f 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/Unique_key_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/OtherUIFeatures/Unique_key_spec.js @@ -2,12 +2,20 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const dsl = require("../../../../fixtures/basicDsl.json"); const explorer = require("../../../../locators/explorerlocators.json"); const widgetsPage = require("../../../../locators/Widgets.json"); +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; + +const agHelper = ObjectsRegistry.AggregateHelper; // Since we cannot test the root cause as it does not show up on the DOM, we are testing the sideEffects // the root cause is when widget has same keys, which are not visible in DOM but confuses React when the list is modified. // please refer to issue, https://github.com/appsmithorg/appsmith/issues/7415 for more details. describe("Unique react keys", function() { - this.beforeEach(() => { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/PropertyPane/PropertyPaneJsEnabledVisible_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/PropertyPane/PropertyPaneJsEnabledVisible_spec.js index 0b0fbb80a4eb..f7a365e3a2cf 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/PropertyPane/PropertyPaneJsEnabledVisible_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/PropertyPane/PropertyPaneJsEnabledVisible_spec.js @@ -1,5 +1,4 @@ const dsl = require("../../../../fixtures/jsonFormDslWithSchema.json"); -const { ObjectsRegistry } = require("../../../../support/Objects/Registry"); describe("Property pane js enabled field", function() { before(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Datepicker/DatePickerV2_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Datepicker/DatePickerV2_spec.js index 2c3ebfa37055..f2ce9eef0e1d 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Datepicker/DatePickerV2_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Datepicker/DatePickerV2_spec.js @@ -1,13 +1,24 @@ const formWidgetsPage = require("../../../../../locators/FormWidgets.json"); const dsl = require("../../../../../fixtures/datePicker2dsl.json"); const datedsl = require("../../../../../fixtures/datePickerdsl.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; + +let agHelper = ObjectsRegistry.AggregateHelper; describe("DatePicker Widget Property pane tests with js bindings", function() { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + before(() => { cy.addDsl(dsl); }); - it("Datepicker default date validation with js binding", function() { + it("1. Datepicker default date validation with js binding", function() { cy.wait(7000); cy.openPropertyPane("datepickerwidget2"); cy.get(".t--property-control-defaultdate .bp3-input").clear(); @@ -33,7 +44,7 @@ describe("DatePicker Widget Property pane tests with js bindings", function() { */ }); - it("Text widgets binding with datepicker", function() { + it("2. Text widgets binding with datepicker", function() { cy.openPropertyPane("textwidget"); cy.testJsontext("text", "{{DatePicker1.formattedDate}}"); cy.closePropertyPane(); @@ -43,7 +54,7 @@ describe("DatePicker Widget Property pane tests with js bindings", function() { cy.closePropertyPane(); }); - it("Text widgets binding with datepicker", function() { + it("3. Text widgets binding with datepicker", function() { cy.openPropertyPane("datepickerwidget2"); cy.selectDateFormat("YYYY-MM-DD"); cy.assertDateFormat(); @@ -58,20 +69,16 @@ describe("DatePicker Widget Property pane tests with js bindings", function() { cy.assertDateFormat(); }); - it("Datepicker default date validation message", function() { + it("4. Datepicker default date validation message", function() { cy.openPropertyPane("datepickerwidget2"); cy.testJsontext("defaultdate", "24-12-2021"); cy.evaluateErrorMessage("Value does not match: ISO 8601 date string"); cy.closePropertyPane(); }); -}); -describe("DatePicker Widget Property pane tests with js bindings", function() { - before(() => { + it("5. Datepicker should not change the display data unless user selects the date", () => { cy.addDsl(datedsl); - }); - it("Datepicker should not change the display data unless user selects the date", () => { cy.openPropertyPane("datepickerwidget2"); cy.testJsontext( @@ -98,14 +105,9 @@ describe("DatePicker Widget Property pane tests with js bindings", function() { "{{moment().subtract(10, 'days').toISOString()}}", ); }); -}); -describe("DatePicker Widget Property pane tests with js bindings", function() { - before(() => { + it("6. Datepicker default date validation with strings", function() { cy.addDsl(datedsl); - }); - - it("Datepicker default date validation with strings", function() { cy.openPropertyPane("datepickerwidget2"); cy.get(formWidgetsPage.toggleJsDefaultDate).click(); cy.get(".t--property-control-defaultdate .bp3-input").clear(); @@ -119,7 +121,7 @@ describe("DatePicker Widget Property pane tests with js bindings", function() { cy.closePropertyPane(); }); - it("Datepicker input value changes to work with selected date formats", function() { + it("7. Datepicker input value changes to work with selected date formats", function() { cy.openPropertyPane("datepickerwidget2"); cy.get(".t--property-control-mindate .bp3-input") .clear() @@ -149,14 +151,9 @@ describe("DatePicker Widget Property pane tests with js bindings", function() { .first() .should("contain.text", "May 4, 2021 6:25 AM"); }); -}); -describe("DatePicker Widget Property pane tests with js bindings", function() { - before(() => { + it("8. Check isDirty meta property", function() { cy.addDsl(datedsl); - }); - - it("Check isDirty meta property", function() { cy.openPropertyPane("textwidget"); cy.updateCodeInput(".t--property-control-text", `{{DatePicker1.isDirty}}`); // Init isDirty @@ -201,7 +198,7 @@ describe("DatePicker Widget Property pane tests with js bindings", function() { .should("contain", "false"); }); - it("Datepicker default date validation with js binding", function() { + it("9. Datepicker default date validation with js binding", function() { cy.PublishtheApp(); // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(10000); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Dropdown/Dropdown_onOptionChange_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Dropdown/Dropdown_onOptionChange_spec.js index 66db083b56bd..30ea04bce7c7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Dropdown/Dropdown_onOptionChange_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Dropdown/Dropdown_onOptionChange_spec.js @@ -5,7 +5,6 @@ const publish = require("../../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../../fixtures/newFormDsl.json"); const data = require("../../../../../fixtures/example.json"); const datasource = require("../../../../../locators/DatasourcesEditor.json"); -const modalWidgetPage = require("../../../../../locators/ModalWidget.json"); describe("Dropdown Widget Functionality", function() { before(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Filepicker/FilePicker2_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Filepicker/FilePicker2_spec.js index c6b590157d29..6b84853f8d7a 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Filepicker/FilePicker2_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Filepicker/FilePicker2_spec.js @@ -1,8 +1,15 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const dsl = require("../../../../../fixtures/newFormDsl.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; describe("FilePicker Widget Functionality", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Input/Input_MaxChar_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Input/Input_MaxChar_spec.js index a01b13eea2cc..6440f8339563 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Input/Input_MaxChar_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Input/Input_MaxChar_spec.js @@ -2,8 +2,16 @@ const dsl = require("../../../../../fixtures/inputMaxCharDsl.json"); const commonlocators = require("../../../../../locators/commonlocators.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; + describe("Input Widget Max Char Functionality", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_ArrayField_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_ArrayField_spec.js index f0b6839ca7b4..79d2d9510b88 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_ArrayField_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_ArrayField_spec.js @@ -1,13 +1,22 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const dslWithSchema = require("../../../../../fixtures/jsonFormDslWithSchema.json"); const jsonFormDslWithSchemaAndWithoutSourceData = require("../../../../../fixtures/jsonFormDslWithSchemaAndWithoutSourceData.json"); - const fieldPrefix = ".t--jsonformfield"; const education = `${fieldPrefix}-education`; const addButton = ".t--jsonformfield-array-add-btn"; const deleteButton = ".t--jsonformfield-array-delete-btn"; +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("JSON Form Widget Array Field", () => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("can remove default items when default value changes from undefined to an array", () => { cy.addDsl(jsonFormDslWithSchemaAndWithoutSourceData); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_AutoGenerateFormDisabled_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_AutoGenerateFormDisabled_spec.js index 72d287be679c..93a807c011af 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_AutoGenerateFormDisabled_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_AutoGenerateFormDisabled_spec.js @@ -1,8 +1,17 @@ const jsonFormDslWithSchemaAndWithoutSourceData = require("../../../../../fixtures/jsonFormDslWithSchemaAndWithoutSourceData.json"); - const fieldPrefix = ".t--jsonformfield"; +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("JSON Form Widget AutoGenerate Disabled", () => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("generates fields with valid source data json", () => { const formDsl = JSON.parse( JSON.stringify(jsonFormDslWithSchemaAndWithoutSourceData), diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_AutoGenerateFormEnabled_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_AutoGenerateFormEnabled_spec.js index 21e883e5bd51..ffa28e193bd7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_AutoGenerateFormEnabled_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_AutoGenerateFormEnabled_spec.js @@ -1,9 +1,18 @@ const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); const jsonFormDslWithSchemaAndWithoutSourceData = require("../../../../../fixtures/jsonFormDslWithSchemaAndWithoutSourceData.json"); - const fieldPrefix = ".t--jsonformfield"; +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("JSON Form Widget AutoGenerate Enabled", () => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("generates fields with valid source data json", () => { cy.addDsl(dslWithoutSchema); const sourceData = { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldChange_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldChange_spec.js index 0816ea9635d4..6af1616ecb13 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldChange_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldChange_spec.js @@ -7,7 +7,6 @@ describe("JSON Form Widget Field Change", () => { before(() => { cy.addDsl(dslWithSchema); }); - it("modifies field type text to number", () => { cy.openPropertyPane("jsonformwidget"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldEvents_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldEvents_spec.js index 206604b50714..bcd5b58526f7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldEvents_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldEvents_spec.js @@ -5,13 +5,22 @@ const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); const commonlocators = require("../../../../../locators/commonlocators.json"); const widgetLocators = require("../../../../../locators/Widgets.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; const fieldPrefix = ".t--jsonformfield"; - const toggleJSButton = (name) => `.t--property-control-${name} .t--js-toggle`; +let agHelper = ObjectsRegistry.AggregateHelper; describe("Radio Group Field", () => { - before(() => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + it("1. Radio Group Field - pre condition", () => { const schema = { answer: "Y", }; @@ -23,7 +32,7 @@ describe("Radio Group Field", () => { cy.closePropertyPane(); }); - it("shows alert on optionChange", () => { + it("2. shows alert on optionChange", () => { cy.openPropertyPane("jsonformwidget"); cy.openFieldConfiguration("answer"); @@ -41,10 +50,8 @@ describe("Radio Group Field", () => { // Check for alert cy.get(commonlocators.toastmsg).contains("N"); }); -}); -describe("Multiselect Field", () => { - before(() => { + it("3. Multiselect Field - pre condition", () => { const schema = { colors: ["BLUE"], }; @@ -54,7 +61,7 @@ describe("Multiselect Field", () => { cy.closePropertyPane(); }); - it("shows updated formData values in onOptionChange binding", () => { + it("4. Shows updated formData values in onOptionChange binding", () => { cy.openPropertyPane("jsonformwidget"); cy.openFieldConfiguration("colors"); @@ -78,10 +85,8 @@ describe("Multiselect Field", () => { // Check for alert cy.get(commonlocators.toastmsg).contains("BLUE, RED"); }); -}); -describe("Select Field", () => { - before(() => { + it("5. Select Field - pre condition", () => { const schema = { color: "BLUE", }; @@ -93,7 +98,7 @@ describe("Select Field", () => { cy.closePropertyPane(); }); - it("shows updated formData values in onOptionChange binding", () => { + it("6. shows updated formData values in onOptionChange binding", () => { cy.openPropertyPane("jsonformwidget"); cy.openFieldConfiguration("color"); @@ -116,10 +121,8 @@ describe("Select Field", () => { // Check for alert cy.get(commonlocators.toastmsg).contains("RED"); }); -}); -describe("Input Field", () => { - before(() => { + it("7. Input Field - pre condition", () => { const schema = { name: "John", }; @@ -129,7 +132,7 @@ describe("Input Field", () => { cy.closePropertyPane(); }); - it("shows updated formData values in onOptionChange binding", () => { + it("8. Shows updated formData values in onOptionChange binding", () => { cy.openPropertyPane("jsonformwidget"); cy.openFieldConfiguration("name"); @@ -145,10 +148,8 @@ describe("Input Field", () => { // Check for alert cy.get(commonlocators.toastmsg).contains("John Doe"); }); -}); -describe("Checkbox Field", () => { - before(() => { + it("9. Checkbox Field - pre condition", () => { const schema = { agree: true, }; @@ -160,7 +161,7 @@ describe("Checkbox Field", () => { cy.closePropertyPane(); }); - it("shows updated formData values in onChange binding", () => { + it("10. Shows updated formData values in onChange binding", () => { cy.openPropertyPane("jsonformwidget"); cy.openFieldConfiguration("agree"); @@ -179,10 +180,8 @@ describe("Checkbox Field", () => { // Check for alert cy.get(commonlocators.toastmsg).contains("false"); }); -}); -describe("Switch Field", () => { - before(() => { + it("11. Switch Field - pre condition", () => { const schema = { agree: true, }; @@ -192,7 +191,7 @@ describe("Switch Field", () => { cy.closePropertyPane(); }); - it("shows updated formData values in onChange binding", () => { + it("12. Shows updated formData values in onChange binding", () => { cy.openPropertyPane("jsonformwidget"); cy.openFieldConfiguration("agree"); @@ -208,10 +207,8 @@ describe("Switch Field", () => { // Check for alert cy.get(commonlocators.toastmsg).contains("false"); }); -}); -describe("Date Field", () => { - before(() => { + it("13. Date Field - pre condition", () => { const schema = { dob: "20/12/1992", }; @@ -221,7 +218,7 @@ describe("Date Field", () => { cy.closePropertyPane(); }); - it("shows updated formData values in onDateSelected binding", () => { + it("14. shows updated formData values in onDateSelected binding", () => { cy.openPropertyPane("jsonformwidget"); cy.openFieldConfiguration("dob"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldProperties_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldProperties_spec.js index 2d62c2c0b42b..5c331428b74b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldProperties_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FieldProperties_spec.js @@ -1,9 +1,19 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; const fieldPrefix = ".t--jsonformfield"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("Text Field Property Control", () => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + before(() => { const schema = { name: "John", @@ -13,18 +23,18 @@ describe("Text Field Property Control", () => { cy.testJsontext("sourcedata", JSON.stringify(schema)); }); - it("has valid default text", () => { + it("1. has valid default text", () => { cy.openFieldConfiguration("name"); cy.get(".t--property-control-defaultvalue").contains("{{sourceData.name}}"); }); - it("updated field with change in default text", () => { + it("2. updated field with change in default text", () => { const defaultValue = "New default text"; cy.testJsontext("defaultvalue", "New default text").wait(200); cy.get(`${fieldPrefix}-name input`).should("have.value", defaultValue); }); - it("throws max character error when exceeds maxChar limit for default text", () => { + it("3. throws max character error when exceeds maxChar limit for default text", () => { cy.testJsontext("maxchars", 5); cy.get(`${fieldPrefix}-name input`).click(); cy.get(".bp3-popover-content").should(($x) => { @@ -33,7 +43,7 @@ describe("Text Field Property Control", () => { cy.testJsontext("maxchars", ""); }); - it("throws max character error when exceeds maxChar limit for input text", () => { + it("4. throws max character error when exceeds maxChar limit for input text", () => { cy.testJsontext("defaultvalue", "").wait(200); cy.get(`${fieldPrefix}-name input`) .clear() @@ -46,7 +56,7 @@ describe("Text Field Property Control", () => { cy.testJsontext("maxchars", ""); }); - it("sets placeholder", () => { + it("5. sets placeholder", () => { const placeholderText = "First name"; cy.testJsontext("placeholder", placeholderText); cy.get(`${fieldPrefix}-name input`) @@ -54,7 +64,7 @@ describe("Text Field Property Control", () => { .should("contain", placeholderText); }); - it("sets valid property with custom error message", () => { + it("6. sets valid property with custom error message", () => { cy.testJsontext("valid", "false"); cy.get(`${fieldPrefix}-name input`) .clear() @@ -71,7 +81,7 @@ describe("Text Field Property Control", () => { cy.testJsontext("valid", ""); }); - it("hides field when visible switched off", () => { + it("7. hides field when visible switched off", () => { cy.togglebarDisable(`.t--property-control-visible input`); cy.get(`${fieldPrefix}-name`).should("not.exist"); cy.wait(500); @@ -79,7 +89,7 @@ describe("Text Field Property Control", () => { cy.get(`${fieldPrefix}-name`).should("exist"); }); - it("disables field when disabled switched on", () => { + it("8. disables field when disabled switched on", () => { cy.togglebar(`.t--property-control-disabled input`); cy.get(`${fieldPrefix}-name input`).each(($el) => { cy.wrap($el).should("have.attr", "disabled"); @@ -88,7 +98,7 @@ describe("Text Field Property Control", () => { cy.togglebarDisable(`.t--property-control-disabled input`); }); - it("throws error when REGEX does not match the input value", () => { + it("9. throws error when REGEX does not match the input value", () => { cy.testJsontext("regex", "^\\d+$"); cy.get(`${fieldPrefix}-name input`) .clear() @@ -100,10 +110,8 @@ describe("Text Field Property Control", () => { .type("1234"); cy.get(".bp3-popover-content").should("not.exist"); }); -}); -describe("Checkbox Field Property Control", () => { - before(() => { + it("10. Checkbox Field Property Control - pre condition", () => { const schema = { check: false, }; @@ -114,18 +122,18 @@ describe("Checkbox Field Property Control", () => { cy.selectDropdownValue(commonlocators.jsonFormFieldType, "Checkbox"); }); - it("has default property", () => { + it("11. has default property", () => { cy.get(".t--property-control-defaultstate").contains( "{{sourceData.check}}", ); }); - it("should update field checked state when default selected changed", () => { + it("12. should update field checked state when default selected changed", () => { cy.testJsontext("defaultstate", "{{true}}"); cy.get(`${fieldPrefix}-check input`).should("be.checked"); }); - it("hides field when visible switched off", () => { + it("13. hides field when visible switched off", () => { cy.togglebarDisable(`.t--property-control-visible input`); cy.get(`${fieldPrefix}-check`).should("not.exist"); cy.wait(500); @@ -133,7 +141,7 @@ describe("Checkbox Field Property Control", () => { cy.get(`${fieldPrefix}-check`).should("exist"); }); - it("disables field when disabled switched on", () => { + it("14. disables field when disabled switched on", () => { cy.togglebar(`.t--property-control-disabled input`); cy.get(`${fieldPrefix}-check input`).each(($el) => { cy.wrap($el).should("have.attr", "disabled"); @@ -141,10 +149,8 @@ describe("Checkbox Field Property Control", () => { cy.togglebarDisable(`.t--property-control-disabled input`); }); -}); -describe("Switch Field Property Control", () => { - before(() => { + it("15. Switch Field Property Control - pre condition", () => { const schema = { switch: true, }; @@ -154,13 +160,13 @@ describe("Switch Field Property Control", () => { cy.openFieldConfiguration("switch"); }); - it("has default property", () => { + it("16. has default property", () => { cy.get(".t--property-control-defaultselected").contains( "{{sourceData.switch}}", ); }); - it("should update field checked state when default selected changed", () => { + it("17. should update field checked state when default selected changed", () => { cy.testJsontext("defaultselected", "{{false}}"); cy.get(`${fieldPrefix}-switch label.bp3-control.bp3-switch`).should( "have.class", @@ -168,7 +174,7 @@ describe("Switch Field Property Control", () => { ); }); - it("hides field when visible switched off", () => { + it("18. hides field when visible switched off", () => { cy.togglebarDisable(`.t--property-control-visible input`); cy.get(`${fieldPrefix}-switch`).should("not.exist"); cy.wait(500); @@ -176,7 +182,7 @@ describe("Switch Field Property Control", () => { cy.get(`${fieldPrefix}-switch`).should("exist"); }); - it("disables field when disabled switched on", () => { + it("19. disables field when disabled switched on", () => { cy.togglebar(`.t--property-control-disabled input`); cy.get(`${fieldPrefix}-switch input`).each(($el) => { cy.wrap($el).should("have.attr", "disabled"); @@ -184,10 +190,8 @@ describe("Switch Field Property Control", () => { cy.togglebarDisable(`.t--property-control-disabled input`); }); -}); -describe("Select Field Property Control", () => { - before(() => { + it("20. Select Field Property Control - pre condition", () => { const schema = { state: "Karnataka", }; @@ -198,13 +202,13 @@ describe("Select Field Property Control", () => { cy.selectDropdownValue(commonlocators.jsonFormFieldType, /^Select/); }); - it("has valid default value", () => { + it("21. has valid default value", () => { cy.get(".t--property-control-defaultselectedvalue").contains( "{{sourceData.state}}", ); }); - it("makes select filterable", () => { + it("22. makes select filterable", () => { // click select field and filter input should not exist cy.get(`${fieldPrefix}-state .bp3-control-group`).click({ force: true }); cy.get(`.bp3-select-popover .bp3-input-group`).should("not.exist"); @@ -217,7 +221,7 @@ describe("Select Field Property Control", () => { cy.get(`.bp3-select-popover .bp3-input-group`).should("exist"); }); - it("hides field when visible switched off", () => { + it("23. hides field when visible switched off", () => { cy.togglebarDisable(`.t--property-control-visible input`); cy.get(`${fieldPrefix}-state`).should("not.exist"); cy.wait(500); @@ -225,7 +229,7 @@ describe("Select Field Property Control", () => { cy.get(`${fieldPrefix}-state`).should("exist"); }); - it("disables field when disabled switched on", () => { + it("24. disables field when disabled switched on", () => { cy.togglebar(`.t--property-control-disabled input`); cy.get(`${fieldPrefix}-state button.bp3-button`).should( "have.class", @@ -234,10 +238,8 @@ describe("Select Field Property Control", () => { cy.togglebarDisable(`.t--property-control-disabled input`); }); -}); -describe("Multi-Select Field Property Control", () => { - before(() => { + it("25. Multi Field Property Control - pre condition", () => { const schema = { hobbies: [], }; @@ -247,14 +249,14 @@ describe("Multi-Select Field Property Control", () => { cy.openFieldConfiguration("hobbies"); }); - it("has valid default value", () => { + it("26. has valid default value", () => { cy.get(".t--property-control-defaultselectedvalues").contains( "{{sourceData.hobbies}}", ); cy.closePropertyPane(); }); - it("adds placeholder text", () => { + it("27. adds placeholder text", () => { cy.openPropertyPane("jsonformwidget"); cy.openFieldConfiguration("hobbies"); @@ -263,7 +265,7 @@ describe("Multi-Select Field Property Control", () => { cy.get(`.rc-select-selection-placeholder`).contains("Select placeholder"); }); - it("hides field when visible switched off", () => { + it("28. hides field when visible switched off", () => { cy.togglebarDisable(`.t--property-control-visible input`); cy.get(`${fieldPrefix}-hobbies`).should("not.exist"); cy.wait(500); @@ -271,7 +273,7 @@ describe("Multi-Select Field Property Control", () => { cy.get(`${fieldPrefix}-hobbies`).should("exist"); }); - it("disables field when disabled switched on", () => { + it("29. disables field when disabled switched on", () => { cy.togglebar(`.t--property-control-disabled input`); cy.get(`${fieldPrefix}-hobbies .rc-select-multiple`).should( "have.class", @@ -280,10 +282,8 @@ describe("Multi-Select Field Property Control", () => { cy.togglebarDisable(`.t--property-control-disabled input`); }); -}); -describe("Radio group Field Property Control", () => { - before(() => { + it("30. Radio group Field Property Control - pre condition", () => { const sourceData = { radio: "Y", }; @@ -294,7 +294,7 @@ describe("Radio group Field Property Control", () => { cy.selectDropdownValue(commonlocators.jsonFormFieldType, "Radio Group"); }); - it("has valid default value", () => { + it("31. has valid default value", () => { cy.get(".t--property-control-defaultselectedvalue").contains( "{{sourceData.radio}}", ); @@ -302,7 +302,7 @@ describe("Radio group Field Property Control", () => { cy.get(`${fieldPrefix}-radio input`).should("have.value", "Y"); }); - it("hides field when visible switched off", () => { + it("32. hides field when visible switched off", () => { cy.togglebarDisable(`.t--property-control-visible input`); cy.get(`${fieldPrefix}-radio`).should("not.exist"); cy.wait(500); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FilterText_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FilterText_spec.js index e0230707b3c9..9f3716110ce5 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FilterText_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FilterText_spec.js @@ -4,12 +4,21 @@ const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); const commonlocators = require("../../../../../locators/commonlocators.json"); - const onFilterUpdateJSBtn = ".t--property-control-onfilterupdate .t--js-toggle"; const fieldPrefix = ".t--jsonformfield"; +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("JSONForm Select field - filterText update action trigger ", () => { - before(() => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + it("1. JSONForm Select field - filterText update action trigger - pre condition", () => { const schema = { color: "GREEN", }; @@ -21,7 +30,7 @@ describe("JSONForm Select field - filterText update action trigger ", () => { cy.closePropertyPane(); }); - it("shows alert on filter text change", () => { + it("2. shows alert on filter text change", () => { const filterText = "Test string"; cy.openPropertyPane("jsonformwidget"); @@ -50,10 +59,8 @@ describe("JSONForm Select field - filterText update action trigger ", () => { cy.get(commonlocators.toastmsg).contains(`Filter update:${filterText}`); }); -}); -describe("JSONForm Multiselect field - filterText update action trigger ", () => { - before(() => { + it("3. JSONForm Multiselect field - filterText update action trigger - pre condition", () => { const schema = { colors: ["GREEN", "BLUE"], }; @@ -63,7 +70,7 @@ describe("JSONForm Multiselect field - filterText update action trigger ", () => cy.closePropertyPane(); }); - it("shows alert on filter text change", () => { + it("4. shows alert on filter text change", () => { const filterText = "Test string"; cy.openPropertyPane("jsonformwidget"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_Footer_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_Footer_spec.js index ce8fcdcf4b8e..11cc4a2e221e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_Footer_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_Footer_spec.js @@ -1,7 +1,18 @@ const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); const dslWithSchema = require("../../../../../fixtures/jsonFormDslWithSchema.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; + +let agHelper = ObjectsRegistry.AggregateHelper; describe("JSONForm Footer spec", () => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("1. sticks to the bottom when fixed footer is true and content is less", () => { cy.addDsl(dslWithoutSchema); // add small source data diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FormBindings_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FormBindings_spec.js index 5c6f9159bdf3..a806bc218955 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FormBindings_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FormBindings_spec.js @@ -5,12 +5,20 @@ const fieldPrefix = ".t--jsonformfield"; const propertyControlPrefix = ".t--property-control"; const backBtn = ".t--property-pane-back-btn"; +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; + describe("JSON Form Widget Form Bindings", () => { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dslWithSchema); }); - it("updates formData when field value changes", () => { + it("1. updates formData when field value changes", () => { const expectedInitialFormData = { age: 30, dob: "10/12/1992", @@ -68,7 +76,7 @@ describe("JSON Form Widget Form Bindings", () => { }); }); - it("updates fieldState", () => { + it("2. updates fieldState", () => { const expectedInitialFieldState = { name: { isDisabled: false, @@ -280,7 +288,7 @@ describe("JSON Form Widget Form Bindings", () => { }); }); - it("change field accessor should reflect in fieldState", () => { + it("3. change field accessor should reflect in fieldState", () => { const expectedFieldStateChange = { firstName: { isDisabled: false, @@ -379,7 +387,7 @@ describe("JSON Form Widget Form Bindings", () => { }); }); - it("change field accessor should reflect in formData", () => { + it("4. change field accessor should reflect in formData", () => { const expectedFormDataChange = { age: 30, dob: "10/12/1992", diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FormProperties_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FormProperties_spec.js index 1046f990b16e..a03a691471cd 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FormProperties_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_FormProperties_spec.js @@ -9,13 +9,23 @@ const fieldPrefix = ".t--jsonformfield"; const propertyControlPrefix = ".t--property-control"; const submitButtonStylesSection = ".t--property-pane-section-submitbuttonstyles"; +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("JSON Form Widget Form Bindings", () => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + before(() => { cy.addDsl(dslWithSchema); }); - it("should have all the fields under field configuration", () => { + it("1. should have all the fields under field configuration", () => { cy.openPropertyPane("jsonformwidget"); const fieldNames = [ "name", @@ -32,7 +42,7 @@ describe("JSON Form Widget Form Bindings", () => { }); }); - it("Field Configuration - adds new custom field", () => { + it("2. Field Configuration - adds new custom field", () => { cy.openPropertyPane("jsonformwidget"); // Add new field @@ -44,7 +54,7 @@ describe("JSON Form Widget Form Bindings", () => { cy.get(`[data-rbd-draggable-id='customField1']`).should("exist"); }); - it("Disabled Invalid Forms - disables the submit button when form has invalid field(s)", () => { + it("3. Disabled Invalid Forms - disables the submit button when form has invalid field(s)", () => { cy.get("button") .contains("Submit") .parent("button") @@ -73,7 +83,7 @@ describe("JSON Form Widget Form Bindings", () => { .should("not.have.attr", "disabled"); }); - it("Should set isValid to false when form is invalid", () => { + it("4. Should set isValid to false when form is invalid", () => { cy.openPropertyPane("textwidget"); cy.testJsontext("text", "{{JSONForm1.isValid}}"); @@ -92,7 +102,7 @@ describe("JSON Form Widget Form Bindings", () => { cy.get(`${widgetsPage.textWidget} .bp3-ui-text`).contains("true"); }); - it("show show icon select when a collapsed section is opened", () => { + it("5. show show icon select when a collapsed section is opened", () => { cy.openPropertyPane("jsonformwidget"); cy.moveToStyleTab(); // Check Submit Button Styles hidden @@ -117,7 +127,7 @@ describe("JSON Form Widget Form Bindings", () => { cy.get(".bp3-select-popover .virtuoso-grid-item").should("be.visible"); }); - it("Should set isValid to false on first load when form is invalid", () => { + it("6. Should set isValid to false on first load when form is invalid", () => { cy.addDsl(dslWithoutSchema); const schema = { @@ -141,7 +151,7 @@ describe("JSON Form Widget Form Bindings", () => { cy.get(publishPage.backToEditor).click({ force: true }); }); - it("Should set isValid to false on reset when form is invalid", () => { + it("7. Should set isValid to false on reset when form is invalid", () => { cy.addDsl(dslWithoutSchema); const schema = { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_MultipleSourceData_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_MultipleSourceData_spec.js index 9dfbeea55cbe..fb15a3bc12c1 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_MultipleSourceData_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_MultipleSourceData_spec.js @@ -1,67 +1,57 @@ const jsonform = require("../../../../../locators/jsonFormWidget.json"); const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); const jsonText = require("../../../../../fixtures/jsonTextDsl.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("Verify syntax to create Datpicker field type", () => { - before(() => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + it("1. Validate calendar on clicking date field", () => { const schema = { Key: "20/03/1992" }; cy.addDsl(dslWithoutSchema); cy.openPropertyPane("jsonformwidget"); cy.testJsontext("sourcedata", JSON.stringify(schema)); - }); - - it("Validate calendar on clicking date field", () => { cy.xpath(jsonform.datepickerContainer).click({ force: true, }); cy.get(jsonform.calendarPopup).should("be.visible"); }); -}); -describe("Verify syntax to boolean type", () => { - before(() => { + it("2. Validate calendar on clicking date field", () => { const schema = { Key: true }; cy.addDsl(dslWithoutSchema); cy.openPropertyPane("jsonformwidget"); cy.testJsontext("sourcedata", JSON.stringify(schema)); - }); - - it("Validate calendar on clicking date field", () => { cy.get(jsonform.switchStatus).should("be.visible"); cy.get(jsonform.switchStatus).click({ force: true }); }); -}); -describe("Verify syntax to create email type", () => { - before(() => { + it("3. Validate email input field in form", () => { const schema = { Key: "[email protected]" }; cy.addDsl(dslWithoutSchema); cy.openPropertyPane("jsonformwidget"); cy.testJsontext("sourcedata", JSON.stringify(schema)); - }); - - it("Validate email input field in form", () => { cy.xpath(jsonform.emailField).should("be.visible"); cy.xpath(jsonform.emailField).should("have.value", "[email protected]"); }); -}); -describe("Verify syntax for Text type", () => { - before(() => { + it("4. Validate email input field in form", () => { const schema = { Key: "value" }; cy.addDsl(dslWithoutSchema); cy.openPropertyPane("jsonformwidget"); cy.testJsontext("sourcedata", JSON.stringify(schema)); - }); - - it("Validate email input field in form", () => { cy.get(jsonform.keyInput).should("be.visible"); cy.get(jsonform.keyInput).should("have.value", "value"); }); -}); -describe("Verify mandatory field check and also submit button active/inactive", () => { - before(() => { + it("5. Verify mandatory field check and also submit button active/inactive", () => { const schema = { name: "John", date_of_birth: "20/02/1990", @@ -70,9 +60,6 @@ describe("Verify mandatory field check and also submit button active/inactive", cy.addDsl(dslWithoutSchema); cy.openPropertyPane("jsonformwidget"); cy.testJsontext("sourcedata", JSON.stringify(schema)); - }); - - it("Modify a field to be mandatory", () => { cy.get(jsonform.settings) .first() .should("be.visible") @@ -86,7 +73,7 @@ describe("Verify mandatory field check and also submit button active/inactive", cy.get(jsonform.mandatoryAsterisk).should("be.visible"); }); - it("Checks when mandatory field is blank", () => { + it("6. Checks when mandatory field is blank", () => { cy.get(jsonform.jsformInput).clear({ force: true }); cy.get(jsonform.msg).should("have.text", "This field is required"); cy.get(jsonform.submit).should("be.disabled"); @@ -94,15 +81,10 @@ describe("Verify mandatory field check and also submit button active/inactive", cy.get(jsonform.msg).should("not.exist"); cy.get(jsonform.submit).should("be.enabled"); }); -}); -describe("Verify property name change with json/text widget binding", () => { - before(() => { + it("7. Verify property name change with json/text widget binding - Modify property name and check how the binding value changes", () => { cy.addDsl(jsonText); cy.openPropertyPane("jsonformwidget"); - }); - - it("Modify property name and check how the binding value changes", () => { cy.get(jsonform.settings) .first() .should("be.visible") diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_NestedField_Select_Multiselect.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_NestedField_Select_Multiselect.js index d8ce16a6e530..01f84946a477 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_NestedField_Select_Multiselect.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_NestedField_Select_Multiselect.js @@ -6,9 +6,19 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); const fieldPrefix = ".t--jsonformfield"; +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; describe("JSONForm select field", () => { - before(() => { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + it("1. JSONForm select field - precondition", () => { const schema = { object: { select: "GREEN", @@ -34,7 +44,7 @@ describe("JSONForm select field", () => { cy.selectDropdownValue(commonlocators.jsonFormFieldType, /^Select$/); }); - it("should open the menu", () => { + it("2. should open the menu", () => { // Click select field in object cy.get(`${fieldPrefix}-object-select label`).click({ force: true }); // Menu should open up @@ -46,7 +56,7 @@ describe("JSONForm select field", () => { cy.get(".bp3-select-popover.select-popover-wrapper").should("exist"); }); - it("menu items should be selectable", () => { + it("3. menu items should be selectable", () => { // Select field in object cy.get(`${fieldPrefix}-object-select label`).click({ force: true }); // Click blue option @@ -67,10 +77,8 @@ describe("JSONForm select field", () => { // Verify if blue option is selected cy.get(`${fieldPrefix}-array-0--select .select-button`).contains("Blue"); }); -}); -describe("JSONForm multiselect field", () => { - before(() => { + it("4. JSONForm multiselect field - precondition", () => { const schema = { object: { multiselect: "GREEN", @@ -96,7 +104,7 @@ describe("JSONForm multiselect field", () => { cy.selectDropdownValue(commonlocators.jsonFormFieldType, /^Multiselect$/); }); - it("should open the menu", () => { + it("5. should open the menu", () => { // Open multiselect in object cy.get(`${fieldPrefix}-object-multiselect`) .find(".rc-select-selection-search-input") @@ -118,7 +126,7 @@ describe("JSONForm multiselect field", () => { cy.get(".rc-virtual-list").should("exist"); }); - it("menu items should be selectable", () => { + it("6. menu items should be selectable", () => { // Open multiselect in object cy.get(`${fieldPrefix}-object-multiselect`) .find(".rc-select-selection-search-input") diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_RadioGroupField_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_RadioGroupField_spec.js index 0f94314a9851..1ec45f3d1ff4 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_RadioGroupField_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_RadioGroupField_spec.js @@ -1,7 +1,8 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); - const fieldPrefix = ".t--jsonformfield"; +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper; function selectAndValidateOption(selector, option, expectedFormData) { // Select option Zero @@ -34,9 +35,13 @@ function clearOptionsProperty() { } describe("JSONForm RadioGroup Field", () => { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dslWithoutSchema); - // Bind formData to Text1 widget text property cy.openPropertyPane("textwidget"); cy.testJsontext("text", "{{JSON.stringify(JSONForm1.formData)}}"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_Reset_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_Reset_spec.js index 1745ef9f9f82..ff6c3bd885c0 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_Reset_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_Reset_spec.js @@ -3,7 +3,7 @@ const dslWithSchema = require("../../../../../fixtures/jsonFormDslWithSchema.jso const fieldPrefix = ".t--jsonformfield"; describe("JSON Form reset", () => { - beforeEach(() => { + before(() => { cy.addDsl(dslWithSchema); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_UnicodeKeys_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_UnicodeKeys_spec.js index d48f2ba74492..af6fd530e3d0 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_UnicodeKeys_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/JSONForm/JSONForm_UnicodeKeys_spec.js @@ -1,11 +1,21 @@ const dslWithoutSchema = require("../../../../../fixtures/jsonFormDslWithoutSchema.json"); const jsonFormUnicodeDSLWithoutSourceData = require("../../../../../fixtures/jsonFormUnicodeDSLWithoutSourceData.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; const fieldPrefix = ".t--jsonformfield"; const backBtn = ".t--property-pane-back-btn"; describe("JSON Form Widget Unicode keys", () => { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + it("generates fields with valid source data json", () => { cy.addDsl(dslWithoutSchema); const sourceData = { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List1_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List1_spec.js index f8cb1b32a233..918271390e71 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List1_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List1_spec.js @@ -1,6 +1,5 @@ const dsl = require("../../../../../fixtures/listRegressionDsl.json"); const publish = require("../../../../../locators/publishWidgetspage.json"); -const commonlocators = require("../../../../../locators/commonlocators.json"); import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; let propPane = ObjectsRegistry.PropertyPane; diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List3_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List3_spec.js index 8ad728054822..def65b8c564b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List3_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/List/List3_spec.js @@ -2,8 +2,6 @@ const dsl = require("../../../../../fixtures/listRegression3Dsl.json"); const publish = require("../../../../../locators/publishWidgetspage.json"); describe("Binding the list widget with text widget", function() { - const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl"; - before(() => { cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Modal_On_Table_Filter_Pane_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Modal_On_Table_Filter_Pane_spec.js index 98e179a2119d..6934929dde41 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Modal_On_Table_Filter_Pane_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Modal_On_Table_Filter_Pane_spec.js @@ -2,7 +2,7 @@ const dsl = require("../../../../fixtures/modalOnTableFilterPaneDsl.json"); const widgets = require("../../../../locators/Widgets.json"); describe("Modal Widget Functionality", function() { - beforeEach(() => { + before(() => { cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Modal_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Modal_spec.js index ed5dbc65a912..3c855f74fe97 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Modal_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Modal_spec.js @@ -2,9 +2,17 @@ const dsl = require("../../../../fixtures/ModalDsl.json"); const commonlocators = require("../../../../locators/commonlocators.json"); const explorer = require("../../../../locators/explorerlocators.json"); const widgets = require("../../../../locators/Widgets.json"); +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper, + ee = ObjectsRegistry.EntityExplorer; describe("Modal Widget Functionality", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); @@ -15,30 +23,21 @@ describe("Modal Widget Functionality", function() { }); it("2. Open Existing Modal from created Widgets list", () => { - cy.get(".t--entity-name") - .contains("Widgets") - .click(); - cy.get(".t--entity-name:contains(Modal1)").click(); + ee.SelectEntityByName("Modal1", "Widgets"); cy.get(".t--modal-widget").should("exist"); - cy.CreateAPI("FirstAPI"); - - cy.get(".t--entity-name:contains(Modal1)").click(); + ee.SelectEntityByName("Modal1", "Widgets"); cy.get(".t--modal-widget").should("exist"); }); it("3. Display toast on close action", () => { cy.SearchEntityandOpen("Modal1"); - cy.get(".t--property-control-onclose") .find(".t--js-toggle") .click({ force: true }); - cy.testJsontext("onclose", "{{showAlert('test','success')}}"); - cy.wait(1000); //make sure evaluated value disappears cy.get(widgets.modalCloseButton).click({ force: true }); - cy.get(commonlocators.toastmsg).contains("test"); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Multiselect/MultiSelect4_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Multiselect/MultiSelect4_spec.js index 22dd14f9d47b..d4c601e02a72 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Multiselect/MultiSelect4_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Multiselect/MultiSelect4_spec.js @@ -14,7 +14,7 @@ describe("MultiSelect Widget Functionality", function() { cy.addDsl(dsl); }); beforeEach(() => { - cy.wait(7000); + cy.wait(3000); }); it("Add new multiselect widget", () => { cy.get(explorer.addWidget).click(); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Canvas_scrolling_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Canvas_scrolling_spec.js index cbef4c0c8c5d..3845d7a6a487 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Canvas_scrolling_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Canvas_scrolling_spec.js @@ -1,5 +1,4 @@ const dsl = require("../../../../../fixtures/modalScroll.json"); -const widgetsPage = require("../../../../../locators/Widgets.json"); describe("Modal Widget Functionality", function() { before(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Statbox_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Statbox_spec.js index 87a20f0d6d1e..879a282d55c7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Statbox_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Statbox_spec.js @@ -2,9 +2,16 @@ const dsl = require("../../../../../fixtures/StatboxDsl.json"); const explorer = require("../../../../../locators/explorerlocators.json"); const data = require("../../../../../fixtures/example.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; describe("Statbox Widget Functionality", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Video_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Video_spec.js index 79bc09ee20eb..b7e456bcd0b4 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Video_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Others/Video_spec.js @@ -1,8 +1,6 @@ const widgetsPage = require("../../../../../locators/Widgets.json"); const commonlocators = require("../../../../../locators/commonlocators.json"); -const publish = require("../../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../../fixtures/videoWidgetDsl.json"); -const pages = require("../../../../../locators/Pages.json"); const testdata = require("../../../../../fixtures/testdata.json"); describe("Video Widget Functionality", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/PhoneInput/PhoneInputDynamicValue_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/PhoneInput/PhoneInputDynamicValue_spec.js index d78dd2173991..8c45d863b331 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/PhoneInput/PhoneInputDynamicValue_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/PhoneInput/PhoneInputDynamicValue_spec.js @@ -7,7 +7,6 @@ describe("Phone input widget - ", () => { before(() => { cy.addDsl(dynamicDSL); }); - it("1. Should show empty dropdown for a typo", () => { cy.openPropertyPane(widgetName); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_MultiRowSelect_dataUpdation_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_MultiRowSelect_dataUpdation_spec.js index bd702e997556..33aeb365be1e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_MultiRowSelect_dataUpdation_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_MultiRowSelect_dataUpdation_spec.js @@ -1,7 +1,7 @@ const widgetsPage = require("../../../../../locators/Widgets.json"); const dsl = require("../../../../../fixtures/multiSelectedRowUpdationDsl.json"); -/* +/* Selected row stays selected after data updation if the primary column value isn't updated. */ diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Switch_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Switch_spec.js index b844d9dca81e..14d85b6031c6 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Switch_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Switch_spec.js @@ -1,9 +1,5 @@ /* eslint-disable cypress/no-unnecessary-waiting */ -const widgetsPage = require("../../../../../locators/Widgets.json"); -const commonlocators = require("../../../../../locators/commonlocators.json"); -const publish = require("../../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../../fixtures/swtchTableDsl.json"); -const explorer = require("../../../../../locators/explorerlocators.json"); describe("Table Widget and Switch binding Functionality", function() { before(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Copy_Paste_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Copy_Paste_spec.js index bc2263d37138..19c5bb52932f 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Copy_Paste_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Copy_Paste_spec.js @@ -3,11 +3,11 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); const dsl = require("../../../../../fixtures/tableNewDsl.json"); -before(() => { - cy.addDsl(dsl); -}); - describe("Test Suite to validate copy/paste table Widget", function() { + before(() => { + cy.addDsl(dsl); + }); + it("Copy paste table widget and valdiate application status", function() { const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl"; cy.openPropertyPane("tablewidget"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Default_Row_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Default_Row_spec.js index cee86a8c9ecf..13e0512ccc23 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Default_Row_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Default_Row_spec.js @@ -1,4 +1,3 @@ -const widgetsPage = require("../../../../../locators/Widgets.json"); const dsl = require("../../../../../fixtures/defaultTableDsl.json"); describe("Table Widget property pane deafult feature validation", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Derived_Column_Computed_value_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Derived_Column_Computed_value_spec.js index e857d2047dab..4aefb60f1de0 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Derived_Column_Computed_value_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV1/Table_Widget_Derived_Column_Computed_value_spec.js @@ -1,8 +1,4 @@ -const widgetsPage = require("../../../../../locators/Widgets.json"); -const commonlocators = require("../../../../../locators/commonlocators.json"); -const publish = require("../../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../../fixtures/tableNewDsl.json"); -const pages = require("../../../../../locators/Pages.json"); const testdata = require("../../../../../fixtures/testdata.json"); describe("Table Widget property pane feature validation", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Edge_case_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Edge_case_spec.js index 9041376ed06b..ddd51b7e5c1e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Edge_case_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Edge_case_spec.js @@ -1,9 +1,16 @@ const dsl = require("../../../../../fixtures/tableV2WithTextWidgetDsl.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); const commonlocators = require("../../../../../locators/commonlocators.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; describe("Table widget v2 edge case scenario testing", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Inline_editing_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Inline_editing_spec.js index a2d01b033fd9..ba7a0a0c5537 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Inline_editing_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Inline_editing_spec.js @@ -2,11 +2,15 @@ const dsl = require("../../../../../fixtures/Table/InlineEditingDSL.json"); const commonlocators = require("../../../../../locators/commonlocators.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; - const agHelper = ObjectsRegistry.AggregateHelper; describe("Table widget inline editing functionality", () => { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); @@ -666,14 +670,9 @@ describe("Table widget inline editing functionality", () => { expect(text).to.equal("discarded!!"); }); }); -}); - -describe("Table widget inline editing functionality with Text wrapping functionality", () => { - beforeEach(() => { - cy.addDsl(dsl); - }); it("22. should check that inline editing works with text wrapping disabled", () => { + cy.addDsl(dsl); cy.openPropertyPane("tablewidgetv2"); cy.makeColumnEditable("step"); cy.editTableCell(0, 0); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Color_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Color_spec.js index e552193b610d..7a2b3673f0a6 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Color_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Color_spec.js @@ -4,8 +4,17 @@ let propPane = ObjectsRegistry.PropertyPane; const widgetsPage = require("../../../../../locators/Widgets.json"); const dsl = require("../../../../../fixtures/tableV2NewDsl.json"); const publish = require("../../../../../locators/publishWidgetspage.json"); +let agHelper = ObjectsRegistry.AggregateHelper; describe("Table Widget V2 property pane feature validation", function() { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Column_Order_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Column_Order_spec.js index d82c4ff4ef4e..8db569ca9544 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Column_Order_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Column_Order_spec.js @@ -1,6 +1,5 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const dsl = require("../../../../../fixtures/tableV2ColumnOrderDsl.json"); -const widgetsPage = require("../../../../../locators/Widgets.json"); describe("Table Widget V2 column order maintained on column change validation", function() { before(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Column_Resize_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Column_Resize_spec.js index 32255645b6ed..310594bb86af 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Column_Resize_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Column_Resize_spec.js @@ -1,7 +1,4 @@ /* eslint-disable cypress/no-unnecessary-waiting */ -const widgetsPage = require("../../../../../locators/Widgets.json"); -const commonlocators = require("../../../../../locators/commonlocators.json"); -const publish = require("../../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../../fixtures/tableV2ResizedColumnsDsl.json"); describe("Table Widget V2 Functionality with Hidden and Resized Columns", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_MultiRowSelect_dataUpdation_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_MultiRowSelect_dataUpdation_spec.js index a70d0ed5f13a..d57dbc72d2a2 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_MultiRowSelect_dataUpdation_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_MultiRowSelect_dataUpdation_spec.js @@ -1,7 +1,7 @@ const widgetsPage = require("../../../../../locators/Widgets.json"); const dsl = require("../../../../../fixtures/multiSelectedRowUpdationTableV2Dsl.json"); -/* +/* Selected row stays selected after data updation if the primary column value isn't updated. */ diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Widget_Copy_Paste_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Widget_Copy_Paste_spec.js index c853204a511f..306b7b17d711 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Widget_Copy_Paste_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/TableV2_Widget_Copy_Paste_spec.js @@ -3,11 +3,10 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); const widgetsPage = require("../../../../../locators/Widgets.json"); const dsl = require("../../../../../fixtures/tableV2NewDsl.json"); -before(() => { - cy.addDsl(dsl); -}); - describe("Test Suite to validate copy/paste table Widget V2", function() { + before(() => { + cy.addDsl(dsl); + }); it("1. Copy paste table widget and valdiate application status", function() { const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl"; cy.openPropertyPane("tablewidgetv2"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Text_wrapping_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Text_wrapping_spec.js index 24b45259b858..14abeff5042c 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Text_wrapping_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/Text_wrapping_spec.js @@ -1,8 +1,15 @@ const dsl = require("../../../../../fixtures/Table/TextWrappingDSL.json"); const commonlocators = require("../../../../../locators/commonlocators.json"); +import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; +const agHelper = ObjectsRegistry.AggregateHelper; describe("Table Widget text wrapping functionality", function() { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/inline_editing_validations_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/inline_editing_validations_spec.js index 9e4c09b906ae..d8a2ca788224 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/inline_editing_validations_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableV2/inline_editing_validations_spec.js @@ -4,9 +4,15 @@ const widgetsPage = require("../../../../../locators/Widgets.json"); import { ObjectsRegistry } from "../../../../../support/Objects/Registry"; const propPane = ObjectsRegistry.PropertyPane; +const agHelper = ObjectsRegistry.AggregateHelper; describe("Table widget inline editing validation functionality", () => { + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Workspace/WorkspaceImportApplication_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Workspace/WorkspaceImportApplication_spec.js index 11c95830d661..e1460747dcf3 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Workspace/WorkspaceImportApplication_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Workspace/WorkspaceImportApplication_spec.js @@ -8,7 +8,6 @@ describe("Workspace Import Application", function() { before(() => { cy.addDsl(dsl); - cy.wait(5000); }); it("Can Import Application from json", function() { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Bugs_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Bugs_Spec.js index e22d9946b96d..ab1d44336fe1 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Bugs_Spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Bugs_Spec.js @@ -1,7 +1,6 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const dslParallel = require("../../../../fixtures/apiParallelDsl.json"); const dslTable = require("../../../../fixtures/apiTableDsl.json"); -const pages = require("../../../../locators/Pages.json"); const testdata = require("../../../../fixtures/testdata.json"); import { ObjectsRegistry } from "../../../../support/Objects/Registry"; @@ -11,6 +10,14 @@ let apiPage = ObjectsRegistry.ApiPage, locator = ObjectsRegistry.CommonLocators; describe("Rest Bugs tests", function() { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("Bug 5550: Not able to run APIs in parallel", function() { cy.addDsl(dslParallel); cy.wait(8000); //settling time for dsl! diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Edit_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Edit_spec.js index 1d22167ed6b5..78341c59de5f 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Edit_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Edit_spec.js @@ -1,6 +1,5 @@ const testdata = require("../../../../fixtures/testdata.json"); const apiwidget = require("../../../../locators/apiWidgetslocator.json"); -const commonlocators = require("../../../../locators/commonlocators.json"); const dsl = require("../../../../fixtures/uiBindDsl.json"); const explorer = require("../../../../locators/explorerlocators.json"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_MultiPart_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_MultiPart_Spec.ts index 842f758da8ea..1a15d1f10a87 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_MultiPart_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_MultiPart_Spec.ts @@ -1,5 +1,4 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - let agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, jsEditor = ObjectsRegistry.JSEditor, @@ -9,6 +8,15 @@ let agHelper = ObjectsRegistry.AggregateHelper, propPane = ObjectsRegistry.PropertyPane; describe("Validate API request body panel", () => { + + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + it("1. Check whether input and type dropdown selector exist when multi-part is selected", () => { apiPage.CreateApi("FirstAPI", "POST"); apiPage.SelectPaneTab("Body"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Mustache_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Mustache_spec.js index 4674ad80fa4b..2aa66867cc55 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Mustache_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_Mustache_spec.js @@ -3,7 +3,6 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const dsl = require("../../../../fixtures/commondsl.json"); const widgetsPage = require("../../../../locators/Widgets.json"); const testdata = require("../../../../fixtures/testdata.json"); -const pages = require("../../../../locators/Pages.json"); describe("Moustache test Functionality", function() { beforeEach(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLNoiseTest_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLNoiseTest_spec.js index 93d458b224ef..7479016c4a12 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLNoiseTest_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLNoiseTest_spec.js @@ -2,8 +2,10 @@ const queryLocators = require("../../../../locators/QueryEditor.json"); const datasourceEditor = require("../../../../locators/DatasourcesEditor.json"); const dsl = require("../../../../fixtures/noiseDsl.json"); const commonlocators = require("../../../../locators/commonlocators.json"); + describe("MySQL noise test", function() { let datasourceName; + beforeEach(() => { cy.addDsl(dsl); cy.startRoutesForDatasource(); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad1_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad1_Spec.ts index b3f6228b8190..14099ee7368d 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad1_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad1_Spec.ts @@ -1,5 +1,4 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - let dsName: any, jsName: any; const agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, @@ -13,6 +12,14 @@ const agHelper = ObjectsRegistry.AggregateHelper, propPane = ObjectsRegistry.PropertyPane; describe("JSObjects OnLoad Actions tests", function() { + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + before(() => { cy.fixture("tablev1NewDsl").then((val: any) => { agHelper.AddDsl(val); 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 111a512f5f3a..41ed0776ee68 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 @@ -18,7 +18,7 @@ let queryName; Cyclic Depedency Error if occurs, Message would be shown in following 6 cases: 1. On page load actions 2. When updating DSL attribute -3. When updating JS Object name +3. When updating JS Object name 4. When updating Js Object content 5. When updating DSL name 6. When updating Datasource query @@ -26,6 +26,8 @@ Cyclic Depedency Error if occurs, Message would be shown in following 6 cases: describe("Cyclic Dependency Informational Error Messagaes", function() { before(() => { + //appId = localStorage.getItem("applicationId"); + //cy.log("appID:" + appId); cy.addDsl(dsl); cy.wait(3000); //dsl to settle! }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts index 86addcb24d6f..b1f1c014df45 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts @@ -1,6 +1,4 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - -let dsl: any; const agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, apiPage = ObjectsRegistry.ApiPage, @@ -9,14 +7,18 @@ const agHelper = ObjectsRegistry.AggregateHelper, deployMode = ObjectsRegistry.DeployMode; describe("Layout OnLoad Actions tests", function() { - before(() => { - cy.fixture("onPageLoadActionsDsl").then((val: any) => { - agHelper.AddDsl(val); - dsl = val; - }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); }); it("1. Bug 8595: OnPageLoad execution - when No api to run on Pageload", function() { + cy.fixture("onPageLoadActionsDsl").then((val: any) => { + agHelper.AddDsl(val); + }); ee.SelectEntityByName("Widgets"); ee.SelectEntityByName("Page1"); cy.url().then((url) => { @@ -35,7 +37,9 @@ describe("Layout OnLoad Actions tests", function() { }); it("2. Bug 8595: OnPageLoad execution - when Query Parmas added via Params tab", function() { - agHelper.AddDsl(dsl, locator._imageWidget); + cy.fixture("onPageLoadActionsDsl").then((val: any) => { + agHelper.AddDsl(val, locator._imageWidget); + }); apiPage.CreateAndFillApi( "https://source.unsplash.com/collection/1599413", "RandomFlora", @@ -133,23 +137,25 @@ describe("Layout OnLoad Actions tests", function() { cy.wait("@viewPage").then(($response) => { const respBody = JSON.stringify($response.response?.body); - const _randomFlora = JSON.parse(respBody).data.layouts[0] + const _random = JSON.parse(respBody).data.layouts[0] .layoutOnLoadActions[0]; - const _randomUser = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[1]; + // const _randomFlora = JSON.parse(respBody).data.layouts[0] + // .layoutOnLoadActions[1]; const _genderize = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[2]; + .layoutOnLoadActions[1]; const _suggestions = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[3]; + .layoutOnLoadActions[2]; // cy.log("_randomFlora is: " + JSON.stringify(_randomFlora)) // cy.log("_randomUser is: " + JSON.stringify(_randomUser)) // cy.log("_genderize is: " + JSON.stringify(_genderize)) // cy.log("_suggestions is: " + JSON.stringify(_suggestions)) - expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq( + expect(JSON.parse(JSON.stringify(_random))[0]["name"]).to.eq( + "RandomUser", "RandomFlora", ); - expect(JSON.parse(JSON.stringify(_randomUser))[0]["name"]).to.eq( + expect(JSON.parse(JSON.stringify(_random))[1]["name"]).to.eq( + "RandomFlora", "RandomUser", ); expect(JSON.parse(JSON.stringify(_genderize))[0]["name"]).to.be.oneOf([ @@ -174,7 +180,8 @@ describe("Layout OnLoad Actions tests", function() { apiPage.CreateAndFillApi( "https://api.genderize.io?name={{RandomUser.data.results[0].name.first}}", - "Genderize", 30000 + "Genderize", + 30000, ); apiPage.ValidateQueryParams({ key: "name", @@ -185,19 +192,19 @@ describe("Layout OnLoad Actions tests", function() { agHelper.Sleep(5000); //for all api's to ccomplete call! cy.wait("@viewPage").then(($response) => { const respBody = JSON.stringify($response.response?.body); - const _randomFlora = JSON.parse(respBody).data.layouts[0] + const _random = JSON.parse(respBody).data.layouts[0] .layoutOnLoadActions[0]; - const _randomUser = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[1]; const _genderize = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[2]; + .layoutOnLoadActions[1]; const _suggestions = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[3]; + .layoutOnLoadActions[2]; - expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq( + expect(JSON.parse(JSON.stringify(_random))[0]["name"]).to.eq( + "RandomUser", "RandomFlora", ); - expect(JSON.parse(JSON.stringify(_randomUser))[0]["name"]).to.eq( + expect(JSON.parse(JSON.stringify(_random))[1]["name"]).to.eq( + "RandomFlora", "RandomUser", ); expect(JSON.parse(JSON.stringify(_genderize))[0]["name"]).to.be.oneOf([ diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Postgres_DataTypes/Json_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Postgres_DataTypes/Json_Spec.ts index ef62cb1308d2..979ecfc0e2bd 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Postgres_DataTypes/Json_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Postgres_DataTypes/Json_Spec.ts @@ -17,6 +17,14 @@ describe("Json & JsonB Datatype tests", function() { }); }); + beforeEach(() => { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + //#region Json Datatype it("0. Importing App & setting theme", () => { @@ -35,7 +43,7 @@ describe("Json & JsonB Datatype tests", function() { agHelper.RenameWithInPane("createTable"); dataSources.EnterQuery(query); dataSources.RunQuery(); - + ee.SelectEntityByName(dsName, "Datasources"); ee.ActionContextMenuByEntityName(dsName, "Refresh"); agHelper.AssertElementVisible(ee._entityNameInExplorer("public.jsonbooks")); }); @@ -368,6 +376,7 @@ describe("Json & JsonB Datatype tests", function() { dataSources.EnterQuery(query); dataSources.RunQuery(); + ee.SelectEntityByName(dsName, "Datasources"); ee.ActionContextMenuByEntityName(dsName, "Refresh"); agHelper.AssertElementVisible( ee._entityNameInExplorer("public.jsonBbooks"), diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_2_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_2_spec.js index 664ac7ab57ce..8a1868797c1d 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_2_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_2_spec.js @@ -6,14 +6,22 @@ const generatePage = require("../../../../locators/GeneratePage.json"); const dsl = require("../../../../fixtures/snippingTableDsl.json"); const commonlocators = require("../../../../locators/commonlocators.json"); const formControls = require("../../../../locators/FormControl.json"); +import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +let agHelper = ObjectsRegistry.AggregateHelper, + ee = ObjectsRegistry.EntityExplorer; let datasourceName; describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", function() { beforeEach(() => { + agHelper.RestoreLocalStorageCache(); cy.startRoutesForDatasource(); }); + afterEach(() => { + agHelper.SaveLocalStorageCache(); + }); + // afterEach(function() { // if (this.currentTest.state === "failed") { // Cypress.runner.stop(); @@ -198,45 +206,35 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", "assets-test.appsmith.com", formControls.s3BucketName, ); - cy.getEntityName().then((entity) => { - cy.wrap(entity).as("entity"); - }); + // cy.getEntityName().then((entity) => { + // cy.wrap(entity).as("entity"); + // }); cy.runQuery(); cy.xpath(queryLocators.suggestedWidgetDropdown) .click() .wait(1000); cy.get(".t--draggable-selectwidget").validateWidgetExists(); - cy.get("@entity").then((entityN) => cy.selectEntityByName(entityN)); + ee.SelectEntityByName("Query1", "Queries/JS"); + //cy.get("@entity").then((entityN) => cy.selectEntityByName(entityN)); cy.get(queryLocators.suggestedTableWidget) .click() .wait(1000); cy.get(commonlocators.TableV2Row).validateWidgetExists(); - cy.get("@entity").then((entityN) => cy.selectEntityByName(entityN)); + ee.SelectEntityByName("Query1", "Queries/JS"); cy.xpath(queryLocators.suggestedWidgetText) .click() .wait(1000); cy.get(commonlocators.textWidget).validateWidgetExists(); - cy.get("@entity").then((entityN) => cy.selectEntityByName(entityN)); - cy.deleteQueryUsingContext(); //exeute actions & 200 response is verified in this method + ee.SelectEntityByName("Query1", "Queries/JS"); }); it("4. Verify 'Connect Widget [snipping]' functionality - S3 ", () => { cy.addDsl(dsl); - cy.NavigateToActiveDSQueryPane(datasourceName); - cy.getEntityName().then((entity) => { - cy.wrap(entity).as("entity"); - }); - cy.ValidateAndSelectDropdownOption( - formControls.commandDropdown, - "List files in bucket", - ); - cy.typeValueNValidate( - "assets-test.appsmith.com", - formControls.s3BucketName, - ); + cy.wait(3000); //dsl to settle! cy.NavigateToActiveDSQueryPane(datasourceName); + ee.SelectEntityByName("Query1", "Queries/JS"); cy.runQuery(); cy.clickButton("Select Widget"); cy.xpath(queryLocators.snipeableTable) @@ -244,11 +242,7 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", .wait(1500); //wait for table to load! cy.get(commonlocators.TableRow).validateWidgetExists(); - cy.CheckAndUnfoldEntityItem("Queries/JS"); - cy.get("@entity").then((entityN) => { - cy.log(entityN); - cy.selectEntityByName(entityN); - }); + ee.SelectEntityByName("Query1", "Queries/JS"); cy.deleteQueryUsingContext(); //exeute actions & 200 response is verified in this method cy.CheckAndUnfoldEntityItem("Widgets"); cy.actionContextMenuByEntityName("Table1"); diff --git a/app/client/cypress/manual_TestSuite/CommentedScriptFiles/Table_Duplicate_ColumnName_spec.js b/app/client/cypress/manual_TestSuite/CommentedScriptFiles/Table_Duplicate_ColumnName_spec.js index 164700dfc53f..bead70e9a649 100644 --- a/app/client/cypress/manual_TestSuite/CommentedScriptFiles/Table_Duplicate_ColumnName_spec.js +++ b/app/client/cypress/manual_TestSuite/CommentedScriptFiles/Table_Duplicate_ColumnName_spec.js @@ -1,6 +1,4 @@ -const widgetsPage = require("../../locators/Widgets.json"); const dsl = require("../../fixtures/tableNewDsl.json"); -const commonlocators = require("../../locators/commonlocators.json"); describe("prevent duplicate column name in table", function() { before(() => { diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts index 9d5ec0876845..f8b4a13baf44 100644 --- a/app/client/cypress/support/Pages/AggregateHelper.ts +++ b/app/client/cypress/support/Pages/AggregateHelper.ts @@ -60,8 +60,8 @@ export class AggregateHelper { dsl: string, elementToCheckPresenceaftDslLoad: string | "" = "", ) { - let pageid: string; - let layoutId; + let pageid: string, layoutId, appId: string | null; + appId = localStorage.getItem("applicationId"); cy.url().then((url) => { pageid = url .split("/")[5] @@ -75,7 +75,7 @@ export class AggregateHelper { // Dumping the DSL to the created page cy.request( "PUT", - "api/v1/layouts/" + layoutId + "/pages/" + pageid, + "api/v1/layouts/" + layoutId + "/pages/" + pageid + "?applicationId=" + appId, dsl, ).then((dslDumpResp) => { //cy.log("Pages resposne is : " + dslDumpResp.body); diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index eb762bbe9a12..a07f06911990 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -577,9 +577,8 @@ Cypress.Commands.add("generateUUID", () => { }); Cypress.Commands.add("addDsl", (dsl) => { - let currentURL; - let pageid; - let layoutId; + let currentURL, pageid, layoutId, appId; + appId = localStorage.getItem("applicationId"); cy.url().then((url) => { currentURL = url; pageid = currentURL @@ -588,14 +587,21 @@ Cypress.Commands.add("addDsl", (dsl) => { .pop(); cy.log(pageidcopy + "page id copy"); cy.log(pageid + "page id"); + appId = localStorage.getItem("applicationId"); //Fetch the layout id cy.request("GET", "api/v1/pages/" + pageid).then((response) => { const respBody = JSON.stringify(response.body); layoutId = JSON.parse(respBody).data.layouts[0].id; + cy.log("appid:" + appId); // Dumping the DSL to the created page cy.request( "PUT", - "api/v1/layouts/" + layoutId + "/pages/" + pageid, + "api/v1/layouts/" + + layoutId + + "/pages/" + + pageid + + "?applicationId=" + + appId, dsl, ).then((response) => { cy.log(response.body); diff --git a/app/client/src/api/PageApi.tsx b/app/client/src/api/PageApi.tsx index 5e5b1c2ec104..e386c3f252c7 100644 --- a/app/client/src/api/PageApi.tsx +++ b/app/client/src/api/PageApi.tsx @@ -27,6 +27,7 @@ export type SavePageRequest = { dsl: DSLWidget; layoutId: string; pageId: string; + applicationId: string; }; export type PageLayout = { @@ -147,8 +148,12 @@ class PageApi extends Api { static url = "v1/pages"; static refactorLayoutURL = "v1/layouts/refactor"; static pageUpdateCancelTokenSource?: CancelTokenSource = undefined; - static getLayoutUpdateURL = (pageId: string, layoutId: string) => { - return `v1/layouts/${layoutId}/pages/${pageId}`; + static getLayoutUpdateURL = ( + applicationId: string, + pageId: string, + layoutId: string, + ) => { + return `v1/layouts/${layoutId}/pages/${pageId}?applicationId=${applicationId}`; }; static getGenerateTemplateURL = (pageId?: string) => { @@ -183,6 +188,7 @@ class PageApi extends Api { PageApi.pageUpdateCancelTokenSource = axios.CancelToken.source(); return Api.put( PageApi.getLayoutUpdateURL( + savePageRequest.applicationId, savePageRequest.pageId, savePageRequest.layoutId, ), diff --git a/app/client/src/sagas/PageSagas.tsx b/app/client/src/sagas/PageSagas.tsx index f762b007a7c1..613a9e0c8941 100644 --- a/app/client/src/sagas/PageSagas.tsx +++ b/app/client/src/sagas/PageSagas.tsx @@ -36,6 +36,7 @@ import PageApi, { FetchPageResponse, FetchPublishedPageRequest, PageLayout, + SavePageRequest, SavePageResponse, SavePageResponseData, SetPageOrderRequest, @@ -383,12 +384,16 @@ function* savePageSaga(action: ReduxAction<{ isRetry?: boolean }>) { const widgets: CanvasWidgetsReduxState = yield select(getWidgets); const editorConfigs: | { + applicationId: string; pageId: string; layoutId: string; } | undefined = yield select(getEditorConfigs) as any; const guidedTourEnabled: boolean = yield select(inGuidedTour); - const savePageRequest = getLayoutSavePayload(widgets, editorConfigs); + const savePageRequest: SavePageRequest = getLayoutSavePayload( + widgets, + editorConfigs, + ); PerformanceTracker.startAsyncTracking( PerformanceTransactionName.SAVE_PAGE_API, { diff --git a/app/client/src/sagas/selectors.tsx b/app/client/src/sagas/selectors.tsx index ef3e52748d82..824db9f46190 100644 --- a/app/client/src/sagas/selectors.tsx +++ b/app/client/src/sagas/selectors.tsx @@ -56,11 +56,12 @@ export const getWidgetOptionsTree = createSelector(getWidgets, (widgets) => export const getEditorConfigs = ( state: AppState, -): { pageId: string; layoutId: string } | undefined => { +): { applicationId: string; pageId: string; layoutId: string } | undefined => { const pageId = state.entities.pageList.currentPageId; const layoutId = state.ui.editor.currentLayoutId; - if (!pageId || !layoutId) return undefined; - return { pageId, layoutId }; + const applicationId = state.ui.applications.currentApplication?.id; + if (!pageId || !layoutId || !applicationId) return undefined; + return { pageId, layoutId, applicationId }; }; export const getDefaultPageId = (state: AppState): string => diff --git a/app/rts/src/controllers/BaseController.ts b/app/rts/src/controllers/BaseController.ts index c02017d44c1c..f01904b0f885 100644 --- a/app/rts/src/controllers/BaseController.ts +++ b/app/rts/src/controllers/BaseController.ts @@ -24,7 +24,7 @@ export default class BaseController { serverErrorMessaage = "Something went wrong"; sendResponse( response: Response, - result: unknown, + result?: unknown, message?: string, code: number = StatusCodes.OK ): Response<ResponseData> { diff --git a/app/rts/src/controllers/healthCheck/HealthCheckController.ts b/app/rts/src/controllers/healthCheck/HealthCheckController.ts new file mode 100644 index 000000000000..bcc905a72a2b --- /dev/null +++ b/app/rts/src/controllers/healthCheck/HealthCheckController.ts @@ -0,0 +1,23 @@ +import { Response, Request } from "express"; +import { StatusCodes } from "http-status-codes"; + +import BaseController from "@controllers/BaseController"; + +export default class HealthCheckController extends BaseController { + constructor() { + super(); + } + + async performHealthCheck(req: Request, res: Response) { + try { + return super.sendResponse(res); + } catch (err) { + return super.sendError( + res, + super.serverErrorMessaage, + [err.message], + StatusCodes.INTERNAL_SERVER_ERROR + ); + } + } +} diff --git a/app/rts/src/routes/health_check_routes.ts b/app/rts/src/routes/health_check_routes.ts new file mode 100644 index 000000000000..2bd7eda3b92e --- /dev/null +++ b/app/rts/src/routes/health_check_routes.ts @@ -0,0 +1,15 @@ +import express from "express"; +import HealthCheckController from "@controllers/healthCheck/HealthCheckController"; +import { Validator } from "@middlewares/Validator"; + +const router = express.Router(); +const healthCheckController = new HealthCheckController(); +const validator = new Validator(); + +router.get( + "/health-check", + validator.validateRequest, + healthCheckController.performHealthCheck +); + +export default router; diff --git a/app/rts/src/server.ts b/app/rts/src/server.ts index 778d516d662a..28a6966e32b4 100644 --- a/app/rts/src/server.ts +++ b/app/rts/src/server.ts @@ -8,6 +8,7 @@ import { initializeSockets } from "./sockets"; // routes import ast_routes from "./routes/ast_routes"; +import health_check_routes from "./routes/health_check_routes"; const RTS_BASE_PATH = "/rts"; export const RTS_BASE_API_PATH = "/rts-api/v1"; @@ -56,6 +57,7 @@ app.get("/", (_, res) => { }); app.use(`${RTS_BASE_API_PATH}/ast`, ast_routes); +app.use(`${RTS_BASE_API_PATH}`, health_check_routes); // Run the server server.listen(PORT, () => { diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/MustacheHelper.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/MustacheHelper.java index 871b579b9935..c0be714e4b53 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/MustacheHelper.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/MustacheHelper.java @@ -1,13 +1,17 @@ package com.appsmith.external.helpers; import com.appsmith.external.models.ActionConfiguration; -import com.appsmith.external.models.DynamicBinding; +import com.appsmith.external.models.EntityDependencyNode; +import com.appsmith.external.models.EntityReferenceType; import lombok.extern.slf4j.Slf4j; import org.apache.commons.text.StringEscapeUtils; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeansException; import org.springframework.beans.PropertyAccessorFactory; import org.springframework.util.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.util.function.Tuple2; import java.beans.PropertyDescriptor; import java.util.ArrayList; @@ -42,21 +46,29 @@ public class MustacheHelper { * Appsmith smart replacement : The regex pattern below looks for '?' or "?". This pattern is later replaced with ? * to fit the requirements of prepared statements. */ - private static String regexQuotesTrimming = "([\"']\\?[\"'])"; - private static Pattern quoteQuestionPattern = Pattern.compile(regexQuotesTrimming); + private static final String regexQuotesTrimming = "([\"']\\?[\"'])"; + private static final Pattern quoteQuestionPattern = Pattern.compile(regexQuotesTrimming); // The final replacement string of ? for replacing '?' or "?" - private static String postQuoteTrimmingQuestionMark = "\\?"; + private static final String postQuoteTrimmingQuestionMark = "\\?"; /** * Appsmith smart replacement with placeholder : The regex pattern below looks for `APPSMITH_SUBSTITUTION_PLACEHOLDER` * surrounded by quotes. This pattern is later replaced with just APPSMITH_SUBSTITUTION_PLACEHOLDER to fit the requirements * of JSON smart replacement aka trim the quotes present. */ - private static String regexPlaceholderTrimming = "([\"']" + APPSMITH_SUBSTITUTION_PLACEHOLDER + "[\"'])"; - private static Pattern placeholderTrimmingPattern = Pattern.compile(regexPlaceholderTrimming); + private static final String regexPlaceholderTrimming = "([\"']" + APPSMITH_SUBSTITUTION_PLACEHOLDER + "[\"'])"; + private static final Pattern placeholderTrimmingPattern = Pattern.compile(regexPlaceholderTrimming); - private static String laxMustacheBindingRegex = "\\{\\{([\\s\\S]*?)\\}\\}"; - private static Pattern laxMustacheBindingPattern = Pattern.compile(laxMustacheBindingRegex); + private static final String laxMustacheBindingRegex = "\\{\\{([\\s\\S]*?)}}"; + private static final Pattern laxMustacheBindingPattern = Pattern.compile(laxMustacheBindingRegex); + + + private static final Pattern nestedPathTokenSplitter = Pattern.compile("\\[.*\\]\\.?|\\."); + + // Possible types of entity references that we want to be filtering + // from the global identifiers found in a dynamic binding + public static final int ACTION_ENTITY_REFERENCES = 0b01; + public static final int WIDGET_ENTITY_REFERENCES = 0b10; /** @@ -68,7 +80,7 @@ public class MustacheHelper { * text and the others are mustache interpolations. */ public static List<String> tokenize(String template) { - if (StringUtils.isEmpty(template)) { + if (!StringUtils.hasLength(template)) { return Collections.emptyList(); } @@ -77,7 +89,7 @@ public static List<String> tokenize(String template) { int length = template.length(); // Following are state variables for the parser. - // This indicates the state of the pointer. It is `true` when inside mustache double braces. Otherwise `false`. + // This indicates the state of the pointer. It is `true` when inside mustache double braces, otherwise `false`. boolean isInsideMustache = false; // This is set to the quote character of a string in JS. When `null`, it means we're not inside any Javascript @@ -93,7 +105,7 @@ public static List<String> tokenize(String template) { // There's majorly two states for the parser, plain-text-mode and mustache-mode, with the current state // indicated by `isInsideMustache`. This is set to `true` when the pointer encounters a `{{` in plain-text-mode. // It is set back to `false` when the pointer encounters a `}}` in mustache-mode, but not inside a quoted - // string. Since the contents inside mustache double-braces is supposed to be valid Javascript expression, any + // string. Since the contents inside mustache double-braces is supposed to be valid Javascript expression, // any braces inside quoted strings (using single, double or back quotes) should not affect the // `isInsideMustache` state. for (int i = 1; i < length; ++i) { @@ -258,7 +270,7 @@ private static void clearAndPushToken(StringBuilder tokenBuilder, List<String> t */ public static <T> T renderFieldValues(T object, Map<String, String> context) { if (object == null) { - return object; + return null; } if (isDomainModel(object.getClass())) { @@ -278,7 +290,7 @@ public static <T> T renderFieldValues(T object, Map<String, String> context) { log.error("Exception caught while substituting values in mustache template.", e); } } else if (object instanceof List) { - List renderedList = new ArrayList(); + List renderedList = new ArrayList<>(); for (Object childValue : (List) object) { renderedList.add(renderFieldValues(childValue, context)); } @@ -286,10 +298,9 @@ public static <T> T renderFieldValues(T object, Map<String, String> context) { return (T) renderedList; } else if (object instanceof Map) { - Map renderedMap = new HashMap(); + Map renderedMap = new HashMap<>(); for (Object entry : ((Map) object).entrySet()) { - renderedMap.put( - ((Map.Entry) entry).getKey(), // key + renderedMap.put(((Map.Entry) entry).getKey(), // key renderFieldValues(((Map.Entry) entry).getValue(), context) // value ); } @@ -322,21 +333,149 @@ public static String render(String template, Map<String, String> keyValueMap) { return StringEscapeUtils.unescapeHtml4(rendered.toString()); } - public static void extractActionNamesAndAddValidActionBindingsToSet(Map<String, DynamicBinding> bindingNames, String mustacheKey) { + /** + * Depending on the entity types that the caller has asked for, this method analyzed the global references found in each binding + * and creates entity dependency nodes out of the references that would qualify as a reference of a specific entity type + * + * @param bindingAndPossibleReferencesFlux + * @param types + * @return + */ + public static Mono<Map<String, Set<EntityDependencyNode>>> getPossibleEntityParentsMap(Flux<Tuple2<String, Set<String>>> bindingAndPossibleReferencesFlux, int types) { + + return bindingAndPossibleReferencesFlux.collect(HashMap::new, (map, tuple) -> { + String bindingValue = tuple.getT1(); + HashSet<EntityDependencyNode> totalParents = new HashSet<>(); + tuple.getT2().forEach(reference -> { + if ((types & ACTION_ENTITY_REFERENCES) == ACTION_ENTITY_REFERENCES) { + totalParents.addAll(MustacheHelper.getPossibleActions(reference)); + } + if ((types & WIDGET_ENTITY_REFERENCES) == WIDGET_ENTITY_REFERENCES) { + totalParents.addAll(MustacheHelper.getPossibleWidgets(reference)); + } + }); + map.put(bindingValue, totalParents); + }); + } + + /** + * Given a global reference, this method returns any possible combinations of widgets + * that could be derived out of the reference string. The rules for this are as follows: + * 1) Irrespective of whether the reference string has a dot notation reference, as long as it is not empty, + * pick the first word in the string as a possible widget reference. + * Eg: Text1 which could be derived from {{ Text1 }} + * Eg: Text1 which could be derived from {{ Text1.text }} + * <p> + * Please note that we do not filter out any invalid references at this point, + * because we do not have context of the global namespace here. + * + * @param reference The string reference computed by AST logic. + * @return A set of all possible widget dependencies that could exist in the given reference + */ + public static Set<EntityDependencyNode> getPossibleWidgets(String reference) { + Set<EntityDependencyNode> dependencyNodes = new HashSet<>(); + String key = reference.trim(); + + String[] subStrings = nestedPathTokenSplitter.split(key); + + if (subStrings.length < 1) { + return dependencyNodes; + } else { + EntityDependencyNode entityDependencyNode = new EntityDependencyNode(EntityReferenceType.WIDGET, subStrings[0], reference, null, null, null); + dependencyNodes.add(entityDependencyNode); + } + + return dependencyNodes; + } + + /** + * Given a global reference, this method returns any possible combinations of actions or JS actions + * that could be derived out of the reference string. The rules for this are as follows: + * 1) If the reference string has exactly one dot notation reference in its path, it could be a sync JS function call + * Eg: JsObject1.syncJsFunc which could be derived from {{ JsObject1.syncJsFunc() }} + * If the reference string has more than one dot notation reference in its path, it could either be - + * 2) An action reference where the data from the actions is consumed using the .data reference + * Eg: Action1.data.users which could be derived from {{ Action1.data.users }} + * 3) An asynchronous JS function that is being made to run on page load using its fully qualified name followed by + * the .data reference + * Eg: JsObject2.asyncJsFunc.data which could be derived from {{ JsObject2.asyncFunc.data }} + * <p> + * Please note that we do not filter out any invalid references at this point, + * because we do not have context of the global namespace here. + * + * @param reference The string reference computed by AST logic + * @return A set of all possible action or JS function dependencies that could exist in the given reference + */ + public static Set<EntityDependencyNode> getPossibleActions(String reference) { + Set<EntityDependencyNode> dependencyNodes = new HashSet<>(); + String key = reference.trim(); + + + String[] subStrings = nestedPathTokenSplitter.split(key); + + if (subStrings.length < 1) { + return dependencyNodes; + } + + if (subStrings.length == 2) { + // This could qualify if it is a sync JS function call, even if it is called `JsObject1.data()` + // For sync JS actions, the entire reference could be a function call + EntityDependencyNode entityDependencyNode = new EntityDependencyNode(EntityReferenceType.JSACTION, key, reference, false, true, null); + dependencyNodes.add(entityDependencyNode); + if ("data".equals(subStrings[1])) { + // This means it is a valid API/query reference + // For queries and APIs, the first word is the action name + EntityDependencyNode actionEntityDependencyNode = new EntityDependencyNode(EntityReferenceType.ACTION, subStrings[0], reference, false, false, null); + dependencyNodes.add(actionEntityDependencyNode); + } + } else if (subStrings.length > 2) { + if ("data".equals(subStrings[1])) { + // This means it is a valid API/query reference + // For queries and APIs, the first word is the action name + EntityDependencyNode actionEntityDependencyNode = new EntityDependencyNode(EntityReferenceType.ACTION, subStrings[0], reference, false, false, null); + dependencyNodes.add(actionEntityDependencyNode); + } + if ("data".equals(subStrings[2])) { + // For JS actions, the first two words are the action name since action name consists of + // the collection name and the individual action name + // We don't know if this is a run for sync or async JS action at this point, + // since both would be valid + EntityDependencyNode entityDependencyNode = new EntityDependencyNode(EntityReferenceType.JSACTION, subStrings[0] + "." + subStrings[1], reference, null, false, null); + dependencyNodes.add(entityDependencyNode); + } + } + return dependencyNodes; + } + + /** + * This method is used as a fallback for setups where the RTS server is not accessible. + * It counts all words as possible entity references. This is obviously going to + * continue to give inaccurate results, but is required to maintain backward compatibility + * + * @param mustacheKey The mustache binding to find references from + * @return A set of identified references from the mustache binding value + */ + public static Set<String> getPossibleParentsOld(String mustacheKey) { + Set<String> bindingNames = new HashSet<>(); String key = mustacheKey.trim(); - /* Extract all action names in the dynamic bindings */ + + // Extract all the words in the dynamic bindings Matcher matcher = pattern.matcher(key); + while (matcher.find()) { - // For each match, check what combination of action bindings could be calculated - bindingNames.putAll(DynamicBinding.create(matcher.group())); + String word = matcher.group(); + bindingNames.add(word); } + + return bindingNames; } public static Set<String> getPossibleParents(String mustacheKey) { Set<String> bindingNames = new HashSet<>(); String key = mustacheKey.trim(); + // Extract all the words in the dynamic bindings Matcher matcher = pattern.matcher(key); @@ -362,27 +501,25 @@ public static Set<String> getPossibleParents(String mustacheKey) { } public static String replaceMustacheWithPlaceholder(String query, List<String> mustacheBindings) { - return replaceMustacheUsingPatterns(query, APPSMITH_SUBSTITUTION_PLACEHOLDER, mustacheBindings, - placeholderTrimmingPattern, APPSMITH_SUBSTITUTION_PLACEHOLDER); + return replaceMustacheUsingPatterns(query, APPSMITH_SUBSTITUTION_PLACEHOLDER, mustacheBindings, placeholderTrimmingPattern, APPSMITH_SUBSTITUTION_PLACEHOLDER); } public static String replaceMustacheWithQuestionMark(String query, List<String> mustacheBindings) { - return replaceMustacheUsingPatterns(query, "?", mustacheBindings, - quoteQuestionPattern, postQuoteTrimmingQuestionMark); + return replaceMustacheUsingPatterns(query, "?", mustacheBindings, quoteQuestionPattern, postQuoteTrimmingQuestionMark); } - private static String replaceMustacheUsingPatterns(String query, String placeholder, List<String> mustacheBindings, - Pattern sanitizePattern, String replacement) { + private static String replaceMustacheUsingPatterns(String query, + String placeholder, + List<String> mustacheBindings, + Pattern sanitizePattern, + String replacement) { ActionConfiguration actionConfiguration = new ActionConfiguration(); actionConfiguration.setBody(query); - Set<String> mustacheSet = new HashSet<>(); - mustacheSet.addAll(mustacheBindings); + Set<String> mustacheSet = new HashSet<>(mustacheBindings); - Map<String, String> replaceParamsMap = mustacheSet - .stream() - .collect(Collectors.toMap(Function.identity(), v -> placeholder)); + Map<String, String> replaceParamsMap = mustacheSet.stream().collect(Collectors.toMap(Function.identity(), v -> placeholder)); // Replace the mustaches with the values mapped to each mustache in replaceParamsMap ActionConfiguration updatedActionConfiguration = renderFieldValues(actionConfiguration, replaceParamsMap); diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionConfiguration.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionConfiguration.java index 75c60cf1d366..d9cb81100667 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionConfiguration.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionConfiguration.java @@ -10,6 +10,7 @@ import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.http.HttpMethod; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -64,7 +65,7 @@ public class ActionConfiguration implements AppsmithDomain { * cyclic dependency errors. */ @Transient - Set<String> selfReferencingDataPaths; + Set<String> selfReferencingDataPaths = new HashSet<>(); // DB action fields diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionDTO.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionDTO.java similarity index 96% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionDTO.java rename to app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionDTO.java index 2a74cb8fe3ce..d7d8d6019091 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionDTO.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionDTO.java @@ -1,14 +1,14 @@ -package com.appsmith.server.dtos; +package com.appsmith.external.models; +import com.appsmith.external.exceptions.ErrorDTO; import com.appsmith.external.models.ActionConfiguration; import com.appsmith.external.models.Datasource; import com.appsmith.external.models.DefaultResources; import com.appsmith.external.models.Policy; import com.appsmith.external.models.Property; -import com.appsmith.server.domains.ActionProvider; -import com.appsmith.server.domains.Documentation; -import com.appsmith.server.domains.PluginType; -import com.appsmith.external.exceptions.ErrorDTO; +import com.appsmith.external.models.ActionProvider; +import com.appsmith.external.models.Documentation; +import com.appsmith.external.models.PluginType; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -154,6 +154,7 @@ public String getValidName() { return this.fullyQualifiedName; } } + public void sanitiseToExportDBObject() { this.setDefaultResources(null); this.setCacheResponse(null); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionProvider.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionProvider.java similarity index 87% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionProvider.java rename to app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionProvider.java index 2984dc9df689..d2d449266588 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionProvider.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionProvider.java @@ -1,4 +1,4 @@ -package com.appsmith.server.domains; +package com.appsmith.external.models; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Documentation.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Documentation.java similarity index 82% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Documentation.java rename to app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Documentation.java index b4f39fe3b20d..992da4e8b954 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Documentation.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Documentation.java @@ -1,4 +1,4 @@ -package com.appsmith.server.domains; +package com.appsmith.external.models; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DynamicBinding.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DynamicBinding.java deleted file mode 100644 index 96e1ecaa1609..000000000000 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DynamicBinding.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.appsmith.external.models; - -import lombok.Getter; - -import java.util.HashMap; -import java.util.Map; - -@Getter -public class DynamicBinding { - String binding; - Boolean isFunctionCall; - - public static Map<String, DynamicBinding> create(String bindingCandidate) { - Map<String, DynamicBinding> dynamicBindings = new HashMap<>(); - - - final String[] splitBindings = bindingCandidate.split("\\."); - - if (splitBindings.length < 2) { - // This could be a reference to an action but doesn't use its data - // Do not trigger the action unnecessarily - // Example: Api1 or btoa - return dynamicBindings; - } else if (splitBindings.length == 2 && "data".equals(splitBindings[1])) { - // This is a normal action data reference - // Example: Api1.data - DynamicBinding dynamicBinding = new DynamicBinding(); - dynamicBinding.binding = splitBindings[0]; - dynamicBinding.isFunctionCall = false; - dynamicBindings.put(dynamicBinding.binding, dynamicBinding); - } else if (splitBindings.length == 2) { - // If this is a reference to an action, it is only valid if it belongs to a collection - // These won't be called on page load for js, but will still be traversed for dependencies - // Example: Collection1.action1 - // Note: Here, if something like Api1.run gets caught, it won't match an action name, - // and hence won't be marked for run on page load - DynamicBinding dynamicBinding = new DynamicBinding(); - dynamicBinding.binding = bindingCandidate; - dynamicBinding.isFunctionCall = true; - dynamicBindings.put(dynamicBinding.binding, dynamicBinding); - } else if ("data".equals(splitBindings[1])) { - // This could be a normal action data reference with references to objects within it - // Example: Api1.data.fileData... - DynamicBinding dynamicBinding = new DynamicBinding(); - dynamicBinding.binding = splitBindings[0]; - dynamicBinding.isFunctionCall = false; - dynamicBindings.put(dynamicBinding.binding, dynamicBinding); - - // This could be a collection action data reference, with or without more references - // Example: Collection1.data.action1... - dynamicBinding = new DynamicBinding(); - dynamicBinding.binding = splitBindings[0] + "." + splitBindings[2]; - dynamicBinding.isFunctionCall = false; - dynamicBindings.put(dynamicBinding.binding, dynamicBinding); - } - - return dynamicBindings; - } -} diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/EntityDependencyNode.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/EntityDependencyNode.java new file mode 100644 index 000000000000..28997a4045f1 --- /dev/null +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/EntityDependencyNode.java @@ -0,0 +1,53 @@ +package com.appsmith.external.models; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EntityDependencyNode { + EntityReferenceType entityReferenceType; + String validEntityName; + String referenceString; + Boolean isAsync; + Boolean isFunctionCall; + ActionDTO actionDTO; + + public boolean isValidDynamicBinding() { + boolean result = true; + + if (this.referenceString == null) { + // This node represents an entity that has been explicitly marked to run on page load + return true; + } + + if (EntityReferenceType.ACTION.equals(this.entityReferenceType)) { + if (!this.referenceString.startsWith(this.validEntityName + ".data")) { + result = false; + } + } else if (EntityReferenceType.JSACTION.equals(this.entityReferenceType)) { + if (Boolean.TRUE.equals(this.isAsync) && (Boolean.TRUE.equals(this.isFunctionCall) || !this.referenceString.startsWith(this.validEntityName + ".data"))) { + result = false; + } + + if (Boolean.FALSE.equals(this.isAsync)) { + if (Boolean.TRUE.equals(this.isFunctionCall) && !this.validEntityName.equals(this.referenceString)) { + result = false; + } + if (Boolean.FALSE.equals(this.isFunctionCall) && !this.referenceString.startsWith(this.validEntityName + ".data")) { + result = false; + } + } + + // TODO: This one feels a little hacky. Should we introduce another property that handles whether the node is coming from a binding or i + if (this.isAsync == null && !this.referenceString.startsWith(this.validEntityName + ".data")) { + result = false; + } + } + return result; + } +} diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/EntityReferenceType.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/EntityReferenceType.java new file mode 100644 index 000000000000..9a76306d6fef --- /dev/null +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/EntityReferenceType.java @@ -0,0 +1,8 @@ +package com.appsmith.external.models; + +public enum EntityReferenceType { + ACTION, // Queries or APIs + JSACTION, // Functions inside JS objects + WIDGET, + APPSMITH // References inside the appsmith object in the global scope +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PluginType.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/PluginType.java similarity index 60% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PluginType.java rename to app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/PluginType.java index 85ac8af0e49a..1aba877651a5 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PluginType.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/PluginType.java @@ -1,4 +1,4 @@ -package com.appsmith.server.domains; +package com.appsmith.external.models; public enum PluginType { DB, API, JS, SAAS, REMOTE 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 ae5e0b29a4cf..f2d6c58c4438 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 @@ -62,8 +62,11 @@ public class CommonConfig { @Value("${disable.telemetry:true}") private boolean isTelemetryDisabled; + @Value("${appsmith.rts.url:http://localhost:8091}") + private String rtsBaseDomain; private List<String> allowedDomains; + @Bean public Scheduler scheduler() { return Schedulers.newElastic(ELASTIC_THREAD_POOL_NAME); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/InstanceConfig.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/InstanceConfig.java index ccfdfdf59881..dc16c7e63c51 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/InstanceConfig.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/InstanceConfig.java @@ -30,11 +30,16 @@ public class InstanceConfig implements ApplicationListener<ApplicationReadyEvent private final CloudServicesConfig cloudServicesConfig; + private final CommonConfig commonConfig; + + private boolean isRtsAccessible = false; + @Override public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) { configService.getByName(Appsmith.APPSMITH_REGISTERED) .filter(config -> Boolean.TRUE.equals(config.getConfig().get("value"))) .switchIfEmpty(registerInstance()) + .zipWith(performRtsHealthCheck()) .doOnSuccess(ignored -> this.printReady()) .doOnError(ignored -> this.printReady()) .subscribe(null, e -> { @@ -76,18 +81,32 @@ private Mono<? extends Config> registerInstance() { ); } + private Mono<Void> performRtsHealthCheck() { + return WebClientUtils + .create(commonConfig.getRtsBaseDomain() + "/rts-api/v1/health-check") + .get() + .retrieve() + .toBodilessEntity() + .doOnNext(nextSignal -> this.isRtsAccessible = true) + .then(); + } + private void printReady() { System.out.println( "\n" + - " █████╗ ██████╗ ██████╗ ███████╗███╗ ███╗██╗████████╗██╗ ██╗ ██╗███████╗ ██████╗ ██╗ ██╗███╗ ██╗███╗ ██╗██╗███╗ ██╗ ██████╗ ██╗\n" + - "██╔══██╗██╔══██╗██╔══██╗██╔════╝████╗ ████║██║╚══██╔══╝██║ ██║ ██║██╔════╝ ██╔══██╗██║ ██║████╗ ██║████╗ ██║██║████╗ ██║██╔════╝ ██║\n" + - "███████║██████╔╝██████╔╝███████╗██╔████╔██║██║ ██║ ███████║ ██║███████╗ ██████╔╝██║ ██║██╔██╗ ██║██╔██╗ ██║██║██╔██╗ ██║██║ ███╗██║\n" + - "██╔══██║██╔═══╝ ██╔═══╝ ╚════██║██║╚██╔╝██║██║ ██║ ██╔══██║ ██║╚════██║ ██╔══██╗██║ ██║██║╚██╗██║██║╚██╗██║██║██║╚██╗██║██║ ██║╚═╝\n" + - "██║ ██║██║ ██║ ███████║██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║███████║ ██║ ██║╚██████╔╝██║ ╚████║██║ ╚████║██║██║ ╚████║╚██████╔╝██╗\n" + - "╚═╝ ╚═╝╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝\n" + - "\n" + - "Please open http://localhost:<port> in your browser to experience Appsmith!\n" + " █████╗ ██████╗ ██████╗ ███████╗███╗ ███╗██╗████████╗██╗ ██╗ ██╗███████╗ ██████╗ ██╗ ██╗███╗ ██╗███╗ ██╗██╗███╗ ██╗ ██████╗ ██╗\n" + + "██╔══██╗██╔══██╗██╔══██╗██╔════╝████╗ ████║██║╚══██╔══╝██║ ██║ ██║██╔════╝ ██╔══██╗██║ ██║████╗ ██║████╗ ██║██║████╗ ██║██╔════╝ ██║\n" + + "███████║██████╔╝██████╔╝███████╗██╔████╔██║██║ ██║ ███████║ ██║███████╗ ██████╔╝██║ ██║██╔██╗ ██║██╔██╗ ██║██║██╔██╗ ██║██║ ███╗██║\n" + + "██╔══██║██╔═══╝ ██╔═══╝ ╚════██║██║╚██╔╝██║██║ ██║ ██╔══██║ ██║╚════██║ ██╔══██╗██║ ██║██║╚██╗██║██║╚██╗██║██║██║╚██╗██║██║ ██║╚═╝\n" + + "██║ ██║██║ ██║ ███████║██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║███████║ ██║ ██║╚██████╔╝██║ ╚████║██║ ╚████║██║██║ ╚████║╚██████╔╝██╗\n" + + "╚═╝ ╚═╝╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝\n" + + "\n" + + "Please open http://localhost:<port> in your browser to experience Appsmith!\n" ); } + public boolean getIsRtsAccessible() { + return this.isRtsAccessible; + } + } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java index 5adf0776f584..03f95bf34c0a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java @@ -3,7 +3,7 @@ import com.appsmith.external.models.ActionExecutionResult; import com.appsmith.server.constants.FieldName; import com.appsmith.server.constants.Url; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ActionMoveDTO; import com.appsmith.server.dtos.ActionViewDTO; import com.appsmith.server.dtos.LayoutDTO; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ItemControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ItemControllerCE.java index 9f2fdc2de16d..0bfb3394e8fb 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ItemControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ItemControllerCE.java @@ -1,7 +1,7 @@ package com.appsmith.server.controllers.ce; import com.appsmith.server.constants.Url; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.AddItemToPageDTO; import com.appsmith.server.dtos.ItemDTO; import com.appsmith.server.dtos.ResponseDTO; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/LayoutControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/LayoutControllerCE.java index ea6d2ec9219b..d89722039516 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/LayoutControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/LayoutControllerCE.java @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import reactor.core.publisher.Mono; import javax.validation.Valid; @@ -32,7 +33,7 @@ public class LayoutControllerCE { @Autowired public LayoutControllerCE(LayoutService layoutService, - LayoutActionService layoutActionService) { + LayoutActionService layoutActionService) { this.service = layoutService; this.layoutActionService = layoutActionService; } @@ -55,11 +56,12 @@ public Mono<ResponseDTO<Layout>> getLayout(@PathVariable String defaultPageId, @PutMapping("/{layoutId}/pages/{pageId}") public Mono<ResponseDTO<LayoutDTO>> updateLayout(@PathVariable String pageId, + @RequestParam String applicationId, @PathVariable String layoutId, @RequestBody Layout layout, @RequestHeader(name = FieldName.BRANCH_NAME, required = false) String branchName) { log.debug("update layout received for page {}", pageId); - return layoutActionService.updateLayout(pageId, layoutId, layout, branchName) + return layoutActionService.updateLayout(pageId, applicationId, layoutId, layout, branchName) .map(created -> new ResponseDTO<>(HttpStatus.OK.value(), created, null)); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/RestApiImportControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/RestApiImportControllerCE.java index ba37f7c6812d..37613e1b55f3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/RestApiImportControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/RestApiImportControllerCE.java @@ -4,7 +4,7 @@ import com.appsmith.server.constants.FieldName; import com.appsmith.server.constants.Url; import com.appsmith.server.domains.RestApiImporterType; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ResponseDTO; import com.appsmith.server.services.ApiImporter; import com.appsmith.server.services.CurlImporterService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java index 82cd30675ea0..b79d0129a20c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java @@ -1,8 +1,11 @@ package com.appsmith.server.domains; import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.ActionProvider; import com.appsmith.external.models.BaseDomain; import com.appsmith.external.models.Datasource; +import com.appsmith.external.models.Documentation; +import com.appsmith.external.models.PluginType; import com.appsmith.external.models.Property; 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/domains/ActionDependencyEdge.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionDependencyEdge.java index 2f1a9db94def..9280e62c85e3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionDependencyEdge.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ActionDependencyEdge.java @@ -1,5 +1,6 @@ package com.appsmith.server.domains; +import com.appsmith.external.models.EntityDependencyNode; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; @@ -12,14 +13,15 @@ @ToString @AllArgsConstructor public class ActionDependencyEdge { - String source; - String target; + + EntityDependencyNode sourceNode; + EntityDependencyNode targetNode; @Override public int hashCode() { return new HashCodeBuilder() - .append(source) - .append(target) + .append(sourceNode.getReferenceString()) + .append(targetNode.getReferenceString()) .toHashCode(); } @@ -29,8 +31,8 @@ public boolean equals(Object obj) { final ActionDependencyEdge actionDependencyEdge = (ActionDependencyEdge) obj; return new EqualsBuilder() - .append(source, actionDependencyEdge.source) - .append(target, actionDependencyEdge.target) + .append(sourceNode.getReferenceString(), actionDependencyEdge.sourceNode.getReferenceString()) + .append(targetNode.getReferenceString(), actionDependencyEdge.targetNode.getReferenceString()) .isEquals(); } else { return false; @@ -39,6 +41,6 @@ public boolean equals(Object obj) { @Override public String toString() { - return source + " : " + target; + return sourceNode.getReferenceString() + " : " + targetNode.getReferenceString(); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/NewAction.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/NewAction.java index eaa93ebacc5f..77f26c9c52e3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/NewAction.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/NewAction.java @@ -1,7 +1,9 @@ package com.appsmith.server.domains; import com.appsmith.external.models.BaseDomain; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.Documentation; +import com.appsmith.external.models.PluginType; +import com.appsmith.external.models.ActionDTO; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Plugin.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Plugin.java index f136981f5743..74759bb4eb51 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Plugin.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Plugin.java @@ -1,6 +1,7 @@ package com.appsmith.server.domains; import com.appsmith.external.models.BaseDomain; +import com.appsmith.external.models.PluginType; 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 bcedc07619aa..dfbbe63f9c38 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,10 +1,11 @@ package com.appsmith.server.dtos; +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.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.external.exceptions.ErrorDTO; import com.fasterxml.jackson.annotation.JsonFormat; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionCollectionViewDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionCollectionViewDTO.java index 1ad317b391b8..e23e957e595e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionCollectionViewDTO.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionCollectionViewDTO.java @@ -1,5 +1,6 @@ package com.appsmith.server.dtos; +import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.DefaultResources; import com.appsmith.external.models.JSValue; import lombok.Getter; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionMoveDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionMoveDTO.java index 9c1d9c9a11d5..0e50503e6749 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionMoveDTO.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ActionMoveDTO.java @@ -1,5 +1,6 @@ package com.appsmith.server.dtos; +import com.appsmith.external.models.ActionDTO; import lombok.Getter; import lombok.Setter; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/DslActionDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/DslActionDTO.java index 07402c803b14..8ba4c22916d6 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/DslActionDTO.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/DslActionDTO.java @@ -1,6 +1,6 @@ package com.appsmith.server.dtos; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/PluginDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/PluginDTO.java index 498fd1e7f05b..43aebd37a355 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/PluginDTO.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/PluginDTO.java @@ -1,6 +1,6 @@ package com.appsmith.server.dtos; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import lombok.Getter; import lombok.Setter; 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 d25b631634ac..b930dc68039d 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 @@ -5,7 +5,7 @@ import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.DslActionDTO; import com.appsmith.server.dtos.PageDTO; import org.apache.commons.lang3.StringUtils; 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 d70469e4106b..2e6a4b49381f 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 @@ -14,7 +14,7 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Theme; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ResponseUtils.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ResponseUtils.java index 869718318b5d..f8d07dec8a35 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ResponseUtils.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ResponseUtils.java @@ -9,7 +9,7 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ActionCollectionViewDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ActionViewDTO; import com.appsmith.server.dtos.ApplicationPagesDTO; import com.appsmith.server.dtos.LayoutDTO; 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 e2192506c74f..d1b0e93d0107 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 @@ -40,7 +40,7 @@ import com.appsmith.server.domains.Page; import com.appsmith.server.domains.PasswordResetToken; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.QActionCollection; import com.appsmith.server.domains.QApplication; import com.appsmith.server.domains.QComment; @@ -63,7 +63,7 @@ import com.appsmith.server.domains.Workspace; import com.appsmith.server.domains.WorkspacePlugin; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.DslActionDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.dtos.WorkspacePluginStatus; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java index 08090281d781..03eaaf8e181a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java @@ -1,7 +1,9 @@ package com.appsmith.server.migrations; +import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.BaseDomain; import com.appsmith.external.models.Datasource; +import com.appsmith.external.models.PluginType; import com.appsmith.external.models.Policy; import com.appsmith.external.models.Property; import com.appsmith.external.models.QBaseDomain; @@ -23,7 +25,6 @@ import com.appsmith.server.domains.Page; import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; import com.appsmith.server.domains.PricingPlan; import com.appsmith.server.domains.QActionCollection; import com.appsmith.server.domains.QApplication; @@ -47,7 +48,6 @@ import com.appsmith.server.domains.UserData; import com.appsmith.server.domains.UserRole; import com.appsmith.server.domains.Workspace; -import com.appsmith.server.dtos.ActionDTO; import com.appsmith.server.dtos.Permission; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java index 1f17589bc27a..01564cb84845 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java @@ -6,7 +6,7 @@ import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.QUser; import com.appsmith.server.domains.User; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.helpers.CollectionUtils; import com.appsmith.server.repositories.CacheableRepositoryHelper; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/PluginRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/PluginRepositoryCE.java index f495f7eaed7c..951edecdbd2b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/PluginRepositoryCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/PluginRepositoryCE.java @@ -1,7 +1,7 @@ package com.appsmith.server.repositories.ce; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.repositories.BaseRepository; import com.appsmith.server.repositories.CustomPluginRepository; import reactor.core.publisher.Flux; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstService.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstService.java new file mode 100644 index 000000000000..1c9259499b8a --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstService.java @@ -0,0 +1,6 @@ +package com.appsmith.server.services; + +import com.appsmith.server.services.ce.AstServiceCE; + +public interface AstService extends AstServiceCE { +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstServiceImpl.java new file mode 100644 index 000000000000..0c9bfca2a92d --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstServiceImpl.java @@ -0,0 +1,16 @@ +package com.appsmith.server.services; + +import com.appsmith.server.configurations.CommonConfig; +import com.appsmith.server.configurations.InstanceConfig; +import com.appsmith.server.services.ce.AstServiceCEImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +public class AstServiceImpl extends AstServiceCEImpl implements AstService { + + public AstServiceImpl(CommonConfig commonConfig, InstanceConfig instanceConfig) { + super(commonConfig, instanceConfig); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCE.java index 9ceec2b28c53..0d479db0fd37 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCE.java @@ -5,7 +5,7 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ActionCollectionViewDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.services.CrudService; import org.springframework.data.domain.Sort; import org.springframework.util.MultiValueMap; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCEImpl.java index 229405999962..e22907a34072 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCEImpl.java @@ -11,7 +11,7 @@ import com.appsmith.server.domains.Page; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ActionCollectionViewDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.DefaultResourcesUtils; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApiImporterCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApiImporterCE.java index 6e9f8ea9d0e0..ea6e3cd60b10 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApiImporterCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApiImporterCE.java @@ -1,6 +1,6 @@ package com.appsmith.server.services.ce; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import reactor.core.publisher.Mono; public interface ApiImporterCE { 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 8aa369339751..8b28c5eadd7b 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 @@ -21,7 +21,7 @@ import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.User; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationPagesDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.dtos.PageNameIdDTO; @@ -175,7 +175,7 @@ public Mono<PageDTO> createPageWithBranchName(PageDTO page, String branchName) { * Note: It is assumed here that `application` is already checked for the MANAGE_APPLICATIONS policy. * * @param application Application to which the page will be added. Should have an `id` already. - * @param page Page to be added to the application. Should have an `id` already. + * @param page Page to be added to the application. Should have an `id` already. * @return UpdateResult object with details on how many documents have been updated, which should be 0 or 1. */ @Override @@ -183,21 +183,21 @@ public Mono<UpdateResult> addPageToApplication(Application application, PageDTO String defaultPageId = page.getDefaultResources() == null || StringUtils.isEmpty(page.getDefaultResources().getPageId()) ? page.getId() : page.getDefaultResources().getPageId(); - if(isDuplicatePage(application, page.getId())) { + if (isDuplicatePage(application, page.getId())) { return applicationRepository.addPageToApplication(application.getId(), page.getId(), isDefault, defaultPageId) .doOnSuccess(result -> { if (result.getModifiedCount() != 1) { log.error("Add page to application didn't update anything, probably because application wasn't found."); } }); - } else{ - return Mono.error(new AppsmithException(AppsmithError.DUPLICATE_KEY, "Page already exists with id "+page.getId())); + } else { + return Mono.error(new AppsmithException(AppsmithError.DUPLICATE_KEY, "Page already exists with id " + page.getId())); } } private Boolean isDuplicatePage(Application application, String pageId) { - if( application.getPages() != null) { + if (application.getPages() != null) { int count = (int) application.getPages().stream().filter( applicationPage -> applicationPage.getId().equals(pageId)).count(); if (count > 0) { @@ -326,7 +326,7 @@ public Mono<Application> createApplication(Application application, String works Application application1 = tuple.getT1(); application1.setModifiedBy(tuple.getT2().getUsername()); // setting modified by to current user // assign the default theme id to edit mode - return themeService.getDefaultThemeId().map(themeId-> { + return themeService.getDefaultThemeId().map(themeId -> { application1.setEditModeThemeId(themeId); application1.setPublishedModeThemeId(themeId); return themeId; @@ -413,7 +413,7 @@ public Mono<Application> deleteApplication(String id) { return deleteApplicationByResource(application); }) .then(applicationMono) - .flatMap(application ->{ + .flatMap(application -> { GitApplicationMetadata gitData = application.getGitApplicationMetadata(); if (gitData != null && !StringUtils.isEmpty(gitData.getDefaultApplicationId()) && !StringUtils.isEmpty(gitData.getRepoName())) { String repoName = gitData.getRepoName(); @@ -644,14 +644,14 @@ private Mono<PageDTO> clonePageGivenApplicationId(String pageId, }) .flatMap(newlyCreatedActionCollection -> Flux.fromIterable(updatedDefaultToBranchedActionId.values()) - .flatMap(newActionService::findById) - .flatMap(newlyCreatedAction -> { - newlyCreatedAction.getUnpublishedAction().setCollectionId(newlyCreatedActionCollection.getId()); - newlyCreatedAction.getUnpublishedAction().getDefaultResources() - .setCollectionId(newlyCreatedActionCollection.getDefaultResources().getCollectionId()); - return newActionService.update(newlyCreatedAction.getId(), newlyCreatedAction); - }) - .collectList() + .flatMap(newActionService::findById) + .flatMap(newlyCreatedAction -> { + newlyCreatedAction.getUnpublishedAction().setCollectionId(newlyCreatedActionCollection.getId()); + newlyCreatedAction.getUnpublishedAction().getDefaultResources() + .setCollectionId(newlyCreatedActionCollection.getDefaultResources().getCollectionId()); + return newActionService.update(newlyCreatedAction.getId(), newlyCreatedAction); + }) + .collectList() ); }) .collectList(); @@ -665,7 +665,7 @@ private Mono<PageDTO> clonePageGivenApplicationId(String pageId, return Flux.fromIterable(layouts) .flatMap(layout -> { layout.setDsl(layoutActionService.unescapeMongoSpecialCharacters(layout)); - return layoutActionService.updateLayout(savedPage.getId(), layout.getId(), layout); + return layoutActionService.updateLayout(savedPage.getId(), savedPage.getApplicationId(), layout.getId(), layout); }) .collectList() .thenReturn(savedPage); @@ -700,7 +700,7 @@ public Mono<Application> cloneApplication(String applicationId, String branchNam .flatMap(application -> { // For git connected application user can update the default branch // In such cases we should fork the application from the new default branch - if(StringUtils.isEmpty(branchName) + if (StringUtils.isEmpty(branchName) && !Optional.ofNullable(application.getGitApplicationMetadata()).isEmpty() && !application.getGitApplicationMetadata().getBranchName().equals(application.getGitApplicationMetadata().getDefaultBranchName())) { return applicationService.findByBranchNameAndDefaultApplicationId( @@ -744,7 +744,7 @@ public Mono<Application> cloneApplication(String applicationId, String branchNam newApplication.setLastEditedAt(Instant.now()); newApplication.setEvaluationVersion(sourceApplication.getEvaluationVersion()); - if(sourceApplication.getApplicationVersion() != null) { + if (sourceApplication.getApplicationVersion() != null) { newApplication.setApplicationVersion(sourceApplication.getApplicationVersion()); } else { newApplication.setApplicationVersion(ApplicationVersion.EARLIEST_VERSION); @@ -910,6 +910,7 @@ public Mono<PageDTO> deleteUnpublishedPageByBranchAndDefaultPageId(String defaul .flatMap(newPage -> deleteUnpublishedPage(newPage.getId())) .map(responseUtils::updatePageDTOWithDefaultResources); } + /** * This function walks through all the pages in the application. In each page, it walks through all the layouts. * In a layout, dsl and publishedDsl JSONObjects exist. Publish function is responsible for copying the dsl into @@ -925,7 +926,7 @@ public Mono<Application> publish(String applicationId, boolean isPublishedManual .cache(); Mono<Theme> publishThemeMono = applicationMono.flatMap( - application -> themeService.publishTheme(application.getId()) + application -> themeService.publishTheme(application.getId()) ); Mono<List<NewPage>> publishApplicationAndPages = applicationMono @@ -971,7 +972,7 @@ public Mono<Application> publish(String applicationId, boolean isPublishedManual application.setPublishedPages(pages); application.setPublishedAppLayout(application.getUnpublishedAppLayout()); - if(isPublishedManually) { + if (isPublishedManually) { application.setLastDeployedAt(Instant.now()); } // Archive the deleted pages and save the application changes and then return the pages so that @@ -1069,11 +1070,13 @@ public Mono<Application> publish(String defaultApplicationId, String branchName, .map(responseUtils::updateApplicationWithDefaultResources); } - /** This function walks through all the pages and reorders them and updates the order as per the user preference. + /** + * This function walks through all the pages and reorders them and updates the order as per the user preference. * A page can be moved up or down from the current position and accordingly the order of the remaining page changes. - * @param defaultAppId The id of the Application + * + * @param defaultAppId The id of the Application * @param defaultPageId Targetted page id - * @param order New order for the selected page + * @param order New order for the selected page * @return Application object with the latest order **/ @Override @@ -1095,7 +1098,7 @@ public Mono<ApplicationPagesDTO> reorderPage(String defaultAppId, String default } } - if(foundPage != null) { + if (foundPage != null) { pages.remove(foundPage); pages.add(order, foundPage); } @@ -1110,9 +1113,10 @@ public Mono<ApplicationPagesDTO> reorderPage(String defaultAppId, String default /** * 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 + * @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) { @@ -1141,8 +1145,9 @@ public Mono<Application> createOrUpdateSuffixedApplication(Application applicati /** * To send analytics event for cloning an application + * * @param sourceApplication The application from which cloning is done - * @param application The newly created application by cloning + * @param application The newly created application by cloning * @return The newly created application by cloning */ private Mono<Application> sendCloneApplicationAnalyticsEvent(Application sourceApplication, Application application) { @@ -1168,7 +1173,8 @@ private Mono<Application> sendCloneApplicationAnalyticsEvent(Application sourceA /** * To send analytics event for page views - * @param newPage Page being accessed + * + * @param newPage Page being accessed * @param viewMode Page is accessed in view mode or not * @return NewPage */ 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 5e71cfddb91e..5ec96609489a 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 @@ -19,7 +19,7 @@ import com.appsmith.server.domains.QApplication; import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.User; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationAccessDTO; import com.appsmith.server.dtos.GitAuthDTO; import com.appsmith.server.dtos.GitDeployKeyDTO; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCE.java new file mode 100644 index 000000000000..87e8155d98a6 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCE.java @@ -0,0 +1,21 @@ +package com.appsmith.server.services.ce; + +import reactor.core.publisher.Mono; + +import java.util.Set; + +public interface AstServiceCE { + + /** + * If the RTS AST endpoints are accessible, use the service to find global references in the binding value + * If not, then fall back to the string comparison way of breaking down the binding value into words and looking + * for references + * In case the AST service returns with an error, throw an exception that propagates to the layout error messages, + * to let the user know that their on page load actions have not been updated. + * + * @param bindingValue : The mustache binding value string to be analyzed + * @param evalVersion : The evaluated value version of the current app to be used while AST parsing + * @return A mono of list of strings that represent all valid global references in the binding string + */ + Mono<Set<String>> getPossibleReferencesFromDynamicBinding(String bindingValue, int evalVersion); +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCEImpl.java new file mode 100644 index 000000000000..ac87bd8fd457 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCEImpl.java @@ -0,0 +1,93 @@ +package com.appsmith.server.services.ce; + +import com.appsmith.external.helpers.MustacheHelper; +import com.appsmith.server.configurations.CommonConfig; +import com.appsmith.server.configurations.InstanceConfig; +import com.appsmith.util.WebClientUtils; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; +import org.springframework.util.StringUtils; +import org.springframework.web.reactive.function.BodyInserters; +import reactor.core.publisher.Mono; + +import java.util.HashSet; +import java.util.Set; + +@Slf4j +@RequiredArgsConstructor +public class AstServiceCEImpl implements AstServiceCE { + + private final CommonConfig commonConfig; + + private final InstanceConfig instanceConfig; + + @Override + public Mono<Set<String>> getPossibleReferencesFromDynamicBinding(String bindingValue, int evalVersion) { + if (!StringUtils.hasLength(bindingValue)) { + return Mono.empty(); + } + + // If RTS server is not accessible for this instance, it means that this is a slim container set up + // Proceed with assuming that all words need to be processed as possible entity references + if (Boolean.FALSE.equals(instanceConfig.getIsRtsAccessible())) { + return Mono.just(new HashSet<>(MustacheHelper.getPossibleParentsOld(bindingValue))); + } + + return WebClientUtils.create(commonConfig.getRtsBaseDomain() + "/rts-api/v1/ast/single-script-data") + .post() + .contentType(MediaType.APPLICATION_JSON) + .body(BodyInserters.fromValue(new GetIdentifiersRequest(bindingValue, evalVersion))) + .retrieve() + .bodyToMono(GetIdentifiersResponse.class) + .map(response -> response.data.references); + // TODO: add error handling scenario for when RTS is not accessible in fat container + } + + @NoArgsConstructor + @AllArgsConstructor + @Getter + static class GetIdentifiersRequest { + String script; + int evalVersion; + } + + @NoArgsConstructor + @AllArgsConstructor + @Getter + @Setter + static class GetIdentifiersResponse { + GetIdentifiersResponseDetails data; + } + + /** + * Consider the following binding: + * ( function(ignoredAction1) { + * let a = ignoredAction1.data + * let ignoredAction2 = { data: "nothing" } + * let b = ignoredAction2.data + * let c = "ignoredAction3.data" + * // ignoredAction4.data + * return aPostAction.data + * } )(anotherPostAction.data) + * <p/> + * The values in the returned instance of GetIdentifiersResponseDetails will be: + * { + * references: ["aPostAction.data", "anotherPostAction.data"], + * functionalParams: ["ignoredAction1"], + * variables: ["ignoredAction2", "a", "b", "c"] + */ + @NoArgsConstructor + @AllArgsConstructor + @Getter + @Setter + static class GetIdentifiersResponseDetails { + Set<String> references; + Set<String> functionalParams; + Set<String> variables; + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/BaseApiImporterCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/BaseApiImporterCE.java index 4bb5b848a4b2..ce7381ad0f95 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/BaseApiImporterCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/BaseApiImporterCE.java @@ -1,6 +1,6 @@ package com.appsmith.server.services.ce; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import reactor.core.publisher.Mono; public abstract class BaseApiImporterCE implements ApiImporterCE { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CollectionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CollectionServiceCE.java index e5341a779872..b6e2a0f57896 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CollectionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CollectionServiceCE.java @@ -2,7 +2,7 @@ import com.appsmith.server.domains.Collection; import com.appsmith.server.domains.NewAction; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.services.CrudService; import reactor.core.publisher.Mono; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CollectionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CollectionServiceCEImpl.java index 5a9984d7688b..8be1c5ba7603 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CollectionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CollectionServiceCEImpl.java @@ -3,7 +3,7 @@ import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.Collection; import com.appsmith.server.domains.NewAction; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.repositories.CollectionRepository; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCE.java index 1b0288da54b0..9e9890bc389c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCE.java @@ -1,6 +1,6 @@ package com.appsmith.server.services.ce; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.exceptions.AppsmithException; import java.util.List; 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 fbdffe72c090..fc9e12012d83 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 @@ -7,7 +7,7 @@ import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.ResponseUtils; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCE.java index 8f68633a68c0..7f9bce432491 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCE.java @@ -1,9 +1,9 @@ package com.appsmith.server.services.ce; +import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.Datasource; import com.appsmith.external.models.DatasourceTestResult; import com.appsmith.server.acl.AclPermission; -import com.appsmith.server.dtos.ActionDTO; import com.appsmith.server.services.CrudService; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; 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 1b00df0c734a..ed02aceba2db 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 @@ -2,6 +2,7 @@ import com.appsmith.external.helpers.AppsmithBeanUtils; import com.appsmith.external.helpers.MustacheHelper; +import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.Datasource; import com.appsmith.external.models.DatasourceConfiguration; import com.appsmith.external.models.DatasourceTestResult; @@ -15,7 +16,6 @@ import com.appsmith.server.domains.Plugin; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; -import com.appsmith.server.dtos.ActionDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.PluginExecutorHelper; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ItemServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ItemServiceCE.java index c11580d5725b..5d33763a8dc5 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ItemServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ItemServiceCE.java @@ -1,6 +1,6 @@ package com.appsmith.server.services.ce; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.AddItemToPageDTO; import com.appsmith.server.dtos.ItemDTO; import org.springframework.util.MultiValueMap; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ItemServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ItemServiceCEImpl.java index 0d8fd5e5d127..e5ca8bf5eb4c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ItemServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ItemServiceCEImpl.java @@ -3,8 +3,8 @@ import com.appsmith.external.models.ApiTemplate; import com.appsmith.external.models.Datasource; import com.appsmith.server.constants.FieldName; -import com.appsmith.server.domains.Documentation; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.Documentation; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.AddItemToPageDTO; import com.appsmith.server.dtos.ItemDTO; import com.appsmith.server.dtos.ItemType; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java index cab1963bba86..9b7ebda730dd 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java @@ -2,7 +2,7 @@ import com.appsmith.external.helpers.AppsmithEventContext; import com.appsmith.server.domains.Layout; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ActionMoveDTO; import com.appsmith.server.dtos.LayoutDTO; import com.appsmith.server.dtos.RefactorActionNameDTO; @@ -12,9 +12,9 @@ public interface LayoutActionServiceCE { - Mono<LayoutDTO> updateLayout(String pageId, String layoutId, Layout layout); + Mono<LayoutDTO> updateLayout(String pageId, String applicationId, String layoutId, Layout layout); - Mono<LayoutDTO> updateLayout(String pageId, String layoutId, Layout layout, String branchName); + Mono<LayoutDTO> updateLayout(String defaultPageId, String defaultApplicationId, String layoutId, Layout layout, String branchName); Mono<ActionDTO> moveAction(ActionMoveDTO actionMoveDTO); 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 25b86f0708ae..5e9805df39d3 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 @@ -1,11 +1,13 @@ package com.appsmith.server.services.ce; import com.appsmith.external.constants.AnalyticsEvents; +import com.appsmith.external.exceptions.ErrorDTO; import com.appsmith.external.helpers.AppsmithBeanUtils; import com.appsmith.external.helpers.AppsmithEventContext; import com.appsmith.external.helpers.AppsmithEventContextType; import com.appsmith.external.helpers.MustacheHelper; import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.Datasource; import com.appsmith.external.models.DefaultResources; import com.appsmith.server.constants.FieldName; @@ -15,7 +17,6 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.User; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; import com.appsmith.server.dtos.ActionMoveDTO; import com.appsmith.server.dtos.DslActionDTO; import com.appsmith.server.dtos.LayoutActionUpdateDTO; @@ -23,7 +24,6 @@ import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.dtos.RefactorActionNameDTO; import com.appsmith.server.dtos.RefactorNameDTO; -import com.appsmith.external.exceptions.ErrorDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.DefaultResourcesUtils; @@ -71,6 +71,7 @@ import static com.appsmith.server.acl.AclPermission.MANAGE_ACTIONS; import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES; import static com.appsmith.server.acl.AclPermission.READ_PAGES; +import static com.appsmith.server.services.ce.ApplicationPageServiceCEImpl.EVALUATION_VERSION; import static java.lang.Boolean.FALSE; import static java.util.stream.Collectors.toSet; @@ -206,7 +207,7 @@ public Mono<ActionDTO> moveAction(ActionMoveDTO actionMoveDTO) { return Flux.fromIterable(page.getLayouts()) .flatMap(layout -> { layout.setDsl(this.unescapeMongoSpecialCharacters(layout)); - return updateLayout(page.getId(), layout.getId(), layout); + return updateLayout(page.getId(), page.getApplicationId(), layout.getId(), layout); }) .collect(toSet()); }) @@ -221,7 +222,7 @@ public Mono<ActionDTO> moveAction(ActionMoveDTO actionMoveDTO) { return Flux.fromIterable(page.getLayouts()) .flatMap(layout -> { layout.setDsl(this.unescapeMongoSpecialCharacters(layout)); - return updateLayout(page.getId(), layout.getId(), layout); + return updateLayout(page.getId(), page.getApplicationId(), layout.getId(), layout); }) .collect(toSet()); }) @@ -450,7 +451,7 @@ public Mono<LayoutDTO> refactorName(String pageId, String layoutId, String oldNa for (Layout layout : layouts) { if (layoutId.equals(layout.getId())) { layout.setDsl(this.unescapeMongoSpecialCharacters(layout)); - return updateLayout(page.getId(), layout.getId(), layout); + return updateLayout(page.getId(), page.getApplicationId(), layout.getId(), layout); } } return Mono.empty(); @@ -490,7 +491,7 @@ private JsonNode replaceStringInJsonNode(JsonNode jsonNode, Pattern oldNamePatte ((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()) { @@ -833,7 +834,7 @@ private Mono<String> updatePageLayoutsGivenAction(String pageId) { return Flux.fromIterable(page.getLayouts()) .flatMap(layout -> { layout.setDsl(this.unescapeMongoSpecialCharacters(layout)); - return updateLayout(page.getId(), layout.getId(), layout); + return updateLayout(page.getId(), page.getApplicationId(), layout.getId(), layout); }); }) .collectList() @@ -870,7 +871,7 @@ private Mono<Boolean> sendUpdateLayoutAnalyticsEvent(String pageId, String layou } @Override - public Mono<LayoutDTO> updateLayout(String pageId, String layoutId, Layout layout) { + public Mono<LayoutDTO> updateLayout(String pageId, String applicationId, String layoutId, Layout layout) { JSONObject dsl = layout.getDsl(); if (dsl == null) { // There is no DSL here. No need to process anything. Return as is. @@ -901,21 +902,33 @@ public Mono<LayoutDTO> updateLayout(String pageId, String layoutId, Layout layou List<String> messages = new ArrayList<>(); AtomicReference<Boolean> validOnPageLoadActions = new AtomicReference<>(Boolean.TRUE); + Mono<Integer> evaluatedVersionMono = applicationService + .findById(applicationId) + .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, + FieldName.APPLICATION_ID, applicationId))) + .map(application -> { + Integer evaluationVersion = application.getEvaluationVersion(); + if (evaluationVersion == null) { + evaluationVersion = EVALUATION_VERSION; + } + return evaluationVersion; + }); - // setting the layoutOnLoadActionActionErrors to null to remove the existing errors before new DAG calculation. + // setting the layoutOnLoadActionActionErrors to empty to remove the existing errors before new DAG calculation. layout.setLayoutOnLoadActionErrors(new ArrayList<>()); - Mono<List<Set<DslActionDTO>>> allOnLoadActionsMono = pageLoadActionsUtil - .findAllOnLoadActions(pageId, widgetNames, edges, widgetDynamicBindingsMap, flatmapPageLoadActions, actionsUsedInDSL) - .onErrorResume(AppsmithException.class, error -> { - log.info(error.getMessage()); - validOnPageLoadActions.set(FALSE); - layout.setLayoutOnLoadActionErrors(List.of( - new ErrorDTO(error.getAppErrorCode(), - layoutOnLoadActionErrorToastMessage, - error.getMessage()))); - return Mono.just(new ArrayList<>()); - }); + Mono<List<Set<DslActionDTO>>> allOnLoadActionsMono = evaluatedVersionMono + .flatMap(evaluatedVersion -> pageLoadActionsUtil + .findAllOnLoadActions(pageId, evaluatedVersion, widgetNames, edges, widgetDynamicBindingsMap, flatmapPageLoadActions, actionsUsedInDSL) + .onErrorResume(AppsmithException.class, error -> { + log.info(error.getMessage()); + validOnPageLoadActions.set(FALSE); + layout.setLayoutOnLoadActionErrors(List.of( + new ErrorDTO(error.getAppErrorCode(), + layoutOnLoadActionErrorToastMessage, + error.getMessage()))); + return Mono.just(new ArrayList<>()); + })); // First update the actions and set execute on load to true JSONObject finalDsl = dsl; @@ -987,12 +1000,12 @@ public Mono<LayoutDTO> updateLayout(String pageId, String layoutId, Layout layou } @Override - public Mono<LayoutDTO> updateLayout(String defaultPageId, String layoutId, Layout layout, String branchName) { + public Mono<LayoutDTO> updateLayout(String defaultPageId, String defaultApplicationId, String layoutId, Layout layout, String branchName) { if (StringUtils.isEmpty(branchName)) { - return updateLayout(defaultPageId, layoutId, layout); + return updateLayout(defaultPageId, defaultApplicationId, layoutId, layout); } return newPageService.findByBranchNameAndDefaultPageId(branchName, defaultPageId, MANAGE_PAGES) - .flatMap(branchedPage -> updateLayout(branchedPage.getId(), layoutId, layout)) + .flatMap(branchedPage -> updateLayout(branchedPage.getId(), branchedPage.getApplicationId(), layoutId, layout)) .map(responseUtils::updateLayoutDTOWithDefaultResources); } 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 efef2468e2bf..6c15fa8ad3d1 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 @@ -9,7 +9,7 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ActionCollectionMoveDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.LayoutDTO; import com.appsmith.server.dtos.RefactorActionCollectionNameDTO; import com.appsmith.server.dtos.RefactorActionNameDTO; @@ -379,7 +379,7 @@ public Mono<ActionCollectionDTO> moveCollection(ActionCollectionMoveDTO actionCo return Flux.fromIterable(page.getLayouts()) .flatMap(layout -> { layout.setDsl(layoutActionService.unescapeMongoSpecialCharacters(layout)); - return layoutActionService.updateLayout(page.getId(), layout.getId(), layout); + return layoutActionService.updateLayout(page.getId(), page.getApplicationId(), layout.getId(), layout); }) .collect(toSet()); }) @@ -394,7 +394,7 @@ public Mono<ActionCollectionDTO> moveCollection(ActionCollectionMoveDTO actionCo return Flux.fromIterable(page.getLayouts()) .flatMap(layout -> { layout.setDsl(layoutActionService.unescapeMongoSpecialCharacters(layout)); - return layoutActionService.updateLayout(page.getId(), layout.getId(), layout); + return layoutActionService.updateLayout(page.getId(), page.getApplicationId(), layout.getId(), layout); }) .collect(toSet()); }) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCE.java index 8d80d63d9d75..9a1a45ed62bf 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCE.java @@ -5,7 +5,7 @@ import com.appsmith.server.acl.AclPermission; import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ActionViewDTO; import com.appsmith.server.dtos.LayoutActionUpdateDTO; import com.appsmith.server.services.CrudService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java index 0633fdeeb188..b819ba367951 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java @@ -25,7 +25,7 @@ import com.appsmith.server.acl.PolicyGenerator; import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.Action; -import com.appsmith.server.domains.ActionProvider; +import com.appsmith.external.models.ActionProvider; import com.appsmith.server.domains.Application; import com.appsmith.server.domains.ApplicationMode; import com.appsmith.server.domains.DatasourceContext; @@ -33,9 +33,9 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Page; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.User; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ActionViewDTO; import com.appsmith.server.dtos.LayoutActionUpdateDTO; import com.appsmith.server.exceptions.AppsmithError; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PluginServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PluginServiceCEImpl.java index bd9609d7929e..f25f047a8e0a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PluginServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PluginServiceCEImpl.java @@ -2,10 +2,10 @@ import com.appsmith.external.models.Datasource; import com.appsmith.server.constants.FieldName; -import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; import com.appsmith.server.domains.Workspace; import com.appsmith.server.domains.WorkspacePlugin; +import com.appsmith.server.domains.Plugin; +import com.appsmith.external.models.PluginType; import com.appsmith.server.dtos.InstallPluginRedisDTO; import com.appsmith.server.dtos.PluginWorkspaceDTO; import com.appsmith.server.dtos.WorkspacePluginStatus; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PostmanImporterServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PostmanImporterServiceCEImpl.java index 5ebec8465f6c..24740feef43b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PostmanImporterServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/PostmanImporterServiceCEImpl.java @@ -6,7 +6,7 @@ import com.appsmith.external.models.DatasourceConfiguration; import com.appsmith.external.models.Property; import com.appsmith.external.models.TemplateCollection; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.helpers.ResponseUtils; import com.appsmith.server.services.BaseApiImporter; import com.appsmith.server.services.NewPageService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/PageLoadActionsUtilImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/PageLoadActionsUtilImpl.java index f8cbfb701c94..c8ec1f1140ef 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/PageLoadActionsUtilImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/PageLoadActionsUtilImpl.java @@ -1,5 +1,7 @@ package com.appsmith.server.solutions; +import com.appsmith.server.services.ApplicationService; +import com.appsmith.server.services.AstService; import com.appsmith.server.services.NewActionService; import com.appsmith.server.solutions.ce.PageLoadActionsUtilCEImpl; import lombok.extern.slf4j.Slf4j; @@ -9,7 +11,8 @@ @Component public class PageLoadActionsUtilImpl extends PageLoadActionsUtilCEImpl implements PageLoadActionsUtil { - public PageLoadActionsUtilImpl(NewActionService newActionService) { - super(newActionService); + public PageLoadActionsUtilImpl(NewActionService newActionService, + AstService astService) { + super(newActionService, astService); } } 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 02c518d02f7b..1b2401f5afe4 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 @@ -16,7 +16,7 @@ import com.appsmith.server.constants.Url; import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.dtos.AuthorizationCodeCallbackDTO; import com.appsmith.server.dtos.IntegrationDTO; import com.appsmith.server.exceptions.AppsmithError; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java index 90a98e00f8f4..bfa3718db133 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java @@ -19,7 +19,7 @@ import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.dtos.CRUDPageResourceDTO; import com.appsmith.server.dtos.CRUDPageResponseDTO; @@ -342,7 +342,7 @@ public Mono<CRUDPageResponseDTO> createPageFromDBTable(String defaultPageId, } log.debug("Going to update layout for page {} and layout {}", savedPageId, layoutId); - return layoutActionService.updateLayout(savedPageId, layoutId, layout) + return layoutActionService.updateLayout(savedPageId, page.getApplicationId(), layoutId, layout) .then(Mono.zip( Mono.just(datasource), Mono.just(templateActionList), diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ExamplesWorkspaceClonerCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ExamplesWorkspaceClonerCEImpl.java index 4e308ddb403e..397eaf2c767d 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ExamplesWorkspaceClonerCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ExamplesWorkspaceClonerCEImpl.java @@ -17,7 +17,7 @@ import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.User; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.DslActionDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; 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 a1098fd42e18..d99dfd373525 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 @@ -28,7 +28,7 @@ import com.appsmith.server.domains.Workspace; import com.appsmith.server.domains.GitApplicationMetadata; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationImportDTO; import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.dtos.ExportFileDTO; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/PageLoadActionsUtilCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/PageLoadActionsUtilCE.java index 8fbfd5adacff..47613a10b7e3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/PageLoadActionsUtilCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/PageLoadActionsUtilCE.java @@ -1,7 +1,7 @@ package com.appsmith.server.solutions.ce; import com.appsmith.server.domains.ActionDependencyEdge; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.DslActionDTO; import reactor.core.publisher.Mono; @@ -12,6 +12,7 @@ public interface PageLoadActionsUtilCE { Mono<List<Set<DslActionDTO>>> findAllOnLoadActions(String pageId, + Integer evaluatedVersion, Set<String> widgetNames, Set<ActionDependencyEdge> edges, Map<String, Set<String>> widgetDynamicBindingsMap, diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/PageLoadActionsUtilCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/PageLoadActionsUtilCEImpl.java index c0dbc5b1e468..f7921816588b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/PageLoadActionsUtilCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/PageLoadActionsUtilCEImpl.java @@ -1,13 +1,16 @@ package com.appsmith.server.solutions.ce; import com.appsmith.external.helpers.MustacheHelper; +import com.appsmith.external.models.ActionDTO; +import com.appsmith.external.models.EntityDependencyNode; +import com.appsmith.external.models.EntityReferenceType; +import com.appsmith.external.models.PluginType; import com.appsmith.external.models.Property; import com.appsmith.server.domains.ActionDependencyEdge; -import com.appsmith.server.domains.PluginType; -import com.appsmith.server.dtos.ActionDTO; import com.appsmith.server.dtos.DslActionDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.services.AstService; import com.appsmith.server.services.NewActionService; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; @@ -18,6 +21,7 @@ import org.jgrapht.traverse.BreadthFirstIterator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import reactor.util.function.Tuple2; import java.util.ArrayList; import java.util.Arrays; @@ -29,13 +33,13 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import static com.appsmith.external.helpers.MustacheHelper.ACTION_ENTITY_REFERENCES; +import static com.appsmith.external.helpers.MustacheHelper.WIDGET_ENTITY_REFERENCES; import static com.appsmith.external.helpers.MustacheHelper.getPossibleParents; -import static com.appsmith.external.helpers.MustacheHelper.getWordsFromMustache; import static com.appsmith.server.acl.AclPermission.MANAGE_ACTIONS; import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; @@ -45,6 +49,8 @@ public class PageLoadActionsUtilCEImpl implements PageLoadActionsUtilCE { private final NewActionService newActionService; + + private final AstService astService; private final ObjectMapper objectMapper = new ObjectMapper(); /** @@ -69,6 +75,7 @@ public class PageLoadActionsUtilCEImpl implements PageLoadActionsUtilCE { * and the same are used by the caller function for further processing. * * @param pageId : Argument used for fetching actions in this page + * @param evaluatedVersion : Depending on the evaluated version, the way the AST parsing logic picks entities in the dynamic binding will change * @param widgetNames : Set of widget names which SHOULD have been populated before calling this function. * @param edges : Set where this function adds all the relationships (dependencies) between actions * @param widgetDynamicBindingsMap : A map of widget path and the set of dynamic binding words in the mustache at the @@ -79,11 +86,12 @@ public class PageLoadActionsUtilCEImpl implements PageLoadActionsUtilCE { * @param flatPageLoadActions : A flat list of on page load actions (Not in the sequence in which these actions * would be called on page load) * @param actionsUsedInDSL : Set where this function adds all the actions directly used in the DSL - * @return : Returns page load actions which is a list of sets of actions. Inside a set, all actions can be executed + * @return Returns page load actions which is a list of sets of actions. Inside a set, all actions can be executed * in parallel. But one set of actions MUST finish execution before the next set of actions can be executed * in the list. */ public Mono<List<Set<DslActionDTO>>> findAllOnLoadActions(String pageId, + Integer evaluatedVersion, Set<String> widgetNames, Set<ActionDependencyEdge> edges, Map<String, Set<String>> widgetDynamicBindingsMap, @@ -94,7 +102,7 @@ public Mono<List<Set<DslActionDTO>>> findAllOnLoadActions(String pageId, Set<String> explicitUserSetOnLoadActions = new HashSet<>(); Set<String> bindingsFromActions = new HashSet<>(); - // Function `extractAndSetActionBindingsInGraphEdges` updates this set to keep a track of all the actions which + // Function `extractAndSetActionBindingsInGraphEdges` updates this map to keep a track of all the actions which // have been discovered while walking the actions to ensure that we don't end up in a recursive infinite loop // in case of a cyclical relationship between actions (and not specific paths) and helps us exit at the appropriate // junction. @@ -102,33 +110,28 @@ public Mono<List<Set<DslActionDTO>>> findAllOnLoadActions(String pageId, // Api1.actionConfiguration.body <- Api2.data.users[0].name // Api2.actionConfiguration.url <- Api1.actionConfiguration.url // In the above case, the two actions depend on each other without there being a real cyclical dependency. - Set<String> actionsFoundDuringWalk = new HashSet<>(); - - Set<String> bindingsInWidgets = new HashSet<>(); + Map<String, EntityDependencyNode> actionsFoundDuringWalk = new HashMap<>(); - // Create a global set of bindings found in ALL the widgets. - widgetDynamicBindingsMap.values().forEach(bindings -> bindingsInWidgets.addAll(bindings)); - - Flux<ActionDTO> allActionsByPageIdMono = newActionService.findByPageIdAndViewMode(pageId, false, MANAGE_ACTIONS) + Flux<ActionDTO> allActionsByPageIdFlux = newActionService + .findByPageIdAndViewMode(pageId, false, MANAGE_ACTIONS) .flatMap(newAction -> newActionService.generateActionByViewMode(newAction, false)) .cache(); - Mono<Map<String, ActionDTO>> actionNameToActionMapMono = allActionsByPageIdMono - .collectMap( - ActionDTO::getValidName, - action -> action - ) - .cache(); + Mono<Map<String, ActionDTO>> actionNameToActionMapMono = allActionsByPageIdFlux.collectMap(ActionDTO::getValidName, action -> action).cache(); - Mono<Set<String>> actionsInPageMono = allActionsByPageIdMono - .map(action -> action.getValidName()) - .collect(Collectors.toSet()) - .cache(); + Mono<Set<String>> actionsInPageMono = allActionsByPageIdFlux.map(ActionDTO::getValidName).collect(Collectors.toSet()).cache(); - Set<String> actionBindingsInDsl = new HashSet<>(); - Mono<Set<ActionDependencyEdge>> directlyReferencedActionsAddedToGraphMono = addDirectlyReferencedActionsToGraph(pageId, - edges, actionsUsedInDSL, bindingsFromActions, actionsFoundDuringWalk, bindingsInWidgets, - actionNameToActionMapMono, actionBindingsInDsl); + Set<EntityDependencyNode> actionBindingsInDsl = new HashSet<>(); + Mono<Set<ActionDependencyEdge>> directlyReferencedActionsAddedToGraphMono = + addDirectlyReferencedActionsToGraph( + edges, + actionsUsedInDSL, + bindingsFromActions, + actionsFoundDuringWalk, + widgetDynamicBindingsMap, + actionNameToActionMapMono, + actionBindingsInDsl, + evaluatedVersion); // This following `createAllEdgesForPageMono` publisher traverses the actions and widgets to add all possible // edges between all possible entity paths @@ -136,15 +139,27 @@ public Mono<List<Set<DslActionDTO>>> findAllOnLoadActions(String pageId, // First find all the actions in the page whose name matches the possible entity names found in the bindings in the widget Mono<Set<ActionDependencyEdge>> createAllEdgesForPageMono = directlyReferencedActionsAddedToGraphMono // Add dependencies of all on page load actions set by the user in the graph - .flatMap(updatedEdges -> addExplicitUserSetOnLoadActionsToGraph(pageId, updatedEdges, explicitUserSetOnLoadActions, actionsFoundDuringWalk, bindingsFromActions)) + .flatMap(updatedEdges -> addExplicitUserSetOnLoadActionsToGraph( + pageId, + updatedEdges, + explicitUserSetOnLoadActions, + actionsFoundDuringWalk, + bindingsFromActions, + actionNameToActionMapMono, + actionBindingsInDsl, + evaluatedVersion)) // For all the actions found so far, recursively walk the dynamic bindings of the actions to find more relationships with other actions (& widgets) - .flatMap(updatedEdges -> recursivelyAddActionsAndTheirDependentsToGraphFromBindings(pageId, updatedEdges, actionsFoundDuringWalk, bindingsFromActions)) + .flatMap(updatedEdges -> recursivelyAddActionsAndTheirDependentsToGraphFromBindings( + updatedEdges, + actionsFoundDuringWalk, + bindingsFromActions, + actionNameToActionMapMono, + evaluatedVersion)) // At last, add all the widget relationships to the graph as well. .zipWith(actionsInPageMono) .flatMap(tuple -> { Set<ActionDependencyEdge> updatedEdges = tuple.getT1(); - Set<String> actionNames = tuple.getT2(); - return addWidgetRelationshipToGraph(updatedEdges, widgetDynamicBindingsMap, actionNames); + return addWidgetRelationshipToGraph(updatedEdges, widgetDynamicBindingsMap, evaluatedVersion); }); @@ -153,18 +168,16 @@ public Mono<List<Set<DslActionDTO>>> findAllOnLoadActions(String pageId, .map(tuple -> { Set<String> allActions = tuple.getT1(); Set<ActionDependencyEdge> updatedEdges = tuple.getT2(); - return constructDAG(allActions, widgetNames, updatedEdges, actionsFoundDuringWalk, actionBindingsInDsl); - }) - .cache(); + return constructDAG(allActions, widgetNames, updatedEdges, actionBindingsInDsl); + }).cache(); // Generate on page load schedule - Mono<List<Set<String>>> computeOnPageLoadScheduleNamesMono = Mono.zip(actionsInPageMono, createGraphMono) + Mono<List<Set<String>>> computeOnPageLoadScheduleNamesMono = Mono.zip(actionNameToActionMapMono, createGraphMono) .map(tuple -> { - Set<String> actionNames = tuple.getT1(); + Map<String, ActionDTO> actionNameToActionMap = tuple.getT1(); DirectedAcyclicGraph<String, DefaultEdge> graph = tuple.getT2(); - return computeOnPageLoadActionsSchedulingOrder(graph, onPageLoadActionSet, actionNames, - explicitUserSetOnLoadActions); + return computeOnPageLoadActionsSchedulingOrder(graph, onPageLoadActionSet, actionNameToActionMap, explicitUserSetOnLoadActions); }) .map(onPageLoadActionsSchedulingOrder -> { // Find all explicitly turned on actions which haven't found their way into the scheduling order @@ -194,20 +207,19 @@ public Mono<List<Set<DslActionDTO>>> findAllOnLoadActions(String pageId, // Transform the schedule order into client feasible DTO Mono<List<Set<DslActionDTO>>> computeCompletePageLoadActionScheduleMono = - filterAndTransformSchedulingOrderToDTO(onPageLoadActionSet, actionNameToActionMapMono, computeOnPageLoadScheduleNamesMono) + filterAndTransformSchedulingOrderToDTO( + onPageLoadActionSet, + actionNameToActionMapMono, + computeOnPageLoadScheduleNamesMono) .cache(); // With the final on page load scheduling order, also set the on page load actions which would be updated // by the caller function - Mono<List<ActionDTO>> flatPageLoadActionsMono = computeCompletePageLoadActionScheduleMono - .then(actionNameToActionMapMono) - .map(actionMap -> { - onPageLoadActionSet - .stream() - .forEach(actionName -> flatPageLoadActions.add(actionMap.get(actionName))); - return flatPageLoadActions; - }); + Mono<List<ActionDTO>> flatPageLoadActionsMono = computeCompletePageLoadActionScheduleMono.then(actionNameToActionMapMono).map(actionMap -> { + onPageLoadActionSet.stream().forEach(actionName -> flatPageLoadActions.add(actionMap.get(actionName))); + return flatPageLoadActions; + }); return createGraphMono .then(flatPageLoadActionsMono) @@ -257,10 +269,124 @@ private Mono<List<Set<DslActionDTO>>> filterAndTransformSchedulingOrderToDTO(Set onPageLoadActions.add(actionsInLevel); } - return onPageLoadActions.stream().filter(setOfActions -> !setOfActions.isEmpty()).collect(Collectors.toList()); + return onPageLoadActions.stream() + .filter(setOfActions -> !setOfActions.isEmpty()) + .collect(Collectors.toList()); }); } + /** + * This method is used to find all possible global entity references in the given set of bindings. + * We'll be able to find valid action references only at this point. For widgets, we just assume that all + * references are possible candidates + * + * @param actionNameToActionMapMono : This map is used to filter only valid action references in bindings + * @param bindings : The set of bindings to find references from + * @param evalVersion : Depending on the evaluated version, the way the AST parsing logic picks entities in the dynamic binding will change + * @return A set of any possible reference found in the binding that qualifies as a global entity reference + */ + private Mono<Set<EntityDependencyNode>> getPossibleEntityReferences(Mono<Map<String, ActionDTO>> actionNameToActionMapMono, + Set<String> bindings, + int evalVersion) { + return getPossibleEntityReferences(actionNameToActionMapMono, bindings, evalVersion, null); + } + + /** + * Similar to the overridden method, this method is used to find all possible global entity references in the given set of bindings. + * However, here we are assuming that the call came from when we were trying to analyze the DSL. + * For such cases, we also want to capture entity references that would be qualified to run on page load first. + * + * @param actionNameToActionMapMono : This map is used to filter only valid action references in bindings + * @param bindings : The set of bindings to find references from + * @param evalVersion : Depending on the evaluated version, the way the AST parsing logic picks entities in the dynamic binding will change + * @param bindingsInDsl : All references are also added to this set if they should be qualified to run on page load first. + * @return A set of any possible reference found in the binding that qualifies as a global entity reference + */ + private Mono<Set<EntityDependencyNode>> getPossibleEntityReferences(Mono<Map<String, ActionDTO>> actionNameToActionMapMono, + Set<String> bindings, + int evalVersion, + Set<EntityDependencyNode> bindingsInDsl) { + // We want to be finding both type of references + final int entityTypes = ACTION_ENTITY_REFERENCES | WIDGET_ENTITY_REFERENCES; + + return actionNameToActionMapMono + .zipWith(getPossibleEntityParentsMap(bindings, entityTypes, evalVersion)) + .map(tuple -> { + Map<String, ActionDTO> actionMap = tuple.getT1(); + // For each binding, here we receive a set of possible references to global entities + // At this point we're guaranteed that these references are made to possible variables, + // but we do not know if those entities exist in the global namespace yet + Map<String, Set<EntityDependencyNode>> bindingToPossibleParentMap = tuple.getT2(); + + Set<EntityDependencyNode> possibleEntitiesReferences = new HashSet<>(); + + // From these references, we will try to validate action references at this point + // Each identified node is already annotated with the expected type of entity we need to search for + bindingToPossibleParentMap.entrySet() + .stream() + .forEach(entry -> { + Set<EntityDependencyNode> bindingsWithActionReference = new HashSet<>(); + entry.getValue() + .stream() + .forEach(binding -> { + // For each possible reference node, check if the reference was to an action + ActionDTO actionDTO = actionMap.get(binding.getValidEntityName()); + + if (actionDTO != null) { + // If it was, and had been identified as the same type of action as what exists in this app, + if ((PluginType.JS.equals(actionDTO.getPluginType()) && EntityReferenceType.JSACTION.equals(binding.getEntityReferenceType())) + || (!PluginType.JS.equals(actionDTO.getPluginType()) && EntityReferenceType.ACTION.equals(binding.getEntityReferenceType()))) { + // Copy over some data from the identified action, this ensures that we do not have to query the DB again later + binding.setIsAsync(actionDTO.getActionConfiguration().getIsAsync()); + binding.setActionDTO(actionDTO); + bindingsWithActionReference.add(binding); + // Only if this is not an async JS function action and is not a direct JS function call, + // add it to a possible on page load action call. + // This discards the following type: + // {{ JSObject1.asyncFunc() }} + if (!(TRUE.equals(binding.getIsAsync()) && TRUE.equals(binding.getIsFunctionCall()))) { + possibleEntitiesReferences.add(binding); + } + // We're ignoring any reference that was identified as a widget but actually matched an action + // We wouldn't have discarded JS collection names here, but this is just an optimization, so it's fine + } + } else { + // If the reference node was identified as a widget, directly add it as a possible reference + // Because we are not doing any validations for widget references at this point + if (EntityReferenceType.WIDGET.equals(binding.getEntityReferenceType())) { + possibleEntitiesReferences.add(binding); + } + } + }); + + if (!bindingsWithActionReference.isEmpty() && bindingsInDsl != null) { + bindingsInDsl.addAll(bindingsWithActionReference); + } + }); + + return possibleEntitiesReferences; + }); + } + + /** + * This method is an abstraction that queries the ast service for possible global references as string values, + * and then uses the mustache helper utility to classify these global references into possible types of EntityDependencyNodes + * + * @param bindings : A set of binding values as string to analyze + * @param types : The types of EntityDependencyNode references to look for + * @param evalVersion : Depending on the evaluated version, the way the AST parsing logic picks entities in the dynamic binding will change + * @return A mono of a map of each of the provided binding values to the possible set of EntityDependencyNodes found in the binding + */ + private Mono<Map<String, Set<EntityDependencyNode>>> getPossibleEntityParentsMap(Set<String> bindings, int types, int evalVersion) { + Flux<Tuple2<String, Set<String>>> findingToReferencesFlux = + Flux.fromIterable(bindings) + .flatMap(bindingValue -> { + Mono<Set<String>> possibleReferencesFromDynamicBinding = astService.getPossibleReferencesFromDynamicBinding(bindingValue, evalVersion); + return Mono.zip(Mono.just(bindingValue), possibleReferencesFromDynamicBinding); + }); + return MustacheHelper.getPossibleEntityParentsMap(findingToReferencesFlux, types); + } + /** * This function finds all the actions in the page whose name matches the possible entity names found in the * bindings in the widget. Caveat : It first removes all invalid bindings from the set of all bindings from the DSL @@ -269,74 +395,59 @@ private Mono<List<Set<DslActionDTO>>> filterAndTransformSchedulingOrderToDTO(Set * !!! WARNING !!! : This function updates actionsUsedInDSL set which is used to store all the directly referenced * actions in the DSL. * - * @param pageId * @param edges * @param actionsUsedInDSL * @param bindingsFromActions * @param actionsFoundDuringWalk - * @param bindingsInWidgets + * @param widgetDynamicBindingsMap * @param actionNameToActionMapMono + * @param actionBindingsInDsl + * @param evalVersion * @return */ - private Mono<Set<ActionDependencyEdge>> addDirectlyReferencedActionsToGraph(String pageId, - Set<ActionDependencyEdge> edges, + private Mono<Set<ActionDependencyEdge>> addDirectlyReferencedActionsToGraph(Set<ActionDependencyEdge> edges, Set<String> actionsUsedInDSL, Set<String> bindingsFromActions, - Set<String> actionsFoundDuringWalk, - Set<String> bindingsInWidgets, + Map<String, EntityDependencyNode> actionsFoundDuringWalk, + Map<String, Set<String>> widgetDynamicBindingsMap, Mono<Map<String, ActionDTO>> actionNameToActionMapMono, - Set<String> actionBindingsInDsl) { - return actionNameToActionMapMono - .map(actionMap -> { - Map<String, Set<String>> bindingToPossibleParentMap = bindingsInWidgets - .stream() - .collect(Collectors.toMap(Function.identity(), v -> getPossibleParents(v))); - - Set<String> invalidBindings = new HashSet<>(); - - bindingsInWidgets - .stream() - .forEach(binding -> { - Set<String> possibleParents = bindingToPossibleParentMap.get(binding); - - Optional<String> isAction = possibleParents - .stream() - .filter(parent -> actionMap.get(parent) != null) - .findFirst(); - - // if the binding is referring to the action, ensure that for ASYNC JS functions, it - // shouldn't be a function call since that is not supported in dynamic bindings. - if (isAction.isPresent()) { - actionBindingsInDsl.add(binding); - ActionDTO action = actionMap.get(isAction.get()); - if (isAsyncJsFunctionCall(action, binding)) { - invalidBindings.add(binding); - } + Set<EntityDependencyNode> actionBindingsInDsl, + int evalVersion) { + return Flux.fromIterable(widgetDynamicBindingsMap.entrySet()) + .flatMap(entry -> { + String widgetName = entry.getKey(); + // For each widget in the DSL that has a dynamic binding, we define an entity dependency node beforehand + // This will be a leaf node in the DAG that is constructed for on page load dependencies + EntityDependencyNode widgetDependencyNode = new EntityDependencyNode(EntityReferenceType.WIDGET, widgetName, widgetName, null, null, null); + Set<String> bindingsInWidget = entry.getValue(); + return getPossibleEntityReferences(actionNameToActionMapMono, bindingsInWidget, evalVersion, actionBindingsInDsl) + .flatMapMany(Flux::fromIterable) + // Add dependencies of the actions found in the DSL in the graph + // We are ignoring the widget references at this point + // TODO: Possible optimization in the future + .flatMap(possibleEntity -> { + if (EntityReferenceType.ACTION.equals(possibleEntity.getEntityReferenceType()) + || EntityReferenceType.JSACTION.equals(possibleEntity.getEntityReferenceType())) { + edges.add(new ActionDependencyEdge(possibleEntity, widgetDependencyNode)); + // This action is directly referenced in the DSL. This action is an ideal candidate for on page load + actionsUsedInDSL.add(possibleEntity.getValidEntityName()); + ActionDTO actionDTO = possibleEntity.getActionDTO(); + return newActionService.fillSelfReferencingDataPaths(actionDTO) + .map(newActionDTO -> { + possibleEntity.setActionDTO(newActionDTO); + return newActionDTO; + }) + .flatMap(newActionDTO -> extractAndSetActionBindingsInGraphEdges(possibleEntity, + edges, + bindingsFromActions, + actionNameToActionMapMono, + actionsFoundDuringWalk, + null, + evalVersion)) + .thenReturn(possibleEntity); } + return Mono.just(possibleEntity); }); - - return invalidBindings; - }) - .map(invalidBindings -> { - Set<String> validBindings = new HashSet<>(bindingsInWidgets); - validBindings.removeAll(invalidBindings); - - Set<String> possibleEntityNamesInDsl = new HashSet<>(); - - // From all the bindings found in the widget, extract all possible entity names. - validBindings.stream().forEach(binding -> possibleEntityNamesInDsl.addAll(getPossibleParents(binding))); - - return possibleEntityNamesInDsl; - }) - .flatMapMany(possibleEntityNamesInDsl -> newActionService.findUnpublishedActionsInPageByNames(possibleEntityNamesInDsl, pageId)) - .flatMap(newAction -> newActionService.generateActionByViewMode(newAction, false)) - .flatMap(newActionService::fillSelfReferencingDataPaths) - // Add dependencies of the actions found in the DSL in the graph. - .map(action -> { - // This action is directly referenced in the DSL. This action is an ideal candidate for on page load - actionsUsedInDSL.add(action.getValidName()); - extractAndSetActionBindingsInGraphEdges(edges, action, bindingsFromActions, actionsFoundDuringWalk); - return action; }) .collectList() .thenReturn(edges); @@ -361,22 +472,19 @@ private Mono<Set<ActionDependencyEdge>> addDirectlyReferencedActionsToGraph(Stri * @param actionNames * @param widgetNames * @param edges - * @param actionsFoundDuringWalk * @param actionBindingsInDsl * @return */ private DirectedAcyclicGraph<String, DefaultEdge> constructDAG(Set<String> actionNames, Set<String> widgetNames, Set<ActionDependencyEdge> edges, - Set<String> actionsFoundDuringWalk, - Set<String> actionBindingsInDsl) { + Set<EntityDependencyNode> actionBindingsInDsl) { - DirectedAcyclicGraph<String, DefaultEdge> actionSchedulingGraph = - new DirectedAcyclicGraph<>(DefaultEdge.class); + DirectedAcyclicGraph<String, DefaultEdge> actionSchedulingGraph = new DirectedAcyclicGraph<>(DefaultEdge.class); // Add the vertices for all the actions found in the DSL - for (String actionBindingInDsl : actionBindingsInDsl) { - actionSchedulingGraph.addVertex(actionBindingInDsl); + for (EntityDependencyNode actionBindingInDsl : actionBindingsInDsl) { + actionSchedulingGraph.addVertex(actionBindingInDsl.getReferenceString()); } Set<ActionDependencyEdge> implicitParentChildEdges = new HashSet<>(); @@ -386,102 +494,59 @@ private DirectedAcyclicGraph<String, DefaultEdge> constructDAG(Set<String> actio // TODO : Handle the above global variables provided by appsmith in the following filtering. edges = edges.stream().filter(edge -> { - String source = edge.getSource(); - String target = edge.getTarget(); - - // Edges here are assumed to be non-null - // If an edge comprises vertices that depend on itself (caused by self-referencing), - // We want to throw an error before attempting to create the DAG - // Example: Text1.text has the value {{ Text1.text }} - if (source.equals(target)) { - throw new AppsmithException(AppsmithError.CYCLICAL_DEPENDENCY_ERROR, edge.toString()); - } + String source = edge.getSourceNode().getReferenceString(); + String target = edge.getTargetNode().getReferenceString(); - Set<String> vertices = Set.of(source, target); + // Edges here are assumed to be non-null + // If an edge comprises vertices that depend on itself (caused by self-referencing), + // We want to throw an error before attempting to create the DAG + // Example: Text1.text has the value {{ Text1.text }} + if (source.equals(target)) { + throw new AppsmithException(AppsmithError.CYCLICAL_DEPENDENCY_ERROR, edge.toString()); + } - AtomicReference<Boolean> isValidVertex = new AtomicReference<>(true); + Set<String> vertices = Set.of(source, target); - // Assert that the vertices which are entire property paths have a possible parent which is either - // an action or a widget or a static variable provided by appsmith at page/application level. - vertices - .stream() - .forEach(vertex -> { - Optional<String> validEntity = getPossibleParents(vertex) - .stream() - .filter(parent -> { - if (!actionNames.contains(parent) && !widgetNames.contains(parent) && !APPSMITH_GLOBAL_VARIABLES.contains(parent)) { - return false; - } - 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); - } - }); + AtomicReference<Boolean> isValidVertex = new AtomicReference<>(true); - return isValidVertex.get(); - }) - .collect(Collectors.toSet()); + // Assert that the vertices which are entire property paths have a possible parent which is either + // an action or a widget or a static variable provided by appsmith at page/application level. + vertices.stream().forEach(vertex -> { + Optional<String> validEntity = getPossibleParents(vertex).stream().filter(parent -> { + if (!actionNames.contains(parent) && !widgetNames.contains(parent) && !APPSMITH_GLOBAL_VARIABLES.contains(parent)) { + return false; + } + 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); + } + }); - Set<String> actionDataPaths = actionNames - .stream() - .map(actionName -> actionName + ".data") - .collect(Collectors.toSet()); + return isValidVertex.get(); + }).collect(Collectors.toSet()); Set<ActionDependencyEdge> actionDataFromConfigurationEdges = new HashSet<>(); - Set<String> vertices = new HashSet<>(actionSchedulingGraph.vertexSet()); edges.stream().forEach(edge -> { - vertices.add(edge.getSource()); - vertices.add(edge.getTarget()); + addImplicitActionConfigurationDependency(edge.getSourceNode(), actionDataFromConfigurationEdges); + addImplicitActionConfigurationDependency(edge.getTargetNode(), actionDataFromConfigurationEdges); }); - - // All actions data paths actually depend on the action configuration paths. Add this implicit relationship in the - // graph as well - // This also ensures that when an action.data vertex exists at two different levels in the graph, it gets a - // single level because of a common relationship getting added to connect all actioConfiguration dependencies - // to action.data - vertices - .stream() - .forEach(vertex -> { - Optional<String> validActionParent = getPossibleParents(vertex) - .stream() - .filter(parent -> { - if (!actionNames.contains(parent)) { - return false; - } - return true; - }).findFirst(); - - if (validActionParent.isPresent()) { - String actionName = validActionParent.get(); - for (String actionDataPath : actionDataPaths) { - if (vertex.contains(actionDataPath)) { - // This vertex is actually a path on top of action.data (or equal to action.data) - // Add a relationship from action.actionConfiguration to action.data - String source = actionName + ".actionConfiguration"; - String destination = vertex; - actionDataFromConfigurationEdges.add(new ActionDependencyEdge(source, destination)); - } - } - } - }); - edges.addAll(actionDataFromConfigurationEdges); // Now add the relationship aka when a child gets updated, the parent should get updated as well. Aka // parent depends on the child. for (ActionDependencyEdge edge : edges) { - String source = edge.getSource(); - String target = edge.getTarget(); + EntityDependencyNode source = edge.getSourceNode(); + EntityDependencyNode target = edge.getTargetNode(); - Set<String> edgeVertices = Set.of(source, target); + Set<EntityDependencyNode> edgeVertices = Set.of(source, target); edgeVertices.stream().forEach(vertex -> implicitParentChildEdges.addAll(generateParentChildRelationships(vertex))); @@ -492,8 +557,8 @@ private DirectedAcyclicGraph<String, DefaultEdge> constructDAG(Set<String> actio // Now create the graph from all the edges. for (ActionDependencyEdge edge : edges) { - String source = edge.getSource(); - String target = edge.getTarget(); + String source = edge.getSourceNode().getReferenceString(); + String target = edge.getTargetNode().getReferenceString(); actionSchedulingGraph.addVertex(source); actionSchedulingGraph.addVertex(target); @@ -511,6 +576,26 @@ private DirectedAcyclicGraph<String, DefaultEdge> constructDAG(Set<String> actio return actionSchedulingGraph; } + /** + * All actions data paths actually depend on the action configuration paths. + * Add this implicit relationship in the graph as well + * This also ensures that when an action.data vertex exists at two different levels in the graph, it gets a + * single level because of a common relationship getting added to connect all actionConfiguration dependencies + * to action.data + * + * @param entityDependencyNode + * @param actionDataFromConfigurationEdges + */ + private void addImplicitActionConfigurationDependency(EntityDependencyNode entityDependencyNode, Set<ActionDependencyEdge> actionDataFromConfigurationEdges) { + if (Set.of(EntityReferenceType.ACTION, EntityReferenceType.JSACTION).contains(entityDependencyNode.getEntityReferenceType())) { + if (entityDependencyNode.isValidDynamicBinding()) { + EntityDependencyNode sourceDependencyNode = new EntityDependencyNode(entityDependencyNode.getEntityReferenceType(), entityDependencyNode.getValidEntityName(), entityDependencyNode.getValidEntityName() + ".actionConfiguration", entityDependencyNode.getIsAsync(), entityDependencyNode.getIsFunctionCall(), entityDependencyNode.getActionDTO()); + actionDataFromConfigurationEdges.add(new ActionDependencyEdge(sourceDependencyNode, entityDependencyNode)); + } + } + } + + /** * This function takes a Directed Acyclic Graph and computes on page load actions. The final results is a list of set * of actions. The set contains all the independent actions which can be executed in parallel. The List represents @@ -520,20 +605,18 @@ private DirectedAcyclicGraph<String, DefaultEdge> constructDAG(Set<String> actio * * @param dag : The DAG graph containing all the edges representing dependencies between appsmith entities in the page. * @param onPageLoadActionSet - * @param actionNames : All the action names for the page + * @param actionNameToActionMap : All the action names for the page * @return */ private List<Set<String>> computeOnPageLoadActionsSchedulingOrder(DirectedAcyclicGraph<String, DefaultEdge> dag, Set<String> onPageLoadActionSet, - Set<String> actionNames, + Map<String, ActionDTO> actionNameToActionMap, Set<String> explicitUserSetOnLoadActions) { Map<String, Integer> pageLoadActionAndLevelMap = new HashMap<>(); List<Set<String>> onPageLoadActions = new ArrayList<>(); // Find all root nodes to start the BFS traversal from - List<String> rootNodes = dag.vertexSet().stream() - .filter(key -> dag.incomingEdgesOf(key).size() == 0) - .collect(Collectors.toList()); + List<String> rootNodes = dag.vertexSet().stream().filter(key -> dag.incomingEdgesOf(key).size() == 0).collect(Collectors.toList()); BreadthFirstIterator<String, DefaultEdge> bfsIterator = new BreadthFirstIterator<>(dag, rootNodes); @@ -547,8 +630,7 @@ private List<Set<String>> computeOnPageLoadActionsSchedulingOrder(DirectedAcycli onPageLoadActions.add(new HashSet<>()); } - Set<String> actionsFromBinding = actionCandidatesForPageLoadFromBinding(actionNames, vertex, - pageLoadActionAndLevelMap, onPageLoadActions, explicitUserSetOnLoadActions); + Set<String> actionsFromBinding = actionCandidatesForPageLoadFromBinding(actionNameToActionMap, vertex, pageLoadActionAndLevelMap, onPageLoadActions, explicitUserSetOnLoadActions); onPageLoadActions.get(level).addAll(actionsFromBinding); for (String action : actionsFromBinding) { pageLoadActionAndLevelMap.put(action, level); @@ -570,40 +652,39 @@ private List<Set<String>> computeOnPageLoadActionsSchedulingOrder(DirectedAcycli * * @return */ - private Mono<Set<ActionDependencyEdge>> recursivelyAddActionsAndTheirDependentsToGraphFromBindings(String pageId, - Set<ActionDependencyEdge> edges, - Set<String> actionsFoundDuringWalk, - Set<String> dynamicBindings) { + private Mono<Set<ActionDependencyEdge>> recursivelyAddActionsAndTheirDependentsToGraphFromBindings(Set<ActionDependencyEdge> edges, + Map<String, EntityDependencyNode> actionsFoundDuringWalk, + Set<String> dynamicBindings, + Mono<Map<String, ActionDTO>> actionNameToActionMapMono, + int evalVersion) { if (dynamicBindings == null || dynamicBindings.isEmpty()) { return Mono.just(edges); } - Set<String> possibleActionNames = new HashSet<>(); - - dynamicBindings.stream().forEach(binding -> possibleActionNames.addAll(getPossibleParents(binding))); - // All actions found from possibleActionNames set would add their dependencies in the following set for further // walk to find more actions recursively. Set<String> newBindings = new HashSet<>(); // First fetch all the actions in the page whose name matches the words found in all the dynamic bindings - Mono<List<ActionDTO>> findAndAddActionsInBindingsMono = newActionService.findUnpublishedActionsInPageByNames(possibleActionNames, pageId) - .flatMap(newAction -> newActionService.generateActionByViewMode(newAction, false)) - .flatMap(newActionService::fillSelfReferencingDataPaths) - .map(action -> { - - extractAndSetActionBindingsInGraphEdges(edges, action, newBindings, actionsFoundDuringWalk); - - return action; - }) - .collectList(); + Mono<List<EntityDependencyNode>> findAndAddActionsInBindingsMono = getPossibleEntityReferences(actionNameToActionMapMono, dynamicBindings, evalVersion).flatMapMany(Flux::fromIterable) + // Add dependencies of the actions found in the DSL in the graph. + .flatMap(possibleEntity -> { + if (Set.of(EntityReferenceType.JSACTION, EntityReferenceType.ACTION).contains(possibleEntity.getEntityReferenceType())) { + ActionDTO actionDTO = possibleEntity.getActionDTO(); + return newActionService.fillSelfReferencingDataPaths(actionDTO).map(newActionDTO -> { + possibleEntity.setActionDTO(newActionDTO); + return newActionDTO; + }).then(extractAndSetActionBindingsInGraphEdges(possibleEntity, edges, newBindings, actionNameToActionMapMono, actionsFoundDuringWalk, null, evalVersion)).thenReturn(possibleEntity); + } else { + return Mono.empty(); + } + }).collectList(); - return findAndAddActionsInBindingsMono - .flatMap(actions -> { - // Now that the next set of bindings have been found, find recursively all actions by these names - // and their bindings - return recursivelyAddActionsAndTheirDependentsToGraphFromBindings(pageId, edges, actionsFoundDuringWalk, newBindings); - }); + return findAndAddActionsInBindingsMono.flatMap(entityDependencyNodes -> { + // Now that the next set of bindings have been found, find recursively all actions by these names + // and their bindings + return recursivelyAddActionsAndTheirDependentsToGraphFromBindings(edges, actionsFoundDuringWalk, newBindings, actionNameToActionMapMono, evalVersion); + }); } /** @@ -627,18 +708,29 @@ private Mono<Set<ActionDependencyEdge>> recursivelyAddActionsAndTheirDependentsT private Mono<Set<ActionDependencyEdge>> addExplicitUserSetOnLoadActionsToGraph(String pageId, Set<ActionDependencyEdge> edges, Set<String> explicitUserSetOnLoadActions, - Set<String> actionsFoundDuringWalk, - Set<String> bindingsFromActions) { + Map<String, EntityDependencyNode> actionsFoundDuringWalk, + Set<String> bindingsFromActions, + Mono<Map<String, ActionDTO>> actionNameToActionMapMono, + Set<EntityDependencyNode> actionBindingsInDsl, + int evalVersion) { //First fetch all the actions which have been tagged as on load by the user explicitly. return newActionService.findUnpublishedOnLoadActionsExplicitSetByUserInPage(pageId) .flatMap(newAction -> newActionService.generateActionByViewMode(newAction, false)) .flatMap(newActionService::fillSelfReferencingDataPaths) // Add the vertices and edges to the graph for these actions - .map(actionDTO -> { - extractAndSetActionBindingsInGraphEdges(edges, actionDTO, bindingsFromActions, actionsFoundDuringWalk); + .flatMap(actionDTO -> { + EntityDependencyNode entityDependencyNode = new EntityDependencyNode(actionDTO.getPluginType().equals(PluginType.JS) ? EntityReferenceType.JSACTION : EntityReferenceType.ACTION, actionDTO.getValidName(), null, null, false, actionDTO); explicitUserSetOnLoadActions.add(actionDTO.getValidName()); - return actionDTO; + return extractAndSetActionBindingsInGraphEdges( + entityDependencyNode, + edges, + bindingsFromActions, + actionNameToActionMapMono, + actionsFoundDuringWalk, + actionBindingsInDsl, + evalVersion) + .thenReturn(actionDTO); }) .collectList() .thenReturn(edges); @@ -656,28 +748,32 @@ private Mono<Set<ActionDependencyEdge>> addExplicitUserSetOnLoadActionsToGraph(S * This function also updates `edges` by adding all the new relationships for the said action in the set. * * @param edges - * @param action + * @param entityDependencyNode * @param bindingsFromActions * @param actionsFoundDuringWalk */ - private void extractAndSetActionBindingsInGraphEdges(Set<ActionDependencyEdge> edges, - ActionDTO action, - Set<String> bindingsFromActions, - Set<String> actionsFoundDuringWalk) { + private Mono<Void> extractAndSetActionBindingsInGraphEdges(EntityDependencyNode entityDependencyNode, + Set<ActionDependencyEdge> edges, + Set<String> bindingsFromActions, + Mono<Map<String, ActionDTO>> actionNameToActionMapMono, + Map<String, EntityDependencyNode> actionsFoundDuringWalk, + Set<EntityDependencyNode> bindingsInDsl, + int evalVersion) { + ActionDTO action = entityDependencyNode.getActionDTO(); // Check if the action has been deleted in unpublished state. If yes, ignore it. if (action.getDeletedAt() != null) { - return; + return Mono.empty().then(); } - String name = action.getValidName(); + String name = entityDependencyNode.getValidEntityName(); - if (actionsFoundDuringWalk.contains(name)) { + if (actionsFoundDuringWalk.containsKey(name)) { // This action has already been found in our walk. Ignore this. - return; + return Mono.empty().then(); } - actionsFoundDuringWalk.add(name); + actionsFoundDuringWalk.put(name, entityDependencyNode); Map<String, Set<String>> actionBindingMap = getActionBindingMap(action); @@ -685,32 +781,30 @@ private void extractAndSetActionBindingsInGraphEdges(Set<ActionDependencyEdge> e actionBindingMap.values().stream().forEach(bindings -> allBindings.addAll(bindings)); // TODO : Throw an error on action save when bindings from dynamic binding path list do not match the json path keys - // and get the client to recompute the dynamic binding path list and try again. + // and get the client to recompute the dynamic binding path list and try again. if (!allBindings.containsAll(action.getJsonPathKeys())) { Set<String> invalidBindings = new HashSet<>(action.getJsonPathKeys()); invalidBindings.removeAll(allBindings); - log.error("Invalid dynamic binding path list for action id {}. Not taking the following bindings in " + - "consideration for computing on page load actions : {}", - action.getId(), - invalidBindings); + log.error("Invalid dynamic binding path list for action id {}. Not taking the following bindings in " + "consideration for computing on page load actions : {}", action.getId(), invalidBindings); } Set<String> bindingPaths = actionBindingMap.keySet(); - for (String bindingPath : bindingPaths) { - Set<String> dynamicBindings = actionBindingMap.get(bindingPath); - for (String binding : dynamicBindings) { - Set<String> entityPaths = getWordsFromMustache(binding); - for (String source : entityPaths) { - // TODO : Since its words from binding instead of possible parents Api1 would be recognized as - // source instead of Api1.data (since getWordsFromMustache would split Api1 and data from Api1.data) - ActionDependencyEdge edge = new ActionDependencyEdge(source, bindingPath); - edges.add(edge); - } - // Add all the binding words further examination for dependencies in the future. - bindingsFromActions.addAll(entityPaths); - } - } + return Flux.fromIterable(bindingPaths).flatMap(bindingPath -> { + EntityDependencyNode actionDependencyNode = new EntityDependencyNode(entityDependencyNode.getEntityReferenceType(), entityDependencyNode.getValidEntityName(), bindingPath, null, false, action); + return getPossibleEntityReferences(actionNameToActionMapMono, actionBindingMap.get(bindingPath), evalVersion, bindingsInDsl) + .flatMapMany(Flux::fromIterable) + .map(relatedDependencyNode -> { + bindingsFromActions.add(relatedDependencyNode.getReferenceString()); + ActionDependencyEdge edge = new ActionDependencyEdge(relatedDependencyNode, actionDependencyNode); + edges.add(edge); + return relatedDependencyNode; + }) + .collectList(); + }) + .collectList() + .then(); + } /** @@ -720,53 +814,46 @@ private void extractAndSetActionBindingsInGraphEdges(Set<ActionDependencyEdge> e * * @param edges * @param widgetBindingMap - * @param allActionNames * @return */ private Mono<Set<ActionDependencyEdge>> addWidgetRelationshipToGraph(Set<ActionDependencyEdge> edges, Map<String, Set<String>> widgetBindingMap, - Set<String> allActionNames) { + int evalVersion) { + final int entityTypes = WIDGET_ENTITY_REFERENCES; // This part will ensure that we are discovering widget to widget relationships. - return Mono.just(widgetBindingMap) - .map(widgetDynamicBindingsMap -> { - widgetDynamicBindingsMap.forEach((widgetPath, widgetDynamicBindings) -> { - - // Given the widget path, add all the relationships between the binding to the path - widgetDynamicBindings.stream().forEach(binding -> { - Set<String> entityPaths = getWordsFromMustache(binding); - for (String source : entityPaths) { - - // Only add widget to widget relationships. Skip adding the action to widget relationship - // since this has already been recognized in step 1 of addDirectlyReferencedActionsToGraph - Set<String> possibleParents = getPossibleParents(source); - - Boolean interestingRelationship = TRUE; - for (String entity : possibleParents) { - - // if this generated entity name from the binding matches an action name, skip this - // entityPath entirely since this relationship has already been captured. - if (allActionNames.contains(entity)) { - interestingRelationship = FALSE; - } + return Flux.fromIterable(widgetBindingMap.entrySet()) + .flatMap(widgetBindingEntries -> getPossibleEntityParentsMap(widgetBindingEntries.getValue(), entityTypes, evalVersion) + .map(possibleParentsMap -> { + possibleParentsMap.entrySet().stream().forEach(entry -> { + + if (entry.getValue() == null || entry.getValue().isEmpty()) { + return; } - if (interestingRelationship) { - ActionDependencyEdge edge = new ActionDependencyEdge(source, widgetPath); - edges.add(edge); + String widgetPath = widgetBindingEntries.getKey().trim(); + String[] widgetPathParts = widgetPath.split("\\."); + String widgetName = widgetPath; + if (widgetPathParts.length > 0) { + widgetName = widgetPathParts[0]; } - } - }); + EntityDependencyNode entityDependencyNode = new EntityDependencyNode(EntityReferenceType.WIDGET, widgetName, widgetPath, null, null, null); + entry.getValue().stream().forEach(widgetDependencyNode -> { + ActionDependencyEdge edge = new ActionDependencyEdge(widgetDependencyNode, entityDependencyNode); + edges.add(edge); + }); - }); - return widgetDynamicBindingsMap; - }) - .thenReturn(edges); + }); + return possibleParentsMap; + + })) + .collectList() + .then(Mono.just(edges)); + } private boolean hasUserSetActionToNotRunOnPageLoad(ActionDTO unpublishedAction) { - if (TRUE.equals(unpublishedAction.getUserSetOnLoad()) - && !TRUE.equals(unpublishedAction.getExecuteOnLoad())) { + if (TRUE.equals(unpublishedAction.getUserSetOnLoad()) && !TRUE.equals(unpublishedAction.getExecuteOnLoad())) { return true; } @@ -877,21 +964,22 @@ private Map<String, Set<String>> getActionBindingMap(ActionDTO action) { * Dropdown1.options[1] -> Dropdown1.options * Dropdown1.options -> Dropdown1 * - * @param path + * @param entityDependencyNode * @return */ - private Set<ActionDependencyEdge> generateParentChildRelationships(String path) { + private Set<ActionDependencyEdge> generateParentChildRelationships(EntityDependencyNode entityDependencyNode) { Set<ActionDependencyEdge> edges = new HashSet<>(); String parent; while (true) { try { - Matcher matcher = parentPattern.matcher(path); + Matcher matcher = parentPattern.matcher(entityDependencyNode.getReferenceString()); matcher.find(); parent = matcher.group(1); - edges.add(new ActionDependencyEdge(path, parent)); - path = parent; + EntityDependencyNode parentDependencyNode = new EntityDependencyNode(entityDependencyNode.getEntityReferenceType(), entityDependencyNode.getValidEntityName(), parent, entityDependencyNode.getIsAsync(), entityDependencyNode.getIsFunctionCall(), entityDependencyNode.getActionDTO()); + edges.add(new ActionDependencyEdge(entityDependencyNode, parentDependencyNode)); + entityDependencyNode = parentDependencyNode; } catch (IllegalStateException | IndexOutOfBoundsException e) { // No matches being found. Break out of infinite loop break; @@ -910,13 +998,13 @@ private Set<ActionDependencyEdge> generateParentChildRelationships(String path) * - If sync function, ignore. This is because client would execute the same during dynamic binding eval * - If async function, it is a candidate only if the data for the function is referred in the dynamic binding. * - * @param allActionNames + * @param actionNameToActionMap * @param vertex * @param pageLoadActionsLevelMap * @param existingPageLoadActions * @return */ - private Set<String> actionCandidatesForPageLoadFromBinding(Set<String> allActionNames, + private Set<String> actionCandidatesForPageLoadFromBinding(Map<String, ActionDTO> actionNameToActionMap, String vertex, Map<String, Integer> pageLoadActionsLevelMap, List<Set<String>> existingPageLoadActions, @@ -929,7 +1017,7 @@ private Set<String> actionCandidatesForPageLoadFromBinding(Set<String> allAction for (String entity : possibleParents) { // if this generated entity name from the binding matches an action name check for its eligibility - if (allActionNames.contains(entity)) { + if (actionNameToActionMap.containsKey(entity)) { Boolean isCandidateForPageLoad = TRUE; @@ -943,11 +1031,16 @@ private Set<String> actionCandidatesForPageLoadFromBinding(Set<String> allAction String validBinding; if (explicitUserSetOnLoadActions.contains(entity)) { validBinding = entity + "." + "actionConfiguration"; - } - else { + } else { validBinding = entity + "." + "data"; } + // If the reference is to a sync JS function, discard it from the scheduling order + ActionDTO actionDTO = actionNameToActionMap.get(entity); + if (PluginType.JS.equals(actionDTO.getPluginType()) && FALSE.equals(actionDTO.getActionConfiguration().getIsAsync())) { + isCandidateForPageLoad = FALSE; + } + if (!vertex.contains(validBinding)) { isCandidateForPageLoad = FALSE; } @@ -969,27 +1062,6 @@ private Set<String> actionCandidatesForPageLoadFromBinding(Set<String> allAction return onPageLoadCandidates; } - private boolean isAsyncJsFunctionCall(ActionDTO action, String binding) { - if (PluginType.JS.equals(action.getPluginType()) && - TRUE.equals(action.getActionConfiguration().getIsAsync())) { - - // This function is ASYNC. Now check if the binding is a function call. If yes, then this action would not - // be a candidate for on page load. - String name = action.getValidName(); - - // Regex pattern to check for actionname(parameter1, parameter2..) where no parameters are also allowed. - String regexForFunctionCall = name + "\\([^\\)]*\\)(\\.[^\\)]*\\))?"; - Pattern functionCallPattern = Pattern.compile(regexForFunctionCall); - Matcher matcher = functionCallPattern.matcher(binding); - - if (matcher.find()) { - return TRUE; - } - } - - return FALSE; - } - private DslActionDTO getDslAction(ActionDTO actionDTO) { DslActionDTO dslActionDTO = new DslActionDTO(); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/SeedMongoData.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/SeedMongoData.java index 1e261315b55a..7cf9f3bb8927 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/SeedMongoData.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/SeedMongoData.java @@ -5,7 +5,7 @@ import com.appsmith.server.domains.Application; import com.appsmith.server.domains.Page; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.PricingPlan; import com.appsmith.server.domains.Tenant; import com.appsmith.server.domains.User; @@ -31,15 +31,12 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import javax.swing.Spring; - 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.MANAGE_USERS; diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java index 5b57c574d10d..4f1311574bf3 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java @@ -7,10 +7,10 @@ import com.appsmith.server.domains.Layout; import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ActionCollectionMoveDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.LayoutDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.dtos.RefactorActionCollectionNameDTO; @@ -916,7 +916,7 @@ public void testMoveCollection_toValidPage_returnsCollection() throws IOExceptio .thenReturn(jsonObject); Mockito - .when(layoutActionService.updateLayout(Mockito.any(), Mockito.any(), Mockito.any())) + .when(layoutActionService.updateLayout(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(Mono.just(layout)); final Mono<ActionCollectionDTO> actionCollectionDTOMono = layoutCollectionService.moveCollection(actionCollectionMoveDTO); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceTest.java index 03e164b883f9..887c9d07f8ff 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceTest.java @@ -11,12 +11,12 @@ import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ActionCollectionViewDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.LayoutDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.dtos.PluginWorkspaceDTO; 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 3df70355a8e8..30e14e52fe80 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 @@ -2,10 +2,12 @@ import com.appsmith.external.helpers.AppsmithBeanUtils; import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.BaseDomain; import com.appsmith.external.models.Datasource; import com.appsmith.external.models.DatasourceConfiguration; import com.appsmith.external.models.JSValue; +import com.appsmith.external.models.PluginType; import com.appsmith.external.models.Policy; import com.appsmith.external.plugins.PluginExecutor; import com.appsmith.server.acl.AclPermission; @@ -20,13 +22,11 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; import com.appsmith.server.domains.QNewAction; import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; import com.appsmith.server.dtos.ApplicationAccessDTO; import com.appsmith.server.dtos.ApplicationPagesDTO; import com.appsmith.server.dtos.PageDTO; @@ -1645,7 +1645,7 @@ public void cloneApplication_withActionAndActionCollection_success() { return Mono.zip( layoutCollectionService.createCollection(actionCollectionDTO), layoutActionService.createSingleAction(action), - layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout), + layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout), Mono.just(application) ); }) @@ -1736,9 +1736,9 @@ public void cloneApplication_withActionAndActionCollection_success() { newPage.getUnpublishedPage() .getLayouts() .forEach(layout -> { - assertThat(layout.getLayoutOnLoadActions()).hasSize(1); + assertThat(layout.getLayoutOnLoadActions()).hasSize(2); layout.getLayoutOnLoadActions().forEach(dslActionDTOS -> { - assertThat(dslActionDTOS).hasSize(2); + assertThat(dslActionDTOS).hasSize(1); dslActionDTOS.forEach(actionDTO -> { assertThat(actionDTO.getId()).isEqualTo(actionDTO.getDefaultActionId()); if (StringUtils.hasLength(actionDTO.getCollectionId())) { @@ -1974,10 +1974,20 @@ public void cloneApplication_withDeletedActionInActionCollection_deletedActionIs return Mono.zip( layoutCollectionService.createCollection(actionCollectionDTO), layoutActionService.createSingleAction(action), - layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout), - Mono.just(application) + Mono.just(application), + Mono.just(testPage), + Mono.just(layout) ); }) + .flatMap(tuple -> { + PageDTO testPage = tuple.getT4(); + Layout layout = tuple.getT5(); + return Mono.zip( + Mono.just(tuple.getT1()), + Mono.just(tuple.getT2()), + layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout), + Mono.just(tuple.getT3())); + }) .flatMap(tuple -> { List<String> pageIds = new ArrayList<>(), collectionIds = new ArrayList<>(); ActionCollectionDTO collectionDTO = tuple.getT1(); @@ -2072,9 +2082,9 @@ public void cloneApplication_withDeletedActionInActionCollection_deletedActionIs newPage.getUnpublishedPage() .getLayouts() .forEach(layout -> { - assertThat(layout.getLayoutOnLoadActions()).hasSize(1); + assertThat(layout.getLayoutOnLoadActions()).hasSize(2); layout.getLayoutOnLoadActions().forEach(dslActionDTOS -> { - assertThat(dslActionDTOS).hasSize(2); + assertThat(dslActionDTOS).hasSize(1); dslActionDTOS.forEach(actionDTO -> { assertThat(actionDTO.getId()).isEqualTo(actionDTO.getDefaultActionId()); if (StringUtils.hasLength(actionDTO.getCollectionId())) { 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 6c96b9c59595..147bacd8281a 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 @@ -9,7 +9,7 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java index c7a6e406ed44..0195aa043f17 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java @@ -20,7 +20,7 @@ import com.appsmith.server.domains.Plugin; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; 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 804d9c47dc93..68e6f0fb09ee 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 @@ -19,12 +19,12 @@ import com.appsmith.server.domains.Layout; import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationImportDTO; import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.dtos.GitCommitDTO; @@ -1037,7 +1037,7 @@ public void detachRemote_applicationWithActionAndActionCollection_Success() { return Mono.zip( layoutActionService.createSingleAction(action) - .then(layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout)), + .then(layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout)), layoutCollectionService.createCollection(actionCollectionDTO) ) .map(tuple2 -> application); @@ -1991,7 +1991,7 @@ public void createBranch_validCreateBranchRequest_newApplicationCreated() throws return Mono.zip( layoutActionService.createSingleActionWithBranch(action, null) - .then(layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout)), + .then(layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout)), layoutCollectionService.createCollection(actionCollectionDTO, null) ) .then(gitService.connectApplicationToGit(application.getId(), gitConnectDTO, "origin")); 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 75ed7ba7aca5..bffc01e2ce58 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 @@ -11,11 +11,11 @@ import com.appsmith.server.domains.Layout; import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.DslActionDTO; import com.appsmith.server.dtos.LayoutActionUpdateDTO; import com.appsmith.server.dtos.LayoutDTO; @@ -68,8 +68,10 @@ import static com.appsmith.server.acl.AclPermission.READ_ACTIONS; import static com.appsmith.server.acl.AclPermission.READ_PAGES; import static com.appsmith.server.constants.FieldName.DEFAULT_PAGE_LAYOUT; +import static com.mongodb.assertions.Assertions.assertNull; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -138,6 +140,10 @@ public class LayoutActionServiceTest { ObjectMapper objectMapper = new ObjectMapper(); + Plugin installed_plugin; + + Plugin installedJsPlugin; + @BeforeEach @WithUserDetails(value = "api_user") public void setup() { @@ -186,7 +192,7 @@ public void setup() { layout.setDsl(dsl); layout.setPublishedDsl(dsl); - layoutActionService.updateLayout(pageId, layout.getId(), layout).block(); + layoutActionService.updateLayout(pageId, testApp.getId(), layout.getId(), layout).block(); testPage = newPageService.findPageById(pageId, READ_PAGES, false).block(); } @@ -216,13 +222,13 @@ public void setup() { datasource = new Datasource(); datasource.setName("Default Database"); datasource.setWorkspaceId(workspaceId); - Plugin installed_plugin = pluginRepository.findByPackageName("installed-plugin").block(); + installed_plugin = pluginRepository.findByPackageName("installed-plugin").block(); datasource.setPluginId(installed_plugin.getId()); jsDatasource = new Datasource(); jsDatasource.setName("Default JS Database"); jsDatasource.setWorkspaceId(workspaceId); - Plugin installedJsPlugin = pluginRepository.findByPackageName("installed-js-plugin").block(); + installedJsPlugin = pluginRepository.findByPackageName("installed-js-plugin").block(); assert installedJsPlugin != null; jsDatasource.setPluginId(installedJsPlugin.getId()); } @@ -353,10 +359,13 @@ public void updateActionUpdatesLayout() { .create(resultMono) .assertNext(page -> { assertThat(page.getLayouts()).hasSize(1); - assertThat(page.getLayouts().get(0).getLayoutOnLoadActions()).hasSize(1); - Set<DslActionDTO> dslActionDTOS = page.getLayouts().get(0).getLayoutOnLoadActions().get(0); - assertThat(dslActionDTOS).hasSize(2); - assertThat(dslActionDTOS.stream().map(dto -> dto.getName()).collect(Collectors.toSet())).containsAll(Set.of("query1", "jsObject.jsFunction")); + assertThat(page.getLayouts().get(0).getLayoutOnLoadActions()).hasSize(2); + Set<DslActionDTO> dslActionDTOS1 = page.getLayouts().get(0).getLayoutOnLoadActions().get(0); + assertThat(dslActionDTOS1).hasSize(1); + assertThat(dslActionDTOS1.stream().map(dto -> dto.getName()).collect(Collectors.toSet())).containsAll(Set.of("jsObject.jsFunction")); + Set<DslActionDTO> dslActionDTOS2 = page.getLayouts().get(0).getLayoutOnLoadActions().get(1); + assertThat(dslActionDTOS2).hasSize(1); + assertThat(dslActionDTOS2.stream().map(dto -> dto.getName()).collect(Collectors.toSet())).containsAll(Set.of("query1")); }) .verifyComplete(); } @@ -393,7 +402,7 @@ public void refactorActionName() { ActionDTO createdAction = layoutActionService.createSingleAction(action).block(); - LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), testApp.getId(), layout.getId(), layout).block(); RefactorActionNameDTO refactorActionNameDTO = new RefactorActionNameDTO(); @@ -457,7 +466,7 @@ public void refactorActionName_forGitConnectedAction_success() { ActionDTO createdAction = layoutActionService.createSingleAction(action).block(); - LayoutDTO firstLayout = layoutActionService.updateLayout(gitConnectedPage.getId(), layout.getId(), layout, branchName).block(); + LayoutDTO firstLayout = layoutActionService.updateLayout(gitConnectedPage.getId(), gitConnectedPage.getApplicationId(), layout.getId(), layout, branchName).block(); RefactorActionNameDTO refactorActionNameDTO = new RefactorActionNameDTO(); @@ -511,7 +520,7 @@ public void refactorActionNameToDeletedName() { ActionDTO firstAction = layoutActionService.createSingleAction(action).block(); layout.setDsl(layoutActionService.unescapeMongoSpecialCharacters(layout)); - LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).block(); applicationPageService.publish(testPage.getApplicationId(), true).block(); @@ -568,7 +577,7 @@ public void testRefactorActionName_withInvalidName_throwsError() { ActionDTO createdAction = layoutActionService.createSingleAction(action).block(); - LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).block(); RefactorActionNameDTO refactorActionNameDTO = new RefactorActionNameDTO(); refactorActionNameDTO.setPageId(testPage.getId()); @@ -622,7 +631,7 @@ public void actionExecuteOnLoadChangeOnUpdateLayout() { ActionDTO createdAction1 = layoutActionService.createSingleAction(action1).block(); ActionDTO createdAction2 = layoutActionService.createSingleAction(action2).block(); - Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout); + Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout); StepVerifier.create(updateLayoutMono) .assertNext(updatedLayout -> { @@ -651,7 +660,7 @@ public void actionExecuteOnLoadChangeOnUpdateLayout() { layout.setDsl(dsl); - updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout); + updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout); StepVerifier.create(updateLayoutMono) .assertNext(updatedLayout -> { @@ -744,7 +753,7 @@ public void tableWidgetKeyEscape() { Layout layout = testPage.getLayouts().get(0); layout.setDsl(dsl); - Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).cache(); + Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).cache(); Mono<PageDTO> pageFromRepoMono = updateLayoutMono.then(newPageService.findPageById(testPage.getId(), READ_PAGES, false)); @@ -812,7 +821,7 @@ public void refactorDuplicateActionName() { // Now save this action directly in the repo to create a duplicate action name scenario actionRepository.save(duplicateNameCompleteAction).block(); - LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).block(); RefactorActionNameDTO refactorActionNameDTO = new RefactorActionNameDTO(); refactorActionNameDTO.setPageId(testPage.getId()); @@ -888,7 +897,7 @@ public void tableWidgetKeyEscapeRefactorName() { Layout layout = testPage.getLayouts().get(0); layout.setDsl(dsl); - layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).block(); RefactorNameDTO refactorNameDTO = new RefactorNameDTO(); refactorNameDTO.setPageId(testPage.getId()); @@ -929,7 +938,7 @@ public void simpleWidgetNameRefactor() { Layout layout = testPage.getLayouts().get(0); layout.setDsl(dsl); - layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).block(); RefactorNameDTO refactorNameDTO = new RefactorNameDTO(); refactorNameDTO.setPageId(testPage.getId()); @@ -973,7 +982,7 @@ public void testRefactorWidgetName_forDefaultWidgetsInList_updatesBothWidgetsAnd Layout layout = testPage.getLayouts().get(0); layout.setDsl(dsl); - layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).block(); RefactorNameDTO refactorNameDTO = new RefactorNameDTO(); refactorNameDTO.setPageId(testPage.getId()); @@ -1005,7 +1014,7 @@ public void testWidgetNameRefactor_withSimpleUpdate_refactorsActionCollectionAnd Layout layout = testPage.getLayouts().get(0); layout.setDsl(dsl); - layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).block(); // Create an action collection that refers to the table ActionCollectionDTO actionCollectionDTO1 = new ActionCollectionDTO(); @@ -1131,14 +1140,14 @@ public void OnLoadActionsWhenActionDependentOnActionViaWidget() { ActionDTO createdAction1 = layoutActionService.createSingleAction(action1).block(); ActionDTO createdAction2 = layoutActionService.createSingleAction(action2).block(); - Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout); + Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout); StepVerifier.create(updateLayoutMono) .assertNext(updatedLayout -> { assertThat(updatedLayout.getLayoutOnLoadActions().size()).isEqualTo(2); - // Assert that both the actions dont belong to the same set. They should be run iteratively. + // Assert that both the actions don't belong to the same set. They should be run iteratively. DslActionDTO actionDTO = updatedLayout.getLayoutOnLoadActions().get(0).iterator().next(); assertThat(actionDTO.getName()).isEqualTo("firstAction"); @@ -1155,7 +1164,7 @@ public void OnLoadActionsWhenActionDependentOnActionViaWidget() { public void simpleOnPageLoadActionCreationTest() throws JsonProcessingException { Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any())).thenReturn(Mono.just(new MockPluginExecutor())); - // This action should be tagged as on page load since its used by firstWidget + // This action should be tagged as on page load since it is used by firstWidget ActionDTO action1 = new ActionDTO(); action1.setName("firstAction"); action1.setPageId(testPage.getId()); @@ -1228,7 +1237,7 @@ public void simpleOnPageLoadActionCreationTest() throws JsonProcessingException return layoutActionService.updateSingleAction(savedAction.getId(), updates); }).block(); - Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout); + Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout); StepVerifier.create(updateLayoutMono) .assertNext(updatedLayout -> { @@ -1372,7 +1381,7 @@ public void OnLoadActionsWhenActionDependentOnWidgetButNotPageLoadCandidate() { ActionDTO createdAction1 = layoutActionService.createSingleAction(action1).block(); ActionDTO createdAction2 = layoutActionService.createSingleAction(action2).block(); - Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout); + Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout); StepVerifier.create(updateLayoutMono) .assertNext(updatedLayout -> { @@ -1399,7 +1408,7 @@ public void testUpdateLayout_withSelfReferencingWidget_updatesLayout() { JSONObject firstWidget = new JSONObject(); firstWidget.put("widgetName", "firstWidget"); JSONArray temp = new JSONArray(); - temp.addAll(List.of(new JSONObject(Map.of("key", "testField")))); + temp.add(new JSONObject(Map.of("key", "testField"))); firstWidget.put("dynamicBindingPathList", temp); firstWidget.put("testField", "{{ firstWidget.testField }}"); children.add(firstWidget); @@ -1410,7 +1419,7 @@ public void testUpdateLayout_withSelfReferencingWidget_updatesLayout() { layout.setDsl(parentDsl); - Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout); + Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout); StepVerifier.create(updateLayoutMono) .assertNext(layoutDTO -> { @@ -1464,16 +1473,22 @@ public void testExecuteOnPageLoadOrderWhenAllActionsAreOnlyExplicitlySetToExecut layout.setDsl(parentDsl); ActionDTO createdAction1 = layoutActionService.createSingleAction(action1).block(); // create action1 + assertNotNull(createdAction1); createdAction1.setExecuteOnLoad(true); // this can only be set to true post action creation. NewAction newAction1 = new NewAction(); newAction1.setUnpublishedAction(createdAction1); newAction1.setDefaultResources(createdAction1.getDefaultResources()); + newAction1.setPluginId(installed_plugin.getId()); + newAction1.setPluginType(installed_plugin.getType()); ActionDTO createdAction2 = layoutActionService.createSingleAction(action2).block(); // create action2 + assertNotNull(createdAction1); createdAction2.setExecuteOnLoad(true); // this can only be set to true post action creation. NewAction newAction2 = new NewAction(); newAction2.setUnpublishedAction(createdAction2); newAction2.setDefaultResources(createdAction2.getDefaultResources()); + newAction2.setPluginId(installed_plugin.getId()); + newAction2.setPluginType(installed_plugin.getType()); NewAction[] newActionArray = new NewAction[2]; newActionArray[0] = newAction1; @@ -1481,7 +1496,7 @@ public void testExecuteOnPageLoadOrderWhenAllActionsAreOnlyExplicitlySetToExecut Flux<NewAction> newActionFlux = Flux.fromArray(newActionArray); Mockito.when(newActionService.findUnpublishedOnLoadActionsExplicitSetByUserInPage(Mockito.any())).thenReturn(newActionFlux); - Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout); + Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout); StepVerifier.create(updateLayoutMono) .assertNext(updatedLayout -> { @@ -1521,7 +1536,7 @@ public void testPageLoadActionWhenSetBothWaysExplicitlyAndImplicitlyViaWidget() JSONObject dsl = new JSONObject(); dsl.put("widgetName", "firstWidget"); JSONArray temp = new JSONArray(); - temp.addAll(List.of(new JSONObject(Map.of("key", "testField")))); + temp.add(new JSONObject(Map.of("key", "testField"))); dsl.put("dynamicBindingPathList", temp); dsl.put("testField", "{{ firstAction.data }}"); @@ -1529,18 +1544,21 @@ public void testPageLoadActionWhenSetBothWaysExplicitlyAndImplicitlyViaWidget() layout.setDsl(dsl); ActionDTO createdAction1 = layoutActionService.createSingleAction(action1).block(); + assertNotNull(createdAction1); createdAction1.setExecuteOnLoad(true); // this can only be set to true post action creation. createdAction1.setUserSetOnLoad(true); NewAction newAction1 = new NewAction(); newAction1.setUnpublishedAction(createdAction1); newAction1.setDefaultResources(createdAction1.getDefaultResources()); + newAction1.setPluginId(installed_plugin.getId()); + newAction1.setPluginType(installed_plugin.getType()); NewAction[] newActionArray = new NewAction[1]; newActionArray[0] = newAction1; Flux<NewAction> newActionFlux = Flux.fromArray(newActionArray); Mockito.when(newActionService.findUnpublishedOnLoadActionsExplicitSetByUserInPage(Mockito.any())).thenReturn(newActionFlux); - Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout); + Mono<LayoutDTO> updateLayoutMono = layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout); StepVerifier.create(updateLayoutMono) .assertNext(updatedLayout -> { @@ -1578,9 +1596,14 @@ public void introduceCyclicDependencyAndRemoveLater() { JSONObject dsl = new JSONObject(); dsl.put("widgetName", "inputWidget"); JSONArray temp = new JSONArray(); - temp.addAll(List.of(new JSONObject(Map.of("key", "defaultText")))); + temp.add(new JSONObject(Map.of("key", "defaultText"))); dsl.put("dynamicBindingPathList", temp); - dsl.put("defaultText", "{{ \tactionName.data[0].inputWidget}}"); + dsl.put("defaultText", "{{\n" + + "(function(){\n" + + "\tlet inputWidget = \"abc\";\n" + + "\treturn actionName.data;\n" + + "})()\n" + + "}}"); final JSONObject innerObjectReference = new JSONObject(); innerObjectReference.put("k", "{{\tactionName.data[0].inputWidget}}"); @@ -1597,17 +1620,15 @@ public void introduceCyclicDependencyAndRemoveLater() { mainDsl.put("children", objects); layout.setDsl(mainDsl); - LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + LayoutDTO firstLayout = layoutActionService.updateLayout(testPage.getId(), testApp.getId(), layout.getId(), layout).block(); // by default there should be no error in the layout, hence no error should be sent to ActionDTO/ errorReports will be null - if (createdAction.getErrorReports() != null) { - assert (createdAction.getErrorReports() instanceof List || createdAction.getErrorReports() == null); - assert (createdAction.getErrorReports() == null); - } + assertNotNull(createdAction); + assertNull(createdAction.getErrorReports()); // since the dependency has been introduced calling updateLayout will return a LayoutDTO with a populated layoutOnLoadActionErrors - assert (firstLayout.getLayoutOnLoadActionErrors() instanceof List); - assert (firstLayout.getLayoutOnLoadActionErrors().size() == 1); + assertNotNull(firstLayout); + assertEquals(1, firstLayout.getLayoutOnLoadActionErrors().size()); // refactoring action to carry the existing error in DSL RefactorActionNameDTO refactorActionNameDTO = new RefactorActionNameDTO(); @@ -1618,20 +1639,18 @@ public void introduceCyclicDependencyAndRemoveLater() { refactorActionNameDTO.setActionId(createdAction.getId()); Mono<LayoutDTO> layoutDTOMono = layoutActionService.refactorActionName(refactorActionNameDTO); - StepVerifier.create(layoutDTOMono - .map(layoutDTO -> layoutDTO.getLayoutOnLoadActionErrors().size())) - .expectNext(1).verifyComplete(); + StepVerifier.create(layoutDTOMono.map(layoutDTO -> layoutDTO.getLayoutOnLoadActionErrors().size())) + .expectNext(1) + .verifyComplete(); // updateAction to see if the error persists actionDTO.setName("finalActionName"); Mono<ActionDTO> actionDTOMono = layoutActionService.updateSingleActionWithBranchName(createdAction.getId(), actionDTO, null); - StepVerifier.create(actionDTOMono.map( - - actionDTO1 -> actionDTO1.getErrorReports().size() - )) - .expectNext(1).verifyComplete(); + StepVerifier.create(actionDTOMono.map(actionDTO1 -> actionDTO1.getErrorReports().size())) + .expectNext(1) + .verifyComplete(); JSONObject newDsl = new JSONObject(); @@ -1645,9 +1664,10 @@ public void introduceCyclicDependencyAndRemoveLater() { layout.setDsl(mainDsl); - LayoutDTO changedLayoutDTO = layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); - assert (changedLayoutDTO.getLayoutOnLoadActionErrors() instanceof List); - assert (changedLayoutDTO.getLayoutOnLoadActionErrors().size() == 0); + LayoutDTO changedLayoutDTO = layoutActionService.updateLayout(testPage.getId(), testApp.getId(), layout.getId(), layout).block(); + assertNotNull(changedLayoutDTO); + assertNotNull(changedLayoutDTO.getLayoutOnLoadActionErrors()); + assertEquals(0, changedLayoutDTO.getLayoutOnLoadActionErrors().size()); } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutServiceTest.java index 6e2644c1278b..b1cd9d33a2d0 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutServiceTest.java @@ -1,17 +1,17 @@ package com.appsmith.server.services; import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.Datasource; +import com.appsmith.external.models.PluginType; import com.appsmith.external.models.Property; import com.appsmith.server.acl.AclPermission; import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.Application; import com.appsmith.server.domains.Layout; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; -import com.appsmith.server.dtos.ActionDTO; import com.appsmith.server.dtos.DslActionDTO; import com.appsmith.server.dtos.LayoutDTO; import com.appsmith.server.dtos.PageDTO; @@ -25,13 +25,13 @@ import net.minidev.json.JSONObject; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.http.HttpMethod; import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.test.annotation.DirtiesContext; @@ -48,6 +48,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; +import static com.appsmith.server.services.ce.ApplicationPageServiceCEImpl.EVALUATION_VERSION; import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(SpringExtension.class) @@ -64,9 +65,6 @@ public class LayoutServiceTest { @Autowired ApplicationPageService applicationPageService; - @Autowired - ApplicationService applicationService; - @Autowired UserService userService; @@ -91,6 +89,9 @@ public class LayoutServiceTest { Plugin installedJsPlugin; + @SpyBean + AstService astService; + @BeforeEach @WithUserDetails(value = "api_user") public void setup() { @@ -208,7 +209,7 @@ public void updateLayoutInvalidPageId() { Layout startLayout = layoutService.createLayout(page.getId(), testLayout).block(); - Mono<LayoutDTO> updatedLayoutMono = layoutActionService.updateLayout("random-impossible-id-page", startLayout.getId(), updateLayout); + Mono<LayoutDTO> updatedLayoutMono = layoutActionService.updateLayout("random-impossible-id-page", page.getApplicationId(), startLayout.getId(), updateLayout); StepVerifier .create(updatedLayoutMono) @@ -218,6 +219,38 @@ public void updateLayoutInvalidPageId() { .verify(); } + @Test + @WithUserDetails(value = "api_user") + public void updateLayoutInvalidAppId() { + Layout testLayout = new Layout(); + JSONObject obj = new JSONObject(); + obj.put("key", "value"); + testLayout.setDsl(obj); + + PageDTO testPage = new PageDTO(); + testPage.setName("LayoutServiceTest updateLayoutInvalidPageId"); + + Layout updateLayout = new Layout(); + obj = new JSONObject(); + obj.put("key", "value-updated"); + updateLayout.setDsl(obj); + + Application app = new Application(); + app.setName("newApplication-updateLayoutInvalidPageId-Test"); + PageDTO page = createPage(app, testPage).block(); + + Layout startLayout = layoutService.createLayout(page.getId(), testLayout).block(); + + Mono<LayoutDTO> updatedLayoutMono = layoutActionService.updateLayout(page.getId(), "random-impossible-id-app", startLayout.getId(), updateLayout); + + StepVerifier + .create(updatedLayoutMono) + .expectErrorMatches(throwable -> throwable instanceof AppsmithException && + throwable.getMessage().equals(AppsmithError.ACL_NO_RESOURCE_FOUND + .getMessage(FieldName.APPLICATION_ID, "random-impossible-id-app"))) + .verify(); + } + @Test @WithUserDetails(value = "api_user") public void updateLayoutValidPageId() { @@ -246,7 +279,7 @@ public void updateLayoutValidPageId() { PageDTO page = tuple.getT1(); Layout startLayout = tuple.getT2(); startLayout.setDsl(obj1); - return layoutActionService.updateLayout(page.getId(), startLayout.getId(), startLayout); + return layoutActionService.updateLayout(page.getId(), page.getApplicationId(), startLayout.getId(), startLayout); }); StepVerifier @@ -259,28 +292,7 @@ public void updateLayoutValidPageId() { .verifyComplete(); } - /** - * TODO: Comment no longer valid - * This test adds some actions in the page and attaches a few of those in the dynamic bindings in the widgets - * in the layout. An action attached in the widget also has two dependencies on other actions. One of those - * has been explicitly marked to NOT run on page load. This test asserts the following : - * 1. All the actions which must be executed on page load have been recognized correctly - * 2. The sequence of the action execution takes into account the action dependencies - * 3. An action which has been marked to not execute on page load does not get added to the on page load order - */ - @Test - @Tag("performance") - @WithUserDetails(value = "api_user") - public void getActionsExecuteOnLoad() { - Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any())).thenReturn(Mono.just(new MockPluginExecutor())); - - PageDTO testPage = new PageDTO(); - testPage.setName("ActionsExecuteOnLoad Test Page"); - - Application app = new Application(); - app.setName("newApplication-updateLayoutValidPageId-Test"); - - Mono<PageDTO> pageMono = createPage(app, testPage).cache(); + private Mono<LayoutDTO> createComplexAppForExecuteOnLoad(Mono<PageDTO> pageMono) { Mono<LayoutDTO> testMono = pageMono .flatMap(page1 -> { @@ -304,6 +316,15 @@ public void getActionsExecuteOnLoad() { action.setDatasource(datasource); monos.add(layoutActionService.createSingleAction(action)); + // Create another POST API Action + action = new ActionDTO(); + action.setName("anotherPostAction"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.POST); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + // Action aPostActionWithAutoExec depends on [aPostSecondaryAction, aPostTertiaryAction] action = new ActionDTO(); action.setName("aPostActionWithAutoExec"); @@ -451,6 +472,46 @@ public void getActionsExecuteOnLoad() { action.setPluginType(PluginType.JS); monos.add(layoutActionService.createSingleAction(action)); + action = new ActionDTO(); + action.setName("anIgnoredAction"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.GET); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("ignoredAction1"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.GET); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("ignoredAction2"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.GET); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("ignoredAction3"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.GET); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("ignoredAction4"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.GET); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + return Mono.zip(monos, objects -> page1); }) .zipWhen(page1 -> { @@ -473,8 +534,16 @@ public void getActionsExecuteOnLoad() { "widgetName", "testWidget", "key", "value-updated", "another", "Hello people of the {{input1.text}} planet!", - "dynamicGet", "some dynamic {{aGetAction.data}}", - "dynamicPost", "some dynamic {{aPostAction.data}}", + "dynamicGet", "some dynamic {{\"anIgnoredAction.data:\" + aGetAction.data}}", + "dynamicPost", "some dynamic {{\n" + + "(function(ignoredAction1){\n" + + "\tlet a = ignoredAction1.data\n" + + "\tlet ignoredAction2 = { data: \"nothing\" }\n" + + "\tlet b = ignoredAction2.data\n" + + "\tlet c = \"ignoredAction3.data\"\n" + + "\t// ignoredAction4.data\n" + + "\treturn aPostAction.data\n" + + "})(anotherPostAction.data)}}", "dynamicPostWithAutoExec", "some dynamic {{aPostActionWithAutoExec.data}}", "dynamicDelete", "some dynamic {{aDeleteAction.data}}" )); @@ -485,7 +554,7 @@ public void getActionsExecuteOnLoad() { // only add sync function call dependencies in the dependency tree. sync call would be done during eval. "collection4Key", "some dynamic {{Collection.aSyncCollectionActionWithCall()}}" )); - obj.put("dynamicDB", new JSONObject(Map.of("test", "child path {{aDBAction.data.irrelevant}}"))); + obj.put("dynamicDB", new JSONObject(Map.of("test", "child path {{aDBAction.data[0].irrelevant}}"))); obj.put("dynamicDB2", List.of("{{ anotherDBAction.data.optional }}")); obj.put("tableWidget", new JSONObject( Map.of("test", @@ -495,6 +564,7 @@ public void getActionsExecuteOnLoad() { JSONArray dynamicBindingsPathList = new JSONArray(); dynamicBindingsPathList.addAll(List.of( new JSONObject(Map.of("key", "dynamicGet")), + new JSONObject(Map.of("key", "dynamicPost")), new JSONObject(Map.of("key", "dynamicPostWithAutoExec")), new JSONObject(Map.of("key", "dynamicDB.test")), new JSONObject(Map.of("key", "dynamicDB2.0")), @@ -505,38 +575,429 @@ public void getActionsExecuteOnLoad() { new JSONObject(Map.of("key", "collection4Key")) )); + + obj.put("dynamicBindingPathList", dynamicBindingsPathList); + newLayout.setDsl(obj); + + return layoutActionService.updateLayout(page1.getId(), page1.getApplicationId(), layout.getId(), newLayout); + + }); + + return testMono; + } + + private Mono<LayoutDTO> createAppWithAllTypesOfReferencesForExecuteOnLoad(Mono<PageDTO> pageMono) { + + Mono<LayoutDTO> testMono = pageMono + .flatMap(page1 -> { + List<Mono<ActionDTO>> monos = new ArrayList<>(); + + // Create a GET API Action for : aGetAction.data + ActionDTO action = new ActionDTO(); + action.setName("aGetAction"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.GET); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + // Create a POST API Action for : aPostAction.data.users.name + action = new ActionDTO(); + action.setName("aPostAction"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.POST); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + // Create a POST API Action for : anotherPostAction.run() + action = new ActionDTO(); + action.setName("anotherPostAction"); + action.setActionConfiguration(new ActionConfiguration()); + action.getActionConfiguration().setHttpMethod(HttpMethod.POST); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + Datasource d2 = new Datasource(); + d2.setWorkspaceId(datasource.getWorkspaceId()); + d2.setPluginId(installedJsPlugin.getId()); + d2.setIsAutoGenerated(true); + d2.setName("UNUSED_DATASOURCE"); + + action = new ActionDTO(); + action.setName("hiddenAction1"); + action.setActionConfiguration(new ActionConfiguration()); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + // Create an async function for: Collection.anAsyncCollectionActionWithoutCall.data + action = new ActionDTO(); + action.setName("anAsyncCollectionActionWithoutCall"); + action.setFullyQualifiedName("Collection.anAsyncCollectionActionWithoutCall"); + action.setDynamicBindingPathList(List.of(new Property("body", null))); + final ActionConfiguration ac1 = new ActionConfiguration(); + ac1.setBody("hiddenAction1.data"); + ac1.setIsAsync(true); + action.setActionConfiguration(ac1); + action.setDatasource(d2); + action.setPageId(page1.getId()); + action.setPluginType(PluginType.JS); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("hiddenAction2"); + action.setActionConfiguration(new ActionConfiguration()); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + // Create a sync function for: Collection.aSyncCollectionActionWithoutCall.data + action = new ActionDTO(); + action.setName("aSyncCollectionActionWithoutCall"); + action.setFullyQualifiedName("Collection.aSyncCollectionActionWithoutCall"); + action.setDynamicBindingPathList(List.of(new Property("body", null))); + final ActionConfiguration ac2 = new ActionConfiguration(); + ac2.setBody("hiddenAction2.data"); + ac2.setIsAsync(false); + action.setActionConfiguration(ac2); + action.setDatasource(d2); + action.setPageId(page1.getId()); + action.setPluginType(PluginType.JS); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("hiddenAction3"); + action.setActionConfiguration(new ActionConfiguration()); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + // Create an async function for: Collection.anAsyncCollectionActionWithCall() + action = new ActionDTO(); + action.setName("anAsyncCollectionActionWithCall"); + action.setFullyQualifiedName("Collection.anAsyncCollectionActionWithCall"); + action.setDynamicBindingPathList(List.of(new Property("body", null))); + final ActionConfiguration ac3 = new ActionConfiguration(); + ac3.setBody("hiddenAction3.data"); + ac3.setIsAsync(true); + action.setActionConfiguration(ac3); + action.setDatasource(d2); + action.setPageId(page1.getId()); + action.setPluginType(PluginType.JS); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("hiddenAction4"); + action.setActionConfiguration(new ActionConfiguration()); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + // Create a sync function for: Collection.aSyncCollectionActionWithCall() + action = new ActionDTO(); + action.setName("aSyncCollectionActionWithCall"); + action.setFullyQualifiedName("Collection.aSyncCollectionActionWithCall"); + final ActionConfiguration ac4 = new ActionConfiguration(); + ac4.setBody("hiddenAction4.data"); + ac4.setIsAsync(false); + action.setActionConfiguration(ac4); + action.setDatasource(d2); + action.setPageId(page1.getId()); + action.setPluginType(PluginType.JS); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("hiddenAction5"); + action.setActionConfiguration(new ActionConfiguration()); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + // Create a sync function for: Collection.data() + action = new ActionDTO(); + action.setName("data"); + action.setFullyQualifiedName("Collection.data"); + final ActionConfiguration ac5 = new ActionConfiguration(); + ac5.setBody("hiddenAction5.data"); + ac5.setIsAsync(false); + action.setActionConfiguration(ac5); + action.setDatasource(d2); + action.setPageId(page1.getId()); + action.setPluginType(PluginType.JS); + monos.add(layoutActionService.createSingleAction(action)); + + action = new ActionDTO(); + action.setName("hiddenAction6"); + action.setActionConfiguration(new ActionConfiguration()); + action.setPageId(page1.getId()); + action.setDatasource(datasource); + monos.add(layoutActionService.createSingleAction(action)); + + // Create an async function for: Collection2.data() + action = new ActionDTO(); + action.setName("data"); + action.setFullyQualifiedName("Collection2.data"); + final ActionConfiguration ac6 = new ActionConfiguration(); + ac6.setBody("hiddenAction6.data"); + ac6.setIsAsync(true); + action.setActionConfiguration(ac6); + action.setDatasource(d2); + action.setPageId(page1.getId()); + action.setPluginType(PluginType.JS); + monos.add(layoutActionService.createSingleAction(action)); + + return Mono.zip(monos, objects -> page1); + }) + .zipWhen(page1 -> { + Layout layout = new Layout(); + + JSONObject obj = new JSONObject(Map.of( + "key", "value" + )); + layout.setDsl(obj); + + return layoutService.createLayout(page1.getId(), layout); + }) + .flatMap(tuple2 -> { + final PageDTO page1 = tuple2.getT1(); + final Layout layout = tuple2.getT2(); + + Layout newLayout = new Layout(); + + JSONObject obj = new JSONObject(Map.of( + "widgetName", "testWidget", + "k1", "{{ aGetAction.data }}", + "k2", "{{ aPostAction.data.users.name }}", + "k3", "{{ anotherPostAction.run() }}", + "k4", "{{ Collection.anAsyncCollectionActionWithoutCall.data }}", + "k5", "{{ Collection.aSyncCollectionActionWithoutCall.data }}", + "k6", "{{ Collection.anAsyncCollectionActionWithCall() }}", + "k7", "{{ Collection.aSyncCollectionActionWithCall() }}" + )); + obj.putAll(Map.of( + "k8", "{{ Collection.data() }}", + "k9", "{{ Collection2.data() }}" + )); + JSONArray dynamicBindingsPathList = new JSONArray(); + dynamicBindingsPathList.addAll(List.of( + new JSONObject(Map.of("key", "k1")), + new JSONObject(Map.of("key", "k2")), + new JSONObject(Map.of("key", "k3")), + new JSONObject(Map.of("key", "k4")), + new JSONObject(Map.of("key", "k5")), + new JSONObject(Map.of("key", "k6")), + new JSONObject(Map.of("key", "k7")), + new JSONObject(Map.of("key", "k8")), + new JSONObject(Map.of("key", "k9")) + )); + obj.put("dynamicBindingPathList", dynamicBindingsPathList); newLayout.setDsl(obj); - return layoutActionService.updateLayout(page1.getId(), layout.getId(), newLayout); + return layoutActionService.updateLayout(page1.getId(), page1.getApplicationId(), layout.getId(), newLayout); }); + + return testMono; + } + + @Test + @WithUserDetails(value = "api_user") + public void getActionsExecuteOnLoadWithAstLogic_withAllTypesOfActionReferences() { + Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any())).thenReturn(Mono.just(new MockPluginExecutor())); + + PageDTO testPage = new PageDTO(); + testPage.setName("ActionsExecuteOnLoad Test Page1 Universal"); + + Application app = new Application(); + app.setName("newApplication-updateLayoutValidPageId-TestWithAst-Universal"); + + Mono<PageDTO> pageMono = createPage(app, testPage).cache(); + + Mono<LayoutDTO> testMono = createAppWithAllTypesOfReferencesForExecuteOnLoad(pageMono); + + + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("aGetAction.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aGetAction.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("aPostAction.data.users.name", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aPostAction.data.users.name")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("anotherPostAction.run()", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("anotherPostAction.run")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.anAsyncCollectionActionWithoutCall.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.anAsyncCollectionActionWithoutCall.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.aSyncCollectionActionWithoutCall.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.aSyncCollectionActionWithoutCall.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.anAsyncCollectionActionWithCall()", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.anAsyncCollectionActionWithCall")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.aSyncCollectionActionWithCall()", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.aSyncCollectionActionWithCall")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.data()", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection2.data()", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection2.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("hiddenAction1.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("hiddenAction1.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("hiddenAction2.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("hiddenAction2.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("hiddenAction4.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("hiddenAction4.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("hiddenAction5.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("hiddenAction5.data")))); + StepVerifier .create(testMono) .assertNext(layout -> { assertThat(layout).isNotNull(); assertThat(layout.getId()).isNotNull(); - assertThat(layout.getDsl().get("key")).isEqualTo("value-updated"); assertThat(layout.getLayoutOnLoadActions()).hasSize(3); + Set<String> firstSetPageLoadActions = Set.of( + "aGetAction", + "hiddenAction1", + "hiddenAction2", + "hiddenAction4", + "hiddenAction5" + ); + + Set<String> secondSetPageLoadActions = Set.of( + "aPostAction" + ); + + Set<String> thirdSetPageLoadActions = Set.of( + "Collection.anAsyncCollectionActionWithoutCall" + ); + + assertThat(layout.getLayoutOnLoadActions().get(0).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) + .hasSameElementsAs(firstSetPageLoadActions); + assertThat(layout.getLayoutOnLoadActions().get(1).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) + .hasSameElementsAs(secondSetPageLoadActions); + assertThat(layout.getLayoutOnLoadActions().get(2).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) + .hasSameElementsAs(thirdSetPageLoadActions); + Set<DslActionDTO> flatOnLoadActions = new HashSet<>(); + for (Set<DslActionDTO> actions : layout.getLayoutOnLoadActions()) { + flatOnLoadActions.addAll(actions); + } + for (DslActionDTO action : flatOnLoadActions) { + assertThat(action.getId()).isNotBlank(); + assertThat(action.getName()).isNotBlank(); + assertThat(action.getTimeoutInMillisecond()).isNotZero(); + } + }) + .verifyComplete(); + + Mono<Tuple2<ActionDTO, ActionDTO>> actionDTOMono = pageMono.flatMap(page -> { + return newActionService.findByUnpublishedNameAndPageId("aGetAction", page.getId(), AclPermission.MANAGE_ACTIONS) + .zipWith(newActionService.findByUnpublishedNameAndPageId("hiddenAction3", page.getId(), AclPermission.MANAGE_ACTIONS)); + }); + + StepVerifier + .create(actionDTOMono) + .assertNext(tuple -> { + assertThat(tuple.getT1().getExecuteOnLoad()).isTrue(); + assertThat(tuple.getT2().getExecuteOnLoad()).isNotEqualTo(Boolean.TRUE); + }) + .verifyComplete(); + } + + /** + * This test is meant for the newer AST based on page load logic that is meant to work with fat container deployments. + * This test adds some actions in the page and attaches a few of those in the dynamic bindings in the widgets + * in the layout. An action attached in the widget also has two dependencies on other actions. One of those + * has been explicitly marked to NOT run on page load. This test asserts the following : + * 1. All the actions which must be executed on page load have been recognized correctly + * 2. The sequence of the action execution takes into account the action dependencies + * 3. An action which has been marked to not execute on page load does not get added to the on page load order + * 4. Async and sync JS functions when called with a .data reference are marked to run on load + * 5. Async and sync JS function when called as function calls are ignored to be marked on page load + * 6. A string that happens to match an action reference IS NOT marked to run on page load + */ + @Test + @WithUserDetails(value = "api_user") + public void getActionsExecuteOnLoadWithAstLogic() { + Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any())).thenReturn(Mono.just(new MockPluginExecutor())); + + + PageDTO testPage = new PageDTO(); + testPage.setName("ActionsExecuteOnLoad Test Page1"); + + Application app = new Application(); + app.setName("newApplication-updateLayoutValidPageId-TestWithAst"); + + Mono<PageDTO> pageMono = createPage(app, testPage).cache(); + + Mono<LayoutDTO> testMono = createComplexAppForExecuteOnLoad(pageMono); + + + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("\"anIgnoredAction.data:\" + aGetAction.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aGetAction.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding( + "(function(ignoredAction1){\n" + + "\tlet a = ignoredAction1.data\n" + + "\tlet ignoredAction2 = { data: \"nothing\" }\n" + + "\tlet b = ignoredAction2.data\n" + + "\tlet c = \"ignoredAction3.data\"\n" + + "\t// ignoredAction4.data\n" + + "\treturn aPostAction.data\n" + + "})(anotherPostAction.data)", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aPostAction.data", "anotherPostAction.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("aPostActionWithAutoExec.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aPostActionWithAutoExec.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("aDBAction.data[0].irrelevant", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aDBAction.data[0].irrelevant")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("anotherDBAction.data.optional", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("anotherDBAction.data.optional")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("aTableAction.data.child", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aTableAction.data.child")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.anAsyncCollectionActionWithoutCall.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.anAsyncCollectionActionWithoutCall.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.aSyncCollectionActionWithoutCall.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.aSyncCollectionActionWithoutCall.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.anAsyncCollectionActionWithCall()", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.anAsyncCollectionActionWithCall")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("Collection.aSyncCollectionActionWithCall()", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("Collection.aSyncCollectionActionWithCall")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("hiddenAction4.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("hiddenAction4.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("hiddenAction2.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("hiddenAction2.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("hiddenAction1.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("hiddenAction1.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("aPostTertiaryAction.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aPostTertiaryAction.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("aPostSecondaryAction.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("aPostSecondaryAction.data")))); + StepVerifier + .create(testMono) + .assertNext(layout -> { + assertThat(layout).isNotNull(); + assertThat(layout.getId()).isNotNull(); + assertThat(layout.getDsl().get("key")).isEqualTo("value-updated"); + assertThat(layout.getLayoutOnLoadActions()).hasSize(4); + Set<String> firstSetPageLoadActions = Set.of( "aPostTertiaryAction", "aGetAction", "hiddenAction1", "hiddenAction2", - "hiddenAction4" + "hiddenAction4", + "aPostAction", + "anotherPostAction" ); Set<String> secondSetPageLoadActions = Set.of( "aTableAction", - "aDBAction", "anotherDBAction" ); Set<String> thirdSetPageLoadActions = Set.of( + "aDBAction" + ); + + Set<String> fourthSetPageLoadActions = Set.of( "aPostActionWithAutoExec", - "Collection.anAsyncCollectionActionWithoutCall", - "Collection.aSyncCollectionActionWithoutCall" + "Collection.anAsyncCollectionActionWithoutCall" ); assertThat(layout.getLayoutOnLoadActions().get(0).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) .hasSameElementsAs(firstSetPageLoadActions); @@ -544,6 +1005,8 @@ public void getActionsExecuteOnLoad() { .hasSameElementsAs(secondSetPageLoadActions); assertThat(layout.getLayoutOnLoadActions().get(2).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) .hasSameElementsAs(thirdSetPageLoadActions); + assertThat(layout.getLayoutOnLoadActions().get(3).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) + .hasSameElementsAs(fourthSetPageLoadActions); Set<DslActionDTO> flatOnLoadActions = new HashSet<>(); for (Set<DslActionDTO> actions : layout.getLayoutOnLoadActions()) { flatOnLoadActions.addAll(actions); @@ -558,7 +1021,7 @@ public void getActionsExecuteOnLoad() { Mono<Tuple2<ActionDTO, ActionDTO>> actionDTOMono = pageMono.flatMap(page -> { return newActionService.findByUnpublishedNameAndPageId("aGetAction", page.getId(), AclPermission.MANAGE_ACTIONS) - .zipWith(newActionService.findByUnpublishedNameAndPageId("aPostAction", page.getId(), AclPermission.MANAGE_ACTIONS)); + .zipWith(newActionService.findByUnpublishedNameAndPageId("ignoredAction1", page.getId(), AclPermission.MANAGE_ACTIONS)); }); StepVerifier @@ -571,6 +1034,102 @@ public void getActionsExecuteOnLoad() { } + /** + * This test is meant for the older string based on page load logic that persists today for older deployments. + * The expectation is the same as the previous test, except that only valid global references are marked to run on page load. + * (Please refer point #6 in this list) + * This test adds some actions in the page and attaches a few of those in the dynamic bindings in the widgets + * in the layout. An action attached in the widget also has two dependencies on other actions. One of those + * has been explicitly marked to NOT run on page load. This test asserts the following : + * 1. All the actions which must be executed on page load have been recognized correctly + * 2. The sequence of the action execution takes into account the action dependencies + * 3. An action which has been marked to not execute on page load does not get added to the on page load order + * 4. Async and sync JS functions when called with a .data reference are marked to run on load + * 5. Async and sync JS function when called as function calls are ignored to be marked on page load + * 6. A string that happens to match an action reference DOES GET INCORRECTLY marked to run on page load + */ + @Test + @WithUserDetails(value = "api_user") + public void getActionsExecuteOnLoadWithoutAstLogic() { + Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any())).thenReturn(Mono.just(new MockPluginExecutor())); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding(Mockito.anyString(), Mockito.anyInt())).thenCallRealMethod(); + + PageDTO testPage = new PageDTO(); + testPage.setName("ActionsExecuteOnLoad Test Page2"); + + Application app = new Application(); + app.setName("newApplication-updateLayoutValidPageId-TestWithoutAst"); + + Mono<PageDTO> pageMono = createPage(app, testPage).cache(); + + Mono<LayoutDTO> testMono = createComplexAppForExecuteOnLoad(pageMono); + + StepVerifier + .create(testMono) + .assertNext(layout -> { + assertThat(layout).isNotNull(); + assertThat(layout.getId()).isNotNull(); + assertThat(layout.getDsl().get("key")).isEqualTo("value-updated"); + assertThat(layout.getLayoutOnLoadActions()).hasSize(3); + + Set<String> firstSetPageLoadActions = Set.of( + "aPostTertiaryAction", + "aGetAction", + "hiddenAction1", + "hiddenAction2", + "hiddenAction4", + "anIgnoredAction", + "aDBAction", + "aPostAction", + "anotherPostAction", + "ignoredAction1", + "ignoredAction2", + "ignoredAction3", + "ignoredAction4" + ); + + Set<String> secondSetPageLoadActions = Set.of( + "aTableAction", + "anotherDBAction" + ); + + Set<String> thirdSetPageLoadActions = Set.of( + "aPostActionWithAutoExec", + "Collection.anAsyncCollectionActionWithoutCall" + ); + assertThat(layout.getLayoutOnLoadActions().get(0).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) + .hasSameElementsAs(firstSetPageLoadActions); + assertThat(layout.getLayoutOnLoadActions().get(1).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) + .hasSameElementsAs(secondSetPageLoadActions); + assertThat(layout.getLayoutOnLoadActions().get(2).stream().map(DslActionDTO::getName).collect(Collectors.toSet())) + .hasSameElementsAs(thirdSetPageLoadActions); + Set<DslActionDTO> flatOnLoadActions = new HashSet<>(); + for (Set<DslActionDTO> actions : layout.getLayoutOnLoadActions()) { + flatOnLoadActions.addAll(actions); + } + for (DslActionDTO action : flatOnLoadActions) { + assertThat(action.getId()).isNotBlank(); + assertThat(action.getName()).isNotBlank(); + assertThat(action.getTimeoutInMillisecond()).isNotZero(); + } + }) + .verifyComplete(); + + Mono<Tuple2<ActionDTO, ActionDTO>> actionDTOMono = pageMono.flatMap(page -> { + return newActionService.findByUnpublishedNameAndPageId("aGetAction", page.getId(), AclPermission.MANAGE_ACTIONS) + .zipWith(newActionService.findByUnpublishedNameAndPageId("ignoredAction1", page.getId(), AclPermission.MANAGE_ACTIONS)); + }); + + StepVerifier + .create(actionDTOMono) + .assertNext(tuple -> { + assertThat(tuple.getT1().getExecuteOnLoad()).isTrue(); + assertThat(tuple.getT2().getExecuteOnLoad()).isTrue(); + }) + .verifyComplete(); + } + + @Test @WithUserDetails(value = "api_user") public void testIncorrectDynamicBindingPathInDsl() { @@ -633,7 +1192,7 @@ public void testIncorrectDynamicBindingPathInDsl() { obj.put("dynamicBindingPathList", dynamicBindingsPathList); newLayout.setDsl(obj); - return layoutActionService.updateLayout(page1.getId(), layout.getId(), newLayout); + return layoutActionService.updateLayout(page1.getId(), page1.getApplicationId(), layout.getId(), newLayout); }); StepVerifier @@ -660,8 +1219,6 @@ public void testIncorrectMustacheExpressionInBindingInDsl() { app.setName("newApplication-testIncorrectMustacheExpressionInBinding-Test"); PageDTO page = createPage(app, testPage).block(); - String pageId = page.getId(); - String layoutId = page.getLayouts().get(0).getId(); Mono<LayoutDTO> testMono = Mono.just(page) .flatMap(page1 -> { @@ -708,7 +1265,7 @@ public void testIncorrectMustacheExpressionInBindingInDsl() { obj.put("dynamicBindingPathList", dynamicBindingsPathList); newLayout.setDsl(obj); - return layoutActionService.updateLayout(page1.getId(), layout.getId(), newLayout); + return layoutActionService.updateLayout(page1.getId(), page1.getApplicationId(), layout.getId(), newLayout); }); StepVerifier diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java index 246312d54a75..4650e748798f 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java @@ -17,11 +17,11 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationPagesDTO; import com.appsmith.server.dtos.LayoutDTO; import com.appsmith.server.dtos.PageDTO; @@ -562,7 +562,7 @@ public void clonePage() { action.setPageId(page.getId()); - final LayoutDTO layoutDTO = layoutActionService.updateLayout(page.getId(), layout.getId(), layout).block(); + final LayoutDTO layoutDTO = layoutActionService.updateLayout(page.getId(), page.getApplicationId(), layout.getId(), layout).block(); layoutActionService.createSingleAction(action).block(); @@ -743,7 +743,7 @@ public void clonePage_whenPageCloned_defaultIdsRetained() { action.setPageId(page.getId()); - final LayoutDTO layoutDTO = layoutActionService.updateLayout(page.getId(), layout.getId(), layout).block(); + final LayoutDTO layoutDTO = layoutActionService.updateLayout(page.getId(), page.getApplicationId(), layout.getId(), layout).block(); layoutActionService.createSingleAction(action).block(); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java index 919c2f2eebc4..c93ac23134e0 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java @@ -31,7 +31,7 @@ import com.appsmith.server.domains.Plugin; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ActionMoveDTO; import com.appsmith.server.dtos.ActionViewDTO; import com.appsmith.server.dtos.ApplicationAccessDTO; @@ -46,10 +46,9 @@ import com.appsmith.server.helpers.WidgetSuggestionHelper; import com.appsmith.server.repositories.PermissionGroupRepository; import com.appsmith.server.repositories.PluginRepository; -import com.appsmith.server.repositories.WorkspaceRepository; -import com.appsmith.server.services.ActionCollectionService; import com.appsmith.server.services.ApplicationPageService; import com.appsmith.server.services.ApplicationService; +import com.appsmith.server.services.AstService; import com.appsmith.server.services.DatasourceService; import com.appsmith.server.services.LayoutActionService; import com.appsmith.server.services.LayoutService; @@ -106,6 +105,7 @@ import static com.appsmith.server.constants.FieldName.ADMINISTRATOR; import static com.appsmith.server.constants.FieldName.DEVELOPER; import static com.appsmith.server.constants.FieldName.VIEWER; +import static com.appsmith.server.services.ce.ApplicationPageServiceCEImpl.EVALUATION_VERSION; import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(SpringExtension.class) @@ -128,9 +128,6 @@ public class ActionServiceCE_Test { @Autowired WorkspaceService workspaceService; - @Autowired - WorkspaceRepository workspaceRepository; - @Autowired PluginRepository pluginRepository; @@ -152,9 +149,6 @@ public class ActionServiceCE_Test { @Autowired DatasourceService datasourceService; - @Autowired - ActionCollectionService actionCollectionService; - @Autowired ImportExportApplicationService importExportApplicationService; @@ -173,6 +167,9 @@ public class ActionServiceCE_Test { @Autowired PermissionGroupService permissionGroupService; + @SpyBean + AstService astService; + Application testApp = null; PageDTO testPage = null; @@ -2718,9 +2715,17 @@ public void getActionsExecuteOnLoadPaginatedApi() { obj.put("dynamicBindingPathList", dynamicBindingsPathList); newLayout.setDsl(obj); - return layoutActionService.updateLayout(page1.getId(), layout.getId(), newLayout); + return layoutActionService.updateLayout(page1.getId(), page1.getApplicationId(), layout.getId(), newLayout); }); + + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("paginatedApi.data", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("paginatedApi.data")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("paginatedApi.data.prev", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("paginatedApi.data.prev")))); + Mockito.when(astService.getPossibleReferencesFromDynamicBinding("paginatedApi.data.next", EVALUATION_VERSION)) + .thenReturn(Mono.just(new HashSet<>(Set.of("paginatedApi.data.next")))); + StepVerifier .create(testMono) .assertNext(layout -> { diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/NewActionServiceCEImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/NewActionServiceCEImplTest.java index 88057739673e..00b19b4c541b 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/NewActionServiceCEImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/NewActionServiceCEImplTest.java @@ -6,8 +6,8 @@ import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.PluginType; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.PluginExecutorHelper; 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 4f43fc03f3a6..4e3cd1058c4b 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 @@ -17,11 +17,11 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.InviteUsersDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; @@ -253,7 +253,7 @@ public void setup() { Layout layout = testPage.getLayouts().get(0); layout.setDsl(parentDsl); - layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout).block(); + layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout).block(); // Invite "[email protected]" with VIEW access, api_user will be the admin of sourceWorkspace and we are // controlling this with @FixMethodOrder(MethodSorters.NAME_ASCENDING) to run the TCs in a sequence. // Running TC in a sequence is a bad practice for unit TCs but here we are testing the invite user and then fork @@ -340,9 +340,9 @@ public void test1_cloneWorkspaceWithItsContents() { newPage.getUnpublishedPage() .getLayouts() .forEach(layout -> { - assertThat(layout.getLayoutOnLoadActions()).hasSize(1); + assertThat(layout.getLayoutOnLoadActions()).hasSize(2); layout.getLayoutOnLoadActions().forEach(dslActionDTOS -> { - assertThat(dslActionDTOS).hasSize(2); + assertThat(dslActionDTOS).hasSize(1); dslActionDTOS.forEach(actionDTO -> { assertThat(actionDTO.getId()).isEqualTo(actionDTO.getDefaultActionId()); if (!StringUtils.isEmpty(actionDTO.getCollectionId())) { diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java index 096d1587971c..4cf2369d959f 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java @@ -18,7 +18,7 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Plugin; import com.appsmith.server.domains.Workspace; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.CRUDPageResourceDTO; import com.appsmith.server.dtos.CRUDPageResponseDTO; import com.appsmith.server.dtos.PageDTO; 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 5b0f758b9836..c85527ce31df 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 @@ -20,11 +20,11 @@ import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.DslActionDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.helpers.MockPluginExecutor; 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 cbe4380ec44c..e29aa72435fe 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 @@ -21,11 +21,11 @@ import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.Plugin; -import com.appsmith.server.domains.PluginType; +import com.appsmith.external.models.PluginType; import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; -import com.appsmith.server.dtos.ActionDTO; +import com.appsmith.external.models.ActionDTO; import com.appsmith.server.dtos.ApplicationAccessDTO; import com.appsmith.server.dtos.ApplicationImportDTO; import com.appsmith.server.dtos.ApplicationJson; @@ -485,7 +485,7 @@ public void createExportAppJsonWithActionAndActionCollectionTest() { return layoutCollectionService.createCollection(actionCollectionDTO1) .then(layoutActionService.createSingleAction(action)) .then(layoutActionService.createSingleAction(action2)) - .then(layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout)) + .then(layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout)) .then(importExportApplicationService.exportApplicationById(testApp.getId(), "")); }) .cache(); @@ -2232,7 +2232,7 @@ public void exportApplication_withDatasourceConfig_exportedWithDecryptedFields() return layoutCollectionService.createCollection(actionCollectionDTO1) .then(layoutActionService.createSingleAction(action)) .then(layoutActionService.createSingleAction(action2)) - .then(layoutActionService.updateLayout(testPage.getId(), layout.getId(), layout)) + .then(layoutActionService.updateLayout(testPage.getId(), testPage.getApplicationId(), layout.getId(), layout)) .then(importExportApplicationService.exportApplicationById(testApp.getId(), "")); }) .cache();
f0d837c599a35425d4dd8be6969221cc9659c0c0
2024-05-03 11:54:39
Shrikant Sharat Kandula
chore: Remove unused User.currentWorkspaceId (#33149)
false
Remove unused User.currentWorkspaceId (#33149)
chore
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java index 2b81c06ad596..6f645a4f3a3b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java @@ -259,7 +259,6 @@ private User createAnonymousUser() { User user = new User(); user.setName(FieldName.ANONYMOUS_USER); user.setEmail(FieldName.ANONYMOUS_USER); - user.setCurrentWorkspaceId(""); user.setWorkspaceIds(new HashSet<>()); user.setIsAnonymous(true); return user; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/User.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/User.java index 57eccbed438d..125ae6a5226b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/User.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/User.java @@ -62,9 +62,6 @@ public class User extends BaseDomain implements UserDetails, OidcUser { @JsonView(Views.Public.class) private Boolean emailVerified; - @JsonView(Views.Public.class) - private String currentWorkspaceId; - @JsonView(Views.Public.class) private Set<String> workspaceIds; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/UserSessionDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/UserSessionDTO.java index b2f34603af94..92b6adab46e8 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/UserSessionDTO.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/UserSessionDTO.java @@ -84,7 +84,6 @@ public static UserSessionDTO fromToken(Authentication authentication) { session.source = user.getSource(); session.state = user.getState(); session.isEnabled = user.isEnabled(); - session.currentWorkspaceId = user.getCurrentWorkspaceId(); session.workspaceIds = user.getWorkspaceIds(); session.tenantId = user.getTenantId(); session.emailVerified = Boolean.TRUE.equals(user.getEmailVerified()); @@ -126,7 +125,6 @@ public Authentication makeToken() { user.setSource(source); user.setState(state); user.setIsEnabled(isEnabled); - user.setCurrentWorkspaceId(currentWorkspaceId); user.setWorkspaceIds(workspaceIds); user.setTenantId(tenantId); user.setEmailVerified(Boolean.TRUE.equals(emailVerified)); 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 d9dbd07d70b1..e801255b464d 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 @@ -100,22 +100,6 @@ public enum AppsmithError { "Deprecated API", ErrorType.BAD_REQUEST, null), - USER_DOESNT_BELONG_ANY_WORKSPACE( - 400, - AppsmithErrorCode.USER_DOESNT_BELONG_ANY_WORKSPACE.getCode(), - "User {0} does not belong to any workspace", - AppsmithErrorAction.LOG_EXTERNALLY, - "User doesn''t belong to any workspace", - ErrorType.INTERNAL_ERROR, - null), - USER_DOESNT_BELONG_TO_WORKSPACE( - 400, - AppsmithErrorCode.USER_DOESNT_BELONG_TO_WORKSPACE.getCode(), - "User {0} does not belong to the workspace with id {1}", - AppsmithErrorAction.LOG_EXTERNALLY, - "User doesn''t belong to this workspace", - ErrorType.INTERNAL_ERROR, - null), USER_NOT_ASSIGNED_TO_ROLE( 400, 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 d54684d1a598..fee9ddaade26 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 @@ -17,8 +17,6 @@ public enum AppsmithErrorCode { PAGE_DOESNT_BELONG_TO_USER_WORKSPACE("AE-APP-4006", "Page doesn't belong to user workspace"), UNSUPPORTED_OPERATION("AE-APP-4007", "Unsupported operation"), DEPRECATED_API("AE-APP-4008", "Deprecated api"), - USER_DOESNT_BELONG_ANY_WORKSPACE("AE-APP-4009", "User doesn't belong any workspace"), - USER_DOESNT_BELONG_TO_WORKSPACE("AE-APP-4010", "User doesn't belong to workspace"), USER_NOT_ASSIGNED_TO_ROLE("AE-APP-4011", "User is not assigned to role"), INVALID_ACTION("AE-APP-4012", "Invalid action"), PAYLOAD_TOO_LARGE("AE-APP-4013", "Payload too large"), diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java index ca7ad5f15a44..db5be15202d5 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java @@ -214,7 +214,6 @@ public void addAnonymousUser(MongoTemplate mongoTemplate) { anonymousUser = new User(); anonymousUser.setName(FieldName.ANONYMOUS_USER); anonymousUser.setEmail(FieldName.ANONYMOUS_USER); - anonymousUser.setCurrentWorkspaceId(""); anonymousUser.setWorkspaceIds(new HashSet<>()); anonymousUser.setIsAnonymous(true); anonymousUser.setTenantId(tenant.getId()); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCE.java index 145c4870934f..3c489065891f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCE.java @@ -20,8 +20,6 @@ public interface UserServiceCE extends CrudService<User, String> { Mono<User> findByEmailAndTenantId(String email, String tenantId); - Mono<User> switchCurrentWorkspace(String workspaceId); - Mono<Boolean> forgotPasswordTokenGenerate(ResetUserPasswordDTO resetUserPasswordDTO); Mono<Boolean> verifyPasswordResetToken(String token); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCEImpl.java index 957218667cf6..570e743ee95c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCEImpl.java @@ -72,7 +72,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.regex.Pattern; @@ -167,49 +166,6 @@ public Mono<User> findByEmailAndTenantId(String email, String tenantId) { return repository.findByEmailAndTenantId(email, tenantId); } - /** - * This function switches the user's currentWorkspace in the User collection in the DB. This means that on subsequent - * logins, the user will see applications for their last used workspace. - * - * @param workspaceId - * @return - */ - @Override - public Mono<User> switchCurrentWorkspace(String workspaceId) { - if (workspaceId == null || workspaceId.isEmpty()) { - return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "workspaceId")); - } - return sessionUserService - .getCurrentUser() - .flatMap(user -> repository.findByEmail(user.getUsername())) - .flatMap(user -> { - log.debug("Going to set workspaceId: {} for user: {}", workspaceId, user.getId()); - - if (user.getCurrentWorkspaceId().equals(workspaceId)) { - return Mono.just(user); - } - - Set<String> workspaceIds = user.getWorkspaceIds(); - if (workspaceIds == null || workspaceIds.isEmpty()) { - return Mono.error( - new AppsmithException(AppsmithError.USER_DOESNT_BELONG_ANY_WORKSPACE, user.getId())); - } - - Optional<String> maybeWorkspaceId = workspaceIds.stream() - .filter(workspaceId1 -> workspaceId1.equals(workspaceId)) - .findFirst(); - - if (maybeWorkspaceId.isPresent()) { - user.setCurrentWorkspaceId(maybeWorkspaceId.get()); - return repository.save(user); - } - - // Throw an exception if the workspaceId is not part of the user's workspaces - return Mono.error(new AppsmithException( - AppsmithError.USER_DOESNT_BELONG_TO_WORKSPACE, user.getId(), workspaceId)); - }); - } - /** * This function creates a one-time token for resetting the user's password. This token is stored in the `passwordResetToken` * collection with an expiry time of 48 hours. The user must provide this one-time token when updating with the new password.
115a119003f37537b532ae4a54a92cbc74e6e6c3
2022-04-08 17:41:01
Paul Li
fix: Auto-suggestion is not working for progress widget while binding (#12675)
false
Auto-suggestion is not working for progress widget while binding (#12675)
fix
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Progress_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Progress_spec.js index 24e12ac5a278..5e0e52822027 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Progress_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Progress_spec.js @@ -1,10 +1,13 @@ const explorer = require("../../../../locators/explorerlocators.json"); describe("Progress Widget", function() { - it("Add a new 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", ""); }); // Linear progress @@ -132,4 +135,14 @@ describe("Progress Widget", function() { .invoke("css", "stroke-dashoffset") .should("not.match", /-/); }); + + it("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.", { force: true }); + cy.get("ul.CodeMirror-hints") + .contains("progress") + .should("exist"); + }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js index 83d7f4f5260c..273f88124a5a 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js @@ -185,7 +185,7 @@ describe("Button Widget Functionality", function() { it("Toggle JS - Button-Unckeck Visible field Validation", function() { //Uncheck the disabled checkbox using JS and validate cy.get(widgetsPage.toggleVisible).click({ force: true }); - cy.testJsontext("visible", "true"); + cy.testJsontext("visible", "false"); cy.PublishtheApp(); cy.get(publishPage.buttonWidget).should("not.exist"); });
25349c1c66a406a8bf0e979fec61fe5fad6708c9
2024-08-20 10:48:52
Sagar Khalasi
test: Update case base duplicate file name (#35672)
false
Update case base duplicate file name (#35672)
test
diff --git a/app/client/cypress/e2e/GSheet/Misc_Spec.ts b/app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts similarity index 100% rename from app/client/cypress/e2e/GSheet/Misc_Spec.ts rename to app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBugs_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncGitBugs_spec.js similarity index 100% rename from app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBugs_spec.js rename to app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncGitBugs_spec.js diff --git a/app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/mysql_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/OneClickBindingMysql_spec.ts similarity index 100% rename from app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/mysql_spec.ts rename to app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/OneClickBindingMysql_spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Basic_spec.js b/app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_Basic_spec.js similarity index 100% rename from app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Basic_spec.js rename to app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_Basic_spec.js diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Camera/Image_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Camera/CameraImage_Spec.ts similarity index 100% rename from app/client/cypress/e2e/Regression/ClientSide/Widgets/Camera/Image_Spec.ts rename to app/client/cypress/e2e/Regression/ClientSide/Widgets/Camera/CameraImage_Spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Camera/Video_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Camera/CameraVideo_Spec.ts similarity index 100% rename from app/client/cypress/e2e/Regression/ClientSide/Widgets/Camera/Video_Spec.ts rename to app/client/cypress/e2e/Regression/ClientSide/Widgets/Camera/CameraVideo_Spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/Autocomplete_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/OthersAutocomplete_spec.js similarity index 100% rename from app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/Autocomplete_spec.js rename to app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/OthersAutocomplete_spec.js diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/menubutton_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/ColumnTypeMenubutton_spec.js similarity index 100% rename from app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/menubutton_spec.js rename to app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/ColumnTypeMenubutton_spec.js diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/ColumnTypesSelect2_spec.ts similarity index 100% rename from app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select2_spec.ts rename to app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/ColumnTypesSelect2_spec.ts diff --git a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/MySQL_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/QueryPane_MySQL_Spec.ts similarity index 100% rename from app/client/cypress/e2e/Regression/ServerSide/QueryPane/MySQL_Spec.ts rename to app/client/cypress/e2e/Regression/ServerSide/QueryPane/QueryPane_MySQL_Spec.ts diff --git a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/Postgres_Spec.js b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/QueryPane_Postgres_Spec.js similarity index 100% rename from app/client/cypress/e2e/Regression/ServerSide/QueryPane/Postgres_Spec.js rename to app/client/cypress/e2e/Regression/ServerSide/QueryPane/QueryPane_Postgres_Spec.js
b4b038d90ee1056e1b3d54f0c0a8a7c9fe9df182
2021-10-11 13:08:27
Alyssa Holland
fix: 🐛 Display tooltips for scroll content label (#8134)
false
🐛 Display tooltips for scroll content label (#8134)
fix
diff --git a/app/client/src/widgets/ContainerWidget/widget/index.tsx b/app/client/src/widgets/ContainerWidget/widget/index.tsx index 9f1028fdcb26..b36c2dc19b8b 100644 --- a/app/client/src/widgets/ContainerWidget/widget/index.tsx +++ b/app/client/src/widgets/ContainerWidget/widget/index.tsx @@ -44,6 +44,7 @@ class ContainerWidget extends BaseWidget< validation: { type: ValidationTypes.BOOLEAN }, }, { + helpText: "Enables scrolling for content inside the widget", propertyName: "shouldScrollContents", label: "Scroll Contents", controlType: "SWITCH", diff --git a/app/client/src/widgets/ModalWidget/widget/index.tsx b/app/client/src/widgets/ModalWidget/widget/index.tsx index b15d11ddc852..b3681bfef3f3 100644 --- a/app/client/src/widgets/ModalWidget/widget/index.tsx +++ b/app/client/src/widgets/ModalWidget/widget/index.tsx @@ -29,6 +29,7 @@ export class ModalWidget extends BaseWidget<ModalWidgetProps, WidgetState> { sectionName: "General", children: [ { + helpText: "Enables scrolling for content inside the widget", propertyName: "shouldScrollContents", label: "Scroll Contents", controlType: "SWITCH", diff --git a/app/client/src/widgets/StatboxWidget/widget/index.tsx b/app/client/src/widgets/StatboxWidget/widget/index.tsx index 7b384c15c93e..6f10dbb94f99 100644 --- a/app/client/src/widgets/StatboxWidget/widget/index.tsx +++ b/app/client/src/widgets/StatboxWidget/widget/index.tsx @@ -32,6 +32,7 @@ class StatboxWidget extends ContainerWidget { validation: { type: ValidationTypes.BOOLEAN }, }, { + helpText: "Enables scrolling for content inside the widget", propertyName: "shouldScrollContents", label: "Scroll Contents", controlType: "SWITCH", diff --git a/app/client/src/widgets/TabsMigrator/widget/index.tsx b/app/client/src/widgets/TabsMigrator/widget/index.tsx index 3450523490b4..16ae80897f3a 100644 --- a/app/client/src/widgets/TabsMigrator/widget/index.tsx +++ b/app/client/src/widgets/TabsMigrator/widget/index.tsx @@ -90,6 +90,7 @@ class TabsMigratorWidget extends BaseWidget< dependencies: ["tabsObj", "tabs"], }, { + helpText: "Enables scrolling for content inside the widget", propertyName: "shouldScrollContents", label: "Scroll Contents", controlType: "SWITCH", diff --git a/app/client/src/widgets/TabsWidget/widget/index.tsx b/app/client/src/widgets/TabsWidget/widget/index.tsx index c699e73c29e3..682c0d70b123 100644 --- a/app/client/src/widgets/TabsWidget/widget/index.tsx +++ b/app/client/src/widgets/TabsWidget/widget/index.tsx @@ -136,6 +136,7 @@ class TabsWidget extends BaseWidget< isTriggerProperty: false, }, { + helpText: "Enables scrolling for content inside the widget", propertyName: "shouldScrollContents", label: "Scroll Contents", controlType: "SWITCH",
576f27ea0b6d1656412de87c58eb10d7705d2ec2
2023-06-16 13:39:40
Ayangade Adeoluwa
fix: Fix table height issue (#24277)
false
Fix table height issue (#24277)
fix
diff --git a/app/client/src/pages/Editor/QueryEditor/Table.tsx b/app/client/src/pages/Editor/QueryEditor/Table.tsx index 53fdca4a20bb..290ef3be52e8 100644 --- a/app/client/src/pages/Editor/QueryEditor/Table.tsx +++ b/app/client/src/pages/Editor/QueryEditor/Table.tsx @@ -34,7 +34,7 @@ const NoDataMessage = styled.span` // TODO: replace with ads table export const TableWrapper = styled.div` width: 100%; - height: 100%; + height: auto; background: var(--ads-v2-color-bg); border: 1px solid var(--ads-v2-color-border); box-sizing: border-box; @@ -55,7 +55,7 @@ export const TableWrapper = styled.div` background: var(--ads-v2-color-gray-50); display: table; width: 100%; - height: 100%; + height: auto; .thead, .tbody { overflow: hidden; @@ -241,16 +241,6 @@ function Table(props: TableProps) { return []; }, [data]); - const responseTypePanelHeight = 24; - - const tableBodyHeightComputed = - (props.tableBodyHeight || window.innerHeight) - - TABLE_SIZES.COLUMN_HEADER_HEIGHT - - theme.tabPanelHeight - - TABLE_SIZES.SCROLL_SIZE - - responseTypePanelHeight - - 2 * theme.spaces[4]; //top and bottom padding - const defaultColumn = React.useMemo( () => ({ width: 170, @@ -275,6 +265,27 @@ function Table(props: TableProps) { useBlockLayout, ); + const responseTypePanelHeight = 24; + const tableRowHeight = 35; + + // height of response pane with respect to other constants. + let tableBodyHeightComputed = + (props.tableBodyHeight || window.innerHeight) - + TABLE_SIZES.COLUMN_HEADER_HEIGHT - + theme.tabPanelHeight - + TABLE_SIZES.SCROLL_SIZE - + responseTypePanelHeight - + 2 * theme.spaces[4]; //top and bottom padding + + // actual height of all the rows. + const actualHeightOfAllRows = rows.length * tableRowHeight; + + // if the actual height of all the rows is less than computed table body height + // set the height of the body to it. + if (rows.length && actualHeightOfAllRows < tableBodyHeightComputed) { + tableBodyHeightComputed = actualHeightOfAllRows; + } + const tableBodyEle = tableBodyRef?.current; const scrollBarW = React.useMemo(() => scrollbarWidth(), []); const scrollBarSize = getScrollBarWidth(tableBodyEle, scrollBarW);
b4441969d0c47e19d29d5f645fd5dfd14a524591
2023-12-14 23:26:46
Nirmal Sarswat
feat: Google AI integration (#29620)
false
Google AI integration (#29620)
feat
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 7d337ffc7942..8d5aebfeada1 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 @@ -14,6 +14,7 @@ interface PackageName { String GRAPH_QL_PLUGIN = "graphql-plugin"; String OPEN_AI_PLUGIN = "openai-plugin"; String ANTHROPIC_PLUGIN = "anthropic-plugin"; + String GOOGLE_AI_PLUGIN = "googleai-plugin"; } public static final String DEFAULT_REST_DATASOURCE = "DEFAULT_REST_DATASOURCE"; @@ -39,6 +40,7 @@ interface PluginName { public static final String OPEN_AI_PLUGIN_NAME = "Open AI"; public static final String ANTHROPIC_PLUGIN_NAME = "Anthropic"; + public static final String GOOGLE_AI_PLUGIN_NAME = "Google AI"; } interface HostName { diff --git a/app/server/appsmith-plugins/googleAiPlugin/pom.xml b/app/server/appsmith-plugins/googleAiPlugin/pom.xml new file mode 100644 index 000000000000..9c8ba07e5c97 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/pom.xml @@ -0,0 +1,108 @@ +<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.appsmith</groupId> + <artifactId>appsmith-plugins</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <groupId>com.external.plugins</groupId> + <artifactId>googleAiPlugin</artifactId> + <version>1.0-SNAPSHOT</version> + <name>googleAiPlugin</name> + <url>http://maven.apache.org</url> + + <dependencies> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webflux</artifactId> + <exclusions> + <exclusion> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson-bom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jdk8</artifactId> + <version>${jackson-bom.version}</version> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + <version>${jackson-bom.version}</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>32.0.1-jre</version> + </dependency> + + <!-- + Ideally this dependency should have been added with 'compile' scope here. But that is causing 'java.lang + .NoClassDefFoundError'. After trying to fix it right way many times, I decided to move the dependency to + the main server module's pom.xml file and keep the dependency here with 'provided' scope. This seems to + fix the problem for now. + --> + + <!-- Test dependencies --> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>3.13.2</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-webflux</artifactId> + <version>${spring-boot.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.projectreactor.netty</groupId> + <artifactId>reactor-netty-http</artifactId> + <scope>provided</scope> + </dependency> + + </dependencies> + +</project> diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/GoogleAiPlugin.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/GoogleAiPlugin.java new file mode 100644 index 000000000000..534fce99f754 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/GoogleAiPlugin.java @@ -0,0 +1,209 @@ +package com.external.plugins; + +import com.appsmith.external.dtos.ExecuteActionDTO; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.helpers.restApiUtils.connections.APIConnection; +import com.appsmith.external.helpers.restApiUtils.helpers.RequestCaptureFilter; +import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.ActionExecutionRequest; +import com.appsmith.external.models.ActionExecutionResult; +import com.appsmith.external.models.ApiKeyAuth; +import com.appsmith.external.models.DatasourceConfiguration; +import com.appsmith.external.models.DatasourceTestResult; +import com.appsmith.external.models.TriggerRequestDTO; +import com.appsmith.external.models.TriggerResultDTO; +import com.appsmith.external.plugins.BasePlugin; +import com.appsmith.external.plugins.BaseRestApiPluginExecutor; +import com.appsmith.external.services.SharedConfig; +import com.external.plugins.commands.GoogleAICommand; +import com.external.plugins.constants.GoogleAIConstants; +import com.external.plugins.models.GoogleAIRequestDTO; +import com.external.plugins.utils.GoogleAIMethodStrategy; +import com.external.plugins.utils.RequestUtils; +import com.google.gson.Gson; +import lombok.extern.slf4j.Slf4j; +import org.pf4j.PluginWrapper; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatusCode; +import org.springframework.util.StringUtils; +import org.springframework.web.reactive.function.BodyInserters; +import org.springframework.web.util.UriComponentsBuilder; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.external.plugins.constants.GoogleAIConstants.BODY; +import static com.external.plugins.constants.GoogleAIConstants.GOOGLE_AI_API_ENDPOINT; +import static com.external.plugins.constants.GoogleAIConstants.LABEL; +import static com.external.plugins.constants.GoogleAIConstants.MODELS; +import static com.external.plugins.constants.GoogleAIConstants.VALUE; +import static com.external.plugins.constants.GoogleAIErrorMessages.EMPTY_API_KEY; +import static com.external.plugins.constants.GoogleAIErrorMessages.INVALID_API_KEY; +import static com.external.plugins.constants.GoogleAIErrorMessages.QUERY_FAILED_TO_EXECUTE; + +@Slf4j +public class GoogleAiPlugin extends BasePlugin { + public GoogleAiPlugin(PluginWrapper wrapper) { + super(wrapper); + } + + public static class GoogleAiPluginExecutor extends BaseRestApiPluginExecutor { + private static final Gson gson = new Gson(); + + protected GoogleAiPluginExecutor(SharedConfig sharedConfig) { + super(sharedConfig); + } + + /** + * Tries to fetch the models list from GoogleAI API and if request succeed, then datasource configuration is valid + */ + @Override + public Mono<DatasourceTestResult> testDatasource(DatasourceConfiguration datasourceConfiguration) { + final ApiKeyAuth apiKeyAuth = (ApiKeyAuth) datasourceConfiguration.getAuthentication(); + if (!StringUtils.hasText(apiKeyAuth.getValue())) { + return Mono.error(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, EMPTY_API_KEY)); + } + + URI uri = UriComponentsBuilder.fromUriString(GOOGLE_AI_API_ENDPOINT) + .path(MODELS) + .build() + .toUri(); + HttpMethod httpMethod = HttpMethod.GET; + + return RequestUtils.makeRequest(httpMethod, uri, apiKeyAuth, BodyInserters.empty()) + .map(responseEntity -> { + if (responseEntity.getStatusCode().is2xxSuccessful()) { + // valid credentials + return new DatasourceTestResult(); + } + return new DatasourceTestResult(INVALID_API_KEY); + }) + .onErrorResume(error -> Mono.just(new DatasourceTestResult( + "Error while trying to test the datasource configurations" + error.getMessage()))); + } + + @Override + public Mono<ActionExecutionResult> executeParameterized( + APIConnection connection, + ExecuteActionDTO executeActionDTO, + DatasourceConfiguration datasourceConfiguration, + ActionConfiguration actionConfiguration) { + // Get prompt from action configuration + List<Map.Entry<String, String>> parameters = new ArrayList<>(); + + prepareConfigurationsForExecution(executeActionDTO, actionConfiguration, datasourceConfiguration); + + // Initializing object for error condition + ActionExecutionResult errorResult = new ActionExecutionResult(); + initUtils.initializeResponseWithError(errorResult); + + GoogleAICommand googleAICommand = GoogleAIMethodStrategy.selectExecutionMethod(actionConfiguration, gson); + googleAICommand.validateRequest(actionConfiguration); + GoogleAIRequestDTO googleAIRequestDTO = googleAICommand.makeRequestBody(actionConfiguration); + + URI uri = googleAICommand.createExecutionUri(actionConfiguration); + HttpMethod httpMethod = googleAICommand.getExecutionMethod(); + ActionExecutionRequest actionExecutionRequest = + RequestCaptureFilter.populateRequestFields(actionConfiguration, uri, parameters, objectMapper); + + final ApiKeyAuth apiKeyAuth = (ApiKeyAuth) datasourceConfiguration.getAuthentication(); + + if (!StringUtils.hasText(apiKeyAuth.getValue())) { + ActionExecutionResult apiKeyNotPresentErrorResult = new ActionExecutionResult(); + apiKeyNotPresentErrorResult.setIsExecutionSuccess(false); + apiKeyNotPresentErrorResult.setErrorInfo(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, EMPTY_API_KEY)); + return Mono.just(apiKeyNotPresentErrorResult); + } + + return RequestUtils.makeRequest(httpMethod, uri, apiKeyAuth, BodyInserters.fromValue(googleAIRequestDTO)) + .flatMap(responseEntity -> { + HttpStatusCode statusCode = responseEntity.getStatusCode(); + + ActionExecutionResult actionExecutionResult = new ActionExecutionResult(); + actionExecutionResult.setRequest(actionExecutionRequest); + actionExecutionResult.setStatusCode(statusCode.toString()); + + if (HttpStatusCode.valueOf(401).isSameCodeAs(statusCode)) { + actionExecutionResult.setIsExecutionSuccess(false); + String errorMessage = ""; + if (responseEntity.getBody() != null && responseEntity.getBody().length > 0) { + errorMessage = new String(responseEntity.getBody()); + } + actionExecutionResult.setErrorInfo(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_AUTHENTICATION_ERROR, errorMessage)); + return Mono.just(actionExecutionResult); + } + + if (statusCode.is4xxClientError()) { + actionExecutionResult.setIsExecutionSuccess(false); + String errorMessage = ""; + if (responseEntity.getBody() != null && responseEntity.getBody().length > 0) { + errorMessage = new String(responseEntity.getBody()); + } + actionExecutionResult.setErrorInfo(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ERROR, errorMessage)); + + return Mono.just(actionExecutionResult); + } + + Object body; + try { + body = objectMapper.readValue(responseEntity.getBody(), Object.class); + actionExecutionResult.setBody(body); + } catch (IOException ex) { + actionExecutionResult.setIsExecutionSuccess(false); + actionExecutionResult.setErrorInfo(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_JSON_PARSE_ERROR, BODY, ex.getMessage())); + return Mono.just(actionExecutionResult); + } + + if (!statusCode.is2xxSuccessful()) { + actionExecutionResult.setIsExecutionSuccess(false); + actionExecutionResult.setErrorInfo(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_ERROR, QUERY_FAILED_TO_EXECUTE, body)); + return Mono.just(actionExecutionResult); + } + + actionExecutionResult.setIsExecutionSuccess(true); + + return Mono.just(actionExecutionResult); + }) + .onErrorResume(error -> { + errorResult.setIsExecutionSuccess(false); + log.error( + "An error has occurred while trying to run the Google AI API query command with error {}", + error.getMessage()); + if (!(error instanceof AppsmithPluginException)) { + error = new AppsmithPluginException( + AppsmithPluginError.PLUGIN_ERROR, error.getMessage(), error); + } + errorResult.setErrorInfo(error); + return Mono.just(errorResult); + }); + } + + @Override + public Mono<TriggerResultDTO> trigger( + APIConnection connection, DatasourceConfiguration datasourceConfiguration, TriggerRequestDTO request) { + return Mono.just(new TriggerResultDTO(getDataToMap(GoogleAIConstants.GOOGLE_AI_MODELS))); + } + + @Override + public Set<String> validateDatasource(DatasourceConfiguration datasourceConfiguration) { + return RequestUtils.validateApiKeyAuthDatasource(datasourceConfiguration); + } + + private List<Map<String, String>> getDataToMap(List<String> data) { + return data.stream().sorted().map(x -> Map.of(LABEL, x, VALUE, x)).collect(Collectors.toList()); + } + } +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/commands/GenerateContentCommand.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/commands/GenerateContentCommand.java new file mode 100644 index 000000000000..585060964892 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/commands/GenerateContentCommand.java @@ -0,0 +1,152 @@ +package com.external.plugins.commands; + +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.models.ActionConfiguration; +import com.external.plugins.constants.GoogleAIConstants; +import com.external.plugins.models.GoogleAIRequestDTO; +import com.external.plugins.models.Role; +import com.external.plugins.utils.RequestUtils; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import org.springframework.http.HttpMethod; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.lang.reflect.Type; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static com.external.plugins.constants.GoogleAIConstants.COMPONENT; +import static com.external.plugins.constants.GoogleAIConstants.COMPONENT_DATA; +import static com.external.plugins.constants.GoogleAIConstants.CONTENT; +import static com.external.plugins.constants.GoogleAIConstants.DATA; +import static com.external.plugins.constants.GoogleAIConstants.GENERATE_CONTENT_MODEL; +import static com.external.plugins.constants.GoogleAIConstants.JSON; +import static com.external.plugins.constants.GoogleAIConstants.MESSAGES; +import static com.external.plugins.constants.GoogleAIConstants.ROLE; +import static com.external.plugins.constants.GoogleAIConstants.TYPE; +import static com.external.plugins.constants.GoogleAIConstants.VIEW_TYPE; +import static com.external.plugins.constants.GoogleAIErrorMessages.EXECUTION_FAILURE; +import static com.external.plugins.constants.GoogleAIErrorMessages.INCORRECT_MESSAGE_FORMAT; +import static com.external.plugins.constants.GoogleAIErrorMessages.MODEL_NOT_SELECTED; +import static com.external.plugins.constants.GoogleAIErrorMessages.QUERY_NOT_CONFIGURED; +import static com.external.plugins.constants.GoogleAIErrorMessages.STRING_APPENDER; + +public class GenerateContentCommand implements GoogleAICommand { + private final Gson gson = new Gson(); + + @Override + public HttpMethod getTriggerHTTPMethod() { + return HttpMethod.GET; + } + + @Override + public HttpMethod getExecutionMethod() { + return HttpMethod.POST; + } + + /** + * This will be implemented in later stage once we integrate all the functions provided by Google AI + */ + @Override + public URI createTriggerUri() { + return URI.create(""); + } + + @Override + public URI createExecutionUri(ActionConfiguration actionConfiguration) { + return RequestUtils.createUriFromCommand(GoogleAIConstants.GENERATE_CONTENT, selectModel(actionConfiguration)); + } + + private String selectModel(ActionConfiguration actionConfiguration) { + if (actionConfiguration != null + && actionConfiguration.getFormData() != null + && actionConfiguration.getFormData().containsKey(GENERATE_CONTENT_MODEL)) { + return ((Map<String, String>) actionConfiguration.getFormData().get(GENERATE_CONTENT_MODEL)).get(DATA); + } + // throw error if no model selected + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, + "No generate content model is selected in the configuration"); + } + + @Override + public GoogleAIRequestDTO makeRequestBody(ActionConfiguration actionConfiguration) { + Map<String, Object> formData = actionConfiguration.getFormData(); + GoogleAIRequestDTO googleAIRequestDTO = new GoogleAIRequestDTO(); + List<Map<String, String>> messages = getMessages((Map<String, Object>) formData.get(MESSAGES)); + if (messages == null || messages.isEmpty()) { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, + String.format(STRING_APPENDER, EXECUTION_FAILURE, INCORRECT_MESSAGE_FORMAT)); + } + // as of today, we are going to support only text input to text output, so we will condense user messages in + // a single content parts of request body + List<GoogleAIRequestDTO.Part> userQueryParts = new ArrayList<>(); + for (Map<String, String> message : messages) { + if (message.containsKey(ROLE) && message.containsKey(TYPE) && message.containsKey(CONTENT)) { + String role = message.get(ROLE); + String type = message.get(TYPE); + String content = message.get(CONTENT); + if (content.isEmpty()) { + continue; + } + + if (Role.USER.getValue().equals(role) + && com.external.plugins.models.Type.TEXT.toString().equals(type)) { + userQueryParts.add(new GoogleAIRequestDTO.Part(content)); + } + } + } + // no content is configured completely + if (userQueryParts.isEmpty()) { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, + String.format(STRING_APPENDER, EXECUTION_FAILURE, INCORRECT_MESSAGE_FORMAT)); + } + googleAIRequestDTO.setContents(List.of(new GoogleAIRequestDTO.Content(Role.USER, userQueryParts))); + return googleAIRequestDTO; + } + + /** + * Place all necessary validation checks here + */ + @Override + public void validateRequest(ActionConfiguration actionConfiguration) { + Map<String, Object> formData = actionConfiguration.getFormData(); + if (CollectionUtils.isEmpty(formData)) { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, + String.format(STRING_APPENDER, EXECUTION_FAILURE, QUERY_NOT_CONFIGURED)); + } + + String model = RequestUtils.extractDataFromFormData(formData, GENERATE_CONTENT_MODEL); + if (!StringUtils.hasText(model)) { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, + String.format(STRING_APPENDER, EXECUTION_FAILURE, MODEL_NOT_SELECTED)); + } + if (!formData.containsKey(MESSAGES) || formData.get(MESSAGES) == null) { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, + String.format(STRING_APPENDER, EXECUTION_FAILURE, INCORRECT_MESSAGE_FORMAT)); + } + } + + private List<Map<String, String>> getMessages(Map<String, Object> messages) { + Type listType = new TypeToken<List<Map<String, String>>>() {}.getType(); + if (messages.containsKey(VIEW_TYPE)) { + if (JSON.equals(messages.get(VIEW_TYPE))) { + // data is present in data key as String + return gson.fromJson((String) messages.get(DATA), listType); + } else if (COMPONENT.equals(messages.get(VIEW_TYPE))) { + return (List<Map<String, String>>) messages.get(COMPONENT_DATA); + } + } + // return object stored in data key + return (List<Map<String, String>>) messages.get(DATA); + } +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/commands/GoogleAICommand.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/commands/GoogleAICommand.java new file mode 100644 index 000000000000..ebbf24c41bcd --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/commands/GoogleAICommand.java @@ -0,0 +1,21 @@ +package com.external.plugins.commands; + +import com.appsmith.external.models.ActionConfiguration; +import com.external.plugins.models.GoogleAIRequestDTO; +import org.springframework.http.HttpMethod; + +import java.net.URI; + +public interface GoogleAICommand { + HttpMethod getTriggerHTTPMethod(); + + HttpMethod getExecutionMethod(); + + URI createTriggerUri(); + + URI createExecutionUri(ActionConfiguration actionConfiguration); + + GoogleAIRequestDTO makeRequestBody(ActionConfiguration actionConfiguration); + + void validateRequest(ActionConfiguration actionConfiguration); +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/constants/GoogleAIConstants.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/constants/GoogleAIConstants.java new file mode 100644 index 000000000000..b2f6bd2caf89 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/constants/GoogleAIConstants.java @@ -0,0 +1,32 @@ +package com.external.plugins.constants; + +import org.springframework.web.reactive.function.client.ExchangeStrategies; + +import java.util.List; + +public class GoogleAIConstants { + public static final String GOOGLE_AI_API_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta"; + public static final String MODELS = "/models"; + public static final String GENERATE_CONTENT_MODELS = "GENERATE_CONTENT_MODELS"; + public static final String GENERATE_CONTENT = "GENERATE_CONTENT"; + public static final String GENERATE_CONTENT_MODEL = "generateContentModel"; + public static final String GENERATE_CONTENT_ACTION = ":generateContent"; + public static final String COMMAND = "command"; + public static final String DATA = "data"; + public static final String VIEW_TYPE = "viewType"; + public static final String COMPONENT_DATA = "componentData"; + public static final String BODY = "body"; + public static final String ROLE = "role"; + public static final String TYPE = "type"; + public static final String CONTENT = "content"; + public static final String KEY = "key"; + public static final String MESSAGES = "messages"; + public static final String LABEL = "label"; + public static final String VALUE = "value"; + public static final List<String> GOOGLE_AI_MODELS = List.of("gemini-pro"); + public static final ExchangeStrategies EXCHANGE_STRATEGIES = ExchangeStrategies.builder() + .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(/* 10MB */ 10 * 1024 * 1024)) + .build(); + public static final String JSON = "json"; + public static final String COMPONENT = "component"; +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/constants/GoogleAIErrorMessages.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/constants/GoogleAIErrorMessages.java new file mode 100644 index 000000000000..b569a4d7ad75 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/constants/GoogleAIErrorMessages.java @@ -0,0 +1,14 @@ +package com.external.plugins.constants; + +public class GoogleAIErrorMessages { + public static final String STRING_APPENDER = "%s %s"; + public static final String EXECUTION_FAILURE = "Query failed to execute because"; + public static final String QUERY_FAILED_TO_EXECUTE = "Your query failed to execute"; + public static final String MODEL_NOT_SELECTED = "model hasn't been selected. Please select a model"; + public static final String QUERY_NOT_CONFIGURED = "query is not configured."; + public static final String INCORRECT_MESSAGE_FORMAT = + "messages object is not correctly configured. Please provide a list of messages"; + public static final String EMPTY_API_KEY = "API key should not be empty. Please add an API key"; + public static final String INVALID_API_KEY = + "Invalid authentication credentials provided in datasource configurations"; +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/GoogleAIRequestDTO.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/GoogleAIRequestDTO.java new file mode 100644 index 000000000000..9307abdb5dcd --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/GoogleAIRequestDTO.java @@ -0,0 +1,30 @@ +package com.external.plugins.models; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class GoogleAIRequestDTO { + List<Content> contents; + + @Data + @AllArgsConstructor + public static class Content { + Role role; + List<Part> parts; + } + + @Data + @AllArgsConstructor + public static class Part { + String text; + } +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/Role.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/Role.java new file mode 100644 index 000000000000..ee2f1fb821ae --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/Role.java @@ -0,0 +1,17 @@ +package com.external.plugins.models; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum Role { + USER("user"); + + private final String value; + + @Override + public String toString() { + return value; + } +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/Type.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/Type.java new file mode 100644 index 000000000000..e5516fc6ce1c --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/models/Type.java @@ -0,0 +1,16 @@ +package com.external.plugins.models; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum Type { + TEXT("text"); + private final String value; + + @Override + public String toString() { + return this.value; + } +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/utils/GoogleAIMethodStrategy.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/utils/GoogleAIMethodStrategy.java new file mode 100644 index 000000000000..5e9c4d3e0b2e --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/utils/GoogleAIMethodStrategy.java @@ -0,0 +1,47 @@ +package com.external.plugins.utils; + +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.TriggerRequestDTO; +import com.external.plugins.commands.GenerateContentCommand; +import com.external.plugins.commands.GoogleAICommand; +import com.external.plugins.constants.GoogleAIConstants; +import com.google.gson.Gson; +import org.springframework.util.CollectionUtils; +import reactor.core.Exceptions; + +import java.util.Map; + +import static com.external.plugins.utils.RequestUtils.extractDataFromFormData; + +public class GoogleAIMethodStrategy { + public static GoogleAICommand selectTriggerMethod(TriggerRequestDTO triggerRequestDTO, Gson gson) { + String requestType = triggerRequestDTO.getRequestType(); + + return switch (requestType) { + case GoogleAIConstants.GENERATE_CONTENT_MODELS -> new GenerateContentCommand(); + default -> throw Exceptions.propagate( + new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR)); + }; + } + + public static GoogleAICommand selectExecutionMethod(ActionConfiguration actionConfiguration, Gson gson) { + Map<String, Object> formData = actionConfiguration.getFormData(); + if (CollectionUtils.isEmpty(formData)) { + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR); + } + + String command = extractDataFromFormData(formData, GoogleAIConstants.COMMAND); + + return selectExecutionMethod(command); + } + + public static GoogleAICommand selectExecutionMethod(String command) { + return switch (command) { + case GoogleAIConstants.GENERATE_CONTENT -> new GenerateContentCommand(); + default -> throw Exceptions.propagate(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unsupported command: " + command)); + }; + } +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/utils/RequestUtils.java b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/utils/RequestUtils.java new file mode 100644 index 000000000000..048ca6c185d6 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/utils/RequestUtils.java @@ -0,0 +1,107 @@ +package com.external.plugins.utils; + +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.models.ApiKeyAuth; +import com.appsmith.external.models.DatasourceConfiguration; +import com.external.plugins.constants.GoogleAIConstants; +import com.external.plugins.constants.GoogleAIErrorMessages; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.reactive.ClientHttpRequest; +import org.springframework.http.client.reactive.ReactorClientHttpConnector; +import org.springframework.util.StringUtils; +import org.springframework.web.reactive.function.BodyInserter; +import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.util.UriComponentsBuilder; +import reactor.core.publisher.Mono; +import reactor.netty.http.client.HttpClient; +import reactor.netty.resources.ConnectionProvider; + +import java.net.URI; +import java.time.Duration; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import static com.external.plugins.constants.GoogleAIConstants.GENERATE_CONTENT_ACTION; +import static com.external.plugins.constants.GoogleAIConstants.GOOGLE_AI_API_ENDPOINT; +import static com.external.plugins.constants.GoogleAIConstants.KEY; +import static com.external.plugins.constants.GoogleAIConstants.MODELS; + +public class RequestUtils { + + private static final WebClient webClient = createWebClient(); + + public static String extractDataFromFormData(Map<String, Object> formData, String key) { + return (String) ((Map<String, Object>) formData.get(key)).get(GoogleAIConstants.DATA); + } + + public static String extractValueFromFormData(Map<String, Object> formData, String key) { + return (String) formData.get(key); + } + + public static URI createUriFromCommand(String command, String model) { + if (GoogleAIConstants.GENERATE_CONTENT.equals(command)) { + return URI.create(GOOGLE_AI_API_ENDPOINT + MODELS + "/" + model + GENERATE_CONTENT_ACTION); + } else { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unsupported command: " + command); + } + } + + public static Mono<ResponseEntity<byte[]>> makeRequest( + HttpMethod httpMethod, URI uri, ApiKeyAuth apiKeyAuth, BodyInserter<?, ? super ClientHttpRequest> body) { + + if (!StringUtils.hasText(apiKeyAuth.getValue())) { + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, GoogleAIErrorMessages.EMPTY_API_KEY); + } + + return webClient + .method(httpMethod) + .uri(appendKeyInUri(apiKeyAuth.getValue(), uri)) + .contentType(MediaType.APPLICATION_JSON) + .body(body) + .exchangeToMono(clientResponse -> clientResponse.toEntity(byte[].class)); + } + + /** + * Add key query params in requests + * @param apiKey - Google AI API Key + * @param uri - Actual request URI + */ + private static URI appendKeyInUri(String apiKey, URI uri) { + return UriComponentsBuilder.fromUri(uri).queryParam(KEY, apiKey).build().toUri(); + } + + private static WebClient createWebClient() { + // Initializing webClient to be used for http call + WebClient.Builder webClientBuilder = WebClient.builder(); + return webClientBuilder + .exchangeStrategies(GoogleAIConstants.EXCHANGE_STRATEGIES) + .clientConnector(new ReactorClientHttpConnector(HttpClient.create(connectionProvider()))) + .build(); + } + + private static ConnectionProvider connectionProvider() { + return ConnectionProvider.builder("googleAi") + .maxConnections(100) + .maxIdleTime(Duration.ofSeconds(60)) + .maxLifeTime(Duration.ofSeconds(60)) + .pendingAcquireTimeout(Duration.ofSeconds(30)) + .evictInBackground(Duration.ofSeconds(120)) + .build(); + } + + public static Set<String> validateApiKeyAuthDatasource(DatasourceConfiguration datasourceConfiguration) { + Set<String> invalids = new HashSet<>(); + final ApiKeyAuth apiKeyAuth = (ApiKeyAuth) datasourceConfiguration.getAuthentication(); + + if (apiKeyAuth == null || !StringUtils.hasText(apiKeyAuth.getValue())) { + invalids.add(GoogleAIErrorMessages.EMPTY_API_KEY); + } + + return invalids; + } +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/editor/generate.json b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/editor/generate.json new file mode 100644 index 000000000000..fc7442f2ea81 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/editor/generate.json @@ -0,0 +1,79 @@ +{ + "identifier": "CHAT", + "controlType": "SECTION", + "conditionals": { + "show": "{{actionConfiguration.formData.command.data === 'GENERATE_CONTENT'}}" + }, + "children": [ + { + "label": "Models", + "tooltipText": "Select the model for content generation", + "subtitle": "ID of the model to use.", + "isRequired": true, + "propertyName": "generate_content_model_id", + "configProperty": "actionConfiguration.formData.generateContentModel.data", + "controlType": "DROP_DOWN", + "initialValue": "", + "options": [], + "placeholderText": "All models will be fetched.", + "fetchOptionsConditionally": true, + "setFirstOptionAsDefault": true, + "alternateViewTypes": ["json"], + "conditionals": { + "enable": "{{true}}", + "fetchDynamicValues": { + "condition": "{{actionConfiguration.formData.command.data === 'GENERATE_CONTENT'}}", + "config": { + "params": { + "requestType": "GENERATE_CONTENT_MODELS", + "displayType": "DROP_DOWN" + } + } + } + } + }, + { + "label": "Messages", + "tooltipText": "Ask a question", + "subtitle": "A list of messages to generate the content", + "propertyName": "messages", + "isRequired": true, + "configProperty": "actionConfiguration.formData.messages.data", + "controlType": "ARRAY_FIELD", + "addMoreButtonLabel": "Add message", + "alternateViewTypes": ["json"], + "schema": [ + { + "label": "Role", + "key": "role", + "controlType": "DROP_DOWN", + "initialValue": "user", + "options": [ + { + "label": "User", + "value": "user" + } + ] + }, + { + "label": "Type", + "key": "type", + "controlType": "DROP_DOWN", + "initialValue": "text", + "options": [ + { + "label": "Text", + "value": "text" + } + ] + }, + { + "label": "Content", + "key": "content", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "placeholderText": "{{ UserInput.text }}" + } + ] + } + ] +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/editor/root.json b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/editor/root.json new file mode 100644 index 000000000000..60d41f8747c0 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/editor/root.json @@ -0,0 +1,27 @@ +{ + "editor": [ + { + "controlType": "SECTION", + "identifier": "SELECTOR", + "children": [ + { + "label": "Commands", + "description": "Choose the method you would like to use", + "configProperty": "actionConfiguration.formData.command.data", + "controlType": "DROP_DOWN", + "isRequired": true, + "initialValue": "GENERATE_CONTENT", + "options": [ + { + "label": "Generate Content", + "value": "GENERATE_CONTENT" + } + ] + } + ] + } + ], + "files": [ + "generate.json" + ] +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/form.json b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/form.json new file mode 100644 index 000000000000..9f992ffe252c --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/form.json @@ -0,0 +1,43 @@ +{ + "form": [ + { + "sectionName": "Details", + "id": 1, + "children": [ + { + "label": "Authentication type", + "description": "Select the authentication type to use", + "configProperty": "datasourceConfiguration.authentication.authenticationType", + "controlType": "DROP_DOWN", + "initialValue" : "apiKey", + "setFirstOptionAsDefault": true, + "options": [ + { + "label": "API Key", + "value": "apiKey" + } + ], + "isRequired": true + }, + { + "label": "API Key", + "configProperty": "datasourceConfiguration.authentication.value", + "controlType": "INPUT_TEXT", + "dataType": "PASSWORD", + "initialValue": "", + "isRequired": true, + "encrypted": true + }, + { + "label": "Endpoint URL (with or without protocol and port no)", + "configProperty": "datasourceConfiguration.url", + "controlType": "INPUT_TEXT", + "initialValue": "https://generativelanguage.googleapis.com/", + "isRequired": true, + "hidden": true + } + ] + } + ], + "formButton" : ["TEST", "CANCEL", "SAVE"] +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/plugin.properties b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/plugin.properties new file mode 100644 index 000000000000..6231319a908f --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/plugin.properties @@ -0,0 +1,5 @@ +plugin.id=googleai-plugin +plugin.class=com.external.plugins.GoogleAiPlugin +plugin.version=1.0-SNAPSHOT [email protected] +plugin.dependencies= diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json new file mode 100644 index 000000000000..4dd710a3bc3e --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json @@ -0,0 +1,30 @@ +{ + "setting": [ + { + "sectionName": "", + "id": 1, + "children": [ + { + "label": "Run query on page load", + "configProperty": "executeOnLoad", + "controlType": "SWITCH", + "subtitle": "Will refresh data each time the page is loaded" + }, + { + "label": "Request confirmation before running query", + "configProperty": "confirmBeforeExecute", + "controlType": "SWITCH", + "subtitle": "Ask confirmation from the user each time before refreshing data" + }, + { + "label": "Query timeout (in milliseconds)", + "subtitle": "Maximum time after which the query will return", + "configProperty": "actionConfiguration.timeoutInMillisecond", + "controlType": "INPUT_TEXT", + "initialValue": 60000, + "dataType": "NUMBER" + } + ] + } + ] +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/test/java/com/external/plugins/GenerateContentCommandTest.java b/app/server/appsmith-plugins/googleAiPlugin/src/test/java/com/external/plugins/GenerateContentCommandTest.java new file mode 100644 index 000000000000..a7178c683bc5 --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/test/java/com/external/plugins/GenerateContentCommandTest.java @@ -0,0 +1,57 @@ +package com.external.plugins; + +import com.appsmith.external.models.ActionConfiguration; +import com.external.plugins.commands.GenerateContentCommand; +import com.external.plugins.models.GoogleAIRequestDTO; +import com.external.plugins.models.Role; +import com.external.plugins.models.Type; +import com.google.gson.Gson; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.net.URI; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.external.plugins.constants.GoogleAIConstants.CONTENT; +import static com.external.plugins.constants.GoogleAIConstants.DATA; +import static com.external.plugins.constants.GoogleAIConstants.GENERATE_CONTENT_MODEL; +import static com.external.plugins.constants.GoogleAIConstants.MESSAGES; +import static com.external.plugins.constants.GoogleAIConstants.ROLE; +import static com.external.plugins.constants.GoogleAIConstants.TYPE; + +public class GenerateContentCommandTest { + GenerateContentCommand generateContentCommand = new GenerateContentCommand(); + + @Test + public void testCreateTriggerUri() { + Assertions.assertEquals(URI.create(""), generateContentCommand.createTriggerUri()); + } + + @Test + public void testCreateExecutionUri() { + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setFormData(Map.of(GENERATE_CONTENT_MODEL, Map.of(DATA, "gemini-pro"))); + URI uri = generateContentCommand.createExecutionUri(actionConfiguration); + Assertions.assertEquals( + "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent", uri.toString()); + } + + @Test + public void testMakeRequestBody_withValidData() { + // Test with valid form data + ActionConfiguration actionConfiguration = new ActionConfiguration(); + Map<String, Object> formData = new HashMap<>(); + Map<String, Object> message = new HashMap<>(); + message.put(ROLE, Role.USER.toString()); + message.put(TYPE, Type.TEXT.toString()); + message.put(CONTENT, "Hello Gemini"); + formData.put(MESSAGES, Map.of(DATA, List.of(message))); + actionConfiguration.setFormData(formData); + GoogleAIRequestDTO googleAIRequestDTO = generateContentCommand.makeRequestBody(actionConfiguration); + Assertions.assertEquals( + "{\"contents\":[{\"role\":\"USER\",\"parts\":[{\"text\":\"Hello Gemini\"}]}]}", + new Gson().toJson(googleAIRequestDTO)); + } +} diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/test/java/com/external/plugins/GoogleAiPluginTest.java b/app/server/appsmith-plugins/googleAiPlugin/src/test/java/com/external/plugins/GoogleAiPluginTest.java new file mode 100644 index 000000000000..dd8b0b757feb --- /dev/null +++ b/app/server/appsmith-plugins/googleAiPlugin/src/test/java/com/external/plugins/GoogleAiPluginTest.java @@ -0,0 +1,134 @@ +package com.external.plugins; + +import com.appsmith.external.models.ApiKeyAuth; +import com.appsmith.external.models.DatasourceConfiguration; +import com.appsmith.external.models.DatasourceTestResult; +import com.appsmith.external.models.TriggerRequestDTO; +import com.appsmith.external.models.TriggerResultDTO; +import com.appsmith.external.services.SharedConfig; +import com.external.plugins.constants.GoogleAIConstants; +import com.external.plugins.constants.GoogleAIErrorMessages; +import mockwebserver3.MockResponse; +import mockwebserver3.MockWebServer; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.external.plugins.constants.GoogleAIConstants.LABEL; +import static com.external.plugins.constants.GoogleAIConstants.VALUE; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class GoogleAiPluginTest { + private static MockWebServer mockEndpoint; + + public static class MockSharedConfig implements SharedConfig { + + @Override + public int getCodecSize() { + return 10 * 1024 * 1024; + } + + @Override + public int getMaxResponseSize() { + return 10000; + } + + @Override + public String getRemoteExecutionUrl() { + return ""; + } + } + + GoogleAiPlugin.GoogleAiPluginExecutor pluginExecutor = + new GoogleAiPlugin.GoogleAiPluginExecutor(new MockSharedConfig()); + + @BeforeEach + public void setUp() throws IOException { + mockEndpoint = new MockWebServer(); + mockEndpoint.start(); + } + + @AfterEach + public void tearDown() throws IOException { + mockEndpoint.shutdown(); + } + + @Test + public void testValidateDatasourceGivesNoInvalidsWhenConfiguredWithString() { + ApiKeyAuth apiKeyAuth = new ApiKeyAuth(); + apiKeyAuth.setValue("apiKey"); + + DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration(); + datasourceConfiguration.setAuthentication(apiKeyAuth); + + Set<String> invalids = pluginExecutor.validateDatasource(datasourceConfiguration); + assertEquals(invalids.size(), 0); + } + + @Test + public void testValidateDatasourceGivesInvalids() { + Set<String> invalids = pluginExecutor.validateDatasource(new DatasourceConfiguration()); + assertEquals(invalids.size(), 1); + assertEquals(invalids, Set.of(GoogleAIErrorMessages.EMPTY_API_KEY)); + } + + @Test + public void verifyTestDatasourceReturnsFalse() { + ApiKeyAuth apiKeyAuth = new ApiKeyAuth(); + apiKeyAuth.setValue("apiKey"); + DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration(); + datasourceConfiguration.setAuthentication(apiKeyAuth); + + MockResponse mockResponse = new MockResponse(); + mockResponse.setResponseCode(401); + mockEndpoint.enqueue(mockResponse); + + Mono<DatasourceTestResult> datasourceTestResultMono = pluginExecutor.testDatasource(datasourceConfiguration); + + StepVerifier.create(datasourceTestResultMono) + .assertNext(datasourceTestResult -> { + assertEquals(datasourceTestResult.getInvalids().size(), 1); + assertFalse(datasourceTestResult.isSuccess()); + }) + .verifyComplete(); + } + + @Test + public void verifyDatasourceTriggerResultsForChatModels() { + ApiKeyAuth apiKeyAuth = new ApiKeyAuth(); + apiKeyAuth.setValue("apiKey"); + DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration(); + datasourceConfiguration.setAuthentication(apiKeyAuth); + String responseBody = "[\"gemini-pro\"]"; + MockResponse mockResponse = new MockResponse().setBody(responseBody); + mockResponse.setResponseCode(200); + mockEndpoint.enqueue(mockResponse); + + TriggerRequestDTO request = new TriggerRequestDTO(); + request.setRequestType(GoogleAIConstants.GENERATE_CONTENT_MODEL); + Mono<TriggerResultDTO> datasourceTriggerResultMono = + pluginExecutor.trigger(null, datasourceConfiguration, request); + + StepVerifier.create(datasourceTriggerResultMono) + .assertNext(result -> { + assertTrue(result.getTrigger() instanceof List<?>); + assertEquals(((List) result.getTrigger()).size(), 1); + assertEquals(result.getTrigger(), getDataToMap(List.of("gemini-pro"))); + }) + .verifyComplete(); + } + + private List<Map<String, String>> getDataToMap(List<String> data) { + return data.stream().sorted().map(x -> Map.of(LABEL, x, VALUE, x)).collect(Collectors.toList()); + } +} diff --git a/app/server/appsmith-plugins/pom.xml b/app/server/appsmith-plugins/pom.xml index 7abd23a8b696..2d2a6b8b9c86 100644 --- a/app/server/appsmith-plugins/pom.xml +++ b/app/server/appsmith-plugins/pom.xml @@ -62,6 +62,7 @@ <module>openAiPlugin</module> <module>anthropicPlugin</module> + <module>googleAiPlugin</module> </modules> diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration038AddGoogleAIPlugin.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration038AddGoogleAIPlugin.java new file mode 100644 index 000000000000..a0ebb648d183 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration038AddGoogleAIPlugin.java @@ -0,0 +1,52 @@ +package com.appsmith.server.migrations.db.ce; + +import com.appsmith.external.constants.PluginConstants; +import com.appsmith.external.models.PluginType; +import com.appsmith.server.domains.Plugin; +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.springframework.dao.DuplicateKeyException; +import org.springframework.data.mongodb.core.MongoTemplate; + +import static com.appsmith.server.migrations.DatabaseChangelog1.installPluginToAllWorkspaces; + +@Slf4j +@ChangeUnit(order = "038", id = "add-google-ai-plugin", author = " ") +public class Migration038AddGoogleAIPlugin { + private final MongoTemplate mongoTemplate; + + public Migration038AddGoogleAIPlugin(MongoTemplate mongoTemplate) { + this.mongoTemplate = mongoTemplate; + } + + @RollbackExecution + public void rollbackExecution() {} + + @Execution + public void addPluginToDbAndWorkspace() { + Plugin plugin = new Plugin(); + plugin.setName(PluginConstants.PluginName.GOOGLE_AI_PLUGIN_NAME); + plugin.setType(PluginType.AI); + plugin.setPluginName(PluginConstants.PluginName.GOOGLE_AI_PLUGIN_NAME); + plugin.setPackageName(PluginConstants.PackageName.GOOGLE_AI_PLUGIN); + plugin.setUiComponent("UQIDbEditorForm"); + plugin.setDatasourceComponent("DbEditorForm"); + plugin.setResponseType(Plugin.ResponseType.JSON); + plugin.setIconLocation("https://assets.appsmith.com/google-ai.svg"); + plugin.setDocumentationLink("https://docs.appsmith.com/connect-data/reference/google-ai"); + plugin.setDefaultInstall(true); + try { + mongoTemplate.insert(plugin); + } catch (DuplicateKeyException e) { + log.warn(plugin.getPackageName() + " already present in database."); + } + + if (plugin.getId() == null) { + log.error("Failed to insert the Google AI plugin into the database."); + } + + installPluginToAllWorkspaces(mongoTemplate, plugin.getId()); + } +}
a70ca2bc017f05b3066524cf3fc623c224da169b
2022-12-22 12:36:18
Goutham Pratapa
ci: Migrate runners from buildjet to github
false
Migrate runners from buildjet to github
ci
diff --git a/.github/workflows/client-build.yml b/.github/workflows/client-build.yml index 380fe68ccbfd..10dfd6ac2ec4 100644 --- a/.github/workflows/client-build.yml +++ b/.github/workflows/client-build.yml @@ -23,7 +23,7 @@ defaults: jobs: build: - runs-on: buildjet-8vcpu-ubuntu-2004 + runs-on: ubuntu-latest-4-cores # Only run this workflow for internally triggered events if: | github.event.pull_request.head.repo.full_name == github.repository || diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index acf8dcc03694..783b43924469 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -44,7 +44,7 @@ jobs: needs: - prelude - runs-on: buildjet-8vcpu-ubuntu-2004 + runs-on: ubuntu-latest-4-cores defaults: run: diff --git a/.github/workflows/perf-test.yml b/.github/workflows/perf-test.yml index 77bf31c1553e..ef5b44465573 100644 --- a/.github/workflows/perf-test.yml +++ b/.github/workflows/perf-test.yml @@ -18,7 +18,7 @@ defaults: jobs: perf-test: - runs-on: buildjet-4vcpu-ubuntu-2004 + runs-on: ubuntu-latest-4-cores # Only run this workflow for internally triggered events if: | github.event.pull_request.head.repo.full_name == github.repository || diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index 52c6ee03c450..07481a7b7ba0 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -23,7 +23,7 @@ defaults: jobs: build: - runs-on: buildjet-8vcpu-ubuntu-2004 + runs-on: ubuntu-latest-8-cores # Only run this workflow for internally triggered events if: | github.event.pull_request.head.repo.full_name == github.repository || diff --git a/.github/workflows/test-build-docker-image.yml b/.github/workflows/test-build-docker-image.yml index 2f169729966d..3536dcbe61f6 100644 --- a/.github/workflows/test-build-docker-image.yml +++ b/.github/workflows/test-build-docker-image.yml @@ -23,7 +23,7 @@ jobs: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved' && github.event.pull_request.head.repo.full_name == github.repository) - runs-on: buildjet-8vcpu-ubuntu-2004 + runs-on: ubuntu-latest-4-cores defaults: run: working-directory: app/client @@ -399,7 +399,7 @@ jobs: # Only run if the build step is successful if: success() - runs-on: buildjet-4vcpu-ubuntu-2004 + runs-on: ubuntu-latest-4-cores defaults: run: @@ -634,7 +634,7 @@ jobs: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved' && github.event.pull_request.head.repo.full_name == github.repository)) - runs-on: buildjet-4vcpu-ubuntu-2004 + runs-on: ubuntu-latest-4-cores defaults: run: shell: bash @@ -1483,7 +1483,7 @@ jobs: with: name: failed-spec path: ~/failed_spec - + # Download failed_spec_fat list for all fat container jobs - uses: actions/download-artifact@v2 if: needs.fat-container-test.result @@ -1496,7 +1496,7 @@ jobs: - name: "combine all specs" if: needs.ui-test.result != 'success' run: cat ~/failed_spec/failed_spec* >> ~/combined_failed_spec - + # Incase for any fat-container job failure, create combined failed spec - name: "combine all specs for fat" if: needs.fat-container-test.result != 'success' @@ -1532,7 +1532,7 @@ jobs: with: name: combined_failed_spec path: ~/combined_failed_spec - + # Upload combined failed fat spec list to a file # This is done for debugging. - name: upload combined failed spec @@ -1557,8 +1557,8 @@ jobs: package: needs: ui-test - runs-on: buildjet-4vcpu-ubuntu-2004 - # Set permissions since we're using OIDC token authentication between Depot and Github + runs-on: ubuntu-latest + # Set permissions since we're using OIDC token authentication between Depot and GitHub permissions: contents: read id-token: write
d1176dee10e9445fde616389486cd21ab77dcff0
2024-10-16 07:47:04
albinAppsmith
fix: Open settings button not working in response pane (#36887)
false
Open settings button not working in response pane (#36887)
fix
diff --git a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx b/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx index fa73e1ae1ef2..a60834e8f1bf 100644 --- a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx +++ b/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx @@ -38,7 +38,7 @@ import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig import BindDataButton from "./BindDataButton"; import { getPluginActionDebuggerState, - setPluginActionEditorDebuggerState, + setPluginActionEditorSelectedTab, } from "PluginActionEditor/store"; import { EDITOR_TABS } from "constants/QueryEditorConstants"; import { @@ -219,11 +219,7 @@ const QueryResponseTab = (props: Props) => { } const navigateToSettings = useCallback(() => { - dispatch( - setPluginActionEditorDebuggerState({ - selectedTab: EDITOR_TABS.SETTINGS, - }), - ); + dispatch(setPluginActionEditorSelectedTab(EDITOR_TABS.SETTINGS)); }, [dispatch]); const preparedStatementCalloutLinks: CalloutLinkProps[] = [
dbb72c4778c10742b3befe70061b6a927eecb940
2022-12-21 23:35:11
sidhantgoel
feat: Support for Import/Export without ACL (#18997)
false
Support for Import/Export without ACL (#18997)
feat
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/AppsmithRepository.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/AppsmithRepository.java index 180af348e961..7762389a480f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/AppsmithRepository.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/AppsmithRepository.java @@ -9,12 +9,15 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; import java.util.Set; public interface AppsmithRepository<T> { Mono<T> findById(String id, AclPermission permission); + Mono<T> findById(String id, Optional<AclPermission> permission); + Mono<T> findById(String id, List<String> projectionFieldNames, AclPermission permission); Mono<T> updateById(String id, T resource, AclPermission permission); @@ -31,5 +34,7 @@ public interface AppsmithRepository<T> { Mono<T> findByGitSyncIdAndDefaultApplicationId(String defaultApplicationId, String gitSyncId, AclPermission permission); + Mono<T> findByGitSyncIdAndDefaultApplicationId(String defaultApplicationId, String gitSyncId, Optional<AclPermission> permission); + Mono<Boolean> isPermissionPresentForUser(Set<Policy> policies, String permission, String username); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java index dff271d240e0..8fd387e82769 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java @@ -14,7 +14,7 @@ import com.mongodb.DBObject; import com.mongodb.client.result.UpdateResult; import com.querydsl.core.types.Path; -import lombok.extern.slf4j.Slf4j; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.GenericTypeResolver; import org.springframework.data.domain.Sort; @@ -60,7 +60,6 @@ * ``` * Ref: https://theappsmith.slack.com/archives/CPQNLFHTN/p1669100205502599?thread_ts=1668753437.497369&cid=CPQNLFHTN */ -@Slf4j public abstract class BaseAppsmithRepositoryCEImpl<T extends BaseDomain> { protected final ReactiveMongoOperations mongoOperations; @@ -74,6 +73,7 @@ public abstract class BaseAppsmithRepositoryCEImpl<T extends BaseDomain> { protected final static int NO_RECORD_LIMIT = -1; @Autowired + @SuppressWarnings("unchecked") public BaseAppsmithRepositoryCEImpl(ReactiveMongoOperations mongoOperations, MongoConverter mongoConverter, CacheableRepositoryHelper cacheableRepositoryHelper) { this.mongoOperations = mongoOperations; @@ -110,8 +110,8 @@ public Mono<Boolean> isPermissionPresentForUser(Set<Policy> policies, String per }); } - public static final String fieldName(Path path) { - return path != null ? path.getMetadata().getName() : null; + public static final String fieldName(Path<?> path) { + return Optional.ofNullable(path).map(p -> p.getMetadata().getName()).orElse(""); } public static final Criteria notDeleted() { @@ -129,30 +129,36 @@ public static final Criteria notDeleted() { ); } + @Deprecated public static final Criteria userAcl(Set<String> permissionGroups, AclPermission permission) { + Optional<Criteria> criteria = userAcl(permissionGroups, Optional.ofNullable(permission)); + return criteria.orElse(null); + } + + public static final Optional<Criteria> userAcl(Set<String> permissionGroups, Optional<AclPermission> permission) { + if(permission.isEmpty()) { + return Optional.empty(); + } // Check if the permission is being provided by any of the permission groups Criteria permissionGroupCriteria = Criteria.where(fieldName(QBaseDomain.baseDomain.policies)) .elemMatch(Criteria.where("permissionGroups").in(permissionGroups) - .and("permission").is(permission.getValue())); + .and("permission").is(permission.get().getValue())); - return permissionGroupCriteria; + return Optional.of(permissionGroupCriteria); } protected Criteria getIdCriteria(Object id) { return where("id").is(id); } - private Criteria getBranchCriteria(String branchName) { - return where(FieldName.DEFAULT_RESOURCES + "." + FieldName.BRANCH_NAME).is(branchName); - } - protected DBObject getDbObject(Object o) { BasicDBObject basicDBObject = new BasicDBObject(); mongoConverter.write(o, basicDBObject); return basicDBObject; } + @Deprecated public Mono<T> findById(String id, AclPermission permission) { return findById(id, null, permission); } @@ -161,60 +167,69 @@ public Mono<T> findById(String id, List<String> projectionFieldNames, AclPermiss if (id == null) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.ID)); } - return ReactiveSecurityContextHolder.getContext() - .map(ctx -> ctx.getAuthentication()) - .map(auth -> auth.getPrincipal()) - .flatMap(principal -> getAllPermissionGroupsForUser((User) principal)) - .flatMap(permissionGroups -> { - Query query = new Query(getIdCriteria(id)); - query.addCriteria(new Criteria().andOperator(notDeleted(), userAcl(permissionGroups, permission))); - - if(!isEmpty(projectionFieldNames)) { - projectionFieldNames.stream() - .forEach(projectionFieldName -> { - query.fields().include(projectionFieldName); - }); - } + return findById(id, Optional.ofNullable(permission)); + } - return mongoOperations.query(this.genericDomain) - .matching(query) - .one() - .flatMap(obj -> setUserPermissionsInObject(obj, permissionGroups)); - }); + public Mono<T> findById(String id, Optional<AclPermission> permission) { + return getCurrentUserPermissionGroupsIfRequired(permission).flatMap(permissionGroups -> { + Query query = new Query(getIdCriteria(id)); + query.addCriteria(notDeleted()); + Optional<Criteria> userAcl = userAcl(permissionGroups, permission); + if(userAcl.isPresent()) { + query.addCriteria(userAcl.get()); + } + return mongoOperations.query(this.genericDomain) + .matching(query) + .one() + .flatMap(obj -> setUserPermissionsInObject(obj, permissionGroups)); + }); } + @Deprecated public Mono<T> updateById(String id, T resource, AclPermission permission) { if (id == null) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.ID)); } + if (resource == null) { + return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.ID)); + } + return updateById(id, resource, Optional.ofNullable(permission)); + } + + public Mono<T> updateById(String id, T resource, Optional<AclPermission> permission) { + Query query = new Query(Criteria.where("id").is(id)); + + // Set policies to null in the update object + resource.setPolicies(null); + resource.setUpdatedAt(Instant.now()); + + DBObject update = getDbObject(resource); + Update updateObj = new Update(); + update.keySet().stream().forEach(entry -> updateObj.set(entry, update.get(entry))); + return ReactiveSecurityContextHolder.getContext() .map(ctx -> ctx.getAuthentication()) - .map(auth -> auth.getPrincipal()) - .zipWhen(principal -> getAllPermissionGroupsForUser((User) principal)) - .flatMap(touple -> { - User user = (User) touple.getT1(); - Set<String> permissionGroups = touple.getT2(); - Query query = new Query(Criteria.where("id").is(id)); - query.addCriteria(new Criteria().andOperator(notDeleted(), userAcl(permissionGroups, permission))); - - // Set policies to null in the update object - resource.setPolicies(null); - resource.setUpdatedAt(Instant.now()); + .map(auth -> (User) auth.getPrincipal()) + .flatMap(user -> { resource.setModifiedBy(user.getUsername()); - - DBObject update = getDbObject(resource); - Update updateObj = new Update(); - Map<String, Object> updateMap = update.toMap(); - updateMap.entrySet().stream().forEach(entry -> updateObj.set(entry.getKey(), entry.getValue())); - - return mongoOperations.updateFirst(query, updateObj, resource.getClass()) - .flatMap(obj -> { - if (obj.getMatchedCount() == 0) { - return Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, resource.getClass().getSimpleName().toLowerCase(), id)); + return (permission.isPresent() ? getAllPermissionGroupsForUser(user) : Mono.just(Set.<String>of())) + .flatMap(permissionGroups -> { + Optional<Criteria> userAcl = userAcl(permissionGroups, permission); + query.addCriteria(notDeleted()); + if(userAcl.isPresent()) { + query.addCriteria(userAcl.get()); } - return findById(id, permission); - }) - .flatMap(obj -> setUserPermissionsInObject(obj, permissionGroups)); + return mongoOperations.updateFirst(query, updateObj, resource.getClass()) + .flatMap(obj -> { + if (obj.getMatchedCount() == 0) { + return Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, resource.getClass().getSimpleName().toLowerCase(), id)); + } + return findById(id, permission); + }) + .flatMap(obj -> { + return setUserPermissionsInObject(obj, permissionGroups); + }); + }); }); } @@ -246,13 +261,21 @@ public Mono<UpdateResult> updateById(String id, Update updateObj, AclPermission if (id == null) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.ID)); } - return ReactiveSecurityContextHolder.getContext() - .map(ctx -> ctx.getAuthentication()) - .map(auth -> auth.getPrincipal()) - .flatMap(principal -> getAllPermissionGroupsForUser((User) principal)) - .flatMap(permissionGroups -> { - Query query = new Query(Criteria.where("id").is(id)); - query.addCriteria(new Criteria().andOperator(notDeleted(), userAcl(permissionGroups, permission))); + if (updateObj == null) { + return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.ID)); + } + return updateById(id, updateObj, Optional.ofNullable(permission)); + } + + public Mono<UpdateResult> updateById(String id, Update updateObj, Optional<AclPermission> permission) { + Query query = new Query(Criteria.where("id").is(id)); + + if(permission.isEmpty()) { + return mongoOperations.updateFirst(query, updateObj, this.genericDomain); + } + + return getCurrentUserPermissionGroupsIfRequired(permission).flatMap(permissionGroups -> { + query.addCriteria(new Criteria().andOperator(notDeleted(), userAcl(permissionGroups, permission.get()))); return mongoOperations.updateFirst(query, updateObj, this.genericDomain); }); } @@ -261,47 +284,81 @@ public Mono<UpdateResult> updateByCriteria(List<Criteria> criteriaList, Update u if (criteriaList == null) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "criteriaList")); } + if (updateObj == null) { + return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "updateObj")); + } List<Criteria> allCriterias = new ArrayList<>(criteriaList); allCriterias.add(notDeleted()); Query query = new Query(new Criteria().andOperator(allCriterias)); return mongoOperations.updateMulti(query, updateObj, this.genericDomain); } + @Deprecated protected Mono<T> queryOne(List<Criteria> criterias, AclPermission aclPermission) { - return queryOne(criterias, null, aclPermission); + return queryOne(criterias, Optional.ofNullable(aclPermission)); + } + + protected Mono<Set<String>> getCurrentUserPermissionGroupsIfRequired(Optional<AclPermission> permission) { + if(permission.isEmpty()) { + return Mono.just(Set.of()); + } + return getCurrentUserPermissionGroups(); } - protected Mono<T> queryOne(List<Criteria> criterias, List<String> projectionFieldNames, AclPermission aclPermission) { + protected Mono<Set<String>> getCurrentUserPermissionGroups() { return ReactiveSecurityContextHolder.getContext() .map(ctx -> ctx.getAuthentication()) .map(auth -> auth.getPrincipal()) - .flatMap(principal -> getAllPermissionGroupsForUser((User) principal)) - .flatMap(permissionGroups -> { + .flatMap(principal -> getAllPermissionGroupsForUser((User) principal)); + } + + protected Mono<T> queryOne(List<Criteria> criterias, List<String> projectionFieldNames, AclPermission permission) { + Mono<Set<String>> permissionGroupsMono = getCurrentUserPermissionGroupsIfRequired(Optional.ofNullable(permission)); + + return permissionGroupsMono.flatMap(permissionGroups -> { return mongoOperations.query(this.genericDomain) - .matching(createQueryWithPermission(criterias, projectionFieldNames, permissionGroups, aclPermission)) + .matching(createQueryWithPermission(criterias, projectionFieldNames, permissionGroups, permission)) .one() .flatMap(obj -> setUserPermissionsInObject(obj, permissionGroups)); }); } - protected Mono<T> queryFirst(List<Criteria> criterias, AclPermission aclPermission) { - return ReactiveSecurityContextHolder.getContext() - .map(ctx -> ctx.getAuthentication()) - .map(auth -> auth.getPrincipal()) - .flatMap(principal -> getAllPermissionGroupsForUser((User) principal)) - .flatMap(permissionGroups -> { + protected Mono<T> queryOne(List<Criteria> criterias, Optional<AclPermission> permission) { + Mono<Set<String>> permissionGroupsMono = getCurrentUserPermissionGroupsIfRequired(permission); + + return permissionGroupsMono.flatMap(permissionGroups -> { return mongoOperations.query(this.genericDomain) - .matching(createQueryWithPermission(criterias, permissionGroups, aclPermission)) - .first() + .matching(createQueryWithPermission(criterias, permissionGroups, permission)) + .one() .flatMap(obj -> setUserPermissionsInObject(obj, permissionGroups)); }); } - protected Query createQueryWithPermission(List<Criteria> criterias, Set<String> permissionGroups, - AclPermission aclPermission) { + @Deprecated + protected Mono<T> queryFirst(List<Criteria> criterias, AclPermission aclPermission) { + return queryFirst(criterias, Optional.ofNullable(aclPermission)); + } + + protected Mono<T> queryFirst(List<Criteria> criterias, Optional<AclPermission> permission) { + Mono<Set<String>> permissionGroupsMono = getCurrentUserPermissionGroupsIfRequired(permission); + + return permissionGroupsMono.flatMap(permissionGroups -> { + return mongoOperations.query(this.genericDomain) + .matching(createQueryWithPermission(criterias, permissionGroups, permission)) + .first() + .flatMap(obj -> setUserPermissionsInObject(obj, permissionGroups)); + }); + } + + @Deprecated + protected Query createQueryWithPermission(List<Criteria> criterias, Set<String> permissionGroups, AclPermission aclPermission) { return createQueryWithPermission(criterias, null, permissionGroups, aclPermission); } + protected Query createQueryWithPermission(List<Criteria> criterias, Set<String> permissionGroups, Optional<AclPermission> permission) { + return createQueryWithPermission(criterias, null, permissionGroups, permission.orElse(null)); + } + protected Query createQueryWithPermission(List<Criteria> criterias, List<String> projectionFieldNames, Set<String> permissionGroups, AclPermission aclPermission) { @@ -322,76 +379,91 @@ protected Query createQueryWithPermission(List<Criteria> criterias, List<String> return query; } + @Deprecated protected Mono<Long> count(List<Criteria> criterias, AclPermission aclPermission) { - return ReactiveSecurityContextHolder.getContext() - .map(ctx -> ctx.getAuthentication()) - .map(auth -> auth.getPrincipal()) - .flatMap(principal -> getAllPermissionGroupsForUser((User) principal)) - .flatMap(permissionGroups -> - mongoOperations.count( - createQueryWithPermission(criterias, permissionGroups, aclPermission), this.genericDomain - ) - ); + return count(criterias, Optional.ofNullable(aclPermission)); } - protected Mono<Long> count(List<Criteria> criteriaList) { - return mongoOperations.count( - createQueryWithPermission(criteriaList, null, null), this.genericDomain + protected Mono<Long> count(List<Criteria> criterias, Optional<AclPermission> permission) { + Mono<Set<String>> permissionGroupsMono = getCurrentUserPermissionGroupsIfRequired(permission); + + return permissionGroupsMono.flatMap(permissionGroups -> + mongoOperations.count(createQueryWithPermission(criterias, permissionGroups, permission), this.genericDomain) ); } + protected Mono<Long> count(List<Criteria> criteriaList) { + return count(criteriaList, Optional.empty()); + } + + @Deprecated public Flux<T> queryAll(List<Criteria> criterias, AclPermission aclPermission) { - return queryAll(criterias, aclPermission, null); + return queryAll(criterias, Optional.empty(), Optional.ofNullable(aclPermission), Optional.empty(), NO_RECORD_LIMIT); + } + + public Flux<T> queryAll(List<Criteria> criterias, Optional<AclPermission> permission) { + return queryAll(criterias, permission, Optional.empty()); } + @Deprecated public Flux<T> queryAll(List<Criteria> criterias, AclPermission aclPermission, Sort sort) { - return queryAll(criterias, null, aclPermission, sort); + return queryAll(criterias, Optional.empty(), Optional.ofNullable(aclPermission), Optional.ofNullable(sort), NO_RECORD_LIMIT); } + public Flux<T> queryAll(List<Criteria> criterias, Optional<AclPermission> permission, Optional<Sort> sort) { + return queryAll(criterias, Optional.empty(), permission, sort, NO_RECORD_LIMIT); + } + + @Deprecated public Flux<T> queryAll(List<Criteria> criterias, List<String> includeFields, AclPermission aclPermission, Sort sort) { + return queryAll(criterias, Optional.ofNullable(includeFields), Optional.ofNullable(aclPermission), Optional.ofNullable(sort), NO_RECORD_LIMIT); + } + + public Flux<T> queryAll(List<Criteria> criterias, Optional<List<String>> includeFields, Optional<AclPermission> aclPermission, Optional<Sort> sort) { return queryAll(criterias, includeFields, aclPermission, sort, NO_RECORD_LIMIT); } + @Deprecated public Flux<T> queryAll(List<Criteria> criterias, List<String> includeFields, AclPermission aclPermission, Sort sort, int limit) { + return queryAll(criterias, Optional.ofNullable(includeFields), Optional.ofNullable(aclPermission), Optional.ofNullable(sort), limit); + } + + public Flux<T> queryAll( List<Criteria> criterias, Optional<List<String>> includeFields, Optional<AclPermission> permission, Optional<Sort> sort, int limit) { final ArrayList<Criteria> criteriaList = new ArrayList<>(criterias); - return ReactiveSecurityContextHolder.getContext() - .map(ctx -> ctx.getAuthentication()) - .map(auth -> auth.getPrincipal()) - .flatMap(principal -> getAllPermissionGroupsForUser((User) principal)) - .flatMapMany(permissionGroups -> queryAllWithPermissionGroups(criteriaList, includeFields, aclPermission, sort, permissionGroups, limit)); + Mono<Set<String>> permissionGroupsMono = getCurrentUserPermissionGroupsIfRequired(permission); + return permissionGroupsMono.flatMapMany(permissionGroups -> queryAllWithPermissionGroups(criterias, includeFields, permission, sort, permissionGroups, limit)); } + @Deprecated public Flux<T> queryAllWithPermissionGroups(List<Criteria> criterias, List<String> includeFields, AclPermission aclPermission, Sort sort, Set<String> permissionGroups, int limit) { + return queryAllWithPermissionGroups(criterias, Optional.ofNullable(includeFields), Optional.ofNullable(aclPermission), Optional.ofNullable(sort), permissionGroups, limit); + } + + public Flux<T> queryAllWithPermissionGroups(List<Criteria> criterias, + Optional<List<String>> includeFields, + Optional<AclPermission> aclPermission, + Optional<Sort> sortOptional, + Set<String> permissionGroups, + int limit) { final ArrayList<Criteria> criteriaList = new ArrayList<>(criterias); Query query = new Query(); - if (!CollectionUtils.isEmpty(includeFields)) { - for (String includeField : includeFields) { - query.fields().include(includeField); - } - } - + includeFields.ifPresent(fields -> { + fields.forEach(field -> query.fields().include(field)); + }); if (limit != NO_RECORD_LIMIT) { query.limit(limit); } Criteria andCriteria = new Criteria(); - criteriaList.add(notDeleted()); - if (aclPermission != null) { - criteriaList.add(userAcl(permissionGroups, aclPermission)); - } - + userAcl(permissionGroups, aclPermission).ifPresent(criteria -> criteriaList.add(criteria)); andCriteria.andOperator(criteriaList.toArray(new Criteria[0])); - query.addCriteria(andCriteria); - if (sort != null) { - query.with(sort); - } - + sortOptional.ifPresent(sort-> query.with(sort)); return mongoOperations.query(this.genericDomain) .matching(query) .all() @@ -399,17 +471,15 @@ public Flux<T> queryAllWithPermissionGroups(List<Criteria> criterias, } public Mono<T> setUserPermissionsInObject(T obj) { - return ReactiveSecurityContextHolder.getContext() - .map(ctx -> ctx.getAuthentication()) - .map(auth -> auth.getPrincipal()) - .flatMap(principal -> getAllPermissionGroupsForUser((User) principal)) + return getCurrentUserPermissionGroups() .flatMap(permissionGroups -> setUserPermissionsInObject(obj, permissionGroups)); } public Mono<T> setUserPermissionsInObject(T obj, Set<String> permissionGroups) { Set<String> permissions = new HashSet<>(); + obj.setUserPermissions(permissions); - if (CollectionUtils.isEmpty(obj.getPolicies())) { + if (CollectionUtils.isEmpty(obj.getPolicies()) || permissionGroups.isEmpty()) { return Mono.just(obj); } @@ -426,11 +496,15 @@ public Mono<T> setUserPermissionsInObject(T obj, Set<String> permissionGroups) { } } - obj.setUserPermissions(permissions); return Mono.just(obj); } + @Deprecated public Mono<T> findByGitSyncIdAndDefaultApplicationId(String defaultApplicationId, String gitSyncId, AclPermission permission) { + return findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, gitSyncId, Optional.ofNullable(permission)); + } + + public Mono<T> findByGitSyncIdAndDefaultApplicationId(String defaultApplicationId, String gitSyncId, Optional<AclPermission> permission) { final String defaultResources = fieldName(QBaseDomain.baseDomain.defaultResources); Criteria defaultAppIdCriteria = where(defaultResources + "." + FieldName.APPLICATION_ID).is(defaultApplicationId); Criteria gitSyncIdCriteria = where(FieldName.GIT_SYNC_ID).is(gitSyncId); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomActionCollectionRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomActionCollectionRepositoryCE.java index 67b26f5c75f3..f6a5051b7e9d 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomActionCollectionRepositoryCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomActionCollectionRepositoryCE.java @@ -8,11 +8,14 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; public interface CustomActionCollectionRepositoryCE extends AppsmithRepository<ActionCollection> { Flux<ActionCollection> findByApplicationId(String applicationId, AclPermission aclPermission, Sort sort); + Flux<ActionCollection> findByApplicationId(String applicationId, Optional<AclPermission> aclPermission, Optional<Sort> sort); + Flux<ActionCollection> findByApplicationIdAndViewMode(String applicationId, boolean viewMode, AclPermission aclPermission); Flux<ActionCollection> findAllActionCollectionsByNamePageIdsViewModeAndBranch(String name, List<String> pageIds, boolean viewMode, String branchName, AclPermission aclPermission, Sort sort); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomActionCollectionRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomActionCollectionRepositoryCEImpl.java index 642a6853bfd6..c2b04687c0fc 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomActionCollectionRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomActionCollectionRepositoryCEImpl.java @@ -16,6 +16,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; import static org.springframework.data.mongodb.core.query.Criteria.where; @@ -28,6 +29,7 @@ public CustomActionCollectionRepositoryCEImpl(ReactiveMongoOperations mongoOpera @Override + @Deprecated public Flux<ActionCollection> findByApplicationId(String applicationId, AclPermission aclPermission, Sort sort) { Criteria applicationCriteria = where(fieldName(QActionCollection.actionCollection.applicationId)).is(applicationId); @@ -35,6 +37,14 @@ public Flux<ActionCollection> findByApplicationId(String applicationId, AclPermi return queryAll(List.of(applicationCriteria), aclPermission, sort); } + @Override + public Flux<ActionCollection> findByApplicationId(String applicationId, Optional<AclPermission> aclPermission, Optional<Sort> sort) { + + Criteria applicationCriteria = where(fieldName(QActionCollection.actionCollection.applicationId)).is(applicationId); + + return queryAll(List.of(applicationCriteria), aclPermission, sort); + } + @Override public Flux<ActionCollection> findByApplicationIdAndViewMode(String applicationId, boolean viewMode, AclPermission aclPermission) { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomApplicationRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomApplicationRepositoryCE.java index e8d90e1fb51e..9c75b9c58b25 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomApplicationRepositoryCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomApplicationRepositoryCE.java @@ -10,6 +10,7 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.Map; @@ -42,6 +43,8 @@ public interface CustomApplicationRepositoryCE extends AppsmithRepository<Applic Mono<UpdateResult> setGitAuth(String applicationId, GitAuth gitAuth, AclPermission aclPermission); + Mono<Application> getApplicationByGitBranchAndDefaultApplicationId(String defaultApplicationId, String branchName, Optional<AclPermission> permission); + Mono<Application> getApplicationByGitBranchAndDefaultApplicationId(String defaultApplicationId, String branchName, AclPermission aclPermission); Mono<Application> getApplicationByGitBranchAndDefaultApplicationId(String defaultApplicationId, diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomApplicationRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomApplicationRepositoryCEImpl.java index b9f5a9a343af..8c6638713d2f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomApplicationRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomApplicationRepositoryCEImpl.java @@ -27,6 +27,7 @@ import java.time.Instant; import java.util.List; +import java.util.Optional; import java.util.Map; import java.util.Set; @@ -163,6 +164,7 @@ public Mono<UpdateResult> setGitAuth(String applicationId, GitAuth gitAuth, AclP } @Override + @Deprecated public Mono<Application> getApplicationByGitBranchAndDefaultApplicationId(String defaultApplicationId, String branchName, AclPermission aclPermission) { return getApplicationByGitBranchAndDefaultApplicationId(defaultApplicationId, null, branchName, aclPermission); } @@ -179,6 +181,16 @@ public Mono<Application> getApplicationByGitBranchAndDefaultApplicationId(String return queryOne(List.of(defaultAppCriteria, branchNameCriteria), projectionFieldNames, aclPermission); } + @Override + public Mono<Application> getApplicationByGitBranchAndDefaultApplicationId(String defaultApplicationId, String branchName, Optional<AclPermission> aclPermission) { + + String gitApplicationMetadata = fieldName(QApplication.application.gitApplicationMetadata); + + Criteria defaultAppCriteria = where(gitApplicationMetadata + "." + fieldName(QApplication.application.gitApplicationMetadata.defaultApplicationId)).is(defaultApplicationId); + Criteria branchNameCriteria = where(gitApplicationMetadata + "." + fieldName(QApplication.application.gitApplicationMetadata.branchName)).is(branchName); + return queryOne(List.of(defaultAppCriteria, branchNameCriteria), aclPermission); + } + @Override public Flux<Application> getApplicationByGitDefaultApplicationId(String defaultApplicationId, AclPermission permission) { String gitApplicationMetadata = fieldName(QApplication.application.gitApplicationMetadata); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceRepositoryCE.java index 414601700edb..91a8939211ad 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceRepositoryCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceRepositoryCE.java @@ -8,14 +8,19 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.util.Optional; import java.util.Set; public interface CustomDatasourceRepositoryCE extends AppsmithRepository<Datasource> { Flux<Datasource> findAllByWorkspaceId(String workspaceId, AclPermission permission); + Flux<Datasource> findAllByWorkspaceId(String workspaceId, Optional<AclPermission> permission); + Mono<Datasource> findByNameAndWorkspaceId(String name, String workspaceId, AclPermission aclPermission); + Mono<Datasource> findByNameAndWorkspaceId(String name, String workspaceId, Optional<AclPermission> permission); + Mono<Datasource> findById(String id, AclPermission aclPermission); Flux<Datasource> findAllByIds(Set<String> ids, AclPermission permission); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceRepositoryCEImpl.java index cac4d8337d8e..90f5caeffd8d 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceRepositoryCEImpl.java @@ -16,6 +16,7 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; import java.util.Set; import static org.springframework.data.mongodb.core.query.Criteria.where; @@ -28,18 +29,33 @@ public CustomDatasourceRepositoryCEImpl(ReactiveMongoOperations mongoOperations, } @Override + @Deprecated public Flux<Datasource> findAllByWorkspaceId(String workspaceId, AclPermission permission) { Criteria workspaceIdCriteria = where(fieldName(QDatasource.datasource.workspaceId)).is(workspaceId); return queryAll(List.of(workspaceIdCriteria), permission, Sort.by(fieldName(QDatasource.datasource.name))); } @Override + public Flux<Datasource> findAllByWorkspaceId(String workspaceId, Optional<AclPermission> permission) { + Criteria workspaceIdCriteria = where(fieldName(QDatasource.datasource.workspaceId)).is(workspaceId); + return queryAll(List.of(workspaceIdCriteria), permission, Optional.of(Sort.by(fieldName(QDatasource.datasource.name)))); + } + + @Override + @Deprecated public Mono<Datasource> findByNameAndWorkspaceId(String name, String workspaceId, AclPermission aclPermission) { Criteria nameCriteria = where(fieldName(QDatasource.datasource.name)).is(name); Criteria workspaceIdCriteria = where(fieldName(QDatasource.datasource.workspaceId)).is(workspaceId); return queryOne(List.of(nameCriteria, workspaceIdCriteria), aclPermission); } + @Override + public Mono<Datasource> findByNameAndWorkspaceId(String name, String workspaceId, Optional<AclPermission> aclPermission) { + Criteria nameCriteria = where(fieldName(QDatasource.datasource.name)).is(name); + Criteria workspaceIdCriteria = where(fieldName(QDatasource.datasource.workspaceId)).is(workspaceId); + return queryOne(List.of(nameCriteria, workspaceIdCriteria), aclPermission); + } + @Override public Flux<Datasource> findAllByIds(Set<String> ids, AclPermission permission) { Criteria idcriteria = where(fieldName(QDatasource.datasource.id)).in(ids); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomGroupRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomGroupRepositoryCEImpl.java index c5558db4e11d..cb9add30b389 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomGroupRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomGroupRepositoryCEImpl.java @@ -11,6 +11,7 @@ import reactor.core.publisher.Flux; import java.util.List; +import java.util.Optional; import static org.springframework.data.mongodb.core.query.Criteria.where; @@ -26,6 +27,6 @@ public CustomGroupRepositoryCEImpl(ReactiveMongoOperations mongoOperations, Mong public Flux<Group> getAllByWorkspaceId(String workspaceId) { Criteria workspaceIdCriteria = where(fieldName(QGroup.group.workspaceId)).is(workspaceId); - return queryAll(List.of(workspaceIdCriteria), null); + return queryAll(List.of(workspaceIdCriteria), Optional.empty()); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCE.java index e3def5c8c313..e5d350873b6f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCE.java @@ -8,6 +8,7 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; import java.util.Set; public interface CustomNewActionRepositoryCE extends AppsmithRepository<NewAction> { @@ -18,6 +19,8 @@ public interface CustomNewActionRepositoryCE extends AppsmithRepository<NewActio Flux<NewAction> findByPageId(String pageId, AclPermission aclPermission); + Flux<NewAction> findByPageId(String pageId, Optional<AclPermission> aclPermission); + Flux<NewAction> findByPageId(String pageId); Flux<NewAction> findByPageIdAndViewMode(String pageId, Boolean viewMode, AclPermission aclPermission); @@ -38,6 +41,8 @@ Flux<NewAction> findUnpublishedActionsByNameInAndPageIdAndExecuteOnLoadTrue( Flux<NewAction> findByApplicationId(String applicationId, AclPermission aclPermission, Sort sort); + Flux<NewAction> findByApplicationId(String applicationId, Optional<AclPermission> aclPermission, Optional<Sort> sort); + Flux<NewAction> findByApplicationIdAndViewMode(String applicationId, Boolean viewMode, AclPermission aclPermission); Mono<Long> countByDatasourceId(String datasourceId); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCEImpl.java index 929369e503c7..11364ddd4902 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCEImpl.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.Set; import static org.springframework.data.mongodb.core.query.Criteria.where; @@ -38,6 +39,12 @@ public Flux<NewAction> findByApplicationId(String applicationId, AclPermission a return queryAll(List.of(applicationIdCriteria), aclPermission); } + @Override + public Flux<NewAction> findByApplicationId(String applicationId, Optional<AclPermission> aclPermission, Optional<Sort> sort) { + Criteria applicationIdCriteria = where(fieldName(QNewAction.newAction.applicationId)).is(applicationId); + return queryAll(List.of(applicationIdCriteria), aclPermission, sort); + } + @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); @@ -61,9 +68,22 @@ public Flux<NewAction> findByPageId(String pageId, AclPermission aclPermission) return queryAll(List.of(pageCriteria), aclPermission); } + @Override + public Flux<NewAction> findByPageId(String pageId, Optional<AclPermission> aclPermission) { + String unpublishedPage = fieldName(QNewAction.newAction.unpublishedAction) + "." + fieldName(QNewAction.newAction.unpublishedAction.pageId); + String publishedPage = fieldName(QNewAction.newAction.publishedAction) + "." + fieldName(QNewAction.newAction.publishedAction.pageId); + + Criteria pageCriteria = new Criteria().orOperator( + where(unpublishedPage).is(pageId), + where(publishedPage).is(pageId) + ); + + return queryAll(List.of(pageCriteria), aclPermission); + } + @Override public Flux<NewAction> findByPageId(String pageId) { - return this.findByPageId(pageId, null); + return this.findByPageId(pageId, Optional.empty()); } @Override diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewPageRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewPageRepositoryCE.java index 61885bc6e82d..5a6e66407a35 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewPageRepositoryCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewPageRepositoryCE.java @@ -7,11 +7,15 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; public interface CustomNewPageRepositoryCE extends AppsmithRepository<NewPage> { + @Deprecated Flux<NewPage> findByApplicationId(String applicationId, AclPermission aclPermission); + Flux<NewPage> findByApplicationId(String applicationId, Optional<AclPermission> permission); + Flux<NewPage> findByApplicationIdAndNonDeletedEditMode(String applicationId, AclPermission aclPermission); Mono<NewPage> findByIdAndLayoutsIdAndViewMode(String id, String layoutId, AclPermission aclPermission, Boolean viewMode); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewPageRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewPageRepositoryCEImpl.java index 07ee57c4d66f..4d768b25c8c4 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewPageRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewPageRepositoryCEImpl.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; import static org.springframework.data.mongodb.core.query.Criteria.where; @@ -35,6 +36,12 @@ public Flux<NewPage> findByApplicationId(String applicationId, AclPermission acl return queryAll(List.of(applicationIdCriteria), aclPermission); } + @Override + public Flux<NewPage> findByApplicationId(String applicationId, Optional<AclPermission> permission) { + Criteria applicationIdCriteria = where(fieldName(QNewPage.newPage.applicationId)).is(applicationId); + return queryAll(List.of(applicationIdCriteria), permission); + } + @Override public Flux<NewPage> findByApplicationIdAndNonDeletedEditMode(String applicationId, AclPermission aclPermission) { Criteria applicationIdCriteria = where(fieldName(QNewPage.newPage.applicationId)).is(applicationId); 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 6c84da3318d9..880e63f6d857 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 @@ -46,12 +46,14 @@ public GitServiceImpl(UserService userService, DatasourcePermission datasourcePermission, ApplicationPermission applicationPermission, PagePermission pagePermission, - ActionPermission actionPermission) { + ActionPermission actionPermission, + WorkspaceService workspaceService) { super(userService, userDataService, sessionUserService, applicationService, applicationPageService, newPageService, newActionService, actionCollectionService, fileUtils, importExportApplicationService, gitExecutor, responseUtils, emailConfig, analyticsService, gitCloudServicesUtils, gitDeployKeysRepository, datasourceService, pluginService, datasourcePermission, applicationPermission, pagePermission, - actionPermission); + actionPermission, workspaceService); } + } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCE.java index 0d479db0fd37..02cc1e972e5e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCE.java @@ -37,6 +37,8 @@ public interface ActionCollectionServiceCE extends CrudService<ActionCollection, Mono<ActionCollectionDTO> update(String id, ActionCollectionDTO actionCollectionDTO); Mono<ActionCollectionDTO> deleteUnpublishedActionCollection(String id); + + Mono<ActionCollectionDTO> deleteWithoutPermissionUnpublishedActionCollection(String id); Mono<ActionCollectionDTO> deleteUnpublishedActionCollection(String id, String branchName); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCEImpl.java index f0f4b14a9b97..8655ca52e2cc 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ActionCollectionServiceCEImpl.java @@ -45,6 +45,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -322,9 +323,18 @@ public Mono<ActionCollectionDTO> update(String id, ActionCollectionDTO actionCol false))); } + @Override + public Mono<ActionCollectionDTO> deleteWithoutPermissionUnpublishedActionCollection(String id) { + return deleteUnpublishedActionCollectionEx(id, Optional.empty()); + } + @Override public Mono<ActionCollectionDTO> deleteUnpublishedActionCollection(String id) { - Mono<ActionCollection> actionCollectionMono = repository.findById(id, actionPermission.getDeletePermission()) + return deleteUnpublishedActionCollectionEx(id, Optional.of(actionPermission.getDeletePermission())); + } + + public Mono<ActionCollectionDTO> deleteUnpublishedActionCollectionEx(String id, Optional<AclPermission> permission) { + Mono<ActionCollection> actionCollectionMono = repository.findById(id, permission) .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.ACTION_COLLECTION, id))); return actionCollectionMono .flatMap(toDelete -> { 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 dfedd06ed073..cb686fdcc04f 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 @@ -45,6 +45,8 @@ public interface ApplicationPageServiceCE { Mono<PageDTO> deleteUnpublishedPage(String id); + Mono<PageDTO> deleteWithoutPermissionUnpublishedPage(String id); + Mono<Application> publish(String applicationId, boolean isPublishedManually); Mono<Application> publish(String defaultApplicationId, String branchName, boolean isPublishedManually); 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 36ac48012eff..a152613483e8 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 @@ -830,10 +830,32 @@ public Mono<Application> cloneApplication(String applicationId, String branchNam * @param id The pageId which needs to be archived. * @return */ + @Override + public Mono<PageDTO> deleteWithoutPermissionUnpublishedPage(String id) { + return deleteUnpublishedPageEx(id, Optional.empty()); + } + @Override public Mono<PageDTO> deleteUnpublishedPage(String id) { + return deleteUnpublishedPageEx(id, Optional.of(pagePermission.getDeletePermission())); + } + + + /** + * This function archives the unpublished page. This also archives the unpublished action. The reason that the + * entire action is not deleted at this point is to handle the following edge case : + * An application is published with 1 page and 1 action. + * Post publish, create a new page and move the action from the existing page to the new page. Now delete this newly + * created page. + * In this scenario, if we were to delete all actions associated with the page, we would end up deleting an action + * which is currently in published state and is being used. + * + * @param id The pageId which needs to be archived. + * @return + */ + private Mono<PageDTO> deleteUnpublishedPageEx(String id, Optional<AclPermission> permission) { - return newPageService.findById(id, pagePermission.getDeletePermission()) + return newPageService.findById(id, permission) .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.PAGE, id))) .flatMap(page -> { log.debug("Going to archive pageId: {} for applicationId: {}", page.getId(), page.getApplicationId()); 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 1d79721e46c8..d995f0005b0f 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 @@ -1,5 +1,8 @@ package com.appsmith.server.services.ce; +import java.util.Optional; + + import com.appsmith.server.acl.AclPermission; import com.appsmith.server.domains.Application; import com.appsmith.server.domains.GitAuth; @@ -21,6 +24,8 @@ public interface ApplicationServiceCE extends CrudService<Application, String> { Mono<Application> findById(String id, AclPermission aclPermission); + Mono<Application> findById(String id, Optional<AclPermission> aclPermission); + Mono<Application> findByIdAndWorkspaceId(String id, String workspaceId, AclPermission permission); Flux<Application> findByWorkspaceId(String workspaceId, AclPermission permission); @@ -61,6 +66,8 @@ Mono<Application> findByBranchNameAndDefaultApplicationId(String branchName, String defaultApplicationId, AclPermission aclPermission); + Mono<String> findBranchedApplicationId(Optional<String> branchName, String defaultApplicationId, Optional<AclPermission> permission); + Mono<Application> findByBranchNameAndDefaultApplicationId(String branchName, String defaultApplicationId, List<String> projectionFieldNames, 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 9fb136f7e2d3..5824a4514b1d 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 @@ -58,6 +58,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS; @@ -170,11 +171,18 @@ public Mono<Application> findById(String id) { } @Override + @Deprecated public Mono<Application> findById(String id, AclPermission aclPermission) { return repository.findById(id, aclPermission) .flatMap(this::setTransientFields); } + @Override + public Mono<Application> findById(String id, Optional<AclPermission> aclPermission) { + return repository.findById(id, aclPermission) + .flatMap(this::setTransientFields); + } + @Override public Mono<Application> findByIdAndWorkspaceId(String id, String workspaceId, AclPermission permission) { return repository.findByIdAndWorkspaceId(id, workspaceId, permission) @@ -679,8 +687,8 @@ public Mono<Application> saveLastEditInformation(String applicationId) { } public Mono<String> findBranchedApplicationId(String branchName, String defaultApplicationId, AclPermission permission) { - if (StringUtils.isEmpty(branchName)) { - if (StringUtils.isEmpty(defaultApplicationId)) { + if (!StringUtils.hasLength(branchName)) { + if (!StringUtils.hasLength(defaultApplicationId)) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.APPLICATION_ID, defaultApplicationId)); } return Mono.just(defaultApplicationId); @@ -692,6 +700,20 @@ public Mono<String> findBranchedApplicationId(String branchName, String defaultA .map(Application::getId); } + public Mono<String> findBranchedApplicationId(Optional<String> branchName, String defaultApplicationId, Optional<AclPermission> permission) { + if (branchName.isEmpty()) { + if (!StringUtils.hasLength(defaultApplicationId)) { + return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.APPLICATION_ID, defaultApplicationId)); + } + return Mono.just(defaultApplicationId); + } + return repository.getApplicationByGitBranchAndDefaultApplicationId(defaultApplicationId, branchName.get(), permission) + .switchIfEmpty(Mono.error( + new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.APPLICATION, defaultApplicationId + ", " + branchName)) + ) + .map(Application::getId); + } + /** * As part of git sync feature a new application will be created for each branch with reference to main application * feat/new-branch ----> new application in Appsmith diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCE.java index 4a1bfb3df5ca..bdc2ce1be41b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceServiceCE.java @@ -10,6 +10,7 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; import java.util.Set; public interface DatasourceServiceCE extends CrudService<Datasource, String> { @@ -18,6 +19,8 @@ public interface DatasourceServiceCE extends CrudService<Datasource, String> { Mono<Datasource> findByNameAndWorkspaceId(String name, String workspaceId, AclPermission permission); + Mono<Datasource> findByNameAndWorkspaceId(String name, String workspaceId, Optional<AclPermission> permission); + Mono<Datasource> findById(String id, AclPermission aclPermission); Mono<Datasource> findById(String id); @@ -30,6 +33,8 @@ public interface DatasourceServiceCE extends CrudService<Datasource, String> { Flux<Datasource> findAllByWorkspaceId(String workspaceId, AclPermission readDatasources); + Flux<Datasource> findAllByWorkspaceId(String workspaceId, Optional<AclPermission> readDatasources); + Flux<Datasource> saveAll(List<Datasource> datasourceList); Mono<Datasource> populateHintMessages(Datasource datasource); @@ -38,4 +43,6 @@ public interface DatasourceServiceCE extends CrudService<Datasource, String> { Mono<Datasource> getValidDatasourceFromActionMono(ActionDTO actionDTO, AclPermission aclPermission); + Mono<Datasource> createWithoutPermissions(Datasource datasource); + } 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 9dff1cf0c553..c9527dbe307b 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 @@ -55,6 +55,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; @@ -107,6 +108,15 @@ public DatasourceServiceCEImpl(Scheduler scheduler, @Override public Mono<Datasource> create(@NotNull Datasource datasource) { + return createEx(datasource, Optional.of(workspacePermission.getDatasourceCreatePermission())); + } + + @Override + public Mono<Datasource> createWithoutPermissions(Datasource datasource) { + return createEx(datasource, Optional.empty()); + } + + private Mono<Datasource> createEx(@NotNull Datasource datasource, Optional<AclPermission> permission) { String workspaceId = datasource.getWorkspaceId(); if (workspaceId == null) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.WORKSPACE_ID)); @@ -131,7 +141,7 @@ public Mono<Datasource> create(@NotNull Datasource datasource) { Mono<Datasource> datasourceWithPoliciesMono = datasourceMono .flatMap(datasource1 -> { Mono<User> userMono = sessionUserService.getCurrentUser(); - return generateAndSetDatasourcePolicies(userMono, datasource1); + return generateAndSetDatasourcePolicies(userMono, datasource1, permission); }); return datasourceWithPoliciesMono @@ -143,10 +153,11 @@ public Mono<Datasource> create(@NotNull Datasource datasource) { .flatMap(repository::setUserPermissionsInObject); } - private Mono<Datasource> generateAndSetDatasourcePolicies(Mono<User> userMono, Datasource datasource) { + private Mono<Datasource> generateAndSetDatasourcePolicies(Mono<User> userMono, Datasource datasource, Optional<AclPermission> permission) { return userMono .flatMap(user -> { - Mono<Workspace> workspaceMono = workspaceService.findById(datasource.getWorkspaceId(), workspacePermission.getDatasourceCreatePermission()) + Mono<Workspace> workspaceMono = workspaceService.findById(datasource.getWorkspaceId(), permission) + .log() .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.WORKSPACE, datasource.getWorkspaceId()))); return workspaceMono.map(workspace -> { @@ -390,6 +401,11 @@ public Mono<Datasource> findByNameAndWorkspaceId(String name, String workspaceId return repository.findByNameAndWorkspaceId(name, workspaceId, permission); } + @Override + public Mono<Datasource> findByNameAndWorkspaceId(String name, String workspaceId, Optional<AclPermission> permission) { + return repository.findByNameAndWorkspaceId(name, workspaceId, permission); + } + @Override public Mono<Datasource> findById(String id, AclPermission aclPermission) { return repository.findById(id, aclPermission); @@ -435,6 +451,12 @@ public Flux<Datasource> findAllByWorkspaceId(String workspaceId, AclPermission p .flatMap(this::populateHintMessages); } + @Override + public Flux<Datasource> findAllByWorkspaceId(String workspaceId, Optional<AclPermission> permission) { + return repository.findAllByWorkspaceId(workspaceId, permission) + .flatMap(this::populateHintMessages); + } + @Override public Flux<Datasource> saveAll(List<Datasource> datasourceList) { datasourceList 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 ca04049d2244..99f12ec3126b 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 @@ -9,6 +9,7 @@ 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; import com.appsmith.server.constants.Assets; import com.appsmith.server.constants.Entity; @@ -24,6 +25,7 @@ import com.appsmith.server.domains.GitProfile; import com.appsmith.server.domains.Plugin; import com.appsmith.server.domains.UserData; +import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ApplicationImportDTO; import com.appsmith.server.dtos.GitCommitDTO; import com.appsmith.server.dtos.GitConnectDTO; @@ -51,6 +53,7 @@ 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.solutions.ActionPermission; import com.appsmith.server.solutions.ApplicationPermission; import com.appsmith.server.solutions.DatasourcePermission; @@ -134,6 +137,7 @@ public class GitServiceCEImpl implements GitServiceCE { private final ApplicationPermission applicationPermission; private final PagePermission pagePermission; private final ActionPermission actionPermission; + private final WorkspaceService workspaceService; @Override public Mono<Application> updateGitMetadata(String applicationId, GitApplicationMetadata gitApplicationMetadata) { @@ -367,9 +371,8 @@ public Mono<String> commitApplication(GitCommitDTO commitDTO, String defaultAppl updateProfiles.put(DEFAULT, gitProfile); } - UserData update = new UserData(); - update.setGitProfiles(updateProfiles); - return userDataService.update(userData.getUserId(), update); + userData.setGitProfiles(updateProfiles); + return userDataService.updateForCurrentUser(userData); }); } return Mono.just(userData); @@ -1044,14 +1047,14 @@ public Mono<Application> detachRemote(String defaultApplicationId) { // Update all the resources to replace defaultResource Ids with the resource Ids as branchName // will be deleted Flux.fromIterable(application.getPages()) - .flatMap(page -> newPageService.findById(page.getId(), pagePermission.getEditPermission())) + .flatMap(page -> newPageService.findById(page.getId(), Optional.empty())) .map(newPage -> { newPage.setDefaultResources(null); return createDefaultIdsOrUpdateWithGivenResourceIds(newPage, null); }) .collectList() .flatMapMany(newPageService::saveAll) - .flatMap(newPage -> newActionService.findByPageId(newPage.getId(), actionPermission.getEditPermission()) + .flatMap(newPage -> newActionService.findByPageId(newPage.getId(), Optional.empty()) .map(newAction -> { newAction.setDefaultResources(null); if (newAction.getUnpublishedAction() != null) { @@ -1831,9 +1834,12 @@ public Mono<ApplicationImportDTO> importApplicationFromGit(String workspaceId, G return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "Invalid workspace id")); } + Mono<Workspace> workspaceMono = workspaceService.findById(workspaceId, AclPermission.WORKSPACE_CREATE_APPLICATION) + .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.WORKSPACE, workspaceId))); + final String repoName = GitUtils.getRepoName(gitConnectDTO.getRemoteUrl()); Mono<Boolean> isPrivateRepoMono = GitUtils.isRepoPrivate(GitUtils.convertSshUrlToBrowserSupportedUrl(gitConnectDTO.getRemoteUrl())).cache(); - Mono<ApplicationImportDTO> importedApplicationMono = getSSHKeyForCurrentUser() + Mono<ApplicationImportDTO> importedApplicationMono = workspaceMono.then(getSSHKeyForCurrentUser()) .zipWith(isPrivateRepoMono) .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.INVALID_GIT_CONFIGURATION, "Unable to find git configuration for logged-in user. Please contact Appsmith team for support"))) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCE.java index 981e6a00e945..5878d8f07ab0 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCE.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; public interface NewActionServiceCE extends CrudService<NewAction, String> { @@ -58,10 +59,14 @@ public interface NewActionServiceCE extends CrudService<NewAction, String> { Flux<NewAction> findByPageId(String pageId, AclPermission permission); + Flux<NewAction> findByPageId(String pageId, Optional<AclPermission> permission); + Flux<NewAction> findByPageIdAndViewMode(String pageId, Boolean viewMode, AclPermission permission); Flux<NewAction> findAllByApplicationIdAndViewMode(String applicationId, Boolean viewMode, AclPermission permission, Sort sort); + Flux<NewAction> findAllByApplicationIdAndViewMode(String applicationId, Boolean viewMode, Optional<AclPermission> permission, Optional<Sort> sort); + Flux<ActionViewDTO> getActionsForViewMode(String applicationId); Flux<ActionViewDTO> getActionsForViewMode(String defaultApplicationId, String branchName); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java index 00447d473534..84e4d585394e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewActionServiceCEImpl.java @@ -1463,6 +1463,12 @@ public Flux<NewAction> findByPageId(String pageId, AclPermission permission) { return repository.findByPageId(pageId, permission) .flatMap(this::sanitizeAction); } + + @Override + public Flux<NewAction> findByPageId(String pageId, Optional<AclPermission> permission) { + return repository.findByPageId(pageId, permission) + .flatMap(this::sanitizeAction); + } @Override public Flux<NewAction> findByPageIdAndViewMode(String pageId, Boolean viewMode, AclPermission permission) { @@ -1489,6 +1495,25 @@ public Flux<NewAction> findAllByApplicationIdAndViewMode(String applicationId, B .flatMap(this::sanitizeAction); } + @Override + public Flux<NewAction> findAllByApplicationIdAndViewMode(String applicationId, Boolean viewMode, Optional<AclPermission> permission, Optional<Sort> sort) { + return repository.findByApplicationId(applicationId, permission, sort) + // In case of view mode being true, filter out all the actions which haven't been published + .flatMap(action -> { + if (Boolean.TRUE.equals(viewMode)) { + // In case we are trying to fetch published actions but this action has not been published, do not return + if (action.getPublishedAction() == null) { + return Mono.empty(); + } + } + // No need to handle the edge case of unpublished action not being present. This is not possible because + // every created action starts from an unpublishedAction state. + + return Mono.just(action); + }) + .flatMap(this::sanitizeAction); + } + @Override public Flux<ActionViewDTO> getActionsForViewMode(String defaultApplicationId, String branchName) { return applicationService.findBranchedApplicationId(branchName, defaultApplicationId, applicationPermission.getReadPermission()) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewPageServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewPageServiceCE.java index 3e195dea7836..9bc7a8db56bc 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewPageServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewPageServiceCE.java @@ -11,6 +11,7 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; public interface NewPageServiceCE extends CrudService<NewPage, String> { @@ -18,12 +19,16 @@ public interface NewPageServiceCE extends CrudService<NewPage, String> { Mono<NewPage> findById(String pageId, AclPermission aclPermission); + Mono<NewPage> findById(String pageId, Optional<AclPermission> aclPermission); + Mono<PageDTO> findPageById(String pageId, AclPermission aclPermission, Boolean view); Flux<PageDTO> findByApplicationId(String applicationId, AclPermission permission, Boolean view); Flux<NewPage> findNewPagesByApplicationId(String applicationId, AclPermission permission); + Flux<NewPage> findNewPagesByApplicationId(String applicationId, Optional<AclPermission> permission); + Mono<PageDTO> saveUnpublishedPage(PageDTO page); Mono<PageDTO> createDefault(PageDTO object); @@ -65,6 +70,8 @@ Mono<ApplicationPagesDTO> findApplicationPagesByApplicationIdViewMode( Mono<NewPage> archiveById(String id); + Mono<NewPage> archiveWithoutPermissionById(String id); + Flux<NewPage> saveAll(List<NewPage> pages); Mono<String> getNameByPageId(String pageId, boolean isPublishedName); @@ -77,5 +84,7 @@ Mono<ApplicationPagesDTO> findApplicationPagesByApplicationIdViewMode( Mono<NewPage> findByGitSyncIdAndDefaultApplicationId(String defaultApplicationId, String gitSyncId, AclPermission permission); + Mono<NewPage> findByGitSyncIdAndDefaultApplicationId(String defaultApplicationId, String gitSyncId, Optional<AclPermission> permission); + Flux<NewPage> findPageSlugsByApplicationIds(List<String> applicationIds, AclPermission aclPermission); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewPageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewPageServiceCEImpl.java index 6ec2e091d238..30b7f1d0a29c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewPageServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/NewPageServiceCEImpl.java @@ -42,6 +42,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -124,6 +125,11 @@ public Mono<PageDTO> findPageById(String pageId, AclPermission aclPermission, Bo .flatMap(page -> getPageByViewMode(page, view)); } + @Override + public Mono<NewPage> findById(String pageId, Optional<AclPermission> aclPermission) { + return repository.findById(pageId, aclPermission); + } + @Override public Flux<PageDTO> findByApplicationId(String applicationId, AclPermission permission, Boolean view) { return findNewPagesByApplicationId(applicationId, permission) @@ -446,6 +452,11 @@ public Flux<NewPage> findNewPagesByApplicationId(String applicationId, AclPermis return repository.findByApplicationId(applicationId, permission); } + @Override + public Flux<NewPage> findNewPagesByApplicationId(String applicationId, Optional<AclPermission> permission) { + return repository.findByApplicationId(applicationId, permission); + } + @Override public Mono<List<NewPage>> archivePagesByApplicationId(String applicationId, AclPermission permission) { return findNewPagesByApplicationId(applicationId, permission) @@ -508,9 +519,18 @@ public Mono<NewPage> archive(NewPage page) { return repository.archive(page); } + @Override + public Mono<NewPage> archiveWithoutPermissionById(String id) { + return archiveByIdEx(id, Optional.empty()); + } + @Override public Mono<NewPage> archiveById(String id) { - Mono<NewPage> pageMono = this.findById(id, pagePermission.getDeletePermission()) + return archiveByIdEx(id, Optional.of(pagePermission.getDeletePermission())); + } + + public Mono<NewPage> archiveByIdEx(String id, Optional<AclPermission> permission) { + Mono<NewPage> pageMono = this.findById(id, permission) .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.PAGE_ID, id))) .cache(); @@ -593,6 +613,11 @@ public Mono<NewPage> findByGitSyncIdAndDefaultApplicationId(String defaultApplic return repository.findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, gitSyncId, permission); } + @Override + public Mono<NewPage> findByGitSyncIdAndDefaultApplicationId(String defaultApplicationId, String gitSyncId, Optional<AclPermission> permission) { + return repository.findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, gitSyncId, permission); + } + @Override public Flux<NewPage> findPageSlugsByApplicationIds(List<String> applicationIds, AclPermission aclPermission) { return repository.findSlugsByApplicationIds(applicationIds, aclPermission); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/WorkspaceServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/WorkspaceServiceCE.java index 9aac09bce284..af1755832d17 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/WorkspaceServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/WorkspaceServiceCE.java @@ -10,6 +10,7 @@ import reactor.core.publisher.Mono; import java.util.List; +import java.util.Optional; import java.util.Set; public interface WorkspaceServiceCE extends CrudService<Workspace, String> { @@ -24,6 +25,8 @@ public interface WorkspaceServiceCE extends CrudService<Workspace, String> { Mono<Workspace> findById(String id, AclPermission permission); + Mono<Workspace> findById(String id, Optional<AclPermission> permission); + Mono<Workspace> save(Workspace workspace); Mono<Workspace> findByIdAndPluginsPluginId(String workspaceId, String pluginId); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/WorkspaceServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/WorkspaceServiceCEImpl.java index 109089b7a08a..0f1f79122aeb 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/WorkspaceServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/WorkspaceServiceCEImpl.java @@ -51,6 +51,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -467,6 +468,11 @@ public Mono<Workspace> findById(String id, AclPermission permission) { return repository.findById(id, permission); } + @Override + public Mono<Workspace> findById(String id, Optional<AclPermission> permission) { + return repository.findById(id, permission); + } + @Override public Mono<Workspace> save(Workspace workspace) { if (StringUtils.hasLength(workspace.getName())) { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationServiceImplV2.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationServiceImplV2.java index d86b8583e010..e75fc4f51f33 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationServiceImplV2.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationServiceImplV2.java @@ -56,7 +56,7 @@ public ImportExportApplicationServiceImplV2(DatasourceService datasourceService, super(datasourceService, sessionUserService, newActionRepository, datasourceRepository, pluginRepository, workspaceService, applicationService, newPageService, applicationPageService, newPageRepository, newActionService, sequenceService, examplesWorkspaceCloner, actionCollectionRepository, - actionCollectionService, themeService, policyUtils, analyticsService, datasourcePermission, + actionCollectionService, themeService, analyticsService, datasourcePermission, workspacePermission, applicationPermission, pagePermission, actionPermission); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImplV2.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImplV2.java index b30f960d69a1..d6c0ca2b815e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImplV2.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImplV2.java @@ -36,7 +36,6 @@ import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.DefaultResourcesUtils; -import com.appsmith.server.helpers.PolicyUtils; import com.appsmith.server.helpers.TextUtils; import com.appsmith.server.migrations.ApplicationVersion; import com.appsmith.server.migrations.JsonSchemaMigration; @@ -69,7 +68,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.bson.types.ObjectId; import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.dao.DuplicateKeyException; @@ -90,14 +89,11 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; -import static com.appsmith.server.acl.AclPermission.MANAGE_ACTIONS; -import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES; -import static com.appsmith.server.acl.AclPermission.READ_ACTIONS; -import static com.appsmith.server.acl.AclPermission.READ_PAGES; import static com.appsmith.server.acl.AclPermission.READ_THEMES; import static com.appsmith.server.constants.ResourceModes.EDIT; import static com.appsmith.server.constants.ResourceModes.VIEW; @@ -124,7 +120,6 @@ public class ImportExportApplicationServiceCEImplV2 implements ImportExportAppli private final ActionCollectionRepository actionCollectionRepository; private final ActionCollectionService actionCollectionService; private final ThemeService themeService; - private final PolicyUtils policyUtils; private final AnalyticsService analyticsService; private final DatasourcePermission datasourcePermission; private final WorkspacePermission workspacePermission; @@ -240,9 +235,11 @@ public Mono<ApplicationJson> exportApplicationById(String applicationId, Seriali applicationJson.setExportedApplication(application); Set<String> dbNamesUsedInActions = new HashSet<>(); - Flux<NewPage> pageFlux = TRUE.equals(application.getExportWithConfiguration()) - ? newPageRepository.findByApplicationId(applicationId, pagePermission.getReadPermission()) - : newPageRepository.findByApplicationId(applicationId, pagePermission.getEditPermission()); + Optional<AclPermission> optionalPermission = isGitSync ? Optional.empty() : + TRUE.equals(application.getExportWithConfiguration()) + ? Optional.of(pagePermission.getReadPermission()) + : Optional.of(pagePermission.getEditPermission()); + Flux<NewPage> pageFlux = newPageRepository.findByApplicationId(applicationId, optionalPermission); return pageFlux .collectList() @@ -289,10 +286,13 @@ public Mono<ApplicationJson> exportApplicationById(String applicationId, Seriali put(FieldName.PAGE_LIST, updatedPageSet); }}); - Flux<Datasource> datasourceFlux = TRUE.equals(application.getExportWithConfiguration()) - ? datasourceRepository.findAllByWorkspaceId(workspaceId, datasourcePermission.getReadPermission()) - : datasourceRepository.findAllByWorkspaceId(workspaceId, datasourcePermission.getEditPermission()); + Optional<AclPermission> optionalPermission3 = isGitSync ? Optional.empty() + : TRUE.equals(application.getExportWithConfiguration()) + ? Optional.of(datasourcePermission.getReadPermission()) + : Optional.of(datasourcePermission.getEditPermission()); + Flux<Datasource> datasourceFlux = + datasourceRepository.findAllByWorkspaceId(workspaceId, optionalPermission3); return datasourceFlux.collectList(); }) .flatMapMany(datasourceList -> { @@ -300,9 +300,12 @@ public Mono<ApplicationJson> exportApplicationById(String applicationId, Seriali datasourceIdToNameMap.put(datasource.getId(), datasource.getName())); applicationJson.setDatasourceList(datasourceList); - Flux<ActionCollection> actionCollectionFlux = TRUE.equals(application.getExportWithConfiguration()) - ? actionCollectionRepository.findByApplicationId(applicationId, actionPermission.getReadPermission(), null) - : actionCollectionRepository.findByApplicationId(applicationId, actionPermission.getEditPermission(), null); + Optional<AclPermission> optionalPermission1 = isGitSync ? Optional.empty() : + TRUE.equals(application.getExportWithConfiguration()) + ? Optional.of(actionPermission.getReadPermission()) + : Optional.of(actionPermission.getEditPermission()); + Flux<ActionCollection> actionCollectionFlux = + actionCollectionRepository.findByApplicationId(applicationId, optionalPermission1, Optional.empty()); return actionCollectionFlux; }) .map(actionCollection -> { @@ -356,10 +359,13 @@ public Mono<ApplicationJson> exportApplicationById(String applicationId, Seriali applicationJson.setActionCollectionList(actionCollections); applicationJson.getUpdatedResources().put(FieldName.ACTION_COLLECTION_LIST, updatedActionCollectionSet); - Flux<NewAction> actionFlux = TRUE.equals(application.getExportWithConfiguration()) - ? newActionRepository.findByApplicationId(applicationId, actionPermission.getReadPermission(), null) - : newActionRepository.findByApplicationId(applicationId, actionPermission.getEditPermission(), null); + Optional<AclPermission> optionalPermission2 = isGitSync ? Optional.empty() + : TRUE.equals(application.getExportWithConfiguration()) + ? Optional.of(actionPermission.getReadPermission()) + : Optional.of(actionPermission.getEditPermission()); + Flux<NewAction> actionFlux = + newActionRepository.findByApplicationId(applicationId, optionalPermission2, Optional.empty()); return actionFlux; }) .map(newAction -> { @@ -602,14 +608,12 @@ public Mono<ApplicationImportDTO> extractFileAndSaveApplication(String workspace * @return saved application in DB */ public Mono<Application> importApplicationInWorkspace(String workspaceId, ApplicationJson importedDoc) { - return importApplicationInWorkspace(workspaceId, importedDoc, null, null); + return importApplicationInWorkspace(workspaceId, importedDoc, null, null, false, false); } - public Mono<Application> importApplicationInWorkspace(String workspaceId, - ApplicationJson applicationJson, - String applicationId, - String branchName) { - return importApplicationInWorkspace(workspaceId, applicationJson, applicationId, branchName, false); + @Override + public Mono<Application> importApplicationInWorkspace(String workspaceId, ApplicationJson importedDoc, String applicationId, String branchName) { + return importApplicationInWorkspace(workspaceId, importedDoc, applicationId, branchName, false, !StringUtils.isEmpty(branchName)); } /** @@ -647,7 +651,8 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, ApplicationJson applicationJson, String applicationId, String branchName, - boolean appendToApp) { + boolean appendToApp, + boolean isGitSync) { /* 1. Migrate resource to latest schema 2. Fetch workspace by id @@ -686,7 +691,7 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, Mono<User> currUserMono = sessionUserService.getCurrentUser().cache(); final Flux<Datasource> existingDatasourceFlux = datasourceRepository - .findAllByWorkspaceId(workspaceId, datasourcePermission.getEditPermission()) + .findAllByWorkspaceId(workspaceId, isGitSync ? Optional.empty() : Optional.of(datasourcePermission.getEditPermission())) .cache(); assert importedApplication != null : "Received invalid application object!"; @@ -708,7 +713,7 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, pluginMap.put(pluginReference, plugin.getId()); return plugin; }) - .then(workspaceService.findById(workspaceId, workspacePermission.getApplicationCreatePermission())) + .then(workspaceService.findById(workspaceId, isGitSync ? Optional.empty() : Optional.of(workspacePermission.getApplicationCreatePermission()))) .switchIfEmpty(Mono.error( new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.WORKSPACE, workspaceId)) ) @@ -802,7 +807,7 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, importedApplication.setWorkspaceId(workspaceId); // Application Id will be present for GIT sync if (!StringUtils.isEmpty(applicationId)) { - return applicationService.findById(applicationId, applicationPermission.getEditPermission()) + return applicationService.findById(applicationId, Optional.empty()) .switchIfEmpty( Mono.error(new AppsmithException( AppsmithError.ACL_NO_RESOURCE_FOUND, @@ -870,7 +875,7 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, // For git-sync this will not be empty Mono<List<NewPage>> existingPagesMono = newPageService - .findNewPagesByApplicationId(importedApplication.getId(), pagePermission.getEditPermission()) + .findNewPagesByApplicationId(importedApplication.getId(), Optional.empty()) .collectList() .cache(); @@ -1003,8 +1008,8 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, // Delete the pages which were removed during git merge operation // This does not apply to the traditional import via file approach return Flux.fromIterable(invalidPageIds) - .flatMap(applicationPageService::deleteUnpublishedPage) - .flatMap(page -> newPageService.archiveById(page.getId()) + .flatMap(applicationPageService::deleteWithoutPermissionUnpublishedPage) + .flatMap(page -> newPageService.archiveWithoutPermissionById(page.getId()) .onErrorResume(e -> { log.debug("Unable to archive page {} with error {}", page.getId(), e.getMessage()); return Mono.empty(); @@ -1117,7 +1122,7 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, } } return Flux.fromIterable(invalidCollectionIds) - .flatMap(collectionId -> actionCollectionService.deleteUnpublishedActionCollection(collectionId) + .flatMap(collectionId -> actionCollectionService.deleteWithoutPermissionUnpublishedActionCollection(collectionId) // return an empty collection so that the filter can remove it from the list .onErrorResume(throwable -> { log.debug("Failed to delete collection with id {} during import", collectionId); @@ -1136,7 +1141,7 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, // Don't update gitAuth as we are using @Encrypted for private key importedApplication.setGitApplicationMetadata(null); // Map layoutOnLoadActions ids with relevant actions - return newPageService.findNewPagesByApplicationId(importedApplication.getId(), pagePermission.getEditPermission()) + return newPageService.findNewPagesByApplicationId(importedApplication.getId(), Optional.empty()) .flatMap(newPage -> { if (newPage.getDefaultResources() != null) { newPage.getDefaultResources().setBranchName(branchName); @@ -1156,7 +1161,7 @@ private Mono<Application> importApplicationInWorkspace(String workspaceId, stopwatch.stopAndLogTimeInMillis(); final Map<String, Object> data = Map.of( FieldName.APPLICATION_ID, application.getId(), - FieldName.ORGANIZATION_ID, application.getWorkspaceId(), + FieldName.WORKSPACE_ID, application.getWorkspaceId(), "pageCount", applicationJson.getPageList().size(), "actionCount", applicationJson.getActionList().size(), "JSObjectCount", applicationJson.getActionCollectionList().size(), @@ -1288,7 +1293,7 @@ private Flux<NewPage> importAndSavePages(List<NewPage> pages, return newPageService.save(existingPage); } else if (application.getGitApplicationMetadata() != null) { final String defaultApplicationId = application.getGitApplicationMetadata().getDefaultApplicationId(); - return newPageService.findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, newPage.getGitSyncId(), pagePermission.getEditPermission()) + return newPageService.findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, newPage.getGitSyncId(), Optional.empty()) .switchIfEmpty(Mono.defer(() -> { // This is the first page we are saving with given gitSyncId in this instance DefaultResources defaultResources = new DefaultResources(); @@ -1408,7 +1413,7 @@ private Flux<NewAction> importAndSaveAction(List<NewAction> importedNewActionLis return newActionService.save(existingAction); } else if (importedApplication.getGitApplicationMetadata() != null) { final String defaultApplicationId = importedApplication.getGitApplicationMetadata().getDefaultApplicationId(); - return newActionRepository.findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, newAction.getGitSyncId(), actionPermission.getEditPermission()) + return newActionRepository.findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, newAction.getGitSyncId(), Optional.empty()) .switchIfEmpty(Mono.defer(() -> { // This is the first page we are saving with given gitSyncId in this instance DefaultResources defaultResources = new DefaultResources(); @@ -1564,7 +1569,7 @@ private Flux<Tuple2<String, ActionCollection>> importAndSaveActionCollection( ); } else if (importedApplication.getGitApplicationMetadata() != null) { final String defaultApplicationId = importedApplication.getGitApplicationMetadata().getDefaultApplicationId(); - return actionCollectionRepository.findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, actionCollection.getGitSyncId(), actionPermission.getEditPermission()) + return actionCollectionRepository.findByGitSyncIdAndDefaultApplicationId(defaultApplicationId, actionCollection.getGitSyncId(), Optional.empty()) .switchIfEmpty(Mono.defer(() -> { // This is the first page we are saving with given gitSyncId in this instance DefaultResources defaultResources = new DefaultResources(); @@ -1635,7 +1640,7 @@ private Flux<NewAction> updateActionsWithImportedCollectionIds( actionIds.addAll(unpublishedActionIdToCollectionIdMap.keySet()); actionIds.addAll(publishedActionIdToCollectionIdMap.keySet()); return Flux.fromIterable(actionIds) - .flatMap(actionId -> newActionRepository.findById(actionId, actionPermission.getEditPermission())) + .flatMap(actionId -> newActionRepository.findById(actionId, Optional.empty())) .map(newAction -> { // Update collectionId and defaultCollectionIds in actionDTOs ActionDTO unpublishedAction = newAction.getUnpublishedAction(); @@ -1906,7 +1911,7 @@ private Mono<Datasource> createUniqueDatasourceIfNotPresent(Flux<Datasource> exi // No matching existing datasource found, so create a new one. datasource.setIsConfigured(datasourceConfig != null && datasourceConfig.getAuthentication() != null); return datasourceService - .findByNameAndWorkspaceId(datasource.getName(), workspaceId, datasourcePermission.getEditPermission()) + .findByNameAndWorkspaceId(datasource.getName(), workspaceId, Optional.empty()) .flatMap(duplicateNameDatasource -> getUniqueSuffixForDuplicateNameEntity(duplicateNameDatasource, workspaceId) ) @@ -1914,7 +1919,7 @@ private Mono<Datasource> createUniqueDatasourceIfNotPresent(Flux<Datasource> exi datasource.setName(datasource.getName() + suffix); return datasource; }) - .then(datasourceService.create(datasource)); + .then(datasourceService.createWithoutPermissions(datasource)); })); } @@ -2000,8 +2005,8 @@ private DecryptedSensitiveFields getDecryptedFields(Datasource datasource) { public Mono<List<Datasource>> findDatasourceByApplicationId(String applicationId, String workspaceId) { // TODO: Investigate further why datasourcePermission.getReadPermission() is not being used. - Mono<List<Datasource>> listMono = datasourceService.findAllByWorkspaceId(workspaceId, datasourcePermission.getEditPermission()).collectList(); - return newActionService.findAllByApplicationIdAndViewMode(applicationId, false, actionPermission.getReadPermission(), null) + Mono<List<Datasource>> listMono = datasourceService.findAllByWorkspaceId(workspaceId, Optional.empty()).collectList(); + return newActionService.findAllByApplicationIdAndViewMode(applicationId, false, Optional.empty(), Optional.empty()) .collectList() .zipWith(listMono) .flatMap(objects -> { @@ -2107,7 +2112,7 @@ public Mono<Application> mergeApplicationJsonWithApplication(String workspaceId, applicationJson.setActionCollectionList(importedActionCollectionList); } - return importApplicationInWorkspace(workspaceId, applicationJson, applicationId, branchName, true); + return importApplicationInWorkspace(workspaceId, applicationJson, applicationId, branchName, true, !StringUtils.isEmpty(branchName)); } private Mono<Map<String, String>> updateNewPagesBeforeMerge(Mono<List<NewPage>> existingPagesMono, List<NewPage> newPagesList) { @@ -2150,7 +2155,7 @@ private Mono<Map<String, String>> updateNewPagesBeforeMerge(Mono<List<NewPage>> */ private Mono<Application> sendImportExportApplicationAnalyticsEvent(String applicationId, AnalyticsEvents event) { - return applicationService.findById(applicationId, applicationPermission.getReadPermission()) + return applicationService.findById(applicationId, Optional.empty()) .flatMap(application -> { return Mono.zip(Mono.just(application), workspaceService.getById(application.getWorkspaceId())); }) diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java index b7a06ef90f2b..a144e1875834 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java @@ -1,6 +1,7 @@ package com.appsmith.server.services; import com.appsmith.external.models.DefaultResources; +import com.appsmith.server.acl.AclPermission; import com.appsmith.server.acl.PolicyGenerator; import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.ActionCollection; @@ -53,6 +54,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -213,7 +215,7 @@ public void testCreateCollection_withRepeatedActionName_throwsError() throws IOE final JsonNode jsonNode = objectMapper.readValue(mockObjects, JsonNode.class); final NewPage newPage = objectMapper.convertValue(jsonNode.get("newPage"), NewPage.class); Mockito - .when(newPageService.findById(Mockito.any(), Mockito.any())) + .when(newPageService.findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(newPage)); Mockito .when(layoutActionService.isNameAllowed(Mockito.any(), Mockito.any(), Mockito.any())) @@ -256,7 +258,7 @@ public void testCreateCollection_createActionFailure_returnsWithIncompleteCollec final NewPage newPage = objectMapper.convertValue(jsonNode.get("newPage"), NewPage.class); Mockito - .when(newPageService.findById(Mockito.any(), Mockito.any())) + .when(newPageService.findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(newPage)); Mockito .when(layoutActionService.isNameAllowed(Mockito.any(), Mockito.any(), Mockito.any())) @@ -329,7 +331,7 @@ public void testCreateCollection_validCollection_returnsPopulatedCollection() th final NewPage newPage = objectMapper.convertValue(jsonNode.get("newPage"), NewPage.class); Mockito - .when(newPageService.findById(Mockito.any(), Mockito.any())) + .when(newPageService.findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(newPage)); Mockito .when(layoutActionService.isNameAllowed(Mockito.any(), Mockito.any(), Mockito.any())) @@ -425,7 +427,7 @@ public void testUpdateUnpublishedActionCollection_withInvalidId_throwsError() th final NewPage newPage = objectMapper.convertValue(jsonNode.get("newPage"), NewPage.class); Mockito - .when(actionCollectionRepository.findById(Mockito.anyString(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.anyString(), Mockito.<AclPermission>any())) .thenReturn(Mono.empty()); Mockito @@ -436,7 +438,7 @@ public void testUpdateUnpublishedActionCollection_withInvalidId_throwsError() th Mockito .when(newPageService - .findById(Mockito.any(), Mockito.any())) + .findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(newPage)); final Mono<ActionCollectionDTO> actionCollectionDTOMono = @@ -490,7 +492,7 @@ public void testUpdateUnpublishedActionCollection_withModifiedCollection_returns .thenReturn(Mono.just((Mockito.mock(UpdateResult.class)))); Mockito - .when(actionCollectionRepository.findById(Mockito.anyString(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.anyString(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(actionCollection)); Mockito @@ -516,7 +518,7 @@ public void testUpdateUnpublishedActionCollection_withModifiedCollection_returns Mockito .when(newPageService - .findById(Mockito.any(), Mockito.any())) + .findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(newPage)); Mockito.when(actionCollectionRepository.setUserPermissionsInObject(Mockito.any())) @@ -552,7 +554,7 @@ public void testUpdateUnpublishedActionCollection_withModifiedCollection_returns @Test public void testDeleteUnpublishedActionCollection_withInvalidId_throwsError() { Mockito - .when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.any(), Mockito.<Optional<AclPermission>>any())) .thenReturn(Mono.empty()); final Mono<ActionCollectionDTO> actionCollectionMono = @@ -580,7 +582,7 @@ public void testDeleteUnpublishedActionCollection_withPublishedCollectionAndNoAc Instant deletedAt = Instant.now(); Mockito - .when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.any(), Mockito.<Optional<AclPermission>>any())) .thenReturn(Mono.just(actionCollection)); Mockito @@ -614,7 +616,7 @@ public void testDeleteUnpublishedActionCollection_withPublishedCollectionAndActi Instant deletedAt = Instant.now(); Mockito - .when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.any(), Mockito.<Optional<AclPermission>>any())) .thenReturn(Mono.just(actionCollection)); Mockito @@ -651,7 +653,7 @@ public void testDeleteUnpublishedActionCollection_withoutPublishedCollectionAndN actionCollection.getUnpublishedCollection().setDefaultResources(setDefaultResources(actionCollection.getUnpublishedCollection())); Mockito - .when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.any(), Mockito.<Optional<AclPermission>>any())) .thenReturn(Mono.just(actionCollection)); Mockito @@ -684,7 +686,7 @@ public void testDeleteUnpublishedActionCollection_withoutPublishedCollectionAndW actionCollection.getUnpublishedCollection().setDefaultResources(setDefaultResources(actionCollection.getUnpublishedCollection())); Mockito - .when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.any(), Mockito.<Optional<AclPermission>>any())) .thenReturn(Mono.just(actionCollection)); Mockito @@ -783,7 +785,7 @@ public void testRefactorCollectionName_withEmptyActions_returnsValidLayout() { .thenReturn(Mono.just(true)); Mockito - .when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(oldActionCollection)); Mockito @@ -851,7 +853,7 @@ public void testRefactorCollectionName_withActions_returnsValidLayout() { .thenReturn(Mono.just(true)); Mockito - .when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(oldActionCollection)); Mockito @@ -919,7 +921,7 @@ public void testMoveCollection_toValidPage_returnsCollection() throws IOExceptio action.setDefaultResources(actionResources); Mockito - .when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) + .when(actionCollectionRepository.findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(actionCollection)); Mockito @@ -959,7 +961,7 @@ public void testMoveCollection_toValidPage_returnsCollection() throws IOExceptio .thenReturn(Mono.just(newPageDTO)); Mockito - .when(newPageService.findById(Mockito.any(), Mockito.any())) + .when(newPageService.findById(Mockito.any(), Mockito.<AclPermission>any())) .thenReturn(Mono.just(newPage)); LayoutDTO layout = new LayoutDTO(); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/GitServiceCEImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/GitServiceCEImplTest.java index 9ae7d83489aa..b50b972c8b95 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/GitServiceCEImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/GitServiceCEImplTest.java @@ -17,6 +17,7 @@ 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.solutions.ActionPermission; import com.appsmith.server.solutions.ApplicationPermission; import com.appsmith.server.solutions.DatasourcePermission; @@ -86,6 +87,8 @@ public class GitServiceCEImplTest { PagePermission pagePermission; @MockBean ActionPermission actionPermission; + @MockBean + WorkspaceService workspaceService; @BeforeEach public void setup() { @@ -94,7 +97,7 @@ public void setup() { newPageService, newActionService, actionCollectionService, gitFileUtils, importExportApplicationService, gitExecutor, responseUtils, emailConfig, analyticsService, gitCloudServicesUtils, gitDeployKeysRepository, datasourceService, pluginService, datasourcePermission, applicationPermission, pagePermission, - actionPermission + actionPermission, workspaceService ); }
51a5b447b1f05106f416c0748af18debeae8e688
2023-10-13 16:18:45
Valera Melnikov
fix: postcss version (#28042)
false
postcss version (#28042)
fix
diff --git a/app/client/package.json b/app/client/package.json index cfb718db5ee4..2079505bdcd1 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -330,7 +330,7 @@ "msw": "^0.28.0", "pg": "^8.11.3", "plop": "^3.1.1", - "postcss": "^8.4.31", + "postcss": "8.4.31", "postcss-at-rules-variables": "^0.3.0", "postcss-each": "^1.1.0", "postcss-import": "^15.1.0", @@ -377,6 +377,7 @@ "@blueprintjs/core@^3.33.0": "patch:@blueprintjs/core@npm%3A3.47.0#./.yarn/patches/@blueprintjs-core-npm-3.47.0-a5bc1ea927.patch", "@blueprintjs/core@^3.47.0": "patch:@blueprintjs/core@npm%3A3.47.0#./.yarn/patches/@blueprintjs-core-npm-3.47.0-a5bc1ea927.patch", "@blueprintjs/icons": "3.22.0", - "@types/react": "^17.0.2" + "@types/react": "^17.0.2", + "postcss": "8.4.31" } } diff --git a/app/client/yarn.lock b/app/client/yarn.lock index bca591db2e24..6706b5b8aea2 100644 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -10560,7 +10560,7 @@ __metadata: pg: ^8.11.3 plop: ^3.1.1 popper.js: ^1.15.0 - postcss: ^8.4.31 + postcss: 8.4.31 postcss-at-rules-variables: ^0.3.0 postcss-each: ^1.1.0 postcss-import: ^15.1.0 @@ -23718,13 +23718,6 @@ __metadata: languageName: node linkType: hard -"picocolors@npm:^0.2.1": - version: 0.2.1 - resolution: "picocolors@npm:0.2.1" - checksum: 3b0f441f0062def0c0f39e87b898ae7461c3a16ffc9f974f320b44c799418cabff17780ee647fda42b856a1dc45897e2c62047e1b546d94d6d5c6962f45427b2 - languageName: node - linkType: hard - "picocolors@npm:^1.0.0": version: 1.0.0 resolution: "picocolors@npm:1.0.0" @@ -25116,7 +25109,7 @@ __metadata: languageName: node linkType: hard -"postcss@npm:*, postcss@npm:^8.3.5, postcss@npm:^8.4.21, postcss@npm:^8.4.23, postcss@npm:^8.4.27, postcss@npm:^8.4.31, postcss@npm:^8.4.4": +"postcss@npm:8.4.31": version: 8.4.31 resolution: "postcss@npm:8.4.31" dependencies: @@ -25127,16 +25120,6 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^7.0.35": - version: 7.0.39 - resolution: "postcss@npm:7.0.39" - dependencies: - picocolors: ^0.2.1 - source-map: ^0.6.1 - checksum: 4ac793f506c23259189064bdc921260d869a115a82b5e713973c5af8e94fbb5721a5cc3e1e26840500d7e1f1fa42a209747c5b1a151918a9bc11f0d7ed9048e3 - languageName: node - linkType: hard - "postgres-array@npm:~2.0.0": version: 2.0.0 resolution: "postgres-array@npm:2.0.0"
42ea9938fa7ddef73b2a8aad937d783015ae6356
2023-08-11 15:50:13
arunvjn
fix: fixed auto indent in fields that contains JSON inside mustache binding (#26245)
false
fixed auto indent in fields that contains JSON inside mustache binding (#26245)
fix
diff --git a/app/client/cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js b/app/client/cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js index a95ee658fe13..0d50efea4973 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js @@ -4,6 +4,8 @@ import { entityExplorer, homePage, jsEditor, + apiPage, + dataSources, } from "../../../../support/Objects/ObjectsCore"; describe("JSEditor Indendation - Visual tests", () => { @@ -341,4 +343,21 @@ myFun2: async () => { cy.get("div.CodeMirror").type("{cmd+leftArrow}"); cy.get("div.CodeMirror").matchImageSnapshot("jsObjAfterGoLineStartSmart5"); }); + + it("5. Bug 25325 Check if the JS Object in body field is formatted properly on save", () => { + apiPage.CreateApi("FirstAPI"); + apiPage.SelectPaneTab("Body"); + apiPage.SelectSubTab("JSON"); + dataSources.EnterQuery( + `{{ + { + "title": this.params.title, + "due": this.params.due, + assignee: this.params.assignee + } + }}`, + ); + cy.get("body").type(agHelper.isMac ? "{meta}S" : "{ctrl}S"); + cy.get(apiPage.jsonBody).matchImageSnapshot("formattedJSONBodyAfterSave"); + }); }); diff --git a/app/client/cypress/snapshots/JSEditorIndent_spec.js/formattedJSONBodyAfterSave.snap.png b/app/client/cypress/snapshots/JSEditorIndent_spec.js/formattedJSONBodyAfterSave.snap.png new file mode 100644 index 000000000000..1f9afa4c18c7 Binary files /dev/null and b/app/client/cypress/snapshots/JSEditorIndent_spec.js/formattedJSONBodyAfterSave.snap.png differ diff --git a/app/client/cypress/support/Pages/ApiPage.ts b/app/client/cypress/support/Pages/ApiPage.ts index 8cce37159145..c15da6cbccfe 100644 --- a/app/client/cypress/support/Pages/ApiPage.ts +++ b/app/client/cypress/support/Pages/ApiPage.ts @@ -79,6 +79,7 @@ export class ApiPage { _addMore = ".t--addApiHeader"; public _editorDS = ".t--datasource-editor"; public _addMoreHeaderFieldButton = ".t--addApiHeader"; + public jsonBody = `.t--apiFormPostBody`; CreateApi( apiName = "", diff --git a/app/client/src/components/editorComponents/CodeEditor/modes.ts b/app/client/src/components/editorComponents/CodeEditor/modes.ts index b107e2916236..ab3d6bb07a7f 100644 --- a/app/client/src/components/editorComponents/CodeEditor/modes.ts +++ b/app/client/src/components/editorComponents/CodeEditor/modes.ts @@ -90,6 +90,7 @@ Object.keys(MULTIPLEXING_MODE_CONFIGS).forEach((key) => { delimStyle: "binding-brackets", mode: CodeMirror.getMode(config, { name: "javascript", + json: true, }), })), );
44d18376785fd5f99a79f13213e5d14859fbf028
2023-05-15 13:13:10
Goutham Pratapa
ci: disable postgres by default in helm charts (#23155)
false
disable postgres by default in helm charts (#23155)
ci
diff --git a/deploy/helm/Chart.yaml b/deploy/helm/Chart.yaml index e92148e87c98..9e9eeacb0a59 100644 --- a/deploy/helm/Chart.yaml +++ b/deploy/helm/Chart.yaml @@ -11,7 +11,7 @@ sources: - https://github.com/appsmithorg/appsmith home: https://www.appsmith.com/ icon: https://assets.appsmith.com/appsmith-icon.png -version: 2.0.1 +version: 2.0.2 dependencies: - condition: redis.enabled name: redis diff --git a/deploy/helm/values.yaml b/deploy/helm/values.yaml index 0139549243c0..441a38d10773 100644 --- a/deploy/helm/values.yaml +++ b/deploy/helm/values.yaml @@ -307,3 +307,4 @@ applicationConfig: APPSMITH_ENCRYPTION_SALT: "" APPSMITH_CUSTOM_DOMAIN: "" APPSMITH_DISABLE_IFRAME_WIDGET_SANDBOX: "false" + APPSMITH_ENABLE_EMBEDDED_DB: 0
585a19401b987bb452d5661cf24aae09c1ebdf1e
2022-12-21 22:37:15
GitStart-Appsmith
feat: [APPSMTH-29] make step up/down arrows in input Number and Currency widgets optional (#18764)
false
[APPSMTH-29] make step up/down arrows in input Number and Currency widgets optional (#18764)
feat
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/CurrencyInput/CurrencyInput_ShowStepArrows_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/CurrencyInput/CurrencyInput_ShowStepArrows_spec.js new file mode 100644 index 000000000000..80dac3fe6ccc --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/CurrencyInput/CurrencyInput_ShowStepArrows_spec.js @@ -0,0 +1,38 @@ +const widgetsPage = require("../../../../../locators/Widgets.json"); + +const widgetName = "currencyinputwidget"; + +describe("Currency Widget showStepArrows Functionality - ", function() { + it("1. Validate that For new currency input widgets being dragged, the value for showStepArrows should be set to false", () => { + cy.dragAndDropToCanvas(widgetName, { x: 300, y: 400 }); + cy.openPropertyPane(widgetName); + + cy.get(widgetsPage.showStepArrowsToggleCheckBox).should("not.be.checked"); + + cy.get(widgetsPage.inputStepArrows).should("not.exist"); // This is the step arrows + }); + + it("2. Validate that currency input widget, stepArrows should be visible when showStepArrows is set to true", () => { + // Enable showStepArrows to true + cy.togglebar(widgetsPage.showStepArrowsToggleCheckBox); + + cy.get(widgetsPage.inputStepArrows).should("exist"); // step arrows should be visible + }); + + it("3. Toggle test case to validate that currency input widget, stepArrows should be hidden when toggle value is false", () => { + // click on the Js + cy.get(widgetsPage.toggleShowStepArrows).click({ force: true }); + + // Add showStepArrows action and value as false + cy.testJsontext("showsteparrows", `{{false}}`); + + cy.get(widgetsPage.inputStepArrows).should("not.exist"); // step arrows should not be visible + }); + + it("4. Toggle test case to validate that currency input widget, stepArrows should be visible when toggle value is true", () => { + // Add showStepArrows action and value as true + cy.testJsontext("showsteparrows", `{{true}}`); + + cy.get(widgetsPage.inputStepArrows).should("exist"); // step arrows should be visible + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Input/Inputv2_ShowStepArrows_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Input/Inputv2_ShowStepArrows_spec.js new file mode 100644 index 000000000000..b73e50e8e9b2 --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/Input/Inputv2_ShowStepArrows_spec.js @@ -0,0 +1,40 @@ +const widgetsPage = require("../../../../../locators/Widgets.json"); + +const widgetName = "inputwidgetv2"; + +describe("Input Widget V2 showStepArrows Functionality - ", function() { + it("1. Validate that dataType - NUMBER, For new widgets being dragged, the value for showStepArrows should be set to false", () => { + cy.dragAndDropToCanvas(widgetName, { x: 300, y: 400 }); + cy.openPropertyPane(widgetName); + + cy.selectDropdownValue(widgetsPage.inputPropsDataType, "Number"); + + cy.get(widgetsPage.showStepArrowsToggleCheckBox).should("not.be.checked"); + + cy.get(widgetsPage.inputStepArrows).should("not.exist"); // This is the step arrows + }); + + it("2. Validate that dataType - NUMBER, stepArrows should be visible when showStepArrows is set to true", () => { + // Enable showStepArrows to true + cy.togglebar(widgetsPage.showStepArrowsToggleCheckBox); + + cy.get(widgetsPage.inputStepArrows).should("exist"); // step arrows should be visible + }); + + it("3. Toggle test case to validate that dataType - NUMBER, stepArrows should be hidden when toggle value is false", () => { + // click on the Js + cy.get(widgetsPage.toggleShowStepArrows).click({ force: true }); + + // Add showStepArrows action and value as false + cy.testJsontext("showsteparrows", `{{false}}`); + + cy.get(widgetsPage.inputStepArrows).should("not.exist"); // step arrows should not be visible + }); + + it("4. Toggle test case to validate that dataType - NUMBER, stepArrows should be visible when toggle value is true", () => { + // Add showStepArrows action and add value as true + cy.testJsontext("showsteparrows", `{{true}}`); + + cy.get(widgetsPage.inputStepArrows).should("exist"); // step arrows should be visible + }); +}); diff --git a/app/client/cypress/locators/Widgets.json b/app/client/cypress/locators/Widgets.json index c96d7e80243d..0979b2689467 100644 --- a/app/client/cypress/locators/Widgets.json +++ b/app/client/cypress/locators/Widgets.json @@ -4,6 +4,7 @@ "inputWidget": ".t--draggable-inputwidgetv2", "multiSelectWidget": ".t--draggable-multiselectwidgetv2", "togglebutton": "input[type='checkbox']", + "showStepArrowsToggleCheckBox": ".t--property-control-showsteparrows input[type='checkbox']", "inputPropsDataType": ".t--property-control-datatype", "inputdatatypeplaceholder": ".t--property-control-placeholder", "buttonWidget": ".t--draggable-buttonwidget", @@ -98,6 +99,7 @@ "boadercolorPicker": ".t--property-control-bordercolour input", "boxShadowColorPicker": ".t--property-control-shadowcolor input", "boxShadow": ".t--property-control-boxshadow .bp3-button-group", + "inputStepArrows": ".bp3-button-group", "backgroundcolorPicker": ".t--property-control-backgroundcolour input", "backgroundcolorPickerNew": ".t--property-control-backgroundcolor input", "greenColorHex": "#03b365", @@ -154,6 +156,7 @@ "listWidgetName":".t--property-pane-title", "toggleBackground": ".t--property-control-background .t--js-toggle", "toggleItemBackground": ".t--property-control-itembackground .t--js-toggle", + "toggleShowStepArrows": ".t--property-control-showsteparrows .t--js-toggle", "chartPlotGroup": "g.raphael-group-63-plot-group", "toggleEnableMultirowselection": ".t--property-control-enablemulti-rowselection .bp3-control-indicator", "toggleEnableMultirowselection_tablev1": ".t--property-control-enablemultirowselection .bp3-control-indicator", diff --git a/app/client/src/constants/WidgetConstants.tsx b/app/client/src/constants/WidgetConstants.tsx index 7f3fc4a4a6ff..bb2888ff0775 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 = 73; +export const LATEST_PAGE_VERSION = 74; 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 a0cf7c762440..a5d93d4a99e3 100644 --- a/app/client/src/utils/DSLMigration.test.ts +++ b/app/client/src/utils/DSLMigration.test.ts @@ -709,6 +709,15 @@ const migrations: Migration[] = [ ], version: 72, }, + { + functionLookup: [ + { + moduleObj: inputCurrencyMigration, + functionName: "migrateInputWidgetShowStepArrows", + }, + ], + version: 73, + }, ]; const mockFnObj: Record<number, any> = {}; diff --git a/app/client/src/utils/DSLMigrations.ts b/app/client/src/utils/DSLMigrations.ts index a09d9e9f547f..290c1037e7a0 100644 --- a/app/client/src/utils/DSLMigrations.ts +++ b/app/client/src/utils/DSLMigrations.ts @@ -62,7 +62,10 @@ import { migratePhoneInputWidgetAllowFormatting, migratePhoneInputWidgetDefaultDialCode, } from "./migrations/PhoneInputWidgetMigrations"; -import { migrateCurrencyInputWidgetDefaultCurrencyCode } from "./migrations/CurrencyInputWidgetMigrations"; +import { + migrateCurrencyInputWidgetDefaultCurrencyCode, + migrateInputWidgetShowStepArrows, +} from "./migrations/CurrencyInputWidgetMigrations"; import { migrateRadioGroupAlignmentProperty } from "./migrations/RadioGroupWidget"; import { migrateCheckboxSwitchProperty } from "./migrations/PropertyPaneMigrations"; import { migrateChartWidgetReskinningData } from "./migrations/ChartWidgetReskinningMigrations"; @@ -1147,6 +1150,11 @@ export const transformDSL = (currentDSL: DSLWidget, newPage = false) => { if (currentDSL.version === 72) { currentDSL = migrateListWidgetChildrenForAutoHeight(currentDSL); + currentDSL.version = 73; + } + + if (currentDSL.version === 73) { + currentDSL = migrateInputWidgetShowStepArrows(currentDSL); currentDSL.version = LATEST_PAGE_VERSION; } diff --git a/app/client/src/utils/migrations/CurrencyInputWidgetMigrations.test.ts b/app/client/src/utils/migrations/CurrencyInputWidgetMigrations.test.ts index a8e73c9889f9..29e90a0e08c3 100644 --- a/app/client/src/utils/migrations/CurrencyInputWidgetMigrations.test.ts +++ b/app/client/src/utils/migrations/CurrencyInputWidgetMigrations.test.ts @@ -1,5 +1,8 @@ import { DSLWidget } from "widgets/constants"; -import { migrateCurrencyInputWidgetDefaultCurrencyCode } from "./CurrencyInputWidgetMigrations"; +import { + migrateCurrencyInputWidgetDefaultCurrencyCode, + migrateInputWidgetShowStepArrows, +} from "./CurrencyInputWidgetMigrations"; const oldDSLWithCurrencyCode = { widgetName: "MainContainer", @@ -1985,6 +1988,1000 @@ const expectedDSLWithDefaultCurrencyCode2 = { ], }; +const oldDSLWithoutShowStepArrows = { + widgetName: "MainContainer", + backgroundColor: "none", + rightColumn: 1296, + snapColumns: 64, + detachFromLayout: true, + widgetId: "0", + topRow: 0, + bottomRow: 1130, + containerStyle: "none", + snapRows: 125, + parentRowSpace: 1, + type: "CANVAS_WIDGET", + canExtend: true, + version: 52, + minHeight: 890, + parentColumnSpace: 1, + dynamicBindingPathList: [], + leftColumn: 0, + children: [ + { + widgetName: "Table1", + defaultPageSize: 0, + columnOrder: ["step", "task", "status", "action", "customColumn1"], + isVisibleDownload: true, + displayName: "Table", + iconSVG: "/static/media/icon.db8a9cbd.svg", + topRow: 2, + bottomRow: 30, + isSortable: true, + parentRowSpace: 10, + type: "TABLE_WIDGET", + defaultSelectedRow: "0", + hideCard: false, + animateLoading: true, + parentColumnSpace: 20.0625, + dynamicTriggerPathList: [], + dynamicBindingPathList: [ + { + key: "primaryColumns.step.computedValue", + }, + { + key: "primaryColumns.task.computedValue", + }, + { + key: "primaryColumns.status.computedValue", + }, + { + key: "primaryColumns.action.computedValue", + }, + ], + leftColumn: 11, + 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: + "{{currentRow.step === '#1' ? showAlert('Done', 'success') : currentRow.step === '#2' ? navigateTo('https://docs.appsmith.com/core-concepts/connecting-to-data-sources/querying-a-database',undefined,'NEW_WINDOW') : navigateTo('https://docs.appsmith.com/core-concepts/displaying-data-read/display-data-tables',undefined,'NEW_WINDOW')}}", + computedValue: + "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.action))}}", + buttonColor: "#03B365", + menuColor: "#03B365", + labelColor: "#FFFFFF", + }, + customColumn1: { + index: 4, + width: 150, + id: "customColumn1", + columnType: "text", + enableFilter: true, + enableSort: true, + isVisible: true, + isDisabled: false, + isCellVisible: true, + isDerived: true, + label: "test", + computedValue: "", + buttonStyle: "rgb(3, 179, 101)", + buttonLabelColor: "#FFFFFF", + buttonColor: "#03B365", + menuColor: "#03B365", + labelColor: "#FFFFFF", + }, + }, + delimiter: ",", + key: "tezu035xfn", + derivedColumns: { + customColumn1: { + index: 4, + width: 150, + id: "customColumn1", + columnType: "text", + enableFilter: true, + enableSort: true, + isVisible: true, + isDisabled: false, + isCellVisible: true, + isDerived: true, + label: "test", + computedValue: "", + buttonStyle: "rgb(3, 179, 101)", + buttonLabelColor: "#FFFFFF", + buttonColor: "#03B365", + menuColor: "#03B365", + labelColor: "#FFFFFF", + }, + }, + rightColumn: 45, + textSize: "PARAGRAPH", + widgetId: "l7p1322ix5", + isVisibleFilters: true, + tableData: [ + { + step: "#1", + task: "Drop a table", + status: "✅", + action: "", + }, + { + step: "#2", + task: "Create a query fetch_users with the Mock DB", + status: "--", + action: "", + }, + { + step: "#3", + task: "Bind the query using => fetch_users.data", + status: "--", + action: "", + }, + ], + 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, + }, + multiRowSelection: true, + }, + { + widgetName: "Input1", + displayName: "Input", + iconSVG: "/static/media/icon.9f505595.svg", + topRow: 33, + bottomRow: 37, + parentRowSpace: 10, + autoFocus: false, + type: "INPUT_WIDGET_V2", + hideCard: false, + animateLoading: true, + parentColumnSpace: 20.0625, + resetOnSubmit: true, + leftColumn: 11, + labelStyle: "", + inputType: "NUMBER", + isDisabled: false, + key: "tj11un6vmd", + isRequired: false, + rightColumn: 31, + widgetId: "whay9rh6bp", + isVisible: true, + label: "", + version: 2, + parentId: "0", + renderMode: "CANVAS", + isLoading: false, + iconAlign: "left", + defaultText: "", + }, + { + widgetName: "CurrencyInput1", + displayName: "Currency Input", + iconSVG: "/static/media/icon.01a1e03d.svg", + topRow: 44, + bottomRow: 48, + parentRowSpace: 10, + autoFocus: false, + type: "CURRENCY_INPUT_WIDGET", + hideCard: false, + animateLoading: true, + parentColumnSpace: 20.0625, + dynamicPropertyPathList: [{ key: "defaultCurrencyCode" }], + dynamicTriggerPathList: [], + resetOnSubmit: true, + leftColumn: 11, + dynamicBindingPathList: [{ key: "defaultCurrencyCode" }], + labelStyle: "", + isDisabled: false, + key: "4pdqazset5", + isRequired: false, + rightColumn: 31, + widgetId: "0i6is5knem", + isVisible: true, + label: "", + allowCurrencyChange: false, + version: 1, + parentId: "0", + renderMode: "CANVAS", + isLoading: false, + decimals: 0, + iconAlign: "left", + defaultText: "", + defaultCurrencyCode: "{{'USD'}}", + }, + { + widgetName: "PhoneInput1", + dialCode: "+1", + displayName: "Phone Input", + iconSVG: "/static/media/icon.ec4f5c23.svg", + topRow: 54, + bottomRow: 58, + parentRowSpace: 10, + autoFocus: false, + type: "PHONE_INPUT_WIDGET", + hideCard: false, + animateLoading: true, + parentColumnSpace: 20.0625, + dynamicTriggerPathList: [], + resetOnSubmit: true, + leftColumn: 11, + dynamicBindingPathList: [], + countryCode: "US", + labelStyle: "", + isDisabled: false, + key: "hygs5twb8a", + isRequired: false, + rightColumn: 31, + widgetId: "2hdejhkfe2", + allowDialCodeChange: false, + isVisible: true, + label: "", + version: 1, + parentId: "0", + renderMode: "CANVAS", + isLoading: false, + iconAlign: "left", + defaultText: "", + }, + { + isVisible: true, + backgroundColor: "#FFFFFF", + widgetName: "Container1", + containerStyle: "card", + borderColor: "transparent", + borderWidth: "0", + borderRadius: "0", + boxShadow: "NONE", + animateLoading: true, + children: [ + { + isVisible: true, + widgetName: "Canvas1", + version: 1, + detachFromLayout: true, + type: "CANVAS_WIDGET", + hideCard: true, + displayName: "Canvas", + key: "upcnljouz6", + containerStyle: "none", + canExtend: false, + children: [ + { + isVisible: true, + isDisabled: false, + datePickerType: "DATE_PICKER", + label: "", + dateFormat: "YYYY-MM-DD HH:mm", + widgetName: "DatePicker1", + defaultDate: "2022-02-02T12:35:06.838Z", + minDate: "1920-12-31T18:30:00.000Z", + maxDate: "2121-12-31T18:29:00.000Z", + version: 2, + isRequired: false, + closeOnSelection: true, + shortcuts: false, + firstDayOfWeek: 0, + timePrecision: "minute", + animateLoading: true, + type: "DATE_PICKER_WIDGET2", + hideCard: false, + displayName: "DatePicker", + key: "ot1g8a7wsy", + iconSVG: "/static/media/icon.300e5ab8.svg", + widgetId: "b40vzteeen", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 7.2109375, + parentRowSpace: 10, + leftColumn: 3, + rightColumn: 41, + topRow: 1, + bottomRow: 5, + parentId: "onbmx309sa", + }, + { + isVisible: true, + backgroundColor: "#FFFFFF", + widgetName: "Container2", + containerStyle: "card", + borderColor: "transparent", + borderWidth: "0", + borderRadius: "0", + boxShadow: "NONE", + animateLoading: true, + children: [ + { + isVisible: true, + widgetName: "Canvas2", + version: 1, + detachFromLayout: true, + type: "CANVAS_WIDGET", + hideCard: true, + displayName: "Canvas", + key: "upcnljouz6", + containerStyle: "none", + canExtend: false, + children: [ + { + isVisible: true, + animateLoading: true, + text: "Submit", + buttonColor: "#03B365", + buttonVariant: "PRIMARY", + placement: "CENTER", + widgetName: "Button1", + isDisabled: false, + isDefaultClickDisabled: true, + recaptchaType: "V3", + version: 1, + type: "BUTTON_WIDGET", + hideCard: false, + displayName: "Button", + key: "61pqdckhct", + iconSVG: "/static/media/icon.cca02633.svg", + widgetId: "viyg9naglg", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 4.9830322265625, + parentRowSpace: 10, + leftColumn: 4, + rightColumn: 20, + topRow: 3, + bottomRow: 7, + parentId: "847huqpwdl", + }, + ], + minHeight: 400, + widgetId: "847huqpwdl", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 1, + parentRowSpace: 1, + leftColumn: 0, + rightColumn: 173.0625, + topRow: 0, + bottomRow: 400, + parentId: "p1czagf2h9", + }, + ], + version: 1, + type: "CONTAINER_WIDGET", + hideCard: false, + displayName: "Container", + key: "parnsbxrsh", + iconSVG: "/static/media/icon.1977dca3.svg", + isCanvas: true, + widgetId: "p1czagf2h9", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 7.2109375, + parentRowSpace: 10, + leftColumn: 4, + rightColumn: 51, + topRow: 8, + bottomRow: 48, + parentId: "onbmx309sa", + }, + ], + minHeight: 400, + widgetId: "onbmx309sa", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 1, + parentRowSpace: 1, + leftColumn: 0, + rightColumn: 481.5, + topRow: 0, + bottomRow: 500, + parentId: "6v4urdv6p2", + }, + ], + version: 1, + type: "CONTAINER_WIDGET", + hideCard: false, + displayName: "Container", + key: "parnsbxrsh", + iconSVG: "/static/media/icon.1977dca3.svg", + isCanvas: true, + widgetId: "6v4urdv6p2", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 20.0625, + parentRowSpace: 10, + leftColumn: 12, + rightColumn: 36, + topRow: 61, + bottomRow: 111, + parentId: "0", + }, + ], +}; + +const expectedDSLWithShowStepArrows = { + widgetName: "MainContainer", + backgroundColor: "none", + rightColumn: 1296, + snapColumns: 64, + detachFromLayout: true, + widgetId: "0", + topRow: 0, + bottomRow: 1130, + containerStyle: "none", + snapRows: 125, + parentRowSpace: 1, + type: "CANVAS_WIDGET", + canExtend: true, + version: 52, + minHeight: 890, + parentColumnSpace: 1, + dynamicBindingPathList: [], + leftColumn: 0, + children: [ + { + widgetName: "Table1", + defaultPageSize: 0, + columnOrder: ["step", "task", "status", "action", "customColumn1"], + isVisibleDownload: true, + displayName: "Table", + iconSVG: "/static/media/icon.db8a9cbd.svg", + topRow: 2, + bottomRow: 30, + isSortable: true, + parentRowSpace: 10, + type: "TABLE_WIDGET", + defaultSelectedRow: "0", + hideCard: false, + animateLoading: true, + parentColumnSpace: 20.0625, + dynamicTriggerPathList: [], + dynamicBindingPathList: [ + { + key: "primaryColumns.step.computedValue", + }, + { + key: "primaryColumns.task.computedValue", + }, + { + key: "primaryColumns.status.computedValue", + }, + { + key: "primaryColumns.action.computedValue", + }, + ], + leftColumn: 11, + 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: + "{{currentRow.step === '#1' ? showAlert('Done', 'success') : currentRow.step === '#2' ? navigateTo('https://docs.appsmith.com/core-concepts/connecting-to-data-sources/querying-a-database',undefined,'NEW_WINDOW') : navigateTo('https://docs.appsmith.com/core-concepts/displaying-data-read/display-data-tables',undefined,'NEW_WINDOW')}}", + computedValue: + "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.action))}}", + buttonColor: "#03B365", + menuColor: "#03B365", + labelColor: "#FFFFFF", + }, + customColumn1: { + index: 4, + width: 150, + id: "customColumn1", + columnType: "text", + enableFilter: true, + enableSort: true, + isVisible: true, + isDisabled: false, + isCellVisible: true, + isDerived: true, + label: "test", + computedValue: "", + buttonStyle: "rgb(3, 179, 101)", + buttonLabelColor: "#FFFFFF", + buttonColor: "#03B365", + menuColor: "#03B365", + labelColor: "#FFFFFF", + }, + }, + delimiter: ",", + key: "tezu035xfn", + derivedColumns: { + customColumn1: { + index: 4, + width: 150, + id: "customColumn1", + columnType: "text", + enableFilter: true, + enableSort: true, + isVisible: true, + isDisabled: false, + isCellVisible: true, + isDerived: true, + label: "test", + computedValue: "", + buttonStyle: "rgb(3, 179, 101)", + buttonLabelColor: "#FFFFFF", + buttonColor: "#03B365", + menuColor: "#03B365", + labelColor: "#FFFFFF", + }, + }, + rightColumn: 45, + textSize: "PARAGRAPH", + widgetId: "l7p1322ix5", + isVisibleFilters: true, + tableData: [ + { + step: "#1", + task: "Drop a table", + status: "✅", + action: "", + }, + { + step: "#2", + task: "Create a query fetch_users with the Mock DB", + status: "--", + action: "", + }, + { + step: "#3", + task: "Bind the query using => fetch_users.data", + status: "--", + action: "", + }, + ], + 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, + }, + multiRowSelection: true, + }, + { + widgetName: "Input1", + displayName: "Input", + iconSVG: "/static/media/icon.9f505595.svg", + topRow: 33, + bottomRow: 37, + parentRowSpace: 10, + autoFocus: false, + type: "INPUT_WIDGET_V2", + hideCard: false, + animateLoading: true, + parentColumnSpace: 20.0625, + resetOnSubmit: true, + leftColumn: 11, + labelStyle: "", + inputType: "NUMBER", + isDisabled: false, + key: "tj11un6vmd", + isRequired: false, + rightColumn: 31, + widgetId: "whay9rh6bp", + isVisible: true, + showStepArrows: true, + label: "", + version: 2, + parentId: "0", + renderMode: "CANVAS", + isLoading: false, + iconAlign: "left", + defaultText: "", + }, + { + widgetName: "CurrencyInput1", + displayName: "Currency Input", + iconSVG: "/static/media/icon.01a1e03d.svg", + topRow: 44, + bottomRow: 48, + parentRowSpace: 10, + autoFocus: false, + type: "CURRENCY_INPUT_WIDGET", + hideCard: false, + animateLoading: true, + parentColumnSpace: 20.0625, + dynamicPropertyPathList: [{ key: "defaultCurrencyCode" }], + dynamicTriggerPathList: [], + resetOnSubmit: true, + leftColumn: 11, + dynamicBindingPathList: [{ key: "defaultCurrencyCode" }], + labelStyle: "", + isDisabled: false, + key: "4pdqazset5", + isRequired: false, + rightColumn: 31, + widgetId: "0i6is5knem", + isVisible: true, + label: "", + allowCurrencyChange: false, + showStepArrows: true, + version: 1, + parentId: "0", + renderMode: "CANVAS", + isLoading: false, + decimals: 0, + iconAlign: "left", + defaultText: "", + defaultCurrencyCode: "{{'USD'}}", + }, + { + widgetName: "PhoneInput1", + dialCode: "+1", + displayName: "Phone Input", + iconSVG: "/static/media/icon.ec4f5c23.svg", + topRow: 54, + bottomRow: 58, + parentRowSpace: 10, + autoFocus: false, + type: "PHONE_INPUT_WIDGET", + hideCard: false, + animateLoading: true, + parentColumnSpace: 20.0625, + dynamicTriggerPathList: [], + resetOnSubmit: true, + leftColumn: 11, + dynamicBindingPathList: [], + countryCode: "US", + labelStyle: "", + isDisabled: false, + key: "hygs5twb8a", + isRequired: false, + rightColumn: 31, + widgetId: "2hdejhkfe2", + allowDialCodeChange: false, + isVisible: true, + label: "", + version: 1, + parentId: "0", + renderMode: "CANVAS", + isLoading: false, + iconAlign: "left", + defaultText: "", + }, + { + isVisible: true, + backgroundColor: "#FFFFFF", + widgetName: "Container1", + containerStyle: "card", + borderColor: "transparent", + borderWidth: "0", + borderRadius: "0", + boxShadow: "NONE", + animateLoading: true, + children: [ + { + isVisible: true, + widgetName: "Canvas1", + version: 1, + detachFromLayout: true, + type: "CANVAS_WIDGET", + hideCard: true, + displayName: "Canvas", + key: "upcnljouz6", + containerStyle: "none", + canExtend: false, + children: [ + { + isVisible: true, + isDisabled: false, + datePickerType: "DATE_PICKER", + label: "", + dateFormat: "YYYY-MM-DD HH:mm", + widgetName: "DatePicker1", + defaultDate: "2022-02-02T12:35:06.838Z", + minDate: "1920-12-31T18:30:00.000Z", + maxDate: "2121-12-31T18:29:00.000Z", + version: 2, + isRequired: false, + closeOnSelection: true, + shortcuts: false, + firstDayOfWeek: 0, + timePrecision: "minute", + animateLoading: true, + type: "DATE_PICKER_WIDGET2", + hideCard: false, + displayName: "DatePicker", + key: "ot1g8a7wsy", + iconSVG: "/static/media/icon.300e5ab8.svg", + widgetId: "b40vzteeen", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 7.2109375, + parentRowSpace: 10, + leftColumn: 3, + rightColumn: 41, + topRow: 1, + bottomRow: 5, + parentId: "onbmx309sa", + }, + { + isVisible: true, + backgroundColor: "#FFFFFF", + widgetName: "Container2", + containerStyle: "card", + borderColor: "transparent", + borderWidth: "0", + borderRadius: "0", + boxShadow: "NONE", + animateLoading: true, + children: [ + { + isVisible: true, + widgetName: "Canvas2", + version: 1, + detachFromLayout: true, + type: "CANVAS_WIDGET", + hideCard: true, + displayName: "Canvas", + key: "upcnljouz6", + containerStyle: "none", + canExtend: false, + children: [ + { + isVisible: true, + animateLoading: true, + text: "Submit", + buttonColor: "#03B365", + buttonVariant: "PRIMARY", + placement: "CENTER", + widgetName: "Button1", + isDisabled: false, + isDefaultClickDisabled: true, + recaptchaType: "V3", + version: 1, + type: "BUTTON_WIDGET", + hideCard: false, + displayName: "Button", + key: "61pqdckhct", + iconSVG: "/static/media/icon.cca02633.svg", + widgetId: "viyg9naglg", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 4.9830322265625, + parentRowSpace: 10, + leftColumn: 4, + rightColumn: 20, + topRow: 3, + bottomRow: 7, + parentId: "847huqpwdl", + }, + ], + minHeight: 400, + widgetId: "847huqpwdl", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 1, + parentRowSpace: 1, + leftColumn: 0, + rightColumn: 173.0625, + topRow: 0, + bottomRow: 400, + parentId: "p1czagf2h9", + }, + ], + version: 1, + type: "CONTAINER_WIDGET", + hideCard: false, + displayName: "Container", + key: "parnsbxrsh", + iconSVG: "/static/media/icon.1977dca3.svg", + isCanvas: true, + widgetId: "p1czagf2h9", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 7.2109375, + parentRowSpace: 10, + leftColumn: 4, + rightColumn: 51, + topRow: 8, + bottomRow: 48, + parentId: "onbmx309sa", + }, + ], + minHeight: 400, + widgetId: "onbmx309sa", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 1, + parentRowSpace: 1, + leftColumn: 0, + rightColumn: 481.5, + topRow: 0, + bottomRow: 500, + parentId: "6v4urdv6p2", + }, + ], + version: 1, + type: "CONTAINER_WIDGET", + hideCard: false, + displayName: "Container", + key: "parnsbxrsh", + iconSVG: "/static/media/icon.1977dca3.svg", + isCanvas: true, + widgetId: "6v4urdv6p2", + renderMode: "CANVAS", + isLoading: false, + parentColumnSpace: 20.0625, + parentRowSpace: 10, + leftColumn: 12, + rightColumn: 36, + topRow: 61, + bottomRow: 111, + parentId: "0", + }, + ], +}; + describe("CurrencyInputWidgetMigrations - ", () => { describe("migrateCurrencyInputWidgetDefaultCountryCode - ", () => { it("should test that its only migrating default country code with dynamic value", () => { @@ -2003,4 +3000,13 @@ describe("CurrencyInputWidgetMigrations - ", () => { ).toEqual(expectedDSLWithDefaultCurrencyCode2); }); }); + + describe("Input Widget for Number-Type and Currency Migration - ", () => { + it("should test that its only migrating showStepArrows", () => { + const migratedDsl = migrateInputWidgetShowStepArrows( + (oldDSLWithoutShowStepArrows as unknown) as DSLWidget, + ); + expect(migratedDsl).toEqual(expectedDSLWithShowStepArrows); + }); + }); }); diff --git a/app/client/src/utils/migrations/CurrencyInputWidgetMigrations.ts b/app/client/src/utils/migrations/CurrencyInputWidgetMigrations.ts index f2e726005cd1..090c30a5b5f7 100644 --- a/app/client/src/utils/migrations/CurrencyInputWidgetMigrations.ts +++ b/app/client/src/utils/migrations/CurrencyInputWidgetMigrations.ts @@ -1,3 +1,5 @@ +import { traverseDSLAndMigrate } from "utils/WidgetMigrationUtils"; +import { InputTypes } from "widgets/BaseInputWidget/constants"; import { WidgetProps } from "widgets/BaseWidget"; import { DSLWidget } from "widgets/constants"; @@ -31,3 +33,18 @@ export const migrateCurrencyInputWidgetDefaultCurrencyCode = ( }); return currentDSL; }; + +export const migrateInputWidgetShowStepArrows = ( + currentDSL: DSLWidget, +): DSLWidget => { + return traverseDSLAndMigrate(currentDSL, (widget: WidgetProps) => { + if ( + (widget.type === "CURRENCY_INPUT_WIDGET" || + (widget.type === "INPUT_WIDGET_V2" && + widget.inputType === InputTypes.NUMBER)) && + widget.showStepArrows === undefined + ) { + widget.showStepArrows = true; + } + }); +}; diff --git a/app/client/src/widgets/BaseInputWidget/component/index.tsx b/app/client/src/widgets/BaseInputWidget/component/index.tsx index c3e2599d9e5b..cc77741c9e44 100644 --- a/app/client/src/widgets/BaseInputWidget/component/index.tsx +++ b/app/client/src/widgets/BaseInputWidget/component/index.tsx @@ -20,7 +20,7 @@ import { createMessage, INPUT_WIDGET_DEFAULT_VALIDATION_ERROR, } from "@appsmith/constants/messages"; -import { InputTypes } from "../constants"; +import { InputTypes, NumberInputStepButtonPosition } from "../constants"; // TODO(abhinav): All of the following imports should not be in widgets. import ErrorTooltip from "components/editorComponents/ErrorTooltip"; @@ -530,6 +530,7 @@ class BaseInputComponent extends React.Component< <StyledNumericInput allowNumericCharactersOnly autoFocus={this.props.autoFocus} + buttonPosition={this.props.buttonPosition} className={this.props.isLoading ? "bp3-skeleton" : Classes.FILL} disabled={this.props.disabled} inputRef={(el) => { @@ -783,6 +784,7 @@ export interface BaseInputComponentProps extends ComponentProps { accentColor?: string; errorTooltipBoundary?: string; shouldUseLocale?: boolean; + buttonPosition?: NumberInputStepButtonPosition; } export default BaseInputComponent; diff --git a/app/client/src/widgets/BaseInputWidget/constants.ts b/app/client/src/widgets/BaseInputWidget/constants.ts index 3997261dad6c..5a1a185fd36c 100644 --- a/app/client/src/widgets/BaseInputWidget/constants.ts +++ b/app/client/src/widgets/BaseInputWidget/constants.ts @@ -6,3 +6,9 @@ export enum InputTypes { PASSWORD = "PASSWORD", CURRENCY = "CURRENCY", } + +export enum NumberInputStepButtonPosition { + LEFT = "left", + RIGHT = "right", + NONE = "none", +} diff --git a/app/client/src/widgets/BaseInputWidget/widget/index.tsx b/app/client/src/widgets/BaseInputWidget/widget/index.tsx index 5cd8b05982d5..47e65fe7ff1e 100644 --- a/app/client/src/widgets/BaseInputWidget/widget/index.tsx +++ b/app/client/src/widgets/BaseInputWidget/widget/index.tsx @@ -176,6 +176,28 @@ class BaseInputWidget< isTriggerProperty: false, validation: { type: ValidationTypes.TEXT }, }, + { + helpText: "Show arrows to increase or decrease values", + propertyName: "showStepArrows", + label: "Show Step Arrows", + controlType: "SWITCH", + isJSConvertible: true, + isBindProperty: true, + isTriggerProperty: false, + validation: { + type: ValidationTypes.BOOLEAN, + params: { + default: false, + }, + }, + hidden: (props: BaseInputWidgetProps) => { + return ( + props.type !== "CURRENCY_INPUT_WIDGET" && + props.inputType !== InputTypes.NUMBER + ); + }, + dependencies: ["inputType"], + }, { helpText: "Controls the visibility of the widget", propertyName: "isVisible", diff --git a/app/client/src/widgets/CurrencyInputWidget/component/index.tsx b/app/client/src/widgets/CurrencyInputWidget/component/index.tsx index 5e7dd3ec6499..9b41f30e6540 100644 --- a/app/client/src/widgets/CurrencyInputWidget/component/index.tsx +++ b/app/client/src/widgets/CurrencyInputWidget/component/index.tsx @@ -43,6 +43,7 @@ class CurrencyInputComponent extends React.Component< autoFocus={this.props.autoFocus} borderRadius={this.props.borderRadius} boxShadow={this.props.boxShadow} + buttonPosition={this.props.buttonPosition} compactMode={this.props.compactMode} defaultValue={this.props.defaultValue} disableNewLineOnPressEnterKey={this.props.disableNewLineOnPressEnterKey} diff --git a/app/client/src/widgets/CurrencyInputWidget/index.ts b/app/client/src/widgets/CurrencyInputWidget/index.ts index 7f1d33fc660f..ef929356c4d2 100644 --- a/app/client/src/widgets/CurrencyInputWidget/index.ts +++ b/app/client/src/widgets/CurrencyInputWidget/index.ts @@ -27,6 +27,7 @@ export const CONFIG = { allowCurrencyChange: false, defaultCurrencyCode: getDefaultCurrency().currency, decimals: 0, + showStepArrows: false, }, properties: { derived: Widget.getDerivedPropertiesMap(), diff --git a/app/client/src/widgets/CurrencyInputWidget/widget/index.tsx b/app/client/src/widgets/CurrencyInputWidget/widget/index.tsx index 113ace991859..f27fc3cac373 100644 --- a/app/client/src/widgets/CurrencyInputWidget/widget/index.tsx +++ b/app/client/src/widgets/CurrencyInputWidget/widget/index.tsx @@ -37,6 +37,7 @@ import { isAutoHeightEnabledForWidget, } from "widgets/WidgetUtils"; import { Stylesheet } from "entities/AppTheming"; +import { NumberInputStepButtonPosition } from "widgets/BaseInputWidget/constants"; export function defaultValueValidation( value: any, @@ -430,6 +431,12 @@ class CurrencyInputWidget extends BaseInputWidget< conditionalProps.errorMessage = createMessage(FIELD_REQUIRED_ERROR); } + if (this.props.showStepArrows) { + conditionalProps.buttonPosition = NumberInputStepButtonPosition.RIGHT; + } else { + conditionalProps.buttonPosition = NumberInputStepButtonPosition.NONE; + } + return ( <CurrencyInputComponent accentColor={this.props.accentColor} diff --git a/app/client/src/widgets/InputWidgetV2/component/index.tsx b/app/client/src/widgets/InputWidgetV2/component/index.tsx index 4a076206b481..6b9fffdf2172 100644 --- a/app/client/src/widgets/InputWidgetV2/component/index.tsx +++ b/app/client/src/widgets/InputWidgetV2/component/index.tsx @@ -45,6 +45,7 @@ class InputComponent extends React.Component<InputComponentProps> { autoFocus={this.props.autoFocus} borderRadius={this.props.borderRadius} boxShadow={this.props.boxShadow} + buttonPosition={this.props.buttonPosition} compactMode={this.props.compactMode} defaultValue={this.props.defaultValue} disableNewLineOnPressEnterKey={this.props.disableNewLineOnPressEnterKey} diff --git a/app/client/src/widgets/InputWidgetV2/index.ts b/app/client/src/widgets/InputWidgetV2/index.ts index 99c7c1064125..e27ea21d4022 100644 --- a/app/client/src/widgets/InputWidgetV2/index.ts +++ b/app/client/src/widgets/InputWidgetV2/index.ts @@ -24,6 +24,7 @@ export const CONFIG = { inputType: "TEXT", widgetName: "Input", version: 2, + showStepArrows: false, }, properties: { derived: Widget.getDerivedPropertiesMap(), diff --git a/app/client/src/widgets/InputWidgetV2/widget/index.tsx b/app/client/src/widgets/InputWidgetV2/widget/index.tsx index ebf105f08471..cd1c35355690 100644 --- a/app/client/src/widgets/InputWidgetV2/widget/index.tsx +++ b/app/client/src/widgets/InputWidgetV2/widget/index.tsx @@ -23,7 +23,10 @@ import { isNil, isNumber, merge, toString } from "lodash"; import derivedProperties from "./parsedDerivedProperties"; import { BaseInputWidgetProps } from "widgets/BaseInputWidget/widget"; import { mergeWidgetConfig } from "utils/helpers"; -import { InputTypes } from "widgets/BaseInputWidget/constants"; +import { + InputTypes, + NumberInputStepButtonPosition, +} from "widgets/BaseInputWidget/constants"; import { getParsedText } from "./Utilities"; import { Stylesheet } from "entities/AppTheming"; import { isAutoHeightEnabledForWidget } from "widgets/WidgetUtils"; @@ -553,6 +556,15 @@ class InputWidget extends BaseInputWidget<InputWidgetProps, WidgetState> { ); } } + + if ( + this.props.inputType === InputTypes.NUMBER && + this.props.showStepArrows + ) { + conditionalProps.buttonPosition = NumberInputStepButtonPosition.RIGHT; + } else { + conditionalProps.buttonPosition = NumberInputStepButtonPosition.NONE; + } const minInputSingleLineHeight = this.props.label || this.props.tooltip ? // adjust height for label | tooltip extra div
69b63fa552b142af03633b4884c8460c61c81924
2024-06-12 13:07:07
Ayush Pahwa
fix: set eval version for workflows artefact (#34197)
false
set eval version for workflows artefact (#34197)
fix
diff --git a/app/client/src/ce/api/ApplicationApi.tsx b/app/client/src/ce/api/ApplicationApi.tsx index 2ffa8cc883fb..29f9a3666ffb 100644 --- a/app/client/src/ce/api/ApplicationApi.tsx +++ b/app/client/src/ce/api/ApplicationApi.tsx @@ -14,8 +14,7 @@ import type { LayoutSystemTypes, } from "layoutSystems/types"; import type { BaseAction } from "entities/Action"; - -export type EvaluationVersion = number; +import type { EvaluationVersion } from "constants/EvalConstants"; export interface PublishApplicationRequest { applicationId: string; diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx index 8d49cfbc7b36..03c4b2a50f84 100644 --- a/app/client/src/ce/constants/ReduxActionConstants.tsx +++ b/app/client/src/ce/constants/ReduxActionConstants.tsx @@ -3,7 +3,6 @@ import type { Workspace } from "@appsmith/constants/workspaceConstants"; import type { AppEmbedSetting, ApplicationPagePayload, - EvaluationVersion, GitApplicationMetadata, } from "@appsmith/api/ApplicationApi"; import type { ApplicationVersion } from "@appsmith/actions/applicationActions"; @@ -17,6 +16,7 @@ import type { AppLayoutConfig } from "reducers/entityReducers/pageListReducer"; import type { DSLWidget } from "WidgetProvider/constants"; import type { LayoutSystemTypeConfig } from "layoutSystems/types"; import type { AffectedJSObjects } from "sagas/EvaluationsSagaUtils"; +import type { EvaluationVersion } from "constants/EvalConstants"; export const ReduxSagaChannels = { WEBSOCKET_APP_LEVEL_WRITE_CHANNEL: "WEBSOCKET_APP_LEVEL_WRITE_CHANNEL", diff --git a/app/client/src/ce/constants/WorkflowConstants.ts b/app/client/src/ce/constants/WorkflowConstants.ts index 9dd2947cd151..753854d23a7e 100644 --- a/app/client/src/ce/constants/WorkflowConstants.ts +++ b/app/client/src/ce/constants/WorkflowConstants.ts @@ -1,3 +1,5 @@ +import type { EvaluationVersion } from "constants/EvalConstants"; + type ID = string; // Type for the workflow object. @@ -14,6 +16,9 @@ export interface Workflow { slug: string; // Slug of the workflow (Not in use currently). mainJsObjectId: string; // ID of the main JS object. tokenGenerated: boolean; + // Evaluation version of the application. Used to ensure the escape characters are properly evaluated. + // PR for reference: https://github.com/appsmithorg/appsmith/pull/8796 + evaluationVersion: EvaluationVersion; token?: string; } diff --git a/app/client/src/ce/selectors/applicationSelectors.tsx b/app/client/src/ce/selectors/applicationSelectors.tsx index 9c7fc0326675..a89b2f8c18d5 100644 --- a/app/client/src/ce/selectors/applicationSelectors.tsx +++ b/app/client/src/ce/selectors/applicationSelectors.tsx @@ -15,6 +15,7 @@ import { type ThemeSetting, defaultThemeSetting, } from "constants/AppConstants"; +import { DEFAULT_EVALUATION_VERSION } from "constants/EvalConstants"; const fuzzySearchOptions = { keys: ["applications.name", "workspace.name", "packages.name"], @@ -178,8 +179,6 @@ export const getIsDeletingNavigationLogo = (state: AppState) => { return state.ui.applications.isDeletingNavigationLogo; }; -const DEFAULT_EVALUATION_VERSION = 2; - export const selectEvaluationVersion = (state: AppState) => state.ui.applications.currentApplication?.evaluationVersion || DEFAULT_EVALUATION_VERSION; diff --git a/app/client/src/ce/workers/Evaluation/Actions.ts b/app/client/src/ce/workers/Evaluation/Actions.ts index 429bc551cc98..8a9658b9c53f 100644 --- a/app/client/src/ce/workers/Evaluation/Actions.ts +++ b/app/client/src/ce/workers/Evaluation/Actions.ts @@ -8,7 +8,7 @@ import type { DataTreeEntity, } from "entities/DataTree/dataTreeTypes"; import type { EvalContext } from "workers/Evaluation/evaluate"; -import type { EvaluationVersion } from "@appsmith/api/ApplicationApi"; +import type { EvaluationVersion } from "constants/EvalConstants"; import { addFn } from "workers/Evaluation/fns/utils/fnGuard"; import { getEntityFunctions, diff --git a/app/client/src/constants/EvalConstants.ts b/app/client/src/constants/EvalConstants.ts new file mode 100644 index 000000000000..0a90343bcd69 --- /dev/null +++ b/app/client/src/constants/EvalConstants.ts @@ -0,0 +1,2 @@ +export type EvaluationVersion = number; +export const DEFAULT_EVALUATION_VERSION: EvaluationVersion = 2; diff --git a/app/client/src/ee/configs/index.ts b/app/client/src/ee/configs/index.ts index b9e9e7b43cd8..562285dc2377 100644 --- a/app/client/src/ee/configs/index.ts +++ b/app/client/src/ee/configs/index.ts @@ -1,5 +1,5 @@ export * from "ce/configs/index"; -import type { EvaluationVersion } from "@appsmith/api/ApplicationApi"; +import type { EvaluationVersion } from "constants/EvalConstants"; import type { INJECTED_CONFIGS } from "ce/configs/index"; declare global { diff --git a/app/client/src/sagas/EvaluationsSaga.ts b/app/client/src/sagas/EvaluationsSaga.ts index 6e85d1145662..a81d24267fa6 100644 --- a/app/client/src/sagas/EvaluationsSaga.ts +++ b/app/client/src/sagas/EvaluationsSaga.ts @@ -70,7 +70,7 @@ import { } from "constants/AppsmithActionConstants/ActionConstants"; import { validate } from "workers/Evaluation/validations"; import { REPLAY_DELAY } from "entities/Replay/replayUtils"; -import type { EvaluationVersion } from "@appsmith/api/ApplicationApi"; +import type { EvaluationVersion } from "constants/EvalConstants"; import type { LogObject } from "entities/AppsmithConsole"; import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
4e13fc51255134808746f793e72258d45a72872e
2022-06-10 23:52:59
Rishabh Rathod
fix: AppViewer init and page fetch logic (#14294)
false
AppViewer init and page fetch logic (#14294)
fix
diff --git a/app/client/src/actions/evaluationActions.ts b/app/client/src/actions/evaluationActions.ts index 8493ca3fd3b1..67f5f922d37e 100644 --- a/app/client/src/actions/evaluationActions.ts +++ b/app/client/src/actions/evaluationActions.ts @@ -11,14 +11,12 @@ import { QueryActionConfig } from "entities/Action"; export const FIRST_EVAL_REDUX_ACTIONS = [ // Pages - // ReduxActionTypes.FETCH_PAGE_SUCCESS, - // ReduxActionTypes.FETCH_PUBLISHED_PAGE_SUCCESS, ReduxActionTypes.FETCH_ALL_PAGE_ENTITY_COMPLETION, ]; + export const EVALUATE_REDUX_ACTIONS = [ ...FIRST_EVAL_REDUX_ACTIONS, // Actions - ReduxActionTypes.FETCH_PLUGIN_AND_JS_ACTIONS_SUCCESS, ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_SUCCESS, ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_SUCCESS, ReduxActionErrorTypes.FETCH_ACTIONS_ERROR, diff --git a/app/client/src/actions/initActions.ts b/app/client/src/actions/initActions.ts index a82db2787e1b..6e2691d73363 100644 --- a/app/client/src/actions/initActions.ts +++ b/app/client/src/actions/initActions.ts @@ -1,3 +1,4 @@ +import { APP_MODE } from "entities/App"; import { ReduxActionTypes, ReduxAction, @@ -7,6 +8,7 @@ export type InitializeEditorPayload = { applicationId?: string; pageId?: string; branch?: string; + mode: APP_MODE; }; export const initEditor = ( @@ -16,6 +18,28 @@ export const initEditor = ( payload, }); +export type InitAppViewerPayload = { + branch: string; + applicationId: string; + pageId: string; + mode: APP_MODE; +}; + +export const initAppViewer = ({ + applicationId, + branch, + mode, + pageId, +}: InitAppViewerPayload) => ({ + type: ReduxActionTypes.INITIALIZE_PAGE_VIEWER, + payload: { + branch: branch, + applicationId, + pageId, + mode, + }, +}); + export const resetEditorRequest = () => ({ type: ReduxActionTypes.RESET_EDITOR_REQUEST, }); diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx index 086fce5cb6b3..792cdbfe0ca5 100644 --- a/app/client/src/ce/constants/ReduxActionConstants.tsx +++ b/app/client/src/ce/constants/ReduxActionConstants.tsx @@ -714,7 +714,6 @@ export const ReduxActionTypes = { "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", SET_APP_VIEWER_HEADER_HEIGHT: "SET_APP_VIEWER_HEADER_HEIGHT", UPDATE_BETA_CARD_SHOWN: "UPDATE_BETA_CARD_SHOWN", CLOSE_BETA_CARD_SHOWN: "CLOSE_BETA_CARD_SHOWN", diff --git a/app/client/src/pages/AppViewer/index.tsx b/app/client/src/pages/AppViewer/index.tsx index 7c62e696f522..89a61d9e89e7 100644 --- a/app/client/src/pages/AppViewer/index.tsx +++ b/app/client/src/pages/AppViewer/index.tsx @@ -8,7 +8,6 @@ import { BuilderRouteParams, GIT_BRANCH_QUERY_KEY, } from "constants/routes"; -import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; import { getIsInitialized, getAppViewHeaderHeight, @@ -41,6 +40,11 @@ import { } from "actions/controlActions"; import { setAppViewHeaderHeight } from "actions/appViewActions"; import { showPostCompletionMessage } from "selectors/onboardingSelectors"; +import { fetchPublishedPage } from "actions/pageActions"; +import usePrevious from "utils/hooks/usePrevious"; +import { getIsBranchUpdated } from "../utils"; +import { APP_MODE } from "entities/App"; +import { initAppViewer } from "actions/initActions"; import { getShowBrandingBadge } from "@appsmith/selectors/organizationSelectors"; const AppViewerBody = styled.section<{ @@ -80,7 +84,7 @@ const DEFAULT_FONT_NAME = "System Default"; function AppViewer(props: Props) { const dispatch = useDispatch(); - const { search } = props.location; + const { pathname, search } = props.location; const { applicationId, pageId } = props.match.params; const [registered, setRegistered] = useState(false); const isInitialized = useSelector(getIsInitialized); @@ -91,24 +95,65 @@ function AppViewer(props: Props) { ); const showGuidedTourMessage = useSelector(showPostCompletionMessage); const headerHeight = useSelector(getAppViewHeaderHeight); - const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY); const showBrandingBadge = useSelector(getShowBrandingBadge); + const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY); + const prevValues = usePrevious({ branch, location: props.location, pageId }); /** * initializes the widgets factory and registers all widgets */ useEffect(() => { - editorInitializer().then(() => setRegistered(true)); + editorInitializer().then(() => { + setRegistered(true); + }); + + // onMount initPage + if (applicationId || pageId) { + dispatch( + initAppViewer({ + applicationId, + branch, + pageId, + mode: APP_MODE.PUBLISHED, + }), + ); + } }, []); /** * initialize the app if branch, pageId or application is changed */ useEffect(() => { - if (applicationId || pageId) { - initializeAppViewerCallback(branch, applicationId, pageId); + const prevBranch = prevValues?.branch; + const prevLocation = prevValues?.location; + const prevPageId = prevValues?.pageId; + let isBranchUpdated = false; + if (prevBranch && prevLocation) { + isBranchUpdated = getIsBranchUpdated(props.location, prevLocation); } - }, [branch, pageId, applicationId]); + + const isPageIdUpdated = pageId !== prevPageId; + + if (prevBranch && isBranchUpdated && (applicationId || pageId)) { + dispatch( + initAppViewer({ + applicationId, + branch, + pageId, + mode: APP_MODE.PUBLISHED, + }), + ); + } else { + /** + * First time load is handled by init sagas + * If we don't check for `prevPageId`: fetch page is retriggered + * when redirected to the default page + */ + if (prevPageId && pageId && isPageIdUpdated) { + dispatch(fetchPublishedPage(pageId, true)); + } + } + }, [branch, pageId, applicationId, pathname]); useEffect(() => { const header = document.querySelector(".js-appviewer-header"); @@ -141,24 +186,6 @@ function AppViewer(props: Props) { document.body.style.fontFamily = appFontFamily; }, [selectedTheme.properties.fontFamily.appFont]); - /** - * callback for initialize app - */ - const initializeAppViewerCallback = ( - branch: string, - applicationId: string, - pageId: string, - ) => { - dispatch({ - type: ReduxActionTypes.INITIALIZE_PAGE_VIEWER, - payload: { - branch: branch, - applicationId, - pageId, - }, - }); - }; - /** * callback for executing an action */ diff --git a/app/client/src/pages/Editor/index.tsx b/app/client/src/pages/Editor/index.tsx index 3348fb4acf03..53f4ebd79116 100644 --- a/app/client/src/pages/Editor/index.tsx +++ b/app/client/src/pages/Editor/index.tsx @@ -53,6 +53,9 @@ import GuidedTourModal from "./GuidedTour/DeviationModal"; import { getPageLevelSocketRoomId } from "sagas/WebsocketSagas/utils"; import RepoLimitExceededErrorModal from "./gitSync/RepoLimitExceededErrorModal"; import ImportedApplicationSuccessModal from "./gitSync/ImportedAppSuccessModal"; +import { getIsBranchUpdated } from "../utils"; +import { APP_MODE } from "entities/App"; +import { GIT_BRANCH_QUERY_KEY } from "constants/routes"; type EditorProps = { currentApplicationId?: string; @@ -95,11 +98,16 @@ class Editor extends Component<Props> { const { location: { search }, } = this.props; - const branch = getSearchQuery(search, "branch"); + const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY); const { applicationId, pageId } = this.props.match.params; - if (applicationId || pageId) - this.props.initEditor({ applicationId, pageId, branch }); + if (pageId) + this.props.initEditor({ + applicationId, + pageId, + branch, + mode: APP_MODE.EDIT, + }); this.props.handlePathUpdated(window.location); this.unlisten = history.listen(this.handleHistoryChange); @@ -110,22 +118,11 @@ class Editor extends Component<Props> { } } - getIsBranchUpdated(props1: Props, props2: Props) { - const { - location: { search: search1 }, - } = props1; - const { - location: { search: search2 }, - } = props2; - - const branch1 = getSearchQuery(search1, "branch"); - const branch2 = getSearchQuery(search2, "branch"); - - return branch1 !== branch2; - } - shouldComponentUpdate(nextProps: Props, nextState: { registered: boolean }) { - const isBranchUpdated = this.getIsBranchUpdated(this.props, nextProps); + const isBranchUpdated = getIsBranchUpdated( + this.props.location, + nextProps.location, + ); return ( isBranchUpdated || @@ -148,16 +145,30 @@ class Editor extends Component<Props> { componentDidUpdate(prevProps: Props) { const { applicationId, pageId } = this.props.match.params || {}; const { pageId: prevPageId } = prevProps.match.params || {}; - const isBranchUpdated = this.getIsBranchUpdated(this.props, prevProps); + const isBranchUpdated = getIsBranchUpdated( + this.props.location, + prevProps.location, + ); - const branch = getSearchQuery(this.props.location.search, "branch"); - const prevBranch = getSearchQuery(prevProps.location.search, "branch"); + const branch = getSearchQuery( + this.props.location.search, + GIT_BRANCH_QUERY_KEY, + ); + const prevBranch = getSearchQuery( + prevProps.location.search, + GIT_BRANCH_QUERY_KEY, + ); const isPageIdUpdated = pageId !== prevPageId; // to prevent re-init during connect - if (prevBranch && isBranchUpdated && (applicationId || pageId)) { - this.props.initEditor({ pageId, branch, applicationId }); + if (prevBranch && isBranchUpdated && pageId) { + this.props.initEditor({ + applicationId, + pageId, + branch, + mode: APP_MODE.EDIT, + }); } else { /** * First time load is handled by init sagas @@ -182,7 +193,7 @@ class Editor extends Component<Props> { const { location: { search }, } = this.props; - const branch = getSearchQuery(search, "branch"); + const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY); this.props.resetEditorRequest(); if (typeof this.unlisten === "function") this.unlisten(); this.props.collabStopSharingPointerEvent( diff --git a/app/client/src/pages/utils.ts b/app/client/src/pages/utils.ts new file mode 100644 index 000000000000..80c6935a151c --- /dev/null +++ b/app/client/src/pages/utils.ts @@ -0,0 +1,15 @@ +import { getSearchQuery } from "utils/helpers"; +import { Location } from "history"; + +export const getIsBranchUpdated = ( + prevLocation: Location<unknown>, + currentLocation: Location<unknown>, +) => { + const { search: search1 } = prevLocation; + const { search: search2 } = currentLocation; + + const branch1 = getSearchQuery(search1, "branch"); + const branch2 = getSearchQuery(search2, "branch"); + + return branch1 !== branch2; +}; diff --git a/app/client/src/sagas/GitSyncSagas.ts b/app/client/src/sagas/GitSyncSagas.ts index acf1e5168f3d..722cbb570af5 100644 --- a/app/client/src/sagas/GitSyncSagas.ts +++ b/app/client/src/sagas/GitSyncSagas.ts @@ -84,6 +84,7 @@ import { Org } from "constants/orgConstants"; import { log } from "loglevel"; import GIT_ERROR_CODES from "constants/GitErrorCodes"; import { builderURL } from "RouteBuilder"; +import { APP_MODE } from "../entities/App"; export function* handleRepoLimitReachedError(response?: ApiResponse) { const { responseMeta } = response || {}; @@ -547,6 +548,7 @@ function* gitPullSaga( initEditor({ pageId: currentPageId, branch: currentBranch, + mode: APP_MODE.EDIT, }), ); } diff --git a/app/client/src/sagas/InitSagas.ts b/app/client/src/sagas/InitSagas.ts index 8e49e446c855..75c59fe074a6 100644 --- a/app/client/src/sagas/InitSagas.ts +++ b/app/client/src/sagas/InitSagas.ts @@ -57,17 +57,14 @@ import { restoreRecentEntitiesRequest, } from "actions/globalSearchActions"; import { - InitializeEditorPayload, resetEditorSuccess, + InitializeEditorPayload, + InitAppViewerPayload, } from "actions/initActions"; import PerformanceTracker, { PerformanceTransactionName, } from "utils/PerformanceTracker"; -import { - getCurrentApplicationId, - getIsEditorInitialized, - getPageById, -} from "selectors/editorSelectors"; +import { getIsEditorInitialized, getPageById } from "selectors/editorSelectors"; import { getIsInitialized as getIsViewerInitialized } from "selectors/appViewSelectors"; import { fetchCommentThreadsInit } from "actions/commentActions"; import { fetchJSCollectionsForView } from "actions/jsActionActions"; @@ -127,11 +124,13 @@ export function* failFastApiCalls( * @param initializeEditorAction * @returns */ -function* bootstrapEditor(payload: InitializeEditorPayload) { - const { branch } = payload; - yield put(resetEditorSuccess()); +function* bootstrap(payload: InitializeEditorPayload) { + const { branch, mode } = payload; + if (mode === APP_MODE.EDIT) { + yield put(resetEditorSuccess()); + } yield put(updateBranchLocally(branch || "")); - yield put(setAppMode(APP_MODE.EDIT)); + yield put(setAppMode(mode)); yield put({ type: ReduxActionTypes.START_EVALUATION }); } @@ -200,19 +199,18 @@ function* initiateURLUpdate( } } -function* initiateEditorApplicationAndPages(payload: InitializeEditorPayload) { - const pageId = payload.pageId; - const applicationId = payload.applicationId; +function* initiateApplication(payload: InitializeEditorPayload) { + const { applicationId, mode, pageId } = payload; const applicationCall: boolean = yield failFastApiCalls( - [fetchApplication({ pageId, applicationId, mode: APP_MODE.EDIT })], + [fetchApplication({ pageId, applicationId, mode })], [ ReduxActionTypes.FETCH_APPLICATION_SUCCESS, ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS, ], [ ReduxActionErrorTypes.FETCH_APPLICATION_ERROR, - ReduxActionErrorTypes.FETCH_PAGE_ERROR, + ReduxActionErrorTypes.FETCH_PAGE_LIST_ERROR, ], ); @@ -222,34 +220,73 @@ function* initiateEditorApplicationAndPages(payload: InitializeEditorPayload) { const defaultPageId: string = yield select(getDefaultPageId); toLoadPageId = toLoadPageId || defaultPageId; - yield call(initiateURLUpdate, toLoadPageId, APP_MODE.EDIT, payload.pageId); + yield call(initiateURLUpdate, toLoadPageId, mode, payload.pageId); return toLoadPageId; } -function* initiateEditorActions(toLoadPageId: string, applicationId: string) { - const initActionsCalls = [ - fetchPage(toLoadPageId, true), - fetchActions({ applicationId }, []), - fetchJSCollections({ applicationId }), - fetchSelectedAppThemeAction(applicationId), - fetchAppThemesAction(applicationId), - ]; - - const successActionEffects = [ - ReduxActionTypes.FETCH_JS_ACTIONS_SUCCESS, - ReduxActionTypes.FETCH_ACTIONS_SUCCESS, - ReduxActionTypes.FETCH_APP_THEMES_SUCCESS, - ReduxActionTypes.FETCH_SELECTED_APP_THEME_SUCCESS, - fetchPageSuccess().type, - ]; - const failureActionEffects = [ - ReduxActionErrorTypes.FETCH_JS_ACTIONS_ERROR, - ReduxActionErrorTypes.FETCH_ACTIONS_ERROR, - ReduxActionErrorTypes.FETCH_APP_THEMES_ERROR, - ReduxActionErrorTypes.FETCH_SELECTED_APP_THEME_ERROR, - ReduxActionErrorTypes.FETCH_PAGE_ERROR, - ]; +function* initiatePageAndAllActions( + toLoadPageId: string, + applicationId: string, + mode: APP_MODE, +) { + let initActionsCalls = []; + let successActionEffects = []; + let failureActionEffects = []; + switch (mode) { + case APP_MODE.EDIT: + { + initActionsCalls = [ + fetchPage(toLoadPageId, true), + fetchActions({ applicationId }, []), + fetchJSCollections({ applicationId }), + fetchSelectedAppThemeAction(applicationId), + fetchAppThemesAction(applicationId), + ]; + successActionEffects = [ + ReduxActionTypes.FETCH_JS_ACTIONS_SUCCESS, + ReduxActionTypes.FETCH_ACTIONS_SUCCESS, + ReduxActionTypes.FETCH_SELECTED_APP_THEME_SUCCESS, + fetchPageSuccess().type, + ReduxActionTypes.FETCH_APP_THEMES_SUCCESS, + ]; + failureActionEffects = [ + ReduxActionErrorTypes.FETCH_JS_ACTIONS_ERROR, + ReduxActionErrorTypes.FETCH_ACTIONS_ERROR, + ReduxActionErrorTypes.FETCH_SELECTED_APP_THEME_ERROR, + ReduxActionErrorTypes.FETCH_PAGE_ERROR, + ReduxActionErrorTypes.FETCH_APP_THEMES_ERROR, + ]; + } + break; + case APP_MODE.PUBLISHED: + { + initActionsCalls = [ + fetchPublishedPage(toLoadPageId, true, true), + fetchActionsForView({ applicationId }), + fetchJSCollectionsForView({ applicationId }), + fetchSelectedAppThemeAction(applicationId), + fetchAppThemesAction(applicationId), + ]; + successActionEffects = [ + fetchPublishedPageSuccess().type, + ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_SUCCESS, + ReduxActionTypes.FETCH_JS_ACTIONS_VIEW_MODE_SUCCESS, + ReduxActionTypes.FETCH_SELECTED_APP_THEME_SUCCESS, + ReduxActionTypes.FETCH_APP_THEMES_SUCCESS, + ]; + failureActionEffects = [ + ReduxActionErrorTypes.FETCH_PUBLISHED_PAGE_ERROR, + ReduxActionErrorTypes.FETCH_ACTIONS_VIEW_MODE_ERROR, + ReduxActionErrorTypes.FETCH_JS_ACTIONS_VIEW_MODE_ERROR, + ReduxActionErrorTypes.FETCH_SELECTED_APP_THEME_ERROR, + ReduxActionErrorTypes.FETCH_APP_THEMES_ERROR, + ]; + } + break; + default: + return false; + } const allActionCalls: boolean = yield failFastApiCalls( initActionsCalls, successActionEffects, @@ -257,15 +294,15 @@ function* initiateEditorActions(toLoadPageId: string, applicationId: string) { ); if (!allActionCalls) { - return; + return false; } else { - yield put({ - type: ReduxActionTypes.FETCH_PLUGIN_AND_JS_ACTIONS_SUCCESS, - }); yield put(fetchAllPageEntityCompletion([executePageLoadActions()])); + + return true; } } +// Editor mode only function* initiatePluginsAndDatasources() { const pluginsAndDatasourcesCalls: boolean = yield failFastApiCalls( [fetchPlugins(), fetchDatasources(), fetchMockDatasources()], @@ -289,7 +326,7 @@ function* initiatePluginsAndDatasources() { ); if (!pluginFormCall) return; } - +// Editor mode only function* initiateGit(applicationId: string) { const branchInStore: string = yield select(getCurrentGitBranch); @@ -316,17 +353,15 @@ function* initializeEditorSaga( initializeEditorAction: ReduxAction<InitializeEditorPayload>, ) { try { - const { payload } = initializeEditorAction; - - const { branch } = payload; - - yield call(bootstrapEditor, payload); - PerformanceTracker.startAsyncTracking( PerformanceTransactionName.INIT_EDIT_APP, ); + const { payload } = initializeEditorAction; + const { branch, mode } = initializeEditorAction.payload; + + yield call(bootstrap, payload); - const toLoadPageId = yield call(initiateEditorApplicationAndPages, payload); + const toLoadPageId = yield call(initiateApplication, payload); if (!toLoadPageId) return; const { id: applicationId, name }: ApplicationPayload = yield select( @@ -338,7 +373,8 @@ function* initializeEditorSaga( ); yield all([ - call(initiateEditorActions, toLoadPageId, applicationId), + call(initiatePageAndAllActions, toLoadPageId, applicationId, mode), + // only in edit mode call(initiatePluginsAndDatasources), call(populatePageDSLsSaga), ]); @@ -348,10 +384,14 @@ function* initializeEditorSaga( appName: name, }); + // only in edit mode yield call(initiateGit, applicationId); yield put(fetchCommentThreadsInit()); + // For omnibar to show all entities search + // only in edit mode + yield put({ type: ReduxActionTypes.INITIALIZE_EDITOR_SUCCESS, }); @@ -373,75 +413,34 @@ function* initializeEditorSaga( } export function* initializeAppViewerSaga( - action: ReduxAction<{ - branch: string; - pageId: string; - applicationId: string; - }>, + action: ReduxAction<InitAppViewerPayload>, ) { - const { branch, pageId } = action.payload; - - let { applicationId } = action.payload; - PerformanceTracker.startAsyncTracking( PerformanceTransactionName.INIT_VIEW_APP, ); + const { payload } = action; + const { branch, mode } = payload; - yield put(updateBranchLocally(branch || "")); - - yield put(setAppMode(APP_MODE.PUBLISHED)); + yield call(bootstrap, payload); - const applicationCall: boolean = yield failFastApiCalls( - [fetchApplication({ applicationId, pageId, mode: APP_MODE.PUBLISHED })], - [ - ReduxActionTypes.FETCH_APPLICATION_SUCCESS, - ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS, - ], - [ - ReduxActionErrorTypes.FETCH_APPLICATION_ERROR, - ReduxActionErrorTypes.FETCH_PAGE_LIST_ERROR, - ], + const toLoadPageId = yield call(initiateApplication, payload); + // only in edit mode + const { id: applicationId }: ApplicationPayload = yield select( + getCurrentApplication, ); - if (!applicationCall) return; - - applicationId = applicationId || (yield select(getCurrentApplicationId)); yield put( updateAppPersistentStore(getPersistentAppStore(applicationId, branch)), ); - yield put({ type: ReduxActionTypes.START_EVALUATION }); - - const defaultPageId: string = yield select(getDefaultPageId); - const toLoadPageId: string = pageId || defaultPageId; - - yield call(initiateURLUpdate, toLoadPageId, APP_MODE.PUBLISHED, pageId); - const resultOfPrimaryCalls: boolean = yield failFastApiCalls( - [ - fetchActionsForView({ applicationId }), - fetchJSCollectionsForView({ applicationId }), - fetchSelectedAppThemeAction(applicationId), - fetchAppThemesAction(applicationId), - fetchPublishedPage(toLoadPageId, true, true), - ], - [ - ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_SUCCESS, - ReduxActionTypes.FETCH_JS_ACTIONS_VIEW_MODE_SUCCESS, - ReduxActionTypes.FETCH_APP_THEMES_SUCCESS, - ReduxActionTypes.FETCH_SELECTED_APP_THEME_SUCCESS, - fetchPublishedPageSuccess().type, - ], - [ - ReduxActionErrorTypes.FETCH_ACTIONS_VIEW_MODE_ERROR, - ReduxActionErrorTypes.FETCH_JS_ACTIONS_VIEW_MODE_ERROR, - ReduxActionErrorTypes.FETCH_APP_THEMES_ERROR, - ReduxActionErrorTypes.FETCH_SELECTED_APP_THEME_ERROR, - ReduxActionErrorTypes.FETCH_PUBLISHED_PAGE_ERROR, - ], + const pageAndActionsFetch = yield call( + initiatePageAndAllActions, + toLoadPageId, + applicationId, + mode, ); - if (!resultOfPrimaryCalls) return; - + if (!pageAndActionsFetch) return; yield put(fetchAllPageEntityCompletion([executePageLoadActions()])); yield put(fetchCommentThreadsInit()); diff --git a/app/client/src/utils/hooks/usePrevious.tsx b/app/client/src/utils/hooks/usePrevious.tsx new file mode 100644 index 000000000000..a9a52702eae2 --- /dev/null +++ b/app/client/src/utils/hooks/usePrevious.tsx @@ -0,0 +1,12 @@ +import { useEffect, useRef } from "react"; + +// Make sure to use this hook at the start of functional component +const usePrevious = <T,>(value: T): T | undefined => { + const ref = useRef<T>(); + useEffect(() => { + ref.current = value; + }); + return ref.current; +}; + +export default usePrevious; diff --git a/app/client/test/testCommon.ts b/app/client/test/testCommon.ts index 1fb45b98acb1..1a5a2be6483d 100644 --- a/app/client/test/testCommon.ts +++ b/app/client/test/testCommon.ts @@ -98,7 +98,7 @@ export const syntheticTestMouseEvent = ( export function MockApplication({ children }: any) { editorInitializer(); const dispatch = useDispatch(); - dispatch(initEditor({ pageId: "page_id" })); + dispatch(initEditor({ pageId: "page_id", mode: APP_MODE.EDIT })); const mockResp: any = { organizationId: "org_id", pages: [{ id: "page_id", name: "Page1", isDefault: true }],
7a90619b63947f0c25457461fbefcb7769bf092f
2024-04-02 16:18:37
Shrikant Sharat Kandula
chore: Remove use of ErrorProne transitive dependency
false
Remove use of ErrorProne transitive dependency
chore
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepositoryImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepositoryImpl.java index 676cbb0ea025..365e58d19446 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepositoryImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepositoryImpl.java @@ -2,7 +2,6 @@ import com.appsmith.external.models.BaseDomain; import com.appsmith.server.constants.FieldName; -import com.google.errorprone.annotations.DoNotCall; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Example; @@ -106,7 +105,6 @@ public Flux<T> findAll() { * We don't use this today, it doesn't use our `notDeleted` criteria, and since we don't use it, we're not porting * it to Postgres. Querying with `queryBuilder` or anything else is arguably more readable than this. */ - @DoNotCall @Override public <S extends T> Flux<S> findAll(Example<S> example, Sort sort) { return Flux.error(new UnsupportedOperationException("This method is not supported!"));
6e8d363080a19b9951ee773f7a222f6476e13f82
2023-09-08 14:35:46
Valera Melnikov
fix: save checked full color picker between renders (#27028)
false
save checked full color picker between renders (#27028)
fix
diff --git a/app/client/src/components/propertyControls/ColorPickerComponentV2.tsx b/app/client/src/components/propertyControls/ColorPickerComponentV2.tsx index d3f97a9ee59a..0694509111c7 100644 --- a/app/client/src/components/propertyControls/ColorPickerComponentV2.tsx +++ b/app/client/src/components/propertyControls/ColorPickerComponentV2.tsx @@ -54,6 +54,8 @@ interface ColorPickerProps { placeholderText?: string; portalContainer?: HTMLElement; onPopupClosed?: () => void; + isFullColorPicker?: boolean; + setFullColorPicker?: (value: boolean) => void; } /** @@ -356,7 +358,12 @@ const POPOVER_MODFIER = { const ColorPickerComponent = React.forwardRef( (props: ColorPickerProps, containerRef: any) => { - const { isOpen: isOpenProp = false, placeholderText } = props; + const { + isFullColorPicker: defaultFullColorPickerValue = false, + isOpen: isOpenProp = false, + placeholderText, + setFullColorPicker: setDefaultFullColorPickerValue, + } = props; const popupRef = useRef<HTMLDivElement>(null); const inputGroupRef = useRef<HTMLInputElement>(null); // isClick is used to track whether the input field is in focus by mouse click or by keyboard @@ -367,7 +374,9 @@ const ColorPickerComponent = React.forwardRef( props.evaluatedColorValue || props.color, ); - const [isFullColorPicker, setFullColorPicker] = React.useState(false); + const [isFullColorPicker, setFullColorPicker] = React.useState( + defaultFullColorPickerValue, + ); const debouncedOnChange = React.useCallback( debounce((color: string, isUpdatedViaKeyboard: boolean) => { @@ -398,6 +407,8 @@ const ColorPickerComponent = React.forwardRef( ); const handleKeydown = (e: KeyboardEvent) => { + if (isFullColorPicker) return; + if (isOpen) { switch (e.key) { case "Escape": @@ -548,15 +559,16 @@ const ColorPickerComponent = React.forwardRef( }, [props.color]); const handleInputClick = () => { - isClick.current = true; - if (isFullColorPicker && isOpen) { setIsOpen(false); + } else { + isClick.current = true; } }; const handleFullColorPickerClick = (value: boolean) => { setFullColorPicker(value); + setDefaultFullColorPickerValue && setDefaultFullColorPickerValue(value); setIsOpen(false); }; diff --git a/app/client/src/pages/Editor/ThemePropertyPane/controls/ThemeColorControl.tsx b/app/client/src/pages/Editor/ThemePropertyPane/controls/ThemeColorControl.tsx index 7d820b398eee..5099c9cac90b 100644 --- a/app/client/src/pages/Editor/ThemePropertyPane/controls/ThemeColorControl.tsx +++ b/app/client/src/pages/Editor/ThemePropertyPane/controls/ThemeColorControl.tsx @@ -14,7 +14,6 @@ interface ThemeColorControlProps { const ColorBox = styled.div<{ background: string; - // selectedColor: string; }>` background: ${({ background }) => background}; border: 2px solid var(--ads-v2-color-border); @@ -32,6 +31,7 @@ function ThemeColorControl(props: ThemeColorControlProps) { const [autoFocus, setAutoFocus] = useState(false); const userDefinedColors = theme.properties.colors; const [selectedColor, setSelectedColor] = useState<string>("primaryColor"); + const [isFullColorPicker, setFullColorPicker] = React.useState(false); return ( <div className="space-y-2"> @@ -46,7 +46,6 @@ function ThemeColorControl(props: ThemeColorControlProps) { <ColorBox background={userDefinedColors[colorName]} className={selectedColor === colorName ? "selected" : ""} - // selectedColor={colorName} data-testid={`theme-${colorName}`} onClick={() => { setAutoFocus( @@ -78,12 +77,14 @@ function ThemeColorControl(props: ThemeColorControlProps) { }); }} color={userDefinedColors[selectedColor]} + isFullColorPicker={isFullColorPicker} isOpen={autoFocus} key={selectedColor} onPopupClosed={() => setAutoFocus(false)} portalContainer={ document.getElementById("app-settings-portal") || undefined } + setFullColorPicker={setFullColorPicker} /> </div> )}
bf8170949217509e43e47842d3c00c10f61bfe99
2021-05-06 16:23:37
Snyk bot
fix: upgrade org.hibernate.validator:hibernate-validator from 6.0.18.Final to 6.2.0.Final (#4307)
false
upgrade org.hibernate.validator:hibernate-validator from 6.0.18.Final to 6.2.0.Final (#4307)
fix
diff --git a/app/server/appsmith-server/pom.xml b/app/server/appsmith-server/pom.xml index 601e2f80578b..584eba9d7cfa 100644 --- a/app/server/appsmith-server/pom.xml +++ b/app/server/appsmith-server/pom.xml @@ -91,7 +91,7 @@ <dependency> <groupId>org.hibernate.validator</groupId> <artifactId>hibernate-validator</artifactId> - <version>6.0.18.Final</version> + <version>6.2.0.Final</version> </dependency> <dependency> <groupId>org.glassfish</groupId>
be63e1b404f192e2d57c55bce259ce143085ffd2
2023-10-18 19:20:55
Shrikant Sharat Kandula
ci: Add BASE build argument to all workflows
false
Add BASE build argument to all workflows
ci
diff --git a/.github/workflows/ad-hoc-deploy-preview.yml b/.github/workflows/ad-hoc-deploy-preview.yml index a22b9b4a447e..0bd2e530fa4f 100644 --- a/.github/workflows/ad-hoc-deploy-preview.yml +++ b/.github/workflows/ad-hoc-deploy-preview.yml @@ -127,6 +127,7 @@ jobs: ${{ vars.DOCKER_HUB_ORGANIZATION }}/appsmith-dp:${{ github.event.inputs.sub-domain-name }} build-args: | APPSMITH_CLOUD_SERVICES_BASE_URL=https://release-cs.appsmith.com + BASE=${{ vars.DOCKER_HUB_ORGANIZATION }}/base-${{ vars.EDITION }}:release outputs: imageHash: ${{ github.event.inputs.sub-domain-name }} diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 5dfdce797265..70dda949201d 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -92,7 +92,11 @@ jobs: fi if [[ "${{ inputs.pr }}" != 0 || "${{ github.ref_name }}" != master ]]; then args+=(--build-arg "APPSMITH_CLOUD_SERVICES_BASE_URL=https://release-cs.appsmith.com") + base_tag=release + else + base_tag=nightly fi + args+=(--build-arg "BASE=${{ vars.DOCKER_HUB_ORGANIZATION }}/base-${{ vars.EDITION }}:$base_tag") docker build -t cicontainer "${args[@]}" . # Saving the docker image to tar file diff --git a/.github/workflows/test-build-docker-image.yml b/.github/workflows/test-build-docker-image.yml index 15c129c970dc..5ec3c3f43cf6 100644 --- a/.github/workflows/test-build-docker-image.yml +++ b/.github/workflows/test-build-docker-image.yml @@ -255,6 +255,7 @@ jobs: build-args: | APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY_RELEASE }} APPSMITH_CLOUD_SERVICES_BASE_URL=https://release-cs.appsmith.com + BASE=${{ vars.DOCKER_HUB_ORGANIZATION }}/base-${{ vars.EDITION }}:release tags: | ${{ vars.DOCKER_HUB_ORGANIZATION }}/appsmith-${{ vars.EDITION }}:release @@ -328,6 +329,7 @@ jobs: platforms: linux/arm64,linux/amd64 build-args: | APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} + BASE=${{ vars.DOCKER_HUB_ORGANIZATION }}/base-${{ vars.EDITION }}:nightly tags: | ${{ vars.DOCKER_HUB_ORGANIZATION }}/appsmith-${{ vars.EDITION }}:${{ github.sha }} ${{ vars.DOCKER_HUB_ORGANIZATION }}/appsmith-${{ vars.EDITION }}:nightly
862cdded5a90401c1d84f8c9a17675f30e2ae685
2023-12-19 13:13:06
Valera Melnikov
chore: add shadow elevation color tokens (#29708)
false
add shadow elevation color tokens (#29708)
chore
diff --git a/app/client/packages/design-system/theming/src/color/src/DarkModeTheme.ts b/app/client/packages/design-system/theming/src/color/src/DarkModeTheme.ts index fa94ab86b6ba..49625a0ec89d 100644 --- a/app/client/packages/design-system/theming/src/color/src/DarkModeTheme.ts +++ b/app/client/packages/design-system/theming/src/color/src/DarkModeTheme.ts @@ -81,6 +81,10 @@ export class DarkModeTheme implements ColorModeTheme { bgElevation2: this.bgElevation2.to("sRGB").toString(), bgElevation3: this.bgElevation3.to("sRGB").toString(), + shadowElevation1: this.shadowElevation1.to("sRGB").toString(), + shadowElevation2: this.shadowElevation2.to("sRGB").toString(), + shadowElevation3: this.shadowElevation3.to("sRGB").toString(), + fg: this.fg.to("sRGB").toString(), fgAccent: this.fgAccent.to("sRGB").toString(), fgNeutral: this.fgNeutral.to("sRGB").toString(), @@ -613,6 +617,34 @@ export class DarkModeTheme implements ColorModeTheme { return color; } + /* + * Shadow colors + */ + + private get shadowElevation1() { + const color = this.seedColor.clone(); + + color.oklch.l = 0.2; + + return color; + } + + private get shadowElevation2() { + const color = this.shadowElevation1.clone(); + + color.oklch.l -= 0.05; + + return color; + } + + private get shadowElevation3() { + const color = this.shadowElevation2.clone(); + + color.oklch.l -= 0.05; + + return color; + } + /* * Foreground colors */ diff --git a/app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts b/app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts index 5dd645f49c8b..f54391fe17b4 100644 --- a/app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts +++ b/app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts @@ -81,6 +81,10 @@ export class LightModeTheme implements ColorModeTheme { bgElevation2: this.bgElevation2.to("sRGB").toString(), bgElevation3: this.bgElevation3.to("sRGB").toString(), + shadowElevation1: this.shadowElevation1.to("sRGB").toString(), + shadowElevation2: this.shadowElevation2.to("sRGB").toString(), + shadowElevation3: this.shadowElevation3.to("sRGB").toString(), + fg: this.fg.to("sRGB").toString(), fgAccent: this.fgAccent.to("sRGB").toString(), fgNeutral: this.fgNeutral.to("sRGB").toString(), @@ -651,6 +655,34 @@ export class LightModeTheme implements ColorModeTheme { return color; } + /* + * Shadow colors + */ + + private get shadowElevation1() { + const color = this.seedColor.clone(); + + color.oklch.l = 0.2; + + return color; + } + + private get shadowElevation2() { + const color = this.shadowElevation1.clone(); + + color.oklch.l += 0.05; + + return color; + } + + private get shadowElevation3() { + const color = this.shadowElevation2.clone(); + + color.oklch.l += 0.05; + + return color; + } + /* * Foreground colors */ diff --git a/app/client/packages/design-system/theming/src/color/src/types.ts b/app/client/packages/design-system/theming/src/color/src/types.ts index dfa2e471fa8f..d59c5cec185e 100644 --- a/app/client/packages/design-system/theming/src/color/src/types.ts +++ b/app/client/packages/design-system/theming/src/color/src/types.ts @@ -32,6 +32,14 @@ export interface ColorModeTheme { bgWarningActive: string; bgWarningSubtleHover: string; bgWarningSubtleActive: string; + // Elevation + bgElevation1: string; + bgElevation2: string; + bgElevation3: string; + // Shadow + shadowElevation1: string; + shadowElevation2: string; + shadowElevation3: string; // fg fg: string; fgAccent: string; diff --git a/app/client/packages/design-system/theming/src/theme/stories/Color.stories.mdx b/app/client/packages/design-system/theming/src/theme/stories/Color.stories.mdx index 8fa39139701b..59418cf8f54f 100644 --- a/app/client/packages/design-system/theming/src/theme/stories/Color.stories.mdx +++ b/app/client/packages/design-system/theming/src/theme/stories/Color.stories.mdx @@ -36,7 +36,7 @@ Tokens are named using four-part schema. Every part of the name except `type` is <tr> <td>fg</td> <td>neutral</td> - <td></td> + <td>elevation</td> <td>active</td> </tr> <tr> @@ -46,7 +46,7 @@ Tokens are named using four-part schema. Every part of the name except `type` is <td>focus</td> </tr> <tr> - <td></td> + <td>shadow</td> <td>negative</td> <td></td> <td></td> @@ -183,3 +183,7 @@ Slightly darker than the resting state to produce the effect of moving further f ### Border Tokens <ColorTable isExactMatch={false} filter={["bd"]} /> + +### Shadow Tokens + +<ColorTable isExactMatch={false} filter={["shadow"]} /> diff --git a/app/client/packages/design-system/theming/src/token/src/defaultTokens.json b/app/client/packages/design-system/theming/src/token/src/defaultTokens.json index 316662bcee2d..331666bf89a3 100644 --- a/app/client/packages/design-system/theming/src/token/src/defaultTokens.json +++ b/app/client/packages/design-system/theming/src/token/src/defaultTokens.json @@ -57,9 +57,9 @@ "1": "0px" }, "boxShadow": { - "1": "0 8px 8px 0 rgba(0, 0, 0, 0.05)", - "2": "0 4px 4px 0 rgba(0, 0, 0, 0.1)", - "3": "0 2px 2px 0 rgba(0, 0, 0, 0.15)" + "1": "0 4px 6px 0 var(--color-shadow-elevation-1)", + "2": "0 2px 4px 0 var(--color-shadow-elevation-2)", + "3": "0 1px 2px 0 var(--color-shadow-elevation-3)" }, "borderWidth": { "1": "1px", diff --git a/app/client/packages/design-system/theming/src/token/src/styles.module.css b/app/client/packages/design-system/theming/src/token/src/styles.module.css index 1549eeffe7b7..019d9d48d3b6 100644 --- a/app/client/packages/design-system/theming/src/token/src/styles.module.css +++ b/app/client/packages/design-system/theming/src/token/src/styles.module.css @@ -683,7 +683,7 @@ --sizing-200: calc( 200 * clamp(3.2px, calc(0.1 * var(--provider-width) / 100 + 2.83px), 4.8px) ); - --color-bg: rgb(97.488% 97.871% 100%); + --color-bg: rgb(94.217% 94.598% 97.227%); --color-bg-accent: rgb(33.333% 23.922% 91.373%); --color-bg-accent-hover: rgb(38.033% 31.188% 98.353%); --color-bg-accent-active: rgb(31.537% 20.805% 88.597%); @@ -716,10 +716,16 @@ --color-bg-warning-subtle: rgb(100% 94.114% 80.142%); --color-bg-warning-subtle-hover: rgb(100% 97.012% 87.859%); --color-bg-warning-subtle-active: rgb(99.63% 92.81% 78.869%); + --color-bg-elevation-1: rgb(96.832% 97.215% 99.857%); + --color-bg-elevation-2: rgb(98.836% 99.192% 100%); + --color-bg-elevation-3: rgb(100% 100% 100%); + --color-shadow-elevation-1: rgb(0% 0% 0%); + --color-shadow-elevation-2: rgb(13.355% 0% 21.478%); + --color-shadow-elevation-3: rgb(19.719% 0% 40.53%); --color-fg: rgb(1.6475% 1.7126% 6.8084%); --color-fg-accent: rgb(33.333% 23.922% 91.373%); - --color-fg-neutral: rgb(37.193% 38.537% 50.855%); - --color-fg-neutral-subtle: rgb(48.439% 49.938% 62.827%); + --color-fg-neutral: rgb(26.531% 27.672% 39.337%); + --color-fg-neutral-subtle: rgb(37.193% 38.537% 50.855%); --color-fg-positive: rgb(6.7435% 63.436% 18.481%); --color-fg-negative: rgb(100% 0% 28.453%); --color-fg-warning: rgb(71.79% 51.231% 0%); @@ -747,7 +753,9 @@ --color-bd-on-negative: rgb(21.923% 0% 2.8118%); --color-bd-on-warning: rgb(39.972% 27.552% 0%); --border-radius-1: 0px; - --box-shadow-1: 0 2px 2px 0 rgba(0, 0, 0, 0.2); + --box-shadow-1: 0 4px 6px 0 var(--color-shadow-elevation-1); + --box-shadow-2: 0 2px 4px 0 var(--color-shadow-elevation-2); + --box-shadow-3: 0 1px 2px 0 var(--color-shadow-elevation-3); --border-width-1: 1px; --border-width-2: 2px; --opacity-disabled: 0.3; diff --git a/app/client/packages/design-system/theming/src/token/src/themeTokens.json b/app/client/packages/design-system/theming/src/token/src/themeTokens.json index 6b6d01dcf690..4593d86c80a5 100644 --- a/app/client/packages/design-system/theming/src/token/src/themeTokens.json +++ b/app/client/packages/design-system/theming/src/token/src/themeTokens.json @@ -1,7 +1,7 @@ { "color": { "bg": { - "value": "rgb(97.488% 97.871% 100%)", + "value": "rgb(94.217% 94.598% 97.227%)", "type": "color" }, "bg-accent": { @@ -132,6 +132,30 @@ "value": "rgb(99.63% 92.81% 78.869%)", "type": "color" }, + "bg-elevation-1": { + "value": "rgb(96.832% 97.215% 99.857%)", + "type": "color" + }, + "bg-elevation-2": { + "value": "rgb(98.836% 99.192% 100%)", + "type": "color" + }, + "bg-elevation-3": { + "value": "rgb(100% 100% 100%)", + "type": "color" + }, + "shadow-elevation-1": { + "value": "rgb(0% 0% 0%)", + "type": "color" + }, + "shadow-elevation-2": { + "value": "rgb(13.355% 0% 21.478%)", + "type": "color" + }, + "shadow-elevation-3": { + "value": "rgb(19.719% 0% 40.53%)", + "type": "color" + }, "fg": { "value": "rgb(1.6475% 1.7126% 6.8084%)", "type": "color" @@ -141,11 +165,11 @@ "type": "color" }, "fg-neutral": { - "value": "rgb(37.193% 38.537% 50.855%)", + "value": "rgb(26.531% 27.672% 39.337%)", "type": "color" }, "fg-neutral-subtle": { - "value": "rgb(48.439% 49.938% 62.827%)", + "value": "rgb(37.193% 38.537% 50.855%)", "type": "color" }, "fg-positive": { @@ -261,7 +285,15 @@ }, "boxShadow": { "1": { - "value": "0 2px 2px 0 rgba(0, 0, 0, 0.2)", + "value": "0 4px 6px 0 var(--color-shadow-elevation-1)", + "type": "boxShadow" + }, + "2": { + "value": "0 2px 4px 0 var(--color-shadow-elevation-2)", + "type": "boxShadow" + }, + "3": { + "value": "0 1px 2px 0 var(--color-shadow-elevation-3)", "type": "boxShadow" } }, diff --git a/app/client/packages/design-system/widgets/src/components/Menu/src/styles.module.css b/app/client/packages/design-system/widgets/src/components/Menu/src/styles.module.css index d09a2b4a76c3..9aaa4e893487 100644 --- a/app/client/packages/design-system/widgets/src/components/Menu/src/styles.module.css +++ b/app/client/packages/design-system/widgets/src/components/Menu/src/styles.module.css @@ -1,7 +1,7 @@ @import "../../../shared/colors/colors.module.css"; .menu { - background-color: var(--color-bg); + background-color: var(--color-bg-elevation-3); border-radius: var(--border-radius-1); z-index: var(--z-index-99); box-shadow: var(--box-shadow-1); diff --git a/app/client/packages/storybook/.storybook/preview-head.html b/app/client/packages/storybook/.storybook/preview-head.html index daa0ba4887ba..a94c41fb8d6c 100644 --- a/app/client/packages/storybook/.storybook/preview-head.html +++ b/app/client/packages/storybook/.storybook/preview-head.html @@ -1,20 +1,24 @@ <script defer src="https://cdn.jsdelivr.net/npm/container-query-polyfill@1/dist/container-query-polyfill.modern.js"></script> <style> + .docs-story [data-theme-provider] { + background-color: transparent; + } + h1, h2, h3, h4, h5, h6, p, th, td { color: var(--color-fg) !important; border-color: var(--color-bd) !important; font-family: var(--font-family) !important; } - tr { - background-color: var(--color-bg) !important; - } - th, td, .css-s230ta { border-color: var(--color-bd) !important; - background-color: var(--color-bg) !important; + } + + td, + .css-s230ta { + background-color: var(--color-bg-elevation-1) !important; } code, diff --git a/app/client/packages/storybook/src/components/StoryThemeProvider.tsx b/app/client/packages/storybook/src/components/StoryThemeProvider.tsx index 73ca12d6324b..03576263c674 100644 --- a/app/client/packages/storybook/src/components/StoryThemeProvider.tsx +++ b/app/client/packages/storybook/src/components/StoryThemeProvider.tsx @@ -8,8 +8,6 @@ const StyledThemeProvider = styled(ThemeProvider)` min-width: 100%; min-height: 100%; padding: 36px; - background: var(--color-bg); - color: var(--color-fg); flex-direction: column; align-items: center; `; diff --git a/app/client/packages/storybook/src/components/TokenTable.tsx b/app/client/packages/storybook/src/components/TokenTable.tsx index c41a550a04e3..341a8d11ca40 100644 --- a/app/client/packages/storybook/src/components/TokenTable.tsx +++ b/app/client/packages/storybook/src/components/TokenTable.tsx @@ -26,6 +26,7 @@ export const StyledTable = styled.table` td { text-align: left; padding: var(--spacing-2); + background-color: var(--color-bg-elevation-1); } td {
71963b5bf935e61f75465fc3491cb577b578b7a9
2024-10-09 16:25:06
Hetu Nandu
chore: Add named-use-effect custom eslint rule (#36725)
false
Add named-use-effect custom eslint rule (#36725)
chore
diff --git a/app/client/packages/eslint-plugin/src/index.ts b/app/client/packages/eslint-plugin/src/index.ts index e3e454c20e2a..eda6deb6d349 100644 --- a/app/client/packages/eslint-plugin/src/index.ts +++ b/app/client/packages/eslint-plugin/src/index.ts @@ -1,13 +1,16 @@ import { objectKeysRule } from "./object-keys/rule"; +import { namedUseEffectRule } from "./named-use-effect/rule"; const plugin = { rules: { "object-keys": objectKeysRule, + "named-use-effect": namedUseEffectRule, }, configs: { recommended: { rules: { "@appsmith/object-keys": "warn", + "@appsmith/named-use-effect": "warn", }, }, }, diff --git a/app/client/packages/eslint-plugin/src/named-use-effect/rule.test.ts b/app/client/packages/eslint-plugin/src/named-use-effect/rule.test.ts new file mode 100644 index 000000000000..267997f9e4af --- /dev/null +++ b/app/client/packages/eslint-plugin/src/named-use-effect/rule.test.ts @@ -0,0 +1,25 @@ +import { TSESLint } from "@typescript-eslint/utils"; +import { namedUseEffectRule } from "./rule"; + +const ruleTester = new TSESLint.RuleTester(); + +ruleTester.run("named-use-effect", namedUseEffectRule, { + valid: [ + { + code: "useEffect(function add(){ }, [])", + }, + { + code: "React.useEffect(function add(){ }, [])", + }, + ], + invalid: [ + { + code: "useEffect(function (){ }, [])", + errors: [{ messageId: "useNamedUseEffect" }], + }, + { + code: "React.useEffect(function (){ }, [])", + errors: [{ messageId: "useNamedUseEffect" }], + }, + ], +}); diff --git a/app/client/packages/eslint-plugin/src/named-use-effect/rule.ts b/app/client/packages/eslint-plugin/src/named-use-effect/rule.ts new file mode 100644 index 000000000000..5732f04c9264 --- /dev/null +++ b/app/client/packages/eslint-plugin/src/named-use-effect/rule.ts @@ -0,0 +1,65 @@ +import type { TSESLint } from "@typescript-eslint/utils"; + +export const namedUseEffectRule: TSESLint.RuleModule<"useNamedUseEffect"> = { + defaultOptions: [], + meta: { + type: "suggestion", + docs: { + description: "Warns when useEffect hook has an anonymous function", + recommended: "warn", + }, + schema: [], // No options + messages: { + useNamedUseEffect: + "The function inside the useEffect should be named for better readability eg: useEffect(function mySideEffect() {...}, [])", + }, + }, + create(context) { + return { + CallExpression(node) { + // useEffect used directly + // eg + // import { useEffect } from "react"; + // ... + // useEffect(() => {}, []) + const isDirectCall = + node.callee.type === "Identifier" && node.callee.name === "useEffect"; + + // useEffect used via React object + // eg + // import React from "react"; + // ... + // React.useEffect(() => {}, []) + const isMemberExpressionCall = + node.callee.type === "MemberExpression" && + node.callee.object.type === "Identifier" && + node.callee.object.name === "React" && + node.callee.property.type === "Identifier" && + node.callee.property.name === "useEffect"; + + if (isDirectCall || isMemberExpressionCall) { + // Get the first argument which should be a function + const callbackArg = node.arguments[0]; + + // Arrow function are never named so it is discouraged + if (callbackArg.type === "ArrowFunctionExpression") { + context.report({ + node: callbackArg, + messageId: "useNamedUseEffect", + }); + } + + // Function Expressions can be unnamed. This is also discouraged + if (callbackArg.type === "FunctionExpression") { + if (!callbackArg.id) { + context.report({ + node: callbackArg, + messageId: "useNamedUseEffect", + }); + } + } + } + }, + }; + }, +};
076f2a6ced5744f8acb95f02fddc600bfb759364
2022-06-22 10:56:37
Nayan
fix: Admin email not working (#14474)
false
Admin email not working (#14474)
fix
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 208c6a589a14..876beef0f45c 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 @@ -1,11 +1,11 @@ package com.appsmith.server.solutions.ce; +import com.appsmith.external.constants.AnalyticsEvents; import com.appsmith.external.models.Policy; import com.appsmith.server.acl.AclPermission; import com.appsmith.server.configurations.CommonConfig; import com.appsmith.server.configurations.EmailConfig; import com.appsmith.server.configurations.GoogleRecaptchaConfig; -import com.appsmith.external.constants.AnalyticsEvents; import com.appsmith.server.constants.EnvVariables; import com.appsmith.server.domains.User; import com.appsmith.server.dtos.EnvChangesResponseDTO; @@ -18,9 +18,9 @@ import com.appsmith.server.helpers.ValidationUtils; import com.appsmith.server.notifications.EmailSender; import com.appsmith.server.repositories.UserRepository; +import com.appsmith.server.services.AnalyticsService; import com.appsmith.server.services.SessionUserService; import com.appsmith.server.services.UserService; -import com.appsmith.server.services.AnalyticsService; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -37,7 +37,6 @@ import org.springframework.web.server.ServerWebExchange; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; import javax.mail.MessagingException; import java.io.File; @@ -47,14 +46,13 @@ import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; -import java.time.Duration; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; -import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -70,13 +68,13 @@ import static com.appsmith.server.constants.EnvVariables.APPSMITH_MAIL_PORT; import static com.appsmith.server.constants.EnvVariables.APPSMITH_MAIL_SMTP_AUTH; import static com.appsmith.server.constants.EnvVariables.APPSMITH_MAIL_USERNAME; +import static com.appsmith.server.constants.EnvVariables.APPSMITH_OAUTH2_GITHUB_CLIENT_ID; +import static com.appsmith.server.constants.EnvVariables.APPSMITH_OAUTH2_GOOGLE_CLIENT_ID; import static com.appsmith.server.constants.EnvVariables.APPSMITH_RECAPTCHA_SECRET_KEY; import static com.appsmith.server.constants.EnvVariables.APPSMITH_RECAPTCHA_SITE_KEY; import static com.appsmith.server.constants.EnvVariables.APPSMITH_REPLY_TO; import static com.appsmith.server.constants.EnvVariables.APPSMITH_SIGNUP_ALLOWED_DOMAINS; import static com.appsmith.server.constants.EnvVariables.APPSMITH_SIGNUP_DISABLED; -import static com.appsmith.server.constants.EnvVariables.APPSMITH_OAUTH2_GOOGLE_CLIENT_ID; -import static com.appsmith.server.constants.EnvVariables.APPSMITH_OAUTH2_GITHUB_CLIENT_ID; @RequiredArgsConstructor @Slf4j @@ -232,7 +230,9 @@ public Mono<EnvChangesResponseDTO> applyChanges(Map<String, String> changes) { if (changesCopy.containsKey(APPSMITH_ADMIN_EMAILS.name())) { commonConfig.setAdminEmails(changesCopy.remove(APPSMITH_ADMIN_EMAILS.name())); String oldAdminEmailsCsv = originalValues.get(APPSMITH_ADMIN_EMAILS.name()); - dependentTasks = dependentTasks.then(updateAdminUserPolicies(oldAdminEmailsCsv)); + dependentTasks = dependentTasks.then( + updateAdminUserPolicies(oldAdminEmailsCsv).then() + ); } if (changesCopy.containsKey(APPSMITH_MAIL_FROM.name())) { @@ -279,16 +279,7 @@ public Mono<EnvChangesResponseDTO> applyChanges(Map<String, String> changes) { commonConfig.setTelemetryDisabled("true".equals(changesCopy.remove(APPSMITH_DISABLE_TELEMETRY.name()))); } - // Ideally, we should only need a restart here if `changesCopy` is not empty. However, some of these - // env variables are also used in client code, which means restart might be necessary there. So, to - // provide a more uniform and predictable experience, we always restart. - Mono.delay(Duration.ofSeconds(1)) - .then(dependentTasks) - .then(restart()) - .subscribeOn(Schedulers.boundedElastic()) - .subscribe(); - - return Mono.just(new EnvChangesResponseDTO(true)); + return dependentTasks.thenReturn(new EnvChangesResponseDTO(true)); }); } @@ -366,8 +357,9 @@ else if (newVariable.isEmpty() && !originalVariable.isEmpty()) { * If an email is removed from admin emails, it'll remove the policy from that user. * If a new email is added as admin email, it'll add the policy to that user * @param oldAdminEmailsCsv comma separated email addresses that was set as admin email earlier + * @return */ - private Mono<Void> updateAdminUserPolicies(String oldAdminEmailsCsv) { + private Flux<User> updateAdminUserPolicies(String oldAdminEmailsCsv) { Set<String> oldAdminEmails = TextUtils.csvToSet(oldAdminEmailsCsv); Set<String> newAdminEmails = commonConfig.getAdminEmails(); @@ -395,14 +387,8 @@ private Mono<Void> updateAdminUserPolicies(String oldAdminEmailsCsv) { return userRepository.save(user); }); - /* - * we need to run these two flux immediately because server will be restarted and these changes - * should be persisted to DB before that - */ - return Mono.whenDelayError( - removedUserFlux.then(), - newUsersFlux.then() - ); + int prefetchSize = oldAdminEmails.size(); // prefetch total emails + return Flux.mergeDelayError(prefetchSize, removedUserFlux, newUsersFlux); } public Map<String, String> parseToMap(String content) {
a69db80f23616ada2cfd751132d8da231caadf3e
2025-02-06 13:57:21
Valera Melnikov
chore: add slider control (#39058)
false
add slider control (#39058)
chore
diff --git a/app/client/src/components/formControls/BaseControl.tsx b/app/client/src/components/formControls/BaseControl.tsx index a728fdf28348..50189b9e6a65 100644 --- a/app/client/src/components/formControls/BaseControl.tsx +++ b/app/client/src/components/formControls/BaseControl.tsx @@ -87,6 +87,7 @@ export interface ControlData { errorText?: string; showError?: boolean; encrypted?: boolean; + title?: string; // used as label for control component subtitle?: string; showLineNumbers?: boolean; url?: string; diff --git a/app/client/src/components/formControls/SliderControl.tsx b/app/client/src/components/formControls/SliderControl.tsx new file mode 100644 index 000000000000..afbe92c92eda --- /dev/null +++ b/app/client/src/components/formControls/SliderControl.tsx @@ -0,0 +1,47 @@ +import React from "react"; +import { Field, type WrappedFieldInputProps } from "redux-form"; +import BaseControl from "./BaseControl"; +import type { ControlProps } from "./BaseControl"; +import { Slider, type SliderProps } from "@appsmith/ads"; + +export interface SliderControlProps + extends ControlProps, + Omit<SliderProps, "id" | "label"> {} + +export class SliderControl extends BaseControl<SliderControlProps> { + render() { + const { configProperty, ...rest } = this.props; + + return ( + <Field + component={renderSliderControl} + name={configProperty} + props={{ ...rest }} + /> + ); + } + + getControlType(): string { + return "SLIDER"; + } +} + +const renderSliderControl = ( + props: { + input?: WrappedFieldInputProps; + } & SliderControlProps, +) => { + const { input, maxValue, minValue, step, title } = props; + + return ( + <Slider + defaultValue={input?.value} + // use title as label because UQI label form placed above the component witch breaks the layout + label={title} + maxValue={maxValue} + minValue={minValue} + onChangeEnd={input?.onChange} + step={step} + /> + ); +}; diff --git a/app/client/src/utils/formControl/FormControlRegistry.tsx b/app/client/src/utils/formControl/FormControlRegistry.tsx index ab538fe39ddb..391e64f159c7 100644 --- a/app/client/src/utils/formControl/FormControlRegistry.tsx +++ b/app/client/src/utils/formControl/FormControlRegistry.tsx @@ -38,6 +38,10 @@ import type { MultipleFilePickerControlProps } from "components/formControls/Mul import type { RadioButtonControlProps } from "components/formControls/RadioButtonControl"; import RadioButtonControl from "components/formControls/RadioButtonControl"; import { RagIntegrations } from "ee/components/formControls/Rag"; +import { + SliderControl, + type SliderControlProps, +} from "components/formControls/SliderControl"; /** * NOTE: If you are adding a component that uses FormControl @@ -199,6 +203,11 @@ class FormControlRegistry { }, }, ); + FormControlFactory.registerControlBuilder(formControlTypes.SLIDER, { + buildPropertyControl(controlProps: SliderControlProps): JSX.Element { + return <SliderControl {...controlProps} />; + }, + }); } } diff --git a/app/client/src/utils/formControl/formControlTypes.ts b/app/client/src/utils/formControl/formControlTypes.ts index 69c0f6d7add8..ee81c6d24c74 100644 --- a/app/client/src/utils/formControl/formControlTypes.ts +++ b/app/client/src/utils/formControl/formControlTypes.ts @@ -20,4 +20,5 @@ export default { MULTIPLE_FILE_PICKER: "MULTIPLE_FILE_PICKER", RADIO_BUTTON: "RADIO_BUTTON", RAG_INTEGRATIONS: "RAG_INTEGRATIONS", + SLIDER: "SLIDER", };
02d1231d60336dd41f06280c9ff38d8d38cb9cda
2021-05-09 10:29:13
snyk-bot
fix: upgrade flow-bin from 0.91.0 to 0.148.0
false
upgrade flow-bin from 0.91.0 to 0.148.0
fix
diff --git a/app/client/package.json b/app/client/package.json index bc24cf83d9c2..dd17952c7534 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -65,7 +65,7 @@ "eslint": "^7.11.0", "fast-deep-equal": "^3.1.1", "fast-xml-parser": "^3.17.5", - "flow-bin": "^0.91.0", + "flow-bin": "^0.148.0", "fuse.js": "^3.4.5", "fusioncharts": "^3.16.0", "history": "^4.10.1", diff --git a/app/client/yarn.lock b/app/client/yarn.lock index 8af878b06b2f..5e3ae9aad21a 100644 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -8619,9 +8619,10 @@ flatten@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.3.tgz#c1283ac9f27b368abc1e36d1ff7b04501a30356b" -flow-bin@^0.91.0: - version "0.91.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.91.0.tgz#f5c89729f74b2ccbd47df6fbfadbdcc89cc1e478" +flow-bin@^0.148.0: + version "0.148.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.148.0.tgz#1d264606dbb4d6e6070cc98a775e21dcd64e6890" + integrity sha512-7Cx6BUm8UAlbqtYJNYXdMrh900MQhNV+SjtBxZuWN7UmlVG4tIRNzNLEOjNnj2DN2vcL1wfI5IlSUXnws/QCEw== flow-parser@0.*: version "0.135.0"
cdee74e93b2e3a0fddc9367dfb943b0b6f86cb58
2024-06-11 19:25:34
ashit-rath
chore: Split JS collection update api call to override for modules (#34009)
false
Split JS collection update api call to override for modules (#34009)
chore
diff --git a/app/client/src/ce/sagas/ApiCallerSaga.test.ts b/app/client/src/ce/sagas/ApiCallerSaga.test.ts new file mode 100644 index 000000000000..1dfece723a1f --- /dev/null +++ b/app/client/src/ce/sagas/ApiCallerSaga.test.ts @@ -0,0 +1,124 @@ +import { runSaga } from "redux-saga"; +import type { Saga } from "redux-saga"; + +import ActionAPI from "api/ActionAPI"; +import { PostgresFactory } from "test/factories/Actions/Postgres"; +import type { ApiResponse } from "api/ApiResponses"; +import type { Action } from "entities/Action"; +import { JSObjectFactory } from "test/factories/Actions/JSObject"; +// Since this is a ce test, importing from @appsmith might lead to unexpected results +// eslint-disable-next-line @typescript-eslint/no-restricted-imports +import JSActionAPI from "ce/api/JSActionAPI"; +import { + updateActionAPICall, + updateJSCollectionAPICall, +} from "./ApiCallerSagas"; + +jest.mock("ce/api/JSActionAPI"); +jest.mock("api/ActionAPI"); + +const successResponse = <T = any>(data: T) => { + return { + responseMeta: { + status: 200, + success: true, + }, + data, + errorDisplay: "", + } as ApiResponse<T>; +}; + +describe("updateActionAPICall", () => { + beforeEach(() => { + jest.resetAllMocks(); + }); + + it("should call ActionAPI.updateAction and return the response", async () => { + const dispatchedActions: any[] = []; + const action = PostgresFactory.build(); + + const response: ApiResponse<Action> = successResponse(action); + + (ActionAPI.updateAction as jest.Mock).mockResolvedValue(response); + + const result = await runSaga( + { + dispatch: (action) => dispatchedActions.push(action), + }, + updateActionAPICall as Saga, + action, + ).toPromise(); + + expect(ActionAPI.updateAction).toHaveBeenCalledWith(action); + expect(result).toEqual(response); + }); + + it("should throw an error when ActionAPI.updateAction fails", async () => { + const dispatchedActions: any[] = []; + const action = PostgresFactory.build(); + const error = new Error("Some error"); + + (ActionAPI.updateAction as jest.Mock).mockRejectedValue(error); + + try { + await runSaga( + { + dispatch: (action) => dispatchedActions.push(action), + }, + updateActionAPICall as Saga, + action, + ).toPromise(); + } catch (e) { + expect(e).toEqual(error); + } + + expect(ActionAPI.updateAction).toHaveBeenCalledWith(action); + }); +}); + +describe("updateJSCollectionAPICall", () => { + beforeEach(() => { + jest.resetAllMocks(); + }); + + it("should call JSActionAPI.updateJSCollection and return the response", async () => { + const dispatchedActions: any[] = []; + const jsCollection = JSObjectFactory.build(); + const response = successResponse(jsCollection); + + (JSActionAPI.updateJSCollection as jest.Mock).mockResolvedValue(response); + + const result = await runSaga( + { + dispatch: (action) => dispatchedActions.push(action), + }, + updateJSCollectionAPICall as Saga, + jsCollection, + ).toPromise(); + + expect(JSActionAPI.updateJSCollection).toHaveBeenCalledWith(jsCollection); + expect(result).toEqual(response); + }); + + it("should throw an error when JSActionAPI.updateJSCollection fails", async () => { + const dispatchedActions: any[] = []; + const jsCollection = JSObjectFactory.build(); + const error = new Error("Some error"); + + (JSActionAPI.updateJSCollection as jest.Mock).mockRejectedValue(error); + + try { + await runSaga( + { + dispatch: (action) => dispatchedActions.push(action), + }, + updateJSCollectionAPICall as Saga, + jsCollection, + ).toPromise(); + } catch (e) { + expect(e).toEqual(error); + } + + expect(JSActionAPI.updateJSCollection).toHaveBeenCalledWith(jsCollection); + }); +}); diff --git a/app/client/src/ce/sagas/ApiCallerSagas.ts b/app/client/src/ce/sagas/ApiCallerSagas.ts index 4f70d2a463ba..9790963fe472 100644 --- a/app/client/src/ce/sagas/ApiCallerSagas.ts +++ b/app/client/src/ce/sagas/ApiCallerSagas.ts @@ -1,6 +1,8 @@ +import JSActionAPI from "@appsmith/api/JSActionAPI"; import ActionAPI from "api/ActionAPI"; import type { ApiResponse } from "api/ApiResponses"; import type { Action } from "entities/Action"; +import type { JSCollection } from "entities/JSCollection"; /** * DO NOT ADD any additional code/functionality in this saga. This function is overridden in EE to @@ -18,3 +20,21 @@ export function* updateActionAPICall(action: Action) { throw e; } } + +/** + * DO NOT ADD any additional code/functionality in this saga. This function is overridden in EE to + * use a different API for update jsCollection under the package editor. + * The purpose of this saga is only to call the appropriate API and return the result + * @param action Action + * @returns Action + */ +export function* updateJSCollectionAPICall(jsCollection: JSCollection) { + try { + const response: ApiResponse<JSCollection> = + yield JSActionAPI.updateJSCollection(jsCollection); + + return response; + } catch (e) { + throw e; + } +} diff --git a/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/pasteSagas.test.ts b/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/pasteSagas.test.ts index 686690727baf..e9316c96365b 100644 --- a/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/pasteSagas.test.ts +++ b/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/pasteSagas.test.ts @@ -45,7 +45,7 @@ jest.mock("selectors/layoutSystemSelectors", () => ({ getLayoutSystemType: jest.fn(), })); describe("pasteSagas", () => { - const pageId = "pageId"; + const pageId = "0123456789abcdef00000000"; beforeAll(() => { registerLayoutComponents(); diff --git a/app/client/src/sagas/JSPaneSagas.ts b/app/client/src/sagas/JSPaneSagas.ts index f8fb06a013d6..60571f757d92 100644 --- a/app/client/src/sagas/JSPaneSagas.ts +++ b/app/client/src/sagas/JSPaneSagas.ts @@ -100,6 +100,7 @@ import { getFocusablePropertyPaneField } from "selectors/propertyPaneSelectors"; import { getIsSideBySideEnabled } from "selectors/ideSelectors"; import { setIdeEditorViewMode } from "actions/ideActions"; import { EditorViewMode } from "@appsmith/entities/IDE/constants"; +import { updateJSCollectionAPICall } from "@appsmith/sagas/ApiCallerSagas"; export interface GenerateDefaultJSObjectProps { name: string; @@ -325,8 +326,10 @@ function* updateJSCollection(data: { try { const { deletedActions, jsCollection, newActions } = data; if (jsCollection) { - const response: JSCollectionCreateUpdateResponse = - yield JSActionAPI.updateJSCollection(jsCollection); + const response: JSCollectionCreateUpdateResponse = yield call( + updateJSCollectionAPICall, + jsCollection, + ); const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { if (newActions && newActions.length) { @@ -724,7 +727,8 @@ function* handleUpdateJSFunctionPropertySaga( }); collection.actions = updatedActions; const response: ApiResponse<JSCollectionCreateUpdateResponse> = - yield JSActionAPI.updateJSCollection(collection); + yield call(updateJSCollectionAPICall, collection); + const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { yield put({
d43982bd3a387d30dd770f22231e11592d885d00
2024-03-27 16:16:52
sneha122
fix: Auth datasource new api button not working fixed (#32079)
false
Auth datasource new api button not working fixed (#32079)
fix
diff --git a/app/client/src/pages/Editor/DataSourceEditor/NewActionButton.tsx b/app/client/src/pages/Editor/DataSourceEditor/NewActionButton.tsx index a4bddd408067..6624a6e3ba10 100644 --- a/app/client/src/pages/Editor/DataSourceEditor/NewActionButton.tsx +++ b/app/client/src/pages/Editor/DataSourceEditor/NewActionButton.tsx @@ -36,6 +36,22 @@ interface NewActionButtonProps { style?: any; isNewQuerySecondaryButton?: boolean; } + +export const apiPluginHasUrl = ( + currentEnvironment: string, + pluginType?: string, + datasource?: Datasource, +) => { + if (pluginType !== PluginType.API) { + return false; + } + return ( + !datasource || + !datasource?.datasourceStorages[currentEnvironment]?.datasourceConfiguration + ?.url + ); +}; + function NewActionButton(props: NewActionButtonProps) { const { datasource, @@ -59,14 +75,7 @@ function NewActionButton(props: NewActionButtonProps) { const createQueryAction = useCallback( (pageId: string) => { - if ( - pluginType === PluginType.API && - (!datasource || - !datasource.datasourceStorages[currentEnvironment] - .datasourceConfiguration || - !datasource.datasourceStorages[currentEnvironment] - .datasourceConfiguration.url) - ) { + if (apiPluginHasUrl(currentEnvironment, pluginType, datasource)) { toast.show(ERROR_ADD_API_INVALID_URL(), { kind: "error", }); diff --git a/app/client/src/pages/Editor/__tests__/NewActionButton.test.tsx b/app/client/src/pages/Editor/__tests__/NewActionButton.test.tsx new file mode 100644 index 000000000000..9264281ee4dc --- /dev/null +++ b/app/client/src/pages/Editor/__tests__/NewActionButton.test.tsx @@ -0,0 +1,83 @@ +import "@testing-library/jest-dom"; +import { PluginType } from "entities/Action"; +import type { Datasource } from "entities/Datasource"; +import { apiPluginHasUrl } from "../DataSourceEditor/NewActionButton"; + +const datasourceWithUrl: Datasource = { + id: "test", + datasourceStorages: { + env1: { + datasourceId: "test", + environmentId: "env1", + datasourceConfiguration: { + url: "https://example.com", + }, + isValid: false, + }, + }, + pluginId: "plugin", + workspaceId: "workspace", + name: "datasource1", +}; + +const datasourceWithoutUrl: Datasource = { + id: "test", + datasourceStorages: { + env1: { + datasourceId: "test", + environmentId: "env1", + datasourceConfiguration: { + url: "", + }, + isValid: false, + }, + }, + pluginId: "plugin", + workspaceId: "workspace", + name: "datasource1", +}; + +describe("New Action Button Component", () => { + // Positive case where everything is correct in datasource / Plugin type is different, basically no error + it("1. Plugin type is API and datasource defined with url, should return false", () => { + const result: boolean = apiPluginHasUrl( + "env1", + PluginType.API, + datasourceWithUrl, + ); + expect(result).toBe(false); + }); + + it("2. If plugin type is different, should return false", () => { + const result: boolean = apiPluginHasUrl( + "env1", + PluginType.SAAS, + datasourceWithUrl, + ); + expect(result).toBe(false); + }); + + // Negative cases, error is there due to various reasons + it("3. Plugin type is API but datasource not defined, should return true", () => { + const result: boolean = apiPluginHasUrl("env1", PluginType.API, undefined); + expect(result).toBe(true); + }); + + it("4. If current environment is different from datasource env, should return true", () => { + const result: boolean = apiPluginHasUrl( + "env2", + PluginType.API, + datasourceWithUrl, + ); + expect(result).toBe(true); + }); + + it("5. Plugin type is API and datasource defined without url, should return false", () => { + const result: boolean = apiPluginHasUrl( + "env1", + PluginType.API, + datasourceWithoutUrl, + ); + expect(result).toBe(true); + }); +});
3d2b33c0fa531368827eb5c989d6a662e99093a6
2024-04-03 14:52:09
albinAppsmith
chore: cypress test for canvas view mode (#32354)
false
cypress test for canvas view mode (#32354)
chore
diff --git a/app/client/cypress/e2e/Regression/ClientSide/IDE/Canvas_View_mode.ts b/app/client/cypress/e2e/Regression/ClientSide/IDE/Canvas_View_mode.ts new file mode 100644 index 000000000000..d8d138018170 --- /dev/null +++ b/app/client/cypress/e2e/Regression/ClientSide/IDE/Canvas_View_mode.ts @@ -0,0 +1,64 @@ +import { + CANVAS_VIEW_MODE_TOOLTIP, + createMessage, +} from "../../../../../src/ce/constants/messages"; +import { + agHelper, + draggableWidgets, + jsEditor, + locators, +} from "../../../../support/Objects/ObjectsCore"; +import Canvas from "../../../../support/Pages/Canvas"; +import EditorNavigation, { + EditorViewMode, + PageLeftPane, + PagePaneSegment, +} from "../../../../support/Pages/EditorNavigation"; + +describe("Canvas view mode", { tags: ["@tag.IDE"] }, () => { + const JS_OBJECT_BODY = `export default { + testFunction: () => { + console.log("hi"); + }, + }`; + const shortKey = Cypress.platform === "darwin" ? "\u2318" : "Ctrl +"; + + it("1. Canvas view mode functionalities", () => { + cy.dragAndDropToCanvas("inputwidgetv2", { x: 300, y: 200 }); + + jsEditor.CreateJSObject(JS_OBJECT_BODY, { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + }); + + EditorNavigation.SwitchScreenMode(EditorViewMode.SplitScreen); + + Canvas.hoverOnWidget("Input1"); + // check for tooltip helper text + cy.assertTooltipPresence( + '[role="tooltip"]', + createMessage(CANVAS_VIEW_MODE_TOOLTIP, shortKey), + ); + // check for widget name element + cy.get(`div[data-testid="t--settings-controls-positioned-wrapper"]`) + .should("be.visible") + .contains("Input1"); + + // check widget intraction + agHelper.ClearNType( + locators._widgetInDeployed(draggableWidgets.INPUT_V2) + " input", + "test data", + ); + + // assert js pane existance + PageLeftPane.assertSelectedSegment(PagePaneSegment.JS); + + // cmd click to show property pane + Canvas.commandClickWidget("Input1"); + + // check for property pane visibility + cy.get(".t--property-pane-sidebar").should("be.visible"); + }); +}); diff --git a/app/client/cypress/support/Pages/Canvas.ts b/app/client/cypress/support/Pages/Canvas.ts index 90704ec1868c..a12e2f2023ff 100644 --- a/app/client/cypress/support/Pages/Canvas.ts +++ b/app/client/cypress/support/Pages/Canvas.ts @@ -1,3 +1,4 @@ +import { agHelper } from "../Objects/ObjectsCore"; import EditorNavigation from "./EditorNavigation"; class Canvas { @@ -5,15 +6,25 @@ class Canvas { EditorNavigation.ShowCanvas(); for (const widget of widgetNames) { // Ctrl click on widget name component - cy.get(`div[data-widgetname-cy='${widget}']`).realHover(); - cy.get(`div[data-testid="t--settings-controls-positioned-wrapper"]`) - .contains(widget) - .click({ - force: true, - ctrlKey: true, - }); + this.commandClickWidget(widget); } } + + hoverOnWidget(widgetName: string) { + const selector = `[data-widgetname-cy="${widgetName}"] > div`; + agHelper.Sleep(500); + cy.get(selector).trigger("mouseover", { force: true }).wait(500); + } + + commandClickWidget(widgetName: string) { + cy.get(`div[data-widgetname-cy='${widgetName}']`).realHover(); + cy.get(`div[data-testid="t--settings-controls-positioned-wrapper"]`) + .contains(widgetName) + .click({ + force: true, + ctrlKey: true, + }); + } } export default new Canvas(); diff --git a/app/client/cypress/support/Pages/IDE/LeftPane.ts b/app/client/cypress/support/Pages/IDE/LeftPane.ts index 0ada0f1fff58..003a2f703926 100644 --- a/app/client/cypress/support/Pages/IDE/LeftPane.ts +++ b/app/client/cypress/support/Pages/IDE/LeftPane.ts @@ -124,4 +124,10 @@ export class LeftPane { public assertItemCount(count: number) { this.listView.assertItemCount(count); } + + public assertSelectedSegment(name: string) { + ObjectsRegistry.AggregateHelper.GetElement( + this.locators.segment(name), + ).should("have.attr", "data-selected", "true"); + } } diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index f17bd1e0cdfa..371ed6bf70c6 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -2091,3 +2091,17 @@ Cypress.Commands.add("stubPricingPage", () => { Cypress.Commands.add("selectByTestId", (testId) => { return cy.get(`[data-testid="${testId}"]`); }); + +/** + * @param tooltipSelector + * @param expectedText + * @returns + * + * + */ +Cypress.Commands.add( + "assertTooltipPresence", + (tooltipSelector = "", expectedText) => { + cy.get(tooltipSelector).should("be.visible").and("contain", expectedText); + }, +); diff --git a/app/client/cypress/support/index.d.ts b/app/client/cypress/support/index.d.ts index 5e8f574a0619..df58757ca757 100644 --- a/app/client/cypress/support/index.d.ts +++ b/app/client/cypress/support/index.d.ts @@ -176,5 +176,6 @@ declare namespace Cypress { stubPricingPage(); validateEvaluatedValue(value: string); selectByTestId(value: string): Chainable<JQuery<HTMLElement>>; + assertTooltipPresence(tooltipSelector: string, expectedText: string); } } diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts index 9a8ea0143d25..4fcad618661b 100644 --- a/app/client/src/ce/constants/messages.ts +++ b/app/client/src/ce/constants/messages.ts @@ -2464,3 +2464,6 @@ export const SPLITPANE_ANNOUNCEMENT = { DESCRIPTION: () => "Write queries and JS functions while you refer to the UI on the side! This is a beta version that we will continue to improve with your feedback.", }; + +export const CANVAS_VIEW_MODE_TOOLTIP = (shortcutKey: string) => + `💡 ${shortcutKey} click a widget to navigate to UI mode.`; diff --git a/app/client/src/pages/Editor/WidgetsEditor/components/CodeModeTooltip.tsx b/app/client/src/pages/Editor/WidgetsEditor/components/CodeModeTooltip.tsx index d42e41c1bd31..50ec4ec66b1f 100644 --- a/app/client/src/pages/Editor/WidgetsEditor/components/CodeModeTooltip.tsx +++ b/app/client/src/pages/Editor/WidgetsEditor/components/CodeModeTooltip.tsx @@ -4,6 +4,10 @@ import { modText } from "utils/helpers"; import { useSelector } from "react-redux"; import { getWidgetSelectionBlock } from "selectors/ui"; import { retrieveCodeWidgetNavigationUsed } from "utils/storage"; +import { + CANVAS_VIEW_MODE_TOOLTIP, + createMessage, +} from "@appsmith/constants/messages"; /** * CodeModeTooltip @@ -28,7 +32,7 @@ const CodeModeTooltip = (props: { children: React.ReactElement }) => { if (!isWidgetSelectionBlock) return props.children; return ( <Tooltip - content={`💡 ${modText()} click a widget to navigate to UI mode.`} + content={createMessage(CANVAS_VIEW_MODE_TOOLTIP, `${modText()}`)} isDisabled={!shouldShow} placement={"bottom"} showArrow={false}
4d9264444e891a5f17b70d5fb0a02a770f18f61f
2024-01-16 18:19:58
Nidhi
fix: Split changes to allow access to all entities when refactoring something (#30344)
false
Split changes to allow access to all entities when refactoring something (#30344)
fix
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceCEImpl.java index aa2e28d85a92..9386e8492114 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceCEImpl.java @@ -15,7 +15,6 @@ import com.appsmith.server.newpages.base.NewPageService; import com.appsmith.server.refactors.entities.EntityRefactoringServiceCE; import com.appsmith.server.services.AstService; -import com.appsmith.server.solutions.PagePermission; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; @@ -47,7 +46,6 @@ public class WidgetRefactoringServiceCEImpl implements EntityRefactoringServiceC private final NewPageService newPageService; private final AstService astService; private final ObjectMapper objectMapper; - private final PagePermission pagePermission; @Override public AnalyticsEvents getRefactorAnalyticsEvent(EntityType entityType) { @@ -117,7 +115,7 @@ public Flux<String> getExistingEntityNames( String contextId, CreatorContextType contextType, String layoutId, boolean viewMode) { return newPageService // fetch the unpublished page - .findPageById(contextId, pagePermission.getReadPermission(), viewMode) + .findPageById(contextId, null, viewMode) .flatMapMany(page -> { List<Layout> layouts = page.getLayouts(); for (Layout layout : layouts) { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceImpl.java index 574f78b8d8fa..72c2ebb05a59 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceImpl.java @@ -4,7 +4,6 @@ import com.appsmith.server.newpages.base.NewPageService; import com.appsmith.server.refactors.entities.EntityRefactoringService; import com.appsmith.server.services.AstService; -import com.appsmith.server.solutions.PagePermission; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.stereotype.Service; @@ -12,10 +11,7 @@ public class WidgetRefactoringServiceImpl extends WidgetRefactoringServiceCEImpl implements EntityRefactoringService<Layout> { public WidgetRefactoringServiceImpl( - NewPageService newPageService, - AstService astService, - ObjectMapper objectMapper, - PagePermission pagePermission) { - super(newPageService, astService, objectMapper, pagePermission); + NewPageService newPageService, AstService astService, ObjectMapper objectMapper) { + super(newPageService, astService, objectMapper); } } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceCEImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceCEImplTest.java index c105fcd40378..5390dfe973aa 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceCEImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/widgets/refactors/WidgetRefactoringServiceCEImplTest.java @@ -4,7 +4,6 @@ import com.appsmith.server.repositories.ActionCollectionRepository; import com.appsmith.server.services.AstService; import com.appsmith.server.solutions.ActionPermission; -import com.appsmith.server.solutions.PagePermission; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; @@ -33,9 +32,6 @@ class WidgetRefactoringServiceCEImplTest { private final String preWord = "\\b("; private final String postWord = ")\\b"; - @Autowired - PagePermission pagePermission; - @Autowired ActionPermission actionPermission; @@ -54,8 +50,7 @@ class WidgetRefactoringServiceCEImplTest { @BeforeEach public void setUp() { - widgetRefactoringServiceCE = - new WidgetRefactoringServiceCEImpl(newPageService, astService, mapper, pagePermission); + widgetRefactoringServiceCE = new WidgetRefactoringServiceCEImpl(newPageService, astService, mapper); } @Test
4acf5aa59c89a7bd047c5914f95887ca3f533bae
2022-08-15 17:27:28
Souma Ghosh
fix: Cell background colour not applied to new columns in table widget (#15898)
false
Cell background colour not applied to new columns in table widget (#15898)
fix
diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/General.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/General.ts index 7d7e42fe73fa..feb763dd5b0a 100644 --- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/General.ts +++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/General.ts @@ -53,6 +53,12 @@ export default { "columnOrder", "childStylesheet", "inlineEditingSaveOption", + "textColor", + "textSize", + "fontStyle", + "cellBackground", + "verticalAlignment", + "horizontalAlignment", ], isBindProperty: false, isTriggerProperty: false,
9b40629ce94123739881c182781ef70619b65658
2024-08-23 14:58:32
sneha122
fix: moved js filter to mongoDB (#35826)
false
moved js filter to mongoDB (#35826)
fix
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java index 7b2c4b71384c..b52362f42686 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java @@ -78,6 +78,9 @@ Flux<NewAction> findAllByApplicationIdAndViewMode( Flux<NewAction> findAllByApplicationIdAndViewMode( String applicationId, Boolean viewMode, Optional<AclPermission> permission, Optional<Sort> sort); + Flux<NewAction> findAllByApplicationIdAndPluginType( + String applicationId, Boolean viewMode, AclPermission permission, Sort sort, List<String> pluginTypes); + Flux<ActionViewDTO> getActionsForViewMode(String applicationId); ActionViewDTO generateActionViewDTO(NewAction action, ActionDTO actionDTO, boolean viewMode); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java index 952a7605d804..127254e26009 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java @@ -734,26 +734,18 @@ public Flux<NewAction> findByPageIdAndViewMode(String pageId, Boolean viewMode, } @Override - public Flux<NewAction> findAllByApplicationIdAndViewMode( - String applicationId, Boolean viewMode, AclPermission permission, Sort sort) { + public Flux<NewAction> findAllByApplicationIdAndPluginType( + String applicationId, + Boolean viewMode, + AclPermission permission, + Sort sort, + List<String> excludedPluginTypes) { return repository - .findByApplicationId(applicationId, permission, sort) + .findByApplicationIdAndPluginType(applicationId, excludedPluginTypes, permission, sort) .name(VIEW_MODE_FETCH_ACTIONS_FROM_DB) .tap(Micrometer.observation(observationRegistry)) // In case of view mode being true, filter out all the actions which haven't been published - .flatMap(action -> { - if (Boolean.TRUE.equals(viewMode)) { - // In case we are trying to fetch published actions but this action has not been published, do - // not return - if (action.getPublishedAction() == null) { - return Mono.empty(); - } - } - // No need to handle the edge case of unpublished action not being present. This is not possible - // because every created action starts from an unpublishedAction state. - - return Mono.just(action); - }) + .flatMap(action -> this.filterAction(action, viewMode)) .name(VIEW_MODE_FILTER_ACTION) .tap(Micrometer.observation(observationRegistry)) .flatMap(this::sanitizeAction) @@ -761,6 +753,16 @@ public Flux<NewAction> findAllByApplicationIdAndViewMode( .tap(Micrometer.observation(observationRegistry)); } + @Override + public Flux<NewAction> findAllByApplicationIdAndViewMode( + String applicationId, Boolean viewMode, AclPermission permission, Sort sort) { + return repository + .findByApplicationId(applicationId, permission, sort) + // In case of view mode being true, filter out all the actions which haven't been published + .flatMap(action -> this.filterAction(action, viewMode)) + .flatMap(this::sanitizeAction); + } + @Override public Flux<NewAction> findAllByApplicationIdAndViewMode( String applicationId, Boolean viewMode, Optional<AclPermission> permission, Optional<Sort> sort) { @@ -792,9 +794,12 @@ public Flux<ActionViewDTO> getActionsForViewMode(String applicationId) { return Flux.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.APPLICATION_ID)); } + List<String> excludedPluginTypes = List.of(PluginType.JS.toString()); + // fetch the published actions by applicationId // No need to sort the results - return findAllByApplicationIdAndViewMode(applicationId, true, actionPermission.getExecutePermission(), null) + return findAllByApplicationIdAndPluginType( + applicationId, true, actionPermission.getExecutePermission(), null, excludedPluginTypes) .name(VIEW_MODE_INITIAL_ACTION) .tap(Micrometer.observation(observationRegistry)) .filter(newAction -> !PluginType.JS.equals(newAction.getPluginType())) @@ -1083,6 +1088,20 @@ public Mono<NewAction> sanitizeAction(NewAction action) { return actionMono; } + public Mono<NewAction> filterAction(NewAction action, Boolean viewMode) { + if (Boolean.TRUE.equals(viewMode)) { + // In case we are trying to fetch published actions but this action has not been published, do + // not return + if (action.getPublishedAction() == null) { + return Mono.empty(); + } + } + // No need to handle the edge case of unpublished action not being present. This is not possible + // because every created action starts from an unpublishedAction state. + + return Mono.just(action); + } + public Flux<NewAction> addMissingPluginDetailsIntoAllActions(List<NewAction> actionList) { Mono<Map<String, Plugin>> pluginMapMono = Mono.just(defaultPluginMap); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCE.java index 47957edb548f..6026e79bc622 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCE.java @@ -37,6 +37,9 @@ Flux<NewAction> findAllActionsByNameAndPageIdsAndViewMode( Flux<NewAction> findByApplicationId(String applicationId, AclPermission aclPermission, Sort sort); + Flux<NewAction> findByApplicationIdAndPluginType( + String applicationId, List<String> pluginTypes, AclPermission aclPermission, Sort sort); + Flux<NewAction> findByApplicationId( String applicationId, Optional<AclPermission> aclPermission, Optional<Sort> sort); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCEImpl.java index 37de19d0f3da..5913e10ced03 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomNewActionRepositoryCEImpl.java @@ -22,7 +22,6 @@ import org.springframework.data.mongodb.core.aggregation.MatchOperation; import org.springframework.data.mongodb.core.aggregation.ProjectionOperation; import org.springframework.data.mongodb.core.query.Criteria; -import reactor.core.observability.micrometer.Micrometer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -31,7 +30,6 @@ import java.util.Optional; import java.util.Set; -import static com.appsmith.external.constants.spans.ce.ActionSpanCE.VIEW_MODE_FETCH_ACTIONS_FROM_DB_QUERY; import static org.springframework.data.mongodb.core.aggregation.Aggregation.group; import static org.springframework.data.mongodb.core.aggregation.Aggregation.match; import static org.springframework.data.mongodb.core.aggregation.Aggregation.newAggregation; @@ -52,9 +50,7 @@ public Flux<NewAction> findByApplicationId(String applicationId, AclPermission a return queryBuilder() .criteria(getCriterionForFindByApplicationId(applicationId)) .permission(aclPermission) - .all() - .name(VIEW_MODE_FETCH_ACTIONS_FROM_DB_QUERY) - .tap(Micrometer.observation(observationRegistry)); + .all(); } @Override @@ -206,6 +202,26 @@ protected BridgeQuery<NewAction> getCriterionForFindByApplicationId(String appli return Bridge.equal(NewAction.Fields.applicationId, applicationId); } + @Override + public Flux<NewAction> findByApplicationIdAndPluginType( + String applicationId, List<String> excludedPluginTypes, AclPermission aclPermission, Sort sort) { + return queryBuilder() + .criteria(getCriterionForFindByApplicationIdAndPluginType(applicationId, excludedPluginTypes)) + .permission(aclPermission) + .sort(sort) + .all(); + } + + protected BridgeQuery<NewAction> getCriterionForFindByApplicationIdAndPluginType( + String applicationId, List<String> excludedPluginTypes) { + final BridgeQuery<NewAction> q = getCriterionForFindByApplicationId(applicationId); + q.and(Bridge.or( + Bridge.notIn(NewAction.Fields.pluginType, excludedPluginTypes), + Bridge.isNull(NewAction.Fields.pluginType))); + + return q; + } + @Override public Flux<NewAction> findByApplicationIdAndViewMode( String applicationId, Boolean viewMode, AclPermission aclPermission) {
74ad85b565712a9b0b1e7eab7f9deb575667b042
2023-10-20 13:26:30
Nidhi
chore: Refactored import service to use type parameterized generic interface impls (#28245)
false
Refactored import service to use type parameterized generic interface impls (#28245)
chore
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCE.java index 380666277dfb..d09f4c009037 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCE.java @@ -3,13 +3,9 @@ import com.appsmith.external.models.ActionDTO; import com.appsmith.server.acl.AclPermission; import com.appsmith.server.domains.ActionCollection; -import com.appsmith.server.domains.Application; import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ActionCollectionViewDTO; -import com.appsmith.server.dtos.ce.ImportActionCollectionResultDTO; -import com.appsmith.server.dtos.ce.ImportActionResultDTO; -import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; import com.appsmith.server.services.CrudService; import org.springframework.data.domain.Sort; import org.springframework.util.MultiValueMap; @@ -17,7 +13,6 @@ import reactor.core.publisher.Mono; import java.util.List; -import java.util.Map; import java.util.Optional; public interface ActionCollectionServiceCE extends CrudService<ActionCollection, String> { @@ -73,13 +68,4 @@ Mono<ActionCollection> findByBranchNameAndDefaultCollectionId( void populateDefaultResources( ActionCollection actionCollection, ActionCollection branchedActionCollection, String branchName); - - Mono<ImportActionCollectionResultDTO> importActionCollections( - ImportActionResultDTO importActionResultDTO, - Application importedApplication, - String branchName, - List<ActionCollection> importedActionCollectionList, - Map<String, String> pluginMap, - Map<String, NewPage> pageNameMap, - ImportApplicationPermissionProvider permissionProvider); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java index 386b3f7ab4de..35210774e516 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java @@ -8,18 +8,14 @@ import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.Action; import com.appsmith.server.domains.ActionCollection; -import com.appsmith.server.domains.Application; import com.appsmith.server.domains.NewPage; import com.appsmith.server.domains.Page; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ActionCollectionViewDTO; -import com.appsmith.server.dtos.ce.ImportActionCollectionResultDTO; -import com.appsmith.server.dtos.ce.ImportActionResultDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.DefaultResourcesUtils; import com.appsmith.server.helpers.ResponseUtils; -import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; import com.appsmith.server.newactions.base.NewActionService; import com.appsmith.server.repositories.ActionCollectionRepository; import com.appsmith.server.services.AnalyticsService; @@ -45,7 +41,6 @@ import java.time.Instant; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -54,7 +49,6 @@ import java.util.Set; import java.util.stream.Collectors; -import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNewFieldValuesIntoOldObject; import static java.lang.Boolean.TRUE; @@ -626,219 +620,4 @@ public void populateDefaultResources( // Set policies from existing branch object actionCollection.setPolicies(branchedActionCollection.getPolicies()); } - - private NewPage updatePageInActionCollection(ActionCollectionDTO collectionDTO, Map<String, NewPage> pageNameMap) { - NewPage parentPage = pageNameMap.get(collectionDTO.getPageId()); - if (parentPage == null) { - return null; - } - collectionDTO.setPageId(parentPage.getId()); - - // Update defaultResources in actionCollectionDTO - DefaultResources defaultResources = new DefaultResources(); - defaultResources.setPageId(parentPage.getDefaultResources().getPageId()); - collectionDTO.setDefaultResources(defaultResources); - - return parentPage; - } - - /** - * Method to - * - save imported actionCollections with updated policies - * - update default resource ids along with branch-name if the application is connected to git - * - * @param importedActionCollectionList action list extracted from the imported JSON file - * @param application imported and saved application in DB - * @param branchName branch to which the actions needs to be saved if the application is connected to git - * @param pageNameMap map of page name to saved page in DB - * @param pluginMap map of plugin name to saved plugin id in DB - * @param permissionProvider - * @return tuple of imported actionCollectionId and saved actionCollection in DB - */ - @Override - public Mono<ImportActionCollectionResultDTO> importActionCollections( - ImportActionResultDTO importActionResultDTO, - Application application, - String branchName, - List<ActionCollection> importedActionCollectionList, - Map<String, String> pluginMap, - Map<String, NewPage> pageNameMap, - ImportApplicationPermissionProvider permissionProvider) { - - /* Mono.just(application) is created to avoid the eagerly fetching of existing actionCollections - * during the pipeline construction. It should be fetched only when the pipeline is subscribed/executed. - */ - return Mono.just(application) - .flatMap(importedApplication -> { - ImportActionCollectionResultDTO resultDTO = new ImportActionCollectionResultDTO(); - final String workspaceId = importedApplication.getWorkspaceId(); - - // Map of gitSyncId to actionCollection of the existing records in DB - Mono<Map<String, ActionCollection>> actionCollectionsInCurrentAppMono = repository - .findByApplicationId(importedApplication.getId()) - .filter(collection -> collection.getGitSyncId() != null) - .collectMap(ActionCollection::getGitSyncId); - - Mono<Map<String, ActionCollection>> actionCollectionsInBranchesMono; - if (importedApplication.getGitApplicationMetadata() != null) { - final String defaultApplicationId = - importedApplication.getGitApplicationMetadata().getDefaultApplicationId(); - actionCollectionsInBranchesMono = repository - .findByDefaultApplicationId(defaultApplicationId, Optional.empty()) - .filter(actionCollection -> actionCollection.getGitSyncId() != null) - .collectMap(ActionCollection::getGitSyncId); - } else { - actionCollectionsInBranchesMono = Mono.just(Collections.emptyMap()); - } - - return Mono.zip(actionCollectionsInCurrentAppMono, actionCollectionsInBranchesMono) - .flatMap(objects -> { - Map<String, ActionCollection> actionsCollectionsInCurrentApp = objects.getT1(); - Map<String, ActionCollection> actionsCollectionsInBranches = objects.getT2(); - - // set the existing action collections in the result DTO, this will be required in next - // phases - resultDTO.setExistingActionCollections(actionsCollectionsInCurrentApp.values()); - - List<ActionCollection> newActionCollections = new ArrayList<>(); - List<ActionCollection> existingActionCollections = new ArrayList<>(); - - for (ActionCollection actionCollection : importedActionCollectionList) { - if (actionCollection.getUnpublishedCollection() == null - || StringUtils.isEmpty(actionCollection - .getUnpublishedCollection() - .getPageId())) { - continue; // invalid action collection, skip it - } - final String idFromJsonFile = actionCollection.getId(); - NewPage parentPage = new NewPage(); - final ActionCollectionDTO unpublishedCollection = - actionCollection.getUnpublishedCollection(); - final ActionCollectionDTO publishedCollection = - actionCollection.getPublishedCollection(); - - // If pageId is missing in the actionCollectionDTO create a fallback pageId - final String fallbackParentPageId = unpublishedCollection.getPageId(); - - if (unpublishedCollection.getName() != null) { - unpublishedCollection.setDefaultToBranchedActionIdsMap(importActionResultDTO - .getUnpublishedCollectionIdToActionIdsMap() - .get(idFromJsonFile)); - unpublishedCollection.setPluginId( - pluginMap.get(unpublishedCollection.getPluginId())); - parentPage = updatePageInActionCollection(unpublishedCollection, pageNameMap); - } - - if (publishedCollection != null && publishedCollection.getName() != null) { - publishedCollection.setDefaultToBranchedActionIdsMap(importActionResultDTO - .getPublishedCollectionIdToActionIdsMap() - .get(idFromJsonFile)); - publishedCollection.setPluginId( - pluginMap.get(publishedCollection.getPluginId())); - if (StringUtils.isEmpty(publishedCollection.getPageId())) { - publishedCollection.setPageId(fallbackParentPageId); - } - NewPage publishedCollectionPage = - updatePageInActionCollection(publishedCollection, pageNameMap); - parentPage = parentPage == null ? publishedCollectionPage : parentPage; - } - - actionCollection.makePristine(); - actionCollection.setWorkspaceId(workspaceId); - actionCollection.setApplicationId(importedApplication.getId()); - - // Check if the action has gitSyncId and if it's already in DB - if (actionCollection.getGitSyncId() != null - && actionsCollectionsInCurrentApp.containsKey( - actionCollection.getGitSyncId())) { - - // Since the resource is already present in DB, just update resource - ActionCollection existingActionCollection = - actionsCollectionsInCurrentApp.get(actionCollection.getGitSyncId()); - - Set<Policy> existingPolicy = existingActionCollection.getPolicies(); - copyNestedNonNullProperties(actionCollection, existingActionCollection); - // Update branchName - existingActionCollection - .getDefaultResources() - .setBranchName(branchName); - // Recover the deleted state present in DB from imported actionCollection - existingActionCollection - .getUnpublishedCollection() - .setDeletedAt(actionCollection - .getUnpublishedCollection() - .getDeletedAt()); - existingActionCollection.setDeletedAt(actionCollection.getDeletedAt()); - existingActionCollection.setDeleted(actionCollection.getDeleted()); - existingActionCollection.setPolicies(existingPolicy); - - existingActionCollection.updateForBulkWriteOperation(); - existingActionCollections.add(existingActionCollection); - resultDTO.getSavedActionCollectionIds().add(existingActionCollection.getId()); - resultDTO - .getSavedActionCollectionMap() - .put(idFromJsonFile, existingActionCollection); - } else { - if (!permissionProvider.canCreateAction(parentPage)) { - throw new AppsmithException( - AppsmithError.ACL_NO_RESOURCE_FOUND, - FieldName.PAGE, - parentPage.getId()); - } - - if (importedApplication.getGitApplicationMetadata() != null) { - final String defaultApplicationId = importedApplication - .getGitApplicationMetadata() - .getDefaultApplicationId(); - if (actionsCollectionsInBranches.containsKey( - actionCollection.getGitSyncId())) { - ActionCollection branchedActionCollection = - actionsCollectionsInBranches.get( - actionCollection.getGitSyncId()); - populateDefaultResources( - actionCollection, branchedActionCollection, branchName); - } else { - DefaultResources defaultResources = new DefaultResources(); - defaultResources.setApplicationId(defaultApplicationId); - defaultResources.setBranchName(branchName); - actionCollection.setDefaultResources(defaultResources); - } - } - - // this will generate the id and other auto generated fields e.g. createdAt - actionCollection.updateForBulkWriteOperation(); - generateAndSetPolicies(parentPage, actionCollection); - - // create or update default resources for the action - // values already set to defaultResources are kept unchanged - DefaultResourcesUtils.createDefaultIdsOrUpdateWithGivenResourceIds( - actionCollection, branchName); - - // generate gitSyncId if it's not present - if (actionCollection.getGitSyncId() == null) { - actionCollection.setGitSyncId( - actionCollection.getApplicationId() + "_" + new ObjectId()); - } - - // it's new actionCollection - newActionCollections.add(actionCollection); - resultDTO.getSavedActionCollectionIds().add(actionCollection.getId()); - resultDTO.getSavedActionCollectionMap().put(idFromJsonFile, actionCollection); - } - } - log.info( - "Saving action collections in bulk. New: {}, Updated: {}", - newActionCollections.size(), - existingActionCollections.size()); - return repository - .bulkInsert(newActionCollections) - .then(repository.bulkUpdate(existingActionCollections)) - .thenReturn(resultDTO); - }); - }) - .onErrorResume(e -> { - log.error("Error saving action collections", e); - return Mono.error(e); - }); - } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/export/ActionCollectionExportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/exports/ActionCollectionExportableServiceCEImpl.java similarity index 99% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/export/ActionCollectionExportableServiceCEImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/exports/ActionCollectionExportableServiceCEImpl.java index 79e8b7023b54..0eed8687c878 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/export/ActionCollectionExportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/exports/ActionCollectionExportableServiceCEImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.actioncollections.export; +package com.appsmith.server.actioncollections.exports; import com.appsmith.server.acl.AclPermission; import com.appsmith.server.actioncollections.base.ActionCollectionService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/export/ActionCollectionExportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/exports/ActionCollectionExportableServiceImpl.java similarity index 92% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/export/ActionCollectionExportableServiceImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/exports/ActionCollectionExportableServiceImpl.java index 73ee693adf20..685bacbddaae 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/export/ActionCollectionExportableServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/exports/ActionCollectionExportableServiceImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.actioncollections.export; +package com.appsmith.server.actioncollections.exports; import com.appsmith.server.actioncollections.base.ActionCollectionService; import com.appsmith.server.domains.ActionCollection; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/imports/ActionCollectionImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/imports/ActionCollectionImportableServiceCEImpl.java new file mode 100644 index 000000000000..28d7a16ac6b2 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/imports/ActionCollectionImportableServiceCEImpl.java @@ -0,0 +1,330 @@ +package com.appsmith.server.actioncollections.imports; + +import com.appsmith.external.models.DefaultResources; +import com.appsmith.external.models.Policy; +import com.appsmith.server.actioncollections.base.ActionCollectionService; +import com.appsmith.server.constants.FieldName; +import com.appsmith.server.domains.ActionCollection; +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.NewPage; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.dtos.ActionCollectionDTO; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import com.appsmith.server.dtos.ce.ImportActionCollectionResultDTO; +import com.appsmith.server.exceptions.AppsmithError; +import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.helpers.DefaultResourcesUtils; +import com.appsmith.server.imports.importable.ImportableServiceCE; +import com.appsmith.server.repositories.ActionCollectionRepository; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.bson.types.ObjectId; +import reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; + +@Slf4j +public class ActionCollectionImportableServiceCEImpl implements ImportableServiceCE<ActionCollection> { + private final ActionCollectionService actionCollectionService; + private final ActionCollectionRepository repository; + + public ActionCollectionImportableServiceCEImpl( + ActionCollectionService actionCollectionService, ActionCollectionRepository repository) { + this.actionCollectionService = actionCollectionService; + this.repository = repository; + } + + @Override + public Mono<List<ActionCollection>> importEntities( + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<Workspace> workspaceMono, + Mono<Application> applicationMono, + ApplicationJson applicationJson) { + List<ActionCollection> importedActionCollectionList = + CollectionUtils.isEmpty(applicationJson.getActionCollectionList()) + ? new ArrayList<>() + : applicationJson.getActionCollectionList(); + + Mono<ImportActionCollectionResultDTO> importActionCollectionMono = createImportActionCollectionMono( + importedActionCollectionList, applicationMono, importingMetaDTO, mappedImportableResourcesDTO); + + return importActionCollectionMono + .doOnNext(mappedImportableResourcesDTO::setActionCollectionResultDTO) + .thenReturn(List.of()); + } + + private Mono<ImportActionCollectionResultDTO> createImportActionCollectionMono( + List<ActionCollection> importedActionCollectionList, + Mono<Application> importApplicationMono, + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + Mono<List<ActionCollection>> importedActionCollectionMono = Mono.just(importedActionCollectionList); + + if (importingMetaDTO.getAppendToApp()) { + importedActionCollectionMono = importedActionCollectionMono.map(importedActionCollectionList1 -> { + List<NewPage> importedNewPages = mappedImportableResourcesDTO.getPageNameMap().values().stream() + .toList(); + Map<String, String> newToOldNameMap = mappedImportableResourcesDTO.getNewPageNameToOldPageNameMap(); + + for (NewPage newPage : importedNewPages) { + String newPageName = newPage.getUnpublishedPage().getName(); + String oldPageName = newToOldNameMap.get(newPageName); + + if (!newPageName.equals(oldPageName)) { + renamePageInActionCollections(importedActionCollectionList1, oldPageName, newPageName); + } + } + return importedActionCollectionList1; + }); + } + + return Mono.zip(importApplicationMono, importedActionCollectionMono) + .flatMap(objects -> { + log.info("Importing action collections"); + return this.importActionCollections( + objects.getT1(), objects.getT2(), importingMetaDTO, mappedImportableResourcesDTO); + }) + .onErrorResume(throwable -> { + log.error("Error importing action collections", throwable); + return Mono.error(throwable); + }); + } + + private void renamePageInActionCollections( + List<ActionCollection> actionCollectionList, String oldPageName, String newPageName) { + for (ActionCollection actionCollection : actionCollectionList) { + if (actionCollection.getUnpublishedCollection().getPageId().equals(oldPageName)) { + actionCollection.getUnpublishedCollection().setPageId(newPageName); + } + } + } + + /** + * Method to + * - save imported actionCollections with updated policies + * - update default resource ids along with branch-name if the application is connected to git + * + * @param importedActionCollectionList action list extracted from the imported JSON file + * @param application imported and saved application in DB + * @return tuple of imported actionCollectionId and saved actionCollection in DB + */ + private Mono<ImportActionCollectionResultDTO> importActionCollections( + Application application, + List<ActionCollection> importedActionCollectionList, + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + + /* Mono.just(application) is created to avoid the eagerly fetching of existing actionCollections + * during the pipeline construction. It should be fetched only when the pipeline is subscribed/executed. + */ + return Mono.just(application) + .flatMap(importedApplication -> { + ImportActionCollectionResultDTO resultDTO = new ImportActionCollectionResultDTO(); + final String workspaceId = importedApplication.getWorkspaceId(); + + // Map of gitSyncId to actionCollection of the existing records in DB + Mono<Map<String, ActionCollection>> actionCollectionsInCurrentAppMono = repository + .findByApplicationId(importedApplication.getId()) + .filter(collection -> collection.getGitSyncId() != null) + .collectMap(ActionCollection::getGitSyncId); + + Mono<Map<String, ActionCollection>> actionCollectionsInBranchesMono; + if (importedApplication.getGitApplicationMetadata() != null) { + final String defaultApplicationId = + importedApplication.getGitApplicationMetadata().getDefaultApplicationId(); + actionCollectionsInBranchesMono = repository + .findByDefaultApplicationId(defaultApplicationId, Optional.empty()) + .filter(actionCollection -> actionCollection.getGitSyncId() != null) + .collectMap(ActionCollection::getGitSyncId); + } else { + actionCollectionsInBranchesMono = Mono.just(Collections.emptyMap()); + } + + return Mono.zip(actionCollectionsInCurrentAppMono, actionCollectionsInBranchesMono) + .flatMap(objects -> { + Map<String, ActionCollection> actionsCollectionsInCurrentApp = objects.getT1(); + Map<String, ActionCollection> actionsCollectionsInBranches = objects.getT2(); + + // set the existing action collections in the result DTO, this will be required in next + // phases + resultDTO.setExistingActionCollections(actionsCollectionsInCurrentApp.values()); + + List<ActionCollection> newActionCollections = new ArrayList<>(); + List<ActionCollection> existingActionCollections = new ArrayList<>(); + + for (ActionCollection actionCollection : importedActionCollectionList) { + if (actionCollection.getUnpublishedCollection() == null + || StringUtils.isEmpty(actionCollection + .getUnpublishedCollection() + .getPageId())) { + continue; // invalid action collection, skip it + } + final String idFromJsonFile = actionCollection.getId(); + NewPage parentPage = new NewPage(); + final ActionCollectionDTO unpublishedCollection = + actionCollection.getUnpublishedCollection(); + final ActionCollectionDTO publishedCollection = + actionCollection.getPublishedCollection(); + + // If pageId is missing in the actionCollectionDTO create a fallback pageId + final String fallbackParentPageId = unpublishedCollection.getPageId(); + + if (unpublishedCollection.getName() != null) { + unpublishedCollection.setDefaultToBranchedActionIdsMap( + mappedImportableResourcesDTO + .getActionResultDTO() + .getUnpublishedCollectionIdToActionIdsMap() + .get(idFromJsonFile)); + unpublishedCollection.setPluginId(mappedImportableResourcesDTO + .getPluginMap() + .get(unpublishedCollection.getPluginId())); + parentPage = updatePageInActionCollection( + unpublishedCollection, mappedImportableResourcesDTO.getPageNameMap()); + } + + if (publishedCollection != null && publishedCollection.getName() != null) { + publishedCollection.setDefaultToBranchedActionIdsMap( + mappedImportableResourcesDTO + .getActionResultDTO() + .getPublishedCollectionIdToActionIdsMap() + .get(idFromJsonFile)); + publishedCollection.setPluginId(mappedImportableResourcesDTO + .getPluginMap() + .get(publishedCollection.getPluginId())); + if (StringUtils.isEmpty(publishedCollection.getPageId())) { + publishedCollection.setPageId(fallbackParentPageId); + } + NewPage publishedCollectionPage = updatePageInActionCollection( + publishedCollection, mappedImportableResourcesDTO.getPageNameMap()); + parentPage = parentPage == null ? publishedCollectionPage : parentPage; + } + + actionCollection.makePristine(); + actionCollection.setWorkspaceId(workspaceId); + actionCollection.setApplicationId(importedApplication.getId()); + + // Check if the action has gitSyncId and if it's already in DB + if (actionCollection.getGitSyncId() != null + && actionsCollectionsInCurrentApp.containsKey( + actionCollection.getGitSyncId())) { + + // Since the resource is already present in DB, just update resource + ActionCollection existingActionCollection = + actionsCollectionsInCurrentApp.get(actionCollection.getGitSyncId()); + + Set<Policy> existingPolicy = existingActionCollection.getPolicies(); + copyNestedNonNullProperties(actionCollection, existingActionCollection); + // Update branchName + existingActionCollection + .getDefaultResources() + .setBranchName(importingMetaDTO.getBranchName()); + // Recover the deleted state present in DB from imported actionCollection + existingActionCollection + .getUnpublishedCollection() + .setDeletedAt(actionCollection + .getUnpublishedCollection() + .getDeletedAt()); + existingActionCollection.setDeletedAt(actionCollection.getDeletedAt()); + existingActionCollection.setDeleted(actionCollection.getDeleted()); + existingActionCollection.setPolicies(existingPolicy); + + existingActionCollection.updateForBulkWriteOperation(); + existingActionCollections.add(existingActionCollection); + resultDTO.getSavedActionCollectionIds().add(existingActionCollection.getId()); + resultDTO + .getSavedActionCollectionMap() + .put(idFromJsonFile, existingActionCollection); + } else { + if (!importingMetaDTO + .getPermissionProvider() + .canCreateAction(parentPage)) { + throw new AppsmithException( + AppsmithError.ACL_NO_RESOURCE_FOUND, + FieldName.PAGE, + parentPage.getId()); + } + + if (importedApplication.getGitApplicationMetadata() != null) { + final String defaultApplicationId = importedApplication + .getGitApplicationMetadata() + .getDefaultApplicationId(); + if (actionsCollectionsInBranches.containsKey( + actionCollection.getGitSyncId())) { + ActionCollection branchedActionCollection = + actionsCollectionsInBranches.get( + actionCollection.getGitSyncId()); + actionCollectionService.populateDefaultResources( + actionCollection, + branchedActionCollection, + importingMetaDTO.getBranchName()); + } else { + DefaultResources defaultResources = new DefaultResources(); + defaultResources.setApplicationId(defaultApplicationId); + defaultResources.setBranchName(importingMetaDTO.getBranchName()); + actionCollection.setDefaultResources(defaultResources); + } + } + + // this will generate the id and other auto generated fields e.g. createdAt + actionCollection.updateForBulkWriteOperation(); + actionCollectionService.generateAndSetPolicies(parentPage, actionCollection); + + // create or update default resources for the action + // values already set to defaultResources are kept unchanged + DefaultResourcesUtils.createDefaultIdsOrUpdateWithGivenResourceIds( + actionCollection, importingMetaDTO.getBranchName()); + + // generate gitSyncId if it's not present + if (actionCollection.getGitSyncId() == null) { + actionCollection.setGitSyncId( + actionCollection.getApplicationId() + "_" + new ObjectId()); + } + + // it's new actionCollection + newActionCollections.add(actionCollection); + resultDTO.getSavedActionCollectionIds().add(actionCollection.getId()); + resultDTO.getSavedActionCollectionMap().put(idFromJsonFile, actionCollection); + } + } + log.info( + "Saving action collections in bulk. New: {}, Updated: {}", + newActionCollections.size(), + existingActionCollections.size()); + return repository + .bulkInsert(newActionCollections) + .then(repository.bulkUpdate(existingActionCollections)) + .thenReturn(resultDTO); + }); + }) + .onErrorResume(e -> { + log.error("Error saving action collections", e); + return Mono.error(e); + }); + } + + private NewPage updatePageInActionCollection(ActionCollectionDTO collectionDTO, Map<String, NewPage> pageNameMap) { + NewPage parentPage = pageNameMap.get(collectionDTO.getPageId()); + if (parentPage == null) { + return null; + } + collectionDTO.setPageId(parentPage.getId()); + + // Update defaultResources in actionCollectionDTO + DefaultResources defaultResources = new DefaultResources(); + defaultResources.setPageId(parentPage.getDefaultResources().getPageId()); + collectionDTO.setDefaultResources(defaultResources); + + return parentPage; + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/imports/ActionCollectionImportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/imports/ActionCollectionImportableServiceImpl.java new file mode 100644 index 000000000000..522cfa338fa3 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/imports/ActionCollectionImportableServiceImpl.java @@ -0,0 +1,16 @@ +package com.appsmith.server.actioncollections.imports; + +import com.appsmith.server.actioncollections.base.ActionCollectionService; +import com.appsmith.server.domains.ActionCollection; +import com.appsmith.server.imports.importable.ImportableService; +import com.appsmith.server.repositories.ActionCollectionRepository; +import org.springframework.stereotype.Service; + +@Service +public class ActionCollectionImportableServiceImpl extends ActionCollectionImportableServiceCEImpl + implements ImportableService<ActionCollection> { + public ActionCollectionImportableServiceImpl( + ActionCollectionService actionCollectionService, ActionCollectionRepository repository) { + super(actionCollectionService, repository); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java index 16f520570cbc..27bbab6a84ce 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java @@ -487,15 +487,11 @@ public Mono<DatasourceTestResult> testDatasource( } String trueEnvironmentId = datasourceStorage1.getEnvironmentId(); - // Fetch any fields that maybe encrypted from the db if the datasource being - // tested does not - // have those fields set. - // This scenario would happen whenever an existing datasource is being - // tested and no changes are - // present in the - // encrypted field (because encrypted fields are not sent over the network - // after encryption back - // to the client + // Fetch any fields that maybe encrypted from the db if the datasource being tested does + // not have those fields set. + // This scenario would happen whenever an existing datasource is being tested and no + // changes are present in the encrypted field, because encrypted fields are not sent + // over the network after encryption back to the client if (!hasText(datasourceStorage.getId())) { return Mono.just(datasourceStorage); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/export/DatasourceExportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/exports/DatasourceExportableServiceCEImpl.java similarity index 99% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/export/DatasourceExportableServiceCEImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/exports/DatasourceExportableServiceCEImpl.java index b75f9460c169..f7b7cc09e58b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/export/DatasourceExportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/exports/DatasourceExportableServiceCEImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.datasources.export; +package com.appsmith.server.datasources.exports; import com.appsmith.external.models.AuthenticationDTO; import com.appsmith.external.models.BasicAuth; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/export/DatasourceExportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/exports/DatasourceExportableServiceImpl.java similarity index 95% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/export/DatasourceExportableServiceImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/exports/DatasourceExportableServiceImpl.java index b246bff2ab93..9a7f15944131 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/export/DatasourceExportableServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/exports/DatasourceExportableServiceImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.datasources.export; +package com.appsmith.server.datasources.exports; import com.appsmith.external.models.Datasource; import com.appsmith.server.datasources.base.DatasourceService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/imports/DatasourceImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/imports/DatasourceImportableServiceCEImpl.java new file mode 100644 index 000000000000..346bfb8f8b95 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/imports/DatasourceImportableServiceCEImpl.java @@ -0,0 +1,358 @@ +package com.appsmith.server.datasources.imports; + +import com.appsmith.external.models.AuthenticationResponse; +import com.appsmith.external.models.BaseDomain; +import com.appsmith.external.models.BasicAuth; +import com.appsmith.external.models.BearerTokenAuth; +import com.appsmith.external.models.DBAuth; +import com.appsmith.external.models.Datasource; +import com.appsmith.external.models.DatasourceConfiguration; +import com.appsmith.external.models.DatasourceStorage; +import com.appsmith.external.models.DecryptedSensitiveFields; +import com.appsmith.external.models.OAuth2; +import com.appsmith.server.constants.FieldName; +import com.appsmith.server.datasources.base.DatasourceService; +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import com.appsmith.server.exceptions.AppsmithError; +import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; +import com.appsmith.server.imports.importable.ImportableServiceCE; +import com.appsmith.server.services.SequenceService; +import com.appsmith.server.services.WorkspaceService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; + +@Slf4j +public class DatasourceImportableServiceCEImpl implements ImportableServiceCE<Datasource> { + + private final DatasourceService datasourceService; + private final WorkspaceService workspaceService; + private final SequenceService sequenceService; + + public DatasourceImportableServiceCEImpl( + DatasourceService datasourceService, WorkspaceService workspaceService, SequenceService sequenceService) { + this.datasourceService = datasourceService; + this.workspaceService = workspaceService; + this.sequenceService = sequenceService; + } + + @Override + public Mono<List<Datasource>> importEntities( + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<Workspace> workspaceMono, + Mono<Application> applicationMono, + ApplicationJson applicationJson) { + return workspaceMono.flatMap(workspace -> { + final Flux<Datasource> existingDatasourceFlux = datasourceService + .getAllByWorkspaceIdWithStorages(workspace.getId(), Optional.empty()) + .cache(); + + Mono<List<Datasource>> existingDatasourceMono = + getExistingDatasourceMono(importingMetaDTO.getApplicationId(), existingDatasourceFlux); + Mono<Map<String, String>> datasourceMapMono = importDatasources( + applicationJson, + existingDatasourceMono, + existingDatasourceFlux, + workspace, + importingMetaDTO, + mappedImportableResourcesDTO); + + return datasourceMapMono.map(datasourceMap -> { + mappedImportableResourcesDTO.setDatasourceNameToIdMap(datasourceMap); + return List.of(); + }); + }); + } + + private Mono<List<Datasource>> getExistingDatasourceMono(String applicationId, Flux<Datasource> datasourceFlux) { + Mono<List<Datasource>> existingDatasourceMono; + // Check if the request is to hydrate the application to DB for particular branch + // Application id will be present for GIT sync + if (!StringUtils.isEmpty(applicationId)) { + // No need to hydrate the datasource as we expect user will configure the datasource + existingDatasourceMono = datasourceFlux.collectList(); + } else { + existingDatasourceMono = Mono.just(new ArrayList<>()); + } + return existingDatasourceMono; + } + + private Mono<Map<String, String>> importDatasources( + ApplicationJson importedDoc, + Mono<List<Datasource>> existingDatasourceMono, + Flux<Datasource> existingDatasourcesFlux, + Workspace workspace, + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + return Mono.zip(existingDatasourceMono, workspaceService.getDefaultEnvironmentId(workspace.getId(), null)) + .flatMapMany(objects -> { + List<Datasource> existingDatasources = objects.getT1(); + String environmentId = objects.getT2(); + Map<String, String> pluginMap = mappedImportableResourcesDTO.getPluginMap(); + List<DatasourceStorage> importedDatasourceList = importedDoc.getDatasourceList(); + if (CollectionUtils.isEmpty(importedDatasourceList)) { + return Flux.empty(); + } + Map<String, Datasource> savedDatasourcesGitIdToDatasourceMap = new HashMap<>(); + Map<String, Datasource> savedDatasourcesNameDatasourceMap = new HashMap<>(); + + existingDatasources.stream() + .filter(datasource -> datasource.getGitSyncId() != null) + .forEach(datasource -> { + savedDatasourcesGitIdToDatasourceMap.put(datasource.getGitSyncId(), datasource); + savedDatasourcesNameDatasourceMap.put(datasource.getName(), datasource); + }); + + // Check if the destination org have all the required plugins installed + for (DatasourceStorage datasource : importedDatasourceList) { + if (StringUtils.isEmpty(pluginMap.get(datasource.getPluginId()))) { + log.error( + "Unable to find the plugin: {}, available plugins are: {}", + datasource.getPluginId(), + pluginMap.keySet()); + return Flux.error(new AppsmithException( + AppsmithError.UNKNOWN_PLUGIN_REFERENCE, datasource.getPluginId())); + } + } + + return Flux.fromIterable(importedDatasourceList) + // Check for duplicate datasources to avoid duplicates in target workspace + .flatMap(datasourceStorage -> { + final String importedDatasourceName = datasourceStorage.getName(); + // try to find whether there is an existing datasource with same gitSyncId + Datasource existingDatasource = null; + if (datasourceStorage.getGitSyncId() != null + && savedDatasourcesGitIdToDatasourceMap.containsKey( + datasourceStorage.getGitSyncId())) { + Datasource dsWithSameGitsyncId = savedDatasourcesGitIdToDatasourceMap.get( + datasourceStorage.getGitSyncId()); // found a match + // we'll be renaming the matchingDatasource with targetDatasourceName + String targetDatasourceName = datasourceStorage.getName(); + + // check whether there are any other datasource with the same targetDatasourceName + if (savedDatasourcesNameDatasourceMap.containsKey(targetDatasourceName)) { + // found with same name, check if it's matchingDatasource or not + Datasource dsWithSameName = + savedDatasourcesNameDatasourceMap.get(targetDatasourceName); + if (dsWithSameName.getId().equals(dsWithSameGitsyncId.getId())) { + // same DS, we can rename safely + existingDatasource = dsWithSameGitsyncId; + } // otherwise existingDatasource will be null + } else { // no DS found with the targetDatasourceName, we can rename safely + existingDatasource = dsWithSameGitsyncId; + } + } + // Check if the datasource has gitSyncId and if it's already in DB + if (existingDatasource != null) { + // Since the resource is already present in DB, just update resource + if (!importingMetaDTO + .getPermissionProvider() + .hasEditPermission(existingDatasource)) { + log.error( + "Trying to update datasource {} without edit permission", + existingDatasource.getName()); + return Mono.error(new AppsmithException( + AppsmithError.ACL_NO_RESOURCE_FOUND, + FieldName.DATASOURCE, + existingDatasource.getId())); + } + datasourceStorage.setId(null); + // Don't update datasource config as the saved datasource is already configured by + // user + // for this instance + datasourceStorage.setDatasourceConfiguration(null); + datasourceStorage.setPluginId(null); + datasourceStorage.setEnvironmentId(environmentId); + Datasource newDatasource = + datasourceService.createDatasourceFromDatasourceStorage(datasourceStorage); + newDatasource.setPolicies(null); + + copyNestedNonNullProperties(newDatasource, existingDatasource); + // Don't update the datasource configuration for already available datasources + existingDatasource.setDatasourceConfiguration(null); + return datasourceService.save(existingDatasource); + } else { + // This is explicitly copied over from the map we created before + datasourceStorage.setPluginId(pluginMap.get(datasourceStorage.getPluginId())); + datasourceStorage.setWorkspaceId(workspace.getId()); + datasourceStorage.setEnvironmentId(environmentId); + + // Check if any decrypted fields are present for datasource + if (importedDoc.getDecryptedFields() != null + && importedDoc.getDecryptedFields().get(datasourceStorage.getName()) + != null) { + + DecryptedSensitiveFields decryptedFields = + importedDoc.getDecryptedFields().get(datasourceStorage.getName()); + + updateAuthenticationDTO(datasourceStorage, decryptedFields); + } + return createUniqueDatasourceIfNotPresent( + existingDatasourcesFlux, + datasourceStorage, + workspace, + environmentId, + importingMetaDTO.getPermissionProvider()); + } + }); + }) + .collectMap(Datasource::getName, Datasource::getId) + .onErrorResume(error -> { + log.error("Error importing datasources", error); + return Mono.error(error); + }) + .elapsed() + .map(tuple -> { + log.debug("Time taken to import datasources: {} ms", tuple.getT1()); + return tuple.getT2(); + }); + } + + /** + * This will check if the datasource is already present in the workspace and create a new one if unable to find one + * + * @param existingDatasources already present datasource in the workspace + * @param datasourceStorage which will be checked against existing datasources + * @param workspace workspace where duplicate datasource should be checked + * @return already present or brand new datasource depending upon the equality check + */ + private Mono<Datasource> createUniqueDatasourceIfNotPresent( + Flux<Datasource> existingDatasources, + DatasourceStorage datasourceStorage, + Workspace workspace, + String environmentId, + ImportApplicationPermissionProvider permissionProvider) { + /* + 1. If same datasource is present return + 2. If unable to find the datasource create a new datasource with unique name and return + */ + final DatasourceConfiguration datasourceConfig = datasourceStorage.getDatasourceConfiguration(); + AuthenticationResponse authResponse = new AuthenticationResponse(); + if (datasourceConfig != null && datasourceConfig.getAuthentication() != null) { + copyNestedNonNullProperties(datasourceConfig.getAuthentication().getAuthenticationResponse(), authResponse); + datasourceConfig.getAuthentication().setAuthenticationResponse(null); + datasourceConfig.getAuthentication().setAuthenticationType(null); + } + + return existingDatasources + // For git import exclude datasource configuration + .filter(ds -> ds.getName().equals(datasourceStorage.getName()) + && datasourceStorage.getPluginId().equals(ds.getPluginId())) + .next() // Get the first matching datasource, we don't need more than one here. + .switchIfEmpty(Mono.defer(() -> { + // check if user has permission to create datasource + if (!permissionProvider.canCreateDatasource(workspace)) { + log.error( + "Unauthorized to create datasource: {} in workspace: {}", + datasourceStorage.getName(), + workspace.getName()); + return Mono.error(new AppsmithException( + AppsmithError.ACL_NO_RESOURCE_FOUND, + FieldName.DATASOURCE, + datasourceStorage.getName())); + } + + if (datasourceConfig != null && datasourceConfig.getAuthentication() != null) { + datasourceConfig.getAuthentication().setAuthenticationResponse(authResponse); + } + // No matching existing datasource found, so create a new one. + datasourceStorage.setIsConfigured( + datasourceConfig != null && datasourceConfig.getAuthentication() != null); + datasourceStorage.setEnvironmentId(environmentId); + + return datasourceService + .findByNameAndWorkspaceId(datasourceStorage.getName(), workspace.getId(), Optional.empty()) + .flatMap(duplicateNameDatasource -> + getUniqueSuffixForDuplicateNameEntity(duplicateNameDatasource, workspace.getId())) + .map(dsName -> { + datasourceStorage.setName(datasourceStorage.getName() + dsName); + return datasourceService.createDatasourceFromDatasourceStorage(datasourceStorage); + }) + .switchIfEmpty(Mono.just( + datasourceService.createDatasourceFromDatasourceStorage(datasourceStorage))) + .flatMap(datasourceService::createWithoutPermissions); + })) + .onErrorResume(throwable -> { + log.error("failed to import datasource", throwable); + return Mono.error(throwable); + }); + } + + /** + * Here we will be rehydrating the sensitive fields like password, secrets etc. in datasourceStorage while importing the application + * + * @param datasourceStorage for which sensitive fields should be rehydrated + * @param decryptedFields sensitive fields + * @return updated datasourceStorage with rehydrated sensitive fields + */ + private DatasourceStorage updateAuthenticationDTO( + DatasourceStorage datasourceStorage, DecryptedSensitiveFields decryptedFields) { + + final DatasourceConfiguration dsConfig = datasourceStorage.getDatasourceConfiguration(); + String authType = decryptedFields.getAuthType(); + if (dsConfig == null || authType == null) { + return datasourceStorage; + } + + if (StringUtils.equals(authType, DBAuth.class.getName())) { + final DBAuth dbAuth = decryptedFields.getDbAuth(); + dbAuth.setPassword(decryptedFields.getPassword()); + datasourceStorage.getDatasourceConfiguration().setAuthentication(dbAuth); + } else if (StringUtils.equals(authType, BasicAuth.class.getName())) { + final BasicAuth basicAuth = decryptedFields.getBasicAuth(); + basicAuth.setPassword(decryptedFields.getPassword()); + datasourceStorage.getDatasourceConfiguration().setAuthentication(basicAuth); + } else if (StringUtils.equals(authType, OAuth2.class.getName())) { + OAuth2 auth2 = decryptedFields.getOpenAuth2(); + AuthenticationResponse authResponse = new AuthenticationResponse(); + auth2.setClientSecret(decryptedFields.getPassword()); + authResponse.setToken(decryptedFields.getToken()); + authResponse.setRefreshToken(decryptedFields.getRefreshToken()); + authResponse.setTokenResponse(decryptedFields.getTokenResponse()); + authResponse.setExpiresAt(Instant.now()); + auth2.setAuthenticationResponse(authResponse); + datasourceStorage.getDatasourceConfiguration().setAuthentication(auth2); + } else if (StringUtils.equals(authType, BearerTokenAuth.class.getName())) { + BearerTokenAuth auth = new BearerTokenAuth(); + auth.setBearerToken(decryptedFields.getBearerTokenAuth().getBearerToken()); + datasourceStorage.getDatasourceConfiguration().setAuthentication(auth); + } + return datasourceStorage; + } + + /** + * This function will respond with unique suffixed number for the entity to avoid duplicate names + * + * @param sourceEntity for which the suffixed number is required to avoid duplication + * @param workspaceId workspace in which entity should be searched + * @return next possible number in case of duplication + */ + private Mono<String> getUniqueSuffixForDuplicateNameEntity(BaseDomain sourceEntity, String workspaceId) { + if (sourceEntity != null) { + return sequenceService + .getNextAsSuffix(sourceEntity.getClass(), " for workspace with _id : " + workspaceId) + .map(sequenceNumber -> { + // sequence number will be empty if no duplicate is found + return sequenceNumber.isEmpty() ? " #1" : " #" + sequenceNumber.trim(); + }); + } + return Mono.just(""); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/imports/DatasourceImportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/imports/DatasourceImportableServiceImpl.java new file mode 100644 index 000000000000..b96958b42ad5 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/imports/DatasourceImportableServiceImpl.java @@ -0,0 +1,18 @@ +package com.appsmith.server.datasources.imports; + +import com.appsmith.external.models.Datasource; +import com.appsmith.server.datasources.base.DatasourceService; +import com.appsmith.server.imports.importable.ImportableService; +import com.appsmith.server.services.SequenceService; +import com.appsmith.server.services.WorkspaceService; +import org.springframework.stereotype.Service; + +@Service +public class DatasourceImportableServiceImpl extends DatasourceImportableServiceCEImpl + implements ImportableService<Datasource> { + + public DatasourceImportableServiceImpl( + DatasourceService datasourceService, WorkspaceService workspaceService, SequenceService sequenceService) { + super(datasourceService, workspaceService, sequenceService); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ImportingMetaDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ImportingMetaDTO.java new file mode 100644 index 000000000000..81b26948797d --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ImportingMetaDTO.java @@ -0,0 +1,19 @@ +package com.appsmith.server.dtos; + +import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder(toBuilder = true) +public class ImportingMetaDTO { + String workspaceId; + String applicationId; + String branchName; + Boolean appendToApp; + ImportApplicationPermissionProvider permissionProvider; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/MappedImportableResourcesDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/MappedImportableResourcesDTO.java new file mode 100644 index 000000000000..f504eb846c01 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/MappedImportableResourcesDTO.java @@ -0,0 +1,5 @@ +package com.appsmith.server.dtos; + +import com.appsmith.server.dtos.ce.MappedImportableResourcesCE_DTO; + +public class MappedImportableResourcesDTO extends MappedImportableResourcesCE_DTO {} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ce/MappedImportableResourcesCE_DTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ce/MappedImportableResourcesCE_DTO.java new file mode 100644 index 000000000000..fe81e0522b1c --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ce/MappedImportableResourcesCE_DTO.java @@ -0,0 +1,25 @@ +package com.appsmith.server.dtos.ce; + +import com.appsmith.server.domains.NewPage; +import com.appsmith.server.dtos.CustomJSLibApplicationDTO; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@NoArgsConstructor +@Data +public class MappedImportableResourcesCE_DTO { + + Map<String, String> pluginMap = new HashMap<>(); + Map<String, String> datasourceNameToIdMap = new HashMap<>(); + + List<CustomJSLibApplicationDTO> installedJsLibsList; + Map<String, String> newPageNameToOldPageNameMap; + Map<String, NewPage> pageNameMap; + ImportActionResultDTO actionResultDTO; + ImportActionCollectionResultDTO actionCollectionResultDTO; + ImportedActionAndCollectionMapsDTO actionAndCollectionMapsDTO = new ImportedActionAndCollectionMapsDTO(); +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportApplicationServiceCEImpl.java index a428c443c8b0..faf47a905d19 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportApplicationServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportApplicationServiceCEImpl.java @@ -22,7 +22,6 @@ import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.exports.exportable.ExportableService; -import com.appsmith.server.exports.exportable.ExportableServiceCE; import com.appsmith.server.migrations.JsonSchemaVersions; import com.appsmith.server.services.AnalyticsService; import com.appsmith.server.services.ApplicationService; @@ -41,7 +40,6 @@ import java.time.Instant; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.stream.Collectors; import static java.lang.Boolean.TRUE; @@ -61,7 +59,7 @@ public class ExportApplicationServiceCEImpl implements ExportApplicationServiceC private final ExportableService<NewPage> newPageExportableService; private final ExportableService<NewAction> newActionExportableService; private final ExportableService<ActionCollection> actionCollectionExportableService; - private final ExportableServiceCE<Theme> themeExportableService; + private final ExportableService<Theme> themeExportableService; private final ExportableService<CustomJSLib> customJSLibExportableService; /** @@ -195,8 +193,8 @@ public Mono<ApplicationJson> exportApplicationById( AnalyticsEvents.UNIT_EXECUTION_TIME.getEventName(), user.getUsername(), data); return applicationJson; }) - // TODO : Why are we sending two sets of events here? -- Ask Git team - .then(sendImportExportApplicationAnalyticsEvent(applicationId, AnalyticsEvents.EXPORT)) + .then(applicationMono) + .map(application -> sendImportExportApplicationAnalyticsEvent(application, AnalyticsEvents.EXPORT)) .thenReturn(applicationJson); } @@ -247,17 +245,4 @@ private Mono<Application> sendImportExportApplicationAnalyticsEvent( return analyticsService.sendObjectEvent(event, application, data); }); } - - /** - * To send analytics event for import and export of application - * - * @param applicationId id of application being imported or exported - * @param event analyticsEvents event - * @return The application which is imported or exported - */ - private Mono<Application> sendImportExportApplicationAnalyticsEvent(String applicationId, AnalyticsEvents event) { - return applicationService - .findById(applicationId, Optional.empty()) - .flatMap(application -> sendImportExportApplicationAnalyticsEvent(application, event)); - } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportApplicationServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportApplicationServiceImpl.java index ee0d6cd10239..0e9d22c8b774 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportApplicationServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/exports/internal/ExportApplicationServiceImpl.java @@ -8,7 +8,6 @@ import com.appsmith.server.domains.Plugin; import com.appsmith.server.domains.Theme; import com.appsmith.server.exports.exportable.ExportableService; -import com.appsmith.server.exports.exportable.ExportableServiceCE; import com.appsmith.server.services.AnalyticsService; import com.appsmith.server.services.ApplicationService; import com.appsmith.server.services.SessionUserService; @@ -34,7 +33,7 @@ public ExportApplicationServiceImpl( ExportableService<NewPage> newPageExportableService, ExportableService<NewAction> newActionExportableService, ExportableService<ActionCollection> actionCollectionExportableService, - ExportableServiceCE<Theme> themeExportableService, + ExportableService<Theme> themeExportableService, ExportableService<CustomJSLib> customJSLibExportableService) { super( sessionUserService, diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/importable/ImportableServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/importable/ImportableServiceCE.java index 502df59444c3..644093ece768 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/importable/ImportableServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/importable/ImportableServiceCE.java @@ -1,5 +1,28 @@ package com.appsmith.server.imports.importable; import com.appsmith.external.models.BaseDomain; +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import reactor.core.publisher.Mono; -public interface ImportableServiceCE<T extends BaseDomain> {} +import java.util.List; + +public interface ImportableServiceCE<T extends BaseDomain> { + + Mono<List<T>> importEntities( + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<Workspace> workspaceMono, + Mono<Application> applicationMono, + ApplicationJson applicationJson); + + default Mono<Void> updateImportedEntities( + Application application, + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + return null; + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceCEImpl.java index 1de6ffcb7b2e..cbd0e22adb22 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceCEImpl.java @@ -2,23 +2,9 @@ import com.appsmith.external.constants.AnalyticsEvents; import com.appsmith.external.helpers.Stopwatch; -import com.appsmith.external.models.AuthenticationResponse; -import com.appsmith.external.models.BaseDomain; -import com.appsmith.external.models.BasicAuth; -import com.appsmith.external.models.BearerTokenAuth; -import com.appsmith.external.models.DBAuth; import com.appsmith.external.models.Datasource; -import com.appsmith.external.models.DatasourceConfiguration; -import com.appsmith.external.models.DatasourceStorage; import com.appsmith.external.models.DatasourceStorageDTO; -import com.appsmith.external.models.DecryptedSensitiveFields; -import com.appsmith.external.models.DefaultResources; -import com.appsmith.external.models.OAuth2; -import com.appsmith.external.models.Policy; -import com.appsmith.server.actioncollections.base.ActionCollectionService; -import com.appsmith.server.constants.ApplicationConstants; import com.appsmith.server.constants.FieldName; -import com.appsmith.server.constants.ResourceModes; import com.appsmith.server.datasources.base.DatasourceService; import com.appsmith.server.domains.ActionCollection; import com.appsmith.server.domains.Application; @@ -26,31 +12,26 @@ import com.appsmith.server.domains.CustomJSLib; import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; +import com.appsmith.server.domains.Plugin; +import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ApplicationImportDTO; import com.appsmith.server.dtos.ApplicationJson; -import com.appsmith.server.dtos.CustomJSLibApplicationDTO; -import com.appsmith.server.dtos.ce.ImportActionCollectionResultDTO; -import com.appsmith.server.dtos.ce.ImportActionResultDTO; -import com.appsmith.server.dtos.ce.ImportedActionAndCollectionMapsDTO; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; -import com.appsmith.server.helpers.DefaultResourcesUtils; import com.appsmith.server.helpers.ImportExportUtils; -import com.appsmith.server.helpers.TextUtils; import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; -import com.appsmith.server.jslibs.base.CustomJSLibService; +import com.appsmith.server.imports.importable.ImportableService; import com.appsmith.server.migrations.ApplicationVersion; import com.appsmith.server.migrations.JsonSchemaMigration; import com.appsmith.server.newactions.base.NewActionService; -import com.appsmith.server.newpages.base.NewPageService; import com.appsmith.server.repositories.PermissionGroupRepository; -import com.appsmith.server.repositories.PluginRepository; import com.appsmith.server.services.AnalyticsService; import com.appsmith.server.services.ApplicationPageService; import com.appsmith.server.services.ApplicationService; -import com.appsmith.server.services.SequenceService; import com.appsmith.server.services.SessionUserService; import com.appsmith.server.services.WorkspaceService; import com.appsmith.server.solutions.ActionPermission; @@ -58,39 +39,28 @@ import com.appsmith.server.solutions.DatasourcePermission; import com.appsmith.server.solutions.PagePermission; import com.appsmith.server.solutions.WorkspacePermission; -import com.appsmith.server.themes.base.ThemeService; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.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 org.springframework.transaction.reactive.TransactionalOperator; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.util.function.Tuple2; -import reactor.util.function.Tuples; import java.lang.reflect.Type; -import java.time.Instant; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; -import static com.appsmith.server.constants.ResourceModes.EDIT; -import static com.appsmith.server.constants.ResourceModes.VIEW; import static com.appsmith.server.helpers.ImportExportUtils.setPropertiesToExistingApplication; import static com.appsmith.server.helpers.ImportExportUtils.setPublishedApplicationProperties; @@ -98,19 +68,15 @@ @RequiredArgsConstructor public class ImportApplicationServiceCEImpl implements ImportApplicationServiceCE { + private static final Set<MediaType> ALLOWED_CONTENT_TYPES = Set.of(MediaType.APPLICATION_JSON); + private static final String INVALID_JSON_FILE = "invalid json file"; private final DatasourceService datasourceService; private final SessionUserService sessionUserService; - private final PluginRepository pluginRepository; private final WorkspaceService workspaceService; private final ApplicationService applicationService; - private final NewPageService newPageService; private final ApplicationPageService applicationPageService; private final NewActionService newActionService; - private final SequenceService sequenceService; - private final ActionCollectionService actionCollectionService; - private final ThemeService themeService; private final AnalyticsService analyticsService; - private final CustomJSLibService customJSLibService; private final DatasourcePermission datasourcePermission; private final WorkspacePermission workspacePermission; private final ApplicationPermission applicationPermission; @@ -119,9 +85,13 @@ public class ImportApplicationServiceCEImpl implements ImportApplicationServiceC private final Gson gson; private final TransactionalOperator transactionalOperator; private final PermissionGroupRepository permissionGroupRepository; - - private static final Set<MediaType> ALLOWED_CONTENT_TYPES = Set.of(MediaType.APPLICATION_JSON); - private static final String INVALID_JSON_FILE = "invalid json file"; + private final ImportableService<Plugin> pluginImportableService; + private final ImportableService<Theme> themeImportableService; + private final ImportableService<NewPage> newPageImportableService; + private final ImportableService<CustomJSLib> customJSLibImportableService; + private final ImportableService<Datasource> datasourceImportableService; + private final ImportableService<NewAction> newActionImportableService; + private final ImportableService<ActionCollection> actionCollectionImportableService; @Override public Mono<ApplicationImportDTO> extractFileAndSaveApplication(String workspaceId, Part filePart) { @@ -380,146 +350,11 @@ private String validateApplicationJson(ApplicationJson importedDoc) { return errorField; } - private Mono<Map<String, String>> importDatasources( - ApplicationJson importedDoc, - Mono<List<Datasource>> existingDatasourceMono, - Flux<Datasource> existingDatasourcesFlux, - Workspace workspace, - Mono<Map<String, String>> pluginMapMno, - ImportApplicationPermissionProvider permissionProvider) { - return Mono.zip( - existingDatasourceMono, - workspaceService.getDefaultEnvironmentId(workspace.getId(), null), - pluginMapMno) - .flatMapMany(objects -> { - List<Datasource> existingDatasources = objects.getT1(); - String environmentId = objects.getT2(); - Map<String, String> pluginMap = objects.getT3(); - List<DatasourceStorage> importedDatasourceList = importedDoc.getDatasourceList(); - if (CollectionUtils.isEmpty(importedDatasourceList)) { - return Flux.empty(); - } - Map<String, Datasource> savedDatasourcesGitIdToDatasourceMap = new HashMap<>(); - Map<String, Datasource> savedDatasourcesNameDatasourceMap = new HashMap<>(); - - existingDatasources.stream() - .filter(datasource -> datasource.getGitSyncId() != null) - .forEach(datasource -> { - savedDatasourcesGitIdToDatasourceMap.put(datasource.getGitSyncId(), datasource); - savedDatasourcesNameDatasourceMap.put(datasource.getName(), datasource); - }); - - // Check if the destination org have all the required plugins installed - for (DatasourceStorage datasource : importedDatasourceList) { - if (StringUtils.isEmpty(pluginMap.get(datasource.getPluginId()))) { - log.error( - "Unable to find the plugin: {}, available plugins are: {}", - datasource.getPluginId(), - pluginMap.keySet()); - return Flux.error(new AppsmithException( - AppsmithError.UNKNOWN_PLUGIN_REFERENCE, datasource.getPluginId())); - } - } - - return Flux.fromIterable(importedDatasourceList) - // Check for duplicate datasources to avoid duplicates in target workspace - .flatMap(datasourceStorage -> { - final String importedDatasourceName = datasourceStorage.getName(); - // try to find whether there is an existing datasource with same gitSyncId - Datasource existingDatasource = null; - if (datasourceStorage.getGitSyncId() != null - && savedDatasourcesGitIdToDatasourceMap.containsKey( - datasourceStorage.getGitSyncId())) { - Datasource dsWithSameGitsyncId = savedDatasourcesGitIdToDatasourceMap.get( - datasourceStorage.getGitSyncId()); // found a match - // we'll be renaming the matchingDatasource with targetDatasourceName - String targetDatasourceName = datasourceStorage.getName(); - - // check whether there are any other datasource with the same targetDatasourceName - if (savedDatasourcesNameDatasourceMap.containsKey(targetDatasourceName)) { - // found with same name, check if it's matchingDatasource or not - Datasource dsWithSameName = - savedDatasourcesNameDatasourceMap.get(targetDatasourceName); - if (dsWithSameName.getId().equals(dsWithSameGitsyncId.getId())) { - // same DS, we can rename safely - existingDatasource = dsWithSameGitsyncId; - } // otherwise existingDatasource will be null - } else { // no DS found with the targetDatasourceName, we can rename safely - existingDatasource = dsWithSameGitsyncId; - } - } - // Check if the datasource has gitSyncId and if it's already in DB - if (existingDatasource != null) { - // Since the resource is already present in DB, just update resource - if (!permissionProvider.hasEditPermission(existingDatasource)) { - log.error( - "Trying to update datasource {} without edit permission", - existingDatasource.getName()); - return Mono.error(new AppsmithException( - AppsmithError.ACL_NO_RESOURCE_FOUND, - FieldName.DATASOURCE, - existingDatasource.getId())); - } - datasourceStorage.setId(null); - // Don't update datasource config as the saved datasource is already configured by - // user - // for this instance - datasourceStorage.setDatasourceConfiguration(null); - datasourceStorage.setPluginId(null); - datasourceStorage.setEnvironmentId(environmentId); - Datasource newDatasource = - datasourceService.createDatasourceFromDatasourceStorage(datasourceStorage); - newDatasource.setPolicies(null); - - copyNestedNonNullProperties(newDatasource, existingDatasource); - // Don't update the datasource configuration for already available datasources - existingDatasource.setDatasourceConfiguration(null); - return datasourceService.save(existingDatasource); - } else { - // This is explicitly copied over from the map we created before - datasourceStorage.setPluginId(pluginMap.get(datasourceStorage.getPluginId())); - datasourceStorage.setWorkspaceId(workspace.getId()); - datasourceStorage.setEnvironmentId(environmentId); - - // Check if any decrypted fields are present for datasource - if (importedDoc.getDecryptedFields() != null - && importedDoc.getDecryptedFields().get(datasourceStorage.getName()) - != null) { - - DecryptedSensitiveFields decryptedFields = - importedDoc.getDecryptedFields().get(datasourceStorage.getName()); - - updateAuthenticationDTO(datasourceStorage, decryptedFields); - } - return createUniqueDatasourceIfNotPresent( - existingDatasourcesFlux, - datasourceStorage, - workspace, - environmentId, - permissionProvider); - } - }); - }) - .collectMap(Datasource::getName, Datasource::getId) - .onErrorResume(error -> { - log.error("Error importing datasources", error); - return Mono.error(error); - }) - .elapsed() - .map(tuple -> { - log.debug("Time taken to import datasources: {} ms", tuple.getT1()); - return tuple.getT2(); - }); - } - private Mono<Application> getImportApplicationMono( Application importedApplication, - String applicationId, - boolean appendToApp, - String workspaceId, - ImportApplicationPermissionProvider permissionProvider, - Mono<User> currUserMono, - Mono<List<CustomJSLibApplicationDTO>> installedJsLibsMono) { + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<User> currUserMono) { Mono<Application> importApplicationMono = Mono.just(importedApplication) .map(application -> { if (application.getApplicationVersion() == null) { @@ -528,18 +363,16 @@ private Mono<Application> getImportApplicationMono( application.setViewMode(false); application.setForkWithConfiguration(null); application.setExportWithConfiguration(null); - application.setWorkspaceId(workspaceId); + application.setWorkspaceId(importingMetaDTO.getWorkspaceId()); application.setIsPublic(null); application.setPolicies(null); application.setPages(null); application.setPublishedPages(null); return application; }) - .zipWith(installedJsLibsMono) - .map(tuple -> { - Application application = tuple.getT1(); - List<CustomJSLibApplicationDTO> customJSLibApplicationDTOList = tuple.getT2(); - application.setUnpublishedCustomJSLibs(new HashSet<>(customJSLibApplicationDTOList)); + .map(application -> { + application.setUnpublishedCustomJSLibs( + new HashSet<>(mappedImportableResourcesDTO.getInstalledJsLibsList())); return application; }); @@ -549,25 +382,29 @@ private Mono<Application> getImportApplicationMono( return application; }); - if (StringUtils.isEmpty(applicationId)) { + if (StringUtils.isEmpty(importingMetaDTO.getApplicationId())) { importApplicationMono = importApplicationMono.flatMap(application -> { return applicationPageService.createOrUpdateSuffixedApplication(application, application.getName(), 0); }); } else { Mono<Application> existingApplicationMono = applicationService - .findById(applicationId, permissionProvider.getRequiredPermissionOnTargetApplication()) + .findById( + importingMetaDTO.getApplicationId(), + importingMetaDTO.getPermissionProvider().getRequiredPermissionOnTargetApplication()) .switchIfEmpty(Mono.defer(() -> { log.error( "No application found with id: {} and permission: {}", - applicationId, - permissionProvider.getRequiredPermissionOnTargetApplication()); + importingMetaDTO.getApplicationId(), + importingMetaDTO.getPermissionProvider().getRequiredPermissionOnTargetApplication()); return Mono.error(new AppsmithException( - AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.APPLICATION, applicationId)); + AppsmithError.ACL_NO_RESOURCE_FOUND, + FieldName.APPLICATION, + importingMetaDTO.getApplicationId())); })) .cache(); // this can be a git sync, import page from template, update app with json, restore snapshot - if (appendToApp) { // we don't need to do anything with the imported application + if (importingMetaDTO.getAppendToApp()) { // we don't need to do anything with the imported application importApplicationMono = existingApplicationMono; } else { importApplicationMono = importApplicationMono @@ -623,628 +460,6 @@ private Mono<Application> getImportApplicationMono( }); } - private Mono<Map<String, String>> getPluginMapMono() { - return pluginRepository - .findAll() - .collectList() - .map(plugins -> { - Map<String, String> pluginMap = new HashMap<>(); - plugins.forEach(plugin -> { - final String pluginReference = StringUtils.isEmpty(plugin.getPluginName()) - ? plugin.getPackageName() - : plugin.getPluginName(); - pluginMap.put(pluginReference, plugin.getId()); - }); - return pluginMap; - }) - .elapsed() - .map(tuples -> { - log.debug("time to get plugin map: {}", tuples.getT1()); - return tuples.getT2(); - }); - } - - private Mono<Map<String, NewPage>> getPageNameMapMono( - Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono) { - return importedNewPagesMono.map(objects -> { - Map<String, NewPage> pageNameMap = new HashMap<>(); - objects.getT1().forEach(newPage -> { - // Save the map of pageName and NewPage - if (newPage.getUnpublishedPage() != null - && newPage.getUnpublishedPage().getName() != null) { - pageNameMap.put(newPage.getUnpublishedPage().getName(), newPage); - } - if (newPage.getPublishedPage() != null - && newPage.getPublishedPage().getName() != null) { - pageNameMap.put(newPage.getPublishedPage().getName(), newPage); - } - }); - return pageNameMap; - }); - } - - private Mono<Tuple2<ImportedActionAndCollectionMapsDTO, ImportActionResultDTO>> setCollectionIdToActionsMono( - Mono<ImportActionResultDTO> importActionsMono, - Mono<ImportActionCollectionResultDTO> importActionCollectionMono, - Mono<Application> importApplicationMono, - String applicationId, - boolean appendToApp) { - return Mono.zip(importActionsMono, importActionCollectionMono, importApplicationMono) - .flatMap(objects -> { - ImportActionResultDTO importActionResultDTO = objects.getT1(); - ImportActionCollectionResultDTO importActionCollectionResultDTO = objects.getT2(); - Application importedApplication1 = objects.getT3(); - - List<String> savedCollectionIds = importActionCollectionResultDTO.getSavedActionCollectionIds(); - log.info( - "Action collections imported. applicationId {}, result: {}", - importedApplication1.getId(), - importActionCollectionResultDTO.getGist()); - return newActionService - .updateActionsWithImportedCollectionIds( - importActionCollectionResultDTO, importActionResultDTO) - .flatMap(actionAndCollectionMapsDTO -> { - log.info( - "Updated actions with imported collection ids. applicationId {}", - importedApplication1.getId()); - // Updating the existing application for git-sync - // During partial import/appending to the existing application keep the resources - // attached to the application: - // Delete the invalid resources (which are not the part of applicationJsonDTO) in - // the git flow only - if (!StringUtils.isEmpty(applicationId) && !appendToApp) { - // Remove unwanted action collections - Set<String> invalidCollectionIds = new HashSet<>(); - for (ActionCollection collection : - importActionCollectionResultDTO.getExistingActionCollections()) { - if (!savedCollectionIds.contains(collection.getId())) { - invalidCollectionIds.add(collection.getId()); - } - } - log.info( - "Deleting {} action collections which are no more used", - invalidCollectionIds.size()); - return Flux.fromIterable(invalidCollectionIds) - .flatMap(collectionId -> actionCollectionService - .deleteWithoutPermissionUnpublishedActionCollection(collectionId) - // return an empty collection so that the filter can remove it from - // the list - .onErrorResume(throwable -> { - log.debug( - "Failed to delete collection with id {} during import", - collectionId); - log.error(throwable.getMessage()); - return Mono.empty(); - })) - .then() - .thenReturn(actionAndCollectionMapsDTO); - } - return Mono.just(actionAndCollectionMapsDTO); - }) - .zipWith(Mono.just(importActionResultDTO)); - }) - .onErrorResume(error -> { - log.error("Error while updating collection id to actions", error); - return Mono.error(error); - }); - } - - private Mono<List<NewPage>> setActionIdInPages( - Mono<Tuple2<ImportedActionAndCollectionMapsDTO, ImportActionResultDTO>> updateCollectionIdToActionsMono, - Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono, - String branchName) { - return Mono.zip(updateCollectionIdToActionsMono, importedNewPagesMono) - .flatMap(objects -> { - ImportedActionAndCollectionMapsDTO actionAndCollectionMapsDTO = - objects.getT1().getT1(); - ImportActionResultDTO importActionResultDTO = - objects.getT1().getT2(); - List<NewPage> newPages = objects.getT2().getT1(); - return Flux.fromIterable(newPages) - .flatMap(newPage -> { - if (newPage.getDefaultResources() != null) { - newPage.getDefaultResources().setBranchName(branchName); - } - return mapActionAndCollectionIdWithPageLayout( - newPage, - importActionResultDTO.getActionIdMap(), - actionAndCollectionMapsDTO.getUnpublishedActionIdToCollectionIdMap(), - actionAndCollectionMapsDTO.getPublishedActionIdToCollectionIdMap()); - }) - .collectList() - .flatMapMany(newPageService::saveAll) - .collectList(); - }) - .onErrorResume(throwable -> { - log.error("Failed to set action ids in pages", throwable); - return Mono.error(throwable); - }); - } - - private Mono<ImportActionCollectionResultDTO> createImportActionCollectionMono( - List<ActionCollection> importedActionCollectionList, - Mono<Application> importApplicationMono, - Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono, - Mono<ImportActionResultDTO> importActionsMono, - Mono<Map<String, String>> pluginMapMno, - Mono<Map<String, NewPage>> pageNameMapMono, - ImportApplicationPermissionProvider permissionProvider, - boolean appendToApp, - String branchName) { - Mono<List<ActionCollection>> importedActionCollectionMono = Mono.just(importedActionCollectionList); - - if (appendToApp) { - importedActionCollectionMono = importedActionCollectionMono - .zipWith(importedNewPagesMono) - .map(objects -> { - List<ActionCollection> importedActionCollectionList1 = objects.getT1(); - List<NewPage> importedNewPages = objects.getT2().getT1(); - Map<String, String> newToOldNameMap = objects.getT2().getT2(); - - for (NewPage newPage : importedNewPages) { - String newPageName = newPage.getUnpublishedPage().getName(); - String oldPageName = newToOldNameMap.get(newPageName); - - if (!newPageName.equals(oldPageName)) { - renamePageInActionCollections(importedActionCollectionList1, oldPageName, newPageName); - } - } - return importedActionCollectionList1; - }); - } - - return Mono.zip( - importActionsMono, - importApplicationMono, - importedActionCollectionMono, - pluginMapMno, - pageNameMapMono) - .flatMap(objects -> { - log.info("Importing action collections"); - return actionCollectionService.importActionCollections( - objects.getT1(), - objects.getT2(), - branchName, - objects.getT3(), - objects.getT4(), - objects.getT5(), - permissionProvider); - }) - .onErrorResume(throwable -> { - log.error("Error importing action collections", throwable); - return Mono.error(throwable); - }); - } - - Mono<ImportActionResultDTO> getImportActionsMono( - ApplicationJson importedDoc, - Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono, - Mono<Application> importApplicationMono, - Mono<Map<String, NewPage>> pageNameMapMono, - Mono<Map<String, String>> pluginMapMno, - boolean appendToApp, - Workspace workspace, - String applicationId, - String branchName, - ImportApplicationPermissionProvider permissionProvider) { - List<NewAction> importedNewActionList = importedDoc.getActionList(); - - final Flux<Datasource> existingDatasourceFlux = datasourceService - .getAllByWorkspaceIdWithStorages(workspace.getId(), Optional.empty()) - .cache(); - - Mono<List<Datasource>> existingDatasourceMono = - getExistingDatasourceMono(applicationId, existingDatasourceFlux); - Mono<Map<String, String>> datasourceMapMono = importDatasources( - importedDoc, - existingDatasourceMono, - existingDatasourceFlux, - workspace, - pluginMapMno, - permissionProvider); - - Mono<List<NewAction>> importedNewActionMono = Mono.just(importedNewActionList); - if (appendToApp) { - importedNewActionMono = importedNewActionMono - .zipWith(importedNewPagesMono) - .map(objects -> { - List<NewAction> importedNewActionList1 = objects.getT1(); - List<NewPage> importedNewPages = objects.getT2().getT1(); - Map<String, String> newToOldNameMap = objects.getT2().getT2(); - - for (NewPage newPage : importedNewPages) { - String newPageName = newPage.getUnpublishedPage().getName(); - String oldPageName = newToOldNameMap.get(newPageName); - - if (!newPageName.equals(oldPageName)) { - renamePageInActions(importedNewActionList1, oldPageName, newPageName); - } - } - return importedNewActionList1; - }); - } - - return Mono.zip(importedNewActionMono, importApplicationMono, pageNameMapMono, pluginMapMno, datasourceMapMono) - .flatMap(objects -> newActionService.importActions( - objects.getT1(), - objects.getT2(), - branchName, - objects.getT3(), - objects.getT4(), - objects.getT5(), - permissionProvider)) - .flatMap(importActionResultDTO -> { - log.info("Actions imported. result: {}", importActionResultDTO.getGist()); - // Updating the existing application for git-sync - // During partial import/appending to the existing application keep the resources - // attached to the application: - // Delete the invalid resources (which are not the part of applicationJsonDTO) in - // the git flow only - if (!StringUtils.isEmpty(applicationId) - && !appendToApp - && CollectionUtils.isNotEmpty(importActionResultDTO.getExistingActions())) { - // Remove unwanted actions - Set<String> invalidActionIds = new HashSet<>(); - for (NewAction action : importActionResultDTO.getExistingActions()) { - if (!importActionResultDTO.getImportedActionIds().contains(action.getId())) { - invalidActionIds.add(action.getId()); - } - } - log.info("Deleting {} actions which are no more used", invalidActionIds.size()); - return Flux.fromIterable(invalidActionIds) - .flatMap(actionId -> newActionService - .deleteUnpublishedAction(actionId) - // return an empty action so that the filter can remove it from the list - .onErrorResume(throwable -> { - log.debug("Failed to delete action with id {} during import", actionId); - log.error(throwable.getMessage()); - return Mono.empty(); - })) - .then() - .thenReturn(importActionResultDTO); - } - return Mono.just(importActionResultDTO); - }) - .onErrorResume(throwable -> { - log.error("Error while importing actions and deleting unused ones", throwable); - return Mono.error(throwable); - }); - } - - private Mono<List<ApplicationPage>> importUnpublishedPages( - List<ApplicationPage> editModeApplicationPages, - boolean appendToApp, - Mono<Application> importApplicationMono, - Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono) { - Mono<List<ApplicationPage>> unpublishedPagesMono = Mono.just(editModeApplicationPages); - if (appendToApp) { - unpublishedPagesMono = unpublishedPagesMono - .zipWith(importApplicationMono) - .map(objects -> { - Application application = objects.getT2(); - List<ApplicationPage> applicationPages = objects.getT1(); - applicationPages.addAll(application.getPages()); - return applicationPages; - }) - .zipWith(importedNewPagesMono) - .map(objects -> { - List<ApplicationPage> unpublishedPages = objects.getT1(); - Map<String, String> newToOldNameMap = objects.getT2().getT2(); - List<NewPage> importedPages = objects.getT2().getT1(); - for (NewPage newPage : importedPages) { - // we need to map the newly created page with old name - // because other related resources e.g. actions will refer the page with old name - String newPageName = newPage.getUnpublishedPage().getName(); - if (newToOldNameMap.containsKey(newPageName)) { - String oldPageName = newToOldNameMap.get(newPageName); - unpublishedPages.stream() - .filter(applicationPage -> oldPageName.equals(applicationPage.getId())) - .findAny() - .ifPresent(applicationPage -> applicationPage.setId(newPageName)); - } - } - return unpublishedPages; - }); - } - return unpublishedPagesMono; - } - - private Mono<Tuple2<List<NewPage>, Map<String, String>>> getImportNewPagesMono( - List<NewPage> importedNewPageList, - Mono<List<NewPage>> existingPagesMono, - Mono<Application> importApplicationMono, - boolean appendToApp, - String branchName, - ImportApplicationPermissionProvider permissionProvider) { - return Mono.just(importedNewPageList) - .zipWith(existingPagesMono) - .map(objects -> { - List<NewPage> importedNewPages = objects.getT1(); - List<NewPage> existingPages = objects.getT2(); - Map<String, String> newToOldNameMap; - if (appendToApp) { - newToOldNameMap = updateNewPagesBeforeMerge(existingPages, importedNewPages); - } else { - newToOldNameMap = Map.of(); - } - return Tuples.of(importedNewPages, newToOldNameMap); - }) - .zipWith(importApplicationMono) - .flatMap(objects -> { - List<NewPage> importedNewPages = objects.getT1().getT1(); - Map<String, String> newToOldNameMap = objects.getT1().getT2(); - Application application = objects.getT2(); - return importAndSavePages( - importedNewPages, application, branchName, existingPagesMono, permissionProvider) - .collectList() - .zipWith(Mono.just(newToOldNameMap)); - }) - .onErrorResume(throwable -> { - log.error("Error importing pages", throwable); - return Mono.error(throwable); - }) - .elapsed() - .map(objects -> { - log.debug("time to import {} pages: {}", objects.getT2().size(), objects.getT1()); - return objects.getT2(); - }); - } - - Mono<Application> savePagesToApplicationMono( - Application importedApplication, - Mono<Map<String, NewPage>> pageNameMapMono, - Mono<Application> applicationMono, - boolean appendToApp, - String applicationId, - Mono<List<NewPage>> existingPagesMono, - Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono) { - - List<ApplicationPage> editModeApplicationPages = importedApplication.getPages(); - List<ApplicationPage> publishedModeApplicationPages = importedApplication.getPublishedPages(); - - Mono<List<ApplicationPage>> unpublishedPagesMono = - importUnpublishedPages(editModeApplicationPages, appendToApp, applicationMono, importedNewPagesMono); - - Mono<List<ApplicationPage>> publishedPagesMono = Mono.just(publishedModeApplicationPages); - - Mono<Map<ResourceModes, List<ApplicationPage>>> applicationPagesMono = Mono.zip( - unpublishedPagesMono, publishedPagesMono, pageNameMapMono, applicationMono) - .map(objects -> { - List<ApplicationPage> unpublishedPages = objects.getT1(); - List<ApplicationPage> publishedPages = objects.getT2(); - Map<String, NewPage> pageNameMap = objects.getT3(); - Application savedApp = objects.getT4(); - - log.debug("New pages imported for application: {}", savedApp.getId()); - Map<ResourceModes, List<ApplicationPage>> applicationPages = new HashMap<>(); - applicationPages.put(EDIT, unpublishedPages); - applicationPages.put(VIEW, publishedPages); - - Iterator<ApplicationPage> unpublishedPageItr = unpublishedPages.iterator(); - while (unpublishedPageItr.hasNext()) { - ApplicationPage applicationPage = unpublishedPageItr.next(); - NewPage newPage = pageNameMap.get(applicationPage.getId()); - if (newPage == null) { - if (appendToApp) { - // Don't remove the page reference if doing the partial import and appending - // to the existing application - continue; - } - log.debug( - "Unable to find the page during import for appId {}, with name {}", - applicationId, - applicationPage.getId()); - unpublishedPageItr.remove(); - } else { - applicationPage.setId(newPage.getId()); - applicationPage.setDefaultPageId( - newPage.getDefaultResources().getPageId()); - // Keep the existing page as the default one - if (appendToApp) { - applicationPage.setIsDefault(false); - } - } - } - - Iterator<ApplicationPage> publishedPagesItr; - // Remove the newly added pages from merge app flow. Keep only the existing page from the old app - if (appendToApp) { - List<String> existingPagesId = savedApp.getPublishedPages().stream() - .map(applicationPage -> applicationPage.getId()) - .collect(Collectors.toList()); - List<ApplicationPage> publishedApplicationPages = publishedPages.stream() - .filter(applicationPage -> existingPagesId.contains(applicationPage.getId())) - .collect(Collectors.toList()); - applicationPages.replace(VIEW, publishedApplicationPages); - publishedPagesItr = publishedApplicationPages.iterator(); - } else { - publishedPagesItr = publishedPages.iterator(); - } - while (publishedPagesItr.hasNext()) { - ApplicationPage applicationPage = publishedPagesItr.next(); - NewPage newPage = pageNameMap.get(applicationPage.getId()); - if (newPage == null) { - log.debug( - "Unable to find the page during import for appId {}, with name {}", - applicationId, - applicationPage.getId()); - if (!appendToApp) { - publishedPagesItr.remove(); - } - } else { - applicationPage.setId(newPage.getId()); - applicationPage.setDefaultPageId( - newPage.getDefaultResources().getPageId()); - if (appendToApp) { - applicationPage.setIsDefault(false); - } - } - } - - return applicationPages; - }); - - if (!StringUtils.isEmpty(applicationId) && !appendToApp) { - applicationPagesMono = applicationPagesMono - .zipWith(existingPagesMono) - .flatMap(objects -> { - Map<ResourceModes, List<ApplicationPage>> applicationPages = objects.getT1(); - List<NewPage> existingPagesList = objects.getT2(); - Set<String> validPageIds = applicationPages.get(EDIT).stream() - .map(ApplicationPage::getId) - .collect(Collectors.toSet()); - - validPageIds.addAll(applicationPages.get(VIEW).stream() - .map(ApplicationPage::getId) - .collect(Collectors.toSet())); - - Set<String> invalidPageIds = new HashSet<>(); - for (NewPage newPage : existingPagesList) { - if (!validPageIds.contains(newPage.getId())) { - invalidPageIds.add(newPage.getId()); - } - } - - // Delete the pages which were removed during git merge operation - // This does not apply to the traditional import via file approach - return Flux.fromIterable(invalidPageIds) - .flatMap(applicationPageService::deleteWithoutPermissionUnpublishedPage) - .flatMap(page -> newPageService - .archiveWithoutPermissionById(page.getId()) - .onErrorResume(e -> { - log.debug( - "Unable to archive page {} with error {}", - page.getId(), - e.getMessage()); - return Mono.empty(); - })) - .then() - .thenReturn(applicationPages); - }); - } - return applicationMono.zipWith(applicationPagesMono).map(objects -> { - Application application = objects.getT1(); - Map<ResourceModes, List<ApplicationPage>> applicationPages = objects.getT2(); - application.setPages(applicationPages.get(EDIT)); - application.setPublishedPages(applicationPages.get(VIEW)); - return application; - }); - } - - private Mono<List<CustomJSLibApplicationDTO>> getCustomJslibImportMono(List<CustomJSLib> customJSLibs) { - if (customJSLibs == null) { - customJSLibs = new ArrayList<>(); - } - - ensureXmlParserPresenceInCustomJsLibList(customJSLibs); - - return Flux.fromIterable(customJSLibs) - .flatMap(customJSLib -> { - customJSLib.setId(null); - customJSLib.setCreatedAt(null); - customJSLib.setUpdatedAt(null); - return customJSLibService.persistCustomJSLibMetaDataIfDoesNotExistAndGetDTO(customJSLib, false); - }) - .collectList() - .elapsed() - .map(objects -> { - log.debug("time to import custom jslibs: {}", objects.getT1()); - return objects.getT2(); - }) - .onErrorResume(e -> { - log.error("Error importing custom jslibs", e); - return Mono.error(e); - }); - } - - /** - * This method takes customJSLibList from application JSON, checks if an entry for XML parser exists, - * otherwise adds the entry. - * This has been done to add the xmlParser entry in imported application as appsmith is stopping native support - * for xml parser. - * Read More: https://github.com/appsmithorg/appsmith/pull/28012 - * - * @param customJSLibList - */ - public void ensureXmlParserPresenceInCustomJsLibList(List<CustomJSLib> customJSLibList) { - boolean isXmlParserLibFound = false; - for (CustomJSLib customJSLib : customJSLibList) { - if (!customJSLib.getUidString().equals(ApplicationConstants.XML_PARSER_LIBRARY_UID)) { - continue; - } - - isXmlParserLibFound = true; - break; - } - - if (!isXmlParserLibFound) { - CustomJSLib xmlParserJsLib = ApplicationConstants.getDefaultParserCustomJsLibCompatibilityDTO(); - customJSLibList.add(xmlParserJsLib); - } - } - - private Mono<List<Datasource>> getExistingDatasourceMono(String applicationId, Flux<Datasource> datasourceFlux) { - Mono<List<Datasource>> existingDatasourceMono; - // Check if the request is to hydrate the application to DB for particular branch - // Application id will be present for GIT sync - if (!StringUtils.isEmpty(applicationId)) { - // No need to hydrate the datasource as we expect user will configure the datasource - existingDatasourceMono = datasourceFlux.collectList(); - } else { - existingDatasourceMono = Mono.just(new ArrayList<>()); - } - return existingDatasourceMono; - } - - private Mono<List<NewPage>> getImportActionsAndActionCollectionsMono( - ApplicationJson importedDoc, - Mono<Application> applicationMono, - Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono, - Mono<Map<String, String>> pluginMapMno, - Mono<Map<String, NewPage>> pageNameMapMono, - boolean appendToApp, - String branchName, - String applicationId, - Workspace workspace, - ImportApplicationPermissionProvider permissionProvider) { - Mono<ImportActionResultDTO> importActionsMono = getImportActionsMono( - importedDoc, - importedNewPagesMono, - applicationMono, - pageNameMapMono, - pluginMapMno, - appendToApp, - workspace, - applicationId, - branchName, - permissionProvider) - .cache(); - - List<ActionCollection> importedActionCollectionList = - CollectionUtils.isEmpty(importedDoc.getActionCollectionList()) - ? new ArrayList<>() - : importedDoc.getActionCollectionList(); - - Mono<ImportActionCollectionResultDTO> importActionCollectionMono = createImportActionCollectionMono( - importedActionCollectionList, - applicationMono, - importedNewPagesMono, - importActionsMono, - pluginMapMno, - pageNameMapMono, - permissionProvider, - appendToApp, - branchName); - - Mono<Tuple2<ImportedActionAndCollectionMapsDTO, ImportActionResultDTO>> updateCollectionIdToActionsMono = - setCollectionIdToActionsMono( - importActionsMono, importActionCollectionMono, applicationMono, applicationId, appendToApp); - - Mono<List<NewPage>> updateActionsInPages = - setActionIdInPages(updateCollectionIdToActionsMono, importedNewPagesMono, branchName); - return updateActionsInPages; - } - /** * This function will take the application reference object to hydrate the application in mongoDB * @@ -1281,8 +496,12 @@ private Mono<Application> importApplicationInWorkspace( AppsmithError.VALIDATION_FAILURE, "Field '" + errorField + "' is missing in the JSON.")); } + ImportingMetaDTO importingMetaDTO = + new ImportingMetaDTO(workspaceId, applicationId, branchName, appendToApp, permissionProvider); + + MappedImportableResourcesDTO mappedImportableResourcesDTO = new MappedImportableResourcesDTO(); + Application importedApplication = importedDoc.getExportedApplication(); - List<NewPage> importedNewPageList = importedDoc.getPageList(); Mono<Workspace> workspaceMono = workspaceService .findById(workspaceId, permissionProvider.getRequiredPermissionOnTargetWorkspace()) @@ -1293,93 +512,90 @@ private Mono<Application> importApplicationInWorkspace( permissionProvider.getRequiredPermissionOnTargetWorkspace()); return Mono.error(new AppsmithException( AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.WORKSPACE, workspaceId)); - })); + })) + .cache(); Mono<User> currUserMono = sessionUserService.getCurrentUser().cache(); - Mono<List<CustomJSLibApplicationDTO>> installedJsLibsMono = - getCustomJslibImportMono(importedDoc.getCustomJSLibList()); - Mono<Map<String, String>> pluginMapMno = getPluginMapMono().cache(); + Mono<List<CustomJSLib>> installedJsLibsMono = customJSLibImportableService.importEntities( + importingMetaDTO, mappedImportableResourcesDTO, null, null, applicationJson); + Mono<List<Plugin>> installedPluginsMono = pluginImportableService.importEntities( + importingMetaDTO, mappedImportableResourcesDTO, workspaceMono, null, applicationJson); // Start the stopwatch to log the execution time Stopwatch stopwatch = new Stopwatch(AnalyticsEvents.IMPORT.getEventName()); - Mono<Application> importedApplicationMono = workspaceMono - .flatMap(workspace -> { - Mono<Application> applicationMono = getImportApplicationMono( - importedApplication, - applicationId, - appendToApp, - workspaceId, - permissionProvider, - currUserMono, - installedJsLibsMono) - .flatMap(application -> importThemes(application, importedDoc, appendToApp)) - .cache(); - - // Import and save pages, also update the pages related fields in saved application - assert importedNewPageList != null : "Unable to find pages in the imported application"; - - // For git-sync this will not be empty - Mono<List<NewPage>> existingPagesMono = applicationMono - .flatMap(application -> newPageService - .findNewPagesByApplicationId(application.getId(), Optional.empty()) - .collectList()) - .cache(); - - Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono = getImportNewPagesMono( - importedNewPageList, - existingPagesMono, - applicationMono, - appendToApp, - branchName, - permissionProvider) - .cache(); - - Mono<Map<String, NewPage>> pageNameMapMono = - getPageNameMapMono(importedNewPagesMono).cache(); - - applicationMono = savePagesToApplicationMono( - importedApplication, - pageNameMapMono, - applicationMono, - appendToApp, - applicationId, - existingPagesMono, - importedNewPagesMono) - .cache(); - - // this will trigger all the dependent monos - Mono<List<NewPage>> importActionAndActionCollections = getImportActionsAndActionCollectionsMono( - importedDoc, - applicationMono, - importedNewPagesMono, - pluginMapMno, - pageNameMapMono, - appendToApp, - branchName, - applicationId, - workspace, - permissionProvider); + final Mono<Application> importedApplicationMono = installedJsLibsMono + .then(getImportApplicationMono( + importedApplication, importingMetaDTO, mappedImportableResourcesDTO, currUserMono)) + .cache(); - return importActionAndActionCollections - .then(applicationMono) - .flatMap(application -> { - log.info("Imported application with id {}", application.getId()); - // Need to update the application object with updated pages and publishedPages - Application updateApplication = new Application(); - updateApplication.setPages(application.getPages()); - updateApplication.setPublishedPages(application.getPublishedPages()); - return applicationService.update(application.getId(), updateApplication); - }) - .onErrorResume(throwable -> { - String errorMessage = ImportExportUtils.getErrorMessage(throwable); - log.error("Error importing application. Error: {}", errorMessage, throwable); - return Mono.error(new AppsmithException( - AppsmithError.GENERIC_JSON_IMPORT_ERROR, workspaceId, errorMessage)); - }); + Mono<List<Theme>> importedThemesMono = themeImportableService.importEntities( + importingMetaDTO, + mappedImportableResourcesDTO, + workspaceMono, + importedApplicationMono, + applicationJson); + + Mono<List<NewPage>> importedPagesMono = newPageImportableService.importEntities( + importingMetaDTO, + mappedImportableResourcesDTO, + workspaceMono, + importedApplicationMono, + applicationJson); + + Mono<List<Datasource>> importedDatasourcesMono = datasourceImportableService.importEntities( + importingMetaDTO, + mappedImportableResourcesDTO, + workspaceMono, + importedApplicationMono, + applicationJson); + + Mono<List<NewAction>> importedNewActionsMono = newActionImportableService.importEntities( + importingMetaDTO, + mappedImportableResourcesDTO, + workspaceMono, + importedApplicationMono, + applicationJson); + + Mono<List<ActionCollection>> importedActionCollectionsMono = actionCollectionImportableService.importEntities( + importingMetaDTO, + mappedImportableResourcesDTO, + workspaceMono, + importedApplicationMono, + applicationJson); + + Mono<Application> importMono = importedApplicationMono + .then(installedPluginsMono) + .then(importedThemesMono) + .then(importedPagesMono) + .then(importedDatasourcesMono) + .then(importedNewActionsMono) + .then(importedActionCollectionsMono) + .then(importedApplicationMono) + .flatMap(application -> { + return newActionImportableService + .updateImportedEntities(application, importingMetaDTO, mappedImportableResourcesDTO) + .then(newPageImportableService.updateImportedEntities( + application, importingMetaDTO, mappedImportableResourcesDTO)) + .thenReturn(application); + }) + .flatMap(application -> { + log.info("Imported application with id {}", application.getId()); + // Need to update the application object with updated pages and publishedPages + Application updateApplication = new Application(); + updateApplication.setPages(application.getPages()); + updateApplication.setPublishedPages(application.getPublishedPages()); + + return applicationService.update(application.getId(), updateApplication); + }) + .onErrorResume(throwable -> { + String errorMessage = ImportExportUtils.getErrorMessage(throwable); + log.error("Error importing application. Error: {}", errorMessage, throwable); + return Mono.error( + new AppsmithException(AppsmithError.GENERIC_JSON_IMPORT_ERROR, workspaceId, errorMessage)); }) .as(transactionalOperator::transactional); - final Mono<Application> resultMono = importedApplicationMono + final Mono<Application> resultMono = importMono .flatMap(application -> sendImportExportApplicationAnalyticsEvent(application.getId(), AnalyticsEvents.IMPORT)) .zipWith(currUserMono) @@ -1419,440 +635,45 @@ private Mono<Application> importApplicationInWorkspace( // Import Application is currently a slow API because it needs to import and create application, pages, actions // and action collection. This process may take time and the client may cancel the request. This leads to the - // flow - // getting stopped midway producing corrupted objects in DB. The following ensures that even though the client - // may have - // cancelled the flow, the importing the application should proceed uninterrupted and whenever the user - // refreshes - // the page, the imported application is available and is in sane state. + // flow getting stopped midway producing corrupted objects in DB. The following ensures that even though the + // client may have refreshes the page, the imported application is available and is in sane state. // To achieve this, we use a synchronous sink which does not take subscription cancellations into account. This // means that even if the subscriber has cancelled its subscription, the create method still generates its // event. return Mono.create(sink -> resultMono.subscribe(sink::success, sink::error, null, sink.currentContext())); } - private void renamePageInActions(List<NewAction> newActionList, String oldPageName, String newPageName) { - for (NewAction newAction : newActionList) { - if (newAction.getUnpublishedAction().getPageId().equals(oldPageName)) { - newAction.getUnpublishedAction().setPageId(newPageName); - } - } - } - - private void renamePageInActionCollections( - List<ActionCollection> actionCollectionList, String oldPageName, String newPageName) { - for (ActionCollection actionCollection : actionCollectionList) { - if (actionCollection.getUnpublishedCollection().getPageId().equals(oldPageName)) { - actionCollection.getUnpublishedCollection().setPageId(newPageName); - } - } - } - - /** - * This function will respond with unique suffixed number for the entity to avoid duplicate names - * - * @param sourceEntity for which the suffixed number is required to avoid duplication - * @param workspaceId workspace in which entity should be searched - * @return next possible number in case of duplication - */ - private Mono<String> getUniqueSuffixForDuplicateNameEntity(BaseDomain sourceEntity, String workspaceId) { - if (sourceEntity != null) { - return sequenceService - .getNextAsSuffix(sourceEntity.getClass(), " for workspace with _id : " + workspaceId) - .map(sequenceNumber -> { - // sequence number will be empty if no duplicate is found - return sequenceNumber.isEmpty() ? " #1" : " #" + sequenceNumber.trim(); - }); - } - return Mono.just(""); - } - - /** - * Method to - * - save imported pages - * - update the mongoEscapedWidgets if present in the page - * - set the policies for the page - * - update default resource ids along with branch-name if the application is connected to git - * - * @param pages pagelist extracted from the imported JSON file - * @param application saved application where pages needs to be added - * @param branchName to which branch pages should be imported if application is connected to git - * @param existingPages existing pages in DB if the application is connected to git - * @return flux of saved pages in DB - */ - private Flux<NewPage> importAndSavePages( - List<NewPage> pages, - Application application, - String branchName, - Mono<List<NewPage>> existingPages, - ImportApplicationPermissionProvider permissionProvider) { - - Map<String, String> oldToNewLayoutIds = new HashMap<>(); - pages.forEach(newPage -> { - newPage.setApplicationId(application.getId()); - if (newPage.getUnpublishedPage() != null) { - applicationPageService.generateAndSetPagePolicies(application, newPage.getUnpublishedPage()); - newPage.setPolicies(newPage.getUnpublishedPage().getPolicies()); - newPage.getUnpublishedPage().getLayouts().forEach(layout -> { - String layoutId = new ObjectId().toString(); - oldToNewLayoutIds.put(layout.getId(), layoutId); - layout.setId(layoutId); - }); - } - - if (newPage.getPublishedPage() != null) { - applicationPageService.generateAndSetPagePolicies(application, newPage.getPublishedPage()); - newPage.getPublishedPage().getLayouts().forEach(layout -> { - String layoutId = oldToNewLayoutIds.containsKey(layout.getId()) - ? oldToNewLayoutIds.get(layout.getId()) - : new ObjectId().toString(); - layout.setId(layoutId); - }); - } - }); - - return existingPages - .flatMapMany(existingSavedPages -> { - Map<String, NewPage> savedPagesGitIdToPageMap = new HashMap<>(); - - existingSavedPages.stream() - .filter(newPage -> !StringUtils.isEmpty(newPage.getGitSyncId())) - .forEach(newPage -> savedPagesGitIdToPageMap.put(newPage.getGitSyncId(), newPage)); - - return Flux.fromIterable(pages).flatMap(newPage -> { - log.debug( - "Importing page: {}", - newPage.getUnpublishedPage().getName()); - // Check if the page has gitSyncId and if it's already in DB - if (newPage.getGitSyncId() != null - && savedPagesGitIdToPageMap.containsKey(newPage.getGitSyncId())) { - // Since the resource is already present in DB, just update resource - NewPage existingPage = savedPagesGitIdToPageMap.get(newPage.getGitSyncId()); - if (!permissionProvider.hasEditPermission(existingPage)) { - log.error( - "User does not have permission to edit page with id: {}", existingPage.getId()); - return Mono.error(new AppsmithException( - AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.PAGE, existingPage.getId())); - } - Set<Policy> existingPagePolicy = existingPage.getPolicies(); - copyNestedNonNullProperties(newPage, existingPage); - // Update branchName - existingPage.getDefaultResources().setBranchName(branchName); - // Recover the deleted state present in DB from imported page - existingPage - .getUnpublishedPage() - .setDeletedAt(newPage.getUnpublishedPage().getDeletedAt()); - existingPage.setDeletedAt(newPage.getDeletedAt()); - existingPage.setDeleted(newPage.getDeleted()); - existingPage.setPolicies(existingPagePolicy); - return newPageService.save(existingPage); - } else { - // check if user has permission to add new page to the application - if (!permissionProvider.canCreatePage(application)) { - log.error( - "User does not have permission to create page in application with id: {}", - application.getId()); - return Mono.error(new AppsmithException( - AppsmithError.ACL_NO_RESOURCE_FOUND, - FieldName.APPLICATION, - application.getId())); - } - if (application.getGitApplicationMetadata() != null) { - final String defaultApplicationId = - application.getGitApplicationMetadata().getDefaultApplicationId(); - return newPageService - .findByGitSyncIdAndDefaultApplicationId( - defaultApplicationId, newPage.getGitSyncId(), Optional.empty()) - .switchIfEmpty(Mono.defer(() -> { - // This is the first page we are saving with given gitSyncId in this - // instance - DefaultResources defaultResources = new DefaultResources(); - defaultResources.setApplicationId(defaultApplicationId); - defaultResources.setBranchName(branchName); - newPage.setDefaultResources(defaultResources); - return saveNewPageAndUpdateDefaultResources(newPage, branchName); - })) - .flatMap(branchedPage -> { - DefaultResources defaultResources = branchedPage.getDefaultResources(); - // Create new page but keep defaultApplicationId and defaultPageId same for - // both the - // pages - defaultResources.setBranchName(branchName); - newPage.setDefaultResources(defaultResources); - newPage.getUnpublishedPage() - .setDeletedAt(branchedPage - .getUnpublishedPage() - .getDeletedAt()); - newPage.setDeletedAt(branchedPage.getDeletedAt()); - newPage.setDeleted(branchedPage.getDeleted()); - // Set policies from existing branch object - newPage.setPolicies(branchedPage.getPolicies()); - return newPageService.save(newPage); - }); - } - return saveNewPageAndUpdateDefaultResources(newPage, branchName); + @Override + public Mono<ApplicationImportDTO> getApplicationImportDTO( + String applicationId, String workspaceId, Application application) { + return findDatasourceByApplicationId(applicationId, workspaceId) + .zipWith(workspaceService.getDefaultEnvironmentId(workspaceId, null)) + .map(tuple2 -> { + List<Datasource> datasources = tuple2.getT1(); + String environmentId = tuple2.getT2(); + ApplicationImportDTO applicationImportDTO = new ApplicationImportDTO(); + applicationImportDTO.setApplication(application); + Boolean isUnConfiguredDatasource = datasources.stream().anyMatch(datasource -> { + DatasourceStorageDTO datasourceStorageDTO = + datasource.getDatasourceStorages().get(environmentId); + if (datasourceStorageDTO == null) { + // If this environment has not been configured, + // We do not expect to find a storage, user will have to reconfigure + return Boolean.FALSE; } + return Boolean.FALSE.equals(datasourceStorageDTO.getIsConfigured()); }); - }) - .onErrorResume(error -> { - log.error("Error importing page", error); - return Mono.error(error); - }); - } - - private Mono<NewPage> saveNewPageAndUpdateDefaultResources(NewPage newPage, String branchName) { - NewPage update = new NewPage(); - return newPageService.save(newPage).flatMap(page -> { - update.setDefaultResources( - DefaultResourcesUtils.createDefaultIdsOrUpdateWithGivenResourceIds(page, branchName) - .getDefaultResources()); - return newPageService.update(page.getId(), update); - }); - } - - private Set<String> getLayoutOnLoadActionsForPage( - NewPage page, - Map<String, String> actionIdMap, - Map<String, List<String>> unpublishedActionIdToCollectionIdsMap, - Map<String, List<String>> publishedActionIdToCollectionIdsMap) { - Set<String> layoutOnLoadActions = new HashSet<>(); - if (page.getUnpublishedPage().getLayouts() != null) { - - page.getUnpublishedPage().getLayouts().forEach(layout -> { - if (layout.getLayoutOnLoadActions() != null) { - layout.getLayoutOnLoadActions() - .forEach(onLoadAction -> onLoadAction.forEach(actionDTO -> { - actionDTO.setId(actionIdMap.get(actionDTO.getId())); - if (!CollectionUtils.sizeIsEmpty(unpublishedActionIdToCollectionIdsMap) - && !CollectionUtils.isEmpty( - unpublishedActionIdToCollectionIdsMap.get(actionDTO.getId()))) { - actionDTO.setCollectionId(unpublishedActionIdToCollectionIdsMap - .get(actionDTO.getId()) - .get(0)); - } - layoutOnLoadActions.add(actionDTO.getId()); - })); - } - }); - } - - if (page.getPublishedPage() != null && page.getPublishedPage().getLayouts() != null) { - - page.getPublishedPage().getLayouts().forEach(layout -> { - if (layout.getLayoutOnLoadActions() != null) { - layout.getLayoutOnLoadActions() - .forEach(onLoadAction -> onLoadAction.forEach(actionDTO -> { - actionDTO.setId(actionIdMap.get(actionDTO.getId())); - if (!CollectionUtils.sizeIsEmpty(publishedActionIdToCollectionIdsMap) - && !CollectionUtils.isEmpty( - publishedActionIdToCollectionIdsMap.get(actionDTO.getId()))) { - actionDTO.setCollectionId(publishedActionIdToCollectionIdsMap - .get(actionDTO.getId()) - .get(0)); - } - layoutOnLoadActions.add(actionDTO.getId()); - })); - } - }); - } - - layoutOnLoadActions.remove(null); - return layoutOnLoadActions; - } - - // This method will update the action id in saved page for layoutOnLoadAction - private Mono<NewPage> mapActionAndCollectionIdWithPageLayout( - NewPage newPage, - Map<String, String> actionIdMap, - Map<String, List<String>> unpublishedActionIdToCollectionIdsMap, - Map<String, List<String>> publishedActionIdToCollectionIdsMap) { - - return Mono.just(newPage) - .flatMap(page -> { - return newActionService - .findAllById(getLayoutOnLoadActionsForPage( - page, - actionIdMap, - unpublishedActionIdToCollectionIdsMap, - publishedActionIdToCollectionIdsMap)) - .map(newAction -> { - final String defaultActionId = - newAction.getDefaultResources().getActionId(); - if (page.getUnpublishedPage().getLayouts() != null) { - final String defaultCollectionId = newAction - .getUnpublishedAction() - .getDefaultResources() - .getCollectionId(); - page.getUnpublishedPage().getLayouts().forEach(layout -> { - if (layout.getLayoutOnLoadActions() != null) { - layout.getLayoutOnLoadActions() - .forEach(onLoadAction -> onLoadAction.stream() - .filter(actionDTO -> StringUtils.equals( - actionDTO.getId(), newAction.getId())) - .forEach(actionDTO -> { - actionDTO.setDefaultActionId(defaultActionId); - actionDTO.setDefaultCollectionId(defaultCollectionId); - })); - } - }); - } - - if (page.getPublishedPage() != null - && page.getPublishedPage().getLayouts() != null) { - page.getPublishedPage().getLayouts().forEach(layout -> { - if (layout.getLayoutOnLoadActions() != null) { - layout.getLayoutOnLoadActions() - .forEach(onLoadAction -> onLoadAction.stream() - .filter(actionDTO -> StringUtils.equals( - actionDTO.getId(), newAction.getId())) - .forEach(actionDTO -> { - actionDTO.setDefaultActionId(defaultActionId); - if (newAction.getPublishedAction() != null - && newAction - .getPublishedAction() - .getDefaultResources() - != null) { - actionDTO.setDefaultCollectionId(newAction - .getPublishedAction() - .getDefaultResources() - .getCollectionId()); - } - })); - } - }); - } - return newAction; - }) - .collectList() - .thenReturn(page); - }) - .onErrorResume(error -> { - log.error("Error while updating action collection id in page layout", error); - return Mono.error(error); - }); - } - - /** - * This will check if the datasource is already present in the workspace and create a new one if unable to find one - * - * @param existingDatasources already present datasource in the workspace - * @param datasourceStorage which will be checked against existing datasources - * @param workspace workspace where duplicate datasource should be checked - * @return already present or brand new datasource depending upon the equality check - */ - private Mono<Datasource> createUniqueDatasourceIfNotPresent( - Flux<Datasource> existingDatasources, - DatasourceStorage datasourceStorage, - Workspace workspace, - String environmentId, - ImportApplicationPermissionProvider permissionProvider) { - /* - 1. If same datasource is present return - 2. If unable to find the datasource create a new datasource with unique name and return - */ - final DatasourceConfiguration datasourceConfig = datasourceStorage.getDatasourceConfiguration(); - AuthenticationResponse authResponse = new AuthenticationResponse(); - if (datasourceConfig != null && datasourceConfig.getAuthentication() != null) { - copyNestedNonNullProperties(datasourceConfig.getAuthentication().getAuthenticationResponse(), authResponse); - datasourceConfig.getAuthentication().setAuthenticationResponse(null); - datasourceConfig.getAuthentication().setAuthenticationType(null); - } - - return existingDatasources - // For git import exclude datasource configuration - .filter(ds -> ds.getName().equals(datasourceStorage.getName()) - && datasourceStorage.getPluginId().equals(ds.getPluginId())) - .next() // Get the first matching datasource, we don't need more than one here. - .switchIfEmpty(Mono.defer(() -> { - // check if user has permission to create datasource - if (!permissionProvider.canCreateDatasource(workspace)) { - log.error( - "Unauthorized to create datasource: {} in workspace: {}", - datasourceStorage.getName(), - workspace.getName()); - return Mono.error(new AppsmithException( - AppsmithError.ACL_NO_RESOURCE_FOUND, - FieldName.DATASOURCE, - datasourceStorage.getName())); - } - - if (datasourceConfig != null && datasourceConfig.getAuthentication() != null) { - datasourceConfig.getAuthentication().setAuthenticationResponse(authResponse); + if (Boolean.TRUE.equals(isUnConfiguredDatasource)) { + applicationImportDTO.setIsPartialImport(true); + applicationImportDTO.setUnConfiguredDatasourceList(datasources); + } else { + applicationImportDTO.setIsPartialImport(false); } - // No matching existing datasource found, so create a new one. - datasourceStorage.setIsConfigured( - datasourceConfig != null && datasourceConfig.getAuthentication() != null); - datasourceStorage.setEnvironmentId(environmentId); - - return datasourceService - .findByNameAndWorkspaceId(datasourceStorage.getName(), workspace.getId(), Optional.empty()) - .flatMap(duplicateNameDatasource -> - getUniqueSuffixForDuplicateNameEntity(duplicateNameDatasource, workspace.getId())) - .map(dsName -> { - datasourceStorage.setName(datasourceStorage.getName() + dsName); - return datasourceService.createDatasourceFromDatasourceStorage(datasourceStorage); - }) - .switchIfEmpty(Mono.just( - datasourceService.createDatasourceFromDatasourceStorage(datasourceStorage))) - .flatMap(datasourceService::createWithoutPermissions); - })) - .onErrorResume(throwable -> { - log.error("failed to import datasource", throwable); - return Mono.error(throwable); + return applicationImportDTO; }); } - /** - * Here we will be rehydrating the sensitive fields like password, secrets etc. in datasourceStorage while importing the application - * - * @param datasourceStorage for which sensitive fields should be rehydrated - * @param decryptedFields sensitive fields - * @return updated datasourceStorage with rehydrated sensitive fields - */ - private DatasourceStorage updateAuthenticationDTO( - DatasourceStorage datasourceStorage, DecryptedSensitiveFields decryptedFields) { - - final DatasourceConfiguration dsConfig = datasourceStorage.getDatasourceConfiguration(); - String authType = decryptedFields.getAuthType(); - if (dsConfig == null || authType == null) { - return datasourceStorage; - } - - if (StringUtils.equals(authType, DBAuth.class.getName())) { - final DBAuth dbAuth = decryptedFields.getDbAuth(); - dbAuth.setPassword(decryptedFields.getPassword()); - datasourceStorage.getDatasourceConfiguration().setAuthentication(dbAuth); - } else if (StringUtils.equals(authType, BasicAuth.class.getName())) { - final BasicAuth basicAuth = decryptedFields.getBasicAuth(); - basicAuth.setPassword(decryptedFields.getPassword()); - datasourceStorage.getDatasourceConfiguration().setAuthentication(basicAuth); - } else if (StringUtils.equals(authType, OAuth2.class.getName())) { - OAuth2 auth2 = decryptedFields.getOpenAuth2(); - AuthenticationResponse authResponse = new AuthenticationResponse(); - auth2.setClientSecret(decryptedFields.getPassword()); - authResponse.setToken(decryptedFields.getToken()); - authResponse.setRefreshToken(decryptedFields.getRefreshToken()); - authResponse.setTokenResponse(decryptedFields.getTokenResponse()); - authResponse.setExpiresAt(Instant.now()); - auth2.setAuthenticationResponse(authResponse); - datasourceStorage.getDatasourceConfiguration().setAuthentication(auth2); - } else if (StringUtils.equals(authType, BearerTokenAuth.class.getName())) { - BearerTokenAuth auth = new BearerTokenAuth(); - auth.setBearerToken(decryptedFields.getBearerTokenAuth().getBearerToken()); - datasourceStorage.getDatasourceConfiguration().setAuthentication(auth); - } - return datasourceStorage; - } - - private Mono<Application> importThemes( - Application application, ApplicationJson importedApplicationJson, boolean appendToApp) { - if (appendToApp) { - // appending to existing app, theme should not change - return Mono.just(application); - } - return themeService.importThemesToApplication(application, importedApplicationJson); - } - + @Override public Mono<List<Datasource>> findDatasourceByApplicationId(String applicationId, String workspaceId) { // TODO: Investigate further why datasourcePermission.getReadPermission() is not being used. Mono<List<Datasource>> listMono = datasourceService @@ -1878,36 +699,6 @@ public Mono<List<Datasource>> findDatasourceByApplicationId(String applicationId }); } - @Override - public Mono<ApplicationImportDTO> getApplicationImportDTO( - String applicationId, String workspaceId, Application application) { - return findDatasourceByApplicationId(applicationId, workspaceId) - .zipWith(workspaceService.getDefaultEnvironmentId(workspaceId, null)) - .map(tuple2 -> { - List<Datasource> datasources = tuple2.getT1(); - String environmentId = tuple2.getT2(); - ApplicationImportDTO applicationImportDTO = new ApplicationImportDTO(); - applicationImportDTO.setApplication(application); - Boolean isUnConfiguredDatasource = datasources.stream().anyMatch(datasource -> { - DatasourceStorageDTO datasourceStorageDTO = - datasource.getDatasourceStorages().get(environmentId); - if (datasourceStorageDTO == null) { - // If this environment has not been configured, - // We do not expect to find a storage, user will have to reconfigure - return Boolean.FALSE; - } - return Boolean.FALSE.equals(datasourceStorageDTO.getIsConfigured()); - }); - if (Boolean.TRUE.equals(isUnConfiguredDatasource)) { - applicationImportDTO.setIsPartialImport(true); - applicationImportDTO.setUnConfiguredDatasourceList(datasources); - } else { - applicationImportDTO.setIsPartialImport(false); - } - return applicationImportDTO; - }); - } - /** * @param applicationId default ID of the application where this ApplicationJSON is going to get merged with * @param branchName name of the branch of the application where this ApplicationJSON is going to get merged with @@ -1998,35 +789,6 @@ public Mono<Application> mergeApplicationJsonWithApplication( }); } - private Map<String, String> updateNewPagesBeforeMerge(List<NewPage> existingPages, List<NewPage> newPagesList) { - Map<String, String> newToOldToPageNameMap = new HashMap<>(); // maps new names with old names - - // get a list of unpublished page names that already exists - List<String> unpublishedPageNames = existingPages.stream() - .filter(newPage -> newPage.getUnpublishedPage() != null) - .map(newPage -> newPage.getUnpublishedPage().getName()) - .collect(Collectors.toList()); - - // modify each new page - for (NewPage newPage : newPagesList) { - newPage.setPublishedPage(null); // we'll not merge published pages so removing this - - // let's check if page name conflicts, rename in that case - String oldPageName = newPage.getUnpublishedPage().getName(), - newPageName = newPage.getUnpublishedPage().getName(); - - int i = 1; - while (unpublishedPageNames.contains(newPageName)) { - i++; - newPageName = oldPageName + i; - } - newPage.getUnpublishedPage().setName(newPageName); // set new name. may be same as before or not - newPage.getUnpublishedPage().setSlug(TextUtils.makeSlug(newPageName)); // set the slug also - newToOldToPageNameMap.put(newPageName, oldPageName); // map: new name -> old name - } - return newToOldToPageNameMap; - } - /** * To send analytics event for import and export of application * diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceImpl.java index 31d0ce10d592..f8b14622fa21 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceImpl.java @@ -1,16 +1,19 @@ package com.appsmith.server.imports.internal; -import com.appsmith.server.actioncollections.base.ActionCollectionService; +import com.appsmith.external.models.Datasource; import com.appsmith.server.datasources.base.DatasourceService; -import com.appsmith.server.jslibs.base.CustomJSLibService; +import com.appsmith.server.domains.ActionCollection; +import com.appsmith.server.domains.CustomJSLib; +import com.appsmith.server.domains.NewAction; +import com.appsmith.server.domains.NewPage; +import com.appsmith.server.domains.Plugin; +import com.appsmith.server.domains.Theme; +import com.appsmith.server.imports.importable.ImportableService; import com.appsmith.server.newactions.base.NewActionService; -import com.appsmith.server.newpages.base.NewPageService; import com.appsmith.server.repositories.PermissionGroupRepository; -import com.appsmith.server.repositories.PluginRepository; import com.appsmith.server.services.AnalyticsService; import com.appsmith.server.services.ApplicationPageService; import com.appsmith.server.services.ApplicationService; -import com.appsmith.server.services.SequenceService; import com.appsmith.server.services.SessionUserService; import com.appsmith.server.services.WorkspaceService; import com.appsmith.server.solutions.ActionPermission; @@ -18,32 +21,25 @@ import com.appsmith.server.solutions.DatasourcePermission; import com.appsmith.server.solutions.PagePermission; import com.appsmith.server.solutions.WorkspacePermission; -import com.appsmith.server.themes.base.ThemeService; import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; import org.springframework.transaction.reactive.TransactionalOperator; @Slf4j -@Component +@Service @Primary public class ImportApplicationServiceImpl extends ImportApplicationServiceCEImpl implements ImportApplicationService { public ImportApplicationServiceImpl( DatasourceService datasourceService, SessionUserService sessionUserService, - PluginRepository pluginRepository, WorkspaceService workspaceService, ApplicationService applicationService, - NewPageService newPageService, ApplicationPageService applicationPageService, NewActionService newActionService, - SequenceService sequenceService, - ActionCollectionService actionCollectionService, - ThemeService themeService, AnalyticsService analyticsService, - CustomJSLibService customJSLibService, DatasourcePermission datasourcePermission, WorkspacePermission workspacePermission, ApplicationPermission applicationPermission, @@ -51,21 +47,22 @@ public ImportApplicationServiceImpl( ActionPermission actionPermission, Gson gson, TransactionalOperator transactionalOperator, - PermissionGroupRepository permissionGroupRepository) { + PermissionGroupRepository permissionGroupRepository, + ImportableService<Plugin> pluginImportableService, + ImportableService<Theme> themeImportableService, + ImportableService<NewPage> newPageImportableService, + ImportableService<CustomJSLib> customJSLibImportableService, + ImportableService<Datasource> datasourceImportableService, + ImportableService<NewAction> newActionImportableService, + ImportableService<ActionCollection> actionCollectionImportableService) { super( datasourceService, sessionUserService, - pluginRepository, workspaceService, applicationService, - newPageService, applicationPageService, newActionService, - sequenceService, - actionCollectionService, - themeService, analyticsService, - customJSLibService, datasourcePermission, workspacePermission, applicationPermission, @@ -73,6 +70,13 @@ public ImportApplicationServiceImpl( actionPermission, gson, transactionalOperator, - permissionGroupRepository); + permissionGroupRepository, + pluginImportableService, + themeImportableService, + newPageImportableService, + customJSLibImportableService, + datasourceImportableService, + newActionImportableService, + actionCollectionImportableService); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/export/CustomJSLibExportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/exports/CustomJSLibExportableServiceCEImpl.java similarity index 98% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/export/CustomJSLibExportableServiceCEImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/exports/CustomJSLibExportableServiceCEImpl.java index 41c71b48ee42..b7342dd46438 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/export/CustomJSLibExportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/exports/CustomJSLibExportableServiceCEImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.jslibs.export; +package com.appsmith.server.jslibs.exports; import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.Application; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/export/CustomJSLibExportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/exports/CustomJSLibExportableServiceImpl.java similarity index 91% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/export/CustomJSLibExportableServiceImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/exports/CustomJSLibExportableServiceImpl.java index 55d8f6b13720..5abe396313b2 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/export/CustomJSLibExportableServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/exports/CustomJSLibExportableServiceImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.jslibs.export; +package com.appsmith.server.jslibs.exports; import com.appsmith.server.domains.CustomJSLib; import com.appsmith.server.exports.exportable.ExportableService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/imports/CustomJSLibImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/imports/CustomJSLibImportableServiceCEImpl.java new file mode 100644 index 000000000000..a8140fde10fc --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/imports/CustomJSLibImportableServiceCEImpl.java @@ -0,0 +1,89 @@ +package com.appsmith.server.jslibs.imports; + +import com.appsmith.server.constants.ApplicationConstants; +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.CustomJSLib; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import com.appsmith.server.imports.importable.ImportableServiceCE; +import com.appsmith.server.jslibs.base.CustomJSLibService; +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class CustomJSLibImportableServiceCEImpl implements ImportableServiceCE<CustomJSLib> { + private final CustomJSLibService customJSLibService; + + public CustomJSLibImportableServiceCEImpl(CustomJSLibService customJSLibService) { + this.customJSLibService = customJSLibService; + } + + @Override + public Mono<List<CustomJSLib>> importEntities( + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<Workspace> workspaceMono, + Mono<Application> applicationMono, + ApplicationJson applicationJson) { + List<CustomJSLib> customJSLibs = applicationJson.getCustomJSLibList(); + if (customJSLibs == null) { + customJSLibs = new ArrayList<>(); + } + + ensureXmlParserPresenceInCustomJsLibList(customJSLibs); + + return Flux.fromIterable(customJSLibs) + .flatMap(customJSLib -> { + customJSLib.setId(null); + customJSLib.setCreatedAt(null); + customJSLib.setUpdatedAt(null); + return customJSLibService.persistCustomJSLibMetaDataIfDoesNotExistAndGetDTO(customJSLib, false); + }) + .collectList() + .map(customJSLibApplicationDTOS -> { + mappedImportableResourcesDTO.setInstalledJsLibsList(customJSLibApplicationDTOS); + return List.<CustomJSLib>of(); + }) + .elapsed() + .map(objects -> { + log.debug("time to import custom jslibs: {}", objects.getT1()); + return objects.getT2(); + }) + .onErrorResume(e -> { + log.error("Error importing custom jslibs", e); + return Mono.error(e); + }); + } + + /** + * This method takes customJSLibList from application JSON, checks if an entry for XML parser exists, + * otherwise adds the entry. + * This has been done to add the xmlParser entry in imported application as appsmith is stopping native support + * for xml parser. + * Read More: https://github.com/appsmithorg/appsmith/pull/28012 + * + * @param customJSLibList + */ + private void ensureXmlParserPresenceInCustomJsLibList(List<CustomJSLib> customJSLibList) { + boolean isXmlParserLibFound = false; + for (CustomJSLib customJSLib : customJSLibList) { + if (!customJSLib.getUidString().equals(ApplicationConstants.XML_PARSER_LIBRARY_UID)) { + continue; + } + + isXmlParserLibFound = true; + break; + } + + if (!isXmlParserLibFound) { + CustomJSLib xmlParserJsLib = ApplicationConstants.getDefaultParserCustomJsLibCompatibilityDTO(); + customJSLibList.add(xmlParserJsLib); + } + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/imports/CustomJSLibImportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/imports/CustomJSLibImportableServiceImpl.java new file mode 100644 index 000000000000..ab97a8e51494 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/jslibs/imports/CustomJSLibImportableServiceImpl.java @@ -0,0 +1,14 @@ +package com.appsmith.server.jslibs.imports; + +import com.appsmith.server.domains.CustomJSLib; +import com.appsmith.server.imports.importable.ImportableService; +import com.appsmith.server.jslibs.base.CustomJSLibService; +import org.springframework.stereotype.Service; + +@Service +public class CustomJSLibImportableServiceImpl extends CustomJSLibImportableServiceCEImpl + implements ImportableService<CustomJSLib> { + public CustomJSLibImportableServiceImpl(CustomJSLibService customJSLibService) { + super(customJSLibService); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java index af52100b948f..0391928779d3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java @@ -4,7 +4,6 @@ import com.appsmith.external.models.Executable; import com.appsmith.external.models.MustacheBindingToken; import com.appsmith.server.acl.AclPermission; -import com.appsmith.server.domains.Application; import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionViewDTO; @@ -13,7 +12,6 @@ import com.appsmith.server.dtos.ce.ImportActionCollectionResultDTO; import com.appsmith.server.dtos.ce.ImportActionResultDTO; import com.appsmith.server.dtos.ce.ImportedActionAndCollectionMapsDTO; -import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; import com.appsmith.server.services.CrudService; import com.mongodb.bulk.BulkWriteResult; import org.springframework.data.domain.Sort; @@ -129,15 +127,6 @@ Mono<String> findBranchedIdByBranchNameAndDefaultActionId( void populateDefaultResources(NewAction newAction, NewAction branchedAction, String branchName); - Mono<ImportActionResultDTO> importActions( - List<NewAction> importedNewActionList, - Application importedApplication, - String branchName, - Map<String, NewPage> pageNameMap, - Map<String, String> pluginMap, - Map<String, String> datasourceMap, - ImportApplicationPermissionProvider permissionProvider); - Mono<ImportedActionAndCollectionMapsDTO> updateActionsWithImportedCollectionIds( ImportActionCollectionResultDTO importActionCollectionResultDTO, ImportActionResultDTO importActionResultDTO); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java index 053baf8d8fdb..298a5610358f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java @@ -39,7 +39,6 @@ import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.PluginExecutorHelper; import com.appsmith.server.helpers.ResponseUtils; -import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; import com.appsmith.server.newpages.base.NewPageService; import com.appsmith.server.plugins.base.PluginService; import com.appsmith.server.repositories.NewActionRepository; @@ -77,7 +76,6 @@ import javax.lang.model.SourceVersion; import java.time.Instant; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -92,11 +90,9 @@ import static com.appsmith.external.constants.spans.ActionSpan.GET_ACTION_REPOSITORY_CALL; import static com.appsmith.external.constants.spans.ActionSpan.GET_UNPUBLISHED_ACTION; import static com.appsmith.external.constants.spans.ActionSpan.GET_VIEW_MODE_ACTION; -import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNewFieldValuesIntoOldObject; import static com.appsmith.external.helpers.PluginUtils.setValueSafelyInFormData; import static com.appsmith.server.acl.AclPermission.EXECUTE_DATASOURCES; -import static com.appsmith.server.helpers.ImportExportUtils.sanitizeDatasourceInActionDTO; import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; @@ -1618,289 +1614,6 @@ public void populateDefaultResources(NewAction newAction, NewAction branchedActi newAction.setPolicies(branchedAction.getPolicies()); } - private NewPage updatePageInAction( - ActionDTO action, Map<String, NewPage> pageNameMap, Map<String, String> actionIdMap) { - NewPage parentPage = pageNameMap.get(action.getPageId()); - if (parentPage == null) { - return null; - } - actionIdMap.put(action.getValidName() + parentPage.getId(), action.getId()); - action.setPageId(parentPage.getId()); - - // Update defaultResources in actionDTO - DefaultResources defaultResources = new DefaultResources(); - defaultResources.setPageId(parentPage.getDefaultResources().getPageId()); - action.setDefaultResources(defaultResources); - - return parentPage; - } - - private void updateExistingAction( - NewAction existingAction, - NewAction actionToImport, - String branchName, - ImportApplicationPermissionProvider permissionProvider) { - // Since the resource is already present in DB, just update resource - if (!permissionProvider.hasEditPermission(existingAction)) { - log.error("User does not have permission to edit action with id: {}", existingAction.getId()); - throw new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.ACTION, existingAction.getId()); - } - Set<Policy> existingPolicy = existingAction.getPolicies(); - copyNestedNonNullProperties(actionToImport, existingAction); - // Update branchName - existingAction.getDefaultResources().setBranchName(branchName); - // Recover the deleted state present in DB from imported action - existingAction - .getUnpublishedAction() - .setDeletedAt(actionToImport.getUnpublishedAction().getDeletedAt()); - existingAction.setDeletedAt(actionToImport.getDeletedAt()); - existingAction.setDeleted(actionToImport.getDeleted()); - existingAction.setPolicies(existingPolicy); - } - - private void putActionIdInMap(NewAction newAction, ImportActionResultDTO importActionResultDTO) { - // Populate actionIdsMap to associate the appropriate actions to run on page load - if (newAction.getUnpublishedAction() != null) { - ActionDTO unpublishedAction = newAction.getUnpublishedAction(); - importActionResultDTO - .getActionIdMap() - .put( - importActionResultDTO - .getActionIdMap() - .get(unpublishedAction.getValidName() + unpublishedAction.getPageId()), - newAction.getId()); - - if (unpublishedAction.getCollectionId() != null) { - importActionResultDTO - .getUnpublishedCollectionIdToActionIdsMap() - .putIfAbsent(unpublishedAction.getCollectionId(), new HashMap<>()); - final Map<String, String> actionIds = importActionResultDTO - .getUnpublishedCollectionIdToActionIdsMap() - .get(unpublishedAction.getCollectionId()); - actionIds.put(newAction.getDefaultResources().getActionId(), newAction.getId()); - } - } - if (newAction.getPublishedAction() != null) { - ActionDTO publishedAction = newAction.getPublishedAction(); - importActionResultDTO - .getActionIdMap() - .put( - importActionResultDTO - .getActionIdMap() - .get(publishedAction.getValidName() + publishedAction.getPageId()), - newAction.getId()); - - if (publishedAction.getCollectionId() != null) { - importActionResultDTO - .getPublishedCollectionIdToActionIdsMap() - .putIfAbsent(publishedAction.getCollectionId(), new HashMap<>()); - final Map<String, String> actionIds = importActionResultDTO - .getPublishedCollectionIdToActionIdsMap() - .get(publishedAction.getCollectionId()); - actionIds.put(newAction.getDefaultResources().getActionId(), newAction.getId()); - } - } - } - - /** - * Method to - * - save imported actions with updated policies - * - update default resource ids along with branch-name if the application is connected to git - * - update the map of imported collectionIds to the actionIds in saved in DB - * - * @param importedNewActionList action list extracted from the imported JSON file - * @param application imported and saved application in DB - * @param branchName branch to which the actions needs to be saved if the application is connected to git - * @param pageNameMap map of page name to saved page in DB - * @param pluginMap map of plugin name to saved plugin id in DB - * @param datasourceMap map of plugin name to saved datasource id in DB - * @return A DTO class with several information - */ - @Override - public Mono<ImportActionResultDTO> importActions( - List<NewAction> importedNewActionList, - Application application, - String branchName, - Map<String, NewPage> pageNameMap, - Map<String, String> pluginMap, - Map<String, String> datasourceMap, - ImportApplicationPermissionProvider permissionProvider) { - /* Mono.just(application) is created to avoid the eagerly fetching of existing actions - * during the pipeline construction. It should be fetched only when the pipeline is subscribed/executed. - */ - return Mono.just(application) - .flatMap(importedApplication -> { - Mono<Map<String, NewAction>> actionsInCurrentAppMono = repository - .findByApplicationId(importedApplication.getId()) - .filter(newAction -> newAction.getGitSyncId() != null) - .collectMap(NewAction::getGitSyncId); - - // find existing actions in all the branches of this application and put them in a map - Mono<Map<String, NewAction>> actionsInOtherBranchesMono; - if (importedApplication.getGitApplicationMetadata() != null) { - final String defaultApplicationId = - importedApplication.getGitApplicationMetadata().getDefaultApplicationId(); - actionsInOtherBranchesMono = repository - .findByDefaultApplicationId(defaultApplicationId, Optional.empty()) - .filter(newAction -> newAction.getGitSyncId() != null) - .collectMap(NewAction::getGitSyncId); - } else { - actionsInOtherBranchesMono = Mono.just(Collections.emptyMap()); - } - - return Mono.zip(actionsInCurrentAppMono, actionsInOtherBranchesMono) - .flatMap(objects -> { - Map<String, NewAction> actionsInCurrentApp = objects.getT1(); - Map<String, NewAction> actionsInOtherBranches = objects.getT2(); - - List<NewAction> newNewActionList = new ArrayList<>(); - List<NewAction> existingNewActionList = new ArrayList<>(); - - final String workspaceId = importedApplication.getWorkspaceId(); - - ImportActionResultDTO importActionResultDTO = new ImportActionResultDTO(); - - // existing actions will be required when we'll delete the outdated actions later - importActionResultDTO.setExistingActions(actionsInCurrentApp.values()); - - for (NewAction newAction : importedNewActionList) { - if (newAction.getUnpublishedAction() == null - || !StringUtils.hasLength(newAction - .getUnpublishedAction() - .getPageId())) { - continue; - } - - NewPage parentPage = new NewPage(); - ActionDTO unpublishedAction = newAction.getUnpublishedAction(); - ActionDTO publishedAction = newAction.getPublishedAction(); - - // If pageId is missing in the actionDTO create a fallback pageId - final String fallbackParentPageId = unpublishedAction.getPageId(); - - if (unpublishedAction.getValidName() != null) { - unpublishedAction.setId(newAction.getId()); - parentPage = updatePageInAction( - unpublishedAction, pageNameMap, importActionResultDTO.getActionIdMap()); - sanitizeDatasourceInActionDTO( - unpublishedAction, datasourceMap, pluginMap, workspaceId, false); - } - - if (publishedAction != null && publishedAction.getValidName() != null) { - publishedAction.setId(newAction.getId()); - if (!StringUtils.hasLength(publishedAction.getPageId())) { - publishedAction.setPageId(fallbackParentPageId); - } - NewPage publishedActionPage = updatePageInAction( - publishedAction, pageNameMap, importActionResultDTO.getActionIdMap()); - parentPage = parentPage == null ? publishedActionPage : parentPage; - sanitizeDatasourceInActionDTO( - publishedAction, datasourceMap, pluginMap, workspaceId, false); - } - - newAction.makePristine(); - newAction.setWorkspaceId(workspaceId); - newAction.setApplicationId(importedApplication.getId()); - newAction.setPluginId(pluginMap.get(newAction.getPluginId())); - this.generateAndSetActionPolicies(parentPage, newAction); - - // Check if the action has gitSyncId and if it's already in DB - if (newAction.getGitSyncId() != null - && actionsInCurrentApp.containsKey(newAction.getGitSyncId())) { - - // Since the resource is already present in DB, just update resource - NewAction existingAction = actionsInCurrentApp.get(newAction.getGitSyncId()); - updateExistingAction(existingAction, newAction, branchName, permissionProvider); - - // Add it to actions list that'll be updated in bulk - existingNewActionList.add(existingAction); - importActionResultDTO - .getImportedActionIds() - .add(existingAction.getId()); - putActionIdInMap(existingAction, importActionResultDTO); - } else { - // check whether user has permission to add new action - if (!permissionProvider.canCreateAction(parentPage)) { - log.error( - "User does not have permission to create action in page with id: {}", - parentPage.getId()); - throw new AppsmithException( - AppsmithError.ACL_NO_RESOURCE_FOUND, - FieldName.PAGE, - parentPage.getId()); - } - - // this will generate the id and other auto generated fields e.g. createdAt - newAction.updateForBulkWriteOperation(); - - // set gitSyncId if doesn't exist - if (newAction.getGitSyncId() == null) { - newAction.setGitSyncId(newAction.getApplicationId() + "_" - + Instant.now().toString()); - } - - if (importedApplication.getGitApplicationMetadata() != null) { - // application is git connected, check if the action is already present in - // any other branch - if (actionsInOtherBranches.containsKey(newAction.getGitSyncId())) { - // action found in other branch, copy the default resources from that - // action - NewAction branchedAction = - actionsInOtherBranches.get(newAction.getGitSyncId()); - populateDefaultResources(newAction, branchedAction, branchName); - } else { - // This is the first action we are saving with given gitSyncId in this - // instance - DefaultResources defaultResources = new DefaultResources(); - defaultResources.setApplicationId(importedApplication - .getGitApplicationMetadata() - .getDefaultApplicationId()); - defaultResources.setActionId(newAction.getId()); - defaultResources.setBranchName(branchName); - newAction.setDefaultResources(defaultResources); - } - } else { - DefaultResources defaultResources = new DefaultResources(); - defaultResources.setApplicationId(importedApplication.getId()); - defaultResources.setActionId(newAction.getId()); - newAction.setDefaultResources(defaultResources); - } - - // Add it to actions list that'll be inserted or updated in bulk - newNewActionList.add(newAction); - importActionResultDTO - .getImportedActionIds() - .add(newAction.getId()); - putActionIdInMap(newAction, importActionResultDTO); - } - } - - log.info( - "Saving actions in bulk. New: {}, Updated: {}", - newNewActionList.size(), - existingNewActionList.size()); - - // Save all the new actions in bulk - return repository - .bulkInsert(newNewActionList) - .then(repository.bulkUpdate(existingNewActionList)) - .thenReturn(importActionResultDTO); - }); - }) - .onErrorResume(e -> { - log.error("Error importing actions", e); - return Mono.error(e); - }) - .elapsed() - .map(tuple -> { - log.debug( - "time to import {} actions: {} ms", - tuple.getT2().getImportedActionIds().size(), - tuple.getT1()); - return tuple.getT2(); - }); - } - @Override public Mono<ImportedActionAndCollectionMapsDTO> updateActionsWithImportedCollectionIds( ImportActionCollectionResultDTO importActionCollectionResultDTO, diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/export/NewActionExportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/exports/NewActionExportableServiceCEImpl.java similarity index 99% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/export/NewActionExportableServiceCEImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/exports/NewActionExportableServiceCEImpl.java index ac611efc57b9..9c02e174febd 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/export/NewActionExportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/exports/NewActionExportableServiceCEImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.newactions.export; +package com.appsmith.server.newactions.exports; import com.appsmith.external.models.ActionDTO; import com.appsmith.server.acl.AclPermission; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/export/NewActionExportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/exports/NewActionExportableServiceImpl.java similarity index 92% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/export/NewActionExportableServiceImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/exports/NewActionExportableServiceImpl.java index 877e804eda08..23c2cde72d9a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/export/NewActionExportableServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/exports/NewActionExportableServiceImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.newactions.export; +package com.appsmith.server.newactions.exports; import com.appsmith.server.domains.NewAction; import com.appsmith.server.exports.exportable.ExportableService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/imports/NewActionImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/imports/NewActionImportableServiceCEImpl.java new file mode 100644 index 000000000000..c5598d40a61a --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/imports/NewActionImportableServiceCEImpl.java @@ -0,0 +1,496 @@ +package com.appsmith.server.newactions.imports; + +import com.appsmith.external.models.ActionDTO; +import com.appsmith.external.models.DefaultResources; +import com.appsmith.external.models.Policy; +import com.appsmith.server.actioncollections.base.ActionCollectionService; +import com.appsmith.server.constants.FieldName; +import com.appsmith.server.domains.ActionCollection; +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.NewAction; +import com.appsmith.server.domains.NewPage; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import com.appsmith.server.dtos.ce.ImportActionCollectionResultDTO; +import com.appsmith.server.dtos.ce.ImportActionResultDTO; +import com.appsmith.server.exceptions.AppsmithError; +import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; +import com.appsmith.server.imports.importable.ImportableServiceCE; +import com.appsmith.server.newactions.base.NewActionService; +import com.appsmith.server.repositories.NewActionRepository; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; +import static com.appsmith.server.helpers.ImportExportUtils.sanitizeDatasourceInActionDTO; + +@Slf4j +public class NewActionImportableServiceCEImpl implements ImportableServiceCE<NewAction> { + + private final NewActionService newActionService; + private final NewActionRepository repository; + private final ActionCollectionService actionCollectionService; + + public NewActionImportableServiceCEImpl( + NewActionService newActionService, + NewActionRepository repository, + ActionCollectionService actionCollectionService) { + this.newActionService = newActionService; + this.repository = repository; + this.actionCollectionService = actionCollectionService; + } + + @Override + public Mono<List<NewAction>> importEntities( + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<Workspace> workspaceMono, + Mono<Application> applicationMono, + ApplicationJson applicationJson) { + + List<NewAction> importedNewActionList = applicationJson.getActionList(); + + Mono<List<NewAction>> importedNewActionMono = Mono.just(importedNewActionList); + if (Boolean.TRUE.equals(importingMetaDTO.getAppendToApp())) { + importedNewActionMono = importedNewActionMono.map(importedNewActionList1 -> { + List<NewPage> importedNewPages = mappedImportableResourcesDTO.getPageNameMap().values().stream() + .toList(); + Map<String, String> newToOldNameMap = mappedImportableResourcesDTO.getNewPageNameToOldPageNameMap(); + + for (NewPage newPage : importedNewPages) { + String newPageName = newPage.getUnpublishedPage().getName(); + String oldPageName = newToOldNameMap.get(newPageName); + + if (!newPageName.equals(oldPageName)) { + renamePageInActions(importedNewActionList1, oldPageName, newPageName); + } + } + return importedNewActionList1; + }); + } + + return Mono.zip(importedNewActionMono, applicationMono) + .flatMap(objects -> + importActions(objects.getT1(), objects.getT2(), importingMetaDTO, mappedImportableResourcesDTO)) + .flatMap(importActionResultDTO -> { + log.info("Actions imported. result: {}", importActionResultDTO.getGist()); + // Updating the existing application for git-sync + // During partial import/appending to the existing application keep the resources + // attached to the application: + // Delete the invalid resources (which are not the part of applicationJsonDTO) in + // the git flow only + if (!StringUtils.isEmpty(importingMetaDTO.getApplicationId()) + && !importingMetaDTO.getAppendToApp() + && CollectionUtils.isNotEmpty(importActionResultDTO.getExistingActions())) { + // Remove unwanted actions + Set<String> invalidActionIds = new HashSet<>(); + for (NewAction action : importActionResultDTO.getExistingActions()) { + if (!importActionResultDTO.getImportedActionIds().contains(action.getId())) { + invalidActionIds.add(action.getId()); + } + } + log.info("Deleting {} actions which are no more used", invalidActionIds.size()); + return Flux.fromIterable(invalidActionIds) + .flatMap(actionId -> newActionService + .deleteUnpublishedAction(actionId) + // return an empty action so that the filter can remove it from the list + .onErrorResume(throwable -> { + log.debug("Failed to delete action with id {} during import", actionId); + log.error(throwable.getMessage()); + return Mono.empty(); + })) + .then() + .thenReturn(importActionResultDTO); + } + return Mono.just(importActionResultDTO); + }) + .onErrorResume(throwable -> { + log.error("Error while importing actions and deleting unused ones", throwable); + return Mono.error(throwable); + }) + .thenReturn(List.of()); + } + + @Override + public Mono<Void> updateImportedEntities( + Application application, + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + + ImportActionResultDTO importActionResultDTO = mappedImportableResourcesDTO.getActionResultDTO(); + ImportActionCollectionResultDTO importActionCollectionResultDTO = + mappedImportableResourcesDTO.getActionCollectionResultDTO(); + + List<String> savedCollectionIds = importActionCollectionResultDTO.getSavedActionCollectionIds(); + log.info( + "Action collections imported. applicationId {}, result: {}", + application.getId(), + importActionCollectionResultDTO.getGist()); + return newActionService + .updateActionsWithImportedCollectionIds(importActionCollectionResultDTO, importActionResultDTO) + .flatMap(actionAndCollectionMapsDTO -> { + log.info("Updated actions with imported collection ids. applicationId {}", application.getId()); + // Updating the existing application for git-sync + // During partial import/appending to the existing application keep the resources + // attached to the application: + // Delete the invalid resources (which are not the part of applicationJsonDTO) in + // the git flow only + if (!StringUtils.isEmpty(importingMetaDTO.getApplicationId()) + && !importingMetaDTO.getAppendToApp()) { + // Remove unwanted action collections + Set<String> invalidCollectionIds = new HashSet<>(); + for (ActionCollection collection : + importActionCollectionResultDTO.getExistingActionCollections()) { + if (!savedCollectionIds.contains(collection.getId())) { + invalidCollectionIds.add(collection.getId()); + } + } + log.info("Deleting {} action collections which are no more used", invalidCollectionIds.size()); + return Flux.fromIterable(invalidCollectionIds) + .flatMap(collectionId -> actionCollectionService + .deleteWithoutPermissionUnpublishedActionCollection(collectionId) + // return an empty collection so that the filter can remove it from + // the list + .onErrorResume(throwable -> { + log.debug( + "Failed to delete collection with id {} during import", + collectionId); + log.error(throwable.getMessage()); + return Mono.empty(); + })) + .then(); + } + + mappedImportableResourcesDTO.setActionAndCollectionMapsDTO(actionAndCollectionMapsDTO); + + return Mono.empty().then(); + }) + .onErrorResume(error -> { + log.error("Error while updating collection id to actions", error); + return Mono.error(error); + }); + } + + private void renamePageInActions(List<NewAction> newActionList, String oldPageName, String newPageName) { + for (NewAction newAction : newActionList) { + if (newAction.getUnpublishedAction().getPageId().equals(oldPageName)) { + newAction.getUnpublishedAction().setPageId(newPageName); + } + } + } + + /** + * Method to + * - save imported actions with updated policies + * - update default resource ids along with branch-name if the application is connected to git + * - update the map of imported collectionIds to the actionIds in saved in DB + * + * @param importedNewActionList action list extracted from the imported JSON file + * @param application imported and saved application in DB + * @return A DTO class with several information + */ + private Mono<ImportActionResultDTO> importActions( + List<NewAction> importedNewActionList, + Application application, + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + /* Mono.just(application) is created to avoid the eagerly fetching of existing actions + * during the pipeline construction. It should be fetched only when the pipeline is subscribed/executed. + */ + return Mono.just(application) + .flatMap(importedApplication -> { + Mono<Map<String, NewAction>> actionsInCurrentAppMono = repository + .findByApplicationId(importedApplication.getId()) + .filter(newAction -> newAction.getGitSyncId() != null) + .collectMap(NewAction::getGitSyncId); + + // find existing actions in all the branches of this application and put them in a map + Mono<Map<String, NewAction>> actionsInOtherBranchesMono; + if (importedApplication.getGitApplicationMetadata() != null) { + final String defaultApplicationId = + importedApplication.getGitApplicationMetadata().getDefaultApplicationId(); + actionsInOtherBranchesMono = repository + .findByDefaultApplicationId(defaultApplicationId, Optional.empty()) + .filter(newAction -> newAction.getGitSyncId() != null) + .collectMap(NewAction::getGitSyncId); + } else { + actionsInOtherBranchesMono = Mono.just(Collections.emptyMap()); + } + + return Mono.zip(actionsInCurrentAppMono, actionsInOtherBranchesMono) + .flatMap(objects -> { + Map<String, NewAction> actionsInCurrentApp = objects.getT1(); + Map<String, NewAction> actionsInOtherBranches = objects.getT2(); + + List<NewAction> newNewActionList = new ArrayList<>(); + List<NewAction> existingNewActionList = new ArrayList<>(); + + final String workspaceId = importedApplication.getWorkspaceId(); + + ImportActionResultDTO importActionResultDTO = new ImportActionResultDTO(); + + // existing actions will be required when we'll delete the outdated actions later + importActionResultDTO.setExistingActions(actionsInCurrentApp.values()); + + for (NewAction newAction : importedNewActionList) { + if (newAction.getUnpublishedAction() == null + || !org.springframework.util.StringUtils.hasLength(newAction + .getUnpublishedAction() + .getPageId())) { + continue; + } + + NewPage parentPage = new NewPage(); + ActionDTO unpublishedAction = newAction.getUnpublishedAction(); + ActionDTO publishedAction = newAction.getPublishedAction(); + + // If pageId is missing in the actionDTO create a fallback pageId + final String fallbackParentPageId = unpublishedAction.getPageId(); + + if (unpublishedAction.getValidName() != null) { + unpublishedAction.setId(newAction.getId()); + parentPage = updatePageInAction( + unpublishedAction, + mappedImportableResourcesDTO.getPageNameMap(), + importActionResultDTO.getActionIdMap()); + sanitizeDatasourceInActionDTO( + unpublishedAction, + mappedImportableResourcesDTO.getDatasourceNameToIdMap(), + mappedImportableResourcesDTO.getPluginMap(), + workspaceId, + false); + } + + if (publishedAction != null && publishedAction.getValidName() != null) { + publishedAction.setId(newAction.getId()); + if (!org.springframework.util.StringUtils.hasLength( + publishedAction.getPageId())) { + publishedAction.setPageId(fallbackParentPageId); + } + NewPage publishedActionPage = updatePageInAction( + publishedAction, + mappedImportableResourcesDTO.getPageNameMap(), + importActionResultDTO.getActionIdMap()); + parentPage = parentPage == null ? publishedActionPage : parentPage; + sanitizeDatasourceInActionDTO( + publishedAction, + mappedImportableResourcesDTO.getDatasourceNameToIdMap(), + mappedImportableResourcesDTO.getPluginMap(), + workspaceId, + false); + } + + newAction.makePristine(); + newAction.setWorkspaceId(workspaceId); + newAction.setApplicationId(importedApplication.getId()); + newAction.setPluginId(mappedImportableResourcesDTO + .getPluginMap() + .get(newAction.getPluginId())); + newActionService.generateAndSetActionPolicies(parentPage, newAction); + + // Check if the action has gitSyncId and if it's already in DB + if (newAction.getGitSyncId() != null + && actionsInCurrentApp.containsKey(newAction.getGitSyncId())) { + + // Since the resource is already present in DB, just update resource + NewAction existingAction = actionsInCurrentApp.get(newAction.getGitSyncId()); + updateExistingAction( + existingAction, + newAction, + importingMetaDTO.getBranchName(), + importingMetaDTO.getPermissionProvider()); + + // Add it to actions list that'll be updated in bulk + existingNewActionList.add(existingAction); + importActionResultDTO + .getImportedActionIds() + .add(existingAction.getId()); + putActionIdInMap(existingAction, importActionResultDTO); + } else { + // check whether user has permission to add new action + if (!importingMetaDTO + .getPermissionProvider() + .canCreateAction(parentPage)) { + log.error( + "User does not have permission to create action in page with id: {}", + parentPage.getId()); + throw new AppsmithException( + AppsmithError.ACL_NO_RESOURCE_FOUND, + FieldName.PAGE, + parentPage.getId()); + } + + // this will generate the id and other auto generated fields e.g. createdAt + newAction.updateForBulkWriteOperation(); + + // set gitSyncId if doesn't exist + if (newAction.getGitSyncId() == null) { + newAction.setGitSyncId(newAction.getApplicationId() + "_" + + Instant.now().toString()); + } + + if (importedApplication.getGitApplicationMetadata() != null) { + // application is git connected, check if the action is already present in + // any other branch + if (actionsInOtherBranches.containsKey(newAction.getGitSyncId())) { + // action found in other branch, copy the default resources from that + // action + NewAction branchedAction = + actionsInOtherBranches.get(newAction.getGitSyncId()); + newActionService.populateDefaultResources( + newAction, branchedAction, importingMetaDTO.getBranchName()); + } else { + // This is the first action we are saving with given gitSyncId in this + // instance + DefaultResources defaultResources = new DefaultResources(); + defaultResources.setApplicationId(importedApplication + .getGitApplicationMetadata() + .getDefaultApplicationId()); + defaultResources.setActionId(newAction.getId()); + defaultResources.setBranchName(importingMetaDTO.getBranchName()); + newAction.setDefaultResources(defaultResources); + } + } else { + DefaultResources defaultResources = new DefaultResources(); + defaultResources.setApplicationId(importedApplication.getId()); + defaultResources.setActionId(newAction.getId()); + newAction.setDefaultResources(defaultResources); + } + + // Add it to actions list that'll be inserted or updated in bulk + newNewActionList.add(newAction); + importActionResultDTO + .getImportedActionIds() + .add(newAction.getId()); + putActionIdInMap(newAction, importActionResultDTO); + } + } + + log.info( + "Saving actions in bulk. New: {}, Updated: {}", + newNewActionList.size(), + existingNewActionList.size()); + + mappedImportableResourcesDTO.setActionResultDTO(importActionResultDTO); + + // Save all the new actions in bulk + return repository + .bulkInsert(newNewActionList) + .then(repository.bulkUpdate(existingNewActionList)) + .thenReturn(importActionResultDTO); + }); + }) + .onErrorResume(e -> { + log.error("Error importing actions", e); + return Mono.error(e); + }) + .elapsed() + .map(tuple -> { + log.debug( + "time to import {} actions: {} ms", + tuple.getT2().getImportedActionIds().size(), + tuple.getT1()); + return tuple.getT2(); + }); + } + + private NewPage updatePageInAction( + ActionDTO action, Map<String, NewPage> pageNameMap, Map<String, String> actionIdMap) { + NewPage parentPage = pageNameMap.get(action.getPageId()); + if (parentPage == null) { + return null; + } + actionIdMap.put(action.getValidName() + parentPage.getId(), action.getId()); + action.setPageId(parentPage.getId()); + + // Update defaultResources in actionDTO + DefaultResources defaultResources = new DefaultResources(); + defaultResources.setPageId(parentPage.getDefaultResources().getPageId()); + action.setDefaultResources(defaultResources); + + return parentPage; + } + + private void updateExistingAction( + NewAction existingAction, + NewAction actionToImport, + String branchName, + ImportApplicationPermissionProvider permissionProvider) { + // Since the resource is already present in DB, just update resource + if (!permissionProvider.hasEditPermission(existingAction)) { + log.error("User does not have permission to edit action with id: {}", existingAction.getId()); + throw new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.ACTION, existingAction.getId()); + } + Set<Policy> existingPolicy = existingAction.getPolicies(); + copyNestedNonNullProperties(actionToImport, existingAction); + // Update branchName + existingAction.getDefaultResources().setBranchName(branchName); + // Recover the deleted state present in DB from imported action + existingAction + .getUnpublishedAction() + .setDeletedAt(actionToImport.getUnpublishedAction().getDeletedAt()); + existingAction.setDeletedAt(actionToImport.getDeletedAt()); + existingAction.setDeleted(actionToImport.getDeleted()); + existingAction.setPolicies(existingPolicy); + } + + private void putActionIdInMap(NewAction newAction, ImportActionResultDTO importActionResultDTO) { + // Populate actionIdsMap to associate the appropriate actions to run on page load + if (newAction.getUnpublishedAction() != null) { + ActionDTO unpublishedAction = newAction.getUnpublishedAction(); + importActionResultDTO + .getActionIdMap() + .put( + importActionResultDTO + .getActionIdMap() + .get(unpublishedAction.getValidName() + unpublishedAction.getPageId()), + newAction.getId()); + + if (unpublishedAction.getCollectionId() != null) { + importActionResultDTO + .getUnpublishedCollectionIdToActionIdsMap() + .putIfAbsent(unpublishedAction.getCollectionId(), new HashMap<>()); + final Map<String, String> actionIds = importActionResultDTO + .getUnpublishedCollectionIdToActionIdsMap() + .get(unpublishedAction.getCollectionId()); + actionIds.put(newAction.getDefaultResources().getActionId(), newAction.getId()); + } + } + if (newAction.getPublishedAction() != null) { + ActionDTO publishedAction = newAction.getPublishedAction(); + importActionResultDTO + .getActionIdMap() + .put( + importActionResultDTO + .getActionIdMap() + .get(publishedAction.getValidName() + publishedAction.getPageId()), + newAction.getId()); + + if (publishedAction.getCollectionId() != null) { + importActionResultDTO + .getPublishedCollectionIdToActionIdsMap() + .putIfAbsent(publishedAction.getCollectionId(), new HashMap<>()); + final Map<String, String> actionIds = importActionResultDTO + .getPublishedCollectionIdToActionIdsMap() + .get(publishedAction.getCollectionId()); + actionIds.put(newAction.getDefaultResources().getActionId(), newAction.getId()); + } + } + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/imports/NewActionImportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/imports/NewActionImportableServiceImpl.java new file mode 100644 index 000000000000..a7e8f9c3941d --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/imports/NewActionImportableServiceImpl.java @@ -0,0 +1,19 @@ +package com.appsmith.server.newactions.imports; + +import com.appsmith.server.actioncollections.base.ActionCollectionService; +import com.appsmith.server.domains.NewAction; +import com.appsmith.server.imports.importable.ImportableService; +import com.appsmith.server.newactions.base.NewActionService; +import com.appsmith.server.repositories.NewActionRepository; +import org.springframework.stereotype.Service; + +@Service +public class NewActionImportableServiceImpl extends NewActionImportableServiceCEImpl + implements ImportableService<NewAction> { + public NewActionImportableServiceImpl( + NewActionService newActionService, + NewActionRepository repository, + ActionCollectionService actionCollectionService) { + super(newActionService, repository, actionCollectionService); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/export/NewPageExportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/exports/NewPageExportableServiceCEImpl.java similarity index 99% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/export/NewPageExportableServiceCEImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/exports/NewPageExportableServiceCEImpl.java index 8ad8413b6eff..5dddb902d043 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/export/NewPageExportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/exports/NewPageExportableServiceCEImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.newpages.export; +package com.appsmith.server.newpages.exports; import com.appsmith.server.acl.AclPermission; import com.appsmith.server.constants.FieldName; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/export/NewPageExportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/exports/NewPageExportableServiceImpl.java similarity index 92% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/export/NewPageExportableServiceImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/exports/NewPageExportableServiceImpl.java index 15fa91088069..ba51d67cc47c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/export/NewPageExportableServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/exports/NewPageExportableServiceImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.newpages.export; +package com.appsmith.server.newpages.exports; import com.appsmith.server.domains.NewPage; import com.appsmith.server.exports.exportable.ExportableService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/imports/NewPageImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/imports/NewPageImportableServiceCEImpl.java new file mode 100644 index 000000000000..eecca835f625 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/imports/NewPageImportableServiceCEImpl.java @@ -0,0 +1,681 @@ +package com.appsmith.server.newpages.imports; + +import com.appsmith.external.models.DefaultResources; +import com.appsmith.external.models.Policy; +import com.appsmith.server.constants.FieldName; +import com.appsmith.server.constants.ResourceModes; +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.ApplicationPage; +import com.appsmith.server.domains.NewPage; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import com.appsmith.server.dtos.ce.ImportActionResultDTO; +import com.appsmith.server.dtos.ce.ImportedActionAndCollectionMapsDTO; +import com.appsmith.server.exceptions.AppsmithError; +import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.helpers.DefaultResourcesUtils; +import com.appsmith.server.helpers.TextUtils; +import com.appsmith.server.helpers.ce.ImportApplicationPermissionProvider; +import com.appsmith.server.imports.importable.ImportableServiceCE; +import com.appsmith.server.newactions.base.NewActionService; +import com.appsmith.server.newpages.base.NewPageService; +import com.appsmith.server.services.ApplicationPageService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.bson.types.ObjectId; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.util.function.Tuple2; +import reactor.util.function.Tuples; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; +import static com.appsmith.server.constants.ResourceModes.EDIT; +import static com.appsmith.server.constants.ResourceModes.VIEW; + +@Slf4j +public class NewPageImportableServiceCEImpl implements ImportableServiceCE<NewPage> { + + private final NewPageService newPageService; + private final ApplicationPageService applicationPageService; + private final NewActionService newActionService; + + public NewPageImportableServiceCEImpl( + NewPageService newPageService, + ApplicationPageService applicationPageService, + NewActionService newActionService) { + this.newPageService = newPageService; + this.applicationPageService = applicationPageService; + this.newActionService = newActionService; + } + + @Override + public Mono<List<NewPage>> importEntities( + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<Workspace> workspaceMono, + Mono<Application> applicationMono, + ApplicationJson applicationJson) { + + List<NewPage> importedNewPageList = applicationJson.getPageList(); + + // Import and save pages, also update the pages related fields in saved application + assert importedNewPageList != null : "Unable to find pages in the imported application"; + + // For git-sync this will not be empty + Mono<List<NewPage>> existingPagesMono = applicationMono + .flatMap(application -> newPageService + .findNewPagesByApplicationId(application.getId(), Optional.empty()) + .collectList()) + .cache(); + + Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono = getImportNewPagesMono( + importedNewPageList, + existingPagesMono, + applicationMono, + importingMetaDTO.getAppendToApp(), + importingMetaDTO.getBranchName(), + importingMetaDTO.getPermissionProvider(), + mappedImportableResourcesDTO) + .cache(); + + Mono<Map<String, NewPage>> pageNameMapMono = + getPageNameMapMono(importedNewPagesMono).cache(); + + Mono<Application> updatedApplicationMono = savePagesToApplicationMono( + applicationJson.getExportedApplication(), + pageNameMapMono, + applicationMono, + importingMetaDTO.getAppendToApp(), + importingMetaDTO.getApplicationId(), + existingPagesMono, + importedNewPagesMono, + mappedImportableResourcesDTO) + .cache(); + + return updatedApplicationMono.then(importedNewPagesMono).map(Tuple2::getT1); + } + + @Override + public Mono<Void> updateImportedEntities( + Application application, + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + + ImportedActionAndCollectionMapsDTO actionAndCollectionMapsDTO = + mappedImportableResourcesDTO.getActionAndCollectionMapsDTO(); + + ImportActionResultDTO importActionResultDTO = mappedImportableResourcesDTO.getActionResultDTO(); + List<NewPage> newPages = + mappedImportableResourcesDTO.getPageNameMap().values().stream().toList(); + return Flux.fromIterable(newPages) + .flatMap(newPage -> { + if (newPage.getDefaultResources() != null) { + newPage.getDefaultResources().setBranchName(importingMetaDTO.getBranchName()); + } + return mapActionAndCollectionIdWithPageLayout( + newPage, + importActionResultDTO.getActionIdMap(), + actionAndCollectionMapsDTO.getUnpublishedActionIdToCollectionIdMap(), + actionAndCollectionMapsDTO.getPublishedActionIdToCollectionIdMap()); + }) + .collectList() + .flatMapMany(newPageService::saveAll) + .collectList() + .then() + .onErrorResume(throwable -> { + log.error("Failed to set action ids in pages", throwable); + return Mono.error(throwable); + }); + } + + private Mono<Map<String, NewPage>> getPageNameMapMono( + Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono) { + return importedNewPagesMono.map(objects -> { + Map<String, NewPage> pageNameMap = new HashMap<>(); + objects.getT1().forEach(newPage -> { + // Save the map of pageName and NewPage + if (newPage.getUnpublishedPage() != null + && newPage.getUnpublishedPage().getName() != null) { + pageNameMap.put(newPage.getUnpublishedPage().getName(), newPage); + } + if (newPage.getPublishedPage() != null + && newPage.getPublishedPage().getName() != null) { + pageNameMap.put(newPage.getPublishedPage().getName(), newPage); + } + }); + return pageNameMap; + }); + } + + private Mono<Tuple2<List<NewPage>, Map<String, String>>> getImportNewPagesMono( + List<NewPage> importedNewPageList, + Mono<List<NewPage>> existingPagesMono, + Mono<Application> importApplicationMono, + boolean appendToApp, + String branchName, + ImportApplicationPermissionProvider permissionProvider, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + return Mono.just(importedNewPageList) + .zipWith(existingPagesMono) + .map(objects -> { + List<NewPage> importedNewPages = objects.getT1(); + List<NewPage> existingPages = objects.getT2(); + Map<String, String> newToOldNameMap; + if (appendToApp) { + newToOldNameMap = updateNewPagesBeforeMerge(existingPages, importedNewPages); + } else { + newToOldNameMap = Map.of(); + } + + mappedImportableResourcesDTO.setNewPageNameToOldPageNameMap(newToOldNameMap); + return Tuples.of(importedNewPages, newToOldNameMap); + }) + .zipWith(importApplicationMono) + .flatMap(objects -> { + List<NewPage> importedNewPages = objects.getT1().getT1(); + Map<String, String> newToOldNameMap = objects.getT1().getT2(); + Application application = objects.getT2(); + return importAndSavePages( + importedNewPages, application, branchName, existingPagesMono, permissionProvider) + .collectList() + .zipWith(Mono.just(newToOldNameMap)); + }) + .onErrorResume(throwable -> { + log.error("Error importing pages", throwable); + return Mono.error(throwable); + }) + .elapsed() + .map(objects -> { + log.debug("time to import {} pages: {}", objects.getT2().size(), objects.getT1()); + return objects.getT2(); + }); + } + + Mono<Application> savePagesToApplicationMono( + Application importedApplication, + Mono<Map<String, NewPage>> pageNameMapMono, + Mono<Application> applicationMono, + boolean appendToApp, + String applicationId, + Mono<List<NewPage>> existingPagesMono, + Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono, + MappedImportableResourcesDTO mappedImportableResourcesDTO) { + + List<ApplicationPage> editModeApplicationPages = importedApplication.getPages(); + List<ApplicationPage> publishedModeApplicationPages = importedApplication.getPublishedPages(); + + Mono<List<ApplicationPage>> unpublishedPagesMono = + importUnpublishedPages(editModeApplicationPages, appendToApp, applicationMono, importedNewPagesMono); + + Mono<List<ApplicationPage>> publishedPagesMono = Mono.just(publishedModeApplicationPages); + + Mono<Map<ResourceModes, List<ApplicationPage>>> applicationPagesMono = Mono.zip( + unpublishedPagesMono, publishedPagesMono, pageNameMapMono, applicationMono) + .map(objects -> { + List<ApplicationPage> unpublishedPages = objects.getT1(); + List<ApplicationPage> publishedPages = objects.getT2(); + Map<String, NewPage> pageNameMap = objects.getT3(); + Application savedApp = objects.getT4(); + + mappedImportableResourcesDTO.setPageNameMap(pageNameMap); + + log.debug("New pages imported for application: {}", savedApp.getId()); + Map<ResourceModes, List<ApplicationPage>> applicationPages = new HashMap<>(); + applicationPages.put(EDIT, unpublishedPages); + applicationPages.put(VIEW, publishedPages); + + Iterator<ApplicationPage> unpublishedPageItr = unpublishedPages.iterator(); + while (unpublishedPageItr.hasNext()) { + ApplicationPage applicationPage = unpublishedPageItr.next(); + NewPage newPage = pageNameMap.get(applicationPage.getId()); + if (newPage == null) { + if (appendToApp) { + // Don't remove the page reference if doing the partial import and appending + // to the existing application + continue; + } + log.debug( + "Unable to find the page during import for appId {}, with name {}", + applicationId, + applicationPage.getId()); + unpublishedPageItr.remove(); + } else { + applicationPage.setId(newPage.getId()); + applicationPage.setDefaultPageId( + newPage.getDefaultResources().getPageId()); + // Keep the existing page as the default one + if (appendToApp) { + applicationPage.setIsDefault(false); + } + } + } + + Iterator<ApplicationPage> publishedPagesItr; + // Remove the newly added pages from merge app flow. Keep only the existing page from the old app + if (appendToApp) { + List<String> existingPagesId = savedApp.getPublishedPages().stream() + .map(applicationPage -> applicationPage.getId()) + .collect(Collectors.toList()); + List<ApplicationPage> publishedApplicationPages = publishedPages.stream() + .filter(applicationPage -> existingPagesId.contains(applicationPage.getId())) + .collect(Collectors.toList()); + applicationPages.replace(VIEW, publishedApplicationPages); + publishedPagesItr = publishedApplicationPages.iterator(); + } else { + publishedPagesItr = publishedPages.iterator(); + } + while (publishedPagesItr.hasNext()) { + ApplicationPage applicationPage = publishedPagesItr.next(); + NewPage newPage = pageNameMap.get(applicationPage.getId()); + if (newPage == null) { + log.debug( + "Unable to find the page during import for appId {}, with name {}", + applicationId, + applicationPage.getId()); + if (!appendToApp) { + publishedPagesItr.remove(); + } + } else { + applicationPage.setId(newPage.getId()); + applicationPage.setDefaultPageId( + newPage.getDefaultResources().getPageId()); + if (appendToApp) { + applicationPage.setIsDefault(false); + } + } + } + + return applicationPages; + }); + + if (!StringUtils.isEmpty(applicationId) && !appendToApp) { + applicationPagesMono = applicationPagesMono + .zipWith(existingPagesMono) + .flatMap(objects -> { + Map<ResourceModes, List<ApplicationPage>> applicationPages = objects.getT1(); + List<NewPage> existingPagesList = objects.getT2(); + Set<String> validPageIds = applicationPages.get(EDIT).stream() + .map(ApplicationPage::getId) + .collect(Collectors.toSet()); + + validPageIds.addAll(applicationPages.get(VIEW).stream() + .map(ApplicationPage::getId) + .collect(Collectors.toSet())); + + Set<String> invalidPageIds = new HashSet<>(); + for (NewPage newPage : existingPagesList) { + if (!validPageIds.contains(newPage.getId())) { + invalidPageIds.add(newPage.getId()); + } + } + + // Delete the pages which were removed during git merge operation + // This does not apply to the traditional import via file approach + return Flux.fromIterable(invalidPageIds) + .flatMap(applicationPageService::deleteWithoutPermissionUnpublishedPage) + .flatMap(page -> newPageService + .archiveWithoutPermissionById(page.getId()) + .onErrorResume(e -> { + log.debug( + "Unable to archive page {} with error {}", + page.getId(), + e.getMessage()); + return Mono.empty(); + })) + .then() + .thenReturn(applicationPages); + }); + } + return applicationMono.zipWith(applicationPagesMono).map(objects -> { + Application application = objects.getT1(); + Map<ResourceModes, List<ApplicationPage>> applicationPages = objects.getT2(); + application.setPages(applicationPages.get(EDIT)); + application.setPublishedPages(applicationPages.get(VIEW)); + return application; + }); + } + + /** + * Method to + * - save imported pages + * - update the mongoEscapedWidgets if present in the page + * - set the policies for the page + * - update default resource ids along with branch-name if the application is connected to git + * + * @param pages pagelist extracted from the imported JSON file + * @param application saved application where pages needs to be added + * @param branchName to which branch pages should be imported if application is connected to git + * @param existingPages existing pages in DB if the application is connected to git + * @return flux of saved pages in DB + */ + private Flux<NewPage> importAndSavePages( + List<NewPage> pages, + Application application, + String branchName, + Mono<List<NewPage>> existingPages, + ImportApplicationPermissionProvider permissionProvider) { + + Map<String, String> oldToNewLayoutIds = new HashMap<>(); + pages.forEach(newPage -> { + newPage.setApplicationId(application.getId()); + if (newPage.getUnpublishedPage() != null) { + applicationPageService.generateAndSetPagePolicies(application, newPage.getUnpublishedPage()); + newPage.setPolicies(newPage.getUnpublishedPage().getPolicies()); + newPage.getUnpublishedPage().getLayouts().forEach(layout -> { + String layoutId = new ObjectId().toString(); + oldToNewLayoutIds.put(layout.getId(), layoutId); + layout.setId(layoutId); + }); + } + + if (newPage.getPublishedPage() != null) { + applicationPageService.generateAndSetPagePolicies(application, newPage.getPublishedPage()); + newPage.getPublishedPage().getLayouts().forEach(layout -> { + String layoutId = oldToNewLayoutIds.containsKey(layout.getId()) + ? oldToNewLayoutIds.get(layout.getId()) + : new ObjectId().toString(); + layout.setId(layoutId); + }); + } + }); + + return existingPages + .flatMapMany(existingSavedPages -> { + Map<String, NewPage> savedPagesGitIdToPageMap = new HashMap<>(); + + existingSavedPages.stream() + .filter(newPage -> !StringUtils.isEmpty(newPage.getGitSyncId())) + .forEach(newPage -> savedPagesGitIdToPageMap.put(newPage.getGitSyncId(), newPage)); + + return Flux.fromIterable(pages).flatMap(newPage -> { + log.debug( + "Importing page: {}", + newPage.getUnpublishedPage().getName()); + // Check if the page has gitSyncId and if it's already in DB + if (newPage.getGitSyncId() != null + && savedPagesGitIdToPageMap.containsKey(newPage.getGitSyncId())) { + // Since the resource is already present in DB, just update resource + NewPage existingPage = savedPagesGitIdToPageMap.get(newPage.getGitSyncId()); + if (!permissionProvider.hasEditPermission(existingPage)) { + log.error( + "User does not have permission to edit page with id: {}", existingPage.getId()); + return Mono.error(new AppsmithException( + AppsmithError.ACL_NO_RESOURCE_FOUND, FieldName.PAGE, existingPage.getId())); + } + Set<Policy> existingPagePolicy = existingPage.getPolicies(); + copyNestedNonNullProperties(newPage, existingPage); + // Update branchName + existingPage.getDefaultResources().setBranchName(branchName); + // Recover the deleted state present in DB from imported page + existingPage + .getUnpublishedPage() + .setDeletedAt(newPage.getUnpublishedPage().getDeletedAt()); + existingPage.setDeletedAt(newPage.getDeletedAt()); + existingPage.setDeleted(newPage.getDeleted()); + existingPage.setPolicies(existingPagePolicy); + return newPageService.save(existingPage); + } else { + // check if user has permission to add new page to the application + if (!permissionProvider.canCreatePage(application)) { + log.error( + "User does not have permission to create page in application with id: {}", + application.getId()); + return Mono.error(new AppsmithException( + AppsmithError.ACL_NO_RESOURCE_FOUND, + FieldName.APPLICATION, + application.getId())); + } + if (application.getGitApplicationMetadata() != null) { + final String defaultApplicationId = + application.getGitApplicationMetadata().getDefaultApplicationId(); + return newPageService + .findByGitSyncIdAndDefaultApplicationId( + defaultApplicationId, newPage.getGitSyncId(), Optional.empty()) + .switchIfEmpty(Mono.defer(() -> { + // This is the first page we are saving with given gitSyncId in this + // instance + DefaultResources defaultResources = new DefaultResources(); + defaultResources.setApplicationId(defaultApplicationId); + defaultResources.setBranchName(branchName); + newPage.setDefaultResources(defaultResources); + return saveNewPageAndUpdateDefaultResources(newPage, branchName); + })) + .flatMap(branchedPage -> { + DefaultResources defaultResources = branchedPage.getDefaultResources(); + // Create new page but keep defaultApplicationId and defaultPageId same for + // both the + // pages + defaultResources.setBranchName(branchName); + newPage.setDefaultResources(defaultResources); + newPage.getUnpublishedPage() + .setDeletedAt(branchedPage + .getUnpublishedPage() + .getDeletedAt()); + newPage.setDeletedAt(branchedPage.getDeletedAt()); + newPage.setDeleted(branchedPage.getDeleted()); + // Set policies from existing branch object + newPage.setPolicies(branchedPage.getPolicies()); + return newPageService.save(newPage); + }); + } + return saveNewPageAndUpdateDefaultResources(newPage, branchName); + } + }); + }) + .onErrorResume(error -> { + log.error("Error importing page", error); + return Mono.error(error); + }); + } + + private Mono<NewPage> saveNewPageAndUpdateDefaultResources(NewPage newPage, String branchName) { + NewPage update = new NewPage(); + return newPageService.save(newPage).flatMap(page -> { + update.setDefaultResources( + DefaultResourcesUtils.createDefaultIdsOrUpdateWithGivenResourceIds(page, branchName) + .getDefaultResources()); + return newPageService.update(page.getId(), update); + }); + } + + private Map<String, String> updateNewPagesBeforeMerge(List<NewPage> existingPages, List<NewPage> importedPages) { + Map<String, String> newToOldToPageNameMap = new HashMap<>(); // maps new names with old names + + // get a list of unpublished page names that already exists + List<String> unpublishedPageNames = existingPages.stream() + .filter(newPage -> newPage.getUnpublishedPage() != null) + .map(newPage -> newPage.getUnpublishedPage().getName()) + .collect(Collectors.toList()); + + // modify each new page + for (NewPage newPage : importedPages) { + newPage.setPublishedPage(null); // we'll not merge published pages so removing this + + // let's check if page name conflicts, rename in that case + String oldPageName = newPage.getUnpublishedPage().getName(), + newPageName = newPage.getUnpublishedPage().getName(); + + int i = 1; + while (unpublishedPageNames.contains(newPageName)) { + i++; + newPageName = oldPageName + i; + } + newPage.getUnpublishedPage().setName(newPageName); // set new name. may be same as before or not + newPage.getUnpublishedPage().setSlug(TextUtils.makeSlug(newPageName)); // set the slug also + newToOldToPageNameMap.put(newPageName, oldPageName); // map: new name -> old name + } + return newToOldToPageNameMap; + } + + private Mono<List<ApplicationPage>> importUnpublishedPages( + List<ApplicationPage> editModeApplicationPages, + boolean appendToApp, + Mono<Application> importApplicationMono, + Mono<Tuple2<List<NewPage>, Map<String, String>>> importedNewPagesMono) { + Mono<List<ApplicationPage>> unpublishedPagesMono = Mono.just(editModeApplicationPages); + if (appendToApp) { + unpublishedPagesMono = unpublishedPagesMono + .zipWith(importApplicationMono) + .map(objects -> { + Application application = objects.getT2(); + List<ApplicationPage> applicationPages = objects.getT1(); + applicationPages.addAll(application.getPages()); + return applicationPages; + }) + .zipWith(importedNewPagesMono) + .map(objects -> { + List<ApplicationPage> unpublishedPages = objects.getT1(); + Map<String, String> newToOldNameMap = objects.getT2().getT2(); + List<NewPage> importedPages = objects.getT2().getT1(); + for (NewPage newPage : importedPages) { + // we need to map the newly created page with old name + // because other related resources e.g. actions will refer the page with old name + String newPageName = newPage.getUnpublishedPage().getName(); + if (newToOldNameMap.containsKey(newPageName)) { + String oldPageName = newToOldNameMap.get(newPageName); + unpublishedPages.stream() + .filter(applicationPage -> oldPageName.equals(applicationPage.getId())) + .findAny() + .ifPresent(applicationPage -> applicationPage.setId(newPageName)); + } + } + return unpublishedPages; + }); + } + return unpublishedPagesMono; + } + + // This method will update the action id in saved page for layoutOnLoadAction + private Mono<NewPage> mapActionAndCollectionIdWithPageLayout( + NewPage newPage, + Map<String, String> actionIdMap, + Map<String, List<String>> unpublishedActionIdToCollectionIdsMap, + Map<String, List<String>> publishedActionIdToCollectionIdsMap) { + + return Mono.just(newPage) + .flatMap(page -> { + return newActionService + .findAllById(getLayoutOnLoadActionsForPage( + page, + actionIdMap, + unpublishedActionIdToCollectionIdsMap, + publishedActionIdToCollectionIdsMap)) + .map(newAction -> { + final String defaultActionId = + newAction.getDefaultResources().getActionId(); + if (page.getUnpublishedPage().getLayouts() != null) { + final String defaultCollectionId = newAction + .getUnpublishedAction() + .getDefaultResources() + .getCollectionId(); + page.getUnpublishedPage().getLayouts().forEach(layout -> { + if (layout.getLayoutOnLoadActions() != null) { + layout.getLayoutOnLoadActions() + .forEach(onLoadAction -> onLoadAction.stream() + .filter(actionDTO -> StringUtils.equals( + actionDTO.getId(), newAction.getId())) + .forEach(actionDTO -> { + actionDTO.setDefaultActionId(defaultActionId); + actionDTO.setDefaultCollectionId(defaultCollectionId); + })); + } + }); + } + + if (page.getPublishedPage() != null + && page.getPublishedPage().getLayouts() != null) { + page.getPublishedPage().getLayouts().forEach(layout -> { + if (layout.getLayoutOnLoadActions() != null) { + layout.getLayoutOnLoadActions() + .forEach(onLoadAction -> onLoadAction.stream() + .filter(actionDTO -> StringUtils.equals( + actionDTO.getId(), newAction.getId())) + .forEach(actionDTO -> { + actionDTO.setDefaultActionId(defaultActionId); + if (newAction.getPublishedAction() != null + && newAction + .getPublishedAction() + .getDefaultResources() + != null) { + actionDTO.setDefaultCollectionId(newAction + .getPublishedAction() + .getDefaultResources() + .getCollectionId()); + } + })); + } + }); + } + return newAction; + }) + .collectList() + .thenReturn(page); + }) + .onErrorResume(error -> { + log.error("Error while updating action collection id in page layout", error); + return Mono.error(error); + }); + } + + private Set<String> getLayoutOnLoadActionsForPage( + NewPage page, + Map<String, String> actionIdMap, + Map<String, List<String>> unpublishedActionIdToCollectionIdsMap, + Map<String, List<String>> publishedActionIdToCollectionIdsMap) { + Set<String> layoutOnLoadActions = new HashSet<>(); + if (page.getUnpublishedPage().getLayouts() != null) { + + page.getUnpublishedPage().getLayouts().forEach(layout -> { + if (layout.getLayoutOnLoadActions() != null) { + layout.getLayoutOnLoadActions() + .forEach(onLoadAction -> onLoadAction.forEach(actionDTO -> { + actionDTO.setId(actionIdMap.get(actionDTO.getId())); + if (!CollectionUtils.sizeIsEmpty(unpublishedActionIdToCollectionIdsMap) + && !CollectionUtils.isEmpty( + unpublishedActionIdToCollectionIdsMap.get(actionDTO.getId()))) { + actionDTO.setCollectionId(unpublishedActionIdToCollectionIdsMap + .get(actionDTO.getId()) + .get(0)); + } + layoutOnLoadActions.add(actionDTO.getId()); + })); + } + }); + } + + if (page.getPublishedPage() != null && page.getPublishedPage().getLayouts() != null) { + + page.getPublishedPage().getLayouts().forEach(layout -> { + if (layout.getLayoutOnLoadActions() != null) { + layout.getLayoutOnLoadActions() + .forEach(onLoadAction -> onLoadAction.forEach(actionDTO -> { + actionDTO.setId(actionIdMap.get(actionDTO.getId())); + if (!CollectionUtils.sizeIsEmpty(publishedActionIdToCollectionIdsMap) + && !CollectionUtils.isEmpty( + publishedActionIdToCollectionIdsMap.get(actionDTO.getId()))) { + actionDTO.setCollectionId(publishedActionIdToCollectionIdsMap + .get(actionDTO.getId()) + .get(0)); + } + layoutOnLoadActions.add(actionDTO.getId()); + })); + } + }); + } + + layoutOnLoadActions.remove(null); + return layoutOnLoadActions; + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/imports/NewPageImportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/imports/NewPageImportableServiceImpl.java new file mode 100644 index 000000000000..aa785d6f3160 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/imports/NewPageImportableServiceImpl.java @@ -0,0 +1,18 @@ +package com.appsmith.server.newpages.imports; + +import com.appsmith.server.domains.NewPage; +import com.appsmith.server.imports.importable.ImportableService; +import com.appsmith.server.newactions.base.NewActionService; +import com.appsmith.server.newpages.base.NewPageService; +import com.appsmith.server.services.ApplicationPageService; +import org.springframework.stereotype.Service; + +@Service +public class NewPageImportableServiceImpl extends NewPageImportableServiceCEImpl implements ImportableService<NewPage> { + public NewPageImportableServiceImpl( + NewPageService newPageService, + ApplicationPageService applicationPageService, + NewActionService newActionService) { + super(newPageService, applicationPageService, newActionService); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/export/PluginExportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/exports/PluginExportableServiceCEImpl.java similarity index 98% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/export/PluginExportableServiceCEImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/exports/PluginExportableServiceCEImpl.java index 761560992bde..037afc8e7866 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/export/PluginExportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/exports/PluginExportableServiceCEImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.plugins.export; +package com.appsmith.server.plugins.exports; import com.appsmith.server.domains.Application; import com.appsmith.server.domains.Plugin; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/export/PluginExportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/exports/PluginExportableServiceImpl.java similarity index 92% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/export/PluginExportableServiceImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/exports/PluginExportableServiceImpl.java index 16987de35c29..48b229d6e488 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/export/PluginExportableServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/exports/PluginExportableServiceImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.plugins.export; +package com.appsmith.server.plugins.exports; import com.appsmith.server.domains.Plugin; import com.appsmith.server.exports.exportable.ExportableService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/imports/PluginImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/imports/PluginImportableServiceCEImpl.java new file mode 100644 index 000000000000..7af0a44ec2a3 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/imports/PluginImportableServiceCEImpl.java @@ -0,0 +1,58 @@ +package com.appsmith.server.plugins.imports; + +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.Plugin; +import com.appsmith.server.domains.QPlugin; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.domains.WorkspacePlugin; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import com.appsmith.server.imports.importable.ImportableServiceCE; +import com.appsmith.server.plugins.base.PluginService; +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.stream.Collectors; + +import static com.appsmith.server.repositories.ce.BaseAppsmithRepositoryCEImpl.fieldName; + +@Slf4j +public class PluginImportableServiceCEImpl implements ImportableServiceCE<Plugin> { + private final PluginService pluginService; + + public PluginImportableServiceCEImpl(PluginService pluginService) { + this.pluginService = pluginService; + } + + @Override + public Mono<List<Plugin>> importEntities( + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<Workspace> workspaceMono, + Mono<Application> applicationMono, + ApplicationJson applicationJson) { + return workspaceMono + .map(workspace -> workspace.getPlugins().stream() + .map(WorkspacePlugin::getPluginId) + .collect(Collectors.toSet())) + .flatMapMany(pluginIds -> pluginService.findAllByIdsWithoutPermission( + pluginIds, + List.of(fieldName(QPlugin.plugin.pluginName), fieldName(QPlugin.plugin.packageName)))) + .map(plugin -> { + mappedImportableResourcesDTO + .getPluginMap() + .put( + plugin.getPluginName() == null ? plugin.getPackageName() : plugin.getPluginName(), + plugin.getId()); + return plugin; + }) + .collectList() + .elapsed() + .map(tuples -> { + log.debug("time to get plugin map: {}", tuples.getT1()); + return tuples.getT2(); + }); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/imports/PluginImportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/imports/PluginImportableServiceImpl.java new file mode 100644 index 000000000000..556911a7b702 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/imports/PluginImportableServiceImpl.java @@ -0,0 +1,13 @@ +package com.appsmith.server.plugins.imports; + +import com.appsmith.server.domains.Plugin; +import com.appsmith.server.imports.importable.ImportableService; +import com.appsmith.server.plugins.base.PluginService; +import org.springframework.stereotype.Service; + +@Service +public class PluginImportableServiceImpl extends PluginImportableServiceCEImpl implements ImportableService<Plugin> { + public PluginImportableServiceImpl(PluginService pluginService) { + super(pluginService); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/base/ThemeServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/base/ThemeServiceCE.java index d89858c114fb..3c75e6c10b95 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/base/ThemeServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/base/ThemeServiceCE.java @@ -4,7 +4,6 @@ import com.appsmith.server.domains.Application; import com.appsmith.server.domains.ApplicationMode; import com.appsmith.server.domains.Theme; -import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.services.CrudService; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -61,6 +60,4 @@ public interface ThemeServiceCE extends CrudService<Theme, String> { Mono<Theme> getOrSaveTheme(Theme theme, Application destApplication); Mono<Application> archiveApplicationThemes(Application application); - - Mono<Application> importThemesToApplication(Application destinationApp, ApplicationJson sourceJson); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/base/ThemeServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/base/ThemeServiceCEImpl.java index d2b3f5c2791e..e73a7ba2e802 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/base/ThemeServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/base/ThemeServiceCEImpl.java @@ -7,7 +7,6 @@ import com.appsmith.server.domains.Application; import com.appsmith.server.domains.ApplicationMode; import com.appsmith.server.domains.Theme; -import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.repositories.ApplicationRepository; @@ -484,72 +483,4 @@ public Mono<Application> archiveApplicationThemes(Application application) { application.getEditModeThemeId(), application.getPublishedModeThemeId())) .thenReturn(application); } - - /** - * This method imports a theme from a JSON file to an application. The destination application can already have - * a theme set or not. If no theme is set, it means the application is being created from a JSON import, git import. - * In that case, we'll import the edit mode theme and published mode theme from the JSON file and update the application. - * If the destination application already has a theme, it means we're doing any of these Git operations - - * pull, merge, discard. In this case, we'll decide based on this decision tree: - * - If current theme is a customized one and source theme is also customized, replace the current theme properties with source theme properties - * - If current theme is a customized one and source theme is system theme, set the current theme to system and delete the old one - * - If current theme is system theme, update the current theme as per source theme - * - * @param destinationApp Application object - * @param sourceJson ApplicationJSON from file or Git - * @return Updated application that has editModeThemeId and publishedModeThemeId set - */ - @Override - public Mono<Application> importThemesToApplication(Application destinationApp, ApplicationJson sourceJson) { - Mono<Theme> editModeTheme = updateExistingAppThemeFromJSON( - destinationApp, destinationApp.getEditModeThemeId(), sourceJson.getEditModeTheme()); - - Mono<Theme> publishedModeTheme = updateExistingAppThemeFromJSON( - destinationApp, destinationApp.getPublishedModeThemeId(), sourceJson.getPublishedTheme()); - - return Mono.zip(editModeTheme, publishedModeTheme) - .flatMap(importedThemesTuple -> { - String editModeThemeId = importedThemesTuple.getT1().getId(); - String publishedModeThemeId = importedThemesTuple.getT2().getId(); - - destinationApp.setEditModeThemeId(editModeThemeId); - destinationApp.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( - destinationApp.getId(), - editModeThemeId, - publishedModeThemeId, - applicationPermission.getEditPermission()) - .thenReturn(destinationApp); - }) - .switchIfEmpty( - Mono.error(new AppsmithException(AppsmithError.GENERIC_BAD_REQUEST, "Failed to import theme"))); - } - - private Mono<Theme> updateExistingAppThemeFromJSON( - Application destinationApp, String existingThemeId, Theme themeFromJson) { - if (!StringUtils.hasLength(existingThemeId)) { - return getOrSaveTheme(themeFromJson, destinationApp); - } - - return repository - .findById(existingThemeId) - .defaultIfEmpty(new Theme()) // fallback when application theme is deleted - .flatMap(existingTheme -> { - if (!StringUtils.hasLength(existingTheme.getId()) || existingTheme.isSystemTheme()) { - return getOrSaveTheme(themeFromJson, destinationApp); - } else { - if (themeFromJson.isSystemTheme()) { - return getOrSaveTheme(themeFromJson, destinationApp).flatMap(importedTheme -> { - // need to delete the old existingTheme - return repository.archiveById(existingThemeId).thenReturn(importedTheme); - }); - } else { - return repository.updateById(existingThemeId, themeFromJson, MANAGE_THEMES); - } - } - }); - } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/export/ThemeExportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/exports/ThemeExportableServiceCEImpl.java similarity index 98% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/themes/export/ThemeExportableServiceCEImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/themes/exports/ThemeExportableServiceCEImpl.java index dfbf2d1201ce..acb62087e53f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/export/ThemeExportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/exports/ThemeExportableServiceCEImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.themes.export; +package com.appsmith.server.themes.exports; import com.appsmith.server.domains.Application; import com.appsmith.server.domains.Theme; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/export/ThemeExportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/exports/ThemeExportableServiceImpl.java similarity index 90% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/themes/export/ThemeExportableServiceImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/themes/exports/ThemeExportableServiceImpl.java index 37f64c9246fe..754e740a5828 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/export/ThemeExportableServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/exports/ThemeExportableServiceImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.themes.export; +package com.appsmith.server.themes.exports; import com.appsmith.server.domains.Theme; import com.appsmith.server.exports.exportable.ExportableService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/imports/ThemeImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/imports/ThemeImportableServiceCEImpl.java new file mode 100644 index 000000000000..34bca98bf29e --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/imports/ThemeImportableServiceCEImpl.java @@ -0,0 +1,124 @@ +package com.appsmith.server.themes.imports; + +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.Theme; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import com.appsmith.server.exceptions.AppsmithError; +import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.imports.importable.ImportableServiceCE; +import com.appsmith.server.repositories.ThemeRepository; +import com.appsmith.server.services.ApplicationService; +import com.appsmith.server.solutions.ApplicationPermission; +import com.appsmith.server.themes.base.ThemeService; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Mono; + +import java.util.List; + +import static com.appsmith.server.acl.AclPermission.MANAGE_THEMES; + +public class ThemeImportableServiceCEImpl implements ImportableServiceCE<Theme> { + + private final ThemeService themeService; + private final ThemeRepository repository; + private final ApplicationService applicationService; + private final ApplicationPermission applicationPermission; + + public ThemeImportableServiceCEImpl( + ThemeService themeService, + ThemeRepository repository, + ApplicationService applicationService, + ApplicationPermission applicationPermission) { + this.themeService = themeService; + this.repository = repository; + this.applicationService = applicationService; + this.applicationPermission = applicationPermission; + } + + /** + * This method imports a theme from a JSON file to an application. The destination application can already have + * a theme set or not. If no theme is set, it means the application is being created from a JSON import, git import. + * In that case, we'll import the edit mode theme and published mode theme from the JSON file and update the application. + * If the destination application already has a theme, it means we're doing any of these Git operations - + * pull, merge, discard. In this case, we'll decide based on this decision tree: + * - If current theme is a customized one and source theme is also customized, replace the current theme properties with source theme properties + * - If current theme is a customized one and source theme is system theme, set the current theme to system and delete the old one + * - If current theme is system theme, update the current theme as per source theme + * + * @param applicationJson ApplicationJSON from file or Git + * @return Updated application that has editModeThemeId and publishedModeThemeId set + */ + @Override + public Mono<List<Theme>> importEntities( + ImportingMetaDTO importingMetaDTO, + MappedImportableResourcesDTO mappedImportableResourcesDTO, + Mono<Workspace> workspaceMono, + Mono<Application> applicationMono, + ApplicationJson applicationJson) { + if (Boolean.TRUE.equals(importingMetaDTO.getAppendToApp())) { + // appending to existing app, theme should not change + return Mono.just(List.of()); + } + return applicationMono.flatMap(destinationApp -> { + Mono<Theme> editModeTheme = updateExistingAppThemeFromJSON( + destinationApp, destinationApp.getEditModeThemeId(), applicationJson.getEditModeTheme()); + + Mono<Theme> publishedModeTheme = updateExistingAppThemeFromJSON( + destinationApp, destinationApp.getPublishedModeThemeId(), applicationJson.getPublishedTheme()); + + return Mono.zip(editModeTheme, publishedModeTheme) + .flatMap(importedThemesTuple -> { + String editModeThemeId = importedThemesTuple.getT1().getId(); + String publishedModeThemeId = + importedThemesTuple.getT2().getId(); + + destinationApp.setEditModeThemeId(editModeThemeId); + destinationApp.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( + destinationApp.getId(), + editModeThemeId, + publishedModeThemeId, + applicationPermission.getEditPermission()) + .thenReturn(List.<Theme>of()); + }) + .switchIfEmpty(Mono.error( + new AppsmithException(AppsmithError.GENERIC_BAD_REQUEST, "Failed to import theme"))); + }); + } + + private Mono<Theme> updateExistingAppThemeFromJSON( + Application destinationApp, String existingThemeId, Theme themeFromJson) { + if (!StringUtils.hasLength(existingThemeId)) { + return themeService.getOrSaveTheme(themeFromJson, destinationApp); + } + + return repository + .findById(existingThemeId) + .defaultIfEmpty(new Theme()) // fallback when application theme is deleted + .flatMap(existingTheme -> { + if (!StringUtils.hasLength(existingTheme.getId()) || existingTheme.isSystemTheme()) { + return themeService.getOrSaveTheme(themeFromJson, destinationApp); + } else { + if (themeFromJson.isSystemTheme()) { + return themeService + .getOrSaveTheme(themeFromJson, destinationApp) + .flatMap(importedTheme -> { + // need to delete the old existingTheme + return repository + .archiveById(existingThemeId) + .thenReturn(importedTheme); + }); + } else { + return repository.updateById(existingThemeId, themeFromJson, MANAGE_THEMES); + } + } + }); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/imports/ThemeImportableServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/imports/ThemeImportableServiceImpl.java new file mode 100644 index 000000000000..b1fde5790cde --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/themes/imports/ThemeImportableServiceImpl.java @@ -0,0 +1,21 @@ +package com.appsmith.server.themes.imports; + +import com.appsmith.server.domains.Theme; +import com.appsmith.server.imports.importable.ImportableService; +import com.appsmith.server.repositories.ThemeRepository; +import com.appsmith.server.services.ApplicationService; +import com.appsmith.server.solutions.ApplicationPermission; +import com.appsmith.server.themes.base.ThemeService; +import org.springframework.stereotype.Service; + +@Service +public class ThemeImportableServiceImpl extends ThemeImportableServiceCEImpl implements ImportableService<Theme> { + + public ThemeImportableServiceImpl( + ThemeService themeService, + ThemeRepository repository, + ApplicationService applicationService, + ApplicationPermission applicationPermission) { + super(themeService, repository, applicationService, applicationPermission); + } +} 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 c01b7e47b83b..b0bb162ae85e 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 @@ -8,7 +8,6 @@ import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; -import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.dtos.InviteUsersDTO; import com.appsmith.server.dtos.UpdatePermissionGroupDTO; import com.appsmith.server.exceptions.AppsmithError; @@ -862,72 +861,4 @@ public void updateName_WhenCustomTheme_NameUpdated() { }) .verifyComplete(); } - - @WithUserDetails("api_user") - @Test - public void importThemesToApplication_WhenBothImportedThemesAreCustom_NewThemesCreated() { - Application application = createApplication(); - - // create a application json with a custom theme set as both edit mode and published mode - ApplicationJson applicationJson = new ApplicationJson(); - Theme customTheme = new Theme(); - customTheme.setName("Custom theme name"); - customTheme.setDisplayName("Custom theme display name"); - applicationJson.setEditModeTheme(customTheme); - applicationJson.setPublishedTheme(customTheme); - - Mono<Application> applicationMono = Mono.just(application) - .flatMap(savedApplication -> themeService - .importThemesToApplication(savedApplication, applicationJson) - .thenReturn(savedApplication.getId())) - .flatMap(applicationId -> applicationRepository.findById(applicationId, MANAGE_APPLICATIONS)); - - StepVerifier.create(applicationMono) - .assertNext(app -> { - assertThat(app.getEditModeThemeId().equals(app.getPublishedModeThemeId())) - .isFalse(); - }) - .verifyComplete(); - } - - @WithUserDetails("api_user") - @Test - public void importThemesToApplication_ApplicationThemeNotFound_DefaultThemeImported() { - Theme defaultTheme = - themeRepository.getSystemThemeByName(Theme.DEFAULT_THEME_NAME).block(); - - // create the theme information present in the application JSON - Theme themeInJson = new Theme(); - themeInJson.setSystemTheme(true); - themeInJson.setName(defaultTheme.getName()); - - // create a application json with the above theme set in both modes - ApplicationJson applicationJson = new ApplicationJson(); - applicationJson.setEditModeTheme(themeInJson); - applicationJson.setPublishedTheme(themeInJson); - - Mono<Application> applicationMono = Mono.just(createApplication()) - .map(application -> { - // setting invalid ids to themes to check the case - application.setEditModeThemeId(UUID.randomUUID().toString()); - application.setPublishedModeThemeId(UUID.randomUUID().toString()); - return application; - }) - .flatMap(applicationRepository::save) - .flatMap(savedApplication -> { - assert savedApplication.getId() != null; - return themeService - .importThemesToApplication(savedApplication, applicationJson) - .thenReturn(savedApplication.getId()); - }) - .flatMap(applicationId -> applicationRepository.findById(applicationId, MANAGE_APPLICATIONS)); - - StepVerifier.create(applicationMono) - .assertNext(app -> { - // both edit mode and published mode should have default theme set - assertThat(app.getEditModeThemeId()).isEqualTo(app.getPublishedModeThemeId()); - assertThat(app.getEditModeThemeId()).isEqualTo(defaultTheme.getId()); - }) - .verifyComplete(); - } } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java new file mode 100644 index 000000000000..d86a8bae853f --- /dev/null +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ThemeImportableServiceCETest.java @@ -0,0 +1,240 @@ +package com.appsmith.server.services.ce; + +import com.appsmith.server.domains.Application; +import com.appsmith.server.domains.PermissionGroup; +import com.appsmith.server.domains.Theme; +import com.appsmith.server.domains.User; +import com.appsmith.server.domains.Workspace; +import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ImportingMetaDTO; +import com.appsmith.server.dtos.InviteUsersDTO; +import com.appsmith.server.dtos.MappedImportableResourcesDTO; +import com.appsmith.server.dtos.UpdatePermissionGroupDTO; +import com.appsmith.server.imports.importable.ImportableService; +import com.appsmith.server.repositories.ApplicationRepository; +import com.appsmith.server.repositories.PermissionGroupRepository; +import com.appsmith.server.repositories.ThemeRepository; +import com.appsmith.server.repositories.UserRepository; +import com.appsmith.server.services.ApplicationPageService; +import com.appsmith.server.services.ApplicationService; +import com.appsmith.server.services.PermissionGroupService; +import com.appsmith.server.services.UserService; +import com.appsmith.server.services.UserWorkspaceService; +import com.appsmith.server.services.WorkspaceService; +import com.appsmith.server.solutions.ApplicationPermission; +import com.appsmith.server.solutions.UserAndAccessManagementService; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.test.context.support.WithUserDetails; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS; +import static com.appsmith.server.constants.FieldName.ADMINISTRATOR; +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest +@ExtendWith(SpringExtension.class) +public class ThemeImportableServiceCETest { + + @Autowired + ApplicationRepository applicationRepository; + + @Autowired + ApplicationService applicationService; + + @Autowired + ApplicationPageService applicationPageService; + + @Autowired + WorkspaceService workspaceService; + + @Autowired + UserService userService; + + Workspace workspace; + + @Autowired + private ImportableService<Theme> themeImportableService; + + @Autowired + private PermissionGroupRepository permissionGroupRepository; + + @Autowired + private UserWorkspaceService userWorkspaceService; + + @Autowired + private ThemeRepository themeRepository; + + @Autowired + private UserAndAccessManagementService userAndAccessManagementService; + + @Autowired + ApplicationPermission applicationPermission; + + @Autowired + UserRepository userRepository; + + @Autowired + PermissionGroupService permissionGroupService; + + @BeforeEach + public void setup() { + Workspace workspace = new Workspace(); + workspace.setName("Theme Service Test workspace"); + workspace.setUserRoles(new ArrayList<>()); + this.workspace = workspaceService.create(workspace).block(); + } + + @AfterEach + public void cleanup() { + List<Application> deletedApplications = applicationService + .findByWorkspaceId(workspace.getId(), applicationPermission.getDeletePermission()) + .flatMap(remainingApplication -> applicationPageService.deleteApplication(remainingApplication.getId())) + .collectList() + .block(); + Workspace deletedWorkspace = + workspaceService.archiveById(workspace.getId()).block(); + } + + private Application createApplication() { + Application application = new Application(); + application.setName("ThemeTest_" + UUID.randomUUID()); + application.setWorkspaceId(this.workspace.getId()); + applicationPageService + .createApplication(application, this.workspace.getId()) + .block(); + return application; + } + + public void replaceApiUserWithAnotherUserInWorkspace() { + + String origin = "http://random-origin.test"; + PermissionGroup adminPermissionGroup = permissionGroupRepository + .findAllById(workspace.getDefaultPermissionGroups()) + .filter(permissionGroup -> permissionGroup.getName().startsWith(ADMINISTRATOR)) + .collectList() + .block() + .get(0); + + // invite usertest to the workspace + InviteUsersDTO inviteUsersDTO = new InviteUsersDTO(); + inviteUsersDTO.setUsernames(List.of("[email protected]")); + inviteUsersDTO.setPermissionGroupId(adminPermissionGroup.getId()); + userAndAccessManagementService.inviteUsers(inviteUsersDTO, origin).block(); + + // Remove api_user from the workspace + UpdatePermissionGroupDTO updatePermissionGroupDTO = new UpdatePermissionGroupDTO(); + updatePermissionGroupDTO.setNewPermissionGroupId(null); + updatePermissionGroupDTO.setUsername("api_user"); + userWorkspaceService + .updatePermissionGroupForMember(workspace.getId(), updatePermissionGroupDTO, origin) + .block(); + } + + public void addApiUserToTheWorkspaceAsAdmin() { + String origin = "http://random-origin.test"; + PermissionGroup adminPermissionGroup = permissionGroupRepository + .findAllById(workspace.getDefaultPermissionGroups()) + .filter(permissionGroup -> permissionGroup.getName().startsWith(ADMINISTRATOR)) + .collectList() + .block() + .get(0); + + // add api_user back to the workspace + User apiUser = userRepository.findByEmail("api_user").block(); + adminPermissionGroup.getAssignedToUserIds().add(apiUser.getId()); + permissionGroupRepository + .save(adminPermissionGroup) + .flatMap( + savedRole -> permissionGroupService.cleanPermissionGroupCacheForUsers(List.of(apiUser.getId()))) + .block(); + } + + @WithUserDetails("api_user") + @Test + public void importThemesToApplication_WhenBothImportedThemesAreCustom_NewThemesCreated() { + Application application = createApplication(); + + // create a application json with a custom theme set as both edit mode and published mode + ApplicationJson applicationJson = new ApplicationJson(); + Theme customTheme = new Theme(); + customTheme.setName("Custom theme name"); + customTheme.setDisplayName("Custom theme display name"); + applicationJson.setEditModeTheme(customTheme); + applicationJson.setPublishedTheme(customTheme); + + Mono<Application> applicationMono = Mono.just(application) + .flatMap(savedApplication -> themeImportableService + .importEntities( + new ImportingMetaDTO(), + new MappedImportableResourcesDTO(), + null, + Mono.just(application), + applicationJson) + .thenReturn(savedApplication.getId())) + .flatMap(applicationId -> applicationRepository.findById(applicationId, MANAGE_APPLICATIONS)); + + StepVerifier.create(applicationMono) + .assertNext(app -> { + assertThat(app.getEditModeThemeId().equals(app.getPublishedModeThemeId())) + .isFalse(); + }) + .verifyComplete(); + } + + @WithUserDetails("api_user") + @Test + public void importThemesToApplication_ApplicationThemeNotFound_DefaultThemeImported() { + Theme defaultTheme = + themeRepository.getSystemThemeByName(Theme.DEFAULT_THEME_NAME).block(); + + // create the theme information present in the application JSON + Theme themeInJson = new Theme(); + themeInJson.setSystemTheme(true); + themeInJson.setName(defaultTheme.getName()); + + // create a application json with the above theme set in both modes + ApplicationJson applicationJson = new ApplicationJson(); + applicationJson.setEditModeTheme(themeInJson); + applicationJson.setPublishedTheme(themeInJson); + + Mono<Application> applicationMono = Mono.just(createApplication()) + .map(application -> { + // setting invalid ids to themes to check the case + application.setEditModeThemeId(UUID.randomUUID().toString()); + application.setPublishedModeThemeId(UUID.randomUUID().toString()); + return application; + }) + .flatMap(applicationRepository::save) + .flatMap(savedApplication -> { + assert savedApplication.getId() != null; + return themeImportableService + .importEntities( + new ImportingMetaDTO(), + new MappedImportableResourcesDTO(), + null, + Mono.just(savedApplication), + applicationJson) + .thenReturn(savedApplication.getId()); + }) + .flatMap(applicationId -> applicationRepository.findById(applicationId, MANAGE_APPLICATIONS)); + + StepVerifier.create(applicationMono) + .assertNext(app -> { + // both edit mode and published mode should have default theme set + assertThat(app.getEditModeThemeId()).isEqualTo(app.getPublishedModeThemeId()); + assertThat(app.getEditModeThemeId()).isEqualTo(defaultTheme.getId()); + }) + .verifyComplete(); + } +} diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/transactions/ImportApplicationTransactionServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/transactions/ImportApplicationTransactionServiceTest.java index 86ef182e5275..eb46120fe210 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/transactions/ImportApplicationTransactionServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/transactions/ImportApplicationTransactionServiceTest.java @@ -11,6 +11,7 @@ import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.MockPluginExecutor; import com.appsmith.server.helpers.PluginExecutorHelper; +import com.appsmith.server.imports.importable.ImportableService; import com.appsmith.server.imports.internal.ImportApplicationService; import com.appsmith.server.migrations.JsonSchemaMigration; import com.appsmith.server.newactions.base.NewActionService; @@ -79,6 +80,9 @@ public class ImportApplicationTransactionServiceTest { @MockBean PluginExecutorHelper pluginExecutorHelper; + @MockBean + ImportableService<NewAction> newActionImportableService; + Long applicationCount = 0L, pageCount = 0L, actionCount = 0L, actionCollectionCount = 0L; private ApplicationJson applicationJson = new ApplicationJson(); @@ -131,7 +135,7 @@ public void importApplication_exceptionDuringImportActions_savedPagesAndApplicat Workspace newWorkspace = new Workspace(); newWorkspace.setName("Template Workspace"); - Mockito.when(newActionService.importActions(any(), any(), any(), any(), any(), any(), any())) + Mockito.when(newActionImportableService.importEntities(any(), any(), any(), any(), any())) .thenReturn(Mono.error(new AppsmithException(AppsmithError.GENERIC_BAD_REQUEST))); Workspace createdWorkspace = workspaceService.create(newWorkspace).block(); @@ -162,7 +166,7 @@ public void importApplication_transactionExceptionDuringListActionSave_omitTrans Workspace newWorkspace = new Workspace(); newWorkspace.setName("Template Workspace"); - Mockito.when(newActionService.importActions(any(), any(), any(), any(), any(), any(), any())) + Mockito.when(newActionImportableService.importEntities(any(), any(), any(), any(), any())) .thenReturn(Mono.error(new MongoTransactionException( "Command failed with error 251 (NoSuchTransaction): 'Transaction 1 has been aborted.'"))); diff --git a/app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/valid-application.json b/app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/valid-application.json index 702075694fd7..e341ac8d6d4f 100644 --- a/app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/valid-application.json +++ b/app/server/appsmith-server/src/test/resources/test_assets/ImportExportServiceTest/valid-application.json @@ -25,7 +25,7 @@ "read:datasources" ], "name": "db-auth", - "pluginId": "mongo-plugin", + "pluginId": "installed-plugin", "gitSyncId": "datasource1_git", "datasourceConfiguration": { "connection": { @@ -59,7 +59,7 @@ "read:datasources" ], "name": "api_ds_wo_auth", - "pluginId": "restapi-plugin", + "pluginId": "installed-plugin", "gitSyncId": "datasource2_git", "datasourceConfiguration": { "sshProxyEnabled": false, @@ -434,7 +434,7 @@ "userPermissions": [], "applicationId": "valid_application", "pluginType": "DB", - "pluginId": "mongo-plugin", + "pluginId": "installed-plugin", "gitSyncId": "action1_git", "unpublishedAction": { "name": "get_users", @@ -478,7 +478,7 @@ "userPermissions": [], "applicationId": "valid_application", "pluginType": "API", - "pluginId": "restapi-plugin", + "pluginId": "installed-plugin", "gitSyncId": "action2_git", "unpublishedAction": { "name": "api_wo_auth", @@ -571,14 +571,14 @@ "manage:actions" ], "pluginType": "JS", - "pluginId": "js-plugin", + "pluginId": "installed-js-plugin", "unpublishedAction": { "name": "run", "fullyQualifiedName": "JSObject1.run", "datasource": { "userPermissions": [], "name": "UNUSED_DATASOURCE", - "pluginId": "js-plugin", + "pluginId": "installed-js-plugin", "isValid": true, "new": true }, @@ -625,7 +625,7 @@ "unpublishedCollection": { "name": "JSObject1", "pageId": "Page1", - "pluginId": "js-plugin", + "pluginId": "installed-js-plugin", "pluginType": "JS", "actions": [], "archivedActions": [], @@ -640,7 +640,7 @@ "publishedCollection": { "name": "JSObject1_Published", "pageId": "Page1", - "pluginId": "js-plugin", + "pluginId": "installed-js-plugin", "pluginType": "JS", "actions": [], "archivedActions": [], @@ -664,7 +664,7 @@ "unpublishedCollection": { "name": "JSObject2", "pageId": "Page1", - "pluginId": "js-plugin", + "pluginId": "installed-js-plugin", "pluginType": "JS", "actions": [], "archivedActions": [], @@ -724,4 +724,4 @@ "uidString": "accessor1_url" } ] -} \ No newline at end of file +}
cbf7dc2745259ad47fe3dfa03c4797d2a0480c89
2021-09-02 19:30:18
Trisha Anand
feat: New Mongo UQI Plugin with new datastructures (with old UI) (#6666)
false
New Mongo UQI Plugin with new datastructures (with old UI) (#6666)
feat
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStructure.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStructure.java index 3c95add0dd02..8b0b997136e3 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStructure.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStructure.java @@ -9,6 +9,7 @@ import java.lang.reflect.Type; import java.util.List; +import java.util.Map; @Data @NoArgsConstructor @@ -105,11 +106,33 @@ public String getType() { } @Data - @AllArgsConstructor + @NoArgsConstructor public static class Template { String title; String body; - List<Property> pluginSpecifiedTemplates; + Object configuration; + + // To create templates for plugins which store the configurations + // in List<Property> format + public Template(String title, String body, List<Property> configuration) { + this.title = title; + this.body = body; + this.configuration = configuration; + } + + // To create templates for plugins with UQI framework whic store the configurations + // as a map + public Template(String title, String body, Map<String, ?> configuration) { + this.title = title; + this.body = body; + this.configuration = configuration; + } + + // Creating templates without configuration + public Template(String title, String body) { + this.title = title; + this.body = body; + } } ErrorDTO error; diff --git a/app/server/appsmith-plugins/arangoDBPlugin/src/main/java/com/external/utils/StructureUtils.java b/app/server/appsmith-plugins/arangoDBPlugin/src/main/java/com/external/utils/StructureUtils.java index 3fb27cb3387c..829bd0ba90e0 100644 --- a/app/server/appsmith-plugins/arangoDBPlugin/src/main/java/com/external/utils/StructureUtils.java +++ b/app/server/appsmith-plugins/arangoDBPlugin/src/main/java/com/external/utils/StructureUtils.java @@ -84,8 +84,7 @@ private static DatasourceStructure.Template generateSelectTemplate(Map<String, O return new DatasourceStructure.Template( "Select", - rawQuery, - null + rawQuery ); } @@ -100,8 +99,7 @@ private static DatasourceStructure.Template generateCreateTemplate(Map<String, O return new DatasourceStructure.Template( "Create", - rawQuery, - null + rawQuery ); } @@ -123,8 +121,7 @@ private static DatasourceStructure.Template generateUpdateTemplate(Map<String, O return new DatasourceStructure.Template( "Update", - rawQuery, - null + rawQuery ); } @@ -137,8 +134,7 @@ private static DatasourceStructure.Template generateRemoveTemplate(Map<String, O return new DatasourceStructure.Template( "Delete", - rawQuery, - null + rawQuery ); } 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 4d4b5a16324e..9c276f7a2745 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 @@ -485,9 +485,9 @@ public void testStructure() { " },\n" + " \"limit\": 10\n" + "}\n"); - assertEquals(findTemplate.getPluginSpecifiedTemplates().get(COMMAND).getValue(), "FIND"); - assertEquals(findTemplate.getPluginSpecifiedTemplates().get(FIND_QUERY).getValue(), "{ \"gender\": \"F\"}"); - assertEquals(findTemplate.getPluginSpecifiedTemplates().get(FIND_SORT).getValue(), "{\"_id\": 1}"); + assertEquals(((List<Property>)findTemplate.getConfiguration()).get(COMMAND).getValue(), "FIND"); + assertEquals(((List<Property>)findTemplate.getConfiguration()).get(FIND_QUERY).getValue(), "{ \"gender\": \"F\"}"); + assertEquals(((List<Property>)findTemplate.getConfiguration()).get(FIND_SORT).getValue(), "{\"_id\": 1}"); //Assert Find By Id command DatasourceStructure.Template findByIdTemplate = templates.get(1); @@ -498,8 +498,8 @@ public void testStructure() { " \"_id\": ObjectId(\"id_to_query_with\")\n" + " }\n" + "}\n"); - assertEquals(findByIdTemplate.getPluginSpecifiedTemplates().get(COMMAND).getValue(), "FIND"); - assertEquals(findByIdTemplate.getPluginSpecifiedTemplates().get(FIND_QUERY).getValue(), "{\"_id\": ObjectId(\"id_to_query_with\")}"); + assertEquals(((List<Property>)findByIdTemplate.getConfiguration()).get(COMMAND).getValue(), "FIND"); + assertEquals(((List<Property>)findByIdTemplate.getConfiguration()).get(FIND_QUERY).getValue(), "{\"_id\": ObjectId(\"id_to_query_with\")}"); // Assert Insert command DatasourceStructure.Template insertTemplate = templates.get(2); @@ -519,8 +519,8 @@ public void testStructure() { " }\n" + " ]\n" + "}\n"); - assertEquals(insertTemplate.getPluginSpecifiedTemplates().get(COMMAND).getValue(), "INSERT"); - assertEquals(insertTemplate.getPluginSpecifiedTemplates().get(INSERT_DOCUMENT).getValue(), + assertEquals(((List<Property>)insertTemplate.getConfiguration()).get(COMMAND).getValue(), "INSERT"); + assertEquals(((List<Property>)insertTemplate.getConfiguration()).get(INSERT_DOCUMENT).getValue(), "[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n" + " \"age\": 1,\n" + " \"dob\": new Date(\"2019-07-01\"),\n" + @@ -545,9 +545,9 @@ public void testStructure() { " }\n" + " ]\n" + "}\n"); - assertEquals(updateTemplate.getPluginSpecifiedTemplates().get(COMMAND).getValue(), "UPDATE"); - assertEquals(updateTemplate.getPluginSpecifiedTemplates().get(UPDATE_QUERY).getValue(), "{ \"_id\": ObjectId(\"id_of_document_to_update\") }"); - assertEquals(updateTemplate.getPluginSpecifiedTemplates().get(UPDATE_UPDATE).getValue(), "{ \"$set\": { \"gender\": \"new value\" } }"); + assertEquals(((List<Property>)updateTemplate.getConfiguration()).get(COMMAND).getValue(), "UPDATE"); + assertEquals(((List<Property>)updateTemplate.getConfiguration()).get(UPDATE_QUERY).getValue(), "{ \"_id\": ObjectId(\"id_of_document_to_update\") }"); + assertEquals(((List<Property>)updateTemplate.getConfiguration()).get(UPDATE_UPDATE).getValue(), "{ \"$set\": { \"gender\": \"new value\" } }"); // Assert Delete Command DatasourceStructure.Template deleteTemplate = templates.get(4); @@ -563,9 +563,9 @@ public void testStructure() { " }\n" + " ]\n" + "}\n"); - assertEquals(deleteTemplate.getPluginSpecifiedTemplates().get(COMMAND).getValue(), "DELETE"); - assertEquals(deleteTemplate.getPluginSpecifiedTemplates().get(DELETE_QUERY).getValue(), "{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"); - assertEquals(deleteTemplate.getPluginSpecifiedTemplates().get(DELETE_LIMIT).getValue(), "SINGLE"); + assertEquals(((List<Property>)deleteTemplate.getConfiguration()).get(COMMAND).getValue(), "DELETE"); + assertEquals(((List<Property>)deleteTemplate.getConfiguration()).get(DELETE_QUERY).getValue(), "{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"); + assertEquals(((List<Property>)deleteTemplate.getConfiguration()).get(DELETE_LIMIT).getValue(), "SINGLE"); }) .verifyComplete(); } diff --git a/app/server/appsmith-plugins/mongoPluginUqi/plugin.properties b/app/server/appsmith-plugins/mongoPluginUqi/plugin.properties new file mode 100644 index 000000000000..1c4af142cfb0 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/plugin.properties @@ -0,0 +1,5 @@ +plugin.id=mongo-uqi-plugin +plugin.class=com.external.plugins.MongoPluginUqi +plugin.version=1.0-SNAPSHOT [email protected] +plugin.dependencies= diff --git a/app/server/appsmith-plugins/mongoPluginUqi/pom.xml b/app/server/appsmith-plugins/mongoPluginUqi/pom.xml new file mode 100644 index 000000000000..69ab8f8293c3 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/pom.xml @@ -0,0 +1,108 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.external.plugins</groupId> + <artifactId>mongoPluginUqi</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>mongoPluginUqi</name> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <java.version>11</java.version> + <maven.compiler.source>${java.version}</maven.compiler.source> + <maven.compiler.target>${java.version}</maven.compiler.target> + <plugin.id>mongo-uqi-plugin</plugin.id> + <plugin.class>com.external.plugins.MongoPluginUqi</plugin.class> + <plugin.version>1.0-SNAPSHOT</plugin.version> + <plugin.provider>[email protected]</plugin.provider> + <plugin.dependencies/> + </properties> + + <dependencies> + + <dependency> + <groupId>org.pf4j</groupId> + <artifactId>pf4j-spring</artifactId> + <version>0.7.0</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>com.appsmith</groupId> + <artifactId>interfaces</artifactId> + <version>1.0-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.8</version> + <scope>provided</scope> + </dependency> + + <!-- Test Dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-test</artifactId> + <version>3.2.11.RELEASE</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>3.1.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testcontainers</groupId> + <artifactId>testcontainers</artifactId> + <version>1.15.0-rc2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.2.4</version> + <configuration> + <minimizeJar>false</minimizeJar> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <manifestEntries> + <Plugin-Id>${plugin.id}</Plugin-Id> + <Plugin-Class>${plugin.class}</Plugin-Class> + <Plugin-Version>${plugin.version}</Plugin-Version> + <Plugin-Provider>${plugin.provider}</Plugin-Provider> + </manifestEntries> + </transformer> + </transformers> + </configuration> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/MongoPluginUqi.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/MongoPluginUqi.java new file mode 100644 index 000000000000..786865a597a5 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/MongoPluginUqi.java @@ -0,0 +1,909 @@ +package com.external.plugins; + +import com.appsmith.external.constants.DisplayDataType; +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.DataTypeStringUtils; +import com.appsmith.external.helpers.MustacheHelper; +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.appsmith.external.plugins.BasePlugin; +import com.appsmith.external.plugins.PluginExecutor; +import com.appsmith.external.plugins.SmartSubstitutionInterface; +import com.mongodb.MongoCommandException; +import com.mongodb.MongoSocketWriteException; +import com.mongodb.MongoTimeoutException; +import com.mongodb.reactivestreams.client.MongoClient; +import com.mongodb.reactivestreams.client.MongoClients; +import com.mongodb.reactivestreams.client.MongoDatabase; +import lombok.extern.slf4j.Slf4j; +import org.bson.Document; +import org.bson.conversions.Bson; +import org.json.JSONArray; +import org.json.JSONObject; +import org.pf4j.Extension; +import org.pf4j.PluginWrapper; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; +import reactor.core.scheduler.Schedulers; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.Duration; +import java.time.Instant; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeoutException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static com.appsmith.external.constants.ActionConstants.ACTION_CONFIGURATION_BODY; +import static com.external.plugins.MongoPluginUtils.convertMongoFormInputToRawCommand; +import static com.external.plugins.MongoPluginUtils.generateTemplatesAndStructureForACollection; +import static com.external.plugins.MongoPluginUtils.getDatabaseName; +import static com.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.isRawCommand; +import static com.external.plugins.MongoPluginUtils.setValueSafely; +import static com.external.plugins.MongoPluginUtils.urlEncode; +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.AGGREGATE_PIPELINE; +import static com.external.plugins.constants.FieldName.COUNT_QUERY; +import static com.external.plugins.constants.FieldName.DELETE_QUERY; +import static com.external.plugins.constants.FieldName.DISTINCT_QUERY; +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.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_UPDATE; +import static java.lang.Boolean.TRUE; + +public class MongoPluginUqi extends BasePlugin { + + private static final Set<DBAuth.Type> VALID_AUTH_TYPES = Set.of( + DBAuth.Type.SCRAM_SHA_1, + DBAuth.Type.SCRAM_SHA_256, + DBAuth.Type.MONGODB_CR // NOTE: Deprecated in the driver. + ); + + private static final String VALID_AUTH_TYPES_STR = VALID_AUTH_TYPES.stream() + .map(String::valueOf) + .collect(Collectors.joining(", ")); + + private static final int DEFAULT_PORT = 27017; + + public static final String N_MODIFIED = "nModified"; + + private static final String VALUE = "value"; + + private static final String VALUES = "values"; + + 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....)) + */ + private static final String MONGO_URI_REGEX = "^(mongodb(\\+srv)?:\\/\\/)((.+):(.+))(@.+\\/(.+))$"; + + private static final int REGEX_GROUP_HEAD = 1; + + private static final int REGEX_GROUP_USERNAME = 4; + + private static final int REGEX_GROUP_PASSWORD = 5; + + private static final int REGEX_GROUP_TAIL = 6; + + private static final int REGEX_GROUP_DBNAME = 7; + + private static final String KEY_USERNAME = "username"; + + private static final String KEY_PASSWORD = "password"; + + private static final String KEY_URI_HEAD = "uriHead"; + + private static final String KEY_URI_TAIL = "uriTail"; + + private static final String KEY_URI_DBNAME = "dbName"; + + private static final String YES = "Yes"; + + private static final int DATASOURCE_CONFIG_USE_MONGO_URI_PROPERTY_INDEX = 0; + + private static final int DATASOURCE_CONFIG_MONGO_URI_PROPERTY_INDEX = 1; + + private static final Integer MONGO_COMMAND_EXCEPTION_UNAUTHORIZED_ERROR_CODE = 13; + + private static final Set<String> bsonFields = new HashSet<>(Arrays.asList(AGGREGATE_PIPELINE, + COUNT_QUERY, + DELETE_QUERY, + DISTINCT_QUERY, + FIND_QUERY, + FIND_SORT, + FIND_PROJECTION, + INSERT_DOCUMENT, + UPDATE_QUERY, + UPDATE_UPDATE + )); + + public MongoPluginUqi(PluginWrapper wrapper) { + super(wrapper); + } + + @Slf4j + @Extension + public static class MongoPluginUqiExecutor implements PluginExecutor<MongoClient>, SmartSubstitutionInterface { + + private final Scheduler scheduler = Schedulers.elastic(); + + /** + * Instead of using the default executeParametrized provided by pluginExecutor, this implementation affords an opportunity + * also update the datasource and action configuration for pagination and some minor cleanup of the configuration before execution + * + * @param mongoClient : This is the connection that is established to the data source. This connection is according + * to the parameters in Datasource Configuration + * @param executeActionDTO : This is the data structure sent by the client during execute. This contains the params + * which would be used for substitution + * @param datasourceConfiguration : These are the configurations which have been used to create a Datasource from a Plugin + * @param actionConfiguration : These are the configurations which have been used to create an Action from a Datasource. + * @return + */ + @Override + public Mono<ActionExecutionResult> executeParameterized(MongoClient mongoClient, + ExecuteActionDTO executeActionDTO, + DatasourceConfiguration datasourceConfiguration, + ActionConfiguration actionConfiguration) { + + + final Map<String, Object> properties = actionConfiguration.getFormData(); + List<Map.Entry<String, String>> parameters = new ArrayList<>(); + + Boolean smartBsonSubstitution = (Boolean) properties.getOrDefault(SMART_SUBSTITUTION, TRUE); + + // Smartly substitute in actionConfiguration.body and replace all the bindings with values. + if (TRUE.equals(smartBsonSubstitution)) { + + // If not raw, then it must be form input. + if (!isRawCommand(actionConfiguration.getFormData())) { + smartSubstituteFormCommand(actionConfiguration.getFormData(), + executeActionDTO.getParams(), parameters); + } else { + // For raw queries do smart replacements in BSON body + if (actionConfiguration.getBody() != null) { + try { + String updatedRawQuery = smartSubstituteBSON(actionConfiguration.getBody(), + executeActionDTO.getParams(), parameters); + actionConfiguration.setBody(updatedRawQuery); + } catch (AppsmithPluginException e) { + ActionExecutionResult errorResult = new ActionExecutionResult(); + errorResult.setStatusCode(AppsmithPluginError.PLUGIN_ERROR.getAppErrorCode().toString()); + errorResult.setIsExecutionSuccess(false); + errorResult.setBody(e.getMessage()); + return Mono.just(errorResult); + } + } + } + } + + prepareConfigurationsForExecution(executeActionDTO, actionConfiguration, datasourceConfiguration); + + // In case the input type is form instead of raw, parse the same into BSON command + String parsedRawCommand = convertMongoFormInputToRawCommand(actionConfiguration); + if (parsedRawCommand != null) { + actionConfiguration.setBody(parsedRawCommand); + } + + return this.executeCommon(mongoClient, datasourceConfiguration, actionConfiguration, parameters); + } + + /** + * For reference on creating the json queries for Mongo please head to + * https://docs.huihoo.com/mongodb/3.4/reference/command/index.html + * + * @param mongoClient : This is the connection that is established to the data source. This connection is according + * to the parameters in Datasource Configuration + * @param datasourceConfiguration : These are the configurations which have been used to create a Datasource from a Plugin + * @param actionConfiguration : These are the configurations which have been used to create an Action from a Datasource. + * @return Result data from executing the action's query. + */ + public Mono<ActionExecutionResult> executeCommon(MongoClient mongoClient, + DatasourceConfiguration datasourceConfiguration, + ActionConfiguration actionConfiguration, + List<Map.Entry<String, String>> parameters) { + + if (mongoClient == null) { + log.info("Encountered null connection in MongoDB plugin. Reporting back."); + throw new StaleConnectionException(); + } + + MongoDatabase database = mongoClient.getDatabase(getDatabaseName(datasourceConfiguration)); + + String query = actionConfiguration.getBody(); + Bson command = Document.parse(query); + + Mono<Document> mongoOutputMono = Mono.from(database.runCommand(command)); + ActionExecutionResult result = new ActionExecutionResult(); + List<RequestParamDTO> requestParams = List.of(new RequestParamDTO(ACTION_CONFIGURATION_BODY, query, null + , null, null)); + + return mongoOutputMono + .onErrorMap( + MongoTimeoutException.class, + error -> new AppsmithPluginException( + AppsmithPluginError.PLUGIN_QUERY_TIMEOUT_ERROR, + error.getMessage() + ) + ) + .onErrorMap( + MongoCommandException.class, + error -> new AppsmithPluginException( + AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, + error.getErrorMessage() + ) + ) + // This is an experimental fix to handle the scenario where after a period of inactivity, the mongo + // database drops the connection which makes the client throw the following exception. + .onErrorMap( + MongoSocketWriteException.class, + error -> new StaleConnectionException() + ) + .flatMap(mongoOutput -> { + try { + JSONObject outputJson = new JSONObject(mongoOutput.toJson()); + + //The output json contains the key "ok". This is the status of the command + BigInteger status = outputJson.getBigInteger("ok"); + JSONArray headerArray = new JSONArray(); + + if (BigInteger.ONE.equals(status)) { + result.setIsExecutionSuccess(true); + result.setDataTypes(List.of( + new ParsedDataType(DisplayDataType.JSON), + new ParsedDataType(DisplayDataType.RAW) + )); + + /** + * For the `findAndModify` command, we don't get the count of modifications made. Instead, + * we either get the modified new value or the pre-modified old value (depending on the + * `new` field in the command. Let's return that value to the user. + */ + if (outputJson.has(VALUE)) { + result.setBody(objectMapper.readTree( + cleanUp(new JSONObject().put(VALUE, outputJson.get(VALUE))).toString() + )); + } + + /** + * The json contains key "cursor" when find command was issued and there are 1 or more + * results. In case there are no results for find, this key is not present in the result json. + */ + if (outputJson.has("cursor")) { + JSONArray outputResult = (JSONArray) cleanUp( + outputJson.getJSONObject("cursor").getJSONArray("firstBatch")); + result.setBody(objectMapper.readTree(outputResult.toString())); + } + + /** + * The json contains key "n" when insert/update command is issued. "n" for update + * signifies the no of documents selected for update. "n" in case of insert signifies the + * number of documents inserted. + */ + if (outputJson.has("n")) { + JSONObject body = new JSONObject().put("n", outputJson.getBigInteger("n")); + result.setBody(objectMapper.readTree(body.toString())); + headerArray.put(body); + } + + /** + * The json key contains key "nModified" in case of update command. This signifies the no of + * documents updated. + */ + if (outputJson.has(N_MODIFIED)) { + JSONObject body = new JSONObject().put(N_MODIFIED, outputJson.getBigInteger(N_MODIFIED)); + result.setBody(objectMapper.readTree(body.toString())); + headerArray.put(body); + } + + /** + * The json contains key "values" when distinct command is used. + */ + if (outputJson.has(VALUES)) { + JSONArray outputResult = (JSONArray) cleanUp( + outputJson.getJSONArray("values")); + result.setBody(objectMapper.readTree(outputResult.toString())); + } + + /** TODO + * Go through all the possible fields that are returned in the output JSON and add all the fields + * that are important to the headerArray. + */ + } + + JSONObject statusJson = new JSONObject().put("ok", status); + headerArray.put(statusJson); + result.setHeaders(objectMapper.readTree(headerArray.toString())); + } catch (Exception e) { + return Mono.error(new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, e)); + } + + return Mono.just(result); + }) + .onErrorResume(error -> { + if (error instanceof StaleConnectionException) { + log.debug("The mongo connection seems to have been invalidated or doesn't exist anymore"); + return Mono.error(error); + } + ActionExecutionResult actionExecutionResult = new ActionExecutionResult(); + actionExecutionResult.setIsExecutionSuccess(false); + actionExecutionResult.setErrorInfo(error); + return Mono.just(actionExecutionResult); + }) + // Now set the request in the result to be returned back to the server + .map(actionExecutionResult -> { + ActionExecutionRequest request = new ActionExecutionRequest(); + request.setQuery(query); + if (!parameters.isEmpty()) { + final Map<String, Object> requestData = new HashMap<>(); + requestData.put("smart-substitution-parameters", parameters); + request.setProperties(requestData); + } + request.setRequestParams(requestParams); + actionExecutionResult.setRequest(request); + return actionExecutionResult; + }) + .subscribeOn(scheduler); + } + + private String smartSubstituteBSON(String rawQuery, + List<Param> params, + List<Map.Entry<String, String>> parameters) throws AppsmithPluginException { + + // First extract all the bindings in order + List<String> mustacheKeysInOrder = MustacheHelper.extractMustacheKeysInOrder(rawQuery); + // Replace all the bindings with a ? as expected in a prepared statement. + String updatedQuery = MustacheHelper.replaceMustacheWithPlaceholder(rawQuery, mustacheKeysInOrder); + + updatedQuery = (String) smartSubstitutionOfBindings(updatedQuery, + mustacheKeysInOrder, + params, + parameters); + + return updatedQuery; + } + + private void smartSubstituteFormCommand(Map<String, Object> formData, + List<Param> params, + List<Map.Entry<String, String>> parameters) throws AppsmithPluginException { + + for (String bsonField : bsonFields) { + if (validConfigurationPresent(formData, bsonField)) { + String preSmartSubValue = (String) getValueSafely(formData, bsonField); + String postSmartSubValue = smartSubstituteBSON(preSmartSubValue, params, parameters); + setValueSafely(formData, bsonField, postSmartSubValue); + } + } + } + + @Override + public Mono<MongoClient> datasourceCreate(DatasourceConfiguration datasourceConfiguration) { + /** + * TODO: ReadOnly seems to be not supported at the driver level. The recommendation is to connect with a + * user that doesn't have write permissions on the database. + * Ref: https://api.mongodb.com/java/2.13/com/mongodb/DB.html#setReadOnly-java.lang.Boolean- + */ + + return Mono.just(datasourceConfiguration) + .flatMap(dsConfig -> { + try { + return Mono.just(buildClientURI(dsConfig)); + } catch (AppsmithPluginException e) { + return Mono.error(e); + } + }) + .map(MongoClients::create) + .onErrorMap( + IllegalArgumentException.class, + error -> + new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, + error.getMessage() + ) + ) + .onErrorMap(e -> { + if (!(e instanceof AppsmithPluginException)) { + return new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, e.getMessage()); + } + + return e; + }) + .subscribeOn(scheduler); + } + + private boolean isUsingURI(DatasourceConfiguration datasourceConfiguration) { + List<Property> properties = datasourceConfiguration.getProperties(); + if (properties != null && properties.size() > DATASOURCE_CONFIG_USE_MONGO_URI_PROPERTY_INDEX + && properties.get(DATASOURCE_CONFIG_USE_MONGO_URI_PROPERTY_INDEX) != null + && YES.equals(properties.get(DATASOURCE_CONFIG_USE_MONGO_URI_PROPERTY_INDEX).getValue())) { + return true; + } + + return false; + } + + private boolean hasNonEmptyURI(DatasourceConfiguration datasourceConfiguration) { + List<Property> properties = datasourceConfiguration.getProperties(); + if (properties != null && properties.size() > DATASOURCE_CONFIG_MONGO_URI_PROPERTY_INDEX + && properties.get(DATASOURCE_CONFIG_MONGO_URI_PROPERTY_INDEX) != null + && !StringUtils.isEmpty(properties.get(DATASOURCE_CONFIG_MONGO_URI_PROPERTY_INDEX).getValue())) { + return true; + } + + return false; + } + + private Map extractInfoFromConnectionStringURI(String uri, String regex) { + if (uri.matches(regex)) { + Pattern pattern = Pattern.compile(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_URI_TAIL, matcher.group(REGEX_GROUP_TAIL)); + extractedInfoMap.put(KEY_URI_DBNAME, matcher.group(REGEX_GROUP_DBNAME).split("\\?")[0]); + return extractedInfoMap; + } + } + + 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); + } + + public String buildClientURI(DatasourceConfiguration datasourceConfiguration) throws AppsmithPluginException { + List<Property> properties = datasourceConfiguration.getProperties(); + if (isUsingURI(datasourceConfiguration)) { + if (hasNonEmptyURI(datasourceConfiguration)) { + String uriWithHiddenPassword = + (String) properties.get(DATASOURCE_CONFIG_MONGO_URI_PROPERTY_INDEX).getValue(); + Map extractedInfo = extractInfoFromConnectionStringURI(uriWithHiddenPassword, MONGO_URI_REGEX); + if (extractedInfo != null) { + String password = ((DBAuth) datasourceConfiguration.getAuthentication()).getPassword(); + return buildURIfromExtractedInfo(extractedInfo, password); + } else { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, + "Appsmith server has failed to parse the Mongo connection string URI. Please check " + + "if the URI has the correct format." + ); + } + } else { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, + "Could not find any Mongo connection string URI. Please edit the 'Mongo Connection String" + + " URI' field to provide the URI to connect to." + ); + } + } + + StringBuilder builder = new StringBuilder(); + final Connection connection = datasourceConfiguration.getConnection(); + final List<Endpoint> endpoints = datasourceConfiguration.getEndpoints(); + + // Use SRV mode if using REPLICA_SET, AND a port is not specified in the first endpoint. In SRV mode, the + // host and port details of individual shards will be obtained from the TXT records of the first endpoint. + boolean isSrv = Connection.Type.REPLICA_SET.equals(connection.getType()) + && endpoints.get(0).getPort() == null; + + if (isSrv) { + builder.append("mongodb+srv://"); + } else { + builder.append("mongodb://"); + } + + boolean hasUsername = false; + DBAuth authentication = (DBAuth) datasourceConfiguration.getAuthentication(); + if (authentication != null) { + hasUsername = StringUtils.hasText(authentication.getUsername()); + final boolean hasPassword = StringUtils.hasText(authentication.getPassword()); + if (hasUsername) { + builder.append(urlEncode(authentication.getUsername())); + } + if (hasPassword) { + builder.append(':').append(urlEncode(authentication.getPassword())); + } + if (hasUsername || hasPassword) { + builder.append('@'); + } + } + + for (Endpoint endpoint : endpoints) { + builder.append(endpoint.getHost()); + if (endpoint.getPort() != null) { + builder.append(':').append(endpoint.getPort()); + } else if (!isSrv) { + // Connections with +srv should NOT have a port. + builder.append(':').append(DEFAULT_PORT); + } + builder.append(','); + } + + // Delete the trailing comma. + builder.deleteCharAt(builder.length() - 1); + + final String authenticationDatabaseName = authentication == null ? null : authentication.getDatabaseName(); + builder.append('/').append(authenticationDatabaseName); + + List<String> queryParams = new ArrayList<>(); + + /* + * - Ideally, it is never expected to be null because the SSL dropdown is set to a initial value. + */ + if (datasourceConfiguration.getConnection() == null + || datasourceConfiguration.getConnection().getSsl() == null + || datasourceConfiguration.getConnection().getSsl().getAuthType() == null) { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_ERROR, + "Appsmith server has failed to fetch SSL configuration from datasource configuration form. " + + "Please reach out to Appsmith customer support to resolve this." + ); + } + + /* + * - By default, the driver configures SSL in the preferred mode. + */ + SSLDetails.AuthType sslAuthType = datasourceConfiguration.getConnection().getSsl().getAuthType(); + switch (sslAuthType) { + case ENABLED: + queryParams.add("ssl=true"); + + break; + case DISABLED: + queryParams.add("ssl=false"); + + break; + case DEFAULT: + /* do nothing - accept default driver setting */ + + break; + default: + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_ERROR, + "Appsmith server has found an unexpected SSL option: " + sslAuthType + ". Please reach out to" + + " Appsmith customer support to resolve this." + ); + } + + if (hasUsername && authentication.getAuthType() != null) { + queryParams.add("authMechanism=" + authentication.getAuthType().name().replace('_', '-')); + } + + if (!queryParams.isEmpty()) { + builder.append('?'); + for (String param : queryParams) { + builder.append(param).append('&'); + } + // Delete the trailing ampersand. + builder.deleteCharAt(builder.length() - 1); + } + + return builder.toString(); + } + + @Override + public void datasourceDestroy(MongoClient mongoClient) { + if (mongoClient != null) { + mongoClient.close(); + } + } + + private boolean hostStringHasConnectionURIHead(String host) { + if (!StringUtils.isEmpty(host) && (host.contains("mongodb://") || host.contains("mongodb+srv"))) { + return true; + } + + return false; + } + + private boolean isHostStringConnectionURI(Endpoint endpoint) { + if (endpoint != null && hostStringHasConnectionURIHead(endpoint.getHost())) { + return true; + } + + return false; + } + + @Override + public Set<String> validateDatasource(DatasourceConfiguration datasourceConfiguration) { + Set<String> invalids = new HashSet<>(); + List<Property> properties = datasourceConfiguration.getProperties(); + DBAuth authentication = (DBAuth) datasourceConfiguration.getAuthentication(); + if (isUsingURI(datasourceConfiguration)) { + if (!hasNonEmptyURI(datasourceConfiguration)) { + invalids.add("'Mongo Connection String URI' field is empty. Please edit the 'Mongo Connection " + + "URI' field to provide a connection uri to connect with."); + } else { + String mongoUri = (String) properties.get(DATASOURCE_CONFIG_MONGO_URI_PROPERTY_INDEX).getValue(); + if (!mongoUri.matches(MONGO_URI_REGEX)) { + invalids.add("Mongo Connection String URI does not seem to be in the correct format. Please " + + "check the URI once."); + } else { + Map extractedInfo = extractInfoFromConnectionStringURI(mongoUri, MONGO_URI_REGEX); + if (extractedInfo == null) { + 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, "****"); + properties.get(DATASOURCE_CONFIG_MONGO_URI_PROPERTY_INDEX).setValue(mongoUriWithHiddenPassword); + authentication = (authentication == null) ? new DBAuth() : authentication; + authentication.setUsername((String) extractedInfo.get(KEY_USERNAME)); + authentication.setPassword((String) extractedInfo.get(KEY_PASSWORD)); + authentication.setDatabaseName((String) extractedInfo.get(KEY_URI_DBNAME)); + datasourceConfiguration.setAuthentication(authentication); + + // remove any default db set via form auto-fill via browser + if (datasourceConfiguration.getConnection() != null) { + datasourceConfiguration.getConnection().setDefaultDatabaseName(null); + } + } + } + } + } else { + List<Endpoint> endpoints = datasourceConfiguration.getEndpoints(); + if (CollectionUtils.isEmpty(endpoints)) { + invalids.add("Missing endpoint(s)."); + + } else if (Connection.Type.REPLICA_SET.equals(datasourceConfiguration.getConnection().getType())) { + if (endpoints.size() == 1 && endpoints.get(0).getPort() != null) { + invalids.add("REPLICA_SET connections should not be given a port." + + " If you are trying to specify all the shards, please add more than one."); + } + + } + + if (!CollectionUtils.isEmpty(endpoints)) { + boolean usingUri = endpoints + .stream() + .anyMatch(endPoint -> isHostStringConnectionURI(endPoint)); + + if (usingUri) { + invalids.add("It seems that you are trying to use a mongo connection string URI. Please " + + "extract relevant fields and fill the form with extracted values. For " + + "details, please check out the Appsmith's documentation for Mongo database. " + + "Alternatively, you may use 'Import from Connection String URI' option from the " + + "dropdown labelled 'Use Mongo Connection String URI' to use the URI connection string" + + " directly."); + } + } + + if (authentication != null) { + DBAuth.Type authType = authentication.getAuthType(); + + if (authType == null || !VALID_AUTH_TYPES.contains(authType)) { + invalids.add("Invalid authType. Must be one of " + VALID_AUTH_TYPES_STR); + } + + if (StringUtils.isEmpty(authentication.getDatabaseName())) { + invalids.add("Missing database name."); + } + + } + + /* + * - Ideally, it is never expected to be null because the SSL dropdown is set to a initial value. + */ + if (datasourceConfiguration.getConnection() == null + || datasourceConfiguration.getConnection().getSsl() == null + || datasourceConfiguration.getConnection().getSsl().getAuthType() == null) { + invalids.add("Appsmith server has failed to fetch SSL configuration from datasource configuration " + + "form. Please reach out to Appsmith customer support to resolve this."); + } + } + + return invalids; + } + + @Override + public Mono<DatasourceTestResult> testDatasource(DatasourceConfiguration datasourceConfiguration) { + return datasourceCreate(datasourceConfiguration) + .flatMap(mongoClient -> { + return Mono.zip(Mono.just(mongoClient), + Mono.from(mongoClient.getDatabase("admin").runCommand(new Document( + "listDatabases", 1)))); + }) + .doOnSuccess(tuple -> { + MongoClient mongoClient = tuple.getT1(); + + if (mongoClient != null) { + mongoClient.close(); + } + }) + .then(Mono.just(new DatasourceTestResult())) + .timeout(Duration.ofSeconds(TEST_DATASOURCE_TIMEOUT_SECONDS)) + .onErrorMap( + TimeoutException.class, + error -> new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_TIMEOUT_ERROR, + "Connection timed out. Please check if the datasource configuration fields have " + + "been filled correctly." + ) + ) + .onErrorResume(error -> { + /** + * 1. Return OK response on "Unauthorized" exception. + * 2. If we get an exception with error code "Unauthorized" then it means that the connection to + * the MongoDB instance is valid. It also means we don't have access to the admin database, + * but that's okay for our purposes here. + */ + if (error instanceof MongoCommandException && + ((MongoCommandException) error).getErrorCodeName().equals("Unauthorized")) { + return Mono.just(new DatasourceTestResult()); + } + + return Mono.just(new DatasourceTestResult(error.getMessage())); + }) + .subscribeOn(scheduler); + } + + @Override + public Mono<DatasourceStructure> getStructure(MongoClient mongoClient, DatasourceConfiguration datasourceConfiguration) { + final DatasourceStructure structure = new DatasourceStructure(); + List<DatasourceStructure.Table> tables = new ArrayList<>(); + structure.setTables(tables); + + final MongoDatabase database = mongoClient.getDatabase(getDatabaseName(datasourceConfiguration)); + + return Flux.from(database.listCollectionNames()) + .flatMap(collectionName -> { + final ArrayList<DatasourceStructure.Column> columns = new ArrayList<>(); + final ArrayList<DatasourceStructure.Template> templates = new ArrayList<>(); + tables.add(new DatasourceStructure.Table( + DatasourceStructure.TableType.COLLECTION, + null, + collectionName, + columns, + new ArrayList<>(), + templates + )); + + return Mono.zip( + Mono.just(columns), + Mono.just(templates), + Mono.just(collectionName), + Mono.from(database.getCollection(collectionName).find().limit(1).first()) + ); + }) + .flatMap(tuple -> { + final ArrayList<DatasourceStructure.Column> columns = tuple.getT1(); + final ArrayList<DatasourceStructure.Template> templates = tuple.getT2(); + String collectionName = tuple.getT3(); + Document document = tuple.getT4(); + + generateTemplatesAndStructureForACollection(collectionName, document, columns, templates); + + return Mono.just(structure); + }) + .collectList() + .thenReturn(structure) + .onErrorMap( + MongoCommandException.class, + error -> { + if (MONGO_COMMAND_EXCEPTION_UNAUTHORIZED_ERROR_CODE.equals(error.getErrorCode())) { + return new AppsmithPluginException( + AppsmithPluginError.PLUGIN_GET_STRUCTURE_ERROR, + "Appsmith has failed to get database structure. Please provide read permission on" + + " the database to fix this." + ); + } + + return error; + } + ) + .subscribeOn(scheduler); + } + + @Override + public Object substituteValueInInput(int index, + String binding, + String value, + Object input, + List<Map.Entry<String, String>> insertedParams, + Object... args) { + String jsonBody = (String) input; + return DataTypeStringUtils.jsonSmartReplacementPlaceholderWithValue(jsonBody, value, insertedParams); + } + + @Override + public Mono<ActionExecutionResult> execute(MongoClient mongoClient, + DatasourceConfiguration datasourceConfiguration, + ActionConfiguration actionConfiguration) { + // Unused function + return Mono.error(new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Unsupported Operation")); + } + } + + private static Object cleanUp(Object object) { + if (object instanceof JSONObject) { + JSONObject jsonObject = (JSONObject) object; + final boolean isSingleKey = jsonObject.keySet().size() == 1; + + if (isSingleKey && "$numberLong".equals(jsonObject.keys().next())) { + return jsonObject.getBigInteger("$numberLong"); + + } else if (isSingleKey && "$oid".equals(jsonObject.keys().next())) { + return jsonObject.getString("$oid"); + + } else if (isSingleKey && "$date".equals(jsonObject.keys().next())) { + return DateTimeFormatter.ISO_INSTANT.format( + Instant.ofEpochMilli(jsonObject.getLong("$date")) + ); + + } else if (isSingleKey && "$numberDecimal".equals(jsonObject.keys().next())) { + return new BigDecimal(jsonObject.getString("$numberDecimal")); + + } else { + for (String key : new HashSet<>(jsonObject.keySet())) { + jsonObject.put(key, cleanUp(jsonObject.get(key))); + } + + } + + } else if (object instanceof JSONArray) { + Collection<Object> cleaned = new ArrayList<>(); + + for (Object child : (JSONArray) object) { + cleaned.add(cleanUp(child)); + } + + return new JSONArray(cleaned); + + } + + return object; + } + + private static boolean isAuthenticated(DBAuth authentication, String mongoUri) { + if (authentication != null && authentication.getUsername() != null + && authentication.getPassword() != null && mongoUri.contains("****")) { + + return true; + } + return false; + } + +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/MongoPluginUtils.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/MongoPluginUtils.java new file mode 100644 index 000000000000..1a87d4548a2e --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/MongoPluginUtils.java @@ -0,0 +1,248 @@ +package com.external.plugins; + +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.DBAuth; +import com.appsmith.external.models.DatasourceConfiguration; +import com.appsmith.external.models.DatasourceStructure; +import com.external.plugins.commands.Aggregate; +import com.external.plugins.commands.Count; +import com.external.plugins.commands.Delete; +import com.external.plugins.commands.Distinct; +import com.external.plugins.commands.Find; +import com.external.plugins.commands.Insert; +import com.external.plugins.commands.MongoCommand; +import com.external.plugins.commands.UpdateMany; +import org.bson.Document; +import org.bson.json.JsonParseException; +import org.bson.types.Decimal128; +import org.bson.types.ObjectId; +import org.springframework.util.StringUtils; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import static com.external.plugins.constants.FieldName.COMMAND; +import static com.external.plugins.constants.FieldName.RAW; + +public class MongoPluginUtils { + + public static Boolean validConfigurationPresent(Map<String, Object> formData, String field) { + if (formData != null && !formData.isEmpty()) { + return getValueSafely(formData, field) != null; + } + + return Boolean.FALSE; + } + + public static Object getValueSafely(Map<String, Object> formData, String field) { + if (formData != null && !formData.isEmpty()) { + // This field value contains nesting + if (field.contains(".")) { + + String[] fieldNames = field.split("\\."); + + Map<String, Object> nestedMap = (Map<String, Object>) formData.get(fieldNames[0]); + + String[] trimmedFieldNames = Arrays.copyOfRange(fieldNames, 1, fieldNames.length); + String nestedFieldName = String.join(".", trimmedFieldNames); + + // Now get the value from the new nested map using trimmed field name (without the parent key) + return getValueSafely(nestedMap, nestedFieldName); + } else { + // This is a top level field. Return the value + return formData.getOrDefault(field, null); + } + } + + return null; + } + + public static void setValueSafely(Map<String, Object> formData, String field, Object value) { + + // This field value contains nesting + if (field.contains(".")) { + + String[] fieldNames = field.split("\\."); + + // In case the parent key does not exist in the map, create one + formData.putIfAbsent(fieldNames[0], new HashMap<String, Object>()); + + Map<String, Object> nestedMap = (Map<String, Object>) formData.get(fieldNames[0]); + + String[] trimmedFieldNames = Arrays.copyOfRange(fieldNames, 1, fieldNames.length); + String nestedFieldName = String.join(".", trimmedFieldNames); + + // Now set the value from the new nested map using trimmed field name (without the parent key) + setValueSafely(nestedMap, nestedFieldName, value); + } else { + // This is a top level field. Set the value + formData.put(field, value); + } + } + + public static Document parseSafely(String fieldName, String input) { + try { + return Document.parse(input); + } catch (JsonParseException e) { + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, fieldName + " could not be parsed into expected JSON format."); + } + } + + public static Boolean isRawCommand(Map<String, Object> formData) { + String command = (String) formData.getOrDefault(COMMAND, null); + return RAW.equals(command); + } + + public static String convertMongoFormInputToRawCommand(ActionConfiguration actionConfiguration) { + Map<String, Object> formData = actionConfiguration.getFormData(); + if (formData != null && !formData.isEmpty()) { + // If its not raw command, then it must be one of the mongo form commands + if (!isRawCommand(formData)) { + + // Parse the commands into raw appropriately + MongoCommand command = null; + switch ((String) formData.getOrDefault(COMMAND, "")) { + case "INSERT": + command = new Insert(actionConfiguration); + break; + case "FIND": + command = new Find(actionConfiguration); + break; + case "UPDATE": + command = new UpdateMany(actionConfiguration); + break; + case "DELETE": + command = new Delete(actionConfiguration); + break; + case "COUNT": + command = new Count(actionConfiguration); + break; + case "DISTINCT": + command = new Distinct(actionConfiguration); + break; + case "AGGREGATE": + command = new Aggregate(actionConfiguration); + break; + default: + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "No valid mongo command found. Please select a command from the \"Command\" dropdown and try again"); + } + if (!command.isValid()) { + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Try again after configuring the fields : " + command.getFieldNamesWithNoConfiguration()); + } + + return command.parseCommand().toJson(); + } + } + + // We reached here. This means either this is a RAW command input or some configuration error has happened + // in which case, we default to RAW + return actionConfiguration.getBody(); + } + + public static String getDatabaseName(DatasourceConfiguration datasourceConfiguration) { + // Explicitly set default database. + String databaseName = datasourceConfiguration.getConnection().getDefaultDatabaseName(); + + // If that's not available, pick the authentication database. + final DBAuth authentication = (DBAuth) datasourceConfiguration.getAuthentication(); + if (StringUtils.isEmpty(databaseName) && authentication != null) { + databaseName = authentication.getDatabaseName(); + } + + return databaseName; + } + + public static void generateTemplatesAndStructureForACollection(String collectionName, + Document document, + ArrayList<DatasourceStructure.Column> columns, + ArrayList<DatasourceStructure.Template> templates) { + String filterFieldName = null; + String filterFieldValue = null; + Map<String, String> sampleInsertValues = new LinkedHashMap<>(); + + for (Map.Entry<String, Object> entry : document.entrySet()) { + final String name = entry.getKey(); + final Object value = entry.getValue(); + String type; + boolean isAutogenerated = false; + + if (value instanceof Integer) { + type = "Integer"; + sampleInsertValues.put(name, "1"); + } else if (value instanceof Long) { + type = "Long"; + sampleInsertValues.put(name, "NumberLong(\"1\")"); + } else if (value instanceof Double) { + type = "Double"; + sampleInsertValues.put(name, "1"); + } else if (value instanceof Decimal128) { + type = "BigDecimal"; + sampleInsertValues.put(name, "NumberDecimal(\"1\")"); + } else if (value instanceof String) { + type = "String"; + sampleInsertValues.put(name, "\"new value\""); + if (filterFieldName == null || filterFieldName.compareTo(name) > 0) { + filterFieldName = name; + filterFieldValue = (String) value; + } + } else if (value instanceof ObjectId) { + type = "ObjectId"; + isAutogenerated = true; + if (!value.equals("_id")) { + sampleInsertValues.put(name, "ObjectId(\"a_valid_object_id_hex\")"); + } + } else if (value instanceof Collection) { + type = "Array"; + sampleInsertValues.put(name, "[1, 2, 3]"); + } else if (value instanceof Date) { + type = "Date"; + sampleInsertValues.put(name, "new Date(\"2019-07-01\")"); + } else { + type = "Object"; + sampleInsertValues.put(name, "{}"); + } + + columns.add(new DatasourceStructure.Column(name, type, null, isAutogenerated)); + } + + columns.sort(Comparator.naturalOrder()); + + Map<String, Object> templateConfiguration = new HashMap<>(); + templateConfiguration.put("collectionName", collectionName); + templateConfiguration.put("filterFieldName", filterFieldName); + templateConfiguration.put("filterFieldValue", filterFieldValue); + templateConfiguration.put("sampleInsertValues", sampleInsertValues); + + templates.addAll( + new Find().generateTemplate(templateConfiguration) + ); + + + templates.addAll( + new Insert().generateTemplate(templateConfiguration) + ); + + templates.addAll( + new UpdateMany().generateTemplate(templateConfiguration) + ); + + templates.addAll( + new Delete().generateTemplate(templateConfiguration) + ); + } + + public static String urlEncode(String text) { + return URLEncoder.encode(text, StandardCharsets.UTF_8); + } + +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Aggregate.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Aggregate.java new file mode 100644 index 000000000000..88abde53f011 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Aggregate.java @@ -0,0 +1,83 @@ +package com.external.plugins.commands; + +import com.appsmith.external.constants.DataType; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.helpers.DataTypeStringUtils; +import com.appsmith.external.models.ActionConfiguration; +import lombok.Getter; +import lombok.Setter; +import org.bson.BsonArray; +import org.bson.Document; +import org.bson.json.JsonParseException; +import org.pf4j.util.StringUtils; + +import java.util.ArrayList; +import java.util.Map; + +import static com.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.parseSafely; +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.AGGREGATE_PIPELINE; + +@Getter +@Setter +public class Aggregate extends MongoCommand { + String pipeline; + + public Aggregate(ActionConfiguration actionConfiguration) { + super(actionConfiguration); + + Map<String, Object> formData = actionConfiguration.getFormData(); + + if (validConfigurationPresent(formData, AGGREGATE_PIPELINE)) { + this.pipeline = (String) getValueSafely(formData, AGGREGATE_PIPELINE); + } + } + + @Override + public Boolean isValid() { + if (super.isValid()) { + if (!StringUtils.isNullOrEmpty(pipeline)) { + return Boolean.TRUE; + } else { + fieldNamesWithNoConfiguration.add("Array of Pipelines"); + } + } + + return Boolean.FALSE; + } + + @Override + public Document parseCommand() { + Document commandDocument = new Document(); + + commandDocument.put("aggregate", this.collection); + + DataType dataType = DataTypeStringUtils.stringToKnownDataTypeConverter(this.pipeline); + if (dataType.equals(DataType.ARRAY)) { + try { + BsonArray arrayListFromInput = BsonArray.parse(this.pipeline); + if (arrayListFromInput.isEmpty()) { + commandDocument.put("pipeline", "[]"); + } else { + commandDocument.put("pipeline", arrayListFromInput); + } + } catch (JsonParseException e) { + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Array of Pipelines could not be parsed into expected Mongo BSON Array format."); + } + } else { + // The command expects the pipelines to be sent in an array. Parse and create a single element array + Document document = parseSafely("Array of Pipelines", this.pipeline); + ArrayList<Document> documentArrayList = new ArrayList<>(); + documentArrayList.add(document); + + commandDocument.put("pipeline", documentArrayList); + } + + // Add default cursor + commandDocument.put("cursor", parseSafely("cursor", "{}")); + + return commandDocument; + } +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Count.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Count.java new file mode 100644 index 000000000000..56300a501ff7 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Count.java @@ -0,0 +1,53 @@ +package com.external.plugins.commands; + +import com.appsmith.external.models.ActionConfiguration; +import lombok.Getter; +import lombok.Setter; +import org.bson.Document; +import org.pf4j.util.StringUtils; + +import java.util.Map; + +import static com.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.parseSafely; +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.COUNT_QUERY; + +@Getter +@Setter +public class Count extends MongoCommand { + String query; + + public Count(ActionConfiguration actionConfiguration) { + super(actionConfiguration); + + Map<String, Object> formData = actionConfiguration.getFormData(); + + if (validConfigurationPresent(formData, COUNT_QUERY)) { + this.query = (String) getValueSafely(formData, COUNT_QUERY); + } + } + + @Override + public Boolean isValid() { + if (super.isValid()) { + if (!StringUtils.isNullOrEmpty(query)) { + return Boolean.TRUE; + } else { + fieldNamesWithNoConfiguration.add("Query"); + } + } + return Boolean.FALSE; + } + + @Override + public Document parseCommand() { + Document document = new Document(); + + document.put("count", this.collection); + + document.put("query", parseSafely("Query", this.query)); + + return document; + } +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Delete.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Delete.java new file mode 100644 index 000000000000..9a48f1ccca75 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Delete.java @@ -0,0 +1,113 @@ +package com.external.plugins.commands; + +import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.DatasourceStructure; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.bson.Document; +import org.pf4j.util.StringUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.parseSafely; +import static com.external.plugins.MongoPluginUtils.setValueSafely; +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.COLLECTION; +import static com.external.plugins.constants.FieldName.COMMAND; +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.SMART_SUBSTITUTION; + +@Getter +@Setter +@NoArgsConstructor +public class Delete extends MongoCommand { + String query; + Integer limit = 1; // Can be only 0 or 1. 0 indicates all matching documents, 1 indicates single matching document + + public Delete(ActionConfiguration actionConfiguration) { + super(actionConfiguration); + + Map<String, Object> formData = actionConfiguration.getFormData(); + + if (validConfigurationPresent(formData, DELETE_QUERY)) { + this.query = (String) getValueSafely(formData, DELETE_QUERY); + } + + if (validConfigurationPresent(formData, DELETE_LIMIT)) { + String limitOption = (String) getValueSafely(formData, DELETE_LIMIT); + if ("ALL".equals(limitOption)) { + this.limit = 0; + } + } + } + + @Override + public Boolean isValid() { + if (super.isValid()) { + if (!StringUtils.isNullOrEmpty(query)) { + return Boolean.TRUE; + } else { + fieldNamesWithNoConfiguration.add("Query"); + } + } + return Boolean.FALSE; + } + + @Override + public Document parseCommand() { + Document document = new Document(); + + document.put("delete", this.collection); + + Document queryDocument = parseSafely("Query", this.query); + + Document delete = new Document(); + delete.put("q", queryDocument); + delete.put("limit", this.limit); + + List<Document> deletes = new ArrayList<>(); + deletes.add(delete); + + document.put("deletes", deletes); + + return document; + } + + @Override + public List<DatasourceStructure.Template> generateTemplate(Map<String, Object> templateConfiguration) { + String collectionName = (String) templateConfiguration.get("collectionName"); + + Map<String, Object> configMap = new HashMap<>(); + + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "DELETE"); + setValueSafely(configMap, COLLECTION, collectionName); + setValueSafely(configMap, DELETE_QUERY, "{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"); + setValueSafely(configMap, DELETE_LIMIT, "SINGLE"); + + String rawQuery = "{\n" + + " \"delete\": \"" + collectionName + "\",\n" + + " \"deletes\": [\n" + + " {\n" + + " \"q\": {\n" + + " \"_id\": \"id_of_document_to_delete\"\n" + + " },\n" + + " \"limit\": 1\n" + + " }\n" + + " ]\n" + + "}\n"; + + return Collections.singletonList(new DatasourceStructure.Template( + "Delete", + rawQuery, + configMap + )); + } +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Distinct.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Distinct.java new file mode 100644 index 000000000000..763d159902b7 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Distinct.java @@ -0,0 +1,67 @@ +package com.external.plugins.commands; + +import com.appsmith.external.models.ActionConfiguration; +import com.external.plugins.constants.FieldName; +import lombok.Getter; +import lombok.Setter; +import org.bson.Document; +import org.pf4j.util.StringUtils; + +import java.util.Map; + +import static com.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.parseSafely; +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.DISTINCT_QUERY; + +@Getter +@Setter +public class Distinct extends MongoCommand { + String query; + String key; + + public Distinct(ActionConfiguration actionConfiguration) { + super(actionConfiguration); + + Map<String, Object> formData = actionConfiguration.getFormData(); + + if (validConfigurationPresent(formData, DISTINCT_QUERY)) { + this.query = (String) getValueSafely(formData, DISTINCT_QUERY); + } + + if (validConfigurationPresent(formData, FieldName.DISTINCT_KEY)) { + this.key = (String) getValueSafely(formData, FieldName.DISTINCT_KEY); + } + } + + @Override + public Boolean isValid() { + if (super.isValid()) { + if (!StringUtils.isNullOrEmpty(query) && !StringUtils.isNullOrEmpty(key)) { + return Boolean.TRUE; + } else { + if (StringUtils.isNullOrEmpty(query)) { + fieldNamesWithNoConfiguration.add("Query"); + } + if (StringUtils.isNullOrEmpty(key)) { + fieldNamesWithNoConfiguration.add("Key/Field"); + } + } + } + + return Boolean.FALSE; + } + + @Override + public Document parseCommand() { + Document document = new Document(); + + document.put("distinct", this.collection); + + document.put("query", parseSafely("Query", this.query)); + + document.put("key", this.key); + + return document; + } +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Find.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Find.java new file mode 100644 index 000000000000..a008ccd5ff89 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Find.java @@ -0,0 +1,179 @@ +package com.external.plugins.commands; + +import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.DatasourceStructure; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.bson.Document; +import org.pf4j.util.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.parseSafely; +import static com.external.plugins.MongoPluginUtils.setValueSafely; +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.COLLECTION; +import static com.external.plugins.constants.FieldName.COMMAND; +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.FIND_SKIP; +import static com.external.plugins.constants.FieldName.FIND_SORT; +import static com.external.plugins.constants.FieldName.SMART_SUBSTITUTION; + +@Getter +@Setter +@NoArgsConstructor +public class Find extends MongoCommand { + String query; + String sort; + String projection; + String limit; + String skip; + + public Find(ActionConfiguration actionConfiguration) { + super(actionConfiguration); + + Map<String, Object> formData = actionConfiguration.getFormData(); + + if (validConfigurationPresent(formData, FIND_QUERY)) { + this.query = (String) getValueSafely(formData, FIND_QUERY); + } + + if (validConfigurationPresent(formData, FIND_SORT)) { + this.sort = (String) getValueSafely(formData, FIND_SORT); + } + + if (validConfigurationPresent(formData, FIND_PROJECTION)) { + this.projection = (String) getValueSafely(formData, FIND_PROJECTION); + } + + if (validConfigurationPresent(formData, FIND_LIMIT)) { + this.limit = (String) getValueSafely(formData, FIND_LIMIT); + } + + if (validConfigurationPresent(formData, FIND_SKIP)) { + this.skip = (String) getValueSafely(formData, FIND_SKIP); + } + } + + @Override + public Boolean isValid() { + if (super.isValid()) { + if (!StringUtils.isNullOrEmpty(query)) { + return Boolean.TRUE; + } else { + fieldNamesWithNoConfiguration.add("Query"); + } + } + + return Boolean.FALSE; + } + + @Override + public Document parseCommand() { + Document document = new Document(); + + document.put("find", this.collection); + + document.put("filter", parseSafely("Query", this.query)); + + if (!StringUtils.isNullOrEmpty(this.sort)) { + document.put("sort", parseSafely("Sort", this.sort)); + } + + if (!StringUtils.isNullOrEmpty(this.projection)) { + document.put("projection", parseSafely("Projection", this.projection)); + } + + // Default to returning 10 documents if not mentioned + int limit = 10; + if (!StringUtils.isNullOrEmpty(this.limit)) { + limit = Integer.parseInt(this.limit); + } + document.put("limit", limit); + document.put("batchSize", limit); + + if (!StringUtils.isNullOrEmpty(this.skip)) { + document.put("skip", Long.parseLong(this.skip)); + } + + return document; + } + + @Override + public List<DatasourceStructure.Template> generateTemplate(Map<String, Object> templateConfiguration) { + String collectionName = (String) templateConfiguration.get("collectionName"); + String filterFieldName = (String) templateConfiguration.get("filterFieldName"); + String filterFieldValue = (String) templateConfiguration.get("filterFieldValue"); + + List<DatasourceStructure.Template> templates = new ArrayList<>(); + + templates.add(generateFindTemplate(collectionName, filterFieldName, filterFieldValue)); + + templates.add(generateFindByIdTemplate(collectionName)); + + return templates; + } + + private DatasourceStructure.Template generateFindTemplate(String collectionName, String filterFieldName, String filterFieldValue) { + Map<String, Object> configMap = new HashMap<>(); + + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "FIND"); + setValueSafely(configMap, COLLECTION, collectionName); + setValueSafely(configMap, FIND_SORT, "{\"_id\": 1}"); + setValueSafely(configMap, FIND_LIMIT, "10"); + + String query = filterFieldName == null ? "{}" : + "{ \"" + filterFieldName + "\": \"" + filterFieldValue + "\"}"; + setValueSafely(configMap, FIND_QUERY, query); + + String rawQuery = "{\n" + + " \"find\": \"" + collectionName + "\",\n" + + ( + filterFieldName == null ? "" : + " \"filter\": {\n" + + " \"" + filterFieldName + "\": \"" + filterFieldValue + "\"\n" + + " },\n" + ) + + " \"sort\": {\n" + + " \"_id\": 1\n" + + " },\n" + + " \"limit\": 10\n" + + "}\n"; + + return new DatasourceStructure.Template( + "Find", + rawQuery, + configMap + ); + } + + private DatasourceStructure.Template generateFindByIdTemplate(String collectionName) { + Map<String, Object> configMap = new HashMap<>(); + + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "FIND"); + setValueSafely(configMap, FIND_QUERY, "{\"_id\": ObjectId(\"id_to_query_with\")}"); + setValueSafely(configMap, COLLECTION, collectionName); + + String rawQuery = "{\n" + + " \"find\": \"" + collectionName + "\",\n" + + " \"filter\": {\n" + + " \"_id\": ObjectId(\"id_to_query_with\")\n" + + " }\n" + + "}\n"; + + return new DatasourceStructure.Template( + "Find by ID", + rawQuery, + configMap + ); + } +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Insert.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Insert.java new file mode 100644 index 000000000000..d4a096211122 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/Insert.java @@ -0,0 +1,123 @@ +package com.external.plugins.commands; + +import com.appsmith.external.constants.DataType; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.helpers.DataTypeStringUtils; +import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.DatasourceStructure; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.bson.BsonArray; +import org.bson.Document; +import org.bson.json.JsonParseException; +import org.pf4j.util.StringUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static com.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.parseSafely; +import static com.external.plugins.MongoPluginUtils.setValueSafely; +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.COLLECTION; +import static com.external.plugins.constants.FieldName.COMMAND; +import static com.external.plugins.constants.FieldName.INSERT_DOCUMENT; +import static com.external.plugins.constants.FieldName.SMART_SUBSTITUTION; + +@Getter +@Setter +@NoArgsConstructor +public class Insert extends MongoCommand { + String documents; + + public Insert(ActionConfiguration actionConfiguration) { + super(actionConfiguration); + + Map<String, Object> formData = actionConfiguration.getFormData(); + + if (validConfigurationPresent(formData, INSERT_DOCUMENT)) { + this.documents = (String) getValueSafely(formData, INSERT_DOCUMENT); + } + } + + @Override + public Boolean isValid() { + if (super.isValid()) { + if (!StringUtils.isNullOrEmpty(documents)) { + return Boolean.TRUE; + } else { + fieldNamesWithNoConfiguration.add("Documents"); + } + } + return Boolean.FALSE; + } + + @Override + public Document parseCommand() { + Document commandDocument = new Document(); + + commandDocument.put("insert", this.collection); + + DataType dataType = DataTypeStringUtils.stringToKnownDataTypeConverter(this.documents); + if (dataType.equals(DataType.ARRAY)) { + try { + List arrayListFromInput = BsonArray.parse(this.documents); + if (arrayListFromInput.isEmpty()) { + commandDocument.put("documents", "[]"); + } else { + commandDocument.put("documents", arrayListFromInput); + } + } catch (JsonParseException e) { + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Documents" + " could not be parsed into expected JSON Array format."); + } + } else { + // The command expects the documents to be sent in an array. Parse and create a single element array + Document document = parseSafely("Documents", this.documents); + ArrayList<Document> documentArrayList = new ArrayList<>(); + documentArrayList.add(document); + + commandDocument.put("documents", documentArrayList); + } + + return commandDocument; + } + + @Override + public List<DatasourceStructure.Template> generateTemplate(Map<String, Object> templateConfiguration) { + String collectionName = (String) templateConfiguration.get("collectionName"); + Map<String, String> sampleInsertValues = (Map<String, String>) templateConfiguration.get("sampleInsertValues"); + + String sampleInsertDocuments = sampleInsertValues.entrySet().stream() + .map(entry -> " \"" + entry.getKey() + "\": " + entry.getValue() + ",\n") + .sorted() + .collect(Collectors.joining("")); + + Map<String, Object> configMap = new HashMap<>(); + + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "INSERT"); + setValueSafely(configMap, INSERT_DOCUMENT, "[{" + sampleInsertDocuments + "}]"); + setValueSafely(configMap, COLLECTION, collectionName); + + String rawQuery = "{\n" + + " \"insert\": \"" + collectionName + "\",\n" + + " \"documents\": [\n" + + " {\n" + + sampleInsertDocuments + + " }\n" + + " ]\n" + + "}\n"; + + return Collections.singletonList(new DatasourceStructure.Template( + "Insert", + rawQuery, + configMap + )); + } +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/MongoCommand.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/MongoCommand.java new file mode 100644 index 000000000000..0e10360c4bc3 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/MongoCommand.java @@ -0,0 +1,60 @@ +package com.external.plugins.commands; + +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.DatasourceStructure; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.bson.Document; +import org.pf4j.util.StringUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.COLLECTION; + +/** + * This is the base class which every Mongo Command extends. Common functions across all mongo commands + * are implemented here including reading and validating the collection. This also defines functions which should be + * implemented by all the commands. + */ +@Getter +@Setter +@NoArgsConstructor +public abstract class MongoCommand { + String collection; + List<String> fieldNamesWithNoConfiguration; + protected static final ObjectMapper objectMapper = new ObjectMapper(); + + public MongoCommand(ActionConfiguration actionConfiguration) { + + this.fieldNamesWithNoConfiguration = new ArrayList<>(); + + Map<String, Object> formData = actionConfiguration.getFormData(); + + if (validConfigurationPresent(formData, COLLECTION)) { + this.collection = (String) formData.get(COLLECTION); + } + } + + public Boolean isValid() { + if (StringUtils.isNullOrEmpty(this.collection)) { + fieldNamesWithNoConfiguration.add(COLLECTION); + return Boolean.FALSE; + } + return Boolean.TRUE; + } + + public Document parseCommand() { + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Unsupported Operation : All mongo commands must implement parseCommand"); + } + + public List<DatasourceStructure.Template> generateTemplate(Map<String, Object> templateConfiguration) { + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Unsupported Operation : All mongo commands must implement generateTemplate"); + } +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/UpdateMany.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/UpdateMany.java new file mode 100644 index 000000000000..5b0793adde03 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/commands/UpdateMany.java @@ -0,0 +1,130 @@ +package com.external.plugins.commands; + +import com.appsmith.external.models.ActionConfiguration; +import com.appsmith.external.models.DatasourceStructure; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.bson.Document; +import org.pf4j.util.StringUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.parseSafely; +import static com.external.plugins.MongoPluginUtils.setValueSafely; +import static com.external.plugins.MongoPluginUtils.validConfigurationPresent; +import static com.external.plugins.constants.FieldName.COLLECTION; +import static com.external.plugins.constants.FieldName.COMMAND; +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_QUERY; +import static com.external.plugins.constants.FieldName.UPDATE_UPDATE; + +@Getter +@Setter +@NoArgsConstructor +public class UpdateMany extends MongoCommand { + String query; + String update; + Boolean multi = Boolean.FALSE; + + public UpdateMany(ActionConfiguration actionConfiguration) { + super(actionConfiguration); + + Map<String, Object> formData = actionConfiguration.getFormData(); + + if (validConfigurationPresent(formData, UPDATE_QUERY)) { + this.query = (String) getValueSafely(formData, UPDATE_QUERY); + } + + if (validConfigurationPresent(formData, UPDATE_UPDATE)) { + this.update = (String) getValueSafely(formData, UPDATE_UPDATE); + } + + // Default for this is 1 to indicate updating only one document at a time. + if (validConfigurationPresent(formData, UPDATE_LIMIT)) { + String limitOption = (String) getValueSafely(formData, UPDATE_LIMIT); + if ("ALL".equals(limitOption)) { + this.multi = Boolean.TRUE; + } + } + } + + @Override + public Boolean isValid() { + if (super.isValid()) { + if (!StringUtils.isNullOrEmpty(query) && !StringUtils.isNullOrEmpty(update)) { + return Boolean.TRUE; + } else { + if (StringUtils.isNullOrEmpty(query)) { + fieldNamesWithNoConfiguration.add("Query"); + } + if (StringUtils.isNullOrEmpty(update)) { + fieldNamesWithNoConfiguration.add("Update"); + } + } + } + return Boolean.FALSE; + } + + @Override + public Document parseCommand() { + Document document = new Document(); + + document.put("update", this.collection); + + Document queryDocument = parseSafely("Query", this.query); + + Document updateDocument = parseSafely("Update", this.update); + + Document update = new Document(); + update.put("q", queryDocument); + update.put("u", updateDocument); + update.put("multi", multi); + + List<Document> updates = new ArrayList<>(); + updates.add(update); + + document.put("updates", updates); + + return document; + } + + @Override + public List<DatasourceStructure.Template> generateTemplate(Map<String, Object> templateConfiguration) { + String collectionName = (String) templateConfiguration.get("collectionName"); + String filterFieldName = (String) templateConfiguration.get("filterFieldName"); + + Map<String, Object> configMap = new HashMap<>(); + + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "UPDATE"); + setValueSafely(configMap, COLLECTION, collectionName); + setValueSafely(configMap, UPDATE_QUERY, "{ \"_id\": ObjectId(\"id_of_document_to_update\") }"); + setValueSafely(configMap, UPDATE_UPDATE, "{ \"$set\": { \"" + filterFieldName + "\": \"new value\" } }"); + setValueSafely(configMap, UPDATE_LIMIT, "ALL"); + + String rawQuery = "{\n" + + " \"update\": \"" + collectionName + "\",\n" + + " \"updates\": [\n" + + " {\n" + + " \"q\": {\n" + + " \"_id\": ObjectId(\"id_of_document_to_update\")\n" + + " },\n" + + " \"u\": { \"$set\": { \"" + filterFieldName + "\": \"new value\" } }\n" + + " }\n" + + " ]\n" + + "}\n"; + + return Collections.singletonList(new DatasourceStructure.Template( + "Update", + rawQuery, + configMap + )); + } +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/constants/FieldName.java b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/constants/FieldName.java new file mode 100644 index 000000000000..349fce7265ab --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/java/com/external/plugins/constants/FieldName.java @@ -0,0 +1,46 @@ +package com.external.plugins.constants; + +public class FieldName { + + public static final String SMART_SUBSTITUTION = "smartSubstitution"; + public static final String COMMAND = "command"; + public static final String COLLECTION = "collection"; + + public static final String FIND = "find"; + public static final String UPDATE_MANY = "updateMany"; + public static final String DELETE = "delete"; + public static final String COUNT = "count"; + public static final String DISTINCT = "distinct"; + public static final String AGGREGATE = "aggregate"; + public static final String INSERT = "insert"; + + public static final String QUERY = "query"; + public static final String SORT = "sort"; + public static final String PROJECTION = "projection"; + public static final String LIMIT = "limit"; + public static final String SKIP = "skip"; + public static final String UPDATE = "update"; + public static final String KEY = "key"; + public static final String PIPELINES = "arrayPipelines"; + public static final String DOCUMENTS = "documents"; + + public static final String AGGREGATE_PIPELINE = AGGREGATE + "." + "arrayPipelines"; + public static final String COUNT_QUERY = COUNT + "." + QUERY; + public static final String DELETE_QUERY = DELETE + "." + QUERY; + public static final String DELETE_LIMIT = DELETE + "." + LIMIT; + public static final String DISTINCT_QUERY = DISTINCT + "." + QUERY; + public static final String FIND_QUERY = FIND + "." + QUERY; + public static final String FIND_SORT = FIND + "." + SORT; + public static final String FIND_PROJECTION = FIND + "." + PROJECTION; + public static final String INSERT_DOCUMENT = INSERT + "." + DOCUMENTS; + public static final String UPDATE_QUERY = UPDATE_MANY + "." + QUERY; + public static final String UPDATE_UPDATE = UPDATE_MANY + "." + UPDATE; + public static final String DISTINCT_KEY = DISTINCT + "." + KEY; + public static final String FIND_LIMIT = FIND + "." + LIMIT; + public static final String FIND_SKIP = FIND + "." + SKIP; + public static final String UPDATE_LIMIT = UPDATE + "." + LIMIT; + + + public static final String RAW = "RAW"; + +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/dependency.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/dependency.json new file mode 100644 index 000000000000..418a8d2d09f8 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/dependency.json @@ -0,0 +1,7 @@ +{ + "dependencies": { + "actionConfiguration.body": [ + "actionConfiguration.formData.smartSubstitution" + ] + } +} \ No newline at end of file diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/editor.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/editor.json new file mode 100644 index 000000000000..0f36ee510f43 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/editor.json @@ -0,0 +1,286 @@ +{ + "editor": [ + { + "controlType": "SECTION", + "label": "", + "id": 1, + "children": [ + { + "label": "Command", + "configProperty": "actionConfiguration.formData.command", + "controlType": "DROP_DOWN", + "initialValue": "FIND", + "options": [ + { + "label": "Fetch Many", + "value": "FIND" + }, + { + "label": "Insert Document(s)", + "value": "INSERT" + }, + { + "label": "Update Document(s)", + "value": "UPDATE" + }, + { + "label": "Delete Document(s)", + "value": "DELETE" + }, + { + "label": "Count", + "value": "COUNT" + }, + { + "label": "Distinct", + "value": "DISTINCT" + }, + { + "label": "Aggregate", + "value": "AGGREGATE" + }, + { + "label": "Raw", + "value": "RAW" + } + ] + }, + { + "label": "Collection Name", + "configProperty": "actionConfiguration.formData.collection", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "conditionals": { + "hide": "{{actionConfiguration.formData.command === 'RAW'}}" + }, + "_hidden": { + "path": "actionConfiguration.formData.command", + "comparison": "EQUALS", + "value": "RAW" + } + }, + { + "controlType": "SECTION", + "label": "", + "serverLabel": "findCommandForm", + "conditionals": { + "show": "{{actionConfiguration.formData.command === 'FIND'}}" + }, + "children": [ + { + "label": "Query", + "configProperty": "actionConfiguration.formData.find.query", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "{rating : {$gte : 9}}" + }, + { + "label": "Sort", + "configProperty": "actionConfiguration.formData.find.sort", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "{name : 1}" + }, + { + "label": "Projection", + "configProperty": "actionConfiguration.formData.find.projection", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "{name : 1}" + }, + { + "label": "Limit", + "configProperty": "actionConfiguration.formData.find.limit", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "10" + }, + { + "label": "Skip", + "configProperty": "actionConfiguration.formData.find.skip", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "0" + } + ] + }, + { + "controlType": "SECTION", + "label": "", + "id": 4, + "serverLabel": "updateMany", + "conditionals": { + "show": "{{actionConfiguration.formData.command === 'UPDATE'}}" + }, + "children": [ + { + "label": "Query", + "configProperty": "actionConfiguration.formData.updateMany.query", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "{rating : {$gte : 9}}" + }, + { + "label": "Update", + "configProperty": "actionConfiguration.formData.updateMany.update", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "{ $inc: { score: 1 } }" + }, + { + "label": "Limit", + "configProperty": "actionConfiguration.formData.updateMany.limit", + "controlType": "DROP_DOWN", + "initialValue": "SINGLE", + "options": [ + { + "label": "Single Document", + "value": "SINGLE" + }, + { + "label": "All Matching Documents", + "value": "ALL" + } + ] + } + ] + }, + { + "controlType": "SECTION", + "label": "", + "id": 5, + "serverLabel": "delete", + "conditionals": { + "show": "{{actionConfiguration.formData.command === 'DELETE'}}" + }, + "children": [ + { + "label": "Query", + "configProperty": "actionConfiguration.formData.delete.query", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "{rating : {$gte : 9}}" + }, + { + "label": "Limit", + "configProperty": "actionConfiguration.formData.delete.limit", + "controlType": "DROP_DOWN", + "initialValue": "SINGLE", + "options": [ + { + "label": "Single Document", + "value": "SINGLE" + }, + { + "label": "All Matching Documents", + "value": "ALL" + } + ] + } + ] + }, + { + "controlType": "SECTION", + "label": "", + "id": 6, + "serverLabel": "count", + "_conditionals": { + "show": "{{actionConfiguration.formData.command === 'COUNT'}}" + }, + "children": [ + { + "label": "Query", + "configProperty": "actionConfiguration.formData.count.query", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "{rating : {$gte : 9}}" + } + ] + }, + { + "controlType": "SECTION", + "label": "", + "id": 7, + "serverLabel": "distinct", + "conditionals": { + "show": "{{actionConfiguration.formData.command === 'DISTINCT'}}" + }, + "children": [ + { + "label": "Query", + "configProperty": "actionConfiguration.formData.distinct.query", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "{rating : {$gte : 9}}" + }, + { + "label": "Key", + "configProperty": "actionConfiguration.formData.distinct.key", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "name" + } + ] + }, + { + "controlType": "SECTION", + "label": "", + "id": 8, + "serverLabel": "aggregate", + "conditionals": { + "show": "{{actionConfiguration.formData.command === 'AGGREGATE'}}" + }, + "children": [ + { + "label": "Array of Pipelines", + "configProperty": "actionConfiguration.formData.aggregate.arrayPipelines", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "[{ $project: { tags: 1 } }, { $unwind: \"$tags\" }, { $group: { _id: \"$tags\", count: { $sum : 1 } } } ]" + } + ] + }, + { + "controlType": "SECTION", + "label": "", + "id": 9, + "serverLabel": "insert", + "conditionals": { + "show": "{{actionConfiguration.formData.command === 'INSERT'}}" + }, + "children": [ + { + "label": "Documents", + "configProperty": "actionConfiguration.formData.insert.documents", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "placeholderText": "[ { _id: 1, user: \"abc123\", status: \"A\" } ]" + } + ] + }, + { + "controlType": "SECTION", + "label": "", + "internalLabel": "Query", + "configProperty": "actionConfiguration.body", + "controlType": "QUERY_DYNAMIC_TEXT", + "evaluationSubstitutionType": "SMART_SUBSTITUTE", + "conditionals": { + "show": "{{actionConfiguration.formData.command === 'RAW' && actionConfiguration.formData.smartSubstitution === true}}" + } + }, + { + "controlType": "SECTION", + "label": "", + "configProperty": "actionConfiguration.body", + "internalLabel": "Query", + "controlType": "QUERY_DYNAMIC_TEXT", + "evaluationSubstitutionType": "TEMPLATE", + "conditionals": { + "show": "{{actionConfiguration.formData.command === 'RAW' && actionConfiguration.formData.smartSubstitution === false}}" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/form.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/form.json new file mode 100644 index 000000000000..1878ba55df51 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/form.json @@ -0,0 +1,218 @@ +{ + "form": [ + { + "sectionName": "Connection", + "children": [ + { + "label": "Use Mongo Connection String URI Key", + "configProperty": "datasourceConfiguration.properties[0].key", + "controlType": "INPUT_TEXT", + "initialValue": "Use Mongo Connection String URI", + "hidden": true + }, + { + "label": "Use Mongo Connection String URI", + "configProperty": "datasourceConfiguration.properties[0].value", + "controlType": "DROP_DOWN", + "initialValue": "No", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + }, + { + "label": "Connection String URI Key", + "configProperty": "datasourceConfiguration.properties[1].key", + "controlType": "INPUT_TEXT", + "initialValue": "Connection String URI", + "hidden": true + }, + { + "label": "Connection String URI", + "placeholderText": "mongodb+srv://<username>:<password>@test-db.swrsq.mongodb.net/myDatabase", + "configProperty": "datasourceConfiguration.properties[1].value", + "controlType": "INPUT_TEXT", + "hidden": { + "path": "datasourceConfiguration.properties[0].value", + "comparison": "NOT_EQUALS", + "value": "Yes" + } + }, + { + "label": "Connection Mode", + "configProperty": "datasourceConfiguration.connection.mode", + "controlType": "DROP_DOWN", + "initialValue": "READ_WRITE", + "options": [ + { + "label": "Read Only", + "value": "READ_ONLY" + }, + { + "label": "Read / Write", + "value": "READ_WRITE" + } + ], + "hidden": { + "path": "datasourceConfiguration.properties[0].value", + "comparison": "EQUALS", + "value": "Yes" + } + }, + { + "label": "Connection Type", + "configProperty": "datasourceConfiguration.connection.type", + "initialValue": "DIRECT", + "controlType": "DROP_DOWN", + "options": [ + { + "label": "Direct Connection", + "value": "DIRECT" + }, + { + "label": "Replica set", + "value": "REPLICA_SET" + } + ], + "hidden": { + "path": "datasourceConfiguration.properties[0].value", + "comparison": "EQUALS", + "value": "Yes" + } + }, + { + "sectionName": null, + "children": [ + { + "label": "Host Address", + "configProperty": "datasourceConfiguration.endpoints[*].host", + "controlType": "KEYVALUE_ARRAY", + "validationMessage": "Please enter a valid host", + "validationRegex": "^((?![/:]).)*$", + "placeholderText": "myapp.abcde.mongodb.net", + "hidden": { + "path": "datasourceConfiguration.properties[0].value", + "comparison": "EQUALS", + "value": "Yes" + } + }, + { + "label": "Port", + "configProperty": "datasourceConfiguration.endpoints[*].port", + "dataType": "NUMBER", + "controlType": "KEYVALUE_ARRAY", + "hidden": { + "path": "datasourceConfiguration.properties[0].value", + "comparison": "EQUALS", + "value": "Yes" + } + } + ] + }, + { + "label": "Default Database Name", + "placeholderText": "(Optional)", + "configProperty": "datasourceConfiguration.connection.defaultDatabaseName", + "controlType": "INPUT_TEXT", + "hidden": { + "path": "datasourceConfiguration.properties[0].value", + "comparison": "EQUALS", + "value": "Yes" + } + } + ] + }, + { + "sectionName": "Authentication", + "hidden": { + "path": "datasourceConfiguration.properties[0].value", + "comparison": "EQUALS", + "value": "Yes" + }, + "children": [ + { + "label": "Database Name", + "configProperty": "datasourceConfiguration.authentication.databaseName", + "controlType": "INPUT_TEXT", + "placeholderText": "Database name", + "initialValue": "admin" + }, + { + "label": "Authentication Type", + "configProperty": "datasourceConfiguration.authentication.authType", + "controlType": "DROP_DOWN", + "initialValue": "SCRAM_SHA_1", + "options": [ + { + "label": "SCRAM-SHA-1", + "value": "SCRAM_SHA_1" + }, + { + "label": "SCRAM-SHA-256", + "value": "SCRAM_SHA_256" + }, + { + "label": "MONGODB-CR", + "value": "MONGODB_CR" + } + ] + }, + { + "sectionName": null, + "children": [ + { + "label": "Username", + "configProperty": "datasourceConfiguration.authentication.username", + "controlType": "INPUT_TEXT", + "placeholderText": "Username" + }, + { + "label": "Password", + "configProperty": "datasourceConfiguration.authentication.password", + "dataType": "PASSWORD", + "controlType": "INPUT_TEXT", + "placeholderText": "Password", + "encrypted": true + } + ] + } + ] + }, + { + "sectionName": "SSL (optional)", + "hidden": { + "path": "datasourceConfiguration.properties[0].value", + "comparison": "EQUALS", + "value": "Yes" + }, + "children": [ + { + "label": "SSL Mode", + "configProperty": "datasourceConfiguration.connection.ssl.authType", + "controlType": "DROP_DOWN", + "initialValue": "DEFAULT", + "options": [ + { + "label": "Default", + "value": "DEFAULT" + }, + { + "label": "Enabled", + "value": "ENABLED" + }, + { + "label": "Disabled", + "value": "DISABLED" + } + ] + } + ] + } + ] +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/setting.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/setting.json new file mode 100644 index 000000000000..97b4b560dfec --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/setting.json @@ -0,0 +1,36 @@ +{ + "setting": [ + { + "sectionName": "", + "id": 1, + "children": [ + { + "label": "Run query on page load", + "configProperty": "executeOnLoad", + "controlType": "SWITCH", + "info": "Will refresh data each time the page is loaded" + }, + { + "label": "Request confirmation before running query", + "configProperty": "confirmBeforeExecute", + "controlType": "SWITCH", + "info": "Ask confirmation from the user each time before refreshing data" + }, + { + "label": "Smart BSON Substitution", + "info": "Turning on this property fixes the BSON substitution of bindings in the Mongo BSON document by adding/removing quotes intelligently and reduces developer errors", + "configProperty": "actionConfiguration.formData.smartSubstitution", + "controlType": "SWITCH", + "initialValue": true + }, + { + "label": "Query timeout (in milliseconds)", + "info": "Maximum time after which the query will return", + "configProperty": "actionConfiguration.timeoutInMillisecond", + "controlType": "INPUT_TEXT", + "dataType": "NUMBER" + } + ] + } + ] +} \ No newline at end of file diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/CREATE.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/CREATE.json new file mode 100644 index 000000000000..000062cdf95a --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/CREATE.json @@ -0,0 +1,10 @@ +{ + "insert": "users", + "documents": [ + { + "name": "{{ nameInput.text }}", + "email": "{{ emailInput.text }}", + "gender": "{{ genderDropdown.selectedOptionValue }}" + } + ] +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/DELETE.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/DELETE.json new file mode 100644 index 000000000000..a10f6da1cf12 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/DELETE.json @@ -0,0 +1,11 @@ +{ + "delete": "users", + "deletes": [ + { + "q": { + "id": "{{ usersTable.selectedRow.id }}" + }, + "limit": 1 + } + ] +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/READ.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/READ.json new file mode 100644 index 000000000000..49ca131c9b96 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/READ.json @@ -0,0 +1,10 @@ +{ + "find": "users", + "filter": { + "status": "{{ statusDropdown.selectedOptionValue }}" + }, + "sort": { + "id": 1 + }, + "limit": 10 +} \ No newline at end of file diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/UPDATE.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/UPDATE.json new file mode 100644 index 000000000000..437a26a70f02 --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/UPDATE.json @@ -0,0 +1,11 @@ +{ + "update": "users", + "updates": [ + { + "q": { + "id": 10 + }, + "u": { "$set": { "status": "{{ statusDropdown.selectedOptionValue }}" } } + } + ] +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/meta.json b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/meta.json new file mode 100644 index 000000000000..833afaa6ea2c --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/main/resources/templates/meta.json @@ -0,0 +1,16 @@ +{ + "templates": [ + { + "file": "CREATE.json" + }, + { + "file": "READ.json" + }, + { + "file": "UPDATE.json" + }, + { + "file": "DELETE.json" + } + ] +} diff --git a/app/server/appsmith-plugins/mongoPluginUqi/src/test/java/com/external/plugins/MongoPluginUqiTest.java b/app/server/appsmith-plugins/mongoPluginUqi/src/test/java/com/external/plugins/MongoPluginUqiTest.java new file mode 100644 index 000000000000..deb9f5e7bf7f --- /dev/null +++ b/app/server/appsmith-plugins/mongoPluginUqi/src/test/java/com/external/plugins/MongoPluginUqiTest.java @@ -0,0 +1,1525 @@ +package com.external.plugins; + +import com.appsmith.external.dtos.ExecuteActionDTO; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +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.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.mongodb.MongoCommandException; +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.junit.Assert; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.testcontainers.containers.GenericContainer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.math.BigDecimal; +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.external.plugins.MongoPluginUtils.getValueSafely; +import static com.external.plugins.MongoPluginUtils.setValueSafely; +import static com.external.plugins.constants.FieldName.AGGREGATE_PIPELINE; +import static com.external.plugins.constants.FieldName.COLLECTION; +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.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_UPDATE; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +/** + * Unit tests for MongoPluginUqi + */ + +public class MongoPluginUqiTest { + + MongoPluginUqi.MongoPluginUqiExecutor pluginExecutor = new MongoPluginUqi.MongoPluginUqiExecutor(); + + private static String address; + private static Integer port; + + @SuppressWarnings("rawtypes") + @ClassRule + public static GenericContainer mongoContainer = new GenericContainer(CompletableFuture.completedFuture("mongo:4.4")) + .withExposedPorts(27017); + + private JsonNode value; + + @BeforeClass + public static void setUp() { + address = mongoContainer.getContainerIpAddress(); + port = mongoContainer.getFirstMappedPort(); + String uri = "mongodb://" + address + ":" + Integer.toString(port); + final MongoClient mongoClient = MongoClients.create(uri); + + Flux.from(mongoClient.getDatabase("test").listCollectionNames()).collectList(). + flatMap(collectionNamesList -> { + final MongoCollection<Document> usersCollection = mongoClient.getDatabase("test").getCollection( + "users"); + if (collectionNamesList.size() == 0) { + Mono.from(usersCollection.insertMany(List.of( + new Document(Map.of( + "name", "Cierra Vega", + "gender", "F", + "age", 20, + "luckyNumber", 987654321L, + "dob", LocalDate.of(2018, 12, 31), + "netWorth", new BigDecimal("123456.789012"), + "updatedByCommand", false + )), + new Document(Map.of("name", "Alden Cantrell", "gender", "M", "age", 30)), + new Document(Map.of("name", "Kierra Gentry", "gender", "F", "age", 40)) + ))).block(); + } + + return Mono.just(usersCollection); + }).block(); + } + + private DatasourceConfiguration createDatasourceConfiguration() { + Endpoint endpoint = new Endpoint(); + endpoint.setHost(address); + endpoint.setPort(port.longValue()); + + Connection connection = new Connection(); + connection.setMode(Connection.Mode.READ_WRITE); + connection.setType(Connection.Type.DIRECT); + connection.setDefaultDatabaseName("test"); + connection.setSsl(new SSLDetails()); + connection.getSsl().setAuthType(SSLDetails.AuthType.DEFAULT); + + DatasourceConfiguration dsConfig = new DatasourceConfiguration(); + dsConfig.setConnection(connection); + dsConfig.setEndpoints(List.of(endpoint)); + + return dsConfig; + } + + @Test + public void testConnectToMongo() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + StepVerifier.create(dsConnectionMono) + .assertNext(obj -> { + MongoClient client = obj; + assertNotNull(client); + }) + .verifyComplete(); + } + + @Test + public void testConnectToMongoWithoutUsername() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + dsConfig.setAuthentication(new DBAuth(DBAuth.Type.SCRAM_SHA_1, "", "", "admin")); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + StepVerifier.create(dsConnectionMono) + .assertNext(Assert::assertNotNull) + .verifyComplete(); + } + + /** + * 1. Test "testDatasource" method in MongoPluginUqiExecutor class. + */ + @Test + public void testDatasourceFail() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + dsConfig.getEndpoints().get(0).setHost("badHost"); + + StepVerifier.create(pluginExecutor.testDatasource(dsConfig)) + .assertNext(datasourceTestResult -> { + assertNotNull(datasourceTestResult); + assertFalse(datasourceTestResult.isSuccess()); + }) + .verifyComplete(); + } + + /* + * 1. Test that when a query is attempted to run on mongodb but refused because of lack of authorization, then + * also, it indicates a successful connection establishment. + */ + @Test + public void testDatasourceWithUnauthorizedException() throws NoSuchFieldException { + /* + * 1. Create mock exception of type: MongoCommandException. + * - mock method getErrorCodeName() to return String "Unauthorized". + */ + MongoCommandException mockMongoCommandException = mock(MongoCommandException.class); + when(mockMongoCommandException.getErrorCodeName()).thenReturn("Unauthorized"); + when(mockMongoCommandException.getMessage()).thenReturn("Mock Unauthorized Exception"); + + /* + * 1. Spy MongoPluginUqiExecutor class. + * - On calling testDatasource(...) -> call the real method. + * - On calling datasourceCreate(...) -> throw the mock exception defined above. + */ + MongoPluginUqi.MongoPluginUqiExecutor mongoPluginUqiExecutor = new MongoPluginUqi.MongoPluginUqiExecutor(); + MongoPluginUqi.MongoPluginUqiExecutor spyMongoPluginUqiExecutor = spy(mongoPluginUqiExecutor); + /* Please check this out before modifying this line: https://stackoverflow + * .com/questions/11620103/mockito-trying-to-spy-on-method-is-calling-the-original-method + */ + doReturn(Mono.error(mockMongoCommandException)).when(spyMongoPluginUqiExecutor).datasourceCreate(any()); + + /* + * 1. Test that MongoCommandException with error code "Unauthorized" is caught and no error is reported. + */ + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + StepVerifier + .create(spyMongoPluginUqiExecutor.testDatasource(dsConfig)) + .assertNext(datasourceTestResult -> { + assertTrue(datasourceTestResult.isSuccess()); + }) + .verifyComplete(); + } + + @Test + public void testExecuteReadQuery() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " find: \"users\",\n" + + " filter: { \"age\": { \"$gte\": 30 } },\n" + + " sort: { id: 1 },\n" + + " limit: 10,\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals(2, ((ArrayNode) result.getBody()).size()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + + + /* + * - RequestParamDTO object only have attributes configProperty and value at this point. + * - The other two RequestParamDTO attributes - label and type are null at this point. + */ + List<RequestParamDTO> expectedRequestParams = new ArrayList<>(); + expectedRequestParams.add(new RequestParamDTO(ACTION_CONFIGURATION_BODY, + actionConfiguration.getBody(), null, null, null)); + assertEquals(result.getRequest().getRequestParams().toString(), expectedRequestParams.toString()); + }) + .verifyComplete(); + } + + @Test + public void testExecuteInvalidReadQuery() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " find: \"users\",\n" + + " filter: { $is: {} },\n" + + " sort: { id: 1 },\n" + + " limit: 10,\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertFalse(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals("unknown top level operator: $is", result.getBody()); + assertEquals(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR.getTitle(), result.getTitle()); + + /* + * - RequestParamDTO object only have attributes configProperty and value at this point. + * - The other two RequestParamDTO attributes - label and type are null at this point. + */ + List<RequestParamDTO> expectedRequestParams = new ArrayList<>(); + expectedRequestParams.add(new RequestParamDTO(ACTION_CONFIGURATION_BODY, + actionConfiguration.getBody(), null, null, null)); + assertEquals(result.getRequest().getRequestParams().toString(), expectedRequestParams.toString()); + }) + .verifyComplete(); + } + + @Test + public void testExecuteWriteQuery() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " insert: \"users\",\n" + + " documents: [\n" + + " {\n" + + " name: \"John Smith\",\n" + + " email: [\"[email protected]](mailto:%[email protected])\"],\n" + + " gender: \"M\",\n" + + " age: \"50\",\n" + + " },\n" + + " ],\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + + // Clean up this newly inserted value + configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "DELETE"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, DELETE_QUERY, "{\"name\": \"John Smith\"}"); + setValueSafely(configMap, DELETE_LIMIT, "SINGLE"); + + actionConfiguration.setFormData(configMap); + // Run the delete command + dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)).block(); + } + + @Test + public void testFindAndModify() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " findAndModify: \"users\",\n" + + " query: " + + "{ " + + "name: \"Alden Cantrell\"" + + " },\n" + + " update: { $set: { gender: \"F\" }}\n" + + "}"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + value = ((ObjectNode) result.getBody()).get("value"); + assertNotNull(value); + assertEquals("M", value.get("gender").asText()); + assertEquals("Alden Cantrell", value.get("name").asText()); + assertEquals(30, value.get("age").asInt()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + } + + @Test + public void testCleanUp() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " find: \"users\",\n" + + " limit: 1,\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + final ArrayNode body = (ArrayNode) result.getBody(); + assertEquals(1, body.size()); + final JsonNode node = body.get(0); + assertTrue(node.get("_id").isTextual()); + assertTrue(node.get("luckyNumber").isNumber()); + assertEquals("2018-12-31T00:00:00Z", node.get("dob").asText()); + assertEquals("123456.789012", node.get("netWorth").toString()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + } + + @Test + public void testStructure() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<DatasourceStructure> structureMono = pluginExecutor.datasourceCreate(dsConfig) + .flatMap(connection -> pluginExecutor.getStructure(connection, dsConfig)); + + StepVerifier.create(structureMono) + .assertNext(structure -> { + assertNotNull(structure); + assertEquals(1, structure.getTables().size()); + + final DatasourceStructure.Table usersTable = structure.getTables().get(0); + assertEquals("users", usersTable.getName()); + assertEquals(DatasourceStructure.TableType.COLLECTION, usersTable.getType()); + assertArrayEquals( + new DatasourceStructure.Column[]{ + new DatasourceStructure.Column("_id", "ObjectId", null, true), + new DatasourceStructure.Column("age", "Integer", null, false), + new DatasourceStructure.Column("dob", "Date", null, false), + new DatasourceStructure.Column("gender", "String", null, false), + new DatasourceStructure.Column("luckyNumber", "Long", null, false), + new DatasourceStructure.Column("name", "String", null, false), + new DatasourceStructure.Column("netWorth", "BigDecimal", null, false), + new DatasourceStructure.Column("updatedByCommand", "Object", null, false), + }, + usersTable.getColumns().toArray() + ); + + assertArrayEquals( + new DatasourceStructure.Key[]{}, + usersTable.getKeys().toArray() + ); + List<DatasourceStructure.Template> templates = usersTable.getTemplates(); + + //Assert Find command + DatasourceStructure.Template findTemplate = templates.get(0); + assertEquals(findTemplate.getTitle(), "Find"); + assertEquals(findTemplate.getBody(), "{\n" + + " \"find\": \"users\",\n" + + " \"filter\": {\n" + + " \"gender\": \"F\"\n" + + " },\n" + + " \"sort\": {\n" + + " \"_id\": 1\n" + + " },\n" + + " \"limit\": 10\n" + + "}\n"); + assertEquals( ((Map<String, Object>) findTemplate.getConfiguration()).get(COMMAND), "FIND"); + + assertEquals(getValueSafely((Map<String, Object>) findTemplate.getConfiguration(), FIND_QUERY), + "{ \"gender\": \"F\"}"); + assertEquals(getValueSafely((Map<String, Object>) findTemplate.getConfiguration(), FIND_SORT), + "{\"_id\": 1}"); + + //Assert Find By Id command + DatasourceStructure.Template findByIdTemplate = templates.get(1); + assertEquals(findByIdTemplate.getTitle(), "Find by ID"); + assertEquals(findByIdTemplate.getBody(), "{\n" + + " \"find\": \"users\",\n" + + " \"filter\": {\n" + + " \"_id\": ObjectId(\"id_to_query_with\")\n" + + " }\n" + + "}\n"); + assertEquals( ((Map<String, Object>) findByIdTemplate.getConfiguration()).get(COMMAND), "FIND"); + assertEquals(getValueSafely((Map<String, Object>) findByIdTemplate.getConfiguration(), FIND_QUERY), + "{\"_id\": ObjectId(\"id_to_query_with\")}"); + + // Assert Insert command + DatasourceStructure.Template insertTemplate = templates.get(2); + assertEquals(insertTemplate.getTitle(), "Insert"); + assertEquals(insertTemplate.getBody(), "{\n" + + " \"insert\": \"users\",\n" + + " \"documents\": [\n" + + " {\n" + + " \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n" + + " \"age\": 1,\n" + + " \"dob\": new Date(\"2019-07-01\"),\n" + + " \"gender\": \"new value\",\n" + + " \"luckyNumber\": NumberLong(\"1\"),\n" + + " \"name\": \"new value\",\n" + + " \"netWorth\": NumberDecimal(\"1\"),\n" + + " \"updatedByCommand\": {},\n" + + " }\n" + + " ]\n" + + "}\n"); + assertEquals(((Map<String, Object>) insertTemplate.getConfiguration()).get(COMMAND), "INSERT"); + assertEquals(getValueSafely((Map<String, Object>) insertTemplate.getConfiguration(), INSERT_DOCUMENT), + "[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n" + + " \"age\": 1,\n" + + " \"dob\": new Date(\"2019-07-01\"),\n" + + " \"gender\": \"new value\",\n" + + " \"luckyNumber\": NumberLong(\"1\"),\n" + + " \"name\": \"new value\",\n" + + " \"netWorth\": NumberDecimal(\"1\"),\n" + + " \"updatedByCommand\": {},\n" + + "}]"); + + // Assert Update command + DatasourceStructure.Template updateTemplate = templates.get(3); + assertEquals(updateTemplate.getTitle(), "Update"); + assertEquals(updateTemplate.getBody(), "{\n" + + " \"update\": \"users\",\n" + + " \"updates\": [\n" + + " {\n" + + " \"q\": {\n" + + " \"_id\": ObjectId(\"id_of_document_to_update\")\n" + + " },\n" + + " \"u\": { \"$set\": { \"gender\": \"new value\" } }\n" + + " }\n" + + " ]\n" + + "}\n"); + assertEquals(((Map<String, Object>) updateTemplate.getConfiguration()).get(COMMAND), "UPDATE"); + assertEquals(getValueSafely((Map<String, Object>) updateTemplate.getConfiguration(), UPDATE_QUERY), + "{ \"_id\": ObjectId(\"id_of_document_to_update\") }"); + assertEquals(getValueSafely((Map<String, Object>) updateTemplate.getConfiguration(), UPDATE_UPDATE), + "{ \"$set\": { \"gender\": \"new value\" } }"); + + // Assert Delete Command + DatasourceStructure.Template deleteTemplate = templates.get(4); + assertEquals(deleteTemplate.getTitle(), "Delete"); + assertEquals(deleteTemplate.getBody(), "{\n" + + " \"delete\": \"users\",\n" + + " \"deletes\": [\n" + + " {\n" + + " \"q\": {\n" + + " \"_id\": \"id_of_document_to_delete\"\n" + + " },\n" + + " \"limit\": 1\n" + + " }\n" + + " ]\n" + + "}\n"); + assertEquals(((Map<String, Object>) deleteTemplate.getConfiguration()).get(COMMAND), "DELETE"); + assertEquals(getValueSafely((Map<String, Object>) deleteTemplate.getConfiguration(), DELETE_QUERY), + "{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"); + assertEquals(getValueSafely((Map<String, Object>) deleteTemplate.getConfiguration(), DELETE_LIMIT), + "SINGLE"); + }) + .verifyComplete(); + } + + @Test + public void testErrorMessageOnSrvUriWithFormInterface() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + dsConfig.getEndpoints().get(0).setHost("mongodb+srv://user:[email protected]/dbName"); + dsConfig.setProperties(List.of(new Property("Import from URI", "No"))); + Mono<Set<String>> invalidsMono = Mono.just(pluginExecutor.validateDatasource(dsConfig)); + + StepVerifier.create(invalidsMono) + .assertNext(invalids -> { + assertTrue(invalids + .stream() + .anyMatch(error -> error.contains("It seems that you are trying to use a mongo connection" + + " string URI. Please extract relevant fields and fill the form with extracted " + + "values. For details, please check out the Appsmith's documentation for Mongo " + + "database. Alternatively, you may use 'Import from Connection String URI' option " + + "from the dropdown labelled 'Use Mongo Connection String URI' to use the URI " + + "connection string directly."))); + }) + .verifyComplete(); + } + + @Test + public void testErrorMessageOnNonSrvUri() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + List<Endpoint> endpoints = new ArrayList<>(); + endpoints.add(new Endpoint("url", 123L)); + endpoints.add(null); + endpoints.add(new Endpoint(null, 123L)); + endpoints.add(new Endpoint("mongodb://user:[email protected]:1234,url.net:1234/dbName", 123L)); + dsConfig.setEndpoints(endpoints); + dsConfig.setProperties(List.of(new Property("Import from URI", "No"))); + Mono<Set<String>> invalidsMono = Mono.just(pluginExecutor.validateDatasource(dsConfig)); + + StepVerifier.create(invalidsMono) + .assertNext(invalids -> { + assertTrue(invalids + .stream() + .anyMatch(error -> error.contains("It seems that you are trying to use a mongo connection" + + " string URI. Please extract relevant fields and fill the form with extracted " + + "values. For details, please check out the Appsmith's documentation for Mongo " + + "database. Alternatively, you may use 'Import from Connection String URI' option " + + "from the dropdown labelled 'Use Mongo Connection String URI' to use the URI " + + "connection string directly."))); + }) + .verifyComplete(); + } + + @Test + public void testInvalidsOnMissingUri() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + dsConfig.setProperties(List.of(new Property("Import from URI", "Yes"))); + Mono<Set<String>> invalidsMono = Mono.just(pluginExecutor.validateDatasource(dsConfig)); + + StepVerifier.create(invalidsMono) + .assertNext(invalids -> { + assertTrue(invalids + .stream() + .anyMatch(error -> error.contains("'Mongo Connection String URI' field is empty. Please " + + "edit the 'Mongo Connection URI' field to provide a connection uri to connect with."))); + }) + .verifyComplete(); + } + + @Test + public void testInvalidsOnBadSrvUriFormat() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + List<Property> properties = new ArrayList<>(); + properties.add(new Property("Import from URI", "Yes")); + properties.add(new Property("Srv Url", "mongodb+srv::username:password//url.net")); + dsConfig.setProperties(properties); + Mono<Set<String>> invalidsMono = Mono.just(pluginExecutor.validateDatasource(dsConfig)); + + StepVerifier.create(invalidsMono) + .assertNext(invalids -> { + assertTrue(invalids + .stream() + .anyMatch(error -> error.contains("Mongo Connection String URI does not seem to be in the" + + " correct format. Please check the URI once."))); + }) + .verifyComplete(); + } + + @Test + public void testInvalidsOnBadNonSrvUriFormat() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + List<Property> properties = new ArrayList<>(); + properties.add(new Property("Import from URI", "Yes")); + properties.add(new Property("Srv Url", "mongodb::username:password//url.net")); + dsConfig.setProperties(properties); + Mono<Set<String>> invalidsMono = Mono.just(pluginExecutor.validateDatasource(dsConfig)); + + StepVerifier.create(invalidsMono) + .assertNext(invalids -> { + assertTrue(invalids + .stream() + .anyMatch(error -> error.contains("Mongo Connection String URI does not seem to be in the" + + " correct format. Please check the URI once."))); + }) + .verifyComplete(); + } + + @Test + public void testInvalidsEmptyOnCorrectSrvUriFormat() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + List<Property> properties = new ArrayList<>(); + properties.add(new Property("Import from URI", "Yes")); + properties.add(new Property("Srv Url", "mongodb+srv://username:[email protected]/dbname")); + dsConfig.setProperties(properties); + Mono<Set<String>> invalidsMono = Mono.just(pluginExecutor.validateDatasource(dsConfig)); + + StepVerifier.create(invalidsMono) + .assertNext(invalids -> { + assertTrue(invalids.isEmpty()); + }) + .verifyComplete(); + } + + @Test + public void testInvalidsEmptyOnCorrectNonSrvUriFormat() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + List<Property> properties = new ArrayList<>(); + properties.add(new Property("Import from URI", "Yes")); + properties.add(new Property("Srv Url", "mongodb://username:[email protected]:1234,url-2:1234/dbname")); + dsConfig.setProperties(properties); + Mono<Set<String>> invalidsMono = Mono.just(pluginExecutor.validateDatasource(dsConfig)); + + StepVerifier.create(invalidsMono) + .assertNext(invalids -> { + assertTrue(invalids.isEmpty()); + }) + .verifyComplete(); + } + + @Test + public void testTestDatasourceTimeoutError() { + String badHost = "mongo-bad-url.mongodb.net"; + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + dsConfig.getEndpoints().get(0).setHost(badHost); + + Mono<DatasourceTestResult> datasourceTestResult = pluginExecutor.testDatasource(dsConfig); + + StepVerifier.create(datasourceTestResult) + .assertNext(result -> { + assertFalse(result.isSuccess()); + assertTrue(result.getInvalids().size() == 1); + assertTrue(result + .getInvalids() + .stream() + .anyMatch(error -> error.contains( + "Connection timed out. Please check if the datasource configuration fields have " + + "been filled correctly." + ))); + }) + .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 testSslDefault() { + DatasourceConfiguration datasourceConfiguration = createDatasourceConfiguration(); + datasourceConfiguration.getConnection().getSsl().setAuthType(SSLDetails.AuthType.DEFAULT); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " find: \"users\",\n" + + " filter: { age: { $gte: 30 } },\n" + + " sort: { id: 1 },\n" + + " limit: 10,\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(datasourceConfiguration); + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, + new ExecuteActionDTO(), + datasourceConfiguration, + actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals(2, ((ArrayNode) result.getBody()).size()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + } + + @Test + public void testSslDisabled() { + DatasourceConfiguration datasourceConfiguration = createDatasourceConfiguration(); + datasourceConfiguration.getConnection().getSsl().setAuthType(SSLDetails.AuthType.DISABLED); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " find: \"users\",\n" + + " filter: { age: { $gte: 30 } },\n" + + " sort: { id: 1 },\n" + + " limit: 10,\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(datasourceConfiguration); + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, + new ExecuteActionDTO(), + datasourceConfiguration, + actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals(2, ((ArrayNode) result.getBody()).size()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + } + + @Test + public void testSslEnabled() { + DatasourceConfiguration datasourceConfiguration = createDatasourceConfiguration(); + datasourceConfiguration.getConnection().getSsl().setAuthType(SSLDetails.AuthType.ENABLED); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " find: \"users\",\n" + + " filter: { age: { $gte: 30 } },\n" + + " sort: { id: 1 },\n" + + " limit: 10,\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(datasourceConfiguration); + Mono<ActionExecutionResult> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, + new ExecuteActionDTO(), + datasourceConfiguration, + actionConfiguration)); + + /* + * - This test case is exactly same as the one's used in DEFAULT and DISABLED tests. + * - Expect error here because testcontainer does not support SSL connection. + */ + StepVerifier.create(executeMono) + .assertNext(result -> { + assertFalse(result.getIsExecutionSuccess()); + assertEquals(AppsmithPluginError.PLUGIN_QUERY_TIMEOUT_ERROR.getTitle(), result.getTitle()); + }) + .verifyComplete(); + } + + @Test + public void testBsonSmartSubstitution_withBSONValue() { + DatasourceConfiguration datasourceConfiguration = createDatasourceConfiguration(); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " find: {{Input4.text}},\n" + + " filter: \"{{Input1.text}}\",\n" + + " sort: { id: {{Input2.text}} },\n" + + " limit: {{Input3.text}}\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + ExecuteActionDTO executeActionDTO = new ExecuteActionDTO(); + List<Param> params = new ArrayList<>(); + Param param1 = new Param(); + param1.setKey("Input1.text"); + param1.setValue("{ age: { \"$gte\": 30 } }"); + params.add(param1); + Param param3 = new Param(); + param3.setKey("Input2.text"); + param3.setValue("1"); + params.add(param3); + Param param4 = new Param(); + param4.setKey("Input3.text"); + param4.setValue("10"); + params.add(param4); + Param param5 = new Param(); + param5.setKey("Input4.text"); + param5.setValue("users"); + params.add(param5); + executeActionDTO.setParams(params); + + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(datasourceConfiguration); + Mono<ActionExecutionResult> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, + executeActionDTO, + datasourceConfiguration, + actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals(2, ((ArrayNode) result.getBody()).size()); + + // 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(), 4); + + Map.Entry<String, String> parameterEntry = parameters.get(0); + assertEquals(parameterEntry.getKey(), "users"); + assertEquals(parameterEntry.getValue(), "STRING"); + + parameterEntry = parameters.get(1); + assertEquals(parameterEntry.getKey(), "{ age: { \"$gte\": 30 } }"); + assertEquals(parameterEntry.getValue(), "BSON"); + + parameterEntry = parameters.get(2); + assertEquals(parameterEntry.getKey(), "1"); + assertEquals(parameterEntry.getValue(), "INTEGER"); + + parameterEntry = parameters.get(3); + assertEquals(parameterEntry.getKey(), "10"); + assertEquals(parameterEntry.getValue(), "INTEGER"); + + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + + String expectedQuery = "{\n" + + " find: \"users\",\n" + + " filter: { age: { \"$gte\": 30 } },\n" + + " sort: { id: 1 },\n" + + " limit: 10\n" + + " }"; + // check that bindings are not replaced with actual values and not '$i' or '?' + assertEquals(expectedQuery, + ((RequestParamDTO) (((List) result.getRequest().getRequestParams())).get(0)).getValue()); + }) + .verifyComplete(); + } + + @Test + public void testBsonSmartSubstitution_withEscapedStringValue() { + DatasourceConfiguration datasourceConfiguration = createDatasourceConfiguration(); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + actionConfiguration.setBody("{\n" + + " find: {{Input4.text}},\n" + + " filter: { age: { {{Input1.text}} : 30 } },\n" + + " sort: { id: {{Input2.text}} },\n" + + " limit: {{Input3.text}}\n" + + " }"); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "RAW"); + actionConfiguration.setFormData(configMap); + + ExecuteActionDTO executeActionDTO = new ExecuteActionDTO(); + List<Param> params = new ArrayList<>(); + Param param1 = new Param(); + param1.setKey("Input1.text"); + param1.setValue("$gte"); + params.add(param1); + Param param3 = new Param(); + param3.setKey("Input2.text"); + param3.setValue("1"); + params.add(param3); + Param param4 = new Param(); + param4.setKey("Input3.text"); + param4.setValue("10"); + params.add(param4); + Param param5 = new Param(); + param5.setKey("Input4.text"); + param5.setValue("users"); + params.add(param5); + executeActionDTO.setParams(params); + + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(datasourceConfiguration); + Mono<ActionExecutionResult> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, + executeActionDTO, + datasourceConfiguration, + actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals(2, ((ArrayNode) result.getBody()).size()); + + // 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(), 4); + + Map.Entry<String, String> parameterEntry = parameters.get(0); + assertEquals(parameterEntry.getKey(), "users"); + assertEquals(parameterEntry.getValue(), "STRING"); + + parameterEntry = parameters.get(1); + assertEquals(parameterEntry.getKey(), "$gte"); + assertEquals(parameterEntry.getValue(), "STRING"); + + parameterEntry = parameters.get(2); + assertEquals(parameterEntry.getKey(), "1"); + assertEquals(parameterEntry.getValue(), "INTEGER"); + + parameterEntry = parameters.get(3); + assertEquals(parameterEntry.getKey(), "10"); + assertEquals(parameterEntry.getValue(), "INTEGER"); + + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + + String expectedQuery = "{\n" + + " find: \"users\",\n" + + " filter: { age: { \"$gte\" : 30 } },\n" + + " sort: { id: 1 },\n" + + " limit: 10\n" + + " }"; + // check that bindings are not replaced with actual values and not '$i' or '?' + assertEquals(expectedQuery, + ((RequestParamDTO) (((List) result.getRequest().getRequestParams())).get(0)).getValue()); + }) + .verifyComplete(); + } + + @Test + public void testGetStructureReadPermissionError() { + MongoClient mockConnection = mock(MongoClient.class); + MongoDatabase mockDatabase = mock(MongoDatabase.class); + when(mockConnection.getDatabase(any())).thenReturn(mockDatabase); + + MongoCommandException mockMongoCmdException = mock(MongoCommandException.class); + when(mockDatabase.listCollectionNames()).thenReturn(Mono.error(mockMongoCmdException)); + when(mockMongoCmdException.getErrorCode()).thenReturn(13); + + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<DatasourceStructure> structureMono = pluginExecutor.datasourceCreate(dsConfig) + .flatMap(connection -> pluginExecutor.getStructure(mockConnection, dsConfig)); + + StepVerifier.create(structureMono) + .verifyErrorSatisfies(error -> { + assertTrue(error instanceof AppsmithPluginException); + String expectedMessage = "Appsmith has failed to get database structure. Please provide read permission on" + + " the database to fix this."; + assertTrue(expectedMessage.equals(error.getMessage())); + }); + } + + @Test + public void testFindFormCommand() { + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "FIND"); + setValueSafely(configMap, FIND_QUERY, "{ age: { \"$gte\": 30 } }"); + setValueSafely(configMap, FIND_SORT, "{ id: 1 }"); + setValueSafely(configMap, COLLECTION, "users"); + + actionConfiguration.setFormData(configMap); + + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals(2, ((ArrayNode) result.getBody()).size()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + } + + @Test + public void testInsertFormCommandArrayDocuments() { + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "INSERT"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, INSERT_DOCUMENT, "[{name : \"ZZZ Insert Form Array Test 1\", gender : \"F\", age : 40, tag : \"test\"}," + + "{name : \"ZZZ Insert Form Array Test 2\", gender : \"F\", age : 40, tag : \"test\"}" + + "]"); + + actionConfiguration.setFormData(configMap); + + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + + // Clean up this newly inserted value + configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "DELETE"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, DELETE_QUERY, "{\"tag\" : \"test\"}"); + setValueSafely(configMap, DELETE_LIMIT, "ALL"); + + actionConfiguration.setFormData(configMap); + // Run the delete command + dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)).block(); + } + + @Test + public void testInsertFormCommandSingleDocument() { + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "INSERT"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, INSERT_DOCUMENT, "{\"name\" : \"ZZZ Insert Form Single Test\", \"gender\" : \"F\", \"age\" : 40, \"tag\" : \"test\"}"); + + actionConfiguration.setFormData(configMap); + + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + + // Clean up this newly inserted value + configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "DELETE"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, DELETE_QUERY, "{\"tag\" : \"test\"}"); + setValueSafely(configMap, DELETE_LIMIT, "ALL"); + + actionConfiguration.setFormData(configMap); + + // Run the delete command + dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)).block(); + } + + @Test + public void testUpdateOneFormCommand() { + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "UPDATE"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, UPDATE_QUERY, "{ name: \"Alden Cantrell\" }"); + setValueSafely(configMap, UPDATE_UPDATE, "{ $set: { age: 31 }}}"); + setValueSafely(configMap, UPDATE_LIMIT, "SINGLE"); + + actionConfiguration.setFormData(configMap); + + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + JsonNode value = ((ObjectNode) result.getBody()).get("nModified"); + assertEquals(value.asText(), "1"); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + } + + @Test + public void testUpdateManyFormCommand() { + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "UPDATE"); + setValueSafely(configMap, COLLECTION, "users"); + // Query for all the documents in the collection + setValueSafely(configMap, UPDATE_QUERY, "{}"); + setValueSafely(configMap, UPDATE_UPDATE, "{ $set: { updatedByCommand: true }}}"); + setValueSafely(configMap, UPDATE_LIMIT, "ALL"); + + actionConfiguration.setFormData(configMap); + + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + JsonNode value = ((ObjectNode) result.getBody()).get("nModified"); + assertEquals(value.asText(), "3"); + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + }) + .verifyComplete(); + } + + @Test + public void testDeleteFormCommandSingleDocument() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + // Insert multiple documents which would match the delete criterion + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "INSERT"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, INSERT_DOCUMENT, "[{\"name\" : \"To Delete1\", \"tag\" : \"delete\"}, {\"name\" : \"To Delete2\", \"tag\" : \"delete\"}]"); + + actionConfiguration.setFormData(configMap); + + dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)).block(); + + // Now that the documents have been inserted, lets delete one of them + configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "DELETE"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, DELETE_QUERY, "{tag : \"delete\"}"); + setValueSafely(configMap, DELETE_LIMIT, "SINGLE"); + + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + JsonNode value = ((ObjectNode) result.getBody()).get("n"); + //Assert that only one document out of the two gets deleted + assertEquals(value.asInt(), 1); + }) + .verifyComplete(); + + // Run this delete command again to ensure that both the documents added are deleted post this test. + dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)).block(); + + } + + @Test + public void testDeleteFormCommandMultipleDocument() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + // Insert multiple documents which would match the delete criterion + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "INSERT"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, INSERT_DOCUMENT, "[{\"name\" : \"To Delete1\", \"tag\" : \"delete\"}, {\"name\" : \"To Delete2\", \"tag\" : \"delete\"}]"); + + actionConfiguration.setFormData(configMap); + + dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)).block(); + + // Now that the documents have been inserted, lets delete both of them + configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "DELETE"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, DELETE_QUERY, "{tag : \"delete\"}"); + setValueSafely(configMap, DELETE_LIMIT, "ALL"); + + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + JsonNode value = ((ObjectNode) result.getBody()).get("n"); + assertEquals(value.asInt(), 2); + }) + .verifyComplete(); + } + + @Test + public void testCountCommand() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "COUNT"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, COUNT_QUERY, "{}"); + + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + JsonNode value = ((ObjectNode) result.getBody()).get("n"); + assertEquals(value.asInt(), 3); + }) + .verifyComplete(); + } + + @Test + public void testDistinctCommand() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "DISTINCT"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, DISTINCT_QUERY, "{}"); + setValueSafely(configMap, DISTINCT_KEY, "name"); + + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + int valuesSize = ((ArrayNode) result.getBody()).size(); + assertEquals(valuesSize, 3); + }) + .verifyComplete(); + } + + @Test + public void testAggregateCommand() { + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "AGGREGATE"); + setValueSafely(configMap, COLLECTION, "users"); + setValueSafely(configMap, AGGREGATE_PIPELINE, "[ {$sort :{ _id : 1 }}, { $project: { age : 1}}, {$count: \"userCount\"} ]"); + + actionConfiguration.setFormData(configMap); + + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + JsonNode value = ((ArrayNode) result.getBody()).get(0).get("userCount"); + assertEquals(value.asInt(), 3); + }) + .verifyComplete(); + } + + @Test + public void testFindCommandProjection() { + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.FALSE); + setValueSafely(configMap, COMMAND, "FIND"); + setValueSafely(configMap, FIND_QUERY, "{ age: { \"$gte\": 30 } }"); + setValueSafely(configMap, FIND_SORT, "{ id: 1 }"); + setValueSafely(configMap, FIND_PROJECTION, "{ name: 1 }"); + setValueSafely(configMap, COLLECTION, "users"); + + actionConfiguration.setFormData(configMap); + + DatasourceConfiguration dsConfig = createDatasourceConfiguration(); + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(dsConfig); + Mono<Object> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, new ExecuteActionDTO(), dsConfig, actionConfiguration)); + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = (ActionExecutionResult) obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals(2, ((ArrayNode) result.getBody()).size()); + JsonNode value = ((ArrayNode) result.getBody()).get(0).get("name"); + assertNotNull(value); + }) + .verifyComplete(); + } + + @Test + public void testBsonSmartSubstitutionMongoForm() { + DatasourceConfiguration datasourceConfiguration = createDatasourceConfiguration(); + + ActionConfiguration actionConfiguration = new ActionConfiguration(); + + Map<String, Object> configMap = new HashMap<>(); + setValueSafely(configMap, SMART_SUBSTITUTION, Boolean.TRUE); + setValueSafely(configMap, COMMAND, "FIND"); + setValueSafely(configMap, FIND_QUERY, "\"{{Input1.text}}\""); + setValueSafely(configMap, FIND_SORT, "{ id: {{Input2.text}} }"); + setValueSafely(configMap, FIND_LIMIT, "{{Input3.text}}"); + setValueSafely(configMap, COLLECTION, "{{Input4.text}}"); + + actionConfiguration.setFormData(configMap); + + ExecuteActionDTO executeActionDTO = new ExecuteActionDTO(); + List<Param> params = new ArrayList<>(); + Param param1 = new Param(); + param1.setKey("Input1.text"); + param1.setValue("{ age: { \"$gte\": 30 } }"); + params.add(param1); + Param param3 = new Param(); + param3.setKey("Input2.text"); + param3.setValue("1"); + params.add(param3); + Param param4 = new Param(); + param4.setKey("Input3.text"); + param4.setValue("10"); + params.add(param4); + Param param5 = new Param(); + param5.setKey("Input4.text"); + param5.setValue("users"); + params.add(param5); + executeActionDTO.setParams(params); + + Mono<MongoClient> dsConnectionMono = pluginExecutor.datasourceCreate(datasourceConfiguration); + Mono<ActionExecutionResult> executeMono = dsConnectionMono.flatMap(conn -> pluginExecutor.executeParameterized(conn, + executeActionDTO, + datasourceConfiguration, + actionConfiguration)); + + StepVerifier.create(executeMono) + .assertNext(obj -> { + ActionExecutionResult result = obj; + assertNotNull(result); + assertTrue(result.getIsExecutionSuccess()); + assertNotNull(result.getBody()); + assertEquals(2, ((ArrayNode) result.getBody()).size()); + + assertEquals( + List.of(new ParsedDataType(JSON), new ParsedDataType(RAW)).toString(), + result.getDataTypes().toString() + ); + + String expectedQuery = "{\"find\": \"users\", \"filter\": {\"age\": {\"$gte\": 30}}, \"sort\": {\"id\": 1}, \"limit\": 10, \"batchSize\": 10}"; + assertEquals(expectedQuery, + ((RequestParamDTO)(((List)result.getRequest().getRequestParams())).get(0)).getValue()); + }) + .verifyComplete(); + } + +} diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/java/com/external/plugins/MySqlPlugin.java b/app/server/appsmith-plugins/mysqlPlugin/src/main/java/com/external/plugins/MySqlPlugin.java index 7c7aa2d0de2a..a59d7de719b8 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/java/com/external/plugins/MySqlPlugin.java +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/java/com/external/plugins/MySqlPlugin.java @@ -773,15 +773,15 @@ private void getTemplates(Map<String, DatasourceStructure.Table> tablesByName) { final String tableName = table.getName(); table.getTemplates().addAll(List.of( - new DatasourceStructure.Template("SELECT", "SELECT * FROM " + tableName + " LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM " + tableName + " LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO " + tableName + " (" + String.join(", ", columnNames) + ")\n" - + " VALUES (" + String.join(", ", columnValues) + ");", null), + + " VALUES (" + String.join(", ", columnValues) + ");"), new DatasourceStructure.Template("UPDATE", "UPDATE " + tableName + " SET" + setFragments.toString() + "\n" - + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM " + tableName - + "\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null) + + "\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!") )); } } 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 415d38a431ed..3a2ab63a10bd 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 @@ -639,18 +639,18 @@ public void testStructure() { assertArrayEquals( new DatasourceStructure.Template[]{ - new DatasourceStructure.Template("SELECT", "SELECT * FROM possessions LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM possessions LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO possessions (id, title, user_id, username, email)\n" + - " VALUES (1, '', 1, '', '');", null), + " VALUES (1, '', 1, '', '');"), new DatasourceStructure.Template("UPDATE", "UPDATE possessions SET\n" + " id = 1,\n" + " title = '',\n" + " user_id = 1,\n" + " username = '',\n" + " email = ''\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM possessions\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"), }, possessionsTable.getTemplates().toArray() ); @@ -682,9 +682,9 @@ public void testStructure() { assertArrayEquals( new DatasourceStructure.Template[]{ - new DatasourceStructure.Template("SELECT", "SELECT * FROM users LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM users LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO users (id, username, password, email, spouse_dob, dob, yob, time1, created_on, updated_on)\n" + - " VALUES (1, '', '', '', '2019-07-01', '2019-07-01', '', '', '2019-07-01 10:00:00', '2019-07-01 10:00:00');", null), + " VALUES (1, '', '', '', '2019-07-01', '2019-07-01', '', '', '2019-07-01 10:00:00', '2019-07-01 10:00:00');"), new DatasourceStructure.Template("UPDATE", "UPDATE users SET\n" + " id = 1,\n" + " username = '',\n" + @@ -696,9 +696,9 @@ public void testStructure() { " time1 = '',\n" + " created_on = '2019-07-01 10:00:00',\n" + " updated_on = '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!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM users\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"), }, usersTable.getTemplates().toArray() ); diff --git a/app/server/appsmith-plugins/pom.xml b/app/server/appsmith-plugins/pom.xml index fcc5720eceaa..9eb45384998e 100644 --- a/app/server/appsmith-plugins/pom.xml +++ b/app/server/appsmith-plugins/pom.xml @@ -29,5 +29,6 @@ <module>googleSheetsPlugin</module> <module>snowflakePlugin</module> <module>arangoDBPlugin</module> + <module>mongoPluginUqi</module> </modules> </project> \ No newline at end of file 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 3bb141f83c00..ff122b42d100 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 @@ -758,15 +758,15 @@ public Mono<DatasourceStructure> getStructure(HikariDataSource connection, Datas final String quotedTableName = table.getName().replaceFirst("\\.(\\w+)", ".\"$1\""); table.getTemplates().addAll(List.of( - new DatasourceStructure.Template("SELECT", "SELECT * FROM " + quotedTableName + " LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM " + quotedTableName + " LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO " + quotedTableName + " (" + String.join(", ", columnNames) + ")\n" - + " VALUES (" + String.join(", ", columnValues) + ");", null), + + " VALUES (" + String.join(", ", columnValues) + ");"), new DatasourceStructure.Template("UPDATE", "UPDATE " + quotedTableName + " SET" + setFragments.toString() + "\n" - + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM " + quotedTableName - + "\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null) + + "\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!") )); } diff --git a/app/server/appsmith-plugins/postgresPlugin/src/test/java/com/external/plugins/PostgresPluginTest.java b/app/server/appsmith-plugins/postgresPlugin/src/test/java/com/external/plugins/PostgresPluginTest.java index b83fc1b6a0b1..d0eefc9fd995 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/test/java/com/external/plugins/PostgresPluginTest.java +++ b/app/server/appsmith-plugins/postgresPlugin/src/test/java/com/external/plugins/PostgresPluginTest.java @@ -420,15 +420,15 @@ public void testStructure() { assertArrayEquals( new DatasourceStructure.Template[]{ - new DatasourceStructure.Template("SELECT", "SELECT * FROM public.\"possessions\" LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM public.\"possessions\" LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO public.\"possessions\" (\"title\", \"user_id\")\n" + - " VALUES ('', 1);", null), + " VALUES ('', 1);"), new DatasourceStructure.Template("UPDATE", "UPDATE public.\"possessions\" SET\n" + " \"title\" = '',\n" + " \"user_id\" = 1\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM public.\"possessions\"\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"), }, possessionsTable.getTemplates().toArray() ); @@ -465,9 +465,14 @@ public void testStructure() { assertArrayEquals( new DatasourceStructure.Template[]{ - new DatasourceStructure.Template("SELECT", "SELECT * FROM public.\"users\" LIMIT 10;", null), - new DatasourceStructure.Template("INSERT", "INSERT INTO public.\"users\" (\"username\", \"password\", \"email\", \"spouse_dob\", \"dob\", \"time1\", \"time_tz\", \"created_on\", \"created_on_tz\", \"interval1\", \"numbers\", \"texts\", \"rating\")\n" + - " VALUES ('', '', '', '2019-07-01', '2019-07-01', '18:32:45', '04:05:06 PST', TIMESTAMP '2019-07-01 10:00:00', TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', 1, '{1, 2, 3}', '{\"first\", \"second\"}', 1.0);", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM public.\"users\" LIMIT 10;"), + new DatasourceStructure.Template("INSERT", "INSERT INTO public.\"users\" " + + "(\"username\", \"password\", \"email\", \"spouse_dob\", \"dob\", " + + "\"time1\", \"time_tz\", \"created_on\", \"created_on_tz\", " + + "\"interval1\", \"numbers\", \"texts\", \"rating\")\n " + + "VALUES ('', '', '', '2019-07-01', '2019-07-01', '18:32:45', " + + "'04:05:06 PST', TIMESTAMP '2019-07-01 10:00:00', TIMESTAMP WITH TIME ZONE " + + "'2019-07-01 06:30:00 CET', 1, '{1, 2, 3}', '{\"first\", \"second\"}', 1.0);"), new DatasourceStructure.Template("UPDATE", "UPDATE public.\"users\" SET\n" + " \"username\" = '',\n" + " \"password\" = '',\n" + @@ -482,9 +487,9 @@ public void testStructure() { " \"numbers\" = '{1, 2, 3}',\n" + " \"texts\" = '{\"first\", \"second\"}',\n" + " \"rating\" = 1.0\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM public.\"users\"\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"), }, usersTable.getTemplates().toArray() ); diff --git a/app/server/appsmith-plugins/redshiftPlugin/src/main/java/com/external/plugins/RedshiftPlugin.java b/app/server/appsmith-plugins/redshiftPlugin/src/main/java/com/external/plugins/RedshiftPlugin.java index e3b4a3a698ad..f718cfcb5486 100644 --- a/app/server/appsmith-plugins/redshiftPlugin/src/main/java/com/external/plugins/RedshiftPlugin.java +++ b/app/server/appsmith-plugins/redshiftPlugin/src/main/java/com/external/plugins/RedshiftPlugin.java @@ -609,15 +609,15 @@ private void getTemplates(Map<String, DatasourceStructure.Table> tablesByName) { final String quotedTableName = table.getName().replaceFirst("\\.(\\w+)", ".\"$1\""); table.getTemplates().addAll(List.of( - new DatasourceStructure.Template("SELECT", "SELECT * FROM " + quotedTableName + " LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM " + quotedTableName + " LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO " + quotedTableName + " (" + String.join(", ", columnNames) + ")\n" - + " VALUES (" + String.join(", ", columnValues) + ");", null), + + " VALUES (" + String.join(", ", columnValues) + ");"), new DatasourceStructure.Template("UPDATE", "UPDATE " + quotedTableName + " SET" + setFragments.toString() + "\n" - + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM " + quotedTableName - + "\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null) + + "\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!") )); } } diff --git a/app/server/appsmith-plugins/redshiftPlugin/src/test/java/com/external/plugins/RedshiftPluginTest.java b/app/server/appsmith-plugins/redshiftPlugin/src/test/java/com/external/plugins/RedshiftPluginTest.java index 105332e23731..9a112c4888ad 100644 --- a/app/server/appsmith-plugins/redshiftPlugin/src/test/java/com/external/plugins/RedshiftPluginTest.java +++ b/app/server/appsmith-plugins/redshiftPlugin/src/test/java/com/external/plugins/RedshiftPluginTest.java @@ -415,16 +415,16 @@ public void testStructure() throws SQLException { assertArrayEquals( new DatasourceStructure.Template[]{ - new DatasourceStructure.Template("SELECT", "SELECT * FROM public.\"possessions\" LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM public.\"possessions\" LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO public.\"possessions\" " + - "(\"id\", \"title\", \"user_id\")\n VALUES (1, '', 1);", null), + "(\"id\", \"title\", \"user_id\")\n VALUES (1, '', 1);"), new DatasourceStructure.Template("UPDATE", "UPDATE public.\"possessions\" SET\n" + " \"id\" = 1\n" + " \"title\" = ''\n" + " \"user_id\" = 1\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM public.\"possessions\"\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"), }, possessionsTable.getTemplates().toArray() ); @@ -451,15 +451,15 @@ public void testStructure() throws SQLException { assertArrayEquals( new DatasourceStructure.Template[]{ - new DatasourceStructure.Template("SELECT", "SELECT * FROM public.\"users\" LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM public.\"users\" LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO public.\"users\" (\"username\", \"password\")\n" + - " VALUES ('', '');", null), + " VALUES ('', '');"), new DatasourceStructure.Template("UPDATE", "UPDATE public.\"users\" SET\n" + " \"username\" = ''\n" + " \"password\" = ''\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM public.\"users\"\n" + - " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null), + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"), }, usersTable.getTemplates().toArray() ); diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/utils/SqlUtils.java b/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/utils/SqlUtils.java index 24ac558f1df2..1a13af669018 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/utils/SqlUtils.java +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/utils/SqlUtils.java @@ -152,15 +152,15 @@ public static void getTemplates(Map<String, DatasourceStructure.Table> tablesByN final String tableName = table.getSchema() + "." + table.getName(); table.getTemplates().addAll(List.of( - new DatasourceStructure.Template("SELECT", "SELECT * FROM " + tableName + " LIMIT 10;", null), + new DatasourceStructure.Template("SELECT", "SELECT * FROM " + tableName + " LIMIT 10;"), new DatasourceStructure.Template("INSERT", "INSERT INTO " + tableName + " (" + String.join(", ", columnNames) + ")\n" - + " VALUES (" + String.join(", ", columnValues) + ");", null), + + " VALUES (" + String.join(", ", columnValues) + ");"), new DatasourceStructure.Template("UPDATE", "UPDATE " + tableName + " SET" + setFragments.toString() + "\n" - + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!", null), + + " WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"), new DatasourceStructure.Template("DELETE", "DELETE FROM " + tableName - + "\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!", null) + + "\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!") )); } }
2edfd6c1ecaca4b644bb3179bc8d4e9177951036
2024-07-08 11:26:45
Vemparala Surya Vamsi
chore: remove unevalTree (#34605)
false
remove unevalTree (#34605)
chore
diff --git a/app/client/src/sagas/EvalWorkerActionSagas.ts b/app/client/src/sagas/EvalWorkerActionSagas.ts index 4df4432cbf9a..0fd6f604d4a9 100644 --- a/app/client/src/sagas/EvalWorkerActionSagas.ts +++ b/app/client/src/sagas/EvalWorkerActionSagas.ts @@ -19,7 +19,6 @@ import { import { handleStoreOperations } from "./ActionExecution/StoreActionSaga"; import type { EvalTreeResponseData } from "workers/Evaluation/types"; import isEmpty from "lodash/isEmpty"; -import type { UnEvalTree } from "entities/DataTree/dataTreeTypes"; import { sortJSExecutionDataByCollectionId } from "workers/Evaluation/JSObject/utils"; import type { LintTreeSagaRequestData } from "plugins/Linting/types"; import { evalErrorHandler } from "./EvalErrorHandler"; @@ -27,7 +26,6 @@ import { getUnevaluatedDataTree } from "selectors/dataTreeSelectors"; export interface UpdateDataTreeMessageData { workerResponse: EvalTreeResponseData; - unevalTree: UnEvalTree; } export function* handleEvalWorkerRequestSaga(listenerChannel: Channel<any>) { @@ -141,12 +139,12 @@ export function* handleEvalWorkerMessage(message: TMessage<any>) { break; } case MAIN_THREAD_ACTION.UPDATE_DATATREE: { - const { unevalTree, workerResponse } = data as UpdateDataTreeMessageData; + const { workerResponse } = data as UpdateDataTreeMessageData; const unEvalAndConfigTree: ReturnType<typeof getUnevaluatedDataTree> = yield select(getUnevaluatedDataTree); yield call(updateDataTreeHandler, { evalTreeResponse: workerResponse as EvalTreeResponseData, - unevalTree, + unevalTree: unEvalAndConfigTree.unEvalTree || {}, requiresLogging: false, configTree: unEvalAndConfigTree.configTree, }); diff --git a/app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts b/app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts index cee6048f50e3..b94e8b935735 100644 --- a/app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts +++ b/app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts @@ -190,7 +190,6 @@ describe("evaluateAndGenerateResponse", () => { expect(parsedUpdates).toEqual([]); expect(webworkerResponse).toEqual({ - unevalTree: {}, workerResponse: { dependencies: {}, errors: [], @@ -224,28 +223,6 @@ describe("evaluateAndGenerateResponse", () => { expect(parsedUpdates).toEqual([]); }); - test("should send the new unevalTree in the web worker response", () => { - const updatedLabelUnevalTree = produce(unEvalTree, (draft: any) => { - if (draft.Text1?.text) { - draft.Text1.text = UPDATED_LABEL; - } - }); - expect(evaluator.getOldUnevalTree()).toEqual(unEvalTree); - const updateTreeResponse = evaluator.setupUpdateTree( - updatedLabelUnevalTree, - configTree, - ); - // the new unevalTree gets set in setupUpdateTree - expect(evaluator.getOldUnevalTree()).toEqual(updatedLabelUnevalTree); - - const { unevalTree } = evalTreeWithChanges.evaluateAndGenerateResponse( - evaluator, - updateTreeResponse, - [], - [], - ); - expect(unevalTree).toEqual(updatedLabelUnevalTree); - }); describe("updates", () => { test("should generate updates based on the unEvalUpdates", () => { diff --git a/app/client/src/workers/Evaluation/evalTreeWithChanges.ts b/app/client/src/workers/Evaluation/evalTreeWithChanges.ts index d539eedba006..880f6f7c1633 100644 --- a/app/client/src/workers/Evaluation/evalTreeWithChanges.ts +++ b/app/client/src/workers/Evaluation/evalTreeWithChanges.ts @@ -106,7 +106,6 @@ export const evaluateAndGenerateResponse = ( defaultResponse.evalMetaUpdates = [...(metaUpdates || [])]; return { workerResponse: defaultResponse, - unevalTree: {}, }; } @@ -134,7 +133,6 @@ export const evaluateAndGenerateResponse = ( ); defaultResponse.staleMetaIds = updateResponse.staleMetaIds; - const unevalTree = dataTreeEvaluator.getOldUnevalTree(); // when additional paths are required to be added as updates, we extract the updates from the data tree using these paths. const additionalUpdates = getNewDataTreeUpdates( @@ -159,7 +157,6 @@ export const evaluateAndGenerateResponse = ( return { workerResponse: defaultResponse, - unevalTree, }; };
b89aadecfda711b840c2c81e8aa2092074798cfe
2023-12-01 06:49:30
Shrikant Sharat Kandula
chore: Remove unused methods (#29239)
false
Remove unused methods (#29239)
chore
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepository.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepository.java index fe329b25f984..5c76e516a006 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepository.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepository.java @@ -6,7 +6,6 @@ import java.io.Serializable; import java.util.Collection; -import java.util.List; @NoRepositoryBean public interface BaseRepository<T, ID extends Serializable> extends ReactiveMongoRepository<T, ID> { @@ -43,12 +42,4 @@ public interface BaseRepository<T, ID extends Serializable> extends ReactiveMong * @return */ Mono<Boolean> archiveAllById(Collection<ID> ids); - - Mono<T> findByIdAndBranchName(ID id, String branchName); - - /** - * When `fieldNames` is blank, this method will return the entire object. Otherwise, it will return only the values - * against the `fieldNames` property in the matching object. - */ - Mono<T> findByIdAndFieldNames(ID id, List<String> fieldNames); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepositoryImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepositoryImpl.java index 843cfe75f96f..e09cd442cd85 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepositoryImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseRepositoryImpl.java @@ -20,9 +20,7 @@ import java.io.Serializable; import java.time.Instant; import java.util.Collection; -import java.util.List; -import static org.apache.commons.lang3.StringUtils.isBlank; import static org.springframework.data.mongodb.core.query.Criteria.where; /** @@ -88,12 +86,8 @@ private Criteria getIdCriteria(Object id) { return where(entityInformation.getIdAttribute()).is(id); } - /** - * When `fieldName` is blank, this method will return the entire object. Otherwise, it will return only the value - * against the `fieldName` property in the matching object. - */ @Override - public Mono<T> findByIdAndFieldNames(ID id, List<String> fieldNames) { + public Mono<T> findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return ReactiveSecurityContextHolder.getContext() .map(ctx -> ctx.getAuthentication()) @@ -101,15 +95,6 @@ public Mono<T> findByIdAndFieldNames(ID id, List<String> fieldNames) { .flatMap(principal -> { Query query = new Query(getIdCriteria(id)); query.addCriteria(notDeleted()); - - if (fieldNames != null && fieldNames.size() > 0) { - fieldNames.forEach(fieldName -> { - if (!isBlank(fieldName)) { - query.fields().include(fieldName); - } - }); - } - return mongoOperations .query(entityInformation.getJavaType()) .inCollection(entityInformation.getCollectionName()) @@ -130,17 +115,6 @@ public Mono<T> retrieveById(ID id) { .one(); } - @Override - public Mono<T> findById(ID id) { - return this.findByIdAndFieldNames(id, null); - } - - @Override - public Mono<T> findByIdAndBranchName(ID id, String branchName) { - // branchName will be ignored and this method is overridden for the services which are shared across branches - return this.findById(id); - } - @Override public Flux<T> findAll() { return ReactiveSecurityContextHolder.getContext() diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/LayoutRepository.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/LayoutRepository.java deleted file mode 100644 index 2d21aa35083d..000000000000 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/LayoutRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.appsmith.server.repositories; - -import com.appsmith.server.repositories.ce.LayoutRepositoryCE; -import org.springframework.stereotype.Repository; - -@Repository -public interface LayoutRepository extends LayoutRepositoryCE {} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/LayoutRepositoryCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/LayoutRepositoryCE.java deleted file mode 100644 index 852d7d141441..000000000000 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/LayoutRepositoryCE.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.appsmith.server.repositories.ce; - -import com.appsmith.server.domains.Layout; -import com.appsmith.server.repositories.BaseRepository; - -public interface LayoutRepositoryCE extends BaseRepository<Layout, String> {}
a2f48fa622ff74dca362d5252732e851a5144949
2023-06-02 16:22:34
Tanvi Bhakta
chore: bump appsmith-design-system (#23975)
false
bump appsmith-design-system (#23975)
chore
diff --git a/app/client/package.json b/app/client/package.json index 0fe26aa736a7..266bd6bebd56 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -91,7 +91,7 @@ "cypress-log-to-output": "^1.1.2", "dayjs": "^1.10.6", "deep-diff": "^1.0.2", - "design-system": "npm:@appsmithorg/[email protected]", + "design-system": "npm:@appsmithorg/[email protected]", "design-system-old": "npm:@appsmithorg/[email protected]", "downloadjs": "^1.4.7", "fast-deep-equal": "^3.1.3", diff --git a/app/client/yarn.lock b/app/client/yarn.lock index ca46e1a5dbbd..fe051d3ba3e7 100644 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -9575,7 +9575,7 @@ __metadata: cypress-xpath: ^1.6.0 dayjs: ^1.10.6 deep-diff: ^1.0.2 - design-system: "npm:@appsmithorg/[email protected]" + design-system: "npm:@appsmithorg/[email protected]" design-system-old: "npm:@appsmithorg/[email protected]" diff: ^5.0.0 dotenv: ^8.1.0 @@ -13609,9 +13609,9 @@ __metadata: languageName: node linkType: hard -"design-system@npm:@appsmithorg/[email protected]": - version: 2.1.10-alpha.9 - resolution: "@appsmithorg/design-system@npm:2.1.10-alpha.9" +"design-system@npm:@appsmithorg/[email protected]": + version: 2.1.11 + resolution: "@appsmithorg/design-system@npm:2.1.11" dependencies: "@radix-ui/react-dialog": ^1.0.2 "@radix-ui/react-dropdown-menu": ^2.0.4 @@ -13636,7 +13636,7 @@ __metadata: react-dom: ^17.0.2 react-router-dom: ^5.0.0 styled-components: ^5.3.6 - checksum: b40970fba5c3e61a783db873e0bc549d2b35f05f63a1ade15bd22dd011029a5aeda904047860a367144324d7f310c8c32021762ff6de8ae8bf88465e843f052c + checksum: d2dab007f1a943067928dd019e64dd89648b94246320a3a54d1620d8b696baf74311e256e1176be9e2eef1b13f4f433549a023e8335c326c1438f3361bc76146 languageName: node linkType: hard
921a4830bab0ab9acc88a0472739c22465e05221
2023-12-06 15:54:32
Abhijeet
feat: API to get applications and workspaces for homepage in recently used order (#29004)
false
API to get applications and workspaces for homepage in recently used order (#29004)
feat
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceCE.java index 53382660fda9..30085522735a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceCE.java @@ -29,6 +29,8 @@ public interface ApplicationServiceCE extends CrudService<Application, String> { Flux<Application> findByWorkspaceId(String workspaceId, AclPermission permission); + Flux<Application> findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder(String workspaceId); + Flux<Application> findByClonedFromApplicationId(String applicationId, AclPermission permission); Mono<Application> findByName(String name, AclPermission permission); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceCEImpl.java index 1e25042d9032..25cf52df8b63 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceCEImpl.java @@ -17,9 +17,11 @@ import com.appsmith.server.domains.Page; import com.appsmith.server.domains.QApplication; import com.appsmith.server.domains.Theme; +import com.appsmith.server.domains.UserData; import com.appsmith.server.dtos.ApplicationAccessDTO; import com.appsmith.server.dtos.GitAuthDTO; import com.appsmith.server.dtos.GitDeployKeyDTO; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.exceptions.util.DuplicateKeyExceptionUtils; @@ -35,6 +37,7 @@ import com.appsmith.server.services.ConfigService; import com.appsmith.server.services.PermissionGroupService; import com.appsmith.server.services.SessionUserService; +import com.appsmith.server.services.UserDataService; import com.appsmith.server.solutions.ApplicationPermission; import com.appsmith.server.solutions.DatasourcePermission; import com.appsmith.server.solutions.PolicySolution; @@ -67,6 +70,7 @@ import static com.appsmith.server.acl.AclPermission.MANAGE_APPLICATIONS; import static com.appsmith.server.acl.AclPermission.READ_APPLICATIONS; import static com.appsmith.server.constants.Constraint.MAX_LOGO_SIZE_KB; +import static com.appsmith.server.helpers.ce.DomainSorter.sortDomainsBasedOnOrderedDomainIds; import static org.apache.commons.lang3.StringUtils.isBlank; @Slf4j @@ -84,6 +88,7 @@ public class ApplicationServiceCEImpl extends BaseService<ApplicationRepository, private final DatasourcePermission datasourcePermission; private final ApplicationPermission applicationPermission; private final SessionUserService sessionUserService; + private final UserDataService userDataService; private static final Integer MAX_RETRIES = 5; @Autowired @@ -102,7 +107,8 @@ public ApplicationServiceCEImpl( AssetService assetService, DatasourcePermission datasourcePermission, ApplicationPermission applicationPermission, - SessionUserService sessionUserService) { + SessionUserService sessionUserService, + UserDataService userDataService) { super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository, analyticsService); this.policySolution = policySolution; @@ -114,6 +120,7 @@ public ApplicationServiceCEImpl( this.datasourcePermission = datasourcePermission; this.applicationPermission = applicationPermission; this.sessionUserService = sessionUserService; + this.userDataService = userDataService; } @Override @@ -179,6 +186,57 @@ public Flux<Application> findByWorkspaceId(String workspaceId, AclPermission per return setTransientFields(repository.findByWorkspaceId(workspaceId, permission)); } + /** + * This method is used to fetch all the applications for a given workspaceId. It also sorts the applications based + * on recently used order. + * For git connected applications only default branched application is returned. + * @param workspaceId workspaceId for which applications are to be fetched + * @return Flux of applications + */ + @Override + public Flux<Application> findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder(String workspaceId) { + + if (!StringUtils.hasLength(workspaceId)) { + return Flux.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.WORKSPACE_ID)); + } + + Mono<RecentlyUsedEntityDTO> userDataMono = userDataService + .getForCurrentUser() + .defaultIfEmpty(new UserData()) + .map(userData -> { + if (userData.getRecentlyUsedEntityIds() == null) { + return new RecentlyUsedEntityDTO(); + } + return userData.getRecentlyUsedEntityIds().stream() + .filter(entityDTO -> workspaceId.equals(entityDTO.getWorkspaceId())) + .findFirst() + .orElse(new RecentlyUsedEntityDTO()); + }); + + // Collect all the applications as a map with workspace id as a key + return userDataMono.flatMapMany( + recentlyUsedEntityDTO -> this.findByWorkspaceId(workspaceId, applicationPermission.getReadPermission()) + // sort transformation + .transform(domainFlux -> sortDomainsBasedOnOrderedDomainIds( + domainFlux, recentlyUsedEntityDTO.getApplicationIds())) + .filter(application -> { + /* + * Filter applications based on the following criteria: + * - Applications that are not connected to Git. + * - Applications that, when connected, revert with default branch only. + */ + GitApplicationMetadata metadata = application.getGitApplicationMetadata(); + return metadata == null + // When the ssh key is generated by user and then the connect app fails + || (!StringUtils.hasLength(metadata.getDefaultBranchName()) + && !StringUtils.hasLength(metadata.getBranchName())) + // Default branched application + || (StringUtils.hasLength(metadata.getBranchName()) + && metadata.getBranchName().equals(metadata.getDefaultBranchName())); + }) + .map(responseUtils::updateApplicationWithDefaultResources)); + } + @Override public Flux<Application> findByClonedFromApplicationId(String applicationId, AclPermission permission) { return repository.findByClonedFromApplicationId(applicationId, permission); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceImpl.java index 3225cdeeb3a5..4aef27bce5ff 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/base/ApplicationServiceImpl.java @@ -8,6 +8,7 @@ import com.appsmith.server.services.ConfigService; import com.appsmith.server.services.PermissionGroupService; import com.appsmith.server.services.SessionUserService; +import com.appsmith.server.services.UserDataService; import com.appsmith.server.services.ce_compatible.ApplicationServiceCECompatibleImpl; import com.appsmith.server.solutions.ApplicationPermission; import com.appsmith.server.solutions.DatasourcePermission; @@ -38,7 +39,8 @@ public ApplicationServiceImpl( AssetService assetService, DatasourcePermission datasourcePermission, ApplicationPermission applicationPermission, - SessionUserService sessionUserService) { + SessionUserService sessionUserService, + UserDataService userDataService) { super( scheduler, @@ -55,6 +57,7 @@ public ApplicationServiceImpl( assetService, datasourcePermission, applicationPermission, - sessionUserService); + sessionUserService, + userDataService); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java index 3643b1398009..c4740ee899b4 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java @@ -160,6 +160,7 @@ public Mono<ResponseDTO<List<Application>>> deleteMultipleApps(@Valid @RequestBo .map(deletedResources -> new ResponseDTO<>(HttpStatus.OK.value(), deletedResources, null)); } + @Deprecated @JsonView(Views.Public.class) @GetMapping("/new") public Mono<ResponseDTO<UserHomepageDTO>> getAllApplicationsForHome() { @@ -169,6 +170,16 @@ public Mono<ResponseDTO<UserHomepageDTO>> getAllApplicationsForHome() { .map(applications -> new ResponseDTO<>(HttpStatus.OK.value(), applications, null)); } + @JsonView(Views.Public.class) + @GetMapping("/home") + public Mono<ResponseDTO<List<Application>>> findByWorkspaceIdAndRecentlyUsedOrder( + @RequestParam(required = false) String workspaceId) { + log.debug("Going to get all applications by workspace id {}", workspaceId); + return service.findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder(workspaceId) + .collectList() + .map(applications -> new ResponseDTO<>(HttpStatus.OK.value(), applications, null)); + } + @JsonView(Views.Public.class) @GetMapping(Url.RELEASE_ITEMS) public Mono<ResponseDTO<ReleaseItemsDTO>> getReleaseItemsInformation() { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java index f0089c2fd091..dc15e571e676 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java @@ -82,4 +82,12 @@ public Mono<ResponseDTO<Workspace>> deleteLogo(@PathVariable String workspaceId) return service.deleteLogo(workspaceId) .map(workspace -> new ResponseDTO<>(HttpStatus.OK.value(), workspace, null)); } + + @JsonView(Views.Public.class) + @GetMapping("/home") + public Mono<ResponseDTO<List<Workspace>>> workspacesForHome() { + return userWorkspaceService + .getUserWorkspacesByRecentlyUsedOrder() + .map(workspaces -> new ResponseDTO<>(HttpStatus.OK.value(), workspaces, null)); + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/UserData.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/UserData.java index b9382105d33b..315f17d91afc 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/UserData.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/UserData.java @@ -2,6 +2,7 @@ import com.appsmith.external.models.BaseDomain; import com.appsmith.external.views.Views; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; import com.appsmith.server.helpers.CollectionUtils; import com.fasterxml.jackson.annotation.JsonView; import lombok.Getter; @@ -56,13 +57,19 @@ public class UserData extends BaseDomain { private List<String> recentlyUsedOrgIds; // list of workspace ids that were recently accessed by the user + @Deprecated @JsonView(Views.Public.class) private List<String> recentlyUsedWorkspaceIds; // list of application ids that were recently accessed by the user + @Deprecated @JsonView(Views.Public.class) private List<String> recentlyUsedAppIds; + // Map of workspaceId to list of recently used applicationIds. This field should be used to add entities + @JsonView(Views.Public.class) + private List<RecentlyUsedEntityDTO> recentlyUsedEntityIds; + // Map of defaultApplicationIds with the GitProfiles. For fallback/default git profile per user default will be the // the key for the map @JsonView(Views.Internal.class) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/RecentlyUsedEntityDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/RecentlyUsedEntityDTO.java new file mode 100644 index 000000000000..4f75c4a9a70d --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/RecentlyUsedEntityDTO.java @@ -0,0 +1,11 @@ +package com.appsmith.server.dtos; + +import com.appsmith.server.dtos.ce.RecentlyUsedEntityCE_DTO; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class RecentlyUsedEntityDTO extends RecentlyUsedEntityCE_DTO {} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ce/RecentlyUsedEntityCE_DTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ce/RecentlyUsedEntityCE_DTO.java new file mode 100644 index 000000000000..e6e819815406 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ce/RecentlyUsedEntityCE_DTO.java @@ -0,0 +1,13 @@ +package com.appsmith.server.dtos.ce; + +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class RecentlyUsedEntityCE_DTO { + String workspaceId; + List<String> applicationIds; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/DomainSorter.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/DomainSorter.java new file mode 100644 index 000000000000..6d2700fa8c44 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/DomainSorter.java @@ -0,0 +1,43 @@ +package com.appsmith.server.helpers.ce; + +import com.appsmith.external.models.BaseDomain; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Flux; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class DomainSorter { + + /** + * Sorts a Flux of domains based on the provided list of ordered domain IDs. + * + * @param domainFlux The Flux of domains to be sorted. + * @param sortedDomainIds The list of domain IDs used for sorting. + * @param <Domain> The type of the domains, must extend BaseDomain. + * @return A Flux of sorted domains. + */ + public static <Domain extends BaseDomain> Flux<Domain> sortDomainsBasedOnOrderedDomainIds( + Flux<Domain> domainFlux, List<String> sortedDomainIds) { + if (CollectionUtils.isEmpty(sortedDomainIds)) { + return domainFlux; + } + return domainFlux + .collect(Collectors.toMap(Domain::getId, Function.identity(), (key1, key2) -> key1, LinkedHashMap::new)) + .map(domainMap -> { + List<Domain> sortedDomains = new ArrayList<>(); + for (String id : sortedDomainIds) { + if (domainMap.containsKey(id)) { + sortedDomains.add(domainMap.get(id)); + domainMap.remove(id); + } + } + sortedDomains.addAll(domainMap.values()); + return sortedDomains; + }) + .flatMapMany(Flux::fromIterable); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration036AddRecentlyUsedEntitiesForUserData.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration036AddRecentlyUsedEntitiesForUserData.java new file mode 100644 index 000000000000..52a0ce9122d0 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration036AddRecentlyUsedEntitiesForUserData.java @@ -0,0 +1,60 @@ +package com.appsmith.server.migrations.db.ce; + +import com.appsmith.server.domains.QUserData; +import com.appsmith.server.domains.UserData; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; +import com.appsmith.server.helpers.CollectionUtils; +import io.mongock.api.annotations.ChangeUnit; +import io.mongock.api.annotations.Execution; +import io.mongock.api.annotations.RollbackExecution; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; + +import java.util.ArrayList; +import java.util.List; + +import static com.appsmith.server.repositories.ce.BaseAppsmithRepositoryCEImpl.fieldName; +import static org.springframework.data.mongodb.core.query.Criteria.where; +import static org.springframework.data.mongodb.core.query.Query.query; + +@ChangeUnit(order = "036", id = "add-recently-used-entities-for-user") +public class Migration036AddRecentlyUsedEntitiesForUserData { + + private final MongoTemplate mongoTemplate; + + public Migration036AddRecentlyUsedEntitiesForUserData(MongoTemplate mongoTemplate) { + this.mongoTemplate = mongoTemplate; + } + + @RollbackExecution + public void rollbackExecution() {} + + @Execution + public void addRecentlyUsedEntitiesForUserData() { + + final Query userDataQuery = + query(where(fieldName(QUserData.userData.deleted)).ne(true)); + + // We are not migrating the applicationIds, to avoid long-running migration. Also, as user starts using the + // instance these fields should auto-populate. + userDataQuery.fields().include(fieldName(QUserData.userData.recentlyUsedWorkspaceIds)); + + List<UserData> userDataList = mongoTemplate.find(userDataQuery, UserData.class); + for (UserData userData : userDataList) { + final Update update = new Update(); + if (CollectionUtils.isNullOrEmpty(userData.getRecentlyUsedWorkspaceIds())) { + continue; + } + List<RecentlyUsedEntityDTO> recentlyUsedEntityDTOS = new ArrayList<>(); + for (String workspaceId : userData.getRecentlyUsedWorkspaceIds()) { + RecentlyUsedEntityDTO recentlyUsedEntityDTO = new RecentlyUsedEntityDTO(); + recentlyUsedEntityDTO.setWorkspaceId(workspaceId); + recentlyUsedEntityDTOS.add(recentlyUsedEntityDTO); + } + update.set(fieldName(QUserData.userData.recentlyUsedEntityIds), recentlyUsedEntityDTOS); + mongoTemplate.updateFirst( + query(where(fieldName(QUserData.userData.id)).is(userData.getId())), update, UserData.class); + } + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomUserDataRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomUserDataRepositoryCEImpl.java index 53dd18060271..3e7e5d1d2321 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomUserDataRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomUserDataRepositoryCEImpl.java @@ -2,9 +2,12 @@ import com.appsmith.server.domains.QUserData; import com.appsmith.server.domains.UserData; +import com.appsmith.server.dtos.QRecentlyUsedEntityDTO; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; import com.appsmith.server.repositories.BaseAppsmithRepositoryImpl; import com.appsmith.server.repositories.CacheableRepositoryHelper; import com.google.common.collect.Lists; +import com.mongodb.BasicDBObject; import com.mongodb.client.result.UpdateResult; import org.springframework.data.mongodb.core.ReactiveMongoOperations; import org.springframework.data.mongodb.core.convert.MongoConverter; @@ -47,6 +50,9 @@ public Mono<UpdateResult> removeIdFromRecentlyUsedList( if (!CollectionUtils.isEmpty(applicationIds)) { update = update.pullAll(fieldName(QUserData.userData.recentlyUsedAppIds), applicationIds.toArray()); } + update.pull( + fieldName(QUserData.userData.recentlyUsedEntityIds), + new BasicDBObject(fieldName(QRecentlyUsedEntityDTO.recentlyUsedEntityDTO.workspaceId), workspaceId)); return mongoOperations.updateFirst( query(where(fieldName(QUserData.userData.userId)).is(userId)), update, UserData.class); } @@ -71,11 +77,13 @@ public Flux<UserData> findPhotoAssetsByUserIds(Iterable<String> userId) { public Mono<String> fetchMostRecentlyUsedWorkspaceId(String userId) { final Query query = query(where(fieldName(QUserData.userData.userId)).is(userId)); - query.fields().include(fieldName(QUserData.userData.recentlyUsedWorkspaceIds)); + query.fields().include(fieldName(QUserData.userData.recentlyUsedEntityIds)); return mongoOperations.findOne(query, UserData.class).map(userData -> { - final List<String> recentlyUsedWorkspaceIds = userData.getRecentlyUsedWorkspaceIds(); - return CollectionUtils.isEmpty(recentlyUsedWorkspaceIds) ? "" : recentlyUsedWorkspaceIds.get(0); + final List<RecentlyUsedEntityDTO> recentlyUsedWorkspaceIds = userData.getRecentlyUsedEntityIds(); + return CollectionUtils.isEmpty(recentlyUsedWorkspaceIds) + ? "" + : recentlyUsedWorkspaceIds.get(0).getWorkspaceId(); }); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserWorkspaceServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserWorkspaceServiceImpl.java index dc4b90681013..f691f37d248e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserWorkspaceServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserWorkspaceServiceImpl.java @@ -3,7 +3,6 @@ import com.appsmith.server.notifications.EmailSender; import com.appsmith.server.repositories.UserDataRepository; import com.appsmith.server.repositories.UserRepository; -import com.appsmith.server.repositories.WorkspaceRepository; import com.appsmith.server.services.ce.UserWorkspaceServiceCEImpl; import com.appsmith.server.solutions.PermissionGroupPermission; import com.appsmith.server.solutions.PolicySolution; @@ -17,7 +16,7 @@ public class UserWorkspaceServiceImpl extends UserWorkspaceServiceCEImpl impleme public UserWorkspaceServiceImpl( SessionUserService sessionUserService, - WorkspaceRepository workspaceRepository, + WorkspaceService workspaceService, UserRepository userRepository, UserDataRepository userDataRepository, PolicySolution policySolution, @@ -30,7 +29,7 @@ public UserWorkspaceServiceImpl( super( sessionUserService, - workspaceRepository, + workspaceService, userRepository, userDataRepository, policySolution, diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserDataServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserDataServiceCEImpl.java index 411e4a32e4a8..dd4e773f4923 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserDataServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserDataServiceCEImpl.java @@ -1,10 +1,12 @@ package com.appsmith.server.services.ce; +import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.Application; import com.appsmith.server.domains.Asset; import com.appsmith.server.domains.QUserData; import com.appsmith.server.domains.User; import com.appsmith.server.domains.UserData; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.CollectionUtils; @@ -63,6 +65,10 @@ public class UserDataServiceCEImpl extends BaseService<UserDataRepository, UserD private static final int MAX_PROFILE_PHOTO_SIZE_KB = 1024; + private static final int MAX_RECENT_WORKSPACES_LIMIT = 10; + + private static final int MAX_RECENT_APPLICATIONS_LIMIT = 20; + @Autowired public UserDataServiceCEImpl( Scheduler scheduler, @@ -248,10 +254,10 @@ private Mono<Void> makeProfilePhotoResponse(ServerWebExchange exchange, UserData } /** - * The application.workspaceId is prepended to the list {@link UserData#getRecentlyUsedWorkspaceIds}. - * The application.id is prepended to the list {@link UserData#getRecentlyUsedAppIds()}. + * This function is used to update the recently used application and workspace for the user * - * @param application@return Updated {@link UserData} + * @param application + * @return Updated {@link UserData} */ @Override public Mono<UserData> updateLastUsedAppAndWorkspaceList(Application application) { @@ -261,12 +267,29 @@ public Mono<UserData> updateLastUsedAppAndWorkspaceList(Application application) .flatMap(tuple -> { final User user = tuple.getT1(); final UserData userData = tuple.getT2(); + // TODO remove the updated to deprecated fields once client starts consuming the updated API // set recently used workspace ids userData.setRecentlyUsedWorkspaceIds(addIdToRecentList( - userData.getRecentlyUsedWorkspaceIds(), application.getWorkspaceId(), 10)); + userData.getRecentlyUsedWorkspaceIds(), + application.getWorkspaceId(), + MAX_RECENT_WORKSPACES_LIMIT)); // set recently used application ids - userData.setRecentlyUsedAppIds( - addIdToRecentList(userData.getRecentlyUsedAppIds(), application.getId(), 20)); + userData.setRecentlyUsedAppIds(addIdToRecentList( + userData.getRecentlyUsedAppIds(), application.getId(), MAX_RECENT_APPLICATIONS_LIMIT)); + + // Update recently used workspace and corresponding application ids + List<RecentlyUsedEntityDTO> recentlyUsedEntities = reorderWorkspacesInRecentlyUsedOrderForUser( + userData.getRecentlyUsedEntityIds(), + application.getWorkspaceId(), + MAX_RECENT_WORKSPACES_LIMIT); + + if (!CollectionUtils.isNullOrEmpty(recentlyUsedEntities)) { + RecentlyUsedEntityDTO latest = recentlyUsedEntities.get(0); + // Add the current applicationId to the list + latest.setApplicationIds(addIdToRecentList( + latest.getApplicationIds(), application.getId(), MAX_RECENT_APPLICATIONS_LIMIT)); + } + userData.setRecentlyUsedEntityIds(recentlyUsedEntities); return Mono.zip( analyticsService.identifyUser(user, userData, application.getWorkspaceId()), repository.save(userData)); @@ -274,7 +297,7 @@ public Mono<UserData> updateLastUsedAppAndWorkspaceList(Application application) .map(Tuple2::getT2); } - private List<String> addIdToRecentList(List<String> srcIdList, String newId, int maxSize) { + protected List<String> addIdToRecentList(List<String> srcIdList, String newId, int maxSize) { if (srcIdList == null) { srcIdList = new ArrayList<>(); } @@ -291,6 +314,37 @@ private List<String> addIdToRecentList(List<String> srcIdList, String newId, int return srcIdList; } + protected List<RecentlyUsedEntityDTO> reorderWorkspacesInRecentlyUsedOrderForUser( + List<RecentlyUsedEntityDTO> srcIdList, String workspaceId, int maxSize) { + if (srcIdList == null) { + srcIdList = new ArrayList<>(maxSize); + } + if (!StringUtils.hasLength(workspaceId)) { + throw new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.WORKSPACE_ID); + } + RecentlyUsedEntityDTO existingEntity = null; + for (RecentlyUsedEntityDTO entityDTO : srcIdList) { + if (entityDTO.getWorkspaceId().equals(workspaceId)) { + existingEntity = entityDTO; + break; + } + } + if (existingEntity == null) { + existingEntity = new RecentlyUsedEntityDTO(); + existingEntity.setWorkspaceId(workspaceId); + } else { + // Remove duplicates + srcIdList.remove(existingEntity); + } + CollectionUtils.putAtFirst(srcIdList, existingEntity); + + // keeping the last maxSize ids, there may be a lot of ids which are not used anymore + if (srcIdList.size() > maxSize) { + srcIdList = srcIdList.subList(0, maxSize); + } + return srcIdList; + } + @Override public Mono<Map<String, Boolean>> getFeatureFlagsForCurrentUser() { return featureFlagService.getAllFeatureFlagsForUser(); @@ -304,6 +358,7 @@ public Mono<Map<String, Boolean>> getFeatureFlagsForCurrentUser() { */ @Override public Mono<UpdateResult> removeRecentWorkspaceAndApps(String userId, String workspaceId) { + return applicationRepository .getAllApplicationId(workspaceId) .flatMap(appIdsList -> repository.removeIdFromRecentlyUsedList(userId, workspaceId, appIdsList)); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCE.java index a0c14fcedd8e..ee1082921ee3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCE.java @@ -2,6 +2,7 @@ import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.User; +import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.MemberInfoDTO; import com.appsmith.server.dtos.UpdatePermissionGroupDTO; import reactor.core.publisher.Mono; @@ -22,4 +23,6 @@ Mono<MemberInfoDTO> updatePermissionGroupForMember( Mono<Map<String, List<MemberInfoDTO>>> getWorkspaceMembers(Set<String> workspaceIds); Boolean isLastAdminRoleEntity(PermissionGroup permissionGroup); + + Mono<List<Workspace>> getUserWorkspacesByRecentlyUsedOrder(); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCEImpl.java index 01ec0833292b..178ee11083b6 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCEImpl.java @@ -7,6 +7,7 @@ import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.MemberInfoDTO; import com.appsmith.server.dtos.PermissionGroupInfoDTO; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; import com.appsmith.server.dtos.UpdatePermissionGroupDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; @@ -14,11 +15,11 @@ import com.appsmith.server.notifications.EmailSender; import com.appsmith.server.repositories.UserDataRepository; import com.appsmith.server.repositories.UserRepository; -import com.appsmith.server.repositories.WorkspaceRepository; import com.appsmith.server.services.PermissionGroupService; import com.appsmith.server.services.SessionUserService; import com.appsmith.server.services.TenantService; import com.appsmith.server.services.UserDataService; +import com.appsmith.server.services.WorkspaceService; import com.appsmith.server.solutions.PermissionGroupPermission; import com.appsmith.server.solutions.PolicySolution; import com.appsmith.server.solutions.WorkspacePermission; @@ -43,11 +44,13 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static com.appsmith.server.helpers.ce.DomainSorter.sortDomainsBasedOnOrderedDomainIds; + @Slf4j @Service public class UserWorkspaceServiceCEImpl implements UserWorkspaceServiceCE { private final SessionUserService sessionUserService; - private final WorkspaceRepository workspaceRepository; + private final WorkspaceService workspaceService; private final UserRepository userRepository; private final UserDataRepository userDataRepository; private final PolicySolution policySolution; @@ -61,7 +64,7 @@ public class UserWorkspaceServiceCEImpl implements UserWorkspaceServiceCE { @Autowired public UserWorkspaceServiceCEImpl( SessionUserService sessionUserService, - WorkspaceRepository workspaceRepository, + WorkspaceService workspaceService, UserRepository userRepository, UserDataRepository userDataRepository, PolicySolution policySolution, @@ -72,7 +75,7 @@ public UserWorkspaceServiceCEImpl( WorkspacePermission workspacePermission, PermissionGroupPermission permissionGroupPermission) { this.sessionUserService = sessionUserService; - this.workspaceRepository = workspaceRepository; + this.workspaceService = workspaceService; this.userRepository = userRepository; this.userDataRepository = userDataRepository; this.policySolution = policySolution; @@ -87,7 +90,7 @@ public UserWorkspaceServiceCEImpl( @Override public Mono<User> leaveWorkspace(String workspaceId) { // Read the workspace - Mono<Workspace> workspaceMono = workspaceRepository + Mono<Workspace> workspaceMono = workspaceService .findById(workspaceId, workspacePermission.getReadPermission()) .switchIfEmpty(Mono.error( new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.WORKSPACE, workspaceId))); @@ -150,7 +153,7 @@ public Mono<MemberInfoDTO> updatePermissionGroupForMember( } // Read the workspace - Mono<Workspace> workspaceMono = workspaceRepository + Mono<Workspace> workspaceMono = workspaceService .findById(workspaceId, workspacePermission.getReadPermission()) .switchIfEmpty(Mono.error( new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.WORKSPACE, workspaceId))) @@ -388,7 +391,7 @@ private List<MemberInfoDTO> mapPermissionGroupListToUserAndPermissionGroupDTOLis } protected Flux<PermissionGroup> getPermissionGroupsForWorkspace(String workspaceId) { - Mono<Workspace> workspaceMono = workspaceRepository + Mono<Workspace> workspaceMono = workspaceService .findById(workspaceId, workspacePermission.getReadPermission()) .switchIfEmpty(Mono.error( new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.WORKSPACE, workspaceId))); @@ -403,4 +406,32 @@ public Boolean isLastAdminRoleEntity(PermissionGroup permissionGroup) { return permissionGroup.getName().startsWith(FieldName.ADMINISTRATOR) && permissionGroup.getAssignedToUserIds().size() == 1; } + + /** + * This function returns the list of workspaces for the current user in the order of recently used. + * + * @return Mono of list of workspaces + */ + @Override + public Mono<List<Workspace>> getUserWorkspacesByRecentlyUsedOrder() { + + Mono<List<String>> workspaceIdsMono = userDataService + .getForCurrentUser() + .defaultIfEmpty(new UserData()) + .map(userData -> { + if (userData.getRecentlyUsedEntityIds() == null) { + return Collections.emptyList(); + } + return userData.getRecentlyUsedEntityIds().stream() + .map(RecentlyUsedEntityDTO::getWorkspaceId) + .collect(Collectors.toList()); + }); + + return workspaceIdsMono.flatMap(workspaceIds -> workspaceService + .getAll(workspacePermission.getReadPermission()) + // sort transformation + .transform(domainFlux -> sortDomainsBasedOnOrderedDomainIds(domainFlux, workspaceIds)) + // collect to list to keep the order of the workspaces + .collectList()); + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/ApplicationServiceCECompatibleImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/ApplicationServiceCECompatibleImpl.java index d818a4cc9ef8..4de82ab7fd9e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/ApplicationServiceCECompatibleImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/ApplicationServiceCECompatibleImpl.java @@ -9,6 +9,7 @@ import com.appsmith.server.services.ConfigService; import com.appsmith.server.services.PermissionGroupService; import com.appsmith.server.services.SessionUserService; +import com.appsmith.server.services.UserDataService; import com.appsmith.server.solutions.ApplicationPermission; import com.appsmith.server.solutions.DatasourcePermission; import com.appsmith.server.solutions.PolicySolution; @@ -36,7 +37,8 @@ public ApplicationServiceCECompatibleImpl( AssetService assetService, DatasourcePermission datasourcePermission, ApplicationPermission applicationPermission, - SessionUserService sessionUserService) { + SessionUserService sessionUserService, + UserDataService userDataService) { super( scheduler, validator, @@ -52,6 +54,7 @@ public ApplicationServiceCECompatibleImpl( assetService, datasourcePermission, applicationPermission, - sessionUserService); + sessionUserService, + userDataService); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ApplicationFetcherCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ApplicationFetcherCEImpl.java index 23bcfe57a980..9c2b2a210b13 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ApplicationFetcherCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ApplicationFetcherCEImpl.java @@ -37,13 +37,14 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; +import static com.appsmith.server.helpers.ce.DomainSorter.sortDomainsBasedOnOrderedDomainIds; + @Slf4j @RequiredArgsConstructor public class ApplicationFetcherCEImpl implements ApplicationFetcherCE { @@ -66,32 +67,14 @@ public class ApplicationFetcherCEImpl implements ApplicationFetcherCE { private final ApplicationPermission applicationPermission; private final PagePermission pagePermission; - private <Domain extends BaseDomain> Flux<Domain> sortDomain(Flux<Domain> domainFlux, List<String> sortOrder) { - if (CollectionUtils.isEmpty(sortOrder)) { - return domainFlux; - } - return domainFlux - .collect(Collectors.toMap(Domain::getId, Function.identity(), (key1, key2) -> key1, LinkedHashMap::new)) - .map(domainMap -> { - List<Domain> sortedDomains = new ArrayList<>(); - for (String id : sortOrder) { - if (domainMap.containsKey(id)) { - sortedDomains.add(domainMap.get(id)); - domainMap.remove(id); - } - } - sortedDomains.addAll(domainMap.values()); - return sortedDomains; - }) - .flatMapMany(Flux::fromIterable); - } - + // TODO: Remove this method once the new homepage is ready /** * For the current user, it first fetches all the workspaces user has read permission on. For each workspace, in turn all * the readable applications are fetched. These applications are then returned grouped by Workspaces in a special DTO and returned * * @return List of UserHomepageDTO */ + @Deprecated public Mono<UserHomepageDTO> getAllApplications() { Mono<User> userMono = sessionUserService @@ -122,7 +105,8 @@ public Mono<UserHomepageDTO> getAllApplications() { Flux<Application> applicationFlux = applicationRepository .findAllUserApps(applicationPermission.getReadPermission()) // sort transformation - .transform(domainFlux -> sortDomain(domainFlux, userData.getRecentlyUsedAppIds())) + .transform(domainFlux -> + sortDomainsBasedOnOrderedDomainIds(domainFlux, userData.getRecentlyUsedAppIds())) // Git connected apps will have gitApplicationMetadat .filter(application -> application.getGitApplicationMetadata() == null // 1. When the ssh key is generated by user and then the connect app fails @@ -154,7 +138,8 @@ public Mono<UserHomepageDTO> getAllApplications() { Mono<List<Workspace>> workspaceListMono = workspacesFromRepoFlux // sort transformation - .transform(domainFlux -> sortDomain(domainFlux, userData.getRecentlyUsedWorkspaceIds())) + .transform(domainFlux -> sortDomainsBasedOnOrderedDomainIds( + domainFlux, userData.getRecentlyUsedWorkspaceIds())) // collect to list to keep the order of the workspaces .collectList() .cache(); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/DomainSorterTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/DomainSorterTest.java new file mode 100644 index 000000000000..c8680b448bfe --- /dev/null +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/DomainSorterTest.java @@ -0,0 +1,71 @@ +package com.appsmith.server.helpers.ce; + +import com.appsmith.external.models.BaseDomain; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import static com.appsmith.server.helpers.ce.DomainSorter.sortDomainsBasedOnOrderedDomainIds; +import static org.junit.jupiter.api.Assertions.assertEquals; + +class DomainSorterTest { + + @Test + void sortDomainsBasedOnOrderedDomainIds_withValidDomainIds_revertWithSameOrder() { + TestDomain testDomain1 = new TestDomain(); + testDomain1.setId("1"); + + TestDomain testDomain2 = new TestDomain(); + testDomain2.setId("2"); + + TestDomain testDomain3 = new TestDomain(); + testDomain3.setId("3"); + + Flux<TestDomain> domainFlux = Flux.just(testDomain1, testDomain2, testDomain3); + + // List of ordered domain IDs + List<String> sortedDomainIds = new ArrayList<>(List.of(new String[] {"3", "2", "1"})); + + Flux<TestDomain> resultFlux = sortDomainsBasedOnOrderedDomainIds(domainFlux, sortedDomainIds); + + // Assert + List<TestDomain> resultList = resultFlux.collectList().block(); + + // Ensure the order is as expected + assert resultList != null; + List<String> resultIds = resultList.stream().map(TestDomain::getId).collect(Collectors.toList()); + assertEquals(sortedDomainIds, resultIds); + } + + @Test + void sortDomainsBasedOnOrderedDomainIds_emptyDomainIds_preserveOriginalOrder() { + TestDomain testDomain1 = new TestDomain(); + testDomain1.setId("1"); + + TestDomain testDomain2 = new TestDomain(); + testDomain2.setId("2"); + + TestDomain testDomain3 = new TestDomain(); + testDomain3.setId("3"); + + Flux<TestDomain> domainFlux = Flux.just(testDomain1, testDomain3, testDomain2); + + // List of ordered domain IDs + List<String> sortedDomainIds = new ArrayList<>(); + + Flux<TestDomain> resultFlux = sortDomainsBasedOnOrderedDomainIds(domainFlux, sortedDomainIds); + + // Assert + List<TestDomain> resultList = resultFlux.collectList().block(); + + // Ensure the order is as expected + assert resultList != null; + List<String> resultIds = resultList.stream().map(TestDomain::getId).collect(Collectors.toList()); + assertEquals(List.of("1", "3", "2"), resultIds); + } + + private static class TestDomain extends BaseDomain {} +} diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserDataServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserDataServiceTest.java index f2d08098e137..d28fc941fc26 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserDataServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserDataServiceTest.java @@ -5,6 +5,7 @@ import com.appsmith.server.domains.GitProfile; import com.appsmith.server.domains.User; import com.appsmith.server.domains.UserData; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.repositories.ApplicationRepository; @@ -36,7 +37,7 @@ import reactor.util.function.Tuple2; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; import java.util.Map; import java.util.UUID; @@ -76,6 +77,10 @@ public class UserDataServiceTest { private Mono<User> userMono; + private static final int MAX_RECENT_WORKSPACES_LIMIT = 10; + + private static final int MAX_RECENT_APPLICATIONS_LIMIT = 20; + @BeforeEach public void setup() { userMono = userService.findByEmail("[email protected]"); @@ -239,6 +244,7 @@ public void updateLastUsedAppAndWorkspaceList_WhenListIsEmpty_workspaceIdPrepend .flatMap(userData -> { // set recently used org ids to null userData.setRecentlyUsedWorkspaceIds(null); + userData.setRecentlyUsedEntityIds(null); return userDataRepository.save(userData); }) .then(userDataService.updateLastUsedAppAndWorkspaceList(application)); @@ -249,6 +255,10 @@ public void updateLastUsedAppAndWorkspaceList_WhenListIsEmpty_workspaceIdPrepend assertEquals( sampleWorkspaceId, userData.getRecentlyUsedWorkspaceIds().get(0)); + + assertThat(userData.getRecentlyUsedEntityIds().size()).isEqualTo(1); + assertThat(userData.getRecentlyUsedEntityIds().get(0).getWorkspaceId()) + .isEqualTo(sampleWorkspaceId); }) .verifyComplete(); } @@ -260,7 +270,15 @@ public void updateLastUsedAppAndWorkspaceList_WhenListIsNotEmpty_workspaceIdPrep .getForCurrentUser() .flatMap(userData -> { // Set an initial list of org ids to the current user. - userData.setRecentlyUsedWorkspaceIds(Arrays.asList("123", "456")); + List<String> recentlyUsedWorkspaceIds = List.of("123", "456"); + userData.setRecentlyUsedWorkspaceIds(recentlyUsedWorkspaceIds); + List<RecentlyUsedEntityDTO> recentlyUsedEntityIds = new ArrayList<>(); + recentlyUsedWorkspaceIds.forEach(workspaceId -> { + RecentlyUsedEntityDTO recentlyUsedEntityDTO = new RecentlyUsedEntityDTO(); + recentlyUsedEntityDTO.setWorkspaceId(workspaceId); + recentlyUsedEntityIds.add(recentlyUsedEntityDTO); + }); + userData.setRecentlyUsedEntityIds(recentlyUsedEntityIds); return userDataRepository.save(userData); }) .flatMap(userData -> { @@ -268,6 +286,7 @@ public void updateLastUsedAppAndWorkspaceList_WhenListIsNotEmpty_workspaceIdPrep String sampleWorkspaceId = "sample-org-id"; Application application = new Application(); application.setWorkspaceId(sampleWorkspaceId); + application.setId("sample-app-id"); return userDataService.updateLastUsedAppAndWorkspaceList(application); }); @@ -277,6 +296,15 @@ public void updateLastUsedAppAndWorkspaceList_WhenListIsNotEmpty_workspaceIdPrep assertEquals( "sample-org-id", userData.getRecentlyUsedWorkspaceIds().get(0)); + + assertThat(userData.getRecentlyUsedEntityIds().size()).isEqualTo(3); + assertThat(userData.getRecentlyUsedEntityIds().get(0).getWorkspaceId()) + .isEqualTo("sample-org-id"); + assertThat(userData.getRecentlyUsedEntityIds() + .get(0) + .getApplicationIds() + .get(0)) + .isEqualTo("sample-app-id"); }) .verifyComplete(); } @@ -290,16 +318,24 @@ public void updateLastUsedAppAndOrgList_TooManyRecentIds_ListsAreTruncated() { .getForCurrentUser() .flatMap(userData -> { // Set an initial list of 12 org ids to the current user - userData.setRecentlyUsedWorkspaceIds(new ArrayList<>()); + List<String> workspaceIds = new ArrayList<>(); + List<RecentlyUsedEntityDTO> recentlyUsedEntityIds = new ArrayList<>(); for (int i = 1; i <= 12; i++) { - userData.getRecentlyUsedWorkspaceIds().add("org-" + i); + workspaceIds.add("org-" + i); + RecentlyUsedEntityDTO recentlyUsedEntityDTO = new RecentlyUsedEntityDTO(); + recentlyUsedEntityDTO.setWorkspaceId("org-" + i); + recentlyUsedEntityIds.add(recentlyUsedEntityDTO); } + userData.setRecentlyUsedWorkspaceIds(workspaceIds); + userData.setRecentlyUsedEntityIds(recentlyUsedEntityIds); // Set an initial list of 22 app ids to the current user. - userData.setRecentlyUsedAppIds(new ArrayList<>()); + List<String> applicationIds = new ArrayList<>(); for (int i = 1; i <= 22; i++) { - userData.getRecentlyUsedAppIds().add("app-" + i); + applicationIds.add("app-" + i); } + userData.setRecentlyUsedAppIds(applicationIds); + recentlyUsedEntityIds.get(0).setApplicationIds(applicationIds); return userDataRepository.save(userData); }) .flatMap(userData -> { @@ -308,19 +344,71 @@ public void updateLastUsedAppAndOrgList_TooManyRecentIds_ListsAreTruncated() { application.setId(sampleAppId); application.setWorkspaceId(sampleWorkspaceId); return userDataService.updateLastUsedAppAndWorkspaceList(application); - }); + }) + .cache(); StepVerifier.create(resultMono) .assertNext(userData -> { - // org id list should be truncated to 10 - assertThat(userData.getRecentlyUsedWorkspaceIds().size()).isEqualTo(10); + assertThat(userData.getRecentlyUsedWorkspaceIds().size()).isEqualTo(MAX_RECENT_WORKSPACES_LIMIT); assertThat(userData.getRecentlyUsedWorkspaceIds().get(0)).isEqualTo(sampleWorkspaceId); assertThat(userData.getRecentlyUsedWorkspaceIds().get(9)).isEqualTo("org-9"); - // app id list should be truncated to 20 - assertThat(userData.getRecentlyUsedAppIds().size()).isEqualTo(20); + assertThat(userData.getRecentlyUsedAppIds().size()).isEqualTo(MAX_RECENT_APPLICATIONS_LIMIT); assertThat(userData.getRecentlyUsedAppIds().get(0)).isEqualTo(sampleAppId); assertThat(userData.getRecentlyUsedAppIds().get(19)).isEqualTo("app-19"); + + assertThat(userData.getRecentlyUsedEntityIds().size()).isEqualTo(MAX_RECENT_WORKSPACES_LIMIT); + assertThat(userData.getRecentlyUsedEntityIds().get(0).getWorkspaceId()) + .isEqualTo(sampleWorkspaceId); + assertThat(userData.getRecentlyUsedEntityIds().get(9).getWorkspaceId()) + .isEqualTo("org-9"); + assertThat(userData.getRecentlyUsedEntityIds() + .get(0) + .getApplicationIds() + .get(0)) + .isEqualTo(sampleAppId); + assertThat(userData.getRecentlyUsedEntityIds() + .get(0) + .getApplicationIds() + .size()) + .isEqualTo(1); + // Truncation will be applied only after the specific entry for recently used entities goes through + // the workflow + assertThat(userData.getRecentlyUsedEntityIds().get(1).getWorkspaceId()) + .isEqualTo("org-1"); + assertThat(userData.getRecentlyUsedEntityIds() + .get(1) + .getApplicationIds() + .size()) + .isEqualTo(22); + }) + .verifyComplete(); + + // 1. Test the re-ordering of existing workspaces and apps + // 2. Check if the application list truncation is working correctly for applications that are already present in + // the list + final Mono<UserData> updateRecentlyUsedEntitiesMono = resultMono.flatMap(userData -> { + Application application = new Application(); + application.setId(sampleAppId); + application.setWorkspaceId("org-1"); + return userDataService.updateLastUsedAppAndWorkspaceList(application); + }); + + StepVerifier.create(updateRecentlyUsedEntitiesMono) + .assertNext(userData -> { + // Check whether a new org id is put at first. + assertThat(userData.getRecentlyUsedEntityIds() + .get(0) + .getApplicationIds() + .size()) + .isEqualTo(MAX_RECENT_APPLICATIONS_LIMIT); + assertThat(userData.getRecentlyUsedEntityIds().get(0).getWorkspaceId()) + .isEqualTo("org-1"); + assertThat(userData.getRecentlyUsedEntityIds() + .get(0) + .getApplicationIds() + .get(0)) + .isEqualTo(sampleAppId); }) .verifyComplete(); } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserWorkspaceServiceUnitTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserWorkspaceServiceUnitTest.java index 09533d50b127..7bbdf08c3e8c 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserWorkspaceServiceUnitTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserWorkspaceServiceUnitTest.java @@ -5,10 +5,13 @@ import com.appsmith.server.domains.Application; import com.appsmith.server.domains.PermissionGroup; import com.appsmith.server.domains.User; +import com.appsmith.server.domains.UserData; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.MemberInfoDTO; import com.appsmith.server.dtos.PermissionGroupInfoDTO; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; import com.appsmith.server.exceptions.AppsmithError; +import com.appsmith.server.helpers.CollectionUtils; import com.appsmith.server.repositories.PermissionGroupRepository; import com.appsmith.server.repositories.UserDataRepository; import com.appsmith.server.solutions.ApplicationPermission; @@ -20,12 +23,15 @@ import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringExtension; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -34,6 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.doReturn; @ExtendWith(SpringExtension.class) @SpringBootTest @@ -43,7 +50,7 @@ public class UserWorkspaceServiceUnitTest { @Autowired UserDataRepository userDataRepository; - @Autowired + @SpyBean UserDataService userDataService; @Autowired @@ -71,6 +78,8 @@ public class UserWorkspaceServiceUnitTest { Workspace workspace; + List<String> workspaceIds = new ArrayList<>(); + @BeforeEach public void setUp() { modelMapper = new ModelMapper(); @@ -90,6 +99,22 @@ public void setUp() { workspace = workspaceService.create(testWorkspace).block(); } + private Flux<Workspace> createDummyWorkspaces() { + List<Workspace> workspaceList = new ArrayList<>(4); + for (int i = 1; i <= 4; i++) { + Workspace workspace = new Workspace(); + workspace.setId("org-" + i); + workspace.setName(workspace.getId()); + workspaceList.add(workspace); + } + return Flux.fromIterable(workspaceList) + .flatMap(workspace -> workspaceService.create(workspace)) + .map(workspace -> { + workspaceIds.add(workspace.getId()); + return workspace; + }); + } + @AfterEach public void cleanup() { User currentUser = sessionUserService.getCurrentUser().block(); @@ -102,8 +127,16 @@ public void cleanup() { .flatMap(remainingApplication -> applicationPageService.deleteApplication(remainingApplication.getId())) .collectList() .block(); - Workspace deletedWorkspace = - workspaceService.archiveById(workspace.getId()).block(); + if (workspace != null && workspace.getDeletedAt() == null) { + workspace = workspaceService.archiveById(workspace.getId()).block(); + } + + if (!CollectionUtils.isNullOrEmpty(workspaceIds)) { + Flux.fromIterable(workspaceIds) + .flatMap(workspaceId -> workspaceService.archiveById(workspaceId)) + .map(deletedWorkspace -> workspaceIds.remove(deletedWorkspace.getId())) + .blockLast(); + } } @Test @@ -209,4 +242,54 @@ public void getWorkspaceMembers_WhenUserHasProfilePhotoForMultipleWorkspace_Prof .flatMap(createdSecondWorkspace -> workspaceService.archiveById(createdSecondWorkspace.getId())) .block(); } + + @Test + @WithUserDetails(value = "api_user") + public void getUserWorkspacesByRecentlyUsedOrder_noRecentWorkspaces_allEntriesAreReturned() { + // Mock the user data to return empty recently used workspaces + UserData userData = new UserData(); + doReturn(Mono.just(userData)).when(userDataService).getForCurrentUser(); + cleanup(); + createDummyWorkspaces().blockLast(); + + StepVerifier.create(userWorkspaceService.getUserWorkspacesByRecentlyUsedOrder()) + .assertNext(workspaces -> { + assertThat(workspaces.size()).isEqualTo(4); + workspaces.forEach(workspace -> { + assertThat(workspaceIds.contains(workspace.getId())).isTrue(); + assertThat(workspace.getTenantId()).isNotEmpty(); + }); + }) + .verifyComplete(); + } + + @Test + @WithUserDetails(value = "api_user") + public void getUserWorkspacesByRecentlyUsedOrder_withRecentlyUsedWorkspaces_allEntriesWithSameOrderAreReturned() { + // Mock the user data to return recently used workspaces + UserData userData = new UserData(); + cleanup(); + createDummyWorkspaces().blockLast(); + List<RecentlyUsedEntityDTO> recentlyUsedEntityDTOs = new ArrayList<>(); + workspaceIds.forEach(workspaceId -> { + RecentlyUsedEntityDTO recentlyUsedEntityDTO = new RecentlyUsedEntityDTO(); + recentlyUsedEntityDTO.setWorkspaceId(workspaceId); + recentlyUsedEntityDTOs.add(recentlyUsedEntityDTO); + }); + userData.setRecentlyUsedEntityIds(recentlyUsedEntityDTOs); + doReturn(Mono.just(userData)).when(userDataService).getForCurrentUser(); + + StepVerifier.create(userWorkspaceService.getUserWorkspacesByRecentlyUsedOrder()) + .assertNext(workspaces -> { + assertThat(workspaces.size()).isEqualTo(4); + List<String> fetchedWorkspaceIds = new ArrayList<>(); + workspaces.forEach(workspace -> { + fetchedWorkspaceIds.add(workspace.getId()); + assertThat(workspaceIds.contains(workspace.getId())).isTrue(); + assertThat(workspace.getTenantId()).isNotEmpty(); + }); + assertThat(fetchedWorkspaceIds).isEqualTo(workspaceIds); + }) + .verifyComplete(); + } } 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 b40f39de5afd..5642e04a0e7a 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 @@ -33,6 +33,7 @@ import com.appsmith.server.domains.QNewAction; import com.appsmith.server.domains.Theme; import com.appsmith.server.domains.User; +import com.appsmith.server.domains.UserData; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ApplicationAccessDTO; @@ -40,6 +41,7 @@ import com.appsmith.server.dtos.ApplicationPagesDTO; import com.appsmith.server.dtos.InviteUsersDTO; import com.appsmith.server.dtos.PageDTO; +import com.appsmith.server.dtos.RecentlyUsedEntityDTO; import com.appsmith.server.dtos.UserHomepageDTO; import com.appsmith.server.dtos.WorkspaceApplicationsDTO; import com.appsmith.server.exceptions.AppsmithError; @@ -67,6 +69,7 @@ import com.appsmith.server.services.LayoutCollectionService; import com.appsmith.server.services.PermissionGroupService; 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.solutions.ApplicationFetcher; @@ -93,6 +96,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; @@ -155,6 +159,8 @@ import static java.lang.Boolean.TRUE; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.doReturn; import static org.springframework.data.mongodb.core.query.Criteria.where; import static org.springframework.data.mongodb.core.query.Query.query; @@ -275,6 +281,9 @@ public class ApplicationServiceCETest { @Autowired CacheableRepositoryHelper cacheableRepositoryHelper; + @SpyBean + UserDataService userDataService; + String workspaceId; String defaultEnvironmentId; @@ -4492,4 +4501,117 @@ public void testCreatePage_lastModifiedByShouldGetChanged() { assertThat(applicationPostLastEdit.getPages()).hasSize(2); assertThat(applicationPostLastEdit.getModifiedBy()).isEqualTo(createdUser.getUsername()); } + + @Test + @WithUserDetails(value = "[email protected]") + public void + findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder_noApplicationPresentInWorkspace_emptyListIsReturned() { + // Create an workspace for this user first. + Workspace workspace = new Workspace(); + workspace.setName("usertest's workspace"); + workspace = workspaceService.create(workspace).block(); + + assert workspace != null; + Flux<Application> allApplicationsWithinWorkspace = + applicationService.findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder(workspace.getId()); + + StepVerifier.create(allApplicationsWithinWorkspace.collectList()) + .assertNext(applications -> { + assertThat(applications).isEmpty(); + }) + .verifyComplete(); + + // Clean up + workspaceService.archiveById(workspace.getId()).block(); + } + + @Test + @WithUserDetails(value = "[email protected]") + public void + findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder_applicationPresentInWorkspace_recentlyUsedAppsPresent_orderedListIsReturned() { + // Create an workspace for this user first. + Workspace workspace = new Workspace(); + workspace.setName("usertest's workspace"); + workspace = workspaceService.create(workspace).block(); + + assert workspace != null; + List<String> applicationIds = createDummyApplications(workspace.getId()); + + UserData userData = new UserData(); + RecentlyUsedEntityDTO usedEntityDTO = new RecentlyUsedEntityDTO(); + usedEntityDTO.setWorkspaceId(workspace.getId()); + usedEntityDTO.setApplicationIds(applicationIds); + userData.setRecentlyUsedEntityIds(List.of(usedEntityDTO)); + doReturn(Mono.just(userData)).when(userDataService).getForCurrentUser(); + + Flux<Application> allApplicationsWithinWorkspace = + applicationService.findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder(workspace.getId()); + + StepVerifier.create(allApplicationsWithinWorkspace.collectList()) + .assertNext(applications -> { + assertThat(applications).hasSize(4); + + List<String> orderedAppIds = new ArrayList<>(); + applications.forEach(application -> { + assertThat(applicationIds).contains(application.getId()); + orderedAppIds.add(application.getId()); + }); + assertThat(orderedAppIds).isEqualTo(applicationIds); + }) + .verifyComplete(); + + // Clean up + applicationIds.forEach(applicationId -> + applicationPageService.deleteApplication(applicationId).block()); + workspaceService.archiveById(workspace.getId()).block(); + } + + @Test + @WithUserDetails(value = "[email protected]") + public void + findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder_applicationPresentInWorkspace_recentlyUsedAppsAbsent_allAppsAreReturned() { + // Create an workspace for this user first. + Workspace workspace = new Workspace(); + workspace.setName("usertest's workspace"); + workspace = workspaceService.create(workspace).block(); + + assert workspace != null; + List<String> applicationIds = createDummyApplications(workspace.getId()); + + UserData userData = new UserData(); + doReturn(Mono.just(userData)).when(userDataService).getForCurrentUser(); + + Flux<Application> allApplicationsWithinWorkspace = + applicationService.findByWorkspaceIdAndDefaultApplicationsInRecentlyUsedOrder(workspace.getId()); + + StepVerifier.create(allApplicationsWithinWorkspace.collectList()) + .assertNext(applications -> { + assertThat(applications).hasSize(4); + + List<String> savedApplicationIds = new ArrayList<>(); + applications.forEach(application -> { + assertThat(applicationIds).contains(application.getId()); + savedApplicationIds.add(application.getId()); + }); + assertTrue(savedApplicationIds.containsAll(applicationIds)); + }) + .verifyComplete(); + + // Clean up + applicationIds.forEach(applicationId -> + applicationPageService.deleteApplication(applicationId).block()); + workspaceService.archiveById(workspace.getId()).block(); + } + + private List<String> createDummyApplications(String workspaceId) { + List<String> applicationIds = new ArrayList<>(); + for (int count = 0; count < 4; count++) { + Application application = new Application(); + application.setName("Application " + count); + application.setWorkspaceId(workspaceId); + application = applicationPageService.createApplication(application).block(); + applicationIds.add(application.getId()); + } + return applicationIds; + } }
eaf1fa495cdc85fb93fc8adb029a5a34ca61d0c8
2024-07-01 19:39:14
sneha122
feat: snowflake key auth server (#34548)
false
snowflake key auth server (#34548)
feat
diff --git a/app/client/src/api/DatasourcesApi.ts b/app/client/src/api/DatasourcesApi.ts index db818e7ea7b2..fbbb21fbe181 100644 --- a/app/client/src/api/DatasourcesApi.ts +++ b/app/client/src/api/DatasourcesApi.ts @@ -143,6 +143,9 @@ class DatasourcesApi extends API { toastMessage: undefined, datasourceConfiguration: datasourceConfig.datasourceConfiguration && { ...datasourceConfig.datasourceConfiguration, + authentication: DatasourcesApi.cleanAuthenticationObject( + datasourceConfig.datasourceConfiguration.authentication, + ), connection: datasourceConfig.datasourceConfiguration.connection && { ...datasourceConfig.datasourceConfiguration.connection, ssl: { diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/SnowflakePlugin.java b/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/SnowflakePlugin.java index 951e3cb3c631..c919bcd08631 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/SnowflakePlugin.java +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/SnowflakePlugin.java @@ -1,12 +1,12 @@ package com.external.plugins; -import com.appsmith.external.constants.Authentication; 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.models.ActionConfiguration; import com.appsmith.external.models.ActionExecutionRequest; import com.appsmith.external.models.ActionExecutionResult; +import com.appsmith.external.models.AuthenticationDTO; import com.appsmith.external.models.DBAuth; import com.appsmith.external.models.DatasourceConfiguration; import com.appsmith.external.models.DatasourceStructure; @@ -15,12 +15,15 @@ import com.appsmith.external.plugins.BasePlugin; import com.appsmith.external.plugins.PluginExecutor; import com.external.plugins.exceptions.SnowflakeErrorMessages; +import com.external.utils.SnowflakeKeyUtils; import com.external.utils.SqlUtils; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariPoolMXBean; import com.zaxxer.hikari.pool.HikariPool; import lombok.extern.slf4j.Slf4j; +import net.snowflake.client.jdbc.SnowflakeBasicDataSource; +import org.bouncycastle.pkcs.PKCSException; import org.pf4j.Extension; import org.pf4j.PluginWrapper; import org.springframework.util.StringUtils; @@ -28,19 +31,12 @@ import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Properties; -import java.util.Set; +import java.security.PrivateKey; +import java.sql.*; +import java.util.*; +import static com.appsmith.external.constants.Authentication.DB_AUTH; +import static com.appsmith.external.constants.Authentication.SNOWFLAKE_KEY_PAIR_AUTH; import static com.appsmith.external.constants.PluginConstants.PluginName.SNOWFLAKE_PLUGIN_NAME; import static com.external.utils.ExecutionUtils.getRowsFromQueryResult; import static com.external.utils.SnowflakeDatasourceUtils.getConnectionFromHikariConnectionPool; @@ -159,58 +155,30 @@ public Mono<ActionExecutionResult> execute( @Override public Mono<HikariDataSource> createConnectionClient( DatasourceConfiguration datasourceConfiguration, Properties properties) { - return Mono.fromCallable(() -> { - HikariConfig config = new HikariConfig(); - - config.setDriverClassName(properties.getProperty("driver_name")); - - config.setMinimumIdle( - Integer.parseInt(properties.get("minimumIdle").toString())); - config.setMaximumPoolSize(Integer.parseInt( - properties.get("maximunPoolSize").toString())); - - config.setInitializationFailTimeout(Long.parseLong( - properties.get("initializationFailTimeout").toString())); - config.setConnectionTimeout(Long.parseLong( - properties.get("connectionTimeoutMillis").toString())); - - if (Authentication.SNOWFLAKE_KEY_PAIR_AUTH.equals( - datasourceConfiguration.getAuthentication().getAuthenticationType())) { - KeyPairAuth authentication = (KeyPairAuth) datasourceConfiguration.getAuthentication(); - // Set authentication properties - if (authentication.getUsername() != null) { - config.setUsername(authentication.getUsername()); - } - } else { - // Set authentication properties - DBAuth authentication = (DBAuth) datasourceConfiguration.getAuthentication(); - if (authentication.getUsername() != null) { - config.setUsername(authentication.getUsername()); - } - if (authentication.getPassword() != null) { - config.setPassword(authentication.getPassword()); - } - } - - // Set up the connection URL - StringBuilder urlBuilder = new StringBuilder( - "jdbc:snowflake://" + datasourceConfiguration.getUrl() + ".snowflakecomputing.com?"); - config.setJdbcUrl(urlBuilder.toString()); + return getHikariConfig(datasourceConfiguration, properties) + .flatMap(config -> Mono.fromCallable(() -> { + // Set up the connection URL + String jdbcUrl = getJDBCUrl(datasourceConfiguration); + config.setJdbcUrl(jdbcUrl); - config.setDataSourceProperties(properties); + config.setDataSourceProperties(properties); - // Now create the connection pool from the configuration - HikariDataSource datasource = null; - try { - datasource = new HikariDataSource(config); - } catch (HikariPool.PoolInitializationException e) { - throw new AppsmithPluginException( - AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, e.getMessage()); - } + // Now create the connection pool from the configuration + HikariDataSource datasource = null; + try { + datasource = new HikariDataSource(config); + } catch (HikariPool.PoolInitializationException e) { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, e.getMessage()); + } - return datasource; - }) - .subscribeOn(scheduler); + return datasource; + }) + .subscribeOn(scheduler)) + .onErrorMap( + AppsmithPluginException.class, + error -> new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, error.getMessage())); } @Override @@ -234,17 +202,16 @@ public Properties addPluginSpecificProperties( @Override public Properties addAuthParamsToConnectionConfig( DatasourceConfiguration datasourceConfiguration, Properties properties) { - - if (Authentication.SNOWFLAKE_KEY_PAIR_AUTH.equals( - datasourceConfiguration.getAuthentication().getAuthenticationType())) { - KeyPairAuth authentication = (KeyPairAuth) datasourceConfiguration.getAuthentication(); - properties.setProperty("user", authentication.getUsername()); - } else { - DBAuth authentication = (DBAuth) datasourceConfiguration.getAuthentication(); - properties.setProperty("user", authentication.getUsername()); - properties.setProperty("password", authentication.getPassword()); + // Only for username password auth, we need to set these properties, for others + // like key-pair auth, authentication specific properties need to be set on config itself + AuthenticationDTO authentication = datasourceConfiguration.getAuthentication(); + switch (authentication.getAuthenticationType()) { + case DB_AUTH: + DBAuth dbAuth = (DBAuth) authentication; + properties.setProperty("user", dbAuth.getUsername()); + properties.setProperty("password", dbAuth.getPassword()); + break; } - properties.setProperty( "warehouse", String.valueOf( @@ -317,7 +284,7 @@ public Set<String> validateDatasource(DatasourceConfiguration datasourceConfigur if (datasourceConfiguration.getAuthentication() == null) { invalids.add(SnowflakeErrorMessages.DS_MISSING_AUTHENTICATION_DETAILS_ERROR_MSG); } else { - if (Authentication.SNOWFLAKE_KEY_PAIR_AUTH.equals( + if (SNOWFLAKE_KEY_PAIR_AUTH.equals( datasourceConfiguration.getAuthentication().getAuthenticationType())) { KeyPairAuth authentication = (KeyPairAuth) datasourceConfiguration.getAuthentication(); if (StringUtils.isEmpty(authentication.getUsername())) { @@ -491,5 +458,112 @@ public Mono<DatasourceStructure> getStructure( }) .subscribeOn(scheduler); } + + private Mono<HikariConfig> getHikariConfig( + DatasourceConfiguration datasourceConfiguration, Properties properties) { + HikariConfig commonConfig = getCommonHikariConfig(properties); + Mono<HikariConfig> configMono = Mono.empty(); + + String authenticationType = + datasourceConfiguration.getAuthentication().getAuthenticationType(); + if (authenticationType != null) { + switch (authenticationType) { + case DB_AUTH: + configMono = getBasicAuthConfig(commonConfig, datasourceConfiguration); + break; + case SNOWFLAKE_KEY_PAIR_AUTH: + configMono = getKeyPairAuthConfig(commonConfig, datasourceConfiguration); + break; + default: + break; + } + } + return configMono; + } + + private Mono<HikariConfig> getKeyPairAuthConfig( + HikariConfig config, DatasourceConfiguration datasourceConfiguration) { + KeyPairAuth keyPairAuthConfig = (KeyPairAuth) datasourceConfiguration.getAuthentication(); + byte[] keyBytes = keyPairAuthConfig.getPrivateKey().getDecodedContent(); + String passphrase = keyPairAuthConfig.getPassphrase(); + return getPrivateKeyFromBase64(keyBytes, passphrase) + .flatMap(privateKey -> { + String jdbcUrl = getJDBCUrl(datasourceConfiguration); + + // Prepare datasource object to be passed to hikariConfig + SnowflakeBasicDataSource ds = new SnowflakeBasicDataSource(); + ds.setPrivateKey(privateKey); + ds.setUser(keyPairAuthConfig.getUsername()); + ds.setUrl(jdbcUrl); + ds.setWarehouse(String.valueOf( + datasourceConfiguration.getProperties().get(0).getValue())); + ds.setDatabaseName(String.valueOf( + datasourceConfiguration.getProperties().get(1).getValue())); + ds.setRole(String.valueOf( + datasourceConfiguration.getProperties().get(3).getValue())); + ds.setSchema(String.valueOf( + datasourceConfiguration.getProperties().get(2).getValue())); + config.setDataSource(ds); + + return Mono.just(config); + }) + .onErrorMap( + AppsmithPluginException.class, + error -> new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, error.getMessage())); + } + + private Mono<HikariConfig> getBasicAuthConfig( + HikariConfig config, DatasourceConfiguration datasourceConfiguration) { + return Mono.fromCallable(() -> { + DBAuth authentication = (DBAuth) datasourceConfiguration.getAuthentication(); + if (authentication.getUsername() != null) { + config.setUsername(authentication.getUsername()); + } + if (authentication.getPassword() != null) { + config.setPassword(authentication.getPassword()); + } + return config; + }); + } + + private HikariConfig getCommonHikariConfig(Properties properties) { + HikariConfig config = new HikariConfig(); + config.setDriverClassName(properties.getProperty("driver_name")); + + config.setMinimumIdle(Integer.parseInt(properties.get("minimumIdle").toString())); + config.setMaximumPoolSize( + Integer.parseInt(properties.get("maximunPoolSize").toString())); + + config.setInitializationFailTimeout( + Long.parseLong(properties.get("initializationFailTimeout").toString())); + config.setConnectionTimeout( + Long.parseLong(properties.get("connectionTimeoutMillis").toString())); + return config; + } + + private Mono<PrivateKey> getPrivateKeyFromBase64(byte[] keyBytes, String passphrase) { + try { + return Mono.just(SnowflakeKeyUtils.readEncryptedPrivateKey(keyBytes, passphrase)); + } catch (AppsmithPluginException e) { + return Mono.error(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, + SnowflakeErrorMessages.DS_MISSING_PASSPHRASE_FOR_ENCRYPTED_PRIVATE_KEY)); + } catch (PKCSException e) { + return Mono.error(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, + SnowflakeErrorMessages.DS_INCORRECT_PASSPHRASE_OR_PRIVATE_KEY)); + } catch (Exception e) { + return Mono.error(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, + SnowflakeErrorMessages.UNABLE_TO_CREATE_CONNECTION_ERROR_MSG)); + } + } + + private String getJDBCUrl(DatasourceConfiguration dsConfig) { + StringBuilder urlBuilder = + new StringBuilder("jdbc:snowflake://" + dsConfig.getUrl() + ".snowflakecomputing.com?"); + return urlBuilder.toString(); + } } } diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/exceptions/SnowflakeErrorMessages.java b/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/exceptions/SnowflakeErrorMessages.java index 41fa52fd7630..06740d5d1c52 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/exceptions/SnowflakeErrorMessages.java +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/exceptions/SnowflakeErrorMessages.java @@ -36,4 +36,8 @@ public class SnowflakeErrorMessages extends BasePluginErrorMessages { public static final String DS_MISSING_PASSWORD_ERROR_MSG = "Missing password for authentication."; public static final String DS_MISSING_PRIVATE_KEY_ERROR_MSG = "Missing private key for authentication."; + + public static final String DS_MISSING_PASSPHRASE_FOR_ENCRYPTED_PRIVATE_KEY = + "Passphrase is required as private key is encrypted"; + public static final String DS_INCORRECT_PASSPHRASE_OR_PRIVATE_KEY = "Passphrase or private key is incorrect"; } diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/utils/SnowflakeKeyUtils.java b/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/utils/SnowflakeKeyUtils.java new file mode 100644 index 000000000000..5f625a831b34 --- /dev/null +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/utils/SnowflakeKeyUtils.java @@ -0,0 +1,49 @@ +package com.external.utils; + +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.external.plugins.exceptions.SnowflakeErrorMessages; +import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.openssl.PEMParser; +import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; +import org.bouncycastle.openssl.jcajce.JceOpenSSLPKCS8DecryptorProviderBuilder; +import org.bouncycastle.operator.InputDecryptorProvider; +import org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo; + +import java.io.StringReader; +import java.security.PrivateKey; +import java.security.Security; + +import static org.apache.commons.lang.StringUtils.isEmpty; + +public class SnowflakeKeyUtils { + static { + Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); + } + + public static PrivateKey readEncryptedPrivateKey(byte[] keyBytes, String passphrase) throws Exception { + PrivateKeyInfo privateKeyInfo = null; + String privateKeyPEM = new String(keyBytes); + PEMParser pemParser = new PEMParser(new StringReader(privateKeyPEM)); + Object pemObject = pemParser.readObject(); + if (pemObject instanceof PKCS8EncryptedPrivateKeyInfo) { + // Handle the case where the private key is encrypted. + if (isEmpty(passphrase)) { + throw new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, + SnowflakeErrorMessages.DS_MISSING_PASSPHRASE_FOR_ENCRYPTED_PRIVATE_KEY); + } + PKCS8EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = (PKCS8EncryptedPrivateKeyInfo) pemObject; + InputDecryptorProvider pkcs8Prov = + new JceOpenSSLPKCS8DecryptorProviderBuilder().build(passphrase.toCharArray()); + privateKeyInfo = encryptedPrivateKeyInfo.decryptPrivateKeyInfo(pkcs8Prov); + } else if (pemObject instanceof PrivateKeyInfo) { + // Handle the case where the private key is unencrypted. + privateKeyInfo = (PrivateKeyInfo) pemObject; + } + pemParser.close(); + JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME); + return converter.getPrivateKey(privateKeyInfo); + } +} diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/test/java/com/external/plugins/SnowflakePluginTest.java b/app/server/appsmith-plugins/snowflakePlugin/src/test/java/com/external/plugins/SnowflakePluginTest.java index c0e585d2c965..22e6e00c40d9 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/test/java/com/external/plugins/SnowflakePluginTest.java +++ b/app/server/appsmith-plugins/snowflakePlugin/src/test/java/com/external/plugins/SnowflakePluginTest.java @@ -102,6 +102,7 @@ public void testDatasourceWithInvalidUrl() { DBAuth auth = new DBAuth(); auth.setUsername("test"); auth.setPassword("test"); + auth.setAuthenticationType("dbAuth"); datasourceConfiguration.setAuthentication(auth); List<Property> properties = new ArrayList<>(); properties.add(new Property("warehouse", "warehouse"));
89c79d1221ff3da8938e6556b2ebe71547834a47
2023-05-25 06:44:48
Vijetha-Kaja
test: Cypress - Flaky test fix (#23229)
false
Cypress - Flaky test fix (#23229)
test
diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/PageOnLoad_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/PageOnLoad_spec.ts index d21aa3d99a95..6b966ecf559e 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/PageOnLoad_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/PageOnLoad_spec.ts @@ -1,27 +1,23 @@ const dsl = require("../../../../fixtures/debuggerTableDsl.json"); const explorer = require("../../../../locators/explorerlocators.json"); const testdata = require("../../../../fixtures/testdata.json"); -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - -const debuggerHelper = ObjectsRegistry.DebuggerHelper; +import * as _ from "../../../../support/Objects/ObjectsCore"; describe("Check debugger logs state when there are onPageLoad actions", function () { before(() => { - cy.addDsl(dsl); + _.agHelper.AddDsl(dsl); }); it("1. Check debugger logs state when there are onPageLoad actions", function () { - cy.openPropertyPane("tablewidget"); - cy.testJsontext("tabledata", "{{TestApi.data.users}}"); - cy.NavigateToAPI_Panel(); - cy.CreateAPI("TestApi"); - cy.enterDatasourceAndPath(testdata.baseUrl, testdata.methods); - cy.SaveAndRunAPI(); - cy.get(explorer.addWidget).click(); - cy.reload(); + _.entityExplorer.SelectEntityByName("Table1", "Widgets"); + _.propPane.UpdatePropertyFieldValue("Table data", "{{TestApi.data.users}}"); + _.apiPage.CreateAndFillApi(testdata.baseUrl + testdata.methods, "TestApi"); + _.apiPage.RunAPI(); + _.agHelper.GetNClick(explorer.addWidget); + _.agHelper.RefreshPage(); // Wait for the debugger icon to be visible - cy.get(".t--debugger-count").should("be.visible"); + _.agHelper.AssertElementVisible(".t--debugger-count"); // debuggerHelper.isErrorCount(0); cy.wait("@postExecute"); - debuggerHelper.AssertErrorCount(1); + _.debuggerHelper.AssertErrorCount(1); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js index 4468392e9a10..edea8c00943c 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js @@ -1,8 +1,7 @@ const commonlocators = require("../../../../locators/commonlocators.json"); const templateLocators = require("../../../../locators/TemplatesLocators.json"); import reconnectDatasourceLocators from "../../../../locators/ReconnectLocators.js"; -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; -const { AggregateHelper, HomePage } = ObjectsRegistry; +import * as _ from "../../../../support/Objects/ObjectsCore"; describe("excludeForAirgap", "Fork a template to an workspace", () => { it("1. Fork a template to an workspace", () => { @@ -29,7 +28,7 @@ describe("excludeForAirgap", "Fork a template to an workspace", () => { cy.NavigateToHome(); cy.get(templateLocators.templatesTab).click(); cy.get(templateLocators.templateCard).first().click(); - AggregateHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR"); + _.agHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR"); cy.get(templateLocators.templateViewForkButton).click(); cy.location().should((location) => { expect(location.search).to.eq("?showForkTemplateModal=true"); @@ -37,29 +36,32 @@ describe("excludeForAirgap", "Fork a template to an workspace", () => { }); it("3. Hide template fork button if user does not have a valid workspace to fork", () => { - HomePage.NavigateToHome(); + _.homePage.NavigateToHome(); // Mock user with App Viewer permission cy.intercept("/api/v1/applications/new", { fixture: "Templates/MockAppViewerUser.json", }); - AggregateHelper.RefreshPage(); - HomePage.SwitchToTemplatesTab(); - AggregateHelper.Sleep(2000); - AggregateHelper.CheckForErrorToast( + _.agHelper.RefreshPage(); + _.homePage.SwitchToTemplatesTab(); + _.agHelper.Sleep(2000); + _.agHelper.CheckForErrorToast( "Internal server error while processing request", ); - AggregateHelper.AssertElementExist(templateLocators.templateCard); - AggregateHelper.AssertElementAbsence(templateLocators.templateForkButton); + _.agHelper.AssertElementExist(templateLocators.templateCard); + _.agHelper.AssertElementAbsence(templateLocators.templateForkButton); - AggregateHelper.GetNClick(templateLocators.templateCard); - AggregateHelper.AssertElementExist(templateLocators.templateCard); - AggregateHelper.AssertElementAbsence( - templateLocators.templateViewForkButton, - ); + _.agHelper.GetNClick(templateLocators.templateCard); + _.agHelper.AssertElementExist(templateLocators.templateCard); + _.agHelper.AssertElementAbsence(templateLocators.templateViewForkButton); }); it("4. Check if tooltip is working in 'Reconnect Datasources'", () => { cy.NavigateToHome(); + cy.get("body").then(($ele) => { + if ($ele.find(reconnectDatasourceLocators.Modal).length) { + cy.get(_.dataSources._skiptoApplicationBtn).click(); + } + }); cy.get(templateLocators.templatesTab).click(); cy.wait(1000); cy.xpath( diff --git a/app/client/cypress/e2e/Regression/ServerSide/MySQL_Datatypes/False_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/MySQL_Datatypes/False_Spec.ts index a6c661e633cb..7f97b9d0e194 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/MySQL_Datatypes/False_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/MySQL_Datatypes/False_Spec.ts @@ -59,13 +59,14 @@ describe("MySQL Datatype tests", function () { _.dataSources.RunQuery(); _.entityExplorer.ExpandCollapseEntity("Queries/JS"); - ["falseCases", "createTable"].forEach((type) => { - _.entityExplorer.ActionContextMenuByEntityName( - type, - "Delete", - "Are you sure?", - ); - }); + // ["falseCases", "createTable"].forEach((type) => { + // _.entityExplorer.ActionContextMenuByEntityName( + // type, + // "Delete", + // "Are you sure?", + // ); + // }); + _.entityExplorer.DeleteAllQueriesForDB(dsName); _.deployMode.DeployApp(); _.deployMode.NavigateBacktoEditor(); _.entityExplorer.ExpandCollapseEntity("Queries/JS"); diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index c260d0c7988a..315aa45cc97c 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1 +1 @@ -cypress/e2e/**/**/* +cypress/e2e/**/**/* \ No newline at end of file diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index c1f457f48e28..a0c9033e37ff 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -767,6 +767,7 @@ export class DataSources { .scrollIntoView() .should("be.visible") .closest(this._datasourceCard) + .scrollIntoView() .within(() => { cy.get(this._createQuery).click({ force: true }); });
9574bd75878ebaa476c3705c027970bb20fb2eed
2024-03-14 12:56:03
albinAppsmith
fix: updated add navigation hooks to solve EE issue (#31751)
false
updated add navigation hooks to solve EE issue (#31751)
fix
diff --git a/app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts b/app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts index aea677db80c6..fe816cf00b41 100644 --- a/app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts +++ b/app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts @@ -20,8 +20,8 @@ import { BlankStateContainer } from "pages/Editor/IDE/EditorPane/JS/BlankStateCo import { useCurrentEditorState } from "pages/Editor/IDE/hooks"; import history from "utils/history"; import { FocusEntity, identifyEntityFromPath } from "navigation/FocusEntity"; -import { getJSUrl } from "./utils"; import { useModuleOptions } from "@appsmith/utils/moduleInstanceHelpers"; +import { getJSUrl } from "@appsmith/pages/Editor/IDE/EditorPane/JS/utils"; export const useJSAdd = () => { const pageId = useSelector(getCurrentPageId);
ed35225df794031c35399bb01f26ee5b88927257
2022-04-08 23:13:22
Sumit Kumar
fix: update check for GSheet where condition (#12729)
false
update check for GSheet where condition (#12729)
fix
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Condition.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Condition.java index 80fbfdc11424..2ae0bea19c47 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Condition.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Condition.java @@ -18,6 +18,7 @@ import java.util.stream.Collectors; import static com.appsmith.external.helpers.DataTypeStringUtils.stringToKnownDataTypeConverter; +import static org.apache.commons.lang3.StringUtils.isBlank; @Getter @Setter @@ -25,6 +26,9 @@ @NoArgsConstructor public class Condition { + public static final String PATH_KEY = "path"; + public static final String OPERATOR_KEY = "operator"; + String path; ConditionalOperator operator; @@ -103,7 +107,7 @@ public static List<Condition> generateFromConfiguration(List<Object> configurati if (condition.entrySet().isEmpty()) { // Its an empty object set by the client for UX. Ignore the same continue; - } else if (!condition.keySet().containsAll(Set.of("path", "operator"))) { + } else if (isColumnOrOperatorEmpty(condition)) { throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Filtering Condition not configured properly"); } conditionList.add(new Condition( @@ -115,4 +119,8 @@ public static List<Condition> generateFromConfiguration(List<Object> configurati return conditionList; } + + private static boolean isColumnOrOperatorEmpty(Map<String, String> condition) { + return isBlank(condition.get(PATH_KEY)) || isBlank(condition.get(OPERATOR_KEY)); + } } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/MethodConfig.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/MethodConfig.java index 12b3b9154ad7..1c80636a1750 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/MethodConfig.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/MethodConfig.java @@ -16,12 +16,19 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import static org.apache.commons.lang.StringUtils.isBlank; +import static org.apache.commons.lang3.ObjectUtils.isEmpty; + @Getter @Setter @Builder(toBuilder = true) @AllArgsConstructor @ToString public class MethodConfig { + public static final String PATH_KEY = "path"; + public static final String VALUE_KEY = "value"; + public static final String OPERATOR_KEY = "operator"; + String spreadsheetId; String spreadsheetUrl; String spreadsheetRange; @@ -91,13 +98,15 @@ public MethodConfig(List<Property> propertyList) { this.rowObjects = propertyValue; break; case "where": + /** + * Here, value represents a list of where condition rows. + * e.g. value = [{"path": "Country", "operator": "==", "value": "India"}, {...}, ...] + */ if (value instanceof List) { - // Check if all values in the where condition are null. - boolean allValuesNull = ((List) value).stream() - .allMatch(valueMap -> valueMap == null || - ((Map) valueMap).entrySet().stream().allMatch(e -> ((Map.Entry) e).getValue() == null)); + boolean isAllColumnAndOperatorEmpty = ((List) value).stream() + .allMatch(condition -> isEmpty(condition) || isColumnNameAndOperatorEmpty((Map) condition)); - if (!allValuesNull) { + if (!isAllColumnAndOperatorEmpty) { this.whereConditions = Condition.generateFromConfiguration((List<Object>) value); } } @@ -106,4 +115,8 @@ public MethodConfig(List<Property> propertyList) { } }); } + + private boolean isColumnNameAndOperatorEmpty(Map condition) { + return isBlank((String) condition.get(PATH_KEY)) && isBlank((String) condition.get(OPERATOR_KEY)); + } } \ No newline at end of file diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/test/java/com/external/config/MethodConfigTest.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/test/java/com/external/config/MethodConfigTest.java index b8fa366ce723..ce9e43b5b2dc 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/test/java/com/external/config/MethodConfigTest.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/test/java/com/external/config/MethodConfigTest.java @@ -1,12 +1,19 @@ package com.external.config; +import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.models.Condition; import com.appsmith.external.models.Property; import com.external.config.MethodConfig; import org.junit.Assert; import org.junit.Test; import java.util.*; +import static com.external.config.MethodConfig.OPERATOR_KEY; +import static com.external.config.MethodConfig.PATH_KEY; +import static com.external.config.MethodConfig.VALUE_KEY; +import static org.junit.Assert.assertEquals; + public class MethodConfigTest { @Test @@ -41,24 +48,61 @@ public void testWhiteSpaceRemovalForIntegerParsingErrors() throws Exception { switch (testPropKeys[i]){ case "range": - Assert.assertEquals(methodConfig.getSpreadsheetRange(), e.getKey()); + assertEquals(methodConfig.getSpreadsheetRange(), e.getKey()); break; case "tableHeaderIndex": - Assert.assertEquals(methodConfig.getTableHeaderIndex(), e.getKey()); + assertEquals(methodConfig.getTableHeaderIndex(), e.getKey()); break; case "rowLimit": - Assert.assertEquals(methodConfig.getRowLimit(), e.getKey()); + assertEquals(methodConfig.getRowLimit(), e.getKey()); break; case "rowOffset": - Assert.assertEquals(methodConfig.getRowOffset(), e.getKey()); + assertEquals(methodConfig.getRowOffset(), e.getKey()); break; case "rowIndex": - Assert.assertEquals(methodConfig.getRowIndex(), e.getKey()); + assertEquals(methodConfig.getRowIndex(), e.getKey()); break; } } } } + + @Test + public void testInitialEmptyWhereCondition() { + Map condition = new LinkedHashMap(); + condition.put(PATH_KEY, ""); + condition.put(VALUE_KEY, ""); + + List<Map> listOfConditions = new ArrayList<>(); + listOfConditions.add(condition); + + Property property = new Property("where", listOfConditions); + List<Property> propertyList = new ArrayList(); + propertyList.add(property); + + MethodConfig methodConfig = new MethodConfig(propertyList); + List<Condition> parsedWhereConditions = methodConfig.getWhereConditions(); + assertEquals(0, parsedWhereConditions.size()); + } + + @Test(expected = AppsmithPluginException.class) + public void testNonEmptyOperatorWithEmptyColumnWhereCondition() { + Map condition = new LinkedHashMap(); + condition.put(PATH_KEY, ""); + condition.put(OPERATOR_KEY, "EQ"); + condition.put(VALUE_KEY, ""); + + List<Map> listOfConditions = new ArrayList<>(); + listOfConditions.add(condition); + + Property property = new Property("where", listOfConditions); + List<Property> propertyList = new ArrayList(); + propertyList.add(property); + + MethodConfig methodConfig = new MethodConfig(propertyList); + List<Condition> parsedWhereConditions = methodConfig.getWhereConditions(); + assertEquals(0, parsedWhereConditions.size()); + } }
bdc094bcb645bbb40713b35602da9ba75df5cfc8
2025-02-28 12:06:48
Ashit Rath
chore: Add widget list split to show modules list in tabs (#39443)
false
Add widget list split to show modules list in tabs (#39443)
chore
diff --git a/app/client/src/ce/pages/AppIDE/components/WidgetAdd/UIModulesList.tsx b/app/client/src/ce/pages/AppIDE/components/WidgetAdd/UIModulesList.tsx new file mode 100644 index 000000000000..e8f23ba7110f --- /dev/null +++ b/app/client/src/ce/pages/AppIDE/components/WidgetAdd/UIModulesList.tsx @@ -0,0 +1,10 @@ +export interface UIModulesListProps { + focusSearchInput?: boolean; +} + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +const UIModulesList = (props: UIModulesListProps) => { + return null; +}; + +export default UIModulesList; diff --git a/app/client/src/ce/selectors/modulesSelector.ts b/app/client/src/ce/selectors/modulesSelector.ts index b69f6769a829..a459d9a87aed 100644 --- a/app/client/src/ce/selectors/modulesSelector.ts +++ b/app/client/src/ce/selectors/modulesSelector.ts @@ -9,3 +9,5 @@ export const getAllModules = ( ): Record<string, Module> | any => {}; export const getCurrentModuleId = (state: AppState) => ""; + +export const showUIModulesList = (state: AppState) => false; diff --git a/app/client/src/ee/pages/AppIDE/components/WidgetAdd/UIModulesList.tsx b/app/client/src/ee/pages/AppIDE/components/WidgetAdd/UIModulesList.tsx new file mode 100644 index 000000000000..76e044ce30eb --- /dev/null +++ b/app/client/src/ee/pages/AppIDE/components/WidgetAdd/UIModulesList.tsx @@ -0,0 +1,2 @@ +export * from "ce/pages/AppIDE/components/WidgetAdd/UIModulesList"; +export { default } from "ce/pages/AppIDE/components/WidgetAdd/UIModulesList"; diff --git a/app/client/src/pages/AppIDE/components/WidgetAdd/WidgetsList.tsx b/app/client/src/pages/AppIDE/components/WidgetAdd/WidgetsList.tsx new file mode 100644 index 000000000000..ecf677713cc9 --- /dev/null +++ b/app/client/src/pages/AppIDE/components/WidgetAdd/WidgetsList.tsx @@ -0,0 +1,24 @@ +import React from "react"; + +import { useUIExplorerItems } from "pages/Editor/widgetSidebar/hooks"; +import UIEntitySidebar from "pages/Editor/widgetSidebar/UIEntitySidebar"; + +interface WidgetsListProps { + focusSearchInput?: boolean; +} + +function WidgetsList({ focusSearchInput }: WidgetsListProps) { + const { cards, entityLoading, groupedCards } = useUIExplorerItems(); + + return ( + <UIEntitySidebar + cards={cards} + entityLoading={entityLoading} + focusSearchInput={focusSearchInput} + groupedCards={groupedCards} + isActive + /> + ); +} + +export default WidgetsList; diff --git a/app/client/src/pages/AppIDE/components/WidgetAdd.tsx b/app/client/src/pages/AppIDE/components/WidgetAdd/index.tsx similarity index 56% rename from app/client/src/pages/AppIDE/components/WidgetAdd.tsx rename to app/client/src/pages/AppIDE/components/WidgetAdd/index.tsx index 129147dfb763..e8e2aec9eda6 100644 --- a/app/client/src/pages/AppIDE/components/WidgetAdd.tsx +++ b/app/client/src/pages/AppIDE/components/WidgetAdd/index.tsx @@ -1,21 +1,32 @@ import React, { useCallback } from "react"; -import { Button, Flex, Text } from "@appsmith/ads"; +import { + Button, + Flex, + Tab, + TabPanel, + Tabs, + TabsList, + Text, +} from "@appsmith/ads"; import { useSelector } from "react-redux"; import styled from "styled-components"; import history from "utils/history"; -import UIEntitySidebar from "../../Editor/widgetSidebar/UIEntitySidebar"; import { widgetListURL } from "ee/RouteBuilder"; import { EDITOR_PANE_TEXTS, createMessage } from "ee/constants/messages"; import { getCurrentBasePageId } from "selectors/editorSelectors"; +import UIModulesList from "ee/pages/AppIDE/components/WidgetAdd/UIModulesList"; +import WidgetsList from "./WidgetsList"; +import { showUIModulesList } from "ee/selectors/modulesSelector"; const Container = styled(Flex)` padding-right: var(--ads-v2-spaces-2); background-color: var(--ads-v2-color-gray-50); `; -const AddWidgets = (props: { focusSearchInput?: boolean }) => { +const WidgetsAdd = (props: { focusSearchInput?: boolean }) => { const basePageId = useSelector(getCurrentBasePageId) as string; + const showUIModules = useSelector(showUIModulesList); const closeButtonClickHandler = useCallback(() => { history.push(widgetListURL({ basePageId })); @@ -45,10 +56,26 @@ const AddWidgets = (props: { focusSearchInput?: boolean }) => { /> </Container> <Flex flexDirection="column" gap="spaces-3" overflowX="auto"> - <UIEntitySidebar focusSearchInput={props.focusSearchInput} isActive /> + {showUIModules && ( + <Tabs defaultValue="widgets"> + <TabsList> + <Tab value="widgets">Widgets</Tab> + <Tab value="modules">Modules</Tab> + </TabsList> + <TabPanel className="TabsContent" value="widgets"> + <WidgetsList focusSearchInput={props.focusSearchInput} /> + </TabPanel> + <TabPanel className="TabsContent" value="modules"> + <UIModulesList focusSearchInput={props.focusSearchInput} /> + </TabPanel> + </Tabs> + )} + {!showUIModules && ( + <WidgetsList focusSearchInput={props.focusSearchInput} /> + )} </Flex> </> ); }; -export default AddWidgets; +export default WidgetsAdd; diff --git a/app/client/src/pages/Editor/widgetSidebar/UIEntitySidebar.tsx b/app/client/src/pages/Editor/widgetSidebar/UIEntitySidebar.tsx index e6781d01b450..ee091cc14fda 100644 --- a/app/client/src/pages/Editor/widgetSidebar/UIEntitySidebar.tsx +++ b/app/client/src/pages/Editor/widgetSidebar/UIEntitySidebar.tsx @@ -16,16 +16,22 @@ import { debounce } from "lodash"; import React, { useEffect, useMemo, useRef, useState } from "react"; import { groupWidgetCardsByTags } from "../utils"; import UIEntityTagGroup from "./UIEntityTagGroup"; -import { useUIExplorerItems } from "./hooks"; +import type { WidgetCardProps } from "widgets/BaseWidget"; +interface UIEntitySidebarProps { + focusSearchInput?: boolean; + isActive: boolean; + cards: WidgetCardProps[]; + entityLoading?: Partial<Record<WidgetTags, boolean>>; + groupedCards: WidgetCardsGroupedByTags; +} function UIEntitySidebar({ + cards, + entityLoading, focusSearchInput, + groupedCards, isActive, -}: { - isActive: boolean; - focusSearchInput?: boolean; -}) { - const { cards, entityLoading, groupedCards } = useUIExplorerItems(); +}: UIEntitySidebarProps) { const [filteredCards, setFilteredCards] = useState<WidgetCardsGroupedByTags>(groupedCards); const searchInputRef = useRef<HTMLInputElement | null>(null); @@ -91,7 +97,7 @@ function UIEntitySidebar({ // update widgets list after building blocks have been fetched async useEffect(() => { setFilteredCards(groupedCards); - }, [entityLoading[WIDGET_TAGS.BUILDING_BLOCKS]]); + }, [entityLoading?.[WIDGET_TAGS.BUILDING_BLOCKS]]); useEffect(() => { if (focusSearchInput) searchInputRef.current?.focus(); @@ -132,7 +138,10 @@ function UIEntitySidebar({ )} <div> {Object.entries(filteredCards).map(([tag, cardsForThisTag]) => { - if (!cardsForThisTag?.length && !entityLoading[tag as WidgetTags]) { + if ( + !cardsForThisTag?.length && + !entityLoading?.[tag as WidgetTags] + ) { return null; } @@ -143,7 +152,7 @@ function UIEntitySidebar({ return ( <UIEntityTagGroup cards={cardsForThisTag} - isLoading={!!entityLoading[tag as WidgetTags]} + isLoading={!!entityLoading?.[tag as WidgetTags]} key={tag} tag={tag} /> diff --git a/app/client/src/pages/Editor/widgetSidebar/tests/UIEntitySidebar.test.tsx b/app/client/src/pages/Editor/widgetSidebar/tests/UIEntitySidebar.test.tsx index e6aeebe0b93f..df08d4e92615 100644 --- a/app/client/src/pages/Editor/widgetSidebar/tests/UIEntitySidebar.test.tsx +++ b/app/client/src/pages/Editor/widgetSidebar/tests/UIEntitySidebar.test.tsx @@ -5,11 +5,16 @@ import { } from "ee/constants/messages"; import "@testing-library/jest-dom"; import { fireEvent, waitFor } from "@testing-library/react"; -import { WIDGET_TAGS } from "constants/WidgetConstants"; +import { + WIDGET_TAGS, + type WidgetCardsGroupedByTags, + type WidgetTags, +} from "constants/WidgetConstants"; import UIEntitySidebar from "../UIEntitySidebar"; import { cards, groupedCards } from "./UIEntitySidebar.fixture"; import { render } from "test/testUtils"; import { getIDETestState } from "test/factories/AppIDEFactoryUtils"; +import type { WidgetCardProps } from "widgets/BaseWidget"; jest.mock("utils/hooks/useFeatureFlag", () => ({ useFeatureFlag: jest.fn(), @@ -25,9 +30,18 @@ describe("UIEntitySidebar", () => { isActive: boolean, focusSearchInput: boolean, ) => { + const mockItems = { + cards: cards as unknown as WidgetCardProps[], + groupedCards: groupedCards as unknown as WidgetCardsGroupedByTags, + entityLoading: {} as Partial<Record<WidgetTags, boolean>>, + }; + return render( <UIEntitySidebar + cards={mockItems.cards} + entityLoading={mockItems.entityLoading} focusSearchInput={focusSearchInput} + groupedCards={mockItems.groupedCards} isActive={isActive} />, { @@ -38,7 +52,6 @@ describe("UIEntitySidebar", () => { const mockUIExplorerItems = ( items: unknown = { - //return an object with cards, groupedCards and entityLoading states cards, groupedCards, entityLoading: {}, @@ -76,9 +89,19 @@ describe("UIEntitySidebar", () => { groupedCards: {}, }); - const { getByPlaceholderText, queryByTestId } = renderUIEntitySidebar( - true, - true, + const emptyGroupedCards = {} as WidgetCardsGroupedByTags; + + const { getByPlaceholderText, queryByTestId } = render( + <UIEntitySidebar + cards={[] as WidgetCardProps[]} + entityLoading={{} as Partial<Record<WidgetTags, boolean>>} + focusSearchInput + groupedCards={emptyGroupedCards} + isActive + />, + { + initialState: getIDETestState({}), + }, ); const input = getByPlaceholderText(
70e464056b0cc5a5d2ea209c0707856586c8b82d
2023-09-29 16:34:08
Ayangade Adeoluwa
feat: Rollout Gsheets for all users (#27494)
false
Rollout Gsheets for all users (#27494)
feat
diff --git a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx index 7e5afe81b292..3db88f144f40 100644 --- a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx +++ b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx @@ -84,8 +84,6 @@ import { DSEditorWrapper } from "../DataSourceEditor"; import type { DatasourceFilterState } from "../DataSourceEditor"; import { getQueryParams } from "utils/URLUtils"; import GoogleSheetSchema from "./GoogleSheetSchema"; -import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag"; -import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors"; import AnalyticsUtil from "utils/AnalyticsUtil"; import { getDefaultEnvironmentId } from "@appsmith/selectors/environmentSelectors"; import { DEFAULT_ENV_ID } from "@appsmith/api/ApiUtils"; @@ -127,7 +125,6 @@ interface StateProps extends JSONtoFormProps { scopeValue?: string; requiredFields: Record<string, ControlProps>; configDetails: Record<string, string>; - isEnabledForGSheetSchema: boolean; isPluginAuthFailed: boolean; } interface DatasourceFormFunctions { @@ -480,7 +477,6 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> { gsheetToken, hiddenHeader, isDeleting, - isEnabledForGSheetSchema, isInsideReconnectModal, isPluginAuthFailed, isPluginAuthorized, @@ -521,7 +517,7 @@ class DatasourceSaaSEditor extends JSONtoForm<Props, State> { authErrorMessage == GSHEET_AUTHORIZATION_ERROR; const isGoogleSheetSchemaAvailable = - isGoogleSheetPlugin && isPluginAuthorized && isEnabledForGSheetSchema; + isGoogleSheetPlugin && isPluginAuthorized; return ( <> @@ -693,12 +689,6 @@ const mapStateToProps = (state: AppState, props: any) => { state, ) as Datasource; - // A/B feature flag for gsheet schema. - const isEnabledForGSheetSchema = selectFeatureFlagCheck( - state, - FEATURE_FLAG.ab_gsheet_schema_enabled, - ); - // get scopeValue to be shown in analytical events const scopeValue = getDatasourceScopeValue( state, @@ -806,7 +796,6 @@ const mapStateToProps = (state: AppState, props: any) => { gsheetProjectID, showDebugger, scopeValue, - isEnabledForGSheetSchema, isPluginAuthFailed, }; };
0924b18776f318b233b20c88cc30d69223bc4dbb
2023-08-11 18:55:29
sneha122
fix: property pane table binding issue fixed (#26124)
false
property pane table binding issue fixed (#26124)
fix
diff --git a/app/client/cypress/e2e/Regression/ClientSide/BugTests/ApiBugs_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/BugTests/ApiBugs_Spec.ts index 0610ae2a7571..ad5b271ccf99 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/BugTests/ApiBugs_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/BugTests/ApiBugs_Spec.ts @@ -6,6 +6,8 @@ import { dataSources, debuggerHelper, tedTestConfig, + propPane, + entityExplorer, } from "../../../../support/Objects/ObjectsCore"; import { Widgets } from "../../../../support/Pages/DataSources"; @@ -14,6 +16,7 @@ import { createMessage, } from "../../../../support/Objects/CommonErrorMessages"; import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags"; +import oneClickBindingLocator from "../../../../locators/OneClickBindingLocator"; describe("API Bugs", function () { before(() => { @@ -25,16 +28,34 @@ describe("API Bugs", function () { ); agHelper.RefreshPage(); }); - it("1. Bug 14037: User gets an error even when table widget is added from the API page successfully", function () { + it("1. Bug 14037, 25432: User gets an error even when table widget is added from the API page successfully", function () { + // Case where api returns array response apiPage.CreateAndFillApi( tedTestConfig.dsValues[tedTestConfig.defaultEnviorment].mockApiUrl, "Api1", ); apiPage.RunAPI(); - dataSources.AddSuggestedWidget(Widgets.Table); - debuggerHelper.AssertErrorCount(0); + agHelper.AssertElementExist( + oneClickBindingLocator.dropdownOptionSelector("Api1"), + ); + + // Edit the API so that it returns object response + entityExplorer.SelectEntityByName("Api1", "Queries/JS"); + apiPage.EnterURL( + tedTestConfig.dsValues[tedTestConfig.defaultEnviorment].mockApiObjectUrl, + ); + apiPage.RunAPI(); + dataSources.AddSuggestedWidget(Widgets.Table); + agHelper.Sleep(500); + propPane.ValidatePropertyFieldValue("Table data", "{{Api1.data.users}}"); + entityExplorer.ExpandCollapseEntity("Queries/JS"); + entityExplorer.ActionContextMenuByEntityName({ + entityNameinLeftSidebar: "Api1", + action: "Delete", + entityType: entityItems.Api, + }); }); it("2. Bug 16377, When Api url has dynamic binding expressions, ensure the url and path derived is not corrupting Api execution", function () { diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/SuggestedWidgets_spec.js b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/SuggestedWidgets_spec.js index 992229bb01a4..af63de96bc85 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/SuggestedWidgets_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/SuggestedWidgets_spec.js @@ -12,7 +12,7 @@ describe("Check Suggested Widgets Feature in auto-layout", function () { autoLayout.ConvertToAutoLayoutAndVerify(false); featureFlagIntercept( { - ab_ds_binding_enabled: true, + ab_ds_binding_enabled: false, }, false, ); diff --git a/app/client/cypress/support/Objects/TestConfigs.ts b/app/client/cypress/support/Objects/TestConfigs.ts index e3e693f50d24..0d7e0a694777 100644 --- a/app/client/cypress/support/Objects/TestConfigs.ts +++ b/app/client/cypress/support/Objects/TestConfigs.ts @@ -72,6 +72,8 @@ export class TEDTestConfigs { AirtableTable: "tblsFCQSskVFf7xNd", mockApiUrl: "http://host.docker.internal:5001/v1/mock-api?records=10", + mockApiObjectUrl: + "http://host.docker.internal:5001/v1/mock-api-object?records=10", echoApiUrl: "http://host.docker.internal:5001/v1/mock-api/echo", randomCatfactUrl: "http://host.docker.internal:5001/v1/catfact/random", mockHttpCodeUrl: "http://host.docker.internal:5001/v1/mock-http-codes/", diff --git a/app/client/src/components/editorComponents/ActionRightPane/SuggestedWidgets.tsx b/app/client/src/components/editorComponents/ActionRightPane/SuggestedWidgets.tsx index 039a0d0b5173..340b829d56e1 100644 --- a/app/client/src/components/editorComponents/ActionRightPane/SuggestedWidgets.tsx +++ b/app/client/src/components/editorComponents/ActionRightPane/SuggestedWidgets.tsx @@ -249,6 +249,10 @@ function getWidgetProps( props: { [fieldName]: `{{${actionName}.${suggestedWidget.bindingQuery}}}`, dynamicBindingPathList: [{ key: "tableData" }], + dynamicPropertyPathList: + suggestedWidget.bindingQuery === "data" + ? [] + : [{ key: "tableData" }], }, parentRowSpace: 10, };
28d267bf371ad804fe18dc68c4064de4adbc616b
2023-11-14 17:58:27
Rahul Barwal
fix: scroll issue and improve select component (#28695)
false
scroll issue and improve select component (#28695)
fix
diff --git a/app/client/src/constants/TemplatesConstants.tsx b/app/client/src/constants/TemplatesConstants.tsx index f739825587a0..532b03db2dfc 100644 --- a/app/client/src/constants/TemplatesConstants.tsx +++ b/app/client/src/constants/TemplatesConstants.tsx @@ -28,34 +28,34 @@ export const STARTER_BUILDING_BLOCKS = { DATASOURCE_PROMPT_DELAY: 3000, STARTER_BUILDING_BLOCKS_TEMPLATES: [ { - id: 1, + id: 2, title: createMessage( - STARTER_BUILDING_BLOCKS_LAYOUTS.layouts.recordEdit.name, + STARTER_BUILDING_BLOCKS_LAYOUTS.layouts.recordDetails.name, ), description: createMessage( - STARTER_BUILDING_BLOCKS_LAYOUTS.layouts.recordEdit.description, + STARTER_BUILDING_BLOCKS_LAYOUTS.layouts.recordDetails.description, ), - icon: <RecordEdit />, + icon: <RecordDetails />, screenshot: - "https://s3.us-east-2.amazonaws.com/template.appsmith.com/canvas-starter-page-layout-record-edit.png", + "https://s3.us-east-2.amazonaws.com/template.appsmith.com/canvas-starter-page-layout-record-detail.png", templateId: "6530e343fa63b553e4be0266", templateName: STARTER_BUILDING_BLOCK_TEMPLATE_NAME, - templatePageName: "Record Edit", + templatePageName: "Record Details", }, { - id: 2, + id: 1, title: createMessage( - STARTER_BUILDING_BLOCKS_LAYOUTS.layouts.recordDetails.name, + STARTER_BUILDING_BLOCKS_LAYOUTS.layouts.recordEdit.name, ), description: createMessage( - STARTER_BUILDING_BLOCKS_LAYOUTS.layouts.recordDetails.description, + STARTER_BUILDING_BLOCKS_LAYOUTS.layouts.recordEdit.description, ), - icon: <RecordDetails />, + icon: <RecordEdit />, screenshot: - "https://s3.us-east-2.amazonaws.com/template.appsmith.com/canvas-starter-page-layout-record-detail.png", + "https://s3.us-east-2.amazonaws.com/template.appsmith.com/canvas-starter-page-layout-record-edit.png", templateId: "6530e343fa63b553e4be0266", templateName: STARTER_BUILDING_BLOCK_TEMPLATE_NAME, - templatePageName: "Record Details", + templatePageName: "Record Edit", }, { id: 3, diff --git a/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/components/TemplateInfoForm.tsx b/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/components/TemplateInfoForm.tsx index 386ee4c30357..775fb9a184b9 100644 --- a/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/components/TemplateInfoForm.tsx +++ b/app/client/src/pages/Editor/CommunityTemplates/Modals/PublishCommunityTemplate/components/TemplateInfoForm.tsx @@ -128,6 +128,7 @@ const UseCasesSelect = ({ return ( <Select data-testid="t--community-template-usecases-input" + getPopupContainer={(triggerNode) => triggerNode.parentNode.parentNode} isMultiSelect onChange={setTemplateUseCases} value={templateUseCases}
addb809823374a59d9878072b3ec7e7f64e32e40
2024-03-07 10:56:21
Nilesh Sarupriya
chore: code split to support action execution without permission (#31465)
false
code split to support action execution without permission (#31465)
chore
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 6316cfad15f1..4575a9e7f1b0 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 @@ -151,4 +151,11 @@ public static boolean isPermissionForEntity(AclPermission aclPermission, Class<? } return aclPermission.getEntity().equals(entityClass); } + + public static AclPermission getPermissionOrNull(AclPermission permission, Boolean operateWithoutPermission) { + if (Boolean.TRUE.equals(operateWithoutPermission)) { + return null; + } + return permission; + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java index 9b65020ed82d..6dc5d69ae205 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java @@ -103,7 +103,8 @@ public Mono<ResponseDTO<ActionExecutionResult>> executeAction( partFlux, branchName, environmentId, - serverWebExchange.getRequest().getHeaders()) + serverWebExchange.getRequest().getHeaders(), + Boolean.FALSE) .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ExecuteActionMetaDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ExecuteActionMetaDTO.java new file mode 100644 index 000000000000..3a20cb1710f4 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ExecuteActionMetaDTO.java @@ -0,0 +1,18 @@ +package com.appsmith.server.dtos; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.http.HttpHeaders; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder(toBuilder = true) +public class ExecuteActionMetaDTO { + String environmentId; + String branchName; + HttpHeaders headers; + boolean operateWithoutPermission = false; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCE.java index 78ae7a27305e..74b988eeb2ce 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCE.java @@ -3,6 +3,7 @@ import com.appsmith.external.dtos.ExecuteActionDTO; import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.ActionExecutionResult; +import com.appsmith.server.dtos.ExecuteActionMetaDTO; import org.springframework.http.HttpHeaders; import org.springframework.http.codec.multipart.Part; import reactor.core.publisher.Flux; @@ -12,12 +13,17 @@ public interface ActionExecutionSolutionCE { Mono<ActionExecutionResult> executeAction( - Flux<Part> partFlux, String branchName, String environmentId, HttpHeaders httpHeaders); + Flux<Part> partFlux, + String branchName, + String environmentId, + HttpHeaders httpHeaders, + Boolean operateWithoutPermission); Mono<ActionExecutionResult> executeAction( - ExecuteActionDTO executeActionDTO, String environmentId, HttpHeaders httpHeaders); + ExecuteActionDTO executeActionDTO, ExecuteActionMetaDTO executeActionMetaDTO); - Mono<ActionDTO> getValidActionForExecution(ExecuteActionDTO executeActionDTO); + Mono<ActionDTO> getValidActionForExecution( + ExecuteActionDTO executeActionDTO, ExecuteActionMetaDTO executeActionMetaDTO); <T> T variableSubstitution(T configuration, Map<String, String> replaceParamsMap); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java index 6244ae6d11f0..069b1c13ba61 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java @@ -17,6 +17,7 @@ import com.appsmith.external.models.PluginType; import com.appsmith.external.models.RequestParamDTO; import com.appsmith.external.plugins.PluginExecutor; +import com.appsmith.server.acl.AclPermission; import com.appsmith.server.applications.base.ApplicationService; import com.appsmith.server.constants.Constraint; import com.appsmith.server.constants.FieldName; @@ -28,6 +29,7 @@ import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.Plugin; import com.appsmith.server.domains.User; +import com.appsmith.server.dtos.ExecuteActionMetaDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.DatasourceAnalyticsUtils; @@ -171,6 +173,89 @@ public ActionExecutionSolutionCEImpl( this.patternList.add(Pattern.compile(PARAMETER_MAP)); } + protected AclPermission getPermission(ExecuteActionMetaDTO executeActionMetaDTO, AclPermission aclPermission) { + return aclPermission; + } + + /** + * Fetches the action from the DB, and populates the executeActionMetaDTO with the action + * Also fetches the true environmentId for the action execution + * + * @param executeActionDTO + * @param executeActionMetaDTO + * @return + */ + protected Mono<ActionExecutionResult> populateAndExecuteAction( + ExecuteActionDTO executeActionDTO, ExecuteActionMetaDTO executeActionMetaDTO) { + AclPermission executePermission = getPermission(executeActionMetaDTO, actionPermission.getExecutePermission()); + Mono<NewAction> newActionMono = newActionService + .findByBranchNameAndDefaultActionId( + executeActionMetaDTO.getBranchName(), executeActionDTO.getActionId(), executePermission) + .cache(); + + Mono<ExecuteActionDTO> populatedExecuteActionDTOMono = + newActionMono.flatMap(newAction -> populateExecuteActionDTO(executeActionDTO, newAction)); + Mono<String> environmentIdMono = Mono.zip(newActionMono, populatedExecuteActionDTOMono) + .flatMap(tuple -> { + NewAction newAction = tuple.getT1(); + ExecuteActionDTO populatedExecuteActionDTO = tuple.getT2(); + return getTrueEnvironmentId(newAction, populatedExecuteActionDTO, executeActionMetaDTO); + }); + + return Mono.zip(populatedExecuteActionDTOMono, environmentIdMono).flatMap(pair -> { + ExecuteActionDTO populatedExecuteActionDTO = pair.getT1(); + String environmentId = pair.getT2(); + executeActionMetaDTO.setEnvironmentId(environmentId); + return executeAction(populatedExecuteActionDTO, executeActionMetaDTO); + }); + } + + /** + * Fetches the true environmentId for the action execution based on the action, the provided environmentId and the + * pluginId. It also takes into account, whether the datasource related to action is embedded or not. + * @param newAction + * @param executeActionDTO + * @param executeActionMetaDTO + * @return + */ + private Mono<String> getTrueEnvironmentId( + NewAction newAction, ExecuteActionDTO executeActionDTO, ExecuteActionMetaDTO executeActionMetaDTO) { + boolean isEmbedded = executeActionDTO.getViewMode() + ? newAction.getPublishedAction().getDatasource().getId() == null + : newAction.getUnpublishedAction().getDatasource().getId() == null; + + AclPermission executePermission = + getPermission(executeActionMetaDTO, environmentPermission.getExecutePermission()); + + return datasourceService.getTrueEnvironmentId( + newAction.getWorkspaceId(), + executeActionMetaDTO.getEnvironmentId(), + newAction.getPluginId(), + executePermission, + isEmbedded); + } + + /** + * Populates the executeActionDTO with the required fields + * @param executeActionDTO + * @param newAction + * @return + */ + private Mono<ExecuteActionDTO> populateExecuteActionDTO(ExecuteActionDTO executeActionDTO, NewAction newAction) { + Mono<String> instanceIdMono = configService.getInstanceId(); + Mono<String> defaultTenantIdMono = tenantService.getDefaultTenantId(); + + return Mono.zip(instanceIdMono, defaultTenantIdMono).map(tuple -> { + String instanceId = tuple.getT1(); + String tenantId = tuple.getT2(); + executeActionDTO.setActionId(newAction.getId()); + executeActionDTO.setWorkspaceId(newAction.getWorkspaceId()); + executeActionDTO.setInstanceId(instanceId); + executeActionDTO.setTenantId(tenantId); + return executeActionDTO; + }); + } + /** * Executes the action(queries) by creating executeActionDTO and sending it to the plugin for further execution * @@ -181,46 +266,20 @@ public ActionExecutionSolutionCEImpl( */ @Override public Mono<ActionExecutionResult> executeAction( - Flux<Part> partFlux, String branchName, String environmentId, HttpHeaders httpHeaders) { - return createExecuteActionDTO(partFlux) - .flatMap(executeActionDTO -> newActionService - .findByBranchNameAndDefaultActionId( - branchName, executeActionDTO.getActionId(), actionPermission.getExecutePermission()) - .zipWith(configService.getInstanceId().zipWith(tenantService.getDefaultTenantId())) - .flatMap(tuple -> { - NewAction branchedAction = tuple.getT1(); - String instanceId = tuple.getT2().getT1(); - String tenantId = tuple.getT2().getT2(); - executeActionDTO.setActionId(branchedAction.getId()); - executeActionDTO.setWorkspaceId(branchedAction.getWorkspaceId()); - executeActionDTO.setInstanceId(instanceId); - executeActionDTO.setTenantId(tenantId); - - boolean isEmbedded; - if (executeActionDTO.getViewMode()) { - isEmbedded = branchedAction - .getPublishedAction() - .getDatasource() - .getId() - == null; - } else { - isEmbedded = branchedAction - .getUnpublishedAction() - .getDatasource() - .getId() - == null; - } - - return Mono.just(executeActionDTO) - .zipWith(datasourceService.getTrueEnvironmentId( - branchedAction.getWorkspaceId(), - environmentId, - branchedAction.getPluginId(), - environmentPermission.getExecutePermission(), - isEmbedded)); - })) - .flatMap(tuple2 -> - this.executeAction(tuple2.getT1(), tuple2.getT2(), httpHeaders)) // getTrue is temporary call + Flux<Part> partFlux, + String branchName, + String environmentId, + HttpHeaders httpHeaders, + Boolean operateWithoutPermission) { + ExecuteActionMetaDTO executeActionMetaDTO = ExecuteActionMetaDTO.builder() + .headers(httpHeaders) + .operateWithoutPermission(operateWithoutPermission) + .branchName(branchName) + .environmentId(environmentId) + .build(); + Mono<ExecuteActionDTO> executeActionDTOMono = createExecuteActionDTO(partFlux); + return executeActionDTOMono + .flatMap(executeActionDTO -> populateAndExecuteAction(executeActionDTO, executeActionMetaDTO)) .name(ACTION_EXECUTION_SERVER_EXECUTION) .tap(Micrometer.observation(observationRegistry)); } @@ -229,12 +288,12 @@ public Mono<ActionExecutionResult> executeAction( * Fetches the required Mono (action, datasource, and plugin) and makes actionExecution call to plugin * * @param executeActionDTO - * @param environmentId + * @param executeActionMetaDTO * @return actionExecutionResult if query succeeds, error messages otherwise */ + @Override public Mono<ActionExecutionResult> executeAction( - ExecuteActionDTO executeActionDTO, String environmentId, HttpHeaders httpHeaders) { - + ExecuteActionDTO executeActionDTO, ExecuteActionMetaDTO executeActionMetaDTO) { // 1. Validate input parameters which are required for mustache replacements replaceNullWithQuotesForParamValues(executeActionDTO.getParams()); @@ -243,17 +302,22 @@ public Mono<ActionExecutionResult> executeAction( actionName.set(""); // 2. Fetch the action from the DB and check if it can be executed - Mono<ActionDTO> actionDTOMono = - getValidActionForExecution(executeActionDTO).cache(); + Mono<ActionDTO> actionDTOMono = getValidActionForExecution(executeActionDTO, executeActionMetaDTO) + .cache(); // 3. Instantiate the implementation class based on the query type - Mono<DatasourceStorage> datasourceStorageMono = getCachedDatasourceStorage(actionDTOMono, environmentId); + Mono<DatasourceStorage> datasourceStorageMono = getCachedDatasourceStorage(actionDTOMono, executeActionMetaDTO); Mono<Plugin> pluginMono = getCachedPluginForActionExecution(datasourceStorageMono); Mono<PluginExecutor> pluginExecutorMono = pluginExecutorHelper.getPluginExecutor(pluginMono); // 4. Execute the query Mono<ActionExecutionResult> actionExecutionResultMono = getActionExecutionResult( - executeActionDTO, actionDTOMono, datasourceStorageMono, pluginMono, pluginExecutorMono, httpHeaders); + executeActionDTO, + actionDTOMono, + datasourceStorageMono, + pluginMono, + pluginExecutorMono, + executeActionMetaDTO.getHeaders()); Mono<Map> editorConfigLabelMapMono = getEditorConfigLabelMap(datasourceStorageMono); @@ -525,7 +589,8 @@ protected void replaceNullWithQuotesForParamValues(List<Param> params) { * @param actionDTOMono * @return datasourceStorageMono */ - protected Mono<DatasourceStorage> getCachedDatasourceStorage(Mono<ActionDTO> actionDTOMono, String environmentId) { + protected Mono<DatasourceStorage> getCachedDatasourceStorage( + Mono<ActionDTO> actionDTOMono, ExecuteActionMetaDTO executeActionMetaDTO) { return actionDTOMono .flatMap(actionDTO -> { @@ -534,18 +599,20 @@ protected Mono<DatasourceStorage> getCachedDatasourceStorage(Mono<ActionDTO> act if (datasource != null && datasource.getId() != null) { // This is an action with a global datasource, // we need to find the entry from db and populate storage + AclPermission executePermission = + getPermission(executeActionMetaDTO, datasourcePermission.getExecutePermission()); datasourceStorageMono = datasourceService - .findById(datasource.getId(), datasourcePermission.getExecutePermission()) + .findById(datasource.getId(), executePermission) .flatMap(datasource1 -> datasourceStorageService.findByDatasourceAndEnvironmentIdForExecution( - datasource1, environmentId)); + datasource1, executeActionMetaDTO.getEnvironmentId())); } else if (datasource == null) { datasourceStorageMono = Mono.empty(); } else { // For embedded datasource, we are simply relying on datasource configuration property datasourceStorageMono = Mono.just(datasourceStorageService.createDatasourceStorageFromDatasource( - datasource, environmentId)); + datasource, executeActionMetaDTO.getEnvironmentId())); } return datasourceStorageMono @@ -773,12 +840,12 @@ protected Mono<ActionExecutionResult> getActionExecutionResult( } @Override - public Mono<ActionDTO> getValidActionForExecution(ExecuteActionDTO executeActionDTO) { + public Mono<ActionDTO> getValidActionForExecution( + ExecuteActionDTO executeActionDTO, ExecuteActionMetaDTO executeActionMetaDTO) { + AclPermission executePermission = getPermission(executeActionMetaDTO, actionPermission.getExecutePermission()); return newActionService .findActionDTObyIdAndViewMode( - executeActionDTO.getActionId(), - executeActionDTO.getViewMode(), - actionPermission.getExecutePermission()) + executeActionDTO.getActionId(), executeActionDTO.getViewMode(), executePermission) .switchIfEmpty(Mono.error(new AppsmithException( AppsmithError.NO_RESOURCE_FOUND, FieldName.ACTION, executeActionDTO.getActionId()))) .flatMap(action -> { diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/acl/AclPermissionTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/acl/AclPermissionTest.java index 9a405297ecc2..3c4be887bc09 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/acl/AclPermissionTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/acl/AclPermissionTest.java @@ -31,4 +31,12 @@ void testIsPermissionForEntity() { assertThat(AclPermission.isPermissionForEntity(AclPermission.MANAGE_PAGES, NewPage.class)) .isTrue(); } + + @Test + void testGetAclPermissionWhenOperateWithoutPermission() { + assertThat(AclPermission.getPermissionOrNull(AclPermission.READ_APPLICATIONS, Boolean.FALSE)) + .isEqualTo(AclPermission.READ_APPLICATIONS); + assertThat(AclPermission.getPermissionOrNull(AclPermission.READ_APPLICATIONS, Boolean.TRUE)) + .isNull(); + } } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java index 555a610a9ecb..509520214c35 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java @@ -203,8 +203,8 @@ public Map<String, Object> hints() { @Test public void testExecuteAction_withoutExecuteActionDTOPart_failsValidation() { - final Mono<ActionExecutionResult> actionExecutionResultMono = - actionExecutionSolution.executeAction(Flux.empty(), null, FieldName.UNUSED_ENVIRONMENT_ID, null); + final Mono<ActionExecutionResult> actionExecutionResultMono = actionExecutionSolution.executeAction( + Flux.empty(), null, FieldName.UNUSED_ENVIRONMENT_ID, null, Boolean.FALSE); StepVerifier.create(actionExecutionResultMono) .expectErrorMatches(e -> e instanceof AppsmithException @@ -227,8 +227,8 @@ public void testExecuteAction_withMalformedExecuteActionDTO_failsValidation() { final Flux<Part> partsFlux = BodyExtractors.toParts().extract(mock, this.context); - final Mono<ActionExecutionResult> actionExecutionResultMono = - actionExecutionSolution.executeAction(partsFlux, null, FieldName.UNUSED_ENVIRONMENT_ID, null); + final Mono<ActionExecutionResult> actionExecutionResultMono = actionExecutionSolution.executeAction( + partsFlux, null, FieldName.UNUSED_ENVIRONMENT_ID, null, Boolean.FALSE); StepVerifier.create(actionExecutionResultMono) .expectErrorMatches(e -> e instanceof AppsmithException @@ -252,7 +252,7 @@ public void testExecuteAction_withoutActionId_failsValidation() { final Flux<Part> partsFlux = BodyExtractors.toParts().extract(mock, this.context); final Mono<ActionExecutionResult> actionExecutionResultMono = - actionExecutionSolution.executeAction(partsFlux, null, null, null); + actionExecutionSolution.executeAction(partsFlux, null, null, null, Boolean.FALSE); StepVerifier.create(actionExecutionResultMono) .expectErrorMatches(e -> e instanceof AppsmithException @@ -288,7 +288,7 @@ public void testExecuteAPIWithUsualOrderingOfTheParts() { ActionExecutionSolutionCE executionSolutionSpy = spy(actionExecutionSolution); Mono<ActionExecutionResult> actionExecutionResultMono = - executionSolutionSpy.executeAction(partsFlux, null, null, null); + executionSolutionSpy.executeAction(partsFlux, null, null, null, Boolean.FALSE); ActionExecutionResult mockResult = new ActionExecutionResult(); mockResult.setIsExecutionSuccess(true); @@ -305,7 +305,7 @@ public void testExecuteAPIWithUsualOrderingOfTheParts() { .when(datasourceService) .getTrueEnvironmentId( any(), any(), any(), Mockito.eq(environmentPermission.getExecutePermission()), anyBoolean()); - doReturn(Mono.just(mockResult)).when(executionSolutionSpy).executeAction(any(), any(), any()); + doReturn(Mono.just(mockResult)).when(executionSolutionSpy).executeAction(any(), any()); doReturn(Mono.just(newAction)).when(newActionService).findByBranchNameAndDefaultActionId(any(), any(), any()); StepVerifier.create(actionExecutionResultMono) @@ -346,7 +346,7 @@ public void testExecuteAPIWithParameterMapAsLastPart() { ActionExecutionSolutionCE executionSolutionSpy = spy(actionExecutionSolution); Mono<ActionExecutionResult> actionExecutionResultMono = - executionSolutionSpy.executeAction(partsFlux, null, null, null); + executionSolutionSpy.executeAction(partsFlux, null, null, null, Boolean.FALSE); ActionExecutionResult mockResult = new ActionExecutionResult(); mockResult.setIsExecutionSuccess(true); @@ -363,7 +363,7 @@ public void testExecuteAPIWithParameterMapAsLastPart() { .when(datasourceService) .getTrueEnvironmentId( any(), any(), any(), Mockito.eq(environmentPermission.getExecutePermission()), anyBoolean()); - doReturn(Mono.just(mockResult)).when(executionSolutionSpy).executeAction(any(), any(), any()); + doReturn(Mono.just(mockResult)).when(executionSolutionSpy).executeAction(any(), any()); doReturn(Mono.just(newAction)).when(newActionService).findByBranchNameAndDefaultActionId(any(), any(), any()); StepVerifier.create(actionExecutionResultMono) diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java index 71d3ff4d8583..c6afdc4a9c0c 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java @@ -29,6 +29,7 @@ import com.appsmith.server.domains.User; import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.ExecuteActionMetaDTO; import com.appsmith.server.dtos.MockDataSource; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; @@ -334,8 +335,12 @@ private Mono<ActionExecutionResult> executeAction( .when(spyDatasourceService) .isEndpointBlockedForConnectionRequest(Mockito.any()); + ExecuteActionMetaDTO executeActionMetaDTO = ExecuteActionMetaDTO.builder() + .environmentId(defaultEnvironmentId) + .build(); + Mono<ActionExecutionResult> actionExecutionResultMono = - actionExecutionSolution.executeAction(executeActionDTO, defaultEnvironmentId, null); + actionExecutionSolution.executeAction(executeActionDTO, executeActionMetaDTO); return actionExecutionResultMono; } @@ -530,8 +535,11 @@ public void testActionExecuteErrorResponse() { .when(spyDatasourceService) .isEndpointBlockedForConnectionRequest(Mockito.any()); + ExecuteActionMetaDTO executeActionMetaDTO = + ExecuteActionMetaDTO.builder().build(); + Mono<ActionExecutionResult> executionResultMono = - actionExecutionSolution.executeAction(executeActionDTO, null, null); + actionExecutionSolution.executeAction(executeActionDTO, executeActionMetaDTO); StepVerifier.create(executionResultMono) .assertNext(result -> { @@ -584,8 +592,11 @@ public void testActionExecuteNullPaginationParameters() { .when(spyDatasourceService) .isEndpointBlockedForConnectionRequest(Mockito.any()); + ExecuteActionMetaDTO executeActionMetaDTO = + ExecuteActionMetaDTO.builder().build(); + Mono<ActionExecutionResult> executionResultMono = - actionExecutionSolution.executeAction(executeActionDTO, null, null); + actionExecutionSolution.executeAction(executeActionDTO, executeActionMetaDTO); StepVerifier.create(executionResultMono) .assertNext(result -> { @@ -632,8 +643,11 @@ public void testActionExecuteSecondaryStaleConnection() { .when(spyDatasourceService) .isEndpointBlockedForConnectionRequest(Mockito.any()); + ExecuteActionMetaDTO executeActionMetaDTO = + ExecuteActionMetaDTO.builder().build(); + Mono<ActionExecutionResult> executionResultMono = - actionExecutionSolution.executeAction(executeActionDTO, null, null); + actionExecutionSolution.executeAction(executeActionDTO, executeActionMetaDTO); StepVerifier.create(executionResultMono) .assertNext(result -> { @@ -680,8 +694,11 @@ public void testActionExecuteTimeout() { .when(spyDatasourceService) .isEndpointBlockedForConnectionRequest(Mockito.any()); + ExecuteActionMetaDTO executeActionMetaDTO = + ExecuteActionMetaDTO.builder().build(); + Mono<ActionExecutionResult> executionResultMono = - actionExecutionSolution.executeAction(executeActionDTO, null, null); + actionExecutionSolution.executeAction(executeActionDTO, executeActionMetaDTO); StepVerifier.create(executionResultMono) .assertNext(result -> { @@ -725,8 +742,11 @@ public void checkRecoveryFromStaleConnections() { executeActionDTO.setActionId(createdAction.getId()); executeActionDTO.setViewMode(false); + ExecuteActionMetaDTO executeActionMetaDTO = + ExecuteActionMetaDTO.builder().build(); + Mono<ActionExecutionResult> actionExecutionResultMono = - actionExecutionSolution.executeAction(executeActionDTO, null, null); + actionExecutionSolution.executeAction(executeActionDTO, executeActionMetaDTO); StepVerifier.create(actionExecutionResultMono) .assertNext(result -> { @@ -765,13 +785,17 @@ public void executeActionWithExternalDatasource() { action.setActionConfiguration(actionConfiguration); action.setDatasource(savedDs); + ExecuteActionMetaDTO executeActionMetaDTO = ExecuteActionMetaDTO.builder() + .environmentId(defaultEnvironmentId) + .build(); + Mono<ActionExecutionResult> resultMono = layoutActionService .createSingleAction(action, Boolean.FALSE) .flatMap(savedAction -> { ExecuteActionDTO executeActionDTO = new ExecuteActionDTO(); executeActionDTO.setActionId(savedAction.getId()); executeActionDTO.setViewMode(false); - return actionExecutionSolution.executeAction(executeActionDTO, defaultEnvironmentId, null); + return actionExecutionSolution.executeAction(executeActionDTO, executeActionMetaDTO); }); StepVerifier.create(resultMono) @@ -1917,13 +1941,17 @@ public void executeActionNoStorageFound() { action.setActionConfiguration(actionConfiguration); action.setDatasource(savedDs); + ExecuteActionMetaDTO executeActionMetaDTO = ExecuteActionMetaDTO.builder() + .environmentId(defaultEnvironmentId) + .build(); + Mono<ActionExecutionResult> resultMono = layoutActionService .createSingleAction(action, Boolean.FALSE) .flatMap(savedAction -> { ExecuteActionDTO executeActionDTO = new ExecuteActionDTO(); executeActionDTO.setActionId(savedAction.getId()); executeActionDTO.setViewMode(false); - return actionExecutionSolution.executeAction(executeActionDTO, defaultEnvironmentId, null); + return actionExecutionSolution.executeAction(executeActionDTO, executeActionMetaDTO); }); Mockito.doReturn(Mono.empty())
9a135b961a38c8da28ebe940dd8773468187716a
2023-03-24 13:18:19
vadim
feat: Widgets color generation utility functions (#21731)
false
Widgets color generation utility functions (#21731)
feat
diff --git a/app/client/packages/wds/src/utils/colors.ts b/app/client/packages/wds/src/utils/colors.ts index e6db2c46ca93..db0de362d851 100644 --- a/app/client/packages/wds/src/utils/colors.ts +++ b/app/client/packages/wds/src/utils/colors.ts @@ -1,5 +1,47 @@ import Color from "colorjs.io"; +/* Color Utility Functions. Lightness */ + +export const isVeryDark = (hex = "#000") => { + return parseColor(hex).oklch.l < 30; +}; + +export const isVeryLight = (hex = "#000") => { + return parseColor(hex).oklch.l > 90; +}; + +/* Chroma */ + +export const isAchromatic = (hex = "#000") => { + return parseColor(hex).oklch.c < 5; +}; + +export const isColorful = (hex = "#000") => { + return parseColor(hex).oklch.c > 17; +}; + +/* Hue */ + +export const isCold = (hex = "#000") => { + return parseColor(hex).oklch.h >= 120 && parseColor(hex).oklch.h <= 300; +}; + +export const isBlue = (hex = "#000") => { + return parseColor(hex).oklch.h >= 230 && parseColor(hex).oklch.h <= 270; +}; + +export const isGreen = (hex = "#000") => { + return parseColor(hex).oklch.h >= 105 && parseColor(hex).oklch.h <= 165; +}; + +export const isYellow = (hex = "#000") => { + return parseColor(hex).oklch.h >= 60 && parseColor(hex).oklch.h <= 75; +}; + +export const isRed = (hex = "#000") => { + return parseColor(hex).oklch.h >= 29 && parseColor(hex).oklch.h <= 50; +}; + /** * returns black or white based on the constrast of the color compare to white * using APCA algorithm
c0f98ad4d7bce2d0362fa73a93c83882b624d3c4
2022-05-06 23:43:10
rashmi rai
fix: change default value in rest api json and placeholder (#13261)
false
change default value in rest api json and placeholder (#13261)
fix
diff --git a/app/client/cypress/fixtures/patchjson.txt b/app/client/cypress/fixtures/patchjson.txt index 44f0d028af56..ec2f1795a905 100644 --- a/app/client/cypress/fixtures/patchjson.txt +++ b/app/client/cypress/fixtures/patchjson.txt @@ -1,4 +1,4 @@ { "name": "morpheus", "job": "zion resident" - +} diff --git a/app/client/cypress/fixtures/postjson.txt b/app/client/cypress/fixtures/postjson.txt index 44f0d028af56..614fe6ee15d7 100644 --- a/app/client/cypress/fixtures/postjson.txt +++ b/app/client/cypress/fixtures/postjson.txt @@ -1,4 +1,4 @@ { "name": "morpheus", "job": "zion resident" - +} \ No newline at end of file diff --git a/app/client/cypress/fixtures/putjson.txt b/app/client/cypress/fixtures/putjson.txt index 44f0d028af56..614fe6ee15d7 100644 --- a/app/client/cypress/fixtures/putjson.txt +++ b/app/client/cypress/fixtures/putjson.txt @@ -1,4 +1,4 @@ { "name": "morpheus", "job": "zion resident" - +} \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiPaneTests/API_All_Verb_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiPaneTests/API_All_Verb_spec.js index 4d44bf0c0de5..9c8b7fedb577 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiPaneTests/API_All_Verb_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiPaneTests/API_All_Verb_spec.js @@ -32,7 +32,7 @@ describe("API Panel Test Functionality", function() { cy.xpath(apiwidget.postbody) .click({ force: true }) .focus() - .type(json, { force: true }); + .invoke("val", json); cy.WaitAutoSave(); cy.RunAPI(); cy.validateRequest( @@ -64,7 +64,7 @@ describe("API Panel Test Functionality", function() { cy.xpath(apiwidget.postbody) .click({ force: true }) .focus() - .type(json, { force: true }); + .invoke("val", json); cy.WaitAutoSave(); cy.RunAPI(); cy.validateRequest( @@ -96,7 +96,7 @@ describe("API Panel Test Functionality", function() { cy.xpath(apiwidget.postbody) .click({ force: true }) .focus() - .type(json, { force: true }); + .invoke("val", json); cy.WaitAutoSave(); cy.RunAPI(); cy.validateRequest( diff --git a/app/client/src/components/ads/MultiSwitch.tsx b/app/client/src/components/ads/MultiSwitch.tsx index fc45fd1b8310..6d683e9ec958 100644 --- a/app/client/src/components/ads/MultiSwitch.tsx +++ b/app/client/src/components/ads/MultiSwitch.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect } from "react"; import styled from "styled-components"; import { CommonComponentProps } from "./common"; import Text, { Case, TextType } from "./Text"; @@ -66,6 +66,10 @@ export default function MultiSwitch<T>(props: MultiSwitchProps<T>) { (tab) => tab.key === props.selected.value, ); + useEffect(() => { + props.onSelect(props.selected.value); + }, []); + return ( <div data-cy={props.cypressSelector}> <TabHeader diff --git a/app/client/src/constants/ApiEditorConstants.ts b/app/client/src/constants/ApiEditorConstants.ts index 8096e9692c0d..2ebe30e325da 100644 --- a/app/client/src/constants/ApiEditorConstants.ts +++ b/app/client/src/constants/ApiEditorConstants.ts @@ -77,7 +77,7 @@ export const DEFAULT_API_ACTION_CONFIG: ApiActionConfig = { httpMethod: DEFAULT_METHOD_TYPE, headers: EMPTY_KEY_VALUE_PAIRS.slice(), queryParameters: EMPTY_KEY_VALUE_PAIRS.slice(), - body: "", + body: `{{\n\t{}\n}}`, bodyFormData: [], formData: { apiContentType: HTTP_METHODS_DEFAULT_FORMAT_TYPES[DEFAULT_METHOD_TYPE], diff --git a/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx b/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx index 570f1e264fde..ecfbb32382d5 100644 --- a/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx +++ b/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx @@ -90,9 +90,7 @@ function PostBodyData(props: Props) { expected={expectedPostBody} mode={EditorModes.JSON_WITH_BINDING} name="actionConfiguration.body" - placeholder={ - '{\n "name":"{{ inputName.property }}",\n "preference":"{{ dropdownName.property }}"\n}\n\n\\\\Take widget inputs using {{ }}' - } + placeholder={`{{\n\t{name: inputName.property, preference: dropdownName.property}\n}}`} showLineNumbers size={EditorSize.EXTENDED} tabBehaviour={TabBehaviour.INDENT} @@ -130,6 +128,7 @@ function PostBodyData(props: Props) { dataTreePath={`${dataTreePath}.body`} mode={EditorModes.TEXT_WITH_BINDING} name="actionConfiguration.body" + placeholder={`{{\n\t{name: inputName.property, preference: dropdownName.property}\n}}`} size={EditorSize.EXTENDED} tabBehaviour={TabBehaviour.INDENT} theme={theme}
6182de6d2b6adffc478c9717f67497b340269f3b
2023-07-01 00:57:14
Aishwarya-U-R
ci: Cypress-only-fixes label workflow fix-V (#24984)
false
Cypress-only-fixes label workflow fix-V (#24984)
ci
diff --git a/.github/workflows/add-label.yml b/.github/workflows/add-label.yml index 5e84e4795564..98062d23ae20 100644 --- a/.github/workflows/add-label.yml +++ b/.github/workflows/add-label.yml @@ -23,19 +23,19 @@ jobs: id: check_files_changed run: | filesChangedCount=$(echo "${{ steps.files.outputs.files_changed }}" | wc -l) - if [[ "$filesChangedCount" -gt 0 ]]; then - echo "::set-output name=files_changed_count::$filesChangedCount" - else + if [[ -z "$filesChangedCount" ]]; then echo "No files changed in the specified folder" exit 1 - fi + else + echo "::set-output name=files_changed_count::$filesChangedCount" + fi - name: Check if PR is merged id: check_pr_merged run: echo "PR_MERGED=$(jq --raw-output .pull_request.merged $GITHUB_EVENT_PATH)" >> $GITHUB_ENV - name: Add label - if: ${{ env.PR_MERGED == 'true' && steps.check_files_changed.outputs.files_changed_count > 0 }} + if: ${{ env.PR_MERGED == 'true' && steps.check_files_changed.outputs.files_changed_count != '' }} uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }}
b342a0386691a335f0f50edf310f31cb4ff2371f
2023-07-17 11:56:39
sneha122
feat: default table name populated in query editor for mock datasources (#25263)
false
default table name populated in query editor for mock datasources (#25263)
feat
diff --git a/app/client/cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts b/app/client/cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts index 2785170a2944..110a86c77460 100644 --- a/app/client/cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts +++ b/app/client/cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts @@ -6,6 +6,7 @@ import { assertHelper, } from "../../../support/Objects/ObjectsCore"; let dsName: any; +import formControls from "../../../locators/FormControl.json"; describe( "excludeForAirgap", @@ -43,7 +44,14 @@ describe( dataSources.CreateMockDB("Users").then((mockDBName) => { dsName = mockDBName; dataSources.CreateQueryAfterDSSaved(); - dataSources.RunQueryNVerifyResponseViews(1); + + // This will validate that query populated in editor uses existing table name + agHelper.VerifyCodeInputValue( + formControls.postgreSqlBody, + "SELECT * FROM public.users LIMIT 10;\n\n", + ); + + dataSources.RunQueryNVerifyResponseViews(10); dataSources.NavigateToActiveTab(); agHelper .GetText(dataSources._queriesOnPageText(mockDBName)) @@ -52,7 +60,7 @@ describe( ); entityExplorer.CreateNewDsQuery(mockDBName); - dataSources.RunQueryNVerifyResponseViews(1, true); + dataSources.RunQueryNVerifyResponseViews(10, true); dataSources.NavigateToActiveTab(); agHelper .GetText(dataSources._queriesOnPageText(mockDBName)) diff --git a/app/client/src/pages/Editor/FormControl.tsx b/app/client/src/pages/Editor/FormControl.tsx index 888399404f37..14709142467b 100644 --- a/app/client/src/pages/Editor/FormControl.tsx +++ b/app/client/src/pages/Editor/FormControl.tsx @@ -34,6 +34,7 @@ import TemplateMenu from "./QueryEditor/TemplateMenu"; import { SQL_DATASOURCES } from "../../constants/QueryEditorConstants"; import { getCurrentEnvironment } from "@appsmith/utils/Environments"; import type { Datasource } from "entities/Datasource"; +import { getSQLPluginsMockTableName } from "utils/editorContextUtils"; export interface FormControlProps { config: ControlProps; @@ -75,6 +76,9 @@ function FormControl(props: FormControlProps) { const datasourceTableName: string = useSelector((state: AppState) => getDatasourceFirstTableName(state, dsId), ); + const isMockDS = + ((formValues as Action)?.datasource as any)?.isMock || + (formValues as Datasource)?.isMock; const pluginTemplates: Record<string, any> = useSelector((state: AppState) => getPluginTemplates(state), ); @@ -143,17 +147,20 @@ function FormControl(props: FormControlProps) { !convertFormToRaw && SQL_DATASOURCES.includes(pluginName) ) { + const tableNameToBeReplaced = isMockDS + ? getSQLPluginsMockTableName(pluginId) + : datasourceTableName; const defaultTemplate = !!pluginTemplate ? pluginTemplate[DB_QUERY_DEFAULT_TEMPLATE_TYPE] : ""; const smartTemplate = defaultTemplate - .replace(DB_QUERY_DEFAULT_TABLE_NAME, datasourceTableName) + .replace(DB_QUERY_DEFAULT_TABLE_NAME, tableNameToBeReplaced) .split("--")[0]; dispatch( change( props?.formName || QUERY_EDITOR_FORM_NAME, props.config.configProperty, - !!datasourceTableName ? smartTemplate : defaultTemplate, + !!tableNameToBeReplaced ? smartTemplate : defaultTemplate, ), ); updateQueryParams(); diff --git a/app/client/src/utils/editorContextUtils.ts b/app/client/src/utils/editorContextUtils.ts index 97ae8a9b6d4b..71e0fdd779ba 100644 --- a/app/client/src/utils/editorContextUtils.ts +++ b/app/client/src/utils/editorContextUtils.ts @@ -6,10 +6,13 @@ import { } from "@appsmith/constants/forms"; import { getCurrentEnvironment } from "@appsmith/utils/Environments"; import { diff } from "deep-diff"; -import { PluginPackageName, PluginType } from "entities/Action"; +import { PluginName, PluginPackageName, PluginType } from "entities/Action"; import type { Datasource } from "entities/Datasource"; import { AuthenticationStatus, AuthType } from "entities/Datasource"; import { get, isArray } from "lodash"; +import store from "store"; +import { getPlugin } from "selectors/entitiesSelector"; +import type { AppState } from "@appsmith/reducers"; export function isCurrentFocusOnInput() { return ( ["input", "textarea"].indexOf( @@ -171,3 +174,22 @@ export function getFormDiffPaths(initialValues: any, currentValues: any) { } return diffPaths; } + +/** + * Returns mock datasource default table name to be populated in query editor, based on plugin name + * @param pluginId string + * @returns string + */ +export function getSQLPluginsMockTableName(pluginId: string) { + const state: AppState = store.getState(); + const plugin: Plugin | undefined = getPlugin(state, pluginId); + + switch (plugin?.name) { + case PluginName.POSTGRES: { + return "public.users"; + } + default: { + return ""; + } + } +}
a277568d33af62f6dfb3df740009d4955d1de831
2022-11-30 22:21:24
Parthvi
test: fix merge_spec.js cypress test (#18587)
false
fix merge_spec.js cypress test (#18587)
test
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js index c32cbb42f812..5b518830b195 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js @@ -32,6 +32,7 @@ describe("Git sync modal: merge tab", function() { .should("eq", "true"); cy.get(gitSyncLocators.mergeButton).should("be.disabled"); + cy.wait(3000); cy.get(gitSyncLocators.mergeBranchDropdownDestination).click(); cy.get(commonLocators.dropdownmenu) .contains(mainBranch)
4dff6e4b5c7e32ec398fd6121fd93b9c47d442b0
2021-05-11 16:22:47
Pawan Kumar
fix: Cannot read property 'label' of undefined & Cannot read property 'length' of undefined (#4389)
false
Cannot read property 'label' of undefined & Cannot read property 'length' of undefined (#4389)
fix
diff --git a/app/client/src/components/designSystems/appsmith/ChartComponent.tsx b/app/client/src/components/designSystems/appsmith/ChartComponent.tsx index ca49f9b40b21..43b3bf3b7b5f 100644 --- a/app/client/src/components/designSystems/appsmith/ChartComponent.tsx +++ b/app/client/src/components/designSystems/appsmith/ChartComponent.tsx @@ -185,7 +185,9 @@ class ChartComponent extends React.Component<ChartComponentProps> { getSeriesChartData = (data: ChartDataPoint[], categories: string[]) => { const dataMap: { [key: string]: string } = {}; - if (data.length === 0) { + + // if not array or (is array and array length is zero) + if (!Array.isArray(data) || (Array.isArray(data) && data.length === 0)) { return [ { value: "", @@ -218,7 +220,7 @@ class ChartComponent extends React.Component<ChartComponentProps> { const seriesChartData: Array<Record< string, unknown - >> = this.getSeriesChartData(item.data, categories); + >> = this.getSeriesChartData(get(item, "data", []), categories); return { seriesName: item.seriesName, data: seriesChartData, diff --git a/app/client/src/components/designSystems/blueprint/DropdownComponent.tsx b/app/client/src/components/designSystems/blueprint/DropdownComponent.tsx index f5a45770fe8e..3487aab4b820 100644 --- a/app/client/src/components/designSystems/blueprint/DropdownComponent.tsx +++ b/app/client/src/components/designSystems/blueprint/DropdownComponent.tsx @@ -337,7 +337,7 @@ class DropDownComponent extends React.Component<DropDownComponentProps> { }; renderTag = (option: DropdownOption) => { - return option.label; + return option?.label; }; isOptionSelected = (selectedOption: DropdownOption) => {
f62816a9d5d2624d0c05021014d0409543c29086
2023-10-27 18:18:42
arunvjn
fix: Validation issue in select widget on page reload (#28277)
false
Validation issue in select widget on page reload (#28277)
fix
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Multiselect/MultiSelect5_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Multiselect/MultiSelect5_spec.ts index 5bb17df6ac0b..4bb61a805269 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Multiselect/MultiSelect5_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Multiselect/MultiSelect5_spec.ts @@ -296,4 +296,74 @@ describe("Multi Select widget Tests", function () { "rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px", ); }); + + it("8. Verify validation error in default selected values", () => { + entityExplorer.SelectEntityByName("NewMultiSelect", "Widgets"); + + propPane.MoveToTab("Content"); + + propPane.UpdatePropertyFieldValue( + "Default selected values", + '["GREEN1", "RED1"]', + true, + ); + + agHelper.VerifyEvaluatedErrorMessage( + "Some or all default values are missing from options. Please update the values.", + ); + + propPane.ToggleJSMode("Source Data", true); + + // Updates the options and asserts that the validation error is fixed + propPane.UpdatePropertyFieldValue( + "Source Data", + '[{"name": "Green", "code":"GREEN1"}, { "name": "Red","code": "RED1" }]', + true, + ); + + agHelper.FocusElement( + locators._propertyInputField("Default selected values"), + ); + + agHelper.Sleep(1000); + agHelper.AssertElementAbsence(locators._evaluatedErrorMessage); + + // Changes options to bring back validation error + propPane.UpdatePropertyFieldValue( + "Source Data", + '[{"name": "Green", "code":"GREEN1"}, { "name": "Red","code": "RED" }]', + true, + ); + + agHelper.FocusElement( + locators._propertyInputField("Default selected values"), + ); + + agHelper.VerifyEvaluatedErrorMessage( + "Some or all default values are missing from options. Please update the values.", + ); + + // Reload to check if the error persists + agHelper.RefreshPage(); + + entityExplorer.SelectEntityByName("NewMultiSelect", "Widgets"); + + agHelper.FocusElement( + locators._propertyInputField("Default selected values"), + ); + + agHelper.VerifyEvaluatedErrorMessage( + "Some or all default values are missing from options. Please update the values.", + ); + + // Fixes the validation error + propPane.UpdatePropertyFieldValue( + "Default selected values", + '{{["GREEN1"]}}', + true, + ); + + agHelper.Sleep(1000); + agHelper.AssertElementAbsence(locators._evaluatedErrorMessage); + }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/Select_Validation_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/Select_Validation_spec.js index a4a1a7e706f2..0aa066434774 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/Select_Validation_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/Select_Validation_spec.js @@ -29,5 +29,74 @@ describe("Select Widget Functionality", function () { "contain.text", "Green", ); + _.deployMode.NavigateBacktoEditor(); + }); + + it("2. Shows validation error for invalid defaultSelectedValue", () => { + const { agHelper, entityExplorer, locators, propPane } = _; + + entityExplorer.SelectEntityByName("SelectRenamed", "Widgets"); + + propPane.UpdatePropertyFieldValue("Default selected value", "GREEN1", true); + + agHelper.VerifyEvaluatedErrorMessage( + "Default value is missing in options. Please update the value.", + ); + + propPane.ToggleJSMode("Source Data", true); + + // Updates the options and asserts that the validation error is fixed + propPane.UpdatePropertyFieldValue( + "Source Data", + '[{"name": "Green", "code":"GREEN1"}]', + true, + ); + + agHelper.FocusElement( + locators._propertyInputField("Default selected value"), + ); + + agHelper.AssertElementAbsence(locators._evaluatedErrorMessage); + + // Changes options to bring back validation error + propPane.UpdatePropertyFieldValue( + "Source Data", + '[{"name": "Green", "code":"GREEN"}]', + true, + ); + + agHelper.FocusElement( + locators._propertyInputField("Default selected value"), + ); + + agHelper.VerifyEvaluatedErrorMessage( + "Default value is missing in options. Please update the value.", + ); + + // Reload to check if the error persists + agHelper.RefreshPage(); + + entityExplorer.SelectEntityByName("SelectRenamed", "Widgets"); + + agHelper.FocusElement( + locators._propertyInputField("Default selected value"), + ); + + agHelper.VerifyEvaluatedErrorMessage( + "Default value is missing in options. Please update the value.", + ); + + // Fixes the validation error + propPane.UpdatePropertyFieldValue( + "Source Data", + '[{"name": "Green", "code": {{"GREEN1"}}}]', + true, + ); + + agHelper.FocusElement( + locators._propertyInputField("Default selected value"), + ); + + agHelper.AssertElementAbsence(locators._evaluatedErrorMessage); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts index 57240928a3bf..b6cc1f61b407 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts @@ -231,4 +231,44 @@ describe("Tabs widget Tests", function () { "rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px", ); }); + + it("8. Checks validation error in default selected tab", () => { + entityExplorer.SelectEntityByName("NewTabs", "Widgets"); + + propPane.MoveToTab("Content"); + + propPane.TypeTextIntoField("Default tab", "Tab 11", true); + + agHelper.VerifyEvaluatedErrorMessage("Tab name Tab 11 does not exist"); + + agHelper.ClearNType( + locators._draggableFieldConfig("tab1") + " input", + "Tab 11", + 0, + ); + + agHelper.AssertAutoSave(); + + agHelper.Sleep(1000); + + agHelper.FocusElement(locators._propertyInputField("Default tab")); + + agHelper.AssertElementAbsence(locators._evaluatedErrorMessage); + + propPane.TypeTextIntoField("Default tab", "Tab 13", true); + + agHelper.VerifyEvaluatedErrorMessage("Tab name Tab 13 does not exist"); + + agHelper.AssertAutoSave(); + + agHelper.Sleep(1000); + + cy.reload(); + + entityExplorer.SelectEntityByName("NewTabs", "Widgets"); + + agHelper.FocusElement(locators._propertyInputField("Default tab")); + + agHelper.VerifyEvaluatedErrorMessage("Tab name Tab 13 does not exist"); + }); }); diff --git a/app/client/src/WidgetProvider/factory/index.tsx b/app/client/src/WidgetProvider/factory/index.tsx index b1a742946c84..f9dafeba688b 100644 --- a/app/client/src/WidgetProvider/factory/index.tsx +++ b/app/client/src/WidgetProvider/factory/index.tsx @@ -221,6 +221,23 @@ class WidgetFactory { } } + @memoize + @freeze + static getWidgetDependencyMap( + widgetType: WidgetType, + ): Record<string, string[]> { + const widget = WidgetFactory.widgetsMap.get(widgetType); + + const dependencyMap = widget?.getDependencyMap(); + + if (dependencyMap) { + return dependencyMap; + } else { + log.error(`Dependency map is defined for widget type: ${widgetType}`); + return {}; + } + } + @memoize @freeze static getWidgetMetaPropertiesMap( diff --git a/app/client/src/ce/entities/DataTree/types.ts b/app/client/src/ce/entities/DataTree/types.ts index 58da10b3aab4..c49f169233c7 100644 --- a/app/client/src/ce/entities/DataTree/types.ts +++ b/app/client/src/ce/entities/DataTree/types.ts @@ -140,6 +140,7 @@ export interface EntityConfig { reactivePaths?: Record<string, EvaluationSubstitutionType>; validationPaths?: Record<string, ValidationConfig>; dynamicBindingPathList?: DynamicPath[]; + dependencyMap?: Record<string, string[]>; } //data factory types diff --git a/app/client/src/ce/workers/common/DependencyMap/utils/getEntityDependenciesByType.ts b/app/client/src/ce/workers/common/DependencyMap/utils/getEntityDependenciesByType.ts index 44e74173e070..da9056f7176a 100644 --- a/app/client/src/ce/workers/common/DependencyMap/utils/getEntityDependenciesByType.ts +++ b/app/client/src/ce/workers/common/DependencyMap/utils/getEntityDependenciesByType.ts @@ -66,6 +66,18 @@ export function getWidgetDependencies( dependencies = { ...widgetInternalDependencies }; + const dependencyMap = widgetConfig.dependencyMap; + + for (const source in dependencyMap) { + if (!dependencyMap.hasOwnProperty(source)) continue; + const targetPaths = dependencyMap[source]; + const fullPropertyPath = `${widgetName}.${source}`; + dependencies[fullPropertyPath] = dependencies[fullPropertyPath] || []; + dependencies[fullPropertyPath].push( + ...targetPaths.map((p) => `${widgetName}.${p}`), + ); + } + const dynamicBindingPathList = getEntityDynamicBindingPathList(widgetConfig); const dynamicTriggerPathList = widgetConfig.dynamicTriggerPathList || []; diff --git a/app/client/src/constants/PropertyControlConstants.tsx b/app/client/src/constants/PropertyControlConstants.tsx index 45e2b3855f6e..f20c728c22a3 100644 --- a/app/client/src/constants/PropertyControlConstants.tsx +++ b/app/client/src/constants/PropertyControlConstants.tsx @@ -140,7 +140,6 @@ interface ValidationConfigParams { export interface ValidationConfig { type: ValidationTypes; params?: ValidationConfigParams; - dependentPaths?: string[]; } export type PropertyPaneConfig = diff --git a/app/client/src/entities/DataTree/dataTreeWidget.test.ts b/app/client/src/entities/DataTree/dataTreeWidget.test.ts index b1e272f2ef9c..1cdad2d850d3 100644 --- a/app/client/src/entities/DataTree/dataTreeWidget.test.ts +++ b/app/client/src/entities/DataTree/dataTreeWidget.test.ts @@ -294,6 +294,7 @@ describe("generateDataTreeWidget", () => { META: "meta.text", }, }, + dependencyMap: {}, defaultMetaProps: ["text", "isDirty", "isFocused"], defaultProps: { text: "defaultText", diff --git a/app/client/src/entities/DataTree/dataTreeWidget.ts b/app/client/src/entities/DataTree/dataTreeWidget.ts index bd474b15eb4a..d9f85de61e38 100644 --- a/app/client/src/entities/DataTree/dataTreeWidget.ts +++ b/app/client/src/entities/DataTree/dataTreeWidget.ts @@ -186,6 +186,8 @@ const generateDataTreeWidgetWithoutMeta = ( ); const defaultProps = WidgetFactory.getWidgetDefaultPropertiesMap(widget.type); + const dependencyMap = WidgetFactory.getWidgetDependencyMap(widget.type); + const propertyPaneConfigs = WidgetFactory.getWidgetPropertyPaneConfig( widget.type, ); @@ -324,6 +326,7 @@ const generateDataTreeWidgetWithoutMeta = ( reactivePaths, triggerPaths, validationPaths, + dependencyMap, ENTITY_TYPE: ENTITY_TYPE_VALUE.WIDGET, privateWidgets: { ...widget.privateWidgets, diff --git a/app/client/src/sagas/EvaluationsSaga.ts b/app/client/src/sagas/EvaluationsSaga.ts index a5299d80c399..fe3c12e8bfdc 100644 --- a/app/client/src/sagas/EvaluationsSaga.ts +++ b/app/client/src/sagas/EvaluationsSaga.ts @@ -139,7 +139,6 @@ export function* updateDataTreeHandler( jsVarsCreatedEvent, logs, removedPaths, - reValidatedPaths, staleMetaIds, undefinedEvalValuesMap, unEvalUpdates, @@ -184,7 +183,6 @@ export function* updateDataTreeHandler( errors, updatedDataTree, evaluationOrder, - reValidatedPaths, configTree, removedPaths, ); @@ -375,8 +373,13 @@ export function* executeTriggerRequestSaga( } export function* clearEvalCache() { - yield put({ type: ReduxActionTypes.RESET_DATA_TREE }); + /** + * Reset cache in worker before resetting the dataTree + * This order is important because there could be pending evaluation requests that are being processed by the worker + * The diffs generated by the already queued eval request when applied to a reset data tree will cause unexpected crash. + */ yield call(evalWorker.request, EVAL_WORKER_ACTIONS.CLEAR_CACHE); + yield put({ type: ReduxActionTypes.RESET_DATA_TREE }); return true; } diff --git a/app/client/src/sagas/PostEvaluationSagas.ts b/app/client/src/sagas/PostEvaluationSagas.ts index d01c6da2799c..39fd94971a0b 100644 --- a/app/client/src/sagas/PostEvaluationSagas.ts +++ b/app/client/src/sagas/PostEvaluationSagas.ts @@ -225,23 +225,18 @@ export function* evalErrorHandler( errors: EvalError[], dataTree?: DataTree, evaluationOrder?: Array<string>, - reValidatedPaths?: Array<string>, configTree?: ConfigTree, removedPaths?: Array<{ entityId: string; fullpath: string }>, ) { - if (dataTree && evaluationOrder && configTree && reValidatedPaths) { + if (dataTree && evaluationOrder && configTree) { const currentDebuggerErrors: Record<string, Log> = yield select(getDebuggerErrors); - const evalAndValidationOrder = new Set([ - ...reValidatedPaths, - ...evaluationOrder, - ]); // Update latest errors to the debugger logLatestEvalPropertyErrors( currentDebuggerErrors, dataTree, - [...evalAndValidationOrder], + evaluationOrder, configTree, removedPaths, ); diff --git a/app/client/src/widgets/BaseWidget.tsx b/app/client/src/widgets/BaseWidget.tsx index 62e9e95d3767..8bb23fec4b33 100644 --- a/app/client/src/widgets/BaseWidget.tsx +++ b/app/client/src/widgets/BaseWidget.tsx @@ -136,6 +136,10 @@ abstract class BaseWidget< return {}; } + static getDependencyMap(): Record<string, string[]> { + return {}; + } + // TODO Find a way to enforce this, (dont let it be set) static getMetaPropertiesMap(): Record<string, any> { return {}; diff --git a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.ts b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.ts index d2eb4248532e..ef446f1ba1fa 100644 --- a/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.ts +++ b/app/client/src/widgets/JSONFormWidget/widget/propertyConfig.ts @@ -109,7 +109,7 @@ export const sourceDataValidationFn = ( } catch (e) { return { isValid: false, - parsed: JSON.parse(value as string), + parsed: {}, messages: [e as Error], }; } diff --git a/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx b/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx index 8d199877c502..05059bd23f1a 100644 --- a/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx +++ b/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx @@ -207,6 +207,13 @@ class MultiSelectWidget extends BaseWidget< }; } + static getDependencyMap(): Record<string, string[]> { + return { + optionValue: ["sourceData"], + defaultOptionValue: ["serverSideFiltering", "options"], + }; + } + static getPropertyPaneContentConfig() { return [ { @@ -320,7 +327,6 @@ class MultiSelectWidget extends BaseWidget< autocompleteDataType: AutocompleteDataType.STRING, }, }, - dependentPaths: ["sourceData"], }, additionalAutoComplete: getLabelValueAdditionalAutocompleteData, }, @@ -348,7 +354,6 @@ class MultiSelectWidget extends BaseWidget< autocompleteDataType: AutocompleteDataType.ARRAY, }, }, - dependentPaths: ["serverSideFiltering", "options"], }, dependencies: ["serverSideFiltering", "options"], }, diff --git a/app/client/src/widgets/SelectWidget/widget/index.tsx b/app/client/src/widgets/SelectWidget/widget/index.tsx index 079c82ff887f..fcccd292dab1 100644 --- a/app/client/src/widgets/SelectWidget/widget/index.tsx +++ b/app/client/src/widgets/SelectWidget/widget/index.tsx @@ -196,6 +196,14 @@ class SelectWidget extends BaseWidget<SelectWidgetProps, WidgetState> { }; } + static getDependencyMap(): Record<string, string[]> { + return { + optionLabel: ["sourceData"], + optionValue: ["sourceData"], + defaultOptionValue: ["serverSideFiltering", "options"], + }; + } + static getAutocompleteDefinitions(): AutocompletionDefinitions { return { "!doc": @@ -304,7 +312,6 @@ class SelectWidget extends BaseWidget<SelectWidgetProps, WidgetState> { autocompleteDataType: AutocompleteDataType.STRING, }, }, - dependentPaths: ["sourceData"], }, additionalAutoComplete: getLabelValueAdditionalAutocompleteData, }, @@ -337,7 +344,6 @@ class SelectWidget extends BaseWidget<SelectWidgetProps, WidgetState> { autocompleteDataType: AutocompleteDataType.STRING, }, }, - dependentPaths: ["sourceData"], }, additionalAutoComplete: getLabelValueAdditionalAutocompleteData, }, @@ -365,7 +371,6 @@ class SelectWidget extends BaseWidget<SelectWidgetProps, WidgetState> { autocompleteDataType: AutocompleteDataType.STRING, }, }, - dependentPaths: ["serverSideFiltering", "options"], }, dependencies: ["serverSideFiltering", "options"], }, diff --git a/app/client/src/widgets/TabsWidget/widget/index.tsx b/app/client/src/widgets/TabsWidget/widget/index.tsx index 90a28ec45982..6532d77ee7b9 100644 --- a/app/client/src/widgets/TabsWidget/widget/index.tsx +++ b/app/client/src/widgets/TabsWidget/widget/index.tsx @@ -237,6 +237,12 @@ class TabsWidget extends BaseWidget< }; } + static getDependencyMap(): Record<string, string[]> { + return { + defaultTab: ["tabsObj", "tabs"], + }; + } + static getPropertyPaneContentConfig() { return [ { @@ -329,7 +335,6 @@ class TabsWidget extends BaseWidget< autocompleteDataType: AutocompleteDataType.STRING, }, }, - dependentPaths: ["tabsObj", "tabs"], }, dependencies: ["tabsObj", "tabs"], }, diff --git a/app/client/src/workers/Evaluation/__tests__/evaluation.test.ts b/app/client/src/workers/Evaluation/__tests__/evaluation.test.ts index 719665aeb045..8af71a6f856a 100644 --- a/app/client/src/workers/Evaluation/__tests__/evaluation.test.ts +++ b/app/client/src/workers/Evaluation/__tests__/evaluation.test.ts @@ -593,11 +593,12 @@ describe("DataTreeEvaluator", () => { ...configTree.Text1, }, }; - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - evaluator.setupUpdateTree(updatedUnEvalTree, updatedConfigTree); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedUnEvalTree, + updatedConfigTree, + ); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree, unEvalUpdates, ); @@ -629,11 +630,12 @@ describe("DataTreeEvaluator", () => { ["Text3.text"]: [], }; - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - evaluator.setupUpdateTree(updatedUnEvalTree, updatedConfigTree); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedUnEvalTree, + updatedConfigTree, + ); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree, unEvalUpdates, ); @@ -673,11 +675,12 @@ describe("DataTreeEvaluator", () => { "Input1.value": ["Input1.text"], }; - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - evaluator.setupUpdateTree(updatedUnEvalTree, updatedConfigTree); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedUnEvalTree, + updatedConfigTree, + ); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree, unEvalUpdates, ); @@ -733,12 +736,13 @@ describe("DataTreeEvaluator", () => { }, } as unknown as ConfigTree; const expectedDependencies = { ...initialdependencies }; - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - evaluator.setupUpdateTree(updatedUnEvalTree, updatedConfigTree); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedUnEvalTree, + updatedConfigTree, + ); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree, unEvalUpdates, ); @@ -774,11 +778,12 @@ describe("DataTreeEvaluator", () => { }, } as unknown as ConfigTree; - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - evaluator.setupUpdateTree(updatedUnEvalTree, updatedConfigTree); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedUnEvalTree, + updatedConfigTree, + ); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree, unEvalUpdates, ); @@ -836,12 +841,13 @@ describe("DataTreeEvaluator", () => { }, } as unknown as ConfigTree; - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - evaluator.setupUpdateTree(updatedUnEvalTree, updatedConfigTree); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedUnEvalTree, + updatedConfigTree, + ); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree, unEvalUpdates, ); @@ -906,14 +912,12 @@ describe("DataTreeEvaluator", () => { }, } as unknown as ConfigTree; - const { - evalOrder, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder2, - unEvalUpdates, - } = evaluator.setupUpdateTree(updatedTree1, updatedConfigTree1); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedTree1, + updatedConfigTree1, + ); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder2, updatedConfigTree1, unEvalUpdates, ); @@ -943,14 +947,10 @@ describe("DataTreeEvaluator", () => { }, }; - const { - evalOrder: newEvalOrder, - nonDynamicFieldValidationOrder, - unEvalUpdates: unEvalUpdates2, - } = evaluator.setupUpdateTree(updatedTree2, updatedConfigTree2); + const { evalOrder: newEvalOrder, unEvalUpdates: unEvalUpdates2 } = + evaluator.setupUpdateTree(updatedTree2, updatedConfigTree2); evaluator.evalAndValidateSubTree( newEvalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree2, unEvalUpdates2, ); @@ -986,14 +986,10 @@ describe("DataTreeEvaluator", () => { }, }; - const { - evalOrder: newEvalOrder2, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder3, - unEvalUpdates: unEvalUpdates3, - } = evaluator.setupUpdateTree(updatedTree3, updatedConfigTree3); + const { evalOrder: newEvalOrder2, unEvalUpdates: unEvalUpdates3 } = + evaluator.setupUpdateTree(updatedTree3, updatedConfigTree3); evaluator.evalAndValidateSubTree( newEvalOrder2, - nonDynamicFieldValidationOrder3, updatedConfigTree3, unEvalUpdates3, ); @@ -1026,12 +1022,13 @@ describe("DataTreeEvaluator", () => { ...configTree, TextX: configEntity, }; - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - evaluator.setupUpdateTree(updatedUnEvalTree, updatedConfigTree); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedUnEvalTree, + updatedConfigTree, + ); expect(evalOrder).toContain("TextX.text"); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree, unEvalUpdates, ); @@ -1060,13 +1057,14 @@ describe("DataTreeEvaluator", () => { ...configTree, TextY: configEntity, }; - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - evaluator.setupUpdateTree(updatedUnEvalTree, updatedConfigTree); + const { evalOrder, unEvalUpdates } = evaluator.setupUpdateTree( + updatedUnEvalTree, + updatedConfigTree, + ); expect(evalOrder).toContain("TextY.text"); expect(evalOrder.length).toBe(2); evaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, updatedConfigTree, unEvalUpdates, ); diff --git a/app/client/src/workers/Evaluation/evalTreeWithChanges.ts b/app/client/src/workers/Evaluation/evalTreeWithChanges.ts index 413840c1e07f..6b3a717a60ec 100644 --- a/app/client/src/workers/Evaluation/evalTreeWithChanges.ts +++ b/app/client/src/workers/Evaluation/evalTreeWithChanges.ts @@ -20,10 +20,8 @@ export function evalTreeWithChanges( metaUpdates: EvalMetaUpdates = [], ) { let evalOrder: string[] = []; - let reValidatedPaths: string[] = []; let jsUpdates: Record<string, JSUpdate> = {}; let unEvalUpdates: DataTreeDiff[] = []; - let nonDynamicFieldValidationOrder: string[] = []; const isCreateFirstTree = false; let dataTree: DataTree = {}; const errors: EvalError[] = []; @@ -43,17 +41,12 @@ export function evalTreeWithChanges( unEvalUpdates = setupUpdateTreeResponse.unEvalUpdates; jsUpdates = setupUpdateTreeResponse.jsUpdates; - nonDynamicFieldValidationOrder = - setupUpdateTreeResponse.nonDynamicFieldValidationOrder; const updateResponse = dataTreeEvaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, dataTreeEvaluator.oldConfigTree, unEvalUpdates, ); - reValidatedPaths = updateResponse.reValidatedPaths; - dataTree = makeEntityConfigsAsObjProperties(dataTreeEvaluator.evalTree, { evalProps: dataTreeEvaluator.evalProps, identicalEvalPathsPatches: @@ -80,7 +73,6 @@ export function evalTreeWithChanges( errors, evalMetaUpdates, evaluationOrder: evalOrder, - reValidatedPaths, jsUpdates, logs, unEvalUpdates, diff --git a/app/client/src/workers/Evaluation/handlers/evalTree.ts b/app/client/src/workers/Evaluation/handlers/evalTree.ts index 4d8a58853d6e..58d1c4e6299a 100644 --- a/app/client/src/workers/Evaluation/handlers/evalTree.ts +++ b/app/client/src/workers/Evaluation/handlers/evalTree.ts @@ -32,10 +32,8 @@ export const CANVAS = "canvas"; export default function (request: EvalWorkerSyncRequest) { const { data } = request; let evalOrder: string[] = []; - let reValidatedPaths: string[] = []; let jsUpdates: Record<string, JSUpdate> = {}; let unEvalUpdates: DataTreeDiff[] = []; - let nonDynamicFieldValidationOrder: string[] = []; let isCreateFirstTree = false; let dataTree: DataTree = {}; let errors: EvalError[] = []; @@ -143,19 +141,13 @@ export default function (request: EvalWorkerSyncRequest) { removedPaths = setupUpdateTreeResponse.removedPaths; isNewWidgetAdded = setupUpdateTreeResponse.isNewWidgetAdded; - nonDynamicFieldValidationOrder = - setupUpdateTreeResponse.nonDynamicFieldValidationOrder; - const updateResponse = dataTreeEvaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, configTree, unEvalUpdates, Object.keys(metaWidgets), ); - reValidatedPaths = updateResponse.reValidatedPaths; - dataTree = makeEntityConfigsAsObjProperties(dataTreeEvaluator.evalTree, { evalProps: dataTreeEvaluator.evalProps, identicalEvalPathsPatches: @@ -216,7 +208,6 @@ export default function (request: EvalWorkerSyncRequest) { errors, evalMetaUpdates, evaluationOrder: evalOrder, - reValidatedPaths, jsUpdates, logs, unEvalUpdates, diff --git a/app/client/src/workers/Evaluation/handlers/evalTrigger.ts b/app/client/src/workers/Evaluation/handlers/evalTrigger.ts index 8970a242ca54..dd426c5bb27c 100644 --- a/app/client/src/workers/Evaluation/handlers/evalTrigger.ts +++ b/app/client/src/workers/Evaluation/handlers/evalTrigger.ts @@ -18,15 +18,13 @@ export default async function (request: EvalWorkerASyncRequest) { ExecutionMetaData.setExecutionMetaData({ triggerMeta, eventType }); - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - dataTreeEvaluator.setupUpdateTree( - unEvalTree.unEvalTree, - unEvalTree.configTree, - ); + const { evalOrder, unEvalUpdates } = dataTreeEvaluator.setupUpdateTree( + unEvalTree.unEvalTree, + unEvalTree.configTree, + ); const { contextTree } = dataTreeEvaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, unEvalTree.configTree, unEvalUpdates, ); diff --git a/app/client/src/workers/Evaluation/types.ts b/app/client/src/workers/Evaluation/types.ts index d416e8735b02..ac3de6e51953 100644 --- a/app/client/src/workers/Evaluation/types.ts +++ b/app/client/src/workers/Evaluation/types.ts @@ -48,7 +48,6 @@ export interface EvalTreeResponseData { errors: EvalError[]; evalMetaUpdates: EvalMetaUpdates; evaluationOrder: string[]; - reValidatedPaths: string[]; jsUpdates: Record<string, JSUpdate>; logs: unknown[]; unEvalUpdates: DataTreeDiff[]; diff --git a/app/client/src/workers/common/DataTreeEvaluator/index.ts b/app/client/src/workers/common/DataTreeEvaluator/index.ts index 5537034ea595..95087fc9bb2f 100644 --- a/app/client/src/workers/common/DataTreeEvaluator/index.ts +++ b/app/client/src/workers/common/DataTreeEvaluator/index.ts @@ -112,10 +112,10 @@ import { import { getFixedTimeDifference, replaceThisDotParams } from "./utils"; import { isJSObjectFunction } from "workers/Evaluation/JSObject/utils"; import { - getValidatedTree, setToEvalPathsIdenticalToState, validateActionProperty, validateAndParseWidgetProperty, + validateWidgetProperty, } from "./validationUtils"; import { errorModifier } from "workers/Evaluation/errorModifier"; import JSObjectCollection from "workers/Evaluation/JSObject/Collection"; @@ -157,12 +157,6 @@ export default class DataTreeEvaluator { allActionValidationConfig?: { [actionId: string]: ActionValidationConfigMap; }; - /* - * Maintains dependency of paths to re-validate on evaluation of particular property path. - */ - validationDependencyMap: DependencyMap = new DependencyMap(); - validationDependencies: Record<string, string[]> = {}; - inverseValidationDependencies: Record<string, string[]> = {}; /** * Sanitized eval values and errors @@ -271,18 +265,15 @@ export default class DataTreeEvaluator { const allKeysGenerationEndTime = performance.now(); const createDependencyMapStartTime = performance.now(); - const { - dependencies, - inverseDependencies, - inverseValidationDependencies, - validationDependencies, - } = createDependencyMap(this, localUnEvalTree, configTree); + const { dependencies, inverseDependencies } = createDependencyMap( + this, + localUnEvalTree, + configTree, + ); const createDependencyMapEndTime = performance.now(); this.dependencies = dependencies; this.inverseDependencies = inverseDependencies; - this.validationDependencies = validationDependencies; - this.inverseValidationDependencies = inverseValidationDependencies; const sortDependenciesStartTime = performance.now(); this.sortedDependencies = this.sortDependencies(this.dependencyMap); @@ -325,8 +316,6 @@ export default class DataTreeEvaluator { timeTakenForSetupFirstTree, dependencies: this.dependencies, inverseDependencies: this.inverseDependencies, - validationDependencies: this.validationDependencies, - inverseValidationDependencies: this.inverseValidationDependencies, }); return { jsUpdates, @@ -334,6 +323,92 @@ export default class DataTreeEvaluator { }; } + /** + * Mutates the dataTree. + * Validates all the nodes of the tree to make sure all the values are as expected according to the validation config + * + * For example :- If Button.isDisabled is set to false in propertyPane then it would be passed as "false" in unEvalTree and validateTree method makes sure to convert it to boolean. + * @param tree + * @param option + * @param configTree + * @returns + */ + validatedTree( + dataTree: DataTree, + option: { + evalProps: EvalProps; + evalPathsIdenticalToState: EvalPathsIdenticalToState; + }, + configTree: ConfigTree, + ) { + const unParsedEvalTree = this.getUnParsedEvalTree(); + const { evalPathsIdenticalToState, evalProps } = option; + for (const [entityName, entity] of Object.entries(dataTree)) { + if (!isWidget(entity)) continue; + const entityConfig = configTree[entityName] as WidgetEntityConfig; + const validationPathsMap = Object.entries(entityConfig.validationPaths); + + for (const [propertyPath, validationConfig] of validationPathsMap) { + const fullPropertyPath = `${entityName}.${propertyPath}`; + + const value = get( + unParsedEvalTree, + fullPropertyPath, + get(entity, propertyPath), + ); + // Pass it through parse + const { isValid, messages, parsed, transformed } = + validateWidgetProperty(validationConfig, value, entity, propertyPath); + + set(entity, propertyPath, parsed); + + const evaluatedValue = isValid + ? parsed + : isUndefined(transformed) + ? value + : transformed; + + const isParsedValueTheSame = parsed === evaluatedValue; + + const evalPath = getEvalValuePath(fullPropertyPath, { + isPopulated: false, + fullPath: true, + }); + + setToEvalPathsIdenticalToState({ + evalPath, + evalPathsIdenticalToState, + evalProps, + isParsedValueTheSame, + fullPropertyPath, + value: evaluatedValue, + }); + + resetValidationErrorsForEntityProperty({ + evalProps, + fullPropertyPath, + }); + + if (!isValid) { + const evalErrors: EvaluationError[] = + messages?.map((message) => ({ + errorType: PropertyEvaluationErrorType.VALIDATION, + errorMessage: message ?? {}, + severity: Severity.ERROR, + raw: value, + })) ?? []; + + addErrorToEntityProperty({ + errors: evalErrors, + evalProps, + fullPropertyPath, + configTree, + }); + } + } + } + } + evalAndValidateFirstTree(): { evalTree: DataTree; evalMetaUpdates: EvalMetaUpdates; @@ -352,32 +427,29 @@ export default class DataTreeEvaluator { this.oldConfigTree, ); - const evaluationEndTime = performance.now(); - const validationStartTime = performance.now(); - - const validatedEvalTree = getValidatedTree( + /** + * We need to re-validate all widgets only in case of first tree + * Widget fields with custom validation functions can depend on other properties of the widget, + * which aren't evaluated/validated yet, thereby store incorrect validation errors in the previous step + */ + this.validatedTree( evaluatedTree, { evalProps: this.evalProps, evalPathsIdenticalToState: this.evalPathsIdenticalToState, - pathsValidated: evaluationOrder, }, this.oldConfigTree, ); - const validationEndTime = performance.now(); + const evaluationEndTime = performance.now(); - this.setEvalTree(validatedEvalTree); + this.setEvalTree(evaluatedTree); const timeTakenForEvalAndValidateFirstTree = { evaluation: getFixedTimeDifference( evaluationEndTime, evaluationStartTime, ), - validation: getFixedTimeDifference( - validationEndTime, - validationStartTime, - ), }; this.logs.push({ timeTakenForEvalAndValidateFirstTree }); @@ -419,7 +491,6 @@ export default class DataTreeEvaluator { unEvalUpdates: DataTreeDiff[]; evalOrder: string[]; jsUpdates: Record<string, JSUpdate>; - nonDynamicFieldValidationOrder: string[]; removedPaths: Array<{ entityId: string; fullpath: string }>; isNewWidgetAdded: boolean; } { @@ -496,7 +567,6 @@ export default class DataTreeEvaluator { unEvalUpdates: [], evalOrder: [], jsUpdates: {}, - nonDynamicFieldValidationOrder: [], isNewWidgetAdded: false, }; } @@ -535,9 +605,7 @@ export default class DataTreeEvaluator { dependencies, dependenciesOfRemovedPaths, inverseDependencies, - inverseValidationDependencies, removedPaths, - validationDependencies, } = updateDependencyMap({ configTree, dataTreeEvalRef: this, @@ -547,9 +615,7 @@ export default class DataTreeEvaluator { const updateDependencyEndTime = performance.now(); this.dependencies = dependencies; - this.validationDependencies = validationDependencies; this.inverseDependencies = inverseDependencies; - this.inverseValidationDependencies = inverseValidationDependencies; this.updateEvalTreeWithChanges({ differences }); @@ -604,24 +670,11 @@ export default class DataTreeEvaluator { }) { // Remove anything from the sort order that is not a dynamic leaf since only those need evaluation const evaluationOrder: string[] = []; - let nonDynamicFieldValidationOrderSet = new Set<string>(); for (const fullPath of subTreeSortOrder) { if (pathsToSkipFromEval.includes(fullPath)) continue; - if (!isDynamicLeaf(localUnEvalTree, fullPath, configTree)) { - /** - * Store fullPath in nonDynamicFieldValidationOrderSet, - * if the non dynamic value changes to trigger revalidation. - */ - if (this.inverseValidationDependencies[fullPath]) { - nonDynamicFieldValidationOrderSet = new Set([ - ...nonDynamicFieldValidationOrderSet, - fullPath, - ]); - } - continue; - } + if (!isDynamicLeaf(localUnEvalTree, fullPath, configTree)) continue; const unEvalPropValue = get(localUnEvalTree, fullPath); const evalPropValue = get(this.evalTree, fullPath); @@ -631,7 +684,7 @@ export default class DataTreeEvaluator { set(this.evalTree, fullPath, unEvalPropValue); } - return { evaluationOrder, nonDynamicFieldValidationOrderSet }; + return { evaluationOrder }; } setupTree( @@ -673,21 +726,18 @@ export default class DataTreeEvaluator { ); const calculateSortOrderEndTime = performance.now(); - const { evaluationOrder, nonDynamicFieldValidationOrderSet } = - this.getEvaluationOrder({ - localUnEvalTree, - pathsToSkipFromEval, - subTreeSortOrder, - configTree, - }); + const { evaluationOrder } = this.getEvaluationOrder({ + localUnEvalTree, + pathsToSkipFromEval, + subTreeSortOrder, + configTree, + }); this.logs.push({ sortedDependencies: this.sortedDependencies, inverseDependencies: this.inverseDependencies, updatedDependencies: this.dependencies, evaluationOrder: evaluationOrder, - updatedValidationDependencies: this.validationDependencies, - inverseValidationDependencies: this.inverseValidationDependencies, }); // Remove any deleted paths from the eval tree @@ -723,9 +773,6 @@ export default class DataTreeEvaluator { return { unEvalUpdates: translatedDiffs, evalOrder: evaluationOrder, - nonDynamicFieldValidationOrder: Array.from( - nonDynamicFieldValidationOrderSet, - ), removedPaths, isNewWidgetAdded, }; @@ -741,7 +788,6 @@ export default class DataTreeEvaluator { unEvalUpdates: [], evalOrder: [], jsUpdates: {}, - nonDynamicFieldValidationOrder: [], removedPaths: [], isNewWidgetAdded: false, }; @@ -769,14 +815,12 @@ export default class DataTreeEvaluator { evalAndValidateSubTree( evaluationOrder: string[], - nonDynamicFieldValidationOrder: string[], configTree: ConfigTree, unevalUpdates: DataTreeDiff[], metaWidgetIds: string[] = [], ): { evalMetaUpdates: EvalMetaUpdates; staleMetaIds: string[]; - reValidatedPaths: string[]; contextTree: DataTree; } { const evaluationStartTime = performance.now(); @@ -800,32 +844,16 @@ export default class DataTreeEvaluator { this.setEvalTree(newEvalTree); - const reValidateStartTime = performance.now(); - - const pathsChanged = new Set([ - ...evaluationOrder, - ...nonDynamicFieldValidationOrder, - ]); - const pathsToValidate = this.getPathsToValidate([...pathsChanged]); - this.validateEvalDependentPaths(pathsToValidate); - - const reValidateEndTime = performance.now(); - const timeTakenForEvalAndValidateSubTree = { evaluation: getFixedTimeDifference( evaluationEndTime, evaluationStartTime, ), - revalidation: getFixedTimeDifference( - reValidateEndTime, - reValidateStartTime, - ), }; this.logs.push({ timeTakenForEvalAndValidateSubTree }); return { evalMetaUpdates, staleMetaIds, - reValidatedPaths: pathsToValidate, contextTree, }; } @@ -1536,51 +1564,6 @@ export default class DataTreeEvaluator { return parsedValue; } - validateEntityDependentProperty({ - fullPropertyPath, - }: { - fullPropertyPath: string; - }) { - const evalTree = this.getEvalTree(); - const configTree = this.getConfigTree(); - const { entityName } = getEntityNameAndPropertyPath(fullPropertyPath); - const entity = evalTree[entityName]; - - validateAndParseWidgetProperty({ - fullPropertyPath, - widget: entity as WidgetEntity, - configTree, - // we supply non-transformed evaluated value - evalPropertyValue: get(this.getUnParsedEvalTree(), fullPropertyPath), - unEvalPropertyValue: get( - this.oldUnEvalTree, - fullPropertyPath, - ) as unknown as string, - evalProps: this.evalProps, - evalPathsIdenticalToState: this.evalPathsIdenticalToState, - }); - } - - getPathsToValidate(pathsEvaluated: string[]) { - const pathsToValidate = new Set<string>(); - pathsEvaluated.forEach((fullPropertyPath) => { - if (this.inverseValidationDependencies[fullPropertyPath]) { - const pathsToRevalidate = - this.inverseValidationDependencies[fullPropertyPath]; - pathsToRevalidate.forEach((path) => pathsToValidate.add(path)); - } - }); - return [...pathsToValidate]; - } - - validateEvalDependentPaths(pathsToValidate: string[]) { - pathsToValidate.forEach((fullPropertyPath) => { - this.validateEntityDependentProperty({ - fullPropertyPath, - }); - }); - } - // validates the user input saved as action property based on a validationConfig validateActionProperty( fullPropertyPath: string, diff --git a/app/client/src/workers/common/DataTreeEvaluator/mockData/mockConfigTree.ts b/app/client/src/workers/common/DataTreeEvaluator/mockData/mockConfigTree.ts index a0fc305a73e3..6708256dddf8 100644 --- a/app/client/src/workers/common/DataTreeEvaluator/mockData/mockConfigTree.ts +++ b/app/client/src/workers/common/DataTreeEvaluator/mockData/mockConfigTree.ts @@ -315,7 +315,6 @@ export const unEvalTreeWidgetSelectWidgetConfig = { fnString: 'function defaultOptionValueValidation(value, props, _) {\n var isValid;\n var parsed;\n var message = "";\n var isServerSideFiltered = props.serverSideFiltering; // TODO: validation of defaultOption is dependent on serverSideFiltering and options, this property should reValidated once the dependencies change\n //this issue is been tracked here https://github.com/appsmithorg/appsmith/issues/15303\n\n var options = props.options;\n /*\n * Function to check if the object has `label` and `value`\n */\n\n var hasLabelValue = function hasLabelValue(obj) {\n return _.isPlainObject(value) && obj.hasOwnProperty("label") && obj.hasOwnProperty("value") && _.isString(obj.label) && (_.isString(obj.value) || _.isFinite(obj.value));\n };\n /*\n * When value is "{label: \'green\', value: \'green\'}"\n */\n\n\n if (typeof value === "string") {\n try {\n var parsedValue = JSON.parse(value);\n\n if (_.isObject(parsedValue)) {\n value = parsedValue;\n }\n } catch (e) {}\n }\n\n if (_.isString(value) || _.isFinite(value) || hasLabelValue(value)) {\n /*\n * When value is "", "green", 444, {label: "green", value: "green"}\n */\n isValid = true;\n parsed = value;\n } else {\n isValid = false;\n parsed = undefined;\n message = \'value does not evaluate to type: string | number | { "label": "label1", "value": "value1" }\';\n }\n\n if (isValid && !_.isNil(parsed) && parsed !== "") {\n if (!Array.isArray(options) && typeof options === "string") {\n try {\n var parsedOptions = JSON.parse(options);\n\n if (Array.isArray(parsedOptions)) {\n options = parsedOptions;\n } else {\n options = [];\n }\n } catch (e) {\n options = [];\n }\n }\n\n var _parsedValue = parsed.hasOwnProperty("value") ? parsed.value : parsed;\n\n var valueIndex = _.findIndex(options, function (option) {\n return option.value === _parsedValue;\n });\n\n if (valueIndex === -1) {\n if (!isServerSideFiltered) {\n isValid = false;\n message = "Default value is missing in options. Please update the value.";\n } else {\n if (!hasLabelValue(parsed)) {\n isValid = false;\n message = "Default value is missing in options. Please use {label : <string | num>, value : < string | num>} format to show default for server side data.";\n }\n }\n }\n }\n\n return {\n isValid: isValid,\n parsed: parsed,\n messages: [message]\n };\n}', }, - dependentPaths: ["serverSideFiltering", "options"], }, labelText: { type: "TEXT", diff --git a/app/client/src/workers/common/DataTreeEvaluator/test.ts b/app/client/src/workers/common/DataTreeEvaluator/test.ts index f62265925cb5..541143fb1bc9 100644 --- a/app/client/src/workers/common/DataTreeEvaluator/test.ts +++ b/app/client/src/workers/common/DataTreeEvaluator/test.ts @@ -151,14 +151,12 @@ describe("DataTreeEvaluator", () => { }); it("initial dependencyMap computation", () => { - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - dataTreeEvaluator.setupUpdateTree( - unEvalTree as unknown as DataTree, - configTree as unknown as ConfigTree, - ); + const { evalOrder, unEvalUpdates } = dataTreeEvaluator.setupUpdateTree( + unEvalTree as unknown as DataTree, + configTree as unknown as ConfigTree, + ); dataTreeEvaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder, configTree as unknown as ConfigTree, unEvalUpdates, ); @@ -250,17 +248,13 @@ describe("DataTreeEvaluator", () => { // cyclic dependency case for (let i = 0; i < 2; i++) { // success: response -> [{...}, {...}, {...}] - const { - evalOrder, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder1, - unEvalUpdates, - } = dataTreeEvaluator.setupUpdateTree( - arrayAccessorCyclicDependency.apiSuccessUnEvalTree, - arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, - ); + const { evalOrder, unEvalUpdates } = + dataTreeEvaluator.setupUpdateTree( + arrayAccessorCyclicDependency.apiSuccessUnEvalTree, + arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, + ); dataTreeEvaluator.evalAndValidateSubTree( evalOrder, - nonDynamicFieldValidationOrder1, arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, unEvalUpdates, ); @@ -278,17 +272,13 @@ describe("DataTreeEvaluator", () => { ]); // failure: response -> {} - const { - evalOrder: order, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder2, - unEvalUpdates: unEvalUpdates2, - } = dataTreeEvaluator.setupUpdateTree( - arrayAccessorCyclicDependency.apiFailureUnEvalTree, - arrayAccessorCyclicDependencyConfig.apiFailureConfigTree, - ); + const { evalOrder: order, unEvalUpdates: unEvalUpdates2 } = + dataTreeEvaluator.setupUpdateTree( + arrayAccessorCyclicDependency.apiFailureUnEvalTree, + arrayAccessorCyclicDependencyConfig.apiFailureConfigTree, + ); dataTreeEvaluator.evalAndValidateSubTree( order, - nonDynamicFieldValidationOrder2, arrayAccessorCyclicDependencyConfig.apiFailureConfigTree, unEvalUpdates2, ); @@ -309,33 +299,25 @@ describe("DataTreeEvaluator", () => { // when Text1.text has a binding Api1.data[2].id it("on API response array length change", () => { // success: response -> [{...}, {...}, {...}] - const { - evalOrder: order1, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder3, - unEvalUpdates, - } = dataTreeEvaluator.setupUpdateTree( - arrayAccessorCyclicDependency.apiSuccessUnEvalTree, - arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, - ); + const { evalOrder: order1, unEvalUpdates } = + dataTreeEvaluator.setupUpdateTree( + arrayAccessorCyclicDependency.apiSuccessUnEvalTree, + arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, + ); dataTreeEvaluator.evalAndValidateSubTree( order1, - nonDynamicFieldValidationOrder3, arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, unEvalUpdates, ); // success: response -> [{...}, {...}] - const { - evalOrder: order2, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder4, - unEvalUpdates: unEvalUpdates2, - } = dataTreeEvaluator.setupUpdateTree( - arrayAccessorCyclicDependency.apiSuccessUnEvalTree2, - arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree2, - ); + const { evalOrder: order2, unEvalUpdates: unEvalUpdates2 } = + dataTreeEvaluator.setupUpdateTree( + arrayAccessorCyclicDependency.apiSuccessUnEvalTree2, + arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree2, + ); dataTreeEvaluator.evalAndValidateSubTree( order2, - nonDynamicFieldValidationOrder4, arrayAccessorCyclicDependencyConfig.apiSuccessConfigTree2, unEvalUpdates2, ); @@ -357,17 +339,13 @@ describe("DataTreeEvaluator", () => { // cyclic dependency case for (let i = 0; i < 2; i++) { // success: response -> [ [{...}, {...}, {...}], [{...}, {...}, {...}], [{...}, {...}, {...}] ] - const { - evalOrder: order, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder5, - unEvalUpdates, - } = dataTreeEvaluator.setupUpdateTree( - nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree, - nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, - ); + const { evalOrder: order, unEvalUpdates } = + dataTreeEvaluator.setupUpdateTree( + nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree, + nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, + ); dataTreeEvaluator.evalAndValidateSubTree( order, - nonDynamicFieldValidationOrder5, nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, unEvalUpdates, ); @@ -388,17 +366,13 @@ describe("DataTreeEvaluator", () => { ]); // failure: response -> {} - const { - evalOrder: order1, - nonDynamicFieldValidationOrder, - unEvalUpdates: unEvalUpdates2, - } = dataTreeEvaluator.setupUpdateTree( - nestedArrayAccessorCyclicDependency.apiFailureUnEvalTree, - nestedArrayAccessorCyclicDependencyConfig.apiFailureConfigTree, - ); + const { evalOrder: order1, unEvalUpdates: unEvalUpdates2 } = + dataTreeEvaluator.setupUpdateTree( + nestedArrayAccessorCyclicDependency.apiFailureUnEvalTree, + nestedArrayAccessorCyclicDependencyConfig.apiFailureConfigTree, + ); dataTreeEvaluator.evalAndValidateSubTree( order1, - nonDynamicFieldValidationOrder, nestedArrayAccessorCyclicDependencyConfig.apiFailureConfigTree, unEvalUpdates2, ); @@ -421,33 +395,25 @@ describe("DataTreeEvaluator", () => { // when Text1.text has a binding Api1.data[2][2].id it("on API response array length change", () => { // success: response -> [ [{...}, {...}, {...}], [{...}, {...}, {...}], [{...}, {...}, {...}] ] - const { - evalOrder: order, - nonDynamicFieldValidationOrder, - unEvalUpdates, - } = dataTreeEvaluator.setupUpdateTree( - nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree, - nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, - ); + const { evalOrder: order, unEvalUpdates } = + dataTreeEvaluator.setupUpdateTree( + nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree, + nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, + ); dataTreeEvaluator.evalAndValidateSubTree( order, - nonDynamicFieldValidationOrder, nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, unEvalUpdates, ); // success: response -> [ [{...}, {...}, {...}], [{...}, {...}, {...}] ] - const { - evalOrder: order1, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder2, - unEvalUpdates: unEvalUpdates2, - } = dataTreeEvaluator.setupUpdateTree( - nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree2, - nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree2, - ); + const { evalOrder: order1, unEvalUpdates: unEvalUpdates2 } = + dataTreeEvaluator.setupUpdateTree( + nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree2, + nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree2, + ); dataTreeEvaluator.evalAndValidateSubTree( order1, - nonDynamicFieldValidationOrder2, nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree2, unEvalUpdates2, ); @@ -468,33 +434,25 @@ describe("DataTreeEvaluator", () => { // when Text1.text has a binding Api1.data[2][2].id it("on API response nested array length change", () => { // success: response -> [ [{...}, {...}, {...}], [{...}, {...}, {...}], [{...}, {...}, {...}] ] - const { - evalOrder: order, - nonDynamicFieldValidationOrder: nonDynamicFieldValidationOrder2, - unEvalUpdates, - } = dataTreeEvaluator.setupUpdateTree( - nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree, - nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, - ); + const { evalOrder: order, unEvalUpdates } = + dataTreeEvaluator.setupUpdateTree( + nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree, + nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, + ); dataTreeEvaluator.evalAndValidateSubTree( order, - nonDynamicFieldValidationOrder2, nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree, unEvalUpdates, ); // success: response -> [ [{...}, {...}, {...}], [{...}, {...}, {...}], [] ] - const { - evalOrder: order1, - nonDynamicFieldValidationOrder, - unEvalUpdates: unEvalUpdates2, - } = dataTreeEvaluator.setupUpdateTree( - nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree3, - nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree3, - ); + const { evalOrder: order1, unEvalUpdates: unEvalUpdates2 } = + dataTreeEvaluator.setupUpdateTree( + nestedArrayAccessorCyclicDependency.apiSuccessUnEvalTree3, + nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree3, + ); dataTreeEvaluator.evalAndValidateSubTree( order1, - nonDynamicFieldValidationOrder, nestedArrayAccessorCyclicDependencyConfig.apiSuccessConfigTree3, unEvalUpdates2, ); diff --git a/app/client/src/workers/common/DataTreeEvaluator/validationUtils.ts b/app/client/src/workers/common/DataTreeEvaluator/validationUtils.ts index dac11271d689..0e6835b99fcd 100644 --- a/app/client/src/workers/common/DataTreeEvaluator/validationUtils.ts +++ b/app/client/src/workers/common/DataTreeEvaluator/validationUtils.ts @@ -4,8 +4,8 @@ import type { WidgetEntity, WidgetEntityConfig, } from "@appsmith/entities/DataTree/types"; -import type { ConfigTree, DataTree } from "entities/DataTree/dataTreeTypes"; -import { get, isObject, isUndefined, set } from "lodash"; +import type { ConfigTree } from "entities/DataTree/dataTreeTypes"; +import { isObject, isUndefined, set } from "lodash"; import type { EvaluationError } from "utils/DynamicBindingUtils"; import { getEvalValuePath, @@ -15,7 +15,6 @@ import { import { addErrorToEntityProperty, getEntityNameAndPropertyPath, - isWidget, resetValidationErrorsForEntityProperty, } from "@appsmith/workers/Evaluation/evaluationUtils"; import { validate } from "workers/Evaluation/validations"; @@ -106,7 +105,7 @@ export function validateAndParseWidgetProperty({ messages?.map((message) => { return { raw: unEvalPropertyValue, - errorMessage: message || "", + errorMessage: message || {}, errorType: PropertyEvaluationErrorType.VALIDATION, severity: Severity.ERROR, }; @@ -165,93 +164,3 @@ export function validateActionProperty( } return validate(config, value, {}, ""); } -/** - * Validates all the nodes of the tree to make sure all the values are as expected according to the validation config - * - * For example :- If Button.isDisabled is set to false in propertyPane then it would be passed as "false" in unEvalTree and validateTree method makes sure to convert it to boolean. - * @param tree - * @param option - * @param configTree - * @returns - */ -export function getValidatedTree( - dataTree: DataTree, - option: { - evalProps: EvalProps; - evalPathsIdenticalToState: EvalPathsIdenticalToState; - pathsValidated: string[]; - }, - configTree: ConfigTree, -) { - const { evalPathsIdenticalToState, evalProps, pathsValidated } = option; - for (const [entityName, entity] of Object.entries(dataTree)) { - if (!isWidget(entity)) { - continue; - } - const entityConfig = configTree[entityName] as WidgetEntityConfig; - - const validationPathsMap = Object.entries(entityConfig.validationPaths); - - for (const [propertyPath, validationConfig] of validationPathsMap) { - const fullPropertyPath = `${entityName}.${propertyPath}`; - - if (pathsValidated.includes(fullPropertyPath)) continue; - - const value = get(entity, propertyPath); - // Pass it through parse - const { isValid, messages, parsed, transformed } = validateWidgetProperty( - validationConfig, - value, - entity, - propertyPath, - ); - - set(entity, propertyPath, parsed); - - const evaluatedValue = isValid - ? parsed - : isUndefined(transformed) - ? value - : transformed; - - const isParsedValueTheSame = parsed === evaluatedValue; - - const evalPath = getEvalValuePath(fullPropertyPath, { - isPopulated: false, - fullPath: true, - }); - - setToEvalPathsIdenticalToState({ - evalPath, - evalPathsIdenticalToState, - evalProps, - isParsedValueTheSame, - fullPropertyPath, - value: evaluatedValue, - }); - - resetValidationErrorsForEntityProperty({ - evalProps, - fullPropertyPath, - }); - - if (!isValid) { - const evalErrors: EvaluationError[] = - messages?.map((message) => ({ - errorType: PropertyEvaluationErrorType.VALIDATION, - errorMessage: message, - severity: Severity.ERROR, - raw: value, - })) ?? []; - - addErrorToEntityProperty({ - errors: evalErrors, - evalProps, - fullPropertyPath, - configTree, - }); - } - } - } - return dataTree; -} diff --git a/app/client/src/workers/common/DependencyMap/index.ts b/app/client/src/workers/common/DependencyMap/index.ts index 0e0a9a550525..bddff7f9ece2 100644 --- a/app/client/src/workers/common/DependencyMap/index.ts +++ b/app/client/src/workers/common/DependencyMap/index.ts @@ -2,13 +2,11 @@ import type { DataTreeDiff } from "@appsmith/workers/Evaluation/evaluationUtils" import { getAllPaths, DataTreeDiffEvent, - isWidget, getEntityNameAndPropertyPath, isDynamicLeaf, } from "@appsmith/workers/Evaluation/evaluationUtils"; import type { WidgetEntity, - WidgetEntityConfig, ActionEntity, JSActionEntity, DataTreeEntityObject, @@ -23,7 +21,6 @@ import { getEntityDependencies, getEntityPathDependencies, } from "./utils/getEntityDependencies"; -import { getValidationDependencies } from "./utils/getValidationDependencies"; import { DependencyMapUtils } from "entities/DependencyMap/DependencyMapUtils"; import { AppsmithFunctionsWithFields } from "components/editorComponents/ActionCreator/constants"; import { @@ -33,19 +30,12 @@ import { import { isWidgetActionOrJsObject } from "@appsmith/entities/DataTree/utils"; import { getValidEntityType } from "workers/common/DataTreeEvaluator/utils"; -interface CreateDependencyMap { - dependencies: Record<string, string[]>; - validationDependencies: Record<string, string[]>; - inverseDependencies: Record<string, string[]>; - inverseValidationDependencies: Record<string, string[]>; -} - export function createDependencyMap( dataTreeEvalRef: DataTreeEvaluator, unEvalTree: DataTree, configTree: ConfigTree, -): CreateDependencyMap { - const { allKeys, dependencyMap, validationDependencyMap } = dataTreeEvalRef; +) { + const { allKeys, dependencyMap } = dataTreeEvalRef; const allAppsmithInternalFunctions = convertArrayToObject( AppsmithFunctionsWithFields, ); @@ -54,7 +44,6 @@ export function createDependencyMap( { ...allKeys, ...allAppsmithInternalFunctions, ...setterFunctions }, false, ); - validationDependencyMap.addNodes(allKeys, false); Object.keys(configTree).forEach((entityName) => { const entity = unEvalTree[entityName]; @@ -74,35 +63,16 @@ export function createDependencyMap( dependencyMap.addDependency(path, references); dataTreeEvalRef.errors.push(...errors); } - - const validationDependencies = getValidationDependencies( - entity, - entityName, - entityConfig as WidgetEntityConfig, - ); - for (const path of Object.keys(validationDependencies)) { - validationDependencyMap.addDependency(path, validationDependencies[path]); - } }); DependencyMapUtils.makeParentsDependOnChildren(dependencyMap); return { dependencies: dependencyMap.dependencies, - validationDependencies: validationDependencyMap.dependencies, inverseDependencies: dependencyMap.inverseDependencies, - inverseValidationDependencies: validationDependencyMap.inverseDependencies, }; } -interface UpdateDependencyMap { - dependenciesOfRemovedPaths: string[]; - removedPaths: Array<{ entityId: string; fullpath: string }>; - dependencies: Record<string, string[]>; - validationDependencies: Record<string, string[]>; - inverseDependencies: Record<string, string[]>; - inverseValidationDependencies: Record<string, string[]>; -} export const updateDependencyMap = ({ configTree, dataTreeEvalRef, @@ -113,18 +83,13 @@ export const updateDependencyMap = ({ translatedDiffs: Array<DataTreeDiff>; unEvalDataTree: DataTree; configTree: ConfigTree; -}): UpdateDependencyMap => { +}) => { const diffCalcStart = performance.now(); const dependenciesOfRemovedPaths: Array<string> = []; const removedPaths: Array<{ entityId: string; fullpath: string }> = []; let didUpdateDependencyMap = false; - const { - allKeys, - dependencyMap, - oldConfigTree, - oldUnEvalTree, - validationDependencyMap, - } = dataTreeEvalRef; + const { allKeys, dependencyMap, oldConfigTree, oldUnEvalTree } = + dataTreeEvalRef; let { errors: dataTreeEvalErrors } = dataTreeEvalRef; translatedDiffs.forEach((dataTreeDiff) => { @@ -159,7 +124,6 @@ export const updateDependencyMap = ({ } const didUpdateDep = dependencyMap.addNodes(allAddedPaths, false); - validationDependencyMap.addNodes(allAddedPaths); if (didUpdateDep) didUpdateDependencyMap = true; @@ -185,21 +149,6 @@ export const updateDependencyMap = ({ }, ); } - if (isWidget(entity)) { - // For widgets, - // we need to update the validation dependencyMap - const validationDependencies = getValidationDependencies( - entity, - entityName, - entityConfig as WidgetEntityConfig, - ); - for (const path of Object.keys(validationDependencies)) { - validationDependencyMap.addDependency( - path, - validationDependencies[path], - ); - } - } } else { const entityPathDependencies = getEntityPathDependencies( entity, @@ -214,20 +163,6 @@ export const updateDependencyMap = ({ dataTreeEvalErrors = dataTreeEvalErrors.concat( extractDependencyErrors, ); - - if (isWidget(entity)) { - const validationDependencies = getValidationDependencies( - entity, - entityName, - entityConfig as WidgetEntityConfig, - ); - for (const path of Object.keys(validationDependencies)) { - validationDependencyMap.addDependency( - path, - validationDependencies[path], - ); - } - } } } break; @@ -251,7 +186,6 @@ export const updateDependencyMap = ({ } const didUpdateDeps = dependencyMap.removeNodes(allDeletedPaths); - validationDependencyMap.removeNodes(allDeletedPaths); if (didUpdateDeps) didUpdateDependencyMap = true; @@ -330,8 +264,6 @@ export const updateDependencyMap = ({ dependenciesOfRemovedPaths, removedPaths, dependencies: dependencyMap.dependencies, - validationDependencies: validationDependencyMap.dependencies, inverseDependencies: dependencyMap.inverseDependencies, - inverseValidationDependencies: validationDependencyMap.inverseDependencies, }; }; diff --git a/app/client/src/workers/common/DependencyMap/test.ts b/app/client/src/workers/common/DependencyMap/test.ts index 3bb6b933a893..a921561bdaa8 100644 --- a/app/client/src/workers/common/DependencyMap/test.ts +++ b/app/client/src/workers/common/DependencyMap/test.ts @@ -1,20 +1,9 @@ -import DataTreeEvaluator from "workers/common/DataTreeEvaluator"; -import { - unEvalTree, - unEvalTreeWidgetSelectWidget, -} from "workers/common/DataTreeEvaluator/mockData/mockUnEvalTree"; import ButtonWidget from "widgets/ButtonWidget"; import SelectWidget from "widgets/SelectWidget"; import type { WidgetEntity, DataTreeEntityConfig, } from "@appsmith/entities/DataTree/types"; -import type { DataTree, ConfigTree } from "entities/DataTree/dataTreeTypes"; -import { - unEvalTreeWidgetSelectWidgetConfig, - configTree, -} from "workers/common/DataTreeEvaluator/mockData/mockConfigTree"; - import { getEntityPathDependencies } from "./utils/getEntityDependencies"; import type BaseWidget from "widgets/BaseWidget"; @@ -33,48 +22,6 @@ const widgetConfigMap = {}; } }); -const dataTreeEvaluator = new DataTreeEvaluator(widgetConfigMap); - -describe("test validationDependencyMap", () => { - beforeAll(() => { - dataTreeEvaluator.setupFirstTree( - unEvalTreeWidgetSelectWidget as unknown as DataTree, - unEvalTreeWidgetSelectWidgetConfig as unknown as ConfigTree, - ); - dataTreeEvaluator.evalAndValidateFirstTree(); - }); - - it("initial validation dependencyMap computation", () => { - expect( - dataTreeEvaluator.validationDependencyMap.dependencies, - ).toStrictEqual({ - "Select2.defaultOptionValue": [ - "Select2.serverSideFiltering", - "Select2.options", - ], - }); - }); - - it("update validation dependencyMap computation", () => { - const { evalOrder, nonDynamicFieldValidationOrder, unEvalUpdates } = - dataTreeEvaluator.setupUpdateTree( - unEvalTree as unknown as DataTree, - configTree as unknown as ConfigTree, - ); - - dataTreeEvaluator.evalAndValidateSubTree( - evalOrder, - nonDynamicFieldValidationOrder, - configTree as unknown as ConfigTree, - unEvalUpdates, - ); - - expect( - dataTreeEvaluator.validationDependencyMap.dependencies, - ).toStrictEqual({}); - }); -}); - describe("DependencyMap utils", function () { test("getEntityPathDependencies", () => { const entity = { diff --git a/app/client/src/workers/common/DependencyMap/utils/getValidationDependencies.ts b/app/client/src/workers/common/DependencyMap/utils/getValidationDependencies.ts deleted file mode 100644 index 6ac10d10f3aa..000000000000 --- a/app/client/src/workers/common/DependencyMap/utils/getValidationDependencies.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { isWidget } from "@appsmith/workers/Evaluation/evaluationUtils"; -import type { - DataTreeEntityConfig, - WidgetEntityConfig, -} from "@appsmith/entities/DataTree/types"; -import type { DataTreeEntity } from "entities/DataTree/dataTreeTypes"; -import type { DependencyMap } from "utils/DynamicBindingUtils"; - -const DATA_DERIVED_PROPERTY_PLACEHOLDER = "*"; - -export function getValidationDependencies( - entity: DataTreeEntity, - entityName: string, - entityConfig: DataTreeEntityConfig, -): DependencyMap { - const validationDependency: DependencyMap = {}; - if (!isWidget(entity)) return validationDependency; - - const { validationPaths } = entityConfig as WidgetEntityConfig; - - Object.entries(validationPaths).forEach( - ([propertyPath, validationConfig]) => { - if (validationConfig.dependentPaths) { - const propertyPathsSplitArray = propertyPath.split("."); - const dependencyArray = validationConfig.dependentPaths.map((path) => { - const pathSplitArray = path.split("."); - /** - * Below logic add support for data derived paths in validation dependencies - * dependentPaths: ["primaryColumns.*.computedValue"] - * - * Here, items.*.value is a data derived path and we need to replace * with the actual value resulting in "primaryColumns.columnName.computedValue" as dependency. - */ - const index = pathSplitArray.indexOf( - DATA_DERIVED_PROPERTY_PLACEHOLDER, - ); - if (index > -1) { - // replace * in pathSplitArray with same position value in propertyPathsSplitArray - for (let i = 0; i < pathSplitArray.length; i++) { - if (pathSplitArray[i] === DATA_DERIVED_PROPERTY_PLACEHOLDER) { - pathSplitArray[i] = propertyPathsSplitArray[i]; - } - } - return `${entityName}.${pathSplitArray.join(".")}`; - } - return `${entityName}.${path}`; - }); - validationDependency[`${entityName}.${propertyPath}`] = dependencyArray; - } - }, - ); - - return validationDependency; -}
2443b8ce9d4c64dc149e07d3fb313f912f545832
2024-09-24 18:12:48
Aman Agarwal
fix: js library default export to a unique name instead of default key in self (#36483)
false
js library default export to a unique name instead of default key in self (#36483)
fix
diff --git a/app/client/src/workers/Evaluation/handlers/__tests__/jsLibrary.test.ts b/app/client/src/workers/Evaluation/handlers/__tests__/jsLibrary.test.ts index 9727c496fb81..9b9a4c1b23df 100644 --- a/app/client/src/workers/Evaluation/handlers/__tests__/jsLibrary.test.ts +++ b/app/client/src/workers/Evaluation/handlers/__tests__/jsLibrary.test.ts @@ -11,7 +11,17 @@ declare const self: WorkerGlobalScope; describe("Tests to assert install/uninstall flows", function () { beforeAll(() => { - self.importScripts = jest.fn(() => { + self.importScripts = jest.fn((url: string) => { + if (url.includes("jspdf-autotable")) { + const defaultVar = function () {}; + + defaultVar.Cell = function () {}; + self.Cell = function () {}; + self.default = defaultVar; + + return; + } + self.lodash = {}; }); @@ -150,4 +160,28 @@ describe("Tests to assert install/uninstall flows", function () { method: "Hello", }); }); + + it("should install a library with default export", async function () { + const res = await installLibrary({ + data: { + url: "https://cdn.jsdelivr.net/npm/[email protected]/dist/jspdf.plugin.autotable.js", + takenAccessors: [], + takenNamesMap: {}, + }, + method: EVAL_WORKER_ASYNC_ACTION.INSTALL_LIBRARY, + webworkerTelemetry: {}, + }); + + expect(self.importScripts).toHaveBeenCalled(); + expect(mod.makeTernDefs).toHaveBeenCalledWith({}); + + expect(res).toEqual({ + accessor: ["jspdf_plugin_autotable_js"], + defs: { + "!name": "LIB/jspdf_plugin_autotable_js", + jspdf_plugin_autotable_js: undefined, + }, + success: true, + }); + }); }); diff --git a/app/client/src/workers/Evaluation/handlers/jsLibrary.ts b/app/client/src/workers/Evaluation/handlers/jsLibrary.ts index 87d22747c32a..bdf704f2bab4 100644 --- a/app/client/src/workers/Evaluation/handlers/jsLibrary.ts +++ b/app/client/src/workers/Evaluation/handlers/jsLibrary.ts @@ -128,10 +128,40 @@ export async function installLibrary( // Find keys add that were installed to the global scope. const keysAfterInstallation = Object.keys(self); - accessors.push( - ...difference(keysAfterInstallation, envKeysBeforeInstallation), + const differentiatingKeys = difference( + keysAfterInstallation, + envKeysBeforeInstallation, ); + if ( + differentiatingKeys.length > 0 && + differentiatingKeys.includes("default") + ) { + // Changing default export to library specific name + const uniqueName = generateUniqueAccessor( + url, + takenAccessors, + takenNamesMap, + ); + + // mapping default functionality to library name accessor + self[uniqueName] = self["default"]; + // deleting the reference of default key from the self object + delete self["default"]; + // mapping all the references of differentiating keys from the self object to the self[uniqueName] key object + differentiatingKeys.map((key) => { + if (key !== "default") { + self[uniqueName][key] = self[key]; + // deleting the references from the self object + delete self[key]; + } + }); + // pushing the uniqueName to the accessor array + accessors.push(uniqueName); + } else { + accessors.push(...differentiatingKeys); + } + /** * Check the list of installed library to see if their values have changed. * This is to check if the newly installed library overwrites an already existing one
7caf93d52608ecc27b58202ab4ab12879803b26a
2023-12-29 15:26:25
yatinappsmith
ci: Added restore cache from git for client build (#29938)
false
Added restore cache from git for client build (#29938)
ci
diff --git a/.github/workflows/client-build.yml b/.github/workflows/client-build.yml index ffb48774a832..64634c637bbf 100644 --- a/.github/workflows/client-build.yml +++ b/.github/workflows/client-build.yml @@ -74,10 +74,23 @@ jobs: uses: actions/checkout@v4 with: fetch-tags: true + - name: Get changed files in the client folder + id: changed-files-specific + uses: tj-actions/changed-files@v41 + with: + files: 'app/client/**' + + - name: Run step if any file(s) in the client folder change + if: steps.changed-files-specific.outputs.any_changed == 'true' + env: + ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }} + run: | + echo "One or more files in the server folder has changed." + echo "List all the files that have changed: $ALL_CHANGED_FILES" # get all the files changes in the cypress/e2e folder - name: Get added files in cypress/e2e folder - if: inputs.pr != 0 + if: inputs.pr != 0 && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') id: files uses: umani/[email protected] with: @@ -87,7 +100,7 @@ jobs: # Check all the newly added files are in ts - name: Check the newly added files are written in ts - if: inputs.check-test-files == 'true' && inputs.pr != 0 + if: inputs.check-test-files == 'true' && inputs.pr != 0 && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') id: check_files run: | files=(${{steps.files.outputs.files_created}}) @@ -102,7 +115,7 @@ jobs: # Comment in PR if test files are not written in ts and fail the workflow - name: Comment in PR if test files are not written in ts - if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true' && inputs.pr != 0 + if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true' && inputs.pr != 0 && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ inputs.pr }} @@ -110,11 +123,11 @@ jobs: <b>Below new test files are written in js 🔴 </b> <b>Expected format ts. Please fix and retrigger ok-to-test:</b> <ol>${{ steps.check_files.outputs.non_ts_files }}</ol> - - if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true' && inputs.pr != 0 + - if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true' && inputs.pr != 0 && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') run: exit 1 - name: Get all the added or changed files in client/src folder - if: inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' + if: inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') id: client_files uses: umani/[email protected] with: @@ -124,7 +137,7 @@ jobs: # Check all the newly added files are in ts - name: ADS compliant check - if: inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' + if: inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') id: ads_check run: | comment_files="" @@ -143,7 +156,7 @@ jobs: # Comment in PR if test files are not written in ts and fail the workflow - name: Comment in PR if test files are not written in ts - if: steps.ads_check.outputs.ads_non_compliant_count != 0 && inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' + if: steps.ads_check.outputs.ads_non_compliant_count != 0 && inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ inputs.pr }} @@ -156,6 +169,7 @@ jobs: # Create a run record exactly at the time of merge to release to # ensure we compare run details with code at this point - name: Create Perf Meta + if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' continue-on-error: true run: | PGPASSWORD='${{secrets.APPSMITH_PERFORMANCE_DB_PASSWORD}}' psql -h '${{secrets.APPSMITH_PERFORMANCE_DB_HOST}}' \ @@ -165,6 +179,7 @@ jobs: # In case this is second attempt try restoring status of the prior attempt from cache - name: Restore the previous run result + if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' uses: actions/cache@v3 with: path: | @@ -173,15 +188,16 @@ jobs: # Fetch prior run result - name: Get the previous run result + if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' id: run_result run: cat ~/run_result 2>/dev/null || echo 'default' # In case of prior failure run the job - - if: steps.run_result.outputs.run_result != 'success' + - if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') run: echo "I'm alive!" && exit 0 - name: Use Node.js - if: steps.run_result.outputs.run_result != 'success' + if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') uses: actions/setup-node@v3 with: node-version-file: app/client/package.json @@ -190,7 +206,7 @@ jobs: # when the project lives in a subdirectory: https://github.com/actions/setup-node/issues/488 # Restoring the cache manually instead - name: Restore Yarn cache - if: steps.run_result.outputs.run_result != 'success' + if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') uses: actions/cache@v3 id: cache-dependencies with: @@ -199,18 +215,18 @@ jobs: # Install all the dependencies - name: Install dependencies - if: steps.run_result.outputs.run_result != 'success' + if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') run: | npm install -g yarn yarn install --immutable # Type checking before starting the build - name: Run type check - if: steps.run_result.outputs.run_result != 'success' + if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') run: yarn run check-types - name: Set the build environment based on the branch - if: steps.run_result.outputs.run_result != 'success' + if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') id: vars run: | set +o pipefail @@ -232,6 +248,7 @@ jobs: # We burn React environment & the Segment analytics key into the build itself. # This is to ensure that we don't need to configure it in each installation - name: Create the bundle + if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' run: | if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then export REACT_APP_SEGMENT_CE_KEY="${{ secrets.APPSMITH_SEGMENT_CE_KEY }}" @@ -249,13 +266,14 @@ jobs: # Saving the cache to use it in subsequent runs - name: Save Yarn cache uses: actions/cache/save@v3 - if: steps.cache-dependencies.outputs.cache-hit != 'true' + if: steps.cache-dependencies.outputs.cache-hit != 'true' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') with: path: app/client/.yarn/cache key: v1-yarn3-${{ hashFiles('app/client/yarn.lock') }} # Restore the previous built bundle if present. If not push the newly built into the cache - name: Restore the previous bundle + if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' uses: actions/cache@v3 with: path: | @@ -263,9 +281,31 @@ jobs: key: ${{ github.run_id }}-${{ github.job }}-client - name: Pack the client build directory + if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' run: | tar -cvf ./build.tar -C build . + - name: Fetch client build from cache + if: steps.changed-files-specific.outputs.any_changed == 'false' && success() && github.event_name != 'push' && github.event_name != 'workflow_dispatch' && github.event_name != 'schedule' + env: + cachetoken: ${{ secrets.CACHETOKEN }} + reponame: ${{ github.event.repository.name }} + gituser: ${{ secrets.CACHE_GIT_USER }} + gituseremail: ${{ secrets.CACHE_GIT_EMAIL }} + run: | + mkdir cacherepo + cd ./cacherepo + git lfs install + git config --global user.email "$gituseremail" + git config --global user.name "$gituser" + git clone https://[email protected]/appsmithorg/cibuildcache.git + git lfs install + if [ "$reponame" = "appsmith" ]; then export repodir="CE"; fi + if [ "$reponame" = "appsmith-ee" ]; then export repodir="EE"; fi + cd cibuildcache/$repodir/release/client + git lfs pull ./build.tar + mv ./build.tar ../../../../../build.tar + # Upload the build artifact so that it can be used by the test & deploy job in the workflow - name: Upload react build bundle uses: actions/upload-artifact@v3
eb83389b3c6584431de07634209de22fd3464379
2023-07-25 14:04:37
Ayush Pahwa
fix: multiple env issues (#25655)
false
multiple env issues (#25655)
fix
diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index 8327eb4409f6..812b0a6c8dbb 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -1111,6 +1111,8 @@ export class DataSources { testNSave = true, environment = this.tedTestConfig.defaultEnviorment, assetEnvironmentSelected = false, + // function to be executed before filling the datasource form + preDSConfigAction?: (arg?: string) => void, ) { let guid: any; let dataSourceName = ""; @@ -1123,6 +1125,10 @@ export class DataSources { guid = uid; dataSourceName = dsType + " " + guid; this.agHelper.RenameWithInPane(dataSourceName, false); + // Execute the preDSConfigAction if it is defined + if (!!preDSConfigAction) { + preDSConfigAction.bind(this)(environment); + } if (assetEnvironmentSelected) { this.agHelper.AssertSelectedTab( this.locator.ds_editor_env_filter(environment), diff --git a/app/client/cypress/support/Pages/DeployModeHelper.ts b/app/client/cypress/support/Pages/DeployModeHelper.ts index 0763a646e060..2ddaf654e028 100644 --- a/app/client/cypress/support/Pages/DeployModeHelper.ts +++ b/app/client/cypress/support/Pages/DeployModeHelper.ts @@ -25,6 +25,7 @@ export class DeployMode { ".t--app-viewer-navigation-header .t--app-viewer-back-to-apps-button"; private _homeAppsmithImage = "a.t--appsmith-logo"; public envInfoModal = `[data-testid="t--env-info-modal"]`; + public envInfoModalDismissCheckbox = `[data-testid="t--env-info-dismiss-checkbox"]`; public envInfoModalDeployButton = `[data-testid="t--env-info-modal-deploy-button"]`; //refering PublishtheApp from command.js @@ -33,7 +34,8 @@ export class DeployMode { toCheckFailureToast = true, toValidateSavedState = true, addDebugFlag = true, - assertEnvInfoModal = false, + assertEnvInfoModal: "present" | "absent", + dismissModal = false, ) { //cy.intercept("POST", "/api/v1/applications/publish/*").as("publishAppli"); @@ -44,9 +46,14 @@ export class DeployMode { this.assertHelper.AssertDocumentReady(); this.StubbingDeployPage(addDebugFlag); this.agHelper.ClickButton("Deploy"); - if (assertEnvInfoModal) { + if (!!assertEnvInfoModal && assertEnvInfoModal === "present") { this.agHelper.WaitUntilEleAppear(this.envInfoModal); this.agHelper.AssertElementExist(this.envInfoModal); + if (dismissModal) { + this.agHelper.CheckUncheck(this.envInfoModalDismissCheckbox); + } + } else { + this.agHelper.AssertElementAbsence(this.envInfoModal); } this.agHelper.GetNClickIfPresent(this.envInfoModalDeployButton); this.agHelper.AssertElementAbsence(this.locator._btnSpinner, 10000); //to make sure we have started navigation from Edit page diff --git a/app/client/src/ce/utils/Environments/index.tsx b/app/client/src/ce/utils/Environments/index.tsx index bf63303a7107..6dce66007bc2 100644 --- a/app/client/src/ce/utils/Environments/index.tsx +++ b/app/client/src/ce/utils/Environments/index.tsx @@ -22,6 +22,24 @@ export const getCurrentEnvName = () => { return ""; }; +// function to check if the datasource is created for the current environment +export const isStorageEnvironmentCreated = ( + datasource: Datasource | null, + environment?: string, +) => { + !environment && (environment = getCurrentEnvironment()); + return ( + !!datasource && + datasource.hasOwnProperty("datasourceStorages") && + !!datasource.datasourceStorages && + datasource.datasourceStorages.hasOwnProperty(environment) && + datasource.datasourceStorages[environment].hasOwnProperty("id") && + datasource.datasourceStorages[environment].hasOwnProperty( + "datasourceConfiguration", + ) + ); +}; + // function to check if the datasource is configured for the current environment export const isEnvironmentConfigured = ( datasource: Datasource | null, @@ -35,6 +53,31 @@ export const isEnvironmentConfigured = ( return !!isConfigured ? isConfigured : false; }; +// function to check if the datasource is configured for the current environment +export const doesAnyDsConfigExist = ( + datasource: Datasource | null, + environment?: string, +) => { + !environment && (environment = getCurrentEnvironment()); + let isConfigured = false; + if (!!datasource && !!datasource.datasourceStorages) { + const envsList = Object.keys(datasource.datasourceStorages); + if (envsList.length === 0) { + isConfigured = false; + } else { + if (envsList.includes(environment)) { + isConfigured = + datasource.datasourceStorages[environment]?.isConfigured || false; + } else { + // Allow user to create a query even though the config is not + // there for the current environment + isConfigured = true; + } + } + } + return isConfigured; +}; + // function to check if the datasource is valid for the current environment export const isEnvironmentValid = ( datasource: Datasource | null, diff --git a/app/client/src/pages/Editor/DataSourceEditor/index.tsx b/app/client/src/pages/Editor/DataSourceEditor/index.tsx index a6e9c6ae6455..4d1866ab5d67 100644 --- a/app/client/src/pages/Editor/DataSourceEditor/index.tsx +++ b/app/client/src/pages/Editor/DataSourceEditor/index.tsx @@ -90,7 +90,10 @@ import type { PluginType } from "entities/Action"; import { PluginPackageName } from "entities/Action"; import DSDataFilter from "@appsmith/components/DSDataFilter"; import { DEFAULT_ENV_ID } from "@appsmith/api/ApiUtils"; -import { onUpdateFilterSuccess } from "@appsmith/utils/Environments"; +import { + isStorageEnvironmentCreated, + onUpdateFilterSuccess, +} from "@appsmith/utils/Environments"; import type { CalloutKind } from "design-system"; interface ReduxStateProps { @@ -523,6 +526,15 @@ class DatasourceEditorRouter extends React.Component<Props, State> { userPermissions, showFilterPane, ); + } else if ( + !isStorageEnvironmentCreated(this.props.formData as Datasource, id) + ) { + return this.updateFilterSuccess( + id, + name, + userPermissions, + showFilterPane, + ); } else if (showFilterPane !== this.state.filterParams.showFilterPane) { // In case just the viewmode changes but the id remains the same this.setState({ 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 6ee2bf26c49b..428d0737503d 100644 --- a/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GeneratePageForm.tsx +++ b/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/GeneratePageForm.tsx @@ -405,6 +405,7 @@ function GeneratePageForm() { canCreateDatasource, datasources, generateCRUDSupportedPlugin, + isGoogleSheetPlugin, }); const spreadSheetsProps = useSpreadSheets({ 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 96905cf055cc..4bb76c43660c 100644 --- a/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/hooks.ts +++ b/app/client/src/pages/Editor/GeneratePage/components/GeneratePageForm/hooks.ts @@ -24,10 +24,12 @@ export const useDatasourceOptions = ({ canCreateDatasource, datasources, generateCRUDSupportedPlugin, + isGoogleSheetPlugin, }: { canCreateDatasource: boolean; datasources: Datasource[]; generateCRUDSupportedPlugin: GenerateCRUDEnabledPluginMap; + isGoogleSheetPlugin: boolean; }) => { const [dataSourceOptions, setDataSourceOptions] = useState<DropdownOptions>( [], @@ -45,6 +47,11 @@ export const useDatasourceOptions = ({ ); } datasources.forEach(({ datasourceStorages, id, name, pluginId }) => { + // Doing this since g sheets plugin is not supported for environments + // and we need to show the option in the dropdown + const datasourceStorage = isGoogleSheetPlugin + ? Object.values(datasourceStorages)[0] + : datasourceStorages[currentEnvironment]; const datasourceObject = { id, label: name, @@ -52,7 +59,7 @@ export const useDatasourceOptions = ({ data: { pluginId, isSupportedForTemplate: !!generateCRUDSupportedPlugin[pluginId], - isValid: datasourceStorages[currentEnvironment]?.isValid, + isValid: datasourceStorage?.isValid, }, }; if (generateCRUDSupportedPlugin[pluginId]) diff --git a/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx b/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx index 22d0b1a4db75..186aef29f75c 100644 --- a/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx +++ b/app/client/src/pages/Editor/IntegrationEditor/DatasourceCard.tsx @@ -48,6 +48,8 @@ import { DatasourceEditEntryPoints } from "constants/Datasource"; import { isEnvironmentConfigured, getCurrentEnvironment, + doesAnyDsConfigExist, + DB_NOT_SUPPORTED, } from "@appsmith/utils/Environments"; const Wrapper = styled.div` @@ -142,6 +144,7 @@ function DatasourceCard(props: DatasourceCardProps) { getGenerateCRUDEnabledPluginMap, ); const { datasource, plugin } = props; + const envSupportedDs = !DB_NOT_SUPPORTED.includes(plugin.type); const supportTemplateGeneration = !!generateCRUDSupportedPlugin[datasource.pluginId]; @@ -281,31 +284,37 @@ function DatasourceCard(props: DatasourceCardProps) { </Queries> </div> <ButtonsWrapper className="action-wrapper"> - {(!isEnvironmentConfigured(datasource, currentEnv) || - supportTemplateGeneration) && + {supportTemplateGeneration && isDatasourceAuthorizedForQueryCreation(datasource, plugin) && ( <Button - className={ - isEnvironmentConfigured(datasource, currentEnv) - ? "t--generate-template" - : "t--reconnect-btn" - } + className={"t--generate-template"} kind="secondary" onClick={(e) => { e.stopPropagation(); e.preventDefault(); - isEnvironmentConfigured(datasource, currentEnv) - ? routeToGeneratePage() - : editDatasource(); + routeToGeneratePage(); }} size="md" > - {isEnvironmentConfigured(datasource, currentEnv) - ? createMessage(GENERATE_NEW_PAGE_BUTTON_TEXT) - : createMessage(RECONNECT_BUTTON_TEXT)} + {createMessage(GENERATE_NEW_PAGE_BUTTON_TEXT)} </Button> )} - {isEnvironmentConfigured(datasource, currentEnv) && ( + {envSupportedDs && + !isEnvironmentConfigured(datasource, currentEnv) && ( + <Button + className={"t--reconnect-btn"} + kind="secondary" + onClick={(e) => { + e.stopPropagation(); + e.preventDefault(); + editDatasource(); + }} + size="md" + > + {createMessage(RECONNECT_BUTTON_TEXT)} + </Button> + )} + {doesAnyDsConfigExist(datasource, currentEnv) && ( <NewActionButton datasource={datasource} disabled={ diff --git a/app/client/src/utils/editorContextUtils.ts b/app/client/src/utils/editorContextUtils.ts index 40273f4a955b..0044ca8648d6 100644 --- a/app/client/src/utils/editorContextUtils.ts +++ b/app/client/src/utils/editorContextUtils.ts @@ -4,7 +4,10 @@ import { DATASOURCE_REST_API_FORM, DATASOURCE_SAAS_FORM, } from "@appsmith/constants/forms"; -import { getCurrentEnvironment } from "@appsmith/utils/Environments"; +import { + DB_NOT_SUPPORTED, + getCurrentEnvironment, +} from "@appsmith/utils/Environments"; import { diff } from "deep-diff"; import { PluginName, PluginPackageName, PluginType } from "entities/Action"; import type { @@ -101,12 +104,16 @@ export function isDatasourceAuthorizedForQueryCreation( plugin: Plugin, currentEnvironment = getCurrentEnvironment(), ): boolean { - if ( - !datasource || - !datasource.hasOwnProperty("datasourceStorages") || - !datasource.datasourceStorages.hasOwnProperty(currentEnvironment) - ) + if (!datasource || !datasource.hasOwnProperty("datasourceStorages")) return false; + const isGoogleSheetPlugin = isGoogleSheetPluginDS(plugin?.packageName); + const envSupportedDs = !DB_NOT_SUPPORTED.includes(plugin?.type || ""); + if (!datasource.datasourceStorages.hasOwnProperty(currentEnvironment)) { + if (envSupportedDs) return false; + const envs = Object.keys(datasource.datasourceStorages); + if (envs.length === 0) return false; + currentEnvironment = envs[0]; + } const datasourceStorage = datasource.datasourceStorages[currentEnvironment]; if ( !datasourceStorage || @@ -119,7 +126,6 @@ export function isDatasourceAuthorizedForQueryCreation( "datasourceConfiguration.authentication.authenticationType", ); - const isGoogleSheetPlugin = isGoogleSheetPluginDS(plugin?.packageName); if (isGoogleSheetPlugin) { const isAuthorized = authType === AuthType.OAUTH2 &&
e24a17815849338bf92e38ad7e42b7be79ea2c96
2023-06-17 11:54:32
Aishwarya-U-R
ci: Set Branch name (#24571)
false
Set Branch name (#24571)
ci
diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 247191957f45..a387040c1e4b 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -253,7 +253,7 @@ jobs: # using GitHub Actions environment file # https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#environment-files run: | - echo COMMIT_INFO_BRANCH=$(git rev-parse --abbrev-ref HEAD) >> $GITHUB_ENV + echo COMMIT_INFO_BRANCH=$(git --git-dir=.git rev-parse --abbrev-ref HEAD) >> $GITHUB_ENV echo COMMIT_INFO_MESSAGE=Run from PR# ${{ inputs.pr }} on commit $(git show -s --pretty=%H | cut -c 1-7) >> $GITHUB_ENV echo COMMIT_INFO_EMAIL=$(git show -s --pretty=%ae) >> $GITHUB_ENV echo COMMIT_INFO_AUTHOR=$(git show -s --pretty=%an) >> $GITHUB_ENV
e6cd97318d294d85512e65a79c196e9e513001b7
2024-09-27 14:00:01
Nilansh Bansal
feat: added LRU cache for mockDB connections (#36480)
false
added LRU cache for mockDB connections (#36480)
feat
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 7c52a719d02c..960834f9064d 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 @@ -24,6 +24,7 @@ interface PackageName { String APPSMITH_AI_PLUGIN = "appsmithai-plugin"; String DATABRICKS_PLUGIN = "databricks-plugin"; String AWS_LAMBDA_PLUGIN = "aws-lambda-plugin"; + String MONGO_PLUGIN = "mongo-plugin"; } public static final String DEFAULT_REST_DATASOURCE = "DEFAULT_REST_DATASOURCE"; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/DatasourcePluginContext.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/DatasourcePluginContext.java new file mode 100644 index 000000000000..b3385964e2dc --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/DatasourcePluginContext.java @@ -0,0 +1,20 @@ +package com.appsmith.server.domains; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.time.Instant; + +@Getter +@Setter +@ToString +public class DatasourcePluginContext<T> { + private T connection; + private String pluginId; + private Instant creationTime; + + public DatasourcePluginContext() { + creationTime = Instant.now(); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceContextServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceContextServiceCEImpl.java index 3693d1348c47..adc1d2ea82bb 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceContextServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceContextServiceCEImpl.java @@ -13,6 +13,7 @@ import com.appsmith.server.datasourcestorages.base.DatasourceStorageService; import com.appsmith.server.domains.DatasourceContext; import com.appsmith.server.domains.DatasourceContextIdentifier; +import com.appsmith.server.domains.DatasourcePluginContext; import com.appsmith.server.domains.Plugin; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; @@ -20,6 +21,10 @@ import com.appsmith.server.plugins.base.PluginService; import com.appsmith.server.services.ConfigService; import com.appsmith.server.solutions.DatasourcePermission; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.RemovalListener; +import com.google.common.cache.RemovalNotification; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; @@ -29,8 +34,12 @@ import java.time.Instant; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; import java.util.function.Function; +import static java.lang.Boolean.FALSE; +import static java.lang.Boolean.TRUE; + @Slf4j public class DatasourceContextServiceCEImpl implements DatasourceContextServiceCE { @@ -38,6 +47,21 @@ public class DatasourceContextServiceCEImpl implements DatasourceContextServiceC protected final Map<DatasourceContextIdentifier, Mono<DatasourceContext<Object>>> datasourceContextMonoMap; protected final Map<DatasourceContextIdentifier, Object> datasourceContextSynchronizationMonitorMap; protected final Map<DatasourceContextIdentifier, DatasourceContext<?>> datasourceContextMap; + + /** + * This cache is used to store the datasource context for a limited time and a limited max number of connections and + * then destroy the least recently used connection. The cleanup process is triggered when the cache is accessed and + * either the time limit or the max connections are reached. + * The purpose of this is to prevent the large number of open dangling connections to the movies mockDB. + * The removalListener method is called when the connection is removed from the cache. + */ + protected final Cache<DatasourceContextIdentifier, DatasourcePluginContext> datasourcePluginContextMapLRUCache = + CacheBuilder.newBuilder() + .removalListener(createRemovalListener()) + .expireAfterAccess(2, TimeUnit.HOURS) + .maximumSize(300) // caches most recently used 300 mock connections per pod + .build(); + private final DatasourceService datasourceService; private final DatasourceStorageService datasourceStorageService; private final PluginService pluginService; @@ -67,6 +91,50 @@ public DatasourceContextServiceCEImpl( this.datasourcePermission = datasourcePermission; } + private RemovalListener<DatasourceContextIdentifier, DatasourcePluginContext> createRemovalListener() { + return (RemovalNotification<DatasourceContextIdentifier, DatasourcePluginContext> removalNotification) -> { + handleRemoval(removalNotification); + }; + } + + private Object getConnectionFromDatasourceContextMap(DatasourceContextIdentifier datasourceContextIdentifier) { + return this.datasourceContextMap.containsKey(datasourceContextIdentifier) + && this.datasourceContextMap.get(datasourceContextIdentifier) != null + ? this.datasourceContextMap.get(datasourceContextIdentifier).getConnection() + : null; + } + + private void handleRemoval( + RemovalNotification<DatasourceContextIdentifier, DatasourcePluginContext> removalNotification) { + final DatasourceContextIdentifier datasourceContextIdentifier = removalNotification.getKey(); + final DatasourcePluginContext datasourcePluginContext = removalNotification.getValue(); + + log.debug( + "Removing Datasource Context from cache and closing the open connection for DatasourceId: {} and environmentId: {}", + datasourceContextIdentifier.getDatasourceId(), + datasourceContextIdentifier.getEnvironmentId()); + log.info("LRU Cache Size after eviction: {}", datasourcePluginContextMapLRUCache.size()); + + // Close connection and remove entry from both cache maps + final Object connection = getConnectionFromDatasourceContextMap(datasourceContextIdentifier); + + Mono<Plugin> pluginMono = + pluginService.findById(datasourcePluginContext.getPluginId()).cache(); + if (connection != null) { + pluginExecutorHelper + .getPluginExecutor(pluginMono) + .flatMap(pluginExecutor -> Mono.fromRunnable(() -> pluginExecutor.datasourceDestroy(connection))) + .onErrorResume(e -> { + log.error("Error destroying stale datasource connection", e); + return Mono.empty(); + }) + .subscribe(); // Trigger the execution + } + // Remove the entries from both maps + datasourceContextMonoMap.remove(datasourceContextIdentifier); + datasourceContextMap.remove(datasourceContextIdentifier); + } + /** * This method defines a critical section that can be executed only by one thread at a time per datasource id - i * .e. if two threads want to create datasource for different datasource ids then they would not be synchronized. @@ -115,6 +183,11 @@ public Mono<DatasourceContext<Object>> getCachedDatasourceContextMono( } datasourceContextMonoMap.remove(datasourceContextIdentifier); datasourceContextMap.remove(datasourceContextIdentifier); + log.info( + "Invalidating the LRU cache entry for datasource id {}, environment id {} as the connection is stale or in error state", + datasourceContextIdentifier.getDatasourceId(), + datasourceContextIdentifier.getEnvironmentId()); + datasourcePluginContextMapLRUCache.invalidate(datasourceContextIdentifier); } /* @@ -129,17 +202,13 @@ public Mono<DatasourceContext<Object>> getCachedDatasourceContextMono( + ": Cached resource context mono exists for datasource id {}, environment id {}. Returning the same.", datasourceContextIdentifier.getDatasourceId(), datasourceContextIdentifier.getEnvironmentId()); + // Accessing the LRU cache to update the last accessed time + datasourcePluginContextMapLRUCache.getIfPresent(datasourceContextIdentifier); return datasourceContextMonoMap.get(datasourceContextIdentifier); } /* Create a fresh datasource context */ DatasourceContext<Object> datasourceContext = new DatasourceContext<>(); - if (datasourceContextIdentifier.isKeyValid() && shouldCacheContextForThisPlugin(plugin)) { - /* For this datasource, either the context doesn't exist, or the context is stale. Replace (or add) with - the new connection in the context map. */ - datasourceContextMap.put(datasourceContextIdentifier, datasourceContext); - } - Mono<Object> connectionMonoCache = pluginExecutor .datasourceCreate(datasourceStorage.getDatasourceConfiguration()) .cache(); @@ -159,15 +228,34 @@ public Mono<DatasourceContext<Object>> getCachedDatasourceContextMono( datasourceContext) .cache(); /* Cache the value so that further evaluations don't result in new connections */ - if (datasourceContextIdentifier.isKeyValid() && shouldCacheContextForThisPlugin(plugin)) { - datasourceContextMonoMap.put(datasourceContextIdentifier, datasourceContextMonoCache); - } - log.debug( - Thread.currentThread().getName() - + ": Cached new datasource context for datasource id {}, environment id {}", - datasourceContextIdentifier.getDatasourceId(), - datasourceContextIdentifier.getEnvironmentId()); - return datasourceContextMonoCache; + return connectionMonoCache + .flatMap(connection -> { + datasourceContext.setConnection(connection); + if (datasourceContextIdentifier.isKeyValid() + && shouldCacheContextForThisPlugin(plugin)) { + datasourceContextMap.put(datasourceContextIdentifier, datasourceContext); + datasourceContextMonoMap.put( + datasourceContextIdentifier, datasourceContextMonoCache); + + if (TRUE.equals(datasourceStorage.getIsMock()) + && PluginConstants.PackageName.MONGO_PLUGIN.equals( + plugin.getPackageName())) { + log.info( + "Datasource is a mock mongo DB. Adding the connection to LRU cache!"); + DatasourcePluginContext<Object> datasourcePluginContext = + new DatasourcePluginContext<>(); + datasourcePluginContext.setConnection(datasourceContext.getConnection()); + datasourcePluginContext.setPluginId(plugin.getId()); + datasourcePluginContextMapLRUCache.put( + datasourceContextIdentifier, datasourcePluginContext); + log.info( + "LRU Cache Size after adding: {}", + datasourcePluginContextMapLRUCache.size()); + } + } + return datasourceContextMonoCache; + }) + .switchIfEmpty(datasourceContextMonoCache); } }) .flatMap(obj -> obj) @@ -195,7 +283,7 @@ public Mono<Object> updateDatasourceAndSetAuthentication(Object connection, Data .setAuthentication(updatableConnection.getAuthenticationDTO( datasourceStorage.getDatasourceConfiguration().getAuthentication())); datasourceStorageMono = datasourceStorageService.updateDatasourceStorage( - datasourceStorage, datasourceStorage.getEnvironmentId(), Boolean.FALSE, false); + datasourceStorage, datasourceStorage.getEnvironmentId(), FALSE, false); } return datasourceStorageMono.thenReturn(connection); } @@ -308,6 +396,8 @@ public Mono<DatasourceContext<?>> getDatasourceContext(DatasourceStorage datasou } else { if (isValidDatasourceContextAvailable(datasourceStorage, datasourceContextIdentifier)) { log.debug("Resource context exists. Returning the same."); + // Accessing the LRU cache to update the last accessed time + datasourcePluginContextMapLRUCache.getIfPresent(datasourceContextIdentifier); return Mono.just(datasourceContextMap.get(datasourceContextIdentifier)); } } @@ -399,7 +489,11 @@ public Mono<DatasourceContext<?>> deleteDatasourceContext(DatasourceStorage data log.info("Clearing datasource context for datasource storage ID {}.", datasourceStorage.getId()); pluginExecutor.datasourceDestroy(datasourceContext.getConnection()); datasourceContextMonoMap.remove(datasourceContextIdentifier); - + log.info( + "Invalidating the LRU cache entry for datasource id {}, environment id {} as delete datasource context is invoked", + datasourceContextIdentifier.getDatasourceId(), + datasourceContextIdentifier.getEnvironmentId()); + datasourcePluginContextMapLRUCache.invalidate(datasourceContextIdentifier); if (!datasourceContextMap.containsKey(datasourceContextIdentifier)) { log.info( "datasourceContextMap does not contain any entry for datasource storage with id: {} ",
d99789c401a29f9b43d405ce13003c1355396386
2024-11-21 13:55:02
Nilesh Sarupriya
chore: set datasourceId in executeActionDTO during execution (#37626)
false
set datasourceId in executeActionDTO during execution (#37626)
chore
diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java index 38c8664141d0..794d24af0b98 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java @@ -252,17 +252,24 @@ private Mono<ExecuteActionDTO> populateExecuteActionDTO(ExecuteActionDTO execute Mono<ExecuteActionDTO> systemInfoPopulatedExecuteActionDTOMono = actionExecutionSolutionHelper.populateExecuteActionDTOWithSystemInfo(executeActionDTO); - return systemInfoPopulatedExecuteActionDTOMono.flatMap( - populatedExecuteActionDTO -> Mono.zip(instanceIdMono, defaultTenantIdMono) - .map(tuple -> { - String instanceId = tuple.getT1(); - String tenantId = tuple.getT2(); - populatedExecuteActionDTO.setActionId(newAction.getId()); - populatedExecuteActionDTO.setWorkspaceId(newAction.getWorkspaceId()); - populatedExecuteActionDTO.setInstanceId(instanceId); - populatedExecuteActionDTO.setTenantId(tenantId); - return populatedExecuteActionDTO; - })); + return systemInfoPopulatedExecuteActionDTOMono.flatMap(populatedExecuteActionDTO -> Mono.zip( + instanceIdMono, defaultTenantIdMono) + .map(tuple -> { + String instanceId = tuple.getT1(); + String tenantId = tuple.getT2(); + populatedExecuteActionDTO.setActionId(newAction.getId()); + populatedExecuteActionDTO.setWorkspaceId(newAction.getWorkspaceId()); + if (TRUE.equals(executeActionDTO.getViewMode())) { + populatedExecuteActionDTO.setDatasourceId( + newAction.getPublishedAction().getDatasource().getId()); + } else { + populatedExecuteActionDTO.setDatasourceId( + newAction.getUnpublishedAction().getDatasource().getId()); + } + populatedExecuteActionDTO.setInstanceId(instanceId); + populatedExecuteActionDTO.setTenantId(tenantId); + return populatedExecuteActionDTO; + })); } /**
6a59c153c312879dddd99560a7f533b5fbb50f0b
2023-01-03 20:47:25
sneha122
fix: Added Gsheet Auth Failure Analytic Event (#19289)
false
Added Gsheet Auth Failure Analytic Event (#19289)
fix
diff --git a/app/client/src/pages/Editor/gitSync/ReconnectDatasourceModal.tsx b/app/client/src/pages/Editor/gitSync/ReconnectDatasourceModal.tsx index d9faf16a21b6..0d4ea9ad2549 100644 --- a/app/client/src/pages/Editor/gitSync/ReconnectDatasourceModal.tsx +++ b/app/client/src/pages/Editor/gitSync/ReconnectDatasourceModal.tsx @@ -316,6 +316,13 @@ function ReconnectDatasourceModal() { const [datasource, setDatasource] = useState<Datasource | null>(null); const [isImport, setIsImport] = useState(queryIsImport); const [isTesting, setIsTesting] = useState(false); + const queryDS = datasources.find((ds) => ds.id === queryDatasourceId); + const dsName = queryDS?.name; + const orgId = queryDS?.workspaceId; + let pluginName = ""; + if (!!queryDS?.pluginId) { + pluginName = pluginNames[queryDS.pluginId]; + } // when redirecting from oauth, processing the status if (isImport) { @@ -330,6 +337,13 @@ function ReconnectDatasourceModal() { ? OAUTH_AUTHORIZATION_APPSMITH_ERROR : OAUTH_AUTHORIZATION_FAILED; Toaster.show({ text: display_message || message, variant }); + const oAuthStatus = status; + AnalyticsUtil.logEvent("UPDATE_DATASOURCE", { + dsName, + oAuthStatus, + orgId, + pluginName, + }); } else if (queryDatasourceId) { dispatch(getOAuthAccessToken(queryDatasourceId)); } diff --git a/app/client/src/pages/common/datasourceAuth/index.tsx b/app/client/src/pages/common/datasourceAuth/index.tsx index 5f649e6f668f..59d0a0d94cfb 100644 --- a/app/client/src/pages/common/datasourceAuth/index.tsx +++ b/app/client/src/pages/common/datasourceAuth/index.tsx @@ -4,6 +4,7 @@ import { ActionButton } from "pages/Editor/DataSourceEditor/JSONtoForm"; import { useDispatch, useSelector } from "react-redux"; import { getEntities, + getPluginNameFromId, getPluginTypeFromDatasourceId, } from "selectors/entitiesSelector"; import { @@ -124,8 +125,11 @@ function DatasourceAuth({ ? formData?.authType : formData?.datasourceConfiguration?.authentication?.authenticationType; - const { id: datasourceId, isDeleting } = datasource; + const { id: datasourceId, isDeleting, pluginId } = datasource; const applicationId = useSelector(getCurrentApplicationId); + const pluginName = useSelector((state: AppState) => + getPluginNameFromId(state, pluginId), + ); const datasourcePermissions = datasource.userPermissions || []; @@ -144,6 +148,8 @@ function DatasourceAuth({ const pageId = (pageIdQuery || pageIdProp) as string; const [confirmDelete, setConfirmDelete] = useState(false); + const dsName = datasource?.name; + const orgId = datasource?.workspaceId; useEffect(() => { if (confirmDelete) { @@ -172,6 +178,13 @@ function DatasourceAuth({ ? OAUTH_AUTHORIZATION_APPSMITH_ERROR : OAUTH_AUTHORIZATION_FAILED; Toaster.show({ text: display_message || message, variant }); + const oAuthStatus = status; + AnalyticsUtil.logEvent("UPDATE_DATASOURCE", { + dsName, + oAuthStatus, + orgId, + pluginName, + }); } else { dispatch(getOAuthAccessToken(datasourceId)); } diff --git a/app/client/src/utils/AnalyticsUtil.tsx b/app/client/src/utils/AnalyticsUtil.tsx index 5ae6f0fde27b..d125e3ede98c 100644 --- a/app/client/src/utils/AnalyticsUtil.tsx +++ b/app/client/src/utils/AnalyticsUtil.tsx @@ -94,6 +94,7 @@ export type EventName = | "CONSOLE_LOG_CREATED" | "TEST_DATA_SOURCE_SUCCESS" | "TEST_DATA_SOURCE_CLICK" + | "UPDATE_DATASOURCE" | "CREATE_QUERY_CLICK" | "NAVIGATE" | "PAGE_LOAD"
e7b95d2fd905505f67ad7e31aab3ffb410e943cb
2021-09-06 22:28:48
Nikhil Nandagopal
fix: Updated Template (#7169)
false
Updated Template (#7169)
fix
diff --git a/app/server/appsmith-server/src/main/resources/CRUD-DB-Table-Template-Application.json b/app/server/appsmith-server/src/main/resources/CRUD-DB-Table-Template-Application.json index e6ee5303f47c..12efd1f9b829 100644 --- a/app/server/appsmith-server/src/main/resources/CRUD-DB-Table-Template-Application.json +++ b/app/server/appsmith-server/src/main/resources/CRUD-DB-Table-Template-Application.json @@ -1 +1 @@ -{"unpublishedDefaultPageName":"PostgreSQL","datasourceList":[{"new":true,"invalids":[],"pluginId":"amazons3-plugin","isValid":true,"name":"AmazonS3","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"endpoints":[{"host":""}],"properties":[{"value":"ap-south-1"},{"value":"amazon-s3","key":"s3Provider"},{"value":"","key":"customRegion"}]},"structure":{}},{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"Appsmith Prod","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"headers":[{"value":"_hjIncludedInSample=1; _hjSessionTooLarge=1; _ga=GA1.2.572027528.1599035590; SL_C_23361dd035530_KEY=c370af0df0edf38360adbefbdc47d2b42ea137c9; ajs_user_id=%22nikhil%40appsmith.com%22; ajs_anonymous_id=%2213c846f6-970b-41e1-925f-f8f4a92ea315%22; SL_C_23361dd035530_SID=laR0iYdLzA-; SL_C_23361dd035530_VID=EDGoRechnrX; _hjid=da2ef5e3-4ea5-42dc-b892-7962b7564098; [email protected]; ajs_anonymous_id=13c846f6-970b-41e1-925f-f8f4a92ea315; intercom-id-y10e7138=a7d5577a-ac9b-4f96-93df-c3f86f2b7548; SESSION=21e71ab1-7ef2-4987-b430-1ab002edbd6b; _gid=GA1.2.1874210412.1627809109; amplitude_id_fef1e872c952688acd962d30aa545b9eappsmith.com=eyJkZXZpY2VJZCI6IjU5ZjhhZTJlLTgzYjQtNDY5My1hZjA4LTM2ZGRkZjBjNGJiYlIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYyODE0NzgzNzQ1NiwibGFzdEV2ZW50VGltZSI6MTYyODE0NzgzNzQ1NywiZXZlbnRJZCI6MSwiaWRlbnRpZnlJZCI6MCwic2VxdWVuY2VOdW1iZXIiOjF9; _hjAbsoluteSessionInProgress=0; _hjIncludedInPageviewSample=1; mp_70b8ea94d623dd857fb555a76d11f944_mixpanel=%7B%22distinct_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24device_id%22%3A%20%221787d3b4aab392-0b46f81f3f91ff-1633685c-1aeaa0-1787d3b4aac48d%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%2C%22mp_lib%22%3A%20%22Segment%3A%20web%22%2C%22%24user_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22mp_name_tag%22%3A%20%22nikhil%40appsmith.com%22%2C%22userId%22%3A%20%22nikhil%40appsmith.com%22%2C%22source%22%3A%20%22cloud%22%2C%22id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24email%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24first_name%22%3A%20%22Nikhil%22%2C%22%24last_name%22%3A%20%22Nandagopal%22%2C%22%24name%22%3A%20%22Nikhil%20Nandagopal%22%2C%22utm_source%22%3A%20%22ActiveCampaign%22%2C%22utm_medium%22%3A%20%22email%22%2C%22utm_campaign%22%3A%20%22Day%201%20Nudge%20after%20Sign%20up%22%2C%22utm_content%22%3A%20%22Does%20appsmith%20use%20appsmith%3F%20%F0%9F%A4%94%22%7D; intercom-session-y10e7138=Nkxsd3kzTnVDTC9VcnEzbnNGZFRkWUZ0MG00RzByb2c5YXFOdmM4THpzcHZNYzgwUHdmazdWYXpLb3pkNVRGMy0tcDVLbld2UDJudThPTEQ5d1hZR1BhZz09--fc315a38af2f912c348ca1aa8cdbb9dad2b39c3f","key":"Cookie"}],"properties":[{"value":"N","key":"isSendSessionEnabled"},{"value":"","key":"sessionSignatureKey"}],"url":"https://app.appsmith.com"},"structure":{}},{"new":true,"invalids":[],"pluginId":"firestore-plugin","isValid":true,"name":"FBTemplateDB","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"url":"https://firebase-crud-template.firebaseio.com"},"structure":{}},{"new":true,"invalids":[],"pluginId":"google-sheets-plugin","isValid":true,"name":"Google Sheet","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false},"structure":{}},{"new":true,"invalids":[],"pluginId":"postgres-plugin","isValid":true,"name":"Internal DB","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"endpoints":[{"port":5432,"host":"fake-api.cvuydmurdlas.us-east-1.rds.amazonaws.com"}],"connection":{"mode":"READ_WRITE","ssl":{"authType":"DEFAULT"}}},"structure":{"tables":[{"schema":"public","columns":[{"defaultValue":"nextval('active_app_report_id_seq'::regclass)","name":"id","type":"int4"},{"name":"active_app","type":"text"},{"name":"num_api_calls","type":"int8"},{"name":"date","type":"text"},{"name":"report_type","type":"text"},{"name":"app_id","type":"text"}],"keys":[{"columnNames":["id"],"name":"active_app_report_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"active_app_report\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"active_app_report\" (\"active_app\", \"num_api_calls\", \"date\", \"report_type\", \"app_id\")\n VALUES ('', 1, '', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"active_app_report\" SET\n \"active_app\" = ''\n \"num_api_calls\" = 1\n \"date\" = ''\n \"report_type\" = ''\n \"app_id\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"active_app_report\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.active_app_report","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('audit_logs_id_seq'::regclass)","name":"id","type":"int4"},{"name":"date","type":"timestamptz"},{"name":"appId","type":"text"},{"name":"appName","type":"text"},{"name":"orgId","type":"text"},{"name":"actionName","type":"text"},{"name":"userId","type":"text"},{"name":"pageId","type":"text"},{"name":"insert_id","type":"text"},{"name":"pageName","type":"text"},{"name":"req","type":"json"}],"keys":[{"columnNames":["id"],"name":"audit_logs_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"audit_logs\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"audit_logs\" (\"date\", \"appId\", \"appName\", \"orgId\", \"actionName\", \"userId\", \"pageId\", \"insert_id\", \"pageName\", \"req\")\n VALUES (TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '', '', '', '', '', '', '', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"audit_logs\" SET\n \"date\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET'\n \"appId\" = ''\n \"appName\" = ''\n \"orgId\" = ''\n \"actionName\" = ''\n \"userId\" = ''\n \"pageId\" = ''\n \"insert_id\" = ''\n \"pageName\" = ''\n \"req\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"audit_logs\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.audit_logs","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('discord_messages_id_seq'::regclass)","name":"id","type":"int4"},{"name":"msg_id","type":"text"},{"name":"created_at","type":"date"},{"name":"author","type":"text"}],"keys":[{"columnNames":["id"],"name":"discord_messages_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"discord_messages\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"discord_messages\" (\"msg_id\", \"created_at\", \"author\")\n VALUES ('', '2019-07-01', '');"},{"title":"UPDATE","body":"UPDATE public.\"discord_messages\" SET\n \"msg_id\" = ''\n \"created_at\" = '2019-07-01'\n \"author\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"discord_messages\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.discord_messages","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('email_issues_id_seq'::regclass)","name":"id","type":"int4"},{"name":"from","type":"text"},{"name":"body","type":"text"},{"name":"created_at","type":"timestamptz"},{"name":"subject","type":"text"},{"name":"is_tagged","type":"bool"},{"name":"assignee","type":"text"}],"keys":[{"columnNames":["id"],"name":"email_issues_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"email_issues\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"email_issues\" (\"from\", \"body\", \"created_at\", \"subject\", \"is_tagged\", \"assignee\")\n VALUES ('', '', TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"email_issues\" SET\n \"from\" = ''\n \"body\" = ''\n \"created_at\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET'\n \"subject\" = ''\n \"is_tagged\" = ''\n \"assignee\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"email_issues\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.email_issues","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('github_issues_id_seq'::regclass)","name":"id","type":"int4"},{"name":"issue_id","type":"text"},{"name":"order","type":"int4"}],"keys":[{"columnNames":["id"],"name":"github_issues_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"github_issues\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"github_issues\" (\"issue_id\", \"order\")\n VALUES ('', 1);"},{"title":"UPDATE","body":"UPDATE public.\"github_issues\" SET\n \"issue_id\" = ''\n \"order\" = 1\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"github_issues\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.github_issues","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('github_projects_id_seq'::regclass)","name":"id","type":"int4"},{"name":"github_id","type":"text"},{"name":"due_date","type":"timestamptz"},{"name":"tag","type":"text"}],"keys":[{"columnNames":["id"],"name":"github_projects_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"github_projects\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"github_projects\" (\"github_id\", \"due_date\", \"tag\")\n VALUES ('', TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '');"},{"title":"UPDATE","body":"UPDATE public.\"github_projects\" SET\n \"github_id\" = ''\n \"due_date\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET'\n \"tag\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"github_projects\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.github_projects","type":"TABLE"},{"schema":"public","columns":[{"name":"id","type":"text"},{"name":"assignee","type":"text"},{"name":"state","type":"text"}],"keys":[{"columnNames":["id"],"name":"support_email_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"support_email\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"support_email\" (\"id\", \"assignee\", \"state\")\n VALUES ('', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"support_email\" SET\n \"id\" = ''\n \"assignee\" = ''\n \"state\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"support_email\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.support_email","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('support_tickets_id_seq'::regclass)","name":"id","type":"int4"},{"name":"description","type":"varchar"},{"name":"created_at","type":"timestamptz"},{"name":"author","type":"text"},{"name":"user","type":"text"},{"name":"comments","type":"text"}],"keys":[{"columnNames":["id"],"name":"support_tickets_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"support_tickets\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"support_tickets\" (\"description\", \"created_at\", \"author\", \"user\", \"comments\")\n VALUES ('', TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"support_tickets\" SET\n \"description\" = ''\n \"created_at\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET'\n \"author\" = ''\n \"user\" = ''\n \"comments\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"support_tickets\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.support_tickets","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('template_table_col1_seq'::regclass)","name":"col1","type":"int4"},{"name":"col3","type":"text"},{"name":"col4","type":"int4"},{"name":"col5","type":"bool"},{"name":"col2","type":"text"}],"keys":[{"columnNames":["col1"],"name":"template_table_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"template_table\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"template_table\" (\"col3\", \"col4\", \"col5\", \"col2\")\n VALUES ('', 1, '', '');"},{"title":"UPDATE","body":"UPDATE public.\"template_table\" SET\n \"col3\" = ''\n \"col4\" = 1\n \"col5\" = ''\n \"col2\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"template_table\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.template_table","type":"TABLE"},{"schema":"public","columns":[{"name":"age","type":"int4"},{"name":"username","type":"varchar"},{"name":"password","type":"varchar"},{"name":"email","type":"varchar"},{"name":"created_on","type":"timestamp"},{"name":"last_login","type":"timestamp"}],"keys":[],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"testuser\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"testuser\" (\"age\", \"username\", \"password\", \"email\", \"created_on\", \"last_login\")\n VALUES (1, '', '', '', TIMESTAMP '2019-07-01 10:00:00', TIMESTAMP '2019-07-01 10:00:00');"},{"title":"UPDATE","body":"UPDATE public.\"testuser\" SET\n \"age\" = 1\n \"username\" = ''\n \"password\" = ''\n \"email\" = ''\n \"created_on\" = TIMESTAMP '2019-07-01 10:00:00'\n \"last_login\" = 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!"},{"title":"DELETE","body":"DELETE FROM public.\"testuser\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.testuser","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('ticket_tags_id_seq'::regclass)","name":"id","type":"int4"},{"name":"ticket_id","type":"int4"},{"name":"github_tag_id","type":"text"}],"keys":[{"columnNames":["id"],"name":"ticket_tags_pkey","type":"primary key"},{"fromColumns":["ticket_id"],"name":"ticket_id_fk","toColumns":["support_tickets.id"],"type":"foreign key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"ticket_tags\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"ticket_tags\" (\"ticket_id\", \"github_tag_id\")\n VALUES (1, '');"},{"title":"UPDATE","body":"UPDATE public.\"ticket_tags\" SET\n \"ticket_id\" = 1\n \"github_tag_id\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"ticket_tags\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.ticket_tags","type":"TABLE"}]}},{"new":true,"invalids":[],"pluginId":"mongo-plugin","isValid":true,"name":"Mock Mongo","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"endpoints":[],"connection":{"mode":"READ_WRITE","type":"DIRECT","ssl":{"authType":"DEFAULT"}},"properties":[{"value":"Yes","key":"Use Mongo Connection String URI"},{"value":"mongodb+srv://mockdb-admin:****@mockdb.swrsq.mongodb.net/admin_db?retryWrites=true&w=majority","key":"Connection String URI"}]},"structure":{"tables":[{"columns":[{"name":"_id","type":"ObjectId"},{"name":"col1","type":"String"},{"name":"col2","type":"String"},{"name":"col3","type":"String"},{"name":"col4","type":"String"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"template_table\",\n \"filter\": {\n \"col1\": \"test\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"col1\": \"test\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"template_table"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"template_table\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"template_table"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"template_table\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"col1\": \"new value\",\n \"col2\": \"new value\",\n \"col3\": \"new value\",\n \"col4\": \"new value\",\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"col1\": \"new value\",\n \"col2\": \"new value\",\n \"col3\": \"new value\",\n \"col4\": \"new value\",\n}]"},{"value":"template_table"},{},{}]},{"title":"Update","body":"{\n \"update\": \"template_table\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"col1\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"col1\": \"new value\" } }"},{},{},{},{},{},{},{"value":"template_table"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"template_table\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"template_table"},{"value":"SINGLE"},{}]}],"name":"template_table","type":"COLLECTION"},{"columns":[{"name":"_id","type":"ObjectId"},{"name":"createdAt","type":"Date"},{"name":"email","type":"String"},{"name":"name","type":"String"},{"name":"role","type":"String"},{"name":"status","type":"Object"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"users\",\n \"filter\": {\n \"email\": \"[email protected]\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"email\": \"[email protected]\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"users"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"users\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"users"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"users\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"email\": \"new value\",\n \"name\": \"new value\",\n \"role\": \"new value\",\n \"status\": {},\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"email\": \"new value\",\n \"name\": \"new value\",\n \"role\": \"new value\",\n \"status\": {},\n}]"},{"value":"users"},{},{}]},{"title":"Update","body":"{\n \"update\": \"users\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"email\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"email\": \"new value\" } }"},{},{},{},{},{},{},{"value":"users"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"users\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"users"},{"value":"SINGLE"},{}]}],"name":"users","type":"COLLECTION"},{"columns":[{"name":"_id","type":"ObjectId"},{"name":"createdAt","type":"Date"},{"name":"currentLimit","type":"Integer"},{"name":"featureName","type":"String"},{"name":"key","type":"Integer"},{"name":"limit","type":"Integer"},{"name":"subscriptionId","type":"ObjectId"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"orgs\",\n \"filter\": {\n \"featureName\": \"Okuneva Inc\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"featureName\": \"Okuneva Inc\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"orgs"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"orgs\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"orgs"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"orgs\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"currentLimit\": 1,\n \"featureName\": \"new value\",\n \"key\": 1,\n \"limit\": 1,\n \"subscriptionId\": ObjectId(\"a_valid_object_id_hex\"),\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"currentLimit\": 1,\n \"featureName\": \"new value\",\n \"key\": 1,\n \"limit\": 1,\n \"subscriptionId\": ObjectId(\"a_valid_object_id_hex\"),\n}]"},{"value":"orgs"},{},{}]},{"title":"Update","body":"{\n \"update\": \"orgs\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"featureName\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"featureName\": \"new value\" } }"},{},{},{},{},{},{},{"value":"orgs"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"orgs\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"orgs"},{"value":"SINGLE"},{}]}],"name":"orgs","type":"COLLECTION"},{"columns":[{"name":"_id","type":"ObjectId"},{"name":"createdAt","type":"Date"},{"name":"createdBy","type":"ObjectId"},{"name":"domain","type":"String"},{"name":"name","type":"String"},{"name":"numUsers","type":"Integer"},{"name":"orgId","type":"ObjectId"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"apps\",\n \"filter\": {\n \"domain\": \"adolph.biz\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"domain\": \"adolph.biz\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"apps"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"apps\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"apps"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"apps\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"createdBy\": ObjectId(\"a_valid_object_id_hex\"),\n \"domain\": \"new value\",\n \"name\": \"new value\",\n \"numUsers\": 1,\n \"orgId\": ObjectId(\"a_valid_object_id_hex\"),\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"createdBy\": ObjectId(\"a_valid_object_id_hex\"),\n \"domain\": \"new value\",\n \"name\": \"new value\",\n \"numUsers\": 1,\n \"orgId\": ObjectId(\"a_valid_object_id_hex\"),\n}]"},{"value":"apps"},{},{}]},{"title":"Update","body":"{\n \"update\": \"apps\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"domain\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"domain\": \"new value\" } }"},{},{},{},{},{},{},{"value":"apps"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"apps\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"apps"},{"value":"SINGLE"},{}]}],"name":"apps","type":"COLLECTION"},{"columns":[{"name":"_id","type":"ObjectId"},{"name":"createdAt","type":"Date"},{"name":"currency","type":"String"},{"name":"mrr","type":"String"},{"name":"name","type":"String"},{"name":"renewalDate","type":"Date"},{"name":"status","type":"String"},{"name":"statusOfApp","type":"Object"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"subscriptions\",\n \"filter\": {\n \"currency\": \"RUB\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"currency\": \"RUB\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"subscriptions"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"subscriptions\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"subscriptions"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"subscriptions\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"currency\": \"new value\",\n \"mrr\": \"new value\",\n \"name\": \"new value\",\n \"renewalDate\": new Date(\"2019-07-01\"),\n \"status\": \"new value\",\n \"statusOfApp\": {},\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"currency\": \"new value\",\n \"mrr\": \"new value\",\n \"name\": \"new value\",\n \"renewalDate\": new Date(\"2019-07-01\"),\n \"status\": \"new value\",\n \"statusOfApp\": {},\n}]"},{"value":"subscriptions"},{},{}]},{"title":"Update","body":"{\n \"update\": \"subscriptions\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"currency\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"currency\": \"new value\" } }"},{},{},{},{},{},{},{"value":"subscriptions"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"subscriptions\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"subscriptions"},{"value":"SINGLE"},{}]}],"name":"subscriptions","type":"COLLECTION"}]}},{"new":true,"invalids":[],"pluginId":"redis-plugin","isValid":true,"name":"RedisTemplateApps","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"endpoints":[{"port":10339,"host":"redis-10339.c278.us-east-1-4.ec2.cloud.redislabs.com"}]},"structure":{}}],"actionList":[{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["Table1.selectedRow.col1"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"DELETE FROM public.template_table\n WHERE col1 = {{Table1.selectedRow.col1}};"},"userPermissions":[],"pageId":"SQL"},"pluginId":"postgres-plugin","id":"60d4559cee9aa1792c5bec41","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["Table1.selectedRow.col1"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"DELETE FROM public.template_table\n WHERE col1 = {{Table1.selectedRow.col1}};"},"userPermissions":[],"pageId":"SQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"INSERT INTO public.template_table (\n\tcol1,\n\tcol2, \n\tcol3,\n\tcol4, \n\tcol5\n)\nVALUES (\n\t\t\t\t{{insert_col_input1.text}}, \n\t\t\t\t{{insert_col_input2.text}}, \n\t\t\t\t{{insert_col_input3.text}}, \n\t\t\t\t{{insert_col_input4.text}}, \n\t\t\t\t{{insert_col_input5.text}}\n);","pluginSpecifiedTemplates":[{"value":true}]},"userPermissions":[],"pageId":"SQL"},"pluginId":"postgres-plugin","id":"60d4559cee9aa1792c5bec43","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"INSERT INTO public.template_table (\n\tcol1,\n\tcol2, \n\tcol3,\n\tcol4, \n\tcol5\n)\nVALUES (\n\t\t\t\t{{insert_col_input1.text}}, \n\t\t\t\t{{insert_col_input2.text}}, \n\t\t\t\t{{insert_col_input3.text}}, \n\t\t\t\t{{insert_col_input4.text}}, \n\t\t\t\t{{insert_col_input5.text}}\n);","pluginSpecifiedTemplates":[{"value":true}]},"userPermissions":[],"pageId":"SQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","Table1.selectedRow.col1","update_col_2.text","update_col_5.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"UPDATE public.template_table SET\n\t\tcol2 = '{{update_col_2.text}}',\n col3 = '{{update_col_3.text}}',\n col4 = '{{update_col_4.text}}',\n col5 = '{{update_col_5.text}}'\n WHERE col1 = {{Table1.selectedRow.col1}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"SQL"},"pluginId":"postgres-plugin","id":"60d4559cee9aa1792c5bec42","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","Table1.selectedRow.col1","update_col_2.text","update_col_5.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"UPDATE public.template_table SET\n\t\tcol2 = '{{update_col_2.text}}',\n col3 = '{{update_col_3.text}}',\n col4 = '{{update_col_4.text}}',\n col5 = '{{update_col_5.text}}'\n WHERE col1 = {{Table1.selectedRow.col1}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"SQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"SELECT * FROM public.template_table\nWHERE col2 like '%{{Table1.searchText || \"\"}}%'\nORDER BY {{col_select.selectedOptionValue}} {{order_select.selectedOptionLabel}}\nLIMIT {{Table1.pageSize}}\nOFFSET {{(Table1.pageNo - 1) * Table1.pageSize}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"SQL"},"pluginId":"postgres-plugin","id":"60d4559cee9aa1792c5bec40","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"SELECT * FROM public.template_table\nWHERE col2 like '%{{Table1.searchText || \"\"}}%'\nORDER BY {{col_select.selectedOptionValue}} {{order_select.selectedOptionLabel}}\nLIMIT {{Table1.pageSize}}\nOFFSET {{(Table1.pageNo - 1) * Table1.pageSize}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"SQL"}},{"new":false,"pluginType":"SAAS","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[8].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"GET","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"{{data_table.pageSize}}","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}","key":"rowOffset"},{"key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"},"pluginId":"google-sheets-plugin","id":"60d468c1ee9aa1792c5bec95","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[8].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"GET","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"{{data_table.pageSize}}","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}","key":"rowOffset"},{"key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"}},{"new":false,"pluginType":"SAAS","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[8].value"},{"key":"pluginSpecifiedTemplates[11].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.rowIndex","data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_ROW","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"{{data_table.pageSize}}","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}","key":"rowOffset"},{"key":"rowObject"},{"key":"rowObjects"},{"value":"{{data_table.selectedRow.rowIndex}}","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"},"pluginId":"google-sheets-plugin","id":"60d46a38ee9aa1792c5bec99","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[8].value"},{"key":"pluginSpecifiedTemplates[11].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.rowIndex","data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_ROW","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"{{data_table.pageSize}}","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}","key":"rowOffset"},{"key":"rowObject"},{"key":"rowObjects"},{"value":"{{data_table.selectedRow.rowIndex}}","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"}},{"new":false,"pluginType":"SAAS","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[9].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["colInput1.text","colInput4.text","data_table.selectedRow.rowIndex","colInput2.text","colInput3.text"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"UPDATE","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"","key":"rowOffset"},{"value":"{\n\t \"rowIndex\": {{data_table.selectedRow.rowIndex}}, \n\t\t\"col1\": \"{{colInput1.text}}\", \n\t\t\"col2\": \"{{colInput2.text}}\", \n\t\t\"col3\": \"{{colInput3.text}}\", \n\t\t\"col4\": \"{{colInput4.text}}\"\n}","key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"},"pluginId":"google-sheets-plugin","id":"60d47052ee9aa1792c5becbe","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[9].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["colInput1.text","colInput4.text","data_table.selectedRow.rowIndex","colInput2.text","colInput3.text"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"UPDATE","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"","key":"rowOffset"},{"value":"{\n\t \"rowIndex\": {{data_table.selectedRow.rowIndex}}, \n\t\t\"col1\": \"{{colInput1.text}}\", \n\t\t\"col2\": \"{{colInput2.text}}\", \n\t\t\"col3\": \"{{colInput3.text}}\", \n\t\t\"col4\": \"{{colInput4.text}}\"\n}","key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"}},{"new":false,"pluginType":"SAAS","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[9].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"APPEND","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"","key":"rowOffset"},{"value":"{ \n\t\t\"col1\": \"{{insert_col_input1.text}}\", \n\t\t\"col2\": \"{{insert_col_input2.text}}\", \n\t\t\"col3\": \"{{insert_col_input3.text}}\", \n\t\t\"col4\": \"{{insert_col_input4.text}}\",\n\t\t\"col5\": \"{{insert_col_input5.text}}\"\n}","key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"},"pluginId":"google-sheets-plugin","id":"60d47363ee9aa1792c5becc3","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[9].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"APPEND","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"","key":"rowOffset"},{"value":"{ \n\t\t\"col1\": \"{{insert_col_input1.text}}\", \n\t\t\"col2\": \"{{insert_col_input2.text}}\", \n\t\t\"col3\": \"{{insert_col_input3.text}}\", \n\t\t\"col4\": \"{{insert_col_input4.text}}\",\n\t\t\"col5\": \"{{insert_col_input5.text}}\"\n}","key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":["'Query timeout' field must be an integer between 0 and 60000"],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["FilePicker.files[this.params.fileIndex].data","(folder_name.text || folder_name.text == \"\" ? folder_name.text + \"/\" : \"\") + this.params.name"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"CreateFile","actionConfiguration":{"path":"{{(folder_name.text || folder_name.text == \"\" ? folder_name.text + \"/\" : \"\") + this.params.name}}","paginationType":"NONE","timeoutInMillisecond":100000,"encodeParamsToggle":true,"body":"{{FilePicker.files[this.params.fileIndex].data}}","pluginSpecifiedTemplates":[{"value":"UPLOAD_FILE_FROM_BODY"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60da6d3fee9aa1792c5bf5e8","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":["'Query timeout' field must be an integer between 0 and 60000"],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["FilePicker.files[this.params.fileIndex].data","(folder_name.text || folder_name.text == \"\" ? folder_name.text + \"/\" : \"\") + this.params.name"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"CreateFile","actionConfiguration":{"path":"{{(folder_name.text || folder_name.text == \"\" ? folder_name.text + \"/\" : \"\") + this.params.name}}","paginationType":"NONE","timeoutInMillisecond":100000,"encodeParamsToggle":true,"body":"{{FilePicker.files[this.params.fileIndex].data}}","pluginSpecifiedTemplates":[{"value":"UPLOAD_FILE_FROM_BODY"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[4].value"},{"key":"pluginSpecifiedTemplates[3].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["60 * 24","search_input.text"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"ListFiles","actionConfiguration":{"path":"","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","pluginSpecifiedTemplates":[{"value":"LIST"},{"value":"assets-test.appsmith.com"},{"value":"YES"},{"value":"{{ 60 * 24 }}"},{"value":"{{search_input.text}}"},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60da700cee9aa1792c5bf5e9","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[4].value"},{"key":"pluginSpecifiedTemplates[3].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["60 * 24","search_input.text"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"ListFiles","actionConfiguration":{"path":"","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","pluginSpecifiedTemplates":[{"value":"LIST"},{"value":"assets-test.appsmith.com"},{"value":"YES"},{"value":"{{ 60 * 24 }}"},{"value":"{{search_input.text}}"},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":true,"jsonPathKeys":["{...get_exported_app.data, decryptedFields: undefined, datasourceList: get_exported_app.data.datasourceList.map((source) => { return {...source, structure: appsmith.store[source.pluginId] == undefined ? {}: appsmith.store[source.pluginId].data} } ) }","branch_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://hook.integromat.com"}},"executeOnLoad":false,"isValid":true,"name":"update_template","actionConfiguration":{"path":"/uepsj7o6a0hmiodonjr7xrcqj9pixe0s","headers":[{"value":"application/json","key":"content-type"},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"app\": {{ {...get_exported_app.data, decryptedFields: undefined, datasourceList: get_exported_app.data.datasourceList.map((source) => { return {...source, structure: appsmith.store[source.pluginId] == undefined ? {}: appsmith.store[source.pluginId].data} } ) } }},\n\t\"branch\": \"{{branch_input.text}}\"\n}","httpMethod":"POST","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"},"pluginId":"restapi-plugin","id":"60daba3aee9aa1792c5bf647","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":true,"jsonPathKeys":["{...get_exported_app.data, decryptedFields: undefined, datasourceList: get_exported_app.data.datasourceList.map((source) => { return {...source, structure: appsmith.store[source.pluginId] == undefined ? {}: appsmith.store[source.pluginId].data} } ) }","branch_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://hook.integromat.com"}},"executeOnLoad":false,"isValid":true,"name":"update_template","actionConfiguration":{"path":"/uepsj7o6a0hmiodonjr7xrcqj9pixe0s","headers":[{"value":"application/json","key":"content-type"},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"app\": {{ {...get_exported_app.data, decryptedFields: undefined, datasourceList: get_exported_app.data.datasourceList.map((source) => { return {...source, structure: appsmith.store[source.pluginId] == undefined ? {}: appsmith.store[source.pluginId].data} } ) } }},\n\t\"branch\": \"{{branch_input.text}}\"\n}","httpMethod":"POST","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":false,"isValid":true,"id":"Appsmith Prod","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"get_exported_app","actionConfiguration":{"path":"/api/v1/applications/export/60d4559cee9aa1792c5bec3d","headers":[{"value":"_hjIncludedInSample=1; _hjSessionTooLarge=1; _ga=GA1.2.572027528.1599035590; SL_C_23361dd035530_KEY=c370af0df0edf38360adbefbdc47d2b42ea137c9; ajs_user_id=%22nikhil%40appsmith.com%22; ajs_anonymous_id=%2213c846f6-970b-41e1-925f-f8f4a92ea315%22; SL_C_23361dd035530_SID=laR0iYdLzA-; SL_C_23361dd035530_VID=EDGoRechnrX; _hjid=da2ef5e3-4ea5-42dc-b892-7962b7564098; [email protected]; ajs_anonymous_id=13c846f6-970b-41e1-925f-f8f4a92ea315; intercom-id-y10e7138=a7d5577a-ac9b-4f96-93df-c3f86f2b7548; SESSION=21e71ab1-7ef2-4987-b430-1ab002edbd6b; _gid=GA1.2.1874210412.1627809109; amplitude_id_fef1e872c952688acd962d30aa545b9eappsmith.com=eyJkZXZpY2VJZCI6IjU5ZjhhZTJlLTgzYjQtNDY5My1hZjA4LTM2ZGRkZjBjNGJiYlIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYyODE0NzgzNzQ1NiwibGFzdEV2ZW50VGltZSI6MTYyODE0NzgzNzQ1NywiZXZlbnRJZCI6MSwiaWRlbnRpZnlJZCI6MCwic2VxdWVuY2VOdW1iZXIiOjF9; _hjAbsoluteSessionInProgress=0; _hjIncludedInPageviewSample=1; mp_70b8ea94d623dd857fb555a76d11f944_mixpanel=%7B%22distinct_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24device_id%22%3A%20%221787d3b4aab392-0b46f81f3f91ff-1633685c-1aeaa0-1787d3b4aac48d%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%2C%22mp_lib%22%3A%20%22Segment%3A%20web%22%2C%22%24user_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22mp_name_tag%22%3A%20%22nikhil%40appsmith.com%22%2C%22userId%22%3A%20%22nikhil%40appsmith.com%22%2C%22source%22%3A%20%22cloud%22%2C%22id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24email%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24first_name%22%3A%20%22Nikhil%22%2C%22%24last_name%22%3A%20%22Nandagopal%22%2C%22%24name%22%3A%20%22Nikhil%20Nandagopal%22%2C%22utm_source%22%3A%20%22ActiveCampaign%22%2C%22utm_medium%22%3A%20%22email%22%2C%22utm_campaign%22%3A%20%22Day%201%20Nudge%20after%20Sign%20up%22%2C%22utm_content%22%3A%20%22Does%20appsmith%20use%20appsmith%3F%20%F0%9F%A4%94%22%7D; intercom-session-y10e7138=Nkxsd3kzTnVDTC9VcnEzbnNGZFRkWUZ0MG00RzByb2c5YXFOdmM4THpzcHZNYzgwUHdmazdWYXpLb3pkNVRGMy0tcDVLbld2UDJudThPTEQ5d1hZR1BhZz09--fc315a38af2f912c348ca1aa8cdbb9dad2b39c3f","key":"Cookie"},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"},"pluginId":"restapi-plugin","id":"60dabb35ee9aa1792c5bf648","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":false,"isValid":true,"id":"Appsmith Prod","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"get_exported_app","actionConfiguration":{"path":"/api/v1/applications/export/60d4559cee9aa1792c5bec3d","headers":[{"value":"_hjIncludedInSample=1; _hjSessionTooLarge=1; _ga=GA1.2.572027528.1599035590; SL_C_23361dd035530_KEY=c370af0df0edf38360adbefbdc47d2b42ea137c9; ajs_user_id=%22nikhil%40appsmith.com%22; ajs_anonymous_id=%2213c846f6-970b-41e1-925f-f8f4a92ea315%22; SL_C_23361dd035530_SID=laR0iYdLzA-; SL_C_23361dd035530_VID=EDGoRechnrX; _hjid=da2ef5e3-4ea5-42dc-b892-7962b7564098; [email protected]; ajs_anonymous_id=13c846f6-970b-41e1-925f-f8f4a92ea315; intercom-id-y10e7138=a7d5577a-ac9b-4f96-93df-c3f86f2b7548; SESSION=21e71ab1-7ef2-4987-b430-1ab002edbd6b; _gid=GA1.2.1874210412.1627809109; amplitude_id_fef1e872c952688acd962d30aa545b9eappsmith.com=eyJkZXZpY2VJZCI6IjU5ZjhhZTJlLTgzYjQtNDY5My1hZjA4LTM2ZGRkZjBjNGJiYlIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYyODE0NzgzNzQ1NiwibGFzdEV2ZW50VGltZSI6MTYyODE0NzgzNzQ1NywiZXZlbnRJZCI6MSwiaWRlbnRpZnlJZCI6MCwic2VxdWVuY2VOdW1iZXIiOjF9; _hjAbsoluteSessionInProgress=0; _hjIncludedInPageviewSample=1; mp_70b8ea94d623dd857fb555a76d11f944_mixpanel=%7B%22distinct_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24device_id%22%3A%20%221787d3b4aab392-0b46f81f3f91ff-1633685c-1aeaa0-1787d3b4aac48d%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%2C%22mp_lib%22%3A%20%22Segment%3A%20web%22%2C%22%24user_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22mp_name_tag%22%3A%20%22nikhil%40appsmith.com%22%2C%22userId%22%3A%20%22nikhil%40appsmith.com%22%2C%22source%22%3A%20%22cloud%22%2C%22id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24email%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24first_name%22%3A%20%22Nikhil%22%2C%22%24last_name%22%3A%20%22Nandagopal%22%2C%22%24name%22%3A%20%22Nikhil%20Nandagopal%22%2C%22utm_source%22%3A%20%22ActiveCampaign%22%2C%22utm_medium%22%3A%20%22email%22%2C%22utm_campaign%22%3A%20%22Day%201%20Nudge%20after%20Sign%20up%22%2C%22utm_content%22%3A%20%22Does%20appsmith%20use%20appsmith%3F%20%F0%9F%A4%94%22%7D; intercom-session-y10e7138=Nkxsd3kzTnVDTC9VcnEzbnNGZFRkWUZ0MG00RzByb2c5YXFOdmM4THpzcHZNYzgwUHdmazdWYXpLb3pkNVRGMy0tcDVLbld2UDJudThPTEQ5d1hZR1BhZz09--fc315a38af2f912c348ca1aa8cdbb9dad2b39c3f","key":"Cookie"},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":["this.params.id"],"datasource":{"new":false,"isValid":true,"id":"Appsmith Prod","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"get_datasource_structure","actionConfiguration":{"path":"/api/v1/datasources/{{this.params.id}}/structure","headers":[],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"},"pluginId":"restapi-plugin","id":"60dabca0ee9aa1792c5bf649","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":["this.params.id"],"datasource":{"new":false,"isValid":true,"id":"Appsmith Prod","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"get_datasource_structure","actionConfiguration":{"path":"/api/v1/datasources/{{this.params.id}}/structure","headers":[],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["select_cols_input.text","datasource_input.text.split(\"applications/\")[1].split(\"/\")[0]","datasource_input.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]","search_col_input.text","tableName_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_sql_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{tableName_input.text}}\",\n \"datasourceId\": \"{{datasource_input.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]}}\",\n \"applicationId\" : \"{{datasource_input.text.split(\"applications/\")[1].split(\"/\")[0]}}\",\n\t\t\"searchColumn\": \"{{search_col_input.text}}\",\n\t\t\"columns\": \"{{select_cols_input.text}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"},"pluginId":"restapi-plugin","id":"60dadb5aee9aa1792c5bf6bc","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["select_cols_input.text","datasource_input.text.split(\"applications/\")[1].split(\"/\")[0]","datasource_input.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]","search_col_input.text","tableName_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_sql_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{tableName_input.text}}\",\n \"datasourceId\": \"{{datasource_input.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]}}\",\n \"applicationId\" : \"{{datasource_input.text.split(\"applications/\")[1].split(\"/\")[0]}}\",\n\t\t\"searchColumn\": \"{{search_col_input.text}}\",\n\t\t\"columns\": \"{{select_cols_input.text}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[4].value"},{"key":"pluginSpecifiedTemplates[7].value"},{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[3].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["key_select.selectedOptionValue","data_table.pageSize","data_table.searchText||\"\"","order_select.selectedOptionValue","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FindQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":false},{"value":"FORM"},{"value":"FIND"},{"value":"{ col2: /{{data_table.searchText||\"\"}}/i }"},{"value":"{ \n{{key_select.selectedOptionValue}}: {{order_select.selectedOptionValue}} \n}"},null,{"value":"{{data_table.pageSize}}"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}"},null,null,null,null,null,null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"},"pluginId":"mongo-plugin","id":"60db015aee9aa1792c5bf778","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[4].value"},{"key":"pluginSpecifiedTemplates[7].value"},{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[3].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["key_select.selectedOptionValue","data_table.pageSize","data_table.searchText||\"\"","order_select.selectedOptionValue","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FindQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":false},{"value":"FORM"},{"value":"FIND"},{"value":"{ col2: /{{data_table.searchText||\"\"}}/i }"},{"value":"{ \n{{key_select.selectedOptionValue}}: {{order_select.selectedOptionValue}} \n}"},null,{"value":"{{data_table.pageSize}}"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}"},null,null,null,null,null,null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[13].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow._ref","data_table.selectedRow._id"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"path":"template_table/{{data_table.selectedRow._ref}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_DOCUMENT"},{"value":"FORM"},{"value":"DELETE"},null,null,null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"},"pluginId":"mongo-plugin","id":"60db0325ee9aa1792c5bf77e","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[13].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow._ref","data_table.selectedRow._id"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"path":"template_table/{{data_table.selectedRow._ref}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_DOCUMENT"},{"value":"FORM"},{"value":"DELETE"},null,null,null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[11].value"},{"key":"pluginSpecifiedTemplates[12].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","update_col_2.text","data_table.selectedRow._id","update_col_1.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},{"value":"{\n \"col1\" : {{update_col_1.text}},\n\t\"col2\" : {{update_col_2.text}},\n \"col3\" : {{update_col_3.text}},\n \"col4\" : {{update_col_4.text}}\n}"},null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"},"pluginId":"mongo-plugin","id":"60db034dee9aa1792c5bf77f","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[11].value"},{"key":"pluginSpecifiedTemplates[12].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","update_col_2.text","data_table.selectedRow._id","update_col_1.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},{"value":"{\n \"col1\" : {{update_col_1.text}},\n\t\"col2\" : {{update_col_2.text}},\n \"col3\" : {{update_col_3.text}},\n \"col4\" : {{update_col_4.text}}\n}"},null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[18].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"value":"{\n \"col1\": {{insert_col_input1.text}}, \n \"col2\": {{insert_col_input2.text}}, \n \"col3\": {{insert_col_input3.text}}, \n \"col4\": {{insert_col_input4.text}}\n}"},{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"},"pluginId":"mongo-plugin","id":"60db03dcee9aa1792c5bf781","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[18].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"value":"{\n \"col1\": {{insert_col_input1.text}}, \n \"col2\": {{insert_col_input2.text}}, \n \"col3\": {{insert_col_input3.text}}, \n \"col4\": {{insert_col_input4.text}}\n}"},{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["mongo_ds_url.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]","collection_input.text","search_keys_input.text","mongo_ds_url.text.split(\"applications/\")[1].split(\"/\")[0]"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_mongo_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{collection_input.text}}\",\n \"datasourceId\": \"{{mongo_ds_url.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]}}\",\n \"applicationId\" : \"{{mongo_ds_url.text.split(\"applications/\")[1].split(\"/\")[0]}}\",\n\t\t\"searchColumn\" : \"{{search_keys_input.text}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"},"pluginId":"restapi-plugin","id":"60dc1a0aee9aa1792c5bf9a5","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["mongo_ds_url.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]","collection_input.text","search_keys_input.text","mongo_ds_url.text.split(\"applications/\")[1].split(\"/\")[0]"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_mongo_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{collection_input.text}}\",\n \"datasourceId\": \"{{mongo_ds_url.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]}}\",\n \"applicationId\" : \"{{mongo_ds_url.text.split(\"applications/\")[1].split(\"/\")[0]}}\",\n\t\t\"searchColumn\" : \"{{search_keys_input.text}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["gsheet_ds_input.text.split(\"datasources/\")[1].split(\"/\" || \"?\")[0]","gsheet_ds_input.text.split(\"applications/\")[1].split(\"/\")[0]","collection_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_gsheet_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{collection_input.text}}\",\n \"datasourceId\": \"{{gsheet_ds_input.text.split(\"datasources/\")[1].split(\"/\" || \"?\")[0]}}\",\n \"applicationId\" : \"{{gsheet_ds_input.text.split(\"applications/\")[1].split(\"/\")[0]}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"},"pluginId":"restapi-plugin","id":"60dc1a22ee9aa1792c5bf9a8","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["gsheet_ds_input.text.split(\"datasources/\")[1].split(\"/\" || \"?\")[0]","gsheet_ds_input.text.split(\"applications/\")[1].split(\"/\")[0]","collection_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_gsheet_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{collection_input.text}}\",\n \"datasourceId\": \"{{gsheet_ds_input.text.split(\"datasources/\")[1].split(\"/\" || \"?\")[0]}}\",\n \"applicationId\" : \"{{gsheet_ds_input.text.split(\"applications/\")[1].split(\"/\")[0]}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["File_List.selectedItem.fileName"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteFile","actionConfiguration":{"path":"{{File_List.selectedItem.fileName}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_FILE"},{"value":"assets-test.appsmith.com"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60e6cb8c646724139a549885","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["File_List.selectedItem.fileName"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteFile","actionConfiguration":{"path":"{{File_List.selectedItem.fileName}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_FILE"},{"value":"assets-test.appsmith.com"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["File_List.selectedItem.fileName"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"ReadFile","actionConfiguration":{"path":"{{File_List.selectedItem.fileName}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","pluginSpecifiedTemplates":[{"value":"READ_FILE"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60e6d7c3646724139a5498c4","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["File_List.selectedItem.fileName"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"ReadFile","actionConfiguration":{"path":"{{File_List.selectedItem.fileName}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","pluginSpecifiedTemplates":[{"value":"READ_FILE"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_file_picker.files.length ? update_file_picker.files[0].data : \"\"","update_file_name.text"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateFile","actionConfiguration":{"path":"{{update_file_name.text}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{{update_file_picker.files.length ? update_file_picker.files[0].data : \"\" }}","pluginSpecifiedTemplates":[{"value":"UPLOAD_FILE_FROM_BODY"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60e6edae646724139a549925","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_file_picker.files.length ? update_file_picker.files[0].data : \"\"","update_file_name.text"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateFile","actionConfiguration":{"path":"{{update_file_name.text}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{{update_file_picker.files.length ? update_file_picker.files[0].data : \"\" }}","pluginSpecifiedTemplates":[{"value":"UPLOAD_FILE_FROM_BODY"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow._ref.path","data_table.selectedRow._id"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"path":"{{data_table.selectedRow._ref.path}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_DOCUMENT"},{"value":"FORM"},{"value":"DELETE"},null,null,null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"firestore-plugin","id":"60ec1d85a5109b1d752d75df","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow._ref.path","data_table.selectedRow._id"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"path":"{{data_table.selectedRow._ref.path}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_DOCUMENT"},{"value":"FORM"},{"value":"DELETE"},null,null,null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","update_col_2.text","data_table.selectedRow._ref.path","update_col_1.text","update_col_5.text","data_table.selectedRow._id","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"path":"{{data_table.selectedRow._ref.path}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"col1\": \"{{update_col_1.text}}\",\n\t\"col2\": \"{{update_col_2.text}}\",\n\t\"col3\": \"{{update_col_3.text}}\",\n\t\"col4\": \"{{update_col_4.text}}\",\n\t\"col5\": \"{{update_col_5.text}}\"\n}","pluginSpecifiedTemplates":[{"value":"UPDATE_DOCUMENT"},{"value":"FORM"},{"value":"UPDATE"},null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},{"value":"{\n \"col1\" : {{update_col_1.text}},\n\t\"col2\" : {{update_col_2.text}},\n \"col3\" : {{update_col_3.text}},\n \"col4\" : {{update_col_4.text}}\n}"},null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"firestore-plugin","id":"60ec1d85a5109b1d752d75de","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","update_col_2.text","data_table.selectedRow._ref.path","update_col_1.text","update_col_5.text","data_table.selectedRow._id","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"path":"{{data_table.selectedRow._ref.path}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"col1\": \"{{update_col_1.text}}\",\n\t\"col2\": \"{{update_col_2.text}}\",\n\t\"col3\": \"{{update_col_3.text}}\",\n\t\"col4\": \"{{update_col_4.text}}\",\n\t\"col5\": \"{{update_col_5.text}}\"\n}","pluginSpecifiedTemplates":[{"value":"UPDATE_DOCUMENT"},{"value":"FORM"},{"value":"UPDATE"},null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},{"value":"{\n \"col1\" : {{update_col_1.text}},\n\t\"col2\" : {{update_col_2.text}},\n \"col3\" : {{update_col_3.text}},\n \"col4\" : {{update_col_4.text}}\n}"},null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"path":"template_table","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"col1\": \"{{insert_col_input1.text}}\",\n\t\"col2\": \"{{insert_col_input2.text}}\",\n\t\"col3\": \"{{insert_col_input3.text}}\",\n\t\"col4\": \"{{insert_col_input4.text}}\",\n\t\"col5\": \"{{insert_col_input5.text}}\"\n}","pluginSpecifiedTemplates":[{"value":"ADD_TO_COLLECTION"},{"value":"FORM"},{"value":"INSERT"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"value":"{\n \"col1\": {{insert_col_input1.text}}, \n \"col2\": {{insert_col_input2.text}}, \n \"col3\": {{insert_col_input3.text}}, \n \"col4\": {{insert_col_input4.text}}\n}"},{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"firestore-plugin","id":"60ec1d85a5109b1d752d75e1","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"path":"template_table","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"col1\": \"{{insert_col_input1.text}}\",\n\t\"col2\": \"{{insert_col_input2.text}}\",\n\t\"col3\": \"{{insert_col_input3.text}}\",\n\t\"col4\": \"{{insert_col_input4.text}}\",\n\t\"col5\": \"{{insert_col_input5.text}}\"\n}","pluginSpecifiedTemplates":[{"value":"ADD_TO_COLLECTION"},{"value":"FORM"},{"value":"INSERT"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"value":"{\n \"col1\": {{insert_col_input1.text}}, \n \"col2\": {{insert_col_input2.text}}, \n \"col3\": {{insert_col_input3.text}}, \n \"col4\": {{insert_col_input4.text}}\n}"},{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":true,"invalids":["No datasource configuration found. Please configure it and try again."],"pluginId":"restapi-plugin","isValid":false,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"Api1","actionConfiguration":{"headers":[{"value":"","key":""},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"restapi-plugin","id":"60ec2e7aa5109b1d752d7621","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":true,"invalids":["No datasource configuration found. Please configure it and try again."],"pluginId":"restapi-plugin","isValid":false,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"Api1","actionConfiguration":{"headers":[{"value":"","key":""},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[1].value"},{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[7].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["SelectQuery.data[SelectQuery.data.length - 1]","order_select.selectedOptionValue + key_select.selectedOptionValue","SelectQuery.data[0]"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"path":"template_table","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"GET_COLLECTION","key":"method"},{"value":"[\"{{order_select.selectedOptionValue + key_select.selectedOptionValue}}\"]","key":"orderBy"},{"value":"1","key":"limit"},{"key":"whereConditionTuples"},null,null,{"value":"{{SelectQuery.data[SelectQuery.data.length - 1]}}","key":"limit"},{"value":"{{SelectQuery.data[0]}}","key":"limit"},{"value":"","key":"timestampValuePath"},{"value":"","key":"deleteKeyValuePairPath"}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"firestore-plugin","id":"60ee9cafa5109b1d752d7b7b","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[1].value"},{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[7].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["SelectQuery.data[SelectQuery.data.length - 1]","order_select.selectedOptionValue + key_select.selectedOptionValue","SelectQuery.data[0]"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"path":"template_table","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"GET_COLLECTION","key":"method"},{"value":"[\"{{order_select.selectedOptionValue + key_select.selectedOptionValue}}\"]","key":"orderBy"},{"value":"1","key":"limit"},{"key":"whereConditionTuples"},null,null,{"value":"{{SelectQuery.data[SelectQuery.data.length - 1]}}","key":"limit"},{"value":"{{SelectQuery.data[0]}}","key":"limit"},{"value":"","key":"timestampValuePath"},{"value":"","key":"deleteKeyValuePairPath"}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FetchKeys","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"keys *"},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeaf83a5109b1d752d7bab","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FetchKeys","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"keys *"},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_key_input.text","insert_value_input.text"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"set {{insert_key_input.text}} \"{{insert_value_input.text}}\""},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeb2f2a5109b1d752d7bb3","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_key_input.text","insert_value_input.text"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"set {{insert_key_input.text}} \"{{insert_value_input.text}}\""},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_value_input.text","data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"set {{data_table.selectedRow.result}} \"{{update_value_input.text}}\""},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeb563a5109b1d752d7bbc","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_value_input.text","data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"set {{data_table.selectedRow.result}} \"{{update_value_input.text}}\""},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"del {{data_table.selectedRow.result}}"},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeb5caa5109b1d752d7bbd","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"del {{data_table.selectedRow.result}}"},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FetchValue","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"GET {{data_table.selectedRow.result}}"},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeb8eda5109b1d752d7bc3","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FetchValue","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"GET {{data_table.selectedRow.result}}"},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","Table1.selectedRow.col1","update_col_2.text","update_col_5.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"UPDATE public.template_table SET\n\t\t\"col2\" = '{{update_col_2.text}}',\n \"col3\" = '{{update_col_3.text}}',\n \"col4\" = '{{update_col_4.text}}',\n \"col5\" = '{{update_col_5.text}}'\n WHERE \"col1\" = {{Table1.selectedRow.col1}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"PostgreSQL"},"pluginId":"postgres-plugin","id":"60f68221d4c0bb105f54dfd2","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","Table1.selectedRow.col1","update_col_2.text","update_col_5.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"UPDATE public.template_table SET\n\t\t\"col2\" = '{{update_col_2.text}}',\n \"col3\" = '{{update_col_3.text}}',\n \"col4\" = '{{update_col_4.text}}',\n \"col5\" = '{{update_col_5.text}}'\n WHERE \"col1\" = {{Table1.selectedRow.col1}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"PostgreSQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["Table1.selectedRow.col1"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"DELETE FROM public.template_table\n WHERE \"col1\" = {{Table1.selectedRow.col1}};"},"userPermissions":[],"pageId":"PostgreSQL"},"pluginId":"postgres-plugin","id":"60f68221d4c0bb105f54dfd3","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["Table1.selectedRow.col1"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"DELETE FROM public.template_table\n WHERE \"col1\" = {{Table1.selectedRow.col1}};"},"userPermissions":[],"pageId":"PostgreSQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"SELECT * FROM public.template_table\nWHERE \"col2\" ilike '%{{Table1.searchText || \"\"}}%'\nORDER BY \"{{col_select.selectedOptionValue}}\" {{order_select.selectedOptionLabel}}\nLIMIT {{Table1.pageSize}}\nOFFSET {{(Table1.pageNo - 1) * Table1.pageSize}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"PostgreSQL"},"pluginId":"postgres-plugin","id":"60f68221d4c0bb105f54dfd4","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"SELECT * FROM public.template_table\nWHERE \"col2\" ilike '%{{Table1.searchText || \"\"}}%'\nORDER BY \"{{col_select.selectedOptionValue}}\" {{order_select.selectedOptionLabel}}\nLIMIT {{Table1.pageSize}}\nOFFSET {{(Table1.pageNo - 1) * Table1.pageSize}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"PostgreSQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"INSERT INTO public.template_table (\n\t\"col1\",\n\t\"col2\", \n\t\"col3\",\n\t\"col4\", \n\t\"col5\"\n)\nVALUES (\n\t\t\t\t{{insert_col_input1.text}}, \n\t\t\t\t{{insert_col_input2.text}}, \n\t\t\t\t{{insert_col_input3.text}}, \n\t\t\t\t{{insert_col_input4.text}}, \n\t\t\t\t{{insert_col_input5.text}}\n);","pluginSpecifiedTemplates":[{"value":true}]},"userPermissions":[],"pageId":"PostgreSQL"},"pluginId":"postgres-plugin","id":"60f68221d4c0bb105f54dfd5","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"INSERT INTO public.template_table (\n\t\"col1\",\n\t\"col2\", \n\t\"col3\",\n\t\"col4\", \n\t\"col5\"\n)\nVALUES (\n\t\t\t\t{{insert_col_input1.text}}, \n\t\t\t\t{{insert_col_input2.text}}, \n\t\t\t\t{{insert_col_input3.text}}, \n\t\t\t\t{{insert_col_input4.text}}, \n\t\t\t\t{{insert_col_input5.text}}\n);","pluginSpecifiedTemplates":[{"value":true}]},"userPermissions":[],"pageId":"PostgreSQL"}}],"unpublishedLayoutmongoEscapedWidgets":{"60dafddaee9aa1792c5bf76d":["data_table"]},"pageList":[{"publishedPage":{"name":"SQL","userPermissions":[],"layouts":[{"new":false,"id":"60d4559cee9aa1792c5bec3e","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60d4559cee9aa1792c5bec40"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":800,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":880,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Table1","columnOrder":["col1","col2","col3","col4","col5","customColumn1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","fontStyle":"","textColor":"","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"col_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"ASC","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"ASC\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"DESC\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"9t3vdjd5xj","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"5rfqxgj0vm","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!Table1.selectedRow.col1}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col4}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row: {{Table1.selectedRow.col1}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"},{"widgetName":"Text20","rightColumn":18,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"SQL","userPermissions":[],"layouts":[{"new":false,"id":"60d4559cee9aa1792c5bec3e","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60d4559cee9aa1792c5bec40"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":800,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":880,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Table1","columnOrder":["col1","col2","col3","col4","col5","customColumn1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","fontStyle":"","textColor":"","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"col_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"ASC","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"ASC\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"DESC\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"9t3vdjd5xj","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"5rfqxgj0vm","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!Table1.selectedRow.col1}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col4}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row: {{Table1.selectedRow.col1}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"},{"widgetName":"Text20","rightColumn":18,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Google Sheets","userPermissions":[],"layouts":[{"new":false,"id":"60d45c59ee9aa1792c5bec5a","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"SAAS","jsonPathKeys":["data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60d468c1ee9aa1792c5bec95"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":966,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":870,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["col1","col2","col3","col4","rowIndex","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":6,"bottomRow":84,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"}],"dynamicBindingPathList":[{"key":"tableData"},{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"primaryColumns.rowIndex.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col1.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"rowIndex":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.rowIndex))}}","textSize":"PARAGRAPH","index":4,"isVisible":false,"label":"rowIndex","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"rowIndex","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{deleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"step":62,"status":75,"col1":140}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":41,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":39,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":18.8828125,"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text11","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Alert"},{"widgetName":"Button1","rightColumn":48,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":16,"bottomRow":20,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"delete_button","rightColumn":64,"onClick":"{{(function () {\nDeleteQuery.run(() => showAlert('Row successfully deleted!','success'), () => showAlert('Something went wrong! Please check debugger for more info.','error'));\ncloseModal('Delete_Modal');\nSelectQuery.run();\n})()}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":16,"bottomRow":20,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":60,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"hqtpvn9ut2","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"ipc9o3ksyi","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"hqtpvn9ut2","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"FormButton1","rightColumn":63,"onClick":"{{(function () {\nInsertQuery.run(() =>{ \t\tshowAlert('Item successfully inserted!','success');\ncloseModal('Insert_Modal');\nSelectQuery.run();\n}, (error) => showAlert(error,'error'));\n})()}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"s2jtkzz2ub","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"FormButton2","rightColumn":45,"isDefaultClickDisabled":true,"widgetId":"396envygmb","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Reset"},{"widgetName":"Text21","rightColumn":18,"textAlign":"RIGHT","widgetId":"vwgogtczul","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"cbz2r2wizv","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col1}}","isDisabled":false},{"widgetName":"Text22","rightColumn":18,"textAlign":"RIGHT","widgetId":"t2a63abehn","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"tjrktjwn9c","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","defaultText":"","placeholderText":"{{data_table.tableData[0].col2}}","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"0xqhj661rj","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"et0p9va1yw","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col3}}","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"mxztke60bg","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"wp3nuhaz7m","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col4}}","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"2xn45kukrz","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"lqhw4zvrts","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col5}}","isDisabled":false},{"widgetName":"Text13","rightColumn":35,"textAlign":"LEFT","widgetId":"iuydklwdo3","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"ipc9o3ksyi","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{data_table.selectedRowIndex >= 0}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":60,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":39,"dynamicBindingPathList":[],"text":"Update"},{"isRequired":false,"widgetName":"colInput1","rightColumn":60,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":18,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput2","rightColumn":60,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput3","rightColumn":60,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput4","rightColumn":60,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row Index: {{data_table.selectedRow.rowIndex}}"},{"widgetName":"col_text_1","rightColumn":18,"textAlign":"LEFT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"widgetName":"col_text_2","rightColumn":19,"textAlign":"LEFT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"widgetName":"col_text_3","rightColumn":19,"textAlign":"LEFT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"widgetName":"col_text_4","rightColumn":19,"textAlign":"LEFT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Google Sheets","userPermissions":[],"layouts":[{"new":false,"id":"60d45c59ee9aa1792c5bec5a","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"SAAS","jsonPathKeys":["data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60d468c1ee9aa1792c5bec95"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":870,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["col1","col2","col3","col4","rowIndex","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":6,"bottomRow":84,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"}],"dynamicBindingPathList":[{"key":"tableData"},{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"primaryColumns.rowIndex.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col1.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"rowIndex":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.rowIndex))}}","textSize":"PARAGRAPH","index":4,"isVisible":false,"label":"rowIndex","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"rowIndex","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{deleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"step":62,"status":75,"col1":140}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":41,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":39,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":18.8828125,"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text11","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Alert"},{"widgetName":"Button1","rightColumn":48,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":16,"bottomRow":20,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"delete_button","rightColumn":64,"onClick":"{{(function () {\nDeleteQuery.run(() =>{ showAlert('Row successfully deleted!','success');\t\t\t\t\t\t\t\tSelectQuery.run();\n}, () => showAlert('Something went wrong! Please check debugger for more info.','error'));\ncloseModal('Delete_Modal');\n})()}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":16,"bottomRow":20,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":60,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"hqtpvn9ut2","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"ipc9o3ksyi","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"hqtpvn9ut2","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"FormButton1","rightColumn":63,"onClick":"{{(function () {\nInsertQuery.run(() =>{ \t\tshowAlert('Item successfully inserted!','success');\ncloseModal('Insert_Modal');\nSelectQuery.run();\n}, (error) => showAlert(error,'error'));\n})()}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"s2jtkzz2ub","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"FormButton2","rightColumn":45,"isDefaultClickDisabled":true,"widgetId":"396envygmb","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Reset"},{"widgetName":"Text21","rightColumn":18,"textAlign":"RIGHT","widgetId":"vwgogtczul","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"cbz2r2wizv","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col1}}","isDisabled":false},{"widgetName":"Text22","rightColumn":18,"textAlign":"RIGHT","widgetId":"t2a63abehn","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"tjrktjwn9c","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","defaultText":"","placeholderText":"{{data_table.tableData[0].col2}}","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"0xqhj661rj","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"et0p9va1yw","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col3}}","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"mxztke60bg","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"wp3nuhaz7m","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col4}}","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"2xn45kukrz","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"lqhw4zvrts","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col5}}","isDisabled":false},{"widgetName":"Text13","rightColumn":35,"textAlign":"LEFT","widgetId":"iuydklwdo3","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"ipc9o3ksyi","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{data_table.selectedRowIndex >= 0}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":60,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":39,"dynamicBindingPathList":[],"text":"Update"},{"isRequired":false,"widgetName":"colInput1","rightColumn":60,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":18,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput2","rightColumn":60,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput3","rightColumn":60,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput4","rightColumn":60,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row Index: {{data_table.selectedRow.rowIndex}}"},{"widgetName":"col_text_1","rightColumn":18,"textAlign":"LEFT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"widgetName":"col_text_2","rightColumn":19,"textAlign":"LEFT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"widgetName":"col_text_3","rightColumn":19,"textAlign":"LEFT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"widgetName":"col_text_4","rightColumn":19,"textAlign":"LEFT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"S3","userPermissions":[],"layouts":[{"new":false,"id":"60da6c7aee9aa1792c5bf5e4","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["60 * 24","search_input.text"],"name":"ListFiles","timeoutInMillisecond":10000,"id":"60da700cee9aa1792c5bf5e9"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":1720,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":1250,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container3","rightColumn":64,"widgetId":"th4d9oxy8z","containerStyle":"card","topRow":5,"bottomRow":101,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"leftColumn":0,"children":[{"widgetName":"Canvas4","rightColumn":634,"detachFromLayout":true,"widgetId":"6tz2s7ivi5","containerStyle":"none","topRow":0,"bottomRow":1020,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"th4d9oxy8z","minHeight":960,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":false,"onTextChanged":"{{ListFiles.run()}}","widgetName":"search_input","rightColumn":19,"widgetId":"0llmlojupa","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"6tz2s7ivi5","isLoading":false,"parentColumnSpace":19.5,"dynamicTriggerPathList":[{"key":"onTextChanged"}],"resetOnSubmit":true,"leftColumn":0,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"Search File Prefix","defaultText":"","isDisabled":false},{"template":{"Image4":{"image":"{{File_List.listData.map((currentItem) => {\n return (function(){\n return ( currentItem.signedUrl );\n })();\n })}}","widgetName":"Image4","rightColumn":48,"objectFit":"contain","widgetId":"k9t673b0fu","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"enableDownload":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"enableRotation":true,"defaultImage":true},"topRow":1,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"maxZoomLevel":1,"enableDownload":false,"parentColumnSpace":19.0625,"imageShape":"RECTANGLE","leftColumn":32,"enableRotation":false,"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"},"Text16":{"text":"{{File_List.listData.map((currentItem) => {\n return (function(){\n return ( currentItem.fileName );\n })();\n })}}","shouldScroll":true},"download_button":{"onClick":"{{navigateTo(currentItem.signedUrl, {})}}"}},"childAutoComplete":{"currentItem":{"fileName":"","urlExpiryDate":"","signedUrl":""}},"backgroundColor":"","widgetName":"File_List","rightColumn":64,"itemBackgroundColor":"#FFFFFF","listData":"{{ListFiles.data}}","widgetId":"p9xuxpwwuc","topRow":5,"bottomRow":94,"parentRowSpace":10,"isVisible":true,"type":"LIST_WIDGET","parentId":"6tz2s7ivi5","gridGap":"10","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[{"key":"template.download_button.onClick"}],"leftColumn":0,"dynamicBindingPathList":[{"key":"listData"},{"key":"template.Image4.image"},{"key":"template.Text16.text"}],"gridType":"vertical","enhancements":true,"children":[{"widgetName":"Canvas11","rightColumn":634,"detachFromLayout":true,"widgetId":"jczf6u7ji9","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"p9xuxpwwuc","openParentPropertyPane":true,"minHeight":890,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"backgroundColor":"white","widgetName":"Container5","rightColumn":64,"disallowCopy":true,"widgetId":"aiiokpktqq","containerStyle":"card","topRow":0,"bottomRow":16,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"jczf6u7ji9","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":[{"widgetName":"Canvas12","detachFromLayout":true,"widgetId":"qxtrflb6ki","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"aiiokpktqq","minHeight":160,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text16","rightColumn":43,"textAlign":"LEFT","widgetId":"fnla1fasgx","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"fontSize":true,"text":true},"topRow":1,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[],"leftColumn":11,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{currentItem.fileName}}"},{"widgetName":"download_button","rightColumn":48,"onClick":"{{navigateTo(currentItem.signedUrl, {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"wqenprx82s","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":41,"dynamicBindingPathList":[],"text":"Download","isDisabled":false},{"widgetName":"Button5","rightColumn":56,"onClick":"{{copyToClipboard(File_List.selectedItem.signedUrl)}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"47abcy9ml3","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":49,"dynamicBindingPathList":[],"text":"Copy URL","isDisabled":false},{"widgetName":"Button14","rightColumn":40,"onClick":"{{showModal('Edit_Modal')}}","isDefaultClickDisabled":true,"widgetId":"0xc28a5g77","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":33,"dynamicBindingPathList":[],"text":"Update","isDisabled":false},{"widgetName":"delete_button","rightColumn":64,"onClick":"{{showModal('delete_modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"ge7ws9hdfv","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"DANGER_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":57,"dynamicBindingPathList":[],"text":"Delete","isDisabled":false},{"image":"{{currentItem.signedUrl}}","widgetName":"Image4","rightColumn":10,"objectFit":"contain","widgetId":"k9t673b0fu","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"enableDownload":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"enableRotation":true,"defaultImage":true},"topRow":0,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"maxZoomLevel":1,"enableDownload":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"enableRotation":false,"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"}]}],"disablePropertyPane":true}]}]}]}]},{"widgetName":"Text6","rightColumn":37,"backgroundColor":"","textAlign":"LEFT","widgetId":"t54ituq472","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#2E3D49","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Bucket"},{"widgetName":"Upload_Files_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"1fxorj7v97","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":0,"detachFromLayout":true,"widgetId":"d8io5ijwj4","topRow":0,"bottomRow":620,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"1fxorj7v97","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"FilePicker","dynamicPropertyPathList":[],"topRow":11,"bottomRow":15,"parentRowSpace":10,"allowedFileTypes":["*","image/*","video/*","audio/*","text/*",".doc","image/jpeg",".png"],"type":"FILE_PICKER_WIDGET","parentColumnSpace":19.5,"dynamicTriggerPathList":[{"key":"onFilesSelected"}],"leftColumn":17,"dynamicBindingPathList":[],"isDisabled":false,"onFilesSelected":"","isRequired":true,"rightColumn":63,"isDefaultClickDisabled":true,"widgetId":"322pwxcdcp","defaultSelectedFiles":[],"isVisible":true,"label":"Select Files","maxFileSize":"5","version":1,"fileDataType":"Base64","parentId":"d8io5ijwj4","selectedFiles":[],"isLoading":false,"files":[],"maxNumFiles":"3"},{"widgetName":"Icon1","rightColumn":64,"onClick":"{{closeModal('Upload_Files_Modal')}}","color":"#040627","iconName":"cross","widgetId":"qoq5qcqwn3","topRow":0,"bottomRow":4,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"d8io5ijwj4","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text7","rightColumn":40,"textAlign":"LEFT","widgetId":"caavmyb2hq","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"d8io5ijwj4","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Upload Files"},{"widgetName":"Button8","rightColumn":42,"onClick":"{{closeModal('Upload_Files_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"ha7jsexyny","buttonStyle":"SECONDARY_BUTTON","topRow":54,"bottomRow":58,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"d8io5ijwj4","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":30,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"upload_button","rightColumn":64,"onClick":"{{\nFilePicker.files.forEach((file, index) => {\n\tCreateFile.run((response, params)=> { showAlert('File Uploaded','success'); \nif (params.isLastFile) {\n\tListFiles.run(() => {closeModal('Upload_Files_Modal'); resetWidget('FilePicker')})\t\n}\n}\n\t, () => showAlert('File Upload Failed','error')\t\n\t, {fileIndex: index, name: selected_files.items[index].update_files_name.text, isLastFile: index == (FilePicker.files.length - 1), });\n\treturn true;\n})\n}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"},{"key":"isDisabled"}],"widgetId":"hk4wlj8lqk","buttonStyle":"PRIMARY_BUTTON","topRow":54,"bottomRow":58,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"d8io5ijwj4","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":42,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Upload","isDisabled":"{{ selected_files.items.length == 0 || selected_files.items.map((file) => file.update_files_name.text).includes(\"\") }}"},{"widgetName":"Text9","rightColumn":16,"textAlign":"RIGHT","widgetId":"5rnwbi4l7l","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"d8io5ijwj4","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Upload Folder"},{"isRequired":false,"widgetName":"folder_name","rightColumn":63,"widgetId":"xy36b926b7","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"d8io5ijwj4","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":17,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"folder/sub-folder","isDisabled":false},{"template":{"update_files_name":{"isRequired":false,"widgetName":"update_files_name","rightColumn":52,"widgetId":"a2tpi1lssb","logBlackList":{"isRequired":true,"widgetName":true,"rightColumn":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"label":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"resetOnSubmit":true,"leftColumn":true,"inputType":true,"isDisabled":true},"topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"parentColumnSpace":7.3125,"resetOnSubmit":true,"leftColumn":32,"inputType":"TEXT","defaultText":"{{selected_files.listData.map((currentItem) => {\n return (function(){\n return currentItem.name;\n })();\n })}}","isDisabled":false},"Image2":{"image":"{{selected_files.listData.map((currentItem) => {\n return (function(){\n return currentItem.base64;\n })();\n })}}","widgetName":"Image2","rightColumn":17,"objectFit":"cover","widgetId":"fqtm26urc8","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"defaultImage":true},"topRow":5,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"maxZoomLevel":1,"parentColumnSpace":7.3125,"imageShape":"RECTANGLE","leftColumn":1,"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"},"Text14":{"widgetName":"Text14","rightColumn":40,"textAlign":"RIGHT","widgetId":"5o9832t0pg","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"dynamicTriggerPathList":[],"dynamicBindingPathList":[{"key":"text"}],"leftColumn":16,"fontSize":"PARAGRAPH","text":"File Name","textStyle":"HEADING"}},"childAutoComplete":{"currentItem":{"data":"","base64":"","name":"","raw":"","id":"","text":"","type":""}},"widgetName":"selected_files","backgroundColor":"","rightColumn":64,"listData":"{{FilePicker.files}}","dynamicPropertyPathList":[{"key":"isVisible"}],"itemBackgroundColor":"#FFFFFF","widgetId":"8j571uwl0l","topRow":18,"bottomRow":48,"parentRowSpace":10,"isVisible":"{{FilePicker.files.length > 0}}","type":"LIST_WIDGET","parentId":"d8io5ijwj4","gridGap":0,"isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[{"key":"listData"},{"key":"template.update_files_name.defaultText"},{"key":"isVisible"},{"key":"template.Image2.image"}],"gridType":"vertical","enhancements":true,"children":[{"widgetName":"Canvas7","rightColumn":256,"detachFromLayout":true,"widgetId":"2b0x8h3zyv","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"8j571uwl0l","openParentPropertyPane":true,"minHeight":300,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"backgroundColor":"white","widgetName":"Container4","rightColumn":64,"disallowCopy":true,"widgetId":"60y08tm87w","containerStyle":"card","topRow":0,"bottomRow":8,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"2b0x8h3zyv","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":[{"widgetName":"Canvas8","detachFromLayout":true,"widgetId":"h6xtuzmqwr","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"60y08tm87w","minHeight":80,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text14","rightColumn":23,"textAlign":"RIGHT","widgetId":"5o9832t0pg","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"dynamicTriggerPathList":true,"parentColumnSpace":true,"dynamicBindingPathList":true,"leftColumn":true,"fontSize":true,"text":true,"textStyle":true},"topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":11,"fontSize":"PARAGRAPH","text":"File Name","textStyle":"HEADING"},{"isRequired":false,"widgetName":"update_files_name","rightColumn":63,"widgetId":"a2tpi1lssb","logBlackList":{"isRequired":true,"widgetName":true,"rightColumn":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"label":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"resetOnSubmit":true,"leftColumn":true,"inputType":true,"isDisabled":true},"topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":23,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{currentItem.name}}","isDisabled":false},{"image":"{{currentItem.base64}}","widgetName":"Image2","rightColumn":10,"objectFit":"cover","widgetId":"fqtm26urc8","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"defaultImage":true},"topRow":0,"bottomRow":6,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"maxZoomLevel":1,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"}]}],"disablePropertyPane":true}]}]}],"isDisabled":false}]},{"widgetName":"delete_modal","rightColumn":0,"detachFromLayout":true,"widgetId":"9g0cw9adf8","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas6","rightColumn":0,"detachFromLayout":true,"widgetId":"ozvpoudxz2","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"9g0cw9adf8","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon2","rightColumn":64,"onClick":"{{closeModal('delete_modal')}}","color":"#040627","iconName":"cross","widgetId":"xkyh49z71e","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text12","rightColumn":41,"textAlign":"LEFT","widgetId":"s1y44xm547","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete File"},{"widgetName":"Button10","rightColumn":48,"onClick":"{{closeModal('delete_modal')}}","isDefaultClickDisabled":true,"widgetId":"pi0t67rnwh","buttonStyle":"SECONDARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Button11","rightColumn":64,"onClick":"{{DeleteFile.run(() => ListFiles.run(() => closeModal('delete_modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"hp22uj3dra","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text13","rightColumn":64,"textAlign":"LEFT","widgetId":"oypa9ad1tg","topRow":5,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ozvpoudxz2","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete the file?\n\n{{File_List.selectedItem.fileName}}"}],"isDisabled":false}]},{"widgetName":"add_files_button","rightColumn":64,"onClick":"{{showModal('Upload_Files_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o8of2mic83","buttonStyle":"PRIMARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":56,"dynamicBindingPathList":[],"text":"Add Files","isDisabled":false},{"widgetName":"Zoom_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"p4buulj86a","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas9","rightColumn":0,"detachFromLayout":true,"widgetId":"p3cxdtb4wp","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"p4buulj86a","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3","rightColumn":64,"onClick":"{{closeModal('Zoom_Modal')}}","color":"#040627","iconName":"cross","widgetId":"b49lgvj9yy","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text15","rightColumn":41,"textAlign":"LEFT","widgetId":"cy38v3de8z","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Zoom Image"},{"widgetName":"Button13","rightColumn":63,"onClick":"{{closeModal('Zoom_Modal')}}","isDefaultClickDisabled":true,"widgetId":"ftst3w9m8m","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":47,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"image":"{{File_List.selectedItem.signedUrl}}","widgetName":"Image3","rightColumn":64,"objectFit":"cover","widgetId":"a5gy0pdfzn","topRow":6,"bottomRow":51,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"maxZoomLevel":8,"parentColumnSpace":8,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":1,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"}],"isDisabled":false}]},{"widgetName":"Edit_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"usealgbtyj","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas10","rightColumn":0,"detachFromLayout":true,"widgetId":"6i7m9kpuky","topRow":0,"bottomRow":240,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"usealgbtyj","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon4","rightColumn":64,"onClick":"{{closeModal('Edit_Modal')}}","color":"#040627","iconName":"cross","widgetId":"pstfdcc1e4","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text17","rightColumn":41,"textAlign":"LEFT","widgetId":"z64z3l112n","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Update File"},{"widgetName":"Button15","rightColumn":44,"onClick":"{{closeModal('Edit_Modal')}}","isDefaultClickDisabled":true,"widgetId":"trc4e6ylcz","buttonStyle":"SECONDARY_BUTTON","topRow":18,"bottomRow":22,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":32,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"update_button","rightColumn":64,"onClick":"{{UpdateFile.run(() => ListFiles.run(() => {resetWidget('update_file_picker');closeModal('Edit_Modal');}), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"},{"key":"isDisabled"}],"widgetId":"8lbthc9dml","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":44,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Update","isDisabled":"{{update_file_picker.files.length == 0}}"},{"widgetName":"Text18","rightColumn":17,"textAlign":"RIGHT","widgetId":"qb26g34etr","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"6i7m9kpuky","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"File Name"},{"isRequired":false,"widgetName":"update_file_name","rightColumn":64,"widgetId":"je0ea8ma5d","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":17,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{File_List.selectedItem.fileName}}","isDisabled":true},{"widgetName":"update_file_picker","topRow":11,"bottomRow":15,"parentRowSpace":10,"allowedFileTypes":["*","image/*","video/*","audio/*","text/*",".doc","image/jpeg",".png"],"type":"FILE_PICKER_WIDGET","parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":17,"dynamicBindingPathList":[],"isDisabled":false,"isRequired":false,"rightColumn":64,"isDefaultClickDisabled":true,"widgetId":"mioot5pcs5","defaultSelectedFiles":[],"isVisible":true,"label":"Select File","maxFileSize":"10","version":1,"fileDataType":"Base64","parentId":"6i7m9kpuky","selectedFiles":[],"isLoading":false,"files":[],"maxNumFiles":1}],"isDisabled":false}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"S3","userPermissions":[],"layouts":[{"new":false,"id":"60da6c7aee9aa1792c5bf5e4","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["60 * 24","search_input.text"],"name":"ListFiles","timeoutInMillisecond":10000,"id":"60da700cee9aa1792c5bf5e9"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":966,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":1720,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":1250,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container3","rightColumn":64,"widgetId":"th4d9oxy8z","containerStyle":"card","topRow":5,"bottomRow":101,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"leftColumn":0,"children":[{"widgetName":"Canvas4","rightColumn":634,"detachFromLayout":true,"widgetId":"6tz2s7ivi5","containerStyle":"none","topRow":0,"bottomRow":1020,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"th4d9oxy8z","minHeight":960,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":false,"onTextChanged":"{{ListFiles.run()}}","widgetName":"search_input","rightColumn":19,"widgetId":"0llmlojupa","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"6tz2s7ivi5","isLoading":false,"parentColumnSpace":19.5,"dynamicTriggerPathList":[{"key":"onTextChanged"}],"resetOnSubmit":true,"leftColumn":0,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"Search File Prefix","defaultText":"","isDisabled":false},{"template":{"Image4":{"image":"{{File_List.listData.map((currentItem) => {\n return (function(){\n return ( currentItem.signedUrl );\n })();\n })}}","widgetName":"Image4","rightColumn":48,"objectFit":"contain","widgetId":"k9t673b0fu","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"enableDownload":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"enableRotation":true,"defaultImage":true},"topRow":1,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"maxZoomLevel":1,"enableDownload":false,"parentColumnSpace":19.0625,"imageShape":"RECTANGLE","leftColumn":32,"enableRotation":false,"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"},"Text16":{"text":"{{File_List.listData.map((currentItem) => {\n return (function(){\n return ( currentItem.fileName );\n })();\n })}}","shouldScroll":true},"download_button":{"onClick":"{{navigateTo(currentItem.signedUrl, {})}}"}},"childAutoComplete":{"currentItem":{"fileName":"","urlExpiryDate":"","signedUrl":""}},"backgroundColor":"","widgetName":"File_List","rightColumn":64,"itemBackgroundColor":"#FFFFFF","listData":"{{ListFiles.data}}","widgetId":"p9xuxpwwuc","topRow":5,"bottomRow":94,"parentRowSpace":10,"isVisible":true,"type":"LIST_WIDGET","parentId":"6tz2s7ivi5","gridGap":"10","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[{"key":"template.download_button.onClick"}],"leftColumn":0,"dynamicBindingPathList":[{"key":"listData"},{"key":"template.Image4.image"},{"key":"template.Text16.text"}],"gridType":"vertical","enhancements":true,"children":[{"widgetName":"Canvas11","rightColumn":634,"detachFromLayout":true,"widgetId":"jczf6u7ji9","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"p9xuxpwwuc","openParentPropertyPane":true,"minHeight":890,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"backgroundColor":"white","widgetName":"Container5","rightColumn":64,"disallowCopy":true,"widgetId":"aiiokpktqq","containerStyle":"card","topRow":0,"bottomRow":16,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"jczf6u7ji9","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":[{"widgetName":"Canvas12","detachFromLayout":true,"widgetId":"qxtrflb6ki","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"aiiokpktqq","minHeight":160,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text16","rightColumn":43,"textAlign":"LEFT","widgetId":"fnla1fasgx","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"fontSize":true,"text":true},"topRow":1,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[],"leftColumn":11,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{currentItem.fileName}}"},{"widgetName":"download_button","rightColumn":48,"onClick":"{{navigateTo(currentItem.signedUrl, {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"wqenprx82s","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":41,"dynamicBindingPathList":[],"text":"Download","isDisabled":false},{"widgetName":"Button5","rightColumn":56,"onClick":"{{copyToClipboard(File_List.selectedItem.signedUrl)}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"47abcy9ml3","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":49,"dynamicBindingPathList":[],"text":"Copy URL","isDisabled":false},{"widgetName":"Button14","rightColumn":40,"onClick":"{{showModal('Edit_Modal')}}","isDefaultClickDisabled":true,"widgetId":"0xc28a5g77","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":33,"dynamicBindingPathList":[],"text":"Update","isDisabled":false},{"widgetName":"delete_button","rightColumn":64,"onClick":"{{showModal('delete_modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"ge7ws9hdfv","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"DANGER_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":57,"dynamicBindingPathList":[],"text":"Delete","isDisabled":false},{"image":"{{currentItem.signedUrl}}","widgetName":"Image4","rightColumn":10,"objectFit":"contain","widgetId":"k9t673b0fu","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"enableDownload":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"enableRotation":true,"defaultImage":true},"topRow":0,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"maxZoomLevel":1,"enableDownload":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"enableRotation":false,"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"}]}],"disablePropertyPane":true}]}]}]}]},{"widgetName":"Text6","rightColumn":37,"backgroundColor":"","textAlign":"LEFT","widgetId":"t54ituq472","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#2E3D49","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Bucket"},{"widgetName":"Upload_Files_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"1fxorj7v97","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":0,"detachFromLayout":true,"widgetId":"d8io5ijwj4","topRow":0,"bottomRow":620,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"1fxorj7v97","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"FilePicker","dynamicPropertyPathList":[{"key":"onFilesSelected"}],"topRow":11,"bottomRow":15,"parentRowSpace":10,"allowedFileTypes":["*","image/*","video/*","audio/*","text/*",".doc","image/jpeg",".png"],"type":"FILE_PICKER_WIDGET","parentColumnSpace":19.5,"dynamicTriggerPathList":[{"key":"onFilesSelected"}],"leftColumn":17,"dynamicBindingPathList":[],"isDisabled":false,"onFilesSelected":"","isRequired":true,"rightColumn":63,"isDefaultClickDisabled":true,"widgetId":"322pwxcdcp","defaultSelectedFiles":[],"isVisible":true,"label":"Select Files","maxFileSize":"5","version":1,"fileDataType":"Base64","parentId":"d8io5ijwj4","selectedFiles":[],"isLoading":false,"files":[],"maxNumFiles":"3"},{"widgetName":"Icon1","rightColumn":64,"onClick":"{{closeModal('Upload_Files_Modal')}}","color":"#040627","iconName":"cross","widgetId":"qoq5qcqwn3","topRow":0,"bottomRow":4,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"d8io5ijwj4","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text7","rightColumn":40,"textAlign":"LEFT","widgetId":"caavmyb2hq","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"d8io5ijwj4","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Upload Files"},{"widgetName":"Button8","rightColumn":42,"onClick":"{{closeModal('Upload_Files_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"ha7jsexyny","buttonStyle":"SECONDARY_BUTTON","topRow":54,"bottomRow":58,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"d8io5ijwj4","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":30,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"upload_button","rightColumn":64,"onClick":"{{\nFilePicker.files.forEach((file, index) => {\n\tCreateFile.run((response, params)=> { showAlert('File Uploaded','success'); \nif (params.isLastFile) {\n\tListFiles.run(() => {closeModal('Upload_Files_Modal'); resetWidget('FilePicker')})\t\n}\n}\n\t, () => showAlert('File Upload Failed','error')\t\n\t, {fileIndex: index, name: selected_files.items[index].update_files_name.text, isLastFile: index == (FilePicker.files.length - 1), });\n\treturn true;\n})\n}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"},{"key":"isDisabled"}],"widgetId":"hk4wlj8lqk","buttonStyle":"PRIMARY_BUTTON","topRow":54,"bottomRow":58,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"d8io5ijwj4","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":42,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Upload","isDisabled":"{{ selected_files.items.length == 0 || selected_files.items.map((file) => file.update_files_name.text).includes(\"\") }}"},{"widgetName":"Text9","rightColumn":16,"textAlign":"RIGHT","widgetId":"5rnwbi4l7l","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"d8io5ijwj4","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Upload Folder"},{"isRequired":false,"widgetName":"folder_name","rightColumn":63,"widgetId":"xy36b926b7","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"d8io5ijwj4","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":17,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"folder/sub-folder","isDisabled":false},{"template":{"update_files_name":{"isRequired":false,"widgetName":"update_files_name","rightColumn":52,"widgetId":"a2tpi1lssb","logBlackList":{"isRequired":true,"widgetName":true,"rightColumn":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"label":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"resetOnSubmit":true,"leftColumn":true,"inputType":true,"isDisabled":true},"topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"parentColumnSpace":7.3125,"resetOnSubmit":true,"leftColumn":32,"inputType":"TEXT","defaultText":"{{selected_files.listData.map((currentItem) => {\n return (function(){\n return currentItem.name;\n })();\n })}}","isDisabled":false},"Image2":{"image":"{{selected_files.listData.map((currentItem) => {\n return (function(){\n return currentItem.base64;\n })();\n })}}","widgetName":"Image2","rightColumn":17,"objectFit":"cover","widgetId":"fqtm26urc8","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"defaultImage":true},"topRow":5,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"maxZoomLevel":1,"parentColumnSpace":7.3125,"imageShape":"RECTANGLE","leftColumn":1,"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"},"Text14":{"widgetName":"Text14","rightColumn":40,"textAlign":"RIGHT","widgetId":"5o9832t0pg","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"dynamicTriggerPathList":[],"dynamicBindingPathList":[{"key":"text"}],"leftColumn":16,"fontSize":"PARAGRAPH","text":"File Name","textStyle":"HEADING"}},"childAutoComplete":{"currentItem":{}},"widgetName":"selected_files","backgroundColor":"","rightColumn":64,"listData":"{{FilePicker.files}}","dynamicPropertyPathList":[{"key":"isVisible"}],"itemBackgroundColor":"#FFFFFF","widgetId":"8j571uwl0l","topRow":18,"bottomRow":52,"parentRowSpace":10,"isVisible":"{{FilePicker.files.length > 0}}","type":"LIST_WIDGET","parentId":"d8io5ijwj4","gridGap":0,"isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[{"key":"listData"},{"key":"template.update_files_name.defaultText"},{"key":"isVisible"},{"key":"template.Image2.image"}],"gridType":"vertical","enhancements":true,"children":[{"widgetName":"Canvas7","rightColumn":256,"detachFromLayout":true,"widgetId":"2b0x8h3zyv","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"8j571uwl0l","openParentPropertyPane":true,"minHeight":340,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"backgroundColor":"white","widgetName":"Container4","rightColumn":64,"disallowCopy":true,"widgetId":"60y08tm87w","containerStyle":"card","topRow":0,"bottomRow":8,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"2b0x8h3zyv","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":[{"widgetName":"Canvas8","detachFromLayout":true,"widgetId":"h6xtuzmqwr","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"60y08tm87w","minHeight":80,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text14","rightColumn":23,"textAlign":"RIGHT","widgetId":"5o9832t0pg","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"dynamicTriggerPathList":true,"parentColumnSpace":true,"dynamicBindingPathList":true,"leftColumn":true,"fontSize":true,"text":true,"textStyle":true},"topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":11,"fontSize":"PARAGRAPH","text":"File Name","textStyle":"HEADING"},{"isRequired":false,"widgetName":"update_files_name","rightColumn":63,"widgetId":"a2tpi1lssb","logBlackList":{"isRequired":true,"widgetName":true,"rightColumn":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"label":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"resetOnSubmit":true,"leftColumn":true,"inputType":true,"isDisabled":true},"topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":23,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{currentItem.name}}","isDisabled":false},{"image":"{{currentItem.base64}}","widgetName":"Image2","rightColumn":10,"objectFit":"cover","widgetId":"fqtm26urc8","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"defaultImage":true},"topRow":0,"bottomRow":6,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"h6xtuzmqwr","isLoading":false,"maxZoomLevel":1,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"}]}],"disablePropertyPane":true}]}]}],"isDisabled":false}]},{"widgetName":"delete_modal","rightColumn":0,"detachFromLayout":true,"widgetId":"9g0cw9adf8","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas6","rightColumn":0,"detachFromLayout":true,"widgetId":"ozvpoudxz2","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"9g0cw9adf8","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon2","rightColumn":64,"onClick":"{{closeModal('delete_modal')}}","color":"#040627","iconName":"cross","widgetId":"xkyh49z71e","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text12","rightColumn":41,"textAlign":"LEFT","widgetId":"s1y44xm547","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete File"},{"widgetName":"Button10","rightColumn":48,"onClick":"{{closeModal('delete_modal')}}","isDefaultClickDisabled":true,"widgetId":"pi0t67rnwh","buttonStyle":"SECONDARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Button11","rightColumn":64,"onClick":"{{DeleteFile.run(() => ListFiles.run(() => closeModal('delete_modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"hp22uj3dra","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text13","rightColumn":64,"textAlign":"LEFT","widgetId":"oypa9ad1tg","topRow":5,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ozvpoudxz2","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete the file?\n\n{{File_List.selectedItem.fileName}}"}],"isDisabled":false}]},{"widgetName":"add_files_button","rightColumn":64,"onClick":"{{showModal('Upload_Files_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o8of2mic83","buttonStyle":"PRIMARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":56,"dynamicBindingPathList":[],"text":"Add Files","isDisabled":false},{"widgetName":"Zoom_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"p4buulj86a","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas9","rightColumn":0,"detachFromLayout":true,"widgetId":"p3cxdtb4wp","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"p4buulj86a","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3","rightColumn":64,"onClick":"{{closeModal('Zoom_Modal')}}","color":"#040627","iconName":"cross","widgetId":"b49lgvj9yy","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text15","rightColumn":41,"textAlign":"LEFT","widgetId":"cy38v3de8z","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Zoom Image"},{"widgetName":"Button13","rightColumn":63,"onClick":"{{closeModal('Zoom_Modal')}}","isDefaultClickDisabled":true,"widgetId":"ftst3w9m8m","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":47,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"image":"{{File_List.selectedItem.signedUrl}}","widgetName":"Image3","rightColumn":64,"objectFit":"cover","widgetId":"a5gy0pdfzn","topRow":6,"bottomRow":51,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"maxZoomLevel":8,"parentColumnSpace":8,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":1,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"}],"isDisabled":false}]},{"widgetName":"Edit_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"usealgbtyj","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas10","rightColumn":0,"detachFromLayout":true,"widgetId":"6i7m9kpuky","topRow":0,"bottomRow":240,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"usealgbtyj","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon4","rightColumn":64,"onClick":"{{closeModal('Edit_Modal')}}","color":"#040627","iconName":"cross","widgetId":"pstfdcc1e4","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text17","rightColumn":41,"textAlign":"LEFT","widgetId":"z64z3l112n","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Update File"},{"widgetName":"Button15","rightColumn":44,"onClick":"{{closeModal('Edit_Modal')}}","isDefaultClickDisabled":true,"widgetId":"trc4e6ylcz","buttonStyle":"SECONDARY_BUTTON","topRow":18,"bottomRow":22,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":32,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"update_button","rightColumn":64,"onClick":"{{UpdateFile.run(() => ListFiles.run(() => {resetWidget('update_file_picker');closeModal('Edit_Modal');}), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"},{"key":"isDisabled"}],"widgetId":"8lbthc9dml","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":44,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Update","isDisabled":"{{update_file_picker.files.length == 0}}"},{"widgetName":"Text18","rightColumn":17,"textAlign":"RIGHT","widgetId":"qb26g34etr","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"6i7m9kpuky","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"File Name"},{"isRequired":false,"widgetName":"update_file_name","rightColumn":64,"widgetId":"je0ea8ma5d","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":17,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{File_List.selectedItem.fileName}}","isDisabled":true},{"widgetName":"update_file_picker","topRow":11,"bottomRow":15,"parentRowSpace":10,"allowedFileTypes":["*","image/*","video/*","audio/*","text/*",".doc","image/jpeg",".png"],"type":"FILE_PICKER_WIDGET","parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":17,"dynamicBindingPathList":[],"isDisabled":false,"isRequired":false,"rightColumn":64,"isDefaultClickDisabled":true,"widgetId":"mioot5pcs5","defaultSelectedFiles":[],"isVisible":true,"label":"Select File","maxFileSize":"10","version":1,"fileDataType":"Base64","parentId":"6i7m9kpuky","selectedFiles":[],"isLoading":false,"files":[],"maxNumFiles":1}],"isDisabled":false}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Admin","userPermissions":[],"layouts":[{"new":false,"id":"60dab9efee9aa1792c5bf645","userPermissions":[],"layoutOnLoadActions":[],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":910,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":800,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Form1","backgroundColor":"#2E3D49","rightColumn":45,"widgetId":"hdpwx2szs0","topRow":5,"bottomRow":86,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas1","rightColumn":554.75,"detachFromLayout":true,"widgetId":"kwx6oz4fub","containerStyle":"none","topRow":0,"bottomRow":830,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"hdpwx2szs0","minHeight":810,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text1","rightColumn":36,"textAlign":"LEFT","widgetId":"7fqtlu52np","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Update App Template"},{"widgetName":"Text2","rightColumn":61,"textAlign":"LEFT","widgetId":"w2l08fshj2","topRow":10,"bottomRow":62,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"shouldScroll":true,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{\"<pre>\" + JSON.stringify(get_exported_app.data, null, 2) + \"</pre>\" || \"Fetch The App\"}}"},{"widgetName":"Button1","rightColumn":21,"onClick":"{{\n get_exported_app.run(() => {\n \tconst arr = JSON.parse(datasource_arr.text);\n\t\tarr.map((row) => { get_datasource_structure.run((res, params) => {\n storeValue(params.name, res); \n },undefined, row)\n })\n })\n}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"2vtg0qdlqv","buttonStyle":"PRIMARY_BUTTON","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":3,"dynamicBindingPathList":[],"text":"Fetch App","isDisabled":false},{"widgetName":"Button2","rightColumn":63,"onClick":"{{update_template.run(() => showAlert('Template Updated','success'), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"isDisabled"}],"widgetId":"jg23u09rwk","buttonStyle":"PRIMARY_BUTTON","topRow":72,"bottomRow":76,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":4,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Deploy","isDisabled":"{{get_exported_app.data.exportedApplication === undefined}}"},{"isRequired":false,"widgetName":"branch_input","rightColumn":49,"widgetId":"d6shlon0z2","topRow":63,"bottomRow":67,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":12,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"Branch name","defaultText":"update-crud-template","isDisabled":false},{"widgetName":"Text3","rightColumn":12,"textAlign":"LEFT","widgetId":"y57v1yp7vb","topRow":63,"bottomRow":67,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"HEADING3","text":"Branch"},{"widgetName":"Text4","rightColumn":63,"backgroundColor":"#DD4B34","textAlign":"LEFT","widgetId":"fanskapltd","topRow":67,"bottomRow":71,"parentRowSpace":10,"isVisible":true,"fontStyle":"","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Note : Please use update-crud-template branch to avoid TCs failing in release"}]}]},{"widgetName":"datasource_arr","rightColumn":16,"textAlign":"LEFT","widgetId":"znji9afu2q","topRow":1,"bottomRow":35,"parentRowSpace":10,"isVisible":false,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"[\n{ \"name\":\"mongo-plugin\",\n\"id\": \"60dafedaee9aa1792c5bf773\"\n},\n{ \"name\":\"postgres-plugin\",\n\"id\": \"5fcdd652b0e807468e3b493b\"\n}, {\n\"name\": \"GSheets\", \"id\": \"60c744d93535574772b64363\"\n}\n]"}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Admin","userPermissions":[],"layouts":[{"new":false,"id":"60dab9efee9aa1792c5bf645","userPermissions":[],"layoutOnLoadActions":[],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":910,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":800,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Form1","backgroundColor":"#2E3D49","rightColumn":45,"widgetId":"hdpwx2szs0","topRow":5,"bottomRow":86,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas1","rightColumn":554.75,"detachFromLayout":true,"widgetId":"kwx6oz4fub","containerStyle":"none","topRow":0,"bottomRow":830,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"hdpwx2szs0","minHeight":810,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text1","rightColumn":36,"textAlign":"LEFT","widgetId":"7fqtlu52np","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Update App Template"},{"widgetName":"Text2","rightColumn":61,"textAlign":"LEFT","widgetId":"w2l08fshj2","topRow":10,"bottomRow":62,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"shouldScroll":true,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{\"<pre>\" + JSON.stringify(get_exported_app.data, null, 2) + \"</pre>\" || \"Fetch The App\"}}"},{"widgetName":"Button1","rightColumn":21,"onClick":"{{\n get_exported_app.run(() => {\n \tconst arr = JSON.parse(datasource_arr.text);\n\t\tarr.map((row) => { get_datasource_structure.run((res, params) => {\n storeValue(params.name, res); \n },undefined, row)\n })\n })\n}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"2vtg0qdlqv","buttonStyle":"PRIMARY_BUTTON","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":3,"dynamicBindingPathList":[],"text":"Fetch App","isDisabled":false},{"widgetName":"Button2","rightColumn":63,"onClick":"{{update_template.run(() => showAlert('Template Updated','success'), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"isDisabled"}],"widgetId":"jg23u09rwk","buttonStyle":"PRIMARY_BUTTON","topRow":72,"bottomRow":76,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":4,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Deploy","isDisabled":"{{get_exported_app.data.exportedApplication === undefined}}"},{"isRequired":false,"widgetName":"branch_input","rightColumn":49,"widgetId":"d6shlon0z2","topRow":63,"bottomRow":67,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":12,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"Branch name","defaultText":"update-crud-template","isDisabled":false},{"widgetName":"Text3","rightColumn":12,"textAlign":"LEFT","widgetId":"y57v1yp7vb","topRow":63,"bottomRow":67,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"HEADING3","text":"Branch"},{"widgetName":"Text4","rightColumn":63,"backgroundColor":"#DD4B34","textAlign":"LEFT","widgetId":"fanskapltd","topRow":67,"bottomRow":71,"parentRowSpace":10,"isVisible":true,"fontStyle":"","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Note : Please use update-crud-template branch to avoid TCs failing in release"}]}]},{"widgetName":"datasource_arr","rightColumn":16,"textAlign":"LEFT","widgetId":"znji9afu2q","topRow":1,"bottomRow":35,"parentRowSpace":10,"isVisible":false,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"[\n{ \"name\":\"mongo-plugin\",\n\"id\": \"60dafedaee9aa1792c5bf773\"\n},\n{ \"name\":\"postgres-plugin\",\n\"id\": \"5fcdd652b0e807468e3b493b\"\n}, {\n\"name\": \"GSheets\", \"id\": \"60c744d93535574772b64363\"\n}\n]"}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Page Generator","userPermissions":[],"layouts":[{"new":false,"id":"60dadae5ee9aa1792c5bf6b8","userPermissions":[],"layoutOnLoadActions":[],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":880,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":28,"minHeight":860,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Tabs1","rightColumn":44,"widgetId":"jalvzswyyk","defaultTab":"SQL","topRow":13,"bottomRow":54,"shouldShowTabs":true,"parentRowSpace":10,"tabsObj":{"tab1":{"widgetId":"nyka98xqpv","index":0,"label":"SQL","id":"tab1","isVisible":true},"tab2":{"widgetId":"neexe4fljs","index":1,"label":"GSheet","id":"tab2","isVisible":true},"tab7qxuerb9p7":{"widgetId":"4yqoh4fjmv","id":"tab7qxuerb9p7","label":"Mongo","isVisible":true}},"isVisible":true,"type":"TABS_WIDGET","version":3,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":15,"dynamicBindingPathList":[],"children":[{"tabId":"tab1","tabName":"SQL","rightColumn":634,"widgetName":"Canvas2","detachFromLayout":true,"widgetId":"nyka98xqpv","topRow":0,"bottomRow":430,"parentRowSpace":1,"type":"CANVAS_WIDGET","parentId":"jalvzswyyk","isLoading":false,"renderMode":"CANVAS","minHeight":410,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":false,"widgetName":"tableName_input","rightColumn":63,"widgetId":"f8k5jt9mjm","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"isRequired":false,"widgetName":"datasource_input","rightColumn":63,"widgetId":"4j1xd4hih9","topRow":3,"bottomRow":7,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text2","rightColumn":14,"textAlign":"RIGHT","widgetId":"957c72jpan","topRow":3,"bottomRow":7,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Datasource URL"},{"widgetName":"Text4","rightColumn":14,"textAlign":"RIGHT","widgetId":"nz74xi3ae3","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Table Name"},{"widgetName":"Text6","rightColumn":14,"textAlign":"RIGHT","widgetId":"s1i89k31f5","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Columns to Select"},{"isRequired":false,"widgetName":"select_cols_input","rightColumn":63,"widgetId":"pwt5ybili3","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text7","rightColumn":14,"textAlign":"RIGHT","widgetId":"rbacxz6brz","topRow":25,"bottomRow":29,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Column to Search"},{"isRequired":false,"widgetName":"search_col_input","rightColumn":63,"widgetId":"bnro1si5sz","topRow":25,"bottomRow":29,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"resetFormOnClick":false,"widgetName":"FormButton1","rightColumn":63,"onClick":"{{generate_sql_app.run(() => showAlert('Page Created!','success'), () => {})}}","isDefaultClickDisabled":true,"widgetId":"n6220hgzzs","buttonStyle":"PRIMARY_BUTTON","topRow":31,"bottomRow":35,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Generate"}]},{"tabId":"tab2","tabName":"GSheet","rightColumn":634,"widgetName":"Canvas3","detachFromLayout":true,"widgetId":"neexe4fljs","topRow":0,"bottomRow":400,"parentRowSpace":1,"type":"CANVAS_WIDGET","parentId":"jalvzswyyk","isLoading":false,"renderMode":"CANVAS","minHeight":410,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text8","rightColumn":16,"textAlign":"RIGHT","widgetId":"3ghywz6tk6","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"DataSource URL"},{"isRequired":false,"widgetName":"gsheet_ds_input","rightColumn":62,"widgetId":"a8kpjqdp59","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text9","rightColumn":16,"textAlign":"RIGHT","widgetId":"r6o12im1qd","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"SpreadSheet URL"},{"isRequired":false,"widgetName":"spreadsheet_input","rightColumn":62,"widgetId":"80kk95t99i","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text10","rightColumn":16,"textAlign":"RIGHT","widgetId":"k0ul3uaoph","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Sheet Name"},{"isRequired":false,"widgetName":"sheet_input","rightColumn":62,"widgetId":"a35cwuivq7","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text11","rightColumn":16,"textAlign":"RIGHT","widgetId":"l1r1tfbx6y","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Table Header Index"},{"isRequired":false,"widgetName":"header_input","rightColumn":62,"widgetId":"jrhp3pwzll","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Button1","rightColumn":62,"onClick":"{{generate_gsheet_app.run()}}","isDefaultClickDisabled":true,"widgetId":"zzsh2d5rns","buttonStyle":"PRIMARY_BUTTON","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Generate","isDisabled":false}]},{"tabId":"tab7qxuerb9p7","widgetName":"Canvas4","tabName":"Mongo","rightColumn":574.5625,"detachFromLayout":true,"widgetId":"4yqoh4fjmv","containerStyle":"none","topRow":1,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"jalvzswyyk","minHeight":410,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text12","rightColumn":17,"textAlign":"RIGHT","widgetId":"4l1uqhf2au","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Datasource URL"},{"isRequired":false,"widgetName":"mongo_ds_url","rightColumn":61,"widgetId":"r8yvmt103v","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text13","rightColumn":17,"textAlign":"RIGHT","widgetId":"0y3rz6ufib","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Collection Name"},{"isRequired":false,"widgetName":"collection_input","rightColumn":61,"widgetId":"sbe7jfnafu","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text14","rightColumn":17,"textAlign":"RIGHT","widgetId":"s1fhjft9to","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Keys to Fetch"},{"isRequired":false,"widgetName":"fetch_keys_input","rightColumn":61,"widgetId":"74tjl0q7x3","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text15","rightColumn":17,"textAlign":"RIGHT","widgetId":"rwi67ouhe1","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Key to Search"},{"isRequired":false,"widgetName":"search_keys_input","rightColumn":61,"widgetId":"ie4mp16js1","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Button2","rightColumn":62,"onClick":"{{generate_mongo_app.run()}}","isDefaultClickDisabled":true,"widgetId":"6ui5kmqebf","buttonStyle":"PRIMARY_BUTTON","topRow":29,"bottomRow":33,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Generate","isDisabled":false}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Page Generator","userPermissions":[],"layouts":[{"new":false,"id":"60dadae5ee9aa1792c5bf6b8","userPermissions":[],"layoutOnLoadActions":[],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":880,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":860,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Tabs1","rightColumn":44,"widgetId":"jalvzswyyk","defaultTab":"SQL","topRow":13,"bottomRow":54,"shouldShowTabs":true,"parentRowSpace":10,"tabsObj":{"tab1":{"widgetId":"nyka98xqpv","index":0,"label":"SQL","id":"tab1","isVisible":true},"tab2":{"widgetId":"neexe4fljs","index":1,"label":"GSheet","id":"tab2","isVisible":true},"tab7qxuerb9p7":{"widgetId":"4yqoh4fjmv","id":"tab7qxuerb9p7","label":"Mongo","isVisible":true}},"isVisible":true,"type":"TABS_WIDGET","version":3,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":15,"dynamicBindingPathList":[],"children":[{"tabId":"tab1","tabName":"SQL","rightColumn":634,"widgetName":"Canvas2","detachFromLayout":true,"widgetId":"nyka98xqpv","topRow":0,"bottomRow":430,"parentRowSpace":1,"type":"CANVAS_WIDGET","parentId":"jalvzswyyk","isLoading":false,"renderMode":"CANVAS","minHeight":410,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":false,"widgetName":"tableName_input","rightColumn":63,"widgetId":"f8k5jt9mjm","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"isRequired":false,"widgetName":"datasource_input","rightColumn":63,"widgetId":"4j1xd4hih9","topRow":3,"bottomRow":7,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text2","rightColumn":14,"textAlign":"RIGHT","widgetId":"957c72jpan","topRow":3,"bottomRow":7,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Datasource URL"},{"widgetName":"Text4","rightColumn":14,"textAlign":"RIGHT","widgetId":"nz74xi3ae3","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Table Name"},{"widgetName":"Text6","rightColumn":14,"textAlign":"RIGHT","widgetId":"s1i89k31f5","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Columns to Select"},{"isRequired":false,"widgetName":"select_cols_input","rightColumn":63,"widgetId":"pwt5ybili3","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text7","rightColumn":14,"textAlign":"RIGHT","widgetId":"rbacxz6brz","topRow":25,"bottomRow":29,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Column to Search"},{"isRequired":false,"widgetName":"search_col_input","rightColumn":63,"widgetId":"bnro1si5sz","topRow":25,"bottomRow":29,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"resetFormOnClick":false,"widgetName":"FormButton1","rightColumn":63,"onClick":"{{generate_sql_app.run(() => showAlert('Page Created!','success'), () => {})}}","isDefaultClickDisabled":true,"widgetId":"n6220hgzzs","buttonStyle":"PRIMARY_BUTTON","topRow":31,"bottomRow":35,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Generate"}]},{"tabId":"tab2","tabName":"GSheet","rightColumn":634,"widgetName":"Canvas3","detachFromLayout":true,"widgetId":"neexe4fljs","topRow":0,"bottomRow":400,"parentRowSpace":1,"type":"CANVAS_WIDGET","parentId":"jalvzswyyk","isLoading":false,"renderMode":"CANVAS","minHeight":410,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text8","rightColumn":16,"textAlign":"RIGHT","widgetId":"3ghywz6tk6","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"DataSource URL"},{"isRequired":false,"widgetName":"gsheet_ds_input","rightColumn":62,"widgetId":"a8kpjqdp59","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text9","rightColumn":16,"textAlign":"RIGHT","widgetId":"r6o12im1qd","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"SpreadSheet URL"},{"isRequired":false,"widgetName":"spreadsheet_input","rightColumn":62,"widgetId":"80kk95t99i","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text10","rightColumn":16,"textAlign":"RIGHT","widgetId":"k0ul3uaoph","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Sheet Name"},{"isRequired":false,"widgetName":"sheet_input","rightColumn":62,"widgetId":"a35cwuivq7","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text11","rightColumn":16,"textAlign":"RIGHT","widgetId":"l1r1tfbx6y","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Table Header Index"},{"isRequired":false,"widgetName":"header_input","rightColumn":62,"widgetId":"jrhp3pwzll","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Button1","rightColumn":62,"onClick":"{{generate_gsheet_app.run()}}","isDefaultClickDisabled":true,"widgetId":"zzsh2d5rns","buttonStyle":"PRIMARY_BUTTON","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Generate","isDisabled":false}]},{"tabId":"tab7qxuerb9p7","widgetName":"Canvas4","tabName":"Mongo","rightColumn":574.5625,"detachFromLayout":true,"widgetId":"4yqoh4fjmv","containerStyle":"none","topRow":1,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"jalvzswyyk","minHeight":410,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text12","rightColumn":17,"textAlign":"RIGHT","widgetId":"4l1uqhf2au","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Datasource URL"},{"isRequired":false,"widgetName":"mongo_ds_url","rightColumn":61,"widgetId":"r8yvmt103v","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text13","rightColumn":17,"textAlign":"RIGHT","widgetId":"0y3rz6ufib","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Collection Name"},{"isRequired":false,"widgetName":"collection_input","rightColumn":61,"widgetId":"sbe7jfnafu","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text14","rightColumn":17,"textAlign":"RIGHT","widgetId":"s1fhjft9to","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Keys to Fetch"},{"isRequired":false,"widgetName":"fetch_keys_input","rightColumn":61,"widgetId":"74tjl0q7x3","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text15","rightColumn":17,"textAlign":"RIGHT","widgetId":"rwi67ouhe1","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Key to Search"},{"isRequired":false,"widgetName":"search_keys_input","rightColumn":61,"widgetId":"ie4mp16js1","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Button2","rightColumn":62,"onClick":"{{generate_mongo_app.run()}}","isDefaultClickDisabled":true,"widgetId":"6ui5kmqebf","buttonStyle":"PRIMARY_BUTTON","topRow":29,"bottomRow":33,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Generate","isDisabled":false}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"MongoDB","userPermissions":[],"layouts":[{"new":false,"id":"60dafddaee9aa1792c5bf76d","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["key_select.selectedOptionValue","data_table.pageSize","data_table.searchText||\"\"","order_select.selectedOptionValue","(data_table.pageNo - 1) * data_table.pageSize"],"name":"FindQuery","timeoutInMillisecond":10000,"id":"60db015aee9aa1792c5bf778"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":860,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["customColumn1","_id","col4","col2","col3","col1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{FindQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns._id.computedValue"}],"leftColumn":0,"primaryColumns":{"appsmith_mongo_escape_id":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow._id))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"_id","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"_id","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{FindQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{FindQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"key_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{FindQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t},\n\t{\n\t\t\"label\": \"col4\",\n\t\t\"value\": \"col4\"\n\t}\n]","onOptionChange":"{{FindQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{FindQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"1","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"1\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"-1\"\n }\n]","onOptionChange":"{{FindQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{FindQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => FindQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => FindQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!data_table.selectedRow._id}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => FindQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_1","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row ID: {{data_table.selectedRow._id}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text20","rightColumn":19,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"MongoDB","userPermissions":[],"layouts":[{"new":false,"id":"60dafddaee9aa1792c5bf76d","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["key_select.selectedOptionValue","data_table.pageSize","data_table.searchText||\"\"","order_select.selectedOptionValue","(data_table.pageNo - 1) * data_table.pageSize"],"name":"FindQuery","timeoutInMillisecond":10000,"id":"60db015aee9aa1792c5bf778"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":860,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["customColumn1","_id","col4","col2","col3","col1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{FindQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns._id.computedValue"}],"leftColumn":0,"primaryColumns":{"appsmith_mongo_escape_id":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow._id))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"_id","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"_id","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{FindQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{FindQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"key_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{FindQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t},\n\t{\n\t\t\"label\": \"col4\",\n\t\t\"value\": \"col4\"\n\t}\n]","onOptionChange":"{{FindQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{FindQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"1","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"1\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"-1\"\n }\n]","onOptionChange":"{{FindQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{FindQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => FindQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => FindQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!data_table.selectedRow._id}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => FindQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_1","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row ID: {{data_table.selectedRow._id}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text20","rightColumn":19,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Firestore","userPermissions":[],"layouts":[{"new":false,"id":"60ec1d84a5109b1d752d75dc","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["SelectQuery.data[SelectQuery.data.length - 1]","order_select.selectedOptionValue + key_select.selectedOptionValue","SelectQuery.data[0]"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60ee9cafa5109b1d752d7b7b"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":890,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["_ref","col4","col5","col2","col3","col1","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns._ref.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col1.computedValue"}],"leftColumn":0,"primaryColumns":{"_ref":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow._ref))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"_ref","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"_ref","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":5,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":6,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":7,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":8,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"key_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t},\n\t{\n\t\t\"label\": \"col4\",\n\t\t\"value\": \"col4\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"-\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":63,"widgetId":"hdw7qt67dg","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":22,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","defaultText":"","isDisabled":false},{"widgetName":"Text14Copy","rightColumn":19,"textAlign":"RIGHT","widgetId":"yy4u8kzs8p","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":50,"parentRowSpace":10,"isVisible":"{{data_table.selectedRow._ref}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":490,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":500,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"25okoeayc8","topRow":37,"bottomRow":41,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text20Copy","rightColumn":19,"textAlign":"RIGHT","widgetId":"kv1pqyhxvs","topRow":37,"bottomRow":41,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"},{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":64,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":43,"bottomRow":47,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":48,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":43,"bottomRow":47,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_1","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row ID: {{data_table.selectedRow._id}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text20","rightColumn":19,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Firestore","userPermissions":[],"layouts":[{"new":false,"id":"60ec1d84a5109b1d752d75dc","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["SelectQuery.data[SelectQuery.data.length - 1]","order_select.selectedOptionValue + key_select.selectedOptionValue","SelectQuery.data[0]"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60ee9cafa5109b1d752d7b7b"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":890,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["_ref","col4","col5","col2","col3","col1","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns._ref.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col1.computedValue"}],"leftColumn":0,"primaryColumns":{"_ref":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow._ref))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"_ref","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"_ref","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":5,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":6,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":7,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":8,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"key_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t},\n\t{\n\t\t\"label\": \"col4\",\n\t\t\"value\": \"col4\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"-\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":63,"widgetId":"hdw7qt67dg","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":22,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","defaultText":"","isDisabled":false},{"widgetName":"Text14Copy","rightColumn":19,"textAlign":"RIGHT","widgetId":"yy4u8kzs8p","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":50,"parentRowSpace":10,"isVisible":"{{data_table.selectedRow._ref}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":490,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":500,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"25okoeayc8","topRow":37,"bottomRow":41,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text20Copy","rightColumn":19,"textAlign":"RIGHT","widgetId":"kv1pqyhxvs","topRow":37,"bottomRow":41,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"},{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":64,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":43,"bottomRow":47,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":48,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":43,"bottomRow":47,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_1","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row ID: {{data_table.selectedRow._id}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text20","rightColumn":19,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Redis","userPermissions":[],"layouts":[{"new":false,"id":"60eeaf24a5109b1d752d7ba8","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":[],"name":"FetchKeys","timeoutInMillisecond":10000,"id":"60eeaf83a5109b1d752d7bab"},{"pluginType":"DB","jsonPathKeys":["data_table.selectedRow.result"],"name":"FetchValue","timeoutInMillisecond":10000,"id":"60eeb8eda5109b1d752d7bc3"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":5168,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":27,"minHeight":860,"parentColumnSpace":1,"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"eer73khglm","topRow":1,"bottomRow":47,"parentRowSpace":10,"isVisible":"{{data_table.selectedRow.result}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"9nvn3gfw6q","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"eer73khglm","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateKey.run(() => FetchKeys.run(), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"3apd2wkt91","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"hhh0296qfj","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_value_input","rightColumn":63,"widgetId":"07ker1hdod","topRow":8,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":1,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{FetchValue.data[0].result}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"uawwds1z0r","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Key: {{data_table.selectedRow.result}}"}]}]},{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"v8nfulwuy0","containerStyle":"card","topRow":1,"bottomRow":88,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"erkvdsolhu","containerStyle":"none","topRow":0,"bottomRow":890,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"v8nfulwuy0","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["result","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":5,"bottomRow":86,"parentRowSpace":10,"onPageChange":"","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"},{"key":"onRowSelected"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.result.computedValue"}],"leftColumn":0,"primaryColumns":{"result":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => { return currentRow.result})}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"result","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"result","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"onRowSelected":"{{FetchValue.run()}}","derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"tefed053r1","isVisibleFilters":true,"tableData":"{{FetchKeys.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"erkvdsolhu","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"result":503,"task":245,"deliveryAddress":170,"step":62,"id":228,"customColumn2":174,"status":75}},{"widgetName":"new_key_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"2rlp4irwh0","buttonStyle":"PRIMARY_BUTTON","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Key","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{FetchKeys.run()}}","isDefaultClickDisabled":true,"widgetId":"o9t8fslxdi","buttonStyle":"SECONDARY_BUTTON","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":39,"textAlign":"LEFT","widgetId":"nt181ks4ci","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Redis Data"}]}]},{"widgetName":"Insert_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"c8fg4ubw52","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":0,"detachFromLayout":true,"widgetId":"re60vbuakz","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"c8fg4ubw52","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon1","rightColumn":64,"onClick":"{{closeModal('Insert_Modal')}}","color":"#040627","iconName":"cross","widgetId":"3tk445loxa","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text21","rightColumn":41,"textAlign":"LEFT","widgetId":"fgi9qp4uwr","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"New Key"},{"widgetName":"Button1","rightColumn":48,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"xnh96plcyo","buttonStyle":"SECONDARY_BUTTON","topRow":53,"bottomRow":57,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Button2","rightColumn":64,"onClick":"{{InsertKey.run(() => FetchKeys.run(() => closeModal('Insert_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"ix2dralfal","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Insert","isDisabled":false},{"isRequired":false,"widgetName":"insert_key_input","rightColumn":64,"widgetId":"ozz6gi7zmm","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":6.8125,"resetOnSubmit":true,"leftColumn":19,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text22","rightColumn":17,"textAlign":"RIGHT","widgetId":"kotk4wa6pe","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Key"},{"widgetName":"Text23","rightColumn":17,"textAlign":"RIGHT","widgetId":"y2dlumuetl","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Value"},{"isRequired":false,"widgetName":"insert_value_input","rightColumn":64,"widgetId":"pevr27mh87","topRow":16,"bottomRow":50,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":8,"resetOnSubmit":true,"leftColumn":19,"inputType":"TEXT","isDisabled":false}],"isDisabled":false}]},{"widgetName":"value_modal","rightColumn":0,"detachFromLayout":true,"widgetId":"fh14k9y353","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas4","rightColumn":0,"detachFromLayout":true,"widgetId":"v8n3d5aecd","topRow":0,"bottomRow":260,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"fh14k9y353","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon2","rightColumn":64,"onClick":"{{closeModal('value_modal')}}","color":"#040627","iconName":"cross","widgetId":"jqaazpo3zy","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"v8n3d5aecd","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text24","rightColumn":41,"textAlign":"LEFT","widgetId":"hvb3xnk1u8","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"v8n3d5aecd","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Value for Key: {{data_table.selectedRow.result}}"},{"widgetName":"Button4","rightColumn":64,"onClick":"{{closeModal('value_modal')}}","isDefaultClickDisabled":true,"widgetId":"yka7b6k706","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"v8n3d5aecd","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"widgetName":"Text25","rightColumn":64,"textAlign":"LEFT","widgetId":"j9315vzr13","topRow":6,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"v8n3d5aecd","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{FetchValue.data[0].result}}"}],"isDisabled":false}]},{"widgetName":"Delete_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"0skbil3ntd","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas5","rightColumn":0,"detachFromLayout":true,"widgetId":"lwsyaz55ll","topRow":0,"bottomRow":240,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"0skbil3ntd","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3","rightColumn":64,"onClick":"{{closeModal('Delete_Modal')}}","color":"#040627","iconName":"cross","widgetId":"dtuc8ag2of","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text26","rightColumn":41,"textAlign":"LEFT","widgetId":"d9ap4dp300","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"lwsyaz55ll","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Key"},{"widgetName":"Button6","rightColumn":64,"onClick":"{{DeleteKey.run(() => FetchKeys.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"2kg6lmim5m","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":46,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text27","rightColumn":64,"textAlign":"LEFT","widgetId":"c698jgkzjg","topRow":7,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"lwsyaz55ll","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete the key?\n\n{{data_table.selectedRow.result}}"},{"widgetName":"Button7","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"widgetId":"lsvqrab5v2","buttonStyle":"SECONDARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":32,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false}],"isDisabled":false}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Redis","userPermissions":[],"layouts":[{"new":false,"id":"60eeaf24a5109b1d752d7ba8","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":[],"name":"FetchKeys","timeoutInMillisecond":10000,"id":"60eeaf83a5109b1d752d7bab"},{"pluginType":"DB","jsonPathKeys":["data_table.selectedRow.result"],"name":"FetchValue","timeoutInMillisecond":10000,"id":"60eeb8eda5109b1d752d7bc3"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":5168,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":27,"minHeight":860,"parentColumnSpace":1,"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"eer73khglm","topRow":1,"bottomRow":47,"parentRowSpace":10,"isVisible":"{{data_table.selectedRow.result}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"9nvn3gfw6q","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"eer73khglm","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateKey.run(() => FetchKeys.run(), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"3apd2wkt91","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"hhh0296qfj","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_value_input","rightColumn":63,"widgetId":"07ker1hdod","topRow":8,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":1,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{FetchValue.data[0].result}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"uawwds1z0r","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Key: {{data_table.selectedRow.result}}"}]}]},{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"v8nfulwuy0","containerStyle":"card","topRow":1,"bottomRow":88,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"erkvdsolhu","containerStyle":"none","topRow":0,"bottomRow":890,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"v8nfulwuy0","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["result","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":5,"bottomRow":86,"parentRowSpace":10,"onPageChange":"","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"},{"key":"onRowSelected"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.result.computedValue"}],"leftColumn":0,"primaryColumns":{"result":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => { return currentRow.result})}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"result","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"result","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"onRowSelected":"{{FetchValue.run()}}","derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"tefed053r1","isVisibleFilters":true,"tableData":"{{FetchKeys.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"erkvdsolhu","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"result":503,"task":245,"deliveryAddress":170,"step":62,"id":228,"customColumn2":174,"status":75}},{"widgetName":"new_key_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"2rlp4irwh0","buttonStyle":"PRIMARY_BUTTON","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Key","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{FetchKeys.run()}}","isDefaultClickDisabled":true,"widgetId":"o9t8fslxdi","buttonStyle":"SECONDARY_BUTTON","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":39,"textAlign":"LEFT","widgetId":"nt181ks4ci","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Redis Data"}]}]},{"widgetName":"Insert_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"c8fg4ubw52","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":0,"detachFromLayout":true,"widgetId":"re60vbuakz","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"c8fg4ubw52","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon1","rightColumn":64,"onClick":"{{closeModal('Insert_Modal')}}","color":"#040627","iconName":"cross","widgetId":"3tk445loxa","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text21","rightColumn":41,"textAlign":"LEFT","widgetId":"fgi9qp4uwr","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"New Key"},{"widgetName":"Button1","rightColumn":48,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"xnh96plcyo","buttonStyle":"SECONDARY_BUTTON","topRow":53,"bottomRow":57,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Button2","rightColumn":64,"onClick":"{{InsertKey.run(() => FetchKeys.run(() => closeModal('Insert_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"ix2dralfal","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Insert","isDisabled":false},{"isRequired":false,"widgetName":"insert_key_input","rightColumn":64,"widgetId":"ozz6gi7zmm","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":6.8125,"resetOnSubmit":true,"leftColumn":19,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text22","rightColumn":17,"textAlign":"RIGHT","widgetId":"kotk4wa6pe","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Key"},{"widgetName":"Text23","rightColumn":17,"textAlign":"RIGHT","widgetId":"y2dlumuetl","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Value"},{"isRequired":false,"widgetName":"insert_value_input","rightColumn":64,"widgetId":"pevr27mh87","topRow":16,"bottomRow":50,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":8,"resetOnSubmit":true,"leftColumn":19,"inputType":"TEXT","isDisabled":false}],"isDisabled":false}]},{"widgetName":"value_modal","rightColumn":0,"detachFromLayout":true,"widgetId":"fh14k9y353","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas4","rightColumn":0,"detachFromLayout":true,"widgetId":"v8n3d5aecd","topRow":0,"bottomRow":260,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"fh14k9y353","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon2","rightColumn":64,"onClick":"{{closeModal('value_modal')}}","color":"#040627","iconName":"cross","widgetId":"jqaazpo3zy","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"v8n3d5aecd","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text24","rightColumn":41,"textAlign":"LEFT","widgetId":"hvb3xnk1u8","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"v8n3d5aecd","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Value for Key: {{data_table.selectedRow.result}}"},{"widgetName":"Button4","rightColumn":64,"onClick":"{{closeModal('value_modal')}}","isDefaultClickDisabled":true,"widgetId":"yka7b6k706","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"v8n3d5aecd","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"widgetName":"Text25","rightColumn":64,"textAlign":"LEFT","widgetId":"j9315vzr13","topRow":6,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"v8n3d5aecd","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{FetchValue.data[0].result}}"}],"isDisabled":false}]},{"widgetName":"Delete_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"0skbil3ntd","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas5","rightColumn":0,"detachFromLayout":true,"widgetId":"lwsyaz55ll","topRow":0,"bottomRow":240,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"0skbil3ntd","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3","rightColumn":64,"onClick":"{{closeModal('Delete_Modal')}}","color":"#040627","iconName":"cross","widgetId":"dtuc8ag2of","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text26","rightColumn":41,"textAlign":"LEFT","widgetId":"d9ap4dp300","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"lwsyaz55ll","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Key"},{"widgetName":"Button6","rightColumn":64,"onClick":"{{DeleteKey.run(() => FetchKeys.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"2kg6lmim5m","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":46,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text27","rightColumn":64,"textAlign":"LEFT","widgetId":"c698jgkzjg","topRow":7,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"lwsyaz55ll","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete the key?\n\n{{data_table.selectedRow.result}}"},{"widgetName":"Button7","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"widgetId":"lsvqrab5v2","buttonStyle":"SECONDARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":32,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false}],"isDisabled":false}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"PostgreSQL","userPermissions":[],"layouts":[{"new":false,"id":"60f68220d4c0bb105f54dfd0","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60f68221d4c0bb105f54dfd4"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":900,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":880,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Table1","columnOrder":["col1","col3","col4","col5","col2","customColumn1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"},{"key":"primaryColumns.col2.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"col_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"ASC","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"ASC\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"DESC\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"9t3vdjd5xj","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"5rfqxgj0vm","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!Table1.selectedRow.col1}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col4}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row: {{Table1.selectedRow.col1}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"},{"widgetName":"Text20","rightColumn":18,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"PostgreSQL","userPermissions":[],"layouts":[{"new":false,"id":"60f68220d4c0bb105f54dfd0","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60f68221d4c0bb105f54dfd4"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":900,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":880,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Table1","columnOrder":["col1","col3","col4","col5","col2","customColumn1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"},{"key":"primaryColumns.col2.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"col_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"ASC","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"ASC\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"DESC\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"9t3vdjd5xj","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"5rfqxgj0vm","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!Table1.selectedRow.col1}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col4}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row: {{Table1.selectedRow.col1}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"},{"widgetName":"Text20","rightColumn":18,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]}],"publishedLayoutmongoEscapedWidgets":{"60dafddaee9aa1792c5bf76d":["data_table"]},"exportedApplication":{"new":true,"color":"#6C9DD0","name":"CRUD App Templates","appIsExample":false,"icon":"bus","isPublic":false,"userPermissions":["canComment:applications","manage:applications","export:applications","read:applications","publish:applications","makePublic:applications"],"unreadCommentThreads":0},"publishedDefaultPageName":"PostgreSQL"} \ No newline at end of file +{"unpublishedDefaultPageName":"PostgreSQL","datasourceList":[{"new":true,"invalids":[],"pluginId":"amazons3-plugin","isValid":true,"name":"AmazonS3","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"endpoints":[{"host":""}],"properties":[{"value":"ap-south-1"},{"value":"amazon-s3","key":"s3Provider"},{"value":"","key":"customRegion"}]},"structure":{}},{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"Appsmith Prod","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"headers":[{"value":"_hjIncludedInSample=1; _hjSessionTooLarge=1; _ga=GA1.2.572027528.1599035590; SL_C_23361dd035530_KEY=c370af0df0edf38360adbefbdc47d2b42ea137c9; ajs_user_id=%22nikhil%40appsmith.com%22; ajs_anonymous_id=%2213c846f6-970b-41e1-925f-f8f4a92ea315%22; SL_C_23361dd035530_SID=laR0iYdLzA-; SL_C_23361dd035530_VID=EDGoRechnrX; _hjid=da2ef5e3-4ea5-42dc-b892-7962b7564098; [email protected]; ajs_anonymous_id=13c846f6-970b-41e1-925f-f8f4a92ea315; intercom-id-y10e7138=a7d5577a-ac9b-4f96-93df-c3f86f2b7548; SESSION=21e71ab1-7ef2-4987-b430-1ab002edbd6b; _gid=GA1.2.1874210412.1627809109; amplitude_id_fef1e872c952688acd962d30aa545b9eappsmith.com=eyJkZXZpY2VJZCI6IjU5ZjhhZTJlLTgzYjQtNDY5My1hZjA4LTM2ZGRkZjBjNGJiYlIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYyODE0NzgzNzQ1NiwibGFzdEV2ZW50VGltZSI6MTYyODE0NzgzNzQ1NywiZXZlbnRJZCI6MSwiaWRlbnRpZnlJZCI6MCwic2VxdWVuY2VOdW1iZXIiOjF9; _hjAbsoluteSessionInProgress=0; _hjIncludedInPageviewSample=1; mp_70b8ea94d623dd857fb555a76d11f944_mixpanel=%7B%22distinct_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24device_id%22%3A%20%221787d3b4aab392-0b46f81f3f91ff-1633685c-1aeaa0-1787d3b4aac48d%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%2C%22mp_lib%22%3A%20%22Segment%3A%20web%22%2C%22%24user_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22mp_name_tag%22%3A%20%22nikhil%40appsmith.com%22%2C%22userId%22%3A%20%22nikhil%40appsmith.com%22%2C%22source%22%3A%20%22cloud%22%2C%22id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24email%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24first_name%22%3A%20%22Nikhil%22%2C%22%24last_name%22%3A%20%22Nandagopal%22%2C%22%24name%22%3A%20%22Nikhil%20Nandagopal%22%2C%22utm_source%22%3A%20%22ActiveCampaign%22%2C%22utm_medium%22%3A%20%22email%22%2C%22utm_campaign%22%3A%20%22Day%201%20Nudge%20after%20Sign%20up%22%2C%22utm_content%22%3A%20%22Does%20appsmith%20use%20appsmith%3F%20%F0%9F%A4%94%22%7D; intercom-session-y10e7138=Nkxsd3kzTnVDTC9VcnEzbnNGZFRkWUZ0MG00RzByb2c5YXFOdmM4THpzcHZNYzgwUHdmazdWYXpLb3pkNVRGMy0tcDVLbld2UDJudThPTEQ5d1hZR1BhZz09--fc315a38af2f912c348ca1aa8cdbb9dad2b39c3f","key":"Cookie"}],"properties":[{"value":"N","key":"isSendSessionEnabled"},{"value":"","key":"sessionSignatureKey"}],"url":"https://app.appsmith.com"},"structure":{}},{"new":true,"invalids":[],"pluginId":"firestore-plugin","isValid":true,"name":"FBTemplateDB","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"url":"https://firebase-crud-template.firebaseio.com"},"structure":{}},{"new":true,"invalids":[],"pluginId":"google-sheets-plugin","isValid":true,"name":"Google Sheet","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false},"structure":{}},{"new":true,"invalids":[],"pluginId":"postgres-plugin","isValid":true,"name":"Internal DB","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"endpoints":[{"port":5432,"host":"fake-api.cvuydmurdlas.us-east-1.rds.amazonaws.com"}],"connection":{"mode":"READ_WRITE","ssl":{"authType":"DEFAULT"}}},"structure":{"tables":[{"schema":"public","columns":[{"defaultValue":"nextval('active_app_report_id_seq'::regclass)","name":"id","type":"int4"},{"name":"active_app","type":"text"},{"name":"num_api_calls","type":"int8"},{"name":"date","type":"text"},{"name":"report_type","type":"text"},{"name":"app_id","type":"text"}],"keys":[{"columnNames":["id"],"name":"active_app_report_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"active_app_report\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"active_app_report\" (\"active_app\", \"num_api_calls\", \"date\", \"report_type\", \"app_id\")\n VALUES ('', 1, '', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"active_app_report\" SET\n \"active_app\" = ''\n \"num_api_calls\" = 1\n \"date\" = ''\n \"report_type\" = ''\n \"app_id\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"active_app_report\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.active_app_report","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('audit_logs_id_seq'::regclass)","name":"id","type":"int4"},{"name":"date","type":"timestamptz"},{"name":"appId","type":"text"},{"name":"appName","type":"text"},{"name":"orgId","type":"text"},{"name":"actionName","type":"text"},{"name":"userId","type":"text"},{"name":"pageId","type":"text"},{"name":"insert_id","type":"text"},{"name":"pageName","type":"text"},{"name":"req","type":"json"}],"keys":[{"columnNames":["id"],"name":"audit_logs_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"audit_logs\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"audit_logs\" (\"date\", \"appId\", \"appName\", \"orgId\", \"actionName\", \"userId\", \"pageId\", \"insert_id\", \"pageName\", \"req\")\n VALUES (TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '', '', '', '', '', '', '', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"audit_logs\" SET\n \"date\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET'\n \"appId\" = ''\n \"appName\" = ''\n \"orgId\" = ''\n \"actionName\" = ''\n \"userId\" = ''\n \"pageId\" = ''\n \"insert_id\" = ''\n \"pageName\" = ''\n \"req\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"audit_logs\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.audit_logs","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('discord_messages_id_seq'::regclass)","name":"id","type":"int4"},{"name":"msg_id","type":"text"},{"name":"created_at","type":"date"},{"name":"author","type":"text"}],"keys":[{"columnNames":["id"],"name":"discord_messages_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"discord_messages\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"discord_messages\" (\"msg_id\", \"created_at\", \"author\")\n VALUES ('', '2019-07-01', '');"},{"title":"UPDATE","body":"UPDATE public.\"discord_messages\" SET\n \"msg_id\" = ''\n \"created_at\" = '2019-07-01'\n \"author\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"discord_messages\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.discord_messages","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('email_issues_id_seq'::regclass)","name":"id","type":"int4"},{"name":"from","type":"text"},{"name":"body","type":"text"},{"name":"created_at","type":"timestamptz"},{"name":"subject","type":"text"},{"name":"is_tagged","type":"bool"},{"name":"assignee","type":"text"}],"keys":[{"columnNames":["id"],"name":"email_issues_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"email_issues\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"email_issues\" (\"from\", \"body\", \"created_at\", \"subject\", \"is_tagged\", \"assignee\")\n VALUES ('', '', TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"email_issues\" SET\n \"from\" = ''\n \"body\" = ''\n \"created_at\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET'\n \"subject\" = ''\n \"is_tagged\" = ''\n \"assignee\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"email_issues\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.email_issues","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('github_issues_id_seq'::regclass)","name":"id","type":"int4"},{"name":"issue_id","type":"text"},{"name":"order","type":"int4"}],"keys":[{"columnNames":["id"],"name":"github_issues_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"github_issues\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"github_issues\" (\"issue_id\", \"order\")\n VALUES ('', 1);"},{"title":"UPDATE","body":"UPDATE public.\"github_issues\" SET\n \"issue_id\" = ''\n \"order\" = 1\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"github_issues\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.github_issues","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('github_projects_id_seq'::regclass)","name":"id","type":"int4"},{"name":"github_id","type":"text"},{"name":"due_date","type":"timestamptz"},{"name":"tag","type":"text"}],"keys":[{"columnNames":["id"],"name":"github_projects_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"github_projects\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"github_projects\" (\"github_id\", \"due_date\", \"tag\")\n VALUES ('', TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '');"},{"title":"UPDATE","body":"UPDATE public.\"github_projects\" SET\n \"github_id\" = ''\n \"due_date\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET'\n \"tag\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"github_projects\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.github_projects","type":"TABLE"},{"schema":"public","columns":[{"name":"id","type":"text"},{"name":"assignee","type":"text"},{"name":"state","type":"text"}],"keys":[{"columnNames":["id"],"name":"support_email_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"support_email\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"support_email\" (\"id\", \"assignee\", \"state\")\n VALUES ('', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"support_email\" SET\n \"id\" = ''\n \"assignee\" = ''\n \"state\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"support_email\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.support_email","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('support_tickets_id_seq'::regclass)","name":"id","type":"int4"},{"name":"description","type":"varchar"},{"name":"created_at","type":"timestamptz"},{"name":"author","type":"text"},{"name":"user","type":"text"},{"name":"comments","type":"text"}],"keys":[{"columnNames":["id"],"name":"support_tickets_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"support_tickets\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"support_tickets\" (\"description\", \"created_at\", \"author\", \"user\", \"comments\")\n VALUES ('', TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET', '', '', '');"},{"title":"UPDATE","body":"UPDATE public.\"support_tickets\" SET\n \"description\" = ''\n \"created_at\" = TIMESTAMP WITH TIME ZONE '2019-07-01 06:30:00 CET'\n \"author\" = ''\n \"user\" = ''\n \"comments\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"support_tickets\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.support_tickets","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('template_table_col1_seq'::regclass)","name":"col1","type":"int4"},{"name":"col3","type":"text"},{"name":"col4","type":"int4"},{"name":"col5","type":"bool"},{"name":"col2","type":"text"}],"keys":[{"columnNames":["col1"],"name":"template_table_pkey","type":"primary key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"template_table\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"template_table\" (\"col3\", \"col4\", \"col5\", \"col2\")\n VALUES ('', 1, '', '');"},{"title":"UPDATE","body":"UPDATE public.\"template_table\" SET\n \"col3\" = ''\n \"col4\" = 1\n \"col5\" = ''\n \"col2\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"template_table\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.template_table","type":"TABLE"},{"schema":"public","columns":[{"name":"age","type":"int4"},{"name":"username","type":"varchar"},{"name":"password","type":"varchar"},{"name":"email","type":"varchar"},{"name":"created_on","type":"timestamp"},{"name":"last_login","type":"timestamp"}],"keys":[],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"testuser\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"testuser\" (\"age\", \"username\", \"password\", \"email\", \"created_on\", \"last_login\")\n VALUES (1, '', '', '', TIMESTAMP '2019-07-01 10:00:00', TIMESTAMP '2019-07-01 10:00:00');"},{"title":"UPDATE","body":"UPDATE public.\"testuser\" SET\n \"age\" = 1\n \"username\" = ''\n \"password\" = ''\n \"email\" = ''\n \"created_on\" = TIMESTAMP '2019-07-01 10:00:00'\n \"last_login\" = 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!"},{"title":"DELETE","body":"DELETE FROM public.\"testuser\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.testuser","type":"TABLE"},{"schema":"public","columns":[{"defaultValue":"nextval('ticket_tags_id_seq'::regclass)","name":"id","type":"int4"},{"name":"ticket_id","type":"int4"},{"name":"github_tag_id","type":"text"}],"keys":[{"columnNames":["id"],"name":"ticket_tags_pkey","type":"primary key"},{"fromColumns":["ticket_id"],"name":"ticket_id_fk","toColumns":["support_tickets.id"],"type":"foreign key"}],"templates":[{"title":"SELECT","body":"SELECT * FROM public.\"ticket_tags\" LIMIT 10;"},{"title":"INSERT","body":"INSERT INTO public.\"ticket_tags\" (\"ticket_id\", \"github_tag_id\")\n VALUES (1, '');"},{"title":"UPDATE","body":"UPDATE public.\"ticket_tags\" SET\n \"ticket_id\" = 1\n \"github_tag_id\" = ''\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may update every row in the table!"},{"title":"DELETE","body":"DELETE FROM public.\"ticket_tags\"\n WHERE 1 = 0; -- Specify a valid condition here. Removing the condition may delete everything in the table!"}],"name":"public.ticket_tags","type":"TABLE"}]}},{"new":true,"invalids":[],"pluginId":"mongo-plugin","isValid":true,"name":"Mock Mongo","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"sshProxyEnabled":false,"endpoints":[],"connection":{"mode":"READ_WRITE","type":"DIRECT","ssl":{"authType":"DEFAULT"}},"properties":[{"value":"Yes","key":"Use Mongo Connection String URI"},{"value":"mongodb+srv://mockdb-admin:****@mockdb.swrsq.mongodb.net/admin_db?retryWrites=true&w=majority","key":"Connection String URI"}]},"structure":{"tables":[{"columns":[{"name":"_id","type":"ObjectId"},{"name":"col1","type":"String"},{"name":"col2","type":"String"},{"name":"col3","type":"String"},{"name":"col4","type":"String"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"template_table\",\n \"filter\": {\n \"col1\": \"test\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"col1\": \"test\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"template_table"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"template_table\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"template_table"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"template_table\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"col1\": \"new value\",\n \"col2\": \"new value\",\n \"col3\": \"new value\",\n \"col4\": \"new value\",\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"col1\": \"new value\",\n \"col2\": \"new value\",\n \"col3\": \"new value\",\n \"col4\": \"new value\",\n}]"},{"value":"template_table"},{},{}]},{"title":"Update","body":"{\n \"update\": \"template_table\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"col1\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"col1\": \"new value\" } }"},{},{},{},{},{},{},{"value":"template_table"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"template_table\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"template_table"},{"value":"SINGLE"},{}]}],"name":"template_table","type":"COLLECTION"},{"columns":[{"name":"_id","type":"ObjectId"},{"name":"createdAt","type":"Date"},{"name":"email","type":"String"},{"name":"name","type":"String"},{"name":"role","type":"String"},{"name":"status","type":"Object"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"users\",\n \"filter\": {\n \"email\": \"[email protected]\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"email\": \"[email protected]\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"users"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"users\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"users"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"users\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"email\": \"new value\",\n \"name\": \"new value\",\n \"role\": \"new value\",\n \"status\": {},\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"email\": \"new value\",\n \"name\": \"new value\",\n \"role\": \"new value\",\n \"status\": {},\n}]"},{"value":"users"},{},{}]},{"title":"Update","body":"{\n \"update\": \"users\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"email\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"email\": \"new value\" } }"},{},{},{},{},{},{},{"value":"users"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"users\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"users"},{"value":"SINGLE"},{}]}],"name":"users","type":"COLLECTION"},{"columns":[{"name":"_id","type":"ObjectId"},{"name":"createdAt","type":"Date"},{"name":"currentLimit","type":"Integer"},{"name":"featureName","type":"String"},{"name":"key","type":"Integer"},{"name":"limit","type":"Integer"},{"name":"subscriptionId","type":"ObjectId"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"orgs\",\n \"filter\": {\n \"featureName\": \"Okuneva Inc\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"featureName\": \"Okuneva Inc\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"orgs"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"orgs\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"orgs"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"orgs\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"currentLimit\": 1,\n \"featureName\": \"new value\",\n \"key\": 1,\n \"limit\": 1,\n \"subscriptionId\": ObjectId(\"a_valid_object_id_hex\"),\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"currentLimit\": 1,\n \"featureName\": \"new value\",\n \"key\": 1,\n \"limit\": 1,\n \"subscriptionId\": ObjectId(\"a_valid_object_id_hex\"),\n}]"},{"value":"orgs"},{},{}]},{"title":"Update","body":"{\n \"update\": \"orgs\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"featureName\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"featureName\": \"new value\" } }"},{},{},{},{},{},{},{"value":"orgs"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"orgs\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"orgs"},{"value":"SINGLE"},{}]}],"name":"orgs","type":"COLLECTION"},{"columns":[{"name":"_id","type":"ObjectId"},{"name":"createdAt","type":"Date"},{"name":"createdBy","type":"ObjectId"},{"name":"domain","type":"String"},{"name":"name","type":"String"},{"name":"numUsers","type":"Integer"},{"name":"orgId","type":"ObjectId"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"apps\",\n \"filter\": {\n \"domain\": \"adolph.biz\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"domain\": \"adolph.biz\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"apps"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"apps\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"apps"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"apps\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"createdBy\": ObjectId(\"a_valid_object_id_hex\"),\n \"domain\": \"new value\",\n \"name\": \"new value\",\n \"numUsers\": 1,\n \"orgId\": ObjectId(\"a_valid_object_id_hex\"),\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"createdBy\": ObjectId(\"a_valid_object_id_hex\"),\n \"domain\": \"new value\",\n \"name\": \"new value\",\n \"numUsers\": 1,\n \"orgId\": ObjectId(\"a_valid_object_id_hex\"),\n}]"},{"value":"apps"},{},{}]},{"title":"Update","body":"{\n \"update\": \"apps\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"domain\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"domain\": \"new value\" } }"},{},{},{},{},{},{},{"value":"apps"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"apps\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"apps"},{"value":"SINGLE"},{}]}],"name":"apps","type":"COLLECTION"},{"columns":[{"name":"_id","type":"ObjectId"},{"name":"createdAt","type":"Date"},{"name":"currency","type":"String"},{"name":"mrr","type":"String"},{"name":"name","type":"String"},{"name":"renewalDate","type":"Date"},{"name":"status","type":"String"},{"name":"statusOfApp","type":"Object"}],"keys":[],"templates":[{"title":"Find","body":"{\n \"find\": \"subscriptions\",\n \"filter\": {\n \"currency\": \"RUB\"\n },\n \"sort\": {\n \"_id\": 1\n },\n \"limit\": 10\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{ \"currency\": \"RUB\"}"},{"value":"{\"_id\": 1}"},{},{"value":"10"},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"subscriptions"},{},{}]},{"title":"Find by ID","body":"{\n \"find\": \"subscriptions\",\n \"filter\": {\n \"_id\": ObjectId(\"id_to_query_with\")\n }\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"FIND"},{"value":"{\"_id\": ObjectId(\"id_to_query_with\")}"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"subscriptions"},{},{}]},{"title":"Insert","body":"{\n \"insert\": \"subscriptions\",\n \"documents\": [\n {\n \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"currency\": \"new value\",\n \"mrr\": \"new value\",\n \"name\": \"new value\",\n \"renewalDate\": new Date(\"2019-07-01\"),\n \"status\": \"new value\",\n \"statusOfApp\": {},\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"value":"[{ \"_id\": ObjectId(\"a_valid_object_id_hex\"),\n \"createdAt\": new Date(\"2019-07-01\"),\n \"currency\": \"new value\",\n \"mrr\": \"new value\",\n \"name\": \"new value\",\n \"renewalDate\": new Date(\"2019-07-01\"),\n \"status\": \"new value\",\n \"statusOfApp\": {},\n}]"},{"value":"subscriptions"},{},{}]},{"title":"Update","body":"{\n \"update\": \"subscriptions\",\n \"updates\": [\n {\n \"q\": {\n \"_id\": ObjectId(\"id_of_document_to_update\")\n },\n \"u\": { \"$set\": { \"currency\": \"new value\" } }\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_update\") }"},{"value":"{ \"$set\": { \"currency\": \"new value\" } }"},{},{},{},{},{},{},{"value":"subscriptions"},{},{"value":"ALL"}]},{"title":"Delete","body":"{\n \"delete\": \"subscriptions\",\n \"deletes\": [\n {\n \"q\": {\n \"_id\": \"id_of_document_to_delete\"\n },\n \"limit\": 1\n }\n ]\n}\n","pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"DELETE"},{},{},{},{},{},{},{},{},{},{},{"value":"{ \"_id\": ObjectId(\"id_of_document_to_delete\") }"},{},{},{},{},{},{"value":"subscriptions"},{"value":"SINGLE"},{}]}],"name":"subscriptions","type":"COLLECTION"}]}},{"new":true,"invalids":[],"pluginId":"redis-plugin","isValid":true,"name":"RedisTemplateApps","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"datasourceConfiguration":{"endpoints":[{"port":10339,"host":"redis-10339.c278.us-east-1-4.ec2.cloud.redislabs.com"}]},"structure":{}}],"actionList":[{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["Table1.selectedRow.col1"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"DELETE FROM public.template_table\n WHERE col1 = {{Table1.selectedRow.col1}};"},"userPermissions":[],"pageId":"SQL"},"pluginId":"postgres-plugin","id":"60d4559cee9aa1792c5bec41","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["Table1.selectedRow.col1"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"DELETE FROM public.template_table\n WHERE col1 = {{Table1.selectedRow.col1}};"},"userPermissions":[],"pageId":"SQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"INSERT INTO public.template_table (\n\tcol1,\n\tcol2, \n\tcol3,\n\tcol4, \n\tcol5\n)\nVALUES (\n\t\t\t\t{{insert_col_input1.text}}, \n\t\t\t\t{{insert_col_input2.text}}, \n\t\t\t\t{{insert_col_input3.text}}, \n\t\t\t\t{{insert_col_input4.text}}, \n\t\t\t\t{{insert_col_input5.text}}\n);","pluginSpecifiedTemplates":[{"value":true}]},"userPermissions":[],"pageId":"SQL"},"pluginId":"postgres-plugin","id":"60d4559cee9aa1792c5bec43","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"INSERT INTO public.template_table (\n\tcol1,\n\tcol2, \n\tcol3,\n\tcol4, \n\tcol5\n)\nVALUES (\n\t\t\t\t{{insert_col_input1.text}}, \n\t\t\t\t{{insert_col_input2.text}}, \n\t\t\t\t{{insert_col_input3.text}}, \n\t\t\t\t{{insert_col_input4.text}}, \n\t\t\t\t{{insert_col_input5.text}}\n);","pluginSpecifiedTemplates":[{"value":true}]},"userPermissions":[],"pageId":"SQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","Table1.selectedRow.col1","update_col_2.text","update_col_5.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"UPDATE public.template_table SET\n\t\tcol2 = '{{update_col_2.text}}',\n col3 = '{{update_col_3.text}}',\n col4 = '{{update_col_4.text}}',\n col5 = '{{update_col_5.text}}'\n WHERE col1 = {{Table1.selectedRow.col1}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"SQL"},"pluginId":"postgres-plugin","id":"60d4559cee9aa1792c5bec42","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","Table1.selectedRow.col1","update_col_2.text","update_col_5.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"UPDATE public.template_table SET\n\t\tcol2 = '{{update_col_2.text}}',\n col3 = '{{update_col_3.text}}',\n col4 = '{{update_col_4.text}}',\n col5 = '{{update_col_5.text}}'\n WHERE col1 = {{Table1.selectedRow.col1}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"SQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"SELECT * FROM public.template_table\nWHERE col2 like '%{{Table1.searchText || \"\"}}%'\nORDER BY {{col_select.selectedOptionValue}} {{order_select.selectedOptionLabel}}\nLIMIT {{Table1.pageSize}}\nOFFSET {{(Table1.pageNo - 1) * Table1.pageSize}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"SQL"},"pluginId":"postgres-plugin","id":"60d4559cee9aa1792c5bec40","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"SELECT * FROM public.template_table\nWHERE col2 like '%{{Table1.searchText || \"\"}}%'\nORDER BY {{col_select.selectedOptionValue}} {{order_select.selectedOptionLabel}}\nLIMIT {{Table1.pageSize}}\nOFFSET {{(Table1.pageNo - 1) * Table1.pageSize}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"SQL"}},{"new":false,"pluginType":"SAAS","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[8].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"GET","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"{{data_table.pageSize}}","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}","key":"rowOffset"},{"key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"},"pluginId":"google-sheets-plugin","id":"60d468c1ee9aa1792c5bec95","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[8].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"GET","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"{{data_table.pageSize}}","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}","key":"rowOffset"},{"key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"}},{"new":false,"pluginType":"SAAS","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[8].value"},{"key":"pluginSpecifiedTemplates[11].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.rowIndex","data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_ROW","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"{{data_table.pageSize}}","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}","key":"rowOffset"},{"key":"rowObject"},{"key":"rowObjects"},{"value":"{{data_table.selectedRow.rowIndex}}","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"},"pluginId":"google-sheets-plugin","id":"60d46a38ee9aa1792c5bec99","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[8].value"},{"key":"pluginSpecifiedTemplates[11].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.rowIndex","data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_ROW","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"{{data_table.pageSize}}","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}","key":"rowOffset"},{"key":"rowObject"},{"key":"rowObjects"},{"value":"{{data_table.selectedRow.rowIndex}}","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"}},{"new":false,"pluginType":"SAAS","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[9].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["colInput1.text","colInput4.text","data_table.selectedRow.rowIndex","colInput2.text","colInput3.text"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"UPDATE","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"","key":"rowOffset"},{"value":"{\n\t \"rowIndex\": {{data_table.selectedRow.rowIndex}}, \n\t\t\"col1\": \"{{colInput1.text}}\", \n\t\t\"col2\": \"{{colInput2.text}}\", \n\t\t\"col3\": \"{{colInput3.text}}\", \n\t\t\"col4\": \"{{colInput4.text}}\"\n}","key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"},"pluginId":"google-sheets-plugin","id":"60d47052ee9aa1792c5becbe","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[9].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["colInput1.text","colInput4.text","data_table.selectedRow.rowIndex","colInput2.text","colInput3.text"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"UPDATE","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"","key":"rowOffset"},{"value":"{\n\t \"rowIndex\": {{data_table.selectedRow.rowIndex}}, \n\t\t\"col1\": \"{{colInput1.text}}\", \n\t\t\"col2\": \"{{colInput2.text}}\", \n\t\t\"col3\": \"{{colInput3.text}}\", \n\t\t\"col4\": \"{{colInput4.text}}\"\n}","key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"}},{"new":false,"pluginType":"SAAS","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[9].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"APPEND","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"","key":"rowOffset"},{"value":"{ \n\t\t\"col1\": \"{{insert_col_input1.text}}\", \n\t\t\"col2\": \"{{insert_col_input2.text}}\", \n\t\t\"col3\": \"{{insert_col_input3.text}}\", \n\t\t\"col4\": \"{{insert_col_input4.text}}\",\n\t\t\"col5\": \"{{insert_col_input5.text}}\"\n}","key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"},"pluginId":"google-sheets-plugin","id":"60d47363ee9aa1792c5becc3","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[9].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Google Sheet","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"APPEND","key":"method"},{"value":"https://docs.google.com/spreadsheets/d/1P6or_F8UZ9sJX3JRAsX_kQDMRRnXqrnRgRIiml8Gjl0/edit#gid=0","key":"sheetUrl"},{"value":"","key":"range"},{"value":"","key":"spreadsheetName"},{"value":"1","key":"tableHeaderIndex"},{"value":"ROWS","key":"queryFormat"},{"value":"","key":"rowLimit"},{"value":"template_table","key":"sheetName"},{"value":"","key":"rowOffset"},{"value":"{ \n\t\t\"col1\": \"{{insert_col_input1.text}}\", \n\t\t\"col2\": \"{{insert_col_input2.text}}\", \n\t\t\"col3\": \"{{insert_col_input3.text}}\", \n\t\t\"col4\": \"{{insert_col_input4.text}}\",\n\t\t\"col5\": \"{{insert_col_input5.text}}\"\n}","key":"rowObject"},{"key":"rowObjects"},{"value":"","key":"rowIndex"},{"value":"SHEET","key":"deleteFormat"}]},"userPermissions":[],"pageId":"Google Sheets"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":["'Query timeout' field must be an integer between 0 and 60000"],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["FilePicker.files[this.params.fileIndex].data","(folder_name.text || folder_name.text == \"\" ? folder_name.text + \"/\" : \"\") + this.params.name"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"CreateFile","actionConfiguration":{"path":"{{(folder_name.text || folder_name.text == \"\" ? folder_name.text + \"/\" : \"\") + this.params.name}}","paginationType":"NONE","timeoutInMillisecond":100000,"encodeParamsToggle":true,"body":"{{FilePicker.files[this.params.fileIndex].data}}","pluginSpecifiedTemplates":[{"value":"UPLOAD_FILE_FROM_BODY"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60da6d3fee9aa1792c5bf5e8","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":["'Query timeout' field must be an integer between 0 and 60000"],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["FilePicker.files[this.params.fileIndex].data","(folder_name.text || folder_name.text == \"\" ? folder_name.text + \"/\" : \"\") + this.params.name"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"CreateFile","actionConfiguration":{"path":"{{(folder_name.text || folder_name.text == \"\" ? folder_name.text + \"/\" : \"\") + this.params.name}}","paginationType":"NONE","timeoutInMillisecond":100000,"encodeParamsToggle":true,"body":"{{FilePicker.files[this.params.fileIndex].data}}","pluginSpecifiedTemplates":[{"value":"UPLOAD_FILE_FROM_BODY"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[4].value"},{"key":"pluginSpecifiedTemplates[3].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["60 * 24","search_input.text"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"ListFiles","actionConfiguration":{"path":"","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","pluginSpecifiedTemplates":[{"value":"LIST"},{"value":"assets-test.appsmith.com"},{"value":"YES"},{"value":"{{ 60 * 24 }}"},{"value":"{{search_input.text}}"},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60da700cee9aa1792c5bf5e9","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[4].value"},{"key":"pluginSpecifiedTemplates[3].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["60 * 24","search_input.text"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"ListFiles","actionConfiguration":{"path":"","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","pluginSpecifiedTemplates":[{"value":"LIST"},{"value":"assets-test.appsmith.com"},{"value":"YES"},{"value":"{{ 60 * 24 }}"},{"value":"{{search_input.text}}"},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":true,"jsonPathKeys":["{...get_exported_app.data, decryptedFields: undefined, datasourceList: get_exported_app.data.datasourceList.map((source) => { return {...source, structure: appsmith.store[source.pluginId] == undefined ? {}: appsmith.store[source.pluginId].data} } ) }","branch_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://hook.integromat.com"}},"executeOnLoad":false,"isValid":true,"name":"update_template","actionConfiguration":{"path":"/uepsj7o6a0hmiodonjr7xrcqj9pixe0s","headers":[{"value":"application/json","key":"content-type"},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"app\": {{ {...get_exported_app.data, decryptedFields: undefined, datasourceList: get_exported_app.data.datasourceList.map((source) => { return {...source, structure: appsmith.store[source.pluginId] == undefined ? {}: appsmith.store[source.pluginId].data} } ) } }},\n\t\"branch\": \"{{branch_input.text}}\"\n}","httpMethod":"POST","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"},"pluginId":"restapi-plugin","id":"60daba3aee9aa1792c5bf647","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":true,"jsonPathKeys":["{...get_exported_app.data, decryptedFields: undefined, datasourceList: get_exported_app.data.datasourceList.map((source) => { return {...source, structure: appsmith.store[source.pluginId] == undefined ? {}: appsmith.store[source.pluginId].data} } ) }","branch_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://hook.integromat.com"}},"executeOnLoad":false,"isValid":true,"name":"update_template","actionConfiguration":{"path":"/uepsj7o6a0hmiodonjr7xrcqj9pixe0s","headers":[{"value":"application/json","key":"content-type"},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"app\": {{ {...get_exported_app.data, decryptedFields: undefined, datasourceList: get_exported_app.data.datasourceList.map((source) => { return {...source, structure: appsmith.store[source.pluginId] == undefined ? {}: appsmith.store[source.pluginId].data} } ) } }},\n\t\"branch\": \"{{branch_input.text}}\"\n}","httpMethod":"POST","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":false,"isValid":true,"id":"Appsmith Prod","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"get_exported_app","actionConfiguration":{"path":"/api/v1/applications/export/60d4559cee9aa1792c5bec3d","headers":[{"value":"_hjIncludedInSample=1; _hjSessionTooLarge=1; _ga=GA1.2.572027528.1599035590; SL_C_23361dd035530_KEY=c370af0df0edf38360adbefbdc47d2b42ea137c9; ajs_user_id=%22nikhil%40appsmith.com%22; ajs_anonymous_id=%2213c846f6-970b-41e1-925f-f8f4a92ea315%22; SL_C_23361dd035530_SID=laR0iYdLzA-; SL_C_23361dd035530_VID=EDGoRechnrX; _hjid=da2ef5e3-4ea5-42dc-b892-7962b7564098; [email protected]; ajs_anonymous_id=13c846f6-970b-41e1-925f-f8f4a92ea315; intercom-id-y10e7138=a7d5577a-ac9b-4f96-93df-c3f86f2b7548; SESSION=21e71ab1-7ef2-4987-b430-1ab002edbd6b; _gid=GA1.2.1874210412.1627809109; amplitude_id_fef1e872c952688acd962d30aa545b9eappsmith.com=eyJkZXZpY2VJZCI6IjU5ZjhhZTJlLTgzYjQtNDY5My1hZjA4LTM2ZGRkZjBjNGJiYlIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYyODE0NzgzNzQ1NiwibGFzdEV2ZW50VGltZSI6MTYyODE0NzgzNzQ1NywiZXZlbnRJZCI6MSwiaWRlbnRpZnlJZCI6MCwic2VxdWVuY2VOdW1iZXIiOjF9; _hjAbsoluteSessionInProgress=0; _hjIncludedInPageviewSample=1; mp_70b8ea94d623dd857fb555a76d11f944_mixpanel=%7B%22distinct_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24device_id%22%3A%20%221787d3b4aab392-0b46f81f3f91ff-1633685c-1aeaa0-1787d3b4aac48d%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%2C%22mp_lib%22%3A%20%22Segment%3A%20web%22%2C%22%24user_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22mp_name_tag%22%3A%20%22nikhil%40appsmith.com%22%2C%22userId%22%3A%20%22nikhil%40appsmith.com%22%2C%22source%22%3A%20%22cloud%22%2C%22id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24email%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24first_name%22%3A%20%22Nikhil%22%2C%22%24last_name%22%3A%20%22Nandagopal%22%2C%22%24name%22%3A%20%22Nikhil%20Nandagopal%22%2C%22utm_source%22%3A%20%22ActiveCampaign%22%2C%22utm_medium%22%3A%20%22email%22%2C%22utm_campaign%22%3A%20%22Day%201%20Nudge%20after%20Sign%20up%22%2C%22utm_content%22%3A%20%22Does%20appsmith%20use%20appsmith%3F%20%F0%9F%A4%94%22%7D; intercom-session-y10e7138=Nkxsd3kzTnVDTC9VcnEzbnNGZFRkWUZ0MG00RzByb2c5YXFOdmM4THpzcHZNYzgwUHdmazdWYXpLb3pkNVRGMy0tcDVLbld2UDJudThPTEQ5d1hZR1BhZz09--fc315a38af2f912c348ca1aa8cdbb9dad2b39c3f","key":"Cookie"},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"},"pluginId":"restapi-plugin","id":"60dabb35ee9aa1792c5bf648","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":false,"isValid":true,"id":"Appsmith Prod","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"get_exported_app","actionConfiguration":{"path":"/api/v1/applications/export/60d4559cee9aa1792c5bec3d","headers":[{"value":"_hjIncludedInSample=1; _hjSessionTooLarge=1; _ga=GA1.2.572027528.1599035590; SL_C_23361dd035530_KEY=c370af0df0edf38360adbefbdc47d2b42ea137c9; ajs_user_id=%22nikhil%40appsmith.com%22; ajs_anonymous_id=%2213c846f6-970b-41e1-925f-f8f4a92ea315%22; SL_C_23361dd035530_SID=laR0iYdLzA-; SL_C_23361dd035530_VID=EDGoRechnrX; _hjid=da2ef5e3-4ea5-42dc-b892-7962b7564098; [email protected]; ajs_anonymous_id=13c846f6-970b-41e1-925f-f8f4a92ea315; intercom-id-y10e7138=a7d5577a-ac9b-4f96-93df-c3f86f2b7548; SESSION=21e71ab1-7ef2-4987-b430-1ab002edbd6b; _gid=GA1.2.1874210412.1627809109; amplitude_id_fef1e872c952688acd962d30aa545b9eappsmith.com=eyJkZXZpY2VJZCI6IjU5ZjhhZTJlLTgzYjQtNDY5My1hZjA4LTM2ZGRkZjBjNGJiYlIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYyODE0NzgzNzQ1NiwibGFzdEV2ZW50VGltZSI6MTYyODE0NzgzNzQ1NywiZXZlbnRJZCI6MSwiaWRlbnRpZnlJZCI6MCwic2VxdWVuY2VOdW1iZXIiOjF9; _hjAbsoluteSessionInProgress=0; _hjIncludedInPageviewSample=1; mp_70b8ea94d623dd857fb555a76d11f944_mixpanel=%7B%22distinct_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24device_id%22%3A%20%221787d3b4aab392-0b46f81f3f91ff-1633685c-1aeaa0-1787d3b4aac48d%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%2C%22mp_lib%22%3A%20%22Segment%3A%20web%22%2C%22%24user_id%22%3A%20%22nikhil%40appsmith.com%22%2C%22mp_name_tag%22%3A%20%22nikhil%40appsmith.com%22%2C%22userId%22%3A%20%22nikhil%40appsmith.com%22%2C%22source%22%3A%20%22cloud%22%2C%22id%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24email%22%3A%20%22nikhil%40appsmith.com%22%2C%22%24first_name%22%3A%20%22Nikhil%22%2C%22%24last_name%22%3A%20%22Nandagopal%22%2C%22%24name%22%3A%20%22Nikhil%20Nandagopal%22%2C%22utm_source%22%3A%20%22ActiveCampaign%22%2C%22utm_medium%22%3A%20%22email%22%2C%22utm_campaign%22%3A%20%22Day%201%20Nudge%20after%20Sign%20up%22%2C%22utm_content%22%3A%20%22Does%20appsmith%20use%20appsmith%3F%20%F0%9F%A4%94%22%7D; intercom-session-y10e7138=Nkxsd3kzTnVDTC9VcnEzbnNGZFRkWUZ0MG00RzByb2c5YXFOdmM4THpzcHZNYzgwUHdmazdWYXpLb3pkNVRGMy0tcDVLbld2UDJudThPTEQ5d1hZR1BhZz09--fc315a38af2f912c348ca1aa8cdbb9dad2b39c3f","key":"Cookie"},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":["this.params.id"],"datasource":{"new":false,"isValid":true,"id":"Appsmith Prod","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"get_datasource_structure","actionConfiguration":{"path":"/api/v1/datasources/{{this.params.id}}/structure","headers":[],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"},"pluginId":"restapi-plugin","id":"60dabca0ee9aa1792c5bf649","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":["this.params.id"],"datasource":{"new":false,"isValid":true,"id":"Appsmith Prod","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"get_datasource_structure","actionConfiguration":{"path":"/api/v1/datasources/{{this.params.id}}/structure","headers":[],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Admin"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["select_cols_input.text","datasource_input.text.split(\"applications/\")[1].split(\"/\")[0]","datasource_input.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]","search_col_input.text","tableName_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_sql_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{tableName_input.text}}\",\n \"datasourceId\": \"{{datasource_input.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]}}\",\n \"applicationId\" : \"{{datasource_input.text.split(\"applications/\")[1].split(\"/\")[0]}}\",\n\t\t\"searchColumn\": \"{{search_col_input.text}}\",\n\t\t\"columns\": \"{{select_cols_input.text}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"},"pluginId":"restapi-plugin","id":"60dadb5aee9aa1792c5bf6bc","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["select_cols_input.text","datasource_input.text.split(\"applications/\")[1].split(\"/\")[0]","datasource_input.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]","search_col_input.text","tableName_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_sql_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{tableName_input.text}}\",\n \"datasourceId\": \"{{datasource_input.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]}}\",\n \"applicationId\" : \"{{datasource_input.text.split(\"applications/\")[1].split(\"/\")[0]}}\",\n\t\t\"searchColumn\": \"{{search_col_input.text}}\",\n\t\t\"columns\": \"{{select_cols_input.text}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[4].value"},{"key":"pluginSpecifiedTemplates[7].value"},{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[3].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["key_select.selectedOptionValue","data_table.pageSize","data_table.searchText||\"\"","order_select.selectedOptionValue","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FindQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":false},{"value":"FORM"},{"value":"FIND"},{"value":"{ col2: /{{data_table.searchText||\"\"}}/i }"},{"value":"{ \n{{key_select.selectedOptionValue}}: {{order_select.selectedOptionValue}} \n}"},null,{"value":"{{data_table.pageSize}}"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}"},null,null,null,null,null,null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"},"pluginId":"mongo-plugin","id":"60db015aee9aa1792c5bf778","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[4].value"},{"key":"pluginSpecifiedTemplates[7].value"},{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[3].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["key_select.selectedOptionValue","data_table.pageSize","data_table.searchText||\"\"","order_select.selectedOptionValue","(data_table.pageNo - 1) * data_table.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FindQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":false},{"value":"FORM"},{"value":"FIND"},{"value":"{ col2: /{{data_table.searchText||\"\"}}/i }"},{"value":"{ \n{{key_select.selectedOptionValue}}: {{order_select.selectedOptionValue}} \n}"},null,{"value":"{{data_table.pageSize}}"},{"value":"{{(data_table.pageNo - 1) * data_table.pageSize}}"},null,null,null,null,null,null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[13].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow._ref","data_table.selectedRow._id"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"path":"template_table/{{data_table.selectedRow._ref}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_DOCUMENT"},{"value":"FORM"},{"value":"DELETE"},null,null,null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"},"pluginId":"mongo-plugin","id":"60db0325ee9aa1792c5bf77e","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[13].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow._ref","data_table.selectedRow._id"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"path":"template_table/{{data_table.selectedRow._ref}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_DOCUMENT"},{"value":"FORM"},{"value":"DELETE"},null,null,null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[11].value"},{"key":"pluginSpecifiedTemplates[12].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","update_col_2.text","data_table.selectedRow._id","update_col_1.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},{"value":"{\n \"col1\" : {{update_col_1.text}},\n\t\"col2\" : {{update_col_2.text}},\n \"col3\" : {{update_col_3.text}},\n \"col4\" : {{update_col_4.text}}\n}"},null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"},"pluginId":"mongo-plugin","id":"60db034dee9aa1792c5bf77f","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[11].value"},{"key":"pluginSpecifiedTemplates[12].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","update_col_2.text","data_table.selectedRow._id","update_col_1.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"UPDATE"},null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},{"value":"{\n \"col1\" : {{update_col_1.text}},\n\t\"col2\" : {{update_col_2.text}},\n \"col3\" : {{update_col_3.text}},\n \"col4\" : {{update_col_4.text}}\n}"},null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[18].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"value":"{\n \"col1\": {{insert_col_input1.text}}, \n \"col2\": {{insert_col_input2.text}}, \n \"col3\": {{insert_col_input3.text}}, \n \"col4\": {{insert_col_input4.text}}\n}"},{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"},"pluginId":"mongo-plugin","id":"60db03dcee9aa1792c5bf781","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[18].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Mock Mongo","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":true},{"value":"FORM"},{"value":"INSERT"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"value":"{\n \"col1\": {{insert_col_input1.text}}, \n \"col2\": {{insert_col_input2.text}}, \n \"col3\": {{insert_col_input3.text}}, \n \"col4\": {{insert_col_input4.text}}\n}"},{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"MongoDB"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["mongo_ds_url.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]","collection_input.text","search_keys_input.text","mongo_ds_url.text.split(\"applications/\")[1].split(\"/\")[0]"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_mongo_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{collection_input.text}}\",\n \"datasourceId\": \"{{mongo_ds_url.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]}}\",\n \"applicationId\" : \"{{mongo_ds_url.text.split(\"applications/\")[1].split(\"/\")[0]}}\",\n\t\t\"searchColumn\" : \"{{search_keys_input.text}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"},"pluginId":"restapi-plugin","id":"60dc1a0aee9aa1792c5bf9a5","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["mongo_ds_url.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]","collection_input.text","search_keys_input.text","mongo_ds_url.text.split(\"applications/\")[1].split(\"/\")[0]"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_mongo_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{collection_input.text}}\",\n \"datasourceId\": \"{{mongo_ds_url.text.split(\"datasource/\")[1].split(\"?\" || \"/\")[0]}}\",\n \"applicationId\" : \"{{mongo_ds_url.text.split(\"applications/\")[1].split(\"/\")[0]}}\",\n\t\t\"searchColumn\" : \"{{search_keys_input.text}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["gsheet_ds_input.text.split(\"datasources/\")[1].split(\"/\" || \"?\")[0]","gsheet_ds_input.text.split(\"applications/\")[1].split(\"/\")[0]","collection_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_gsheet_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{collection_input.text}}\",\n \"datasourceId\": \"{{gsheet_ds_input.text.split(\"datasources/\")[1].split(\"/\" || \"?\")[0]}}\",\n \"applicationId\" : \"{{gsheet_ds_input.text.split(\"applications/\")[1].split(\"/\")[0]}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"},"pluginId":"restapi-plugin","id":"60dc1a22ee9aa1792c5bf9a8","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["gsheet_ds_input.text.split(\"datasources/\")[1].split(\"/\" || \"?\")[0]","gsheet_ds_input.text.split(\"applications/\")[1].split(\"/\")[0]","collection_input.text"],"datasource":{"new":true,"invalids":[],"pluginId":"restapi-plugin","isValid":true,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[],"datasourceConfiguration":{"url":"https://release.app.appsmith.com"}},"executeOnLoad":false,"isValid":true,"name":"generate_gsheet_app","actionConfiguration":{"path":"/api/v1/pages/crud-page","headers":[{"value":"application/json","key":"Content-Type"},{"value":"SESSION=691d7061-6eb8-4483-af91-b6e5de0692cc","key":"Cookie"}],"paginationType":"PAGE_NO","queryParameters":[],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n \"tableName\": \"{{collection_input.text}}\",\n \"datasourceId\": \"{{gsheet_ds_input.text.split(\"datasources/\")[1].split(\"/\" || \"?\")[0]}}\",\n \"applicationId\" : \"{{gsheet_ds_input.text.split(\"applications/\")[1].split(\"/\")[0]}}\"\n}","httpMethod":"POST"},"userPermissions":[],"pageId":"Page Generator"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["File_List.selectedItem.fileName"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteFile","actionConfiguration":{"path":"{{File_List.selectedItem.fileName}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_FILE"},{"value":"assets-test.appsmith.com"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60e6cb8c646724139a549885","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["File_List.selectedItem.fileName"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteFile","actionConfiguration":{"path":"{{File_List.selectedItem.fileName}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_FILE"},{"value":"assets-test.appsmith.com"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["File_List.selectedItem.fileName"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"ReadFile","actionConfiguration":{"path":"{{File_List.selectedItem.fileName}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","pluginSpecifiedTemplates":[{"value":"READ_FILE"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60e6d7c3646724139a5498c4","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["File_List.selectedItem.fileName"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"ReadFile","actionConfiguration":{"path":"{{File_List.selectedItem.fileName}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","pluginSpecifiedTemplates":[{"value":"READ_FILE"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_file_picker.files.length ? update_file_picker.files[0].data : \"\"","update_file_name.text"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateFile","actionConfiguration":{"path":"{{update_file_name.text}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{{update_file_picker.files.length ? update_file_picker.files[0].data : \"\" }}","pluginSpecifiedTemplates":[{"value":"UPLOAD_FILE_FROM_BODY"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"},"pluginId":"amazons3-plugin","id":"60e6edae646724139a549925","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_file_picker.files.length ? update_file_picker.files[0].data : \"\"","update_file_name.text"],"datasource":{"new":false,"isValid":true,"id":"AmazonS3","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateFile","actionConfiguration":{"path":"{{update_file_name.text}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{{update_file_picker.files.length ? update_file_picker.files[0].data : \"\" }}","pluginSpecifiedTemplates":[{"value":"UPLOAD_FILE_FROM_BODY"},{"value":"assets-test.appsmith.com"},{"value":"NO"},{"value":"5"},{"value":""},{"value":"YES"},{"value":"YES"},{"value":"5"}]},"userPermissions":[],"pageId":"S3"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow._ref.path","data_table.selectedRow._id"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"path":"{{data_table.selectedRow._ref.path}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_DOCUMENT"},{"value":"FORM"},{"value":"DELETE"},null,null,null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"firestore-plugin","id":"60ec1d85a5109b1d752d75df","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow._ref.path","data_table.selectedRow._id"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"path":"{{data_table.selectedRow._ref.path}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"DELETE_DOCUMENT"},{"value":"FORM"},{"value":"DELETE"},null,null,null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","update_col_2.text","data_table.selectedRow._ref.path","update_col_1.text","update_col_5.text","data_table.selectedRow._id","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"path":"{{data_table.selectedRow._ref.path}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"col1\": \"{{update_col_1.text}}\",\n\t\"col2\": \"{{update_col_2.text}}\",\n\t\"col3\": \"{{update_col_3.text}}\",\n\t\"col4\": \"{{update_col_4.text}}\",\n\t\"col5\": \"{{update_col_5.text}}\"\n}","pluginSpecifiedTemplates":[{"value":"UPDATE_DOCUMENT"},{"value":"FORM"},{"value":"UPDATE"},null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},{"value":"{\n \"col1\" : {{update_col_1.text}},\n\t\"col2\" : {{update_col_2.text}},\n \"col3\" : {{update_col_3.text}},\n \"col4\" : {{update_col_4.text}}\n}"},null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"firestore-plugin","id":"60ec1d85a5109b1d752d75de","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"},{"key":"path"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","update_col_2.text","data_table.selectedRow._ref.path","update_col_1.text","update_col_5.text","data_table.selectedRow._id","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"path":"{{data_table.selectedRow._ref.path}}","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"col1\": \"{{update_col_1.text}}\",\n\t\"col2\": \"{{update_col_2.text}}\",\n\t\"col3\": \"{{update_col_3.text}}\",\n\t\"col4\": \"{{update_col_4.text}}\",\n\t\"col5\": \"{{update_col_5.text}}\"\n}","pluginSpecifiedTemplates":[{"value":"UPDATE_DOCUMENT"},{"value":"FORM"},{"value":"UPDATE"},null,null,null,null,null,null,null,null,{"value":"{ _id: ObjectId('{{data_table.selectedRow._id}}') }"},{"value":"{\n \"col1\" : {{update_col_1.text}},\n\t\"col2\" : {{update_col_2.text}},\n \"col3\" : {{update_col_3.text}},\n \"col4\" : {{update_col_4.text}}\n}"},null,null,null,null,null,null,{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"path":"template_table","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"col1\": \"{{insert_col_input1.text}}\",\n\t\"col2\": \"{{insert_col_input2.text}}\",\n\t\"col3\": \"{{insert_col_input3.text}}\",\n\t\"col4\": \"{{insert_col_input4.text}}\",\n\t\"col5\": \"{{insert_col_input5.text}}\"\n}","pluginSpecifiedTemplates":[{"value":"ADD_TO_COLLECTION"},{"value":"FORM"},{"value":"INSERT"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"value":"{\n \"col1\": {{insert_col_input1.text}}, \n \"col2\": {{insert_col_input2.text}}, \n \"col3\": {{insert_col_input3.text}}, \n \"col4\": {{insert_col_input4.text}}\n}"},{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"firestore-plugin","id":"60ec1d85a5109b1d752d75e1","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"path":"template_table","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"{\n\t\"col1\": \"{{insert_col_input1.text}}\",\n\t\"col2\": \"{{insert_col_input2.text}}\",\n\t\"col3\": \"{{insert_col_input3.text}}\",\n\t\"col4\": \"{{insert_col_input4.text}}\",\n\t\"col5\": \"{{insert_col_input5.text}}\"\n}","pluginSpecifiedTemplates":[{"value":"ADD_TO_COLLECTION"},{"value":"FORM"},{"value":"INSERT"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"value":"{\n \"col1\": {{insert_col_input1.text}}, \n \"col2\": {{insert_col_input2.text}}, \n \"col3\": {{insert_col_input3.text}}, \n \"col4\": {{insert_col_input4.text}}\n}"},{"value":"template_table"},{"value":"SINGLE"},{"value":"SINGLE"}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"API","unpublishedAction":{"invalids":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":true,"invalids":["No datasource configuration found. Please configure it and try again."],"pluginId":"restapi-plugin","isValid":false,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"Api1","actionConfiguration":{"headers":[{"value":"","key":""},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"restapi-plugin","id":"60ec2e7aa5109b1d752d7621","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":true,"invalids":["No datasource configuration found. Please configure it and try again."],"pluginId":"restapi-plugin","isValid":false,"name":"DEFAULT_REST_DATASOURCE","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"Api1","actionConfiguration":{"headers":[{"value":"","key":""},{"value":"","key":""}],"paginationType":"NONE","queryParameters":[{"value":"","key":""},{"value":"","key":""}],"timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"","httpMethod":"GET","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[1].value"},{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[7].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["SelectQuery.data[SelectQuery.data.length - 1]","order_select.selectedOptionValue + key_select.selectedOptionValue","SelectQuery.data[0]"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"path":"template_table","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"GET_COLLECTION","key":"method"},{"value":"[\"{{order_select.selectedOptionValue + key_select.selectedOptionValue}}\"]","key":"orderBy"},{"value":"1","key":"limit"},{"key":"whereConditionTuples"},null,null,{"value":"{{SelectQuery.data[SelectQuery.data.length - 1]}}","key":"limit"},{"value":"{{SelectQuery.data[0]}}","key":"limit"},{"value":"","key":"timestampValuePath"},{"value":"","key":"deleteKeyValuePairPath"}]},"userPermissions":[],"pageId":"Firestore"},"pluginId":"firestore-plugin","id":"60ee9cafa5109b1d752d7b7b","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"pluginSpecifiedTemplates[1].value"},{"key":"pluginSpecifiedTemplates[6].value"},{"key":"pluginSpecifiedTemplates[7].value"}],"confirmBeforeExecute":false,"jsonPathKeys":["SelectQuery.data[SelectQuery.data.length - 1]","order_select.selectedOptionValue + key_select.selectedOptionValue","SelectQuery.data[0]"],"datasource":{"new":false,"isValid":true,"id":"FBTemplateDB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"path":"template_table","paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"pluginSpecifiedTemplates":[{"value":"GET_COLLECTION","key":"method"},{"value":"[\"{{order_select.selectedOptionValue + key_select.selectedOptionValue}}\"]","key":"orderBy"},{"value":"1","key":"limit"},{"key":"whereConditionTuples"},null,null,{"value":"{{SelectQuery.data[SelectQuery.data.length - 1]}}","key":"limit"},{"value":"{{SelectQuery.data[0]}}","key":"limit"},{"value":"","key":"timestampValuePath"},{"value":"","key":"deleteKeyValuePairPath"}]},"userPermissions":[],"pageId":"Firestore"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FetchKeys","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"keys *"},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeaf83a5109b1d752d7bab","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[],"confirmBeforeExecute":false,"jsonPathKeys":[],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FetchKeys","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"keys *"},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_key_input.text","insert_value_input.text"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"set {{insert_key_input.text}} \"{{insert_value_input.text}}\""},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeb2f2a5109b1d752d7bb3","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_key_input.text","insert_value_input.text"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"set {{insert_key_input.text}} \"{{insert_value_input.text}}\""},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_value_input.text","data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"set {{data_table.selectedRow.result}} \"{{update_value_input.text}}\""},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeb563a5109b1d752d7bbc","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_value_input.text","data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"set {{data_table.selectedRow.result}} \"{{update_value_input.text}}\""},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"del {{data_table.selectedRow.result}}"},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeb5caa5109b1d752d7bbd","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteKey","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"del {{data_table.selectedRow.result}}"},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FetchValue","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"GET {{data_table.selectedRow.result}}"},"userPermissions":[],"pageId":"Redis"},"pluginId":"redis-plugin","id":"60eeb8eda5109b1d752d7bc3","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["data_table.selectedRow.result"],"datasource":{"new":false,"isValid":true,"id":"RedisTemplateApps","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"FetchValue","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"GET {{data_table.selectedRow.result}}"},"userPermissions":[],"pageId":"Redis"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","Table1.selectedRow.col1","update_col_2.text","update_col_5.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"UPDATE public.template_table SET\n\t\t\"col2\" = '{{update_col_2.text}}',\n \"col3\" = '{{update_col_3.text}}',\n \"col4\" = '{{update_col_4.text}}',\n \"col5\" = '{{update_col_5.text}}'\n WHERE \"col1\" = {{Table1.selectedRow.col1}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"PostgreSQL"},"pluginId":"postgres-plugin","id":"60f68221d4c0bb105f54dfd2","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["update_col_3.text","Table1.selectedRow.col1","update_col_2.text","update_col_5.text","update_col_4.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"UpdateQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"UPDATE public.template_table SET\n\t\t\"col2\" = '{{update_col_2.text}}',\n \"col3\" = '{{update_col_3.text}}',\n \"col4\" = '{{update_col_4.text}}',\n \"col5\" = '{{update_col_5.text}}'\n WHERE \"col1\" = {{Table1.selectedRow.col1}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"PostgreSQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["Table1.selectedRow.col1"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"DELETE FROM public.template_table\n WHERE \"col1\" = {{Table1.selectedRow.col1}};"},"userPermissions":[],"pageId":"PostgreSQL"},"pluginId":"postgres-plugin","id":"60f68221d4c0bb105f54dfd3","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["Table1.selectedRow.col1"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"DeleteQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"DELETE FROM public.template_table\n WHERE \"col1\" = {{Table1.selectedRow.col1}};"},"userPermissions":[],"pageId":"PostgreSQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"SELECT * FROM public.template_table\nWHERE \"col2\" ilike '%{{Table1.searchText || \"\"}}%'\nORDER BY \"{{col_select.selectedOptionValue}}\" {{order_select.selectedOptionLabel}}\nLIMIT {{Table1.pageSize}}\nOFFSET {{(Table1.pageNo - 1) * Table1.pageSize}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"PostgreSQL"},"pluginId":"postgres-plugin","id":"60f68221d4c0bb105f54dfd4","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":true,"isValid":true,"name":"SelectQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"SELECT * FROM public.template_table\nWHERE \"col2\" ilike '%{{Table1.searchText || \"\"}}%'\nORDER BY \"{{col_select.selectedOptionValue}}\" {{order_select.selectedOptionLabel}}\nLIMIT {{Table1.pageSize}}\nOFFSET {{(Table1.pageNo - 1) * Table1.pageSize}};","pluginSpecifiedTemplates":[{"value":false}]},"userPermissions":[],"pageId":"PostgreSQL"}},{"new":false,"pluginType":"DB","unpublishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"INSERT INTO public.template_table (\n\t\"col1\",\n\t\"col2\", \n\t\"col3\",\n\t\"col4\", \n\t\"col5\"\n)\nVALUES (\n\t\t\t\t{{insert_col_input1.text}}, \n\t\t\t\t{{insert_col_input2.text}}, \n\t\t\t\t{{insert_col_input3.text}}, \n\t\t\t\t{{insert_col_input4.text}}, \n\t\t\t\t{{insert_col_input5.text}}\n);","pluginSpecifiedTemplates":[{"value":true}]},"userPermissions":[],"pageId":"PostgreSQL"},"pluginId":"postgres-plugin","id":"60f68221d4c0bb105f54dfd5","userPermissions":["read:actions","execute:actions","manage:actions"],"publishedAction":{"invalids":[],"dynamicBindingPathList":[{"key":"body"}],"confirmBeforeExecute":false,"jsonPathKeys":["insert_col_input1.text","insert_col_input5.text","insert_col_input4.text","insert_col_input3.text","insert_col_input2.text"],"datasource":{"new":false,"isValid":true,"id":"Internal DB","userPermissions":[]},"executeOnLoad":false,"isValid":true,"name":"InsertQuery","actionConfiguration":{"paginationType":"NONE","timeoutInMillisecond":10000,"encodeParamsToggle":true,"body":"INSERT INTO public.template_table (\n\t\"col1\",\n\t\"col2\", \n\t\"col3\",\n\t\"col4\", \n\t\"col5\"\n)\nVALUES (\n\t\t\t\t{{insert_col_input1.text}}, \n\t\t\t\t{{insert_col_input2.text}}, \n\t\t\t\t{{insert_col_input3.text}}, \n\t\t\t\t{{insert_col_input4.text}}, \n\t\t\t\t{{insert_col_input5.text}}\n);","pluginSpecifiedTemplates":[{"value":true}]},"userPermissions":[],"pageId":"PostgreSQL"}}],"unpublishedLayoutmongoEscapedWidgets":{"60dafddaee9aa1792c5bf76d":["data_table"]},"pageList":[{"publishedPage":{"name":"SQL","userPermissions":[],"layouts":[{"new":false,"id":"60d4559cee9aa1792c5bec3e","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60d4559cee9aa1792c5bec40"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":800,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":880,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Table1","columnOrder":["col1","col2","col3","col4","col5","customColumn1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","fontStyle":"","textColor":"","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"col_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"ASC","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"ASC\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"DESC\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"9t3vdjd5xj","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"5rfqxgj0vm","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!Table1.selectedRow.col1}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col4}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row: {{Table1.selectedRow.col1}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"},{"widgetName":"Text20","rightColumn":18,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"SQL","userPermissions":[],"layouts":[{"new":false,"id":"60d4559cee9aa1792c5bec3e","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60d4559cee9aa1792c5bec40"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":800,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":880,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Table1","columnOrder":["col1","col2","col3","col4","col5","customColumn1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","fontStyle":"","textColor":"","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"col_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"ASC","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"ASC\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"DESC\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"9t3vdjd5xj","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"5rfqxgj0vm","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!Table1.selectedRow.col1}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col4}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row: {{Table1.selectedRow.col1}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"},{"widgetName":"Text20","rightColumn":18,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Google Sheets","userPermissions":[],"layouts":[{"new":false,"id":"60d45c59ee9aa1792c5bec5a","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"SAAS","jsonPathKeys":["data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60d468c1ee9aa1792c5bec95"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":890,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["col1","col2","col3","col4","rowIndex","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":6,"bottomRow":84,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"}],"dynamicBindingPathList":[{"key":"tableData"},{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"primaryColumns.rowIndex.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col1.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"rowIndex":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.rowIndex))}}","textSize":"PARAGRAPH","index":4,"isVisible":false,"label":"rowIndex","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"rowIndex","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{deleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"step":62,"status":75,"col1":140}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":41,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":39,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":18.8828125,"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text11","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Alert"},{"widgetName":"Button1","rightColumn":48,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":16,"bottomRow":20,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"delete_button","rightColumn":64,"onClick":"{{(function () {\nDeleteQuery.run(() =>{ showAlert('Row successfully deleted!','success');\tSelectQuery.run();\n}, () => showAlert('Something went wrong! Please check debugger for more info.','error'));\ncloseModal('Delete_Modal');\n})()}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":16,"bottomRow":20,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":60,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"hqtpvn9ut2","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"ipc9o3ksyi","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"hqtpvn9ut2","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"FormButton1","rightColumn":63,"onClick":"{{(function () {\nInsertQuery.run(() =>{ \t\tshowAlert('Item successfully inserted!','success');\ncloseModal('Insert_Modal');\nSelectQuery.run();\n}, (error) => showAlert(error,'error'));\n})()}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"s2jtkzz2ub","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"FormButton2","rightColumn":45,"isDefaultClickDisabled":true,"widgetId":"396envygmb","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Reset"},{"widgetName":"Text21","rightColumn":18,"textAlign":"RIGHT","widgetId":"vwgogtczul","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"cbz2r2wizv","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col1}}","isDisabled":false},{"widgetName":"Text22","rightColumn":18,"textAlign":"RIGHT","widgetId":"t2a63abehn","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"tjrktjwn9c","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","defaultText":"","placeholderText":"{{data_table.tableData[0].col2}}","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"0xqhj661rj","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"et0p9va1yw","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col3}}","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"mxztke60bg","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"wp3nuhaz7m","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col4}}","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"2xn45kukrz","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"lqhw4zvrts","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col5}}","isDisabled":false},{"widgetName":"Text13","rightColumn":35,"textAlign":"LEFT","widgetId":"iuydklwdo3","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"ipc9o3ksyi","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{data_table.selectedRowIndex >= 0}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":60,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":39,"dynamicBindingPathList":[],"text":"Update"},{"isRequired":false,"widgetName":"colInput1","rightColumn":60,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":18,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput2","rightColumn":60,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput3","rightColumn":60,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput4","rightColumn":60,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row Index: {{data_table.selectedRow.rowIndex}}"},{"widgetName":"col_text_1","rightColumn":18,"textAlign":"LEFT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"widgetName":"col_text_2","rightColumn":19,"textAlign":"LEFT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"widgetName":"col_text_3","rightColumn":19,"textAlign":"LEFT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"widgetName":"col_text_4","rightColumn":19,"textAlign":"LEFT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Google Sheets","userPermissions":[],"layouts":[{"new":false,"id":"60d45c59ee9aa1792c5bec5a","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"SAAS","jsonPathKeys":["data_table.pageSize","(data_table.pageNo - 1) * data_table.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60d468c1ee9aa1792c5bec95"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":890,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["col1","col2","col3","col4","rowIndex","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":6,"bottomRow":84,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"}],"dynamicBindingPathList":[{"key":"tableData"},{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"primaryColumns.rowIndex.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col1.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"rowIndex":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.rowIndex))}}","textSize":"PARAGRAPH","index":4,"isVisible":false,"label":"rowIndex","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"rowIndex","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{deleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"step":62,"status":75,"col1":140}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":41,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":39,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":18.8828125,"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text11","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Alert"},{"widgetName":"Button1","rightColumn":48,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":16,"bottomRow":20,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"delete_button","rightColumn":64,"onClick":"{{(function () {\nDeleteQuery.run(() =>{ showAlert('Row successfully deleted!','success');\tSelectQuery.run();\n}, () => showAlert('Something went wrong! Please check debugger for more info.','error'));\ncloseModal('Delete_Modal');\n})()}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":16,"bottomRow":20,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":60,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"hqtpvn9ut2","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"ipc9o3ksyi","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"hqtpvn9ut2","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"FormButton1","rightColumn":63,"onClick":"{{(function () {\nInsertQuery.run(() =>{ \t\tshowAlert('Item successfully inserted!','success');\ncloseModal('Insert_Modal');\nSelectQuery.run();\n}, (error) => showAlert(error,'error'));\n})()}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"s2jtkzz2ub","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"FormButton2","rightColumn":45,"isDefaultClickDisabled":true,"widgetId":"396envygmb","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Reset"},{"widgetName":"Text21","rightColumn":18,"textAlign":"RIGHT","widgetId":"vwgogtczul","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"cbz2r2wizv","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col1}}","isDisabled":false},{"widgetName":"Text22","rightColumn":18,"textAlign":"RIGHT","widgetId":"t2a63abehn","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"tjrktjwn9c","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","defaultText":"","placeholderText":"{{data_table.tableData[0].col2}}","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"0xqhj661rj","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"et0p9va1yw","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col3}}","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"mxztke60bg","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"wp3nuhaz7m","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col4}}","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"2xn45kukrz","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"lqhw4zvrts","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"ipc9o3ksyi","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[{"key":"placeholderText"}],"inputType":"TEXT","placeholderText":"{{data_table.tableData[0].col5}}","isDisabled":false},{"widgetName":"Text13","rightColumn":35,"textAlign":"LEFT","widgetId":"iuydklwdo3","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"ipc9o3ksyi","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{data_table.selectedRowIndex >= 0}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":60,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":39,"dynamicBindingPathList":[],"text":"Update"},{"isRequired":false,"widgetName":"colInput1","rightColumn":60,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":18,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput2","rightColumn":60,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput3","rightColumn":60,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":false,"widgetName":"colInput4","rightColumn":60,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row Index: {{data_table.selectedRow.rowIndex}}"},{"widgetName":"col_text_1","rightColumn":18,"textAlign":"LEFT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"widgetName":"col_text_2","rightColumn":19,"textAlign":"LEFT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"widgetName":"col_text_3","rightColumn":19,"textAlign":"LEFT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"widgetName":"col_text_4","rightColumn":19,"textAlign":"LEFT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"S3","userPermissions":[],"layouts":[{"new":false,"id":"60da6c7aee9aa1792c5bf5e4","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["60 * 24","search_input.text"],"name":"ListFiles","timeoutInMillisecond":10000,"id":"60da700cee9aa1792c5bf5e9"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":1270,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":1280,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Zoom_Modal2","rightColumn":0,"detachFromLayout":true,"widgetId":"kqxoe40pg6","topRow":89,"bottomRow":89,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas9Copy","rightColumn":0,"detachFromLayout":true,"widgetId":"80wzwajsst","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"kqxoe40pg6","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3Copy","rightColumn":64,"onClick":"{{closeModal('Zoom_Modal2')}}","color":"#040627","iconName":"cross","widgetId":"8kw9kfcd5y","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"80wzwajsst","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text15Copy","rightColumn":41,"textAlign":"LEFT","widgetId":"vk710q1v3s","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"80wzwajsst","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Zoom Image"},{"widgetName":"Button13Copy","rightColumn":63,"onClick":"{{closeModal('Zoom_Modal2')}}","isDefaultClickDisabled":true,"widgetId":"lfiwss1u3w","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"80wzwajsst","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":47,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"image":"{{selected_files.selectedItem.base64}}","widgetName":"Image3Copy","rightColumn":64,"objectFit":"contain","widgetId":"2bewgakjx9","topRow":6,"bottomRow":51,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"80wzwajsst","isLoading":false,"maxZoomLevel":8,"parentColumnSpace":8,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":1,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"}],"isDisabled":false}]},{"backgroundColor":"#FFFFFF","widgetName":"Container3","rightColumn":32,"widgetId":"th4d9oxy8z","containerStyle":"card","topRow":5,"bottomRow":88,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"leftColumn":0,"children":[{"widgetName":"Canvas4","rightColumn":634,"detachFromLayout":true,"widgetId":"6tz2s7ivi5","containerStyle":"none","topRow":0,"bottomRow":2290,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"th4d9oxy8z","minHeight":830,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":false,"onTextChanged":"{{ListFiles.run()}}","widgetName":"search_input","rightColumn":40,"widgetId":"0llmlojupa","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"6tz2s7ivi5","isLoading":false,"parentColumnSpace":19.5,"dynamicTriggerPathList":[{"key":"onTextChanged"}],"resetOnSubmit":true,"leftColumn":0,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"Search File Prefix","defaultText":"","isDisabled":false},{"template":{"Image4":{"image":"{{File_List.listData.map((currentItem) => {\n return (function(){\n return ( currentItem.signedUrl );\n })();\n })}}","widgetName":"Image4","rightColumn":48,"onClick":"{{showModal('Zoom_Modal')}}","objectFit":"contain","widgetId":"k9t673b0fu","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"enableDownload":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"enableRotation":true,"defaultImage":true},"topRow":1,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"maxZoomLevel":1,"enableDownload":false,"parentColumnSpace":19.0625,"imageShape":"RECTANGLE","leftColumn":32,"enableRotation":false,"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"},"Text16":{"text":"{{File_List.listData.map((currentItem) => {\n return (function(){\n return ( currentItem.fileName );\n })();\n })}}","shouldScroll":true},"download_button":{"onClick":"{{navigateTo(currentItem.signedUrl, {})}}"}},"childAutoComplete":{"currentItem":{"fileName":"","urlExpiryDate":"","signedUrl":""}},"backgroundColor":"","widgetName":"File_List","rightColumn":64,"itemBackgroundColor":"#FFFFFF","listData":"{{ListFiles.data}}","widgetId":"p9xuxpwwuc","topRow":5,"bottomRow":81,"parentRowSpace":10,"isVisible":true,"type":"LIST_WIDGET","parentId":"6tz2s7ivi5","gridGap":"10","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[{"key":"template.download_button.onClick"},{"key":"template.MenuButton1.menuItems.menuItem1.onClick"},{"key":"template.Image4.onClick"}],"leftColumn":0,"dynamicBindingPathList":[{"key":"listData"},{"key":"template.Image4.image"},{"key":"template.Text16.text"}],"gridType":"vertical","enhancements":true,"children":[{"widgetName":"Canvas11","rightColumn":634,"detachFromLayout":true,"widgetId":"jczf6u7ji9","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"p9xuxpwwuc","openParentPropertyPane":true,"minHeight":760,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"backgroundColor":"white","widgetName":"Container5","rightColumn":64,"disallowCopy":true,"widgetId":"aiiokpktqq","containerStyle":"card","topRow":0,"bottomRow":16,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"jczf6u7ji9","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":[{"widgetName":"Canvas12","detachFromLayout":true,"widgetId":"qxtrflb6ki","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"aiiokpktqq","minHeight":160,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"fnla1fasgx","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"fontSize":true,"text":true},"topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[],"leftColumn":22,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{currentItem.fileName}}"},{"widgetName":"download_button","rightColumn":64,"onClick":"{{navigateTo(currentItem.signedUrl, {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"wqenprx82s","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"Download","isDisabled":false},{"widgetName":"Button5","rightColumn":51,"onClick":"{{copyToClipboard(File_List.selectedItem.signedUrl)}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"47abcy9ml3","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":38,"dynamicBindingPathList":[],"text":"Copy URL","isDisabled":false},{"widgetName":"Button14","rightColumn":38,"onClick":"{{showModal('Edit_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"0xc28a5g77","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":27,"dynamicBindingPathList":[],"text":"Update","isDisabled":false},{"widgetName":"delete_button","rightColumn":64,"onClick":"{{showModal('delete_modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"ge7ws9hdfv","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"DANGER_BUTTON","topRow":4,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":54,"dynamicBindingPathList":[],"text":"Delete","isDisabled":false},{"image":"{{currentItem.signedUrl}}","widgetName":"Image4","onClick":"{{showModal('Zoom_Modal')}}","rightColumn":21,"objectFit":"contain","widgetId":"k9t673b0fu","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"enableDownload":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"enableRotation":true,"defaultImage":true},"topRow":0,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"maxZoomLevel":1,"enableDownload":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"enableRotation":false,"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"}]}],"disablePropertyPane":true}]}]}]}]},{"widgetName":"Text6","rightColumn":64,"backgroundColor":"","textAlign":"LEFT","widgetId":"t54ituq472","topRow":0,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#2E3D49","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Bucket"},{"widgetName":"Upload_Files_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"1fxorj7v97","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":0,"detachFromLayout":true,"widgetId":"d8io5ijwj4","topRow":0,"bottomRow":620,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"1fxorj7v97","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[],"isDisabled":false}]},{"widgetName":"delete_modal","rightColumn":0,"detachFromLayout":true,"widgetId":"9g0cw9adf8","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas6","rightColumn":0,"detachFromLayout":true,"widgetId":"ozvpoudxz2","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"9g0cw9adf8","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon2","rightColumn":64,"onClick":"{{closeModal('delete_modal')}}","color":"#040627","iconName":"cross","widgetId":"xkyh49z71e","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text12","rightColumn":41,"textAlign":"LEFT","widgetId":"s1y44xm547","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete File"},{"widgetName":"Button10","rightColumn":48,"onClick":"{{closeModal('delete_modal')}}","isDefaultClickDisabled":true,"widgetId":"pi0t67rnwh","buttonStyle":"SECONDARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Button11","rightColumn":64,"onClick":"{{DeleteFile.run(() => ListFiles.run(() => closeModal('delete_modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"hp22uj3dra","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text13","rightColumn":64,"textAlign":"LEFT","widgetId":"oypa9ad1tg","topRow":5,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ozvpoudxz2","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete the file?\n\n{{File_List.selectedItem.fileName}}"}],"isDisabled":false}]},{"widgetName":"Zoom_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"p4buulj86a","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas9","rightColumn":0,"detachFromLayout":true,"widgetId":"p3cxdtb4wp","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"p4buulj86a","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3","rightColumn":64,"onClick":"{{closeModal('Zoom_Modal')}}","color":"#040627","iconName":"cross","widgetId":"b49lgvj9yy","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text15","rightColumn":41,"textAlign":"LEFT","widgetId":"cy38v3de8z","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Zoom Image"},{"widgetName":"Button13","rightColumn":63,"onClick":"{{closeModal('Zoom_Modal')}}","isDefaultClickDisabled":true,"widgetId":"ftst3w9m8m","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":47,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"image":"{{File_List.selectedItem.signedUrl}}","widgetName":"Image3","rightColumn":64,"objectFit":"contain","widgetId":"a5gy0pdfzn","topRow":6,"bottomRow":51,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"maxZoomLevel":8,"parentColumnSpace":8,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":1,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"}],"isDisabled":false}]},{"widgetName":"Edit_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"usealgbtyj","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas10","rightColumn":0,"detachFromLayout":true,"widgetId":"6i7m9kpuky","topRow":0,"bottomRow":240,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"usealgbtyj","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon4","rightColumn":64,"onClick":"{{closeModal('Edit_Modal')}}","color":"#040627","iconName":"cross","widgetId":"pstfdcc1e4","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text17","rightColumn":41,"textAlign":"LEFT","widgetId":"z64z3l112n","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Update File"},{"widgetName":"Button15","rightColumn":44,"onClick":"{{closeModal('Edit_Modal')}}","isDefaultClickDisabled":true,"widgetId":"trc4e6ylcz","buttonStyle":"SECONDARY_BUTTON","topRow":18,"bottomRow":22,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":32,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"update_button","rightColumn":64,"onClick":"{{UpdateFile.run(() => ListFiles.run(() => {resetWidget('update_file_picker');closeModal('Edit_Modal');}), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"},{"key":"isDisabled"}],"widgetId":"8lbthc9dml","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":44,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Update","isDisabled":"{{update_file_picker.files.length == 0}}"},{"widgetName":"Text18","rightColumn":17,"textAlign":"RIGHT","widgetId":"qb26g34etr","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"6i7m9kpuky","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"File Name"},{"isRequired":false,"widgetName":"update_file_name","rightColumn":64,"widgetId":"je0ea8ma5d","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":17,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{File_List.selectedItem.fileName}}","isDisabled":true},{"widgetName":"update_file_picker","topRow":11,"bottomRow":15,"parentRowSpace":10,"allowedFileTypes":["*","image/*","video/*","audio/*","text/*",".doc","image/jpeg",".png"],"type":"FILE_PICKER_WIDGET","parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":17,"dynamicBindingPathList":[],"isDisabled":false,"isRequired":false,"rightColumn":64,"isDefaultClickDisabled":true,"widgetId":"mioot5pcs5","defaultSelectedFiles":[],"isVisible":true,"label":"Select File","maxFileSize":"10","version":1,"fileDataType":"Base64","parentId":"6i7m9kpuky","selectedFiles":[],"isLoading":false,"files":[],"maxNumFiles":1}],"isDisabled":false}]},{"backgroundColor":"#FFFFFF","widgetName":"Container6","rightColumn":64,"widgetId":"yg1iyxq9kd","containerStyle":"card","topRow":6,"bottomRow":88,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"leftColumn":37,"children":[{"widgetName":"Canvas13","rightColumn":634,"detachFromLayout":true,"widgetId":"xv97g6rzgq","containerStyle":"none","topRow":0,"bottomRow":600,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"yg1iyxq9kd","minHeight":820,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Button8","rightColumn":43,"onClick":"{{closeModal('Upload_Files_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"bx8wok3aut","buttonStyle":"SECONDARY_BUTTON","topRow":75,"bottomRow":79,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"xv97g6rzgq","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":31,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"template":{"Canvas7":{"widgetName":"Canvas7","rightColumn":256,"detachFromLayout":true,"widgetId":"oqhzaygncs","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"0n30419eso","openParentPropertyPane":true,"minHeight":340,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":["u3nvgafsdo"]},"update_files_name":{"isRequired":false,"widgetName":"update_files_name","rightColumn":63,"widgetId":"7zziet357m","logBlackList":{"isRequired":true,"widgetName":true,"rightColumn":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"label":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"resetOnSubmit":true,"leftColumn":true,"inputType":true,"isDisabled":true},"topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"romgsruzxz","isLoading":false,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":23,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{selected_files.listData.map((currentItem) => currentItem.name)}}","isDisabled":false},"Image2":{"image":"{{selected_files.listData.map((currentItem) => currentItem.base64)}}","widgetName":"Image2","rightColumn":10,"onClick":"{{showModal('Zoom_Modal2')}}","objectFit":"{{selected_files.listData.map((currentItem, currentIndex) => {\n return (function(){\n return 'contain';\n })();\n })}}","widgetId":"ql8qs2xelx","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"defaultImage":true},"topRow":0,"bottomRow":6,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"romgsruzxz","isLoading":false,"maxZoomLevel":1,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"},"Container4":{"backgroundColor":"white","widgetName":"Container4","rightColumn":64,"disallowCopy":true,"widgetId":"u3nvgafsdo","containerStyle":"card","topRow":0,"bottomRow":8,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"oqhzaygncs","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":["romgsruzxz"],"disablePropertyPane":true},"Canvas8":{"widgetName":"Canvas8","detachFromLayout":true,"widgetId":"romgsruzxz","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"u3nvgafsdo","minHeight":80,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":["vu7fb0dbt8","7zziet357m","ql8qs2xelx"]},"Text14":{"widgetName":"Text14","rightColumn":23,"textAlign":"{{selected_files.listData.map((currentItem, currentIndex) => {\n return (function(){\n return 'LEFT';\n })();\n })}}","widgetId":"vu7fb0dbt8","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"dynamicTriggerPathList":true,"parentColumnSpace":true,"dynamicBindingPathList":true,"leftColumn":true,"fontSize":true,"text":true,"textStyle":true},"topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"romgsruzxz","isLoading":false,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":11,"fontSize":"PARAGRAPH","text":"File Name","textStyle":"HEADING"}},"childAutoComplete":{"currentItem":{"data":"","base64":"","name":"","raw":"","id":"","text":"","type":""}},"widgetName":"selected_files","backgroundColor":"","rightColumn":64,"listData":"{{FilePicker.files}}","dynamicPropertyPathList":[{"key":"isVisible"}],"itemBackgroundColor":"#FFFFFF","widgetId":"0n30419eso","topRow":21,"bottomRow":73,"parentRowSpace":10,"isVisible":"{{FilePicker.files.length > 0}}","type":"LIST_WIDGET","parentId":"xv97g6rzgq","gridGap":0,"isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[{"key":"template.Image2.onClick"}],"leftColumn":0,"dynamicBindingPathList":[{"key":"listData"},{"key":"template.update_files_name.defaultText"},{"key":"isVisible"},{"key":"template.Image2.image"},{"key":"template.update_files_name.defaultText"},{"key":"template.Image2.image"},{"key":"template.update_files_name.defaultText"},{"key":"template.Image2.image"},{"key":"template.update_files_name.defaultText"},{"key":"template.Image2.image"},{"key":"template.Text14.textAlign"},{"key":"template.Image2.objectFit"}],"gridType":"vertical","enhancements":true,"children":[{"widgetName":"Canvas7","rightColumn":256,"detachFromLayout":true,"widgetId":"oqhzaygncs","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"0n30419eso","openParentPropertyPane":true,"minHeight":520,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"backgroundColor":"white","widgetName":"Container4","rightColumn":64,"disallowCopy":true,"widgetId":"u3nvgafsdo","containerStyle":"card","topRow":0,"bottomRow":12,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"oqhzaygncs","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":[{"widgetName":"Canvas8","detachFromLayout":true,"widgetId":"romgsruzxz","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"u3nvgafsdo","minHeight":120,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text14","rightColumn":31,"textAlign":"LEFT","widgetId":"vu7fb0dbt8","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"dynamicTriggerPathList":true,"parentColumnSpace":true,"dynamicBindingPathList":true,"leftColumn":true,"fontSize":true,"text":true,"textStyle":true},"topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"romgsruzxz","isLoading":false,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":19,"fontSize":"PARAGRAPH","text":"File Name","textStyle":"HEADING"},{"isRequired":false,"widgetName":"update_files_name","rightColumn":63,"widgetId":"7zziet357m","logBlackList":{"isRequired":true,"widgetName":true,"rightColumn":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"label":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"resetOnSubmit":true,"leftColumn":true,"inputType":true,"isDisabled":true},"topRow":4,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"romgsruzxz","isLoading":false,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{currentItem.name}}","isDisabled":false},{"image":"{{currentItem.base64}}","widgetName":"Image2","rightColumn":18,"onClick":"{{showModal('Zoom_Modal2')}}","objectFit":"contain","widgetId":"ql8qs2xelx","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"defaultImage":true},"topRow":0,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"romgsruzxz","isLoading":false,"maxZoomLevel":1,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[{"key":"onClick"}],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"}]}],"disablePropertyPane":true}]}]},{"widgetName":"FilePicker","dynamicPropertyPathList":[{"key":"onFilesSelected"}],"topRow":12,"bottomRow":16,"parentRowSpace":10,"allowedFileTypes":["*","image/*","video/*","audio/*","text/*",".doc","image/jpeg",".png"],"type":"FILE_PICKER_WIDGET","parentColumnSpace":19.5,"dynamicTriggerPathList":[{"key":"onFilesSelected"}],"leftColumn":17,"dynamicBindingPathList":[],"isDisabled":false,"onFilesSelected":"","isRequired":true,"rightColumn":64,"isDefaultClickDisabled":true,"widgetId":"6j8fgyuvq7","defaultSelectedFiles":[],"isVisible":true,"label":"Select Files","maxFileSize":"5","version":1,"fileDataType":"Base64","parentId":"xv97g6rzgq","selectedFiles":[],"isLoading":false,"files":[],"maxNumFiles":"3"},{"isRequired":false,"widgetName":"folder_name","rightColumn":64,"widgetId":"fjh7zgcdmh","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"xv97g6rzgq","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":17,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"folder/sub-folder","isDisabled":false},{"widgetName":"Text9","rightColumn":16,"textAlign":"RIGHT","widgetId":"jc21bnjh92","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"xv97g6rzgq","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Upload Folder"},{"widgetName":"Text7","rightColumn":40,"textAlign":"LEFT","widgetId":"364shivyaz","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"xv97g6rzgq","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Upload New Files"},{"widgetName":"upload_button","rightColumn":64,"onClick":"{{\nFilePicker.files.forEach((file, index) => {\n\tCreateFile.run((response, params)=> { showAlert('File Uploaded','success'); \nif (params.isLastFile) {\n\tListFiles.run(() => {closeModal('Upload_Files_Modal'); resetWidget('FilePicker')})\t\n}\n}\n\t, () => showAlert('File Upload Failed','error')\t\n\t, {fileIndex: index, name: selected_files.items[index].update_files_name.text, isLastFile: index == (FilePicker.files.length - 1), });\n\treturn true;\n})\n}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"},{"key":"isDisabled"}],"widgetId":"1uava20nxi","buttonStyle":"PRIMARY_BUTTON","topRow":75,"bottomRow":79,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"xv97g6rzgq","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":44,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Upload","isDisabled":"{{ selected_files.items.length == 0 || selected_files.items.map((file) => file.update_files_name.text).includes(\"\") }}"},{"widgetName":"Text19","rightColumn":16,"textAlign":"LEFT","dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"9wh2ereoy9","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":"{{FilePicker.files.length > 0}}","fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"xv97g6rzgq","isLoading":false,"parentColumnSpace":8.0458984375,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[{"key":"isVisible"}],"fontSize":"HEADING3","text":"Selected Files"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"S3","userPermissions":[],"layouts":[{"new":false,"id":"60da6c7aee9aa1792c5bf5e4","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["60 * 24","search_input.text"],"name":"ListFiles","timeoutInMillisecond":10000,"id":"60da700cee9aa1792c5bf5e9"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":1270,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":1280,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Zoom_Modal2","rightColumn":0,"detachFromLayout":true,"widgetId":"kqxoe40pg6","topRow":89,"bottomRow":89,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas9Copy","rightColumn":0,"detachFromLayout":true,"widgetId":"80wzwajsst","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"kqxoe40pg6","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3Copy","rightColumn":64,"onClick":"{{closeModal('Zoom_Modal2')}}","color":"#040627","iconName":"cross","widgetId":"8kw9kfcd5y","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"80wzwajsst","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text15Copy","rightColumn":41,"textAlign":"LEFT","widgetId":"vk710q1v3s","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"80wzwajsst","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Zoom Image"},{"widgetName":"Button13Copy","rightColumn":63,"onClick":"{{closeModal('Zoom_Modal2')}}","isDefaultClickDisabled":true,"widgetId":"lfiwss1u3w","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"80wzwajsst","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":47,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"image":"{{selected_files.selectedItem.base64}}","widgetName":"Image3Copy","rightColumn":64,"objectFit":"contain","widgetId":"2bewgakjx9","topRow":6,"bottomRow":51,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"80wzwajsst","isLoading":false,"maxZoomLevel":8,"parentColumnSpace":8,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":1,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"}],"isDisabled":false}]},{"backgroundColor":"#FFFFFF","widgetName":"Container3","rightColumn":32,"widgetId":"th4d9oxy8z","containerStyle":"card","topRow":5,"bottomRow":88,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"leftColumn":0,"children":[{"widgetName":"Canvas4","rightColumn":634,"detachFromLayout":true,"widgetId":"6tz2s7ivi5","containerStyle":"none","topRow":0,"bottomRow":2290,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"th4d9oxy8z","minHeight":830,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":false,"onTextChanged":"{{ListFiles.run()}}","widgetName":"search_input","rightColumn":40,"widgetId":"0llmlojupa","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"6tz2s7ivi5","isLoading":false,"parentColumnSpace":19.5,"dynamicTriggerPathList":[{"key":"onTextChanged"}],"resetOnSubmit":true,"leftColumn":0,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"Search File Prefix","defaultText":"","isDisabled":false},{"template":{"Image4":{"image":"{{File_List.listData.map((currentItem) => {\n return (function(){\n return ( currentItem.signedUrl );\n })();\n })}}","widgetName":"Image4","rightColumn":48,"onClick":"{{showModal('Zoom_Modal')}}","objectFit":"contain","widgetId":"k9t673b0fu","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"enableDownload":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"enableRotation":true,"defaultImage":true},"topRow":1,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"maxZoomLevel":1,"enableDownload":false,"parentColumnSpace":19.0625,"imageShape":"RECTANGLE","leftColumn":32,"enableRotation":false,"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"},"Text16":{"text":"{{File_List.listData.map((currentItem) => {\n return (function(){\n return ( currentItem.fileName );\n })();\n })}}","shouldScroll":true},"download_button":{"onClick":"{{navigateTo(currentItem.signedUrl, {})}}"}},"childAutoComplete":{"currentItem":{"fileName":"","urlExpiryDate":"","signedUrl":""}},"backgroundColor":"","widgetName":"File_List","rightColumn":64,"itemBackgroundColor":"#FFFFFF","listData":"{{ListFiles.data}}","widgetId":"p9xuxpwwuc","topRow":5,"bottomRow":81,"parentRowSpace":10,"isVisible":true,"type":"LIST_WIDGET","parentId":"6tz2s7ivi5","gridGap":"10","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[{"key":"template.download_button.onClick"},{"key":"template.MenuButton1.menuItems.menuItem1.onClick"},{"key":"template.Image4.onClick"}],"leftColumn":0,"dynamicBindingPathList":[{"key":"listData"},{"key":"template.Image4.image"},{"key":"template.Text16.text"}],"gridType":"vertical","enhancements":true,"children":[{"widgetName":"Canvas11","rightColumn":634,"detachFromLayout":true,"widgetId":"jczf6u7ji9","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"p9xuxpwwuc","openParentPropertyPane":true,"minHeight":760,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"backgroundColor":"white","widgetName":"Container5","rightColumn":64,"disallowCopy":true,"widgetId":"aiiokpktqq","containerStyle":"card","topRow":0,"bottomRow":16,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"jczf6u7ji9","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":[{"widgetName":"Canvas12","detachFromLayout":true,"widgetId":"qxtrflb6ki","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"aiiokpktqq","minHeight":160,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"fnla1fasgx","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"fontSize":true,"text":true},"topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[],"leftColumn":22,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{currentItem.fileName}}"},{"widgetName":"download_button","rightColumn":64,"onClick":"{{navigateTo(currentItem.signedUrl, {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"wqenprx82s","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"Download","isDisabled":false},{"widgetName":"Button5","rightColumn":51,"onClick":"{{copyToClipboard(File_List.selectedItem.signedUrl)}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"47abcy9ml3","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":38,"dynamicBindingPathList":[],"text":"Copy URL","isDisabled":false},{"widgetName":"Button14","rightColumn":38,"onClick":"{{showModal('Edit_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"0xc28a5g77","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"PRIMARY_BUTTON","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":27,"dynamicBindingPathList":[],"text":"Update","isDisabled":false},{"widgetName":"delete_button","rightColumn":64,"onClick":"{{showModal('delete_modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"ge7ws9hdfv","logBlackList":{"widgetName":true,"rightColumn":true,"isDefaultClickDisabled":true,"widgetId":true,"buttonStyle":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"leftColumn":true,"text":true,"isDisabled":true},"buttonStyle":"DANGER_BUTTON","topRow":4,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":54,"dynamicBindingPathList":[],"text":"Delete","isDisabled":false},{"image":"{{currentItem.signedUrl}}","widgetName":"Image4","onClick":"{{showModal('Zoom_Modal')}}","rightColumn":21,"objectFit":"contain","widgetId":"k9t673b0fu","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"enableDownload":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"enableRotation":true,"defaultImage":true},"topRow":0,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"qxtrflb6ki","isLoading":false,"maxZoomLevel":1,"enableDownload":false,"parentColumnSpace":19.0625,"dynamicTriggerPathList":[{"key":"onClick"}],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"enableRotation":false,"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"}]}],"disablePropertyPane":true}]}]}]}]},{"widgetName":"Text6","rightColumn":64,"backgroundColor":"","textAlign":"LEFT","widgetId":"t54ituq472","topRow":0,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#2E3D49","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Bucket"},{"widgetName":"Upload_Files_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"1fxorj7v97","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":0,"detachFromLayout":true,"widgetId":"d8io5ijwj4","topRow":0,"bottomRow":620,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"1fxorj7v97","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[],"isDisabled":false}]},{"widgetName":"delete_modal","rightColumn":0,"detachFromLayout":true,"widgetId":"9g0cw9adf8","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas6","rightColumn":0,"detachFromLayout":true,"widgetId":"ozvpoudxz2","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"9g0cw9adf8","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon2","rightColumn":64,"onClick":"{{closeModal('delete_modal')}}","color":"#040627","iconName":"cross","widgetId":"xkyh49z71e","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text12","rightColumn":41,"textAlign":"LEFT","widgetId":"s1y44xm547","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete File"},{"widgetName":"Button10","rightColumn":48,"onClick":"{{closeModal('delete_modal')}}","isDefaultClickDisabled":true,"widgetId":"pi0t67rnwh","buttonStyle":"SECONDARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Button11","rightColumn":64,"onClick":"{{DeleteFile.run(() => ListFiles.run(() => closeModal('delete_modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"hp22uj3dra","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"ozvpoudxz2","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text13","rightColumn":64,"textAlign":"LEFT","widgetId":"oypa9ad1tg","topRow":5,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"ozvpoudxz2","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete the file?\n\n{{File_List.selectedItem.fileName}}"}],"isDisabled":false}]},{"widgetName":"Zoom_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"p4buulj86a","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas9","rightColumn":0,"detachFromLayout":true,"widgetId":"p3cxdtb4wp","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"p4buulj86a","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3","rightColumn":64,"onClick":"{{closeModal('Zoom_Modal')}}","color":"#040627","iconName":"cross","widgetId":"b49lgvj9yy","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text15","rightColumn":41,"textAlign":"LEFT","widgetId":"cy38v3de8z","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Zoom Image"},{"widgetName":"Button13","rightColumn":63,"onClick":"{{closeModal('Zoom_Modal')}}","isDefaultClickDisabled":true,"widgetId":"ftst3w9m8m","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":47,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"image":"{{File_List.selectedItem.signedUrl}}","widgetName":"Image3","rightColumn":64,"objectFit":"contain","widgetId":"a5gy0pdfzn","topRow":6,"bottomRow":51,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"p3cxdtb4wp","isLoading":false,"maxZoomLevel":8,"parentColumnSpace":8,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":1,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://cdn3.iconfinder.com/data/icons/brands-applications/512/File-512.png"}],"isDisabled":false}]},{"widgetName":"Edit_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"usealgbtyj","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas10","rightColumn":0,"detachFromLayout":true,"widgetId":"6i7m9kpuky","topRow":0,"bottomRow":240,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"usealgbtyj","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon4","rightColumn":64,"onClick":"{{closeModal('Edit_Modal')}}","color":"#040627","iconName":"cross","widgetId":"pstfdcc1e4","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text17","rightColumn":41,"textAlign":"LEFT","widgetId":"z64z3l112n","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Update File"},{"widgetName":"Button15","rightColumn":44,"onClick":"{{closeModal('Edit_Modal')}}","isDefaultClickDisabled":true,"widgetId":"trc4e6ylcz","buttonStyle":"SECONDARY_BUTTON","topRow":18,"bottomRow":22,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":32,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"update_button","rightColumn":64,"onClick":"{{UpdateFile.run(() => ListFiles.run(() => {resetWidget('update_file_picker');closeModal('Edit_Modal');}), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"},{"key":"isDisabled"}],"widgetId":"8lbthc9dml","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":44,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Update","isDisabled":"{{update_file_picker.files.length == 0}}"},{"widgetName":"Text18","rightColumn":17,"textAlign":"RIGHT","widgetId":"qb26g34etr","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"6i7m9kpuky","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"File Name"},{"isRequired":false,"widgetName":"update_file_name","rightColumn":64,"widgetId":"je0ea8ma5d","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"6i7m9kpuky","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":17,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{File_List.selectedItem.fileName}}","isDisabled":true},{"widgetName":"update_file_picker","topRow":11,"bottomRow":15,"parentRowSpace":10,"allowedFileTypes":["*","image/*","video/*","audio/*","text/*",".doc","image/jpeg",".png"],"type":"FILE_PICKER_WIDGET","parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":17,"dynamicBindingPathList":[],"isDisabled":false,"isRequired":false,"rightColumn":64,"isDefaultClickDisabled":true,"widgetId":"mioot5pcs5","defaultSelectedFiles":[],"isVisible":true,"label":"Select File","maxFileSize":"10","version":1,"fileDataType":"Base64","parentId":"6i7m9kpuky","selectedFiles":[],"isLoading":false,"files":[],"maxNumFiles":1}],"isDisabled":false}]},{"backgroundColor":"#FFFFFF","widgetName":"Container6","rightColumn":64,"widgetId":"yg1iyxq9kd","containerStyle":"card","topRow":6,"bottomRow":88,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"leftColumn":37,"children":[{"widgetName":"Canvas13","rightColumn":634,"detachFromLayout":true,"widgetId":"xv97g6rzgq","containerStyle":"none","topRow":0,"bottomRow":600,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"yg1iyxq9kd","minHeight":820,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Button8","rightColumn":43,"onClick":"{{closeModal('Upload_Files_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"bx8wok3aut","buttonStyle":"SECONDARY_BUTTON","topRow":75,"bottomRow":79,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"xv97g6rzgq","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":31,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"template":{"Canvas7":{"widgetName":"Canvas7","rightColumn":256,"detachFromLayout":true,"widgetId":"oqhzaygncs","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"0n30419eso","openParentPropertyPane":true,"minHeight":340,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":["u3nvgafsdo"]},"update_files_name":{"isRequired":false,"widgetName":"update_files_name","rightColumn":63,"widgetId":"7zziet357m","logBlackList":{"isRequired":true,"widgetName":true,"rightColumn":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"label":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"resetOnSubmit":true,"leftColumn":true,"inputType":true,"isDisabled":true},"topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"romgsruzxz","isLoading":false,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":23,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{selected_files.listData.map((currentItem) => currentItem.name)}}","isDisabled":false},"Image2":{"image":"{{selected_files.listData.map((currentItem) => currentItem.base64)}}","widgetName":"Image2","rightColumn":10,"onClick":"{{showModal('Zoom_Modal2')}}","objectFit":"{{selected_files.listData.map((currentItem, currentIndex) => {\n return (function(){\n return 'contain';\n })();\n })}}","widgetId":"ql8qs2xelx","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"defaultImage":true},"topRow":0,"bottomRow":6,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"romgsruzxz","isLoading":false,"maxZoomLevel":1,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"},"Container4":{"backgroundColor":"white","widgetName":"Container4","rightColumn":64,"disallowCopy":true,"widgetId":"u3nvgafsdo","containerStyle":"card","topRow":0,"bottomRow":8,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"oqhzaygncs","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":["romgsruzxz"],"disablePropertyPane":true},"Canvas8":{"widgetName":"Canvas8","detachFromLayout":true,"widgetId":"romgsruzxz","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"u3nvgafsdo","minHeight":80,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":["vu7fb0dbt8","7zziet357m","ql8qs2xelx"]},"Text14":{"widgetName":"Text14","rightColumn":23,"textAlign":"{{selected_files.listData.map((currentItem, currentIndex) => {\n return (function(){\n return 'LEFT';\n })();\n })}}","widgetId":"vu7fb0dbt8","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"dynamicTriggerPathList":true,"parentColumnSpace":true,"dynamicBindingPathList":true,"leftColumn":true,"fontSize":true,"text":true,"textStyle":true},"topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"romgsruzxz","isLoading":false,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":11,"fontSize":"PARAGRAPH","text":"File Name","textStyle":"HEADING"}},"childAutoComplete":{"currentItem":{"data":"","base64":"","name":"","raw":"","id":"","text":"","type":""}},"widgetName":"selected_files","backgroundColor":"","rightColumn":64,"listData":"{{FilePicker.files}}","dynamicPropertyPathList":[{"key":"isVisible"}],"itemBackgroundColor":"#FFFFFF","widgetId":"0n30419eso","topRow":21,"bottomRow":73,"parentRowSpace":10,"isVisible":"{{FilePicker.files.length > 0}}","type":"LIST_WIDGET","parentId":"xv97g6rzgq","gridGap":0,"isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[{"key":"template.Image2.onClick"}],"leftColumn":0,"dynamicBindingPathList":[{"key":"listData"},{"key":"template.update_files_name.defaultText"},{"key":"isVisible"},{"key":"template.Image2.image"},{"key":"template.update_files_name.defaultText"},{"key":"template.Image2.image"},{"key":"template.update_files_name.defaultText"},{"key":"template.Image2.image"},{"key":"template.update_files_name.defaultText"},{"key":"template.Image2.image"},{"key":"template.Text14.textAlign"},{"key":"template.Image2.objectFit"}],"gridType":"vertical","enhancements":true,"children":[{"widgetName":"Canvas7","rightColumn":256,"detachFromLayout":true,"widgetId":"oqhzaygncs","containerStyle":"none","topRow":0,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"dropDisabled":true,"parentId":"0n30419eso","openParentPropertyPane":true,"minHeight":520,"isLoading":false,"noPad":true,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"backgroundColor":"white","widgetName":"Container4","rightColumn":64,"disallowCopy":true,"widgetId":"u3nvgafsdo","containerStyle":"card","topRow":0,"bottomRow":12,"dragDisabled":true,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"oqhzaygncs","openParentPropertyPane":true,"isDeletable":false,"isLoading":false,"leftColumn":0,"children":[{"widgetName":"Canvas8","detachFromLayout":true,"widgetId":"romgsruzxz","containerStyle":"none","topRow":0,"bottomRow":180,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"u3nvgafsdo","minHeight":120,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text14","rightColumn":31,"textAlign":"LEFT","widgetId":"vu7fb0dbt8","logBlackList":{"widgetName":true,"rightColumn":true,"textAlign":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"fontStyle":true,"type":true,"textColor":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"dynamicTriggerPathList":true,"parentColumnSpace":true,"dynamicBindingPathList":true,"leftColumn":true,"fontSize":true,"text":true,"textStyle":true},"topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"romgsruzxz","isLoading":false,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":19,"fontSize":"PARAGRAPH","text":"File Name","textStyle":"HEADING"},{"isRequired":false,"widgetName":"update_files_name","rightColumn":63,"widgetId":"7zziet357m","logBlackList":{"isRequired":true,"widgetName":true,"rightColumn":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"label":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"parentColumnSpace":true,"resetOnSubmit":true,"leftColumn":true,"inputType":true,"isDisabled":true},"topRow":4,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"romgsruzxz","isLoading":false,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{currentItem.name}}","isDisabled":false},{"image":"{{currentItem.base64}}","widgetName":"Image2","rightColumn":18,"onClick":"{{showModal('Zoom_Modal2')}}","objectFit":"contain","widgetId":"ql8qs2xelx","logBlackList":{"image":true,"widgetName":true,"rightColumn":true,"objectFit":true,"widgetId":true,"topRow":true,"bottomRow":true,"parentRowSpace":true,"isVisible":true,"type":true,"version":true,"parentId":true,"minHeight":true,"isLoading":true,"maxZoomLevel":true,"parentColumnSpace":true,"imageShape":true,"leftColumn":true,"defaultImage":true},"topRow":0,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"type":"IMAGE_WIDGET","version":1,"parentId":"romgsruzxz","isLoading":false,"maxZoomLevel":1,"parentColumnSpace":7.3125,"dynamicTriggerPathList":[{"key":"onClick"}],"imageShape":"RECTANGLE","leftColumn":0,"dynamicBindingPathList":[{"key":"image"}],"defaultImage":"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png"}]}],"disablePropertyPane":true}]}]},{"widgetName":"FilePicker","dynamicPropertyPathList":[{"key":"onFilesSelected"}],"topRow":12,"bottomRow":16,"parentRowSpace":10,"allowedFileTypes":["*","image/*","video/*","audio/*","text/*",".doc","image/jpeg",".png"],"type":"FILE_PICKER_WIDGET","parentColumnSpace":19.5,"dynamicTriggerPathList":[{"key":"onFilesSelected"}],"leftColumn":17,"dynamicBindingPathList":[],"isDisabled":false,"onFilesSelected":"","isRequired":true,"rightColumn":64,"isDefaultClickDisabled":true,"widgetId":"6j8fgyuvq7","defaultSelectedFiles":[],"isVisible":true,"label":"Select Files","maxFileSize":"5","version":1,"fileDataType":"Base64","parentId":"xv97g6rzgq","selectedFiles":[],"isLoading":false,"files":[],"maxNumFiles":"3"},{"isRequired":false,"widgetName":"folder_name","rightColumn":64,"widgetId":"fjh7zgcdmh","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"xv97g6rzgq","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":17,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"folder/sub-folder","isDisabled":false},{"widgetName":"Text9","rightColumn":16,"textAlign":"RIGHT","widgetId":"jc21bnjh92","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"xv97g6rzgq","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Upload Folder"},{"widgetName":"Text7","rightColumn":40,"textAlign":"LEFT","widgetId":"364shivyaz","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"xv97g6rzgq","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Upload New Files"},{"widgetName":"upload_button","rightColumn":64,"onClick":"{{\nFilePicker.files.forEach((file, index) => {\n\tCreateFile.run((response, params)=> { showAlert('File Uploaded','success'); \nif (params.isLastFile) {\n\tListFiles.run(() => {closeModal('Upload_Files_Modal'); resetWidget('FilePicker')})\t\n}\n}\n\t, () => showAlert('File Upload Failed','error')\t\n\t, {fileIndex: index, name: selected_files.items[index].update_files_name.text, isLastFile: index == (FilePicker.files.length - 1), });\n\treturn true;\n})\n}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"},{"key":"isDisabled"}],"widgetId":"1uava20nxi","buttonStyle":"PRIMARY_BUTTON","topRow":75,"bottomRow":79,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"xv97g6rzgq","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":44,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Upload","isDisabled":"{{ selected_files.items.length == 0 || selected_files.items.map((file) => file.update_files_name.text).includes(\"\") }}"},{"widgetName":"Text19","rightColumn":16,"textAlign":"LEFT","dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"9wh2ereoy9","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":"{{FilePicker.files.length > 0}}","fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"xv97g6rzgq","isLoading":false,"parentColumnSpace":8.0458984375,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[{"key":"isVisible"}],"fontSize":"HEADING3","text":"Selected Files"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Admin","userPermissions":[],"layouts":[{"new":false,"id":"60dab9efee9aa1792c5bf645","userPermissions":[],"layoutOnLoadActions":[],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":910,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":900,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Form1","backgroundColor":"#2E3D49","rightColumn":45,"widgetId":"hdpwx2szs0","topRow":5,"bottomRow":86,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas1","rightColumn":554.75,"detachFromLayout":true,"widgetId":"kwx6oz4fub","containerStyle":"none","topRow":0,"bottomRow":830,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"hdpwx2szs0","minHeight":810,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text1","rightColumn":36,"textAlign":"LEFT","widgetId":"7fqtlu52np","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Update App Template"},{"widgetName":"Text2","rightColumn":61,"textAlign":"LEFT","widgetId":"w2l08fshj2","topRow":10,"bottomRow":62,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"shouldScroll":true,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{\"<pre>\" + JSON.stringify(get_exported_app.data, null, 2) + \"</pre>\" || \"Fetch The App\"}}"},{"widgetName":"Button1","rightColumn":21,"onClick":"{{\n get_exported_app.run(() => {\n \tconst arr = JSON.parse(datasource_arr.text);\n\t\tarr.map((row) => { get_datasource_structure.run((res, params) => {\n storeValue(params.name, res); \n },undefined, row)\n })\n })\n}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"2vtg0qdlqv","buttonStyle":"PRIMARY_BUTTON","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":3,"dynamicBindingPathList":[],"text":"Fetch App","isDisabled":false},{"widgetName":"Button2","rightColumn":63,"onClick":"{{update_template.run(() => showAlert('Template Updated','success'), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"isDisabled"}],"widgetId":"jg23u09rwk","buttonStyle":"PRIMARY_BUTTON","topRow":72,"bottomRow":76,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":4,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Deploy","isDisabled":"{{get_exported_app.data.exportedApplication === undefined}}"},{"isRequired":false,"widgetName":"branch_input","rightColumn":49,"widgetId":"d6shlon0z2","topRow":63,"bottomRow":67,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":12,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"Branch name","defaultText":"update-crud-template","isDisabled":false},{"widgetName":"Text3","rightColumn":12,"textAlign":"LEFT","widgetId":"y57v1yp7vb","topRow":63,"bottomRow":67,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"HEADING3","text":"Branch"},{"widgetName":"Text4","rightColumn":63,"backgroundColor":"#DD4B34","textAlign":"LEFT","widgetId":"fanskapltd","topRow":67,"bottomRow":71,"parentRowSpace":10,"isVisible":true,"fontStyle":"","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Note : Please use update-crud-template branch to avoid TCs failing in release"}]}]},{"widgetName":"datasource_arr","rightColumn":16,"textAlign":"LEFT","widgetId":"znji9afu2q","topRow":1,"bottomRow":35,"parentRowSpace":10,"isVisible":false,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"[\n{ \"name\":\"mongo-plugin\",\n\"id\": \"60dafedaee9aa1792c5bf773\"\n},\n{ \"name\":\"postgres-plugin\",\n\"id\": \"5fcdd652b0e807468e3b493b\"\n}\n]"}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Admin","userPermissions":[],"layouts":[{"new":false,"id":"60dab9efee9aa1792c5bf645","userPermissions":[],"layoutOnLoadActions":[],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":910,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":900,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Form1","backgroundColor":"#2E3D49","rightColumn":45,"widgetId":"hdpwx2szs0","topRow":5,"bottomRow":86,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas1","rightColumn":554.75,"detachFromLayout":true,"widgetId":"kwx6oz4fub","containerStyle":"none","topRow":0,"bottomRow":830,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"hdpwx2szs0","minHeight":810,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text1","rightColumn":36,"textAlign":"LEFT","widgetId":"7fqtlu52np","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Update App Template"},{"widgetName":"Text2","rightColumn":61,"textAlign":"LEFT","widgetId":"w2l08fshj2","topRow":10,"bottomRow":62,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"shouldScroll":true,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{\"<pre>\" + JSON.stringify(get_exported_app.data, null, 2) + \"</pre>\" || \"Fetch The App\"}}"},{"widgetName":"Button1","rightColumn":21,"onClick":"{{\n get_exported_app.run(() => {\n \tconst arr = JSON.parse(datasource_arr.text);\n\t\tarr.map((row) => { get_datasource_structure.run((res, params) => {\n storeValue(params.name, res); \n },undefined, row)\n })\n })\n}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"2vtg0qdlqv","buttonStyle":"PRIMARY_BUTTON","topRow":6,"bottomRow":10,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":3,"dynamicBindingPathList":[],"text":"Fetch App","isDisabled":false},{"widgetName":"Button2","rightColumn":63,"onClick":"{{update_template.run(() => showAlert('Template Updated','success'), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"isDisabled"}],"widgetId":"jg23u09rwk","buttonStyle":"PRIMARY_BUTTON","topRow":72,"bottomRow":76,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":4,"dynamicBindingPathList":[{"key":"isDisabled"}],"text":"Deploy","isDisabled":"{{get_exported_app.data.exportedApplication === undefined}}"},{"isRequired":false,"widgetName":"branch_input","rightColumn":49,"widgetId":"d6shlon0z2","topRow":63,"bottomRow":67,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":12,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"Branch name","defaultText":"update-crud-template","isDisabled":false},{"widgetName":"Text3","rightColumn":12,"textAlign":"LEFT","widgetId":"y57v1yp7vb","topRow":63,"bottomRow":67,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"HEADING3","text":"Branch"},{"widgetName":"Text4","rightColumn":63,"backgroundColor":"#DD4B34","textAlign":"LEFT","widgetId":"fanskapltd","topRow":67,"bottomRow":71,"parentRowSpace":10,"isVisible":true,"fontStyle":"","type":"TEXT_WIDGET","textColor":"#FFFFFF","version":1,"parentId":"kwx6oz4fub","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Note : Please use update-crud-template branch to avoid TCs failing in release"}]}]},{"widgetName":"datasource_arr","rightColumn":16,"textAlign":"LEFT","widgetId":"znji9afu2q","topRow":1,"bottomRow":35,"parentRowSpace":10,"isVisible":false,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"[\n{ \"name\":\"mongo-plugin\",\n\"id\": \"60dafedaee9aa1792c5bf773\"\n},\n{ \"name\":\"postgres-plugin\",\n\"id\": \"5fcdd652b0e807468e3b493b\"\n}\n]"}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Page Generator","userPermissions":[],"layouts":[{"new":false,"id":"60dadae5ee9aa1792c5bf6b8","userPermissions":[],"layoutOnLoadActions":[],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1118,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":880,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":860,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Tabs1","rightColumn":44,"widgetId":"jalvzswyyk","defaultTab":"SQL","topRow":13,"bottomRow":54,"shouldShowTabs":true,"parentRowSpace":10,"tabsObj":{"tab1":{"widgetId":"nyka98xqpv","index":0,"label":"SQL","id":"tab1","isVisible":true},"tab2":{"widgetId":"neexe4fljs","index":1,"label":"GSheet","id":"tab2","isVisible":true},"tab7qxuerb9p7":{"widgetId":"4yqoh4fjmv","id":"tab7qxuerb9p7","label":"Mongo","isVisible":true}},"isVisible":true,"type":"TABS_WIDGET","version":3,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":15,"dynamicBindingPathList":[],"children":[{"tabId":"tab1","tabName":"SQL","rightColumn":634,"widgetName":"Canvas2","detachFromLayout":true,"widgetId":"nyka98xqpv","topRow":0,"bottomRow":430,"parentRowSpace":1,"type":"CANVAS_WIDGET","parentId":"jalvzswyyk","isLoading":false,"renderMode":"CANVAS","minHeight":410,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":false,"widgetName":"tableName_input","rightColumn":63,"widgetId":"f8k5jt9mjm","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"isRequired":false,"widgetName":"datasource_input","rightColumn":63,"widgetId":"4j1xd4hih9","topRow":3,"bottomRow":7,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text2","rightColumn":14,"textAlign":"RIGHT","widgetId":"957c72jpan","topRow":3,"bottomRow":7,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Datasource URL"},{"widgetName":"Text4","rightColumn":14,"textAlign":"RIGHT","widgetId":"nz74xi3ae3","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Table Name"},{"widgetName":"Text6","rightColumn":14,"textAlign":"RIGHT","widgetId":"s1i89k31f5","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Columns to Select"},{"isRequired":false,"widgetName":"select_cols_input","rightColumn":63,"widgetId":"pwt5ybili3","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text7","rightColumn":14,"textAlign":"RIGHT","widgetId":"rbacxz6brz","topRow":25,"bottomRow":29,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Column to Search"},{"isRequired":false,"widgetName":"search_col_input","rightColumn":63,"widgetId":"bnro1si5sz","topRow":25,"bottomRow":29,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"resetFormOnClick":false,"widgetName":"FormButton1","rightColumn":63,"onClick":"{{generate_sql_app.run(() => showAlert('Page Created!','success'), () => {})}}","isDefaultClickDisabled":true,"widgetId":"n6220hgzzs","buttonStyle":"PRIMARY_BUTTON","topRow":31,"bottomRow":35,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Generate"}]},{"tabId":"tab2","tabName":"GSheet","rightColumn":634,"widgetName":"Canvas3","detachFromLayout":true,"widgetId":"neexe4fljs","topRow":0,"bottomRow":400,"parentRowSpace":1,"type":"CANVAS_WIDGET","parentId":"jalvzswyyk","isLoading":false,"renderMode":"CANVAS","minHeight":410,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text8","rightColumn":16,"textAlign":"RIGHT","widgetId":"3ghywz6tk6","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"DataSource URL"},{"isRequired":false,"widgetName":"gsheet_ds_input","rightColumn":62,"widgetId":"a8kpjqdp59","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text9","rightColumn":16,"textAlign":"RIGHT","widgetId":"r6o12im1qd","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"SpreadSheet URL"},{"isRequired":false,"widgetName":"spreadsheet_input","rightColumn":62,"widgetId":"80kk95t99i","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text10","rightColumn":16,"textAlign":"RIGHT","widgetId":"k0ul3uaoph","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Sheet Name"},{"isRequired":false,"widgetName":"sheet_input","rightColumn":62,"widgetId":"a35cwuivq7","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text11","rightColumn":16,"textAlign":"RIGHT","widgetId":"l1r1tfbx6y","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Table Header Index"},{"isRequired":false,"widgetName":"header_input","rightColumn":62,"widgetId":"jrhp3pwzll","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Button1","rightColumn":62,"onClick":"{{generate_gsheet_app.run()}}","isDefaultClickDisabled":true,"widgetId":"zzsh2d5rns","buttonStyle":"PRIMARY_BUTTON","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Generate","isDisabled":false}]},{"tabId":"tab7qxuerb9p7","widgetName":"Canvas4","tabName":"Mongo","rightColumn":574.5625,"detachFromLayout":true,"widgetId":"4yqoh4fjmv","containerStyle":"none","topRow":1,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"jalvzswyyk","minHeight":410,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text12","rightColumn":17,"textAlign":"RIGHT","widgetId":"4l1uqhf2au","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Datasource URL"},{"isRequired":false,"widgetName":"mongo_ds_url","rightColumn":61,"widgetId":"r8yvmt103v","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text13","rightColumn":17,"textAlign":"RIGHT","widgetId":"0y3rz6ufib","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Collection Name"},{"isRequired":false,"widgetName":"collection_input","rightColumn":61,"widgetId":"sbe7jfnafu","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text14","rightColumn":17,"textAlign":"RIGHT","widgetId":"s1fhjft9to","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Keys to Fetch"},{"isRequired":false,"widgetName":"fetch_keys_input","rightColumn":61,"widgetId":"74tjl0q7x3","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text15","rightColumn":17,"textAlign":"RIGHT","widgetId":"rwi67ouhe1","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Key to Search"},{"isRequired":false,"widgetName":"search_keys_input","rightColumn":61,"widgetId":"ie4mp16js1","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Button2","rightColumn":62,"onClick":"{{generate_mongo_app.run()}}","isDefaultClickDisabled":true,"widgetId":"6ui5kmqebf","buttonStyle":"PRIMARY_BUTTON","topRow":29,"bottomRow":33,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Generate","isDisabled":false}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Page Generator","userPermissions":[],"layouts":[{"new":false,"id":"60dadae5ee9aa1792c5bf6b8","userPermissions":[],"layoutOnLoadActions":[],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1118,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":880,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":860,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Tabs1","rightColumn":44,"widgetId":"jalvzswyyk","defaultTab":"SQL","topRow":13,"bottomRow":54,"shouldShowTabs":true,"parentRowSpace":10,"tabsObj":{"tab1":{"widgetId":"nyka98xqpv","index":0,"label":"SQL","id":"tab1","isVisible":true},"tab2":{"widgetId":"neexe4fljs","index":1,"label":"GSheet","id":"tab2","isVisible":true},"tab7qxuerb9p7":{"widgetId":"4yqoh4fjmv","id":"tab7qxuerb9p7","label":"Mongo","isVisible":true}},"isVisible":true,"type":"TABS_WIDGET","version":3,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":19.8125,"dynamicTriggerPathList":[],"leftColumn":15,"dynamicBindingPathList":[],"children":[{"tabId":"tab1","tabName":"SQL","rightColumn":634,"widgetName":"Canvas2","detachFromLayout":true,"widgetId":"nyka98xqpv","topRow":0,"bottomRow":430,"parentRowSpace":1,"type":"CANVAS_WIDGET","parentId":"jalvzswyyk","isLoading":false,"renderMode":"CANVAS","minHeight":410,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":false,"widgetName":"tableName_input","rightColumn":63,"widgetId":"f8k5jt9mjm","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"isRequired":false,"widgetName":"datasource_input","rightColumn":63,"widgetId":"4j1xd4hih9","topRow":3,"bottomRow":7,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text2","rightColumn":14,"textAlign":"RIGHT","widgetId":"957c72jpan","topRow":3,"bottomRow":7,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Datasource URL"},{"widgetName":"Text4","rightColumn":14,"textAlign":"RIGHT","widgetId":"nz74xi3ae3","topRow":10,"bottomRow":14,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Table Name"},{"widgetName":"Text6","rightColumn":14,"textAlign":"RIGHT","widgetId":"s1i89k31f5","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Columns to Select"},{"isRequired":false,"widgetName":"select_cols_input","rightColumn":63,"widgetId":"pwt5ybili3","topRow":17,"bottomRow":21,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text7","rightColumn":14,"textAlign":"RIGHT","widgetId":"rbacxz6brz","topRow":25,"bottomRow":29,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Column to Search"},{"isRequired":false,"widgetName":"search_col_input","rightColumn":63,"widgetId":"bnro1si5sz","topRow":25,"bottomRow":29,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"parentColumnSpace":8.35546875,"resetOnSubmit":true,"leftColumn":14,"inputType":"TEXT","isDisabled":false},{"resetFormOnClick":false,"widgetName":"FormButton1","rightColumn":63,"onClick":"{{generate_sql_app.run(() => showAlert('Page Created!','success'), () => {})}}","isDefaultClickDisabled":true,"widgetId":"n6220hgzzs","buttonStyle":"PRIMARY_BUTTON","topRow":31,"bottomRow":35,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"nyka98xqpv","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Generate"}]},{"tabId":"tab2","tabName":"GSheet","rightColumn":634,"widgetName":"Canvas3","detachFromLayout":true,"widgetId":"neexe4fljs","topRow":0,"bottomRow":400,"parentRowSpace":1,"type":"CANVAS_WIDGET","parentId":"jalvzswyyk","isLoading":false,"renderMode":"CANVAS","minHeight":410,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text8","rightColumn":16,"textAlign":"RIGHT","widgetId":"3ghywz6tk6","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"DataSource URL"},{"isRequired":false,"widgetName":"gsheet_ds_input","rightColumn":62,"widgetId":"a8kpjqdp59","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text9","rightColumn":16,"textAlign":"RIGHT","widgetId":"r6o12im1qd","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"SpreadSheet URL"},{"isRequired":false,"widgetName":"spreadsheet_input","rightColumn":62,"widgetId":"80kk95t99i","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text10","rightColumn":16,"textAlign":"RIGHT","widgetId":"k0ul3uaoph","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Sheet Name"},{"isRequired":false,"widgetName":"sheet_input","rightColumn":62,"widgetId":"a35cwuivq7","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text11","rightColumn":16,"textAlign":"RIGHT","widgetId":"l1r1tfbx6y","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Table Header Index"},{"isRequired":false,"widgetName":"header_input","rightColumn":62,"widgetId":"jrhp3pwzll","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":16,"inputType":"TEXT","isDisabled":false},{"widgetName":"Button1","rightColumn":62,"onClick":"{{generate_gsheet_app.run()}}","isDefaultClickDisabled":true,"widgetId":"zzsh2d5rns","buttonStyle":"PRIMARY_BUTTON","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"neexe4fljs","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Generate","isDisabled":false}]},{"tabId":"tab7qxuerb9p7","widgetName":"Canvas4","tabName":"Mongo","rightColumn":574.5625,"detachFromLayout":true,"widgetId":"4yqoh4fjmv","containerStyle":"none","topRow":1,"bottomRow":400,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"jalvzswyyk","minHeight":410,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Text12","rightColumn":17,"textAlign":"RIGHT","widgetId":"4l1uqhf2au","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Datasource URL"},{"isRequired":false,"widgetName":"mongo_ds_url","rightColumn":61,"widgetId":"r8yvmt103v","topRow":1,"bottomRow":5,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text13","rightColumn":17,"textAlign":"RIGHT","widgetId":"0y3rz6ufib","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Collection Name"},{"isRequired":false,"widgetName":"collection_input","rightColumn":61,"widgetId":"sbe7jfnafu","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text14","rightColumn":17,"textAlign":"RIGHT","widgetId":"s1fhjft9to","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Keys to Fetch"},{"isRequired":false,"widgetName":"fetch_keys_input","rightColumn":61,"widgetId":"74tjl0q7x3","topRow":15,"bottomRow":19,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text15","rightColumn":17,"textAlign":"RIGHT","widgetId":"rwi67ouhe1","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Key to Search"},{"isRequired":false,"widgetName":"search_keys_input","rightColumn":61,"widgetId":"ie4mp16js1","topRow":22,"bottomRow":26,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"resetOnSubmit":true,"leftColumn":17,"inputType":"TEXT","isDisabled":false},{"widgetName":"Button2","rightColumn":62,"onClick":"{{generate_mongo_app.run()}}","isDefaultClickDisabled":true,"widgetId":"6ui5kmqebf","buttonStyle":"PRIMARY_BUTTON","topRow":29,"bottomRow":33,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"4yqoh4fjmv","isLoading":false,"parentColumnSpace":8.6650390625,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Generate","isDisabled":false}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"MongoDB","userPermissions":[],"layouts":[{"new":false,"id":"60dafddaee9aa1792c5bf76d","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["key_select.selectedOptionValue","data_table.pageSize","data_table.searchText||\"\"","order_select.selectedOptionValue","(data_table.pageNo - 1) * data_table.pageSize"],"name":"FindQuery","timeoutInMillisecond":10000,"id":"60db015aee9aa1792c5bf778"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":860,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["customColumn1","_id","col4","col2","col3","col1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{FindQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns._id.computedValue"}],"leftColumn":0,"primaryColumns":{"appsmith_mongo_escape_id":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow._id))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"_id","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"_id","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{FindQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{FindQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"key_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{FindQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t},\n\t{\n\t\t\"label\": \"col4\",\n\t\t\"value\": \"col4\"\n\t}\n]","onOptionChange":"{{FindQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{FindQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"1","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"1\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"-1\"\n }\n]","onOptionChange":"{{FindQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{FindQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => FindQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => FindQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!data_table.selectedRow._id}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => FindQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_1","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row ID: {{data_table.selectedRow._id}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text20","rightColumn":19,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"MongoDB","userPermissions":[],"layouts":[{"new":false,"id":"60dafddaee9aa1792c5bf76d","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["key_select.selectedOptionValue","data_table.pageSize","data_table.searchText||\"\"","order_select.selectedOptionValue","(data_table.pageNo - 1) * data_table.pageSize"],"name":"FindQuery","timeoutInMillisecond":10000,"id":"60db015aee9aa1792c5bf778"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1209.1999999999998,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":860,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["customColumn1","_id","col4","col2","col3","col1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{FindQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns._id.computedValue"}],"leftColumn":0,"primaryColumns":{"appsmith_mongo_escape_id":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow._id))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"_id","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"_id","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{FindQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{FindQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"key_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{FindQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t},\n\t{\n\t\t\"label\": \"col4\",\n\t\t\"value\": \"col4\"\n\t}\n]","onOptionChange":"{{FindQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{FindQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"1","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"1\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"-1\"\n }\n]","onOptionChange":"{{FindQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{FindQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => FindQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => FindQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!data_table.selectedRow._id}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => FindQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_1","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row ID: {{data_table.selectedRow._id}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text20","rightColumn":19,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Firestore","userPermissions":[],"layouts":[{"new":false,"id":"60ec1d84a5109b1d752d75dc","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["SelectQuery.data[SelectQuery.data.length - 1]","order_select.selectedOptionValue + key_select.selectedOptionValue","SelectQuery.data[0]"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60ee9cafa5109b1d752d7b7b"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":890,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["_ref","col4","col5","col2","col3","col1","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns._ref.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col1.computedValue"}],"leftColumn":0,"primaryColumns":{"_ref":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow._ref))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"_ref","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"_ref","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":5,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":6,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":7,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":8,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"key_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t},\n\t{\n\t\t\"label\": \"col4\",\n\t\t\"value\": \"col4\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"-\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":63,"widgetId":"hdw7qt67dg","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":22,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","defaultText":"","isDisabled":false},{"widgetName":"Text14Copy","rightColumn":19,"textAlign":"RIGHT","widgetId":"yy4u8kzs8p","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":50,"parentRowSpace":10,"isVisible":"{{data_table.selectedRow._ref}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":490,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":500,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"25okoeayc8","topRow":37,"bottomRow":41,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text20Copy","rightColumn":19,"textAlign":"RIGHT","widgetId":"kv1pqyhxvs","topRow":37,"bottomRow":41,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"},{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":64,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":43,"bottomRow":47,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":48,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":43,"bottomRow":47,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_1","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row ID: {{data_table.selectedRow._id}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text20","rightColumn":19,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Firestore","userPermissions":[],"layouts":[{"new":false,"id":"60ec1d84a5109b1d752d75dc","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["SelectQuery.data[SelectQuery.data.length - 1]","order_select.selectedOptionValue + key_select.selectedOptionValue","SelectQuery.data[0]"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60ee9cafa5109b1d752d7b7b"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":890,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":720,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["_ref","col4","col5","col2","col3","col1","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns._ref.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"},{"key":"primaryColumns.col2.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col1.computedValue"}],"leftColumn":0,"primaryColumns":{"_ref":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow._ref))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"_ref","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"_ref","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":5,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":6,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":7,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":8,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"key_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t},\n\t{\n\t\t\"label\": \"col4\",\n\t\t\"value\": \"col4\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"-\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":63,"widgetId":"hdw7qt67dg","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":22,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","defaultText":"","isDisabled":false},{"widgetName":"Text14Copy","rightColumn":19,"textAlign":"RIGHT","widgetId":"yy4u8kzs8p","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":50,"parentRowSpace":10,"isVisible":"{{data_table.selectedRow._ref}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":490,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":500,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"25okoeayc8","topRow":37,"bottomRow":41,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text20Copy","rightColumn":19,"textAlign":"RIGHT","widgetId":"kv1pqyhxvs","topRow":37,"bottomRow":41,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"},{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":64,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":43,"bottomRow":47,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":48,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":43,"bottomRow":47,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_1","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col1}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{data_table.selectedRow.col4}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row ID: {{data_table.selectedRow._id}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text20","rightColumn":19,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"Redis","userPermissions":[],"layouts":[{"new":false,"id":"60eeaf24a5109b1d752d7ba8","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":[],"name":"FetchKeys","timeoutInMillisecond":10000,"id":"60eeaf83a5109b1d752d7bab"},{"pluginType":"DB","jsonPathKeys":["data_table.selectedRow.result"],"name":"FetchValue","timeoutInMillisecond":10000,"id":"60eeb8eda5109b1d752d7bc3"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":5168,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":27,"minHeight":860,"parentColumnSpace":1,"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"eer73khglm","topRow":1,"bottomRow":47,"parentRowSpace":10,"isVisible":"{{data_table.selectedRow.result}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"9nvn3gfw6q","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"eer73khglm","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateKey.run(() => FetchKeys.run(), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"3apd2wkt91","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"hhh0296qfj","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_value_input","rightColumn":63,"widgetId":"07ker1hdod","topRow":8,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":1,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{FetchValue.data[0].result}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"uawwds1z0r","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Key: {{data_table.selectedRow.result}}"}]}]},{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"v8nfulwuy0","containerStyle":"card","topRow":1,"bottomRow":88,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"erkvdsolhu","containerStyle":"none","topRow":0,"bottomRow":890,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"v8nfulwuy0","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["result","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":5,"bottomRow":86,"parentRowSpace":10,"onPageChange":"","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"},{"key":"onRowSelected"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.result.computedValue"}],"leftColumn":0,"primaryColumns":{"result":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => { return currentRow.result})}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"result","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"result","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"onRowSelected":"{{FetchValue.run()}}","derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"tefed053r1","isVisibleFilters":true,"tableData":"{{FetchKeys.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"erkvdsolhu","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"result":503,"task":245,"deliveryAddress":170,"step":62,"id":228,"customColumn2":174,"status":75}},{"widgetName":"new_key_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"2rlp4irwh0","buttonStyle":"PRIMARY_BUTTON","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Key","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{FetchKeys.run()}}","isDefaultClickDisabled":true,"widgetId":"o9t8fslxdi","buttonStyle":"SECONDARY_BUTTON","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":39,"textAlign":"LEFT","widgetId":"nt181ks4ci","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Redis Data"}]}]},{"widgetName":"Insert_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"c8fg4ubw52","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":0,"detachFromLayout":true,"widgetId":"re60vbuakz","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"c8fg4ubw52","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon1","rightColumn":64,"onClick":"{{closeModal('Insert_Modal')}}","color":"#040627","iconName":"cross","widgetId":"3tk445loxa","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text21","rightColumn":41,"textAlign":"LEFT","widgetId":"fgi9qp4uwr","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"New Key"},{"widgetName":"Button1","rightColumn":48,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"xnh96plcyo","buttonStyle":"SECONDARY_BUTTON","topRow":53,"bottomRow":57,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Button2","rightColumn":64,"onClick":"{{InsertKey.run(() => FetchKeys.run(() => closeModal('Insert_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"ix2dralfal","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Insert","isDisabled":false},{"isRequired":false,"widgetName":"insert_key_input","rightColumn":64,"widgetId":"ozz6gi7zmm","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":6.8125,"resetOnSubmit":true,"leftColumn":19,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text22","rightColumn":17,"textAlign":"RIGHT","widgetId":"kotk4wa6pe","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Key"},{"widgetName":"Text23","rightColumn":17,"textAlign":"RIGHT","widgetId":"y2dlumuetl","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Value"},{"isRequired":false,"widgetName":"insert_value_input","rightColumn":64,"widgetId":"pevr27mh87","topRow":16,"bottomRow":50,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":8,"resetOnSubmit":true,"leftColumn":19,"inputType":"TEXT","isDisabled":false}],"isDisabled":false}]},{"widgetName":"value_modal","rightColumn":0,"detachFromLayout":true,"widgetId":"fh14k9y353","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas4","rightColumn":0,"detachFromLayout":true,"widgetId":"v8n3d5aecd","topRow":0,"bottomRow":260,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"fh14k9y353","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon2","rightColumn":64,"onClick":"{{closeModal('value_modal')}}","color":"#040627","iconName":"cross","widgetId":"jqaazpo3zy","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"v8n3d5aecd","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text24","rightColumn":41,"textAlign":"LEFT","widgetId":"hvb3xnk1u8","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"v8n3d5aecd","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Value for Key: {{data_table.selectedRow.result}}"},{"widgetName":"Button4","rightColumn":64,"onClick":"{{closeModal('value_modal')}}","isDefaultClickDisabled":true,"widgetId":"yka7b6k706","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"v8n3d5aecd","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"widgetName":"Text25","rightColumn":64,"textAlign":"LEFT","widgetId":"j9315vzr13","topRow":6,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"v8n3d5aecd","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{FetchValue.data[0].result}}"}],"isDisabled":false}]},{"widgetName":"Delete_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"0skbil3ntd","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas5","rightColumn":0,"detachFromLayout":true,"widgetId":"lwsyaz55ll","topRow":0,"bottomRow":240,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"0skbil3ntd","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3","rightColumn":64,"onClick":"{{closeModal('Delete_Modal')}}","color":"#040627","iconName":"cross","widgetId":"dtuc8ag2of","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text26","rightColumn":41,"textAlign":"LEFT","widgetId":"d9ap4dp300","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"lwsyaz55ll","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Key"},{"widgetName":"Button6","rightColumn":64,"onClick":"{{DeleteKey.run(() => FetchKeys.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"2kg6lmim5m","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":46,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text27","rightColumn":64,"textAlign":"LEFT","widgetId":"c698jgkzjg","topRow":7,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"lwsyaz55ll","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete the key?\n\n{{data_table.selectedRow.result}}"},{"widgetName":"Button7","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"widgetId":"lsvqrab5v2","buttonStyle":"SECONDARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":32,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false}],"isDisabled":false}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"Redis","userPermissions":[],"layouts":[{"new":false,"id":"60eeaf24a5109b1d752d7ba8","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":[],"name":"FetchKeys","timeoutInMillisecond":10000,"id":"60eeaf83a5109b1d752d7bab"},{"pluginType":"DB","jsonPathKeys":["data_table.selectedRow.result"],"name":"FetchValue","timeoutInMillisecond":10000,"id":"60eeb8eda5109b1d752d7bc3"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":5168,"containerStyle":"none","snapRows":129,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":27,"minHeight":860,"parentColumnSpace":1,"dynamicBindingPathList":[],"leftColumn":0,"children":[{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"eer73khglm","topRow":1,"bottomRow":47,"parentRowSpace":10,"isVisible":"{{data_table.selectedRow.result}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"9nvn3gfw6q","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"eer73khglm","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateKey.run(() => FetchKeys.run(), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"3apd2wkt91","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"hhh0296qfj","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_value_input","rightColumn":63,"widgetId":"07ker1hdod","topRow":8,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":1,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{FetchValue.data[0].result}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"uawwds1z0r","topRow":0,"bottomRow":8,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"9nvn3gfw6q","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Key: {{data_table.selectedRow.result}}"}]}]},{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"v8nfulwuy0","containerStyle":"card","topRow":1,"bottomRow":88,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"erkvdsolhu","containerStyle":"none","topRow":0,"bottomRow":890,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"v8nfulwuy0","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"data_table","columnOrder":["result","customColumn1"],"dynamicPropertyPathList":[],"isVisibleDownload":true,"topRow":5,"bottomRow":86,"parentRowSpace":10,"onPageChange":"","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"},{"key":"onRowSelected"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.result.computedValue"}],"leftColumn":0,"primaryColumns":{"result":{"isDerived":false,"computedValue":"{{data_table.sanitizedTableData.map((currentRow) => { return currentRow.result})}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"result","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"result","verticalAlignment":"CENTER"},"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"onRowSelected":"{{FetchValue.run()}}","derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{data_table.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"tefed053r1","isVisibleFilters":true,"tableData":"{{FetchKeys.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"erkvdsolhu","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"result":503,"task":245,"deliveryAddress":170,"step":62,"id":228,"customColumn2":174,"status":75}},{"widgetName":"new_key_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"2rlp4irwh0","buttonStyle":"PRIMARY_BUTTON","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Key","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{FetchKeys.run()}}","isDefaultClickDisabled":true,"widgetId":"o9t8fslxdi","buttonStyle":"SECONDARY_BUTTON","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":39,"textAlign":"LEFT","widgetId":"nt181ks4ci","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"erkvdsolhu","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Redis Data"}]}]},{"widgetName":"Insert_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"c8fg4ubw52","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":0,"detachFromLayout":true,"widgetId":"re60vbuakz","topRow":0,"bottomRow":590,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"c8fg4ubw52","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon1","rightColumn":64,"onClick":"{{closeModal('Insert_Modal')}}","color":"#040627","iconName":"cross","widgetId":"3tk445loxa","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text21","rightColumn":41,"textAlign":"LEFT","widgetId":"fgi9qp4uwr","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"New Key"},{"widgetName":"Button1","rightColumn":48,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"xnh96plcyo","buttonStyle":"SECONDARY_BUTTON","topRow":53,"bottomRow":57,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":36,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Button2","rightColumn":64,"onClick":"{{InsertKey.run(() => FetchKeys.run(() => closeModal('Insert_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"ix2dralfal","buttonStyle":"PRIMARY_BUTTON","topRow":53,"bottomRow":57,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Insert","isDisabled":false},{"isRequired":false,"widgetName":"insert_key_input","rightColumn":64,"widgetId":"ozz6gi7zmm","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":6.8125,"resetOnSubmit":true,"leftColumn":19,"inputType":"TEXT","isDisabled":false},{"widgetName":"Text22","rightColumn":17,"textAlign":"RIGHT","widgetId":"kotk4wa6pe","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Key"},{"widgetName":"Text23","rightColumn":17,"textAlign":"RIGHT","widgetId":"y2dlumuetl","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Value"},{"isRequired":false,"widgetName":"insert_value_input","rightColumn":64,"widgetId":"pevr27mh87","topRow":16,"bottomRow":50,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"re60vbuakz","isLoading":false,"parentColumnSpace":8,"resetOnSubmit":true,"leftColumn":19,"inputType":"TEXT","isDisabled":false}],"isDisabled":false}]},{"widgetName":"value_modal","rightColumn":0,"detachFromLayout":true,"widgetId":"fh14k9y353","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas4","rightColumn":0,"detachFromLayout":true,"widgetId":"v8n3d5aecd","topRow":0,"bottomRow":260,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"fh14k9y353","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon2","rightColumn":64,"onClick":"{{closeModal('value_modal')}}","color":"#040627","iconName":"cross","widgetId":"jqaazpo3zy","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"v8n3d5aecd","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text24","rightColumn":41,"textAlign":"LEFT","widgetId":"hvb3xnk1u8","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"v8n3d5aecd","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Value for Key: {{data_table.selectedRow.result}}"},{"widgetName":"Button4","rightColumn":64,"onClick":"{{closeModal('value_modal')}}","isDefaultClickDisabled":true,"widgetId":"yka7b6k706","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"v8n3d5aecd","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Close","isDisabled":false},{"widgetName":"Text25","rightColumn":64,"textAlign":"LEFT","widgetId":"j9315vzr13","topRow":6,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"v8n3d5aecd","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"{{FetchValue.data[0].result}}"}],"isDisabled":false}]},{"widgetName":"Delete_Modal","rightColumn":0,"detachFromLayout":true,"widgetId":"0skbil3ntd","topRow":0,"bottomRow":0,"parentRowSpace":1,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":true,"isLoading":false,"parentColumnSpace":1,"size":"MODAL_SMALL","leftColumn":0,"children":[{"widgetName":"Canvas5","rightColumn":0,"detachFromLayout":true,"widgetId":"lwsyaz55ll","topRow":0,"bottomRow":240,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"0skbil3ntd","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Icon3","rightColumn":64,"onClick":"{{closeModal('Delete_Modal')}}","color":"#040627","iconName":"cross","widgetId":"dtuc8ag2of","topRow":1,"bottomRow":5,"isVisible":true,"type":"ICON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"leftColumn":56,"iconSize":24},{"widgetName":"Text26","rightColumn":41,"textAlign":"LEFT","widgetId":"d9ap4dp300","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"lwsyaz55ll","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Key"},{"widgetName":"Button6","rightColumn":64,"onClick":"{{DeleteKey.run(() => FetchKeys.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"2kg6lmim5m","buttonStyle":"PRIMARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":46,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text27","rightColumn":64,"textAlign":"LEFT","widgetId":"c698jgkzjg","topRow":7,"bottomRow":17,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":true,"parentId":"lwsyaz55ll","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete the key?\n\n{{data_table.selectedRow.result}}"},{"widgetName":"Button7","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"widgetId":"lsvqrab5v2","buttonStyle":"SECONDARY_BUTTON","topRow":18,"bottomRow":22,"recaptchaV2":false,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"lwsyaz55ll","isLoading":false,"parentColumnSpace":6.8125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":32,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false}],"isDisabled":false}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]},{"publishedPage":{"name":"PostgreSQL","userPermissions":[],"layouts":[{"new":false,"id":"60f68220d4c0bb105f54dfd0","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60f68221d4c0bb105f54dfd4"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":1020,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":880,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Table1","columnOrder":["col1","col3","col4","col5","col2","customColumn1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"},{"key":"primaryColumns.col2.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"col_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"ASC","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"ASC\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"DESC\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"9t3vdjd5xj","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"5rfqxgj0vm","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!Table1.selectedRow.col1}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col4}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row: {{Table1.selectedRow.col1}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"},{"widgetName":"Text20","rightColumn":18,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"}]}]}]}}],"isHidden":false},"new":true,"unpublishedPage":{"name":"PostgreSQL","userPermissions":[],"layouts":[{"new":false,"id":"60f68220d4c0bb105f54dfd0","userPermissions":[],"layoutOnLoadActions":[[{"pluginType":"DB","jsonPathKeys":["order_select.selectedOptionLabel","(Table1.pageNo - 1) * Table1.pageSize","Table1.searchText || \"\"","col_select.selectedOptionValue","Table1.pageSize"],"name":"SelectQuery","timeoutInMillisecond":10000,"id":"60f68221d4c0bb105f54dfd4"}]],"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1280,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":890,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":30,"minHeight":1020,"parentColumnSpace":1,"dynamicTriggerPathList":[],"dynamicBindingPathList":[],"leftColumn":0,"children":[{"backgroundColor":"#FFFFFF","widgetName":"Container1","rightColumn":40,"widgetId":"mvubsemxfo","containerStyle":"card","topRow":0,"bottomRow":87,"parentRowSpace":10,"isVisible":true,"type":"CONTAINER_WIDGET","version":1,"parentId":"0","isLoading":false,"parentColumnSpace":19.75,"leftColumn":0,"children":[{"widgetName":"Canvas1","rightColumn":632,"detachFromLayout":true,"widgetId":"59rw5mx0bq","containerStyle":"none","topRow":0,"bottomRow":880,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"mvubsemxfo","minHeight":870,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Table1","columnOrder":["col1","col3","col4","col5","col2","customColumn1"],"dynamicPropertyPathList":[{"key":"onPageChange"}],"isVisibleDownload":true,"topRow":10,"bottomRow":86,"parentRowSpace":10,"onPageChange":"{{SelectQuery.run()}}","type":"TABLE_WIDGET","defaultSelectedRow":"0","parentColumnSpace":1,"dynamicTriggerPathList":[{"key":"onPageChange"},{"key":"primaryColumns.customColumn1.onClick"},{"key":"onSearchTextChanged"}],"dynamicBindingPathList":[{"key":"primaryColumns.customColumn1.buttonLabel"},{"key":"tableData"},{"key":"primaryColumns.col1.computedValue"},{"key":"primaryColumns.col3.computedValue"},{"key":"primaryColumns.col4.computedValue"},{"key":"primaryColumns.col5.computedValue"},{"key":"primaryColumns.col2.computedValue"}],"leftColumn":0,"primaryColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{showModal('Delete_Modal')}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"Delete","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"},"col4":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col4))}}","textSize":"PARAGRAPH","index":2,"isVisible":true,"label":"col4","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col4","verticalAlignment":"CENTER"},"col5":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col5))}}","textSize":"PARAGRAPH","index":3,"isVisible":true,"label":"col5","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col5","verticalAlignment":"CENTER"},"col2":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col2))}}","textSize":"PARAGRAPH","index":4,"isVisible":true,"label":"col2","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col2","verticalAlignment":"CENTER"},"col3":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col3))}}","textSize":"PARAGRAPH","index":1,"isVisible":true,"label":"col3","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col3","verticalAlignment":"CENTER"},"col1":{"isDerived":false,"computedValue":"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.col1))}}","textSize":"PARAGRAPH","index":0,"isVisible":true,"label":"col1","columnType":"text","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"col1","verticalAlignment":"CENTER"}},"derivedColumns":{"customColumn1":{"isDerived":true,"computedValue":"","onClick":"{{DeleteQuery.run()}}","textSize":"PARAGRAPH","buttonStyle":"#DD4B34","index":7,"isVisible":true,"label":"customColumn1","buttonLabel":"{{Table1.sanitizedTableData.map((currentRow) => { return 'Delete'})}}","columnType":"button","horizontalAlignment":"LEFT","width":150,"enableFilter":true,"enableSort":true,"id":"customColumn1","buttonLabelColor":"#FFFFFF","verticalAlignment":"CENTER"}},"rightColumn":64,"textSize":"PARAGRAPH","widgetId":"jabdu9f16g","isVisibleFilters":true,"tableData":"{{SelectQuery.data}}","isVisible":true,"label":"Data","searchKey":"","version":1,"parentId":"59rw5mx0bq","serverSidePaginationEnabled":true,"isLoading":false,"isVisibleCompactMode":true,"onSearchTextChanged":"{{SelectQuery.run()}}","horizontalAlignment":"LEFT","isVisibleSearch":true,"isVisiblePagination":true,"verticalAlignment":"CENTER","columnSizeMap":{"task":245,"deliveryAddress":170,"step":62,"id":228,"status":75}},{"widgetName":"new_row_button","rightColumn":64,"onClick":"{{showModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"aiy9e38won","buttonStyle":"PRIMARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":6.8310546875,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":51,"dynamicBindingPathList":[],"text":"New Row","isDisabled":false},{"isRequired":false,"widgetName":"col_select","isFilterable":true,"rightColumn":22,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"asmgosgxjm","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"col1","parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":7,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n\t{\n\t\t\"label\": \"col1\",\n\t\t\"value\": \"col1\"\n\t},\n\t{\n\t\t\"label\": \"col2\",\n\t\t\"value\": \"col2\"\n\t},\n\t{\n\t\t\"label\": \"col3\",\n\t\t\"value\": \"col3\"\n\t}\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"Text15","rightColumn":7,"textAlign":"LEFT","widgetId":"l8pgl90klz","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":19.75,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Order By :"},{"isRequired":false,"widgetName":"order_select","isFilterable":true,"rightColumn":30,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"10v8a19m25","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":"{{SelectQuery.data.length > 0}}","label":"","type":"DROP_DOWN_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"defaultOptionValue":"ASC","parentColumnSpace":19.75,"dynamicTriggerPathList":[{"key":"onOptionChange"}],"leftColumn":22,"dynamicBindingPathList":[{"key":"isVisible"}],"options":"[\n {\n \"label\": \"ASC\",\n \"value\": \"ASC\"\n },\n {\n \"label\": \"DESC\",\n \"value\": \"DESC\"\n }\n]","onOptionChange":"{{SelectQuery.run()}}","isDisabled":false},{"widgetName":"refresh_button","rightColumn":51,"onClick":"{{SelectQuery.run()}}","isDefaultClickDisabled":true,"widgetId":"qykn04gnsw","buttonStyle":"SECONDARY_BUTTON","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":40,"dynamicBindingPathList":[],"text":"Refresh","isDisabled":false},{"widgetName":"Text16","rightColumn":64,"textAlign":"LEFT","widgetId":"urzv99hdc8","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"59rw5mx0bq","isLoading":false,"parentColumnSpace":11.78515625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"template_table Data"}]}]},{"widgetName":"Delete_Modal","rightColumn":45,"detachFromLayout":true,"widgetId":"i3whp03wf0","topRow":13,"bottomRow":37,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_SMALL","leftColumn":21,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas3","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"zi8fjakv8o","topRow":0,"bottomRow":230,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"i3whp03wf0","shouldScrollContents":false,"minHeight":240,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Alert_text","rightColumn":41,"textAlign":"LEFT","widgetId":"35yoxo4oec","topRow":1,"bottomRow":5,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Delete Row"},{"widgetName":"Button1","rightColumn":46,"onClick":"{{closeModal('Delete_Modal')}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"lryg8kw537","buttonStyle":"PRIMARY_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":34,"dynamicBindingPathList":[],"text":"Cancel","isDisabled":false},{"widgetName":"Delete_Button","rightColumn":64,"onClick":"{{DeleteQuery.run(() => SelectQuery.run(() => closeModal('Delete_Modal')), () => {})}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"qq02lh7ust","buttonStyle":"DANGER_BUTTON","topRow":17,"bottomRow":21,"isVisible":true,"type":"BUTTON_WIDGET","version":1,"parentId":"zi8fjakv8o","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"leftColumn":48,"dynamicBindingPathList":[],"text":"Confirm","isDisabled":false},{"widgetName":"Text12","rightColumn":63,"textAlign":"LEFT","widgetId":"48uac29g6e","topRow":8,"bottomRow":12,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"zi8fjakv8o","isLoading":false,"parentColumnSpace":6.875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"Are you sure you want to delete this item?"}],"isDisabled":false}]},{"widgetName":"Insert_Modal","rightColumn":41,"detachFromLayout":true,"widgetId":"vmorzie6eq","topRow":16,"bottomRow":40,"parentRowSpace":10,"canOutsideClickClose":true,"type":"MODAL_WIDGET","canEscapeKeyClose":true,"version":1,"parentId":"0","shouldScrollContents":false,"isLoading":false,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"size":"MODAL_LARGE","leftColumn":17,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas4","rightColumn":453.1875,"detachFromLayout":true,"widgetId":"9rhv3ioohq","topRow":0,"bottomRow":610,"parentRowSpace":1,"isVisible":true,"canExtend":true,"type":"CANVAS_WIDGET","version":1,"parentId":"vmorzie6eq","shouldScrollContents":false,"minHeight":600,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"widgetName":"Form2","backgroundColor":"#F6F7F8","rightColumn":64,"widgetId":"1ruewbc4ef","topRow":0,"bottomRow":58,"parentRowSpace":10,"isVisible":true,"type":"FORM_WIDGET","parentId":"9rhv3ioohq","isLoading":false,"shouldScrollContents":false,"parentColumnSpace":8,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"children":[{"widgetName":"Canvas5","rightColumn":224,"detachFromLayout":true,"widgetId":"tp9pui0e6y","containerStyle":"none","topRow":0,"bottomRow":570,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"1ruewbc4ef","minHeight":580,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":true,"widgetName":"insert_button","rightColumn":62,"onClick":"{{InsertQuery.run(() => SelectQuery.run(() => closeModal('Insert_Modal')))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[{"key":"onClick"}],"widgetId":"h8vxf3oh4s","buttonStyle":"PRIMARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":43,"dynamicBindingPathList":[],"googleRecaptchaKey":"","text":"Submit"},{"resetFormOnClick":true,"widgetName":"reset_button","rightColumn":42,"onClick":"{{closeModal('Insert_Modal')}}","isDefaultClickDisabled":true,"widgetId":"o23gs26wm5","buttonStyle":"SECONDARY_BUTTON","topRow":51,"bottomRow":55,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":29,"dynamicBindingPathList":[],"text":"Close"},{"widgetName":"Text21","rightColumn":19,"textAlign":"RIGHT","widgetId":"cfmxebyn06","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col1:"},{"isRequired":true,"widgetName":"insert_col_input1","rightColumn":62,"widgetId":"h1wbbv7alb","topRow":5,"bottomRow":9,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col1","isDisabled":false},{"widgetName":"Text22","rightColumn":19,"textAlign":"RIGHT","widgetId":"jsffaxrqhw","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":2,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2:"},{"isRequired":true,"widgetName":"insert_col_input2","rightColumn":62,"widgetId":"6enalyprua","topRow":12,"bottomRow":16,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","defaultText":"","placeholderText":"col2","isDisabled":false},{"widgetName":"Text23","rightColumn":19,"textAlign":"RIGHT","widgetId":"btk60uozsm","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3:"},{"isRequired":true,"widgetName":"insert_col_input3","rightColumn":62,"widgetId":"e490gfts69","topRow":19,"bottomRow":23,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col3","defaultText":"","isDisabled":false},{"widgetName":"Text14","rightColumn":19,"textAlign":"RIGHT","widgetId":"8fm60omwwv","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4:"},{"isRequired":true,"widgetName":"insert_col_input4","rightColumn":62,"widgetId":"r55cydp0ao","topRow":26,"bottomRow":30,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col4","defaultText":"","isDisabled":false},{"widgetName":"Text24","rightColumn":19,"textAlign":"RIGHT","widgetId":"9t3vdjd5xj","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":7.6865234375,"dynamicTriggerPathList":[],"leftColumn":3,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5:"},{"isRequired":true,"widgetName":"insert_col_input5","rightColumn":62,"widgetId":"5rfqxgj0vm","topRow":33,"bottomRow":37,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"tp9pui0e6y","isLoading":false,"parentColumnSpace":8.0625,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":21,"dynamicBindingPathList":[],"inputType":"TEXT","placeholderText":"col5","isDisabled":false},{"widgetName":"Text13Copy","rightColumn":35,"textAlign":"LEFT","widgetId":"18x7vdv3gs","topRow":0,"bottomRow":4,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"shouldScroll":false,"parentId":"tp9pui0e6y","isLoading":false,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"HEADING1","text":"Insert Row"}]}]}],"isDisabled":false}]},{"widgetName":"Form1","backgroundColor":"white","rightColumn":64,"dynamicPropertyPathList":[{"key":"isVisible"}],"widgetId":"m7dvlazbn7","topRow":0,"bottomRow":46,"parentRowSpace":10,"isVisible":"{{!!Table1.selectedRow.col1}}","type":"FORM_WIDGET","parentId":"0","isLoading":false,"shouldScrollContents":true,"parentColumnSpace":18.8828125,"dynamicTriggerPathList":[],"leftColumn":40,"dynamicBindingPathList":[{"key":"isVisible"}],"children":[{"widgetName":"Canvas2","rightColumn":528.71875,"detachFromLayout":true,"widgetId":"cicukwhp5j","containerStyle":"none","topRow":0,"bottomRow":450,"parentRowSpace":1,"isVisible":true,"canExtend":false,"type":"CANVAS_WIDGET","version":1,"parentId":"m7dvlazbn7","minHeight":460,"isLoading":false,"parentColumnSpace":1,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"children":[{"resetFormOnClick":false,"widgetName":"update_button","rightColumn":63,"onClick":"{{UpdateQuery.run(() => SelectQuery.run(), () => showAlert('Error while updating resource!','error'))}}","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"4gnygu5jew","buttonStyle":"PRIMARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":true,"leftColumn":47,"dynamicBindingPathList":[],"text":"Update"},{"resetFormOnClick":true,"widgetName":"reset_update_button","rightColumn":46,"onClick":"","isDefaultClickDisabled":true,"dynamicPropertyPathList":[],"widgetId":"twwgpz5wfu","buttonStyle":"SECONDARY_BUTTON","topRow":39,"bottomRow":43,"isVisible":true,"type":"FORM_BUTTON_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"dynamicTriggerPathList":[{"key":"onClick"}],"disabledWhenInvalid":false,"leftColumn":28,"dynamicBindingPathList":[],"text":"Reset"},{"isRequired":true,"widgetName":"update_col_2","rightColumn":63,"widgetId":"in8e51pg3y","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col2}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_3","rightColumn":63,"widgetId":"mlhvfasf31","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col3}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_4","rightColumn":63,"widgetId":"0lz9vhcnr0","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col4}}","isDisabled":false},{"isRequired":true,"widgetName":"update_col_5","rightColumn":63,"widgetId":"m4esf7fww5","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"label":"","type":"INPUT_WIDGET","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"resetOnSubmit":true,"leftColumn":19,"dynamicBindingPathList":[{"key":"defaultText"}],"inputType":"TEXT","defaultText":"{{Table1.selectedRow.col5}}","isDisabled":false},{"widgetName":"Text9","rightColumn":63,"textAlign":"LEFT","widgetId":"4hnz8ktmz5","topRow":0,"bottomRow":4,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":8.8963623046875,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[{"key":"text"}],"fontSize":"HEADING1","text":"Update Row: {{Table1.selectedRow.col1}}"},{"widgetName":"Text17","rightColumn":18,"textAlign":"RIGHT","widgetId":"afzzc7q8af","topRow":9,"bottomRow":13,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col2 :"},{"widgetName":"Text18","rightColumn":18,"textAlign":"RIGHT","widgetId":"xqcsd2e5dj","topRow":16,"bottomRow":20,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col3 :"},{"widgetName":"Text19","rightColumn":18,"textAlign":"RIGHT","widgetId":"l109ilp3vq","topRow":23,"bottomRow":27,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":1,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col4 :"},{"widgetName":"Text20","rightColumn":18,"textAlign":"RIGHT","widgetId":"gqpwf0yng6","topRow":30,"bottomRow":34,"parentRowSpace":10,"isVisible":true,"fontStyle":"BOLD","type":"TEXT_WIDGET","textColor":"#231F20","version":1,"parentId":"cicukwhp5j","isLoading":false,"parentColumnSpace":7.15625,"dynamicTriggerPathList":[],"leftColumn":0,"dynamicBindingPathList":[],"fontSize":"PARAGRAPH","text":"col5 :"}]}]}]}}],"isHidden":false},"userPermissions":["read:pages","manage:pages"]}],"publishedLayoutmongoEscapedWidgets":{"60dafddaee9aa1792c5bf76d":["data_table"]},"exportedApplication":{"appLayout":{"type":"DESKTOP"},"new":true,"color":"#6C9DD0","name":"CRUD App Templates","appIsExample":false,"icon":"bus","isPublic":false,"userPermissions":["canComment:applications","manage:applications","export:applications","read:applications","publish:applications","makePublic:applications"],"unreadCommentThreads":0},"publishedDefaultPageName":"PostgreSQL"} \ No newline at end of file
258e92e368bef68bb0d49057dcaec43d1f2d249f
2024-05-02 16:16:25
Shrikant Sharat Kandula
chore: Use FromRequest for datasource APIs (#33039)
false
Use FromRequest for datasource APIs (#33039)
chore
diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ApiKeyAuth.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ApiKeyAuth.java index a736a20e952d..50563228df97 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ApiKeyAuth.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ApiKeyAuth.java @@ -3,7 +3,10 @@ import com.appsmith.external.annotations.documenttype.DocumentType; import com.appsmith.external.annotations.encryption.Encrypted; import com.appsmith.external.constants.Authentication; +import com.appsmith.external.views.FromRequest; +import com.appsmith.external.views.Views; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonView; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; @@ -27,10 +30,15 @@ public enum Type { HEADER, } + @JsonView({Views.Public.class, FromRequest.class}) Type addTo; + + @JsonView({Views.Public.class, FromRequest.class}) String label; + + @JsonView({Views.Public.class, FromRequest.class}) String headerPrefix; - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + @JsonView(FromRequest.class) @Encrypted String value; } diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BasicAuth.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BasicAuth.java index d9ce26819d69..c0c597bc8dd3 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BasicAuth.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BasicAuth.java @@ -3,7 +3,9 @@ import com.appsmith.external.annotations.documenttype.DocumentType; import com.appsmith.external.annotations.encryption.Encrypted; import com.appsmith.external.constants.Authentication; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.appsmith.external.views.FromRequest; +import com.appsmith.external.views.Views; +import com.fasterxml.jackson.annotation.JsonView; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -18,8 +20,9 @@ @DocumentType(Authentication.BASIC) public class BasicAuth extends AuthenticationDTO { + @JsonView({Views.Public.class, FromRequest.class}) String username; - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - @Encrypted String password; + @Encrypted @JsonView(FromRequest.class) + String password; } diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BearerTokenAuth.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BearerTokenAuth.java index e550833c8018..3563b51bdde8 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BearerTokenAuth.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/BearerTokenAuth.java @@ -3,7 +3,8 @@ import com.appsmith.external.annotations.documenttype.DocumentType; import com.appsmith.external.annotations.encryption.Encrypted; import com.appsmith.external.constants.Authentication; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.appsmith.external.views.FromRequest; +import com.fasterxml.jackson.annotation.JsonView; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -17,7 +18,6 @@ @AllArgsConstructor @DocumentType(Authentication.BEARER_TOKEN) public class BearerTokenAuth extends AuthenticationDTO { - - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - @Encrypted String bearerToken; + @Encrypted @JsonView(FromRequest.class) + String bearerToken; } diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Connection.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Connection.java index 3c51016b1458..ac8722c4e86a 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Connection.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Connection.java @@ -1,5 +1,8 @@ package com.appsmith.external.models; +import com.appsmith.external.views.FromRequest; +import com.appsmith.external.views.Views; +import com.fasterxml.jackson.annotation.JsonView; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -29,6 +32,7 @@ public enum Type { Type type; + @JsonView({Views.Public.class, FromRequest.class}) SSLDetails ssl; String defaultDatabaseName; diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DBAuth.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DBAuth.java index 09530c5695cb..f48f5e0b81b1 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DBAuth.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DBAuth.java @@ -3,7 +3,9 @@ import com.appsmith.external.annotations.documenttype.DocumentType; import com.appsmith.external.annotations.encryption.Encrypted; import com.appsmith.external.constants.Authentication; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.appsmith.external.views.FromRequest; +import com.appsmith.external.views.Views; +import com.fasterxml.jackson.annotation.JsonView; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -25,12 +27,15 @@ public enum Type { USERNAME_PASSWORD } + @JsonView({Views.Public.class, FromRequest.class}) Type authType; + @JsonView({Views.Public.class, FromRequest.class}) String username; - @Encrypted @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + @Encrypted @JsonView(FromRequest.class) String password; + @JsonView({Views.Public.class, FromRequest.class}) String databaseName; } 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 4a2c97900711..c7748bd047fc 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 @@ -39,18 +39,18 @@ public class Datasource extends BranchAwareDomain { // name of the plugin. used to log analytics events where pluginName is a required attribute // It'll be null if not set @Transient - @JsonView({Views.Public.class, FromRequest.class}) + @JsonView(Views.Public.class) String pluginName; // Organizations migrated to workspaces, kept the field as deprecated to support the old migration @Deprecated - @JsonView({Views.Public.class, FromRequest.class}) + @JsonView(Views.Public.class) String organizationId; @JsonView({Views.Public.class, FromRequest.class}) String workspaceId; - @JsonView({Views.Public.class, FromRequest.class}) + @JsonView(Views.Public.class) String templateName; // This is only kept public for embedded datasource @@ -58,7 +58,7 @@ public class Datasource extends BranchAwareDomain { DatasourceConfiguration datasourceConfiguration; @Transient - @JsonView(Views.Public.class) + @JsonView({Views.Public.class, FromRequest.class}) Map<String, DatasourceStorageDTO> datasourceStorages = new HashMap<>(); @JsonView(Views.Public.class) @@ -89,7 +89,7 @@ public class Datasource extends BranchAwareDomain { Boolean isConfigured; @Transient - @JsonView({Views.Public.class, FromRequest.class}) + @JsonView(Views.Public.class) Boolean isRecentlyCreated; /* @@ -97,14 +97,14 @@ public class Datasource extends BranchAwareDomain { * The field is not used anywhere in the codebase because templates are created directly in the DB, and the field * serves only as a DTO property. */ - @JsonView({Views.Public.class, FromRequest.class}) + @JsonView(Views.Public.class) Boolean isTemplate; /* * This field is meant to indicate whether the datasource is part of a mock DB, or a copy of the same. * The field is set during the creation of the mock db */ - @JsonView({Views.Public.class, FromRequest.class}) + @JsonView(Views.Public.class) Boolean isMock; @JsonView(Views.Internal.class) diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceConfiguration.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceConfiguration.java index a053c87a77da..ee6c0097cf42 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceConfiguration.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceConfiguration.java @@ -1,5 +1,8 @@ package com.appsmith.external.models; +import com.appsmith.external.views.FromRequest; +import com.appsmith.external.views.Views; +import com.fasterxml.jackson.annotation.JsonView; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; @@ -21,22 +24,30 @@ @FieldNameConstants public class DatasourceConfiguration implements AppsmithDomain { + @JsonView({Views.Public.class, FromRequest.class}) Connection connection; + @JsonView({Views.Public.class, FromRequest.class}) List<Endpoint> endpoints; + @JsonView({Views.Public.class, FromRequest.class}) AuthenticationDTO authentication; SSHConnection sshProxy; Boolean sshProxyEnabled; + @JsonView({Views.Public.class, FromRequest.class}) List<Property> properties; // For REST API. + @JsonView({Views.Public.class, FromRequest.class}) String url; + @JsonView({Views.Public.class, FromRequest.class}) List<Property> headers; + + @JsonView({Views.Public.class, FromRequest.class}) List<Property> queryParameters; public boolean isSshProxyEnabled() { diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStorageDTO.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStorageDTO.java index a4c4cb5cc712..15ff27823881 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStorageDTO.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/DatasourceStorageDTO.java @@ -1,5 +1,6 @@ package com.appsmith.external.models; +import com.appsmith.external.views.FromRequest; import com.appsmith.external.views.Views; import com.fasterxml.jackson.annotation.JsonView; import lombok.Data; @@ -15,9 +16,16 @@ public class DatasourceStorageDTO { String id; String datasourceId; + + @JsonView({Views.Public.class, FromRequest.class}) String environmentId; + + @JsonView({Views.Public.class, FromRequest.class}) DatasourceConfiguration datasourceConfiguration; + + @JsonView({Views.Public.class, FromRequest.class}) Boolean isConfigured; + Set<String> invalids; Set<String> messages; diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/OAuth2.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/OAuth2.java index 8e8b1a7b44c3..54e94e2551ad 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/OAuth2.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/OAuth2.java @@ -5,7 +5,10 @@ import com.appsmith.external.constants.Authentication; import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError; import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException; +import com.appsmith.external.views.FromRequest; +import com.appsmith.external.views.Views; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonView; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -41,6 +44,7 @@ public enum RefreshTokenClientCredentialsLocation { BODY } + @JsonView({Views.Public.class, FromRequest.class}) Type grantType; // Send tokens as query params if false @@ -49,32 +53,40 @@ public enum RefreshTokenClientCredentialsLocation { // Send auth details in body if false Boolean isAuthorizationHeader = false; + @JsonView({Views.Public.class, FromRequest.class}) String clientId; - @Encrypted @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + @Encrypted @JsonView({Views.Public.class, FromRequest.class}) String clientSecret; + @JsonView({Views.Public.class, FromRequest.class}) String authorizationUrl; String expiresIn; + @JsonView({Views.Public.class, FromRequest.class}) String accessTokenUrl; @Transient + @JsonView({Views.Public.class, FromRequest.class}) String scopeString; + @JsonView({Views.Public.class, FromRequest.class}) Set<String> scope; Boolean sendScopeWithRefreshToken; RefreshTokenClientCredentialsLocation refreshTokenClientCredentialsLocation; + @JsonView({Views.Public.class, FromRequest.class}) String headerPrefix; Set<Property> customTokenParameters; + @JsonView({Views.Public.class, FromRequest.class}) String audience; + @JsonView({Views.Public.class, FromRequest.class}) String resource; boolean useSelfSignedCert = false; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/DatasourceController.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/DatasourceController.java index 2fc2583f3d78..ad27f544564b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/DatasourceController.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/DatasourceController.java @@ -3,7 +3,6 @@ import com.appsmith.server.constants.Url; import com.appsmith.server.controllers.ce.DatasourceControllerCE; import com.appsmith.server.datasources.base.DatasourceService; -import com.appsmith.server.ratelimiting.RateLimitService; import com.appsmith.server.services.MockDataService; import com.appsmith.server.solutions.AuthenticationService; import com.appsmith.server.solutions.DatasourceStructureSolution; @@ -20,14 +19,12 @@ public DatasourceController( DatasourceStructureSolution datasourceStructureSolution, AuthenticationService authenticationService, MockDataService datasourceService, - DatasourceTriggerSolution datasourceTriggerSolution, - RateLimitService rateLimitService) { + DatasourceTriggerSolution datasourceTriggerSolution) { super( service, datasourceStructureSolution, authenticationService, datasourceService, - datasourceTriggerSolution, - rateLimitService); + datasourceTriggerSolution); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/DatasourceControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/DatasourceControllerCE.java index 1425e749e747..a3c6961ba1e9 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/DatasourceControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/DatasourceControllerCE.java @@ -8,6 +8,7 @@ import com.appsmith.external.models.DatasourceTestResult; import com.appsmith.external.models.TriggerRequestDTO; import com.appsmith.external.models.TriggerResultDTO; +import com.appsmith.external.views.FromRequest; import com.appsmith.external.views.Views; import com.appsmith.server.constants.FieldName; import com.appsmith.server.constants.Url; @@ -16,16 +17,15 @@ import com.appsmith.server.dtos.MockDataSet; import com.appsmith.server.dtos.MockDataSource; import com.appsmith.server.dtos.ResponseDTO; -import com.appsmith.server.ratelimiting.RateLimitService; import com.appsmith.server.services.MockDataService; import com.appsmith.server.solutions.AuthenticationService; import com.appsmith.server.solutions.DatasourceStructureSolution; import com.appsmith.server.solutions.DatasourceTriggerSolution; import com.fasterxml.jackson.annotation.JsonView; import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.BooleanUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.DeleteMapping; @@ -46,33 +46,17 @@ @Slf4j @RequestMapping(Url.DATASOURCE_URL) +@RequiredArgsConstructor public class DatasourceControllerCE { + private final DatasourceService datasourceService; private final DatasourceStructureSolution datasourceStructureSolution; private final AuthenticationService authenticationService; private final MockDataService mockDataService; private final DatasourceTriggerSolution datasourceTriggerSolution; - private final DatasourceService datasourceService; - private final RateLimitService rateLimitService; - - @Autowired - public DatasourceControllerCE( - DatasourceService service, - DatasourceStructureSolution datasourceStructureSolution, - AuthenticationService authenticationService, - MockDataService datasourceService, - DatasourceTriggerSolution datasourceTriggerSolution, - RateLimitService rateLimitService) { - this.datasourceService = service; - this.datasourceStructureSolution = datasourceStructureSolution; - this.authenticationService = authenticationService; - this.mockDataService = datasourceService; - this.datasourceTriggerSolution = datasourceTriggerSolution; - this.rateLimitService = rateLimitService; - } @JsonView(Views.Public.class) - @GetMapping("") + @GetMapping public Mono<ResponseDTO<List<Datasource>>> getAll(@RequestParam MultiValueMap<String, String> params) { log.debug("Going to get all resources from datasource controller {}", params); return datasourceService @@ -84,9 +68,7 @@ public Mono<ResponseDTO<List<Datasource>>> getAll(@RequestParam MultiValueMap<St @JsonView(Views.Public.class) @PostMapping @ResponseStatus(HttpStatus.CREATED) - public Mono<ResponseDTO<Datasource>> create( - @Valid @RequestBody Datasource resource, - @RequestHeader(name = FieldName.HEADER_ENVIRONMENT_ID, required = false) String activeEnvironmentId) { + public Mono<ResponseDTO<Datasource>> create(@Valid @RequestBody @JsonView(FromRequest.class) Datasource resource) { log.debug("Going to create resource from datasource controller"); return datasourceService .create(resource) @@ -97,7 +79,7 @@ public Mono<ResponseDTO<Datasource>> create( @PutMapping("/{id}") public Mono<ResponseDTO<Datasource>> update( @PathVariable String id, - @RequestBody Datasource datasource, + @RequestBody @JsonView(FromRequest.class) Datasource datasource, @RequestHeader(name = FieldName.HEADER_ENVIRONMENT_ID, required = false) String environmentId) { log.debug("Going to update resource from datasource controller with id: {}", id); return datasourceService
8d9c52df5d2a2b52e4b408ec0a717f9648ceef88
2023-08-18 13:48:41
Aishwarya-U-R
test: Cypress | (DI) S3 added validations + CI Stabilize (#26452)
false
Cypress | (DI) S3 added validations + CI Stabilize (#26452)
test
diff --git a/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts index 66a0adbe592e..0a46d4af6861 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts @@ -285,8 +285,9 @@ describe("Autocomplete tests", () => { cy.get(locators._codeMirrorTextArea) .eq(0) .focus() + .wait(200) .type( - "{downArrow}{downArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}", + "{downArrow}{downArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}", ) .type("."); diff --git a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MongoURI_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MongoURI_Spec.ts index b175a2010f6c..f1821e6d7417 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MongoURI_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MongoURI_Spec.ts @@ -93,7 +93,7 @@ describe("Validate Mongo URI CRUD with JSON Form", () => { agHelper.ClickButton("Update"); agHelper.AssertElementAbsence(locators._toastMsg); //Validating fix for Bug 14063 - table.ReadTableRowColumnData(8, 8, "v1", 200).then(($cellData) => { + table.ReadTableRowColumnData(8, 8, "v1", 2000).then(($cellData) => { expect($cellData).to.eq( "Write Your Story with Elegance: The Pen of Choice!", ); diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts index 5fc54aecae8d..294e4d391afe 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts @@ -12,8 +12,7 @@ let datasourceName: any, jsName: any; describe("JSObjects OnLoad Actions tests", function () { before(() => { - homePage.NavigateToHome(); - homePage.CreateNewWorkspace("JSOnLoadTest"); + homePage.CreateNewWorkspace("JSOnLoadTest", true); }); it("1. Tc #58 Verify JSOnPageload with ConfirmBefore calling - while imported", () => { diff --git a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js index 4b14ca14c332..1802ecb7e6e7 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js +++ b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js @@ -9,6 +9,8 @@ import { entityExplorer, dataSources, entityItems, + draggableWidgets, + propPane, } from "../../../../support/Objects/ObjectsCore"; let datasourceName; @@ -39,20 +41,15 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", // }); before("Creates a new Amazon S3 datasource", function () { - cy.NavigateToDatasourceEditor(); - cy.get(datasource.AmazonS3).click({ force: true }).wait(1000); - - cy.generateUUID().then((uid) => { - datasourceName = `S3 CRUD ds ${uid}`; - cy.renameDatasource(datasourceName); - cy.wrap(datasourceName).as("dSName"); - cy.fillAmazonS3DatasourceForm(); - cy.testSaveDatasource(); - entityExplorer.ExpandCollapseEntity(datasourceName, false); + dataSources.CreateDataSource("S3"); + cy.get("@dsName").then((dsName) => { + datasourceName = dsName; }); }); - it("1. Validate List Files in bucket (all existing files) command, run and then delete the query", () => { + it("1. Validate List Files in bucket (all existing files) command, run + Widget Binding", () => { + entityExplorer.DragDropWidgetNVerify(draggableWidgets.INPUT_V2); + propPane.UpdatePropertyFieldValue("Default value", "AutoTest"); cy.NavigateToActiveDSQueryPane(datasourceName); dataSources.ValidateNSelectDropdown("Commands", "List files in bucket"); dataSources.RunQuery({ toValidateResponse: false }); @@ -62,8 +59,8 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", "Mandatory parameter 'Bucket name' is missing.", ); }); + agHelper.UpdateCodeInput(formControls.s3BucketName, "{{Input1.text}}"); //Widget Binding - cy.typeValueNValidate("AutoTest", formControls.s3BucketName); dataSources.RunQuery({ toValidateResponse: false }); cy.wait(3000); //for new postExecute to come thru cy.wait("@postExecute").then(({ response }) => { diff --git a/app/client/cypress/e2e/Sanity/Datasources/Arango_Basic_Spec.ts b/app/client/cypress/e2e/Sanity/Datasources/Arango_Basic_Spec.ts index 4ad2cc4ff487..1fb31194fc82 100644 --- a/app/client/cypress/e2e/Sanity/Datasources/Arango_Basic_Spec.ts +++ b/app/client/cypress/e2e/Sanity/Datasources/Arango_Basic_Spec.ts @@ -7,6 +7,7 @@ import { propPane, dataManager, locators, + homePage, } from "../../../support/Objects/ObjectsCore"; import { Widgets } from "../../../support/Pages/DataSources"; import { featureFlagIntercept } from "../../../support/Objects/FeatureFlags"; @@ -17,6 +18,8 @@ describe("Validate Arango & CURL Import Datasources", () => { containerName = "arangodb"; before("Create a new Arango DS", () => { dataSources.StartContainerNVerify("Arango", containerName, 20000); + homePage.CreateNewWorkspace("ArangoDS", true); + homePage.CreateAppInWorkspace("ArangoDS", "ArangoDSApp"); dataSources.CreateDataSource("ArangoDB"); cy.get("@dsName").then(($dsName) => { dsName = $dsName; @@ -337,11 +340,12 @@ describe("Validate Arango & CURL Import Datasources", () => { action: "Delete", entityType: entityItems.Api, }); //Deleting api created + entityExplorer.ExpandCollapseEntity(dsName); entityExplorer.ActionContextMenuByEntityName({ entityNameinLeftSidebar: dsName, action: "Refresh", - }); //needed for the deltion of ds to reflect + }); //needed for the deletion of ds to reflect agHelper.AssertElementVisibility(dataSources._noSchemaAvailable(dsName)); //Deleting datasource finally dataSources.DeleteDatasouceFromActiveTab(dsName); diff --git a/app/client/cypress/support/AdminSettingsCommands.js b/app/client/cypress/support/AdminSettingsCommands.js index b79bffc1d3dc..aa6ac0c4cdd4 100644 --- a/app/client/cypress/support/AdminSettingsCommands.js +++ b/app/client/cypress/support/AdminSettingsCommands.js @@ -73,9 +73,10 @@ Cypress.Commands.add("waitForServerRestart", () => { cy.get(adminSettings.restartNotice).should("be.visible"); // Wait for restart notice to not be visible with a timeout // Cannot use cy.get as mentioned in https://github.com/NoriSte/cypress-wait-until/issues/75#issuecomment-572685623 - cy.waitUntil(() => !Cypress.$(adminSettings.restartNotice).length, { - timeout: 180000, - }); + // cy.waitUntil(() => !Cypress.$(adminSettings.restartNotice).length, { + // timeout: 180000, + // }); + cy.get(adminSettings.restartNotice, { timeout: 210000 }).should("not.exist"); cy.window().then((win) => { win.location.reload(); });
11f8684e7f4a3dcfb56caacc89c7c8b93bc4a99e
2022-07-01 10:56:57
Favour Ohanekwu
fix: prevent temporary update of sub-path value in store object (#14847)
false
prevent temporary update of sub-path value in store object (#14847)
fix
diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/CommunityIssues_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/Application/CommunityIssues_Spec.ts index 92d14110d81b..465ecda98daa 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/CommunityIssues_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/CommunityIssues_Spec.ts @@ -119,7 +119,7 @@ describe("AForce - Community Issues page validations", function() { }); it("4. Change Default selected row in table and verify", () => { - jsEditor.EnterJSContext("Default Selected Row", "1"); + propPane.UpdatePropertyFieldValue("Default Selected Row", "1"); deployMode.DeployApp(); table.WaitUntilTableLoad(); table.AssertPageNumber(1); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/StoreValue_spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/StoreValue_spec.ts index d5eefb330263..a4cb0862bcc0 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/StoreValue_spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/StoreValue_spec.ts @@ -1,15 +1,23 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; -const { AggregateHelper: agHelper, JSEditor: jsEditor } = ObjectsRegistry; +const { + AggregateHelper: agHelper, + EntityExplorer: ee, + JSEditor: jsEditor, + CommonLocators: locator, + DeployMode: deployMode, + PropertyPane: propPane, +} = ObjectsRegistry; describe("storeValue Action test", () => { before(() => { - // + ee.DragDropWidgetNVerify("buttonwidget", 100, 100); + ee.NavigateToSwitcher("explorer"); }); it("1. Bug 14653: Running consecutive storeValue actions and await", function() { const jsObjectBody = `export default { - myFun1: () => { + storeTest: () => { let values = [ storeValue('val1', 'number 1'), @@ -33,15 +41,162 @@ describe("storeValue Action test", () => { toRun: false, shouldCreateNewJSObj: true, }); - agHelper.WaitUntilToastDisappear('created successfully') - agHelper.GetNClick(jsEditor._runButton); - agHelper.ValidateToastMessage( + + ee.SelectEntityByName("Button1", "WIDGETS"); + propPane.UpdatePropertyFieldValue("Label", "StoreTest"); + cy.get("@jsObjName").then((jsObj: any) => { + propPane.SelectJSFunctionToExecute( + "onClick", + jsObj as string, + "storeTest", + ); + }); + + deployMode.DeployApp(); + agHelper.ClickButton("StoreTest"); + agHelper.WaitUntilToastDisappear( JSON.stringify({ val1: "number 1", val2: "number 2", val3: "number 3", val4: "number 4", - }), 2 + }), + ); + deployMode.NavigateBacktoEditor(); + }); + + it("2. Bug 14827 : Accepts paths as keys and doesn't update paths in store but creates a new field with path as key", function() { + const DEFAULT_STUDENT_OBJECT = { + details: { isTopper: true, name: "Abhah", grade: 1 }, + }; + const MODIFIED_STUDENT_OBJECT = { + details: { isTopper: false, name: "Alia", grade: 3 }, + }; + const JS_OBJECT_BODY = `export default { + storePathTest: async ()=> { + await storeValue("student", ${JSON.stringify( + DEFAULT_STUDENT_OBJECT, + )}, false) + await showAlert(JSON.stringify(appsmith.store.student)); + await storeValue("student.details.name", "Annah", false); + await showAlert(appsmith.store.student.details.name); + await showAlert(appsmith.store["student.details.name"]); + }, + modifyStorePathTest: async ()=>{ + await storeValue("student",${JSON.stringify( + MODIFIED_STUDENT_OBJECT, + )} , false) + await showAlert(JSON.stringify(appsmith.store.student)); + await storeValue("student.details.isTopper", true, false); + await showAlert(appsmith.store.student.details.isTopper.toString()); + await showAlert(appsmith.store["student.details.isTopper"].toString()); + } + } + `; + + // Create js object + jsEditor.CreateJSObject(JS_OBJECT_BODY, { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + }); + + // Button1 + ee.SelectEntityByName("Button1", "WIDGETS"); + propPane.UpdatePropertyFieldValue("Label", "StorePathTest"); + cy.get("@jsObjName").then((jsObj: any) => { + propPane.SelectJSFunctionToExecute( + "onClick", + jsObj as string, + "storePathTest", + ); + }); + + // Button 2 + ee.DragDropWidgetNVerify("buttonwidget", 100, 200); + ee.SelectEntityByName("Button2", "WIDGETS"); + propPane.UpdatePropertyFieldValue("Label", "modifyStorePathTest"); + cy.get("@jsObjName").then((jsObj: any) => { + propPane.SelectJSFunctionToExecute( + "onClick", + jsObj as string, + "modifyStorePathTest", + ); + }); + + deployMode.DeployApp(); + agHelper.ClickButton("StorePathTest"); + agHelper.ValidateToastMessage(JSON.stringify(DEFAULT_STUDENT_OBJECT), 0, 1); + agHelper.ValidateToastMessage(DEFAULT_STUDENT_OBJECT.details.name, 1, 2); + agHelper.WaitUntilToastDisappear("Annah", 2, 3); + + agHelper.ClickButton("modifyStorePathTest"); + agHelper.ValidateToastMessage( + JSON.stringify(MODIFIED_STUDENT_OBJECT.details), + 0, + 1, + ); + agHelper.ValidateToastMessage( + `${MODIFIED_STUDENT_OBJECT.details.isTopper}`, + 1, + 2, ); + agHelper.WaitUntilToastDisappear(`true`, 2, 3); + deployMode.NavigateBacktoEditor(); + }); + + it("3. Bug 14827 : Accepts paths as keys and doesn't update paths in store but creates a new field with path as key - object keys", function() { + const TEST_OBJECT = { a: 1, two: {} }; + + const JS_OBJECT_BODY = `export default { + setStore: async () => { + await storeValue("test", ${JSON.stringify(TEST_OBJECT)}, false); + await showAlert(JSON.stringify(appsmith.store.test)); + await storeValue("test.two",{"b":2}, false); + await showAlert(JSON.stringify(appsmith.store.test.two)); + await showAlert(JSON.stringify(appsmith.store["test.two"])); + }, + showStore: () => { + showAlert(JSON.stringify(appsmith.store.test));} + }`; + + // create js object + jsEditor.CreateJSObject(JS_OBJECT_BODY, { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + }); + + ee.SelectEntityByName("Button1", "WIDGETS"); + propPane.UpdatePropertyFieldValue("Label", "SetStore"); + cy.get("@jsObjName").then((jsObj: any) => { + propPane.SelectJSFunctionToExecute( + "onClick", + jsObj as string, + "setStore", + ); + }); + + ee.SelectEntityByName("Button2", "WIDGETS"); + propPane.UpdatePropertyFieldValue("Label", "ShowStore"); + cy.get("@jsObjName").then((jsObj: any) => { + propPane.SelectJSFunctionToExecute( + "onClick", + jsObj as string, + "showStore", + ); + }); + + deployMode.DeployApp(); + agHelper.ClickButton("SetStore"); + agHelper.ValidateToastMessage(JSON.stringify(TEST_OBJECT), 0, 1); + agHelper.ValidateToastMessage(JSON.stringify(TEST_OBJECT.two), 1, 2); + agHelper.WaitUntilToastDisappear(`{"b":2}`, 2, 3); + + agHelper.ClickButton("ShowStore"); + agHelper.ValidateToastMessage(JSON.stringify(TEST_OBJECT), 0); + deployMode.NavigateBacktoEditor(); }); }); 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 5cf68691ead1..7986b2d8cb4f 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 @@ -4,7 +4,8 @@ let agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, jsEditor = ObjectsRegistry.JSEditor, locator = ObjectsRegistry.CommonLocators, - deployMode = ObjectsRegistry.DeployMode; + deployMode = ObjectsRegistry.DeployMode, + propPane = ObjectsRegistry.PropertyPane; describe("Validate JSObjects binding to Input widget", () => { before(() => { @@ -40,7 +41,7 @@ describe("Validate JSObjects binding to Input widget", () => { .should("equal", "Hello"); //Before mapping JSObject value of input cy.get("@jsObjName").then((jsObjName) => { jsOjbNameReceived = jsObjName; - jsEditor.EnterJSContext("Default Text", "{{" + jsObjName + ".myFun1()}}"); + propPane.UpdatePropertyFieldValue("Default Text", "{{" + jsObjName + ".myFun1()}}"); }); cy.get(locator._inputWidget) .last() diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToListWidget_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToListWidget_Spec.ts index ca3cacf7ba5d..160fecdcc858 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToListWidget_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToListWidget_Spec.ts @@ -7,7 +7,8 @@ let agHelper = ObjectsRegistry.AggregateHelper, locator = ObjectsRegistry.CommonLocators, apiPage = ObjectsRegistry.ApiPage, table = ObjectsRegistry.Table, - deployMode = ObjectsRegistry.DeployMode; + deployMode = ObjectsRegistry.DeployMode, + propPane = ObjectsRegistry.PropertyPane; describe("Validate JSObj binding to Table widget", () => { before(() => { @@ -43,7 +44,7 @@ describe("Validate JSObj binding to Table widget", () => { it("2. Validate the Api data is updated on List widget + Bug 12438", function() { ee.SelectEntityByName("List1", "WIDGETS"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Items", (("{{" + jsName) as string) + ".myFun1()}}", ); @@ -75,7 +76,7 @@ describe("Validate JSObj binding to Table widget", () => { it("3. Validate the List widget + Bug 12438 ", function() { ee.SelectEntityByName("List1", "WIDGETS"); - jsEditor.EnterJSContext("Item Spacing (px)", "50"); + propPane.UpdatePropertyFieldValue("Item Spacing (px)", "50"); cy.get(locator._textWidget).should("have.length", 6); deployMode.DeployApp(locator._textWidgetInDeployed); agHelper.AssertElementLength(locator._textWidgetInDeployed, 6); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/LoadashBasic_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/LoadashBasic_Spec.ts index 243653d59e8a..bb23a9446c68 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/LoadashBasic_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/LoadashBasic_Spec.ts @@ -3,7 +3,7 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry" let dataSet: any; let agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor, + propPane = ObjectsRegistry.PropertyPane, locator = ObjectsRegistry.CommonLocators, deployMode = ObjectsRegistry.DeployMode; @@ -21,13 +21,13 @@ describe("Loadash basic test with input Widget", () => { it("1. Input widget test with default value for atob method", () => { ee.SelectEntityByName("Input1", 'WIDGETS') - jsEditor.EnterJSContext("Default Text", dataSet.defaultInputBinding + "}}"); + propPane.UpdatePropertyFieldValue("Default Text", dataSet.defaultInputBinding + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') }); it("2. Input widget test with default value for btoa method", function () { ee.SelectEntityByName("Input2") - jsEditor.EnterJSContext("Default Text", dataSet.loadashInput + "}}"); + propPane.UpdatePropertyFieldValue("Default Text", dataSet.loadashInput + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts index 121babd0f059..5fe8c145e408 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts @@ -3,7 +3,7 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry" let dataSet: any; let agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor, + propPane = ObjectsRegistry.PropertyPane, locator = ObjectsRegistry.CommonLocators, deployMode = ObjectsRegistry.DeployMode; @@ -21,13 +21,13 @@ describe("Validate basic binding of Input widget to Input widget", () => { it("1. Input widget test with default value from another Input widget", () => { ee.SelectEntityByName("Input1", 'WIDGETS') - jsEditor.EnterJSContext("Default Text", dataSet.defaultInputBinding + "}}"); + propPane.UpdatePropertyFieldValue("Default Text", dataSet.defaultInputBinding + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') }); it("2. Binding second input widget with first input widget and validating", function () { ee.SelectEntityByName("Input2") - jsEditor.EnterJSContext("Default Text", dataSet.momentInput + "}}"); + propPane.UpdatePropertyFieldValue("Default Text", dataSet.momentInput + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') }); 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 b7b17579935d..e89b5eda8804 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 @@ -5,7 +5,8 @@ let agHelper = ObjectsRegistry.AggregateHelper, jsEditor = ObjectsRegistry.JSEditor, locator = ObjectsRegistry.CommonLocators, apiPage = ObjectsRegistry.ApiPage, - deployMode = ObjectsRegistry.DeployMode; + deployMode = ObjectsRegistry.DeployMode, + propPane = ObjectsRegistry.PropertyPane; describe("Validate basic Promises", () => { it("1. Verify storeValue via .then via direct Promises", () => { @@ -111,7 +112,7 @@ describe("Validate basic Promises", () => { true, ); ee.SelectEntityByName("Image1"); - jsEditor.EnterJSContext("Image", `{{Christmas.data}}`, true); + propPane.UpdatePropertyFieldValue("Image", `{{Christmas.data}}`); agHelper.ValidateToastMessage( "will be executed automatically on page load", ); @@ -184,7 +185,7 @@ return InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + us "GetAnime", ); ee.SelectEntityByName("List1", "WIDGETS"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Items", `[{ "name": {{ GetAnime.data.results[0].title }}, @@ -200,9 +201,7 @@ return InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + us "name": {{ GetAnime.data.results[2].title }}, "img": {{ GetAnime.data.results[2].image_url }}, "synopsis": {{ GetAnime.data.results[2].synopsis }} -}]`, - true, - ); +}]`); agHelper.ValidateToastMessage( "will be executed automatically on page load", ); //Validating 'Run API on Page Load' is set once api response is mapped diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/aTobAndbToaBasic_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/aTobAndbToaBasic_Spec.ts index 10ad6a52483b..0503b464c13e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/aTobAndbToaBasic_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/aTobAndbToaBasic_Spec.ts @@ -3,7 +3,7 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry" let dataSet: any; let agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor, + propPane = ObjectsRegistry.PropertyPane, locator = ObjectsRegistry.CommonLocators, deployMode = ObjectsRegistry.DeployMode; @@ -21,14 +21,14 @@ describe("Validate basic binding of Input widget to Input widget", () => { it("1. Input widget test with default value for atob method", () => { ee.SelectEntityByName("Input1", 'WIDGETS') - jsEditor.EnterJSContext("Default Text", dataSet.atobInput + "}}"); + propPane.UpdatePropertyFieldValue("Default Text", dataSet.atobInput + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') cy.get(locator._inputWidget).first().invoke("attr", "value").should("equal", 'A');//Before mapping JSObject value of input }); it("2. Input widget test with default value for btoa method", function () { ee.SelectEntityByName("Input2") - jsEditor.EnterJSContext("Default Text", dataSet.btoaInput + "}}"); + propPane.UpdatePropertyFieldValue("Default Text", dataSet.btoaInput + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') cy.get(locator._inputWidget).last().invoke("attr", "value").should("equal", 'QQ==');//Before mapping JSObject value of input }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug14299_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug14299_Spec.ts index eb5243e83927..e3155cae5f8b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug14299_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Bug14299_Spec.ts @@ -56,16 +56,16 @@ describe("[Bug]: The data from the query does not show up on the widget #14299", ); ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("Table Data", `{{JSObject1.runAstros.data}}`); + propPane.UpdatePropertyFieldValue("Table Data", `{{JSObject1.runAstros.data}}`); ee.SelectEntityByName("DatePicker1"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Default Date", `{{moment(Table1.selectedRow.date_of_death)}}`, ); ee.SelectEntityByName("Text1"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Text", `Date: {{moment(Table1.selectedRow.date_of_death).toString()}}`, ); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/ChartDataPoint_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/ChartDataPoint_Spec.ts index 5f1c19153e00..bc55c1eea0cf 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/ChartDataPoint_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/ChartDataPoint_Spec.ts @@ -3,7 +3,7 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry" let dataSet: any, dsl: any; let agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor, + propPane = ObjectsRegistry.PropertyPane, locator = ObjectsRegistry.CommonLocators, deployMode = ObjectsRegistry.DeployMode; @@ -22,13 +22,13 @@ describe("Input widget test with default value from chart datapoint", () => { it("1. Chart widget - Input widget test with default value from another Input widget", () => { ee.SelectEntityByName("Input1", 'WIDGETS') - jsEditor.EnterJSContext("Default Text", dataSet.bindChartData + "}}"); + propPane.UpdatePropertyFieldValue("Default Text", dataSet.bindChartData + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') ee.SelectEntityByName("Chart1") agHelper.SelectPropertiesDropDown("ondatapointclick", "Show message") agHelper.EnterActionValue("Message", dataSet.bindingDataPoint) ee.SelectEntityByName("Input2") - jsEditor.EnterJSContext("Default Text", dataSet.bindingSeriesTitle + "}}"); + propPane.UpdatePropertyFieldValue("Default Text", dataSet.bindingSeriesTitle + "}}"); deployMode.DeployApp() agHelper.Sleep(1500)//waiting for chart to load! agHelper.GetNClick("//*[local-name()='rect']", 13) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableBugs_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableBugs_Spec.ts index 701c72068662..78925817b7dc 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableBugs_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableBugs_Spec.ts @@ -3,7 +3,7 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; let dataSet: any; const agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor, + propPane = ObjectsRegistry.PropertyPane, table = ObjectsRegistry.Table, deployMode = ObjectsRegistry.DeployMode; @@ -16,16 +16,15 @@ describe("Verify various Table property bugs", function () { it("1. Adding Data to Table Widget", function () { ee.DragDropWidgetNVerify("tablewidget", 250, 250); - jsEditor.EnterJSContext("Table Data", JSON.stringify(dataSet.TableURLColumnType)); + propPane.UpdatePropertyFieldValue("Table Data", JSON.stringify(dataSet.TableURLColumnType)); agHelper.ValidateNetworkStatus("@updateLayout", 200); cy.get('body').type("{esc}"); }); it("2. Bug 13299 - Verify Display Text does not contain garbage value for URL column type when empty", function () { table.ChangeColumnType('image', 'URL') - jsEditor.EnterJSContext("Display Text", - `{{currentRow.image.toString().includes('7') ? currentRow.image.toString().split('full/')[1] : "" }}`, - true) + propPane.UpdatePropertyFieldValue("Display Text", + `{{currentRow.image.toString().includes('7') ? currentRow.image.toString().split('full/')[1] : "" }}`) deployMode.DeployApp() @@ -58,9 +57,8 @@ describe("Verify various Table property bugs", function () { ee.SelectEntityByName("Table1", 'WIDGETS') agHelper.GetNClick(table._columnSettings('image')) - jsEditor.EnterJSContext("Display Text", - `{{currentRow.image.toString().includes('7') ? currentRow.image.toString().split('full/')[1] : null }}`, - true) + propPane.UpdatePropertyFieldValue("Display Text", + `{{currentRow.image.toString().includes('7') ? currentRow.image.toString().split('full/')[1] : null }}`) deployMode.DeployApp() @@ -91,9 +89,8 @@ describe("Verify various Table property bugs", function () { ee.SelectEntityByName("Table1", 'WIDGETS') agHelper.GetNClick(table._columnSettings('image')) - jsEditor.EnterJSContext("Display Text", - `{{currentRow.image.toString().includes('7') ? currentRow.image.toString().split('full/')[1] : undefined }}`, - true) + propPane.UpdatePropertyFieldValue("Display Text", + `{{currentRow.image.toString().includes('7') ? currentRow.image.toString().split('full/')[1] : undefined }}`) deployMode.DeployApp() diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableFilter_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableFilter_Spec.ts index b408b94b66d9..1dc81a44c16d 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableFilter_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/TableFilter_Spec.ts @@ -3,7 +3,7 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; let dataSet: any; const agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor, + propPane = ObjectsRegistry.PropertyPane, table = ObjectsRegistry.Table, homePage = ObjectsRegistry.HomePage, deployMode = ObjectsRegistry.DeployMode; @@ -17,7 +17,7 @@ describe("Verify various Table_Filter combinations", function () { it("1. Adding Data to Table Widget", function () { ee.DragDropWidgetNVerify("tablewidget", 250, 250); - jsEditor.EnterJSContext("Table Data", JSON.stringify(dataSet.TableInput)); + propPane.UpdatePropertyFieldValue("Table Data", JSON.stringify(dataSet.TableInput)); agHelper.ValidateNetworkStatus("@updateLayout", 200); cy.get('body').type("{esc}"); deployMode.DeployApp() diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_MultiPart_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_MultiPart_Spec.ts index a5bd7412c441..56b8900c9c22 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_MultiPart_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiTests/API_MultiPart_Spec.ts @@ -5,7 +5,8 @@ let agHelper = ObjectsRegistry.AggregateHelper, jsEditor = ObjectsRegistry.JSEditor, apiPage = ObjectsRegistry.ApiPage, locator = ObjectsRegistry.CommonLocators, - deployMode = ObjectsRegistry.DeployMode; + deployMode = ObjectsRegistry.DeployMode, + propPane = ObjectsRegistry.PropertyPane; describe("Validate API request body panel", () => { it("1. Check whether input and type dropdown selector exist when multi-part is selected", () => { @@ -127,7 +128,7 @@ describe("Validate API request body panel", () => { ); ee.SelectEntityByName("Image1"); - jsEditor.EnterJSContext("Image", "{{CloudinaryUploadApi.data.url}}"); + propPane.UpdatePropertyFieldValue("Image", "{{CloudinaryUploadApi.data.url}}"); ee.SelectEntityByName("CloudinaryUploadApi", "QUERIES/JS"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/MySQL_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/MySQL_Spec.ts index aee89216d5e1..8f130cb5a5e5 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/MySQL_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/MySQL_Spec.ts @@ -9,8 +9,7 @@ let agHelper = ObjectsRegistry.AggregateHelper, homePage = ObjectsRegistry.HomePage, dataSources = ObjectsRegistry.DataSources, propPane = ObjectsRegistry.PropertyPane, - deployMode = ObjectsRegistry.DeployMode, - jsEditor = ObjectsRegistry.JSEditor; + deployMode = ObjectsRegistry.DeployMode; describe("Validate MySQL Generate CRUD with JSON Form", () => { before(() => { @@ -693,7 +692,7 @@ describe("Validate MySQL Generate CRUD with JSON Form", () => { function updatingStoreJSONPropertyFileds() { propPane.ChangeJsonFormFieldType("Store Status", "Radio Group"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Options", `[{ "label": "Active", diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/Postgres_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/Postgres_Spec.ts index 2e336d1cd51a..34c9e9942840 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/Postgres_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/Postgres_Spec.ts @@ -9,8 +9,7 @@ let agHelper = ObjectsRegistry.AggregateHelper, homePage = ObjectsRegistry.HomePage, dataSources = ObjectsRegistry.DataSources, propPane = ObjectsRegistry.PropertyPane, - deployMode = ObjectsRegistry.DeployMode, - jsEditor = ObjectsRegistry.JSEditor; + deployMode = ObjectsRegistry.DeployMode; describe("Validate Postgres Generate CRUD with JSON Form", () => { before(() => { @@ -803,7 +802,7 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => { propPane.NavigateBackToPropertyPane(); propPane.ChangeJsonFormFieldType("Vessel Type", "Select"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Options", `{{["Cargo", "Pleasure Craft", "Passenger", "Fishing", "Special Craft"].map(item=> {return { label: item, @@ -813,9 +812,9 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => { propPane.NavigateBackToPropertyPane(); propPane.OpenJsonFormFieldSettings("Timezone"); - jsEditor.EnterJSContext("Min", "-10"); - jsEditor.EnterJSContext("Max", "10"); - jsEditor.EnterJSContext("Error Message", "Not a valid timezone!"); + propPane.UpdatePropertyFieldValue("Min", "-10"); + propPane.UpdatePropertyFieldValue("Max", "10"); + propPane.UpdatePropertyFieldValue("Error Message", "Not a valid timezone!"); propPane.NavigateBackToPropertyPane(); propPane.ChangeJsonFormFieldType("Eta Updated", "Datepicker"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/JSFunctionExecution_spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/JSFunctionExecution_spec.ts index 08c9d5fe5a44..604996c0b408 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/JSFunctionExecution_spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/JsFunctionExecution/JSFunctionExecution_spec.ts @@ -6,7 +6,8 @@ const jsEditor = ObjectsRegistry.JSEditor, ee = ObjectsRegistry.EntityExplorer, table = ObjectsRegistry.Table, agHelper = ObjectsRegistry.AggregateHelper, - deployMode = ObjectsRegistry.DeployMode; + deployMode = ObjectsRegistry.DeployMode, + propPane = ObjectsRegistry.PropertyPane; let onPageLoadAndConfirmExecuteFunctionsLength: number, getJSObject: any, @@ -172,9 +173,8 @@ describe("JS Function Execution", function() { toRun: false, shouldCreateNewJSObj: true, }); - // Assert presence of toast message - agHelper.ValidateToastMessage(invalidJSObjectStartToastMessage); + agHelper.WaitUntilToastDisappear(invalidJSObjectStartToastMessage); // Assert presence of lint error at the start line cy.get(locator._lintErrorElement) @@ -283,7 +283,7 @@ describe("JS Function Execution", function() { cy.get("@jsObjName").then((jsObjName) => { ee.SelectEntityByName("Table1", "WIDGETS"); - jsEditor.EnterJSContext("Table Data", `{{${jsObjName}.largeData}}`); + propPane.UpdatePropertyFieldValue("Table Data", `{{${jsObjName}.largeData}}`); }); // Deploy App and test that table loads properly @@ -338,7 +338,6 @@ describe("JS Function Execution", function() { toRun: false, shouldCreateNewJSObj: true, }); - agHelper.WaitUntilToastDisappear("created successfully"); // change sync function name and test that cyclic dependency is not created jsEditor.EditJSObj(syncJSCodeWithRenamedFunction1); @@ -352,7 +351,6 @@ describe("JS Function Execution", function() { toRun: false, shouldCreateNewJSObj: true, }); - agHelper.WaitUntilToastDisappear("created successfully"); // change async function name and test that cyclic dependency is not created jsEditor.EditJSObj(asyncJSCodeWithRenamedFunction1); agHelper.AssertElementAbsence(locator._toastMsg); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_Spec.ts index 56e0cb9e770c..b9869870de49 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_Spec.ts @@ -9,7 +9,8 @@ const agHelper = ObjectsRegistry.AggregateHelper, locator = ObjectsRegistry.CommonLocators, homePage = ObjectsRegistry.HomePage, apiPage = ObjectsRegistry.ApiPage, - deployMode = ObjectsRegistry.DeployMode; + deployMode = ObjectsRegistry.DeployMode, + propPane = ObjectsRegistry.PropertyPane; describe("JSObjects OnLoad Actions tests", function() { before(() => { @@ -55,7 +56,7 @@ describe("JSObjects OnLoad Actions tests", function() { ".getId.data}}", ); ee.SelectEntityByName("Table1", "WIDGETS"); - jsEditor.EnterJSContext("Table Data", "{{GetUser.data}}"); + propPane.UpdatePropertyFieldValue("Table Data", "{{GetUser.data}}"); agHelper.ValidateToastMessage( (("[" + jsName) as string) + ".getId, GetUser] will be executed automatically on page load", @@ -275,7 +276,7 @@ describe("JSObjects OnLoad Actions tests", function() { // cy.get(locator._toastMsg).contains(regex) ee.SelectEntityByName("Input1", "WIDGETS"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Default Text", "{{" + jsObjName + ".callQuotes.data}}", ); @@ -285,12 +286,14 @@ describe("JSObjects OnLoad Actions tests", function() { .and("contain", jsName as string) .and("contain", "will be executed automatically on page load"); + agHelper.WaitUntilToastDisappear("Quotes"); + ee.SelectEntityByName("Input2"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Default Text", "{{" + jsObjName + ".callTrump.data.message}}", ); - agHelper.ValidateToastMessage( + agHelper.WaitUntilToastDisappear( (("[" + jsName) as string) + ".callTrump] will be executed automatically on page load", ); @@ -300,19 +303,19 @@ describe("JSObjects OnLoad Actions tests", function() { //One Quotes confirmation - for API true agHelper.AssertElementVisible(jsEditor._dialogBody("Quotes")); agHelper.ClickButton("No"); - agHelper.ValidateToastMessage('The action "Quotes" has failed'); + agHelper.WaitUntilToastDisappear('The action "Quotes" has failed'); //Another for API called via JS callQuotes() agHelper.AssertElementVisible(jsEditor._dialogBody("Quotes")); agHelper.ClickButton("No"); - agHelper.ValidateToastMessage('The action "Quotes" has failed'); + //agHelper.WaitUntilToastDisappear('The action "Quotes" has failed');No toast appears! //Confirmation - first JSObj then API agHelper.AssertElementVisible( jsEditor._dialogBody((jsName as string) + ".callTrump"), ); agHelper.ClickButton("No"); - agHelper.ValidateToastMessage( + agHelper.WaitUntilToastDisappear( "Failed to execute actions during page load", ); //When Confirmation is NO validate error toast! agHelper.AssertElementAbsence(jsEditor._dialogBody("WhatTrumpThinks")); //Since JS call is NO, dependent API confirmation should not appear @@ -468,7 +471,7 @@ describe("JSObjects OnLoad Actions tests", function() { //jsEditor.EnableDisableAsyncFuncSettings("callCountry", false, true); Bug # 13826 ee.SelectEntityByName("Select1", "WIDGETS"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Options", `{{ getCitiesList.data.map((row) => { return { label: row.city, value: row.city } @@ -505,7 +508,7 @@ describe("JSObjects OnLoad Actions tests", function() { // agHelper.GetNClick(locator._dropDownValue("callBooks")); ee.SelectEntityByName("JSONForm1"); - jsEditor.EnterJSContext("Source Data", "{{getBooks.data}}"); + propPane.UpdatePropertyFieldValue("Source Data", "{{getBooks.data}}"); //this toast is not coming due to existing JSON date errors but its made true at API //agHelper.ValidateToastMessage("[getBooks] will be executed automatically on page load"); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts index 92a0efaf09ce..e84a326c6eab 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/OnLoadActions_Spec.ts @@ -4,7 +4,7 @@ let dsl: any; const agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, apiPage = ObjectsRegistry.ApiPage, - jsEditor = ObjectsRegistry.JSEditor, + propPane = ObjectsRegistry.PropertyPane, locator = ObjectsRegistry.CommonLocators, deployMode = ObjectsRegistry.DeployMode; @@ -63,28 +63,22 @@ describe("Layout OnLoad Actions tests", function() { //Adding dependency in right order matters! ee.ExpandCollapseEntity("WIDGETS"); ee.SelectEntityByName("Image1"); - jsEditor.EnterJSContext("Image", `{{RandomFlora.data}}`, true); + propPane.UpdatePropertyFieldValue("Image", `{{RandomFlora.data}}`); ee.SelectEntityByName("Image2"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Image", - `{{RandomUser.data.results[0].picture.large}}`, - true, - ); + `{{RandomUser.data.results[0].picture.large}}`); ee.SelectEntityByName("Text1"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Text", - `{{InspiringQuotes.data.quote.body}}\n--\n{{InspiringQuotes.data.quote.author}}\n`, - true, - ); + `{{InspiringQuotes.data.quote.body}}\n--\n{{InspiringQuotes.data.quote.author}}\n`); ee.SelectEntityByName("Text2"); - jsEditor.EnterJSContext( + propPane.UpdatePropertyFieldValue( "Text", - `Hi, here is {{RandomUser.data.results[0].name.first}} & I'm {{RandomUser.data.results[0].dob.age}}'yo\nI live in {{RandomUser.data.results[0].location.country}}\nMy Suggestion : {{Suggestions.data.activity}}\n\nI'm {{Genderize.data.gender}}`, - true, - ); + `Hi, here is {{RandomUser.data.results[0].name.first}} & I'm {{RandomUser.data.results[0].dob.age}}'yo\nI live in {{RandomUser.data.results[0].location.country}}\nMy Suggestion : {{Suggestions.data.activity}}\n\nI'm {{Genderize.data.gender}}`); // cy.url().then((url) => { // const pageid = url.split("/")[4]?.split("-").pop(); 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 6f331b6ee158..935ed012cd81 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 @@ -8,7 +8,8 @@ let agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, table = ObjectsRegistry.Table, apiPage = ObjectsRegistry.ApiPage, - deployMode = ObjectsRegistry.DeployMode; + deployMode = ObjectsRegistry.DeployMode, + propPane = ObjectsRegistry.PropertyPane; describe("[Bug] - 10784 - Passing params from JS to SQL query should not break", () => { before(() => { @@ -54,7 +55,7 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break", ); }); ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("Table Data", "{{ParamsTest.data}}"); + propPane.UpdatePropertyFieldValue("Table Data", "{{ParamsTest.data}}"); ee.SelectEntityByName("ParamsTest", "QUERIES/JS"); apiPage.ToggleOnPageLoadRun(false); //Bug 12476 diff --git a/app/client/cypress/support/Objects/CommonLocators.ts b/app/client/cypress/support/Objects/CommonLocators.ts index a3fa5b68fe8a..ba88de4efefd 100644 --- a/app/client/cypress/support/Objects/CommonLocators.ts +++ b/app/client/cypress/support/Objects/CommonLocators.ts @@ -45,7 +45,7 @@ export class CommonLocators { _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" - _selectPropDropdown = (ddName: string) => "//div[contains(@class, 't--property-control-" + ddName + "')]//button[contains(@class, 't--open-dropdown-Select-Action')]" + _selectPropDropdown = (ddName: string) => "//div[contains(@class, 't--property-control-" + ddName.replace(/ +/g, "").toLowerCase() + "')]//button[contains(@class, 't--open-dropdown-Select-Action')]" _dropDownValue = (dropdownOption: string) => ".single-select:contains('" + dropdownOption + "')" _selectOptionValue = (dropdownOption: string) => ".menu-item-link:contains('" + dropdownOption + "')" _selectedDropdownValue = "//button[contains(@class, 'select-button')]/span[@class='bp3-button-text']" diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts index 785cf5717743..f8e035e8d06f 100644 --- a/app/client/cypress/support/Pages/AggregateHelper.ts +++ b/app/client/cypress/support/Pages/AggregateHelper.ts @@ -110,9 +110,10 @@ export class AggregateHelper { }); } - public ValidateToastMessage(text: string, length = 1) { + public ValidateToastMessage(text: string, index = 0, length = 1) { + cy.get(this.locator._toastMsg).should("have.length.at.least", length); cy.get(this.locator._toastMsg) - .should("have.length", length) + .eq(index) .should("contain.text", text); } @@ -138,7 +139,8 @@ export class AggregateHelper { }); } - public WaitUntilToastDisappear(msgToCheckforDisappearance: string | "") { + public WaitUntilToastDisappear(msgToCheckforDisappearance: string | "", index = 0 , length = 1) { + this.ValidateToastMessage(msgToCheckforDisappearance, index, length); cy.waitUntil(() => cy.get(this.locator._toastMsg), { errorMsg: msgToCheckforDisappearance + " did not disappear", timeout: 5000, @@ -511,6 +513,7 @@ export class AggregateHelper { if (action == "Delete") { !jsDelete && this.ValidateNetworkStatus("@deleteAction"); jsDelete && this.ValidateNetworkStatus("@deleteJSCollection"); + jsDelete && this.WaitUntilToastDisappear("deleted successfully"); } } @@ -528,14 +531,7 @@ export class AggregateHelper { options: IEnterValue = DEFAULT_ENTERVALUE_OPTIONS, ) { const { directInput, inputFieldName, propFieldName } = options; - - if (propFieldName && !directInput && !inputFieldName) { - cy.xpath(this.locator._existingFieldTextByName(propFieldName)).then( - ($field: any) => { - this.UpdateCodeInput($field, valueToEnter); - }, - ); - } else if (propFieldName && directInput && !inputFieldName) { + if (propFieldName && directInput && !inputFieldName) { cy.get(propFieldName).then(($field: any) => { this.UpdateCodeInput($field, valueToEnter); }); diff --git a/app/client/cypress/support/Pages/EntityExplorer.ts b/app/client/cypress/support/Pages/EntityExplorer.ts index ad812dae7b53..afcca542fd59 100644 --- a/app/client/cypress/support/Pages/EntityExplorer.ts +++ b/app/client/cypress/support/Pages/EntityExplorer.ts @@ -51,6 +51,7 @@ export class EntityExplorer { entityNameinLeftSidebar: string, section: "WIDGETS" | "QUERIES/JS" | "DATASOURCES" | "" = "", ) { + this.NavigateToSwitcher("explorer"); if (section) this.ExpandCollapseEntity(section); //to expand respective section cy.xpath(this._entityNameInExplorer(entityNameinLeftSidebar)) .last() diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts index f706c1889c0d..116184fdae2e 100644 --- a/app/client/cypress/support/Pages/JSEditor.ts +++ b/app/client/cypress/support/Pages/JSEditor.ts @@ -17,6 +17,7 @@ export class JSEditor { public agHelper = ObjectsRegistry.AggregateHelper; public locator = ObjectsRegistry.CommonLocators; public ee = ObjectsRegistry.EntityExplorer; + public propPane = ObjectsRegistry.PropertyPane; //#region Element locators _runButton = "button.run-js-action"; @@ -109,7 +110,7 @@ export class JSEditor { cy.get(this._jsObjTxt).should("not.exist"); //cy.waitUntil(() => cy.get(this.locator._toastMsg).should('not.be.visible')) // fails sometimes - //this.agHelper.WaitUntilToastDisappear('created successfully') + this.agHelper.WaitUntilToastDisappear("created successfully"); //to not hinder with other toast msgs! this.agHelper.Sleep(); } @@ -153,22 +154,19 @@ export class JSEditor { } else { input.type(JSCode, { parseSpecialCharSequences: false, - delay: 150, + delay: 100, force: true, }); } }); this.agHelper.AssertAutoSave(); //Ample wait due to open bug # 10284 - //this.agHelper.Sleep(5000)//Ample wait due to open bug # 10284 if (toRun) { - //clicking 1 times & waits for 3 second for result to be populated! + //clicking 1 times & waits for 2 second for result to be populated! Cypress._.times(1, () => { - cy.get(this._runButton) - .first() - .click() - .wait(3000); + this.agHelper.GetNClick(this._runButton); + this.agHelper.Sleep(2000); }); cy.get(this.locator._empty).should("not.exist"); } @@ -191,7 +189,6 @@ export class JSEditor { value: string, paste = true, toToggleOnJS = false, - notField = false, ) { if (toToggleOnJS) { cy.get(this.locator._jsToggle(endp.replace(/ +/g, "").toLowerCase())) @@ -216,11 +213,7 @@ export class JSEditor { // .type("{del}", { force: true }); if (paste) { - this.agHelper.EnterValue(value, { - propFieldName: endp, - directInput: notField, - inputFieldName: "", - }); + this.propPane.UpdatePropertyFieldValue(endp, value); } else { cy.get( this.locator._propertyControl + diff --git a/app/client/cypress/support/Pages/PropertyPane.ts b/app/client/cypress/support/Pages/PropertyPane.ts index 565813701a22..f120437f8906 100644 --- a/app/client/cypress/support/Pages/PropertyPane.ts +++ b/app/client/cypress/support/Pages/PropertyPane.ts @@ -19,7 +19,6 @@ type filedTypeValues = export class PropertyPane { private agHelper = ObjectsRegistry.AggregateHelper; - private jsEditor = ObjectsRegistry.JSEditor; private locator = ObjectsRegistry.CommonLocators; _fieldConfig = (fieldName: string) => @@ -72,7 +71,7 @@ export class PropertyPane { public ChangeTheme(newTheme: string) { this.agHelper.GetNClick(this._changeThemeBtn, 0, true); this.agHelper.GetNClick(this._themeCard(newTheme)); - this.agHelper.ValidateToastMessage("Theme " + newTheme + " Applied"); + this.agHelper.WaitUntilToastDisappear("Theme " + newTheme + " Applied"); } public ChangeColor( @@ -109,9 +108,9 @@ export class PropertyPane { .GetText(this.locator._existingActualValueByName("Property Name")) .then(($propName) => { placeHolderText = "{{sourceData." + $propName + "}}"; - this.jsEditor.EnterJSContext("Placeholder", placeHolderText); + this.UpdatePropertyFieldValue("Placeholder", placeHolderText); }); - this.jsEditor.EnterJSContext("Default Value", ""); + this.UpdatePropertyFieldValue("Default Value", ""); this.NavigateBackToPropertyPane(); }); } @@ -128,4 +127,22 @@ export class PropertyPane { } this.agHelper.AssertAutoSave(); } + + public SelectJSFunctionToExecute( + eventName: string, + jsName: string, + funcName: string, + ) { + this.agHelper.SelectPropertiesDropDown(eventName, "Execute a JS function"); + this.agHelper.GetNClick(this.locator._dropDownValue(jsName), 0, true); + this.agHelper.GetNClick(this.locator._dropDownValue(funcName), 0, true); + this.agHelper.AssertAutoSave(); + } + + public UpdatePropertyFieldValue(propFieldName: string, valueToEnter: string) { + cy.xpath(this.locator._existingFieldTextByName(propFieldName)).then( + ($field: any) => { + this.agHelper.UpdateCodeInput($field, valueToEnter); + }); + } } diff --git a/app/client/src/workers/Actions.ts b/app/client/src/workers/Actions.ts index 164a01aa078b..1be30aab7f0e 100644 --- a/app/client/src/workers/Actions.ts +++ b/app/client/src/workers/Actions.ts @@ -77,7 +77,7 @@ const DATA_TREE_FUNCTIONS: Record< }, storeValue: function(key: string, value: string, persist = true) { // momentarily store this value in local state to support loops - _.set(self, `appsmith.store[${key}]`, value); + _.set(self, ["appsmith", "store", key], value); return { type: ActionTriggerType.STORE_VALUE, payload: {