From 33aba9fd50cab336775f5241ae14a621bdc9fc6e Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Tue, 19 Nov 2024 09:48:46 -0600 Subject: [PATCH] remove legacy JQuery collection creator modal files --- .../Collections/ListCollectionCreatorModal.js | 60 ---------------- .../Collections/PairCollectionCreatorModal.js | 43 ----------- .../PairedListCollectionCreatorModal.js | 71 ------------------- 3 files changed, 174 deletions(-) delete mode 100644 client/src/components/Collections/ListCollectionCreatorModal.js delete mode 100644 client/src/components/Collections/PairCollectionCreatorModal.js delete mode 100644 client/src/components/Collections/PairedListCollectionCreatorModal.js diff --git a/client/src/components/Collections/ListCollectionCreatorModal.js b/client/src/components/Collections/ListCollectionCreatorModal.js deleted file mode 100644 index c3c4f5c7e9f8..000000000000 --- a/client/src/components/Collections/ListCollectionCreatorModal.js +++ /dev/null @@ -1,60 +0,0 @@ -import _l from "utils/localization"; -import Vue from "vue"; - -import { orList } from "@/utils/strings"; - -import { collectionCreatorModalSetup } from "./common/modal"; - -function listCollectionCreatorModal(elements, options) { - options = options || {}; - options.title = _l( - `Create a collection from a list of ${options.fromSelection ? "selected" : ""} ${ - options.extensions?.length ? orList(options.extensions) : "" - } datasets` - ); - const { promise, showEl } = collectionCreatorModalSetup(options); - return import(/* webpackChunkName: "ListCollectionCreator" */ "./ListCollectionCreator.vue").then((module) => { - const listCollectionCreatorInstance = Vue.extend(module.default); - const vm = document.createElement("div"); - showEl(vm); - new listCollectionCreatorInstance({ - propsData: { - initialElements: elements, - creationFn: options.creationFn, - oncancel: options.oncancel, - oncreate: options.oncreate, - defaultHideSourceItems: options.defaultHideSourceItems, - fromSelection: options.fromSelection, - extensions: options.extensions, - }, - }).$mount(vm); - return promise; - }); -} - -/** Use a modal to create a list collection, then add it to the given history contents. - * @returns {Promise} resolved when the collection is added to the history. - */ -function createListCollection(contents) { - const elements = contents.toJSON(); - const promise = listCollectionCreatorModal(elements, { - defaultHideSourceItems: contents.defaultHideSourceItems, - fromSelection: contents.fromSelection, - extensions: contents.extensions, - historyName: contents.historyName, - creationFn: function (elements, name, hideSourceItems) { - elements = elements.map((element) => ({ - id: element.id, - name: element.name, - //TODO: this allows for list:list even if the filter above does not - reconcile - src: element.src || (element.history_content_type == "dataset" ? "hda" : "hdca"), - })); - return contents.createHDCA(elements, "list", name, hideSourceItems); - }, - }); - return promise; -} -export default { - listCollectionCreatorModal: listCollectionCreatorModal, - createListCollection: createListCollection, -}; diff --git a/client/src/components/Collections/PairCollectionCreatorModal.js b/client/src/components/Collections/PairCollectionCreatorModal.js deleted file mode 100644 index 1cfa2a64dc71..000000000000 --- a/client/src/components/Collections/PairCollectionCreatorModal.js +++ /dev/null @@ -1,43 +0,0 @@ -import _l from "utils/localization"; -import Vue from "vue"; - -import { collectionCreatorModalSetup } from "./common/modal"; - -function pairCollectionCreatorModal(elements, options) { - options = options || {}; - options.title = _l("Create a collection from a pair of datasets"); - const { promise, showEl } = collectionCreatorModalSetup(options); - return import(/* webpackChunkName: "PairCollectionCreator" */ "./PairCollectionCreator.vue").then((module) => { - var pairCollectionCreatorInstance = Vue.extend(module.default); - var vm = document.createElement("div"); - showEl(vm); - new pairCollectionCreatorInstance({ - propsData: { - initialElements: elements, - creationFn: options.creationFn, - oncancel: options.oncancel, - oncreate: options.oncreate, - defaultHideSourceItems: options.defaultHideSourceItems, - }, - }).$mount(vm); - return promise; - }); -} -function createPairCollection(contents, defaultHideSourceItems = true) { - var elements = contents.toJSON(); - var promise = pairCollectionCreatorModal(elements, { - defaultHideSourceItems: defaultHideSourceItems, - creationFn: function (elements, name, hideSourceItems) { - elements = [ - { name: "forward", src: elements[0].src || "hda", id: elements[0].id }, - { name: "reverse", src: elements[1].src || "hda", id: elements[1].id }, - ]; - return contents.createHDCA(elements, "paired", name, hideSourceItems); - }, - }); - return promise; -} -export default { - pairCollectionCreatorModal: pairCollectionCreatorModal, - createPairCollection: createPairCollection, -}; diff --git a/client/src/components/Collections/PairedListCollectionCreatorModal.js b/client/src/components/Collections/PairedListCollectionCreatorModal.js deleted file mode 100644 index 992452d65f55..000000000000 --- a/client/src/components/Collections/PairedListCollectionCreatorModal.js +++ /dev/null @@ -1,71 +0,0 @@ -import _l from "utils/localization"; -import Vue from "vue"; - -import { orList } from "@/utils/strings"; - -import { collectionCreatorModalSetup } from "./common/modal"; - -import PairedListCollectionCreator from "./PairedListCollectionCreator.vue"; - -function pairedListCollectionCreatorModal(elements, options) { - options = options || {}; - options.title = _l( - `Create a collection of ${options.fromSelection ? "selected" : ""} ${ - options.extensions?.length ? orList(options.extensions) : "" - } dataset pairs` - ); - const { promise, showEl } = collectionCreatorModalSetup(options); - var pairedListCollectionCreatorInstance = Vue.extend(PairedListCollectionCreator); - var vm = document.createElement("div"); - showEl(vm); - new pairedListCollectionCreatorInstance({ - propsData: { - initialElements: elements, - creationFn: options.creationFn, - oncancel: options.oncancel, - oncreate: options.oncreate, - defaultHideSourceItems: options.defaultHideSourceItems, - fromSelection: options.fromSelection, - extensions: options.extensions, - }, - }).$mount(vm); - return promise; -} - -/** Use a modal to create a list collection, then add it to the given history contents. - * @returns {Promise} resolved when the collection is added to the history. - */ -function createPairedListCollection(contents) { - const elements = contents.toJSON(); - const promise = pairedListCollectionCreatorModal(elements, { - defaultHideSourceItems: contents.defaultHideSourceItems, - fromSelection: contents.fromSelection, - extensions: contents.extensions, - historyName: contents.historyName, - creationFn: function (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 contents.createHDCA(elements, "list:paired", name, hideSourceItems); - }, - }); - return promise; -} -export default { - pairedListCollectionCreatorModal: pairedListCollectionCreatorModal, - createPairedListCollection: createPairedListCollection, -};