feat: add legacy device migration flow

This commit is contained in:
QiuSW
2026-07-21 10:06:51 +08:00
parent 7b80ae3a7a
commit 1af47d043e
20 changed files with 1030 additions and 6 deletions
@@ -0,0 +1,17 @@
{% extends "portal/base.html" %}
{% block title %}设备授权 | 虾皮圈{% endblock %}
{% block content %}
<section class="container py-5">
<h1 class="h3 mb-4">设备授权</h1>
<div class="table-responsive"><table class="table align-middle">
<thead><tr><th>产品</th><th>设备平台</th><th>客户端版本</th><th>到期时间</th><th>状态</th><th></th></tr></thead>
<tbody>{% for credential in credentials %}<tr>
<td>{{ credential.get_product_code_display }}</td><td>{{ credential.device.get_platform_display }}</td><td>{{ credential.device.client_version }}</td><td>{{ credential.expires_at }}</td>
<td>{% if credential.revoked_at %}已吊销{% else %}有效{% endif %}</td>
<td>{% if not credential.revoked_at %}<form method="post" action="{% url 'portal-device-credential-revoke' credential.pk %}">{% csrf_token %}<button class="btn btn-outline-danger btn-sm">解绑</button></form>{% endif %}</td>
</tr>{% empty %}<tr><td colspan="6" class="text-muted">暂无已确认设备。</td></tr>{% endfor %}</tbody>
</table></div>
</section>
{% endblock %}
@@ -0,0 +1,19 @@
{% extends "portal/base.html" %}
{% block title %}确认设备迁移 | 虾皮圈{% endblock %}
{% block content %}
<section class="container py-5" style="max-width: 720px;">
<h1 class="h3 mb-3">确认设备迁移</h1>
<p class="text-muted">确认后,当前设备会占用一个软件授权席位。</p>
<dl class="row">
<dt class="col-sm-4">产品</dt><dd class="col-sm-8">{{ migration_request.device.get_product_code_display }}</dd>
<dt class="col-sm-4">客户端版本</dt><dd class="col-sm-8">{{ migration_request.device.client_version }}</dd>
<dt class="col-sm-4">确认截止</dt><dd class="col-sm-8">{{ migration_request.expires_at }}</dd>
<dt class="col-sm-4">状态</dt><dd class="col-sm-8">{{ migration_request.get_status_display }}</dd>
</dl>
{% if migration_request.status == "pending" %}
<form method="post">{% csrf_token %}<button type="submit" class="btn btn-primary">确认当前设备</button></form>
{% endif %}
</section>
{% endblock %}