Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalWebpage
Commits
231b0bd8
Commit
231b0bd8
authored
Mar 06, 2018
by
Lukas Burgey
Browse files
Move interfaces from user.service into a separate module
parent
ac5aae35
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/app/types/types.module.ts
0 → 100644
View file @
231b0bd8
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
{
}
src/app/user.service.ts
View file @
231b0bd8
...
...
@@ -11,52 +11,7 @@ import { MatTableDataSource } from '@angular/material';
import
{
SnackBarService
}
from
'
./snackbar.service
'
;
import
{
environment
}
from
'
../environments/environment
'
;
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
;
}
import
{
User
,
Service
,
AuthInfo
,
UserState
}
from
'
./types/types.module
'
;
@
Injectable
()
...
...
@@ -129,7 +84,8 @@ export class UserService {
this
.
userInfoData
=
null
;
}
// this.logState();
// FIXME remove
this
.
logState
();
}
public
getAuthInfo
()
{
...
...
@@ -147,7 +103,7 @@ export class UserService {
this
.
http
.
get
(
'
/backend/api/state/
'
)
.
subscribe
(
(
data
:
State
APIUser
)
=>
{
(
data
:
User
State
)
=>
{
this
.
updateData
(
data
);
},
(
err
:
HttpErrorResponse
)
=>
{
...
...
@@ -191,10 +147,10 @@ export class UserService {
);
}
public
removeSshKey
(
name
:
string
)
{
public
removeSshKey
(
id
:
string
)
{
const
body
=
{
'
type
'
:
'
remove
'
,
'
name
'
:
name
,
'
id
'
:
id
,
};
return
this
.
http
.
post
(
'
/backend/api/sshkey/
'
,
body
).
subscribe
(
(
data
)
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment