mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-09 12:21:57 -04:00
update REST API and Admin UI to use new id and old_id exclusively
Some checks failed
Build Homebrew package / build (push) Has been cancelled
Run linters / lint (push) Has been cancelled
Build Debian package / build (push) Has been cancelled
Build Docker image / buildx (push) Has been cancelled
Build Pip package / build (push) Has been cancelled
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Has been cancelled
Run tests / docker_tests (push) Has been cancelled
Some checks failed
Build Homebrew package / build (push) Has been cancelled
Run linters / lint (push) Has been cancelled
Build Debian package / build (push) Has been cancelled
Build Docker image / buildx (push) Has been cancelled
Build Pip package / build (push) Has been cancelled
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Has been cancelled
Run tests / docker_tests (push) Has been cancelled
This commit is contained in:
parent
344e902fc6
commit
c4ef2993b2
3 changed files with 26 additions and 25 deletions
|
@ -178,11 +178,6 @@ def get_abid_info(self, obj):
|
|||
return format_html(
|
||||
# URL Hash: <code style="font-size: 10px; user-select: all">{}</code><br/>
|
||||
'''
|
||||
DB PK: <code style="font-size: 16px; user-select: all; border-radius: 8px; background-color: #fdd; padding: 1px 4px; border: 1px solid #aaa; margin-bottom: 8px; display: inline-block; vertical-align: top;"><b>{}</b></code><br/>
|
||||
.old_id: <code style="font-size: 10px; user-select: all">{}</code> <br/>
|
||||
.id: <code style="font-size: 10px; user-select: all">{}</code> <br/>
|
||||
.uuid: <code style="font-size: 10px; user-select: all">{}</code> <br/>
|
||||
<br/>
|
||||
<div style="opacity: 0.8">
|
||||
ABID: <small style="opacity: 0.5">{}_</small><code style="font-size: 16px; user-select: all; border-radius: 8px; background-color: #ddf; padding: 1px 4px; border: 1px solid #aaa; margin-bottom: 8px; display: inline-block; vertical-align: top;"><b>{}</b></code> <a href="{}" style="font-size: 1.5em; font-family: monospace;">/api/v1 GET JSON</a> <a href="{}" style="color: limegreen; font-size: 1.2em; vertical-align: 1px; font-family: monospace;">API DOCS</a><br/>
|
||||
TS: <code style="font-size: 10px; user-select: all"><b>{}</b></code> ({})<br/>
|
||||
|
@ -191,22 +186,18 @@ def get_abid_info(self, obj):
|
|||
RAND: <code style="font-size: 10px; user-select: all"><b>{}</b></code> ({})
|
||||
SALT: <code style="font-size: 10px; user-select: all"><b style="display:inline-block; user-select: all; width: 50px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">{}</b></code>
|
||||
<br/><hr/>
|
||||
<small style="opacity: 0.8">.ulid: <code style="font-size: 10px; user-select: all">{}</code></small><br/>
|
||||
<small style="opacity: 0.8">.uuid: <code style="font-size: 10px; user-select: all">{}</code></small><br/><br/>
|
||||
<small style="opacity: 0.8">.uuid: <code style="font-size: 10px; user-select: all">{}</code></small><br/>
|
||||
<small style="opacity: 0.5">.old_id: <code style="font-size: 10px; user-select: all">{}</code></small>
|
||||
</div>
|
||||
''',
|
||||
obj.pk,
|
||||
getattr(obj, 'old_id', ''),
|
||||
getattr(obj, 'id', ''),
|
||||
getattr(obj, 'uuid', ''),
|
||||
*obj.abid.split('_', 1), obj.api_url, obj.api_docs_url,
|
||||
*str(obj.abid or obj.get_abid()).split('_', 1), obj.api_url, obj.api_docs_url,
|
||||
obj.ABID.ts, obj.abid_values['ts'].isoformat() if isinstance(obj.abid_values['ts'], datetime) else obj.abid_values['ts'],
|
||||
obj.ABID.uri, str(obj.abid_values['uri']),
|
||||
obj.ABID.subtype, str(obj.abid_values['subtype']),
|
||||
obj.ABID.rand, str(obj.abid_values['rand'])[-7:],
|
||||
obj.ABID.uri_salt,
|
||||
obj.ABID.ulid,
|
||||
obj.ABID.uuid,
|
||||
getattr(obj, 'old_id', ''),
|
||||
)
|
||||
|
||||
|
||||
|
@ -495,7 +486,10 @@ class TagAdmin(admin.ModelAdmin):
|
|||
ordering = ['-id']
|
||||
|
||||
def identifiers(self, obj):
|
||||
return get_abid_info(self, obj)
|
||||
try:
|
||||
return get_abid_info(self, obj)
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
def num_snapshots(self, tag):
|
||||
return format_html(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue