better-staridc-MNBT
1<?php
2/** 存储卷 */
3$active = 'volume';
4include __DIR__ . '/head.php';
5?>
6<div class="dk-card">
7 <div class="dk-card-head"><h3>存储卷</h3><button class="dk-btn dk-btn-ghost dk-btn-sm" onclick="loadVolumes()">刷新</button></div>
8 <div class="dk-card-body flush">
9 <div class="dk-spinner-overlay" id="dkVolLoading"><span class="dk-spin"></span> 加载中…</div>
10 <table class="dk-table" id="dkVolTable" style="display:none">
11 <thead><tr><th>名称</th><th>驱动</th><th>挂载点</th><th>创建时间</th></tr></thead>
12 <tbody></tbody>
13 </table>
14 </div>
15</div>
16<script>
17function esc(s){ return $('<div>').text(s==null?'':String(s)).html(); }
18function loadVolumes(){
19 $('#dkVolLoading').show(); $('#dkVolTable').hide();
20 dkAjax('volume_list', {}, {silent:true, timeout:60000}).then(function(r){
21 var list = r.data && r.data.data ? r.data.data : (r.data || []);
22 list = Array.isArray(list) ? list : [];
23 var rows = '';
24 if (!list.length) rows = '<tr><td colspan="4" class="dk-empty">暂无存储卷</td></tr>';
25 list.forEach(function(v){
26 rows += '<tr><td class="dk-mono">'+ esc(v.Name || v.name || '-') +'</td><td>'+ esc(v.Driver || v.driver || '-') +'</td><td class="dk-mono" style="font-size:12px">'+ esc(v.Mountpoint || v.mountpoint || '-') +'</td><td class="dk-mono">'+ esc(v.CreatedAt || v.created_at || '-') +'</td></tr>';
27 });
28 $('#dkVolTable tbody').html(rows);
29 $('#dkVolLoading').hide(); $('#dkVolTable').show();
30 }).fail(function(){ $('#dkVolLoading').html('<div class="dk-empty"><p>加载失败,请确认节点 Docker 可用</p></div>'); });
31}
32loadVolumes();
33</script>
34<?php include __DIR__ . '/foot.php'; ?>