Commit 910aa592 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

preparing to choose the VM type when creating a new machine

parent 430b7d2c
......@@ -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;
......
......@@ -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;
});
}]);
......
......@@ -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>
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment