Update public/index.html
Browse files- public/index.html +17 -3
public/index.html
CHANGED
@@ -1270,13 +1270,20 @@
|
|
1270 |
if (!isLoggedIn) {
|
1271 |
card.classList.add('not-logged-in'); // 未登录时添加类以调整高度
|
1272 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1273 |
card.innerHTML = `
|
1274 |
<div class="server-header">
|
1275 |
<div class="server-name">
|
1276 |
<div class="status-dot status-sleep"></div>
|
1277 |
-
|
1278 |
-
<path d="M21 3H3C1.9 3 1 3.9 1 5v3c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-1 5H4V6h16v2zm1 4H3c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm-1 5H4v-2h16v2zm1 4H3c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm-1 5H4v-2h16v2z"/>
|
1279 |
-
</svg>
|
1280 |
<div>${instance.name} </div>
|
1281 |
</div>
|
1282 |
<div>
|
@@ -1311,6 +1318,7 @@
|
|
1311 |
</div>
|
1312 |
<div class="action-buttons" style="display: ${isLoggedIn ? 'flex' : 'none'};">
|
1313 |
<button class="action-button view-button" onclick="viewInstance('${instance.url}')">查看</button>
|
|
|
1314 |
<button class="action-button" onclick="showConfirmDialog('restart', '${instance.repo_id}', '确认重启', '您确定要重启实例 ${instance.name} (${instance.repo_id}) 吗?')">重启</button>
|
1315 |
<button class="action-button" onclick="showConfirmDialog('rebuild', '${instance.repo_id}', '确认重建', '您确定要重建实例 ${instance.name} (${instance.repo_id}) 吗?')">重建</button>
|
1316 |
</div>
|
@@ -1590,6 +1598,12 @@
|
|
1590 |
function viewInstance(url) {
|
1591 |
window.open(url, '_blank');
|
1592 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1593 |
|
1594 |
// 新增函数:切换实例监控状态
|
1595 |
function toggleMonitorInstance(instanceId, checked) {
|
|
|
1270 |
if (!isLoggedIn) {
|
1271 |
card.classList.add('not-logged-in'); // 未登录时添加类以调整高度
|
1272 |
}
|
1273 |
+
// 根据 instance.private 属性选择不同的图标
|
1274 |
+
const iconSvg = instance.private
|
1275 |
+
? `<svg class="server-flag" width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
|
1276 |
+
<path d="M18 8v-3c0-1.656-1.344-3-3-3h-6c-1.656 0-3 1.344-3 3v3h-3v14h18v-14h-3zm-10-1.5c0-.828.672-1.5 1.5-1.5h5c.828 0 1.5.672 1.5 1.5v2.5h-8v-2.5zm4 11.5c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z"/>
|
1277 |
+
</svg>` // 锁图标,表示 private 实例
|
1278 |
+
: `<svg class="server-flag" width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
|
1279 |
+
<path d="M21 3H3C1.9 3 1 3.9 1 5v3c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-1 5H4V6h16v2zm1 4H3c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm-1 5H4v-2h16v2zm1 4H3c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm-1 5H4v-2h16v2z"/>
|
1280 |
+
</svg>`; // 服务器图标,表示非 private 实例
|
1281 |
+
|
1282 |
card.innerHTML = `
|
1283 |
<div class="server-header">
|
1284 |
<div class="server-name">
|
1285 |
<div class="status-dot status-sleep"></div>
|
1286 |
+
${iconSvg}
|
|
|
|
|
1287 |
<div>${instance.name} </div>
|
1288 |
</div>
|
1289 |
<div>
|
|
|
1318 |
</div>
|
1319 |
<div class="action-buttons" style="display: ${isLoggedIn ? 'flex' : 'none'};">
|
1320 |
<button class="action-button view-button" onclick="viewInstance('${instance.url}')">查看</button>
|
1321 |
+
<button class="action-button" onclick="manageInstance('${instance.repo_id}')">管理</button>
|
1322 |
<button class="action-button" onclick="showConfirmDialog('restart', '${instance.repo_id}', '确认重启', '您确定要重启实例 ${instance.name} (${instance.repo_id}) 吗?')">重启</button>
|
1323 |
<button class="action-button" onclick="showConfirmDialog('rebuild', '${instance.repo_id}', '确认重建', '您确定要重建实例 ${instance.name} (${instance.repo_id}) 吗?')">重建</button>
|
1324 |
</div>
|
|
|
1598 |
function viewInstance(url) {
|
1599 |
window.open(url, '_blank');
|
1600 |
}
|
1601 |
+
|
1602 |
+
// 新增函数:在新标签页中打开实例的管理页面
|
1603 |
+
function manageInstance(repoId) {
|
1604 |
+
const manageUrl = `https://huggingface.co/spaces/${repoId}`;
|
1605 |
+
window.open(manageUrl, '_blank');
|
1606 |
+
}
|
1607 |
|
1608 |
// 新增函数:切换实例监控状态
|
1609 |
function toggleMonitorInstance(instanceId, checked) {
|