From 61d3313fbb6322c8fd33d52e1a0a6e9121fb2349 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 19 Nov 2026 09:55:58 +0100 Subject: [PATCH] :bug: Explain in the import dialog why a components v1 file is rejected Importing a file in the old components v1 format failed with "Something went wrong while processing this file". The job's entry carried the specific message (`dashboard.import.components-v1-error`), but the error list of the dialog only knew the check error and corrupt file texts and showed the unknown error text for everything else. The error list now shows the components v1 message as it is (`import-error-detail`). Found by the components Qase run (Migration suite). Test: `dashboard-import-errors-test`. AI-assisted-by: claude-opus-5-5 --- .../src/app/main/ui/dashboard/import.cljs | 30 ++++++++++++------- frontend/test/frontend_tests/runner.cljs | 2 ++ .../ui/dashboard_import_errors_test.cljs | 28 +++++++++++++++++ 3 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 frontend/test/frontend_tests/ui/dashboard_import_errors_test.cljs diff --git a/frontend/src/app/main/ui/dashboard/import.cljs b/frontend/src/app/main/ui/dashboard/import.cljs index 048c0d7e73..5db2d5e6fe 100644 --- a/frontend/src/app/main/ui/dashboard/import.cljs +++ b/frontend/src/app/main/ui/dashboard/import.cljs @@ -669,6 +669,24 @@ :style (when (some? pct) #js {:width (str pct "%")})}]])]))) +(defn import-error-detail + "The text that explains why an entry could not be imported." + [err] + (cond + (= err (tr "dashboard.import.components-v1-error")) + err + + (and (string? err) + (str/includes? (str/lower err) "check error")) + (tr "dashboard.import.import-error.check-error") + + (and (string? err) + (str/includes? (str/lower err) "corrupt")) + (tr "dashboard.import.import-error.corrupt-file") + + :else + (tr "dashboard.import.import-error.unknown-error"))) + (mf/defc import-files-stage* {::mf/private true} [{:keys [entries template status step errors? import-success-total auto-linked-count @@ -715,17 +733,7 @@ [:div (:name entry)] (when-let [err (:error entry)] [:div {:class (stl/css :import-error-detail)} - (cond - (and (string? err) - (str/includes? (str/lower err) "check error")) - (tr "dashboard.import.import-error.check-error") - - (and (string? err) - (str/includes? (str/lower err) "corrupt")) - (tr "dashboard.import.import-error.corrupt-file") - - :else - (tr "dashboard.import.import-error.unknown-error"))])]))] + (import-error-detail err)])]))] [:div (tr "dashboard.import.import-error.message2")]] (imp/awaiting-analysis? status errors?) diff --git a/frontend/test/frontend_tests/runner.cljs b/frontend/test/frontend_tests/runner.cljs index a4c9e6fed0..f7fc1a5877 100644 --- a/frontend/test/frontend_tests/runner.cljs +++ b/frontend/test/frontend_tests/runner.cljs @@ -188,6 +188,7 @@ [frontend-tests.ui.comments-clustering-test] [frontend-tests.ui.comments-position-modifier-test] [frontend-tests.ui.context-menu-prototype-test] + [frontend-tests.ui.dashboard-import-errors-test] [frontend-tests.ui.dashboard-import-linking-test] [frontend-tests.ui.drawarea-test] [frontend-tests.ui.ds-controls-numeric-input-test] @@ -445,6 +446,7 @@ 'frontend-tests.ui.comments-clustering-test 'frontend-tests.ui.comments-position-modifier-test 'frontend-tests.ui.context-menu-prototype-test + 'frontend-tests.ui.dashboard-import-errors-test 'frontend-tests.ui.dashboard-import-linking-test 'frontend-tests.ui.drawarea-test 'frontend-tests.ui.ds-controls-numeric-input-test diff --git a/frontend/test/frontend_tests/ui/dashboard_import_errors_test.cljs b/frontend/test/frontend_tests/ui/dashboard_import_errors_test.cljs new file mode 100644 index 0000000000..be782843c8 --- /dev/null +++ b/frontend/test/frontend_tests/ui/dashboard_import_errors_test.cljs @@ -0,0 +1,28 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS SUBSIDIARY SL + +(ns frontend-tests.ui.dashboard-import-errors-test + "The text the import wizard shows under an entry that failed." + (:require + [app.main.ui.dashboard.import :as import] + [app.util.i18n :refer [tr]] + [cljs.test :as t :include-macros true])) + +(t/deftest a-components-v1-file-shows-why-it-cannot-be-imported + (let [err (tr "dashboard.import.components-v1-error")] + (t/is (= err (import/import-error-detail err))))) + +(t/deftest known-failures-show-their-own-explanation + (t/is (= (tr "dashboard.import.import-error.check-error") + (import/import-error-detail "Check error: invalid shape"))) + (t/is (= (tr "dashboard.import.import-error.corrupt-file") + (import/import-error-detail "The file is corrupt")))) + +(t/deftest other-failures-show-the-generic-explanation + (t/is (= (tr "dashboard.import.import-error.unknown-error") + (import/import-error-detail "some server hint"))) + (t/is (= (tr "dashboard.import.import-error.unknown-error") + (import/import-error-detail nil))))