From c6a73fc34d9a5a8df53089ae839a4e43932e1d5f Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Tue, 11 Apr 2023 12:44:21 -0400 Subject: [PATCH 1/7] Emit related filter to History Panel --- client/src/components/History/Content/ContentItem.vue | 2 +- client/src/components/History/Content/GenericItem.vue | 4 ++++ .../WorkflowInvocationState/WorkflowInvocationDetails.vue | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/src/components/History/Content/ContentItem.vue b/client/src/components/History/Content/ContentItem.vue index be5aaeb5b0d..824cd2c881c 100644 --- a/client/src/components/History/Content/ContentItem.vue +++ b/client/src/components/History/Content/ContentItem.vue @@ -92,7 +92,7 @@ v-if="expandDataset" :dataset="item" :writable="writable" - :show-highlight="isHistoryItem && filterable" + :show-highlight="isHistoryItem" :item-urls="itemUrls" @edit="onEdit" @toggleHighlights="toggleHighlights" /> diff --git a/client/src/components/History/Content/GenericItem.vue b/client/src/components/History/Content/GenericItem.vue index adda51b27de..60e2b8d34c6 100644 --- a/client/src/components/History/Content/GenericItem.vue +++ b/client/src/components/History/Content/GenericItem.vue @@ -12,6 +12,7 @@ @update:expand-dataset="expandDataset = $event" @view-collection="viewCollection = !viewCollection" @delete="onDelete(item)" + @toggleHighlights="onHighlight(item)" @undelete="onUndelete(item)" @unhide="onUnhide(item)" />
@@ -70,6 +71,9 @@ export default { onUnhide(item) { updateContentFields(item, { visible: true }); }, + onHighlight(item) { + this.$emit("toggleHighlights", item); + }, }, }; diff --git a/client/src/components/WorkflowInvocationState/WorkflowInvocationDetails.vue b/client/src/components/WorkflowInvocationState/WorkflowInvocationDetails.vue index c8977d2b5c0..aaa5dc42825 100644 --- a/client/src/components/WorkflowInvocationState/WorkflowInvocationDetails.vue +++ b/client/src/components/WorkflowInvocationState/WorkflowInvocationDetails.vue @@ -11,8 +11,14 @@ const props = defineProps({ }, }); +const emit = defineEmits(["toggleHighlights"]); + const { workflow } = useWorkflowInstance(props.invocation.workflow_id); +function onHighlight(item) { + emit("toggleHighlights", item); +} + function dataInputStepLabel(key, input) { const invocationStep = props.invocation.steps[key]; let label = invocationStep && invocationStep.workflow_step_label; @@ -50,7 +56,7 @@ function dataInputStepLabel(key, input) {
{{ key }}: - +
From 88589282007301ea1bf2aa28569a89f82946e99f Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Wed, 12 Apr 2023 01:52:44 -0400 Subject: [PATCH 2/7] Emit Related filter to HistoryPanel from historyStore --- client/src/components/Dataset/DatasetList.vue | 4 ++-- .../History/Content/GenericItem.vue | 6 +++++- .../History/CurrentHistory/HistoryPanel.vue | 11 ++++++++++- client/src/stores/historyStore.ts | 19 +++++++++++++++++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/client/src/components/Dataset/DatasetList.vue b/client/src/components/Dataset/DatasetList.vue index 50f4ddac974..31cb0dabf59 100644 --- a/client/src/components/Dataset/DatasetList.vue +++ b/client/src/components/Dataset/DatasetList.vue @@ -115,7 +115,7 @@ export default { this.load(); }, methods: { - ...mapActions(useHistoryStore, ["loadHistories", "setCurrentHistory"]), + ...mapActions(useHistoryStore, ["loadHistories", "setCurrentHistory", "applyFilterText"]), load(concat = false) { this.loading = true; getDatasets({ @@ -153,7 +153,7 @@ export default { async onShowDataset(item) { const historyId = item.history_id; try { - await this.setCurrentHistory(historyId); + await this.applyFilterText(historyId, `hid:${item.hid}`); } catch (error) { this.onError(error); } diff --git a/client/src/components/History/Content/GenericItem.vue b/client/src/components/History/Content/GenericItem.vue index 60e2b8d34c6..fc2f2b5cfe4 100644 --- a/client/src/components/History/Content/GenericItem.vue +++ b/client/src/components/History/Content/GenericItem.vue @@ -28,6 +28,7 @@ import { DatasetCollectionProvider, DatasetProvider } from "components/providers import { deleteContent, updateContentFields } from "components/History/model/queries"; import ContentItem from "./ContentItem"; import GenericElement from "./GenericElement"; +import { mapActions } from "pinia"; export default { components: { @@ -59,6 +60,7 @@ export default { }, }, methods: { + ...mapActions(useHistoryStore, ["applyFilterText"]), onDelete(item) { deleteContent(item); }, @@ -72,7 +74,9 @@ export default { updateContentFields(item, { visible: true }); }, onHighlight(item) { - this.$emit("toggleHighlights", item); + const { history_id } = item; + const filterText = `related:${item.hid}`; + this.applyFilterText(history_id, filterText); }, }, }; diff --git a/client/src/components/History/CurrentHistory/HistoryPanel.vue b/client/src/components/History/CurrentHistory/HistoryPanel.vue index 7b6c60dcdce..8cacef509cb 100644 --- a/client/src/components/History/CurrentHistory/HistoryPanel.vue +++ b/client/src/components/History/CurrentHistory/HistoryPanel.vue @@ -248,6 +248,10 @@ export default { const { getWatchingVisibility } = storeToRefs(useHistoryItemsStore()); return getWatchingVisibility.value; }, + /** @returns {String} */ + storeFilterText() { + return this.currentFilterText(); + } }, watch: { queryKey() { @@ -263,6 +267,11 @@ export default { filter(newVal) { this.filterText = newVal; }, + storeFilterText(newVal, oldVal) { + if (newVal !== oldVal) { + this.filterText = newVal; + } + }, offset() { this.loadHistoryItems(); }, @@ -274,7 +283,7 @@ export default { await this.loadHistoryItems(); }, methods: { - ...mapActions(useHistoryStore, ["loadHistoryById"]), + ...mapActions(useHistoryStore, ["loadHistoryById", "currentFilterText"]), ...mapActions(useHistoryItemsStore, ["fetchHistoryItems"]), getHighlight(item) { if (this.filterText.includes("related:" + item.hid)) { diff --git a/client/src/stores/historyStore.ts b/client/src/stores/historyStore.ts index ff0ffa8d821..fe10bc61b12 100644 --- a/client/src/stores/historyStore.ts +++ b/client/src/stores/historyStore.ts @@ -24,6 +24,7 @@ export const useHistoryStore = defineStore( const historiesLoading = ref(false); const pinnedHistories = ref<{ id: string }[]>([]); const storedCurrentHistoryId = ref(null); + const storedCurrentFilterText = ref(null); const storedHistories = ref<{ [key: string]: HistorySummary }>({}); const histories = computed(() => { @@ -49,6 +50,10 @@ export const useHistoryStore = defineStore( } }); + const currentFilterText = computed(() => { + return storedCurrentFilterText.value; + }); + const getHistoryById = computed(() => { return (historyId: string) => { return storedHistories.value[historyId] ?? null; @@ -75,6 +80,10 @@ export const useHistoryStore = defineStore( storedCurrentHistoryId.value = historyId; } + function setCurrentFilterText(filterText: string) { + storedCurrentFilterText.value = filterText; + } + function setHistory(history: HistorySummary) { Vue.set(storedHistories.value, history.id, history); } @@ -119,6 +128,13 @@ export const useHistoryStore = defineStore( setCurrentHistoryId(history.id); } + function applyFilterText(history_id: string, filterText: string) { + setCurrentFilterText(filterText); + if (currentHistoryId.value !== history_id) { + return setCurrentHistory(history_id); + } + } + async function copyHistory(history: HistorySummary, name: string, copyAll: boolean) { const newHistory = (await cloneHistory(history, name, copyAll)) as HistorySummary; return setCurrentHistory(newHistory.id); @@ -182,16 +198,19 @@ export const useHistoryStore = defineStore( histories, currentHistory, currentHistoryId, + currentFilterText, pinnedHistories, getHistoryById, getHistoryNameById, setCurrentHistory, setCurrentHistoryId, + setCurrentFilterText, setHistory, setHistories, pinHistory, unpinHistory, selectHistory, + applyFilterText, copyHistory, createNewHistory, deleteHistory, From 151c9acaca31bc2d3bdc46388164026537db3681 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Wed, 12 Apr 2023 02:00:09 -0400 Subject: [PATCH 3/7] remove emit redundant emit from WorkflowInvocationDetails --- .../WorkflowInvocationState/WorkflowInvocationDetails.vue | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/client/src/components/WorkflowInvocationState/WorkflowInvocationDetails.vue b/client/src/components/WorkflowInvocationState/WorkflowInvocationDetails.vue index aaa5dc42825..c8977d2b5c0 100644 --- a/client/src/components/WorkflowInvocationState/WorkflowInvocationDetails.vue +++ b/client/src/components/WorkflowInvocationState/WorkflowInvocationDetails.vue @@ -11,14 +11,8 @@ const props = defineProps({ }, }); -const emit = defineEmits(["toggleHighlights"]); - const { workflow } = useWorkflowInstance(props.invocation.workflow_id); -function onHighlight(item) { - emit("toggleHighlights", item); -} - function dataInputStepLabel(key, input) { const invocationStep = props.invocation.steps[key]; let label = invocationStep && invocationStep.workflow_step_label; @@ -56,7 +50,7 @@ function dataInputStepLabel(key, input) {
{{ key }}: - +
From 0ccfb95e6b279000afb60e639dd3e45e9576ea16 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Mon, 24 Apr 2023 14:50:07 -0400 Subject: [PATCH 4/7] apply related filter emit only to filterable panels --- .../src/components/History/CurrentHistory/HistoryPanel.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/components/History/CurrentHistory/HistoryPanel.vue b/client/src/components/History/CurrentHistory/HistoryPanel.vue index 8cacef509cb..664c4e63c14 100644 --- a/client/src/components/History/CurrentHistory/HistoryPanel.vue +++ b/client/src/components/History/CurrentHistory/HistoryPanel.vue @@ -250,7 +250,8 @@ export default { }, /** @returns {String} */ storeFilterText() { - return this.currentFilterText(); + const { currentFilterText } = storeToRefs(useHistoryStore()); + return currentFilterText.value; } }, watch: { @@ -268,7 +269,7 @@ export default { this.filterText = newVal; }, storeFilterText(newVal, oldVal) { - if (newVal !== oldVal) { + if (this.filterable && newVal !== oldVal) { this.filterText = newVal; } }, @@ -283,7 +284,7 @@ export default { await this.loadHistoryItems(); }, methods: { - ...mapActions(useHistoryStore, ["loadHistoryById", "currentFilterText"]), + ...mapActions(useHistoryStore, ["loadHistoryById"]), ...mapActions(useHistoryItemsStore, ["fetchHistoryItems"]), getHighlight(item) { if (this.filterText.includes("related:" + item.hid)) { From e095db56ca3af23343510a4f42be07faae7cc08c Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Mon, 24 Apr 2023 15:31:17 -0400 Subject: [PATCH 5/7] include useHistoryStore import --- client/src/components/History/Content/GenericItem.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/components/History/Content/GenericItem.vue b/client/src/components/History/Content/GenericItem.vue index fc2f2b5cfe4..d96463846c3 100644 --- a/client/src/components/History/Content/GenericItem.vue +++ b/client/src/components/History/Content/GenericItem.vue @@ -29,6 +29,7 @@ import { deleteContent, updateContentFields } from "components/History/model/que import ContentItem from "./ContentItem"; import GenericElement from "./GenericElement"; import { mapActions } from "pinia"; +import { useHistoryStore } from "@/stores/historyStore"; export default { components: { From 0656f1e2662437f696deaa4945a1b1d5a4fb9f04 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Mon, 24 Apr 2023 15:32:26 -0400 Subject: [PATCH 6/7] use applyFilterText instead of setCurrentHistory in DatasetList --- client/src/components/Dataset/DatasetList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Dataset/DatasetList.vue b/client/src/components/Dataset/DatasetList.vue index 31cb0dabf59..cb19af07aa2 100644 --- a/client/src/components/Dataset/DatasetList.vue +++ b/client/src/components/Dataset/DatasetList.vue @@ -115,7 +115,7 @@ export default { this.load(); }, methods: { - ...mapActions(useHistoryStore, ["loadHistories", "setCurrentHistory", "applyFilterText"]), + ...mapActions(useHistoryStore, ["loadHistories", "applyFilterText"]), load(concat = false) { this.loading = true; getDatasets({ From cebcc54019b85c6983f751b24e04c3ff68e5a51d Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Mon, 24 Apr 2023 16:30:58 -0400 Subject: [PATCH 7/7] track history panel filterText in historyStore --- client/src/components/Dataset/DatasetName.vue | 2 +- .../src/components/History/Content/ContentItem.vue | 3 ++- .../History/Content/Dataset/DatasetActions.vue | 2 +- .../src/components/History/Content/GenericItem.vue | 1 + .../History/CurrentHistory/HistoryPanel.vue | 13 +++++++++---- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/client/src/components/Dataset/DatasetName.vue b/client/src/components/Dataset/DatasetName.vue index 9751155ea3d..70916f1046e 100644 --- a/client/src/components/Dataset/DatasetName.vue +++ b/client/src/components/Dataset/DatasetName.vue @@ -22,7 +22,7 @@