update
This commit is contained in:
@@ -321,6 +321,7 @@ export const toggleAutoRefreshAction = uiStatePart.createAction(async (statePart
|
|||||||
// Set Active View Action
|
// Set Active View Action
|
||||||
export const setActiveViewAction = uiStatePart.createAction<string>(async (statePartArg, viewName) => {
|
export const setActiveViewAction = uiStatePart.createAction<string>(async (statePartArg, viewName) => {
|
||||||
const currentState = statePartArg.getState();
|
const currentState = statePartArg.getState();
|
||||||
|
console.log('[SetActiveView]', currentState.activeView, '->', viewName);
|
||||||
|
|
||||||
// If switching to network view, ensure we fetch network data
|
// If switching to network view, ensure we fetch network data
|
||||||
if (viewName === 'network' && currentState.activeView !== 'network') {
|
if (viewName === 'network' && currentState.activeView !== 'network') {
|
||||||
@@ -401,6 +402,7 @@ export const fetchNetworkStatsAction = networkStatePart.createAction(async (stat
|
|||||||
async function dispatchCombinedRefreshAction() {
|
async function dispatchCombinedRefreshAction() {
|
||||||
const context = getActionContext();
|
const context = getActionContext();
|
||||||
const currentView = uiStatePart.getState().activeView;
|
const currentView = uiStatePart.getState().activeView;
|
||||||
|
console.log('[CombinedRefresh] activeView:', currentView, 'will fetch network:', currentView === 'network');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Always fetch basic stats for dashboard widgets
|
// Always fetch basic stats for dashboard widgets
|
||||||
|
@@ -65,6 +65,7 @@ export class OpsViewNetwork extends DeesElement {
|
|||||||
|
|
||||||
async connectedCallback() {
|
async connectedCallback() {
|
||||||
await super.connectedCallback();
|
await super.connectedCallback();
|
||||||
|
console.log('[NetworkView] Connected - setting activeView to network');
|
||||||
|
|
||||||
// Force the activeView to be 'network' when this component connects
|
// Force the activeView to be 'network' when this component connects
|
||||||
await appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, 'network');
|
await appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, 'network');
|
||||||
@@ -76,12 +77,6 @@ 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() {
|
||||||
|
Reference in New Issue
Block a user