diff --git a/client/src/components/History/HistoryView.vue b/client/src/components/History/HistoryView.vue
index 3a39909559bb..10e1697c16ed 100644
--- a/client/src/components/History/HistoryView.vue
+++ b/client/src/components/History/HistoryView.vue
@@ -22,7 +22,7 @@
- History imported and is now your active history. View here.
+ History imported and is now your active history. View here.
import { mapActions, mapState } from "pinia";
+import { isAnonymousUser } from "@/api";
import { useHistoryStore } from "@/stores/historyStore";
import { useUserStore } from "@/stores/userStore";
@@ -89,6 +90,9 @@ export default {
canImportHistory() {
return !this.userOwnsHistory && !this.history.purged;
},
+ importedHistoryLink() {
+ return isAnonymousUser(this.currentUser) ? "/" : "/histories/list";
+ },
},
created() {
this.loadHistoryById(this.id);
diff --git a/client/src/components/History/Modals/CopyModal.vue b/client/src/components/History/Modals/CopyModal.vue
index 44c0bb9ffd51..7f0f6423b0f4 100644
--- a/client/src/components/History/Modals/CopyModal.vue
+++ b/client/src/components/History/Modals/CopyModal.vue
@@ -78,7 +78,7 @@ async function copy(close: () => void) {
As an anonymous user, unless you log in or register, you will lose your current history after copying
- this history. You can log in here or register here.
+ this history. You can log in or register here.
diff --git a/lib/galaxy/visualization/data_providers/genome.py b/lib/galaxy/visualization/data_providers/genome.py
index fb40b052f7fd..9735167c3843 100644
--- a/lib/galaxy/visualization/data_providers/genome.py
+++ b/lib/galaxy/visualization/data_providers/genome.py
@@ -39,6 +39,7 @@
GFFReaderWrapper,
parse_gff_attributes,
)
+from galaxy.exceptions import MessageException
from galaxy.model import DatasetInstance
from galaxy.visualization.data_providers.basic import BaseDataProvider
from galaxy.visualization.data_providers.cigar import get_ref_based_read_seq_and_cigar
@@ -106,43 +107,53 @@ def __init__(self, converted_dataset):
self.converted_dataset = converted_dataset
def get_data(self, query):
+ if self.converted_dataset is None or not self.converted_dataset.is_ok:
+ raise MessageException("The dataset is not available or is in an error state.")
# Init.
- textloc_file = open(self.converted_dataset.get_file_name())
- line_len = int(textloc_file.readline())
- file_len = os.path.getsize(self.converted_dataset.get_file_name())
- query = query.lower()
-
- # Find query in file using binary search.
- low = 0
- high = int(file_len / line_len)
- while low < high:
- mid: int = (low + high) // 2
- position = mid * line_len
- textloc_file.seek(position)
-
- # Compare line with query and update low, high.
+ result = []
+ with open(self.converted_dataset.get_file_name()) as textloc_file:
line = textloc_file.readline()
- if line < query:
- low = mid + 1
- else:
- high = mid
+ if not line:
+ raise MessageException("The dataset is empty.")
+ try:
+ line_len = int(line)
+ except ValueError:
+ raise MessageException(f"Expected an integer at first line, but found: '{line}'")
+ if line_len < 1:
+ raise MessageException(f"The first line must be a positive integer, but found: {line_len}")
+
+ file_len = os.path.getsize(self.converted_dataset.get_file_name())
+ query = query.lower()
+
+ # Find query in file using binary search.
+ low = 0
+ high = int(file_len / line_len)
+ while low < high:
+ mid: int = (low + high) // 2
+ position = mid * line_len
+ textloc_file.seek(position)
+
+ # Compare line with query and update low, high.
+ line = textloc_file.readline()
+ if line < query:
+ low = mid + 1
+ else:
+ high = mid
- # Need to move back one line because last line read may be included in
- # results.
- position = low * line_len
- textloc_file.seek(position)
+ # Need to move back one line because last line read may be included in
+ # results.
+ position = low * line_len
+ textloc_file.seek(position)
- # At right point in file, generate hits.
- result = []
- while True:
- line = textloc_file.readline()
- if not line.startswith(query):
- break
- if line[-1:] == "\n":
- line = line[:-1]
- result.append(line.split()[1:])
+ # At right point in file, generate hits.
+ while True:
+ line = textloc_file.readline()
+ if not line.startswith(query):
+ break
+ if line[-1:] == "\n":
+ line = line[:-1]
+ result.append(line.split()[1:])
- textloc_file.close()
return result
diff --git a/lib/galaxy_test/driver/driver_util.py b/lib/galaxy_test/driver/driver_util.py
index a95e19e376a5..77ab88ca0682 100644
--- a/lib/galaxy_test/driver/driver_util.py
+++ b/lib/galaxy_test/driver/driver_util.py
@@ -50,8 +50,6 @@
DEFAULT_WEB_HOST,
target_url_parts,
)
-from tool_shed.webapp.app import UniverseApplication as ToolshedUniverseApplication
-from tool_shed.webapp.fast_app import initialize_fast_app as init_tool_shed_fast_app
from .test_logging import logging_config_file
galaxy_root = galaxy_directory()
@@ -71,9 +69,8 @@
log = logging.getLogger("test_driver")
-# Global variables to pass database contexts around - only needed for older
+# Global variable to pass database contexts around - only needed for older
# Tool Shed twill tests that didn't utilize the API for such interactions.
-tool_shed_context = None
install_context = None
@@ -583,26 +580,6 @@ def build_galaxy_app(simple_kwargs) -> GalaxyUniverseApplication:
return app
-def build_shed_app(simple_kwargs):
- """Build a Galaxy app object from a simple keyword arguments.
-
- Construct paste style complex dictionary. Also setup "global" reference
- to sqlalchemy database context for tool shed database.
- """
- log.info("Tool shed database connection: %s", simple_kwargs["database_connection"])
- # TODO: Simplify global_conf to match Galaxy above...
- simple_kwargs["__file__"] = "tool_shed_wsgi.yml.sample"
- simple_kwargs["global_conf"] = get_webapp_global_conf()
-
- app = ToolshedUniverseApplication(**simple_kwargs)
- log.info("Embedded Toolshed application started")
-
- global tool_shed_context
- tool_shed_context = app.model.context
-
- return app
-
-
def explicitly_configured_host_and_port(prefix, config_object):
host_env_key = f"{prefix}_TEST_HOST"
port_env_key = f"{prefix}_TEST_PORT"
@@ -758,7 +735,14 @@ def launch_gravity(port, gxit_port=None, galaxy_config=None):
)
-def launch_server(app_factory, webapp_factory, prefix=DEFAULT_CONFIG_PREFIX, galaxy_config=None, config_object=None):
+def launch_server(
+ app_factory,
+ webapp_factory,
+ prefix=DEFAULT_CONFIG_PREFIX,
+ galaxy_config=None,
+ config_object=None,
+ init_fast_app=init_galaxy_fast_app,
+):
name = prefix.lower()
host, port = explicitly_configured_host_and_port(prefix, config_object)
port = attempt_ports(port)
@@ -792,12 +776,7 @@ def launch_server(app_factory, webapp_factory, prefix=DEFAULT_CONFIG_PREFIX, gal
static_enabled=True,
register_shutdown_at_exit=False,
)
- if name == "galaxy":
- asgi_app = init_galaxy_fast_app(wsgi_webapp, app)
- elif name == "tool_shed":
- asgi_app = init_tool_shed_fast_app(wsgi_webapp, app)
- else:
- raise NotImplementedError(f"Launching {name} not implemented")
+ asgi_app = init_fast_app(wsgi_webapp, app)
server, port, thread = uvicorn_serve(asgi_app, host=host, port=port)
set_and_wait_for_http_target(prefix, host, port, url_prefix=url_prefix)
diff --git a/lib/tool_shed/test/base/driver.py b/lib/tool_shed/test/base/driver.py
index b342a749f591..a4fa67efdfb5 100644
--- a/lib/tool_shed/test/base/driver.py
+++ b/lib/tool_shed/test/base/driver.py
@@ -11,6 +11,8 @@
from galaxy_test.driver import driver_util
from tool_shed.test.base.api_util import get_admin_api_key
from tool_shed.webapp import buildapp as toolshedbuildapp
+from tool_shed.webapp.app import UniverseApplication as ToolshedUniverseApplication
+from tool_shed.webapp.fast_app import initialize_fast_app as init_tool_shed_fast_app
log = driver_util.build_logger()
@@ -36,6 +38,29 @@
"""
+# Global variable to pass database contexts around - only needed for older
+# Tool Shed twill tests that didn't utilize the API for such interactions.
+tool_shed_context = None
+
+
+def build_shed_app(simple_kwargs):
+ """Build a Galaxy app object from a simple keyword arguments.
+
+ Construct paste style complex dictionary. Also setup "global" reference
+ to sqlalchemy database context for tool shed database.
+ """
+ log.info("Tool shed database connection: %s", simple_kwargs["database_connection"])
+ # TODO: Simplify global_conf to match Galaxy above...
+ simple_kwargs["__file__"] = "tool_shed_wsgi.yml.sample"
+ simple_kwargs["global_conf"] = driver_util.get_webapp_global_conf()
+
+ app = ToolshedUniverseApplication(**simple_kwargs)
+ log.info("Embedded Toolshed application started")
+
+ global tool_shed_context
+ tool_shed_context = app.model.context
+
+ return app
class ToolShedTestDriver(driver_util.TestDriver):
@@ -117,10 +142,11 @@ def _setup_local(self):
# ---- Run tool shed webserver ------------------------------------------------------
# TODO: Needed for hg middleware ('lib/galaxy/webapps/tool_shed/framework/middleware/hg.py')
tool_shed_server_wrapper = driver_util.launch_server(
- app_factory=lambda: driver_util.build_shed_app(kwargs),
+ app_factory=lambda: build_shed_app(kwargs),
webapp_factory=toolshedbuildapp.app_factory,
galaxy_config=kwargs,
prefix="TOOL_SHED",
+ init_fast_app=init_tool_shed_fast_app,
)
self.server_wrappers.append(tool_shed_server_wrapper)
tool_shed_test_host = tool_shed_server_wrapper.host
diff --git a/lib/tool_shed/test/base/test_db_util.py b/lib/tool_shed/test/base/test_db_util.py
index 03b1bbcc7550..f957cfe0ea2c 100644
--- a/lib/tool_shed/test/base/test_db_util.py
+++ b/lib/tool_shed/test/base/test_db_util.py
@@ -18,7 +18,7 @@
def sa_session():
- from galaxy_test.driver.driver_util import tool_shed_context as sa_session
+ from .driver import tool_shed_context as sa_session
return sa_session