Skip to content

[WIP] Use GModal in Selection Dialog #20375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion client/src/components/FilesDialog/FilesDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ onMounted(() => {
:provider-url="currentDirectory?.url"
:total-items="totalItems"
:modal-show="modalShow"
:modal-static="modalStatic"
:multiple="multiple"
:options-show="optionsShow"
:select-all-variant="selectAllIcon"
Expand Down
76 changes: 43 additions & 33 deletions client/src/components/SelectionDialog/SelectionDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { type IconDefinition, library } from "@fortawesome/fontawesome-svg-core"
import { faCheckSquare, faMinusSquare, faSquare } from "@fortawesome/free-regular-svg-icons";
import { faCaretLeft, faCheck, faFolder, faSpinner, faTimes } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BAlert, BButton, BLink, BModal, BPagination, BSpinner, BTable } from "bootstrap-vue";
import { BAlert, BButton, BLink, BPagination, BSpinner, BTable } from "bootstrap-vue";
import { computed, ref, watch } from "vue";

import { type ItemsProvider, SELECTION_STATES, type SelectionState } from "@/components/SelectionDialog/selectionTypes";
import type Filtering from "@/utils/filtering";

import type { FieldEntry, SelectionItem } from "./selectionTypes";

import GModal from "../BaseComponents/GModal.vue";
import FilterMenu from "@/components/Common/FilterMenu.vue";
import Heading from "@/components/Common/Heading.vue";
import DataDialogSearch from "@/components/SelectionDialog/DataDialogSearch.vue";
import StatelessTags from "@/components/TagsMultiselect/StatelessTags.vue";

Expand All @@ -35,7 +35,6 @@ interface Props {
leafIcon?: string;
folderIcon?: IconDefinition;
modalShow?: boolean;
modalStatic?: boolean;
multiple?: boolean;
optionsShow?: boolean;
undoShow?: boolean;
Expand Down Expand Up @@ -168,35 +167,48 @@ watch(
}
}
);

const dialog = ref<InstanceType<typeof GModal> | null>(null);
watch(
() => dialog.value,
(newValue) => {
if (newValue) {
dialog.value?.showModal();
}
},
{ immediate: true }
);
</script>

<template>
<BModal
v-if="modalShow"
modal-class="selection-dialog-modal"
header-class="flex-column"
visible
:static="modalStatic"
<GModal
ref="dialog"
class="selection-dialog-modal"
size="medium"
:show="props.modalShow"
fixed-height
footer
:title="title"
@hide="emit('onCancel')">
<template v-slot:modal-header>
<slot name="header">
<Heading v-if="props.title" h2> {{ props.title }} </Heading>
@close="emit('onCancel')">
<template v-slot:header>
<slot name="header" />
</template>

<FilterMenu
v-if="props.filterClass"
:name="props.title"
class="w-100"
:placeholder="props.searchTitle || props.title"
:filter-class="props.filterClass"
:filter-text.sync="filter"
:loading="props.isBusy"
:show-advanced.sync="showAdvancedSearch" />
<FilterMenu
v-if="props.filterClass"
:name="props.title"
class="w-100"
:placeholder="props.searchTitle || props.title"
:filter-class="props.filterClass"
:filter-text.sync="filter"
:loading="props.isBusy"
:show-advanced.sync="showAdvancedSearch" />
<DataDialogSearch v-else v-model="filter" :title="props.searchTitle || props.title" />

<div class="mt-2">
<slot name="helper" />
</div>

<DataDialogSearch v-else v-model="filter" :title="props.searchTitle || props.title" />
</slot>
</template>
<slot name="helper" />
<BAlert v-if="errorMessage" variant="danger" show>
{{ errorMessage }}
</BAlert>
Expand Down Expand Up @@ -274,7 +286,7 @@ watch(
<span>Please wait...</span>
</div>
</div>
<template v-slot:modal-footer>
<template v-slot:footer>
<div class="d-flex justify-content-between w-100">
<div>
<BButton v-if="undoShow" data-description="selection dialog undo" size="sm" @click="emit('onUndo')">
Expand Down Expand Up @@ -312,13 +324,11 @@ watch(
</div>
</div>
</template>
</BModal>
</GModal>
</template>

<style>
.selection-dialog-modal .modal-body {
max-height: 50vh;
height: 50vh;
overflow-y: auto;
<style lang="scss" scoped>
.selection-dialog-modal {
max-height: 70vh;
}
</style>
10 changes: 9 additions & 1 deletion client/src/utils/dataModalUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import $ from "jquery";
import { getAppRoot } from "onload/loadConfig";
import Vue from "vue";

let lastSelectionDialog = null;

// This should be moved more centrally (though still hanging off Galaxy for
// external use?), and populated from the store; just using this as a temporary
// interface.
Expand All @@ -25,10 +27,16 @@ export async function getCurrentGalaxyHistory(galaxy) {
}

export function mountSelectionDialog(clazz, options) {
if (lastSelectionDialog) {
lastSelectionDialog.$destroy();
$(lastSelectionDialog.$el).remove();
lastSelectionDialog = null;
}

const instance = Vue.extend(clazz);
const vm = document.createElement("div");
$("body").append(vm);
new instance({
lastSelectionDialog = new instance({
propsData: options,
}).$mount(vm);
}
Loading