diff --git a/.last-branch b/.last-branch index f1be705..9e27860 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260106-11-new-ticket-remove-description +v20260106-12-disable-ticket-and-remark-edit diff --git a/containers/backupchecks/src/templates/main/daily_jobs.html b/containers/backupchecks/src/templates/main/daily_jobs.html index 786a20b..4fc11a1 100644 --- a/containers/backupchecks/src/templates/main/daily_jobs.html +++ b/containers/backupchecks/src/templates/main/daily_jobs.html @@ -356,27 +356,13 @@ '
' + '🎫' + '' + escapeHtml(t.ticket_code || '') + '' + - '' + status + '' + + '' + status + '' + '
' + - (t.description ? ('
' + escapeHtml(t.description) + '
') : '') + '' + '
' + - '' + '' + '
' + '' + - '' + ''; }); html += ''; @@ -397,22 +383,9 @@ (r.body ? ('
' + escapeHtml(r.body) + '
') : '') + '' + '
' + - '' + '' + '
' + '' + - '' + ''; }); html += ''; @@ -427,8 +400,6 @@ var id = btn.getAttribute('data-id'); if (!action || !id) return; - var wrapper = btn.closest('[data-alert-type]'); - if (action === 'resolve-ticket') { if (!confirm('Mark ticket as resolved?')) return; apiJson('/api/tickets/' + encodeURIComponent(id) + '/resolve', {method: 'POST', body: '{}'}) @@ -439,59 +410,6 @@ apiJson('/api/remarks/' + encodeURIComponent(id) + '/resolve', {method: 'POST', body: '{}'}) .then(function () { loadAlerts(currentRunId); }) .catch(function (e) { alert(e.message || 'Failed.'); }); - } else if (action === 'toggle-edit-ticket') { - if (!wrapper) return; - var edit = wrapper.querySelector('[data-edit="ticket"]'); - if (!edit) return; - edit.style.display = (edit.style.display === 'none' || !edit.style.display) ? '' : 'none'; - } else if (action === 'toggle-edit-remark') { - if (!wrapper) return; - var edit2 = wrapper.querySelector('[data-edit="remark"]'); - if (!edit2) return; - edit2.style.display = (edit2.style.display === 'none' || !edit2.style.display) ? '' : 'none'; - } else if (action === 'cancel-edit') { - if (!wrapper) return; - var editAny = wrapper.querySelector('[data-edit]'); - if (editAny) editAny.style.display = 'none'; - } else if (action === 'save-ticket') { - if (!wrapper) return; - var editT = wrapper.querySelector('[data-edit="ticket"]'); - if (!editT) return; - var descEl = editT.querySelector('[data-field="description"]'); - var statusEl = editT.querySelector('[data-field="status"]'); - var descVal = descEl ? descEl.value : ''; - if (statusEl) statusEl.textContent = 'Saving...'; - apiJson('/api/tickets/' + encodeURIComponent(id), { - method: 'PATCH', - body: JSON.stringify({description: descVal}) - }) - .then(function () { loadAlerts(currentRunId); }) - .catch(function (e) { - if (statusEl) statusEl.textContent = e.message || 'Failed.'; - else alert(e.message || 'Failed.'); - }); - } else if (action === 'save-remark') { - if (!wrapper) return; - var editR = wrapper.querySelector('[data-edit="remark"]'); - if (!editR) return; - var bodyEl2 = editR.querySelector('[data-field="body"]'); - var statusEl2 = editR.querySelector('[data-field="status"]'); - var bodyVal2 = bodyEl2 ? bodyEl2.value : ''; - if (!bodyVal2 || !bodyVal2.trim()) { - if (statusEl2) statusEl2.textContent = 'Body is required.'; - else alert('Body is required.'); - return; - } - if (statusEl2) statusEl2.textContent = 'Saving...'; - apiJson('/api/remarks/' + encodeURIComponent(id), { - method: 'PATCH', - body: JSON.stringify({body: bodyVal2}) - }) - .then(function () { loadAlerts(currentRunId); }) - .catch(function (e) { - if (statusEl2) statusEl2.textContent = e.message || 'Failed.'; - else alert(e.message || 'Failed.'); - }); } }); }); diff --git a/containers/backupchecks/src/templates/main/run_checks.html b/containers/backupchecks/src/templates/main/run_checks.html index 8458c4c..171b4ca 100644 --- a/containers/backupchecks/src/templates/main/run_checks.html +++ b/containers/backupchecks/src/templates/main/run_checks.html @@ -669,25 +669,11 @@ table.addEventListener('change', function (e) { '' + escapeHtml(t.ticket_code || '') + '' + '' + status + '' + '' + - (t.description ? ('
' + escapeHtml(t.description) + '
') : '') + '' + '
' + - '' + '' + '
' + '' + - '' + ''; }); html += ''; @@ -696,34 +682,21 @@ table.addEventListener('change', function (e) { if (remarks.length) { html += '
Remarks
'; remarks.forEach(function (r) { - var status2 = r.resolved_at ? 'Resolved' : 'Active'; + var status = r.resolved_at ? 'Resolved' : 'Active'; html += '
' + '
' + '
' + '
' + '💬' + 'Remark' + - '' + status2 + '' + + '' + status + '' + '
' + (r.body ? ('
' + escapeHtml(r.body) + '
') : '') + '
' + '
' + - '' + '' + '
' + '
' + - '' + '
'; }); html += '
'; @@ -737,8 +710,6 @@ table.addEventListener('change', function (e) { var action = btn.getAttribute('data-action'); var id = btn.getAttribute('data-id'); if (!action || !id) return; - var wrapper = btn.closest('[data-alert-type]'); - if (action === 'resolve-ticket') { if (!confirm('Mark ticket as resolved?')) return; apiJson('/api/tickets/' + encodeURIComponent(id) + '/resolve', {method: 'POST', body: '{}'}) @@ -749,58 +720,6 @@ table.addEventListener('change', function (e) { apiJson('/api/remarks/' + encodeURIComponent(id) + '/resolve', {method: 'POST', body: '{}'}) .then(function () { loadAlerts(currentRunId); }) .catch(function (e) { alert(e.message || 'Failed.'); }); - } else if (action === 'toggle-edit-ticket') { - if (!wrapper) return; - var edit = wrapper.querySelector('[data-edit="ticket"]'); - if (!edit) return; - edit.style.display = (edit.style.display === 'none' || !edit.style.display) ? '' : 'none'; - } else if (action === 'toggle-edit-remark') { - if (!wrapper) return; - var edit2 = wrapper.querySelector('[data-edit="remark"]'); - if (!edit2) return; - edit2.style.display = (edit2.style.display === 'none' || !edit2.style.display) ? '' : 'none'; - } else if (action === 'cancel-edit') { - if (!wrapper) return; - var editAny = wrapper.querySelector('[data-edit]'); - if (editAny) editAny.style.display = 'none'; - } else if (action === 'save-ticket') { - if (!wrapper) return; - var editT = wrapper.querySelector('[data-edit="ticket"]'); - if (!editT) return; - var descEl = editT.querySelector('[data-field="description"]'); - var statusEl2 = editT.querySelector('[data-field="status"]'); - var descVal = descEl ? descEl.value : ''; - if (statusEl2) statusEl2.textContent = 'Saving...'; - apiJson('/api/tickets/' + encodeURIComponent(id), { - method: 'PATCH', - body: JSON.stringify({description: descVal}) - }) - .then(function () { loadAlerts(currentRunId); }) - .catch(function (e) { - if (statusEl2) statusEl2.textContent = e.message || 'Failed.'; - else alert(e.message || 'Failed.'); - }); - } else if (action === 'save-remark') { - if (!wrapper) return; - var editR = wrapper.querySelector('[data-edit="remark"]'); - if (!editR) return; - var bodyEl = editR.querySelector('[data-field="body"]'); - var statusEl3 = editR.querySelector('[data-field="status"]'); - var bodyVal = bodyEl ? bodyEl.value : ''; - if (!bodyVal || !bodyVal.trim()) { - if (statusEl3) statusEl3.textContent = 'Body is required.'; - return; - } - if (statusEl3) statusEl3.textContent = 'Saving...'; - apiJson('/api/remarks/' + encodeURIComponent(id), { - method: 'PATCH', - body: JSON.stringify({body: bodyVal}) - }) - .then(function () { loadAlerts(currentRunId); }) - .catch(function (e) { - if (statusEl3) statusEl3.textContent = e.message || 'Failed.'; - else alert(e.message || 'Failed.'); - }); } }); }); diff --git a/containers/backupchecks/src/templates/main/ticket_detail.html b/containers/backupchecks/src/templates/main/ticket_detail.html index 12869dd..32cd071 100644 --- a/containers/backupchecks/src/templates/main/ticket_detail.html +++ b/containers/backupchecks/src/templates/main/ticket_detail.html @@ -17,10 +17,7 @@ {% endif %} -
- -
{{ ticket.description or '' }}
-
+
{% if active_role in ['admin','operator'] %}
diff --git a/containers/backupchecks/src/templates/main/tickets.html b/containers/backupchecks/src/templates/main/tickets.html index 61d6b4e..33de980 100644 --- a/containers/backupchecks/src/templates/main/tickets.html +++ b/containers/backupchecks/src/templates/main/tickets.html @@ -45,7 +45,7 @@
- +
@@ -89,7 +89,7 @@ {{ t.start_date }} {{ t.resolved_at }} - View / Edit + View {% if t.active and t.job_id %} Job page {% endif %} @@ -144,7 +144,7 @@ {{ r.start_date }} {{ r.resolved_at }} - View / Edit + View {% if r.active and r.job_id %} Job page {% endif %} diff --git a/docs/changelog.md b/docs/changelog.md index 1771d84..dd4e5f2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -87,6 +87,14 @@ Removed an incorrectly indented redirect statement so the module loads correctly - Updated the ticket creation request to store only the ticket number (ticket_code) when creating a new ticket. - Backend /api/tickets (POST) now ignores any description input during ticket creation (use remarks for additional context). +--- + +## v20260106-12-disable-ticket-and-remark-edit +- Removed ticket edit UI actions (Daily Jobs, Run Checks, Tickets & Remarks overview). +- Removed remark edit UI actions (Daily Jobs, Run Checks, Tickets & Remarks overview). +- Removed ticket description display from ticket detail to prevent the field from reappearing. +- Kept resolve actions available for tickets and remarks. + ================================================================================================================================================ ## v0.1.16