Commit Graph

1590 Commits

Author SHA1 Message Date
Paul Fitzpatrick
05d8976c5b (core) updates from grist-core 2024-10-01 11:54:40 -04:00
jarek
437d7e61c0
Removing fixSiteProducts method (#1236)
Context:
Removing an obsolete method that was fixing an issue with default site products.
Details can be found here 76d9448

Proposed solution:
Removing this method and its test.

Test plan:
not needed

https://github.com/gristlabs/grist-core/pull/1236
2024-10-01 17:33:50 +02:00
Paul Fitzpatrick
11fe3e90d4
check sandbox viability lazily (#1226)
This checks whether code can successfully run in the
sandbox only when the admin panel needs to report that,
rather than at start up. This is motivated by two things:

  - The desktop app became a lot slower to open with this
    check, since it uses pyodide by default, and there's
    been no work on optimizing the pyodide sandbox load
    times (as opposed to gvisor, where a lot of work was
    done, and it is also fundamentally faster).
  - The messages logged by a test sandbox starting and
    stopping have been confusing people.

There is a case for doing the check on startup, especially
on servers, so that we can fail early. Still, that isn't
what we were doing, and we'd also like to move away from the
server refusing to start because of a problem and
towards an always-reachable admin page that reports
the nature of problems in a clearer way.
2024-09-30 15:58:38 -04:00
George Gevoian
bda7935714 (core) Add remaining audit log events
Summary:
Adds the remaining batch of audit log events, and a CLI
utility to generate documentation for installation and
site audit events.

Test Plan: Manual.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4356
2024-09-30 13:38:17 -04:00
George Gevoian
1927c87413 (core) Treat URLs in Markdown cells as absolute
Summary: The previous behavior didn't match HyperLink cells.

Test Plan: Browser test.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4358
2024-09-30 13:07:17 -04:00
George Gevoian
d2714da224 (core) Fix scrollbar in code view
Summary:
The scrollbar wasn't properly positioned inside the
bounds of the main panel.

Test Plan: Manual.

Reviewers: jarek

Reviewed By: jarek

Subscribers: paulfitz, jarek

Differential Revision: https://phab.getgrist.com/D4357
2024-09-30 12:04:00 -04:00
Tim Newsome
755a742d6f
Add Copy With Headers to grid cell popup. (#1208)
* Add "Copy with headers" to grid cell popup.

This is what you want when you're going to paste into e.g. an email.

Tested just by manually trying copy and paste into an editor and an
email, and then again using the new variant to confirm the headers show
up.

https://github.com/gristlabs/grist-core/pull/1208
2024-09-30 11:20:22 +02:00
Paul Fitzpatrick
632cb8464b (core) updates from grist-core 2024-09-26 13:18:47 -04:00
Paul Fitzpatrick
36722c19a3
preliminary support for a job queue (#1212)
Grist has needed a job queue for some time. This adds one, using
BullMQ. BullMQ however requires Redis, meaning we couldn't use
jobs for the large subset of Grist that needs to be runnable without
Redis (e.g. for use on desktop, or on simple self-hosted sites).
So simple immediate, delayed, and repeated jobs are supported also
in a crude single-process form when Redis is not available.

This code isn't ready for actual use since an important issue
remains to be worked out, specifically how to handle draining
the queue during deployments to avoid mixing versions (or - if
allowing mixed versions - thinking through any extra support needed
for the developer to avoid introducing hard-to-test code paths).
2024-09-25 15:23:23 -04:00
Jarosław Sadziński
8da04d5a2a (core) Two way reference polish
Summary:
- Fixing BulkRemoveRecord bug
- Rewriting copy on the `delete reverse column` dialog
- Rewriting text on the `reassign reference dialog`
- Adding tooltip that explains why 2-way references are not enabled for formula columns

Test Plan: Added tests

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4355
2024-09-24 10:20:55 +02:00
George Gevoian
8b1d1c5d25 (core) Add more audit logging data/events
Summary:
Adds a few additional audit events and enhances audit logging
to capture more data (request origin, active org, user type).

Test Plan: Server and manual tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4348
2024-09-23 12:57:35 -04:00
Jarosław Sadziński
11e22dd84e (core) Renaming column before cursor moves
Summary:
Fix for a bug. If a user tried to trigger the rename
column action by changing a cursor position, the wrong column
was renamed.

Test Plan: Added new test

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4352
2024-09-20 14:54:37 +02:00
Jarosław Sadziński
dd22ebdaf0 (core) Handling shift+enter on ace editor
Summary:
Shift+Enter doesn't work on ace editor when suggestions
are shown. Propobly this is bug in the ace-editor.

Test Plan:
Manual:
Start ace editor, and trigger auto-completion menu.
Pressing shift+enter should add new line (with proper indention). Previously
it did nothing.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3625
2024-09-19 17:07:34 +02:00
Jarosław Sadziński
e97a45143f (core) Adding UI for reverse columns
Summary:
- Adding an UI for two-way reference column.
- Reusing table name as label for the reverse column

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4344
2024-09-18 12:07:21 +02:00
George Gevoian
da6c39aa50 (core) Add new home page cards
Summary:
New cards on the home page link to useful resources like the welcome
video, tutorial, webinars, and the Help Center. They are shown by
default to new and exisiting users, and may be hidden via a toggle.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4340
2024-09-17 17:32:10 -04:00
Spoffy
839bf63b9f (core) Fixes compilation issues from grist-core
Test Plan: SaaS CI

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D4351
2024-09-17 20:57:54 +01:00
Jarosław Sadziński
5b26c84f0d (core) Editing summary columns widget options
Summary:
- Allowing changing description and all widget options (except choices) for summary columns
- Making text error in toast notification selectable

Test Plan: Added new tests

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: georgegevoian

Differential Revision: https://phab.getgrist.com/D4346
2024-09-17 09:37:47 +02:00
Leslie H
02cfcee84d
Make changes required for Desktop FS updates (#1099)
Make a set of changes required for Desktop FS improvements, see
https://github.com/gristlabs/grist-desktop/pull/42

---------

Co-authored-by: Spoffy <contact@spoffy.net>
Co-authored-by: Spoffy <4805393+Spoffy@users.noreply.github.com>
2024-09-16 21:01:58 -04:00
Paul Fitzpatrick
938bb0666e (core) updates from grist-core 2024-09-16 08:47:08 -04:00
Paul Fitzpatrick
a45a7f9fda
switch default LLM from a model that is going away (#1202)
* switch default LLM from a model that is going away

If an api key is provided, Grist can use an LLM as an assistant
for writing formulas. The LLM can be self-hosted or an external
service. The default external service is OpenAI. This commit
freshens the default model used, if this feature is enabled,
since the existing one is going away. Benchmarking suggests the
results are generally better, though not dramatically so.

The feature of falling back on a longer context model is no longer
as important, but is retained since it could be useful for self-hosters.

* update long context model tests
2024-09-13 14:56:42 -04:00
Jarosław Sadziński
d22d7a4ac8 (core) Fixing print preview bugs
Summary:
- Hiding pinned filters
- Switch editor (for toggle column) renders itself as checkbox on print preview

Test Plan: Manual

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: georgegevoian

Differential Revision: https://phab.getgrist.com/D4345
2024-09-13 11:13:39 +02:00
George Gevoian
3e22b89fa2 (core) Add audit logging machinery
Summary:
Adds machinery to support audit logging in the backend.

Logging is currently implemented by streaming events to external HTTP
endpoints. All flavors of Grist support a default "grist" payload format,
and Grist Enterprise additionally supports an HEC-compatible payload format.

Logging of all audit events will be added at a later date.

Test Plan: Server tests.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D4331
2024-09-12 12:13:41 -04:00
Jarosław Sadziński
14718120bd (core) Allowing installation admins to manage billing.
Summary:
Permissions for admin billing endpoints were changed

- Support user can't use admin subscription endpoints
- Installation admin (as support user) can see billing details on any site
- Installation admin (unlike support user) can replace subscription (or attach payment) on any site, regardless permissions

Installation admin is any user that belongs to a special `admin` org. If `admin` org is not defined, it defaults to
support user. In that case, with this diff, the support user receives admin's permissions, and now can replace subscription on
any site (without being billing manager).

Test Plan: Added new test

Reviewers: dsagal, paulfitz

Reviewed By: dsagal, paulfitz

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4338
2024-09-11 23:06:47 +02:00
Jarosław Sadziński
1d2cf3de49 (core) Adding backend for 2-way references
Summary:
Adding support for 2-way references in data engine.

- Columns have an `reverseCol` field, which says "this is a reverse of the given column, update me when that one changes".
- At the time of setting `reverseCol`, we ensure that it's symmetrical to make a 2-way reference.
- Elsewhere we just implement syncing in one direction:
  - When `reverseCol` is present, user code is generated with a type like `grist.ReferenceList("Tasks", reverse_of="Assignee")`
  - On updating a ref column, we use `prepare_new_values()` method to generate corresponding updates to any column that's a reverse of it.
  - The `prepare_new_values()` approach is extended to support this.
  - We don't add (or remove) any mappings between rows, and rely on existing mappings (in a ref column's `_relation`) to create reverse updates.

NOTE This is polished version of https://phab.getgrist.com/D4307 with tests and 3 bug fixes
- Column transformation didn't work when transforming RefList to Ref, the reverse column became out of sync
- Tables with reverse columns couldn't be removed
- Setting json arrays to RefList didn't work if arrays contained other things besides ints
Those fixes are covered by new tests.

Test Plan: New tests

Reviewers: georgegevoian, paulfitz, dsagal

Reviewed By: georgegevoian, paulfitz

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4322
2024-09-11 22:31:36 +02:00
Jarosław Sadziński
0ca70e9d43 (core) Fixing lock issues and reverting back to single connection.
Summary:
Removing `createNewConnection` method that was used in tests to create a
"scoped" version of `HomeDbManager`. Currently this won't work as there are
many methods (like `Users.findOne`) that are using the default (global) connection.

Additionally `HomeDBManger` had couple of bugs that were causing locks, which
manifested themselves in postgresql tests (that are not serializing transactions).
Repository methods like `Users.findOne` or `user.save()`, even when wrapped in
transaction were using a separate connection from the pool (and a separate
transaction).

Some tests in `UsersManager` are still skipped or refactored, as sinon's `fakeTimers`
doesn't work well with postgresql driver (which is using `setTimout` a lot).

Date mappings in `User` entity were fixed, they were using `SQLite` configuration only,
which caused problems with postgresql database.

Test Plan: Refactored.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4342
2024-09-11 20:48:52 +02:00
Jarosław Sadziński
51acc9a8cc (core) Allowing non-owner managers to add other managers
Summary:
Billing managers can now add other billing managers. Before
only managers with owner access could do that.

Test Plan: Added test

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4339
2024-09-09 18:33:03 +02:00
Paul Fitzpatrick
963e26dda6 (core) updates from grist-core 2024-09-09 09:14:43 -04:00
Florent
243369513f
Don't throttle /api/docs/{docId}/force-reload #1107 (#1197)
When a document has too many requests, one may want to force a document to be reopened. However, the /force-reload endpoint may raise a 429 (TOO_MANY_REQUESTS) error, because it uses the throttled middleware.
2024-09-05 16:36:05 -04:00
Florent
16ebc32611
Add tests for UsersManager (#1149)
Context

HomeDBManager lacks of direct tests, which makes hard to make rework or refactorations.
Proposed solution

Specifically here, I introduce tests which call exposed UsersManager methods directly and check their result.

Also:

    I removed updateUserName which seems to me useless (updateUser does the same work)
    Taking a look at the getUserByLogin methods, it appears that Typescirpt infers it returns a Promise<User|null> while in no case it may resolve a nullish value, therefore I have forced to return a Promise<User> and have changed the call sites to reflect the change.

Related issues

I make this change for then working on #870
2024-09-05 16:30:04 -04:00
Dmitry S
d35574c198 (core) Add support for locales to DateEditor and DateTimeEditor.
Summary:
Addresses request https://github.com/gristlabs/grist-core/issues/443

The bootstrap-datepicker used for the Date/DateTime dropdown calendar does
support a number of locales. This diff loads them on-demand, if available,
based on the document's locale setting.

Also:
- Improves NewBaseEditor typings, reduces some casts, adds comments.
- Converts DateEditor and DateTimeEditor to typescript.
- Moves DateEditor nbrowser test to core.

Test Plan: Added a test case for locales to DateEditor test.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4335
2024-09-05 08:35:04 -04:00
Vincent Viers
f0d0b9120b
Fix: formula assistant translations (#1192)
These strings are translated under the `FormulaAssistant.*` keys in weblate
2024-09-04 11:11:22 -04:00
Florent
b1a9e5f0da
OIDC: allow configuring the request timeout (#1177)
Add IdP timeout, controlled by env var GRIST_OIDC_SP_HTTP_TIMEOUT

---------

Co-authored-by: atropos <sv7n@pm.me>
2024-09-03 17:10:18 -04:00
George Gevoian
437aaac6d2
Pin browser tests to Chrome 127 (#1187) 2024-09-03 11:36:49 -04:00
Paul Fitzpatrick
994c8d3faa (core) updates from grist-core 2024-09-03 10:01:20 -04:00
George Gevoian
5e4140fcae (core) Support bare links in Markdown cells
Summary:
Also tweaks the bottom margin of a few Markdown
element types when they are the last element in a
cell, and fixes an alignment issue with list items
containing paragraphs.

Test Plan: Browser and manual tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4334
2024-09-03 02:23:57 -04:00
Jordi Gutiérrez Hermoso
80f8168cab (core) DocLimits: display days remaining instead of days of grace period
Summary:
Before this change we would always say there are 14 days remaining,
regardless of how many actually are remaining. Let's pass around a
different `dataLimitsInfo` object that also reports the number of days
remaining.

Test Plan: Ensure the test suite passes.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4332
2024-08-29 22:51:49 -04:00
Dmitry S
8da89b0a3d (core) Improve behavior to update current time, to allow inactive docs to shut down, and reduce spurious errors.
Summary:
- When sandbox is down, report failing UpdateCurrentTime calls as warnings instead of errors.
- When applying system actions (such as updating current time), don't treat
  them as user activity for the purpose of keeping the doc open.

Test Plan: Added a test case for the fixed behavior.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4324
2024-08-29 01:22:57 -04:00
Florent
76fcfd733e
Small: Log requests body (#913)
Add body in log requests.

GRIST_LOG_SKIP_HTTP is a badly named environment variable and its
expected values are confusing (to log the requests, you actually have to
set its value to "", and setting to "false" actually is equivalent to
setting to "true").

We deprecate this env variable in favor of GRIST_LOG_HTTP which is more
convenient and understandable:
 - by default, its undefined, so nothing is logged;
 - to enable the logs, you just have to set GRIST_LOG_HTTP=true

Also this commit removes the default value for GRIST_LOG_SKIP_HTTP,
because we don't have to set it to "true" to actually disable the
requests logging thanks to GRIST_LOG_HTTP. FlexServer now handles
the historical behavior for this deprecated variable.

---------

Co-authored-by: Jonathan Perret <j-github@jonathanperret.net>
2024-08-27 06:38:35 -04:00
George Gevoian
292c894b93 (core) Add Markdown cell format
Summary:
Text columns can now display their values as Markdown-formatted text
by changing their cell format to "Markdown". A minimal subset of the
Markdown specification is currently supported.

Test Plan: Browser tests.

Reviewers: Spoffy, dsagal

Reviewed By: Spoffy, dsagal

Subscribers: dsagal, Spoffy

Differential Revision: https://phab.getgrist.com/D4326
2024-08-23 11:24:35 -04:00
George Gevoian
5c486e686e (core) Refactor disabled summary button logic
Summary:
A project test began failing because of an incompatibility with pointer-events
being disabled. This gets us back to green.

Test Plan: Existing tests.

Reviewers: jordigh

Reviewed By: jordigh

Subscribers: jordigh

Differential Revision: https://phab.getgrist.com/D4325
2024-08-19 22:59:21 -04:00
Jordi Gutiérrez Hermoso
54502280de (core) AdminPanel: hide the enterprise toggle in core and grist-ee images
Summary:
In the pure OSS `grist-oss` image, the `ActivationPage` module from
stubs is used, as the `ext` code is completely missing. We can easily
just always return `false` here.

In the case when the `ext` directory exists, this may mean we're in
the standard `grist` image or the `grist-ee` image. The latter is
distinguished by having `GRIST_FORCE_ENABLE_ENTERPRISE` so we check if
that's on, and hide the toggle accordingly if so.

Test Plan:
Use these changes to build the three Docker images
(`grist-oss`, `grist`, and `grist-ee`) and verify that only `grist`
shows the toggle.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4321
2024-08-19 15:51:24 -04:00
Paul Fitzpatrick
0a78cdbaab (core) updates from grist-core 2024-08-19 07:01:01 -04:00
Dmitry S
ef4180c8da (core) Fix unhandledRejection caused by exception from verifyClient.
Summary:
This includes two fixes: one to ensure that any exception from websocket
upgrade handlers are handled (by destroying the socket). A test case is
added for this.

The other is to ensure verifyClient returns false instead of failing; this
should lead to a better error to the client (Forbidden, rather than just socket
close). This is only tested manually with a curl request.

Test Plan: Added a test case for the more sensitive half of the fix.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: georgegevoian

Differential Revision: https://phab.getgrist.com/D4323
2024-08-15 17:32:44 -04:00
George Gevoian
e70c294e3d (core) Add custom widget gallery
Summary:
Custom widgets are now shown in a gallery.

The gallery is automatically opened when a new custom widget is
added to a page.

Descriptions, authors, and update times are pulled from the widget
manifest.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4309
2024-08-14 16:48:36 -04:00
Jordi Gutiérrez Hermoso
a16d76d25d (core) config: rename TEST_ENABLE_ACTIVATION to GRIST_FORCE_ENABLE_ENTERPRISE
Summary:
The name of this env var has bothered me for a little while.
Let's rename it more meaningfully.

Test Plan: No need to test, cosmetic change only.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4320
2024-08-14 14:33:06 -04:00
Jarosław Sadziński
9509b2edcb (core) Hiding censored pages and all their leaves
Summary:
Page is now hidden when any of its ancestor (or the page itself)
is censored.

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4319
2024-08-14 19:48:17 +02:00
Grégoire Cutzach
93ed1bec5e
feat: forms inhibited when summary selected and vice versa (#1037) 2024-08-14 10:59:06 -04:00
Dmitry S
fbc0418118 (core) Fix CustomView taking up more height than page layout gives it.
Summary:
Each view type currently responsible for fitting appropriately within the box
it's given (e.g. deciding which container is scrollable). CustomView wasn't
doing a good job of it, particularly when showing "columns aren't mapped"
message.

Test Plan:
Only CSS affected. Checked manually on FF, Chrome, Safari that CustomViews take
the right amount of space, and scroll well, in 3 situations: not-mapped,
not-configured, and a functional widget.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4316
2024-08-13 12:34:28 -04:00
Dmitry S
5ef54b278f (core) When getting error details for on-demand formulas, provide an explanation
Summary:
Since formula errors are typically obtained from the Python data engine, they
were not returning any info for errors in on-demand tables (not loaded into the
data engine). This change implements a detailed message to explain such errors,
mainly to point out that on-demand table is the reason.

Test Plan: Added a check to the OnDemand test that formula error details are shown.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4317
2024-08-13 12:34:08 -04:00
Dmitry S
69aabd1ae0 (core) Limit related videos when playing onboarding video tour from home page
Summary:
When video is opened from the app homepage, it opens in a popup, which stays
open when it ends. The rel=0 parameter limits the related videos shown at the
end to those from the same channel, avoiding surprising unrelated videos.

This doesn't affect the video shown during initial onboarding, since that once
auto-closes when it ends.

Test Plan: Tested manually

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4313
2024-08-09 19:24:09 -04:00