Skip to content

Commit

Permalink
fix: send origin in query tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
lauramargar committed Aug 5, 2024
1 parent 7c0dbb2 commit d2bf8ad
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/x-components/src/components/base-event-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { defineComponent, PropType, ref } from 'vue';
import { use$x } from '../composables/use-$x';
import { XEvent, XEventsTypes } from '../wiring/events.types';
import { QueryFeature } from '../types/origin';
/**
* Component to be reused that renders a `<button>` with the logic of emitting events to the bus
Expand All @@ -26,6 +27,14 @@
events: {
type: Object as PropType<Partial<XEventsTypes>>,
required: true
},
/**
* The origin property for the request on each query preview.
*
* @public
*/
queryFeature: {
type: String as PropType<QueryFeature>
}
},
setup(props) {
Expand All @@ -38,7 +47,7 @@
*/
function emitEvents() {
Object.entries(props.events).forEach(([event, payload]) =>
$x.emit(event as XEvent, payload, { target: rootRef.value })
$x.emit(event as XEvent, payload, { target: rootRef.value, feature: props.queryFeature })
);
}
Expand Down
1 change: 1 addition & 0 deletions packages/x-components/src/views/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
<QueryPreviewButton
class="x-w-fit x-button-xl x-button-ghost"
:queryPreviewInfo="queryPreviewInfo"
:queryFeature="'customer'"
>
{{ `${queryPreviewInfo.query} (${totalResults})` }}
</QueryPreviewButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<BaseEventButton
v-on="$listeners"
:events="events"
:queryFeature="queryFeature"
class="x-query-preview-button x-button"
data-test="query-preview-button"
>
Expand All @@ -19,6 +20,7 @@
import { BaseEventButton } from '../../../components';
import { queriesPreviewXModule } from '../x-module';
import { useState } from '../../../composables/use-state';
import { QueryFeature } from '../../../types/origin';
/**
* Component containing an event button that emits
Expand All @@ -42,6 +44,14 @@
queryPreviewInfo: {
type: Object as PropType<QueryPreviewInfo>,
required: true
},
/**
* The origin property for the request on each query preview.
*
* @public
*/
queryFeature: {
type: String as PropType<QueryFeature>
}
},
setup(props) {
Expand Down

0 comments on commit d2bf8ad

Please sign in to comment.