Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a45d20f46 | ||
|
|
802a6f81fd | ||
|
|
0ae6ed304f | ||
|
|
183c135b1d | ||
|
|
299c93f8d6 | ||
|
|
36cefaab5f | ||
|
|
697f13e13a |
Generated
+1
-1
@@ -445,7 +445,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "call-recorder"
|
name = "call-recorder"
|
||||||
version = "0.2.2"
|
version = "0.2.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ pub struct CallListItem {
|
|||||||
/// Whole seconds from start to end; 0 while recording.
|
/// Whole seconds from start to end; 0 while recording.
|
||||||
pub duration_secs: i64,
|
pub duration_secs: i64,
|
||||||
pub status: CallStatus,
|
pub status: CallStatus,
|
||||||
|
/// What the status pill shows and whether the row needs the user's
|
||||||
|
/// attention — see [`ListState`]. Computed from `status` and
|
||||||
|
/// [`uploaded_here`] so the UI does not re-implement the rule.
|
||||||
|
pub list_state: ListState,
|
||||||
|
/// Whether this row needs the user to act on it (the dot in
|
||||||
|
/// `CallList.svelte` and the sidebar header's "N offen" count). Equal
|
||||||
|
/// to `list_state.needs_action()`, kept as its own field so the UI
|
||||||
|
/// does not need to know `ListState`'s variants to filter by it.
|
||||||
|
pub needs_action: bool,
|
||||||
pub interrupted: bool,
|
pub interrupted: bool,
|
||||||
/// The name the user gave the call, if any.
|
/// The name the user gave the call, if any.
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
@@ -35,12 +44,15 @@ impl CallListItem {
|
|||||||
/// row. Nothing is deleted; the fields are just not shown as set.
|
/// row. Nothing is deleted; the fields are just not shown as set.
|
||||||
pub fn of(call: &Call, backend_url: &str) -> Self {
|
pub fn of(call: &Call, backend_url: &str) -> Self {
|
||||||
let uploaded = uploaded_here(call, backend_url);
|
let uploaded = uploaded_here(call, backend_url);
|
||||||
|
let list_state = ListState::of(call.status, uploaded);
|
||||||
Self {
|
Self {
|
||||||
id: call.id,
|
id: call.id,
|
||||||
app: call.app.clone(),
|
app: call.app.clone(),
|
||||||
started_at: call.started_at,
|
started_at: call.started_at,
|
||||||
duration_secs: duration_secs(call),
|
duration_secs: duration_secs(call),
|
||||||
status: call.status,
|
status: call.status,
|
||||||
|
list_state,
|
||||||
|
needs_action: list_state.needs_action(),
|
||||||
interrupted: call.interrupted,
|
interrupted: call.interrupted,
|
||||||
title: call.title.clone(),
|
title: call.title.clone(),
|
||||||
crm_transcript_id: if uploaded {
|
crm_transcript_id: if uploaded {
|
||||||
@@ -53,6 +65,45 @@ impl CallListItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// What the call list row (and the detail header's pill) shows about a
|
||||||
|
/// call's status. Mirrors [`CallStatus`] one-to-one, except that `Done`
|
||||||
|
/// splits in two: a call is only ever shown as done ("fertig") once its
|
||||||
|
/// transcript has actually reached *this build's* backend ([`uploaded_here`]);
|
||||||
|
/// otherwise — never uploaded, or uploaded to a different backend — it is
|
||||||
|
/// `ReadyToUpload` ("bereit zum Hochladen"), because from this build's
|
||||||
|
/// point of view the CRM has not seen it yet.
|
||||||
|
#[derive(Serialize, Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum ListState {
|
||||||
|
Recording,
|
||||||
|
AwaitingDecision,
|
||||||
|
Processing,
|
||||||
|
Failed,
|
||||||
|
Done,
|
||||||
|
ReadyToUpload,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ListState {
|
||||||
|
fn of(status: CallStatus, uploaded_here: bool) -> Self {
|
||||||
|
match status {
|
||||||
|
CallStatus::Recording => ListState::Recording,
|
||||||
|
CallStatus::AwaitingDecision => ListState::AwaitingDecision,
|
||||||
|
CallStatus::Processing => ListState::Processing,
|
||||||
|
CallStatus::Failed => ListState::Failed,
|
||||||
|
CallStatus::Done if uploaded_here => ListState::Done,
|
||||||
|
CallStatus::Done => ListState::ReadyToUpload,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Whether a row in this state needs the user to act on it: not yet
|
||||||
|
/// transcribed, or transcribed but not uploaded here. Excludes
|
||||||
|
/// `Failed` (already shown in red) and the transient
|
||||||
|
/// `Recording`/`Processing` states.
|
||||||
|
pub fn needs_action(self) -> bool {
|
||||||
|
matches!(self, ListState::AwaitingDecision | ListState::ReadyToUpload)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Whole seconds from `started_at` to `ended_at`; 0 while the call has not
|
/// Whole seconds from `started_at` to `ended_at`; 0 while the call has not
|
||||||
/// ended (and never negative).
|
/// ended (and never negative).
|
||||||
pub fn duration_secs(call: &Call) -> i64 {
|
pub fn duration_secs(call: &Call) -> i64 {
|
||||||
@@ -318,6 +369,8 @@ mod tests {
|
|||||||
started_at: at(10, 14, 0),
|
started_at: at(10, 14, 0),
|
||||||
duration_secs: 60,
|
duration_secs: 60,
|
||||||
status: CallStatus::AwaitingDecision,
|
status: CallStatus::AwaitingDecision,
|
||||||
|
list_state: ListState::AwaitingDecision,
|
||||||
|
needs_action: true,
|
||||||
interrupted: true,
|
interrupted: true,
|
||||||
title: None,
|
title: None,
|
||||||
crm_transcript_id: None,
|
crm_transcript_id: None,
|
||||||
@@ -351,6 +404,64 @@ mod tests {
|
|||||||
assert!(uploaded_here(&c, BACKEND));
|
assert!(uploaded_here(&c, BACKEND));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn done_is_fertig_only_once_uploaded_to_this_backend() {
|
||||||
|
let mut c = call(Some(at(10, 15, 0)));
|
||||||
|
c.status = CallStatus::Done;
|
||||||
|
|
||||||
|
// Never uploaded.
|
||||||
|
assert_eq!(
|
||||||
|
CallListItem::of(&c, BACKEND).list_state,
|
||||||
|
ListState::ReadyToUpload
|
||||||
|
);
|
||||||
|
|
||||||
|
// Uploaded, but to a different backend.
|
||||||
|
c.crm_transcript_id = Some("4711".into());
|
||||||
|
c.crm_base_url = Some(OTHER_BACKEND.into());
|
||||||
|
assert_eq!(
|
||||||
|
CallListItem::of(&c, BACKEND).list_state,
|
||||||
|
ListState::ReadyToUpload
|
||||||
|
);
|
||||||
|
|
||||||
|
// Uploaded to this build's backend.
|
||||||
|
c.crm_base_url = Some(BACKEND.into());
|
||||||
|
assert_eq!(CallListItem::of(&c, BACKEND).list_state, ListState::Done);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn needs_action_marks_awaiting_and_ready_to_upload_only() {
|
||||||
|
let mut c = call(Some(at(10, 15, 0)));
|
||||||
|
|
||||||
|
c.status = CallStatus::AwaitingDecision;
|
||||||
|
assert!(CallListItem::of(&c, BACKEND).needs_action, "awaiting");
|
||||||
|
|
||||||
|
c.status = CallStatus::Done;
|
||||||
|
assert!(
|
||||||
|
CallListItem::of(&c, BACKEND).needs_action,
|
||||||
|
"done, never uploaded"
|
||||||
|
);
|
||||||
|
|
||||||
|
for status in [
|
||||||
|
CallStatus::Processing,
|
||||||
|
CallStatus::Failed,
|
||||||
|
CallStatus::Recording,
|
||||||
|
] {
|
||||||
|
c.status = status;
|
||||||
|
assert!(
|
||||||
|
!CallListItem::of(&c, BACKEND).needs_action,
|
||||||
|
"{status:?} must not show the dot"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
c.status = CallStatus::Done;
|
||||||
|
c.crm_transcript_id = Some("4711".into());
|
||||||
|
c.crm_base_url = Some(BACKEND.into());
|
||||||
|
assert!(
|
||||||
|
!CallListItem::of(&c, BACKEND).needs_action,
|
||||||
|
"done and uploaded here"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn an_upload_to_another_backend_is_hidden_from_the_list_item() {
|
fn an_upload_to_another_backend_is_hidden_from_the_list_item() {
|
||||||
// Uploaded to OTHER_BACKEND; this build's backend is BACKEND: the
|
// Uploaded to OTHER_BACKEND; this build's backend is BACKEND: the
|
||||||
@@ -503,6 +614,8 @@ mod tests {
|
|||||||
"started_at": serde_json::to_value(at(10, 14, 0)).unwrap(),
|
"started_at": serde_json::to_value(at(10, 14, 0)).unwrap(),
|
||||||
"duration_secs": 60,
|
"duration_secs": 60,
|
||||||
"status": "failed",
|
"status": "failed",
|
||||||
|
"list_state": "failed",
|
||||||
|
"needs_action": false,
|
||||||
"interrupted": false,
|
"interrupted": false,
|
||||||
"title": "Reklamation",
|
"title": "Reklamation",
|
||||||
"crm_transcript_id": null,
|
"crm_transcript_id": null,
|
||||||
|
|||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.1",
|
"version": "0.2.3",
|
||||||
"pub_date": "2026-11-06T14:48:27Z",
|
"pub_date": "2026-11-09T13:59:09Z",
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"windows-x86_64": {
|
"windows-x86_64": {
|
||||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVUdGpRa1ZvalU2SU9ZeUN6RUpYcjNFQ0VFTTZrZFpEa255SkRib0JtMVE4aEdVOG9ack5valRJdVAwZy9wcHZ2a1JFUHREZmJGT21Yd2hNOTh2TmMwSTVYRlRhQ1NqREFZPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzkzOTc2NDgwCWZpbGU6R2VzcHLDpGNoc3Jla29yZGVyXzAuMi4xX3g2NC1zZXR1cC5leGUJdmVyc2lvbjowLjIuMQplYUZLR25PZVk0dm4xZUczMElNYlpYeEZ5Um9VbTgwbEJKUmQwU2l1QkZPUE9Bdy9sd1FIUHAyb0MyeEZlemkxaktwM0VBd05PZDBRV3NYWTVOSmlBQT09Cg==",
|
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVUdGpRa1ZvalU2SUVjMGZZenR3QnZJN001NFBrcm41UnFQQUZPcXVZaXFyem43b3ZkR0dsTG9MQWR2aWxuWVdyVnlSb3lUN1hmZ0hqR0w4VkVRT2hNSlZqZit2bWc5a0E0PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzk0MjMyNzIzCWZpbGU6R2VzcHLDpGNoc3Jla29yZGVyXzAuMi4zX3g2NC1zZXR1cC5leGUJdmVyc2lvbjowLjIuMwpkUWd5TS81eko5bDFMWm81YURPb3o2U1Z2NEtVQmM2L21XOW02MUhSVmE5WDdpNGVFR01VNkljRmNhREpuUUw2eXp2WXJSL1llM3FvZUtnMXhDakVDUT09Cg==",
|
||||||
"url": "https://gitea.euvino.eu/public/call-recorder/releases/download/v0.2.1/Gespraechsrekorder_0.2.1_x64-setup.exe"
|
"url": "https://gitea.euvino.eu/public/call-recorder/releases/download/v0.2.3/Gespraechsrekorder_0.2.3_x64-setup.exe"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "call-recorder"
|
name = "call-recorder"
|
||||||
version = "0.2.2"
|
version = "0.2.4"
|
||||||
description = "Gesprächsrekorder desktop app"
|
description = "Gesprächsrekorder desktop app"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|||||||
+75
-8
@@ -37,6 +37,7 @@ const MANUAL_APP: &str = "Manuell";
|
|||||||
const TEST_DURATION: Duration = Duration::from_secs(5);
|
const TEST_DURATION: Duration = Duration::from_secs(5);
|
||||||
const TEST_POLL: Duration = Duration::from_millis(50);
|
const TEST_POLL: Duration = Duration::from_millis(50);
|
||||||
const ALREADY_PROCESSING: &str = "Wird bereits verarbeitet";
|
const ALREADY_PROCESSING: &str = "Wird bereits verarbeitet";
|
||||||
|
const ALREADY_UPLOADING: &str = "Wird bereits hochgeladen";
|
||||||
|
|
||||||
/// Why [`AppState::discard_call`] refused.
|
/// Why [`AppState::discard_call`] refused.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
@@ -362,7 +363,7 @@ impl AppState {
|
|||||||
pub fn claim_upload(&self, id: CallId) -> Result<UploadClaim<'_>, String> {
|
pub fn claim_upload(&self, id: CallId) -> Result<UploadClaim<'_>, String> {
|
||||||
let mut uploading = lock(&self.uploading);
|
let mut uploading = lock(&self.uploading);
|
||||||
if uploading.contains(&id) {
|
if uploading.contains(&id) {
|
||||||
return Err("Wird bereits hochgeladen".to_string());
|
return Err(ALREADY_UPLOADING.to_string());
|
||||||
}
|
}
|
||||||
if lock(&self.upload_confirmed_unsaved).contains(&id) {
|
if lock(&self.upload_confirmed_unsaved).contains(&id) {
|
||||||
return Err("Bereits hochgeladen".to_string());
|
return Err("Bereits hochgeladen".to_string());
|
||||||
@@ -712,11 +713,15 @@ impl AppState {
|
|||||||
.ok_or_else(|| "Gespräch nicht gefunden".to_string())
|
.ok_or_else(|| "Gespräch nicht gefunden".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Deletes a finished call: both audio files and the row, and takes it
|
/// Deletes a finished (or still undecided/failed) call: both audio files
|
||||||
/// out of the prompt queue. Returns how many calls still wait for the
|
/// and the row, cascading to its segments, speaker names, merges and
|
||||||
/// prompt. A call that is being processed, or whose DeepScript jobs
|
/// recorded remote jobs — this is also how a transcribed (`Done`) call's
|
||||||
/// are still on record ([`DiscardError::CleanupPending`]), is not
|
/// "Löschen" removes it. Takes it out of the prompt queue and returns how
|
||||||
/// deleted.
|
/// many calls still wait for it. Refused while the call is being
|
||||||
|
/// recorded, processed ([`AppState::claim_processing`]/
|
||||||
|
/// [`AppState::reserve_processing`] or status `Processing`), uploaded
|
||||||
|
/// ([`AppState::claim_upload`]), or while its DeepScript jobs are still
|
||||||
|
/// on record ([`DiscardError::CleanupPending`]).
|
||||||
pub fn discard_call(&self, id: CallId) -> Result<usize, DiscardError> {
|
pub fn discard_call(&self, id: CallId) -> Result<usize, DiscardError> {
|
||||||
if lock(&self.current)
|
if lock(&self.current)
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@@ -724,11 +729,17 @@ impl AppState {
|
|||||||
{
|
{
|
||||||
return Err("Das Gespräch wird gerade aufgenommen".to_string().into());
|
return Err("Das Gespräch wird gerade aufgenommen".to_string().into());
|
||||||
}
|
}
|
||||||
// Held until the call is gone, so no run can claim it meanwhile.
|
// Both held until the call is gone, so neither a pipeline run nor an
|
||||||
|
// upload can claim it meanwhile (same uploading -> store lock order
|
||||||
|
// as `claim_upload`, so this can never deadlock against it).
|
||||||
let processing = lock(&self.processing);
|
let processing = lock(&self.processing);
|
||||||
if processing.contains(&id) {
|
if processing.contains(&id) {
|
||||||
return Err(ALREADY_PROCESSING.to_string().into());
|
return Err(ALREADY_PROCESSING.to_string().into());
|
||||||
}
|
}
|
||||||
|
let uploading = lock(&self.uploading);
|
||||||
|
if uploading.contains(&id) {
|
||||||
|
return Err(ALREADY_UPLOADING.to_string().into());
|
||||||
|
}
|
||||||
let call = self
|
let call = self
|
||||||
.store
|
.store
|
||||||
.get_call(id)
|
.get_call(id)
|
||||||
@@ -742,7 +753,8 @@ impl AppState {
|
|||||||
return Err(DiscardError::CleanupPending);
|
return Err(DiscardError::CleanupPending);
|
||||||
}
|
}
|
||||||
// Files first: if one cannot be deleted, the row stays so the user
|
// Files first: if one cannot be deleted, the row stays so the user
|
||||||
// can try again instead of leaving orphaned audio behind.
|
// can try again instead of leaving orphaned audio behind. Already
|
||||||
|
// gone (e.g. removed by retention) is not an error.
|
||||||
for path in [&call.mic_path, &call.out_path] {
|
for path in [&call.mic_path, &call.out_path] {
|
||||||
if path.as_os_str().is_empty() {
|
if path.as_os_str().is_empty() {
|
||||||
continue;
|
continue;
|
||||||
@@ -768,6 +780,7 @@ impl AppState {
|
|||||||
}
|
}
|
||||||
return Err(format!("Gespräch konnte nicht gelöscht werden: {e}").into());
|
return Err(format!("Gespräch konnte nicht gelöscht werden: {e}").into());
|
||||||
}
|
}
|
||||||
|
drop(uploading);
|
||||||
drop(processing);
|
drop(processing);
|
||||||
Ok(self.prompts_waiting())
|
Ok(self.prompts_waiting())
|
||||||
}
|
}
|
||||||
@@ -1147,6 +1160,60 @@ mod tests {
|
|||||||
assert!(f.state.reserve_processing(id));
|
assert!(f.state.reserve_processing(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_transcribed_call_is_deleted_like_any_other() {
|
||||||
|
let f = fixture();
|
||||||
|
let (id, mic, out) = finished_call(&f, "a");
|
||||||
|
f.state
|
||||||
|
.store
|
||||||
|
.set_status(id, CallStatus::Done, None)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(f.state.discard_call(id), Ok(0));
|
||||||
|
assert!(!mic.exists());
|
||||||
|
assert!(!out.exists());
|
||||||
|
assert_eq!(f.state.store.get_call(id).unwrap(), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_call_being_uploaded_is_not_discarded() {
|
||||||
|
let f = fixture();
|
||||||
|
let (id, mic, out) = finished_call(&f, "a");
|
||||||
|
f.state
|
||||||
|
.store
|
||||||
|
.set_status(id, CallStatus::Done, None)
|
||||||
|
.unwrap();
|
||||||
|
let claim = f.state.claim_upload(id).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
f.state.discard_call(id),
|
||||||
|
Err(DiscardError::Other("Wird bereits hochgeladen".to_string()))
|
||||||
|
);
|
||||||
|
assert!(mic.exists());
|
||||||
|
assert!(out.exists());
|
||||||
|
assert!(f.state.store.get_call(id).unwrap().is_some());
|
||||||
|
|
||||||
|
// Once the upload is done, the delete goes through.
|
||||||
|
drop(claim);
|
||||||
|
assert_eq!(f.state.discard_call(id), Ok(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_call_already_uploaded_here_is_deleted_without_touching_the_crm() {
|
||||||
|
let f = fixture();
|
||||||
|
let (id, mic, out) = finished_call(&f, "a");
|
||||||
|
f.state
|
||||||
|
.store
|
||||||
|
.set_status(id, CallStatus::Done, None)
|
||||||
|
.unwrap();
|
||||||
|
f.state.mark_uploaded(id, "4711").unwrap();
|
||||||
|
|
||||||
|
assert_eq!(f.state.discard_call(id), Ok(0));
|
||||||
|
assert!(!mic.exists());
|
||||||
|
assert!(!out.exists());
|
||||||
|
assert_eq!(f.state.store.get_call(id).unwrap(), None);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_cleanup_reserves_a_call_of_any_status() {
|
fn a_cleanup_reserves_a_call_of_any_status() {
|
||||||
let f = fixture();
|
let f = fixture();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Gesprächsrekorder",
|
"productName": "Gesprächsrekorder",
|
||||||
"version": "0.2.2",
|
"version": "0.2.4",
|
||||||
"identifier": "eu.euvino.callrecorder",
|
"identifier": "eu.euvino.callrecorder",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../ui/dist",
|
"frontendDist": "../ui/dist",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ui",
|
"name": "ui",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.2.2",
|
"version": "0.2.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -28,12 +28,15 @@
|
|||||||
aria-current={call.id === selectedId}
|
aria-current={call.id === selectedId}
|
||||||
onclick={() => onselect(call.id)}
|
onclick={() => onselect(call.id)}
|
||||||
>
|
>
|
||||||
|
{#if call.needs_action}
|
||||||
|
<span class="dot" title="Offen" aria-label="Offen"></span>
|
||||||
|
{/if}
|
||||||
<span class="title">{call.title ?? appLine(call)}</span>
|
<span class="title">{call.title ?? appLine(call)}</span>
|
||||||
<span class="meta">
|
<span class="meta">
|
||||||
<span class="muted">
|
<span class="muted">
|
||||||
{call.title ? `${appLine(call)} · ` : ''}{formatListTime(call.started_at)}
|
{call.title ? `${appLine(call)} · ` : ''}{formatListTime(call.started_at)}
|
||||||
</span>
|
</span>
|
||||||
<StatusPill status={call.status} interrupted={call.interrupted} />
|
<StatusPill state={call.list_state} interrupted={call.interrupted} />
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
@@ -53,11 +56,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 9px 10px;
|
padding: 9px 10px 9px 18px;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: none;
|
background: none;
|
||||||
@@ -67,6 +71,20 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
position: absolute;
|
||||||
|
left: 7px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--primary);
|
||||||
|
/* A thin ring so the dot stays visible against the selected row's
|
||||||
|
primary-soft background (and the hover background). */
|
||||||
|
box-shadow: 0 0 0 2px var(--surface);
|
||||||
|
}
|
||||||
|
|
||||||
.row:hover {
|
.row:hover {
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { CallStatus } from './api'
|
import type { ListState } from './api'
|
||||||
|
|
||||||
let { status, interrupted = false }: { status: CallStatus; interrupted?: boolean } = $props()
|
let { state, interrupted = false }: { state: ListState; interrupted?: boolean } = $props()
|
||||||
|
|
||||||
const pills: Record<CallStatus, { text: string; kind: string }> = {
|
const pills: Record<ListState, { text: string; kind: string }> = {
|
||||||
done: { text: 'fertig', kind: 'done' },
|
done: { text: 'fertig', kind: 'done' },
|
||||||
|
ready_to_upload: { text: 'bereit zum Hochladen', kind: 'ready' },
|
||||||
processing: { text: 'wird verarbeitet…', kind: 'processing' },
|
processing: { text: 'wird verarbeitet…', kind: 'processing' },
|
||||||
awaiting_decision: { text: 'nicht transkribiert', kind: 'awaiting' },
|
awaiting_decision: { text: 'nicht transkribiert', kind: 'awaiting' },
|
||||||
failed: { text: 'fehlgeschlagen', kind: 'failed' },
|
failed: { text: 'fehlgeschlagen', kind: 'failed' },
|
||||||
recording: { text: 'Aufnahme läuft', kind: 'recording' },
|
recording: { text: 'Aufnahme läuft', kind: 'recording' },
|
||||||
}
|
}
|
||||||
|
|
||||||
let pill = $derived(pills[status])
|
let pill = $derived(pills[state])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span class="pill status {pill.kind}">
|
<span class="pill status {pill.kind}">
|
||||||
{pill.text}{#if interrupted && status === 'awaiting_decision'}, unterbrochen{/if}
|
{pill.text}{#if interrupted && state === 'awaiting_decision'}, unterbrochen{/if}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -28,6 +29,11 @@
|
|||||||
color: var(--ok);
|
color: var(--ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ready {
|
||||||
|
background: var(--primary-soft);
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
.processing {
|
.processing {
|
||||||
background: #fff4d6;
|
background: #fff4d6;
|
||||||
color: #8a6100;
|
color: #8a6100;
|
||||||
|
|||||||
@@ -79,6 +79,18 @@ export interface PendingPrompt extends CallBrief {
|
|||||||
|
|
||||||
export type CallStatus = 'recording' | 'awaiting_decision' | 'processing' | 'done' | 'failed'
|
export type CallStatus = 'recording' | 'awaiting_decision' | 'processing' | 'done' | 'failed'
|
||||||
|
|
||||||
|
/** What the status pill shows and whether the row needs the user's
|
||||||
|
* attention. Mirrors `CallStatus`, except `done` splits into `done`
|
||||||
|
* (uploaded to this build's backend — "fertig") and `ready_to_upload`
|
||||||
|
* (not uploaded here yet — "bereit zum Hochladen"). */
|
||||||
|
export type ListState =
|
||||||
|
| 'recording'
|
||||||
|
| 'awaiting_decision'
|
||||||
|
| 'processing'
|
||||||
|
| 'failed'
|
||||||
|
| 'done'
|
||||||
|
| 'ready_to_upload'
|
||||||
|
|
||||||
/** A row of the main window's call list. Times are RFC 3339. */
|
/** A row of the main window's call list. Times are RFC 3339. */
|
||||||
export interface CallListItem {
|
export interface CallListItem {
|
||||||
id: CallId
|
id: CallId
|
||||||
@@ -87,6 +99,10 @@ export interface CallListItem {
|
|||||||
/** 0 while recording. */
|
/** 0 while recording. */
|
||||||
duration_secs: number
|
duration_secs: number
|
||||||
status: CallStatus
|
status: CallStatus
|
||||||
|
list_state: ListState
|
||||||
|
/** Whether this row needs the user to act on it (the dot in the list,
|
||||||
|
* counted in the sidebar header's "N offen"). */
|
||||||
|
needs_action: boolean
|
||||||
interrupted: boolean
|
interrupted: boolean
|
||||||
/** The name the user gave the call, if any. */
|
/** The name the user gave the call, if any. */
|
||||||
title: string | null
|
title: string | null
|
||||||
|
|||||||
+166
-8
@@ -45,6 +45,12 @@
|
|||||||
let actionError = $state('')
|
let actionError = $state('')
|
||||||
let busy = $state(false)
|
let busy = $state(false)
|
||||||
|
|
||||||
|
// "Löschen" (transcribed calls): confirmed with a dialog instead of
|
||||||
|
// running straight away like the other actions.
|
||||||
|
let deleteDialogOpen = $state(false)
|
||||||
|
let deleteBusy = $state(false)
|
||||||
|
let deleteError = $state('')
|
||||||
|
|
||||||
// Uploads run per call and may outlive the selection (the login can
|
// Uploads run per call and may outlive the selection (the login can
|
||||||
// take a while); their errors are kept per call too.
|
// take a while); their errors are kept per call too.
|
||||||
let uploading = $state<CallId[]>([])
|
let uploading = $state<CallId[]>([])
|
||||||
@@ -105,6 +111,8 @@
|
|||||||
actionError = ''
|
actionError = ''
|
||||||
editingTitle = false
|
editingTitle = false
|
||||||
titleError = ''
|
titleError = ''
|
||||||
|
deleteDialogOpen = false
|
||||||
|
deleteError = ''
|
||||||
refreshDetail()
|
refreshDetail()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +123,8 @@
|
|||||||
actionError = ''
|
actionError = ''
|
||||||
editingTitle = false
|
editingTitle = false
|
||||||
titleError = ''
|
titleError = ''
|
||||||
|
deleteDialogOpen = false
|
||||||
|
deleteError = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@@ -189,6 +199,49 @@
|
|||||||
refreshList()
|
refreshList()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** "Löschen" on a transcribed call: asks for confirmation first. */
|
||||||
|
function askDelete() {
|
||||||
|
deleteError = ''
|
||||||
|
deleteDialogOpen = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelDelete() {
|
||||||
|
deleteDialogOpen = false
|
||||||
|
deleteError = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Confirmed delete: same backend path as "Verwerfen" (`discard_call`).
|
||||||
|
* On success the selection moves to the next call in the list, or clears
|
||||||
|
* if none is left. */
|
||||||
|
async function confirmDelete() {
|
||||||
|
if (!detail) return
|
||||||
|
const id = detail.call.id
|
||||||
|
deleteBusy = true
|
||||||
|
try {
|
||||||
|
await discardCall(id)
|
||||||
|
deleteDialogOpen = false
|
||||||
|
selectAfterDelete(id)
|
||||||
|
refreshList()
|
||||||
|
} catch (err) {
|
||||||
|
deleteError = errorText(err)
|
||||||
|
} finally {
|
||||||
|
deleteBusy = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Selects the call that took `deletedId`'s place in the list (or the one
|
||||||
|
* before it, if `deletedId` was last), else clears the selection. */
|
||||||
|
function selectAfterDelete(deletedId: CallId) {
|
||||||
|
const index = calls.findIndex((c) => c.id === deletedId)
|
||||||
|
const remaining = calls.filter((c) => c.id !== deletedId)
|
||||||
|
if (remaining.length === 0) {
|
||||||
|
clearSelection()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const next = remaining[Math.min(Math.max(index, 0), remaining.length - 1)]
|
||||||
|
select(next.id)
|
||||||
|
}
|
||||||
|
|
||||||
/** Uploads the shown call's transcript (logging in first if needed). A
|
/** Uploads the shown call's transcript (logging in first if needed). A
|
||||||
* call already uploaded has no button any more: the CRM never gets a
|
* call already uploaded has no button any more: the CRM never gets a
|
||||||
* duplicate. */
|
* duplicate. */
|
||||||
@@ -273,13 +326,17 @@
|
|||||||
// A failed start (e.g. missing key) also marks the call failed; its
|
// A failed start (e.g. missing key) also marks the call failed; its
|
||||||
// error is then shown once, in the failure box.
|
// error is then shown once, in the failure box.
|
||||||
let shownActionError = $derived(actionError !== detail?.call.error ? actionError : '')
|
let shownActionError = $derived(actionError !== detail?.call.error ? actionError : '')
|
||||||
|
|
||||||
|
// Calls that still need the user's attention (not transcribed, or
|
||||||
|
// transcribed but not uploaded here) — shown as "Gespräche · N offen".
|
||||||
|
let openCount = $derived(calls.filter((c) => c.needs_action).length)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main class="main">
|
<main class="main">
|
||||||
<UpdateBanner />
|
<UpdateBanner />
|
||||||
<aside class="sidebar">
|
<aside class="sidebar">
|
||||||
<header class="sidebar-header">
|
<header class="sidebar-header">
|
||||||
<h1>Gespräche</h1>
|
<h1>Gespräche{#if openCount > 0}<span class="open-count" title="{openCount} offen" aria-label="{openCount} offen">{openCount}</span>{/if}</h1>
|
||||||
<div class="header-actions">
|
<div class="header-actions">
|
||||||
<button
|
<button
|
||||||
class="btn small record-btn"
|
class="btn small record-btn"
|
||||||
@@ -328,7 +385,7 @@
|
|||||||
<button class="edit-title" title="Titel ändern" onclick={startTitleEdit}>✎</button>
|
<button class="edit-title" title="Titel ändern" onclick={startTitleEdit}>✎</button>
|
||||||
</h1>
|
</h1>
|
||||||
{/if}
|
{/if}
|
||||||
<StatusPill status={call.status} interrupted={call.interrupted} />
|
<StatusPill state={call.list_state} interrupted={call.interrupted} />
|
||||||
</div>
|
</div>
|
||||||
{#if editingTitle}
|
{#if editingTitle}
|
||||||
<p class="muted subline">Enter speichert, Esc bricht ab. Leer = Standardtitel.</p>
|
<p class="muted subline">Enter speichert, Esc bricht ab. Leer = Standardtitel.</p>
|
||||||
@@ -351,7 +408,8 @@
|
|||||||
{:else if call.status === 'failed'}
|
{:else if call.status === 'failed'}
|
||||||
<button class="btn primary" disabled={busy} onclick={retry}>Erneut versuchen</button>
|
<button class="btn primary" disabled={busy} onclick={retry}>Erneut versuchen</button>
|
||||||
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
||||||
{:else if call.status === 'done' && !call.uploaded_at}
|
{:else if call.status === 'done'}
|
||||||
|
{#if !call.uploaded_at}
|
||||||
<button
|
<button
|
||||||
class="btn primary"
|
class="btn primary"
|
||||||
disabled={!call.transcribed_at || isUploading}
|
disabled={!call.transcribed_at || isUploading}
|
||||||
@@ -361,6 +419,10 @@
|
|||||||
{isUploading ? 'wird hochgeladen…' : 'Transkript hochladen'}
|
{isUploading ? 'wird hochgeladen…' : 'Transkript hochladen'}
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
<button class="btn danger" disabled={deleteBusy || isUploading} onclick={askDelete}>
|
||||||
|
Löschen
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{#if shownActionError}
|
{#if shownActionError}
|
||||||
@@ -397,6 +459,40 @@
|
|||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if deleteDialogOpen}
|
||||||
|
<div
|
||||||
|
class="dialog-backdrop"
|
||||||
|
onclick={cancelDelete}
|
||||||
|
onkeydown={(e) => e.key === 'Escape' && cancelDelete()}
|
||||||
|
role="presentation"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="dialog"
|
||||||
|
role="alertdialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="delete-dialog-title"
|
||||||
|
tabindex="-1"
|
||||||
|
onclick={(e) => e.stopPropagation()}
|
||||||
|
onkeydown={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<p class="dialog-title" id="delete-dialog-title">Gespräch löschen?</p>
|
||||||
|
<p>Audio und Transkript werden unwiderruflich von diesem PC gelöscht.</p>
|
||||||
|
{#if call.uploaded_at}
|
||||||
|
<p>Die Kopie im CRM bleibt erhalten.</p>
|
||||||
|
{/if}
|
||||||
|
{#if deleteError}
|
||||||
|
<p class="error">{deleteError}</p>
|
||||||
|
{/if}
|
||||||
|
<div class="dialog-actions">
|
||||||
|
<button class="btn danger" disabled={deleteBusy} onclick={confirmDelete}>
|
||||||
|
Löschen
|
||||||
|
</button>
|
||||||
|
<button class="btn" disabled={deleteBusy} onclick={cancelDelete}>Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{:else if detailError}
|
{:else if detailError}
|
||||||
<p class="error pad">{detailError}</p>
|
<p class="error pad">{detailError}</p>
|
||||||
{:else if loaded && selectedId === null && calls.length > 0}
|
{:else if loaded && selectedId === null && calls.length > 0}
|
||||||
@@ -435,21 +531,47 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 14px 12px 10px 16px;
|
gap: 4px;
|
||||||
|
padding: 12px 6px 8px 10px;
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-header h1 {
|
.sidebar-header h1 {
|
||||||
font-size: 16px;
|
flex: 0 1 auto;
|
||||||
|
min-width: 0;
|
||||||
|
font-size: 15px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.open-count {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-left: 4px;
|
||||||
|
min-width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
padding: 0 3px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--primary-soft);
|
||||||
|
color: var(--primary);
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-actions {
|
.header-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-shrink: 0;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-btn {
|
.record-btn {
|
||||||
|
padding: 2px 6px;
|
||||||
|
font-size: 11px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,9 +588,9 @@
|
|||||||
|
|
||||||
.gear {
|
.gear {
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: 18px;
|
font-size: 15px;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
padding: 4px 6px;
|
padding: 3px 4px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@@ -574,4 +696,40 @@
|
|||||||
background: var(--rec-soft);
|
background: var(--rec-soft);
|
||||||
color: var(--rec);
|
color: var(--rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dialog-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(29, 35, 48, 0.4);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 12px 32px rgba(29, 35, 48, 0.25);
|
||||||
|
padding: 20px;
|
||||||
|
width: min(420px, calc(100vw - 32px));
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog p {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user