-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: hide activity part if no activities are registered
closes #107
- Loading branch information
1 parent
1e0a78c
commit 3c01b6f
Showing
18 changed files
with
633 additions
and
57 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
projects/app/workbench/workbench-app/src/app/activity-1/activity-1.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-activity-1', | ||
template: 'Activity 1 is showing', | ||
}) | ||
export class Activity1Component { | ||
} |
8 changes: 8 additions & 0 deletions
8
projects/app/workbench/workbench-app/src/app/activity-2/activity-2.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-activity-2', | ||
template: 'Activity 2 is showing', | ||
}) | ||
export class Activity2Component { | ||
} |
7 changes: 6 additions & 1 deletion
7
projects/app/workbench/workbench-app/src/app/app-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
projects/app/workbench/workbench-app/src/app/app.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
<wb-workbench></wb-workbench> | ||
<wb-workbench> | ||
<wb-activity title="Activity 1" | ||
itemText="filter_1" | ||
itemCssClass="material-icons" | ||
[visible]="showActivities" | ||
routerLink="activity-1"> | ||
</wb-activity> | ||
<wb-activity *ngIf="showActivities" | ||
title="Activity 2" | ||
itemText="filter_2" | ||
itemCssClass="material-icons" | ||
routerLink="activity-2"> | ||
</wb-activity> | ||
</wb-workbench> |
24 changes: 22 additions & 2 deletions
24
projects/app/workbench/workbench-app/src/app/app.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, OnDestroy } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { Subject } from 'rxjs'; | ||
import { takeUntil } from 'rxjs/operators'; | ||
import { coerceBooleanProperty } from '@angular/cdk/coercion'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'] | ||
}) | ||
export class AppComponent { | ||
export class AppComponent implements OnDestroy { | ||
|
||
private _destroy$ = new Subject<void>(); | ||
|
||
public showActivities = true; | ||
|
||
constructor(route: ActivatedRoute) { | ||
route.queryParamMap | ||
.pipe(takeUntil(this._destroy$)) | ||
.subscribe(queryParams => { | ||
this.showActivities = coerceBooleanProperty(queryParams.get('show-activities') || true); | ||
}); | ||
} | ||
|
||
public ngOnDestroy(): void { | ||
this._destroy$.next(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) 2018 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import { HostAppPO } from './page-object/host-app.po'; | ||
import { browser } from 'protractor'; | ||
|
||
describe('Activity', () => { | ||
|
||
const hostAppPO = new HostAppPO(); | ||
|
||
beforeEach(async () => { | ||
await browser.get('/'); | ||
}); | ||
|
||
describe('Activity bar', () => { | ||
|
||
it('should not show if no activities are registered', async () => { | ||
await browser.get('/'); | ||
await expect(hostAppPO.isActivityBarShowing()).toBeTruthy(); | ||
|
||
await browser.get('/#/?show-activities=true'); | ||
await expect(hostAppPO.isActivityBarShowing()).toBeTruthy(); | ||
|
||
await browser.get('/#/?show-activities=false'); | ||
await expect(hostAppPO.isActivityBarShowing()).toBeFalsy(); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.