From 7c83c87f32f28fe8e3cac1515f8bf3500980d76f Mon Sep 17 00:00:00 2001
From: Franzi321 <71708325+Franzi321@users.noreply.github.com>
Date: Wed, 14 Oct 2020 16:39:22 +0200
Subject: [PATCH] TSK-1395: Update Navbar to work without bootstrap 3 (#1288)
* TSK-1395: update navbar
* TSK-1395: fixed CI error
* TSK-1395: arrange components correctly
* TSK-1395: fit navbar to the other components
* TSK-1395: optimize code and add tests
* TSK-1395: delete comment
* TSK-1395: add missing logout function
* TSK-1395: modify components
---
web/.vscode/settings.json | 3 +-
web/cypress/cypress/plugins/index.js | 2 +-
web/cypress/cypress/support/index.js | 2 +-
web/cypress/fixtures/example.json | 2 +-
web/cypress/support/index.js | 2 +-
.../access-items-management.component.scss | 1 -
.../classification-details.component.scss | 3 -
.../classification-overview.component.scss | 2 +-
.../import-export.component.scss | 2 +-
.../components/tree/tree.component.scss | 1 -
.../workbasket-overview.component.scss | 1 -
web/src/app/app.component.html | 33 +++-
web/src/app/app.component.scss | 57 ++++++
web/src/app/app.component.ts | 34 +++-
web/src/app/app.module.ts | 21 ++-
.../master-and-detail.component.scss | 1 -
.../components/nav-bar/nav-bar.component.html | 85 +--------
.../components/nav-bar/nav-bar.component.scss | 171 +++++-------------
.../nav-bar/nav-bar.component.spec.ts | 67 +++++++
.../components/nav-bar/nav-bar.component.ts | 90 +--------
.../sidenav-list/sidenav-list.component.html | 16 ++
.../sidenav-list/sidenav-list.component.scss | 35 ++++
.../sidenav-list.component.spec.ts | 101 +++++++++++
.../sidenav-list/sidenav-list.component.ts | 45 +++++
.../user-information.component.html | 26 ++-
.../user-information.component.scss | 27 ++-
.../user-information.component.spec.ts | 53 ++++++
.../services/sidenav/sidenav.service.spec.ts | 15 ++
.../services/sidenav/sidenav.service.ts | 19 ++
web/src/index.html | 5 +-
web/src/tsconfig.app.json | 9 +-
web/tsconfig.spec.json | 15 +-
32 files changed, 594 insertions(+), 352 deletions(-)
create mode 100644 web/src/app/shared/components/nav-bar/nav-bar.component.spec.ts
create mode 100644 web/src/app/shared/components/sidenav-list/sidenav-list.component.html
create mode 100644 web/src/app/shared/components/sidenav-list/sidenav-list.component.scss
create mode 100644 web/src/app/shared/components/sidenav-list/sidenav-list.component.spec.ts
create mode 100644 web/src/app/shared/components/sidenav-list/sidenav-list.component.ts
create mode 100644 web/src/app/shared/components/user-information/user-information.component.spec.ts
create mode 100644 web/src/app/shared/services/sidenav/sidenav.service.spec.ts
create mode 100644 web/src/app/shared/services/sidenav/sidenav.service.ts
diff --git a/web/.vscode/settings.json b/web/.vscode/settings.json
index 7880738e9..a422b16c8 100644
--- a/web/.vscode/settings.json
+++ b/web/.vscode/settings.json
@@ -11,5 +11,6 @@
"[html]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "vscode.html-language-features"
- }
+ },
+ "eslint.enable": false
}
\ No newline at end of file
diff --git a/web/cypress/cypress/plugins/index.js b/web/cypress/cypress/plugins/index.js
index fd170fba6..dffed2532 100644
--- a/web/cypress/cypress/plugins/index.js
+++ b/web/cypress/cypress/plugins/index.js
@@ -14,4 +14,4 @@
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
-}
+};
diff --git a/web/cypress/cypress/support/index.js b/web/cypress/cypress/support/index.js
index d68db96df..37a498fb5 100644
--- a/web/cypress/cypress/support/index.js
+++ b/web/cypress/cypress/support/index.js
@@ -14,7 +14,7 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
-import './commands'
+import './commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')
diff --git a/web/cypress/fixtures/example.json b/web/cypress/fixtures/example.json
index da18d9352..02e425437 100644
--- a/web/cypress/fixtures/example.json
+++ b/web/cypress/fixtures/example.json
@@ -2,4 +2,4 @@
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
-}
\ No newline at end of file
+}
diff --git a/web/cypress/support/index.js b/web/cypress/support/index.js
index d076cec9f..37a498fb5 100644
--- a/web/cypress/support/index.js
+++ b/web/cypress/support/index.js
@@ -14,7 +14,7 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
-import "./commands";
+import './commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')
diff --git a/web/src/app/administration/components/access-items-management/access-items-management.component.scss b/web/src/app/administration/components/access-items-management/access-items-management.component.scss
index babc13209..2b73f1d72 100644
--- a/web/src/app/administration/components/access-items-management/access-items-management.component.scss
+++ b/web/src/app/administration/components/access-items-management/access-items-management.component.scss
@@ -44,4 +44,3 @@ td {
.table__access-item-groups {
height: 80px;
}
-
diff --git a/web/src/app/administration/components/classification-details/classification-details.component.scss b/web/src/app/administration/components/classification-details/classification-details.component.scss
index be6a2fd56..00c180975 100644
--- a/web/src/app/administration/components/classification-details/classification-details.component.scss
+++ b/web/src/app/administration/components/classification-details/classification-details.component.scss
@@ -10,7 +10,6 @@
position: relative;
}
-
/* ACTION TOOLBAR */
.classification-details__headline {
padding-top: 0.5rem;
@@ -52,7 +51,6 @@
color: $invalid;
}
-
/* DETAILED FIELDS */
.classification__detailed-fields {
@@ -111,4 +109,3 @@
input:invalid.dirty {
border-color: $invalid;
}
-
diff --git a/web/src/app/administration/components/classification-overview/classification-overview.component.scss b/web/src/app/administration/components/classification-overview/classification-overview.component.scss
index 1799977d8..0c9cc6aa0 100644
--- a/web/src/app/administration/components/classification-overview/classification-overview.component.scss
+++ b/web/src/app/administration/components/classification-overview/classification-overview.component.scss
@@ -6,5 +6,5 @@
align-items: stretch;
}
taskana-administration-classification-details {
- width: 100%
+ width: 100%;
}
diff --git a/web/src/app/administration/components/import-export/import-export.component.scss b/web/src/app/administration/components/import-export/import-export.component.scss
index bcf0f7455..e6728976a 100644
--- a/web/src/app/administration/components/import-export/import-export.component.scss
+++ b/web/src/app/administration/components/import-export/import-export.component.scss
@@ -5,5 +5,5 @@ mat-icon {
margin-left: 3px;
}
button {
- color: #555
+ color: #555;
}
diff --git a/web/src/app/administration/components/tree/tree.component.scss b/web/src/app/administration/components/tree/tree.component.scss
index d4f109b9c..9dc7adbe1 100644
--- a/web/src/app/administration/components/tree/tree.component.scss
+++ b/web/src/app/administration/components/tree/tree.component.scss
@@ -6,4 +6,3 @@ svg-icon {
fill: #555;
top: -5px !important;
}
-
diff --git a/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.scss b/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.scss
index 85ace22bc..330f4fa54 100644
--- a/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.scss
+++ b/web/src/app/administration/components/workbasket-overview/workbasket-overview.component.scss
@@ -2,4 +2,3 @@
width: 100%;
display: flex;
}
-
diff --git a/web/src/app/app.component.html b/web/src/app/app.component.html
index b59930a8d..4d5ac4c67 100644
--- a/web/src/app/app.component.html
+++ b/web/src/app/app.component.html
@@ -1,10 +1,29 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
Taskana version: {{version}}
+
+
+
+
+
-
-
+
+
\ No newline at end of file
diff --git a/web/src/app/app.component.scss b/web/src/app/app.component.scss
index e69de29bb..8b34a01af 100644
--- a/web/src/app/app.component.scss
+++ b/web/src/app/app.component.scss
@@ -0,0 +1,57 @@
+@import '../theme/variables';
+
+.sidenav {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ margin-top: 0px;
+}
+
+.sidenav__drawer {
+ position: absolute;
+ z-index: 999;
+ box-shadow: none;
+ width: 350px;
+ background-color: $dark-green;
+ box-shadow: 3px 0px 10px -1px $dark-green;
+}
+
+.sidenav__drawer-list-item {
+ margin-left: 30px;
+}
+
+.sidenav__drawer-logout {
+ text-align: end;
+}
+
+.sidenav__drawer-version {
+ color: $grey;
+ position: absolute;
+ bottom: 5px;
+ font-size: 12px;
+ margin-left: 16px;
+}
+
+.sidenav__drawer-user-info {
+ margin-top: 30px;
+ margin-bottom: 50px;
+ margin-left: -16px;
+}
+
+.mat-icon-button {
+ outline: none;
+}
+
+.mat-icon {
+ color: white;
+}
+
+::ng-deep .mat-drawer-inner-container {
+ overflow: visible !important;
+}
+
+::ng-deep .mat-drawer {
+ overflow-y: visible !important;
+}
diff --git a/web/src/app/app.component.ts b/web/src/app/app.component.ts
index 19c9f8432..491213606 100644
--- a/web/src/app/app.component.ts
+++ b/web/src/app/app.component.ts
@@ -1,15 +1,17 @@
-import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';
+import { Component, HostListener, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { NavigationStart, Router } from '@angular/router';
import { Subscription } from 'rxjs';
-
+import { MatSidenav } from '@angular/material';
import { FormsValidatorService } from 'app/shared/services/forms-validator/forms-validator.service';
-
+import { SidenavService } from './shared/services/sidenav/sidenav.service';
import { RequestInProgressService } from './shared/services/request-in-progress/request-in-progress.service';
import { OrientationService } from './shared/services/orientation/orientation.service';
import { SelectedRouteService } from './shared/services/selected-route/selected-route';
import { UploadService } from './shared/services/upload/upload.service';
import { ErrorModel } from './shared/models/error-model';
-import { NotificationService } from './shared/services/notifications/notification.service';
+import { TaskanaEngineService } from './shared/services/taskana-engine/taskana-engine.service';
+import { WindowRefService } from 'app/shared/services/window/window.service';
+import { environment } from 'environments/environment';
@Component({
selector: 'taskana-root',
@@ -18,7 +20,6 @@ import { NotificationService } from './shared/services/notifications/notificatio
})
export class AppComponent implements OnInit, OnDestroy {
workbasketsRoute = true;
-
selectedRoute = '';
requestInProgress = false;
@@ -29,6 +30,7 @@ export class AppComponent implements OnInit, OnDestroy {
routerSubscription: Subscription;
uploadingFileSubscription: Subscription;
error: ErrorModel;
+ version: string;
constructor(
private router: Router,
@@ -36,8 +38,10 @@ export class AppComponent implements OnInit, OnDestroy {
private orientationService: OrientationService,
private selectedRouteService: SelectedRouteService,
private formsValidatorService: FormsValidatorService,
- private errorService: NotificationService,
- public uploadService: UploadService
+ public uploadService: UploadService,
+ private sidenavService: SidenavService,
+ private taskanaEngineService: TaskanaEngineService,
+ private window: WindowRefService
) {}
@HostListener('window:resize', ['$event'])
@@ -45,6 +49,8 @@ export class AppComponent implements OnInit, OnDestroy {
this.orientationService.onResize();
}
+ @ViewChild('sidenav') public sidenav: MatSidenav;
+
ngOnInit() {
this.routerSubscription = this.router.events.subscribe((event) => {
if (event instanceof NavigationStart) {
@@ -65,9 +71,23 @@ export class AppComponent implements OnInit, OnDestroy {
}
this.selectedRoute = value;
});
+
this.uploadingFileSubscription = this.uploadService.getCurrentProgressValue().subscribe((value) => {
this.currentProgressValue = value;
});
+
+ this.taskanaEngineService.getVersion().subscribe((restVersion) => {
+ this.version = restVersion.version;
+ });
+ }
+
+ logout() {
+ this.taskanaEngineService.logout();
+ this.window.nativeWindow.location.href = environment.taskanaLogoutUrl;
+ }
+
+ ngAfterViewInit(): void {
+ this.sidenavService.setSidenav(this.sidenav);
}
ngOnDestroy() {
diff --git a/web/src/app/app.module.ts b/web/src/app/app.module.ts
index 44b10764c..c037ed7e8 100644
--- a/web/src/app/app.module.ts
+++ b/web/src/app/app.module.ts
@@ -13,6 +13,14 @@ import { TabsModule } from 'ngx-bootstrap/tabs';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TreeModule } from 'angular-tree-component';
import { SharedModule } from 'app/shared/shared.module';
+import {
+ MatButtonModule,
+ MatSidenavModule,
+ MatCheckboxModule,
+ MatGridListModule,
+ MatListModule,
+ MatIconModule
+} from '@angular/material';
/**
* Services
@@ -31,6 +39,8 @@ import { NoAccessComponent } from 'app/shared/components/no-access/no-access.com
import { FormsValidatorService } from './shared/services/forms-validator/forms-validator.service';
import { UploadService } from './shared/services/upload/upload.service';
import { NotificationService } from './shared/services/notifications/notification.service';
+import { SidenavService } from './shared/services/sidenav/sidenav.service';
+import { SidenavListComponent } from 'app/shared/components/sidenav-list/sidenav-list.component';
/**
* Components
*/
@@ -62,11 +72,17 @@ const MODULES = [
ReactiveFormsModule,
TreeModule,
SharedModule,
+ MatSidenavModule,
+ MatCheckboxModule,
+ MatGridListModule,
+ MatListModule,
+ MatButtonModule,
+ MatIconModule,
NgxsModule.forRoot(STATES, { developmentMode: !environment.production }),
NgxsReduxDevtoolsPluginModule.forRoot({ disabled: environment.production, maxAge: 25 })
];
-const DECLARATIONS = [AppComponent, NavBarComponent, UserInformationComponent, NoAccessComponent];
+const DECLARATIONS = [AppComponent, NavBarComponent, UserInformationComponent, NoAccessComponent, SidenavListComponent];
export function startupServiceFactory(startupService: StartupService): () => Promise
{
return (): Promise => startupService.load();
@@ -97,7 +113,8 @@ export function startupServiceFactory(startupService: StartupService): () => Pro
FormsValidatorService,
UploadService,
NotificationService,
- ClassificationCategoriesService
+ ClassificationCategoriesService,
+ SidenavService
],
bootstrap: [AppComponent]
})
diff --git a/web/src/app/shared/components/master-and-detail/master-and-detail.component.scss b/web/src/app/shared/components/master-and-detail/master-and-detail.component.scss
index 6366de648..a0c84dda9 100644
--- a/web/src/app/shared/components/master-and-detail/master-and-detail.component.scss
+++ b/web/src/app/shared/components/master-and-detail/master-and-detail.component.scss
@@ -1,4 +1,3 @@
-
.master-detail {
min-width: 100vw;
}
diff --git a/web/src/app/shared/components/nav-bar/nav-bar.component.html b/web/src/app/shared/components/nav-bar/nav-bar.component.html
index efe0d1d37..d33a82a64 100644
--- a/web/src/app/shared/components/nav-bar/nav-bar.component.html
+++ b/web/src/app/shared/components/nav-bar/nav-bar.component.html
@@ -1,78 +1,11 @@
-