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

Switch description_html to description and obtain_url and obtain_label #12

Closed
simonw opened this issue Apr 24, 2024 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Contributor

simonw commented Apr 24, 2024

I don't like having HTML in the system like this. Instead I'll field the URL you can obtain a secret from separately.

Secret(
"OPENAI_API_KEY",
'An OpenAI API key. Get them from <a href="https://platform.openai.com/api-keys">here</a>.',
),

@dataclasses.dataclass
class Secret:
name: str
description_html: Optional[str] = None

@simonw simonw added the enhancement New feature or request label Apr 24, 2024
@simonw
Copy link
Contributor Author

simonw commented Apr 24, 2024

I'm going to make it an optional thing called obtain_url.

@simonw
Copy link
Contributor Author

simonw commented Apr 24, 2024

... no I'm going to have a field for the label and a field for the URL. I don't like the accessibility implications of having a lot of URLs with the same label.

@simonw
Copy link
Contributor Author

simonw commented Apr 24, 2024

Updated the demo plugin: https://gist.github.com/simonw/d6c3500ea0c77499034df6b4e409e3e3

from datasette_secrets import Secret
from datasette import hookimpl

@hookimpl
def register_secrets():
    return [
        Secret(
            name="DEMO_SECRET_ONE",
            description="First demo secret",
        ),
        Secret(
            name="DEMO_SECRET_TWO",
            description="Second demo secret",
            obtain_url="https://www.example.com/",
            obtain_label="Example",
        ),
        Secret(
            name="DEMO_SECRET_THREE",
            obtain_url="https://three.example.com/",
            obtain_label="Example 3",
        ),
    ]
datasette install https://gist.github.com/simonw/d6c3500ea0c77499034df6b4e409e3e3/archive/0042a7ffd7bcf35a42d00874171a57159c69458a.zip

@simonw simonw changed the title I don't like description_html - switch to description and url I don't like description_html - switch to description and obtain_url and obtain_label Apr 24, 2024
@simonw simonw changed the title I don't like description_html - switch to description and obtain_url and obtain_label Switch description_html to description and obtain_url and obtain_label Apr 24, 2024
@simonw simonw closed this as completed in 56640af Apr 24, 2024
simonw added a commit that referenced this issue Apr 24, 2024
@simonw
Copy link
Contributor Author

simonw commented Apr 24, 2024

Now looks like this:

CleanShot 2024-04-24 at 15 08 15@2x

And on the edit screen:

CleanShot 2024-04-24 at 15 08 37@2x

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

No branches or pull requests

1 participant