Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
feudalWebpage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
feudal
feudalWebpage
Commits
b717a992
Commit
b717a992
authored
Apr 27, 2018
by
Lukas Burgey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add listing of unfinished tasks
parent
c418b031
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
35 deletions
+67
-35
src/app/mgmt/mgmt.component.html
src/app/mgmt/mgmt.component.html
+20
-10
src/app/snackbar.service.ts
src/app/snackbar.service.ts
+1
-0
src/app/user.service.ts
src/app/user.service.ts
+46
-25
No files found.
src/app/mgmt/mgmt.component.html
View file @
b717a992
<div
*ngIf=
"userService.loggedIn"
>
<h4>
Services
</h4>
<div
*ngIf=
"userService.services.length > 0"
>
<mat-accordion>
<app-service
*ngFor=
"let service of userService.services"
[serviceData]=
"service"
></app-service>
</mat-accordion>
<div>
<h4>
Services
</h4>
<div
*ngIf=
"userService.services.length > 0"
>
<mat-accordion>
<app-service
*ngFor=
"let service of userService.services"
[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>
<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>
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
'
]);
}
if
(
!
this
.
services
)
{
this
.
services
=
data
.
services
;
}
this
.
user
=
data
.
user
;
private
_handleValueChange
(
newData
:
any
)
{
}
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