Formatter/HTML: only display description if we have one

This commit is contained in:
Dietmar Maurer 2017-01-15 11:04:02 +01:00
parent c5f0a96ffd
commit dc80cea51c

View File

@ -178,12 +178,14 @@ PVE::APIServer::Formatter::register_formatter($portal_format, sub {
$html .= $doc->alert(text => "Error $res->{status}: $res->{message}"); $html .= $doc->alert(text => "Error $res->{status}: $res->{message}");
} }
my $info = $res->{info}; my $lnk;
$html .= $doc->el(tag => 'h3', text => 'Description'); if (my $info = $res->{info}) {
$html .= $doc->el(tag => 'p', text => $info->{description}); $html .= $doc->el(tag => 'h3', text => 'Description');
$html .= $doc->el(tag => 'p', text => $info->{description});
my $lnk = PVE::JSONSchema::method_get_child_link($info); $lnk = PVE::JSONSchema::method_get_child_link($info);
}
if ($lnk && $data && $data->{data} && HTTP::Status::is_success($res->{status})) { if ($lnk && $data && $data->{data} && HTTP::Status::is_success($res->{status})) {