diff --git a/client/src/components/History/CurrentHistory/HistoryFilters/HistoryFilters.vue b/client/src/components/History/CurrentHistory/HistoryFilters/HistoryFilters.vue index b1e0dd79cf55..3cfd27b55539 100644 --- a/client/src/components/History/CurrentHistory/HistoryFilters/HistoryFilters.vue +++ b/client/src/components/History/CurrentHistory/HistoryFilters/HistoryFilters.vue @@ -51,7 +51,13 @@ Filter by state: - + @@ -63,22 +69,47 @@ Filter by database: Filter by related to item index: - + Filter by item index: - - + + Filter by creation time: - + - + @@ -115,6 +146,7 @@ export default { props: { filterText: { type: String, default: null }, showAdvanced: { type: Boolean, default: false }, + searchError: { type: Object, default: null }, }, data() { return { @@ -147,8 +179,17 @@ export default { this.create_time_gt = this.filterSettings["create_time>"]; this.create_time_lt = this.filterSettings["create_time<"]; }, + showAdvanced(newVal) { + this.showHelp = !newVal ? false : this.showHelp; + }, }, methods: { + hasError(field) { + if (this.searchError && this.searchError.filter == field) { + return this.searchError.typeError || this.searchError.msg; + } + return ""; + }, onOption(name, value) { this.filterSettings[name] = value; }, diff --git a/client/src/components/History/CurrentHistory/HistoryPanel.vue b/client/src/components/History/CurrentHistory/HistoryPanel.vue index 8567fce05239..8415d843868f 100644 --- a/client/src/components/History/CurrentHistory/HistoryPanel.vue +++ b/client/src/components/History/CurrentHistory/HistoryPanel.vue @@ -31,7 +31,8 @@ v-if="showControls" class="content-operations-filters mx-3" :filter-text.sync="filterText" - :show-advanced.sync="showAdvanced" /> + :show-advanced.sync="showAdvanced" + :search-error="formattedSearchError" />
+ + Error in filter: + + {{ formattedSearchError.filter }}'{{ formattedSearchError.value }}' + + No data found for selected filter. @@ -153,6 +160,7 @@ import HistoryDetails from "./HistoryDetails"; import HistoryDropZone from "./HistoryDropZone"; import HistoryEmpty from "./HistoryEmpty"; import HistoryFilters from "./HistoryFilters/HistoryFilters"; +import { getOperatorForAlias } from "utils/filtering"; import HistoryMessages from "./HistoryMessages"; import HistorySelectionOperations from "./HistoryOperations/SelectionOperations"; import HistorySelectionStatus from "./HistoryOperations/SelectionStatus"; @@ -190,12 +198,12 @@ export default { }, data() { return { - error: null, filterText: "", highlightsKey: null, invisible: {}, loading: false, offset: 0, + searchError: null, showAdvanced: false, showDropZone: false, operationRunning: null, @@ -248,6 +256,23 @@ export default { const { getWatchingVisibility } = storeToRefs(useHistoryItemsStore()); return getWatchingVisibility.value; }, + /** @returns {Object} */ + formattedSearchError() { + if (this.searchError) { + const { column, col, operation, op, value, val, err_msg, ValueError } = this.searchError; + const alias = operation || op; + const operator = alias ? getOperatorForAlias(alias) : ":"; + const formatted = { + filter: `${column || col}${operator}`, + value: value || val, + msg: err_msg, + typeError: ValueError, + }; + return formatted; + } else { + return null; + } + }, /** @returns {String} */ storeFilterText() { const { currentFilterText } = storeToRefs(useHistoryStore()); @@ -316,11 +341,15 @@ export default { this.loading = true; try { await this.fetchHistoryItems(this.historyId, this.filterText, this.offset); - this.error = null; + this.searchError = null; this.loading = false; } catch (error) { - console.debug("HistoryPanel - Load error.", error); - this.error = error; + if (error.response && error.response.data && error.response.data.err_msg) { + console.debug("HistoryPanel - Load items error:", error.response.data.err_msg); + this.searchError = error.response.data; + } else { + console.debug("HistoryPanel - Load items error.", error); + } this.loading = false; } }, diff --git a/client/src/stores/history/historyItemsStore.js b/client/src/stores/history/historyItemsStore.js index f93d640acd70..a8df77781101 100644 --- a/client/src/stores/history/historyItemsStore.js +++ b/client/src/stores/history/historyItemsStore.js @@ -67,7 +67,7 @@ export const useHistoryItemsStore = defineStore("historyItemsStore", { const params = `v=dev&order=hid&offset=${offset}&limit=${limit}`; const url = `/api/histories/${historyId}/contents?${params}&${queryString}`; const headers = { accept: "application/vnd.galaxy.history.contents.stats+json" }; - await queue.enqueue(urlData, { url, headers }, historyId).then((data) => { + return await queue.enqueue(urlData, { url, headers, errorSimplify: false }, historyId).then((data) => { const stats = data.stats; this.totalMatchesCount = stats.total_matches; const payload = data.contents; diff --git a/client/src/style/scss/ui.scss b/client/src/style/scss/ui.scss index d8d3c5caabb5..fe370727b928 100644 --- a/client/src/style/scss/ui.scss +++ b/client/src/style/scss/ui.scss @@ -213,6 +213,10 @@ $ui-margin-horizontal-large: $margin-v * 2; } } +.ui-input-error { + border-color: $brand-danger; +} + .ui-textarea { @extend .ui-input; height: 100px !important; diff --git a/client/src/utils/url.js b/client/src/utils/url.js index df8c36629713..6fda0c5960bc 100644 --- a/client/src/utils/url.js +++ b/client/src/utils/url.js @@ -2,14 +2,18 @@ import axios from "axios"; import { withPrefix } from "utils/redirect"; import { rethrowSimple } from "utils/simple-error"; -export async function urlData({ url, headers, params }) { +export async function urlData({ url, headers, params, errorSimplify = true }) { try { headers = headers || {}; params = params || {}; const { data } = await axios.get(withPrefix(url), { headers, params }); return data; } catch (e) { - rethrowSimple(e); + if (errorSimplify) { + rethrowSimple(e); + } else { + throw e; + } } }