fix: move reprocess button to transcript list item, remove from modal
This commit is contained in:
+16
-16
@@ -10,7 +10,6 @@ const modalTitle = document.getElementById('modal-title');
|
|||||||
const modalBody = document.getElementById('modal-body');
|
const modalBody = document.getElementById('modal-body');
|
||||||
const modalOpenBtn = document.getElementById('modal-open-btn');
|
const modalOpenBtn = document.getElementById('modal-open-btn');
|
||||||
const modalCloseBtn = document.getElementById('modal-close-btn');
|
const modalCloseBtn = document.getElementById('modal-close-btn');
|
||||||
const modalReprocessBtn = document.getElementById('modal-reprocess-btn');
|
|
||||||
let _modalPath = null;
|
let _modalPath = null;
|
||||||
let _modalFilename = null;
|
let _modalFilename = null;
|
||||||
|
|
||||||
@@ -69,20 +68,6 @@ modalOpenBtn.addEventListener('click', () => {
|
|||||||
if (_modalPath) apiFetch('/open', { method: 'POST', body: JSON.stringify({ path: _modalPath }) });
|
if (_modalPath) apiFetch('/open', { method: 'POST', body: JSON.stringify({ path: _modalPath }) });
|
||||||
});
|
});
|
||||||
|
|
||||||
modalReprocessBtn.addEventListener('click', async () => {
|
|
||||||
if (!_modalFilename) return;
|
|
||||||
modalReprocessBtn.disabled = true;
|
|
||||||
modalBody.textContent = 'Wird neu verarbeitet\u2026';
|
|
||||||
const instructions = instructionsEl.value;
|
|
||||||
const r = await apiFetch(`/transcripts/${encodeURIComponent(_modalFilename)}/reprocess`, {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ instructions }),
|
|
||||||
});
|
|
||||||
const md = await r.text();
|
|
||||||
modalBody.innerHTML = DOMPurify.sanitize(marked.parse(md));
|
|
||||||
modalReprocessBtn.disabled = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
instructionsEl.addEventListener('input', async () => {
|
instructionsEl.addEventListener('input', async () => {
|
||||||
await apiFetch('/instructions', {
|
await apiFetch('/instructions', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -145,6 +130,21 @@ async function loadTranscripts() {
|
|||||||
|
|
||||||
div.addEventListener('click', () => openModal(t.filename, t.path));
|
div.addEventListener('click', () => openModal(t.filename, t.path));
|
||||||
|
|
||||||
|
const reprocessBtn = document.createElement('button');
|
||||||
|
reprocessBtn.className = 'del-btn';
|
||||||
|
reprocessBtn.title = 'Neu verarbeiten';
|
||||||
|
reprocessBtn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 1 0 8 8h-2a6 6 0 1 1-1.76-4.24l-2.24 2.24H20V4l-2.35 2.35z"/></svg>';
|
||||||
|
reprocessBtn.addEventListener('click', async (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
reprocessBtn.disabled = true;
|
||||||
|
await apiFetch(`/transcripts/${encodeURIComponent(t.filename)}/reprocess`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({ instructions: instructionsEl.value }),
|
||||||
|
});
|
||||||
|
reprocessBtn.disabled = false;
|
||||||
|
loadTranscripts();
|
||||||
|
});
|
||||||
|
|
||||||
const delBtn = document.createElement('button');
|
const delBtn = document.createElement('button');
|
||||||
delBtn.className = 'del-btn';
|
delBtn.className = 'del-btn';
|
||||||
delBtn.title = 'Löschen';
|
delBtn.title = 'Löschen';
|
||||||
@@ -155,7 +155,7 @@ async function loadTranscripts() {
|
|||||||
loadTranscripts();
|
loadTranscripts();
|
||||||
});
|
});
|
||||||
|
|
||||||
div.append(name, meta, delBtn);
|
div.append(name, meta, reprocessBtn, delBtn);
|
||||||
return div;
|
return div;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -200,11 +200,6 @@
|
|||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<span id="modal-title" class="modal-title"></span>
|
<span id="modal-title" class="modal-title"></span>
|
||||||
<div class="modal-actions">
|
<div class="modal-actions">
|
||||||
<button id="modal-reprocess-btn" class="modal-btn" title="Neu verarbeiten">
|
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
||||||
<path d="M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 1 0 8 8h-2a6 6 0 1 1-1.76-4.24l-2.24 2.24H20V4l-2.35 2.35z"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<button id="modal-open-btn" class="modal-btn" title="Im Editor öffnen">
|
<button id="modal-open-btn" class="modal-btn" title="Im Editor öffnen">
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
||||||
<path d="M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42L17.59 5H14V3zm-1 2H5a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8h-2v8H5V7h8V5z"/>
|
<path d="M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42L17.59 5H14V3zm-1 2H5a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8h-2v8H5V7h8V5z"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user