diff --git a/client/src/components/Form/Elements/FormData/variants.ts b/client/src/components/Form/Elements/FormData/variants.ts index 1b73712514fe..472ad866b316 100644 --- a/client/src/components/Form/Elements/FormData/variants.ts +++ b/client/src/components/Form/Elements/FormData/variants.ts @@ -18,7 +18,7 @@ export const SOURCE = { DATASET: "hda", COLLECTION: "hdca", COLLECTION_ELEMENT: export const VARIANTS: Record> = { data: [ { - src: "hda", + src: SOURCE.DATASET, icon: "fa-file", tooltip: "Single dataset", library: true, @@ -26,14 +26,14 @@ export const VARIANTS: Record> = { batch: BATCH.DISABLED, }, { - src: "hda", + src: SOURCE.DATASET, icon: "fa-copy", tooltip: "Multiple datasets", multiple: true, batch: BATCH.LINKED, }, { - src: "hdca", + src: SOURCE.COLLECTION, icon: "fa-folder", tooltip: "Dataset collection", multiple: false, @@ -42,14 +42,15 @@ export const VARIANTS: Record> = { ], data_multiple: [ { - src: "hda", + src: SOURCE.DATASET, icon: "fa-copy", tooltip: "Multiple datasets", + library: true, multiple: true, batch: BATCH.DISABLED, }, { - src: "hdca", + src: SOURCE.COLLECTION, icon: "fa-folder", tooltip: "Dataset collection", multiple: true, @@ -58,7 +59,7 @@ export const VARIANTS: Record> = { ], data_collection: [ { - src: "hdca", + src: SOURCE.COLLECTION, icon: "fa-folder", tooltip: "Dataset collection", multiple: false, @@ -67,7 +68,7 @@ export const VARIANTS: Record> = { ], workflow_data: [ { - src: "hda", + src: SOURCE.DATASET, icon: "fa-file", tooltip: "Single dataset", multiple: false, @@ -76,7 +77,7 @@ export const VARIANTS: Record> = { ], workflow_data_multiple: [ { - src: "hda", + src: SOURCE.DATASET, icon: "fa-copy", tooltip: "Multiple datasets", multiple: true, @@ -85,7 +86,7 @@ export const VARIANTS: Record> = { ], workflow_data_collection: [ { - src: "hdca", + src: SOURCE.COLLECTION, icon: "fa-folder", tooltip: "Dataset collection", multiple: false, @@ -94,14 +95,14 @@ export const VARIANTS: Record> = { ], module_data: [ { - src: "hda", + src: SOURCE.DATASET, icon: "fa-file", tooltip: "Single dataset", multiple: false, batch: BATCH.DISABLED, }, { - src: "hda", + src: SOURCE.DATASET, icon: "fa-copy", tooltip: "Multiple datasets", multiple: true, @@ -110,14 +111,14 @@ export const VARIANTS: Record> = { ], module_data_collection: [ { - src: "hdca", + src: SOURCE.COLLECTION, icon: "fa-folder", tooltip: "Dataset collection", multiple: false, batch: BATCH.DISABLED, }, { - src: "hdca", + src: SOURCE.COLLECTION, icon: "fa-folder", tooltip: "Multiple collections", multiple: true, diff --git a/client/src/components/Form/Elements/FormParameter.vue b/client/src/components/Form/Elements/FormParameter.vue deleted file mode 100644 index 151e47347651..000000000000 --- a/client/src/components/Form/Elements/FormParameter.vue +++ /dev/null @@ -1,63 +0,0 @@ - - diff --git a/client/src/components/Form/Elements/FormSelect.vue b/client/src/components/Form/Elements/FormSelect.vue index a1b0720c257b..bb5304c19edc 100644 --- a/client/src/components/Form/Elements/FormSelect.vue +++ b/client/src/components/Form/Elements/FormSelect.vue @@ -2,13 +2,12 @@ import { computed, type ComputedRef, onMounted, watch } from "vue"; import Multiselect from "vue-multiselect"; -import { type DataOption } from "@/components/Form/Elements/FormData/types"; import { useMultiselect } from "@/composables/useMultiselect"; import { uid } from "@/utils/utils"; const { ariaExpanded, onOpen, onClose } = useMultiselect(); -type SelectValue = DataOption | string | number | null; +type SelectValue = Record | string | number | null; interface SelectOption { label: string; @@ -23,7 +22,7 @@ const props = withDefaults( optional?: boolean; options: Array; placeholder?: string; - value?: Array | string | number; + value?: Array | Record | string | number; }>(), { id: `form-select-${uid()}`, diff --git a/client/src/components/Form/Elements/parameters.js b/client/src/components/Form/Elements/parameters.js deleted file mode 100644 index 01729e887c0a..000000000000 --- a/client/src/components/Form/Elements/parameters.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - This class creates input elements. New input parameter types should be added to the types dictionary. -*/ -import Backbone from "backbone"; -import SelectFtp from "mvc/ui/ui-select-ftp"; -import SelectLibrary from "mvc/ui/ui-select-library"; - -// create form view -export default Backbone.View.extend({ - /** Available parameter types */ - types: { - library_data: "_fieldLibrary", - ftpfile: "_fieldFtp", - }, - - remove: function () { - this.field.remove(); - Backbone.View.prototype.remove.call(this); - }, - - /** Returns an input field for a given field type */ - create: function (input_def) { - var fieldClass = this.types[input_def.type]; - this.field = typeof this[fieldClass] === "function" ? this[fieldClass].call(this, input_def) : null; - if (input_def.value === undefined) { - input_def.value = null; - } - this.field.value(input_def.value); - this.setElement(input_def.el || "
"); - this.$el.append(this.field.$el); - }, - - /** Library dataset field */ - _fieldLibrary: function (input_def) { - return new SelectLibrary.View({ - id: input_def.id, - optional: input_def.optional, - multiple: input_def.multiple, - onchange: input_def.onchange, - }); - }, - - /** FTP file field */ - _fieldFtp: function (input_def) { - return new SelectFtp.View({ - id: input_def.id, - optional: input_def.optional, - multiple: input_def.multiple, - onchange: input_def.onchange, - }); - }, -}); diff --git a/client/src/components/Form/FormElement.vue b/client/src/components/Form/FormElement.vue index 7a5841e7338b..208664bdb616 100644 --- a/client/src/components/Form/FormElement.vue +++ b/client/src/components/Form/FormElement.vue @@ -18,7 +18,6 @@ import FormHidden from "./Elements/FormHidden.vue"; import FormInput from "./Elements/FormInput.vue"; import FormNumber from "./Elements/FormNumber.vue"; import FormOptionalText from "./Elements/FormOptionalText.vue"; -import FormParameter from "./Elements/FormParameter.vue"; import FormRulesEdit from "./Elements/FormRulesEdit.vue"; import FormSelection from "./Elements/FormSelection.vue"; import FormTags from "./Elements/FormTags.vue"; @@ -300,13 +299,6 @@ const isOptional = computed(() => !isRequired.value && attrs.value["optional"] ! - ").append((this.$icon = $("")))); - this.listenTo(this.model, "change", this.render, this); - this.render(); - }, - - render: function () { - var options = this.model.attributes; - this.$el - .removeClass() - .addClass(options.cls) - .attr({ - id: options.id, - href: options.href || "javascript:void(0)", - title: options.title, - target: options.target || "_top", - disabled: options.disabled, - "data-description": options.description, - }) - .css("display", options.visible ? "inline-block" : "none") - .tooltip({ placement: "bottom" }) - .off("click") - .on("click", () => { - options.onclick && !options.disabled && options.onclick(); - }); - this.$icon.removeClass().addClass(options.icon); - }, -}); - -/** The check button is used in the tool form and allows to distinguish between multiple states e.g. all, partially and nothing selected. */ -var ButtonCheck = Backbone.View.extend({ - initialize: function (options) { - this.model = - (options && options.model) || - new Backbone.Model({ - id: Utils.uid(), - title: "Select/Unselect all", - icons: ["fa-square-o", "fa-minus-square-o", "fa-check-square-o"], - value: 0, - visible: true, - onchange: function () {}, - }).set(options); - this.setElement( - $("
") - .addClass("mb-2") - .append((this.$icon = $(""))) - .append((this.$title = $(""))) - ); - this.listenTo(this.model, "change", this.render, this); - this.render(); - }, - - render: function (options) { - options = this.model.attributes; - this.$el - .addClass("ui-button-check") - .css("display", options.visible ? "inline-block" : "none") - .off("click") - .on("click", () => { - this.model.set("value", (this.model.get("value") === 0 && 2) || 0); - options.onclick && options.onclick(); - }); - this.$title.html(options.title); - this.$icon.removeClass().addClass("icon fa mr-1").addClass(options.icons[options.value]); - }, - - /* Sets a new value and/or returns the value. - * @param{Integer} new_val - Set a new value 0=unchecked, 1=partial and 2=checked. - * OR: - * @param{Integer} new_val - Number of selected options. - * @param{Integer} total - Total number of available options. - */ - value: function (new_val, total) { - if (new_val !== undefined) { - if (total && new_val !== 0) { - new_val = (new_val !== total && 1) || 2; - } - this.model.set("value", new_val); - this.model.get("onchange")(this.model.get("value")); - } - return this.model.get("value"); - }, -}); - /** This class creates a button with dropdown menu. */ var ButtonMenu = Backbone.View.extend({ $menu: null, @@ -306,7 +211,5 @@ var ButtonMenu = Backbone.View.extend({ export default { Button: Button, - ButtonLink: ButtonLink, - ButtonCheck: ButtonCheck, ButtonMenu: ButtonMenu, }; diff --git a/client/src/mvc/ui/ui-list.js b/client/src/mvc/ui/ui-list.js deleted file mode 100644 index e3a84db86775..000000000000 --- a/client/src/mvc/ui/ui-list.js +++ /dev/null @@ -1,148 +0,0 @@ -import Backbone from "backbone"; -import $ from "jquery"; -import Ui from "mvc/ui/ui-misc"; -import Utils from "utils/utils"; - -var View = Backbone.View.extend({ - initialize: function (options) { - this.options = options; - this.name = options.name || "element"; - this.multiple = options.multiple || false; - - // create message handler - this.message = new Ui.Message({ cls: "col mb-0" }); - - // create selections area - this.selections = $("
"); - - // create select field containing the options which can be inserted into the list - this.select = new Ui.Select.View({ optional: options.optional }); - - // create insert new list element button - this.$button = $(`