i0110 commited on
Commit
6b5b2cd
·
verified ·
1 Parent(s): b830844

Update public/index.html

Browse files
Files changed (1) hide show
  1. public/index.html +33 -4
public/index.html CHANGED
@@ -205,9 +205,20 @@
205
  border-radius: 4px;
206
  flex-shrink: 0;
207
  }
 
 
 
 
 
 
 
 
 
 
 
208
  .metric-grid {
209
  display: grid;
210
- grid-template-columns: repeat(5, 1fr);
211
  gap: 10px;
212
  margin-top: 10px;
213
  }
@@ -332,6 +343,9 @@
332
  padding: 15px;
333
  margin-bottom: 20px;
334
  }
 
 
 
335
  }
336
  .login-overlay, .confirm-overlay, .loading-overlay {
337
  position: fixed;
@@ -1276,15 +1290,25 @@
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>
1290
  <label style="display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer;">
@@ -1294,6 +1318,7 @@
1294
  <button class="chart-toggle-button" onclick="toggleChart('${instanceId}')">查看图表</button>
1295
  </div>
1296
  </div>
 
1297
  <div class="metric-grid">
1298
  <div class="metric-item">
1299
  <div class="metric-label">状态</div>
@@ -1315,6 +1340,10 @@
1315
  <div class="metric-label">下载</div>
1316
  <div class="metric-value download">N/A</div>
1317
  </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>
 
205
  border-radius: 4px;
206
  flex-shrink: 0;
207
  }
208
+ .server-description {
209
+ margin-top: 5px;
210
+ font-size: 13px;
211
+ color: var(--secondary-text);
212
+ display: -webkit-box;
213
+ -webkit-line-clamp: 2; /* 限制描述最多显示两行 */
214
+ -webkit-box-orient: vertical;
215
+ overflow: hidden;
216
+ text-overflow: ellipsis;
217
+ line-height: 1.4;
218
+ }
219
  .metric-grid {
220
  display: grid;
221
+ grid-template-columns: repeat(3, 1fr); /* 调整为 3 列以容纳更多字段 */
222
  gap: 10px;
223
  margin-top: 10px;
224
  }
 
343
  padding: 15px;
344
  margin-bottom: 20px;
345
  }
346
+ .server-description {
347
+ -webkit-line-clamp: 1; /* 小屏幕限制描述为一行 */
348
+ }
349
  }
350
  .login-overlay, .confirm-overlay, .loading-overlay {
351
  position: fixed;
 
1290
  <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"/>
1291
  </svg>` // 锁图标,表示 private 实例
1292
  : `<svg class="server-flag" width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
1293
+ <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"/>
1294
+ </svg>`; // 服务器图标,表示非 private 实例
1295
 
1296
+ // 格式化 last_modified 为本地时区时间
1297
+ const lastModified = instance.last_modified && instance.last_modified !== 'unknown'
1298
+ ? new Date(instance.last_modified).toLocaleString()
1299
+ : 'N/A';
1300
+
1301
+ // 处理 short_description,为空时不显示
1302
+ const descriptionHtml = instance.short_description
1303
+ ? `<div class="server-description">${instance.short_description}</div>`
1304
+ : '';
1305
+
1306
  card.innerHTML = `
1307
  <div class="server-header">
1308
  <div class="server-name">
1309
  <div class="status-dot status-sleep"></div>
1310
  ${iconSvg}
1311
+ <div>${instance.name}</div>
1312
  </div>
1313
  <div>
1314
  <label style="display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer;">
 
1318
  <button class="chart-toggle-button" onclick="toggleChart('${instanceId}')">查看图表</button>
1319
  </div>
1320
  </div>
1321
+ ${descriptionHtml}
1322
  <div class="metric-grid">
1323
  <div class="metric-item">
1324
  <div class="metric-label">状态</div>
 
1340
  <div class="metric-label">下载</div>
1341
  <div class="metric-value download">N/A</div>
1342
  </div>
1343
+ <div class="metric-item">
1344
+ <div class="metric-label">最后修改</div>
1345
+ <div class="metric-value last-modified">${lastModified}</div>
1346
+ </div>
1347
  </div>
1348
  <div class="action-buttons" style="display: ${isLoggedIn ? 'flex' : 'none'};">
1349
  <button class="action-button view-button" onclick="viewInstance('${instance.url}')">查看</button>