(core) Allow descriptions for Raw Data tables

Summary: Descriptions can now be set on Raw Data table sections.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4131
pull/787/head
George Gevoian 6 months ago
parent 887717bb15
commit cc56e91f5b

@ -482,5 +482,6 @@ const cssFlexRow = styled('div', `
`);
const cssRenamableTableName = styled('div', `
align-items: center;
flex: initial;
`);

@ -460,7 +460,7 @@ class UserActions(object):
table_id == "_grist_Views_section"
and any(rec.isRaw for i, rec in self._bulk_action_iter(table_id, row_ids))
):
allowed_fields = {"title", "options", "sortColRefs", "rules"}
allowed_fields = {"title", "description", "options", "sortColRefs", "rules"}
has_summary_section = any(rec.tableRef.summarySourceTable
for i, rec in self._bulk_action_iter(table_id, row_ids))
if has_summary_section:

@ -108,6 +108,36 @@ describe('RawData', function () {
assert.deepEqual(tables, ['Town', 'Empire', 'CountryLanguage', 'Table1'].sort());
});
it('should show table description', async function () {
// Give Empire table a description.
await gu.renameRawTable('Empire', undefined, 'My raw data table description.');
// Check that a description icon tooltip is shown next to the title.
await driver.findContent('.test-raw-data-table-title', 'Empire')
.find('.test-widget-info-tooltip')
.click();
await gu.waitToPass(async () => {
assert.isTrue(await driver.find('.test-widget-info-tooltip-popup').isDisplayed());
});
assert.equal(
await driver.find('.test-widget-info-tooltip-popup').getText(),
'My raw data table description.'
);
// Open Empire table and check that the tooltip is shown there as well.
await driver.findContent('.test-raw-data-table-title', 'Empire').click();
await gu.waitForServer();
await driver.find('.test-viewsection-title .test-widget-info-tooltip').click();
await gu.waitToPass(async () => {
assert.isTrue(await driver.find('.test-widget-info-tooltip-popup').isDisplayed());
});
assert.equal(
await driver.find('.test-widget-info-tooltip-popup').getText(),
'My raw data table description.'
);
await gu.closeRawTable();
});
it('should remove table', async function () {
// Open menu for Town
await openMenu('Town');

@ -1531,16 +1531,25 @@ export async function openRawTable(tableId: string) {
await driver.find(`.test-raw-data-table .test-raw-data-table-id-${tableId}`).click();
}
export async function renameRawTable(tableId: string, newName: string) {
export async function renameRawTable(tableId: string, newName?: string, newDescription?: string) {
await driver.find(`.test-raw-data-table .test-raw-data-table-id-${tableId}`)
.findClosest('.test-raw-data-table')
.find('.test-raw-data-table-menu')
.click();
await driver.find('.test-raw-data-menu-rename-table').click();
const input = await driver.find(".test-widget-title-table-name-input");
await input.doClear();
await input.click();
await driver.sendKeys(newName, Key.ENTER);
if (newName !== undefined) {
const input = await driver.find(".test-widget-title-table-name-input");
await input.doClear();
await input.click();
await driver.sendKeys(newName);
}
if (newDescription !== undefined) {
const input = await driver.find(".test-widget-title-section-description-input");
await input.doClear();
await input.click();
await driver.sendKeys(newDescription);
}
await driver.find(".test-widget-title-save").click();
await waitForServer();
}

Loading…
Cancel
Save