refator_comm1
This commit is contained in:
@@ -55,6 +55,11 @@ function rebuildTargetSelect(selectEl, currentNode, nodes) {
|
||||
if (idx >= 0) selectEl.selectedIndex = idx;
|
||||
}
|
||||
|
||||
function setMigrateDisabled(tr, disabled) {
|
||||
const btn = tr.querySelector('.act-migrate');
|
||||
if (btn) btn.disabled = !!disabled;
|
||||
}
|
||||
|
||||
export async function renderVMAdmin() {
|
||||
injectOnceCSS();
|
||||
stopAllAdminWatches();
|
||||
@@ -78,12 +83,9 @@ export async function renderVMAdmin() {
|
||||
const sel = `<select class="form-select form-select-sm target-node" style="min-width:160px">
|
||||
${availableNodes.map(n => `<option value="${n}" ${n === x.node ? 'disabled selected' : ''}>${n}</option>`).join('')}
|
||||
</select>`;
|
||||
const tools = `<div class="d-flex align-items-center gap-2">
|
||||
<button class="btn btn-outline-primary btn-sm act-migrate">Migrate (offline)</button>
|
||||
<button class="btn btn-outline-secondary btn-sm act-status">Details</button>
|
||||
</div>`;
|
||||
// Kolumny: SID | TYPE | NAME | NODE | ACTIONS | TARGET | TOOLS
|
||||
return rowHTML([sid, type.toUpperCase(), nameCell, node, actions, sel, tools], `data-sid="${sid}"`);
|
||||
const migrateBtn = `<button class="btn btn-outline-primary btn-sm act-migrate">Migrate (offline)</button>`;
|
||||
// Kolumny: SID | TYPE | NAME | NODE | ACTIONS | TARGET | MIGRATE
|
||||
return rowHTML([sid, type.toUpperCase(), nameCell, node, actions, sel, migrateBtn], `data-sid="${sid}"`);
|
||||
});
|
||||
|
||||
setRows(tbody, rows);
|
||||
@@ -155,10 +157,6 @@ export async function renderVMAdmin() {
|
||||
tr.querySelector('.act-shutdown')?.addEventListener('click',() => doAction('shutdown'));
|
||||
tr.querySelector('.act-migrate')?.addEventListener('click', () => doAction('migrate', true));
|
||||
|
||||
tr.querySelector('.act-status')?.addEventListener('click', async () => {
|
||||
flashDot(nameCell);
|
||||
});
|
||||
|
||||
ensureWatchOn();
|
||||
});
|
||||
|
||||
|
@@ -215,7 +215,6 @@
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th>Node</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
<th>Target</th>
|
||||
<th>Migrate</th>
|
||||
@@ -223,15 +222,16 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="8" class="text-muted">Loading…</td>
|
||||
<td colspan="7" class="text-muted">Loading…</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="small text-muted">Akcje: Unlock (qm), Start/Stop/Shutdown, Offline migrate.</div>
|
||||
<div class="small text-muted">Actions: Unlock (qm), Start/Stop/Shutdown, Offline migrate.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- TAB: Nodes (expandable) -->
|
||||
<div class="tab-pane fade" id="tab-nodes">
|
||||
<div class="card border-0">
|
||||
|
Reference in New Issue
Block a user