Skip to content
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

feat: Add feature flag customization and astra tracking #6963

Merged
merged 5 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -10,6 +10,7 @@ import {
} from "@/components/ui/dialog";
import { usePostTemplateValue } from "@/controllers/API/queries/nodes/use-post-template-value";
import { getCustomParameterTitle } from "@/customization/components/custom-parameter";
import { track } from "@/customization/utils/analytics";
import { mutateTemplate } from "@/CustomNodes/helpers/mutate-template";
import useAlertStore from "@/stores/alertStore";
import useFlowStore from "@/stores/flowStore";
Expand Down Expand Up @@ -122,6 +123,20 @@ export const NodeDialog: React.FC<NodeDialogProps> = ({
nodeClass.tool_mode,
);

if (nodeId.toLowerCase().includes("astra") && name === "database_name") {
const {
cloud_provider: cloudProvider,
new_database_name: databaseName,
...otherFields
} = fieldValues;
track("Database Created", {
nodeId,
cloudProvider,
databaseName,
...otherFields,
});
}

setTimeout(() => {
handleCloseDialog();
}, 5000);
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/src/CustomNodes/hooks/use-handle-new-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ const useHandleOnNewValue = ({
// Debounced tracking
track("Component Edited", { nodeId });

if (nodeId.toLowerCase().includes("astra") && name === "database_name") {
track("Database Selected", { nodeId, databaseName: changes.value });
}

if (!template) {
setErrorData({ title: "Template not found in the component" });
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { useLogout } from "@/controllers/API/queries/auth";
import CustomFeatureFlagDialog from "@/customization/components/custom-feature-flag-dialog";
import CustomFeatureFlagMenuItems from "@/customization/components/custom-feature-flag-menu-items";
import { CustomFeedbackDialog } from "@/customization/components/custom-feedback-dialog";
import { CustomHeaderMenuItemsTitle } from "@/customization/components/custom-header-menu-items-title";
import { CustomProfileIcon } from "@/customization/components/custom-profile-icon";
Expand All @@ -22,6 +24,8 @@ import ThemeButtons from "../ThemeButtons";

export const AccountMenu = () => {
const [isFeedbackOpen, setIsFeedbackOpen] = useState(false);
const [isCustomFeatureFlagsOpen, setIsCustomFeatureFlagsOpen] =
useState(false);
const { customParam: id } = useParams();
const version = useDarkStore((state) => state.version);
const navigate = useCustomNavigate();
Expand Down Expand Up @@ -99,14 +103,19 @@ export const AccountMenu = () => {
</>
)}
{ENABLE_DATASTAX_LANGFLOW ? (
<HeaderMenuItemButton onClick={() => setIsFeedbackOpen(true)}>
<span
data-testid="menu_feedback_button"
id="menu_feedback_button"
>
Feedback
</span>
</HeaderMenuItemButton>
<>
<HeaderMenuItemButton onClick={() => setIsFeedbackOpen(true)}>
<span
data-testid="menu_feedback_button"
id="menu_feedback_button"
>
Feedback
</span>
</HeaderMenuItemButton>
<CustomFeatureFlagMenuItems
onClick={() => setIsCustomFeatureFlagsOpen(true)}
/>
</>
) : (
<HeaderMenuItemLink newPage href="https://docs.langflow.org">
<span data-testid="menu_docs_button" id="menu_docs_button">
Expand Down Expand Up @@ -168,6 +177,10 @@ export const AccountMenu = () => {
isOpen={isFeedbackOpen}
setIsOpen={setIsFeedbackOpen}
/>
<CustomFeatureFlagDialog
isOpen={isCustomFeatureFlagsOpen}
setIsOpen={setIsCustomFeatureFlagsOpen}
/>
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const CustomFeatureFlagDialog = ({
isOpen,
setIsOpen,
}: {
isOpen: boolean;
setIsOpen: (isOpen: boolean) => void;
}) => {
return <></>;
};

export default CustomFeatureFlagDialog;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const CustomFeatureFlagMenuItems = ({ onClick }: { onClick?: () => void }) => {
return <></>;
};

export default CustomFeatureFlagMenuItems;
Loading