feat(station): group slave nodes by station target
Merge stations with the same station code and platform into one logical target, and expand music and temp broadcast playback to all online slave nodes while the console and picker UIs show grouped station entries with node counts.
This commit is contained in:
@@ -925,6 +925,8 @@
|
||||
const isBroadcasting = broadcastingStations.has(st.name);
|
||||
const dotClass = isBroadcasting ? 'dot-broadcasting' : (isOnline ? 'dot-online' : 'dot-offline');
|
||||
const hasCC = Array.isArray(st.tags) && st.tags.includes('CC');
|
||||
const stationTarget = st.target || st.name;
|
||||
const memberCount = Number(st.memberCount || 1);
|
||||
const div = document.createElement('div');
|
||||
div.className = 'status-item';
|
||||
div.id = `station-item-${st.name.replace(/[^a-zA-Z0-9]/g, '_')}`;
|
||||
@@ -935,11 +937,11 @@
|
||||
${st.name}
|
||||
${hasCC ? '<span style="font-size:0.65rem; background:rgba(16, 185, 129, 0.1); color:#34d399; padding:1px 5px; border-radius:4px; margin-left:6px; font-weight:normal; border:1px solid rgba(16, 185, 129, 0.2)">CC</span>' : ''}
|
||||
</div>
|
||||
<div class="item-sub">${st.code}${st.platform ? ` - Platform ${st.platform}` : ''}</div>
|
||||
<div class="item-sub">${st.code}${st.platform ? ` - Platform ${st.platform}` : ''}${memberCount > 1 ? ` · Nodes ${memberCount}` : ''}</div>
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;gap:10px">
|
||||
<div class="status-dot ${dotClass}" id="station-dot-${st.name.replace(/[^a-zA-Z0-9]/g, '_')}" data-online="${isOnline}" data-name="${st.name}"></div>
|
||||
<button class="btn-icon" onclick="deleteStation('${st.name}')">${ICONS.trash}</button>
|
||||
<button class="btn-icon" onclick="deleteStation('${stationTarget}')">${ICONS.trash}</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -279,14 +279,16 @@
|
||||
}
|
||||
for (const st of stations) {
|
||||
const name = st.name || "";
|
||||
const target = st.target || name;
|
||||
const code = st.code || "";
|
||||
const memberCount = Number(st.memberCount || 1);
|
||||
const lastSeen = st.lastSeen ? new Date(st.lastSeen).toLocaleString() : "";
|
||||
const row = document.createElement("div");
|
||||
row.className = "station-item";
|
||||
row.innerHTML = `
|
||||
<input type="checkbox" data-station-name="1" data-name="${escapeHtml(name)}" onchange="updateSelectedBadge()" />
|
||||
<input type="checkbox" data-station-name="1" data-name="${escapeHtml(target)}" onchange="updateSelectedBadge()" />
|
||||
<div class="station-name">${escapeHtml(name)}</div>
|
||||
<div class="station-meta">${escapeHtml(code)}${lastSeen ? " · " + escapeHtml(lastSeen) : ""}</div>
|
||||
<div class="station-meta">${escapeHtml(code)}${memberCount > 1 ? " · 从机 " + memberCount : ""}${lastSeen ? " · " + escapeHtml(lastSeen) : ""}</div>
|
||||
`;
|
||||
box.appendChild(row);
|
||||
}
|
||||
|
||||
@@ -274,14 +274,16 @@
|
||||
}
|
||||
for (const st of stations) {
|
||||
const name = st.name || "";
|
||||
const target = st.target || name;
|
||||
const code = st.code || "";
|
||||
const memberCount = Number(st.memberCount || 1);
|
||||
const lastSeen = st.lastSeen ? new Date(st.lastSeen).toLocaleString() : "";
|
||||
const row = document.createElement("div");
|
||||
row.className = "station-item";
|
||||
row.innerHTML = `
|
||||
<input type="checkbox" data-station-name="1" data-name="${escapeHtml(name)}" onchange="updateSelectedBadge()" />
|
||||
<input type="checkbox" data-station-name="1" data-name="${escapeHtml(target)}" onchange="updateSelectedBadge()" />
|
||||
<div class="station-name">${escapeHtml(name)}</div>
|
||||
<div class="station-meta">${escapeHtml(code)}${lastSeen ? " · " + escapeHtml(lastSeen) : ""}</div>
|
||||
<div class="station-meta">${escapeHtml(code)}${memberCount > 1 ? " · 从机 " + memberCount : ""}${lastSeen ? " · " + escapeHtml(lastSeen) : ""}</div>
|
||||
`;
|
||||
box.appendChild(row);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user