Commit cd4c9614 authored by Lukas Burgey's avatar Lukas Burgey

Fix some bugs concerning the initialization of the user service

parent 889f3187
......@@ -23,7 +23,7 @@ export class UserService {
public sshKeyData: MatTableDataSource<any>;
public userInfoData: MatTableDataSource<any>;
public services: Service[];
public messages: string[];
public messages: string[] = [];
constructor(
......@@ -32,8 +32,7 @@ export class UserService {
public snackBar: SnackBarService,
private _stompService: StompRService,
) {
this.update();
this.messages = [];
this.updateState();
}
public setIdPPreference(idp: IdP) {
......@@ -74,8 +73,6 @@ export class UserService {
);
}
private _handleValueChange(newData: any) {
}
private _updateUserValues(newUser: any) {
this.user = newUser;
......@@ -119,6 +116,7 @@ export class UserService {
if (!this.services) {
this.services = newData.services;
}
this._updateUserValues(newData.user);
if (login) {
......@@ -142,15 +140,15 @@ export class UserService {
this.updateData(data);
},
(err: HttpErrorResponse) => {
if (!this.services) {
this.services = [];
}
console.log('Error', err);
this.snackBar.open('Error receiving data from the server');
}
);
}
public update() {
this.updateState();
}
public login(idp: IdP) {
this.setIdPPreference(idp);
......@@ -177,7 +175,7 @@ export class UserService {
(err) => {
this.snackBar.open('Error uploading key');
console.log(err);
this.update();
this.updateState();
}
);
}
......@@ -194,7 +192,7 @@ export class UserService {
(err) => {
this.snackBar.open('Error deleting key');
console.log(err);
this.update();
this.updateState();
}
);
}
......@@ -213,7 +211,7 @@ export class UserService {
(err) => {
this.snackBar.open('Error deploying key ' + key.name);
console.log(err);
this.update();
this.updateState();
}
);
}
......@@ -233,7 +231,7 @@ export class UserService {
(err) => {
this.snackBar.open('Error withdrawing key ' + key.name);
console.log(err);
this.update();
this.updateState();
}
);
}
......@@ -249,7 +247,7 @@ export class UserService {
(err) => {
this.snackBar.open('Error uploading questionnaire');
console.log(err);
this.update();
this.updateState();
}
);
}
......@@ -263,7 +261,7 @@ export class UserService {
(err) => {
this.snackBar.open('Error deleting user from server');
console.log(err);
this.update();
this.updateState();
}
);
}
......@@ -321,7 +319,7 @@ export class UserService {
}
public taskItem(site, service): any {
if (site && service) {
if (this.user.deployment_task_items && site && service) {
for (const item of this.user.deployment_task_items){
if (item.site.id == site.id && item.service.id == service.id) {
return item;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment