Skip to content

Commit

Permalink
Open the SE from url and not select the first one (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
jggoebel authored May 22, 2024
1 parent 2c3c403 commit 64f17eb
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/app/dashboards/dashboards.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ export class DashboardsComponent implements OnInit, OnDestroy {
}, new Map());
this.scheduledeventService.setDashboardCache(map);
this.rbacService.Grants('users', 'list').then((rbacUsers) => {
rbacUsers && this.sortEventLists();
if (rbacUsers) {
// sort by creator if allowed
this.sortEventLists();
}
//Always navigate to first event
this.navigateToFirstScheduledEvent();
});
this.setActiveSessionsCount();
this.updateInterval = setInterval(() => {
this.setActiveSessionsCount();
}, 30 * 1000);
if (this.activeEvents.length > 0) {
this.router.navigateByUrl(
`/dashboards/event/${this.activeEvents[0].id}`
);
}
});
}

Expand All @@ -88,6 +88,17 @@ export class DashboardsComponent implements OnInit, OnDestroy {
this.sortByLoggedInAdminUser(this.activeEvents);
this.sortByLoggedInAdminUser(this.finishedEvents);
}

navigateToFirstScheduledEvent() {
if (this.activeEvents.length > 0) {
if (this.router.url === '/dashboards') {
this.router.navigateByUrl(
`/dashboards/event/${this.activeEvents[0].id}`
);
}
}
}

sortByLoggedInAdminUser(eventArray: DashboardScheduledEvent[]) {
const isCreatedByMe = (e: DashboardScheduledEvent) =>
Number(e.creatorEmail === this.loggedInAdminEmail);
Expand Down

0 comments on commit 64f17eb

Please sign in to comment.