Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalWebpage
Commits
b717a992
Commit
b717a992
authored
Apr 27, 2018
by
Lukas Burgey
Browse files
Add listing of unfinished tasks
parent
c418b031
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/app/mgmt/mgmt.component.html
View file @
b717a992
<div
*ngIf=
"userService.loggedIn"
>
<div
*ngIf=
"userService.loggedIn"
>
<h4>
Services
</h4>
<div>
<div
*ngIf=
"userService.services.length > 0"
>
<h4>
Services
</h4>
<mat-accordion>
<div
*ngIf=
"userService.services.length > 0"
>
<app-service
*ngFor=
"let service of userService.services"
<mat-accordion>
[serviceData]=
"service"
></app-service>
<app-service
*ngFor=
"let service of userService.services"
</mat-accordion>
[serviceData]=
"service"
></app-service>
</mat-accordion>
</div>
<p
*ngIf=
"userService.services?.length == 0"
>
You have no available services.
<br/>
This is due services requiring users to be member of a certain group.
</p>
</div>
<div
*ngIf=
"userService.user.deployment_tasks.length > 0"
>
<h4>
Uncompleted tasks
</h4>
<div>
<p
*ngFor=
"let task of userService.user.deployment_tasks"
>
{{ task.action }}: {{ task.key }}
</p>
</div>
</div>
</div>
<p
*ngIf=
"userService.services?.length == 0"
>
You have no available services.
<br/>
This is due services requiring users to be member of a certain group.
</p>
</div>
</div>
src/app/snackbar.service.ts
View file @
b717a992
...
@@ -13,6 +13,7 @@ export class SnackBarService {
...
@@ -13,6 +13,7 @@ export class SnackBarService {
}
}
public
open
(
message
:
string
)
{
public
open
(
message
:
string
)
{
console
.
log
(
message
);
return
this
.
snackBar
.
open
(
message
,
''
,
this
.
config
);
return
this
.
snackBar
.
open
(
message
,
''
,
this
.
config
);
}
}
}
}
src/app/user.service.ts
View file @
b717a992
...
@@ -72,22 +72,17 @@ export class UserService {
...
@@ -72,22 +72,17 @@ export class UserService {
);
);
}
}
public
updateData
(
data
:
any
)
{
private
_handleValueChange
(
newData
:
any
)
{
if
(
data
[
'
error
'
])
{
}
this
.
snackBar
.
open
(
data
[
'
error
'
]);
}
if
(
!
this
.
services
)
{
this
.
services
=
data
.
services
;
}
this
.
user
=
data
.
user
;
private
_updateUserValues
(
newUser
:
any
)
{
this
.
user
=
newUser
;
if
(
this
.
user
)
{
if
(
this
.
user
)
{
// build sshKeyData
// build sshKeyData
if
(
'
ssh_keys
'
in
this
.
user
)
{
if
(
'
ssh_keys
'
in
this
.
user
)
{
this
.
sshKeyData
=
new
MatTableDataSource
(
this
.
user
.
ssh_keys
);
this
.
sshKeyData
=
new
MatTableDataSource
(
this
.
user
.
ssh_keys
);
}
else
{
}
else
{
this
.
sshKeyData
=
null
;
this
.
sshKeyData
=
undefined
;
}
}
// build userInfoData
// build userInfoData
...
@@ -100,16 +95,41 @@ export class UserService {
...
@@ -100,16 +95,41 @@ export class UserService {
this
.
userInfoData
=
new
MatTableDataSource
(
userInfoList
);
this
.
userInfoData
=
new
MatTableDataSource
(
userInfoList
);
}
else
{
}
else
{
this
.
sshKeyData
=
null
;
this
.
sshKeyData
=
undefined
;
this
.
userInfoData
=
null
;
this
.
userInfoData
=
undefined
;
}
}
}
public
updateData
(
newData
:
any
)
{
// did a login occur?
let
login
=
(
!
this
.
loggedIn
&&
newData
.
logged_in
);
// did a logout occur?
let
logout
=
(
this
.
loggedIn
&&
!
newData
.
logged_in
);
if
(
!
this
.
loggedIn
&&
data
.
logged_in
)
{
// report an occured error
if
(
newData
.
error
)
{
this
.
snackBar
.
open
(
newData
.
error
);
}
// -- Value updating --
this
.
loggedIn
=
newData
.
logged_in
;
// this check is needed because the accordeon collapses if we overwrite the list
if
(
!
this
.
services
)
{
this
.
services
=
newData
.
services
;
}
this
.
_updateUserValues
(
newData
.
user
);
if
(
login
)
{
this
.
snackBar
.
open
(
'
Logged in
'
);
this
.
snackBar
.
open
(
'
Logged in
'
);
// TODO dirty
this
.
connectLiveUpdates
()
this
.
connectLiveUpdates
()
}
}
this
.
loggedIn
=
data
.
logged_in
;
if
(
logout
)
{
this
.
snackBar
.
open
(
'
Logged out
'
);
this
.
_stompService
.
disconnect
();
// reset some attributes
this
.
services
=
[];
}
}
}
public
updateState
()
{
public
updateState
()
{
...
@@ -185,7 +205,7 @@ export class UserService {
...
@@ -185,7 +205,7 @@ export class UserService {
};
};
return
this
.
http
.
post
(
'
/backend/api/deployments/
'
,
body
).
subscribe
(
return
this
.
http
.
post
(
'
/backend/api/deployments/
'
,
body
).
subscribe
(
(
data
)
=>
{
(
data
)
=>
{
this
.
snackBar
.
open
(
'
Deployed key
'
+
key
.
name
);
//
this.snackBar.open('Deployed key ' + key.name);
this
.
updateData
(
data
);
this
.
updateData
(
data
);
},
},
(
err
)
=>
{
(
err
)
=>
{
...
@@ -205,7 +225,7 @@ export class UserService {
...
@@ -205,7 +225,7 @@ export class UserService {
return
this
.
http
.
post
(
'
/backend/api/deployments/
'
,
body
).
subscribe
(
return
this
.
http
.
post
(
'
/backend/api/deployments/
'
,
body
).
subscribe
(
(
data
)
=>
{
(
data
)
=>
{
this
.
snackBar
.
open
(
'
Withdrew key
'
+
key
.
name
);
//
this.snackBar.open('Withdrew key ' + key.name);
this
.
updateData
(
data
);
this
.
updateData
(
data
);
},
},
(
err
)
=>
{
(
err
)
=>
{
...
@@ -256,7 +276,7 @@ export class UserService {
...
@@ -256,7 +276,7 @@ export class UserService {
reconnect_delay
:
5000
,
reconnect_delay
:
5000
,
// Will log diagnostics on console
// Will log diagnostics on console
debug
:
true
debug
:
false
,
};
};
this
.
_stompService
.
config
=
stompConfig
;
this
.
_stompService
.
config
=
stompConfig
;
this
.
_stompService
.
initAndConnect
();
this
.
_stompService
.
initAndConnect
();
...
@@ -270,13 +290,14 @@ export class UserService {
...
@@ -270,13 +290,14 @@ export class UserService {
subscription
.
map
((
message
:
Message
)
=>
{
subscription
.
map
((
message
:
Message
)
=>
{
return
message
.
body
;
return
message
.
body
;
}).
subscribe
((
msg_body
:
string
)
=>
{
}).
subscribe
((
body
:
any
)
=>
{
this
.
snackBar
.
open
(
let
json
=
JSON
.
parse
(
body
);
'
Backend:
'
+
msg_body
if
(
json
.
message
&&
json
.
message
!=
''
)
{
);
this
.
snackBar
.
open
(
json
.
message
);
console
.
log
(
`Received:
${
msg_body
}
`
);
}
if
(
json
.
user_state
)
{
this
.
_updateUserValues
(
json
.
user_state
);
}
});
});
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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