Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0aa1cf2
[UNIONVMS-4725] - Fixed bug in printing of segments and the info popup
Aug 31, 2020
120d33d
[UNIONVMS-4725] added activities to generated report
nomikosi Sep 11, 2020
f7a7a35
[UNIONVMS-4775] added printing for labels
nomikosi Sep 21, 2020
0710f23
[UNIONVMS-4741] Choose vessel from Reports page and pan to its latest…
Aug 3, 2020
717878f
[UNIONVMS-4743] Allowing filter criteria to extend the selection (OR)
Aug 24, 2020
f44d4c4
[UNIONVMS-4750] Added last x/All X criteria for positions/segments/tr…
Aug 24, 2020
c76742c
[UNIONVMS-4854] Add tripId as search field for position and segment t…
Oct 15, 2020
8c3163c
[UNIONVMS-4854] Corrections - we are in ES5 - and performance improve…
Oct 21, 2020
1b8ab6c
[UNIONVMS-4725] Fix spatial server url
Oct 22, 2020
932c03c
[UNIONVMS-4738] Import area from gml file.
Sep 28, 2020
cfeee3e
[UNIONVMS-4751] Made attribute names individually hideable in the map…
Aug 24, 2020
ce0541d
[UNIONVMS-4752] Added allowance in user config to add replacement att…
Aug 24, 2020
e34f163
Refactoring: Removed trailing white spaces
Aug 25, 2020
1930d72
[UNIONVMS-4738] Fix areas imported by gml not being saved.
Oct 23, 2020
9b92de1
[UNIONVMS-4743] Remove extra forms when clearing search filters.
Oct 23, 2020
3480580
[UNIONVMS-4743] Fix trip search for multiple criteria.
Oct 26, 2020
8a995c7
[UNIONVMS-4855] add save for map configuration selections
Oct 26, 2020
24193e4
[UNIONVMS-4750] Apply last X search to segments.
Nov 2, 2020
b68681c
[UNIONVMS-4752] Fix the display when all labels are deselected and wh…
Nov 2, 2020
648ea44
[UNIONVMS-4719] Add script for Promise if undefined.
Nov 4, 2020
9f77db1
[UNIONVMS-4704] Show catches' conversion factor in italics if it come…
Nov 11, 2020
49e456d
[UNIONVMS-4866] Add selection for exporting activities to csv.
Nov 4, 2020
8f1ecf1
[UNIONVMS-4537] Remove Mobile Terminal from header and routing.
Nov 4, 2020
a901146
Header tabs are added according to user permissions.
Nov 12, 2020
d107127
[UVMS-4535] Adding redirection at usm panel in case of no full permis…
Oct 16, 2020
4c27fd2
[UNIONVMS-4866] Export trips to CSV.
Nov 16, 2020
3967150
[UNIONVMS-4863] [UNIONVMS-4864] front end functionallity for sorting …
Nov 9, 2020
936c1ba
[UNIONVMS-4634] Added field in activities advanced search form for fl…
Oct 15, 2020
ade1d5f
[UNIONVMS-4866] Fix queries for csv export.
Nov 18, 2020
d15e4f8
[UNIONVMS-4541] sorting asset table with added backend functionality
Oct 20, 2020
99cc667
[UNIONVMS-4541] Apply sorting to all pages in assets list.
Nov 20, 2020
44fd98c
[UNIONVMS-4921] Add platform version at the footer and module version…
Nov 24, 2020
8ce3541
[UNIONVMS-4921] add footer for angular 9
Dec 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion unionvms-web-2/src/angular/app/auth/auth-endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const AUTH_ENDPOINTS = {
userLogin: '/usm-administration/rest/authenticate',
getUserContexts: '/usm-administration/rest/userContexts',
userLogout: '/usm-administration/rest/sessions/'
userLogout: '/usm-administration/rest/sessions/',
getIsReviewContactDetailsEnabled: '/usm-administration/rest/persons/isReviewContactDetailsEnabled'
};

4 changes: 4 additions & 0 deletions unionvms-web-2/src/angular/app/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ export class AuthService {
logOut(sessionId) {
return this.http.delete(`${environment.baseURL}${AUTH_ENDPOINTS.userLogout}${sessionId}`).toPromise();
}

getUserIsReviewContactDetailsEnabled() {
return this.http.get(`${environment.baseURL}${AUTH_ENDPOINTS.getIsReviewContactDetailsEnabled}`);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div>
<footer>
<p><span>Platform version: {{platformVersion}}</span></p>
</footer>
</div>

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
footer {
bottom: 0;
background-color: #ecf0f1;
color: white;
width: 100%;
padding-top: 4px;
margin-top: 100px;
min-width: 992px;
border-top: 1px solid #dddddd;
p {
margin-bottom: 5px;
font-size: 13px;
color: #666666;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Component, OnInit } from '@angular/core';
import { MainService } from './../main.service';

@Component({
selector: 'app-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss']
})

export class FooterComponent implements OnInit {
platformVersion: string;
constructor(private mainService: MainService) { }

ngOnInit() {
this.updatePlatformDependencies();
}

async updatePlatformDependencies() {
const result: any = await this.mainService.getPlatformVersion();
this.platformVersion = result.data.platformVersion;
}

}
1 change: 1 addition & 0 deletions unionvms-web-2/src/angular/app/core/main/main-endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const MAIN_ENDPOINTS = {
countOpenAlarms: '/rules/rest/alarms/countopen',
countUserOpenTickets: '/rules/rest/tickets/countopen',
getPlatformVersion: '/config/rest/module/all'
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<app-navigation></app-navigation>
<div class="container-fluid main">
<router-outlet></router-outlet>
<app-footer></app-footer>
</div>
7 changes: 3 additions & 4 deletions unionvms-web-2/src/angular/app/core/main/main.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ import { SharedModule } from '../../shared/shared.module';
import { MainRoutingModule } from './main-routing.module';
import { HeaderComponent } from './header/header.component';
import { NavigationComponent } from './navigation/navigation.component';



import { FooterComponent } from './footer/footer.component'

@NgModule({
declarations: [
MainComponent,
HeaderComponent,
NavigationComponent,
ClockComponent
ClockComponent,
FooterComponent
],
imports: [
SharedModule,
Expand Down
6 changes: 5 additions & 1 deletion unionvms-web-2/src/angular/app/core/main/main.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { HttpClient } from '@angular/common/http';
import { environment } from '../../../environments/environment';
import { ResponseDto } from 'app/features/features.model';


// provide in main module?
@Injectable({
providedIn: 'root',
Expand All @@ -21,4 +20,9 @@ export class MainService {
countUserOpenTickets(username): Promise<ResponseDto<number>> {
return this.http.get<ResponseDto<number>>(`${environment.baseURL}${MAIN_ENDPOINTS.countUserOpenTickets}/${username}`).toPromise();
}

async getPlatformVersion() {
return this.http.get(`${environment.baseURL}${MAIN_ENDPOINTS.getPlatformVersion}`).toPromise();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,85 +4,64 @@ export const NAVIGATION_TABS = [
{
id: 1,
name: 'Today',
href: `${environment.oldBaseURL}/#/today`,
// permissions: [300001]
href: `${environment.oldBaseURL}/#/today`
},
{
id: 2,
name: 'Reports',
href: `${environment.oldBaseURL}/#/reporting`,
// permissions: [300001]
permissions: [21] //LIST_REPORTS
},
{
id: 3,
name: 'Area management',
href: `${environment.oldBaseURL}/#/areas`,
// permissions: [100041]
permissions: [100036] //VIEW_AREA_MANAGEMENT_UI
},
{
id: 4,
name: 'Subscriptions',
route: '/subscriptions',
// permissions: [300001]
permissions: [300000] //VIEW_SUBSCRIPTION
},
{
id: 5,
name: 'Activity',
href: `${environment.oldBaseURL}/#/activity`,
// permissions: [279]
permissions: [100026] //ACTIVITY_ALLOWED
},
{
id: 6,
name: 'Positions',
href: `${environment.oldBaseURL}/#/movement`,
// permissions: [300001]
name: 'Positions'
},
{
id: 7,
name: 'Sales',
href: `${environment.oldBaseURL}/#/sales`,
// permissions: [300001]
permissions: [300002] //viewSalesReports
},
{
id: 8,
name: 'Exchange',
href: `${environment.oldBaseURL}/#/exchange`,
// permissions: [300001]
permissions: [249] //viewExchange
},
{
id: 9,
name: 'Polling',
href: `${environment.oldBaseURL}/#/polling/logs`,
// permissions: [100034]
name: 'Assets',
href: `${environment.oldBaseURL}/#/assets`,
permissions: [292] //viewVesselsAndMobileTerminals
},
{
id: 10,
name: 'Mobile terminals',
href: `${environment.oldBaseURL}/#/communication`,
// permissions: [300001]
name: 'Alerts'
},
{
id: 11,
name: 'Assets',
href: `${environment.oldBaseURL}/#/assets`,
// permissions: [300001]
name: 'User'
},
{
id: 12,
name: 'Alerts',
href: `${environment.oldBaseURL}/#/alerts/holdingtable`,
// permissions: [300001]
},
{
id: 13,
name: 'User',
href: `${environment.oldBaseURL}/#/usm/users`,
// permissions: [300001]
},
{
id: 14,
name: 'Admin',
href: `${environment.oldBaseURL}/#/admin/auditlog`,
// permissions: [300001]
name: 'Admin'
}
];
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Component, OnInit, OnDestroy, ElementRef } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Store} from '@ngrx/store';
import * as fromRoot from '../../../app.reducer';
import { take, throttleTime } from 'rxjs/operators';

import { AuthResponse } from 'app/auth/auth-response.model';
import { Observable, fromEvent } from 'rxjs';
import { NAVIGATION_TABS } from './navigation-tabs';
import { NavigationTab } from './navigation-tab.model';
import {throttleTime} from 'rxjs/operators';

import {AuthResponse} from 'app/auth/auth-response.model';
import {fromEvent, Observable} from 'rxjs';
import {NAVIGATION_TABS} from './navigation-tabs';
import {NavigationTab} from './navigation-tab.model';
import {environment} from "../../../../environments/environment";
import {AuthService} from "../../../auth/auth.service";
import {Context, Feature, UserContexts} from "../../../auth/user-contexts.model";


@Component({
Expand All @@ -24,21 +26,78 @@ export class NavigationComponent implements OnInit {

// currentUrl$: Observable<>;

constructor(private store: Store<fromRoot.State>, private activatedRoute: ActivatedRoute) { }
constructor(private store: Store<fromRoot.State>, private activatedRoute: ActivatedRoute, private authService: AuthService) { }

ngOnInit() {
// this.authenticatedUser$.pipe(take(1)).subscribe(
// authUser => {
// this.userPemissions = authUser.permissions;
// }
// );
// A tab can be shown if appropriate permission exists withing the jwt token features array
// this.availableTabs = NAVIGATION_TABS.filter(element => element.permissions.some(entry => this.userPemissions.includes(entry)));

// No checks for now
this.availableTabs = NAVIGATION_TABS;
let scopeName = localStorage.getItem('scopeName');
let roleName = localStorage.getItem('roleName');
this.authService.getUserContexts().toPromise().then((contexts: UserContexts) => {
let currentContext: Context = contexts.contextSet.contexts.find((context:Context) => {
return context.scope.scopeName === scopeName && context.role.roleName === roleName;
});
this.userPemissions = currentContext.role.features.map((feature: Feature) => {
return feature.featureId;
});
this.setAvailableTabs();
});
this.setUpAutoResize();
}

private setAvailableTabs() {

let movementTab = NAVIGATION_TABS[5];
if(this.userPemissions.includes(267)) { //viewMovements
movementTab['href'] = `${environment.oldBaseURL}/#/movement`;
} else if (this.userPemissions.includes(276)) { //viewManualMovements
movementTab['href'] = `${environment.oldBaseURL}/#/movement/manual`;
} else {
movementTab['permissions'] = [-1]; //tab is not shown
}

let alarmsTab = NAVIGATION_TABS[9];
if(this.userPemissions.includes(208)) { //viewAlarmsHoldingTable
alarmsTab['href'] = `${environment.oldBaseURL}/#/alerts/holdingtable`;
} else if (this.userPemissions.includes(210)) { //viewAlarmsOpenTickets
alarmsTab['href'] = `${environment.oldBaseURL}/#/alerts/notifications`;
} else if (this.userPemissions.includes(206)) { //viewAlarmRules
alarmsTab['href'] = `${environment.oldBaseURL}/#/alerts/rules`;
} else {
alarmsTab['permissions'] = [-1]; //tab is not shown
}

let usersTab = NAVIGATION_TABS[10];
if(this.userPemissions.includes(100001) || this.userPemissions.includes(100000)) { // manageUsers or viewUsers
usersTab['href'] = `${environment.oldBaseURL}/#/usm/users`;
} else if (this.userPemissions.includes(100004) || this.userPemissions.includes(100003)) { //manageOrganisations or viewOrganisations
usersTab['href'] = `${environment.oldBaseURL}/#/usm/organisations`;
} else if (this.userPemissions.includes(100011) || this.userPemissions.includes(100010)) { //manageRoles or viewRoles
usersTab['href'] = `${environment.oldBaseURL}/#/usm/roles`;
} else if (this.userPemissions.includes(100015) || this.userPemissions.includes(100014)) { //manageScopes or viewScopes
usersTab['href'] = `${environment.oldBaseURL}/#/usm/scopes`;
} else if (this.userPemissions.includes(100006) || this.userPemissions.includes(100005)) { //manageApplications or viewApplications
usersTab['href'] = `${environment.oldBaseURL}/#/usm/applications`;
} else if (this.userPemissions.includes(100018)) { //configurePolicies
usersTab['href'] = `${environment.oldBaseURL}/#/usm/policies`;
} else if (this.userPemissions.includes(100001)) { //manageUsers
this.authService.getUserIsReviewContactDetailsEnabled().toPromise().then( resp => {
if(!resp['result']) {
usersTab['href'] = `${environment.oldBaseURL}/#/usm/changes`;
this.availableTabs = NAVIGATION_TABS.filter(element =>!element.permissions || element.permissions.some(entry => this.userPemissions.includes(entry)));
}
});
} else {
usersTab['permissions'] = [-1]; //tab is not shown
}

let adminTab = NAVIGATION_TABS[11];
if (this.userPemissions.includes(286)) { //viewAudit
adminTab['href'] = `${environment.oldBaseURL}/#/admin/auditlog`;
} else if (this.userPemissions.includes(214)) { //viewConfiguration
adminTab['href'] = `${environment.oldBaseURL}/#/admin/configuration`;
} else {
adminTab['permissions'] = [-1]; //tab is not shown
}
this.availableTabs = NAVIGATION_TABS.filter(element =>!element.permissions || element.permissions.some(entry => this.userPemissions.includes(entry)));

}

Expand Down
Loading