プロジェクト

全般

プロフィール

Vote #81408

完了

Reject CSV file without data row when importing

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Importers_15
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
15
version_id:
155
issue_org_id:
35137
author_id:
362529
assigned_to_id:
332
comments:
7
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

It is suggested to display a message indicating that there is no data when trying to import a file that has no data.

!{width:400px;border:1px solid grey;}message-no-data.png!


journals

I created a patch. You get a message when you try to import a file that has only a header row.

<pre><code class="diff">
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index 721d08fa2..2b9edfc31 100644
--- a/app/controllers/imports_controller.rb
+++ b/app/controllers/imports_controller.rb
@@ -50,7 +50,11 @@ class ImportsController < ApplicationController

def settings
if request.post? && @import.parse_file
- redirect_to import_mapping_path(@import)
+ if @import.total_items == 0
+ flash.now[:error] = l(:error_no_data_import_file)
+ else
+ redirect_to import_mapping_path(@import)
+ end
end

rescue CSV::MalformedCSVError, EncodingError => e
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9d779a2fe..c948d40ff 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -223,6 +223,7 @@ en:
error_invalid_file_encoding: "The file is not a valid %{encoding} encoded file"
error_invalid_csv_file_or_settings: "The file is not a CSV file or does not match the settings below (%{value})"
error_can_not_read_import_file: "An error occurred while reading the file to import"
+ error_no_data_import_file: "There is no data to import into the file"
error_attachment_extension_not_allowed: "Attachment extension %{extension} is not allowed"
error_ldap_bind_credentials: "Invalid LDAP Account/Password"
error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue"
</code></pre>
--------------------------------------------------------------------------------
Users can run the import after configuring the field mapping, even if the CSV file contains only a header row.

However, after running the import of the CSV file, only a blank page is displayed (see attachment:Screenshot_2021-06-03.png). I think it is confusing and difficult to troubleshoot for some users.

I think it would be helpful to display an appropriate error message so as not to confuse users.

--------------------------------------------------------------------------------
Changed the error message in the patch.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Setting the target version to 5.0.0.
--------------------------------------------------------------------------------
Committed the patch. Thank you.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリImporters_15 にセット
  • 対象バージョン5.0.0_155 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0