Skip to content

Commit

Permalink
Merge branch 'release_22.05' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Jun 22, 2022
2 parents 7d57532 + 29100ed commit 0273323
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<JobDetailsProvider
v-if="!isDatasetLoading && dataset.creating_job !== null"
v-slot="{ result: job, loading: isJobLoading }"
:jobid="dataset.creating_job"
:jobId="dataset.creating_job"
auto-refresh>
<div v-if="!isJobLoading">
<dataset-information class="detail" :hda_id="datasetId" />
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/DatasetInformation/DatasetError.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<JobDetailsProvider
v-if="!datasetLoading"
v-slot="{ result: jobDetails, loading }"
:jobid="dataset.creating_job"
:jobId="dataset.creating_job"
@error="onError">
<div v-if="!loading">
<div class="page-container edit-attr">
Expand All @@ -24,7 +24,7 @@
:tool-stderr="jobDetails.tool_stderr"
:job-stderr="jobDetails.job_stderr"
:job-messages="jobDetails.job_messages" />
<JobProblemProvider v-slot="{ result: jobProblems }" :jobid="dataset.creating_job" @error="onError">
<JobProblemProvider v-slot="{ result: jobProblems }" :jobId="dataset.creating_job" @error="onError">
<div v-if="jobProblems && (jobProblems.has_duplicate_inputs || jobProblems.has_empty_inputs)">
<h3 class="common_problems mt-3">Detected Common Potential Problems</h3>
<p v-if="jobProblems.has_empty_inputs" id="dataset-error-has-empty-inputs">
Expand Down
13 changes: 7 additions & 6 deletions client/src/components/History/Content/ContentItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
<span class="id hid">{{ id }}</span>
<span>:</span>
<span class="content-title name">{{ name }}</span>
<CollectionDescription
v-if="!isDataset"
:job-state-summary="jobState"
:collection-type="item.collection_type"
:element-count="item.element_count"
:elements-datatypes="item.elements_datatypes" />
</span>
<ContentOptions
:is-dataset="isDataset"
Expand All @@ -67,6 +61,13 @@
@unhide="$emit('unhide')" />
</div>
</div>
<CollectionDescription
v-if="!isDataset"
class="px-2 pb-2"
:job-state-summary="jobState"
:collection-type="item.collection_type"
:element-count="item.element_count"
:elements-datatypes="item.elements_datatypes" />
<StatelessTags
v-if="!tagsDisabled || hasTags"
class="alltags p-1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Listing :items="payload" :loading="loading" @scroll="onScroll">
<template v-slot:item="{ item }">
<ContentItem
:id="item.element_index"
:id="item.element_index + 1"
:item="item.object"
:name="item.element_identifier"
:expand-dataset="isExpanded(item)"
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/JobInformation/JobInformation.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<job-details-provider auto-refresh :jobid="job_id" @update:result="updateJob" />
<job-details-provider auto-refresh :jobId="job_id" @update:result="updateJob" />
<h3>Job Information</h3>
<table id="job-information" class="tabletip info_data_table">
<tbody>
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/providers/JobProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { rethrowSimple } from "utils/simple-error";
import { stateIsTerminal } from "./utils";
import { cleanPaginationParameters } from "./utils";

async function jobDetails({ jobid }) {
const url = `${getAppRoot()}api/jobs/${jobid}?full=True`;
async function jobDetails({ jobId }) {
const url = `${getAppRoot()}api/jobs/${jobId}?full=True`;
try {
const { data } = await axios.get(url);
return data;
Expand All @@ -15,8 +15,8 @@ async function jobDetails({ jobid }) {
}
}

async function jobProblems({ jobid }) {
const url = `${getAppRoot()}api/jobs/${jobid}/common_problems`;
async function jobProblems({ jobId }) {
const url = `${getAppRoot()}api/jobs/${jobId}/common_problems`;
try {
const { data } = await axios.get(url);
return data;
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/providers/SingleQueryProvider.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import hash from "object-hash";
import { LastQueue } from "utils/promise-queue";
import { HasAttributesMixin } from "./utils";

/**
* Builds a provider that gets its result from a single promise-based query function and
Expand All @@ -14,6 +15,7 @@ import { LastQueue } from "utils/promise-queue";
export const SingleQueryProvider = (lookup, stopRefresh = (result) => false) => {
const promiseCache = new Map();
return {
mixins: [HasAttributesMixin],
props: {
useCache: {
type: Boolean,
Expand Down Expand Up @@ -74,7 +76,7 @@ export const SingleQueryProvider = (lookup, stopRefresh = (result) => false) =>
promiseCache.set(this.cacheKey, lookupPromise);
}
} else {
lookupPromise = this.queue.enqueue(lookup, this.$attrs);
lookupPromise = this.queue.enqueue(lookup, this.attributes);
}
lookupPromise.then(
(result) => {
Expand Down
13 changes: 2 additions & 11 deletions client/src/components/providers/storeProviders.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import axios from "axios";
import { prependPath } from "utils/redirect";
import { mapActions, mapGetters } from "vuex";
import { mapCacheActions } from "vuex-cache";
import { HasAttributesMixin } from "./utils";

export const SimpleProviderMixin = {
props: {
Expand Down Expand Up @@ -135,6 +136,7 @@ export const JobProvider = {
*/
export const StoreProvider = (storeAction, storeGetter, storeCountGetter = undefined) => {
return {
mixins: [HasAttributesMixin],
watch: {
$attrs(newVal, oldVal) {
if (JSON.stringify(newVal) != JSON.stringify(oldVal)) {
Expand All @@ -153,9 +155,6 @@ export const StoreProvider = (storeAction, storeGetter, storeCountGetter = undef
},
computed: {
...mapGetters([storeGetter, storeCountGetter]),
attributes() {
return this.toCamelCase(this.$attrs);
},
result() {
return this[storeGetter](this.attributes);
},
Expand Down Expand Up @@ -184,14 +183,6 @@ export const StoreProvider = (storeAction, storeGetter, storeCountGetter = undef
this.loading = false;
}
},
toCamelCase(attributes) {
const result = {};
for (const key in attributes) {
const newKey = key.replace(/-./g, (x) => x[1].toUpperCase());
result[newKey] = attributes[key];
}
return result;
},
},
};
};
Expand Down
18 changes: 18 additions & 0 deletions client/src/components/providers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ export function stateIsTerminal(result) {
return !JOB_STATES_MODEL.NON_TERMINAL_STATES.includes(result.state);
}

export const HasAttributesMixin = {
computed: {
attributes() {
return this.toCamelCase(this.$attrs);
},
},
methods: {
toCamelCase(attributes) {
const result = {};
for (const key in attributes) {
const newKey = key.replace(/-./g, (x) => x[1].toUpperCase());
result[newKey] = attributes[key];
}
return result;
},
},
};

// Adapt bootstrap parameters to Galaxy API. Galaxy consumes snake case parameters
// and generally uses limit instead of perPage/per_page as a name for this concept.
export function cleanPaginationParameters(requestParams) {
Expand Down
14 changes: 9 additions & 5 deletions lib/galaxy/managers/taggable.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import logging
from typing import Type

from sqlalchemy import sql
from sqlalchemy import (
func,
sql,
)

from galaxy import model
from galaxy.model.tags import GalaxyTagHandler
Expand Down Expand Up @@ -118,15 +121,16 @@ def _create_tag_filter(model_class=None):
target_model = getattr(model, f"{class_name}TagAssociation")
id_column = f"{target_model.table.name.rsplit('_tag_association')[0]}_id"
column = target_model.table.c.user_tname + ":" + target_model.table.c.user_value
lower_val = val.lower() # Ignore case
if op == "eq":
if ":" not in val:
if ":" not in lower_val:
# We require an exact match and the tag to look for has no user_value,
# so we can't just concatenate user_tname, ':' and user_vale
cond = target_model.table.c.user_tname == val
cond = func.lower(target_model.table.c.user_tname) == lower_val
else:
cond = column == val
cond = func.lower(column) == lower_val
else:
cond = column.contains(val, autoescape=True)
cond = func.lower(column).contains(lower_val, autoescape=True)
return sql.expression.and_(model_class.table.c.id == getattr(target_model.table.c, id_column), cond)

return _create_tag_filter
Expand Down
37 changes: 37 additions & 0 deletions lib/galaxy_test/api/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,43 @@ def test_search_by_tag(self):
index_response = self._get("datasets", payload).json()
assert len(index_response) == 0

def test_search_by_tag_case_insensitive(self):
history_id = self.dataset_populator.new_history()
hda_id = self.dataset_populator.new_dataset(history_id)["id"]
update_payload = {
"tags": ["name:new_TAG", "cool:another_TAG"],
}
updated_hda = self._put(f"histories/{history_id}/contents/{hda_id}", update_payload, json=True).json()
assert "name:new_TAG" in updated_hda["tags"]
assert "cool:another_TAG" in updated_hda["tags"]
payload = {
"limit": 10,
"offset": 0,
"q": ["history_content_type", "tag"],
"qv": ["dataset", "name:new_tag"],
"history_id": history_id,
}
index_response = self._get("datasets", payload).json()
assert len(index_response) == 1
payload = {
"limit": 10,
"offset": 0,
"q": ["history_content_type", "tag-contains"],
"qv": ["dataset", "new_tag"],
"history_id": history_id,
}
index_response = self._get("datasets", payload).json()
assert len(index_response) == 1
payload = {
"limit": 10,
"offset": 0,
"q": ["history_content_type", "tag-contains"],
"qv": ["dataset", "notag"],
"history_id": history_id,
}
index_response = self._get("datasets", payload).json()
assert len(index_response) == 0

def test_search_by_tool_id(self):
self.dataset_populator.new_dataset(self.history_id)
payload = {
Expand Down

0 comments on commit 0273323

Please sign in to comment.