update
This commit is contained in:
@@ -517,6 +517,6 @@ export class MetricsManager {
|
|||||||
topIPs,
|
topIPs,
|
||||||
totalDataTransferred,
|
totalDataTransferred,
|
||||||
};
|
};
|
||||||
}, 1000); // Use 200ms cache for more frequent updates
|
}, 200); // Use 200ms cache for more frequent updates
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -415,7 +415,7 @@ async function dispatchCombinedRefreshAction() {
|
|||||||
email: true,
|
email: true,
|
||||||
dns: true,
|
dns: true,
|
||||||
security: true,
|
security: true,
|
||||||
network: currentView === 'network' || currentView === 'Network', // Only fetch network if on network view
|
network: currentView === 'network', // Only fetch network if on network view
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -432,7 +432,7 @@ async function dispatchCombinedRefreshAction() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Update network stats if included
|
// Update network stats if included
|
||||||
if (combinedResponse.metrics.network && (currentView === 'network' || currentView === 'Network')) {
|
if (combinedResponse.metrics.network && currentView === 'network') {
|
||||||
const network = combinedResponse.metrics.network;
|
const network = combinedResponse.metrics.network;
|
||||||
const connectionsByIP: { [ip: string]: number } = {};
|
const connectionsByIP: { [ip: string]: number } = {};
|
||||||
|
|
||||||
@@ -505,6 +505,13 @@ let currentRefreshRate = 1000; // Track current refresh rate to avoid unnecessar
|
|||||||
refreshInterval = setInterval(() => {
|
refreshInterval = setInterval(() => {
|
||||||
// Use combined refresh action for efficiency
|
// Use combined refresh action for efficiency
|
||||||
dispatchCombinedRefreshAction();
|
dispatchCombinedRefreshAction();
|
||||||
|
|
||||||
|
// If network view is active, also ensure we have fresh network data
|
||||||
|
const currentView = uiStatePart.getState().activeView;
|
||||||
|
if (currentView === 'network') {
|
||||||
|
// Network view needs more frequent updates, fetch directly
|
||||||
|
networkStatePart.dispatchAction(fetchNetworkStatsAction, null);
|
||||||
|
}
|
||||||
}, uiState.refreshInterval);
|
}, uiState.refreshInterval);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -87,6 +87,9 @@ export class OpsDashboard extends DeesElement {
|
|||||||
{
|
{
|
||||||
name: 'Network',
|
name: 'Network',
|
||||||
element: OpsViewNetwork,
|
element: OpsViewNetwork,
|
||||||
|
action: () => {
|
||||||
|
appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, 'network');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Emails',
|
name: 'Emails',
|
||||||
|
@@ -66,6 +66,9 @@ export class OpsViewNetwork extends DeesElement {
|
|||||||
async connectedCallback() {
|
async connectedCallback() {
|
||||||
await super.connectedCallback();
|
await super.connectedCallback();
|
||||||
|
|
||||||
|
// Force the activeView to be 'network' when this component connects
|
||||||
|
await appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, 'network');
|
||||||
|
|
||||||
// When network view becomes visible, ensure we fetch network data
|
// When network view becomes visible, ensure we fetch network data
|
||||||
await appstate.networkStatePart.dispatchAction(appstate.fetchNetworkStatsAction, null);
|
await appstate.networkStatePart.dispatchAction(appstate.fetchNetworkStatsAction, null);
|
||||||
}
|
}
|
||||||
@@ -73,6 +76,12 @@ export class OpsViewNetwork extends DeesElement {
|
|||||||
async disconnectedCallback() {
|
async disconnectedCallback() {
|
||||||
await super.disconnectedCallback();
|
await super.disconnectedCallback();
|
||||||
this.stopTrafficUpdateTimer();
|
this.stopTrafficUpdateTimer();
|
||||||
|
|
||||||
|
// When network view disconnects, reset activeView if it's still 'network'
|
||||||
|
const currentView = appstate.uiStatePart.getState().activeView;
|
||||||
|
if (currentView === 'network') {
|
||||||
|
await appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, 'overview');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private subscribeToStateParts() {
|
private subscribeToStateParts() {
|
||||||
@@ -183,13 +192,6 @@ export class OpsViewNetwork extends DeesElement {
|
|||||||
];
|
];
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
console.log('Network view render - chart data points:', {
|
|
||||||
inPoints: this.trafficDataIn.length,
|
|
||||||
outPoints: this.trafficDataOut.length,
|
|
||||||
lastInValue: this.trafficDataIn[this.trafficDataIn.length - 1]?.y,
|
|
||||||
lastOutValue: this.trafficDataOut[this.trafficDataOut.length - 1]?.y
|
|
||||||
});
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ops-sectionheading>Network Activity</ops-sectionheading>
|
<ops-sectionheading>Network Activity</ops-sectionheading>
|
||||||
|
|
||||||
@@ -527,7 +529,6 @@ export class OpsViewNetwork extends DeesElement {
|
|||||||
private updateTrafficData() {
|
private updateTrafficData() {
|
||||||
// This method is called when network data updates
|
// This method is called when network data updates
|
||||||
// The actual chart updates are handled by the timer calling addTrafficDataPoint()
|
// The actual chart updates are handled by the timer calling addTrafficDataPoint()
|
||||||
console.log('UpdateTrafficData called - network data updated');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private startTrafficUpdateTimer() {
|
private startTrafficUpdateTimer() {
|
||||||
|
Reference in New Issue
Block a user