Skip to content

Commit

Permalink
wip: add attached domains
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Feb 8, 2024
1 parent c2fbea3 commit 35ab7c4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/Ravada/WebSocket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,29 @@ sub _list_domains_with_device($rvd,$row) {
push @domains, ($domain);
}
}
push @domains,( _list_domains_with_devices_locked($rvd, values %devices) );

$row->{_domains} = \@domains;
$row->{_bases} = \@bases;
$row->{devices} = [values %devices];
}

sub _list_domains_with_devices_locked($rvd, @devices) {
my $sql =
"SELECT d.id, d.name, d.is_base, d.status "
." FROM host_devices_domain_locked l, domains d "
." WHERE l.id_domain = d.id "
." AND ";

my $where = '';
for (@devices ) {
$where .= " OR " if $where;
$where .= " name = ? "
}
$sth = $rvd->_dbh->prepare($sql);
$sth->execute(@devices);
}

sub _list_requests($rvd, $args) {
my $login = $args->{login} or die "Error: no login arg ".Dumper($args);
my $user = Ravada::Auth::SQL->new(name => $login) or die "Error: uknown user $login";
Expand Down

0 comments on commit 35ab7c4

Please sign in to comment.