diff --git a/packages/client/hmi-client/src/components/navbar/tera-searchbar.vue b/packages/client/hmi-client/src/components/navbar/tera-searchbar.vue index ea86638672..70278c9041 100644 --- a/packages/client/hmi-client/src/components/navbar/tera-searchbar.vue +++ b/packages/client/hmi-client/src/components/navbar/tera-searchbar.vue @@ -132,6 +132,7 @@ import { useSearchByExampleOptions, extractResourceName } from '@/page/data-explorer/search-by-example'; +import { getResourceID } from '@/utils/data-util'; const props = defineProps<{ showSuggestions: boolean; @@ -157,8 +158,7 @@ const selectedSearchByExampleOptions = ref({ backwardCitation: false, relatedContent: false }); -const { searchByExampleOptions, searchByExampleItem, searchByExampleAssetCardProp } = - useSearchByExampleOptions(); +const { searchByExampleOptions, searchByExampleItem } = useSearchByExampleOptions(); function clearQuery() { query.value = ''; @@ -167,20 +167,21 @@ function clearQuery() { const initiateSearch = () => { emit('query-changed', query.value); - router.push({ name: RouteName.DataExplorerRoute, query: { q: query.value, byExample: 'false' } }); + router.push({ name: RouteName.DataExplorerRoute, query: { q: query.value } }); EventService.create(EventType.Search, resources.activeProject?.id, query.value); }; function initiateSearchByExample() { + searchByExampleItem.value = searchByExampleSelectedAsset.value; searchByExampleOptions.value = { ...selectedSearchByExampleOptions.value }; searchByExampleToggle.value = false; - // used in order to update the "showing x of y results with ... to " - // section after a search by example is initiated - searchByExampleAssetCardProp.value = { ...searchByExampleItem.value }; // used to update the search bar text with the name of the search by example asset query.value = extractResourceName(searchByExampleItem.value); - router.push({ name: RouteName.DataExplorerRoute, query: { q: query.value, byExample: 'true' } }); + router.push({ + name: RouteName.DataExplorerRoute, + query: { resourceId: getResourceID(searchByExampleItem.value!) } + }); } function addToQuery(term: string) { @@ -230,7 +231,6 @@ function onDrop() { searchByExampleToggle.value = true; // Maintains open search by example popup once an asset is successfully dropped searchByExampleSelectedAsset.value = getDragData('asset'); searchByExampleSelectedResourceType.value = getDragData('resourceType'); - searchByExampleItem.value = searchByExampleSelectedAsset.value; isDraggedOver.value = false; } diff --git a/packages/client/hmi-client/src/page/data-explorer/DataExplorer.vue b/packages/client/hmi-client/src/page/data-explorer/DataExplorer.vue index 24103b5de3..8301563e6d 100644 --- a/packages/client/hmi-client/src/page/data-explorer/DataExplorer.vue +++ b/packages/client/hmi-client/src/page/data-explorer/DataExplorer.vue @@ -111,7 +111,7 @@