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

database color shows only on index page, not other pages #2119

Closed
simonw opened this issue Jul 27, 2023 · 3 comments
Closed

database color shows only on index page, not other pages #2119

simonw opened this issue Jul 27, 2023 · 3 comments
Labels
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Jul 27, 2023

I think this has been a bug for a long time.

https://latest.datasette.io/ currently shows:

image

Those colors are based on a hash of the database name. But when you click through to https://latest.datasette.io/fixtures

image

It's red on all sub-pages too.

@simonw
Copy link
Owner Author

simonw commented Aug 11, 2023

Relevant template snippet:

<h2 style="padding-left: 10px; border-left: 10px solid #{{ database.color }}"><a href="{{ urls.database(database.name) }}">{{ database.name }}</a>{% if database.private %} 🔒{% endif %}</h2>

@simonw
Copy link
Owner Author

simonw commented Aug 11, 2023

That database.color is only available in index.html at the moment thanks to this:

"color": db.hash[:6]
if db.hash
else hashlib.md5(name.encode("utf8")).hexdigest()[:6],

@simonw simonw closed this as completed in 4535568 Aug 11, 2023
simonw added a commit that referenced this issue Aug 22, 2023
* API explorer requires view-instance permission

* Check database/table permissions on /-/api page

* Release notes for 1.0a4

Refs #2119, #2133, #2138, #2140

Refs GHSA-7ch3-7pp7-7cpq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant