总览无持仓时仍显示灰色禁用平仓按钮,避免操作列只剩打开。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-04 09:57:47 +08:00
parent 706601416b
commit 822ef65f2d
3 changed files with 21 additions and 3 deletions
+10
View File
@@ -302,6 +302,16 @@ button, .btn {
} }
.btn:hover, button:hover { filter: brightness(1.06); } .btn:hover, button:hover { filter: brightness(1.06); }
.btn-danger { background: #9f1239; color: #fff; } .btn-danger { background: #9f1239; color: #fff; }
.btn-close-disabled,
.btn-close-disabled:hover,
.btn.btn-close-disabled:disabled {
background: #3a3f4b;
color: #8b93a7;
border: 1px solid #4a5160;
cursor: not-allowed;
filter: none;
opacity: 1;
}
.btn-sm { .btn-sm {
padding: 3px 8px; padding: 3px 8px;
font-size: 0.75rem; font-size: 0.75rem;
+10 -2
View File
@@ -85,11 +85,19 @@
} }
function closeActionButtons(brief, instanceId, online) { function closeActionButtons(brief, instanceId, online) {
if (!online) return "";
const list = (brief || []).filter(function (p) { const list = (brief || []).filter(function (p) {
return !!(p && p.inst_id); return !!(p && p.inst_id);
}); });
if (!list.length) return ""; if (!online) {
return (
'<button type="button" class="btn btn-close-disabled" disabled title="实例离线">平仓</button>'
);
}
if (!list.length) {
return (
'<button type="button" class="btn btn-close-disabled" disabled title="暂无持仓">平仓</button>'
);
}
return list return list
.slice(0, 8) .slice(0, 8)
.map(function (p) { .map(function (p) {
+1 -1
View File
@@ -15,6 +15,6 @@
<div id="overview-grid"></div> <div id="overview-grid"></div>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ url_for('static', filename='hub.js') }}?v=16"></script> <script src="{{ url_for('static', filename='hub.js') }}?v=17"></script>
<script>HubOverview.boot();</script> <script>HubOverview.boot();</script>
{% endblock %} {% endblock %}