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

Limit text display in cells containing large amounts of text #330

Closed
psychemedia opened this issue Jun 29, 2018 · 4 comments
Closed

Limit text display in cells containing large amounts of text #330

psychemedia opened this issue Jun 29, 2018 · 4 comments

Comments

@psychemedia
Copy link
Contributor

psychemedia commented Jun 29, 2018

The default preview of a database shows all columns (is the row count limited?) which is fine in many cases but can take a long time to load / offer a large overhead if the table is a SpatiaLite table containing geometry columns that include large shapefiles.

Would it make sense to have a setting that can limit the amount of text displayed in any given cell in the table preview, or (less useful?) suppress (with notification) the display of overlong columns unless enabled by the user?

An issue then arises if a user does want to see all the text in a cell:

  1. for a particular cell;
  2. for every cell in the table;
  3. for all cells in a particular column or columns

(I haven't checked but what if a column contains e.g. raw image data? Does this display as raw data? Or can this be rendered in a context aware way as an image preview? I guess a custom template would be one way to do that?)

@psychemedia psychemedia changed the title Limited text display in cells containing large amounts of text Limit text display in cells containing large amounts of text Jun 29, 2018
@simonw
Copy link
Owner

simonw commented Jul 10, 2018

This relates to #276 - I'm definitely convinced now that displaying a giant b'...' blob on the page is not a useful default.

@simonw
Copy link
Owner

simonw commented Jul 10, 2018

I think this makes sense for the HTML view (not for JSON or CSV). It could be controlled be a new config option, truncate_cells_html - which is on by default but can be turned off.

@simonw simonw closed this as completed in fc9b1cc Jul 10, 2018
@simonw
Copy link
Owner

simonw commented Jul 10, 2018

datasette publish now timezones.db --spatialite \
  --extra-options="--config truncate_cells_html:200" \
  --name=datasette-issue-330-demo \
  --branch=master

https://datasette-issue-330-demo-sbelwxttfn.now.sh/timezones-3cb9f64/timezones

2018-07-10 at 10 39 am

But https://datasette-issue-330-demo-sbelwxttfn.now.sh/timezones-3cb9f64/timezones/1 displays the full blob.

@simonw
Copy link
Owner

simonw commented Jul 10, 2018

@simonw simonw added this to the Next release milestone Jul 10, 2018
@simonw simonw removed this from the Next release milestone Jul 24, 2018
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

No branches or pull requests

2 participants