Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#11665 draft of new vaadin-style side menu
- Loading branch information
1 parent
585008b
commit c5a05ca
Showing
16 changed files
with
17,628 additions
and
10,937 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -144,6 +144,7 @@ | |
}, | ||
"schematicCollections": [ | ||
"@angular-eslint/schematics" | ||
] | ||
], | ||
"analytics": false | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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
48 changes: 48 additions & 0 deletions
48
src/app/_common-components/side-menu/side-menu.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!-- TODO add logo --> | ||
|
||
<mat-nav-list #mainMenu class="main-menu"> | ||
<ng-container *ngFor="let route of routeConfig"> | ||
<a | ||
*ngIf="!useLegacyLink(route.legacyPath); else legacyLink" | ||
mat-list-item | ||
[routerLink]="[route.route]" | ||
[ngClass]="[ | ||
route.selectedLink, | ||
isSelectedLink(route.selectedLink) ? 'active' : '' | ||
]" | ||
> | ||
<mat-icon class="material-icons-round">{{ route.icon }}</mat-icon> | ||
<span>{{ route.label | translate }}</span> | ||
</a> | ||
<ng-template #legacyLink> | ||
<a | ||
mat-list-item | ||
href="{{getLegacyLink(route.legacyPath)}}" | ||
[ngClass]="[ | ||
route.selectedLink, | ||
isSelectedLink(route.selectedLink) ? 'active' : '' | ||
]" | ||
> | ||
<mat-icon class="material-icons-round">{{ route.icon }}</mat-icon> | ||
<span>{{ route.label | translate }}</span> | ||
</a> | ||
</ng-template> | ||
</ng-container> | ||
</mat-nav-list> | ||
|
||
<mat-nav-list #userMenu class="user-menu"> | ||
<a | ||
*ngFor="let route of userRouteConfig" | ||
mat-icon-button | ||
[routerLink]="[route.route]" | ||
[ngClass]="[ | ||
'button-user-menu', | ||
route.selectedLink, | ||
isSelectedLink(route.selectedLink) ? 'active' : '' | ||
]" | ||
> | ||
<mat-icon class="material-icons-round">{{ route.icon }}</mat-icon> | ||
</a> | ||
</mat-nav-list> | ||
|
||
<!-- TODO add logout --> |
Empty file.
23 changes: 23 additions & 0 deletions
23
src/app/_common-components/side-menu/side-menu.component.spec.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,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { SideMenuComponent } from './side-menu.component'; | ||
|
||
describe('SideMenuComponent', () => { | ||
let component: SideMenuComponent; | ||
let fixture: ComponentFixture<SideMenuComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ SideMenuComponent ] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(SideMenuComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
73 changes: 73 additions & 0 deletions
73
src/app/_common-components/side-menu/side-menu.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,73 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import {HelperService} from "../../_services/helper.service"; | ||
|
||
export interface RouteItem { | ||
route: string; | ||
legacyPath: string; | ||
label: string; | ||
selectedLink: string; | ||
icon?: string; | ||
} | ||
|
||
export const routesConfig: RouteItem[] = [ | ||
{ route: '', legacyPath: 'dashboard', label: 'captions.mainMenuDashboard', selectedLink: 'dashboard', icon: 'analytics' }, | ||
{ route: 'tasks/list', legacyPath: 'tasks', label: 'captions.mainMenuTasks', selectedLink: 'tasks', icon: 'checklist' }, | ||
{ route: 'messages/list',legacyPath: 'messages', label: 'captions.mainMenuExternalMessages', selectedLink: 'messages', icon: 'all-inbox' }, | ||
{ route: 'msers/list', legacyPath: 'msers', label: 'captions.mainMenuAggregateReports', selectedLink: 'msers' }, | ||
{ route: 'persons/list',legacyPath: 'persons', label: 'captions.mainMenuPersons', selectedLink: 'persons', icon: 'person' }, | ||
{ route: 'cases/list', legacyPath: 'cases', label: 'captions.mainMenuCases', selectedLink: 'cases', icon: 'recent-patient' }, | ||
{ route: 'contacts/list', legacyPath: 'contacts', label: 'captions.mainMenuContacts', selectedLink: 'contacts', icon: 'handshake' }, | ||
{ route: 'events/list', legacyPath: 'events', label: 'captions.mainMenuEvents', selectedLink: 'events', icon: 'phone' }, | ||
{ route: 'samples/list',legacyPath: 'samples', label: 'captions.mainMenuSamples', selectedLink: 'samples' }, | ||
{ route: 'entries/list',legacyPath: 'entries', label: 'captions.mainMenuEntries', selectedLink: 'entries' }, | ||
{ route: 'immunizations/list',legacyPath: 'immunizations', label: 'captions.mainMenuImmunizations', selectedLink: 'immunizations' }, | ||
{ route: 'shares/list', legacyPath: 'shares', label: 'captions.mainMenuShareRequests', selectedLink: 'shares', icon: 'share' }, | ||
{ route: 'stats', legacyPath: 'stats', label: 'captions.mainMenuStatistics', selectedLink: 'stats', icon: 'grouped-bar-chart' }, | ||
{ route: 'users/list', legacyPath: 'users', label: 'captions.mainMenuUsers', selectedLink: 'users' }, | ||
{ route: 'reports/list', legacyPath: 'reports', label: 'captions.mainMenuReports', selectedLink: 'reports' }, | ||
{ route: 'configuration', legacyPath: 'configuration', label: 'captions.mainMenuConfiguration', selectedLink: 'configuration', icon: 'settings' }, | ||
{ route: 'about', legacyPath: 'about', label: 'captions.mainMenuAbout', selectedLink: 'about', icon: 'info' }, | ||
]; | ||
|
||
export const userRoutesConfig: RouteItem[] = [ | ||
{ route: 'user-profile', legacyPath: '', label: 'mainMenuMyProfile', selectedLink: 'user-profile', icon: 'account_circle', }, | ||
{ route: 'logout', legacyPath: '', label: 'logout', selectedLink: 'logout', icon: 'logout', }, | ||
]; | ||
|
||
@Component({ | ||
selector: 'app-menu', | ||
templateUrl: './side-menu.component.html', | ||
styleUrls: ['./side-menu.component.scss'] | ||
}) | ||
export class SideMenuComponent implements OnInit { | ||
|
||
routeConfig: RouteItem[] = routesConfig; | ||
userRouteConfig: RouteItem[] = userRoutesConfig; | ||
selectedRoute = ''; | ||
legacyUrl: string; | ||
|
||
constructor(private helperService: HelperService) { | ||
this.legacyUrl = helperService.getLegacyUrl(); | ||
} | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
isAvailable(feature: string, userRight: string) : boolean { | ||
// todo match against features and user rights retrieved from rest-api when the component is started | ||
return true; | ||
} | ||
|
||
isSelectedLink(link: string): boolean { | ||
const currentRoute = this.selectedRoute === '/' ? '/dashboard' : this.selectedRoute; | ||
return currentRoute.startsWith(`/${link}`); | ||
} | ||
|
||
getLegacyLink(legacyPath: string) : string { | ||
return this.legacyUrl + legacyPath; | ||
} | ||
|
||
useLegacyLink(legacyPath: string) : boolean { | ||
return this.legacyUrl.length > 0 && legacyPath.length > 0; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div [dir]="direction" class="main-wrapper"> | ||
<app-menu></app-menu> | ||
<router-outlet></router-outlet> | ||
</div> | ||
<mat-sidenav-container [dir]="direction" class="main-wrapper" autosize="true"> | ||
<mat-sidenav mode="side" opened><app-menu></app-menu></mat-sidenav> | ||
<mat-sidenav-content><router-outlet></router-outlet></mat-sidenav-content> | ||
</mat-sidenav-container> |
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,4 +1,4 @@ | ||
.main-wrapper { | ||
height: 100%; | ||
padding-top: 68px; | ||
//padding-top: 68px; | ||
} |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"keycloakRealm": "SORMAS", | ||
"keycloakClientId": "sormas-angular", | ||
"keycloakUrl": "https://test-de2.sormas.netzlink.com/keycloak/auth/", | ||
"keycloakUrl": "http://localhost:7080/keycloak", | ||
"apiUrl": "http://localhost:4201/sormas-rest", | ||
"domainSubfolder": "/" | ||
"domainSubfolder": "/", | ||
"legacyUrl": "http://localhost:6080/sormas-ui/" | ||
} |
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,7 +1,8 @@ | ||
{ | ||
"keycloakRealm": "SORMAS", | ||
"keycloakClientId": "sormas-angular", | ||
"keycloakUrl": "https://test-de2.sormas.netzlink.com/keycloak/auth/", | ||
"keycloakUrl": "https://localhost:7080/keycloak/", | ||
"apiUrl": "http://localhost:4201/sormas-rest", | ||
"domainSubfolder": "/sormas-ui/" | ||
"domainSubfolder": "/sormas-angular/", | ||
"legacyUrl": "http://localhost:6080/sormas-ui/" | ||
} |