Skip to content

Commit ae67bc4

Browse files
krobipdclaude
andcommitted
Explain why a drag-and-drop move did nothing on a name collision
When a device is dropped onto a target where an object with the same name already exists, `handleDragEnd` returned silently — the move looked valid but nothing happened. Show a message in that case instead. Structural targets (non-alias, automatically_detected, linked_devices) keep the silent reject; they are already marked red while dragging. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f9e0f61 commit ae67bc4

12 files changed

Lines changed: 20 additions & 3 deletions

File tree

src-admin/src/Tabs/ListDevices.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,15 +2539,21 @@ export default class ListDevices extends Component<ListDevicesProps, ListDevices
25392539
targetPath = `${parentId}.${lastPart}`;
25402540
}
25412541

2542-
// Validate drop target
2542+
// Structural targets cannot receive a drop — reject them silently (they are already
2543+
// marked red while dragging).
25432544
if (
25442545
!dropTarget.id?.includes('alias.0') ||
25452546
dropTarget.id?.includes('automatically_detected') ||
2546-
dropTarget.id?.includes('linked_devices') ||
2547-
this.objects[targetPath]
2547+
dropTarget.id?.includes('linked_devices')
25482548
) {
25492549
return;
25502550
}
2551+
// The target looks droppable, but an object with this name already exists there — tell
2552+
// the user instead of silently doing nothing.
2553+
if (this.objects[targetPath]) {
2554+
this.setState({ message: I18n.t('An object with this name already exists in the target folder') });
2555+
return;
2556+
}
25512557

25522558
await this.onCopyDevice(draggedItem.id, targetPath);
25532559
this.toggleExpanded(dropTarget.id, true);

src-admin/src/i18n/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "Ein Objekt mit diesem Namen existiert bereits im Zielordner",
23
"Add": "Hinzufügen",
34
"Add new folder to \"%s\"": "Neuen Ordner zu \"%s\" hinzufügen",
45
"Add state": "Zustand hinzufügen",

src-admin/src/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "An object with this name already exists in the target folder",
23
"Add": "Add",
34
"Add new folder to \"%s\"": "Add new folder to \"%s\"",
45
"Add state": "Add state",

src-admin/src/i18n/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "Ya existe un objeto con este nombre en la carpeta de destino",
23
"Add": "Añadir",
34
"Add new folder to \"%s\"": "Agregar nueva carpeta a \"%s\"",
45
"Add state": "Agregar estado",

src-admin/src/i18n/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "Un objet portant ce nom existe déjà dans le dossier cible",
23
"Add": "Ajouter",
34
"Add new folder to \"%s\"": "Ajouter un nouveau dossier à \"%s\"",
45
"Add state": "Ajouter un état",

src-admin/src/i18n/it.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "Esiste già un oggetto con questo nome nella cartella di destinazione",
23
"Add": "Inserisci",
34
"Add new folder to \"%s\"": "Aggiungi nuova cartella a \"%s\"",
45
"Add state": "Aggiungi stato",

src-admin/src/i18n/nl.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "Er bestaat al een object met deze naam in de doelmap",
23
"Add": "Toevoegen",
34
"Add new folder to \"%s\"": "Nieuwe map toevoegen aan \"%s\"",
45
"Add state": "Staat toevoegen",

src-admin/src/i18n/pl.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "Obiekt o tej nazwie już istnieje w folderze docelowym",
23
"Add": "Dodaj",
34
"Add new folder to \"%s\"": "Dodaj nowy folder do „%s”",
45
"Add state": "Dodaj stan",

src-admin/src/i18n/pt.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "Já existe um objeto com este nome na pasta de destino",
23
"Add": "Adicionar",
34
"Add new folder to \"%s\"": "Adicione nova pasta a \"%s\"",
45
"Add state": "Adicionar estado",

src-admin/src/i18n/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"An object with this name already exists in the target folder": "Объект с таким именем уже существует в целевой папке",
23
"Add": "Добавить",
34
"Add new folder to \"%s\"": "Добавить новую папку в \"%s\"",
45
"Add state": "Добавить состояние",

0 commit comments

Comments
 (0)