header: showing username + logoutfunctionality, package-lock modified, delay reduced to 500
lbs-gitea/maptology/master This commit looks good
lbs-gitea/maptology/master This commit looks good
This commit is contained in:
Generated
+32
-937
File diff suppressed because it is too large
Load Diff
@@ -6,16 +6,17 @@
|
||||
<button class="navbar-toggler d-md-down-none mr-auto" type="button" appSidebarToggler>
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
|
||||
<ul class="nav navbar-nav ml-auto">
|
||||
<li class="nav-item dropdown" dropdown placement="bottom right">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" dropdownToggle (click)="false">
|
||||
<img src="assets/img/avatars/6.jpg" class="img-avatar" alt="admin@bootstrapmaster.com"/>
|
||||
<!-- <img src="assets/img/avatars/6.jpg" class="img-avatar" alt="admin@bootstrapmaster.com"/>-->
|
||||
{{getUser().getValue().name}}
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right" *dropdownMenu aria-labelledby="simple-dropdown">
|
||||
<div class="dropdown-header text-center"><strong>Account</strong></div>
|
||||
<a class="dropdown-item" href="#"><i class="fa fa-user-circle-o"></i> Profile</a>
|
||||
<a class="dropdown-item" href="#"><i class="fa fa-sign-out"></i> Logout</a>
|
||||
<a class="dropdown-item" href="#"><i class="fa fa-user-circle-o"></i>Profile</a>
|
||||
<a class="dropdown-item" (click)="requestLogout()" href=""><i class="fa fa-sign-out"></i>Logout</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.navbar-nav{
|
||||
padding-right: 10px;
|
||||
}
|
||||
@@ -1,7 +1,24 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { AuthService } from '../../auth.service';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { User } from '../../../api/models/user.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
templateUrl: './app-header.component.html'
|
||||
templateUrl: './app-header.component.html',
|
||||
styleUrls: ['./app-header.component.scss'],
|
||||
})
|
||||
export class AppHeaderComponent { }
|
||||
export class AppHeaderComponent {
|
||||
|
||||
AuthState = this.AuthState;
|
||||
|
||||
constructor(private authService: AuthService) { }
|
||||
|
||||
getUser(): BehaviorSubject<User> {
|
||||
return this.authService.user;
|
||||
}
|
||||
|
||||
requestLogout(): void {
|
||||
this.authService.requestLogout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ConsoleService } from './console.service';
|
||||
|
||||
/**
|
||||
* An interceptor that slows down the responses of http requests
|
||||
* by a configurable amount of time such that every response will
|
||||
* by a configurable amount of time such that every response will
|
||||
* not be delivered before the configured delay.
|
||||
*/
|
||||
@Injectable()
|
||||
@@ -16,12 +16,12 @@ export class DelayInterceptor implements HttpInterceptor {
|
||||
/**
|
||||
* The delay to slow down requests.
|
||||
*/
|
||||
private delay: number = 3000;
|
||||
private delay: number = 500;
|
||||
|
||||
/**
|
||||
* Creates a new interceptor with the injected console service
|
||||
* and the optionally injected delay.
|
||||
*
|
||||
*
|
||||
* @param consoleService The console service for logging.
|
||||
* @param delay The configurable delay.
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ export class DelayInterceptor implements HttpInterceptor {
|
||||
/**
|
||||
* Intercepts the requests and returns a new observable that is
|
||||
* populated with a delay.
|
||||
*
|
||||
*
|
||||
* @param req The request that is intercepted.
|
||||
* @param next The handler to continue the request.
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ export class DelayInterceptor implements HttpInterceptor {
|
||||
//
|
||||
// import { delay } from 'rxjs/operators';
|
||||
// return next.handle(req).pipe(delay(10000));
|
||||
//
|
||||
//
|
||||
// but we also want to delay errors, so we need to fully specify it
|
||||
const started = Date.now();
|
||||
var delayedRequest: Subject<HttpEvent<any>> = new Subject<HttpEvent<any>>();
|
||||
@@ -55,7 +55,7 @@ export class DelayInterceptor implements HttpInterceptor {
|
||||
}, () => {
|
||||
this.consoleService.log("Scheduling completion for " + req.urlWithParams);
|
||||
// hacky: +2 to ensure that completion is sent last
|
||||
this.schedule(started + 2, ()=> delayedRequest.complete() );
|
||||
this.schedule(started + 2, ()=> delayedRequest.complete() );
|
||||
});
|
||||
return delayedRequest;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ export class DelayInterceptor implements HttpInterceptor {
|
||||
* Schedules the (possibly delayed) execution of the request. If
|
||||
* the request took long enough already, this method will directly
|
||||
* execute it.
|
||||
*
|
||||
*
|
||||
* @param started The time in milliseconds when the request was issued.
|
||||
* @param completion The completion method to be called when the result
|
||||
* should be forwarded.
|
||||
@@ -79,11 +79,11 @@ export class DelayInterceptor implements HttpInterceptor {
|
||||
var slowdown = this.delay - elapsed;
|
||||
this.consoleService.log("Delaying data for " + slowdown + "ms.");
|
||||
var delayedRequest: Subject<HttpEvent<any>> = new Subject<HttpEvent<any>>();
|
||||
setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
this.consoleService.log("Forwarding delayed data.");
|
||||
completion();
|
||||
}, slowdown);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="shortcut icon" href="assets/img/favicon.png">
|
||||
<title>CoreUI - Open Source Bootstrap Admin Template</title>
|
||||
<title>Maptology</title>
|
||||
</head>
|
||||
|
||||
<!-- BODY options, add following classes to body to change options
|
||||
|
||||
Reference in New Issue
Block a user