This commit is contained in:
Juergen Kunz
2025-07-04 18:50:15 +00:00
parent 5d4bf4eff8
commit aed9151998
3 changed files with 9 additions and 25 deletions

View File

@@ -321,7 +321,6 @@ export const toggleAutoRefreshAction = uiStatePart.createAction(async (statePart
// Set Active View Action
export const setActiveViewAction = uiStatePart.createAction<string>(async (statePartArg, viewName) => {
const currentState = statePartArg.getState();
console.log('[SetActiveView]', currentState.activeView, '->', viewName);
// If switching to network view, ensure we fetch network data
if (viewName === 'network' && currentState.activeView !== 'network') {
@@ -402,7 +401,6 @@ export const fetchNetworkStatsAction = networkStatePart.createAction(async (stat
async function dispatchCombinedRefreshAction() {
const context = getActionContext();
const currentView = uiStatePart.getState().activeView;
console.log('[CombinedRefresh] activeView:', currentView, 'will fetch network:', currentView === 'network');
try {
// Always fetch basic stats for dashboard widgets

View File

@@ -27,10 +27,10 @@ export class OpsDashboard extends DeesElement {
};
@state() private uiState: appstate.IUiState = {
activeView: 'dashboard',
activeView: 'overview',
sidebarCollapsed: false,
autoRefresh: true,
refreshInterval: 30000,
refreshInterval: 1000,
theme: 'light',
};
@@ -87,9 +87,6 @@ export class OpsDashboard extends DeesElement {
{
name: 'Network',
element: OpsViewNetwork,
action: () => {
appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, 'network');
},
},
{
name: 'Emails',
@@ -108,14 +105,6 @@ export class OpsDashboard extends DeesElement {
element: OpsViewSecurity,
},
]}
.userMenuItems=${[
{
name: 'Logout',
action: async () => {
await appstate.loginStatePart.dispatchAction(appstate.logoutAction, null);
},
},
]}
>
</dees-simple-appdash>
</dees-simple-login>
@@ -133,10 +122,15 @@ export class OpsDashboard extends DeesElement {
// Handle view changes
const appDash = this.shadowRoot.querySelector('dees-simple-appdash');
if (appDash) {
appDash.addEventListener('viewSwitch', (e: CustomEvent) => {
const viewName = e.detail.tabName;
appDash.addEventListener('view-select', (e: CustomEvent) => {
const viewName = e.detail.view.name;
appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, viewName.toLowerCase());
});
// Handle logout event
appDash.addEventListener('logout', async () => {
await appstate.loginStatePart.dispatchAction(appstate.logoutAction, null);
});
}
// Handle initial state
@@ -175,8 +169,4 @@ export class OpsDashboard extends DeesElement {
form.reset();
}
}
private async logout() {
await appstate.loginStatePart.dispatchAction(appstate.logoutAction, null);
}
}

View File

@@ -65,10 +65,6 @@ export class OpsViewNetwork extends DeesElement {
async connectedCallback() {
await super.connectedCallback();
console.log('[NetworkView] Connected - setting activeView to network');
// 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);