Commit graph

1494 commits

Author SHA1 Message Date
Jonatan Kłosko 137deeb12f
Enforce string values in dynamic tables (#363)
* Enforce string values in dynamic tables

* Explicitly convert values to string
2021-06-17 18:49:58 +02:00
Jonatan Kłosko 6f724f7146
Make table refetch an optional feature (#358) 2021-06-17 13:21:09 +02:00
Jean Carlos 511a47e238
Add password input (#357)
* Add password input

* Save empty string for password in .livemd file

* Update lib/livebook_web/live/session_live/cell_component.ex

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-06-17 01:30:39 +02:00
Jonatan Kłosko b18c1579bd
Add dynamic table output (#356)
* Add dynamic table output

* Support table name
2021-06-17 01:02:27 +02:00
Wojtek Mach 8cf8f2697c
Use <kbd> for keyboard keys (#351)
* Use <kbd> for keyboard keys

* Show keyboard icon

* Render each key explicitly

* Update lib/livebook_web/live/session_live/shortcuts_component.ex

Co-authored-by: Wojtek Mach <wojtekmach@users.noreply.github.com>

* Add Livebook specific icons to the introductory notebooks

* More updates

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-06-16 13:31:53 +02:00
Jonatan Kłosko e75ef5f339
Add numeric input (#352) 2021-06-16 12:28:47 +02:00
Jonatan Kłosko 2b2d6c9d50
Show consistent user avatar on initial page load (#349) 2021-06-15 19:33:16 +02:00
Jonatan Kłosko adb9612fbe
Add link pointing to a new notebook (#347)
* Add link pointing to a new notebook

* Add test
2021-06-14 21:25:18 +02:00
Jonatan Kłosko 66e2c14ab7
Add notebook on VM introspection (#346)
* Add notebook on VM introspection

* Apply suggestions from code review

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update node setup instructions

* Update lib/livebook/notebook/explore/vm_introspection.livemd

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update node setup instructions

* Remove inspect that may give inconsistent results

* Clarify connecting all nodes

* Livebook application -> Livebook server

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-06-14 21:04:57 +02:00
José Valim e4cd38a1f1 Add portal images, closes #330 2021-06-14 11:37:57 +02:00
Jonatan Kłosko d3b4a8a9e6
Track and garbage collect widgets (#344) 2021-06-11 15:42:41 +02:00
Alexandre Antonio Juca 2acb4020ca
correct spelling mistake, should be list and not lits (#343) 2021-06-11 00:16:18 +02:00
Jonatan Kłosko 6274731c8d Make sure session is forked with complete data 2021-06-10 20:03:47 +02:00
Jonatan Kłosko e02bcce0bf
Drop cell source text from data in LV when no longer needed (#342) 2021-06-10 15:41:40 +02:00
Jonatan Kłosko b0bd7540c0
Compute cell source digest on the client (#341) 2021-06-10 14:54:55 +02:00
José Valim 13108c8591
Update intro_to_vega_lite.livemd (#338) 2021-06-09 23:02:59 +02:00
Jonatan Kłosko e967165999
Add VegaLite intro notebook to the explore section (#335)
* Add VegaLite intro notebook to the explore section

* Update lib/livebook/notebook/explore/intro_to_vega_lite.livemd

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update package list

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-06-09 17:38:49 +02:00
José Valim d0c47557a2
Warning on Mix.install for Mix standalone (#336) 2021-06-09 16:51:53 +02:00
Jonatan Kłosko c4a96bc99c
Add support for Mix runtime as the default one (#334)
* Add support for Mix runtime as a default

* Support default runtime options in the CLI

* Set cell status to queued while runtime is being started

* Clean up tests
2021-06-09 16:24:02 +02:00
José Valim 9eaa98ce56
Portal guide (#318) 2021-06-08 14:53:41 +02:00
Jonatan Kłosko 11246cdb8f
Add an option to preload session images from memory (#329)
* Add an option to preload session images from memory

* Remove images
2021-06-08 13:28:53 +02:00
Jonatan Kłosko 8dea99e600
Support inputs (#328)
* Render basic input

* Make each cell type a separate struct

* Add operation to set input value

* Prototype communication

* Make input name editable

* Refactoring

* Unify cell attribute setters

* IO tests

* Document input communication protocol in Runtime

* Add more tests

* Add persistence

* Fix status update on cell attributes change

* Rework persistence

* Integrate input cell with insert mode

* Add missing users keybinding

* Mimic autofocus for dynamically inserted elements

* Support input type selection

* Support URL input and set up validation

* Convert input error into a more meaningful io error

* Add missing client checks

* Consume every input only once per evaluation

* Fixes
2021-06-08 12:33:50 +02:00
Jonatan Kłosko a8073ceac1
Add attributions to Delta-related packages (#324) 2021-06-06 15:27:09 +02:00
Jonatan Kłosko da64f51589
Show an informative message on completion when there is no runtime (#316) 2021-06-03 19:43:22 +02:00
José Valim fcf53c4bf2
Add a notebook about the unique features behind Elixir and Livebook (#314) 2021-06-03 15:47:33 +02:00
Jonatan Kłosko 91a9f62fb9 Make images in explore cards clickable 2021-06-03 14:55:25 +02:00
Jonatan Kłosko c07da9880c
Update LV version and remove deprecations (#312)
* Bump LiveView

* Remove deprecated socket argument to live_component

* Point to an exact LV version
2021-06-03 13:53:03 +02:00
Jonatan Kłosko f70581f255
Introduce an Explore section (#310)
* Add explore page

* Move sidebar to a configurable component

* Fix homepage test

* Add images

* Store example notebooks in files and make explore notebooks linkable

* Fix tests

* Raise on invalid notebook slug

* Keep just the file contents in notebook info

* Move notebook lookup to Explore

* Exclude notebooks in progress
2021-06-02 21:51:43 +02:00
José Valim 69890cf43e
Allow errors on boot to be reported (#311)
Because we unregistered standard_error, if there
was an error booting livebook, we would fail to
print the error. This commit makes sure the original
standard error is added back whenever the proxy
process terminates.
2021-06-02 19:01:45 +02:00
Jonatan Kłosko 80bed1aa06
Delegate output formatting rules to Kino (#309)
* Delegate output formatting rules to Kino

* Update naming

* Group output components and views

* Fallback to inspect when Kino.Render.to_output/1 fails

* Update naming

* Add reference to Kino
2021-06-01 17:47:03 +02:00
Brett Cannon 5f041d219a
Clarify/tweak some comments (#308)
* Clarify a comment for live_markdown.ex

* Tweak grammar for docs of notebook_from_markdown()
2021-05-31 22:49:56 +02:00
Jonatan Kłosko ce7adef7e4
Add VegaLite widget integration (#306)
* Add support for LiveWidget.VegaLite

* LiveWidget -> Kino

* Show an error when rendering unsupported Kino widget

* Match on Kino.Widget

* Add catch-all for unknown outputs
2021-05-31 22:48:05 +02:00
Jonatan Kłosko d6c9ab1783
Ensure hostname is properly resolved when running in shortname distribution (#303)
* Ensure hostname is properly resolved when running in shortname distribution

* Update lib/livebook/application.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Pretty print host resolution error

* Add missing env var

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-05-28 13:41:08 +02:00
Qiu Hua 605c5e397e
fix a display bug when the message wider than the window (#304) 2021-05-28 13:04:07 +02:00
Benjamin Philip 26226a42e0
Update Welcome Notebook (#299)
TeX uses the words 'inline and display math', replace 'formula' with these.
2021-05-26 19:57:47 +02:00
Jonatan Kłosko a7e1d8ba9a
Capture logger output (#298)
* Capture logger output

* Add capture integration test
2021-05-26 19:54:43 +02:00
Jonatan Kłosko 617a51e723
Fix completion shortcut listing for mac (#291) 2021-05-24 15:45:28 +02:00
Brian Underwood 8dfe12da68
Change anchor tags for sections to be based on the titles, not randomly generated (#288)
* Change anchor tags for sections to be based on the titles, not randomly generated

* Update lib/livebook_web/helpers.ex

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-05-23 18:22:55 +02:00
Jonatan Kłosko 7804ff1d82
Set up Vega-Lite plots rendering (#287)
* Set up Vega-Lite plots rendering

* Automatically recognise VegaLite specification

* Improve matching VegaLite result

* Update naming

* StringFormatter -> DefaultFormatter
2021-05-21 17:51:31 +02:00
Jonatan Kłosko 1a1057153e
Optimise data view recomputation for delta operations (#286)
* Optimise data view recomputation for delta operations

* Use generic access_by_id/1 for nested updates

* Use access_by_id/1 for nested notebook updates

* Use Enum.split_while
2021-05-21 14:56:25 +02:00
José Valim 7416975376
Infer short vs longname from actual node and use longname in example (#284) 2021-05-21 13:03:47 +02:00
José Valim 00edceafc9
Update import URL text (#282) 2021-05-21 08:11:53 +02:00
Jonatan Kłosko 74702a4583 Fix assets path in development 2021-05-20 12:28:00 +02:00
Jonatan Kłosko 406c17dc43 Build assets to tmp/static_dev in development 2021-05-19 23:50:18 +02:00
Jonatan Kłosko 889503ad68
Require Elixir v1.12 (#278)
* Require Elixir v1.12

* Update introductory notebook

* Update base Docker images

* Add completion of reserved module attributes

* Move complete_module_attribute/1
2021-05-19 16:46:33 +02:00
Jonatan Kłosko 38db12fbcc
Direct non-captured output to the terminal (#273) 2021-05-16 17:07:19 +02:00
Jonatan Kłosko 61a841a6d2
Handle output even after cell finishes evaluation (#272) 2021-05-15 19:55:25 +02:00
Jonatan Kłosko ea93edcc86
Add embedded runtime for evaluating code in the Livebook VM (#266)
* Add embedded runtime for evaluating code in the Livebook VM

* Update lib/livebook_web/live/session_live/embedded_live.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Use standard error proxy globally in the Livebook node

* Add configuration env variable for setting the default runtime

* Increase evaluation response assertion timeouts

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-05-10 14:37:38 +02:00
José Valim 1c45d0777a
Update welcome.ex (#263) 2021-05-07 17:17:49 +02:00
Jonatan Kłosko cd80bd7804
Implement user cursor and selection tracking (#260)
* Implement user cursor and selection tracking

* Separate jump-to-user and follow
2021-05-07 16:41:37 +02:00
José Valim c7887a57de Remove sleep from tests 2021-05-07 08:57:39 +02:00
Benjamin Philip ec07e4749a
Use a node pool for node names (#256) 2021-05-07 08:43:36 +02:00
Jonatan Kłosko 5c8e117800
Setup user profiles (#253)
* Add initial user config modal

* Assign user ids

* Update session data to hold user ids

* Get users list for specific ids

* Render user avatar

* User update

* Refactor user changes

* Subscribe to individual user updates

* Show users in side panel

* Add sidebar to homepage

* Don't generate the same color twice in a row

* Add documentation notes

* Fix tests

* Add tests

* Keep users in session data

* Rename color to hex_color
2021-05-03 20:03:19 +02:00
Jonatan Kłosko 3694576244
Require cookie for connecting to an attached node (#245)
* Require cookie for connecting to an attached node

* Fix modals sizing
2021-04-28 14:28:28 +02:00
José Valim 5fede30764 Format 2021-04-28 14:10:52 +02:00
José Valim 2792280e3d
Show how to run tests in notebooks (#153)
This requires Elixir v1.12-rc.1.
2021-04-28 14:05:25 +02:00
Jonatan Kłosko ac8e1e30f4
Setup Docker image with releases (#244)
* Setup Docker image with releases

* Support ip env variable and use it for Docker deployment

* Autofocus auth forms

* Rename ip env var

* Update option lists

* Make distribution cookie configurable

* Update README.md

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Include git in the final image

* Remove unnecessary build dependency

* Improve file permissions handling and add more comments

* Use namespaced home directory

* Update README with all running options

* Update base image

* Reference official Docker image in the README

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-04-27 16:34:02 +02:00
Jonatan Kłosko cc2820f17e
Add anchor links to sections (#243) 2021-04-26 15:24:43 +02:00
Javier Goday 790b9e764b
Feature cell link (#239)
* #99: Add anchor links to sections and cells

* Restores some css classes removed by error

* Focus cell based on anchor link

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-04-26 14:22:33 +02:00
Akash Hiremath a2eb269cec
Fix undefined function warning (#241) 2021-04-26 08:59:46 +02:00
Wojtek Mach c3a0b7c01d
Add autofocus to import inputs (#240) 2021-04-24 11:15:37 +02:00
Jonatan Kłosko aaba58a933
Set up importing notebook from URL or clipboard (#237)
* Set up importing notebook from URL or clipboard

* Extract loading functions into separate module

* Replace import icon with text

* Add TLS peer verification

* Remove unnecessary tests setup step
2021-04-23 17:40:13 +02:00
Jonatan Kłosko e755ff8122
Restructure settings (#233)
* Force menu items into a single line

* Add shortcut for saving the notebook

* Make the disk icon always show file dialog

* Split runtime and file settings into separate modals

* Add ctrl+s to the shortcuts list

* Add togglable menu to the session page

* Make sure newly saved file appears in the file selector

* Fix path seletor force reloading

* Remove notebook generated in tests

* Add test for file list refresh after save
2021-04-21 23:02:09 +02:00
Jonatan Kłosko 91af8a46ed Make the sidebar floating on small screens 2021-04-21 17:42:03 +02:00
José Valim 02f46fd912 Improve responsive features 2021-04-21 13:50:55 +02:00
Jonatan Kłosko dd7453c706 Improve homepage responsiveness 2021-04-21 12:43:43 +02:00
José Valim 982759844f Do not tab over file container (it does so on Firefox) 2021-04-21 12:34:49 +02:00
José Valim 48b611faeb Run formatter 2021-04-21 12:17:35 +02:00
Benjamin Philip d41f3a73fe Beautify match file selector results
- Makes the file selector results to have a "box"/"container" of its own

- Seperates the filtred files from rest of the files with a border

- Optimize path selector to only traverse the filesystem if the directory
  changes
2021-04-21 12:16:28 +02:00
Jonatan Kłosko 193050cae5 Don't print token in URL when disabled 2021-04-21 00:04:17 +02:00
Jonatan Kłosko 5dd3b82e1f
Don't register named supervisors on remote node (#230) 2021-04-20 20:03:13 +02:00
Jonatan Kłosko 700987dc02
Add editor completion to Elixir cells (#208)
* Implement editor completion for Elixir cells

* Add completion tests

* Refactor completion

* Only extract Markdown docs for now

* Fix Elixir version-dependent test

* Fix docs matching

* Use upcoming Code.cursor_context/2

* Start temporary completion processes under a supervisor

* Show Erlang docs in completion items

* Update to latest Code.cursor_context

* Refactor completion

* Fix module completion when alias expands to Erlang module

* Remove tests-generated notebook

* Show variables and map fields differently

* Adjust signatures formatting
2021-04-20 19:34:17 +02:00
Jonatan Kłosko 04edc75181
Scroll to section when moved (#226) 2021-04-20 19:31:23 +02:00
Jonatan Kłosko 44eda43d02
Fix markdown line breaks rendering (#227) 2021-04-20 19:31:02 +02:00
Frank Hunleth b1ceedc220
Ignore RFC 1468 switch to ASCII code sequence (#225)
This ignores "\e(B" which sometimes shows up even when the other RFC
1468 Japanese character set switch codes aren't used. This also updates
defmodifier so that it can be used with non-CSI escape codes (the
ones that start with '[').
2021-04-20 15:05:30 +02:00
Jonatan Kłosko 5100d2723a Fix invalid File.get_cwd! call 2021-04-20 14:17:09 +02:00
Frank Hunleth 0f49351c3b
Handle a short ANSI reset ("\e[m") (#220)
It's legal to omit the 0 in the "\e[0m" sequence to reduce the number of
bytes needed to reset the terminal. See
https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences
and a simple explanation and the cited reference for a more involved
one.
2021-04-20 14:16:21 +02:00
Benjamin Philip 682ee396d0
Allow re-ordering of sections (#221)
* Allow server-side re-ordering of sections

* `Livebook.Notenook.move_section` definition
* Management and implementation of requests
* tests

This commit allows a person to send a request to the server to move a
section. However, the functionality in not yet available in the UI.

* Allow "Move up" and "Move down" functionality for sections

* Rendering of up and down "arrows" at Section's side
* Request from UI on click

This commit enables a user to move a section upwards or downwards, much
like a cell. However, after the section moves, the focus is not changed
to it.

* Apply formatting

* Define a function to update cell status

* Defines a common function for `move_cell` and `move_section` to use to
update cell status.
2021-04-20 12:12:29 +02:00
José Valim 81b123d5b5
Make root path configurable from outside (#217) 2021-04-19 19:50:09 +02:00
Juha 08c4025bd7
Remove assumption about root path (#209) 2021-04-17 20:32:19 +02:00
Frank Hunleth 73caecc7f1
Fix typos in comments (#207) 2021-04-17 00:40:30 +02:00
José Valim c4d06d877e Move auth to its own view
Prior to this PR the HTML head was being
included twice on the password auth page.
One from root.html and another from the
error page, so we decoupled those.
2021-04-16 22:18:59 +02:00
José Valim d00393ca86 Keep uppercase letters together 2021-04-16 22:18:59 +02:00
José Valim 8a17130391
Improvements to runtime initialization (#201)
1. Do not use nouse_stdio as it causes slowdowns when IEx
   is also running

2. Reduce the amount of generated random atoms by using the
   child_node as the name of the parent process

3. Do not pass quoted strings nor newlines to Windows to eval,
    use argv instead

Closes #194.
2021-04-16 12:31:25 +02:00
Cheng Zhe f06891cd6d
Fix typo on notebook cell (#200)
Fix typo on notebook cell
2021-04-16 08:05:35 +02:00
José Valim 101f582196
Use known cookie when starting runtimes (#199) 2021-04-15 20:09:54 +02:00
Jonatan Kłosko d6e9c36571 Use password input for entering passphrase 2021-04-15 16:19:17 +02:00
José Valim 57047f9c7f
Unify env variables and change auth to use session (#195) 2021-04-15 15:50:29 +02:00
Frank Hunleth 3a19021983
Support config of the root path for storing notebooks (#191)
This adds a `:root_path` key to the application environment so that
file dialogs can default to known location where notebooks are stored.
2021-04-15 14:51:27 +02:00
Jakub Perżyło a9c8e20775
Password access (#187) 2021-04-15 14:15:56 +02:00
José Valim dee372c623
Improve error message if we can't boot epmd, closes #196 (#197) 2021-04-15 11:42:56 +02:00
José Valim 5190e01db7 Remove unused root module 2021-04-15 11:30:24 +02:00
José Valim 31e16f6b93 Fix typo on CLI entries 2021-04-15 09:06:01 +02:00
Cheng Zhe d3ffb7978d
Rename litebook_cli.ex to livebook_cli.ex (#174)
Rename litebook_cli.ex to livebook_cli.ex
2021-04-15 08:56:49 +02:00
Cheng Zhe 9978d29831
Fix spec error type (#181) 2021-04-15 08:56:20 +02:00
Cheng Zhe bfaf6b7776
Fix spec in delta operation (#193) 2021-04-15 08:56:03 +02:00
Cheng Zhe 9b0ac23c2c
Fix typo in delta operation docs (#192) 2021-04-15 08:55:43 +02:00
Jonatan Kłosko 69343bfc3c
Link to live dashboard for each running session to show process info (#186)
* Link to live dashboard for each running session to show process info

* Update lib/livebook_web/live/home_live/sessions_component.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-04-14 22:37:17 +02:00
James Baldwin 9c6d747aca
Remove extra word in comment (#185) 2021-04-14 21:02:47 +02:00
Jakub Perżyło a3c55a801d
Add live dashboard (#183) 2021-04-14 20:10:25 +02:00
Jonatan Kłosko 9e026ee4b9
Make sure write-protected files can only be forked (#182)
* Format file errors into readable messages

* Make sure write-protected files can only be forked

* Show tooltip when the file is write protected
2021-04-14 16:27:35 +02:00
Michał Gibowski 539cb8e2b1
Fix some typos in moduledocs (#180) 2021-04-14 13:40:32 +02:00
TED 623c5b3290
Add notbook runtime settings shortcut (#176) 2021-04-14 12:20:51 +02:00
Jonatan Kłosko 2887527dc9
Fix sections sidebar overflow (#171) 2021-04-14 11:35:54 +02:00
Jonatan Kłosko 252642f601
Start standalone runtimes as hidden nodes (#172) 2021-04-14 11:23:05 +02:00
Alexandre Antonio Juca 5f3230f7aa
Add spelling corrections to welcome livebook (#169) 2021-04-14 00:17:20 +02:00
Jonatan Kłosko d8213c3f68
Change wording from delete session to close session (#160) 2021-04-12 23:24:26 +02:00
Jonatan Kłosko 5f5ef1d0b6
Improve path selector (#159)
* Synchronously save file when the location is chosen and fix default path

* Handle enter press in the path selector
2021-04-12 22:59:48 +02:00
Jonatan Kłosko c6f9c54f31
Buffer IO evaluation output (#156)
* Buffer IO evaluation output

* Respect CR in IOProxy

* Handle CR when adding cell output rather than during each render

* Optimise CR handling in buffer
2021-04-12 17:56:40 +02:00
Wojtek Mach caea9610ad
Update Welcome notebook (#154) 2021-04-09 15:24:41 +02:00
Jonatan Kłosko d68c271aae
Add support for math formulas (#151)
* Add support for LaTeX equations

* Mention math support in the introductory notebook
2021-04-08 15:31:46 +02:00
Jonatan Kłosko e9766ed7a5
Introduce token auth and add basic cli configuration (#148)
* Add token authentication

* Restructure CLI

* Allow port configuration

* Further refactoring

* Make sure livebook node starts with unique name

* Improve startup error handling

* Further refactoring

* Add authentication tests

* Add authentication view for entering the token

* Fix auth tests

* Always use random Livebook name for distribution

* Don't enable ANSI on Windows

* Define CLI Task behaviour and move generic logic to the main module

* Generalize convertion from cli arguments to configuration

* Randomly generate secret key base

* Update test/livebook_web/plugs/auth_plug_test.exs

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Override app config in persistent manner

* Update lib/litebook_cli.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Move auth error to ErrorView

* Unify node name configuration and allow it via CLI

* Set all applications configs at once

* Move token generation to application.ex to work outside CLI

* Clean up overriding configuration

* Store auth token in separate cookies

* Update lib/livebook_cli/server.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/endpoint.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/plugs/auth_plug.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-04-08 11:41:52 +02:00
Jonatan Kłosko b3661ed2f0
Make failed evaluations preserve evaluation context (#145) 2021-04-05 17:01:07 +02:00
Jonatan Kłosko 70be004ee0
Make autoscroll behaviour more intuitive (#143)
* Fix editor shift

* Make autoscrolling more intuitive
2021-04-05 15:06:14 +02:00
Jonatan Kłosko 7d1d1f4d98
Respect CR in cell output (#137)
* Respect CR in cell output

* Update test/livebook_web/helpers_test.exs

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Improve rewind implementation

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-04-04 21:22:28 +02:00
Jonatan Kłosko d93b5d8450
Set up image uploads for Markdown content (#132)
* Add cell image upload modal

* Add controller for serving the images and handle this on markdown side

* Use per-session images dir

* Add etag header to session image responses

* Adjust markdown image styling

* Properly manage session images dir

* Add tests

* Set maximum file size for image uploads

* Move images dir specifics to the Session module

* Move images when nonpersistent session becomes persistent

* Update lib/livebook_web/live/session_live.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/live/session_live.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/live/session_live/cell_upload_component.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Test that close gets rid of session temporary dir

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-04-04 18:55:51 +02:00
José Valim 5fb753c4d1
Logo and README (#133) 2021-04-04 12:42:46 +02:00
Jonatan Kłosko 9ec80acc63
Design adjustments (#131)
* Add full logo to the homepage

* Update sidebar active icon style

* Update lib/livebook_web/live/home_live.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-04-02 14:54:14 +02:00
José Valim 931d55a8b8
Minor nits on welcome notebook (#130) 2021-04-02 14:09:28 +02:00
Jonatan Kłosko cc9d5a8103
Prevent from scrolling to top on modal open (#129)
* Render modal components at the end of live views

* Add error pages

* Restructure web module

* Update lib/livebook_web/templates/error/500.html.eex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/templates/error/500.html.eex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/views/error_view.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-04-02 14:00:49 +02:00
Jonatan Kłosko 0fbeb42d24 Fix some typos in the Welcome notebook 2021-04-01 17:01:18 +02:00
Jonatan Kłosko 59fefc1980
Highlight results in path selector (#128)
* Highlight results in path selector

* Increase highlight contrast
2021-04-01 15:49:39 +02:00
Jonatan Kłosko 5efd8eb851
Notebook status indicators (#127)
* Add notebook indicators

* Make evaluation status button point to the corresponding cell

* Rename introductory notebook

* Update path highlight when chosen for saving

* Allow specifying nonexistent directories when saving and create those

* Update lib/livebook_web/live/session_live/indicators_component.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/live/session_live/indicators_component.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/live/session_live/indicators_component.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/live/session_live/indicators_component.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/live/session_live/indicators_component.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-04-01 12:56:19 +02:00
Jonatan Kłosko 4e90666350
Fix pressing insert button when in markdown insert mode (#126) 2021-03-30 22:16:42 +02:00
Jonatan Kłosko 5c5b4ece26
Add "Hello Livebook" notebook (#123)
* Limit module result to a single line

* Add introductory notebook to get started with

* Don't show tooltip on focused elements

* Update lib/livebook/notebook/hello_livebook.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook/notebook/hello_livebook.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook/notebook/hello_livebook.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update notebook settings reference

* Add note on package authors

* Add tests

* Update Phoenix version to git master

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-03-30 21:42:02 +02:00
José Valim 83a092fa38
Reduce space between section header and first paragraph (#124)
* Reduce space between section header and first paragraph

* Remove mb-1 on markdown

Because of line height, there is already enough spacing
between the buttons and the content.
2021-03-30 12:35:11 +02:00
Jonatan Kłosko a1bf2d999e
Handle evaluator process failures (#121)
* Handle evaluator process failures

* Add test

* Use Exception.format_exit/1
2021-03-29 19:52:06 +02:00
Jonatan Kłosko e335ecb791
Focus notebook name after creation (#122) 2021-03-29 19:50:46 +02:00
Jonatan Kłosko 143cd5d80f
Optimise rendering and diff by stripping data into view-specific struct (#119)
* Optimise rendering and diff by stripping data into view-specific struct

* Move data to socket.private
2021-03-25 23:29:22 +01:00
Jonatan Kłosko de83020d05
Home tests (#118)
* Test forking existing session

* Test session deletion

* Fix capitalization
2021-03-25 19:04:49 +01:00
Jonatan Kłosko 0983a9df77
Add confirmation for session deletion (#117)
* Update sections panel

* Add deletion confirm and unify buttons

* Align notebook title

* Fix whitespace shrinking in the editor

* Update session deletion route
2021-03-25 17:39:18 +01:00
Jonatan Kłosko 9a1fab7b59
Diffing optimisation (#116)
* Make buttons group component back stateful

* Move buttons rendering to the buttons group component

* Move cell status to its own component

* Revert cell status component
2021-03-24 22:26:26 +01:00
Jonatan Kłosko fe5dfe3b86
Insert section (#114)
* Add section insertion button

* Add shortcut for inserting section

* Pass buttons to the component

* Add mix alias for running both formatter

* Adjustments

* Make the buttons group component stateless
2021-03-24 18:37:50 +01:00
Jonatan Kłosko 50db813092
Show reconnect button when connecting to a matching runtime (#113)
* Show reconnect button when connecting to a matching runtime

* Add runtime config test
2021-03-23 19:41:03 +01:00
Jonatan Kłosko a18122cfcb
Further redesign (#112)
* Update logo and favicon

* Tiny updates

* Replace checkbox with switch button

* Build assets

* Move assets/static to priv/static

* Update lib/livebook_web/endpoint.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-03-23 17:46:33 +01:00
Jonatan Kłosko 92c34b8718
Add shortcuts for toggling sections panel and showing settings (#110)
* Add shortcuts for toggling sections panel and showing settings

* List new shortcuts
2021-03-23 15:27:03 +01:00
Jonatan Kłosko ad99680a82
Remove trailing newline in captured outputs (#111)
* Remove trailing newline in captured outputs

* Use String.replace_suffix/3
2021-03-23 14:43:16 +01:00
Jonatan Kłosko af79a0fd2f
Improve tab navigation (#109)
* Ignore editor for tab movement

* Improve tab behaviour within notebook

* Highlight focused regular buttons

* Show tooltips on focused elements
2021-03-23 14:10:34 +01:00
Jonatan Kłosko 6d56ef141b
Add tooltips (#107) 2021-03-22 22:15:40 +01:00
Jonatan Kłosko 4061802220
Automatically scroll output (#106) 2021-03-22 16:23:42 +01:00
Jonatan Kłosko 9e69e8f096
Add changed cell indicator (#105) 2021-03-22 15:43:31 +01:00
Jonatan Kłosko 5e20541774
Set proper file in env when the notebook is persisted (#95)
* Set proper file in env when the notebook is persisted

* Fix typo
2021-03-21 16:53:00 +01:00
Jonatan Kłosko 8217fdd118
Don't show explicitly ignored result (#94)
* Don't show explicitly ignored evaluation results

* Fix multiline ANSI formatting with virtualized lines

* Add reference to IEx.Helpers

* Fix typo
2021-03-20 16:48:23 +01:00
Jonatan Kłosko 90e7941fe4
Redesign (#80)
* Update cell actions

* Add new focus indicator

* Update headings typography

* Update cell actions and insert buttons

* Add sidebar menu

* Add settings modal

* Update homepage

* Update settings dialog

* Rename classes

* Add floating menu

* Update icon colors on hover

* Fix homepage tests

* Format assets source

* Update monaco editor

* Fix editor width on resize

* Add more padding to the notebook content

* Update settings dialog title

* Show reevaluate button when the cell is in evaluated state

* Show section actions on focus or hover only

* Pre-fill runtime selector with the current configuration

* Ignore cmd + enter in Markdown cells
2021-03-20 14:10:15 +01:00
Jonatan Kłosko 8b3a7bec6b
Don't check request origin for WebSockets connection (#78) 2021-03-17 11:16:40 +01:00
Jonatan Kłosko 8b37e32e3a
Escript (#77)
* Set up Escript packaging

* Use MD5 digest sa ETAG

* Make sure changes to the static files recompile the relevant module

* Manually start the application in Escript

* Set up basic CLI

* Run formatter

* Start Elixir app before anything else

* Improve version output

* Build Escript to project root directory

* Improve assets handling

* Move plug related modules under plugs directory

* Include bundled assets in the repository

* Use the same plug with different static providers in prod and dev

* Refactor providers

* Rename StaticProvidedPlug to StaticPlug
2021-03-17 01:53:44 +01:00
Jonatan Kłosko 7fa2b44666
Highlight viewed section within the list (#76)
* Add fallback primary fonts

* Highlight viewed section in the navbar

* Fix moving cells with empty sections

* Reword attribute
2021-03-12 16:40:37 +01:00
Jonatan Kłosko a2d1e2f934
Initial redesign (#75)
* Add Remix icons

* Replace existing icons with Remix icons

* Update fonts

* Redesign homepage

* Redesign shortcuts modal

* Fix tests
2021-03-12 11:57:01 +01:00
Jonatan Kłosko 266bf35bd0
Move focus navigation to the client (#74)
* Show all sections and enable cross-section focus navigation

* Move focus to the client

* Add shortcut for evaluating all cells

* Fix and expand tests

* Make section links scroll to the given section
2021-03-11 15:28:18 +01:00
Jonatan Kłosko ac9b5526fe
Make evaluation linear (#73)
* Evaluate stale cells that the run cell depends on

* Make evaluation linear
2021-03-09 19:35:39 +01:00
Jonatan Kłosko e65a5f712c
Virtualize output lines (#70)
* Virtualize output lines

* Remove unused dependency

* Remove VirtualizedLinesComponent

* Pass lines as HTML nodes and use as template

* Validate hook children

* Refactor markup
2021-03-04 22:09:57 +01:00
Jonatan Kłosko 199602016c
Optimise inspect coloring (#69) 2021-03-04 11:22:03 +01:00
Jonatan Kłosko 0b6e8f7ef2 Update web client title to Livebook 2021-03-03 23:22:53 +01:00
Jonatan Kłosko dae6d5c9c3
Rename project (#68)
* Rename references

* Update file and directory names

* Fix homepage tests
2021-03-03 22:56:28 +01:00
Jonatan Kłosko 33409e7564
Format Elixir code in exported LiveMarkdown (#40)
* Format Elixir code in exported LiveMarkdown

* Make it possible to disable code formatting for Elixir cells

* Add tests
2021-03-03 22:23:48 +01:00
Jonatan Kłosko 1996dfada9
Extend ANSI codes support (#67)
* Extend ANSI escape codes support

* Add tests

* Apply suggestions
2021-03-03 14:22:49 +01:00
Jonatan Kłosko 90a7b599df
Fix new cell/section focus (#66)
* Add pid to data operations and use that in post-operation hooks

* Fix tests
2021-03-02 08:50:31 +01:00
Jonatan Kłosko 228c279cea
Keep editor focus when cell actions are executed (#65) 2021-03-01 18:48:19 +01:00
Jonatan Kłosko ca520cf481
Add buttons for moving cell (#64) 2021-03-01 18:17:24 +01:00
Jonatan Kłosko d93ab41e7a
Implement reordering cells using keyboard (#63)
* Implement moving cells with keyboard shortcuts

* Add tests for cell movement operation

* Refactor

* Does not mark cells as stale if Elixir cells did not change order
2021-03-01 13:29:46 +01:00
Jonatan Kłosko 663ec3283e
Support starting runtime in Mix context (#61)
* Prototype standalone mode with mix

* Move runtime initialization into separate LiveViews

* Make standalone node initialization async

* Refactor async node initialization

* Automatically scroll to the bottom of output

* Refactor streaming output

* Move MessageEmitter under Utils

* Add path selector to the mix runtime picker

* Update runtime descriptions

* Add successful or error message at the end of output

* Run formatter

* Rename Standalone to ElixirStandalone for consistency

* Show only directories when looking for a mix project

* Update docs

* Extract shared standalone logic

* Make the remote primary process monitor Manager instead of session

* Further refactoring and docs

* Add tests for collectable Callback

* Add missing macro doc

* Apply review suggestions

* Decouple sending asynchronous notifications from the runtime initialization

* Apply suggestions
2021-02-26 20:53:29 +01:00
Jonatan Kłosko d2cd541ce1
Fixes (#62)
* Ignore compilation warnings in the Evaluator tests

* Make Cmd + Enter evaluate cell even in navigation mode

* Fix homepage responsiveness

* Improve setting insert mode with mouse
2021-02-26 20:39:32 +01:00
Jonatan Kłosko 9fed524ed5
Markdown snippets (#56)
* Extend LiveMarkdown format to support Elixir snippets in Markdown cells

* Highlight Markdown code blocks using Monaco editor API

* Use livebook metadata for forcing markdown as well
2021-02-24 15:41:00 +01:00
Jonatan Kłosko cc630dc9da
Show stderr output (#58)
* Implement IODevice forwarding requests to sender's group leader

* Register custom standard error handler for connection lifetime

* Add tests

* Refactor IOForwardGL
2021-02-24 15:37:35 +01:00
Jonatan Kłosko efd58466f2
Purge old deltas (#57)
* Keep track of connected clients in session data

* Add API for confirming and purging deltas

* Send delta confirmation from clients once received

* Update naming

* Fix and extend Data tests

* Update naming
2021-02-23 21:20:46 +01:00
Jonatan Kłosko 780ca84500
Support ANSI escape codes (#55)
* Implement ANSI to HTML converter

* Enable ANSI escape codes by default in the standalone runtime
2021-02-22 22:08:02 +01:00
Jonatan Kłosko 207f168239
Don't warn on module redefinition (#52) 2021-02-22 15:18:37 +01:00
Jonatan Kłosko dc1930634f
Add UI for cancelling evaluation (#51)
* Add icon for cancelling cell evaluation

* Add shortcut for cancelling evaluation

* Test cancellation
2021-02-22 14:21:28 +01:00
Jonatan Kłosko c1eafc9a2c
Save notebook and notify clients when session is stopped (#45) 2021-02-21 19:17:14 +01:00
Jonatan Kłosko 0925ec77cd
Implement notebook persistence and import (#44)
* Basic filesystem navigation

* Add file picker modal

* Implement autosave when dirty and show the status

* Add hompage link in the session view

* Improve file picker and use in both places

* Move session list to homepage

* Some refactoring

* Show import messages if any

* Fix and extend tests

* Show a message when there are no sessions running

* Rename import to fork and make that clear in notebook name

* Fix old route

* Show info when no file is connected to the given session

* Show runtime type next to filename

* Show button for joining session when a running path is selected

* Move modal components to SessionLive namespace

* Add FileGuard to lock files used for notebook persistence

* Use radio for specifying persistence type

* Don't lock nil path

* Simplify FileGuard implementation

* Test notebook persistence

* Fix typo

* Further simplify FileGuard

* Improve file listing

* Don't show parent dir when there's a basename being typed

* Add path component tests
2021-02-21 16:54:44 +01:00
Jonatan Kłosko 77675ad61e
UI polishing (#43)
* Tiny UI improvements

* Add icon for entering insert mode on a markdown cell

* Highlight selected section

* Improve contenteditable elements

* Highlight notebook/section name while editing
2021-02-18 15:11:24 +01:00
Jonatan Kłosko 0b77fd4279
Add keyboard shortcuts help modal (#41)
* Update keybindings and add help modal

* Add more evaluation shortcuts

* Add shortcut to the help modal

* Show appropriate shortcuts depending on the user system

* Handle missing user-agent header

* Conditionally render shortcut based on user agent

* Implement vim-style navigation

* Remove warning

* Determine platform based on socket on mount

* Improve shortcuts list UI
2021-02-18 13:14:09 +01:00
Jonatan Kłosko 6ac7f94897
Define notebook file format (#27)
* Initial file import/export

* Add renderer tests

* Refactor renderer

* Depend only on EarmarkParser

* Add test for export

* Add import tests

* Improve import

* Document the ExMd file format

* Rename ExMd to ExMarkdown

* Rename ExMarkdown to LiveMarkdown

* Build iodata when exporting a notebook

* Persist metadata as a single JSON object

* Move Markdown to LiveMarkdown.MarkdownHelpers

* Make LiveMarkdown private

* Always move primary heading to the top during import

* Hint the user not to use heading 1 and 2

* Return a list of messages from the import function

* Update headings warning

* Add import and export test for non-elixir snippets

* Merge markdown renderer into MarkdownHelpers

* Add import messages on AST rewrites
2021-02-16 18:39:52 +01:00
José Valim 309c9c8a51
Update to Elixir v1.11 and remove unused files (#32) 2021-02-16 12:29:41 +01:00
Jonatan Kłosko 85806f5e03
Make the Delta behavior consistent for client and server (#26) 2021-02-11 22:02:07 +01:00
Jonatan Kłosko 9d3a2ae264
Some cleanups (#25)
* Remove old js files

* Cleanup styles

* Update page title

* Unify elements rounding

* Fix indentation

* Rename component modules

* Add actions to routes for better helpers
2021-02-11 16:35:32 +01:00
Jonatan Kłosko b487fe6104
Extend Evaluator with response formatter (#23) 2021-02-11 14:04:29 +01:00
Jonatan Kłosko c05ed1c29c Update filenames, remote -> erl_dist 2021-02-11 12:47:30 +01:00
Jonatan Kłosko 79e5c432b3
Move evaluation to a separate Elixir runtime (#20)
* Isolate evaluation in separate node for each session

* Start new remote upon first evaluation and handle nodedown

* Add UI for managing evaluation node, improve naming and structure

* Show runtime initialization errors and some fixes

* Improve standalone node initialization

* Correctly handle multiple sessions connecting to the same node

* Fix session tests concerning evaluation

* Documentation and some refactoring

* Various improvements

* Configure schedulers to get to sleep immediately after evaluation

* Move EvaluatorSpervisor into the Remote namespace

* Fix evaluators cleanup

* Add tests

* Improve flash messages

* Introduce remote genserver taking care of cleanup

* Redefine the Runtime protocol to serve as an interface for evaluation

* Cleanup operations

* Use reference for communication with a standalone node

* Use shortnames for distribution by default

* Update node configuration and make sure epmd is running

* Rename Remote to ErlDist
2021-02-11 12:42:17 +01:00
Jonatan Kłosko 8acb483bcd
Improve keyboard navigation and focus (#19)
* Adjust result length

* Add more keyboard navigation actions

* Improve inserted/deleted cells focus and add some tests

* Some refactoring

* Run formatter
2021-02-04 16:01:59 +01:00
Jonatan Kłosko a8b5227dd6
Use inspect to highlight cell result (#18)
* Use inspect to highlight cell result

* Use invalid UTF-8 byte for color separation

* Match editor typography in cell output
2021-02-03 13:13:56 +01:00
Jonatan Kłosko 77b60c8110
Integrate evaluation into UI (#17)
* Render evaluation outputs and result

* Fix auto-scrolling to not be interrupted by editor focus

* Add cell output tests

* Run formatter

* Show cell status

* Apply review suggestions

* Change EEx strings to Live EEx
2021-02-02 19:58:06 +01:00
Jonatan Kłosko 936d0af5fb
Set up markdown rendering (#16)
* Set up markdown rendering, update theme.

* Improve focus and handle expanding for markdown cells

* Add keybindings for expanding/navigating cells

* Improve editor autofocus when navigating with shortcuts

* Add tests

* Render markdown on the client

* Don't render cell initial data and make a request instead
2021-01-30 00:33:04 +01:00
Jonatan Kłosko 3e6a4adce2
Implement collaborative text editing (#10)
* Set up editor and client side delta handling

* Synchronize deltas on the server

* Document the client code, add more tests

* Implement delta on the server, use compact representation when transmitting changes

* Simplify transformation implementation and add documentation

* Add session and data tests

* Add more delta tests

* Clean up evaluator tests wait timeout
2021-01-21 13:11:45 +01:00
Jonatan Kłosko 80cd651b0f
Setup initial session UI (#9)
* Sync session data within LV client

* Add basic session UI

* Add operations for setting notebook and section name

* Update notebook and section name from the UI

* Some cleanup

* Return current data upon client registartion to avoid race conditions

* Small fixes
2021-01-17 22:03:03 +01:00
Jonatan Kłosko 0e593c3719
Split cell status into validity status and evaluation status (#8) 2021-01-15 12:03:01 +01:00
Jonatan Kłosko 8beeb48d1b
Implement evaluation cancellation (#7)
* Implement evaluation cancellation

* Forger cell evaluation on deletion

* Further operation fixes

* Implement new side effects approach
2021-01-14 19:41:11 +01:00
Jonatan Kłosko 00b06f6e7a
Define session data structure and implement several operations (#6)
* Define session data structure and some operations

* Make code evaluation request async, so that we don't need an intermediary process

* Simplify id typespecs

* Make operation application composable

* Keep a separate evaluation queue per section and actually support concurrent evaluation

* Small fixes

* Validate queued cell type and set evaluation timestamp

* Apply review suggestions

* Add tests

* Store evaluating_cell_id instead of section status

* Add dynamic supervisor for managing evaluator processes

* Some fixes

* Refactor operation application

* Upon cell deletion mark dependent cells as stale
2021-01-13 14:39:04 +01:00
Jonatan Kłosko 88d194af80
Introduce the evaluator process (#5)
* Add code evaluation server

* Capture evaluator standard output and send to the caller

* Return full error info from evaluator

* Add support for deleting evaluation from hitory

* Fix a typo

* Start IOProxy once per Evalutor

* Apply review suggestions
2021-01-11 12:05:05 +01:00
Jonatan Kłosko 464e30fa98
Add initial notebook data structure (#4)
* Add initial notebook data structure

* Move required frields out of metadata
2021-01-08 15:24:13 +01:00
Jonatan Kłosko 5cdcb15e3d
Add module for managing multiple running sessions (#3)
* Add dynamic supervisor for session processes

* Add basic UI listing current sessions

* Handle review comments

* Make tests not dependent on restarting SessionSupervisor
2021-01-08 14:14:26 +01:00
Jonatan Kłosko 5877180934
Set up assets and layout (#2) 2021-01-07 22:13:17 +01:00
José Valim 2dd88ec017 Add LiveView 2021-01-07 21:16:54 +01:00
José Valim 79792777a7 Initial commit 2021-01-07 20:56:24 +01:00