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

Fix auto-detect metadata from Edit Dataset Attributes panel #19025

Merged
merged 2 commits into from
Oct 26, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ onMounted(async () => {
v-if="
(!datasetAttributes['conversion_disable'] || !datasetAttributes['datatype_disable']) &&
!datasetAttributes['metadata_disable']
">
"
title-link-class="dataset-edit-datatype-tab">
<template v-slot:title>
<FontAwesomeIcon :icon="faDatabase" class="mr-1" />
{{ localize("Datatypes") }}
Expand Down Expand Up @@ -168,7 +169,9 @@ onMounted(async () => {
{{ localize("Save") }}
</BButton>

<BButton @click="submit('datatype', 'datatype_detect')">
<BButton
id="dataset-attributes-autodetect-datatype"
@click="submit('datatype', 'datatype_detect')">
<FontAwesomeIcon :icon="faRedo" class="mr-1" />
{{ localize("Auto-detect") }}
</BButton>
Expand Down
3 changes: 3 additions & 0 deletions client/src/utils/navigation/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ edit_dataset_attributes:
name_input: '[aria-labelledby="dataset-attributes-heading"] input#name'
info_input: '[aria-labelledby="dataset-attributes-heading"] textarea#info'
annotation_input: '[aria-labelledby="dataset-attributes-heading"] textarea#annotation'
datatypes_tab: '.dataset-edit-datatype-tab'
datatype_dropdown: ' #datatype .multiselect'
save_button: '#dataset-attributes-default-save'
auto_detect_datatype_button: '#dataset-attributes-autodetect-datatype'
alert: '.dataset-attributes-alert'

dbkey_dropdown_results:
Expand Down
3 changes: 1 addition & 2 deletions lib/galaxy/webapps/galaxy/controllers/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ def set_edit(self, trans, payload=None, **kwd):
trans.app.datatypes_registry.set_external_metadata_tool,
trans,
incoming={"input1": data},
overwrite=False,
) # overwrite is False as per existing behavior
)
trans.app.job_manager.enqueue(job, tool=trans.app.datatypes_registry.set_external_metadata_tool)
message = f"Detection was finished and changed the datatype to {datatype}."
else:
Expand Down
30 changes: 30 additions & 0 deletions lib/galaxy_test/selenium/test_dataset_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,33 @@ def test_history_dataset_update_annotation_and_info(self):

assert annotation_component.wait_for_value() == TEST_ANNOTATION
assert info_component.wait_for_value() == TEST_INFO

@selenium_test
@managed_history
def test_history_dataset_auto_detect_datatype(self):
expected_datatype = "txt"
provided_datatype = "tabular"
history_entry = self.perform_single_upload(self.get_filename("1.txt"), ext=provided_datatype)
hid = history_entry.hid
self.wait_for_history()
self.history_panel_wait_for_hid_ok(hid)
self.history_panel_item_edit(hid=hid)
edit_dataset_attributes = self.components.edit_dataset_attributes
datatypes_tab = edit_dataset_attributes.datatypes_tab
datatype_component = edit_dataset_attributes.datatype_dropdown
datatypes_tab.wait_for_and_click()
assert datatype_component.wait_for_text() == provided_datatype

# click auto detect datatype button
edit_dataset_attributes.auto_detect_datatype_button.wait_for_and_click()
edit_dataset_attributes.alert.wait_for_visible()

assert edit_dataset_attributes.alert.has_class("alert-success")

# reopen and check that datatype is updated
self.home()
self.history_panel_wait_for_hid_ok(hid)
self.history_panel_item_edit(hid=hid)
datatypes_tab.wait_for_and_click()

assert datatype_component.wait_for_text() == expected_datatype
Loading