update
This commit is contained in:
@@ -517,6 +517,6 @@ export class MetricsManager {
|
||||
topIPs,
|
||||
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,
|
||||
dns: 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
|
||||
if (combinedResponse.metrics.network && (currentView === 'network' || currentView === 'Network')) {
|
||||
if (combinedResponse.metrics.network && currentView === 'network') {
|
||||
const network = combinedResponse.metrics.network;
|
||||
const connectionsByIP: { [ip: string]: number } = {};
|
||||
|
||||
@@ -505,6 +505,13 @@ let currentRefreshRate = 1000; // Track current refresh rate to avoid unnecessar
|
||||
refreshInterval = setInterval(() => {
|
||||
// Use combined refresh action for efficiency
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
|
@@ -87,6 +87,9 @@ export class OpsDashboard extends DeesElement {
|
||||
{
|
||||
name: 'Network',
|
||||
element: OpsViewNetwork,
|
||||
action: () => {
|
||||
appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, 'network');
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Emails',
|
||||
|
@@ -66,6 +66,9 @@ export class OpsViewNetwork extends DeesElement {
|
||||
async 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
|
||||
await appstate.networkStatePart.dispatchAction(appstate.fetchNetworkStatsAction, null);
|
||||
}
|
||||
@@ -73,6 +76,12 @@ export class OpsViewNetwork extends DeesElement {
|
||||
async disconnectedCallback() {
|
||||
await super.disconnectedCallback();
|
||||
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() {
|
||||
@@ -183,13 +192,6 @@ export class OpsViewNetwork extends DeesElement {
|
||||
];
|
||||
|
||||
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`
|
||||
<ops-sectionheading>Network Activity</ops-sectionheading>
|
||||
|
||||
@@ -527,7 +529,6 @@ export class OpsViewNetwork extends DeesElement {
|
||||
private updateTrafficData() {
|
||||
// This method is called when network data updates
|
||||
// The actual chart updates are handled by the timer calling addTrafficDataPoint()
|
||||
console.log('UpdateTrafficData called - network data updated');
|
||||
}
|
||||
|
||||
private startTrafficUpdateTimer() {
|
||||
|
Reference in New Issue
Block a user