This commit is contained in:
@@ -22,11 +22,13 @@ import { RegisterComponent } from './views/pages/register/register.component';
|
||||
import { HomepageComponent } from './views/components/homepage/homepage.component';
|
||||
import { ProfileComponent } from './views/components/profile/profile.component';
|
||||
import { StatisticComponent } from './views/components/statistic/statistic.component';
|
||||
import { SharesComponent } from './views/components/shares/shares.component';
|
||||
import {NotAuthGuard} from "./notAuth.guard";
|
||||
import {ParentAuthGuard} from "./parentAuth.guard";
|
||||
import {ApiClientService} from "../api/index";
|
||||
import {MapComponent} from "./views/components/map/map.component";
|
||||
import {LocationService} from "./location.service";
|
||||
import { PrivilegesService } from './privileges.service';
|
||||
import {VerifyEmailComponent} from "./views/pages/verify-email/verify-email.component";
|
||||
import {ResetPasswordComponent} from "./views/pages/reset-password/reset-password.component";
|
||||
import {ResetPasswordEmailComponent} from "./views/pages/reset-password-email/reset-password-email.component";
|
||||
@@ -92,7 +94,8 @@ const APP_COMPONENTS = [
|
||||
ResetPasswordEmailComponent,
|
||||
AdminComponent,
|
||||
UserManagementComponent,
|
||||
PlaceComponent
|
||||
PlaceComponent,
|
||||
SharesComponent
|
||||
];
|
||||
|
||||
// Import directives
|
||||
@@ -156,7 +159,7 @@ import { DatepickerModule, BsDatepickerModule } from 'ngx-bootstrap/datepicker';
|
||||
{provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true},
|
||||
{ provide: LOCALE_ID, useValue: 'de' },
|
||||
// add our application services (api access, logging, authentication)
|
||||
ApiClientService, ConsoleService, AuthGuard, NotAuthGuard, ParentAuthGuard, AuthService, LocationService
|
||||
ApiClientService, ConsoleService, AuthGuard, NotAuthGuard, ParentAuthGuard, AuthService, LocationService, PrivilegesService
|
||||
],
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
|
||||
@@ -28,7 +28,6 @@ export class LocationService {
|
||||
getLocation(shareId: string): void {
|
||||
this.apiClientService.getShareLocation(shareId).subscribe(result => {
|
||||
this.location.next(result.body);
|
||||
this.consoleService.log(`Fetched location: \n ${this.location.getValue()}`);
|
||||
}, error => {
|
||||
this.consoleService.log(`Error finding the share with id ${shareId}.`);
|
||||
if (error instanceof HttpErrorResponse) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ApiClientService } from '../api/index';
|
||||
import { ConsoleService } from './console.service';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Privilege } from '../api/models/privilege.model';
|
||||
import { PrivilegePage } from '../api/models/privilegepage.model';
|
||||
|
||||
@Injectable()
|
||||
export class PrivilegesService {
|
||||
|
||||
constructor(private consoleService: ConsoleService, private apiClientService: ApiClientService) { }
|
||||
|
||||
privileges: BehaviorSubject<PrivilegePage> = new BehaviorSubject<PrivilegePage>(null);
|
||||
error: BehaviorSubject<string> = new BehaviorSubject<string>(null);
|
||||
|
||||
getPrivilegesForCurrentUser(pageOffset: number, pageSize: number) {
|
||||
this.apiClientService.getCurrentUserPrivileges(pageOffset, pageSize).subscribe(privileges => {
|
||||
this.privileges.next(privileges.body);
|
||||
}, error => {
|
||||
this.consoleService.log('Could not get privileges for current user.');
|
||||
if (error instanceof HttpErrorResponse) {
|
||||
const message = error.status + ': ' + error.statusText;
|
||||
this.consoleService.log('HttpError: ' + message);
|
||||
this.error.next(message);
|
||||
} else {
|
||||
this.consoleService.log('Unknown error getting the privileges for the current user.');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
<div class="animated fadeIn align-items-center">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
<div *ngIf="getAuthState() | async as authObject;" class="col-md-2">
|
||||
<div *ngIf="authObject == AuthState.Authorized">
|
||||
<app-shares></app-shares>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -15,10 +16,10 @@
|
||||
<div class="modal-dialog modal-warning" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Share does not exist</h4>
|
||||
<h4 class="modal-title">Share nicht gefunden</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>The share-id specified in the URL does not exist!</p>
|
||||
<p>Der angegebene Share existiert nicht.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" (click)="onModalOkClick()">Okay</button>
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'leaflet-easybutton';
|
||||
import { setInterval, clearInterval } from 'timers';
|
||||
import { LocationService } from '../../../location.service';
|
||||
import { ConsoleService } from '../../../console.service';
|
||||
import { AuthService, AuthState } from '../../../auth.service';
|
||||
import { Location } from '../../../../api/models/location.model';
|
||||
import { LatLng } from 'leaflet';
|
||||
|
||||
@@ -24,33 +25,36 @@ import { OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MapComponent implements OnInit, OnDestroy {
|
||||
AuthState = AuthState;
|
||||
|
||||
private defaultLocation: L.LatLng = new L.LatLng(51.4556, 7.0116);
|
||||
private defaultZoom = 13;
|
||||
isUserLoggedIn: boolean;
|
||||
|
||||
private currentLocation: L.LatLng;
|
||||
private currentZoom: Number;
|
||||
defaultLocation: L.LatLng = new L.LatLng(51.4556, 7.0116);
|
||||
defaultZoom = 13;
|
||||
|
||||
private zoomPanOptions: L.ZoomPanOptions = {
|
||||
currentLocation: L.LatLng;
|
||||
currentZoom: Number;
|
||||
|
||||
zoomPanOptions: L.ZoomPanOptions = {
|
||||
animate: true,
|
||||
duration: 2,
|
||||
easeLinearity: 0.6,
|
||||
noMoveStart: true
|
||||
};
|
||||
|
||||
private currentShare: string;
|
||||
private map: L.Map;
|
||||
private tileLayer: L.TileLayer;
|
||||
currentShare: string;
|
||||
map: L.Map;
|
||||
tileLayer: L.TileLayer;
|
||||
|
||||
private defaultIcon = new L.Icon({
|
||||
defaultIcon = new L.Icon({
|
||||
iconUrl: require('../../../../assets/img/marker_normal.png'),
|
||||
iconSize: [50, 64], // size of the icon
|
||||
iconAnchor: [25, 63], // point of the icon which will correspond to marker's location
|
||||
});
|
||||
|
||||
private marker: L.Marker;
|
||||
marker: L.Marker;
|
||||
|
||||
private refreshInterval;
|
||||
refreshInterval;
|
||||
|
||||
@ViewChild('shareNonExistentModal') shareNonExistentModal;
|
||||
|
||||
@@ -59,6 +63,7 @@ export class MapComponent implements OnInit, OnDestroy {
|
||||
private locationService: LocationService,
|
||||
private consoleService: ConsoleService,
|
||||
private toastService: ToastrService,
|
||||
private authService: AuthService,
|
||||
private browser_location: BrowserLocation
|
||||
) { }
|
||||
|
||||
@@ -102,7 +107,7 @@ export class MapComponent implements OnInit, OnDestroy {
|
||||
}, 2000);
|
||||
|
||||
} else {
|
||||
setTimeout(() => this.showWarning('Warning', 'URL does not contain a valid share!'));
|
||||
// setTimeout(() => this.showWarning('Warning', 'URL does not contain a valid share!'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,4 +182,8 @@ export class MapComponent implements OnInit, OnDestroy {
|
||||
closeButton: true,
|
||||
});
|
||||
}
|
||||
|
||||
getAuthState(): BehaviorSubject<AuthState> {
|
||||
return this.authService.state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<table class="table table-striped table-bordered dataTable no-footer" role="grid">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Share</th>
|
||||
<th>Status</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, Input, ViewChild } from '@angular/core';
|
||||
import { AuthService } from '../../../auth.service';
|
||||
import { User } from '../../../../api/models/user.model';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shares',
|
||||
templateUrl: 'shares.component.html'
|
||||
})
|
||||
export class SharesComponent {
|
||||
|
||||
constructor(private authService: AuthService, private toastr: ToastrService) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user