-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
Submodule specs
updated
34 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block title %}{{ metadata.title or "Datasette" }}: Reconciliation{% endblock %} | ||
|
||
{%- block extra_head %} | ||
{{- super() -}} | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.4.1/papaparse.min.js" | ||
integrity="sha512-dfX5uYVXzyU8+KHqj8bjo7UkOdg18PaOtpa48djpNbZHwExddghZ+ZmzWT06R5v6NSk3ZUfsH6FNEDepLx9hPQ==" | ||
crossorigin="anonymous" referrerpolicy="no-referrer"></script> | ||
<script> | ||
const RECONCILE_URL = {{ reconcile_url|tojson }}; | ||
</script> | ||
{% endblock -%} | ||
|
||
{% block content %} | ||
<h1>{{ metadata.title or "Datasette" }} Reconciliation {% if private %} 🔒{% endif %}</h1> | ||
|
||
{{ reconcile_config }} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from datasette.version import __version__ | ||
from datasette.views.base import BaseView | ||
|
||
from datasette_reconcile.utils import check_config, check_permissions | ||
|
||
|
||
class ReconcileHTML(BaseView): | ||
name = "reconcile_html" | ||
|
||
async def get(self, request): | ||
database = request.url_vars["db_name"] | ||
table = request.url_vars["db_table"] | ||
db = self.ds.get_database(database) | ||
|
||
# get plugin configuration | ||
config = self.ds.plugin_config("datasette-reconcile", database=database, table=table) | ||
config = await check_config(config, db, table) | ||
|
||
# check user can at least view this table | ||
await check_permissions( | ||
request, | ||
[ | ||
("view-table", (database, table)), | ||
("view-database", database), | ||
"view-instance", | ||
], | ||
self.ds, | ||
) | ||
|
||
return await self.render( | ||
["reconcile.html"], | ||
request=request, | ||
context={ | ||
"database": database, | ||
"table": table, | ||
"reconcile_config": config, | ||
"reconcile_url": self.ds.absolute_url(request, self.ds.urls.table(database, table) + "/-/reconcile"), | ||
"metadata": self.ds.metadata(), | ||
"datasette_version": __version__, | ||
"private": not await self.ds.permission_allowed(None, "view-instance"), | ||
}, | ||
) |