Skip to content

Commit

Permalink
Merge pull request #16834 from guerler/remaining_form_inputs
Browse files Browse the repository at this point in the history
Remove remaining legacy backbone form input elements
  • Loading branch information
guerler authored Oct 18, 2023
2 parents 9798e9d + 5b928e4 commit d8d27e8
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 1,529 deletions.
27 changes: 14 additions & 13 deletions client/src/components/Form/Elements/FormData/variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ export const SOURCE = { DATASET: "hda", COLLECTION: "hdca", COLLECTION_ELEMENT:
export const VARIANTS: Record<string, Array<VariantInterface>> = {
data: [
{
src: "hda",
src: SOURCE.DATASET,
icon: "fa-file",
tooltip: "Single dataset",
library: true,
multiple: false,
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,
Expand All @@ -42,14 +42,15 @@ export const VARIANTS: Record<string, Array<VariantInterface>> = {
],
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,
Expand All @@ -58,7 +59,7 @@ export const VARIANTS: Record<string, Array<VariantInterface>> = {
],
data_collection: [
{
src: "hdca",
src: SOURCE.COLLECTION,
icon: "fa-folder",
tooltip: "Dataset collection",
multiple: false,
Expand All @@ -67,7 +68,7 @@ export const VARIANTS: Record<string, Array<VariantInterface>> = {
],
workflow_data: [
{
src: "hda",
src: SOURCE.DATASET,
icon: "fa-file",
tooltip: "Single dataset",
multiple: false,
Expand All @@ -76,7 +77,7 @@ export const VARIANTS: Record<string, Array<VariantInterface>> = {
],
workflow_data_multiple: [
{
src: "hda",
src: SOURCE.DATASET,
icon: "fa-copy",
tooltip: "Multiple datasets",
multiple: true,
Expand All @@ -85,7 +86,7 @@ export const VARIANTS: Record<string, Array<VariantInterface>> = {
],
workflow_data_collection: [
{
src: "hdca",
src: SOURCE.COLLECTION,
icon: "fa-folder",
tooltip: "Dataset collection",
multiple: false,
Expand All @@ -94,14 +95,14 @@ export const VARIANTS: Record<string, Array<VariantInterface>> = {
],
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,
Expand All @@ -110,14 +111,14 @@ export const VARIANTS: Record<string, Array<VariantInterface>> = {
],
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,
Expand Down
63 changes: 0 additions & 63 deletions client/src/components/Form/Elements/FormParameter.vue

This file was deleted.

5 changes: 2 additions & 3 deletions client/src/components/Form/Elements/FormSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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, unknown> | string | number | null;
interface SelectOption {
label: string;
Expand All @@ -23,7 +22,7 @@ const props = withDefaults(
optional?: boolean;
options: Array<SelectOption>;
placeholder?: string;
value?: Array<SelectValue> | string | number;
value?: Array<SelectValue> | Record<string, unknown> | string | number;
}>(),
{
id: `form-select-${uid()}`,
Expand Down
52 changes: 0 additions & 52 deletions client/src/components/Form/Elements/parameters.js

This file was deleted.

8 changes: 0 additions & 8 deletions client/src/components/Form/FormElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -300,13 +299,6 @@ const isOptional = computed(() => !isRequired.value && attrs.value["optional"] !
<FormDirectory v-else-if="props.type === 'directory_uri'" v-model="currentValue" />
<FormUpload v-else-if="props.type === 'upload'" v-model="currentValue" />
<FormRulesEdit v-else-if="props.type == 'rules'" v-model="currentValue" :target="attrs.target" />
<FormParameter
v-else-if="['data_dialog', 'ftpfile', 'library_data'].includes(props.type)"
:id="props.id"
v-model="currentValue"
:data-label="props.title"
:type="props.type"
:attributes="attrs" />
<FormTags
v-else-if="props.type === 'tags'"
v-model="currentValue"
Expand Down
1 change: 0 additions & 1 deletion client/src/components/Form/parameterTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export type FormParameterTypes =
| "data_collection"
| "drill_down"
| "group_tag"
| "library_data"
| "ftpfile"
| "upload"
| "rules"
Expand Down
97 changes: 0 additions & 97 deletions client/src/mvc/ui/ui-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,101 +102,6 @@ var Button = Backbone.View.extend({
},
});

/** This button allows the right-click/open-in-new-tab feature, its used e.g. for panel buttons. */
var ButtonLink = Button.extend({
initialize: function (options) {
this.model =
(options && options.model) ||
new Backbone.Model({
id: Utils.uid(),
visible: true,
title: "",
icon: "",
cls: "",
}).set(options);
this.setElement($("<a/>").append((this.$icon = $("<span/>"))));
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(
$("<div/>")
.addClass("mb-2")
.append((this.$icon = $("<span/>")))
.append((this.$title = $("<span/>")))
);
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,
Expand Down Expand Up @@ -306,7 +211,5 @@ var ButtonMenu = Backbone.View.extend({

export default {
Button: Button,
ButtonLink: ButtonLink,
ButtonCheck: ButtonCheck,
ButtonMenu: ButtonMenu,
};
Loading

0 comments on commit d8d27e8

Please sign in to comment.