webcron/templates/job/add.html.twig

177 lines
9.5 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-04-12 12:23:50 +02:00
<div class="mb-3">
2021-04-13 14:07:11 +02:00
<div class="dropdown">
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="crontypeButton" 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">
<a class="dropdown-item crontype-item" href="#" data-type="local">Local</a>
<a class="dropdown-item crontype-item" href="#" data-type="ssh">Ssh</a>
<a class="dropdown-item crontype-item" href="#" data-type="docker">Docker</a>
2021-04-15 13:06:59 +02:00
<a class="dropdown-item crontype-item" href="#" data-type="docker-ssh">Docker over SSH</a>
<a class="dropdown-item crontype-item" href="#" data-type="reboot">Reboot</a>
<a class="dropdown-item crontype-item" href="#" data-type="reboot-ssh">Reboot over SSH</a>
2021-04-13 14:07:11 +02:00
<a class="dropdown-item crontype-item" href="#" data-type="http">Http request</a>
</div>
</div>
</div>
2021-04-15 13:52:27 +02:00
<div class="crontype-local crontype-inputs hidden">
<div class="mb-3">
<label for="command">Command</label>
<input type="text" name="command" class="form-control" id="command" placeholder="sudo apt update">
</div>
</div>
<div class="crontype-ssh crontype-inputs hidden">
<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="basicauth-password-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>
2021-05-06 13:30:12 +02:00
<input type="password" name="privkey-password" class="form-control" placeholder="correct horse battery staple">
2021-04-15 13:52:27 +02:00
<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 class="mb-3">
<label for="command">Command</label>
<input type="text" name="command" class="form-control" id="command" placeholder="sudo apt update">
</div>
</div>
2021-05-06 14:30:35 +02:00
<div class="crontype-reboot crontype-inputs hidden">
<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-04-13 14:44:58 +02:00
<div class="crontype-http crontype-inputs hidden">
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>
</div>
2021-05-06 13:30:12 +02:00
<h3>Variables</h3>
<div class="vars mb-3">
<div class="input-group var-group hidden">
<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-06 13:30:12 +02:00
<div class="vars-description mb-3 hidden">
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-04-13 14:07:11 +02:00
<input type="hidden" name="type" class="crontype" value=""><button type="submit" class="btn btn-outline-primary">Submit</button>
2021-04-12 12:23:50 +02:00
</form>
{% endblock %}
{% block extrastyles %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.39.0/css/tempusdominus-bootstrap-4.min.css" integrity="sha512-3JRrEUwaCkFUBLK1N8HehwQgu8e23jTH4np5NHOmQOobuC4ROQxFwFgBLTnhcnQRMs84muMh0PnnwXlPq5MGjg==" crossorigin="anonymous" />
2021-04-13 14:07:11 +02:00
<link rel="stylesheet" href="/resources/job/add.css" />
2021-04-12 12:23:50 +02:00
{% endblock %}
{% block extrascripts %}
2021-04-15 13:52:27 +02:00
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ==" crossorigin="anonymous"></script>
2021-04-13 14:07:11 +02:00
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.39.0/js/tempusdominus-bootstrap-4.min.js" integrity="sha512-k6/Bkb8Fxf/c1Tkyl39yJwcOZ1P4cRrJu77p83zJjN2Z55prbFHxPs9vN7q3l3+tSMGPDdoH51AEU8Vgo1cgAA==" crossorigin="anonymous"></script>
2021-04-15 13:52:27 +02:00
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bs-custom-file-input/1.3.4/bs-custom-file-input.min.js" integrity="sha512-91BoXI7UENvgjyH31ug0ga7o1Ov41tOzbMM3+RPqFVohn1UbVcjL/f5sl6YSOFfaJp+rF+/IEbOOEwtBONMz+w==" crossorigin="anonymous"></script>
2021-04-13 14:07:11 +02:00
<script type="text/javascript" src="/resources/job/add.js"></script>
2021-04-12 12:23:50 +02:00
{% endblock %}