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