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
93643237
Commit
93643237
authored
Feb 15, 2021
by
Roberto P. Rubio
Browse files
Adds machine start confirmation on list-machines if limit per user reached
parent
665abd05
Changes
3
Hide whitespace changes
Inline
Side-by-side
public/js/ravada.js
View file @
93643237
...
...
@@ -97,9 +97,41 @@
);
};
$scope
.
action
=
function
(
machine
,
action
)
{
$scope
.
confirmingMachineStopOnNewMachineStartData
=
null
;
$scope
.
confirmingMachineStopOnNewMachineStartDataCancelled
=
function
()
{
$scope
.
confirmingMachineStopOnNewMachineStartData
=
null
;
};
$scope
.
confirmingMachineStopOnNewMachineStartDataDone
=
function
()
{
$scope
.
action
(
$scope
.
confirmingMachineStopOnNewMachineStartData
.
machine
,
$scope
.
confirmingMachineStopOnNewMachineStartData
.
action
,
true
);
$scope
.
confirmingMachineStopOnNewMachineStartData
=
null
;
};
$scope
.
checkExecutionMachineLimits
=
function
(
action
,
machine
)
{
$http
.
get
(
'
/execution_machines_limit
'
)
.
then
(
function
(
data
)
{
if
((
data
.
data
.
can_start_many
)
||
(
data
.
data
.
running_domains
.
indexOf
(
machine
.
id
)
>=
0
)
||
(
data
.
data
.
start_limit
>
data
.
data
.
running_domains
.
length
))
{
$scope
.
action
(
machine
,
action
,
true
);
}
else
{
$scope
.
confirmingMachineStopOnNewMachineStartData
=
{
action
:
action
,
machine
:
machine
};
}
},
function
(
data
,
status
)
{
console
.
error
(
'
Repos error
'
,
status
,
data
);
window
.
location
.
reload
();
});
};
$scope
.
action
=
function
(
machine
,
action
,
confirmed
)
{
machine
.
action
=
false
;
if
(
action
==
'
restore
'
)
{
if
(
action
==
'
start
'
)
{
if
(
!
confirmed
)
{
$scope
.
checkExecutionMachineLimits
(
action
,
machine
);
}
else
{
window
.
location
.
assign
(
'
/machine/clone/
'
+
machine
.
id
+
'
.html
'
);
}
}
else
if
(
action
==
'
restore
'
)
{
$scope
.
host_restore
=
machine
.
id_clone
;
$scope
.
host_shutdown
=
0
;
$scope
.
host_force_shutdown
=
0
;
...
...
templates/main/list_bases_ng.html.ep
View file @
93643237
...
...
@@ -38,9 +38,22 @@
</div>
</div>
<div
class=
"card-body"
id=
"step2"
>
<div
ng-show=
"(confirmingMachineStopOnNewMachineStartData) && (confirmingMachineStopOnNewMachineStartData.action === 'start')"
class=
"row alert alert-warning"
role=
"alert"
>
<div>
<span><
%=
l
'
One
of
the
machines
that
are
currently
running
will
be
shutdown.
'
%
></span>
<br>
<span><
%=
l
'
Continue
?'
%
></span>
<br>
</div>
<div
class=
"pull-right"
>
<input
type=
"button"
class=
"btn btn-danger btn-xs"
value=
"<%=l 'Yes' %>"
ng-click=
"confirmingMachineStopOnNewMachineStartDataDone()"
>
<input
type=
"button"
class=
"btn btn-primary btn-xs"
value=
"<%=l 'No' %>"
ng-click=
"confirmingMachineStopOnNewMachineStartDataCancelled()"
>
</div>
<br>
</div>
<div
class=
"row"
>
<a
type=
"button"
class=
"btn btn-success mr-2"
ng-hide=
"machine.action"
href=
"/machine/clone/{{machine.id}}.html
"
><strong><i
class=
"fa fa-play"
aria-hidden=
"true"
></i>
<
%=
l
'
Start
'
%
></strong></a>
ng-click=
"action(machine,'start')
"
><strong><i
class=
"fa fa-play"
aria-hidden=
"true"
></i>
<
%=
l
'
Start
'
%
></strong></a>
<div
class=
"dropdown"
>
<button
ng-show=
"machine.is_active && !machine.action"
class=
"btn btn-secondary dropdown-toggle"
ng-click=
"$parent.refresh=20"
type=
"button"
id=
"dropdownMenuButton"
...
...
templates/main/vm_actions.html.ep
View file @
93643237
...
...
@@ -11,10 +11,12 @@
</div>
<div ng-show="(confirmingMachineStopOnNewMachineStartData) && (confirmingMachineStopOnNewMachineStartData.action === 'start')" class="alert alert-warning" role="alert">
<span><%=l 'One of the machines that are currently running will be shutdown.' %></span>
<br>
<span><%=l 'Continue?' %></span>
<br>
<div>
<span><%=l 'One of the machines that are currently running will be shutdown.' %></span>
<br>
<span><%=l 'Continue?' %></span>
<br>
</div>
<div class="pull-right">
<input type="button" class="btn btn-danger btn-xs" value="<%=l 'Yes' %>" ng-click="confirmingMachineStopOnNewMachineStartDataDone()">
<input type="button" class="btn btn-primary btn-xs" value="<%=l 'No' %>" ng-click="confirmingMachineStopOnNewMachineStartDataCancelled()">
...
...
@@ -33,10 +35,12 @@
</div>
<div type="warning" ng-show="(confirmingMachineStopOnNewMachineStartData) && (confirmingMachineStopOnNewMachineStartData.action === 'view')" class="alert alert-warning" role="alert">
<span><%=l 'One of the machines that are currently running will be shutdown.' %></span>
<br>
<span><%=l 'Continue?' %></span>
<br>
<div>
<span><%=l 'One of the machines that are currently running will be shutdown.' %></span>
<br>
<span><%=l 'Continue?' %></span>
<br>
</div>
<div class="pull-right">
<input type="button" class="btn btn-primary btn-xs" value="<%=l 'Yes' %>" ng-click="confirmingMachineStopOnNewMachineStartDataDone()">
<input type="button" class="btn btn-primary btn-xs" value="<%=l 'No' %>" ng-click="confirmingMachineStopOnNewMachineStartDataCancelled()">
...
...
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