webcron/templates/job/add.html.twig

223 lines
11 KiB
Twig
Raw Normal View History

2021-04-12 12:23:50 +02:00
{% extends "base.html.twig" %}
{% block title %}Add job{% endblock %}
{% block content %}
<h2>Add a cronjob</h2>
2021-04-15 13:52:27 +02:00
<form method="post" class="form-horizontal" enctype="multipart/form-data" action="{{ path('job_add') }}">
2021-04-12 12:23:50 +02:00
2021-04-13 14:44:58 +02:00
<h3>General info</h3>
2021-04-12 12:23:50 +02:00
<div class="mb-3">
<label for="name">Name</label>
<input type="text" name="name" class="form-control" id="name" placeholder="System update">
</div>
<div class="mb-3">
2021-05-06 15:53:21 +02:00
<label for="name">Interval (in seconds)</label>
2021-04-13 19:04:32 +02:00
<div class="input-group">
<div class="dropdown input-group-prepend">
2021-05-06 15:53:21 +02:00
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="intervalButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2021-04-13 19:04:32 +02:00
Patterns
</button>
2021-05-06 15:53:21 +02:00
<div class="dropdown-menu" aria-labelledby="intervalButton">
<a class="dropdown-item intervalpattern-item" href="#" data-time="60">Every minute</a>
<a class="dropdown-item intervalpattern-item" href="#" data-time="3600">Every hour</a>
<a class="dropdown-item intervalpattern-item" href="#" data-time="86400">Every day</a>
<a class="dropdown-item intervalpattern-item" href="#" data-time="604800">Every week</a>
<a class="dropdown-item intervalpattern-item" href="#" data-time="2419200">Every 4 weeks</a>
2021-04-13 19:04:32 +02:00
</div>
</div>
2021-05-06 15:53:21 +02:00
<input type="number" class="form-control" id="interval" name="interval">
2021-04-13 19:04:32 +02:00
</div>
2021-04-12 12:23:50 +02:00
</div>
<div class="mb-3">
<label for="nextrun">Next run</label>
2021-04-13 14:44:58 +02:00
<input type="text" autocomplete="off" id="nextrunselector" class="form-control datetimepicker-input" data-target="#nextrunselector" data-toggle="datetimepicker" name="nextrun">
2021-04-12 12:23:50 +02:00
</div>
<div class="mb-3">
<label for="lastrun">Last run</label>
2021-04-13 14:44:58 +02:00
<input type="text" autocomplete="off" id="lastrunselector" class="form-control datetimepicker-input" data-target="#lastrunselector" data-toggle="datetimepicker" name="lastrun">
2021-04-12 12:23:50 +02:00
</div>
2021-04-13 14:44:58 +02:00
<h3>Job details</h3>
2021-05-19 13:24:38 +02:00
<div class="mb-3 btn-group">
<div class="dropdown croncategory-group crontype-group">
2021-05-21 13:09:48 +02:00
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="crontypeButton" data-default-text="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2021-04-13 14:44:58 +02:00
Job type
2021-04-13 14:07:11 +02:00
</button>
<div class="dropdown-menu" aria-labelledby="crontypeButton">
2021-05-19 13:24:38 +02:00
<a class="dropdown-item crontype-item" href="#" data-type="command">Command</a>
2021-04-15 13:06:59 +02:00
<a class="dropdown-item crontype-item" href="#" data-type="reboot">Reboot</a>
2021-04-13 14:07:11 +02:00
<a class="dropdown-item crontype-item" href="#" data-type="http">Http request</a>
</div>
</div>
2021-05-20 13:06:53 +02:00
2021-05-26 13:09:13 +02:00
<div class="dropdown croncategory-group d-none hosttype-group">
2021-05-21 13:09:48 +02:00
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="hosttypeButton" data-default-text="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2021-05-19 13:24:38 +02:00
Host type
</button>
<div class="dropdown-menu" aria-labelledby="hosttypeButton">
2021-05-20 13:06:53 +02:00
<a class="dropdown-item hosttype-item" href="#" data-type="local">Local</a>
2021-05-19 13:24:38 +02:00
<a class="dropdown-item hosttype-item" href="#" data-type="ssh">SSH</a>
2021-05-20 13:06:53 +02:00
</div>
</div>
2021-05-26 13:09:13 +02:00
<div class="dropdown croncategory-group d-none containertype-group">
2021-05-21 13:09:48 +02:00
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="containertypeButton" data-default-text="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2021-05-20 13:06:53 +02:00
Container
</button>
<div class="dropdown-menu" aria-labelledby="containertypeButton">
<a class="dropdown-item containertype-item" href="#" data-type="none">None</a>
<a class="dropdown-item containertype-item" href="#" data-type="docker">Docker</a>
2021-04-15 13:52:27 +02:00
</div>
</div>
2021-05-19 13:24:38 +02:00
</div>
2021-04-15 13:52:27 +02:00
2021-05-26 13:09:13 +02:00
<div class="crontype-command crontype-inputs croncategory-inputs d-none">
2021-05-19 13:24:38 +02:00
<h4>Command details</h4>
2021-04-15 13:52:27 +02:00
<div class="mb-3">
<label for="command">Command</label>
<input type="text" name="command" class="form-control" id="command" placeholder="sudo apt update">
</div>
2021-05-19 20:09:09 +02:00
<div class="mb-3">
<label for="response">Expected exit code</label>
<input type="text" name="response" class="form-control" id="response" placeholder="0">
</div>
2021-04-15 13:52:27 +02:00
</div>
2021-05-26 13:09:13 +02:00
<div class="crontype-reboot crontype-inputs croncategory-inputs d-none">
2021-05-19 13:24:38 +02:00
<h4>Reboot job details</h4>
2021-05-06 14:30:35 +02:00
<div class="mb-3">
<label for="reboot-command">Reboot command</label>
<input type="text" name="reboot-command" class="form-control" id="command" placeholder="systemctl reboot">
<small id="reboot-command-help" class="form-text text-muted">Use {reboot-delay} or {reboot-delay-secs} to add the delay in your command</small>
</div>
<div class="mb-3">
<label for="getservices-command">Get services command</label>
<input type="text" name="getservices-command" class="form-control" id="command" placeholder="systemctl list-units">
</div>
<div class="mb-3">
<label for="reboot-delay">Reboot delay (in minutes)</label>
<input type="number" name="reboot-delay" class="form-control" placeholder="5">
<small id="reboot-delay-help" class="form-text text-muted">Delay between triggering reboot and actual reboot</small>
</div>
<div class="mb-3">
<label for="reboot-duration">Reboot duration (in minutes)</label>
<input type="number" name="reboot-duration" class="form-control" placeholder="10">
<small id="reboot-duration-help" class="form-text text-muted">The amount of time the system takes to actually reboot</small>
</div>
</div>
2021-05-26 13:09:13 +02:00
<div class="crontype-http crontype-inputs croncategory-inputs d-none">
2021-05-19 13:24:38 +02:00
<h4>HTTP request details</h4>
2021-04-13 14:07:11 +02:00
<div class="mb-3">
<label for="url">Url</label>
<input type="text" name="url" class="form-control" id="url" placeholder="https://scripts.example.com/">
</div>
2021-04-13 14:44:58 +02:00
<div class="mb-3">
<label for="basicauth-username">Username for Basic-Auth</label>
<input type="text" name="basicauth-username" class="form-control" id="basicauth-username" placeholder="www-data">
</div>
<div class="mb-3">
<label for="basicauth-password">Password for Basic-Auth</label>
2021-05-06 13:30:12 +02:00
<input type="password" name="basicauth-password" class="form-control" placeholder="correct horse battery staple">
2021-04-13 14:44:58 +02:00
<small id="basicauth-password-help" class="form-text text-muted">This field is being saved as a secret</small>
</div>
2021-05-19 20:09:09 +02:00
<div class="mb-3">
<label for="response">Expected response status code</label>
<input type="text" name="response" class="form-control" id="response" placeholder="200">
</div>
</div>
2021-05-26 13:09:13 +02:00
<div class="hosttype-local hosttype-inputs croncategory-inputs d-none">
2021-05-19 20:09:09 +02:00
<h4>Localhost details</h4>
<h5>No options</h5>
2021-04-13 14:44:58 +02:00
</div>
2021-05-26 13:09:13 +02:00
<div class="hosttype-ssh hosttype-inputs croncategory-inputs d-none">
2021-05-19 13:24:38 +02:00
<h4>SSH host details</h4>
<div class="mb-3">
<label for="host">Hostname</label>
<input type="text" name="host" class="form-control" id="host" placeholder="ssh.abc.xyz">
</div>
<div class="mb-3">
<label for="user">Username</label>
<input type="text" name="user" class="form-control" id="user" placeholder="larry">
</div>
<div class="mb-3">
<label for="privkey">Private key</label>
<div class="custom-file">
<input type="file" class="custom-file-input" id="privkey" name="privkey">
<label class="custom-file-label" for="privkey">Choose file</label>
</div>
<small id="custom-file-help" class="form-text text-muted">This file is being saved as a secret</small>
</div>
<div class="mb-3">
<label for="privkey-password">Password for private key</label>
<input type="password" name="privkey-password" class="form-control" placeholder="correct horse battery staple">
<small id="privkey-password-help" class="form-text text-muted">If private key is empty this field is being used as ssh-password</small>
<small id="privkey-password-help-2" class="form-text text-muted">This field is being saved as a secret</small>
</div>
</div>
2021-05-26 13:09:13 +02:00
<div class="containertype-none containertype-inputs croncategory-inputs d-none">
2021-05-20 13:06:53 +02:00
</div>
2021-05-26 13:09:13 +02:00
<div class="containertype-docker containertype-inputs croncategory-inputs d-none">
2021-05-20 13:06:53 +02:00
<h4>Docker container details</h4>
<div class="mb-3">
<label for="service">Service</label>
<input type="text" name="service" class="form-control" id="service" placeholder="mysql">
</div>
<div class="mb-3">
<label for="user">Username</label>
2021-05-24 12:28:47 +02:00
<input type="text" name="container-user" class="form-control" id="container-user" placeholder="larry">
2021-05-20 13:06:53 +02:00
</div>
</div>
2021-05-06 13:30:12 +02:00
<h3>Variables</h3>
2021-05-21 13:09:48 +02:00
2021-05-06 13:30:12 +02:00
<div class="vars mb-3">
2021-05-26 13:09:13 +02:00
<div class="input-group var-group d-none">
2021-05-06 13:30:12 +02:00
<div class="input-group-prepend">
<div class="input-group-text border-right-0">
<input type="checkbox" name="var-issecret[0]" class="var-issecret" placeholder="value" value="true">
</div>
<span class="input-group-text border-left-0">Secret</span>
</div>
<input type="text" name="var-id[0]" class="form-control var-id" placeholder="name">
<input type="text" name="var-value[0]" class="form-control var-value" placeholder="value">
2021-04-13 14:44:58 +02:00
</div>
</div>
2021-05-26 13:09:13 +02:00
<div class="vars-description mb-3 d-none">
2021-04-13 14:44:58 +02:00
<p>
2021-05-06 13:30:12 +02:00
You can add variables by using {variable-name} in job details
2021-04-13 14:44:58 +02:00
</p>
</div>
<div class="mb-3">
2021-05-06 13:30:12 +02:00
<a href="#" class="btn btn-outline-primary addvar-btn">Add variable</a>
2021-04-12 12:23:50 +02:00
</div>
2021-05-20 13:06:53 +02:00
<input type="hidden" name="crontype" class="crontype" value="">
<input type="hidden" name="hosttype" class="hosttype" value="">
<input type="hidden" name="containertype" class="containertype" value="">
<button type="submit" class="btn btn-outline-primary">Submit</button>
2021-04-12 12:23:50 +02:00
</form>
{% endblock %}
2021-05-26 13:09:13 +02:00
{% block styles %}
{{ encore_entry_link_tags('job.add') }}
2021-04-12 12:23:50 +02:00
{% endblock %}
2021-05-26 13:09:13 +02:00
{% block scripts %}
{{ encore_entry_script_tags('job.add') }}
2021-04-12 12:23:50 +02:00
{% endblock %}