Merge pull request #11700 from assuntad23/hotfix/paired-list-builder-from-data-library

[21.01] Hotfix/paired list builder from data library
This commit is contained in:
Björn Grüning
2021-03-22 19:30:06 +01:00
committed by GitHub
@@ -9,7 +9,8 @@ import LIST_CREATOR from "components/Collections/ListCollectionCreator";
import LIST_CREATOR_MODAL from "components/Collections/ListCollectionCreatorModal";
import PAIR_CREATOR from "components/Collections/PairCollectionCreator";
import PAIR_CREATOR_MODAL from "components/Collections/PairCollectionCreatorModal";
import PAIRED_CREATOR from "components/Collections/PairedListCollectionCreatorModal";
import PAIRED_CREATOR from "components/Collections/PairedListCollectionCreator";
import PAIRED_CREATOR_MODAL from "components/Collections/PairedListCollectionCreatorModal";
import RULE_CREATOR_MODAL from "components/Collections/RuleBasedCollectionCreatorModal";
import HDCA_MODEL from "mvc/history/hdca-model";
@@ -144,16 +145,32 @@ var ImportCollectionModal = Backbone.View.extend({
creator_class
);
} else if (this.collectionType === "list:paired") {
const elements = collection_elements.map((element) => ({
id: element.id,
name: element.name,
src: "ldda",
}));
PAIRED_CREATOR.pairedListCollectionCreatorModal(elements, {
historyId: history_id,
title: modal_title,
defaultHideSourceItems: true,
});
creator_class = PAIRED_CREATOR;
creationFn = (elements, name, hideSourceItems) => {
elements = elements.map((pair) => ({
collection_type: "paired",
src: "new_collection",
name: pair.name,
element_identifiers: [
{
name: "forward",
id: pair.forward.id,
src: pair.forward.src || "hda",
},
{
name: "reverse",
id: pair.reverse.id,
src: pair.reverse.src || "hda",
},
],
}));
return this.createHDCA(elements, "list:paired", name, hideSourceItems, history_id);
};
PAIRED_CREATOR_MODAL.pairedListCollectionCreatorModal(
collection_elements,
{ creationFn: creationFn, title: modal_title, defaultHideSourceItems: true },
creator_class
);
} else if (this.collectionType === "rules") {
const creationFn = (elements, collectionType, name, hideSourceItems) => {
return this.createHDCA(elements, collectionType, name, hideSourceItems, history_id);