diff --git a/docs/deployment.md b/docs/deployment.md index a71cc82..34122a9 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -1450,16 +1450,22 @@ sudo systemctl enable --now coulobre-website-job-worker.service sudo systemctl restart coulobre-panel coulobre-worker coulobre-beat ``` -Set **Website job limit** to the number of saved jobs allowed per hosting -account. Paused jobs count toward the saved limit. The default is zero. +Set **Scheduled tasks per hosting account** to the number of saved tasks +allowed per account. Paused tasks count toward the limit. The default is zero. If you lower a limit, the oldest enabled jobs retain their places until the account removes or pauses jobs. Add `website-jobs` to the local service health list if you monitor this worker from the panel. -Customers can open **Scheduled jobs** from the -account page. Operators need both **Can view hosting account** and **Can -manage scheduled website jobs**. Pick the primary or an active independent -website. Use five cron fields in UTC. For example, `*/15 * * * *` runs every +Customers can open **Advanced Features → Scheduled Tasks** and select a +hosting account. **Add task** is available when the account has an active +website and room in its hosting package. The page explains what to check +when adding tasks is unavailable. Operators and managers can open **System → +Scheduled Task Overview** to inspect tasks in their workspace. Operators +can manage tasks for accounts without an assigned customer when they have +both **Can view hosting account** and **Can manage scheduled website jobs**. + +When adding a task, pick the primary or an active independent website. +Use five cron fields in UTC. For example, `*/15 * * * *` runs every 15 minutes. Runs must be at least five minutes apart. When both day fields are restricted, the date must match both. diff --git a/src/coulobre/hosting/templates/hosting/account_detail.html b/src/coulobre/hosting/templates/hosting/account_detail.html index aa62815..31eadae 100644 --- a/src/coulobre/hosting/templates/hosting/account_detail.html +++ b/src/coulobre/hosting/templates/hosting/account_detail.html @@ -96,7 +96,7 @@ Website files {% endif %} {% if manage_website_jobs %} - Scheduled jobs + Scheduled Tasks {% endif %} {% if manage_sftp %} SFTP access diff --git a/src/coulobre/hosting/templates/hosting/system_workspace.html b/src/coulobre/hosting/templates/hosting/system_workspace.html index 27e2ffd..a35f75d 100644 --- a/src/coulobre/hosting/templates/hosting/system_workspace.html +++ b/src/coulobre/hosting/templates/hosting/system_workspace.html @@ -13,10 +13,18 @@ {% empty %}No hosting accounts are available.{% endfor %} {% elif section == 'tasks' %} + {% if manageable_accounts %} +
+

Manage tasks by hosting account

+ +
+ {% endif %}
{% for job in tasks %} - + {% empty %}{% endfor %}
DomainTaskStatusNext run (UTC)
{{ job.domain }}{% if target %}{{ job.name }}{% else %}{{ job.name }}{% endif %}{{ job.enabled|yesno:"Enabled,Paused" }}{{ job.next_run_at|date:"j M Y H:i"|default:"—" }}
{{ job.domain }}{% if job.account_id in manageable_accounts %}{{ job.name }}{% else %}{{ job.name }}{% endif %}{{ job.enabled|yesno:"Enabled,Paused" }}{{ job.next_run_at|date:"j M Y H:i"|default:"—" }}
No scheduled tasks for these accounts.
{% else %} diff --git a/src/coulobre/hosting/templates/hosting/website_job_form.html b/src/coulobre/hosting/templates/hosting/website_job_form.html index e974886..4c52741 100644 --- a/src/coulobre/hosting/templates/hosting/website_job_form.html +++ b/src/coulobre/hosting/templates/hosting/website_job_form.html @@ -1,15 +1,16 @@ {% extends "hosting/workspace_page.html" %} -{% block title %}{% if job %}Edit{% else %}Add{% endif %} website job · Coulobre Panel{% endblock %} +{% block title %}{% if job %}Edit{% else %}Add{% endif %} task · Coulobre Panel{% endblock %} +{% block workspace_selector %}{% endblock %} {% block page_header %}
-

{% if job %}Edit{% else %}Add{% endif %} website job

- {% if job %}

{{ job.domain }}

{% endif %} +

{% if job %}Edit{% else %}Add{% endif %} task

+

{{ job.domain|default:account.primary_domain }}

{% endblock %} {% block page_context %} - ← Scheduled website jobs + ← Scheduled Tasks {% endblock %} {% block page_content %}
@@ -17,9 +18,9 @@ {% csrf_token %} {{ form.as_div }}
- + Cancel - {% if job %}{% endif %} + {% if job %}{% endif %}
diff --git a/src/coulobre/hosting/templates/hosting/website_jobs.html b/src/coulobre/hosting/templates/hosting/website_jobs.html index 8a6374b..0c2b117 100644 --- a/src/coulobre/hosting/templates/hosting/website_jobs.html +++ b/src/coulobre/hosting/templates/hosting/website_jobs.html @@ -1,31 +1,54 @@ {% extends "hosting/workspace_page.html" %} -{% block title %}Scheduled website jobs · Coulobre Panel{% endblock %} -{% block page_header %} -
-
-

Scheduled website jobs

-

{{ rows|length }} of {{ limit|default_if_none:"Unlimited" }} saved jobs

-
- {% if add_job %} - Add job - {% endif %} -
+{% block title %}Scheduled Tasks · Coulobre Panel{% endblock %} +{% block page_title %}Scheduled Tasks{% endblock %} +{% block page_metadata %} + {% if account %} +

{{ account.primary_domain }} · {{ rows|length }} saved · {% if limit is None %}Unlimited{% else %}{{ limit }} allowed{% endif %}

+ {% endif %} +{% endblock %} +{% block page_actions %} + {% if account and not creation_blocker %} + Add task + {% endif %} +{% endblock %} +{% block workspace_selector %} + {% include "hosting/workspace_account_selector.html" with account_workspace='tasks' workspace_selected=account.pk %} {% endblock %} {% block page_context %} - ← {{ account.name }} + {% if account %}← {{ account.name }}{% endif %} {% endblock %} {% block page_content %} -
+ {% if creation_blocker %} +

+ {% if creation_blocker == 'service' %} + Scheduled tasks are disabled on this server. + {% if request.user.is_superuser %}Open Operator Settings{% else %}Ask your hosting provider to enable them.{% endif %} + {% elif creation_blocker == 'suspended' %} + Hosting services are suspended. Resume them before adding a task. + {% elif creation_blocker == 'no-package' %} + This account has no hosting package. + {% if is_customer %}Ask your hosting provider to assign a package that allows scheduled tasks.{% else %}Assign a package that allows scheduled tasks.{% endif %} + {% elif creation_blocker == 'disabled-by-package' %} + This hosting package has a scheduled task limit of zero. + {% if is_customer %}Ask your hosting provider to increase the limit.{% else %}Increase the limit or assign a package that allows tasks.{% endif %} + {% elif creation_blocker == 'no-website' %} + An active website is required. Review your websites. + {% elif creation_blocker == 'limit' %} + This account has reached its scheduled task limit. Remove a saved task or {% if is_customer %}ask your hosting provider to increase the limit{% else %}increase the hosting package limit{% endif %}. + {% endif %} +

+ {% endif %} +
{% if rows %}
- + {% for job, available in rows %} - +
JobWebsiteSchedule (UTC)Next runLast result
TaskWebsiteSchedule (UTC)Next runLast result
{{ job.name }}{% if service_available %}{{ job.name }}{% else %}{{ job.name }}{% endif %} {{ job.domain }} {{ job.expression }} @@ -42,8 +65,10 @@
+ {% elif account %} +

No tasks have been scheduled for this account.

{% else %} -

No website jobs scheduled.

+

No hosting accounts are available. Contact your hosting provider to get started.

{% endif %}
{% endblock %} diff --git a/src/coulobre/hosting/templates/hosting/workspace_account_selector.html b/src/coulobre/hosting/templates/hosting/workspace_account_selector.html index ea07757..87f6e1f 100644 --- a/src/coulobre/hosting/templates/hosting/workspace_account_selector.html +++ b/src/coulobre/hosting/templates/hosting/workspace_account_selector.html @@ -1,5 +1,5 @@ {% if workspace_accounts %} -
+