Skip to content
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

Libraries Modernisation: Directory Dataset Picker #18638

Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e49b6a5
🛠️: add `modalShow` typing in `FolderTopBar`
itisAliRH Aug 2, 2024
19a1bae
✨: add `leaf`, `fullPath`, and `disabled` properties to `FormDrilldo…
itisAliRH Aug 2, 2024
5839ce3
✨: add optional `leafIcon` and `branchIcon` and `disable` to `FormD…
itisAliRH Aug 2, 2024
57731e4
🎉: create `DirectoryDatasetPicker` to select datasets from paths
itisAliRH Aug 2, 2024
e81a0c8
🎨: use `DirectoryDatasetPicker` in `FolderTopBar` and remove outdated…
itisAliRH Aug 2, 2024
b0b6dfe
🔥: remove `add-datasets.js`
itisAliRH Aug 2, 2024
3e5bea1
🔥: remove `jstree.scss` import from `base.scss`
itisAliRH Aug 2, 2024
cfaf9be
🛠️: refactor FontAwesome icon import in `FolderTopBar` and `FormDrill…
itisAliRH Sep 16, 2024
2cdbbb7
🛠️: refactor remote files fetching logic in `DirectoryDatasetPicker`
itisAliRH Sep 16, 2024
b7d9240
✨: use progress bar on importing datasets from directories
itisAliRH Sep 16, 2024
b4e7605
🛠️: unified dataset addition logic in `FolderTopBar`
itisAliRH Sep 16, 2024
caa4d0e
🛠️: enhanced `DirectoryDatasetPicker` by adding a scroll to the items…
itisAliRH Sep 16, 2024
d31a760
🛠️: use `IconDefinition` for `leafIcon` and `branchIcon` in FormDrill…
itisAliRH Sep 16, 2024
7f622f2
✨: modified `SingleItemSelectors` to utilize flexible `trackBy` and …
itisAliRH Sep 19, 2024
938e5c9
🛠️: replaced `Multiselect` with `SingleItemSelector`, revised data fe…
itisAliRH Sep 19, 2024
d74a025
✨: add no-options alert to `FormDrilldown` and import missing bootstr…
itisAliRH Sep 20, 2024
bcb9a54
🛠️: `DirectoryDatasetPicker` shows error on fetching options and fix …
itisAliRH Sep 20, 2024
1233552
🐛: fix `DirectoryDatasetPicker` components conditions
itisAliRH Sep 20, 2024
6f4549f
🛠️: add unique IDs to drilldown options in `FormDrilldownOption`
itisAliRH Sep 30, 2024
9fd2c0c
🎨: update navigation selectors
itisAliRH Sep 30, 2024
60ea778
🎨: update navigation selector for non exists user import directory in…
itisAliRH Sep 30, 2024
5859880
🛠️: improve `Libraries/LibraryFolder/FolderTopBar` `ImportSource` type
itisAliRH Oct 6, 2024
a44d583
🛠️: update`mapDataToOptions` method input type, in use `errorMessage…
itisAliRH Oct 6, 2024
19d2ba4
🛠️: using any for `fetchOptions` data in `DirectoryDatasetPicker` bec…
itisAliRH Oct 7, 2024
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
40 changes: 25 additions & 15 deletions client/src/components/Form/Elements/FormDrilldown/FormDrilldown.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { BAlert, BFormCheckbox } from "bootstrap-vue";
import { computed, type ComputedRef } from "vue";

import { findDescendants, flattenValues, getAllValues, type Option, type Value } from "./utilities";
Expand All @@ -11,10 +12,12 @@ const props = withDefaults(
value?: Value;
options: Array<Option>;
multiple: boolean;
showIcons?: boolean;
}>(),
{
value: null,
multiple: true,
showIcons: false,
}
);

Expand Down Expand Up @@ -91,20 +94,27 @@ function setElementValues(oldArray: string[], newArray: string[], value: string)
</script>

<template>
<div v-if="hasOptions">
<b-form-checkbox
v-if="multiple"
v-localize
:checked="selectAllChecked"
:indeterminate="selectAllIndeterminate"
class="d-inline select-all-checkbox"
@change="onSelectAll">
Select / Deselect All
</b-form-checkbox>
<FormDrilldownList
:multiple="multiple"
:current-value="currentValue"
:options="options"
:handle-click="handleClick" />
<div>
<div v-if="hasOptions">
<BFormCheckbox
v-if="multiple"
v-localize
:checked="selectAllChecked"
:indeterminate="selectAllIndeterminate"
class="d-inline select-all-checkbox"
@change="onSelectAll">
Select / Deselect All
</BFormCheckbox>

<FormDrilldownList
:show-icons="showIcons"
:multiple="multiple"
:current-value="currentValue"
:options="options"
:handle-click="handleClick" />
</div>
<div v-else>
<BAlert show variant="info" class="mt-2"> No options available. </BAlert>
</div>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defineProps<{
currentValue: string[];
handleClick: Function;
multiple: boolean;
showIcons?: boolean;
options: Array<Option>;
}>();
</script>
Expand All @@ -15,6 +16,7 @@ defineProps<{
<div class="ui-drilldown">
<div v-for="option in options" :key="option.name" class="descendant-lines">
<FormDrilldownOption
:show-icons="showIcons"
:current-value="currentValue"
:handle-click="handleClick"
:multiple="multiple"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
<script setup lang="ts">
import { faCaretDown, faCaretRight, faFile, faFolder, type IconDefinition } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BFormCheckbox, BFormRadio } from "bootstrap-vue";
import { computed, type ComputedRef, onMounted, ref } from "vue";

import { getAllValues, type Option } from "./utilities";

import FormDrilldownList from "./FormDrilldownList.vue";

const props = defineProps<{
interface Props {
currentValue: string[];
option: Option;
handleClick: Function;
multiple: boolean;
}>();
showIcons?: boolean;
leafIcon?: IconDefinition;
branchIcon?: IconDefinition;
}

const props = withDefaults(defineProps<Props>(), {
leafIcon: () => faFile,
branchIcon: () => faFolder,
});

const showChildren = ref(false);

Expand Down Expand Up @@ -43,6 +53,11 @@ function toggleInitialization(): void {
}
}
}

function getOptionIcon(option: Option) {
return option.leaf ? props.leafIcon : props.branchIcon;
}

onMounted(() => {
toggleInitialization();
});
Expand All @@ -51,22 +66,26 @@ onMounted(() => {
<template>
<div>
<b-button v-if="hasOptions" variant="link" class="btn p-0" @click="toggleChildren">
<i v-if="showChildren" class="fa fa-caret-down align-checkbox" />
<i v-else class="fa fa-caret-right align-checkbox" />
<FontAwesomeIcon v-if="showChildren" :icon="faCaretDown" class="align-checkbox" />
<FontAwesomeIcon v-else :icon="faCaretRight" class="align-checkbox" />
</b-button>
<span v-if="!hasOptions" class="align-indent"></span>
<component
:is="isComponent"
:id="`drilldown-option-${option.name}`"
class="drilldown-option d-inline"
value="true"
:disabled="option.disabled"
:checked="isChecked"
@change="handleClick(option.value, $event)">
<FontAwesomeIcon v-if="props.showIcons" :icon="getOptionIcon(option)" />
{{ option.name }}
</component>
<FormDrilldownList
v-if="hasOptions"
v-show="showChildren"
class="indent"
:show-icons="props.showIcons"
:current-value="currentValue"
:multiple="multiple"
:options="option.options"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export interface Option {
name: string;
value: string;
leaf?: boolean;
fullPath?: string;
disabled?: boolean;
options: Array<Option>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
collection-name="Database/Builds"
:loading="loadingDbKeys"
:items="dbkeys"
:current-item-id="selectedDbKey"
:current-item="selectedDbKey"
@update:selected-item="onSelectedDbKey" />
</DbKeyProvider>
</b-modal>
Expand All @@ -116,7 +116,7 @@
collection-name="Data Types"
:loading="loadingDatatypes"
:items="datatypes"
:current-item-id="selectedDatatype"
:current-item="selectedDatatype"
@update:selected-item="onSelectedDatatype" />
</DatatypesProvider>
</b-modal>
Expand Down Expand Up @@ -186,8 +186,8 @@ export default {
},
data: function () {
return {
selectedDbKey: "?",
selectedDatatype: "auto",
selectedDbKey: { id: "?", text: "unspecified (?)" },
selectedDatatype: { id: "auto", text: "Auto-detect" },
selectedTags: [],
};
},
Expand Down Expand Up @@ -307,12 +307,12 @@ export default {
this.runOnSelection(purgeSelectedContent);
},
changeDbkeyOfSelected() {
this.runOnSelection(changeDbkeyOfSelectedContent, { dbkey: this.selectedDbKey });
this.selectedDbKey = "?";
this.runOnSelection(changeDbkeyOfSelectedContent, { dbkey: this.selectedDbKey.id });
this.selectedDbKey = { id: "?" };
},
changeDatatypeOfSelected() {
this.runOnSelection(changeDatatypeOfSelectedContent, { datatype: this.selectedDatatype });
this.selectedDatatype = "auto";
this.runOnSelection(changeDatatypeOfSelectedContent, { datatype: this.selectedDatatype.id });
this.selectedDatatype = { id: "auto", text: "Auto-detect" };
},
addTagsToSelected() {
this.runOnSelection(addTagsToSelectedContent, { tags: this.selectedTags });
Expand Down Expand Up @@ -354,10 +354,10 @@ export default {
this.$emit("operation-error", { errorMessage, result });
},
onSelectedDbKey(dbkey) {
this.selectedDbKey = dbkey.id;
this.selectedDbKey = dbkey;
},
onSelectedDatatype(datatype) {
this.selectedDatatype = datatype.id;
this.selectedDatatype = datatype;
},

// collection creation, fires up a modal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
collection-name="Data Types"
:loading="loadingDatatypes"
:items="datatypes"
:current-item-id="dataset.file_ext"
:current-item="datatypes?.find((datatype) => datatype.id === dataset.file_ext)"
@update:selected-item="onSelectedDatatype" />
</DatatypesProvider>
<DbKeyProvider
Expand All @@ -93,7 +93,7 @@
collection-name="Database/Builds"
:loading="loadingDbKeys"
:items="dbkeys"
:current-item-id="dataset.genome_build"
:current-item="dbkeys?.find((dbkey) => dbkey.id === dataset.genome_build)"
@update:selected-item="onSelectedDbKey" />
</DbKeyProvider>
<b-form-input
Expand Down
Loading
Loading