Skip to content

[dashboard] Send error body with feedback #12992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions components/dashboard/src/Analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
import Cookies from "js-cookie";
import { v4 } from "uuid";
import { Experiment } from "./experiments";
import { StartWorkspaceError } from "./start/StartPage";

export type Event =
| "invite_url_requested"
Expand Down Expand Up @@ -40,6 +41,8 @@ export interface TrackFeedback {
feedback: string;
href: string;
path: string;
error_object?: StartWorkspaceError;
error_message?: string;
Comment on lines +44 to +45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason these props have to be snake-cased rather than camel-cased?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really! Before it was error_rendered which I confirmed with @jakobhero. Let me see what the convention is in Segment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it's a mix 😅 Some are ui_experiments, button_type, while others are workspaceInstanceId or clientKind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asked here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I thought this interface defined props for some component, but it doesn't 😊 It's fine how it is if Segment needs it that way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

short answer: snake case is preferred downstream, but using camel case is perfectly fine as segment will automatically change the prop names to snake case before pushing downstream - more details here

}
interface TrackDashboardClick {
dnt?: boolean;
Expand Down
1 change: 1 addition & 0 deletions components/dashboard/src/components/ErrorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function ErrorMessage(props: { imgSrc: string; imgAlt?: string; message: string
initialSize={24}
isError={true}
isModal={false}
errorMessage={props.message}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ import starry from "../images/feedback/starry-emoji.svg";
import happy from "../images/feedback/happy-emoji.svg";
import meh from "../images/feedback/meh-emoji.svg";
import crying from "../images/feedback/crying-emoji.svg";
import { trackEvent } from "../Analytics";
import { trackEvent, TrackFeedback } from "../Analytics";
import { StartWorkspaceError } from "../start/StartPage";

function FeedbackComponent(props: {
onClose?: () => void;
isModal: boolean;
isError: boolean;
message?: string;
initialSize?: number;
errorObject?: StartWorkspaceError;
errorMessage?: string;
}) {
const [text, setText] = useState<string>("");
const [selectedEmoji, setSelectedEmoji] = useState<number | undefined>();
Expand All @@ -30,11 +33,13 @@ function FeedbackComponent(props: {
};
const onSubmit = () => {
if (selectedEmoji) {
const feedbackObj = {
const feedbackObj: TrackFeedback = {
score: selectedEmoji,
feedback: text,
href: window.location.href,
path: window.location.pathname,
error_object: props.errorObject || undefined,
error_message: props.errorMessage,
};
trackEvent("feedback_submitted", feedbackObj);
}
Expand Down
2 changes: 2 additions & 0 deletions components/dashboard/src/start/CreateWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ function RepositoryNotFoundView(p: { error: StartWorkspaceError }) {
message={"Was this error message helpful?"}
isError={true}
initialSize={24}
errorObject={p.error}
errorMessage={p.error.message}
/>
)}
</StartPage>
Expand Down