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
388fa3fb
Commit
388fa3fb
authored
Feb 08, 2021
by
Roberto P. Rubio
Browse files
Confirms machine start if running machines limit reached (on admin machines)
parent
27c3c5ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
public/js/admin.js
View file @
388fa3fb
...
...
@@ -300,25 +300,59 @@ ravadaApp.directive("solShowMachine", swMach)
}
}
$scope
.
request
=
function
(
request
,
args
)
{
$http
.
post
(
'
/request/
'
+
request
+
'
/
'
,
JSON
.
stringify
(
args
)
).
then
(
function
(
response
)
{
$scope
.
request
=
function
(
request
,
args
)
{
$http
.
post
(
'
/request/
'
+
request
+
'
/
'
,
JSON
.
stringify
(
args
)
).
then
(
function
(
response
)
{
if
(
response
.
status
==
300
)
{
console
.
error
(
'
Response error
'
,
response
.
status
);
window
.
location
.
reload
();
}
});
};
});
};
$scope
.
action
=
function
(
target
,
action
,
machineId
){
$http
.
get
(
'
/
'
+
target
+
'
/
'
+
action
+
'
/
'
+
machineId
+
'
.json
'
)
.
then
(
function
(
response
)
{
if
(
response
.
status
==
300
)
{
console
.
error
(
'
Reponse error
'
,
response
.
status
);
window
.
location
.
reload
();
$scope
.
confirmingMachineStopOnNewMachineStartData
=
null
;
$scope
.
confirmingMachineStopOnNewMachineStartDataCancelled
=
function
()
{
$scope
.
confirmingMachineStopOnNewMachineStartData
=
null
;
};
$scope
.
confirmingMachineStopOnNewMachineStartDataDone
=
function
()
{
$scope
.
action
(
$scope
.
confirmingMachineStopOnNewMachineStartData
.
target
,
$scope
.
confirmingMachineStopOnNewMachineStartData
.
action
,
$scope
.
confirmingMachineStopOnNewMachineStartData
.
machine
,
true
);
$scope
.
confirmingMachineStopOnNewMachineStartData
=
null
;
};
$scope
.
checkExecutionMachineLimits
=
function
(
target
,
action
,
machineId
)
{
$http
.
get
(
'
/execution_machines_limit
'
)
.
then
(
function
(
data
)
{
if
((
data
.
data
.
can_start_many
)
||
(
data
.
data
.
running_domains
.
indexOf
(
machineId
)
>=
0
)
||
(
data
.
data
.
start_limit
>
data
.
data
.
running_domains
.
length
))
{
$scope
.
action
(
target
,
action
,
machineId
,
true
);
}
});
else
{
$scope
.
confirmingMachineStopOnNewMachineStartData
=
{
target
:
target
,
action
:
action
,
machine
:
machineId
};
}
},
function
(
data
,
status
)
{
console
.
error
(
'
Repos error
'
,
status
,
data
);
window
.
location
.
reload
();
});
};
$scope
.
action
=
function
(
target
,
action
,
machineId
,
confirmed
){
if
(((
action
===
'
start
'
)
||
(
action
===
'
view
'
))
&&
(
!
confirmed
))
{
$scope
.
checkExecutionMachineLimits
(
target
,
action
,
machineId
);
}
else
if
(
action
===
'
view
'
)
{
window
.
location
.
assign
(
'
/machine/view/
'
+
machineId
+
'
.html
'
);
}
else
{
$http
.
get
(
'
/
'
+
target
+
'
/
'
+
action
+
'
/
'
+
machineId
+
'
.json
'
)
.
then
(
function
(
response
)
{
if
(
response
.
status
==
300
)
{
console
.
error
(
'
Reponse error
'
,
response
.
status
);
window
.
location
.
reload
();
}
});
}
};
$scope
.
set_autostart
=
function
(
machineId
,
value
)
{
$http
.
get
(
"
/machine/autostart/
"
+
machineId
+
"
/
"
+
value
);
...
...
public/js/ravada.js
View file @
388fa3fb
...
...
@@ -235,7 +235,7 @@
$scope
.
checkExecutionMachineLimits
=
function
(
target
,
action
,
machineId
,
params
)
{
$http
.
get
(
'
/execution_machines_limit
'
)
.
then
(
function
(
data
)
{
if
((
data
.
data
.
can
t
_start_many
)
||
(
data
.
data
.
running_domains
.
indexOf
(
machineId
)
>=
0
)
||
(
data
.
data
.
start_limit
>
data
.
data
.
running_domains
.
length
))
{
if
((
data
.
data
.
can_start_many
)
||
(
data
.
data
.
running_domains
.
indexOf
(
machineId
)
>=
0
)
||
(
data
.
data
.
start_limit
>
data
.
data
.
running_domains
.
length
))
{
$scope
.
action
(
target
,
action
,
machineId
,
params
,
true
);
}
else
{
...
...
templates/main/admin_machines.html.ep
View file @
388fa3fb
...
...
@@ -275,12 +275,11 @@
title=
"<%=l 'ShutDown' %>"
>
<i
class=
"fa fa-power-off"
></i>
</button>
<a
type=
"button"
class=
"btn btn-primary btn-sm"
ng-show=
"machine.can_view"
ng-href=
"/machine/view/{{machine.id}}.html"
<button
type=
"button"
class=
"btn btn-primary btn-sm"
ng-click=
"action('machine','view',showmachine.id)"
title=
"<%=l 'View' %>"
>
<i
class=
"fa fa-desktop"
></i>
</
a
>
</
button
>
</div>
<div
ng-show=
"machine.is_locked"
ng-cloak
>
Machine
<a
href=
"/request/{{machine.is_locked}}.html"
><
%=
l
'
locked
'
%
></a></div>
<div
ng-show=
"machine.is_base && !machine.is_locked"
...
...
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