Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return hint on localhost url #3611

Merged
merged 17 commits into from
Mar 26, 2021

Conversation

sumitsum
Copy link
Contributor

@sumitsum sumitsum commented Mar 18, 2021

Description

  • Return hint for localhost URL on the following events:
    • Test datasource
    • Save datasource
    • Update REST API Url
    • Create datasource from REST API
    • When page gets loaded for first time.
  • Hint message returned: "You may not able to access your localhost if Appsmith is running inside a docker container or on the cloud. Please check out Appsmith's documentation to understand more."
  • It has been decided as part of actions pod meeting that these messages will not be persisted.

Fixes #552

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Test datasource response:
————————
{"responseMeta":{"status":200,"success":true},"data":{"invalids":["Missing username for authentication."], "messages":["You may not able to access localhost if Appsmith is running inside a docker container"], "success":false}}

Save datasource response:
————————
{"responseMeta":{"status":200,"success":true},"data":{"id":"6052f64a0f724760d3e94a23","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"name":"Untitled Datasource 5467","pluginId":"5c9f512f96c1a50004819786","organizationId":"5f9fc0550b682b2a63e424d3","datasourceConfiguration":{"connection":{"mode":"READ_WRITE"},"endpoints":[{"host":"localhost"}],"authentication":{"authenticationType":"dbAuth","authenticationType":"dbAuth","databaseName":"admin"},"sshProxyEnabled":false},"invalids":["Missing username for authentication."],"messages":["You may not able to access localhost if Appsmith is running inside a docker container"],"isValid":false,"new":false}}
API URL update response:
———————————
{"responseMeta":{"status":200,"success":true},"data":{"id":"60530960bf7f4b4dceae17aa","organizationId":"5f9fc0550b682b2a63e424d3","pluginType":"API","pluginId":"5ca385dc81b37f0004b4db85","name":"Api6","datasource":{"userPermissions":[],"name":"DEFAULT_REST_DATASOURCE","pluginId":"5ca385dc81b37f0004b4db85","organizationId":"5f9fc0550b682b2a63e424d3","datasourceConfiguration":{"url":"http://localhost"`},"invalids":[],`"messages":["You may not able to access localhost if Appsmith is running inside a docker container"],"isValid":true,"new":true},"pageId":"60211622f3d65469ffa7d5f5","actionConfiguration":{"timeoutInMillisecond":10000,"paginationType":"NONE","headers":[{"key":"","value":""},{"key":"","value":""}],"encodeParamsToggle":true,"queryParameters":[{"key":"","value":""},{"key":"","value":""}],"httpMethod":"GET"},"executeOnLoad":false,"dynamicBindingPathList":[],"isValid":true,"invalids":[],"jsonPathKeys":[],"confirmBeforeExecute":false,"userPermissions":["read:actions","execute:actions","manage:actions"]}}

API save as datasource response:
————————————
{"responseMeta":{"status":201,"success":true},"data":{"id":"605309f5bf7f4b4dceae17ab","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"name":"Untitled Datasource 5468","pluginId":"5ca385dc81b37f0004b4db85","organizationId":"5f9fc0550b682b2a63e424d3","datasourceConfiguration":{"properties":[{"key":"isSendSessionEnabled","value":"N"},{"key":"sessionSignatureKey"}],"url":"http://localhost"`},"invalids":[],`"messages":["You may not able to access localhost if Appsmith is running inside a docker container"],"isValid":true,"new":false}}

Fetch datasource info on page load response:
—————————————
{"id":"6051d88334f958353c5ae719","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"name":"Untitled Datasource 5460","pluginId":"5ca385dc81b37f0004b4db85","organizationId":"5f9fc0550b682b2a63e424d3","datasourceConfiguration":{"authentication":{"authenticationType":"oAuth2","grantType":"client_credentials","isTokenHeader":true,"isAuthorizationHeader":false,"headerPrefix":"Bearer "},"sshProxyEnabled":false,"properties":[{"key":"isSendSessionEnabled","value":"N"},{"key":"sessionSignatureKey","value":""}],"url":"https://localhost",`"headers":[]},"invalids":["Missing Client Secret","Missing Client ID","Missing Access Token URL"],"messages":["You may not able to access localhost if Appsmith is running inside a docker container"],"isValid":false,"new":false},`

{"id":"6051db4bec994c15970cc8a3","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"name":"Untitled Datasource 5461","pluginId":"5ca385dc81b37f0004b4db85","organizationId":"5f9fc0550b682b2a63e424d3","datasourceConfiguration":{"authentication":{"authenticationType":"oAuth2","grantType":"client_credentials","isTokenHeader":true,"isAuthorizationHeader":false,"headerPrefix":"Bearer "},"sshProxyEnabled":false,"properties":[{"key":"isSendSessionEnabled","value":"N"},{"key":"sessionSignatureKey","value":""}],"url":"https://localhost"`,"headers":[]},"invalids":["Missing Client Secret","Missing Client ID","Missing Access Token URL"],"messages":["You may not able to access localhost if Appsmith is running inside a docker container"],"isValid":false,"new":false},`

{"id":"6051db8fec994c15970cc8a4","userPermissions":["execute:datasources","manage:datasources","read:datasources"],"name":"Untitled Datasource 5462","pluginId":"5ca385dc81b37f0004b4db85","organizationId":"5f9fc0550b682b2a63e424d3","datasourceConfiguration":{"properties":[{"key":"isSendSessionEnabled","value":"N"},{"key":"sessionSignatureKey"}],"url":"https://localhost"`},"invalids":[],`"messages":["You may not able to access localhost if Appsmith is running inside a docker container"],"isValid":true,"new":false},

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@sumitsum sumitsum marked this pull request as ready for review March 22, 2021 10:37
@sumitsum sumitsum changed the title [Draft] return hint on localhost url Return hint on localhost url Mar 22, 2021
- remove unused errors.
- handle null datasource properly
@sumitsum sumitsum merged commit e347b61 into release Mar 26, 2021
@sumitsum sumitsum deleted the feature/return_hint_on_localhost_url_with_get_all branch March 26, 2021 10:12
@areyabhishek
Copy link
Contributor

@sumitsum Thanks for fixing this. I have a suggestion about the message. Instead of just saying please check Appsmith documentation, is there a solution we can suggest in the message itself? Like please expose your local endpoint to the internet before trying to access it inside Appsmith. If there's no such answer, then I understand.

Also is there a documentation link for this message?

@sumitsum
Copy link
Contributor Author

sumitsum commented Mar 26, 2021

Hi @areyabhishek , Yes I can change the message to include one possible solution that should cover ground for most of the users. I can change it to something like this:
You may not able to access your localhost if Appsmith is running inside a docker container or on the cloud. In order to access localhost, you may use ngrok to expose your local endpoint to the internet. Please check out Appsmith's documentation to understand more.
Tracking it here: #3725

We don't have a documentation for this yet, but I will update it soon to include details about this message. This message is not yet displayed to the user because the client side changes have not come in. I will update the documentation before that happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Show message when trying to connect to local host
3 participants