Skip to content

Commit 165d4f4

Browse files
nevio18324RandomTannenbaumactions-user
authored
Bug/1013 routing to overview (#1084)
* Add permanent teamverwaltung button and make logo route to / * Make router links leading to homepage preserve query params * Change tag around logo from span to a * Add e2e tests that test if route is preserved --------- Co-authored-by: Jannik Pulfer <[email protected]> Co-authored-by: GitHub Actions <[email protected]>
1 parent 56caefd commit 165d4f4

File tree

5 files changed

+49
-22
lines changed

5 files changed

+49
-22
lines changed

frontend/cypress/e2e/tab.cy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ describe('Tab workflow tests', () => {
124124
cy.loginAsUser(users.gl);
125125
onlyOn('chrome');
126126
cy.tabForward();
127+
cy.tabForward();
127128
});
128129

129130
// Header from here

frontend/cypress/e2e/teammanagement.cy.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@ describe('Team management tests', () => {
55
const teamName = uniqueSuffix('New Team');
66
const nameEsha = users.bl.name;
77

8+
describe('Routing to overview', () => {
9+
beforeEach(() => {
10+
cy.loginAsUser(users.gl);
11+
});
12+
it('should navigate to overview when clicking logo', () => {
13+
cy.getByTestId('team-management').click();
14+
cy.getByTestId('logo').click();
15+
cy.url().should('not.include', 'team-management');
16+
});
17+
it('should navigate to overview when pressing back to overview', () => {
18+
cy.getByTestId('team-management').click();
19+
cy.getByTestId('routerLink-to-overview').click();
20+
cy.url().should('not.include', 'team-management');
21+
});
22+
it('should preserve team filter', () => {
23+
cy.get('mat-chip:visible:contains("/BBT")').click();
24+
cy.get('mat-chip:visible:contains("Puzzle ITC")').click();
25+
checkTeamsSelected();
26+
cy.getByTestId('team-management').click();
27+
checkTeamsSelected();
28+
cy.getByTestId('routerLink-to-overview').click();
29+
checkTeamsSelected();
30+
cy.getByTestId('team-management').click();
31+
cy.getByTestId('logo').click();
32+
checkTeamsSelected();
33+
});
34+
35+
function checkTeamsSelected() {
36+
cy.url().should('include', 'teams=');
37+
cy.url().should('include', '6');
38+
cy.url().should('include', '4');
39+
}
40+
});
41+
842
describe('As GL', () => {
943
before(() => {
1044
// login as bl to ensure this user exists in database

frontend/src/app/components/application-top-bar/application-top-bar.component.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
<div id="topBarHeight">
22
<div id="okrTopbar">
3-
<span class="d-flex h-100 align-items-center ps-4">
4-
<img alt="okr-logo" height="32" ngSrc="{{ this.logoSrc$ | async }}" width="140" priority />
5-
</span>
3+
<a routerLink="/" queryParamsHandling="preserve" class="d-flex h-100 align-items-center ps-4">
4+
<img
5+
[attr.data-testId]="'logo'"
6+
alt="okr-logo"
7+
height="32"
8+
ngSrc="{{ this.logoSrc$ | async }}"
9+
width="140"
10+
priority
11+
/>
12+
</a>
613
<div class="d-flex align-items-center me-md-5 me-1">
714
<button
8-
*ngIf="teamManagementVisible$ | async"
915
routerLink="team-management"
1016
[attr.data-testId]="'team-management'"
1117
class="topBarEntry btn visible-by-default"
18+
queryParamsHandling="preserve"
1219
>
1320
<mat-icon aria-hidden="false" aria-label="Group icon" fontIcon="group"></mat-icon>
1421
<span class="d-none d-md-flex">Teamverwaltung </span>
1522
</button>
1623

17-
<button *ngIf="!(teamManagementVisible$ | async)" routerLink="/" class="topBarEntry btn visible-by-default">
18-
<mat-icon aria-hidden="false" aria-label="Group icon" fontIcon="group"></mat-icon>
19-
<span class="d-none d-md-flex">OKR Übersicht </span>
20-
</button>
21-
2224
<button
2325
id="hilfeButton"
2426
class="topBarEntry btn"

frontend/src/app/components/application-top-bar/application-top-bar.component.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { getFullNameFromUser } from '../../shared/types/model/User';
1515
export class ApplicationTopBarComponent implements OnInit, OnDestroy {
1616
userFullName: string = '';
1717
menuIsOpen = false;
18-
teamManagementVisible$: Observable<boolean> | undefined;
1918
logoSrc$ = new BehaviorSubject<String>('assets/images/empty.svg');
2019
private subscription?: Subscription;
2120

@@ -35,9 +34,7 @@ export class ApplicationTopBarComponent implements OnInit, OnDestroy {
3534
}
3635
},
3736
});
38-
3937
this.initUserFullName();
40-
this.initTeamManagementVisible();
4138
}
4239

4340
ngOnDestroy(): void {
@@ -60,13 +57,4 @@ export class ApplicationTopBarComponent implements OnInit, OnDestroy {
6057
}
6158
});
6259
}
63-
64-
private initTeamManagementVisible() {
65-
this.teamManagementVisible$ = this.router.events.pipe(
66-
filter((e): e is NavigationEnd => e instanceof NavigationEnd),
67-
switchMap(() => {
68-
return of(this.router.url.split('?')[0] === '/');
69-
}),
70-
);
71-
}
7260
}

frontend/src/app/team-management/team-management-banner/team-management-banner.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<div id="okrBanner" class="container-fluid">
22
<div class="row first-line">
33
<div class="col-12">
4-
<a routerLink="/">Zurück zur OKR Übersicht</a>
4+
<a [attr.data-testId]="'routerLink-to-overview'" routerLink="/" queryParamsHandling="preserve"
5+
>Zurück zur OKR Übersicht</a
6+
>
57
</div>
68
</div>
79
<div class="row second-line">

0 commit comments

Comments
 (0)