Commit 5d7bd1cb authored by Cage, Gregory's avatar Cage, Gregory
Browse files

Merge branch '127-add-option-to-disable-batch-mode' into 'dev'

Add option to disable batch mode for all tools

Closes #127

See merge request !101
parents cb11285c 832af834
Loading
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -87,6 +87,18 @@ describe("FormData", () => {
        expect(wrapper.find(SELECTED_VALUE).text()).toEqual("4: hdaName4");
    });

    it("regular data no batch input", async () => {
        const wrapper = createTarget({
            value: null,
            options: defaultOptions,
            disableBatchInput: true,
        });
        const options = wrapper.find(".btn-group").findAll("button");
        expect(options.length).toBe(2);
        expect(options.at(0).classes()).toContain("active");
        expect(options.at(0).attributes("title")).toBe("Single dataset");
    });

    it("optional dataset", async () => {
        const wrapper = createTarget({
            value: null,
+9 −14
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ const props = withDefaults(
        collectionTypes?: Array<string>;
        flavor?: string;
        tag?: string;
        singleDatasetInput?: boolean;
        disableBatchInput?: boolean;
    }>(),
    {
        loading: false,
@@ -51,13 +51,14 @@ const props = withDefaults(
        collectionTypes: undefined,
        flavor: undefined,
        tag: undefined,
        singleDatasetInput: false,
        disableBatchInput: false,
    }
);

const eventStore = useEventStore();
const { datatypesMapper } = useDatatypesMapper();


const $emit = defineEmits(["input", "alert"]);

// Determines wether values should be processed as linked or unlinked
@@ -224,6 +225,11 @@ const variant = computed(() => {
    const flavorKey = props.flavor ? `${props.flavor}_` : "";
    const multipleKey = props.multiple ? `_multiple` : "";
    const variantKey = `${flavorKey}${props.type}${multipleKey}`;
    if (props.disableBatchInput && VARIANTS[variantKey]) {
        return VARIANTS[variantKey]!.filter((v) => {
            return v.batch === BATCH.DISABLED;
        });
    }
    return VARIANTS[variantKey];
});

@@ -523,19 +529,8 @@ const noOptionsWarningMessage = computed(() => {
        @dragover.prevent
        @drop.prevent="onDrop">
        <div class="d-flex flex-column">
            <BButtonGroup v-if="variant && variant.length > 1" buttons class="align-self-start">
                <BButton
                    v-if="props.singleDatasetInput"
                    v-for="(v, index) in variant.slice(0,1)"
                    :key="index"
                    v-b-tooltip.hover.bottom
                    :pressed="currentField === index"
                    :title="v.tooltip"
                    @click="currentField = index">
                    <FontAwesomeIcon :icon="['far', v.icon]" />
                </BButton>
            <BButtonGroup v-if="variant && variant.length > 0" buttons class="align-self-start">
                <BButton
                    v-else
                    v-for="(v, index) in variant"
                    :key="index"
                    v-b-tooltip.hover.bottom
+4 −3
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ import { sanitize } from "dompurify";
import type { ComputedRef } from "vue";
import { computed, ref, useAttrs } from "vue";

import { getGalaxyInstance } from "@/app";
import { linkify } from "@/utils/utils";

import type { FormParameterAttributes, FormParameterTypes, FormParameterValue } from "./parameterTypes";
@@ -48,7 +49,6 @@ interface FormElementProps {
    connectedEnableIcon?: string;
    connectedDisableIcon?: string;
    workflowBuildingMode?: boolean;
    singleDatasetInput?: boolean;
}

const props = withDefaults(defineProps<FormElementProps>(), {
@@ -64,7 +64,6 @@ const props = withDefaults(defineProps<FormElementProps>(), {
    connectedEnableIcon: "fa fa-times",
    connectedDisableIcon: "fa fa-arrows-alt-h",
    workflowBuildingMode: false,
    singleDatasetInput: false,
});

const emit = defineEmits<{
@@ -90,6 +89,8 @@ const collapsed = ref(false);
const collapsible = computed(() => !props.disabled && collapsibleValue.value !== undefined);
const connectable = computed(() => collapsible.value && Boolean(attrs.value["connectable"]));

const disableBatchInput = computed(() => getGalaxyInstance().config.disable_batch_input);

// Determines whether to expand or collapse the input
{
    const valueJson = JSON.stringify(props.value);
@@ -300,7 +301,7 @@ function onAlert(value: string | undefined) {
                :tag="attrs.tag"
                :type="props.type"
                :collection-types="attrs.collection_types"
                :single-dataset-input="props.singleDatasetInput"
                :disable-batch-input="disableBatchInput"
                @alert="onAlert" />
            <FormDrilldown
                v-else-if="props.type === 'drill_down'"
+0 −6
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@
                        :refresh-on-change="false"
                        :disabled="sustainConditionals"
                        :attributes="input.test_param"
                        :single-dataset-input="singleDatasetInput"
                        @change="onChange" />
                    <div v-for="(caseDetails, caseId) in input.cases" :key="caseId">
                        <FormNode
@@ -60,7 +59,6 @@
                :collapsed-disable-icon="collapsedDisableIcon"
                :loading="loading"
                :workflow-building-mode="workflowBuildingMode"
                :single-dataset-input="singleDatasetInput"
                @change="onChange" />
        </div>
    </div>
@@ -131,10 +129,6 @@ export default {
            type: Boolean,
            default: false,
        },
        singleDatasetInput: {
            type: Boolean,
            default: false,
        },
    },
    methods: {
        getPrefix(name, index) {
+1 −5
Original line number Diff line number Diff line
@@ -59,10 +59,6 @@ const props = defineProps({
        type: String,
        default: null,
    },
    singleDatasetInput: {
        type: Boolean,
        default: true,
    },
});

const emit = defineEmits<{
@@ -173,7 +169,7 @@ const { keyObject } = useKeyedObjects();
            </template>

            <template v-slot:body>
                <FormNode v-bind="props.passthroughProps" :inputs="cache" :prefix="getPrefix(cacheId)" :single-dataset-input="props.singleDatasetInput" />
                <FormNode v-bind="props.passthroughProps" :inputs="cache" :prefix="getPrefix(cacheId)" />
            </template>
        </FormCard>

Loading