Skip to content

Commit 5a38e51

Browse files
fix UI issue
1 parent fe61af0 commit 5a38e51

File tree

1 file changed

+48
-23
lines changed

1 file changed

+48
-23
lines changed

nebula/frontend/static/js/monitor/monitor.js

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -688,16 +688,15 @@ class Monitor {
688688
nodeRow = document.createElement('tr');
689689
nodeRow.id = `node-${data.uid}`;
690690

691-
// Create cells
691+
// Create cells matching the HTML template structure
692692
const cells = [
693-
{ class: 'text-center', content: '' }, // IDX
694-
{ class: 'text-center', content: '' }, // IP
695-
{ class: 'text-center', content: '' }, // Role
696-
{ class: 'text-center', content: '' }, // Round
697-
{ class: 'text-center', content: '' }, // Behavior
698-
{ class: 'text-center', content: '' }, // Status
699-
{ class: 'text-center', content: '' }, // Federation
700-
{ class: 'text-center', content: '' } // Timestamp
693+
{ class: 'py-3', content: '' }, // IDX
694+
{ class: 'py-3', content: '' }, // IP
695+
{ class: 'py-3', content: '' }, // Role
696+
{ class: 'py-3', content: '' }, // Round
697+
{ class: 'py-3', content: '' }, // Behaviour
698+
{ class: 'py-3', content: '' }, // Status
699+
{ class: 'py-3', content: '' } // Actions
701700
];
702701

703702
// Add cells to row
@@ -750,7 +749,7 @@ class Monitor {
750749
// Update IDX
751750
const idxCell = nodeRow.querySelector('td:nth-child(1)');
752751
if (idxCell) {
753-
idxCell.textContent = data.idx || '';
752+
idxCell.textContent = data.idx || '0';
754753
}
755754

756755
// Update IP
@@ -775,7 +774,7 @@ class Monitor {
775774
roundCell.textContent = data.round || '0';
776775
}
777776

778-
// Update Behavior
777+
// Update Behaviour
779778
const behaviorCell = nodeRow.querySelector('td:nth-child(5)');
780779
if (behaviorCell) {
781780
behaviorCell.innerHTML = data.malicious === "True"
@@ -788,20 +787,46 @@ class Monitor {
788787
if (statusCell) {
789788
statusCell.innerHTML = data.status
790789
? '<span class="badge bg-success"><i class="fa fa-circle me-1"></i>Online</span>'
791-
: '<span class="badge bg-danger"><i class="fa fa-circle me-1"></i>Offline</span>';
790+
: '<span class="badge bg-danger-subtle text-danger"><i class="fa fa-circle me-1"></i>Offline</span>';
792791
}
793792

794-
// Update Federation if present
795-
const federationCell = nodeRow.querySelector('td:nth-child(7)');
796-
if (federationCell && data.federation) {
797-
federationCell.textContent = data.federation;
798-
}
799-
800-
// Update Timestamp if present
801-
const timestampCell = nodeRow.querySelector('td:nth-child(8)');
802-
if (timestampCell && data.timestamp) {
803-
const date = new Date(data.timestamp);
804-
timestampCell.textContent = date.toLocaleString();
793+
// Update Actions
794+
const actionsCell = nodeRow.querySelector('td:nth-child(7)');
795+
if (actionsCell) {
796+
const metricsLink = data.hash ? `
797+
<li>
798+
<a class="dropdown-item" href="/platform/dashboard/${this.scenarioName}/node/${data.hash}/metrics">
799+
<i class="fa fa-chart-bar me-2"></i>Real-time metrics
800+
</a>
801+
</li>
802+
` : '';
803+
804+
actionsCell.innerHTML = `
805+
<div class="dropdown d-flex justify-content-center">
806+
<button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button"
807+
data-bs-toggle="dropdown" aria-expanded="false">
808+
<i class="fa fa-ellipsis-v"></i>
809+
</button>
810+
<ul class="dropdown-menu dropdown-menu-end">
811+
${metricsLink}
812+
<li>
813+
<a class="dropdown-item download" href="/platform/dashboard/${this.scenarioName}/node/${data.idx}/infolog">
814+
<i class="fa fa-file-alt me-2"></i>Download INFO logs
815+
</a>
816+
</li>
817+
<li>
818+
<a class="dropdown-item download" href="/platform/dashboard/${this.scenarioName}/node/${data.idx}/debuglog">
819+
<i class="fa fa-bug me-2"></i>Download DEBUG logs
820+
</a>
821+
</li>
822+
<li>
823+
<a class="dropdown-item download" href="/platform/dashboard/${this.scenarioName}/node/${data.idx}/errorlog">
824+
<i class="fa fa-exclamation-triangle me-2"></i>Download ERROR logs
825+
</a>
826+
</li>
827+
</ul>
828+
</div>
829+
`;
805830
}
806831

807832
console.log('Table updated for node:', data.uid);

0 commit comments

Comments
 (0)