diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-10 00:08:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-10 00:08:15 +0300 |
commit | 21a5ef21750a02e4536077833400158de7e4ff95 (patch) | |
tree | b75e7834afc7f9be05e328e90babd86430676efe /app/views/notify | |
parent | cc6b6a7b78befba0fa003def271d446c51d67088 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/views/notify')
-rw-r--r-- | app/views/notify/import_work_items_csv_email.html.haml | 57 | ||||
-rw-r--r-- | app/views/notify/import_work_items_csv_email.text.erb | 49 |
2 files changed, 87 insertions, 19 deletions
diff --git a/app/views/notify/import_work_items_csv_email.html.haml b/app/views/notify/import_work_items_csv_email.html.haml index 425cf42fbd0..d4326d6bdf9 100644 --- a/app/views/notify/import_work_items_csv_email.html.haml +++ b/app/views/notify/import_work_items_csv_email.html.haml @@ -1,18 +1,49 @@ -- text_style = 'font-size:16px; text-align:center; line-height:30px;' +- info_style = 'font-size:16px; text-align:center; line-height:24px;' +- error_style = 'font-size:13px; text-align:center; line-height:16px; color:#dd2b0e;' -%p{ style: text_style } +%p{ style: info_style } - project_link = link_to(@project.full_name, project_url(@project), style: "color:#3777b0; text-decoration:none;") - = s_('Notify|Your CSV import of work items for project %{project_link} has been completed.').html_safe % { project_link: project_link } + = s_('Notify|Here are the results for your CSV import for %{project_link}.').html_safe % { project_link: project_link } -%p{ style: text_style } - - work_items = n_('%d work item', '%d work items', @results[:success]) % @results[:success] - = s_('Notify|%{work_items} imported.') % { work_items: work_items } +- success_lines = @results[:success] +%p{ style: info_style } + - if success_lines > 0 + - work_items = n_('%d work item', '%d work items', success_lines) % success_lines + = s_('Notify|%{work_items} successfully imported.') % { work_items: work_items } + - else + = s_('Notify|No work items have been imported.') -- if @results[:error_lines].present? - %p{ style: text_style } - = s_('Notify|Errors found on %{singular_or_plural_line}: %{error_lines}. Please check that these lines have the following fields: %{required_headers}.') % { singular_or_plural_line: n_('line', 'lines', @results[:error_lines].size), required_headers: WorkItems::ImportCsvService.required_headers.join(', '), - error_lines: @results[:error_lines].join(', ') } + - if @results[:parse_error] + %p{ style: info_style } + = s_('Notify|Error parsing CSV file. Please make sure it has the correct format: a delimited text file that uses a comma to separate values.') -- if @results[:parse_error] - %p{ style: text_style } - = s_('Notify|Error parsing CSV file. Please make sure it has the correct format: a delimited text file that uses a comma to separate values.') +- type_errors = @results[:type_errors] +- if type_errors + %p{ style: info_style } + = s_('Notify|Some values in the "type" column could not be matched with supported work item types:') + + - blank_lines = type_errors[:blank] + - missing_lines = type_errors[:missing] + - disallowed_lines = type_errors[:disallowed] + + - if blank_lines.present? + %p{ style: error_style } + = s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type is empty.') % { singular_or_plural_line: n_('Line', 'Lines', blank_lines.size), error_lines: blank_lines.join(', ') } + + - if missing_lines.present? + %p{ style: error_style } + = s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type cannot be found or is not supported.') % { singular_or_plural_line: n_('Line', 'Lines', missing_lines.size), error_lines: missing_lines.join(', ') } + + - if disallowed_lines.present? + %p{ style: error_style } + = s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type is not available. Please check your license and permissions.') % { singular_or_plural_line: n_('Line', 'Lines', disallowed_lines.size), error_lines: disallowed_lines.join(', ') } + +- error_lines = @results[:error_lines] +- if error_lines.present? + %p{ style: error_style } + = s_('Notify|Errors found on %{singular_or_plural_line}: %{error_lines}. Please check that these lines have the following fields: %{required_headers}.') % { singular_or_plural_line: n_('line', 'lines', error_lines.size), required_headers: WorkItems::ImportCsvService.required_headers.join(', '), + error_lines: error_lines.join(', ') } + +- if error_lines.present? || type_errors + %p{ style: info_style } + = s_('Notify|Please fix the lines with errors and try the CSV import again.') diff --git a/app/views/notify/import_work_items_csv_email.text.erb b/app/views/notify/import_work_items_csv_email.text.erb index 5793131af89..059dbc95cbc 100644 --- a/app/views/notify/import_work_items_csv_email.text.erb +++ b/app/views/notify/import_work_items_csv_email.text.erb @@ -1,11 +1,48 @@ -Your CSV import for project <%= @project.full_name %> (<%= project_url(@project) %>) has been completed. +<%= s_('Notify|Here are the results for your CSV import for %{project_name} (%{project_link}).') % { project_name: @project.full_name, project_link: project_url(@project) } %> -<%= pluralize(@results[:success], 'work item') %> imported. +<% success_lines = @results[:success] %> +<% if success_lines > 0 %> + <% work_items = n_('%d work item', '%d work items', success_lines) % success_lines %> + <%= s_('Notify|%{work_items} successfully imported.') % { work_items: work_items } %> +<% else %> + <%= s_('Notify|No work items have been imported.') %> -<% if @results[:error_lines].present? %> -Errors found on line <%= 'number'.pluralize(@results[:error_lines].size) %>: <%= @results[:error_lines].join(', ') %>. Please check that these lines have the following fields: <%= WorkItems::ImportCsvService.required_headers.join(', ') %>. + <% if @results[:parse_error] %> + <%= s_('Notify|Error parsing CSV file. Please make sure it has the correct format: a delimited text file that uses a comma to separate values.') %> + <% end %> <% end %> -<% if @results[:parse_error] %> -Error parsing CSV file. Please make sure it has the correct format: a delimited text file that uses a comma to separate values. +<% type_errors = @results[:type_errors] %> +<% + if type_errors + blank_lines = type_errors[:blank] + missing_lines = type_errors[:missing] + disallowed_lines = type_errors[:disallowed] +%> + <%= s_('Notify|Some values in the "type" column could not be matched with supported work item types:') %> + + <% if blank_lines.present? %> + <%= s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type is empty.') % { singular_or_plural_line: n_('Line', 'Lines', blank_lines.size), error_lines: blank_lines.join(', ') } %> + <% end %> + + <% if missing_lines.present? %> + <%= s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type cannot be found or is not supported.') % { singular_or_plural_line: n_('Line', 'Lines', missing_lines.size), error_lines: missing_lines.join(', ') } %> + <% end %> + + <% if disallowed_lines.present? %> + <%= s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type is not available. Please check your license and permissions.') % { singular_or_plural_line: n_('Line', 'Lines', disallowed_lines.size), error_lines: disallowed_lines.join(', ') } %> + <% end %> +<% end %> + +<% + error_lines = @results[:error_lines] + if error_lines.present? +%> + <%= s_('Notify|Errors found on %{singular_or_plural_line}: %{error_lines}. Please check that these lines have the following fields: %{required_headers}.') % { singular_or_plural_line: n_('line', 'lines', error_lines.size), required_headers: WorkItems::ImportCsvService.required_headers.join(', '), + error_lines: error_lines.join(', ') } %> +<% end %> + +<% if error_lines.present? || type_errors %> + <%= s_('Notify|Please fix the lines with errors and try the CSV import again.') %> <% end %> + |