fix: 设备名改用flex布局,按钮不再折行
This commit is contained in:
parent
1938a26f5a
commit
337c136829
@ -49,7 +49,7 @@
|
||||
{{if .Device.Online}}<span class="pill ok">在线</span>{{else}}<span class="pill bad">离线</span>{{end}}
|
||||
</div>
|
||||
<div class="info-list">
|
||||
<div><span>设备名称</span><strong>{{displayDeviceName .Device .ConfigStatus}}<span class="btn-icon ghost" style="margin-left:6px;font-size:11px;cursor:pointer;vertical-align:baseline" onclick="editDeviceName(this,'{{.Device.DeviceID}}')">✎</span></strong></div>
|
||||
<div><span>设备名称</span><strong style="display:flex;align-items:center;gap:6px"><span>{{displayDeviceName .Device .ConfigStatus}}</span><span class="btn-icon ghost" style="font-size:11px;cursor:pointer" onclick="editDeviceName(this,'{{.Device.DeviceID}}')">✎</span></strong></div>
|
||||
<div><span>设备 ID</span><strong class="mono">{{.Device.DeviceID}}</strong></div>
|
||||
<div><span>管理地址</span><strong class="mono">{{.Device.IP}}:{{.Device.AgentPort}}</strong></div>
|
||||
<div><span>视频端口</span><strong class="mono">{{.Device.MediaPort}}</strong></div>
|
||||
@ -248,19 +248,22 @@
|
||||
</div>
|
||||
<script>
|
||||
function editDeviceName(el, deviceID) {
|
||||
var current = el.parentNode.querySelector('strong').textContent;
|
||||
var strong = el.parentNode;
|
||||
var nameSpan = strong.querySelector('span:first-child');
|
||||
var current = nameSpan.textContent.trim();
|
||||
var input = document.createElement('input');
|
||||
input.value = current.indexOf('[') === 0 ? '' : current;
|
||||
input.style.cssText = 'width:200px;padding:2px 6px;font-size:13px;margin-left:4px';
|
||||
input.value = current;
|
||||
input.style.cssText = 'width:200px;padding:2px 6px;font-size:inherit;font-weight:400;border:1px solid var(--primary);border-radius:4px';
|
||||
nameSpan.style.display = 'none';
|
||||
el.style.display = 'none';
|
||||
el.parentNode.appendChild(input);
|
||||
strong.insertBefore(input, strong.firstChild);
|
||||
input.focus();
|
||||
input.select();
|
||||
function save() {
|
||||
var name = input.value.trim();
|
||||
input.remove();
|
||||
el.style.display = '';
|
||||
if (!name || name === current) return;
|
||||
if (!name || name === current) { input.remove(); el.style.display = ''; return; }
|
||||
var form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = '/devices/' + deviceID + '/alias';
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user