Skip to content

Commit

Permalink
Update auto-logout and fix breadcrumbs console error (kubernetes#5163)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Florek authored May 21, 2020
1 parent 1e2aa71 commit 36eeea5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
7 changes: 6 additions & 1 deletion aio/gulp/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,18 @@ export default {
enableSkipButton: argv.enableSkipButton !== undefined ?
argv.enableSkipButton :
false,

/**
* Allows to enable login view when serving on http.
*/
enableInsecureLogin: argv.enableInsecureLogin !== undefined ?
argv.enableInsecureLogin :
false,
/**
* Defines token time to live.
*/
tokenTTL: argv.tokenTTL !== undefined ?
argv.tokenTTL :
0,
},

/**
Expand Down
4 changes: 4 additions & 0 deletions aio/gulp/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ function getBackendArgs() {
args.push(`--apiserver-host=${conf.backend.apiServerHost}`);
}

if(conf.backend.tokenTTL) {
args.push(`--token-ttl=${conf.backend.tokenTTL}`);
}

return args;
}

Expand Down
7 changes: 4 additions & 3 deletions src/app/frontend/common/components/breadcrumbs/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ export class BreadcrumbsComponent implements OnInit {
const currentRoute = this._getCurrentRoute();
const url = this._router.url.includes('?') ? this._router.url.split('?')[0] : '';
let urlArray = url.split('/');
let routeParamsCount = currentRoute.routeConfig.data.routeParamsCount
? +currentRoute.routeConfig.data.routeParamsCount
: currentRoute.routeConfig.path.split('/').length;
let routeParamsCount =
currentRoute.routeConfig.data && currentRoute.routeConfig.data.routeParamsCount
? +currentRoute.routeConfig.data.routeParamsCount
: currentRoute.routeConfig.path.split('/').length;

this.breadcrumbs = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/frontend/error/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export class GlobalErrorHandler implements ErrorHandler {
private handleHTTPError_(error: HttpErrorResponse): void {
this.ngZone_.run(() => {
if (KdError.isError(error, ApiError.tokenExpired, ApiError.encryptionKeyChanged)) {
this.auth_.removeAuthCookies();
this.router_.navigate(['login'], {
state: {error: AsKdError(error)} as StateError,
});
this.auth_.removeAuthCookies();
return;
}

Expand Down

0 comments on commit 36eeea5

Please sign in to comment.