feat #14740: link to the euvino admin backend
- Settings section "Backend": backend URL, login status checked live (logged in as / until, not logged in, backend unreachable), Anmelden / Neu anmelden, Abmelden and the link to the key management page - login window "backend-login": the backend's own login page in an incognito webview without any Tauri capability; after a page load behind the login, its cookies create a key (one request, never stored or logged), the key goes to the keyring, the window closes; closing it cancels; one login at a time, later requests wait for the same result - call detail: "Transkript hochladen" / "Erneut hochladen" (with a confirmation), "wird hochgeladen…", "Hochgeladen am … (ID …)" and inline errors; logs in first when there is no usable key - saving a different backend URL discards the key of the old backend Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
getRecordingState,
|
||||
listCalls,
|
||||
mergeSpeakers,
|
||||
onBackendLoginError,
|
||||
onCallEnded,
|
||||
onCallUpdated,
|
||||
onPromptChanged,
|
||||
@@ -18,13 +19,14 @@
|
||||
startManualRecording,
|
||||
transcribeCall,
|
||||
unmergeSpeaker,
|
||||
uploadTranscript,
|
||||
type CallDetail,
|
||||
type CallId,
|
||||
type CallListItem,
|
||||
type RecordingState,
|
||||
} from '../lib/api'
|
||||
import CallList from '../lib/CallList.svelte'
|
||||
import { formatDetailTime, formatMinutes } from '../lib/format'
|
||||
import { formatDateTime, formatDetailTime, formatMinutes } from '../lib/format'
|
||||
import StatusPill from '../lib/StatusPill.svelte'
|
||||
import TranscriptView from '../lib/TranscriptView.svelte'
|
||||
import UpdateBanner from '../lib/UpdateBanner.svelte'
|
||||
@@ -43,6 +45,12 @@
|
||||
let actionError = $state('')
|
||||
let busy = $state(false)
|
||||
|
||||
// Uploads run per call and may outlive the selection (the login can
|
||||
// take a while); their errors are kept per call too.
|
||||
let uploading = $state<CallId[]>([])
|
||||
let uploadErrors = $state<Record<CallId, string>>({})
|
||||
let confirmingUpload = $state(false)
|
||||
|
||||
let editingTitle = $state(false)
|
||||
let titleDraft = $state('')
|
||||
let savingTitle = $state(false)
|
||||
@@ -98,6 +106,7 @@
|
||||
actionError = ''
|
||||
editingTitle = false
|
||||
titleError = ''
|
||||
confirmingUpload = false
|
||||
refreshDetail()
|
||||
}
|
||||
|
||||
@@ -108,6 +117,7 @@
|
||||
actionError = ''
|
||||
editingTitle = false
|
||||
titleError = ''
|
||||
confirmingUpload = false
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
@@ -117,6 +127,10 @@
|
||||
if (id === selectedId) refreshDetail()
|
||||
}),
|
||||
onCallEnded(refreshList),
|
||||
// Creating the key failed; the login window stays open for another try.
|
||||
onBackendLoginError((msg) => {
|
||||
for (const id of uploading) uploadErrors[id] = msg
|
||||
}),
|
||||
onPromptChanged(refreshList),
|
||||
onRecordingState((state) => {
|
||||
recordingState = state
|
||||
@@ -178,6 +192,31 @@
|
||||
refreshList()
|
||||
})
|
||||
|
||||
/** "Transkript hochladen"; an upload done before asks first. */
|
||||
function uploadClick() {
|
||||
if (!detail) return
|
||||
if (detail.call.uploaded_at) confirmingUpload = true
|
||||
else upload()
|
||||
}
|
||||
|
||||
/** Uploads the shown call's transcript (logging in first if needed). */
|
||||
async function upload() {
|
||||
if (!detail) return
|
||||
const id = detail.call.id
|
||||
confirmingUpload = false
|
||||
if (uploading.includes(id)) return
|
||||
uploading = [...uploading, id]
|
||||
delete uploadErrors[id]
|
||||
try {
|
||||
await uploadTranscript(id)
|
||||
delete uploadErrors[id]
|
||||
} catch (err) {
|
||||
uploadErrors[id] = errorText(err)
|
||||
} finally {
|
||||
uploading = uploading.filter((u) => u !== id)
|
||||
}
|
||||
}
|
||||
|
||||
async function rename(speakerKey: string, name: string) {
|
||||
if (!detail) return
|
||||
await renameSpeaker(detail.call.id, speakerKey, name)
|
||||
@@ -303,6 +342,11 @@
|
||||
<p class="error">{titleError}</p>
|
||||
{/if}
|
||||
<div class="toolbar">
|
||||
{#if call.status === 'done' && call.uploaded_at}
|
||||
<span class="muted uploaded">
|
||||
Hochgeladen am {formatDateTime(call.uploaded_at)} (ID {call.crm_transcript_id})
|
||||
</span>
|
||||
{/if}
|
||||
<span class="actions">
|
||||
{#if call.status === 'awaiting_decision'}
|
||||
<button class="btn primary" disabled={busy} onclick={transcribe}>Transkribieren</button>
|
||||
@@ -310,16 +354,32 @@
|
||||
{:else if call.status === 'failed'}
|
||||
<button class="btn primary" disabled={busy} onclick={retry}>Erneut versuchen</button>
|
||||
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
||||
{:else if call.status === 'done' && confirmingUpload}
|
||||
<span class="confirm">Dieses Transkript wurde bereits hochgeladen. Nochmal hochladen?</span>
|
||||
<button class="btn primary" onclick={upload}>Hochladen</button>
|
||||
<button class="btn" onclick={() => (confirmingUpload = false)}>Abbrechen</button>
|
||||
{:else if call.status === 'done'}
|
||||
<span title="Kommt in einer späteren Version">
|
||||
<button class="btn" disabled>In Kundenakte speichern</button>
|
||||
</span>
|
||||
<button
|
||||
class="btn primary"
|
||||
disabled={!call.transcribed_at || uploading.includes(call.id)}
|
||||
title={call.transcribed_at ? 'Transkript ins CRM hochladen' : 'Noch kein Transkript'}
|
||||
onclick={uploadClick}
|
||||
>
|
||||
{uploading.includes(call.id)
|
||||
? 'wird hochgeladen…'
|
||||
: call.uploaded_at
|
||||
? 'Erneut hochladen'
|
||||
: 'Transkript hochladen'}
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
{#if shownActionError}
|
||||
<p class="error">{shownActionError}</p>
|
||||
{/if}
|
||||
{#if uploadErrors[call.id]}
|
||||
<p class="error">{uploadErrors[call.id]}</p>
|
||||
{/if}
|
||||
</header>
|
||||
|
||||
<div class="body">
|
||||
@@ -496,10 +556,17 @@
|
||||
|
||||
.actions {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.uploaded,
|
||||
.confirm {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.detail-header .error {
|
||||
margin: 10px 0 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user