From f7cf7e1182abebd43bc3dc504c82add39935ff88 Mon Sep 17 00:00:00 2001 From: Nikhil Nandagopal Date: Tue, 4 Aug 2020 17:51:02 +0530 Subject: [PATCH] Fix/copy changes (#210) * Added information to setup domain * Fixed incorrect var reference * Updated documentation message * Updated env template * updated template * removed debug echo * Updated Script * Updated Text * Removed option to connect to external mongo for fresh installs Exit script of docker desktop is not installed * Updated docker installation explanation * added a question to skip custom domain if user is installing locally * Inverted script question and * Removed question to determine local installation * Updated Popup CTA to Modal Updated query templates to contain bindings Added a message to display on API / Query errors * updated styles for evaluated value updated styles for auto complete * added spaces to questions Co-authored-by: Nikhil Nandagopal --- app/client/cypress/support/commands.js | 2 +- .../CodeEditor/EvaluatedValuePopup.tsx | 26 ++++++++++++------- .../editorComponents/CodeEditor/index.tsx | 1 + .../CodeEditor/styledComponents.ts | 15 ++++++----- .../actioncreator/ActionCreator.tsx | 6 ++--- app/client/src/constants/DefaultTheme.tsx | 2 +- .../mockResponses/WidgetConfigResponse.tsx | 2 +- app/client/src/sagas/ActionExecutionSagas.ts | 5 ++++ .../src/main/resources/templates/CREATE.json | 8 +++--- .../src/main/resources/templates/DELETE.json | 5 ++-- .../src/main/resources/templates/READ.json | 6 ++--- .../src/main/resources/templates/UPDATE.json | 7 +---- .../src/main/resources/templates/CREATE.sql | 8 ++++-- .../src/main/resources/templates/DELETE.sql | 2 +- .../src/main/resources/templates/SELECT.sql | 2 +- .../src/main/resources/templates/UPDATE.sql | 2 +- .../src/main/resources/templates/CREATE.sql | 8 ++++-- .../src/main/resources/templates/DELETE.sql | 2 +- .../src/main/resources/templates/SELECT.sql | 2 +- .../src/main/resources/templates/UPDATE.sql | 2 +- deploy/install.sh | 1 + 21 files changed, 66 insertions(+), 48 deletions(-) diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 02434a6006..5695056052 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -617,7 +617,7 @@ Cypress.Commands.add("createModal", (modalType, ModalName) => { .click({ force: true }) .get("ul.bp3-menu") .children() - .contains("Open Popup") + .contains("New Modal") .click(); cy.get(modalWidgetPage.selectModal).click(); cy.get(modalWidgetPage.createModalButton).click({ force: true }); diff --git a/app/client/src/components/editorComponents/CodeEditor/EvaluatedValuePopup.tsx b/app/client/src/components/editorComponents/CodeEditor/EvaluatedValuePopup.tsx index f842cbadb0..b4052968ed 100644 --- a/app/client/src/components/editorComponents/CodeEditor/EvaluatedValuePopup.tsx +++ b/app/client/src/components/editorComponents/CodeEditor/EvaluatedValuePopup.tsx @@ -47,13 +47,13 @@ const ContentWrapper = styled.div<{ colorTheme: EditorTheme }>` -ms-overflow-style: none; background-color: ${props => THEMES[props.colorTheme].backgroundColor}; color: ${props => THEMES[props.colorTheme].textColor}; - padding: 15px; + padding: 10px; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); border-radius: 4px; `; const CurrentValueWrapper = styled.div` - max-height: 150px; + max-height: 300px; overflow-y: auto; ::-webkit-scrollbar { display: none; @@ -63,12 +63,14 @@ const CurrentValueWrapper = styled.div` const CodeWrapper = styled.pre<{ colorTheme: EditorTheme }>` padding: 10px; + margin: 0px 0px; background-color: ${props => THEMES[props.colorTheme].editorBackground}; color: ${props => THEMES[props.colorTheme].editorColor}; overflow: scroll; ::-webkit-scrollbar { display: none; } + font-size: 14px; -ms-overflow-style: none; white-space: pre-wrap; `; @@ -81,17 +83,23 @@ const TypeText = styled.pre<{ colorTheme: EditorTheme }>` ::-webkit-scrollbar { display: none; } + font-size: 12px; + margin: 5px 0; -ms-overflow-style: none; `; const ErrorText = styled.p` - margin: 10px 0; + margin: 5px 0; padding: 5px; border-radius: 2px; background-color: rgba(235, 87, 87, 0.2); color: ${props => props.theme.colors.error}; `; +const StyledTitle = styled.p` + margin: 8px 0; +`; + interface Props { theme: EditorTheme; isOpen: boolean; @@ -123,13 +131,13 @@ const CurrentValueViewer = (props: { Array.isArray(props.evaluatedValue) ) { const reactJsonProps = { - theme: props.theme === EditorTheme.DARK ? "monokai" : "rjv-default", + theme: props.theme === EditorTheme.DARK ? "summerfruit" : "rjv-default", name: null, enableClipboard: false, displayObjectSize: false, displayDataTypes: false, style: { - fontSize: "14px", + fontSize: "12px", }, collapsed: 2, collapseStringsAfterLength: 20, @@ -145,7 +153,7 @@ const CurrentValueViewer = (props: { } return ( -

Current Value:

+ Evaluated Value {content}
); @@ -162,9 +170,9 @@ const PopoverContent = (props: PopoverContentProps) => { {props.hasError && ( {`This value does not evaluate to type "${props.expected}"`} )} - {props.expected && ( + {!props.hasError && props.expected && ( -

Expected type:

+ Expected Data Type {props.expected}
)} @@ -207,7 +215,7 @@ const EvaluatedValuePopup = (props: Props) => { expected={props.expected} evaluatedValue={props.evaluatedValue} hasError={props.hasError} - theme={props.theme} + theme={EditorTheme.DARK} onMouseLeave={() => { setContentHovered(false); }} diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx index d806e27af5..a21102f99a 100644 --- a/app/client/src/components/editorComponents/CodeEditor/index.tsx +++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx @@ -286,6 +286,7 @@ class CodeEditor extends Component { diff --git a/app/client/src/components/editorComponents/CodeEditor/styledComponents.ts b/app/client/src/components/editorComponents/CodeEditor/styledComponents.ts index a3e5adec58..5dec2a10d0 100644 --- a/app/client/src/components/editorComponents/CodeEditor/styledComponents.ts +++ b/app/client/src/components/editorComponents/CodeEditor/styledComponents.ts @@ -17,7 +17,7 @@ export const HintStyles = createGlobalStyle<{ editorTheme: EditorTheme }>` font-size: 90%; font-family: monospace; max-height: 20em; - width: 300px; + width: 250px; overflow-y: auto; background: ${props => props.editorTheme === EditorTheme.DARK ? "#090A0F" : "#ffffff"}; @@ -38,7 +38,7 @@ export const HintStyles = createGlobalStyle<{ editorTheme: EditorTheme }>` cursor: pointer; display: flex; align-items: center; - font-size: 14px; + font-size: 12px; } li.CodeMirror-hint-active { @@ -239,15 +239,16 @@ export const DynamicAutocompleteInputWrapper = styled.div<{ theme: Theme; isActive: boolean; isNotHover: boolean; + isError: boolean; }>` width: 100%; height: 100%; flex: 1; position: relative; - border: ${props => (props.skin === Skin.DARK ? "1px solid" : "none")}; + border: 1px solid; border-radius: 2px; border-color: ${props => - props.isActive && props.skin === Skin.DARK + !props.isError && props.isActive && props.skin === Skin.DARK ? Colors.ALABASTER : "transparent"}; > span:first-of-type { @@ -256,8 +257,10 @@ export const DynamicAutocompleteInputWrapper = styled.div<{ right: 0px; } &:hover { - border: ${props => - props.skin === Skin.DARK ? "1px solid " + Colors.ALABASTER : "none"}; + border-color: ${props => + !props.isError && props.skin === Skin.DARK + ? Colors.ALABASTER + : "transparent"}; .lightning-menu { background: ${props => !props.isNotHover diff --git a/app/client/src/components/editorComponents/actioncreator/ActionCreator.tsx b/app/client/src/components/editorComponents/actioncreator/ActionCreator.tsx index 09d14b3740..30252fcf1c 100644 --- a/app/client/src/components/editorComponents/actioncreator/ActionCreator.tsx +++ b/app/client/src/components/editorComponents/actioncreator/ActionCreator.tsx @@ -372,11 +372,11 @@ const baseOptions: any = [ value: ActionType.showAlert, }, { - label: "Open Popup", + label: "Open Modal", value: ActionType.showModal, }, { - label: "Close Popup", + label: "Close Modal", value: ActionType.closeModal, }, ]; @@ -760,7 +760,7 @@ function useModalDropdownList() { let finalList: TreeDropdownOption[] = [ { - label: "Open Popup", + label: "New Modal", value: "Modal", id: "create", className: "t--create-modal-btn", diff --git a/app/client/src/constants/DefaultTheme.tsx b/app/client/src/constants/DefaultTheme.tsx index 306a9d7a45..d7a0667719 100644 --- a/app/client/src/constants/DefaultTheme.tsx +++ b/app/client/src/constants/DefaultTheme.tsx @@ -376,7 +376,7 @@ export const theme: Theme = { }, evaluatedValuePopup: { width: 300, - height: 400, + height: 500, }, drawerWidth: "80%", colors: { diff --git a/app/client/src/mockResponses/WidgetConfigResponse.tsx b/app/client/src/mockResponses/WidgetConfigResponse.tsx index 6dafcb3986..4465bc3fe4 100644 --- a/app/client/src/mockResponses/WidgetConfigResponse.tsx +++ b/app/client/src/mockResponses/WidgetConfigResponse.tsx @@ -396,7 +396,7 @@ const WidgetConfigResponse: WidgetConfigReducerState = { text: "Submit", buttonStyle: "PRIMARY_BUTTON", disabledWhenInvalid: true, - resetFormOnClick: false, + resetFormOnClick: true, }, }, { diff --git a/app/client/src/sagas/ActionExecutionSagas.ts b/app/client/src/sagas/ActionExecutionSagas.ts index 2e1aec3423..7990b90d8f 100644 --- a/app/client/src/sagas/ActionExecutionSagas.ts +++ b/app/client/src/sagas/ActionExecutionSagas.ts @@ -272,6 +272,11 @@ export function* executeActionSaga( event.callback({ success: false }); } } + AppToaster.show({ + message: + api.name + " failed to execute. Please check it's configuration", + type: "error", + }); } else { if (onSuccess) { yield put( diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/CREATE.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/CREATE.json index 481c0c6323..000062cdf9 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/CREATE.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/CREATE.json @@ -2,11 +2,9 @@ "insert": "users", "documents": [ { - "name": "John Smith", - "email": [ - "john@appsmith.com" - ], - "gender": "M" + "name": "{{ nameInput.text }}", + "email": "{{ emailInput.text }}", + "gender": "{{ genderDropdown.selectedOptionValue }}" } ] } diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/DELETE.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/DELETE.json index 842160cf90..a10f6da1cf 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/DELETE.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/DELETE.json @@ -3,8 +3,9 @@ "deletes": [ { "q": { - "id": 10 - } + "id": "{{ usersTable.selectedRow.id }}" + }, + "limit": 1 } ] } diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/READ.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/READ.json index 2ecc90b82c..49ca131c9b 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/READ.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/READ.json @@ -1,12 +1,10 @@ { "find": "users", "filter": { - "id": { - "$gte": 10 - } + "status": "{{ statusDropdown.selectedOptionValue }}" }, "sort": { "id": 1 }, "limit": 10 -} +} \ No newline at end of file diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/UPDATE.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/UPDATE.json index 231d713ff9..437a26a70f 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/UPDATE.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/templates/UPDATE.json @@ -5,12 +5,7 @@ "q": { "id": 10 }, - "u": { - "name": "Updated Sam", - "email": [ - "updates@appsmith.com" - ] - } + "u": { "$set": { "status": "{{ statusDropdown.selectedOptionValue }}" } } } ] } diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql index 37d328b85c..bcdd4dbd5a 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql @@ -1,4 +1,8 @@ INSERT INTO users - (id, name, gender, avatar, email, address, role) + (name, gender, email) VALUES - (?, ?, ?, ?, ?, ?, ?); + ( + '{{ nameInput.text }}', + '{{ genderDropdown.selectedOptionValue }}', + '{{ nameInput.text }}' + ); \ No newline at end of file diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql index c487578842..aad8425f9b 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = ?; +DELETE FROM users WHERE id = '{{ usersTable.selectedRow.id }}'; diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/SELECT.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/SELECT.sql index 0a8208db0d..80ef4f2134 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/SELECT.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/SELECT.sql @@ -1 +1 @@ -SELECT * FROM users ORDER BY id LIMIT 10; +SELECT * FROM users where role = '{{ roleDropdown.selectedOptionValue }}' ORDER BY id LIMIT 10; \ No newline at end of file diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql index 18445fd6c3..4c1b31b32b 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,3 @@ UPDATE users SET status = 'APPROVED' - WHERE id = 1; + WHERE id = '{{ usersTable.selectedRow.id }}'; diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql index 37d328b85c..60948f8b63 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql @@ -1,4 +1,8 @@ INSERT INTO users - (id, name, gender, avatar, email, address, role) + (name, gender, email) VALUES - (?, ?, ?, ?, ?, ?, ?); + ( + '{{ nameInput.text }}', + '{{ genderDropdown.selectedOptionValue }}', + '{{ nameInput.text }}' + ); diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql index c487578842..aad8425f9b 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = ?; +DELETE FROM users WHERE id = '{{ usersTable.selectedRow.id }}'; diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql index 0a8208db0d..80ef4f2134 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql @@ -1 +1 @@ -SELECT * FROM users ORDER BY id LIMIT 10; +SELECT * FROM users where role = '{{ roleDropdown.selectedOptionValue }}' ORDER BY id LIMIT 10; \ No newline at end of file diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql index 18445fd6c3..4c1b31b32b 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,3 @@ UPDATE users SET status = 'APPROVED' - WHERE id = 1; + WHERE id = '{{ usersTable.selectedRow.id }}'; diff --git a/deploy/install.sh b/deploy/install.sh index 5366781b6d..e2f273f03f 100755 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -304,6 +304,7 @@ echo "+++++++++++++++++++++++++++++++++++++++++++++++++" echo "" echo "Your application is running on http://localhost" echo "" +echo "Your application is running on http://localhost" echo "Need help troubleshooting?" echo "Join our discord server https://discord.com/invite/rBTTVJp" echo ""