Commit Graph
1250 Commits
Author SHA1 Message Date
David Lechner 8ffaf64292 fileStorage: add file create option
When opening a file, sometimes we want to create it if it does not
exist and sometimes we don't.
2022-04-08 18:29:05 -05:00
David Lechner e0a6926d01 explorer: implement duplicate file feature 2022-04-08 18:11:09 -05:00
David Lechner 30741b13ef explorer: drop rename feature
It turns out that renaming files while they are open is technically
difficult problem. We will forgo this feature for now.
2022-04-08 14:30:21 -05:00
David Lechner d238e68deb explorer: new delete alert dialog
This replaces the delete notification with a new alert dialog. This
makes for better keyboard interaction and forces the user to make a
decision before doing anything else.

Also fixes closing the editor before deleting the file.
2022-04-08 12:53:12 -05:00
David Lechner 1c30683b93 explorer: fix wrong file names 2022-04-08 11:58:13 -05:00
David Lechner 825607952f newFileWizard: doc comments 2022-04-08 11:22:46 -05:00
David Lechner 2536e17865 explorer: fix click propagating from action buttons
When the tree item actions buttons were clicked, they were also clicking
the underlying tree item.
2022-04-08 11:04:39 -05:00
David Lechner fad7b0114a explorer/newFileWizard: refactor
This refactors the new file wizard to be more independent. Most of the
control is now done through the saga instead of splitting it between
react and the sagas.

Also fix a few issues while we are touching this:
- pressing enter now accepts the dialog
- newly created file is now activated in the editor
2022-04-08 10:52:54 -05:00
David Lechner 8ac77560fb editor: add tabs for controlling open/active files 2022-04-07 21:17:09 -05:00
David Lechner 56858390ca notifications: allow viewing stack trace of unexpected error
Previously, it was only possible to view the stack trace by clicking
the copy button and pasting it somewhere.
2022-04-07 11:24:07 -05:00
David Lechner c29ca56658 utils: fix defined()
NonNullable means both not undefined and not null.
2022-04-06 18:16:21 -05:00
David Lechner 158e8f2693 fix typo 2022-04-06 09:01:14 -05:00
David Lechner da7e983ad2 yarn: drop navigator.locks patch
The fix was merged upstream.
2022-04-05 18:52:59 -05:00
David Lechner 89a2019a98 explorer: add action for activating file
this simply forwards the action to the editor module
2022-04-05 18:10:06 -05:00
David Lechner 48bc6dbe4d explorer: sort actions
the rename actions were not grouped all together
2022-04-05 17:46:05 -05:00
David Lechner 76eade2038 index: drop react-complex-tree css
since we are using a custom renderer, we are not using any of this css.
2022-04-05 17:33:24 -05:00
David Lechner 626dc82b6b tree-renderer: better workaround for focus manager
Changing the focus manager at runtime doesn't work as expected, so we
work around with a css hack instead.
2022-04-05 17:31:47 -05:00
David Lechner 6289f1df92 utils/tree-renderer: do not make icon focusable 2022-04-05 11:13:42 -05:00
David Lechner 6e55be056c explorer/reducers: don't use FileMetadata
This separates the explorer files state from the fileStorage FileMetadata.
The latter contains extra info that the explorer doesn't need. This
will prevent rerendering each time the file contents change.
2022-04-05 10:52:11 -05:00
David Lechner c6cf0608f4 explorer: move files state from fileStorage
This state should be exclusivly used to for displaying files in the
explorer, so the state should be in the explorer branch of the
reducer tree.
2022-04-04 18:59:13 -05:00
David Lechner 05731e50fc explorer: split archive saga from fileStorage
This splits the fileStorage archive into two sagas to separate concerns.
fileStorage now just gives a dump of the database and explorer deals
with the user interaction and zipping.
2022-04-04 17:48:36 -05:00
David Lechner 7cb0cf3151 test: clean up restoreAllMocks()
clearAllMocks() does not remove mock implementations, so we need to be
using restoreAllMocks() instead. Also ensure that it is called first
in case the other cleanup code needs to call a mocked function.
2022-04-04 15:51:57 -05:00
David Lechner b9dbaaa5cb fileStorage: implement file locks
This breaks down reading and writing into low-level and high level sagas.

Opening now takes a lock on the file so that it can only have one writer
or have multiple readers. The low-level read and write sagas use the
file descriptor to determine if the file is still open before actually
performing the action.

Since we are using the web locks api, these locks should work across
browser tabs/windows.

The high-level read/write sagas perform the low-level open, read/write,
close operations in a single call.

The high-level delete and rename sagas are also updated to take locks
on the files while performing the respective operations and will fail
if the file is already being used somewhere else.
2022-04-04 15:24:08 -05:00
David Lechner 7ef08122e8 explorer: move export from fileStorage 2022-04-01 18:45:24 -05:00
David Lechner 1709591afc fileStorage: untangle file id/name
We were using file UUID and path interchangeable. This adds a new UUID
type for static checking and fixes a bunch of issues found.
2022-04-01 17:24:00 -05:00
David Lechner daa6c07910 yarn: update react-complex-tree 2022-04-01 14:42:18 -05:00
David Lechner 5f29165bc3 craco: add missing dexie-observable license
Also throw error on missing (default was only warning).
2022-04-01 14:03:30 -05:00
David Lechner 1515e5ae4f fileStorage: add file handles
This changes how files work. There is now an open function that
translates a path to a file handle (id). Then this handle is used
to perform other actions on the file. The file contents are moved
to a separate table so that the actual file storage is independent
of the database (e.g. in the future, we may use File Access API).

We store a hash of the file contents in the metadata file so we can
detect file changes without having to compare file contents.

We also separate the change and add actions.
2022-04-01 13:41:10 -05:00
David Lechner 75c3efc5ba fileStorage: replace localforage with dexie
This gives us more fine-grained control over database transaction and
cross-tab notifications and will facilitate upgrading the database with
new metadata in the future.
2022-03-28 17:04:45 -05:00
David Lechner b6990d6a2c fixup! craco: add upper-case license 2022-03-28 12:11:01 -05:00
David Lechner 110d93860a test: add timeout to saga take
This will crash tests sooner and give a stack track at the crash point
instead of waiting the default 5 seconds for the entire test to timeout
(which doesn't give a stack trace of where the test was when it timed
out).
2022-03-28 11:48:08 -05:00
David Lechner 07a03d4ea7 drop FirmwareSagaContext
This context is not exclusive to the firmware sagas.
2022-03-26 16:10:28 -05:00
David Lechner 54a475cebc drop 'editor' saga context
This is no longer used.
2022-03-26 13:52:33 -05:00
David Lechner c158e4f0e2 editor: add editorGetValue() saga
This is another step towards removing the 'editor' context.
2022-03-26 13:44:55 -05:00
David Lechner 79d5b06136 editor: move isReady state from app
This is a step towards getting rid of the 'editor' context.
2022-03-26 12:03:08 -05:00
David Lechner 3eac7d384f fileStorage/sagas: remove editor init from fileStorage
This is still a bit of a hack but is one step towards being able to
remove the 'editor' context.
2022-03-26 11:49:23 -05:00
David Lechner 0715ce3de1 drop settingsToggleShowDocs
We can change the event handler in App.tsx do we no longer need the
settingsToggleShowDocs action or related sagas.
2022-03-25 18:05:03 -05:00
David Lechner 3c48d115d7 editor/Editor: use hooks to configure editor
This fixes the issue of the editor not being updated when properties
change.
2022-03-25 17:49:56 -05:00
David Lechner 2be1c26f82 editor/Editor: drop unused argument 2022-03-25 16:26:56 -05:00
David Lechner 08abd5d277 explorer/fileNameFormGroup: add test 2022-03-25 15:54:05 -05:00
David Lechner 4193383dec explorer/Explorer: hoist button translations
This makes for fewer props to pass.
2022-03-25 15:54:05 -05:00
David Lechner 60c0c820e6 explorer/sagas: rename tests 2022-03-25 15:54:04 -05:00
David Lechner f36e774d1e coverage: ignore useI18n 2022-03-25 15:54:04 -05:00
David Lechner 5dd61fa4c3 toolbar/buttons: consolidate buttons 2022-03-25 15:54:04 -05:00
David Lechner 9d995ceeef craco: add upper-case license 2022-03-25 15:54:04 -05:00
David Lechner 9f254f035f i18n: use babel-loader plugin 2022-03-25 15:54:04 -05:00
David Lechner 45d0b4071a spelling 2022-03-25 15:54:04 -05:00
David Lechner b16298b08f explorer/renameFileDialog: isolate
This provides more separation between the explorer and the rename file
dialog. This makes writing tests easier and make reading the code easier.
2022-03-25 15:54:04 -05:00
David Lechner 549fe88a00 fileStorage/actions: fix duplicate type 2022-03-21 20:19:43 -05:00
David Lechner 7abdcf85e7 LicenseDialog: make license list keyboard accessible 2022-03-19 21:20:02 -05:00