Commit Graph

980 Commits

Author SHA1 Message Date
Alex Hall
b1f5e061c1
Merge pull request #279 from yohanboniface/boolean-converter
Add BooleanConverter to map proper boolean cells to a Bool column
2022-09-20 14:34:00 +02:00
Paul Fitzpatrick
b1921209df (core) updates from grist-core 2022-09-19 12:47:15 -04:00
Jarosław Sadziński
473dcf7c15 (core) Fix for a FreeTeam test
Summary:
FreeTeam test was overlapping with DuplicateDocument test.
It was leaving some documents in personal workspace.

Test Plan: Updated tests

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3632
2022-09-16 16:48:27 +02:00
Louis Delbosc
c8a80cb56e
Replace disabled attribute by readonly attribute (#281)
Co-authored-by: Camille Saillard <camille.saillard.prestataire@anct.gouv.fr>
2022-09-16 08:44:39 -04:00
Dmitry S
23008038b7 (core) When managing focus, don't auto-scroll
Summary:
When Grist is embedded, calls to focus() cause the outer page to scroll to the embed iframe. Because this happens automatically on load, this cause the page to jump to the embed (not consistent across browsers, but at least in Chrome on Windows).

This change changes the automatic focus() calls to avoid scrolling. In the normal app, it should make no difference; in embedded context, this avoids the unexpected scrolling of the parent page.

Test Plan: Tested manually, with Anais's help: in her browser, embedded Grist consistently caused the page to jump to the embed before the change, and not after.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3631
2022-09-14 17:32:11 -04:00
Louis Delbosc
494a683332
Export xlsx #256 (#270)
XLSX export of active view / table

Co-authored-by: Louis Delbosc <louis.delbosc.prestataire@anct.gouv.fr>
Co-authored-by: Vincent Viers <vincent.viers@beta.gouv.fr>
2022-09-14 14:55:44 -04:00
Paul Fitzpatrick
1a091f1dd5 (core) another bundle of dependabot suggestions
Summary:
Version changes suggested by dependabot for security issues that
may or may not affect us (it is easier to apply the changes than
to figure out if the issues are relevant).

 * understore 1.12.1
 * ini 1.3.7, 1.3.8
 * electron 19.0.9
 * js-yaml 3.13.1, 3.14.1
 * highlight.js 10.7.3
 * file-type 16.5.4

Test Plan: existing tests pass

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3629
2022-09-12 14:20:09 -04:00
Jarosław Sadziński
81c623109f (core) Adding empty workspace intro
Summary: Adding title and buttons for empty workspace screen.

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3622
2022-09-12 16:19:31 +02:00
Paul Fitzpatrick
b9441cf8fd (core) updates from grist-core 2022-09-12 09:14:22 -04:00
Jarosław Sadziński
2a3328abfc (core) Clearing selection after rows or cols were removed
Summary:
The selection was not cleared after removing rows, and it still
kept deleted rows ids. Removing selected rows once again
produced an assertion error.
Also, the selection is now cleared when columns are removed.

Test Plan: Updated tests

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3623
2022-09-12 08:40:07 +02:00
George Gevoian
2d141559d8
Merge pull request #280 from gristlabs/increase-yarn-network-timeout
Increase yarn install network timeout
2022-09-11 17:40:19 -07:00
George Gevoian
9dccaa5301 Increase yarn install network timeout 2022-09-11 16:33:11 -07:00
Yohan Boniface
7bd895ef42 Add BooleanConverter to map proper boolean cells to a Bool column
Note that only proper boolean will be considered, but not integers
nor truthy or falsy strings.
2022-09-10 07:07:45 +02:00
Paul Fitzpatrick
bd9ede9d13
give parseDate test more time (#278)
The time it takes parseDate to run depends on how many timezone
names moment knows about.
2022-09-09 17:05:29 -04:00
Alex Hall
56624c4a95 (core) Fix undo error for automatically removed rows, especially in summary tables
Summary:
Fixes a bug noted here: https://grist.slack.com/archives/C069RUP71/p1662564341132349

This bug could happen quite easily as follows:

1. Have a formula in a summary table such as `$group.amount`. Typically there's also a `SUM` but that's not essential.
2. Find a group with nonzero values of `amount`.
3. Delete all rows in that group in the source table. Typically that just means one row in a lonely group.
4. The summary table row is automatically deleted.
5. Try to undo. This raises an error about trying to update a non-existent summary table row.

I tried to account for this undo problem in https://phab.getgrist.com/D3489 by not saving the updated value for `$group` when it was found to be empty. The reason this was insufficient is that `$group.amount` is immediately invalidated anyway when the source row(s) are deleted (I think because that's just how dependency relations involving references work) *and* the calculated value of `$group.amount` changes even if `$group` doesn't. For example, `$group.amount` may have previously been `[100, 200]`. After deleting the rows, `$group.amount` becomes `[0, 0]`. Keeping `$group` unchanged prevents `$group.amount` from just being `[]`, but deleting the source rows means that the amounts become the numeric default `0` which is still a change. This change in value is then noted which leads to saving an undo action to update the summary table record. All this happens in step 3 above, and the summary record is only deleted after that point.

This diff removes that special handling for `group` and instead adds a more general fix to `action_summary.py`. This inserts undo actions for deleted rows at the beginning of the undo list rather than at the end, which was already done for deleted tables and columns.

Test Plan: Python tests

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3626
2022-09-09 22:15:45 +02:00
Yohan Boniface
8bc5c7d595
Fix columns with falsy cells wrongly parsed as dates (#276)
Eg. before this commit, this table would result in Date columns:

| A     | B |
| ----- | -- |
| FALSE | 0 |

For now, even FALSE is parsed as Numeric (not sure why we don't have
a BooleanConverter).
2022-09-09 15:13:34 -04:00
Paul Fitzpatrick
c9a81ea7ea (core) updates from grist-core 2022-09-09 14:42:01 -04:00
Paul Fitzpatrick
99a207b1fc (core) another batch of dependabot updates
Summary:
Another batch of updates suggested by dependabot.

 * jsdom 16.5.0
 * terser 5.14.2
 * y18n 4.0.3
 * cached-path-relative 1.1.0
 * tar 4.4.19
 * saml2-js 2.0.5
 * jszip 3.10.1
 * path-parse 1.0.7
 * ws 6.2.2
 * normalize-url 4.5.1
 * lodash 4.17.21
 * elliptic 6.5.4
 * glob-parent 5.1.2

The only substantial change is the login bundle got slightly bigger (I think because of lodash).

Test Plan: existing tests pass

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D3627
2022-09-09 13:34:08 -04:00
George Gevoian
c3d21becba
Merge pull request #274 from gristlabs/fix-css-property-fallback
Fix incorrect CSS fallback values
2022-09-08 17:53:23 -07:00
George Gevoian
4ee47e9c1d Fix a few more CSS values 2022-09-08 15:04:14 -07:00
George Gevoian
965cf7e076 Fix incorrect CSS fallback values 2022-09-08 14:30:46 -07:00
Jarosław Sadziński
87731224df (core) Adding selection layer on top of field element
Summary: Adding a new layer in front of the field_clip element that fixes selected cells' color.

Test Plan: Existing tests

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3620
2022-09-08 12:38:18 +02:00
Paul Fitzpatrick
c9c46d337b (core) updates from grist-core 2022-09-07 17:34:01 -04:00
Paul Fitzpatrick
bde44323c5 (core) apply some dependabot suggestions
Summary:
This applies the set of dependabot suggestions that are currently
passing tests on grist-core. There are a lot more suggestions to
come, an unusual number are not passing tests because tests were
briefly broken.

The list of suggestions is extracted from:

https://api.github.com/repos/gristlabs/grist-core/pulls?search=status:success+state:open

And then applied using:

  yarn upgrade package1@version1 package2@version2 ....

After application, any new entries in package.json are pruned, leaving
just updated entries and yarn.lock changes.

Non-trivial code updates include:
 * A change related to axios typing
 * A change related to jquery dropping `size()` in favor of `length`

Test Plan: existing tests should pass

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D3621
2022-09-07 14:15:34 -04:00
Alex Hall
0a2bc56938 (core) Test undo for all Python summary table tests
Summary:
Undo often leads to errors, especially with summary tables. One example is here: https://grist.slack.com/archives/C069RUP71/p1662564341132349

This diff simply decorates all relevant tests in 3 files testing summary tables with `@test_engine.test_undo`. This didn't catch any new bugs or reveal the problem in the thread above, but it seems good to have.

Test Plan: this

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3624
2022-09-07 18:02:02 +02:00
Paul Fitzpatrick
c588d58959
use python3 for workflows (#267)
Use python3 for running tests. Grist has supported python3 for a while,
and is slowly slowly starting to inch away from python2 support. Grist
now needs python3 when doing imports, although python2 is still supported
for regular document operation.
2022-09-06 11:46:52 -04:00
Jarosław Sadziński
2438a63255 (core) Moving widget tests to core
Summary:
- Custom widget tests are now in grist-core
- Adding buildtools for grist-plugin-api.js

Test Plan: Existing tests

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3617
2022-09-06 17:17:14 +02:00
George Gevoian
ec157dc469 (core) Add dark mode to user preferences
Summary:
Adds initial implementation of dark mode. Preferences for dark mode are
available on the account settings page. Dark mode is currently a beta feature
as there are still some small bugs to squash and a few remaining UI elements
to style.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: paulfitz, jarek

Differential Revision: https://phab.getgrist.com/D3587
2022-09-05 19:17:32 -07:00
Paul Fitzpatrick
d7b3fb972c (core) upgrade typeorm so we can support newer postgres
Summary:
upgrade typeorm version, so Grist can run against newer versions of postgres.

Dusted off some old benchmarking code to verify that important queries don't get slower. They don't appear to, unlike for some intermediate versions of typeorm I tried in the past.

Most of the changes are because `findOne` changed how it interprets its arguments, and the value it returns when nothing is found. For the return value, I stuck with limiting its impact by emulating old behavior (returning undefined rather than null) rather than propagating the change out to parts of the code unrelated to the database.

Test Plan: existing tests pass; manual testing with postgres 10 and 14

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3613
2022-09-02 15:34:21 -04:00
Dmitry S
1c24bfc8a6 (core) Fix exports to CSV/XLSX/etc when data is restricted by access rules
Summary:
- The issue manifested as error "Cannot read property '0' of undefined" in some
  cases, and as "Blocked by table read access rules" in others (instead of
  limiting output to what's not blocked)
- Goes deeper: exports weren't respecting metadata censoring.
- The fix changes exports to use censored metadata, which addresses both errors above.
- Includes an improvement to column ordering in XLSX exports.

Test Plan: Add a server test for CSV and XLSX exports with access rules

Reviewers: paulfitz, georgegevoian

Reviewed By: paulfitz, georgegevoian

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3615
2022-09-02 10:59:59 -04:00
Alex Hall
42afb17e36 (core) Run and test imports only in Python 3, upgrade openpyxl, fix weird date handling
Summary:
Python 2 only needs to be supported for the sake of old documents and formulas. This doesn't apply to the separate sandboxes that parse files for imports. Using Python 3 only allows using newer libraries and library versions. In particular, the latest version of openpyxl doesn't support Python 2. This will also make it easier to make other similar changes in the future, such as replacing messytables with a modern library. See https://grist.slack.com/archives/C0234CPPXPA/p1661261829343999?thread_ts=1661260442.837959&cid=C0234CPPXPA

The latest openpyxl is better at handling a particular edge case with broken dates in Excel, but still doesn't quite do what we want, so we monkeypatch it. Discussion: https://grist.slack.com/archives/C02EGJ1FUCV/p1661440851911869?thread_ts=1661154219.515549&cid=C02EGJ1FUCV

Setting `preferredPythonVersion` to '3' in SafePythonComponent ensures that JS always creates import sandboxes that use Python 3. Within Python, a module used by all imports will raise an error in Python 2. Python unit tests of imports are now only run in Python 3, using the `load_tests` protocol of `unittest`.

Test Plan: Mostly existing tests. Added another strange date to the Excel fixture.

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3606
2022-09-02 16:27:34 +02:00
Alex Hall
ecf2fdf71a (core) Fix summary table titles and linking when source table is hidden by ACL
Summary:
Two summary table widgets that share a source table and have compatible groupby columns can be filter linked. This diff fixes a bug where this linking is broken when the source table is hidden by access rules. The source table data isn't needed for the linking, but its metadata is, and that metadata is censored by GranularAccess. To deal with this:

- `LinkConfig._assertValid` allows blank `tableId`s specifically for linking two summary tables.
- `LinkingState.filterColValues` gets the `colId`s of groupby columns from the summary table columns rather than the source table.

A closely related problem is that the titles of summary tables are incomplete when the source table is hidden, e.g. they just say `[by A]` instead of `Table1 [by A]`. To fix this, the raw view sections of source tables are 'uncensored' in GranularAccess.

Initially I also planned to uncensor the tableId of the source table, which seemed like a better and more general fix for the blank tableId problem. But several parts of client code use blank tableIds to know that a table should be hidden, so they were left as is.

Test Plan: Added an nbrowser test for summary table linking, and a server test for uncensoring the raw view section in GranularAccess.

Reviewers: georgegevoian, paulfitz

Reviewed By: georgegevoian, paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3608
2022-09-01 19:14:47 +02:00
Cyprien P
193d5360ad (core) Fix prevent auto-expansion when user is resizing browser window
Summary:
Diff fixes an annoying issue when the left panel would sometimes
auto-expand when the user is resizing the window. Alghouth it is quite
easy to reproduce the issue still would happen a bit randomly.

Here are what was done to fix it:
 1) The most annoying manifestation of the issue happens with doc menu
 page. Indeed the panel is not meant to be collapsing hence triggering
 overlapping expansion messes UI a great deal. This was fix by
 asserting that the panel was collapsible before triggering expansion
 `if (left.hideOpener) { return; }`.

 2) To prevent issue to happen also with doc page, we first test
 whether the user is actually dragging using `ev1.buttons !== 0` and
 also we've added a `isScreeResizingObs` observable. Although this
 seems to have fixed the problem for me, other developers still
 reports occurence of the issue on there machine but at a lesser
 frequence. It is unknown what this solution does not fully work,
 still situation seems acceptable now (most annoying part was 1st
 item).

Diff also brings another small improvement when using Grist in a split
screen setup when Grist is on the right. Moving cursor back and forth
between the two windows would frequently leave the left panel
inadvertandly expanded. Diff added a fix to allow panel to collapse
when cursor leave window.

Test Plan: Tested manually as it is hard to test when selenium.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3562
2022-09-01 12:19:09 +02:00
Dmitry S
b722fb3aaa (core) If invalid tableIds are present in Access Rules, avoid browser errors to show the rules anyway
Summary:
- Previously a JS error was shown when an invalid table was present.
- Now invalid tables are shown as '#Invalid (tableId)'

Test Plan: Added a test case that Access Rules page can load after deletion.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3614
2022-08-31 11:02:56 -04:00
Dmitry S
5e0bf50574 (core) Update text in the delete-page dialog
Summary:
In the delete-page dialog, for the option to keep the data, use the somewhat
clearer text "Keep data and delete page".

Test Plan: No changes to testId, should not affect tests.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3612
2022-08-31 11:01:40 -04:00
Alex Hall
81810bd44b (core) Don't show doc/onboarding tour in embedded mode
Summary:
Tours don't really make sense when you can't see the full interface and document, so they're not shown when the interface style is 'light'.

Discussion: https://grist.slack.com/archives/CDHABLZJT/p1661459343666569?thread_ts=1661183887.200899&cid=CDHABLZJT

Test Plan: Extended nbrowser DocTour test

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3607
2022-08-30 16:46:56 +02:00
Alex Hall
1c43aed5dd (core) Upgrade sortedcontainers, python_dateutil, and html5lib for better Python 3.10 compatibility
Summary:
Based on https://github.com/gristlabs/grist-core/pull/251. It may not look like it, but there's very little going on in this diff:

- Tweak the DATEVALUE doctest for Python 2/3 compatibility.
- Mirrors the PR's changes to requirements3.txt in requirements.txt, i.e. make the same dependency upgrades in Python 2.
- Make the same upgrades in the thirdparty folder for the Python 2 nacl sandbox.

Test Plan: Updated one doctest for dateutil. Checked changelog of sortedcontainers. html5lib is only used by messytables and isn't actually relevant.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3609
2022-08-30 16:46:29 +02:00
Paul Fitzpatrick
63683f98cc (core) updates from grist-core 2022-08-26 17:29:25 -04:00
Alex Hall
ec1d0801fc
Merge pull request #251 from yohanboniface/py10
Update some python deps for python>=3.8 compat
2022-08-26 23:27:54 +02:00
Yohan Boniface
76fc6c87ae
Add docs/ and sandbox_venv*/ in .gitignore (#258)
docs/ is the default path where docs are storer when running app locally
sandbox_venv*/ are created when installing python
2022-08-26 16:20:01 -04:00
Yohan Boniface
ac9f2fbdd1 Update some python deps to prepare python>=3.10 compat
ABC classes have moved from collections to collections.abc since
python 3.3, and retro compat has ended with 3.8
2022-08-26 16:45:24 +02:00
Yohan Boniface
7ae425f869
add a description property to column mapping for custom widgets (#255) 2022-08-26 08:25:34 -04:00
Jarosław Sadziński
b6f5718ad0 (core) Fixing ACIndex highlightMatches functions
Summary:
Highlighting wasn't working correctly for the new
normalized search for autocomplate widgets.

Test Plan: Existing tests

Reviewers: alexmojaki

Reviewed By: alexmojaki

Differential Revision: https://phab.getgrist.com/D3602
2022-08-26 08:34:16 +02:00
George Gevoian
2cb783ea7b (core) Fix bugs with intervals
Summary:
Fixes some bugs involving intervals, and updates RandomizedTimer to support both fixed and
randomized delays, and to better handle async callbacks.

 * Fixed a bug where Throttle would queue up many pidusage calls due to the use of
    setInterval, and the async nature of the calls.

 * Fixed a but where RandomizedTimer (now just Interval) would not be disabled in
    ActiveDoc on doc shutdown if initialization had not yet settled.

Test Plan: Tested manually.

Reviewers: jarek, dsagal

Reviewed By: jarek, dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3604
2022-08-25 12:38:36 -07:00
Dmitry S
af77824618 (core) Add caching for measuring data size in DocStorage, when data isn't changing
Summary:
getDataSize() call can be expensive and involve lots of disk reading. We can
avoid doing it repeatedly when the document isn't actually changing.

Test Plan: Should have no change in behavior except for timings.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3605
2022-08-25 09:50:23 -04:00
Jarosław Sadziński
2997434815 (core) Showing a raw data section on a popup
Summary:
Show raw data will now open a popup with
raw section instead of redirecting to raw data page.

Adding new anchor link type "a2" that is able to open
any section in a popup on a current view.

Not related:
Fixing highlightMatches function, after merging core PR.

Test Plan: Updated tests

Reviewers: alexmojaki, georgegevoian

Reviewed By: alexmojaki, georgegevoian

Subscribers: georgegevoian, alexmojaki

Differential Revision: https://phab.getgrist.com/D3592
2022-08-25 09:30:07 +02:00
George Gevoian
1c722014fa
Merge pull request #254 from vviers/main
fix(ui): pointer cursor when creating a new widget
2022-08-24 14:40:48 -07:00
Yohan Boniface
50a57c673f
Add GRIST_DEFAULT_LOCALE env var (#257) 2022-08-24 15:24:50 -04:00
Paul Fitzpatrick
177b9d83d9 (core) add a log message on proxying failures
Summary:
When a home server fails to fetch from a doc worker, errors are
passed along to clients but we don't get to see them. This fixes
that omission.

Test Plan:
tested manually, by inserting some code to delay
serving particular test documents.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3601
2022-08-24 09:16:19 -04:00
Alex Hall
eac1f26f3e (core) More helpful messages when formula probably needs to use Table.all
Summary:
Raise an exception with a customised message for two cases when a user tries on operation directly on a table without `.all`:

1. For `Table.Col`, where `Col` is an existing column, suggest `Table.all.Col`. If `Col` doesn't exist as a column, fall back to the standard AttributeError.
2. When iterating directly over a table, e.g. `[r for r in Table]`, suggest looping over `Table.all` instead.

Test Plan: Added Python unit tests.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3593
2022-08-24 14:49:33 +02:00