Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/datasette/datasette-write-ui

A Datasette plugin that adds UI elements to edit, insert, or delete rows in SQLite tables
https://github.com/datasette/datasette-write-ui

Last synced: 2 months ago
JSON representation

A Datasette plugin that adds UI elements to edit, insert, or delete rows in SQLite tables

Awesome Lists containing this project

README

        

# datasette-write-ui

[![PyPI](https://img.shields.io/pypi/v/datasette-write-ui.svg)](https://pypi.org/project/datasette-write-ui/)
[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-write-ui?include_prereleases&label=changelog)](https://github.com/datasette/datasette-write-ui/releases)
[![Tests](https://github.com/datasette/datasette-write-ui/workflows/Test/badge.svg)](https://github.com/datasette/datasette-write-ui/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-write-ui/blob/main/LICENSE)

A Datasette plugin that adds UI elements to edit, insert, or delete rows in SQLite tables.

## Installation

This plugin requires the alpha version of Datasette 1.0. You can install it with:

```bash
pip install datasette==1.0a3
```

After that, you can install this plugin in the same environment as Datasette.

```bash
datasette install datasette-write-ui
```

## Usage

Once installed, the new UI elements will appear on the table page. You'll need special permission in order to see them. The easiest way is to [use the root user](https://docs.datasette.io/en/latest/authentication.html#using-the-root-actor), or otherwise use a [custom actor](https://docs.datasette.io/en/latest/authentication.html#actors).

If you actor has the `insert-row` permissions, you'll see the "Insert new row" button at the bottom of the page.

If your actor has the `update-row` permissions, you'll see a new "Edit row" option in a new menu on each row.

If your actor has the `delete-row` permissions, you'll see a new "Delete row" option in a new menu on each row.

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd datasette-write-ui
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```
pip install -e '.[test]'
```
To install the JavaScript build dependencies, run this:
```bash
npm install
```
You can use the [Just](https://github.com/casey/just) command runner to build the TypeScript to minified JavaScript like this:
```bash
just js
```
To run the tests:
```bash
pytest
```