Skip to content

Commit

Permalink
Merge pull request #17338 from ahmedhamidawan/upload_modal_loses_content
Browse files Browse the repository at this point in the history
[23.2] Fix upload modal loses its content when closed
  • Loading branch information
guerler authored Jan 30, 2024
2 parents d840b8c + fe353dc commit 34fab93
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
12 changes: 6 additions & 6 deletions client/src/components/Upload/DefaultBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ const queue = new UploadQueue({
});
/** Add files to queue */
function addFiles(files) {
function addFiles(files, immediate = false) {
if (!isRunning.value) {
if (immediate || !props.multiple) {
eventReset();
}
if (props.multiple) {
queue.add(files);
} else {
eventReset();
if (files.length > 0) {
queue.add([files[0]]);
}
} else if (files.length > 0) {
queue.add([files[0]]);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Upload/UploadContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const showRegular = computed(() => !props.formats || hasRegularExtension);
const showRules = computed(() => !props.formats || props.multiple);
function immediateUpload(files) {
regular.value?.addFiles(files);
regular.value?.addFiles(files, true);
}
function toData(items, history_id, composite = false) {
Expand Down
1 change: 0 additions & 1 deletion client/src/components/Upload/UploadModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ defineExpose({
<UploadContainer
v-if="currentHistoryId"
ref="content"
:key="showModal"
:current-user-id="currentUser?.id"
:current-history-id="currentHistoryId"
v-bind="options"
Expand Down
30 changes: 30 additions & 0 deletions lib/galaxy_test/selenium/test_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,36 @@ def test_upload_paired_list(self):
self.history_panel_wait_for_hid_hidden(3)
self.history_panel_wait_for_hid_hidden(4)

@selenium_test
def test_upload_modal_retains_content(self):
self.home()

# initialize 2 uploads and close modal
self.upload_start_click()
self.upload_queue_local_file(self.get_filename("1.sam"))
self.upload_paste_data("some pasted data")
self.wait_for_and_click_selector("button#btn-close")

# reopen modal and check that the files are still there
self.upload_start_click()
self.wait_for_selector_visible("#upload-row-0.upload-init")
self.wait_for_selector_visible("#upload-row-1.upload-init")

# perform upload and close modal
self.upload_start()
self.wait_for_and_click_selector("button#btn-close")

# add another pasted file, but don't upload it
self.upload_start_click()
self.upload_paste_data("some more pasted data")
self.wait_for_and_click_selector("button#btn-close")

# reopen modal and see 2 uploaded, 1 yet to upload
self.upload_start_click()
self.wait_for_selector_visible("#upload-row-0.upload-success")
self.wait_for_selector_visible("#upload-row-1.upload-success")
self.wait_for_selector_visible("#upload-row-2.upload-init")

@selenium_test
@pytest.mark.gtn_screenshot
@pytest.mark.local
Expand Down

0 comments on commit 34fab93

Please sign in to comment.