Skip to content

Commit

Permalink
VmHeader: show templates as such
Browse files Browse the repository at this point in the history
fixes #205
  • Loading branch information
Thomas-Gelf committed Sep 20, 2020
1 parent 8213692 commit eb5afd8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/84-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ restart the *Background Daemon*.
* FEATURE: VM details now show host resource usage (#120)
* FEATURE: Provide suggestions in case there is no vCenter (#189)
* FEATURE: allow to define a custom vCenter display name (#121)
* FEATURE: show VM templates as such to make them distinguishable (#205)

### CLI
* FIX: vm check now also looks for object name (#109)
Expand Down
3 changes: 0 additions & 3 deletions library/Vspheredb/Web/Table/Object/VmExtraInfoTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ protected function assemble()
$this->translate('UUID') => Html::tag('pre', $vm->get('bios_uuid')),
$this->translate('Instance UUID') => Html::tag('pre', $vm->get('instance_uuid')),
$this->translate('CPUs') => $vm->get('hardware_numcpu'),
$this->translate('Is Template') => $vm->get('template') === 'y'
? $this->translate('true')
: $this->translate('false'),
$this->translate('Version') => $vm->get('version'),
]);
}
Expand Down
12 changes: 11 additions & 1 deletion library/Vspheredb/Web/Widget/VmHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Icinga\Module\Vspheredb\Web\Widget;

use gipfl\IcingaWeb2\Icon;
use gipfl\Translation\TranslationHelper;
use Icinga\Module\Vspheredb\DbObject\VirtualMachine;
use ipl\Html\Html;
Expand All @@ -27,7 +28,16 @@ protected function assemble()
$vm = $this->vm;
$powerState = $vm->get('runtime_power_state');
$renderer = new PowerStateRenderer();
if ($powerState !== 'poweredOn') {
if ($vm->get('template') === 'y') {
$cpu = Html::tag('div', [
'class' => 'vm-template'
], Icon::create('upload', [
'title' => $this->translate('This is a template'),
'class' => [ 'state' ]
]));

$mem = $this->translate('This is a template');
} elseif ($powerState !== 'poweredOn') {
$cpu = Html::tag('div', [
'class' => 'cpu off',
// 'style' => 'font-size: 3em; width: 1em; height: 1em; display: inline-block;',
Expand Down
21 changes: 21 additions & 0 deletions public/css/module.less
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,27 @@ pre.logOutput {
}

/** End logfile */
div.vm-template {
float: left;
border: 0.75em solid @text-color;
height: 6em;
box-sizing: border-box;
width: 6em;
border-radius: 1em;
text-align: center;
display: inline-block;
background-color: @gray;
margin-right: 1em;
color: @text-color;
padding: 0.2em 0;
i.state {
&:before {
color: @text-color;
}
font-size: 2.2em;
}
}

.cpu {
border: 0.75em solid @text-color;
height: 6em;
Expand Down

0 comments on commit eb5afd8

Please sign in to comment.