Commit Graph

889 Commits

Author SHA1 Message Date
somebody1234
784d06912f
Make (almost) all interfaces readonly (#8800)
This is not strictly necessary (as indicated by the fact that no actual logic needed to be changed), but it doesn't hurt to make this change.
- Make (almost) all `interface`s `readonly`
- Some of them are *not* readonly; this is intentional as those *do* need to be mutated
- A `no-restricted-syntax` lint rule has been added, but only for `interfaces` - it has been added neither for `classes` nor for `readonly T[]`
- A lint rule for `extends React.PropsWithChildren` instead of `extends Readonly<React.PropsWithChildren>` would be easy to add though...

# Important Notes
- There should be no logic changes, so QA shouldn't need to test anything in particular.
2024-02-07 11:26:59 +00:00
somebody1234
2db13bd168
Fix saved project validation (#8951)
Fix an oversight of project validation disallowing `accessToken: null`, which will be the case when in offline mode/not logged in.

# Important Notes
None
2024-02-07 10:47:04 +00:00
Kaz Wesley
e0ba39ed3e
Introduce SourceDocument for text edit support (#8957)
Introduce `SourceDocument`, a reactive source code representation that can be synced from a `MutableModule`. `SourceDocument` replaces various logic for tracking source code and spans--most importantly, `ReactiveModule`. There is no longer any reactively-tracked `Module`, per-se: Changes to the `MutableModule` attached to the synchronized `ydoc` are pushed as Y.Js events to the `SourceDocument` and `GraphDb`, which are reactively tracked. This avoids a problem in the upcoming text-synchronization (next PR) that was caused by a reactive back channel bypassing the `GraphDb` and resulting in observation of inconsistent states.

Stacked on #8956. Part of #8238.
2024-02-06 16:44:24 +00:00
Michael Mauderer
678270ac69
New scenarios for E2E tests - Interactions with Edges (#8917)
Adds e2e test for interactions with edges.
2024-02-06 16:15:00 +00:00
somebody1234
8bfdf0063a
Bump expect timeout and add retries for dashboard E2E tests (#8939)
- Fix flaky dashboard E2E tests that occur because of timeouts

# Important Notes
None
2024-02-06 15:52:03 +00:00
Kaz Wesley
06f18864f4
Refactoring before text edits (#8956)
Changes in preparation for #8238 features.

# Important Notes
Changed edit APIs:
- **`graph.astModule` is deprecated.** It will be removed in my next PR.
- Prefer `graph.edit` to start and commit an edit.
- Use `graph.startEdit` / `graph.commitEdit` if the edit can't be confined to one scope.
2024-02-06 14:43:17 +00:00
Adam Obuchowicz
6517384bbb
Interpret documented nodes properly (#8978)
When a node has documentation, it becomes a special "Documented" AST node.
2024-02-06 10:45:16 +00:00
Adam Obuchowicz
e88d8d8756
Fix vector widget in non-argument literal (#8972)
Fix vector widget not appearing in non-argument list literals. Added tests for showing widgets for various literals.
2024-02-06 09:43:38 +00:00
Paweł Grabarz
d418a02014
Update icon definitions to new figma export format (#8860)
Related to #8387

Updated icons file to match the export format of figma plugin.
2024-02-05 15:29:45 +00:00
Adam Obuchowicz
fa4b980d67
Reduce test flakiness (#8947)
Probably fixes the first point in #8942

My guess is that the mockExpressionUpdate may be not set in cases when the test runs before App mounting. To make sure all the setup is done, we wait for `App` widget to being mounted before proceeding.

# Important Notes
This PR also change the way we run test's server. Before it was always a production build, but this makes development iteration long. Now we test production build only on CI or when `PROD=true` env variable is set.
2024-02-05 14:20:24 +00:00
Ilya Bogdanov
801cc7b37d
Fix dangling node connection (#8902)
Fixes #8871

The issue was caused by invalid port registration. Because of the existing context switch expression (which is not visible in GUI),  the port incorrectly considered itself to belong to another node. This happened because the port was only aware of the visible part of the node’s AST and considered it the whole node.

There are two fixes in this PR. Either of them fixes the issue, and they are both implemented for robustness:
1. We provide `nodeId` information to the widget tree, so it no longer assumes the node ID from AST.
2. The order of checks in `getPortNodeId` is swapped. Now we first search by AST, only then try to look up the port. It makes sense to me because the AST is a single root of truth, and we should only rely on registered ports if AST does not exist (which happens for unconnected ports).
2024-02-05 10:49:55 +01:00
Adam Obuchowicz
1a8b82e237
Another set of small fixes (#8946)
* `Enter` key accepts the edit in Numeric and Text input
* Newly added node are selected
* Placement of new nodes takes opened visualizations into account.

[Screencast from 2024-02-02 13-02-26.webm](https://github.com/enso-org/enso/assets/3919101/0f328824-1cbc-4b07-988e-dbf17b94dc2f)
2024-02-02 18:11:28 +01:00
Adam Obuchowicz
8eeef71c26
Fix loading wasm for ydocs server (#8952)
#8893 introduced a fatal regression for old IDE + new IDE also does not work on every system.

The fix:
1. Don't assume that WASM needed by ydocs server is bundled
2. Don't assume we know its exact name.
2024-02-02 17:01:58 +01:00
Ilya Bogdanov
45221d9167
A quick fix for incorrectly working dropdowns. (#8933)
Partial fix for #8932 

https://github.com/enso-org/enso/assets/6566674/75a878fb-891b-44fc-bdfd-c3cbb90c9f35

This is not a correct fix, as comparing strings is not what we really want, but it should fix most of use cases.
2024-02-02 15:55:22 +01:00
Kaz Wesley
343a644051
Syntactic synchronization, automatic parentheses, metadata in Ast (#8893)
- Synchronize Y.Js clients by AST (implements #8237).
- Before committing an edit, insert any parentheses-nodes needed for the concrete syntax to reflect tree structure (fixes #8884).
- Move `externalId` and all node metadata into a Y.Map owned by each `Ast`. This allows including metadata changes in an edit, enables Y.Js merging of changes to different metadata fields, and will enable the use of Y.Js objects in metadata. (Implements #8804.)

### Important Notes

- Metadata is now set and retrieved through accessors on the `Ast` objects.
- Since some metadata edits need to take effect in real time (e.g. node dragging), new lower-overhead APIs (`commitDirect`, `skipTreeRepair`) are provided for careful use in certain cases.
- The client is now bundled as ESM.
- The build script cleans up git-untracked generated files in an outdated location, which fixes lint errors related to `src/generated` that may occur when switching branches.
2024-02-02 10:22:18 +01:00
Adam Obuchowicz
ed65af7005
CB preview debounce (#8909)
To make engine's life a bit easier, we added 200ms debounce to CB preview updates.
2024-02-01 17:37:00 +00:00
Michał Wawrzyniec Urbańczyk
9a2bb19a89
CI: Native aarch64 macOS builds, refactoring workflow generation (#8864)
This PR adds a native aarch64 target to our release process.

It also includes refactoring of workflow generation and minor tweaks:
* removing some workarounds in the generated action code that are not needed anymore;
* some version bumps that are harmless;
* release builds have cleaning enabled unconditionally.
2024-02-01 13:53:50 +01:00
somebody1234
4f7032f966
Add dashboard tests to GUI2 CI; fix dashboard tests (#8922)
- Close #8911
- Add dashboard unit tests to GUI2 CI
- Add dashboard E2E tests to GUI2 CI
- Fix (minor) issues in dashboard unit tests

# Important Notes
None
2024-02-01 11:03:58 +00:00
somebody1234
41c7b5afb4
Version panel (#8746)
- Closes https://github.com/enso-org/cloud-v2/issues/784
- Add version panel

# Important Notes
- The backend sends an `isLatest` field in the response, but this is currently *not* shown in the UI because I think it isn't particularly useful.
- Versions are displayed in descending order (most recent first)
- Versions have hover effects, but there is not yet any relevant behavior that can be triggered on click.
- The versions breadcrumbs control displays the version number in the Figma design, however it is not yet returned by the cloud backend (and should ideally not take an extra request)
2024-02-01 08:47:43 +00:00
Michael Mauderer
1ba28a3c5c
New scenarios for E2E tests - Displaying Edges (#8904)
Adds e2e test for rendering edges.
2024-01-31 13:42:36 +00:00
somebody1234
cbf6d41e4c
More E2E tests; export default classes from modules (#8730)
This is a prerequisite for adding a CI action for E2E tests.

- Fix E2E tests
- Remove visual regression testing (VRT) and associated fixtures (screenshots) for now
- Switch dashboard almost fully to Vite, from ESBuild, to match GUI2's build tooling.
- Add some new E2E tests:
- Creating assets
- Deleting assets
- Creating assets from the samples on the home page
- Sort assets
- Includes fixes for sorting:
- Group sorted assets by type again (regression) (see https://github.com/enso-org/cloud-v2/issues/554)
- Make sorting by title, case insensitive. This is because it is more intuitive for non-programmers if all items with uppercase names *aren't* separated from those with lowercase names - especially since the Windows FS is case-insensitive.
- Normalization of Unicode letters is *not* currently being done. It can potentially be added later.
- Double-clicking *anywhere* on a directory row now expands it. Previously it was only being expanded when double clicking
- Add recursive label adding/removal to mirror backend
- Note: The current implementation is not exactly the same as the backend's implementation.
- Fix https://github.com/enso-org/cloud-v2/issues/872
- Unset "saved project details" (for opening the last open project) if fetching it produces an error.

# Important Notes
- All tests pass. (run `npm run test:e2e` in `app/ide-desktop/lib/dashboard`)
- All `npm` commands should be run in `app/ide-desktop/lib/dashboard`. `dashboard:*` npm scripts have been removed from `app/ide-desktop` to prevent a mess.
- `npm run dev` confirmed to still work. Note that it has not been changed as it was already using Vite.
- `npm run build` now uses `vite build`. This has been tested using a local HTTP server that supports `404.html`.
- Other cases have been tested:
- `npm run test:e2e` works (all tests pass)
- `./run ide build` works
- `./run ide watch` works
- `./run ide2 build` works
- `./run gui watch` works
2024-01-31 11:35:41 +00:00
Ilya Bogdanov
057bf17ffb
Fix wrapping in doc panel (#8887)
Fixes soft-wrapping of lines in documentation panel.
2024-01-30 15:05:39 +01:00
Ilya Bogdanov
ad6348a12a
Text input widget (#8873)
Closes #8823

https://github.com/enso-org/enso/assets/6566674/966576ec-6507-401c-98d3-bd71c2ffc6b2

Adds a basic text widget for text literals. 

### Important Notes

Several known restrictions:
- Separators would always be replaced with single quotation marks. All types of separators in Enso are supported though, and they would be correctly escaped if needed.
- Logic for widget selection probably needs refinement (works for text literals and `Text` types, but does not work for `Text | Integer`, for example)
- **(!)** There is a very annoying issue when the input field suddenly loses focus, closing the editing mode and discarding any changes. Debugging shows that it happens when we receive an engine update (and probably recreate the node component/widget tree (???)). It requires a separate investigation.
2024-01-30 15:05:28 +01:00
Adam Obuchowicz
2ca4fe94e2
Fix breadcrumbs navigation (#8874)
Fixes #8756

The items were added to stack in wrong order (I wonder how on earth it worked with the engine).
2024-01-29 10:53:44 +00:00
Michael Mauderer
abe0875072
New scenarios for E2E - Displaying proper types on nodes on hover (#8856)
Adds a new test scenario that checks that types are correctly set and displayed after an expression update. Includes checking the string set on the node as well as showing the type label when hovering the output port of a node.
2024-01-29 10:37:44 +00:00
Adam Obuchowicz
ad7fad42fa
Make run button execute in live mode (#8876)
What can I say? It's not quite a bug. Rather a wrong implementation

Anyway, fixes #8810
2024-01-29 09:50:52 +00:00
Adam Obuchowicz
057245ea5e
Fix nested drop downs + test scenarios for drop-down and vector widgets. (#8859)
Part of #8518
Closes #8822

The drop downs were missing, because WidgetFunction had a higher score than them and took precedence. The fix was to adjust scores, so drop down is before both argument name and function. Generally, any widget expecting to "overlap" existing code (and possibly further widgets) should go before WidgetFunction.

# Important Notes
* Extended mockExpressionUpdate to accept a subexpression of a node. Also, I removed it from GraphDb - I want this function to have as little impact on app code as possible.
2024-01-26 17:18:27 +00:00
Kaz Wesley
a04385a6a4
New AST APIs (#8851)
Introduce new AST APIs. They will be used for synchronization in the next PR.

# Important Notes
- `Module.edit` now clones a YDoc containing all the module's data; the resulting `MutableModule` can be edited with mutation APIs.
- Every AST type now has a mutable subtype. These `MutableAst` types expose all editing operations that were previously in `MutableModule`, such as `replace`; they also provide field setters.
2024-01-26 11:32:35 +00:00
Adam Obuchowicz
5dd2dc1c93
Fix gui2 typecheck (#8870) 2024-01-26 09:15:01 +01:00
Ilya Bogdanov
6f51894273
Align collapsed node to the leftmost selected one (#8844)
As discussed on the latest demo.


https://github.com/enso-org/enso/assets/6566674/c68f1df4-285e-413b-b05e-13394dffe3bd
2024-01-25 16:19:41 +01:00
somebody1234
6e7672a424
Add settings page; add endpoints for deleting user and uploading profile picture (#8720)
- Depends on unmerged backend features:
- https://github.com/enso-org/cloud-v2/issues/832
- https://github.com/enso-org/cloud-v2/issues/833
- Close https://github.com/enso-org/cloud-v2/issues/829
- Add scaffold for settings page
- Add endpoint for deleting user
- Add endpoint for uploading profile picture
- Modify API types to add profile picture to user info
- Add shortcuts:
- <kbd>Cmd</kbd>+<kbd>,</kbd> to open settings page (shortcut taken from VS Code)
- <kbd>Esc</kbd> to close settings page
- ℹ️ Note that, while the settings page is considered as a page by the logic, it is not saved for the next session, as the settings page should be a transitional page (it should only ever be open to do one specific task, and then immediately closed again)
- Partly implement https://github.com/enso-org/cloud-v2/issues/840
- Add "members" tab with member list
- Add "Invite Users" button to be able to invite multiple users
- Misc. QoL improvements
- Deselect selections when clicking away from the selection

# Important Notes
None
2024-01-25 15:10:51 +00:00
Adam Obuchowicz
3a849ea01b
Connection and visualization fixes (#8803)
Fixes several points from #8745
* Brought back cursor pointer in full screen visualization
* Changed behavior of edge disconnected from one side: Esc will bring the connection back, while click will remove it (and start creating new node if the source was connected).
* When hovering connection, the "active" part (i.e. the part which will be the hanging connection after click) is in normal color, and the rest is dimmed.

[Screencast from 2024-01-19 09-06-48.webm](https://github.com/enso-org/enso/assets/3919101/6df28a9c-51b3-4f98-be10-a35275eac800)
2024-01-25 14:18:26 +00:00
Ilya Bogdanov
a3873b9565
Numeric input widget (#8837)
Closes #8751
Closes #8752

- The numeric widget allows the use of the input field after clicking with LMB
- Slider is only visible if the engine provides widget configuration with set limits (see below for testing)
- Setting value outside limits is possible
- For now, to distinguish drag from click, we compare relative mouse movement on the mouse up event. We might benefit from using a timer instead, but let’s see how good it is now.
- Changes after demo
- No more input validation. You can enter literally anything and it would be accepted.
- Updates debouncing – the code is updated on defocus or when slider dragging has finished.


https://github.com/enso-org/enso/assets/6566674/b3580083-c678-4734-881c-97f8ac56176b
2024-01-25 09:41:37 +00:00
somebody1234
899f7e4e61
Fix offline detection (#8829)
- Closes https://github.com/enso-org/cloud-v2/issues/860

# Important Notes
None
2024-01-25 06:36:03 +00:00
Kaz Wesley
f88bd90ebb
Refactor for YJs AST (#8840)
Some refactoring separated from #8825 for easier review.

# Important Notes
**ID types**

The new *synchronization IDs* will replace `ExprId` for `Ast` references in frontend logic. `ExprId` (now called `ExternalId`) is now used only for module serialization and engine communication. The graph database will maintain an index that is used to translate at the boundaries. For now, this translation is implemented as a type cast, as the IDs have the same values until the next PR.

- `AstId`: Identifies an `Ast` node.
- `NodeId`: A subtype of `AstId`.
- `ExternalId`: UUID used for serialization and engine communication.

**Other changes**:

- Immediate validation of `Owned` usage.
- Eliminate `Ast.RawCode`.
- Prepare to remove `IdMap` from yjsModel.
2024-01-24 19:22:05 +00:00
Adam Obuchowicz
f5c02d36e2
Fix addRequiredImport so it is not fooled by existing module changes (#8813)
A follow-up of [this comment](https://github.com/enso-org/enso/pull/8740#discussion_r1452282468)

`addRequiredImport` now reads the existing import from the edit instead of taking them from the current module. This way, it will consider any imports added so far as part of this edit.
2024-01-24 12:03:25 +00:00
somebody1234
0a493de012
Update uploaded files (#8797)
- Close https://github.com/enso-org/cloud-v2/issues/856
- Implement upload for existing files
- This is triggered by uploading a file with the same name.
- Add a modal that allows the user to select whether to rename or update the file, for each conflicting file

# Important Notes
- There are a *lot* of buttons in the modal. Any ideas on how to make this screen clearer/simpler/easier to understand would be greatly appreciated.
- There are currently a few minor backend issues preventing all functionality from fully working:
- Projects currently cannot be updated due to a bug
- Neither files nor projects can be uploaded if their name contains `()` - e.g. `foo (2).txt`
2024-01-23 09:55:15 +00:00
somebody1234
5f1333a519
Change dashboard to use 2 spaces for indentation (#8798)
This makes it consistent with the indentation style of GUI2.

# Important Notes
- This commit *will* need to be added to [`.git-blame-ignore-revs`](https://github.com/enso-org/enso/blob/develop/.git-blame-ignore-revs) *after* it is merged.
- This shouldn't need any particular QA (although QA doesn't hurt), as the only thing that was done is a `npx prettier -w .`, meaning that there should be zero logic changes.
2024-01-22 21:26:15 +00:00
somebody1234
bd4f46499f
Remove underscores from default project and folder names (#8819)
- Closes https://github.com/enso-org/cloud-v2/issues/857
- Changes format for new folders from `New_Folder_1` to `New Folder 1`
- Changes format for new projects from `New_Project_1` to `New Project 1`
- Uses names for projects created from templates, rather than `Upper_Snake_Case`d IDs

# Important Notes
- Folders containing spaces work fine on cloud backend
- ⚠️ Unable to test opening a project with a space in its name on the cloud backend.
- Projects containing spaces work (open, edit, and execute fine on local backend
2024-01-22 11:38:15 +00:00
somebody1234
d16a645e8e
Prevent dragging rows when editing, and when on local backend (#8747)
- Fix https://github.com/enso-org/cloud-v2/issues/848
- Disables dragging rows when a row is being edited
- Also disables dragging rows on the local backend, as folders are not yet supported there
- Fix other issues found (not sure if they were introduced by this PR):
- Cut (Cmd+X) does not fade out assets
- Cancelling editing names actually still renames the asset
- Cut/Copy/Paste/Undo shortcuts when renaming *also* trigger "copy assets" (etc.) shortcuts
- Apply suggested QoL improvement:
- Disallow renaming an asset to a blank name (a name consisting only of whitespace). Current (new) behavior is to silently revert the asset name to its original name.

# Important Notes
None
2024-01-22 11:06:45 +00:00
Ilya Bogdanov
d5d4793e0e
Positioning for nodes created when collapsing (#8771)
Closes #8699


https://github.com/enso-org/enso/assets/6566674/82e1bdb3-3f37-4122-9e73-92d39acd0f13
2024-01-18 14:30:13 +00:00
Ilya Bogdanov
f96e5dddd6
e2e tests for collapsing and entering nodes (#8758)
Related to https://github.com/enso-org/enso/issues/8518

These tests already caught one regression in nav breadcrumbs: https://github.com/enso-org/enso/issues/8756

It also provides API for mocking expression updates for arbitrary nodes on the screen. The implementation is a bit convoluted and includes setting a callback on `window`, but it looks like the only possible solution given our architecture and playwright restrictions.
2024-01-18 13:45:18 +00:00
Paweł Grabarz
48a5599eb6
improve argument placeholder resolution for partial applications and … (#8794)
Fixes #8788

- Fixed missing argument lists on constructors, and improved handling for various cases of partially applied functions.
- Extended tests to check for correct `self` argument placeholders.
- Additionally reworked some questionable test code to maintain separation between server and client code.

<img width="1241" alt="image" src="https://github.com/enso-org/enso/assets/919491/5377f57f-18f0-4a50-a8ab-9331862ca547">
2024-01-18 13:13:31 +00:00
AdRiley
ac0d4c9f5f
Make Random.Seed private. Remove unused TEXT_ONLY (#8783)
Random.Seed doesn't work in the GUI and the TEXT_ONLY tag doesn't do anything so it was incorrectly showing up in the component browser.

This MR makes Random.Seed private to hide it from the GUI and completely removes the TEXT_ONLY tag which is unused and unimplemented.
2024-01-17 17:15:51 +00:00
Michael Mauderer
080690b3ad
Fix for code enabling/disabling output context on single node (#8776) 2024-01-17 10:18:40 +00:00
somebody1234
318cc2d81b
Inline Table, TableRow and TableColumn (#8760)
These components are a legacy remnant of the old design, where `Table` needed to be reusable because there was a separate table for each asset type.

# Important Notes
None
2024-01-16 22:13:15 +00:00
Paweł Grabarz
a880fe80b6
[GUI2] Implement proper connect and disconnect operation on argument placeholders (#8731)
- Correctly applying code edits when connecting to argument placeholders or disconnecting existing arguments.
- Prevented the placeholders from temporarily flickering right after the edit operation.
- Rewritten the placeholder argument placing logic to match the old GUI exactly - the argument should never move right after being connected.
- Fixes #8494
- Fixed some cases of ports either not existing, or existing where they shouldn't.
2024-01-16 21:20:43 +00:00
somebody1234
da7dcd8bd5
Rename index.js.gz to entrypoint.js.gz (#8757)
This is required because `index.ts` was renamed to `entrypoint.ts` in order to avoid colliding with the main export of the `enso-dashboard` module, which is used by `gui2` as `dashboard.run()`. This file was renamed in #8587, causing the issue.

Build script changes also included thanks to @mwu-tow.

# Important Notes
This should only affect projects opened against the remote (cloud) backend, meaning that to test this, you should open a project against the cloud backend.
2024-01-16 19:10:49 +00:00
Adam Obuchowicz
db2d3f1d01
Shorter tag values in WidgetSelection (#8740)
Fixes #8727

Ported GUI1 behavior: The tags in WidgetSelection which are fully qualified names have only last segment displayed, and inserted expression is also shorter (with proper import added).

[Screencast from 2024-01-11 15-14-08.webm](https://github.com/enso-org/enso/assets/3919101/afdf2c1a-3110-4ddd-83ff-fd0c3551afb6)
2024-01-15 11:57:24 +00:00
Adam Obuchowicz
b28b743ae4
Set of GUI2 widgets fixes (#8749)
Implements first two points of #8745

1. The fix for drop-down was simple, just stop click propagation
2. The fix for connections was much more complicated. It turned out, that it's about keeping track of hovered ports; when picking an option in WidgetSelection makes the drop-down disappear - but that won't emit `pointerleave` event, so the port was still deemed hovered. Changed the mechanism for tracking hovered port to more "centralized" one.
2024-01-15 08:12:34 +00:00