Merge branch 'release_22.05' into dev

This commit is contained in:
Nicola Soranzo
2022-07-12 22:16:48 +01:00
8 changed files with 76 additions and 28 deletions
@@ -15,6 +15,9 @@
:per-page="perPage"
:current-page="currentPage"
:selectable="true"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:sort-compare="currentFirstSortCompare"
select-mode="single"
selected-variant="success"
@row-selected="switchToHistory"
@@ -58,6 +61,8 @@ export default {
filter: null,
currentPage: 1,
totalRows: 0,
sortBy: "update_time",
sortDesc: true,
};
},
computed: {
@@ -92,6 +97,17 @@ export default {
this.totalRows = filteredItems.length;
this.currentPage = 1;
},
/** Make the current history appear always first when sorting. */
currentFirstSortCompare(a, b, key, sortDesc) {
if (a.id == this.currentHistoryId) {
return sortDesc ? 1 : -1;
} else if (b.id == this.currentHistoryId) {
return sortDesc ? -1 : 1;
} else {
// Fallback to default sorting
return false;
}
},
},
};
</script>
@@ -52,6 +52,11 @@ export default {
modalShow: false,
};
},
watch: {
modalShow() {
this.setIframeEvents(this.modalShow);
},
},
mounted() {
this.show();
// handles subsequent external requests to re-open a re-used modal
@@ -70,6 +75,15 @@ export default {
}
this.hide();
},
/** Disable mouse events in iframe to prevent interference with uploader drop box */
setIframeEvents(disableEvents) {
const element = document.getElementById("galaxy_main");
if (element) {
element.style["pointer-events"] = disableEvents ? "none" : "auto";
} else {
console.warn("UploadModal::setIframeEvents - `galaxy_main` not found.");
}
},
},
};
</script>
@@ -136,7 +136,7 @@
<tool file="interactive/interactivetool_cellxgene.xml" />
<tool file="interactive/interactivetool_ethercalc.xml" />
<tool file="interactive/interactivetool_hicbrowser.xml" />
<tool file="interactive/interactivetool_jupyter_notebook_0.3.xml" />
<tool file="interactive/interactivetool_jupyter_notebook_1.0.0.xml" />
<tool file="interactive/interactivetool_jupyter_notebook.xml" />
<tool file="interactive/interactivetool_neo4j.xml" />
<tool file="interactive/interactivetool_phinch.xml" />
+5 -2
View File
@@ -1,7 +1,10 @@
import json
import logging
import typing
from datetime import datetime
from datetime import (
date,
datetime,
)
from boltons.iterutils import remap
from pydantic import (
@@ -108,7 +111,7 @@ class JobManager:
def build_and_apply_filters(query, objects, filter_func):
if objects is not None:
if isinstance(objects, str) or isinstance(objects, datetime):
if isinstance(objects, (str, date, datetime)):
query = query.filter(filter_func(objects))
elif isinstance(objects, list):
t = []
+6 -3
View File
@@ -2,7 +2,10 @@
import json
import re
from datetime import datetime
from datetime import (
date,
datetime,
)
from enum import Enum
from typing import (
Any,
@@ -1112,8 +1115,8 @@ class JobIndexQueryPayload(Model):
user_id: Optional[DecodedDatabaseIdField] = None
tool_ids: Optional[List[str]] = None
tool_ids_like: Optional[List[str]] = None
date_range_min: Optional[datetime] = None
date_range_max: Optional[datetime] = None
date_range_min: Optional[Union[datetime, date]] = None
date_range_max: Optional[Union[datetime, date]] = None
history_id: Optional[DecodedDatabaseIdField] = None
workflow_id: Optional[DecodedDatabaseIdField] = None
invocation_id: Optional[DecodedDatabaseIdField] = None
+9 -5
View File
@@ -5,12 +5,16 @@ API operations on a jobs.
"""
import logging
from datetime import datetime
from datetime import (
date,
datetime,
)
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from fastapi import Query
@@ -99,13 +103,13 @@ ToolIdLikeQueryParam: Optional[str] = Query(
description="Limit listing of jobs to those that match one of the included tool ID sql-like patterns. If none, all are returned",
)
DateRangeMinQueryParam: Optional[datetime] = Query(
DateRangeMinQueryParam: Optional[Union[datetime, date]] = Query(
default=None,
title="Date Range Minimum",
description="Limit listing of jobs to those that are updated after specified date (e.g. '2014-01-01')",
)
DateRangeMaxQueryParam: Optional[datetime] = Query(
DateRangeMaxQueryParam: Optional[Union[datetime, date]] = Query(
default=None,
title="Date Range Maximum",
description="Limit listing of jobs to those that are updated before specified date (e.g. '2014-01-01')",
@@ -187,8 +191,8 @@ class FastAPIJobs:
view: JobIndexViewEnum = ViewQueryParam,
tool_id: Optional[str] = ToolIdQueryParam,
tool_id_like: Optional[str] = ToolIdLikeQueryParam,
date_range_min: Optional[datetime] = DateRangeMinQueryParam,
date_range_max: Optional[datetime] = DateRangeMaxQueryParam,
date_range_min: Optional[Union[datetime, date]] = DateRangeMinQueryParam,
date_range_max: Optional[Union[datetime, date]] = DateRangeMaxQueryParam,
history_id: Optional[EncodedDatabaseIdField] = HistoryIdQueryParam,
workflow_id: Optional[EncodedDatabaseIdField] = WorkflowIdQueryParam,
invocation_id: Optional[EncodedDatabaseIdField] = InvocationIdQueryParam,
+11 -7
View File
@@ -84,21 +84,25 @@ class JobsApiTestCase(ApiTestCase, TestsTools):
def test_index_date_filter(self, history_id):
two_weeks_ago = (datetime.datetime.utcnow() - datetime.timedelta(14)).isoformat()
last_week = (datetime.datetime.utcnow() - datetime.timedelta(7)).isoformat()
next_week = (datetime.datetime.utcnow() + datetime.timedelta(7)).isoformat()
today = datetime.datetime.utcnow().isoformat()
tomorrow = (datetime.datetime.utcnow() + datetime.timedelta(1)).isoformat()
before = datetime.datetime.utcnow().isoformat()
today = before[:10]
tomorrow = (datetime.datetime.utcnow() + datetime.timedelta(1)).isoformat()[:10]
self.__history_with_new_dataset(history_id)
after = datetime.datetime.utcnow().isoformat()
# Test using dates
jobs = self.__jobs_index(data={"date_range_min": today, "date_range_max": tomorrow})
assert len(jobs) > 0
today_job_id = jobs[0]["id"]
today_job = jobs[0]
today_job_id = today_job["id"]
# Test using datetimes
jobs = self.__jobs_index(data={"date_range_min": before, "date_range_max": after})
assert today_job_id in map(itemgetter("id"), jobs), f"before: {before}, after: {after}, job: {today_job}"
jobs = self.__jobs_index(data={"date_range_min": two_weeks_ago, "date_range_max": last_week})
assert today_job_id not in map(itemgetter("id"), jobs)
jobs = self.__jobs_index(data={"date_range_min": last_week, "date_range_max": next_week})
assert today_job_id in map(itemgetter("id"), jobs)
@uses_test_history(require_new=True)
def test_index_history(self, history_id):
self.__history_with_new_dataset(history_id)
@@ -1,6 +1,6 @@
<tool id="interactive_tool_jupyter_notebook" tool_type="interactive" name="Interactive JupyTool and notebook" version="0.3" profile="22.01">
<tool id="interactive_tool_jupyter_notebook" tool_type="interactive" name="Interactive JupyTool and notebook" version="1.0.0" profile="22.01">
<requirements>
<container type="docker">quay.io/bgruening/docker-jupyter-notebook:ie2</container>
<container type="docker">quay.io/bgruening/docker-jupyter-notebook:2021-03-05</container>
</requirements>
<entry_points>
<entry_point name="JupyTool interactive tool" requires_domain="True">
@@ -75,7 +75,7 @@ except FileNotFoundError:
]]>
</configfile>
</configfiles>
<command detect_errors="aggressive"><![CDATA[
<command><![CDATA[
python staging_script.py &&
export GALAXY_WORKING_DIR=`pwd` &&
mkdir -p ./jupyter/outputs/collection &&
@@ -87,25 +87,29 @@ except FileNotFoundError:
export PATH=/home/jovyan/.local/bin:\$PATH &&
cp '${galaxy_input_startup_script}' /home/jovyan/.ipython/profile_default/startup/00-load.py &&
#set $output_notebook_name = 'ipython_galaxy_notebook.ipynb'
#if $mode.mode_select == 'scratch':
## copy default notebook
cp '$__tool_directory__/default_notebook.ipynb' ./ipython_galaxy_notebook.ipynb &&
jupyter trust ./ipython_galaxy_notebook.ipynb &&
cp '$__tool_directory__/default_notebook.ipynb' ${output_notebook_name} &&
jupyter trust ${output_notebook_name} &&
jupyter lab --allow-root --no-browser --NotebookApp.shutdown_button=True &&
cp ./ipython_galaxy_notebook.ipynb '$jupyter_notebook'
#else:
#import re
#set $cleaned_name = re.sub('[^\w\-\.]', '_', str($mode.ipynb.element_identifier))
cp '$mode.ipynb' ./${cleaned_name}.ipynb &&
jupyter trust ./${cleaned_name}.ipynb &&
#if not $cleaned_name.endswith(".ipynb"):
#set $cleaned_name = "%s.ipynb" % $cleaned_name
#end if
cp '$mode.ipynb' '${cleaned_name}' &&
jupyter trust '${cleaned_name}' &&
#if $mode.run_it:
jupyter nbconvert --to notebook --execute --output ./ipython_galaxy_notebook.ipynb --allow-errors ./*.ipynb &&
jupyter nbconvert --to notebook --execute --output '${output_notebook_name}' --allow-errors '${cleaned_name}' &&
#else:
#set $output_notebook_name = $cleaned_name
jupyter lab --allow-root --no-browser --NotebookApp.shutdown_button=True &&
#end if
cp ./ipython_galaxy_notebook.ipynb '$jupyter_notebook'
#end if
cp '${output_notebook_name}' '$jupyter_notebook'
]]>
</command>
<inputs>