Skip to content

fix: remove several source change forms throughout the log drawer #730

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 5 commits into from
Apr 7, 2025
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
5 changes: 5 additions & 0 deletions .changeset/big-rules-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---

36c3edc fix: remove several source change forms throughout the log drawer
1 change: 0 additions & 1 deletion packages/app/src/components/DBRowOverviewPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export function RowOverviewPanel({
{!hideHeader && (
<Box px="32px" pt="md">
<DBRowSidePanelHeader
sourceId={source.id}
date={new Date(firstRow?.__hdx_timestamp ?? 0)}
tags={{}}
mainContent={mainContent}
Expand Down
1 change: 0 additions & 1 deletion packages/app/src/components/DBRowSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ export default function DBRowSidePanel({
<>
<Box p="sm">
<DBRowSidePanelHeader
sourceId={source.id}
date={timestampDate}
tags={tags}
mainContent={mainContent}
Expand Down
37 changes: 4 additions & 33 deletions packages/app/src/components/DBRowSidePanelHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import React, {
useRef,
useState,
} from 'react';
import { Box, Button, Flex, Modal, Paper, Popover, Text } from '@mantine/core';
import { Button, Flex, Paper, Text } from '@mantine/core';

import EventTag from '@/components/EventTag';
import { TableSourceForm } from '@/components/SourceForm';
import { FormatTime } from '@/useFormatTime';
import { useUserPreferences } from '@/useUserPreferences';
import { formatDistanceToNowStrictShort } from '@/utils';
Expand All @@ -20,37 +19,13 @@ const isValidDate = (date: Date) => 'getTime' in date && !isNaN(date.getTime());

const MAX_MAIN_CONTENT_LENGTH = 2000;

const EditButton = ({
sourceId,
label,
}: {
sourceId: string;
label?: string;
}) => {
return (
<Popover width={600} position="bottom" withArrow withinPortal={false}>
<Popover.Target>
<Button size="compact-xs" variant="subtle" color="gray">
<i className="bi bi-gear-fill fs-8.5" />
{label && <span className="ms-2">{label}</span>}
</Button>
</Popover.Target>
<Popover.Dropdown>
<TableSourceForm sourceId={sourceId} />
</Popover.Dropdown>
</Popover>
);
};

export default function DBRowSidePanelHeader({
sourceId,
tags,
mainContent = '',
mainContentHeader,
date,
severityText,
}: {
sourceId: string;
Copy link
Author

Choose a reason for hiding this comment

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

sourceId was only used for the TableSourceForm

date: Date;
mainContent?: string;
mainContentHeader?: string;
Expand Down Expand Up @@ -137,12 +112,9 @@ export default function DBRowSidePanelHeader({
ref={headerRef}
>
<Flex justify="space-between" mb="xs">
<Flex align="baseline" gap={2}>
<Text size="xs" c="gray.4">
{mainContentHeader}
</Text>
<EditButton sourceId={sourceId} />
</Flex>
<Text size="xs" c="gray.4">
{mainContentHeader}
</Text>
{/* Toggles expanded sidebar header*/}
{headerHeight >= maxBoxHeight && (
<Button
Expand Down Expand Up @@ -184,7 +156,6 @@ export default function DBRowSidePanelHeader({
<Text size="xs" c="gray.4" mb="xs">
[Empty]
</Text>
<EditButton sourceId={sourceId} label="Set body expression" />
</Paper>
)}
<Flex mt="sm">
Expand Down
33 changes: 0 additions & 33 deletions packages/app/src/components/DBTracePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useForm } from 'react-hook-form';
import { tcFromSource } from '@hyperdx/common-utils/dist/metadata';
import { SourceKind } from '@hyperdx/common-utils/dist/types';
import {
ActionIcon,
Button,
Center,
Divider,
Expand All @@ -14,15 +13,13 @@ import {
Stack,
Text,
} from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';

import { DBTraceWaterfallChartContainer } from '@/components/DBTraceWaterfallChart';
import { useSource, useUpdateSource } from '@/source';
import TabBar from '@/TabBar';

import { RowDataPanel } from './DBRowDataPanel';
import { RowOverviewPanel } from './DBRowOverviewPanel';
import { TableSourceForm } from './SourceForm';
import { SourceSelectControlled } from './SourceSelect';
import { SQLInlineEditorControlled } from './SQLInlineEditor';

Expand Down Expand Up @@ -103,22 +100,6 @@ export default function DBTracePanel({
}, [parentSourceData?.traceIdExpression, traceIdSetValue]);

const [showTraceIdInput, setShowTraceIdInput] = useState(false);
const [showSourceForm, setShowSourceForm] = useState(false);
useEffect(() => {
if (
isTraceSourceLoading == false &&
(traceSourceData == null ||
traceSourceData?.kind == 'log' ||
traceSourceData?.durationExpression == null)
) {
setShowSourceForm(true);
}
}, [showSourceForm, traceSourceData, isTraceSourceLoading]);

const [
sourceFormModalOpened,
{ open: openSourceFormModal, close: closeSourceFormModal },
] = useDisclosure(false);
Copy link
Author

Choose a reason for hiding this comment

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

All solely related to opening/closing source form


// Reset highlighted row when trace ID changes
// otherwise we'll show stale span details
Expand Down Expand Up @@ -155,19 +136,6 @@ export default function DBTracePanel({
: 'Correlated Log Source'}
</Text>
<SourceSelectControlled control={control} name="source" size="xs" />
<ActionIcon
variant="subtle"
color="dark.2"
size="sm"
onClick={
sourceFormModalOpened ? closeSourceFormModal : openSourceFormModal
}
title="Edit Source"
>
<Text size="xs">
<i className="bi bi-gear" />
</Text>
</ActionIcon>
</Group>
</Flex>
{(showTraceIdInput || !traceId) && parentSourceId != null && (
Expand Down Expand Up @@ -214,7 +182,6 @@ export default function DBTracePanel({
</Stack>
)}
<Divider my="sm" />
{sourceFormModalOpened && <TableSourceForm sourceId={watch('source')} />}
{traceSourceData?.kind === SourceKind.Trace && (
<DBTraceWaterfallChartContainer
traceTableSource={traceSourceData}
Expand Down