chekos / RIPA-2018-datasette

Publishing datasette of CA's RIPA 2018 data
http://ripa-2018.datasettes.cimarron.io/
GNU General Public License v3.0
0 stars 0 forks source link

Add button to submit SQL query as suggested canned query #13

Closed chekos closed 4 years ago

chekos commented 4 years ago

Is there a way to send the SQL query we just ran as the text of a new GitHub issue? It would make submitting canned queries a lot easier 🤔

chekos commented 4 years ago

Maybe add another button after Format SQL and Run SQL

https://github.com/simonw/datasette/blob/master/datasette/templates/query.html

chekos commented 4 years ago

https://developer.github.com/v3/issues/#create-an-issue

chekos commented 4 years ago

https://help.github.com/en/github/managing-your-work-on-github/about-automation-for-issues-and-pull-requests-with-query-parameters

chekos commented 4 years ago

https://www.w3schools.com/jsref/jsref_encodeuricomponent.asp

chekos commented 4 years ago

essetially

https://GitHub.com/chekos/ripa-2018-datasette/issues/new?title=Query+suggestion&labels=suggestion&body=testing+query

and just use encodeURIcomponent() on the query to add to the body parameter

maybe encode back ticks too `

chekos commented 4 years ago

select #sql-query -> encode it -> send it as body

chekos commented 4 years ago

on load create the URL and attach it as href of button to submit query

chekos commented 4 years ago

because it's jinja2 I think you can just access the request object and grab the SQL query URI ready to go

{{ request.spit("sql=")[0].split("&")[0] }}

maybe

chekos commented 4 years ago

maybe it's {{request.args.get("sql")}}