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
Show whitespace changes
Inline
Side-by-side
src/app/mgmt/mgmt.component.html
View file @
b717a992
<div
*ngIf=
"userService.loggedIn"
>
<div>
<h4>
Services
</h4>
<div
*ngIf=
"userService.services.length > 0"
>
<mat-accordion>
...
...
@@ -10,4 +11,13 @@
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>
src/app/snackbar.service.ts
View file @
b717a992
...
...
@@ -13,6 +13,7 @@ export class SnackBarService {
}
public
open
(
message
:
string
)
{
console
.
log
(
message
);
return
this
.
snackBar
.
open
(
message
,
''
,
this
.
config
);
}
}
src/app/user.service.ts
View file @
b717a992
...
...
@@ -72,22 +72,17 @@ export class UserService {
);
}
public
updateData
(
data
:
any
)
{
if
(
data
[
'
error
'
])
{
this
.
snackBar
.
open
(
data
[
'
error
'
]);
private
_handleValueChange
(
newData
:
any
)
{
}
if
(
!
this
.
services
)
{
this
.
services
=
data
.
services
;
}
this
.
user
=
data
.
user
;
private
_updateUserValues
(
newUser
:
any
)
{
this
.
user
=
newUser
;
if
(
this
.
user
)
{
// build sshKeyData
if
(
'
ssh_keys
'
in
this
.
user
)
{
this
.
sshKeyData
=
new
MatTableDataSource
(
this
.
user
.
ssh_keys
);
}
else
{
this
.
sshKeyData
=
null
;
this
.
sshKeyData
=
undefined
;
}
// build userInfoData
...
...
@@ -100,16 +95,41 @@ export class UserService {
this
.
userInfoData
=
new
MatTableDataSource
(
userInfoList
);
}
else
{
this
.
sshKeyData
=
null
;
this
.
userInfoData
=
null
;
this
.
sshKeyData
=
undefined
;
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
'
);
// TODO dirty
this
.
connectLiveUpdates
()
}
this
.
loggedIn
=
data
.
logged_in
;
if
(
logout
)
{
this
.
snackBar
.
open
(
'
Logged out
'
);
this
.
_stompService
.
disconnect
();
// reset some attributes
this
.
services
=
[];
}
}
public
updateState
()
{
...
...
@@ -185,7 +205,7 @@ export class UserService {
};
return
this
.
http
.
post
(
'
/backend/api/deployments/
'
,
body
).
subscribe
(
(
data
)
=>
{
this
.
snackBar
.
open
(
'
Deployed key
'
+
key
.
name
);
//
this.snackBar.open('Deployed key ' + key.name);
this
.
updateData
(
data
);
},
(
err
)
=>
{
...
...
@@ -205,7 +225,7 @@ export class UserService {
return
this
.
http
.
post
(
'
/backend/api/deployments/
'
,
body
).
subscribe
(
(
data
)
=>
{
this
.
snackBar
.
open
(
'
Withdrew key
'
+
key
.
name
);
//
this.snackBar.open('Withdrew key ' + key.name);
this
.
updateData
(
data
);
},
(
err
)
=>
{
...
...
@@ -256,7 +276,7 @@ export class UserService {
reconnect_delay
:
5000
,
// Will log diagnostics on console
debug
:
true
debug
:
false
,
};
this
.
_stompService
.
config
=
stompConfig
;
this
.
_stompService
.
initAndConnect
();
...
...
@@ -270,13 +290,14 @@ export class UserService {
subscription
.
map
((
message
:
Message
)
=>
{
return
message
.
body
;
}).
subscribe
((
msg_body
:
string
)
=>
{
this
.
snackBar
.
open
(
'
Backend:
'
+
msg_body
);
console
.
log
(
`Received:
${
msg_body
}
`
);
}).
subscribe
((
body
:
any
)
=>
{
let
json
=
JSON
.
parse
(
body
);
if
(
json
.
message
&&
json
.
message
!=
''
)
{
this
.
snackBar
.
open
(
json
.
message
);
}
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