Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export const runDigmaWithCommandLine: PageContent = {
curl --create-dirs -O -L --output-dir ./otel https://github.com/digma-ai/otel-java-instrumentation/releases/latest/download/digma-otel-agent-extension.jar

export JAVA_TOOL_OPTIONS="-javaagent:/otel/javaagent.jar -Dotel.exporter.otlp.endpoint=http://localhost:5050 -Dotel.javaagent.extensions=/otel/digma-otel-agent-extension.jar -Dotel.metrics.exporter=none -Dotel.logs.exporter=none -Dotel.exporter.otlp.protocol=grpc"

export OTEL_SERVICE_NAME={--ENTER YOUR SERVICE NAME HERE--}
export OTEL_RESOURCE_ATTRIBUTES=digma.environment=LOCAL

Expand Down
10 changes: 10 additions & 0 deletions src/components/RecentActivity/RecentActivity.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Meta, StoryObj } from "@storybook/react";
import { RecentActivity } from ".";
import { mockData as liveData } from "./LiveView/mockData";
import { actions } from "./actions";
import { RecentActivityData } from "./types";

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
Expand Down Expand Up @@ -663,3 +664,12 @@ export const WithNoLiveData: Story = {
}
}
};

export const OpenRegistrationDialog: Story = {
play: () => {
window.postMessage({
type: "digma",
action: actions.OPEN_REGISTRATION_DIALOG
});
}
};
3 changes: 2 additions & 1 deletion src/components/RecentActivity/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export const actions = addPrefix(ACTION_PREFIX, {
APPLY_REMOTE_ENVIRONMENT_SETTINGS: "APPLY_REMOTE_ENVIRONMENT_SETTINGS",
SET_REMOTE_ENVIRONMENT_CONNECTION_CHECK_RESULT:
"SET_REMOTE_ENVIRONMENT_CONNECTION_CHECK_RESULT",
FINISH_ORG_DIGMA_SETUP: "FINISH_ORG_DIGMA_SETUP"
FINISH_ORG_DIGMA_SETUP: "FINISH_ORG_DIGMA_SETUP",
OPEN_REGISTRATION_DIALOG: "OPEN_REGISTRATION_DIALOG"
});
23 changes: 21 additions & 2 deletions src/components/RecentActivity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,27 @@ export const RecentActivity = (props: RecentActivityProps) => {
setLiveData(data as LiveData);
};

const handleOpenRegistrationDialog = () => {
setIsRegistrationPopupVisible(true);
};

dispatcher.addActionListener(actions.SET_DATA, handleRecentActivityData);
dispatcher.addActionListener(actions.SET_LIVE_DATA, handleLiveData);
dispatcher.addActionListener(
actions.OPEN_REGISTRATION_DIALOG,
handleOpenRegistrationDialog
);

return () => {
dispatcher.removeActionListener(
actions.SET_DATA,
handleRecentActivityData
);
dispatcher.removeActionListener(actions.SET_LIVE_DATA, handleLiveData);
dispatcher.removeActionListener(
actions.OPEN_REGISTRATION_DIALOG,
handleOpenRegistrationDialog
);
};
}, []);

Expand Down Expand Up @@ -339,8 +352,14 @@ export const RecentActivity = (props: RecentActivityProps) => {
action: globalActions.REGISTER,
payload: {
...formData,
scope: "recent activity add environment",
selectedEnvironmentType: environmentToSetType?.type
...(environmentToSetType
? {
scope: "recent activity add environment",
selectedEnvironmentType: environmentToSetType.type
}
: {
scope: "recent activity"
})
}
});

Expand Down
6 changes: 6 additions & 0 deletions src/components/common/RegistrationDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { KeyboardEvent, useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { isValidEmailFormat } from "../../../utils/isValidEmailFormat";
import { sendTrackingEvent } from "../../../utils/sendTrackingEvent";
import { NewCircleLoader } from "../NewCircleLoader";
import { EnvelopeIcon } from "../icons/16px/EnvelopeIcon";
import { CrossIcon } from "../icons/CrossIcon";
Expand Down Expand Up @@ -51,18 +52,23 @@ export const RegistrationDialog = (props: RegistrationDialogProps) => {
}, [setFocus]);

const onSubmit = (data: RegistrationFormValues) => {
sendTrackingEvent("registration dialog submit button clicked");
props.onSubmit({
fullName: data.fullName.trim(),
email: data.email
});
};

const handleCloseButtonClick = () => {
sendTrackingEvent("registration dialog close button clicked");
props.onClose();
};

const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
if (e.key === "Enter" && isValid) {
sendTrackingEvent(
"registration dialog Enter key pressed and form data is valid"
);
onSubmit(values);
}
};
Expand Down