Add timer/scheduler to ticket automation rules
Adds optional delay_days + delay_condition (no_activity) to ticket rules. When a ticket has no activity for X days, timed rules automatically apply actions (e.g., escalate priority to urgent). Checked on each ticket list load. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2342,6 +2342,10 @@ function renderRules() {
|
||||
if (r.set_priority) actions.push('Prioriteetti → ' + (priorityLabels[r.set_priority] || r.set_priority));
|
||||
if (r.set_tags) actions.push('Tagit: #' + r.set_tags.split(',').map(t => t.trim()).join(' #'));
|
||||
if (r.auto_close_days) actions.push('Auto-close: ' + r.auto_close_days + 'pv');
|
||||
if (r.delay_days && r.delay_condition) {
|
||||
const condLabel = r.delay_condition === 'no_activity' ? 'ei aktiviteettia' : r.delay_condition;
|
||||
actions.push('⏱ Ajastin: ' + r.delay_days + 'pv (' + condLabel + ')');
|
||||
}
|
||||
return `<div style="display:flex;justify-content:space-between;align-items:center;padding:0.75rem 1rem;background:${r.enabled ? '#f8f9fb' : '#fafafa'};border:1px solid #e8ebf0;border-radius:8px;margin-bottom:0.5rem;opacity:${r.enabled ? '1' : '0.5'};">
|
||||
<div>
|
||||
<div style="font-weight:600;color:#0f3460;font-size:0.9rem;">${esc(r.name)}</div>
|
||||
@@ -2373,6 +2377,8 @@ function showRuleForm(rule) {
|
||||
document.getElementById('rule-form-priority').value = rule ? (rule.set_priority || '') : '';
|
||||
document.getElementById('rule-form-tags').value = rule ? (rule.set_tags || '') : '';
|
||||
document.getElementById('rule-form-autoclose').value = rule ? (rule.auto_close_days || '') : '';
|
||||
document.getElementById('rule-form-delay-days').value = rule ? (rule.delay_days || '') : '';
|
||||
document.getElementById('rule-form-delay-condition').value = rule ? (rule.delay_condition || '') : '';
|
||||
editingRuleId = rule ? rule.id : null;
|
||||
}
|
||||
|
||||
@@ -2397,6 +2403,8 @@ document.getElementById('btn-save-rule').addEventListener('click', async () => {
|
||||
set_priority: document.getElementById('rule-form-priority').value,
|
||||
set_tags: document.getElementById('rule-form-tags').value.trim(),
|
||||
auto_close_days: parseInt(document.getElementById('rule-form-autoclose').value) || 0,
|
||||
delay_days: parseInt(document.getElementById('rule-form-delay-days').value) || 0,
|
||||
delay_condition: document.getElementById('rule-form-delay-condition').value,
|
||||
enabled: true,
|
||||
};
|
||||
const existingId = document.getElementById('rule-form-id').value;
|
||||
|
||||
Reference in New Issue
Block a user