Inventory export FE [SCI-6546] (#5622)

* Implement the front-end part of inventory export functionality [SCI-6546]

- Add the export button to the action toolbar
- Create new modal and link it to the export repository action
- Update the global export limit counter

Co-authored-by: Sboursen <dev.sboursen@gmail.com>

* Remove load_repository and check_view_permission for export_repositories [SCI-6546]

Co-authored-by: Sboursen <dev.sboursen@gmail.com>

* Fix text grammar in repositories export modal [SCI-6546]

Co-authored-by: Sboursen <dev.sboursen@gmail.com>

* Use I18n pluralization [SCI-6546]

Co-authored-by: Sboursen <dev.sboursen@gmail.com>

---------

Co-authored-by: Sboursen <dev.sboursen@gmail.com>
This commit is contained in:
Soufiane 2023-06-19 14:16:55 +02:00 committed by GitHub
parent 245a58b5c1
commit 72266fc636
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -160,13 +160,18 @@
var value = inputField.val();
inputField.focus().val('').val(value);
}).on('shown.bs.modal', '#export-repositories-modal', function() {
const selectedInventoriesCount = CHECKBOX_SELECTOR.selectedRows.length;
const firstDescription = $(this).find('.description-p1');
const teamName = firstDescription.data('team-name');
const exportButton = $(this).find('#export-repositories-modal-submit');
const exportURL = exportButton.data('export-url');
firstDescription.html(I18n.t(
'repositories.index.modal_export.description_p1_html',
{ team_name: teamName, repositories_count: CHECKBOX_SELECTOR.selectedRows.length }
{
team_name: teamName,
count: selectedInventoriesCount
}
));
exportButton.on('click', function() {

View file

@ -1746,7 +1746,9 @@ en:
copy: "Copy"
modal_export:
title: "Export Inventories"
description_p1_html: "You are about to export <strong>%{repositories_count}</strong> inventories in %{team_name}'s team."
description_p1_html:
one: "You are about to export <strong>1</strong> inventory in %{team_name}'s team."
other: "You are about to export <strong>%{count}</strong> inventories in %{team_name}'s team."
description_alert: "This process may take minutes to hours, depending on the file size. Any new data entered afterward won't be included in the export."
description_p2: "You will receive an email when the .zip file is ready. A link to your file will also appear in your SciNote notification. For security reasons, this link will expire in 7 days."
description_p3_html: "After you confirm this export, you will have <strong>%{remaining_export_requests}</strong> export requests left today (max %{requests_limit} requests per day)."