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
910aa592
Commit
910aa592
authored
Jun 17, 2016
by
Francesc Guasch
Browse files
preparing to choose the VM type when creating a new machine
parent
430b7d2c
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
910aa592
...
...
@@ -415,6 +415,23 @@ sub list_requests {
return
\
@reqs
;
}
=head2 list_vm_types
Returnsa list ofthe types of Virtual Machines available on this system
=cut
sub
list_vm_types
{
my
$self
=
shift
;
my
%type
;
for
my
$vm
(
@
{
$self
->
vm
})
{
my
(
$name
)
=
ref
(
$vm
)
=~
/.*::(.*)/
;
$type
{
$name
}
++
;
}
return
sort
keys
%type
;
}
sub
_execute
{
my
$self
=
shift
;
my
$request
=
shift
;
...
...
public/js/ravada.js
View file @
910aa592
...
...
@@ -5,6 +5,10 @@ var app = angular.module("ravada.app",[]);
$http
.
get
(
'
/list_images.json
'
).
then
(
function
(
response
)
{
$scope
.
images
=
response
.
data
;
});
$http
.
get
(
'
/list_vm_types.json
'
).
then
(
function
(
response
)
{
$scope
.
backends
=
response
.
data
;
});
}]);
...
...
public/templates/new_machine.html
View file @
910aa592
...
...
@@ -12,15 +12,16 @@
>
</select>
<br/>
Backend:
<br/>
<input
type=
"radio"
name=
"backend"
value=
"kvm"
>
kvm
</input><br/>
<input
type=
"radio"
name=
"backend"
value=
"lxc"
disabled=
"true"
>
lxc
</input><br/>
Disk:
<input
type=
"text"
name=
"disk"
size=
"2"
>
Gb
<br/>
Ram:
<input
type=
"text"
name=
"ram"
size=
"2"
>
Gb
<br/>
<input
type=
"submit"
name=
"submit"
value=
"create"
>
<label
for=
"backend"
>
Backend
</label>
<select
name=
"backend"
ng-model=
"backend"
ng-options=
"item for item in backends"
>
</select>
<br/>
Disk:
<input
type=
"text"
name=
"disk"
size=
"2"
>
Gb
<br/>
Ram:
<input
type=
"text"
name=
"ram"
size=
"2"
>
Gb
<br/>
<input
type=
"submit"
name=
"submit"
value=
"create"
>
</form>
rvd_front.pl
View file @
910aa592
...
...
@@ -95,6 +95,11 @@ any '/users' => sub {
};
get
'
/list_vm_types.json
'
=>
sub
{
my
$c
=
shift
;
$c
->
render
(
json
=>
[
$RAVADA
->
list_vm_types
]);
};
get
'
/list_bases.json
'
=>
sub
{
my
$c
=
shift
;
$c
->
render
(
json
=>
$RAVADA
->
list_bases_data
);
...
...
@@ -112,6 +117,11 @@ get '/list_machines.json' => sub {
# machine commands
get
'
/machine/manage/*html
'
=>
sub
{
my
$c
=
shift
;
return
manage_machine
(
$c
);
};
get
'
/machine/view/*.html
'
=>
sub
{
my
$c
=
shift
;
return
view_machine
(
$c
);
...
...
@@ -418,6 +428,16 @@ sub _search_requested_machine {
return
$domain
;
}
sub
manage_machine
{
my
$c
=
shift
;
return
login
(
$c
)
if
!
_logged_in
(
$c
);
my
$domain
=
_search_requested_machine
(
$c
);
if
(
!
$domain
)
{
return
$c
->
render
(
text
=>
"
Domain no found
");
}
$c
->
render
(
text
=>
"
TODO :
"
.
Dumper
(
$domain
));
}
sub
view_machine
{
my
$c
=
shift
;
return
login
(
$c
)
if
!
_logged_in
(
$c
);
...
...
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