diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml deleted file mode 100644 index c20fa7ad23..0000000000 --- a/.github/workflows/deploy-docs.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: deploy-docs -on: - push: - branches: - - master -permissions: - contents: write -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - run: pip install -r ./docs/requirements.txt - - working-directory: ./docs - run: mkdocs gh-deploy --strict --force diff --git a/db/sql/00_msar.sql b/db/sql/00_msar.sql index 9633e0f710..dea812a9ba 100644 --- a/db/sql/00_msar.sql +++ b/db/sql/00_msar.sql @@ -1246,7 +1246,8 @@ Args: Membership will be revoked for existing members not present in this array. */ DECLARE - parent_role_info jsonb := msar.get_role(parent_rol_id::regrole::text); + parent_role_name text := msar.get_role_name(parent_rol_id); + parent_role_info jsonb := msar.get_role(parent_role_name); all_members_array bigint[]; revoke_members_array bigint[]; set_members_expr text; @@ -1273,7 +1274,7 @@ BEGIN ); EXECUTE set_members_expr; -- Return the updated parent_role info including membership details. - RETURN msar.get_role(parent_rol_id::regrole::text); + RETURN msar.get_role(parent_role_name); END; $$ LANGUAGE plpgsql RETURNS NULL ON NULL INPUT; diff --git a/docker-compose.yml b/docker-compose.yml index 7ff8c91d71..d1560a986c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -144,7 +144,7 @@ services: # service: container_name: mathesar_service - image: mathesar/mathesar-prod:latest + image: mathesar/mathesar-testing:latest environment: # First we load the variables configured above. <<: *config diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000000..d97e100637 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +site \ No newline at end of file diff --git a/docs/docs/api/rpc.md b/docs/docs/api/rpc.md index dc27780336..b01c54193e 100644 --- a/docs/docs/api/rpc.md +++ b/docs/docs/api/rpc.md @@ -2,7 +2,7 @@ Mathesar has an API available at `/api/rpc/v0/` which follows the [JSON-RPC](https://www.jsonrpc.org/specification) spec version 2.0. -!!! caution "Not yet stable" +!!! danger "Not yet stable" The RPC API is not yet stable and may change in the future. If you build logic that depends on this API, be mindful that it may change in the future without warning or notice. ## Usage diff --git a/docs/docs/assets/releases/0.2.0-testing.1/create-link-changes.png b/docs/docs/assets/releases/0.2.0-testing.1/create-link-changes.png new file mode 100644 index 0000000000..271f306dac Binary files /dev/null and b/docs/docs/assets/releases/0.2.0-testing.1/create-link-changes.png differ diff --git a/docs/docs/assets/releases/0.2.0-testing.1/db-settings-collaborators.png b/docs/docs/assets/releases/0.2.0-testing.1/db-settings-collaborators.png new file mode 100644 index 0000000000..8fbb6676b5 Binary files /dev/null and b/docs/docs/assets/releases/0.2.0-testing.1/db-settings-collaborators.png differ diff --git a/docs/docs/index.md b/docs/docs/index.md index ea09a26144..8706f8e88d 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -1,5 +1,10 @@ # Mathesar Documentation +!!! question "Help us get our beta out sooner – send us feedback!" + You're looking at the documentation for our **✨ new test build ✨**, see [release notes here](releases/0.2.0-testing.1.md). + + For a timely and stable beta release, we need feedback from as many users as possible about how this new version of Mathesar is working for you. Let us know on [this GitHub discussion](https://github.com/mathesar-foundation/mathesar/discussions/3956) or drop us a line at . + ## Welcome! Mathesar is a self-hostable open source project that provides a spreadsheet-like interface to a PostgreSQL database. Our web-based interface helps you and your collaborators set up data models, edit data, and build custom reports — no technical skills needed. You can create a new PostgreSQL database while setting up Mathesar or use our UI to interact with an existing database (or do both). @@ -17,7 +22,7 @@ This is a quick way to play with Mathesar locally, but is not appropriate for sa 1. With [Docker](https://docs.docker.com/get-docker/) installed, run: ``` - docker run -it --name mathesar -p 8000:8000 mathesar/mathesar-prod:latest + docker run -it --name mathesar -p 8000:8000 mathesar/mathesar-testing:latest ``` 1. Visit [http://localhost:8000/](http://localhost:8000/) to set up an admin user account and create a database connection. diff --git a/docs/docs/installation/build-from-source/index.md b/docs/docs/installation/build-from-source/index.md index e28efe0bf7..49b43a651a 100644 --- a/docs/docs/installation/build-from-source/index.md +++ b/docs/docs/installation/build-from-source/index.md @@ -1,5 +1,8 @@ # Install Mathesar from source on Linux +!!! danger "Not a stable release" + This is a testing build released with the goal of gathering feedback from our community. It has **[many known issues](https://github.com/mathesar-foundation/mathesar/issues?q=is%3Aissue+milestone%3Av0.2.0-testing.2+)** and is not recommended for production use. + !!! warning "For experienced Linux sysadmins" To follow this guide you need be experienced with Linux server administration, including the command line interface and some common utilities. @@ -23,7 +26,7 @@ You should have **root access** to the machine you're installing Mathesar on. You'll need to install the following system packages before you install Mathesar: -- [Python](https://www.python.org/downloads/) 3.9, 3.10, or 3.11 +- [Python](https://www.python.org/downloads/) 3.9, 3.10, or 3.11 (along with appropriate [`venv`](https://docs.python.org/3/library/venv.html) module) !!! note "Python version" @@ -39,6 +42,8 @@ You'll need to install the following system packages before you install Mathesar - [GNU gettext](https://www.gnu.org/software/gettext/) (Verify with `gettext --version`) +- [unzip](https://packages.debian.org/search?keywords=unzip) A utility tool to de-archive .zip files (Verify with `unzip -v`) + ### Domain (optional) If you want Mathesar to be accessible over the internet, you'll probably want to set up a domain or sub-domain to use. **If you don't need a domain, you can skip this section.** @@ -129,14 +134,14 @@ Then press Enter to customize this guide with your domain name. git clone https://github.com/mathesar-foundation/mathesar.git . ``` -1. Checkout the tag of the latest stable release, `{{mathesar_version}}`. +1. Check out the tag of the release or build you'd like to install, `{{mathesar_version}}`. ``` git checkout {{mathesar_version}} ``` !!! warning "Important" - If you don't run the above command you'll end up installing the latest _development_ version of Mathesar, which will be less stable. + If you don't run the above command you'll end up installing the latest _development_ version of Mathesar. 1. We need to create a python virtual environment for the Mathesar application. @@ -177,23 +182,31 @@ Then press Enter to customize this guide with your domain name. Your `.env` file should look something like this ``` + SECRET_KEY='REPLACE_THIS_WITH_YOUR_RANDOMLY_GENERATED_VALUE' DOMAIN_NAME='xDOMAIN_NAMEx' ALLOWED_HOSTS='xDOMAIN_NAMEx' - SECRET_KEY='REPLACE_THIS_WITH_YOUR_RANDOMLY_GENERATED_VALUE' # REPLACE THIS! POSTGRES_DB=mathesar_django POSTGRES_USER=mathesar - POSTGRES_PASSWORD=mathesar1234 # Do not use this password! + POSTGRES_PASSWORD=REPLACE_THIS_WITH_APPROPRIATE_PASSWORD_FOR_THE_CHOSEN_POSTGRES_USER POSTGRES_HOST=localhost POSTGRES_PORT=5432 ``` !!! tip - You can generate a [SECRET_KEY variable](../../configuration/env-variables.md#secret_key) by running: + To generate a [`SECRET_KEY`](../../configuration/env-variables.md#secret_key) you can use this [browser-based generator](https://djecrety.ir/) or run this command on MacOS or Linux: ``` echo $(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 50) ``` + !!! tip + If you want to host Mathesar on multiple domains/subdomains you can do so by adding multiple comma separated domain names to the following env variables without a whitespace: + + ``` + DOMAIN_NAME='xDOMAIN_NAMEx,xDOMAIN_NAMEx.example.org' + ALLOWED_HOSTS='xDOMAIN_NAMEx,xDOMAIN_NAMEx.example.org' + ``` + 1. Add the environment variables to the shell You need to `export` the environment variables listed in the `.env` file to your shell. The easiest way would be to run the below command. @@ -290,7 +303,7 @@ Then press Enter to customize this guide with your domain name. 1. Check the logs to verify if Gunicorn is running without any errors ``` - journalctl --priority=notice --unit=gunicorn.service + journalctl --unit=gunicorn.service ``` ### Set up the Caddy reverse proxy @@ -307,7 +320,7 @@ Then press Enter to customize this guide with your domain name. 2. Add the configuration details to the CaddyFile ``` - https://xDOMAIN_NAMEx { + $DOMAIN_NAME { log { output stdout } @@ -385,7 +398,7 @@ Then press Enter to customize this guide with your domain name. 1. Check the logs to verify if Caddy is running without any errors ``` - journalctl --priority=notice --unit=caddy.service + journalctl --unit=caddy.service ``` ### Set up your user account diff --git a/docs/docs/installation/docker-compose/index.md b/docs/docs/installation/docker-compose/index.md index bb9cab73fd..c94849f1d2 100644 --- a/docs/docs/installation/docker-compose/index.md +++ b/docs/docs/installation/docker-compose/index.md @@ -1,5 +1,8 @@ # Install Mathesar via Docker Compose +!!! danger "Not a stable release" + This is a testing build released with the goal of gathering feedback from our community. It has **[many known issues](https://github.com/mathesar-foundation/mathesar/issues?q=is%3Aissue+milestone%3Av0.2.0-testing.2+)** and is not recommended for production use. + ## Prerequisites {% include 'snippets/docker-compose-prerequisites.md' %} diff --git a/docs/docs/releases/0.2.0-testing.1.md b/docs/docs/releases/0.2.0-testing.1.md new file mode 100644 index 0000000000..2ea7fcfcef --- /dev/null +++ b/docs/docs/releases/0.2.0-testing.1.md @@ -0,0 +1,234 @@ +# 🧪 Mathesar 0.2.0-testing.1 + +!!! danger "Not a stable release" + This is a testing build released with the goal of gathering feedback from our community. It has **[many known issues](https://github.com/mathesar-foundation/mathesar/issues?q=is%3Aissue+milestone%3Av0.2.0-testing.2+)** and is not recommended for production use. + +## Summary + +**Mathesar 0.2.0-testing.1** provides an early preview of improvements we plan to release in our beta version. We have a brand new access control system based entirely on PostgreSQL database permissions, and we've also made major improvements to the responsiveness of the Mathesar UI. We've also built out a new RPC API, and we're deprecating our REST API in favor of it. + +_This page provides a comprehensive list of all changes in the release._ + +## Installing 0.2.0-testing.1 + +You will need to create a new installation of Mathesar to use this version, which you can do via [Docker Compose](../installation/docker-compose/index.md) or [from source](../installation/build-from-source/index.md). + +We do not support upgrading from previous versions to `0.2.0-testing.1`. + +## Improvements + +### Access control based on PostgreSQL roles and privileges + +We have a brand new access control system based entirely on PostgreSQL database roles and privileges. Mathesar users must now be assigned a database role, and any operations performed by the user through the Mathesar UI will connect to the database using that role. + +![image](../assets/releases/0.2.0-testing.1/db-settings-collaborators.png) + +This gives Mathesar several new capabilities. Database administrators can set up access control directly on the database and use those roles in Mathesar. Mathesar also supports setting up PostgreSQL roles and privileges via the UI, including granular access control at the individual table level. + +This replaces our previous access control system (which was enforced at the API layer, and only supported permissions at the database and schema levels). It also eliminates the need for Mathesar to use a database superuser for day-to-day operations. + +More detailed documentation can be found in our User Guide under [Permissions](../user-guide/permissions.md) and [Users](../user-guide/users.md). + +------ + +- Initial permissions remodel _[#3626](https://github.com/mathesar-foundation/mathesar/pull/3626 "Initial permissions remodel")_ +- Implement RPC method for listing roles in server _[#3663](https://github.com/mathesar-foundation/mathesar/pull/3663 "Implement RPC endpoint for listing roles in server")_ +- Initial `database_setup` RPC methods _[#3665](https://github.com/mathesar-foundation/mathesar/pull/3665 "Initial `database_setup` RPC functions")_ +- Cast OID values to bigint in msar.get_roles _[#3667](https://github.com/mathesar-foundation/mathesar/pull/3667 "Cast OID values to bigint in msar.get_roles")_ +- RPC methods for servers, collaborators _[#3684](https://github.com/mathesar-foundation/mathesar/pull/3684 "Endpoints for servers, collaborators")_ +- RPC methods for configured roles _[#3685](https://github.com/mathesar-foundation/mathesar/pull/3685 "Endpoints for configured roles")_ +- Remove existing permissions logic on the frontend _[#3689](https://github.com/mathesar-foundation/mathesar/pull/3689 "Remove existing permissions logic on the frontend")_ +- Homepage changes for database connections _[#3710](https://github.com/mathesar-foundation/mathesar/pull/3710 "Homepage changes for database connections")_ +- Homepage UI _[#3711](https://github.com/mathesar-foundation/mathesar/pull/3711 "Homepage UI")_ +- Implement `database_privileges.list_direct` RPC method. _[#3750](https://github.com/mathesar-foundation/mathesar/pull/3750 "Implement `database_privileges.list_direct` RPC endpoint.")_ +- Implement `database_privileges.get_owner_oid_and_curr_role_db_priv` RPC method _[#3760](https://github.com/mathesar-foundation/mathesar/pull/3760 "Implement `database_privileges.get_owner_oid_and_curr_role_db_priv` RPC endpoint")_ +- Database page role configuration, collaborators, roles _[#3762](https://github.com/mathesar-foundation/mathesar/pull/3762 "Database page role configuration, collaborators, roles")_ +- Implement `roles.add` RPC endpoint _[#3769](https://github.com/mathesar-foundation/mathesar/pull/3769 "Implement `roles.add` RPC endpoint")_ +- Add `database_privileges.replace_for_roles` RPC method. _[#3781](https://github.com/mathesar-foundation/mathesar/pull/3781 "Add `database_privileges.replace_for_roles` RPC function.")_ +- Add `schema_privileges.replace_for_roles` RPC method _[#3786](https://github.com/mathesar-foundation/mathesar/pull/3786 "Add `schema_privileges.replace_for_roles` RPC function")_ +- Move DB page contexts to the route level _[#3789](https://github.com/mathesar-foundation/mathesar/pull/3789 "Move DB page contexts to the route level")_ +- Add privilege information fields _[#3795](https://github.com/mathesar-foundation/mathesar/pull/3795 "Add privilege information fields")_ +- Database permissions modal - 'Share' tab _[#3810](https://github.com/mathesar-foundation/mathesar/pull/3810 "Database permissions modal - 'Share' tab")_ +- Implement `transfer_ownership` for schemas and tables _[#3833](https://github.com/mathesar-foundation/mathesar/pull/3833 "Implement `transfer_ownership` for schemas and tables")_ +- Implement permissions modal for schemas and tables _[#3836](https://github.com/mathesar-foundation/mathesar/pull/3836 "Implement permissions modal for schemas and tables")_, _[#3838](https://github.com/mathesar-foundation/mathesar/pull/3838 "Implement permissions modal for schemas and tables")_ +- Allow setting owner at creation _[#3840](https://github.com/mathesar-foundation/mathesar/pull/3840 "Allow setting owner at Creation")_ +- Implement `roles.delete`, `databases.drop` & `databases.configured.disconnect` RPC methods _[#3858](https://github.com/mathesar-foundation/mathesar/pull/3858 "Implement `roles.delete`, `databases.drop` & `databases.configured.disconnect` endpoints")_ +- Implement 'Transfer ownership' tabs _[#3859](https://github.com/mathesar-foundation/mathesar/pull/3859 "Implement 'Transfer ownership' tabs")_ +- Permission checks in all pages, disconnect database option _[#3861](https://github.com/mathesar-foundation/mathesar/pull/3861 "permission checks in all pages, Disconnect database option")_ +- Bugfix `get_current_role` when only one role exists _[#3869](https://github.com/mathesar-foundation/mathesar/pull/3869 "Bugfix `get_current_role` when only one role exists")_ +- Grant appropriate permissions for `msar`, `__msar` and `mathesar_types` to `PUBLIC` _[#3881](https://github.com/mathesar-foundation/mathesar/pull/3881 "Grant appropriate permissions for `msar`, `__msar` and `mathesar_types` to `PUBLIC`")_ +- Filter databases for admin and standard users _[#3895](https://github.com/mathesar-foundation/mathesar/pull/3895 "Filter databases for admin and standard users")_ +- Fix logic in `get_current_role` _[#3922](https://github.com/mathesar-foundation/mathesar/pull/3922 "Fix logic in `get_current_role`")_ +- Fix quoting for role grant/revoke expressions _[#3931](https://github.com/mathesar-foundation/mathesar/pull/3931 "Fix quoting for role grant/revoke expressions")_ + +### Performance improvements and RPC API + +We've made major improvements to the responsiveness of the Mathesar UI. Loading data and data entry should be much more snappy, and importing data into Mathsar is around 50 times faster. We've also eliminated the need to manually sync database schema changes to Mathesar, any DDL changes will be reflected in the UI automatically. + +To achieve these performance benefits, we needed to overhaul our backend architecture and API. We have built out a new RPC API and our frontend UI now primarily uses that API. The RPC API [has some documentation here](../api/rpc.md), but should not be considered stable yet. + +Most of our REST API endpoints are now deprecated and will be removed soon. The `/users/` and `/data-files/` endpoints remain in use. + +- Connections RPC front end _[#3543](https://github.com/mathesar-foundation/mathesar/pull/3543 "Connections RPC front end")_ +- Exception handler tests _[#3547](https://github.com/mathesar-foundation/mathesar/pull/3547 "Exception handler tests")_ +- Fix SQL syntax highlighting in VS code for SQL tests _[#3588](https://github.com/mathesar-foundation/mathesar/pull/3588 "Fix SQL syntax highlighting in VS code for SQL tests")_ +- Remove dead front end API client code to GET one schema _[#3589](https://github.com/mathesar-foundation/mathesar/pull/3589 "Remove dead front end API client code to GET one schema")_ +- Implement `tables.delete` RPC method _[#3608](https://github.com/mathesar-foundation/mathesar/pull/3608 "Implement `tables.delete` RPC endpoint")_ +- Implement `schemas.delete` RPC method _[#3610](https://github.com/mathesar-foundation/mathesar/pull/3610 "Implement `schemas.delete` RPC method")_ +- Implement `tables.get` RPC method _[#3612](https://github.com/mathesar-foundation/mathesar/pull/3612 "Implement `tables.get` RPC endpoint")_ +- Implement `tables.add` RPC method _[#3614](https://github.com/mathesar-foundation/mathesar/pull/3614 "Implement `tables.add` RPC endpoint")_ +- Add `columns.patch` RPC method _[#3615](https://github.com/mathesar-foundation/mathesar/pull/3615 "Add `columns.patch` RPC function")_ +- Add `columns.add` RPC method _[#3616](https://github.com/mathesar-foundation/mathesar/pull/3616 "Add `columns.add` RPC function")_ +- Implement `tables.patch` RPC method _[#3618](https://github.com/mathesar-foundation/mathesar/pull/3618 "Implement `tables.patch` RPC endpoint")_ +- Implement `schemas.add` RPC method _[#3620](https://github.com/mathesar-foundation/mathesar/pull/3620 "Implement `schemas.add` RPC method")_ +- Implement `table.import` RPC method _[#3623](https://github.com/mathesar-foundation/mathesar/pull/3623 "Implement `table.import` RPC endpoint")_ +- Implement `schemas.patch` RPC method _[#3628](https://github.com/mathesar-foundation/mathesar/pull/3628 "Implement `schemas.patch` RPC method")_ +- Wire RPC methods to new models _[#3632](https://github.com/mathesar-foundation/mathesar/pull/3632 "Wire RPC functions to new models")_ +- Quoting refactor _[#3633](https://github.com/mathesar-foundation/mathesar/pull/3633 "Quoting refactor")_ +- Implement `tables.get_import_preview` RPC method _[#3635](https://github.com/mathesar-foundation/mathesar/pull/3635 "Implement `tables.get_import_preview` RPC endpoint")_ +- Auto generate table name _[#3637](https://github.com/mathesar-foundation/mathesar/pull/3637 "Auto generate table name")_ +- Add `columns.metadata.list` RPC method _[#3641](https://github.com/mathesar-foundation/mathesar/pull/3641 "Add `columns.metadata.list` RPC function")_ +- Implement `tables.metadata` `list` & `patch` RPC method _[#3646](https://github.com/mathesar-foundation/mathesar/pull/3646 "Implement `tables.metadata` `list` & `patch` RPC endpoint")_ +- Fix issue with removing comments on schemas _[#3649](https://github.com/mathesar-foundation/mathesar/pull/3649 "Allow unsetting schema comment using NULL")_ +- Drop old SQL function signature _[#3650](https://github.com/mathesar-foundation/mathesar/pull/3650 "Drop old SQL function signature")_ +- Implement tables list and delete RPC methods _[#3651](https://github.com/mathesar-foundation/mathesar/pull/3651 "Implement tables list and delete RPC APIs")_ +- Columns meta RPC patch _[#3653](https://github.com/mathesar-foundation/mathesar/pull/3653 "Columns meta RPC patch")_ +- Constraints RPC transition _[#3664](https://github.com/mathesar-foundation/mathesar/pull/3664 "Constraints RPC transition")_ +- Cast OIDs to bigint before putting in JSON _[#3666](https://github.com/mathesar-foundation/mathesar/pull/3666 "Cast OIDs to bigint before putting in JSON")_ +- RPC implementation for `tables.list_joinable` _[#3669](https://github.com/mathesar-foundation/mathesar/pull/3669 "RPC implementation for `tables.list_joinable`")_ +- Improve tables metadata _[#3672](https://github.com/mathesar-foundation/mathesar/pull/3672 "Improve tables metadata")_ +- RPC implementation for `types.list` _[#3676](https://github.com/mathesar-foundation/mathesar/pull/3676 "RPC implementation for `types.list`")_ +- Add `records.list` RPC method _[#3691](https://github.com/mathesar-foundation/mathesar/pull/3691 "Add `records.list` RPC function")_ +- RPC transition for explorations `list` and `delete` _[#3694](https://github.com/mathesar-foundation/mathesar/pull/3694 "RPC transition for explorations `list` and `delete`")_ +- Implement `explorations.run` RPC method _[#3696](https://github.com/mathesar-foundation/mathesar/pull/3696 "Implement `explorations.run` RPC endpoint")_ +- Fix return type error when re-defining `get_constraints_for_table` SQL function _[#3698](https://github.com/mathesar-foundation/mathesar/pull/3698 "Fix return type error when re-defining `get_constraints_for_table` SQL function")_ +- Fix Issues with `tables.patch` RPC method _[#3699](https://github.com/mathesar-foundation/mathesar/pull/3699 "Fix Issues with `tables.patch` RPC method")_ +- RPC records list filtering _[#3700](https://github.com/mathesar-foundation/mathesar/pull/3700 "RPC records list filtering")_ +- Return empty array when schema has no tables _[#3702](https://github.com/mathesar-foundation/mathesar/pull/3702 "Return empty array when schema has no tables")_ +- RPC function for column info with metadata _[#3703](https://github.com/mathesar-foundation/mathesar/pull/3703 "RPC endpoint for column info with metadata")_ +- First steps of RPC implementation for table page _[#3704](https://github.com/mathesar-foundation/mathesar/pull/3704 "First steps of RPC implementation for table page")_ +- Add `records.search` RPC method _[#3708](https://github.com/mathesar-foundation/mathesar/pull/3708 "Add `records.search` RPC function")_ +- Wire up valid_target_type function to column lister _[#3709](https://github.com/mathesar-foundation/mathesar/pull/3709 "Wire up valid_target_type function to column lister")_ +- Alter column metadata fields _[#3717](https://github.com/mathesar-foundation/mathesar/pull/3717 "Alter column metadata fields")_ +- Add target_table_info in `tables.list_joinable's` response _[#3718](https://github.com/mathesar-foundation/mathesar/pull/3718 "Add target_table_info in `tables.list_joinable's` response")_ +- Records grouping _[#3721](https://github.com/mathesar-foundation/mathesar/pull/3721 "Records grouping")_ +- Fix "no current database" error _[#3723](https://github.com/mathesar-foundation/mathesar/pull/3723 "Fix 'no current database' error")_ +- Implement explorations `run_saved` & `get` RPC methods _[#3725](https://github.com/mathesar-foundation/mathesar/pull/3725 "Implement explorations `run_saved` & `get` RPC endpoints")_ +- Handle new records filtering on the front end _[#3728](https://github.com/mathesar-foundation/mathesar/pull/3728 "Handle new records filtering on the front end")_ +- Implement explorations `add` & `replace` method _[#3731](https://github.com/mathesar-foundation/mathesar/pull/3731 "Implement explorations `add` & `replace` endpoint")_ +- Add `records.get` RPC method _[#3740](https://github.com/mathesar-foundation/mathesar/pull/3740 "Add `records.get` RPC function")_ +- Add `records.delete` RPC method _[#3741](https://github.com/mathesar-foundation/mathesar/pull/3741 "Add `records.delete` RPC function")_ +- Add `records.add` RPC method _[#3745](https://github.com/mathesar-foundation/mathesar/pull/3745 "Add `records.add` RPC function")_ +- Adapt front end to new RPC-based joinable tables API _[#3746](https://github.com/mathesar-foundation/mathesar/pull/3746 "Adapt front end to new RPC-based joinable tables API")_ +- Fix edge case while getting joinable tables for tables with no links _[#3748](https://github.com/mathesar-foundation/mathesar/pull/3748 "Fix edge case while getting joinable tables for tables with no links")_ +- Add `records.patch` RPC method _[#3749](https://github.com/mathesar-foundation/mathesar/pull/3749 "Add `records.patch` RPC function")_ +- Records grouping bugfix _[#3751](https://github.com/mathesar-foundation/mathesar/pull/3751 "Records grouping bugfix")_ +- Records delete bugfix _[#3754](https://github.com/mathesar-foundation/mathesar/pull/3754 "Records delete bugfix")_ +- Adapt front end to new records grouping API _[#3755](https://github.com/mathesar-foundation/mathesar/pull/3755 "Adapt front end to new records grouping API")_ +- Implement RPC records CRUD operations on front end _[#3759](https://github.com/mathesar-foundation/mathesar/pull/3759 "Implement RPC records CRUD operations on front end")_ +- Add simplified record summaries _[#3761](https://github.com/mathesar-foundation/mathesar/pull/3761 "Add simplified record summaries")_ +- Add link-adding RPC methods _[#3767](https://github.com/mathesar-foundation/mathesar/pull/3767 "Add link-adding RPC functions")_ +- Add `data_modeling.suggest_types` method. _[#3771](https://github.com/mathesar-foundation/mathesar/pull/3771 "Add `data_modeling.suggest_types` function.")_ +- Add `schema_privileges.list_direct` RPC method _[#3782](https://github.com/mathesar-foundation/mathesar/pull/3782 "Add `schema_privileges.list_direct` RPC function")_ +- Add `table_privileges.list_direct` RPC method _[#3783](https://github.com/mathesar-foundation/mathesar/pull/3783 "Add `table_privileges.list_direct` RPC function")_ +- Add `table_privileges.replace_for_roles` RPC method _[#3791](https://github.com/mathesar-foundation/mathesar/pull/3791 "Add `table_privileges.replace_for_roles` RPC function")_ +- Add `roles.get_current_role` RPC method _[#3796](https://github.com/mathesar-foundation/mathesar/pull/3796 "Add `roles.get_current_role` RPC function")_ +- Reorganize namespacing _[#3799](https://github.com/mathesar-foundation/mathesar/pull/3799 "Reorganize namespacing")_ +- Hard-code abstract types response in client _[#3800](https://github.com/mathesar-foundation/mathesar/pull/3800 "Hard-code abstract types response in client")_ +- Change response structure for record summary _[#3802](https://github.com/mathesar-foundation/mathesar/pull/3802 "Change response structure for record summary")_ +- Implement `data_modeling.split_table` RPC methods _[#3803](https://github.com/mathesar-foundation/mathesar/pull/3803 "Implement `data_modeling.split_table` RPC functions")_ +- Modify pkey finder to return False when no pkey exists _[#3804](https://github.com/mathesar-foundation/mathesar/pull/3804 "Modify pkey finder to return False when no pkey exists")_ +- Change response for `tables.add` and `tables.import` _[#3807](https://github.com/mathesar-foundation/mathesar/pull/3807 "Change response for `tables.add` and `tables.import`")_ +- Add summaries to self _[#3808](https://github.com/mathesar-foundation/mathesar/pull/3808 "Add summaries to self")_ +- Move columns SQL _[#3809](https://github.com/mathesar-foundation/mathesar/pull/3809 "Move columns SQL")_ +- Propagate RPC record summary changes to front end _[#3811](https://github.com/mathesar-foundation/mathesar/pull/3811 "Propagate RPC record summary changes to front end")_ +- Add `data_file_id` field to `TableMetaData` _[#3813](https://github.com/mathesar-foundation/mathesar/pull/3813 "Add `data_file_id` field to `TableMetaData`")_ +- Implement `data_modeling.move_columns` RPC method _[#3814](https://github.com/mathesar-foundation/mathesar/pull/3814 "Implement `data_modeling.move_columns` RPC endpoint")_ +- Get imports working again _[#3819](https://github.com/mathesar-foundation/mathesar/pull/3819 "Get imports working again")_ +- Implement `databases.privileges.transfer_ownership` RPC method _[#3821](https://github.com/mathesar-foundation/mathesar/pull/3821 "Implement `databases.privileges.transfer_ownership` RPC endpoint")_ +- Implement `tables.get_with_metadata` RPC method _[#3823](https://github.com/mathesar-foundation/mathesar/pull/3823 "Implement `tables.get_with_metadata` RPC endpoint")_ +- Use data file name as table name during import _[#3824](https://github.com/mathesar-foundation/mathesar/pull/3824 "Use data file name as table name during import")_ +- A couple small front end RPC changes _[#3825](https://github.com/mathesar-foundation/mathesar/pull/3825 "A couple small front end RPC changes")_ +- Bugfix listing records from a table with self-Referential FK _[#3831](https://github.com/mathesar-foundation/mathesar/pull/3831 "Bugfix listing records from a table with self-Referential FK")_ +- Hard-code type cast map on front end _[#3832](https://github.com/mathesar-foundation/mathesar/pull/3832 "Hard-code type cast map on front end")_ +- Alter response for schemas `add` and `patch` methods & implement `schemas.get` _[#3837](https://github.com/mathesar-foundation/mathesar/pull/3837 "Alter response for schemas `add` and `patch` endpoints & implement `schemas.get`")_ +- Propagate RPC changes to record selector _[#3843](https://github.com/mathesar-foundation/mathesar/pull/3843 "Propagate RPC changes to record selector")_ +- Use RPC API for column metadata _[#3845](https://github.com/mathesar-foundation/mathesar/pull/3845 "Use RPC API for column metadata")_ +- Propagate RPC changes to link table dialog _[#3847](https://github.com/mathesar-foundation/mathesar/pull/3847 "Propagate RPC changes to link table dialog")_ +- Fix response for `split_table` _[#3850](https://github.com/mathesar-foundation/mathesar/pull/3850 "Fix response for `split_table`")_ +- Alter response for record summaries with NULL records _[#3852](https://github.com/mathesar-foundation/mathesar/pull/3852 "Alter response for record summaries with NULL records")_ +- Make `records.get` work with stringified PK values _[#3853](https://github.com/mathesar-foundation/mathesar/pull/3853 "Make `records.get` work with stringified PK values")_ +- Enabling running of very simple explorations _[#3855](https://github.com/mathesar-foundation/mathesar/pull/3855 "Enabling running of very simple explorations")_ +- Get "extract columns" and "move columns" functionality working again _[#3856](https://github.com/mathesar-foundation/mathesar/pull/3856 "Get 'extract columns' and 'move columns' functionality working again")_ +- Allow patching records via string PKs _[#3857](https://github.com/mathesar-foundation/mathesar/pull/3857 "Allow patching records via string PKs")_ +- Implement `roles.set_members` RPC method _[#3866](https://github.com/mathesar-foundation/mathesar/pull/3866 "Implement `roles.set_members` RPC endpoint")_ +- Fix updating of table name _[#3879](https://github.com/mathesar-foundation/mathesar/pull/3879 "Fix ypdating of table name")_ +- Bugfix summarizations _[#3884](https://github.com/mathesar-foundation/mathesar/pull/3884 "Bugfix summarizations")_ +- Fix insert for table with only ID column _[#3885](https://github.com/mathesar-foundation/mathesar/pull/3885 "Fix insert for table with only ID column")_ +- Add `schema_oid` to `Explorations` model _[#3892](https://github.com/mathesar-foundation/mathesar/pull/3892 "Add `schema_oid` to `Explorations` model")_ +- Get explorations CRUD working again _[#3893](https://github.com/mathesar-foundation/mathesar/pull/3893 "Get explorations CRUD working again")_ +- Reduces frontend caching, fixes a few bugs _[#3897](https://github.com/mathesar-foundation/mathesar/pull/3897 "Reduces frontend caching, fixes a few bugs")_ +- Fix broken exploration "column added" indicators _[#3894](https://github.com/mathesar-foundation/mathesar/pull/3894 "Fix broken exploration 'column added' indicators")_ +- Fix bug when updating table twice _[#3909](https://github.com/mathesar-foundation/mathesar/pull/3909 "Fix bug when updating table twice") +- Fix response of `explorations.run` for summarizations _[#3940](https://github.com/mathesar-foundation/mathesar/pull/3940 "Fix response of `explorations.run` for summarizations")_ +- Fixes server errors when RPC exceptions are thrown while rendering common_data _[#3948](https://github.com/mathesar-foundation/mathesar/pull/3948 "Fixes server errors when RPC exceptions are thrown while rendering common_data")_ + +### Visual improvements + +We made several visual improvements to Mathesar to ensure consistency, better usability, and adherence to design guidelines. The changes were mainly to various modals and to the table inspector. + +A before-and-after comparison of the "Create Link" modal can be seen below. + +![image](../assets/releases/0.2.0-testing.1/create-link-changes.png) + +- Show a loading spinner for table pages _[#3602](https://github.com/mathesar-foundation/mathesar/pull/3602 "Show a loading spinner for table pages")_ +- UI consistency improvements for modals and table inspector _[#3860](https://github.com/mathesar-foundation/mathesar/pull/3860 "UI consistency improvements")_ + +## Bug fixes + +Bugs related to permissions or the backend overhaul are listed in the relevant sections above. The bugs listed here are unrelated to those changes. + +- Remove nonsensical cast_to_email and cast_to_uri functions _[#3564](https://github.com/mathesar-foundation/mathesar/pull/3564 "Remove nonsensical cast_to_email and cast_to_uri functions")_ +- Add 0.1.7 release notes to the nav menu _[#3569](https://github.com/mathesar-foundation/mathesar/pull/3569 "Merge pull request #3568 from mathesar-foundation/release_notes_nav")_ +- Fix error when trying to reset password of other user _[#3536](https://github.com/mathesar-foundation/mathesar/pull/3536 "Fix change password error")_ +- Handle negative numbers not being serialized correctly when copying _[#3582](https://github.com/mathesar-foundation/mathesar/pull/3582 "Handle negative numbers in TSV serialization for copy")_ +- Fix timeout when installing Mathesar on a remote DB _[#3917](https://github.com/mathesar-foundation/mathesar/pull/3917 "Fast install")_ +- Use a semver library to parse our version strings on the front end _[#3938](https://github.com/mathesar-foundation/mathesar/pull/3938 "Use a semver library to parse our version strings on the front end")_ + +## Documentation +- Updated user guide to cover new features and remove unnecessary pages _[#3910](https://github.com/mathesar-foundation/mathesar/pull/3910 "Permissions Documentation Updates")_ +- Improvements to installation from scratch documentation _[#3945](https://github.com/mathesar-foundation/mathesar/pull/3945 "Docs improvements for build from scrach")_ + + +## Maintenance + +Miscellanous work done to reduce technical debt, improve developer documentation, and maintain our workflow. + +- Refactor CellSelection data structure and store _[#3037](https://github.com/mathesar-foundation/mathesar/pull/3037 "Refactor CellSelection data structure and store")_ +- Remove API documentation infrastructure _[#3541](https://github.com/mathesar-foundation/mathesar/pull/3541 "Remove API documentation infrastructure")_ +- Remove Debian build _[#3546](https://github.com/mathesar-foundation/mathesar/pull/3546 "Remove Debian build")_ +- Update docs to add instructions for loading data from playground _[#3535](https://github.com/mathesar-foundation/mathesar/pull/3535 "Update docs to add instructions for loading data from playground")_ +- Merge 0.1.7 release back into develop _[#3558](https://github.com/mathesar-foundation/mathesar/pull/3558 "Merge pull request #3539 from mathesar-foundation/0.1.7")_ +- Resolve merge conflict for #3558 _[#3559](https://github.com/mathesar-foundation/mathesar/pull/3559 "Resolve merge conflict for #3558")_ +- Revert #3559 _[#3567](https://github.com/mathesar-foundation/mathesar/pull/3567 "Revert #3559")_ +- Bump dependencies _[#3544](https://github.com/mathesar-foundation/mathesar/pull/3544 "Bump dependencies")_, _[#3604](https://github.com/mathesar-foundation/mathesar/pull/3604 "Bump dependencies")_ +- Sort frontend imports _[#3552](https://github.com/mathesar-foundation/mathesar/pull/3552 "Sort frontend imports")_ +- Architectural overhaul _[#3587](https://github.com/mathesar-foundation/mathesar/pull/3587 "Architectural overhaul")_ +- Add SQL code standard for casting OIDs to bigint _[#3643](https://github.com/mathesar-foundation/mathesar/pull/3643 "Add SQL code standard for casting OIDs to bigint")_ +- Fix issue with SQL migrations not running when service restarts _[#3678](https://github.com/mathesar-foundation/mathesar/pull/3678 "Fix install script")_ +- Merge breaking changes into `develop` _[#3695](https://github.com/mathesar-foundation/mathesar/pull/3695 "Merge breaking changes into `develop`")_ +- Update MkDocs dependencies _[#3763](https://github.com/mathesar-foundation/mathesar/pull/3763 "Update MkDocs dependencies")_ +- Merge develop into release branch. _[#3950](https://github.com/mathesar-foundation/mathesar/pull/3950 "Merge develop into release branch.")_ + + +## Live demo changes + +We have removed code related to Mathesar's "live demo" mode since we didn't think it made sense to include code for our promotional website in the core product. If we do choose to maintain our live demo in the future, we will set up a separate microservice that performs some of these functions. + +We also set up a workflow to reset the live demo regularly to mitigate reliability issues. + +- Remove demo code and E2E infrastructure _[#3538](https://github.com/mathesar-foundation/mathesar/pull/3538 "Remove demo code and E2E infrastructure")_, _[#3551](https://github.com/mathesar-foundation/mathesar/pull/3551 "Remove E2E infrastructure")_ +- Add GitHub workflow to reset demo _[#3577](https://github.com/mathesar-foundation/mathesar/pull/3577 "Add GitHub workflow to reset demo")_ +- Updates to GH workflow for resetting demo _[#3579](https://github.com/mathesar-foundation/mathesar/pull/3579 "Updates to GH workflow for resetting demo")_ +- Updates to GH workflow to reset demo _[#3580](https://github.com/mathesar-foundation/mathesar/pull/3580 "Updates to GH workflow to reset demo")_ +- Remove the demo reset workflow _[#3581](https://github.com/mathesar-foundation/mathesar/pull/3581 "Remove the demo reset workflow")_ diff --git a/docs/docs/stylesheets/extra.css b/docs/docs/stylesheets/extra.css index fa915bb3c3..ded3c27abd 100644 --- a/docs/docs/stylesheets/extra.css +++ b/docs/docs/stylesheets/extra.css @@ -151,3 +151,17 @@ border-bottom: 2px solid var(--md-primary-fg-color--light); color: var(--md-primary-bg-color--lightest); } + +/* Make header title smaller */ +.md-header__title { font-size: 0.8rem; } +[dir="ltr"] .md-header__title { margin-left: 0; } + +/* Make header theme switcher smaller */ +.md-header__option .md-header__button { padding: 0.2rem; } +.md-header__option .md-header__button { padding: 0.2rem; } +.md-header__option .md-header__button svg { height: 1rem; width: 1rem; } + +/* Make version switcher smaller */ +.md-version { font-size: 0.7rem; font-weight: normal; } +[dir="ltr"] .md-version__current { margin-left: 0.6rem; } +.md-version__list { margin: 1.7rem 0 0 0; } diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index bc61f19893..25b24c0d98 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -31,6 +31,8 @@ nav: - API: - RPC: api/rpc.md - REST: api/rest.md + - Test Builds: + - '0.2.0-testing.1': releases/0.2.0-testing.1.md - Releases: - '0.1.7': releases/0.1.7.md - '0.1.6': releases/0.1.6.md @@ -91,6 +93,7 @@ theme: toggle: icon: material/brightness-4 name: Switch to light mode + custom_dir: overrides extra_css: - stylesheets/extra.css @@ -117,4 +120,7 @@ markdown_extensions: permalink: true extra: - mathesar_version: 0.1.7 + mathesar_version: 0.2.0-testing.1 + version: + provider: mike + alias: true diff --git a/docs/overrides/404.html b/docs/overrides/404.html new file mode 100644 index 0000000000..6a3bbee7e0 --- /dev/null +++ b/docs/overrides/404.html @@ -0,0 +1,91 @@ +{% extends "base.html" %} + +{% block content %} +

Loading...

+ + +{% endblock %} + +{% block scripts %} + {{ super() }} + +{% endblock %} \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index 700485f293..d8a12071ad 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,4 @@ +mike==2.1.3 mkdocs==1.4.2 mkdocs-material==8.5.11 mkdocs-redirects==1.2.0 diff --git a/mathesar/__init__.py b/mathesar/__init__.py index c5b35f12fe..9cb87736d0 100644 --- a/mathesar/__init__.py +++ b/mathesar/__init__.py @@ -1,3 +1,3 @@ default_app_config = 'mathesar.apps.MathesarConfig' -__version__ = "0.1.7" +__version__ = "0.2.0-testing.1" diff --git a/mathesar/urls.py b/mathesar/urls.py index 7c66b8942f..42cc7566dc 100644 --- a/mathesar/urls.py +++ b/mathesar/urls.py @@ -30,16 +30,16 @@ path('administration/users/', views.admin_home, name='admin_users_home'), path('administration/users//', views.admin_home, name='admin_users_edit'), path('administration/update/', views.admin_home, name='admin_update'), - path('databases/', views.databases, name='databases'), + path('databases/', views.databases_list_route, name='databases_list_route'), path('i18n/', include('django.conf.urls.i18n')), re_path( r'^db/(?P\d+)/schemas/(?P\d+)/', - views.schemas_home, - name='schema_home' + views.schema_route, + name='schema_route' ), re_path( r'^db/(?P\d+)/((schemas|settings)/)?', - views.schemas, - name='schemas' + views.database_route, + name='database_route' ), ] diff --git a/mathesar/views.py b/mathesar/views.py index e5eabc9fbf..84153c34dc 100644 --- a/mathesar/views.py +++ b/mathesar/views.py @@ -1,8 +1,11 @@ +from functools import wraps + from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render, redirect from modernrpc.views import RPCEntryPoint +from modernrpc.exceptions import RPCException from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response @@ -17,6 +20,30 @@ from mathesar import __version__ +def get_database_list(request): + return databases_list(request=request) + + +def wrap_data_and_rpc_exceptions(f): + @wraps(f) + def safe_func(*args, **kwargs): + try: + return { + 'state': 'success', + 'data': f(*args, **kwargs) + } + except RPCException as exp: + return { + 'state': 'failure', + 'error': { + 'code': exp.code, + 'message': exp.message + } + } + return safe_func + + +@wrap_data_and_rpc_exceptions def get_schema_list(request, database_id): if database_id is not None: return schemas_list(request=request, database_id=database_id) @@ -24,10 +51,7 @@ def get_schema_list(request, database_id): return [] -def get_database_list(request): - return databases_list(request=request) - - +@wrap_data_and_rpc_exceptions def get_table_list(request, database_id, schema_oid): if database_id is not None and schema_oid is not None: return tables_list( @@ -72,28 +96,31 @@ def _get_internal_db_meta(): return {'type': 'sqlite'} -def _get_base_data_all_routes(request, database_id=None, schema_id=None): +def get_common_data(request, database_id=None, schema_oid=None): + databases = get_database_list(request) + database_id_int = int(database_id) if database_id else None + current_database = next((database for database in databases if database['id'] == database_id_int), None) + current_database_id = current_database['id'] if current_database else None + + schemas = get_schema_list(request, current_database_id) + schema_oid_int = int(schema_oid) if schema_oid else None + schemas_data = schemas['data'] if 'data' in schemas else [] + current_schema = next((schema for schema in schemas_data if schema['oid'] == schema_oid_int), None) + current_schema_oid = current_schema['oid'] if current_schema else None + return { - 'current_database': int(database_id) if database_id else None, - 'current_schema': int(schema_id) if schema_id else None, + 'current_database': current_database_id, + 'current_schema': current_schema_oid, 'current_release_tag_name': __version__, - 'databases': get_database_list(request), - 'servers': get_servers_list(), + 'databases': databases, 'internal_db': _get_internal_db_meta(), 'is_authenticated': not request.user.is_anonymous, - 'queries': [], - 'schemas': get_schema_list(request, database_id), + 'servers': get_servers_list(), + 'schemas': schemas, 'supported_languages': dict(getattr(settings, 'LANGUAGES', [])), - 'tables': [], - 'user': get_user_data(request) - } - - -def get_common_data(request, database_id=None, schema_id=None): - return { - **_get_base_data_all_routes(request, database_id, schema_id), - 'tables': get_table_list(request, database_id, schema_id), - 'queries': get_queries_list(request, database_id, schema_id), + 'tables': get_table_list(request, current_database_id, current_schema_oid), + 'user': get_user_data(request), + 'queries': get_queries_list(request, current_database_id, current_schema_oid), 'routing_context': 'normal', } @@ -114,10 +141,10 @@ def home(request): database_list = get_database_list(request) number_of_databases = len(database_list) if number_of_databases > 1: - return redirect('databases') + return redirect('databases_list_route') elif number_of_databases == 1: db = database_list[0] - return redirect('schemas', database_id=db['id']) + return redirect('database_route', database_id=db['id']) else: return render(request, 'mathesar/index.html', { 'common_data': get_common_data(request) @@ -125,7 +152,7 @@ def home(request): @login_required -def databases(request): +def databases_list_route(request): return render(request, 'mathesar/index.html', { 'common_data': get_common_data(request) }) @@ -146,14 +173,14 @@ def admin_home(request, **kwargs): @login_required -def schemas(request, database_id, **kwargs): +def database_route(request, database_id, **kwargs): return render(request, 'mathesar/index.html', { 'common_data': get_common_data(request, database_id, None) }) @login_required -def schemas_home(request, database_id, schema_id, **kwargs): +def schema_route(request, database_id, schema_id, **kwargs): return render(request, 'mathesar/index.html', { 'common_data': get_common_data(request, database_id, schema_id) }) diff --git a/mathesar_ui/src/stores/schemas.ts b/mathesar_ui/src/stores/schemas.ts index 493ff7e5da..a3a231a1c9 100644 --- a/mathesar_ui/src/stores/schemas.ts +++ b/mathesar_ui/src/stores/schemas.ts @@ -152,7 +152,18 @@ export const schemas = collapse( const $schemasStore = get(schemasStore); if ($schemasStore.databaseId !== $currentDatabase?.id) { if (preload && commonData.current_database === $currentDatabase?.id) { - setSchemasInStore($currentDatabase, commonData.schemas); + if (commonData.schemas.state === 'success') { + setSchemasInStore($currentDatabase, commonData.schemas.data); + } else { + schemasStore.set({ + databaseId: $currentDatabase.id, + requestStatus: { + state: 'failure', + errors: [getErrorMessage(commonData.schemas.error)], + }, + data: new Map(), + }); + } } else { void fetchSchemasForCurrentDatabase(); } diff --git a/mathesar_ui/src/stores/tables.ts b/mathesar_ui/src/stores/tables.ts index d6022cd06e..3b7104340f 100644 --- a/mathesar_ui/src/stores/tables.ts +++ b/mathesar_ui/src/stores/tables.ts @@ -395,7 +395,19 @@ export const currentTablesData = collapse( commonData.current_schema === $currentSchema?.oid && commonData.current_database === $currentSchema?.database.id ) { - setTablesStore($currentSchema, commonData.tables); + if (commonData.tables.state === 'success') { + setTablesStore($currentSchema, commonData.tables.data); + } else { + tablesStore.set({ + databaseId: $currentSchema.database.id, + schemaOid: $currentSchema.oid, + tablesMap: new Map(), + requestStatus: { + state: 'failure', + errors: [getErrorMessage(commonData.tables.error)], + }, + }); + } } else { void fetchTablesForCurrentSchema(); } diff --git a/mathesar_ui/src/systems/table-view/link-table/NewColumn.svelte b/mathesar_ui/src/systems/table-view/link-table/NewColumn.svelte index 50d82f5fa1..a5665c72a3 100644 --- a/mathesar_ui/src/systems/table-view/link-table/NewColumn.svelte +++ b/mathesar_ui/src/systems/table-view/link-table/NewColumn.svelte @@ -28,9 +28,9 @@ {#if slotName === 'baseTable'} - + {:else if slotName === 'targetTable'} - + {/if} diff --git a/mathesar_ui/src/utils/preloadData.ts b/mathesar_ui/src/utils/preloadData.ts index c44f0d00c1..f80c22a766 100644 --- a/mathesar_ui/src/utils/preloadData.ts +++ b/mathesar_ui/src/utils/preloadData.ts @@ -5,11 +5,24 @@ import type { RawSchema } from '@mathesar/api/rpc/schemas'; import type { RawServer } from '@mathesar/api/rpc/servers'; import type { RawTableWithMetadata } from '@mathesar/api/rpc/tables'; +type WithStatus = + | { + state: 'success'; + data: D; + } + | { + state: 'failure'; + error: { + code: number; + message: string; + }; + }; + export interface CommonData { databases: RawDatabase[]; servers: RawServer[]; - schemas: RawSchema[]; - tables: RawTableWithMetadata[]; + schemas: WithStatus; + tables: WithStatus; queries: SavedExploration[]; current_database: RawDatabase['id'] | null; internal_db: {