console
This commit is contained in:
@@ -266,7 +266,9 @@ $runs = $pdo->query(
|
|||||||
<option value="">Vorlage auswählen (optional)</option>
|
<option value="">Vorlage auswählen (optional)</option>
|
||||||
<?php foreach ($commands as $c): ?>
|
<?php foreach ($commands as $c): ?>
|
||||||
<?php if (!auth_is_admin() && !empty($c['admin_only'])) { continue; } ?>
|
<?php if (!auth_is_admin() && !empty($c['admin_only'])) { continue; } ?>
|
||||||
<option value="<?= e((string)$c['id']) ?>"><?= e($c['label'] ?? '') ?></option>
|
<option value="<?= e((string)$c['id']) ?>" data-command="<?= e((string)($c['command'] ?? '')) ?>">
|
||||||
|
<?= e($c['label'] ?? '') ?>
|
||||||
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -266,8 +266,21 @@
|
|||||||
const consoleNotice = document.querySelector('[data-console-notice]');
|
const consoleNotice = document.querySelector('[data-console-notice]');
|
||||||
const tokenEl = document.querySelector('[data-console-token]');
|
const tokenEl = document.querySelector('[data-console-token]');
|
||||||
if (consoleForm) {
|
if (consoleForm) {
|
||||||
|
const presetSelect = consoleForm.querySelector('select[name="terminal_preset_id"]');
|
||||||
|
const commandTextarea = consoleForm.querySelector('textarea[name="terminal_command_text"]');
|
||||||
|
if (presetSelect && commandTextarea) {
|
||||||
|
presetSelect.addEventListener('change', () => {
|
||||||
|
const opt = presetSelect.selectedOptions[0];
|
||||||
|
const cmd = opt && opt.dataset && opt.dataset.command ? opt.dataset.command : '';
|
||||||
|
if (cmd) {
|
||||||
|
commandTextarea.value = cmd;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const submitOpen = async () => {
|
const submitOpen = async () => {
|
||||||
const formData = new FormData(consoleForm);
|
const formData = new FormData(consoleForm);
|
||||||
|
if (presetSelect) formData.set('terminal_preset_id', '');
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
url.searchParams.set('open_console_json', '1');
|
url.searchParams.set('open_console_json', '1');
|
||||||
const res = await fetch(url.toString(), { method: 'POST', body: formData, cache: 'no-store' });
|
const res = await fetch(url.toString(), { method: 'POST', body: formData, cache: 'no-store' });
|
||||||
@@ -287,6 +300,7 @@
|
|||||||
|
|
||||||
const submitRun = async () => {
|
const submitRun = async () => {
|
||||||
const formData = new FormData(consoleForm);
|
const formData = new FormData(consoleForm);
|
||||||
|
if (presetSelect) formData.set('terminal_preset_id', '');
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
url.searchParams.set('run_command_json', '1');
|
url.searchParams.set('run_command_json', '1');
|
||||||
const res = await fetch(url.toString(), { method: 'POST', body: formData, cache: 'no-store' });
|
const res = await fetch(url.toString(), { method: 'POST', body: formData, cache: 'no-store' });
|
||||||
|
|||||||
Reference in New Issue
Block a user