Skip to content

Commit 1794b5c

Browse files
authored
Merge branch 'develop' into alter_col_refactor
2 parents 47f1948 + 054cd95 commit 1794b5c

File tree

4 files changed

+43
-16
lines changed

4 files changed

+43
-16
lines changed

DEVELOPER_GUIDE.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Mathesar is built using:
1010
- [Python](https://www.python.org/) for the backend
1111
- [Django](https://www.djangoproject.com/) for the web application
1212
- [SQLAlchemy](https://www.sqlalchemy.org/) to talk to the database
13-
- [Django REST Framework](https://www.django-rest-framework.org/) for the API
13+
- [Django REST Framework](https://www.django-rest-framework.org/) for the API
1414
- [Svelte](https://svelte.dev/) and [TypeScript](https://www.typescriptlang.org/) for the frontend
1515

1616
## Local development setup
@@ -77,7 +77,7 @@ We use [pytest](https://docs.pytest.org) for our backend tests.
7777
```
7878
docker exec mathesar_service_dev pytest -k "test_name"
7979
```
80-
80+
8181
- See the [pytest documentation](https://docs.pytest.org/en/latest/how-to/usage.html), or run pytest with the `--help` flag to learn about more options for running tests.
8282
8383
- Run all SQL tests:
@@ -183,7 +183,7 @@ Django uses gettext, which require the `.po` files to be compiled into a more ef
183183
## Translation process
184184
185185
- We use [Transifex](https://app.transifex.com/mathesar/mathesar/dashboard/) for managing our translation process.
186-
- You'll need to be a member of the Mathesar organization in Transifex, inorder to work with translations. Please reach out to us for information on how to join.
186+
- You'll need to be a member of the Mathesar organization in Transifex, inorder to work with translations. Please reach out to us for information on how to join.
187187
188188
### For Translators
189189
@@ -241,12 +241,34 @@ If you'd like to manually push or pull translations, follow the instructions in
241241
```
242242
docker exec -it mathesar_dev_db psql -U mathesar
243243
```
244-
244+
245+
## Working with file attachments
246+
247+
Mathesar has a feature which allows users to upload files through the UI and store references to those file in data. Uploaded files are stored in an S3-compatible storage provider.
248+
249+
To work with this feature in your local development environment, you'll need to take some extra steps to enable it:
250+
251+
1. Copy `file_storage.yml.example` to `file_storage.yml`.
252+
253+
1. Restart docker with the following command
254+
255+
```
256+
docker compose -f docker-compose.dev.yml up dev-service obj-store
257+
```
258+
259+
Notice that we start the `obj-store` service too, in addition to the normal `dev-service`.
260+
261+
1. Log in to the file storage backend UI at http://localhost:9001 with `mathesar`/`mathesar`. Create a new storage bucket in the UI called "mathesar-storages".
262+
263+
At this point you can run Mathesar and create new "File" columns in tables. Those columns will present a UI that allows you to attach files to table cells.
264+
265+
With the `obj-store` service running, you can return to http://localhost:9001 to view and manage your uploaded files.
266+
245267
## Troubleshooting
246268
247269
### Permissions within Windows
248270
249-
- Running Script in powershell is disabled by default in windows , you have to change permission to run scripts [Official Docs ](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.2)
271+
- Running Script in powershell is disabled by default in windows , you have to change permission to run scripts [Official Docs ](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.2)
250272
251273
### Fixing line endings on Windows
252274

mathesar_ui/src/i18n/languages/en/dict.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"create_table_move_columns": "Create Table and Move Columns",
166166
"currently_installed": "Currently Installed",
167167
"custom": "Custom",
168-
"custom_database_nickname_label_help": "Selecting this option can help you differentiate between multiple databases with the name name on separate PostgreSQL severs. You can modify this later if needed.",
168+
"custom_database_nickname_label_help": "Selecting this option can help you differentiate between multiple databases with the same name on separate PostgreSQL servers. You can modify this later if needed.",
169169
"custom_default": "Custom Default",
170170
"custom_fields": "Custom Fields",
171171
"customization": "Customization",

mathesar_ui/src/stores/table-data/meta.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,15 @@ function serializeMetaProps(p: MetaProps): string {
9292
return Url64.encode(JSON.stringify(makeTerseMetaProps(p)));
9393
}
9494

95-
/** @throws Error if string is not properly formatted. */
96-
function deserializeMetaProps(s: string): MetaProps {
97-
return makeMetaProps(JSON.parse(Url64.decode(s)) as TerseMetaProps);
95+
function deserializeMetaProps(s: string): MetaProps | undefined {
96+
// NOTE: it would be good to someday validate the serialized meta props in a
97+
// more robust manner.
98+
if (!s) return undefined;
99+
try {
100+
return makeMetaProps(JSON.parse(Url64.decode(s)) as TerseMetaProps);
101+
} catch {
102+
return undefined;
103+
}
98104
}
99105

100106
const defaultMetaPropsSerialization = serializeMetaProps(getFullMetaProps());
@@ -281,12 +287,8 @@ export class Meta {
281287
this.cellModificationStatus.clear();
282288
}
283289

284-
static fromSerialization(s: string): Meta | undefined {
285-
try {
286-
return new Meta(deserializeMetaProps(s));
287-
} catch (e) {
288-
return undefined;
289-
}
290+
static fromSerialization(s: string): Meta {
291+
return new Meta(deserializeMetaProps(s));
290292
}
291293

292294
destroy(): void {

mathesar_ui/src/stores/table-data/records.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,10 @@ export class RecordsData {
557557
if (isDraftRecordRow(row)) {
558558
return api.records.add({
559559
...this.apiContext,
560-
record_def: recordDef,
560+
record_def: {
561+
...Object.fromEntries(this.contextualFilters),
562+
...recordDef,
563+
},
561564
});
562565
}
563566
return api.records.patch({

0 commit comments

Comments
 (0)