mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Fix 'select by' when adding summary table widget to page
Summary: When adding a summary table widget to a page and using 'select by' in the add widget config (as opposed to in the right panel for an existing widget): 1. If an equivalent summary table already exists, use its referencing columns (if any) to construct link nodes. Previously the source table columns were being used instead, which could include referencing columns that don't have any equivalent in the summary table, and exclude referencing columns in the summary table. 2. If no such summary table exists yet, then keep using the source table columns, but only the selected groupby columns, and 3. After the summary table is created, correct the `linkTargetColRef` (which points to a source table column) to the corresponding column from the new summary table instead. This fixes bugs which only appeared recently since 'select by' for a summary table previously involved no target columns. Test Plan: Added two new tests to `nbrowser/SelectBySummaryRef`, and confirmed that they fail without the fixes to all three points above. Reviewers: dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D3527
This commit is contained in:
@@ -871,6 +871,7 @@ export interface PageWidgetPickerOptions {
|
||||
tableName?: string;
|
||||
selectBy?: RegExp|string; // Optional pattern of SELECT BY option to pick.
|
||||
summarize?: (RegExp|string)[]; // Optional list of patterns to match Group By columns.
|
||||
dontAdd?: boolean; // If true, configure the widget selection without actually adding to the page
|
||||
}
|
||||
|
||||
// Add a new page using the 'Add New' menu and wait for the new page to be shown.
|
||||
@@ -939,8 +940,14 @@ export async function selectWidget(
|
||||
await driver.findContent('.test-wselect-selectby option', options.selectBy).doClick();
|
||||
}
|
||||
|
||||
// let's select right type and save
|
||||
// select right type
|
||||
await driver.findContent('.test-wselect-type', typeRe).doClick();
|
||||
|
||||
if (options.dontAdd) {
|
||||
return;
|
||||
}
|
||||
|
||||
// add the widget
|
||||
await driver.find('.test-wselect-addBtn').doClick();
|
||||
|
||||
// if we selected a new table, there will be a popup for a name
|
||||
|
||||
Reference in New Issue
Block a user