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

Merge 24.2 into dev #19240

Merged
merged 185 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
185 commits
Select commit Hold shift + click to select a range
a05ec3f
24.2 release testing - UI tests for new workflow parameters
jmchilton Nov 21, 2024
2f7c1e5
Merge pull request #19182 from jmchilton/selenium_24.2
mvdbeek Nov 27, 2024
433766e
Allow setting default value for required parameter
mvdbeek Sep 7, 2024
0f5a89a
Remove now unused input_default_value property
mvdbeek Nov 28, 2024
70a74c2
Fix and add test for required workflow parameters with a default value
mvdbeek Nov 29, 2024
6474ed1
Adjust EmptyValueFilter
mvdbeek Nov 29, 2024
8aa986f
Extend tests
mvdbeek Nov 29, 2024
5d4e341
Replace explicit null with default value
mvdbeek Nov 29, 2024
59dc2a4
Add test for default value with optional input
mvdbeek Nov 29, 2024
d4c2101
Merge pull request #19219 from mvdbeek/required_parameters_with_default
jmchilton Nov 29, 2024
7cd2147
This really stablizes these tests - they sort of runaway without this.
jmchilton Nov 19, 2024
abe326a
fix pesky warning
ElectronicBlueberry Nov 21, 2024
d44f037
add button for creating a list from run form field
ahmedhamidawan Sep 19, 2024
6d90374
fully implement `list` collection creator in `FormData`
ahmedhamidawan Sep 26, 2024
4b20276
add a `maintain-selection-order` prop to `FormSelectMany`
ahmedhamidawan Sep 26, 2024
0eaccd5
fix reactivity of `ClickToEdit` and add some styling
ahmedhamidawan Oct 1, 2024
f53170f
`ListCollectionCreator`: add more types
ahmedhamidawan Oct 1, 2024
35ff19d
modernize/refactor `PairedListCollectionCreator` for input forms
ahmedhamidawan Oct 1, 2024
6a504c0
remove the extensions toggle, only include `isSubTypeOfAny` items
ahmedhamidawan Oct 1, 2024
74234e0
improve styling of collection create button in `FormData`
ahmedhamidawan Oct 1, 2024
6862f64
change create new collection `ButtonSpinner` variant
ahmedhamidawan Oct 3, 2024
297a529
change create new collection `ButtonSpinner` title; fix icon imports
ahmedhamidawan Oct 3, 2024
67f3105
add history name to modal header
ahmedhamidawan Oct 4, 2024
e844241
restrict the `list:paired` creator to required extensions
ahmedhamidawan Oct 7, 2024
16c4eea
make the "pairing" section in `list:paired` builder expand/collapseable
ahmedhamidawan Oct 7, 2024
8a9d9ac
add `CollectionCreatorModal` that replaces `buildCollectionModal`
ahmedhamidawan Oct 18, 2024
b9f8f3c
slight optimization
ahmedhamidawan Oct 18, 2024
3a827cc
(incomplete/WIP) add uploader to collection creator
ahmedhamidawan Oct 21, 2024
60a5fb7
`paired` collection items are now also reversed like history
ahmedhamidawan Nov 19, 2024
fa572ad
add uploaded files to collection directly
ahmedhamidawan Nov 19, 2024
b70f90c
Fix jest collection modal test to be more flexible, allowing title co…
dannon Nov 19, 2024
99447d6
remove legacy JQuery collection creator modal files
ahmedhamidawan Nov 19, 2024
c2ab795
fix `PairedListCollectionCreator` jest
ahmedhamidawan Nov 19, 2024
29796d4
fix selectors for the changes to the collection builder
ahmedhamidawan Nov 22, 2024
03527bd
do not show create another collection link if from selection
ahmedhamidawan Dec 2, 2024
56ccef4
fix selection for collection creator in libraries
ahmedhamidawan Dec 3, 2024
b9adc1b
fix reset function when creating collection from a selection
ahmedhamidawan Dec 3, 2024
e09a364
fix `selection` object for rule collection builder
ahmedhamidawan Dec 3, 2024
9deac09
ensure library import to collection modal closes
ahmedhamidawan Dec 3, 2024
f5e146d
Merge pull request #18857 from ahmedhamidawan/guide_users_to_collecti…
dannon Dec 3, 2024
06d870e
generalize activity bar
ElectronicBlueberry Aug 20, 2024
f5b2cab
add activity bar to workflow editor
ElectronicBlueberry Aug 20, 2024
1ea75e1
add activities to activity bar
ElectronicBlueberry Aug 21, 2024
ffc6e1d
add save and exit activity
ElectronicBlueberry Aug 22, 2024
4747e87
route to workflow list on exit
ElectronicBlueberry Aug 22, 2024
37b2d4e
move best practices to activity bar
ElectronicBlueberry Aug 22, 2024
47f0ea3
use ActivityPanel component for Lint
ElectronicBlueberry Aug 23, 2024
1436031
move UndoRedoStack to activity bar
ElectronicBlueberry Aug 23, 2024
f8b8fe9
add placeholder activities
ElectronicBlueberry Aug 23, 2024
dc44c14
fix delayed input
ElectronicBlueberry Aug 28, 2024
b2aee86
make favorites button reusable
ElectronicBlueberry Aug 28, 2024
fdd3b11
refactor WorkflowCard
ElectronicBlueberry Aug 29, 2024
9ceee38
improve performance of workflow card
ElectronicBlueberry Aug 29, 2024
02c7511
add workflows panel
ElectronicBlueberry Sep 5, 2024
2cd580f
fix z-indexing for dropdown
ElectronicBlueberry Sep 6, 2024
c9e0483
connect insert and insert steps events
ElectronicBlueberry Sep 6, 2024
ef8aab1
move breakpoints to partial
ElectronicBlueberry Sep 6, 2024
377e0d5
only occupy vertical space if invocations count is present
ElectronicBlueberry Sep 9, 2024
62285a3
rename Attributes to WorkflowAttributes
ElectronicBlueberry Sep 9, 2024
fa4aa6d
make attributes an activity
ElectronicBlueberry Sep 9, 2024
dbe8d24
move MarkdownEditor to activity bar
ElectronicBlueberry Sep 9, 2024
bb599c6
move all options to activity bar
ElectronicBlueberry Sep 10, 2024
136b68f
add save button
ElectronicBlueberry Sep 23, 2024
89aad6a
remove unused attribute and unreachable code
ElectronicBlueberry Sep 23, 2024
46f30b6
enable run and save
ElectronicBlueberry Sep 23, 2024
12ad230
fix activity text centering on chrome
ElectronicBlueberry Sep 23, 2024
b9d87a9
fix text short property collision
ElectronicBlueberry Sep 24, 2024
32c60ce
decouple node inspector from right hand panel
ElectronicBlueberry Sep 27, 2024
1d4090f
modularize drag handle
ElectronicBlueberry Oct 8, 2024
7300e7b
correct appearance of drag handle
ElectronicBlueberry Oct 8, 2024
8522aaa
show collapse button
ElectronicBlueberry Oct 8, 2024
8dca4d2
add tool form to node inspector
ElectronicBlueberry Oct 14, 2024
7f88c81
add inspector heading
ElectronicBlueberry Oct 16, 2024
6073a1d
allow for saving default sizes for tools / steps
ElectronicBlueberry Oct 17, 2024
ecbebaa
make double click maximize node inspector
ElectronicBlueberry Oct 18, 2024
c04f53e
fix scroll height
ElectronicBlueberry Oct 18, 2024
ab5e901
add form default to inspector
ElectronicBlueberry Oct 18, 2024
28c488c
make form default full width
ElectronicBlueberry Oct 21, 2024
0fb7502
remove ability to sub-workflow own workflow
ElectronicBlueberry Oct 21, 2024
46a4c7b
connect refresh list signal
ElectronicBlueberry Oct 21, 2024
65dec1e
fix workflow creation
ElectronicBlueberry Oct 21, 2024
e2e65b1
make current workflow immutable from card
ElectronicBlueberry Oct 22, 2024
ae58b8d
replace save with save and exit
ElectronicBlueberry Oct 22, 2024
0be4c1d
add save button to title bar
ElectronicBlueberry Oct 22, 2024
62b6ed2
move initial position to not interfere with toolbar
ElectronicBlueberry Oct 24, 2024
60ef378
make step annotation resizable
ElectronicBlueberry Oct 24, 2024
f440a86
fix activity item test
ElectronicBlueberry Oct 28, 2024
3bb365b
fix workflow attributes test
ElectronicBlueberry Oct 28, 2024
169496f
fxi activity store test
ElectronicBlueberry Oct 28, 2024
47392d6
fix empty divs rendered
ElectronicBlueberry Oct 28, 2024
b191a19
fix activity settings test
ElectronicBlueberry Oct 28, 2024
c98a167
fix lint test
ElectronicBlueberry Oct 28, 2024
5c6058d
fix filter conversion test
ElectronicBlueberry Oct 28, 2024
3bddb47
fix workflow filters import
ElectronicBlueberry Oct 28, 2024
01b2bb9
remove broken test case
ElectronicBlueberry Oct 28, 2024
a478e03
remove workflows section in tool box
ElectronicBlueberry Oct 29, 2024
9c94e66
add back activity item id
ElectronicBlueberry Oct 30, 2024
1aebab7
make workflow editor default to attributes
ElectronicBlueberry Oct 31, 2024
140d94e
add class for editor save button
ElectronicBlueberry Nov 4, 2024
1234a56
move selector to id
ElectronicBlueberry Nov 4, 2024
1c1aea4
fix auto layout
ElectronicBlueberry Nov 4, 2024
869f561
add button titles to node inspector
ElectronicBlueberry Nov 4, 2024
7b8e162
fix maximize center pane function
ElectronicBlueberry Nov 4, 2024
1ff3dc0
make auto layout respect grid and snapping
ElectronicBlueberry Nov 5, 2024
f1c68dc
make auto layout an action
ElectronicBlueberry Nov 7, 2024
88a24e6
make activity panel scrollable
ElectronicBlueberry Nov 7, 2024
7f98026
close inspector instead of showing attributes
ElectronicBlueberry Nov 11, 2024
2cd6b9b
open nodes from lint panel
ElectronicBlueberry Nov 11, 2024
1d9df1d
auto layout frame comments
ElectronicBlueberry Nov 11, 2024
cb10614
undo comment auto layout
ElectronicBlueberry Nov 11, 2024
13c9c77
consider comments in layout
ElectronicBlueberry Nov 11, 2024
97dbde1
move freehand comments with their closest comment preserving large dr…
ElectronicBlueberry Nov 11, 2024
88a88e4
fix edge crossing
ElectronicBlueberry Nov 11, 2024
6fa52cb
associate comments to their closest node
ElectronicBlueberry Nov 12, 2024
e352336
make auto layout a toolbar tool
ElectronicBlueberry Nov 12, 2024
a381310
pass step position for more accurate comment positioning
ElectronicBlueberry Nov 12, 2024
63aaaad
disable run button on new workflow
ElectronicBlueberry Nov 13, 2024
b3b00ed
Update client/src/components/ActivityBar/ActivityBar.vue
itisAliRH Nov 15, 2024
8103f7c
Updates bookmark toggle function parameters
itisAliRH Nov 15, 2024
eda1534
Removes non-existent config property usage
itisAliRH Nov 15, 2024
95b4043
Adds workflowId to useStores return object
itisAliRH Nov 15, 2024
5333a7b
Adds computed property for tools favorites toggle
itisAliRH Nov 15, 2024
4fc923c
Fixes FontAwesome icon usage in ToolPanel
itisAliRH Nov 15, 2024
995b226
Fix the test to check the shared indicator tooltip text
itisAliRH Nov 15, 2024
d2e4a8a
Adds Pinia testing support to ActivityItem tests and add required pro…
itisAliRH Nov 15, 2024
8ee9806
Updates workflow type to StoredWorkflowDetailed
itisAliRH Nov 15, 2024
d0d6c51
Fixes import path and adds activity bar ID to NotificationItem
itisAliRH Nov 15, 2024
7aa575a
Adds activity-bar-id prop to ActivityItem components
itisAliRH Nov 15, 2024
eaf09ba
Adds favorites filter functionality to WorkflowPanel
itisAliRH Nov 15, 2024
f461d7c
Refactors icon imports and usage
itisAliRH Nov 15, 2024
6640b28
Updates icon handling in tests
itisAliRH Nov 15, 2024
160d871
Updates filter keyword for workflow bookmarks
itisAliRH Nov 15, 2024
b90c96b
Simplifies activity item IDs
itisAliRH Nov 17, 2024
67cc231
Fix activity item upload progress background
itisAliRH Nov 17, 2024
db252e3
Adds ID to toolbox panel
itisAliRH Nov 17, 2024
4b88521
Adds auto-layout button ID in workflow toolbar
itisAliRH Nov 17, 2024
5d4af22
Adds hidePanel prop to ActivityBar and integrates MarkdownToolBox in …
itisAliRH Nov 18, 2024
7b3453a
remove wait for absent element
ElectronicBlueberry Nov 18, 2024
40b0e61
fix add_input
ElectronicBlueberry Nov 18, 2024
1b2fe7a
fix inserting steps
ElectronicBlueberry Nov 18, 2024
b19cbe4
fix tool menu container occurrences
ElectronicBlueberry Nov 18, 2024
5cb6784
Migrates WorkflowAttributes test to TypeScript and updates dependencies
itisAliRH Nov 18, 2024
f6ec31a
fix workflows activity id
ElectronicBlueberry Nov 19, 2024
da11b07
Migrates ToolPanel test to TypeScript
itisAliRH Nov 19, 2024
c054c71
Updates toolbox panel selectors and workflow editor logic
itisAliRH Nov 19, 2024
a99a82a
Adds 'Save As' functionality to workflow editor
itisAliRH Nov 19, 2024
fec3214
Adds 'Save As' option to workflow editor toolbar
itisAliRH Nov 19, 2024
fc5f2f0
fix basics test
ElectronicBlueberry Nov 20, 2024
5c02c41
revert shortening of ids
ElectronicBlueberry Nov 20, 2024
df4f7d4
fix test save as
ElectronicBlueberry Nov 20, 2024
09bcf33
add more wait time for search
ElectronicBlueberry Nov 20, 2024
263f0d6
re-add confirm dialog
ElectronicBlueberry Nov 20, 2024
320a0f1
remove double id prepending
ElectronicBlueberry Nov 20, 2024
5b0150e
redo add subworkflow
ElectronicBlueberry Nov 20, 2024
d9d1c15
fix save as selector
ElectronicBlueberry Nov 20, 2024
11519d4
move selection options to the left, so they do not interfere with the…
ElectronicBlueberry Nov 20, 2024
4a33bca
remove collapse buttons from basics test
ElectronicBlueberry Nov 20, 2024
21ceb30
wait for save to complete
ElectronicBlueberry Nov 21, 2024
b84ad70
remove test for removed feature
ElectronicBlueberry Nov 21, 2024
a16574a
remove invalid check in insert steps
ElectronicBlueberry Nov 21, 2024
852fc4c
remove test for removed component
ElectronicBlueberry Nov 21, 2024
b565fea
make search selector more specific
ElectronicBlueberry Nov 25, 2024
d899b92
fix selection test
ElectronicBlueberry Nov 25, 2024
5c8b958
clear search before searching for other tool
ElectronicBlueberry Nov 25, 2024
1dca036
use confirm dialog composable
ElectronicBlueberry Nov 25, 2024
43ddb6d
exclude node buttons from node selection targets
ElectronicBlueberry Nov 25, 2024
123843e
use latest id on insert
ElectronicBlueberry Nov 25, 2024
ea06e77
save latest id to dict
ElectronicBlueberry Nov 25, 2024
63a67ec
fix test_non_data_connections test
ElectronicBlueberry Nov 25, 2024
6e7585c
fix test_editor_duplicate_node test
ElectronicBlueberry Nov 25, 2024
85bde64
fix event name for markdown update in PageEditorMarkdown component
davelopez Nov 26, 2024
4b3ee52
Merge branch 'release_24.2' into merge_24.2_into_dev
jmchilton Dec 3, 2024
d59861f
Avoid unhelpful accepted format drop downs.
jmchilton Dec 3, 2024
247d679
Upload on empty?
jmchilton Dec 3, 2024
5dbf3b0
add a message and link to upload tab if no initial elements
ahmedhamidawan Dec 3, 2024
ef82f8f
Merge pull request #19241 from jmchilton/avoid_unhelpful_formats
ahmedhamidawan Dec 3, 2024
82b410a
remove useless "Cancel" buttons, add upload message
ahmedhamidawan Dec 3, 2024
f6dad7b
Pass redirect_uri back to authnz login
dannon Dec 4, 2024
bafcc91
Add support for storing and retrieving login redirect URI in cookies
dannon Dec 4, 2024
66fc7a6
Fix method sig, cleanup
dannon Dec 4, 2024
90e6393
fix rebased test function
ElectronicBlueberry Dec 4, 2024
f5cb35c
Merge pull request #19242 from jmchilton/improve_empty_message
ahmedhamidawan Dec 4, 2024
f47df34
Merge pull request #19212 from dannon/workflow-editor-activity-bar
jdavcs Dec 4, 2024
963ae52
Merge pull request #19247 from dannon/fix-psa-redirect
jdavcs Dec 4, 2024
67118bb
Merge branch 'release_24.2' into merge_24.2_into_dev
jmchilton Dec 5, 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
3 changes: 3 additions & 0 deletions client/src/api/datatypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { type components } from "@/api";

export type CompositeFileInfo = components["schemas"]["CompositeFileInfo"];
3 changes: 3 additions & 0 deletions client/src/api/histories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { type components } from "@/api";

export type HistoryContentsResult = components["schemas"]["HistoryContentsResult"];
326 changes: 326 additions & 0 deletions client/src/components/Collections/CollectionCreatorModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,326 @@
<script setup lang="ts">
import { faCheckCircle, faUndo } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BAlert, BLink, BModal } from "bootstrap-vue";
import { computed, ref, watch } from "vue";

import type { HDASummary, HistoryItemSummary, HistorySummary } from "@/api";
import { createDatasetCollection } from "@/components/History/model/queries";
import { useCollectionBuilderItemsStore } from "@/stores/collectionBuilderItemsStore";
import { useHistoryStore } from "@/stores/historyStore";
import localize from "@/utils/localization";
import { orList } from "@/utils/strings";

import type { CollectionType, DatasetPair } from "../History/adapters/buildCollectionModal";

import ListCollectionCreator from "./ListCollectionCreator.vue";
import PairCollectionCreator from "./PairCollectionCreator.vue";
import PairedListCollectionCreator from "./PairedListCollectionCreator.vue";
import Heading from "@/components/Common/Heading.vue";
import GenericItem from "@/components/History/Content/GenericItem.vue";
import LoadingSpan from "@/components/LoadingSpan.vue";

interface Props {
historyId: string;
showModal: boolean;
collectionType: CollectionType;
selectedItems?: HistoryItemSummary[];
defaultHideSourceItems?: boolean;
extensions?: string[];
fromRulesInput?: boolean;
hideModalOnCreate?: boolean;
filterText?: string;
}
const props = defineProps<Props>();

const emit = defineEmits<{
(e: "created-collection", collection: any): void;
(e: "update:show-modal", showModal: boolean): void;
}>();

/** Computed toggle that handles opening and closing the modal */
const localShowToggle = computed({
get: () => props.showModal,
set: (value: boolean) => {
emit("update:show-modal", value);
},
});

// Create Collection refs
const creatingCollection = ref(false);
const createCollectionError = ref<string | null>(null);
const createdCollection = ref<any>(null);

// History items variables
const historyItemsError = ref<string | null>(null);
const collectionItemsStore = useCollectionBuilderItemsStore();
const historyStore = useHistoryStore();
const history = computed(() => historyStore.getHistoryById(props.historyId));
const historyId = computed(() => props.historyId);
const localFilterText = computed(() => props.filterText || "");
const historyUpdateTime = computed(() => history.value?.update_time);
const isFetchingItems = computed(() => collectionItemsStore.isFetching[localFilterText.value]);
const historyDatasets = computed(() => {
if (collectionItemsStore.cachedDatasetsForFilterText) {
return collectionItemsStore.cachedDatasetsForFilterText[localFilterText.value] || [];
} else {
return [];
}
});

/** Flag for the initial fetch of history items */
const initialFetch = ref(false);

/** Whether a list of items was selected to create a collection from */
const fromSelection = computed(() => !!props.selectedItems?.length);

/** Items to create the collection from */
const creatorItems = computed(() => (fromSelection.value ? props.selectedItems : historyDatasets.value));

watch(
() => localShowToggle.value,
async (show) => {
if (show) {
await fetchHistoryDatasets();
if (!initialFetch.value) {
initialFetch.value = true;
}
}
},
{ immediate: true }
);

// Fetch items when history ID or update time changes, only if localShowToggle is true
watch([historyId, historyUpdateTime, localFilterText], async () => {
if (localShowToggle.value) {
await fetchHistoryDatasets();
}
});

// If there is a change in `historyDatasets`, but we have selected items, we should update the selected items
watch(
() => historyDatasets.value,
(newDatasets) => {
if (fromSelection.value) {
// find each selected item in the new datasets, and update it
props.selectedItems?.forEach((selectedItem) => {
const newDataset = newDatasets.find((dataset) => dataset.id === selectedItem.id);
if (newDataset) {
Object.assign(selectedItem, newDataset);
}
});
}
}
);

const modalTitle = computed(() => {
if (props.collectionType === "list") {
return localize(
`Create a collection from a list of ${fromSelection.value ? "selected" : ""} ${
props.extensions?.length ? orList(props.extensions) : ""
} datasets`
);
} else if (props.collectionType === "list:paired") {
return localize(
`Create a collection of ${fromSelection.value ? "selected" : ""} ${
props.extensions?.length ? orList(props.extensions) : ""
} dataset pairs`
);
} else if (props.collectionType === "paired") {
return localize(
`Create a ${props.extensions?.length ? orList(props.extensions) : ""} dataset pair collection ${
fromSelection.value ? "from selected items" : ""
}`
);
} else {
return localize("Create a collection");
}
});

// Methods
function createListCollection(elements: HDASummary[], name: string, hideSourceItems: boolean) {
const returnedElems = elements.map((element) => ({
id: element.id,
name: element.name,
//TODO: this allows for list:list even if the implementation does not - reconcile
src: "src" in element ? element.src : element.history_content_type == "dataset" ? "hda" : "hdca",
}));
return createHDCA(returnedElems, "list", name, hideSourceItems);
}

function createListPairedCollection(elements: DatasetPair[], name: string, hideSourceItems: boolean) {
const returnedElems = elements.map((pair) => ({
collection_type: "paired",
src: "new_collection",
name: pair.name,
element_identifiers: [
{
name: "forward",
id: pair.forward.id,
src: "src" in pair.forward ? pair.forward.src : "hda",
},
{
name: "reverse",
id: pair.reverse.id,
src: "src" in pair.reverse ? pair.reverse.src : "hda",
},
],
}));
return createHDCA(returnedElems, "list:paired", name, hideSourceItems);
}

function createPairedCollection(elements: DatasetPair, name: string, hideSourceItems: boolean) {
const { forward, reverse } = elements;
const returnedElems = [
{ name: "forward", src: "src" in forward ? forward.src : "hda", id: forward.id },
{ name: "reverse", src: "src" in reverse ? reverse.src : "hda", id: reverse.id },
];
return createHDCA(returnedElems, "paired", name, hideSourceItems);
}

async function createHDCA(
element_identifiers: any[],
collection_type: CollectionType,
name: string,
hide_source_items: boolean,
options = {}
) {
try {
creatingCollection.value = true;
const collection = await createDatasetCollection(history.value as HistorySummary, {
collection_type,
name,
hide_source_items,
element_identifiers,
options,
});

emit("created-collection", collection);
createdCollection.value = collection;

if (props.hideModalOnCreate) {
hideModal();
}
} catch (error) {
createCollectionError.value = error as string;
} finally {
creatingCollection.value = false;
}
}

async function fetchHistoryDatasets() {
const { error } = await collectionItemsStore.fetchDatasetsForFiltertext(
historyId.value,
historyUpdateTime.value,
localFilterText.value
);
if (error) {
historyItemsError.value = error;
console.error("Error fetching history items:", historyItemsError.value);
} else {
historyItemsError.value = null;
}
}

function hideModal() {
localShowToggle.value = false;
}

function resetModal() {
createCollectionError.value = null;
createdCollection.value = null;
}
</script>

<template>
<BModal
id="collection-creator-modal"
v-model="localShowToggle"
:busy="(fromSelection && isFetchingItems) || creatingCollection"
modal-class="ui-modal collection-creator-modal"
:hide-footer="!createdCollection && !createCollectionError"
:ok-disabled="!!createdCollection || !!createCollectionError"
:cancel-title="localize('Exit')"
footer-class="d-flex justify-content-between"
:ok-title="localize('Create Collection')"
@hidden="resetModal">
<template v-slot:modal-header>
<Heading class="w-100" size="sm">
<div class="d-flex justify-content-between unselectable w-100">
<div>{{ modalTitle }}</div>
<div v-if="!!history">
From history: <b>{{ history.name }}</b>
</div>
</div>
</Heading>
</template>
<BAlert v-if="isFetchingItems && !initialFetch" variant="info" show>
<LoadingSpan :message="localize('Loading items')" />
</BAlert>
<BAlert v-else-if="!fromSelection && historyItemsError" variant="danger" show>
{{ historyItemsError }}
</BAlert>
<BAlert v-else-if="creatingCollection" variant="info" show>
<LoadingSpan :message="localize('Creating collection')" />
</BAlert>
<BAlert v-else-if="createCollectionError" variant="danger" show>
{{ createCollectionError }}
<BLink class="text-decoration-none" @click.stop.prevent="resetModal">
<FontAwesomeIcon :icon="faUndo" fixed-width />
{{ localize("Try again") }}
</BLink>
</BAlert>
<div v-else-if="createdCollection">
<BAlert variant="success" show>
<FontAwesomeIcon :icon="faCheckCircle" class="text-success" fixed-width />
{{ localize("Collection created successfully.") }}
<BLink v-if="!fromSelection" class="text-decoration-none" @click.stop.prevent="resetModal">
<FontAwesomeIcon :icon="faUndo" fixed-width />
{{ localize("Create another collection") }}
</BLink>
</BAlert>

<!-- TODO: This is a bit shady, better if we confirm it is a collection type -->
<GenericItem :item-id="createdCollection.id" item-src="hdca" />
</div>
<ListCollectionCreator
v-else-if="props.collectionType === 'list'"
:history-id="props.historyId"
:initial-elements="creatorItems || []"
:default-hide-source-items="props.defaultHideSourceItems"
:from-selection="fromSelection"
:extensions="props.extensions"
@clicked-create="createListCollection"
@on-cancel="hideModal" />
<PairedListCollectionCreator
v-else-if="props.collectionType === 'list:paired'"
:history-id="props.historyId"
:initial-elements="creatorItems || []"
:default-hide-source-items="props.defaultHideSourceItems"
:from-selection="fromSelection"
:extensions="props.extensions"
@clicked-create="createListPairedCollection"
@on-cancel="hideModal" />
<PairCollectionCreator
v-else-if="props.collectionType === 'paired'"
:history-id="props.historyId"
:initial-elements="creatorItems || []"
:default-hide-source-items="props.defaultHideSourceItems"
:from-selection="fromSelection"
:extensions="props.extensions"
@clicked-create="createPairedCollection"
@on-cancel="hideModal" />
</BModal>
</template>

<style lang="scss">
/** NOTE: Not using `<style scoped> here because these classes are
`BModal` `body-class` and `content-class` and don't seem to work
with scoped */
.collection-creator-modal {
.modal-dialog {
width: 85%;
max-width: 100%;
}
}
</style>
Loading
Loading