myvesta/web/templates/admin/list_services.html
2023-06-12 10:04:56 +02:00

211 lines
9.2 KiB
HTML

<div class="l-center">
<div class="l-sort clearfix noselect">
<a href="/edit/server/" class="l-sort__create-btn edit" title="<?=__('Configure')?>"><div id="add-icon"></div><div id="tooltip"><?=__('Configure')?></div></a>
<div class="l-sort-toolbar clearfix">
<table>
<tr>
<td class="l-sort-toolbar__search-box">
<form action="/search/" method="get">
<input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
<input type="text" name="q" class="search-input" value="<? echo isset($_POST['q']) ? htmlspecialchars($_POST['q']) : '' ?>" />
<input type="submit" value="" class="l-sort-toolbar__search" onClick="return doSearch('/search/')" />
</form>
</td>
<td class="step-right">
<a class="vst" href="/list/server/?cpu" target="_blank" > <?=__('show: CPU / MEM / NET / DISK');?> </a>
</td>
<td class="toggle-all">
<input id="toggle-all" type="checkbox" name="toggle-all" value="toggle-all" onChange="checkedAll('objects');">
<label for="toggle-all" class="check-label toggle-all"><?=__('toggle all')?></label>
</td>
<td>
<form action="/bulk/service/" method="post" id="objects">
<input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
<div class="l-select">
<select class="" name="action">
<option value=""><?php print __('apply to selected');?></option>
<option value="stop"><?php print __('stop');?></option>
<option value="start"><?php print __('start');?></option>
<option value="restart"><?php print __('restart');?></option>
</select>
</div>
<input type="submit" class="l-sort-toolbar__filter-apply" value="">
</td>
</tr>
</table>
</div>
</div>
<!-- /.l-sort -->
</div>
<div class="l-separator"></div>
<!-- /.l-separator -->
<div class="l-center units">
<div class="l-unit <? if($status == 'suspended') echo 'l-unit--suspended';?>">
<div class="l-unit-toolbar clearfix">
<div class="l-unit-toolbar__col l-unit-toolbar__col--left">
<input id="check0" class="ch-toggle" type="checkbox" name="srv[]" value="<?php echo $sys['sysinfo']['HOSTNAME'] ?>">
<label for="check0" class="check-label"></label>
</div>
<!-- l-unit-toolbar__col -->
<div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
<div class="actions-panel clearfix">
<div class="actions-panel__col actions-panel__configure shortcut-enter" key-action="href"><a href="/edit/server/"><?=__('configure')?> <i></i></a><span class="shortcut enter">&nbsp;&#8629;</span></div>
<div class="actions-panel__col actions-panel__restart shortcut-r" key-action="href"><a href="/restart/system/?hostname=<?php echo $sys['sysinfo']['HOSTNAME'] ?>&token=<?=$_SESSION['token']?>"><?=__('restart')?> <i></i></a><span class="shortcut">&nbsp;R</span></div>
</div>
<!-- /.actions-panel -->
</div>
<!-- l-unit-toolbar__col -->
</div>
<!-- /.l-unit-toolbar -->
<div class="l-unit__col l-unit__col--left clearfix">
<div class="l-unit__suspended"><?__('suspended')?></div>
<!-- div class="l-unit__date">
</div-->
</div>
<!-- /.l-unit__col -->
<div class="l-unit__col l-unit__col--right">
<div class="l-unit__name separate">
<?=$sys['sysinfo']['HOSTNAME']?>
</div>
<div class="l-unit__stats">
<table>
<tr>
<td>
<div class="l-unit__stat-cols clearfix">
<div class="l-unit__stat-col l-unit__stat-col--left">
<b><?=$sys['sysinfo']['OS']?>
<?=$sys['sysinfo']['VERSION']?></b>
</div>
<div class="l-unit__stat-col l-unit__stat-col--right">(<?=$sys['sysinfo']['ARCH']?>)</div>
</div>
</td>
<td>
<div class="l-unit__stat-cols clearfix">
<div class="l-unit__stat-col l-unit__stat-col--left"><?=__('Load Average')?>:</div>
<div class="l-unit__stat-col l-unit__stat-col--right"><b><?=$sys['sysinfo']['LOADAVERAGE']?></b></div>
</div>
</td>
<td>
<div class="l-unit__stat-cols clearfix last">
<div class="l-unit__stat-col l-unit__stat-col--left compact"><?=__('Uptime')?>:</div>
<div class="l-unit__stat-col l-unit__stat-col--right"><b><?=humanize_time($sys['sysinfo']['UPTIME'])?></b></div>
</div>
</td>
</tr>
</table>
</div>
<!-- /.l-unit__stats -->
</div>
<!-- /.l-unit__col -->
</div>
<!-- /.l-unit -->
<?php
foreach ($data as $key => $value) {
++$i;
if ($data[$key]['STATE'] == 'running') {
$status = 'active';
$action = 'stop';
} else {
$status = 'suspended';
$action = 'start';
}
$realservice=$key;
if ($realservice=="vesta-php") $realservice="vesta";
if ($realservice=="vesta-nginx") $realservice="vesta";
$cpu = $data[$key]['CPU'] / 10;
$cpu = number_format($cpu, 1);
if ($cpu == '0.0') $cpu = 0;
?>
<div class="l-unit <? if($status == 'suspended') echo 'l-unit--suspended';?>">
<div class="l-unit-toolbar clearfix">
<div class="l-unit-toolbar__col l-unit-toolbar__col--left">
<input id="check<?php echo $i ?>" class="ch-toggle" type="checkbox" name="service[]" value="<?php echo $key ?>">
<label for="check<?php echo $i ?>" class="check-label"></label>
</div>
<!-- l-unit-toolbar__col -->
<div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
<div class="actions-panel clearfix">
<div class="actions-panel__col actions-panel__configure shortcut-enter" key-action="href"><a href="/edit/server/<? echo $realservice ?>/"><?=__('configure')?> <i></i></a><span class="shortcut enter">&nbsp;&#8629;</span></div>
<div class="actions-panel__col actions-panel__<?=$action?> shortcut-s" key-action="href"><a href="/<?php echo $action ?>/service/?srv=<?=$realservice?>&token=<?=$_SESSION['token']?>"><?=__($action)?> <i></i></a><span class="shortcut">&nbsp;S</span></div>
<div class="actions-panel__col actions-panel__restart shortcut-r" key-action="href"><a href="/restart/service/?srv=<?=$realservice?>&token=<?=$_SESSION['token']?>"><?=__('restart')?> <i></i></a><span class="shortcut">&nbsp;R</span></div>
</div>
<!-- /.actions-panel -->
</div>
<!-- l-unit-toolbar__col -->
</div>
<!-- /.l-unit-toolbar -->
<div class="l-unit__col l-unit__col--left clearfix step-left">
<!-- div class="l-unit__date">
</div-->
</div>
<!-- /.l-unit__col -->
<div class="l-unit__col l-unit__col--right">
<div class="l-unit__name small-2">
<?=$key?>
</div>
<div class="l-unit__stats">
<table>
<tr>
<td>
<div class="l-unit__stat-cols clearfix">
<div class="l-unit__stat-col l-unit__stat-col--left"><b><?=__($data[$key]['SYSTEM'])?></b></div>
<div class="l-unit__stat-col l-unit__stat-col--right"></div>
</div>
</td>
<td>
<div class="l-unit__stat-cols clearfix">
<div class="l-unit__stat-col l-unit__stat-col--left"><?=__('CPU')?>: <b><?=$cpu?></b></div>
<div class="l-unit__stat-col l-unit__stat-col--right"><?=__('Memory')?>: <b><?=$data[$key]['MEM']?> <?=__('mb')?></b></div>
</div>
</td>
<td>
<div class="l-unit__stat-cols clearfix last">
<div class="l-unit__stat-col l-unit__stat-col--left"><?=__('Uptime')?>: <b><?=humanize_time($data[$key]['RTIME'])?></b></div>
<div class="l-unit__stat-col l-unit__stat-col--right"></div>
</div>
</td>
</tr>
</table>
</div>
<!-- /.l-unit__stats -->
</div>
<!-- /.l-unit__col -->
</div>
<!-- /.l-unit -->
<!-- div class="l-separator"></div -->
<!-- /.l-separator -->
<?}?>
</div>
<div id="vstobjects">
<div class="l-separator"></div>
<div class="l-center">
<div class="l-unit-ft">
<div class="l-unit__col l-unit__col--left clearfix"></div>
<div class="data-count l-unit__col l-unit__col--right clearfix"></div>
</div>
</div>
</div>