Administration UI for Datascript, Datahike, and other Datalog databases
(ns your-app
(:require
[io.homebase/datalog-console.integrations.datascript :as datalog-console]))
; e.g. enable the message handlers on a datascript db conn
(datalog-console/enable! {:conn conn})
>=0.7.0
>=1.0.0-beta.81
Visit a url with a Datalog DB that has the datalog-console
integration (such as this homebase-react
example todo app)
You will see a green dot appear next to the icon with the following pop up message upon clicking the extension.
You will find 3 views in the Datalog DB panel.
If a schema exists in the database it will use this and in the case of schema on read it will also infer the schema based on contents of the database.
An example of Schema inference.
Renders a list of entities found in the database. Clicking on any of these entities renders them in the Entity view.
Directly look up an entity by id
or unique attribute
. This renders a tree view of an entity where you can also traverse it's reverse references.
Make sure you have Java and the Clojure CLI installed. There are ways to get by without these given this project mostly relies on Javascript, but using the Clojure JVM CLI allows us to resolve dependencies in a more flexible way, which comes in really handy when developing across dependencies.
yarn install
yarn dev
When running for the first time you will want to run Tailwind to generate the styles.
yarn build:tailwind:dev
chrome://extensions/
your-file-path-to/datalog_console/shells/chrome
To view the datalog panel open the Chrome console with either of these options.
You can connect a repl to each process by opening new windows in your terminal and doing the following.
yarn repl-background
- for the background pageyarn repl-panel
- for the devtool panel consoleYou can also connect your editor connected repl. Selecting build chrome
gets you background and chrome-devtool
gets you the panel.
There is 3 runtime environments and 4 environments which both send and receive messages.
The first one you only have access to via postMessage to the window. You also get read and write access to the DOM (used to signal from the external Application environment that a Datalog DB is available). This is all done through Content script
. Messages between the Chrome panel
and Content script
must go through Background script
.
(Fig: 1) - To view the background page go to chrome://extensions/
and click here:
about:debugging#/runtime/this-firefox
your-file-path-to/datalog_console/shells/chrome
Refer to runtime evironments to find where code is executed.
(Fig: 2) - To view the background page go to about:debugging#/runtime/this-firefox
and click here:
Can you improve this documentation? These fine people already did:
Chris Smothers & groundedSAGEEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close