Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
e4481bd1
Commit
e4481bd1
authored
Jan 16, 2020
by
Francesc Guasch
Browse files
fix(frontend): only refresh screenshot when action mode
issue #1228
parent
8348ebf1
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/js/ravada.js
View file @
e4481bd1
...
...
@@ -93,15 +93,14 @@
var
toGet
=
'
/machine/remove/
'
+
machineId
+
'
.html?sure=yes
'
;
$http
.
get
(
toGet
);
};
$scope
.
action
=
function
(
machine
Id
,
action
)
{
$scope
.
refresh
=
2
;
$scope
.
action
=
function
(
machine
,
action
)
{
machine
.
action
=
false
;
if
(
action
==
'
restore
'
)
{
$scope
.
host_restore
=
machine
Id
;
$scope
.
host_restore
=
machine
.
id_clone
;
$scope
.
host_shutdown
=
0
;
}
else
if
(
action
==
'
shutdown
'
||
action
==
'
hibernate
'
)
{
$scope
.
host_restore
=
0
;
$scope
.
host_action
=
-
1
;
$http
.
get
(
'
/machine/
'
+
action
+
'
/
'
+
machineId
+
'
.json
'
);
$http
.
get
(
'
/machine/
'
+
action
+
'
/
'
+
machine
.
id_clone
+
'
.json
'
);
}
else
{
alert
(
"
unknown action
"
+
action
);
}
...
...
@@ -115,6 +114,7 @@
},
60
*
1000
);
$scope
.
subscribe_list_machines_user
=
function
(
url
)
{
$scope
.
machines
=
[];
var
channel
=
'
list_machines_user
'
;
if
(
$scope
.
anonymous
)
{
channel
=
'
list_bases_anonymous
'
;
...
...
@@ -128,11 +128,15 @@
ws
.
onmessage
=
function
(
event
)
{
var
data
=
JSON
.
parse
(
event
.
data
);
$scope
.
$apply
(
function
()
{
$scope
.
machines
=
data
;
$scope
.
public_bases
=
0
;
$scope
.
private_bases
=
0
;
for
(
var
i
=
0
;
i
<
$scope
.
machines
.
length
;
i
++
)
{
if
(
$scope
.
machines
[
i
].
is_public
==
1
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
!
$scope
.
machines
[
i
]
||
!
$scope
.
machines
[
i
].
action
)
{
$scope
.
machines
[
i
]
=
data
[
i
];
}
else
{
$scope
.
machines
[
i
].
screenshot
=
data
[
i
].
screenshot
;
}
if
(
data
[
i
].
is_public
==
1
)
{
$scope
.
public_bases
++
;
}
else
{
$scope
.
private_bases
++
;
...
...
@@ -162,8 +166,6 @@
$scope
.
only_public
=
!
$scope
.
only_public
;
};
$scope
.
startIntro
=
startIntro
;
$scope
.
host_action
=
0
;
$scope
.
refresh
=
0
;
};
function
singleMachinePageC
(
$scope
,
$http
,
$interval
,
request
,
$location
)
{
...
...
templates/main/list_bases_ng.html.ep
View file @
e4481bd1
...
...
@@ -32,29 +32,29 @@
width=
"260"
></a>
</div>
<div
class=
"card-body"
id=
"step2"
>
<a
type=
"button"
class=
"btn btn-success"
ng-hide=
"
host_action ==
machine.
id
"
<a
type=
"button"
class=
"btn btn-success"
ng-hide=
"machine.
action
"
href=
"/machine/clone/{{machine.id}}.html"
><strong><i
class=
"fa fa-play"
aria-hidden=
"true"
></i>
<
%=
l
'
Start
'
%
></strong></a>
<a
type=
"button"
class=
"btn btn-danger text-white"
ng-show=
"machine.id_clone && !machine.is_active && machine.can_remove"
ng-click=
"host_restore=machine.id_clone;
$parent.refresh=20
"
ng-show=
"machine.id_clone && !machine.is_active && machine.can_remove
&& !host_restore
"
ng-click=
"host_restore=machine.id_clone;
machine.action=true
"
><strong><i
class=
"fas fa-redo"
aria-hidden=
"true"
></i>
<
%=
l
'
Restore
'
%
></strong></a>
<div
ng-show=
"machine.id_clone && host_restore == machine.id_clone"
>
<b><
%=
l
'
Restore
'
%
></b>
<
%=
l
'
will
remove
all
the
contents
of
the
machine
'
%
>
<i><b>
{{machine.name_clone}}
</b></i>
.
<
%=
l
'
Are
you
sure
?'
%
><br/>
<a
type=
"button"
class=
"btn btn-primary text-white"
ng-click=
"host_restore=0;
host_
action=
0
"
ng-click=
"host_restore=0;
machine.
action=
false
"
><
%=
l
'
No
'
%
></a>
<a
type=
"button"
class=
"btn btn-danger text-white"
ng-click=
"restore(machine.id_clone);host_restore=0;
host_
action=
0
"
ng-click=
"restore(machine.id_clone);host_restore=0;
machine.
action=
false
"
><
%=
l
'
Yes
'
%
></a>
</div>
<a
ng-show=
"machine.is_active &&
host_action !=
machine.
id
"
<a
ng-show=
"machine.is_active &&
!
machine.
action
"
class=
"btn btn-light"
ng-click=
"
host_action=machine.id
;$parent.refresh=20"
ng-click=
"
machine.action=true
;$parent.refresh=20"
type=
"button"
><
%=
l
'
action
'%
></a>
<div
class=
"btn-group"
ng-show=
"
host_action ==
machine.
id
&& !host_restore"
ng-show=
"machine.
action
&& !host_restore"
>
<a
type=
"button"
class=
"btn btn-light btn-sm"
ng-show=
"machine.can_remove"
...
...
@@ -63,21 +63,21 @@
<a
ng-show=
"machine.is_active"
type=
"button"
class=
"btn btn-light btn-sm"
ng-click=
"action(machine
.id_clone
,'shutdown')
;host_action=-1
"
ng-click=
"
machine.action=false;
action(machine,'shutdown')"
><
%=
l
'
Shutdown
'%
></a>
<a
ng-show=
"machine.is_active && machine.can_hibernate"
type=
"button"
class=
"btn btn-light btn-sm"
ng-click=
"action(machine
.id_clone
,'hibernate')
;host_action=-1
"
ng-click=
"
machine.action=false;
action(machine,'hibernate')"
><
%=
l
'
Hibernate
'
%
></a>
<a
ng-click=
"
host_
action=
0
"
ng-click=
"
machine.
action=
false
"
><i
class=
"align-bottom fas fa-chevron-circle-left"
></i></a>
</div>
% if ($user
%
&&
( $user->can_change_settings || $user->can_change_settings_all)){
<a
ng-show=
"machine.id_clone && (
host_action !=
machine.
id
&& host_restore != machine.id_clone)"
<a
ng-show=
"machine.id_clone && (machine.
action
&& host_restore != machine.id_clone)"
align=
"right"
href=
"/machine/manage/{{machine.id_clone}}.html"
><i
class=
"fa fa-fw fa-cog"
title=
"<%=l 'Settings' %>"
></i></a>
% }
...
...
Write
Preview
Supports
Markdown
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