0.7.0: after_action setting (stay on page with job status vs jump to log), settings UI
This commit is contained in:
1 parent
642a11f505
commit
cbf899b94b
6 files changed
+110
-5
No files matched your search
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"appname": "VM Manager",
|
||||
"version": "0.6.1",
|
||||
"version": "0.7.0",
|
||||
"rootfolder": "/mnt/Daten/extensions/vmmngr",
|
||||
"vm_source": "auto",
|
||||
"bridges": ["ix0bridge"],
|
||||
"default_bridge": "ix0bridge",
|
||||
"enable": true,
|
||||
"job_timeout": 900,
|
||||
"after_action": "stay",
|
||||
"ram_budget_pct": 85
|
||||
}
|
||||
+10
-1
@@ -18,10 +18,15 @@ if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && isset($
|
||||
exit;
|
||||
}
|
||||
$job = vmm_job_new($verb, $vmName);
|
||||
header('Location: vmmngr_jobs.php?id=' . urlencode((string)$job['id']));
|
||||
header('Location: ' . vmm_after_job_target((string)$job['id'], 'vmmngr.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
$activeJob = (string)($_GET['job'] ?? '');
|
||||
if ($activeJob !== '' && vmm_job_running($activeJob)) {
|
||||
header('Refresh: 3');
|
||||
}
|
||||
|
||||
$conf = vmm_config();
|
||||
$vmprov = vmm_resolve('vm');
|
||||
$vms = $vmprov['available'] ? vmm_list() : [];
|
||||
@@ -46,6 +51,10 @@ vmm_nav('dashboard');
|
||||
|
||||
<form action="vmmngr.php" method="post" name="iform" id="iform"><table id="area_data"><tbody><tr><td id="area_data_frame">
|
||||
|
||||
<?php if ($activeJob !== ''): ?>
|
||||
<?=vmm_job_status_html($activeJob); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($_SESSION['vmmngr_error'])): ?>
|
||||
<?php print_info_box(vmm_h((string)$_SESSION['vmmngr_error'])); unset($_SESSION['vmmngr_error']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -6,6 +6,16 @@
|
||||
require_once 'vmmngr-boot.inc';
|
||||
require_once 'vmmngr-config-lib.inc';
|
||||
|
||||
if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && ($_POST['act'] ?? '') === 'save_settings') {
|
||||
$conf = vmm_config();
|
||||
$conf['after_action'] = ($_POST['after_action'] ?? 'stay') === 'log' ? 'log' : 'stay';
|
||||
$conf['vm_source'] = in_array($_POST['vm_source'] ?? '', ['auto', 'system', 'bundle'], true) ? $_POST['vm_source'] : 'auto';
|
||||
vmm_save_config($conf);
|
||||
$_SESSION['vmmngr_error'] = gettext('Settings saved.');
|
||||
header('Location: vmmngr_config.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && ($_POST['act'] ?? '') === 'register') {
|
||||
$added = vmm_register_boot();
|
||||
$_SESSION['vmmngr_error'] = $added === []
|
||||
@@ -30,6 +40,36 @@ vmm_nav('config'); ?>
|
||||
<?php print_info_box(vmm_h((string)$_SESSION['vmmngr_error'])); unset($_SESSION['vmmngr_error']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $bs = vmm_boot_state(); $conf = vmm_config(); ?>
|
||||
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
|
||||
<colgroup><col class="area_data_settings_col_tag"><col class="area_data_settings_col_data"></colgroup>
|
||||
<thead><?php html_separator2(); html_titleline2(gettext('Behaviour'), 2); ?></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="celltag"><?=gettext('After an action');?></td>
|
||||
<td class="celldata">
|
||||
<select name="after_action">
|
||||
<option value="stay" <?=($conf['after_action'] ?? 'stay') === 'stay' ? 'selected' : '';?>><?=gettext('stay on the page, show job status');?></option>
|
||||
<option value="log" <?=($conf['after_action'] ?? 'stay') === 'log' ? 'selected' : '';?>><?=gettext('jump to the job log');?></option>
|
||||
</select>
|
||||
<button type="submit" class="formbtn" name="act" value="save_settings" style="margin-left:8px;"><?=gettext('Save');?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="celltag">vm_source</td>
|
||||
<td class="celldata">
|
||||
<select name="vm_source">
|
||||
<?php foreach (['auto', 'system', 'bundle'] as $src): ?>
|
||||
<option value="<?=$src;?>" <?=($conf['vm_source'] ?? 'auto') === $src ? 'selected' : '';?>><?=$src;?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<?php $bs = vmm_boot_state(); ?>
|
||||
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
|
||||
<colgroup><col class="area_data_settings_col_tag"><col class="area_data_settings_col_data"></colgroup>
|
||||
|
||||
+15
-2
@@ -83,7 +83,7 @@ if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && isset($
|
||||
exit;
|
||||
}
|
||||
$job = vmm_job_new('start', $name);
|
||||
header('Location: vmmngr_jobs.php?id=' . urlencode((string)$job['id']));
|
||||
header('Location: ' . vmm_after_job_target((string)$job['id'], 'vmmngr_vm.php?name=' . urlencode($name)));
|
||||
exit;
|
||||
}
|
||||
$check = vmm_action_check($verb, $vmName, (string)($_POST['confirm'] ?? ''));
|
||||
@@ -93,7 +93,7 @@ if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && isset($
|
||||
exit;
|
||||
}
|
||||
$job = vmm_job_new($verb, $vmName);
|
||||
header('Location: vmmngr_jobs.php?id=' . urlencode((string)$job['id']));
|
||||
header('Location: ' . vmm_after_job_target((string)$job['id'], 'vmmngr_vm.php?name=' . urlencode($name)));
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -103,6 +103,11 @@ if (vmm_vm_state($name) === 'absent') {
|
||||
exit;
|
||||
}
|
||||
|
||||
$activeJob = (string)($_GET['job'] ?? '');
|
||||
if ($activeJob !== '' && vmm_job_running($activeJob)) {
|
||||
header('Refresh: 3');
|
||||
}
|
||||
|
||||
$info = vmm_info($name);
|
||||
$pgtitle = [gettext('Extensions'), gettext('VM Manager'), $name];
|
||||
$jobs = vmm_job_list(10, $name);
|
||||
@@ -114,6 +119,14 @@ vmm_nav('dashboard');
|
||||
|
||||
<form action="vmmngr_vm.php?name=<?=urlencode($name);?>" method="post" name="iform" id="iform"><table id="area_data"><tbody><tr><td id="area_data_frame">
|
||||
|
||||
<?php if ($activeJob !== ''): ?>
|
||||
<?=vmm_job_status_html($activeJob); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($_SESSION['vmmngr_error'])): ?>
|
||||
<?php print_info_box(vmm_h((string)$_SESSION['vmmngr_error'])); unset($_SESSION['vmmngr_error']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($info['error'])): ?>
|
||||
<?php print_info_box(sprintf(gettext('Could not read VM details: %s'), vmm_h((string)$info['error']))); ?>
|
||||
<?php else: ?>
|
||||
|
||||
Reference in new issue
Block a user