-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Timon Masberg <[email protected]>
- Loading branch information
1 parent
4df0a74
commit 912e399
Showing
22 changed files
with
377 additions
and
30 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
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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
import { Routes } from '@angular/router'; | ||
|
||
import { authGuard } from '@kordis/spa/auth'; | ||
|
||
import { ProtectedComponent } from './component/protected.component'; | ||
import { DashboardComponent } from '@kordis/spa/dashboard'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
redirectTo: 'protected', | ||
redirectTo: 'dashbaord', | ||
pathMatch: 'full', | ||
}, | ||
{ | ||
path: 'protected', | ||
component: ProtectedComponent, | ||
path: 'dashboard', | ||
component: DashboardComponent, | ||
canActivate: [authGuard], | ||
}, | ||
{ path: '**', redirectTo: 'protected' }, | ||
{ path: '**', redirectTo: 'dashboard' }, | ||
]; | ||
|
||
export default routes; |
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,36 @@ | ||
{ | ||
"extends": ["../../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts"], | ||
"extends": [ | ||
"plugin:@nx/angular", | ||
"plugin:@angular-eslint/template/process-inline-templates" | ||
], | ||
"rules": { | ||
"@angular-eslint/directive-selector": [ | ||
"error", | ||
{ | ||
"type": "attribute", | ||
"prefix": "krd", | ||
"style": "camelCase" | ||
} | ||
], | ||
"@angular-eslint/component-selector": [ | ||
"error", | ||
{ | ||
"type": "element", | ||
"prefix": "krd", | ||
"style": "kebab-case" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.html"], | ||
"extends": ["plugin:@nx/angular-template"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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 @@ | ||
# Dashboard | ||
|
||
This library provides the dashboard view which integrates the protocol, | ||
operations and deployments view as well as a menu and some user functionality. | ||
|
||
## Running unit tests | ||
|
||
Run `nx test spa-dashboard` to execute the unit tests. |
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,22 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'spa-dashboard', | ||
preset: '../../../jest.preset.js', | ||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], | ||
coverageDirectory: '../../../coverage/libs/spa/dashboard', | ||
transform: { | ||
'^.+\\.(ts|mjs|js|html)$': [ | ||
'jest-preset-angular', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
stringifyContentPathRegex: '\\.(html|svg)$', | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], | ||
snapshotSerializers: [ | ||
'jest-preset-angular/build/serializers/no-ng-attributes', | ||
'jest-preset-angular/build/serializers/ng-snapshot', | ||
'jest-preset-angular/build/serializers/html-comment', | ||
], | ||
}; |
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,21 @@ | ||
{ | ||
"name": "spa-dashboard", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/spa/dashboard/src", | ||
"prefix": "krd", | ||
"tags": [], | ||
"projectType": "library", | ||
"targets": { | ||
"test": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"], | ||
"options": { | ||
"jestConfig": "libs/spa/dashboard/jest.config.ts" | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/eslint:lint", | ||
"outputs": ["{options.outputFile}"] | ||
} | ||
} | ||
} |
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 @@ | ||
export * from './lib/dashboard/dashboard.component'; |
57 changes: 57 additions & 0 deletions
57
libs/spa/dashboard/src/lib/dashboard/dashboard.component.css
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,57 @@ | ||
@import 'ng-zorro-antd/ng-zorro-antd.variable.min.css'; | ||
|
||
nz-layout { | ||
--header-size: 64px; | ||
|
||
[nz-menu] { | ||
line-height: var(--header-size); | ||
} | ||
|
||
nz-header { | ||
background: none; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
|
||
.logo { | ||
color: var(--ant-primary-color); | ||
font-size: 24px; | ||
} | ||
} | ||
|
||
nz-content { | ||
display: grid; | ||
grid-gap: 8px; | ||
grid-template-areas: | ||
'protocol operations' | ||
'deployments deployments'; | ||
grid-template-columns: 3fr 2fr; | ||
grid-template-rows: 3fr 2fr; | ||
min-height: 720px; | ||
min-width: 1280px; | ||
padding: 8px; | ||
width: 100%; | ||
height: calc(100vh - var(--header-size)); | ||
|
||
.placeholder { | ||
/* TODO: Remove this section when filled */ | ||
height: 100%; | ||
width: 100%; | ||
background-color: snow; | ||
padding: 16px; | ||
border-radius: 2px; | ||
} | ||
|
||
.protocol { | ||
grid-area: protocol; | ||
} | ||
|
||
.operations { | ||
grid-area: operations; | ||
} | ||
|
||
.deployments { | ||
grid-area: deployments; | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
libs/spa/dashboard/src/lib/dashboard/dashboard.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,37 @@ | ||
<nz-layout> | ||
<nz-header> | ||
<div class="logo">Kordis</div> | ||
<div> | ||
<nz-avatar | ||
nzText="{{ (user$ | async)?.firstName?.slice(0, 1) }}{{ | ||
(user$ | async)?.lastName?.slice(0, 1) | ||
}}" | ||
[nzDropdownMenu]="userMenu" | ||
nz-dropdown | ||
></nz-avatar> | ||
<nz-dropdown-menu #userMenu="nzDropdownMenu"> | ||
<ul nz-menu> | ||
<li nz-menu-item nzDisabled> | ||
{{ (user$ | async)?.firstName }} {{ (user$ | async)?.lastName }} | ||
</li> | ||
<li (click)="logout()" nz-menu-item>Abmelden</li> | ||
<li nz-menu-divider></li> | ||
<li (click)="showCreditsAndLicensesModal()" nz-menu-item> | ||
Credits und Lizenzen | ||
</li> | ||
</ul> | ||
</nz-dropdown-menu> | ||
</div> | ||
</nz-header> | ||
<nz-content> | ||
<div class="protocol"> | ||
<div class="placeholder">Protocol</div> | ||
</div> | ||
<div class="operations"> | ||
<div class="placeholder">Operations</div> | ||
</div> | ||
<div class="deployments"> | ||
<div class="placeholder">Deployments</div> | ||
</div> | ||
</nz-content> | ||
</nz-layout> |
49 changes: 49 additions & 0 deletions
49
libs/spa/dashboard/src/lib/dashboard/dashboard.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,49 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { createMock } from '@golevelup/ts-jest'; | ||
import { NzModalModule, NzModalService } from 'ng-zorro-antd/modal'; | ||
import { of } from 'rxjs'; | ||
|
||
import { AUTH_SERVICE, AuthService } from '@kordis/spa/auth'; | ||
|
||
import { DashboardComponent } from './dashboard.component'; | ||
|
||
describe('DashboardComponent', () => { | ||
let component: DashboardComponent; | ||
let fixture: ComponentFixture<DashboardComponent>; | ||
const authServiceMock = createMock<AuthService>({ | ||
user$: of(null), | ||
}); | ||
const modalServiceMock = createMock<NzModalService>(); | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [BrowserAnimationsModule], | ||
providers: [{ provide: AUTH_SERVICE, useValue: authServiceMock }], | ||
}).compileComponents(); | ||
|
||
TestBed.overrideModule(NzModalModule, { | ||
set: { | ||
providers: [{ provide: NzModalService, useValue: modalServiceMock }], | ||
}, | ||
}); | ||
|
||
fixture = TestBed.createComponent(DashboardComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should call authService.logout() when logout is called', () => { | ||
component.logout(); | ||
expect(authServiceMock.logout).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should call modalService.create() when showCreditsAndLicensesModal is called', () => { | ||
component.showCreditsAndLicensesModal(); | ||
expect(modalServiceMock.create).toHaveBeenCalled(); | ||
}); | ||
}); |
Oops, something went wrong.