Commit 231b0bd8 authored by Lukas Burgey's avatar Lukas Burgey

Move interfaces from user.service into a separate module

parent ac5aae35
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
interface IdP {
id: string;
name: string;
}
export interface AuthInfo {
idps: IdP[];
default: number;
}
interface Group {
name: string;
}
interface SSHKey {
id: string;
name: string;
key: string;
}
export interface Service {
name: string;
}
interface Deployment {
service: Service;
ssh_keys: SSHKey[];
}
export interface User {
email: string;
userinfo: any;
ssh_keys: SSHKey[];
deployments: Deployment[];
}
export interface UserState {
services: Service[];
logged_in: boolean;
user: User;
}
@NgModule({
imports: [
CommonModule
],
declarations: [
]
})
export class TypesModule { }
...@@ -11,52 +11,7 @@ import { MatTableDataSource } from '@angular/material'; ...@@ -11,52 +11,7 @@ import { MatTableDataSource } from '@angular/material';
import { SnackBarService } from './snackbar.service'; import { SnackBarService } from './snackbar.service';
import { environment } from '../environments/environment'; import { environment } from '../environments/environment';
import { User, Service, AuthInfo, UserState } from './types/types.module';
interface Group {
name: string;
}
interface SSHKey {
name: string;
key: string;
}
interface Service {
name: string;
}
interface Deployment {
service: Service;
ssh_keys: SSHKey[];
}
interface User {
email: string;
userinfo: any;
ssh_keys: SSHKey[];
deployments: Deployment[];
}
interface StateAPI {
services: Service[];
logged_in: boolean;
}
interface StateAPIUser {
services: Service[];
logged_in: boolean;
user: User;
}
interface IdP {
id: string;
name: string;
}
interface AuthInfo {
idps: IdP[];
default: number;
}
@Injectable() @Injectable()
...@@ -129,7 +84,8 @@ export class UserService { ...@@ -129,7 +84,8 @@ export class UserService {
this.userInfoData = null; this.userInfoData = null;
} }
// this.logState(); // FIXME remove
this.logState();
} }
public getAuthInfo() { public getAuthInfo() {
...@@ -147,7 +103,7 @@ export class UserService { ...@@ -147,7 +103,7 @@ export class UserService {
this.http this.http
.get('/backend/api/state/') .get('/backend/api/state/')
.subscribe( .subscribe(
(data: StateAPIUser) => { (data: UserState) => {
this.updateData(data); this.updateData(data);
}, },
(err: HttpErrorResponse) => { (err: HttpErrorResponse) => {
...@@ -191,10 +147,10 @@ export class UserService { ...@@ -191,10 +147,10 @@ export class UserService {
); );
} }
public removeSshKey(name: string) { public removeSshKey(id: string) {
const body = { const body = {
'type': 'remove', 'type': 'remove',
'name': name, 'id': id,
}; };
return this.http.post('/backend/api/sshkey/', body).subscribe( return this.http.post('/backend/api/sshkey/', body).subscribe(
(data) => { (data) => {
......
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