diff --git a/js/src/components/lineage/PreviewChangeView.tsx b/js/src/components/lineage/PreviewChangeView.tsx
index 3f63cef6..4f790c12 100644
--- a/js/src/components/lineage/PreviewChangeView.tsx
+++ b/js/src/components/lineage/PreviewChangeView.tsx
@@ -96,7 +96,6 @@ function PreviewChangeTopBar({
onRunResultOpen();
runQuery();
setTimeout(() => feedbackToast(), 3000);
- trackPreviewChange({ action: "run", node: current?.name });
}}
colorScheme="blue"
isLoading={isPending}
@@ -168,17 +167,39 @@ export function PreviewChangeView({
};
const { mutate: runQuery, isPending } = useMutation({
mutationFn: queryFn,
+ onSuccess(data, variables) {
+ if (data.error) {
+ trackPreviewChange({
+ action: "run",
+ node: current?.name,
+ status: "failure",
+ });
+ } else {
+ trackPreviewChange({
+ action: "run",
+ node: current?.name,
+ status: "success",
+ });
+ }
+ },
});
const { feedbackToast, closeToast } = useFeedbackCollectionToast({
feedbackId: localStorageKeys.previewChangeFeedbackID,
description: "Enjoy preview change?",
+
onFeedbackSubmit: (feedback: string) => {
switch (feedback) {
case "like":
- trackPreviewChangeFeedback({ feedback: "like" });
+ trackPreviewChangeFeedback({ feedback: "like", node: current?.name });
break;
case "dislike":
- trackPreviewChangeFeedback({ feedback: "dislike" });
+ trackPreviewChangeFeedback({
+ feedback: "dislike",
+ node: current?.name,
+ });
+ break;
+ case "link":
+ trackPreviewChangeFeedback({ feedback: "form", node: current?.name });
break;
default:
console.log("Not support feedback type");
@@ -198,7 +219,7 @@ export function PreviewChangeView({
onRunResultClose();
clearRunResult();
closeToast();
- trackPreviewChange({ action: "close" });
+ trackPreviewChange({ action: "close", node: current?.name });
}}
>
{/* */}
diff --git a/js/src/lib/api/track.ts b/js/src/lib/api/track.ts
index d6c5bae0..b8d07fe7 100644
--- a/js/src/lib/api/track.ts
+++ b/js/src/lib/api/track.ts
@@ -43,6 +43,7 @@ export function trackHistoryAction(props: HistoryActionProps) {
interface PreviewChangeProps {
action: "explore" | "run" | "close";
node?: string;
+ status?: "success" | "failure";
}
export function trackPreviewChange(props: PreviewChangeProps) {
@@ -50,7 +51,8 @@ export function trackPreviewChange(props: PreviewChangeProps) {
}
interface PreviewChangeFeedbackProps {
- feedback: "like" | "dislike";
+ feedback: "like" | "dislike" | "form";
+ node?: string;
}
export function trackPreviewChangeFeedback(props: PreviewChangeFeedbackProps) {
diff --git a/js/src/lib/hooks/useFeedbackCollectionToast.tsx b/js/src/lib/hooks/useFeedbackCollectionToast.tsx
index 2d0578e3..4ab3ea02 100644
--- a/js/src/lib/hooks/useFeedbackCollectionToast.tsx
+++ b/js/src/lib/hooks/useFeedbackCollectionToast.tsx
@@ -14,12 +14,14 @@ function ReactionFeedback({
description,
onLike,
onDislike,
+ onClickLink,
externalLink,
externalLinkText,
}: {
description: string;
onLike: () => void;
onDislike: () => void;
+ onClickLink: () => void;
externalLink?: string;
externalLinkText?: string;
}) {
@@ -48,7 +50,12 @@ function ReactionFeedback({
onClick={onDislike}
/>
{externalLink && externalLinkText && (
-
+
{externalLinkText}
)}
@@ -113,6 +120,9 @@ export function useFeedbackCollectionToast(options: {
}}
externalLink={externalLink}
externalLinkText={externalLinkText}
+ onClickLink={() => {
+ onFeedbackSubmit("link");
+ }}
/>