Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
99698ee3
Commit
99698ee3
authored
Jun 30, 2016
by
joansp
Browse files
Machines Status notifications
parent
db21ee1b
Changes
5
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
99698ee3
...
...
@@ -406,19 +406,19 @@ Returns a list of ruquests : ( id , domain_name, status, error )
sub
list_requests
{
my
$self
=
shift
;
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
("
SELECT id,
args
, status, error
"
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
("
SELECT id,
command, args, date_changed
, status, error
"
.
"
FROM requests
"
.
"
WHERE status <> 'done'
"
.
"
ORDER BY date_changed DESC LIMIT 4
"
);
$sth
->
execute
;
my
@reqs
;
my
(
$id
,
$
j_args
,
$status
,
$error
);
$sth
->
bind_columns
(
\
(
$id
,
$
j_args
,
$status
,
$error
));
my
(
$id
,
$
command
,
$j_args
,
$date_changed
,
$status
,
$error
);
$sth
->
bind_columns
(
\
(
$id
,
$
command
,
$j_args
,
$date_changed
,
$status
,
$error
));
while
(
$sth
->
fetch
)
{
my
$args
=
decode_json
(
$j_args
)
if
$j_args
;
push
@reqs
,{
id
=>
$id
,
status
=>
$status
,
error
=>
$error
,
name
=>
$args
->
{
name
}};
push
@reqs
,{
id
=>
$id
,
command
=>
$command
,
date_changed
=>
$date_changed
,
status
=>
$status
,
error
=>
$error
,
name
=>
$args
->
{
name
}};
}
$sth
->
finish
;
return
\
@reqs
;
...
...
public/js/ravada.js
View file @
99698ee3
...
...
@@ -5,6 +5,7 @@
.
directive
(
"
solShowNewmachine
"
,
swNewMach
)
.
directive
(
"
solShowListmachines
"
,
swListMach
)
.
directive
(
"
solShowCardsmachines
"
,
swCardsMach
)
.
directive
(
"
solShowMachinesNotifications
"
,
swMachNotif
)
.
service
(
"
request
"
,
gtRequest
)
.
service
(
"
listMach
"
,
gtListMach
)
.
controller
(
"
new_machine
"
,
newMachineCtrl
)
...
...
@@ -89,6 +90,13 @@
};
function
swMachNotif
()
{
return
{
restrict
:
"
E
"
,
templateUrl
:
'
/templates/machines_notif.html
'
,
};
}
function
gtRequest
(
$resource
){
return
$resource
(
'
/requests.json
'
,{},{
...
...
public/templates/list_machines.html
View file @
99698ee3
<div
class=
"panel-body"
>
<div
class=
"col-lg-12"
>
<table
class=
"table table-striped"
>
...
...
@@ -6,7 +7,8 @@
<th>
Machine Name
</th>
<th>
Base
</th>
<th>
Active
</th>
<th
colspan=
"2"
>
Actions
</th>
<th>
Actions
</th>
</tr>
</thead>
<tbody>
...
...
@@ -17,11 +19,13 @@
<td><a
class=
"btn btn-primary btn-sm"
href=
"/machine/view/{{machine.id}}.html"
>
View
</a>
<a
ng-show=
"{{machine.is_base}}"
class=
"btn btn-primary btn-sm"
href=
"/machine/clone/{{machine.id}}.html"
>
Clone
</a>
<a
ng-show=
"{{!machine.is_base}}"
class=
"btn btn-primary btn-sm"
href=
"/machine/prepare/{{machine.id}}.html"
>
Prepare Base
</a>
<a
ng-show=
"{{machine.is_active}}"
class=
"btn btn-warning btn-sm"
href=
"/machine/shutdown/{{machine.id}}.html"
><strong>
<i
class=
"fa fa-power-off"
aria-hidden=
"true"
></i></strong>
ShutDown
</a>
<a
class=
"btn btn-danger btn-sm"
href=
"/machine/remove/{{machine.id}}.html"
>
Delete
</a>
</td>
<td><a
class=
"btn btn-danger btn-sm"
href=
"/machine/remove/{{machine.id}}.html"
>
X
</a></td>
</tr>
</tbody>
</table>
</table>
</div>
</div>
public/templates/machines_notif.html
0 → 100644
View file @
99698ee3
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h4
class=
"panel-title"
>
Machines Notifications
<a
style=
"float: right;"
data-toggle=
"collapse"
href=
"#collapse1"
><i
class=
"fa fa-angle-double-up"
aria-hidden=
"true"
></i></a>
</h4>
</div>
<div
id=
"collapse1"
class=
"panel-collapse collapse in"
>
<div
class=
"panel-body"
>
<ul
style=
"padding: 25px; list-style: none"
>
<li
ng-repeat=
"request in res"
>
<div
ng-show=
"request.error != ''"
class=
"alert alert-danger fade in"
>
<strong>
Machine {{request.name}} -> {{request.command}}:
</strong>
Error: {{request.error}} {{request.date_changed | date:'MM/dd/yyyy @ h:mma'}}
</div>
<div
ng-show=
"request.error == ''"
class=
"alert alert-success fade in"
>
<strong>
Machine {{request.name}} -> {{request.command}}:
</strong>
Status: {{request.status}} {{request.date_changed | date:'MM/dd/yyyy @ h:mma'}}
</div>
</li>
</ul>
</div>
</div>
</div>
templates/bootstrap/machines.html.ep
View file @
99698ee3
...
...
@@ -10,12 +10,17 @@
<div
ng-controller=
"machines"
>
<div
class=
"page-header"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h2>
Machines List
<button
id=
"newMButton"
style=
"float: right;"
class=
"btn btn-success"
>
New Machine
</button></h2>
</div>
<sol-show-listmachines></sol-show-listmachines>
</div>
<div
class=
"panel-heading"
>
<h2>
Machines List
<button
id=
"newMButton"
style=
"float: right;"
class=
"btn btn-success"
>
New Machine
</button></h2>
</div>
<sol-show-listmachines></sol-show-listmachines>
</div>
</div>
<div
class=
"page-header"
>
<sol-show-machines-notifications></sol-show-machines-notifications>
</div>
</div>
<div
ng-controller=
"new_machine"
>
...
...
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