diff --git a/apps/yaak-client/components/ImportDataDialog.tsx b/apps/yaak-client/components/ImportDataDialog.tsx index 60819840..facb8047 100644 --- a/apps/yaak-client/components/ImportDataDialog.tsx +++ b/apps/yaak-client/components/ImportDataDialog.tsx @@ -312,7 +312,7 @@ function LoadedImportDataDialog({ if (plan.destination.type === "new_workspace") { const names = plan.resources.workspaces.map((w) => w.name).filter((n) => n !== ""); if (names.length > 1) return pluralizeCount("new workspace", names.length); - return names[0] == null ? "New workspace" : `${names[0]} (new workspace)`; + return names[0] == null ? "New workspace" : `New workspace · ${names[0]}`; } const { workspaceId, folderId } = plan.destination; const name = workspaces.find((w) => w.id === workspaceId)?.name ?? "Unknown workspace"; diff --git a/crates/yaak/src/import.rs b/crates/yaak/src/import.rs index b6e3461a..d704fd67 100644 --- a/crates/yaak/src/import.rs +++ b/crates/yaak/src/import.rs @@ -1251,7 +1251,7 @@ fn unique_name(name: &str, taken: &[String]) -> String { } let mut n = 2; loop { - let candidate = format!("{name} {n}"); + let candidate = format!("{name} ({n})"); if !taken.iter().any(|t| *t == candidate) { return candidate; } @@ -1683,13 +1683,13 @@ mod tests { None, ) .expect("plan second import"); - assert_eq!(second.resources.workspaces[0].name, "Imported 2"); + assert_eq!(second.resources.workspaces[0].name, "Imported (2)"); let warning = second .warnings .iter() .find(|w| w.title == "Workspace renamed") .expect("the rename is explained"); - assert_eq!(warning.detail, "Imported → Imported 2 · that name is taken"); + assert_eq!(warning.detail, "Imported → Imported (2) · that name is taken"); commit_import_plan(&query_manager, second).expect("commit second import"); let third = plan_import_resources( @@ -1701,7 +1701,7 @@ mod tests { None, ) .expect("plan third import"); - assert_eq!(third.resources.workspaces[0].name, "Imported 3"); + assert_eq!(third.resources.workspaces[0].name, "Imported (3)"); let names = query_manager .connect() @@ -1711,7 +1711,7 @@ mod tests { .map(|w| w.name) .filter(|name| name.starts_with("Imported")) .collect::>(); - assert_eq!(names, BTreeSet::from(["Imported".to_string(), "Imported 2".to_string()])); + assert_eq!(names, BTreeSet::from(["Imported".to_string(), "Imported (2)".to_string()])); } #[test]