Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dropdown conditions on column rename #1038

Merged
merged 81 commits into from
Jul 12, 2024

Conversation

SleepyLeslie
Copy link
Collaborator

This PR adds the ability to automatically update the dropdown condition formula on a reference column when a column it refers to has been renamed.

Copy link
Contributor

@berhalak berhalak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some tests for this functionality?

@SleepyLeslie
Copy link
Collaborator Author

SleepyLeslie commented Jun 13, 2024

Refactored the entire logic. Now ACL formulas and dropdown condition formulas use the same logic to handle renames. Previously $ notations in ACL formulas are not auto-renamed. This should also be fixed now.

Comments and tests to come later.

@SleepyLeslie SleepyLeslie force-pushed the sleepyleslie/dropdown-cond-update branch 5 times, most recently from 3e14132 to 101f4e9 Compare June 15, 2024 01:00
@SleepyLeslie SleepyLeslie force-pushed the sleepyleslie/dropdown-cond-update branch 2 times, most recently from 2ead64c to 4eeb928 Compare June 15, 2024 01:10
@SleepyLeslie SleepyLeslie force-pushed the sleepyleslie/dropdown-cond-update branch 2 times, most recently from e538e20 to a1b537b Compare June 15, 2024 02:17
@SleepyLeslie SleepyLeslie force-pushed the sleepyleslie/dropdown-cond-update branch from a1b537b to 9847b84 Compare June 15, 2024 02:20
@jordigh jordigh self-assigned this Jun 18, 2024
Paul Janzen and others added 21 commits July 8, 2024 13:30
Currently translated at 100.0% (1340 of 1340 strings)

Translation: Grist/client
Translate-URL: https://hosted.weblate.org/projects/grist/client/de/
Each time the a Grist page is reload the `last_connection_at` of the user is updated

resolve [#924](#924)
We need this directory for building the image, but not for running the
tests outside of it.
While the intent was to run tests with it, we don't need it. Instead,
this caused problems because the stubs overrode the intended `ext`
directory and therefore disabled the ext features.
Currently translated at 99.1% (1329 of 1340 strings)

Translation: Grist/client
Translate-URL: https://hosted.weblate.org/projects/grist/client/fr/
Currently translated at 100.0% (1340 of 1340 strings)

Translation: Grist/client
Translate-URL: https://hosted.weblate.org/projects/grist/client/sk/
Summary:
- Adding confirmation dialog when user doesn't want to cancel site
- Changing `Cancel subscription` to `Cancel plan`
- Removing `Pro` from upgrade header on pricing modal
- Better handling situation when there is no default price
- Removing mentions about sprouts program
- Removing cache for stripe plans

Test Plan: Updated tests

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4273
Summary:
Some editors do some async work before saving the value (Ref column can add new
records). Those actions were send without bundling, so it wasn't possible to undo those
actions with togheter.

Test Plan: Added new test

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4285
This is to facilitate alerting to detect if snapshot generation were to
stall for a document.
Reorganize preview workflows so that previews can be made for PRs from outside contributors.
Summary:
Adding authorization header support for webhooks.

Issue:  #827

---------

Co-authored-by: Florent <florent.git@zeteo.me>
Copy link
Member

@dsagal dsagal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good, just one lingering question about syntaxerrors.

widget_options["dropdownCondition"] = {"text": new_dc_formula}
try:
# Parse the new dropdown condition formula if it is syntactically correct.
# The data engine stops processing remaining formulas when it hits an exception. Parsing a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence sounds wrong. Generally Grist formulas can have exceptions and that doesn't normally interfere with other formulas. So probably you mean something more specific -- it would be good to clarify.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rephrased it a bit. Hope it's clearer now.

sandbox/grist/predicate_formula.py Outdated Show resolved Hide resolved
sandbox/grist/test_dropdown_condition_renames.py Outdated Show resolved Hide resolved
@dsagal
Copy link
Member

dsagal commented Jul 11, 2024

I think one remaining comment is about making public a UserActions member that seems better to keep non-public: #1038 (comment)

Copy link
Member

@dsagal dsagal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two more comments but really minor now. Approving. Thank you very much! I appreciate in particular unifying quite a bit of the logic and fixing the renaming of acl formulas with "$" signs along the way!

sandbox/grist/acl.py Outdated Show resolved Hide resolved
sandbox/grist/dropdown_condition.py Show resolved Hide resolved
@SleepyLeslie SleepyLeslie merged commit 6326205 into main Jul 12, 2024
11 checks passed
@SleepyLeslie SleepyLeslie deleted the sleepyleslie/dropdown-cond-update branch July 12, 2024 14:59
# Build up a dictionary mapping col_ref of each affected formula to the new formula text.
formula_updates = self._prepare_formula_renames(renames)

# For any affected columns, include the formula into the update.
for col_rec, new_formula in sorted(six.iteritems(formula_updates)):
col_updates.setdefault(col_rec, {}).setdefault('formula', new_formula)

acl.perform_acl_rule_renames(self, renames)
Copy link
Contributor

@berhalak berhalak Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsagal @SleepyLeslie Can I move those two method calls down below (where it were before)?
The new order of things generates acl rename actions before the column is actually renamed. Before the order was reversed, first RenameAction then UpdateRecord (for ACL)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing it offline, I will update it in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.