Skip to content

feat: Import javascript libraries#17895

Merged
arunvjn merged 245 commits intoreleasefrom
feat/javascript-libraries
Dec 21, 2022
Merged

feat: Import javascript libraries#17895
arunvjn merged 245 commits intoreleasefrom
feat/javascript-libraries

Conversation

@arunvjn
Copy link
Copy Markdown
Contributor

@arunvjn arunvjn commented Oct 27, 2022

Description

  • Copy and paste the URL of a library of your choice into Appsmith to have the library downloaded and ready to use. This statement comes with some limitation though, and is listed below
    • The library URL that you paste should point to a valid UMD build of the library. Libraries bundled in other module definitions are disallowed.
    • Evaluations that power Appsmith, run on web worker, and the APIs on the worker are a subset of the ones you find on the main thread. Here's the list of APIs that web workers support.
    • Libraries that use APIs that are not on web worker are unsupported.
    • Additionally, libraries that rely on XMLHttpRequest are unsupported.
  • Installed libraries get autocomplete support.
  • Additionally, this comes with Appsmith's recommended libraries, which are chosen based on community feedback and popularity

Code Refactor

  • Eval worker now has 2 message handlers, one to handle async request and one that handles synchronous request.
  • completePromise now resides in the async message handler and not the evaluateAsync call.
  • GracefulWorkerService is refactored to send request and respond to a message if required.
  • Added a new interface Message, that determines the contract for main thread and worker comms.
  • Every GracefulWorkerService now comes with one channel to listen for requests from the worker, thereby reducing the number of channels from 2 to 1.

Note

  • This feature is behind a feature flag.
  • Pending items include libraries support in git connected apps and the cypress tests around it.

Fixes #2430
Fixes #17310
Fixes #17966
Fixes #17309

Type of change

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

How Has This Been Tested?

  • Manual
  • Jest
  • Cypress
    • Install/uninstall JS Libraries.
    • References to an uninstalled library should show lint error.
    • Autocomplete for installed libraries.
    • Code completion should not show up with results for uninstalled libraries.
    • Detect name collision
    • Library should be copied over to duplicated application
    • Import application should reinstall libraries.

Test Plan

Issues raised during DP testing

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

Front logo Front conversations

arunvjn added 30 commits October 10, 2022 23:13
* Added installation popover.
* Added cards to show recommended library.
* Added Input box to paste URLs
* Added URL validation
- Queue multiple installation.
* Queued install appear in entity explorer with a spinner.
* Renamed JSDependency -> index
- Show spinner for currently queued libraries.
- Show trash icon to remove libraries.
- Added action creator for uninstall library.
* Added util to generate tern definitions.
* Move installed libraries to extraLibraries for eval and linting.
* Toast message to show successful/failed installation along with accessor.
- Added save success checkmark icon
- Added scroll bar to the body of installation window
* Persist library accessor for display in explorer.
* Added cards to show multiple installation status.
* Changed the explorer display order to show the latest installations at the top.
@arunvjn
Copy link
Copy Markdown
Contributor Author

arunvjn commented Dec 21, 2022

/ok-to-test sha=2510284

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR cypress/integration/Smoke_TestSuite/ClientSideTests/IDE/MaintainContext&Focus_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/VisualTests/WidgetsLayout_spec.js

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR cypress/integration/Smoke_TestSuite_Fat/ClientSideTests/FormLogin/EnableFormLogin_spec.js

@github-actions
Copy link
Copy Markdown

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3746952662.
Workflow: Appsmith External Integration Test Workflow.
Commit: 2510284.
PR: 17895.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=17895&runId=3746952662_1

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/GuidedTour_spec.js

@arunvjn
Copy link
Copy Markdown
Contributor Author

arunvjn commented Dec 21, 2022

/ok-to-test sha=2510284

@github-actions
Copy link
Copy Markdown

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3747711557.
Workflow: Appsmith External Integration Test Workflow.
Commit: 2510284.
PR: 17895.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=17895&runId=3747711557_1

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js
cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js
cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_1_spec.js

@arunvjn
Copy link
Copy Markdown
Contributor Author

arunvjn commented Dec 21, 2022

/ok-to-test sha=3af21dc

@github-actions
Copy link
Copy Markdown

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3748500984.
Workflow: Appsmith External Integration Test Workflow.
Commit: 3af21dc.
PR: 17895.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=17895&runId=3748500984_1

@ramsaptami
Copy link
Copy Markdown
Contributor

Pending fixes from issues raised is mentioned here

Round 2 of QA is complete and the PR can be merged to release with the following caveats:

  • Git flow hasn't been tested since there's a conflict when merging branches. This also causes issues during git import hence git flow needs a thorough check once backend changes are merged
  • App and page cloning is failing on a few workspaces due to this issue. But works on other new and old workspaces and custom JS functionality has been verified on new and old apps.

CC: @arunvjn @satbir121

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_Existing_app_spec.js
cypress/integration/Smoke_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js
cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_1_spec.js

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Autocomplete_JS_spec.ts
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitImport/ImportEmptyRepo_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Connection_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.ts
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/DisconnectGit_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/VisualTests/JSEditorIndent_spec.js

@arunvjn
Copy link
Copy Markdown
Contributor Author

arunvjn commented Dec 21, 2022

/ok-to-test sha=3c33d5f

@github-actions
Copy link
Copy Markdown

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3749245998.
Workflow: Appsmith External Integration Test Workflow.
Commit: 3c33d5f.
PR: 17895.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=17895&runId=3749245998_1

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/Autocomplete_JS_spec.ts
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitImport/ImportEmptyRepo_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitImport/ImportEmptyRepo_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Connection_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.ts
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Deploy_spec.ts
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/DisconnectGit_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/Merge_spec.js

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR

@arunvjn
Copy link
Copy Markdown
Contributor Author

arunvjn commented Dec 21, 2022

/ok-to-test sha=d982f36

@github-actions
Copy link
Copy Markdown

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/3750468020.
Workflow: Appsmith External Integration Test Workflow.
Commit: d982f36.
PR: 17895.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=17895&runId=3750468020_1

@github-actions
Copy link
Copy Markdown

The following are new failures, please fix them before merging the PR cypress/integration/Smoke_TestSuite/ClientSideTests/ExplorerTests/Entity_Explorer_Widgets_Copy_Paste_Delete_Undo_Keyboard_Event_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js
cypress/integration/Smoke_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Custom JS Libraries Issues related to adding custom JS library Enhancement New feature or request Javascript Product Issues related to users writing javascript in appsmith JS Evaluation Issues related to JS evaluation on the platform JS Objects Issues related to JS Objects Test Plan Approved Manual/Cypress tests covers changes made on the PR. Else, add skip-testPlan label if not applicable

Projects

None yet

5 participants