77 lines
3.9 KiB
HTML
77 lines
3.9 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}New Job - {{ current_user }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<h2 class="mb-4">Queue New Job</h2>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<form method="post" enctype="multipart/form-data">
|
|
<div class="mb-3">
|
|
<label class="form-label">Command</label>
|
|
<textarea name="cmd" class="form-control" rows="3" placeholder="e.g. python script.py --input data.txt" required></textarea>
|
|
<div class="form-text">Space-separated command and arguments (like a shell command).</div>
|
|
</div>
|
|
<div class="mb-3 form-check">
|
|
<input type="checkbox" class="form-check-input" id="shell_mode" name="shell_mode" value="on">
|
|
<label class="form-check-label" for="shell_mode">
|
|
Run command through shell (bash -c)
|
|
<small class="text-muted d-block">
|
|
Allows full shell syntax, pipes, redirects, globbing, and quoted arguments with spaces.
|
|
The entire command will be passed as a single string to <code>bash -c</code>.
|
|
</small>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Environment Variables</label>
|
|
<div id="env-fields">
|
|
<div class="row mb-2 env-row">
|
|
<div class="col"><input type="text" name="env_keys" class="form-control" placeholder="KEY"></div>
|
|
<div class="col"><input type="text" name="env_values" class="form-control" placeholder="value"></div>
|
|
<div class="col-auto"><button type="button" class="btn btn-outline-danger btn-sm" onclick="this.parentElement.parentElement.remove()">Remove</button></div>
|
|
</div>
|
|
</div>
|
|
<button type="button" class="btn btn-outline-secondary btn-sm" onclick="addEnvRow()">+ Add Env Var</button>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Files (scripts, config, data)</label>
|
|
<input type="file" name="files" class="form-control" multiple>
|
|
<div class="form-text">Uploaded files will be available in the container's working directory.</div>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Attach Existing Objects by UUID</label>
|
|
<input type="text" name="objs" class="form-control" placeholder="e.g. 123e4567-e89b-12d3-a456-426614174000, another-uuid-here">
|
|
<div class="form-text">Comma-separated list of object UUIDs (your own or public). Leave blank for none.</div>
|
|
</div>
|
|
|
|
<div class="mb-3 form-check">
|
|
<input type="checkbox" class="form-check-input" id="include_db" name="include_db" value="on">
|
|
<label class="form-check-label" for="include_db">
|
|
Include user database (db flag)
|
|
<small class="text-muted d-block">Adds user-db.json.gz with the full user database snapshot to job files</small>
|
|
</label>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary me-2">Queue Job</button>
|
|
<a href="/jobs" class="btn btn-secondary">Cancel</a>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function addEnvRow() {
|
|
const container = document.getElementById('env-fields');
|
|
const row = document.createElement('div');
|
|
row.className = 'row mb-2 env-row';
|
|
row.innerHTML = `
|
|
<div class="col"><input type="text" name="env_keys" class="form-control" placeholder="KEY"></div>
|
|
<div class="col"><input type="text" name="env_values" class="form-control" placeholder="value"></div>
|
|
<div class="col-auto"><button type="button" class="btn btn-outline-danger btn-sm" onclick="this.parentElement.parentElement.remove()">Remove</button></div>
|
|
`;
|
|
container.appendChild(row);
|
|
}
|
|
</script>
|
|
{% endblock %} |