TSK-617: Add version number to interface
This commit is contained in:
parent
2981dad384
commit
03e29d5a4d
|
@ -13,6 +13,7 @@ import pro.taskana.TaskanaRole;
|
|||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||
import pro.taskana.impl.TaskanaEngineImpl;
|
||||
import pro.taskana.rest.resource.TaskanaUserInfoResource;
|
||||
import pro.taskana.rest.resource.VersionResource;
|
||||
import pro.taskana.security.CurrentUserContext;
|
||||
|
||||
/**
|
||||
|
@ -55,4 +56,20 @@ public class TaskanaEngineController {
|
|||
return new ResponseEntity<>(resource, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current application version.
|
||||
*
|
||||
* @return The current version.
|
||||
*/
|
||||
@GetMapping(path = "/v1/version", produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public ResponseEntity<VersionResource> currentVersion() {
|
||||
String version = TaskanaEngineController.class.getPackage().getImplementationVersion();
|
||||
if (version == null) {
|
||||
version = "1.0-DEFAULT";
|
||||
}
|
||||
VersionResource resource = new VersionResource();
|
||||
resource.setVersion(version);
|
||||
return new ResponseEntity<>(resource,
|
||||
HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.springframework.hateoas.ResourceSupport;
|
||||
|
||||
/**
|
||||
* Resource class for version information.
|
||||
*/
|
||||
public class VersionResource extends ResourceSupport {
|
||||
|
||||
private String version;
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
|
@ -61,6 +61,9 @@
|
|||
<span (click)="toogleNavBar()" routerLink="{{workplaceUrl}}" aria-controls="Workplace" routerLinkActive="active">Workplace</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav-version">
|
||||
<p id="taskana-version"> Taskana version: {{version}} </p>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="showNavbar" class="navbar-backdrop" (click)="toogleNavBar()"></div>
|
||||
</nav>
|
|
@ -1,6 +1,8 @@
|
|||
$background-color: #224562;
|
||||
$background-color-sidenav: #175263;
|
||||
$selected-border-color: #22a39f;
|
||||
$unselected-text: #9d9d9d;
|
||||
|
||||
.navbar-inverse {
|
||||
border:none;
|
||||
background-color: $background-color;
|
||||
|
@ -76,6 +78,14 @@ h2.navbar-brand{
|
|||
.nav-content{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.nav-version {
|
||||
color: $unselected-text;
|
||||
margin: 5px;
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
font-size: 8px;
|
||||
}
|
||||
|
||||
/*
|
||||
* All side bar links styling.
|
||||
|
@ -119,7 +129,7 @@ h2.navbar-brand{
|
|||
|
||||
.menu,.submenu > span {
|
||||
padding-left: 12px;
|
||||
color: #9d9d9d;
|
||||
color: $unselected-text;
|
||||
outline: none;
|
||||
|
||||
}
|
||||
|
@ -138,7 +148,7 @@ h2.navbar-brand{
|
|||
}
|
||||
|
||||
a {
|
||||
color: #9d9d9d;
|
||||
color: $unselected-text;
|
||||
&:hover{
|
||||
color:white;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import { WindowRefService } from 'app/services/window/window.service';
|
|||
import { UserGuard } from 'app/guards/user-guard';
|
||||
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
|
||||
import { expandRight } from 'app/shared/animations/expand.animation';
|
||||
import { VersionModel } from 'app/models/version';
|
||||
@Component({
|
||||
selector: 'taskana-nav-bar',
|
||||
templateUrl: './nav-bar.component.html',
|
||||
|
@ -29,6 +30,7 @@ export class NavBarComponent implements OnInit, OnDestroy {
|
|||
showNavbar = false;
|
||||
domains: Array<string> = [];
|
||||
selectedDomain: string;
|
||||
version: string;
|
||||
|
||||
adminUrl = './administration';
|
||||
monitorUrl = './monitor';
|
||||
|
@ -60,6 +62,10 @@ export class NavBarComponent implements OnInit, OnDestroy {
|
|||
this.selectedDomain = domain;
|
||||
});
|
||||
|
||||
this.taskanaEngineService.getVersion().subscribe(restVersion => {
|
||||
this.version = restVersion.version;
|
||||
});
|
||||
|
||||
this.administrationAccess = this.taskanaEngineService.hasRole(BusinessAdminGuard.roles);
|
||||
this.monitorAccess = this.taskanaEngineService.hasRole(MonitorGuard.roles);
|
||||
this.workplaceAccess = this.taskanaEngineService.hasRole(UserGuard.roles);
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
export class VersionModel {
|
||||
constructor(
|
||||
public version: string = undefined
|
||||
) { };
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { of } from 'rxjs';
|
||||
import { of, Observable } from 'rxjs';
|
||||
import { UserInfoModel } from 'app/models/user-info';
|
||||
import { VersionModel } from '../../models/version';
|
||||
|
||||
@Injectable()
|
||||
export class TaskanaEngineServiceMock {
|
||||
|
@ -28,6 +29,11 @@ export class TaskanaEngineServiceMock {
|
|||
return false;
|
||||
}
|
||||
|
||||
getVersion(): Observable<VersionModel> {
|
||||
const version = new VersionModel('1.0.0');
|
||||
return of(version);
|
||||
}
|
||||
|
||||
private findRole(roles2Find: Array<string>) {
|
||||
return this.currentUserInfo.roles.find(role => {
|
||||
return roles2Find.some(roleLookingFor => {
|
||||
|
|
|
@ -2,6 +2,8 @@ import { Injectable } from '@angular/core';
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'environments/environment';
|
||||
import { UserInfoModel } from 'app/models/user-info';
|
||||
import { VersionModel } from 'app/models/version';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
|
||||
|
@ -32,6 +34,10 @@ export class TaskanaEngineService {
|
|||
return false;
|
||||
}
|
||||
|
||||
getVersion(): Observable<VersionModel> {
|
||||
return this.httpClient.get<VersionModel>(`${environment.taskanaRestUrl}/v1/version`);
|
||||
}
|
||||
|
||||
private findRole(roles2Find: Array<string>) {
|
||||
return this.currentUserInfo.roles.find(role => {
|
||||
return roles2Find.some(roleLookingFor => {
|
||||
|
|
Loading…
Reference in New Issue