Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ docker-push:
docker push onepanel/core-ui:$(COMMIT_HASH)

docker-custom:
docker build -t onepanel-core-ui .
docker build -t onepanel-core-ui . --build-arg VERSION=$(VERSION)
docker tag onepanel-core-ui:latest onepanel/core-ui:$(TAG)
docker push onepanel/core-ui:$(TAG)

Expand Down
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"browserTarget": "onepanel-core-ui:build:production"
},
"local": {
"browserTarget": "onepanel-core-ui:build:local",
"browserTarget": "onepanel-core-ui:build:local"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<app-navbar
*ngIf="!loggingIn && showNavigationBar"
[version]="version"
[activeUrl]="activeUrl"
(logout)="logout()"
(namespaceClick)="onFormFieldClick()">
Expand Down
7 changes: 7 additions & 0 deletions src/app/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Injectable } from '@angular/core';
import { environment } from '../../environments/environment';

@Injectable({
providedIn: 'root'
Expand Down Expand Up @@ -45,6 +46,12 @@ export class AuthService {
}

setLogin(username: string, token: string, domain?: string) {
// When using a local environment, we don't want the domain set as we could be connected to a live running server
// on it's domain. This causes issues with cookies, so we don't set a domain when running locally.
if (environment.type === 'local') {
domain = undefined;
}

localStorage.setItem('auth-token', token);
localStorage.setItem('auth-username', username);
if (domain) {
Expand Down
28 changes: 14 additions & 14 deletions src/app/auth/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ export class LoginComponent implements OnInit {
token: this.tokenInput.value,
username: this.usernameInput.value
}).subscribe(res => {
this.authService.setLogin(this.usernameInput.value, res.token, res.domain);
this.authService.setLogin(this.usernameInput.value, res.token, res.domain);

this.namespaceTracker.getNamespaces();
this.namespaceTracker.getNamespaces();

if (this.authService.redirectUrl) {
this.appRouter.navigateByUrl(this.authService.redirectUrl);
this.authService.redirectUrl = null;
this.loggingIn = false;
return;
}

this.appRouter.navigateToHomePage();
this.loggingIn = false;
}, err => {
this.tokenInput.setErrors({error: 'Invalid token'});
if (this.authService.redirectUrl) {
this.appRouter.navigateByUrl(this.authService.redirectUrl);
this.authService.redirectUrl = null;
this.loggingIn = false;
});
return;
}

this.appRouter.navigateToHomePage();
this.loggingIn = false;
}, err => {
this.tokenInput.setErrors({error: 'Invalid token'});
this.loggingIn = false;
});
}
}
Empty file.
3 changes: 2 additions & 1 deletion src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const environment = {
production: true,
type: 'production',
baseUrl: '<baseUrl>',
baseWsUrl: '<baseWSurl>',
version: "1.0.0"
version: '1.0.0'
};
5 changes: 3 additions & 2 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

export const environment = {
production: false,
type: 'local',
baseUrl: 'http://localhost:8888',
baseWsUrl: 'ws://localhost:8888',
version: "1.0.0"
version: 'development'
};

/*
Expand All @@ -16,4 +17,4 @@ export const environment = {
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
import 'zone.js/dist/zone-error'; // Included with Angular CLI.