mirror of
https://github.com/SigNoz/signoz.git
synced 2026-11-26 18:20:42 +00:00
Compare commits
6 Commits
fix/variab
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1f271a505 | ||
|
|
c92bb94caf | ||
|
|
8e3a4f8775 | ||
|
|
a8433ad9e0 | ||
|
|
d07b0f1d82 | ||
|
|
a02330438f |
@@ -318,6 +318,11 @@
|
||||
"name": "redux",
|
||||
"message": "[State mgmt] redux is deprecated. Migrate to Zustand, nuqs, or react-query."
|
||||
},
|
||||
{
|
||||
"name": "@signozhq/design-tokens",
|
||||
"importNames": ["Style"],
|
||||
"message": "[bundle] Style is a large object of CSS variable strings and is not tree-shaken. Write the CSS variable directly, for example 'var(--l3-foreground)'."
|
||||
},
|
||||
{
|
||||
"name": "react-redux",
|
||||
"message": "[State mgmt] react-redux is deprecated. Migrate to Zustand, nuqs, or react-query."
|
||||
@@ -340,6 +345,11 @@
|
||||
"importNames": ["patchDashboardV2", "usePatchDashboardV2"],
|
||||
"message": "[dashboard-v2] Don't call patchDashboardV2/usePatchDashboardV2 directly — use useOptimisticPatch().patchAsync so spec edits update the react-query cache optimistically and reconcile on settle."
|
||||
},
|
||||
{
|
||||
"name": "antd/lib",
|
||||
"allowTypeImports": true,
|
||||
"message": "[bundle] antd/lib is the CommonJS root and bundles every antd component. Import from 'antd' instead."
|
||||
},
|
||||
{
|
||||
"name": "motion/react-client",
|
||||
"message": "[motion] motion/react-client is for React Server Components only. Use 'motion/react' instead — it provides the same exports and works correctly in client-side SPAs."
|
||||
|
||||
@@ -14,14 +14,14 @@ export type CreatedByProps =
|
||||
creatorOptions: CreatorOption[];
|
||||
createdBy: string[];
|
||||
onCreatedByChange: (emails: string[]) => void;
|
||||
// Clear all Created-by selections and run immediately.
|
||||
onClearCreatedBy: () => void;
|
||||
// Run a Created-by change made with the dropdown closed.
|
||||
onCreatedByCommit: (emails: string[]) => void;
|
||||
}
|
||||
| {
|
||||
creatorOptions?: undefined;
|
||||
createdBy?: undefined;
|
||||
onCreatedByChange?: undefined;
|
||||
onClearCreatedBy?: undefined;
|
||||
onCreatedByCommit?: undefined;
|
||||
};
|
||||
|
||||
type Props = CreatedByProps & {
|
||||
@@ -61,8 +61,8 @@ function FilterChips(props: Props): JSX.Element {
|
||||
placeholder="Created by"
|
||||
testId={`${testIdPrefix}-filter-created-by`}
|
||||
disabled={disabled}
|
||||
onClear={props.onClearCreatedBy}
|
||||
onChange={props.onCreatedByChange}
|
||||
onCommit={props.onCreatedByCommit}
|
||||
onDropdownVisibleChange={runOnClose}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -81,7 +81,7 @@ function FilterZone({
|
||||
applyDraft,
|
||||
handleCreatedByChange,
|
||||
handleUpdatedChange,
|
||||
handleClearCreatedBy,
|
||||
handleCreatedByCommit,
|
||||
handleClear,
|
||||
} = useFilterZoneDraft({
|
||||
query,
|
||||
@@ -96,7 +96,7 @@ function FilterZone({
|
||||
creatorOptions,
|
||||
createdBy: reflected.createdBy,
|
||||
onCreatedByChange: handleCreatedByChange,
|
||||
onClearCreatedBy: handleClearCreatedBy,
|
||||
onCreatedByCommit: handleCreatedByCommit,
|
||||
}
|
||||
: {};
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { ConfigProvider, Select } from 'antd';
|
||||
import { Checkbox } from '@signozhq/ui/checkbox';
|
||||
import cx from 'classnames';
|
||||
@@ -20,7 +21,9 @@ interface Props {
|
||||
placeholder: string;
|
||||
testId: string;
|
||||
onChange: (values: string[]) => void;
|
||||
onClear?: () => void;
|
||||
// A change made with the dropdown closed (a tag's ×, the clear icon) has no
|
||||
// close to run on, so it is committed here instead of staged via onChange.
|
||||
onCommit: (values: string[]) => void;
|
||||
onDropdownVisibleChange?: (open: boolean) => void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
@@ -31,10 +34,31 @@ function MultiSelectFilter({
|
||||
placeholder,
|
||||
testId,
|
||||
onChange,
|
||||
onClear,
|
||||
onCommit,
|
||||
onDropdownVisibleChange,
|
||||
disabled = false,
|
||||
}: Props): JSX.Element {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const handleChange = useCallback(
|
||||
(next: string[]): void => {
|
||||
if (!isOpen) {
|
||||
onCommit(next);
|
||||
return;
|
||||
}
|
||||
onChange(next);
|
||||
},
|
||||
[isOpen, onChange, onCommit],
|
||||
);
|
||||
|
||||
const handleDropdownVisibleChange = useCallback(
|
||||
(nextOpen: boolean): void => {
|
||||
setIsOpen(nextOpen);
|
||||
onDropdownVisibleChange?.(nextOpen);
|
||||
},
|
||||
[onDropdownVisibleChange],
|
||||
);
|
||||
|
||||
return (
|
||||
<ConfigProvider theme={CHECKBOX_SELECT_THEME}>
|
||||
<Select
|
||||
@@ -51,7 +75,6 @@ function MultiSelectFilter({
|
||||
menuItemSelectedIcon={null}
|
||||
data-testid={testId}
|
||||
disabled={disabled}
|
||||
onClear={onClear}
|
||||
optionRender={(option): JSX.Element => (
|
||||
<div
|
||||
className={styles.checkOption}
|
||||
@@ -66,8 +89,8 @@ function MultiSelectFilter({
|
||||
<span className={styles.checkOptionLabel}>{option.label}</span>
|
||||
</div>
|
||||
)}
|
||||
onChange={(next): void => onChange(next as string[])}
|
||||
onDropdownVisibleChange={onDropdownVisibleChange}
|
||||
onChange={(next): void => handleChange(next as string[])}
|
||||
onDropdownVisibleChange={handleDropdownVisibleChange}
|
||||
/>
|
||||
</ConfigProvider>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { render, screen } from 'tests/test-utils';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { render, screen, within } from 'tests/test-utils';
|
||||
|
||||
import type { DslGrammar } from '../../dsl/types';
|
||||
import FilterZone from '../FilterZone';
|
||||
@@ -47,4 +48,33 @@ describe('FilterZone', () => {
|
||||
).not.toBeInTheDocument();
|
||||
expect(screen.getByTestId('things-filter-updated')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('runs the query when a creator is removed with the dropdown closed', async () => {
|
||||
const user = userEvent.setup();
|
||||
const onQueryChange = jest.fn();
|
||||
render(
|
||||
<FilterZone
|
||||
query="created_by = 'ada@example.com'"
|
||||
grammar={grammar}
|
||||
testIdPrefix="things"
|
||||
creatorOptions={[{ email: 'ada@example.com', label: 'Ada' }]}
|
||||
source={source}
|
||||
onQueryChange={onQueryChange}
|
||||
/>,
|
||||
);
|
||||
|
||||
// antd renders the tag's × aria-hidden.
|
||||
await user.click(
|
||||
within(screen.getByTitle('Ada')).getByRole('img', {
|
||||
name: 'close',
|
||||
hidden: true,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(
|
||||
within(screen.getByTestId('things-filter-created-by')).getByRole('combobox'),
|
||||
).toHaveAttribute('aria-expanded', 'false');
|
||||
|
||||
expect(onQueryChange).toHaveBeenCalledWith('');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -106,12 +106,20 @@ describe('useFilterZoneDraft', () => {
|
||||
"created_by = 'a@x.io' AND name = 'x'",
|
||||
);
|
||||
|
||||
act(() => result.current.handleClearCreatedBy());
|
||||
act(() => result.current.handleCreatedByCommit([]));
|
||||
|
||||
expect(result.current.draft).toBe("name = 'x'");
|
||||
expect(onQueryChange).toHaveBeenCalledWith("name = 'x'");
|
||||
});
|
||||
|
||||
it('runs the remaining creators when one is removed', () => {
|
||||
const { result, onQueryChange } = setup("created_by IN ['a@x.io', 'b@x.io']");
|
||||
|
||||
act(() => result.current.handleCreatedByCommit(['b@x.io']));
|
||||
|
||||
expect(onQueryChange).toHaveBeenCalledWith("created_by = 'b@x.io'");
|
||||
});
|
||||
|
||||
it('empties the draft and runs the empty query on clear', () => {
|
||||
const { result, onQueryChange, onCleared, onClearAll } = setup();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ interface FilterZoneDraft {
|
||||
applyDraft: (next: string) => void;
|
||||
handleCreatedByChange: (emails: string[]) => void;
|
||||
handleUpdatedChange: (window: UpdatedWindow) => void;
|
||||
handleClearCreatedBy: () => void;
|
||||
handleCreatedByCommit: (emails: string[]) => void;
|
||||
handleClear: () => void;
|
||||
}
|
||||
|
||||
@@ -97,10 +97,14 @@ export function useFilterZoneDraft({
|
||||
[draft, applyDraft, onFilterApplied],
|
||||
);
|
||||
|
||||
// Clear-all on the Created-by select removes its clause and runs immediately.
|
||||
const handleClearCreatedBy = useCallback((): void => {
|
||||
applyDraft(spliceClause(draft, 'created_by', null));
|
||||
}, [draft, applyDraft]);
|
||||
// Runs a Created-by change made with its dropdown closed.
|
||||
const handleCreatedByCommit = useCallback(
|
||||
(emails: string[]): void => {
|
||||
onFilterApplied?.('createdBy', { valueCount: emails.length });
|
||||
applyDraft(spliceClause(draft, 'created_by', createdByClause(emails)));
|
||||
},
|
||||
[draft, applyDraft, onFilterApplied],
|
||||
);
|
||||
|
||||
// Clear resets the draft and runs immediately (empty query).
|
||||
const handleClear = useCallback((): void => {
|
||||
@@ -122,7 +126,7 @@ export function useFilterZoneDraft({
|
||||
applyDraft,
|
||||
handleCreatedByChange,
|
||||
handleUpdatedChange,
|
||||
handleClearCreatedBy,
|
||||
handleCreatedByCommit,
|
||||
handleClear,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useState } from 'react';
|
||||
import { Tooltip } from '@signozhq/ui/tooltip';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { ChevronDown, ChevronRight, Undo2 } from '@signozhq/icons';
|
||||
|
||||
@@ -22,31 +20,6 @@ export function CheckboxFilterV2Header({
|
||||
onToggleOpen,
|
||||
onClear,
|
||||
}: CheckboxFilterHeaderProps): JSX.Element {
|
||||
const [isTitleTruncated, setIsTitleTruncated] = useState(false);
|
||||
|
||||
const measureTitle = (el: HTMLElement | null): void => {
|
||||
if (el) {
|
||||
setIsTitleTruncated(el.scrollWidth > el.clientWidth);
|
||||
}
|
||||
};
|
||||
|
||||
const titleText = (
|
||||
<Typography
|
||||
ref={measureTitle}
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="secondary"
|
||||
as="span"
|
||||
display="inline-block"
|
||||
minWidth={0}
|
||||
textOverflow="ellipsis"
|
||||
textTransform="capitalize"
|
||||
>
|
||||
{title}
|
||||
</Typography>
|
||||
);
|
||||
|
||||
return (
|
||||
<section
|
||||
role="button"
|
||||
@@ -67,7 +40,19 @@ export function CheckboxFilterV2Header({
|
||||
) : (
|
||||
<ChevronRight size={13} cursor="pointer" />
|
||||
)}
|
||||
<Tooltip title={isTitleTruncated ? title : undefined}>{titleText}</Tooltip>
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="secondary"
|
||||
as="span"
|
||||
display="inline-block"
|
||||
minWidth={0}
|
||||
textOverflow="ellipsis"
|
||||
textTransform="capitalize"
|
||||
>
|
||||
{title}
|
||||
</Typography>
|
||||
</section>
|
||||
{isOpen && canReset && (
|
||||
<section className={styles.rightAction}>
|
||||
|
||||
@@ -120,43 +120,4 @@ describe('CheckboxFilterV2Header', () => {
|
||||
expect(onToggleOpen).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('title tooltip', () => {
|
||||
// jsdom has no layout, so truncation is simulated at the prototype level
|
||||
// before mount (the component measures in a layout effect).
|
||||
function mockTitleWidths(scrollWidth: number, clientWidth: number): void {
|
||||
jest
|
||||
.spyOn(HTMLElement.prototype, 'scrollWidth', 'get')
|
||||
.mockReturnValue(scrollWidth);
|
||||
jest
|
||||
.spyOn(HTMLElement.prototype, 'clientWidth', 'get')
|
||||
.mockReturnValue(clientWidth);
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('shows the full name on hover when the title is truncated', async () => {
|
||||
mockTitleWidths(200, 100);
|
||||
const user = userEvent.setup();
|
||||
render(<CheckboxFilterV2Header {...defaultProps} />);
|
||||
|
||||
await user.hover(screen.getByText(defaultProps.title));
|
||||
|
||||
await expect(screen.findByRole('tooltip')).resolves.toHaveTextContent(
|
||||
defaultProps.title,
|
||||
);
|
||||
});
|
||||
|
||||
it('shows no tooltip when the title fits', async () => {
|
||||
mockTitleWidths(100, 100);
|
||||
const user = userEvent.setup();
|
||||
render(<CheckboxFilterV2Header {...defaultProps} />);
|
||||
|
||||
await user.hover(screen.getByText(defaultProps.title));
|
||||
|
||||
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -114,6 +114,19 @@ export const loadingFiltersHandlers = [
|
||||
),
|
||||
];
|
||||
|
||||
export const longTitleConfig = [
|
||||
{
|
||||
attributeKey: {
|
||||
dataType: DataTypes.Int64,
|
||||
key: 'http.request.content_length_uncompressed',
|
||||
type: 'tag',
|
||||
},
|
||||
defaultOpen: false,
|
||||
title: 'Http Request Content Length Uncompressed',
|
||||
type: FiltersType.CHECKBOX,
|
||||
},
|
||||
];
|
||||
|
||||
export const LONG_FILTER_VALUES = [
|
||||
'checkout-service.production-eu-central-1.svc.cluster.local',
|
||||
'payments-authorisation-worker.production-us-east-2.svc.cluster.local',
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { GlobalMockArgs } from '@/storybook/globals';
|
||||
import QuickFilters from '../QuickFilters';
|
||||
import {
|
||||
dirtySettings,
|
||||
hoverTruncatedTitle,
|
||||
openQueryPicker,
|
||||
openSettings,
|
||||
} from './__story_mockdata__/quickFilters.play';
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
handlers,
|
||||
LONG_FILTER_VALUES,
|
||||
loadingFiltersHandlers,
|
||||
longTitleConfig,
|
||||
MANY_FILTER_VALUES,
|
||||
queryBuilder,
|
||||
selectedServiceQueryBuilder,
|
||||
@@ -159,6 +161,15 @@ export const Tooltips: GlobalArgsStory = {
|
||||
},
|
||||
};
|
||||
|
||||
/** A section title too long for the rail: hovering it shows the full title once. */
|
||||
export const TruncatedTitle: GlobalArgsStory = {
|
||||
args: { config: longTitleConfig },
|
||||
parameters: {
|
||||
msw: { handlers: [noSavedFiltersHandler, ...handlers] },
|
||||
},
|
||||
play: hoverTruncatedTitle,
|
||||
};
|
||||
|
||||
const [firstQuery] = queryBuilder.currentQuery.builder.queryData;
|
||||
|
||||
/** Interaction: the query picker lists every query the filters can follow. */
|
||||
|
||||
@@ -8,9 +8,12 @@ import { QuickFilterManagePermissions } from 'lib/authz/hooks/useAuthZ/permissio
|
||||
import { expect, screen, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { grantsAll } from '@/storybook/access/access';
|
||||
import { hoverTruncatableText } from '@/storybook/play/truncatedText';
|
||||
import type { GlobalMockArgs } from '@/storybook/globals';
|
||||
|
||||
import type QuickFilters from '../../QuickFilters';
|
||||
import { longTitleConfig } from '../QuickFilters.stories.mocks';
|
||||
import { FiltersType } from '../../types';
|
||||
|
||||
interface PlayContext {
|
||||
canvasElement: HTMLElement;
|
||||
@@ -61,6 +64,26 @@ export const dirtySettings = async (context: PlayContext): Promise<void> => {
|
||||
await screen.findByRole('button', { name: 'Save changes' });
|
||||
};
|
||||
|
||||
export const hoverTruncatedTitle = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
const [filter] = args.config ?? [];
|
||||
// Duration and slider sections render no title of their own.
|
||||
if (filter?.type !== FiltersType.CHECKBOX || !filter.title) {
|
||||
return;
|
||||
}
|
||||
|
||||
const [label] = await within(canvasElement).findAllByText(
|
||||
filter.title,
|
||||
{},
|
||||
UNTIL_LOADED,
|
||||
);
|
||||
await hoverTruncatableText(label, filter.title, {
|
||||
cut: filter.title === longTitleConfig[0].title || undefined,
|
||||
});
|
||||
};
|
||||
|
||||
export const openQueryPicker = async ({
|
||||
canvasElement,
|
||||
}: PlayContext): Promise<void> => {
|
||||
|
||||
@@ -2,8 +2,7 @@ import { Dispatch, SetStateAction, useEffect, useMemo, useState } from 'react';
|
||||
import { useAppNavigate } from 'lib/router/useAppNavigate';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Select, Skeleton } from 'antd';
|
||||
import { SelectProps } from 'antd/lib';
|
||||
import { Select, SelectProps, Skeleton } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { useListAccounts } from 'api/generated/services/cloudintegration';
|
||||
import cx from 'classnames';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Modal } from 'antd/lib';
|
||||
import { Modal } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { useDisconnectAccount } from 'api/generated/services/cloudintegration';
|
||||
import { CloudintegrationtypesGCPConnectionMethodDTO } from 'api/generated/services/sigNoz.schemas';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { RuletypesAlertStateDTO } from 'api/generated/services/sigNoz.schemas';
|
||||
import MultiSelectFilter, {
|
||||
type MultiSelectFilterOption,
|
||||
@@ -25,25 +25,27 @@ function RuleStatesFilter({
|
||||
onChange,
|
||||
}: RuleStatesFilterProps): JSX.Element {
|
||||
const [draft, setDraft] = useState(states);
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setDraft(states);
|
||||
}, [states]);
|
||||
|
||||
const handleChange = (next: string[]): void => {
|
||||
setDraft(next);
|
||||
if (!open) {
|
||||
const handleCommit = useCallback(
|
||||
(next: string[]): void => {
|
||||
setDraft(next);
|
||||
onChange(next);
|
||||
}
|
||||
};
|
||||
},
|
||||
[onChange],
|
||||
);
|
||||
|
||||
const handleDropdownVisibleChange = (nextOpen: boolean): void => {
|
||||
setOpen(nextOpen);
|
||||
if (!nextOpen && !isSameStates(draft, states)) {
|
||||
onChange(draft);
|
||||
}
|
||||
};
|
||||
const handleDropdownVisibleChange = useCallback(
|
||||
(isOpen: boolean): void => {
|
||||
if (!isOpen && !isSameStates(draft, states)) {
|
||||
onChange(draft);
|
||||
}
|
||||
},
|
||||
[draft, states, onChange],
|
||||
);
|
||||
|
||||
return (
|
||||
<MultiSelectFilter
|
||||
@@ -51,7 +53,8 @@ function RuleStatesFilter({
|
||||
options={STATE_OPTIONS}
|
||||
placeholder="Status"
|
||||
testId="alert-rules-filter-states"
|
||||
onChange={handleChange}
|
||||
onChange={setDraft}
|
||||
onCommit={handleCommit}
|
||||
onDropdownVisibleChange={handleDropdownVisibleChange}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { Color, Style } from '@signozhq/design-tokens';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
@@ -81,7 +81,7 @@ function ConfigureGoogleAuthAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="google-domain">
|
||||
Domain
|
||||
<Tooltip title="The email domain for users who should use SSO (e.g., `example.com` for users with `@example.com` emails)">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -104,7 +104,7 @@ function ConfigureGoogleAuthAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="google-client-id">
|
||||
Client ID
|
||||
<Tooltip title="ClientID is the application's ID. For example, 292085223830.apps.googleusercontent.com.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -122,7 +122,7 @@ function ConfigureGoogleAuthAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="google-client-secret">
|
||||
Client Secret
|
||||
<Tooltip title="It is the application's secret.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -161,7 +161,7 @@ function ConfigureGoogleAuthAuthnProvider({
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
<Tooltip title='Whether to skip email verification. Defaults to "false"'>
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
@@ -243,7 +243,7 @@ function ConfigureGoogleAuthAuthnProvider({
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
<Tooltip title="Enable fetching Google Workspace groups for the user. Requires service account configuration.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
@@ -256,7 +256,7 @@ function ConfigureGoogleAuthAuthnProvider({
|
||||
>
|
||||
Service Account JSON
|
||||
<Tooltip title="The JSON content of the Google Service Account credentials file. Required for group fetching.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -298,7 +298,7 @@ function ConfigureGoogleAuthAuthnProvider({
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
<Tooltip title="If enabled, recursively fetch groups that contain other groups (transitive membership).">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
@@ -309,7 +309,7 @@ function ConfigureGoogleAuthAuthnProvider({
|
||||
>
|
||||
Allowed Groups
|
||||
<Tooltip title="Optional list of allowed groups. If configured, only users belonging to one of these groups will be allowed to login.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { Style } from '@signozhq/design-tokens';
|
||||
import { CircleHelp, TriangleAlert } from '@signozhq/icons';
|
||||
import { Callout } from '@signozhq/ui/callout';
|
||||
import { Checkbox } from '@signozhq/ui/checkbox';
|
||||
@@ -55,7 +54,7 @@ function ConfigureOIDCAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="oidc-domain">
|
||||
Domain
|
||||
<Tooltip title="The email domain for users who should use SSO (e.g., `example.com` for users with `@example.com` emails)">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -77,7 +76,7 @@ function ConfigureOIDCAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="oidc-issuer">
|
||||
Issuer URL
|
||||
<Tooltip title='The URL identifier for the OIDC provider. For example: "https://accounts.google.com" or "https://login.salesforce.com".'>
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -95,7 +94,7 @@ function ConfigureOIDCAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="oidc-issuer-alias">
|
||||
Issuer Alias
|
||||
<Tooltip title="Optional: Override the issuer URL from .well-known/openid-configuration for providers like Azure or Oracle IDCS.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -110,7 +109,7 @@ function ConfigureOIDCAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="oidc-client-id">
|
||||
Client ID
|
||||
<Tooltip title="The application's client ID from your OIDC provider.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -128,7 +127,7 @@ function ConfigureOIDCAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="oidc-client-secret">
|
||||
Client Secret
|
||||
<Tooltip title="The application's client secret from your OIDC provider.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -166,7 +165,7 @@ function ConfigureOIDCAuthnProvider({
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
<Tooltip title='Whether to skip email verification. Defaults to "false"'>
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
@@ -187,7 +186,7 @@ function ConfigureOIDCAuthnProvider({
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
<Tooltip title="Use the userinfo endpoint to get additional claims. Useful when providers return thin ID tokens.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className="authn-provider__callout-wrapper">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { Style } from '@signozhq/design-tokens';
|
||||
import { CircleHelp, TriangleAlert } from '@signozhq/icons';
|
||||
import { Callout } from '@signozhq/ui/callout';
|
||||
import { Checkbox } from '@signozhq/ui/checkbox';
|
||||
@@ -54,7 +53,7 @@ function ConfigureSAMLAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="saml-domain">
|
||||
Domain
|
||||
<Tooltip title="The email domain for users who should use SSO (e.g., `example.com` for users with `@example.com` emails)">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -76,7 +75,7 @@ function ConfigureSAMLAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="saml-acs-url">
|
||||
SAML ACS URL
|
||||
<Tooltip title="The SSO endpoint of the SAML identity provider. It can typically be found in the SingleSignOnService element in the SAML metadata of the identity provider.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -98,7 +97,7 @@ function ConfigureSAMLAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="saml-entity-id">
|
||||
SAML Entity ID
|
||||
<Tooltip title="The entityID of the SAML identity provider. It can typically be found in the EntityID attribute of the EntityDescriptor element in the SAML metadata.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -120,7 +119,7 @@ function ConfigureSAMLAuthnProvider({
|
||||
<label className="authn-provider__label" htmlFor="saml-certificate">
|
||||
SAML X.509 Certificate
|
||||
<Tooltip title="The certificate of the SAML identity provider. It can typically be found in the X509Certificate element in the SAML metadata.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -163,7 +162,7 @@ function ConfigureSAMLAuthnProvider({
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
<Tooltip title="Whether to skip signing the SAML requests. For providers like JumpCloud, this should be enabled.">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { Color, Style } from '@signozhq/design-tokens';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
@@ -98,7 +98,7 @@ function AttributeMappingSection({
|
||||
>
|
||||
Email Attribute
|
||||
<Tooltip title="The SAML attribute key that contains the user's email. Default: 'email'">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -117,7 +117,7 @@ function AttributeMappingSection({
|
||||
>
|
||||
Name Attribute
|
||||
<Tooltip title="The SAML attribute key that contains the user's display name. Default: 'name'">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -136,7 +136,7 @@ function AttributeMappingSection({
|
||||
>
|
||||
Groups Attribute
|
||||
<Tooltip title="The SAML attribute key that contains the user's group memberships. Used for role mapping. Default: 'groups'">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -155,7 +155,7 @@ function AttributeMappingSection({
|
||||
>
|
||||
Role Attribute
|
||||
<Tooltip title="The SAML attribute key that contains the user's role directly from the IDP. Default: 'role'">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { Color, Style } from '@signozhq/design-tokens';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
@@ -93,7 +93,7 @@ function ClaimMappingSection({
|
||||
<label className="claim-mapping-section__label" htmlFor="email-claim">
|
||||
Email Claim
|
||||
<Tooltip title="The claim key that contains the user's email address. Default: 'email'">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -109,7 +109,7 @@ function ClaimMappingSection({
|
||||
<label className="claim-mapping-section__label" htmlFor="name-claim">
|
||||
Name Claim
|
||||
<Tooltip title="The claim key that contains the user's display name. Default: 'name'">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -125,7 +125,7 @@ function ClaimMappingSection({
|
||||
<label className="claim-mapping-section__label" htmlFor="groups-claim">
|
||||
Groups Claim
|
||||
<Tooltip title="The claim key that contains the user's group memberships. Used for role mapping. Default: 'groups'">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -141,7 +141,7 @@ function ClaimMappingSection({
|
||||
<label className="claim-mapping-section__label" htmlFor="role-claim">
|
||||
Role Claim
|
||||
<Tooltip title="The claim key that contains the user's role directly from the IDP. Default: 'role'">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { Color, Style } from '@signozhq/design-tokens';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
@@ -108,7 +108,7 @@ function RoleMappingSection({
|
||||
<label className="role-mapping-section__label" htmlFor="default-role">
|
||||
Default Role
|
||||
<Tooltip title='The default role assigned to new SSO users if no other role mapping applies. Default: "signoz-viewer"'>
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</label>
|
||||
<Form.Item
|
||||
@@ -148,7 +148,7 @@ function RoleMappingSection({
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
<Tooltip title="If enabled, the role claim/attribute from the IDP will be used directly instead of group mappings. The role value must match a SigNoz role name (e.g. signoz-viewer, signoz-editor, signoz-admin, or a custom role).">
|
||||
<CircleHelp size={14} color={Style.L3_FOREGROUND} cursor="help" />
|
||||
<CircleHelp size={14} color="var(--l3-foreground)" cursor="help" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -108,6 +108,8 @@
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
gap: 8px;
|
||||
|
||||
.value {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Tooltip } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import cx from 'classnames';
|
||||
import { isEmpty, isObject } from 'lodash-es';
|
||||
@@ -46,28 +45,73 @@ function Suggestions(props: ISuggestionsProps): React.ReactElement {
|
||||
return (
|
||||
<div className="option">
|
||||
{!isEmpty(optionType) && isObject(value) ? (
|
||||
<Tooltip title={value.key} placement="topLeft">
|
||||
<div className="container">
|
||||
<section className="left-section">
|
||||
{value.isIndexed ? (
|
||||
<Zap size={12} fill={Color.BG_AMBER_500} />
|
||||
) : (
|
||||
<div className="dot" />
|
||||
)}
|
||||
<div className="value">
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="inherit"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{label}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="container">
|
||||
<section className="left-section">
|
||||
{value.isIndexed ? (
|
||||
<Zap size={12} fill={Color.BG_AMBER_500} />
|
||||
) : (
|
||||
<div className="dot" />
|
||||
)}
|
||||
<div className="value">
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="inherit"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{label}
|
||||
</Typography>
|
||||
</div>
|
||||
</section>
|
||||
<section className="right-section">
|
||||
<div className="data-type">
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="inherit"
|
||||
as="p"
|
||||
textOverflow="visible"
|
||||
>
|
||||
{value.dataType}
|
||||
</Typography>
|
||||
</div>
|
||||
<section className={cx('type-tag', value.type)}>
|
||||
<div className="dot" />
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="small"
|
||||
weight="regular"
|
||||
color="inherit"
|
||||
as="span"
|
||||
textOverflow="visible"
|
||||
textTransform="capitalize"
|
||||
>
|
||||
{value.type}
|
||||
</Typography>
|
||||
</section>
|
||||
<section className="right-section">
|
||||
</section>
|
||||
</div>
|
||||
) : (
|
||||
<div className="container-without-tag">
|
||||
<section className="left">
|
||||
<div className="dot" />
|
||||
<div className={cx('value', option)}>
|
||||
<Typography
|
||||
{...labelTextStyle}
|
||||
size="base"
|
||||
color="inherit"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{`${label}`}
|
||||
</Typography>
|
||||
</div>
|
||||
</section>
|
||||
<section className="right">
|
||||
{dataType && (
|
||||
<div className="data-type">
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
@@ -77,62 +121,13 @@ function Suggestions(props: ISuggestionsProps): React.ReactElement {
|
||||
as="p"
|
||||
textOverflow="visible"
|
||||
>
|
||||
{value.dataType}
|
||||
{dataType}
|
||||
</Typography>
|
||||
</div>
|
||||
<section className={cx('type-tag', value.type)}>
|
||||
<div className="dot" />
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="small"
|
||||
weight="regular"
|
||||
color="inherit"
|
||||
as="span"
|
||||
textOverflow="visible"
|
||||
textTransform="capitalize"
|
||||
>
|
||||
{value.type}
|
||||
</Typography>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Tooltip title={label} placement="topLeft">
|
||||
<div className="container-without-tag">
|
||||
<section className="left">
|
||||
<div className="dot" />
|
||||
<div className={cx('value', option)}>
|
||||
<Typography
|
||||
{...labelTextStyle}
|
||||
size="base"
|
||||
color="inherit"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{`${label}`}
|
||||
</Typography>
|
||||
</div>
|
||||
</section>
|
||||
<section className="right">
|
||||
{dataType && (
|
||||
<div className="data-type">
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="inherit"
|
||||
as="p"
|
||||
textOverflow="visible"
|
||||
>
|
||||
{dataType}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
{tagValue.includes(label) && <Check size={14} />}
|
||||
</section>
|
||||
</div>
|
||||
</Tooltip>
|
||||
)}
|
||||
{tagValue.includes(label) && <Check size={14} />}
|
||||
</section>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useCallback } from 'react';
|
||||
import MultiSelectFilter from 'components/ListFilter/FilterZone/MultiSelectFilter';
|
||||
|
||||
import { SERVICE_ACCOUNTS_STATUS_OPTIONS } from './list.config';
|
||||
@@ -10,15 +11,34 @@ interface Props {
|
||||
setDraft: (newDraft: string) => void;
|
||||
}
|
||||
|
||||
// Picks splice into the draft and run when the dropdown closes; Clear runs at
|
||||
// once. A status term the box holds with another operator shows as nothing
|
||||
// picked.
|
||||
// Picks splice into the draft and run when the dropdown closes; a tag's × or
|
||||
// Clear runs at once. A status term the box holds with another operator shows
|
||||
// as nothing picked.
|
||||
function ServiceAccountStatusFilter({
|
||||
draft,
|
||||
disabled,
|
||||
onApplyDraft,
|
||||
setDraft,
|
||||
}: Props): JSX.Element {
|
||||
const handleChange = useCallback(
|
||||
(statuses: string[]): void => setDraft(withStatuses(draft, statuses)),
|
||||
[draft, setDraft],
|
||||
);
|
||||
|
||||
const handleCommit = useCallback(
|
||||
(statuses: string[]): void => onApplyDraft(withStatuses(draft, statuses)),
|
||||
[draft, onApplyDraft],
|
||||
);
|
||||
|
||||
const handleDropdownVisibleChange = useCallback(
|
||||
(isOpen: boolean): void => {
|
||||
if (!isOpen) {
|
||||
onApplyDraft(draft);
|
||||
}
|
||||
},
|
||||
[draft, onApplyDraft],
|
||||
);
|
||||
|
||||
return (
|
||||
<MultiSelectFilter
|
||||
value={statusesOfQuery(draft)}
|
||||
@@ -26,13 +46,9 @@ function ServiceAccountStatusFilter({
|
||||
placeholder="Status"
|
||||
testId="sa-filter-status"
|
||||
disabled={disabled}
|
||||
onChange={(statuses): void => setDraft(withStatuses(draft, statuses))}
|
||||
onClear={(): void => onApplyDraft(withStatuses(draft, []))}
|
||||
onDropdownVisibleChange={(open): void => {
|
||||
if (!open) {
|
||||
onApplyDraft(draft);
|
||||
}
|
||||
}}
|
||||
onChange={handleChange}
|
||||
onCommit={handleCommit}
|
||||
onDropdownVisibleChange={handleDropdownVisibleChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import {
|
||||
SettingsNavSection,
|
||||
SidebarItem,
|
||||
} from './sideNav.types';
|
||||
import { Style } from '@signozhq/design-tokens';
|
||||
import Noz from 'components/Noz/Noz';
|
||||
import { NOZ_TOOLTIP_TITLE } from 'components/Noz/Noz.constants';
|
||||
|
||||
@@ -523,7 +522,7 @@ export const getUserSettingsDropdownMenuItems = ({
|
||||
type: 'item',
|
||||
value: 'workspace',
|
||||
label: USER_SETTINGS_MENU_LABELS.workspace,
|
||||
prefix: <Building2 size={14} color={Style.L1_FOREGROUND} />,
|
||||
prefix: <Building2 size={14} color="var(--l1-foreground)" />,
|
||||
testId: 'workspace-settings-nav-item',
|
||||
disabled: isWorkspaceBlocked,
|
||||
disabledTooltip: WORKSPACE_LOCKED_TOOLTIP,
|
||||
@@ -533,7 +532,7 @@ export const getUserSettingsDropdownMenuItems = ({
|
||||
type: 'item',
|
||||
value: 'account',
|
||||
label: USER_SETTINGS_MENU_LABELS.account,
|
||||
prefix: <User size={14} color={Style.L1_FOREGROUND} />,
|
||||
prefix: <User size={14} color="var(--l1-foreground)" />,
|
||||
testId: 'account-settings-nav-item',
|
||||
onClick: (event): void => onSelect('account', event),
|
||||
},
|
||||
@@ -544,7 +543,7 @@ export const getUserSettingsDropdownMenuItems = ({
|
||||
type: 'item',
|
||||
value: 'license',
|
||||
label: USER_SETTINGS_MENU_LABELS.license,
|
||||
prefix: <Shield size={14} color={Style.L1_FOREGROUND} />,
|
||||
prefix: <Shield size={14} color="var(--l1-foreground)" />,
|
||||
testId: 'manage-license-nav-item',
|
||||
onClick: (event): void => onSelect('license', event),
|
||||
});
|
||||
@@ -554,7 +553,7 @@ export const getUserSettingsDropdownMenuItems = ({
|
||||
type: 'item',
|
||||
value: 'keyboard-shortcuts',
|
||||
label: USER_SETTINGS_MENU_LABELS['keyboard-shortcuts'],
|
||||
prefix: <Keyboard size={14} color={Style.L1_FOREGROUND} />,
|
||||
prefix: <Keyboard size={14} color="var(--l1-foreground)" />,
|
||||
testId: 'keyboard-shortcuts-nav-item',
|
||||
onClick: (event): void => onSelect('keyboard-shortcuts', event),
|
||||
});
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { toast } from '@signozhq/ui/toast';
|
||||
import { Form } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import { Form, FormInstance } from 'antd';
|
||||
import { useUpdateAccount } from 'api/generated/services/cloudintegration';
|
||||
import { CloudAccount } from 'container/Integrations/CloudIntegration/AmazonWebServices/types';
|
||||
import { INTEGRATION_TYPES } from 'container/Integrations/constants';
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { toast } from '@signozhq/ui/toast';
|
||||
import { Form } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import { Form, FormInstance } from 'antd';
|
||||
import { useUpdateAccount } from 'api/generated/services/cloudintegration';
|
||||
import { INTEGRATION_TYPES } from 'container/Integrations/constants';
|
||||
import { CloudAccount } from 'container/Integrations/types';
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { toast } from '@signozhq/ui/toast';
|
||||
import { Form } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import { Form, FormInstance } from 'antd';
|
||||
import { useUpdateAccount } from 'api/generated/services/cloudintegration';
|
||||
import { INTEGRATION_TYPES } from 'container/Integrations/constants';
|
||||
import { CloudAccount } from 'container/Integrations/types';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { CircleSlash2 } from '@signozhq/icons';
|
||||
|
||||
import styles from './PermissionDeniedFullPage.module.scss';
|
||||
import { Style } from '@signozhq/design-tokens';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
import { BrandedPermission } from 'lib/authz/hooks/useAuthZ/types';
|
||||
import { formatPermission } from 'lib/authz/hooks/useAuthZ/utils';
|
||||
@@ -31,7 +30,7 @@ function PermissionDeniedFullPage({
|
||||
<div className={styles.container}>
|
||||
<div className={styles.content}>
|
||||
<span className={styles.icon}>
|
||||
<CircleSlash2 color={Style.CALLOUT_ERROR_TITLE} size={14} />
|
||||
<CircleSlash2 color="var(--callout-error-title)" size={14} />
|
||||
</span>
|
||||
<p className={styles.title}>Uh-oh! You are not authorized</p>
|
||||
<p className={styles.subtitle}>
|
||||
|
||||
@@ -12,6 +12,7 @@ import { getFiltersFromKeyValue } from '../CeleryOverviewUtils';
|
||||
import OverviewRightPanelGraph from './OverviewRightPanelGraph';
|
||||
import ValueInfo from './ValueInfo';
|
||||
|
||||
import 'components/CeleryTask/CeleryTaskDetail/CeleryTaskDetail.style.scss';
|
||||
import './CeleryOverviewDetails.styles.scss';
|
||||
|
||||
export default function CeleryOverviewDetails({
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
//
|
||||
// Icons are the always-present set (shown in the picker), so we let Vite inline the
|
||||
// small ones as data URIs — they ship in the bundle and render with no network
|
||||
// call. Logos are a large, JSON-only catalogue, so `?url` keeps them as emitted
|
||||
// files fetched (and cached) on demand rather than bloating the bundle.
|
||||
// call. Logos are a large, JSON-only catalogue, so `?no-inline` keeps them as
|
||||
// emitted files fetched (and cached) on demand rather than bloating the bundle
|
||||
// (`?url` alone still inlines files under `build.assetsInlineLimit`).
|
||||
const iconModules = import.meta.glob('../../../assets/Icons/**/*.{svg,png}', {
|
||||
eager: true,
|
||||
import: 'default',
|
||||
@@ -14,7 +15,7 @@ const iconModules = import.meta.glob('../../../assets/Icons/**/*.{svg,png}', {
|
||||
|
||||
const logoModules = import.meta.glob('../../../assets/Logos/**/*.{svg,png}', {
|
||||
eager: true,
|
||||
query: '?url',
|
||||
query: '?no-inline',
|
||||
import: 'default',
|
||||
});
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import type { PageStoryArgs } from '@/storybook/runtime/resolveStory';
|
||||
import {
|
||||
currentDashboardDocument,
|
||||
cyclicVariablesDashboardResponse,
|
||||
DASHBOARD_IMAGES,
|
||||
DURATION_CHOICES,
|
||||
patchDashboardDocument,
|
||||
PANEL_IDS,
|
||||
@@ -43,6 +44,7 @@ import {
|
||||
STORY_DASHBOARD_ID,
|
||||
VARIABLE_KINDS,
|
||||
type DashboardArgs,
|
||||
type DashboardImage,
|
||||
type DurationChoice,
|
||||
type PanelId,
|
||||
type VariableKind,
|
||||
@@ -168,6 +170,13 @@ export const dashboardMocks = defineStoryMocks({
|
||||
options: DURATION_CHOICES,
|
||||
value: 'unset',
|
||||
}),
|
||||
image: choiceControl<DashboardImage>('Image', {
|
||||
group: LAYOUT,
|
||||
description:
|
||||
"The dashboard's `image`, shown beside its name in the header and in the settings icon picker: a bundled icon or a logo, which dashboard JSON can reference but the picker does not offer.",
|
||||
options: DASHBOARD_IMAGES,
|
||||
value: '/assets/Icons/circus-tent',
|
||||
}),
|
||||
variableValues: countControl('Variable options', {
|
||||
group: DATA,
|
||||
description: 'Values the query-backed `service` variable resolves to.',
|
||||
@@ -244,6 +253,7 @@ export const dashboardMocks = defineStoryMocks({
|
||||
variables: values.variables,
|
||||
locked: values.locked,
|
||||
duration: values.duration,
|
||||
image: values.image,
|
||||
};
|
||||
|
||||
return [
|
||||
@@ -384,6 +394,7 @@ export const dashboardMocks = defineStoryMocks({
|
||||
variables: values.variables,
|
||||
locked: values.locked,
|
||||
duration: values.duration,
|
||||
image: values.image,
|
||||
});
|
||||
// The sync mode persists per dashboard, so one story's pick would open the
|
||||
// next one on it.
|
||||
|
||||
@@ -120,6 +120,11 @@ export const DefaultTimeRange: Story = {
|
||||
args: { duration: '6h' },
|
||||
};
|
||||
|
||||
/** A dashboard whose image is a bundled logo, beside its name in the header. */
|
||||
export const Logo: Story = {
|
||||
args: { image: '/assets/Logos/kubernetes' },
|
||||
};
|
||||
|
||||
/** The panels mid-fetch, with the header, variable bar and grid already laid out. */
|
||||
export const Loading: Story = {
|
||||
args: { dataState: 'loading' },
|
||||
|
||||
@@ -360,6 +360,16 @@ export const DURATION_CHOICES = ['unset', '6h', '90m', '1s', '0m'] as const;
|
||||
|
||||
export type DurationChoice = (typeof DURATION_CHOICES)[number];
|
||||
|
||||
/** The default icon, then logos either side of the 4 KB asset inline limit, one a PNG. */
|
||||
export const DASHBOARD_IMAGES = [
|
||||
'/assets/Icons/circus-tent',
|
||||
'/assets/Logos/kubernetes',
|
||||
'/assets/Logos/nginx',
|
||||
'/assets/Logos/rails',
|
||||
] as const;
|
||||
|
||||
export type DashboardImage = (typeof DASHBOARD_IMAGES)[number];
|
||||
|
||||
export interface PanelQueryShape {
|
||||
requestType: string;
|
||||
metricName?: string;
|
||||
@@ -393,6 +403,7 @@ export interface DashboardArgs {
|
||||
variables: readonly VariableKind[];
|
||||
locked: boolean;
|
||||
duration?: DurationChoice;
|
||||
image?: DashboardImage;
|
||||
}
|
||||
|
||||
export const dashboardResponse = ({
|
||||
@@ -401,6 +412,7 @@ export const dashboardResponse = ({
|
||||
variables,
|
||||
locked,
|
||||
duration,
|
||||
image = '/assets/Icons/circus-tent',
|
||||
}: DashboardArgs): GetDashboardV2200 => {
|
||||
const kept = PANEL_IDS.slice(0, panels);
|
||||
|
||||
@@ -420,7 +432,7 @@ export const dashboardResponse = ({
|
||||
id: STORY_DASHBOARD_ID,
|
||||
orgId: 'storybook-org',
|
||||
name: 'Checkout service overview',
|
||||
image: '/assets/Icons/circus-tent',
|
||||
image,
|
||||
schemaVersion: 'v6',
|
||||
source: DashboardtypesSourceDTO.user,
|
||||
locked,
|
||||
|
||||
@@ -52,6 +52,15 @@ export const Overview: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* A dashboard whose image is a logo: the picker keeps it as the selected first
|
||||
* option, ahead of the icons it offers.
|
||||
*/
|
||||
export const OverviewLogo: Story = {
|
||||
...Overview,
|
||||
args: { image: '/assets/Logos/rails' },
|
||||
};
|
||||
|
||||
/** Two fields edited, so the footer counts them and offers to save or discard. */
|
||||
export const OverviewUnsavedChanges: Story = {
|
||||
play: async ({ canvasElement }) => {
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
DashboardtypesListSortDTO,
|
||||
type GetDashboardV2200,
|
||||
} from 'api/generated/services/sigNoz.schemas';
|
||||
import { parseReflectedClauses } from 'components/ListFilter/dsl/filterQuery';
|
||||
import ROUTES from 'constants/routes';
|
||||
import {
|
||||
buildDashboardDeletePermission,
|
||||
@@ -53,6 +54,7 @@ import {
|
||||
dashboardsListResponse,
|
||||
PIN_WRITES,
|
||||
recentDashboardIds,
|
||||
ROW_IMAGES,
|
||||
ROW_MARKERS,
|
||||
savedView,
|
||||
seedPinnedDashboards,
|
||||
@@ -61,6 +63,7 @@ import {
|
||||
TOOLTIP_TAGS,
|
||||
WRITE_STATES,
|
||||
type PinWrite,
|
||||
type RowImages,
|
||||
type RowMarker,
|
||||
type TemplateRequest,
|
||||
type WriteState,
|
||||
@@ -256,6 +259,13 @@ export const dashboardsListMocks = defineStoryMocks({
|
||||
options: ROW_MARKERS,
|
||||
value: [...ROW_MARKERS],
|
||||
}),
|
||||
images: choiceControl<RowImages>('Row images', {
|
||||
group: LIST,
|
||||
description:
|
||||
'What each row shows beside its name: a bundled icon, or a bundled logo, which dashboard JSON can reference but the icon picker does not offer.',
|
||||
options: ROW_IMAGES,
|
||||
value: 'icons',
|
||||
}),
|
||||
columns: multiChoiceControl<DetailColumn>('Detail columns', {
|
||||
group: LIST,
|
||||
description: 'The optional fields on each row’s second line.',
|
||||
@@ -353,6 +363,7 @@ export const dashboardsListMocks = defineStoryMocks({
|
||||
limit: Number(req.url.searchParams.get('limit') ?? 20),
|
||||
markers: values.markers,
|
||||
query: req.url.searchParams.get('query') ?? '',
|
||||
images: values.images,
|
||||
}),
|
||||
),
|
||||
),
|
||||
@@ -592,6 +603,7 @@ export const listedDashboards = (
|
||||
new URL(listRoute(args.view), 'http://localhost').searchParams.get(
|
||||
'query',
|
||||
) ?? '',
|
||||
images: args.images,
|
||||
}).data.dashboards;
|
||||
|
||||
return view?.clientFilter
|
||||
@@ -602,6 +614,13 @@ export const listedDashboards = (
|
||||
: rows;
|
||||
};
|
||||
|
||||
/** The view's own filter picks creators, so the Created-by chip opens with a tag. */
|
||||
export const showsCreatedByTag = (args: DashboardsListArgs): boolean =>
|
||||
parseReflectedClauses(
|
||||
new URL(listRoute(args.view), 'http://localhost').searchParams.get('query') ??
|
||||
'',
|
||||
).createdBy.length > 0;
|
||||
|
||||
export const showsWorkspaceEmpty = (args: DashboardsListArgs): boolean =>
|
||||
args.view === DEFAULT_DASHBOARD_VIEW &&
|
||||
args.dataState === 'loaded' &&
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
openTemplateTab,
|
||||
pinDashboard,
|
||||
renameDashboard,
|
||||
removeCreatedByTag,
|
||||
renameView,
|
||||
saveView,
|
||||
submitTemplateRequest,
|
||||
@@ -85,6 +86,11 @@ export const Viewer: Story = {
|
||||
args: { access: 'viewer' },
|
||||
};
|
||||
|
||||
/** Rows whose images are bundled logos rather than icons. */
|
||||
export const Logos: Story = {
|
||||
args: { images: 'logos' },
|
||||
};
|
||||
|
||||
/** The rows the user pinned, which the page filters out of the fetched page. */
|
||||
export const Pinned: Story = {
|
||||
args: { view: 'pinned' },
|
||||
@@ -100,6 +106,12 @@ export const CreatedByFilterOpen: Story = {
|
||||
play: openCreatedByFilter,
|
||||
};
|
||||
|
||||
/** My dashboards with its creator tag removed by its ×: the list runs unfiltered. */
|
||||
export const CreatedByTagRemoved: Story = {
|
||||
args: { view: 'mine' },
|
||||
play: removeCreatedByTag,
|
||||
};
|
||||
|
||||
/** The template tab of the New dashboard dialog. */
|
||||
export const NewDashboardTemplateTab: Story = {
|
||||
play: openTemplateTab,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Do not hand-edit: regenerate instead.
|
||||
*/
|
||||
|
||||
import { expect, screen, userEvent, within } from 'storybook/test';
|
||||
import { expect, screen, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { isCloudShell } from '@/storybook/globals/appShellMocks';
|
||||
import { findMonacoEditor } from '@/storybook/play/monacoEditor';
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
pickRowAction,
|
||||
requestTemplate,
|
||||
retryMigration,
|
||||
showsCreatedByTag,
|
||||
showsWorkspaceEmpty,
|
||||
TOAST_TIMEOUT,
|
||||
uploadDashboardJson,
|
||||
@@ -81,6 +82,38 @@ export const openCreatedByFilter = async ({
|
||||
await screen.findAllByRole('checkbox', { checked: true });
|
||||
};
|
||||
|
||||
// antd renders a tag's × aria-hidden.
|
||||
const tagRemove = { name: 'close', hidden: true } as const;
|
||||
|
||||
export const removeCreatedByTag = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
if (
|
||||
!canList(args) ||
|
||||
args.dataState !== 'loaded' ||
|
||||
showsWorkspaceEmpty(args) ||
|
||||
!showsCreatedByTag(args)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const filter = await within(canvasElement).findByTestId(
|
||||
'dashboards-filter-created-by',
|
||||
{},
|
||||
{ timeout: TOAST_TIMEOUT },
|
||||
);
|
||||
|
||||
await userEvent.click(
|
||||
await within(filter).findByRole('img', tagRemove, {
|
||||
timeout: TOAST_TIMEOUT,
|
||||
}),
|
||||
);
|
||||
await waitFor(() =>
|
||||
expect(within(filter).queryByRole('img', tagRemove)).not.toBeInTheDocument(),
|
||||
);
|
||||
};
|
||||
|
||||
export const openTemplateTab = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
|
||||
@@ -28,6 +28,7 @@ const tag = (key: string, value: string): TagtypesGettableTagDTO => ({
|
||||
interface DashboardSeed {
|
||||
name: string;
|
||||
icon: string;
|
||||
logo: string;
|
||||
tags: TagtypesGettableTagDTO[];
|
||||
locked?: boolean;
|
||||
}
|
||||
@@ -36,67 +37,84 @@ const SEEDS: DashboardSeed[] = [
|
||||
{
|
||||
name: 'Kubernetes cluster health',
|
||||
icon: 'circus-tent',
|
||||
logo: 'kubernetes',
|
||||
tags: [tag('env', 'prod'), tag('team', 'platform')],
|
||||
locked: true,
|
||||
},
|
||||
{
|
||||
name: 'API latency and errors',
|
||||
icon: 'siren',
|
||||
logo: 'api-gateway',
|
||||
tags: [tag('env', 'prod'), tag('team', 'api')],
|
||||
},
|
||||
{
|
||||
name: 'Checkout funnel',
|
||||
icon: 'bagel',
|
||||
logo: 'rails',
|
||||
tags: [tag('team', 'growth')],
|
||||
},
|
||||
{
|
||||
name: 'Postgres connections',
|
||||
icon: 'cheese',
|
||||
logo: 'postgresql',
|
||||
tags: [tag('env', 'prod'), tag('component', 'database')],
|
||||
},
|
||||
{
|
||||
name: 'Kafka consumer lag',
|
||||
icon: 'drum',
|
||||
logo: 'kafka',
|
||||
tags: [tag('team', 'platform'), tag('component', 'kafka')],
|
||||
},
|
||||
{
|
||||
name: 'Nginx ingress overview',
|
||||
icon: 'crane',
|
||||
logo: 'nginx',
|
||||
tags: [tag('env', 'staging')],
|
||||
},
|
||||
{
|
||||
name: 'Billing jobs',
|
||||
icon: 'dartboard',
|
||||
logo: 'celery',
|
||||
tags: [tag('team', 'billing')],
|
||||
locked: true,
|
||||
},
|
||||
{
|
||||
name: 'Frontend web vitals',
|
||||
icon: 'basketball',
|
||||
logo: 'reactjs',
|
||||
tags: [tag('team', 'frontend')],
|
||||
},
|
||||
{
|
||||
name: 'Redis cache hit ratio',
|
||||
icon: 'cookie',
|
||||
logo: 'redis',
|
||||
tags: [tag('component', 'redis')],
|
||||
},
|
||||
{
|
||||
name: 'Collector pipeline throughput',
|
||||
icon: 'motorcycle',
|
||||
logo: 'opentelemetry',
|
||||
tags: [tag('env', 'prod'), tag('component', 'otel')],
|
||||
},
|
||||
{
|
||||
name: 'On-call triage board',
|
||||
icon: 'police-car',
|
||||
logo: 'prometheus',
|
||||
tags: [tag('team', 'sre')],
|
||||
},
|
||||
{
|
||||
name: 'Cost per service',
|
||||
icon: 'orange',
|
||||
logo: 'cloudwatch',
|
||||
tags: [tag('team', 'finops')],
|
||||
},
|
||||
];
|
||||
|
||||
/** Whether rows show a bundled icon or a bundled logo. */
|
||||
export const ROW_IMAGES = ['icons', 'logos'] as const;
|
||||
|
||||
export type RowImages = (typeof ROW_IMAGES)[number];
|
||||
|
||||
/** Row markers a story can put on the list, each landing on a slice of the rows. */
|
||||
export const ROW_MARKERS = ['pinned', 'locked', 'legacy'] as const;
|
||||
|
||||
@@ -141,6 +159,7 @@ interface ListArgs {
|
||||
limit: number;
|
||||
markers: readonly RowMarker[];
|
||||
query: string;
|
||||
images?: RowImages;
|
||||
}
|
||||
|
||||
const seedAt = (index: number): DashboardSeed => SEEDS[index % SEEDS.length];
|
||||
@@ -155,6 +174,7 @@ const nameAt = (index: number): string => {
|
||||
const dashboardAt = (
|
||||
index: number,
|
||||
markers: readonly RowMarker[],
|
||||
images: RowImages,
|
||||
): DashboardtypesListedDashboardForUserV2DTO => {
|
||||
const seed = seedAt(index);
|
||||
const name = nameAt(index);
|
||||
@@ -165,7 +185,10 @@ const dashboardAt = (
|
||||
orgId: 'storybook-org',
|
||||
name,
|
||||
spec: { display: { name } },
|
||||
image: `/assets/Icons/${seed.icon}`,
|
||||
image:
|
||||
images === 'logos'
|
||||
? `/assets/Logos/${seed.logo}`
|
||||
: `/assets/Icons/${seed.icon}`,
|
||||
schemaVersion: 'v2',
|
||||
source: DashboardtypesSourceDTO.user,
|
||||
pinned: pinned.has(dashboardIdAt(index)),
|
||||
@@ -236,9 +259,10 @@ export const dashboardsListResponse = ({
|
||||
limit,
|
||||
markers,
|
||||
query,
|
||||
images = 'icons',
|
||||
}: ListArgs): ListDashboardsForUserV2200 => {
|
||||
const all = Array.from({ length: count }, (_, index) =>
|
||||
dashboardAt(index, markers),
|
||||
dashboardAt(index, markers, images),
|
||||
);
|
||||
const matched = query ? all.filter((d) => matchesQuery(d, query)) : all;
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
import ROUTES from 'constants/routes';
|
||||
import { screen, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { storyMocks } from '@/storybook/controls/defineStoryMocks';
|
||||
import type { PageStoryArgs } from '@/storybook/runtime/resolveStory';
|
||||
import { homeMocks } from './HomePage.stories.mocks';
|
||||
import { openCommandPalette } from './__story_mockdata__/home.play';
|
||||
import {
|
||||
openCommandPalette,
|
||||
openNavHelpMenu,
|
||||
openNavSettingsMenu,
|
||||
} from './__story_mockdata__/home.play';
|
||||
|
||||
import HomePage from '../HomePage';
|
||||
|
||||
@@ -70,16 +73,7 @@ export const Loading: Story = {
|
||||
* this menu is the same on every page; Home is where it is shot.
|
||||
*/
|
||||
export const NavHelpMenu: Story = {
|
||||
play: async ({ canvasElement }): Promise<void> => {
|
||||
await userEvent.click(
|
||||
await within(canvasElement).findByTestId(
|
||||
'help-support-nav-item',
|
||||
{},
|
||||
{ timeout: 10000 },
|
||||
),
|
||||
);
|
||||
await screen.findByRole('menu');
|
||||
},
|
||||
play: openNavHelpMenu,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -87,16 +81,16 @@ export const NavHelpMenu: Story = {
|
||||
* reaches without leaving the page.
|
||||
*/
|
||||
export const NavSettingsMenu: Story = {
|
||||
play: async ({ canvasElement }): Promise<void> => {
|
||||
await userEvent.click(
|
||||
await within(canvasElement).findByTestId(
|
||||
'settings-nav-item',
|
||||
{},
|
||||
{ timeout: 10000 },
|
||||
),
|
||||
);
|
||||
await screen.findByRole('menu');
|
||||
},
|
||||
play: openNavSettingsMenu,
|
||||
};
|
||||
|
||||
/**
|
||||
* The sidebar's Settings menu on a self-hosted enterprise license, which adds
|
||||
* Manage License between the account and shortcut entries.
|
||||
*/
|
||||
export const NavSettingsMenuSelfHosted: Story = {
|
||||
args: { license: 'enterprise' },
|
||||
play: openNavSettingsMenu,
|
||||
};
|
||||
|
||||
/** The command palette, opened with the same shortcut the shell listens for. */
|
||||
|
||||
@@ -3,14 +3,37 @@
|
||||
* Do not hand-edit: regenerate instead.
|
||||
*/
|
||||
|
||||
import { screen, userEvent } from 'storybook/test';
|
||||
import { screen, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { type HomeArgs, paletteListsHome } from '../HomePage.stories.mocks';
|
||||
|
||||
interface PlayContext {
|
||||
canvasElement: HTMLElement;
|
||||
args: HomeArgs;
|
||||
}
|
||||
|
||||
const openNavMenu = async (
|
||||
canvasElement: HTMLElement,
|
||||
testId: string,
|
||||
): Promise<void> => {
|
||||
await userEvent.click(
|
||||
await within(canvasElement).findByTestId(testId, {}, { timeout: 10000 }),
|
||||
);
|
||||
await screen.findByRole('menu');
|
||||
};
|
||||
|
||||
export const openNavHelpMenu = async ({
|
||||
canvasElement,
|
||||
}: PlayContext): Promise<void> => {
|
||||
await openNavMenu(canvasElement, 'help-support-nav-item');
|
||||
};
|
||||
|
||||
export const openNavSettingsMenu = async ({
|
||||
canvasElement,
|
||||
}: PlayContext): Promise<void> => {
|
||||
await openNavMenu(canvasElement, 'settings-nav-item');
|
||||
};
|
||||
|
||||
export const openCommandPalette = async ({
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
|
||||
@@ -23,7 +23,10 @@ import {
|
||||
updateTaggedAccount,
|
||||
} from './CloudIntegration.stories.mocks';
|
||||
import {
|
||||
openAccountSelect,
|
||||
openAccountSettings,
|
||||
openConnectDialog,
|
||||
openDisconnectConfirm,
|
||||
openGcpRegionDropdown,
|
||||
} from './__story_mockdata__/cloudIntegration.play';
|
||||
|
||||
@@ -86,6 +89,17 @@ export const GoogleCloudPlatform: Story = {
|
||||
args: { provider: 'gcp' },
|
||||
};
|
||||
|
||||
/** The page while the account list is loading, the account picker a skeleton. */
|
||||
export const Loading: Story = {
|
||||
args: { dataState: 'loading' },
|
||||
};
|
||||
|
||||
/** The account picker open over two connected accounts. */
|
||||
export const AccountSelectOpen: Story = {
|
||||
args: { accounts: 2 },
|
||||
play: openAccountSelect,
|
||||
};
|
||||
|
||||
/** Every log attribute and metric a service collects, as the agent names them. */
|
||||
export const DataCollected: Story = {
|
||||
play: async ({ canvasElement }): Promise<void> => {
|
||||
@@ -129,16 +143,27 @@ export const AzureConnectAccount: Story = {
|
||||
|
||||
/** The regions an already-connected account collects from. */
|
||||
export const EditAccount: Story = {
|
||||
play: async ({ canvasElement }): Promise<void> => {
|
||||
await userEvent.click(
|
||||
await within(canvasElement).findByText(
|
||||
/edit account/i,
|
||||
undefined,
|
||||
untilLoaded,
|
||||
),
|
||||
);
|
||||
await screen.findByRole('dialog', undefined, untilLoaded);
|
||||
},
|
||||
play: openAccountSettings,
|
||||
};
|
||||
|
||||
/** The resource groups an already-connected Azure subscription collects from. */
|
||||
export const AzureEditAccount: Story = {
|
||||
args: { provider: 'azure' },
|
||||
play: openAccountSettings,
|
||||
};
|
||||
|
||||
/** The projects an already-connected GCP account collects from. */
|
||||
export const GcpEditAccount: Story = {
|
||||
args: { provider: 'gcp' },
|
||||
play: openAccountSettings,
|
||||
};
|
||||
|
||||
/**
|
||||
* Disconnecting an account, which asks first and names what is removed from the
|
||||
* cloud account and what is left to delete by hand.
|
||||
*/
|
||||
export const DisconnectConfirm: Story = {
|
||||
play: openDisconnectConfirm,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
type CloudIntegrationArgs,
|
||||
offersIntegrateNow,
|
||||
openConnectFlow,
|
||||
openEditAccount,
|
||||
untilLoaded,
|
||||
} from '../CloudIntegration.stories.mocks';
|
||||
|
||||
@@ -17,6 +18,16 @@ interface PlayContext {
|
||||
args: CloudIntegrationArgs;
|
||||
}
|
||||
|
||||
/** The hero shows the account picker and Edit Account only once accounts have answered. */
|
||||
const offersAccountActions = (args: CloudIntegrationArgs): boolean =>
|
||||
args.dataState === 'loaded' && args.accounts > 0;
|
||||
|
||||
const blurActiveElement = (): void => {
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
};
|
||||
|
||||
export const openConnectDialog = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
@@ -48,3 +59,49 @@ export const openGcpRegionDropdown = async ({
|
||||
);
|
||||
await screen.findByRole('listbox');
|
||||
};
|
||||
|
||||
export const openAccountSelect = async ({
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
if (!offersAccountActions(args)) {
|
||||
return;
|
||||
}
|
||||
await userEvent.click(
|
||||
await screen.findByRole('combobox', { name: 'Cloud account' }, untilLoaded),
|
||||
);
|
||||
await screen.findByRole('listbox');
|
||||
};
|
||||
|
||||
export const openAccountSettings = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
if (!offersAccountActions(args)) {
|
||||
return;
|
||||
}
|
||||
await openEditAccount(canvasElement);
|
||||
blurActiveElement();
|
||||
};
|
||||
|
||||
export const openDisconnectConfirm = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
if (!offersAccountActions(args)) {
|
||||
return;
|
||||
}
|
||||
await openEditAccount(canvasElement);
|
||||
await userEvent.click(
|
||||
await screen.findByTestId(
|
||||
'cloud-disconnect-account-btn',
|
||||
undefined,
|
||||
untilLoaded,
|
||||
),
|
||||
);
|
||||
await screen.findByTestId(
|
||||
'cloud-remove-account-confirm',
|
||||
undefined,
|
||||
untilLoaded,
|
||||
);
|
||||
blurActiveElement();
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ import { storyMocks } from '@/storybook/controls/defineStoryMocks';
|
||||
import { type PipelinesArgs, pipelinesMocks } from './Pipelines.stories.mocks';
|
||||
import {
|
||||
expandProcessors,
|
||||
hoverPipelineFilterSuggestions,
|
||||
openAddPipeline,
|
||||
openAddProcessor,
|
||||
openChangeHistory,
|
||||
@@ -75,6 +76,11 @@ export const AddPipelineFilterValues: Story = {
|
||||
play: suggestPipelineFilterValues,
|
||||
};
|
||||
|
||||
/** The filter's suggestions hovered: a key that fits has no tooltip, a route cut short shows in full once. */
|
||||
export const AddPipelineFilterHover: Story = {
|
||||
play: hoverPipelineFilterSuggestions,
|
||||
};
|
||||
|
||||
/** The same form over an existing pipeline, filter included. */
|
||||
export const EditPipeline: Story = {
|
||||
play: openEditPipeline,
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
* Do not hand-edit: regenerate instead.
|
||||
*/
|
||||
|
||||
import { screen, userEvent, within } from 'storybook/test';
|
||||
import { expect, screen, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { hoverTruncatableText } from '@/storybook/play/truncatedText';
|
||||
|
||||
import { LONG_HTTP_ROUTE } from '../../../stories/__story_mockdata__/logs';
|
||||
|
||||
import type { PipelinesArgs } from '../Pipelines.stories.mocks';
|
||||
|
||||
@@ -144,6 +148,42 @@ export const suggestPipelineFilterValues = async ({
|
||||
await screen.findAllByText('checkout', undefined, untilLoaded);
|
||||
};
|
||||
|
||||
/** The pipeline list behind the form can show the same text, so look only in the open list. */
|
||||
const findSuggestion = (text: string): Promise<HTMLElement> =>
|
||||
waitFor(async () => {
|
||||
const match = Array.from(
|
||||
document.querySelectorAll<HTMLElement>(
|
||||
'.ant-select-dropdown:not(.ant-select-dropdown-hidden) .option p',
|
||||
),
|
||||
).find((element) => element.textContent === text);
|
||||
|
||||
await expect(match).toBeTruthy();
|
||||
|
||||
return match as HTMLElement;
|
||||
}, untilLoaded);
|
||||
|
||||
export const hoverPipelineFilterSuggestions = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
if (!listsPipelines(args)) {
|
||||
return;
|
||||
}
|
||||
|
||||
await openNewPipelineForm(canvasElement);
|
||||
const input = await focusPipelineFilter();
|
||||
await hoverTruncatableText(await findSuggestion('http.route'), 'http.route', {
|
||||
cut: false,
|
||||
});
|
||||
|
||||
await userEvent.type(input, 'http.route = ');
|
||||
await hoverTruncatableText(
|
||||
await findSuggestion(LONG_HTTP_ROUTE),
|
||||
LONG_HTTP_ROUTE,
|
||||
{ cut: true },
|
||||
);
|
||||
};
|
||||
|
||||
export const openEditPipeline = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
|
||||
@@ -445,6 +445,10 @@ export const logFieldKeysResponse = (
|
||||
};
|
||||
};
|
||||
|
||||
/** A route longer than the query builder's suggestion list is wide. */
|
||||
export const LONG_HTTP_ROUTE =
|
||||
'/api/v1/checkout/orders/{order_id}/payments/{payment_id}/authorisations/{authorisation_id}/retries/{retry_id}/events/{event_id}/acknowledgements/{acknowledgement_id}';
|
||||
|
||||
/** Keyed by the fields the quick filters and the query builder ask about. */
|
||||
const STRING_VALUES: Record<string, string[]> = {
|
||||
severity_text: [...LOG_SEVERITIES],
|
||||
@@ -459,7 +463,12 @@ const STRING_VALUES: Record<string, string[]> = {
|
||||
'host.name': ['ip-10-0-1-14', 'ip-10-0-2-31'],
|
||||
'os.description': ['Linux 6.8.0 x86_64', 'Darwin 23.5.0 arm64'],
|
||||
'process.owner': ['root', 'app'],
|
||||
'http.route': ['/api/v1/checkout', '/api/v1/cart', '/api/v1/auth/token'],
|
||||
'http.route': [
|
||||
'/api/v1/checkout',
|
||||
'/api/v1/cart',
|
||||
'/api/v1/auth/token',
|
||||
LONG_HTTP_ROUTE,
|
||||
],
|
||||
'body.level': LOG_SEVERITIES.map((severity) => severity.toLowerCase()),
|
||||
'body.service': SERVICES,
|
||||
'body.http.method': ['POST', 'GET', 'DELETE'],
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
import Loadable from 'components/Loadable';
|
||||
import RouteTab from 'components/RouteTab';
|
||||
import { TabRoutes } from 'components/RouteTab/types';
|
||||
import ROUTES from 'constants/routes';
|
||||
import { useAppLocation } from 'lib/router/useAppLocation';
|
||||
import { ListMinus, Rows3 } from '@signozhq/icons';
|
||||
import CeleryOverview from 'pages/Celery/CeleryOverview/CeleryOverview';
|
||||
|
||||
import CeleryTask from '../Celery/CeleryTask/CeleryTask';
|
||||
import MessagingQueues from './MessagingQueues';
|
||||
import MQDetailPage from './MQDetailPage/MQDetailPage';
|
||||
|
||||
import './MessagingQueuesMainPage.styles.scss';
|
||||
|
||||
const MessagingQueues = Loadable(() => import('./MessagingQueues'));
|
||||
|
||||
const MQDetailPage = Loadable(() => import('./MQDetailPage/MQDetailPage'));
|
||||
|
||||
const CeleryTask = Loadable(() => import('../Celery/CeleryTask/CeleryTask'));
|
||||
|
||||
const CeleryOverview = Loadable(
|
||||
() => import('pages/Celery/CeleryOverview/CeleryOverview'),
|
||||
);
|
||||
|
||||
export const Kafka: TabRoutes = {
|
||||
Component: MessagingQueues,
|
||||
name: (
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import Loadable from 'components/Loadable';
|
||||
import { TabRoutes } from 'components/RouteTab/types';
|
||||
import ROUTES from 'constants/routes';
|
||||
import BreakDownPage from 'container/MeterExplorer/Breakdown/BreakDown';
|
||||
import ExplorerPage from 'container/MeterExplorer/Explorer';
|
||||
import { Compass, TowerControl } from '@signozhq/icons';
|
||||
|
||||
const ExplorerPage = Loadable(() => import('container/MeterExplorer/Explorer'));
|
||||
|
||||
const BreakDownPage = Loadable(
|
||||
() => import('container/MeterExplorer/Breakdown/BreakDown'),
|
||||
);
|
||||
|
||||
export const Explorer: TabRoutes = {
|
||||
Component: (): JSX.Element => <ExplorerPage />,
|
||||
Component: ExplorerPage,
|
||||
name: (
|
||||
<div className="tab-item">
|
||||
<Compass size={16} /> Explorer
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
import Loadable from 'components/Loadable';
|
||||
import { TabRoutes } from 'components/RouteTab/types';
|
||||
import ROUTES from 'constants/routes';
|
||||
import ExplorerPage from 'container/MetricsExplorer/Explorer';
|
||||
import SummaryPage from 'container/MetricsExplorer/Summary';
|
||||
import VolumeControlTab from 'container/MetricsExplorer/VolumeControl/components/VolumeControlTab/VolumeControlTab';
|
||||
import { BarChart, Compass, Gauge } from '@signozhq/icons';
|
||||
|
||||
const SummaryPage = Loadable(() => import('container/MetricsExplorer/Summary'));
|
||||
|
||||
const ExplorerPage = Loadable(
|
||||
() => import('container/MetricsExplorer/Explorer'),
|
||||
);
|
||||
|
||||
const VolumeControlTab = Loadable(
|
||||
() =>
|
||||
import('container/MetricsExplorer/VolumeControl/components/VolumeControlTab/VolumeControlTab'),
|
||||
);
|
||||
|
||||
export const Summary: TabRoutes = {
|
||||
Component: SummaryPage,
|
||||
name: (
|
||||
@@ -17,7 +26,7 @@ export const Summary: TabRoutes = {
|
||||
};
|
||||
|
||||
export const Explorer: TabRoutes = {
|
||||
Component: (): JSX.Element => <ExplorerPage />,
|
||||
Component: ExplorerPage,
|
||||
name: (
|
||||
<div className="tab-item">
|
||||
<Compass size={16} /> Explorer
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
keyUpdatedToast,
|
||||
openSearchSuggestions,
|
||||
openStatusChip,
|
||||
removeStatusTag,
|
||||
saveFailed,
|
||||
} from './__story_mockdata__/serviceAccounts.play';
|
||||
import {
|
||||
@@ -116,6 +117,14 @@ export const StatusChipOpen: Story = {
|
||||
play: openStatusChip,
|
||||
};
|
||||
|
||||
/** Deleted only, with its status tag removed by its ×: the list runs unfiltered. */
|
||||
export const StatusTagRemoved: Story = {
|
||||
parameters: at(
|
||||
`search=${encodeURIComponent(where('status', '=', 'deleted'))}`,
|
||||
),
|
||||
play: removeStatusTag,
|
||||
};
|
||||
|
||||
/** Empty: a search that matches no account keeps the list shell and empty state. */
|
||||
export const SearchNoResults: Story = {
|
||||
parameters: at('search=no-such-service-account'),
|
||||
|
||||
@@ -46,6 +46,20 @@ export const openStatusChip = async (): Promise<void> => {
|
||||
await screen.findByTitle('Deleted', undefined, untilLoaded);
|
||||
};
|
||||
|
||||
// antd renders a tag's × aria-hidden.
|
||||
const tagRemove = { name: 'close', hidden: true } as const;
|
||||
|
||||
export const removeStatusTag = async (): Promise<void> => {
|
||||
await editableSearch();
|
||||
const filter = screen.getByTestId('sa-filter-status');
|
||||
await userEvent.click(
|
||||
await within(filter).findByRole('img', tagRemove, untilLoaded),
|
||||
);
|
||||
await waitFor(() =>
|
||||
expect(within(filter).queryByRole('img', tagRemove)).not.toBeInTheDocument(),
|
||||
);
|
||||
};
|
||||
|
||||
export const openSearchSuggestions = async (): Promise<void> => {
|
||||
await userEvent.click(await editableSearch());
|
||||
await screen.findByText('status', undefined, untilLoaded);
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
deleteDomain,
|
||||
expandAttributeMapping,
|
||||
expandRoleMappings,
|
||||
expandWorkspaceGroups,
|
||||
expectViewerAccess,
|
||||
openAddDomain,
|
||||
openConfigureDomain,
|
||||
@@ -105,6 +106,15 @@ export const ClaimMappingExpanded: Story = {
|
||||
play: expandAttributeMapping,
|
||||
};
|
||||
|
||||
/**
|
||||
* Interaction: the Google form with its Workspace groups open, group fetching on
|
||||
* and the allowed groups listed.
|
||||
*/
|
||||
export const WorkspaceGroupsExpanded: Story = {
|
||||
args: { provider: 'google' },
|
||||
play: expandWorkspaceGroups,
|
||||
};
|
||||
|
||||
/** Validation: submitting a new provider without required fields leaves form errors visible. */
|
||||
export const CreateDomainValidation: Story = {
|
||||
play: submitEmptyProvider,
|
||||
|
||||
@@ -110,6 +110,25 @@ export const expandAttributeMapping = async (
|
||||
);
|
||||
};
|
||||
|
||||
export const expandWorkspaceGroups = async (
|
||||
context: PlayContext,
|
||||
): Promise<void> => {
|
||||
if (!listsDomains(context.args)) {
|
||||
return;
|
||||
}
|
||||
await openConfigureDomain(context);
|
||||
if (context.args.provider !== 'google') {
|
||||
return;
|
||||
}
|
||||
|
||||
await userEvent.click(
|
||||
screen.getByTestId('google-auth-workspace-groups-header'),
|
||||
);
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('google-auth-allowed-groups')).toBeVisible(),
|
||||
);
|
||||
};
|
||||
|
||||
export const submitEmptyProvider = async (
|
||||
context: PlayContext,
|
||||
): Promise<void> => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Popover, Tooltip } from 'antd';
|
||||
import { Popover } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { Fullscreen } from '@signozhq/icons';
|
||||
|
||||
@@ -35,18 +35,16 @@ function AttributeWithExpandablePopover({
|
||||
|
||||
return (
|
||||
<div className={styles.attributeContainer} key={attributeKey}>
|
||||
<Tooltip title={attributeKey}>
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="secondary"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{attributeKey}
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="secondary"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{attributeKey}
|
||||
</Typography>
|
||||
|
||||
<div className={styles.wrapper}>
|
||||
<Popover content={popoverContent} trigger="hover" placement="topRight">
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Tooltip } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
|
||||
import styles from '../Events.module.scss';
|
||||
@@ -35,31 +34,27 @@ function EventAttribute({
|
||||
|
||||
return (
|
||||
<div className={styles.attributeContainer} key={attributeKey}>
|
||||
<Tooltip title={attributeKey}>
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="secondary"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{attributeKey}
|
||||
</Typography>
|
||||
<div className={styles.wrapper}>
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="secondary"
|
||||
color="main"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{attributeKey}
|
||||
{attributeValue}
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
<div className={styles.wrapper}>
|
||||
<Tooltip title={attributeValue}>
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="main"
|
||||
as="p"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{attributeValue}
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
expandFilterBar,
|
||||
hoverAiSpan,
|
||||
hoverEventStacktrace,
|
||||
hoverLongEventAttributes,
|
||||
openAddSpanToFunnel,
|
||||
openAnalytics,
|
||||
openCreateFunnelStep,
|
||||
@@ -205,6 +206,11 @@ export const SpanPanelEventAttributePopover: Story = {
|
||||
play: hoverEventStacktrace,
|
||||
};
|
||||
|
||||
/** The Events tab hovered: a key that fits has no tooltip, attributes cut short show in full once. */
|
||||
export const SpanPanelEventLongAttributes: Story = {
|
||||
play: hoverLongEventAttributes,
|
||||
};
|
||||
|
||||
/** The analytics panel the header toggle opens. */
|
||||
export const AnalyticsOpen: Story = {
|
||||
play: openAnalytics,
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from 'storybook/test';
|
||||
|
||||
import { getToastText } from '@/storybook/play/toastText';
|
||||
import { hoverTruncatableText } from '@/storybook/play/truncatedText';
|
||||
|
||||
import { SpanDetailVariant } from '../../SpanDetailsPanel/constants';
|
||||
import {
|
||||
@@ -27,6 +28,7 @@ import {
|
||||
focusSpanAttributes,
|
||||
focusSpanEventCount,
|
||||
focusSpanIndex,
|
||||
LONG_EVENT_ATTRIBUTES,
|
||||
spanIdAt,
|
||||
spanMatchRows,
|
||||
traceHasEvents,
|
||||
@@ -353,6 +355,37 @@ export const hoverEventStacktrace = async (
|
||||
);
|
||||
};
|
||||
|
||||
export const hoverLongEventAttributes = async (
|
||||
context: PageContext,
|
||||
): Promise<void> => {
|
||||
const { canvasElement, args } = context;
|
||||
|
||||
// The dialog panel renders outside the canvas, where the Events tab lookup misses it.
|
||||
if (
|
||||
!showsSpanPanel(args) ||
|
||||
args.panelPosition === SpanDetailVariant.DIALOG ||
|
||||
focusSpanEventCount(traceOf(args)) === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
await openSpanEvents(context);
|
||||
|
||||
// The long texts are sized to be cut in the right-docked panel; other docks measure.
|
||||
const longCut =
|
||||
args.panelPosition === SpanDetailVariant.DOCKED_RIGHT || undefined;
|
||||
const texts: [string, boolean | undefined][] = [
|
||||
['exception.type', false],
|
||||
[LONG_EVENT_ATTRIBUTES.endpointKey, longCut],
|
||||
[LONG_EVENT_ATTRIBUTES.endpoint, longCut],
|
||||
[LONG_EVENT_ATTRIBUTES.responseKey, longCut],
|
||||
];
|
||||
for (const [text, cut] of texts) {
|
||||
const [label] = await within(canvasElement).findAllByText(text);
|
||||
await hoverTruncatableText(label, text, { cut });
|
||||
}
|
||||
};
|
||||
|
||||
export const copyTraceId = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
|
||||
@@ -381,6 +381,27 @@ const stacktraceOf = (span: BuiltSpan): string =>
|
||||
' at async handle (/app/src/checkout/handler.ts:127:22)',
|
||||
].join('\n');
|
||||
|
||||
const UPSTREAM =
|
||||
'payments-authorisation-worker.production-us-east-2.svc.cluster.local';
|
||||
|
||||
/**
|
||||
* Event attributes too long for the panel. `endpoint` stays at 100 characters
|
||||
* or fewer, so it renders plain; a longer value goes behind the preview popover.
|
||||
*/
|
||||
export const LONG_EVENT_ATTRIBUTES = {
|
||||
endpointKey: `upstream.${UPSTREAM}.authorisation.endpoint.url`,
|
||||
endpoint: `https://${UPSTREAM}:8443/v2/authorise?r=3`,
|
||||
responseKey: `upstream.${UPSTREAM}.authorisation.response.body`,
|
||||
};
|
||||
|
||||
const UPSTREAM_RESPONSE = JSON.stringify({
|
||||
error: 'circuit_open',
|
||||
upstream: 'payments-authorisation-worker',
|
||||
retry_after_ms: 1500,
|
||||
attempts: 3,
|
||||
region: 'us-east-2',
|
||||
});
|
||||
|
||||
const eventsOf = (span: BuiltSpan): SpantypesWaterfallSpanDTO['events'] =>
|
||||
span.hasError
|
||||
? [
|
||||
@@ -393,6 +414,8 @@ const eventsOf = (span: BuiltSpan): SpantypesWaterfallSpanDTO['events'] =>
|
||||
'exception.type': 'UpstreamUnavailable',
|
||||
'exception.message': `${span.template.service} refused the request`,
|
||||
'exception.stacktrace': stacktraceOf(span),
|
||||
[LONG_EVENT_ATTRIBUTES.endpointKey]: LONG_EVENT_ATTRIBUTES.endpoint,
|
||||
[LONG_EVENT_ATTRIBUTES.responseKey]: UPSTREAM_RESPONSE,
|
||||
},
|
||||
isError: true,
|
||||
},
|
||||
|
||||
60
frontend/src/storybook/play/truncatedText.ts
Normal file
60
frontend/src/storybook/play/truncatedText.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { expect, screen, userEvent, waitFor } from 'storybook/test';
|
||||
|
||||
// `Typography` counts text as cut only past this much overflow.
|
||||
const TRUNCATION_TOLERANCE_PX = 1;
|
||||
// Longer than the tooltip's open delay, so a tooltip that would open has opened.
|
||||
const PAST_OPEN_DELAY_MS = 600;
|
||||
|
||||
const tooltipsHolding = (text: string): HTMLElement[] =>
|
||||
screen
|
||||
.queryAllByRole('tooltip')
|
||||
.filter((tooltip) => tooltip.textContent?.includes(text));
|
||||
|
||||
/**
|
||||
* Hovers a `Typography` with `textOverflow="ellipsis"` and checks its tooltip:
|
||||
* one tooltip with the full text once while the text is cut, none while it
|
||||
* fits. Nested tooltips on one trigger merge into one, so a duplicate shows as
|
||||
* the text repeated inside it; an outer antd tooltip shows as a second one.
|
||||
*
|
||||
* `cut` fails the play when the layout stops cutting the text, or starts to;
|
||||
* leave it out where a control decides the width. `label` is the Typography
|
||||
* element itself, so a `flex` Typography, whose text sits in an inner span,
|
||||
* does not fit.
|
||||
*/
|
||||
export const hoverTruncatableText = async (
|
||||
label: HTMLElement,
|
||||
text: string,
|
||||
{ cut }: { cut?: boolean } = {},
|
||||
): Promise<void> => {
|
||||
// A width read before the font loads differs from the one `Typography` acts on.
|
||||
await document.fonts.ready;
|
||||
const isCut = label.scrollWidth - label.clientWidth > TRUNCATION_TOLERANCE_PX;
|
||||
if (cut !== undefined) {
|
||||
await expect(isCut).toBe(cut);
|
||||
}
|
||||
|
||||
if (!isCut) {
|
||||
await userEvent.hover(label);
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, PAST_OPEN_DELAY_MS);
|
||||
});
|
||||
await expect(tooltipsHolding(text)).toHaveLength(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// A hover before the text is measured finds no tooltip to open.
|
||||
await waitFor(() => expect(label).toHaveAttribute('data-truncated'));
|
||||
await userEvent.hover(label);
|
||||
|
||||
await waitFor(async () => {
|
||||
await expect(tooltipsHolding(text)[0]).toBeVisible();
|
||||
});
|
||||
// antd opens after 100ms and `Typography` after 300ms, so count once both have.
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, PAST_OPEN_DELAY_MS);
|
||||
});
|
||||
|
||||
const tooltips = tooltipsHolding(text);
|
||||
await expect(tooltips).toHaveLength(1);
|
||||
await expect(tooltips[0].textContent?.split(text)).toHaveLength(2);
|
||||
};
|
||||
Reference in New Issue
Block a user