From d028011d7cb2903faecd1d013aef93c864b3119b Mon Sep 17 00:00:00 2001 From: Nikhil Nandagopal Date: Wed, 16 Sep 2020 19:51:02 +0530 Subject: [PATCH 1/8] Updated events to track user id as IP --- deploy/install.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/deploy/install.sh b/deploy/install.sh index ce47c67faf..63e162bb68 100755 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -313,11 +313,11 @@ bye() { # Prints a friendly good bye message and exits the script. curl -s -O --location --request POST 'https://hook.integromat.com/dkwb6i52am93pi30ojeboktvj32iw0fa' \ --header 'Content-Type: text/plain' \ --data-raw '{ - "userId": "'"$email"'", + "userId": "'"$APPSMITH_INSTALLATION_ID"'", "event": "Installation Support", "data": { "os": "'"$os"'", - "instanceId": "'"$APPSMITH_INSTALLATION_ID"'" + "email": "'"$email"'" } }' echo -e "\nExiting for now. Bye! \U1F44B\n" @@ -338,10 +338,10 @@ APPSMITH_INSTALLATION_ID=$(curl -s 'https://api6.ipify.org') curl -s -O --location --request POST 'https://hook.integromat.com/dkwb6i52am93pi30ojeboktvj32iw0fa' \ --header 'Content-Type: text/plain' \ --data-raw '{ + "userId": "'"$APPSMITH_INSTALLATION_ID"'", "event": "Installation Started", "data": { - "os": "'"$os"'", - "instanceId": "'"$APPSMITH_INSTALLATION_ID"'" + "os": "'"$os"'" } }' @@ -475,10 +475,10 @@ if confirm n "Do you have a custom domain that you would like to link? (Only for curl -s -O --location --request POST 'https://hook.integromat.com/dkwb6i52am93pi30ojeboktvj32iw0fa' \ --header 'Content-Type: text/plain' \ --data-raw '{ + "userId": "'"$APPSMITH_INSTALLATION_ID"'", "event": "Installation Custom Domain", "data": { - "os": "'"$os"'", - "instanceId": "'"$APPSMITH_INSTALLATION_ID"'" + "os": "'"$os"'" } }' echo "" @@ -569,21 +569,21 @@ if [[ $status_code -ne 401 ]]; then curl -s -O --location --request POST 'https://hook.integromat.com/dkwb6i52am93pi30ojeboktvj32iw0fa' \ --header 'Content-Type: text/plain' \ --data-raw '{ - "userId": "'"$email"'", + "userId": "'"$APPSMITH_INSTALLATION_ID"'", "event": "Installation Support", "data": { "os": "'"$os"'", - "instanceId": "'"$APPSMITH_INSTALLATION_ID"'" + "email": "'"$email"'" } }' else curl -s -O --location --request POST 'https://hook.integromat.com/dkwb6i52am93pi30ojeboktvj32iw0fa' \ --header 'Content-Type: text/plain' \ --data-raw '{ + "userId": "'"$APPSMITH_INSTALLATION_ID"'", "event": "Installation Success", "data": { - "os": "'"$os"'", - "instanceId": "'"$APPSMITH_INSTALLATION_ID"'" + "os": "'"$os"'" } }' echo "+++++++++++ SUCCESS ++++++++++++++++++++++++++++++" @@ -604,11 +604,11 @@ else curl -s -O --location --request POST 'https://hook.integromat.com/dkwb6i52am93pi30ojeboktvj32iw0fa' \ --header 'Content-Type: text/plain' \ --data-raw '{ - "userId": "'"$email"'", + "userId": "'"$APPSMITH_INSTALLATION_ID"'", "event": "Identify Successful Installation", "data": { "os": "'"$os"'", - "instanceId": "'"$APPSMITH_INSTALLATION_ID"'" + "email": "'"$email"'" } }' fi From 92273771957c83e18e4e2a2f0519eebbc6bf1083 Mon Sep 17 00:00:00 2001 From: Nikhil Nandagopal Date: Thu, 17 Sep 2020 21:20:34 +0530 Subject: [PATCH 2/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e05d86b1ab..17e6fb08e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,12 +14,12 @@ Feel free to propose changes to this document in a pull request. There are many ways in which we/one can to contribute to Appsmith. All contributions are highly appreciated. - Beta testing -- Raise Issues -- Feature Requests -- Documentation +- Raise Issues / Feature Requests +- Improve the Documentation - Code contribution - - Widgets - - Datasources + - Introduce New Widgets + - Introduce New Database Integrations + - Introduce New SAAS Integrations ## Git Workflow @@ -128,4 +128,4 @@ echo "127.0.0.1 dev.appsmith.com" | sudo tee -a /etc/hosts 2. Run the command to execute tests ```bash mvn clean package -``` \ No newline at end of file +``` From 3363357b9df9a733e5a53969a9d76b85e0d34b4d Mon Sep 17 00:00:00 2001 From: Nikhil Nandagopal Date: Thu, 17 Sep 2020 21:24:35 +0530 Subject: [PATCH 3/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17e6fb08e5..3cfec62168 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,10 +5,11 @@ Appsmith is a project by developers for developers and there are a lot of ways y Feel free to propose changes to this document in a pull request. ### Table of contents -- [Code of conduct](CODE_OF_CONDUCT.md) -- [How can I contribute?](#how-can-i-contribute) -- [How to set up local development?](#how-to-set-up-local-development) -- [How to run tests?](#how-to-run-tests) +- Code of conduct +- How can I contribute? +- Git Workflow +- Setting up local development +- Running tests ## How can I contribute? There are many ways in which we/one can to contribute to Appsmith. All contributions are highly appreciated. @@ -20,6 +21,10 @@ There are many ways in which we/one can to contribute to Appsmith. All contribut - Introduce New Widgets - Introduce New Database Integrations - Introduce New SAAS Integrations + +## Code of conduct + +Read our [Code of Conduct](CODE_OF_CONDUCT.md) before contributing ## Git Workflow @@ -34,7 +39,7 @@ Pull requests are the best way to propose changes to the codebase and get them r 5. Create an issue referencing the pull request. This ensures that we can track the bug being fixed or feature being added easily. -## ๐Ÿ‘จโ€๐Ÿ’ป How to set up local development +## ๐Ÿ‘จโ€๐Ÿ’ป Setting up local development ### Client Appsmith's client (UI/frontend) uses the ReactJS library and Typescript. The application also uses libraries like react-redux and redux-saga for workflows. @@ -109,7 +114,7 @@ echo "127.0.0.1 dev.appsmith.com" | sudo tee -a /etc/hosts cp envs/dev.env.example envs/dev.env ``` -## ๐Ÿงช How to run tests +## ๐Ÿงช Running tests ##### Client 1. In order to run the Cypress integration tests, run: From 64549e4b06011fcc692621c7ee63a92b1e77d685 Mon Sep 17 00:00:00 2001 From: Arpit Mohan Date: Thu, 17 Sep 2020 18:51:26 +0530 Subject: [PATCH 4/8] Removing cacheResponse from the JSON response for actions (#564) This is because this `cacheResponse` field is only used for auto-complete on the UI. The user can still run the action manually and get the auto-complete to work. The downside to sending the `cacheResponse` field in the JSON response is that for large responses, the client times out as our response times increase to 20 secs. Hence removing this for now. In future, we'll extract the JSON schema structure from the response body and send that to the client for populating auto-complete. --- .../src/main/java/com/appsmith/server/domains/Action.java | 1 + 1 file changed, 1 insertion(+) 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 a68dba0777..77cada4a46 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 @@ -56,6 +56,7 @@ public class Action extends BaseDomain { @JsonProperty(access = JsonProperty.Access.READ_ONLY) Set jsonPathKeys; + @JsonIgnore String cacheResponse; String templateId; //If action is created via a template, store the id here. From e7a1ba074166617697e6f26ca96058b983fd727e Mon Sep 17 00:00:00 2001 From: Satbir Singh Date: Fri, 18 Sep 2020 15:42:57 +0530 Subject: [PATCH 5/8] Adding onClick property for image widget. (cherry picked from commit d444b2e16971aafd1ea6661373c8df86a2ef6720) --- .../designSystems/appsmith/ImageComponent.tsx | 7 +++++ .../PropertyPaneConfigResponse.tsx | 15 +++++++++++ app/client/src/widgets/ImageWidget.tsx | 27 ++++++++++++++++++- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/app/client/src/components/designSystems/appsmith/ImageComponent.tsx b/app/client/src/components/designSystems/appsmith/ImageComponent.tsx index 6338f36318..af7151e191 100644 --- a/app/client/src/components/designSystems/appsmith/ImageComponent.tsx +++ b/app/client/src/components/designSystems/appsmith/ImageComponent.tsx @@ -6,6 +6,8 @@ export interface StyledImageProps { defaultImageUrl: string; imageUrl?: string; backgroundColor?: string; + showHoverPointer?: boolean; + onClick?: (event: React.MouseEvent) => void; } export const StyledImage = styled.div< @@ -16,6 +18,8 @@ export const StyledImage = styled.div< position: relative; display: flex; flex-direction: "row"; + cursor: ${props => + props.showHoverPointer && props.onClick ? "pointer" : "inherit"}; background: ${props => props.backgroundColor}; background-image: url("${props => props.imageError ? props.defaultImageUrl : props.imageUrl}"); @@ -53,6 +57,7 @@ class ImageComponent extends React.Component< src={this.props.imageUrl} onError={this.onImageError} onLoad={this.onImageLoad} + onClick={this.props.onClick} > ); @@ -75,6 +80,8 @@ export interface ImageComponentProps extends ComponentProps { imageUrl: string; defaultImageUrl: string; isLoading: boolean; + showHoverPointer?: boolean; + onClick?: (event: React.MouseEvent) => void; } export default ImageComponent; diff --git a/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx b/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx index 968ce4d31e..8e7224261e 100644 --- a/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx +++ b/app/client/src/mockResponses/PropertyPaneConfigResponse.tsx @@ -234,6 +234,21 @@ const PropertyPaneConfigResponse: PropertyPaneConfigsResponse["data"] = { }, ], }, + { + id: "3.2", + sectionName: "Actions", + children: [ + { + id: "3.2.1", + helpText: + "Triggers an action when a user changes the selected option", + propertyName: "onClick", + label: "onClick", + controlType: "ACTION_SELECTOR", + isJSConvertible: true, + }, + ], + }, ], RADIO_GROUP_WIDGET: [ { diff --git a/app/client/src/widgets/ImageWidget.tsx b/app/client/src/widgets/ImageWidget.tsx index 25d57d6c6e..9b76dbc333 100644 --- a/app/client/src/widgets/ImageWidget.tsx +++ b/app/client/src/widgets/ImageWidget.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import BaseWidget, { WidgetProps, WidgetState } from "./BaseWidget"; -import { WidgetType } from "constants/WidgetConstants"; +import { WidgetType, RenderModes } from "constants/WidgetConstants"; import ImageComponent from "components/designSystems/appsmith/ImageComponent"; import { WidgetPropertyValidationType, @@ -8,8 +8,14 @@ import { } from "utils/ValidationFactory"; import { VALIDATION_TYPES } from "constants/WidgetValidation"; import * as Sentry from "@sentry/react"; +import { EventType } from "constants/ActionConstants"; +import { TriggerPropertiesMap } from "utils/WidgetFactory"; class ImageWidget extends BaseWidget { + constructor(props: ImageWidgetProps) { + super(props); + this.onImageClick = this.onImageClick.bind(this); + } static getPropertyValidationMap(): WidgetPropertyValidationType { return { ...BASE_WIDGET_VALIDATION, @@ -18,17 +24,35 @@ class ImageWidget extends BaseWidget { defaultImage: VALIDATION_TYPES.TEXT, }; } + static getTriggerPropertyMap(): TriggerPropertiesMap { + return { + onClick: true, + }; + } getPageView() { return ( ); } + onImageClick() { + if (this.props.onClick) { + super.executeAction({ + dynamicString: this.props.onClick, + event: { + type: EventType.ON_CLICK, + }, + }); + } + } + getWidgetType(): WidgetType { return "IMAGE_WIDGET"; } @@ -40,6 +64,7 @@ export interface ImageWidgetProps extends WidgetProps { image: string; imageShape: ImageShape; defaultImage: string; + onClick?: string; } export default ImageWidget; From 790ad71a2caf2304067af15475d2b122625ad936 Mon Sep 17 00:00:00 2001 From: Arpit Mohan Date: Sat, 19 Sep 2020 12:56:42 +0530 Subject: [PATCH 6/8] Adding more details to Contributing.md for server compilation (#582) --- CONTRIBUTING.md | 29 ++++++++++++++++++++++++++++- app/server/envs/dev.env.example | 13 ++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3cfec62168..3a0f32c209 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -107,13 +107,40 @@ echo "127.0.0.1 dev.appsmith.com" | sudo tee -a /etc/hosts - We use MongoDB for our database. 1. After cloning the repository, change your directory to `app/server` -2. Run `mvn clean compile`. This generates a bunch of classes required by IntelliJ for compiling the rest of the source code. + +2. Run the command +```bash + mvn clean compile +``` + +This generates a bunch of classes required by IntelliJ for compiling the rest of the source code. Without this step, your IDE may complain about missing classes and will be unable to compile the code. + 3. Create a copy of the `envs/dev.env.example` ```shell script cp envs/dev.env.example envs/dev.env ``` +4. Modify the property values in the file `envs/dev.env` to point to your local running instance of MongoDB and Redis. + +5. In order to create the final JAR for the Appsmith server, run the command: +``` +./build.sh +``` + +This command will create a `dist` folder which contains the final packaged jar along with multiple jars for the binaries for plugins as well. + +6. Start the Java server by running + +``` +./scripts/start-dev-server.sh +``` +By default, the server will start on port 8080. + +7. When the server starts, it automatically runs migrations on MongoDB and will populate it with some initial required data. + +8. You can check the status of the server by hitting the endpoint: [http://localhost:8080](http://localhost:8080) on your browser. By default you should see an blank page. + ## ๐Ÿงช Running tests ##### Client diff --git a/app/server/envs/dev.env.example b/app/server/envs/dev.env.example index ee294d34da..7a63880366 100644 --- a/app/server/envs/dev.env.example +++ b/app/server/envs/dev.env.example @@ -1,5 +1,16 @@ #!/bin/sh -APPSMITH_MONGODB_URI="mongodb://localhost:27017/mobtools" +APPSMITH_MONGODB_URI="mongodb://localhost:27017/appsmith" APPSMITH_REDIS_URL="redis://127.0.0.1:6379" + +APPSMITH_MAIL_ENABLED=false + +APPSMITH_ENCRYPTION_PASSWORD=abcd +APPSMITH_ENCRYPTION_SALT=abcd + +#APPSMITH_OAUTH2_GOOGLE_CLIENT_ID="" +#APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET="" + +#APPSMITH_OAUTH2_GITHUB_CLIENT_ID="" +#APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET="" \ No newline at end of file From 5cfb6b7528ee40684b626a4e68d3f588713a2934 Mon Sep 17 00:00:00 2001 From: Arpit Mohan Date: Sat, 19 Sep 2020 13:49:51 +0530 Subject: [PATCH 7/8] Fixing the documentation for where the environment file is created (#583) --- CONTRIBUTING.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a0f32c209..4053f29964 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -118,10 +118,12 @@ This generates a bunch of classes required by IntelliJ for compiling the rest of 3. Create a copy of the `envs/dev.env.example` ```shell script - cp envs/dev.env.example envs/dev.env + cp envs/dev.env.example .env ``` -4. Modify the property values in the file `envs/dev.env` to point to your local running instance of MongoDB and Redis. +This command creates a `.env` file in the `app/server` folder. All run scripts pick up environment configuration from this file. + +4. Modify the property values in the file `.env` to point to your local running instance of MongoDB and Redis. 5. In order to create the final JAR for the Appsmith server, run the command: ``` From 04368d675e891700998ed3d6d4f1b9f69f1819f0 Mon Sep 17 00:00:00 2001 From: Nikhil Nandagopal Date: Sat, 19 Sep 2020 17:15:19 +0530 Subject: [PATCH 8/8] Patch for Rich text editor updates --- .../designSystems/appsmith/RichTextEditorComponent.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/client/src/components/designSystems/appsmith/RichTextEditorComponent.tsx b/app/client/src/components/designSystems/appsmith/RichTextEditorComponent.tsx index 5931172de8..3b6b72b35d 100644 --- a/app/client/src/components/designSystems/appsmith/RichTextEditorComponent.tsx +++ b/app/client/src/components/designSystems/appsmith/RichTextEditorComponent.tsx @@ -39,7 +39,9 @@ export const RichtextEditorComponent = ( editorInstance !== null && props.defaultValue !== editorContent.current ) { - editorInstance.setContent(props.defaultValue, { format: "html" }); + setTimeout(() => { + editorInstance.setContent(props.defaultValue, { format: "html" }); + }, 200); } }, [props.defaultValue]); useEffect(() => {