diff --git a/databrowser/src/domain/cellComponents/components/utils/editList/dialogMultipleFilesLanguage/DialogMultipleFilesLanguage.vue b/databrowser/src/domain/cellComponents/components/utils/editList/dialogMultipleFilesLanguage/DialogMultipleFilesLanguage.vue index 088dc88f..e0603486 100644 --- a/databrowser/src/domain/cellComponents/components/utils/editList/dialogMultipleFilesLanguage/DialogMultipleFilesLanguage.vue +++ b/databrowser/src/domain/cellComponents/components/utils/editList/dialogMultipleFilesLanguage/DialogMultipleFilesLanguage.vue @@ -44,7 +44,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later @click="saveAndNext()" >{{ t( - 'datasets.editView.dialog.multipleFilesLanguage.buttonSaveAndNext' + 'datasets.editView.dialog.multipleFilesLanguage.buttonNext' ) }} @@ -95,8 +95,6 @@ import { Variant } from '../../../../../../components/button/types'; import { useDialogStore } from './dialogStore'; import DialogConfirmDeselectAllLanguages from './DialogConfirmDeselectAllLanguages.vue'; import { - useEventSaveChanges, - useEventDiscardChanges, addItemsInModalAndSave, updateItemsInModalAndSave, setIgnoreDelete, @@ -141,12 +139,10 @@ const saveAndNext = () => { updateItemsInModalAndSave(); } - useEventSaveChanges.emit(true); emit('close'); }; const discardUpdates = () => { - useEventDiscardChanges.emit(true); emit('close'); }; diff --git a/databrowser/src/domain/cellComponents/components/utils/editList/dialogMultipleFilesLanguage/utils.ts b/databrowser/src/domain/cellComponents/components/utils/editList/dialogMultipleFilesLanguage/utils.ts index 28ba7265..0fe80eaa 100644 --- a/databrowser/src/domain/cellComponents/components/utils/editList/dialogMultipleFilesLanguage/utils.ts +++ b/databrowser/src/domain/cellComponents/components/utils/editList/dialogMultipleFilesLanguage/utils.ts @@ -98,12 +98,16 @@ export const setDataForDocumentEdit = (item: FileEntry) => { for (const lang in Documents) { const currentLanguageDocuments = Documents[lang]; for (const currentDocument of currentLanguageDocuments) { + if (currentDocument.DocumentURL !== item.src) { + continue; + } + const index = dialogData.findIndex((item) => item.language === lang); dialogData[index] = { ...dialogData[index], documentName: currentDocument.DocumentName, language: lang, - available: currentDocument.DocumentURL === item.src, + available: true, }; } } @@ -131,7 +135,11 @@ export const updateItem = (index: number, value: FileLanguageUpdate) => { const currentItem = dialogStore.items[dialogStore.activeTab].data[index]; - if (currentItem.documentName && !value.documentName) { + if ( + currentItem.documentName && + !value.documentName && + !currentItem.disableAvailabilityChange + ) { value.available = false; } @@ -202,11 +210,11 @@ export const updateItemsInModalAndSave = () => { const keyLangDocuments = documentInModal.language as keyof typeof Documents; const currentDocumentData = Documents[keyLangDocuments] || []; - const currentSavedDocumentIndex = currentDocumentData.find( + const currentSavedDocumentIndex = currentDocumentData.findIndex( (item: any) => item.DocumentURL === itemInModalToSave.src ); - if (currentSavedDocumentIndex) { + if (currentSavedDocumentIndex >= 0) { Documents[keyLangDocuments].splice(currentSavedDocumentIndex, 1); } } diff --git a/databrowser/src/locales/en.json b/databrowser/src/locales/en.json index 6ecb959e..79f0a897 100644 --- a/databrowser/src/locales/en.json +++ b/databrowser/src/locales/en.json @@ -112,6 +112,7 @@ }, "multipleFilesLanguage": { "buttonSaveAndNext": "Save & next", + "buttonNext": "Next", "buttonDiscardChanges": "Discard changes", "title": "Choose language", "description": "Which language would you like to assign the uploaded document to?"